Refactored usage of HotZone; added cycle counter.

This commit is contained in:
2023-02-22 16:40:11 -05:00
parent 6ac1911770
commit 8ae973f5f4
7 changed files with 35 additions and 41 deletions
@@ -1,5 +1,6 @@
package engine.net.client.handlers;
import engine.Enum;
import engine.Enum.DispatchChannel;
import engine.exception.MsgSendException;
import engine.gameManager.*;
@@ -125,10 +126,9 @@ public class ArcLoginNotifyMsgHandler extends AbstractClientMsgHandler {
}
//Send current hotzone
Zone hotzone = ZoneManager.getHotZone();
if (hotzone != null) {
HotzoneChangeMsg hcm = new HotzoneChangeMsg(hotzone.getObjectType().ordinal(), hotzone.getObjectUUID());
if (ZoneManager.hotZone != null) {
HotzoneChangeMsg hcm = new HotzoneChangeMsg(Enum.GameObjectType.Zone.ordinal(), ZoneManager.hotZone.getObjectUUID());
Dispatch dispatch = Dispatch.borrow(player, hcm);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
}
@@ -50,10 +50,6 @@ public class CityDataHandler extends AbstractClientMsgHandler {
if (playerSession == null)
return true;
// Cache current hotZone
hotZone = ZoneManager.getHotZone();
// No reason to serialize cities and mines everytime map is
// opened. Wait until something has changed.
@@ -76,8 +72,8 @@ public class CityDataHandler extends AbstractClientMsgHandler {
// If the hotZone has changed then update the client's map accordingly.
if (playerCharacter.getTimeStamp("hotzoneupdate") <= WorldServer.getLastHZChange() && hotZone != null) {
HotzoneChangeMsg hotzoneChangeMsg = new HotzoneChangeMsg(Enum.GameObjectType.Zone.ordinal(), hotZone.getObjectUUID());
if (playerCharacter.getTimeStamp("hotzoneupdate") <= WorldServer.getLastHZChange() && ZoneManager.hotZone != null) {
HotzoneChangeMsg hotzoneChangeMsg = new HotzoneChangeMsg(Enum.GameObjectType.Zone.ordinal(), ZoneManager.hotZone.getObjectUUID());
dispatch = Dispatch.borrow(playerCharacter, hotzoneChangeMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
playerCharacter.setTimeStamp("hotzoneupdate", System.currentTimeMillis() - 100);
+1 -1
View File
@@ -80,7 +80,7 @@ public class WorldDataMsg extends ClientNetMsg {
writer.putInt(getTotalMapSize(root) + 1);
Zone.serializeForClientMsg(root,writer);
Zone hotzone = ZoneManager.getHotZone();
Zone hotzone = ZoneManager.hotZone;;
if (hotzone == null)
writer.putLong(0L);