Reformatted file.

This commit is contained in:
2023-02-22 08:34:10 -05:00
parent 4db45a9cbf
commit f723e35785
5 changed files with 584 additions and 593 deletions
@@ -19,77 +19,77 @@ import engine.session.Session;
/*
* @Author:
* @Summary: Processes application protocol message which displays
* the map interface. (Zones, Cities, Realms, Hotzones)
* the map interface. (Zones, Cities, Realms, Hot-zones)
*/
public class CityDataHandler extends AbstractClientMsgHandler {
public CityDataHandler() {
super(KeepAliveServerClientMsg.class);
}
public CityDataHandler() {
super(KeepAliveServerClientMsg.class);
}
@Override
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
@Override
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
boolean updateMine = false;
boolean updateCity = false;
Session playerSession;
PlayerCharacter playerCharacter;
Zone hotZone;
boolean updateMine = false;
boolean updateCity = false;
Session playerSession;
PlayerCharacter playerCharacter;
Zone hotZone;
playerCharacter = origin.getPlayerCharacter();
playerCharacter = origin.getPlayerCharacter();
if (playerCharacter == null)
return true;
if (playerCharacter == null)
return true;
// Session is needed as param for worldObjectMsg.
// Session is needed as param for worldObjectMsg.
playerSession = SessionManager.getSession(playerCharacter);
playerSession = SessionManager.getSession(playerCharacter);
if (playerSession == null)
return true;
if (playerSession == null)
return true;
// Cache current hotZone
// Cache current hotZone
hotZone = ZoneManager.getHotZone();
hotZone = ZoneManager.getHotZone();
// No reason to serialize cities and mines everytime map is
// opened. Wait until something has changed.
// No reason to serialize cities and mines everytime map is
// opened. Wait until something has changed.
if (playerCharacter.getTimeStamp("mineupdate") <= Mine.getLastChange()){
playerCharacter.setTimeStamp("mineupdate", System.currentTimeMillis());
updateMine = true;
}
if (playerCharacter.getTimeStamp("mineupdate") <= Mine.getLastChange()) {
playerCharacter.setTimeStamp("mineupdate", System.currentTimeMillis());
updateMine = true;
}
if (playerCharacter.getTimeStamp("cityUpdate") <= City.lastCityUpdate){
playerCharacter.setTimeStamp("cityUpdate", System.currentTimeMillis());
updateCity = true;
}
if (playerCharacter.getTimeStamp("cityUpdate") <= City.lastCityUpdate) {
playerCharacter.setTimeStamp("cityUpdate", System.currentTimeMillis());
updateCity = true;
}
cityDataMsg cityDataMsg = new cityDataMsg(SessionManager.getSession(playerCharacter), false);
cityDataMsg.updateMines(updateMine);
cityDataMsg.updateCities(updateCity);
cityDataMsg cityDataMsg = new cityDataMsg(SessionManager.getSession(playerCharacter), false);
cityDataMsg.updateMines(updateMine);
cityDataMsg.updateCities(updateCity);
Dispatch dispatch = Dispatch.borrow(playerCharacter, cityDataMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
Dispatch dispatch = Dispatch.borrow(playerCharacter, cityDataMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
if (playerCharacter.getTimeStamp("hotzoneupdate") <= WorldServer.getLastHZChange()) {
if (playerCharacter.getTimeStamp("hotzoneupdate") <= WorldServer.getLastHZChange()) {
if (hotZone != null) {
HotzoneChangeMsg hotzoneChangeMsg = new HotzoneChangeMsg(Enum.GameObjectType.Zone.ordinal(), hotZone.getObjectUUID());
dispatch = Dispatch.borrow(playerCharacter, hotzoneChangeMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
playerCharacter.setTimeStamp("hotzoneupdate", System.currentTimeMillis() - 100);
}
}
if (hotZone != null) {
HotzoneChangeMsg hotzoneChangeMsg = new HotzoneChangeMsg(Enum.GameObjectType.Zone.ordinal(), hotZone.getObjectUUID());
dispatch = Dispatch.borrow(playerCharacter, hotzoneChangeMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
playerCharacter.setTimeStamp("hotzoneupdate", System.currentTimeMillis() - 100);
}
}
// Serialize the realms for this map
// Serialize the realms for this map
WorldRealmMsg worldRealmMsg = new WorldRealmMsg();
dispatch = Dispatch.borrow(playerCharacter, worldRealmMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
WorldRealmMsg worldRealmMsg = new WorldRealmMsg();
dispatch = Dispatch.borrow(playerCharacter, worldRealmMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
}
return true;
}
}