mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-21 09:02:07 -07:00
Tick through event manager
This commit is contained in:
parent
aa6e69cff2
commit
9edca5beb5
3 changed files with 10 additions and 15 deletions
|
|
@ -58,18 +58,20 @@ public class GlobalEventManager implements CallBack {
|
|||
|
||||
while(iterator.hasNext()) {
|
||||
Map.Entry<String, Long> entry = iterator.next();
|
||||
Long ticksRemaining = entry.getValue();
|
||||
if (entry.getValue() > 0) {
|
||||
entry.setValue(entry.getValue() - 1);
|
||||
if (entry.getValue() == 3000)
|
||||
entry.setValue(--ticksRemaining);
|
||||
if (ticksRemaining == 3000)
|
||||
message("You have 30 minutes before the " + entry.getKey() + " event ends on world " + GameWorld.getSettings().getWorldId() + ".");
|
||||
|
||||
if (entry.getValue() <= 0) {
|
||||
if (ticksRemaining <= 0) {
|
||||
message("The " + entry.getKey() + " event has now ended on world " + GameWorld.getSettings().getWorldId() + ".");
|
||||
}
|
||||
System.out.println("The " + entry.getKey() + " event has " + ticksRemaining + " ticks remaining");
|
||||
}
|
||||
}
|
||||
|
||||
if (tick == 50) {
|
||||
if (tick == 100) {
|
||||
tick = 0;
|
||||
save();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ public final class GameWorld {
|
|||
switch(cfTicks) {
|
||||
case 100:
|
||||
if (checkDay()) {
|
||||
GlobalEventManager.get().activate("Clone Fest", null);
|
||||
GlobalEventManager.get().activate("Clone Fest", null, 2000);
|
||||
if (GlobalEventManager.get().isActive("Clone Fest")) {
|
||||
int size = 20;
|
||||
if (PVPAIPActions.pvp_players == null) {
|
||||
|
|
@ -162,15 +162,7 @@ public final class GameWorld {
|
|||
}
|
||||
}
|
||||
break;
|
||||
case 1100:
|
||||
if (PVPAIPActions.pvp_players == null) {
|
||||
GlobalEventManager.get().deactivate("Clone Fest");
|
||||
}
|
||||
break;
|
||||
case 1500:
|
||||
GlobalEventManager.get().deactivate("Clone Fest");
|
||||
break;
|
||||
case 1900:
|
||||
case 2100:
|
||||
cfTicks = 0;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import org.crandor.game.content.eco.ge.GEOfferDispatch;
|
|||
import org.crandor.game.content.holiday.HolidayEvent;
|
||||
import org.crandor.game.content.skill.member.farming.FarmingPulse;
|
||||
import org.crandor.game.content.skill.member.hunter.ImpetuousImpulses;
|
||||
import org.crandor.game.events.GlobalEventManager;
|
||||
import org.crandor.game.system.SystemLogger;
|
||||
import org.crandor.game.world.map.zone.ZoneBuilder;
|
||||
|
||||
|
|
@ -40,7 +41,7 @@ public final class CallbackHub {
|
|||
calls.add(new GEOfferDispatch());
|
||||
calls.add(new FarmingPulse());
|
||||
calls.add(new ImpetuousImpulses());
|
||||
// calls.add(GlobalEventManager.get());
|
||||
calls.add(GlobalEventManager.get());
|
||||
for (CallBack call : calls) {
|
||||
if (!call.call()) {
|
||||
SystemLogger.error("A callback was stopped, callback=" + call.getClass().getSimpleName() + ".");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue