Browse Source

zone override

birdbane
FatBoy-DOTC 9 months ago
parent
commit
0ccf9f61cb
  1. 55
      src/engine/net/client/handlers/ActivateNPCMsgHandler.java

55
src/engine/net/client/handlers/ActivateNPCMsgHandler.java

@ -57,6 +57,21 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler {
if (contract.canSlotinBuilding(building)) if (contract.canSlotinBuilding(building))
ItemLists.add(hirelings); ItemLists.add(hirelings);
if(building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.TOL)){
if(contract.getContractID() == 899)//alchemist
ItemLists.add(hirelings);
if(contract.getContractID() == 866)//banker
ItemLists.add(hirelings);
if(contract.getContractID() == 865)//siege engineer
ItemLists.add(hirelings);
}
if(building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.SIEGETENT)){
if(contract.getContractID() == 865)//siege engineer
ItemLists.add(hirelings);
}
} }
} }
@ -78,13 +93,20 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler {
return false; return false;
} }
if (building.getBlueprint().getMaxSlots() == building.getHirelings().size()) if (building.getBlueprint().getSlotsForRank(building.getRank()) == building.getHirelings().size())
return false; return false;
Item contractItem = Item.getFromCache(msg.getContractItem()); Item contractItem = Item.getFromCache(msg.getContractItem());
if (contractItem == null) if (contractItem == null)
return false; return false;
if (msg.getContractItem() == 850) {//runemaster
for (AbstractCharacter abs : building.getHirelings().keySet()) {
NPC npc = (NPC) abs;
if (npc.contract.getContractID() == 850)
return false; //can only have 1 runemaster
}
}
if (!player.getCharItemManager().doesCharOwnThisItem(contractItem.getObjectUUID())) { if (!player.getCharItemManager().doesCharOwnThisItem(contractItem.getObjectUUID())) {
Logger.error(player.getName() + "has attempted to place Hireling : " + contractItem.getName() + "without a valid contract!"); Logger.error(player.getName() + "has attempted to place Hireling : " + contractItem.getName() + "without a valid contract!");
@ -104,10 +126,33 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler {
return false; return false;
// Check if contract can be slotted in this building // Check if contract can be slotted in this building
//Logger.error("inserting contract: " + contract.getContractID());
if (contract.canSlotinBuilding(building) == false) if (contract.canSlotinBuilding(building) == false) {
return false; boolean override = false;
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.TOL)) {
if (contract.getContractID() == 899)//alchemist
override = true;
if (contract.getContractID() == 866)//banker
override = true;
if (contract.getContractID() == 865)//siege engineer
override = true;
}
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.SIEGETENT)) {
if (contract.getContractID() == 865)//siege engineer
override = true;
}
if(building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.SIEGETENT)){
if(contract.getContractID() == 865)//siege engineer
override = true;
}
if(override == false) {
Logger.error("failed at override with contract: " + contract.getContractID());
return false;
}
}
//Logger.error("override successful: " + contract.getContractID());
if (!BuildingManager.addHireling(building, player, zone, contract, contractItem)) if (!BuildingManager.addHireling(building, player, zone, contract, contractItem))
return false; return false;

Loading…
Cancel
Save