forked from MagicBane/Server
isPlayerguard refactored to derive from agenttype.
This commit is contained in:
@@ -30,18 +30,11 @@ public enum NPCManager {
|
|||||||
if (mob.runeSet == 0)
|
if (mob.runeSet == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//Apply all rune effects.
|
|
||||||
|
|
||||||
if (NPCManager._runeSetMap.get(mob.runeSet).contains(252623)) {
|
|
||||||
mob.isPlayerGuard = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only captains have contracts
|
// Only captains have contracts
|
||||||
|
|
||||||
if (mob.contract != null || mob.isPlayerGuard)
|
if (mob.contract != null || mob.isPlayerGuard())
|
||||||
applyEffectsForRune(mob, 252621);
|
applyEffectsForRune(mob, 252621);
|
||||||
|
|
||||||
|
|
||||||
// Apply effects from RuneSet
|
// Apply effects from RuneSet
|
||||||
|
|
||||||
if (mob.runeSet != 0)
|
if (mob.runeSet != 0)
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ public class MobAI {
|
|||||||
if (mob == null)
|
if (mob == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(mob.isPlayerGuard == true){
|
if (mob.isPlayerGuard() == true) {
|
||||||
|
|
||||||
int contractID;
|
int contractID;
|
||||||
|
|
||||||
@@ -317,7 +317,7 @@ public class MobAI {
|
|||||||
else
|
else
|
||||||
contractID = mob.contract.getContractID();
|
contractID = mob.contract.getContractID();
|
||||||
|
|
||||||
if(Enum.MinionType.ContractToMinionMap.get(contractID).isMage() == false)
|
if (Enum.MinionType.ContractToMinionMap.get(contractID).isMage() == false)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -606,7 +606,7 @@ public class MobAI {
|
|||||||
|
|
||||||
//override for guards
|
//override for guards
|
||||||
|
|
||||||
if (mob.despawned && mob.isPlayerGuard) {
|
if (mob.despawned && mob.isPlayerGuard()) {
|
||||||
|
|
||||||
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardMinion)) {
|
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardMinion)) {
|
||||||
if (mob.guardCaptain.isAlive() == false || ((Mob) mob.guardCaptain).despawned == true) {
|
if (mob.guardCaptain.isAlive() == false || ((Mob) mob.guardCaptain).despawned == true) {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
|
|||||||
protected Vector3fImmutable lastBindLoc;
|
protected Vector3fImmutable lastBindLoc;
|
||||||
public boolean assist = false;
|
public boolean assist = false;
|
||||||
public Enum.AIAgentType agentType = Enum.AIAgentType.MOBILE;
|
public Enum.AIAgentType agentType = Enum.AIAgentType.MOBILE;
|
||||||
public boolean isPlayerGuard = false;
|
|
||||||
public AbstractCharacter guardCaptain;
|
public AbstractCharacter guardCaptain;
|
||||||
public EnumBitSet<Enum.MonsterType> notEnemy = EnumBitSet.noneOf(Enum.MonsterType.class);
|
public EnumBitSet<Enum.MonsterType> notEnemy = EnumBitSet.noneOf(Enum.MonsterType.class);
|
||||||
public EnumBitSet<Enum.MonsterType> enemy = EnumBitSet.noneOf(Enum.MonsterType.class);
|
public EnumBitSet<Enum.MonsterType> enemy = EnumBitSet.noneOf(Enum.MonsterType.class);
|
||||||
|
|||||||
+18
-12
@@ -32,6 +32,7 @@ import org.pmw.tinylog.Logger;
|
|||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.util.EnumSet;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
@@ -183,7 +184,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
} else if (tid == 100962 || tid == 100965) { //Spydraxxx the Mighty, Denigo Tantric
|
} else if (tid == 100962 || tid == 100965) { //Spydraxxx the Mighty, Denigo Tantric
|
||||||
writer.putInt(2);
|
writer.putInt(2);
|
||||||
serializeRune(mob, writer, 5, GameObjectType.NPCClassRuneTwo.ordinal(), 252621); //guard rune
|
serializeRune(mob, writer, 5, GameObjectType.NPCClassRuneTwo.ordinal(), 252621); //guard rune
|
||||||
} else if (mob.contract != null || mob.isPlayerGuard) {
|
} else if (mob.contract != null || mob.isPlayerGuard()) {
|
||||||
writer.putInt(3);
|
writer.putInt(3);
|
||||||
serializeRune(mob, writer, 3, GameObjectType.NPCClassRuneTwo.ordinal(), MobBase.GetClassType(mob.getMobBaseID())); //warrior class
|
serializeRune(mob, writer, 3, GameObjectType.NPCClassRuneTwo.ordinal(), MobBase.GetClassType(mob.getMobBaseID())); //warrior class
|
||||||
serializeRune(mob, writer, 5, GameObjectType.NPCClassRuneThree.ordinal(), 252621); //guard rune
|
serializeRune(mob, writer, 5, GameObjectType.NPCClassRuneThree.ordinal(), 252621); //guard rune
|
||||||
@@ -340,7 +341,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
writer.putInt(0);
|
writer.putInt(0);
|
||||||
writer.putInt(0);
|
writer.putInt(0);
|
||||||
|
|
||||||
if (!mob.isAlive() && !mob.isPet() && !mob.isNecroPet() && !mob.behaviourType.equals(MobBehaviourType.SiegeEngine) && !mob.isPlayerGuard) {
|
if (!mob.isAlive() && !mob.isPet() && !mob.isNecroPet() && !mob.behaviourType.equals(MobBehaviourType.SiegeEngine) && !mob.isPlayerGuard()) {
|
||||||
writer.putInt(0);
|
writer.putInt(0);
|
||||||
writer.putInt(0);
|
writer.putInt(0);
|
||||||
}
|
}
|
||||||
@@ -454,7 +455,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
minionMobile.guardCaptain = guardCaptain;
|
minionMobile.guardCaptain = guardCaptain;
|
||||||
minionMobile.spawnTime = (int) (-2.500 * guardCaptain.building.getRank() + 22.5) * 60;
|
minionMobile.spawnTime = (int) (-2.500 * guardCaptain.building.getRank() + 22.5) * 60;
|
||||||
minionMobile.behaviourType = Enum.MobBehaviourType.GuardMinion;
|
minionMobile.behaviourType = Enum.MobBehaviourType.GuardMinion;
|
||||||
minionMobile.isPlayerGuard = true;
|
|
||||||
minionMobile.guardedCity = guardCaptain.guardedCity;
|
minionMobile.guardedCity = guardCaptain.guardedCity;
|
||||||
minionMobile.patrolPoints = guardCaptain.building.patrolPoints;
|
minionMobile.patrolPoints = guardCaptain.building.patrolPoints;
|
||||||
|
|
||||||
@@ -545,7 +545,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
petMinion.healthMax = MobBase.getMobBase(loadID).getHealthMax() * (petMinion.level * 0.5f);
|
petMinion.healthMax = MobBase.getMobBase(loadID).getHealthMax() * (petMinion.level * 0.5f);
|
||||||
petMinion.health.set(petMinion.healthMax);
|
petMinion.health.set(petMinion.healthMax);
|
||||||
petMinion.behaviourType = MobBehaviourType.Pet1;
|
petMinion.behaviourType = MobBehaviourType.Pet1;
|
||||||
petMinion.agentType = AIAgentType.PET;
|
|
||||||
petMinion.firstName = "";
|
petMinion.firstName = "";
|
||||||
petMinion.lastName = "";
|
petMinion.lastName = "";
|
||||||
|
|
||||||
@@ -747,7 +746,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
// get rune and effect bonuses
|
// get rune and effect bonuses
|
||||||
bonus *= (1 + this.bonuses.getFloatPercentAll(ModType.Speed, SourceType.None));
|
bonus *= (1 + this.bonuses.getFloatPercentAll(ModType.Speed, SourceType.None));
|
||||||
|
|
||||||
if (this.isPlayerGuard)
|
if (this.isPlayerGuard())
|
||||||
switch (this.mobBase.getLoadID()) {
|
switch (this.mobBase.getLoadID()) {
|
||||||
case 2111:
|
case 2111:
|
||||||
if (this.isWalk())
|
if (this.isWalk())
|
||||||
@@ -815,7 +814,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
Group g = GroupManager.getGroup((PlayerCharacter) attacker);
|
Group g = GroupManager.getGroup((PlayerCharacter) attacker);
|
||||||
|
|
||||||
// Give XP, now handled inside the Experience Object
|
// Give XP, now handled inside the Experience Object
|
||||||
if (!this.isPet() && !this.isNecroPet() && !(this.agentType.equals(AIAgentType.PET)) && !this.isPlayerGuard)
|
if (!this.isPet() && !this.isNecroPet() && !(this.agentType.equals(AIAgentType.PET)) && !this.isPlayerGuard())
|
||||||
Experience.doExperience((PlayerCharacter) attacker, this, g);
|
Experience.doExperience((PlayerCharacter) attacker, this, g);
|
||||||
} else if (attacker.getObjectType().equals(GameObjectType.Mob)) {
|
} else if (attacker.getObjectType().equals(GameObjectType.Mob)) {
|
||||||
Mob mobAttacker = (Mob) attacker;
|
Mob mobAttacker = (Mob) attacker;
|
||||||
@@ -826,7 +825,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
PlayerCharacter owner = (PlayerCharacter) mobAttacker.guardCaptain;
|
PlayerCharacter owner = (PlayerCharacter) mobAttacker.guardCaptain;
|
||||||
|
|
||||||
if (owner != null)
|
if (owner != null)
|
||||||
if (!this.isPet() && !this.isNecroPet() && !(this.agentType.equals(AIAgentType.PET)) && !this.isPlayerGuard) {
|
if (!this.isPet() && !this.isNecroPet() && !(this.agentType.equals(AIAgentType.PET)) && !this.isPlayerGuard()) {
|
||||||
Group g = GroupManager.getGroup(owner);
|
Group g = GroupManager.getGroup(owner);
|
||||||
|
|
||||||
// Give XP, now handled inside the Experience Object
|
// Give XP, now handled inside the Experience Object
|
||||||
@@ -940,7 +939,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
|
|
||||||
playerAgroMap.clear();
|
playerAgroMap.clear();
|
||||||
|
|
||||||
if (!this.isPlayerGuard && this.equip != null)
|
if (!this.isPlayerGuard() && this.equip != null)
|
||||||
LootManager.GenerateEquipmentDrop(this);
|
LootManager.GenerateEquipmentDrop(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -987,7 +986,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
else if (this.building != null)
|
else if (this.building != null)
|
||||||
this.region = BuildingManager.GetRegion(this.building, bindLoc.x, bindLoc.y, bindLoc.z);
|
this.region = BuildingManager.GetRegion(this.building, bindLoc.x, bindLoc.y, bindLoc.z);
|
||||||
|
|
||||||
if (!this.behaviourType.equals(MobBehaviourType.SiegeEngine) && !this.isPlayerGuard && contract == null)
|
if (!this.behaviourType.equals(MobBehaviourType.SiegeEngine) && !this.isPlayerGuard() && contract == null)
|
||||||
loadInventory();
|
loadInventory();
|
||||||
|
|
||||||
this.updateLocation();
|
this.updateLocation();
|
||||||
@@ -1026,7 +1025,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
this.charItemManager.clearInventory();
|
this.charItemManager.clearInventory();
|
||||||
this.charItemManager.clearEquip();
|
this.charItemManager.clearEquip();
|
||||||
|
|
||||||
if (isPlayerGuard)
|
if (this.isPlayerGuard())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LootManager.GenerateMobLoot(this);
|
LootManager.GenerateMobLoot(this);
|
||||||
@@ -1539,6 +1538,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
if (this.contract != null) {
|
if (this.contract != null) {
|
||||||
|
|
||||||
// Setup equipset for contract
|
// Setup equipset for contract
|
||||||
|
|
||||||
this.equipmentSetID = this.contract.getEquipmentSet();
|
this.equipmentSetID = this.contract.getEquipmentSet();
|
||||||
|
|
||||||
// Configure AI related values
|
// Configure AI related values
|
||||||
@@ -1550,10 +1550,12 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
this.guardedCity = ZoneManager.getCityAtLocation(this.building.getLoc());
|
this.guardedCity = ZoneManager.getCityAtLocation(this.building.getLoc());
|
||||||
break;
|
break;
|
||||||
case GuardWallArcher:
|
case GuardWallArcher:
|
||||||
this.gridObjectType = GridObjectType.DYNAMIC;
|
|
||||||
this.agentType = AIAgentType.GUARDWALLARCHER;
|
this.agentType = AIAgentType.GUARDWALLARCHER;
|
||||||
this.spawnTime = 450;
|
this.spawnTime = 450;
|
||||||
this.guardedCity = ZoneManager.getCityAtLocation(this.building.getLoc());
|
this.guardedCity = ZoneManager.getCityAtLocation(this.building.getLoc());
|
||||||
|
case Pet1:
|
||||||
|
this.agentType = AIAgentType.PET;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1809,7 +1811,11 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPlayerGuard() {
|
public boolean isPlayerGuard() {
|
||||||
return isPlayerGuard;
|
|
||||||
|
if (EnumSet.of(AIAgentType.GUARDCAPTAIN, AIAgentType.GUARDMINION, AIAgentType.GUARDWALLARCHER).contains(this.agentType))
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLastMobPowerToken() {
|
public int getLastMobPowerToken() {
|
||||||
|
|||||||
Reference in New Issue
Block a user