Compare commits
101 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bdf6500260 | |||
| db4eb0579e | |||
| 76f33534d4 | |||
| 39fea5bc2f | |||
| 660d5c1270 | |||
| 781e2fc9b2 | |||
| c2a2464fe8 | |||
| beb3c15eb3 | |||
| 553010bb7b | |||
| 8d12bbf453 | |||
| fa7588826a | |||
| 332f191e19 | |||
| 8151382a6b | |||
| ae44a21be1 | |||
| b0ff0995de | |||
| e711095ecd | |||
| 08de97a2a8 | |||
| 5eb6302d2a | |||
| 2e346ae7fd | |||
| 1285d12915 | |||
| 8b5cb9258e | |||
| ef3e3a0392 | |||
| 8fca6572f9 | |||
| 33eaf0e583 | |||
| 16acd1c08c | |||
| a8e8804ce3 | |||
| b8c0f997f6 | |||
| 11e63f38b1 | |||
| ff36d8f3db | |||
| 975542d8af | |||
| d71a9415b4 | |||
| e948da95b5 | |||
| 9a6510c320 | |||
| 57ff1ede97 | |||
| 7c0f2563f7 | |||
| d11a954b40 | |||
| f354339af1 | |||
| 89658bb77a | |||
| 1ff0238b6e | |||
| e777434d57 | |||
| ee6efc30a3 | |||
| 0758bb5f38 | |||
| 299d5725a6 | |||
| d7c9b31ec7 | |||
| 6c78bee5c1 | |||
| dba0cbd5f9 | |||
| 0752e780f2 | |||
| c43919ce01 | |||
| 0d95510b72 | |||
| 60fb2571a2 | |||
| 90cbe90492 | |||
| 95c203b0ed | |||
| 449c5c5c77 | |||
| 9aff208403 | |||
| 4318849127 | |||
| 29e8cdf699 | |||
| 4427dbdcad | |||
| af4c3819b9 | |||
| 39379e1ac0 | |||
| 71eeb3f6b8 | |||
| d409ef49af | |||
| e7a80e9280 | |||
| 65c2d2ea0b | |||
| 92666dca21 | |||
| 3e1a79c248 | |||
| 73a1ce083a | |||
| 22dacebc5e | |||
| 80d0948e24 | |||
| 58b427b977 | |||
| a4cab3565a | |||
| 205c9580e3 | |||
| 70a0ed135b | |||
| f556181d77 | |||
| d48e26904e | |||
| 19232ac405 | |||
| 9ee2ccc8af | |||
| 7079bb6a63 | |||
| 0ab5827ee5 | |||
| c5443f622c | |||
| e4aa276cca | |||
| 90ff2d679e | |||
| da26c35d5a | |||
| 779e3da74e | |||
| e358c08773 | |||
| 2945fa3a47 | |||
| ab1541e741 | |||
| 3aeaa709a5 | |||
| 91e627df6b | |||
| d0795e9e1c | |||
| 0e12dd4874 | |||
| 25c0e48181 | |||
| 0d43c3620d | |||
| 2f6137f8df | |||
| 2843b86a93 | |||
| 8235de07ff | |||
| e2f9a4c7f0 | |||
| 55c6e3cf93 | |||
| 11c154e564 | |||
| 7fc0d27c3c | |||
| 1ac76cfcd8 | |||
| c8ed04aaaf |
@@ -2877,10 +2877,11 @@ public class Enum {
|
||||
|
||||
public enum AIAgentType {
|
||||
MOBILE,
|
||||
GUARDCAPTAIN,
|
||||
GUARDMINION,
|
||||
GUARDWALLARCHER,
|
||||
PET,
|
||||
CHARMED,
|
||||
|
||||
SIEGEENGINE,
|
||||
GUARD;
|
||||
SIEGEENGINE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ public enum InterestManager implements Runnable {
|
||||
|
||||
else {
|
||||
if (pc != null)
|
||||
if (pcc.getSeeInvis() < pc.getHidden())
|
||||
if (pcc.getSeeInvis() < pc.hidden)
|
||||
continue;
|
||||
|
||||
if (!cc.sendMsg(uom)) {
|
||||
@@ -340,7 +340,7 @@ public enum InterestManager implements Runnable {
|
||||
if (loadedPlayer.getObjectUUID() == player.getObjectUUID())
|
||||
continue;
|
||||
|
||||
if (player.getSeeInvis() < loadedPlayer.getHidden())
|
||||
if (player.getSeeInvis() < loadedPlayer.hidden)
|
||||
continue;
|
||||
|
||||
if (loadedPlayer.safemodeInvis())
|
||||
@@ -372,7 +372,7 @@ public enum InterestManager implements Runnable {
|
||||
|
||||
if (playerLoadedObject.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||
PlayerCharacter loadedPlayer = (PlayerCharacter) playerLoadedObject;
|
||||
if (player.getSeeInvis() < loadedPlayer.getHidden())
|
||||
if (player.getSeeInvis() < loadedPlayer.hidden)
|
||||
toRemove.add(playerLoadedObject);
|
||||
else if (loadedPlayer.safemodeInvis())
|
||||
toRemove.add(playerLoadedObject);
|
||||
@@ -437,7 +437,7 @@ public enum InterestManager implements Runnable {
|
||||
|
||||
// dont load if invis
|
||||
|
||||
if (player.getSeeInvis() < awopc.getHidden())
|
||||
if (player.getSeeInvis() < awopc.hidden)
|
||||
continue;
|
||||
|
||||
lcm = new LoadCharacterMsg(awopc, PlayerCharacter.hideNonAscii());
|
||||
|
||||
@@ -33,7 +33,7 @@ public class dbMobHandler extends dbHandlerBase {
|
||||
Mob mobile = null;
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("CALL `mob_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);")) {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("CALL `mob_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);")) {
|
||||
|
||||
preparedStatement.setLong(1, toAdd.parentZoneUUID);
|
||||
preparedStatement.setInt(2, toAdd.loadID);
|
||||
@@ -48,6 +48,7 @@ public class dbMobHandler extends dbHandlerBase {
|
||||
preparedStatement.setInt(11, toAdd.buildingUUID);
|
||||
preparedStatement.setInt(12, toAdd.level);
|
||||
preparedStatement.setString(13, toAdd.firstName);
|
||||
preparedStatement.setString(14, toAdd.behaviourType.toString());
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
@@ -110,7 +111,7 @@ public class dbMobHandler extends dbHandlerBase {
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
String minionName = rs.getString("name");
|
||||
String minionName = rs.getString("minionName");
|
||||
Mob toCreate = Mob.createGuardMinion(guardCaptain, guardCaptain.getLevel(), minionName);
|
||||
|
||||
if (toCreate == null)
|
||||
@@ -126,15 +127,13 @@ public class dbMobHandler extends dbHandlerBase {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean ADD_TO_GUARDS(final long captainUID, final int mobBaseID, final String name, final int slot) {
|
||||
public boolean ADD_TO_GUARDS(final long captainUID, final String minionName) {
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_guards` (`captainUID`, `mobBaseID`,`name`, `slot`) VALUES (?,?,?,?)")) {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_guards` (`captainUID`, `minionName`) VALUES (?,?)")) {
|
||||
|
||||
preparedStatement.setLong(1, captainUID);
|
||||
preparedStatement.setInt(2, mobBaseID);
|
||||
preparedStatement.setString(3, name);
|
||||
preparedStatement.setInt(4, slot);
|
||||
preparedStatement.setString(2, minionName);
|
||||
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
|
||||
@@ -144,14 +143,13 @@ public class dbMobHandler extends dbHandlerBase {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean REMOVE_FROM_GUARDS(final long captainUID, final int mobBaseID, final int slot) {
|
||||
public boolean REMOVE_FROM_GUARDS(final long captainUID, final String minionName) {
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_guards` WHERE `captainUID`=? AND `mobBaseID`=? AND `slot` =?")) {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_guards` WHERE `captainUID`=? AND `minionName`=? LIMIT 1;")) {
|
||||
|
||||
preparedStatement.setLong(1, captainUID);
|
||||
preparedStatement.setInt(2, mobBaseID);
|
||||
preparedStatement.setInt(3, slot);
|
||||
preparedStatement.setString(2, minionName);
|
||||
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
|
||||
|
||||
@@ -15,15 +15,9 @@ import engine.gameManager.PowersManager;
|
||||
import engine.objects.Mob;
|
||||
import engine.objects.PreparedStatementShared;
|
||||
import engine.powers.EffectsBase;
|
||||
import engine.powers.MobPowerEntry;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class dbPowerHandler extends dbHandlerBase {
|
||||
@@ -86,43 +80,4 @@ public class dbPowerHandler extends dbHandlerBase {
|
||||
}
|
||||
}
|
||||
|
||||
public static HashMap<Integer, ArrayList<MobPowerEntry>> LOAD_MOB_POWERS() {
|
||||
|
||||
HashMap<Integer, ArrayList<MobPowerEntry>> mobPowers = new HashMap<>();
|
||||
MobPowerEntry mobPowerEntry;
|
||||
|
||||
int mobbaseID;
|
||||
int recordsRead = 0;
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_npc_mobbase_powers ORDER BY `id` ASC;")) {
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
|
||||
recordsRead++;
|
||||
|
||||
mobbaseID = rs.getInt("mobbaseUUID");
|
||||
mobPowerEntry = new MobPowerEntry(rs);
|
||||
|
||||
if (mobPowers.get(mobbaseID) == null) {
|
||||
ArrayList<MobPowerEntry> powerList = new ArrayList<>();
|
||||
powerList.add(mobPowerEntry);
|
||||
mobPowers.put(mobbaseID, powerList);
|
||||
} else {
|
||||
ArrayList<MobPowerEntry> powerList = mobPowers.get(mobbaseID);
|
||||
powerList.add(mobPowerEntry);
|
||||
mobPowers.put(mobbaseID, powerList);
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
return mobPowers;
|
||||
}
|
||||
|
||||
Logger.info("read: " + recordsRead + " cached: " + mobPowers.size());
|
||||
return mobPowers;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ package engine.db.handlers;
|
||||
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.objects.RuneBase;
|
||||
import engine.powers.RunePowerEntry;
|
||||
import engine.powers.RuneSkillAdjustEntry;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.Connection;
|
||||
@@ -27,6 +29,84 @@ public class dbRuneBaseHandler extends dbHandlerBase {
|
||||
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||
}
|
||||
|
||||
public static HashMap<Integer, ArrayList<RunePowerEntry>> LOAD_RUNE_POWERS() {
|
||||
|
||||
HashMap<Integer, ArrayList<RunePowerEntry>> mobPowers = new HashMap<>();
|
||||
RunePowerEntry runePowerEntry;
|
||||
|
||||
int rune_id;
|
||||
int recordsRead = 0;
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_rune_powers")) {
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
|
||||
recordsRead++;
|
||||
|
||||
rune_id = rs.getInt("rune_id");
|
||||
runePowerEntry = new RunePowerEntry(rs);
|
||||
|
||||
if (mobPowers.get(rune_id) == null) {
|
||||
ArrayList<RunePowerEntry> runePowerList = new ArrayList<>();
|
||||
runePowerList.add(runePowerEntry);
|
||||
mobPowers.put(rune_id, runePowerList);
|
||||
} else {
|
||||
ArrayList<RunePowerEntry> powerList = mobPowers.get(rune_id);
|
||||
powerList.add(runePowerEntry);
|
||||
mobPowers.put(rune_id, powerList);
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
return mobPowers;
|
||||
}
|
||||
|
||||
Logger.info("read: " + recordsRead + " cached: " + mobPowers.size());
|
||||
return mobPowers;
|
||||
}
|
||||
|
||||
public static HashMap<Integer, ArrayList<RuneSkillAdjustEntry>> LOAD_RUNE_SKILL_ADJUSTS() {
|
||||
|
||||
HashMap<Integer, ArrayList<RuneSkillAdjustEntry>> runeSkillAdjusts = new HashMap<>();
|
||||
RuneSkillAdjustEntry runeSkillAdjustEntry;
|
||||
|
||||
int rune_id;
|
||||
int recordsRead = 0;
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_rune_skill_adjusts")) {
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
|
||||
recordsRead++;
|
||||
|
||||
rune_id = rs.getInt("rune_id");
|
||||
runeSkillAdjustEntry = new RuneSkillAdjustEntry(rs);
|
||||
|
||||
if (runeSkillAdjusts.get(rune_id) == null) {
|
||||
ArrayList<RuneSkillAdjustEntry> skillAdjustList = new ArrayList<>();
|
||||
skillAdjustList.add(runeSkillAdjustEntry);
|
||||
runeSkillAdjusts.put(rune_id, skillAdjustList);
|
||||
} else {
|
||||
ArrayList<RuneSkillAdjustEntry> powerList = runeSkillAdjusts.get(rune_id);
|
||||
powerList.add(runeSkillAdjustEntry);
|
||||
runeSkillAdjusts.put(rune_id, powerList);
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
return runeSkillAdjusts;
|
||||
}
|
||||
|
||||
Logger.info("read: " + recordsRead + " cached: " + runeSkillAdjusts.size());
|
||||
return runeSkillAdjusts;
|
||||
}
|
||||
|
||||
public void GET_RUNE_REQS(final RuneBase rb) {
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -59,22 +59,25 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
||||
|
||||
|
||||
if (npc != null) {
|
||||
for (Mob mob : npc.siegeMinionMap.keySet()) {
|
||||
for (Integer minionUUID : npc.minions) {
|
||||
Mob mob = Mob.getMob(minionUUID);
|
||||
WorldGrid.RemoveWorldObject(mob);
|
||||
WorldGrid.removeObject(mob, pc);
|
||||
//Mob.getRespawnMap().remove(mob);
|
||||
|
||||
if (mob.getParentZone() != null)
|
||||
mob.getParentZone().zoneMobSet.remove(mob);
|
||||
}
|
||||
|
||||
DbManager.NPCQueries.DELETE_NPC(npc);
|
||||
DbManager.removeFromCache(GameObjectType.NPC,
|
||||
npc.getObjectUUID());
|
||||
WorldGrid.RemoveWorldObject(npc);
|
||||
} else if (mobA != null) {
|
||||
for (Mob mob : mobA.getSiegeMinionMap().keySet()) {
|
||||
for (Integer minionUUID : mobA.minions) {
|
||||
Mob mob = Mob.getMob(minionUUID);
|
||||
WorldGrid.RemoveWorldObject(mob);
|
||||
WorldGrid.removeObject(mob, pc);
|
||||
//Mob.getRespawnMap().remove(mob);
|
||||
|
||||
if (mob.getParentZone() != null)
|
||||
mob.getParentZone().zoneMobSet.remove(mob);
|
||||
}
|
||||
@@ -151,10 +154,11 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
||||
|
||||
|
||||
if (npc != null) {
|
||||
for (Mob mob : npc.siegeMinionMap.keySet()) {
|
||||
for (Integer minionUUID : npc.minions) {
|
||||
Mob mob = Mob.getMob(minionUUID);
|
||||
WorldGrid.RemoveWorldObject(mob);
|
||||
WorldGrid.removeObject(mob, pc);
|
||||
//Mob.getRespawnMap().remove(mob);
|
||||
|
||||
if (mob.getParentZone() != null)
|
||||
mob.getParentZone().zoneMobSet.remove(mob);
|
||||
}
|
||||
@@ -163,10 +167,11 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
||||
npc.getObjectUUID());
|
||||
WorldGrid.RemoveWorldObject(npc);
|
||||
} else if (mobA != null) {
|
||||
for (Mob mob : mobA.getSiegeMinionMap().keySet()) {
|
||||
for (Integer minionUUID : mobA.minions) {
|
||||
Mob mob = Mob.getMob(minionUUID);
|
||||
WorldGrid.RemoveWorldObject(mob);
|
||||
WorldGrid.removeObject(mob, pc);
|
||||
//Mob.getRespawnMap().remove(mob);
|
||||
|
||||
if (mob.getParentZone() != null)
|
||||
mob.getParentZone().zoneMobSet.remove(mob);
|
||||
}
|
||||
|
||||
@@ -154,24 +154,29 @@ public class RemoveObjectCmd extends AbstractDevCmd {
|
||||
mobA = (Mob) ac;
|
||||
|
||||
if (npc != null) {
|
||||
for (Mob mob : npc.siegeMinionMap.keySet()) {
|
||||
WorldGrid.RemoveWorldObject(mob);
|
||||
WorldGrid.removeObject(mob, pc);
|
||||
//Mob.getRespawnMap().remove(mob);
|
||||
if (mob.getParentZone() != null)
|
||||
mob.getParentZone().zoneMobSet.remove(mob);
|
||||
|
||||
for (Integer minionUUID : npc.minions) {
|
||||
Mob minionMob = Mob.getMob(minionUUID);
|
||||
WorldGrid.RemoveWorldObject(minionMob);
|
||||
WorldGrid.removeObject(minionMob, pc);
|
||||
|
||||
if (minionMob.getParentZone() != null)
|
||||
minionMob.getParentZone().zoneMobSet.remove(minionMob);
|
||||
}
|
||||
|
||||
DbManager.NPCQueries.DELETE_NPC(npc);
|
||||
DbManager.removeFromCache(npc);
|
||||
WorldGrid.RemoveWorldObject(npc);
|
||||
WorldGrid.removeObject(npc, pc);
|
||||
} else if (mobA != null) {
|
||||
for (Mob mob : mobA.getSiegeMinionMap().keySet()) {
|
||||
WorldGrid.RemoveWorldObject(mob);
|
||||
WorldGrid.removeObject(mob, pc);
|
||||
//Mob.getRespawnMap().remove(mob);
|
||||
if (mob.getParentZone() != null)
|
||||
mob.getParentZone().zoneMobSet.remove(mob);
|
||||
|
||||
for (Integer minionUUID : mobA.minions) {
|
||||
Mob minionMob = Mob.getMob(minionUUID);
|
||||
WorldGrid.RemoveWorldObject(minionMob);
|
||||
WorldGrid.removeObject(minionMob, pc);
|
||||
|
||||
if (minionMob.getParentZone() != null)
|
||||
minionMob.getParentZone().zoneMobSet.remove(minionMob);
|
||||
}
|
||||
DbManager.MobQueries.DELETE_MOB(mobA);
|
||||
DbManager.removeFromCache(mobA);
|
||||
@@ -209,11 +214,13 @@ public class RemoveObjectCmd extends AbstractDevCmd {
|
||||
if (npc.building != null)
|
||||
npc.building.getHirelings().remove(npc);
|
||||
|
||||
for (Mob mob : npc.siegeMinionMap.keySet()) {
|
||||
WorldGrid.RemoveWorldObject(mob);
|
||||
WorldGrid.removeObject(mob, pc);
|
||||
if (mob.getParentZone() != null)
|
||||
mob.getParentZone().zoneMobSet.remove(mob);
|
||||
for (Integer minionUUID : npc.minions) {
|
||||
Mob minionMob = Mob.getMob(minionUUID);
|
||||
WorldGrid.RemoveWorldObject(minionMob);
|
||||
WorldGrid.removeObject(minionMob, pc);
|
||||
|
||||
if (minionMob.getParentZone() != null)
|
||||
minionMob.getParentZone().zoneMobSet.remove(minionMob);
|
||||
}
|
||||
|
||||
DbManager.NPCQueries.DELETE_NPC(npc);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -9,13 +9,17 @@
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.mobileAI.MobAI;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Mob;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.powers.RunePowerEntry;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -57,6 +61,27 @@ public class aiInfoCmd extends AbstractDevCmd {
|
||||
Mob mob = (Mob) target;
|
||||
output = "Mob AI Information:" + newline;
|
||||
output += mob.getName() + newline;
|
||||
output += mob.agentType.toString() + newline;
|
||||
|
||||
int contractID = 0;
|
||||
|
||||
if (mob.isPlayerGuard() == true) {
|
||||
|
||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION))
|
||||
contractID = mob.guardCaptain.contract.getContractID();
|
||||
else
|
||||
contractID = mob.contract.getContractID();
|
||||
}
|
||||
|
||||
if (contractID != 0) {
|
||||
|
||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION)) {
|
||||
output += "Captain Contract: " + contractID + newline;
|
||||
output += "Captain UUID: " + mob.guardCaptain.getObjectUUID() + newline;
|
||||
} else
|
||||
output += "Contract: " + contractID + newline;
|
||||
}
|
||||
|
||||
if (mob.behaviourType != null) {
|
||||
output += "BehaviourType: " + mob.behaviourType.toString() + newline;
|
||||
if (mob.behaviourType.BehaviourHelperType != null) {
|
||||
@@ -88,10 +113,43 @@ public class aiInfoCmd extends AbstractDevCmd {
|
||||
if (mob.guardedCity != null)
|
||||
output += "Patrolling: " + mob.guardedCity.getCityName() + newline;
|
||||
|
||||
output += "Can Cast: " + MobAI.canCast(mob) + newline;
|
||||
output += "Powers:" + newline;
|
||||
|
||||
for (int token : mob.mobPowers.keySet())
|
||||
output += PowersManager.getPowerByToken(token).getName() + newline;
|
||||
ArrayList<RunePowerEntry> powerEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.getMobBaseID()));
|
||||
|
||||
// Additional powers may come from the contract ID. This is to support
|
||||
// powers for player guards irrespective of the mobbase used.
|
||||
|
||||
if (mob.isPlayerGuard()) {
|
||||
|
||||
ArrayList<RunePowerEntry> contractEntries = new ArrayList<>();
|
||||
|
||||
if (mob.contract != null)
|
||||
contractEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.contractUUID));
|
||||
|
||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION))
|
||||
contractEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.guardCaptain.contractUUID));
|
||||
|
||||
powerEntries.addAll(contractEntries);
|
||||
|
||||
}
|
||||
|
||||
for (RunePowerEntry runePowerEntry : powerEntries)
|
||||
output += PowersManager.getPowerByToken(runePowerEntry.token).getName() + newline;
|
||||
|
||||
// List outlaws defined for this player guard's city
|
||||
|
||||
if (mob.isPlayerGuard()) {
|
||||
|
||||
ArrayList<Integer> outlaws = new ArrayList(mob.guardedCity.cityOutlaws);
|
||||
|
||||
if (outlaws.isEmpty() == false)
|
||||
output += "Outlaws: " + newline;
|
||||
|
||||
for (Integer outlawUUID : outlaws)
|
||||
output += outlawUUID + newline;
|
||||
}
|
||||
|
||||
throwbackInfo(playerCharacter, output);
|
||||
}
|
||||
|
||||
@@ -530,41 +530,63 @@ public enum BuildingManager {
|
||||
else
|
||||
rank = 10;
|
||||
|
||||
Mob mob;
|
||||
Mob mobile;
|
||||
NPC npc;
|
||||
|
||||
if (NPC.ISWallArcher(contract)) {
|
||||
|
||||
mob = 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 (mob == null)
|
||||
if (mobile == null)
|
||||
return false;
|
||||
|
||||
mob.setLoc(mob.getLoc());
|
||||
// Configure AI and write new mobile to disk
|
||||
|
||||
mobile.behaviourType = Enum.MobBehaviourType.GuardWallArcher;
|
||||
mobile = DbManager.MobQueries.PERSIST(mobile);
|
||||
|
||||
// Spawn new mobile
|
||||
|
||||
mobile.setLoc(mobile.getLoc());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (NPC.ISGuardCaptain(contract.getContractID())) {
|
||||
|
||||
mob = 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 (mob == null)
|
||||
if (mobile == null)
|
||||
return false;
|
||||
|
||||
mob.setLoc(mob.getLoc());
|
||||
// Configure AI and write new mobile to disk
|
||||
|
||||
mobile.behaviourType = Enum.MobBehaviourType.GuardCaptain;
|
||||
mobile = DbManager.MobQueries.PERSIST(mobile);
|
||||
|
||||
// Spawn new mobile
|
||||
|
||||
mobile.setLoc(mobile.getLoc());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (contract.getContractID() == 910) {
|
||||
|
||||
//guard dog
|
||||
mob = 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 (mob == null)
|
||||
if (mobile == null)
|
||||
return false;
|
||||
|
||||
mob.setLoc(mob.getLoc());
|
||||
// Configure AI and write new mobile to disk
|
||||
|
||||
mobile.behaviourType = Enum.MobBehaviourType.GuardCaptain;
|
||||
mobile = DbManager.MobQueries.PERSIST(mobile);
|
||||
|
||||
// Spawn new mobile
|
||||
|
||||
mobile.setLoc(mobile.getLoc());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -788,7 +788,7 @@ public enum ChatManager {
|
||||
it.remove();
|
||||
else {
|
||||
PlayerCharacter pcc = (PlayerCharacter) awo;
|
||||
if (pcc.getSeeInvis() < pc.getHidden())
|
||||
if (pcc.getSeeInvis() < pc.hidden)
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ public enum CombatManager {
|
||||
|
||||
City playerCity = ZoneManager.getCityAtLocation(playerCharacter.getLoc());
|
||||
|
||||
if (playerCity != null && playerCity.getGuild().getNation().equals(playerCharacter.getGuild().getNation()) == false && playerCity.cityOutlaws.contains(playerCharacter.getObjectUUID()) == false)
|
||||
if (playerCity != null && playerCity.cityOutlaws.contains(playerCharacter.getObjectUUID()) == false)
|
||||
playerCity.cityOutlaws.add(playerCharacter.getObjectUUID());
|
||||
}
|
||||
|
||||
@@ -826,8 +826,8 @@ public enum CombatManager {
|
||||
damage *= 2.5f; //increase damage if sitting
|
||||
|
||||
if (tarAc.getObjectType() == GameObjectType.Mob) {
|
||||
if(ac.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||
((Mob)tarAc).playerAgroMap.put(ac.getObjectUUID(), ((Mob) tarAc).playerAgroMap.get(ac.getObjectUUID()) + damage);
|
||||
if (ac.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||
((Mob) tarAc).playerAgroMap.put(ac.getObjectUUID(), ((Mob) tarAc).playerAgroMap.get(ac.getObjectUUID()) + damage);
|
||||
((Mob) tarAc).handleDirectAggro(ac);
|
||||
}
|
||||
|
||||
@@ -1268,61 +1268,75 @@ public enum CombatManager {
|
||||
}
|
||||
|
||||
//Called when character takes damage.
|
||||
public static void handleRetaliate(AbstractCharacter tarAc, AbstractCharacter ac) {
|
||||
public static void handleRetaliate(AbstractCharacter target, AbstractCharacter attacker) {
|
||||
|
||||
if (ac == null || tarAc == null)
|
||||
if (attacker == null || target == null)
|
||||
return;
|
||||
|
||||
if (ac.equals(tarAc))
|
||||
if (attacker.equals(target))
|
||||
return;
|
||||
|
||||
if (tarAc.isMoving() && tarAc.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||
if (target.isMoving() && target.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||
return;
|
||||
|
||||
if (!tarAc.isAlive() || !ac.isAlive())
|
||||
if (!target.isAlive() || !attacker.isAlive())
|
||||
return;
|
||||
|
||||
boolean isCombat = tarAc.isCombat();
|
||||
boolean isCombat = target.isCombat();
|
||||
|
||||
//If target in combat and has no target, then attack back
|
||||
|
||||
AbstractWorldObject awoCombTar = tarAc.getCombatTarget();
|
||||
AbstractWorldObject awoCombTar = target.getCombatTarget();
|
||||
|
||||
if ((tarAc.isCombat() && awoCombTar == null) || (isCombat && awoCombTar != null && (!awoCombTar.isAlive() || tarAc.isCombat() && NotInRange(tarAc, awoCombTar, tarAc.getRange()))) || (tarAc != null && tarAc.getObjectType() == GameObjectType.Mob && ((Mob) tarAc).isSiege()))
|
||||
if (tarAc.getObjectType().equals(GameObjectType.PlayerCharacter)) { // we are in combat with no valid target
|
||||
if ((target.isCombat() && awoCombTar == null) || (isCombat && awoCombTar != null && (!awoCombTar.isAlive() || target.isCombat() && NotInRange(target, awoCombTar, target.getRange()))) || (target != null && target.getObjectType() == GameObjectType.Mob && ((Mob) target).isSiege()))
|
||||
if (target.getObjectType().equals(GameObjectType.PlayerCharacter)) { // we are in combat with no valid target
|
||||
|
||||
PlayerCharacter pc = (PlayerCharacter) tarAc;
|
||||
tarAc.setCombatTarget(ac);
|
||||
pc.setLastTarget(ac.getObjectType(), ac.getObjectUUID());
|
||||
PlayerCharacter pc = (PlayerCharacter) target;
|
||||
target.setCombatTarget(attacker);
|
||||
pc.setLastTarget(attacker.getObjectType(), attacker.getObjectUUID());
|
||||
|
||||
if (tarAc.getTimers() != null)
|
||||
if (!tarAc.getTimers().containsKey("Attack" + MBServerStatics.SLOT_MAINHAND))
|
||||
CombatManager.AttackTarget((PlayerCharacter) tarAc, tarAc.getCombatTarget());
|
||||
if (target.getTimers() != null)
|
||||
if (!target.getTimers().containsKey("Attack" + MBServerStatics.SLOT_MAINHAND))
|
||||
CombatManager.AttackTarget((PlayerCharacter) target, target.getCombatTarget());
|
||||
}
|
||||
|
||||
//Handle pet retaliate if assist is on and pet doesn't have a target.
|
||||
|
||||
if (tarAc.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||
if (target.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||
|
||||
Mob pet = ((PlayerCharacter) tarAc).getPet();
|
||||
Mob pet = ((PlayerCharacter) target).getPet();
|
||||
|
||||
if (pet != null && pet.assist && pet.getCombatTarget() == null)
|
||||
pet.setCombatTarget(ac);
|
||||
pet.setCombatTarget(attacker);
|
||||
}
|
||||
|
||||
//Handle Mob Retaliate.
|
||||
|
||||
if (tarAc.getObjectType() == GameObjectType.Mob) {
|
||||
if (target.getObjectType() == GameObjectType.Mob) {
|
||||
|
||||
Mob retaliater = (Mob) tarAc;
|
||||
Mob attackedMobile = (Mob) target;
|
||||
|
||||
if (retaliater.getCombatTarget() != null && !retaliater.isSiege())
|
||||
//handle minion informing his captain of an attack
|
||||
|
||||
if (attackedMobile.agentType.equals(AIAgentType.GUARDMINION) && attackedMobile.guardCaptain != null && attackedMobile.guardCaptain.isAlive()) {
|
||||
|
||||
if (attackedMobile.guardCaptain.combatTarget == null)
|
||||
attackedMobile.guardCaptain.setCombatTarget(attacker);
|
||||
|
||||
// Add to city outlaw list
|
||||
|
||||
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter) &&
|
||||
attackedMobile.guardedCity.cityOutlaws.contains(attacker.getObjectUUID()) == false)
|
||||
attackedMobile.guardedCity.cityOutlaws.add(attacker.getObjectUUID());
|
||||
|
||||
}
|
||||
|
||||
// Mobile already has a target; don't switch.
|
||||
|
||||
if (attackedMobile.getCombatTarget() != null && !attackedMobile.isSiege())
|
||||
return;
|
||||
|
||||
if (ac.getObjectType() == GameObjectType.Mob && retaliater.isSiege())
|
||||
return;
|
||||
|
||||
retaliater.setCombatTarget(ac);
|
||||
attackedMobile.setCombatTarget(attacker);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.PetMsg;
|
||||
import engine.objects.*;
|
||||
import engine.powers.EffectsBase;
|
||||
import engine.powers.RuneSkillAdjustEntry;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -23,84 +24,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;
|
||||
|
||||
//Apply all rune effects.
|
||||
|
||||
if (NPCManager._runeSetMap.get(mob.runeSet).contains(252623)) {
|
||||
mob.isPlayerGuard = true;
|
||||
}
|
||||
|
||||
// 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);
|
||||
@@ -199,37 +122,39 @@ public enum NPCManager {
|
||||
|
||||
public static void removeSiegeMinions(Mob mobile) {
|
||||
|
||||
for (Mob toRemove : mobile.siegeMinionMap.keySet()) {
|
||||
for (Integer minionUUID : mobile.minions) {
|
||||
|
||||
Mob siegeMinion = Mob.getMob(minionUUID);
|
||||
|
||||
if (mobile.isMoving()) {
|
||||
|
||||
mobile.stopMovement(mobile.getLoc());
|
||||
|
||||
if (toRemove.parentZone != null)
|
||||
toRemove.parentZone.zoneMobSet.remove(toRemove);
|
||||
if (siegeMinion.parentZone != null)
|
||||
siegeMinion.parentZone.zoneMobSet.remove(siegeMinion);
|
||||
}
|
||||
|
||||
try {
|
||||
toRemove.clearEffects();
|
||||
siegeMinion.clearEffects();
|
||||
} catch (Exception e) {
|
||||
Logger.error(e.getMessage());
|
||||
}
|
||||
|
||||
if (toRemove.parentZone != null)
|
||||
toRemove.parentZone.zoneMobSet.remove(toRemove);
|
||||
if (siegeMinion.parentZone != null)
|
||||
siegeMinion.parentZone.zoneMobSet.remove(siegeMinion);
|
||||
|
||||
WorldGrid.RemoveWorldObject(toRemove);
|
||||
WorldGrid.removeObject(toRemove);
|
||||
DbManager.removeFromCache(toRemove);
|
||||
WorldGrid.RemoveWorldObject(siegeMinion);
|
||||
WorldGrid.removeObject(siegeMinion);
|
||||
DbManager.removeFromCache(siegeMinion);
|
||||
|
||||
|
||||
PlayerCharacter petOwner = (PlayerCharacter) toRemove.guardCaptain;
|
||||
PlayerCharacter petOwner = (PlayerCharacter) siegeMinion.guardCaptain;
|
||||
|
||||
if (petOwner != null) {
|
||||
|
||||
petOwner.setPet(null);
|
||||
|
||||
toRemove.guardCaptain = null;
|
||||
siegeMinion.guardCaptain = null;
|
||||
|
||||
PetMsg petMsg = new PetMsg(5, null);
|
||||
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
|
||||
@@ -340,7 +265,7 @@ public enum NPCManager {
|
||||
|
||||
if (abstractCharacter.getObjectType().equals(Enum.GameObjectType.Mob) && ((Mob) abstractCharacter).behaviourType.equals(Enum.MobBehaviourType.SiegeEngine)) {
|
||||
Mob siegeMobile = (Mob) abstractCharacter;
|
||||
buildingSlot = siegeMobile.guardCaptain.siegeMinionMap.size() + 2;
|
||||
buildingSlot = siegeMobile.guardCaptain.minions.size() + 2;
|
||||
}
|
||||
|
||||
if (buildingSlot == -1)
|
||||
@@ -419,9 +344,85 @@ public enum NPCManager {
|
||||
mob.patrolPoints.add(newPatrolPoint);
|
||||
|
||||
if (i == 1) {
|
||||
mob.loc = newPatrolPoint;
|
||||
mob.setLoc(newPatrolPoint);
|
||||
mob.endLoc = newPatrolPoint;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void applyMobbaseSkill(Mob mob) {
|
||||
SkillsBase baseSkill = DbManager.SkillsBaseQueries.GET_BASE_BY_TOKEN(mob.mobBase.getMobBaseStats().getBaseSkill());
|
||||
if(baseSkill != null)
|
||||
mob.getSkills().put(baseSkill.getName(),new CharacterSkill(baseSkill,mob,mob.mobBase.getMobBaseStats().getBaseSkillAmount()));
|
||||
}
|
||||
|
||||
public static void applyRuneSkills(Mob mob, int runeID){
|
||||
//load mob skill adjustments from mobbase rune
|
||||
if(PowersManager._allRuneSkillAdjusts.containsKey(runeID))
|
||||
for(RuneSkillAdjustEntry entry : PowersManager._allRuneSkillAdjusts.get(runeID)) {
|
||||
if(SkillsBase.getFromCache(entry.skill_type) == null)
|
||||
SkillsBase.putInCache(DbManager.SkillsBaseQueries.GET_BASE_BY_NAME(entry.skill_type));
|
||||
SkillsBase skillBase = SkillsBase.getFromCache(entry.skill_type);
|
||||
if(skillBase == null)
|
||||
continue;
|
||||
if (entry.level <= mob.level)
|
||||
if (mob.skills.containsKey(entry.name) == false)
|
||||
mob.skills.put(entry.skill_type, new CharacterSkill(skillBase, mob, entry.rank));
|
||||
else
|
||||
mob.skills.put(entry.skill_type, new CharacterSkill(skillBase, mob, entry.rank + mob.skills.get(entry.skill_type).getNumTrains()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,13 +53,10 @@ public enum PowersManager {
|
||||
public static HashMap<Integer, AbstractPowerAction> powerActionsByID = new HashMap<>();
|
||||
public static HashMap<String, Integer> ActionTokenByIDString = new HashMap<>();
|
||||
public static HashMap<String, Integer> AnimationOverrides = new HashMap<>();
|
||||
public static HashMap<Integer, ArrayList<MobPowerEntry>> AllMobPowers;
|
||||
public static HashMap<Integer, ArrayList<RunePowerEntry>> _allRunePowers;
|
||||
public static HashMap<Integer, ArrayList<RuneSkillAdjustEntry>> _allRuneSkillAdjusts;
|
||||
private static JobScheduler js;
|
||||
|
||||
private PowersManager() {
|
||||
|
||||
}
|
||||
|
||||
public static void initPowersManager(boolean fullPowersLoad) {
|
||||
|
||||
if (fullPowersLoad)
|
||||
@@ -103,6 +100,16 @@ public enum PowersManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static ArrayList<RunePowerEntry> getPowersForRune(int rune_id) {
|
||||
|
||||
ArrayList<RunePowerEntry> powerEntries = PowersManager._allRunePowers.get(rune_id);
|
||||
|
||||
if (powerEntries == null)
|
||||
powerEntries = new ArrayList<>();
|
||||
|
||||
return powerEntries;
|
||||
}
|
||||
|
||||
// This pre-loads all powers and effects
|
||||
public static void InitializePowers() {
|
||||
|
||||
|
||||
+164
-280
@@ -23,6 +23,7 @@ import engine.net.client.msg.PowerProjectileMsg;
|
||||
import engine.objects.*;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.PowersBase;
|
||||
import engine.powers.RunePowerEntry;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
@@ -49,17 +50,19 @@ public class MobAI {
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.getObjectType().equals(Enum.GameObjectType.PlayerCharacter) &&
|
||||
!mob.canSee((AbstractCharacter) target)) {
|
||||
mob.setCombatTarget(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.getObjectType() == Enum.GameObjectType.PlayerCharacter && canCast(mob)) {
|
||||
|
||||
if (mob.isPlayerGuard() == false && MobCast(mob)) {
|
||||
if (MobCast(mob)) {
|
||||
mob.updateLocation();
|
||||
return;
|
||||
}
|
||||
|
||||
if (mob.isPlayerGuard() == true && GuardCast(mob)) {
|
||||
mob.updateLocation();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!CombatUtilities.inRangeToAttack(mob, target))
|
||||
@@ -165,7 +168,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);
|
||||
|
||||
@@ -249,18 +252,21 @@ public class MobAI {
|
||||
|
||||
try {
|
||||
|
||||
//make sure mob is out of combat stance
|
||||
|
||||
int patrolDelay = ThreadLocalRandom.current().nextInt((int) (MobAIThread.AI_PATROL_DIVISOR * 0.5f), MobAIThread.AI_PATROL_DIVISOR) + MobAIThread.AI_PATROL_DIVISOR;
|
||||
|
||||
//early exit while waiting to patrol again
|
||||
// early exit while waiting to patrol again.
|
||||
// Minions are force marched if captain is alive
|
||||
|
||||
boolean forced = mob.agentType.equals(Enum.AIAgentType.GUARDMINION) &&
|
||||
mob.guardCaptain.isAlive();
|
||||
|
||||
if (mob.stopPatrolTime + (patrolDelay * 1000) > System.currentTimeMillis())
|
||||
return;
|
||||
if (!forced)
|
||||
return;
|
||||
|
||||
//guard captains inherit barracks patrol points dynamically
|
||||
//guards inherit barracks patrol points dynamically
|
||||
|
||||
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardCaptain)) {
|
||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN) || mob.agentType.equals(Enum.AIAgentType.GUARDMINION)) {
|
||||
|
||||
Building barracks = mob.building;
|
||||
|
||||
@@ -275,24 +281,28 @@ public class MobAI {
|
||||
if (mob.lastPatrolPointIndex > mob.patrolPoints.size() - 1)
|
||||
mob.lastPatrolPointIndex = 0;
|
||||
|
||||
mob.destination = mob.patrolPoints.get(mob.lastPatrolPointIndex);
|
||||
mob.lastPatrolPointIndex += 1;
|
||||
// Minions are given marching orders by the captain if he is alive
|
||||
|
||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION) && mob.guardCaptain.isAlive()) {
|
||||
Mob captain = (Mob) mob.guardCaptain;
|
||||
mob.destination = captain.destination.add(Formation.getOffset(2, mob.guardCaptain.minions.indexOf(mob.getObjectUUID()) + 3));
|
||||
mob.lastPatrolPointIndex = captain.lastPatrolPointIndex;
|
||||
} else {
|
||||
mob.destination = mob.patrolPoints.get(mob.lastPatrolPointIndex);
|
||||
mob.lastPatrolPointIndex += 1;
|
||||
}
|
||||
|
||||
// Captain orders minions to patrol
|
||||
|
||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN))
|
||||
for (Integer minionUUID : mob.minions) {
|
||||
Mob minion = Mob.getMob(minionUUID);
|
||||
if (minion.isAlive() && minion.combatTarget == null)
|
||||
MobAI.Patrol(minion);
|
||||
}
|
||||
|
||||
MovementUtilities.aiMove(mob, mob.destination, true);
|
||||
|
||||
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardCaptain))
|
||||
for (Entry<Mob, Integer> minion : mob.siegeMinionMap.entrySet())
|
||||
|
||||
//make sure mob is out of combat stance
|
||||
|
||||
if (minion.getKey().despawned == false) {
|
||||
if (MovementUtilities.canMove(minion.getKey())) {
|
||||
Vector3f minionOffset = Formation.getOffset(2, minion.getValue() + 3);
|
||||
minion.getKey().updateLocation();
|
||||
Vector3fImmutable formationPatrolPoint = new Vector3fImmutable(mob.destination.x + minionOffset.x, mob.destination.y, mob.destination.z + minionOffset.z);
|
||||
MovementUtilities.aiMove(minion.getKey(), formationPatrolPoint, true);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackTarget" + " " + e.getMessage());
|
||||
}
|
||||
@@ -300,6 +310,8 @@ public class MobAI {
|
||||
|
||||
public static boolean canCast(Mob mob) {
|
||||
|
||||
int contractID = 0;
|
||||
|
||||
try {
|
||||
|
||||
// Performs validation to determine if a
|
||||
@@ -308,26 +320,25 @@ public class MobAI {
|
||||
if (mob == null)
|
||||
return false;
|
||||
|
||||
if(mob.isPlayerGuard == true){
|
||||
if (mob.isPlayerGuard() == true) {
|
||||
|
||||
int contractID;
|
||||
|
||||
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardMinion))
|
||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION))
|
||||
contractID = mob.guardCaptain.contract.getContractID();
|
||||
else
|
||||
contractID = mob.contract.getContractID();
|
||||
|
||||
if(Enum.MinionType.ContractToMinionMap.get(contractID).isMage() == false)
|
||||
// exception allowing werewolf and werebear guard captains to cast
|
||||
|
||||
if (Enum.MinionType.ContractToMinionMap.get(contractID).isMage() == false && contractID != 980103 && contractID != 980104)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mob.mobPowers.isEmpty())
|
||||
// Mobile has no powers defined in mobbase or contract..
|
||||
|
||||
if (PowersManager.getPowersForRune(mob.getMobBaseID()).isEmpty() &&
|
||||
PowersManager.getPowersForRune(contractID).isEmpty())
|
||||
return false;
|
||||
|
||||
if (!mob.canSee((PlayerCharacter) mob.getCombatTarget())) {
|
||||
mob.setCombatTarget(null);
|
||||
return false;
|
||||
}
|
||||
if (mob.nextCastTime == 0)
|
||||
mob.nextCastTime = System.currentTimeMillis();
|
||||
|
||||
@@ -346,8 +357,8 @@ public class MobAI {
|
||||
// and casts it on the current target (or itself). Validation
|
||||
// (including empty lists) is done previously within canCast();
|
||||
|
||||
ArrayList<Integer> powerTokens;
|
||||
ArrayList<Integer> purgeTokens;
|
||||
ArrayList<RunePowerEntry> powerEntries;
|
||||
ArrayList<RunePowerEntry> purgeEntries;
|
||||
AbstractCharacter target = (AbstractCharacter) mob.getCombatTarget();
|
||||
|
||||
if (mob.behaviourType.callsForHelp)
|
||||
@@ -355,38 +366,58 @@ public class MobAI {
|
||||
|
||||
// Generate a list of tokens from the mob powers for this mobile.
|
||||
|
||||
powerTokens = new ArrayList<>(mob.mobPowers.keySet());
|
||||
purgeTokens = new ArrayList<>();
|
||||
powerEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.getMobBaseID()));
|
||||
purgeEntries = new ArrayList<>();
|
||||
|
||||
// Additional powers may come from the contract ID. This is to support
|
||||
// powers for player guards irrespective of the mobbase used.
|
||||
|
||||
if (mob.isPlayerGuard()) {
|
||||
|
||||
ArrayList<RunePowerEntry> contractEntries = new ArrayList<>();
|
||||
|
||||
if (mob.contract != null)
|
||||
contractEntries = PowersManager.getPowersForRune(mob.contractUUID);
|
||||
|
||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION))
|
||||
contractEntries = PowersManager.getPowersForRune(mob.guardCaptain.contractUUID);
|
||||
|
||||
powerEntries.addAll(contractEntries);
|
||||
|
||||
}
|
||||
|
||||
// If player has this effect on them currently then remove
|
||||
// this token from our list.
|
||||
|
||||
for (int powerToken : powerTokens) {
|
||||
for (RunePowerEntry runePowerEntry : powerEntries) {
|
||||
|
||||
PowersBase powerBase = PowersManager.getPowerByToken(powerToken);
|
||||
PowersBase powerBase = PowersManager.getPowerByToken(runePowerEntry.token);
|
||||
|
||||
for (ActionsBase actionBase : powerBase.getActions()) {
|
||||
|
||||
String stackType = actionBase.stackType;
|
||||
|
||||
if (target.getEffects() != null && target.getEffects().containsKey(stackType))
|
||||
purgeTokens.add(powerToken);
|
||||
purgeEntries.add(runePowerEntry);
|
||||
}
|
||||
}
|
||||
|
||||
powerTokens.removeAll(purgeTokens);
|
||||
powerEntries.removeAll(purgeEntries);
|
||||
|
||||
// Sanity check
|
||||
|
||||
if (powerTokens.isEmpty())
|
||||
if (powerEntries.isEmpty())
|
||||
return false;
|
||||
|
||||
// Pick random spell from our list of powers
|
||||
|
||||
int powerToken = powerTokens.get(ThreadLocalRandom.current().nextInt(powerTokens.size()));
|
||||
int powerRank = mob.mobPowers.get(powerToken);
|
||||
RunePowerEntry runePowerEntry = powerEntries.get(ThreadLocalRandom.current().nextInt(powerEntries.size()));
|
||||
|
||||
PowersBase mobPower = PowersManager.getPowerByToken(powerToken);
|
||||
PowersBase mobPower = PowersManager.getPowerByToken(runePowerEntry.token);
|
||||
int powerRank = runePowerEntry.rank;
|
||||
|
||||
if (mob.isPlayerGuard())
|
||||
powerRank = getGuardPowerRank(mob);
|
||||
|
||||
//check for hit-roll
|
||||
|
||||
@@ -411,7 +442,7 @@ public class MobAI {
|
||||
msg.setUnknown04(2);
|
||||
|
||||
PowersManager.finishUseMobPower(msg, mob, 0, 0);
|
||||
long randomCooldown = (long)((ThreadLocalRandom.current().nextInt(10,15) * 1000) * MobAIThread.AI_CAST_FREQUENCY);
|
||||
long randomCooldown = (long) ((ThreadLocalRandom.current().nextInt(10, 15) * 1000) * MobAIThread.AI_CAST_FREQUENCY);
|
||||
|
||||
mob.nextCastTime = System.currentTimeMillis() + randomCooldown;
|
||||
return true;
|
||||
@@ -422,127 +453,33 @@ public class MobAI {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean GuardCast(Mob mob) {
|
||||
private static int getGuardPowerRank(Mob mob) {
|
||||
int powerRank = 1;
|
||||
|
||||
try {
|
||||
// Method picks a random spell from a mobile's list of powers
|
||||
// and casts it on the current target (or itself). Validation
|
||||
// (including empty lists) is done previously within canCast();
|
||||
|
||||
ArrayList<Integer> powerTokens;
|
||||
ArrayList<Integer> purgeTokens;
|
||||
AbstractCharacter target = (AbstractCharacter) mob.getCombatTarget();
|
||||
|
||||
if (mob.behaviourType.callsForHelp)
|
||||
MobCallForHelp(mob);
|
||||
|
||||
// Generate a list of tokens from the mob powers for this mobile.
|
||||
|
||||
powerTokens = new ArrayList<>(mob.mobPowers.keySet());
|
||||
purgeTokens = new ArrayList<>();
|
||||
|
||||
// If player has this effect on them currently then remove
|
||||
// this token from our list.
|
||||
|
||||
for (int powerToken : powerTokens) {
|
||||
|
||||
PowersBase powerBase = PowersManager.getPowerByToken(powerToken);
|
||||
|
||||
for (ActionsBase actionBase : powerBase.getActions()) {
|
||||
|
||||
String stackType = actionBase.stackType;
|
||||
|
||||
if (target.getEffects() != null && target.getEffects().containsKey(stackType))
|
||||
purgeTokens.add(powerToken);
|
||||
}
|
||||
}
|
||||
|
||||
powerTokens.removeAll(purgeTokens);
|
||||
|
||||
// Sanity check
|
||||
|
||||
if (powerTokens.isEmpty())
|
||||
return false;
|
||||
|
||||
int powerToken = 0;
|
||||
int nukeRoll = ThreadLocalRandom.current().nextInt(1,100);
|
||||
|
||||
if (nukeRoll < 55) {
|
||||
|
||||
//use direct damage spell
|
||||
powerToken = powerTokens.get(powerTokens.size() - 1);
|
||||
|
||||
} else {
|
||||
//use random spell
|
||||
powerToken = powerTokens.get(ThreadLocalRandom.current().nextInt(powerTokens.size()));
|
||||
}
|
||||
|
||||
int powerRank = 1;
|
||||
|
||||
switch(mob.getRank()){
|
||||
case 1:
|
||||
powerRank = 10;
|
||||
break;
|
||||
case 2:
|
||||
powerRank = 15;
|
||||
break;
|
||||
case 3:
|
||||
powerRank = 20;
|
||||
break;
|
||||
case 4:
|
||||
powerRank = 25;
|
||||
break;
|
||||
case 5:
|
||||
powerRank = 30;
|
||||
break;
|
||||
case 6:
|
||||
powerRank = 35;
|
||||
break;
|
||||
case 7:
|
||||
powerRank = 40;
|
||||
break;
|
||||
}
|
||||
|
||||
PowersBase mobPower = PowersManager.getPowerByToken(powerToken);
|
||||
|
||||
//check for hit-roll
|
||||
|
||||
if (mobPower.requiresHitRoll)
|
||||
if (CombatUtilities.triggerDefense(mob, mob.getCombatTarget()))
|
||||
return false;
|
||||
|
||||
// Cast the spell
|
||||
|
||||
if (CombatUtilities.inRange2D(mob, mob.getCombatTarget(), mobPower.getRange())) {
|
||||
|
||||
PerformActionMsg msg;
|
||||
|
||||
if (!mobPower.isHarmful() || mobPower.targetSelf) {
|
||||
|
||||
if (mobPower.category.equals("DISPEL")) {
|
||||
PowersManager.useMobPower(mob, target, mobPower, powerRank);
|
||||
msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, target);
|
||||
} else {
|
||||
PowersManager.useMobPower(mob, mob, mobPower, powerRank);
|
||||
msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, mob);
|
||||
}
|
||||
} else {
|
||||
PowersManager.useMobPower(mob, target, mobPower, powerRank);
|
||||
msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, target);
|
||||
}
|
||||
|
||||
msg.setUnknown04(2);
|
||||
|
||||
PowersManager.finishUseMobPower(msg, mob, 0, 0);
|
||||
|
||||
long randomCooldown = (long)((ThreadLocalRandom.current().nextInt(10,15) * 1000) * MobAIThread.AI_CAST_FREQUENCY);
|
||||
mob.nextCastTime = System.currentTimeMillis() + randomCooldown;
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: MobCast" + " " + e.getMessage());
|
||||
switch (mob.getRank()) {
|
||||
case 1:
|
||||
powerRank = 10;
|
||||
break;
|
||||
case 2:
|
||||
powerRank = 15;
|
||||
break;
|
||||
case 3:
|
||||
powerRank = 20;
|
||||
break;
|
||||
case 4:
|
||||
powerRank = 25;
|
||||
break;
|
||||
case 5:
|
||||
powerRank = 30;
|
||||
break;
|
||||
case 6:
|
||||
powerRank = 35;
|
||||
break;
|
||||
case 7:
|
||||
powerRank = 40;
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
return powerRank;
|
||||
}
|
||||
|
||||
public static void MobCallForHelp(Mob mob) {
|
||||
@@ -606,9 +543,9 @@ public class MobAI {
|
||||
|
||||
//override for guards
|
||||
|
||||
if (mob.despawned && mob.isPlayerGuard) {
|
||||
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
|
||||
@@ -625,7 +562,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;
|
||||
@@ -641,12 +578,12 @@ public class MobAI {
|
||||
//no players loaded, no need to proceed
|
||||
|
||||
if (mob.playerAgroMap.isEmpty()) {
|
||||
if(mob.getCombatTarget() != null)
|
||||
if (mob.getCombatTarget() != null)
|
||||
mob.setCombatTarget(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mob.behaviourType.equals(Enum.MobBehaviourType.Pet1) == false)
|
||||
if (mob.agentType.equals(Enum.AIAgentType.PET) == false)
|
||||
CheckToSendMobHome(mob);
|
||||
|
||||
if (mob.getCombatTarget() != null) {
|
||||
@@ -675,10 +612,8 @@ public class MobAI {
|
||||
|
||||
switch (mob.behaviourType) {
|
||||
case GuardCaptain:
|
||||
GuardCaptainLogic(mob);
|
||||
break;
|
||||
case GuardMinion:
|
||||
GuardMinionLogic(mob);
|
||||
GuardLogic(mob);
|
||||
break;
|
||||
case GuardWallArcher:
|
||||
GuardWallArcherLogic(mob);
|
||||
@@ -748,7 +683,6 @@ public class MobAI {
|
||||
aiAgent.setCombatTarget(loadedPlayer);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (aiAgent.getCombatTarget() == null) {
|
||||
@@ -787,49 +721,41 @@ public class MobAI {
|
||||
|
||||
case Pet1:
|
||||
|
||||
|
||||
if ((PlayerCharacter) mob.guardCaptain == null)
|
||||
if (mob.guardCaptain == null)
|
||||
return;
|
||||
|
||||
//mob no longer has its owner loaded, translate pet to owner
|
||||
|
||||
if (!mob.playerAgroMap.containsKey(((PlayerCharacter) mob.guardCaptain).getObjectUUID())) {
|
||||
|
||||
//mob no longer has its owner loaded, translocate pet to owner
|
||||
|
||||
|
||||
MovementManager.translocate(mob, ((PlayerCharacter) mob.guardCaptain).getLoc(), null);
|
||||
if (!mob.playerAgroMap.containsKey(mob.guardCaptain.getObjectUUID())) {
|
||||
MovementManager.translocate(mob, mob.guardCaptain.getLoc(), null);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mob.getCombatTarget() == null) {
|
||||
|
||||
//move back to owner
|
||||
|
||||
|
||||
if (CombatUtilities.inRange2D(mob, (PlayerCharacter) mob.guardCaptain, 6))
|
||||
if (CombatUtilities.inRange2D(mob, mob.guardCaptain, 6))
|
||||
return;
|
||||
|
||||
|
||||
mob.destination = ((PlayerCharacter) mob.guardCaptain).getLoc();
|
||||
mob.destination = mob.guardCaptain.getLoc();
|
||||
MovementUtilities.moveToLocation(mob, mob.destination, 5);
|
||||
} else
|
||||
chaseTarget(mob);
|
||||
break;
|
||||
case GuardMinion:
|
||||
if (!mob.guardCaptain.isAlive() || ((Mob) mob.guardCaptain).despawned)
|
||||
randomGuardPatrolPoint(mob);
|
||||
else {
|
||||
if (mob.getCombatTarget() != null) {
|
||||
chaseTarget(mob);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (mob.getCombatTarget() == null) {
|
||||
if (!mob.isMoving())
|
||||
Patrol(mob);
|
||||
else {
|
||||
|
||||
if (!mob.isMoving()) {
|
||||
|
||||
// Minions only patrol on their own if captain is dead.
|
||||
|
||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION) == false)
|
||||
Patrol(mob);
|
||||
else if (mob.guardCaptain.isAlive() == false)
|
||||
Patrol(mob);
|
||||
} else
|
||||
mob.stopPatrolTime = System.currentTimeMillis();
|
||||
}
|
||||
} else {
|
||||
chaseTarget(mob);
|
||||
}
|
||||
@@ -901,7 +827,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;
|
||||
@@ -917,15 +843,6 @@ public class MobAI {
|
||||
private static void CheckToSendMobHome(Mob mob) {
|
||||
|
||||
try {
|
||||
if (mob.behaviourType.isAgressive) {
|
||||
|
||||
if (mob.isPlayerGuard()) {
|
||||
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardCaptain))
|
||||
CheckForPlayerGuardAggro(mob);
|
||||
} else {
|
||||
CheckForAggro(mob);
|
||||
}
|
||||
}
|
||||
|
||||
if (mob.getCombatTarget() != null && CombatUtilities.inRange2D(mob, mob.getCombatTarget(), MobAIThread.AI_BASE_AGGRO_RANGE * 0.5f))
|
||||
return;
|
||||
@@ -940,13 +857,15 @@ 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
|
||||
|
||||
for (Entry<Mob, Integer> minion : mob.siegeMinionMap.entrySet()) {
|
||||
PowersManager.useMobPower(minion.getKey(), minion.getKey(), recall, 40);
|
||||
minion.getKey().setCombatTarget(null);
|
||||
for (Integer minionUUID : mob.minions) {
|
||||
Mob minion = Mob.getMob(minionUUID);
|
||||
|
||||
PowersManager.useMobPower(minion, minion, recall, 40);
|
||||
minion.setCombatTarget(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -957,7 +876,7 @@ public class MobAI {
|
||||
mob.setCombatTarget(null);
|
||||
|
||||
for (Integer playerEntry : mob.playerAgroMap.keySet())
|
||||
mob.playerAgroMap.put(playerEntry,0f);
|
||||
mob.playerAgroMap.put(playerEntry, 0f);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckToSendMobHome" + " " + e.getMessage());
|
||||
@@ -968,13 +887,7 @@ public class MobAI {
|
||||
|
||||
try {
|
||||
|
||||
float rangeSquared = mob.getRange() * mob.getRange();
|
||||
float distanceSquared = mob.getLoc().distanceSquared2D(mob.getCombatTarget().getLoc());
|
||||
|
||||
if(mob.isMoving() == true && distanceSquared < rangeSquared - 50) {
|
||||
mob.destination = mob.getLoc();
|
||||
MovementUtilities.moveToLocation(mob, mob.destination, 0);
|
||||
} else if (CombatUtilities.inRange2D(mob, mob.getCombatTarget(), mob.getRange()) == false) {
|
||||
if (CombatUtilities.inRange2D(mob, mob.getCombatTarget(), mob.getRange()) == false) {
|
||||
if (mob.getRange() > 15) {
|
||||
mob.destination = mob.getCombatTarget().getLoc();
|
||||
MovementUtilities.moveToLocation(mob, mob.destination, 0);
|
||||
@@ -1011,17 +924,17 @@ public class MobAI {
|
||||
|
||||
//dont scan self.
|
||||
|
||||
if (mob.equals(awoMob) || (mob.agentType.equals(Enum.AIAgentType.GUARD)) == true)
|
||||
if (mob.equals(awoMob) || (mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN)) == true)
|
||||
continue;
|
||||
|
||||
Mob aggroMob = (Mob) awoMob;
|
||||
|
||||
//don't attack other guards
|
||||
|
||||
if ((aggroMob.agentType.equals(Enum.AIAgentType.GUARD)))
|
||||
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))
|
||||
@@ -1034,7 +947,7 @@ public class MobAI {
|
||||
}
|
||||
}
|
||||
|
||||
public static void GuardCaptainLogic(Mob mob) {
|
||||
public static void GuardLogic(Mob mob) {
|
||||
|
||||
try {
|
||||
if (mob.getCombatTarget() == null)
|
||||
@@ -1055,41 +968,7 @@ public class MobAI {
|
||||
CheckMobMovement(mob);
|
||||
CheckForAttack(mob);
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardCaptainLogic" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static void GuardMinionLogic(Mob mob) {
|
||||
|
||||
try {
|
||||
if (!mob.guardCaptain.isAlive()) {
|
||||
|
||||
if (mob.getCombatTarget() == null) {
|
||||
CheckForPlayerGuardAggro(mob);
|
||||
} else {
|
||||
|
||||
AbstractWorldObject newTarget = ChangeTargetFromHateValue(mob);
|
||||
|
||||
if (newTarget != null) {
|
||||
|
||||
if (newTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||
if (GuardCanAggro(mob, (PlayerCharacter) newTarget))
|
||||
mob.setCombatTarget(newTarget);
|
||||
} else
|
||||
mob.setCombatTarget(newTarget);
|
||||
|
||||
}
|
||||
}
|
||||
}else {
|
||||
if (mob.guardCaptain.getCombatTarget() != null)
|
||||
mob.setCombatTarget(mob.guardCaptain.getCombatTarget());
|
||||
else if (mob.getCombatTarget() != null)
|
||||
mob.setCombatTarget(null);
|
||||
}
|
||||
CheckMobMovement(mob);
|
||||
CheckForAttack(mob);
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardMinionLogic" + " " + e.getMessage());
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardLogic" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1109,7 +988,6 @@ public class MobAI {
|
||||
|
||||
try {
|
||||
|
||||
|
||||
if (mob.guardCaptain == null && mob.isNecroPet() == false && mob.isSiege() == false)
|
||||
if (ZoneManager.getSeaFloor().zoneMobSet.contains(mob))
|
||||
mob.killCharacter("no owner");
|
||||
@@ -1204,6 +1082,15 @@ public class MobAI {
|
||||
if (!mob.isAlive())
|
||||
return;
|
||||
|
||||
// Defer to captain if possible for current target
|
||||
|
||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION) &&
|
||||
mob.guardCaptain.isAlive()
|
||||
&& mob.guardCaptain.combatTarget != null) {
|
||||
mob.setCombatTarget(mob.guardCaptain.combatTarget);
|
||||
return;
|
||||
}
|
||||
|
||||
ConcurrentHashMap<Integer, Float> loadedPlayers = mob.playerAgroMap;
|
||||
|
||||
for (Entry playerEntry : loadedPlayers.entrySet()) {
|
||||
@@ -1249,17 +1136,12 @@ public class MobAI {
|
||||
|
||||
try {
|
||||
|
||||
if (mob.guardedCity.cityOutlaws.contains(target.getObjectUUID()) == true)
|
||||
return true;
|
||||
|
||||
if (mob.getGuild().getNation().equals(target.getGuild().getNation()))
|
||||
return false;
|
||||
|
||||
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardMinion)) {
|
||||
if (((Mob) mob.guardCaptain).building.getCity().cityOutlaws.contains(target.getObjectUUID()) == true) {
|
||||
return true;
|
||||
}
|
||||
} else if (mob.building.getCity().cityOutlaws.contains(target.getObjectUUID()) == true) {
|
||||
return true;
|
||||
}
|
||||
|
||||
//first check condemn list for aggro allowed (allies button is checked)
|
||||
|
||||
if (ZoneManager.getCityAtLocation(mob.getLoc()).getTOL().reverseKOS) {
|
||||
@@ -1337,17 +1219,19 @@ public class MobAI {
|
||||
|
||||
MovementUtilities.aiMove(mob, mob.destination, true);
|
||||
|
||||
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardCaptain)) {
|
||||
for (Entry<Mob, Integer> minion : mob.siegeMinionMap.entrySet()) {
|
||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN)) {
|
||||
for (Integer minionUUID : mob.minions) {
|
||||
|
||||
Mob minion = Mob.getMob(minionUUID);
|
||||
|
||||
//make sure mob is out of combat stance
|
||||
|
||||
if (minion.getKey().despawned == false) {
|
||||
if (MovementUtilities.canMove(minion.getKey())) {
|
||||
Vector3f minionOffset = Formation.getOffset(2, minion.getValue() + 3);
|
||||
minion.getKey().updateLocation();
|
||||
if (minion.despawned == false) {
|
||||
if (MovementUtilities.canMove(minion)) {
|
||||
Vector3f minionOffset = Formation.getOffset(2, mob.minions.indexOf(minionUUID) + 3);
|
||||
minion.updateLocation();
|
||||
Vector3fImmutable formationPatrolPoint = new Vector3fImmutable(mob.destination.x + minionOffset.x, mob.destination.y, mob.destination.z + minionOffset.z);
|
||||
MovementUtilities.aiMove(minion.getKey(), formationPatrolPoint, true);
|
||||
MovementUtilities.aiMove(minion, formationPatrolPoint, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import static engine.net.MessageDispatcher.maxRecipients;
|
||||
|
||||
/*
|
||||
* Dispatch Message is the main interface to Magicbane's threaded
|
||||
* asynch message delivery system.
|
||||
* async message delivery system.
|
||||
*/
|
||||
|
||||
public class DispatchMessage {
|
||||
|
||||
@@ -15,9 +15,6 @@ import engine.net.client.msg.*;
|
||||
import engine.objects.*;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
/*
|
||||
* @Author:
|
||||
* @Summary: Processes application protocol message which
|
||||
@@ -26,8 +23,6 @@ import java.util.HashMap;
|
||||
|
||||
public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public static HashMap<Integer, ArrayList<Integer>> _minionsByCaptain = null;
|
||||
|
||||
public MinionTrainingMsgHandler() {
|
||||
super(MinionTrainingMessage.class);
|
||||
}
|
||||
@@ -37,10 +32,11 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
MinionTrainingMessage minionMsg = (MinionTrainingMessage) baseMsg;
|
||||
|
||||
PlayerCharacter player = SessionManager.getPlayerCharacter(origin);
|
||||
PlayerCharacter playerCharacter = SessionManager.getPlayerCharacter(origin);
|
||||
|
||||
if (player == null)
|
||||
if (playerCharacter == null)
|
||||
return true;
|
||||
|
||||
if (minionMsg.getNpcType() == Enum.GameObjectType.NPC.ordinal()) {
|
||||
|
||||
NPC npc = NPC.getFromCache(minionMsg.getNpcID());
|
||||
@@ -48,23 +44,24 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
||||
if (npc == null)
|
||||
return true;
|
||||
|
||||
Building b = BuildingManager.getBuildingFromCache(minionMsg.getBuildingID());
|
||||
Building building = BuildingManager.getBuildingFromCache(minionMsg.getBuildingID());
|
||||
|
||||
if (b == null)
|
||||
if (building == null)
|
||||
return true;
|
||||
|
||||
//clear minion
|
||||
|
||||
if (npc.minionLock.writeLock().tryLock()) {
|
||||
|
||||
try {
|
||||
if (minionMsg.getType() == 2) {
|
||||
|
||||
Mob toRemove = Mob.getFromCache(minionMsg.getUUID());
|
||||
|
||||
if (!npc.siegeMinionMap.containsKey(toRemove))
|
||||
if (!npc.minions.contains(toRemove.getObjectUUID()))
|
||||
return true;
|
||||
|
||||
npc.siegeMinionMap.remove(toRemove);
|
||||
npc.minions.remove(Integer.valueOf(toRemove.getObjectUUID()));
|
||||
|
||||
WorldGrid.RemoveWorldObject(toRemove);
|
||||
|
||||
@@ -86,23 +83,21 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
||||
}
|
||||
}
|
||||
|
||||
// we Found the move to remove, lets break the for loop so it doesnt look for more.
|
||||
|
||||
ManageCityAssetsMsg mca1 = new ManageCityAssetsMsg(player, b);
|
||||
ManageCityAssetsMsg mca1 = new ManageCityAssetsMsg(playerCharacter, building);
|
||||
mca1.actionType = 3;
|
||||
mca1.setTargetType(b.getObjectType().ordinal());
|
||||
mca1.setTargetID(b.getObjectUUID());
|
||||
mca1.setTargetType(building.getObjectType().ordinal());
|
||||
mca1.setTargetID(building.getObjectUUID());
|
||||
|
||||
mca1.setTargetType3(npc.getObjectType().ordinal());
|
||||
mca1.setTargetID3(npc.getObjectUUID());
|
||||
mca1.setAssetName1(b.getName());
|
||||
mca1.setAssetName1(building.getName());
|
||||
mca1.setUnknown54(1);
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(player, mca1);
|
||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, mca1);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
|
||||
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
||||
dispatch = Dispatch.borrow(player, mnm);
|
||||
dispatch = Dispatch.borrow(playerCharacter, mnm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
|
||||
//Add Minion
|
||||
@@ -117,7 +112,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
||||
if (npc.getContractID() == 842)
|
||||
maxSlots = 1;
|
||||
|
||||
if (npc.siegeMinionMap.size() == maxSlots)
|
||||
if (npc.minions.size() == maxSlots)
|
||||
return true;
|
||||
|
||||
int mobBase;
|
||||
@@ -156,7 +151,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
||||
mnm.setMessageType(1);
|
||||
Dispatch dispatch = Dispatch.borrow(player, mnm);
|
||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, mnm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
|
||||
} finally {
|
||||
@@ -184,13 +179,13 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
Mob toRemove = Mob.getFromCache(minionMsg.getUUID());
|
||||
|
||||
if (!npc.getSiegeMinionMap().containsKey(toRemove))
|
||||
if (!npc.minions.contains(toRemove.getObjectUUID()))
|
||||
return true;
|
||||
|
||||
if (!DbManager.MobQueries.REMOVE_FROM_GUARDS(npc.getObjectUUID(), toRemove.getMobBaseID(), npc.getSiegeMinionMap().get(toRemove)))
|
||||
if (!DbManager.MobQueries.REMOVE_FROM_GUARDS(npc.getObjectUUID(), toRemove.firstName))
|
||||
return true;
|
||||
|
||||
npc.getSiegeMinionMap().remove(toRemove);
|
||||
npc.minions.remove(Integer.valueOf(toRemove.getObjectUUID()));
|
||||
|
||||
WorldGrid.RemoveWorldObject(toRemove);
|
||||
|
||||
@@ -199,19 +194,21 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
DbManager.removeFromCache(toRemove);
|
||||
|
||||
if (toRemove.agentType.equals(Enum.AIAgentType.SIEGEENGINE)) {
|
||||
|
||||
PlayerCharacter petOwner = (PlayerCharacter) toRemove.guardCaptain;
|
||||
PlayerCharacter trebOwner = (PlayerCharacter) toRemove.guardCaptain;
|
||||
|
||||
if (petOwner != null) {
|
||||
petOwner.setPet(null);
|
||||
if (trebOwner != null) {
|
||||
trebOwner.setPet(null);
|
||||
|
||||
toRemove.guardCaptain = null;
|
||||
PetMsg petMsg = new PetMsg(5, null);
|
||||
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
toRemove.guardCaptain = null;
|
||||
PetMsg petMsg = new PetMsg(5, null);
|
||||
Dispatch dispatch = Dispatch.borrow(trebOwner, petMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
}
|
||||
}
|
||||
|
||||
ManageCityAssetsMsg mca1 = new ManageCityAssetsMsg(player, building);
|
||||
ManageCityAssetsMsg mca1 = new ManageCityAssetsMsg(playerCharacter, building);
|
||||
mca1.actionType = 3;
|
||||
mca1.setTargetType(building.getObjectType().ordinal());
|
||||
mca1.setTargetID(building.getObjectUUID());
|
||||
@@ -221,11 +218,11 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
||||
mca1.setAssetName1(building.getName());
|
||||
mca1.setUnknown54(1);
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(player, mca1);
|
||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, mca1);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
|
||||
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
||||
dispatch = Dispatch.borrow(player, mnm);
|
||||
dispatch = Dispatch.borrow(playerCharacter, mnm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
|
||||
//Add Minion
|
||||
@@ -261,7 +258,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
||||
break;
|
||||
}
|
||||
|
||||
if (npc.getSiegeMinionMap().size() == maxSlots)
|
||||
if (npc.minions.size() == maxSlots)
|
||||
return true;
|
||||
|
||||
int mobBase = npc.getMobBaseID();
|
||||
@@ -276,7 +273,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
||||
if (toCreate == null)
|
||||
return true;
|
||||
|
||||
if (!DbManager.MobQueries.ADD_TO_GUARDS(npc.getObjectUUID(), mobBase, pirateName, npc.getSiegeMinionMap().size() + 1))
|
||||
if (!DbManager.MobQueries.ADD_TO_GUARDS(npc.getObjectUUID(), pirateName))
|
||||
return true;
|
||||
|
||||
if (toCreate != null) {
|
||||
@@ -287,7 +284,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
||||
mnm.setMessageType(1);
|
||||
Dispatch dispatch = Dispatch.borrow(player, mnm);
|
||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, mnm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -27,7 +27,6 @@ import org.pmw.tinylog.Logger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -96,7 +95,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 +105,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
|
||||
@@ -343,14 +342,17 @@ public class ManageNPCMsg extends ClientNetMsg {
|
||||
writer.putInt(0); //runemaster list
|
||||
|
||||
//artillery captain list
|
||||
ConcurrentHashMap<Mob, Integer> siegeMinions = npc.siegeMinionMap;
|
||||
writer.putInt(1 + siegeMinions.size());
|
||||
|
||||
writer.putInt(1 + npc.minions.size());
|
||||
serializeBulwarkList(writer, 1); //Trebuchet
|
||||
//serializeBulwarkList(writer, 2); //Ballista
|
||||
|
||||
if (siegeMinions != null && siegeMinions.size() > 0)
|
||||
if (npc.minions != null && npc.minions.size() > 0)
|
||||
|
||||
for (Integer minionUUID : npc.minions) {
|
||||
|
||||
Mob mob = Mob.getMob(minionUUID);
|
||||
|
||||
for (Mob mob : siegeMinions.keySet()) {
|
||||
this.unknown83 = mob.getObjectUUID();
|
||||
writer.putInt(2);
|
||||
writer.putInt(mob.getObjectType().ordinal());
|
||||
@@ -666,14 +668,15 @@ public class ManageNPCMsg extends ClientNetMsg {
|
||||
writer.putInt(0); //runemaster list
|
||||
|
||||
//artillery captain list
|
||||
ConcurrentHashMap<Mob, Integer> siegeMinions = mobA.getSiegeMinionMap();
|
||||
|
||||
writer.putInt(siegeMinions.size() + 1);
|
||||
serializeGuardList(writer, mobA.getContract().getContractID()); //Guard
|
||||
writer.putInt(mobA.minions.size() + 1);
|
||||
|
||||
if (siegeMinions != null && siegeMinions.size() > 0)
|
||||
serializeGuardList(writer, mobA.getContract().getContractID(), mobA); //Guard
|
||||
|
||||
for (Mob mob : siegeMinions.keySet()) {
|
||||
if (mobA.minions != null && mobA.minions.size() > 0)
|
||||
|
||||
for (Integer minionUUID : mobA.minions) {
|
||||
Mob mob = Mob.getMob(minionUUID);
|
||||
this.unknown83 = mob.getObjectUUID();
|
||||
writer.putInt(2);
|
||||
writer.putInt(mob.getObjectType().ordinal());
|
||||
|
||||
@@ -39,6 +39,7 @@ import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
@@ -71,7 +72,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
public Guild guild;
|
||||
protected byte runningTrains;
|
||||
protected ConcurrentHashMap<Integer, CharacterPower> powers;
|
||||
protected ConcurrentHashMap<String, CharacterSkill> skills;
|
||||
public ConcurrentHashMap<String, CharacterSkill> skills;
|
||||
// Variables NOT to be stored in db
|
||||
protected boolean sit = false;
|
||||
protected boolean walkMode;
|
||||
@@ -88,7 +89,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;
|
||||
@@ -119,7 +120,9 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
private long takeOffTime = 0;
|
||||
private long lastHateUpdate = 0;
|
||||
private byte aoecntr = 0;
|
||||
public final ConcurrentHashMap<Mob, Integer> siegeMinionMap = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||
|
||||
public int hidden = 0; // current rank of hide/sneak/invis
|
||||
public CopyOnWriteArrayList<Integer> minions = new CopyOnWriteArrayList();
|
||||
|
||||
public AbstractCharacter() {
|
||||
super();
|
||||
@@ -1104,6 +1107,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
}
|
||||
|
||||
public final void setCombatTarget(final AbstractWorldObject value) {
|
||||
|
||||
if(this.getObjectTypeMask() == 2050) {//MOB?
|
||||
if (value == null) {
|
||||
if (this.isCombat()) {
|
||||
@@ -1121,7 +1125,9 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.combatTarget = value;
|
||||
|
||||
}
|
||||
|
||||
public final ConcurrentHashMap<String, JobContainer> getTimers() {
|
||||
|
||||
@@ -32,7 +32,7 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
|
||||
protected Vector3fImmutable lastBindLoc;
|
||||
public boolean assist = false;
|
||||
public Enum.AIAgentType agentType = Enum.AIAgentType.MOBILE;
|
||||
public boolean isPlayerGuard = false;
|
||||
|
||||
public AbstractCharacter guardCaptain;
|
||||
public EnumBitSet<Enum.MonsterType> notEnemy = EnumBitSet.noneOf(Enum.MonsterType.class);
|
||||
public EnumBitSet<Enum.MonsterType> enemy = EnumBitSet.noneOf(Enum.MonsterType.class);
|
||||
@@ -163,7 +163,9 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
|
||||
this.setCombatTarget(null);
|
||||
}
|
||||
|
||||
//clear owner
|
||||
// clear owner and set not alive
|
||||
|
||||
this.isAlive.set(false);
|
||||
|
||||
PlayerCharacter owner = (PlayerCharacter) this.guardCaptain;
|
||||
|
||||
@@ -181,7 +183,7 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
|
||||
owner.setPet(null);
|
||||
|
||||
if (this.getObjectType().equals(GameObjectType.Mob))
|
||||
((Mob) this).guardCaptain = null;
|
||||
this.guardCaptain = null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -223,7 +223,7 @@ public class CharacterSkill extends AbstractGameObject {
|
||||
this.numTrains.set(0);
|
||||
this.ownerUID = pc.getObjectUUID();
|
||||
calculateBaseAmount();
|
||||
calculateModifiedAmount();
|
||||
calculateModifiedAmount(false);
|
||||
this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken());
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ public class CharacterSkill extends AbstractGameObject {
|
||||
this.ownerUID = pc.getObjectUUID();
|
||||
this.trained = true;
|
||||
calculateBaseAmount();
|
||||
calculateModifiedAmount();
|
||||
calculateModifiedAmount(false);
|
||||
this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken());
|
||||
|
||||
}
|
||||
@@ -254,7 +254,7 @@ public class CharacterSkill extends AbstractGameObject {
|
||||
this.numTrains.set(rs.getShort("trains"));
|
||||
this.ownerUID = pc.getObjectUUID();
|
||||
calculateBaseAmount();
|
||||
calculateModifiedAmount();
|
||||
calculateModifiedAmount(false);
|
||||
this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken());
|
||||
}
|
||||
|
||||
@@ -264,8 +264,9 @@ public class CharacterSkill extends AbstractGameObject {
|
||||
this.numTrains.set(trains);
|
||||
this.ownerUID = mob.getObjectUUID();
|
||||
this.isMobOwner = true;
|
||||
calculateMobBaseAmount();
|
||||
calculateModifiedAmount();
|
||||
boolean isGuard = mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN) || mob.agentType.equals(Enum.AIAgentType.GUARDMINION);
|
||||
calculateMobBaseAmount(isGuard);
|
||||
calculateModifiedAmount(isGuard);
|
||||
this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken());
|
||||
}
|
||||
|
||||
@@ -277,7 +278,7 @@ public class CharacterSkill extends AbstractGameObject {
|
||||
this.ownerUID = rs.getInt("CharacterID");
|
||||
// this.owner = DbManager.PlayerCharacterQueries.GET_PLAYER_CHARACTER(rs.getInt("CharacterID"));
|
||||
calculateBaseAmount();
|
||||
calculateModifiedAmount();
|
||||
calculateModifiedAmount(false);
|
||||
this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken());
|
||||
}
|
||||
|
||||
@@ -370,7 +371,7 @@ public class CharacterSkill extends AbstractGameObject {
|
||||
String name = it.next();
|
||||
CharacterSkill cs = skills.get(name);
|
||||
if (cs != null)
|
||||
cs.calculateModifiedAmount();
|
||||
cs.calculateModifiedAmount(false);
|
||||
|
||||
}
|
||||
|
||||
@@ -756,7 +757,7 @@ public class CharacterSkill extends AbstractGameObject {
|
||||
|
||||
//recalculate this skill
|
||||
calculateBaseAmount();
|
||||
calculateModifiedAmount();
|
||||
calculateModifiedAmount(false);
|
||||
|
||||
//see if any new skills or powers granted
|
||||
pc.calculateSkills();
|
||||
@@ -848,7 +849,7 @@ public class CharacterSkill extends AbstractGameObject {
|
||||
if (recalculate) {
|
||||
//recalculate this skill
|
||||
calculateBaseAmount();
|
||||
calculateModifiedAmount();
|
||||
calculateModifiedAmount(false);
|
||||
|
||||
//see if any skills or powers removed
|
||||
pc.calculateSkills();
|
||||
@@ -887,7 +888,7 @@ public class CharacterSkill extends AbstractGameObject {
|
||||
if (recalculate) {
|
||||
//recalculate this skill
|
||||
calculateBaseAmount();
|
||||
calculateModifiedAmount();
|
||||
calculateModifiedAmount(false);
|
||||
|
||||
//see if any skills or powers removed
|
||||
pc.calculateSkills();
|
||||
@@ -1016,33 +1017,34 @@ public class CharacterSkill extends AbstractGameObject {
|
||||
this.modifiedAmountBeforeMods = Math.round(this.baseAmountBeforeMods + calculateAmountAfterTrains());
|
||||
}
|
||||
|
||||
public void calculateMobBaseAmount() {
|
||||
if (CharacterSkill.GetOwner(this) == null) {
|
||||
Logger.error("owner not found for owner uuid : " + this.ownerUID);
|
||||
this.baseAmount = 1;
|
||||
this.modifiedAmount = 1;
|
||||
return;
|
||||
}
|
||||
public void calculateMobBaseAmount(boolean isGuard) {
|
||||
if(!isGuard) {
|
||||
if (CharacterSkill.GetOwner(this) == null) {
|
||||
Logger.error("owner not found for owner uuid : " + this.ownerUID);
|
||||
this.baseAmount = 1;
|
||||
this.modifiedAmount = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.skillsBase == null) {
|
||||
Logger.error("SkillsBase not found for skill " + this.getObjectUUID());
|
||||
this.baseAmount = 1;
|
||||
this.modifiedAmount = 1;
|
||||
return;
|
||||
if (this.skillsBase == null) {
|
||||
Logger.error("SkillsBase not found for skill " + this.getObjectUUID());
|
||||
this.baseAmount = 1;
|
||||
this.modifiedAmount = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//Get any rune bonus
|
||||
float bonus = 0f;
|
||||
//TODO SKILLS RUNES
|
||||
|
||||
if (CharacterSkill.GetOwner(this).getBonuses() != null) {
|
||||
//Get bonuses from runes
|
||||
bonus = CharacterSkill.GetOwner(this).getBonuses().getSkillBonus(this.skillsBase.sourceType);
|
||||
}
|
||||
|
||||
//Get Base skill for unmodified stats
|
||||
float base = 7f;
|
||||
float statMod = 0.5f;
|
||||
if (CharacterSkill.GetOwner(this) != null && CharacterSkill.GetOwner(this).getBonuses() != null) {
|
||||
//Get bonuses from runes
|
||||
bonus = CharacterSkill.GetOwner(this).getBonuses().getSkillBonus(this.skillsBase.sourceType);
|
||||
|
||||
//Get Base skill for unmodified stats
|
||||
|
||||
|
||||
if (this.skillsBase.getStrMod() > 0)
|
||||
statMod += (float) this.skillsBase.getStrMod() * (float) ((Mob) CharacterSkill.GetOwner(this)).getMobBase().getMobBaseStats().getBaseStr() / 100f;
|
||||
if (this.skillsBase.getDexMod() > 0)
|
||||
@@ -1057,6 +1059,7 @@ public class CharacterSkill extends AbstractGameObject {
|
||||
statMod = 1f;
|
||||
else if (statMod > 600)
|
||||
statMod = 600f;
|
||||
}
|
||||
base += CharacterSkill.baseSkillValues[(int) statMod];
|
||||
|
||||
if (base + bonus < 1f)
|
||||
@@ -1066,45 +1069,48 @@ public class CharacterSkill extends AbstractGameObject {
|
||||
this.modifiedAmountBeforeMods = (int) (this.baseAmountBeforeMods + calculateAmountAfterTrains());
|
||||
}
|
||||
|
||||
public void calculateModifiedAmount() {
|
||||
if (CharacterSkill.GetOwner(this) == null || this.skillsBase == null) {
|
||||
Logger.error("owner or SkillsBase not found for skill " + this.getObjectUUID());
|
||||
this.baseAmount = 1;
|
||||
this.modifiedAmount = 1;
|
||||
return;
|
||||
public void calculateModifiedAmount(boolean isGuard) {
|
||||
if(!isGuard) {
|
||||
if (CharacterSkill.GetOwner(this) == null || this.skillsBase == null) {
|
||||
Logger.error("owner or SkillsBase not found for skill " + this.getObjectUUID());
|
||||
this.baseAmount = 1;
|
||||
this.modifiedAmount = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//Get any rune bonus
|
||||
float bonus = 0f;
|
||||
if (CharacterSkill.GetOwner(this).getBonuses() != null) {
|
||||
//Get bonuses from runes
|
||||
bonus = CharacterSkill.GetOwner(this).getBonuses().getSkillBonus(this.skillsBase.sourceType);
|
||||
}
|
||||
|
||||
//Get Base skill for modified stats
|
||||
//TODO this fomula needs verified
|
||||
float base = 7f;
|
||||
float statMod = 0.5f;
|
||||
if (this.skillsBase.getStrMod() > 0)
|
||||
statMod += (float) this.skillsBase.getStrMod() * (float) CharacterSkill.GetOwner(this).getStatStrCurrent() / 100f;
|
||||
if (this.skillsBase.getDexMod() > 0)
|
||||
statMod += (float) this.skillsBase.getDexMod() * (float) CharacterSkill.GetOwner(this).getStatDexCurrent() / 100f;
|
||||
if (this.skillsBase.getConMod() > 0)
|
||||
statMod += (float) this.skillsBase.getConMod() * (float) CharacterSkill.GetOwner(this).getStatConCurrent() / 100f;
|
||||
if (this.skillsBase.getIntMod() > 0)
|
||||
statMod += (float) this.skillsBase.getIntMod() * (float) CharacterSkill.GetOwner(this).getStatIntCurrent() / 100f;
|
||||
if (this.skillsBase.getSpiMod() > 0)
|
||||
statMod += (float) this.skillsBase.getSpiMod() * (float) CharacterSkill.GetOwner(this).getStatSpiCurrent() / 100f;
|
||||
if (statMod < 1)
|
||||
statMod = 1f;
|
||||
else if (statMod > 600)
|
||||
statMod = 600f;
|
||||
if (CharacterSkill.GetOwner(this) != null && CharacterSkill.GetOwner(this).getBonuses() != null) {
|
||||
//Get bonuses from runes
|
||||
bonus = CharacterSkill.GetOwner(this).getBonuses().getSkillBonus(this.skillsBase.sourceType);
|
||||
|
||||
|
||||
//Get Base skill for modified stats
|
||||
//TODO this fomula needs verified
|
||||
|
||||
if (this.skillsBase.getStrMod() > 0)
|
||||
statMod += (float) this.skillsBase.getStrMod() * (float) CharacterSkill.GetOwner(this).getStatStrCurrent() / 100f;
|
||||
if (this.skillsBase.getDexMod() > 0)
|
||||
statMod += (float) this.skillsBase.getDexMod() * (float) CharacterSkill.GetOwner(this).getStatDexCurrent() / 100f;
|
||||
if (this.skillsBase.getConMod() > 0)
|
||||
statMod += (float) this.skillsBase.getConMod() * (float) CharacterSkill.GetOwner(this).getStatConCurrent() / 100f;
|
||||
if (this.skillsBase.getIntMod() > 0)
|
||||
statMod += (float) this.skillsBase.getIntMod() * (float) CharacterSkill.GetOwner(this).getStatIntCurrent() / 100f;
|
||||
if (this.skillsBase.getSpiMod() > 0)
|
||||
statMod += (float) this.skillsBase.getSpiMod() * (float) CharacterSkill.GetOwner(this).getStatSpiCurrent() / 100f;
|
||||
if (statMod < 1)
|
||||
statMod = 1f;
|
||||
else if (statMod > 600)
|
||||
statMod = 600f;
|
||||
}
|
||||
base += CharacterSkill.baseSkillValues[(int) statMod];
|
||||
SourceType sourceType = SourceType.GetSourceType(this.skillsBase.getNameNoSpace());
|
||||
|
||||
//Get any rune, effect and item bonus
|
||||
|
||||
if (CharacterSkill.GetOwner(this).getBonuses() != null) {
|
||||
if (CharacterSkill.GetOwner(this) != null && CharacterSkill.GetOwner(this).getBonuses() != null) {
|
||||
//add bonuses from effects/items and runes
|
||||
base += bonus + CharacterSkill.GetOwner(this).getBonuses().getFloat(ModType.Skill, sourceType);
|
||||
}
|
||||
@@ -1116,7 +1122,7 @@ public class CharacterSkill extends AbstractGameObject {
|
||||
|
||||
float modAmount = this.baseAmount + calculateAmountAfterTrains();
|
||||
|
||||
if (CharacterSkill.GetOwner(this).getBonuses() != null) {
|
||||
if (CharacterSkill.GetOwner(this) != null && CharacterSkill.GetOwner(this).getBonuses() != null) {
|
||||
//Multiply any percent bonuses
|
||||
modAmount *= (1 + CharacterSkill.GetOwner(this).getBonuses().getFloatPercentAll(ModType.Skill, sourceType));
|
||||
}
|
||||
|
||||
@@ -1083,7 +1083,7 @@ public class City extends AbstractWorldObject {
|
||||
|
||||
Thread destroyCityThread = new Thread(new DestroyCityThread(this));
|
||||
|
||||
destroyCityThread.setName("deestroyCity:" + this.getName());
|
||||
destroyCityThread.setName("destroyCity:" + this.getName());
|
||||
destroyCityThread.start();
|
||||
}
|
||||
|
||||
|
||||
+106
-128
@@ -20,20 +20,20 @@ import engine.jobs.DeferredPowerJob;
|
||||
import engine.jobs.UpgradeNPCJob;
|
||||
import engine.math.Bounds;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mobileAI.utilities.MovementUtilities;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.PetMsg;
|
||||
import engine.net.client.msg.PlaceAssetMsg;
|
||||
import engine.powers.MobPowerEntry;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.joda.time.DateTime;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
||||
@@ -51,7 +51,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
public ReentrantReadWriteLock minionLock = new ReentrantReadWriteLock();
|
||||
public boolean despawned = false;
|
||||
public Vector3fImmutable destination = Vector3fImmutable.ZERO;
|
||||
public LinkedHashMap<Integer, Integer> mobPowers = new LinkedHashMap<>();
|
||||
public MobBase mobBase;
|
||||
public int spawnTime;
|
||||
public Zone parentZone;
|
||||
@@ -65,15 +64,13 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
public float spawnRadius;
|
||||
//used by static mobs
|
||||
public int parentZoneUUID;
|
||||
protected int dbID; //the database ID
|
||||
|
||||
private int currentID;
|
||||
|
||||
//TODO implement feared object system
|
||||
public AbstractWorldObject fearedObject = null;
|
||||
protected int dbID; //the database ID
|
||||
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;
|
||||
@@ -105,6 +102,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
this.dbID = rs.getInt(1);
|
||||
this.loadID = rs.getInt("mob_mobbaseID");
|
||||
this.gridObjectType = GridObjectType.DYNAMIC;
|
||||
this.agentType = AIAgentType.MOBILE;
|
||||
|
||||
this.spawnRadius = rs.getFloat("mob_spawnRadius");
|
||||
this.spawnTime = rs.getInt("mob_spawnTime");
|
||||
@@ -153,7 +151,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
|
||||
this.currentID = this.dbID;
|
||||
|
||||
this.agentType = AIAgentType.MOBILE;
|
||||
} catch (Exception e) {
|
||||
Logger.error(e + " " + this.dbID);
|
||||
}
|
||||
@@ -183,7 +180,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
} else if (tid == 100962 || tid == 100965) { //Spydraxxx the Mighty, Denigo Tantric
|
||||
writer.putInt(2);
|
||||
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);
|
||||
serializeRune(mob, writer, 3, GameObjectType.NPCClassRuneTwo.ordinal(), MobBase.GetClassType(mob.getMobBaseID())); //warrior class
|
||||
serializeRune(mob, writer, 5, GameObjectType.NPCClassRuneThree.ordinal(), 252621); //guard rune
|
||||
@@ -316,13 +313,13 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
writer.put((byte) 1);
|
||||
|
||||
|
||||
if ((PlayerCharacter) mob.guardCaptain != null) {
|
||||
if (mob.guardCaptain != null) {
|
||||
|
||||
|
||||
writer.putInt(((PlayerCharacter) mob.guardCaptain).getObjectType().ordinal());
|
||||
writer.putInt(mob.guardCaptain.getObjectType().ordinal());
|
||||
|
||||
|
||||
writer.putInt(((PlayerCharacter) mob.guardCaptain).getObjectUUID());
|
||||
writer.putInt(mob.guardCaptain.getObjectUUID());
|
||||
} else {
|
||||
writer.putInt(0); //ownerType
|
||||
writer.putInt(0); //ownerID
|
||||
@@ -340,7 +337,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
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);
|
||||
}
|
||||
@@ -401,10 +398,13 @@ 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; 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;
|
||||
|
||||
@@ -428,18 +428,8 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
else
|
||||
mobile.contractUUID = contract.getContractID();
|
||||
|
||||
Mob mob;
|
||||
|
||||
mobile.agentType = AIAgentType.GUARD;
|
||||
try {
|
||||
mob = DbManager.MobQueries.PERSIST(mobile);
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.error("SQLException:" + e.getMessage());
|
||||
mob = null;
|
||||
}
|
||||
|
||||
return mob;
|
||||
return mobile;
|
||||
}
|
||||
|
||||
public static synchronized Mob createGuardMinion(Mob guardCaptain, short level, String minionName) {
|
||||
@@ -463,8 +453,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
minionMobile.guardCaptain = guardCaptain;
|
||||
minionMobile.spawnTime = (int) (-2.500 * guardCaptain.building.getRank() + 22.5) * 60;
|
||||
minionMobile.behaviourType = Enum.MobBehaviourType.GuardMinion;
|
||||
minionMobile.agentType = AIAgentType.GUARD;
|
||||
minionMobile.isPlayerGuard = true;
|
||||
minionMobile.agentType = AIAgentType.GUARDMINION;
|
||||
minionMobile.guardedCity = guardCaptain.guardedCity;
|
||||
minionMobile.patrolPoints = guardCaptain.building.patrolPoints;
|
||||
|
||||
@@ -499,8 +488,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
minionMobile.setLoc(minionMobile.bindLoc);
|
||||
minionMobile.despawn();
|
||||
|
||||
int slot = guardCaptain.siegeMinionMap.size() + 1;
|
||||
guardCaptain.siegeMinionMap.put(minionMobile, slot);
|
||||
guardCaptain.minions.add(minionMobile.getObjectUUID());
|
||||
|
||||
return minionMobile;
|
||||
}
|
||||
@@ -530,8 +518,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
siegeMinion.setLoc(siegeMinion.bindLoc);
|
||||
siegeMinion.despawn();
|
||||
|
||||
int slot = artyCaptain.siegeMinionMap.size() + 1;
|
||||
artyCaptain.siegeMinionMap.put(siegeMinion, slot);
|
||||
artyCaptain.minions.add(siegeMinion.getObjectUUID());
|
||||
|
||||
return siegeMinion;
|
||||
}
|
||||
@@ -566,20 +553,22 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
|
||||
return petMinion;
|
||||
}
|
||||
|
||||
public static Mob getMob(int id) {
|
||||
|
||||
if (id == 0)
|
||||
return null;
|
||||
|
||||
Mob mob = (Mob) DbManager.getFromCache(GameObjectType.Mob, id);
|
||||
|
||||
if (mob != null)
|
||||
return mob;
|
||||
|
||||
return DbManager.MobQueries.GET_MOB(id);
|
||||
}
|
||||
|
||||
public static Mob getFromCache(int id) {
|
||||
|
||||
|
||||
return (Mob) DbManager.getFromCache(GameObjectType.Mob, id);
|
||||
}
|
||||
|
||||
@@ -636,7 +625,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
mob.upgradeDateTime = upgradeDateTime;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Getters
|
||||
*/
|
||||
@@ -662,10 +650,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
return this.spawnRadius;
|
||||
}
|
||||
|
||||
public void setSpawnTime(int value) {
|
||||
this.spawnTime = value;
|
||||
}
|
||||
|
||||
public String getSpawnTimeAsString() {
|
||||
if (this.spawnTime == 0)
|
||||
return MBServerStatics.DEFAULT_SPAWN_TIME_MS / 1000 + " seconds (Default)";
|
||||
@@ -680,11 +664,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
}
|
||||
|
||||
public int getMobBaseID() {
|
||||
|
||||
if (this.mobBase != null)
|
||||
return this.mobBase.getObjectUUID();
|
||||
|
||||
return 0;
|
||||
return this.mobBase.getObjectUUID();
|
||||
}
|
||||
|
||||
public Vector3fImmutable getTrueBindLoc() {
|
||||
@@ -708,7 +688,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
public Vector3fImmutable getBindLoc() {
|
||||
|
||||
if (this.isPet() && !this.behaviourType.equals(MobBehaviourType.SiegeEngine))
|
||||
return (PlayerCharacter) this.guardCaptain != null ? ((PlayerCharacter) this.guardCaptain).getLoc() : this.getLoc();
|
||||
return this.guardCaptain != null ? this.guardCaptain.getLoc() : this.getLoc();
|
||||
else
|
||||
return this.bindLoc;
|
||||
}
|
||||
@@ -737,8 +717,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
|
||||
@@ -757,7 +735,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
// get rune and effect bonuses
|
||||
bonus *= (1 + this.bonuses.getFloatPercentAll(ModType.Speed, SourceType.None));
|
||||
|
||||
if (this.isPlayerGuard)
|
||||
if (this.isPlayerGuard())
|
||||
switch (this.mobBase.getLoadID()) {
|
||||
case 2111:
|
||||
if (this.isWalk())
|
||||
@@ -825,7 +803,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
Group g = GroupManager.getGroup((PlayerCharacter) attacker);
|
||||
|
||||
// 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);
|
||||
} else if (attacker.getObjectType().equals(GameObjectType.Mob)) {
|
||||
Mob mobAttacker = (Mob) attacker;
|
||||
@@ -836,7 +814,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
PlayerCharacter owner = (PlayerCharacter) mobAttacker.guardCaptain;
|
||||
|
||||
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);
|
||||
|
||||
// Give XP, now handled inside the Experience Object
|
||||
@@ -950,7 +928,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
|
||||
playerAgroMap.clear();
|
||||
|
||||
if (!this.isPlayerGuard && this.equip != null)
|
||||
if (!this.isPlayerGuard() && this.equip != null)
|
||||
LootManager.GenerateEquipmentDrop(this);
|
||||
|
||||
}
|
||||
@@ -987,7 +965,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);
|
||||
@@ -997,8 +975,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
else if (this.building != null)
|
||||
this.region = BuildingManager.GetRegion(this.building, bindLoc.x, bindLoc.y, bindLoc.z);
|
||||
|
||||
if (!this.behaviourType.equals(MobBehaviourType.SiegeEngine) && !this.isPlayerGuard && contract == null)
|
||||
loadInventory();
|
||||
this.loadInventory();
|
||||
|
||||
this.updateLocation();
|
||||
}
|
||||
@@ -1036,7 +1013,9 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
this.charItemManager.clearInventory();
|
||||
this.charItemManager.clearEquip();
|
||||
|
||||
if (isPlayerGuard)
|
||||
// Only generate loot for mobiles
|
||||
|
||||
if (!this.agentType.equals(AIAgentType.MOBILE))
|
||||
return;
|
||||
|
||||
LootManager.GenerateMobLoot(this);
|
||||
@@ -1138,6 +1117,26 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
this.defenseRating = 0;
|
||||
return;
|
||||
}
|
||||
this.atrHandOne = (short) this.mobBase.getAttackRating();
|
||||
this.minDamageHandOne = (short) this.mobBase.getMinDmg();
|
||||
this.maxDamageHandOne = (short) this.mobBase.getMaxDmg();
|
||||
this.rangeHandOne = 6.5f;
|
||||
this.speedHandOne = 20;
|
||||
|
||||
this.atrHandTwo = (short) this.mobBase.getAttackRating();
|
||||
this.minDamageHandTwo = (short) this.mobBase.getMinDmg();
|
||||
this.maxDamageHandTwo = (short) this.mobBase.getMaxDmg();
|
||||
this.rangeHandTwo = 6.5f;
|
||||
this.speedHandTwo = 20;
|
||||
|
||||
if(this.equip.get(MBServerStatics.SLOT_MAINHAND) != null){
|
||||
//has mainhand weapon to calculate
|
||||
calculateAtrDamageForWeapon(this.equip.get(MBServerStatics.SLOT_MAINHAND), true);
|
||||
}
|
||||
if(this.equip.get(MBServerStatics.SLOT_OFFHAND) != null && !this.equip.get(MBServerStatics.SLOT_OFFHAND).getItemBase().isShield()){
|
||||
//has offhand weapon to calculate
|
||||
calculateAtrDamageForWeapon(this.equip.get(MBServerStatics.SLOT_OFFHAND), false);
|
||||
}
|
||||
|
||||
try {
|
||||
calculateAtrDamageForWeapon(this.equip.get(MBServerStatics.SLOT_MAINHAND), true);
|
||||
@@ -1529,49 +1528,33 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
@Override
|
||||
public void runAfterLoad() {
|
||||
|
||||
this.charItemManager = new CharacterItemManager(this);
|
||||
this.setObjectTypeMask(MBServerStatics.MASK_MOB | this.getTypeMasks());
|
||||
|
||||
if (ConfigManager.serverType.equals(ServerType.LOGINSERVER))
|
||||
return;
|
||||
|
||||
this.mobBase = MobBase.getMobBase(loadID);
|
||||
this.charItemManager = new CharacterItemManager(this);
|
||||
|
||||
this.setObjectTypeMask(MBServerStatics.MASK_MOB | this.getTypeMasks());
|
||||
this.mobBase = MobBase.getMobBase(loadID);
|
||||
|
||||
this.building = BuildingManager.getBuilding(this.buildingUUID);
|
||||
|
||||
if (this.contractUUID == 0)
|
||||
this.contract = null;
|
||||
else
|
||||
this.contract = DbManager.ContractQueries.GET_CONTRACT(this.contractUUID);
|
||||
// Configure AI related values
|
||||
|
||||
// Setup mobile AI and equipset for contract
|
||||
|
||||
if (this.contract != null) {
|
||||
|
||||
this.equipmentSetID = this.contract.getEquipmentSet();
|
||||
|
||||
// Load AI for guard captains
|
||||
|
||||
if (NPC.ISGuardCaptain(contract.getContractID()) || this.contract.getContractID() == 910) { // Guard Dog
|
||||
this.behaviourType = MobBehaviourType.GuardCaptain;
|
||||
this.spawnTime = 60 * 15;
|
||||
this.isPlayerGuard = true;
|
||||
switch (this.behaviourType) {
|
||||
case GuardCaptain:
|
||||
this.agentType = AIAgentType.GUARDCAPTAIN;
|
||||
this.spawnTime = 600;
|
||||
this.guardedCity = ZoneManager.getCityAtLocation(this.building.getLoc());
|
||||
}
|
||||
|
||||
// Load AI for wall archers
|
||||
|
||||
if (NPC.ISWallArcher(this.contract)) {
|
||||
this.gridObjectType = GridObjectType.DYNAMIC;
|
||||
this.behaviourType = MobBehaviourType.GuardWallArcher;
|
||||
this.isPlayerGuard = true;
|
||||
break;
|
||||
case GuardWallArcher:
|
||||
this.agentType = AIAgentType.GUARDWALLARCHER;
|
||||
this.spawnTime = 450;
|
||||
this.guardedCity = ZoneManager.getCityAtLocation(this.building.getLoc());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Default to the mobbase for AI if nothing is hte mob field to override.
|
||||
// Default to the mobbase for AI if nothing is in mob field to override.
|
||||
|
||||
if (this.behaviourType == null || this.behaviourType.equals(MobBehaviourType.None))
|
||||
this.behaviourType = this.getMobBase().fsm;
|
||||
@@ -1579,6 +1562,18 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
if (this.behaviourType == null)
|
||||
this.behaviourType = MobBehaviourType.None;
|
||||
|
||||
if (this.contractUUID == 0)
|
||||
this.contract = null;
|
||||
else
|
||||
this.contract = DbManager.ContractQueries.GET_CONTRACT(this.contractUUID);
|
||||
|
||||
// Setup equipset for contract
|
||||
|
||||
if (this.contract != null)
|
||||
this.equipmentSetID = this.contract.getEquipmentSet();
|
||||
|
||||
// Mobiles default to the building guild.
|
||||
|
||||
if (this.building != null)
|
||||
this.guild = this.building.getGuild();
|
||||
else
|
||||
@@ -1604,7 +1599,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
// Don't override level for guard minions or pets
|
||||
|
||||
if (this.contract == null)
|
||||
if (!this.agentType.equals(AIAgentType.GUARD) && !this.agentType.equals(AIAgentType.PET))
|
||||
if (!this.agentType.equals(AIAgentType.GUARDMINION) && !this.agentType.equals(AIAgentType.PET))
|
||||
this.level = (short) this.mobBase.getLevel();
|
||||
|
||||
//set bonuses
|
||||
@@ -1614,8 +1609,8 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
//TODO set these correctly later
|
||||
this.rangeHandOne = this.mobBase.getAttackRange();
|
||||
this.rangeHandTwo = -1;
|
||||
this.minDamageHandOne = (int)this.mobBase.getMinDmg();
|
||||
this.maxDamageHandOne = (int)this.mobBase.getMaxDmg();
|
||||
this.minDamageHandOne = (int) this.mobBase.getMinDmg();
|
||||
this.maxDamageHandOne = (int) this.mobBase.getMaxDmg();
|
||||
this.minDamageHandTwo = 0;
|
||||
this.maxDamageHandTwo = 0;
|
||||
this.atrHandOne = this.mobBase.getAtr();
|
||||
@@ -1664,18 +1659,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
else
|
||||
this.equip = new HashMap<>();
|
||||
|
||||
// Powers from mobbase
|
||||
|
||||
if (PowersManager.AllMobPowers.containsKey(this.getMobBaseID()))
|
||||
for (MobPowerEntry mobPowerEntry : PowersManager.AllMobPowers.get(this.getMobBaseID()))
|
||||
mobPowers.put(mobPowerEntry.token, mobPowerEntry.rank);
|
||||
|
||||
// Powers from contract
|
||||
|
||||
if (this.contract != null && PowersManager.AllMobPowers.containsKey(this.contract.getContractID()))
|
||||
for (MobPowerEntry mobPowerEntry : PowersManager.AllMobPowers.get(this.contract.getContractID()))
|
||||
mobPowers.put(mobPowerEntry.token, mobPowerEntry.rank);
|
||||
|
||||
if (this.equip == null) {
|
||||
Logger.error("Null equipset returned for uuid " + currentID);
|
||||
this.equip = new HashMap<>(0);
|
||||
@@ -1691,29 +1674,35 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
if (this.getMobBase().enemy.size() > 0)
|
||||
this.enemy.addAll(this.getMobBase().enemy);
|
||||
}
|
||||
NPCManager.applyMobbaseEffects(this);
|
||||
NPCManager.applyEquipmentResists(this);
|
||||
NPCManager.applyMobbaseSkill(this);
|
||||
NPCManager.applyRuneSkills(this,this.getMobBaseID());
|
||||
this.recalculateStats();
|
||||
this.setHealth(this.healthMax);
|
||||
|
||||
try {
|
||||
NPCManager.applyRuneSetEffects(this);
|
||||
recalculateStats();
|
||||
this.setHealth(this.healthMax);
|
||||
// Set bounds for this mobile
|
||||
|
||||
// Set bounds for this mobile
|
||||
Bounds mobBounds = Bounds.borrow();
|
||||
mobBounds.setBounds(this.getLoc());
|
||||
this.setBounds(mobBounds);
|
||||
|
||||
Bounds mobBounds = Bounds.borrow();
|
||||
mobBounds.setBounds(this.getLoc());
|
||||
this.setBounds(mobBounds);
|
||||
//assign 5 random patrol points for regular mobs
|
||||
|
||||
//assign 5 random patrol points for regular mobs
|
||||
if (this.agentType.equals(AIAgentType.MOBILE))
|
||||
NPCManager.AssignPatrolPoints(this);
|
||||
|
||||
if (this.agentType.equals(AIAgentType.MOBILE)) {
|
||||
if (this.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN)) {
|
||||
|
||||
NPCManager.AssignPatrolPoints(this);
|
||||
Building barracks = this.building;
|
||||
|
||||
if (barracks != null && barracks.patrolPoints != null && !barracks.getPatrolPoints().isEmpty()) {
|
||||
this.patrolPoints = barracks.patrolPoints;
|
||||
MovementUtilities.aiMove(this, this.patrolPoints.get(0), true);
|
||||
}
|
||||
|
||||
this.deathTime = 0;
|
||||
} catch (Exception e) {
|
||||
Logger.error(e.getMessage());
|
||||
}
|
||||
|
||||
this.deathTime = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1721,8 +1710,8 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
return new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||
}
|
||||
|
||||
public boolean canSee(PlayerCharacter target) {
|
||||
return this.mobBase.getSeeInvis() >= target.getHidden();
|
||||
public boolean canSee(AbstractCharacter target) {
|
||||
return this.mobBase.getSeeInvis() >= target.hidden;
|
||||
}
|
||||
|
||||
public int getBuildingID() {
|
||||
@@ -1750,16 +1739,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) {
|
||||
@@ -1798,10 +1780,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
this.weaponPower = weaponPower;
|
||||
}
|
||||
|
||||
public ConcurrentHashMap<Mob, Integer> getSiegeMinionMap() {
|
||||
return siegeMinionMap;
|
||||
}
|
||||
|
||||
public DateTime getUpgradeDateTime() {
|
||||
|
||||
lock.readLock().lock();
|
||||
@@ -1822,7 +1800,8 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
}
|
||||
|
||||
public boolean isPlayerGuard() {
|
||||
return isPlayerGuard;
|
||||
|
||||
return EnumSet.of(AIAgentType.GUARDCAPTAIN, AIAgentType.GUARDMINION, AIAgentType.GUARDWALLARCHER).contains(this.agentType);
|
||||
}
|
||||
|
||||
public int getLastMobPowerToken() {
|
||||
@@ -1902,5 +1881,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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,9 @@ public class MobBaseStats {
|
||||
private final int baseSpi;
|
||||
private final int baseDex;
|
||||
|
||||
private final int mobbaseSkill;
|
||||
private final int mobbaseSkillAmount;
|
||||
|
||||
|
||||
/**
|
||||
* ResultSet Constructor
|
||||
@@ -31,6 +34,8 @@ public class MobBaseStats {
|
||||
this.baseCon = rs.getInt("Constitution");
|
||||
this.baseSpi = rs.getInt("Spirit");
|
||||
this.baseDex = rs.getInt("Dexterity");
|
||||
this.mobbaseSkill = rs.getInt("baseSkills");
|
||||
this.mobbaseSkillAmount = rs.getInt("skillAmount");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -43,6 +48,8 @@ public class MobBaseStats {
|
||||
this.baseCon = 0;
|
||||
this.baseSpi = 0;
|
||||
this.baseDex = 0;
|
||||
this.mobbaseSkill = 0;
|
||||
this.mobbaseSkillAmount = 0;
|
||||
}
|
||||
|
||||
public static MobBaseStats GetGenericStats() {
|
||||
@@ -72,5 +79,8 @@ public class MobBaseStats {
|
||||
return baseDex;
|
||||
}
|
||||
|
||||
public int getBaseSkill(){return mobbaseSkill;}
|
||||
|
||||
public int getBaseSkillAmount(){return mobbaseSkillAmount;}
|
||||
|
||||
}
|
||||
|
||||
@@ -640,28 +640,31 @@ public class NPC extends AbstractCharacter {
|
||||
|
||||
public void removeMinions() {
|
||||
|
||||
for (Mob toRemove : this.siegeMinionMap.keySet()) {
|
||||
|
||||
for (Integer minionUUID : this.minions) {
|
||||
|
||||
Mob minionMob = Mob.getMob(minionUUID);
|
||||
|
||||
try {
|
||||
toRemove.clearEffects();
|
||||
minionMob.clearEffects();
|
||||
} catch (Exception e) {
|
||||
Logger.error(e.getMessage());
|
||||
}
|
||||
|
||||
if (toRemove.getParentZone() != null)
|
||||
toRemove.getParentZone().zoneMobSet.remove(toRemove);
|
||||
if (minionMob.getParentZone() != null)
|
||||
minionMob.getParentZone().zoneMobSet.remove(minionMob);
|
||||
|
||||
WorldGrid.RemoveWorldObject(toRemove);
|
||||
DbManager.removeFromCache(toRemove);
|
||||
WorldGrid.RemoveWorldObject(minionMob);
|
||||
DbManager.removeFromCache(minionMob);
|
||||
|
||||
|
||||
PlayerCharacter petOwner = (PlayerCharacter) toRemove.guardCaptain;
|
||||
PlayerCharacter petOwner = (PlayerCharacter) minionMob.guardCaptain;
|
||||
|
||||
if (petOwner != null) {
|
||||
|
||||
petOwner.setPet(null);
|
||||
|
||||
toRemove.guardCaptain = null;
|
||||
minionMob.guardCaptain = null;
|
||||
|
||||
PetMsg petMsg = new PetMsg(5, null);
|
||||
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
|
||||
@@ -669,6 +672,7 @@ public class NPC extends AbstractCharacter {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -135,7 +135,6 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
private Vector3fImmutable lastStaticLoc = new Vector3fImmutable(0.0f, 0.0f, 0.0f);
|
||||
private GameObjectType lastTargetType;
|
||||
private int lastTargetID;
|
||||
private int hidden = 0; // current rank of hide/sneak/invis
|
||||
private int seeInvis = 0; // current rank of see invis
|
||||
private float speedMod;
|
||||
private boolean teleportMode = false; // Teleport on MoveToPoint
|
||||
@@ -2774,10 +2773,6 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
this.lastStaticLoc = value;
|
||||
}
|
||||
|
||||
public int getHidden() {
|
||||
return this.hidden;
|
||||
}
|
||||
|
||||
public void setHidden(int value) {
|
||||
this.hidden = value;
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
package engine.powers;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class MobPowerEntry {
|
||||
|
||||
public int token;
|
||||
public int rank;
|
||||
|
||||
|
||||
public MobPowerEntry(ResultSet rs) throws SQLException {
|
||||
this.token = rs.getInt("token");
|
||||
this.rank = rs.getInt("rank");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
package engine.powers;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class RunePowerEntry {
|
||||
|
||||
public String name;
|
||||
public int token;
|
||||
public String power_type;
|
||||
public int rank;
|
||||
|
||||
|
||||
public RunePowerEntry(ResultSet rs) throws SQLException {
|
||||
this.name = rs.getString("name");
|
||||
this.token = rs.getInt("token");
|
||||
this.power_type = rs.getString("power_type");
|
||||
this.rank = rs.getInt("rank");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
package engine.powers;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class RuneSkillAdjustEntry {
|
||||
|
||||
public String name;
|
||||
public int token;
|
||||
public String skill_type;
|
||||
public int rank;
|
||||
public int level;
|
||||
|
||||
|
||||
public RuneSkillAdjustEntry(ResultSet rs) throws SQLException {
|
||||
this.name = rs.getString("name");
|
||||
this.token = rs.getInt("token");
|
||||
this.skill_type = rs.getString("skill_type");
|
||||
this.rank = rs.getInt("rank");
|
||||
this.level = rs.getInt("level");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,7 +17,7 @@ import engine.InterestManagement.HeightMap;
|
||||
import engine.InterestManagement.RealmMap;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.db.archive.DataWarehouse;
|
||||
import engine.db.handlers.dbPowerHandler;
|
||||
import engine.db.handlers.dbRuneBaseHandler;
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.*;
|
||||
import engine.job.JobContainer;
|
||||
@@ -351,8 +351,11 @@ public class WorldServer {
|
||||
Logger.info("Loading MobBases.");
|
||||
DbManager.MobBaseQueries.GET_ALL_MOBBASES();
|
||||
|
||||
Logger.info("Loading Mob Powers");
|
||||
PowersManager.AllMobPowers = dbPowerHandler.LOAD_MOB_POWERS();
|
||||
Logger.info("Loading Rune Powers");
|
||||
PowersManager._allRunePowers = dbRuneBaseHandler.LOAD_RUNE_POWERS();
|
||||
|
||||
Logger.info("Loading Rune Skill Adjusts");
|
||||
PowersManager._allRuneSkillAdjusts = dbRuneBaseHandler.LOAD_RUNE_SKILL_ADJUSTS();
|
||||
|
||||
Logger.info("Loading item enchants");
|
||||
DbManager.LootQueries.LOAD_ENCHANT_VALUES();
|
||||
|
||||
Reference in New Issue
Block a user