Compare commits
218 Commits
NovaTest
...
bdf6500260
| 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 | |||
| 6641651f3c | |||
| dbf164bfb2 | |||
| 8a617c3008 | |||
| a50a2430ba | |||
| 5c3c552288 | |||
| 69fdddfc71 | |||
| db5b988275 | |||
| 4284757035 | |||
| b93a47acc0 | |||
| d59f9857ce | |||
| 8ce212b74b | |||
| e78aea5735 | |||
| 9a3c5c3f40 | |||
| 60ca3f9c34 | |||
| e7e740dff1 | |||
| 8343a98d77 | |||
| 5862039a00 | |||
| 8af989b75f | |||
| 08d0e5ff75 | |||
| 5196d10e5c | |||
| 3392ec463d | |||
| 33529404cf | |||
| 00e7a36013 | |||
| 3060b394ab | |||
| a43d9022fe | |||
| 6abdc68ca5 | |||
| 61c66b0e96 | |||
| 36cc23457a | |||
| d573b238de | |||
| 8afe25fe85 | |||
| f80647ff0d | |||
| 7e64cbabf8 | |||
| 14a06410ae | |||
| 85c2a4f4f0 | |||
| da9e211ec7 | |||
| a81070c471 | |||
| e3ad7efa4f | |||
| a4dafd7155 | |||
| 645aec853e | |||
| d8d5e4a3c4 | |||
| 7a48c04057 | |||
| 64aaaa707e | |||
| 445d40dc5f | |||
| ebdcb531f2 | |||
| c9cdb891d6 | |||
| f5c6c002a8 | |||
| d171c6bb9a | |||
| 1c81a4faed | |||
| e7d1d5cb71 | |||
| 060d831d50 | |||
| 316bd6dd01 | |||
| 34081e5903 | |||
| e2d843b65e | |||
| a796f5fe4b | |||
| 51ee41c773 | |||
| 7e5ed3efe5 | |||
| 8dd25ac315 | |||
| 1cdaa58e7a | |||
| fa3aa24a3d | |||
| 091431d95b | |||
| 1ecf0122ab | |||
| 79980a1725 | |||
| 8badcc3f6e | |||
| 4d6e57257c | |||
| a7a93b8500 | |||
| 85cc34fb4c | |||
| 772a996b6e | |||
| e67eff822d | |||
| c39ed6120f | |||
| c38f4e6543 | |||
| 098433b697 | |||
| c8e20c905b | |||
| bd2446ba0a | |||
| c179e4aaf3 | |||
| 2f8de2a919 | |||
| 338110973d | |||
| 3c9c4495bc | |||
| 93476f782c | |||
| 3aec6ee578 | |||
| 3bca76d4c8 | |||
| b9d6f35aac | |||
| 9b6959414a | |||
| 400dd6aa5e | |||
| 14af2f6efd | |||
| 0a2de9e0d5 | |||
| 89bfad78a6 | |||
| 52486fa278 | |||
| dc0e14eb21 | |||
| 70278374e7 | |||
| ac3588c76a | |||
| ab335aef2a | |||
| 719c855bdb | |||
| f283e50018 | |||
| 99b952ee28 | |||
| 24639b62c0 | |||
| 573cc531bf | |||
| 29e24bae93 | |||
| 22e4cc07c0 | |||
| 9264347698 | |||
| 579c26ac59 | |||
| ef577dd313 | |||
| 62c7e52487 | |||
| 3534ac6477 | |||
| 1738f7b311 | |||
| eb25caec81 | |||
| a6c60e2c04 | |||
| adafbdf6d3 | |||
| 7eab14938d | |||
| 039e55673b | |||
| ec3a9b6cb4 | |||
| 17a6494b2b | |||
| 0b05c7074f | |||
| 876ccc7cbf | |||
| bdf14b8f24 | |||
| 43375a6f5b | |||
| e00328ae13 | |||
| 07c553294b |
+11
-9
@@ -2822,7 +2822,6 @@ public class Enum {
|
|||||||
|
|
||||||
public enum MobBehaviourType {
|
public enum MobBehaviourType {
|
||||||
None(null, false, false, false, false, false),
|
None(null, false, false, false, false, false),
|
||||||
//Power
|
|
||||||
Power(null, false, true, true, true, false),
|
Power(null, false, true, true, true, false),
|
||||||
PowerHelpee(Power, false, true, true, false, true),
|
PowerHelpee(Power, false, true, true, false, true),
|
||||||
PowerHelpeeWimpy(Power, true, false, true, false, false),
|
PowerHelpeeWimpy(Power, true, false, true, false, false),
|
||||||
@@ -2847,6 +2846,7 @@ public class Enum {
|
|||||||
//Independent Types
|
//Independent Types
|
||||||
SimpleStandingGuard(null, false, false, false, false, false),
|
SimpleStandingGuard(null, false, false, false, false, false),
|
||||||
Pet1(null, false, false, true, false, false),
|
Pet1(null, false, false, true, false, false),
|
||||||
|
SiegeEngine(null, false, false, false, false, false),
|
||||||
Simple(null, false, false, true, false, false),
|
Simple(null, false, false, true, false, false),
|
||||||
Helpee(null, false, true, true, false, true),
|
Helpee(null, false, true, true, false, true),
|
||||||
HelpeeWimpy(null, true, false, true, false, false),
|
HelpeeWimpy(null, true, false, true, false, false),
|
||||||
@@ -2857,13 +2857,12 @@ public class Enum {
|
|||||||
HamletGuard(null, false, true, false, false, false),
|
HamletGuard(null, false, true, false, false, false),
|
||||||
AggroWanderer(null, false, false, true, false, false);
|
AggroWanderer(null, false, false, true, false, false);
|
||||||
|
|
||||||
private static HashMap<Integer, MobBehaviourType> _behaviourTypes = new HashMap<>();
|
public final MobBehaviourType BehaviourHelperType;
|
||||||
public MobBehaviourType BehaviourHelperType;
|
public final boolean isWimpy;
|
||||||
public boolean isWimpy;
|
public final boolean isAgressive;
|
||||||
public boolean isAgressive;
|
public final boolean canRoam;
|
||||||
public boolean canRoam;
|
public final boolean callsForHelp;
|
||||||
public boolean callsForHelp;
|
public final boolean respondsToCallForHelp;
|
||||||
public boolean respondsToCallForHelp;
|
|
||||||
|
|
||||||
MobBehaviourType(MobBehaviourType helpeebehaviourType, boolean wimpy, boolean agressive, boolean canroam, boolean callsforhelp, boolean respondstocallforhelp) {
|
MobBehaviourType(MobBehaviourType helpeebehaviourType, boolean wimpy, boolean agressive, boolean canroam, boolean callsforhelp, boolean respondstocallforhelp) {
|
||||||
this.BehaviourHelperType = helpeebehaviourType;
|
this.BehaviourHelperType = helpeebehaviourType;
|
||||||
@@ -2878,8 +2877,11 @@ public class Enum {
|
|||||||
|
|
||||||
public enum AIAgentType {
|
public enum AIAgentType {
|
||||||
MOBILE,
|
MOBILE,
|
||||||
|
GUARDCAPTAIN,
|
||||||
|
GUARDMINION,
|
||||||
|
GUARDWALLARCHER,
|
||||||
PET,
|
PET,
|
||||||
CHARMED,
|
CHARMED,
|
||||||
GUARD;
|
SIEGEENGINE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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());
|
||||||
@@ -467,7 +467,7 @@ public enum InterestManager implements Runnable {
|
|||||||
if (awonpc.despawned == true)
|
if (awonpc.despawned == true)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
awonpc.playerAgroMap.put(player.getObjectUUID(), false);
|
awonpc.playerAgroMap.put(player.getObjectUUID(), 0f);
|
||||||
((Mob) awonpc).setCombatTarget(null);
|
((Mob) awonpc).setCombatTarget(null);
|
||||||
lcm = new LoadCharacterMsg(awonpc, PlayerCharacter.hideNonAscii());
|
lcm = new LoadCharacterMsg(awonpc, PlayerCharacter.hideNonAscii());
|
||||||
|
|
||||||
@@ -480,7 +480,7 @@ public enum InterestManager implements Runnable {
|
|||||||
if (!awonpc.isAlive())
|
if (!awonpc.isAlive())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
awonpc.playerAgroMap.put(player.getObjectUUID(), false);
|
awonpc.playerAgroMap.put(player.getObjectUUID(), 0f);
|
||||||
|
|
||||||
if ((awonpc.agentType.equals(Enum.AIAgentType.MOBILE)))
|
if ((awonpc.agentType.equals(Enum.AIAgentType.MOBILE)))
|
||||||
((Mob) awonpc).setCombatTarget(null);
|
((Mob) awonpc).setCombatTarget(null);
|
||||||
|
|||||||
@@ -28,31 +28,27 @@ public class dbMobHandler extends dbHandlerBase {
|
|||||||
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Mob ADD_MOB(Mob toAdd) {
|
public Mob PERSIST(Mob toAdd) {
|
||||||
|
|
||||||
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.getParentZoneID());
|
preparedStatement.setLong(1, toAdd.parentZoneUUID);
|
||||||
preparedStatement.setInt(2, toAdd.getMobBaseID());
|
preparedStatement.setInt(2, toAdd.loadID);
|
||||||
preparedStatement.setInt(3, toAdd.getGuildUUID());
|
preparedStatement.setInt(3, toAdd.guildUUID);
|
||||||
preparedStatement.setFloat(4, toAdd.getSpawnX());
|
preparedStatement.setFloat(4, toAdd.bindLoc.x);
|
||||||
preparedStatement.setFloat(5, toAdd.getSpawnY());
|
preparedStatement.setFloat(5, toAdd.bindLoc.y);
|
||||||
preparedStatement.setFloat(6, toAdd.getSpawnZ());
|
preparedStatement.setFloat(6, toAdd.bindLoc.z);
|
||||||
preparedStatement.setInt(7, 0);
|
preparedStatement.setInt(7, 0);
|
||||||
preparedStatement.setFloat(8, toAdd.getSpawnRadius());
|
preparedStatement.setFloat(8, toAdd.spawnRadius);
|
||||||
preparedStatement.setInt(9, toAdd.getTrueSpawnTime());
|
preparedStatement.setInt(9, toAdd.spawnTime);
|
||||||
|
preparedStatement.setInt(10, toAdd.contractUUID);
|
||||||
if (toAdd.getContract() != null)
|
preparedStatement.setInt(11, toAdd.buildingUUID);
|
||||||
preparedStatement.setInt(10, toAdd.getContract().getContractID());
|
preparedStatement.setInt(12, toAdd.level);
|
||||||
else
|
preparedStatement.setString(13, toAdd.firstName);
|
||||||
preparedStatement.setInt(10, 0);
|
preparedStatement.setString(14, toAdd.behaviourType.toString());
|
||||||
|
|
||||||
preparedStatement.setInt(11, toAdd.getBuildingID());
|
|
||||||
preparedStatement.setInt(12, toAdd.getLevel());
|
|
||||||
preparedStatement.setString(13, toAdd.getFirstName());
|
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
@@ -106,17 +102,17 @@ public class dbMobHandler extends dbHandlerBase {
|
|||||||
return row_count;
|
return row_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LOAD_PATROL_POINTS(Mob captain) {
|
public void LOAD_GUARD_MINIONS(Mob guardCaptain) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_guards` WHERE `captainUID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_guards` WHERE `captainUID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, captain.getObjectUUID());
|
preparedStatement.setInt(1, guardCaptain.getObjectUUID());
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
String name = rs.getString("name");
|
String minionName = rs.getString("minionName");
|
||||||
Mob toCreate = Mob.createGuardMob(captain, captain.getGuild(), captain.getParentZone(), captain.building.getLoc(), captain.getLevel(), name);
|
Mob toCreate = Mob.createGuardMinion(guardCaptain, guardCaptain.getLevel(), minionName);
|
||||||
|
|
||||||
if (toCreate == null)
|
if (toCreate == null)
|
||||||
return;
|
return;
|
||||||
@@ -131,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);
|
||||||
|
|
||||||
@@ -149,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, true, zone, null, 0, "", 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, true, zone, null, 0, "", 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,
|
||||||
|
|||||||
@@ -440,7 +440,9 @@ public class InfoCmd extends AbstractDevCmd {
|
|||||||
output += "isSummonedPet: true";
|
output += "isSummonedPet: true";
|
||||||
else
|
else
|
||||||
output += "isSummonedPet: false";
|
output += "isSummonedPet: false";
|
||||||
PlayerCharacter owner = targetMob.getOwner();
|
|
||||||
|
|
||||||
|
PlayerCharacter owner = (PlayerCharacter) targetMob.guardCaptain;
|
||||||
if (owner != null)
|
if (owner != null)
|
||||||
output += " owner: " + owner.getObjectUUID();
|
output += " owner: " + owner.getObjectUUID();
|
||||||
output += newline;
|
output += newline;
|
||||||
|
|||||||
@@ -59,22 +59,25 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
|
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
for (Mob mob : npc.getSiegeMinionMap().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.getSiegeMinionMap().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.getSiegeMinionMap().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.getSiegeMinionMap().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, true, serverZone, null, 0, "", 1);
|
null, serverZone, null, null, "", 1, Enum.AIAgentType.MOBILE);
|
||||||
|
|
||||||
if (mobile != null) {
|
if (mobile != null) {
|
||||||
mobile.updateDatabase();
|
mobile.updateDatabase();
|
||||||
|
|||||||
@@ -9,12 +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.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;
|
||||||
|
|
||||||
|
|
||||||
@@ -56,18 +61,39 @@ 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;
|
||||||
if (mob.BehaviourType != null) {
|
output += mob.agentType.toString() + newline;
|
||||||
output += "BehaviourType: " + mob.BehaviourType.toString() + newline;
|
|
||||||
if (mob.BehaviourType.BehaviourHelperType != null) {
|
int contractID = 0;
|
||||||
output += "Behaviour Helper Type: " + mob.BehaviourType.BehaviourHelperType.toString() + newline;
|
|
||||||
|
if (mob.isPlayerGuard() == true) {
|
||||||
|
|
||||||
|
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION))
|
||||||
|
contractID = mob.guardCaptain.contract.getContractID();
|
||||||
|
else
|
||||||
|
contractID = mob.contract.getContractID();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (contractID != 0) {
|
||||||
|
|
||||||
|
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION)) {
|
||||||
|
output += "Captain Contract: " + contractID + newline;
|
||||||
|
output += "Captain UUID: " + mob.guardCaptain.getObjectUUID() + newline;
|
||||||
|
} else
|
||||||
|
output += "Contract: " + contractID + newline;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mob.behaviourType != null) {
|
||||||
|
output += "BehaviourType: " + mob.behaviourType.toString() + newline;
|
||||||
|
if (mob.behaviourType.BehaviourHelperType != null) {
|
||||||
|
output += "Behaviour Helper Type: " + mob.behaviourType.BehaviourHelperType.toString() + newline;
|
||||||
} else {
|
} else {
|
||||||
output += "Behaviour Helper Type: NULL" + newline;
|
output += "Behaviour Helper Type: NULL" + newline;
|
||||||
}
|
}
|
||||||
output += "Wimpy: " + mob.BehaviourType.isWimpy + newline;
|
output += "Wimpy: " + mob.behaviourType.isWimpy + newline;
|
||||||
output += "Agressive: " + mob.BehaviourType.isAgressive + newline;
|
output += "Agressive: " + mob.behaviourType.isAgressive + newline;
|
||||||
output += "Can Roam: " + mob.BehaviourType.canRoam + newline;
|
output += "Can Roam: " + mob.behaviourType.canRoam + newline;
|
||||||
output += "Calls For Help: " + mob.BehaviourType.callsForHelp + newline;
|
output += "Calls For Help: " + mob.behaviourType.callsForHelp + newline;
|
||||||
output += "Responds To Call For Help: " + mob.BehaviourType.respondsToCallForHelp + newline;
|
output += "Responds To Call For Help: " + mob.behaviourType.respondsToCallForHelp + newline;
|
||||||
} else {
|
} else {
|
||||||
output += "BehaviourType: NULL" + newline;
|
output += "BehaviourType: NULL" + newline;
|
||||||
}
|
}
|
||||||
@@ -76,16 +102,54 @@ public class aiInfoCmd extends AbstractDevCmd {
|
|||||||
if (mob.playerAgroMap.size() > 0) {
|
if (mob.playerAgroMap.size() > 0) {
|
||||||
output += "Players Loaded:" + newline;
|
output += "Players Loaded:" + newline;
|
||||||
}
|
}
|
||||||
for (Map.Entry<Integer, Boolean> entry : mob.playerAgroMap.entrySet()) {
|
for (Map.Entry<Integer, Float> entry : mob.playerAgroMap.entrySet()) {
|
||||||
output += "Player ID: " + entry.getKey() + " Hate Value: " + (PlayerCharacter.getPlayerCharacter(entry.getKey())).getHateValue() + newline;
|
output += "Player ID: " + entry.getKey() + " Hate Value: " + entry.getValue() + newline;
|
||||||
}
|
}
|
||||||
if (mob.getCombatTarget() != null)
|
if (mob.getCombatTarget() != null)
|
||||||
output += "Current Target: " + mob.getCombatTarget().getName() + newline;
|
output += "Current Target: " + mob.getCombatTarget().getName() + newline;
|
||||||
else
|
else
|
||||||
output += "Current Target: NULL" + newline;
|
output += "Current Target: NULL" + newline;
|
||||||
|
|
||||||
for (int token : mob.mobPowers.keySet())
|
if (mob.guardedCity != null)
|
||||||
output += token + newline;
|
output += "Patrolling: " + mob.guardedCity.getCityName() + newline;
|
||||||
|
|
||||||
|
output += "Can Cast: " + MobAI.canCast(mob) + newline;
|
||||||
|
output += "Powers:" + newline;
|
||||||
|
|
||||||
|
ArrayList<RunePowerEntry> powerEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.getMobBaseID()));
|
||||||
|
|
||||||
|
// Additional powers may come from the contract ID. This is to support
|
||||||
|
// powers for player guards irrespective of the mobbase used.
|
||||||
|
|
||||||
|
if (mob.isPlayerGuard()) {
|
||||||
|
|
||||||
|
ArrayList<RunePowerEntry> contractEntries = new ArrayList<>();
|
||||||
|
|
||||||
|
if (mob.contract != null)
|
||||||
|
contractEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.contractUUID));
|
||||||
|
|
||||||
|
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION))
|
||||||
|
contractEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.guardCaptain.contractUUID));
|
||||||
|
|
||||||
|
powerEntries.addAll(contractEntries);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
for (RunePowerEntry runePowerEntry : powerEntries)
|
||||||
|
output += PowersManager.getPowerByToken(runePowerEntry.token).getName() + newline;
|
||||||
|
|
||||||
|
// List outlaws defined for this player guard's city
|
||||||
|
|
||||||
|
if (mob.isPlayerGuard()) {
|
||||||
|
|
||||||
|
ArrayList<Integer> outlaws = new ArrayList(mob.guardedCity.cityOutlaws);
|
||||||
|
|
||||||
|
if (outlaws.isEmpty() == false)
|
||||||
|
output += "Outlaws: " + newline;
|
||||||
|
|
||||||
|
for (Integer outlawUUID : outlaws)
|
||||||
|
output += outlawUUID + newline;
|
||||||
|
}
|
||||||
|
|
||||||
throwbackInfo(playerCharacter, output);
|
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(), true, zone, building, contract.getContractID(), 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(), true, zone, building, contract.getContractID(), 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(), true, zone, building, contract.getContractID(), 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,7 +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) {
|
||||||
ac.setHateValue(damage * MBServerStatics.PLAYER_COMBAT_HATE_MODIFIER);
|
if (ac.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||||
|
((Mob) tarAc).playerAgroMap.put(ac.getObjectUUID(), ((Mob) tarAc).playerAgroMap.get(ac.getObjectUUID()) + damage);
|
||||||
((Mob) tarAc).handleDirectAggro(ac);
|
((Mob) tarAc).handleDirectAggro(ac);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1267,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,92 +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 LoadAllRuneSets() {
|
|
||||||
_runeSetMap = DbManager.ItemBaseQueries.LOAD_RUNES_FOR_NPC_AND_MOBS();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void LoadAllBootySets() {
|
|
||||||
LootManager._bootySetMap = DbManager.LootQueries.LOAD_BOOTY_TABLES();
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
||||||
@@ -127,10 +42,12 @@ public enum NPCManager {
|
|||||||
|
|
||||||
DbManager.removeFromCache(necroPet);
|
DbManager.removeFromCache(necroPet);
|
||||||
|
|
||||||
PlayerCharacter petOwner = necroPet.getOwner();
|
|
||||||
|
PlayerCharacter petOwner = (PlayerCharacter) necroPet.guardCaptain;
|
||||||
|
|
||||||
if (petOwner != null) {
|
if (petOwner != null) {
|
||||||
necroPet.setOwner(null);
|
|
||||||
|
necroPet.guardCaptain = null;
|
||||||
petOwner.setPet(null);
|
petOwner.setPet(null);
|
||||||
|
|
||||||
if (updateOwner == false)
|
if (updateOwner == false)
|
||||||
@@ -205,35 +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 = toRemove.getOwner();
|
|
||||||
|
PlayerCharacter petOwner = (PlayerCharacter) siegeMinion.guardCaptain;
|
||||||
|
|
||||||
if (petOwner != null) {
|
if (petOwner != null) {
|
||||||
|
|
||||||
petOwner.setPet(null);
|
petOwner.setPet(null);
|
||||||
toRemove.setOwner(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,9 +261,18 @@ public enum NPCManager {
|
|||||||
else
|
else
|
||||||
buildingSlot = BuildingManager.getAvailableSlot(abstractCharacter.building);
|
buildingSlot = BuildingManager.getAvailableSlot(abstractCharacter.building);
|
||||||
|
|
||||||
|
// Override slot for siege engines
|
||||||
|
|
||||||
|
if (abstractCharacter.getObjectType().equals(Enum.GameObjectType.Mob) && ((Mob) abstractCharacter).behaviourType.equals(Enum.MobBehaviourType.SiegeEngine)) {
|
||||||
|
Mob siegeMobile = (Mob) abstractCharacter;
|
||||||
|
buildingSlot = siegeMobile.guardCaptain.minions.size() + 2;
|
||||||
|
}
|
||||||
|
|
||||||
if (buildingSlot == -1)
|
if (buildingSlot == -1)
|
||||||
Logger.error("No available slot for NPC: " + abstractCharacter.getObjectUUID());
|
Logger.error("No available slot for NPC: " + abstractCharacter.getObjectUUID());
|
||||||
|
|
||||||
|
// Pets are regular mobiles not hirelings (Siege engines)
|
||||||
|
if (abstractCharacter.contract != null)
|
||||||
abstractCharacter.building.getHirelings().put(abstractCharacter, buildingSlot);
|
abstractCharacter.building.getHirelings().put(abstractCharacter, buildingSlot);
|
||||||
|
|
||||||
// Override bind and location for this npc derived
|
// Override bind and location for this npc derived
|
||||||
@@ -370,4 +300,129 @@ public enum NPCManager {
|
|||||||
|
|
||||||
return buildingSlot;
|
return buildingSlot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getMaxMinions(Mob guardCaptain) {
|
||||||
|
|
||||||
|
int maxSlots;
|
||||||
|
|
||||||
|
switch (guardCaptain.getRank()) {
|
||||||
|
case 3:
|
||||||
|
maxSlots = 2;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
case 5:
|
||||||
|
maxSlots = 3;
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
maxSlots = 4;
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
maxSlots = 5;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
case 2:
|
||||||
|
default:
|
||||||
|
maxSlots = 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
return maxSlots;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AssignPatrolPoints(Mob mob) {
|
||||||
|
mob.patrolPoints = new ArrayList<>();
|
||||||
|
|
||||||
|
for (int i = 0; i < 5; ++i) {
|
||||||
|
float patrolRadius = mob.getSpawnRadius();
|
||||||
|
|
||||||
|
if (patrolRadius > 256)
|
||||||
|
patrolRadius = 256;
|
||||||
|
|
||||||
|
if (patrolRadius < 60)
|
||||||
|
patrolRadius = 60;
|
||||||
|
|
||||||
|
Vector3fImmutable newPatrolPoint = Vector3fImmutable.getRandomPointInCircle(mob.getBindLoc(), patrolRadius);
|
||||||
|
mob.patrolPoints.add(newPatrolPoint);
|
||||||
|
|
||||||
|
if (i == 1) {
|
||||||
|
mob.setLoc(newPatrolPoint);
|
||||||
|
mob.endLoc = newPatrolPoint;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void applyMobbaseEffects(Mob mob) {
|
||||||
|
EffectsBase effectsBase;
|
||||||
|
for (MobBaseEffects mbe : mob.mobBase.effectsList) {
|
||||||
|
|
||||||
|
effectsBase = PowersManager.getEffectByToken(mbe.getToken());
|
||||||
|
|
||||||
|
if (effectsBase == null) {
|
||||||
|
Logger.info("Mob: " + mob.getObjectUUID() + " EffectsBase Null for Token " + mbe.getToken());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//check to upgrade effects if needed.
|
||||||
|
if (mob.effects.containsKey(Integer.toString(effectsBase.getUUID()))) {
|
||||||
|
|
||||||
|
if (mbe.getReqLvl() > (int) mob.level)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Effect eff = mob.effects.get(Integer.toString(effectsBase.getUUID()));
|
||||||
|
|
||||||
|
if (eff == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//Current effect is a higher rank, dont apply.
|
||||||
|
if (eff.getTrains() > mbe.getRank())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//new effect is of a higher rank. remove old effect and apply new one.
|
||||||
|
eff.cancelJob();
|
||||||
|
mob.addEffectNoTimer(Integer.toString(effectsBase.getUUID()), effectsBase, mbe.getRank(), true);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (mbe.getReqLvl() > (int) mob.level)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
mob.addEffectNoTimer(Integer.toString(effectsBase.getUUID()), effectsBase, mbe.getRank(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void applyEquipmentResists(Mob mob){
|
||||||
|
if(mob.equip != null){
|
||||||
|
for(MobEquipment equipped : mob.equip.values()){
|
||||||
|
ItemBase itemBase = equipped.getItemBase();
|
||||||
|
if(itemBase.isHeavyArmor() || itemBase.isLightArmor() || itemBase.isMediumArmor()){
|
||||||
|
mob.resists.setResist(Enum.DamageType.Crush, mob.resists.getResist(Enum.DamageType.Crush,0) + itemBase.getCrushResist());
|
||||||
|
mob.resists.setResist(Enum.DamageType.Slash, mob.resists.getResist(Enum.DamageType.Slash,0) + itemBase.getCrushResist());
|
||||||
|
mob.resists.setResist(Enum.DamageType.Pierce, mob.resists.getResist(Enum.DamageType.Pierce,0) + itemBase.getCrushResist());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void applyMobbaseSkill(Mob mob) {
|
||||||
|
SkillsBase baseSkill = DbManager.SkillsBaseQueries.GET_BASE_BY_TOKEN(mob.mobBase.getMobBaseStats().getBaseSkill());
|
||||||
|
if(baseSkill != null)
|
||||||
|
mob.getSkills().put(baseSkill.getName(),new CharacterSkill(baseSkill,mob,mob.mobBase.getMobBaseStats().getBaseSkillAmount()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void applyRuneSkills(Mob mob, int runeID){
|
||||||
|
//load mob skill adjustments from mobbase rune
|
||||||
|
if(PowersManager._allRuneSkillAdjusts.containsKey(runeID))
|
||||||
|
for(RuneSkillAdjustEntry entry : PowersManager._allRuneSkillAdjusts.get(runeID)) {
|
||||||
|
if(SkillsBase.getFromCache(entry.skill_type) == null)
|
||||||
|
SkillsBase.putInCache(DbManager.SkillsBaseQueries.GET_BASE_BY_NAME(entry.skill_type));
|
||||||
|
SkillsBase skillBase = SkillsBase.getFromCache(entry.skill_type);
|
||||||
|
if(skillBase == null)
|
||||||
|
continue;
|
||||||
|
if (entry.level <= mob.level)
|
||||||
|
if (mob.skills.containsKey(entry.name) == false)
|
||||||
|
mob.skills.put(entry.skill_type, new CharacterSkill(skillBase, mob, entry.rank));
|
||||||
|
else
|
||||||
|
mob.skills.put(entry.skill_type, new CharacterSkill(skillBase, mob, entry.rank + mob.skills.get(entry.skill_type).getNumTrains()));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,13 +53,10 @@ public enum PowersManager {
|
|||||||
public static HashMap<Integer, AbstractPowerAction> powerActionsByID = new HashMap<>();
|
public static HashMap<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() {
|
||||||
|
|
||||||
@@ -839,8 +846,6 @@ public enum PowersManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
playerCharacter.setHateValue(pb.getHateValue(trains));
|
|
||||||
|
|
||||||
//Send Cast Message.
|
//Send Cast Message.
|
||||||
// PerformActionMsg castMsg = new PerformActionMsg(msg);
|
// PerformActionMsg castMsg = new PerformActionMsg(msg);
|
||||||
// castMsg.setNumTrains(9999);
|
// castMsg.setNumTrains(9999);
|
||||||
@@ -891,8 +896,6 @@ public enum PowersManager {
|
|||||||
//Power is aiding a target, handle aggro if combat target is a Mob.
|
//Power is aiding a target, handle aggro if combat target is a Mob.
|
||||||
if (!pb.isHarmful() && target.getObjectType() == GameObjectType.PlayerCharacter) {
|
if (!pb.isHarmful() && target.getObjectType() == GameObjectType.PlayerCharacter) {
|
||||||
PlayerCharacter pcTarget = (PlayerCharacter) target;
|
PlayerCharacter pcTarget = (PlayerCharacter) target;
|
||||||
if (!pb.isHarmful())
|
|
||||||
Mob.HandleAssistedAggro(playerCharacter, pcTarget);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// update target of used power timer
|
// update target of used power timer
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class EndFearJob extends AbstractEffectJob {
|
|||||||
if (this.target == null || (!(this.target instanceof Mob)))
|
if (this.target == null || (!(this.target instanceof Mob)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
((Mob) this.target).setFearedObject(null);
|
((Mob) this.target).fearedObject = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -40,6 +40,6 @@ public class EndFearJob extends AbstractEffectJob {
|
|||||||
if (this.target == null || (!(this.target instanceof Mob)))
|
if (this.target == null || (!(this.target instanceof Mob)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
((Mob) this.target).setFearedObject(null);
|
((Mob) this.target).fearedObject = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+157
-265
@@ -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))
|
||||||
@@ -96,7 +99,7 @@ public class MobAI {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mob.BehaviourType.callsForHelp)
|
if (mob.behaviourType.callsForHelp)
|
||||||
MobCallForHelp(mob);
|
MobCallForHelp(mob);
|
||||||
|
|
||||||
if (!MovementUtilities.inRangeDropAggro(mob, target)) {
|
if (!MovementUtilities.inRangeDropAggro(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.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal())
|
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.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal()) {
|
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))
|
||||||
|
contractID = mob.guardCaptain.contract.getContractID();
|
||||||
if(mob.BehaviourType.equals(Enum.MobBehaviourType.GuardMinion))
|
|
||||||
contractID = mob.npcOwner.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,47 +357,67 @@ 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)
|
||||||
MobCallForHelp(mob);
|
MobCallForHelp(mob);
|
||||||
|
|
||||||
// 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
|
||||||
|
|
||||||
@@ -422,61 +453,7 @@ 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()) {
|
||||||
@@ -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) {
|
||||||
@@ -564,7 +501,7 @@ public class MobAI {
|
|||||||
Zone mobCamp = mob.getParentZone();
|
Zone mobCamp = mob.getParentZone();
|
||||||
|
|
||||||
for (Mob helper : mobCamp.zoneMobSet) {
|
for (Mob helper : mobCamp.zoneMobSet) {
|
||||||
if (helper.BehaviourType.respondsToCallForHelp && helper.BehaviourType.BehaviourHelperType.equals(mob.BehaviourType)) {
|
if (helper.behaviourType.respondsToCallForHelp && helper.behaviourType.BehaviourHelperType.equals(mob.behaviourType)) {
|
||||||
helper.setCombatTarget(mob.getCombatTarget());
|
helper.setCombatTarget(mob.getCombatTarget());
|
||||||
callGotResponse = true;
|
callGotResponse = true;
|
||||||
}
|
}
|
||||||
@@ -606,10 +543,10 @@ public class MobAI {
|
|||||||
|
|
||||||
//override for guards
|
//override for guards
|
||||||
|
|
||||||
if (mob.despawned && mob.isPlayerGuard) {
|
if (mob.despawned && mob.isPlayerGuard()) {
|
||||||
|
|
||||||
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardMinion.ordinal()) {
|
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION)) {
|
||||||
if (mob.npcOwner.isAlive() == false || ((Mob) mob.npcOwner).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.ordinal() != Enum.MobBehaviourType.Pet1.ordinal())
|
if (!mob.agentType.equals(Enum.AIAgentType.PET))
|
||||||
CheckToSendMobHome(mob);
|
CheckToSendMobHome(mob);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -646,7 +583,7 @@ public class MobAI {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mob.BehaviourType.ordinal() != Enum.MobBehaviourType.Pet1.ordinal())
|
if (mob.agentType.equals(Enum.AIAgentType.PET) == false)
|
||||||
CheckToSendMobHome(mob);
|
CheckToSendMobHome(mob);
|
||||||
|
|
||||||
if (mob.getCombatTarget() != null) {
|
if (mob.getCombatTarget() != null) {
|
||||||
@@ -673,17 +610,16 @@ 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);
|
||||||
break;
|
break;
|
||||||
case Pet1:
|
case Pet1:
|
||||||
|
case SiegeEngine:
|
||||||
PetLogic(mob);
|
PetLogic(mob);
|
||||||
break;
|
break;
|
||||||
case HamletGuard:
|
case HamletGuard:
|
||||||
@@ -707,7 +643,7 @@ public class MobAI {
|
|||||||
if (!aiAgent.isAlive())
|
if (!aiAgent.isAlive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ConcurrentHashMap<Integer, Boolean> loadedPlayers = aiAgent.playerAgroMap;
|
ConcurrentHashMap<Integer, Float> loadedPlayers = aiAgent.playerAgroMap;
|
||||||
|
|
||||||
for (Entry playerEntry : loadedPlayers.entrySet()) {
|
for (Entry playerEntry : loadedPlayers.entrySet()) {
|
||||||
|
|
||||||
@@ -747,7 +683,6 @@ public class MobAI {
|
|||||||
aiAgent.setCombatTarget(loadedPlayer);
|
aiAgent.setCombatTarget(loadedPlayer);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aiAgent.getCombatTarget() == null) {
|
if (aiAgent.getCombatTarget() == null) {
|
||||||
@@ -782,47 +717,45 @@ public class MobAI {
|
|||||||
|
|
||||||
mob.updateLocation();
|
mob.updateLocation();
|
||||||
|
|
||||||
switch (mob.BehaviourType) {
|
switch (mob.behaviourType) {
|
||||||
|
|
||||||
case Pet1:
|
case Pet1:
|
||||||
if (mob.getOwner() == null)
|
|
||||||
|
if (mob.guardCaptain == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!mob.playerAgroMap.containsKey(mob.getOwner().getObjectUUID())) {
|
//mob no longer has its owner loaded, translate pet to owner
|
||||||
|
|
||||||
//mob no longer has its owner loaded, translocate pet to owner
|
if (!mob.playerAgroMap.containsKey(mob.guardCaptain.getObjectUUID())) {
|
||||||
|
MovementManager.translocate(mob, mob.guardCaptain.getLoc(), null);
|
||||||
MovementManager.translocate(mob, mob.getOwner().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.getOwner(), 6))
|
if (CombatUtilities.inRange2D(mob, mob.guardCaptain, 6))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mob.destination = mob.getOwner().getLoc();
|
mob.destination = 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.npcOwner.isAlive() || ((Mob) mob.npcOwner).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);
|
||||||
}
|
}
|
||||||
@@ -893,7 +826,8 @@ public class MobAI {
|
|||||||
if (mob.getCombatTarget() == null)
|
if (mob.getCombatTarget() == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter) && MovementUtilities.inRangeDropAggro(mob, (PlayerCharacter) mob.getCombatTarget()) == false && mob.BehaviourType.ordinal() != Enum.MobBehaviourType.Pet1.ordinal()) {
|
if (mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter) && MovementUtilities.inRangeDropAggro(mob, (PlayerCharacter) mob.getCombatTarget()) == false &&
|
||||||
|
mob.agentType.equals(Enum.AIAgentType.PET) == false) {
|
||||||
|
|
||||||
mob.setCombatTarget(null);
|
mob.setCombatTarget(null);
|
||||||
return;
|
return;
|
||||||
@@ -909,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.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal())
|
|
||||||
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;
|
||||||
@@ -932,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.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal() && 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -948,8 +875,8 @@ public class MobAI {
|
|||||||
PowersManager.useMobPower(mob, mob, recall, 40);
|
PowersManager.useMobPower(mob, mob, recall, 40);
|
||||||
mob.setCombatTarget(null);
|
mob.setCombatTarget(null);
|
||||||
|
|
||||||
for (Entry playerEntry : mob.playerAgroMap.entrySet())
|
for (Integer playerEntry : mob.playerAgroMap.keySet())
|
||||||
PlayerCharacter.getFromCache((int) playerEntry.getKey()).setHateValue(0);
|
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());
|
||||||
@@ -960,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);
|
||||||
@@ -1003,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))
|
||||||
@@ -1026,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)
|
||||||
@@ -1047,42 +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.npcOwner.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.npcOwner.getCombatTarget() != null)
|
|
||||||
mob.setCombatTarget(mob.npcOwner.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());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1102,11 +988,11 @@ public class MobAI {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (mob.getOwner() == 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");
|
||||||
|
|
||||||
if (MovementUtilities.canMove(mob) && mob.BehaviourType.canRoam)
|
if (MovementUtilities.canMove(mob) && mob.behaviourType.canRoam)
|
||||||
CheckMobMovement(mob);
|
CheckMobMovement(mob);
|
||||||
|
|
||||||
CheckForAttack(mob);
|
CheckForAttack(mob);
|
||||||
@@ -1156,7 +1042,7 @@ public class MobAI {
|
|||||||
if (mob.getCombatTarget() != null && mob.playerAgroMap.containsKey(mob.getCombatTarget().getObjectUUID()) == false)
|
if (mob.getCombatTarget() != null && mob.playerAgroMap.containsKey(mob.getCombatTarget().getObjectUUID()) == false)
|
||||||
mob.setCombatTarget(null);
|
mob.setCombatTarget(null);
|
||||||
|
|
||||||
if (mob.BehaviourType.isAgressive) {
|
if (mob.behaviourType.isAgressive) {
|
||||||
|
|
||||||
AbstractWorldObject newTarget = ChangeTargetFromHateValue(mob);
|
AbstractWorldObject newTarget = ChangeTargetFromHateValue(mob);
|
||||||
|
|
||||||
@@ -1164,7 +1050,7 @@ public class MobAI {
|
|||||||
mob.setCombatTarget(newTarget);
|
mob.setCombatTarget(newTarget);
|
||||||
else {
|
else {
|
||||||
if (mob.getCombatTarget() == null) {
|
if (mob.getCombatTarget() == null) {
|
||||||
if (mob.BehaviourType == Enum.MobBehaviourType.HamletGuard)
|
if (mob.behaviourType == Enum.MobBehaviourType.HamletGuard)
|
||||||
SafeGuardAggro(mob); //safehold guard
|
SafeGuardAggro(mob); //safehold guard
|
||||||
else
|
else
|
||||||
CheckForAggro(mob); //normal aggro
|
CheckForAggro(mob); //normal aggro
|
||||||
@@ -1174,12 +1060,12 @@ public class MobAI {
|
|||||||
|
|
||||||
//check if mob can move for patrol or moving to target
|
//check if mob can move for patrol or moving to target
|
||||||
|
|
||||||
if (mob.BehaviourType.canRoam)
|
if (mob.behaviourType.canRoam)
|
||||||
CheckMobMovement(mob);
|
CheckMobMovement(mob);
|
||||||
|
|
||||||
//check if mob can attack if it isn't wimpy
|
//check if mob can attack if it isn't wimpy
|
||||||
|
|
||||||
if (!mob.BehaviourType.isWimpy && mob.getCombatTarget() != null)
|
if (!mob.behaviourType.isWimpy && mob.getCombatTarget() != null)
|
||||||
CheckForAttack(mob);
|
CheckForAttack(mob);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -1196,7 +1082,16 @@ public class MobAI {
|
|||||||
if (!mob.isAlive())
|
if (!mob.isAlive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ConcurrentHashMap<Integer, Boolean> loadedPlayers = mob.playerAgroMap;
|
// Defer to captain if possible for current target
|
||||||
|
|
||||||
|
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION) &&
|
||||||
|
mob.guardCaptain.isAlive()
|
||||||
|
&& mob.guardCaptain.combatTarget != null) {
|
||||||
|
mob.setCombatTarget(mob.guardCaptain.combatTarget);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ConcurrentHashMap<Integer, Float> loadedPlayers = mob.playerAgroMap;
|
||||||
|
|
||||||
for (Entry playerEntry : loadedPlayers.entrySet()) {
|
for (Entry playerEntry : loadedPlayers.entrySet()) {
|
||||||
|
|
||||||
@@ -1241,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.ordinal() == Enum.MobBehaviourType.GuardMinion.ordinal()) {
|
|
||||||
if (((Mob) mob.npcOwner).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) {
|
||||||
@@ -1329,17 +1219,19 @@ public class MobAI {
|
|||||||
|
|
||||||
MovementUtilities.aiMove(mob, mob.destination, true);
|
MovementUtilities.aiMove(mob, mob.destination, true);
|
||||||
|
|
||||||
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal()) {
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1356,7 +1248,7 @@ public class MobAI {
|
|||||||
float CurrentHateValue = 0;
|
float CurrentHateValue = 0;
|
||||||
|
|
||||||
if (mob.getCombatTarget() != null && mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter))
|
if (mob.getCombatTarget() != null && mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter))
|
||||||
CurrentHateValue = ((PlayerCharacter) mob.getCombatTarget()).getHateValue();
|
CurrentHateValue = mob.playerAgroMap.get(mob.combatTarget.getObjectUUID()).floatValue();
|
||||||
|
|
||||||
AbstractWorldObject mostHatedTarget = null;
|
AbstractWorldObject mostHatedTarget = null;
|
||||||
|
|
||||||
@@ -1367,8 +1259,8 @@ public class MobAI {
|
|||||||
if (potentialTarget.equals(mob.getCombatTarget()))
|
if (potentialTarget.equals(mob.getCombatTarget()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (potentialTarget != null && potentialTarget.getHateValue() > CurrentHateValue && MovementUtilities.inRangeToAggro(mob, potentialTarget)) {
|
if (potentialTarget != null && mob.playerAgroMap.get(potentialTarget.getObjectUUID()).floatValue() > CurrentHateValue && MovementUtilities.inRangeToAggro(mob, potentialTarget)) {
|
||||||
CurrentHateValue = potentialTarget.getHateValue();
|
CurrentHateValue = mob.playerAgroMap.get(potentialTarget.getObjectUUID()).floatValue();
|
||||||
mostHatedTarget = potentialTarget;
|
mostHatedTarget = potentialTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public class CombatUtilities {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean inRange2D(AbstractWorldObject entity1, AbstractWorldObject entity2, double range) {
|
public static boolean inRange2D(AbstractWorldObject entity1, AbstractWorldObject entity2, double range) {
|
||||||
return entity1.getLoc().distance2D(entity2.getLoc()) < range;
|
return entity1.getLoc().distanceSquared2D(entity2.getLoc()) < range * range;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void swingIsBlock(Mob agent, AbstractWorldObject target, int animation) {
|
public static void swingIsBlock(Mob agent, AbstractWorldObject target, int animation) {
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ import engine.Enum;
|
|||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
import engine.Enum.ModType;
|
import engine.Enum.ModType;
|
||||||
import engine.Enum.SourceType;
|
import engine.Enum.SourceType;
|
||||||
import engine.mobileAI.Threads.MobAIThread;
|
|
||||||
import engine.exception.MsgSendException;
|
import engine.exception.MsgSendException;
|
||||||
import engine.gameManager.MovementManager;
|
import engine.gameManager.MovementManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
|
import engine.mobileAI.Threads.MobAIThread;
|
||||||
import engine.net.client.msg.MoveToPointMsg;
|
import engine.net.client.msg.MoveToPointMsg;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -38,7 +38,7 @@ public class MovementUtilities {
|
|||||||
if (agent.getContract() != null)
|
if (agent.getContract() != null)
|
||||||
guardCaptain = agent;
|
guardCaptain = agent;
|
||||||
else
|
else
|
||||||
guardCaptain = (Mob) agent.npcOwner;
|
guardCaptain = (Mob) agent.guardCaptain;
|
||||||
|
|
||||||
if (guardCaptain != null) {
|
if (guardCaptain != null) {
|
||||||
Building barracks = guardCaptain.building;
|
Building barracks = guardCaptain.building;
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import engine.gameManager.BuildingManager;
|
|||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.gameManager.NPCManager;
|
import engine.gameManager.NPCManager;
|
||||||
import engine.gameManager.SessionManager;
|
import engine.gameManager.SessionManager;
|
||||||
import engine.math.Vector3fImmutable;
|
|
||||||
import engine.net.Dispatch;
|
import engine.net.Dispatch;
|
||||||
import engine.net.DispatchMessage;
|
import engine.net.DispatchMessage;
|
||||||
import engine.net.client.ClientConnection;
|
import engine.net.client.ClientConnection;
|
||||||
@@ -16,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
|
||||||
@@ -27,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);
|
||||||
}
|
}
|
||||||
@@ -38,9 +32,9 @@ 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()) {
|
||||||
@@ -50,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.getSiegeMinionMap().containsKey(toRemove))
|
if (!npc.minions.contains(toRemove.getObjectUUID()))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
npc.getSiegeMinionMap().remove(toRemove);
|
npc.minions.remove(Integer.valueOf(toRemove.getObjectUUID()));
|
||||||
|
|
||||||
WorldGrid.RemoveWorldObject(toRemove);
|
WorldGrid.RemoveWorldObject(toRemove);
|
||||||
|
|
||||||
@@ -74,33 +69,35 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
toRemove.getParentZone().zoneMobSet.remove(toRemove);
|
toRemove.getParentZone().zoneMobSet.remove(toRemove);
|
||||||
|
|
||||||
DbManager.removeFromCache(toRemove);
|
DbManager.removeFromCache(toRemove);
|
||||||
PlayerCharacter petOwner = toRemove.getOwner();
|
|
||||||
|
if(toRemove.guardCaptain.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||||
|
PlayerCharacter petOwner = (PlayerCharacter) toRemove.guardCaptain;
|
||||||
|
|
||||||
if (petOwner != null) {
|
if (petOwner != null) {
|
||||||
petOwner.setPet(null);
|
petOwner.setPet(null);
|
||||||
toRemove.setOwner(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(petOwner, petMsg);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 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
|
||||||
@@ -115,7 +112,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (npc.getContractID() == 842)
|
if (npc.getContractID() == 842)
|
||||||
maxSlots = 1;
|
maxSlots = 1;
|
||||||
|
|
||||||
if (npc.getSiegeMinionMap().size() == maxSlots)
|
if (npc.minions.size() == maxSlots)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
int mobBase;
|
int mobBase;
|
||||||
@@ -146,47 +143,15 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (mobBase == 0)
|
if (mobBase == 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
Mob siegeMob = Mob.createSiegeMob(npc, mobBase, npc.getGuild(), zone, b.getLoc(), (short) 1);
|
Mob siegeMob = Mob.createSiegeMinion(npc, mobBase);
|
||||||
|
|
||||||
if (siegeMob == null)
|
if (siegeMob == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (siegeMob != null) {
|
|
||||||
|
|
||||||
siegeMob.setSpawnTime(60 * 15);
|
|
||||||
Building building = BuildingManager.getBuilding(((MinionTrainingMessage) baseMsg).getBuildingID());
|
|
||||||
|
|
||||||
siegeMob.building = building;
|
|
||||||
siegeMob.parentZone = zone;
|
|
||||||
|
|
||||||
// Slot siege minion
|
|
||||||
// Can be either corner tower or bulwark.
|
|
||||||
|
|
||||||
int slot;
|
|
||||||
|
|
||||||
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.ARTYTOWER))
|
|
||||||
slot = 2;
|
|
||||||
else
|
|
||||||
slot = ((NPC) siegeMob.npcOwner).getSiegeMinionMap().get(siegeMob) + 1; // First slot is for the captain
|
|
||||||
|
|
||||||
BuildingLocation slotLocation = BuildingManager._slotLocations.get(building.meshUUID).get(slot);
|
|
||||||
siegeMob.bindLoc = building.getLoc().add(slotLocation.getLocation());
|
|
||||||
|
|
||||||
// Rotate slot position by the building rotation
|
|
||||||
|
|
||||||
siegeMob.bindLoc = Vector3fImmutable.rotateAroundPoint(building.getLoc(), siegeMob.bindLoc, building.getBounds().getQuaternion().angleY);
|
|
||||||
|
|
||||||
siegeMob.loc = new Vector3fImmutable(siegeMob.bindLoc);
|
|
||||||
siegeMob.endLoc = new Vector3fImmutable(siegeMob.bindLoc);
|
|
||||||
|
|
||||||
zone.zoneMobSet.add(siegeMob);
|
|
||||||
siegeMob.setLoc(siegeMob.bindLoc);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
||||||
@@ -214,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);
|
||||||
|
|
||||||
@@ -228,17 +193,22 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
toRemove.getParentZone().zoneMobSet.remove(toRemove);
|
toRemove.getParentZone().zoneMobSet.remove(toRemove);
|
||||||
|
|
||||||
DbManager.removeFromCache(toRemove);
|
DbManager.removeFromCache(toRemove);
|
||||||
PlayerCharacter petOwner = toRemove.getOwner();
|
|
||||||
|
|
||||||
if (petOwner != null) {
|
if (toRemove.agentType.equals(Enum.AIAgentType.SIEGEENGINE)) {
|
||||||
petOwner.setPet(null);
|
|
||||||
toRemove.setOwner(null);
|
PlayerCharacter trebOwner = (PlayerCharacter) toRemove.guardCaptain;
|
||||||
|
|
||||||
|
if (trebOwner != null) {
|
||||||
|
trebOwner.setPet(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());
|
||||||
@@ -248,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
|
||||||
@@ -288,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();
|
||||||
@@ -298,14 +268,14 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
String pirateName = NPCManager.getPirateName(mobBase);
|
String pirateName = NPCManager.getPirateName(mobBase);
|
||||||
|
|
||||||
if (!DbManager.MobQueries.ADD_TO_GUARDS(npc.getObjectUUID(), mobBase, pirateName, npc.getSiegeMinionMap().size() + 1))
|
Mob toCreate = Mob.createGuardMinion(npc, npc.getLevel(), pirateName);
|
||||||
return true;
|
|
||||||
|
|
||||||
Mob toCreate = Mob.createGuardMob(npc, npc.getGuild(), zone, building.getLoc(), npc.getLevel(), pirateName);
|
|
||||||
|
|
||||||
if (toCreate == null)
|
if (toCreate == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if (!DbManager.MobQueries.ADD_TO_GUARDS(npc.getObjectUUID(), pirateName))
|
||||||
|
return true;
|
||||||
|
|
||||||
if (toCreate != null) {
|
if (toCreate != null) {
|
||||||
toCreate.setDeathTime(System.currentTimeMillis());
|
toCreate.setDeathTime(System.currentTimeMillis());
|
||||||
toCreate.parentZone.zoneMobSet.add(toCreate);
|
toCreate.parentZone.zoneMobSet.add(toCreate);
|
||||||
@@ -314,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) {
|
||||||
|
|||||||
@@ -212,10 +212,6 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (AbstractCharacter guard : building.getHirelings().keySet()) {
|
|
||||||
if (guard.getObjectType() == GameObjectType.Mob)
|
|
||||||
((Mob) guard).setPatrolPointIndex(0);
|
|
||||||
}
|
|
||||||
} else if (building.getPatrolPoints() != null)
|
} else if (building.getPatrolPoints() != null)
|
||||||
ClearPatrolPoints(building.getObjectUUID());
|
ClearPatrolPoints(building.getObjectUUID());
|
||||||
|
|
||||||
@@ -223,10 +219,6 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
AddSentryPoints(building.getObjectUUID(), orderNpcMsg.getSentryPoints());
|
AddSentryPoints(building.getObjectUUID(), orderNpcMsg.getSentryPoints());
|
||||||
} else if (building.getSentryPoints() != null)
|
} else if (building.getSentryPoints() != null)
|
||||||
ClearSentryPoints(building.getObjectUUID());
|
ClearSentryPoints(building.getObjectUUID());
|
||||||
|
|
||||||
// Dispatch dispatch = Dispatch.borrow(pc, msg);
|
|
||||||
// DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void processUpgradeNPC(PlayerCharacter player, AbstractCharacter abstractCharacter) {
|
private static void processUpgradeNPC(PlayerCharacter player, AbstractCharacter abstractCharacter) {
|
||||||
@@ -541,7 +533,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
} else if (orderNPCMsg.getObjectType() == GameObjectType.Mob.ordinal()) {
|
} else if (orderNPCMsg.getObjectType() == GameObjectType.Mob.ordinal()) {
|
||||||
|
|
||||||
mob = Mob.getFromCacheDBID(orderNPCMsg.getNpcUUID());
|
mob = Mob.getMob(orderNPCMsg.getNpcUUID());
|
||||||
|
|
||||||
if (mob == null)
|
if (mob == null)
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -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.getSiegeMinionMap();
|
|
||||||
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());
|
||||||
@@ -366,7 +368,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|||||||
long timeLife = upgradeTime - curTime;
|
long timeLife = upgradeTime - curTime;
|
||||||
|
|
||||||
if (upgradeTime * 1000 > System.currentTimeMillis()) {
|
if (upgradeTime * 1000 > System.currentTimeMillis()) {
|
||||||
if (mob.npcOwner.isAlive()) {
|
if (mob.guardCaptain.isAlive()) {
|
||||||
writer.put((byte) 0);//shows respawning timer
|
writer.put((byte) 0);//shows respawning timer
|
||||||
writer.putInt(mob.spawnTime);
|
writer.putInt(mob.spawnTime);
|
||||||
writer.putInt(mob.spawnTime);
|
writer.putInt(mob.spawnTime);
|
||||||
@@ -557,7 +559,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|||||||
|
|
||||||
} else if (this.targetType == GameObjectType.Mob.ordinal()) {
|
} else if (this.targetType == GameObjectType.Mob.ordinal()) {
|
||||||
|
|
||||||
mobA = Mob.getFromCacheDBID(this.targetID);
|
mobA = Mob.getMob(this.targetID);
|
||||||
|
|
||||||
if (mobA == null) {
|
if (mobA == null) {
|
||||||
Logger.error("Missing Mob of ID " + this.targetID);
|
Logger.error("Missing Mob of ID " + this.targetID);
|
||||||
@@ -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());
|
||||||
@@ -689,7 +692,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|||||||
long timeLife = upgradeTime - curTime;
|
long timeLife = upgradeTime - curTime;
|
||||||
|
|
||||||
if (upgradeTime * 1000 > System.currentTimeMillis()) {
|
if (upgradeTime * 1000 > System.currentTimeMillis()) {
|
||||||
if (mob.npcOwner.isAlive()) {
|
if (mob.guardCaptain.isAlive()) {
|
||||||
writer.put((byte) 0);//shows respawning timer
|
writer.put((byte) 0);//shows respawning timer
|
||||||
writer.putInt(mob.spawnTime);
|
writer.putInt(mob.spawnTime);
|
||||||
writer.putInt(mob.spawnTime);
|
writer.putInt(mob.spawnTime);
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -52,8 +53,8 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
public int contractUUID;
|
public int contractUUID;
|
||||||
public Contract contract;
|
public Contract contract;
|
||||||
|
|
||||||
protected String firstName;
|
public String firstName;
|
||||||
protected String lastName;
|
public String lastName;
|
||||||
protected short statStrCurrent;
|
protected short statStrCurrent;
|
||||||
protected short statDexCurrent;
|
protected short statDexCurrent;
|
||||||
protected short statConCurrent;
|
protected short statConCurrent;
|
||||||
@@ -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;
|
||||||
@@ -117,16 +118,35 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
protected boolean movingUp = false;
|
protected boolean movingUp = false;
|
||||||
private float desiredAltitude = 0;
|
private float desiredAltitude = 0;
|
||||||
private long takeOffTime = 0;
|
private long takeOffTime = 0;
|
||||||
private float hateValue = 0;
|
|
||||||
private long lastHateUpdate = 0;
|
private long lastHateUpdate = 0;
|
||||||
private boolean collided = false;
|
|
||||||
private byte aoecntr = 0;
|
private byte aoecntr = 0;
|
||||||
|
|
||||||
|
public int hidden = 0; // current rank of hide/sneak/invis
|
||||||
|
public CopyOnWriteArrayList<Integer> minions = new CopyOnWriteArrayList();
|
||||||
|
|
||||||
public AbstractCharacter() {
|
public AbstractCharacter() {
|
||||||
super();
|
super();
|
||||||
|
this.firstName = "";
|
||||||
|
this.lastName = "";
|
||||||
|
|
||||||
this.powers = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
this.statStrCurrent = (short) 0;
|
||||||
this.skills = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
this.statDexCurrent = (short) 0;
|
||||||
|
this.statConCurrent = (short) 0;
|
||||||
|
this.statIntCurrent = (short) 0;
|
||||||
|
this.statSpiCurrent = (short) 0;
|
||||||
|
|
||||||
|
this.unusedStatPoints = (short) 0;
|
||||||
|
|
||||||
|
this.level = (short) 0; // TODO get this from MobsBase later
|
||||||
|
this.exp = 1;
|
||||||
|
this.walkMode = true;
|
||||||
|
this.bindLoc = Vector3fImmutable.ZERO;
|
||||||
|
this.faceDir = Vector3fImmutable.ZERO;
|
||||||
|
|
||||||
|
this.runningTrains = (byte) 0;
|
||||||
|
|
||||||
|
this.skills = new ConcurrentHashMap<>();
|
||||||
|
this.powers = new ConcurrentHashMap<>();
|
||||||
this.initializeCharacter();
|
this.initializeCharacter();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -214,8 +234,6 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
this.skills = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
this.skills = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||||
this.initializeCharacter();
|
this.initializeCharacter();
|
||||||
|
|
||||||
// Dangerous to use THIS in a constructor!!!
|
|
||||||
this.charItemManager = new CharacterItemManager(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -258,8 +276,6 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
this.powers = new ConcurrentHashMap<>();
|
this.powers = new ConcurrentHashMap<>();
|
||||||
this.initializeCharacter();
|
this.initializeCharacter();
|
||||||
|
|
||||||
// Dangerous to use THIS in a constructor!!!
|
|
||||||
this.charItemManager = new CharacterItemManager(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -291,8 +307,6 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
this.powers = new ConcurrentHashMap<>();
|
this.powers = new ConcurrentHashMap<>();
|
||||||
initializeCharacter();
|
initializeCharacter();
|
||||||
|
|
||||||
// Dangerous to use THIS in a constructor!!!
|
|
||||||
this.charItemManager = new CharacterItemManager(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -342,9 +356,6 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
this.powers = new ConcurrentHashMap<>();
|
this.powers = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
this.initializeCharacter();
|
this.initializeCharacter();
|
||||||
|
|
||||||
// Dangerous to use THIS in a constructor!!!
|
|
||||||
this.charItemManager = new CharacterItemManager(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getBankCapacity() {
|
public static int getBankCapacity() {
|
||||||
@@ -1096,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()) {
|
||||||
@@ -1113,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() {
|
||||||
@@ -1758,29 +1772,6 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
this.inBuildingID = inBuildingID;
|
this.inBuildingID = inBuildingID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getHateValue() {
|
|
||||||
if (this.hateValue <= 0) {
|
|
||||||
this.hateValue = 0;
|
|
||||||
return hateValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.lastHateUpdate == 0) {
|
|
||||||
this.lastHateUpdate = System.currentTimeMillis();
|
|
||||||
return this.hateValue;
|
|
||||||
}
|
|
||||||
long duration = System.currentTimeMillis() - this.lastHateUpdate;
|
|
||||||
//convert duration to seconds and multiply Hate Delimiter.
|
|
||||||
float modAmount = duration / 1000 * MBServerStatics.PLAYER_HATE_DELIMITER;
|
|
||||||
this.hateValue -= modAmount;
|
|
||||||
this.lastHateUpdate = System.currentTimeMillis();
|
|
||||||
return this.hateValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHateValue(float hateValue) {
|
|
||||||
this.lastHateUpdate = System.currentTimeMillis();
|
|
||||||
this.hateValue = hateValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getInFloorID() {
|
public int getInFloorID() {
|
||||||
return inFloorID;
|
return inFloorID;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
package engine.objects;
|
package engine.objects;
|
||||||
|
|
||||||
|
import ch.claude_martin.enumbitset.EnumBitSet;
|
||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
import engine.Enum.ModType;
|
import engine.Enum.ModType;
|
||||||
@@ -32,6 +33,19 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
|
|||||||
public boolean assist = false;
|
public boolean assist = false;
|
||||||
public Enum.AIAgentType agentType = Enum.AIAgentType.MOBILE;
|
public Enum.AIAgentType agentType = Enum.AIAgentType.MOBILE;
|
||||||
|
|
||||||
|
public AbstractCharacter guardCaptain;
|
||||||
|
public EnumBitSet<Enum.MonsterType> notEnemy = EnumBitSet.noneOf(Enum.MonsterType.class);
|
||||||
|
public EnumBitSet<Enum.MonsterType> enemy = EnumBitSet.noneOf(Enum.MonsterType.class);
|
||||||
|
;
|
||||||
|
public Enum.MobBehaviourType behaviourType;
|
||||||
|
public ArrayList<Vector3fImmutable> patrolPoints;
|
||||||
|
public int lastPatrolPointIndex = 0;
|
||||||
|
public long stopPatrolTime = 0;
|
||||||
|
public City guardedCity;
|
||||||
|
|
||||||
|
public AbstractIntelligenceAgent() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
public AbstractIntelligenceAgent(ResultSet rs) throws SQLException {
|
public AbstractIntelligenceAgent(ResultSet rs) throws SQLException {
|
||||||
super(rs);
|
super(rs);
|
||||||
@@ -87,7 +101,8 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
|
|||||||
this.agentType = Enum.AIAgentType.CHARMED;
|
this.agentType = Enum.AIAgentType.CHARMED;
|
||||||
|
|
||||||
if (this.getObjectType().equals(GameObjectType.Mob)) {
|
if (this.getObjectType().equals(GameObjectType.Mob)) {
|
||||||
((Mob) this).setOwner(owner);
|
|
||||||
|
((Mob) this).guardCaptain = owner;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,14 +125,6 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerCharacter getOwner() {
|
|
||||||
|
|
||||||
if (this.getObjectType().equals(GameObjectType.Mob))
|
|
||||||
return this.getOwner();
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getSafeZone() {
|
public boolean getSafeZone() {
|
||||||
|
|
||||||
ArrayList<Zone> allIn = ZoneManager.getAllZonesIn(this.getLoc());
|
ArrayList<Zone> allIn = ZoneManager.getAllZonesIn(this.getLoc());
|
||||||
@@ -156,9 +163,11 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
|
|||||||
this.setCombatTarget(null);
|
this.setCombatTarget(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
//clear owner
|
// clear owner and set not alive
|
||||||
|
|
||||||
PlayerCharacter owner = this.getOwner();
|
this.isAlive.set(false);
|
||||||
|
|
||||||
|
PlayerCharacter owner = (PlayerCharacter) this.guardCaptain;
|
||||||
|
|
||||||
//close pet window
|
//close pet window
|
||||||
|
|
||||||
@@ -174,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).setOwner(null);
|
this.guardCaptain = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -357,7 +357,9 @@ public abstract class AbstractWorldObject extends AbstractGameObject {
|
|||||||
Mob mob = (Mob) this;
|
Mob mob = (Mob) this;
|
||||||
if (mob.isSiege()) {
|
if (mob.isSiege()) {
|
||||||
if (mob.isPet()) {
|
if (mob.isPet()) {
|
||||||
PlayerCharacter petOwner = mob.getOwner();
|
|
||||||
|
|
||||||
|
PlayerCharacter petOwner = (PlayerCharacter) mob.guardCaptain;
|
||||||
if (petOwner != null && source.equals(EffectSourceType.Effect)) {
|
if (petOwner != null && source.equals(EffectSourceType.Effect)) {
|
||||||
petOwner.dismissPet();
|
petOwner.dismissPet();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+389
-772
File diff suppressed because it is too large
Load Diff
@@ -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;}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-17
@@ -50,7 +50,6 @@ public class NPC extends AbstractCharacter {
|
|||||||
// Used for thread safety
|
// Used for thread safety
|
||||||
public final ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
|
public final ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
|
||||||
private final ArrayList<MobLoot> rolling = new ArrayList<>();
|
private final ArrayList<MobLoot> rolling = new ArrayList<>();
|
||||||
private final ConcurrentHashMap<Mob, Integer> siegeMinionMap = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
|
||||||
public ReentrantReadWriteLock minionLock = new ReentrantReadWriteLock();
|
public ReentrantReadWriteLock minionLock = new ReentrantReadWriteLock();
|
||||||
public ArrayList<ProducedItem> forgedItems = new ArrayList<>();
|
public ArrayList<ProducedItem> forgedItems = new ArrayList<>();
|
||||||
public HashMap<Integer, MobEquipment> equip = null;
|
public HashMap<Integer, MobEquipment> equip = null;
|
||||||
@@ -86,6 +85,7 @@ public class NPC extends AbstractCharacter {
|
|||||||
|
|
||||||
public NPC() {
|
public NPC() {
|
||||||
|
|
||||||
|
super();
|
||||||
this.dbID = MBServerStatics.NO_DB_ROW_ASSIGNED_YET;
|
this.dbID = MBServerStatics.NO_DB_ROW_ASSIGNED_YET;
|
||||||
this.currentID = MBServerStatics.NO_DB_ROW_ASSIGNED_YET;
|
this.currentID = MBServerStatics.NO_DB_ROW_ASSIGNED_YET;
|
||||||
}
|
}
|
||||||
@@ -640,26 +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 = toRemove.getOwner();
|
|
||||||
|
PlayerCharacter petOwner = (PlayerCharacter) minionMob.guardCaptain;
|
||||||
|
|
||||||
if (petOwner != null) {
|
if (petOwner != null) {
|
||||||
|
|
||||||
petOwner.setPet(null);
|
petOwner.setPet(null);
|
||||||
toRemove.setOwner(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);
|
||||||
@@ -667,6 +672,7 @@ public class NPC extends AbstractCharacter {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -805,6 +811,8 @@ public class NPC extends AbstractCharacter {
|
|||||||
@Override
|
@Override
|
||||||
public void runAfterLoad() {
|
public void runAfterLoad() {
|
||||||
|
|
||||||
|
this.charItemManager = new CharacterItemManager(this);
|
||||||
|
|
||||||
if (ConfigManager.serverType.equals(ServerType.LOGINSERVER))
|
if (ConfigManager.serverType.equals(ServerType.LOGINSERVER))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -846,10 +854,6 @@ public class NPC extends AbstractCharacter {
|
|||||||
if (wordCount(this.name) < 2 && this.contract != null)
|
if (wordCount(this.name) < 2 && this.contract != null)
|
||||||
this.name += " the " + this.contract.getName();
|
this.name += " the " + this.contract.getName();
|
||||||
|
|
||||||
// Initialize inventory
|
|
||||||
|
|
||||||
this.charItemManager = new CharacterItemManager(this);
|
|
||||||
|
|
||||||
// Configure parent zone adding this NPC to the
|
// Configure parent zone adding this NPC to the
|
||||||
// zone collection
|
// zone collection
|
||||||
|
|
||||||
@@ -1103,10 +1107,6 @@ public class NPC extends AbstractCharacter {
|
|||||||
return (int) time;
|
return (int) time;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConcurrentHashMap<Mob, Integer> getSiegeMinionMap() {
|
|
||||||
return siegeMinionMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean remove() {
|
public boolean remove() {
|
||||||
|
|
||||||
Building building;
|
Building building;
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -144,7 +143,6 @@ public class PlayerCharacter extends AbstractCharacter {
|
|||||||
private long lastUpdateTime = System.currentTimeMillis();
|
private long lastUpdateTime = System.currentTimeMillis();
|
||||||
private long lastStamUpdateTime = System.currentTimeMillis();
|
private long lastStamUpdateTime = System.currentTimeMillis();
|
||||||
private boolean safeZone = false;
|
private boolean safeZone = false;
|
||||||
private int bindBuildingID;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
DataWarehouse based kill/death tracking.
|
DataWarehouse based kill/death tracking.
|
||||||
@@ -205,15 +203,18 @@ public class PlayerCharacter extends AbstractCharacter {
|
|||||||
this.spiMod.set(spiMod);
|
this.spiMod.set(spiMod);
|
||||||
|
|
||||||
this.guildStatus = new AtomicInteger(0);
|
this.guildStatus = new AtomicInteger(0);
|
||||||
this.bindBuildingID = -1;
|
this.buildingUUID = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ResultSet Constructor
|
* ResultSet Constructor
|
||||||
*/
|
*/
|
||||||
public PlayerCharacter(ResultSet rs) throws SQLException {
|
public PlayerCharacter(ResultSet rs) throws SQLException {
|
||||||
|
|
||||||
super(rs, true);
|
super(rs, true);
|
||||||
|
|
||||||
|
this.charItemManager = new CharacterItemManager(this);
|
||||||
|
|
||||||
this.runes = DbManager.CharacterRuneQueries.GET_RUNES_FOR_CHARACTER(this.getObjectUUID());
|
this.runes = DbManager.CharacterRuneQueries.GET_RUNES_FOR_CHARACTER(this.getObjectUUID());
|
||||||
int accountID = rs.getInt("parent");
|
int accountID = rs.getInt("parent");
|
||||||
this.account = DbManager.AccountQueries.GET_ACCOUNT(accountID);
|
this.account = DbManager.AccountQueries.GET_ACCOUNT(accountID);
|
||||||
@@ -265,7 +266,7 @@ public class PlayerCharacter extends AbstractCharacter {
|
|||||||
this.intMod.set(rs.getShort("char_intMod"));
|
this.intMod.set(rs.getShort("char_intMod"));
|
||||||
this.spiMod.set(rs.getShort("char_spiMod"));
|
this.spiMod.set(rs.getShort("char_spiMod"));
|
||||||
|
|
||||||
this.bindBuildingID = rs.getInt("char_bindBuilding");
|
this.buildingUUID = rs.getInt("char_bindBuilding");
|
||||||
|
|
||||||
this.hash = rs.getString("hash");
|
this.hash = rs.getString("hash");
|
||||||
|
|
||||||
@@ -2721,12 +2722,12 @@ public class PlayerCharacter extends AbstractCharacter {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public synchronized int getBindBuildingID() {
|
public synchronized int getBindBuildingID() {
|
||||||
return this.bindBuildingID;
|
return this.buildingUUID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void setBindBuildingID(int value) {
|
public synchronized void setBindBuildingID(int value) {
|
||||||
DbManager.PlayerCharacterQueries.SET_BIND_BUILDING(this, value);
|
DbManager.PlayerCharacterQueries.SET_BIND_BUILDING(this, value);
|
||||||
this.bindBuildingID = value;
|
this.buildingUUID = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AbstractGameObject getLastTarget() {
|
public AbstractGameObject getLastTarget() {
|
||||||
@@ -2772,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;
|
||||||
}
|
}
|
||||||
@@ -4561,10 +4558,6 @@ public class PlayerCharacter extends AbstractCharacter {
|
|||||||
@Override
|
@Override
|
||||||
public void runAfterLoad() {
|
public void runAfterLoad() {
|
||||||
|
|
||||||
// Init inventory
|
|
||||||
|
|
||||||
this.charItemManager = new CharacterItemManager(this);
|
|
||||||
|
|
||||||
Bounds playerBounds = Bounds.borrow();
|
Bounds playerBounds = Bounds.borrow();
|
||||||
playerBounds.setBounds(this.getLoc());
|
playerBounds.setBounds(this.getLoc());
|
||||||
this.setBounds(playerBounds);
|
this.setBounds(playerBounds);
|
||||||
@@ -4692,7 +4685,8 @@ public class PlayerCharacter extends AbstractCharacter {
|
|||||||
|
|
||||||
} else if (currentPet.isSiege()) {
|
} else if (currentPet.isSiege()) {
|
||||||
currentPet.agentType = AIAgentType.MOBILE;
|
currentPet.agentType = AIAgentType.MOBILE;
|
||||||
currentPet.setOwner(null);
|
|
||||||
|
currentPet.guardCaptain = null;
|
||||||
currentPet.setCombatTarget(null);
|
currentPet.setCombatTarget(null);
|
||||||
if (currentPet.isAlive())
|
if (currentPet.isAlive())
|
||||||
WorldGrid.updateObject(currentPet);
|
WorldGrid.updateObject(currentPet);
|
||||||
|
|||||||
@@ -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");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -11,6 +11,7 @@ package engine.powers.poweractions;
|
|||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
import engine.Enum.ModType;
|
import engine.Enum.ModType;
|
||||||
import engine.Enum.SourceType;
|
import engine.Enum.SourceType;
|
||||||
|
import engine.InterestManagement.WorldGrid;
|
||||||
import engine.gameManager.ChatManager;
|
import engine.gameManager.ChatManager;
|
||||||
import engine.jobs.ChantJob;
|
import engine.jobs.ChantJob;
|
||||||
import engine.jobs.DeferredPowerJob;
|
import engine.jobs.DeferredPowerJob;
|
||||||
@@ -22,6 +23,7 @@ import engine.objects.*;
|
|||||||
import engine.powers.ActionsBase;
|
import engine.powers.ActionsBase;
|
||||||
import engine.powers.EffectsBase;
|
import engine.powers.EffectsBase;
|
||||||
import engine.powers.PowersBase;
|
import engine.powers.PowersBase;
|
||||||
|
import engine.server.MBServerStatics;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
@@ -117,20 +119,12 @@ public class ApplyEffectPowerAction extends AbstractPowerAction {
|
|||||||
awo.addEffect(stackType, duration, eff, effect, trains);
|
awo.addEffect(stackType, duration, eff, effect, trains);
|
||||||
} else
|
} else
|
||||||
awo.applyAllBonuses();
|
awo.applyAllBonuses();
|
||||||
// //TODO if chant, start cycle
|
|
||||||
// if (pb.isChant() && source.equals(awo)) {
|
|
||||||
// ChantJob cj = new ChantJob(source, awo, stackType, trains, ab, pb, effect, eff);
|
|
||||||
// source.setLastChant((int)(pb.getChantDuration()-2) * 1000, cj);
|
|
||||||
// eff.setChant(true);
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (this.effectID.equals("TAUNT")) {
|
if (this.effectID.equals("TAUNT")) {
|
||||||
|
|
||||||
if (awo != null && awo.getObjectType() == GameObjectType.Mob) {
|
if (awo != null && awo.getObjectType() == GameObjectType.Mob) {
|
||||||
((Mob) awo).setCombatTarget(source);
|
|
||||||
ChatSystemMsg msg = ChatManager.CombatInfo(source, awo);
|
ChatSystemMsg msg = ChatManager.CombatInfo(source, awo);
|
||||||
DispatchMessage.sendToAllInRange(source, msg);
|
DispatchMessage.sendToAllInRange(source, msg);
|
||||||
((Mob)awo).refresh();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (awo != null && awo.getObjectType() == GameObjectType.Mob) {
|
if (awo != null && awo.getObjectType() == GameObjectType.Mob) {
|
||||||
@@ -140,8 +134,22 @@ public class ApplyEffectPowerAction extends AbstractPowerAction {
|
|||||||
}
|
}
|
||||||
this.effect.startEffect(source, awo, trains, eff);
|
this.effect.startEffect(source, awo, trains, eff);
|
||||||
}
|
}
|
||||||
|
//apply effects to mobs within range for chants
|
||||||
|
if(pb.isChant){
|
||||||
|
for(AbstractGameObject ago : WorldGrid.getObjectsInRangePartial(awo.loc,pb.range, MBServerStatics.MASK_MOB)){
|
||||||
|
Mob mob = (Mob)ago;
|
||||||
|
if(mob.playerAgroMap.containsKey(source.getObjectUUID()))
|
||||||
|
mob.playerAgroMap.put(source.getObjectUUID(), mob.playerAgroMap.get(source.getObjectUUID()).floatValue() + pb.hateValue);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
if (awo != null && awo.getObjectType() == GameObjectType.Mob) {
|
||||||
|
Mob mob = (Mob) awo;
|
||||||
|
if (mob.playerAgroMap.containsKey(source.getObjectUUID()))
|
||||||
|
mob.playerAgroMap.put(source.getObjectUUID(), mob.playerAgroMap.get(source.getObjectUUID()).floatValue() + pb.hateValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected void _applyEffectForItem(Item item, int trains) {
|
protected void _applyEffectForItem(Item item, int trains) {
|
||||||
if (item == null || this.effect == null)
|
if (item == null || this.effect == null)
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ package engine.powers.poweractions;
|
|||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
import engine.InterestManagement.WorldGrid;
|
import engine.InterestManagement.WorldGrid;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.gameManager.MovementManager;
|
|
||||||
import engine.gameManager.NPCManager;
|
import engine.gameManager.NPCManager;
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
@@ -75,7 +74,7 @@ public class CreateMobPowerAction extends AbstractPowerAction {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
//create Pet
|
//create Pet
|
||||||
Mob pet = Mob.createPet(mobID, guild, seaFloor, owner, (short) mobLevel);
|
Mob pet = Mob.createPetMinion(mobID, seaFloor, owner, (short) mobLevel);
|
||||||
|
|
||||||
|
|
||||||
if (pet.getMobBaseID() == 12021 || pet.getMobBaseID() == 12022) { //is a necro pet
|
if (pet.getMobBaseID() == 12021 || pet.getMobBaseID() == 12022) { //is a necro pet
|
||||||
@@ -84,8 +83,6 @@ public class CreateMobPowerAction extends AbstractPowerAction {
|
|||||||
WorldGrid.RemoveWorldObject(currentPet);
|
WorldGrid.RemoveWorldObject(currentPet);
|
||||||
currentPet.setCombatTarget(null);
|
currentPet.setCombatTarget(null);
|
||||||
|
|
||||||
//if (currentPet.getParentZone() != null)
|
|
||||||
//currentPet.getParentZone().zoneMobSet.remove(currentPet);
|
|
||||||
seaFloor.zoneMobSet.remove(currentPet);
|
seaFloor.zoneMobSet.remove(currentPet);
|
||||||
currentPet.playerAgroMap.clear();
|
currentPet.playerAgroMap.clear();
|
||||||
|
|
||||||
@@ -95,10 +92,10 @@ public class CreateMobPowerAction extends AbstractPowerAction {
|
|||||||
Logger.error(e.getMessage());
|
Logger.error(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
//currentPet.disableIntelligence();
|
|
||||||
} else if (currentPet != null && currentPet.isSiege()) {
|
} else if (currentPet != null && currentPet.isSiege()) {
|
||||||
currentPet.agentType = Enum.AIAgentType.MOBILE;
|
currentPet.agentType = Enum.AIAgentType.MOBILE;
|
||||||
currentPet.setOwner(null);
|
|
||||||
|
currentPet.guardCaptain = null;
|
||||||
currentPet.setCombatTarget(null);
|
currentPet.setCombatTarget(null);
|
||||||
|
|
||||||
if (currentPet.isAlive())
|
if (currentPet.isAlive())
|
||||||
@@ -106,7 +103,6 @@ public class CreateMobPowerAction extends AbstractPowerAction {
|
|||||||
}
|
}
|
||||||
//remove 10th pet
|
//remove 10th pet
|
||||||
|
|
||||||
|
|
||||||
NPCManager.spawnNecroPet(owner, pet);
|
NPCManager.spawnNecroPet(owner, pet);
|
||||||
|
|
||||||
} else { //is not a necro pet
|
} else { //is not a necro pet
|
||||||
@@ -115,7 +111,7 @@ public class CreateMobPowerAction extends AbstractPowerAction {
|
|||||||
DbManager.removeFromCache(currentPet);
|
DbManager.removeFromCache(currentPet);
|
||||||
currentPet.setCombatTarget(null);
|
currentPet.setCombatTarget(null);
|
||||||
|
|
||||||
currentPet.setOwner(null);
|
currentPet.guardCaptain = null;
|
||||||
WorldGrid.RemoveWorldObject(currentPet);
|
WorldGrid.RemoveWorldObject(currentPet);
|
||||||
//currentPet.getParentZone().zoneMobSet.remove(currentPet);
|
//currentPet.getParentZone().zoneMobSet.remove(currentPet);
|
||||||
seaFloor.zoneMobSet.remove(currentPet);
|
seaFloor.zoneMobSet.remove(currentPet);
|
||||||
@@ -125,7 +121,8 @@ public class CreateMobPowerAction extends AbstractPowerAction {
|
|||||||
} else {
|
} else {
|
||||||
if (currentPet.isSiege()) {
|
if (currentPet.isSiege()) {
|
||||||
currentPet.agentType = Enum.AIAgentType.MOBILE;
|
currentPet.agentType = Enum.AIAgentType.MOBILE;
|
||||||
currentPet.setOwner(null);
|
|
||||||
|
currentPet.guardCaptain = null;
|
||||||
currentPet.setCombatTarget(null);
|
currentPet.setCombatTarget(null);
|
||||||
|
|
||||||
if (currentPet.isAlive())
|
if (currentPet.isAlive())
|
||||||
@@ -137,26 +134,9 @@ public class CreateMobPowerAction extends AbstractPowerAction {
|
|||||||
NPCManager.resetNecroPets(owner);
|
NPCManager.resetNecroPets(owner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* if(owner.getPet() != null) {
|
|
||||||
if(owner.getPet().getMobBaseID() != 12021 && owner.getPet().getMobBaseID() != 12022) {
|
|
||||||
//if not a necro pet, remove pet
|
|
||||||
WorldGrid.removeWorldObject(owner.getPet());
|
|
||||||
owner.getPet().disableIntelligence();
|
|
||||||
Mob.removePet(owner.getPet().getUUID());
|
|
||||||
owner.setPet(null);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//if it is a necro pet, add it to the line and set as mob
|
|
||||||
owner.getPet().setMob();
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// if (mobID == 12021 || mobID == 12022) //Necro Pets
|
|
||||||
// pet.setPet(owner, true);
|
|
||||||
owner.setPet(pet);
|
owner.setPet(pet);
|
||||||
if(pet.isSiege() == false) {
|
|
||||||
MovementManager.translocate(pet, owner.getLoc(), owner.region);
|
|
||||||
}
|
|
||||||
pet.recalculateStats();
|
pet.recalculateStats();
|
||||||
pet.healthMax = pet.level * 0.5f * 120;
|
pet.healthMax = pet.level * 0.5f * 120;
|
||||||
pet.setHealth(pet.healthMax);
|
pet.setHealth(pet.healthMax);
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class FearPowerAction extends AbstractPowerAction {
|
|||||||
int duration = 10 + ((int) (trains * 0.5));
|
int duration = 10 + ((int) (trains * 0.5));
|
||||||
String stackType = ab.getStackType();
|
String stackType = ab.getStackType();
|
||||||
EndFearJob efj = new EndFearJob(source, awo, stackType, trains, ab, pb, null);
|
EndFearJob efj = new EndFearJob(source, awo, stackType, trains, ab, pb, null);
|
||||||
((Mob) awo).setFearedObject(source);
|
((Mob) awo).fearedObject = source;
|
||||||
JobScheduler.getInstance().scheduleJob(efj, duration * 1000);
|
JobScheduler.getInstance().scheduleJob(efj, duration * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
package engine.server.world;
|
package engine.server.world;
|
||||||
|
|
||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
import engine.Enum.BuildingGroup;
|
|
||||||
import engine.Enum.DispatchChannel;
|
import engine.Enum.DispatchChannel;
|
||||||
import engine.Enum.MinionType;
|
import engine.Enum.MinionType;
|
||||||
import engine.Enum.SupportMsgType;
|
import engine.Enum.SupportMsgType;
|
||||||
@@ -18,6 +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.dbRuneBaseHandler;
|
||||||
import engine.exception.MsgSendException;
|
import engine.exception.MsgSendException;
|
||||||
import engine.gameManager.*;
|
import engine.gameManager.*;
|
||||||
import engine.job.JobContainer;
|
import engine.job.JobContainer;
|
||||||
@@ -334,7 +334,7 @@ public class WorldServer {
|
|||||||
DbManager.PromotionQueries.GET_ALL_PROMOTIONS();
|
DbManager.PromotionQueries.GET_ALL_PROMOTIONS();
|
||||||
|
|
||||||
Logger.info("Loading NPC and Mob Rune Sets");
|
Logger.info("Loading NPC and Mob Rune Sets");
|
||||||
NPCManager.LoadAllRuneSets();
|
NPCManager._runeSetMap = DbManager.ItemBaseQueries.LOAD_RUNES_FOR_NPC_AND_MOBS();
|
||||||
|
|
||||||
Logger.info("Loading Booty Sets");
|
Logger.info("Loading Booty Sets");
|
||||||
LootManager._bootySetMap = DbManager.LootQueries.LOAD_BOOTY_TABLES();
|
LootManager._bootySetMap = DbManager.LootQueries.LOAD_BOOTY_TABLES();
|
||||||
@@ -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 = DbManager.PowerQueries.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();
|
||||||
@@ -551,44 +554,40 @@ public class WorldServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Set sea floor object for server
|
//Set sea floor object for server
|
||||||
|
|
||||||
Zone seaFloor = rootParent.get(0);
|
Zone seaFloor = rootParent.get(0);
|
||||||
seaFloor.setParent(null);
|
seaFloor.setParent(null);
|
||||||
ZoneManager.setSeaFloor(seaFloor);
|
ZoneManager.setSeaFloor(seaFloor);
|
||||||
|
|
||||||
// zoneManager.addZone(seaFloor.getLoadNum(), seaFloor); <- DIE IN A FUCKING CAR FIRE BONUS CODE LIKE THIS SUCKS FUCKING DICK
|
|
||||||
|
|
||||||
rootParent.addAll(DbManager.ZoneQueries.GET_ALL_NODES(seaFloor));
|
rootParent.addAll(DbManager.ZoneQueries.GET_ALL_NODES(seaFloor));
|
||||||
|
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
|
|
||||||
for (Zone zone : rootParent) {
|
for (Zone zone : rootParent) {
|
||||||
|
|
||||||
try {
|
|
||||||
ZoneManager.addZone(zone.getLoadNum(), zone);
|
ZoneManager.addZone(zone.getLoadNum(), zone);
|
||||||
|
|
||||||
try {
|
|
||||||
zone.generateWorldAltitude();
|
zone.generateWorldAltitude();
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.error(e.getMessage());
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
//Handle Buildings
|
//Handle Buildings
|
||||||
|
|
||||||
|
try {
|
||||||
ArrayList<Building> bList;
|
ArrayList<Building> bList;
|
||||||
bList = DbManager.BuildingQueries.GET_ALL_BUILDINGS_FOR_ZONE(zone);
|
bList = DbManager.BuildingQueries.GET_ALL_BUILDINGS_FOR_ZONE(zone);
|
||||||
|
|
||||||
for (Building b : bList) {
|
for (Building b : bList) {
|
||||||
|
|
||||||
try {
|
|
||||||
b.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
|
b.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
|
||||||
b.setLoc(b.getLoc());
|
b.setLoc(b.getLoc());
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.error(b.getObjectUUID() + " returned an Error Message :" + e.getMessage());
|
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.error(e);
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Handle Mobs
|
//Handle Mobs
|
||||||
|
|
||||||
|
try {
|
||||||
ArrayList<Mob> mobs;
|
ArrayList<Mob> mobs;
|
||||||
mobs = DbManager.MobQueries.GET_ALL_MOBS_FOR_ZONE(zone);
|
mobs = DbManager.MobQueries.GET_ALL_MOBS_FOR_ZONE(zone);
|
||||||
|
|
||||||
@@ -596,15 +595,22 @@ public class WorldServer {
|
|||||||
m.setObjectTypeMask(MBServerStatics.MASK_MOB | m.getTypeMasks());
|
m.setObjectTypeMask(MBServerStatics.MASK_MOB | m.getTypeMasks());
|
||||||
m.setLoc(m.getLoc());
|
m.setLoc(m.getLoc());
|
||||||
|
|
||||||
//ADD GUARDS HERE.
|
// Load Minions for Guard Captains here.
|
||||||
if (m.building != null && m.building.getBlueprint() != null && m.building.getBlueprint().getBuildingGroup() == BuildingGroup.BARRACK)
|
|
||||||
DbManager.MobQueries.LOAD_PATROL_POINTS(m);
|
if (m.building != null && m.building.getBlueprint() != null && m.building.getBlueprint().getBuildingGroup() == Enum.BuildingGroup.BARRACK)
|
||||||
|
DbManager.MobQueries.LOAD_GUARD_MINIONS(m);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.error(e);
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Handle npc's
|
//Handle NPCs
|
||||||
|
|
||||||
|
try {
|
||||||
ArrayList<NPC> npcs;
|
ArrayList<NPC> npcs;
|
||||||
|
|
||||||
// Ignore npc's on the seafloor (npc guild leaders, etc)
|
// Ignore NPCs on the seafloor (npc guild leaders, etc)
|
||||||
|
|
||||||
if (zone.equals(seaFloor))
|
if (zone.equals(seaFloor))
|
||||||
continue;
|
continue;
|
||||||
@@ -612,26 +618,22 @@ public class WorldServer {
|
|||||||
npcs = DbManager.NPCQueries.GET_ALL_NPCS_FOR_ZONE(zone);
|
npcs = DbManager.NPCQueries.GET_ALL_NPCS_FOR_ZONE(zone);
|
||||||
|
|
||||||
for (NPC n : npcs) {
|
for (NPC n : npcs) {
|
||||||
|
|
||||||
try {
|
|
||||||
n.setObjectTypeMask(MBServerStatics.MASK_NPC);
|
n.setObjectTypeMask(MBServerStatics.MASK_NPC);
|
||||||
n.setLoc(n.getLoc());
|
n.setLoc(n.getLoc());
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.error(n.getObjectUUID() + " returned an Error Message :" + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.error(e);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
//Handle cities
|
//Handle cities
|
||||||
|
|
||||||
ZoneManager.loadCities(zone);
|
ZoneManager.loadCities(zone);
|
||||||
ZoneManager.populateWorldZones(zone);
|
ZoneManager.populateWorldZones(zone);
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.info(e.getMessage() + zone.getName() + ' ' + zone.getObjectUUID());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.info("time to load: " + (System.currentTimeMillis() - start) + " ms");
|
Logger.info("time to load World Objects: " + (System.currentTimeMillis() - start) + " ms");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user