Compare commits
10 Commits
779e3da74e
...
f556181d77
| Author | SHA1 | Date | |
|---|---|---|---|
| f556181d77 | |||
| d48e26904e | |||
| 19232ac405 | |||
| 9ee2ccc8af | |||
| 7079bb6a63 | |||
| 0ab5827ee5 | |||
| c5443f622c | |||
| e4aa276cca | |||
| 90ff2d679e | |||
| da26c35d5a |
@@ -9,6 +9,7 @@
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ChatManager;
|
||||
@@ -43,7 +44,7 @@ public class AddMobCmd extends AbstractDevCmd {
|
||||
MobBase mb = (MobBase) mobbaseAGO;
|
||||
int loadID = mb.getObjectUUID();
|
||||
Mob mob = Mob.createMob(loadID, Vector3fImmutable.getRandomPointInCircle(pc.getLoc(), 100),
|
||||
null, zone, null, null, "", 1);
|
||||
null, zone, null, null, "", 1, Enum.AIAgentType.MOBILE);
|
||||
if (mob != null) {
|
||||
mob.updateDatabase();
|
||||
this.setResult(String.valueOf(mob.getDBID()));
|
||||
@@ -84,7 +85,7 @@ public class AddMobCmd extends AbstractDevCmd {
|
||||
|
||||
|
||||
Mob mob = Mob.createMob(loadID, pc.getLoc(),
|
||||
null, zone, null, null, "", 1);
|
||||
null, zone, null, null, "", 1, Enum.AIAgentType.MOBILE);
|
||||
if (mob != null) {
|
||||
mob.updateDatabase();
|
||||
ChatManager.chatSayInfo(pc,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
@@ -110,7 +111,7 @@ public class SplatMobCmd extends AbstractDevCmd {
|
||||
|
||||
mobile = Mob.createMob(_mobileUUID,
|
||||
Vector3fImmutable.getRandomPointInCircle(_currentLocation, _targetRange),
|
||||
null, serverZone, null, null, "", 1);
|
||||
null, serverZone, null, null, "", 1, Enum.AIAgentType.MOBILE);
|
||||
|
||||
if (mobile != null) {
|
||||
mobile.updateDatabase();
|
||||
|
||||
@@ -535,7 +535,7 @@ public enum BuildingManager {
|
||||
|
||||
if (NPC.ISWallArcher(contract)) {
|
||||
|
||||
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank);
|
||||
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank, Enum.AIAgentType.GUARDWALLARCHER);
|
||||
|
||||
if (mobile == null)
|
||||
return false;
|
||||
@@ -554,7 +554,7 @@ public enum BuildingManager {
|
||||
|
||||
if (NPC.ISGuardCaptain(contract.getContractID())) {
|
||||
|
||||
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank);
|
||||
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank, Enum.AIAgentType.GUARDCAPTAIN);
|
||||
|
||||
if (mobile == null)
|
||||
return false;
|
||||
@@ -574,7 +574,7 @@ public enum BuildingManager {
|
||||
if (contract.getContractID() == 910) {
|
||||
|
||||
//guard dog
|
||||
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank);
|
||||
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank, Enum.AIAgentType.GUARDCAPTAIN);
|
||||
|
||||
if (mobile == null)
|
||||
return false;
|
||||
|
||||
@@ -23,77 +23,6 @@ public enum NPCManager {
|
||||
NPC_MANAGER;
|
||||
public static HashMap<Integer, ArrayList<Integer>> _runeSetMap = new HashMap<>();
|
||||
|
||||
public static void applyRuneSetEffects(Mob mob) {
|
||||
|
||||
// Early exit
|
||||
|
||||
if (mob.runeSet == 0)
|
||||
return;
|
||||
|
||||
// Only captains have contracts
|
||||
|
||||
if (mob.contract != null || mob.isPlayerGuard())
|
||||
applyEffectsForRune(mob, 252621);
|
||||
|
||||
// Apply effects from RuneSet
|
||||
|
||||
if (mob.runeSet != 0)
|
||||
for (int runeID : _runeSetMap.get(mob.runeSet))
|
||||
applyEffectsForRune(mob, runeID);
|
||||
|
||||
// Not sure why but apply Warrior effects for some reason?
|
||||
|
||||
applyEffectsForRune(mob, 2518);
|
||||
}
|
||||
|
||||
public static void applyEffectsForRune(AbstractCharacter character, int runeID) {
|
||||
|
||||
EffectsBase effectsBase;
|
||||
RuneBase sourceRune = RuneBase.getRuneBase(runeID);
|
||||
|
||||
// Race runes are in the runeset but not in runebase for some reason
|
||||
|
||||
if (sourceRune == null)
|
||||
return;
|
||||
|
||||
for (MobBaseEffects mbe : sourceRune.getEffectsList()) {
|
||||
|
||||
effectsBase = PowersManager.getEffectByToken(mbe.getToken());
|
||||
|
||||
if (effectsBase == null) {
|
||||
Logger.info("Mob: " + character.getObjectUUID() + " EffectsBase Null for Token " + mbe.getToken());
|
||||
continue;
|
||||
}
|
||||
|
||||
//check to upgrade effects if needed.
|
||||
if (character.effects.containsKey(Integer.toString(effectsBase.getUUID()))) {
|
||||
|
||||
if (mbe.getReqLvl() > (int) character.level)
|
||||
continue;
|
||||
|
||||
Effect eff = character.effects.get(Integer.toString(effectsBase.getUUID()));
|
||||
|
||||
if (eff == null)
|
||||
continue;
|
||||
|
||||
//Current effect is a higher rank, dont apply.
|
||||
if (eff.getTrains() > mbe.getRank())
|
||||
continue;
|
||||
|
||||
//new effect is of a higher rank. remove old effect and apply new one.
|
||||
eff.cancelJob();
|
||||
character.addEffectNoTimer(Integer.toString(effectsBase.getUUID()), effectsBase, mbe.getRank(), true);
|
||||
} else {
|
||||
|
||||
if (mbe.getReqLvl() > (int) character.level)
|
||||
continue;
|
||||
|
||||
character.addEffectNoTimer(Integer.toString(effectsBase.getUUID()), effectsBase, mbe.getRank(), true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static void dismissNecroPet(Mob necroPet, boolean updateOwner) {
|
||||
|
||||
necroPet.setCombatTarget(null);
|
||||
@@ -417,4 +346,57 @@ public enum NPCManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void applyMobbaseEffects(Mob mob) {
|
||||
EffectsBase effectsBase;
|
||||
for (MobBaseEffects mbe : mob.mobBase.effectsList) {
|
||||
|
||||
effectsBase = PowersManager.getEffectByToken(mbe.getToken());
|
||||
|
||||
if (effectsBase == null) {
|
||||
Logger.info("Mob: " + mob.getObjectUUID() + " EffectsBase Null for Token " + mbe.getToken());
|
||||
continue;
|
||||
}
|
||||
|
||||
//check to upgrade effects if needed.
|
||||
if (mob.effects.containsKey(Integer.toString(effectsBase.getUUID()))) {
|
||||
|
||||
if (mbe.getReqLvl() > (int) mob.level)
|
||||
continue;
|
||||
|
||||
Effect eff = mob.effects.get(Integer.toString(effectsBase.getUUID()));
|
||||
|
||||
if (eff == null)
|
||||
continue;
|
||||
|
||||
//Current effect is a higher rank, dont apply.
|
||||
if (eff.getTrains() > mbe.getRank())
|
||||
continue;
|
||||
|
||||
//new effect is of a higher rank. remove old effect and apply new one.
|
||||
eff.cancelJob();
|
||||
mob.addEffectNoTimer(Integer.toString(effectsBase.getUUID()), effectsBase, mbe.getRank(), true);
|
||||
} else {
|
||||
|
||||
if (mbe.getReqLvl() > (int) mob.level)
|
||||
continue;
|
||||
|
||||
mob.addEffectNoTimer(Integer.toString(effectsBase.getUUID()), effectsBase, mbe.getRank(), true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static void applyEquipmentResists(Mob mob){
|
||||
if(mob.equip != null){
|
||||
for(MobEquipment equipped : mob.equip.values()){
|
||||
ItemBase itemBase = equipped.getItemBase();
|
||||
if(itemBase.isHeavyArmor() || itemBase.isLightArmor() || itemBase.isMediumArmor()){
|
||||
mob.resists.setResist(Enum.DamageType.Crush, mob.resists.getResist(Enum.DamageType.Crush,0) + itemBase.getCrushResist());
|
||||
mob.resists.setResist(Enum.DamageType.Slash, mob.resists.getResist(Enum.DamageType.Slash,0) + itemBase.getCrushResist());
|
||||
mob.resists.setResist(Enum.DamageType.Pierce, mob.resists.getResist(Enum.DamageType.Pierce,0) + itemBase.getCrushResist());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ public class MobAI {
|
||||
|
||||
if (playercity != null)
|
||||
for (Mob guard : playercity.getParent().zoneMobSet)
|
||||
if (guard.behaviourType != null && guard.behaviourType.equals(Enum.MobBehaviourType.GuardCaptain))
|
||||
if (guard.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN))
|
||||
if (guard.getCombatTarget() == null && !guard.getGuild().equals(mob.getGuild()))
|
||||
guard.setCombatTarget(mob);
|
||||
|
||||
@@ -261,7 +261,7 @@ public class MobAI {
|
||||
|
||||
//guard captains inherit barracks patrol points dynamically
|
||||
|
||||
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardCaptain)) {
|
||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN)) {
|
||||
|
||||
Building barracks = mob.building;
|
||||
|
||||
@@ -281,7 +281,7 @@ public class MobAI {
|
||||
|
||||
MovementUtilities.aiMove(mob, mob.destination, true);
|
||||
|
||||
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardCaptain))
|
||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN))
|
||||
for (Entry<Mob, Integer> minion : mob.siegeMinionMap.entrySet())
|
||||
|
||||
//make sure mob is out of combat stance
|
||||
@@ -313,12 +313,13 @@ public class MobAI {
|
||||
|
||||
int contractID;
|
||||
|
||||
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardMinion))
|
||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN))
|
||||
contractID = mob.guardCaptain.contract.getContractID();
|
||||
else
|
||||
contractID = mob.contract.getContractID();
|
||||
|
||||
if (Enum.MinionType.ContractToMinionMap.get(contractID).isMage() == false)
|
||||
//exception for werewolf and werebear guard captains
|
||||
if (Enum.MinionType.ContractToMinionMap.get(contractID).isMage() == false && contractID != 980111 && contractID != 980110)
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -615,7 +616,7 @@ public class MobAI {
|
||||
|
||||
if (mob.despawned && mob.isPlayerGuard()) {
|
||||
|
||||
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardMinion)) {
|
||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION)) {
|
||||
if (mob.guardCaptain.isAlive() == false || ((Mob) mob.guardCaptain).despawned == true) {
|
||||
|
||||
//minions don't respawn while guard captain is dead
|
||||
@@ -632,7 +633,7 @@ public class MobAI {
|
||||
|
||||
//check to send mob home for player guards to prevent exploit of dragging guards away and then teleporting
|
||||
|
||||
if (mob.behaviourType.equals(Enum.MobBehaviourType.Pet1) == false)
|
||||
if (!mob.agentType.equals(Enum.AIAgentType.PET))
|
||||
CheckToSendMobHome(mob);
|
||||
|
||||
return;
|
||||
@@ -653,7 +654,7 @@ public class MobAI {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mob.behaviourType.equals(Enum.MobBehaviourType.Pet1) == false)
|
||||
if (mob.agentType.equals(Enum.AIAgentType.PET) == false)
|
||||
CheckToSendMobHome(mob);
|
||||
|
||||
if (mob.getCombatTarget() != null) {
|
||||
@@ -908,7 +909,7 @@ public class MobAI {
|
||||
return;
|
||||
|
||||
if (mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter) && MovementUtilities.inRangeDropAggro(mob, (PlayerCharacter) mob.getCombatTarget()) == false &&
|
||||
mob.behaviourType.equals(Enum.MobBehaviourType.Pet1) == false) {
|
||||
mob.agentType.equals(Enum.AIAgentType.PET) == false) {
|
||||
|
||||
mob.setCombatTarget(null);
|
||||
return;
|
||||
@@ -927,7 +928,7 @@ public class MobAI {
|
||||
if (mob.behaviourType.isAgressive) {
|
||||
|
||||
if (mob.isPlayerGuard()) {
|
||||
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardCaptain))
|
||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN))
|
||||
CheckForPlayerGuardAggro(mob);
|
||||
} else {
|
||||
CheckForAggro(mob);
|
||||
@@ -947,7 +948,7 @@ public class MobAI {
|
||||
PowersManager.useMobPower(mob, mob, recall, 40);
|
||||
mob.setCombatTarget(null);
|
||||
|
||||
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardCaptain) && mob.isAlive()) {
|
||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN) && mob.isAlive()) {
|
||||
|
||||
//guard captain pulls his minions home with him
|
||||
|
||||
@@ -1028,7 +1029,7 @@ public class MobAI {
|
||||
if ((aggroMob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN)))
|
||||
continue;
|
||||
|
||||
if (aggroMob.behaviourType.equals(Enum.MobBehaviourType.Pet1))
|
||||
if (aggroMob.agentType.equals(Enum.AIAgentType.PET))
|
||||
continue;
|
||||
|
||||
if (mob.getLoc().distanceSquared2D(aggroMob.getLoc()) > sqr(50))
|
||||
@@ -1259,7 +1260,7 @@ public class MobAI {
|
||||
if (mob.getGuild().getNation().equals(target.getGuild().getNation()))
|
||||
return false;
|
||||
|
||||
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardMinion)) {
|
||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION)) {
|
||||
if (((Mob) mob.guardCaptain).building.getCity().cityOutlaws.contains(target.getObjectUUID()) == true) {
|
||||
return true;
|
||||
}
|
||||
@@ -1344,7 +1345,7 @@ public class MobAI {
|
||||
|
||||
MovementUtilities.aiMove(mob, mob.destination, true);
|
||||
|
||||
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardCaptain)) {
|
||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN)) {
|
||||
for (Entry<Mob, Integer> minion : mob.siegeMinionMap.entrySet()) {
|
||||
|
||||
//make sure mob is out of combat stance
|
||||
|
||||
@@ -96,7 +96,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
||||
writer.putString("A weapon suited to laying siege");
|
||||
}
|
||||
|
||||
private static void serializeGuardList(ByteBufferWriter writer, int minion) {
|
||||
private static void serializeGuardList(ByteBufferWriter writer, int minion, Mob captain) {
|
||||
|
||||
writer.putInt(1);
|
||||
|
||||
@@ -106,7 +106,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
||||
writer.putInt(minion);
|
||||
writer.putInt(1);
|
||||
writer.putInt(minion);
|
||||
writer.putInt(1);
|
||||
writer.putInt(captain.getRank());//minion rank
|
||||
writer.put((byte) 0);
|
||||
|
||||
writer.putInt(600); //roll time
|
||||
@@ -669,7 +669,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
||||
ConcurrentHashMap<Mob, Integer> siegeMinions = mobA.getSiegeMinionMap();
|
||||
|
||||
writer.putInt(siegeMinions.size() + 1);
|
||||
serializeGuardList(writer, mobA.getContract().getContractID()); //Guard
|
||||
serializeGuardList(writer, mobA.getContract().getContractID(), mobA); //Guard
|
||||
|
||||
if (siegeMinions != null && siegeMinions.size() > 0)
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
protected AtomicFloat mana = new AtomicFloat();
|
||||
protected float manaMax; // Health/Mana/Stamina
|
||||
protected AtomicBoolean isAlive = new AtomicBoolean(true);
|
||||
protected Resists resists = new Resists("Genric");
|
||||
public Resists resists = new Resists("Genric");
|
||||
protected ConcurrentHashMap<String, JobContainer> timers;
|
||||
protected ConcurrentHashMap<String, Long> timestamps;
|
||||
protected int atrHandOne;
|
||||
|
||||
@@ -69,7 +69,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
private int currentID;
|
||||
private long lastAttackTime = 0;
|
||||
private int lastMobPowerToken = 0;
|
||||
private HashMap<Integer, MobEquipment> equip = null;
|
||||
public HashMap<Integer, MobEquipment> equip = null;
|
||||
private DeferredPowerJob weaponPower;
|
||||
private DateTime upgradeDateTime = null;
|
||||
private boolean lootSync = false;
|
||||
@@ -397,11 +397,12 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
writer.putInt(mob.currentID);
|
||||
}
|
||||
|
||||
public static Mob createMob(int loadID, Vector3fImmutable spawn, Guild guild, Zone parent, Building building, Contract contract, String pirateName, int level) {
|
||||
public static Mob createMob(int loadID, Vector3fImmutable spawn, Guild guild, Zone parent, Building building, Contract contract, String pirateName, int level, AIAgentType mobType) {
|
||||
|
||||
Mob mobile = new Mob();
|
||||
mobile.dbID = MBServerStatics.NO_DB_ROW_ASSIGNED_YET;
|
||||
mobile.agentType = AIAgentType.MOBILE;
|
||||
//mobile.agentType = AIAgentType.MOBILE; this method is only called to make guard captains and wall archers
|
||||
mobile.agentType = mobType;
|
||||
mobile.behaviourType = MobBehaviourType.None;
|
||||
mobile.loadID = loadID;
|
||||
mobile.level = (short) level;
|
||||
@@ -724,8 +725,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
conVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.Constitution));
|
||||
intVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.Intelligence));
|
||||
spiVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.Spirit));
|
||||
} else {
|
||||
// apply dex penalty for armor
|
||||
}
|
||||
|
||||
// Set current stats
|
||||
@@ -974,7 +973,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
this.setLoc(this.lastBindLoc);
|
||||
this.stopMovement(this.lastBindLoc);
|
||||
|
||||
NPCManager.applyRuneSetEffects(this);
|
||||
NPCManager.applyMobbaseEffects(this);
|
||||
|
||||
this.recalculateStats();
|
||||
this.setHealth(this.healthMax);
|
||||
@@ -1663,9 +1662,9 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
if (this.getMobBase().enemy.size() > 0)
|
||||
this.enemy.addAll(this.getMobBase().enemy);
|
||||
}
|
||||
|
||||
NPCManager.applyRuneSetEffects(this);
|
||||
recalculateStats();
|
||||
NPCManager.applyMobbaseEffects(this);
|
||||
NPCManager.applyEquipmentResists(this);
|
||||
this.recalculateStats();
|
||||
this.setHealth(this.healthMax);
|
||||
|
||||
// Set bounds for this mobile
|
||||
@@ -1717,16 +1716,9 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
if (!ac.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||
return;
|
||||
|
||||
PlayerCharacter player = (PlayerCharacter) ac;
|
||||
|
||||
if (this.getCombatTarget() == null) {
|
||||
this.setCombatTarget(ac);
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getObjectUUID() == this.getCombatTarget().getObjectUUID())
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
public void setRank(int newRank) {
|
||||
@@ -1870,5 +1862,4 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
lock.writeLock().unlock();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ public class MobBase extends AbstractGameObject {
|
||||
private final String firstName;
|
||||
private final byte level;
|
||||
private final float scale;
|
||||
public final ArrayList<MobBaseEffects> effectsList;
|
||||
public int bootySet;
|
||||
public Enum.MobBehaviourType fsm;
|
||||
public EnumBitSet<Enum.MonsterType> notEnemy;
|
||||
@@ -108,6 +109,8 @@ public class MobBase extends AbstractGameObject {
|
||||
|
||||
this.mobBaseStats = DbManager.MobBaseQueries.LOAD_STATS(this.loadID);
|
||||
DbManager.MobBaseQueries.LOAD_ALL_MOBBASE_SPEEDS(this);
|
||||
//load effects for mobbase
|
||||
this.effectsList = DbManager.MobBaseQueries.GET_RUNEBASE_EFFECTS(this.loadID);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user