Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 221ae0a58b | |||
| 3649c629b7 | |||
| 1c31070fc8 | |||
| bff41967db | |||
| d3692d0fb7 | |||
| 074a799d01 | |||
| 36ffd08a72 | |||
| 58f828b3cd |
+9
-11
@@ -2822,6 +2822,7 @@ 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),
|
||||||
@@ -2846,7 +2847,6 @@ 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,12 +2857,13 @@ 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);
|
||||||
|
|
||||||
public final MobBehaviourType BehaviourHelperType;
|
private static HashMap<Integer, MobBehaviourType> _behaviourTypes = new HashMap<>();
|
||||||
public final boolean isWimpy;
|
public MobBehaviourType BehaviourHelperType;
|
||||||
public final boolean isAgressive;
|
public boolean isWimpy;
|
||||||
public final boolean canRoam;
|
public boolean isAgressive;
|
||||||
public final boolean callsForHelp;
|
public boolean canRoam;
|
||||||
public final boolean respondsToCallForHelp;
|
public boolean callsForHelp;
|
||||||
|
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;
|
||||||
@@ -2877,11 +2878,8 @@ public class Enum {
|
|||||||
|
|
||||||
public enum AIAgentType {
|
public enum AIAgentType {
|
||||||
MOBILE,
|
MOBILE,
|
||||||
GUARDCAPTAIN,
|
|
||||||
GUARDMINION,
|
|
||||||
GUARDWALLARCHER,
|
|
||||||
PET,
|
PET,
|
||||||
CHARMED,
|
CHARMED,
|
||||||
SIEGEENGINE;
|
GUARD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ public enum InterestManager implements Runnable {
|
|||||||
|
|
||||||
else {
|
else {
|
||||||
if (pc != null)
|
if (pc != null)
|
||||||
if (pcc.getSeeInvis() < pc.hidden)
|
if (pcc.getSeeInvis() < pc.getHidden())
|
||||||
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.hidden)
|
if (player.getSeeInvis() < loadedPlayer.getHidden())
|
||||||
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.hidden)
|
if (player.getSeeInvis() < loadedPlayer.getHidden())
|
||||||
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.hidden)
|
if (player.getSeeInvis() < awopc.getHidden())
|
||||||
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(), 0f);
|
awonpc.playerAgroMap.put(player.getObjectUUID(), false);
|
||||||
((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(), 0f);
|
awonpc.playerAgroMap.put(player.getObjectUUID(), false);
|
||||||
|
|
||||||
if ((awonpc.agentType.equals(Enum.AIAgentType.MOBILE)))
|
if ((awonpc.agentType.equals(Enum.AIAgentType.MOBILE)))
|
||||||
((Mob) awonpc).setCombatTarget(null);
|
((Mob) awonpc).setCombatTarget(null);
|
||||||
|
|||||||
@@ -28,27 +28,31 @@ 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 PERSIST(Mob toAdd) {
|
public Mob ADD_MOB(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.parentZoneUUID);
|
preparedStatement.setLong(1, toAdd.getParentZoneID());
|
||||||
preparedStatement.setInt(2, toAdd.loadID);
|
preparedStatement.setInt(2, toAdd.getMobBaseID());
|
||||||
preparedStatement.setInt(3, toAdd.guildUUID);
|
preparedStatement.setInt(3, toAdd.getGuildUUID());
|
||||||
preparedStatement.setFloat(4, toAdd.bindLoc.x);
|
preparedStatement.setFloat(4, toAdd.getSpawnX());
|
||||||
preparedStatement.setFloat(5, toAdd.bindLoc.y);
|
preparedStatement.setFloat(5, toAdd.getSpawnY());
|
||||||
preparedStatement.setFloat(6, toAdd.bindLoc.z);
|
preparedStatement.setFloat(6, toAdd.getSpawnZ());
|
||||||
preparedStatement.setInt(7, 0);
|
preparedStatement.setInt(7, 0);
|
||||||
preparedStatement.setFloat(8, toAdd.spawnRadius);
|
preparedStatement.setFloat(8, toAdd.getSpawnRadius());
|
||||||
preparedStatement.setInt(9, toAdd.spawnTime);
|
preparedStatement.setInt(9, toAdd.getTrueSpawnTime());
|
||||||
preparedStatement.setInt(10, toAdd.contractUUID);
|
|
||||||
preparedStatement.setInt(11, toAdd.buildingUUID);
|
if (toAdd.getContract() != null)
|
||||||
preparedStatement.setInt(12, toAdd.level);
|
preparedStatement.setInt(10, toAdd.getContract().getContractID());
|
||||||
preparedStatement.setString(13, toAdd.firstName);
|
else
|
||||||
preparedStatement.setString(14, toAdd.behaviourType.toString());
|
preparedStatement.setInt(10, 0);
|
||||||
|
|
||||||
|
preparedStatement.setInt(11, toAdd.getBuildingID());
|
||||||
|
preparedStatement.setInt(12, toAdd.getLevel());
|
||||||
|
preparedStatement.setString(13, toAdd.getFirstName());
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
@@ -102,17 +106,17 @@ public class dbMobHandler extends dbHandlerBase {
|
|||||||
return row_count;
|
return row_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LOAD_GUARD_MINIONS(Mob guardCaptain) {
|
public void LOAD_PATROL_POINTS(Mob captain) {
|
||||||
|
|
||||||
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, guardCaptain.getObjectUUID());
|
preparedStatement.setInt(1, captain.getObjectUUID());
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
String minionName = rs.getString("minionName");
|
String name = rs.getString("name");
|
||||||
Mob toCreate = Mob.createGuardMinion(guardCaptain, guardCaptain.getLevel(), minionName);
|
Mob toCreate = Mob.createGuardMob(captain, captain.getGuild(), captain.getParentZone(), captain.building.getLoc(), captain.getLevel(), name);
|
||||||
|
|
||||||
if (toCreate == null)
|
if (toCreate == null)
|
||||||
return;
|
return;
|
||||||
@@ -127,13 +131,15 @@ public class dbMobHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean ADD_TO_GUARDS(final long captainUID, final String minionName) {
|
public boolean ADD_TO_GUARDS(final long captainUID, final int mobBaseID, final String name, final int slot) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_guards` (`captainUID`, `minionName`) VALUES (?,?)")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_guards` (`captainUID`, `mobBaseID`,`name`, `slot`) VALUES (?,?,?,?)")) {
|
||||||
|
|
||||||
preparedStatement.setLong(1, captainUID);
|
preparedStatement.setLong(1, captainUID);
|
||||||
preparedStatement.setString(2, minionName);
|
preparedStatement.setInt(2, mobBaseID);
|
||||||
|
preparedStatement.setString(3, name);
|
||||||
|
preparedStatement.setInt(4, slot);
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -143,13 +149,14 @@ public class dbMobHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean REMOVE_FROM_GUARDS(final long captainUID, final String minionName) {
|
public boolean REMOVE_FROM_GUARDS(final long captainUID, final int mobBaseID, final int slot) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_guards` WHERE `captainUID`=? AND `minionName`=? LIMIT 1;")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_guards` WHERE `captainUID`=? AND `mobBaseID`=? AND `slot` =?")) {
|
||||||
|
|
||||||
preparedStatement.setLong(1, captainUID);
|
preparedStatement.setLong(1, captainUID);
|
||||||
preparedStatement.setString(2, minionName);
|
preparedStatement.setInt(2, mobBaseID);
|
||||||
|
preparedStatement.setInt(3, slot);
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
|||||||
@@ -243,8 +243,12 @@ public class dbNPCHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public boolean UPDATE_EQUIPSET(NPC npc, int equipSetID) {
|
public boolean UPDATE_EQUIPSET(NPC npc, int equipSetID) {
|
||||||
|
|
||||||
|
// Column name must match what NPC/Mob loaders read ("equipmentSet").
|
||||||
|
// Using the wrong column here causes the update to fail silently and
|
||||||
|
// dev command to report "Unable to find Equipset" despite a valid ID.
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_npc` SET `equipsetID`=? WHERE `UID`=?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_npc` SET `equipmentSet`=? WHERE `UID`=?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, equipSetID);
|
preparedStatement.setInt(1, equipSetID);
|
||||||
preparedStatement.setLong(2, npc.getObjectUUID());
|
preparedStatement.setLong(2, npc.getObjectUUID());
|
||||||
|
|||||||
@@ -15,9 +15,15 @@ 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 {
|
||||||
@@ -80,4 +86,43 @@ 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,8 +11,6 @@ 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;
|
||||||
@@ -29,84 +27,6 @@ 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,7 +9,6 @@
|
|||||||
|
|
||||||
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;
|
||||||
@@ -44,7 +43,7 @@ public class AddMobCmd extends AbstractDevCmd {
|
|||||||
MobBase mb = (MobBase) mobbaseAGO;
|
MobBase mb = (MobBase) mobbaseAGO;
|
||||||
int loadID = mb.getObjectUUID();
|
int loadID = mb.getObjectUUID();
|
||||||
Mob mob = Mob.createMob(loadID, Vector3fImmutable.getRandomPointInCircle(pc.getLoc(), 100),
|
Mob mob = Mob.createMob(loadID, Vector3fImmutable.getRandomPointInCircle(pc.getLoc(), 100),
|
||||||
null, zone, null, null, "", 1, Enum.AIAgentType.MOBILE);
|
null, true, zone, null, 0, "", 1);
|
||||||
if (mob != null) {
|
if (mob != null) {
|
||||||
mob.updateDatabase();
|
mob.updateDatabase();
|
||||||
this.setResult(String.valueOf(mob.getDBID()));
|
this.setResult(String.valueOf(mob.getDBID()));
|
||||||
@@ -85,7 +84,7 @@ public class AddMobCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
|
|
||||||
Mob mob = Mob.createMob(loadID, pc.getLoc(),
|
Mob mob = Mob.createMob(loadID, pc.getLoc(),
|
||||||
null, zone, null, null, "", 1, Enum.AIAgentType.MOBILE);
|
null, true, zone, null, 0, "", 1);
|
||||||
if (mob != null) {
|
if (mob != null) {
|
||||||
mob.updateDatabase();
|
mob.updateDatabase();
|
||||||
ChatManager.chatSayInfo(pc,
|
ChatManager.chatSayInfo(pc,
|
||||||
|
|||||||
@@ -440,9 +440,7 @@ 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,25 +59,22 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
|
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
for (Integer minionUUID : npc.minions) {
|
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
|
||||||
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 (Integer minionUUID : mobA.minions) {
|
for (Mob mob : mobA.getSiegeMinionMap().keySet()) {
|
||||||
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,11 +151,10 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
|
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
for (Integer minionUUID : npc.minions) {
|
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
|
||||||
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);
|
||||||
}
|
}
|
||||||
@@ -167,11 +163,10 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
|||||||
npc.getObjectUUID());
|
npc.getObjectUUID());
|
||||||
WorldGrid.RemoveWorldObject(npc);
|
WorldGrid.RemoveWorldObject(npc);
|
||||||
} else if (mobA != null) {
|
} else if (mobA != null) {
|
||||||
for (Integer minionUUID : mobA.minions) {
|
for (Mob mob : mobA.getSiegeMinionMap().keySet()) {
|
||||||
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,29 +154,24 @@ public class RemoveObjectCmd extends AbstractDevCmd {
|
|||||||
mobA = (Mob) ac;
|
mobA = (Mob) ac;
|
||||||
|
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
|
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);
|
//Mob.getRespawnMap().remove(mob);
|
||||||
WorldGrid.removeObject(minionMob, pc);
|
if (mob.getParentZone() != null)
|
||||||
|
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()) {
|
||||||
for (Integer minionUUID : mobA.minions) {
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
Mob minionMob = Mob.getMob(minionUUID);
|
WorldGrid.removeObject(mob, pc);
|
||||||
WorldGrid.RemoveWorldObject(minionMob);
|
//Mob.getRespawnMap().remove(mob);
|
||||||
WorldGrid.removeObject(minionMob, pc);
|
if (mob.getParentZone() != null)
|
||||||
|
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);
|
||||||
@@ -214,13 +209,11 @@ public class RemoveObjectCmd extends AbstractDevCmd {
|
|||||||
if (npc.building != null)
|
if (npc.building != null)
|
||||||
npc.building.getHirelings().remove(npc);
|
npc.building.getHirelings().remove(npc);
|
||||||
|
|
||||||
for (Integer minionUUID : npc.minions) {
|
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
|
||||||
Mob minionMob = Mob.getMob(minionUUID);
|
WorldGrid.RemoveWorldObject(mob);
|
||||||
WorldGrid.RemoveWorldObject(minionMob);
|
WorldGrid.removeObject(mob, pc);
|
||||||
WorldGrid.removeObject(minionMob, pc);
|
if (mob.getParentZone() != null)
|
||||||
|
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,6 +1,5 @@
|
|||||||
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;
|
||||||
@@ -111,7 +110,7 @@ public class SplatMobCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
mobile = Mob.createMob(_mobileUUID,
|
mobile = Mob.createMob(_mobileUUID,
|
||||||
Vector3fImmutable.getRandomPointInCircle(_currentLocation, _targetRange),
|
Vector3fImmutable.getRandomPointInCircle(_currentLocation, _targetRange),
|
||||||
null, serverZone, null, null, "", 1, Enum.AIAgentType.MOBILE);
|
null, true, serverZone, null, 0, "", 1);
|
||||||
|
|
||||||
if (mobile != null) {
|
if (mobile != null) {
|
||||||
mobile.updateDatabase();
|
mobile.updateDatabase();
|
||||||
|
|||||||
@@ -9,17 +9,12 @@
|
|||||||
|
|
||||||
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;
|
||||||
|
|
||||||
|
|
||||||
@@ -61,95 +56,36 @@ public class aiInfoCmd extends AbstractDevCmd {
|
|||||||
Mob mob = (Mob) target;
|
Mob mob = (Mob) target;
|
||||||
output = "Mob AI Information:" + newline;
|
output = "Mob AI Information:" + newline;
|
||||||
output += mob.getName() + newline;
|
output += mob.getName() + newline;
|
||||||
output += mob.agentType.toString() + newline;
|
if (mob.BehaviourType != null) {
|
||||||
|
output += "BehaviourType: " + mob.BehaviourType.toString() + newline;
|
||||||
int contractID = 0;
|
if (mob.BehaviourType.BehaviourHelperType != null) {
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
output += "Aggro Range: " + mob.getAggroRange() + newline;
|
output += "Aggro Range: " + mob.getAggroRange() + newline;
|
||||||
output += "Player Aggro Map Size: " + mob.playerAgroMap.size() + newline;
|
output += "Player Aggro Map Size: " + mob.playerAgroMap.size() + newline;
|
||||||
if (mob.playerAgroMap.size() > 0) {
|
if (mob.playerAgroMap.size() > 0) {
|
||||||
output += "Players Loaded:" + newline;
|
output += "Players Loaded:" + newline;
|
||||||
}
|
}
|
||||||
for (Map.Entry<Integer, Float> entry : mob.playerAgroMap.entrySet()) {
|
for (Map.Entry<Integer, Boolean> entry : mob.playerAgroMap.entrySet()) {
|
||||||
output += "Player ID: " + entry.getKey() + " Hate Value: " + entry.getValue() + newline;
|
output += "Player ID: " + entry.getKey() + " Hate Value: " + (PlayerCharacter.getPlayerCharacter(entry.getKey())).getHateValue() + 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;
|
||||||
|
|
||||||
if (mob.guardedCity != null)
|
for (int token : mob.mobPowers.keySet())
|
||||||
output += "Patrolling: " + mob.guardedCity.getCityName() + newline;
|
output += token + 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,63 +530,41 @@ public enum BuildingManager {
|
|||||||
else
|
else
|
||||||
rank = 10;
|
rank = 10;
|
||||||
|
|
||||||
Mob mobile;
|
Mob mob;
|
||||||
NPC npc;
|
NPC npc;
|
||||||
|
|
||||||
if (NPC.ISWallArcher(contract)) {
|
if (NPC.ISWallArcher(contract)) {
|
||||||
|
|
||||||
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank, Enum.AIAgentType.GUARDWALLARCHER);
|
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
|
||||||
|
|
||||||
if (mobile == null)
|
if (mob == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Configure AI and write new mobile to disk
|
mob.setLoc(mob.getLoc());
|
||||||
|
|
||||||
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())) {
|
||||||
|
|
||||||
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank, Enum.AIAgentType.GUARDCAPTAIN);
|
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
|
||||||
|
|
||||||
if (mobile == null)
|
if (mob == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Configure AI and write new mobile to disk
|
mob.setLoc(mob.getLoc());
|
||||||
|
|
||||||
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
|
||||||
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank, Enum.AIAgentType.GUARDCAPTAIN);
|
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
|
||||||
|
|
||||||
if (mobile == null)
|
if (mob == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Configure AI and write new mobile to disk
|
mob.setLoc(mob.getLoc());
|
||||||
|
|
||||||
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.hidden)
|
if (pcc.getSeeInvis() < pc.getHidden())
|
||||||
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.cityOutlaws.contains(playerCharacter.getObjectUUID()) == false)
|
if (playerCity != null && playerCity.getGuild().getNation().equals(playerCharacter.getGuild().getNation()) == false && playerCity.cityOutlaws.contains(playerCharacter.getObjectUUID()) == false)
|
||||||
playerCity.cityOutlaws.add(playerCharacter.getObjectUUID());
|
playerCity.cityOutlaws.add(playerCharacter.getObjectUUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -826,8 +826,7 @@ public enum CombatManager {
|
|||||||
damage *= 2.5f; //increase damage if sitting
|
damage *= 2.5f; //increase damage if sitting
|
||||||
|
|
||||||
if (tarAc.getObjectType() == GameObjectType.Mob) {
|
if (tarAc.getObjectType() == GameObjectType.Mob) {
|
||||||
if (ac.getObjectType().equals(GameObjectType.PlayerCharacter))
|
ac.setHateValue(damage * MBServerStatics.PLAYER_COMBAT_HATE_MODIFIER);
|
||||||
((Mob) tarAc).playerAgroMap.put(ac.getObjectUUID(), ((Mob) tarAc).playerAgroMap.get(ac.getObjectUUID()) + damage);
|
|
||||||
((Mob) tarAc).handleDirectAggro(ac);
|
((Mob) tarAc).handleDirectAggro(ac);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1268,75 +1267,61 @@ public enum CombatManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Called when character takes damage.
|
//Called when character takes damage.
|
||||||
public static void handleRetaliate(AbstractCharacter target, AbstractCharacter attacker) {
|
public static void handleRetaliate(AbstractCharacter tarAc, AbstractCharacter ac) {
|
||||||
|
|
||||||
if (attacker == null || target == null)
|
if (ac == null || tarAc == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (attacker.equals(target))
|
if (ac.equals(tarAc))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (target.isMoving() && target.getObjectType().equals(GameObjectType.PlayerCharacter))
|
if (tarAc.isMoving() && tarAc.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!target.isAlive() || !attacker.isAlive())
|
if (!tarAc.isAlive() || !ac.isAlive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
boolean isCombat = target.isCombat();
|
boolean isCombat = tarAc.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 = target.getCombatTarget();
|
AbstractWorldObject awoCombTar = tarAc.getCombatTarget();
|
||||||
|
|
||||||
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.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.getObjectType().equals(GameObjectType.PlayerCharacter)) { // we are in combat with no valid target
|
if (tarAc.getObjectType().equals(GameObjectType.PlayerCharacter)) { // we are in combat with no valid target
|
||||||
|
|
||||||
PlayerCharacter pc = (PlayerCharacter) target;
|
PlayerCharacter pc = (PlayerCharacter) tarAc;
|
||||||
target.setCombatTarget(attacker);
|
tarAc.setCombatTarget(ac);
|
||||||
pc.setLastTarget(attacker.getObjectType(), attacker.getObjectUUID());
|
pc.setLastTarget(ac.getObjectType(), ac.getObjectUUID());
|
||||||
|
|
||||||
if (target.getTimers() != null)
|
if (tarAc.getTimers() != null)
|
||||||
if (!target.getTimers().containsKey("Attack" + MBServerStatics.SLOT_MAINHAND))
|
if (!tarAc.getTimers().containsKey("Attack" + MBServerStatics.SLOT_MAINHAND))
|
||||||
CombatManager.AttackTarget((PlayerCharacter) target, target.getCombatTarget());
|
CombatManager.AttackTarget((PlayerCharacter) tarAc, tarAc.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 (target.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
if (tarAc.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||||
|
|
||||||
Mob pet = ((PlayerCharacter) target).getPet();
|
Mob pet = ((PlayerCharacter) tarAc).getPet();
|
||||||
|
|
||||||
if (pet != null && pet.assist && pet.getCombatTarget() == null)
|
if (pet != null && pet.assist && pet.getCombatTarget() == null)
|
||||||
pet.setCombatTarget(attacker);
|
pet.setCombatTarget(ac);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Handle Mob Retaliate.
|
//Handle Mob Retaliate.
|
||||||
|
|
||||||
if (target.getObjectType() == GameObjectType.Mob) {
|
if (tarAc.getObjectType() == GameObjectType.Mob) {
|
||||||
|
|
||||||
Mob attackedMobile = (Mob) target;
|
Mob retaliater = (Mob) tarAc;
|
||||||
|
|
||||||
//handle minion informing his captain of an attack
|
if (retaliater.getCombatTarget() != null && !retaliater.isSiege())
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
attackedMobile.setCombatTarget(attacker);
|
if (ac.getObjectType() == GameObjectType.Mob && retaliater.isSiege())
|
||||||
|
return;
|
||||||
|
|
||||||
|
retaliater.setCombatTarget(ac);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ 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;
|
||||||
@@ -24,6 +23,92 @@ 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);
|
||||||
@@ -42,12 +127,10 @@ 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)
|
||||||
@@ -122,39 +205,35 @@ public enum NPCManager {
|
|||||||
|
|
||||||
public static void removeSiegeMinions(Mob mobile) {
|
public static void removeSiegeMinions(Mob mobile) {
|
||||||
|
|
||||||
for (Integer minionUUID : mobile.minions) {
|
for (Mob toRemove : mobile.siegeMinionMap.keySet()) {
|
||||||
|
|
||||||
Mob siegeMinion = Mob.getMob(minionUUID);
|
|
||||||
|
|
||||||
if (mobile.isMoving()) {
|
if (mobile.isMoving()) {
|
||||||
|
|
||||||
mobile.stopMovement(mobile.getLoc());
|
mobile.stopMovement(mobile.getLoc());
|
||||||
|
|
||||||
if (siegeMinion.parentZone != null)
|
if (toRemove.parentZone != null)
|
||||||
siegeMinion.parentZone.zoneMobSet.remove(siegeMinion);
|
toRemove.parentZone.zoneMobSet.remove(toRemove);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
siegeMinion.clearEffects();
|
toRemove.clearEffects();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(e.getMessage());
|
Logger.error(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (siegeMinion.parentZone != null)
|
if (toRemove.parentZone != null)
|
||||||
siegeMinion.parentZone.zoneMobSet.remove(siegeMinion);
|
toRemove.parentZone.zoneMobSet.remove(toRemove);
|
||||||
|
|
||||||
WorldGrid.RemoveWorldObject(siegeMinion);
|
WorldGrid.RemoveWorldObject(toRemove);
|
||||||
WorldGrid.removeObject(siegeMinion);
|
WorldGrid.removeObject(toRemove);
|
||||||
DbManager.removeFromCache(siegeMinion);
|
DbManager.removeFromCache(toRemove);
|
||||||
|
|
||||||
|
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);
|
||||||
@@ -261,19 +340,10 @@ 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)
|
abstractCharacter.building.getHirelings().put(abstractCharacter, buildingSlot);
|
||||||
if (abstractCharacter.contract != null)
|
|
||||||
abstractCharacter.building.getHirelings().put(abstractCharacter, buildingSlot);
|
|
||||||
|
|
||||||
// Override bind and location for this npc derived
|
// Override bind and location for this npc derived
|
||||||
// from BuildingManager slot location data.
|
// from BuildingManager slot location data.
|
||||||
@@ -300,129 +370,4 @@ 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,10 +53,13 @@ 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<RunePowerEntry>> _allRunePowers;
|
public static HashMap<Integer, ArrayList<MobPowerEntry>> AllMobPowers;
|
||||||
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)
|
||||||
@@ -100,16 +103,6 @@ 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() {
|
||||||
|
|
||||||
@@ -846,6 +839,8 @@ 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);
|
||||||
@@ -896,6 +891,8 @@ 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).fearedObject = null;
|
((Mob) this.target).setFearedObject(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).fearedObject = null;
|
((Mob) this.target).setFearedObject(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+301
-204
@@ -23,7 +23,6 @@ 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;
|
||||||
|
|
||||||
@@ -50,19 +49,17 @@ 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 (MobCast(mob)) {
|
if (mob.isPlayerGuard() == false && 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))
|
||||||
@@ -99,7 +96,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)) {
|
||||||
@@ -168,7 +165,7 @@ public class MobAI {
|
|||||||
|
|
||||||
if (playercity != null)
|
if (playercity != null)
|
||||||
for (Mob guard : playercity.getParent().zoneMobSet)
|
for (Mob guard : playercity.getParent().zoneMobSet)
|
||||||
if (guard.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN))
|
if (guard.BehaviourType != null && guard.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal())
|
||||||
if (guard.getCombatTarget() == null && !guard.getGuild().equals(mob.getGuild()))
|
if (guard.getCombatTarget() == null && !guard.getGuild().equals(mob.getGuild()))
|
||||||
guard.setCombatTarget(mob);
|
guard.setCombatTarget(mob);
|
||||||
|
|
||||||
@@ -252,21 +249,18 @@ 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;
|
|
||||||
|
|
||||||
//guards inherit barracks patrol points dynamically
|
//guard captains inherit barracks patrol points dynamically
|
||||||
|
|
||||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN) || mob.agentType.equals(Enum.AIAgentType.GUARDMINION)) {
|
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal()) {
|
||||||
|
|
||||||
Building barracks = mob.building;
|
Building barracks = mob.building;
|
||||||
|
|
||||||
@@ -281,28 +275,24 @@ 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
|
mob.destination = mob.patrolPoints.get(mob.lastPatrolPointIndex);
|
||||||
|
mob.lastPatrolPointIndex += 1;
|
||||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION) && mob.guardCaptain.isAlive()) {
|
|
||||||
Mob captain = (Mob) mob.guardCaptain;
|
|
||||||
mob.destination = captain.destination.add(Formation.getOffset(2, mob.guardCaptain.minions.indexOf(mob.getObjectUUID()) + 3));
|
|
||||||
mob.lastPatrolPointIndex = captain.lastPatrolPointIndex;
|
|
||||||
} else {
|
|
||||||
mob.destination = mob.patrolPoints.get(mob.lastPatrolPointIndex);
|
|
||||||
mob.lastPatrolPointIndex += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Captain orders minions to patrol
|
|
||||||
|
|
||||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN))
|
|
||||||
for (Integer minionUUID : mob.minions) {
|
|
||||||
Mob minion = Mob.getMob(minionUUID);
|
|
||||||
if (minion.isAlive() && minion.combatTarget == null)
|
|
||||||
MobAI.Patrol(minion);
|
|
||||||
}
|
|
||||||
|
|
||||||
MovementUtilities.aiMove(mob, mob.destination, true);
|
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());
|
||||||
}
|
}
|
||||||
@@ -310,8 +300,6 @@ 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
|
||||||
@@ -320,25 +308,26 @@ public class MobAI {
|
|||||||
if (mob == null)
|
if (mob == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (mob.isPlayerGuard() == true) {
|
if(mob.isPlayerGuard == true){
|
||||||
|
|
||||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION))
|
int contractID;
|
||||||
contractID = mob.guardCaptain.contract.getContractID();
|
|
||||||
else
|
if(mob.BehaviourType.equals(Enum.MobBehaviourType.GuardMinion))
|
||||||
|
contractID = mob.npcOwner.contract.getContractID();
|
||||||
|
else
|
||||||
contractID = mob.contract.getContractID();
|
contractID = mob.contract.getContractID();
|
||||||
|
|
||||||
// exception allowing werewolf and werebear guard captains to cast
|
if(Enum.MinionType.ContractToMinionMap.get(contractID).isMage() == false)
|
||||||
|
|
||||||
if (Enum.MinionType.ContractToMinionMap.get(contractID).isMage() == false && contractID != 980103 && contractID != 980104)
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mobile has no powers defined in mobbase or contract..
|
if (mob.mobPowers.isEmpty())
|
||||||
|
|
||||||
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();
|
||||||
|
|
||||||
@@ -357,67 +346,47 @@ 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<RunePowerEntry> powerEntries;
|
ArrayList<Integer> powerTokens;
|
||||||
ArrayList<RunePowerEntry> purgeEntries;
|
ArrayList<Integer> purgeTokens;
|
||||||
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.
|
||||||
|
|
||||||
powerEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.getMobBaseID()));
|
powerTokens = new ArrayList<>(mob.mobPowers.keySet());
|
||||||
purgeEntries = new ArrayList<>();
|
purgeTokens = 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 (RunePowerEntry runePowerEntry : powerEntries) {
|
for (int powerToken : powerTokens) {
|
||||||
|
|
||||||
PowersBase powerBase = PowersManager.getPowerByToken(runePowerEntry.token);
|
PowersBase powerBase = PowersManager.getPowerByToken(powerToken);
|
||||||
|
|
||||||
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))
|
||||||
purgeEntries.add(runePowerEntry);
|
purgeTokens.add(powerToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
powerEntries.removeAll(purgeEntries);
|
powerTokens.removeAll(purgeTokens);
|
||||||
|
|
||||||
// Sanity check
|
// Sanity check
|
||||||
|
|
||||||
if (powerEntries.isEmpty())
|
if (powerTokens.isEmpty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Pick random spell from our list of powers
|
// Pick random spell from our list of powers
|
||||||
|
|
||||||
RunePowerEntry runePowerEntry = powerEntries.get(ThreadLocalRandom.current().nextInt(powerEntries.size()));
|
int powerToken = powerTokens.get(ThreadLocalRandom.current().nextInt(powerTokens.size()));
|
||||||
|
int powerRank = mob.mobPowers.get(powerToken);
|
||||||
|
|
||||||
PowersBase mobPower = PowersManager.getPowerByToken(runePowerEntry.token);
|
PowersBase mobPower = PowersManager.getPowerByToken(powerToken);
|
||||||
int powerRank = runePowerEntry.rank;
|
|
||||||
|
|
||||||
if (mob.isPlayerGuard())
|
|
||||||
powerRank = getGuardPowerRank(mob);
|
|
||||||
|
|
||||||
//check for hit-roll
|
//check for hit-roll
|
||||||
|
|
||||||
@@ -442,7 +411,7 @@ public class MobAI {
|
|||||||
msg.setUnknown04(2);
|
msg.setUnknown04(2);
|
||||||
|
|
||||||
PowersManager.finishUseMobPower(msg, mob, 0, 0);
|
PowersManager.finishUseMobPower(msg, mob, 0, 0);
|
||||||
long randomCooldown = (long) ((ThreadLocalRandom.current().nextInt(10, 15) * 1000) * MobAIThread.AI_CAST_FREQUENCY);
|
long randomCooldown = (long)((ThreadLocalRandom.current().nextInt(10,15) * 1000) * MobAIThread.AI_CAST_FREQUENCY);
|
||||||
|
|
||||||
mob.nextCastTime = System.currentTimeMillis() + randomCooldown;
|
mob.nextCastTime = System.currentTimeMillis() + randomCooldown;
|
||||||
return true;
|
return true;
|
||||||
@@ -453,33 +422,127 @@ public class MobAI {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int getGuardPowerRank(Mob mob) {
|
public static boolean GuardCast(Mob mob) {
|
||||||
int powerRank = 1;
|
|
||||||
|
|
||||||
switch (mob.getRank()) {
|
try {
|
||||||
case 1:
|
// Method picks a random spell from a mobile's list of powers
|
||||||
powerRank = 10;
|
// and casts it on the current target (or itself). Validation
|
||||||
break;
|
// (including empty lists) is done previously within canCast();
|
||||||
case 2:
|
|
||||||
powerRank = 15;
|
ArrayList<Integer> powerTokens;
|
||||||
break;
|
ArrayList<Integer> purgeTokens;
|
||||||
case 3:
|
AbstractCharacter target = (AbstractCharacter) mob.getCombatTarget();
|
||||||
powerRank = 20;
|
|
||||||
break;
|
if (mob.BehaviourType.callsForHelp)
|
||||||
case 4:
|
MobCallForHelp(mob);
|
||||||
powerRank = 25;
|
|
||||||
break;
|
// Generate a list of tokens from the mob powers for this mobile.
|
||||||
case 5:
|
|
||||||
powerRank = 30;
|
powerTokens = new ArrayList<>(mob.mobPowers.keySet());
|
||||||
break;
|
purgeTokens = new ArrayList<>();
|
||||||
case 6:
|
|
||||||
powerRank = 35;
|
// If player has this effect on them currently then remove
|
||||||
break;
|
// this token from our list.
|
||||||
case 7:
|
|
||||||
powerRank = 40;
|
for (int powerToken : powerTokens) {
|
||||||
break;
|
|
||||||
|
PowersBase powerBase = PowersManager.getPowerByToken(powerToken);
|
||||||
|
|
||||||
|
for (ActionsBase actionBase : powerBase.getActions()) {
|
||||||
|
|
||||||
|
String stackType = actionBase.stackType;
|
||||||
|
|
||||||
|
if (target.getEffects() != null && target.getEffects().containsKey(stackType))
|
||||||
|
purgeTokens.add(powerToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
powerTokens.removeAll(purgeTokens);
|
||||||
|
|
||||||
|
// Sanity check
|
||||||
|
|
||||||
|
if (powerTokens.isEmpty())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
int powerToken = 0;
|
||||||
|
int nukeRoll = ThreadLocalRandom.current().nextInt(1,100);
|
||||||
|
|
||||||
|
if (nukeRoll < 55) {
|
||||||
|
|
||||||
|
//use direct damage spell
|
||||||
|
powerToken = powerTokens.get(powerTokens.size() - 1);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
//use random spell
|
||||||
|
powerToken = powerTokens.get(ThreadLocalRandom.current().nextInt(powerTokens.size()));
|
||||||
|
}
|
||||||
|
|
||||||
|
int powerRank = 1;
|
||||||
|
|
||||||
|
switch(mob.getRank()){
|
||||||
|
case 1:
|
||||||
|
powerRank = 10;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
powerRank = 15;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
powerRank = 20;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
powerRank = 25;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
powerRank = 30;
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
powerRank = 35;
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
powerRank = 40;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
PowersBase mobPower = PowersManager.getPowerByToken(powerToken);
|
||||||
|
|
||||||
|
//check for hit-roll
|
||||||
|
|
||||||
|
if (mobPower.requiresHitRoll)
|
||||||
|
if (CombatUtilities.triggerDefense(mob, mob.getCombatTarget()))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Cast the spell
|
||||||
|
|
||||||
|
if (CombatUtilities.inRange2D(mob, mob.getCombatTarget(), mobPower.getRange())) {
|
||||||
|
|
||||||
|
PerformActionMsg msg;
|
||||||
|
|
||||||
|
if (!mobPower.isHarmful() || mobPower.targetSelf) {
|
||||||
|
|
||||||
|
if (mobPower.category.equals("DISPEL")) {
|
||||||
|
PowersManager.useMobPower(mob, target, mobPower, powerRank);
|
||||||
|
msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, target);
|
||||||
|
} else {
|
||||||
|
PowersManager.useMobPower(mob, mob, mobPower, powerRank);
|
||||||
|
msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, mob);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
PowersManager.useMobPower(mob, target, mobPower, powerRank);
|
||||||
|
msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, target);
|
||||||
|
}
|
||||||
|
|
||||||
|
msg.setUnknown04(2);
|
||||||
|
|
||||||
|
PowersManager.finishUseMobPower(msg, mob, 0, 0);
|
||||||
|
|
||||||
|
long randomCooldown = (long)((ThreadLocalRandom.current().nextInt(10,15) * 1000) * MobAIThread.AI_CAST_FREQUENCY);
|
||||||
|
mob.nextCastTime = System.currentTimeMillis() + randomCooldown;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: MobCast" + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
return powerRank;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void MobCallForHelp(Mob mob) {
|
public static void MobCallForHelp(Mob mob) {
|
||||||
@@ -501,7 +564,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;
|
||||||
}
|
}
|
||||||
@@ -543,10 +606,10 @@ public class MobAI {
|
|||||||
|
|
||||||
//override for guards
|
//override for guards
|
||||||
|
|
||||||
if (mob.despawned && mob.isPlayerGuard()) {
|
if (mob.despawned && mob.isPlayerGuard) {
|
||||||
|
|
||||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION)) {
|
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardMinion.ordinal()) {
|
||||||
if (mob.guardCaptain.isAlive() == false || ((Mob) mob.guardCaptain).despawned == true) {
|
if (mob.npcOwner.isAlive() == false || ((Mob) mob.npcOwner).despawned == true) {
|
||||||
|
|
||||||
//minions don't respawn while guard captain is dead
|
//minions don't respawn while guard captain is dead
|
||||||
|
|
||||||
@@ -562,7 +625,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.agentType.equals(Enum.AIAgentType.PET))
|
if (mob.BehaviourType.ordinal() != Enum.MobBehaviourType.Pet1.ordinal())
|
||||||
CheckToSendMobHome(mob);
|
CheckToSendMobHome(mob);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -578,12 +641,12 @@ public class MobAI {
|
|||||||
//no players loaded, no need to proceed
|
//no players loaded, no need to proceed
|
||||||
|
|
||||||
if (mob.playerAgroMap.isEmpty()) {
|
if (mob.playerAgroMap.isEmpty()) {
|
||||||
if (mob.getCombatTarget() != null)
|
if(mob.getCombatTarget() != null)
|
||||||
mob.setCombatTarget(null);
|
mob.setCombatTarget(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mob.agentType.equals(Enum.AIAgentType.PET) == false)
|
if (mob.BehaviourType.ordinal() != Enum.MobBehaviourType.Pet1.ordinal())
|
||||||
CheckToSendMobHome(mob);
|
CheckToSendMobHome(mob);
|
||||||
|
|
||||||
if (mob.getCombatTarget() != null) {
|
if (mob.getCombatTarget() != null) {
|
||||||
@@ -610,16 +673,17 @@ public class MobAI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (mob.behaviourType) {
|
switch (mob.BehaviourType) {
|
||||||
case GuardCaptain:
|
case GuardCaptain:
|
||||||
|
GuardCaptainLogic(mob);
|
||||||
|
break;
|
||||||
case GuardMinion:
|
case GuardMinion:
|
||||||
GuardLogic(mob);
|
GuardMinionLogic(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:
|
||||||
@@ -629,6 +693,8 @@ public class MobAI {
|
|||||||
DefaultLogic(mob);
|
DefaultLogic(mob);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if(mob.isAlive())
|
||||||
|
RecoverHealth(mob);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: DetermineAction" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: DetermineAction" + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
@@ -643,7 +709,7 @@ public class MobAI {
|
|||||||
if (!aiAgent.isAlive())
|
if (!aiAgent.isAlive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ConcurrentHashMap<Integer, Float> loadedPlayers = aiAgent.playerAgroMap;
|
ConcurrentHashMap<Integer, Boolean> loadedPlayers = aiAgent.playerAgroMap;
|
||||||
|
|
||||||
for (Entry playerEntry : loadedPlayers.entrySet()) {
|
for (Entry playerEntry : loadedPlayers.entrySet()) {
|
||||||
|
|
||||||
@@ -683,6 +749,7 @@ public class MobAI {
|
|||||||
aiAgent.setCombatTarget(loadedPlayer);
|
aiAgent.setCombatTarget(loadedPlayer);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aiAgent.getCombatTarget() == null) {
|
if (aiAgent.getCombatTarget() == null) {
|
||||||
@@ -717,49 +784,52 @@ 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;
|
||||||
|
|
||||||
//mob no longer has its owner loaded, translate pet to owner
|
if (!mob.playerAgroMap.containsKey(mob.getOwner().getObjectUUID())) {
|
||||||
|
|
||||||
if (!mob.playerAgroMap.containsKey(mob.guardCaptain.getObjectUUID())) {
|
//mob no longer has its owner loaded, translocate pet to owner
|
||||||
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.guardCaptain, 6))
|
if (CombatUtilities.inRange2D(mob, mob.getOwner(), 6))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mob.destination = mob.guardCaptain.getLoc();
|
mob.destination = mob.getOwner().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.getCombatTarget() == null)
|
||||||
|
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()) {
|
Patrol(mob);
|
||||||
|
else {
|
||||||
// Minions only patrol on their own if captain is dead.
|
|
||||||
|
|
||||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION) == false)
|
|
||||||
Patrol(mob);
|
|
||||||
else if (mob.guardCaptain.isAlive() == false)
|
|
||||||
Patrol(mob);
|
|
||||||
} else
|
|
||||||
mob.stopPatrolTime = System.currentTimeMillis();
|
mob.stopPatrolTime = System.currentTimeMillis();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
chaseTarget(mob);
|
chaseTarget(mob);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckMobMovement" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckMobMovement" + " " + e.getMessage());
|
||||||
@@ -826,8 +896,7 @@ 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 &&
|
if (mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter) && MovementUtilities.inRangeDropAggro(mob, (PlayerCharacter) mob.getCombatTarget()) == false && mob.BehaviourType.ordinal() != Enum.MobBehaviourType.Pet1.ordinal()) {
|
||||||
mob.agentType.equals(Enum.AIAgentType.PET) == false) {
|
|
||||||
|
|
||||||
mob.setCombatTarget(null);
|
mob.setCombatTarget(null);
|
||||||
return;
|
return;
|
||||||
@@ -843,6 +912,15 @@ 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;
|
||||||
@@ -857,15 +935,13 @@ public class MobAI {
|
|||||||
PowersManager.useMobPower(mob, mob, recall, 40);
|
PowersManager.useMobPower(mob, mob, recall, 40);
|
||||||
mob.setCombatTarget(null);
|
mob.setCombatTarget(null);
|
||||||
|
|
||||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN) && mob.isAlive()) {
|
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal() && mob.isAlive()) {
|
||||||
|
|
||||||
//guard captain pulls his minions home with him
|
//guard captain pulls his minions home with him
|
||||||
|
|
||||||
for (Integer minionUUID : mob.minions) {
|
for (Entry<Mob, Integer> minion : mob.siegeMinionMap.entrySet()) {
|
||||||
Mob minion = Mob.getMob(minionUUID);
|
PowersManager.useMobPower(minion.getKey(), minion.getKey(), recall, 40);
|
||||||
|
minion.getKey().setCombatTarget(null);
|
||||||
PowersManager.useMobPower(minion, minion, recall, 40);
|
|
||||||
minion.setCombatTarget(null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -875,8 +951,8 @@ public class MobAI {
|
|||||||
PowersManager.useMobPower(mob, mob, recall, 40);
|
PowersManager.useMobPower(mob, mob, recall, 40);
|
||||||
mob.setCombatTarget(null);
|
mob.setCombatTarget(null);
|
||||||
|
|
||||||
for (Integer playerEntry : mob.playerAgroMap.keySet())
|
for (Entry playerEntry : mob.playerAgroMap.entrySet())
|
||||||
mob.playerAgroMap.put(playerEntry, 0f);
|
PlayerCharacter.getFromCache((int) playerEntry.getKey()).setHateValue(0);
|
||||||
}
|
}
|
||||||
} 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());
|
||||||
@@ -887,7 +963,13 @@ public class MobAI {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (CombatUtilities.inRange2D(mob, mob.getCombatTarget(), mob.getRange()) == false) {
|
float rangeSquared = mob.getRange() * mob.getRange();
|
||||||
|
float distanceSquared = mob.getLoc().distanceSquared2D(mob.getCombatTarget().getLoc());
|
||||||
|
|
||||||
|
if(mob.isMoving() == true && distanceSquared < rangeSquared - 50) {
|
||||||
|
mob.destination = mob.getLoc();
|
||||||
|
MovementUtilities.moveToLocation(mob, mob.destination, 0);
|
||||||
|
} else if (CombatUtilities.inRange2D(mob, mob.getCombatTarget(), mob.getRange()) == false) {
|
||||||
if (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);
|
||||||
@@ -924,17 +1006,17 @@ public class MobAI {
|
|||||||
|
|
||||||
//dont scan self.
|
//dont scan self.
|
||||||
|
|
||||||
if (mob.equals(awoMob) || (mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN)) == true)
|
if (mob.equals(awoMob) || (mob.agentType.equals(Enum.AIAgentType.GUARD)) == 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.GUARDCAPTAIN)))
|
if ((aggroMob.agentType.equals(Enum.AIAgentType.GUARD)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (aggroMob.agentType.equals(Enum.AIAgentType.PET))
|
if(aggroMob.BehaviourType.equals(Enum.MobBehaviourType.Pet1))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (mob.getLoc().distanceSquared2D(aggroMob.getLoc()) > sqr(50))
|
if (mob.getLoc().distanceSquared2D(aggroMob.getLoc()) > sqr(50))
|
||||||
@@ -947,7 +1029,7 @@ public class MobAI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void GuardLogic(Mob mob) {
|
public static void GuardCaptainLogic(Mob mob) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (mob.getCombatTarget() == null)
|
if (mob.getCombatTarget() == null)
|
||||||
@@ -964,11 +1046,30 @@ public class MobAI {
|
|||||||
mob.setCombatTarget(newTarget);
|
mob.setCombatTarget(newTarget);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckMobMovement(mob);
|
CheckMobMovement(mob);
|
||||||
CheckForAttack(mob);
|
CheckForAttack(mob);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardLogic" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardCaptainLogic" + " " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void GuardMinionLogic(Mob mob) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
boolean isComanded = mob.npcOwner.isAlive();
|
||||||
|
if (!isComanded) {
|
||||||
|
GuardCaptainLogic(mob);
|
||||||
|
}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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -988,30 +1089,14 @@ public class MobAI {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (mob.guardCaptain == null && mob.isNecroPet() == false && mob.isSiege() == false)
|
if (mob.getOwner() == 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);
|
||||||
|
|
||||||
//recover health
|
|
||||||
|
|
||||||
if (mob.getTimestamps().containsKey("HEALTHRECOVERED") == false)
|
|
||||||
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
|
|
||||||
|
|
||||||
if (mob.isSit() && mob.getTimeStamp("HEALTHRECOVERED") < System.currentTimeMillis() + 3000)
|
|
||||||
if (mob.getHealth() < mob.getHealthMax()) {
|
|
||||||
|
|
||||||
float recoveredHealth = mob.getHealthMax() * ((1 + mob.getBonuses().getFloatPercentAll(Enum.ModType.HealthRecoverRate, Enum.SourceType.None)) * 0.01f);
|
|
||||||
mob.setHealth(mob.getHealth() + recoveredHealth);
|
|
||||||
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
|
|
||||||
|
|
||||||
if (mob.getHealth() > mob.getHealthMax())
|
|
||||||
mob.setHealth(mob.getHealthMax());
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: PetLogic" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: PetLogic" + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
@@ -1042,7 +1127,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);
|
||||||
|
|
||||||
@@ -1050,7 +1135,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
|
||||||
@@ -1060,12 +1145,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) {
|
||||||
@@ -1082,16 +1167,7 @@ public class MobAI {
|
|||||||
if (!mob.isAlive())
|
if (!mob.isAlive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Defer to captain if possible for current target
|
ConcurrentHashMap<Integer, Boolean> loadedPlayers = mob.playerAgroMap;
|
||||||
|
|
||||||
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()) {
|
||||||
|
|
||||||
@@ -1136,12 +1212,17 @@ 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) {
|
||||||
@@ -1219,19 +1300,17 @@ public class MobAI {
|
|||||||
|
|
||||||
MovementUtilities.aiMove(mob, mob.destination, true);
|
MovementUtilities.aiMove(mob, mob.destination, true);
|
||||||
|
|
||||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN)) {
|
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal()) {
|
||||||
for (Integer minionUUID : mob.minions) {
|
for (Entry<Mob, Integer> minion : mob.siegeMinionMap.entrySet()) {
|
||||||
|
|
||||||
Mob minion = Mob.getMob(minionUUID);
|
|
||||||
|
|
||||||
//make sure mob is out of combat stance
|
//make sure mob is out of combat stance
|
||||||
|
|
||||||
if (minion.despawned == false) {
|
if (minion.getKey().despawned == false) {
|
||||||
if (MovementUtilities.canMove(minion)) {
|
if (MovementUtilities.canMove(minion.getKey())) {
|
||||||
Vector3f minionOffset = Formation.getOffset(2, mob.minions.indexOf(minionUUID) + 3);
|
Vector3f minionOffset = Formation.getOffset(2, minion.getValue() + 3);
|
||||||
minion.updateLocation();
|
minion.getKey().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, formationPatrolPoint, true);
|
MovementUtilities.aiMove(minion.getKey(), formationPatrolPoint, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1248,7 +1327,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 = mob.playerAgroMap.get(mob.combatTarget.getObjectUUID()).floatValue();
|
CurrentHateValue = ((PlayerCharacter) mob.getCombatTarget()).getHateValue();
|
||||||
|
|
||||||
AbstractWorldObject mostHatedTarget = null;
|
AbstractWorldObject mostHatedTarget = null;
|
||||||
|
|
||||||
@@ -1259,8 +1338,8 @@ public class MobAI {
|
|||||||
if (potentialTarget.equals(mob.getCombatTarget()))
|
if (potentialTarget.equals(mob.getCombatTarget()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (potentialTarget != null && mob.playerAgroMap.get(potentialTarget.getObjectUUID()).floatValue() > CurrentHateValue && MovementUtilities.inRangeToAggro(mob, potentialTarget)) {
|
if (potentialTarget != null && potentialTarget.getHateValue() > CurrentHateValue && MovementUtilities.inRangeToAggro(mob, potentialTarget)) {
|
||||||
CurrentHateValue = mob.playerAgroMap.get(potentialTarget.getObjectUUID()).floatValue();
|
CurrentHateValue = potentialTarget.getHateValue();
|
||||||
mostHatedTarget = potentialTarget;
|
mostHatedTarget = potentialTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1271,4 +1350,22 @@ public class MobAI {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void RecoverHealth(Mob mob){
|
||||||
|
//recover health
|
||||||
|
|
||||||
|
if (mob.getTimestamps().containsKey("HEALTHRECOVERED") == false)
|
||||||
|
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
|
||||||
|
|
||||||
|
if (mob.isSit() && mob.getTimeStamp("HEALTHRECOVERED") < System.currentTimeMillis() + 3000)
|
||||||
|
if (mob.getHealth() < mob.getHealthMax()) {
|
||||||
|
|
||||||
|
float recoveredHealth = mob.getHealthMax() * ((1 + mob.getBonuses().getFloatPercentAll(Enum.ModType.HealthRecoverRate, Enum.SourceType.None)) * 0.01f);
|
||||||
|
mob.setHealth(mob.getHealth() + recoveredHealth);
|
||||||
|
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
|
||||||
|
|
||||||
|
if (mob.getHealth() > mob.getHealthMax())
|
||||||
|
mob.setHealth(mob.getHealthMax());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -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().distanceSquared2D(entity2.getLoc()) < range * range;
|
return entity1.getLoc().distance2D(entity2.getLoc()) < 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.guardCaptain;
|
guardCaptain = (Mob) agent.npcOwner;
|
||||||
|
|
||||||
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
|
||||||
* async message delivery system.
|
* asynch message delivery system.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class DispatchMessage {
|
public class DispatchMessage {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ 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;
|
||||||
@@ -15,6 +16,9 @@ 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
|
||||||
@@ -23,6 +27,8 @@ import org.pmw.tinylog.Logger;
|
|||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
@@ -32,9 +38,9 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
MinionTrainingMessage minionMsg = (MinionTrainingMessage) baseMsg;
|
MinionTrainingMessage minionMsg = (MinionTrainingMessage) baseMsg;
|
||||||
|
|
||||||
PlayerCharacter playerCharacter = SessionManager.getPlayerCharacter(origin);
|
PlayerCharacter player = SessionManager.getPlayerCharacter(origin);
|
||||||
|
|
||||||
if (playerCharacter == null)
|
if (player == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (minionMsg.getNpcType() == Enum.GameObjectType.NPC.ordinal()) {
|
if (minionMsg.getNpcType() == Enum.GameObjectType.NPC.ordinal()) {
|
||||||
@@ -44,24 +50,23 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (npc == null)
|
if (npc == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
Building building = BuildingManager.getBuildingFromCache(minionMsg.getBuildingID());
|
Building b = BuildingManager.getBuildingFromCache(minionMsg.getBuildingID());
|
||||||
|
|
||||||
if (building == null)
|
if (b == 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.minions.contains(toRemove.getObjectUUID()))
|
if (!npc.getSiegeMinionMap().containsKey(toRemove))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
npc.minions.remove(Integer.valueOf(toRemove.getObjectUUID()));
|
npc.getSiegeMinionMap().remove(toRemove);
|
||||||
|
|
||||||
WorldGrid.RemoveWorldObject(toRemove);
|
WorldGrid.RemoveWorldObject(toRemove);
|
||||||
|
|
||||||
@@ -69,35 +74,33 @@ 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)) {
|
if (petOwner != null) {
|
||||||
PlayerCharacter petOwner = (PlayerCharacter) toRemove.guardCaptain;
|
petOwner.setPet(null);
|
||||||
|
toRemove.setOwner(null);
|
||||||
if (petOwner != null) {
|
PetMsg petMsg = new PetMsg(5, null);
|
||||||
petOwner.setPet(null);
|
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
|
||||||
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
toRemove.guardCaptain = null;
|
|
||||||
PetMsg petMsg = new PetMsg(5, null);
|
|
||||||
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
|
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ManageCityAssetsMsg mca1 = new ManageCityAssetsMsg(playerCharacter, building);
|
// we Found the move to remove, lets break the for loop so it doesnt look for more.
|
||||||
|
|
||||||
|
ManageCityAssetsMsg mca1 = new ManageCityAssetsMsg(player, b);
|
||||||
mca1.actionType = 3;
|
mca1.actionType = 3;
|
||||||
mca1.setTargetType(building.getObjectType().ordinal());
|
mca1.setTargetType(b.getObjectType().ordinal());
|
||||||
mca1.setTargetID(building.getObjectUUID());
|
mca1.setTargetID(b.getObjectUUID());
|
||||||
|
|
||||||
mca1.setTargetType3(npc.getObjectType().ordinal());
|
mca1.setTargetType3(npc.getObjectType().ordinal());
|
||||||
mca1.setTargetID3(npc.getObjectUUID());
|
mca1.setTargetID3(npc.getObjectUUID());
|
||||||
mca1.setAssetName1(building.getName());
|
mca1.setAssetName1(b.getName());
|
||||||
mca1.setUnknown54(1);
|
mca1.setUnknown54(1);
|
||||||
|
|
||||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, mca1);
|
Dispatch dispatch = Dispatch.borrow(player, mca1);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
||||||
dispatch = Dispatch.borrow(playerCharacter, mnm);
|
dispatch = Dispatch.borrow(player, mnm);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
//Add Minion
|
//Add Minion
|
||||||
@@ -112,7 +115,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (npc.getContractID() == 842)
|
if (npc.getContractID() == 842)
|
||||||
maxSlots = 1;
|
maxSlots = 1;
|
||||||
|
|
||||||
if (npc.minions.size() == maxSlots)
|
if (npc.getSiegeMinionMap().size() == maxSlots)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
int mobBase;
|
int mobBase;
|
||||||
@@ -143,15 +146,47 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (mobBase == 0)
|
if (mobBase == 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
Mob siegeMob = Mob.createSiegeMinion(npc, mobBase);
|
Mob siegeMob = Mob.createSiegeMob(npc, mobBase, npc.getGuild(), zone, b.getLoc(), (short) 1);
|
||||||
|
|
||||||
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(playerCharacter, mnm);
|
Dispatch dispatch = Dispatch.borrow(player, mnm);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
@@ -179,13 +214,13 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
Mob toRemove = Mob.getFromCache(minionMsg.getUUID());
|
Mob toRemove = Mob.getFromCache(minionMsg.getUUID());
|
||||||
|
|
||||||
if (!npc.minions.contains(toRemove.getObjectUUID()))
|
if (!npc.getSiegeMinionMap().containsKey(toRemove))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!DbManager.MobQueries.REMOVE_FROM_GUARDS(npc.getObjectUUID(), toRemove.firstName))
|
if (!DbManager.MobQueries.REMOVE_FROM_GUARDS(npc.getObjectUUID(), toRemove.getMobBaseID(), npc.getSiegeMinionMap().get(toRemove)))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
npc.minions.remove(Integer.valueOf(toRemove.getObjectUUID()));
|
npc.getSiegeMinionMap().remove(toRemove);
|
||||||
|
|
||||||
WorldGrid.RemoveWorldObject(toRemove);
|
WorldGrid.RemoveWorldObject(toRemove);
|
||||||
|
|
||||||
@@ -193,22 +228,17 @@ 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.agentType.equals(Enum.AIAgentType.SIEGEENGINE)) {
|
if (petOwner != null) {
|
||||||
|
petOwner.setPet(null);
|
||||||
PlayerCharacter trebOwner = (PlayerCharacter) toRemove.guardCaptain;
|
toRemove.setOwner(null);
|
||||||
|
PetMsg petMsg = new PetMsg(5, null);
|
||||||
if (trebOwner != null) {
|
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
|
||||||
trebOwner.setPet(null);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
toRemove.guardCaptain = null;
|
|
||||||
PetMsg petMsg = new PetMsg(5, null);
|
|
||||||
Dispatch dispatch = Dispatch.borrow(trebOwner, petMsg);
|
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ManageCityAssetsMsg mca1 = new ManageCityAssetsMsg(playerCharacter, building);
|
ManageCityAssetsMsg mca1 = new ManageCityAssetsMsg(player, 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());
|
||||||
@@ -218,11 +248,11 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
mca1.setAssetName1(building.getName());
|
mca1.setAssetName1(building.getName());
|
||||||
mca1.setUnknown54(1);
|
mca1.setUnknown54(1);
|
||||||
|
|
||||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, mca1);
|
Dispatch dispatch = Dispatch.borrow(player, mca1);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
||||||
dispatch = Dispatch.borrow(playerCharacter, mnm);
|
dispatch = Dispatch.borrow(player, mnm);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
//Add Minion
|
//Add Minion
|
||||||
@@ -258,7 +288,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (npc.minions.size() == maxSlots)
|
if (npc.getSiegeMinionMap().size() == maxSlots)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
int mobBase = npc.getMobBaseID();
|
int mobBase = npc.getMobBaseID();
|
||||||
@@ -268,12 +298,12 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
String pirateName = NPCManager.getPirateName(mobBase);
|
String pirateName = NPCManager.getPirateName(mobBase);
|
||||||
|
|
||||||
Mob toCreate = Mob.createGuardMinion(npc, npc.getLevel(), pirateName);
|
if (!DbManager.MobQueries.ADD_TO_GUARDS(npc.getObjectUUID(), mobBase, pirateName, npc.getSiegeMinionMap().size() + 1))
|
||||||
|
|
||||||
if (toCreate == null)
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!DbManager.MobQueries.ADD_TO_GUARDS(npc.getObjectUUID(), pirateName))
|
Mob toCreate = Mob.createGuardMob(npc, npc.getGuild(), zone, building.getLoc(), npc.getLevel(), pirateName);
|
||||||
|
|
||||||
|
if (toCreate == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (toCreate != null) {
|
if (toCreate != null) {
|
||||||
@@ -284,7 +314,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(playerCharacter, mnm);
|
Dispatch dispatch = Dispatch.borrow(player, mnm);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -212,6 +212,10 @@ 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());
|
||||||
|
|
||||||
@@ -219,6 +223,10 @@ 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) {
|
||||||
@@ -533,7 +541,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
} else if (orderNPCMsg.getObjectType() == GameObjectType.Mob.ordinal()) {
|
} else if (orderNPCMsg.getObjectType() == GameObjectType.Mob.ordinal()) {
|
||||||
|
|
||||||
mob = Mob.getMob(orderNPCMsg.getNpcUUID());
|
mob = Mob.getFromCacheDBID(orderNPCMsg.getNpcUUID());
|
||||||
|
|
||||||
if (mob == null)
|
if (mob == null)
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ 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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -95,7 +96,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, Mob captain) {
|
private static void serializeGuardList(ByteBufferWriter writer, int minion) {
|
||||||
|
|
||||||
writer.putInt(1);
|
writer.putInt(1);
|
||||||
|
|
||||||
@@ -105,7 +106,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(captain.getRank());//minion rank
|
writer.putInt(1);
|
||||||
writer.put((byte) 0);
|
writer.put((byte) 0);
|
||||||
|
|
||||||
writer.putInt(600); //roll time
|
writer.putInt(600); //roll time
|
||||||
@@ -342,17 +343,14 @@ 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 + npc.minions.size());
|
writer.putInt(1 + siegeMinions.size());
|
||||||
serializeBulwarkList(writer, 1); //Trebuchet
|
serializeBulwarkList(writer, 1); //Trebuchet
|
||||||
//serializeBulwarkList(writer, 2); //Ballista
|
//serializeBulwarkList(writer, 2); //Ballista
|
||||||
|
|
||||||
if (npc.minions != null && npc.minions.size() > 0)
|
if (siegeMinions != null && siegeMinions.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());
|
||||||
@@ -368,7 +366,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.guardCaptain.isAlive()) {
|
if (mob.npcOwner.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);
|
||||||
@@ -559,7 +557,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|||||||
|
|
||||||
} else if (this.targetType == GameObjectType.Mob.ordinal()) {
|
} else if (this.targetType == GameObjectType.Mob.ordinal()) {
|
||||||
|
|
||||||
mobA = Mob.getMob(this.targetID);
|
mobA = Mob.getFromCacheDBID(this.targetID);
|
||||||
|
|
||||||
if (mobA == null) {
|
if (mobA == null) {
|
||||||
Logger.error("Missing Mob of ID " + this.targetID);
|
Logger.error("Missing Mob of ID " + this.targetID);
|
||||||
@@ -668,15 +666,14 @@ 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(mobA.minions.size() + 1);
|
writer.putInt(siegeMinions.size() + 1);
|
||||||
|
serializeGuardList(writer, mobA.getContract().getContractID()); //Guard
|
||||||
|
|
||||||
serializeGuardList(writer, mobA.getContract().getContractID(), mobA); //Guard
|
if (siegeMinions != null && siegeMinions.size() > 0)
|
||||||
|
|
||||||
if (mobA.minions != null && mobA.minions.size() > 0)
|
for (Mob mob : siegeMinions.keySet()) {
|
||||||
|
|
||||||
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());
|
||||||
@@ -692,7 +689,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.guardCaptain.isAlive()) {
|
if (mob.npcOwner.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,7 +39,6 @@ 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;
|
||||||
@@ -53,8 +52,8 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
public int contractUUID;
|
public int contractUUID;
|
||||||
public Contract contract;
|
public Contract contract;
|
||||||
|
|
||||||
public String firstName;
|
protected String firstName;
|
||||||
public String lastName;
|
protected String lastName;
|
||||||
protected short statStrCurrent;
|
protected short statStrCurrent;
|
||||||
protected short statDexCurrent;
|
protected short statDexCurrent;
|
||||||
protected short statConCurrent;
|
protected short statConCurrent;
|
||||||
@@ -72,7 +71,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;
|
||||||
public ConcurrentHashMap<String, CharacterSkill> skills;
|
protected 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;
|
||||||
@@ -89,7 +88,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);
|
||||||
public Resists resists = new Resists("Genric");
|
protected 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;
|
||||||
@@ -118,35 +117,16 @@ 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.statStrCurrent = (short) 0;
|
this.powers = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||||
this.statDexCurrent = (short) 0;
|
this.skills = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||||
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();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -234,6 +214,8 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -276,6 +258,8 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -307,6 +291,8 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -356,6 +342,9 @@ 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() {
|
||||||
@@ -1107,7 +1096,6 @@ 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()) {
|
||||||
@@ -1125,9 +1113,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.combatTarget = value;
|
this.combatTarget = value;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final ConcurrentHashMap<String, JobContainer> getTimers() {
|
public final ConcurrentHashMap<String, JobContainer> getTimers() {
|
||||||
@@ -1772,6 +1758,29 @@ 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,7 +9,6 @@
|
|||||||
|
|
||||||
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;
|
||||||
@@ -33,19 +32,6 @@ 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);
|
||||||
@@ -101,8 +87,7 @@ 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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,6 +110,14 @@ 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());
|
||||||
@@ -163,11 +156,9 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
|
|||||||
this.setCombatTarget(null);
|
this.setCombatTarget(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear owner and set not alive
|
//clear owner
|
||||||
|
|
||||||
this.isAlive.set(false);
|
PlayerCharacter owner = this.getOwner();
|
||||||
|
|
||||||
PlayerCharacter owner = (PlayerCharacter) this.guardCaptain;
|
|
||||||
|
|
||||||
//close pet window
|
//close pet window
|
||||||
|
|
||||||
@@ -183,7 +174,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))
|
||||||
this.guardCaptain = null;
|
((Mob) this).setOwner(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -357,9 +357,7 @@ 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(false);
|
calculateModifiedAmount();
|
||||||
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(false);
|
calculateModifiedAmount();
|
||||||
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(false);
|
calculateModifiedAmount();
|
||||||
this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken());
|
this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -264,9 +264,8 @@ 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;
|
||||||
boolean isGuard = mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN) || mob.agentType.equals(Enum.AIAgentType.GUARDMINION);
|
calculateMobBaseAmount();
|
||||||
calculateMobBaseAmount(isGuard);
|
calculateModifiedAmount();
|
||||||
calculateModifiedAmount(isGuard);
|
|
||||||
this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken());
|
this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -278,7 +277,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(false);
|
calculateModifiedAmount();
|
||||||
this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken());
|
this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -371,7 +370,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(false);
|
cs.calculateModifiedAmount();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -757,7 +756,7 @@ public class CharacterSkill extends AbstractGameObject {
|
|||||||
|
|
||||||
//recalculate this skill
|
//recalculate this skill
|
||||||
calculateBaseAmount();
|
calculateBaseAmount();
|
||||||
calculateModifiedAmount(false);
|
calculateModifiedAmount();
|
||||||
|
|
||||||
//see if any new skills or powers granted
|
//see if any new skills or powers granted
|
||||||
pc.calculateSkills();
|
pc.calculateSkills();
|
||||||
@@ -849,7 +848,7 @@ public class CharacterSkill extends AbstractGameObject {
|
|||||||
if (recalculate) {
|
if (recalculate) {
|
||||||
//recalculate this skill
|
//recalculate this skill
|
||||||
calculateBaseAmount();
|
calculateBaseAmount();
|
||||||
calculateModifiedAmount(false);
|
calculateModifiedAmount();
|
||||||
|
|
||||||
//see if any skills or powers removed
|
//see if any skills or powers removed
|
||||||
pc.calculateSkills();
|
pc.calculateSkills();
|
||||||
@@ -888,7 +887,7 @@ public class CharacterSkill extends AbstractGameObject {
|
|||||||
if (recalculate) {
|
if (recalculate) {
|
||||||
//recalculate this skill
|
//recalculate this skill
|
||||||
calculateBaseAmount();
|
calculateBaseAmount();
|
||||||
calculateModifiedAmount(false);
|
calculateModifiedAmount();
|
||||||
|
|
||||||
//see if any skills or powers removed
|
//see if any skills or powers removed
|
||||||
pc.calculateSkills();
|
pc.calculateSkills();
|
||||||
@@ -1017,34 +1016,33 @@ public class CharacterSkill extends AbstractGameObject {
|
|||||||
this.modifiedAmountBeforeMods = Math.round(this.baseAmountBeforeMods + calculateAmountAfterTrains());
|
this.modifiedAmountBeforeMods = Math.round(this.baseAmountBeforeMods + calculateAmountAfterTrains());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void calculateMobBaseAmount(boolean isGuard) {
|
public void calculateMobBaseAmount() {
|
||||||
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;
|
this.modifiedAmount = 1;
|
||||||
this.modifiedAmount = 1;
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.skillsBase == null) {
|
|
||||||
Logger.error("SkillsBase not found for skill " + this.getObjectUUID());
|
|
||||||
this.baseAmount = 1;
|
|
||||||
this.modifiedAmount = 1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.skillsBase == null) {
|
||||||
|
Logger.error("SkillsBase not found for skill " + this.getObjectUUID());
|
||||||
|
this.baseAmount = 1;
|
||||||
|
this.modifiedAmount = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//Get any rune bonus
|
//Get any rune bonus
|
||||||
float bonus = 0f;
|
float bonus = 0f;
|
||||||
//TODO SKILLS RUNES
|
//TODO SKILLS RUNES
|
||||||
float base = 7f;
|
|
||||||
float statMod = 0.5f;
|
if (CharacterSkill.GetOwner(this).getBonuses() != null) {
|
||||||
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 unmodified stats
|
//Get Base skill for unmodified stats
|
||||||
|
float base = 7f;
|
||||||
|
float statMod = 0.5f;
|
||||||
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)
|
||||||
@@ -1059,7 +1057,6 @@ 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)
|
||||||
@@ -1069,48 +1066,45 @@ public class CharacterSkill extends AbstractGameObject {
|
|||||||
this.modifiedAmountBeforeMods = (int) (this.baseAmountBeforeMods + calculateAmountAfterTrains());
|
this.modifiedAmountBeforeMods = (int) (this.baseAmountBeforeMods + calculateAmountAfterTrains());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void calculateModifiedAmount(boolean isGuard) {
|
public void calculateModifiedAmount() {
|
||||||
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;
|
||||||
float base = 7f;
|
if (CharacterSkill.GetOwner(this).getBonuses() != null) {
|
||||||
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
|
|
||||||
//TODO this fomula needs verified
|
|
||||||
|
|
||||||
if (this.skillsBase.getStrMod() > 0)
|
|
||||||
statMod += (float) this.skillsBase.getStrMod() * (float) CharacterSkill.GetOwner(this).getStatStrCurrent() / 100f;
|
|
||||||
if (this.skillsBase.getDexMod() > 0)
|
|
||||||
statMod += (float) this.skillsBase.getDexMod() * (float) CharacterSkill.GetOwner(this).getStatDexCurrent() / 100f;
|
|
||||||
if (this.skillsBase.getConMod() > 0)
|
|
||||||
statMod += (float) this.skillsBase.getConMod() * (float) CharacterSkill.GetOwner(this).getStatConCurrent() / 100f;
|
|
||||||
if (this.skillsBase.getIntMod() > 0)
|
|
||||||
statMod += (float) this.skillsBase.getIntMod() * (float) CharacterSkill.GetOwner(this).getStatIntCurrent() / 100f;
|
|
||||||
if (this.skillsBase.getSpiMod() > 0)
|
|
||||||
statMod += (float) this.skillsBase.getSpiMod() * (float) CharacterSkill.GetOwner(this).getStatSpiCurrent() / 100f;
|
|
||||||
if (statMod < 1)
|
|
||||||
statMod = 1f;
|
|
||||||
else if (statMod > 600)
|
|
||||||
statMod = 600f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Get Base skill for modified stats
|
||||||
|
//TODO this fomula needs verified
|
||||||
|
float base = 7f;
|
||||||
|
float statMod = 0.5f;
|
||||||
|
if (this.skillsBase.getStrMod() > 0)
|
||||||
|
statMod += (float) this.skillsBase.getStrMod() * (float) CharacterSkill.GetOwner(this).getStatStrCurrent() / 100f;
|
||||||
|
if (this.skillsBase.getDexMod() > 0)
|
||||||
|
statMod += (float) this.skillsBase.getDexMod() * (float) CharacterSkill.GetOwner(this).getStatDexCurrent() / 100f;
|
||||||
|
if (this.skillsBase.getConMod() > 0)
|
||||||
|
statMod += (float) this.skillsBase.getConMod() * (float) CharacterSkill.GetOwner(this).getStatConCurrent() / 100f;
|
||||||
|
if (this.skillsBase.getIntMod() > 0)
|
||||||
|
statMod += (float) this.skillsBase.getIntMod() * (float) CharacterSkill.GetOwner(this).getStatIntCurrent() / 100f;
|
||||||
|
if (this.skillsBase.getSpiMod() > 0)
|
||||||
|
statMod += (float) this.skillsBase.getSpiMod() * (float) CharacterSkill.GetOwner(this).getStatSpiCurrent() / 100f;
|
||||||
|
if (statMod < 1)
|
||||||
|
statMod = 1f;
|
||||||
|
else if (statMod > 600)
|
||||||
|
statMod = 600f;
|
||||||
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) != null && CharacterSkill.GetOwner(this).getBonuses() != null) {
|
if (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);
|
||||||
}
|
}
|
||||||
@@ -1122,7 +1116,7 @@ public class CharacterSkill extends AbstractGameObject {
|
|||||||
|
|
||||||
float modAmount = this.baseAmount + calculateAmountAfterTrains();
|
float modAmount = this.baseAmount + calculateAmountAfterTrains();
|
||||||
|
|
||||||
if (CharacterSkill.GetOwner(this) != null && CharacterSkill.GetOwner(this).getBonuses() != null) {
|
if (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("destroyCity:" + this.getName());
|
destroyCityThread.setName("deestroyCity:" + this.getName());
|
||||||
destroyCityThread.start();
|
destroyCityThread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+807
-414
File diff suppressed because it is too large
Load Diff
@@ -27,7 +27,6 @@ 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;
|
||||||
@@ -109,8 +108,6 @@ 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,9 +21,6 @@ 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
|
||||||
@@ -34,8 +31,6 @@ 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");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -48,8 +43,6 @@ 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() {
|
||||||
@@ -79,8 +72,5 @@ public class MobBaseStats {
|
|||||||
return baseDex;
|
return baseDex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getBaseSkill(){return mobbaseSkill;}
|
|
||||||
|
|
||||||
public int getBaseSkillAmount(){return mobbaseSkillAmount;}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+19
-18
@@ -50,6 +50,7 @@ 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;
|
||||||
@@ -85,7 +86,6 @@ 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;
|
||||||
}
|
}
|
||||||
@@ -470,7 +470,8 @@ public class NPC extends AbstractCharacter {
|
|||||||
newNPC.bindLoc = Vector3fImmutable.ZERO;
|
newNPC.bindLoc = Vector3fImmutable.ZERO;
|
||||||
|
|
||||||
newNPC.parentZoneUUID = parent.getObjectUUID();
|
newNPC.parentZoneUUID = parent.getObjectUUID();
|
||||||
newNPC.guildUUID = guild.getObjectUUID();
|
// guild may be null when spawning via ./npc; default to 0
|
||||||
|
newNPC.guildUUID = (guild != null) ? guild.getObjectUUID() : 0;
|
||||||
|
|
||||||
if (building == null)
|
if (building == null)
|
||||||
newNPC.buildingUUID = 0;
|
newNPC.buildingUUID = 0;
|
||||||
@@ -640,31 +641,26 @@ 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 {
|
||||||
minionMob.clearEffects();
|
toRemove.clearEffects();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(e.getMessage());
|
Logger.error(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (minionMob.getParentZone() != null)
|
if (toRemove.getParentZone() != null)
|
||||||
minionMob.getParentZone().zoneMobSet.remove(minionMob);
|
toRemove.getParentZone().zoneMobSet.remove(toRemove);
|
||||||
|
|
||||||
WorldGrid.RemoveWorldObject(minionMob);
|
WorldGrid.RemoveWorldObject(toRemove);
|
||||||
DbManager.removeFromCache(minionMob);
|
DbManager.removeFromCache(toRemove);
|
||||||
|
|
||||||
|
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);
|
||||||
@@ -672,7 +668,6 @@ public class NPC extends AbstractCharacter {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -811,8 +806,6 @@ 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;
|
||||||
|
|
||||||
@@ -854,6 +847,10 @@ 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
|
||||||
|
|
||||||
@@ -1107,6 +1104,10 @@ 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,6 +135,7 @@ 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
|
||||||
@@ -143,6 +144,7 @@ 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.
|
||||||
@@ -203,18 +205,15 @@ public class PlayerCharacter extends AbstractCharacter {
|
|||||||
this.spiMod.set(spiMod);
|
this.spiMod.set(spiMod);
|
||||||
|
|
||||||
this.guildStatus = new AtomicInteger(0);
|
this.guildStatus = new AtomicInteger(0);
|
||||||
this.buildingUUID = -1;
|
this.bindBuildingID = -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);
|
||||||
@@ -266,7 +265,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.buildingUUID = rs.getInt("char_bindBuilding");
|
this.bindBuildingID = rs.getInt("char_bindBuilding");
|
||||||
|
|
||||||
this.hash = rs.getString("hash");
|
this.hash = rs.getString("hash");
|
||||||
|
|
||||||
@@ -2722,12 +2721,12 @@ public class PlayerCharacter extends AbstractCharacter {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public synchronized int getBindBuildingID() {
|
public synchronized int getBindBuildingID() {
|
||||||
return this.buildingUUID;
|
return this.bindBuildingID;
|
||||||
}
|
}
|
||||||
|
|
||||||
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.buildingUUID = value;
|
this.bindBuildingID = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AbstractGameObject getLastTarget() {
|
public AbstractGameObject getLastTarget() {
|
||||||
@@ -2773,6 +2772,10 @@ 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;
|
||||||
}
|
}
|
||||||
@@ -4558,6 +4561,10 @@ 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);
|
||||||
@@ -4685,8 +4692,7 @@ 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);
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
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");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// 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");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// 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,7 +11,6 @@ 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;
|
||||||
@@ -23,7 +22,6 @@ 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;
|
||||||
@@ -119,12 +117,20 @@ 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) {
|
||||||
@@ -134,21 +140,7 @@ 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) {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ 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;
|
||||||
@@ -74,7 +75,7 @@ public class CreateMobPowerAction extends AbstractPowerAction {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
//create Pet
|
//create Pet
|
||||||
Mob pet = Mob.createPetMinion(mobID, seaFloor, owner, (short) mobLevel);
|
Mob pet = Mob.createPet(mobID, guild, 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
|
||||||
@@ -83,6 +84,8 @@ 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();
|
||||||
|
|
||||||
@@ -92,10 +95,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())
|
||||||
@@ -103,6 +106,7 @@ 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
|
||||||
@@ -111,7 +115,7 @@ public class CreateMobPowerAction extends AbstractPowerAction {
|
|||||||
DbManager.removeFromCache(currentPet);
|
DbManager.removeFromCache(currentPet);
|
||||||
currentPet.setCombatTarget(null);
|
currentPet.setCombatTarget(null);
|
||||||
|
|
||||||
currentPet.guardCaptain = null;
|
currentPet.setOwner(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);
|
||||||
@@ -121,8 +125,7 @@ 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())
|
||||||
@@ -134,9 +137,26 @@ 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).fearedObject = source;
|
((Mob) awo).setFearedObject(source);
|
||||||
JobScheduler.getInstance().scheduleJob(efj, duration * 1000);
|
JobScheduler.getInstance().scheduleJob(efj, duration * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
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;
|
||||||
@@ -17,7 +18,6 @@ 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._runeSetMap = DbManager.ItemBaseQueries.LOAD_RUNES_FOR_NPC_AND_MOBS();
|
NPCManager.LoadAllRuneSets();
|
||||||
|
|
||||||
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,11 +351,8 @@ public class WorldServer {
|
|||||||
Logger.info("Loading MobBases.");
|
Logger.info("Loading MobBases.");
|
||||||
DbManager.MobBaseQueries.GET_ALL_MOBBASES();
|
DbManager.MobBaseQueries.GET_ALL_MOBBASES();
|
||||||
|
|
||||||
Logger.info("Loading Rune Powers");
|
Logger.info("Loading Mob Powers");
|
||||||
PowersManager._allRunePowers = dbRuneBaseHandler.LOAD_RUNE_POWERS();
|
PowersManager.AllMobPowers = DbManager.PowerQueries.LOAD_MOB_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();
|
||||||
@@ -554,40 +551,44 @@ 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) {
|
||||||
|
|
||||||
ZoneManager.addZone(zone.getLoadNum(), zone);
|
|
||||||
zone.generateWorldAltitude();
|
|
||||||
|
|
||||||
|
|
||||||
//Handle Buildings
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
ZoneManager.addZone(zone.getLoadNum(), zone);
|
||||||
|
|
||||||
|
try {
|
||||||
|
zone.generateWorldAltitude();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.error(e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
//Handle Buildings
|
||||||
|
|
||||||
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) {
|
||||||
|
|
||||||
b.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
|
try {
|
||||||
b.setLoc(b.getLoc());
|
b.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
|
||||||
|
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);
|
||||||
|
|
||||||
@@ -595,22 +596,15 @@ 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());
|
||||||
|
|
||||||
// Load Minions for Guard Captains here.
|
//ADD GUARDS HERE.
|
||||||
|
if (m.building != null && m.building.getBlueprint() != null && m.building.getBlueprint().getBuildingGroup() == BuildingGroup.BARRACK)
|
||||||
if (m.building != null && m.building.getBlueprint() != null && m.building.getBlueprint().getBuildingGroup() == Enum.BuildingGroup.BARRACK)
|
DbManager.MobQueries.LOAD_PATROL_POINTS(m);
|
||||||
DbManager.MobQueries.LOAD_GUARD_MINIONS(m);
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.error(e);
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
//Handle NPCs
|
//Handle npc's
|
||||||
|
|
||||||
try {
|
|
||||||
ArrayList<NPC> npcs;
|
ArrayList<NPC> npcs;
|
||||||
|
|
||||||
// Ignore NPCs on the seafloor (npc guild leaders, etc)
|
// Ignore npc's on the seafloor (npc guild leaders, etc)
|
||||||
|
|
||||||
if (zone.equals(seaFloor))
|
if (zone.equals(seaFloor))
|
||||||
continue;
|
continue;
|
||||||
@@ -618,22 +612,26 @@ 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) {
|
||||||
n.setObjectTypeMask(MBServerStatics.MASK_NPC);
|
|
||||||
n.setLoc(n.getLoc());
|
try {
|
||||||
|
n.setObjectTypeMask(MBServerStatics.MASK_NPC);
|
||||||
|
n.setLoc(n.getLoc());
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.error(n.getObjectUUID() + " returned an Error Message :" + e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Handle cities
|
||||||
|
|
||||||
|
ZoneManager.loadCities(zone);
|
||||||
|
ZoneManager.populateWorldZones(zone);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(e);
|
Logger.info(e.getMessage() + zone.getName() + ' ' + zone.getObjectUUID());
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
//Handle cities
|
|
||||||
|
|
||||||
ZoneManager.loadCities(zone);
|
|
||||||
ZoneManager.populateWorldZones(zone);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.info("time to load World Objects: " + (System.currentTimeMillis() - start) + " ms");
|
Logger.info("time to load: " + (System.currentTimeMillis() - start) + " ms");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -706,7 +704,7 @@ public class WorldServer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//remove player from loaded mobs agro maps
|
//remove player from loaded mobs agro maps
|
||||||
for (AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(player.getLoc(), MBServerStatics.CHARACTER_LOAD_RANGE, MBServerStatics.MASK_MOB)) {
|
for(AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(player.getLoc(),MBServerStatics.CHARACTER_LOAD_RANGE,MBServerStatics.MASK_MOB)) {
|
||||||
Mob loadedMob = (Mob) awo;
|
Mob loadedMob = (Mob) awo;
|
||||||
loadedMob.playerAgroMap.remove(player.getObjectUUID());
|
loadedMob.playerAgroMap.remove(player.getObjectUUID());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user