forked from MagicBane/Server
Compare commits
410 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 84446eb726 | |||
| 99f5a9c606 | |||
| 235b5e7375 | |||
| 7289f9e006 | |||
| 9c1afd9441 | |||
| 56226c71eb | |||
| c1eb6796f5 | |||
| 88e16448a8 | |||
| 4cb428e993 | |||
| af9945f9db | |||
| f0594fb1b2 | |||
| a155bc0308 | |||
| dce7444483 | |||
| 76eed79b0a | |||
| f73ed17c05 | |||
| b049d21aff | |||
| f6cce5ee1f | |||
| 8038c2ebe2 | |||
| 9f51b9af57 | |||
| cbc75bf9d7 | |||
| 0ecfa546cd | |||
| b89fb0803d | |||
| 11005d58a7 | |||
| b0c6239314 | |||
| 67f66155e9 | |||
| 7fbae12e99 | |||
| 65580c0a47 | |||
| 236afe4cc6 | |||
| c23a6af28f | |||
| 2535106d2c | |||
| d8379ae5a9 | |||
| 9f13f5fc5d | |||
| 884cb30ebd | |||
| 30488e5da6 | |||
| b7e798a950 | |||
| e999ca3f68 | |||
| 039638c0d8 | |||
| f282504896 | |||
| 0062936ac6 | |||
| 19c41daa86 | |||
| d860b16cfd | |||
| e3b42a8ad9 | |||
| 20bd7a82af | |||
| e607eb8220 | |||
| 38ca49d1a5 | |||
| a21bdfe031 | |||
| f95832b87c | |||
| feff9b3540 | |||
| 78118aa08c | |||
| 3539372437 | |||
| 7c498625bd | |||
| e379016123 | |||
| afa68b840c | |||
| 1926deb7f9 | |||
| 25c1f34c23 | |||
| d0e04e53ad | |||
| e475fb5cc9 | |||
| f72f632cd8 | |||
| 02ea27fc6f | |||
| 5d338bb87c | |||
| f9f08c2886 | |||
| dcc139043d | |||
| 520219404c | |||
| f97991f00d | |||
| 7b7e1c5337 | |||
| 6e66659940 | |||
| 3d83baed78 | |||
| 049b27da96 | |||
| 6bcbe0f633 | |||
| 8c44e39275 | |||
| e36ab1f5d2 | |||
| 865c775f41 | |||
| 198778ba2d | |||
| 215aabdc5f | |||
| 8d92c8be37 | |||
| 93b3ce07f0 | |||
| f9b7c8b851 | |||
| b3cf72abdc | |||
| 65fddd06a9 | |||
| 41f4a8ff58 | |||
| a13d5018b9 | |||
| 2ac3ce5bc8 | |||
| 85514987e7 | |||
| c9eb07b5ba | |||
| 7201b61498 | |||
| 55b3161900 | |||
| 9d5c4424a1 | |||
| d507ba2339 | |||
| 4ec5103454 | |||
| 3e09cd415e | |||
| 1098265145 | |||
| df7a106237 | |||
| 00b38970a1 | |||
| c1004e5817 | |||
| 13e9738345 | |||
| 1a7c1e2544 | |||
| ff082487b5 | |||
| 14cac0d892 | |||
| a8347e0b53 | |||
| a73c3453ea | |||
| a64932b2c9 | |||
| 685297171c | |||
| 2e3e403165 | |||
| fbd910ef50 | |||
| 30129d161f | |||
| a6510af56d | |||
| 9830920635 | |||
| 93025b72cd | |||
| 22639baa4c | |||
| 1aba8dfb11 | |||
| 8b4eb96262 | |||
| cafe6cd2fe | |||
| da6140f6f4 | |||
| 3fc68ce2ff | |||
| 5e8927245b | |||
| 75de1b3ae8 | |||
| 6743114d19 | |||
| 28cca67cb3 | |||
| bad7c6e798 | |||
| ecd3b38d3a | |||
| 8f09f16603 | |||
| 80812cb402 | |||
| 66fbf7aee6 | |||
| a92c603ab2 | |||
| 365438370d | |||
| a40b8fc915 | |||
| 5d92c1c86d | |||
| c526fd8847 | |||
| cd767dc68c | |||
| e21ebc75ee | |||
| 931eaaae4a | |||
| 4d487e6bf0 | |||
| 6c45a6573a | |||
| 45b0dda7d9 | |||
| caf3bc7470 | |||
| 5259b801f7 | |||
| 77e6d0db75 | |||
| b2d7e5ec1e | |||
| 15bc99d216 | |||
| 63c6e2abd7 | |||
| 8ab97a1b36 | |||
| d1aa581879 | |||
| 5f56143c5e | |||
| 1a2b558ac3 | |||
| 4f4ff74bf1 | |||
| ded3b08080 | |||
| 14a29c8612 | |||
| e66e430d30 | |||
| c833f560c1 | |||
| 454c721842 | |||
| 26eda324dc | |||
| 16951d36a2 | |||
| e1d36125d2 | |||
| 7a3c259d2f | |||
| aa5fb2a2c5 | |||
| a92cc6506c | |||
| 3971548142 | |||
| d94de771bf | |||
| c5f47ffcd4 | |||
| b336235ad7 | |||
| eea07309aa | |||
| 5529170036 | |||
| 3d745e93b6 | |||
| 019082bec7 | |||
| 855cceea70 | |||
| 487eae85e1 | |||
| 5d188e61c0 | |||
| 546c335198 | |||
| aaecc5eda2 | |||
| d13e939ddd | |||
| afea79474e | |||
| 05f555b5b5 | |||
| 85931b6dc2 | |||
| 9f0c7f6a76 | |||
| 022c06c803 | |||
| 1b72e7d6b7 | |||
| 666ac6df5b | |||
| 36481a53d9 | |||
| 5a9901d775 | |||
| b3a24d0158 | |||
| 8890826070 | |||
| daa84a1fef | |||
| a4bd47f001 | |||
| d031f1be01 | |||
| a48abc59ce | |||
| 878f05c323 | |||
| d462711d25 | |||
| 40a0120a28 | |||
| ac812eaeae | |||
| 9965223d9b | |||
| 08b99d0d3a | |||
| 519a6a2b1e | |||
| 524f5d470b | |||
| 6631c6a5d7 | |||
| 10f95fb0d9 | |||
| a315366026 | |||
| 1901c9a679 | |||
| 415ad5402f | |||
| 9a40e12dbc | |||
| a1af663796 | |||
| 78b7ddb32a | |||
| 5e5ee4fed1 | |||
| 84c022a39b | |||
| 300741b05a | |||
| dc685a01c6 | |||
| 752f897a34 | |||
| 722cb6b1fd | |||
| 50c095cd09 | |||
| c23546eb46 | |||
| 36340c4e52 | |||
| a7ab38f40c | |||
| 0901c03b74 | |||
| 50817352c1 | |||
| ee4a7447bc | |||
| a6d3c827ad | |||
| d4ea31b91f | |||
| 210faaec6d | |||
| 16be9b9dae | |||
| 2b8f709182 | |||
| aec22d8563 | |||
| 1996d042f0 | |||
| 27b6665717 | |||
| ce20045611 | |||
| 277f8bfd69 | |||
| 1da2db856f | |||
| 33dfe1389c | |||
| 013b69405a | |||
| ca07a53835 | |||
| bbdb6ae1f6 | |||
| 4a63222318 | |||
| 1a1c552964 | |||
| 3587dc2d75 | |||
| 96eb9a3ad0 | |||
| eaa70f43c0 | |||
| a426b773d3 | |||
| 84841edda9 | |||
| d416dbe47b | |||
| 7052da7e54 | |||
| 8f2a2f0ba6 | |||
| d575ba663d | |||
| 964fe7f335 | |||
| d3e92d6576 | |||
| 9dbd6069f1 | |||
| 7ae25c9a1b | |||
| 689969a005 | |||
| b270e1ac8d | |||
| 95d38cea44 | |||
| 3ed0765fe5 | |||
| 0c90164c24 | |||
| a45fa39afc | |||
| 8959f5e1c5 | |||
| df338ab00e | |||
| ac7a2452d6 | |||
| 80104e6d07 | |||
| 8f394cd01d | |||
| e5a32c83c5 | |||
| 8dce20e69f | |||
| 3428a06bb8 | |||
| 177f9a1ff6 | |||
| 9d93944dd1 | |||
| a4cba1a352 | |||
| 17b4232d80 | |||
| 2eb58eb719 | |||
| db5a4195ad | |||
| 3fb29f8e2b | |||
| dacdb2cf35 | |||
| c8473cbe03 | |||
| e9edf8a7ea | |||
| 5a73aa3d90 | |||
| 04101c1c3e | |||
| 0c9343f24d | |||
| b71710871c | |||
| f6df6db17b | |||
| 3f8b3bc6cb | |||
| 383ef27128 | |||
| d8189768ae | |||
| a5eb2fce75 | |||
| 1fe242a284 | |||
| a4b83ca9a0 | |||
| 2365b26c1c | |||
| 8fb044f71b | |||
| 5ce42475c4 | |||
| 57b9d31fff | |||
| 7671586cb0 | |||
| a1997e31a8 | |||
| f5478e9f64 | |||
| 06abea3576 | |||
| ae6b584a5f | |||
| 9e27c69906 | |||
| 00afe27900 | |||
| 4e5c1a32d3 | |||
| d4f5043a25 | |||
| 03a5a55974 | |||
| dbab4c1212 | |||
| d186a96796 | |||
| 6880d014c3 | |||
| 6542dec358 | |||
| 1a2738c3a9 | |||
| 12118ff125 | |||
| c3a00186ff | |||
| fafa777e98 | |||
| d4da99f61c | |||
| bb293c0c02 | |||
| 1e29971b3c | |||
| 25d70cca4f | |||
| 362832a196 | |||
| ed150a5ccd | |||
| d2247b66f1 | |||
| 3b58ea716c | |||
| 368e548e46 | |||
| 6f3612d196 | |||
| 0f38146fcc | |||
| 1a13f3f096 | |||
| 9cc102ca2a | |||
| 50ff4b89bf | |||
| 9b898825ab | |||
| 5be9033c40 | |||
| 67e55ab0a0 | |||
| 227549bf22 | |||
| 19707d10a3 | |||
| 91565ced89 | |||
| 2383b00c8c | |||
| 405063f036 | |||
| d2f3c6a879 | |||
| 4f759c1bd2 | |||
| 9d7f9ce7b3 | |||
| 56f3dfce92 | |||
| 9a66f18edb | |||
| d7270ffb84 | |||
| dd834a3104 | |||
| e28ed1b882 | |||
| 2370123c72 | |||
| 8a5133f04b | |||
| a0f874b319 | |||
| 415d11ae33 | |||
| f93b1ce30e | |||
| 9fb2e4ff1b | |||
| 601d0f4324 | |||
| cbf7db3347 | |||
| 217be1d234 | |||
| 7fabd6554d | |||
| d673819796 | |||
| a963a331a2 | |||
| eda5b8995f | |||
| d5e95eedf3 | |||
| 032e703704 | |||
| ad1444f5ba | |||
| a4b30b8620 | |||
| 9c002c7bff | |||
| 90495a27d9 | |||
| 1246fa699a | |||
| 511d37f5e0 | |||
| 7a03a0eaa9 | |||
| 2f57cb613e | |||
| e386c3078a | |||
| 3802889834 | |||
| f825b2baba | |||
| 6c92abd083 | |||
| c652379a5f | |||
| 61d34ab4ad | |||
| d511641410 | |||
| c8430625bf | |||
| a418224bbb | |||
| 9e3c13dea3 | |||
| 335850f7ff | |||
| f6baf8fe83 | |||
| 4c9b82b649 | |||
| f2570992e5 | |||
| 6911d6314d | |||
| eaeea9730c | |||
| fb0790a733 | |||
| 3230cd53e1 | |||
| edbce067b8 | |||
| 83877e5107 | |||
| 3a67540212 | |||
| 1a5db96023 | |||
| ef82f9ab5b | |||
| bf7e5c6333 | |||
| 443f0f5450 | |||
| cb1dccd630 | |||
| 2e558acbee | |||
| 74162ea54c | |||
| ccbe4fba04 | |||
| 5aeddb6166 | |||
| 49df5203ae | |||
| 0cfe801d18 | |||
| 89c01e8244 | |||
| 6605e4dd61 | |||
| d6239de6fd | |||
| 99ad6f3712 | |||
| f3041e7549 | |||
| 1269031be3 | |||
| ce96274f28 | |||
| a9a9bd0a3d | |||
| 33789adadc | |||
| 15b50a75c4 | |||
| ead34dbb1f | |||
| a9b1356efa | |||
| 33e105bc7b | |||
| e5041147f4 | |||
| 576e627ad1 | |||
| 4059664354 | |||
| 974c0ca7e8 | |||
| 8e7a7b8b6d | |||
| 1e3b1db905 | |||
| 51c98746c4 | |||
| 4c21439847 | |||
| 31385ee533 | |||
| bd4e34e0e1 | |||
| 9f591b166b |
+14
-10
@@ -9,15 +9,13 @@
|
||||
package engine;
|
||||
|
||||
import ch.claude_martin.enumbitset.EnumBitSetHelper;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.ConfigManager;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector2f;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.ItemBase;
|
||||
import engine.objects.Shrine;
|
||||
import engine.objects.Zone;
|
||||
import engine.objects.*;
|
||||
import engine.powers.EffectsBase;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
@@ -211,8 +209,7 @@ public class Enum {
|
||||
STANDARD(6.1900001f, 13.97f, 4.2199998f, 13.97f, 6.3299999f, 18.379999f, 6.5f),
|
||||
CENTAUR(6.1900001f, 16.940001f, 5.5500002f, 16.940001f, 6.3299999f, 18.379999f, 6.5f),
|
||||
MINOTAUR(6.6300001f, 15.95f, 4.2199998f, 15.95f, 6.3299999f, 18.379999f, 6.5f),
|
||||
IREKEI(6.35f, 15.25f, 4.2199998f, 14.5f, 6.3299999f, 18.379999f, 6.5f);
|
||||
|
||||
IREKEI(6.499500105f, 14.6685f, 4.2199998f, 14.6685f, 6.3299999f, 18.379999f, 6.5f);
|
||||
private float walkStandard;
|
||||
private float walkCombat;
|
||||
private float runStandard;
|
||||
@@ -472,11 +469,14 @@ public class Enum {
|
||||
|
||||
// 14001 does not have a banestone to bind at
|
||||
|
||||
if (ruinZone.getLoadNum() == 14001)
|
||||
if (ruinZone.getLoadNum() == 14001) {
|
||||
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc(), 30);
|
||||
else
|
||||
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc()
|
||||
.add(new Vector3fImmutable(-196.016f, 2.812f, 203.621f)), 30);
|
||||
}else {
|
||||
//spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc()
|
||||
//.add(new Vector3fImmutable(-196.016f, 2.812f, 203.621f)), 30);
|
||||
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(BuildingManager.getBuilding(27977).loc,30f);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -779,6 +779,7 @@ public class Enum {
|
||||
Combat,
|
||||
Spires,
|
||||
Snare,
|
||||
Snared,
|
||||
Stun,
|
||||
Blind,
|
||||
Root,
|
||||
@@ -881,6 +882,7 @@ public class Enum {
|
||||
Siege,
|
||||
Slash,
|
||||
Snare,
|
||||
Snared,
|
||||
Sorcery,
|
||||
Spear,
|
||||
SpearMastery,
|
||||
@@ -1030,6 +1032,7 @@ public class Enum {
|
||||
Silence,
|
||||
Slash,
|
||||
Snare,
|
||||
Snared,
|
||||
Stance,
|
||||
Stun,
|
||||
Summon,
|
||||
@@ -1154,6 +1157,7 @@ public class Enum {
|
||||
SkillDebuff,
|
||||
SlashResistanceDebuff,
|
||||
Snare,
|
||||
Snared,
|
||||
StackableAttrCONBuff,
|
||||
StackableAttrDEXBuff,
|
||||
StackableAttrSTRBuff,
|
||||
|
||||
@@ -19,10 +19,7 @@ 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;
|
||||
import engine.net.client.msg.MoveToPointMsg;
|
||||
import engine.net.client.msg.UnloadObjectsMsg;
|
||||
import engine.net.client.msg.*;
|
||||
import engine.objects.*;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.pmw.tinylog.Logger;
|
||||
@@ -525,9 +522,6 @@ public enum InterestManager implements Runnable {
|
||||
player.setDirtyLoad(true);
|
||||
updateStaticList(player, origin);
|
||||
updateMobileList(player, origin);
|
||||
if(player.level < 10)
|
||||
player.setLevel((short) 10);
|
||||
|
||||
}
|
||||
|
||||
public synchronized void HandleLoadForTeleport(PlayerCharacter playerCharacter) {
|
||||
|
||||
@@ -10,17 +10,13 @@
|
||||
package engine.db.handlers;
|
||||
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.objects.Bane;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.City;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.*;
|
||||
import org.joda.time.DateTime;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.*;
|
||||
|
||||
public class dbBaneHandler extends dbHandlerBase {
|
||||
|
||||
@@ -89,6 +85,139 @@ public class dbBaneHandler extends dbHandlerBase {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean SET_BANE_TIME_NEW(int hour, int cityUUID) {
|
||||
hour += 12; // Adjust hour
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement getStatement = connection.prepareStatement("SELECT `placementDate`, `liveDate` FROM `dyn_banes` WHERE `cityUUID`=?");
|
||||
PreparedStatement updateStatement = connection.prepareStatement("UPDATE `dyn_banes` SET `liveDate`=?, `time_set`=? WHERE `cityUUID`=?")) {
|
||||
|
||||
// Retrieve placementDate and liveDate
|
||||
getStatement.setInt(1, cityUUID);
|
||||
try (ResultSet rs = getStatement.executeQuery()) {
|
||||
if (rs.next()) {
|
||||
DateTime placementDate = new DateTime(rs.getTimestamp("placementDate").getTime());
|
||||
Timestamp liveDateTimestamp = rs.getTimestamp("liveDate");
|
||||
|
||||
// Explicitly check if liveDate is null
|
||||
DateTime toSet;
|
||||
if (liveDateTimestamp == null) {
|
||||
// If liveDate is null, default to placementDate
|
||||
toSet = placementDate;
|
||||
} else {
|
||||
// If liveDate is not null, use it
|
||||
DateTime liveDate = new DateTime(liveDateTimestamp.getTime());
|
||||
toSet = liveDate;
|
||||
}
|
||||
|
||||
// Adjust the time
|
||||
toSet = toSet.withHourOfDay(hour).withMinuteOfHour(0).withSecondOfMinute(0).withMillisOfSecond(0);
|
||||
|
||||
// Update liveDate and time_set flag
|
||||
updateStatement.setTimestamp(1, new java.sql.Timestamp(toSet.getMillis()));
|
||||
updateStatement.setInt(2, 1); // time_set flag
|
||||
updateStatement.setInt(3, cityUUID);
|
||||
|
||||
updateStatement.execute();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean SET_BANE_DAY_NEW(int dayOffset, int cityUUID) {
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement getStatement = connection.prepareStatement("SELECT `placementDate`, `liveDate` FROM `dyn_banes` WHERE `cityUUID`=?");
|
||||
PreparedStatement updateStatement = connection.prepareStatement("UPDATE `dyn_banes` SET `liveDate`=?, `day_set`=? WHERE `cityUUID`=?")) {
|
||||
|
||||
// Retrieve placementDate and liveDate
|
||||
getStatement.setInt(1, cityUUID);
|
||||
try (ResultSet rs = getStatement.executeQuery()) {
|
||||
if (rs.next()) {
|
||||
DateTime placementDate = new DateTime(rs.getTimestamp("placementDate").getTime());
|
||||
Timestamp liveDateTimestamp = rs.getTimestamp("liveDate");
|
||||
|
||||
// Explicitly check if liveDate is null
|
||||
DateTime liveDate;
|
||||
if (liveDateTimestamp == null) {
|
||||
// If liveDate is null, default to placementDate
|
||||
liveDate = placementDate;
|
||||
} else {
|
||||
// If liveDate is not null, use it
|
||||
liveDate = new DateTime(liveDateTimestamp.getTime());
|
||||
}
|
||||
|
||||
// Calculate the new liveDate while preserving the time component
|
||||
DateTime updatedDate = placementDate.plusDays(dayOffset)
|
||||
.withHourOfDay(liveDate.getHourOfDay())
|
||||
.withMinuteOfHour(liveDate.getMinuteOfHour())
|
||||
.withSecondOfMinute(liveDate.getSecondOfMinute())
|
||||
.withMillisOfSecond(liveDate.getMillisOfSecond());
|
||||
|
||||
// Update liveDate and day_set flag
|
||||
updateStatement.setTimestamp(1, new java.sql.Timestamp(updatedDate.getMillis()));
|
||||
updateStatement.setInt(2, 1); // day_set flag
|
||||
updateStatement.setInt(3, cityUUID);
|
||||
|
||||
updateStatement.execute();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public boolean SET_BANE_CAP_NEW(int count, int cityUUID) {
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `dyn_banes` SET `cap_size`=? WHERE `cityUUID`=?")) {
|
||||
|
||||
preparedStatement.setInt(1, count);
|
||||
preparedStatement.setLong(2, cityUUID);
|
||||
|
||||
preparedStatement.execute();
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
return false;
|
||||
}
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `dyn_banes` SET `cap_set`=? WHERE `cityUUID`=?")) {
|
||||
|
||||
preparedStatement.setInt(1, 1);
|
||||
preparedStatement.setLong(2, cityUUID);
|
||||
|
||||
preparedStatement.execute();
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
return false;
|
||||
}
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `dyn_banes` SET `cap_size`=? WHERE `cityUUID`=?")) {
|
||||
|
||||
preparedStatement.setInt(1, count);
|
||||
preparedStatement.setLong(2, cityUUID);
|
||||
|
||||
preparedStatement.execute();
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean REMOVE_BANE(Bane bane) {
|
||||
|
||||
if (bane == null)
|
||||
@@ -107,4 +236,25 @@ public class dbBaneHandler extends dbHandlerBase {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public DateTime getLiveDate(int cityUUID) {
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement statement = connection.prepareStatement("SELECT `liveDate` FROM `dyn_banes` WHERE `cityUUID`=?")) {
|
||||
|
||||
statement.setInt(1, cityUUID);
|
||||
|
||||
try (ResultSet rs = statement.executeQuery()) {
|
||||
if (rs.next()) {
|
||||
Timestamp liveDateTimestamp = rs.getTimestamp("liveDate");
|
||||
if (liveDateTimestamp != null) {
|
||||
return new DateTime(liveDateTimestamp.getTime());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
return null; // Return null if liveDate is not found or an error occurs
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,10 +11,7 @@ package engine.db.handlers;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.City;
|
||||
import engine.objects.Zone;
|
||||
import engine.objects.*;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.*;
|
||||
@@ -98,19 +95,9 @@ public class dbCityHandler extends dbHandlerBase {
|
||||
public Integer GET_CAPITAL_CITY_COUNT() {
|
||||
|
||||
int cityCount = 0;
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM obj_city;")) {
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
while(rs.next()){
|
||||
if(rs.getInt("isNpc") == 0)
|
||||
if(DbManager.BuildingQueries.GET_BUILDINGBYUUID(rs.getInt("treeOfLifeUUID")).getRank() == 8)
|
||||
cityCount++;
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
for(Realm realm : Realm._realms.values()){
|
||||
if(realm.isRuled())
|
||||
cityCount ++;
|
||||
}
|
||||
|
||||
return cityCount;
|
||||
|
||||
@@ -98,32 +98,54 @@ public class dbContractHandler extends dbHandlerBase {
|
||||
|
||||
public void LOAD_SELL_LIST_FOR_CONTRACT(final Contract contract) {
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_contract_selltype` WHERE `contractID` = ?;")) {
|
||||
if(!contract.getName().contains("Sage")) {
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_contract_selltype` WHERE `contractID` = ?;")) {
|
||||
|
||||
preparedStatement.setInt(1, contract.getObjectUUID());
|
||||
preparedStatement.setInt(1, contract.getObjectUUID());
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
while (rs.next()) {
|
||||
|
||||
int type = rs.getInt("type");
|
||||
int value = rs.getInt("value");
|
||||
int type = rs.getInt("type");
|
||||
int value = rs.getInt("value");
|
||||
|
||||
switch (type) {
|
||||
case 1:
|
||||
contract.getBuyItemType().add(value);
|
||||
break;
|
||||
case 2:
|
||||
contract.getBuySkillToken().add(value);
|
||||
break;
|
||||
case 3:
|
||||
contract.getBuyUnknownToken().add(value);
|
||||
break;
|
||||
switch (type) {
|
||||
case 1:
|
||||
contract.getBuyItemType().add(value);
|
||||
break;
|
||||
case 2:
|
||||
contract.getBuySkillToken().add(value);
|
||||
break;
|
||||
case 3:
|
||||
contract.getBuyUnknownToken().add(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
}else{
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_contract_selltype`;")) {
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
int value = rs.getInt("value");
|
||||
if(!contract.getBuySkillToken().contains(value))
|
||||
contract.getBuySkillToken().add(value);
|
||||
|
||||
if(!contract.getBuyItemType().contains(value))
|
||||
contract.getBuyItemType().add(value);
|
||||
|
||||
if(!contract.getBuyUnknownToken().contains(value))
|
||||
contract.getBuyUnknownToken().add(value);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,6 +56,13 @@ public abstract class dbHandlerBase {
|
||||
while (rs.next()) {
|
||||
|
||||
int id = rs.getInt(1);
|
||||
try {
|
||||
if (rs.getInt("capSize") == 0) {
|
||||
continue;
|
||||
}
|
||||
}catch(Exception e){
|
||||
//not a mine
|
||||
}
|
||||
|
||||
if (DbManager.inCache(localObjectType, id)) {
|
||||
objectList.add((T) DbManager.getFromCache(localObjectType, id));
|
||||
|
||||
@@ -134,9 +134,13 @@ public class dbItemHandler extends dbHandlerBase {
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
if (rs.next())
|
||||
worked = rs.getBoolean("result");
|
||||
|
||||
if (rs.next()) {
|
||||
try {
|
||||
worked = rs.getBoolean("result");
|
||||
}catch(Exception e){
|
||||
worked = false;
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
|
||||
@@ -131,6 +131,32 @@ public class dbNPCHandler extends dbHandlerBase {
|
||||
return npc;
|
||||
}
|
||||
|
||||
public int BANE_COMMANDER_EXISTS(final int objectUUID) {
|
||||
|
||||
int uid = 0;
|
||||
|
||||
String query = "SELECT `UID` FROM `obj_npc` WHERE `npc_buildingID` = ? LIMIT 1;";
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement(query)) {
|
||||
|
||||
preparedStatement.setInt(1, objectUUID);
|
||||
|
||||
try (ResultSet rs = preparedStatement.executeQuery()) {
|
||||
if (rs.next()) {
|
||||
// Retrieve the UID column value
|
||||
uid = rs.getInt("UID");
|
||||
}
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
|
||||
return uid;
|
||||
}
|
||||
|
||||
|
||||
public int MOVE_NPC(long npcID, long parentID, float locX, float locY, float locZ) {
|
||||
|
||||
int rowCount;
|
||||
@@ -176,6 +202,18 @@ public class dbNPCHandler extends dbHandlerBase {
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void updateSpecialPricing(final NPC npc){
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE obj_npc SET specialPrice=? WHERE UID = ?")) {
|
||||
preparedStatement.setInt(1, npc.getSpecialPrice());
|
||||
preparedStatement.setInt(2, npc.getDBID());
|
||||
|
||||
preparedStatement.executeUpdate();
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
}
|
||||
public void updateDatabase(final NPC npc) {
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.ItemContainerType;
|
||||
import engine.Enum.ItemType;
|
||||
import engine.Enum.OwnerType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.objects.*;
|
||||
import engine.powers.EffectsBase;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author Eighty
|
||||
*/
|
||||
public class GimmeCmd extends AbstractDevCmd {
|
||||
|
||||
public GimmeCmd() {
|
||||
super("gimme");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||
AbstractGameObject target) {
|
||||
int amt = 0;
|
||||
int currentGold = pc.getCharItemManager().getGoldInventory().getNumOfItems();
|
||||
amt = 10000000 - currentGold;
|
||||
if (!pc.getCharItemManager().addGoldToInventory(amt, true)) {
|
||||
throwbackError(pc, "Failed to add gold to inventory");
|
||||
return;
|
||||
}
|
||||
|
||||
ChatManager.chatSayInfo(pc, amt + " gold added to inventory");
|
||||
|
||||
if(pc.level < 75) {
|
||||
pc.setLevel((short) 75);
|
||||
ChatManager.chatSayInfo(pc, "Level set to 75");
|
||||
}
|
||||
pc.getCharItemManager().updateInventory();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Round up current gold in inventory to 10,000,000";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "'./gimme";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.*;
|
||||
import engine.server.MBServerStatics;
|
||||
import engine.util.StringUtils;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
@@ -530,6 +531,13 @@ public class InfoCmd extends AbstractDevCmd {
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case Corpse:
|
||||
Corpse corpse = (Corpse)target;
|
||||
Long timeLeft = MBServerStatics.CORPSE_CLEANUP_TIMER_MS - (System.currentTimeMillis() - corpse.spawnedTime);
|
||||
output += "Despawn in: " + timeLeft;
|
||||
output += newline;
|
||||
break;
|
||||
}
|
||||
|
||||
throwbackInfo(pc, output);
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.objects.*;
|
||||
|
||||
@@ -72,6 +73,10 @@ public class PrintStatsCmd extends AbstractDevCmd {
|
||||
out += "Main Hand: atr: " + tar.getAtrHandOne() + ", damage: " + tar.getMinDamageHandOne() + " to " + tar.getMaxDamageHandOne() + ", speed: " + tar.getSpeedHandOne() + newline;
|
||||
out += "Off Hand: atr: " + tar.getAtrHandTwo() + ", damage: " + tar.getMinDamageHandTwo() + " to " + tar.getMaxDamageHandTwo() + ", speed: " + tar.getSpeedHandTwo() + newline;
|
||||
out += "isAlive: " + tar.isAlive() + ", Combat: " + tar.isCombat() + newline;
|
||||
out += "Move Speed: " + tar.getSpeed() + newline;
|
||||
out += "Health Regen: " + tar.getRegenModifier(Enum.ModType.HealthRecoverRate) + newline;
|
||||
out += "Mana Regen: " + tar.getRegenModifier(Enum.ModType.ManaRecoverRate) + newline;
|
||||
out += "Stamina Regen: " + tar.getRegenModifier(Enum.ModType.StaminaRecoverRate) + newline;
|
||||
throwbackInfo(pc, out);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public class SetLevelCmd extends AbstractDevCmd {
|
||||
this.sendUsage(pc);
|
||||
return;
|
||||
}
|
||||
if (level < 1 || level > 75) {
|
||||
if (level < 1 || level > 80) {
|
||||
this.sendHelp(pc);
|
||||
return;
|
||||
}
|
||||
@@ -62,7 +62,7 @@ public class SetLevelCmd extends AbstractDevCmd {
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Sets your character's level to 'amount'. 'amount' must be between 1-75";
|
||||
return "Sets your character's level to 'amount'. 'amount' must be between 1-80";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,6 +27,14 @@ public class SimulateBootyCmd extends AbstractDevCmd {
|
||||
|
||||
String output;
|
||||
|
||||
try
|
||||
{
|
||||
simCount = Integer.parseInt(words[0]);
|
||||
}catch(Exception e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
output = "Booty Simulation: Rolls:" + simCount + newline;
|
||||
|
||||
Mob mob = (Mob) target;
|
||||
@@ -46,6 +54,7 @@ public class SimulateBootyCmd extends AbstractDevCmd {
|
||||
ArrayList<Item> Resources = new ArrayList<Item>();
|
||||
ArrayList<Item> Runes = new ArrayList<Item>();
|
||||
ArrayList<Item> Contracts = new ArrayList<Item>();
|
||||
ArrayList<Item> GuardContracts = new ArrayList<Item>();
|
||||
ArrayList<Item> Offerings = new ArrayList<Item>();
|
||||
ArrayList<Item> OtherDrops = new ArrayList<Item>();
|
||||
ArrayList<Item> EquipmentDrops = new ArrayList<Item>();
|
||||
@@ -60,7 +69,10 @@ public class SimulateBootyCmd extends AbstractDevCmd {
|
||||
for (Item lootItem : mob.getCharItemManager().getInventory()) {
|
||||
switch (lootItem.getItemBase().getType()) {
|
||||
case CONTRACT: //CONTRACT
|
||||
Contracts.add(lootItem);
|
||||
if(lootItem.getName().contains("Captain"))
|
||||
GuardContracts.add(lootItem);
|
||||
else
|
||||
Contracts.add(lootItem);
|
||||
break;
|
||||
case OFFERING: //OFFERING
|
||||
Offerings.add(lootItem);
|
||||
@@ -132,9 +144,17 @@ public class SimulateBootyCmd extends AbstractDevCmd {
|
||||
}
|
||||
}
|
||||
|
||||
int baseBound = 100000;
|
||||
int levelPenalty = (int) (Math.max(0, Math.abs(50 - mob.level)) * 0.01 * 100000);
|
||||
int totalRange = baseBound + levelPenalty;
|
||||
if(mob.level >= 50){
|
||||
totalRange = baseBound;
|
||||
}
|
||||
output += "TOTAL ROLL POTENTIAL: " + totalRange + newline;
|
||||
output += "GLASS DROPS: " + GlassItems.size() + newline;
|
||||
output += "RUNE DROPS: " + Runes.size() + newline;
|
||||
output += "CONTRACTS DROPS: " + Contracts.size() + newline;
|
||||
output += "GUARD CONTRACTS DROPS: " + GuardContracts.size() + newline;
|
||||
output += "RESOURCE DROPS: " + Resources.size() + newline;
|
||||
output += "OFFERINGS DROPPED: " + Offerings.size() + newline;
|
||||
output += "ENCHANTED ITEMS DROPPED: " + OtherDrops.size() + newline;
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
package engine.gameManager;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.math.Vector3f;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.*;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
public class ArenaManager {
|
||||
private static final List<Arena> activeArenas = new ArrayList<>();
|
||||
public static final List<PlayerCharacter> playerQueue = new ArrayList<>();
|
||||
public static Long pulseDelay = 180000L;
|
||||
public static Long lastExecution = 0L;
|
||||
|
||||
public static void pulseArenas() {
|
||||
if(lastExecution == 0L){
|
||||
lastExecution = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
if(activeArenas.isEmpty() && playerQueue.isEmpty())
|
||||
return;
|
||||
|
||||
Iterator<Arena> iterator = activeArenas.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
Arena arena = iterator.next();
|
||||
if (arena.checkToComplete()) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
if(lastExecution + pulseDelay > System.currentTimeMillis())
|
||||
return;
|
||||
|
||||
lastExecution = System.currentTimeMillis();
|
||||
|
||||
while (playerQueue.size() > 1) {
|
||||
createArena();
|
||||
}
|
||||
}
|
||||
|
||||
public static void joinQueue(PlayerCharacter player) {
|
||||
if (!playerQueue.contains(player)) {
|
||||
playerQueue.add(player);
|
||||
}
|
||||
for(PlayerCharacter pc : playerQueue){
|
||||
if(pc.equals(player))
|
||||
continue;
|
||||
ChatManager.chatSystemInfo(pc, player.getName() + " has joined the arena que. There are now " + playerQueue.size() + " players queued.");
|
||||
}
|
||||
}
|
||||
|
||||
public static void leaveQueue(PlayerCharacter player) {
|
||||
playerQueue.remove(player);
|
||||
for(PlayerCharacter pc : playerQueue){
|
||||
if(pc.equals(player))
|
||||
continue;
|
||||
ChatManager.chatSystemInfo(pc, player.getName() + " has left the arena que. There are now " + playerQueue.size() + " players queued.");
|
||||
}
|
||||
}
|
||||
|
||||
private static void createArena() {
|
||||
if (playerQueue.size() > 1) {
|
||||
|
||||
Collections.shuffle(playerQueue);
|
||||
Arena newArena = new Arena();
|
||||
|
||||
//set starting time
|
||||
newArena.startTime = System.currentTimeMillis();
|
||||
|
||||
//decide an arena location
|
||||
newArena.loc = selectRandomArenaLocation();
|
||||
|
||||
// Assign players to the arena
|
||||
newArena.player1 = playerQueue.remove(0);
|
||||
newArena.player2 = playerQueue.remove(0);
|
||||
|
||||
// Teleport players to the arena location
|
||||
Zone sdr = ZoneManager.getZoneByUUID(656);
|
||||
MovementManager.translocate(newArena.player1, Vector3fImmutable.getRandomPointOnCircle(newArena.loc,75f), null);
|
||||
MovementManager.translocate(newArena.player2, Vector3fImmutable.getRandomPointOnCircle(newArena.loc,75f), null);
|
||||
|
||||
// Add the new arena to the active arenas list
|
||||
activeArenas.add(newArena);
|
||||
}
|
||||
}
|
||||
|
||||
public static void endArena(Arena arena, PlayerCharacter winner, PlayerCharacter loser, String condition){
|
||||
if (winner != null && loser != null) {
|
||||
Logger.info("[ARENA] The fight between {} and {} is concluded. Victor: {}",
|
||||
arena.player1.getName(), arena.player2.getName(), winner.getName());
|
||||
} else {
|
||||
Logger.info("[ARENA] The fight between {} and {} is concluded. No Winner Declared.",
|
||||
arena.player1.getName(), arena.player2.getName());
|
||||
}
|
||||
// Teleport players to the arena location
|
||||
Zone sdr = ZoneManager.getZoneByUUID(656);
|
||||
MovementManager.translocate(arena.player1, Vector3fImmutable.getRandomPointOnCircle(sdr.getLoc(),50f), null);
|
||||
MovementManager.translocate(arena.player2, Vector3fImmutable.getRandomPointOnCircle(sdr.getLoc(),50f), null);
|
||||
|
||||
|
||||
|
||||
activeArenas.remove(arena);
|
||||
|
||||
if(winner != null){
|
||||
ChatManager.chatPVP("[ARENA] " + winner.getName() + " has slain " + loser.getName() + " in the arena!");
|
||||
//handle prize distribution
|
||||
//ItemBase specialLoot = ItemBase.getItemBase(866);
|
||||
//Item promoted = new MobLoot(winner, specialLoot, 1, false).promoteToItem(winner);
|
||||
//promoted.setNumOfItems(21235);
|
||||
//promoted.setName("Special Banker(21235)");
|
||||
//DbManager.ItemQueries.UPDATE_NUM_ITEMS(promoted,21235);
|
||||
//winner.getCharItemManager().addItemToInventory(promoted);
|
||||
//winner.getCharItemManager().updateInventory();
|
||||
}
|
||||
}
|
||||
|
||||
public static Vector3fImmutable selectRandomArenaLocation() {
|
||||
boolean locSet = false;
|
||||
Vector3fImmutable loc = Vector3fImmutable.ZERO;
|
||||
|
||||
while (!locSet) {
|
||||
try {
|
||||
float x = ThreadLocalRandom.current().nextInt(114300, 123600);
|
||||
float z = ThreadLocalRandom.current().nextInt(82675, 91700);
|
||||
float y = 0; // Y coordinate is always 0
|
||||
|
||||
loc = new Vector3fImmutable(x, y, z * -1);
|
||||
HashSet<AbstractWorldObject> inRange = WorldGrid.getObjectsInRangePartial(loc,500f, MBServerStatics.MASK_PLAYER);
|
||||
if(inRange.isEmpty() && !isUnderWater(loc))
|
||||
locSet = true;
|
||||
//}
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return loc;
|
||||
}
|
||||
|
||||
public static boolean isUnderWater(Vector3fImmutable loc) {
|
||||
|
||||
try {
|
||||
|
||||
Zone zone = ZoneManager.findSmallestZone(loc);
|
||||
|
||||
if (zone.getSeaLevel() != 0) {
|
||||
|
||||
float localAltitude = loc.y;
|
||||
if (localAltitude < zone.getSeaLevel())
|
||||
return true;
|
||||
} else {
|
||||
if (loc.y < 0)
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -438,6 +438,18 @@ public enum BuildingManager {
|
||||
|
||||
public static boolean IsPlayerHostile(Building building, PlayerCharacter player) {
|
||||
|
||||
if(building.getBlueprint() != null && building.getBlueprint().getBuildingGroup() != null && building.getBlueprint().getBuildingGroup().equals(BuildingGroup.BANESTONE))
|
||||
{
|
||||
Guild playerNation = player.guild.getNation();
|
||||
City banedCity = ZoneManager.getCityAtLocation(building.loc);
|
||||
if(banedCity != null){
|
||||
if(banedCity.getGuild().getNation().equals(playerNation)){
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
//Nation Members and Guild members are not hostile.
|
||||
// if (building.getGuild() != null){
|
||||
// if (pc.getGuild() != null)
|
||||
|
||||
@@ -646,24 +646,25 @@ public enum CombatManager {
|
||||
|
||||
//Get hit chance
|
||||
|
||||
int chance;
|
||||
//int chance;
|
||||
float dif = atr - defense;
|
||||
|
||||
if (dif > 100)
|
||||
chance = 94;
|
||||
else if (dif < -100)
|
||||
chance = 4;
|
||||
else
|
||||
chance = (int) ((0.45 * dif) + 49);
|
||||
//if (dif > 100)
|
||||
// chance = 94;
|
||||
//else if (dif < -100)
|
||||
// chance = 4;
|
||||
//else
|
||||
// chance = (int) ((0.45 * dif) + 49);
|
||||
|
||||
errorTrack = 5;
|
||||
|
||||
//calculate hit/miss
|
||||
|
||||
int roll = ThreadLocalRandom.current().nextInt(100);
|
||||
DeferredPowerJob dpj = null;
|
||||
|
||||
if (roll < chance) {
|
||||
|
||||
|
||||
if (LandHit((int)atr,(int)defense)) {
|
||||
|
||||
if (ac.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||
updateAttackTimers((PlayerCharacter) ac, target, true);
|
||||
@@ -1241,14 +1242,17 @@ public enum CombatManager {
|
||||
DispatchMessage.dispatchMsgToInterestArea(pc, rwss, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
||||
}
|
||||
|
||||
private static void toggleSit(boolean toggle, ClientConnection origin) {
|
||||
public static void toggleSit(boolean toggle, ClientConnection origin) {
|
||||
|
||||
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
|
||||
|
||||
if (pc == null)
|
||||
return;
|
||||
|
||||
pc.setSit(toggle);
|
||||
if(pc.isFlying())
|
||||
pc.setSit(false);
|
||||
else
|
||||
pc.setSit(toggle);
|
||||
|
||||
UpdateStateMsg rwss = new UpdateStateMsg();
|
||||
rwss.setPlayer(pc);
|
||||
@@ -1326,6 +1330,13 @@ public enum CombatManager {
|
||||
return;
|
||||
|
||||
retaliater.setCombatTarget(ac);
|
||||
if(retaliater.isPlayerGuard && (retaliater.BehaviourType.equals(MobBehaviourType.GuardMinion) || retaliater.BehaviourType.equals(MobBehaviourType.GuardCaptain))){
|
||||
for(Mob guard : retaliater.guardedCity.getParent().zoneMobSet){
|
||||
if(guard.isPlayerGuard && guard.combatTarget == null){
|
||||
guard.setCombatTarget(ac);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1442,4 +1453,17 @@ public enum CombatManager {
|
||||
((AbstractCharacter) awo).getCharItemManager().damageRandomArmor(1);
|
||||
}
|
||||
|
||||
public static boolean LandHit(int C5, int D5){
|
||||
|
||||
float chance = (C5-((C5+D5)*.315f)) / ((D5-((C5+D5)*.315f)) + (C5-((C5+D5)*.315f)));
|
||||
int convertedChance = Math.round(chance * 100);
|
||||
//convertedChance = Math.max(5, Math.min(95, convertedChance));
|
||||
|
||||
int roll = ThreadLocalRandom.current().nextInt(101);
|
||||
|
||||
if(roll < 5)//always 5% chance ot miss
|
||||
return false;
|
||||
|
||||
return roll <= convertedChance;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,6 +65,7 @@ public enum ConfigManager {
|
||||
MB_WORLD_MAINTENANCE,
|
||||
MB_WORLD_GREETING,
|
||||
MB_WORLD_KEYCLONE_MAX,
|
||||
MB_WORLD_TESTMODE,
|
||||
MB_USE_RUINS,
|
||||
|
||||
// Mobile AI modifiers
|
||||
|
||||
@@ -102,6 +102,7 @@ public enum DevCmdManager {
|
||||
DevCmdManager.registerDevCmd(new SetAdminRuneCmd());
|
||||
DevCmdManager.registerDevCmd(new SetInvulCmd());
|
||||
DevCmdManager.registerDevCmd(new MakeItemCmd());
|
||||
DevCmdManager.registerDevCmd(new GimmeCmd());
|
||||
DevCmdManager.registerDevCmd(new EnchantCmd());
|
||||
DevCmdManager.registerDevCmd(new SetSubRaceCmd());
|
||||
// Admin
|
||||
@@ -179,14 +180,20 @@ public enum DevCmdManager {
|
||||
//kill any commands not available to everyone on production server
|
||||
//only admin level can run dev commands on production
|
||||
boolean playerAllowed = false;
|
||||
switch(adc.getMainCmdString()){
|
||||
case "printresists":
|
||||
case "printstats":
|
||||
case "printskills":
|
||||
case "printpowers":
|
||||
if(!a.status.equals(Enum.AccountStatus.ADMIN))
|
||||
target = pcSender;
|
||||
break;
|
||||
if(ConfigManager.MB_WORLD_TESTMODE.getValue().equals("true")) {
|
||||
switch (adc.getMainCmdString()) {
|
||||
case "printresists":
|
||||
case "printstats":
|
||||
case "printskills":
|
||||
case "printpowers":
|
||||
case "gimme":
|
||||
case "goto":
|
||||
case "teleportmode":
|
||||
playerAllowed = true;
|
||||
if (!a.status.equals(Enum.AccountStatus.ADMIN))
|
||||
target = pcSender;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!playerAllowed && !a.status.equals(Enum.AccountStatus.ADMIN)) {
|
||||
Logger.info("Account " + a.getUname() + "attempted to use dev command " + cmd);
|
||||
|
||||
@@ -40,6 +40,7 @@ public enum LootManager {
|
||||
public static final ArrayList<Integer> vorg_ma_uuids = new ArrayList<>(Arrays.asList(27570,188900,188910,188920,188930,188940,188950,189500));
|
||||
public static final ArrayList<Integer> vorg_la_uuids = new ArrayList<>(Arrays.asList(27550,27560,189100,189110,189120,189130,189140,189150));
|
||||
public static final ArrayList<Integer> vorg_cloth_uuids = new ArrayList<>(Arrays.asList(27600,188700,188720,189550,189560));
|
||||
public static final ArrayList<Integer> racial_guard_uuids = new ArrayList<>(Arrays.asList(841,951,952,1050,1052,1180,1182,1250,1252,1350,1352,1450,1452,1500,1502,1525,1527,1550,1552,1575,1577,1600,1602,1650,1652,1700,980100,980102));
|
||||
|
||||
// Drop Rates
|
||||
|
||||
@@ -74,67 +75,41 @@ public enum LootManager {
|
||||
}
|
||||
|
||||
public static void GenerateMobLoot(Mob mob) {
|
||||
|
||||
//no loot for safezones
|
||||
if(mob == null || mob.getSafeZone()){
|
||||
return;
|
||||
}
|
||||
|
||||
//determine if mob is in hotzone
|
||||
boolean inHotzone = false;
|
||||
|
||||
//special blood rune droppers
|
||||
MobLoot specialDrop = null;
|
||||
switch(mob.getObjectUUID()) {
|
||||
case 22595://elf 1
|
||||
specialDrop = new MobLoot(mob,ItemBase.getItemBase(252134),true);
|
||||
mob.setFirstName("Melandrach The Blood-Mage");
|
||||
break;
|
||||
case 22432: //elf 2
|
||||
specialDrop = new MobLoot(mob,ItemBase.getItemBase(252135),true);
|
||||
mob.setFirstName("Kyrtaar The Blood-Mage");
|
||||
break;
|
||||
case 22537: //elf 3
|
||||
specialDrop = new MobLoot(mob,ItemBase.getItemBase(252136),true);
|
||||
mob.setFirstName("Vamir The Blood-Mage");
|
||||
break;
|
||||
case 16387: //human 4 DONE
|
||||
specialDrop = new MobLoot(mob,ItemBase.getItemBase(252129),true);
|
||||
mob.setFirstName("Alatar The Blood-Mage");
|
||||
break;
|
||||
case 32724:// human 5 GOOD
|
||||
specialDrop = new MobLoot(mob,ItemBase.getItemBase(252130),true);
|
||||
mob.setFirstName("Elphaba The Blood-Mage");
|
||||
break;
|
||||
case 23379: //human 1 GOOD
|
||||
specialDrop = new MobLoot(mob,ItemBase.getItemBase(252131),true);
|
||||
mob.setFirstName("Bavmorda The Blood-Mage");
|
||||
break;
|
||||
case 10826: //human 2 REDO
|
||||
specialDrop = new MobLoot(mob,ItemBase.getItemBase(252132),true);
|
||||
mob.setFirstName("Draco The Blood-Mage");
|
||||
break;
|
||||
case 15929: //human 3 GOOD
|
||||
specialDrop = new MobLoot(mob,ItemBase.getItemBase(252133),true);
|
||||
mob.setFirstName("Atlantes The Blood-Mage");
|
||||
break;
|
||||
}
|
||||
if(specialDrop != null) {
|
||||
mob.setLevel((short) 65);
|
||||
mob.setSpawnTime(10800);
|
||||
mob.healthMax = (7500);
|
||||
mob.setHealth(7500);
|
||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().getName() + " has found the " + specialDrop.getName() + ". Are you tough enough to take it?");
|
||||
chatMsg.setMessageType(10);
|
||||
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
||||
DispatchMessage.dispatchMsgToAll(chatMsg);
|
||||
mob.getCharItemManager().addItemToInventory(specialDrop);
|
||||
mob.setResists(new Resists("Dropper"));
|
||||
if(!Mob.discDroppers.contains(mob))
|
||||
Mob.AddDiscDropper(mob);
|
||||
}
|
||||
|
||||
//iterate the booty sets
|
||||
|
||||
if(mob.mobBase == null || mob.getMobBaseID() == 253003){
|
||||
int i = 0;
|
||||
}
|
||||
|
||||
if (mob.getMobBase().bootySet != 0 && _bootySetMap.containsKey(mob.getMobBase().bootySet))
|
||||
RunBootySet(_bootySetMap.get(mob.getMobBase().bootySet), mob, inHotzone);
|
||||
|
||||
if (mob.bootySet != 0 && _bootySetMap.containsKey(mob.bootySet))
|
||||
if (mob.bootySet != 0 && _bootySetMap.containsKey(mob.bootySet)) {
|
||||
RunBootySet(_bootySetMap.get(mob.bootySet), mob, inHotzone);
|
||||
}else if(mob.bootySet != 0 && ItemBase.getItemBase(mob.bootySet) != null){
|
||||
MobLoot specialDrop = null;
|
||||
specialDrop = new MobLoot(mob,ItemBase.getItemBase(mob.bootySet),true);
|
||||
if(specialDrop != null) {
|
||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().getName() + " has found the " + specialDrop.getName() + ". Are you tough enough to take it?");
|
||||
chatMsg.setMessageType(10);
|
||||
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
||||
DispatchMessage.dispatchMsgToAll(chatMsg);
|
||||
mob.getCharItemManager().addItemToInventory(specialDrop);
|
||||
mob.setResists(new Resists("Dropper"));
|
||||
if(!Mob.discDroppers.contains(mob))
|
||||
Mob.AddDiscDropper(mob);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//lastly, check mobs inventory for godly or disc runes to send a server announcement
|
||||
for (Item it : mob.getInventory()) {
|
||||
@@ -157,21 +132,58 @@ public enum LootManager {
|
||||
boolean hotzoneWasRan = false;
|
||||
float dropRate;
|
||||
|
||||
//1 in 1,000 chance to drop glass
|
||||
if(ThreadLocalRandom.current().nextInt(1,1000) == 500){
|
||||
int glassID = rollRandomItem(126);
|
||||
ItemBase glassItem = ItemBase.getItemBase(glassID);
|
||||
if(glassItem != null) {
|
||||
MobLoot toAdd = new MobLoot(mob, glassItem, false);
|
||||
if (!mob.getSafeZone()) {
|
||||
int contractLow = 1, contractHigh = 400;
|
||||
int runeLow = 401, runeHigh = 800;
|
||||
int resourceLow = 801, resourceHigh = 900;
|
||||
int glassLow = 901, glassHigh = 910;
|
||||
int guardLow = 911, guardHigh = 920;
|
||||
|
||||
if (toAdd != null)
|
||||
mob.getCharItemManager().addItemToInventory(toAdd);
|
||||
// Pre-compute adjusted high values
|
||||
int contractAdjust = 0, runeAdjust = 0, resourceAdjust = 0, glassAdjust = 0, guardAdjust = 0;
|
||||
if (mob.level < 50) {
|
||||
int dif = 50 - mob.level;
|
||||
contractAdjust = (int)(400 * (dif * 0.02f));
|
||||
runeAdjust = (int)(400 * (dif * 0.02f));
|
||||
resourceAdjust = (int)(100 * (dif * 0.02f));
|
||||
glassAdjust = (int)(10 * (dif * 0.02f));
|
||||
guardAdjust = (int)(10 * (dif * 0.02f));
|
||||
}
|
||||
|
||||
// Generate a single random roll
|
||||
int specialCaseRoll = ThreadLocalRandom.current().nextInt(1, 100001);
|
||||
|
||||
// Calculate adjusted high values once
|
||||
int contractHighAdjusted = contractHigh - contractAdjust;
|
||||
int runeHighAdjusted = runeHigh - runeAdjust;
|
||||
int resourceHighAdjusted = resourceHigh - resourceAdjust;
|
||||
int glassHighAdjusted = glassHigh - glassAdjust;
|
||||
int guardHighAdjusted = guardHigh - guardAdjust;
|
||||
|
||||
// Check the roll range and handle accordingly
|
||||
if (specialCaseRoll >= contractLow && specialCaseRoll <= contractHighAdjusted) {
|
||||
SpecialCaseContractDrop(mob, entries);
|
||||
} else if (specialCaseRoll >= runeLow && specialCaseRoll <= runeHighAdjusted) {
|
||||
SpecialCaseRuneDrop(mob, entries);
|
||||
} else if (specialCaseRoll >= resourceLow && specialCaseRoll <= resourceHighAdjusted) {
|
||||
SpecialCaseResourceDrop(mob, entries);
|
||||
} else if (specialCaseRoll >= glassLow && specialCaseRoll <= glassHighAdjusted) {
|
||||
int glassID = rollRandomItem(126);
|
||||
ItemBase glassItem = ItemBase.getItemBase(glassID);
|
||||
if (glassItem != null) {
|
||||
MobLoot toAddGlass = new MobLoot(mob, glassItem, false);
|
||||
mob.getCharItemManager().addItemToInventory(toAddGlass);
|
||||
}
|
||||
} else if (specialCaseRoll >= guardLow && specialCaseRoll <= guardHighAdjusted) {
|
||||
int guardContractID = racial_guard_uuids.get(new java.util.Random().nextInt(racial_guard_uuids.size()));
|
||||
ItemBase guardContract = ItemBase.getItemBase(guardContractID);
|
||||
if (guardContract != null) {
|
||||
MobLoot toAddContract = new MobLoot(mob, guardContract, false);
|
||||
mob.getCharItemManager().addItemToInventory(toAddContract);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//check for special gifts 1/100 to drop present
|
||||
if(ThreadLocalRandom.current().nextInt(1,25) == 15)
|
||||
DropPresent(mob);
|
||||
|
||||
// Iterate all entries in this bootySet and process accordingly
|
||||
for (BootySetEntry bse : entries) {
|
||||
@@ -209,6 +221,109 @@ public enum LootManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static void SpecialCaseContractDrop(Mob mob,ArrayList<BootySetEntry> entries){
|
||||
|
||||
int lootTableID = 0;
|
||||
for(BootySetEntry entry : entries){
|
||||
if(entry.bootyType.equals("LOOT")){
|
||||
lootTableID = entry.genTable;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(lootTableID == 0)
|
||||
return;
|
||||
|
||||
int ContractTableID = 0;
|
||||
for(GenTableEntry entry : _genTables.get(lootTableID)){
|
||||
try {
|
||||
if (ItemBase.getItemBase(_itemTables.get(entry.itemTableID).get(0).cacheID).getType().equals(Enum.ItemType.CONTRACT)) {
|
||||
ContractTableID = entry.itemTableID;
|
||||
break;
|
||||
}
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(ContractTableID == 0)
|
||||
return;
|
||||
|
||||
ItemBase ib = ItemBase.getItemBase(rollRandomItem(ContractTableID));
|
||||
if(ib != null){
|
||||
MobLoot toAdd = new MobLoot(mob,ib,false);
|
||||
mob.getCharItemManager().addItemToInventory(toAdd);
|
||||
}
|
||||
}
|
||||
|
||||
public static void SpecialCaseRuneDrop(Mob mob,ArrayList<BootySetEntry> entries){
|
||||
int lootTableID = 0;
|
||||
for(BootySetEntry entry : entries){
|
||||
if(entry.bootyType.equals("LOOT")){
|
||||
lootTableID = entry.genTable;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(lootTableID == 0)
|
||||
return;
|
||||
|
||||
int RuneTableID = 0;
|
||||
for(GenTableEntry entry : _genTables.get(lootTableID)){
|
||||
try {
|
||||
if (ItemBase.getItemBase(_itemTables.get(entry.itemTableID).get(0).cacheID).getType().equals(Enum.ItemType.RUNE)) {
|
||||
RuneTableID = entry.itemTableID;
|
||||
break;
|
||||
}
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(RuneTableID == 0)
|
||||
return;
|
||||
|
||||
ItemBase ib = ItemBase.getItemBase(rollRandomItem(RuneTableID));
|
||||
if(ib != null){
|
||||
MobLoot toAdd = new MobLoot(mob,ib,false);
|
||||
mob.getCharItemManager().addItemToInventory(toAdd);
|
||||
}
|
||||
}
|
||||
|
||||
public static void SpecialCaseResourceDrop(Mob mob,ArrayList<BootySetEntry> entries){
|
||||
int lootTableID = 0;
|
||||
for(BootySetEntry entry : entries){
|
||||
if(entry.bootyType.equals("LOOT")){
|
||||
lootTableID = entry.genTable;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(lootTableID == 0)
|
||||
return;
|
||||
|
||||
int ResourceTableID = 0;
|
||||
for(GenTableEntry entry : _genTables.get(lootTableID)){
|
||||
try {
|
||||
if (ItemBase.getItemBase(_itemTables.get(entry.itemTableID).get(0).cacheID).getType().equals(Enum.ItemType.RESOURCE)) {
|
||||
ResourceTableID = entry.itemTableID;
|
||||
break;
|
||||
}
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(ResourceTableID == 0)
|
||||
return;
|
||||
|
||||
ItemBase ib = ItemBase.getItemBase(rollRandomItem(ResourceTableID));
|
||||
if(ib != null){
|
||||
MobLoot toAdd = new MobLoot(mob,ib,false);
|
||||
mob.getCharItemManager().addItemToInventory(toAdd);
|
||||
}
|
||||
}
|
||||
|
||||
public static MobLoot getGenTableItem(int genTableID, AbstractCharacter mob, Boolean inHotzone) {
|
||||
|
||||
if (mob == null || _genTables.containsKey(genTableID) == false)
|
||||
@@ -230,11 +345,10 @@ public enum LootManager {
|
||||
|
||||
//gets the 1-320 roll for this mob
|
||||
int itemTableRoll = 0;
|
||||
int objectType = mob.getObjectType().ordinal();
|
||||
if(mob.getObjectType().ordinal() == 52) { //52 = player character
|
||||
itemTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
|
||||
} else{
|
||||
itemTableRoll = TableRoll(mob.level, inHotzone);
|
||||
itemTableRoll = TableRoll(mob.level);
|
||||
}
|
||||
ItemTableEntry tableRow = ItemTableEntry.rollTable(itemTableId, itemTableRoll);
|
||||
if (tableRow == null)
|
||||
@@ -306,7 +420,7 @@ public enum LootManager {
|
||||
if(mob.getObjectType().ordinal() == 52) {
|
||||
prefixTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
|
||||
} else{
|
||||
prefixTableRoll = TableRoll(mob.level, inHotzone);
|
||||
prefixTableRoll = TableRoll(mob.level);
|
||||
}
|
||||
ModTableEntry prefixMod = ModTableEntry.rollTable(prefixTable.modTableID, prefixTableRoll);
|
||||
|
||||
@@ -338,7 +452,7 @@ public enum LootManager {
|
||||
if(mob.getObjectType().ordinal() == 52) {
|
||||
suffixTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
|
||||
} else{
|
||||
suffixTableRoll = TableRoll(mob.level, inHotzone);
|
||||
suffixTableRoll = TableRoll(mob.level);
|
||||
}
|
||||
ModTableEntry suffixMod = ModTableEntry.rollTable(suffixTable.modTableID, suffixTableRoll);
|
||||
|
||||
@@ -353,23 +467,36 @@ public enum LootManager {
|
||||
return inItem;
|
||||
}
|
||||
|
||||
public static int TableRoll(int mobLevel, Boolean inHotzone) {
|
||||
public static int TableRoll(int mobLevel) {
|
||||
|
||||
if (mobLevel > 65)
|
||||
mobLevel = 65;
|
||||
|
||||
int max = (int) (4.882 * mobLevel + 127.0);
|
||||
|
||||
if (max > 319)
|
||||
max = 319;
|
||||
|
||||
int min = (int) (4.469 * mobLevel - 3.469);
|
||||
|
||||
if (min < 70)
|
||||
min = 70;
|
||||
|
||||
if (inHotzone)
|
||||
min += mobLevel;
|
||||
int rank = (int)(mobLevel * 0.1f);
|
||||
int min = 50;
|
||||
int max = 100;
|
||||
switch(rank){
|
||||
case 1:
|
||||
min = 200;
|
||||
max = 250;
|
||||
break;
|
||||
case 2:
|
||||
min = 210;
|
||||
max = 275;
|
||||
break;
|
||||
case 3:
|
||||
min = 220;
|
||||
max = 300;
|
||||
break;
|
||||
case 4:
|
||||
min = 230;
|
||||
max = 320;
|
||||
break;
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
min = 240;
|
||||
max = 320;
|
||||
break;
|
||||
}
|
||||
|
||||
int roll = ThreadLocalRandom.current().nextInt(min, max + 1);
|
||||
|
||||
@@ -401,8 +528,14 @@ public enum LootManager {
|
||||
public static void GenerateLootDrop(Mob mob, int tableID, Boolean inHotzone) {
|
||||
|
||||
MobLoot toAdd = getGenTableItem(tableID, mob, inHotzone);
|
||||
|
||||
if (toAdd != null) {
|
||||
if(toAdd != null){
|
||||
ItemBase ib = toAdd.getItemBase();
|
||||
switch(ib.getType()){
|
||||
case CONTRACT:
|
||||
case RUNE:
|
||||
case RESOURCE:
|
||||
return;
|
||||
}
|
||||
toAdd.setIsID(true);
|
||||
mob.getCharItemManager().addItemToInventory(toAdd);
|
||||
}
|
||||
@@ -414,6 +547,9 @@ public enum LootManager {
|
||||
if (mob == null || mob.getSafeZone())
|
||||
return; // no equipment to drop in safezones
|
||||
|
||||
if(mob.StrongholdGuardian || mob.StrongholdCommander || mob.StrongholdEpic)
|
||||
return; // stronghold mobs don't drop equipment
|
||||
|
||||
//do equipment here
|
||||
if (mob.getEquip() != null) {
|
||||
boolean isVorg = false;
|
||||
@@ -426,6 +562,10 @@ public enum LootManager {
|
||||
if (name.contains("vorgrim legionnaire's") || name.contains("vorgrim auxiliary's") ||name.contains("bellugh nuathal") || name.contains("crimson circle"))
|
||||
isVorg = true;
|
||||
|
||||
if(isVorg && !mob.isDropper){
|
||||
continue;
|
||||
}
|
||||
|
||||
float equipmentRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1);
|
||||
float dropChance = me.getDropChance() * 100;
|
||||
ItemBase itemBase = me.getItemBase();
|
||||
@@ -490,7 +630,7 @@ public enum LootManager {
|
||||
|
||||
//roll 1-100 for the gen table selection
|
||||
|
||||
int genRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1);
|
||||
int genRoll = ThreadLocalRandom.current().nextInt(94, 100) + 1;
|
||||
GenTableEntry selectedRow = GenTableEntry.rollTable(tableID, genRoll, LootManager.NORMAL_DROP_RATE);
|
||||
|
||||
if(selectedRow == null)
|
||||
@@ -654,13 +794,128 @@ public enum LootManager {
|
||||
}
|
||||
|
||||
public static void DropPresent(Mob mob){
|
||||
int random = ThreadLocalRandom.current().nextInt(ItemBase.AnniverseryGifts.size());
|
||||
int presentID = ItemBase.AnniverseryGifts.get(random);
|
||||
ItemBase presentBase = ItemBase.getItemBase(presentID);
|
||||
if(presentBase != null){
|
||||
MobLoot lootItem = new MobLoot(mob, presentBase, true);
|
||||
mob.getCharItemManager().addItemToInventory(lootItem);
|
||||
int random = 971049 + ThreadLocalRandom.current().nextInt(24);
|
||||
if (random > 971071)
|
||||
random = 971071;
|
||||
|
||||
ItemBase present = ItemBase.getItemBase(random);
|
||||
if (present != null) {
|
||||
MobLoot toAdd = new MobLoot(mob, present, true);
|
||||
|
||||
if (toAdd != null)
|
||||
mob.getCharItemManager().addItemToInventory(toAdd);
|
||||
}
|
||||
}
|
||||
|
||||
public static void GenerateStrongholdLoot(Mob mob, boolean commander, boolean epic) {
|
||||
|
||||
mob.getCharItemManager().clearInventory();
|
||||
|
||||
int multiplier = 1;
|
||||
if (commander)
|
||||
multiplier = 2;
|
||||
if(epic)
|
||||
multiplier = 10;
|
||||
|
||||
int high = 125000;
|
||||
int low = 50000;
|
||||
int gold = ThreadLocalRandom.current().nextInt(low, high + 1) * multiplier;
|
||||
|
||||
if (gold > 0) {
|
||||
MobLoot goldAmount = new MobLoot(mob, gold);
|
||||
mob.getCharItemManager().addItemToInventory(goldAmount);
|
||||
}
|
||||
|
||||
//present drop chance for all
|
||||
if (ThreadLocalRandom.current().nextInt(100) < 35)
|
||||
DropPresent(mob);
|
||||
|
||||
//random contract drop chance for all
|
||||
if (ThreadLocalRandom.current().nextInt(100) < 40) {
|
||||
int contractTableID = 250;
|
||||
contractTableID += ThreadLocalRandom.current().nextInt(0, 11);
|
||||
if (contractTableID > 259)
|
||||
contractTableID = 659;
|
||||
|
||||
int id = rollRandomItem(contractTableID);
|
||||
ItemBase ib = ItemBase.getItemBase(id);
|
||||
if (ib != null) {
|
||||
MobLoot contract = new MobLoot(mob, ib, true);
|
||||
|
||||
if (contract != null)
|
||||
mob.getCharItemManager().addItemToInventory(contract);
|
||||
}
|
||||
}
|
||||
|
||||
//special commander drop chances
|
||||
if (commander)
|
||||
GenerateCommanderLoot(mob,false);
|
||||
|
||||
//special epic drop chances
|
||||
if (epic) {
|
||||
GenerateCommanderLoot(mob, true);
|
||||
GenerateCommanderLoot(mob,false);
|
||||
}
|
||||
}
|
||||
|
||||
public static void GenerateCommanderLoot(Mob mob, boolean epic){
|
||||
//present chance
|
||||
if (ThreadLocalRandom.current().nextInt(100) < 25)
|
||||
DropPresent(mob);
|
||||
|
||||
//present chance
|
||||
if (ThreadLocalRandom.current().nextInt(100) < 25)
|
||||
DropPresent(mob);
|
||||
|
||||
//chance for glass
|
||||
if (ThreadLocalRandom.current().nextInt(100) < 75) {
|
||||
int glassID = rollRandomItem(126);
|
||||
ItemBase glassItem = ItemBase.getItemBase(glassID);
|
||||
if (glassItem != null) {
|
||||
MobLoot toAdd2 = new MobLoot(mob, glassItem, true);
|
||||
|
||||
if (toAdd2 != null)
|
||||
mob.getCharItemManager().addItemToInventory(toAdd2);
|
||||
}
|
||||
}
|
||||
|
||||
//chance for disc
|
||||
if (ThreadLocalRandom.current().nextInt(100) < 75) {
|
||||
int discID = rollRandomItem(3202);
|
||||
ItemBase discItem = ItemBase.getItemBase(discID);
|
||||
if (discItem != null) {
|
||||
MobLoot toAdd3 = new MobLoot(mob, discItem, true);
|
||||
|
||||
if (toAdd3 != null)
|
||||
mob.getCharItemManager().addItemToInventory(toAdd3);
|
||||
}
|
||||
}
|
||||
|
||||
//chance for stat rune
|
||||
if (ThreadLocalRandom.current().nextInt(100) < 75) {
|
||||
int runeID = rollRandomItem(3201);
|
||||
ItemBase runeItem = ItemBase.getItemBase(runeID);
|
||||
if (runeItem != null) {
|
||||
MobLoot toAdd4 = new MobLoot(mob, runeItem, true);
|
||||
|
||||
if (toAdd4 != null)
|
||||
mob.getCharItemManager().addItemToInventory(toAdd4);
|
||||
}
|
||||
}
|
||||
if(epic){
|
||||
int contractTableID = 250;
|
||||
contractTableID += ThreadLocalRandom.current().nextInt(0, 11);
|
||||
if (contractTableID > 259)
|
||||
contractTableID = 659;
|
||||
|
||||
int id = rollRandomItem(contractTableID);
|
||||
ItemBase ib = ItemBase.getItemBase(id);
|
||||
if (ib != null) {
|
||||
MobLoot contract = new MobLoot(mob, ib, true);
|
||||
|
||||
if (contract != null)
|
||||
mob.getCharItemManager().addItemToInventory(contract);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,9 +122,9 @@ public enum MaintenanceManager {
|
||||
|
||||
|
||||
//no maintenance if day of week doesnt match
|
||||
if (LocalDateTime.now().getDayOfWeek().ordinal() != building.maintDateTime.getDayOfWeek().ordinal()) {
|
||||
continue;
|
||||
}
|
||||
//if (LocalDateTime.now().getDayOfWeek().ordinal() != building.maintDateTime.getDayOfWeek().ordinal()) {
|
||||
// continue;
|
||||
//}
|
||||
// Add building to maintenance queue
|
||||
|
||||
maintList.add(building);
|
||||
@@ -186,43 +186,8 @@ public enum MaintenanceManager {
|
||||
// If this is an R8 tree, validate that we can
|
||||
// cover the resources required
|
||||
|
||||
if (building.getRank() == 8) {
|
||||
|
||||
hasResources = true;
|
||||
|
||||
if (warehouse == null)
|
||||
hasResources = false;
|
||||
else {
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.stoneIB);
|
||||
|
||||
if (resourceValue < 1500)
|
||||
hasResources = false;
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.lumberIB);
|
||||
|
||||
if (resourceValue < 1500)
|
||||
hasResources = false;
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.galvorIB);
|
||||
|
||||
if (resourceValue < 5)
|
||||
hasResources = false;
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.wormwoodIB);
|
||||
|
||||
if (resourceValue < 5)
|
||||
hasResources = false;
|
||||
|
||||
}
|
||||
}
|
||||
// Validation completed but has failed. We can derank
|
||||
// the target building and early exit
|
||||
|
||||
if ((hasFunds == false) ||
|
||||
((building.getRank() == 8) && !hasResources)) {
|
||||
|
||||
|
||||
if (hasFunds == false) {
|
||||
return false; // Early exit for having failed to meet maintenance
|
||||
}
|
||||
|
||||
@@ -247,58 +212,6 @@ public enum MaintenanceManager {
|
||||
}
|
||||
}
|
||||
|
||||
// Early exit as we're done if we're not an R8 tree
|
||||
|
||||
if (building.getRank() < 8)
|
||||
return true;
|
||||
|
||||
// Now for the resources if it's an R8 tree
|
||||
|
||||
// Withdraw Stone
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.stoneIB);
|
||||
|
||||
if (DbManager.WarehouseQueries.updateStone(warehouse, resourceValue - 1500) == true) {
|
||||
warehouse.getResources().put(Warehouse.stoneIB, resourceValue - 1500);
|
||||
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.STONE, 1500);
|
||||
} else {
|
||||
Logger.error("stone update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||
return true;
|
||||
}
|
||||
|
||||
// Withdraw Lumber
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.lumberIB);
|
||||
|
||||
if (DbManager.WarehouseQueries.updateLumber(warehouse, resourceValue - 1500) == true) {
|
||||
warehouse.getResources().put(Warehouse.lumberIB, resourceValue - 1500);
|
||||
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.LUMBER, 1500);
|
||||
} else {
|
||||
Logger.error("lumber update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||
return true;
|
||||
}
|
||||
|
||||
// Withdraw Galvor
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.galvorIB);
|
||||
|
||||
if (DbManager.WarehouseQueries.updateGalvor(warehouse, resourceValue - 5) == true) {
|
||||
warehouse.getResources().put(Warehouse.galvorIB, resourceValue - 5);
|
||||
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.GALVOR, 5);
|
||||
} else {
|
||||
Logger.error("galvor update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||
return true;
|
||||
}
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.wormwoodIB);
|
||||
|
||||
if (DbManager.WarehouseQueries.updateWormwood(warehouse, resourceValue - 5) == true) {
|
||||
warehouse.getResources().put(Warehouse.wormwoodIB, resourceValue - 5);
|
||||
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.WORMWOOD, 5);
|
||||
} else {
|
||||
Logger.error("wyrmwood update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ public enum MovementManager {
|
||||
|
||||
if (toMove.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||
if (((PlayerCharacter) toMove).isCasting())
|
||||
((PlayerCharacter) toMove).update();
|
||||
((PlayerCharacter) toMove).update(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ public enum MovementManager {
|
||||
if (!toMove.isMoving())
|
||||
toMove.resetLastSetLocUpdate();
|
||||
else
|
||||
toMove.update();
|
||||
toMove.update(false);
|
||||
|
||||
// Update movement for the player
|
||||
|
||||
@@ -351,7 +351,7 @@ public enum MovementManager {
|
||||
ChatManager.chatSystemInfo((PlayerCharacter) ac, "Finished Alt change, setting the end location to " + ac.getEndLoc().getX() + ' ' + ac.getEndLoc().getZ() + " moving=" + ac.isMoving() + " and current location is " + curLoc.getX() + ' ' + curLoc.getZ());
|
||||
|
||||
//Send run/walk/sit/stand to tell the client we are flying / landing etc
|
||||
ac.update();
|
||||
ac.update(false);
|
||||
ac.stopMovement(ac.getLoc());
|
||||
if (ac.isAlive())
|
||||
MovementManager.sendRWSSMsg(ac);
|
||||
@@ -408,7 +408,7 @@ public enum MovementManager {
|
||||
if (bonus.getBool(ModType.Stunned, SourceType.None) || bonus.getBool(ModType.CannotMove, SourceType.None))
|
||||
continue;
|
||||
|
||||
member.update();
|
||||
member.update(false);
|
||||
|
||||
|
||||
// All checks passed, let's move the player
|
||||
|
||||
@@ -340,8 +340,8 @@ public enum NPCManager {
|
||||
else
|
||||
buildingSlot = BuildingManager.getAvailableSlot(abstractCharacter.building);
|
||||
|
||||
if (buildingSlot == -1)
|
||||
Logger.error("No available slot for NPC: " + abstractCharacter.getObjectUUID());
|
||||
//if (buildingSlot == -1)
|
||||
//Logger.error("No available slot for NPC: " + abstractCharacter.getObjectUUID());
|
||||
|
||||
abstractCharacter.building.getHirelings().put(abstractCharacter, buildingSlot);
|
||||
|
||||
|
||||
@@ -163,6 +163,14 @@ public enum PowersManager {
|
||||
public static void usePower(final PerformActionMsg msg, ClientConnection origin,
|
||||
boolean sendCastToSelf) {
|
||||
|
||||
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
|
||||
|
||||
if(!pc.isFlying() && powersBaseByToken.get(msg.getPowerUsedID()) != null && powersBaseByToken.get(msg.getPowerUsedID()).isSpell) //cant be sitting if flying
|
||||
CombatManager.toggleSit(false,origin);
|
||||
|
||||
if(pc.isMoving())
|
||||
pc.stopMovement(pc.getMovementLoc());
|
||||
|
||||
if (usePowerA(msg, origin, sendCastToSelf)) {
|
||||
// Cast failed for some reason, reset timer
|
||||
|
||||
@@ -171,13 +179,10 @@ public enum PowersManager {
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
|
||||
// Send Fail to cast message
|
||||
PlayerCharacter pc = SessionManager
|
||||
.getPlayerCharacter(origin);
|
||||
|
||||
if (pc != null) {
|
||||
sendPowerMsg(pc, 2, msg);
|
||||
if (pc.isCasting()) {
|
||||
pc.update();
|
||||
pc.update(false);
|
||||
}
|
||||
|
||||
pc.setIsCasting(false);
|
||||
@@ -205,6 +210,41 @@ public enum PowersManager {
|
||||
|
||||
boolean CSRCast = false;
|
||||
|
||||
if(msg.getPowerUsedID() == 430628895) {
|
||||
|
||||
boolean failed = false;// group teleport
|
||||
City city = ZoneManager.getCityAtLocation(playerCharacter.loc);
|
||||
if (city == null) {
|
||||
failed = true;
|
||||
}else{
|
||||
Bane bane = city.getBane();
|
||||
if (bane == null) {
|
||||
failed = true;
|
||||
}else{
|
||||
if(!bane.getSiegePhase().equals(SiegePhase.WAR)){
|
||||
failed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(failed){
|
||||
//check to see if we are at an active mine
|
||||
Zone zone = ZoneManager.findSmallestZone(playerCharacter.loc);
|
||||
if(zone != null){
|
||||
Mine mine = null;
|
||||
for(Building building : zone.zoneBuildingSet){
|
||||
if(building.getBlueprint().getBuildingGroup().equals(BuildingGroup.MINE)){
|
||||
mine = Mine.getMineFromTower(building.getObjectUUID());
|
||||
}
|
||||
}
|
||||
if(mine != null){
|
||||
failed = !mine.isActive;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(failed)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (MBServerStatics.POWERS_DEBUG) {
|
||||
ChatManager.chatSayInfo(
|
||||
@@ -241,6 +281,7 @@ public enum PowersManager {
|
||||
|
||||
// get power
|
||||
PowersBase pb = PowersManager.powersBaseByToken.get(msg.getPowerUsedID());
|
||||
|
||||
if (pb == null) {
|
||||
ChatManager.chatSayInfo(playerCharacter,
|
||||
"This power is not implemented yet.");
|
||||
@@ -252,6 +293,35 @@ public enum PowersManager {
|
||||
// return false;
|
||||
}
|
||||
|
||||
//check for movement buffs while flying
|
||||
if(playerCharacter.isFlying()) {
|
||||
switch(pb.token){
|
||||
case 429005674:
|
||||
case 429505739:
|
||||
case 431054700:
|
||||
case 428005600:
|
||||
case 431610080:
|
||||
case 427935608:
|
||||
case 427857146:
|
||||
case 427988218:
|
||||
case 431854842:
|
||||
case 421074170:
|
||||
case 429611355:
|
||||
case 428955899:
|
||||
case 1794395699:
|
||||
case 429428796:
|
||||
case 1514898036:
|
||||
ChatManager.chatSystemInfo(playerCharacter, "You Cannot Fly While Having A MovementBuff");
|
||||
//resync stamina
|
||||
playerCharacter.setStamina(playerCharacter.getStamina(), playerCharacter);
|
||||
|
||||
// Update all surrounding clients.
|
||||
TargetedActionMsg cmm = new TargetedActionMsg(playerCharacter);
|
||||
DispatchMessage.dispatchMsgToInterestArea(playerCharacter, cmm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (playerCharacter.getLastPower() != null)
|
||||
return true;
|
||||
|
||||
@@ -279,6 +349,12 @@ public enum PowersManager {
|
||||
msg.setNumTrains(trains);
|
||||
}
|
||||
|
||||
switch(pb.token){
|
||||
case 429420458: // BH eyes
|
||||
msg.setNumTrains(msg.getNumTrains() * 2);
|
||||
break;
|
||||
}
|
||||
|
||||
// can't go over total trains by player
|
||||
if (playerCharacter.getPowers() != null && playerCharacter.getPowers().containsKey(msg.getPowerUsedID())) {
|
||||
CharacterPower cp = playerCharacter.getPowers().get(msg.getPowerUsedID());
|
||||
@@ -370,15 +446,20 @@ public enum PowersManager {
|
||||
float range = pb.getRange();
|
||||
// verify target is in range
|
||||
|
||||
if(pb.token != 429396028) {
|
||||
|
||||
if (verifyInvalidRange(playerCharacter, target, range))
|
||||
// (pc.getLoc().distance(target.getLoc()) > pb.getRange()) {
|
||||
// TODO send message that target is out of range
|
||||
return true;
|
||||
// verify target is valid type
|
||||
if (!validateTarget(target, playerCharacter, pb))
|
||||
return true;
|
||||
}else{
|
||||
pb.isSpell = false;
|
||||
}
|
||||
|
||||
if (verifyInvalidRange(playerCharacter, target, range))
|
||||
// (pc.getLoc().distance(target.getLoc()) > pb.getRange()) {
|
||||
// TODO send message that target is out of range
|
||||
return true;
|
||||
|
||||
// verify target is valid type
|
||||
if (!validateTarget(target, playerCharacter, pb))
|
||||
return true;
|
||||
|
||||
|
||||
if (AbstractWorldObject.IsAbstractCharacter(target))
|
||||
@@ -487,7 +568,6 @@ public enum PowersManager {
|
||||
// Validity checks passed, move on to casting spell
|
||||
//get caster's live counter
|
||||
int casterLiveCounter = playerCharacter.getLiveCounter();
|
||||
|
||||
// run recycle job for when cast is available again, don't bother adding the timer for CSRs
|
||||
if (time > 0) {
|
||||
FinishRecycleTimeJob frtj = new FinishRecycleTimeJob(playerCharacter, msg);
|
||||
@@ -514,7 +594,7 @@ public enum PowersManager {
|
||||
|
||||
// make person casting stand up if spell (unless they're casting a chant which does not make them stand up)
|
||||
if (pb.isSpell() && !pb.isChant() && playerCharacter.isSit()) {
|
||||
playerCharacter.update();
|
||||
playerCharacter.update(false);
|
||||
playerCharacter.setSit(false);
|
||||
UpdateStateMsg updateStateMsg = new UpdateStateMsg(playerCharacter);
|
||||
DispatchMessage.dispatchMsgToInterestArea(playerCharacter, updateStateMsg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
@@ -522,7 +602,9 @@ public enum PowersManager {
|
||||
}
|
||||
|
||||
// update cast (use skill) fail condition
|
||||
playerCharacter.cancelOnCast();
|
||||
if(pb.token != 429396028) {
|
||||
playerCharacter.cancelOnCast();
|
||||
}
|
||||
|
||||
// update castSpell (use spell) fail condition if spell
|
||||
if (pb.isSpell())
|
||||
@@ -535,13 +617,12 @@ public enum PowersManager {
|
||||
|
||||
|
||||
if (time > 100) {
|
||||
playerCharacter.update();
|
||||
playerCharacter.update(false);
|
||||
playerCharacter.setIsCasting(true);
|
||||
}
|
||||
|
||||
|
||||
playerCharacter.setLastMovementState(playerCharacter.getMovementState());
|
||||
|
||||
// run timer job to end cast
|
||||
if (time < 1) // run immediately
|
||||
finishUsePower(copyMsg, playerCharacter, casterLiveCounter, targetLiveCounter);
|
||||
@@ -706,8 +787,19 @@ public enum PowersManager {
|
||||
if (playerCharacter == null || msg == null)
|
||||
return;
|
||||
|
||||
//if((msg.getPowerUsedID() == 429495514 || msg.getPowerUsedID() == 429407306) && playerCharacter.getRace().getName().toLowerCase().contains("shade")){
|
||||
// //use sneak instead of hide
|
||||
// PowersBase pb = PowersManager.getPowerByToken(429397210);
|
||||
// int offsetTrains = (40 - msg.getNumTrains()) ;
|
||||
// applyPower(playerCharacter,playerCharacter,playerCharacter.loc,429397210,msg.getNumTrains(),false);
|
||||
// applyPower(playerCharacter,playerCharacter,playerCharacter.loc,427857146,offsetTrains,false);
|
||||
//}
|
||||
if(msg.getPowerUsedID() == 429494441) {//wildkins chase
|
||||
playerCharacter.removeEffectBySource(EffectSourceType.Root,40,true);
|
||||
playerCharacter.removeEffectBySource(EffectSourceType.Snare,40,true);
|
||||
}
|
||||
if (playerCharacter.isCasting()) {
|
||||
playerCharacter.update();
|
||||
playerCharacter.update(false);
|
||||
playerCharacter.updateStamRegen(-100);
|
||||
}
|
||||
|
||||
@@ -809,15 +901,16 @@ public enum PowersManager {
|
||||
}
|
||||
float range = pb.getRange() + speedRange;
|
||||
|
||||
if(pb.token != 429396028) {
|
||||
|
||||
if (verifyInvalidRange(playerCharacter, mainTarget, range)) {
|
||||
if (verifyInvalidRange(playerCharacter, mainTarget, range)) {
|
||||
|
||||
sendPowerMsg(playerCharacter, 8, msg);
|
||||
return;
|
||||
sendPowerMsg(playerCharacter, 8, msg);
|
||||
return;
|
||||
}
|
||||
// (pc.getLoc().distance(target.getLoc()) > pb.getRange()) {
|
||||
// TODO send message that target is out of range
|
||||
}
|
||||
// (pc.getLoc().distance(target.getLoc()) > pb.getRange()) {
|
||||
// TODO send message that target is out of range
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1233,7 +1326,7 @@ public enum PowersManager {
|
||||
|
||||
PlayerCharacter target = SessionManager
|
||||
.getPlayerCharacterByLowerCaseName(msg.getTargetName());
|
||||
if (target == null || target.equals(pc) || target.isCombat()) {
|
||||
if (target == null || target.equals(pc)) {
|
||||
|
||||
if (target == null) // Player not found. Send not found message
|
||||
ChatManager.chatInfoError(pc,
|
||||
@@ -1337,6 +1430,16 @@ public enum PowersManager {
|
||||
else
|
||||
duration = 45000; // Belgosh Summons, 45 seconds
|
||||
|
||||
boolean enemiesNear = false;
|
||||
for(AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(pc.loc,MBServerStatics.CHARACTER_LOAD_RANGE, MBServerStatics.MASK_PLAYER)){
|
||||
PlayerCharacter playerCharacter = (PlayerCharacter)awo;
|
||||
if(!playerCharacter.guild.getNation().equals(pc.guild.getNation())){
|
||||
enemiesNear = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(enemiesNear && !pc.isInSafeZone())
|
||||
duration += 60000;
|
||||
|
||||
// Teleport to summoners location
|
||||
FinishSummonsJob fsj = new FinishSummonsJob(source, pc);
|
||||
@@ -1462,8 +1565,17 @@ public enum PowersManager {
|
||||
}
|
||||
|
||||
// create list of characters
|
||||
HashSet<AbstractCharacter> trackChars = RangeBasedAwo.getTrackList(
|
||||
allTargets, playerCharacter, maxTargets);
|
||||
HashSet<AbstractCharacter> trackChars;
|
||||
switch(msg.getPowerToken()){
|
||||
case 431511776:
|
||||
case 429578587:
|
||||
case 429503360:
|
||||
trackChars = getTrackList(playerCharacter);
|
||||
break;
|
||||
default:
|
||||
trackChars = RangeBasedAwo.getTrackList(allTargets, playerCharacter, maxTargets);
|
||||
break;
|
||||
}
|
||||
|
||||
TrackWindowMsg trackWindowMsg = new TrackWindowMsg(msg);
|
||||
|
||||
@@ -1476,6 +1588,30 @@ public enum PowersManager {
|
||||
|
||||
}
|
||||
|
||||
public static HashSet<AbstractCharacter> getTrackList(PlayerCharacter tracker){
|
||||
HashSet<AbstractCharacter> list = new HashSet<AbstractCharacter>();
|
||||
HashSet<AbstractWorldObject> shortList = WorldGrid.getObjectsInRangePartial(tracker.loc,MBServerStatics.CHARACTER_LOAD_RANGE, MBServerStatics.MASK_PLAYER);
|
||||
HashSet<AbstractWorldObject> fullList = WorldGrid.getObjectsInRangePartial(tracker.loc,1408, MBServerStatics.MASK_PLAYER);
|
||||
ArrayList<Guild> guildsPresent = new ArrayList<>();
|
||||
for(AbstractWorldObject awo : shortList){
|
||||
PlayerCharacter pc = (PlayerCharacter)awo;
|
||||
if(!guildsPresent.contains(pc.guild.getNation())){
|
||||
guildsPresent.add(pc.guild.getNation());
|
||||
}
|
||||
}
|
||||
for(AbstractWorldObject awo : fullList){
|
||||
if(awo.equals(tracker))
|
||||
continue;
|
||||
PlayerCharacter pc = (PlayerCharacter)awo;
|
||||
if(!pc.isAlive())
|
||||
continue;
|
||||
if(guildsPresent.contains(pc.guild.getNation()))
|
||||
list.add(pc);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
private static void sendRecyclePower(int token, ClientConnection origin) {
|
||||
RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(token);
|
||||
|
||||
@@ -2189,7 +2325,7 @@ public enum PowersManager {
|
||||
|
||||
// set player is not casting for regens
|
||||
if (pc.isCasting()) {
|
||||
pc.update();
|
||||
pc.update(false);
|
||||
}
|
||||
pc.setIsCasting(false);
|
||||
|
||||
@@ -2241,28 +2377,26 @@ public enum PowersManager {
|
||||
defense = 0f;
|
||||
// Get hit chance
|
||||
|
||||
if (pc.getDebug(16)) {
|
||||
String smsg = "ATR: " + atr + ", Defense: " + defense;
|
||||
ChatManager.chatSystemInfo(pc, smsg);
|
||||
}
|
||||
//if (pc.getDebug(16)) {
|
||||
// String smsg = "ATR: " + atr + ", Defense: " + defense;
|
||||
// ChatManager.chatSystemInfo(pc, smsg);
|
||||
//}
|
||||
|
||||
int chance;
|
||||
//int chance;
|
||||
|
||||
if (atr > defense || defense == 0)
|
||||
chance = 94;
|
||||
else {
|
||||
float dif = atr / defense;
|
||||
if (dif <= 0.8f)
|
||||
chance = 4;
|
||||
else
|
||||
chance = ((int) (450 * (dif - 0.8f)) + 4);
|
||||
}
|
||||
//if (atr > defense || defense == 0)
|
||||
// chance = 94;
|
||||
//else {
|
||||
// float dif = atr / defense;
|
||||
// if (dif <= 0.8f)
|
||||
// chance = 4;
|
||||
// else
|
||||
// chance = ((int) (450 * (dif - 0.8f)) + 4);
|
||||
//}
|
||||
|
||||
// calculate hit/miss
|
||||
int roll = ThreadLocalRandom.current().nextInt(100);
|
||||
|
||||
boolean disable = true;
|
||||
if (roll < chance) {
|
||||
if (CombatManager.LandHit((int)atr,(int)defense)) {
|
||||
// Hit, check if dodge kicked in
|
||||
if (awo instanceof AbstractCharacter) {
|
||||
AbstractCharacter tarAc = (AbstractCharacter) awo;
|
||||
@@ -2562,7 +2696,9 @@ public enum PowersManager {
|
||||
}
|
||||
|
||||
public static void cancelOnStun(AbstractCharacter ac) {
|
||||
|
||||
if(ac.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
||||
//PlayerCharacter.GroundPlayer((PlayerCharacter)ac);
|
||||
}
|
||||
}
|
||||
|
||||
private static PowersBase getLastPower(AbstractCharacter ac) {
|
||||
|
||||
@@ -113,9 +113,18 @@ public enum SimulationManager {
|
||||
}
|
||||
|
||||
try {
|
||||
if ((_cityPulseTime != 0)
|
||||
&& (System.currentTimeMillis() > _cityPulseTime))
|
||||
pulseCities();
|
||||
if ((_cityPulseTime != 0) && (System.currentTimeMillis() > _cityPulseTime)) {
|
||||
try {
|
||||
pulseCities();
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
try {
|
||||
ArenaManager.pulseArenas();
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.error(
|
||||
"Fatal error in City Pulse: DISABLED. Error Message : "
|
||||
@@ -151,7 +160,7 @@ public enum SimulationManager {
|
||||
|
||||
if (player == null)
|
||||
continue;
|
||||
player.update();
|
||||
player.update(false);
|
||||
}
|
||||
|
||||
_updatePulseTime = System.currentTimeMillis() + 500;
|
||||
|
||||
@@ -0,0 +1,347 @@
|
||||
package engine.gameManager;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.InterestManagement.InterestManager;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.math.Vector3f;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.*;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
public class StrongholdManager {
|
||||
|
||||
public static void processStrongholds() {
|
||||
ArrayList<Mine> mines = Mine.getMines();
|
||||
|
||||
|
||||
//process strongholds selecting 3 randomly to become active
|
||||
int count = 0;
|
||||
while (count < 3) {
|
||||
int random = ThreadLocalRandom.current().nextInt(1, mines.size()) - 1;
|
||||
Mine mine = mines.get(random);
|
||||
if (mine != null) {
|
||||
if (!mine.isActive && !mine.isStronghold) {
|
||||
StartStronghold(mine);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void StartStronghold(Mine mine){
|
||||
|
||||
//remove buildings
|
||||
Building tower = BuildingManager.getBuilding(mine.getBuildingID());
|
||||
if(tower == null)
|
||||
return;
|
||||
|
||||
mine.isStronghold = true;
|
||||
mine.strongholdMobs = new ArrayList<>();
|
||||
mine.oldBuildings = new HashMap<>();
|
||||
|
||||
Zone mineZone = ZoneManager.findSmallestZone(tower.loc);
|
||||
for(Building building : mineZone.zoneBuildingSet){
|
||||
mine.oldBuildings.put(building.getObjectUUID(),building.meshUUID);
|
||||
building.setMeshUUID(407650);
|
||||
building.setMeshScale(new Vector3f(0,0,0));
|
||||
InterestManager.setObjectDirty(building);
|
||||
WorldGrid.updateObject(building);
|
||||
}
|
||||
|
||||
//update tower to become stronghold mesh
|
||||
tower.setMeshUUID(getStrongholdMeshID(mine.getParentZone()));
|
||||
tower.setMeshScale(new Vector3f(1,1,1));
|
||||
InterestManager.setObjectDirty(tower);
|
||||
WorldGrid.updateObject(tower);
|
||||
|
||||
//create elite mobs
|
||||
for(int i = 0; i < mine.capSize * 2; i++){
|
||||
Vector3fImmutable loc = Vector3fImmutable.getRandomPointOnCircle(tower.loc,30);
|
||||
MobBase guardBase = MobBase.getMobBase(getStrongholdGuardianID(tower.meshUUID));
|
||||
Mob guard = Mob.createStrongholdMob(guardBase.getLoadID(), loc, Guild.getErrantGuild(),true,mineZone,null,0, guardBase.getFirstName(),65);
|
||||
if(guard != null){
|
||||
guard.parentZone = mine.getParentZone();
|
||||
guard.bindLoc = loc;
|
||||
guard.setLoc(loc);
|
||||
guard.StrongholdGuardian = true;
|
||||
guard.equipmentSetID = getStrongholdMobEquipSetID(guard);
|
||||
guard.runAfterLoad();
|
||||
guard.setLevel((short)65);
|
||||
guard.setResists(new Resists("Elite"));
|
||||
guard.spawnTime = 1000000000;
|
||||
guard.BehaviourType = Enum.MobBehaviourType.Aggro;
|
||||
mine.strongholdMobs.add(guard);
|
||||
LootManager.GenerateStrongholdLoot(guard,false,false);
|
||||
guard.healthMax = 12500;
|
||||
guard.setHealth(guard.healthMax);
|
||||
guard.maxDamageHandOne = 1550;
|
||||
guard.minDamageHandOne = 750;
|
||||
guard.atrHandOne = 1800;
|
||||
guard.defenseRating = 2200;
|
||||
guard.setFirstName("Elite Guardian");
|
||||
InterestManager.setObjectDirty(guard);
|
||||
WorldGrid.addObject(guard,loc.x,loc.z);
|
||||
WorldGrid.updateObject(guard);
|
||||
guard.stronghold = mine;
|
||||
guard.mobPowers.clear();
|
||||
guard.mobPowers.put(429399948,20); // find weakness
|
||||
}
|
||||
}
|
||||
//create stronghold commander
|
||||
Vector3fImmutable loc = tower.loc;
|
||||
MobBase commanderBase = MobBase.getMobBase(getStrongholdCommanderID(tower.meshUUID));
|
||||
Mob commander = Mob.createStrongholdMob(commanderBase.getLoadID(), loc,Guild.getErrantGuild(),true,mineZone,null,0, commanderBase.getFirstName(),75);
|
||||
if(commander != null){
|
||||
commander.parentZone = mine.getParentZone();
|
||||
commander.bindLoc = loc;
|
||||
commander.setLoc(loc);
|
||||
commander.StrongholdCommander = true;
|
||||
commander.equipmentSetID = getStrongholdMobEquipSetID(commander);
|
||||
commander.runAfterLoad();
|
||||
commander.setLevel((short)75);
|
||||
commander.setResists(new Resists("Elite"));
|
||||
commander.spawnTime = 1000000000;
|
||||
commander.BehaviourType = Enum.MobBehaviourType.Aggro;
|
||||
commander.mobPowers.clear();
|
||||
commander.mobPowers.put(429032838, 40); // gravechill
|
||||
commander.mobPowers.put(429757701,20); // magebolt
|
||||
commander.mobPowers.put(429121388,20); // blight
|
||||
commander.mobPowers.put(431566891,20); // lightning bolt
|
||||
commander.mobPowers.put(428716075,20); // fire bolt
|
||||
commander.mobPowers.put(429010987,20); // ice bolt
|
||||
mine.strongholdMobs.add(commander);
|
||||
LootManager.GenerateStrongholdLoot(commander,true, false);
|
||||
commander.healthMax = 50000;
|
||||
commander.setHealth(commander.healthMax);
|
||||
commander.maxDamageHandOne = 3500;
|
||||
commander.minDamageHandOne = 1500;
|
||||
commander.atrHandOne = 3500;
|
||||
commander.defenseRating = 3500;
|
||||
commander.setFirstName("Guardian Commander");
|
||||
InterestManager.setObjectDirty(commander);
|
||||
WorldGrid.addObject(commander,loc.x,loc.z);
|
||||
WorldGrid.updateObject(commander);
|
||||
commander.stronghold = mine;
|
||||
}
|
||||
|
||||
mine.isActive = true;
|
||||
tower.setProtectionState(Enum.ProtectionState.PROTECTED);
|
||||
tower.getBounds().setRegions(tower);
|
||||
InterestManager.setObjectDirty(tower);
|
||||
WorldGrid.updateObject(tower);
|
||||
ChatManager.chatSystemChannel(mine.getZoneName() + "'s Stronghold Has Begun!");
|
||||
Logger.info(mine.getZoneName() + "'s Stronghold Has Begun!");
|
||||
}
|
||||
|
||||
public static void EndStronghold(Mine mine){
|
||||
|
||||
//restore the buildings
|
||||
Building tower = BuildingManager.getBuilding(mine.getBuildingID());
|
||||
if(tower == null)
|
||||
return;
|
||||
|
||||
mine.isStronghold = false;
|
||||
|
||||
//get rid of the mobs
|
||||
for(Mob mob : mine.strongholdMobs) {
|
||||
mob.despawn();
|
||||
mob.removeFromCache();
|
||||
DbManager.MobQueries.DELETE_MOB(mob);
|
||||
}
|
||||
|
||||
//restore the buildings
|
||||
Zone mineZone = ZoneManager.findSmallestZone(tower.loc);
|
||||
for(Building building : mineZone.zoneBuildingSet){
|
||||
if(mine.oldBuildings.containsKey(building.getObjectUUID())) {
|
||||
building.setMeshUUID(mine.oldBuildings.get(building.getObjectUUID()));
|
||||
building.setMeshScale(new Vector3f(1, 1, 1));
|
||||
InterestManager.setObjectDirty(building);
|
||||
WorldGrid.updateObject(building);
|
||||
}
|
||||
}
|
||||
|
||||
//update tower to become Mine Tower again
|
||||
tower.setMeshUUID(1500100);
|
||||
|
||||
mine.isActive = false;
|
||||
tower.setProtectionState(Enum.ProtectionState.NPC);
|
||||
tower.getBounds().setRegions(tower);
|
||||
InterestManager.setObjectDirty(tower);
|
||||
WorldGrid.updateObject(tower);
|
||||
ChatManager.chatSystemChannel(mine.getZoneName() + "'s Stronghold Has Concluded!");
|
||||
Logger.info(mine.getZoneName() + "'s Stronghold Has Concluded!");
|
||||
}
|
||||
|
||||
public static int getStrongholdMeshID(Zone parent){
|
||||
while(!parent.isMacroZone()){
|
||||
parent = parent.getParent();
|
||||
if(parent.getName().equalsIgnoreCase("seafloor")){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
switch(parent.getObjectUUID()){
|
||||
case 197:
|
||||
case 234:
|
||||
case 178:
|
||||
case 122:
|
||||
return 814000; //Frost Giant Hall (ICE)
|
||||
case 968:
|
||||
case 951:
|
||||
case 313:
|
||||
case 331:
|
||||
return 5001500; // Lich Queens Keep (UNDEAD)
|
||||
case 785:
|
||||
case 761:
|
||||
case 717:
|
||||
case 737:
|
||||
return 1306600; // Temple of the Dragon (DESERT)
|
||||
case 353:
|
||||
case 371:
|
||||
case 388:
|
||||
case 532:
|
||||
return 564600; // Undead Lord's Keep (SWAMP)
|
||||
case 550:
|
||||
case 508:
|
||||
case 475:
|
||||
case 418:
|
||||
return 1326600; // elven hall
|
||||
case 437:
|
||||
case 491:
|
||||
case 590:
|
||||
case 569:
|
||||
return 602400;
|
||||
case 824:
|
||||
case 842:
|
||||
case 632:
|
||||
return 1600000; // chaos temple
|
||||
}
|
||||
return 456100; // small stockade
|
||||
}
|
||||
|
||||
public static int getStrongholdGuardianID(int ID){
|
||||
switch(ID){
|
||||
case 814000:
|
||||
return 253004; // Mountain Giant Raider Axe
|
||||
case 5001500:
|
||||
return 253008; // Vampire Spear Warrior
|
||||
case 1306600:
|
||||
return 253007; // Desert Orc Warrior
|
||||
case 564600:
|
||||
return 253010; // Kolthoss Warrior
|
||||
case 1326600:
|
||||
return 253005; //elven warrior
|
||||
case 602400:
|
||||
return 253009; // templar missionary
|
||||
case 1600000:
|
||||
return 253006; // scourger
|
||||
}
|
||||
return 13434; // human sword and board warrior
|
||||
}
|
||||
|
||||
public static int getStrongholdEpicID(int ID){
|
||||
switch(ID){
|
||||
case 814000:
|
||||
return 253023; // Mountain Giant Raider Axe
|
||||
case 5001500:
|
||||
return 253022; // Vampire Spear Warrior
|
||||
case 1306600:
|
||||
return 253021; // Desert Orc Warrior
|
||||
case 564600:
|
||||
return 253018; // Kolthoss Warrior
|
||||
case 1326600:
|
||||
return 253019; //elven warrior
|
||||
case 602400:
|
||||
return 253024; // templar missionary
|
||||
case 1600000:
|
||||
return 253020; // scourger
|
||||
}
|
||||
return 13434; // human sword and board warrior
|
||||
}
|
||||
|
||||
public static int getStrongholdCommanderID(int ID){
|
||||
switch(ID){
|
||||
case 814000:
|
||||
return 253017;
|
||||
case 5001500:
|
||||
return 253012;
|
||||
case 1306600:
|
||||
return 253016; // Desert Orc Xbow
|
||||
case 564600:
|
||||
return 253011; // xbow kolthoss
|
||||
case 1326600:
|
||||
return 253013; //elven bow warrior
|
||||
case 602400:
|
||||
return 253015; // dune giant with xbow
|
||||
case 1600000:
|
||||
return 253014; // barbator
|
||||
}
|
||||
return 13433;
|
||||
}
|
||||
|
||||
public static int getStrongholdMobEquipSetID(Mob mob) {
|
||||
if(mob.StrongholdGuardian){
|
||||
return 6327;
|
||||
}else{
|
||||
return 10790;
|
||||
}
|
||||
}
|
||||
|
||||
public static void CheckToEndStronghold(Mine mine) {
|
||||
|
||||
boolean stillAlive = false;
|
||||
for (Mob mob : mine.strongholdMobs)
|
||||
if (mob.isAlive())
|
||||
stillAlive = true;
|
||||
|
||||
if (!stillAlive) {
|
||||
// Epic encounter
|
||||
|
||||
Building tower = BuildingManager.getBuilding(mine.getBuildingID());
|
||||
if (tower == null)
|
||||
return;
|
||||
|
||||
Zone mineZone = ZoneManager.findSmallestZone(tower.loc);
|
||||
|
||||
Vector3fImmutable loc = tower.loc;
|
||||
MobBase commanderBase = MobBase.getMobBase(getStrongholdEpicID(tower.meshUUID));
|
||||
Mob commander = Mob.createStrongholdMob(commanderBase.getLoadID(), loc, Guild.getErrantGuild(), true, mineZone, null, 0, commanderBase.getFirstName(), 75);
|
||||
if (commander != null) {
|
||||
commander.parentZone = mine.getParentZone();
|
||||
commander.bindLoc = loc;
|
||||
commander.setLoc(loc);
|
||||
commander.StrongholdEpic = true;
|
||||
commander.equipmentSetID = getStrongholdMobEquipSetID(commander);
|
||||
commander.runAfterLoad();
|
||||
commander.setLevel((short) 85);
|
||||
commander.setResists(new Resists("Elite"));
|
||||
commander.spawnTime = 1000000000;
|
||||
commander.BehaviourType = Enum.MobBehaviourType.Aggro;
|
||||
commander.mobPowers.clear();
|
||||
commander.mobPowers.put(429032838, 40); // gravechill
|
||||
commander.mobPowers.put(429757701,40); // magebolt
|
||||
commander.mobPowers.put(429121388,40); // blight
|
||||
commander.mobPowers.put(431566891,40); // lightning bolt
|
||||
commander.mobPowers.put(428716075,40); // fire bolt
|
||||
commander.mobPowers.put(429010987,40); // ice bolt
|
||||
mine.strongholdMobs.add(commander);
|
||||
LootManager.GenerateStrongholdLoot(commander, true, true);
|
||||
commander.healthMax = 250000;
|
||||
commander.setHealth(commander.healthMax);
|
||||
commander.maxDamageHandOne = 5000;
|
||||
commander.minDamageHandOne = 2500;
|
||||
commander.atrHandOne = 5000;
|
||||
commander.defenseRating = 3500;
|
||||
commander.setFirstName("Defender of " + mine.getParentZone().getParent().getName());
|
||||
InterestManager.setObjectDirty(commander);
|
||||
WorldGrid.addObject(commander,loc.x,loc.z);
|
||||
WorldGrid.updateObject(commander);
|
||||
commander.stronghold = mine;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,14 +4,13 @@ public class ZergManager {
|
||||
|
||||
public static float getCurrentMultiplier(int count, int maxCount){
|
||||
switch(maxCount) {
|
||||
case 3:
|
||||
return getMultiplier3Man(count);
|
||||
case 5:
|
||||
return getMultiplier5Man(count);
|
||||
case 10:
|
||||
return getMultiplier10Man(count);
|
||||
default:
|
||||
return getMultiplier20Man(count);
|
||||
case 3: return getMultiplier3Man(count);
|
||||
case 5: return getMultiplier5Man(count);
|
||||
case 10: return getMultiplier10Man(count);
|
||||
case 20: return getMultiplier20Man(count);
|
||||
case 30: return getMultiplier30Man(count);
|
||||
case 40: return getMultiplier40Man(count);
|
||||
default: return 1.0f; //unlimited
|
||||
}
|
||||
}
|
||||
public static float getMultiplier3Man(int count) {
|
||||
@@ -22,15 +21,11 @@ public class ZergManager {
|
||||
return 0.0f;
|
||||
|
||||
switch(count){
|
||||
case 4:
|
||||
return 0.75f;
|
||||
case 5:
|
||||
return 0.60f;
|
||||
case 6:
|
||||
return 0.37f;
|
||||
|
||||
case 4: return 0.63f;
|
||||
case 5: return 0.40f;
|
||||
case 6: return 0.25f;
|
||||
default: return 1.0f;
|
||||
}
|
||||
return 1.0f;
|
||||
}
|
||||
public static float getMultiplier5Man(int count) {
|
||||
if(count < 6)
|
||||
@@ -40,19 +35,13 @@ public class ZergManager {
|
||||
return 0.0f;
|
||||
|
||||
switch(count){
|
||||
case 6:
|
||||
return 0.75f;
|
||||
case 7:
|
||||
return 0.67f;
|
||||
case 8:
|
||||
return 0.56f;
|
||||
case 9:
|
||||
return 0.43f;
|
||||
case 10:
|
||||
return 0.25f;
|
||||
|
||||
case 6: return 0.75f;
|
||||
case 7: return 0.57f;
|
||||
case 8: return 0.44f;
|
||||
case 9: return 0.33f;
|
||||
case 10: return 0.25f;
|
||||
default: return 1.0f;
|
||||
}
|
||||
return 1.0f;
|
||||
}
|
||||
public static float getMultiplier10Man(int count) {
|
||||
if(count < 11)
|
||||
@@ -62,31 +51,145 @@ public class ZergManager {
|
||||
return 0.0f;
|
||||
|
||||
switch(count){
|
||||
case 11:
|
||||
return 0.75f;
|
||||
case 12:
|
||||
return 0.71f;
|
||||
case 13:
|
||||
return 0.67f;
|
||||
case 14:
|
||||
return 0.62f;
|
||||
case 15:
|
||||
return 0.56f;
|
||||
case 16:
|
||||
return 0.50f;
|
||||
case 17:
|
||||
return 0.43f;
|
||||
case 18:
|
||||
return 0.35f;
|
||||
case 19:
|
||||
return 0.25f;
|
||||
case 20:
|
||||
return 0.14f;
|
||||
|
||||
case 11: return 0.86f;
|
||||
case 12: return 0.75f;
|
||||
case 13: return 0.65f;
|
||||
case 14: return 0.57f;
|
||||
case 15: return 0.50f;
|
||||
case 16: return 0.44f;
|
||||
case 17: return 0.38f;
|
||||
case 18: return 0.33f;
|
||||
case 19: return 0.29f;
|
||||
case 20: return 0.25f;
|
||||
default: return 1.0f;
|
||||
}
|
||||
return 1.0f;
|
||||
}
|
||||
public static float getMultiplier20Man(int count) {
|
||||
return getMultiplier10Man(count * 2);
|
||||
if(count < 21)
|
||||
return 1.0f;
|
||||
|
||||
if(count > 40)
|
||||
return 0.0f;
|
||||
|
||||
switch (count)
|
||||
{
|
||||
case 21: return 0.93f;
|
||||
case 22: return 0.86f;
|
||||
case 23: return 0.80f;
|
||||
case 24: return 0.75f;
|
||||
case 25: return 0.70f;
|
||||
case 26: return 0.65f;
|
||||
case 27: return 0.61f;
|
||||
case 28: return 0.57f;
|
||||
case 29: return 0.53f;
|
||||
case 30: return 0.50f;
|
||||
case 31: return 0.47f;
|
||||
case 32: return 0.44f;
|
||||
case 33: return 0.41f;
|
||||
case 34: return 0.38f;
|
||||
case 35: return 0.36f;
|
||||
case 36: return 0.33f;
|
||||
case 37: return 0.31f;
|
||||
case 38: return 0.29f;
|
||||
case 39: return 0.27f;
|
||||
case 40: return 0.25f;
|
||||
default: return 1.0f;
|
||||
}
|
||||
|
||||
}
|
||||
public static float getMultiplier30Man(int count) {
|
||||
if(count < 31)
|
||||
return 1.0f;
|
||||
|
||||
if(count > 60)
|
||||
return 0.0f;
|
||||
|
||||
switch (count)
|
||||
{
|
||||
case 31: return 0.95f;
|
||||
case 32: return 0.91f;
|
||||
case 33: return 0.86f;
|
||||
case 34: return 0.82f;
|
||||
case 35: return 0.79f;
|
||||
case 36: return 0.75f;
|
||||
case 37: return 0.72f;
|
||||
case 38: return 0.68f;
|
||||
case 39: return 0.65f;
|
||||
case 40: return 0.63f;
|
||||
case 41: return 0.60f;
|
||||
case 42: return 0.57f;
|
||||
case 43: return 0.55f;
|
||||
case 44: return 0.52f;
|
||||
case 45: return 0.50f;
|
||||
case 46: return 0.48f;
|
||||
case 47: return 0.46f;
|
||||
case 48: return 0.44f;
|
||||
case 49: return 0.42f;
|
||||
case 50: return 0.40f;
|
||||
case 51: return 0.38f;
|
||||
case 52: return 0.37f;
|
||||
case 53: return 0.35f;
|
||||
case 54: return 0.33f;
|
||||
case 55: return 0.32f;
|
||||
case 56: return 0.30f;
|
||||
case 57: return 0.29f;
|
||||
case 58: return 0.28f;
|
||||
case 59: return 0.26f;
|
||||
case 60: return 0.25f;
|
||||
default: return 1.0f;
|
||||
}
|
||||
|
||||
}
|
||||
public static float getMultiplier40Man(int count) {
|
||||
if(count < 41)
|
||||
return 1.0f;
|
||||
|
||||
if(count > 80)
|
||||
return 0.0f;
|
||||
|
||||
switch (count)
|
||||
{
|
||||
case 41: return 0.96f;
|
||||
case 42: return 0.93f;
|
||||
case 43: return 0.90f;
|
||||
case 44: return 0.86f;
|
||||
case 45: return 0.83f;
|
||||
case 46: return 0.80f;
|
||||
case 47: return 0.78f;
|
||||
case 48: return 0.75f;
|
||||
case 49: return 0.72f;
|
||||
case 50: return 0.70f;
|
||||
case 51: return 0.68f;
|
||||
case 52: return 0.65f;
|
||||
case 53: return 0.63f;
|
||||
case 54: return 0.61f;
|
||||
case 55: return 0.59f;
|
||||
case 56: return 0.57f;
|
||||
case 57: return 0.55f;
|
||||
case 58: return 0.53f;
|
||||
case 59: return 0.52f;
|
||||
case 60: return 0.50f;
|
||||
case 61: return 0.48f;
|
||||
case 62: return 0.47f;
|
||||
case 63: return 0.45f;
|
||||
case 64: return 0.44f;
|
||||
case 65: return 0.42f;
|
||||
case 66: return 0.41f;
|
||||
case 67: return 0.40f;
|
||||
case 68: return 0.38f;
|
||||
case 69: return 0.37f;
|
||||
case 70: return 0.36f;
|
||||
case 71: return 0.35f;
|
||||
case 72: return 0.33f;
|
||||
case 73: return 0.32f;
|
||||
case 74: return 0.31f;
|
||||
case 75: return 0.30f;
|
||||
case 76: return 0.29f;
|
||||
case 77: return 0.28f;
|
||||
case 78: return 0.27f;
|
||||
case 79: return 0.26f;
|
||||
case 80: return 0.25f;
|
||||
default: return 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ public abstract class AbstractEffectJob extends AbstractScheduleJob {
|
||||
}
|
||||
|
||||
public void endEffect() {
|
||||
if (this.eb == null)
|
||||
if (this.eb == null || this.power == null)
|
||||
return;
|
||||
this.eb.endEffect(this.source, this.target, this.trains, this.power, this);
|
||||
}
|
||||
|
||||
@@ -47,13 +47,13 @@ public class FinishSummonsJob extends AbstractScheduleJob {
|
||||
return;
|
||||
|
||||
// cannot summon a player in combat
|
||||
if (this.target.isCombat()) {
|
||||
//if (this.target.isCombat()) {
|
||||
|
||||
ErrorPopupMsg.sendErrorMsg(this.source, "Cannot summon player in combat.");
|
||||
// ErrorPopupMsg.sendErrorMsg(this.source, "Cannot summon player in combat.");
|
||||
|
||||
PowersManager.finishRecycleTime(428523680, this.source, false);
|
||||
return;
|
||||
}
|
||||
// PowersManager.finishRecycleTime(428523680, this.source, false);
|
||||
// return;
|
||||
//}
|
||||
|
||||
if (this.target.getBonuses() != null && this.target.getBonuses().getBool(ModType.BlockedPowerType, SourceType.SUMMON)) {
|
||||
ErrorPopupMsg.sendErrorMsg(this.target, "You have been blocked from receiving summons!");
|
||||
|
||||
@@ -37,11 +37,11 @@ public class ItemTableEntry {
|
||||
List<ItemTableEntry> itemTableEntryList;
|
||||
|
||||
itemTableEntryList = LootManager._itemTables.get(itemTable);
|
||||
|
||||
for (ItemTableEntry iteration : itemTableEntryList)
|
||||
if (roll >= iteration.minRoll && roll <= iteration.maxRoll)
|
||||
itemTableEntry = iteration;
|
||||
|
||||
if(itemTableEntryList != null) {
|
||||
for (ItemTableEntry iteration : itemTableEntryList)
|
||||
if (roll >= iteration.minRoll && roll <= iteration.maxRoll)
|
||||
itemTableEntry = iteration;
|
||||
}
|
||||
return itemTableEntry;
|
||||
}
|
||||
|
||||
@@ -51,8 +51,8 @@ public class ItemTableEntry {
|
||||
|
||||
itemTableEntryList = LootManager._itemTables.get(itemTable);
|
||||
|
||||
if(itemTableEntryList != null){
|
||||
id = itemTableEntryList.get(ThreadLocalRandom.current().nextInt(0,itemTableEntryList.size() - 1)).cacheID;
|
||||
if(itemTableEntryList != null && itemTableEntryList.size() > 1){
|
||||
id = itemTableEntryList.get(ThreadLocalRandom.current().nextInt(0, itemTableEntryList.size())).cacheID;
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
@@ -33,11 +33,11 @@ public class ModTableEntry {
|
||||
List<ModTableEntry> itemTableEntryList;
|
||||
|
||||
itemTableEntryList = LootManager._modTables.get(modTablwe);
|
||||
|
||||
for (ModTableEntry iteration : itemTableEntryList)
|
||||
if (roll >= iteration.minRoll && roll <= iteration.maxRoll)
|
||||
modTableEntry = iteration;
|
||||
|
||||
if(itemTableEntryList != null) {
|
||||
for (ModTableEntry iteration : itemTableEntryList)
|
||||
if (roll >= iteration.minRoll && roll <= iteration.maxRoll)
|
||||
modTableEntry = iteration;
|
||||
}
|
||||
return modTableEntry;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ public class Bounds {
|
||||
//player is inside building region, skip collision check. we only do collision from the outside.
|
||||
if (player.region != null && player.region.parentBuildingID == building.getObjectUUID())
|
||||
continue;
|
||||
if (building.getBounds().colliders == null)
|
||||
if (building.getBounds() == null || building.getBounds().colliders == null)
|
||||
continue;
|
||||
|
||||
for (Colliders collider : building.getBounds().colliders) {
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package engine.mobileAI.BehaviourFiles;
|
||||
|
||||
import engine.objects.Mob;
|
||||
|
||||
public class PlayerGuard {
|
||||
|
||||
public static void process(Mob guard){
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package engine.mobileAI.BehaviourFiles;
|
||||
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.mobileAI.enumMobState;
|
||||
import engine.mobileAI.utilities.CombatUtilities;
|
||||
import engine.mobileAI.utilities.MovementUtilities;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
import engine.objects.ItemBase;
|
||||
import engine.objects.Mob;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.powers.PowersBase;
|
||||
import engine.server.MBServerStatics;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class PlayerPet {
|
||||
|
||||
public static void process(Mob pet){
|
||||
if(pet.getOwner() == null && !pet.isNecroPet()){
|
||||
pet.killCharacter("no owner");
|
||||
return;
|
||||
}
|
||||
|
||||
if(!WorldGrid.getObjectsInRangePartial(pet.loc, MBServerStatics.CHARACTER_LOAD_RANGE,1).contains(pet.getOwner())){
|
||||
pet.teleport(pet.getOwner().loc);
|
||||
return;
|
||||
}
|
||||
|
||||
switch(enumMobState.getState(pet)){
|
||||
case dead:
|
||||
pet.despawn();
|
||||
return;
|
||||
case patrolling:
|
||||
if(pet.loc.distanceSquared(pet.getOwner().loc) > 90 && !pet.isMoving()){
|
||||
MovementUtilities.aiMove(pet,pet.getOwner().loc,false);
|
||||
}
|
||||
return;
|
||||
case attacking:
|
||||
attack(pet);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public static void attack(Mob mob){
|
||||
|
||||
if (mob.combatTarget == null || !mob.combatTarget.isAlive()) {
|
||||
mob.setCombatTarget(null);
|
||||
aggro(mob);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!CombatUtilities.inRangeToAttack(mob,mob.combatTarget)){
|
||||
if (!MovementUtilities.canMove(mob))
|
||||
return;
|
||||
MovementUtilities.aiMove(mob,mob.combatTarget.loc,false);
|
||||
return;
|
||||
}
|
||||
|
||||
mob.updateLocation();
|
||||
|
||||
ItemBase weapon = mob.getWeaponItemBase(true);
|
||||
boolean mainHand = true;
|
||||
if(weapon == null) {
|
||||
weapon = mob.getWeaponItemBase(false);
|
||||
mainHand = false;
|
||||
}
|
||||
|
||||
if (System.currentTimeMillis() > mob.getNextAttackTime()) {
|
||||
CombatUtilities.combatCycle(mob, mob.combatTarget, mainHand, weapon);
|
||||
mob.setNextAttackTime(System.currentTimeMillis() + 3000L);
|
||||
}
|
||||
}
|
||||
public static void aggro(Mob mob){
|
||||
|
||||
for(AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(mob.loc,30, MBServerStatics.MASK_MOB)) {
|
||||
Mob potentialTarget = (Mob) awo;
|
||||
if (!potentialTarget.isAlive())
|
||||
continue;
|
||||
if (MovementUtilities.inRangeToAggro(mob, potentialTarget)) {
|
||||
mob.setCombatTarget(potentialTarget);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package engine.mobileAI.BehaviourFiles;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.mobileAI.utilities.CombatUtilities;
|
||||
import engine.objects.Mob;
|
||||
|
||||
public class SiegeMob {
|
||||
public static void process(Mob treb){
|
||||
if(!treb.isAlive()){
|
||||
if(!treb.despawned){
|
||||
treb.despawn();
|
||||
treb.deathTime = System.currentTimeMillis();
|
||||
return;
|
||||
}
|
||||
|
||||
if(treb.deathTime == 0) {
|
||||
treb.deathTime = System.currentTimeMillis();
|
||||
return;
|
||||
}
|
||||
if(treb.deathTime + 900000L > System.currentTimeMillis()) {
|
||||
treb.respawn();
|
||||
treb.setCombatTarget(null);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(treb.combatTarget == null)
|
||||
return;
|
||||
|
||||
if(!treb.combatTarget.getObjectType().equals(Enum.GameObjectType.Building)) {
|
||||
treb.setCombatTarget(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!treb.combatTarget.isAlive()) {
|
||||
treb.setCombatTarget(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!CombatUtilities.inRangeToAttack(treb,treb.combatTarget))
|
||||
treb.setCombatTarget(null);
|
||||
|
||||
if (System.currentTimeMillis() > treb.getNextAttackTime()) {
|
||||
CombatUtilities.combatCycle(treb, treb.combatTarget, true, null);
|
||||
treb.setNextAttackTime(System.currentTimeMillis() + 11000L);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
package engine.mobileAI.BehaviourFiles;
|
||||
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.mobileAI.enumMobState;
|
||||
import engine.mobileAI.utilities.CombatUtilities;
|
||||
import engine.mobileAI.utilities.MovementUtilities;
|
||||
import engine.objects.*;
|
||||
import engine.powers.PowersBase;
|
||||
import engine.server.MBServerStatics;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class StandardMob {
|
||||
public static void process(Mob mob){
|
||||
switch(enumMobState.getState(mob)){
|
||||
case idle:
|
||||
return;
|
||||
case dead:
|
||||
respawn(mob);
|
||||
return;
|
||||
case patrolling:
|
||||
if(mob.combatTarget == null)
|
||||
aggro(mob);
|
||||
if(mob.combatTarget == null)
|
||||
patrol(mob);
|
||||
return;
|
||||
case attacking:
|
||||
attack(mob);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public static void respawn(Mob mob){
|
||||
if (mob.deathTime == 0) {
|
||||
mob.setDeathTime(System.currentTimeMillis());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mob.despawned) {
|
||||
|
||||
if (mob.getCharItemManager() != null && mob.getCharItemManager().getInventoryCount() > 0) {
|
||||
if (System.currentTimeMillis() > mob.deathTime + MBServerStatics.DESPAWN_TIMER_WITH_LOOT) {
|
||||
mob.despawn();
|
||||
mob.deathTime = System.currentTimeMillis();
|
||||
return;
|
||||
}
|
||||
//No items in inventory.
|
||||
} else if (mob.isHasLoot()) {
|
||||
if (System.currentTimeMillis() > mob.deathTime + MBServerStatics.DESPAWN_TIMER_ONCE_LOOTED) {
|
||||
mob.despawn();
|
||||
mob.deathTime = System.currentTimeMillis();
|
||||
return;
|
||||
}
|
||||
//Mob never had Loot.
|
||||
} else {
|
||||
if (System.currentTimeMillis() > mob.deathTime + MBServerStatics.DESPAWN_TIMER) {
|
||||
mob.despawn();
|
||||
mob.deathTime = System.currentTimeMillis();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(Mob.discDroppers.contains(mob))
|
||||
return;
|
||||
|
||||
if (System.currentTimeMillis() > (mob.deathTime + (mob.spawnTime * 1000L))) {
|
||||
if (!Zone.respawnQue.contains(mob)) {
|
||||
Zone.respawnQue.add(mob);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void aggro(Mob mob){
|
||||
if(enumMobState.Agressive(mob)){
|
||||
for(int id : mob.playerAgroMap.keySet()){
|
||||
PlayerCharacter potentialTarget = PlayerCharacter.getFromCache(id);
|
||||
if(!potentialTarget.isAlive() || !mob.canSee(potentialTarget))
|
||||
continue;
|
||||
if (MovementUtilities.inRangeToAggro(mob, potentialTarget)) {
|
||||
mob.setCombatTarget(potentialTarget);
|
||||
return;
|
||||
}
|
||||
}
|
||||
for(AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(mob.loc,60, MBServerStatics.MASK_PET)){
|
||||
Mob potentialTarget = (Mob)awo;
|
||||
if(!potentialTarget.isAlive())
|
||||
continue;
|
||||
if (MovementUtilities.inRangeToAggro(mob, potentialTarget)) {
|
||||
mob.setCombatTarget(potentialTarget);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void patrol(Mob mob){
|
||||
if (!MovementUtilities.canMove(mob))
|
||||
return;
|
||||
|
||||
if (mob.stopPatrolTime + 5000L > System.currentTimeMillis())
|
||||
return;
|
||||
|
||||
if(mob.isMoving())
|
||||
return;
|
||||
|
||||
if (mob.lastPatrolPointIndex > mob.patrolPoints.size() - 1)
|
||||
mob.lastPatrolPointIndex = 0;
|
||||
|
||||
mob.destination = mob.patrolPoints.get(mob.lastPatrolPointIndex);
|
||||
mob.lastPatrolPointIndex += 1;
|
||||
MovementUtilities.aiMove(mob, mob.destination, true);
|
||||
}
|
||||
|
||||
public static void attack(Mob mob){
|
||||
if (!MovementUtilities.inRangeOfBindLocation(mob)) {
|
||||
|
||||
PowersBase recall = PowersManager.getPowerByToken(-1994153779);
|
||||
PowersManager.useMobPower(mob, mob, recall, 40);
|
||||
mob.setCombatTarget(null);
|
||||
|
||||
for (Map.Entry playerEntry : mob.playerAgroMap.entrySet())
|
||||
PlayerCharacter.getFromCache((int) playerEntry.getKey()).setHateValue(0);
|
||||
mob.setCombatTarget(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mob.combatTarget == null || !mob.combatTarget.isAlive()) {
|
||||
mob.setCombatTarget(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!mob.isMoving() && !CombatUtilities.inRangeToAttack(mob,mob.combatTarget)){
|
||||
if (!MovementUtilities.canMove(mob))
|
||||
return;
|
||||
MovementUtilities.aiMove(mob,mob.combatTarget.loc,false);
|
||||
return;
|
||||
}
|
||||
|
||||
mob.updateLocation();
|
||||
|
||||
ItemBase weapon = mob.getWeaponItemBase(true);
|
||||
boolean mainHand = true;
|
||||
if(weapon == null) {
|
||||
weapon = mob.getWeaponItemBase(false);
|
||||
mainHand = false;
|
||||
}
|
||||
|
||||
if (System.currentTimeMillis() > mob.getNextAttackTime()) {
|
||||
CombatUtilities.combatCycle(mob, mob.combatTarget, mainHand, weapon);
|
||||
mob.setNextAttackTime(System.currentTimeMillis() + 3000L);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package engine.mobileAI;
|
||||
|
||||
import engine.mobileAI.BehaviourFiles.PlayerGuard;
|
||||
import engine.mobileAI.BehaviourFiles.PlayerPet;
|
||||
import engine.mobileAI.BehaviourFiles.SiegeMob;
|
||||
import engine.mobileAI.BehaviourFiles.StandardMob;
|
||||
import engine.objects.Mob;
|
||||
|
||||
public class EasyAI {
|
||||
|
||||
public static void aiRun(Mob mob) {
|
||||
if (mob == null)
|
||||
return;
|
||||
|
||||
if (mob.isPlayerGuard) {
|
||||
PlayerGuard.process(mob);
|
||||
return;
|
||||
}
|
||||
|
||||
if(mob.isSiege()){
|
||||
SiegeMob.process(mob);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mob.isPet()) {
|
||||
PlayerPet.process(mob);
|
||||
return;
|
||||
}
|
||||
|
||||
StandardMob.process(mob);
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,6 @@
|
||||
package engine.mobileAI;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.Enum.DispatchChannel;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.gameManager.*;
|
||||
import engine.math.Vector3f;
|
||||
@@ -17,9 +16,7 @@ import engine.math.Vector3fImmutable;
|
||||
import engine.mobileAI.Threads.MobAIThread;
|
||||
import engine.mobileAI.utilities.CombatUtilities;
|
||||
import engine.mobileAI.utilities.MovementUtilities;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.PerformActionMsg;
|
||||
import engine.net.client.msg.PowerProjectileMsg;
|
||||
import engine.objects.*;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.PowersBase;
|
||||
@@ -82,6 +79,16 @@ public class MobAI {
|
||||
|
||||
mob.updateLocation();
|
||||
|
||||
if(mob.StrongholdGuardian || mob.StrongholdEpic){
|
||||
// attempt to ground all players in attack range
|
||||
for(int i : mob.playerAgroMap.keySet()){
|
||||
PlayerCharacter tar = PlayerCharacter.getFromCache(i);
|
||||
if(tar != null && tar.loc.distanceSquared(mob.loc) < 80){
|
||||
PowersManager.applyPower(mob,tar,tar.loc, 111111,40,false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackTarget" + " " + e.getMessage());
|
||||
}
|
||||
@@ -108,7 +115,7 @@ public class MobAI {
|
||||
|
||||
//no weapons, default mob attack speed 3 seconds.
|
||||
|
||||
if (System.currentTimeMillis() < mob.getLastAttackTime())
|
||||
if (System.currentTimeMillis() < mob.getNextAttackTime())
|
||||
return;
|
||||
|
||||
// ranged mobs cant attack while running. skip until they finally stop.
|
||||
@@ -126,19 +133,19 @@ public class MobAI {
|
||||
int delay = 3000;
|
||||
if (mob.isSiege())
|
||||
delay = 11000;
|
||||
mob.setLastAttackTime(System.currentTimeMillis() + delay);
|
||||
mob.setNextAttackTime(System.currentTimeMillis() + delay);
|
||||
} else if (mob.getWeaponItemBase(true) != null) {
|
||||
int delay = 3000;
|
||||
if (mob.isSiege())
|
||||
delay = 11000;
|
||||
CombatUtilities.combatCycle(mob, target, true, mob.getWeaponItemBase(true));
|
||||
mob.setLastAttackTime(System.currentTimeMillis() + delay);
|
||||
mob.setNextAttackTime(System.currentTimeMillis() + delay);
|
||||
} else if (mob.getWeaponItemBase(false) != null) {
|
||||
int attackDelay = 3000;
|
||||
if (mob.isSiege())
|
||||
attackDelay = 11000;
|
||||
CombatUtilities.combatCycle(mob, target, false, mob.getWeaponItemBase(false));
|
||||
mob.setLastAttackTime(System.currentTimeMillis() + attackDelay);
|
||||
mob.setNextAttackTime(System.currentTimeMillis() + attackDelay);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,9 +163,12 @@ public class MobAI {
|
||||
|
||||
try {
|
||||
|
||||
if(mob == null || target == null)
|
||||
return;
|
||||
|
||||
if (target.getRank() == -1 || !target.isVulnerable() || BuildingManager.getBuildingFromCache(target.getObjectUUID()) == null) {
|
||||
mob.setCombatTarget(null);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
City playercity = ZoneManager.getCityAtLocation(mob.getLoc());
|
||||
@@ -166,7 +176,7 @@ public class MobAI {
|
||||
if (playercity != null)
|
||||
for (Mob guard : playercity.getParent().zoneMobSet)
|
||||
if (guard.BehaviourType != null && guard.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal())
|
||||
if (guard.getCombatTarget() == null && !guard.getGuild().equals(mob.getGuild()))
|
||||
if (guard.getCombatTarget() == null && guard.getGuild() != null && mob.getGuild() != null && !guard.getGuild().equals(mob.getGuild()))
|
||||
guard.setCombatTarget(mob);
|
||||
|
||||
if (mob.isSiege())
|
||||
@@ -180,26 +190,26 @@ public class MobAI {
|
||||
int delay = 3000;
|
||||
if (mob.isSiege())
|
||||
delay = 15000;
|
||||
mob.setLastAttackTime(System.currentTimeMillis() + delay);
|
||||
mob.setNextAttackTime(System.currentTimeMillis() + delay);
|
||||
} else if (mob.getWeaponItemBase(true) != null) {
|
||||
int attackDelay = 3000;
|
||||
if (mob.isSiege())
|
||||
attackDelay = 15000;
|
||||
CombatUtilities.combatCycle(mob, target, true, mob.getWeaponItemBase(true));
|
||||
mob.setLastAttackTime(System.currentTimeMillis() + attackDelay);
|
||||
mob.setNextAttackTime(System.currentTimeMillis() + attackDelay);
|
||||
} else if (mob.getWeaponItemBase(false) != null) {
|
||||
int attackDelay = 3000;
|
||||
if (mob.isSiege())
|
||||
attackDelay = 15000;
|
||||
CombatUtilities.combatCycle(mob, target, false, mob.getWeaponItemBase(false));
|
||||
mob.setLastAttackTime(System.currentTimeMillis() + attackDelay);
|
||||
mob.setNextAttackTime(System.currentTimeMillis() + attackDelay);
|
||||
}
|
||||
|
||||
if (mob.isSiege()) {
|
||||
PowerProjectileMsg ppm = new PowerProjectileMsg(mob, target);
|
||||
ppm.setRange(50);
|
||||
DispatchMessage.dispatchMsgToInterestArea(mob, ppm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
||||
}
|
||||
//if (mob.isSiege()) {
|
||||
// PowerProjectileMsg ppm = new PowerProjectileMsg(mob, target);
|
||||
// ppm.setRange(50);
|
||||
// DispatchMessage.dispatchMsgToInterestArea(mob, ppm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
||||
//}
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackBuilding" + " " + e.getMessage());
|
||||
@@ -223,19 +233,19 @@ public class MobAI {
|
||||
int delay = 3000;
|
||||
if (mob.isSiege())
|
||||
delay = 11000;
|
||||
mob.setLastAttackTime(System.currentTimeMillis() + delay);
|
||||
mob.setNextAttackTime(System.currentTimeMillis() + delay);
|
||||
} else if (mob.getWeaponItemBase(true) != null) {
|
||||
int attackDelay = 3000;
|
||||
if (mob.isSiege())
|
||||
attackDelay = 11000;
|
||||
CombatUtilities.combatCycle(mob, target, true, mob.getWeaponItemBase(true));
|
||||
mob.setLastAttackTime(System.currentTimeMillis() + attackDelay);
|
||||
mob.setNextAttackTime(System.currentTimeMillis() + attackDelay);
|
||||
} else if (mob.getWeaponItemBase(false) != null) {
|
||||
int attackDelay = 3000;
|
||||
if (mob.isSiege())
|
||||
attackDelay = 11000;
|
||||
CombatUtilities.combatCycle(mob, target, false, mob.getWeaponItemBase(false));
|
||||
mob.setLastAttackTime(System.currentTimeMillis() + attackDelay);
|
||||
mob.setNextAttackTime(System.currentTimeMillis() + attackDelay);
|
||||
if (target.getCombatTarget() == null) {
|
||||
target.setCombatTarget(mob);
|
||||
}
|
||||
@@ -400,7 +410,7 @@ public class MobAI {
|
||||
|
||||
PerformActionMsg msg;
|
||||
|
||||
if (!mobPower.isHarmful() || mobPower.targetSelf) {
|
||||
if (!mob.StrongholdCommander && !mob.StrongholdEpic && (!mobPower.isHarmful() || mobPower.targetSelf)) {
|
||||
PowersManager.useMobPower(mob, mob, mobPower, powerRank);
|
||||
msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, mob);
|
||||
} else {
|
||||
@@ -588,6 +598,9 @@ public class MobAI {
|
||||
|
||||
if (mob == null)
|
||||
return;
|
||||
if(mob.isAlive())
|
||||
if(!mob.getMovementLoc().equals(Vector3fImmutable.ZERO))
|
||||
mob.setLoc(mob.getMovementLoc());
|
||||
|
||||
if (mob.getTimestamps().containsKey("lastExecution") == false)
|
||||
mob.getTimestamps().put("lastExecution", System.currentTimeMillis());
|
||||
@@ -625,9 +638,6 @@ public class MobAI {
|
||||
|
||||
//check to send mob home for player guards to prevent exploit of dragging guards away and then teleporting
|
||||
|
||||
|
||||
CheckToSendMobHome(mob);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -646,6 +656,9 @@ public class MobAI {
|
||||
return;
|
||||
}
|
||||
|
||||
if(mob.isPet() == false && mob.isPlayerGuard == false)
|
||||
CheckToSendMobHome(mob);
|
||||
|
||||
if (mob.getCombatTarget() != null) {
|
||||
|
||||
if (mob.getCombatTarget().isAlive() == false) {
|
||||
@@ -854,16 +867,14 @@ public class MobAI {
|
||||
return;
|
||||
}
|
||||
//No items in inventory.
|
||||
} else if (aiAgent.isHasLoot()) {
|
||||
if (System.currentTimeMillis() > aiAgent.deathTime + MBServerStatics.DESPAWN_TIMER_ONCE_LOOTED) {
|
||||
aiAgent.despawn();
|
||||
aiAgent.deathTime = System.currentTimeMillis();
|
||||
return;
|
||||
}
|
||||
//Mob never had Loot.
|
||||
} else {
|
||||
//Mob's Loot has been looted.
|
||||
if (aiAgent.isHasLoot()) {
|
||||
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();
|
||||
@@ -871,11 +882,14 @@ public class MobAI {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (System.currentTimeMillis() > (aiAgent.deathTime + (aiAgent.spawnTime * 1000L))) {
|
||||
|
||||
if(Mob.discDroppers.contains(aiAgent))
|
||||
return;
|
||||
if(Mob.discDroppers.contains(aiAgent))
|
||||
return;
|
||||
|
||||
if(aiAgent.StrongholdGuardian || aiAgent.StrongholdEpic || aiAgent.StrongholdCommander)
|
||||
return;
|
||||
|
||||
if (System.currentTimeMillis() > (aiAgent.deathTime + (aiAgent.spawnTime * 1000L))) {
|
||||
if (!Zone.respawnQue.contains(aiAgent)) {
|
||||
Zone.respawnQue.add(aiAgent);
|
||||
}
|
||||
@@ -901,7 +915,7 @@ public class MobAI {
|
||||
mob.setCombatTarget(null);
|
||||
return;
|
||||
}
|
||||
if (System.currentTimeMillis() > mob.getLastAttackTime())
|
||||
if (System.currentTimeMillis() > mob.getNextAttackTime())
|
||||
AttackTarget(mob, mob.getCombatTarget());
|
||||
|
||||
} catch (Exception e) {
|
||||
@@ -911,12 +925,21 @@ public class MobAI {
|
||||
|
||||
private static void CheckToSendMobHome(Mob mob) {
|
||||
|
||||
if(mob.BehaviourType.equals(Enum.MobBehaviourType.Pet1)){
|
||||
if(mob.loc.distanceSquared(mob.getOwner().loc) > 60 * 60)
|
||||
mob.teleport(mob.getOwner().loc);
|
||||
if(mob.isNecroPet())
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
//trebs dont recall
|
||||
if(mob.isSiege())
|
||||
return;
|
||||
|
||||
if(mob.BehaviourType.equals(Enum.MobBehaviourType.Pet1)){
|
||||
if(mob.loc.distanceSquared(mob.getOwner().loc) > 60 * 60)
|
||||
mob.teleport(mob.getOwner().loc);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mob.BehaviourType.isAgressive) {
|
||||
|
||||
if (mob.isPlayerGuard()) {
|
||||
@@ -947,7 +970,7 @@ public class MobAI {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (MovementUtilities.inRangeOfBindLocation(mob) == false) {
|
||||
} else if (!MovementUtilities.inRangeOfBindLocation(mob)) {
|
||||
|
||||
PowersBase recall = PowersManager.getPowerByToken(-1994153779);
|
||||
PowersManager.useMobPower(mob, mob, recall, 40);
|
||||
@@ -955,6 +978,7 @@ public class MobAI {
|
||||
|
||||
for (Entry playerEntry : mob.playerAgroMap.entrySet())
|
||||
PlayerCharacter.getFromCache((int) playerEntry.getKey()).setHateValue(0);
|
||||
mob.setCombatTarget(null);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckToSendMobHome" + " " + e.getMessage());
|
||||
@@ -1031,9 +1055,22 @@ public class MobAI {
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkToDropGuardAggro(Mob mob){
|
||||
City city = mob.guardedCity;
|
||||
|
||||
if(city == null)
|
||||
return;
|
||||
if(mob.combatTarget == null)
|
||||
return;
|
||||
|
||||
if(city._playerMemory.contains(mob.combatTarget.getObjectUUID()) && mob.combatTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter))
|
||||
mob.setCombatTarget(null);
|
||||
}
|
||||
|
||||
public static void GuardCaptainLogic(Mob mob) {
|
||||
|
||||
try {
|
||||
checkToDropGuardAggro(mob);
|
||||
if (mob.getCombatTarget() == null)
|
||||
CheckForPlayerGuardAggro(mob);
|
||||
|
||||
@@ -1058,6 +1095,8 @@ public class MobAI {
|
||||
public static void GuardMinionLogic(Mob mob) {
|
||||
|
||||
try {
|
||||
checkToDropGuardAggro(mob);
|
||||
|
||||
boolean isComanded = mob.npcOwner.isAlive();
|
||||
if (!isComanded) {
|
||||
GuardCaptainLogic(mob);
|
||||
@@ -1078,6 +1117,8 @@ public class MobAI {
|
||||
public static void GuardWallArcherLogic(Mob mob) {
|
||||
|
||||
try {
|
||||
checkToDropGuardAggro(mob);
|
||||
|
||||
if (mob.getCombatTarget() == null)
|
||||
CheckForPlayerGuardAggro(mob);
|
||||
else
|
||||
@@ -1353,21 +1394,24 @@ public class MobAI {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void RecoverHealth(Mob mob){
|
||||
public static void RecoverHealth(Mob mob) {
|
||||
//recover health
|
||||
|
||||
if (mob.getTimestamps().containsKey("HEALTHRECOVERED") == false)
|
||||
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
|
||||
|
||||
if (mob.isSit() && mob.getTimeStamp("HEALTHRECOVERED") < System.currentTimeMillis() + 3000)
|
||||
if (mob.getHealth() < mob.getHealthMax()) {
|
||||
|
||||
float recoveredHealth = mob.getHealthMax() * ((1 + mob.getBonuses().getFloatPercentAll(Enum.ModType.HealthRecoverRate, Enum.SourceType.None)) * 0.01f);
|
||||
mob.setHealth(mob.getHealth() + recoveredHealth);
|
||||
try {
|
||||
if (mob.getTimestamps().containsKey("HEALTHRECOVERED") == false)
|
||||
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
|
||||
|
||||
if (mob.getHealth() > mob.getHealthMax())
|
||||
mob.setHealth(mob.getHealthMax());
|
||||
}
|
||||
if (mob.isSit() && mob.getTimeStamp("HEALTHRECOVERED") < System.currentTimeMillis() + 3000)
|
||||
if (mob.getHealth() < mob.getHealthMax()) {
|
||||
|
||||
float recoveredHealth = mob.getHealthMax() * ((1 + mob.getBonuses().getFloatPercentAll(Enum.ModType.HealthRecoverRate, Enum.SourceType.None)) * 0.01f);
|
||||
mob.setHealth(mob.getHealth() + recoveredHealth);
|
||||
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
|
||||
|
||||
if (mob.getHealth() > mob.getHealthMax())
|
||||
mob.setHealth(mob.getHealthMax());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: RecoverHealth" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package engine.mobileAI.Threads;
|
||||
|
||||
import engine.gameManager.ConfigManager;
|
||||
import engine.mobileAI.EasyAI;
|
||||
import engine.mobileAI.MobAI;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.objects.Mob;
|
||||
@@ -33,7 +34,7 @@ public class MobAIThread implements Runnable{
|
||||
|
||||
try {
|
||||
if (mob != null)
|
||||
MobAI.DetermineAction(mob);
|
||||
EasyAI.aiRun(mob);
|
||||
} catch (Exception e) {
|
||||
Logger.error("Mob: " + mob.getName() + " UUID: " + mob.getObjectUUID() + " ERROR: " + e);
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package engine.mobileAI;
|
||||
|
||||
import engine.objects.Mob;
|
||||
|
||||
public enum enumMobState {
|
||||
idle,
|
||||
attacking,
|
||||
patrolling,
|
||||
dead;
|
||||
|
||||
public static enumMobState getState(Mob mob){
|
||||
if(mob.playerAgroMap.isEmpty())
|
||||
return enumMobState.idle;
|
||||
|
||||
if(!mob.isAlive())
|
||||
return enumMobState.dead;
|
||||
|
||||
if(mob.combatTarget != null)
|
||||
return enumMobState.attacking;
|
||||
|
||||
return enumMobState.patrolling;
|
||||
}
|
||||
|
||||
public static boolean Agressive(Mob mob){
|
||||
return mob.BehaviourType.name().contains("Aggro");
|
||||
}
|
||||
}
|
||||
@@ -139,37 +139,22 @@ public class CombatUtilities {
|
||||
}
|
||||
|
||||
public static boolean triggerDefense(Mob agent, AbstractWorldObject target) {
|
||||
int defenseScore = 0;
|
||||
int attackScore = agent.getAtrHandOne();
|
||||
int defense = 0;
|
||||
int atr = agent.getAtrHandOne();
|
||||
switch (target.getObjectType()) {
|
||||
case PlayerCharacter:
|
||||
defenseScore = ((AbstractCharacter) target).getDefenseRating();
|
||||
defense = ((AbstractCharacter) target).getDefenseRating();
|
||||
break;
|
||||
case Mob:
|
||||
|
||||
Mob mob = (Mob) target;
|
||||
if (mob.isSiege())
|
||||
defenseScore = attackScore;
|
||||
defense = atr;
|
||||
break;
|
||||
case Building:
|
||||
return false;
|
||||
}
|
||||
|
||||
int hitChance;
|
||||
if (attackScore > defenseScore || defenseScore == 0)
|
||||
hitChance = 94;
|
||||
else if (attackScore == defenseScore && target.getObjectType() == GameObjectType.Mob)
|
||||
hitChance = 10;
|
||||
else {
|
||||
float dif = attackScore / defenseScore;
|
||||
if (dif <= 0.8f)
|
||||
hitChance = 4;
|
||||
else
|
||||
hitChance = ((int) (450 * (dif - 0.8f)) + 4);
|
||||
if (target.getObjectType() == GameObjectType.Building)
|
||||
hitChance = 100;
|
||||
}
|
||||
return ThreadLocalRandom.current().nextInt(100) > hitChance;
|
||||
return !CombatManager.LandHit(atr,defense);
|
||||
}
|
||||
|
||||
public static boolean triggerBlock(Mob agent, AbstractWorldObject ac) {
|
||||
|
||||
@@ -83,7 +83,7 @@ public class MovementUtilities {
|
||||
|
||||
}
|
||||
|
||||
public static boolean inRangeToAggro(Mob agent, PlayerCharacter target) {
|
||||
public static boolean inRangeToAggro(Mob agent, AbstractCharacter target) {
|
||||
|
||||
Vector3fImmutable sl = agent.getLoc();
|
||||
Vector3fImmutable tl = target.getLoc();
|
||||
@@ -169,6 +169,9 @@ public class MovementUtilities {
|
||||
if (agent.getMobBase() != null && Enum.MobFlagType.SENTINEL.elementOf(agent.getMobBase().getFlags()))
|
||||
return false;
|
||||
|
||||
if(!agent.BehaviourType.canRoam)
|
||||
return false;
|
||||
|
||||
return (agent.isAlive() && !agent.getBonuses().getBool(ModType.Stunned, SourceType.None) && !agent.getBonuses().getBool(ModType.CannotMove, SourceType.None));
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@ import engine.exception.FactoryBuildException;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.net.client.msg.ErrorPopupMsg;
|
||||
import engine.net.client.msg.PlaceAssetMsg;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.joda.time.DateTime;
|
||||
@@ -94,11 +96,9 @@ public class NetMsgFactory {
|
||||
if (origin instanceof ClientConnection) {
|
||||
PlayerCharacter player = ((ClientConnection) origin).getPlayerCharacter();
|
||||
if (player != null) {
|
||||
// if (MBServerStatics.worldServerName.equals("Grief"))
|
||||
Logger.error("Invalid protocol msg for player " + player.getFirstName() + " : " + opcode + " lastopcode: " + origin.lastProtocol.name() + " Error Code : " + errorCode);
|
||||
} else
|
||||
Logger.error("Invalid protocol msg : " + opcode + " lastopcode: " + origin.lastProtocol.name() + " Error Code : " + errorCode);
|
||||
|
||||
PlaceAssetMsg.sendPlaceAssetError(player.getClientConnection(), 1, "Please Report What You Just Did. Ref Code: " + opcode);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -85,7 +85,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
if (pc == null)
|
||||
return;
|
||||
|
||||
pc.update();
|
||||
pc.update(false);
|
||||
if (msg.getSpeed() == 2)
|
||||
pc.setWalkMode(false);
|
||||
else
|
||||
@@ -114,7 +114,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
if (pc == null)
|
||||
return;
|
||||
|
||||
pc.update();
|
||||
pc.update(false);
|
||||
|
||||
pc.setSit(msg.toggleSitStand());
|
||||
|
||||
@@ -672,6 +672,8 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
JobScheduler.getInstance().scheduleJob(new RefreshGroupJob(sourcePlayer), MBServerStatics.LOAD_OBJECT_DELAY);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static void lootWindowRequest(LootWindowRequestMsg msg, ClientConnection origin) throws MsgSendException {
|
||||
|
||||
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
|
||||
@@ -1363,18 +1365,12 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
|
||||
NPC npc = NPC.getFromCache(msg.getNpcID());
|
||||
|
||||
|
||||
switch(npc.getContractID()){
|
||||
case 900:
|
||||
case 1201:
|
||||
case 1202:
|
||||
npc.sellPercent = 0.0f;
|
||||
break;
|
||||
}
|
||||
if (npc == null)
|
||||
return;
|
||||
|
||||
// test within talking range
|
||||
if(npc.isInSafeZone())
|
||||
npc.sellPercent = 0;
|
||||
|
||||
if (sourcePlayer.getLoc().distanceSquared2D(npc.getLoc()) > MBServerStatics.NPC_TALK_RANGE * MBServerStatics.NPC_TALK_RANGE) {
|
||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 14);
|
||||
@@ -1406,6 +1402,12 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
Item buy = null;
|
||||
if (msg.getItemType() == GameObjectType.MobEquipment.ordinal()) {
|
||||
ArrayList<MobEquipment> sellInventory = npc.getContract().getSellInventory();
|
||||
//if(npc.contract.getObjectUUID() == 890){ // default steward
|
||||
// sellInventory = npc.getSellInventorySteward();
|
||||
//}
|
||||
//if(npc.contract.getObjectUUID() == 889){ // default builder
|
||||
// sellInventory = npc.getSellInventoryBuilder();
|
||||
//}
|
||||
if (sellInventory == null) {
|
||||
return;
|
||||
}
|
||||
@@ -1435,14 +1437,17 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
bargain = 0;
|
||||
break;
|
||||
}
|
||||
float profit = npc.getSellPercent(sourcePlayer) - bargain;
|
||||
if(me.getItemBase().getType().equals(ItemType.POTION))
|
||||
profit -= 1.0f;
|
||||
if (profit < 1)
|
||||
profit = 1;
|
||||
cost *= profit;
|
||||
if(npc.getContractID() == 1502041)
|
||||
cost = 2;
|
||||
float profit;
|
||||
|
||||
if(npc.isInSafeZone())
|
||||
profit = 0;
|
||||
else
|
||||
profit = npc.getSellPercent(sourcePlayer) - bargain;
|
||||
|
||||
|
||||
if(profit > 0)
|
||||
cost *= profit;
|
||||
|
||||
if (gold.getNumOfItems() - cost < 0) {
|
||||
//dont' have enough goldItem exit!
|
||||
// chatMan.chatSystemInfo(pc, "" + "You dont have enough gold.");
|
||||
@@ -1455,8 +1460,9 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
if (b != null && (b.getStrongboxValue() + buildingDeposit) > b.getMaxGold() && !b.isOwnerIsNPC()) {
|
||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 206);
|
||||
return;
|
||||
}
|
||||
if (!itemMan.buyFromNPC(b, cost, buildingDeposit)) {
|
||||
}if(npc.getContractID() == 1502041){
|
||||
me.fromNoob = true;
|
||||
} else if (!itemMan.buyFromNPC(b, cost, buildingDeposit)) {
|
||||
// chatMan.chatSystemInfo(pc, "" + "You Failed to buy the item.");
|
||||
ChatManager.chatSystemError(sourcePlayer, "Failed To Buy Item");
|
||||
return;
|
||||
@@ -1675,8 +1681,12 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
int cost = (int)((toRepair.getMagicValue()/max*(max - dur)) + (npc.getRepairCost() * npc.buyPercent));
|
||||
|
||||
int pointsToRepair = max - dur;
|
||||
double damageRatio = (double)1.0d - (toRepair.getDurabilityMax() - toRepair.getDurabilityCurrent()) / toRepair.getDurabilityMax();
|
||||
int modifiedValue = (int)(damageRatio * toRepair.getMagicValue());
|
||||
int costPerPoint = modifiedValue / toRepair.getDurabilityMax();
|
||||
int modifiedRepairCost = (int)(pointsToRepair * costPerPoint)+ npc.getSpecialPrice();
|
||||
int cost = (int)(modifiedRepairCost * 1 + npc.buyPercent) + npc.getSpecialPrice();
|
||||
Building b = (!npc.isStatic()) ? npc.getBuilding() : null;
|
||||
|
||||
if (b != null)
|
||||
|
||||
@@ -47,13 +47,16 @@ public class ChangeAltitudeHandler extends AbstractClientMsgHandler {
|
||||
if (pc.region != null && !pc.region.isOutside())
|
||||
return false;
|
||||
|
||||
|
||||
// Find out if we already have an altitude timer running and if so
|
||||
// do not process more alt change requests
|
||||
|
||||
pc.updateFlight();
|
||||
|
||||
if (pc.getTakeOffTime() != 0)
|
||||
return false;
|
||||
|
||||
pc.setTakeOffTime(System.currentTimeMillis());
|
||||
|
||||
|
||||
// remove all movement timers and jobs
|
||||
//TODO: test if they can fly
|
||||
@@ -67,7 +70,7 @@ public class ChangeAltitudeHandler extends AbstractClientMsgHandler {
|
||||
if (pc.getAltitude() == 0 && !msg.up())
|
||||
return true;
|
||||
|
||||
pc.update();
|
||||
pc.update(false);
|
||||
pc.stopMovement(pc.getLoc());
|
||||
msg.setStartAlt(pc.getAltitude());
|
||||
if (msg.up()) {
|
||||
@@ -132,7 +135,7 @@ public class ChangeAltitudeHandler extends AbstractClientMsgHandler {
|
||||
}
|
||||
|
||||
if (msg.up()) {
|
||||
pc.update();
|
||||
pc.update(false);
|
||||
pc.setDesiredAltitude(targetAlt);
|
||||
pc.setTakeOffTime(System.currentTimeMillis());
|
||||
} else {
|
||||
@@ -158,7 +161,7 @@ public class ChangeAltitudeHandler extends AbstractClientMsgHandler {
|
||||
} else
|
||||
pc.setDesiredAltitude(targetAlt);
|
||||
|
||||
pc.update();
|
||||
pc.update(false);
|
||||
|
||||
|
||||
pc.setTakeOffTime(System.currentTimeMillis());
|
||||
|
||||
@@ -62,7 +62,7 @@ public class DestroyBuildingHandler extends AbstractClientMsgHandler {
|
||||
if (city != null)
|
||||
bane = city.getBane();
|
||||
|
||||
if (bane != null && bane.getSiegePhase() == Enum.SiegePhase.WAR) {
|
||||
if (bane != null){// && bane.getSiegePhase() == Enum.SiegePhase.WAR) {
|
||||
ErrorPopupMsg.sendErrorPopup(pc, 171);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public class GroupInviteResponseHandler extends AbstractClientMsgHandler {
|
||||
|
||||
// Run Keyclone Audit
|
||||
|
||||
KEYCLONEAUDIT.audit(player, group);
|
||||
//KEYCLONEAUDIT.audit(player, group);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class HirelingServiceMsgHandler extends AbstractClientMsgHandler {
|
||||
return true;
|
||||
|
||||
|
||||
npc.setRepairCost(msg.repairCost);
|
||||
npc.setSpecialPrice(msg.repairCost);
|
||||
ManageNPCMsg outMsg = new ManageNPCMsg(npc);
|
||||
Dispatch dispatch = Dispatch.borrow(player, msg);
|
||||
|
||||
|
||||
@@ -360,6 +360,11 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
|
||||
targetItem.recycle(vendor);
|
||||
vendor.removeItemFromForge(targetItem);
|
||||
|
||||
//refund the gold for cancelled item
|
||||
if(vendor.building.getStrongboxValue() + targetItem.getItemBase().getBaseValue() < 15000000){
|
||||
vendor.building.setStrongboxValue(vendor.building.getStrongboxValue() + targetItem.getItemBase().getBaseValue());
|
||||
}
|
||||
|
||||
// Refresh vendor's inventory to client
|
||||
|
||||
outMsg = new ManageNPCMsg(vendor);
|
||||
|
||||
@@ -62,16 +62,23 @@ public class MOTDEditHandler extends AbstractClientMsgHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (type == 1) // Guild MOTD
|
||||
if (type == 1) { // Guild MOTD
|
||||
msg.setMessage(guild.getMOTD());
|
||||
else if (type == 3) // IC MOTD
|
||||
guild.updateDatabase();
|
||||
}else if (type == 3) { // IC MOTD
|
||||
msg.setMessage(guild.getICMOTD());
|
||||
else if (type == 0) { // Nation MOTD
|
||||
guild.updateDatabase();
|
||||
}else if (type == 0) { // Nation MOTD
|
||||
Guild nation = guild.getNation();
|
||||
if (nation == null || !nation.isNation()) {
|
||||
ErrorPopupMsg.sendErrorMsg(playerCharacter, "You do not have such authority!");
|
||||
return true;
|
||||
}
|
||||
nation.setNMOTD(msg.getMessage());
|
||||
nation.updateDatabase();
|
||||
for(Guild sub : nation.getSubGuildList()){
|
||||
sub.setNMOTD(nation.getNMOTD());
|
||||
}
|
||||
msg.setMessage(nation.getMOTD());
|
||||
}
|
||||
dispatch = Dispatch.borrow(playerCharacter, msg);
|
||||
|
||||
@@ -193,31 +193,28 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
||||
int trains = 0;
|
||||
switch(npc.getRank()){
|
||||
case 1:
|
||||
trains = 5;
|
||||
break;
|
||||
case 2:
|
||||
trains = 10;
|
||||
break;
|
||||
case 3:
|
||||
case 2:
|
||||
trains = 15;
|
||||
break;
|
||||
case 4:
|
||||
case 3:
|
||||
trains = 20;
|
||||
break;
|
||||
case 5:
|
||||
case 4:
|
||||
trains = 25;
|
||||
break;
|
||||
case 6:
|
||||
case 5:
|
||||
trains = 30;
|
||||
break;
|
||||
case 7:
|
||||
case 6:
|
||||
trains = 35;
|
||||
break;
|
||||
case 7:
|
||||
trains = 40;
|
||||
break;
|
||||
}
|
||||
|
||||
if(Objects.requireNonNull(shrineBuilding.getCity()).getTOL() != null && shrineBuilding.getCity().getTOL().getRank() == 8)
|
||||
trains += 5;
|
||||
|
||||
PowersManager.applyPower(player, player, player.getLoc(), shrinePower.getToken(), trains, false);
|
||||
ChatManager.chatGuildInfo(player.getGuild(), player.getName() + " has recieved a boon costing " + 1 + " point of favor.");
|
||||
shrineBuilding.addEffectBit(1000000 << 2);
|
||||
@@ -277,60 +274,85 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
||||
}
|
||||
}
|
||||
|
||||
if (targetCity == null)
|
||||
return;
|
||||
|
||||
//verify level required to teleport or repledge
|
||||
|
||||
Guild toGuild = targetCity.getGuild();
|
||||
|
||||
if (toGuild != null)
|
||||
if (isTeleport) {
|
||||
if (player.getLevel() < toGuild.getTeleportMin() || player.getLevel() > toGuild.getTeleportMax())
|
||||
return;
|
||||
} else if (player.getLevel() < toGuild.getRepledgeMin() || player.getLevel() > toGuild.getRepledgeMax())
|
||||
if (targetCity == null){
|
||||
Mine mineTele = null;
|
||||
for(Mine mine : Mine.getMinesToTeleportTo(player)){
|
||||
if(mine.getObjectUUID() == msg.getCityID()){
|
||||
mineTele = mine;
|
||||
}
|
||||
}
|
||||
if(mineTele == null){
|
||||
return;
|
||||
}else {
|
||||
int time = MBServerStatics.TELEPORT_TIME_IN_SECONDS;
|
||||
msg.setTeleportTime(time);
|
||||
Building tower = Mine.getTower(mineTele);
|
||||
if (tower == null)
|
||||
return;
|
||||
Vector3fImmutable teleportLoc = Vector3fImmutable.getRandomPointOnCircle(tower.getLoc(), 10);
|
||||
ChatManager.chatSystemInfo(player, "You Will Teleport To " + mineTele.getParentZone().getParent().getName() + "'s Mine In " + time + " Seconds.");
|
||||
if (time > 0) {
|
||||
//TODO add timer to teleport
|
||||
TeleportJob tj = new TeleportJob(player, npc, teleportLoc, origin, true);
|
||||
JobScheduler.getInstance().scheduleJob(tj, time * 1000);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
//finish porting to a city
|
||||
//verify level required to teleport or repledge
|
||||
|
||||
boolean joinedGuild = false;
|
||||
Guild toGuild = targetCity.getGuild();
|
||||
|
||||
//if repledge, reguild the player
|
||||
if (toGuild != null)
|
||||
if (isTeleport) {
|
||||
if (player.getLevel() < toGuild.getTeleportMin() || player.getLevel() > toGuild.getTeleportMax())
|
||||
return;
|
||||
} else if (player.getLevel() < toGuild.getRepledgeMin() || player.getLevel() > toGuild.getRepledgeMax())
|
||||
return;
|
||||
|
||||
if (!isTeleport)
|
||||
joinedGuild = GuildManager.joinGuild(player, targetCity.getGuild(), targetCity.getObjectUUID(), GuildHistoryType.JOIN);
|
||||
boolean joinedGuild = false;
|
||||
|
||||
int time;
|
||||
//if repledge, reguild the player
|
||||
|
||||
if (!isTeleport) //repledge
|
||||
time = MBServerStatics.REPLEDGE_TIME_IN_SECONDS;
|
||||
else
|
||||
time = MBServerStatics.TELEPORT_TIME_IN_SECONDS;
|
||||
if (!isTeleport)
|
||||
joinedGuild = GuildManager.joinGuild(player, targetCity.getGuild(), targetCity.getObjectUUID(), GuildHistoryType.JOIN);
|
||||
|
||||
//resend message
|
||||
msg.setTeleportTime(time);
|
||||
int time;
|
||||
|
||||
if ((!isTeleport && joinedGuild) || (isTeleport)) {
|
||||
if (!isTeleport) //repledge
|
||||
time = MBServerStatics.REPLEDGE_TIME_IN_SECONDS;
|
||||
else
|
||||
time = MBServerStatics.TELEPORT_TIME_IN_SECONDS;
|
||||
|
||||
dispatch = Dispatch.borrow(player, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||
//resend message
|
||||
msg.setTeleportTime(time);
|
||||
|
||||
if ((!isTeleport && joinedGuild) || (isTeleport)) {
|
||||
|
||||
dispatch = Dispatch.borrow(player, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
//teleport player to city
|
||||
|
||||
Vector3fImmutable teleportLoc;
|
||||
|
||||
if (targetCity.getTOL().getRank() == 8)
|
||||
teleportLoc = targetCity.getTOL().getStuckLocation();
|
||||
else
|
||||
teleportLoc = Vector3fImmutable.getRandomPointOnCircle(targetCity.getTOL().getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS);
|
||||
|
||||
if (time > 0) {
|
||||
//TODO add timer to teleport
|
||||
TeleportJob tj = new TeleportJob(player, npc, teleportLoc, origin, true);
|
||||
JobScheduler.getInstance().scheduleJob(tj, time * 1000);
|
||||
} else if (joinedGuild) {
|
||||
player.teleport(teleportLoc);
|
||||
player.setSafeMode();
|
||||
}
|
||||
}
|
||||
|
||||
//teleport player to city
|
||||
|
||||
Vector3fImmutable teleportLoc;
|
||||
|
||||
if (targetCity.getTOL().getRank() == 8)
|
||||
teleportLoc = targetCity.getTOL().getStuckLocation();
|
||||
else
|
||||
teleportLoc = Vector3fImmutable.getRandomPointOnCircle(targetCity.getTOL().getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS);
|
||||
|
||||
if (time > 0) {
|
||||
//TODO add timer to teleport
|
||||
TeleportJob tj = new TeleportJob(player, npc, teleportLoc, origin, true);
|
||||
JobScheduler.getInstance().scheduleJob(tj, time * 1000);
|
||||
} else if (joinedGuild) {
|
||||
player.teleport(teleportLoc);
|
||||
player.setSafeMode();
|
||||
}
|
||||
}
|
||||
|
||||
private static PowersBase getPowerforHermit(NPC npc) {
|
||||
|
||||
@@ -443,7 +443,12 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
||||
itemMan.consume(item);
|
||||
}
|
||||
break;
|
||||
} else if (uuid > 252122 && uuid < 252128) { //mastery runes
|
||||
} else if (uuid > 252122 && uuid < 252137) { //blood runes
|
||||
if (ApplyRuneMsg.applyRune(uuid, origin, player)) {
|
||||
itemMan.consume(item);
|
||||
}
|
||||
break;
|
||||
} else if (uuid > 252128 && uuid < 252128) { //mastery runes
|
||||
if (ApplyRuneMsg.applyRune(uuid, origin, player)) {
|
||||
itemMan.consume(item);
|
||||
}
|
||||
@@ -523,7 +528,9 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
dispatch = Dispatch.borrow(player, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||
player.cancelOnSpell();
|
||||
if(!item.getItemBase().getType().equals(ItemType.POTION)) {
|
||||
player.cancelOnSpell();
|
||||
}
|
||||
break;
|
||||
default: //shouldn't be here, consume item
|
||||
dispatch = Dispatch.borrow(player, msg);
|
||||
|
||||
@@ -135,7 +135,8 @@ public class TaxCityMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
msg = (TaxCityMsg) baseMsg;
|
||||
|
||||
ViewTaxes(msg, player);
|
||||
//realm taxing disabled
|
||||
//ViewTaxes(msg, player);
|
||||
|
||||
|
||||
return true;
|
||||
|
||||
@@ -90,12 +90,39 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
||||
}
|
||||
if(runeID == 3040)
|
||||
valid = true;
|
||||
if(runeID == 2514 && raceID == 1999)
|
||||
valid = true;
|
||||
if(runeID == 3036 && raceID == 1999)
|
||||
valid = true;
|
||||
if(runeID == 3033 && raceID == 1999)
|
||||
|
||||
if(runeID == 3049)
|
||||
valid = true;
|
||||
|
||||
if(raceID == 1999){
|
||||
switch(runeID){
|
||||
case 2514:
|
||||
case 3036:
|
||||
case 3033:
|
||||
case 3001:
|
||||
case 3002:
|
||||
case 3003:
|
||||
case 3004:
|
||||
case 3008:
|
||||
case 3009:
|
||||
case 3013:
|
||||
case 3016:
|
||||
case 3017:
|
||||
case 3018:
|
||||
case 3020:
|
||||
case 3021:
|
||||
case 3030:
|
||||
case 3031:
|
||||
case 3037:
|
||||
case 3045:
|
||||
case 3046:
|
||||
case 3047:
|
||||
case 3048:
|
||||
case 3049:
|
||||
valid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
@@ -119,6 +146,8 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
||||
valid = true;
|
||||
if(runeID == 3035 && baseClassID == 2501)
|
||||
valid = true;
|
||||
if(runeID == 3028 && baseClassID == 2501 && playerCharacter.getRace().getName().contains("Irekei"))
|
||||
valid = true;
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
@@ -127,6 +156,7 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
||||
ConcurrentHashMap<Integer, Boolean> promotionClasses = rb.getPromotionClass();
|
||||
if (promotionClasses.size() > 0) {
|
||||
int promotionClassID = playerCharacter.getPromotionClassID();
|
||||
int baseClassID = playerCharacter.getBaseClassID();
|
||||
boolean valid = false;
|
||||
for (int validID : promotionClasses.keySet()) {
|
||||
if (validID == promotionClassID) {
|
||||
@@ -142,6 +172,10 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
||||
valid = true;
|
||||
if(runeID == 3033 && raceID == 1999)
|
||||
valid = true;
|
||||
if(runeID == 3028 && (raceID == 2013 || raceID == 2014) && playerCharacter.getBaseClassID() == 2501)
|
||||
valid = true;
|
||||
if(runeID == 3035 && baseClassID == 2501)
|
||||
valid = true;
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
@@ -200,6 +234,9 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
||||
case "Born of the Gwendannen":
|
||||
case "Born of the Invorri":
|
||||
case "Born of the Irydnu":
|
||||
case "Scion of the Dar Khelegeur":
|
||||
case "Scion of the Gwaridorn":
|
||||
case "Scion of the Twathedilion":
|
||||
mod = 0;
|
||||
}
|
||||
if (mod > playerCharacter.getUnusedStatPoints()) {
|
||||
@@ -256,6 +293,7 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
||||
}
|
||||
//Check if max number runes already reached
|
||||
if (runes.size() > 12) {
|
||||
ChatManager.chatSystemInfo(playerCharacter,"You Have Too Many Runes Applied");
|
||||
return false;
|
||||
}
|
||||
switch (rb.getName()) {
|
||||
@@ -276,19 +314,39 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "Scion of the Dar Khelegeur":
|
||||
case "Scion of the Gwaridorn":
|
||||
case "Scion of the Twathedilion":
|
||||
for (CharacterRune charRune : playerCharacter.getRunes()) {
|
||||
RuneBase rb2 = charRune.getRuneBase();
|
||||
switch (rb2.getName()) {
|
||||
case "Scion of the Dar Khelegeur":
|
||||
case "Scion of the Gwaridorn":
|
||||
case "Scion of the Twathedilion":
|
||||
ChatManager.chatSystemError(playerCharacter, "You Have Already Applied A Blood Rune");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
//if discipline, check number applied
|
||||
if (isDiscipline(runeID)) {
|
||||
//if(playerCharacter.getLevel() == 80)
|
||||
discCount -= 1; // level 80 characters get an extra disc rune
|
||||
if (playerCharacter.getLevel() < 70) {
|
||||
if (discCount > 2) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (discCount > 3) {
|
||||
return false;
|
||||
}
|
||||
switch(playerCharacter.getRank()){
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
if(discCount > 3)
|
||||
return false;
|
||||
break;
|
||||
case 7:
|
||||
case 8:
|
||||
if(discCount > 5)
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//Everything succeeded. Let's apply the rune
|
||||
@@ -351,6 +409,9 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
||||
case "Born of the Gwendannen":
|
||||
case "Born of the Invorri":
|
||||
case "Born of the Irydnu":
|
||||
case "Scion of the Dar Khelegeur":
|
||||
case "Scion of the Gwaridorn":
|
||||
case "Scion of the Twathedilion":
|
||||
cost = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -112,6 +112,12 @@ public class BuyFromNPCWindowMsg extends ClientNetMsg {
|
||||
|
||||
if (contract != null)
|
||||
sellInventory = contract.getSellInventory();
|
||||
//if(npc.contract.getObjectUUID() == 890){ // default steward
|
||||
// sellInventory = npc.getSellInventorySteward();
|
||||
// }
|
||||
//if(npc.contract.getObjectUUID() == 889){ // default builder
|
||||
// sellInventory = npc.getSellInventoryBuilder();
|
||||
// }
|
||||
}
|
||||
|
||||
if (man != null)
|
||||
|
||||
@@ -392,9 +392,9 @@ public class ManageCityAssetsMsg extends ClientNetMsg {
|
||||
writer.putInt(bane.getSiegePhase().ordinal()); //1 challenge //2 standoff //3 war
|
||||
writer.put((byte) 0);
|
||||
|
||||
if (!bane.isAccepted() && this.assetManager.getGuild() == banedCity.getGuild() && GuildStatusController.isInnerCouncil(this.assetManager.getGuildStatus()))
|
||||
writer.put((byte) 1); //canSetTime
|
||||
else
|
||||
//if (!bane.isAccepted() && this.assetManager.getGuild() == banedCity.getGuild() && GuildStatusController.isInnerCouncil(this.assetManager.getGuildStatus()))
|
||||
// writer.put((byte) 1); //canSetTime
|
||||
//else
|
||||
writer.put((byte) 0);
|
||||
|
||||
DateTime placedOn = bane.getLiveDate();
|
||||
@@ -485,13 +485,7 @@ public class ManageCityAssetsMsg extends ClientNetMsg {
|
||||
|
||||
writer.putInt(building.getRank());
|
||||
|
||||
// Maintenance costs include resource if
|
||||
// this structure is an R8 tree
|
||||
|
||||
if (building.getRank() == 8)
|
||||
writer.putInt(5); // Resources included
|
||||
else
|
||||
writer.putInt(1); // Gold only
|
||||
writer.putInt(1); // Gold only
|
||||
|
||||
writer.putInt(2308551); //Gold
|
||||
if (building.getBlueprint() == null)
|
||||
@@ -499,17 +493,6 @@ public class ManageCityAssetsMsg extends ClientNetMsg {
|
||||
else
|
||||
writer.putInt(building.getBlueprint().getMaintCost()); // maint cost
|
||||
|
||||
if (building.getRank() == 8) {
|
||||
writer.putInt(74856115); // Stone
|
||||
writer.putInt(1500); // maint cost
|
||||
writer.putInt(-1603256692); // Lumber
|
||||
writer.putInt(1500); // maint cost
|
||||
writer.putInt(-1596311545); // Galvor
|
||||
writer.putInt(5); // maint cost
|
||||
writer.putInt(1532478436); // Wormwood
|
||||
writer.putInt(5); // maint cost
|
||||
}
|
||||
|
||||
LocalDateTime maintDate = building.maintDateTime;
|
||||
|
||||
if (maintDate == null)
|
||||
|
||||
@@ -503,7 +503,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
||||
writer.putInt(0);
|
||||
writer.putString("Repair items");
|
||||
writer.putString("percent");
|
||||
writer.putInt(npc.getRepairCost()); //cost for repair
|
||||
writer.putInt(npc.getSpecialPrice()); //cost for repair
|
||||
writer.putInt(0);
|
||||
|
||||
ArrayList<Integer> modPrefixList = npc.getModTypeTable();
|
||||
|
||||
@@ -16,7 +16,9 @@ import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.City;
|
||||
import engine.objects.Mine;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -24,6 +26,7 @@ import java.util.ArrayList;
|
||||
public class TeleportRepledgeListMsg extends ClientNetMsg {
|
||||
|
||||
ArrayList<City> cities;
|
||||
ArrayList<Mine> mines;
|
||||
private PlayerCharacter player;
|
||||
private boolean isTeleport;
|
||||
|
||||
@@ -77,10 +80,19 @@ public class TeleportRepledgeListMsg extends ClientNetMsg {
|
||||
|
||||
public void configure() {
|
||||
|
||||
if (isTeleport)
|
||||
if (isTeleport) {
|
||||
cities = City.getCitiesToTeleportTo(player);
|
||||
else
|
||||
try {
|
||||
mines = Mine.getMinesToTeleportTo(player);
|
||||
if(mines == null)
|
||||
mines = new ArrayList<>();
|
||||
}catch(Exception e){
|
||||
Logger.error("Unable To Load Mines For Teleport: " + e.getMessage());
|
||||
}
|
||||
}else {
|
||||
cities = City.getCitiesToRepledgeTo(player);
|
||||
mines = new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,10 +108,14 @@ public class TeleportRepledgeListMsg extends ClientNetMsg {
|
||||
for (int i = 0; i < 3; i++)
|
||||
writer.putInt(0);
|
||||
|
||||
writer.putInt(cities.size());
|
||||
writer.putInt(cities.size() + mines.size());
|
||||
|
||||
for (City city : cities)
|
||||
City.serializeForClientMsg(city, writer);
|
||||
|
||||
for(Mine mine : mines)
|
||||
Mine.serializeForClientMsgTeleport(mine, writer);
|
||||
|
||||
}
|
||||
|
||||
public PlayerCharacter getPlayer() {
|
||||
|
||||
@@ -96,11 +96,6 @@ public class VendorDialogMsg extends ClientNetMsg {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(npc.contractUUID == 1502040){ //enrollment officer
|
||||
PlayerCharacter.unboxPlayer(playerCharacter);
|
||||
}
|
||||
|
||||
// Restrict disc trainers to only characters who have
|
||||
// tht disc applied.
|
||||
|
||||
@@ -119,26 +114,36 @@ public class VendorDialogMsg extends ClientNetMsg {
|
||||
|
||||
VendorDialog vd = null;
|
||||
Contract contract = npc.getContract();
|
||||
if(npc.contractUUID == 1502043){
|
||||
vd = Contract.HandleArenaMaster(msg.unknown03,npc,playerCharacter);
|
||||
msg.updateMessage(3, vd);
|
||||
}else if(npc.contractUUID == 1502040){ //enrollment officer
|
||||
//PlayerCharacter.unboxPlayer(playerCharacter);
|
||||
vd = Contract.HandleEnrollmentOfficer(msg.unknown03,npc,playerCharacter);
|
||||
msg.updateMessage(3, vd);
|
||||
}else if(contract.getContractID() == 1502042){
|
||||
vd = Contract.HandleBaneCommanderOptions(msg.unknown03, npc, playerCharacter);
|
||||
msg.updateMessage(3, vd);
|
||||
}else {
|
||||
|
||||
if (contract == null)
|
||||
vd = VendorDialog.getHostileVendorDialog();
|
||||
else if (npc.getBuilding() != null) {
|
||||
if (BuildingManager.IsPlayerHostile(npc.getBuilding(), playerCharacter))
|
||||
if (contract == null)
|
||||
vd = VendorDialog.getHostileVendorDialog();
|
||||
else
|
||||
else if (npc.getBuilding() != null) {
|
||||
if (npc.getBuilding() != null && BuildingManager.IsPlayerHostile(npc.getBuilding(), playerCharacter))
|
||||
vd = VendorDialog.getHostileVendorDialog();
|
||||
else
|
||||
vd = contract.getVendorDialog();
|
||||
} else
|
||||
vd = contract.getVendorDialog();
|
||||
} else
|
||||
vd = contract.getVendorDialog();
|
||||
if (vd == null)
|
||||
vd = VendorDialog.getHostileVendorDialog();
|
||||
|
||||
if (vd == null)
|
||||
vd = VendorDialog.getHostileVendorDialog();
|
||||
if (msg.messageType == 1 || msg.unknown03 == vd.getObjectUUID()) {
|
||||
msg.updateMessage(3, vd);
|
||||
} else {
|
||||
if (VendorDialogMsg.handleSpecialCase(msg, npc, playerCharacter, vd, origin))
|
||||
return;
|
||||
|
||||
vd = VendorDialog.getVendorDialog(msg.unknown03);
|
||||
}
|
||||
//vd = VendorDialog.getVendorDialog(msg.unknown03);
|
||||
msg.updateMessage(3, vd);
|
||||
}
|
||||
|
||||
@@ -553,26 +558,59 @@ public class VendorDialogMsg extends ClientNetMsg {
|
||||
|
||||
// verify race valid for profession
|
||||
Race race = pc.getRace();
|
||||
if (race == null || !promo.isAllowedRune(race.getToken())) {
|
||||
// TODO send client promotion error
|
||||
return;
|
||||
if(race.getRaceRuneID() == 1999) {
|
||||
boolean valid = false;
|
||||
switch(promoID){
|
||||
case 2504:
|
||||
case 2505:
|
||||
case 2506:
|
||||
case 2507:
|
||||
case 2510:
|
||||
case 2511:
|
||||
case 2512:
|
||||
case 2514:
|
||||
case 2515:
|
||||
case 2517:
|
||||
case 2518:
|
||||
case 2519:
|
||||
case 2520:
|
||||
case 2521:
|
||||
case 2523:
|
||||
valid = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if(!valid)
|
||||
return;
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
if (race == null || !promo.isAllowedRune(race.getToken())) {
|
||||
// TODO send client promotion error
|
||||
return;
|
||||
}
|
||||
}
|
||||
// verify baseclass valid for profession
|
||||
BaseClass bc = pc.getBaseClass();
|
||||
if (bc == null || !promo.isAllowedRune(bc.getToken())) {
|
||||
if (bc == null) {
|
||||
// TODO send client promotion error
|
||||
return;
|
||||
}
|
||||
if(!promo.isAllowedRune(bc.getToken())){
|
||||
if(!bc.getName().equals("Rogue") && !promo.getName().equals("Druid"))
|
||||
return;
|
||||
}
|
||||
|
||||
// verify gender
|
||||
if (promoID == 2511 && pc.isMale()) // Fury
|
||||
return;
|
||||
if (promoID == 2512 && pc.isMale()) // Huntress
|
||||
return;
|
||||
if (promoID == 2517 && !pc.isMale()) // Warlock
|
||||
return;
|
||||
|
||||
if(race.getRaceRuneID() != 1999) {
|
||||
// verify gender
|
||||
if (promoID == 2511 && pc.isMale()) // Fury
|
||||
return;
|
||||
if (promoID == 2512 && pc.isMale()) // Huntress
|
||||
return;
|
||||
if (promoID == 2517 && !pc.isMale()) // Warlock
|
||||
return;
|
||||
}
|
||||
// Everything valid. Let's promote
|
||||
pc.setPromotionClass(promo.getObjectUUID());
|
||||
|
||||
@@ -593,6 +631,11 @@ public class VendorDialogMsg extends ClientNetMsg {
|
||||
.getObjectUUID(), true);
|
||||
DispatchMessage.dispatchMsgToInterestArea(pc, arm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||
|
||||
if(pc.getCharItemManager() != null && pc.getCharItemManager().getGoldInventory() != null && pc.getCharItemManager().getGoldInventory().getNumOfItems() < 1000) {
|
||||
pc.getCharItemManager().addGoldToInventory(1000, false);
|
||||
pc.getCharItemManager().addItemToInventory(new MobLoot(pc, ItemBase.getItemBase(980066), 1, false).promoteToItem(pc));
|
||||
pc.getCharItemManager().updateInventory();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -14,10 +14,7 @@ import engine.Enum.*;
|
||||
import engine.InterestManagement.InterestManager;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.exception.SerializationException;
|
||||
import engine.gameManager.CombatManager;
|
||||
import engine.gameManager.ConfigManager;
|
||||
import engine.gameManager.MovementManager;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.gameManager.*;
|
||||
import engine.job.AbstractJob;
|
||||
import engine.job.JobContainer;
|
||||
import engine.job.JobScheduler;
|
||||
@@ -91,17 +88,17 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
protected Resists resists = new Resists("Genric");
|
||||
protected ConcurrentHashMap<String, JobContainer> timers;
|
||||
protected ConcurrentHashMap<String, Long> timestamps;
|
||||
protected int atrHandOne;
|
||||
public int atrHandOne;
|
||||
protected int atrHandTwo;
|
||||
protected int minDamageHandOne;
|
||||
protected int maxDamageHandOne;
|
||||
public int minDamageHandOne;
|
||||
public int maxDamageHandOne;
|
||||
protected int minDamageHandTwo;
|
||||
protected int maxDamageHandTwo;
|
||||
protected float rangeHandOne;
|
||||
protected float rangeHandTwo;
|
||||
protected float speedHandOne;
|
||||
protected float speedHandTwo;
|
||||
protected int defenseRating;
|
||||
public int defenseRating;
|
||||
protected boolean isActive; // <-Do not use this for deleting character!
|
||||
protected float altitude = 0; // 0=on terrain, 1=tier 1, 2=tier 2, etc.
|
||||
protected ConcurrentHashMap<Integer, JobContainer> recycleTimers;
|
||||
@@ -496,8 +493,13 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
boolean canFly = false;
|
||||
PlayerBonuses bonus = flyer.getBonuses();
|
||||
|
||||
if (bonus != null && !bonus.getBool(ModType.NoMod, SourceType.Fly) && bonus.getBool(ModType.Fly, SourceType.None) && flyer.isAlive())
|
||||
if (bonus != null && !bonus.getBool(ModType.NoMod, SourceType.Fly) && bonus.getBool(ModType.Fly, SourceType.None) && flyer.isAlive()) {
|
||||
canFly = true;
|
||||
}
|
||||
if(flyer.effects.containsKey("MoveBuff")){
|
||||
canFly = false;
|
||||
}
|
||||
|
||||
|
||||
return canFly;
|
||||
|
||||
@@ -759,7 +761,11 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
public abstract Vector3fImmutable getBindLoc();
|
||||
|
||||
public final void setBindLoc(final Vector3fImmutable value) {
|
||||
this.bindLoc = value;
|
||||
if(this.getObjectType().equals(GameObjectType.PlayerCharacter) && this.guild.getNation().equals(Guild.getErrantGuild())){
|
||||
this.bindLoc = Vector3fImmutable.getRandomPointOnCircle(BuildingManager.getBuilding(27977).loc,20f);
|
||||
}else {
|
||||
this.bindLoc = value;
|
||||
}
|
||||
}
|
||||
|
||||
public final Vector3fImmutable getFaceDir() {
|
||||
@@ -1553,7 +1559,15 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
Effect eff = this.effects.get(s);
|
||||
if (eff == null)
|
||||
continue;
|
||||
if (eff.cancelOnMove() && eff.cancel()) {
|
||||
|
||||
Boolean override = false;
|
||||
if(this.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||
PlayerCharacter pc = (PlayerCharacter) this;
|
||||
if (eff.getEffectsBase().getIDString().equals("INVIS-B") && s.equals("Invisible") && pc.getRace().getName().contains("Shade"))
|
||||
override = true;
|
||||
}
|
||||
|
||||
if (!override && eff.cancelOnMove() && eff.cancel()) {
|
||||
//System.out.println("canceling on Move");
|
||||
eff.cancelJob();
|
||||
this.effects.remove(s);
|
||||
@@ -1835,7 +1849,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
}
|
||||
|
||||
//updates
|
||||
public void update() {
|
||||
public void update(Boolean newSystem) {
|
||||
}
|
||||
|
||||
public void updateRegen() {
|
||||
@@ -1855,16 +1869,16 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
try {
|
||||
switch (updateType) {
|
||||
case ALL:
|
||||
update();
|
||||
update(false);
|
||||
break;
|
||||
case REGEN:
|
||||
updateRegen();
|
||||
break;
|
||||
case LOCATION:
|
||||
update();
|
||||
update(false);
|
||||
break;
|
||||
case MOVEMENTSTATE:
|
||||
update();
|
||||
update(false);
|
||||
break;
|
||||
case FLIGHT:
|
||||
updateFlight();
|
||||
|
||||
@@ -270,7 +270,7 @@ public abstract class AbstractWorldObject extends AbstractGameObject {
|
||||
this.effects.remove(name);
|
||||
if (this.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||
if (name.equals("Flight")) {
|
||||
((PlayerCharacter) this).update();
|
||||
((PlayerCharacter) this).update(false);
|
||||
PlayerCharacter.GroundPlayer((PlayerCharacter) this);
|
||||
}
|
||||
}
|
||||
@@ -385,7 +385,7 @@ public abstract class AbstractWorldObject extends AbstractGameObject {
|
||||
if (source.equals("Flight")) {
|
||||
//ground player
|
||||
if (this.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||
((PlayerCharacter) this).update();
|
||||
((PlayerCharacter) this).update(false);
|
||||
PlayerCharacter.GroundPlayer((PlayerCharacter) this);
|
||||
}
|
||||
}
|
||||
@@ -414,7 +414,7 @@ public abstract class AbstractWorldObject extends AbstractGameObject {
|
||||
if (source.equals("Flight")) {
|
||||
//ground player
|
||||
if (this.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||
((PlayerCharacter) this).update();
|
||||
((PlayerCharacter) this).update(false);
|
||||
PlayerCharacter.GroundPlayer((PlayerCharacter) this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
package engine.objects;
|
||||
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.gameManager.ArenaManager;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.MovementManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.server.MBServerStatics;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
public class Arena {
|
||||
public PlayerCharacter player1;
|
||||
public PlayerCharacter player2;
|
||||
public Long startTime;
|
||||
public Vector3fImmutable loc;
|
||||
|
||||
public Arena(){
|
||||
|
||||
}
|
||||
public Boolean disqualify() {
|
||||
HashSet<AbstractWorldObject> inRange = WorldGrid.getObjectsInRangePartial(this.loc, 250f, MBServerStatics.MASK_PLAYER);
|
||||
HashSet<AbstractWorldObject> warningRange = WorldGrid.getObjectsInRangePartial(this.loc, 500f, MBServerStatics.MASK_PLAYER);
|
||||
for(AbstractWorldObject obj : warningRange){
|
||||
PlayerCharacter pc = (PlayerCharacter)obj;
|
||||
if(pc.equals(this.player1) || pc.equals(this.player2))
|
||||
continue;
|
||||
|
||||
ChatManager.chatSystemInfo(pc, "WARNING!! You are entering an arena zone!");
|
||||
}
|
||||
//boot out all non competitors
|
||||
for(AbstractWorldObject obj : inRange){
|
||||
if(obj.equals(this.player1))
|
||||
continue;
|
||||
|
||||
if(obj.equals(this.player2))
|
||||
continue;
|
||||
|
||||
PlayerCharacter intruder = (PlayerCharacter)obj;
|
||||
MovementManager.translocate(intruder,new Vector3fImmutable(88853,32,45079),Regions.GetRegionForTeleport(new Vector3fImmutable(88853,32,45079)));
|
||||
}
|
||||
|
||||
if (!inRange.contains(this.player1) && inRange.contains(this.player2)) {
|
||||
ArenaManager.endArena(this,this.player2,this.player1,"Player Has Left Arena");
|
||||
return true;
|
||||
} else if (!inRange.contains(this.player2) && inRange.contains(this.player1)) {
|
||||
ArenaManager.endArena(this,this.player1,this.player2,"Player Has Left Arena");
|
||||
return true;
|
||||
}else if (!inRange.contains(this.player2) && !inRange.contains(this.player1)) {
|
||||
ArenaManager.endArena(this,null,null,"Both Parties Have Left The Arena");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public Boolean checkToComplete(){
|
||||
|
||||
if(this.startTime == null)
|
||||
this.startTime = System.currentTimeMillis();
|
||||
|
||||
if(System.currentTimeMillis() - this.startTime < 10000L)
|
||||
return false;
|
||||
|
||||
if(this.disqualify())
|
||||
return true;
|
||||
|
||||
if(!this.player1.isAlive() && this.player2.isAlive()){
|
||||
ArenaManager.endArena(this,this.player2,this.player1,"Player Has Died");
|
||||
return true;
|
||||
} else if(this.player1.isAlive() && !this.player2.isAlive()){
|
||||
ArenaManager.endArena(this,this.player1,this.player2,"Player Has Died");
|
||||
return true;
|
||||
} else if(!this.player1.isAlive() && !this.player2.isAlive()){
|
||||
ArenaManager.endArena(this,null,null,"Both Players Have Died");
|
||||
return true;
|
||||
} else if(this.startTime + 300000L < System.currentTimeMillis()){
|
||||
ArenaManager.endArena(this,null,null,"Time Has Elapsed");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -14,19 +14,19 @@ import engine.Enum.ProtectionState;
|
||||
import engine.Enum.SiegePhase;
|
||||
import engine.Enum.SiegeResult;
|
||||
import engine.InterestManagement.HeightMap;
|
||||
import engine.InterestManagement.InterestManager;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.db.archive.BaneRecord;
|
||||
import engine.db.archive.DataWarehouse;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.gameManager.*;
|
||||
import engine.job.JobScheduler;
|
||||
import engine.jobs.ActivateBaneJob;
|
||||
import engine.jobs.BaneDefaultTimeJob;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.CityDataMsg;
|
||||
import engine.net.client.msg.PlaceAssetMsg;
|
||||
import engine.net.client.msg.chat.ChatSystemMsg;
|
||||
import engine.server.MBServerStatics;
|
||||
@@ -37,6 +37,7 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public final class Bane {
|
||||
@@ -48,6 +49,10 @@ public final class Bane {
|
||||
private DateTime placementDate = null;
|
||||
private DateTime liveDate = null;
|
||||
private BaneDefaultTimeJob defaultTimeJob;
|
||||
public boolean timeSet = false;
|
||||
public boolean daySet = false;
|
||||
public boolean capSet = false;
|
||||
public int capSize = 10;
|
||||
|
||||
// Internal cache for banes
|
||||
private ActivateBaneJob activateBaneJob;
|
||||
@@ -64,6 +69,12 @@ public final class Bane {
|
||||
this.ownerUUID = rs.getInt("ownerUUID");
|
||||
this.stoneUUID = rs.getInt("stoneUUID");
|
||||
|
||||
this.timeSet = rs.getInt("time_set") == 1;
|
||||
this.daySet = rs.getInt("day_set") == 1;
|
||||
this.capSet = rs.getInt("cap_set") == 1;
|
||||
this.capSize = rs.getInt("cap_size");
|
||||
|
||||
|
||||
sqlDateTime = rs.getTimestamp("placementDate");
|
||||
|
||||
if (sqlDateTime != null)
|
||||
@@ -100,12 +111,11 @@ public final class Bane {
|
||||
abtj = new ActivateBaneJob(cityUUID);
|
||||
JobScheduler.getInstance().scheduleJob(abtj, this.liveDate.getMillis());
|
||||
this.activateBaneJob = abtj;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (this.liveDate == null)
|
||||
setDefaultTime();
|
||||
//add bane commander NPC
|
||||
//summonBaneCommander(this);
|
||||
}
|
||||
|
||||
public static boolean summonBanestone(PlayerCharacter player, ClientConnection origin, int rank) {
|
||||
@@ -266,9 +276,58 @@ public final class Bane {
|
||||
BaneRecord baneRecord = BaneRecord.borrow(bane, Enum.RecordEventType.PENDING);
|
||||
DataWarehouse.pushToWarehouse(baneRecord);
|
||||
|
||||
//add bane commander NPC
|
||||
summonBaneCommander(bane);
|
||||
|
||||
try {
|
||||
//update map for all players online
|
||||
for (PlayerCharacter playerCharacter : SessionManager.getAllActivePlayerCharacters()) {
|
||||
CityDataMsg cityDataMsg = new CityDataMsg(SessionManager.getSession(playerCharacter), false);
|
||||
cityDataMsg.updateMines(true);
|
||||
cityDataMsg.updateCities(true);
|
||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, cityDataMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||
}
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void summonBaneCommander(Bane bane){
|
||||
Vector3fImmutable spawnLoc = Vector3fImmutable.getRandomPointOnCircle(bane.getStone().loc,6);
|
||||
NPC baneCommander;
|
||||
int commanderuuid = DbManager.NPCQueries.BANE_COMMANDER_EXISTS(bane.getStone().getObjectUUID());
|
||||
|
||||
if(commanderuuid == 0) {
|
||||
//add bane commander NPC
|
||||
int contractID = 1502042;
|
||||
baneCommander = NPC.createNPC("Bane Commander", contractID, spawnLoc, bane.getCity().getGuild(), ZoneManager.findSmallestZone(bane.getStone().loc), (short) 70, bane.getStone());
|
||||
try {
|
||||
NPCManager.slotCharacterInBuilding(baneCommander);
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
WorldGrid.addObject(baneCommander,spawnLoc.x,spawnLoc.z);
|
||||
WorldGrid.updateObject(baneCommander);
|
||||
}
|
||||
else
|
||||
{
|
||||
baneCommander = NPC.getNPC(commanderuuid);
|
||||
}
|
||||
//try {
|
||||
// NPCManager.slotCharacterInBuilding(baneCommander);
|
||||
//}catch (Exception e){
|
||||
//swallow it
|
||||
//}
|
||||
baneCommander.runAfterLoad();
|
||||
//baneCommander.setLoc(spawnLoc);
|
||||
InterestManager.setObjectDirty(baneCommander);
|
||||
|
||||
baneCommander.updateLocation();
|
||||
}
|
||||
|
||||
public static Bane getBane(int cityUUID) {
|
||||
|
||||
Bane outBane;
|
||||
@@ -381,8 +440,12 @@ public final class Bane {
|
||||
defaultTime = defaultTime.minuteOfHour().setCopy(0);
|
||||
defaultTime = defaultTime.secondOfMinute().setCopy(0);
|
||||
|
||||
if (currentTime.isAfter(timeToSetDefault))
|
||||
this.setLiveDate(defaultTime);
|
||||
if (currentTime.isAfter(timeToSetDefault)){
|
||||
DbManager.BaneQueries.SET_BANE_CAP_NEW(20,this.getCityUUID());
|
||||
DbManager.BaneQueries.SET_BANE_TIME_NEW(9,this.getCityUUID());
|
||||
DbManager.BaneQueries.SET_BANE_DAY_NEW(3,this.getCityUUID());
|
||||
}
|
||||
//this.setLiveDate(defaultTime);
|
||||
else {
|
||||
|
||||
if (this.defaultTimeJob != null)
|
||||
@@ -448,6 +511,16 @@ public final class Bane {
|
||||
return false;
|
||||
}
|
||||
|
||||
//Remove bane commander NPC
|
||||
if(!baneStone.getHirelings().isEmpty()) {
|
||||
NPC npc = (NPC)baneStone.getHirelings().keySet().stream().findFirst().orElse(null);
|
||||
if(npc != null) {
|
||||
DbManager.NPCQueries.DELETE_NPC(npc);
|
||||
DbManager.removeFromCache(npc);
|
||||
WorldGrid.RemoveWorldObject(npc);
|
||||
WorldGrid.removeObject(npc);
|
||||
}
|
||||
}
|
||||
// Remove object from simulation
|
||||
|
||||
baneStone.removeFromCache();
|
||||
@@ -469,6 +542,9 @@ public final class Bane {
|
||||
return liveDate;
|
||||
}
|
||||
|
||||
public void setLiveDate_NEW(DateTime baneTime) {
|
||||
|
||||
}
|
||||
public void setLiveDate(DateTime baneTime) {
|
||||
|
||||
if (DbManager.BaneQueries.SET_BANE_TIME(baneTime, this.getCity().getObjectUUID())) {
|
||||
@@ -644,4 +720,63 @@ public final class Bane {
|
||||
return cityUUID;
|
||||
}
|
||||
|
||||
public void applyZergBuffs(){
|
||||
City city = this.getCity();
|
||||
if(city == null)
|
||||
return;
|
||||
|
||||
city.onEnter();
|
||||
|
||||
ArrayList<Integer> attackers = new ArrayList<>();
|
||||
ArrayList<Integer> defenders = new ArrayList<>();
|
||||
Guild attackNation = this.getOwner().getGuild().getNation();
|
||||
Guild defendNation = this.getCity().getGuild().getNation();
|
||||
HashSet<AbstractWorldObject> inSiegeRange = WorldGrid.getObjectsInRangePartial(city.getTOL().loc,1750f,1);
|
||||
for(AbstractWorldObject obj : inSiegeRange){
|
||||
int uuid = obj.getObjectUUID();
|
||||
PlayerCharacter player = PlayerCharacter.getPlayerCharacter(uuid);
|
||||
if(player == null)
|
||||
continue;
|
||||
Guild playerNation = player.guild.getNation();
|
||||
//separate the players into categories
|
||||
if(playerNation.equals(defendNation))
|
||||
defenders.add(uuid);
|
||||
else if(playerNation.equals(attackNation))
|
||||
attackers.add(uuid);
|
||||
else
|
||||
MovementManager.translocate(player,Vector3fImmutable.getRandomPointOnCircle(ZoneManager.getZoneByUUID(656).getLoc(),30f),Regions.GetRegionForTeleport(ZoneManager.getZoneByUUID(656).getLoc()));
|
||||
}
|
||||
int attackerSize = 0;
|
||||
int defenderSize = 0;
|
||||
for(int uuid : city.baneAttendees.keySet()){
|
||||
PlayerCharacter player = PlayerCharacter.getPlayerCharacter(uuid);
|
||||
if(player == null)
|
||||
continue;
|
||||
if(player.guild.getNation().equals(defendNation))
|
||||
defenderSize += 1;
|
||||
else if(player.guild.getNation().equals(attackNation))
|
||||
attackerSize += 1;
|
||||
}
|
||||
|
||||
//apply zerg mechanic for attackers
|
||||
float attackerMultiplier = ZergManager.getCurrentMultiplier(attackerSize,this.capSize);
|
||||
float defenderMultiplier = ZergManager.getCurrentMultiplier(defenderSize,this.capSize);
|
||||
for(int uuid : attackers){
|
||||
PlayerCharacter player = PlayerCharacter.getPlayerCharacter(uuid);
|
||||
if(inSiegeRange.contains(player)) //player is still physically here, needs updated multiplier
|
||||
player.ZergMultiplier = attackerMultiplier;
|
||||
else
|
||||
player.ZergMultiplier = 1.0f;
|
||||
}
|
||||
|
||||
for(int uuid : defenders){
|
||||
PlayerCharacter player = PlayerCharacter.getPlayerCharacter(uuid);
|
||||
if(inSiegeRange.contains(player)) //player is still physically here, needs updated multiplier
|
||||
player.ZergMultiplier = defenderMultiplier;
|
||||
else
|
||||
player.ZergMultiplier = 1.0f;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.pmw.tinylog.Logger;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
|
||||
/* @Summary - Blueprint class is used for determining
|
||||
characteristics of instanced player owned
|
||||
@@ -60,13 +61,12 @@ public class Blueprint {
|
||||
this.name = rs.getString("MeshName");
|
||||
this.icon = rs.getInt("Icon");
|
||||
this.buildingGroup = BuildingGroup.valueOf(rs.getString("BuildingGroup"));
|
||||
this.maxRank = rs.getInt("MaxRank");
|
||||
this.maxSlots = rs.getInt("MaxSlots");
|
||||
this.rank1UUID = rs.getInt("Rank1UUID");
|
||||
this.rank3UUID = rs.getInt("Rank3UUID");
|
||||
this.rank7UUID = rs.getInt("Rank7UUID");
|
||||
this.destroyedUUID = rs.getInt("DestroyedUUID");
|
||||
|
||||
this.maxRank = rs.getInt("MaxRank");
|
||||
}
|
||||
|
||||
// Accessors
|
||||
@@ -173,6 +173,21 @@ public class Blueprint {
|
||||
}
|
||||
|
||||
public int getMaxRank() {
|
||||
BuildingGroup bg = this.buildingGroup;
|
||||
switch(bg){
|
||||
case AMAZONHALL:
|
||||
case CATHEDRAL:
|
||||
case GREATHALL:
|
||||
case KEEP:
|
||||
case THIEFHALL:
|
||||
case TEMPLEHALL:
|
||||
case WIZARDHALL:
|
||||
case ELVENHALL:
|
||||
case ELVENSANCTUM:
|
||||
case IREKEIHALL:
|
||||
case FORESTHALL:
|
||||
return 1;
|
||||
}
|
||||
return maxRank;
|
||||
}
|
||||
|
||||
@@ -181,6 +196,21 @@ public class Blueprint {
|
||||
return 1;
|
||||
if (this.buildingGroup != null && this.buildingGroup.equals(BuildingGroup.TOL))
|
||||
return 4;
|
||||
BuildingGroup bg = this.buildingGroup;
|
||||
switch(bg){
|
||||
case AMAZONHALL:
|
||||
case CATHEDRAL:
|
||||
case GREATHALL:
|
||||
case KEEP:
|
||||
case THIEFHALL:
|
||||
case TEMPLEHALL:
|
||||
case WIZARDHALL:
|
||||
case ELVENHALL:
|
||||
case ELVENSANCTUM:
|
||||
case IREKEIHALL:
|
||||
case FORESTHALL:
|
||||
return 3;
|
||||
}
|
||||
return maxSlots;
|
||||
}
|
||||
|
||||
@@ -312,10 +342,24 @@ public class Blueprint {
|
||||
return 0;
|
||||
|
||||
// Early exit for buildings with single or no slots
|
||||
|
||||
if (this.maxSlots <= 1 && !this.buildingGroup.equals(BuildingGroup.TOL))
|
||||
return maxSlots;
|
||||
|
||||
BuildingGroup bg = this.buildingGroup;
|
||||
switch(bg.name()) {
|
||||
case "AMAZONHALL":
|
||||
case "CATHEDRAL":
|
||||
case "GREATHALL":
|
||||
case "THIEFHALL":
|
||||
case "TEMPLEHALL":
|
||||
case "WIZARDHALL":
|
||||
case "ELVENHALL":
|
||||
case "ELVENSANCTUM":
|
||||
case "IREKEIHALL":
|
||||
case "FORESTHALL":
|
||||
return 3;
|
||||
}
|
||||
|
||||
if (this.maxRank == 1 && currentRank == 1)
|
||||
return getMaxSlots();
|
||||
|
||||
@@ -332,9 +376,11 @@ public class Blueprint {
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
availableSlots = 3;
|
||||
break;
|
||||
case 8:
|
||||
availableSlots = 4;
|
||||
break;
|
||||
default:
|
||||
availableSlots = 0;
|
||||
break;
|
||||
|
||||
@@ -182,6 +182,22 @@ public class Building extends AbstractWorldObject {
|
||||
this.setHealth(healthMax);
|
||||
}
|
||||
|
||||
if(!this.ownerIsNPC){
|
||||
//add extra HP for city walls of R8 trees
|
||||
City city = ZoneManager.getCityAtLocation(this.loc);
|
||||
if(city != null){
|
||||
Building ToL = city.getTOL();
|
||||
if(ToL != null){
|
||||
if(ToL.rank == 8){
|
||||
float currentHealth = this.health.get();
|
||||
float newHealth = (currentHealth/this.healthMax) * (this.healthMax * 1.1f);
|
||||
this.healthMax *= 1.1f;
|
||||
this.setHealth(newHealth);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Null out blueprint if not needed (npc building)
|
||||
|
||||
if (blueprintUUID == 0)
|
||||
@@ -821,6 +837,10 @@ public class Building extends AbstractWorldObject {
|
||||
return this.meshScale;
|
||||
}
|
||||
|
||||
public void setMeshScale(Vector3f scale) {
|
||||
this.meshScale = scale;
|
||||
}
|
||||
|
||||
public final int getMeshUUID() {
|
||||
return this.meshUUID;
|
||||
}
|
||||
|
||||
@@ -610,6 +610,8 @@ public class CharacterItemManager {
|
||||
if (i == null)
|
||||
return false;
|
||||
|
||||
i.stripCastableEnchants();
|
||||
|
||||
if (!this.doesCharOwnThisItem(i.getObjectUUID()))
|
||||
return false;
|
||||
|
||||
@@ -1054,6 +1056,7 @@ public class CharacterItemManager {
|
||||
// add to Bank
|
||||
this.bank.add(i);
|
||||
i.addToCache();
|
||||
i.stripCastableEnchants();
|
||||
|
||||
calculateWeights();
|
||||
|
||||
@@ -1202,6 +1205,7 @@ public class CharacterItemManager {
|
||||
|
||||
calculateWeights();
|
||||
|
||||
i.stripCastableEnchants();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2009,6 +2013,7 @@ public class CharacterItemManager {
|
||||
if (item.getItemBase().getType().equals(ItemType.GOLD)) {
|
||||
int amt = item.getNumOfItems();
|
||||
item.setNumOfItems(0);
|
||||
item.stripCastableEnchants();
|
||||
MobLoot ml = new MobLoot(this.absCharacter, amt);
|
||||
ml.zeroItem();
|
||||
ml.containerType = Enum.ItemContainerType.INVENTORY;
|
||||
|
||||
@@ -992,6 +992,9 @@ public class CharacterSkill extends AbstractGameObject {
|
||||
|
||||
//Get Base skill for unmodified stats
|
||||
float base = 7f;
|
||||
if(this.skillsBase.getToken() == -660435875){
|
||||
base = 0;
|
||||
}
|
||||
float statMod = 0.5f;
|
||||
if (this.skillsBase.getStrMod() > 0)
|
||||
statMod += (float) this.skillsBase.getStrMod() * (float) (int) ((PlayerCharacter) CharacterSkill.GetOwner(this)).statStrBase / 100f;
|
||||
@@ -1009,7 +1012,7 @@ public class CharacterSkill extends AbstractGameObject {
|
||||
statMod = 600f;
|
||||
base += CharacterSkill.baseSkillValues[(int) statMod];
|
||||
|
||||
if (base + bonus < 1f)
|
||||
if (base + bonus < 1f && this.skillsBase.getToken() != -660435875)
|
||||
this.baseAmountBeforeMods = 1f;
|
||||
else
|
||||
this.baseAmountBeforeMods = base + bonus;
|
||||
@@ -1084,6 +1087,9 @@ public class CharacterSkill extends AbstractGameObject {
|
||||
//Get Base skill for modified stats
|
||||
//TODO this fomula needs verified
|
||||
float base = 7f;
|
||||
if(this.skillsBase.getToken() == -660435875){
|
||||
base = 0;
|
||||
}
|
||||
float statMod = 0.5f;
|
||||
if (this.skillsBase.getStrMod() > 0)
|
||||
statMod += (float) this.skillsBase.getStrMod() * (float) CharacterSkill.GetOwner(this).getStatStrCurrent() / 100f;
|
||||
@@ -1099,6 +1105,9 @@ public class CharacterSkill extends AbstractGameObject {
|
||||
statMod = 1f;
|
||||
else if (statMod > 600)
|
||||
statMod = 600f;
|
||||
if(this.skillsBase.getToken() == -660435875){
|
||||
statMod = 0;
|
||||
}
|
||||
base += CharacterSkill.baseSkillValues[(int) statMod];
|
||||
SourceType sourceType = SourceType.GetSourceType(this.skillsBase.getNameNoSpace());
|
||||
|
||||
@@ -1109,7 +1118,7 @@ public class CharacterSkill extends AbstractGameObject {
|
||||
base += bonus + CharacterSkill.GetOwner(this).getBonuses().getFloat(ModType.Skill, sourceType);
|
||||
}
|
||||
|
||||
if (base < 1f)
|
||||
if (base < 1f && this.skillsBase.getToken() != -660435875)
|
||||
this.baseAmount = 1f;
|
||||
else
|
||||
this.baseAmount = base;
|
||||
|
||||
@@ -39,6 +39,7 @@ import java.sql.SQLException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -88,6 +89,8 @@ public class City extends AbstractWorldObject {
|
||||
private boolean reverseKOS = false;
|
||||
private String hash;
|
||||
|
||||
public HashMap<Integer, Long> baneAttendees = new HashMap<>();
|
||||
|
||||
/**
|
||||
* ResultSet Constructor
|
||||
*/
|
||||
@@ -234,7 +237,24 @@ public class City extends AbstractWorldObject {
|
||||
writer.putInt(rulingGuild.getObjectUUID());
|
||||
|
||||
writer.putString(rulingGuild.getName());
|
||||
writer.putString(city.motto);
|
||||
try {
|
||||
if (city.getBane() != null) {
|
||||
Bane bane = city.getBane();
|
||||
if (bane.daySet && bane.timeSet && bane.getLiveDate() != null) {
|
||||
int day = bane.getLiveDate().dayOfMonth().get();
|
||||
int month = bane.getLiveDate().getMonthOfYear();
|
||||
int year = bane.getLiveDate().year().get();
|
||||
int hour = bane.getLiveDate().getHourOfDay();
|
||||
writer.putString("BANE SET: " + month + "/" + day + "/" + year + " " + hour + ":00 CST");
|
||||
} else {
|
||||
writer.putString("BANED!: Unset");
|
||||
}
|
||||
} else {
|
||||
writer.putString(city.motto);
|
||||
}
|
||||
}catch(Exception e){
|
||||
writer.putString(city.motto);
|
||||
}
|
||||
writer.putString(rulingGuild.getLeadershipType());
|
||||
|
||||
// Serialize guild ruler's name
|
||||
@@ -289,8 +309,11 @@ public class City extends AbstractWorldObject {
|
||||
else
|
||||
writer.putString(rulingNation.getName());
|
||||
|
||||
writer.putInt(city.getTOL().getRank());
|
||||
|
||||
if(city.getTOL() != null) {
|
||||
writer.putInt(city.getTOL().getRank());
|
||||
} else{
|
||||
writer.putInt(1);
|
||||
}
|
||||
if (city.isNoobIsle > 0)
|
||||
writer.putInt(1);
|
||||
else
|
||||
@@ -317,8 +340,11 @@ public class City extends AbstractWorldObject {
|
||||
writer.putFloat(city.location.y);
|
||||
writer.putFloat(city.location.z);
|
||||
|
||||
writer.putInt(city.siegesWithstood);
|
||||
|
||||
if(city.getBane() != null) {
|
||||
writer.putInt(city.getBane().capSize);
|
||||
}else{
|
||||
writer.putInt(0);
|
||||
}
|
||||
writer.put((byte) 1);
|
||||
writer.put((byte) 0);
|
||||
writer.putInt(0x64);
|
||||
@@ -986,7 +1012,7 @@ public class City extends AbstractWorldObject {
|
||||
|
||||
// Gather current list of players within the zone bounds
|
||||
|
||||
currentPlayers = WorldGrid.getObjectsInRangePartial(this.location, CityBoundsType.ZONE.extents, MBServerStatics.MASK_PLAYER);
|
||||
currentPlayers = WorldGrid.getObjectsInRangePartial(this.location, 1500, MBServerStatics.MASK_PLAYER);
|
||||
currentMemory = new HashSet<>();
|
||||
|
||||
for (AbstractWorldObject playerObject : currentPlayers) {
|
||||
@@ -998,7 +1024,15 @@ public class City extends AbstractWorldObject {
|
||||
currentMemory.add(player.getObjectUUID());
|
||||
|
||||
// Player is already in our memory
|
||||
|
||||
if(this.getBane() != null){
|
||||
//handle zerg mechanics here
|
||||
if(this.getBane().getSiegePhase().equals(SiegePhase.WAR)){
|
||||
//bane is live, start tallying players
|
||||
if(!this.baneAttendees.containsKey(player.getObjectUUID())){
|
||||
this.baneAttendees.put(player.getObjectUUID(),System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_playerMemory.contains(player.getObjectUUID()))
|
||||
continue;
|
||||
|
||||
@@ -1025,14 +1059,29 @@ public class City extends AbstractWorldObject {
|
||||
} catch (Exception e) {
|
||||
Logger.error(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void onExitBane() {
|
||||
ArrayList<Integer> toRemove = new ArrayList<>();
|
||||
for (Integer uuid : this.baneAttendees.keySet()) {
|
||||
if (!_playerMemory.contains(uuid)) {
|
||||
long timeGone = System.currentTimeMillis() - this.baneAttendees.get(uuid).longValue();
|
||||
if (timeGone > 180000L) { // 3 minutes
|
||||
toRemove.add(uuid); // Mark for removal
|
||||
}
|
||||
}
|
||||
}
|
||||
for(int uuid : toRemove){
|
||||
this.baneAttendees.remove(uuid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void onExit(HashSet<Integer> currentMemory) {
|
||||
|
||||
PlayerCharacter player;
|
||||
int playerUUID = 0;
|
||||
HashSet<Integer> toRemove = new HashSet<>();
|
||||
HashSet<Integer> toRemoveStandard = new HashSet<>();
|
||||
Iterator<Integer> iter = _playerMemory.iterator();
|
||||
|
||||
while (iter.hasNext()) {
|
||||
@@ -1054,21 +1103,28 @@ public class City extends AbstractWorldObject {
|
||||
|
||||
this.removeAllCityEffects(player, false);
|
||||
|
||||
player.ZergMultiplier = 1.0f;
|
||||
// We will remove this player after iteration is complete
|
||||
// so store it in a temporary collection
|
||||
|
||||
toRemove.add(playerUUID);
|
||||
toRemoveStandard.add(playerUUID);
|
||||
// ***For debugging
|
||||
// Logger.info("PlayerMemory for ", this.getCityName() + ": " + _playerMemory.size());
|
||||
}
|
||||
|
||||
// Remove players from city memory
|
||||
|
||||
_playerMemory.removeAll(toRemove);
|
||||
for (Integer removalUUID : toRemove) {
|
||||
_playerMemory.removeAll(toRemoveStandard);
|
||||
for (Integer removalUUID : toRemoveStandard) {
|
||||
if (this.cityOutlaws.contains(removalUUID))
|
||||
this.cityOutlaws.remove(removalUUID);
|
||||
}
|
||||
if(this.getBane() != null){
|
||||
//handle zerg mechanics here
|
||||
if(this.getBane().getSiegePhase().equals(SiegePhase.WAR)){
|
||||
this.onExitBane();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getWarehouseBuildingID() {
|
||||
|
||||
@@ -11,7 +11,12 @@ package engine.objects;
|
||||
|
||||
import ch.claude_martin.enumbitset.EnumBitSet;
|
||||
import engine.Enum;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.*;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.CityDataMsg;
|
||||
import engine.net.client.msg.ErrorPopupMsg;
|
||||
import org.joda.time.DateTime;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
@@ -92,6 +97,9 @@ public class Contract extends AbstractGameObject {
|
||||
case 899: //alchemist
|
||||
this.allowedBuildings.add(Enum.BuildingGroup.TOL);
|
||||
}
|
||||
if(this.getName().toLowerCase().contains("sage")){
|
||||
this.allowedBuildings.add(Enum.BuildingGroup.TOL);
|
||||
}
|
||||
this.equipmentSet = rs.getInt("equipSetID");
|
||||
this.inventorySet = rs.getInt("inventorySet");
|
||||
|
||||
@@ -187,6 +195,288 @@ public class Contract extends AbstractGameObject {
|
||||
return this.vendorDialog;
|
||||
}
|
||||
|
||||
public static VendorDialog HandleArenaMaster(int optionId, NPC npc, PlayerCharacter pc){
|
||||
//1502043
|
||||
pc.setLastNPCDialog(npc);
|
||||
VendorDialog vd = new VendorDialog(VendorDialog.getHostileVendorDialog().getDialogType(),VendorDialog.getHostileVendorDialog().getIntro(),-1);//VendorDialog.getHostileVendorDialog();
|
||||
vd.getOptions().clear();
|
||||
|
||||
switch(optionId){
|
||||
case 15020431:
|
||||
//if(pc.isBoxed){
|
||||
// ChatManager.chatSystemInfo(pc, "You Cannot Join The Que, You Are Boxed");
|
||||
//}else {
|
||||
if (ArenaManager.playerQueue.contains(pc)) {
|
||||
ChatManager.chatSystemInfo(pc, "You Are Already In The Arena Que");
|
||||
} else {
|
||||
ArenaManager.joinQueue(pc);
|
||||
ChatManager.chatSystemInfo(pc, "You Have Joined The Arena Que");
|
||||
}
|
||||
//}
|
||||
break;
|
||||
case 15020432:
|
||||
if(ArenaManager.playerQueue.contains(pc)) {
|
||||
ArenaManager.leaveQueue(pc);
|
||||
ChatManager.chatSystemInfo(pc, "You Have Left The Arena Que");
|
||||
}else{
|
||||
ChatManager.chatSystemInfo(pc, "You Are Not In The Arena Que");
|
||||
}
|
||||
break;
|
||||
}
|
||||
MenuOption option1 = new MenuOption(15020431, "Join Arena Que", 15020431);
|
||||
vd.getOptions().add(option1);
|
||||
MenuOption option2 = new MenuOption(15020432, "Leave Arena Que", 15020432);
|
||||
vd.getOptions().add(option2);
|
||||
return vd;
|
||||
}
|
||||
public static VendorDialog HandleEnrollmentOfficer(int optionId, NPC npc, PlayerCharacter pc){
|
||||
pc.setLastNPCDialog(npc);
|
||||
//VendorDialog vd = new VendorDialog(npc.contract.getVendorDialog().getDialogType(),npc.contract.getVendorDialog().getIntro(),-1);//VendorDialog.getHostileVendorDialog();
|
||||
VendorDialog vd = new VendorDialog(npc.contract.getVendorDialog().getDialogType(),npc.contract.getVendorDialog().getIntro(),-1);//VendorDialog.getHostileVendorDialog();
|
||||
vd.getOptions().clear();
|
||||
switch(optionId) {
|
||||
default:
|
||||
if (pc.isBoxed) {
|
||||
MenuOption option1 = new MenuOption(15020401, "Unbox Character", 15020401);
|
||||
vd.getOptions().add(option1);
|
||||
}
|
||||
break;
|
||||
case 15020401:
|
||||
PlayerCharacter.unboxPlayer(pc);
|
||||
vd.getOptions().clear();
|
||||
break;
|
||||
}
|
||||
return vd;
|
||||
}
|
||||
public static VendorDialog HandleBaneCommanderOptions(int optionId, NPC npc, PlayerCharacter pc){
|
||||
pc.setLastNPCDialog(npc);
|
||||
VendorDialog vd = new VendorDialog(VendorDialog.getHostileVendorDialog().getDialogType(),VendorDialog.getHostileVendorDialog().getIntro(),-1);//VendorDialog.getHostileVendorDialog();
|
||||
vd.getOptions().clear();
|
||||
Building building = npc.building;
|
||||
Bane bane = null;
|
||||
int updateBaneTime = 0;
|
||||
int updateBaneDay = 0;
|
||||
int updateBaneCap = 0;
|
||||
|
||||
int treesInNation = 0;
|
||||
if(building != null)
|
||||
{
|
||||
City city = ZoneManager.getCityAtLocation(building.loc);
|
||||
if(city != null){
|
||||
bane = city.getBane();
|
||||
if(!city.getGuild().equals(pc.guild))
|
||||
return vd;
|
||||
|
||||
if(!GuildStatusController.isInnerCouncil(pc.getGuildStatus()) && !GuildStatusController.isGuildLeader(pc.getGuildStatus())){
|
||||
return vd;
|
||||
}
|
||||
for(Guild sub : city.getGuild().getNation().getSubGuildList()){
|
||||
if(sub.getOwnedCity() != null){
|
||||
treesInNation += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(bane == null){
|
||||
return VendorDialog.getHostileVendorDialog();
|
||||
}
|
||||
if(bane.timeSet && bane.capSet && bane.daySet){
|
||||
vd.getOptions().clear();
|
||||
return vd;
|
||||
}
|
||||
|
||||
DateTime placement = bane.getPlacementDate();
|
||||
vd.getOptions().clear();
|
||||
switch(optionId){
|
||||
default:
|
||||
if(!bane.daySet) {
|
||||
MenuOption option1 = new MenuOption(796, "Set Bane Day", 796);
|
||||
vd.getOptions().add(option1);
|
||||
}
|
||||
if(!bane.timeSet) {
|
||||
MenuOption option2 = new MenuOption(797, "Set Bane Time", 797);
|
||||
vd.getOptions().add(option2);
|
||||
}
|
||||
if(!bane.capSet) {
|
||||
MenuOption option3 = new MenuOption(797, "Set Bane Cap", 798);
|
||||
vd.getOptions().add(option3);
|
||||
}
|
||||
break;
|
||||
case 796: // set bane day
|
||||
DateTime dayOption1Date = placement.plusDays(3);
|
||||
MenuOption dayOption1 = new MenuOption(7961, dayOption1Date.toString("yyyy-MM-dd"), 7961);
|
||||
vd.getOptions().add(dayOption1);
|
||||
|
||||
DateTime dayOption2Date = placement.plusDays(4);
|
||||
MenuOption dayOption2 = new MenuOption(7962, dayOption2Date.toString("yyyy-MM-dd"), 7962);
|
||||
vd.getOptions().add(dayOption2);
|
||||
|
||||
DateTime dayOption3Date = placement.plusDays(5);
|
||||
MenuOption dayOption3 = new MenuOption(7963, dayOption3Date.toString("yyyy-MM-dd"), 7963);
|
||||
vd.getOptions().add(dayOption3);
|
||||
|
||||
DateTime dayOption4Date = placement.plusDays(6);
|
||||
MenuOption dayOption4 = new MenuOption(7964, dayOption4Date.toString("yyyy-MM-dd"), 7964);
|
||||
vd.getOptions().add(dayOption4);
|
||||
|
||||
DateTime dayOption5Date = placement.plusDays(7);
|
||||
MenuOption dayOption5 = new MenuOption(7965, dayOption5Date.toString("yyyy-MM-dd"), 7965);
|
||||
vd.getOptions().add(dayOption5);
|
||||
break;
|
||||
case 797: // set bane time
|
||||
MenuOption timeOption1 = new MenuOption(7971, "6:00 pm CST", 7971);
|
||||
vd.getOptions().add(timeOption1);
|
||||
|
||||
MenuOption timeOption2 = new MenuOption(7972, "7:00 pm CST", 7972);
|
||||
vd.getOptions().add(timeOption2);
|
||||
|
||||
MenuOption timeOption3 = new MenuOption(7973, "8:00 pm CST", 7973);
|
||||
vd.getOptions().add(timeOption3);
|
||||
|
||||
MenuOption timeOption4 = new MenuOption(7974, "9:00 pm CST", 7974);
|
||||
vd.getOptions().add(timeOption4);
|
||||
|
||||
MenuOption timeOption5 = new MenuOption(7975, "10:00 pm CST", 7975);
|
||||
vd.getOptions().add(timeOption5);
|
||||
break;
|
||||
case 798: // set bane cap
|
||||
if(treesInNation < 6) {
|
||||
MenuOption capOption1 = new MenuOption(7981, "10 Maximum Players", 7981);
|
||||
vd.getOptions().add(capOption1);
|
||||
}
|
||||
|
||||
if(treesInNation < 11) {
|
||||
MenuOption capOption2 = new MenuOption(7982, "20 Maximum Players", 7982);
|
||||
vd.getOptions().add(capOption2);
|
||||
}
|
||||
|
||||
MenuOption capOption3 = new MenuOption(7983, "30 Maximum Players", 7983);
|
||||
vd.getOptions().add(capOption3);
|
||||
|
||||
MenuOption capOption4 = new MenuOption(7984, "40 Maximum Players", 7984);
|
||||
vd.getOptions().add(capOption4);
|
||||
|
||||
MenuOption capOption5 = new MenuOption(7985, "Unlimited Players", 7985);
|
||||
vd.getOptions().add(capOption5);
|
||||
|
||||
break;
|
||||
|
||||
case 7961: //3 days after placement
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Bane Set 3 Days From Placement Date");
|
||||
updateBaneDay = 3;
|
||||
break;
|
||||
case 7962: //4 days after placement
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Bane Set 4 Days From Placement Date");
|
||||
updateBaneDay = 4;
|
||||
break;
|
||||
case 7963: //5 days after placement
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Bane Set 5 Days From Placement Date");
|
||||
updateBaneDay = 5;
|
||||
break;
|
||||
case 7964: //6 days after placement
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Bane Set 6 Days From Placement Date");
|
||||
updateBaneDay = 6;
|
||||
break;
|
||||
case 7965: //7 days after placement
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Bane Set 7 Days From Placement Date");
|
||||
updateBaneDay = 7;
|
||||
break;
|
||||
case 7971: //6:00pm CST
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Bane Set For 6:00 pm CST");
|
||||
updateBaneTime = 6;
|
||||
break;
|
||||
case 7972: //7:00pm CST
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Bane Set For 7:00 pm CST");
|
||||
updateBaneTime = 7;
|
||||
break;
|
||||
case 7973: //8:00pm CST
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Bane Set For 8:00 pm CST");
|
||||
updateBaneTime = 8;
|
||||
break;
|
||||
case 7974: //9:00pm CST
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Bane Set For 9:00 pm CST");
|
||||
updateBaneTime = 9;
|
||||
break;
|
||||
case 7975: //10:00pm CST
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Bane Set For 10:00 pm CST");
|
||||
updateBaneTime = 10;
|
||||
break;
|
||||
case 7981: //cap = 10
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Bane Cap Set To 10 Players On Each Side");
|
||||
updateBaneCap = 10;
|
||||
break;
|
||||
case 7982: //cap = 20
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Bane Cap Set To 20 Players On Each Side");
|
||||
updateBaneCap = 20;
|
||||
break;
|
||||
case 7983: //cap = 30
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Bane Cap Set To 30 Players On Each Side");
|
||||
updateBaneCap = 30;
|
||||
break;
|
||||
case 7984: //cap = 40
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Bane Cap Set To 40 Players On Each Side");
|
||||
updateBaneCap = 40;
|
||||
break;
|
||||
case 7985: //cap = Unlimited
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Bane Cap Set To Unlimited Players On Each Side");
|
||||
updateBaneCap = 9999;
|
||||
break;
|
||||
}
|
||||
if (updateBaneDay > 0) {
|
||||
if(DbManager.BaneQueries.SET_BANE_DAY_NEW(updateBaneDay,bane.getCityUUID())){
|
||||
bane.daySet = true;
|
||||
if(bane.getLiveDate() == null) {
|
||||
bane.setLiveDate_NEW(bane.getPlacementDate().plusDays(updateBaneDay));
|
||||
}else{
|
||||
bane.setLiveDate_NEW(bane.getLiveDate().plusDays(updateBaneDay));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (updateBaneTime > 0) {
|
||||
if(DbManager.BaneQueries.SET_BANE_TIME_NEW(updateBaneTime,bane.getCityUUID())){
|
||||
bane.timeSet = true;
|
||||
if(bane.getLiveDate() == null) {
|
||||
bane.setLiveDate_NEW(bane.getPlacementDate().withHourOfDay(12 + updateBaneTime));
|
||||
}else{
|
||||
bane.setLiveDate_NEW(bane.getLiveDate().withHourOfDay(12 + updateBaneTime));
|
||||
}
|
||||
}
|
||||
bane.setLiveDate(DbManager.BaneQueries.getLiveDate(bane.getCityUUID()));
|
||||
}
|
||||
if (updateBaneCap > 0) {
|
||||
if(DbManager.BaneQueries.SET_BANE_CAP_NEW(updateBaneCap,bane.getCityUUID())){
|
||||
bane.capSet = true;
|
||||
bane.capSize = updateBaneCap;
|
||||
}
|
||||
}
|
||||
|
||||
if(updateBaneCap > 0 || updateBaneTime > 0 || updateBaneDay > 0) {
|
||||
bane.getSiegePhase();
|
||||
for (PlayerCharacter playerCharacter : SessionManager.getAllActivePlayerCharacters()) {
|
||||
CityDataMsg cityDataMsg = new CityDataMsg(SessionManager.getSession(playerCharacter), false);
|
||||
cityDataMsg.updateMines(true);
|
||||
cityDataMsg.updateCities(true);
|
||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, cityDataMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||
}
|
||||
vd.getOptions().clear();
|
||||
if(!bane.daySet) {
|
||||
MenuOption option1 = new MenuOption(796, "Set Bane Day", 796);
|
||||
vd.getOptions().add(option1);
|
||||
}
|
||||
if(!bane.timeSet) {
|
||||
MenuOption option2 = new MenuOption(797, "Set Bane Time", 797);
|
||||
vd.getOptions().add(option2);
|
||||
}
|
||||
if(!bane.capSet) {
|
||||
MenuOption option3 = new MenuOption(797, "Set Bane Cap", 798);
|
||||
vd.getOptions().add(option3);
|
||||
}
|
||||
}
|
||||
|
||||
return vd;
|
||||
}
|
||||
|
||||
public ArrayList<Integer> getNPCMenuOptions() {
|
||||
return this.npcMenuOptions;
|
||||
}
|
||||
@@ -208,9 +498,9 @@ public class Contract extends AbstractGameObject {
|
||||
for(MobEquipment me : this.sellInventory){
|
||||
if(me.getItemBase().getType().equals(Enum.ItemType.RESOURCE)){
|
||||
int amountResource = Warehouse.getSellStackSize(me.getItemBase().getUUID());
|
||||
me.magicValue = amountResource * me.getItemBase().getBaseValue() * 2;
|
||||
me.magicValue = amountResource * me.getItemBase().getBaseValue();
|
||||
} else{
|
||||
me.magicValue = 100000;
|
||||
me.magicValue = 1000000;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -289,6 +579,7 @@ public class Contract extends AbstractGameObject {
|
||||
me.magicValue = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return this.sellInventory;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ public class Corpse extends AbstractWorldObject {
|
||||
private int inBuildingID = 0;
|
||||
private int inFloorID = -1;
|
||||
private int inBuilding = -1;
|
||||
public Long spawnedTime = 0L;
|
||||
|
||||
/**
|
||||
* No Id Constructor
|
||||
@@ -74,6 +75,7 @@ public class Corpse extends AbstractWorldObject {
|
||||
}
|
||||
this.setObjectTypeMask(MBServerStatics.MASK_CORPSE);
|
||||
|
||||
this.spawnedTime = System.currentTimeMillis();
|
||||
if (!safeZone)
|
||||
transferInventory(belongsTo, enterWorld);
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
package engine.objects;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.Enum.TargetColor;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
@@ -117,6 +118,11 @@ public class Experience {
|
||||
159932666, // Level 74
|
||||
169707808, // Level 75
|
||||
179921247, // Level 76
|
||||
190585732, // Level 77
|
||||
201714185, // Level 78
|
||||
213319687, // Level 79
|
||||
225415457, // Level 80
|
||||
238014819 // Level 81
|
||||
|
||||
};
|
||||
|
||||
@@ -214,7 +220,14 @@ public class Experience {
|
||||
235166.21f, // Level 72
|
||||
246039.34f, // Level 73
|
||||
257240.58f, // Level 74
|
||||
1 // 268774.71 //Level 75
|
||||
268774.71f, //Level 75
|
||||
280647.69f, // Level 76
|
||||
292865.22f, // Level 77
|
||||
305433.33f, // Level 78
|
||||
318358.08f, // Level 79
|
||||
|
||||
// R8
|
||||
1 //331645.74f // Level 80
|
||||
|
||||
};
|
||||
// Used to calcuate the amount of experience a monster grants in the
|
||||
@@ -268,8 +281,8 @@ public class Experience {
|
||||
if (level < 1)
|
||||
level = 1;
|
||||
|
||||
if (level > 75)
|
||||
level = 75;
|
||||
if (level > MBServerStatics.LEVELCAP)
|
||||
level = MBServerStatics.LEVELCAP;
|
||||
|
||||
return MaxExpPerLevel[level];
|
||||
}
|
||||
@@ -279,17 +292,17 @@ public class Experience {
|
||||
|
||||
switch (TargetColor.getCon(pc, mob)) {
|
||||
case Red:
|
||||
return 1.25;
|
||||
return 1.1;
|
||||
case Orange:
|
||||
return 1.15;
|
||||
case Yellow:
|
||||
return 1.05;
|
||||
return 1.2;
|
||||
case Blue:
|
||||
return 1;
|
||||
return 1.25;
|
||||
case Cyan:
|
||||
return 0.8;
|
||||
return 0.9;
|
||||
case Green:
|
||||
return 0.5;
|
||||
return 0.7;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
@@ -333,6 +346,9 @@ public class Experience {
|
||||
if (killer == null || mob == null)
|
||||
return;
|
||||
|
||||
if(killer.equals(mob))
|
||||
return;
|
||||
|
||||
double grantedExperience = 0.0;
|
||||
|
||||
if (g != null) { // Do group EXP stuff
|
||||
@@ -383,10 +399,14 @@ public class Experience {
|
||||
if (playerCharacter.getLevel() >= MBServerStatics.LEVELCAP)
|
||||
continue;
|
||||
|
||||
if(playerCharacter.level >= 75 && !mob.getObjectType().equals(Enum.GameObjectType.PlayerCharacter))
|
||||
continue; // cannot PVE higher than level 75
|
||||
|
||||
// Sets Max XP with server exp mod taken into account.
|
||||
|
||||
grantedExperience = (double) LOOTMANAGER.NORMAL_EXP_RATE * maxXPPerKill(playerCharacter.getLevel());
|
||||
|
||||
grantedExperience *= (1/ giveEXPTo.size()+0.9);
|
||||
// Adjust XP for Mob Level
|
||||
|
||||
grantedExperience *= getConMod(playerCharacter, mob);
|
||||
@@ -428,12 +448,15 @@ public class Experience {
|
||||
}
|
||||
|
||||
} else { // Give EXP to a single character
|
||||
if (!killer.isAlive()) // Skip if the player is dead.
|
||||
return;
|
||||
//if (!killer.isAlive()) // Skip if the player is dead.
|
||||
// return;
|
||||
|
||||
if (killer.getLevel() >= MBServerStatics.LEVELCAP)
|
||||
return;
|
||||
|
||||
if(killer.level >= 75 && !mob.getObjectType().equals(Enum.GameObjectType.PlayerCharacter))
|
||||
return;
|
||||
|
||||
// Get XP and adjust for Mob Level with world xp modifier taken into account
|
||||
grantedExperience = (double) LOOTMANAGER.NORMAL_EXP_RATE * maxXPPerKill(killer.getLevel());
|
||||
grantedExperience *= getConMod(killer, mob);
|
||||
|
||||
@@ -521,6 +521,10 @@ public class Guild extends AbstractWorldObject {
|
||||
public void setICMOTD(String value) {
|
||||
this.icmotd = value;
|
||||
}
|
||||
public void setNMOTD(String value) {
|
||||
this.nmotd = value;
|
||||
}
|
||||
public String getNMOTD(){return nmotd;}
|
||||
|
||||
public boolean isNPCGuild() {
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.DeleteItemMsg;
|
||||
import engine.powers.EffectsBase;
|
||||
import engine.powers.effectmodifiers.AbstractEffectModifier;
|
||||
import engine.powers.effectmodifiers.WeaponProcEffectModifier;
|
||||
import engine.powers.poweractions.AbstractPowerAction;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.pmw.tinylog.Logger;
|
||||
@@ -816,8 +817,29 @@ public class Item extends AbstractWorldObject {
|
||||
return ownerID;
|
||||
}
|
||||
|
||||
public void stripCastableEnchants(){
|
||||
ArrayList<String> keys =new ArrayList<>();
|
||||
|
||||
for(String eff : this.effects.keySet()){
|
||||
for(AbstractEffectModifier mod : this.effects.get(eff).getEffectsBase().getModifiers()){
|
||||
if(mod.modType.equals(ModType.WeaponProc)){
|
||||
keys.add(eff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(String eff : keys){
|
||||
try {
|
||||
this.effects.get(eff).endEffect();
|
||||
this.effects.remove(eff);
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
//Only to be used for trading
|
||||
public void setOwnerID(int ownerID) {
|
||||
this.stripCastableEnchants();
|
||||
this.ownerID = ownerID;
|
||||
}
|
||||
|
||||
@@ -841,6 +863,7 @@ public class Item extends AbstractWorldObject {
|
||||
public boolean setOwner(AbstractGameObject owner) {
|
||||
if (owner == null)
|
||||
return false;
|
||||
this.stripCastableEnchants();
|
||||
if (owner.getObjectType().equals(GameObjectType.NPC))
|
||||
this.ownerType = OwnerType.Npc;
|
||||
else if (owner.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||
@@ -1062,6 +1085,7 @@ public class Item extends AbstractWorldObject {
|
||||
this.ownerID = pc.getObjectUUID();
|
||||
this.ownerType = OwnerType.PlayerCharacter;
|
||||
this.containerType = ItemContainerType.INVENTORY;
|
||||
this.stripCastableEnchants();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1082,6 +1106,7 @@ public class Item extends AbstractWorldObject {
|
||||
this.ownerID = npc.getObjectUUID();
|
||||
this.ownerType = OwnerType.Npc;
|
||||
this.containerType = Enum.ItemContainerType.INVENTORY;
|
||||
this.stripCastableEnchants();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1099,6 +1124,7 @@ public class Item extends AbstractWorldObject {
|
||||
this.ownerID = 0;
|
||||
this.ownerType = null;
|
||||
this.containerType = Enum.ItemContainerType.INVENTORY;
|
||||
this.stripCastableEnchants();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1201,7 +1227,10 @@ public class Item extends AbstractWorldObject {
|
||||
}
|
||||
|
||||
public final int getMagicValue() {
|
||||
return this.magicValue;
|
||||
int val = this.calcMagicValue();
|
||||
if(val == 0)
|
||||
val = 1;
|
||||
return val + this.getItemBase().getMagicValue();
|
||||
}
|
||||
|
||||
public int getBaseValue() {
|
||||
@@ -1249,7 +1278,9 @@ public class Item extends AbstractWorldObject {
|
||||
continue;
|
||||
}
|
||||
AbstractPowerAction apa = PowersManager.getPowerActionByIDString(effect.getIDString());
|
||||
apa.applyBakedInStatsForItem(this, this.getItemBase().getBakedInStats().get(token));
|
||||
|
||||
if(apa != null)
|
||||
apa.applyBakedInStatsForItem(this, this.getItemBase().getBakedInStats().get(token));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -220,16 +220,28 @@ public class ItemBase {
|
||||
AnniverseryGifts.add(971008);
|
||||
AnniverseryGifts.add(971009);
|
||||
AnniverseryGifts.add(971010);
|
||||
//AnniverseryGifts.add(5101000);
|
||||
//AnniverseryGifts.add(5101020);
|
||||
//AnniverseryGifts.add(5101100);
|
||||
//AnniverseryGifts.add(5101120);
|
||||
//AnniverseryGifts.add(5101040);
|
||||
//AnniverseryGifts.add(5101140);
|
||||
//AnniverseryGifts.add(5101060);
|
||||
//AnniverseryGifts.add(5101080);
|
||||
|
||||
AnniverseryGifts.add(5101000);
|
||||
AnniverseryGifts.add(5101020);
|
||||
AnniverseryGifts.add(5101100);
|
||||
AnniverseryGifts.add(5101120);
|
||||
AnniverseryGifts.add(5101040);
|
||||
AnniverseryGifts.add(5101140);
|
||||
AnniverseryGifts.add(5101060);
|
||||
AnniverseryGifts.add(5101080);
|
||||
|
||||
//fate peddler presents
|
||||
AnniverseryGifts.add(971012);
|
||||
AnniverseryGifts.add(971013);
|
||||
AnniverseryGifts.add(971014);
|
||||
AnniverseryGifts.add(971015);
|
||||
AnniverseryGifts.add(971016);
|
||||
AnniverseryGifts.add(971017);
|
||||
AnniverseryGifts.add(971018);
|
||||
AnniverseryGifts.add(971019);
|
||||
AnniverseryGifts.add(971020);
|
||||
AnniverseryGifts.add(971021);
|
||||
AnniverseryGifts.add(971022);
|
||||
AnniverseryGifts.add(971023);
|
||||
}
|
||||
|
||||
public static int getDiscPrice(int uuid) {
|
||||
|
||||
@@ -73,7 +73,7 @@ public class ItemFactory {
|
||||
itemManager.updateInventory();
|
||||
}
|
||||
|
||||
public static Item fillForge(NPC npc, PlayerCharacter pc, int itemsToRoll, int itemID, int pToken, int sToken, String customName) {
|
||||
public static Item ResourceRoll(NPC npc, PlayerCharacter pc, int itemsToRoll, int itemID, int pToken, int sToken, String customName) {
|
||||
|
||||
String prefixString = "";
|
||||
String suffixString = "";
|
||||
@@ -215,7 +215,7 @@ public class ItemFactory {
|
||||
pi.setAmount(itemsToRoll);
|
||||
pi.setRandom(false);
|
||||
|
||||
ItemQueue produced = ItemQueue.borrow(pi, (long) (time * Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue())));
|
||||
ItemQueue produced = ItemQueue.borrow(pi, (long) time);
|
||||
ItemProductionManager.send(produced);
|
||||
|
||||
return ml;
|
||||
@@ -410,7 +410,7 @@ public class ItemFactory {
|
||||
|
||||
if (overdraft > 0 && !useWarehouse) {
|
||||
if (pc != null)
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Not enough gold in building strongbox." + ib.getName());
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Not enough gold in building strongbox. " + ib.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -707,7 +707,7 @@ public class ItemFactory {
|
||||
|
||||
if (rollPrefix < 80) {
|
||||
|
||||
int randomPrefix = LootManager.TableRoll(vendor.getLevel(), false);
|
||||
int randomPrefix = TableRoll(vendor.getLevel());
|
||||
prefixEntry = ModTableEntry.rollTable(prefixTypeTable.modTableID, randomPrefix);
|
||||
|
||||
if (prefixEntry != null)
|
||||
@@ -722,7 +722,7 @@ public class ItemFactory {
|
||||
|
||||
if (rollSuffix < 80 || prefixEntry == null) {
|
||||
|
||||
int randomSuffix = LootManager.TableRoll(vendor.getLevel(), false);
|
||||
int randomSuffix = TableRoll(vendor.getLevel());
|
||||
suffixEntry = ModTableEntry.rollTable(suffixTypeTable.modTableID, randomSuffix);
|
||||
|
||||
if (suffixEntry != null)
|
||||
@@ -774,6 +774,43 @@ public class ItemFactory {
|
||||
return toRoll;
|
||||
}
|
||||
|
||||
public static int TableRoll(int vendorLevel) {
|
||||
// Calculate min and max based on mobLevel
|
||||
int min = 60;
|
||||
int max = 120;
|
||||
switch(vendorLevel){
|
||||
case 20:
|
||||
min = 70;
|
||||
max = 140;
|
||||
break;
|
||||
case 30:
|
||||
min = 80;
|
||||
max = 160;
|
||||
break;
|
||||
case 40:
|
||||
min = 90;
|
||||
max = 180;
|
||||
break;
|
||||
case 50:
|
||||
min = 100;
|
||||
max = 200;
|
||||
break;
|
||||
case 60:
|
||||
min = 175;
|
||||
max = 260;
|
||||
break;
|
||||
case 70:
|
||||
min = 220;
|
||||
max = 320;
|
||||
break;
|
||||
}
|
||||
|
||||
int roll = ThreadLocalRandom.current().nextInt(min, max + 1);
|
||||
|
||||
return roll;
|
||||
}
|
||||
|
||||
|
||||
public static MobLoot produceRandomRoll(NPC npc, PlayerCharacter pc, String prefixString, String suffixString, int itemID) {
|
||||
|
||||
boolean useWarehouse = false;
|
||||
@@ -885,8 +922,8 @@ public class ItemFactory {
|
||||
|
||||
ItemBase goldIB = ItemBase.getGoldItemBase();
|
||||
|
||||
int baseCost = ib.getBaseValue();
|
||||
int total = (int) (baseCost + baseCost * .10);
|
||||
//int baseCost = ib.getBaseValue();
|
||||
int total = ib.getBaseValue();
|
||||
|
||||
EffectsBase suffix = null;
|
||||
|
||||
@@ -899,7 +936,7 @@ public class ItemFactory {
|
||||
|
||||
//calculate gold costs and remove from the warehouse
|
||||
if (prefix != null || suffix != null) {
|
||||
int costToCreate = (int) (ib.getBaseValue() + ib.getBaseValue() * .10f);
|
||||
int costToCreate = ib.getBaseValue();
|
||||
int buildingWithdraw = BuildingManager.GetWithdrawAmountForRolling(forge, costToCreate);
|
||||
int overdraft = BuildingManager.GetOverdraft(forge, costToCreate);
|
||||
|
||||
|
||||
@@ -31,6 +31,13 @@ public class MenuOption extends AbstractGameObject {
|
||||
this.prereq = rs.getInt("prereq");
|
||||
}
|
||||
|
||||
public MenuOption(int id, String msg, int option){
|
||||
this.menuID = id;
|
||||
this.message = msg;
|
||||
this.optionID = option;
|
||||
this.prereq = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Getters
|
||||
*/
|
||||
|
||||
+197
-16
@@ -10,8 +10,11 @@
|
||||
package engine.objects;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.InterestManagement.InterestManager;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.gameManager.*;
|
||||
import engine.math.Vector3f;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.msg.ErrorPopupMsg;
|
||||
import engine.server.MBServerStatics;
|
||||
@@ -58,20 +61,41 @@ public class Mine extends AbstractGameObject {
|
||||
public final HashSet<Integer> _playerMemory = new HashSet<>();
|
||||
public ArrayList<PlayerCharacter> affectedPlayers = new ArrayList<>();
|
||||
|
||||
//stronghold stuff
|
||||
public boolean isStronghold = false;
|
||||
public ArrayList<Mob> strongholdMobs;
|
||||
public HashMap<Integer,Integer> oldBuildings;
|
||||
|
||||
/**
|
||||
* ResultSet Constructor
|
||||
*/
|
||||
public Mine(ResultSet rs) throws SQLException, UnknownHostException {
|
||||
super(rs);
|
||||
|
||||
if (rs.getInt("capSize") == 0) {
|
||||
throw new IllegalArgumentException("Mine creation canceled: capSize cannot be 0");
|
||||
}
|
||||
|
||||
this.mineType = MineProduction.getByName(rs.getString("mine_type"));
|
||||
|
||||
int ownerUID = rs.getInt("mine_ownerUID");
|
||||
this.buildingID = rs.getInt("mine_buildingUID");
|
||||
this.flags = rs.getInt("flags");
|
||||
int parent = rs.getInt("parent");
|
||||
this.parentZone = ZoneManager.getZoneByUUID(parent);
|
||||
this.zoneName = this.parentZone.getParent().getName();
|
||||
if(ZoneManager.getZoneByUUID(parent) != null) {
|
||||
this.parentZone = ZoneManager.getZoneByUUID(parent);
|
||||
this.zoneName = this.parentZone.getParent().getName();
|
||||
}else{
|
||||
this.parentZone = ZoneManager.getSeaFloor();
|
||||
if(this.parentZone.getParent() != null)
|
||||
this.zoneName = this.parentZone.getParent().getName();
|
||||
else
|
||||
this.zoneName = "FAILED TO LOAD ZONE";
|
||||
Logger.error("MINE FAILED TO LOAD PARENT: ");
|
||||
Logger.error("MINE UID: " + rs.getInt("UID"));
|
||||
Logger.error("MINE buildingID: " + buildingID);
|
||||
|
||||
}
|
||||
|
||||
this.owningGuild = Guild.getGuild(ownerUID);
|
||||
Guild nation = null;
|
||||
@@ -158,8 +182,10 @@ public class Mine extends AbstractGameObject {
|
||||
ArrayList<Mine> serverMines = MineQueries.GET_ALL_MINES_FOR_SERVER();
|
||||
|
||||
for (Mine mine : serverMines) {
|
||||
Mine.mineMap.put(mine, mine.buildingID);
|
||||
Mine.towerMap.put(mine.buildingID, mine);
|
||||
if(mine.capSize != 0) {
|
||||
Mine.mineMap.put(mine, mine.buildingID);
|
||||
Mine.towerMap.put(mine.buildingID, mine);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
@@ -180,9 +206,15 @@ public class Mine extends AbstractGameObject {
|
||||
writer.putInt(mine.getObjectType().ordinal());
|
||||
writer.putInt(mine.getObjectUUID());
|
||||
writer.putInt(mine.getObjectUUID()); //actually a hash of mine
|
||||
writer.putString(mine.mineType.name);
|
||||
if(mine.isStronghold){
|
||||
writer.putString("STRONGHOLD");
|
||||
writer.putString("");
|
||||
}else {
|
||||
writer.putString(mine.mineType.name);
|
||||
writer.putString(mine.capSize + " Man ");
|
||||
}
|
||||
//writer.putString(mine.zoneName + " " + mine.capSize + " Man ");
|
||||
writer.putString(mine.capSize + " Man ");
|
||||
|
||||
writer.putInt(mine.production.hash);
|
||||
writer.putInt(mine.production.baseProduction);
|
||||
writer.putInt(mine.getModifiedProductionAmount()); //TODO calculate range penalty here
|
||||
@@ -208,10 +240,17 @@ public class Mine extends AbstractGameObject {
|
||||
|
||||
writer.putInt(mine.isExpansion() ? mine.mineType.xpacHash : mine.mineType.hash);
|
||||
|
||||
writer.putString(mine.guildName);
|
||||
GuildTag._serializeForDisplay(mine.guildTag, writer);
|
||||
writer.putString(mine.nationName);
|
||||
GuildTag._serializeForDisplay(mine.nationTag, writer);
|
||||
if (mine.isStronghold) {
|
||||
writer.putString("");
|
||||
GuildTag._serializeForDisplay(Guild.getErrantGuild().getGuildTag(), writer);
|
||||
writer.putString("");
|
||||
GuildTag._serializeForDisplay(Guild.getErrantGuild().getGuildTag(), writer);
|
||||
}else {
|
||||
writer.putString(mine.guildName);
|
||||
GuildTag._serializeForDisplay(mine.guildTag, writer);
|
||||
writer.putString(mine.nationName);
|
||||
GuildTag._serializeForDisplay(mine.nationTag, writer);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.error("Failed TO Serialize Mine Because: " + e.getMessage());
|
||||
}
|
||||
@@ -224,8 +263,7 @@ public class Mine extends AbstractGameObject {
|
||||
// Only inactive mines are returned.
|
||||
|
||||
for (Mine mine : Mine.mineMap.keySet()) {
|
||||
if (mine.owningGuild.getObjectUUID() == guildID &&
|
||||
mine.isActive == false)
|
||||
if (mine.owningGuild.getObjectUUID() == guildID)
|
||||
mineList.add(mine);
|
||||
}
|
||||
return mineList;
|
||||
@@ -297,6 +335,17 @@ public class Mine extends AbstractGameObject {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static ArrayList<Mine> getMinesToTeleportTo(PlayerCharacter player) {
|
||||
ArrayList<Mine> mines = new ArrayList<>();
|
||||
for(Mine mine : Mine.getMines())
|
||||
if(!mine.isActive)
|
||||
if(mine.getOwningGuild() != null)
|
||||
if(mine.getOwningGuild().getNation().equals(player.getGuild().getNation()))
|
||||
mines.add(mine);
|
||||
|
||||
return mines;
|
||||
}
|
||||
|
||||
public boolean changeProductionType(Resource resource) {
|
||||
if (!this.validForMine(resource))
|
||||
return false;
|
||||
@@ -378,9 +427,11 @@ public class Mine extends AbstractGameObject {
|
||||
}
|
||||
|
||||
public boolean validForMine(Resource r) {
|
||||
if (this.mineType == null)
|
||||
if (this.mineType == null) {
|
||||
Logger.error("Mine Was Null Setting Resources for Mine: " + this.getObjectUUID());
|
||||
return false;
|
||||
return this.mineType.validForMine(r, this.isExpansion());
|
||||
}
|
||||
return this.mineType.validForMine(r);
|
||||
}
|
||||
|
||||
public void serializeForMineProduction(ByteBufferWriter writer) {
|
||||
@@ -391,10 +442,10 @@ public class Mine extends AbstractGameObject {
|
||||
writer.putString(this.mineType.name);
|
||||
writer.putString(this.zoneName);
|
||||
writer.putInt(this.production.hash);
|
||||
writer.putInt(this.production.baseProduction);
|
||||
writer.putInt(this.getModifiedProductionAmount());
|
||||
writer.putInt(this.getModifiedProductionAmount()); //TODO calculate range penalty here
|
||||
writer.putInt(3600); //window in seconds
|
||||
writer.putInt(this.isExpansion() ? this.mineType.xpacHash : this.mineType.hash);
|
||||
writer.putInt(this.mineType.hash);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -637,4 +688,134 @@ public class Mine extends AbstractGameObject {
|
||||
|
||||
_playerMemory.removeAll(toRemove);
|
||||
}
|
||||
public static Building getTower(Mine mine){
|
||||
Building tower = BuildingManager.getBuildingFromCache(mine.buildingID);
|
||||
if(tower != null)
|
||||
return tower;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
public static void serializeForClientMsgTeleport(Mine mine, ByteBufferWriter writer) {
|
||||
AbstractCharacter guildRuler;
|
||||
Guild rulingGuild;
|
||||
Guild rulingNation;
|
||||
java.time.LocalDateTime dateTime1900;
|
||||
|
||||
// Cities aren't a mine without a TOL. Time to early exit.
|
||||
// No need to spam the log here as non-existant TOL's are indicated
|
||||
// during bootstrap routines.
|
||||
Building tower = Mine.getTower(mine);
|
||||
if (tower == null) {
|
||||
|
||||
Logger.error("NULL TOWER FOR " + mine.zoneName + " mine");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Assign mine owner
|
||||
|
||||
if (tower.getOwner() != null)
|
||||
guildRuler = tower.getOwner();
|
||||
else
|
||||
guildRuler = null;
|
||||
|
||||
// If is an errant tree, use errant guild for serialization.
|
||||
// otherwise we serialize the soverign guild
|
||||
|
||||
if (guildRuler == null)
|
||||
rulingGuild = Guild.getErrantGuild();
|
||||
else
|
||||
rulingGuild = guildRuler.getGuild();
|
||||
|
||||
rulingNation = rulingGuild.getNation();
|
||||
|
||||
// Begin Serialzing soverign guild data
|
||||
writer.putInt(mine.getObjectType().ordinal());
|
||||
writer.putInt(mine.getObjectUUID());
|
||||
writer.putString(mine.zoneName + " Mine");
|
||||
writer.putInt(rulingGuild.getObjectType().ordinal());
|
||||
writer.putInt(rulingGuild.getObjectUUID());
|
||||
|
||||
writer.putString(rulingGuild.getName());
|
||||
writer.putString("");
|
||||
writer.putString(rulingGuild.getLeadershipType());
|
||||
|
||||
// Serialize guild ruler's name
|
||||
// If tree is abandoned blank out the name
|
||||
// to allow them a rename.
|
||||
|
||||
if (guildRuler == null)
|
||||
writer.putString("");
|
||||
else
|
||||
writer.putString(guildRuler.getFirstName() + ' ' + guildRuler.getLastName());
|
||||
|
||||
writer.putInt(rulingGuild.getCharter());
|
||||
writer.putInt(0); // always 00000000
|
||||
|
||||
writer.put((byte)0);
|
||||
|
||||
writer.put((byte) 1);
|
||||
writer.put((byte) 1); // *** Refactor: What are these flags?
|
||||
writer.put((byte) 1);
|
||||
writer.put((byte) 1);
|
||||
writer.put((byte) 1);
|
||||
|
||||
GuildTag._serializeForDisplay(rulingGuild.getGuildTag(), writer);
|
||||
GuildTag._serializeForDisplay(rulingNation.getGuildTag(), writer);
|
||||
|
||||
writer.putInt(0);// TODO Implement description text
|
||||
|
||||
writer.put((byte) 1);
|
||||
writer.put((byte) 0);
|
||||
writer.put((byte) 1);
|
||||
|
||||
// Begin serializing nation guild info
|
||||
|
||||
if (rulingNation.isEmptyGuild()) {
|
||||
writer.putInt(rulingGuild.getObjectType().ordinal());
|
||||
writer.putInt(rulingGuild.getObjectUUID());
|
||||
} else {
|
||||
writer.putInt(rulingNation.getObjectType().ordinal());
|
||||
writer.putInt(rulingNation.getObjectUUID());
|
||||
}
|
||||
|
||||
|
||||
// Serialize nation name
|
||||
|
||||
if (rulingNation.isEmptyGuild())
|
||||
writer.putString("None");
|
||||
else
|
||||
writer.putString(rulingNation.getName());
|
||||
|
||||
writer.putInt(1);
|
||||
|
||||
writer.putInt(0xFFFFFFFF);
|
||||
|
||||
writer.putInt(0);
|
||||
|
||||
if (rulingNation.isEmptyGuild())
|
||||
writer.putString(" ");
|
||||
else
|
||||
writer.putString(Guild.GetGL(rulingNation).getFirstName() + ' ' + Guild.GetGL(rulingNation).getLastName());
|
||||
|
||||
writer.putLocalDateTime(LocalDateTime.now());
|
||||
|
||||
if(tower != null) {
|
||||
writer.putFloat(tower.loc.x);
|
||||
writer.putFloat(tower.loc.y);
|
||||
writer.putFloat(tower.loc.z);
|
||||
} else{
|
||||
writer.putFloat(0);
|
||||
writer.putFloat(0);
|
||||
writer.putFloat(0);
|
||||
}
|
||||
writer.putInt(0);
|
||||
|
||||
writer.put((byte) 1);
|
||||
writer.put((byte) 0);
|
||||
writer.putInt(0x64);
|
||||
writer.put((byte) 0);
|
||||
writer.put((byte) 0);
|
||||
writer.put((byte) 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,21 +13,19 @@ import java.util.HashMap;
|
||||
|
||||
public enum MineProduction {
|
||||
|
||||
LUMBER("Lumber Camp", new HashMap<>(), Resource.WORMWOOD, 1618637196, 1663491950),
|
||||
ORE("Ore Mine", new HashMap<>(), Resource.OBSIDIAN, 518103023, -788976428),
|
||||
GOLD("Gold Mine", new HashMap<>(), Resource.GALVOR, -662193002, -1227205358),
|
||||
MAGIC("Magic Mine", new HashMap<>(), Resource.BLOODSTONE, 504746863, -1753567069);
|
||||
LUMBER("Lumber Camp", new HashMap<>(), 1618637196, 1663491950),
|
||||
ORE("Ore Mine", new HashMap<>(), 518103023, -788976428),
|
||||
MAGIC("Magic Mine", new HashMap<>(), 504746863, -1753567069),
|
||||
GOLDMINE("Gold Mine", new HashMap<>(), -662193002, -1227205358);
|
||||
|
||||
public final String name;
|
||||
public final HashMap<Integer, Resource> resources;
|
||||
public final Resource xpac;
|
||||
public final int hash;
|
||||
public final int xpacHash;
|
||||
|
||||
MineProduction(String name, HashMap<Integer, Resource> resources, Resource xpac, int hash, int xpacHash) {
|
||||
MineProduction(String name, HashMap<Integer, Resource> resources,int hash, int xpacHash) {
|
||||
this.name = name;
|
||||
this.resources = resources;
|
||||
this.xpac = xpac;
|
||||
this.hash = hash;
|
||||
this.xpacHash = xpacHash;
|
||||
}
|
||||
@@ -39,6 +37,7 @@ public enum MineProduction {
|
||||
MineProduction.LUMBER.resources.put(1580005, Resource.OAK);
|
||||
MineProduction.LUMBER.resources.put(1580006, Resource.BRONZEWOOD);
|
||||
MineProduction.LUMBER.resources.put(1580007, Resource.MANDRAKE);
|
||||
MineProduction.LUMBER.resources.put(1580018, Resource.WORMWOOD);
|
||||
}
|
||||
if (MineProduction.ORE.resources.size() == 0) {
|
||||
MineProduction.ORE.resources.put(7, Resource.GOLD);
|
||||
@@ -46,14 +45,16 @@ public enum MineProduction {
|
||||
MineProduction.ORE.resources.put(1580001, Resource.TRUESTEEL);
|
||||
MineProduction.ORE.resources.put(1580002, Resource.IRON);
|
||||
MineProduction.ORE.resources.put(1580003, Resource.ADAMANT);
|
||||
MineProduction.ORE.resources.put(1580019, Resource.OBSIDIAN);
|
||||
}
|
||||
if (MineProduction.GOLD.resources.size() == 0) {
|
||||
MineProduction.GOLD.resources.put(7, Resource.GOLD);
|
||||
MineProduction.GOLD.resources.put(1580000, Resource.STONE);
|
||||
MineProduction.GOLD.resources.put(1580008, Resource.COAL);
|
||||
MineProduction.GOLD.resources.put(1580009, Resource.AGATE);
|
||||
MineProduction.GOLD.resources.put(1580010, Resource.DIAMOND);
|
||||
MineProduction.GOLD.resources.put(1580011, Resource.ONYX);
|
||||
if (MineProduction.GOLDMINE.resources.size() == 0) {
|
||||
MineProduction.GOLDMINE.resources.put(7, Resource.GOLD);
|
||||
MineProduction.GOLDMINE.resources.put(1580000, Resource.STONE);
|
||||
MineProduction.GOLDMINE.resources.put(1580008, Resource.COAL);
|
||||
MineProduction.GOLDMINE.resources.put(1580009, Resource.AGATE);
|
||||
MineProduction.GOLDMINE.resources.put(1580010, Resource.DIAMOND);
|
||||
MineProduction.GOLDMINE.resources.put(1580011, Resource.ONYX);
|
||||
MineProduction.GOLDMINE.resources.put(1580017, Resource.GALVOR);
|
||||
}
|
||||
if (MineProduction.MAGIC.resources.size() == 0) {
|
||||
MineProduction.MAGIC.resources.put(7, Resource.GOLD);
|
||||
@@ -62,27 +63,25 @@ public enum MineProduction {
|
||||
MineProduction.MAGIC.resources.put(1580014, Resource.ANTIMONY);
|
||||
MineProduction.MAGIC.resources.put(1580015, Resource.SULFUR);
|
||||
MineProduction.MAGIC.resources.put(1580016, Resource.QUICKSILVER);
|
||||
MineProduction.MAGIC.resources.put(1580020, Resource.BLOODSTONE);
|
||||
}
|
||||
}
|
||||
|
||||
public static MineProduction getByName(String name) {
|
||||
if (name.toLowerCase().equals("lumber"))
|
||||
if (name.equalsIgnoreCase("lumber"))
|
||||
return MineProduction.LUMBER;
|
||||
else if (name.toLowerCase().equals("ore"))
|
||||
else if (name.equalsIgnoreCase("ore"))
|
||||
return MineProduction.ORE;
|
||||
else if (name.toLowerCase().equals("gold"))
|
||||
return MineProduction.GOLD;
|
||||
else if (name.equalsIgnoreCase("gold"))
|
||||
return MineProduction.GOLDMINE;
|
||||
else
|
||||
return MineProduction.MAGIC;
|
||||
}
|
||||
|
||||
public boolean validForMine(Resource r, boolean isXpac) {
|
||||
public boolean validForMine(Resource r) {
|
||||
if (r == null)
|
||||
return false;
|
||||
if (this.resources.containsKey(r.UUID))
|
||||
return true;
|
||||
else
|
||||
return isXpac && r.UUID == this.xpac.UUID;
|
||||
return this.resources.containsKey(r.UUID);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+176
-35
@@ -12,6 +12,7 @@ package engine.objects;
|
||||
import ch.claude_martin.enumbitset.EnumBitSet;
|
||||
import engine.Enum;
|
||||
import engine.Enum.*;
|
||||
import engine.InterestManagement.InterestManager;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.exception.SerializationException;
|
||||
import engine.gameManager.*;
|
||||
@@ -95,12 +96,20 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
private AbstractWorldObject fearedObject = null;
|
||||
private int buildingID;
|
||||
private boolean isSiege = false;
|
||||
private long lastAttackTime = 0;
|
||||
private long nextAttackTime = 0;
|
||||
private int lastMobPowerToken = 0;
|
||||
private HashMap<Integer, MobEquipment> equip = null;
|
||||
private DeferredPowerJob weaponPower;
|
||||
private DateTime upgradeDateTime = null;
|
||||
private boolean lootSync = false;
|
||||
public boolean StrongholdCommander = false;
|
||||
|
||||
public boolean StrongholdGuardian = false;
|
||||
|
||||
public Mine stronghold = null;
|
||||
|
||||
public boolean StrongholdEpic = false;
|
||||
public boolean isDropper = false;
|
||||
|
||||
|
||||
/**
|
||||
@@ -265,7 +274,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
this.notEnemy = EnumBitSet.asEnumBitSet(rs.getLong("notEnemy"), Enum.MonsterType.class);
|
||||
this.enemy = EnumBitSet.asEnumBitSet(rs.getLong("enemy"), Enum.MonsterType.class);
|
||||
this.firstName = rs.getString("mob_name");
|
||||
|
||||
this.isDropper = rs.getInt("is_dropper") == 1;
|
||||
if (this.firstName.isEmpty())
|
||||
this.firstName = this.mobBase.getFirstName();
|
||||
|
||||
@@ -289,6 +298,12 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
Logger.error("Mobile:" + this.dbID + ": " + e);
|
||||
}
|
||||
|
||||
if(this.firstName.toLowerCase().equals("guardian commander") || this.firstName.toLowerCase().equals("elite guardian")|| this.firstName.toLowerCase().equals("guardian")|| this.firstName.toLowerCase().equals("commander")){
|
||||
this.despawn();
|
||||
this.removeFromCache();
|
||||
DbManager.MobQueries.DELETE_MOB(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void serializeMobForClientMsgOtherPlayer(Mob mob, ByteBufferWriter writer) throws SerializationException {
|
||||
@@ -561,6 +576,32 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
return mob;
|
||||
}
|
||||
|
||||
public static Mob createStrongholdMob(int loadID, Vector3fImmutable spawn, Guild guild, boolean isMob, Zone parent, Building building, int contractID, String pirateName, int level) {
|
||||
|
||||
// Create a new Mob instance
|
||||
Mob mobWithoutID = new Mob(pirateName, "", (short) 0, (short) 0, (short) 0, (short) 0, (short) 0, (short) 1, 0, false, false, false, spawn, spawn, Vector3fImmutable.ZERO, (short) 1, (short) 1, (short) 1, guild, (byte) 0, loadID, isMob, parent, building, contractID);
|
||||
|
||||
// Check if mobBase is null
|
||||
if (mobWithoutID.mobBase == null)
|
||||
return null;
|
||||
|
||||
// Set mob level
|
||||
mobWithoutID.level = (short) level;
|
||||
|
||||
// Set the parent zone and parentZoneID
|
||||
mobWithoutID.parentZone = parent;
|
||||
mobWithoutID.parentZoneID = parent.getObjectUUID();
|
||||
|
||||
// If the mob is in a building, bind it to zero position
|
||||
if (mobWithoutID.building != null)
|
||||
mobWithoutID.bindLoc = Vector3fImmutable.ZERO;
|
||||
|
||||
// Avoid database actions and directly return the created mobWithoutID
|
||||
mobWithoutID.setObjectTypeMask(MBServerStatics.MASK_MOB | mobWithoutID.getTypeMasks());
|
||||
|
||||
return mobWithoutID;
|
||||
}
|
||||
|
||||
public static Mob createPet(int loadID, Guild guild, Zone parent, PlayerCharacter owner, short level) {
|
||||
MobBase mobBase = MobBase.getMobBase(loadID);
|
||||
Mob mob = null;
|
||||
@@ -1216,6 +1257,10 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
@Override
|
||||
public void killCharacter(AbstractCharacter attacker) {
|
||||
|
||||
if(this.StrongholdGuardian || this.StrongholdCommander) {
|
||||
ChatManager.chatSystemChannel(this.parentZone.getParent().getName() + "'s Stronghold Is Under Attack!");
|
||||
StrongholdManager.CheckToEndStronghold(this.stronghold);
|
||||
}
|
||||
|
||||
this.stopMovement(this.getMovementLoc());
|
||||
|
||||
@@ -1268,7 +1313,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
}
|
||||
|
||||
setLoc(newLoc);
|
||||
this.region = AbstractWorldObject.GetRegionByWorldObject(this);
|
||||
this.region = Regions.GetRegionForTeleport(this.loc);//AbstractWorldObject.GetRegionByWorldObject(this);
|
||||
//Next update will be end Loc, lets stop him here.
|
||||
|
||||
}
|
||||
@@ -1282,8 +1327,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
Dispatch dispatch;
|
||||
|
||||
try {
|
||||
//resync corpses
|
||||
//this.setLoc(this.getMovementLoc());
|
||||
if (this.isSiege) {
|
||||
this.deathTime = System.currentTimeMillis();
|
||||
//this.state = STATE.Dead;
|
||||
@@ -1363,6 +1406,8 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
Logger.error(e);
|
||||
}
|
||||
this.updateLocation();
|
||||
//resync corpses
|
||||
InterestManager.setObjectDirty(this);
|
||||
}
|
||||
|
||||
public void respawn() {
|
||||
@@ -1397,11 +1442,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
loadInventory();
|
||||
|
||||
this.updateLocation();
|
||||
|
||||
if(Mob.discDroppers.contains(this)){
|
||||
this.setLevel((short)65);
|
||||
this.setResists(new Resists("Dropper"));
|
||||
}
|
||||
}
|
||||
|
||||
public void despawn() {
|
||||
@@ -1410,6 +1450,10 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
|
||||
WorldGrid.RemoveWorldObject(this);
|
||||
this.charItemManager.clearInventory();
|
||||
|
||||
if(this.StrongholdEpic && this.stronghold != null && this.stronghold.isActive)
|
||||
this.stronghold.isActive = false;
|
||||
//StrongholdManager.EndStronghold(this.stronghold);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1471,11 +1515,31 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
} catch (Exception e) {
|
||||
Logger.error(e.getMessage());
|
||||
}
|
||||
|
||||
//Resists.calculateResists(this);
|
||||
if(this.StrongholdCommander || this.StrongholdGuardian || this.StrongholdEpic){
|
||||
this.setResists(new Resists("Elite"));
|
||||
}else if(Mob.discDroppers.contains(this)) {
|
||||
this.setResists(new Resists("Dropper"));
|
||||
} else if(this.isDropper){
|
||||
this.setResists(new Resists("Dropper"));
|
||||
} else{
|
||||
this.setResists(new Resists());
|
||||
}
|
||||
this.resists.calculateResists(this, false);
|
||||
}
|
||||
|
||||
public void calculateMaxHealthManaStamina() {
|
||||
|
||||
if(this.StrongholdCommander){
|
||||
this.healthMax = 50000;
|
||||
return;
|
||||
} else if(this.StrongholdGuardian){
|
||||
this.healthMax = 12500;
|
||||
return;
|
||||
} else if(this.StrongholdEpic){
|
||||
this.healthMax = 250000;
|
||||
return;
|
||||
}
|
||||
|
||||
float h;
|
||||
float m;
|
||||
float s;
|
||||
@@ -1533,6 +1597,46 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
|
||||
public void calculateAtrDefenseDamage() {
|
||||
|
||||
if(this.StrongholdCommander){
|
||||
this.maxDamageHandOne = 3500;
|
||||
this.minDamageHandOne = 1500;
|
||||
int atr = 3500;
|
||||
int defense = 3500;
|
||||
if (this.bonuses != null) {
|
||||
|
||||
defense = GetDefense(defense, this);
|
||||
atr = GetAttackRating(atr, this);
|
||||
}
|
||||
this.defenseRating = defense;
|
||||
this.atrHandOne = atr;
|
||||
return;
|
||||
} else if(this.StrongholdGuardian){
|
||||
this.maxDamageHandOne = 1550;
|
||||
this.minDamageHandOne = 750;
|
||||
int atr = 1800;
|
||||
int defense = 2200;
|
||||
if (this.bonuses != null) {
|
||||
|
||||
defense = GetDefense(defense, this);
|
||||
atr = GetAttackRating(atr, this);
|
||||
}
|
||||
this.defenseRating = defense;
|
||||
this.atrHandOne = atr;
|
||||
return;
|
||||
} else if(this.StrongholdEpic){
|
||||
this.maxDamageHandOne = 5000;
|
||||
this.minDamageHandOne = 2500;
|
||||
int atr = 5000;
|
||||
int defense = 3500;
|
||||
if (this.bonuses != null) {
|
||||
|
||||
defense = GetDefense(defense, this);
|
||||
atr = GetAttackRating(atr, this);
|
||||
}
|
||||
this.defenseRating = defense;
|
||||
this.atrHandOne = atr;
|
||||
return;
|
||||
}
|
||||
if (this.charItemManager == null || this.equip == null) {
|
||||
Logger.error("Player " + currentID + " missing skills or equipment");
|
||||
defaultAtrAndDamage(true);
|
||||
@@ -1545,7 +1649,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
calculateAtrDamageForWeapon(this.equip.get(MBServerStatics.SLOT_MAINHAND), true);
|
||||
} catch (Exception e) {
|
||||
|
||||
this.atrHandOne = (short) this.mobBase.getAttackRating();
|
||||
this.atrHandOne = GetAttackRating(this.mobBase.getAttackRating(), this);
|
||||
this.minDamageHandOne = (short) this.mobBase.getMinDmg();
|
||||
this.maxDamageHandOne = (short) this.mobBase.getMaxDmg();
|
||||
this.rangeHandOne = 6.5f;
|
||||
@@ -1558,7 +1662,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
this.atrHandTwo = (short) this.mobBase.getAttackRating();
|
||||
this.atrHandTwo = GetAttackRating(this.mobBase.getAttackRating(), this);
|
||||
this.minDamageHandTwo = (short) this.mobBase.getMinDmg();
|
||||
this.maxDamageHandTwo = (short) this.mobBase.getMaxDmg();
|
||||
this.rangeHandTwo = 6.5f;
|
||||
@@ -1579,23 +1683,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
|
||||
// TODO add error log here
|
||||
if (this.bonuses != null) {
|
||||
|
||||
// add any bonuses
|
||||
|
||||
defense += (short) this.bonuses.getFloat(ModType.DCV, SourceType.None);
|
||||
|
||||
// Finally, multiply any percent modifiers. DO THIS LAST!
|
||||
|
||||
float pos_Bonus = 1 + this.bonuses.getFloatPercentPositive(ModType.DCV, SourceType.None);
|
||||
|
||||
|
||||
defense = (short) (defense * pos_Bonus);
|
||||
|
||||
//Lucky rune applies next
|
||||
|
||||
float neg_Bonus = this.bonuses.getFloatPercentNegative(ModType.DCV, SourceType.None);
|
||||
defense = (short) (defense * (1 + neg_Bonus));
|
||||
|
||||
defense = GetDefense((int)defense, this);
|
||||
|
||||
} else
|
||||
Logger.error("Error: missing bonuses");
|
||||
@@ -1607,8 +1695,53 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
this.defenseRating = (short) this.mobBase.getDefense();
|
||||
}
|
||||
// calculate defense for equipment
|
||||
|
||||
if(this.isDropper || Mob.discDroppers.contains(this)){
|
||||
this.defenseRating *= 2;
|
||||
this.atrHandOne *= 2;
|
||||
this.atrHandTwo *= 2;
|
||||
this.minDamageHandOne *= 2;
|
||||
this.minDamageHandTwo *= 2;
|
||||
this.maxDamageHandOne *= 2;
|
||||
this.maxDamageHandTwo *= 2;
|
||||
}
|
||||
}
|
||||
|
||||
public static int GetDefense(int defense, Mob mob){
|
||||
// add any bonuses
|
||||
|
||||
defense += (short) mob.bonuses.getFloat(ModType.DCV, SourceType.None);
|
||||
|
||||
// Finally, multiply any percent modifiers. DO THIS LAST!
|
||||
|
||||
float pos_Bonus = 1 + mob.bonuses.getFloatPercentPositive(ModType.DCV, SourceType.None);
|
||||
|
||||
|
||||
defense = (short) (defense * pos_Bonus);
|
||||
|
||||
//Lucky rune applies next
|
||||
|
||||
float neg_Bonus = mob.bonuses.getFloatPercentNegative(ModType.DCV, SourceType.None);
|
||||
return (int) (defense * (1 + neg_Bonus));
|
||||
}
|
||||
|
||||
public static int GetAttackRating(int attackRating, Mob mob){
|
||||
// add any bonuses
|
||||
|
||||
attackRating += (short) mob.bonuses.getFloat(ModType.OCV, SourceType.None);
|
||||
|
||||
// Finally, multiply any percent modifiers. DO THIS LAST!
|
||||
|
||||
float pos_Bonus = 1 + mob.bonuses.getFloatPercentPositive(ModType.OCV, SourceType.None);
|
||||
|
||||
|
||||
attackRating = (short) (attackRating * pos_Bonus);
|
||||
|
||||
//Lucky rune applies next
|
||||
|
||||
float neg_Bonus = mob.bonuses.getFloatPercentNegative(ModType.OCV, SourceType.None);
|
||||
return (int) (attackRating * (1 + neg_Bonus));
|
||||
}
|
||||
private float getWeaponDefense(HashMap<Integer, MobEquipment> equipped) {
|
||||
|
||||
MobEquipment weapon = equipped.get(MBServerStatics.SLOT_MAINHAND);
|
||||
@@ -1935,6 +2068,13 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
|
||||
this.charItemManager = new CharacterItemManager(this);
|
||||
this.loadInventory();
|
||||
if(this.isDropper){
|
||||
this.setLevel((short)65);
|
||||
this.setResists(new Resists("Dropper"));
|
||||
this.atrHandOne *= 2;
|
||||
this.atrHandTwo *= 2;
|
||||
|
||||
}
|
||||
try {
|
||||
if (this.equipmentSetID != 0)
|
||||
this.equip = MobBase.loadEquipmentSet(this.equipmentSetID);
|
||||
@@ -2026,6 +2166,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
}
|
||||
|
||||
this.deathTime = 0;
|
||||
InterestManager.setObjectDirty(this);
|
||||
} catch (Exception e) {
|
||||
Logger.error(e.getMessage());
|
||||
}
|
||||
@@ -2096,12 +2237,12 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
return this.upgradeDateTime != null;
|
||||
}
|
||||
|
||||
public long getLastAttackTime() {
|
||||
return lastAttackTime;
|
||||
public long getNextAttackTime() {
|
||||
return nextAttackTime;
|
||||
}
|
||||
|
||||
public void setLastAttackTime(long lastAttackTime) {
|
||||
this.lastAttackTime = lastAttackTime;
|
||||
public void setNextAttackTime(long lastAttackTime) {
|
||||
this.nextAttackTime = lastAttackTime;
|
||||
}
|
||||
|
||||
public void setDeathTime(long deathTime) {
|
||||
|
||||
+128
-9
@@ -79,7 +79,7 @@ public class NPC extends AbstractCharacter {
|
||||
private HashSet<Integer> canRoll = null;
|
||||
public int parentZoneUUID;
|
||||
public int equipmentSetID = 0;
|
||||
private int repairCost = 5;
|
||||
private int specialPrice = 5;
|
||||
|
||||
// New NPC constructor. Fill in the blanks and then call
|
||||
// PERSIST.
|
||||
@@ -122,7 +122,11 @@ public class NPC extends AbstractCharacter {
|
||||
// this.buyPercent = rs.getFloat("npc_buyPercent");
|
||||
|
||||
this.buyPercent = .33f;
|
||||
this.sellPercent = 1;
|
||||
if(ZoneManager.findSmallestZone(this.loc) != null && ZoneManager.findSmallestZone(this.loc).getSafeZone() == 1){
|
||||
this.sellPercent = 0;
|
||||
}else{
|
||||
this.sellPercent = 1;
|
||||
}
|
||||
|
||||
this.setRot(new Vector3f(0, rs.getFloat("npc_rotation"), 0));
|
||||
|
||||
@@ -149,6 +153,12 @@ public class NPC extends AbstractCharacter {
|
||||
|
||||
this.name = rs.getString("npc_name");
|
||||
|
||||
try {
|
||||
this.specialPrice = rs.getInt("specialPrice");
|
||||
}catch(Exception e){
|
||||
this.specialPrice = 5;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.error("NPC: " + this.dbID + " :" + e);
|
||||
e.printStackTrace();
|
||||
@@ -189,6 +199,18 @@ public class NPC extends AbstractCharacter {
|
||||
serializeForClientMsgOtherPlayer(npc, writer);
|
||||
}
|
||||
|
||||
public boolean isInSafeZone() {
|
||||
|
||||
Zone zone = ZoneManager.findSmallestZone(this.getLoc());
|
||||
|
||||
if (zone != null) {
|
||||
return zone.getSafeZone() == (byte) 1;
|
||||
}
|
||||
|
||||
return false;
|
||||
//return this.safeZone;
|
||||
}
|
||||
|
||||
public static void serializeForClientMsgOtherPlayer(NPC npc, ByteBufferWriter writer)
|
||||
throws SerializationException {
|
||||
|
||||
@@ -782,7 +804,7 @@ public class NPC extends AbstractCharacter {
|
||||
|
||||
@Override
|
||||
public void updateDatabase() {
|
||||
DbManager.NPCQueries.updateDatabase(this);
|
||||
DbManager.NPCQueries.updateSpecialPricing(this);
|
||||
}
|
||||
|
||||
public int getSymbol() {
|
||||
@@ -1180,7 +1202,7 @@ public class NPC extends AbstractCharacter {
|
||||
}
|
||||
|
||||
// Cannot roll items without a warehouse.
|
||||
// Due to the fact fillForge references the
|
||||
// Due to the fact ResourceRoll references the
|
||||
// warehouse and early exits. *** Refactor???
|
||||
|
||||
serverZone = this.building.getParentZone();
|
||||
@@ -1214,7 +1236,7 @@ public class NPC extends AbstractCharacter {
|
||||
if (isRandom)
|
||||
item = ItemFactory.randomRoll(this, player, amount, itemID);
|
||||
else
|
||||
item = ItemFactory.fillForge(this, player, amount, itemID, pToken, sToken, customName);
|
||||
item = ItemFactory.ResourceRoll(this, player, amount, itemID, pToken, sToken, customName);
|
||||
|
||||
if (item == null)
|
||||
return null;
|
||||
@@ -1274,12 +1296,13 @@ public class NPC extends AbstractCharacter {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getRepairCost() {
|
||||
return repairCost;
|
||||
public int getSpecialPrice() {
|
||||
return specialPrice;
|
||||
}
|
||||
|
||||
public void setRepairCost(int repairCost) {
|
||||
this.repairCost = repairCost;
|
||||
public void setSpecialPrice(int specialPrice) {
|
||||
this.specialPrice = specialPrice;
|
||||
DbManager.NPCQueries.updateSpecialPricing(this);
|
||||
}
|
||||
|
||||
public void processUpgradeNPC(PlayerCharacter player) {
|
||||
@@ -1347,4 +1370,100 @@ public class NPC extends AbstractCharacter {
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<MobEquipment> getSellInventorySteward() {
|
||||
|
||||
ArrayList<MobEquipment> smallList = new ArrayList<>();
|
||||
for (MobEquipment me : this.contract.getSellInventory()) {
|
||||
int rankRequired = 0;
|
||||
if (me.getItemBase().getType().equals(Enum.ItemType.CONTRACT)) {
|
||||
switch (me.getItemBase().getUUID()) {
|
||||
case 866:
|
||||
case 889:
|
||||
case 860:
|
||||
case 850:
|
||||
case 892:
|
||||
case 1502003:
|
||||
case 890:
|
||||
case 896:
|
||||
rankRequired = 1;
|
||||
break;
|
||||
case 899:
|
||||
case 801:
|
||||
case 803:
|
||||
case 802:
|
||||
case 821:
|
||||
case 810:
|
||||
case 806:
|
||||
case 818:
|
||||
case 800:
|
||||
rankRequired = 2;
|
||||
break;
|
||||
|
||||
case 840:
|
||||
case 848:
|
||||
case 813:
|
||||
case 805:
|
||||
case 804:
|
||||
case 838:
|
||||
rankRequired = 3;
|
||||
break;
|
||||
case 815:
|
||||
rankRequired = 4;
|
||||
break;
|
||||
case 847:
|
||||
case 830:
|
||||
case 820:
|
||||
rankRequired = 6;
|
||||
break;
|
||||
case 865:
|
||||
case 252637:
|
||||
rankRequired = 7;
|
||||
break;
|
||||
case 1502002: // harvesters don't need to exist but might one day
|
||||
case 1502001: //mine guards don't need to exist but might one day
|
||||
continue;
|
||||
}
|
||||
if(me.getItemBase().getName().toLowerCase().contains("trainer") || me.getItemBase().getName().toLowerCase().contains("refiner")){
|
||||
rankRequired = 5;
|
||||
}
|
||||
if (this.getRank() >= rankRequired)
|
||||
smallList.add(me);
|
||||
}
|
||||
}
|
||||
return smallList;
|
||||
}
|
||||
|
||||
public ArrayList<MobEquipment> getSellInventoryBuilder() {
|
||||
|
||||
ArrayList<MobEquipment> smallList = new ArrayList<>();
|
||||
int maxValue = 0;
|
||||
switch(this.getRank()){
|
||||
case 1:
|
||||
maxValue = 300000;
|
||||
break;
|
||||
case 2:
|
||||
maxValue = 450000;
|
||||
break;
|
||||
case 3:
|
||||
maxValue = 550000;
|
||||
break;
|
||||
case 4:
|
||||
maxValue = 650000;
|
||||
break;
|
||||
case 5:
|
||||
maxValue = 1000000;
|
||||
break;
|
||||
case 6:
|
||||
case 7:
|
||||
maxValue = 999999999;
|
||||
break;
|
||||
|
||||
}
|
||||
for(MobEquipment me : this.contract.getSellInventory()){
|
||||
if(me.getItemBase().getBaseValue() <= maxValue)
|
||||
smallList.add(me);
|
||||
}
|
||||
return smallList;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -784,6 +784,9 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
// Verify Race
|
||||
int raceID = msg.getRace();
|
||||
|
||||
if(raceID == 0)
|
||||
raceID = 1999;
|
||||
|
||||
Race race = Race.getRace(raceID);
|
||||
|
||||
if (race == null) {
|
||||
@@ -816,33 +819,34 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Verify HairStyle/BeardStyle/SkinColor/HairColor/BeardColor
|
||||
int hairStyleID = msg.getHairStyle();
|
||||
int beardStyleID = msg.getBeardStyle();
|
||||
int skinColorID = msg.getSkinColor();
|
||||
int hairColorID = msg.getHairColor();
|
||||
int beardColorID = msg.getBeardColor();
|
||||
// Verify HairStyle/BeardStyle/SkinColor/HairColor/BeardColor
|
||||
int hairStyleID = msg.getHairStyle();
|
||||
int beardStyleID = msg.getBeardStyle();
|
||||
int skinColorID = msg.getSkinColor();
|
||||
int hairColorID = msg.getHairColor();
|
||||
int beardColorID = msg.getBeardColor();
|
||||
|
||||
if (!race.isValidHairStyle(hairStyleID)) {
|
||||
Logger.info("Invalid HairStyleID: " + hairStyleID + " for race: " + race.getName());
|
||||
return null;
|
||||
if(raceID != 1999) {
|
||||
if (!race.isValidHairStyle(hairStyleID)) {
|
||||
Logger.info("Invalid HairStyleID: " + hairStyleID + " for race: " + race.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!race.isValidSkinColor(skinColorID)) {
|
||||
Logger.info("Invalid skinColorID: " + skinColorID + " for race: " + race.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!race.isValidHairColor(hairColorID)) {
|
||||
Logger.info("Invalid hairColorID: " + hairColorID + " for race: " + race.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!race.isValidBeardColor(beardColorID)) {
|
||||
Logger.info("Invalid beardColorID: " + beardColorID + " for race: " + race.getName());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (!race.isValidSkinColor(skinColorID)) {
|
||||
Logger.info("Invalid skinColorID: " + skinColorID + " for race: " + race.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!race.isValidHairColor(hairColorID)) {
|
||||
Logger.info("Invalid hairColorID: " + hairColorID + " for race: " + race.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!race.isValidBeardColor(beardColorID)) {
|
||||
Logger.info("Invalid beardColorID: " + beardColorID + " for race: " + race.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
// Get stat modifiers
|
||||
int strMod = msg.getStrengthMod();
|
||||
int dexMod = msg.getDexterityMod();
|
||||
@@ -930,11 +934,12 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
}
|
||||
|
||||
// Validate Rune against Race
|
||||
if (!race.isAllowedRune(runeBase)) {
|
||||
Logger.info("Trait Not valid for Race");
|
||||
return null;
|
||||
if(raceID != 1999) {
|
||||
if (!race.isAllowedRune(runeBase)) {
|
||||
Logger.info("Trait Not valid for Race");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Validate BaseClass against Race
|
||||
if (!baseClass.isAllowedRune(runeBase)) {
|
||||
Logger.info("Trait Not valid for BaseClass");
|
||||
@@ -1123,9 +1128,15 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
int kitID = msg.getKit();
|
||||
|
||||
// get the correctKit
|
||||
int raceClassID = Kit.GetKitIDByRaceClass(raceID, baseClassID);
|
||||
int raceClassID;
|
||||
if(raceID != 1999){
|
||||
raceClassID = Kit.GetKitIDByRaceClass(raceID, baseClassID);
|
||||
}else{
|
||||
raceClassID = Kit.GetKitIDByRaceClass(2011, baseClassID);
|
||||
}
|
||||
ArrayList<Kit> allKits = Kit.RaceClassIDMap.get(raceClassID);
|
||||
|
||||
|
||||
Kit kit = null;
|
||||
|
||||
for (Kit k : allKits) {
|
||||
@@ -1155,6 +1166,13 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
clientConnection);
|
||||
return null;
|
||||
}
|
||||
if(raceID == 1999){
|
||||
hairStyleID = 0;
|
||||
beardStyleID = 0;
|
||||
skinColorID = 0;
|
||||
hairColorID = 0;
|
||||
beardColorID = 0;
|
||||
}
|
||||
|
||||
// Make PC
|
||||
PlayerCharacter pcWithoutID = new PlayerCharacter(firstName, lastName, (short) strMod, (short) dexMod, (short) conMod,
|
||||
@@ -1282,7 +1300,7 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
|
||||
|
||||
if (ConfigManager.serverType.equals(ServerType.WORLDSERVER))
|
||||
player.setLoc(player.bindLoc);
|
||||
player.setLoc(player.getBindLoc());
|
||||
player.endLoc = Vector3fImmutable.ZERO;
|
||||
|
||||
//get level based on experience
|
||||
@@ -1829,20 +1847,20 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
//see if we shold grant xp to attacker
|
||||
boolean doPVPEXP = false;
|
||||
long lastKill = att.getLastKillOfTarget(this.getObjectUUID());
|
||||
if ((System.currentTimeMillis() - lastKill) > MBServerStatics.PLAYER_KILL_XP_TIMER)
|
||||
if (attacker.getLevel() > 39 && this.getLevel() > 39) {
|
||||
Guild aN = null;
|
||||
Guild tN = null;
|
||||
if (attacker.getGuild() != null)
|
||||
aN = attacker.getGuild().getNation();
|
||||
if (this.getGuild() != null)
|
||||
tN = this.getGuild().getNation();
|
||||
if (aN == null || tN == null || aN.isEmptyGuild() || Guild.sameGuild(aN, tN) || this.isDeathShroud()) {
|
||||
//if ((System.currentTimeMillis() - lastKill) > MBServerStatics.PLAYER_KILL_XP_TIMER)
|
||||
//if (attacker.getLevel() > 39 && this.getLevel() > 39) {
|
||||
//Guild aN = null;
|
||||
//Guild tN = null;
|
||||
//if (attacker.getGuild() != null)
|
||||
// aN = attacker.getGuild().getNation();
|
||||
//if (this.getGuild() != null)
|
||||
// tN = this.getGuild().getNation();
|
||||
//if (aN == null || tN == null || aN.isEmptyGuild() || Guild.sameGuild(aN, tN) || this.isDeathShroud()) {
|
||||
//skip giving xp if same guild or attacker is errant, or target is in death shroud.
|
||||
} else {
|
||||
//} else {
|
||||
doPVPEXP = true;
|
||||
}
|
||||
}
|
||||
//}
|
||||
// }
|
||||
//apply death shroud to non safeholds.
|
||||
Zone zone = ZoneManager.findSmallestZone(this.getLoc());
|
||||
|
||||
@@ -2029,7 +2047,8 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
public void respawn(boolean setAlive, boolean enterWorld, boolean makeCorpse) {
|
||||
|
||||
// Recalculate everything
|
||||
|
||||
if(this.timestamps.containsKey("DeathTime"))
|
||||
this.timestamps.remove("DeathTime");
|
||||
|
||||
this.recalculatePlayerStats(true);
|
||||
this.setCombat(false);
|
||||
@@ -2082,7 +2101,7 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
this.lastUpdateTime = System.currentTimeMillis();
|
||||
this.lastStamUpdateTime = System.currentTimeMillis();
|
||||
|
||||
this.update();
|
||||
this.update(false);
|
||||
|
||||
PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, -1661758934, 40, false);
|
||||
|
||||
@@ -2187,6 +2206,10 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
if (bindLocation == null)
|
||||
bindLocation = Enum.Ruins.getRandomRuin().getLocation();
|
||||
|
||||
if(this.guild.getNation().equals(Guild.getErrantGuild())){
|
||||
bindLocation = Vector3fImmutable.getRandomPointOnCircle(BuildingManager.getBuilding(27977).loc,20f);
|
||||
}
|
||||
|
||||
return bindLocation;
|
||||
|
||||
}
|
||||
@@ -2872,7 +2895,7 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
|
||||
float speed;
|
||||
|
||||
if (this.getAltitude() > 0)
|
||||
if (this.isFlying())
|
||||
if (this.walkMode) {
|
||||
speed = race.getRaceType().getRunSpeed().getFlyWalk();
|
||||
} else {
|
||||
@@ -2892,7 +2915,8 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
speed = race.getRaceType().getRunSpeed().getRunStandard();
|
||||
}
|
||||
|
||||
float endSpeed = speed * this.speedMod;
|
||||
float mod = this.speedMod;
|
||||
float endSpeed = speed * mod;
|
||||
|
||||
if (endSpeed > 41 && !this.isCSR)
|
||||
endSpeed = 41;
|
||||
@@ -2901,6 +2925,24 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
}
|
||||
|
||||
public synchronized void grantXP(int xp) {
|
||||
int groupSize = 1;
|
||||
if(GroupManager.getGroup(this)!= null)
|
||||
groupSize = GroupManager.getGroup(this).members.size();
|
||||
if(this.promotionClass == null && this.level == 10){
|
||||
this.setOverFlowEXP(0);
|
||||
this.update(false);
|
||||
this.incVer();
|
||||
this.recalculate();
|
||||
this.calculateMaxHealthManaStamina();
|
||||
this.setHealth(this.healthMax);
|
||||
this.mana.set(this.manaMax);
|
||||
this.stamina.set(this.staminaMax);
|
||||
//LoadJob.reloadCharacter(this);
|
||||
DbManager.PlayerCharacterQueries.SET_PROPERTY(this, "char_experience", this.exp);
|
||||
// updateDatabase();
|
||||
DbManager.AccountQueries.INVALIDATE_LOGIN_CACHE(this.getObjectUUID(), "character");
|
||||
return;
|
||||
}
|
||||
// Stop players from getting experience past the cap
|
||||
if (this.exp + xp >= Experience.getBaseExperience(MBServerStatics.LEVELCAP))
|
||||
xp = Experience.getBaseExperience(MBServerStatics.LEVELCAP) - this.exp + 1;
|
||||
@@ -3036,6 +3078,14 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
SetObjectValueMsg upm = new SetObjectValueMsg(this, 9);
|
||||
DispatchMessage.dispatchMsgToInterestArea(this, upm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
||||
checkGuildStatus();
|
||||
|
||||
//give gold for level up if level is under or equal to 20 and over 10
|
||||
if(this.level >= 10 && this.level < 20) {
|
||||
int gold = (int) ((100000 * (this.level - 10) / 55.0) / groupSize);
|
||||
this.charItemManager.addGoldToInventory(gold, false);
|
||||
this.charItemManager.updateInventory();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
this.exp += remainingXP;
|
||||
@@ -3049,7 +3099,7 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
}
|
||||
|
||||
if (charReloadRequired) {
|
||||
this.update();
|
||||
this.update(false);
|
||||
this.incVer();
|
||||
this.recalculate();
|
||||
this.calculateMaxHealthManaStamina();
|
||||
@@ -3122,7 +3172,7 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
bonus += this.bonuses.getFloatPercentNullZero(ModType.Speed, SourceType.None);
|
||||
|
||||
// TODO get equip bonus
|
||||
this.update();
|
||||
this.update(false);
|
||||
this.speedMod = bonus;
|
||||
}
|
||||
|
||||
@@ -3355,11 +3405,11 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
public void recalculatePlayerStats(boolean initialized) {
|
||||
|
||||
//calculate base stats
|
||||
calculateBaseStats();
|
||||
this.calculateBaseStats();
|
||||
|
||||
//calculate base skills
|
||||
CharacterSkill.updateAllBaseAmounts(this);
|
||||
calculateModifiedStats();
|
||||
this.calculateModifiedStats();
|
||||
|
||||
//calculate modified skills
|
||||
CharacterSkill.updateAllModifiedAmounts(this);
|
||||
@@ -3369,13 +3419,13 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
|
||||
|
||||
//calculate ATR, damage and defense
|
||||
calculateAtrDefenseDamage();
|
||||
this.calculateAtrDefenseDamage();
|
||||
|
||||
//calculate movement bonus
|
||||
calculateSpeedMod();
|
||||
this.calculateSpeedMod();
|
||||
|
||||
// recalculate Max Health/Mana/Stamina
|
||||
calculateMaxHealthManaStamina();
|
||||
this.calculateMaxHealthManaStamina();
|
||||
|
||||
// recalculate Resists
|
||||
Resists.calculateResists(this);
|
||||
@@ -4601,7 +4651,7 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
|
||||
tmpLevel = targetLevel;
|
||||
|
||||
tmpLevel = (short) Math.min(tmpLevel, 75);
|
||||
tmpLevel = (short) Math.min(tmpLevel, MBServerStatics.LEVELCAP);
|
||||
|
||||
while (this.level < tmpLevel) {
|
||||
grantXP(Experience.getBaseExperience(tmpLevel) - this.exp);
|
||||
@@ -4791,28 +4841,47 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void forceRespawn(PlayerCharacter sourcePlayer) throws MsgSendException {
|
||||
|
||||
if (sourcePlayer == null)
|
||||
return;
|
||||
try {
|
||||
sourcePlayer.getClientConnection().disconnect();
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
public void update(Boolean newSystem) {
|
||||
|
||||
//if(!newSystem)
|
||||
// return;
|
||||
|
||||
if (this.updateLock.writeLock().tryLock()) {
|
||||
try {
|
||||
|
||||
if (!this.isAlive())
|
||||
if (!this.isAlive() && this.isEnteredWorld()) {
|
||||
if(!this.timestamps.containsKey("DeathTime")){
|
||||
this.timestamps.put("DeathTime",System.currentTimeMillis());
|
||||
}else if((System.currentTimeMillis() - this.timestamps.get("DeathTime")) > 600000)
|
||||
forceRespawn(this);
|
||||
return;
|
||||
|
||||
updateLocation();
|
||||
updateMovementState();
|
||||
updateRegen();
|
||||
}
|
||||
this.updateLocation();
|
||||
this.updateMovementState();
|
||||
this.updateRegen();
|
||||
|
||||
if (this.getStamina() < 10) {
|
||||
if (this.getAltitude() > 0 || this.getDesiredAltitude() > 0) {
|
||||
PlayerCharacter.GroundPlayer(this);
|
||||
updateRegen();
|
||||
this.updateRegen();
|
||||
}
|
||||
}
|
||||
|
||||
RealmMap.updateRealm(this);
|
||||
updateBlessingMessage();
|
||||
this.updateBlessingMessage();
|
||||
|
||||
this.safeZone = this.isInSafeZone();
|
||||
if(!this.timestamps.containsKey("nextBoxCheck"))
|
||||
@@ -4823,10 +4892,30 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
this.timestamps.put("nextBoxCheck", System.currentTimeMillis() + 10000);
|
||||
}
|
||||
|
||||
if(this.level < 10 && this.enteredWorld) {
|
||||
// this.setLevel((short) 10);
|
||||
while (this.level < 10) {
|
||||
grantXP(Experience.getBaseExperience(this.level + 1) - this.exp);
|
||||
}
|
||||
//if(this.charItemManager != null && this.charItemManager.getGoldInventory() != null && this.charItemManager.getGoldInventory().getNumOfItems() < 1000) {
|
||||
// this.getCharItemManager().addGoldToInventory(1000, false);
|
||||
// this.getCharItemManager().addItemToInventory(new MobLoot(this, ItemBase.getItemBase(980066), 1, false).promoteToItem(this));
|
||||
// this.getCharItemManager().updateInventory();
|
||||
//}
|
||||
}
|
||||
|
||||
if(this.isBoxed && !this.containsEffect(1672601862)) {
|
||||
PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false);
|
||||
}
|
||||
|
||||
if(this.isFlying()){
|
||||
//if (!AbstractCharacter.CanFly(this)) {
|
||||
if(this.effects.containsKey("MoveBuff")){
|
||||
GroundPlayer(this);
|
||||
//ChatManager.chatSystemInfo(this, "You Cannot Fly While Having A MovementBuff");
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.error(e);
|
||||
} finally {
|
||||
@@ -4853,6 +4942,9 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
|
||||
}
|
||||
public static boolean checkIfBoxed(PlayerCharacter player){
|
||||
if(ConfigManager.MB_WORLD_TESTMODE.getValue().equals("true")) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
String machineID = player.getClientConnection().machineID;
|
||||
ArrayList<PlayerCharacter> sameMachine = new ArrayList<>();
|
||||
@@ -5474,7 +5566,7 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
@Override
|
||||
public final void setIsCasting(final boolean isCasting) {
|
||||
if (this.isCasting != isCasting)
|
||||
this.update();
|
||||
this.update(false);
|
||||
this.isCasting = isCasting;
|
||||
}
|
||||
|
||||
|
||||
@@ -150,6 +150,7 @@ public class PromotionClass extends AbstractGameObject {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,24 @@ public class Resists {
|
||||
private int protectionTrains = 0;
|
||||
private boolean immuneToAll;
|
||||
|
||||
public Resists() {
|
||||
this.immuneToAll = false;
|
||||
this.resists.put(DamageType.Slash, 0f);
|
||||
this.resists.put(DamageType.Crush, 0f);
|
||||
this.resists.put(DamageType.Pierce, 0f);
|
||||
this.resists.put(DamageType.Magic, 0f);
|
||||
this.resists.put(DamageType.Bleed, 0f);
|
||||
this.resists.put(DamageType.Poison, 0f);
|
||||
this.resists.put(DamageType.Mental, 0f);
|
||||
this.resists.put(DamageType.Holy, 0f);
|
||||
this.resists.put(DamageType.Unholy, 0f);
|
||||
this.resists.put(DamageType.Lightning, 0f);
|
||||
this.resists.put(DamageType.Fire, 0f);
|
||||
this.resists.put(DamageType.Cold, 0f);
|
||||
this.resists.put(DamageType.Healing, 0f);
|
||||
this.immuneTo.put(DamageType.Siege, true);
|
||||
|
||||
}
|
||||
/**
|
||||
* Generic Constructor
|
||||
*/
|
||||
@@ -49,6 +67,9 @@ public class Resists {
|
||||
case "Dropper":
|
||||
setDropperResists();
|
||||
break;
|
||||
case "Elite":
|
||||
setEliteResists();
|
||||
break;
|
||||
default:
|
||||
setGenericResists();
|
||||
break;
|
||||
@@ -252,6 +273,24 @@ public class Resists {
|
||||
this.immuneTo.put(DamageType.Siege, true);
|
||||
}
|
||||
|
||||
public final void setEliteResists() {
|
||||
this.immuneToAll = false;
|
||||
this.resists.put(DamageType.Slash, 75f);
|
||||
this.resists.put(DamageType.Crush, 75f);
|
||||
this.resists.put(DamageType.Pierce, 75f);
|
||||
this.resists.put(DamageType.Magic, 75f);
|
||||
this.resists.put(DamageType.Bleed, 75f);
|
||||
this.resists.put(DamageType.Poison, 75f);
|
||||
this.resists.put(DamageType.Mental, 75f);
|
||||
this.resists.put(DamageType.Holy, 75f);
|
||||
this.resists.put(DamageType.Unholy, 75f);
|
||||
this.resists.put(DamageType.Lightning, 75f);
|
||||
this.resists.put(DamageType.Fire, 75f);
|
||||
this.resists.put(DamageType.Cold, 75f);
|
||||
this.resists.put(DamageType.Healing, 0f);
|
||||
this.immuneTo.put(DamageType.Siege, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create generic resists
|
||||
*/
|
||||
@@ -415,7 +454,7 @@ public class Resists {
|
||||
*/
|
||||
public float getResistedDamage(AbstractCharacter source, AbstractCharacter target, DamageType type, float damage, int trains) {
|
||||
//handle fortitudes
|
||||
damage = handleFortitude(target, type, damage);
|
||||
//damage = handleFortitude(target, type, damage);
|
||||
//calculate armor piercing
|
||||
float ap = source.getBonuses().getFloatPercentAll(ModType.ArmorPiercing, SourceType.None);
|
||||
float damageAfterResists = damage * (1 - (this.getResist(type, trains) * 0.01f) + ap);
|
||||
@@ -438,6 +477,7 @@ public class Resists {
|
||||
}
|
||||
target.cancelOnTakeDamage(type, (damageAfterResists));
|
||||
}
|
||||
damageAfterResists = handleFortitude(target, type, damageAfterResists);
|
||||
return damageAfterResists;
|
||||
}
|
||||
|
||||
@@ -447,6 +487,38 @@ public class Resists {
|
||||
// get resists for runes
|
||||
PlayerBonuses rb = ac.getBonuses();
|
||||
float slash = 0f, crush = 0f, pierce = 0f, magic = 0f, bleed = 0f, mental = 0f, holy = 0f, unholy = 0f, poison = 0f, lightning = 0f, fire = 0f, cold = 0f, healing = 0f;
|
||||
if(ac.getObjectType().equals(Enum.GameObjectType.Mob)){
|
||||
Mob mob = (Mob)ac;
|
||||
if(mob.StrongholdEpic || mob.StrongholdCommander || mob.StrongholdGuardian) {
|
||||
slash = 75f;
|
||||
crush = 75f;
|
||||
pierce = 75f;
|
||||
magic = 75f;
|
||||
bleed = 75f;
|
||||
mental = 75f;
|
||||
holy = 75f;
|
||||
unholy = 75f;
|
||||
poison = 75f;
|
||||
lightning = 75f;
|
||||
fire = 75f;
|
||||
cold = 75f;
|
||||
healing = 0f;
|
||||
} else if(Mob.discDroppers.contains(mob) || mob.isDropper) {
|
||||
slash = 200f;
|
||||
crush = 200f;
|
||||
pierce = 200f;
|
||||
magic = 200f;
|
||||
bleed = 200f;
|
||||
mental = 200f;
|
||||
holy = 200f;
|
||||
unholy = 200f;
|
||||
poison = 200f;
|
||||
lightning = 200f;
|
||||
fire = 200f;
|
||||
cold = 200f;
|
||||
healing = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
if (rb != null) {
|
||||
// Handle immunities
|
||||
@@ -486,19 +558,6 @@ public class Resists {
|
||||
cold += rb.getFloat(ModType.Resistance, SourceType.Cold);
|
||||
healing += rb.getFloat(ModType.Resistance, SourceType.Healing); // DamageType.Healing.name());
|
||||
|
||||
//HHO
|
||||
|
||||
// String protectionString = rb.getString("protection");
|
||||
//
|
||||
// if (protectionString.isEmpty())
|
||||
// this.protection = null;
|
||||
// else try {
|
||||
// this.protection = DamageType.valueOf(rb.getString("protection"));
|
||||
// } catch (IllegalArgumentException e) {
|
||||
// Logger.error( "No enum for: " + protectionString);
|
||||
// this.protection = null;
|
||||
// }
|
||||
// this.protectionTrains = rb.getFloat("protection");
|
||||
}
|
||||
|
||||
// get resists from equipment
|
||||
|
||||
@@ -112,8 +112,8 @@ public class Zone extends AbstractGameObject {
|
||||
|
||||
if (zone.playerCityID > 0) {
|
||||
writer.put((byte) 1); // Player City - True
|
||||
writer.putFloat(Enum.CityBoundsType.GRID.extents);
|
||||
writer.putFloat(Enum.CityBoundsType.GRID.extents);
|
||||
writer.putFloat(Enum.CityBoundsType.GRID.extents + 128);
|
||||
writer.putFloat(Enum.CityBoundsType.GRID.extents + 128);
|
||||
} else
|
||||
writer.put((byte) 0); // Player City - False
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ public class AttributeEffectModifier extends AbstractEffectModifier {
|
||||
@Override
|
||||
public void applyBonus(AbstractCharacter ac, int trains) {
|
||||
|
||||
ac.update();
|
||||
ac.update(false);
|
||||
Float amount = 0f;
|
||||
PlayerBonuses bonus = ac.getBonuses();
|
||||
if (this.percentMod != 0f) { //Stat Percent Modifiers
|
||||
|
||||
@@ -29,7 +29,7 @@ public class HealthRecoverRateEffectModifier extends AbstractEffectModifier {
|
||||
@Override
|
||||
public void applyBonus(AbstractCharacter ac, int trains) {
|
||||
|
||||
ac.update();
|
||||
ac.update(false);
|
||||
Float amount = 0f;
|
||||
PlayerBonuses bonus = ac.getBonuses();
|
||||
if (this.useRampAdd)
|
||||
|
||||
@@ -39,7 +39,7 @@ public class NoModEffectModifier extends AbstractEffectModifier {
|
||||
PlayerCharacter flyer = (PlayerCharacter) ac;
|
||||
|
||||
if (flyer.getAltitude() > 0)
|
||||
flyer.update();
|
||||
flyer.update(false);
|
||||
PlayerCharacter.GroundPlayer(flyer);
|
||||
break;
|
||||
|
||||
|
||||
@@ -45,13 +45,10 @@ public class RunegateTeleportPowerAction extends AbstractPowerAction {
|
||||
Vector3fImmutable rgLoc;
|
||||
|
||||
for (Runegate runegate : Runegate._runegates.values()) {
|
||||
|
||||
rgLoc = runegate.gateBuilding.getLoc();
|
||||
|
||||
float distanceToRunegateSquared = source.getLoc().distanceSquared2D(rgLoc);
|
||||
|
||||
if (distanceToRunegateSquared < sqr(dist)) {
|
||||
dist = sqrt(distanceToRunegateSquared);
|
||||
float disToGate = source.getLoc().distanceSquared2D(rgLoc);
|
||||
if(disToGate < dist){
|
||||
dist = disToGate;
|
||||
rg = runegate.gateBuilding;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public class StealPowerAction extends AbstractPowerAction {
|
||||
@Override
|
||||
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
||||
|
||||
if (source == null || awo == null || !(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) || !(awo.getObjectType().equals(Enum.GameObjectType.Item)))
|
||||
if (source == null || awo == null || !(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)))
|
||||
return;
|
||||
|
||||
PlayerCharacter sourcePlayer = (PlayerCharacter) source;
|
||||
@@ -131,8 +131,23 @@ public class StealPowerAction extends AbstractPowerAction {
|
||||
//Handle target attacking back if in combat and has no other target
|
||||
CombatManager.handleRetaliate(ownerAC, sourcePlayer);
|
||||
|
||||
} else
|
||||
} else if (owner.getObjectType().equals(Enum.GameObjectType.Mob)){
|
||||
Mob ownerMob = (Mob) owner;
|
||||
|
||||
if (ownerMob.isSafeMode() || sourcePlayer.inSafeZone())
|
||||
return;
|
||||
|
||||
if (ownerMob.getLoc().distanceSquared(sourcePlayer.getLoc()) > sqr(MBServerStatics.LOOT_RANGE))
|
||||
return;
|
||||
|
||||
//mark thief and target as player aggressive
|
||||
sourcePlayer.setLastPlayerAttackTime();
|
||||
|
||||
//Handle target attacking back if in combat and has no other target
|
||||
CombatManager.handleRetaliate(ownerAC, sourcePlayer);
|
||||
}else{
|
||||
return;
|
||||
}
|
||||
|
||||
ClientConnection origin = sourcePlayer.getClientConnection();
|
||||
|
||||
|
||||
@@ -326,7 +326,7 @@ public class MBServerStatics {
|
||||
public static final int REGEN_SENSITIVITY_MOB = 1000; // calc regen ever X
|
||||
public static final int TOMBSTONE = 2024;
|
||||
public static final int LOGOUT_TIMER_MS = 1000; // logout delay applied
|
||||
public static final int CORPSE_CLEANUP_TIMER_MS = 15 * 60 * 1000; // Cleanup
|
||||
public static final int CORPSE_CLEANUP_TIMER_MS = 10 * 60 * 1000; // Cleanup
|
||||
public static final int DEFAULT_SPAWN_TIME_MS = 3 * 60 * 1000; // 3 minute
|
||||
public static final int SESSION_CLEANUP_TIMER_MS = 30 * 1000; // cleanup
|
||||
public static final int MOVEMENT_FREQUENCY_MS = 1000; // Update movement
|
||||
@@ -357,7 +357,7 @@ public class MBServerStatics {
|
||||
public static final int COMBAT_SEND_DODGE = 20;
|
||||
public static final int COMBAT_SEND_BLOCK = 21;
|
||||
public static final int COMBAT_SEND_PARRY = 22;
|
||||
public static final short LEVELCAP = 75;
|
||||
public static final short LEVELCAP = 80;
|
||||
public static final int LEVEL_CON_WHITE = 7;
|
||||
public static final int RESPAWN_TIMER = 90 * 1000;
|
||||
public static final int DESPAWN_TIMER = 12 * 1000;
|
||||
|
||||
@@ -210,6 +210,8 @@ public class LoginServer {
|
||||
nextServerTime = LocalDateTime.now().plusSeconds(1);
|
||||
}
|
||||
|
||||
//load realm for the server pop creation screen
|
||||
|
||||
if (LocalDateTime.now().isAfter(nextDatabaseTime)) {
|
||||
String pop = SimulationManager.getPopulationString();
|
||||
Logger.info("Keepalive: " + pop);
|
||||
@@ -276,6 +278,8 @@ public class LoginServer {
|
||||
Logger.info("Loading All Guilds");
|
||||
DbManager.GuildQueries.GET_ALL_GUILDS();
|
||||
|
||||
Logger.info("Loading All Realms");
|
||||
Realm.loadAllRealms();
|
||||
|
||||
Logger.info("***Boot Successful***");
|
||||
return true;
|
||||
|
||||
@@ -57,6 +57,7 @@ import java.nio.file.Paths;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Timer;
|
||||
|
||||
@@ -512,9 +513,53 @@ public class WorldServer {
|
||||
|
||||
Logger.info("Running garbage collection...");
|
||||
System.gc();
|
||||
|
||||
Logger.info("Starting Bane Thread");
|
||||
BaneThread.startBaneThread();
|
||||
|
||||
//Logger.info("Starting Player Update Thread");
|
||||
//UpdateThread.startUpdateThread();
|
||||
|
||||
|
||||
printThreads();
|
||||
Logger.info("Threads Running:");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void printThreads() {
|
||||
// Get the root thread group
|
||||
ThreadGroup rootGroup = Thread.currentThread().getThreadGroup();
|
||||
while (rootGroup.getParent() != null) {
|
||||
rootGroup = rootGroup.getParent();
|
||||
}
|
||||
|
||||
// Estimate the number of threads
|
||||
int activeThreads = rootGroup.activeCount();
|
||||
|
||||
// Create an array to hold the threads
|
||||
Thread[] threads = new Thread[activeThreads];
|
||||
|
||||
// Get the active threads
|
||||
rootGroup.enumerate(threads, true);
|
||||
|
||||
int availableThreads = Runtime.getRuntime().availableProcessors();
|
||||
|
||||
// Print the count
|
||||
Logger.info("Total threads in application: " + threads.length + " / " + availableThreads + " Total Threads On Machine");
|
||||
if(threads.length > (int)(availableThreads * 0.75f)){
|
||||
Logger.error("WARNING! Too many threads are being used, hardware update recommended");
|
||||
}
|
||||
|
||||
// Optionally, list the thread names
|
||||
Logger.info("Active threads:");
|
||||
for (Thread thread : threads) {
|
||||
if (thread != null) {
|
||||
Logger.info(thread.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean initDatabaselayer() {
|
||||
|
||||
// Try starting a GOM <-> DB connection.
|
||||
@@ -595,12 +640,16 @@ public class WorldServer {
|
||||
mobs = DbManager.MobQueries.GET_ALL_MOBS_FOR_ZONE(zone);
|
||||
|
||||
for (Mob m : mobs) {
|
||||
try{
|
||||
m.setObjectTypeMask(MBServerStatics.MASK_MOB | m.getTypeMasks());
|
||||
m.setLoc(m.getLoc());
|
||||
|
||||
//ADD GUARDS HERE.
|
||||
if (m.building != null && m.building.getBlueprint() != null && m.building.getBlueprint().getBuildingGroup() == BuildingGroup.BARRACK)
|
||||
DbManager.MobQueries.LOAD_PATROL_POINTS(m);
|
||||
} catch (Exception e) {
|
||||
Logger.error(m.getObjectUUID() + " returned an Error Message :" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
//Handle npc's
|
||||
@@ -671,6 +720,22 @@ public class WorldServer {
|
||||
delta = 60000;
|
||||
|
||||
}
|
||||
|
||||
//get additional logout timer for enemies nearby
|
||||
if(!playerCharacter.isInSafeZone()){
|
||||
HashSet<AbstractWorldObject> playersClose = WorldGrid.getObjectsInRangePartial(playerCharacter.loc,MBServerStatics.CHARACTER_LOAD_RANGE, MBServerStatics.MASK_PLAYER);
|
||||
boolean enemiesClose = false;
|
||||
for(AbstractWorldObject awo : playersClose){
|
||||
PlayerCharacter pc = (PlayerCharacter)awo;
|
||||
if(!pc.guild.getNation().equals(playerCharacter.guild.getNation()))
|
||||
enemiesClose = true;
|
||||
}
|
||||
if(enemiesClose){
|
||||
delta += 60000;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
playerCharacter.stopMovement(playerCharacter.getLoc());
|
||||
UpdateStateMsg updateStateMsg = new UpdateStateMsg();
|
||||
updateStateMsg.setPlayer(playerCharacter);
|
||||
@@ -688,8 +753,7 @@ public class WorldServer {
|
||||
playerCharacter.getLoadedStaticObjects().clear();
|
||||
|
||||
LogoutCharacterJob logoutJob = new LogoutCharacterJob(playerCharacter, this);
|
||||
JobContainer jc = JobScheduler.getInstance().scheduleJob(logoutJob,
|
||||
System.currentTimeMillis() + delta);
|
||||
JobContainer jc = JobScheduler.getInstance().scheduleJob(logoutJob, System.currentTimeMillis() + delta);
|
||||
playerCharacter.getTimers().put("Logout", jc);
|
||||
playerCharacter.getTimestamps().put("logout", System.currentTimeMillis());
|
||||
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.workthreads;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.db.archive.DataWarehouse;
|
||||
import engine.db.archive.MineRecord;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.StrongholdManager;
|
||||
import engine.mobileAI.Threads.MobAIThread;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.chat.ChatSystemMsg;
|
||||
import engine.objects.*;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class BaneThread implements Runnable {
|
||||
|
||||
public Long lastRun;
|
||||
public static int instancedelay = 10000;
|
||||
public BaneThread() {
|
||||
Logger.info(" BaneThread thread has started!");
|
||||
}
|
||||
|
||||
|
||||
public void processBanesWindow() {
|
||||
|
||||
try {
|
||||
for(int baneId : Bane.banes.keySet()){
|
||||
Bane bane = Bane.banes.get(baneId);
|
||||
if(bane.getSiegePhase().equals(Enum.SiegePhase.WAR)){
|
||||
bane.applyZergBuffs();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.error("BANE ERROR");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void run() {
|
||||
lastRun = System.currentTimeMillis();
|
||||
while (true) {
|
||||
if (System.currentTimeMillis() >= lastRun + instancedelay) { // Correct condition
|
||||
this.processBanesWindow();
|
||||
lastRun = System.currentTimeMillis(); // Update lastRun after processing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void startBaneThread() {
|
||||
Thread baneThread;
|
||||
baneThread = new Thread(new BaneThread());
|
||||
baneThread.setName("baneThread");
|
||||
baneThread.start();
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,9 @@ import org.pmw.tinylog.Logger;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
import static engine.gameManager.StrongholdManager.EndStronghold;
|
||||
import static engine.server.MBServerStatics.MINE_LATE_WINDOW;
|
||||
|
||||
public class HalfHourlyJobThread implements Runnable {
|
||||
@@ -39,12 +41,14 @@ public class HalfHourlyJobThread implements Runnable {
|
||||
try {
|
||||
|
||||
ArrayList<Mine> mines = Mine.getMines();
|
||||
|
||||
for(Mine mine : mines){
|
||||
if (mine.isStronghold)
|
||||
StrongholdManager.EndStronghold(mine);
|
||||
}
|
||||
for (Mine mine : mines) {
|
||||
try {
|
||||
|
||||
//handle mines opening on server reboot weird time interval
|
||||
if(LocalDateTime.now().isAfter(LocalDateTime.now().withHour(mine.openHour).withMinute(mine.openMinute))) {
|
||||
if (LocalDateTime.now().isAfter(LocalDateTime.now().withHour(mine.openHour).withMinute(mine.openMinute))) {
|
||||
if (LocalDateTime.now().isBefore(LocalDateTime.now().withHour(mine.openHour).withMinute(mine.openMinute).plusMinutes(30))) {
|
||||
HalfHourlyJobThread.mineWindowOpen(mine);
|
||||
continue;
|
||||
@@ -60,16 +64,20 @@ public class HalfHourlyJobThread implements Runnable {
|
||||
|
||||
// Close the mine if it reaches this far
|
||||
LocalDateTime openTime = LocalDateTime.now().withHour(mine.openHour).withMinute(mine.openMinute);
|
||||
if(LocalDateTime.now().plusMinutes(1).isAfter(openTime.plusMinutes(30)))
|
||||
if (LocalDateTime.now().plusMinutes(1).isAfter(openTime.plusMinutes(30)))
|
||||
mineWindowClose(mine);
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.error("mineID: " + mine.getObjectUUID(), e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
//StrongholdManager.processStrongholds();
|
||||
} catch (Exception e) {
|
||||
Logger.error(e.toString());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void mineWindowOpen(Mine mine) {
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.workthreads;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.gameManager.SimulationManager;
|
||||
import engine.objects.Bane;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
public class UpdateThread implements Runnable {
|
||||
|
||||
public Long lastRun;
|
||||
public static int instancedelay = 1000;
|
||||
public UpdateThread() {
|
||||
Logger.info(" UpdateThread thread has started!");
|
||||
}
|
||||
|
||||
|
||||
public void processPlayerUpdate() {
|
||||
|
||||
try {
|
||||
for(PlayerCharacter player : SessionManager.getAllActivePlayerCharacters()){
|
||||
player.update(true);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.error("UPDATE ERROR");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void run() {
|
||||
lastRun = System.currentTimeMillis();
|
||||
while (true) {
|
||||
if (System.currentTimeMillis() >= lastRun + instancedelay) { // Correct condition
|
||||
this.processPlayerUpdate();
|
||||
lastRun = System.currentTimeMillis(); // Update lastRun after processing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void startUpdateThread() {
|
||||
Thread updateThread;
|
||||
updateThread = new Thread(new UpdateThread());
|
||||
updateThread.setName("updateThread");
|
||||
updateThread.start();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user