Browse Source

Contract moved to AbstractCharacter.

Arty tower restricted to a single tower captain.
master
MagicBot 2 years ago
parent
commit
7dcefdf5d7
  1. 2
      src/engine/gameManager/BuildingManager.java
  2. 3
      src/engine/net/client/handlers/ActivateNPCMsgHandler.java
  3. 1
      src/engine/objects/AbstractCharacter.java
  4. 8
      src/engine/objects/Contract.java
  5. 1
      src/engine/objects/Mob.java
  6. 2
      src/engine/objects/NPC.java

2
src/engine/gameManager/BuildingManager.java

@ -51,7 +51,7 @@ public enum BuildingManager {
for (int i = 1; i <= numOfSlots; i++) { for (int i = 1; i <= numOfSlots; i++) {
// Slot two is reserved on Arty towers for the trebuchet // Slot one is reserved on Arty towers for the trebuchet
if (i == 1 && if (i == 1 &&
building.getBlueprint() != null && building.getBlueprint() != null &&

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

@ -49,9 +49,12 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler {
for (Item hirelings : player.getInventory()) { for (Item hirelings : player.getInventory()) {
if (hirelings.getItemBase().getType().equals(ItemType.CONTRACT)) { if (hirelings.getItemBase().getType().equals(ItemType.CONTRACT)) {
contract = DbManager.ContractQueries.GET_CONTRACT(hirelings.getItemBase().getUUID()); contract = DbManager.ContractQueries.GET_CONTRACT(hirelings.getItemBase().getUUID());
if (contract == null) if (contract == null)
continue; continue;
if (contract.canSlotinBuilding(building)) if (contract.canSlotinBuilding(building))
ItemLists.add(hirelings); ItemLists.add(hirelings);
} }

1
src/engine/objects/AbstractCharacter.java

@ -119,6 +119,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
protected Regions lastRegion = null; protected Regions lastRegion = null;
protected boolean movingUp = false; protected boolean movingUp = false;
public Contract contract;
/** /**

8
src/engine/objects/Contract.java

@ -254,9 +254,15 @@ public class Contract extends AbstractGameObject {
if (this.allowedBuildings.size() == 0) if (this.allowedBuildings.size() == 0)
return false; return false;
// Restrict arty towers to a single captain
if (this.getContractID() == 842) // Tower Arty Captain
for (AbstractCharacter hireling : building.getHirelings().keySet())
if (hireling.contract.getContractID() == 842)
return false;
// Binary match // Binary match
return (building.getBlueprint().getBuildingGroup().elementOf(this.allowedBuildings)); return (building.getBlueprint().getBuildingGroup().elementOf(this.allowedBuildings));
} }
public int getEquipmentSet() { public int getEquipmentSet() {

1
src/engine/objects/Mob.java

@ -65,7 +65,6 @@ public class Mob extends AbstractIntelligenceAgent {
public int spawnTime; public int spawnTime;
public Zone parentZone; public Zone parentZone;
public Building building; public Building building;
public Contract contract;
public boolean hasLoot = false; public boolean hasLoot = false;
public boolean isPlayerGuard = false; public boolean isPlayerGuard = false;
public AbstractCharacter npcOwner; public AbstractCharacter npcOwner;

2
src/engine/objects/NPC.java

@ -52,7 +52,7 @@ public class NPC extends AbstractCharacter {
protected MobBase mobBase; protected MobBase mobBase;
protected String name; protected String name;
public Building building; public Building building;
protected Contract contract;
protected int dbID; protected int dbID;
protected int currentID; protected int currentID;
private DateTime upgradeDateTime = null; private DateTime upgradeDateTime = null;

Loading…
Cancel
Save