NPc Manager for static NPC classes
This commit is contained in:
1 parent
450ae2ec82
commit
f0bef72fde
41 files changed
+487
-486
No files matched your search
@@ -719,7 +719,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
lwrm = new LootWindowResponseMsg(characterTarget.getObjectType().ordinal(), characterTarget.getObjectUUID(), characterTarget.getInventory(true));
|
||||
break;
|
||||
case NPC:
|
||||
characterTarget = NPC.getFromCache(msg.getTargetID());
|
||||
characterTarget = NPCManager.getFromCache(msg.getTargetID());
|
||||
if (characterTarget == null)
|
||||
return;
|
||||
break;
|
||||
@@ -818,7 +818,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
return;
|
||||
|
||||
} else if (targetType == GameObjectType.NPC.ordinal())
|
||||
tar = NPC.getFromCache(targetID);
|
||||
tar = NPCManager.getFromCache(targetID);
|
||||
else if (targetType == GameObjectType.Mob.ordinal())
|
||||
tar = Mob.getFromCache(targetID);
|
||||
if (tar == null)
|
||||
@@ -1015,7 +1015,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
if (targetType == GameObjectType.PlayerCharacter.ordinal())
|
||||
tar = PlayerManager.getFromCache(msg.getTargetID());
|
||||
else if (targetType == GameObjectType.NPC.ordinal())
|
||||
tar = NPC.getFromCache(msg.getTargetID());
|
||||
tar = NPCManager.getFromCache(msg.getTargetID());
|
||||
else if (targetType == GameObjectType.Mob.ordinal())
|
||||
tar = Mob.getFromCache(msg.getTargetID());
|
||||
|
||||
@@ -1150,7 +1150,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
if (sourcePlayer == null)
|
||||
return;
|
||||
|
||||
NPC npc = NPC.getFromCache(msg.getNPCID());
|
||||
NPC npc = NPCManager.getFromCache(msg.getNPCID());
|
||||
|
||||
if (npc == null)
|
||||
return;
|
||||
@@ -1199,7 +1199,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
if (itemMan == null)
|
||||
return;
|
||||
|
||||
NPC npc = NPC.getFromCache(msg.getNPCID());
|
||||
NPC npc = NPCManager.getFromCache(msg.getNPCID());
|
||||
|
||||
if (npc == null)
|
||||
return;
|
||||
@@ -1363,7 +1363,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
if (sourcePlayer == null)
|
||||
return;
|
||||
|
||||
NPC npc = NPC.getFromCache(msg.getNpcID());
|
||||
NPC npc = NPCManager.getFromCache(msg.getNpcID());
|
||||
|
||||
if (npc == null)
|
||||
return;
|
||||
@@ -1391,7 +1391,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
if (itemMan == null) {
|
||||
return;
|
||||
}
|
||||
NPC npc = NPC.getFromCache(msg.getNPCID());
|
||||
NPC npc = NPCManager.getFromCache(msg.getNPCID());
|
||||
if (npc == null) {
|
||||
return;
|
||||
}
|
||||
@@ -1623,7 +1623,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
NPC npc = NPC.getFromCache(msg.getNPCID());
|
||||
NPC npc = NPCManager.getFromCache(msg.getNPCID());
|
||||
|
||||
if (npc == null)
|
||||
return;
|
||||
|
||||
@@ -144,7 +144,7 @@ public class AssetSupportMsgHandler extends AbstractClientMsgHandler {
|
||||
if (player == null)
|
||||
return true;
|
||||
|
||||
vendor = NPC.getFromCache(msg.getNpcID());
|
||||
vendor = NPCManager.getFromCache(msg.getNpcID());
|
||||
|
||||
if (msg.getMessageType() != 6 && msg.getMessageType() != 7) {
|
||||
if (vendor == null)
|
||||
|
||||
@@ -13,6 +13,7 @@ package engine.net.client.handlers;
|
||||
import engine.Enum.DispatchChannel;
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.NPCManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
@@ -52,7 +53,7 @@ public class HirelingServiceMsgHandler extends AbstractClientMsgHandler {
|
||||
if (building == null)
|
||||
return true;
|
||||
|
||||
NPC npc = NPC.getFromCache(msg.npcID);
|
||||
NPC npc = NPCManager.getFromCache(msg.npcID);
|
||||
|
||||
if (npc == null)
|
||||
return true;
|
||||
|
||||
@@ -415,7 +415,7 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
player = SessionManager.getPlayerCharacter(origin);
|
||||
msg = (MerchantMsg) baseMsg;
|
||||
npc = NPC.getNPC(msg.getNPCID());
|
||||
npc = NPCManager.getNPC(msg.getNPCID());
|
||||
|
||||
// Early exit if something goes awry
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
if (minionMsg.getNpcType() == Enum.GameObjectType.NPC.ordinal()) {
|
||||
|
||||
NPC npc = NPC.getFromCache(minionMsg.getNpcID());
|
||||
NPC npc = NPCManager.getFromCache(minionMsg.getNpcID());
|
||||
|
||||
if (npc == null)
|
||||
return true;
|
||||
|
||||
@@ -4,10 +4,7 @@ import engine.Enum;
|
||||
import engine.Enum.DispatchChannel;
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.PlayerManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.gameManager.*;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
@@ -74,7 +71,7 @@ public class OpenFriendsCondemnListMsgHandler extends AbstractClientMsgHandler {
|
||||
if (msg.getPlayerType() == GameObjectType.PlayerCharacter.ordinal())
|
||||
toAdd = PlayerManager.getFromCache(msg.getPlayerID());
|
||||
else if (msg.getPlayerType() == GameObjectType.NPC.ordinal())
|
||||
toAdd = NPC.getFromCache(msg.getPlayerID());
|
||||
toAdd = NPCManager.getFromCache(msg.getPlayerID());
|
||||
else if (msg.getPlayerType() == GameObjectType.Mob.ordinal())
|
||||
toAdd = Mob.getFromCache(msg.getPlayerID());
|
||||
else {
|
||||
|
||||
@@ -91,7 +91,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
}
|
||||
|
||||
ManageCityAssetsMsg mca = new ManageCityAssetsMsg();
|
||||
mca.actionType = NPC.SVR_CLOSE_WINDOW;
|
||||
mca.actionType = NPCManager.SVR_CLOSE_WINDOW;
|
||||
mca.setTargetType(building.getObjectType().ordinal());
|
||||
mca.setTargetID(building.getObjectUUID());
|
||||
origin.sendMsg(mca);
|
||||
@@ -110,7 +110,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
npc = NPC.getFromCache(msg.getNpcUUID());
|
||||
npc = NPCManager.getFromCache(msg.getNpcUUID());
|
||||
|
||||
if (npc == null)
|
||||
return;
|
||||
@@ -120,7 +120,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
if (building == null)
|
||||
return;
|
||||
|
||||
NPCProfits profit = NPC.GetNPCProfits(npc);
|
||||
NPCProfits profit = NPCManager.GetNPCProfits(npc);
|
||||
|
||||
if (profit == null)
|
||||
return;
|
||||
@@ -155,7 +155,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
npc = NPC.getFromCache(orderNPCMsg.getNpcUUID());
|
||||
npc = NPCManager.getFromCache(orderNPCMsg.getNpcUUID());
|
||||
|
||||
if (npc == null)
|
||||
return;
|
||||
@@ -165,7 +165,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
if (building == null)
|
||||
return;
|
||||
|
||||
NPCProfits profit = NPC.GetNPCProfits(npc);
|
||||
NPCProfits profit = NPCManager.GetNPCProfits(npc);
|
||||
|
||||
if (profit == null)
|
||||
return;
|
||||
@@ -428,7 +428,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
if (orderNPCMsg.getObjectType() == GameObjectType.NPC.ordinal()) {
|
||||
|
||||
npc = NPC.getFromCache(orderNPCMsg.getNpcUUID());
|
||||
npc = NPCManager.getFromCache(orderNPCMsg.getNpcUUID());
|
||||
|
||||
if (npc == null)
|
||||
return true;
|
||||
|
||||
@@ -13,6 +13,7 @@ import engine.Enum.GameObjectType;
|
||||
import engine.Enum.TransactionType;
|
||||
import engine.exception.SerializationException;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.NPCManager;
|
||||
import engine.gameManager.PlayerManager;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
@@ -108,7 +109,7 @@ public class ArcViewAssetTransactionsMsg extends ClientNetMsg {
|
||||
name = pc.getCombinedName();
|
||||
break;
|
||||
case NPC:
|
||||
NPC npc = NPC.getFromCache(transaction.getTargetUUID());
|
||||
NPC npc = NPCManager.getFromCache(transaction.getTargetUUID());
|
||||
if (npc != null) {
|
||||
|
||||
if (npc.getBuilding() != null)
|
||||
|
||||
@@ -11,6 +11,7 @@ package engine.net.client.msg;
|
||||
|
||||
import engine.Enum.ItemType;
|
||||
import engine.exception.SerializationException;
|
||||
import engine.gameManager.NPCManager;
|
||||
import engine.gameManager.PlayerManager;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.AbstractNetMsg;
|
||||
@@ -92,7 +93,7 @@ public class BuyFromNPCWindowMsg extends ClientNetMsg {
|
||||
|
||||
float sellPercent = 1;
|
||||
|
||||
NPC npc = NPC.getFromCache(npcID);
|
||||
NPC npc = NPCManager.getFromCache(npcID);
|
||||
CharacterItemManager man = null;
|
||||
ArrayList<Item> inventory = null;
|
||||
ArrayList<MobEquipment> sellInventory = null;
|
||||
|
||||
@@ -11,6 +11,7 @@ package engine.net.client.msg;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.NPCManager;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.AbstractNetMsg;
|
||||
@@ -291,7 +292,7 @@ public class ItemProductionMsg extends ClientNetMsg {
|
||||
writer.putInt(0);
|
||||
}
|
||||
|
||||
NPC vendor = NPC.getFromCache(this.npcUUID);
|
||||
NPC vendor = NPCManager.getFromCache(this.npcUUID);
|
||||
if (vendor != null) {
|
||||
if (toRoll.isComplete()) {
|
||||
writer.putInt(0);
|
||||
|
||||
@@ -178,7 +178,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
||||
|
||||
if (this.targetType == GameObjectType.NPC.ordinal()) {
|
||||
|
||||
npc = NPC.getFromCache(this.targetID);
|
||||
npc = NPCManager.getFromCache(this.targetID);
|
||||
|
||||
if (npc == null) {
|
||||
Logger.error("Missing NPC of ID " + this.targetID);
|
||||
@@ -233,7 +233,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
||||
writer.put((byte) 0);
|
||||
writer.putInt(0);
|
||||
|
||||
NPCProfits profit = NPC.GetNPCProfits(npc);
|
||||
NPCProfits profit = NPCManager.GetNPCProfits(npc);
|
||||
|
||||
if (profit == null)
|
||||
profit = NPCProfits.defaultProfits;
|
||||
@@ -598,7 +598,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
||||
|
||||
}
|
||||
|
||||
if (NPC.ISGuardCaptain(mobA.getContract().getContractID()) == false)
|
||||
if (NPCManager.ISGuardCaptain(mobA.getContract().getContractID()) == false)
|
||||
maxSlots = 0;
|
||||
|
||||
writer.putInt(0); //anything other than 0 seems to mess up the client
|
||||
|
||||
@@ -11,6 +11,7 @@ package engine.net.client.msg;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.NPCManager;
|
||||
import engine.gameManager.PlayerManager;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
@@ -721,7 +722,7 @@ public class OpenFriendsCondemnListMsg extends ClientNetMsg {
|
||||
if (characterType == GameObjectType.PlayerCharacter.ordinal())
|
||||
heraldryCharacter = PlayerManager.getFromCache(characterID);
|
||||
else if (characterType == GameObjectType.NPC.ordinal())
|
||||
heraldryCharacter = NPC.getFromCache(characterID);
|
||||
heraldryCharacter = NPCManager.getFromCache(characterID);
|
||||
else if (characterType == GameObjectType.Mob.ordinal())
|
||||
heraldryCharacter = Mob.getFromCache(characterID);
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.gameManager.NPCManager;
|
||||
import engine.gameManager.PlayerManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.net.*;
|
||||
@@ -63,7 +64,7 @@ public class RefineMsg extends ClientNetMsg {
|
||||
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
|
||||
if (pc == null)
|
||||
return;
|
||||
NPC npc = NPC.getFromCache(msg.npcID);
|
||||
NPC npc = NPCManager.getFromCache(msg.npcID);
|
||||
if (npc == null)
|
||||
return;
|
||||
int type = msg.type;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
package engine.net.client.msg;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.gameManager.NPCManager;
|
||||
import engine.gameManager.PlayerManager;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.AbstractNetMsg;
|
||||
@@ -109,7 +110,7 @@ public class TrackWindowMsg extends ClientNetMsg {
|
||||
if (objectType == GameObjectType.PlayerCharacter.ordinal())
|
||||
ac = PlayerManager.getFromCache(objectID);
|
||||
else if (objectType == GameObjectType.NPC.ordinal())
|
||||
ac = NPC.getFromCache(objectID);
|
||||
ac = NPCManager.getFromCache(objectID);
|
||||
else if (objectType == GameObjectType.Mob.ordinal())
|
||||
ac = Mob.getFromCache(objectID);
|
||||
|
||||
|
||||
@@ -12,10 +12,7 @@ package engine.net.client.msg;
|
||||
import engine.Enum;
|
||||
import engine.Enum.ProtectionState;
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.gameManager.*;
|
||||
import engine.net.*;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.Protocol;
|
||||
@@ -65,7 +62,7 @@ public class TrainMsg extends ClientNetMsg {
|
||||
if (playerCharacter == null)
|
||||
return;
|
||||
|
||||
NPC npc = NPC.getFromCache(msg.npcID);
|
||||
NPC npc = NPCManager.getFromCache(msg.npcID);
|
||||
|
||||
if (npc == null)
|
||||
return;
|
||||
|
||||
@@ -80,7 +80,7 @@ public class VendorDialogMsg extends ClientNetMsg {
|
||||
}
|
||||
|
||||
// Get NPC that player is talking to
|
||||
NPC npc = NPC.getFromCache(msg.vendorObjectID);
|
||||
NPC npc = NPCManager.getFromCache(msg.vendorObjectID);
|
||||
int npcClassID;
|
||||
|
||||
if (npc == null)
|
||||
|
||||
@@ -11,6 +11,7 @@ package engine.net.client.msg.guild;
|
||||
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.gameManager.NPCManager;
|
||||
import engine.gameManager.PlayerManager;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
@@ -295,7 +296,7 @@ class GuildInfoMessageType4 extends GuildInfoMessageType {
|
||||
AbstractCharacter guildLeader;
|
||||
String guildLeaderName = "";
|
||||
if (g.isNPCGuild()) {
|
||||
guildLeader = NPC.getFromCache(g.getGuildLeaderUUID());
|
||||
guildLeader = NPCManager.getFromCache(g.getGuildLeaderUUID());
|
||||
if (guildLeader != null)
|
||||
guildLeaderName = guildLeader.getName();
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user