Files
dsrc/sku.0/sys.server/compiled/game/script/cureward/cureward.java
2018-06-07 00:32:29 +01:00

60 lines
1.8 KiB
Java
Executable File

package script.cureward;
import script.dictionary;
import script.obj_id;
public class cureward extends script.base_script
{
public cureward()
{
}
public int OnAttach(obj_id self) throws InterruptedException
{
if (getConfigSetting("GameServer", "combatUpgradeReward") == null)
{
return SCRIPT_CONTINUE;
}
if (!createRewards(self))
{
messageTo(self, "handleRetryRewardNextLogin", null, 1, false);
}
return SCRIPT_CONTINUE;
}
public int OnInitialize(obj_id self) throws InterruptedException
{
if (getConfigSetting("GameServer", "combatUpgradeReward") == null)
{
detachScript(self, "cureward.cureward");
}
return SCRIPT_CONTINUE;
}
public boolean createRewards(obj_id self) throws InterruptedException
{
int bornOnDate = getPlayerBirthDate(self);
if (bornOnDate > 1579)
{
return true;
}
String cuRewardOption = getConfigSetting("GameServer", "combatUpgradeReward");
obj_id reward = createObjectInInventoryAllowOverload("object/tangible/event_perk/frn_loyalty_award_plaque_silver.iff", self);
if (!isIdValid(reward))
{
return false;
}
if (cuRewardOption.equals("2"))
{
reward = createObjectInInventoryAllowOverload("object/tangible/event_perk/frn_loyalty_award_plaque_gold.iff", self);
if (!isIdValid(reward))
{
return false;
}
}
return true;
}
public int handleRetryRewardNextLogin(obj_id self, dictionary params) throws InterruptedException
{
detachScript(self, "cureward.cureward");
return SCRIPT_CONTINUE;
}
}