mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-31 00:15:54 -04:00
92 lines
2.4 KiB
Plaintext
92 lines
2.4 KiB
Plaintext
/**
|
|
* Copyright (c)2000-2002 Sony Online Entertainment Inc.
|
|
* All Rights Reserved
|
|
*
|
|
* Title: terminal_food.script
|
|
* Description: BETA SCRIPT: food dispenser
|
|
* @author $Author:$
|
|
* @version $Revision:$
|
|
*/
|
|
|
|
/***** INCLUDES ********************************************************/
|
|
|
|
include library.money;
|
|
|
|
/***** INHERITS ********************************************************/
|
|
|
|
inherits terminal.base.terminal_add_use;
|
|
|
|
/***** CONSTANTS *******************************************************/
|
|
|
|
const int CASH_AMOUNT = 10000;
|
|
|
|
/***** TRIGGERS ********************************************************/
|
|
trigger OnObjectMenuSelect(obj_id player, int item)
|
|
{
|
|
if (isGod(player) || hasObjVar(player, "beta.terminal_ok"))
|
|
{
|
|
|
|
if ( item == menu_info_types.ITEM_USE )
|
|
{
|
|
if ( getCashBalance(player) < 1000000 )
|
|
{
|
|
dictionary d = new dictionary();
|
|
d.put("payoutTarget", player);
|
|
|
|
money.systemPayout(money.ACCT_BETA_TEST, self, CASH_AMOUNT, "handlePayoutToPlayer", d);
|
|
}
|
|
else
|
|
{
|
|
sendSystemMessageTestingOnly(player, "You already have 1,000,000+ credits. Why do you need any more money?");
|
|
}
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
else
|
|
{
|
|
sendSystemMessageTestingOnly(player, "Only authorized users may access this terminal.");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
|
|
/***** FUNCTIONS *******************************************************/
|
|
messageHandler handlePayoutToPlayer()
|
|
{
|
|
obj_id player = params.getObjId("payoutTarget");
|
|
if ( !isIdValid(player) )
|
|
return SCRIPT_CONTINUE;
|
|
|
|
int retCode = params.getInt(money.DICT_CODE);
|
|
if ( retCode == money.RET_SUCCESS )
|
|
{
|
|
transferCashTo(self, player, CASH_AMOUNT, "handlePayoutSuccess", "handlePayoutFail", params);
|
|
}
|
|
else
|
|
{
|
|
sendSystemMessageTestingOnly(player, "The system is unable to complete the transaction. Please try again later.");
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
messageHandler handlePayoutSuccess()
|
|
{
|
|
obj_id player = params.getObjId("payoutTarget");
|
|
if ( !isIdValid(player) )
|
|
return SCRIPT_CONTINUE;
|
|
|
|
sendSystemMessageTestingOnly(player, "You recieve " + CASH_AMOUNT + " credits from " + getString(getNameStringId(self)));
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
messageHandler handlePayoutFail()
|
|
{
|
|
obj_id player = params.getObjId("payoutTarget");
|
|
if ( !isIdValid(player) )
|
|
return SCRIPT_CONTINUE;
|
|
|
|
sendSystemMessageTestingOnly(player, "The system is unable to complete the transaction. Please try again later.");
|
|
return SCRIPT_CONTINUE;
|
|
}
|