Code improvements.
This commit is contained in:
@@ -56,30 +56,27 @@ final class LoveYourGatekeeper extends LongTimeEvent
|
||||
{
|
||||
case "transform_stick":
|
||||
{
|
||||
if (player.getAdena() >= PRICE)
|
||||
if (player.getAdena() < PRICE)
|
||||
{
|
||||
final long reuse = player.getVariables().getLong(REUSE, 0);
|
||||
if (reuse > System.currentTimeMillis())
|
||||
{
|
||||
final long remainingTime = (reuse - System.currentTimeMillis()) / 1000;
|
||||
final int hours = (int) (remainingTime / 3600);
|
||||
final int minutes = (int) ((remainingTime % 3600) / 60);
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_WILL_BE_AVAILABLE_FOR_RE_USE_AFTER_S2_HOUR_S_S3_MINUTE_S);
|
||||
sm.addItemName(GATEKEEPER_TRANSFORMATION_STICK);
|
||||
sm.addInt(hours);
|
||||
sm.addInt(minutes);
|
||||
player.sendPacket(sm);
|
||||
}
|
||||
else
|
||||
{
|
||||
takeItems(player, Inventory.ADENA_ID, PRICE);
|
||||
giveItems(player, GATEKEEPER_TRANSFORMATION_STICK, 1);
|
||||
player.getVariables().set(REUSE, System.currentTimeMillis() + (HOURS * 3600000));
|
||||
}
|
||||
return "32477-3.htm";
|
||||
}
|
||||
final long reuse = player.getVariables().getLong(REUSE, 0);
|
||||
if (reuse > System.currentTimeMillis())
|
||||
{
|
||||
final long remainingTime = (reuse - System.currentTimeMillis()) / 1000;
|
||||
final int hours = (int) (remainingTime / 3600);
|
||||
final int minutes = (int) ((remainingTime % 3600) / 60);
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_WILL_BE_AVAILABLE_FOR_RE_USE_AFTER_S2_HOUR_S_S3_MINUTE_S);
|
||||
sm.addItemName(GATEKEEPER_TRANSFORMATION_STICK);
|
||||
sm.addInt(hours);
|
||||
sm.addInt(minutes);
|
||||
player.sendPacket(sm);
|
||||
}
|
||||
else
|
||||
{
|
||||
return "32477-3.htm";
|
||||
takeItems(player, Inventory.ADENA_ID, PRICE);
|
||||
giveItems(player, GATEKEEPER_TRANSFORMATION_STICK, 1);
|
||||
player.getVariables().set(REUSE, System.currentTimeMillis() + (HOURS * 3600000));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user