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 {
|
public enum AIAgentType {
|
||||||
MOBILE,
|
MOBILE,
|
||||||
|
GUARDCAPTAIN,
|
||||||
|
GUARDMINION,
|
||||||
|
GUARDWALLARCHER,
|
||||||
PET,
|
PET,
|
||||||
CHARMED,
|
CHARMED,
|
||||||
|
SIEGEENGINE;
|
||||||
SIEGEENGINE,
|
|
||||||
GUARD;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ public enum InterestManager implements Runnable {
|
|||||||
|
|
||||||
else {
|
else {
|
||||||
if (pc != null)
|
if (pc != null)
|
||||||
if (pcc.getSeeInvis() < pc.getHidden())
|
if (pcc.getSeeInvis() < pc.hidden)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!cc.sendMsg(uom)) {
|
if (!cc.sendMsg(uom)) {
|
||||||
@@ -340,7 +340,7 @@ public enum InterestManager implements Runnable {
|
|||||||
if (loadedPlayer.getObjectUUID() == player.getObjectUUID())
|
if (loadedPlayer.getObjectUUID() == player.getObjectUUID())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (player.getSeeInvis() < loadedPlayer.getHidden())
|
if (player.getSeeInvis() < loadedPlayer.hidden)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (loadedPlayer.safemodeInvis())
|
if (loadedPlayer.safemodeInvis())
|
||||||
@@ -372,7 +372,7 @@ public enum InterestManager implements Runnable {
|
|||||||
|
|
||||||
if (playerLoadedObject.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
if (playerLoadedObject.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||||
PlayerCharacter loadedPlayer = (PlayerCharacter) playerLoadedObject;
|
PlayerCharacter loadedPlayer = (PlayerCharacter) playerLoadedObject;
|
||||||
if (player.getSeeInvis() < loadedPlayer.getHidden())
|
if (player.getSeeInvis() < loadedPlayer.hidden)
|
||||||
toRemove.add(playerLoadedObject);
|
toRemove.add(playerLoadedObject);
|
||||||
else if (loadedPlayer.safemodeInvis())
|
else if (loadedPlayer.safemodeInvis())
|
||||||
toRemove.add(playerLoadedObject);
|
toRemove.add(playerLoadedObject);
|
||||||
@@ -437,7 +437,7 @@ public enum InterestManager implements Runnable {
|
|||||||
|
|
||||||
// dont load if invis
|
// dont load if invis
|
||||||
|
|
||||||
if (player.getSeeInvis() < awopc.getHidden())
|
if (player.getSeeInvis() < awopc.hidden)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
lcm = new LoadCharacterMsg(awopc, PlayerCharacter.hideNonAscii());
|
lcm = new LoadCharacterMsg(awopc, PlayerCharacter.hideNonAscii());
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class dbMobHandler extends dbHandlerBase {
|
|||||||
Mob mobile = null;
|
Mob mobile = null;
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
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.setLong(1, toAdd.parentZoneUUID);
|
||||||
preparedStatement.setInt(2, toAdd.loadID);
|
preparedStatement.setInt(2, toAdd.loadID);
|
||||||
@@ -48,6 +48,7 @@ public class dbMobHandler extends dbHandlerBase {
|
|||||||
preparedStatement.setInt(11, toAdd.buildingUUID);
|
preparedStatement.setInt(11, toAdd.buildingUUID);
|
||||||
preparedStatement.setInt(12, toAdd.level);
|
preparedStatement.setInt(12, toAdd.level);
|
||||||
preparedStatement.setString(13, toAdd.firstName);
|
preparedStatement.setString(13, toAdd.firstName);
|
||||||
|
preparedStatement.setString(14, toAdd.behaviourType.toString());
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
@@ -110,7 +111,7 @@ public class dbMobHandler extends dbHandlerBase {
|
|||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
String minionName = rs.getString("name");
|
String minionName = rs.getString("minionName");
|
||||||
Mob toCreate = Mob.createGuardMinion(guardCaptain, guardCaptain.getLevel(), minionName);
|
Mob toCreate = Mob.createGuardMinion(guardCaptain, guardCaptain.getLevel(), minionName);
|
||||||
|
|
||||||
if (toCreate == null)
|
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();
|
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.setLong(1, captainUID);
|
||||||
preparedStatement.setInt(2, mobBaseID);
|
preparedStatement.setString(2, minionName);
|
||||||
preparedStatement.setString(3, name);
|
|
||||||
preparedStatement.setInt(4, slot);
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
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();
|
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.setLong(1, captainUID);
|
||||||
preparedStatement.setInt(2, mobBaseID);
|
preparedStatement.setString(2, minionName);
|
||||||
preparedStatement.setInt(3, slot);
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
|||||||
@@ -15,15 +15,9 @@ import engine.gameManager.PowersManager;
|
|||||||
import engine.objects.Mob;
|
import engine.objects.Mob;
|
||||||
import engine.objects.PreparedStatementShared;
|
import engine.objects.PreparedStatementShared;
|
||||||
import engine.powers.EffectsBase;
|
import engine.powers.EffectsBase;
|
||||||
import engine.powers.MobPowerEntry;
|
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
public class dbPowerHandler extends dbHandlerBase {
|
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.gameManager.DbManager;
|
||||||
import engine.objects.RuneBase;
|
import engine.objects.RuneBase;
|
||||||
|
import engine.powers.RunePowerEntry;
|
||||||
|
import engine.powers.RuneSkillAdjustEntry;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
@@ -27,6 +29,84 @@ public class dbRuneBaseHandler extends dbHandlerBase {
|
|||||||
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
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) {
|
public void GET_RUNE_REQS(final RuneBase rb) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.ChatManager;
|
import engine.gameManager.ChatManager;
|
||||||
@@ -43,7 +44,7 @@ public class AddMobCmd extends AbstractDevCmd {
|
|||||||
MobBase mb = (MobBase) mobbaseAGO;
|
MobBase mb = (MobBase) mobbaseAGO;
|
||||||
int loadID = mb.getObjectUUID();
|
int loadID = mb.getObjectUUID();
|
||||||
Mob mob = Mob.createMob(loadID, Vector3fImmutable.getRandomPointInCircle(pc.getLoc(), 100),
|
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) {
|
if (mob != null) {
|
||||||
mob.updateDatabase();
|
mob.updateDatabase();
|
||||||
this.setResult(String.valueOf(mob.getDBID()));
|
this.setResult(String.valueOf(mob.getDBID()));
|
||||||
@@ -84,7 +85,7 @@ public class AddMobCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
|
|
||||||
Mob mob = Mob.createMob(loadID, pc.getLoc(),
|
Mob mob = Mob.createMob(loadID, pc.getLoc(),
|
||||||
null, zone, null, null, "", 1);
|
null, zone, null, null, "", 1, Enum.AIAgentType.MOBILE);
|
||||||
if (mob != null) {
|
if (mob != null) {
|
||||||
mob.updateDatabase();
|
mob.updateDatabase();
|
||||||
ChatManager.chatSayInfo(pc,
|
ChatManager.chatSayInfo(pc,
|
||||||
|
|||||||
@@ -59,22 +59,25 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
|
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
for (Mob mob : npc.siegeMinionMap.keySet()) {
|
for (Integer minionUUID : npc.minions) {
|
||||||
|
Mob mob = Mob.getMob(minionUUID);
|
||||||
WorldGrid.RemoveWorldObject(mob);
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
WorldGrid.removeObject(mob, pc);
|
WorldGrid.removeObject(mob, pc);
|
||||||
//Mob.getRespawnMap().remove(mob);
|
|
||||||
if (mob.getParentZone() != null)
|
if (mob.getParentZone() != null)
|
||||||
mob.getParentZone().zoneMobSet.remove(mob);
|
mob.getParentZone().zoneMobSet.remove(mob);
|
||||||
}
|
}
|
||||||
|
|
||||||
DbManager.NPCQueries.DELETE_NPC(npc);
|
DbManager.NPCQueries.DELETE_NPC(npc);
|
||||||
DbManager.removeFromCache(GameObjectType.NPC,
|
DbManager.removeFromCache(GameObjectType.NPC,
|
||||||
npc.getObjectUUID());
|
npc.getObjectUUID());
|
||||||
WorldGrid.RemoveWorldObject(npc);
|
WorldGrid.RemoveWorldObject(npc);
|
||||||
} else if (mobA != null) {
|
} else if (mobA != null) {
|
||||||
for (Mob mob : mobA.getSiegeMinionMap().keySet()) {
|
for (Integer minionUUID : mobA.minions) {
|
||||||
|
Mob mob = Mob.getMob(minionUUID);
|
||||||
WorldGrid.RemoveWorldObject(mob);
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
WorldGrid.removeObject(mob, pc);
|
WorldGrid.removeObject(mob, pc);
|
||||||
//Mob.getRespawnMap().remove(mob);
|
|
||||||
if (mob.getParentZone() != null)
|
if (mob.getParentZone() != null)
|
||||||
mob.getParentZone().zoneMobSet.remove(mob);
|
mob.getParentZone().zoneMobSet.remove(mob);
|
||||||
}
|
}
|
||||||
@@ -151,10 +154,11 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
|
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
for (Mob mob : npc.siegeMinionMap.keySet()) {
|
for (Integer minionUUID : npc.minions) {
|
||||||
|
Mob mob = Mob.getMob(minionUUID);
|
||||||
WorldGrid.RemoveWorldObject(mob);
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
WorldGrid.removeObject(mob, pc);
|
WorldGrid.removeObject(mob, pc);
|
||||||
//Mob.getRespawnMap().remove(mob);
|
|
||||||
if (mob.getParentZone() != null)
|
if (mob.getParentZone() != null)
|
||||||
mob.getParentZone().zoneMobSet.remove(mob);
|
mob.getParentZone().zoneMobSet.remove(mob);
|
||||||
}
|
}
|
||||||
@@ -163,10 +167,11 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
|||||||
npc.getObjectUUID());
|
npc.getObjectUUID());
|
||||||
WorldGrid.RemoveWorldObject(npc);
|
WorldGrid.RemoveWorldObject(npc);
|
||||||
} else if (mobA != null) {
|
} else if (mobA != null) {
|
||||||
for (Mob mob : mobA.getSiegeMinionMap().keySet()) {
|
for (Integer minionUUID : mobA.minions) {
|
||||||
|
Mob mob = Mob.getMob(minionUUID);
|
||||||
WorldGrid.RemoveWorldObject(mob);
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
WorldGrid.removeObject(mob, pc);
|
WorldGrid.removeObject(mob, pc);
|
||||||
//Mob.getRespawnMap().remove(mob);
|
|
||||||
if (mob.getParentZone() != null)
|
if (mob.getParentZone() != null)
|
||||||
mob.getParentZone().zoneMobSet.remove(mob);
|
mob.getParentZone().zoneMobSet.remove(mob);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,24 +154,29 @@ public class RemoveObjectCmd extends AbstractDevCmd {
|
|||||||
mobA = (Mob) ac;
|
mobA = (Mob) ac;
|
||||||
|
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
for (Mob mob : npc.siegeMinionMap.keySet()) {
|
|
||||||
WorldGrid.RemoveWorldObject(mob);
|
for (Integer minionUUID : npc.minions) {
|
||||||
WorldGrid.removeObject(mob, pc);
|
Mob minionMob = Mob.getMob(minionUUID);
|
||||||
//Mob.getRespawnMap().remove(mob);
|
WorldGrid.RemoveWorldObject(minionMob);
|
||||||
if (mob.getParentZone() != null)
|
WorldGrid.removeObject(minionMob, pc);
|
||||||
mob.getParentZone().zoneMobSet.remove(mob);
|
|
||||||
|
if (minionMob.getParentZone() != null)
|
||||||
|
minionMob.getParentZone().zoneMobSet.remove(minionMob);
|
||||||
}
|
}
|
||||||
|
|
||||||
DbManager.NPCQueries.DELETE_NPC(npc);
|
DbManager.NPCQueries.DELETE_NPC(npc);
|
||||||
DbManager.removeFromCache(npc);
|
DbManager.removeFromCache(npc);
|
||||||
WorldGrid.RemoveWorldObject(npc);
|
WorldGrid.RemoveWorldObject(npc);
|
||||||
WorldGrid.removeObject(npc, pc);
|
WorldGrid.removeObject(npc, pc);
|
||||||
} else if (mobA != null) {
|
} else if (mobA != null) {
|
||||||
for (Mob mob : mobA.getSiegeMinionMap().keySet()) {
|
|
||||||
WorldGrid.RemoveWorldObject(mob);
|
for (Integer minionUUID : mobA.minions) {
|
||||||
WorldGrid.removeObject(mob, pc);
|
Mob minionMob = Mob.getMob(minionUUID);
|
||||||
//Mob.getRespawnMap().remove(mob);
|
WorldGrid.RemoveWorldObject(minionMob);
|
||||||
if (mob.getParentZone() != null)
|
WorldGrid.removeObject(minionMob, pc);
|
||||||
mob.getParentZone().zoneMobSet.remove(mob);
|
|
||||||
|
if (minionMob.getParentZone() != null)
|
||||||
|
minionMob.getParentZone().zoneMobSet.remove(minionMob);
|
||||||
}
|
}
|
||||||
DbManager.MobQueries.DELETE_MOB(mobA);
|
DbManager.MobQueries.DELETE_MOB(mobA);
|
||||||
DbManager.removeFromCache(mobA);
|
DbManager.removeFromCache(mobA);
|
||||||
@@ -209,11 +214,13 @@ public class RemoveObjectCmd extends AbstractDevCmd {
|
|||||||
if (npc.building != null)
|
if (npc.building != null)
|
||||||
npc.building.getHirelings().remove(npc);
|
npc.building.getHirelings().remove(npc);
|
||||||
|
|
||||||
for (Mob mob : npc.siegeMinionMap.keySet()) {
|
for (Integer minionUUID : npc.minions) {
|
||||||
WorldGrid.RemoveWorldObject(mob);
|
Mob minionMob = Mob.getMob(minionUUID);
|
||||||
WorldGrid.removeObject(mob, pc);
|
WorldGrid.RemoveWorldObject(minionMob);
|
||||||
if (mob.getParentZone() != null)
|
WorldGrid.removeObject(minionMob, pc);
|
||||||
mob.getParentZone().zoneMobSet.remove(mob);
|
|
||||||
|
if (minionMob.getParentZone() != null)
|
||||||
|
minionMob.getParentZone().zoneMobSet.remove(minionMob);
|
||||||
}
|
}
|
||||||
|
|
||||||
DbManager.NPCQueries.DELETE_NPC(npc);
|
DbManager.NPCQueries.DELETE_NPC(npc);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
@@ -110,7 +111,7 @@ public class SplatMobCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
mobile = Mob.createMob(_mobileUUID,
|
mobile = Mob.createMob(_mobileUUID,
|
||||||
Vector3fImmutable.getRandomPointInCircle(_currentLocation, _targetRange),
|
Vector3fImmutable.getRandomPointInCircle(_currentLocation, _targetRange),
|
||||||
null, serverZone, null, null, "", 1);
|
null, serverZone, null, null, "", 1, Enum.AIAgentType.MOBILE);
|
||||||
|
|
||||||
if (mobile != null) {
|
if (mobile != null) {
|
||||||
mobile.updateDatabase();
|
mobile.updateDatabase();
|
||||||
|
|||||||
@@ -9,13 +9,17 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.PowersManager;
|
import engine.gameManager.PowersManager;
|
||||||
|
import engine.mobileAI.MobAI;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.Mob;
|
import engine.objects.Mob;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
|
import engine.powers.RunePowerEntry;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
@@ -57,6 +61,27 @@ public class aiInfoCmd extends AbstractDevCmd {
|
|||||||
Mob mob = (Mob) target;
|
Mob mob = (Mob) target;
|
||||||
output = "Mob AI Information:" + newline;
|
output = "Mob AI Information:" + newline;
|
||||||
output += mob.getName() + 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) {
|
if (mob.behaviourType != null) {
|
||||||
output += "BehaviourType: " + mob.behaviourType.toString() + newline;
|
output += "BehaviourType: " + mob.behaviourType.toString() + newline;
|
||||||
if (mob.behaviourType.BehaviourHelperType != null) {
|
if (mob.behaviourType.BehaviourHelperType != null) {
|
||||||
@@ -88,10 +113,43 @@ public class aiInfoCmd extends AbstractDevCmd {
|
|||||||
if (mob.guardedCity != null)
|
if (mob.guardedCity != null)
|
||||||
output += "Patrolling: " + mob.guardedCity.getCityName() + newline;
|
output += "Patrolling: " + mob.guardedCity.getCityName() + newline;
|
||||||
|
|
||||||
|
output += "Can Cast: " + MobAI.canCast(mob) + newline;
|
||||||
output += "Powers:" + newline;
|
output += "Powers:" + newline;
|
||||||
|
|
||||||
for (int token : mob.mobPowers.keySet())
|
ArrayList<RunePowerEntry> powerEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.getMobBaseID()));
|
||||||
output += PowersManager.getPowerByToken(token).getName() + newline;
|
|
||||||
|
// 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);
|
throwbackInfo(playerCharacter, output);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -530,41 +530,63 @@ public enum BuildingManager {
|
|||||||
else
|
else
|
||||||
rank = 10;
|
rank = 10;
|
||||||
|
|
||||||
Mob mob;
|
Mob mobile;
|
||||||
NPC npc;
|
NPC npc;
|
||||||
|
|
||||||
if (NPC.ISWallArcher(contract)) {
|
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;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NPC.ISGuardCaptain(contract.getContractID())) {
|
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;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (contract.getContractID() == 910) {
|
if (contract.getContractID() == 910) {
|
||||||
|
|
||||||
//guard dog
|
//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;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -788,7 +788,7 @@ public enum ChatManager {
|
|||||||
it.remove();
|
it.remove();
|
||||||
else {
|
else {
|
||||||
PlayerCharacter pcc = (PlayerCharacter) awo;
|
PlayerCharacter pcc = (PlayerCharacter) awo;
|
||||||
if (pcc.getSeeInvis() < pc.getHidden())
|
if (pcc.getSeeInvis() < pc.hidden)
|
||||||
it.remove();
|
it.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ public enum CombatManager {
|
|||||||
|
|
||||||
City playerCity = ZoneManager.getCityAtLocation(playerCharacter.getLoc());
|
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());
|
playerCity.cityOutlaws.add(playerCharacter.getObjectUUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -826,8 +826,8 @@ public enum CombatManager {
|
|||||||
damage *= 2.5f; //increase damage if sitting
|
damage *= 2.5f; //increase damage if sitting
|
||||||
|
|
||||||
if (tarAc.getObjectType() == GameObjectType.Mob) {
|
if (tarAc.getObjectType() == GameObjectType.Mob) {
|
||||||
if(ac.getObjectType().equals(GameObjectType.PlayerCharacter))
|
if (ac.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||||
((Mob)tarAc).playerAgroMap.put(ac.getObjectUUID(), ((Mob) tarAc).playerAgroMap.get(ac.getObjectUUID()) + damage);
|
((Mob) tarAc).playerAgroMap.put(ac.getObjectUUID(), ((Mob) tarAc).playerAgroMap.get(ac.getObjectUUID()) + damage);
|
||||||
((Mob) tarAc).handleDirectAggro(ac);
|
((Mob) tarAc).handleDirectAggro(ac);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1268,61 +1268,75 @@ public enum CombatManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Called when character takes damage.
|
//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;
|
return;
|
||||||
|
|
||||||
if (ac.equals(tarAc))
|
if (attacker.equals(target))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (tarAc.isMoving() && tarAc.getObjectType().equals(GameObjectType.PlayerCharacter))
|
if (target.isMoving() && target.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!tarAc.isAlive() || !ac.isAlive())
|
if (!target.isAlive() || !attacker.isAlive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
boolean isCombat = tarAc.isCombat();
|
boolean isCombat = target.isCombat();
|
||||||
|
|
||||||
//If target in combat and has no target, then attack back
|
//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 ((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 (tarAc.getObjectType().equals(GameObjectType.PlayerCharacter)) { // we are in combat with no valid target
|
if (target.getObjectType().equals(GameObjectType.PlayerCharacter)) { // we are in combat with no valid target
|
||||||
|
|
||||||
PlayerCharacter pc = (PlayerCharacter) tarAc;
|
PlayerCharacter pc = (PlayerCharacter) target;
|
||||||
tarAc.setCombatTarget(ac);
|
target.setCombatTarget(attacker);
|
||||||
pc.setLastTarget(ac.getObjectType(), ac.getObjectUUID());
|
pc.setLastTarget(attacker.getObjectType(), attacker.getObjectUUID());
|
||||||
|
|
||||||
if (tarAc.getTimers() != null)
|
if (target.getTimers() != null)
|
||||||
if (!tarAc.getTimers().containsKey("Attack" + MBServerStatics.SLOT_MAINHAND))
|
if (!target.getTimers().containsKey("Attack" + MBServerStatics.SLOT_MAINHAND))
|
||||||
CombatManager.AttackTarget((PlayerCharacter) tarAc, tarAc.getCombatTarget());
|
CombatManager.AttackTarget((PlayerCharacter) target, target.getCombatTarget());
|
||||||
}
|
}
|
||||||
|
|
||||||
//Handle pet retaliate if assist is on and pet doesn't have a target.
|
//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)
|
if (pet != null && pet.assist && pet.getCombatTarget() == null)
|
||||||
pet.setCombatTarget(ac);
|
pet.setCombatTarget(attacker);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Handle Mob Retaliate.
|
//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;
|
return;
|
||||||
|
|
||||||
if (ac.getObjectType() == GameObjectType.Mob && retaliater.isSiege())
|
attackedMobile.setCombatTarget(attacker);
|
||||||
return;
|
|
||||||
|
|
||||||
retaliater.setCombatTarget(ac);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import engine.net.DispatchMessage;
|
|||||||
import engine.net.client.msg.PetMsg;
|
import engine.net.client.msg.PetMsg;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.powers.EffectsBase;
|
import engine.powers.EffectsBase;
|
||||||
|
import engine.powers.RuneSkillAdjustEntry;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -23,84 +24,6 @@ public enum NPCManager {
|
|||||||
NPC_MANAGER;
|
NPC_MANAGER;
|
||||||
public static HashMap<Integer, ArrayList<Integer>> _runeSetMap = new HashMap<>();
|
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) {
|
public static void dismissNecroPet(Mob necroPet, boolean updateOwner) {
|
||||||
|
|
||||||
necroPet.setCombatTarget(null);
|
necroPet.setCombatTarget(null);
|
||||||
@@ -199,37 +122,39 @@ public enum NPCManager {
|
|||||||
|
|
||||||
public static void removeSiegeMinions(Mob mobile) {
|
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()) {
|
if (mobile.isMoving()) {
|
||||||
|
|
||||||
mobile.stopMovement(mobile.getLoc());
|
mobile.stopMovement(mobile.getLoc());
|
||||||
|
|
||||||
if (toRemove.parentZone != null)
|
if (siegeMinion.parentZone != null)
|
||||||
toRemove.parentZone.zoneMobSet.remove(toRemove);
|
siegeMinion.parentZone.zoneMobSet.remove(siegeMinion);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
toRemove.clearEffects();
|
siegeMinion.clearEffects();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(e.getMessage());
|
Logger.error(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toRemove.parentZone != null)
|
if (siegeMinion.parentZone != null)
|
||||||
toRemove.parentZone.zoneMobSet.remove(toRemove);
|
siegeMinion.parentZone.zoneMobSet.remove(siegeMinion);
|
||||||
|
|
||||||
WorldGrid.RemoveWorldObject(toRemove);
|
WorldGrid.RemoveWorldObject(siegeMinion);
|
||||||
WorldGrid.removeObject(toRemove);
|
WorldGrid.removeObject(siegeMinion);
|
||||||
DbManager.removeFromCache(toRemove);
|
DbManager.removeFromCache(siegeMinion);
|
||||||
|
|
||||||
|
|
||||||
PlayerCharacter petOwner = (PlayerCharacter) toRemove.guardCaptain;
|
PlayerCharacter petOwner = (PlayerCharacter) siegeMinion.guardCaptain;
|
||||||
|
|
||||||
if (petOwner != null) {
|
if (petOwner != null) {
|
||||||
|
|
||||||
petOwner.setPet(null);
|
petOwner.setPet(null);
|
||||||
|
|
||||||
toRemove.guardCaptain = null;
|
siegeMinion.guardCaptain = null;
|
||||||
|
|
||||||
PetMsg petMsg = new PetMsg(5, null);
|
PetMsg petMsg = new PetMsg(5, null);
|
||||||
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
|
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)) {
|
if (abstractCharacter.getObjectType().equals(Enum.GameObjectType.Mob) && ((Mob) abstractCharacter).behaviourType.equals(Enum.MobBehaviourType.SiegeEngine)) {
|
||||||
Mob siegeMobile = (Mob) abstractCharacter;
|
Mob siegeMobile = (Mob) abstractCharacter;
|
||||||
buildingSlot = siegeMobile.guardCaptain.siegeMinionMap.size() + 2;
|
buildingSlot = siegeMobile.guardCaptain.minions.size() + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buildingSlot == -1)
|
if (buildingSlot == -1)
|
||||||
@@ -419,9 +344,85 @@ public enum NPCManager {
|
|||||||
mob.patrolPoints.add(newPatrolPoint);
|
mob.patrolPoints.add(newPatrolPoint);
|
||||||
|
|
||||||
if (i == 1) {
|
if (i == 1) {
|
||||||
mob.loc = newPatrolPoint;
|
mob.setLoc(newPatrolPoint);
|
||||||
mob.endLoc = 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<Integer, AbstractPowerAction> powerActionsByID = new HashMap<>();
|
||||||
public static HashMap<String, Integer> ActionTokenByIDString = new HashMap<>();
|
public static HashMap<String, Integer> ActionTokenByIDString = new HashMap<>();
|
||||||
public static HashMap<String, Integer> AnimationOverrides = 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 static JobScheduler js;
|
||||||
|
|
||||||
private PowersManager() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void initPowersManager(boolean fullPowersLoad) {
|
public static void initPowersManager(boolean fullPowersLoad) {
|
||||||
|
|
||||||
if (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
|
// This pre-loads all powers and effects
|
||||||
public static void InitializePowers() {
|
public static void InitializePowers() {
|
||||||
|
|
||||||
|
|||||||
+138
-254
@@ -23,6 +23,7 @@ import engine.net.client.msg.PowerProjectileMsg;
|
|||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.powers.ActionsBase;
|
import engine.powers.ActionsBase;
|
||||||
import engine.powers.PowersBase;
|
import engine.powers.PowersBase;
|
||||||
|
import engine.powers.RunePowerEntry;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -49,17 +50,19 @@ public class MobAI {
|
|||||||
return;
|
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 (target.getObjectType() == Enum.GameObjectType.PlayerCharacter && canCast(mob)) {
|
||||||
|
|
||||||
if (mob.isPlayerGuard() == false && MobCast(mob)) {
|
if (MobCast(mob)) {
|
||||||
mob.updateLocation();
|
mob.updateLocation();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mob.isPlayerGuard() == true && GuardCast(mob)) {
|
|
||||||
mob.updateLocation();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CombatUtilities.inRangeToAttack(mob, target))
|
if (!CombatUtilities.inRangeToAttack(mob, target))
|
||||||
@@ -165,7 +168,7 @@ public class MobAI {
|
|||||||
|
|
||||||
if (playercity != null)
|
if (playercity != null)
|
||||||
for (Mob guard : playercity.getParent().zoneMobSet)
|
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()))
|
if (guard.getCombatTarget() == null && !guard.getGuild().equals(mob.getGuild()))
|
||||||
guard.setCombatTarget(mob);
|
guard.setCombatTarget(mob);
|
||||||
|
|
||||||
@@ -249,18 +252,21 @@ public class MobAI {
|
|||||||
|
|
||||||
try {
|
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;
|
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())
|
if (mob.stopPatrolTime + (patrolDelay * 1000) > System.currentTimeMillis())
|
||||||
|
if (!forced)
|
||||||
return;
|
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;
|
Building barracks = mob.building;
|
||||||
|
|
||||||
@@ -275,24 +281,28 @@ public class MobAI {
|
|||||||
if (mob.lastPatrolPointIndex > mob.patrolPoints.size() - 1)
|
if (mob.lastPatrolPointIndex > mob.patrolPoints.size() - 1)
|
||||||
mob.lastPatrolPointIndex = 0;
|
mob.lastPatrolPointIndex = 0;
|
||||||
|
|
||||||
|
// 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.destination = mob.patrolPoints.get(mob.lastPatrolPointIndex);
|
||||||
mob.lastPatrolPointIndex += 1;
|
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);
|
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) {
|
} catch (Exception e) {
|
||||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackTarget" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackTarget" + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
@@ -300,6 +310,8 @@ public class MobAI {
|
|||||||
|
|
||||||
public static boolean canCast(Mob mob) {
|
public static boolean canCast(Mob mob) {
|
||||||
|
|
||||||
|
int contractID = 0;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// Performs validation to determine if a
|
// Performs validation to determine if a
|
||||||
@@ -308,26 +320,25 @@ public class MobAI {
|
|||||||
if (mob == null)
|
if (mob == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(mob.isPlayerGuard == true){
|
if (mob.isPlayerGuard() == true) {
|
||||||
|
|
||||||
int contractID;
|
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION))
|
||||||
|
|
||||||
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardMinion))
|
|
||||||
contractID = mob.guardCaptain.contract.getContractID();
|
contractID = mob.guardCaptain.contract.getContractID();
|
||||||
else
|
else
|
||||||
contractID = mob.contract.getContractID();
|
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;
|
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;
|
return false;
|
||||||
|
|
||||||
if (!mob.canSee((PlayerCharacter) mob.getCombatTarget())) {
|
|
||||||
mob.setCombatTarget(null);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (mob.nextCastTime == 0)
|
if (mob.nextCastTime == 0)
|
||||||
mob.nextCastTime = System.currentTimeMillis();
|
mob.nextCastTime = System.currentTimeMillis();
|
||||||
|
|
||||||
@@ -346,8 +357,8 @@ public class MobAI {
|
|||||||
// and casts it on the current target (or itself). Validation
|
// and casts it on the current target (or itself). Validation
|
||||||
// (including empty lists) is done previously within canCast();
|
// (including empty lists) is done previously within canCast();
|
||||||
|
|
||||||
ArrayList<Integer> powerTokens;
|
ArrayList<RunePowerEntry> powerEntries;
|
||||||
ArrayList<Integer> purgeTokens;
|
ArrayList<RunePowerEntry> purgeEntries;
|
||||||
AbstractCharacter target = (AbstractCharacter) mob.getCombatTarget();
|
AbstractCharacter target = (AbstractCharacter) mob.getCombatTarget();
|
||||||
|
|
||||||
if (mob.behaviourType.callsForHelp)
|
if (mob.behaviourType.callsForHelp)
|
||||||
@@ -355,38 +366,58 @@ public class MobAI {
|
|||||||
|
|
||||||
// Generate a list of tokens from the mob powers for this mobile.
|
// Generate a list of tokens from the mob powers for this mobile.
|
||||||
|
|
||||||
powerTokens = new ArrayList<>(mob.mobPowers.keySet());
|
powerEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.getMobBaseID()));
|
||||||
purgeTokens = new ArrayList<>();
|
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
|
// If player has this effect on them currently then remove
|
||||||
// this token from our list.
|
// 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()) {
|
for (ActionsBase actionBase : powerBase.getActions()) {
|
||||||
|
|
||||||
String stackType = actionBase.stackType;
|
String stackType = actionBase.stackType;
|
||||||
|
|
||||||
if (target.getEffects() != null && target.getEffects().containsKey(stackType))
|
if (target.getEffects() != null && target.getEffects().containsKey(stackType))
|
||||||
purgeTokens.add(powerToken);
|
purgeEntries.add(runePowerEntry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
powerTokens.removeAll(purgeTokens);
|
powerEntries.removeAll(purgeEntries);
|
||||||
|
|
||||||
// Sanity check
|
// Sanity check
|
||||||
|
|
||||||
if (powerTokens.isEmpty())
|
if (powerEntries.isEmpty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Pick random spell from our list of powers
|
// Pick random spell from our list of powers
|
||||||
|
|
||||||
int powerToken = powerTokens.get(ThreadLocalRandom.current().nextInt(powerTokens.size()));
|
RunePowerEntry runePowerEntry = powerEntries.get(ThreadLocalRandom.current().nextInt(powerEntries.size()));
|
||||||
int powerRank = mob.mobPowers.get(powerToken);
|
|
||||||
|
|
||||||
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
|
//check for hit-roll
|
||||||
|
|
||||||
@@ -411,7 +442,7 @@ public class MobAI {
|
|||||||
msg.setUnknown04(2);
|
msg.setUnknown04(2);
|
||||||
|
|
||||||
PowersManager.finishUseMobPower(msg, mob, 0, 0);
|
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;
|
mob.nextCastTime = System.currentTimeMillis() + randomCooldown;
|
||||||
return true;
|
return true;
|
||||||
@@ -422,64 +453,10 @@ public class MobAI {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean GuardCast(Mob mob) {
|
private static int getGuardPowerRank(Mob mob) {
|
||||||
|
|
||||||
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;
|
int powerRank = 1;
|
||||||
|
|
||||||
switch(mob.getRank()){
|
switch (mob.getRank()) {
|
||||||
case 1:
|
case 1:
|
||||||
powerRank = 10;
|
powerRank = 10;
|
||||||
break;
|
break;
|
||||||
@@ -502,47 +479,7 @@ public class MobAI {
|
|||||||
powerRank = 40;
|
powerRank = 40;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return powerRank;
|
||||||
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());
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void MobCallForHelp(Mob mob) {
|
public static void MobCallForHelp(Mob mob) {
|
||||||
@@ -606,9 +543,9 @@ public class MobAI {
|
|||||||
|
|
||||||
//override for guards
|
//override for guards
|
||||||
|
|
||||||
if (mob.despawned && mob.isPlayerGuard) {
|
if (mob.despawned && mob.isPlayerGuard()) {
|
||||||
|
|
||||||
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardMinion)) {
|
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION)) {
|
||||||
if (mob.guardCaptain.isAlive() == false || ((Mob) mob.guardCaptain).despawned == true) {
|
if (mob.guardCaptain.isAlive() == false || ((Mob) mob.guardCaptain).despawned == true) {
|
||||||
|
|
||||||
//minions don't respawn while guard captain is dead
|
//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
|
//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);
|
CheckToSendMobHome(mob);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -641,12 +578,12 @@ public class MobAI {
|
|||||||
//no players loaded, no need to proceed
|
//no players loaded, no need to proceed
|
||||||
|
|
||||||
if (mob.playerAgroMap.isEmpty()) {
|
if (mob.playerAgroMap.isEmpty()) {
|
||||||
if(mob.getCombatTarget() != null)
|
if (mob.getCombatTarget() != null)
|
||||||
mob.setCombatTarget(null);
|
mob.setCombatTarget(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mob.behaviourType.equals(Enum.MobBehaviourType.Pet1) == false)
|
if (mob.agentType.equals(Enum.AIAgentType.PET) == false)
|
||||||
CheckToSendMobHome(mob);
|
CheckToSendMobHome(mob);
|
||||||
|
|
||||||
if (mob.getCombatTarget() != null) {
|
if (mob.getCombatTarget() != null) {
|
||||||
@@ -675,10 +612,8 @@ public class MobAI {
|
|||||||
|
|
||||||
switch (mob.behaviourType) {
|
switch (mob.behaviourType) {
|
||||||
case GuardCaptain:
|
case GuardCaptain:
|
||||||
GuardCaptainLogic(mob);
|
|
||||||
break;
|
|
||||||
case GuardMinion:
|
case GuardMinion:
|
||||||
GuardMinionLogic(mob);
|
GuardLogic(mob);
|
||||||
break;
|
break;
|
||||||
case GuardWallArcher:
|
case GuardWallArcher:
|
||||||
GuardWallArcherLogic(mob);
|
GuardWallArcherLogic(mob);
|
||||||
@@ -748,7 +683,6 @@ public class MobAI {
|
|||||||
aiAgent.setCombatTarget(loadedPlayer);
|
aiAgent.setCombatTarget(loadedPlayer);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aiAgent.getCombatTarget() == null) {
|
if (aiAgent.getCombatTarget() == null) {
|
||||||
@@ -787,49 +721,41 @@ public class MobAI {
|
|||||||
|
|
||||||
case Pet1:
|
case Pet1:
|
||||||
|
|
||||||
|
if (mob.guardCaptain == null)
|
||||||
if ((PlayerCharacter) mob.guardCaptain == null)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
//mob no longer has its owner loaded, translate pet to owner
|
||||||
|
|
||||||
if (!mob.playerAgroMap.containsKey(((PlayerCharacter) mob.guardCaptain).getObjectUUID())) {
|
if (!mob.playerAgroMap.containsKey(mob.guardCaptain.getObjectUUID())) {
|
||||||
|
MovementManager.translocate(mob, mob.guardCaptain.getLoc(), null);
|
||||||
//mob no longer has its owner loaded, translocate pet to owner
|
|
||||||
|
|
||||||
|
|
||||||
MovementManager.translocate(mob, ((PlayerCharacter) mob.guardCaptain).getLoc(), null);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mob.getCombatTarget() == null) {
|
if (mob.getCombatTarget() == null) {
|
||||||
|
|
||||||
//move back to owner
|
//move back to owner
|
||||||
|
|
||||||
|
if (CombatUtilities.inRange2D(mob, mob.guardCaptain, 6))
|
||||||
if (CombatUtilities.inRange2D(mob, (PlayerCharacter) mob.guardCaptain, 6))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
mob.destination = mob.guardCaptain.getLoc();
|
||||||
mob.destination = ((PlayerCharacter) mob.guardCaptain).getLoc();
|
|
||||||
MovementUtilities.moveToLocation(mob, mob.destination, 5);
|
MovementUtilities.moveToLocation(mob, mob.destination, 5);
|
||||||
} else
|
} else
|
||||||
chaseTarget(mob);
|
chaseTarget(mob);
|
||||||
break;
|
break;
|
||||||
case GuardMinion:
|
|
||||||
if (!mob.guardCaptain.isAlive() || ((Mob) mob.guardCaptain).despawned)
|
|
||||||
randomGuardPatrolPoint(mob);
|
|
||||||
else {
|
|
||||||
if (mob.getCombatTarget() != null) {
|
|
||||||
chaseTarget(mob);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
if (mob.getCombatTarget() == null) {
|
if (mob.getCombatTarget() == null) {
|
||||||
if (!mob.isMoving())
|
|
||||||
|
if (!mob.isMoving()) {
|
||||||
|
|
||||||
|
// Minions only patrol on their own if captain is dead.
|
||||||
|
|
||||||
|
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION) == false)
|
||||||
Patrol(mob);
|
Patrol(mob);
|
||||||
else {
|
else if (mob.guardCaptain.isAlive() == false)
|
||||||
|
Patrol(mob);
|
||||||
|
} else
|
||||||
mob.stopPatrolTime = System.currentTimeMillis();
|
mob.stopPatrolTime = System.currentTimeMillis();
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
chaseTarget(mob);
|
chaseTarget(mob);
|
||||||
}
|
}
|
||||||
@@ -901,7 +827,7 @@ public class MobAI {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter) && MovementUtilities.inRangeDropAggro(mob, (PlayerCharacter) mob.getCombatTarget()) == false &&
|
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);
|
mob.setCombatTarget(null);
|
||||||
return;
|
return;
|
||||||
@@ -917,15 +843,6 @@ public class MobAI {
|
|||||||
private static void CheckToSendMobHome(Mob mob) {
|
private static void CheckToSendMobHome(Mob mob) {
|
||||||
|
|
||||||
try {
|
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))
|
if (mob.getCombatTarget() != null && CombatUtilities.inRange2D(mob, mob.getCombatTarget(), MobAIThread.AI_BASE_AGGRO_RANGE * 0.5f))
|
||||||
return;
|
return;
|
||||||
@@ -940,13 +857,15 @@ public class MobAI {
|
|||||||
PowersManager.useMobPower(mob, mob, recall, 40);
|
PowersManager.useMobPower(mob, mob, recall, 40);
|
||||||
mob.setCombatTarget(null);
|
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
|
//guard captain pulls his minions home with him
|
||||||
|
|
||||||
for (Entry<Mob, Integer> minion : mob.siegeMinionMap.entrySet()) {
|
for (Integer minionUUID : mob.minions) {
|
||||||
PowersManager.useMobPower(minion.getKey(), minion.getKey(), recall, 40);
|
Mob minion = Mob.getMob(minionUUID);
|
||||||
minion.getKey().setCombatTarget(null);
|
|
||||||
|
PowersManager.useMobPower(minion, minion, recall, 40);
|
||||||
|
minion.setCombatTarget(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -957,7 +876,7 @@ public class MobAI {
|
|||||||
mob.setCombatTarget(null);
|
mob.setCombatTarget(null);
|
||||||
|
|
||||||
for (Integer playerEntry : mob.playerAgroMap.keySet())
|
for (Integer playerEntry : mob.playerAgroMap.keySet())
|
||||||
mob.playerAgroMap.put(playerEntry,0f);
|
mob.playerAgroMap.put(playerEntry, 0f);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckToSendMobHome" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckToSendMobHome" + " " + e.getMessage());
|
||||||
@@ -968,13 +887,7 @@ public class MobAI {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
float rangeSquared = mob.getRange() * mob.getRange();
|
if (CombatUtilities.inRange2D(mob, mob.getCombatTarget(), mob.getRange()) == false) {
|
||||||
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 (mob.getRange() > 15) {
|
if (mob.getRange() > 15) {
|
||||||
mob.destination = mob.getCombatTarget().getLoc();
|
mob.destination = mob.getCombatTarget().getLoc();
|
||||||
MovementUtilities.moveToLocation(mob, mob.destination, 0);
|
MovementUtilities.moveToLocation(mob, mob.destination, 0);
|
||||||
@@ -1011,17 +924,17 @@ public class MobAI {
|
|||||||
|
|
||||||
//dont scan self.
|
//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;
|
continue;
|
||||||
|
|
||||||
Mob aggroMob = (Mob) awoMob;
|
Mob aggroMob = (Mob) awoMob;
|
||||||
|
|
||||||
//don't attack other guards
|
//don't attack other guards
|
||||||
|
|
||||||
if ((aggroMob.agentType.equals(Enum.AIAgentType.GUARD)))
|
if ((aggroMob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (aggroMob.behaviourType.equals(Enum.MobBehaviourType.Pet1))
|
if (aggroMob.agentType.equals(Enum.AIAgentType.PET))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (mob.getLoc().distanceSquared2D(aggroMob.getLoc()) > sqr(50))
|
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 {
|
try {
|
||||||
if (mob.getCombatTarget() == null)
|
if (mob.getCombatTarget() == null)
|
||||||
@@ -1055,41 +968,7 @@ public class MobAI {
|
|||||||
CheckMobMovement(mob);
|
CheckMobMovement(mob);
|
||||||
CheckForAttack(mob);
|
CheckForAttack(mob);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardCaptainLogic" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardLogic" + " " + 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());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1109,7 +988,6 @@ public class MobAI {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
if (mob.guardCaptain == null && mob.isNecroPet() == false && mob.isSiege() == false)
|
if (mob.guardCaptain == null && mob.isNecroPet() == false && mob.isSiege() == false)
|
||||||
if (ZoneManager.getSeaFloor().zoneMobSet.contains(mob))
|
if (ZoneManager.getSeaFloor().zoneMobSet.contains(mob))
|
||||||
mob.killCharacter("no owner");
|
mob.killCharacter("no owner");
|
||||||
@@ -1204,6 +1082,15 @@ public class MobAI {
|
|||||||
if (!mob.isAlive())
|
if (!mob.isAlive())
|
||||||
return;
|
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;
|
ConcurrentHashMap<Integer, Float> loadedPlayers = mob.playerAgroMap;
|
||||||
|
|
||||||
for (Entry playerEntry : loadedPlayers.entrySet()) {
|
for (Entry playerEntry : loadedPlayers.entrySet()) {
|
||||||
@@ -1249,17 +1136,12 @@ public class MobAI {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
if (mob.guardedCity.cityOutlaws.contains(target.getObjectUUID()) == true)
|
||||||
|
return true;
|
||||||
|
|
||||||
if (mob.getGuild().getNation().equals(target.getGuild().getNation()))
|
if (mob.getGuild().getNation().equals(target.getGuild().getNation()))
|
||||||
return false;
|
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)
|
//first check condemn list for aggro allowed (allies button is checked)
|
||||||
|
|
||||||
if (ZoneManager.getCityAtLocation(mob.getLoc()).getTOL().reverseKOS) {
|
if (ZoneManager.getCityAtLocation(mob.getLoc()).getTOL().reverseKOS) {
|
||||||
@@ -1337,17 +1219,19 @@ public class MobAI {
|
|||||||
|
|
||||||
MovementUtilities.aiMove(mob, mob.destination, true);
|
MovementUtilities.aiMove(mob, mob.destination, true);
|
||||||
|
|
||||||
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardCaptain)) {
|
if (mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN)) {
|
||||||
for (Entry<Mob, Integer> minion : mob.siegeMinionMap.entrySet()) {
|
for (Integer minionUUID : mob.minions) {
|
||||||
|
|
||||||
|
Mob minion = Mob.getMob(minionUUID);
|
||||||
|
|
||||||
//make sure mob is out of combat stance
|
//make sure mob is out of combat stance
|
||||||
|
|
||||||
if (minion.getKey().despawned == false) {
|
if (minion.despawned == false) {
|
||||||
if (MovementUtilities.canMove(minion.getKey())) {
|
if (MovementUtilities.canMove(minion)) {
|
||||||
Vector3f minionOffset = Formation.getOffset(2, minion.getValue() + 3);
|
Vector3f minionOffset = Formation.getOffset(2, mob.minions.indexOf(minionUUID) + 3);
|
||||||
minion.getKey().updateLocation();
|
minion.updateLocation();
|
||||||
Vector3fImmutable formationPatrolPoint = new Vector3fImmutable(mob.destination.x + minionOffset.x, mob.destination.y, mob.destination.z + minionOffset.z);
|
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
|
* Dispatch Message is the main interface to Magicbane's threaded
|
||||||
* asynch message delivery system.
|
* async message delivery system.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class DispatchMessage {
|
public class DispatchMessage {
|
||||||
|
|||||||
@@ -15,9 +15,6 @@ import engine.net.client.msg.*;
|
|||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @Author:
|
* @Author:
|
||||||
* @Summary: Processes application protocol message which
|
* @Summary: Processes application protocol message which
|
||||||
@@ -26,8 +23,6 @@ import java.util.HashMap;
|
|||||||
|
|
||||||
public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
||||||
|
|
||||||
public static HashMap<Integer, ArrayList<Integer>> _minionsByCaptain = null;
|
|
||||||
|
|
||||||
public MinionTrainingMsgHandler() {
|
public MinionTrainingMsgHandler() {
|
||||||
super(MinionTrainingMessage.class);
|
super(MinionTrainingMessage.class);
|
||||||
}
|
}
|
||||||
@@ -37,10 +32,11 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
MinionTrainingMessage minionMsg = (MinionTrainingMessage) baseMsg;
|
MinionTrainingMessage minionMsg = (MinionTrainingMessage) baseMsg;
|
||||||
|
|
||||||
PlayerCharacter player = SessionManager.getPlayerCharacter(origin);
|
PlayerCharacter playerCharacter = SessionManager.getPlayerCharacter(origin);
|
||||||
|
|
||||||
if (player == null)
|
if (playerCharacter == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (minionMsg.getNpcType() == Enum.GameObjectType.NPC.ordinal()) {
|
if (minionMsg.getNpcType() == Enum.GameObjectType.NPC.ordinal()) {
|
||||||
|
|
||||||
NPC npc = NPC.getFromCache(minionMsg.getNpcID());
|
NPC npc = NPC.getFromCache(minionMsg.getNpcID());
|
||||||
@@ -48,23 +44,24 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (npc == null)
|
if (npc == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
Building b = BuildingManager.getBuildingFromCache(minionMsg.getBuildingID());
|
Building building = BuildingManager.getBuildingFromCache(minionMsg.getBuildingID());
|
||||||
|
|
||||||
if (b == null)
|
if (building == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
//clear minion
|
//clear minion
|
||||||
|
|
||||||
if (npc.minionLock.writeLock().tryLock()) {
|
if (npc.minionLock.writeLock().tryLock()) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (minionMsg.getType() == 2) {
|
if (minionMsg.getType() == 2) {
|
||||||
|
|
||||||
Mob toRemove = Mob.getFromCache(minionMsg.getUUID());
|
Mob toRemove = Mob.getFromCache(minionMsg.getUUID());
|
||||||
|
|
||||||
if (!npc.siegeMinionMap.containsKey(toRemove))
|
if (!npc.minions.contains(toRemove.getObjectUUID()))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
npc.siegeMinionMap.remove(toRemove);
|
npc.minions.remove(Integer.valueOf(toRemove.getObjectUUID()));
|
||||||
|
|
||||||
WorldGrid.RemoveWorldObject(toRemove);
|
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(playerCharacter, building);
|
||||||
|
|
||||||
ManageCityAssetsMsg mca1 = new ManageCityAssetsMsg(player, b);
|
|
||||||
mca1.actionType = 3;
|
mca1.actionType = 3;
|
||||||
mca1.setTargetType(b.getObjectType().ordinal());
|
mca1.setTargetType(building.getObjectType().ordinal());
|
||||||
mca1.setTargetID(b.getObjectUUID());
|
mca1.setTargetID(building.getObjectUUID());
|
||||||
|
|
||||||
mca1.setTargetType3(npc.getObjectType().ordinal());
|
mca1.setTargetType3(npc.getObjectType().ordinal());
|
||||||
mca1.setTargetID3(npc.getObjectUUID());
|
mca1.setTargetID3(npc.getObjectUUID());
|
||||||
mca1.setAssetName1(b.getName());
|
mca1.setAssetName1(building.getName());
|
||||||
mca1.setUnknown54(1);
|
mca1.setUnknown54(1);
|
||||||
|
|
||||||
Dispatch dispatch = Dispatch.borrow(player, mca1);
|
Dispatch dispatch = Dispatch.borrow(playerCharacter, mca1);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
||||||
dispatch = Dispatch.borrow(player, mnm);
|
dispatch = Dispatch.borrow(playerCharacter, mnm);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
//Add Minion
|
//Add Minion
|
||||||
@@ -117,7 +112,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (npc.getContractID() == 842)
|
if (npc.getContractID() == 842)
|
||||||
maxSlots = 1;
|
maxSlots = 1;
|
||||||
|
|
||||||
if (npc.siegeMinionMap.size() == maxSlots)
|
if (npc.minions.size() == maxSlots)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
int mobBase;
|
int mobBase;
|
||||||
@@ -156,7 +151,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
||||||
mnm.setMessageType(1);
|
mnm.setMessageType(1);
|
||||||
Dispatch dispatch = Dispatch.borrow(player, mnm);
|
Dispatch dispatch = Dispatch.borrow(playerCharacter, mnm);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
@@ -184,13 +179,13 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
Mob toRemove = Mob.getFromCache(minionMsg.getUUID());
|
Mob toRemove = Mob.getFromCache(minionMsg.getUUID());
|
||||||
|
|
||||||
if (!npc.getSiegeMinionMap().containsKey(toRemove))
|
if (!npc.minions.contains(toRemove.getObjectUUID()))
|
||||||
return true;
|
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;
|
return true;
|
||||||
|
|
||||||
npc.getSiegeMinionMap().remove(toRemove);
|
npc.minions.remove(Integer.valueOf(toRemove.getObjectUUID()));
|
||||||
|
|
||||||
WorldGrid.RemoveWorldObject(toRemove);
|
WorldGrid.RemoveWorldObject(toRemove);
|
||||||
|
|
||||||
@@ -199,19 +194,21 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
DbManager.removeFromCache(toRemove);
|
DbManager.removeFromCache(toRemove);
|
||||||
|
|
||||||
|
if (toRemove.agentType.equals(Enum.AIAgentType.SIEGEENGINE)) {
|
||||||
|
|
||||||
PlayerCharacter petOwner = (PlayerCharacter) toRemove.guardCaptain;
|
PlayerCharacter trebOwner = (PlayerCharacter) toRemove.guardCaptain;
|
||||||
|
|
||||||
if (petOwner != null) {
|
if (trebOwner != null) {
|
||||||
petOwner.setPet(null);
|
trebOwner.setPet(null);
|
||||||
|
|
||||||
toRemove.guardCaptain = null;
|
toRemove.guardCaptain = null;
|
||||||
PetMsg petMsg = new PetMsg(5, null);
|
PetMsg petMsg = new PetMsg(5, null);
|
||||||
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
|
Dispatch dispatch = Dispatch.borrow(trebOwner, petMsg);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ManageCityAssetsMsg mca1 = new ManageCityAssetsMsg(player, building);
|
ManageCityAssetsMsg mca1 = new ManageCityAssetsMsg(playerCharacter, building);
|
||||||
mca1.actionType = 3;
|
mca1.actionType = 3;
|
||||||
mca1.setTargetType(building.getObjectType().ordinal());
|
mca1.setTargetType(building.getObjectType().ordinal());
|
||||||
mca1.setTargetID(building.getObjectUUID());
|
mca1.setTargetID(building.getObjectUUID());
|
||||||
@@ -221,11 +218,11 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
mca1.setAssetName1(building.getName());
|
mca1.setAssetName1(building.getName());
|
||||||
mca1.setUnknown54(1);
|
mca1.setUnknown54(1);
|
||||||
|
|
||||||
Dispatch dispatch = Dispatch.borrow(player, mca1);
|
Dispatch dispatch = Dispatch.borrow(playerCharacter, mca1);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
||||||
dispatch = Dispatch.borrow(player, mnm);
|
dispatch = Dispatch.borrow(playerCharacter, mnm);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
//Add Minion
|
//Add Minion
|
||||||
@@ -261,7 +258,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (npc.getSiegeMinionMap().size() == maxSlots)
|
if (npc.minions.size() == maxSlots)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
int mobBase = npc.getMobBaseID();
|
int mobBase = npc.getMobBaseID();
|
||||||
@@ -276,7 +273,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (toCreate == null)
|
if (toCreate == null)
|
||||||
return true;
|
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;
|
return true;
|
||||||
|
|
||||||
if (toCreate != null) {
|
if (toCreate != null) {
|
||||||
@@ -287,7 +284,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
||||||
mnm.setMessageType(1);
|
mnm.setMessageType(1);
|
||||||
Dispatch dispatch = Dispatch.borrow(player, mnm);
|
Dispatch dispatch = Dispatch.borrow(playerCharacter, mnm);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ import org.pmw.tinylog.Logger;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -96,7 +95,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|||||||
writer.putString("A weapon suited to laying siege");
|
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);
|
writer.putInt(1);
|
||||||
|
|
||||||
@@ -106,7 +105,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|||||||
writer.putInt(minion);
|
writer.putInt(minion);
|
||||||
writer.putInt(1);
|
writer.putInt(1);
|
||||||
writer.putInt(minion);
|
writer.putInt(minion);
|
||||||
writer.putInt(1);
|
writer.putInt(captain.getRank());//minion rank
|
||||||
writer.put((byte) 0);
|
writer.put((byte) 0);
|
||||||
|
|
||||||
writer.putInt(600); //roll time
|
writer.putInt(600); //roll time
|
||||||
@@ -343,14 +342,17 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|||||||
writer.putInt(0); //runemaster list
|
writer.putInt(0); //runemaster list
|
||||||
|
|
||||||
//artillery captain 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, 1); //Trebuchet
|
||||||
//serializeBulwarkList(writer, 2); //Ballista
|
//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();
|
this.unknown83 = mob.getObjectUUID();
|
||||||
writer.putInt(2);
|
writer.putInt(2);
|
||||||
writer.putInt(mob.getObjectType().ordinal());
|
writer.putInt(mob.getObjectType().ordinal());
|
||||||
@@ -666,14 +668,15 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|||||||
writer.putInt(0); //runemaster list
|
writer.putInt(0); //runemaster list
|
||||||
|
|
||||||
//artillery captain list
|
//artillery captain list
|
||||||
ConcurrentHashMap<Mob, Integer> siegeMinions = mobA.getSiegeMinionMap();
|
|
||||||
|
|
||||||
writer.putInt(siegeMinions.size() + 1);
|
writer.putInt(mobA.minions.size() + 1);
|
||||||
serializeGuardList(writer, mobA.getContract().getContractID()); //Guard
|
|
||||||
|
|
||||||
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();
|
this.unknown83 = mob.getObjectUUID();
|
||||||
writer.putInt(2);
|
writer.putInt(2);
|
||||||
writer.putInt(mob.getObjectType().ordinal());
|
writer.putInt(mob.getObjectType().ordinal());
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import java.sql.SQLException;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||||
@@ -71,7 +72,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
public Guild guild;
|
public Guild guild;
|
||||||
protected byte runningTrains;
|
protected byte runningTrains;
|
||||||
protected ConcurrentHashMap<Integer, CharacterPower> powers;
|
protected ConcurrentHashMap<Integer, CharacterPower> powers;
|
||||||
protected ConcurrentHashMap<String, CharacterSkill> skills;
|
public ConcurrentHashMap<String, CharacterSkill> skills;
|
||||||
// Variables NOT to be stored in db
|
// Variables NOT to be stored in db
|
||||||
protected boolean sit = false;
|
protected boolean sit = false;
|
||||||
protected boolean walkMode;
|
protected boolean walkMode;
|
||||||
@@ -88,7 +89,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
protected AtomicFloat mana = new AtomicFloat();
|
protected AtomicFloat mana = new AtomicFloat();
|
||||||
protected float manaMax; // Health/Mana/Stamina
|
protected float manaMax; // Health/Mana/Stamina
|
||||||
protected AtomicBoolean isAlive = new AtomicBoolean(true);
|
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, JobContainer> timers;
|
||||||
protected ConcurrentHashMap<String, Long> timestamps;
|
protected ConcurrentHashMap<String, Long> timestamps;
|
||||||
protected int atrHandOne;
|
protected int atrHandOne;
|
||||||
@@ -119,7 +120,9 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
private long takeOffTime = 0;
|
private long takeOffTime = 0;
|
||||||
private long lastHateUpdate = 0;
|
private long lastHateUpdate = 0;
|
||||||
private byte aoecntr = 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() {
|
public AbstractCharacter() {
|
||||||
super();
|
super();
|
||||||
@@ -1104,6 +1107,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final void setCombatTarget(final AbstractWorldObject value) {
|
public final void setCombatTarget(final AbstractWorldObject value) {
|
||||||
|
|
||||||
if(this.getObjectTypeMask() == 2050) {//MOB?
|
if(this.getObjectTypeMask() == 2050) {//MOB?
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
if (this.isCombat()) {
|
if (this.isCombat()) {
|
||||||
@@ -1121,7 +1125,9 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.combatTarget = value;
|
this.combatTarget = value;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final ConcurrentHashMap<String, JobContainer> getTimers() {
|
public final ConcurrentHashMap<String, JobContainer> getTimers() {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
|
|||||||
protected Vector3fImmutable lastBindLoc;
|
protected Vector3fImmutable lastBindLoc;
|
||||||
public boolean assist = false;
|
public boolean assist = false;
|
||||||
public Enum.AIAgentType agentType = Enum.AIAgentType.MOBILE;
|
public Enum.AIAgentType agentType = Enum.AIAgentType.MOBILE;
|
||||||
public boolean isPlayerGuard = false;
|
|
||||||
public AbstractCharacter guardCaptain;
|
public AbstractCharacter guardCaptain;
|
||||||
public EnumBitSet<Enum.MonsterType> notEnemy = EnumBitSet.noneOf(Enum.MonsterType.class);
|
public EnumBitSet<Enum.MonsterType> notEnemy = EnumBitSet.noneOf(Enum.MonsterType.class);
|
||||||
public EnumBitSet<Enum.MonsterType> enemy = EnumBitSet.noneOf(Enum.MonsterType.class);
|
public EnumBitSet<Enum.MonsterType> enemy = EnumBitSet.noneOf(Enum.MonsterType.class);
|
||||||
@@ -163,7 +163,9 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
|
|||||||
this.setCombatTarget(null);
|
this.setCombatTarget(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
//clear owner
|
// clear owner and set not alive
|
||||||
|
|
||||||
|
this.isAlive.set(false);
|
||||||
|
|
||||||
PlayerCharacter owner = (PlayerCharacter) this.guardCaptain;
|
PlayerCharacter owner = (PlayerCharacter) this.guardCaptain;
|
||||||
|
|
||||||
@@ -181,7 +183,7 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
|
|||||||
owner.setPet(null);
|
owner.setPet(null);
|
||||||
|
|
||||||
if (this.getObjectType().equals(GameObjectType.Mob))
|
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.numTrains.set(0);
|
||||||
this.ownerUID = pc.getObjectUUID();
|
this.ownerUID = pc.getObjectUUID();
|
||||||
calculateBaseAmount();
|
calculateBaseAmount();
|
||||||
calculateModifiedAmount();
|
calculateModifiedAmount(false);
|
||||||
this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken());
|
this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,7 +238,7 @@ public class CharacterSkill extends AbstractGameObject {
|
|||||||
this.ownerUID = pc.getObjectUUID();
|
this.ownerUID = pc.getObjectUUID();
|
||||||
this.trained = true;
|
this.trained = true;
|
||||||
calculateBaseAmount();
|
calculateBaseAmount();
|
||||||
calculateModifiedAmount();
|
calculateModifiedAmount(false);
|
||||||
this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken());
|
this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken());
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -254,7 +254,7 @@ public class CharacterSkill extends AbstractGameObject {
|
|||||||
this.numTrains.set(rs.getShort("trains"));
|
this.numTrains.set(rs.getShort("trains"));
|
||||||
this.ownerUID = pc.getObjectUUID();
|
this.ownerUID = pc.getObjectUUID();
|
||||||
calculateBaseAmount();
|
calculateBaseAmount();
|
||||||
calculateModifiedAmount();
|
calculateModifiedAmount(false);
|
||||||
this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken());
|
this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -264,8 +264,9 @@ public class CharacterSkill extends AbstractGameObject {
|
|||||||
this.numTrains.set(trains);
|
this.numTrains.set(trains);
|
||||||
this.ownerUID = mob.getObjectUUID();
|
this.ownerUID = mob.getObjectUUID();
|
||||||
this.isMobOwner = true;
|
this.isMobOwner = true;
|
||||||
calculateMobBaseAmount();
|
boolean isGuard = mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN) || mob.agentType.equals(Enum.AIAgentType.GUARDMINION);
|
||||||
calculateModifiedAmount();
|
calculateMobBaseAmount(isGuard);
|
||||||
|
calculateModifiedAmount(isGuard);
|
||||||
this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken());
|
this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,7 +278,7 @@ public class CharacterSkill extends AbstractGameObject {
|
|||||||
this.ownerUID = rs.getInt("CharacterID");
|
this.ownerUID = rs.getInt("CharacterID");
|
||||||
// this.owner = DbManager.PlayerCharacterQueries.GET_PLAYER_CHARACTER(rs.getInt("CharacterID"));
|
// this.owner = DbManager.PlayerCharacterQueries.GET_PLAYER_CHARACTER(rs.getInt("CharacterID"));
|
||||||
calculateBaseAmount();
|
calculateBaseAmount();
|
||||||
calculateModifiedAmount();
|
calculateModifiedAmount(false);
|
||||||
this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken());
|
this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -370,7 +371,7 @@ public class CharacterSkill extends AbstractGameObject {
|
|||||||
String name = it.next();
|
String name = it.next();
|
||||||
CharacterSkill cs = skills.get(name);
|
CharacterSkill cs = skills.get(name);
|
||||||
if (cs != null)
|
if (cs != null)
|
||||||
cs.calculateModifiedAmount();
|
cs.calculateModifiedAmount(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -756,7 +757,7 @@ public class CharacterSkill extends AbstractGameObject {
|
|||||||
|
|
||||||
//recalculate this skill
|
//recalculate this skill
|
||||||
calculateBaseAmount();
|
calculateBaseAmount();
|
||||||
calculateModifiedAmount();
|
calculateModifiedAmount(false);
|
||||||
|
|
||||||
//see if any new skills or powers granted
|
//see if any new skills or powers granted
|
||||||
pc.calculateSkills();
|
pc.calculateSkills();
|
||||||
@@ -848,7 +849,7 @@ public class CharacterSkill extends AbstractGameObject {
|
|||||||
if (recalculate) {
|
if (recalculate) {
|
||||||
//recalculate this skill
|
//recalculate this skill
|
||||||
calculateBaseAmount();
|
calculateBaseAmount();
|
||||||
calculateModifiedAmount();
|
calculateModifiedAmount(false);
|
||||||
|
|
||||||
//see if any skills or powers removed
|
//see if any skills or powers removed
|
||||||
pc.calculateSkills();
|
pc.calculateSkills();
|
||||||
@@ -887,7 +888,7 @@ public class CharacterSkill extends AbstractGameObject {
|
|||||||
if (recalculate) {
|
if (recalculate) {
|
||||||
//recalculate this skill
|
//recalculate this skill
|
||||||
calculateBaseAmount();
|
calculateBaseAmount();
|
||||||
calculateModifiedAmount();
|
calculateModifiedAmount(false);
|
||||||
|
|
||||||
//see if any skills or powers removed
|
//see if any skills or powers removed
|
||||||
pc.calculateSkills();
|
pc.calculateSkills();
|
||||||
@@ -1016,7 +1017,8 @@ public class CharacterSkill extends AbstractGameObject {
|
|||||||
this.modifiedAmountBeforeMods = Math.round(this.baseAmountBeforeMods + calculateAmountAfterTrains());
|
this.modifiedAmountBeforeMods = Math.round(this.baseAmountBeforeMods + calculateAmountAfterTrains());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void calculateMobBaseAmount() {
|
public void calculateMobBaseAmount(boolean isGuard) {
|
||||||
|
if(!isGuard) {
|
||||||
if (CharacterSkill.GetOwner(this) == null) {
|
if (CharacterSkill.GetOwner(this) == null) {
|
||||||
Logger.error("owner not found for owner uuid : " + this.ownerUID);
|
Logger.error("owner not found for owner uuid : " + this.ownerUID);
|
||||||
this.baseAmount = 1;
|
this.baseAmount = 1;
|
||||||
@@ -1030,19 +1032,19 @@ public class CharacterSkill extends AbstractGameObject {
|
|||||||
this.modifiedAmount = 1;
|
this.modifiedAmount = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//Get any rune bonus
|
//Get any rune bonus
|
||||||
float bonus = 0f;
|
float bonus = 0f;
|
||||||
//TODO SKILLS RUNES
|
//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 base = 7f;
|
||||||
float statMod = 0.5f;
|
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)
|
if (this.skillsBase.getStrMod() > 0)
|
||||||
statMod += (float) this.skillsBase.getStrMod() * (float) ((Mob) CharacterSkill.GetOwner(this)).getMobBase().getMobBaseStats().getBaseStr() / 100f;
|
statMod += (float) this.skillsBase.getStrMod() * (float) ((Mob) CharacterSkill.GetOwner(this)).getMobBase().getMobBaseStats().getBaseStr() / 100f;
|
||||||
if (this.skillsBase.getDexMod() > 0)
|
if (this.skillsBase.getDexMod() > 0)
|
||||||
@@ -1057,6 +1059,7 @@ public class CharacterSkill extends AbstractGameObject {
|
|||||||
statMod = 1f;
|
statMod = 1f;
|
||||||
else if (statMod > 600)
|
else if (statMod > 600)
|
||||||
statMod = 600f;
|
statMod = 600f;
|
||||||
|
}
|
||||||
base += CharacterSkill.baseSkillValues[(int) statMod];
|
base += CharacterSkill.baseSkillValues[(int) statMod];
|
||||||
|
|
||||||
if (base + bonus < 1f)
|
if (base + bonus < 1f)
|
||||||
@@ -1066,25 +1069,27 @@ public class CharacterSkill extends AbstractGameObject {
|
|||||||
this.modifiedAmountBeforeMods = (int) (this.baseAmountBeforeMods + calculateAmountAfterTrains());
|
this.modifiedAmountBeforeMods = (int) (this.baseAmountBeforeMods + calculateAmountAfterTrains());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void calculateModifiedAmount() {
|
public void calculateModifiedAmount(boolean isGuard) {
|
||||||
|
if(!isGuard) {
|
||||||
if (CharacterSkill.GetOwner(this) == null || this.skillsBase == null) {
|
if (CharacterSkill.GetOwner(this) == null || this.skillsBase == null) {
|
||||||
Logger.error("owner or SkillsBase not found for skill " + this.getObjectUUID());
|
Logger.error("owner or SkillsBase not found for skill " + this.getObjectUUID());
|
||||||
this.baseAmount = 1;
|
this.baseAmount = 1;
|
||||||
this.modifiedAmount = 1;
|
this.modifiedAmount = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//Get any rune bonus
|
//Get any rune bonus
|
||||||
float bonus = 0f;
|
float bonus = 0f;
|
||||||
if (CharacterSkill.GetOwner(this).getBonuses() != null) {
|
float base = 7f;
|
||||||
|
float statMod = 0.5f;
|
||||||
|
if (CharacterSkill.GetOwner(this) != null && CharacterSkill.GetOwner(this).getBonuses() != null) {
|
||||||
//Get bonuses from runes
|
//Get bonuses from runes
|
||||||
bonus = CharacterSkill.GetOwner(this).getBonuses().getSkillBonus(this.skillsBase.sourceType);
|
bonus = CharacterSkill.GetOwner(this).getBonuses().getSkillBonus(this.skillsBase.sourceType);
|
||||||
}
|
|
||||||
|
|
||||||
//Get Base skill for modified stats
|
//Get Base skill for modified stats
|
||||||
//TODO this fomula needs verified
|
//TODO this fomula needs verified
|
||||||
float base = 7f;
|
|
||||||
float statMod = 0.5f;
|
|
||||||
if (this.skillsBase.getStrMod() > 0)
|
if (this.skillsBase.getStrMod() > 0)
|
||||||
statMod += (float) this.skillsBase.getStrMod() * (float) CharacterSkill.GetOwner(this).getStatStrCurrent() / 100f;
|
statMod += (float) this.skillsBase.getStrMod() * (float) CharacterSkill.GetOwner(this).getStatStrCurrent() / 100f;
|
||||||
if (this.skillsBase.getDexMod() > 0)
|
if (this.skillsBase.getDexMod() > 0)
|
||||||
@@ -1099,12 +1104,13 @@ public class CharacterSkill extends AbstractGameObject {
|
|||||||
statMod = 1f;
|
statMod = 1f;
|
||||||
else if (statMod > 600)
|
else if (statMod > 600)
|
||||||
statMod = 600f;
|
statMod = 600f;
|
||||||
|
}
|
||||||
base += CharacterSkill.baseSkillValues[(int) statMod];
|
base += CharacterSkill.baseSkillValues[(int) statMod];
|
||||||
SourceType sourceType = SourceType.GetSourceType(this.skillsBase.getNameNoSpace());
|
SourceType sourceType = SourceType.GetSourceType(this.skillsBase.getNameNoSpace());
|
||||||
|
|
||||||
//Get any rune, effect and item bonus
|
//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
|
//add bonuses from effects/items and runes
|
||||||
base += bonus + CharacterSkill.GetOwner(this).getBonuses().getFloat(ModType.Skill, sourceType);
|
base += bonus + CharacterSkill.GetOwner(this).getBonuses().getFloat(ModType.Skill, sourceType);
|
||||||
}
|
}
|
||||||
@@ -1116,7 +1122,7 @@ public class CharacterSkill extends AbstractGameObject {
|
|||||||
|
|
||||||
float modAmount = this.baseAmount + calculateAmountAfterTrains();
|
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
|
//Multiply any percent bonuses
|
||||||
modAmount *= (1 + CharacterSkill.GetOwner(this).getBonuses().getFloatPercentAll(ModType.Skill, sourceType));
|
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));
|
Thread destroyCityThread = new Thread(new DestroyCityThread(this));
|
||||||
|
|
||||||
destroyCityThread.setName("deestroyCity:" + this.getName());
|
destroyCityThread.setName("destroyCity:" + this.getName());
|
||||||
destroyCityThread.start();
|
destroyCityThread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+99
-121
@@ -20,20 +20,20 @@ import engine.jobs.DeferredPowerJob;
|
|||||||
import engine.jobs.UpgradeNPCJob;
|
import engine.jobs.UpgradeNPCJob;
|
||||||
import engine.math.Bounds;
|
import engine.math.Bounds;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
|
import engine.mobileAI.utilities.MovementUtilities;
|
||||||
import engine.net.ByteBufferWriter;
|
import engine.net.ByteBufferWriter;
|
||||||
import engine.net.Dispatch;
|
import engine.net.Dispatch;
|
||||||
import engine.net.DispatchMessage;
|
import engine.net.DispatchMessage;
|
||||||
import engine.net.client.msg.PetMsg;
|
import engine.net.client.msg.PetMsg;
|
||||||
import engine.net.client.msg.PlaceAssetMsg;
|
import engine.net.client.msg.PlaceAssetMsg;
|
||||||
import engine.powers.MobPowerEntry;
|
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.util.EnumSet;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||||
|
|
||||||
@@ -51,7 +51,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
public ReentrantReadWriteLock minionLock = new ReentrantReadWriteLock();
|
public ReentrantReadWriteLock minionLock = new ReentrantReadWriteLock();
|
||||||
public boolean despawned = false;
|
public boolean despawned = false;
|
||||||
public Vector3fImmutable destination = Vector3fImmutable.ZERO;
|
public Vector3fImmutable destination = Vector3fImmutable.ZERO;
|
||||||
public LinkedHashMap<Integer, Integer> mobPowers = new LinkedHashMap<>();
|
|
||||||
public MobBase mobBase;
|
public MobBase mobBase;
|
||||||
public int spawnTime;
|
public int spawnTime;
|
||||||
public Zone parentZone;
|
public Zone parentZone;
|
||||||
@@ -65,15 +64,13 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
public float spawnRadius;
|
public float spawnRadius;
|
||||||
//used by static mobs
|
//used by static mobs
|
||||||
public int parentZoneUUID;
|
public int parentZoneUUID;
|
||||||
protected int dbID; //the database ID
|
|
||||||
|
|
||||||
private int currentID;
|
|
||||||
|
|
||||||
//TODO implement feared object system
|
//TODO implement feared object system
|
||||||
public AbstractWorldObject fearedObject = null;
|
public AbstractWorldObject fearedObject = null;
|
||||||
|
protected int dbID; //the database ID
|
||||||
|
private int currentID;
|
||||||
private long lastAttackTime = 0;
|
private long lastAttackTime = 0;
|
||||||
private int lastMobPowerToken = 0;
|
private int lastMobPowerToken = 0;
|
||||||
private HashMap<Integer, MobEquipment> equip = null;
|
public HashMap<Integer, MobEquipment> equip = null;
|
||||||
private DeferredPowerJob weaponPower;
|
private DeferredPowerJob weaponPower;
|
||||||
private DateTime upgradeDateTime = null;
|
private DateTime upgradeDateTime = null;
|
||||||
private boolean lootSync = false;
|
private boolean lootSync = false;
|
||||||
@@ -105,6 +102,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
this.dbID = rs.getInt(1);
|
this.dbID = rs.getInt(1);
|
||||||
this.loadID = rs.getInt("mob_mobbaseID");
|
this.loadID = rs.getInt("mob_mobbaseID");
|
||||||
this.gridObjectType = GridObjectType.DYNAMIC;
|
this.gridObjectType = GridObjectType.DYNAMIC;
|
||||||
|
this.agentType = AIAgentType.MOBILE;
|
||||||
|
|
||||||
this.spawnRadius = rs.getFloat("mob_spawnRadius");
|
this.spawnRadius = rs.getFloat("mob_spawnRadius");
|
||||||
this.spawnTime = rs.getInt("mob_spawnTime");
|
this.spawnTime = rs.getInt("mob_spawnTime");
|
||||||
@@ -153,7 +151,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
|
|
||||||
this.currentID = this.dbID;
|
this.currentID = this.dbID;
|
||||||
|
|
||||||
this.agentType = AIAgentType.MOBILE;
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(e + " " + this.dbID);
|
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
|
} else if (tid == 100962 || tid == 100965) { //Spydraxxx the Mighty, Denigo Tantric
|
||||||
writer.putInt(2);
|
writer.putInt(2);
|
||||||
serializeRune(mob, writer, 5, GameObjectType.NPCClassRuneTwo.ordinal(), 252621); //guard rune
|
serializeRune(mob, writer, 5, GameObjectType.NPCClassRuneTwo.ordinal(), 252621); //guard rune
|
||||||
} else if (mob.contract != null || mob.isPlayerGuard) {
|
} else if (mob.contract != null || mob.isPlayerGuard()) {
|
||||||
writer.putInt(3);
|
writer.putInt(3);
|
||||||
serializeRune(mob, writer, 3, GameObjectType.NPCClassRuneTwo.ordinal(), MobBase.GetClassType(mob.getMobBaseID())); //warrior class
|
serializeRune(mob, writer, 3, GameObjectType.NPCClassRuneTwo.ordinal(), MobBase.GetClassType(mob.getMobBaseID())); //warrior class
|
||||||
serializeRune(mob, writer, 5, GameObjectType.NPCClassRuneThree.ordinal(), 252621); //guard rune
|
serializeRune(mob, writer, 5, GameObjectType.NPCClassRuneThree.ordinal(), 252621); //guard rune
|
||||||
@@ -316,13 +313,13 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
writer.put((byte) 1);
|
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 {
|
} else {
|
||||||
writer.putInt(0); //ownerType
|
writer.putInt(0); //ownerType
|
||||||
writer.putInt(0); //ownerID
|
writer.putInt(0); //ownerID
|
||||||
@@ -340,7 +337,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
writer.putInt(0);
|
writer.putInt(0);
|
||||||
writer.putInt(0);
|
writer.putInt(0);
|
||||||
|
|
||||||
if (!mob.isAlive() && !mob.isPet() && !mob.isNecroPet() && !mob.behaviourType.equals(MobBehaviourType.SiegeEngine) && !mob.isPlayerGuard) {
|
if (!mob.isAlive() && !mob.isPet() && !mob.isNecroPet() && !mob.behaviourType.equals(MobBehaviourType.SiegeEngine) && !mob.isPlayerGuard()) {
|
||||||
writer.putInt(0);
|
writer.putInt(0);
|
||||||
writer.putInt(0);
|
writer.putInt(0);
|
||||||
}
|
}
|
||||||
@@ -401,10 +398,13 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
writer.putInt(mob.currentID);
|
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();
|
Mob mobile = new Mob();
|
||||||
mobile.dbID = MBServerStatics.NO_DB_ROW_ASSIGNED_YET;
|
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.loadID = loadID;
|
||||||
mobile.level = (short) level;
|
mobile.level = (short) level;
|
||||||
|
|
||||||
@@ -428,18 +428,8 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
else
|
else
|
||||||
mobile.contractUUID = contract.getContractID();
|
mobile.contractUUID = contract.getContractID();
|
||||||
|
|
||||||
Mob mob;
|
|
||||||
|
|
||||||
mobile.agentType = AIAgentType.GUARD;
|
return mobile;
|
||||||
try {
|
|
||||||
mob = DbManager.MobQueries.PERSIST(mobile);
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.error("SQLException:" + e.getMessage());
|
|
||||||
mob = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return mob;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static synchronized Mob createGuardMinion(Mob guardCaptain, short level, String minionName) {
|
public static synchronized Mob createGuardMinion(Mob guardCaptain, short level, String minionName) {
|
||||||
@@ -463,8 +453,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
minionMobile.guardCaptain = guardCaptain;
|
minionMobile.guardCaptain = guardCaptain;
|
||||||
minionMobile.spawnTime = (int) (-2.500 * guardCaptain.building.getRank() + 22.5) * 60;
|
minionMobile.spawnTime = (int) (-2.500 * guardCaptain.building.getRank() + 22.5) * 60;
|
||||||
minionMobile.behaviourType = Enum.MobBehaviourType.GuardMinion;
|
minionMobile.behaviourType = Enum.MobBehaviourType.GuardMinion;
|
||||||
minionMobile.agentType = AIAgentType.GUARD;
|
minionMobile.agentType = AIAgentType.GUARDMINION;
|
||||||
minionMobile.isPlayerGuard = true;
|
|
||||||
minionMobile.guardedCity = guardCaptain.guardedCity;
|
minionMobile.guardedCity = guardCaptain.guardedCity;
|
||||||
minionMobile.patrolPoints = guardCaptain.building.patrolPoints;
|
minionMobile.patrolPoints = guardCaptain.building.patrolPoints;
|
||||||
|
|
||||||
@@ -499,8 +488,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
minionMobile.setLoc(minionMobile.bindLoc);
|
minionMobile.setLoc(minionMobile.bindLoc);
|
||||||
minionMobile.despawn();
|
minionMobile.despawn();
|
||||||
|
|
||||||
int slot = guardCaptain.siegeMinionMap.size() + 1;
|
guardCaptain.minions.add(minionMobile.getObjectUUID());
|
||||||
guardCaptain.siegeMinionMap.put(minionMobile, slot);
|
|
||||||
|
|
||||||
return minionMobile;
|
return minionMobile;
|
||||||
}
|
}
|
||||||
@@ -530,8 +518,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
siegeMinion.setLoc(siegeMinion.bindLoc);
|
siegeMinion.setLoc(siegeMinion.bindLoc);
|
||||||
siegeMinion.despawn();
|
siegeMinion.despawn();
|
||||||
|
|
||||||
int slot = artyCaptain.siegeMinionMap.size() + 1;
|
artyCaptain.minions.add(siegeMinion.getObjectUUID());
|
||||||
artyCaptain.siegeMinionMap.put(siegeMinion, slot);
|
|
||||||
|
|
||||||
return siegeMinion;
|
return siegeMinion;
|
||||||
}
|
}
|
||||||
@@ -566,20 +553,22 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
|
|
||||||
return petMinion;
|
return petMinion;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Mob getMob(int id) {
|
public static Mob getMob(int id) {
|
||||||
|
|
||||||
if (id == 0)
|
if (id == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
Mob mob = (Mob) DbManager.getFromCache(GameObjectType.Mob, id);
|
Mob mob = (Mob) DbManager.getFromCache(GameObjectType.Mob, id);
|
||||||
|
|
||||||
if (mob != null)
|
if (mob != null)
|
||||||
return mob;
|
return mob;
|
||||||
|
|
||||||
return DbManager.MobQueries.GET_MOB(id);
|
return DbManager.MobQueries.GET_MOB(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Mob getFromCache(int id) {
|
public static Mob getFromCache(int id) {
|
||||||
|
|
||||||
|
|
||||||
return (Mob) DbManager.getFromCache(GameObjectType.Mob, id);
|
return (Mob) DbManager.getFromCache(GameObjectType.Mob, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -636,7 +625,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
mob.upgradeDateTime = upgradeDateTime;
|
mob.upgradeDateTime = upgradeDateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Getters
|
* Getters
|
||||||
*/
|
*/
|
||||||
@@ -662,10 +650,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
return this.spawnRadius;
|
return this.spawnRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSpawnTime(int value) {
|
|
||||||
this.spawnTime = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSpawnTimeAsString() {
|
public String getSpawnTimeAsString() {
|
||||||
if (this.spawnTime == 0)
|
if (this.spawnTime == 0)
|
||||||
return MBServerStatics.DEFAULT_SPAWN_TIME_MS / 1000 + " seconds (Default)";
|
return MBServerStatics.DEFAULT_SPAWN_TIME_MS / 1000 + " seconds (Default)";
|
||||||
@@ -680,11 +664,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getMobBaseID() {
|
public int getMobBaseID() {
|
||||||
|
|
||||||
if (this.mobBase != null)
|
|
||||||
return this.mobBase.getObjectUUID();
|
return this.mobBase.getObjectUUID();
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector3fImmutable getTrueBindLoc() {
|
public Vector3fImmutable getTrueBindLoc() {
|
||||||
@@ -708,7 +688,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
public Vector3fImmutable getBindLoc() {
|
public Vector3fImmutable getBindLoc() {
|
||||||
|
|
||||||
if (this.isPet() && !this.behaviourType.equals(MobBehaviourType.SiegeEngine))
|
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
|
else
|
||||||
return this.bindLoc;
|
return this.bindLoc;
|
||||||
}
|
}
|
||||||
@@ -737,8 +717,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
conVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.Constitution));
|
conVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.Constitution));
|
||||||
intVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.Intelligence));
|
intVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.Intelligence));
|
||||||
spiVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.Spirit));
|
spiVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.Spirit));
|
||||||
} else {
|
|
||||||
// apply dex penalty for armor
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set current stats
|
// Set current stats
|
||||||
@@ -757,7 +735,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
// get rune and effect bonuses
|
// get rune and effect bonuses
|
||||||
bonus *= (1 + this.bonuses.getFloatPercentAll(ModType.Speed, SourceType.None));
|
bonus *= (1 + this.bonuses.getFloatPercentAll(ModType.Speed, SourceType.None));
|
||||||
|
|
||||||
if (this.isPlayerGuard)
|
if (this.isPlayerGuard())
|
||||||
switch (this.mobBase.getLoadID()) {
|
switch (this.mobBase.getLoadID()) {
|
||||||
case 2111:
|
case 2111:
|
||||||
if (this.isWalk())
|
if (this.isWalk())
|
||||||
@@ -825,7 +803,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
Group g = GroupManager.getGroup((PlayerCharacter) attacker);
|
Group g = GroupManager.getGroup((PlayerCharacter) attacker);
|
||||||
|
|
||||||
// Give XP, now handled inside the Experience Object
|
// Give XP, now handled inside the Experience Object
|
||||||
if (!this.isPet() && !this.isNecroPet() && !(this.agentType.equals(AIAgentType.PET)) && !this.isPlayerGuard)
|
if (!this.isPet() && !this.isNecroPet() && !(this.agentType.equals(AIAgentType.PET)) && !this.isPlayerGuard())
|
||||||
Experience.doExperience((PlayerCharacter) attacker, this, g);
|
Experience.doExperience((PlayerCharacter) attacker, this, g);
|
||||||
} else if (attacker.getObjectType().equals(GameObjectType.Mob)) {
|
} else if (attacker.getObjectType().equals(GameObjectType.Mob)) {
|
||||||
Mob mobAttacker = (Mob) attacker;
|
Mob mobAttacker = (Mob) attacker;
|
||||||
@@ -836,7 +814,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
PlayerCharacter owner = (PlayerCharacter) mobAttacker.guardCaptain;
|
PlayerCharacter owner = (PlayerCharacter) mobAttacker.guardCaptain;
|
||||||
|
|
||||||
if (owner != null)
|
if (owner != null)
|
||||||
if (!this.isPet() && !this.isNecroPet() && !(this.agentType.equals(AIAgentType.PET)) && !this.isPlayerGuard) {
|
if (!this.isPet() && !this.isNecroPet() && !(this.agentType.equals(AIAgentType.PET)) && !this.isPlayerGuard()) {
|
||||||
Group g = GroupManager.getGroup(owner);
|
Group g = GroupManager.getGroup(owner);
|
||||||
|
|
||||||
// Give XP, now handled inside the Experience Object
|
// Give XP, now handled inside the Experience Object
|
||||||
@@ -950,7 +928,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
|
|
||||||
playerAgroMap.clear();
|
playerAgroMap.clear();
|
||||||
|
|
||||||
if (!this.isPlayerGuard && this.equip != null)
|
if (!this.isPlayerGuard() && this.equip != null)
|
||||||
LootManager.GenerateEquipmentDrop(this);
|
LootManager.GenerateEquipmentDrop(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -987,7 +965,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
this.setLoc(this.lastBindLoc);
|
this.setLoc(this.lastBindLoc);
|
||||||
this.stopMovement(this.lastBindLoc);
|
this.stopMovement(this.lastBindLoc);
|
||||||
|
|
||||||
NPCManager.applyRuneSetEffects(this);
|
NPCManager.applyMobbaseEffects(this);
|
||||||
|
|
||||||
this.recalculateStats();
|
this.recalculateStats();
|
||||||
this.setHealth(this.healthMax);
|
this.setHealth(this.healthMax);
|
||||||
@@ -997,8 +975,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
else if (this.building != null)
|
else if (this.building != null)
|
||||||
this.region = BuildingManager.GetRegion(this.building, bindLoc.x, bindLoc.y, bindLoc.z);
|
this.region = BuildingManager.GetRegion(this.building, bindLoc.x, bindLoc.y, bindLoc.z);
|
||||||
|
|
||||||
if (!this.behaviourType.equals(MobBehaviourType.SiegeEngine) && !this.isPlayerGuard && contract == null)
|
this.loadInventory();
|
||||||
loadInventory();
|
|
||||||
|
|
||||||
this.updateLocation();
|
this.updateLocation();
|
||||||
}
|
}
|
||||||
@@ -1036,7 +1013,9 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
this.charItemManager.clearInventory();
|
this.charItemManager.clearInventory();
|
||||||
this.charItemManager.clearEquip();
|
this.charItemManager.clearEquip();
|
||||||
|
|
||||||
if (isPlayerGuard)
|
// Only generate loot for mobiles
|
||||||
|
|
||||||
|
if (!this.agentType.equals(AIAgentType.MOBILE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LootManager.GenerateMobLoot(this);
|
LootManager.GenerateMobLoot(this);
|
||||||
@@ -1138,6 +1117,26 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
this.defenseRating = 0;
|
this.defenseRating = 0;
|
||||||
return;
|
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 {
|
try {
|
||||||
calculateAtrDamageForWeapon(this.equip.get(MBServerStatics.SLOT_MAINHAND), true);
|
calculateAtrDamageForWeapon(this.equip.get(MBServerStatics.SLOT_MAINHAND), true);
|
||||||
@@ -1529,49 +1528,33 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
@Override
|
@Override
|
||||||
public void runAfterLoad() {
|
public void runAfterLoad() {
|
||||||
|
|
||||||
this.charItemManager = new CharacterItemManager(this);
|
this.setObjectTypeMask(MBServerStatics.MASK_MOB | this.getTypeMasks());
|
||||||
|
|
||||||
if (ConfigManager.serverType.equals(ServerType.LOGINSERVER))
|
if (ConfigManager.serverType.equals(ServerType.LOGINSERVER))
|
||||||
return;
|
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);
|
this.building = BuildingManager.getBuilding(this.buildingUUID);
|
||||||
|
|
||||||
if (this.contractUUID == 0)
|
// Configure AI related values
|
||||||
this.contract = null;
|
|
||||||
else
|
|
||||||
this.contract = DbManager.ContractQueries.GET_CONTRACT(this.contractUUID);
|
|
||||||
|
|
||||||
// Setup mobile AI and equipset for contract
|
switch (this.behaviourType) {
|
||||||
|
case GuardCaptain:
|
||||||
if (this.contract != null) {
|
this.agentType = AIAgentType.GUARDCAPTAIN;
|
||||||
|
this.spawnTime = 600;
|
||||||
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;
|
|
||||||
this.guardedCity = ZoneManager.getCityAtLocation(this.building.getLoc());
|
this.guardedCity = ZoneManager.getCityAtLocation(this.building.getLoc());
|
||||||
}
|
break;
|
||||||
|
case GuardWallArcher:
|
||||||
// Load AI for wall archers
|
this.agentType = AIAgentType.GUARDWALLARCHER;
|
||||||
|
|
||||||
if (NPC.ISWallArcher(this.contract)) {
|
|
||||||
this.gridObjectType = GridObjectType.DYNAMIC;
|
|
||||||
this.behaviourType = MobBehaviourType.GuardWallArcher;
|
|
||||||
this.isPlayerGuard = true;
|
|
||||||
this.spawnTime = 450;
|
this.spawnTime = 450;
|
||||||
this.guardedCity = ZoneManager.getCityAtLocation(this.building.getLoc());
|
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))
|
if (this.behaviourType == null || this.behaviourType.equals(MobBehaviourType.None))
|
||||||
this.behaviourType = this.getMobBase().fsm;
|
this.behaviourType = this.getMobBase().fsm;
|
||||||
@@ -1579,6 +1562,18 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
if (this.behaviourType == null)
|
if (this.behaviourType == null)
|
||||||
this.behaviourType = MobBehaviourType.None;
|
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)
|
if (this.building != null)
|
||||||
this.guild = this.building.getGuild();
|
this.guild = this.building.getGuild();
|
||||||
else
|
else
|
||||||
@@ -1604,7 +1599,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
// Don't override level for guard minions or pets
|
// Don't override level for guard minions or pets
|
||||||
|
|
||||||
if (this.contract == null)
|
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();
|
this.level = (short) this.mobBase.getLevel();
|
||||||
|
|
||||||
//set bonuses
|
//set bonuses
|
||||||
@@ -1614,8 +1609,8 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
//TODO set these correctly later
|
//TODO set these correctly later
|
||||||
this.rangeHandOne = this.mobBase.getAttackRange();
|
this.rangeHandOne = this.mobBase.getAttackRange();
|
||||||
this.rangeHandTwo = -1;
|
this.rangeHandTwo = -1;
|
||||||
this.minDamageHandOne = (int)this.mobBase.getMinDmg();
|
this.minDamageHandOne = (int) this.mobBase.getMinDmg();
|
||||||
this.maxDamageHandOne = (int)this.mobBase.getMaxDmg();
|
this.maxDamageHandOne = (int) this.mobBase.getMaxDmg();
|
||||||
this.minDamageHandTwo = 0;
|
this.minDamageHandTwo = 0;
|
||||||
this.maxDamageHandTwo = 0;
|
this.maxDamageHandTwo = 0;
|
||||||
this.atrHandOne = this.mobBase.getAtr();
|
this.atrHandOne = this.mobBase.getAtr();
|
||||||
@@ -1664,18 +1659,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
else
|
else
|
||||||
this.equip = new HashMap<>();
|
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) {
|
if (this.equip == null) {
|
||||||
Logger.error("Null equipset returned for uuid " + currentID);
|
Logger.error("Null equipset returned for uuid " + currentID);
|
||||||
this.equip = new HashMap<>(0);
|
this.equip = new HashMap<>(0);
|
||||||
@@ -1691,10 +1674,11 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
if (this.getMobBase().enemy.size() > 0)
|
if (this.getMobBase().enemy.size() > 0)
|
||||||
this.enemy.addAll(this.getMobBase().enemy);
|
this.enemy.addAll(this.getMobBase().enemy);
|
||||||
}
|
}
|
||||||
|
NPCManager.applyMobbaseEffects(this);
|
||||||
try {
|
NPCManager.applyEquipmentResists(this);
|
||||||
NPCManager.applyRuneSetEffects(this);
|
NPCManager.applyMobbaseSkill(this);
|
||||||
recalculateStats();
|
NPCManager.applyRuneSkills(this,this.getMobBaseID());
|
||||||
|
this.recalculateStats();
|
||||||
this.setHealth(this.healthMax);
|
this.setHealth(this.healthMax);
|
||||||
|
|
||||||
// Set bounds for this mobile
|
// Set bounds for this mobile
|
||||||
@@ -1705,15 +1689,20 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
|
|
||||||
//assign 5 random patrol points for regular mobs
|
//assign 5 random patrol points for regular mobs
|
||||||
|
|
||||||
if (this.agentType.equals(AIAgentType.MOBILE)) {
|
if (this.agentType.equals(AIAgentType.MOBILE))
|
||||||
|
|
||||||
NPCManager.AssignPatrolPoints(this);
|
NPCManager.AssignPatrolPoints(this);
|
||||||
|
|
||||||
|
if (this.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN)) {
|
||||||
|
|
||||||
|
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;
|
this.deathTime = 0;
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.error(e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1721,8 +1710,8 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
return new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
return new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canSee(PlayerCharacter target) {
|
public boolean canSee(AbstractCharacter target) {
|
||||||
return this.mobBase.getSeeInvis() >= target.getHidden();
|
return this.mobBase.getSeeInvis() >= target.hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getBuildingID() {
|
public int getBuildingID() {
|
||||||
@@ -1750,16 +1739,9 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
if (!ac.getObjectType().equals(GameObjectType.PlayerCharacter))
|
if (!ac.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PlayerCharacter player = (PlayerCharacter) ac;
|
|
||||||
|
|
||||||
if (this.getCombatTarget() == null) {
|
if (this.getCombatTarget() == null) {
|
||||||
this.setCombatTarget(ac);
|
this.setCombatTarget(ac);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.getObjectUUID() == this.getCombatTarget().getObjectUUID())
|
|
||||||
return;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRank(int newRank) {
|
public void setRank(int newRank) {
|
||||||
@@ -1798,10 +1780,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
this.weaponPower = weaponPower;
|
this.weaponPower = weaponPower;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConcurrentHashMap<Mob, Integer> getSiegeMinionMap() {
|
|
||||||
return siegeMinionMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DateTime getUpgradeDateTime() {
|
public DateTime getUpgradeDateTime() {
|
||||||
|
|
||||||
lock.readLock().lock();
|
lock.readLock().lock();
|
||||||
@@ -1822,7 +1800,8 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPlayerGuard() {
|
public boolean isPlayerGuard() {
|
||||||
return isPlayerGuard;
|
|
||||||
|
return EnumSet.of(AIAgentType.GUARDCAPTAIN, AIAgentType.GUARDMINION, AIAgentType.GUARDWALLARCHER).contains(this.agentType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLastMobPowerToken() {
|
public int getLastMobPowerToken() {
|
||||||
@@ -1902,5 +1881,4 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
lock.writeLock().unlock();
|
lock.writeLock().unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ public class MobBase extends AbstractGameObject {
|
|||||||
private final String firstName;
|
private final String firstName;
|
||||||
private final byte level;
|
private final byte level;
|
||||||
private final float scale;
|
private final float scale;
|
||||||
|
public final ArrayList<MobBaseEffects> effectsList;
|
||||||
public int bootySet;
|
public int bootySet;
|
||||||
public Enum.MobBehaviourType fsm;
|
public Enum.MobBehaviourType fsm;
|
||||||
public EnumBitSet<Enum.MonsterType> notEnemy;
|
public EnumBitSet<Enum.MonsterType> notEnemy;
|
||||||
@@ -108,6 +109,8 @@ public class MobBase extends AbstractGameObject {
|
|||||||
|
|
||||||
this.mobBaseStats = DbManager.MobBaseQueries.LOAD_STATS(this.loadID);
|
this.mobBaseStats = DbManager.MobBaseQueries.LOAD_STATS(this.loadID);
|
||||||
DbManager.MobBaseQueries.LOAD_ALL_MOBBASE_SPEEDS(this);
|
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 baseSpi;
|
||||||
private final int baseDex;
|
private final int baseDex;
|
||||||
|
|
||||||
|
private final int mobbaseSkill;
|
||||||
|
private final int mobbaseSkillAmount;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ResultSet Constructor
|
* ResultSet Constructor
|
||||||
@@ -31,6 +34,8 @@ public class MobBaseStats {
|
|||||||
this.baseCon = rs.getInt("Constitution");
|
this.baseCon = rs.getInt("Constitution");
|
||||||
this.baseSpi = rs.getInt("Spirit");
|
this.baseSpi = rs.getInt("Spirit");
|
||||||
this.baseDex = rs.getInt("Dexterity");
|
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.baseCon = 0;
|
||||||
this.baseSpi = 0;
|
this.baseSpi = 0;
|
||||||
this.baseDex = 0;
|
this.baseDex = 0;
|
||||||
|
this.mobbaseSkill = 0;
|
||||||
|
this.mobbaseSkillAmount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MobBaseStats GetGenericStats() {
|
public static MobBaseStats GetGenericStats() {
|
||||||
@@ -72,5 +79,8 @@ public class MobBaseStats {
|
|||||||
return baseDex;
|
return baseDex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getBaseSkill(){return mobbaseSkill;}
|
||||||
|
|
||||||
|
public int getBaseSkillAmount(){return mobbaseSkillAmount;}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -640,28 +640,31 @@ public class NPC extends AbstractCharacter {
|
|||||||
|
|
||||||
public void removeMinions() {
|
public void removeMinions() {
|
||||||
|
|
||||||
for (Mob toRemove : this.siegeMinionMap.keySet()) {
|
|
||||||
|
for (Integer minionUUID : this.minions) {
|
||||||
|
|
||||||
|
Mob minionMob = Mob.getMob(minionUUID);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
toRemove.clearEffects();
|
minionMob.clearEffects();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(e.getMessage());
|
Logger.error(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toRemove.getParentZone() != null)
|
if (minionMob.getParentZone() != null)
|
||||||
toRemove.getParentZone().zoneMobSet.remove(toRemove);
|
minionMob.getParentZone().zoneMobSet.remove(minionMob);
|
||||||
|
|
||||||
WorldGrid.RemoveWorldObject(toRemove);
|
WorldGrid.RemoveWorldObject(minionMob);
|
||||||
DbManager.removeFromCache(toRemove);
|
DbManager.removeFromCache(minionMob);
|
||||||
|
|
||||||
|
|
||||||
PlayerCharacter petOwner = (PlayerCharacter) toRemove.guardCaptain;
|
PlayerCharacter petOwner = (PlayerCharacter) minionMob.guardCaptain;
|
||||||
|
|
||||||
if (petOwner != null) {
|
if (petOwner != null) {
|
||||||
|
|
||||||
petOwner.setPet(null);
|
petOwner.setPet(null);
|
||||||
|
|
||||||
toRemove.guardCaptain = null;
|
minionMob.guardCaptain = null;
|
||||||
|
|
||||||
PetMsg petMsg = new PetMsg(5, null);
|
PetMsg petMsg = new PetMsg(5, null);
|
||||||
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
|
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
|
||||||
@@ -669,6 +672,7 @@ public class NPC extends AbstractCharacter {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -135,7 +135,6 @@ public class PlayerCharacter extends AbstractCharacter {
|
|||||||
private Vector3fImmutable lastStaticLoc = new Vector3fImmutable(0.0f, 0.0f, 0.0f);
|
private Vector3fImmutable lastStaticLoc = new Vector3fImmutable(0.0f, 0.0f, 0.0f);
|
||||||
private GameObjectType lastTargetType;
|
private GameObjectType lastTargetType;
|
||||||
private int lastTargetID;
|
private int lastTargetID;
|
||||||
private int hidden = 0; // current rank of hide/sneak/invis
|
|
||||||
private int seeInvis = 0; // current rank of see invis
|
private int seeInvis = 0; // current rank of see invis
|
||||||
private float speedMod;
|
private float speedMod;
|
||||||
private boolean teleportMode = false; // Teleport on MoveToPoint
|
private boolean teleportMode = false; // Teleport on MoveToPoint
|
||||||
@@ -2774,10 +2773,6 @@ public class PlayerCharacter extends AbstractCharacter {
|
|||||||
this.lastStaticLoc = value;
|
this.lastStaticLoc = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getHidden() {
|
|
||||||
return this.hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHidden(int value) {
|
public void setHidden(int value) {
|
||||||
this.hidden = 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.RealmMap;
|
||||||
import engine.InterestManagement.WorldGrid;
|
import engine.InterestManagement.WorldGrid;
|
||||||
import engine.db.archive.DataWarehouse;
|
import engine.db.archive.DataWarehouse;
|
||||||
import engine.db.handlers.dbPowerHandler;
|
import engine.db.handlers.dbRuneBaseHandler;
|
||||||
import engine.exception.MsgSendException;
|
import engine.exception.MsgSendException;
|
||||||
import engine.gameManager.*;
|
import engine.gameManager.*;
|
||||||
import engine.job.JobContainer;
|
import engine.job.JobContainer;
|
||||||
@@ -351,8 +351,11 @@ public class WorldServer {
|
|||||||
Logger.info("Loading MobBases.");
|
Logger.info("Loading MobBases.");
|
||||||
DbManager.MobBaseQueries.GET_ALL_MOBBASES();
|
DbManager.MobBaseQueries.GET_ALL_MOBBASES();
|
||||||
|
|
||||||
Logger.info("Loading Mob Powers");
|
Logger.info("Loading Rune Powers");
|
||||||
PowersManager.AllMobPowers = dbPowerHandler.LOAD_MOB_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");
|
Logger.info("Loading item enchants");
|
||||||
DbManager.LootQueries.LOAD_ENCHANT_VALUES();
|
DbManager.LootQueries.LOAD_ENCHANT_VALUES();
|
||||||
|
|||||||
Reference in New Issue
Block a user