|
|
@ -14,11 +14,8 @@ import engine.Enum.GameObjectType; |
|
|
|
import engine.InterestManagement.WorldGrid; |
|
|
|
import engine.InterestManagement.WorldGrid; |
|
|
|
import engine.exception.MsgSendException; |
|
|
|
import engine.exception.MsgSendException; |
|
|
|
import engine.gameManager.*; |
|
|
|
import engine.gameManager.*; |
|
|
|
import engine.job.JobContainer; |
|
|
|
|
|
|
|
import engine.job.JobScheduler; |
|
|
|
import engine.job.JobScheduler; |
|
|
|
import engine.jobs.RefreshGroupJob; |
|
|
|
import engine.jobs.RefreshGroupJob; |
|
|
|
import engine.jobs.StuckJob; |
|
|
|
|
|
|
|
import engine.math.Vector3fImmutable; |
|
|
|
|
|
|
|
import engine.net.Dispatch; |
|
|
|
import engine.net.Dispatch; |
|
|
|
import engine.net.DispatchMessage; |
|
|
|
import engine.net.DispatchMessage; |
|
|
|
import engine.net.NetMsgHandler; |
|
|
|
import engine.net.NetMsgHandler; |
|
|
@ -34,7 +31,6 @@ import engine.util.StringUtils; |
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
|
|
|
|
|
|
|
|
import java.sql.SQLException; |
|
|
|
import java.sql.SQLException; |
|
|
|
import java.util.concurrent.ConcurrentHashMap; |
|
|
|
|
|
|
|
import java.util.concurrent.ThreadLocalRandom; |
|
|
|
import java.util.concurrent.ThreadLocalRandom; |
|
|
|
|
|
|
|
|
|
|
|
import static engine.math.FastMath.sqr; |
|
|
|
import static engine.math.FastMath.sqr; |
|
|
@ -155,38 +151,6 @@ public class ClientMessagePump implements NetMsgHandler { |
|
|
|
DispatchMessage.dispatchMsgToInterestArea(pc, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, true); |
|
|
|
DispatchMessage.dispatchMsgToInterestArea(pc, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//call this if the transfer fails server side to kick the item back to inventory from vault
|
|
|
|
|
|
|
|
public static void forceTransferFromInventoryToVault(ItemFromVaultMsg msg, ClientConnection origin, String reason) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PlayerCharacter player = origin.getPlayerCharacter(); |
|
|
|
|
|
|
|
Dispatch dispatch; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (player == null) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ItemToVaultMsg back = new ItemToVaultMsg(msg); |
|
|
|
|
|
|
|
dispatch = Dispatch.borrow(player, back); |
|
|
|
|
|
|
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ChatManager.chatInfoError(player, "Can't transfer to inventory: " + reason); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//call this if the transfer fails server side to kick the item back to vault from inventory
|
|
|
|
|
|
|
|
public static void forceTransferFromVaultToInventory(ItemToVaultMsg msg, ClientConnection origin, String reason) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PlayerCharacter player = origin.getPlayerCharacter(); |
|
|
|
|
|
|
|
Dispatch dispatch; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (player == null) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ItemFromVaultMsg back = new ItemFromVaultMsg(msg); |
|
|
|
|
|
|
|
dispatch = Dispatch.borrow(player, back); |
|
|
|
|
|
|
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ChatManager.chatInfoError(player, "Can't transfer to vault: " + reason); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void DeleteItem(DeleteItemMsg msg, ClientConnection origin) { |
|
|
|
private static void DeleteItem(DeleteItemMsg msg, ClientConnection origin) { |
|
|
|
|
|
|
|
|
|
|
|
CharacterItemManager itemManager = origin.getPlayerCharacter().charItemManager; |
|
|
|
CharacterItemManager itemManager = origin.getPlayerCharacter().charItemManager; |
|
|
@ -727,29 +691,6 @@ public class ClientMessagePump implements NetMsgHandler { |
|
|
|
|
|
|
|
|
|
|
|
//returns true if looted item is goldItem and is split. Otherwise returns false
|
|
|
|
//returns true if looted item is goldItem and is split. Otherwise returns false
|
|
|
|
|
|
|
|
|
|
|
|
private static void stuck(ClientConnection origin) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PlayerCharacter sourcePlayer = origin.getPlayerCharacter(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (sourcePlayer == null) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (sourcePlayer.getTimers().containsKey("Stuck")) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
StuckJob sj = new StuckJob(sourcePlayer); |
|
|
|
|
|
|
|
JobContainer jc = JobScheduler.getInstance().scheduleJob(sj, 10000); // Convert
|
|
|
|
|
|
|
|
ConcurrentHashMap<String, JobContainer> timers = sourcePlayer.getTimers(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (timers != null) { |
|
|
|
|
|
|
|
if (timers.containsKey("Stuck")) { |
|
|
|
|
|
|
|
timers.get("Stuck").cancelJob(); |
|
|
|
|
|
|
|
timers.remove("Stuck"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
timers.put("Stuck", jc); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void GuildTreeStatusMsg(GuildTreeStatusMsg msg, ClientConnection origin) throws SQLException { |
|
|
|
private static void GuildTreeStatusMsg(GuildTreeStatusMsg msg, ClientConnection origin) throws SQLException { |
|
|
|
|
|
|
|
|
|
|
|
PlayerCharacter player = SessionManager.getPlayerCharacter(origin); |
|
|
|
PlayerCharacter player = SessionManager.getPlayerCharacter(origin); |
|
|
@ -861,56 +802,6 @@ public class ClientMessagePump implements NetMsgHandler { |
|
|
|
|
|
|
|
|
|
|
|
//Handle RepairObject Window and RepairObject Requests
|
|
|
|
//Handle RepairObject Window and RepairObject Requests
|
|
|
|
|
|
|
|
|
|
|
|
protected static void HandlePromptRecall(PromptRecallMsg msg, ClientConnection origin) throws MsgSendException { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PlayerCharacter player = SessionManager.getPlayerCharacter(origin); |
|
|
|
|
|
|
|
boolean recallAccepted; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (player == null) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean confirmed = msg.getConfirmed(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (confirmed == true) { |
|
|
|
|
|
|
|
long timeElapsed = System.currentTimeMillis() - player.getTimeStamp("PromptRecall"); |
|
|
|
|
|
|
|
//send fail message
|
|
|
|
|
|
|
|
recallAccepted = timeElapsed < 15000; |
|
|
|
|
|
|
|
} else |
|
|
|
|
|
|
|
recallAccepted = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (recallAccepted == true) { |
|
|
|
|
|
|
|
//handle recall
|
|
|
|
|
|
|
|
long type = player.getTimeStamp("LastRecallType"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (type == 1) { //recall to bind
|
|
|
|
|
|
|
|
player.teleport(player.getBindLoc()); |
|
|
|
|
|
|
|
player.setSafeMode(); |
|
|
|
|
|
|
|
} else { //recall to rg
|
|
|
|
|
|
|
|
float dist = 9999999999f; |
|
|
|
|
|
|
|
Building rg = null; |
|
|
|
|
|
|
|
Vector3fImmutable rgLoc; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (Runegate runegate : Runegate._runegates.values()) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rgLoc = runegate.gateBuilding.getLoc(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float distanceSquaredToRunegate = player.getLoc().distanceSquared2D(rgLoc); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (distanceSquaredToRunegate < sqr(dist)) |
|
|
|
|
|
|
|
rg = runegate.gateBuilding; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//nearest runegate found. teleport characterTarget
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (rg != null) { |
|
|
|
|
|
|
|
player.teleport(rg.getLoc()); |
|
|
|
|
|
|
|
player.setSafeMode(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean handleClientMsg(ClientNetMsg msg) { |
|
|
|
public boolean handleClientMsg(ClientNetMsg msg) { |
|
|
|
|
|
|
|
|
|
|
@ -1093,7 +984,7 @@ public class ClientMessagePump implements NetMsgHandler { |
|
|
|
PowersManager.trackWindow((TrackWindowMsg) msg, origin); |
|
|
|
PowersManager.trackWindow((TrackWindowMsg) msg, origin); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case STUCK: |
|
|
|
case STUCK: |
|
|
|
stuck(origin); |
|
|
|
MovementManager.stuck(origin); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case RANDOM: |
|
|
|
case RANDOM: |
|
|
|
ClientMessagePump.randomRoll((RandomMsg) msg, origin); |
|
|
|
ClientMessagePump.randomRoll((RandomMsg) msg, origin); |
|
|
@ -1108,7 +999,7 @@ public class ClientMessagePump implements NetMsgHandler { |
|
|
|
ManageNPCCmd((ManageNPCMsg) msg, origin); |
|
|
|
ManageNPCCmd((ManageNPCMsg) msg, origin); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case ARCPROMPTRECALL: |
|
|
|
case ARCPROMPTRECALL: |
|
|
|
HandlePromptRecall((PromptRecallMsg) msg, origin); |
|
|
|
MovementManager.HandlePromptRecall((PromptRecallMsg) msg, origin); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case CHANNELMUTE: |
|
|
|
case CHANNELMUTE: |
|
|
|
break; |
|
|
|
break; |
|
|
|