Browse Source

Mine claims released when leaving world.

master
MagicBot 2 years ago
parent
commit
c6e0680583
  1. 40
      src/engine/server/world/WorldServer.java

40
src/engine/server/world/WorldServer.java

@ -623,49 +623,53 @@ public class WorldServer {
return; return;
} }
PlayerCharacter pc = SessionManager.getPlayerCharacter( PlayerCharacter playerCharacter = SessionManager.getPlayerCharacter(
origin); origin);
if (pc == null) if (playerCharacter == null)
// TODO log this // TODO log this
return; return;
//cancel any trade //cancel any trade
if (pc.getCharItemManager() != null) if (playerCharacter.getCharItemManager() != null)
pc.getCharItemManager().endTrade(true); playerCharacter.getCharItemManager().endTrade(true);
// Release any mine claims
Mine.releaseMineClaims(playerCharacter);
// logout // logout
long delta = MBServerStatics.LOGOUT_TIMER_MS; long delta = MBServerStatics.LOGOUT_TIMER_MS;
if (System.currentTimeMillis() - pc.getTimeStamp("LastCombatPlayer") < 60000) { if (System.currentTimeMillis() - playerCharacter.getTimeStamp("LastCombatPlayer") < 60000) {
delta = 60000; delta = 60000;
} }
pc.stopMovement(pc.getLoc()); playerCharacter.stopMovement(playerCharacter.getLoc());
UpdateStateMsg updateStateMsg = new UpdateStateMsg(); UpdateStateMsg updateStateMsg = new UpdateStateMsg();
updateStateMsg.setPlayer(pc); updateStateMsg.setPlayer(playerCharacter);
updateStateMsg.setActivity(5); updateStateMsg.setActivity(5);
DispatchMessage.dispatchMsgToInterestArea(pc, updateStateMsg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false); DispatchMessage.dispatchMsgToInterestArea(playerCharacter, updateStateMsg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
if (pc.getRegion() != null) if (playerCharacter.getRegion() != null)
if (PlayerCharacter.CanBindToBuilding(pc, pc.getRegion().parentBuildingID)) if (PlayerCharacter.CanBindToBuilding(playerCharacter, playerCharacter.getRegion().parentBuildingID))
pc.bindBuilding = pc.getRegion().parentBuildingID; playerCharacter.bindBuilding = playerCharacter.getRegion().parentBuildingID;
else else
pc.bindBuilding = 0; playerCharacter.bindBuilding = 0;
pc.getLoadedObjects().clear(); playerCharacter.getLoadedObjects().clear();
pc.getLoadedStaticObjects().clear(); playerCharacter.getLoadedStaticObjects().clear();
LogoutCharacterJob logoutJob = new LogoutCharacterJob(pc, this); LogoutCharacterJob logoutJob = new LogoutCharacterJob(playerCharacter, this);
JobContainer jc = JobScheduler.getInstance().scheduleJob(logoutJob, JobContainer jc = JobScheduler.getInstance().scheduleJob(logoutJob,
System.currentTimeMillis() + delta); System.currentTimeMillis() + delta);
pc.getTimers().put("Logout", jc); playerCharacter.getTimers().put("Logout", jc);
pc.getTimestamps().put("logout", System.currentTimeMillis()); playerCharacter.getTimestamps().put("logout", System.currentTimeMillis());
//send update to friends that you are logged off. //send update to friends that you are logged off.
PlayerFriends.SendFriendsStatus(pc,false); PlayerFriends.SendFriendsStatus(playerCharacter,false);
} }

Loading…
Cancel
Save