Remove hunting time as needed.

Thanks to Hiroshi.
This commit is contained in:
MobiusDevelopment
2021-04-28 13:37:35 +00:00
parent 99a6553f63
commit c8e919b609
36 changed files with 555 additions and 381 deletions

View File

@@ -57,7 +57,7 @@ public class AddHuntingTime extends AbstractEffect
}
final long currentTime = Chronos.currentTimeMillis();
long endTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, 0);
long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
if ((_zoneId == 8) && (endTime > currentTime) && (((endTime - currentTime) + _time) >= Config.TIME_LIMITED_MAX_ADDED_TIME_WEEKLY))
{
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
@@ -73,8 +73,7 @@ public class AddHuntingTime extends AbstractEffect
if (player.isInTimedHuntingZone(_zoneId))
{
endTime = _time + player.getTimedHuntingZoneRemainingTime();
player.getVariables().set(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, currentTime + endTime);
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, _time + player.getTimedHuntingZoneRemainingTime(_zoneId));
player.startTimedHuntingZone(_zoneId, endTime);
}
else
@@ -91,7 +90,7 @@ public class AddHuntingTime extends AbstractEffect
{
endTime = currentTime;
}
player.getVariables().set(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, endTime + _time);
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, (endTime - currentTime) + _time);
}
player.sendPacket(new TimedHuntingZoneList(player));