Compare commits
169 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 40bae67443 | |||
| 1cf1d731c4 | |||
| 24215e21c9 | |||
| 3accd779b9 | |||
| 1d673ca2e5 | |||
| c935ea1986 | |||
| 678ccafd3c | |||
| 31292785a5 | |||
| cdc4717033 | |||
| 35c8ac0289 | |||
| f5cc4a3290 | |||
| 74bd7ddb8b | |||
| 4feb95131c | |||
| d22ba7b89d | |||
| 722fd14be5 | |||
| 12e73d59c7 | |||
| 5c70f15064 | |||
| 8ca641f353 | |||
| 0f9500a0d7 | |||
| 0d51afb737 | |||
| 60e331de1a | |||
| 4a554b0d61 | |||
| 3f3d85fb36 | |||
| d2d655a839 | |||
| 0096b8051c | |||
| 86102c8933 | |||
| f06e2c2e5c | |||
| 74b425e567 | |||
| 22c8cdcf65 | |||
| 7ed026f088 | |||
| 232c381e96 | |||
| 69ea460d5e | |||
| cbe9a30590 | |||
| 1bbbc396bd | |||
| 8601f9fcd5 | |||
| 7f029fd0e2 | |||
| cc7188b404 | |||
| aa0621bb02 | |||
| b4ff1a3f7f | |||
| 9d6b1dcf60 | |||
| 6e123ecb86 | |||
| 2b8b9464af | |||
| cd8099b42f | |||
| 2cdcba47a5 | |||
| b7b4623c75 | |||
| 2d958b929d | |||
| e8f0e9f5de | |||
| 03f0f3fcf0 | |||
| 65db64d3df | |||
| 5a25958aa5 | |||
| 1f8c5495ab | |||
| a54aa03ade | |||
| e82445fcd2 | |||
| 9e9716fc88 | |||
| 4f01da368c | |||
| 93c4103f61 | |||
| f8180a7000 | |||
| 634f1478ce | |||
| 7335946c10 | |||
| fb4eea67ed | |||
| 96ba17f67a | |||
| ff17cacda7 | |||
| 4d6ce2b155 | |||
| b2c9331899 | |||
| 1cb01b1cce | |||
| e79fd0c3b4 | |||
| 6dd1d97be5 | |||
| 805034e30b | |||
| 9646964698 | |||
| 9ffaf96017 | |||
| ce98f80b85 | |||
| f683201086 | |||
| 4796f7042d | |||
| 94ff3cf222 | |||
| 174be35cac | |||
| ba266e506a | |||
| 4123157b92 | |||
| 7bb9aeacf7 | |||
| 1eda55a3f1 | |||
| f670e3143c | |||
| d55b57f7d0 | |||
| ea2f6f4593 | |||
| b592f050c2 | |||
| 25f522c539 | |||
| e89404abda | |||
| ad2cde9d85 | |||
| ba94fabfb8 | |||
| f7ab38e9a8 | |||
| 0d97fa614b | |||
| 6878916874 | |||
| c545468f26 | |||
| 7993fb22d2 | |||
| 19bdb89c0f | |||
| 6b0b0cc357 | |||
| bc1ae9a2c9 | |||
| 408e3a45ca | |||
| 52e0b5be4d | |||
| 161335da26 | |||
| 7f1bc2a4b7 | |||
| e37a4fab38 | |||
| 2760a45d2f | |||
| 77673fde5f | |||
| 5fd4e5a088 | |||
| b01b62ac3d | |||
| 7193ff7698 | |||
| dd72e20ff9 | |||
| f465ea4045 | |||
| 973dfc94f7 | |||
| a5255bcf11 | |||
| ec35228de9 | |||
| 47a93f6545 | |||
| 0cff40070b | |||
| 3f3fb53675 | |||
| b198dbcc09 | |||
| 60b8843563 | |||
| eff8be91d6 | |||
| 55e2d3fb5e | |||
| a6f417d9cc | |||
| 7b1b09dc40 | |||
| 5724608005 | |||
| f5d410f868 | |||
| a5c1422534 | |||
| 6df0e5625c | |||
| 5de932b095 | |||
| db7d606b36 | |||
| 30d302c43e | |||
| 95cfc43956 | |||
| 7c8d78581e | |||
| 6f4a9f7d1a | |||
| 7a5569ab89 | |||
| 042f7c675f | |||
| 3c4d8239db | |||
| 4f20cc9aba | |||
| 34812694b7 | |||
| 0bbbcbaa81 | |||
| 72172b9f05 | |||
| 1876e09b48 | |||
| 31c83f2bb5 | |||
| 065aa34652 | |||
| 8bbaae418d | |||
| 10db850de4 | |||
| 753c3686ea | |||
| f4bd928796 | |||
| 916a12a434 | |||
| 3a8521683b | |||
| df4d5a654f | |||
| 7fb5d7d23d | |||
| a7c9a15405 | |||
| b3b115e9ba | |||
| 1b5a64d8fc | |||
| 01f0e25e08 | |||
| 0782814c8e | |||
| 111ba02289 | |||
| f09a7d4d12 | |||
| e1e72b71bd | |||
| 4dce2e2aa2 | |||
| 743c897254 | |||
| f134f71695 | |||
| 91016dd53c | |||
| 39d04188b4 | |||
| c99433c9bd | |||
| 6cc94e076d | |||
| f294e48140 | |||
| c25f325f87 | |||
| ac0c11cb46 | |||
| 79e86e0a6f | |||
| 46f35f0b10 | |||
| 1b20201f8d | |||
| 1bc3609cbe |
@@ -8,6 +8,7 @@
|
||||
|
||||
package engine.InterestManagement;
|
||||
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.gameManager.GroupManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.job.JobScheduler;
|
||||
@@ -17,7 +18,6 @@ import engine.mbEnums.DispatchChannel;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.net.AbstractNetMsg;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.LoadCharacterMsg;
|
||||
import engine.net.client.msg.LoadStructureMsg;
|
||||
@@ -88,7 +88,7 @@ public enum InterestManager implements Runnable {
|
||||
if (send) {
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(player, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -270,7 +270,7 @@ public enum InterestManager implements Runnable {
|
||||
}
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(player, uom);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
}
|
||||
|
||||
loadedStaticObjects.removeAll(toRemove);
|
||||
@@ -292,7 +292,7 @@ public enum InterestManager implements Runnable {
|
||||
lcm = new LoadCharacterMsg(corpse, PlayerCharacter.hideNonAscii());
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(player, lcm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
|
||||
} else if (awo.getObjectType().equals(GameObjectType.NPC)) {
|
||||
NPC npc = (NPC) awo;
|
||||
@@ -304,13 +304,13 @@ public enum InterestManager implements Runnable {
|
||||
|
||||
if (lsm.getStructureList().size() > 0) {
|
||||
Dispatch dispatch = Dispatch.borrow(player, lsm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
}
|
||||
|
||||
for (LoadCharacterMsg lc : lcmList) {
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(player, lc);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
}
|
||||
|
||||
loadedStaticObjects.addAll(toLoad);
|
||||
@@ -414,7 +414,7 @@ public enum InterestManager implements Runnable {
|
||||
|
||||
if (!uom.getObjectList().isEmpty()) {
|
||||
Dispatch dispatch = Dispatch.borrow(player, uom);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -492,7 +492,7 @@ public enum InterestManager implements Runnable {
|
||||
|
||||
if (lcm != null) {
|
||||
Dispatch dispatch = Dispatch.borrow(player, lcm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
|
||||
package engine.InterestManagement;
|
||||
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.TerritoryChangeMessage;
|
||||
import engine.objects.City;
|
||||
import engine.objects.PlayerCharacter;
|
||||
@@ -68,7 +68,7 @@ public enum RealmMap {
|
||||
|
||||
public static Realm getRealmForCity(City city) {
|
||||
Realm outRealm = null;
|
||||
outRealm = city.getRealm();
|
||||
outRealm = city.realm;
|
||||
return outRealm;
|
||||
}
|
||||
|
||||
@@ -91,17 +91,17 @@ public enum RealmMap {
|
||||
if (city != null) {
|
||||
TerritoryChangeMessage tcm = new TerritoryChangeMessage((PlayerCharacter) realm.getRulingCity().getOwner(), realm);
|
||||
Dispatch dispatch = Dispatch.borrow(player, tcm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
} else {
|
||||
TerritoryChangeMessage tcm = new TerritoryChangeMessage(null, realm);
|
||||
Dispatch dispatch = Dispatch.borrow(player, tcm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
}
|
||||
|
||||
} else {
|
||||
TerritoryChangeMessage tcm = new TerritoryChangeMessage(null, realm);
|
||||
Dispatch dispatch = Dispatch.borrow(player, tcm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ public class Terrain {
|
||||
|
||||
public static float getWorldHeight(Zone zone, Vector3fImmutable world_loc) {
|
||||
|
||||
// Retrieve the next zone with a terrain defined.
|
||||
// Retrieve the next zone up in the tree with a terrain defined.
|
||||
|
||||
Zone terrainZone = getNextZoneWithTerrain(zone);
|
||||
Zone parentZone = getNextZoneWithTerrain(zone.parent);
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
|
||||
package engine.InterestManagement;
|
||||
|
||||
import engine.mbEnums.GridObjectType;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.math.FastMath;
|
||||
import engine.math.Vector3f;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.mbEnums.GridObjectType;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.LoadCharacterMsg;
|
||||
import engine.net.client.msg.LoadStructureMsg;
|
||||
@@ -201,7 +201,7 @@ public class WorldGrid {
|
||||
|
||||
UnloadObjectsMsg uom = new UnloadObjectsMsg();
|
||||
uom.addObject(awo);
|
||||
DispatchMessage.sendToAllInRange(awo, uom);
|
||||
DispatchManager.sendToAllInRange(awo, uom);
|
||||
}
|
||||
|
||||
public static void loadObject(AbstractWorldObject awo) {
|
||||
@@ -213,15 +213,15 @@ public class WorldGrid {
|
||||
case Building:
|
||||
lsm = new LoadStructureMsg();
|
||||
lsm.addObject((Building) awo);
|
||||
DispatchMessage.sendToAllInRange(awo, lsm);
|
||||
DispatchManager.sendToAllInRange(awo, lsm);
|
||||
break;
|
||||
case NPC:
|
||||
lcm = new LoadCharacterMsg((NPC) awo, false);
|
||||
DispatchMessage.sendToAllInRange(awo, lcm);
|
||||
DispatchManager.sendToAllInRange(awo, lcm);
|
||||
break;
|
||||
case Mob:
|
||||
lcm = new LoadCharacterMsg((Mob) awo, false);
|
||||
DispatchMessage.sendToAllInRange(awo, lcm);
|
||||
DispatchManager.sendToAllInRange(awo, lcm);
|
||||
break;
|
||||
default:
|
||||
// *** Refactor: Log error?
|
||||
@@ -239,19 +239,19 @@ public class WorldGrid {
|
||||
case Building:
|
||||
lsm = new LoadStructureMsg();
|
||||
lsm.addObject((Building) awo);
|
||||
DispatchMessage.sendToAllInRange(awo, lsm);
|
||||
DispatchManager.sendToAllInRange(awo, lsm);
|
||||
break;
|
||||
case NPC:
|
||||
lcm = new LoadCharacterMsg((NPC) awo, false);
|
||||
DispatchMessage.sendToAllInRange(awo, lcm);
|
||||
DispatchManager.sendToAllInRange(awo, lcm);
|
||||
break;
|
||||
case Mob:
|
||||
lcm = new LoadCharacterMsg((Mob) awo, false);
|
||||
DispatchMessage.sendToAllInRange(awo, lcm);
|
||||
DispatchManager.sendToAllInRange(awo, lcm);
|
||||
break;
|
||||
case PlayerCharacter:
|
||||
lcm = new LoadCharacterMsg((PlayerCharacter) awo, false);
|
||||
DispatchMessage.sendToAllInRange(awo, lcm);
|
||||
DispatchManager.sendToAllInRange(awo, lcm);
|
||||
break;
|
||||
default:
|
||||
// *** Refactor: Log error?
|
||||
@@ -263,7 +263,7 @@ public class WorldGrid {
|
||||
ClientConnection origin) {
|
||||
UnloadObjectsMsg uom = new UnloadObjectsMsg();
|
||||
uom.addObject(awo);
|
||||
DispatchMessage.sendToAllInRange(awo, uom);
|
||||
DispatchManager.sendToAllInRange(awo, uom);
|
||||
}
|
||||
|
||||
public static void addObject(AbstractWorldObject awo, PlayerCharacter pc) {
|
||||
|
||||
@@ -89,7 +89,8 @@ public class GuildRecord extends DataRecord {
|
||||
guildRecord.guildHash = guildRecord.guild.getHash();
|
||||
guildRecord.guildID = guildRecord.guild.getObjectUUID();
|
||||
guildRecord.guildName = guildRecord.guild.getName();
|
||||
guildRecord.charterName = mbEnums.GuildCharterType.getGuildTypeFromInt(guildRecord.guild.getCharter()).getCharterName();
|
||||
mbEnums.GuildCharterType guildCharterType = guild.charter;
|
||||
guildRecord.charterName = guildCharterType.name;
|
||||
|
||||
guildRecord.GLHash = DataWarehouse.hasher.encrypt(guildRecord.guild.getGuildLeaderUUID());
|
||||
|
||||
|
||||
@@ -52,25 +52,24 @@ public class dbCityHandler extends dbHandlerBase {
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<AbstractGameObject> CREATE_CITY(int ownerID, int parentZoneID, int realmID, float xCoord, float yCoord, float zCoord, float rotation, float W, String name, LocalDateTime established) {
|
||||
public ArrayList<AbstractGameObject> CREATE_CITY(int ownerID, int parentZoneID, float xCoord, float yCoord, float zCoord, float rotation, float W, String name, LocalDateTime established) {
|
||||
|
||||
LocalDateTime upgradeTime = LocalDateTime.now().plusHours(2);
|
||||
ArrayList<AbstractGameObject> objectList = new ArrayList<>();
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("CALL `city_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?,?,?)")) {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("CALL `city_CREATE`(?, ?, ?, ?, ?, ?, ?, ?,?,?)")) {
|
||||
|
||||
preparedStatement.setLong(1, ownerID); //objectUUID of owning player
|
||||
preparedStatement.setLong(2, parentZoneID); //objectUUID of parent (continent) zone
|
||||
preparedStatement.setLong(3, realmID); //objectUUID of realm city belongs in
|
||||
preparedStatement.setFloat(4, xCoord); //xOffset from parentZone center
|
||||
preparedStatement.setFloat(5, yCoord); //yOffset from parentZone center
|
||||
preparedStatement.setFloat(6, zCoord); //zOffset from parentZone center
|
||||
preparedStatement.setString(7, name); //city name
|
||||
preparedStatement.setTimestamp(8, Timestamp.valueOf(established));
|
||||
preparedStatement.setFloat(9, rotation);
|
||||
preparedStatement.setFloat(10, W);
|
||||
preparedStatement.setTimestamp(11, Timestamp.valueOf(upgradeTime));
|
||||
preparedStatement.setFloat(3, xCoord); //xOffset from parentZone center
|
||||
preparedStatement.setFloat(4, yCoord); //yOffset from parentZone center
|
||||
preparedStatement.setFloat(5, zCoord); //zOffset from parentZone center
|
||||
preparedStatement.setString(6, name); //city name
|
||||
preparedStatement.setTimestamp(7, Timestamp.valueOf(established));
|
||||
preparedStatement.setFloat(8, rotation);
|
||||
preparedStatement.setFloat(9, W);
|
||||
preparedStatement.setTimestamp(10, Timestamp.valueOf(upgradeTime));
|
||||
|
||||
boolean work = preparedStatement.execute();
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class dbEffectsResourceCostHandler extends dbHandlerBase {
|
||||
@@ -30,73 +29,6 @@ public class dbEffectsResourceCostHandler extends dbHandlerBase {
|
||||
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||
}
|
||||
|
||||
public void GENERATE_COST_DATA() {
|
||||
ArrayList<String> effectList = GET_EFFECTS_WITH_COST();
|
||||
|
||||
for (String effectID : effectList) {
|
||||
JSONObject costMap = GET_EFFECT_COSTMAP(effectID);
|
||||
WRITE_COSTMAP(effectID, costMap);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public JSONObject GET_EFFECT_COSTMAP(String effectID) {
|
||||
HashMap<mbEnums.ResourceType, Integer> costMap = new HashMap<>();
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_power_effectcost` WHERE `IDString` = ?")) {
|
||||
|
||||
preparedStatement.setString(1, effectID);
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
mbEnums.ResourceType resourceType = mbEnums.ResourceType.resourceLookup.get(rs.getInt("resource"));
|
||||
int value = rs.getInt("amount");
|
||||
costMap.put(resourceType, value);
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
return new JSONObject(costMap);
|
||||
}
|
||||
|
||||
public ArrayList<String> GET_EFFECTS_WITH_COST() {
|
||||
|
||||
ArrayList<String> effectList = new ArrayList<>();
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT DISTINCT `IDString` FROM `static_power_effectcost`")) {
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
effectList.add(rs.getString("IdString"));
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
return effectList;
|
||||
}
|
||||
|
||||
public boolean WRITE_COSTMAP(String effectID, JSONObject costmap) {
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `static_effect_costmaps` (`effectID`, `costMap`) VALUES (?, ?) " +
|
||||
"ON DUPLICATE KEY UPDATE `costmap` = VALUES(`costmap`)")) {
|
||||
|
||||
preparedStatement.setString(1, effectID);
|
||||
preparedStatement.setString(2, costmap.toString());
|
||||
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void LOAD_ALL_COSTMAPS() {
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
@@ -123,22 +55,4 @@ public class dbEffectsResourceCostHandler extends dbHandlerBase {
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<EffectsResourceCosts> GET_ALL_EFFECT_RESOURCES(String idString) {
|
||||
|
||||
ArrayList<EffectsResourceCosts> effectsResourceCosts = new ArrayList<>();
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_power_effectcost` WHERE `IDString` = ?")) {
|
||||
|
||||
preparedStatement.setString(1, idString);
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
effectsResourceCosts = getObjectsFromRs(rs, 1000);
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
|
||||
return effectsResourceCosts;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -427,7 +427,7 @@ public class dbGuildHandler extends dbHandlerBase {
|
||||
preparedStatement.setInt(6, guildTag.symbolColor);
|
||||
preparedStatement.setInt(7, guildTag.backgroundDesign);
|
||||
preparedStatement.setInt(8, guildTag.symbol);
|
||||
preparedStatement.setInt(9, g.getCharter());
|
||||
preparedStatement.setInt(9, g.charter.templateID);
|
||||
preparedStatement.setString(10, g.getLeadershipType());
|
||||
preparedStatement.setString(11, g.getMotto());
|
||||
|
||||
@@ -573,7 +573,7 @@ public class dbGuildHandler extends dbHandlerBase {
|
||||
preparedStatement.setInt(4, g.getGuildTag().symbolColor);
|
||||
preparedStatement.setInt(5, g.getGuildTag().backgroundDesign);
|
||||
preparedStatement.setInt(6, g.getGuildTag().symbol);
|
||||
preparedStatement.setInt(7, g.getCharter());
|
||||
preparedStatement.setInt(7, g.charter.templateID);
|
||||
preparedStatement.setString(8, g.getMOTD());
|
||||
preparedStatement.setString(9, g.getICMOTD());
|
||||
preparedStatement.setString(10, "");
|
||||
|
||||
@@ -554,7 +554,7 @@ public class dbItemHandler extends dbHandlerBase {
|
||||
|
||||
// Write 0 if we will not modify the value from template
|
||||
|
||||
if (item.value == item.template.item_value)
|
||||
if (value == item.template.item_value)
|
||||
value = 0;
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
|
||||
package engine.db.handlers;
|
||||
|
||||
import engine.mbEnums;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.mbEnums;
|
||||
import engine.objects.Mine;
|
||||
import engine.objects.MineProduction;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
package engine.db.handlers;
|
||||
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.objects.MobBase;
|
||||
import engine.objects.MobBaseEffects;
|
||||
import engine.objects.MobBaseStats;
|
||||
|
||||
@@ -310,6 +310,22 @@ public class dbNPCHandler extends dbHandlerBase {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean UPDATE_RACE(NPC npc, int value) {
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_npc` SET `npc_raceID`=? WHERE `UID`=?")) {
|
||||
|
||||
preparedStatement.setInt(1, value);
|
||||
preparedStatement.setLong(2, npc.getObjectUUID());
|
||||
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void LOAD_PIRATE_NAMES() {
|
||||
|
||||
String pirateName;
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
package engine.db.handlers;
|
||||
|
||||
import engine.mbEnums;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.mbEnums;
|
||||
import engine.objects.Petition;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
package engine.db.handlers;
|
||||
|
||||
import engine.mbEnums;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.mbEnums;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.objects.Heraldry;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
package engine.db.handlers;
|
||||
|
||||
import engine.mbEnums;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.mbEnums;
|
||||
import engine.objects.Mob;
|
||||
import engine.powers.EffectsBase;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
package engine.db.handlers;
|
||||
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.RuneBaseEffect;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
package engine.db.handlers;
|
||||
|
||||
import engine.mbEnums;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.mbEnums;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.Portal;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
|
||||
package engine.db.handlers;
|
||||
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.ProtectionState;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.ProtectionState;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.Shrine;
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
package engine.db.handlers;
|
||||
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.objects.MaxSkills;
|
||||
import engine.objects.SkillsBase;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
package engine.db.handlers;
|
||||
|
||||
import engine.mbEnums;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.mbEnums;
|
||||
import engine.objects.VendorDialog;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean UPDATE_WORKORDER(WorkOrder workOrder) {
|
||||
public boolean WRITE_WORKORDER(WorkOrder workOrder) {
|
||||
|
||||
JSONObject warehouseJSON = WorkOrder.toJson(workOrder);
|
||||
|
||||
@@ -187,7 +187,12 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
|
||||
public void LOAD_WORKORDERS() {
|
||||
|
||||
// Method loads NPC workOrders from disk at bootstrap.
|
||||
// A workOrder will persist until completed or junked
|
||||
// via the client interface.
|
||||
|
||||
ArrayList<WorkOrder> submitList = new ArrayList<>();
|
||||
ArrayList<WorkOrder> orphanList = new ArrayList<>();
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_workorders`;");
|
||||
@@ -202,22 +207,22 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
Logger.error(e);
|
||||
}
|
||||
|
||||
// Remove the old workOrder records
|
||||
|
||||
for (WorkOrder workOrder : submitList)
|
||||
DbManager.WarehouseQueries.DELETE_WORKORDER(workOrder);
|
||||
|
||||
// Submit the new workOrders to the ForgeManager
|
||||
// Submit new workOrders to the ForgeManager
|
||||
|
||||
for (WorkOrder workOrder : submitList) {
|
||||
|
||||
DbManager.WarehouseQueries.DELETE_WORKORDER(workOrder);
|
||||
|
||||
// Delete but do not reconstitute orphan workOrders
|
||||
|
||||
if (workOrder.vendor == null)
|
||||
continue;
|
||||
|
||||
workOrder.workOrderID = ForgeManager.workOrderCounter.incrementAndGet();
|
||||
DbManager.WarehouseQueries.WRITE_WORKORDER(workOrder);
|
||||
ForgeManager.vendorWorkOrderLookup.get(workOrder.vendor).add(workOrder);
|
||||
|
||||
// If workorder is not yet complete process it
|
||||
|
||||
if (workOrder.runCompleted == false)
|
||||
ForgeManager.forge.add(workOrder);
|
||||
|
||||
ForgeManager.forge.add(workOrder);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
package engine.db.handlers;
|
||||
|
||||
import engine.mbEnums;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.mbEnums;
|
||||
import engine.objects.Zone;
|
||||
import engine.objects.ZoneTemplate;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.objects.*;
|
||||
import engine.server.MBServerStatics;
|
||||
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.mbEnums;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums;
|
||||
import engine.objects.*;
|
||||
|
||||
public class GotoObj extends AbstractDevCmd {
|
||||
|
||||
@@ -475,7 +475,7 @@ public class InfoCmd extends AbstractDevCmd {
|
||||
output += "EquipSet: " + targetMob.equipmentSetID;
|
||||
output += newline;
|
||||
try {
|
||||
output += "Parent Zone LoadNum : " + targetMob.getParentZone().templateID;
|
||||
output += "Parent Zone LoadNum : " + targetMob.parentZone.templateID;
|
||||
} catch (Exception ex) {
|
||||
//who cares
|
||||
}
|
||||
|
||||
@@ -1,212 +0,0 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector3f;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums.ProtectionState;
|
||||
import engine.objects.*;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
/**
|
||||
* @author Eighty
|
||||
*/
|
||||
public class MakeBaneCmd extends AbstractDevCmd {
|
||||
|
||||
public MakeBaneCmd() {
|
||||
super("makebane");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||
AbstractGameObject target) {
|
||||
if (words.length < 1 || words.length > 2) {
|
||||
this.sendUsage(pc);
|
||||
return;
|
||||
}
|
||||
|
||||
int attackerID = 0;
|
||||
int rank = 8;
|
||||
|
||||
if (words.length == 2) {
|
||||
try {
|
||||
attackerID = Integer.parseInt(words[0]);
|
||||
rank = Integer.parseInt(words[1]);
|
||||
} catch (NumberFormatException e) {
|
||||
throwbackError(pc, "AttackerGuildID must be a number, " + words[0] + " is invalid");
|
||||
return;
|
||||
}
|
||||
} else if (words.length == 1) {
|
||||
if (target == null) {
|
||||
throwbackError(pc, "No target specified");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(target instanceof PlayerCharacter)) {
|
||||
throwbackError(pc, "Target is not a player");
|
||||
return;
|
||||
}
|
||||
attackerID = target.getObjectUUID();
|
||||
|
||||
try {
|
||||
rank = Integer.parseInt(words[0]);
|
||||
} catch (NumberFormatException e) {
|
||||
throwbackError(pc, "Rank must be specified, 1 through 8");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (rank < 1 || rank > 8) {
|
||||
throwbackError(pc, "Rank must be 1 through 8");
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerCharacter player = PlayerCharacter.getPlayerCharacter(attackerID);
|
||||
|
||||
|
||||
if (player.getGuild().isEmptyGuild()) {
|
||||
throwbackError(pc, "Errant's can not place banes");
|
||||
return;
|
||||
}
|
||||
|
||||
AbstractCharacter attackerAGL = Guild.GetGL(player.getGuild());
|
||||
|
||||
if (attackerAGL == null) {
|
||||
throwbackError(pc, "No guild leader found for attacking guild.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(attackerAGL instanceof PlayerCharacter)) {
|
||||
throwbackError(pc, "Attacking guild leader is an NPC.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getGuild().isNPCGuild()) {
|
||||
throwbackError(pc, "The guild used is an npc guild. They can not bane.");
|
||||
return;
|
||||
}
|
||||
|
||||
// if (player.getGuild().getOwnedCity() != null) {
|
||||
// throwbackError(pc, "The attacking guild already has a city.");
|
||||
// return;
|
||||
// }
|
||||
|
||||
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
|
||||
|
||||
if (zone == null) {
|
||||
throwbackError(pc, "Unable to find the zone you're in.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!zone.guild_zone) {
|
||||
throwbackError(pc, "This is not a player city.");
|
||||
return;
|
||||
}
|
||||
|
||||
City city = City.getCity(zone.playerCityUUID);
|
||||
if (city == null) {
|
||||
throwbackError(pc, "Unable to find the city associated with this zone.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (city.getTOL() == null) {
|
||||
throwbackError(pc, "Unable to find the tree of life for this city.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (city.getBane() != null) {
|
||||
throwbackError(pc, "This city is already baned.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Bane.getBaneByAttackerGuild(player.getGuild()) != null) {
|
||||
throwbackError(pc, "This guild is already baning someone.");
|
||||
return;
|
||||
}
|
||||
|
||||
Blueprint blueprint = Blueprint.getBlueprint(24300);
|
||||
|
||||
if (blueprint == null) {
|
||||
throwbackError(pc, "Unable to find building set for banestone.");
|
||||
return;
|
||||
}
|
||||
|
||||
Vector3f rot = new Vector3f(0, 0, 0);
|
||||
|
||||
// *** Refactor : Overlap test goes here
|
||||
|
||||
//Let's drop a banestone!
|
||||
Vector3fImmutable localLocation = ZoneManager.worldToLocal(pc.getLoc(), zone);
|
||||
|
||||
if (localLocation == null) {
|
||||
ChatManager.chatSystemError(pc, "Failed to convert world location to zone location. Contact a CCR.");
|
||||
Logger.info("Failed to Convert World coordinates to local zone coordinates");
|
||||
return;
|
||||
}
|
||||
|
||||
Building stone = DbManager.BuildingQueries.CREATE_BUILDING(
|
||||
zone.getObjectUUID(), pc.getObjectUUID(), blueprint.getName(), blueprint.getBlueprintUUID(),
|
||||
localLocation, 1.0f, blueprint.getMaxHealth(rank), ProtectionState.PROTECTED, 0, rank,
|
||||
null, blueprint.getBlueprintUUID(), 1, 0.0f);
|
||||
|
||||
if (stone == null) {
|
||||
ChatManager.chatSystemError(pc, "Failed to create banestone.");
|
||||
return;
|
||||
}
|
||||
stone.addEffectBit((1 << 19));
|
||||
BuildingManager.setRank(stone, (byte) rank);
|
||||
stone.setMaxHitPoints(blueprint.getMaxHealth(stone.getRank()));
|
||||
stone.setCurrentHitPoints(stone.getMaxHitPoints());
|
||||
BuildingManager.setUpgradeDateTime(stone, null, 0);
|
||||
|
||||
//Make the bane
|
||||
|
||||
Bane bane = Bane.makeBane(player, city, stone);
|
||||
|
||||
if (bane == null) {
|
||||
|
||||
//delete bane stone, failed to make bane object
|
||||
DbManager.BuildingQueries.DELETE_FROM_DATABASE(stone);
|
||||
|
||||
throwbackError(pc, "Failed to create bane.");
|
||||
return;
|
||||
}
|
||||
|
||||
WorldGrid.addObject(stone, pc);
|
||||
|
||||
//Add baned effect to TOL
|
||||
city.getTOL().addEffectBit((1 << 16));
|
||||
city.getTOL().updateEffects();
|
||||
|
||||
Vector3fImmutable movePlayerOutsideStone = player.getLoc();
|
||||
movePlayerOutsideStone = movePlayerOutsideStone.setX(movePlayerOutsideStone.x + 10);
|
||||
movePlayerOutsideStone = movePlayerOutsideStone.setZ(movePlayerOutsideStone.z + 10);
|
||||
player.teleport(movePlayerOutsideStone);
|
||||
|
||||
throwbackInfo(pc, "The city has been succesfully baned.");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Creates an bane.";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "'./makebane playerUUID baneRank'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -64,8 +64,9 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
||||
WorldGrid.RemoveWorldObject(mob);
|
||||
WorldGrid.removeObject(mob, pc);
|
||||
|
||||
if (mob.getParentZone() != null)
|
||||
if (mob.getParentZone() != null) {
|
||||
mob.getParentZone().zoneMobSet.remove(mob);
|
||||
}
|
||||
}
|
||||
|
||||
DbManager.NPCQueries.DELETE_NPC(npc);
|
||||
@@ -78,8 +79,9 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
||||
WorldGrid.RemoveWorldObject(mob);
|
||||
WorldGrid.removeObject(mob, pc);
|
||||
|
||||
if (mob.getParentZone() != null)
|
||||
if (mob.getParentZone() != null) {
|
||||
mob.getParentZone().zoneMobSet.remove(mob);
|
||||
}
|
||||
}
|
||||
DbManager.MobQueries.DELETE_MOB(mobA);
|
||||
DbManager.removeFromCache(GameObjectType.Mob,
|
||||
@@ -159,8 +161,9 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
||||
WorldGrid.RemoveWorldObject(mob);
|
||||
WorldGrid.removeObject(mob, pc);
|
||||
|
||||
if (mob.getParentZone() != null)
|
||||
if (mob.getParentZone() != null) {
|
||||
mob.getParentZone().zoneMobSet.remove(mob);
|
||||
}
|
||||
}
|
||||
DbManager.NPCQueries.DELETE_NPC(npc);
|
||||
DbManager.removeFromCache(mbEnums.GameObjectType.NPC,
|
||||
@@ -172,8 +175,9 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
||||
WorldGrid.RemoveWorldObject(mob);
|
||||
WorldGrid.removeObject(mob, pc);
|
||||
|
||||
if (mob.getParentZone() != null)
|
||||
if (mob.getParentZone() != null) {
|
||||
mob.getParentZone().zoneMobSet.remove(mob);
|
||||
}
|
||||
}
|
||||
DbManager.MobQueries.DELETE_MOB(mobA);
|
||||
DbManager.removeFromCache(mbEnums.GameObjectType.Mob,
|
||||
|
||||
@@ -180,8 +180,9 @@ public class RemoveObjectCmd extends AbstractDevCmd {
|
||||
WorldGrid.RemoveWorldObject(minionMob);
|
||||
WorldGrid.removeObject(minionMob, pc);
|
||||
|
||||
if (minionMob.getParentZone() != null)
|
||||
if (minionMob.getParentZone() != null) {
|
||||
minionMob.getParentZone().zoneMobSet.remove(minionMob);
|
||||
}
|
||||
}
|
||||
|
||||
DbManager.NPCQueries.DELETE_NPC(npc);
|
||||
@@ -202,9 +203,11 @@ public class RemoveObjectCmd extends AbstractDevCmd {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mob.getParentZone() != null && mob.getParentZone() != currentZone && !mob.isPet() && !mob.isNecroPet()) {
|
||||
this.throwbackError(pc, "Error 376954: Could not Remove Mob.Mob is not in the same zone as player.");
|
||||
return;
|
||||
if (mob.getParentZone() != null) {
|
||||
if (mob.parentZone != currentZone && !mob.isPet() && !mob.isNecroPet()) {
|
||||
this.throwbackError(pc, "Error 376954: Could not Remove Mob.Mob is not in the same zone as player.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove npc from hirelings list.
|
||||
@@ -222,8 +225,9 @@ public class RemoveObjectCmd extends AbstractDevCmd {
|
||||
WorldGrid.RemoveWorldObject(mob);
|
||||
WorldGrid.removeObject(mob, pc);
|
||||
|
||||
if (mob.getParentZone() != null)
|
||||
mob.getParentZone().zoneMobSet.remove(mob);
|
||||
if (mob.parentZone != null) {
|
||||
mob.parentZone.zoneMobSet.remove(mob);
|
||||
}
|
||||
|
||||
ChatManager.chatSayInfo(pc,
|
||||
"Mob with ID " + mob.getDBID() + " removed");
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Guild;
|
||||
import engine.objects.NPC;
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.mbEnums.DispatchChannel;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.mbEnums.DispatchChannel;
|
||||
import engine.net.client.msg.TargetedActionMsg;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
@@ -41,7 +41,7 @@ public class SetHealthCmd extends AbstractDevCmd {
|
||||
|
||||
// Update all surrounding clients.
|
||||
TargetedActionMsg cmm = new TargetedActionMsg(pc);
|
||||
DispatchMessage.dispatchMsgToInterestArea(pc, cmm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(pc, cmm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
this.throwbackError(pc, "Supplied data: " + words[0]
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.ProtectionState;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.City;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.mbEnums;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.TargetedActionMsg;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
@@ -32,7 +32,7 @@ public class SetManaCmd extends AbstractDevCmd {
|
||||
|
||||
//Update all surrounding clients. - NOT for Mana?
|
||||
TargetedActionMsg cmm = new TargetedActionMsg(pc);
|
||||
DispatchMessage.dispatchMsgToInterestArea(pc, cmm, mbEnums.DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(pc, cmm, mbEnums.DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
this.throwbackError(pc, "Supplied data: " + words[0]
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.NPC;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.DbObjectType;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.objects.*;
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.mbEnums.DispatchChannel;
|
||||
import engine.InterestManagement.InterestManager;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.mbEnums.DispatchChannel;
|
||||
import engine.net.client.msg.ApplyRuneMsg;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
@@ -54,7 +54,7 @@ public class SetPromotionClassCmd extends AbstractDevCmd {
|
||||
PromotionClass promo = pc.getPromotionClass();
|
||||
if (promo != null) {
|
||||
ApplyRuneMsg arm = new ApplyRuneMsg(pc.getObjectType().ordinal(), pc.getObjectUUID(), promo.getObjectUUID(), promo.getObjectType().ordinal(), promo.getObjectUUID(), true);
|
||||
DispatchMessage.dispatchMsgToInterestArea(pc, arm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(pc, arm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.InterestManagement.InterestManager;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.mbEnums;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.NPC;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
public class SetRaceCmd extends AbstractDevCmd {
|
||||
|
||||
public SetRaceCmd() {
|
||||
super("setRace");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter player, String[] words,
|
||||
AbstractGameObject target) {
|
||||
|
||||
int newRace = Integer.parseInt(words[0]);
|
||||
|
||||
if (target.getObjectType().equals(mbEnums.GameObjectType.NPC) == false) {
|
||||
throwbackError(player, "You Must Target An NPC");
|
||||
}
|
||||
|
||||
NPC npc = (NPC) target;
|
||||
npc.loadID = newRace;
|
||||
DbManager.NPCQueries.UPDATE_RACE(npc, newRace);
|
||||
InterestManager.reloadCharacter(npc);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Sets NPC race";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /setrace ID'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.mbEnums.DispatchChannel;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.mbEnums.DispatchChannel;
|
||||
import engine.net.client.msg.TargetedActionMsg;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
@@ -42,7 +42,7 @@ public class SetStaminaCmd extends AbstractDevCmd {
|
||||
|
||||
// Update all surrounding clients.
|
||||
TargetedActionMsg cmm = new TargetedActionMsg(pc);
|
||||
DispatchMessage.dispatchMsgToInterestArea(pc, cmm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(pc, cmm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
this.throwbackError(pc, "Supplied data: " + words[0]
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.net.client.msg.ApplyBuildingEffectMsg;
|
||||
import engine.net.client.msg.UpdateCharOrMobMessage;
|
||||
import engine.objects.*;
|
||||
@@ -39,13 +39,13 @@ public class SetSubRaceCmd extends AbstractDevCmd {
|
||||
if (raceID == 0)
|
||||
raceID = player.getRaceID();
|
||||
UpdateCharOrMobMessage ucm = new UpdateCharOrMobMessage(player, 1, raceID);
|
||||
DispatchMessage.sendToAllInRange(player, ucm);
|
||||
DispatchManager.sendToAllInRange(player, ucm);
|
||||
return;
|
||||
}
|
||||
if (words[0].equals("all")) {
|
||||
for (int i = 15999; i < 16337; i++) {
|
||||
ApplyBuildingEffectMsg applyBuildingEffectMsg = new ApplyBuildingEffectMsg(4, 0, target.getObjectType().ordinal(), target.getObjectUUID(), i);
|
||||
DispatchMessage.sendToAllInRange((AbstractWorldObject) target, applyBuildingEffectMsg);
|
||||
DispatchManager.sendToAllInRange((AbstractWorldObject) target, applyBuildingEffectMsg);
|
||||
try {
|
||||
Thread.sleep(500);
|
||||
} catch (InterruptedException e) {
|
||||
@@ -56,7 +56,7 @@ public class SetSubRaceCmd extends AbstractDevCmd {
|
||||
|
||||
} else {
|
||||
ApplyBuildingEffectMsg applyBuildingEffectMsg = new ApplyBuildingEffectMsg(4, 0, target.getObjectType().ordinal(), target.getObjectUUID(), Integer.parseInt(words[0]));
|
||||
DispatchMessage.sendToAllInRange((AbstractWorldObject) target, applyBuildingEffectMsg);
|
||||
DispatchManager.sendToAllInRange((AbstractWorldObject) target, applyBuildingEffectMsg);
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.objects.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.mbEnums;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Mob;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.net.client.msg.LoadStructureMsg;
|
||||
import engine.net.client.msg.MoveToPointMsg;
|
||||
import engine.net.client.msg.UnloadObjectsMsg;
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.exception;
|
||||
|
||||
public class MsgSendException extends MBServerException {
|
||||
private static final long serialVersionUID = 6927044139998382254L;
|
||||
|
||||
public MsgSendException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public MsgSendException(String arg0, Throwable arg1) {
|
||||
super(arg0, arg1);
|
||||
}
|
||||
|
||||
public MsgSendException(String arg0) {
|
||||
super(arg0);
|
||||
}
|
||||
|
||||
public MsgSendException(Throwable arg0) {
|
||||
super(arg0);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.exception;
|
||||
|
||||
public class SerializationException extends MBServerException {
|
||||
private static final long serialVersionUID = 6927044139998382254L;
|
||||
|
||||
public SerializationException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public SerializationException(String arg0, Throwable arg1) {
|
||||
super(arg0, arg1);
|
||||
}
|
||||
|
||||
public SerializationException(String arg0) {
|
||||
super(arg0);
|
||||
}
|
||||
|
||||
public SerializationException(Throwable arg0) {
|
||||
super(arg0);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import engine.InterestManagement.WorldGrid;
|
||||
import engine.job.JobContainer;
|
||||
import engine.job.JobScheduler;
|
||||
import engine.jobs.UpgradeBuildingJob;
|
||||
import engine.loot.WorkOrder;
|
||||
import engine.math.Bounds;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums;
|
||||
@@ -49,8 +50,7 @@ public enum BuildingManager {
|
||||
|
||||
// Some meshes might not have slot locations assigned.
|
||||
|
||||
if (slotLocations == null ||
|
||||
slotLocations.isEmpty())
|
||||
if (slotLocations == null || slotLocations.isEmpty())
|
||||
return -1;
|
||||
|
||||
int numOfSlots = _slotLocations.get(building.meshUUID).size();
|
||||
@@ -69,17 +69,15 @@ public enum BuildingManager {
|
||||
|
||||
// Some meshes might not have slot locations assigned.
|
||||
|
||||
if (slotLocations == null ||
|
||||
slotLocations.isEmpty())
|
||||
if (slotLocations == null || slotLocations.isEmpty())
|
||||
return -1;
|
||||
|
||||
int numOfSlots = _slotLocations.get(building.meshUUID).size();
|
||||
|
||||
for (int i = numOfSlots; i > 0; i--) {
|
||||
|
||||
for (int i = numOfSlots; i > 0; i--)
|
||||
if (!building.getHirelings().containsValue(i))
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -92,9 +90,8 @@ public enum BuildingManager {
|
||||
|
||||
buildingLocation = _slotLocations.get(building.meshUUID).get(slot - 1); // array index
|
||||
|
||||
if (buildingLocation == null) {
|
||||
if (buildingLocation == null)
|
||||
Logger.error("Invalid slot for building: " + building.getObjectUUID());
|
||||
}
|
||||
|
||||
return buildingLocation;
|
||||
}
|
||||
@@ -114,6 +111,7 @@ public enum BuildingManager {
|
||||
return true;
|
||||
|
||||
//individual friend.
|
||||
|
||||
if (building.getFriends() != null && building.getFriends().get(player.getObjectUUID()) != null)
|
||||
return true;
|
||||
|
||||
@@ -127,22 +125,16 @@ public enum BuildingManager {
|
||||
if (building.getGuild().isGuildLeader(player.getObjectUUID()))
|
||||
return true;
|
||||
|
||||
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null
|
||||
&& building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 8)
|
||||
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null && building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 8)
|
||||
return true;
|
||||
|
||||
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null
|
||||
&& building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 9
|
||||
&& GuildStatusController.isInnerCouncil(player.getGuildStatus()))
|
||||
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null && building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 9 && GuildStatusController.isInnerCouncil(player.getGuildStatus()))
|
||||
return true;
|
||||
|
||||
if (Guild.sameGuild(building.getGuild(), player.getGuild()) && GuildStatusController.isInnerCouncil(player.getGuildStatus()))
|
||||
return true;
|
||||
|
||||
if (Guild.sameGuild(building.getGuild(), player.getGuild()) && GuildStatusController.isGuildLeader(player.getGuildStatus()))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
return Guild.sameGuild(building.getGuild(), player.getGuild()) && GuildStatusController.isGuildLeader(player.getGuildStatus());
|
||||
|
||||
//TODO test friends list once added
|
||||
//does not meet above criteria. Cannot access.
|
||||
@@ -158,7 +150,6 @@ public enum BuildingManager {
|
||||
if (building == null)
|
||||
return false;
|
||||
|
||||
|
||||
if (building.getRank() == -1)
|
||||
return false;
|
||||
|
||||
@@ -168,9 +159,9 @@ public enum BuildingManager {
|
||||
//Somehow guild leader check fails? lets check if Player is true Guild GL.
|
||||
if (building.getGuild() != null && building.getGuild().isGuildLeader(player.getObjectUUID()))
|
||||
return true;
|
||||
if (GuildStatusController.isGuildLeader(player.getGuildStatus()) == false && GuildStatusController.isInnerCouncil(player.getGuildStatus()) == false)
|
||||
return false;
|
||||
|
||||
if (!GuildStatusController.isGuildLeader(player.getGuildStatus()) && !GuildStatusController.isInnerCouncil(player.getGuildStatus()))
|
||||
return false;
|
||||
|
||||
return false;
|
||||
|
||||
@@ -274,9 +265,7 @@ public enum BuildingManager {
|
||||
// Submit upgrade job for future date or current instant
|
||||
|
||||
if (building.getUpgradeDateTime().isAfter(LocalDateTime.now())) {
|
||||
JobContainer jc = JobScheduler.getInstance().scheduleJob(new UpgradeBuildingJob(building),
|
||||
building.getUpgradeDateTime().atZone(ZoneId.systemDefault())
|
||||
.toInstant().toEpochMilli());
|
||||
JobContainer jc = JobScheduler.getInstance().scheduleJob(new UpgradeBuildingJob(building), building.getUpgradeDateTime().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli());
|
||||
} else
|
||||
JobScheduler.getInstance().scheduleJob(new UpgradeBuildingJob(building), 0);
|
||||
}
|
||||
@@ -335,8 +324,35 @@ public enum BuildingManager {
|
||||
WorldGrid.RemoveWorldObject(minionMob);
|
||||
WorldGrid.unloadObject(minionMob);
|
||||
|
||||
if (minionMob.getParentZone() != null)
|
||||
minionMob.getParentZone().zoneMobSet.remove(minionMob);
|
||||
if (minionMob.parentZone != null)
|
||||
minionMob.parentZone.zoneMobSet.remove(minionMob);
|
||||
}
|
||||
|
||||
// Clear all workorders for this hireling
|
||||
if (hireling.getObjectType().equals(GameObjectType.NPC)) {
|
||||
|
||||
NPC hirelingNPC = (NPC) hireling;
|
||||
|
||||
if (ForgeManager.vendorWorkOrderLookup.get(hirelingNPC) != null)
|
||||
|
||||
for (WorkOrder workOrder : ForgeManager.vendorWorkOrderLookup.get(hirelingNPC)) {
|
||||
workOrder.runCompleted.set(true);
|
||||
workOrder.vendor = null;
|
||||
|
||||
// Remove any cooking items from collections
|
||||
// to ensure we don't leak memory.
|
||||
|
||||
for (Item item : workOrder.cooking) {
|
||||
DbManager.removeFromCache(item);
|
||||
ForgeManager.itemWorkOrderLookup.remove(item);
|
||||
}
|
||||
|
||||
DbManager.WarehouseQueries.DELETE_WORKORDER(workOrder);
|
||||
}
|
||||
|
||||
// Finally remove the NPC from ForgeManager
|
||||
|
||||
ForgeManager.vendorWorkOrderLookup.remove(hirelingNPC);
|
||||
}
|
||||
|
||||
// Remove hireling from building
|
||||
@@ -349,10 +365,9 @@ public enum BuildingManager {
|
||||
|
||||
Mob hirelingMob = (Mob) hireling;
|
||||
|
||||
if (hirelingMob.getParentZone() != null)
|
||||
if (hirelingMob.getParentZone().zoneMobSet.contains(hirelingMob))
|
||||
hirelingMob.getParentZone().zoneMobSet.remove(hireling);
|
||||
|
||||
if (hirelingMob.parentZone != null)
|
||||
if (hirelingMob.parentZone.zoneMobSet.contains(hirelingMob))
|
||||
hirelingMob.parentZone.zoneMobSet.remove(hireling);
|
||||
}
|
||||
|
||||
if (hireling.getObjectType().equals(GameObjectType.NPC)) {
|
||||
@@ -377,10 +392,8 @@ public enum BuildingManager {
|
||||
DbManager.MobQueries.DELETE_MOB((Mob) hireling);
|
||||
else
|
||||
DbManager.NPCQueries.DELETE_NPC((NPC) hireling);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void cleanupHirelings(Building building) {
|
||||
|
||||
// Early exit: Cannot have hirelings in a building
|
||||
@@ -392,22 +405,17 @@ public enum BuildingManager {
|
||||
// Remove all hirelings for destroyed buildings
|
||||
|
||||
if (building.getRank() < 1) {
|
||||
|
||||
for (AbstractCharacter slottedNPC : building.getHirelings().keySet())
|
||||
BuildingManager.removeHireling(building, slottedNPC);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Delete hireling if building has deranked.
|
||||
|
||||
for (AbstractCharacter hireling : building.getHirelings().keySet()) {
|
||||
|
||||
for (AbstractCharacter hireling : building.getHirelings().keySet())
|
||||
if (building.getHirelings().get(hireling) > building.getBlueprint().getSlotsForRank(building.getRank()))
|
||||
BuildingManager.removeHireling(building, hireling);
|
||||
|
||||
}
|
||||
|
||||
refreshHirelings(building);
|
||||
}
|
||||
|
||||
@@ -439,6 +447,7 @@ public enum BuildingManager {
|
||||
return false;
|
||||
|
||||
//lets pass true if player is owner anyway.
|
||||
|
||||
if (building.getOwner().equals(player))
|
||||
return true;
|
||||
|
||||
@@ -451,22 +460,7 @@ public enum BuildingManager {
|
||||
if (!Guild.sameGuild(building.getGuild(), player.getGuild()))
|
||||
return false;
|
||||
|
||||
return GuildStatusController.isGuildLeader(player.getGuildStatus()) != false || GuildStatusController.isInnerCouncil(player.getGuildStatus()) != false;
|
||||
}
|
||||
|
||||
//This is mainly used for Rolling and gold sharing between building and warehouse.
|
||||
|
||||
public static int GetWithdrawAmountForRolling(Building building, int cost) {
|
||||
|
||||
//all funds are available to roll.
|
||||
|
||||
if (cost <= GetAvailableGold(building))
|
||||
return cost;
|
||||
|
||||
// cost is more than available gold, return available gold
|
||||
|
||||
return GetAvailableGold(building);
|
||||
|
||||
return GuildStatusController.isGuildLeader(player.getGuildStatus()) || GuildStatusController.isInnerCouncil(player.getGuildStatus());
|
||||
}
|
||||
|
||||
public static int GetAvailableGold(Building building) {
|
||||
@@ -480,11 +474,6 @@ public enum BuildingManager {
|
||||
return building.getStrongboxValue() - building.reserve;
|
||||
}
|
||||
|
||||
public static int GetOverdraft(Building building, int cost) {
|
||||
int availableGold = GetWithdrawAmountForRolling(building, cost);
|
||||
return cost - availableGold;
|
||||
}
|
||||
|
||||
public static boolean IsPlayerHostile(Building building, PlayerCharacter player) {
|
||||
|
||||
//Nation Members and Guild members are not hostile.
|
||||
@@ -548,7 +537,7 @@ public enum BuildingManager {
|
||||
|
||||
String pirateName = NPCManager.getPirateName(NpcID.getMobbaseID());
|
||||
|
||||
NPC npc = null;
|
||||
NPC npc;
|
||||
|
||||
npc = NPC.createNPC(pirateName, NpcID.getObjectUUID(), NpcLoc, building.getGuild(), zone, (short) rank, building);
|
||||
|
||||
@@ -564,7 +553,7 @@ public enum BuildingManager {
|
||||
|
||||
public static synchronized boolean addHireling(Building building, PlayerCharacter contractOwner, Zone zone, Contract contract, Item item) {
|
||||
|
||||
int rank = 1;
|
||||
int rank;
|
||||
|
||||
if (building.getBlueprintUUID() == 0)
|
||||
return false;
|
||||
@@ -623,6 +612,7 @@ public enum BuildingManager {
|
||||
if (contract.getContractID() == 910) {
|
||||
|
||||
//guard dog
|
||||
|
||||
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank, mbEnums.AIAgentType.GUARDCAPTAIN);
|
||||
|
||||
if (mobile == null)
|
||||
@@ -682,9 +672,7 @@ public enum BuildingManager {
|
||||
if (building.getOwner() == null)
|
||||
return false;
|
||||
|
||||
|
||||
return building.getOwner().getObjectUUID() == player.getObjectUUID();
|
||||
|
||||
}
|
||||
|
||||
public static float GetMissingHealth(Building building) {
|
||||
@@ -696,6 +684,7 @@ public enum BuildingManager {
|
||||
}
|
||||
|
||||
public static Regions GetRegion(Building building, float x, float y, float z) {
|
||||
|
||||
if (building.getBounds() == null)
|
||||
return null;
|
||||
|
||||
@@ -703,17 +692,18 @@ public enum BuildingManager {
|
||||
return null;
|
||||
|
||||
Regions currentRegion = null;
|
||||
for (Regions region : building.getBounds().getRegions()) {
|
||||
|
||||
if (region.isPointInPolygon(new Vector3fImmutable(x, y, z))) {
|
||||
for (Regions region : building.getBounds().getRegions()) {
|
||||
if (region.isPointInPolygon(new Vector3fImmutable(x, y, z)))
|
||||
if (y > (region.highLerp.y - 5))
|
||||
currentRegion = region;
|
||||
}
|
||||
}
|
||||
|
||||
return currentRegion;
|
||||
}
|
||||
|
||||
public static Regions GetRegion(Building building, int room, int level, float x, float z) {
|
||||
|
||||
if (building.getBounds() == null)
|
||||
return null;
|
||||
|
||||
@@ -724,12 +714,12 @@ public enum BuildingManager {
|
||||
|
||||
if (region.getLevel() != level)
|
||||
continue;
|
||||
|
||||
if (region.getRoom() != room)
|
||||
continue;
|
||||
|
||||
if (region.isPointInPolygon(new Vector3fImmutable(x, 0, z))) {
|
||||
if (region.isPointInPolygon(new Vector3fImmutable(x, 0, z)))
|
||||
return region;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -741,11 +731,10 @@ public enum BuildingManager {
|
||||
if (building == null)
|
||||
return mbEnums.Ruins.getRandomRuin().getLocation();
|
||||
|
||||
|
||||
bindLoc = building.getLoc();
|
||||
|
||||
|
||||
float radius = Bounds.meshBoundsCache.get(building.getMeshUUID()).radius;
|
||||
|
||||
if (building.getRank() == 8) {
|
||||
bindLoc = building.getStuckLocation();
|
||||
if (bindLoc != null)
|
||||
@@ -798,7 +787,6 @@ public enum BuildingManager {
|
||||
int newMeshUUID;
|
||||
boolean success;
|
||||
|
||||
|
||||
// If this building has no blueprint then set rank and exit immediatly.
|
||||
|
||||
if (building.blueprintUUID == 0 || building.getBlueprint() != null && building.getBlueprint().getBuildingGroup().equals(BuildingGroup.MINE)) {
|
||||
@@ -810,14 +798,14 @@ public enum BuildingManager {
|
||||
// Delete any upgrade jobs before doing anything else. It won't quite work
|
||||
// if in a few lines we happen to delete this building.
|
||||
|
||||
JobContainer jc = building.getTimers().get("UPGRADE");
|
||||
JobContainer jobContainer = building.getTimers().get("UPGRADE");
|
||||
|
||||
if (jc != null) {
|
||||
if (!JobScheduler.getInstance().cancelScheduledJob(jc))
|
||||
if (jobContainer != null) {
|
||||
if (!JobScheduler.getInstance().cancelScheduledJob(jobContainer))
|
||||
Logger.error("failed to cancel existing upgrade job.");
|
||||
}
|
||||
|
||||
// Attempt write to database, or delete the building
|
||||
// Attempt to write to database or delete the building
|
||||
// if we are destroying it.
|
||||
|
||||
if (rank == -1)
|
||||
@@ -825,7 +813,7 @@ public enum BuildingManager {
|
||||
else
|
||||
success = DbManager.BuildingQueries.updateBuildingRank(building, rank);
|
||||
|
||||
if (success == false) {
|
||||
if (!success) {
|
||||
Logger.error("Error writing to database UUID: " + building.getObjectUUID());
|
||||
return;
|
||||
}
|
||||
@@ -882,7 +870,6 @@ public enum BuildingManager {
|
||||
|
||||
if (Bounds.collide(loc, building.getBounds()))
|
||||
return building;
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ import engine.mbEnums.GameObjectType;
|
||||
import engine.mbEnums.ModType;
|
||||
import engine.mbEnums.SourceType;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.MessageDispatcher;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.handlers.ClientAdminCommandMsgHandler;
|
||||
@@ -87,7 +86,7 @@ public enum ChatManager {
|
||||
for (AbstractWorldObject abstractWorldObject : distroList) {
|
||||
PlayerCharacter playerCharacter = (PlayerCharacter) abstractWorldObject;
|
||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +160,7 @@ public enum ChatManager {
|
||||
|
||||
// Make the Message
|
||||
ChatSayMsg chatSayMsg = new ChatSayMsg(player, text);
|
||||
DispatchMessage.dispatchMsgToInterestArea(pcSender, chatSayMsg, mbEnums.DispatchChannel.SECONDARY, MBServerStatics.SAY_RANGE, true, true);
|
||||
DispatchManager.dispatchMsgToInterestArea(pcSender, chatSayMsg, mbEnums.DispatchChannel.SECONDARY, MBServerStatics.SAY_RANGE, true, true);
|
||||
|
||||
}
|
||||
|
||||
@@ -171,7 +170,7 @@ public enum ChatManager {
|
||||
msg.setMessageType(4);
|
||||
msg.setChannel(mbEnums.ChatChannelType.SYSTEM.getChannelID());
|
||||
Dispatch dispatch = Dispatch.borrow(targetPlayer, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -195,7 +194,7 @@ public enum ChatManager {
|
||||
|
||||
// Make the Message
|
||||
ChatShoutMsg msg = new ChatShoutMsg(sender, text);
|
||||
DispatchMessage.dispatchMsgToInterestArea(pcSender, msg, mbEnums.DispatchChannel.SECONDARY, MBServerStatics.SHOUT_RANGE, true, true);
|
||||
DispatchManager.dispatchMsgToInterestArea(pcSender, msg, mbEnums.DispatchChannel.SECONDARY, MBServerStatics.SHOUT_RANGE, true, true);
|
||||
|
||||
}
|
||||
|
||||
@@ -217,7 +216,7 @@ public enum ChatManager {
|
||||
|
||||
// Make the Message
|
||||
ChatGlobalMsg msg = new ChatGlobalMsg(sender, text);
|
||||
DispatchMessage.dispatchMsgToAll(sender, msg, true);
|
||||
DispatchManager.dispatchMsgToAll(sender, msg, true);
|
||||
|
||||
}
|
||||
|
||||
@@ -284,13 +283,13 @@ public enum ChatManager {
|
||||
// Send dispatch to each player
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(pcRecip, chatTellMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
// Also send /tell to sender
|
||||
if (pcSender != null) {
|
||||
Dispatch dispatch = Dispatch.borrow(pcSender, chatTellMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
} else
|
||||
@@ -339,8 +338,8 @@ public enum ChatManager {
|
||||
chatGuildMsg.setSourceID(sender.getObjectUUID());
|
||||
chatGuildMsg.setSourceName(sender.getFirstName());
|
||||
chatGuildMsg.setUnknown03(WorldServer.worldMapID); // Server ID
|
||||
chatGuildMsg.setUnknown04(sender.getGuild() != null ? sender.getGuild()
|
||||
.getCharter() : 0); // Charter?
|
||||
Guild guild1 = sender.getGuild();
|
||||
chatGuildMsg.setUnknown04(sender.getGuild() != null ? guild1.charter.ordinal() : 0); // Charter?
|
||||
chatGuildMsg.setUnknown05(GuildStatusController.getTitle(sender.getGuildStatus())); // Title?
|
||||
chatGuildMsg.setUnknown06(sender.race.getRaceType().getCharacterSex().equals(mbEnums.CharacterSex.MALE) ? 1 : 2); // isMale?, seen 1 and 2
|
||||
|
||||
@@ -349,7 +348,7 @@ public enum ChatManager {
|
||||
for (AbstractWorldObject abstractWorldObject : distroList) {
|
||||
PlayerCharacter playerCharacter = (PlayerCharacter) abstractWorldObject;
|
||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, chatGuildMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -404,7 +403,7 @@ public enum ChatManager {
|
||||
for (AbstractWorldObject abstractWorldObject : distroList) {
|
||||
PlayerCharacter playerCharacter = (PlayerCharacter) abstractWorldObject;
|
||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, chatICMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -463,7 +462,7 @@ public enum ChatManager {
|
||||
for (AbstractWorldObject abstractWorldObject : distroList) {
|
||||
PlayerCharacter playerCharacter = (PlayerCharacter) abstractWorldObject;
|
||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, chatGroupMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -490,14 +489,14 @@ public enum ChatManager {
|
||||
msg.setName(sender.getFirstName());
|
||||
msg.setGuildTitle(GuildStatusController.getTitle(sender.getGuildStatus()));
|
||||
msg.setGuildUUID(guild.getObjectUUID());
|
||||
msg.setCharter(guild.getCharter());
|
||||
msg.setCharter(guild.charter.ordinal());
|
||||
|
||||
// Send dispatch to each player
|
||||
|
||||
for (AbstractWorldObject abstractWorldObject : distroList) {
|
||||
PlayerCharacter playerCharacter = (PlayerCharacter) abstractWorldObject;
|
||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -733,7 +732,7 @@ public enum ChatManager {
|
||||
public static void chatPVP(String text) {
|
||||
// Create message
|
||||
ChatPvPMsg msg = new ChatPvPMsg(null, text);
|
||||
DispatchMessage.dispatchMsgToAll(msg);
|
||||
DispatchManager.dispatchMsgToAll(msg);
|
||||
}
|
||||
|
||||
public static ChatSystemMsg CombatInfo(AbstractWorldObject source, AbstractWorldObject target) {
|
||||
@@ -844,7 +843,7 @@ public enum ChatManager {
|
||||
for (AbstractWorldObject abstractWorldObject : distroList) {
|
||||
PlayerCharacter playerCharacter = (PlayerCharacter) abstractWorldObject;
|
||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, chatSystemMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -993,7 +992,7 @@ public enum ChatManager {
|
||||
chatSystemMsg.setChannel(channel);
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, chatSystemMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ import engine.job.JobScheduler;
|
||||
import engine.jobs.AttackJob;
|
||||
import engine.jobs.DeferredPowerJob;
|
||||
import engine.mbEnums;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.TargetedActionMsg;
|
||||
import engine.net.client.msg.UpdateStateMsg;
|
||||
@@ -29,9 +28,24 @@ import java.util.EnumSet;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
import static java.lang.Math.pow;
|
||||
|
||||
public enum CombatManager {
|
||||
|
||||
|
||||
// MB Dev notes:
|
||||
// Class implements all combat mechanics for Magicbane.
|
||||
//
|
||||
// Combat initiates in "combatCycle" to determine which hands will be swung, and attack is processed based on that.
|
||||
// Handles all combat for AbstractCharacter including player characters and mobiles.
|
||||
// Controls toggling of combat and sit/stand for all AbstractCharacters
|
||||
//
|
||||
//
|
||||
|
||||
COMBAT_MANAGER;
|
||||
public static final int COMBAT_BLOCK_ANIMATION = 298;
|
||||
public static final int COMBAT_PARRY_ANIMATION = 299;
|
||||
public static final int COMBAT_DODGE_ANIMATION = 300;
|
||||
|
||||
public static void combatCycle(AbstractCharacter attacker, AbstractWorldObject target) {
|
||||
|
||||
@@ -76,25 +90,25 @@ public enum CombatManager {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mainWeapon == null && offWeapon != null && !offWeapon.template.item_skill_required.containsKey("Block")) {
|
||||
if (mainWeapon == null && offWeapon != null && !offWeapon.template.item_skill_used.equals("Block")) {
|
||||
//swing left hand only
|
||||
processAttack(attacker, target, mbEnums.EquipSlotType.LHELD);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mainWeapon == null && offWeapon != null && offWeapon.template.item_skill_required.containsKey("Block")) {
|
||||
if (mainWeapon == null && offWeapon != null && offWeapon.template.item_skill_used.equals("Block")) {
|
||||
//no weapon equipped with a shield, punch with one hand
|
||||
processAttack(attacker, target, mbEnums.EquipSlotType.RHELD);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mainWeapon != null && offWeapon != null && offWeapon.template.item_skill_required.containsKey("Block")) {
|
||||
if (mainWeapon != null && offWeapon != null && offWeapon.template.item_skill_used.equals("Block")) {
|
||||
//one weapon equipped with a shield, swing with one hand
|
||||
processAttack(attacker, target, mbEnums.EquipSlotType.RHELD);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mainWeapon != null && offWeapon != null && !offWeapon.template.item_skill_required.containsKey("Block")) {
|
||||
if (mainWeapon != null && offWeapon != null && !offWeapon.template.item_skill_used.equals("Block")) {
|
||||
//two weapons equipped, swing both hands
|
||||
processAttack(attacker, target, mbEnums.EquipSlotType.RHELD);
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter))
|
||||
@@ -104,16 +118,19 @@ public enum CombatManager {
|
||||
|
||||
public static void processAttack(AbstractCharacter attacker, AbstractWorldObject target, mbEnums.EquipSlotType slot) {
|
||||
|
||||
if(attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||
if (!attacker.isCombat())
|
||||
return;
|
||||
|
||||
if (attacker.getTimestamps().get("Attack" + slot.name()) != null && attacker.getTimestamps().get("Attack" + slot.name()) < System.currentTimeMillis()) {
|
||||
setAutoAttackJob(attacker, slot, 1000);
|
||||
return;
|
||||
}
|
||||
//check if this slot is on attack timer, if timer has passed clear it, else early exit
|
||||
if (attacker.getTimers() != null && attacker.getTimers().containsKey("Attack" + slot.name()))
|
||||
if (attacker.getTimers().get("Attack" + slot.name()).timeToExecutionLeft() <= 0)
|
||||
attacker.getTimers().remove("Attack" + slot.name());
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// check if character is in range to attack target
|
||||
|
||||
PlayerBonuses bonus = attacker.getBonuses();
|
||||
@@ -127,7 +144,7 @@ public enum CombatManager {
|
||||
if (bonus != null)
|
||||
rangeMod += bonus.getFloatPercentAll(mbEnums.ModType.WeaponRange, mbEnums.SourceType.None);
|
||||
|
||||
attackRange = weapon.template.item_weapon_max_range * rangeMod;
|
||||
attackRange += weapon.template.item_weapon_max_range * rangeMod;
|
||||
}
|
||||
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.Mob))
|
||||
@@ -137,31 +154,46 @@ public enum CombatManager {
|
||||
float distanceSquared = attacker.loc.distanceSquared(target.loc);
|
||||
|
||||
boolean inRange = false;
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||
attackRange += ((PlayerCharacter) attacker).getCharacterHeight() * 0.5f;
|
||||
if (AbstractCharacter.IsAbstractCharacter(target)) {
|
||||
attackRange += ((AbstractCharacter) target).calcHitBox();
|
||||
} else {
|
||||
attackRange += attacker.calcHitBox();
|
||||
|
||||
}
|
||||
|
||||
if (attackRange > 15 && attacker.isMoving()) {
|
||||
//cannot shoot bow while moving;
|
||||
return;
|
||||
}
|
||||
|
||||
switch (target.getObjectType()) {
|
||||
case PlayerCharacter:
|
||||
attackRange += ((PlayerCharacter) target).getCharacterHeight() * 0.5f;
|
||||
if (distanceSquared < attackRange * attackRange)
|
||||
if (distanceSquared <= attackRange * attackRange)
|
||||
inRange = true;
|
||||
break;
|
||||
case Mob:
|
||||
attackRange += ((AbstractCharacter) target).calcHitBox();
|
||||
if (distanceSquared < attackRange * attackRange)
|
||||
if (distanceSquared <= attackRange * attackRange)
|
||||
inRange = true;
|
||||
break;
|
||||
case Building:
|
||||
float locX = target.loc.x - target.getBounds().getHalfExtents().x;
|
||||
float locZ = target.loc.z - target.getBounds().getHalfExtents().y;
|
||||
float sizeX = (target.getBounds().getHalfExtents().x + attackRange) * 2;
|
||||
float sizeZ = (target.getBounds().getHalfExtents().y + attackRange) * 2;
|
||||
Rectangle2D.Float rect = new Rectangle2D.Float(locX, locZ, sizeX, sizeZ);
|
||||
if (rect.contains(new Point2D.Float(attacker.loc.x, attacker.loc.z)))
|
||||
inRange = true;
|
||||
break;
|
||||
if (attackRange > 15) {
|
||||
float rangeSquared = (attackRange + target.getBounds().getHalfExtents().x) * (attackRange + target.getBounds().getHalfExtents().x);
|
||||
//float distanceSquared = attacker.loc.distanceSquared(target.loc);
|
||||
if (distanceSquared < rangeSquared) {
|
||||
inRange = true;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
float locX = target.loc.x - target.getBounds().getHalfExtents().x;
|
||||
float locZ = target.loc.z - target.getBounds().getHalfExtents().y;
|
||||
float sizeX = (target.getBounds().getHalfExtents().x + attackRange) * 2;
|
||||
float sizeZ = (target.getBounds().getHalfExtents().y + attackRange) * 2;
|
||||
Rectangle2D.Float rect = new Rectangle2D.Float(locX, locZ, sizeX, sizeZ);
|
||||
if (rect.contains(new Point2D.Float(attacker.loc.x, attacker.loc.z)))
|
||||
inRange = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//get delay for the auto attack job
|
||||
@@ -169,7 +201,7 @@ public enum CombatManager {
|
||||
|
||||
if (weapon != null) {
|
||||
|
||||
int wepSpeed = (int) (weapon.template.item_weapon_wepspeed);
|
||||
float wepSpeed = (int) (weapon.template.item_weapon_wepspeed);
|
||||
|
||||
if (weapon.getBonusPercent(mbEnums.ModType.WeaponSpeed, mbEnums.SourceType.None) != 0f) //add weapon speed bonus
|
||||
wepSpeed *= (1 + weapon.getBonus(mbEnums.ModType.WeaponSpeed, mbEnums.SourceType.None));
|
||||
@@ -180,7 +212,7 @@ public enum CombatManager {
|
||||
if (wepSpeed < 10)
|
||||
wepSpeed = 10; //Old was 10, but it can be reached lower with legit buffs,effects.
|
||||
|
||||
delay = wepSpeed * 100L;
|
||||
delay = (long)wepSpeed * 100L;
|
||||
}
|
||||
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.Mob))
|
||||
@@ -197,23 +229,21 @@ public enum CombatManager {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//check if Out of Stamina
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||
if (attacker.getStamina() < (weapon.template.item_wt / 3f)) {
|
||||
//set auto attack job
|
||||
setAutoAttackJob(attacker, slot, delay);
|
||||
return;
|
||||
// take stamina away from attacker if its not a mob
|
||||
if (weapon != null && !attacker.getObjectType().equals(mbEnums.GameObjectType.Mob)) {
|
||||
//check if Out of Stamina
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||
if (attacker.getStamina() < (weapon.template.item_wt / 3f)) {
|
||||
//set auto attack job
|
||||
setAutoAttackJob(attacker, slot, delay);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// take stamina away from attacker
|
||||
if (weapon != null) {
|
||||
float stam = weapon.template.item_wt / 3f;
|
||||
stam = (stam < 1) ? 1 : stam;
|
||||
attacker.modifyStamina(-(stam), attacker, true);
|
||||
} else
|
||||
attacker.modifyStamina(-0.5f, attacker, true);
|
||||
attacker.modifyStamina(1, attacker, true);
|
||||
|
||||
//cancel things that are cancelled by an attack
|
||||
|
||||
@@ -233,6 +263,22 @@ public enum CombatManager {
|
||||
atr = attacker.atrHandTwo;
|
||||
}
|
||||
|
||||
//apply weapon powers before early exit for miss or passives
|
||||
DeferredPowerJob dpj = null;
|
||||
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||
|
||||
dpj = ((PlayerCharacter) attacker).getWeaponPower();
|
||||
|
||||
if (dpj != null) {
|
||||
dpj.attack(target, attackRange);
|
||||
|
||||
if (dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518))
|
||||
((PlayerCharacter) attacker).setWeaponPower(dpj);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int def = 0;
|
||||
|
||||
if (AbstractCharacter.IsAbstractCharacter(target))
|
||||
@@ -252,19 +298,18 @@ public enum CombatManager {
|
||||
|
||||
if (target.getObjectType() == mbEnums.GameObjectType.Building)
|
||||
hitChance = 100;
|
||||
|
||||
int passiveAnim = getSwingAnimation(null, null, slot.equals(mbEnums.EquipSlotType.RHELD));
|
||||
if (attacker.charItemManager.getEquipped().get(slot) != null) {
|
||||
passiveAnim = getSwingAnimation(attacker.charItemManager.getEquipped().get(slot).template, null, true);
|
||||
}
|
||||
|
||||
int passiveAnim = getPassiveAnimation(mbEnums.PassiveType.None); // checking for a miss due to ATR vs Def
|
||||
if (ThreadLocalRandom.current().nextInt(100) > hitChance) {
|
||||
TargetedActionMsg msg = new TargetedActionMsg(attacker, target, 0f, passiveAnim);
|
||||
|
||||
if (target.getObjectType() == mbEnums.GameObjectType.PlayerCharacter)
|
||||
DispatchMessage.dispatchMsgToInterestArea(target, msg, mbEnums.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(target, msg, mbEnums.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
else
|
||||
DispatchMessage.sendToAllInRange(attacker, msg);
|
||||
DispatchManager.sendToAllInRange(attacker, msg);
|
||||
|
||||
//we need to send the animation even if the attacker misses
|
||||
TargetedActionMsg cmm = new TargetedActionMsg(attacker, target, (float) 0, getSwingAnimation(weapon.template, null, slot));
|
||||
DispatchManager.sendToAllInRange(target, cmm);
|
||||
|
||||
//set auto attack job
|
||||
setAutoAttackJob(attacker, slot, delay);
|
||||
@@ -296,13 +341,15 @@ public enum CombatManager {
|
||||
|
||||
|
||||
if (!passiveType.equals(mbEnums.PassiveType.None)) {
|
||||
passiveAnim = getPassiveAnimation(passiveType);
|
||||
TargetedActionMsg msg = new TargetedActionMsg(attacker, passiveAnim, target, passiveType.value);
|
||||
|
||||
if (target.getObjectType() == mbEnums.GameObjectType.PlayerCharacter)
|
||||
DispatchMessage.dispatchMsgToInterestArea(target, msg, mbEnums.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
else
|
||||
DispatchMessage.sendToAllInRange(attacker, msg);
|
||||
DispatchManager.dispatchMsgToInterestArea(target, msg, mbEnums.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
|
||||
//we need to send the animation even if the attacker misses
|
||||
TargetedActionMsg cmm = new TargetedActionMsg(attacker, target, (float) 0, getSwingAnimation(weapon.template, null, slot));
|
||||
DispatchManager.sendToAllInRange(target, cmm);
|
||||
//set auto attack job
|
||||
setAutoAttackJob(attacker, slot, delay);
|
||||
return;
|
||||
@@ -316,6 +363,9 @@ public enum CombatManager {
|
||||
setAutoAttackJob(attacker, slot, delay);
|
||||
return;
|
||||
}
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.Mob) && ((Mob) attacker).isPet())
|
||||
calculatePetDamage(attacker);
|
||||
|
||||
//get the damage type
|
||||
|
||||
mbEnums.DamageType damageType;
|
||||
@@ -372,7 +422,7 @@ public enum CombatManager {
|
||||
//apply Damage back
|
||||
attacker.modifyHealth(-total, absTarget, true);
|
||||
TargetedActionMsg cmm = new TargetedActionMsg(attacker, attacker, total, 0);
|
||||
DispatchMessage.sendToAllInRange(target, cmm);
|
||||
DispatchManager.sendToAllInRange(target, cmm);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -382,6 +432,9 @@ public enum CombatManager {
|
||||
|
||||
if (resists.immuneTo(damageType)) {
|
||||
//set auto attack job
|
||||
//we need to send the animation even if the attacker misses
|
||||
TargetedActionMsg cmm = new TargetedActionMsg(attacker, target, (float) 0, getSwingAnimation(weapon.template, null, slot));
|
||||
DispatchManager.sendToAllInRange(target, cmm);
|
||||
setAutoAttackJob(attacker, slot, delay);
|
||||
return;
|
||||
}
|
||||
@@ -398,33 +451,19 @@ public enum CombatManager {
|
||||
if (AbstractCharacter.IsAbstractCharacter(target))
|
||||
((AbstractCharacter) target).modifyHealth(-damage, attacker, true);
|
||||
else
|
||||
((Building) target).setCurrentHitPoints(target.getCurrentHitpoints() - damage);
|
||||
((Building) target).modifyHealth(-damage, attacker);
|
||||
|
||||
int attackAnim = getSwingAnimation(null, null, slot.equals(mbEnums.EquipSlotType.RHELD));
|
||||
int attackAnim = getSwingAnimation(null, null, slot);
|
||||
if (attacker.charItemManager.getEquipped().get(slot) != null) {
|
||||
if(attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||
DeferredPowerJob weaponPower = ((PlayerCharacter) attacker).getWeaponPower();
|
||||
attackAnim = getSwingAnimation(attacker.charItemManager.getEquipped().get(slot).template, weaponPower, slot.equals(mbEnums.EquipSlotType.RHELD));
|
||||
}else {
|
||||
attackAnim = getSwingAnimation(attacker.charItemManager.getEquipped().get(slot).template, null, slot.equals(mbEnums.EquipSlotType.RHELD));
|
||||
attackAnim = getSwingAnimation(weapon.template, weaponPower, slot);
|
||||
} else {
|
||||
attackAnim = getSwingAnimation(weapon.template, null, slot);
|
||||
}
|
||||
}
|
||||
TargetedActionMsg cmm = new TargetedActionMsg(attacker, target, (float) damage, attackAnim);
|
||||
DispatchMessage.sendToAllInRange(target, cmm);
|
||||
}
|
||||
}
|
||||
|
||||
DeferredPowerJob dpj = null;
|
||||
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||
|
||||
dpj = ((PlayerCharacter) attacker).getWeaponPower();
|
||||
|
||||
if (dpj != null) {
|
||||
dpj.attack(target, attackRange);
|
||||
|
||||
if (dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518))
|
||||
((PlayerCharacter) attacker).setWeaponPower(dpj);
|
||||
DispatchManager.sendToAllInRange(target, cmm);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -447,7 +486,7 @@ public enum CombatManager {
|
||||
|
||||
UpdateStateMsg rwss = new UpdateStateMsg();
|
||||
rwss.setPlayer(playerCharacter);
|
||||
DispatchMessage.dispatchMsgToInterestArea(playerCharacter, rwss, mbEnums.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(playerCharacter, rwss, mbEnums.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
||||
}
|
||||
|
||||
public static void toggleSit(boolean toggle, ClientConnection origin) {
|
||||
@@ -460,7 +499,7 @@ public enum CombatManager {
|
||||
playerCharacter.setSit(toggle);
|
||||
UpdateStateMsg rwss = new UpdateStateMsg();
|
||||
rwss.setPlayer(playerCharacter);
|
||||
DispatchMessage.dispatchMsgToInterestArea(playerCharacter, rwss, mbEnums.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(playerCharacter, rwss, mbEnums.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -488,7 +527,11 @@ public enum CombatManager {
|
||||
target.setCombatTarget(attacker);
|
||||
}
|
||||
|
||||
public static int getSwingAnimation(ItemTemplate wb, DeferredPowerJob dpj, boolean mainHand) {
|
||||
public static int getSwingAnimation(ItemTemplate wb, DeferredPowerJob dpj, mbEnums.EquipSlotType slot) {
|
||||
|
||||
//No weapon, return default animation
|
||||
if (wb == null)
|
||||
return 75;
|
||||
|
||||
int token;
|
||||
|
||||
@@ -498,31 +541,71 @@ public enum CombatManager {
|
||||
|
||||
if (token == 563721004) //kick animation
|
||||
return 79;
|
||||
|
||||
if (wb != null) {
|
||||
if (mainHand) {
|
||||
int random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_right.size());
|
||||
int anim = wb.weapon_attack_anim_right.get(random)[0];
|
||||
return anim;
|
||||
}else {
|
||||
int random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_left.size());
|
||||
return wb.weapon_attack_anim_left.get(random)[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (wb == null)
|
||||
//Item has no equipment slots and should not try to return an animation, return default instead
|
||||
if (wb.item_eq_slots_or == null || wb.item_eq_slots_or.isEmpty()) {
|
||||
return 75;
|
||||
}
|
||||
|
||||
if (mainHand)
|
||||
return wb.weapon_attack_anim_right.get(0)[0];
|
||||
else
|
||||
return wb.weapon_attack_anim_left.get(0)[0];
|
||||
//declare variables
|
||||
int anim;
|
||||
int random;
|
||||
|
||||
//Item can only be equipped in one slot, return animation for that slot
|
||||
if (wb.item_eq_slots_or.size() == 1) {
|
||||
if (wb.item_eq_slots_or.iterator().next().equals(mbEnums.EquipSlotType.RHELD)) {
|
||||
anim = wb.weapon_attack_anim_right.get(0)[0];
|
||||
if (dpj != null) {
|
||||
random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_right.size());
|
||||
anim = wb.weapon_attack_anim_right.get(random)[0];
|
||||
}
|
||||
} else {
|
||||
anim = wb.weapon_attack_anim_left.get(0)[0];
|
||||
if (dpj != null) {
|
||||
random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_left.size());
|
||||
anim = wb.weapon_attack_anim_left.get(random)[0];
|
||||
}
|
||||
}
|
||||
return anim;
|
||||
}
|
||||
|
||||
//Item can be equipped in either hand, and should have animation sets for each hand
|
||||
if (slot.equals(mbEnums.EquipSlotType.RHELD)) {
|
||||
anim = wb.weapon_attack_anim_right.get(0)[0];
|
||||
if (dpj != null) {
|
||||
random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_right.size());
|
||||
anim = wb.weapon_attack_anim_right.get(random)[0];
|
||||
}
|
||||
} else {
|
||||
anim = wb.weapon_attack_anim_left.get(0)[0];
|
||||
if (dpj != null) {
|
||||
random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_left.size());
|
||||
anim = wb.weapon_attack_anim_left.get(random)[0];
|
||||
}
|
||||
}
|
||||
return anim;
|
||||
}
|
||||
|
||||
public static int getPassiveAnimation(mbEnums.PassiveType passiveType) {
|
||||
switch (passiveType) {
|
||||
case Block:
|
||||
return COMBAT_BLOCK_ANIMATION;
|
||||
case Parry:
|
||||
return COMBAT_PARRY_ANIMATION;
|
||||
case Dodge:
|
||||
return COMBAT_DODGE_ANIMATION;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static void setAutoAttackJob(AbstractCharacter attacker, mbEnums.EquipSlotType slot, long delay) {
|
||||
//calculate next allowed attack and update the timestamp
|
||||
|
||||
if (attacker.getTimestamps().containsKey("Attack" + slot.name()) && attacker.getTimestamps().get("Attack" + slot.name()) > System.currentTimeMillis())
|
||||
return;
|
||||
|
||||
attacker.getTimestamps().put("Attack" + slot.name(), System.currentTimeMillis() + delay);
|
||||
|
||||
//handle auto attack job creation
|
||||
@@ -532,9 +615,40 @@ public enum CombatManager {
|
||||
AttackJob aj = new AttackJob(attacker, slot.ordinal(), true);
|
||||
JobContainer job;
|
||||
job = JobScheduler.getInstance().scheduleJob(aj, (System.currentTimeMillis() + delay)); // offset 1 millisecond so no overlap issue
|
||||
timers.put("Attack" + slot, job);
|
||||
timers.put("Attack" + slot.name(), job);
|
||||
} else
|
||||
Logger.error("Unable to find Timers for Character " + attacker.getObjectUUID());
|
||||
|
||||
}
|
||||
|
||||
public static int calculatePetDamage(AbstractCharacter agent) {
|
||||
//damage calc for pet
|
||||
float range;
|
||||
float damage;
|
||||
float min = 40;
|
||||
float max = 60;
|
||||
float dmgMultiplier = 1 + agent.getBonuses().getFloatPercentAll(mbEnums.ModType.MeleeDamageModifier, mbEnums.SourceType.None);
|
||||
double minDmg = getMinDmg(min, agent);
|
||||
double maxDmg = getMaxDmg(max, agent);
|
||||
dmgMultiplier += agent.getLevel() * 0.1f;
|
||||
range = (float) (maxDmg - minDmg);
|
||||
damage = min + ((ThreadLocalRandom.current().nextFloat() * range) + (ThreadLocalRandom.current().nextFloat() * range)) / 2;
|
||||
return (int) (damage * dmgMultiplier);
|
||||
}
|
||||
|
||||
public static double getMinDmg(double min, AbstractCharacter agent) {
|
||||
int primary = agent.getStatStrCurrent();
|
||||
int secondary = agent.getStatDexCurrent();
|
||||
int focusLevel = 0;
|
||||
int masteryLevel = 0;
|
||||
return min * (pow(0.0048 * primary + .049 * (primary - 0.75), 0.5) + pow(0.0066 * secondary + 0.064 * (secondary - 0.75), 0.5) + +0.01 * (focusLevel + masteryLevel));
|
||||
}
|
||||
|
||||
public static double getMaxDmg(double max, AbstractCharacter agent) {
|
||||
int primary = agent.getStatStrCurrent();
|
||||
int secondary = agent.getStatDexCurrent();
|
||||
int focusLevel = 0;
|
||||
int masteryLevel = 0;
|
||||
return max * (pow(0.0124 * primary + 0.118 * (primary - 0.75), 0.5) + pow(0.0022 * secondary + 0.028 * (secondary - 0.75), 0.5) + 0.0075 * (focusLevel + masteryLevel));
|
||||
}
|
||||
}
|
||||
@@ -10,9 +10,9 @@ package engine.gameManager;
|
||||
|
||||
import com.zaxxer.hikari.HikariConfig;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import engine.db.handlers.*;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.db.handlers.*;
|
||||
import engine.objects.*;
|
||||
import engine.server.MBServerStatics;
|
||||
import engine.util.Hasher;
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
|
||||
package engine.gameManager;
|
||||
|
||||
import engine.mbEnums;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.devcmd.cmds.*;
|
||||
import engine.mbEnums;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Account;
|
||||
import engine.objects.PlayerCharacter;
|
||||
@@ -22,6 +22,13 @@ import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public enum DevCmdManager {
|
||||
|
||||
// MB Dev Notes:
|
||||
// Class registers "Dev Commands" where access requires
|
||||
// Status = "ADMIN" be set in the obj_account table
|
||||
//
|
||||
// Use these at your own risk.
|
||||
|
||||
DEV_CMD_MANAGER;
|
||||
|
||||
public static ConcurrentHashMap<String, AbstractDevCmd> devCmds;
|
||||
@@ -35,9 +42,6 @@ public enum DevCmdManager {
|
||||
DevCmdManager.registerCommands();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static void registerCommands() {
|
||||
|
||||
// Player
|
||||
@@ -72,6 +76,7 @@ public enum DevCmdManager {
|
||||
DevCmdManager.registerDevCmd(new SetLevelCmd());
|
||||
DevCmdManager.registerDevCmd(new SetBaseClassCmd());
|
||||
DevCmdManager.registerDevCmd(new SetPromotionClassCmd());
|
||||
DevCmdManager.registerDevCmd(new SetRaceCmd());
|
||||
DevCmdManager.registerDevCmd(new SetRuneCmd());
|
||||
DevCmdManager.registerDevCmd(new GetOffsetCmd());
|
||||
DevCmdManager.registerDevCmd(new AddGoldCmd());
|
||||
@@ -91,7 +96,6 @@ public enum DevCmdManager {
|
||||
DevCmdManager.registerDevCmd(new RenameCmd());
|
||||
DevCmdManager.registerDevCmd(new CreateItemCmd());
|
||||
DevCmdManager.registerDevCmd(new SetRankCmd());
|
||||
DevCmdManager.registerDevCmd(new MakeBaneCmd());
|
||||
DevCmdManager.registerDevCmd(new RemoveBaneCmd());
|
||||
DevCmdManager.registerDevCmd(new SetBaneActiveCmd());
|
||||
DevCmdManager.registerDevCmd(new SetAdminRuneCmd());
|
||||
|
||||
@@ -7,13 +7,15 @@
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net;
|
||||
package engine.gameManager;
|
||||
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums.DispatchChannel;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.AbstractNetMsg;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.MessageDispatcher;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.objects.Item;
|
||||
@@ -26,12 +28,17 @@ import java.util.HashSet;
|
||||
import static engine.net.MessageDispatcher.dispatchCount;
|
||||
import static engine.net.MessageDispatcher.maxRecipients;
|
||||
|
||||
/*
|
||||
* Dispatch Message is the main interface to Magicbane's threaded
|
||||
* async message delivery system.
|
||||
*/
|
||||
// MB Dev Notes:
|
||||
// Dispatch Manager is the main interface to the threaded async message
|
||||
// delivery system used by Magicbane.
|
||||
//
|
||||
// A Dispatch is .borrowed() and used to wrap an outgoing protocol message.
|
||||
// A distribution list is created and passed to the MessageDispatcher for
|
||||
// delivery.
|
||||
|
||||
public class DispatchMessage {
|
||||
public enum DispatchManager {
|
||||
|
||||
DISPATCH_MANAGER;
|
||||
|
||||
public static void startMessagePump() {
|
||||
|
||||
@@ -83,7 +90,7 @@ public class DispatchMessage {
|
||||
sourcePlayer = (PlayerCharacter) sourceObject;
|
||||
if (sourcePlayer.getClientConnection() != null && sendToSelf) {
|
||||
Dispatch dispatch = Dispatch.borrow(sourcePlayer, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +158,7 @@ public class DispatchMessage {
|
||||
|
||||
if (sourcePlayer.getClientConnection() != null && sendToSelf) {
|
||||
Dispatch dispatch = Dispatch.borrow(sourcePlayer, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
}
|
||||
|
||||
|
||||
@@ -280,7 +287,7 @@ public class DispatchMessage {
|
||||
|
||||
}
|
||||
|
||||
protected static void serializeDispatch(Dispatch messageDispatch) {
|
||||
public static void serializeDispatch(Dispatch messageDispatch) {
|
||||
ClientConnection connection;
|
||||
|
||||
if (messageDispatch.player == null) {
|
||||
@@ -12,7 +12,6 @@ import engine.loot.ModTableEntry;
|
||||
import engine.loot.ModTypeTableEntry;
|
||||
import engine.loot.WorkOrder;
|
||||
import engine.mbEnums;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.ItemProductionMsg;
|
||||
import engine.objects.City;
|
||||
import engine.objects.Item;
|
||||
@@ -23,19 +22,25 @@ import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.DelayQueue;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public enum ForgeManager implements Runnable {
|
||||
|
||||
// MB Dev notes:
|
||||
// Class handles all forge rolling mechanics for the game.
|
||||
// Class implements forge rolling mechanics for Magicbane.
|
||||
//
|
||||
// WorkOrders may be submitted from any thread: usually (ItemProductionMsgHandler).
|
||||
// Concurrency is managed by the same lock used by the warehouse (city.cityTransactionLock).
|
||||
// WorkOrders are persisted then reconstituted at bootstrap from table dyn.workorders.
|
||||
// .submit(workOrder) may be called from any thread: (ItemProductionMsgHandler).
|
||||
// Concurrency is managed by same lock used for warehouse (city.cityTransactionLock).
|
||||
// WorkOrders are persisted then reconstituted at bootstrap using table dyn.workorders.
|
||||
// Forge window (ManageNPCMsg) uses item.upgradeDate to serialize completion time.
|
||||
//
|
||||
// p.s. replaces garbage code that looked like it was written by a crack head with face boils.
|
||||
// Replaces garbage code that looked as if written by a mental patient.
|
||||
//
|
||||
// @TODO Reuse same set of virtual items for the life of a workOrder.
|
||||
|
||||
FORGE_MANAGER;
|
||||
|
||||
@@ -52,33 +57,41 @@ public enum ForgeManager implements Runnable {
|
||||
|
||||
while (true) {
|
||||
|
||||
// .forge is a delayQueue (blocking priority queue using an epoc sort)
|
||||
// workOrders are popped and processed when their completion time has passed.
|
||||
// The forge is a blocking priority queue using an epoc sort.
|
||||
// workOrders are popped once the workOrder.completionTime has
|
||||
// passed.
|
||||
|
||||
try {
|
||||
workOrder = forge.take();
|
||||
|
||||
// Early exit for completed workOrders loaded from disk
|
||||
// or vendors who were re-deeded with items still cooking.
|
||||
|
||||
if (workOrder.vendor == null || workOrder.runCompleted.get())
|
||||
continue;
|
||||
|
||||
// This workOrder has completed production.
|
||||
|
||||
if (workOrder.total_produced >= workOrder.total_to_produce) {
|
||||
|
||||
// Complete this workOrder.
|
||||
// CONFIRM_PRODUCE to refresh the interface after we add
|
||||
// the Identified flag to the item.
|
||||
|
||||
for (Item workOrderItem : workOrder.cooking) {
|
||||
workOrderItem.flags.add(mbEnums.ItemFlags.Identified);
|
||||
ItemProductionMsg outMsg = new ItemProductionMsg(workOrder.vendor.building, workOrder.vendor, workOrderItem, mbEnums.ProductionActionType.CONFIRM_PRODUCE, true);
|
||||
DispatchMessage.dispatchMsgToInterestArea(workOrder.vendor, outMsg, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(workOrder.vendor, outMsg, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
|
||||
}
|
||||
|
||||
workOrder.runCompleted = true;
|
||||
// Set this workOrder to completed and update on disk
|
||||
|
||||
// Update workOrder on disk
|
||||
|
||||
DbManager.WarehouseQueries.UPDATE_WORKORDER(workOrder);
|
||||
workOrder.runCompleted.set(true);
|
||||
DbManager.WarehouseQueries.WRITE_WORKORDER(workOrder);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (workOrder.runCompleted)
|
||||
continue;
|
||||
|
||||
// Move current cooking batch to vendor inventory
|
||||
// PERSIST our current cooking batch of virtual
|
||||
// items then add to the vendor inventory
|
||||
|
||||
completeWorkOrderBatch(workOrder);
|
||||
|
||||
@@ -131,30 +144,32 @@ public enum ForgeManager implements Runnable {
|
||||
if (validation_result != 0)
|
||||
return validation_result;
|
||||
|
||||
try {
|
||||
// Configure this production run.
|
||||
// Configure this production run.
|
||||
|
||||
try {
|
||||
workOrder.workOrderID = workOrderCounter.incrementAndGet();
|
||||
workOrder.rollingDuration = ForgeManager.calcRollingDuration(workOrder);
|
||||
workOrder.rollingDuration = NPCManager.calcRollingDuration(workOrder.vendor, workOrder.templateID);
|
||||
workOrder.completionTime = System.currentTimeMillis() + workOrder.rollingDuration;
|
||||
workOrder.slots_used = calcAvailableSlots(workOrder);
|
||||
workOrder.slots_used.set(calcAvailableSlots(workOrder));
|
||||
|
||||
if (workOrder.slots_used.get() == 0)
|
||||
return 58;
|
||||
|
||||
workOrder.total_produced = 0;
|
||||
|
||||
// Single item configuration
|
||||
// Single item configuration from protocol message (ItemProductionMsg)
|
||||
|
||||
if (!workOrder.multiple_slot_request && workOrder.total_to_produce == 0)
|
||||
if (workOrder.multiple_slot_request == false && workOrder.total_to_produce == 0)
|
||||
workOrder.total_to_produce = 1;
|
||||
|
||||
// Set total cost for production run
|
||||
// Calculate total cost for this production run
|
||||
|
||||
workOrder.total_to_produce *= workOrder.slots_used;
|
||||
workOrder.total_to_produce *= workOrder.slots_used.get();
|
||||
|
||||
workOrder.production_cost = calcProductionCost(workOrder);
|
||||
workOrder.production_cost_total.putAll(workOrder.production_cost);
|
||||
workOrder.production_cost_total.forEach((key, value) -> workOrder.production_cost_total.put(key, value * workOrder.total_to_produce));
|
||||
workOrder.production_cost.forEach((key, value) -> workOrder.production_cost_total.put(key, value * workOrder.total_to_produce));
|
||||
|
||||
// Withdraw gold and resource costs. Availability has previously been validated.
|
||||
// Withdraw gold and resources. Availability has previously been validated.
|
||||
|
||||
if (!WorkOrder.withdrawWorkOrderCost(workOrder))
|
||||
return 58; //58: The formula is beyond the means of this facility
|
||||
@@ -163,15 +178,17 @@ public enum ForgeManager implements Runnable {
|
||||
|
||||
forgeWorkOrderBatch(workOrder);
|
||||
|
||||
// Enqueue workOrder in the .forge and then
|
||||
// add the workOrder to it's vendor
|
||||
// Assign the new workOrder to the vendor
|
||||
|
||||
vendorWorkOrderLookup.get(workOrder.vendor).add(workOrder);
|
||||
|
||||
// Enqueue the new workOrder
|
||||
|
||||
forge.add(workOrder);
|
||||
|
||||
// PERSIST workOrder (dyn_workorders)
|
||||
|
||||
DbManager.WarehouseQueries.UPDATE_WORKORDER(workOrder);
|
||||
DbManager.WarehouseQueries.WRITE_WORKORDER(workOrder);
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.error(e);
|
||||
@@ -182,24 +199,6 @@ public enum ForgeManager implements Runnable {
|
||||
return validation_result;
|
||||
}
|
||||
|
||||
public static long calcRollingDuration(WorkOrder workOrder) {
|
||||
|
||||
float rollingDuration;
|
||||
|
||||
rollingDuration = workOrder.vendor.getBuilding().getRank() * -5L + 40;
|
||||
rollingDuration = TimeUnit.MINUTES.toMillis((long) rollingDuration);
|
||||
rollingDuration *= Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue());
|
||||
|
||||
ItemTemplate template = ItemTemplate.templates.get(workOrder.templateID);
|
||||
|
||||
// Bane circles
|
||||
|
||||
if (template.item_bane_rank > 0)
|
||||
rollingDuration = (long) template.item_bane_rank * 60 * 60 * 3 * 1000 * Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue());
|
||||
|
||||
return (long) rollingDuration;
|
||||
}
|
||||
|
||||
public static int calcAvailableSlots(WorkOrder workOrder) {
|
||||
|
||||
// Slots available in a forge are based on the npc rank
|
||||
@@ -213,7 +212,7 @@ public enum ForgeManager implements Runnable {
|
||||
|
||||
// Single item rolls are always a single slot
|
||||
|
||||
if (availableSlots > 0 && !workOrder.multiple_slot_request)
|
||||
if (availableSlots > 0 && workOrder.multiple_slot_request == false)
|
||||
availableSlots = 1;
|
||||
|
||||
return availableSlots;
|
||||
@@ -312,7 +311,8 @@ public enum ForgeManager implements Runnable {
|
||||
completedItem.prefixToken = virutalItem.prefixToken;
|
||||
completedItem.suffixToken = virutalItem.suffixToken;
|
||||
|
||||
// Add effects to these tokens. Writes to disk.
|
||||
// Add effects for the tokens. Writes to disk using
|
||||
// table dyn_item_enchantment
|
||||
|
||||
ItemManager.applyItemEffects(completedItem);
|
||||
|
||||
@@ -321,9 +321,9 @@ public enum ForgeManager implements Runnable {
|
||||
workOrder.vendor.charItemManager.addItemToInventory(completedItem);
|
||||
|
||||
ItemProductionMsg outMsg1 = new ItemProductionMsg(workOrder.vendor.building, workOrder.vendor, completedItem, mbEnums.ProductionActionType.DEPOSIT, true);
|
||||
DispatchMessage.dispatchMsgToInterestArea(workOrder.vendor, outMsg1, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(workOrder.vendor, outMsg1, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
|
||||
ItemProductionMsg outMsg2 = new ItemProductionMsg(workOrder.vendor.building, workOrder.vendor, completedItem, mbEnums.ProductionActionType.CONFIRM_DEPOSIT, true);
|
||||
DispatchMessage.dispatchMsgToInterestArea(workOrder.vendor, outMsg2, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(workOrder.vendor, outMsg2, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
|
||||
|
||||
toRemove.add(virutalItem);
|
||||
}
|
||||
@@ -333,7 +333,7 @@ public enum ForgeManager implements Runnable {
|
||||
// Remove virtual items from the forge window
|
||||
|
||||
ItemProductionMsg outMsg = new ItemProductionMsg(workOrder.vendor.building, workOrder.vendor, virtualItem, mbEnums.ProductionActionType.CONFIRM_SETPRICE, true);
|
||||
DispatchMessage.dispatchMsgToInterestArea(workOrder.vendor, outMsg, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(workOrder.vendor, outMsg, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
|
||||
|
||||
// Remove virtual item from all collections
|
||||
|
||||
@@ -349,21 +349,20 @@ public enum ForgeManager implements Runnable {
|
||||
|
||||
workOrder.completionTime = System.currentTimeMillis() + workOrder.rollingDuration;
|
||||
|
||||
for (int i = 0; i < workOrder.slots_used; ++i) {
|
||||
for (int i = 0; i < workOrder.slots_used.get(); ++i) {
|
||||
|
||||
Item forged_item = forgeItem(workOrder);
|
||||
|
||||
// Update NPC window
|
||||
|
||||
ItemProductionMsg outMsg = new ItemProductionMsg(workOrder.vendor.building, workOrder.vendor, forged_item, mbEnums.ProductionActionType.CONFIRM_PRODUCE, true);
|
||||
DispatchMessage.dispatchMsgToInterestArea(workOrder.vendor, outMsg, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(workOrder.vendor, outMsg, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
|
||||
workOrder.total_produced = workOrder.total_produced + 1;
|
||||
}
|
||||
|
||||
// Write updated workOrder to disk
|
||||
|
||||
DbManager.WarehouseQueries.UPDATE_WORKORDER(workOrder);
|
||||
|
||||
DbManager.WarehouseQueries.WRITE_WORKORDER(workOrder);
|
||||
}
|
||||
|
||||
public static int calcRandomMod(NPC vendor, mbEnums.ItemModType itemModType, int modTable) {
|
||||
@@ -394,6 +393,12 @@ public enum ForgeManager implements Runnable {
|
||||
if (rollForModifier < 80) {
|
||||
int randomModifier = LootManager.TableRoll(vendor.getLevel(), false);
|
||||
modTableEntry = ModTableEntry.rollTable(modTypeTableEntry.modTableID, randomModifier);
|
||||
|
||||
// @TODO : Figure out how a null can be returned from a defined set.
|
||||
|
||||
if (modTableEntry == null)
|
||||
return 0;
|
||||
|
||||
EffectsBase effectsBase = PowersManager.getEffectByIDString(modTableEntry.action);
|
||||
modifier = effectsBase.getToken();
|
||||
}
|
||||
|
||||
@@ -9,9 +9,7 @@
|
||||
package engine.gameManager;
|
||||
|
||||
import engine.mbEnums;
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.UpdateGoldMsg;
|
||||
import engine.net.client.msg.group.GroupUpdateMsg;
|
||||
@@ -46,12 +44,12 @@ public enum GroupManager {
|
||||
|
||||
}
|
||||
|
||||
public static void LeaveGroup(ClientConnection origin) throws MsgSendException {
|
||||
public static void LeaveGroup(ClientConnection origin) {
|
||||
PlayerCharacter source = SessionManager.getPlayerCharacter(origin);
|
||||
LeaveGroup(source);
|
||||
}
|
||||
|
||||
public static void LeaveGroup(PlayerCharacter source) throws MsgSendException {
|
||||
public static void LeaveGroup(PlayerCharacter source) {
|
||||
|
||||
if (source == null)
|
||||
return;
|
||||
@@ -80,7 +78,7 @@ public enum GroupManager {
|
||||
groupUpdateMsg.setMessageType(3);
|
||||
groupUpdateMsg.setPlayer(groupMember);
|
||||
Dispatch dispatch = Dispatch.borrow(source, groupUpdateMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
}
|
||||
|
||||
@@ -160,7 +158,7 @@ public enum GroupManager {
|
||||
gum.setPlayerUUID(groupMember.getObjectUUID());
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(groupMember, gum);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -189,7 +187,7 @@ public enum GroupManager {
|
||||
gum.setMessageType(1);
|
||||
gum.setPlayer(groupMember);
|
||||
Dispatch dispatch = Dispatch.borrow(groupMember, gum);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -217,7 +215,7 @@ public enum GroupManager {
|
||||
gum.setPlayer(playerToRefresh);
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(source, gum);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
public static void RefreshOthersGroupList(PlayerCharacter source) {
|
||||
@@ -372,12 +370,12 @@ public enum GroupManager {
|
||||
ugm.configure();
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(splitPlayer, ugm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
UpdateGoldMsg updateTargetGold = new UpdateGoldMsg(tar);
|
||||
updateTargetGold.configure();
|
||||
DispatchMessage.dispatchMsgToInterestArea(tar, updateTargetGold, mbEnums.DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(tar, updateTargetGold, mbEnums.DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
|
||||
// //TODO send group split message
|
||||
String text = "Group Split: " + amount;
|
||||
|
||||
@@ -12,7 +12,6 @@ import engine.mbEnums;
|
||||
import engine.mbEnums.BuildingGroup;
|
||||
import engine.mbEnums.GuildHistoryType;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.guild.AcceptInviteToGuildMsg;
|
||||
import engine.net.client.msg.guild.GuildInfoMsg;
|
||||
@@ -89,16 +88,17 @@ public enum GuildManager {
|
||||
|
||||
if (fromTeleportScreen) {
|
||||
dispatch = Dispatch.borrow(playerCharacter, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
}
|
||||
if (DbManager.GuildQueries.ADD_TO_GUILDHISTORY(guild.getObjectUUID(), playerCharacter, DateTime.now(), historyType)) {
|
||||
GuildHistory guildHistory = new GuildHistory(guild.getObjectUUID(), guild.getName(), DateTime.now(), historyType);
|
||||
playerCharacter.getGuildHistory().add(guildHistory);
|
||||
}
|
||||
|
||||
DispatchMessage.sendToAllInRange(playerCharacter, new GuildInfoMsg(playerCharacter, guild, 2));
|
||||
DispatchManager.sendToAllInRange(playerCharacter, new GuildInfoMsg(playerCharacter, guild, 2));
|
||||
|
||||
// Send guild join message
|
||||
|
||||
ChatManager.chatGuildInfo(playerCharacter,
|
||||
playerCharacter.getFirstName() + " has joined the guild");
|
||||
|
||||
@@ -108,44 +108,44 @@ public enum GuildManager {
|
||||
// TODO update player to world
|
||||
}
|
||||
|
||||
public static void enterWorldMOTD(PlayerCharacter pc) {
|
||||
public static void enterWorldMOTD(PlayerCharacter playerCharacter) {
|
||||
|
||||
Guild guild;
|
||||
Guild nation;
|
||||
|
||||
if (pc == null) {
|
||||
if (playerCharacter == null)
|
||||
return;
|
||||
}
|
||||
|
||||
guild = pc.getGuild();
|
||||
guild = playerCharacter.getGuild();
|
||||
|
||||
if (guild == null || guild.getObjectUUID() == 0) // Don't send to errant
|
||||
return;
|
||||
|
||||
// Send Guild MOTD
|
||||
|
||||
String motd = guild.getMOTD();
|
||||
if (motd.length() > 0) {
|
||||
ChatManager.chatGuildMOTD(pc, motd);
|
||||
}
|
||||
|
||||
if (!motd.isEmpty())
|
||||
ChatManager.chatGuildMOTD(playerCharacter, motd);
|
||||
|
||||
// Send Nation MOTD
|
||||
|
||||
nation = guild.getNation();
|
||||
|
||||
if (nation != null) {
|
||||
if (nation != null)
|
||||
if (nation.getObjectUUID() != 0) { // Don't send to errant nation
|
||||
motd = nation.getMOTD();
|
||||
if (motd.length() > 0) {
|
||||
ChatManager.chatNationMOTD(pc, motd);
|
||||
}
|
||||
|
||||
if (!motd.isEmpty())
|
||||
ChatManager.chatNationMOTD(playerCharacter, motd);
|
||||
}
|
||||
}
|
||||
|
||||
// Send IC MOTD if player is IC
|
||||
if (GuildStatusController.isInnerCouncil(pc.getGuildStatus())) {
|
||||
if (GuildStatusController.isInnerCouncil(playerCharacter.getGuildStatus())) {
|
||||
motd = guild.getICMOTD();
|
||||
if (motd.length() > 0) {
|
||||
ChatManager.chatICMOTD(pc, motd);
|
||||
}
|
||||
|
||||
if (!motd.isEmpty())
|
||||
ChatManager.chatICMOTD(playerCharacter, motd);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,12 +156,8 @@ public enum GuildManager {
|
||||
if (guild == null)
|
||||
return;
|
||||
|
||||
int cityID = (city != null) ? city.getObjectUUID() : 0;
|
||||
|
||||
|
||||
//update binds ingame
|
||||
|
||||
|
||||
for (PlayerCharacter playerCharacter : Guild.GuildRoster(guild)) {
|
||||
boolean updateBindBuilding = false;
|
||||
|
||||
@@ -170,7 +166,6 @@ public enum GuildManager {
|
||||
if (oldBoundBuilding == null || oldBoundBuilding.getBlueprint() == null || oldBoundBuilding.getBlueprint().getBuildingGroup().equals(BuildingGroup.TOL))
|
||||
updateBindBuilding = true;
|
||||
|
||||
|
||||
if (updateBindBuilding) {
|
||||
Building bindBuilding = null;
|
||||
if (city != null)
|
||||
@@ -183,7 +178,6 @@ public enum GuildManager {
|
||||
playerCharacter.setBindBuildingID(bindBuilding != null ? bindBuilding.getObjectUUID() : 0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,12 +187,9 @@ public enum GuildManager {
|
||||
if (guild == null)
|
||||
return;
|
||||
|
||||
for (PlayerCharacter player : SessionManager.getAllActivePlayerCharacters()) {
|
||||
|
||||
for (PlayerCharacter player : SessionManager.getAllActivePlayerCharacters())
|
||||
if (player.getGuild().equals(guild))
|
||||
DispatchMessage.sendToAllInRange(player, new GuildInfoMsg(player, guild, 2));
|
||||
|
||||
}
|
||||
DispatchManager.sendToAllInRange(player, new GuildInfoMsg(player, guild, 2));
|
||||
}
|
||||
|
||||
public static Boolean meetsLoreRequirements(Guild guild, PlayerCharacter player) {
|
||||
|
||||
@@ -192,7 +192,7 @@ public enum ItemManager {
|
||||
if (!ValidRace(item, abstractCharacter.absRace))
|
||||
return false;
|
||||
|
||||
if (!ValidClass(item, abstractCharacter.absBaseClass,abstractCharacter.absPromotionClass))
|
||||
if (!ValidClass(item, abstractCharacter.absBaseClass, abstractCharacter.absPromotionClass))
|
||||
return false;
|
||||
|
||||
//players can't wear 0 value items.
|
||||
|
||||
@@ -10,7 +10,6 @@ package engine.gameManager;
|
||||
|
||||
import engine.loot.*;
|
||||
import engine.mbEnums;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.ErrorPopupMsg;
|
||||
import engine.net.client.msg.chat.ChatSystemMsg;
|
||||
import engine.objects.*;
|
||||
@@ -25,6 +24,16 @@ import java.util.concurrent.ThreadLocalRandom;
|
||||
*/
|
||||
public enum LootManager {
|
||||
|
||||
|
||||
// MB Dev notes:
|
||||
// Class implements all loot generation mechanics for Magicbane.
|
||||
// Class handles variables like drop rates
|
||||
// Generation initiates in GenerateMobLoot and is passed a mobile
|
||||
// Utilized database tables:
|
||||
// - static_loot_bootySet - static_loot_gen - static_loot_item - static_loot_mod - static_loot_modtype
|
||||
// Class also handles mechanic for Fate Peddler
|
||||
//
|
||||
|
||||
LOOTMANAGER;
|
||||
|
||||
// Newer tables
|
||||
@@ -86,7 +95,7 @@ public enum LootManager {
|
||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().zoneName + " has found the " + item.template.item_base_name + ". Are you tough enough to take it?");
|
||||
chatMsg.setMessageType(10);
|
||||
chatMsg.setChannel(mbEnums.ChatChannelType.SYSTEM.getChannelID());
|
||||
DispatchMessage.dispatchMsgToAll(chatMsg);
|
||||
DispatchManager.dispatchMsgToAll(chatMsg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
package engine.gameManager;
|
||||
|
||||
import engine.InterestManagement.InterestManager;
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.math.Bounds;
|
||||
import engine.math.Vector3f;
|
||||
import engine.math.Vector3fImmutable;
|
||||
@@ -18,7 +17,6 @@ import engine.mbEnums.DispatchChannel;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.mbEnums.ModType;
|
||||
import engine.mbEnums.SourceType;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.MoveToPointMsg;
|
||||
import engine.net.client.msg.TeleportToPointMsg;
|
||||
@@ -50,9 +48,9 @@ public enum MovementManager {
|
||||
UpdateStateMsg rssm = new UpdateStateMsg();
|
||||
rssm.setPlayer(ac);
|
||||
if (ac.getObjectType() == GameObjectType.PlayerCharacter)
|
||||
DispatchMessage.dispatchMsgToInterestArea(ac, rssm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(ac, rssm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
else
|
||||
DispatchMessage.sendToAllInRange(ac, rssm);
|
||||
DispatchManager.sendToAllInRange(ac, rssm);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -61,7 +59,7 @@ public enum MovementManager {
|
||||
* target upon each move, unless something has set the firstHitCombatTarget
|
||||
* Also used to determine the size of a monster's hitbox
|
||||
*/
|
||||
public static void movement(MoveToPointMsg msg, AbstractCharacter toMove) throws MsgSendException {
|
||||
public static void movement(MoveToPointMsg msg, AbstractCharacter toMove) {
|
||||
|
||||
// check for stun/root
|
||||
if (!toMove.isAlive())
|
||||
@@ -241,7 +239,7 @@ public enum MovementManager {
|
||||
// If it's not a player moving just send the message
|
||||
|
||||
if ((toMove.getObjectType() == GameObjectType.PlayerCharacter) == false) {
|
||||
DispatchMessage.sendToAllInRange(toMove, msg);
|
||||
DispatchManager.sendToAllInRange(toMove, msg);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -253,9 +251,9 @@ public enum MovementManager {
|
||||
player.setTimeStamp("lastMoveGate", System.currentTimeMillis());
|
||||
|
||||
if (collide)
|
||||
DispatchMessage.dispatchMsgToInterestArea(player, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(player, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
else
|
||||
DispatchMessage.dispatchMsgToInterestArea(player, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(player, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
||||
|
||||
|
||||
// Handle formation movement if needed
|
||||
@@ -349,7 +347,7 @@ public enum MovementManager {
|
||||
|
||||
// Handle formation movement in group
|
||||
|
||||
public static void moveGroup(PlayerCharacter pc, ClientConnection origin, MoveToPointMsg msg) throws MsgSendException {
|
||||
public static void moveGroup(PlayerCharacter pc, ClientConnection origin, MoveToPointMsg msg) {
|
||||
// get forward vector
|
||||
Vector3f faceDir = new Vector3f(pc.getFaceDir().x, 0, pc.getFaceDir().z).normalize();
|
||||
// get perpendicular vector
|
||||
@@ -443,7 +441,7 @@ public enum MovementManager {
|
||||
groupMsg.setStartCoord(member.getLoc());
|
||||
groupMsg.setEndCoord(destination);
|
||||
groupMsg.clearTarget();
|
||||
DispatchMessage.sendToAllInRange(member, groupMsg);
|
||||
DispatchManager.sendToAllInRange(member, groupMsg);
|
||||
|
||||
// update group member
|
||||
member.setFaceDir(destination.subtract2D(member.getLoc()).normalize());
|
||||
@@ -463,7 +461,7 @@ public enum MovementManager {
|
||||
InterestManager.INTERESTMANAGER.HandleLoadForTeleport((PlayerCharacter) teleporter);
|
||||
|
||||
TeleportToPointMsg msg = new TeleportToPointMsg(teleporter, teleporter.loc.getX(), teleporter.loc.getY(), teleporter.loc.getZ(), 0, -1, -1);
|
||||
DispatchMessage.dispatchMsgToInterestArea(oldLoc, teleporter, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(oldLoc, teleporter, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ import engine.math.Vector3f;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ErrorPopupMsg;
|
||||
import engine.net.client.msg.PetMsg;
|
||||
@@ -29,6 +28,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static engine.math.FastMath.acos;
|
||||
|
||||
@@ -68,7 +68,7 @@ public enum NPCManager {
|
||||
|
||||
PetMsg petMsg = new PetMsg(5, null);
|
||||
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -525,9 +525,33 @@ public enum NPCManager {
|
||||
|
||||
ConcurrentHashMap.KeySetView<WorkOrder, Boolean> vendorWorkOrders = ForgeManager.vendorWorkOrderLookup.get(npc);
|
||||
|
||||
if (vendorWorkOrders == null)
|
||||
return itemList;
|
||||
|
||||
for (WorkOrder workOrder : vendorWorkOrders)
|
||||
itemList.addAll(workOrder.cooking);
|
||||
|
||||
return itemList;
|
||||
}
|
||||
|
||||
public static long calcRollingDuration(NPC vendor, int templateID) {
|
||||
|
||||
ItemTemplate template = ItemTemplate.templates.get(templateID);
|
||||
float rollingDuration;
|
||||
|
||||
if (template == null)
|
||||
return 0;
|
||||
|
||||
if (template.item_bane_rank > 0)
|
||||
return (long) (template.item_bane_rank * 60 * 60 * 3 * 1000 * Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue()));
|
||||
|
||||
if (vendor.building == null)
|
||||
return 600;
|
||||
|
||||
rollingDuration = vendor.getBuilding().getRank() * -5L + 40;
|
||||
rollingDuration = TimeUnit.MINUTES.toMillis((long) rollingDuration);
|
||||
rollingDuration *= Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue());
|
||||
|
||||
return (long) rollingDuration;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums.*;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.*;
|
||||
import engine.objects.*;
|
||||
@@ -173,15 +172,15 @@ public enum PowersManager {
|
||||
public static void usePower(final PerformActionMsg msg, ClientConnection origin,
|
||||
boolean sendCastToSelf) {
|
||||
|
||||
if (ConfigManager.MB_RULESET.getValue() == "LORE") {
|
||||
if (ConfigManager.MB_RULESET.getValue().equals("LORE")) {
|
||||
PowersBase pb = PowersManager.powersBaseByToken.get(msg.getPowerUsedID());
|
||||
PlayerCharacter caster = origin.getPlayerCharacter();
|
||||
PlayerCharacter target = PlayerCharacter.getFromCache(msg.getTargetID());
|
||||
if (pb != null && pb.isHarmful == false) {
|
||||
if (caster.guild.equals(Guild.getErrantGuild()))
|
||||
return;
|
||||
//if (caster.guild.equals(Guild.getErrantGuild()))
|
||||
// return;
|
||||
|
||||
if (target != null && caster.guild.getGuildType().equals(target.guild.getGuildType()) == false)
|
||||
if (target != null && caster.guild.getGuildType().equals(target.guild.getGuildType()) == false && target.getObjectType().equals(GameObjectType.Building) == false)
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -191,7 +190,7 @@ public enum PowersManager {
|
||||
|
||||
RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(msg.getPowerUsedID());
|
||||
Dispatch dispatch = Dispatch.borrow(origin.getPlayerCharacter(), recyclePowerMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
|
||||
// Send Fail to cast message
|
||||
PlayerCharacter pc = SessionManager
|
||||
@@ -244,7 +243,7 @@ public enum PowersManager {
|
||||
|
||||
RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(msg.getPowerUsedID());
|
||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, recyclePowerMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -488,7 +487,7 @@ public enum PowersManager {
|
||||
0f, 0f, 0, null,
|
||||
9999, 0);
|
||||
mhm.setOmitFromChat(1);
|
||||
DispatchMessage.dispatchMsgToInterestArea(playerCharacter, mhm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(playerCharacter, mhm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
}
|
||||
else if (pb.useMana())
|
||||
if (playerCharacter.getMana() < cost)
|
||||
@@ -519,7 +518,7 @@ public enum PowersManager {
|
||||
// else send recycle message to unlock power
|
||||
RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(msg.getPowerUsedID());
|
||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, recyclePowerMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
}
|
||||
|
||||
//what the fuck?
|
||||
@@ -529,7 +528,7 @@ public enum PowersManager {
|
||||
// else
|
||||
// msg.setUnknown04(1); // Regular Race, use mana?
|
||||
int tr = msg.getNumTrains();
|
||||
DispatchMessage.dispatchMsgToInterestArea(playerCharacter, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, sendCastToSelf, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(playerCharacter, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, sendCastToSelf, false);
|
||||
|
||||
//Make new msg..
|
||||
PerformActionMsg copyMsg = new PerformActionMsg(msg);
|
||||
@@ -540,7 +539,7 @@ public enum PowersManager {
|
||||
playerCharacter.update();
|
||||
playerCharacter.setSit(false);
|
||||
UpdateStateMsg updateStateMsg = new UpdateStateMsg(playerCharacter);
|
||||
DispatchMessage.dispatchMsgToInterestArea(playerCharacter, updateStateMsg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(playerCharacter, updateStateMsg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
|
||||
}
|
||||
|
||||
@@ -683,8 +682,8 @@ public enum PowersManager {
|
||||
|
||||
msg.setNumTrains(9999);
|
||||
|
||||
DispatchMessage.sendToAllInRange(caster, msg);
|
||||
DispatchMessage.sendToAllInRange(caster, msg);
|
||||
DispatchManager.sendToAllInRange(caster, msg);
|
||||
DispatchManager.sendToAllInRange(caster, msg);
|
||||
|
||||
msg.setNumTrains(tr);
|
||||
|
||||
@@ -751,7 +750,7 @@ public enum PowersManager {
|
||||
performActionMsg.setUnknown04(2);
|
||||
|
||||
dispatch = Dispatch.borrow(playerCharacter, performActionMsg);
|
||||
DispatchMessage.dispatchMsgToInterestArea(playerCharacter, performActionMsg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(playerCharacter, performActionMsg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -992,7 +991,7 @@ public enum PowersManager {
|
||||
PerformActionMsg castMsg = new PerformActionMsg(msg);
|
||||
castMsg.setNumTrains(9999);
|
||||
castMsg.setUnknown04(2);
|
||||
DispatchMessage.dispatchMsgToInterestArea(playerCharacter, castMsg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(playerCharacter, castMsg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
msgCasted = true;
|
||||
}
|
||||
}
|
||||
@@ -1002,7 +1001,7 @@ public enum PowersManager {
|
||||
PerformActionMsg castMsg = new PerformActionMsg(msg);
|
||||
castMsg.setNumTrains(9999);
|
||||
castMsg.setUnknown04(2);
|
||||
DispatchMessage.dispatchMsgToInterestArea(playerCharacter, castMsg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(playerCharacter, castMsg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
msgCasted = true;
|
||||
}
|
||||
|
||||
@@ -1063,7 +1062,7 @@ public enum PowersManager {
|
||||
|
||||
msg.setNumTrains(9999);
|
||||
msg.setUnknown04(2);
|
||||
DispatchMessage.sendToAllInRange(caster, msg);
|
||||
DispatchManager.sendToAllInRange(caster, msg);
|
||||
|
||||
// get target loc
|
||||
Vector3fImmutable targetLoc = msg.getTargetLoc();
|
||||
@@ -1170,7 +1169,7 @@ public enum PowersManager {
|
||||
// TODO echo power use to everyone else
|
||||
msg.setNumTrains(9999);
|
||||
msg.setUnknown04(2);
|
||||
DispatchMessage.sendToAllInRange(caster, msg);
|
||||
DispatchManager.sendToAllInRange(caster, msg);
|
||||
|
||||
}
|
||||
|
||||
@@ -1248,7 +1247,7 @@ public enum PowersManager {
|
||||
RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(token);
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(origin.getPlayerCharacter(), recyclePowerMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
|
||||
}
|
||||
|
||||
@@ -1374,7 +1373,7 @@ public enum PowersManager {
|
||||
PerformActionMsg msg = new PerformActionMsg(pb.getToken(),
|
||||
trains, ac.getObjectType().ordinal(), ac.getObjectUUID(), tarType, tarID, 0,
|
||||
0, 0, 1, 0);
|
||||
DispatchMessage.sendToAllInRange(target, msg);
|
||||
DispatchManager.sendToAllInRange(target, msg);
|
||||
|
||||
|
||||
ConcurrentHashMap<String, JobContainer> timers = ac.getTimers();
|
||||
@@ -1492,7 +1491,7 @@ public enum PowersManager {
|
||||
.getObjectType().ordinal(), ac.getObjectUUID(), target.getObjectType().ordinal(),
|
||||
target.getObjectUUID(), 0, 0, 0, 2, 0);
|
||||
|
||||
DispatchMessage.sendToAllInRange(ac, msg);
|
||||
DispatchManager.sendToAllInRange(ac, msg);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1943,7 +1942,7 @@ public enum PowersManager {
|
||||
|
||||
RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(token);
|
||||
Dispatch dispatch = Dispatch.borrow(pc, recyclePowerMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
|
||||
}
|
||||
|
||||
@@ -2103,12 +2102,12 @@ public enum PowersManager {
|
||||
case 3:
|
||||
case 4:
|
||||
msg.setUnknown04(2);
|
||||
DispatchMessage.dispatchMsgToInterestArea(playerCharacter, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(playerCharacter, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
break;
|
||||
default:
|
||||
msg.setUnknown04(1);
|
||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2126,7 +2125,7 @@ public enum PowersManager {
|
||||
|
||||
ApplyEffectMsg aem = new ApplyEffectMsg(pc, pc, 0, eb.getToken(), 9, pb.getToken(), pb.getName());
|
||||
aem.setUnknown03(type);
|
||||
DispatchMessage.dispatchMsgToInterestArea(pc, aem, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(pc, aem, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
@@ -2147,7 +2146,7 @@ public enum PowersManager {
|
||||
aem.setUnknown03(type);
|
||||
aem.setUnknown05(1);
|
||||
|
||||
DispatchMessage.dispatchMsgToInterestArea(pc, aem, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(pc, aem, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
@@ -2162,7 +2161,7 @@ public enum PowersManager {
|
||||
switch (type) {
|
||||
case 3:
|
||||
case 4:
|
||||
DispatchMessage.sendToAllInRange(mob, msg);
|
||||
DispatchManager.sendToAllInRange(mob, msg);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2401,7 +2400,7 @@ public enum PowersManager {
|
||||
if (pam != null) {
|
||||
pam.setNumTrains(9999);
|
||||
pam.setUnknown04(2);
|
||||
DispatchMessage.sendToAllInRange(ac, pam);
|
||||
DispatchManager.sendToAllInRange(ac, pam);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2465,7 +2464,7 @@ public enum PowersManager {
|
||||
PerformActionMsg pam = new PerformActionMsg(pb.getToken(), 9999, ac
|
||||
.getObjectType().ordinal(), ac.getObjectUUID(), target.getObjectType().ordinal(),
|
||||
target.getObjectUUID(), 0, 0, 0, 2, 0);
|
||||
DispatchMessage.sendToAllInRange(ac, pam);
|
||||
DispatchManager.sendToAllInRange(ac, pam);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
|
||||
package engine.gameManager;
|
||||
|
||||
import engine.mbEnums;
|
||||
import engine.InterestManagement.Terrain;
|
||||
import engine.math.Bounds;
|
||||
import engine.math.Vector2f;
|
||||
import engine.math.Vector3f;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.City;
|
||||
import engine.objects.Zone;
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
package engine.jobs;
|
||||
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.job.AbstractScheduleJob;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.ChatChannelType;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.chat.ChatSystemMsg;
|
||||
import engine.objects.City;
|
||||
import org.pmw.tinylog.Logger;
|
||||
@@ -66,7 +66,7 @@ public class ActivateBaneJob extends AbstractScheduleJob {
|
||||
msg.setMessageType(4); // Error message
|
||||
msg.setChannel(ChatChannelType.SYSTEM.getChannelID());
|
||||
|
||||
DispatchMessage.dispatchMsgToAll(msg);
|
||||
DispatchManager.dispatchMsgToAll(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
package engine.jobs;
|
||||
|
||||
import engine.mbEnums.DoorState;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.job.AbstractScheduleJob;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.mbEnums.DoorState;
|
||||
import engine.net.client.msg.DoorTryOpenMsg;
|
||||
import engine.objects.Blueprint;
|
||||
import engine.objects.Building;
|
||||
@@ -40,7 +40,7 @@ public class DoorCloseJob extends AbstractScheduleJob {
|
||||
this.building.setDoorState(doorNumber, DoorState.CLOSED);
|
||||
|
||||
DoorTryOpenMsg msg = new DoorTryOpenMsg(door, this.building.getObjectUUID(), 0, (byte) 0);
|
||||
DispatchMessage.sendToAllInRange(building, msg);
|
||||
DispatchManager.sendToAllInRange(building, msg);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
|
||||
package engine.jobs;
|
||||
|
||||
import engine.mbEnums.ModType;
|
||||
import engine.mbEnums.SourceType;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.job.AbstractScheduleJob;
|
||||
import engine.job.JobContainer;
|
||||
import engine.mbEnums.ModType;
|
||||
import engine.mbEnums.SourceType;
|
||||
import engine.net.client.msg.ErrorPopupMsg;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
|
||||
package engine.jobs;
|
||||
|
||||
import engine.mbEnums;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.TrackArrowMsg;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
@@ -84,7 +84,7 @@ public class TrackJob extends AbstractEffectJob {
|
||||
|
||||
TrackArrowMsg tam = new TrackArrowMsg(rotation);
|
||||
Dispatch dispatch = Dispatch.borrow(pc, tam);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
package engine.jobs;
|
||||
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.job.AbstractScheduleJob;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.Mob;
|
||||
import engine.objects.NPC;
|
||||
|
||||
@@ -25,24 +25,25 @@ import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.Delayed;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class WorkOrder implements Delayed {
|
||||
|
||||
// MB Dev notes:
|
||||
// Class defines a Forge rolling request made through a
|
||||
// vendor; then passed to the ForgeManager singleton
|
||||
// for completion.
|
||||
// Class defines a Forge rolling request made through a vendor
|
||||
// interaction; submitted to the ForgeManager singleton for completion.
|
||||
//
|
||||
// A workOrder once created will last until all items are
|
||||
// either completed or junked. They are persisted in the
|
||||
// table dyn_workorders.
|
||||
// A workOrder once created will last until all items are either
|
||||
// completed or junked. They are persisted in the table dyn_workorders.
|
||||
|
||||
public int workOrderID;
|
||||
public NPC vendor;
|
||||
public int slots_used;
|
||||
public AtomicInteger slots_used = new AtomicInteger(0);
|
||||
public int total_to_produce;
|
||||
public int total_produced;
|
||||
public boolean multiple_slot_request;
|
||||
@@ -54,8 +55,7 @@ public class WorkOrder implements Delayed {
|
||||
public int suffixToken;
|
||||
public long rollingDuration;
|
||||
public long completionTime;
|
||||
public boolean runCompleted = false;
|
||||
public boolean runCanceled = false;
|
||||
public AtomicBoolean runCompleted = new AtomicBoolean(false);
|
||||
|
||||
// This collection is serialized to the vendor rolling window in ManageNPCMsg.
|
||||
|
||||
@@ -72,7 +72,7 @@ public class WorkOrder implements Delayed {
|
||||
|
||||
this.workOrderID = jsonWorkOrder.getInt("workOrderID");
|
||||
this.vendor = NPC.getNPC(jsonWorkOrder.getInt("vendor"));
|
||||
this.slots_used = jsonWorkOrder.getInt("slots_used");
|
||||
this.slots_used.set(jsonWorkOrder.getInt("slots_used"));
|
||||
this.total_to_produce = jsonWorkOrder.getInt("total_to_produce");
|
||||
this.total_produced = jsonWorkOrder.getInt("total_produced");
|
||||
this.multiple_slot_request = jsonWorkOrder.getBoolean("multiple_slot_request");
|
||||
@@ -80,10 +80,14 @@ public class WorkOrder implements Delayed {
|
||||
this.item_name_override = jsonWorkOrder.getString("item_name_override");
|
||||
this.prefixToken = jsonWorkOrder.getInt("prefixToken");
|
||||
this.suffixToken = jsonWorkOrder.getInt("suffixToken");
|
||||
this.slots_used = jsonWorkOrder.getInt("slots_used");
|
||||
this.rollingDuration = jsonWorkOrder.getLong("rollingDuration");
|
||||
this.completionTime = jsonWorkOrder.getLong("completionTime");
|
||||
this.runCompleted = jsonWorkOrder.getBoolean("runCompleted");
|
||||
this.runCompleted.set(jsonWorkOrder.getBoolean("runCompleted"));
|
||||
|
||||
// Vendor sanity check. Might have been deleted
|
||||
|
||||
if (this.vendor == null)
|
||||
return;
|
||||
|
||||
JSONObject productionCostMap = jsonWorkOrder.getJSONObject("production_cost");
|
||||
|
||||
@@ -108,6 +112,7 @@ public class WorkOrder implements Delayed {
|
||||
for (Object o : tokenList) {
|
||||
int prefix = ((JSONArray) o).getInt(0);
|
||||
int suffix = ((JSONArray) o).getInt(1);
|
||||
|
||||
Item cookingItem = ForgeManager.forgeItem(this);
|
||||
cookingItem.prefixToken = prefix;
|
||||
cookingItem.suffixToken = suffix;
|
||||
@@ -147,53 +152,46 @@ public class WorkOrder implements Delayed {
|
||||
|
||||
public static boolean withdrawWorkOrderCost(WorkOrder workOrder) {
|
||||
|
||||
HashMap<mbEnums.ResourceType, Integer> modified_production_cost = new HashMap<>(workOrder.production_cost_total);
|
||||
|
||||
if (workOrder.vendor.building.getCity() == null)
|
||||
return false;
|
||||
|
||||
int strongbox = workOrder.vendor.building.getStrongboxValue();
|
||||
|
||||
// Strongbox can cover total gold cost;
|
||||
|
||||
if (workOrder.production_cost_total.get(mbEnums.ResourceType.GOLD) <= strongbox) {
|
||||
// Early exit if strongbox can cover gold only roll.
|
||||
|
||||
if (workOrder.production_cost_total.size() == 1 && workOrder.production_cost_total.get(mbEnums.ResourceType.GOLD) <= strongbox) {
|
||||
workOrder.vendor.building.setStrongboxValue(strongbox - workOrder.production_cost_total.get(mbEnums.ResourceType.GOLD));
|
||||
workOrder.production_cost_total.put(mbEnums.ResourceType.GOLD, 0);
|
||||
|
||||
// Early exit for Strongbox covering gold only rolls
|
||||
|
||||
if (workOrder.production_cost_total.size() == 1)
|
||||
return true;
|
||||
} else {
|
||||
int remainingAmount = workOrder.production_cost_total.get(mbEnums.ResourceType.GOLD) - strongbox;
|
||||
workOrder.vendor.building.setStrongboxValue(0);
|
||||
workOrder.production_cost_total.put(mbEnums.ResourceType.GOLD, workOrder.production_cost_total.get(mbEnums.ResourceType.GOLD) - remainingAmount);
|
||||
return true;
|
||||
}
|
||||
|
||||
// There is an overflow at this point and a warehouse is required
|
||||
// Warehouse is required after this point
|
||||
|
||||
Warehouse warehouse = workOrder.vendor.building.getCity().warehouse;
|
||||
|
||||
if (warehouse == null)
|
||||
return false;
|
||||
|
||||
// Take from strongbox first and deduct from production cost total
|
||||
|
||||
if (workOrder.production_cost_total.get(mbEnums.ResourceType.GOLD) <= strongbox) {
|
||||
workOrder.vendor.building.setStrongboxValue(strongbox - workOrder.production_cost_total.get(mbEnums.ResourceType.GOLD));
|
||||
modified_production_cost.put(mbEnums.ResourceType.GOLD, 0);
|
||||
} else {
|
||||
int overflowAmount = workOrder.production_cost_total.get(mbEnums.ResourceType.GOLD) - strongbox;
|
||||
workOrder.vendor.building.setStrongboxValue(0);
|
||||
modified_production_cost.put(mbEnums.ResourceType.GOLD, overflowAmount);
|
||||
}
|
||||
|
||||
// Deduct total production cost from warehouse
|
||||
|
||||
workOrder.production_cost_total.forEach((key, value) -> warehouse.resources.put(key, warehouse.resources.get(key) - value));
|
||||
modified_production_cost.forEach((key, value) -> warehouse.resources.put(key, warehouse.resources.get(key) - value));
|
||||
DbManager.WarehouseQueries.UPDATE_WAREHOUSE(warehouse);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getDelay(TimeUnit unit) {
|
||||
long timeRemaining = completionTime - System.currentTimeMillis();
|
||||
return unit.convert(timeRemaining, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Delayed o) {
|
||||
return Long.compare(this.completionTime, ((WorkOrder) o).completionTime);
|
||||
}
|
||||
|
||||
public static JSONObject toJson(WorkOrder workOrder) {
|
||||
|
||||
@@ -203,7 +201,7 @@ public class WorkOrder implements Delayed {
|
||||
|
||||
jsonWorkOrder.put("workOrderID", workOrder.workOrderID);
|
||||
jsonWorkOrder.put("vendor", workOrder.vendor.getObjectUUID());
|
||||
jsonWorkOrder.put("slots_used", workOrder.slots_used);
|
||||
jsonWorkOrder.put("slots_used", workOrder.slots_used.get());
|
||||
jsonWorkOrder.put("total_to_produce", workOrder.total_to_produce);
|
||||
jsonWorkOrder.put("total_produced", workOrder.total_produced);
|
||||
jsonWorkOrder.put("multiple_slot_request", workOrder.multiple_slot_request);
|
||||
@@ -215,7 +213,7 @@ public class WorkOrder implements Delayed {
|
||||
jsonWorkOrder.put("suffixToken", workOrder.suffixToken);
|
||||
jsonWorkOrder.put("rollingDuration", workOrder.rollingDuration);
|
||||
jsonWorkOrder.put("completionTime", workOrder.completionTime);
|
||||
jsonWorkOrder.put("runCompleted", workOrder.runCompleted);
|
||||
jsonWorkOrder.put("runCompleted", workOrder.runCompleted.get());
|
||||
|
||||
ArrayList<Integer[]> cookingTokens = new ArrayList<>();
|
||||
|
||||
@@ -235,7 +233,7 @@ public class WorkOrder implements Delayed {
|
||||
|
||||
String outSTring = "\r\nwordOrderID: " + this.workOrderID + "\r\n" +
|
||||
"vendor: " + this.vendor.getObjectUUID() + "\r\n" +
|
||||
"slots_used: " + this.slots_used + "\r\n" +
|
||||
"slots_used: " + this.slots_used.get() + "\r\n" +
|
||||
"total_to_produce: " + this.total_to_produce + "\r\n" +
|
||||
"total_produced: " + this.total_produced + "\r\n" +
|
||||
"templateID: " + this.templateID + "\r\n" +
|
||||
@@ -244,12 +242,40 @@ public class WorkOrder implements Delayed {
|
||||
"suffixToken: " + this.suffixToken + "\r\n" +
|
||||
"rollingDuration: " + duration + "\r\n" +
|
||||
"completionTime: " + localDateTime + "\r\n" +
|
||||
"runCompleted: " + this.runCompleted + "\r\n" +
|
||||
"runCanceled: " + this.runCanceled + "\r\n" +
|
||||
"runCompleted: " + this.runCompleted.get() + "\r\n" +
|
||||
"productionCost: " + this.production_cost.toString() + "\r\n" +
|
||||
"totalProductionCost:: " + this.production_cost_total.toString();
|
||||
|
||||
return outSTring;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getDelay(TimeUnit unit) {
|
||||
long timeRemaining = completionTime - System.currentTimeMillis();
|
||||
return unit.convert(timeRemaining, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Delayed o) {
|
||||
return Long.compare(this.completionTime, ((WorkOrder) o).completionTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
|
||||
if (this == obj)
|
||||
return true;
|
||||
|
||||
if (obj == null || getClass() != obj.getClass())
|
||||
return false;
|
||||
|
||||
WorkOrder otherWorkOrder = (WorkOrder) obj;
|
||||
return workOrderID == otherWorkOrder.workOrderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(workOrderID);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+110
-140
@@ -14,7 +14,10 @@ import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector2f;
|
||||
import engine.math.Vector3f;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.*;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.ItemTemplate;
|
||||
import engine.objects.Shrine;
|
||||
import engine.objects.Zone;
|
||||
import engine.powers.EffectsBase;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
@@ -34,6 +37,16 @@ import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
public class mbEnums {
|
||||
|
||||
public static <T extends Enum<T>> int toInt(EnumSet<T> enumSet) {
|
||||
|
||||
int bitvector = 0;
|
||||
|
||||
for (T value : enumSet)
|
||||
bitvector |= 1 << value.ordinal();
|
||||
|
||||
return bitvector;
|
||||
}
|
||||
|
||||
public static <T extends Enum<T>> long toLong(EnumSet<T> enumSet) {
|
||||
|
||||
long bitvector = 0L;
|
||||
@@ -2230,7 +2243,8 @@ public class mbEnums {
|
||||
NONE("None", new String[][]{{"None"}}, new String[]{"Thearchy", "Common Rule", "Theocracy", "Republic Rule"},
|
||||
EnumSet.noneOf(ClassType.class),
|
||||
EnumSet.noneOf(MonsterType.class),
|
||||
EnumSet.noneOf(SexType.class)),
|
||||
EnumSet.noneOf(SexType.class),
|
||||
0),
|
||||
|
||||
CATHEDRAL("Church of the All-Father", new String[][]{
|
||||
{"Acolyte", "Acolyte"},
|
||||
@@ -2246,7 +2260,8 @@ public class mbEnums {
|
||||
ClassType.Prelate, ClassType.Priest, ClassType.Sentinel, ClassType.Scout),
|
||||
EnumSet.of(MonsterType.Aelfborn, MonsterType.Centaur, MonsterType.Elf, MonsterType.HalfGiant,
|
||||
MonsterType.Human),
|
||||
EnumSet.allOf(SexType.class)),
|
||||
EnumSet.allOf(SexType.class),
|
||||
559),
|
||||
MILITARY("Military", new String[][]{
|
||||
{"Recruit"},
|
||||
{"Footman"},
|
||||
@@ -2260,7 +2275,8 @@ public class mbEnums {
|
||||
EnumSet.of(ClassType.Bard, ClassType.Priest, ClassType.Scout, ClassType.Warlock,
|
||||
ClassType.Warrior, ClassType.Wizard),
|
||||
EnumSet.of(MonsterType.Centaur, MonsterType.HalfGiant, MonsterType.Human),
|
||||
EnumSet.allOf(SexType.class)),
|
||||
EnumSet.allOf(SexType.class),
|
||||
560),
|
||||
TEMPLE("Temple of the Cleansing Flame", new String[][]{
|
||||
{"Aspirant"},
|
||||
{"Novice"},
|
||||
@@ -2275,7 +2291,8 @@ public class mbEnums {
|
||||
EnumSet.of(ClassType.Assassin, ClassType.Bard, ClassType.Channeler, ClassType.Confessor,
|
||||
ClassType.Nightstalker, ClassType.Priest, ClassType.Scout, ClassType.Templar),
|
||||
EnumSet.of(MonsterType.HalfGiant, MonsterType.Human),
|
||||
EnumSet.allOf(SexType.class)),
|
||||
EnumSet.allOf(SexType.class),
|
||||
561),
|
||||
BARBARIAN("Barbarian Clan", new String[][]{
|
||||
{"Barbarian"},
|
||||
{"Skald"},
|
||||
@@ -2288,7 +2305,8 @@ public class mbEnums {
|
||||
EnumSet.of(ClassType.Barbarian, ClassType.Bard, ClassType.Doomsayer, ClassType.Fury,
|
||||
ClassType.Priest, ClassType.Scout, ClassType.Thief, ClassType.Warrior),
|
||||
EnumSet.of(MonsterType.Aelfborn, MonsterType.HalfGiant, MonsterType.Human, MonsterType.Minotaur),
|
||||
EnumSet.allOf(SexType.class)),
|
||||
EnumSet.allOf(SexType.class),
|
||||
562),
|
||||
RANGER("Ranger's Brotherhood", new String[][]{
|
||||
{"Yeoman"},
|
||||
{"Pathfinder"},
|
||||
@@ -2301,7 +2319,8 @@ public class mbEnums {
|
||||
EnumSet.of(ClassType.Bard, ClassType.Channeler, ClassType.Druid, ClassType.Priest,
|
||||
ClassType.Ranger, ClassType.Scout, ClassType.Warrior),
|
||||
EnumSet.of(MonsterType.Aelfborn, MonsterType.Elf, MonsterType.HalfGiant, MonsterType.Human, MonsterType.Shade),
|
||||
EnumSet.allOf(SexType.class)),
|
||||
EnumSet.allOf(SexType.class),
|
||||
563),
|
||||
AMAZON("Amazon Temple", new String[][]{
|
||||
{"Amazon Thrall", "Amazon"},
|
||||
{"Amazon Slave", "Amazon Warrior"},
|
||||
@@ -2313,7 +2332,8 @@ public class mbEnums {
|
||||
EnumSet.of(ClassType.Bard, ClassType.Druid, ClassType.Fury, ClassType.Huntress,
|
||||
ClassType.Priest, ClassType.Scout, ClassType.Warrior, ClassType.Wizard),
|
||||
EnumSet.of(MonsterType.Aelfborn, MonsterType.Elf, MonsterType.HalfGiant, MonsterType.Human),
|
||||
EnumSet.of(SexType.FEMALE)),
|
||||
EnumSet.of(SexType.FEMALE),
|
||||
564),
|
||||
NOBLE("Noble House", new String[][]{
|
||||
{"Serf"},
|
||||
{"Vassal"},
|
||||
@@ -2328,7 +2348,8 @@ public class mbEnums {
|
||||
EnumSet.of(ClassType.Assassin, ClassType.Bard, ClassType.Channeler, ClassType.Priest,
|
||||
ClassType.Scout, ClassType.Thief, ClassType.Warlock, ClassType.Warrior, ClassType.Wizard),
|
||||
EnumSet.of(MonsterType.Aelfborn, MonsterType.HalfGiant, MonsterType.Human),
|
||||
EnumSet.allOf(SexType.class)),
|
||||
EnumSet.allOf(SexType.class),
|
||||
565),
|
||||
WIZARD("Wizard's Conclave", new String[][]{
|
||||
{"Apprentice"},
|
||||
{"Neophyte"},
|
||||
@@ -2341,7 +2362,8 @@ public class mbEnums {
|
||||
EnumSet.of(ClassType.Assassin, ClassType.Bard, ClassType.Channeler, ClassType.Doomsayer,
|
||||
ClassType.Fury, ClassType.Necromancer, ClassType.Priest, ClassType.Warlock, ClassType.Wizard),
|
||||
EnumSet.of(MonsterType.Aelfborn, MonsterType.Elf, MonsterType.Human, MonsterType.Nephilim, MonsterType.Shade),
|
||||
EnumSet.allOf(SexType.class)),
|
||||
EnumSet.allOf(SexType.class),
|
||||
566),
|
||||
MERCENARY("Mercenary Company", new String[][]{
|
||||
{"Soldier"},
|
||||
{"Man-at-Arms"},
|
||||
@@ -2355,7 +2377,8 @@ public class mbEnums {
|
||||
EnumSet.of(ClassType.Assassin, ClassType.Bard, ClassType.Priest, ClassType.Scout,
|
||||
ClassType.Thief, ClassType.Warlock, ClassType.Warrior),
|
||||
EnumSet.of(MonsterType.Aelfborn, MonsterType.Aracoix, MonsterType.HalfGiant, MonsterType.Human, MonsterType.Shade),
|
||||
EnumSet.allOf(SexType.class)),
|
||||
EnumSet.allOf(SexType.class),
|
||||
567),
|
||||
THIEVES("Thieve's Den", new String[][]{
|
||||
{"Urchin"},
|
||||
{"Footpad"},
|
||||
@@ -2371,7 +2394,8 @@ public class mbEnums {
|
||||
ClassType.Scout, ClassType.Thief, ClassType.Wizard),
|
||||
EnumSet.of(MonsterType.Aelfborn, MonsterType.Aracoix, MonsterType.Elf, MonsterType.Human, MonsterType.Irekei,
|
||||
MonsterType.Nephilim, MonsterType.Shade, MonsterType.Vampire),
|
||||
EnumSet.allOf(SexType.class)),
|
||||
EnumSet.allOf(SexType.class),
|
||||
568),
|
||||
DWARF("Dwarf Hold", new String[][]{
|
||||
{"Citizen"},
|
||||
{"Master"},
|
||||
@@ -2383,7 +2407,8 @@ public class mbEnums {
|
||||
EnumSet.of(ClassType.Crusader, ClassType.Prelate, ClassType.Priest, ClassType.Sentinel,
|
||||
ClassType.Warrior),
|
||||
EnumSet.of(MonsterType.Dwarf),
|
||||
EnumSet.allOf(SexType.class)),
|
||||
EnumSet.allOf(SexType.class),
|
||||
569),
|
||||
HIGHCOURT("High Court", new String[][]{
|
||||
{"Eccekebe"},
|
||||
{"Saedulor"},
|
||||
@@ -2399,7 +2424,8 @@ public class mbEnums {
|
||||
ClassType.Necromancer, ClassType.Priest, ClassType.Ranger, ClassType.Scout,
|
||||
ClassType.Thief, ClassType.Warrior, ClassType.Wizard),
|
||||
EnumSet.of(MonsterType.Elf, MonsterType.Minotaur),
|
||||
EnumSet.allOf(SexType.class)),
|
||||
EnumSet.allOf(SexType.class),
|
||||
570),
|
||||
VIRAKT("Virakt", new String[][]{
|
||||
{"Jov'uus"},
|
||||
{"Urikhan"},
|
||||
@@ -2414,7 +2440,8 @@ public class mbEnums {
|
||||
ClassType.Huntress, ClassType.Nightstalker, ClassType.Priest, ClassType.Ranger,
|
||||
ClassType.Scout, ClassType.Thief, ClassType.Warrior, ClassType.Wizard),
|
||||
EnumSet.of(MonsterType.Irekei),
|
||||
EnumSet.allOf(SexType.class)),
|
||||
EnumSet.allOf(SexType.class),
|
||||
571),
|
||||
BRIALIA("Coven of Brialia", new String[][]{ // Unknown Rank names
|
||||
{"Devotee"},
|
||||
{"Initiated"},
|
||||
@@ -2427,8 +2454,8 @@ public class mbEnums {
|
||||
new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"},
|
||||
EnumSet.allOf(ClassType.class),
|
||||
EnumSet.allOf(MonsterType.class),
|
||||
EnumSet.allOf(SexType.class)),
|
||||
|
||||
EnumSet.allOf(SexType.class),
|
||||
577),
|
||||
UNHOLY("Unholy Legion", new String[][]{ // Unknown Rank names
|
||||
{"Footman"},
|
||||
{"Fell Legionaire"},
|
||||
@@ -2443,7 +2470,8 @@ public class mbEnums {
|
||||
ClassType.Scout, ClassType.Thief, ClassType.Warlock, ClassType.Warrior,
|
||||
ClassType.Wizard),
|
||||
EnumSet.of(MonsterType.Human, MonsterType.Shade, MonsterType.Vampire),
|
||||
EnumSet.allOf(SexType.class)),
|
||||
EnumSet.allOf(SexType.class),
|
||||
575),
|
||||
SCOURGE("Cult of the Scourge", new String[][]{
|
||||
{"Thrall"},
|
||||
{"Mudir"},
|
||||
@@ -2454,7 +2482,8 @@ public class mbEnums {
|
||||
EnumSet.of(ClassType.Bard, ClassType.Channeler, ClassType.Doomsayer, ClassType.Priest,
|
||||
ClassType.Scout, ClassType.Warrior, ClassType.Wizard),
|
||||
EnumSet.of(MonsterType.Aelfborn, MonsterType.Human, MonsterType.Minotaur, MonsterType.Nephilim),
|
||||
EnumSet.allOf(SexType.class)),
|
||||
EnumSet.allOf(SexType.class),
|
||||
572),
|
||||
PIRATE("Pirate Crew", new String[][]{
|
||||
{"Midshipman", "Midshipwoman"},
|
||||
{"Sailor"},
|
||||
@@ -2465,7 +2494,8 @@ public class mbEnums {
|
||||
new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"},
|
||||
EnumSet.allOf(ClassType.class),
|
||||
EnumSet.allOf(MonsterType.class),
|
||||
EnumSet.allOf(SexType.class)),
|
||||
EnumSet.allOf(SexType.class),
|
||||
576),
|
||||
HERALD("Academy of Heralds", new String[][]{
|
||||
{"Pupil"},
|
||||
{"Scribe"},
|
||||
@@ -2478,7 +2508,8 @@ public class mbEnums {
|
||||
new String[]{"Despot Rule", "Common Rule", "Council Rule", "Republic Rule"},
|
||||
EnumSet.allOf(ClassType.class),
|
||||
EnumSet.allOf(MonsterType.class),
|
||||
EnumSet.allOf(SexType.class)),
|
||||
EnumSet.allOf(SexType.class),
|
||||
582),
|
||||
CENTAUR("Centaur Cohort", new String[][]{
|
||||
{"Hoplite"},
|
||||
{"Peltast"},
|
||||
@@ -2493,7 +2524,8 @@ public class mbEnums {
|
||||
ClassType.Prelate, ClassType.Priest, ClassType.Ranger, ClassType.Sentinel,
|
||||
ClassType.Warrior),
|
||||
EnumSet.of(MonsterType.Centaur),
|
||||
EnumSet.allOf(SexType.class)),
|
||||
EnumSet.allOf(SexType.class),
|
||||
574),
|
||||
KHREE("Aracoix Kh'ree", new String[][]{
|
||||
{"Duriacor"},
|
||||
{"Exarch"},
|
||||
@@ -2510,121 +2542,51 @@ public class mbEnums {
|
||||
ClassType.Priest, ClassType.Ranger, ClassType.Scout, ClassType.Thief,
|
||||
ClassType.Warlock, ClassType.Warrior),
|
||||
EnumSet.of(MonsterType.Aracoix),
|
||||
EnumSet.allOf(SexType.class));
|
||||
EnumSet.allOf(SexType.class),
|
||||
573);
|
||||
|
||||
public final EnumSet<ClassType> requiredClasses;
|
||||
public final EnumSet<MonsterType> requiredRaces;
|
||||
public final EnumSet<SexType> sexRequired;
|
||||
private final String name;
|
||||
public final String name;
|
||||
private final String[][] ranks; //Stored Rank#->Gender(M,F)
|
||||
private final String[] leadershipTypes;
|
||||
public final int templateID;
|
||||
public static HashMap<Integer, GuildCharterType> templateLookup = new HashMap<>();
|
||||
|
||||
GuildCharterType(String name, String[][] ranks, String[] leadershipTypes, EnumSet<ClassType> requiredClasses,
|
||||
EnumSet<MonsterType> requiredRaces, EnumSet<SexType> sexRequired) {
|
||||
EnumSet<MonsterType> requiredRaces, EnumSet<SexType> sexRequired, int templateID) {
|
||||
this.name = name;
|
||||
this.ranks = ranks;
|
||||
this.leadershipTypes = leadershipTypes;
|
||||
this.requiredClasses = requiredClasses;
|
||||
this.requiredRaces = requiredRaces;
|
||||
this.sexRequired = sexRequired;
|
||||
this.templateID = templateID;
|
||||
}
|
||||
|
||||
public static GuildCharterType getGuildTypeFromCharter(Item charter) {
|
||||
|
||||
GuildCharterType charterType;
|
||||
|
||||
// Must be a valid charter object
|
||||
|
||||
if (charter.template.item_type.equals(ItemType.CHARTER) == false)
|
||||
return GuildCharterType.NONE; //No guild Type
|
||||
|
||||
switch (charter.template.template_id) {
|
||||
|
||||
case 559:
|
||||
charterType = GuildCharterType.CATHEDRAL;
|
||||
break;
|
||||
case 560:
|
||||
charterType = GuildCharterType.MILITARY;
|
||||
break;
|
||||
case 561:
|
||||
charterType = GuildCharterType.TEMPLE;
|
||||
break;
|
||||
case 562:
|
||||
charterType = GuildCharterType.BARBARIAN;
|
||||
break;
|
||||
case 563:
|
||||
charterType = GuildCharterType.RANGER;
|
||||
break;
|
||||
case 564:
|
||||
charterType = GuildCharterType.AMAZON;
|
||||
break;
|
||||
case 565:
|
||||
charterType = GuildCharterType.NOBLE;
|
||||
break;
|
||||
case 566:
|
||||
charterType = GuildCharterType.WIZARD;
|
||||
break;
|
||||
case 567:
|
||||
charterType = GuildCharterType.MERCENARY;
|
||||
break;
|
||||
case 568:
|
||||
charterType = GuildCharterType.THIEVES;
|
||||
break;
|
||||
case 569:
|
||||
charterType = GuildCharterType.DWARF;
|
||||
break;
|
||||
case 570:
|
||||
charterType = GuildCharterType.HIGHCOURT;
|
||||
break;
|
||||
case 571:
|
||||
charterType = GuildCharterType.VIRAKT;
|
||||
break;
|
||||
case 572:
|
||||
charterType = GuildCharterType.SCOURGE;
|
||||
break;
|
||||
case 573:
|
||||
charterType = GuildCharterType.KHREE;
|
||||
break;
|
||||
case 574:
|
||||
charterType = GuildCharterType.CENTAUR;
|
||||
break;
|
||||
case 575:
|
||||
charterType = GuildCharterType.UNHOLY;
|
||||
break;
|
||||
case 576:
|
||||
charterType = GuildCharterType.PIRATE;
|
||||
break;
|
||||
case 577:
|
||||
charterType = GuildCharterType.BRIALIA;
|
||||
break;
|
||||
|
||||
default:
|
||||
charterType = GuildCharterType.HERALD;
|
||||
}
|
||||
|
||||
return charterType;
|
||||
public static void init() {
|
||||
for (GuildCharterType guildCharterType : GuildCharterType.values())
|
||||
GuildCharterType.templateLookup.put(guildCharterType.templateID, guildCharterType);
|
||||
}
|
||||
|
||||
|
||||
public static GuildCharterType getGuildTypeFromInt(int i) {
|
||||
return GuildCharterType.values()[i];
|
||||
}
|
||||
|
||||
public String getCharterName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public int getNumberOfRanks() {
|
||||
return ranks.length;
|
||||
}
|
||||
|
||||
public String getRankForGender(int rank, boolean male) {
|
||||
if (ranks.length < rank) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (ranks[rank].length != 1 && !male) {
|
||||
if (ranks.length < rank)
|
||||
return "";
|
||||
|
||||
if (ranks[rank].length != 1 && !male)
|
||||
return ranks[rank][1];
|
||||
}
|
||||
|
||||
return ranks[rank][0];
|
||||
}
|
||||
|
||||
@@ -2633,7 +2595,14 @@ public class mbEnums {
|
||||
}
|
||||
|
||||
public boolean canJoin(AbstractCharacter character) {
|
||||
return this.requiredRaces.contains(character.absRace) && this.requiredClasses.contains(character.absPromotionClass) && this.sexRequired.contains(character.absGender);
|
||||
if (this.requiredRaces.contains(character.absRace) == false)
|
||||
return false;
|
||||
if (this.requiredClasses.contains(character.absBaseClass) == false && this.requiredClasses.contains(character.absPromotionClass) == false)
|
||||
return false;
|
||||
if (this.sexRequired.contains(character.absGender) == false)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2746,42 +2715,44 @@ public class mbEnums {
|
||||
|
||||
public enum ResourceType {
|
||||
|
||||
GOLD(7, 2308551, 100000000, 10),
|
||||
ADAMANT(1580003, -1741189964, 1000, 10),
|
||||
AGATE(1580009, 75173057, 2000, 10),
|
||||
ANTIMONY(1580014, 452320058, 1000, 10),
|
||||
AZOTH(1580012, 78329697, 2000, 10),
|
||||
BLOODSTONE(1580020, -1569826353, 500, 10),
|
||||
BRONZEWOOD(1580006, 1334770447, 500, 10),
|
||||
COAL(1580008, 2559427, 3000, 10),
|
||||
DIAMOND(1580010, -1730704107, 2000, 10),
|
||||
GALVOR(1580017, -1596311545, 2000, 10),
|
||||
IRON(1580002, 2504297, 2000, 10),
|
||||
LUMBER(1580004, -1603256692, 10000, 10),
|
||||
MANDRAKE(1580007, 1191391799, 1000, 10),
|
||||
MITHRIL(1580021, -1761257186, 500, 10),
|
||||
OAK(1580005, 74767, 3000, 10),
|
||||
OBSIDIAN(1580019, -697973233, 500, 10),
|
||||
ONYX(1580011, 2977263, 1000, 10),
|
||||
ORICHALK(1580013, -2036290524, 3000, 10),
|
||||
QUICKSILVER(1580016, -472884509, 1000, 10),
|
||||
STONE(1580000, 74856115, 10000, 10),
|
||||
SULFUR(1580015, -1586349421, 1000, 10),
|
||||
TRUESTEEL(1580001, -317484979, 2000, 10),
|
||||
WORMWOOD(1580018, 1532478436, 500, 10);
|
||||
GOLD(7, -1670881623, 2308551, 100000000, 50000),
|
||||
ADAMANT(1580003, 1557001525, -1741189964, 1000, 10),
|
||||
AGATE(1580009, -1096157543, 75173057, 2000, 20),
|
||||
ANTIMONY(1580014, 1256147265, 452320058, 1000, 10),
|
||||
AZOTH(1580012, -1205326951, 78329697, 2000, 20),
|
||||
BLOODSTONE(1580020, -1912381716, -1569826353, 500, 5),
|
||||
BRONZEWOOD(1580006, -519681813, 1334770447, 500, 10),
|
||||
COAL(1580008, -1672872311, 2559427, 3000, 30),
|
||||
DIAMOND(1580010, 1540225085, -1730704107, 2000, 20),
|
||||
GALVOR(1580017, -1683992404, -1596311545, 2000, 5),
|
||||
IRON(1580002, -1673518119, 2504297, 2000, 20),
|
||||
LUMBER(1580004, 1628412684, -1603256692, 10000, 100),
|
||||
MANDRAKE(1580007, 1519910613, 1191391799, 1000, 10),
|
||||
MITHRIL(1580021, 626743397, -1761257186, 500, 5),
|
||||
OAK(1580005, -1653034775, 74767, 3000, 30),
|
||||
OBSIDIAN(1580019, 778019055, -697973233, 500, 5),
|
||||
ONYX(1580011, -1675952151, 2977263, 1000, 10),
|
||||
ORICHALK(1580013, -1468730955, -2036290524, 3000, 30),
|
||||
QUICKSILVER(1580016, -2081208434, -472884509, 1000, 10),
|
||||
STONE(1580000, -1094703863, 74856115, 10000, 100),
|
||||
SULFUR(1580015, -1763687412, -1586349421, 1000, 10),
|
||||
TRUESTEEL(1580001, -169012482, -317484979, 2000, 20),
|
||||
WORMWOOD(1580018, 1204785075, 1532478436, 500, 5);
|
||||
|
||||
public static HashMap<Integer, ResourceType> resourceLookup = new HashMap<>();
|
||||
public static HashMap<Integer, ResourceType> hashLookup = new HashMap<>();
|
||||
public static HashMap<Integer, ResourceType> templateLookup = new HashMap<>();
|
||||
public static HashMap<Integer, ResourceType> templateHashLookup = new HashMap<>();
|
||||
public int templateID;
|
||||
public ItemTemplate template;
|
||||
public int hash;
|
||||
public int resourceHash;
|
||||
public int templateHash;
|
||||
public int deposit_limit;
|
||||
public int mine_production;
|
||||
|
||||
ResourceType(int templateID, int hash, int deposit_limit, int mine_production) {
|
||||
ResourceType(int templateID, int resourceHash, int templateHash, int deposit_limit, int mine_production) {
|
||||
this.templateID = templateID;
|
||||
this.template = ItemTemplate.templates.get(this.templateID);
|
||||
this.hash = hash;
|
||||
this.resourceHash = resourceHash;
|
||||
this.templateHash = templateHash;
|
||||
this.deposit_limit = deposit_limit;
|
||||
this.mine_production = mine_production;
|
||||
}
|
||||
@@ -2789,11 +2760,10 @@ public class mbEnums {
|
||||
public static void InitializeResourceTypes() {
|
||||
|
||||
for (ResourceType resourceType : ResourceType.values()) {
|
||||
resourceLookup.put(resourceType.templateID, resourceType);
|
||||
hashLookup.put(resourceType.hash, resourceType);
|
||||
templateLookup.put(resourceType.templateID, resourceType);
|
||||
templateHashLookup.put(resourceType.templateHash, resourceType);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+155
-103
@@ -8,6 +8,7 @@
|
||||
|
||||
package engine.mobileAI;
|
||||
|
||||
import engine.InterestManagement.RealmMap;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.gameManager.*;
|
||||
import engine.math.Vector3f;
|
||||
@@ -15,9 +16,8 @@ import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.DispatchChannel;
|
||||
import engine.mobileAI.Threads.MobAIThread;
|
||||
import engine.mobileAI.Threads.Respawner;
|
||||
import engine.mobileAI.Threads.ReSpawner;
|
||||
import engine.mobileAI.utilities.MovementUtilities;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.PerformActionMsg;
|
||||
import engine.net.client.msg.PowerProjectileMsg;
|
||||
import engine.objects.*;
|
||||
@@ -30,6 +30,7 @@ import org.pmw.tinylog.Logger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
@@ -37,6 +38,13 @@ import static engine.math.FastMath.sqr;
|
||||
|
||||
public class MobAI {
|
||||
|
||||
// MB Dev notes:
|
||||
// Class implements mobile AI mechanics for Magicbane.
|
||||
//
|
||||
// Controls all mob actions from regular mobs to pets and guards.
|
||||
// Initiates in the "DetermineAction" method and branches from there
|
||||
//
|
||||
// CombatManager.class implements shared combat routines for all avatars.
|
||||
|
||||
private static void attackTarget(Mob mob, AbstractWorldObject target) {
|
||||
|
||||
@@ -50,8 +58,7 @@ public class MobAI {
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter) &&
|
||||
!mob.canSee((AbstractCharacter) target)) {
|
||||
if (target.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter) && !mob.canSee((AbstractCharacter) target)) {
|
||||
mob.setCombatTarget(null);
|
||||
return;
|
||||
}
|
||||
@@ -93,7 +100,10 @@ public class MobAI {
|
||||
public static void attackPlayer(Mob mob, PlayerCharacter target) {
|
||||
|
||||
try {
|
||||
|
||||
if (target == null || !target.isAlive() || !target.isActive()) {
|
||||
mob.setCombatTarget(null);
|
||||
return;
|
||||
}
|
||||
if (!mob.canSee(target)) {
|
||||
mob.setCombatTarget(null);
|
||||
return;
|
||||
@@ -115,11 +125,11 @@ public class MobAI {
|
||||
if (mob.isMoving() && mob.getRange() > 20)
|
||||
return;
|
||||
|
||||
CombatManager.combatCycle(mob, mob.combatTarget);
|
||||
CombatManager.combatCycle(mob, target);
|
||||
}
|
||||
|
||||
if (target.getPet() != null)
|
||||
if (target.getPet().getCombatTarget() == null && target.getPet().assist == true)
|
||||
if (target.getPet().getCombatTarget() == null && target.getPet().assist)
|
||||
target.getPet().setCombatTarget(mob);
|
||||
|
||||
} catch (Exception e) {
|
||||
@@ -154,7 +164,7 @@ public class MobAI {
|
||||
if (mob.isSiege()) {
|
||||
PowerProjectileMsg ppm = new PowerProjectileMsg(mob, target);
|
||||
ppm.setRange(50);
|
||||
DispatchMessage.dispatchMsgToInterestArea(mob, ppm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(mob, ppm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
@@ -165,13 +175,14 @@ public class MobAI {
|
||||
public static void attackMob(Mob mob, Mob target) {
|
||||
|
||||
try {
|
||||
if (mob == null || target == null)
|
||||
return;
|
||||
|
||||
if (mob.getRange() >= 30 && mob.isMoving())
|
||||
return;
|
||||
|
||||
//no weapons, default mob attack speed 3 seconds.
|
||||
|
||||
|
||||
CombatManager.combatCycle(mob, target);
|
||||
|
||||
} catch (Exception e) {
|
||||
@@ -188,10 +199,9 @@ public class MobAI {
|
||||
// early exit while waiting to patrol again.
|
||||
// Minions are force marched if captain is alive
|
||||
|
||||
boolean forced = mob.agentType.equals(mbEnums.AIAgentType.GUARDMINION) &&
|
||||
mob.guardCaptain.isAlive();
|
||||
boolean forced = mob.agentType.equals(mbEnums.AIAgentType.GUARDMINION) && mob.guardCaptain.isAlive();
|
||||
|
||||
if (mob.stopPatrolTime + (patrolDelay * 1000) > System.currentTimeMillis())
|
||||
if (mob.stopPatrolTime + (patrolDelay * 1000L) > System.currentTimeMillis())
|
||||
if (!forced)
|
||||
return;
|
||||
|
||||
@@ -210,6 +220,7 @@ public class MobAI {
|
||||
}
|
||||
}
|
||||
|
||||
assert mob.patrolPoints != null;
|
||||
if (mob.lastPatrolPointIndex > mob.patrolPoints.size() - 1)
|
||||
mob.lastPatrolPointIndex = 0;
|
||||
|
||||
@@ -229,6 +240,7 @@ public class MobAI {
|
||||
if (mob.agentType.equals(mbEnums.AIAgentType.GUARDCAPTAIN))
|
||||
for (Integer minionUUID : mob.minions) {
|
||||
Mob minion = Mob.getMob(minionUUID);
|
||||
assert minion != null;
|
||||
if (minion.isAlive() && minion.combatTarget == null)
|
||||
MobAI.patrol(minion);
|
||||
}
|
||||
@@ -252,7 +264,7 @@ public class MobAI {
|
||||
if (mob == null)
|
||||
return false;
|
||||
|
||||
if (mob.isPlayerGuard() == true) {
|
||||
if (mob.isPlayerGuard()) {
|
||||
|
||||
if (mob.agentType.equals(mbEnums.AIAgentType.GUARDWALLARCHER))
|
||||
return false; //wall archers don't cast
|
||||
@@ -263,14 +275,13 @@ public class MobAI {
|
||||
|
||||
// exception allowing werewolf and werebear guard captains to cast
|
||||
|
||||
if (mbEnums.MinionType.ContractToMinionMap.get(contractID).isMage() == false && contractID != 980103 && contractID != 980104)
|
||||
if (!mbEnums.MinionType.ContractToMinionMap.get(contractID).isMage() && contractID != 980103 && contractID != 980104)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Mobile has no powers defined in mobbase or contract..
|
||||
|
||||
if (PowersManager.getPowersForRune(mob.getMobBaseID()).isEmpty() &&
|
||||
PowersManager.getPowersForRune(contractID).isEmpty())
|
||||
if (PowersManager.getPowersForRune(mob.getMobBaseID()).isEmpty() && PowersManager.getPowersForRune(contractID).isEmpty())
|
||||
return false;
|
||||
|
||||
if (mob.nextCastTime == 0)
|
||||
@@ -370,7 +381,7 @@ public class MobAI {
|
||||
msg.setUnknown04(2);
|
||||
|
||||
PowersManager.finishUseMobPower(msg, mob, 0, 0);
|
||||
long randomCooldown = (long) ((ThreadLocalRandom.current().nextInt(10, 15) * 1000) * MobAIThread.AI_CAST_FREQUENCY);
|
||||
long randomCooldown = (long) ((ThreadLocalRandom.current().nextInt(10, 15) * 1000L) * MobAIThread.AI_CAST_FREQUENCY);
|
||||
|
||||
mob.nextCastTime = System.currentTimeMillis() + randomCooldown;
|
||||
return true;
|
||||
@@ -426,7 +437,7 @@ public class MobAI {
|
||||
|
||||
ChatManager.chatSayInfo(null, mob.getName() + " calls for help!");
|
||||
|
||||
Zone mobCamp = mob.getParentZone();
|
||||
Zone mobCamp = mob.parentZone;
|
||||
|
||||
for (Mob helper : mobCamp.zoneMobSet) {
|
||||
if (helper.behaviourType.respondsToCallForHelp && helper.behaviourType.BehaviourHelperType.equals(mob.behaviourType)) {
|
||||
@@ -454,7 +465,7 @@ public class MobAI {
|
||||
if (mob == null)
|
||||
return;
|
||||
|
||||
if (mob.getTimestamps().containsKey("lastExecution") == false)
|
||||
if (!mob.getTimestamps().containsKey("lastExecution"))
|
||||
mob.getTimestamps().put("lastExecution", System.currentTimeMillis());
|
||||
|
||||
if (System.currentTimeMillis() < mob.getTimeStamp("lastExecution"))
|
||||
@@ -474,11 +485,11 @@ public class MobAI {
|
||||
if (mob.despawned && mob.isPlayerGuard()) {
|
||||
|
||||
if (mob.agentType.equals(mbEnums.AIAgentType.GUARDMINION)) {
|
||||
if (mob.guardCaptain.isAlive() == false || ((Mob) mob.guardCaptain).despawned == true) {
|
||||
if (!mob.guardCaptain.isAlive() || ((Mob) mob.guardCaptain).despawned) {
|
||||
|
||||
//minions don't respawn while guard captain is dead
|
||||
|
||||
if (mob.isAlive() == false) {
|
||||
if (!mob.isAlive()) {
|
||||
mob.deathTime = System.currentTimeMillis();
|
||||
return;
|
||||
}
|
||||
@@ -519,12 +530,12 @@ public class MobAI {
|
||||
}
|
||||
|
||||
|
||||
if (mob.agentType.equals(mbEnums.AIAgentType.PET) == false)
|
||||
if (!mob.agentType.equals(mbEnums.AIAgentType.PET))
|
||||
checkToSendMobHome(mob);
|
||||
|
||||
if (mob.getCombatTarget() != null) {
|
||||
|
||||
if (mob.getCombatTarget().isAlive() == false) {
|
||||
if (!mob.getCombatTarget().isAlive()) {
|
||||
mob.setCombatTarget(null);
|
||||
return;
|
||||
}
|
||||
@@ -533,12 +544,12 @@ public class MobAI {
|
||||
|
||||
PlayerCharacter target = (PlayerCharacter) mob.getCombatTarget();
|
||||
|
||||
if (mob.playerAgroMap.containsKey(target.getObjectUUID()) == false) {
|
||||
if (!mob.playerAgroMap.containsKey(target.getObjectUUID())) {
|
||||
mob.setCombatTarget(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mob.canSee((PlayerCharacter) mob.getCombatTarget()) == false) {
|
||||
if (!mob.canSee((PlayerCharacter) mob.getCombatTarget())) {
|
||||
mob.setCombatTarget(null);
|
||||
return;
|
||||
}
|
||||
@@ -579,9 +590,9 @@ public class MobAI {
|
||||
|
||||
ConcurrentHashMap<Integer, Float> loadedPlayers = aiAgent.playerAgroMap;
|
||||
|
||||
for (Entry playerEntry : loadedPlayers.entrySet()) {
|
||||
for (Entry<Integer, Float> playerEntry : loadedPlayers.entrySet()) {
|
||||
|
||||
int playerID = (int) playerEntry.getKey();
|
||||
int playerID = playerEntry.getKey();
|
||||
PlayerCharacter loadedPlayer = PlayerCharacter.getPlayerCharacter(playerID);
|
||||
|
||||
//Player is null, let's remove them from the list.
|
||||
@@ -605,12 +616,12 @@ public class MobAI {
|
||||
|
||||
// No aggro for this race type
|
||||
|
||||
if (aiAgent.notEnemy.size() > 0 && aiAgent.notEnemy.contains(loadedPlayer.race.getRaceType().getMonsterType()) == true)
|
||||
if (!aiAgent.notEnemy.isEmpty() && aiAgent.notEnemy.contains(loadedPlayer.race.getRaceType().getMonsterType()))
|
||||
continue;
|
||||
|
||||
//mob has enemies and this player race is not it
|
||||
|
||||
if (aiAgent.enemy.size() > 0 && aiAgent.enemy.contains(loadedPlayer.race.getRaceType().getMonsterType()) == false)
|
||||
if (!aiAgent.enemy.isEmpty() && !aiAgent.enemy.contains(loadedPlayer.race.getRaceType().getMonsterType()))
|
||||
continue;
|
||||
|
||||
if (MovementUtilities.inRangeToAggro(aiAgent, loadedPlayer)) {
|
||||
@@ -651,49 +662,44 @@ public class MobAI {
|
||||
|
||||
mob.updateLocation();
|
||||
|
||||
switch (mob.behaviourType) {
|
||||
if (mob.behaviourType == mbEnums.MobBehaviourType.Pet1) {
|
||||
if (mob.guardCaptain == null)
|
||||
return;
|
||||
|
||||
case Pet1:
|
||||
//mob no longer has its owner loaded, translate pet to owner
|
||||
|
||||
if (mob.guardCaptain == null)
|
||||
if (!mob.playerAgroMap.containsKey(mob.guardCaptain.getObjectUUID())) {
|
||||
MovementManager.translocate(mob, mob.guardCaptain.getLoc());
|
||||
return;
|
||||
}
|
||||
|
||||
if (mob.getCombatTarget() == null) {
|
||||
|
||||
//move back to owner
|
||||
|
||||
if (mob.getRange() * mob.getRange() >= mob.loc.distanceSquared(mob.guardCaptain.loc))
|
||||
return;
|
||||
|
||||
//mob no longer has its owner loaded, translate pet to owner
|
||||
mob.destination = mob.guardCaptain.getLoc();
|
||||
MovementUtilities.moveToLocation(mob, mob.destination, 5, false);
|
||||
} else
|
||||
chaseTarget(mob);
|
||||
} else {
|
||||
if (mob.getCombatTarget() == null) {
|
||||
|
||||
if (!mob.playerAgroMap.containsKey(mob.guardCaptain.getObjectUUID())) {
|
||||
MovementManager.translocate(mob, mob.guardCaptain.getLoc());
|
||||
return;
|
||||
}
|
||||
if (!mob.isMoving()) {
|
||||
|
||||
if (mob.getCombatTarget() == null) {
|
||||
// Minions only patrol on their own if captain is dead.
|
||||
|
||||
//move back to owner
|
||||
|
||||
if (mob.getRange() * mob.getRange() >= mob.loc.distanceSquared(mob.guardCaptain.loc))
|
||||
return;
|
||||
|
||||
mob.destination = mob.guardCaptain.getLoc();
|
||||
MovementUtilities.moveToLocation(mob, mob.destination, 5, false);
|
||||
if (!mob.agentType.equals(mbEnums.AIAgentType.GUARDMINION))
|
||||
patrol(mob);
|
||||
else if (!mob.guardCaptain.isAlive())
|
||||
patrol(mob);
|
||||
} else
|
||||
chaseTarget(mob);
|
||||
break;
|
||||
default:
|
||||
if (mob.getCombatTarget() == null) {
|
||||
|
||||
if (!mob.isMoving()) {
|
||||
|
||||
// Minions only patrol on their own if captain is dead.
|
||||
|
||||
if (mob.agentType.equals(mbEnums.AIAgentType.GUARDMINION) == false)
|
||||
patrol(mob);
|
||||
else if (mob.guardCaptain.isAlive() == false)
|
||||
patrol(mob);
|
||||
} else
|
||||
mob.stopPatrolTime = System.currentTimeMillis();
|
||||
} else {
|
||||
chaseTarget(mob);
|
||||
}
|
||||
break;
|
||||
mob.stopPatrolTime = System.currentTimeMillis();
|
||||
} else {
|
||||
chaseTarget(mob);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckMobMovement" + " " + e.getMessage());
|
||||
@@ -718,7 +724,6 @@ public class MobAI {
|
||||
if (System.currentTimeMillis() > aiAgent.deathTime + MBServerStatics.DESPAWN_TIMER_WITH_LOOT) {
|
||||
aiAgent.despawn();
|
||||
aiAgent.deathTime = System.currentTimeMillis();
|
||||
return;
|
||||
}
|
||||
//No items in inventory.
|
||||
} else {
|
||||
@@ -727,20 +732,18 @@ public class MobAI {
|
||||
if (System.currentTimeMillis() > aiAgent.deathTime + MBServerStatics.DESPAWN_TIMER_ONCE_LOOTED) {
|
||||
aiAgent.despawn();
|
||||
aiAgent.deathTime = System.currentTimeMillis();
|
||||
return;
|
||||
}
|
||||
//Mob never had Loot.
|
||||
} else {
|
||||
if (System.currentTimeMillis() > aiAgent.deathTime + MBServerStatics.DESPAWN_TIMER) {
|
||||
aiAgent.despawn();
|
||||
aiAgent.deathTime = System.currentTimeMillis();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (System.currentTimeMillis() > aiAgent.deathTime + (aiAgent.spawnDelay * 1000L)) {
|
||||
aiAgent.respawnTime = aiAgent.deathTime + (aiAgent.spawnDelay * 1000L);
|
||||
Respawner.respawnQueue.put(aiAgent);
|
||||
ReSpawner.respawnQueue.put(aiAgent);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.info(aiAgent.getObjectUUID() + " " + aiAgent.getName() + " Failed At: CheckForRespawn" + " " + e.getMessage());
|
||||
@@ -752,14 +755,13 @@ public class MobAI {
|
||||
|
||||
//checks if mob can attack based on attack timer and range
|
||||
|
||||
if (mob.isAlive() == false)
|
||||
if (!mob.isAlive())
|
||||
return;
|
||||
|
||||
if (mob.getCombatTarget() == null)
|
||||
return;
|
||||
|
||||
if (mob.getCombatTarget().getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter) && MovementUtilities.inRangeDropAggro(mob, (PlayerCharacter) mob.getCombatTarget()) == false &&
|
||||
mob.agentType.equals(mbEnums.AIAgentType.PET) == false) {
|
||||
if (mob.getCombatTarget().getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter) && !MovementUtilities.inRangeDropAggro(mob, (PlayerCharacter) mob.getCombatTarget()) && !mob.agentType.equals(mbEnums.AIAgentType.PET)) {
|
||||
|
||||
mob.setCombatTarget(null);
|
||||
return;
|
||||
@@ -782,7 +784,7 @@ public class MobAI {
|
||||
|
||||
City current = ZoneManager.getCityAtLocation(mob.getLoc());
|
||||
|
||||
if (current == null || current.equals(mob.getGuild().getOwnedCity()) == false) {
|
||||
if (current == null || !current.equals(mob.getGuild().getOwnedCity())) {
|
||||
|
||||
PowersBase recall = PowersManager.getPowerByToken(-1994153779);
|
||||
PowersManager.useMobPower(mob, mob, recall, 40);
|
||||
@@ -796,18 +798,18 @@ public class MobAI {
|
||||
Mob minion = Mob.getMob(minionUUID);
|
||||
|
||||
PowersManager.useMobPower(minion, minion, recall, 40);
|
||||
assert minion != null;
|
||||
minion.setCombatTarget(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (MovementUtilities.inRangeOfBindLocation(mob) == false) {
|
||||
} else if (!MovementUtilities.inRangeOfBindLocation(mob)) {
|
||||
|
||||
PowersBase recall = PowersManager.getPowerByToken(-1994153779);
|
||||
PowersManager.useMobPower(mob, mob, recall, 40);
|
||||
mob.setCombatTarget(null);
|
||||
|
||||
for (Integer playerEntry : mob.playerAgroMap.keySet())
|
||||
mob.playerAgroMap.put(playerEntry, 0f);
|
||||
mob.playerAgroMap.replaceAll((e, v) -> 0f);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckToSendMobHome" + " " + e.getMessage());
|
||||
@@ -818,9 +820,9 @@ public class MobAI {
|
||||
|
||||
try {
|
||||
|
||||
if (mob.getTimestamps().containsKey("lastChase") == false)
|
||||
if (!mob.getTimestamps().containsKey("lastChase"))
|
||||
mob.getTimestamps().put("lastChase", System.currentTimeMillis());
|
||||
else if (System.currentTimeMillis() < mob.getTimestamps().get("lastChase").longValue() + (750 + ThreadLocalRandom.current().nextInt(0, 500)))
|
||||
else if (System.currentTimeMillis() < mob.getTimestamps().get("lastChase") + (750 + ThreadLocalRandom.current().nextInt(0, 500)))
|
||||
return;
|
||||
|
||||
mob.getTimestamps().put("lastChase", System.currentTimeMillis());
|
||||
@@ -868,7 +870,7 @@ public class MobAI {
|
||||
Mob aggroMob = (Mob) awoMob;
|
||||
|
||||
//don't attack other guards
|
||||
if (aggroMob.isGuard() == true)
|
||||
if (aggroMob.isGuard())
|
||||
continue;
|
||||
|
||||
//don't attack pets
|
||||
@@ -919,7 +921,7 @@ public class MobAI {
|
||||
|
||||
try {
|
||||
|
||||
if (mob.guardCaptain == null && mob.isNecroPet() == false && mob.isSiege() == false)
|
||||
if (mob.guardCaptain == null && !mob.isNecroPet() && !mob.isSiege())
|
||||
if (ZoneManager.seaFloor.zoneMobSet.contains(mob))
|
||||
mob.killCharacter("no owner");
|
||||
|
||||
@@ -930,7 +932,7 @@ public class MobAI {
|
||||
|
||||
//recover health
|
||||
|
||||
if (mob.getTimestamps().containsKey("HEALTHRECOVERED") == false)
|
||||
if (!mob.getTimestamps().containsKey("HEALTHRECOVERED"))
|
||||
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
|
||||
|
||||
if (mob.isSit() && mob.getTimeStamp("HEALTHRECOVERED") < System.currentTimeMillis() + 3000)
|
||||
@@ -951,26 +953,67 @@ public class MobAI {
|
||||
private static void hamletGuardLogic(Mob mob) {
|
||||
|
||||
try {
|
||||
//safehold guard
|
||||
|
||||
if (mob.getCombatTarget() == null)
|
||||
safeGuardAggro(mob);
|
||||
else if (mob.getCombatTarget().isAlive() == false)
|
||||
safeGuardAggro(mob);
|
||||
if (ConfigManager.MB_RULESET.getValue().equals("LORE")) {
|
||||
//lore guard aggro to kill members of opposing charters
|
||||
if (mob.getCombatTarget() == null || !mob.combatTarget.isAlive())
|
||||
hamletGuardAggro(mob);
|
||||
else if (!mob.getCombatTarget().isAlive())
|
||||
hamletGuardAggro(mob);
|
||||
} else {
|
||||
//safehold guard
|
||||
|
||||
if (mob.getCombatTarget() == null || !mob.combatTarget.isAlive())
|
||||
safeGuardAggro(mob);
|
||||
else if (!mob.getCombatTarget().isAlive())
|
||||
safeGuardAggro(mob);
|
||||
}
|
||||
checkForAttack(mob);
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: HamletGuardLogic" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private static void hamletGuardAggro(Mob mob) {
|
||||
Realm realm = RealmMap.getRealmAtLocation(mob.loc);
|
||||
if (realm.getRealmName().equals("Uthgaard")) {
|
||||
HashSet<AbstractWorldObject> loadedMobs = WorldGrid.getObjectsInRangePartial(mob.loc, MobAIThread.AI_BASE_AGGRO_RANGE, MBServerStatics.MASK_MOB);
|
||||
for (AbstractWorldObject awo : loadedMobs) {
|
||||
Mob targetMob = (Mob) awo;
|
||||
if (targetMob.equals(mob))
|
||||
continue;
|
||||
if (!targetMob.isAlive() || targetMob.despawned)
|
||||
continue;
|
||||
if (targetMob.isPet())
|
||||
continue;
|
||||
mob.combatTarget = targetMob;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
HashSet<AbstractWorldObject> loadedPlayers = WorldGrid.getObjectsInRangePartial(mob.loc, MobAIThread.AI_BASE_AGGRO_RANGE, MBServerStatics.MASK_PLAYER);
|
||||
for (AbstractWorldObject awo : loadedPlayers) {
|
||||
PlayerCharacter pc = (PlayerCharacter) awo;
|
||||
if (!pc.isAlive() || !pc.isActive())
|
||||
continue;
|
||||
if (pc.guild.equals(Guild.getErrantGuild())) {
|
||||
mob.combatTarget = pc;
|
||||
return;
|
||||
}
|
||||
if (pc.guild.charter.equals(mob.guild.charter))
|
||||
continue;
|
||||
mob.combatTarget = pc;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private static void defaultLogic(Mob mob) {
|
||||
|
||||
try {
|
||||
|
||||
//check for players that can be aggroed if mob is agressive and has no target
|
||||
|
||||
if (mob.getCombatTarget() != null && mob.playerAgroMap.containsKey(mob.getCombatTarget().getObjectUUID()) == false)
|
||||
if (mob.getCombatTarget() != null && !mob.playerAgroMap.containsKey(mob.getCombatTarget().getObjectUUID()))
|
||||
mob.setCombatTarget(null);
|
||||
|
||||
if (mob.behaviourType.isAgressive) {
|
||||
@@ -1015,18 +1058,16 @@ public class MobAI {
|
||||
|
||||
// Defer to captain if possible for current target
|
||||
|
||||
if (mob.agentType.equals(mbEnums.AIAgentType.GUARDMINION) &&
|
||||
mob.guardCaptain.isAlive()
|
||||
&& mob.guardCaptain.combatTarget != null) {
|
||||
if (mob.agentType.equals(mbEnums.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<Integer, Float> playerEntry : loadedPlayers.entrySet()) {
|
||||
|
||||
int playerID = (int) playerEntry.getKey();
|
||||
int playerID = playerEntry.getKey();
|
||||
PlayerCharacter loadedPlayer = PlayerCharacter.getPlayerCharacter(playerID);
|
||||
|
||||
//Player is null, let's remove them from the list.
|
||||
@@ -1050,7 +1091,7 @@ public class MobAI {
|
||||
|
||||
// No aggro for this player
|
||||
|
||||
if (guardCanAggro(mob, loadedPlayer) == false)
|
||||
if (!guardCanAggro(mob, loadedPlayer))
|
||||
continue;
|
||||
|
||||
if (MovementUtilities.inRangeToAggro(mob, loadedPlayer) && mob.getCombatTarget() == null) {
|
||||
@@ -1084,7 +1125,12 @@ public class MobAI {
|
||||
|
||||
try {
|
||||
|
||||
if (mob.guardedCity.cityOutlaws.contains(target.getObjectUUID()) == true)
|
||||
if (ConfigManager.MB_RULESET.getValue().equals("LORE") && !target.guild.equals(Guild.getErrantGuild())) {
|
||||
if (mob.guild.charter.equals(target.guild.charter))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mob.guardedCity != null && mob.guardedCity.cityOutlaws.contains(target.getObjectUUID()))
|
||||
return true;
|
||||
|
||||
if (mob.getGuild().getNation().equals(target.getGuild().getNation()))
|
||||
@@ -1092,8 +1138,8 @@ public class MobAI {
|
||||
|
||||
//first check condemn list for aggro allowed (allies button is checked)
|
||||
|
||||
if (ZoneManager.getCityAtLocation(mob.getLoc()).getTOL().reverseKOS) {
|
||||
for (Entry<Integer, Condemned> entry : ZoneManager.getCityAtLocation(mob.getLoc()).getTOL().getCondemned().entrySet()) {
|
||||
if (Objects.requireNonNull(ZoneManager.getCityAtLocation(mob.getLoc())).getTOL().reverseKOS) {
|
||||
for (Entry<Integer, Condemned> entry : Objects.requireNonNull(ZoneManager.getCityAtLocation(mob.getLoc())).getTOL().getCondemned().entrySet()) {
|
||||
|
||||
//target is listed individually
|
||||
|
||||
@@ -1115,7 +1161,7 @@ public class MobAI {
|
||||
|
||||
//allies button is not checked
|
||||
|
||||
for (Entry<Integer, Condemned> entry : ZoneManager.getCityAtLocation(mob.getLoc()).getTOL().getCondemned().entrySet()) {
|
||||
for (Entry<Integer, Condemned> entry : Objects.requireNonNull(ZoneManager.getCityAtLocation(mob.getLoc())).getTOL().getCondemned().entrySet()) {
|
||||
|
||||
//target is listed individually
|
||||
|
||||
@@ -1146,7 +1192,7 @@ public class MobAI {
|
||||
//early exit for a mob who is already moving to a patrol point
|
||||
//while mob moving, update lastPatrolTime so that when they stop moving the 10 second timer can begin
|
||||
|
||||
if (mob.isMoving() == true) {
|
||||
if (mob.isMoving()) {
|
||||
mob.stopPatrolTime = System.currentTimeMillis();
|
||||
return;
|
||||
}
|
||||
@@ -1174,7 +1220,8 @@ public class MobAI {
|
||||
|
||||
//make sure mob is out of combat stance
|
||||
|
||||
if (minion.despawned == false) {
|
||||
assert minion != null;
|
||||
if (!minion.despawned) {
|
||||
if (MovementUtilities.canMove(minion)) {
|
||||
Vector3f minionOffset = mbEnums.FormationType.getOffset(2, mob.minions.indexOf(minionUUID) + 3);
|
||||
minion.updateLocation();
|
||||
@@ -1196,19 +1243,24 @@ public class MobAI {
|
||||
float CurrentHateValue = 0;
|
||||
|
||||
if (mob.getCombatTarget() != null && mob.getCombatTarget().getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter))
|
||||
CurrentHateValue = mob.playerAgroMap.get(mob.combatTarget.getObjectUUID()).floatValue();
|
||||
CurrentHateValue = mob.playerAgroMap.get(mob.combatTarget.getObjectUUID());
|
||||
|
||||
AbstractWorldObject mostHatedTarget = null;
|
||||
|
||||
for (Entry playerEntry : mob.playerAgroMap.entrySet()) {
|
||||
for (Entry<Integer, Float> playerEntry : mob.playerAgroMap.entrySet()) {
|
||||
|
||||
PlayerCharacter potentialTarget = PlayerCharacter.getPlayerCharacter((int) playerEntry.getKey());
|
||||
PlayerCharacter potentialTarget = PlayerCharacter.getPlayerCharacter(playerEntry.getKey());
|
||||
|
||||
if (potentialTarget.equals(mob.getCombatTarget()))
|
||||
continue;
|
||||
|
||||
if (potentialTarget != null && mob.playerAgroMap.get(potentialTarget.getObjectUUID()).floatValue() > CurrentHateValue && MovementUtilities.inRangeToAggro(mob, potentialTarget)) {
|
||||
CurrentHateValue = mob.playerAgroMap.get(potentialTarget.getObjectUUID()).floatValue();
|
||||
if (ConfigManager.MB_RULESET.getValue().equals("LORE") && !potentialTarget.guild.equals(Guild.getErrantGuild())) {
|
||||
if (mob.guild.charter.equals(potentialTarget.guild.charter))
|
||||
continue;
|
||||
}
|
||||
|
||||
if (mob.playerAgroMap.get(potentialTarget.getObjectUUID()) > CurrentHateValue && MovementUtilities.inRangeToAggro(mob, potentialTarget)) {
|
||||
CurrentHateValue = mob.playerAgroMap.get(potentialTarget.getObjectUUID());
|
||||
mostHatedTarget = potentialTarget;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,23 +13,21 @@ public class MobAIThread implements Runnable {
|
||||
public static int AI_PULSE_MOB_THRESHOLD = 200;
|
||||
public static int AI_PATROL_DIVISOR = 15;
|
||||
public static float AI_CAST_FREQUENCY;
|
||||
// Thread constructor
|
||||
|
||||
public MobAIThread() {
|
||||
Logger.info(" MobAIThread thread has started!");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
//cache config value for mobile casting delay
|
||||
|
||||
AI_CAST_FREQUENCY = Float.parseFloat(ConfigManager.MB_AI_CAST_FREQUENCY.getValue());
|
||||
AI_BASE_AGGRO_RANGE = (int) (60 * Float.parseFloat(ConfigManager.MB_AI_AGGRO_RANGE.getValue()));
|
||||
|
||||
while (true) {
|
||||
for (Zone zone : ZoneManager.getAllZones()) {
|
||||
|
||||
for (Mob mob : zone.zoneMobSet) {
|
||||
|
||||
for (Zone zone : ZoneManager.getAllZones())
|
||||
for (Mob mob : zone.zoneMobSet)
|
||||
try {
|
||||
if (mob != null)
|
||||
MobAI.determineAction(mob);
|
||||
@@ -37,8 +35,6 @@ public class MobAIThread implements Runnable {
|
||||
Logger.error("Mob: " + mob.getName() + " UUID: " + mob.getObjectUUID() + " ERROR: " + e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-4
@@ -15,17 +15,18 @@ import org.pmw.tinylog.Logger;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.DelayQueue;
|
||||
|
||||
public enum Respawner implements Runnable {
|
||||
public enum ReSpawner implements Runnable {
|
||||
|
||||
// MB Dev Notes:
|
||||
//
|
||||
// Thread acts as a throttle for messages to the client. Mobiles are
|
||||
// respawned over a short time so as not to flood the client when
|
||||
// an entire camp respawns at once.
|
||||
// respawned over a short time so as not to flood client when
|
||||
// entire camp respawns at once. Client has a tendency to drop
|
||||
// messages when given too much to digest.
|
||||
|
||||
RESPAWNER;
|
||||
|
||||
public static BlockingQueue<Mob> respawnQueue = new DelayQueue();
|
||||
public static final BlockingQueue<Mob> respawnQueue = new DelayQueue<>();
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
package engine.mobileAI.utilities;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.MovementManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums;
|
||||
@@ -68,8 +67,9 @@ public class MovementUtilities {
|
||||
float zoneRange = 250;
|
||||
|
||||
if (agent.getParentZone() != null) {
|
||||
if (agent.getParentZone().bounds != null)
|
||||
if (agent.getParentZone().bounds != null) {
|
||||
zoneRange = agent.getParentZone().bounds.getHalfExtents().x * 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (zoneRange > 300)
|
||||
@@ -252,7 +252,7 @@ public class MovementUtilities {
|
||||
|
||||
try {
|
||||
MovementManager.movement(msg, agent);
|
||||
} catch (MsgSendException e) {
|
||||
} catch (Exception e) {
|
||||
// TODO Figure out how we want to handle the msg send exception
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ import java.nio.ByteBuffer;
|
||||
import java.nio.channels.ClosedChannelException;
|
||||
import java.nio.channels.NotYetConnectedException;
|
||||
import java.nio.channels.SocketChannel;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
@@ -41,8 +40,6 @@ public abstract class AbstractConnection implements
|
||||
protected long lastKeepAliveTime = System.currentTimeMillis();
|
||||
protected long lastOpcode = -1;
|
||||
protected ConcurrentLinkedQueue<ByteBuffer> outbox = new ConcurrentLinkedQueue<>();
|
||||
protected ByteBuffer outBuf = null;
|
||||
protected ConcurrentHashMap<Long, Byte> cacheList;
|
||||
protected long nextWriteTime = 0L;
|
||||
|
||||
//Opcode tracking
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
package engine.net;
|
||||
|
||||
import engine.exception.SerializationException;
|
||||
import engine.server.MBServerStatics;
|
||||
import engine.util.StringUtils;
|
||||
import org.pmw.tinylog.Logger;
|
||||
@@ -95,7 +94,7 @@ public abstract class AbstractNetMsg {
|
||||
* @throws Exception
|
||||
*/
|
||||
protected abstract void _serialize(ByteBufferWriter writer)
|
||||
throws SerializationException;
|
||||
;
|
||||
|
||||
/**
|
||||
* Attempts to serialize this NetMsg into a ByteBuffer. ByteBuffer is
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
package engine.net;
|
||||
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.mbEnums.DispatchChannel;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
@@ -21,12 +22,11 @@ import java.util.regex.Pattern;
|
||||
// All outgoing Protocol messages to the player are managed through the MessageDispatcher.class.
|
||||
// All incoming Protocol messages from the player are managed by the Protocol.class.
|
||||
//
|
||||
// A DispatchMessage is configured (Protocol messsage) and wrapped in a Dispatch (distribution list).
|
||||
// A Dispatch can be submitted to the MessageDispatcher for delivery from any thread.
|
||||
// A Dispatch is configured wrapping a Protocol message and a distribution list is built.
|
||||
//
|
||||
// Dispatches are interleaved between channels. This is to ensure
|
||||
// a combat or movement message is not delayed by spam clicking a
|
||||
// larger message. Choose your channel wisely.
|
||||
// The system interleaves dispatches between two channels. This is to ensure that
|
||||
// a critical combat or movement message will not be delayed by spam clicking a larger
|
||||
// message with no temporal immediacy. Pick the correct channel will this in mind.
|
||||
|
||||
public class MessageDispatcher implements Runnable {
|
||||
|
||||
@@ -73,7 +73,7 @@ public class MessageDispatcher implements Runnable {
|
||||
this.messageDispatch = _messageQueue[dispatchChannel.getChannelID()].poll();
|
||||
|
||||
if (this.messageDispatch != null) {
|
||||
DispatchMessage.serializeDispatch(this.messageDispatch);
|
||||
DispatchManager.serializeDispatch(this.messageDispatch);
|
||||
shouldBlock = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.*;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.BuildingGroup;
|
||||
@@ -22,7 +21,7 @@ public class AbandonAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
// Instance variables
|
||||
|
||||
public AbandonAssetMsgHandler() {
|
||||
super(AbandonAssetMsg.class);
|
||||
super();
|
||||
|
||||
}
|
||||
|
||||
@@ -48,7 +47,7 @@ public class AbandonAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
// Member variable declaration
|
||||
PlayerCharacter player;
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.net.Protocol;
|
||||
import engine.net.client.ClientConnection;
|
||||
@@ -22,11 +21,11 @@ import static engine.gameManager.ChatManager.FLOOD_TIME_THRESHOLD;
|
||||
public class AbstractChatMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public AbstractChatMsgHandler() {
|
||||
super(AbstractChatMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
PlayerCharacter playerCharacter = origin.getPlayerCharacter();
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
|
||||
@@ -10,10 +9,8 @@ import engine.net.client.msg.ClientNetMsg;
|
||||
*/
|
||||
|
||||
public abstract class AbstractClientMsgHandler {
|
||||
private final Class<? extends ClientNetMsg> handler;
|
||||
|
||||
public AbstractClientMsgHandler(Class<? extends ClientNetMsg> handler) {
|
||||
this.handler = handler;
|
||||
public AbstractClientMsgHandler() {
|
||||
}
|
||||
|
||||
public boolean handleNetMsg(ClientNetMsg msg) {
|
||||
@@ -22,7 +19,7 @@ public abstract class AbstractClientMsgHandler {
|
||||
|
||||
try {
|
||||
executionSucceded = _handleNetMsg(msg, (ClientConnection) msg.getOrigin());
|
||||
} catch (MsgSendException e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
executionSucceded = false;
|
||||
}
|
||||
@@ -30,5 +27,5 @@ public abstract class AbstractClientMsgHandler {
|
||||
return executionSucceded;
|
||||
}
|
||||
|
||||
protected abstract boolean _handleNetMsg(ClientNetMsg msg, ClientConnection origin) throws MsgSendException;
|
||||
protected abstract boolean _handleNetMsg(ClientNetMsg msg, ClientConnection origin);
|
||||
}
|
||||
|
||||
@@ -9,16 +9,11 @@
|
||||
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.GuildManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.gameManager.*;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.mbEnums.GuildHistoryType;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
import engine.net.client.msg.ErrorPopupMsg;
|
||||
@@ -32,11 +27,11 @@ import org.joda.time.DateTime;
|
||||
public class AcceptInviteToGuildHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public AcceptInviteToGuildHandler() {
|
||||
super(AcceptInviteToGuildMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
PlayerCharacter player;
|
||||
AcceptInviteToGuildMsg msg;
|
||||
@@ -86,9 +81,9 @@ public class AcceptInviteToGuildHandler extends AbstractClientMsgHandler {
|
||||
player.resetGuildStatuses();
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(player, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
DispatchMessage.sendToAllInRange(player, new GuildInfoMsg(player, guild, 2));
|
||||
DispatchManager.sendToAllInRange(player, new GuildInfoMsg(player, guild, 2));
|
||||
|
||||
player.incVer();
|
||||
|
||||
|
||||
@@ -9,15 +9,14 @@
|
||||
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.mbEnums.GuildState;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
import engine.net.client.msg.ErrorPopupMsg;
|
||||
@@ -31,11 +30,11 @@ import java.util.ArrayList;
|
||||
public class AcceptSubInviteHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public AcceptSubInviteHandler() {
|
||||
super(AcceptSubInviteMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
AcceptSubInviteMsg msg = (AcceptSubInviteMsg) baseMsg;
|
||||
PlayerCharacter sourcePlayer;
|
||||
@@ -98,7 +97,7 @@ public class AcceptSubInviteHandler extends AbstractClientMsgHandler {
|
||||
msg.setUnknown02(1);
|
||||
msg.setResponse("Your guild is now a " + sourceGuild.getGuildState().name() + '.');
|
||||
dispatch = Dispatch.borrow(sourcePlayer, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
ChatManager.chatSystemInfo(sourcePlayer, "Your guild is now a " + sourceGuild.getGuildState().name() + '.');
|
||||
return true;
|
||||
|
||||
@@ -8,10 +8,9 @@
|
||||
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.mbEnums;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.AcceptTradeRequestMsg;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
@@ -28,11 +27,11 @@ import static engine.objects.CharacterItemManager.canTrade;
|
||||
public class AcceptTradeRequestMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public AcceptTradeRequestMsgHandler() {
|
||||
super(AcceptTradeRequestMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
// Member variable declaration
|
||||
|
||||
@@ -92,10 +91,10 @@ public class AcceptTradeRequestMsgHandler extends AbstractClientMsgHandler {
|
||||
UpdateVaultMsg uvmTarget = new UpdateVaultMsg(targetAccount);
|
||||
|
||||
dispatch = Dispatch.borrow(source, uvmSource);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
|
||||
dispatch = Dispatch.borrow(target, uvmTarget);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
|
||||
source.charItemManager.setVaultOpen(false);
|
||||
toTradeWith.setVaultOpen(false);
|
||||
@@ -118,10 +117,10 @@ public class AcceptTradeRequestMsgHandler extends AbstractClientMsgHandler {
|
||||
toTradeWith.tradeID = msg.getUnknown01();
|
||||
|
||||
dispatch = Dispatch.borrow(source, otwm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
|
||||
dispatch = Dispatch.borrow(target, otwm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.*;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.ItemType;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ActivateNPCMessage;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
@@ -23,11 +21,11 @@ import java.util.ArrayList;
|
||||
public class ActivateNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public ActivateNPCMsgHandler() {
|
||||
super(ActivateNPCMessage.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
ActivateNPCMessage msg;
|
||||
PlayerCharacter player;
|
||||
@@ -66,7 +64,7 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
anm.setSize(ItemLists.size());
|
||||
anm.setItemList(ItemLists);
|
||||
Dispatch dispatch = Dispatch.borrow(player, anm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
if (msg.getUnknown01() == 0) {
|
||||
@@ -125,7 +123,7 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
mca1.setAssetName1(building.getName());
|
||||
mca1.setUnknown54(1);
|
||||
Dispatch dispatch = Dispatch.borrow(player, mca1);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -8,10 +8,9 @@
|
||||
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.mbEnums;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.AddGoldToTradeWindowMsg;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
@@ -27,11 +26,11 @@ import static engine.objects.CharacterItemManager.canTrade;
|
||||
public class AddGoldToTradeWindowMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public AddGoldToTradeWindowMsgHandler() {
|
||||
super(AddGoldToTradeWindowMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
PlayerCharacter source = origin.getPlayerCharacter();
|
||||
|
||||
@@ -95,13 +94,13 @@ public class AddGoldToTradeWindowMsgHandler extends AbstractClientMsgHandler {
|
||||
source.charItemManager.modifyCommitToTrade();
|
||||
|
||||
dispatch = Dispatch.borrow(source, utwm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
dispatch = Dispatch.borrow(source, ugm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
dispatch = Dispatch.borrow(other, utwmOther);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -8,10 +8,9 @@
|
||||
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.mbEnums;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.AddItemToTradeWindowMsg;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
@@ -25,11 +24,11 @@ import static engine.objects.CharacterItemManager.canTrade;
|
||||
public class AddItemToTradeWindowMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public AddItemToTradeWindowMsgHandler() {
|
||||
super(AddItemToTradeWindowMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
// Member variable declaration
|
||||
|
||||
@@ -81,7 +80,7 @@ public class AddItemToTradeWindowMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
if (!tradingWith.hasRoomTrade(item.template.item_wt)) {
|
||||
dispatch = Dispatch.borrow(source, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -93,12 +92,12 @@ public class AddItemToTradeWindowMsgHandler extends AbstractClientMsgHandler {
|
||||
source.charItemManager.addItemToTrade(item);
|
||||
|
||||
dispatch = Dispatch.borrow(other, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
|
||||
source.charItemManager.modifyCommitToTrade();
|
||||
|
||||
dispatch = Dispatch.borrow(other, utwm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.AllianceType;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.AllianceChangeMsg;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
@@ -21,7 +20,7 @@ import engine.objects.PlayerCharacter;
|
||||
public class AllianceChangeMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public AllianceChangeMsgHandler() {
|
||||
super(AllianceChangeMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
private static void MakeEnemy(Guild fromGuild, Guild toGuild, AllianceChangeMsg msg, ClientConnection origin) {
|
||||
@@ -40,20 +39,20 @@ public class AllianceChangeMsgHandler extends AbstractClientMsgHandler {
|
||||
if (!Guild.sameGuild(origin.getPlayerCharacter().getGuild(), fromGuild)) {
|
||||
msg.setMsgType(AllianceChangeMsg.ERROR_NOT_SAME_GUILD);
|
||||
dispatch = Dispatch.borrow(origin.getPlayerCharacter(), msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!GuildStatusController.isInnerCouncil(origin.getPlayerCharacter().getGuildStatus()) && !GuildStatusController.isGuildLeader(origin.getPlayerCharacter().getGuildStatus())) {
|
||||
msg.setMsgType(AllianceChangeMsg.ERROR_NOT_AUTHORIZED);
|
||||
dispatch = Dispatch.borrow(origin.getPlayerCharacter(), msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
dispatch = Dispatch.borrow(origin.getPlayerCharacter(), msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
|
||||
}
|
||||
@@ -72,7 +71,7 @@ public class AllianceChangeMsgHandler extends AbstractClientMsgHandler {
|
||||
return;
|
||||
|
||||
dispatch = Dispatch.borrow(origin.getPlayerCharacter(), msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
|
||||
}
|
||||
@@ -91,13 +90,13 @@ public class AllianceChangeMsgHandler extends AbstractClientMsgHandler {
|
||||
return;
|
||||
|
||||
dispatch = Dispatch.borrow(origin.getPlayerCharacter(), msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
// Member variable declaration
|
||||
|
||||
@@ -142,7 +141,7 @@ public class AllianceChangeMsgHandler extends AbstractClientMsgHandler {
|
||||
}
|
||||
msg.setMsgType(AllianceChangeMsg.INFO_SUCCESS);
|
||||
Dispatch dispatch = Dispatch.borrow(player, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
|
||||
return true;
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.mbEnums;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.AllyEnemyListMsg;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
@@ -19,7 +18,7 @@ import engine.objects.PlayerCharacter;
|
||||
public class AllyEnemyListMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public AllyEnemyListMsgHandler() {
|
||||
super(AllyEnemyListMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
private static void showAllyEnemyList(Guild fromGuild, Guild toGuild, AllyEnemyListMsg msg, ClientConnection origin) {
|
||||
@@ -35,7 +34,7 @@ public class AllyEnemyListMsgHandler extends AbstractClientMsgHandler {
|
||||
if (toGuild == null)
|
||||
return;
|
||||
dispatch = Dispatch.borrow(origin.getPlayerCharacter(), msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
// UpdateClientAlliancesMsg ucam = new UpdateClientAlliancesMsg();
|
||||
//
|
||||
@@ -46,7 +45,7 @@ public class AllyEnemyListMsgHandler extends AbstractClientMsgHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
// Member variable declaration
|
||||
|
||||
|
||||
@@ -9,13 +9,12 @@
|
||||
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.gameManager.GroupManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.mbEnums;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
import engine.net.client.msg.group.AppointGroupLeaderMsg;
|
||||
@@ -26,11 +25,11 @@ import engine.objects.PlayerCharacter;
|
||||
public class AppointGroupLeaderHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public AppointGroupLeaderHandler() {
|
||||
super(AppointGroupLeaderMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
AppointGroupLeaderMsg msg = (AppointGroupLeaderMsg) baseMsg;
|
||||
|
||||
PlayerCharacter source = SessionManager.getPlayerCharacter(origin);
|
||||
@@ -52,7 +51,7 @@ public class AppointGroupLeaderHandler extends AbstractClientMsgHandler {
|
||||
AppointGroupLeaderMsg reply = new AppointGroupLeaderMsg();
|
||||
reply.setResponse(1);
|
||||
Dispatch dispatch = Dispatch.borrow(origin.getPlayerCharacter(), reply);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.*;
|
||||
import engine.job.JobScheduler;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.DispatchChannel;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ArcLoginNotifyMsg;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
import engine.net.client.msg.HotzoneChangeMsg;
|
||||
import engine.net.client.msg.PetMsg;
|
||||
@@ -23,11 +20,11 @@ import org.pmw.tinylog.Logger;
|
||||
public class ArcLoginNotifyMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public ArcLoginNotifyMsgHandler() {
|
||||
super(ArcLoginNotifyMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
PlayerCharacter player = SessionManager.getPlayerCharacter(origin);
|
||||
|
||||
@@ -69,7 +66,7 @@ public class ArcLoginNotifyMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
// Send branch string if available from ConfigManager.
|
||||
|
||||
if (ConfigManager.currentRepoBranch != "")
|
||||
if (!ConfigManager.currentRepoBranch.equals(""))
|
||||
ChatManager.sendSystemMessage(player, ConfigManager.currentRepoBranch);
|
||||
|
||||
// Set player mask for QT
|
||||
@@ -130,7 +127,7 @@ public class ArcLoginNotifyMsgHandler extends AbstractClientMsgHandler {
|
||||
if (player.getPet() != null) {
|
||||
PetMsg pm = new PetMsg(5, player.getPet());
|
||||
Dispatch dispatch = Dispatch.borrow(player, pm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
//Send current hotzone
|
||||
@@ -138,7 +135,7 @@ public class ArcLoginNotifyMsgHandler extends AbstractClientMsgHandler {
|
||||
if (ZoneManager.hotZone != null) {
|
||||
HotzoneChangeMsg hcm = new HotzoneChangeMsg(mbEnums.GameObjectType.Zone.ordinal(), ZoneManager.hotZone.getObjectUUID());
|
||||
Dispatch dispatch = Dispatch.borrow(player, hcm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
if (player.getGuild() != null && !player.getGuild().isEmptyGuild()) {
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.DispatchChannel;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ArcMineChangeProductionMsg;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
@@ -21,11 +20,11 @@ import engine.objects.PlayerCharacter;
|
||||
public class ArcMineChangeProductionMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public ArcMineChangeProductionMsgHandler() {
|
||||
super(ArcMineChangeProductionMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
PlayerCharacter playerCharacter = origin.getPlayerCharacter();
|
||||
ArcMineChangeProductionMsg changeProductionMsg = (ArcMineChangeProductionMsg) baseMsg;
|
||||
@@ -51,7 +50,7 @@ public class ArcMineChangeProductionMsgHandler extends AbstractClientMsgHandler
|
||||
|
||||
//make sure valid resource
|
||||
|
||||
mbEnums.ResourceType resource = mbEnums.ResourceType.hashLookup.get(changeProductionMsg.getResourceHash());
|
||||
mbEnums.ResourceType resource = mbEnums.ResourceType.templateHashLookup.get(changeProductionMsg.getResourceHash());
|
||||
|
||||
if (resource == null)
|
||||
return true;
|
||||
@@ -60,7 +59,7 @@ public class ArcMineChangeProductionMsgHandler extends AbstractClientMsgHandler
|
||||
|
||||
mine.changeProductionType(resource);
|
||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, changeProductionMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.DispatchChannel;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ArcMineWindowAvailableTimeMsg;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
@@ -23,11 +22,11 @@ import engine.objects.PlayerCharacter;
|
||||
public class ArcMineWindowAvailableTimeHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public ArcMineWindowAvailableTimeHandler() {
|
||||
super(ArcMineWindowAvailableTimeMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
ArcMineWindowAvailableTimeMsg msg = (ArcMineWindowAvailableTimeMsg) baseMsg;
|
||||
PlayerCharacter playerCharacter = origin.getPlayerCharacter();
|
||||
@@ -55,7 +54,7 @@ public class ArcMineWindowAvailableTimeHandler extends AbstractClientMsgHandler
|
||||
ArcMineWindowAvailableTimeMsg outMsg = new ArcMineWindowAvailableTimeMsg(treeOfLife, 10);
|
||||
outMsg.configure();
|
||||
dispatch = Dispatch.borrow(playerCharacter, outMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.mbEnums.DispatchChannel;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ArcOwnedMinesListMsg;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
@@ -20,11 +19,11 @@ import engine.objects.PlayerCharacter;
|
||||
public class ArcOwnedMinesListHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public ArcOwnedMinesListHandler() {
|
||||
super(ArcOwnedMinesListMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
PlayerCharacter playerCharacter = origin.getPlayerCharacter();
|
||||
ArcOwnedMinesListMsg msg = (ArcOwnedMinesListMsg) baseMsg;
|
||||
@@ -37,7 +36,7 @@ public class ArcOwnedMinesListHandler extends AbstractClientMsgHandler {
|
||||
|
||||
msg.setMineList(Mine.getMinesForGuild(playerCharacter.getGuild().getObjectUUID()));
|
||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
@@ -22,11 +21,11 @@ import org.pmw.tinylog.Logger;
|
||||
public class ArcSiegeSpireMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public ArcSiegeSpireMsgHandler() {
|
||||
super(ArcSiegeSpireMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
PlayerCharacter player;
|
||||
Building spire;
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.mbEnums;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ArcViewAssetTransactionsMsg;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
@@ -23,11 +22,11 @@ import engine.objects.Warehouse;
|
||||
public class ArcViewAssetTransactionsMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public ArcViewAssetTransactionsMsgHandler() {
|
||||
super(ArcViewAssetTransactionsMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
PlayerCharacter player;
|
||||
ArcViewAssetTransactionsMsg msg;
|
||||
@@ -55,7 +54,7 @@ public class ArcViewAssetTransactionsMsgHandler extends AbstractClientMsgHandler
|
||||
newMsg.configure();
|
||||
|
||||
dispatch = Dispatch.borrow(player, newMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.gameManager.NPCManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.SupportMsgType;
|
||||
import engine.mbEnums.TaxType;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.*;
|
||||
import engine.objects.*;
|
||||
@@ -22,7 +21,7 @@ import org.pmw.tinylog.Logger;
|
||||
public class AssetSupportMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public AssetSupportMsgHandler() {
|
||||
super(AssetSupportMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
private static void protectAsset(AssetSupportMsg msg, Building targetBuilding, NPC vendor, ClientConnection origin) {
|
||||
@@ -96,7 +95,7 @@ public class AssetSupportMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
outMsg = new ManageNPCMsg(vendor);
|
||||
dispatch = Dispatch.borrow(origin.getPlayerCharacter(), outMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
private static void unprotectAsset(Building targetBuilding, NPC vendor, ClientConnection origin) {
|
||||
@@ -123,7 +122,7 @@ public class AssetSupportMsgHandler extends AbstractClientMsgHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
// Member variable declaration
|
||||
|
||||
@@ -179,7 +178,7 @@ public class AssetSupportMsgHandler extends AbstractClientMsgHandler {
|
||||
outMsg.configure();
|
||||
|
||||
dispatch = Dispatch.borrow(player, outMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
break;
|
||||
|
||||
case REMOVETAX:
|
||||
@@ -202,7 +201,7 @@ public class AssetSupportMsgHandler extends AbstractClientMsgHandler {
|
||||
mca.setAssetName1(targetBuilding.getName());
|
||||
mca.setUnknown54(1);
|
||||
dispatch = Dispatch.borrow(player, mca);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
return true;
|
||||
|
||||
case ACCEPTTAX: //AcceptTax
|
||||
@@ -226,12 +225,12 @@ public class AssetSupportMsgHandler extends AbstractClientMsgHandler {
|
||||
mca.setUnknown54(1);
|
||||
|
||||
dispatch = Dispatch.borrow(player, mca);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
return true;
|
||||
}
|
||||
|
||||
dispatch = Dispatch.borrow(player, baseMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
return true;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.CombatManager;
|
||||
import engine.mbEnums;
|
||||
@@ -22,11 +21,11 @@ import engine.objects.PlayerCharacter;
|
||||
public class AttackCmdMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public AttackCmdMsgHandler() {
|
||||
super(AttackCmdMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
PlayerCharacter playerCharacter = origin.getPlayerCharacter();
|
||||
|
||||
@@ -68,12 +67,6 @@ public class AttackCmdMsgHandler extends AbstractClientMsgHandler {
|
||||
return true; // cannot attack a null target
|
||||
}
|
||||
|
||||
// No point in setting combat target to someone you are already fighting
|
||||
|
||||
if (playerCharacter.isCombat() && playerCharacter.getCombatTarget() != null &&
|
||||
playerCharacter.getCombatTarget().equals(target))
|
||||
return true;
|
||||
|
||||
//set sources target
|
||||
|
||||
playerCharacter.setCombatTarget(target);
|
||||
|
||||
@@ -9,14 +9,13 @@
|
||||
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.GuildHistoryType;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
import engine.net.client.msg.ErrorPopupMsg;
|
||||
@@ -31,11 +30,11 @@ import org.joda.time.DateTime;
|
||||
public class BanishUnbanishHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public BanishUnbanishHandler() {
|
||||
super(BanishUnbanishMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
BanishUnbanishMsg msg = (BanishUnbanishMsg) baseMsg;
|
||||
Dispatch dispatch;
|
||||
|
||||
@@ -115,7 +114,7 @@ public class BanishUnbanishHandler extends AbstractClientMsgHandler {
|
||||
targetName + " has been banished from " + guild.getName() + '.');
|
||||
GuildListMsg guildListMsg = new GuildListMsg(guild);
|
||||
dispatch = Dispatch.borrow(source, guildListMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
} else {
|
||||
ErrorPopupMsg.sendErrorPopup(source, 103); // You may not banish this char
|
||||
}
|
||||
|
||||
@@ -9,15 +9,10 @@
|
||||
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.GuildManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.gameManager.*;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
import engine.net.client.msg.ErrorPopupMsg;
|
||||
@@ -32,11 +27,11 @@ import java.util.ArrayList;
|
||||
public class BreakFealtyHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public BreakFealtyHandler() {
|
||||
super(BreakFealtyMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
BreakFealtyMsg bfm;
|
||||
PlayerCharacter player;
|
||||
@@ -97,7 +92,7 @@ public class BreakFealtyHandler extends AbstractClientMsgHandler {
|
||||
|
||||
SendGuildEntryMsg msg = new SendGuildEntryMsg(player);
|
||||
dispatch = Dispatch.borrow(player, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
//Update Map.
|
||||
|
||||
@@ -164,7 +159,7 @@ public class BreakFealtyHandler extends AbstractClientMsgHandler {
|
||||
|
||||
SendGuildEntryMsg msg = new SendGuildEntryMsg(player);
|
||||
dispatch = Dispatch.borrow(player, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
//Update Map.
|
||||
|
||||
|
||||
@@ -9,9 +9,8 @@
|
||||
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.mbEnums.DispatchChannel;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ChangeAltitudeMsg;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
@@ -25,12 +24,12 @@ import org.pmw.tinylog.Logger;
|
||||
public class ChangeAltitudeHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public ChangeAltitudeHandler() {
|
||||
super(ChangeAltitudeMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg,
|
||||
ClientConnection origin) throws MsgSendException {
|
||||
ClientConnection origin) {
|
||||
|
||||
ChangeAltitudeMsg msg = (ChangeAltitudeMsg) baseMsg;
|
||||
|
||||
@@ -171,7 +170,7 @@ public class ChangeAltitudeHandler extends AbstractClientMsgHandler {
|
||||
// Add flight timer job to check stam and ground you when you run out
|
||||
//MovementManager.addFlightTimer(pc, msg, MBServerStatics.FLY_FREQUENCY_MS);
|
||||
//Send change altitude to all in range
|
||||
DispatchMessage.dispatchMsgToInterestArea(pc, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
DispatchManager.dispatchMsgToInterestArea(pc, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
|
||||
|
||||
return true;
|
||||
|
||||
@@ -9,13 +9,12 @@
|
||||
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ChangeGuildLeaderMsg;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
@@ -29,11 +28,11 @@ import engine.objects.PlayerCharacter;
|
||||
public class ChangeGuildLeaderHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public ChangeGuildLeaderHandler() {
|
||||
super(ChangeGuildLeaderMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
ChangeGuildLeaderMsg msg;
|
||||
PlayerCharacter sourcePlayer;
|
||||
@@ -67,18 +66,13 @@ public class ChangeGuildLeaderHandler extends AbstractClientMsgHandler {
|
||||
if (!Guild.sameGuild(sourcePlayer.getGuild(), targetPlayer.getGuild()))
|
||||
return false;
|
||||
|
||||
|
||||
//updateSource will generate a new promote/demote screen for sourcePlayer
|
||||
//updateTarget will sync guild info for the target and all players in range
|
||||
|
||||
|
||||
String targetName = null;
|
||||
boolean isMale = true;
|
||||
boolean updateTarget;
|
||||
|
||||
mbEnums.GuildCharterType t = mbEnums.GuildCharterType.getGuildTypeFromInt(sourcePlayer.getGuild().getCharter());
|
||||
|
||||
|
||||
if (!DbManager.GuildQueries.SET_GUILD_LEADER(targetPlayer.getObjectUUID(), glGuild.getObjectUUID())) {
|
||||
ChatManager.chatGuildError(sourcePlayer, "Failed to change guild leader!");
|
||||
return false;
|
||||
@@ -120,17 +114,17 @@ public class ChangeGuildLeaderHandler extends AbstractClientMsgHandler {
|
||||
|
||||
GuildInfoMsg guildInfoMsg = new GuildInfoMsg(sourcePlayer, sourcePlayer.getGuild(), 2);
|
||||
Dispatch dispatch = Dispatch.borrow(sourcePlayer, guildInfoMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
GuildListMsg guildListMsg = new GuildListMsg(sourcePlayer.getGuild());
|
||||
|
||||
dispatch = Dispatch.borrow(sourcePlayer, guildListMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
|
||||
if (targetPlayer != null) {
|
||||
if (updateTarget)
|
||||
DispatchMessage.sendToAllInRange(targetPlayer, new GuildInfoMsg(targetPlayer, targetPlayer.getGuild(), 2));
|
||||
DispatchManager.sendToAllInRange(targetPlayer, new GuildInfoMsg(targetPlayer, targetPlayer.getGuild(), 2));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -9,29 +9,29 @@
|
||||
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.DispatchManager;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.GameObjectType;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
import engine.net.client.msg.guild.ChangeRankMsg;
|
||||
import engine.net.client.msg.guild.GuildInfoMsg;
|
||||
import engine.net.client.msg.guild.GuildListMsg;
|
||||
import engine.objects.Guild;
|
||||
import engine.objects.GuildStatusController;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
public class ChangeRankHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public ChangeRankHandler() {
|
||||
super(ChangeRankMsg.class);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
ChangeRankMsg msg;
|
||||
PlayerCharacter sourcePlayer;
|
||||
@@ -60,7 +60,8 @@ public class ChangeRankHandler extends AbstractClientMsgHandler {
|
||||
boolean isMale;
|
||||
|
||||
if (msg.getPreviousRank() != msg.getNewRank()) {
|
||||
mbEnums.GuildCharterType t = mbEnums.GuildCharterType.getGuildTypeFromInt(sourcePlayer.getGuild().getCharter());
|
||||
Guild guild = sourcePlayer.getGuild();
|
||||
mbEnums.GuildCharterType t = mbEnums.GuildCharterType.getGuildTypeFromInt(guild.charter.ordinal());
|
||||
|
||||
if (targetPlayer != null) {
|
||||
targetPlayer.setGuildTitle(msg.getNewRank());
|
||||
@@ -144,16 +145,16 @@ public class ChangeRankHandler extends AbstractClientMsgHandler {
|
||||
if (targetPlayer != null) {
|
||||
targetPlayer.incVer();
|
||||
if (updateTarget)
|
||||
DispatchMessage.sendToAllInRange(targetPlayer, new GuildInfoMsg(targetPlayer, targetPlayer.getGuild(), 2));
|
||||
DispatchManager.sendToAllInRange(targetPlayer, new GuildInfoMsg(targetPlayer, targetPlayer.getGuild(), 2));
|
||||
}
|
||||
|
||||
if (updateSource) {
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(sourcePlayer, new GuildInfoMsg(sourcePlayer, sourcePlayer.getGuild(), 2));
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
dispatch = Dispatch.borrow(sourcePlayer, new GuildListMsg(sourcePlayer.getGuild()));
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package engine.net.client.handlers;
|
||||
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.GuildManager;
|
||||
@@ -8,7 +7,6 @@ import engine.gameManager.ZoneManager;
|
||||
import engine.mbEnums.BuildingGroup;
|
||||
import engine.mbEnums.GuildState;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ChatFilterMsg;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
import engine.objects.*;
|
||||
import org.pmw.tinylog.Logger;
|
||||
@@ -23,7 +21,7 @@ public class ChannelMuteMsgHandler extends AbstractClientMsgHandler {
|
||||
// Instance variables
|
||||
|
||||
public ChannelMuteMsgHandler() {
|
||||
super(ChatFilterMsg.class);
|
||||
super();
|
||||
|
||||
}
|
||||
|
||||
@@ -42,7 +40,7 @@ public class ChannelMuteMsgHandler extends AbstractClientMsgHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user