Forums WoW Modding Discussion Miscellaneous [Archive] .PHP Command line! (Help)

[Archive] .PHP Command line! (Help)

[Archive] .PHP Command line! (Help)

rektbyfaith
Administrator
0
11-04-2025, 05:14 PM
#1
Archived author: Leaf • Posted: 2025-11-04T18:14:24.011252
Original source

Hey Emucoach! So I am setting up a CMS with the function to send gold to whomever bought it on the website. Now, I get an error every time someone tries to execute the command and I think that I have found the actual command for sending the gold. The only problem is that I don't have much knowledge regarding PHP. If someone that know the commands on the Emucoach Repack and has a bit of knowledge on PHP then maybe you could help be correct the code so that it works for the Emucoach Repack!​

.PHP Code:

//send the gold

$sentGold =$command->sendMoney($character, ($GoldAmount * 10000), 'In-Game Gold Delivery', $RealmId);

Any clue on how this could be changed to work with the Emucoach Repack?

[Image: 347-f9143aa1fc042dbf13130f11123154b1.jpg...-RQ6ofwELb]

[Image: 351-aa2ab0d0ff1803e39df009b556327ca1.jpg...qiqw0P8YA-]

Thank you!

Best Regards!
rektbyfaith
11-04-2025, 05:14 PM #1

Archived author: Leaf • Posted: 2025-11-04T18:14:24.011252
Original source

Hey Emucoach! So I am setting up a CMS with the function to send gold to whomever bought it on the website. Now, I get an error every time someone tries to execute the command and I think that I have found the actual command for sending the gold. The only problem is that I don't have much knowledge regarding PHP. If someone that know the commands on the Emucoach Repack and has a bit of knowledge on PHP then maybe you could help be correct the code so that it works for the Emucoach Repack!​

.PHP Code:

//send the gold

$sentGold =$command->sendMoney($character, ($GoldAmount * 10000), 'In-Game Gold Delivery', $RealmId);

Any clue on how this could be changed to work with the Emucoach Repack?

[Image: 347-f9143aa1fc042dbf13130f11123154b1.jpg...-RQ6ofwELb]

[Image: 351-aa2ab0d0ff1803e39df009b556327ca1.jpg...qiqw0P8YA-]

Thank you!

Best Regards!

rektbyfaith
Administrator
0
11-04-2025, 05:14 PM
#2
Archived author: Leaf • Posted: 2025-11-04T18:14:24.011252
Original source

Try to replace into excuting files / purchase gold
Quote: <?PHP

if (!defined('init_executes'))

{

header('HTTP/1.0 404 not found');

exit;

}

$CORE->loggedInOrReturn();

//load the coin activity handler

$CORE->load_CoreModule('coin.activity');

//load the characters handling class

$CORE->load_ServerModule('character');

//load the log class

$CORE->load_CoreModule('purchaseLog');

//load the sendmail class

$CORE->load_ServerModule('commands');

$CORE->load_CoreModule('accounts.finances');

//prepare the sendmail class

$command = new server_Commands();

//prepare the log

$logs = new purchaseLog();

//levels data

$LevelsData = new LevelsData();

//Setup the finances class

$finance = new AccountFinances();

//prepare multi errors

$ERRORS->NewInstance('pStore_gold');

//bind the onsuccess message

$ERRORS->onSuccess('Your purchase has been successfully delivered.', '/index.php?page=purchase_gold');

$character = (isset($_POST['character']) ? $_POST['character'] : false);

$GoldAmount = (isset($_POST['amount']) ? (int)$_POST['amount'] : false);

//assume the realm is 1 (for now)

$RealmId = $CURUSER->GetRealm();

if (!$character)

{

$ERRORS->Add("Please select a character first.");

}

if (!$GoldAmount)

{

$ERRORS->Add("Please enter the amount of gold you would like to purchase.");

}

else

{

//Verify the gold amount

if ($GoldAmount < 1000)

{

$GoldAmount = 1000;

}

//check for the limit

if ($GoldAmount > 100000)

{

$ERRORS->Add("The maximum that you can purchase is 100,000 gold.");

}

}

$ERRORS->Check('/index.php?page=purchase_gold');

//Calculate the cost

//get the left overs

$leftOver = $GoldAmount % 1000;

//any left over costs +1 gold coin

if ($leftOver > 0)

{

$GoldAmount -= $leftOver;

$GoldAmount += 1000;

}

//calculate the price

$price = $GoldAmount / 1000;

######################################

######### CHECK FINANCES #############

$finance->SetCurrency(CURRENCY_GOLD);

$finance->SetAmount($price);

//check if the user has enough balance

if ($BalanceError = $finance->CheckBalance())

{

if (is_array($BalanceError))

{

//insufficient amount

foreach ($BalanceError as $currency)

{

$ERRORS->Add("You do not have enough " . ucfirst($currency) . " Coins.");

}

}

else

{

//technical error

$ERRORS->Add('Error, the website failed to verify your account balance.');

}

}

unset($BalanceError);

$ERRORS->Check('/index.php?page=purchase_gold');

####################################################################

## The actual script begins here

//construct the characters handler

$chars = new server_Character();

//start logging

$logs->add('PSTORE_GOLD', 'Starting log session. Using currency: Gold Coins, Amount of Purchase: '.$GoldAmount.', selected realm: '.$RealmId.'.', 'pending');

//set the realm

if ($chars->setRealm($RealmId))

{

//check if the character belongs to this account

if ($chars->isMyCharacter(false, $character))

{

//send the gold

$sentGold = $command->sendMoney($character, ($GoldAmount * 10000), 'In-Game Gold Delivery', $RealmId);

//check if any of the actions have failed and log it

if ($sentGold !== true)

{

$logs->update(false, 'The website failed to execute the send money command and returned: '.$sentGold.'.', 'error');

$ERRORS->Add("The website failed to deliver your purchase. Please contact the administration.");

}

else //check if one of those actions was successful

{

//charge for the purchase

$Charge = $finance->Charge("In-Game Gold", CA_SOURCE_TYPE_PURCHASE);

if ($Charge === true)

{

//update the log

$logs->update(false, 'The user has been charged for his purchase.', 'ok');

}

else

{

//update the log

$logs->update(false, 'The user was not charged for his purchase, website failed to update.', 'error');

}

unset($Charge);

//free up some memory

unset($finance);

}

//check for fatal errors before proceeding to the complete page

$ERRORS->Check('/index.php?page=purchase_gold');

//redirect

$ERRORS->triggerSuccess();

}

else

{

$ERRORS->Add("The selected character does not belong to this account.");

//log

$logs->update(false, 'The user is trying to purchase gold for character from another account.', 'error');

}

}

else

{

$ERRORS->Add("The website failed to load realm database. Please contact the administration for more information.");

//log

$logs->update(false, 'The website failed to load realm database.', 'error');

}

unset($logs);

unset($chars);

####################################################################

$ERRORS->Check('/index.php?page=purchase_gold');

exit;

Click to expand...
rektbyfaith
11-04-2025, 05:14 PM #2

Archived author: Leaf • Posted: 2025-11-04T18:14:24.011252
Original source

Try to replace into excuting files / purchase gold

Quote: <?PHP

if (!defined('init_executes'))

{

header('HTTP/1.0 404 not found');

exit;

}

$CORE->loggedInOrReturn();

//load the coin activity handler

$CORE->load_CoreModule('coin.activity');

//load the characters handling class

$CORE->load_ServerModule('character');

//load the log class

$CORE->load_CoreModule('purchaseLog');

//load the sendmail class

$CORE->load_ServerModule('commands');

$CORE->load_CoreModule('accounts.finances');

//prepare the sendmail class

$command = new server_Commands();

//prepare the log

$logs = new purchaseLog();

//levels data

$LevelsData = new LevelsData();

//Setup the finances class

$finance = new AccountFinances();

//prepare multi errors

$ERRORS->NewInstance('pStore_gold');

//bind the onsuccess message

$ERRORS->onSuccess('Your purchase has been successfully delivered.', '/index.php?page=purchase_gold');

$character = (isset($_POST['character']) ? $_POST['character'] : false);

$GoldAmount = (isset($_POST['amount']) ? (int)$_POST['amount'] : false);

//assume the realm is 1 (for now)

$RealmId = $CURUSER->GetRealm();

if (!$character)

{

$ERRORS->Add("Please select a character first.");

}

if (!$GoldAmount)

{

$ERRORS->Add("Please enter the amount of gold you would like to purchase.");

}

else

{

//Verify the gold amount

if ($GoldAmount < 1000)

{

$GoldAmount = 1000;

}

//check for the limit

if ($GoldAmount > 100000)

{

$ERRORS->Add("The maximum that you can purchase is 100,000 gold.");

}

}

$ERRORS->Check('/index.php?page=purchase_gold');

//Calculate the cost

//get the left overs

$leftOver = $GoldAmount % 1000;

//any left over costs +1 gold coin

if ($leftOver > 0)

{

$GoldAmount -= $leftOver;

$GoldAmount += 1000;

}

//calculate the price

$price = $GoldAmount / 1000;

######################################

######### CHECK FINANCES #############

$finance->SetCurrency(CURRENCY_GOLD);

$finance->SetAmount($price);

//check if the user has enough balance

if ($BalanceError = $finance->CheckBalance())

{

if (is_array($BalanceError))

{

//insufficient amount

foreach ($BalanceError as $currency)

{

$ERRORS->Add("You do not have enough " . ucfirst($currency) . " Coins.");

}

}

else

{

//technical error

$ERRORS->Add('Error, the website failed to verify your account balance.');

}

}

unset($BalanceError);

$ERRORS->Check('/index.php?page=purchase_gold');

####################################################################

## The actual script begins here

//construct the characters handler

$chars = new server_Character();

//start logging

$logs->add('PSTORE_GOLD', 'Starting log session. Using currency: Gold Coins, Amount of Purchase: '.$GoldAmount.', selected realm: '.$RealmId.'.', 'pending');

//set the realm

if ($chars->setRealm($RealmId))

{

//check if the character belongs to this account

if ($chars->isMyCharacter(false, $character))

{

//send the gold

$sentGold = $command->sendMoney($character, ($GoldAmount * 10000), 'In-Game Gold Delivery', $RealmId);

//check if any of the actions have failed and log it

if ($sentGold !== true)

{

$logs->update(false, 'The website failed to execute the send money command and returned: '.$sentGold.'.', 'error');

$ERRORS->Add("The website failed to deliver your purchase. Please contact the administration.");

}

else //check if one of those actions was successful

{

//charge for the purchase

$Charge = $finance->Charge("In-Game Gold", CA_SOURCE_TYPE_PURCHASE);

if ($Charge === true)

{

//update the log

$logs->update(false, 'The user has been charged for his purchase.', 'ok');

}

else

{

//update the log

$logs->update(false, 'The user was not charged for his purchase, website failed to update.', 'error');

}

unset($Charge);

//free up some memory

unset($finance);

}

//check for fatal errors before proceeding to the complete page

$ERRORS->Check('/index.php?page=purchase_gold');

//redirect

$ERRORS->triggerSuccess();

}

else

{

$ERRORS->Add("The selected character does not belong to this account.");

//log

$logs->update(false, 'The user is trying to purchase gold for character from another account.', 'error');

}

}

else

{

$ERRORS->Add("The website failed to load realm database. Please contact the administration for more information.");

//log

$logs->update(false, 'The website failed to load realm database.', 'error');

}

unset($logs);

unset($chars);

####################################################################

$ERRORS->Check('/index.php?page=purchase_gold');

exit;

Click to expand...

rektbyfaith
Administrator
0
11-04-2025, 05:14 PM
#3
Archived author: Leaf • Posted: 2025-11-04T18:14:24.011252
Original source

Quote:cliffsmits said:

Try to replace into excuting files / purchase gold

Click to expand...
Thank you! I will try that later! Hope that it works :good:
rektbyfaith
11-04-2025, 05:14 PM #3

Archived author: Leaf • Posted: 2025-11-04T18:14:24.011252
Original source

Quote:cliffsmits said:

Try to replace into excuting files / purchase gold

Click to expand...
Thank you! I will try that later! Hope that it works :good:

Recently Browsing
 1 Guest(s)
Recently Browsing
 1 Guest(s)