forked from MagicBane/Server
Mob.java cleanup
This commit is contained in:
@@ -70,7 +70,6 @@ public class MobileFSM {
|
|||||||
MobCallForHelp(mob);
|
MobCallForHelp(mob);
|
||||||
}
|
}
|
||||||
if (!MovementUtilities.inRangeDropAggro(mob, target)) {
|
if (!MovementUtilities.inRangeDropAggro(mob, target)) {
|
||||||
mob.setAggroTargetID(0);
|
|
||||||
mob.setCombatTarget(null);
|
mob.setCombatTarget(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -421,7 +420,6 @@ public class MobileFSM {
|
|||||||
if (aiAgent.notEnemy.contains(loadedPlayer.getRace().getRaceType()))
|
if (aiAgent.notEnemy.contains(loadedPlayer.getRace().getRaceType()))
|
||||||
continue;
|
continue;
|
||||||
if (MovementUtilities.inRangeToAggro(aiAgent, loadedPlayer)) {
|
if (MovementUtilities.inRangeToAggro(aiAgent, loadedPlayer)) {
|
||||||
aiAgent.setAggroTargetID(playerID);
|
|
||||||
aiAgent.setCombatTarget(loadedPlayer);
|
aiAgent.setCombatTarget(loadedPlayer);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -523,14 +521,12 @@ public class MobileFSM {
|
|||||||
if(current == null || current.equals(mob.getGuild().getOwnedCity()) == false) {
|
if(current == null || current.equals(mob.getGuild().getOwnedCity()) == false) {
|
||||||
PowersBase recall = PowersManager.getPowerByToken(-1994153779);
|
PowersBase recall = PowersManager.getPowerByToken(-1994153779);
|
||||||
PowersManager.useMobPower(mob, mob, recall, 40);
|
PowersManager.useMobPower(mob, mob, recall, 40);
|
||||||
mob.setAggroTargetID(0);
|
|
||||||
mob.setCombatTarget(null);
|
mob.setCombatTarget(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mob.getLoc().distanceSquared2D(mob.getBindLoc()) > sqr(2000)) {
|
if (mob.getLoc().distanceSquared2D(mob.getBindLoc()) > sqr(2000)) {
|
||||||
PowersBase recall = PowersManager.getPowerByToken(-1994153779);
|
PowersBase recall = PowersManager.getPowerByToken(-1994153779);
|
||||||
PowersManager.useMobPower(mob, mob, recall, 40);
|
PowersManager.useMobPower(mob, mob, recall, 40);
|
||||||
mob.setAggroTargetID(0);
|
|
||||||
mob.setCombatTarget(null);
|
mob.setCombatTarget(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -665,11 +661,9 @@ public class MobileFSM {
|
|||||||
if (GuardCanAggro(mob,loadedPlayer) == false)
|
if (GuardCanAggro(mob,loadedPlayer) == false)
|
||||||
continue;
|
continue;
|
||||||
if (MovementUtilities.inRangeToAggro(mob, loadedPlayer)) {
|
if (MovementUtilities.inRangeToAggro(mob, loadedPlayer)) {
|
||||||
mob.setAggroTargetID(playerID);
|
|
||||||
mob.setCombatTarget(loadedPlayer);
|
mob.setCombatTarget(loadedPlayer);
|
||||||
if(mob.contract != null) {
|
if(mob.contract != null) {
|
||||||
for (Entry<Mob, Integer> minion : mob.siegeMinionMap.entrySet()) {
|
for (Entry<Mob, Integer> minion : mob.siegeMinionMap.entrySet()) {
|
||||||
minion.getKey().setAggroTargetID(playerID);
|
|
||||||
minion.getKey().setCombatTarget(loadedPlayer);
|
minion.getKey().setCombatTarget(loadedPlayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ public enum NPCManager {
|
|||||||
|
|
||||||
if (NPCManager._runeSetMap.get(mob.runeSet).contains(252623)) {
|
if (NPCManager._runeSetMap.get(mob.runeSet).contains(252623)) {
|
||||||
mob.isPlayerGuard = true;
|
mob.isPlayerGuard = true;
|
||||||
mob.setNoAggro(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only captains have contracts
|
// Only captains have contracts
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import java.sql.SQLException;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||||
|
|
||||||
@@ -93,9 +94,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
private int buildingID;
|
private int buildingID;
|
||||||
private boolean isSiege = false;
|
private boolean isSiege = false;
|
||||||
private long timeToSpawnSiege;
|
private long timeToSpawnSiege;
|
||||||
private boolean noAggro = false;
|
|
||||||
private int aggroTargetID = 0;
|
|
||||||
private final boolean walkingHome = true;
|
|
||||||
private long lastAttackTime = 0;
|
private long lastAttackTime = 0;
|
||||||
private int lastMobPowerToken = 0;
|
private int lastMobPowerToken = 0;
|
||||||
private HashMap<Integer, MobEquipment> equip = null;
|
private HashMap<Integer, MobEquipment> equip = null;
|
||||||
@@ -569,12 +567,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
return mob;
|
return mob;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int nextStaticID() {
|
|
||||||
int id = Mob.staticID;
|
|
||||||
Mob.staticID++;
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Mob getMob(int id) {
|
public static Mob getMob(int id) {
|
||||||
|
|
||||||
if (id == 0) return null;
|
if (id == 0) return null;
|
||||||
@@ -667,13 +659,9 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
|
|
||||||
MobBase minionMobBase;
|
MobBase minionMobBase;
|
||||||
Mob mob;
|
Mob mob;
|
||||||
int maxSlots = 1;
|
int maxSlots;
|
||||||
|
|
||||||
switch (guardCaptain.getRank()) {
|
switch (guardCaptain.getRank()) {
|
||||||
case 1:
|
|
||||||
case 2:
|
|
||||||
maxSlots = 1;
|
|
||||||
break;
|
|
||||||
case 3:
|
case 3:
|
||||||
maxSlots = 2;
|
maxSlots = 2;
|
||||||
break;
|
break;
|
||||||
@@ -687,6 +675,8 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
case 7:
|
case 7:
|
||||||
maxSlots = 5;
|
maxSlots = 5;
|
||||||
break;
|
break;
|
||||||
|
case 1:
|
||||||
|
case 2:
|
||||||
default:
|
default:
|
||||||
maxSlots = 1;
|
maxSlots = 1;
|
||||||
|
|
||||||
@@ -711,7 +701,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
if (guardCaptain.contract != null) {
|
if (guardCaptain.contract != null) {
|
||||||
Enum.MinionType minionType = Enum.MinionType.ContractToMinionMap.get(guardCaptain.contract.getContractID());
|
Enum.MinionType minionType = Enum.MinionType.ContractToMinionMap.get(guardCaptain.contract.getContractID());
|
||||||
if (minionType != null) {
|
if (minionType != null) {
|
||||||
String rank = "";
|
String rank;
|
||||||
|
|
||||||
if (guardCaptain.getRank() < 3)
|
if (guardCaptain.getRank() < 3)
|
||||||
rank = MBServerStatics.JUNIOR;
|
rank = MBServerStatics.JUNIOR;
|
||||||
@@ -954,12 +944,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
return this.spawnRadius;
|
return this.spawnRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSpawnTime() {
|
|
||||||
|
|
||||||
if (this.spawnTime == 0) return MBServerStatics.RESPAWN_TIMER;
|
|
||||||
else return this.spawnTime * 1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSpawnTime(int value) {
|
public void setSpawnTime(int value) {
|
||||||
this.spawnTime = value;
|
this.spawnTime = value;
|
||||||
}
|
}
|
||||||
@@ -1644,7 +1628,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float min, max;
|
float min, max;
|
||||||
float speed = 20f;
|
float speed;
|
||||||
boolean strBased = false;
|
boolean strBased = false;
|
||||||
|
|
||||||
// get skill percentages and min and max damage for weapons
|
// get skill percentages and min and max damage for weapons
|
||||||
@@ -1810,9 +1794,9 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
if (npc.getSiegeMinionMap().containsKey(this))
|
if (npc.getSiegeMinionMap().containsKey(this))
|
||||||
putSlot = npc.getSiegeMinionMap().get(this);
|
putSlot = npc.getSiegeMinionMap().get(this);
|
||||||
} else if (mob != null) {
|
} else if (mob != null) {
|
||||||
//if (mob.getSiegeMinionMap().containsKey(this)) putSlot = mob.getSiegeMinionMap().get(this);
|
if (mob.building.getHirelings().containsKey(this))
|
||||||
int hirelings = mob.building.getHirelings().size();
|
putSlot = mob.building.getHirelings().get(this);
|
||||||
putSlot = hirelings;
|
//putSlot = mob.building.getHirelings().size();
|
||||||
}
|
}
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
@@ -1999,14 +1983,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
return this.upgradeDateTime != null;
|
return this.upgradeDateTime != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNoAggro(boolean noAggro) {
|
|
||||||
this.noAggro = noAggro;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAggroTargetID(int aggroTargetID) {
|
|
||||||
this.aggroTargetID = aggroTargetID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getLastAttackTime() {
|
public long getLastAttackTime() {
|
||||||
return lastAttackTime;
|
return lastAttackTime;
|
||||||
}
|
}
|
||||||
@@ -2073,9 +2049,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
this.lastMobPowerToken = lastMobPowerToken;
|
this.lastMobPowerToken = lastMobPowerToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Regions getLastRegion() {
|
|
||||||
return lastRegion;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isLootSync() {
|
public boolean isLootSync() {
|
||||||
return lootSync;
|
return lootSync;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class ClearAggroPowerAction extends AbstractPowerAction {
|
|||||||
@Override
|
@Override
|
||||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||||
if (awo != null && awo.getObjectType() == GameObjectType.Mob){
|
if (awo != null && awo.getObjectType() == GameObjectType.Mob){
|
||||||
((Mob)awo).setNoAggro(true);
|
((Mob)awo).setCombatTarget(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user