From 8ad30a129a688031b2b0a956bda72e43398a60db Mon Sep 17 00:00:00 2001 From: Astrologies Date: Fri, 31 Dec 2021 03:04:28 -0500 Subject: [PATCH] EconomyHelper impl update --- html/catalog/view.php | 19 +++++++------------ html/create/index.php | 3 ++- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/html/catalog/view.php b/html/catalog/view.php index 64a0846..b105a42 100644 --- a/html/catalog/view.php +++ b/html/catalog/view.php @@ -1,5 +1,6 @@ You don't have enough Alphabux"; - } - elseif ($result == 1) - { - $alert = ""; - } - elseif ($result == 2) - { - WebContextManager::Redirect("/catalog/view?id=". $id . ""); + try { + if (EconomyHelper::PurchaseItem($user->id, $id)) { + WebContextManager::Redirect("/catalog/view?id=". $id . ""); + } + } catch (Exception $e) { + $alert = ""; } } // ... diff --git a/html/create/index.php b/html/create/index.php index 8af6aac..f01de3b 100644 --- a/html/create/index.php +++ b/html/create/index.php @@ -5,6 +5,7 @@ Alphaland 2021 */ use Alphaland\Assets\Asset; +use Alphaland\Economy\EconomyHelper; use Alphaland\Web\WebContextManager; $body = ''; @@ -172,7 +173,7 @@ function uploadCosmetic() } //remove currency - if (!removeCurrency($minimumprice, "Creation of cosmetic name ".$name)) + if (!EconomyHelper::RemoveAlphabux($minimumprice, $GLOBALS['user']->id, "Creation of cosmetic name ".$name)) { return "You don't have enough currency"; }