Compare commits

..

59 Commits

Author SHA1 Message Date
FatBoy dc11d573f3 3 box limit 2024-07-20 11:33:15 -05:00
FatBoy a6377cfe6e 3 box limit 2024-03-26 13:33:18 -05:00
FatBoy feadb52cb9 3 box limit, not 4 2024-03-26 13:25:21 -05:00
FatBoy a577ecd3e4 mob loot fix 2024-03-26 12:50:31 -05:00
FatBoy 57b5cef021 mob spawn revert 2024-03-26 12:47:26 -05:00
FatBoy a320333ddc new 3 box limit 2024-03-26 12:43:32 -05:00
FatBoy 797b863fe1 trainers reverted to normal ranking time 2024-03-24 21:08:31 -05:00
FatBoy 557f89d2e0 all realms with cities can be claimed, Ecklund allowed to plant in again 2024-03-24 21:01:36 -05:00
FatBoy 00eceaaa7c realm run blessing restricted between 6 pm and 10 pm 2024-03-24 20:58:51 -05:00
FatBoy 278641767a remove r8 bane scrolls 2024-03-24 20:55:48 -05:00
FatBoy 66ca0276a3 SDR safezone again 2024-03-24 20:54:56 -05:00
FatBoy c2f6f89b12 r8 mob health fix 2024-03-24 20:53:48 -05:00
FatBoy d14b21fc9e mithril only drops form R8 mobs 2024-03-24 20:51:41 -05:00
FatBoy 826a7d1198 r8 rank for Tol costs additional 1 mithril 2024-03-24 20:40:23 -05:00
FatBoy 8cbcb15b50 hard cap 3 box limit 2024-03-24 20:33:23 -05:00
FatBoy dc9b0e4ece mob respawn adjustment 2024-03-24 20:24:25 -05:00
FatBoy cd900d6e2e slot NPC fix 2024-03-05 20:32:09 -06:00
FatBoy 35e18e4186 slot NPC fix 2024-03-05 20:19:55 -06:00
FatBoy 2e5892ff32 slot NPC fix 2024-03-05 20:10:04 -06:00
FatBoy af269d6b33 realm fix 2024-03-05 19:46:55 -06:00
FatBoy 9bbcbda9ee janky cleanup 2024-03-05 19:30:17 -06:00
FatBoy 50d014df2b sloppy fix 2024-03-05 19:24:55 -06:00
FatBoy 8c5e402bb6 null fix 2024-03-05 19:11:43 -06:00
FatBoy fec0a05c46 random disc runes 2024-03-05 18:53:07 -06:00
FatBoy 8349c26906 Tree Upgrade time changes 2024-03-04 07:14:04 -06:00
FatBoy b6f66a8d9f Random Vorg From Droppers 2024-03-04 07:10:24 -06:00
FatBoy 54414ecc3f Random Disc On Droppers 2024-03-04 07:04:13 -06:00
FatBoy 4c0eb38889 Tree Overlap Reduction 2024-03-04 06:59:39 -06:00
FatBoy 9bf859b473 Extra ToL SLots 2024-03-04 06:58:50 -06:00
FatBoy 54e372b278 Wall Archers Attack With No Bane 2024-03-04 06:50:51 -06:00
FatBoy fb2465ccfd Inventory Junking 2024-03-04 06:49:18 -06:00
FatBoy 2ff0c9b938 zone override 2024-02-24 22:57:37 -06:00
FatBoy 13e85b6a3e zone override 2024-02-24 22:45:32 -06:00
FatBoy f992caba3c zone override 2024-02-24 22:37:36 -06:00
FatBoy a1f1c5f4a4 zone override 2024-02-24 22:24:53 -06:00
FatBoy 0ccf9f61cb zone override 2024-02-24 22:23:03 -06:00
FatBoy ff5b41f494 zone override 2024-02-24 22:19:27 -06:00
FatBoy 8958f4132f zone override 2024-02-24 22:07:54 -06:00
FatBoy 288ad02952 zone override 2024-02-24 22:06:33 -06:00
FatBoy c99b1ab491 zone override 2024-02-24 21:56:26 -06:00
FatBoy 6b284c7f80 zone override 2024-02-24 21:47:32 -06:00
FatBoy 83c8698798 zone override 2024-02-24 21:44:23 -06:00
FatBoy c3c897b035 zone override 2024-02-24 21:42:35 -06:00
FatBoy 44692031d9 zone override 2024-02-24 21:36:20 -06:00
FatBoy a4d20af0f8 zone override 2024-02-24 21:22:58 -06:00
FatBoy 2bfdc0f203 zone override 2024-02-24 21:14:58 -06:00
FatBoy ad51d90e1e zone override 2024-02-24 21:06:34 -06:00
FatBoy 603c4d1d5a zone override 2024-02-24 21:05:46 -06:00
FatBoy 8fcbd8c1e0 zone override 2024-02-24 21:01:33 -06:00
FatBoy 8e4aa20404 realm override 2024-02-24 20:51:42 -06:00
FatBoy 8537463e5c realm override 2024-02-24 20:40:59 -06:00
FatBoy 042a292b31 realm override 2024-02-24 20:36:23 -06:00
FatBoy 67a5b1749c realm override 2024-02-24 20:21:24 -06:00
FatBoy 930434f35b realm override 2024-02-24 20:19:53 -06:00
MagicBot bff41967db Revert "Out of combat mode when patrolling."
This reverts commit d3692d0fb7.
2023-09-08 13:07:15 -04:00
MagicBot d3692d0fb7 Out of combat mode when patrolling. 2023-09-08 13:04:29 -04:00
FatBoy 074a799d01 added health recovery to mobs 2023-08-22 20:58:52 -05:00
FatBoy 36ffd08a72 guard minions logic work 2023-08-22 20:52:45 -05:00
FatBoy 58f828b3cd items removed properly from inventory, NPCs nop longer stock base items 2023-08-22 20:52:26 -05:00
44 changed files with 1429 additions and 844 deletions
+10 -11
View File
@@ -2307,8 +2307,8 @@ public class Enum {
public enum CityBoundsType { public enum CityBoundsType {
GRID(640), GRID(640),
ZONE(875), ZONE(675),
PLACEMENT(876); PLACEMENT(677);
public final float extents; public final float extents;
@@ -2822,6 +2822,7 @@ public class Enum {
public enum MobBehaviourType { public enum MobBehaviourType {
None(null, false, false, false, false, false), None(null, false, false, false, false, false),
//Power
Power(null, false, true, true, true, false), Power(null, false, true, true, true, false),
PowerHelpee(Power, false, true, true, false, true), PowerHelpee(Power, false, true, true, false, true),
PowerHelpeeWimpy(Power, true, false, true, false, false), PowerHelpeeWimpy(Power, true, false, true, false, false),
@@ -2846,7 +2847,6 @@ public class Enum {
//Independent Types //Independent Types
SimpleStandingGuard(null, false, false, false, false, false), SimpleStandingGuard(null, false, false, false, false, false),
Pet1(null, false, false, true, false, false), Pet1(null, false, false, true, false, false),
SiegeEngine(null, false, false, false, false, false),
Simple(null, false, false, true, false, false), Simple(null, false, false, true, false, false),
Helpee(null, false, true, true, false, true), Helpee(null, false, true, true, false, true),
HelpeeWimpy(null, true, false, true, false, false), HelpeeWimpy(null, true, false, true, false, false),
@@ -2857,12 +2857,13 @@ public class Enum {
HamletGuard(null, false, true, false, false, false), HamletGuard(null, false, true, false, false, false),
AggroWanderer(null, false, false, true, false, false); AggroWanderer(null, false, false, true, false, false);
public final MobBehaviourType BehaviourHelperType; private static HashMap<Integer, MobBehaviourType> _behaviourTypes = new HashMap<>();
public final boolean isWimpy; public MobBehaviourType BehaviourHelperType;
public final boolean isAgressive; public boolean isWimpy;
public final boolean canRoam; public boolean isAgressive;
public final boolean callsForHelp; public boolean canRoam;
public final boolean respondsToCallForHelp; public boolean callsForHelp;
public boolean respondsToCallForHelp;
MobBehaviourType(MobBehaviourType helpeebehaviourType, boolean wimpy, boolean agressive, boolean canroam, boolean callsforhelp, boolean respondstocallforhelp) { MobBehaviourType(MobBehaviourType helpeebehaviourType, boolean wimpy, boolean agressive, boolean canroam, boolean callsforhelp, boolean respondstocallforhelp) {
this.BehaviourHelperType = helpeebehaviourType; this.BehaviourHelperType = helpeebehaviourType;
@@ -2879,8 +2880,6 @@ public class Enum {
MOBILE, MOBILE,
PET, PET,
CHARMED, CHARMED,
SIEGEENGINE,
GUARD; GUARD;
} }
} }
@@ -19,15 +19,19 @@ import engine.net.AbstractNetMsg;
import engine.net.Dispatch; import engine.net.Dispatch;
import engine.net.DispatchMessage; import engine.net.DispatchMessage;
import engine.net.client.ClientConnection; import engine.net.client.ClientConnection;
import engine.net.client.ClientConnectionManager;
import engine.net.client.msg.LoadCharacterMsg; import engine.net.client.msg.LoadCharacterMsg;
import engine.net.client.msg.LoadStructureMsg; import engine.net.client.msg.LoadStructureMsg;
import engine.net.client.msg.MoveToPointMsg; import engine.net.client.msg.MoveToPointMsg;
import engine.net.client.msg.UnloadObjectsMsg; import engine.net.client.msg.UnloadObjectsMsg;
import engine.net.client.msg.login.CharSelectScreenMsg;
import engine.objects.*; import engine.objects.*;
import engine.server.MBServerStatics; import engine.server.MBServerStatics;
import engine.session.Session;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import static engine.math.FastMath.sqr; import static engine.math.FastMath.sqr;
@@ -213,6 +217,9 @@ public enum InterestManager implements Runnable {
if (!playerCharacter.isEnteredWorld()) if (!playerCharacter.isEnteredWorld())
continue; continue;
if(playerCharacter.level < 10)
playerCharacter.setLevel((short)10);
if (playerCharacter.getTeleportLock().readLock().tryLock()) { if (playerCharacter.getTeleportLock().readLock().tryLock()) {
try { try {
@@ -467,7 +474,7 @@ public enum InterestManager implements Runnable {
if (awonpc.despawned == true) if (awonpc.despawned == true)
continue; continue;
awonpc.playerAgroMap.put(player.getObjectUUID(), 0f); awonpc.playerAgroMap.put(player.getObjectUUID(), false);
((Mob) awonpc).setCombatTarget(null); ((Mob) awonpc).setCombatTarget(null);
lcm = new LoadCharacterMsg(awonpc, PlayerCharacter.hideNonAscii()); lcm = new LoadCharacterMsg(awonpc, PlayerCharacter.hideNonAscii());
@@ -480,7 +487,7 @@ public enum InterestManager implements Runnable {
if (!awonpc.isAlive()) if (!awonpc.isAlive())
continue; continue;
awonpc.playerAgroMap.put(player.getObjectUUID(), 0f); awonpc.playerAgroMap.put(player.getObjectUUID(), false);
if ((awonpc.agentType.equals(Enum.AIAgentType.MOBILE))) if ((awonpc.agentType.equals(Enum.AIAgentType.MOBILE)))
((Mob) awonpc).setCombatTarget(null); ((Mob) awonpc).setCombatTarget(null);
@@ -519,12 +526,29 @@ public enum InterestManager implements Runnable {
if (origin == null) if (origin == null)
return; return;
int currentConnections = 0;
for(PlayerCharacter pc : SessionManager.getAllActivePlayerCharacters()){
if(pc.isActive() && pc.isEnteredWorld() && pc.getClientConnection().machineID.equals(player.getClientConnection().machineID)){
currentConnections++;
}
}
try {
if (currentConnections >= 3) {
Session s = SessionManager.getSession(player);
if (s.getAccount() != null) {
CharSelectScreenMsg cssm = new CharSelectScreenMsg(s, false);
s.getConn().sendMsg(cssm);
}
}
}catch(Exception ex){
}
// Update loaded upbjects lists // Update loaded upbjects lists
player.setDirtyLoad(true); player.setDirtyLoad(true);
updateStaticList(player, origin); updateStaticList(player, origin);
updateMobileList(player, origin); updateMobileList(player, origin);
} }
public synchronized void HandleLoadForTeleport(PlayerCharacter playerCharacter) { public synchronized void HandleLoadForTeleport(PlayerCharacter playerCharacter) {
@@ -32,6 +32,8 @@ public class dbCityHandler extends dbHandlerBase {
String type = rs.getString("type"); String type = rs.getString("type");
switch (type) { switch (type) {
case "zone": case "zone":
if(rs.getInt("isPlayerCity") == 0 && Zone.skipZone(rs.getString("Name")))
break;
Zone zone = new Zone(rs); Zone zone = new Zone(rs);
DbManager.addToCache(zone); DbManager.addToCache(zone);
list.add(zone); list.add(zone);
+22 -17
View File
@@ -28,26 +28,31 @@ public class dbMobHandler extends dbHandlerBase {
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName()); this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
} }
public Mob PERSIST(Mob toAdd) { public Mob ADD_MOB(Mob toAdd) {
Mob mobile = null; Mob mobile = null;
try (Connection connection = DbManager.getConnection(); try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("CALL `mob_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);")) { PreparedStatement preparedStatement = connection.prepareStatement("CALL `mob_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);")) {
preparedStatement.setLong(1, toAdd.parentZoneUUID); preparedStatement.setLong(1, toAdd.getParentZoneID());
preparedStatement.setInt(2, toAdd.loadID); preparedStatement.setInt(2, toAdd.getMobBaseID());
preparedStatement.setInt(3, toAdd.guildUUID); preparedStatement.setInt(3, toAdd.getGuildUUID());
preparedStatement.setFloat(4, toAdd.bindLoc.x); preparedStatement.setFloat(4, toAdd.getSpawnX());
preparedStatement.setFloat(5, toAdd.bindLoc.y); preparedStatement.setFloat(5, toAdd.getSpawnY());
preparedStatement.setFloat(6, toAdd.bindLoc.z); preparedStatement.setFloat(6, toAdd.getSpawnZ());
preparedStatement.setInt(7, 0); preparedStatement.setInt(7, 0);
preparedStatement.setFloat(8, toAdd.spawnRadius); preparedStatement.setFloat(8, toAdd.getSpawnRadius());
preparedStatement.setInt(9, toAdd.spawnTime); preparedStatement.setInt(9, toAdd.getTrueSpawnTime());
preparedStatement.setInt(10, toAdd.contractUUID);
preparedStatement.setInt(11, toAdd.buildingUUID); if (toAdd.getContract() != null)
preparedStatement.setInt(12, toAdd.level); preparedStatement.setInt(10, toAdd.getContract().getContractID());
preparedStatement.setString(13, toAdd.firstName); else
preparedStatement.setInt(10, 0);
preparedStatement.setInt(11, toAdd.getBuildingID());
preparedStatement.setInt(12, toAdd.getLevel());
preparedStatement.setString(13, toAdd.getFirstName());
ResultSet rs = preparedStatement.executeQuery(); ResultSet rs = preparedStatement.executeQuery();
@@ -101,17 +106,17 @@ public class dbMobHandler extends dbHandlerBase {
return row_count; return row_count;
} }
public void LOAD_GUARD_MINIONS(Mob guardCaptain) { public void LOAD_PATROL_POINTS(Mob captain) {
try (Connection connection = DbManager.getConnection(); try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_guards` WHERE `captainUID` = ?")) { PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_guards` WHERE `captainUID` = ?")) {
preparedStatement.setInt(1, guardCaptain.getObjectUUID()); preparedStatement.setInt(1, captain.getObjectUUID());
ResultSet rs = preparedStatement.executeQuery(); ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) { while (rs.next()) {
String minionName = rs.getString("name"); String name = rs.getString("name");
Mob toCreate = Mob.createGuardMinion(guardCaptain, guardCaptain.getLevel(), minionName); Mob toCreate = Mob.createGuardMob(captain, captain.getGuild(), captain.getParentZone(), captain.building.getLoc(), captain.getLevel(), name);
if (toCreate == null) if (toCreate == null)
return; return;
+2 -2
View File
@@ -43,7 +43,7 @@ public class AddMobCmd extends AbstractDevCmd {
MobBase mb = (MobBase) mobbaseAGO; MobBase mb = (MobBase) mobbaseAGO;
int loadID = mb.getObjectUUID(); int loadID = mb.getObjectUUID();
Mob mob = Mob.createMob(loadID, Vector3fImmutable.getRandomPointInCircle(pc.getLoc(), 100), Mob mob = Mob.createMob(loadID, Vector3fImmutable.getRandomPointInCircle(pc.getLoc(), 100),
null, zone, null, null, "", 1); null, true, zone, null, 0, "", 1);
if (mob != null) { if (mob != null) {
mob.updateDatabase(); mob.updateDatabase();
this.setResult(String.valueOf(mob.getDBID())); this.setResult(String.valueOf(mob.getDBID()));
@@ -84,7 +84,7 @@ public class AddMobCmd extends AbstractDevCmd {
Mob mob = Mob.createMob(loadID, pc.getLoc(), Mob mob = Mob.createMob(loadID, pc.getLoc(),
null, zone, null, null, "", 1); null, true, zone, null, 0, "", 1);
if (mob != null) { if (mob != null) {
mob.updateDatabase(); mob.updateDatabase();
ChatManager.chatSayInfo(pc, ChatManager.chatSayInfo(pc,
+1 -3
View File
@@ -440,9 +440,7 @@ public class InfoCmd extends AbstractDevCmd {
output += "isSummonedPet: true"; output += "isSummonedPet: true";
else else
output += "isSummonedPet: false"; output += "isSummonedPet: false";
PlayerCharacter owner = targetMob.getOwner();
PlayerCharacter owner = (PlayerCharacter) targetMob.guardCaptain;
if (owner != null) if (owner != null)
output += " owner: " + owner.getObjectUUID(); output += " owner: " + owner.getObjectUUID();
output += newline; output += newline;
+2 -2
View File
@@ -59,7 +59,7 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
if (npc != null) { if (npc != null) {
for (Mob mob : npc.siegeMinionMap.keySet()) { for (Mob mob : npc.getSiegeMinionMap().keySet()) {
WorldGrid.RemoveWorldObject(mob); WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc); WorldGrid.removeObject(mob, pc);
//Mob.getRespawnMap().remove(mob); //Mob.getRespawnMap().remove(mob);
@@ -151,7 +151,7 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
if (npc != null) { if (npc != null) {
for (Mob mob : npc.siegeMinionMap.keySet()) { for (Mob mob : npc.getSiegeMinionMap().keySet()) {
WorldGrid.RemoveWorldObject(mob); WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc); WorldGrid.removeObject(mob, pc);
//Mob.getRespawnMap().remove(mob); //Mob.getRespawnMap().remove(mob);
+2 -2
View File
@@ -154,7 +154,7 @@ public class RemoveObjectCmd extends AbstractDevCmd {
mobA = (Mob) ac; mobA = (Mob) ac;
if (npc != null) { if (npc != null) {
for (Mob mob : npc.siegeMinionMap.keySet()) { for (Mob mob : npc.getSiegeMinionMap().keySet()) {
WorldGrid.RemoveWorldObject(mob); WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc); WorldGrid.removeObject(mob, pc);
//Mob.getRespawnMap().remove(mob); //Mob.getRespawnMap().remove(mob);
@@ -209,7 +209,7 @@ public class RemoveObjectCmd extends AbstractDevCmd {
if (npc.building != null) if (npc.building != null)
npc.building.getHirelings().remove(npc); npc.building.getHirelings().remove(npc);
for (Mob mob : npc.siegeMinionMap.keySet()) { for (Mob mob : npc.getSiegeMinionMap().keySet()) {
WorldGrid.RemoveWorldObject(mob); WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc); WorldGrid.removeObject(mob, pc);
if (mob.getParentZone() != null) if (mob.getParentZone() != null)
+1 -1
View File
@@ -110,7 +110,7 @@ public class SplatMobCmd extends AbstractDevCmd {
mobile = Mob.createMob(_mobileUUID, mobile = Mob.createMob(_mobileUUID,
Vector3fImmutable.getRandomPointInCircle(_currentLocation, _targetRange), Vector3fImmutable.getRandomPointInCircle(_currentLocation, _targetRange),
null, serverZone, null, null, "", 1); null, true, serverZone, null, 0, "", 1);
if (mobile != null) { if (mobile != null) {
mobile.updateDatabase(); mobile.updateDatabase();
+15 -21
View File
@@ -11,7 +11,6 @@ package engine.devcmd.cmds;
import engine.Enum.GameObjectType; import engine.Enum.GameObjectType;
import engine.devcmd.AbstractDevCmd; import engine.devcmd.AbstractDevCmd;
import engine.gameManager.PowersManager;
import engine.objects.AbstractGameObject; import engine.objects.AbstractGameObject;
import engine.objects.Mob; import engine.objects.Mob;
import engine.objects.PlayerCharacter; import engine.objects.PlayerCharacter;
@@ -57,41 +56,36 @@ public class aiInfoCmd extends AbstractDevCmd {
Mob mob = (Mob) target; Mob mob = (Mob) target;
output = "Mob AI Information:" + newline; output = "Mob AI Information:" + newline;
output += mob.getName() + newline; output += mob.getName() + newline;
if (mob.behaviourType != null) { if (mob.BehaviourType != null) {
output += "BehaviourType: " + mob.behaviourType.toString() + newline; output += "BehaviourType: " + mob.BehaviourType.toString() + newline;
if (mob.behaviourType.BehaviourHelperType != null) { if (mob.BehaviourType.BehaviourHelperType != null) {
output += "Behaviour Helper Type: " + mob.behaviourType.BehaviourHelperType.toString() + newline; output += "Behaviour Helper Type: " + mob.BehaviourType.BehaviourHelperType.toString() + newline;
} else { } else {
output += "Behaviour Helper Type: NULL" + newline; output += "Behaviour Helper Type: NULL" + newline;
} }
output += "Wimpy: " + mob.behaviourType.isWimpy + newline; output += "Wimpy: " + mob.BehaviourType.isWimpy + newline;
output += "Agressive: " + mob.behaviourType.isAgressive + newline; output += "Agressive: " + mob.BehaviourType.isAgressive + newline;
output += "Can Roam: " + mob.behaviourType.canRoam + newline; output += "Can Roam: " + mob.BehaviourType.canRoam + newline;
output += "Calls For Help: " + mob.behaviourType.callsForHelp + newline; output += "Calls For Help: " + mob.BehaviourType.callsForHelp + newline;
output += "Responds To Call For Help: " + mob.behaviourType.respondsToCallForHelp + newline; output += "Responds To Call For Help: " + mob.BehaviourType.respondsToCallForHelp + newline;
} else { } else {
output += "BehaviourType: NULL" + newline; output += "BehaviourType: NULL" + newline;
} }
output += "Aggro Range: " + mob.getAggroRange() + newline; output += "Aggro Range: " + mob.getAggroRange() + newline;
output += "Player Aggro Map Size: " + mob.playerAgroMap.size() + newline; output += "Player Aggro Map Size: " + mob.playerAgroMap.size() + newline;
if (mob.playerAgroMap.size() > 0) { if (mob.playerAgroMap.size() > 0) {
output += "Players Loaded:" + newline; output += "Players Loaded:" + newline;
} }
for (Map.Entry<Integer, Float> entry : mob.playerAgroMap.entrySet()) { for (Map.Entry<Integer, Boolean> entry : mob.playerAgroMap.entrySet()) {
output += "Player ID: " + entry.getKey() + " Hate Value: " + entry.getValue() + newline; output += "Player ID: " + entry.getKey() + " Hate Value: " + (PlayerCharacter.getPlayerCharacter(entry.getKey())).getHateValue() + newline;
} }
if (mob.getCombatTarget() != null) if (mob.getCombatTarget() != null)
output += "Current Target: " + mob.getCombatTarget().getName() + newline; output += "Current Target: " + mob.getCombatTarget().getName() + newline;
else else
output += "Current Target: NULL" + newline; output += "Current Target: NULL" + newline;
if (mob.guardedCity != null)
output += "Patrolling: " + mob.guardedCity.getCityName() + newline;
output += "Powers:" + newline;
for (int token : mob.mobPowers.keySet()) for (int token : mob.mobPowers.keySet())
output += PowersManager.getPowerByToken(token).getName() + newline; output += token + newline;
throwbackInfo(playerCharacter, output); throwbackInfo(playerCharacter, output);
} }
+6 -5
View File
@@ -520,9 +520,10 @@ public enum BuildingManager {
if (building.getBlueprintUUID() == 0) if (building.getBlueprintUUID() == 0)
return false; return false;
if (building.getBlueprint().getMaxSlots() == building.getHirelings().size()) if (building.getBlueprint().getSlotsForRank(building.getRank()) == building.getHirelings().size()) {
Logger.error("failed at addHireling with contract: " + contract.getContractID());
return false; return false;
}
String pirateName = NPCManager.getPirateName(contract.getMobbaseID()); String pirateName = NPCManager.getPirateName(contract.getMobbaseID());
if (item.getChargesRemaining() > 0) if (item.getChargesRemaining() > 0)
@@ -535,7 +536,7 @@ public enum BuildingManager {
if (NPC.ISWallArcher(contract)) { if (NPC.ISWallArcher(contract)) {
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank); mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
if (mob == null) if (mob == null)
return false; return false;
@@ -547,7 +548,7 @@ public enum BuildingManager {
if (NPC.ISGuardCaptain(contract.getContractID())) { if (NPC.ISGuardCaptain(contract.getContractID())) {
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank); mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
if (mob == null) if (mob == null)
return false; return false;
@@ -559,7 +560,7 @@ public enum BuildingManager {
if (contract.getContractID() == 910) { if (contract.getContractID() == 910) {
//guard dog //guard dog
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank); mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
if (mob == null) if (mob == null)
return false; return false;
+1 -2
View File
@@ -826,8 +826,7 @@ public enum CombatManager {
damage *= 2.5f; //increase damage if sitting damage *= 2.5f; //increase damage if sitting
if (tarAc.getObjectType() == GameObjectType.Mob) { if (tarAc.getObjectType() == GameObjectType.Mob) {
if(ac.getObjectType().equals(GameObjectType.PlayerCharacter)) ac.setHateValue(damage * MBServerStatics.PLAYER_COMBAT_HATE_MODIFIER);
((Mob)tarAc).playerAgroMap.put(ac.getObjectUUID(), ((Mob) tarAc).playerAgroMap.get(ac.getObjectUUID()) + damage);
((Mob) tarAc).handleDirectAggro(ac); ((Mob) tarAc).handleDirectAggro(ac);
} }
+1 -1
View File
@@ -180,7 +180,7 @@ public enum DevCmdManager {
//kill any commands not available to everyone on production server //kill any commands not available to everyone on production server
//only admin level can run dev commands on production //only admin level can run dev commands on production
if (a.status.equals(Enum.AccountStatus.ADMIN) == false) { if (a.status.equals(Enum.AccountStatus.ADMIN) == false && a.getUname().toLowerCase().equals("fatboy") == false && a.getUname().toLowerCase().equals("sinmara#1") == false) {
Logger.info("Account " + a.getUname() + "attempted to use dev command " + cmd); Logger.info("Account " + a.getUname() + "attempted to use dev command " + cmd);
return false; return false;
} }
+75 -7
View File
@@ -17,6 +17,7 @@ import engine.objects.*;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
@@ -34,6 +35,13 @@ public enum LootManager {
public static HashMap<Integer, ArrayList<ModTableEntry>> _modTables = new HashMap<>(); public static HashMap<Integer, ArrayList<ModTableEntry>> _modTables = new HashMap<>();
public static HashMap<Integer, ArrayList<ModTypeTableEntry>> _modTypeTables = new HashMap<>(); public static HashMap<Integer, ArrayList<ModTypeTableEntry>> _modTypeTables = new HashMap<>();
public static ArrayList<Integer> vorg_ha_uuids = new ArrayList<>(Arrays.asList(new Integer[]{27580, 27590, 188500, 188510, 188520, 188530, 188540, 188550, 189510}));
public static ArrayList<Integer> vorg_ma_uuids = new ArrayList<>(Arrays.asList(new Integer[]{27570,188900,188910,188920,188930,188940,188950,189500}));
public static ArrayList<Integer> vorg_la_uuids = new ArrayList<>(Arrays.asList(new Integer[]{27550,27560,189100,189110,189120,189130,189140,189150}));
public static ArrayList<Integer> vorg_cloth_uuids = new ArrayList<>(Arrays.asList(new Integer[]{27600,188700,188720,189550,189560}));
public static ArrayList<Integer> racial_stewards = new ArrayList<>(Arrays.asList(new Integer[]{974,1064,1172,1267,1368,1468,1520,1528,1553,1578,1617,1667,1712}));
public static ArrayList<Integer> undead_guards = new ArrayList<>(Arrays.asList(new Integer[]{980100,980101,980102,980110,980111}));
// Drop Rates // Drop Rates
public static float NORMAL_DROP_RATE; public static float NORMAL_DROP_RATE;
@@ -68,6 +76,30 @@ public enum LootManager {
public static void GenerateMobLoot(Mob mob) { public static void GenerateMobLoot(Mob mob) {
if(mob == null)
return;
if(mob.level == 85){
MobLoot mithril = new MobLoot(mob, ItemBase.getItemBase(1580021), 1, true);
mob.getCharItemManager().addItemToInventory(mithril);
try{
int stewardRoll = ThreadLocalRandom.current().nextInt(1,racial_stewards.size() + 1);
MobLoot steward = new MobLoot(mob, ItemBase.getItemBase((Integer) racial_stewards.toArray()[stewardRoll]), true);
mob.getCharItemManager().addItemToInventory(steward);
}catch(Exception ex){
}
try{
int guardRoll = ThreadLocalRandom.current().nextInt(1,undead_guards.size() + 1);
MobLoot guard = new MobLoot(mob, ItemBase.getItemBase((Integer) undead_guards.toArray()[guardRoll]), true);
mob.getCharItemManager().addItemToInventory(guard);
}catch(Exception ex){
}
return;
}
//determine if mob is in hotzone //determine if mob is in hotzone
boolean inHotzone = ZoneManager.inHotZone(mob.getLoc()); boolean inHotzone = ZoneManager.inHotZone(mob.getLoc());
@@ -85,12 +117,18 @@ public enum LootManager {
ItemBase ib = it.getItemBase(); ItemBase ib = it.getItemBase();
if(ib == null) if(ib == null)
break; break;
if (ib.isDiscRune() || ib.getName().toLowerCase().contains("of the gods")) { if (ib.getName().toLowerCase().contains("of the gods")) {
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().getName() + " has found the " + ib.getName() + ". Are you tough enough to take it?"); ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().getName() + " has found the " + ib.getName() + ". Are you tough enough to take it?");
chatMsg.setMessageType(10); chatMsg.setMessageType(10);
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID()); chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
DispatchMessage.dispatchMsgToAll(chatMsg); DispatchMessage.dispatchMsgToAll(chatMsg);
} }
if(ib.isDiscRune()){
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().getName() + " has found the " + ib.getName() + ". Are you tough enough to take it?");
chatMsg.setMessageType(10);
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
DispatchMessage.dispatchMsgToAll(chatMsg);
}
} }
} }
@@ -129,7 +167,7 @@ public enum LootManager {
break; break;
case "ITEM": case "ITEM":
GenerateInventoryDrop(mob, bse); GenerateInventoryDrop(mob, bse, inHotzone);
break; break;
} }
} }
@@ -171,7 +209,7 @@ public enum LootManager {
if (itemUUID == 0) if (itemUUID == 0)
return null; return null;
if (ItemBase.getItemBase(itemUUID).getType().ordinal() == Enum.ItemType.RESOURCE.ordinal()) { if (ItemBase.getItemBase(itemUUID).getType().ordinal() == Enum.ItemType.RESOURCE.ordinal() && itemUUID != 1580021) {
int amount = ThreadLocalRandom.current().nextInt(tableRow.minSpawn, tableRow.maxSpawn + 1); int amount = ThreadLocalRandom.current().nextInt(tableRow.minSpawn, tableRow.maxSpawn + 1);
return new MobLoot(mob, ItemBase.getItemBase(itemUUID), amount, false); return new MobLoot(mob, ItemBase.getItemBase(itemUUID), amount, false);
} }
@@ -196,6 +234,9 @@ public enum LootManager {
Logger.error("Failed to GenerateSuffix for item: " + outItem.getName()); Logger.error("Failed to GenerateSuffix for item: " + outItem.getName());
} }
} }
if(outItem.getName().toLowerCase().contains("of the gods") && inHotzone == false)
return null;
return outItem; return outItem;
} }
@@ -343,8 +384,24 @@ public enum LootManager {
if (equipmentRoll > dropChance) if (equipmentRoll > dropChance)
continue; continue;
ItemBase genericIB = me.getItemBase();
MobLoot ml = new MobLoot(mob, me.getItemBase(), false); //if(genericIB.isVorg()){
if(vorg_cloth_uuids.contains(genericIB.getUUID())){
//get random cloth piece
genericIB = ItemBase.getItemBase(vorg_cloth_uuids.get(ThreadLocalRandom.current().nextInt(0,vorg_cloth_uuids.size() - 1)));
} else if(vorg_ha_uuids.contains(genericIB.getUUID())){
//get random heavy armor piece
genericIB = ItemBase.getItemBase(vorg_ha_uuids.get(ThreadLocalRandom.current().nextInt(0,vorg_ha_uuids.size() - 1)));
} else if(vorg_ma_uuids.contains(genericIB.getUUID())){
//get random medium armor piece
genericIB = ItemBase.getItemBase(vorg_ma_uuids.get(ThreadLocalRandom.current().nextInt(0,vorg_ma_uuids.size() - 1)));
} else if(vorg_la_uuids.contains(genericIB.getUUID())){
//get random light armor piece
genericIB = ItemBase.getItemBase(vorg_la_uuids.get(ThreadLocalRandom.current().nextInt(0,vorg_la_uuids.size() - 1)));
}
mob.spawnTime = ThreadLocalRandom.current().nextInt(300,2700);
//}
MobLoot ml = new MobLoot(mob, genericIB, false);
if (ml != null && dropCount < 1) { if (ml != null && dropCount < 1) {
ml.setIsID(true); ml.setIsID(true);
@@ -356,7 +413,7 @@ public enum LootManager {
} }
} }
public static void GenerateInventoryDrop(Mob mob, BootySetEntry bse) { public static void GenerateInventoryDrop(Mob mob, BootySetEntry bse, boolean inHotzone) {
int chanceRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1); int chanceRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1);
@@ -365,12 +422,23 @@ public enum LootManager {
if (chanceRoll > bse.dropChance) if (chanceRoll > bse.dropChance)
return; return;
ItemBase ib = ItemBase.getItemBase(bse.itemBase);
if (ib == null)
return;
if (ib.isDiscRune()) {
ItemBase newDisc = ItemBase.getItemBase(ThreadLocalRandom.current().nextInt(3001, 3049 + 1));
if (newDisc != null) {
//mob.getInventory().add(new MobLoot(mob, newDisc, true));
mob.getCharItemManager().addItemToInventory(new MobLoot(mob, newDisc, true));
return;
}
}
MobLoot lootItem = new MobLoot(mob, ItemBase.getItemBase(bse.itemBase), true); MobLoot lootItem = new MobLoot(mob, ItemBase.getItemBase(bse.itemBase), true);
if (lootItem != null) if (lootItem != null)
mob.getCharItemManager().addItemToInventory(lootItem); mob.getCharItemManager().addItemToInventory(lootItem);
} }
public static void peddleFate(PlayerCharacter playerCharacter, Item gift) { public static void peddleFate(PlayerCharacter playerCharacter, Item gift) {
//get table ID for the itembase ID //get table ID for the itembase ID
+13 -67
View File
@@ -23,6 +23,14 @@ public enum NPCManager {
NPC_MANAGER; NPC_MANAGER;
public static HashMap<Integer, ArrayList<Integer>> _runeSetMap = new HashMap<>(); public static HashMap<Integer, ArrayList<Integer>> _runeSetMap = new HashMap<>();
public static void LoadAllRuneSets() {
_runeSetMap = DbManager.ItemBaseQueries.LOAD_RUNES_FOR_NPC_AND_MOBS();
}
public static void LoadAllBootySets() {
LootManager._bootySetMap = DbManager.LootQueries.LOAD_BOOTY_TABLES();
}
public static void applyRuneSetEffects(Mob mob) { public static void applyRuneSetEffects(Mob mob) {
// Early exit // Early exit
@@ -119,12 +127,10 @@ public enum NPCManager {
DbManager.removeFromCache(necroPet); DbManager.removeFromCache(necroPet);
PlayerCharacter petOwner = necroPet.getOwner();
PlayerCharacter petOwner = (PlayerCharacter) necroPet.guardCaptain;
if (petOwner != null) { if (petOwner != null) {
necroPet.setOwner(null);
necroPet.guardCaptain = null;
petOwner.setPet(null); petOwner.setPet(null);
if (updateOwner == false) if (updateOwner == false)
@@ -222,14 +228,12 @@ public enum NPCManager {
WorldGrid.removeObject(toRemove); WorldGrid.removeObject(toRemove);
DbManager.removeFromCache(toRemove); DbManager.removeFromCache(toRemove);
PlayerCharacter petOwner = toRemove.getOwner();
PlayerCharacter petOwner = (PlayerCharacter) toRemove.guardCaptain;
if (petOwner != null) { if (petOwner != null) {
petOwner.setPet(null); petOwner.setPet(null);
toRemove.setOwner(null);
toRemove.guardCaptain = null;
PetMsg petMsg = new PetMsg(5, null); PetMsg petMsg = new PetMsg(5, null);
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg); Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
@@ -336,19 +340,10 @@ public enum NPCManager {
else else
buildingSlot = BuildingManager.getAvailableSlot(abstractCharacter.building); buildingSlot = BuildingManager.getAvailableSlot(abstractCharacter.building);
// Override slot for siege engines
if (abstractCharacter.getObjectType().equals(Enum.GameObjectType.Mob) && ((Mob) abstractCharacter).behaviourType.equals(Enum.MobBehaviourType.SiegeEngine)) {
Mob siegeMobile = (Mob) abstractCharacter;
buildingSlot = siegeMobile.guardCaptain.siegeMinionMap.size() + 2;
}
if (buildingSlot == -1) if (buildingSlot == -1)
Logger.error("No available slot for NPC: " + abstractCharacter.getObjectUUID()); Logger.error("No available slot for NPC: " + abstractCharacter.getObjectUUID());
// Pets are regular mobiles not hirelings (Siege engines) abstractCharacter.building.getHirelings().put(abstractCharacter, buildingSlot);
if (abstractCharacter.contract != null)
abstractCharacter.building.getHirelings().put(abstractCharacter, buildingSlot);
// Override bind and location for this npc derived // Override bind and location for this npc derived
// from BuildingManager slot location data. // from BuildingManager slot location data.
@@ -375,53 +370,4 @@ public enum NPCManager {
return buildingSlot; return buildingSlot;
} }
public static int getMaxMinions(Mob guardCaptain) {
int maxSlots;
switch (guardCaptain.getRank()) {
case 3:
maxSlots = 2;
break;
case 4:
case 5:
maxSlots = 3;
break;
case 6:
maxSlots = 4;
break;
case 7:
maxSlots = 5;
break;
case 1:
case 2:
default:
maxSlots = 1;
}
return maxSlots;
}
public static void AssignPatrolPoints(Mob mob) {
mob.patrolPoints = new ArrayList<>();
for (int i = 0; i < 5; ++i) {
float patrolRadius = mob.getSpawnRadius();
if (patrolRadius > 256)
patrolRadius = 256;
if (patrolRadius < 60)
patrolRadius = 60;
Vector3fImmutable newPatrolPoint = Vector3fImmutable.getRandomPointInCircle(mob.getBindLoc(), patrolRadius);
mob.patrolPoints.add(newPatrolPoint);
if (i == 1) {
mob.loc = newPatrolPoint;
mob.endLoc = newPatrolPoint;
}
}
}
} }
@@ -839,6 +839,8 @@ public enum PowersManager {
return; return;
} }
playerCharacter.setHateValue(pb.getHateValue(trains));
//Send Cast Message. //Send Cast Message.
// PerformActionMsg castMsg = new PerformActionMsg(msg); // PerformActionMsg castMsg = new PerformActionMsg(msg);
// castMsg.setNumTrains(9999); // castMsg.setNumTrains(9999);
@@ -889,6 +891,8 @@ public enum PowersManager {
//Power is aiding a target, handle aggro if combat target is a Mob. //Power is aiding a target, handle aggro if combat target is a Mob.
if (!pb.isHarmful() && target.getObjectType() == GameObjectType.PlayerCharacter) { if (!pb.isHarmful() && target.getObjectType() == GameObjectType.PlayerCharacter) {
PlayerCharacter pcTarget = (PlayerCharacter) target; PlayerCharacter pcTarget = (PlayerCharacter) target;
if (!pb.isHarmful())
Mob.HandleAssistedAggro(playerCharacter, pcTarget);
} }
// update target of used power timer // update target of used power timer
+2 -2
View File
@@ -29,7 +29,7 @@ public class EndFearJob extends AbstractEffectJob {
if (this.target == null || (!(this.target instanceof Mob))) if (this.target == null || (!(this.target instanceof Mob)))
return; return;
((Mob) this.target).fearedObject = null; ((Mob) this.target).setFearedObject(null);
} }
@Override @Override
@@ -40,6 +40,6 @@ public class EndFearJob extends AbstractEffectJob {
if (this.target == null || (!(this.target instanceof Mob))) if (this.target == null || (!(this.target instanceof Mob)))
return; return;
((Mob) this.target).fearedObject = null; ((Mob) this.target).setFearedObject(null);
} }
} }
+85 -95
View File
@@ -96,7 +96,7 @@ public class MobAI {
return; return;
} }
if (mob.behaviourType.callsForHelp) if (mob.BehaviourType.callsForHelp)
MobCallForHelp(mob); MobCallForHelp(mob);
if (!MovementUtilities.inRangeDropAggro(mob, target)) { if (!MovementUtilities.inRangeDropAggro(mob, target)) {
@@ -165,7 +165,7 @@ public class MobAI {
if (playercity != null) if (playercity != null)
for (Mob guard : playercity.getParent().zoneMobSet) for (Mob guard : playercity.getParent().zoneMobSet)
if (guard.behaviourType != null && guard.behaviourType.equals(Enum.MobBehaviourType.GuardCaptain)) if (guard.BehaviourType != null && guard.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal())
if (guard.getCombatTarget() == null && !guard.getGuild().equals(mob.getGuild())) if (guard.getCombatTarget() == null && !guard.getGuild().equals(mob.getGuild()))
guard.setCombatTarget(mob); guard.setCombatTarget(mob);
@@ -260,7 +260,7 @@ public class MobAI {
//guard captains inherit barracks patrol points dynamically //guard captains inherit barracks patrol points dynamically
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardCaptain)) { if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal()) {
Building barracks = mob.building; Building barracks = mob.building;
@@ -280,7 +280,7 @@ public class MobAI {
MovementUtilities.aiMove(mob, mob.destination, true); MovementUtilities.aiMove(mob, mob.destination, true);
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardCaptain)) if (mob.BehaviourType.equals(Enum.MobBehaviourType.GuardCaptain))
for (Entry<Mob, Integer> minion : mob.siegeMinionMap.entrySet()) for (Entry<Mob, Integer> minion : mob.siegeMinionMap.entrySet())
//make sure mob is out of combat stance //make sure mob is out of combat stance
@@ -312,9 +312,9 @@ public class MobAI {
int contractID; int contractID;
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardMinion)) if(mob.BehaviourType.equals(Enum.MobBehaviourType.GuardMinion))
contractID = mob.guardCaptain.contract.getContractID(); contractID = mob.npcOwner.contract.getContractID();
else else
contractID = mob.contract.getContractID(); contractID = mob.contract.getContractID();
if(Enum.MinionType.ContractToMinionMap.get(contractID).isMage() == false) if(Enum.MinionType.ContractToMinionMap.get(contractID).isMage() == false)
@@ -350,7 +350,7 @@ public class MobAI {
ArrayList<Integer> purgeTokens; ArrayList<Integer> purgeTokens;
AbstractCharacter target = (AbstractCharacter) mob.getCombatTarget(); AbstractCharacter target = (AbstractCharacter) mob.getCombatTarget();
if (mob.behaviourType.callsForHelp) if (mob.BehaviourType.callsForHelp)
MobCallForHelp(mob); MobCallForHelp(mob);
// Generate a list of tokens from the mob powers for this mobile. // Generate a list of tokens from the mob powers for this mobile.
@@ -433,7 +433,7 @@ public class MobAI {
ArrayList<Integer> purgeTokens; ArrayList<Integer> purgeTokens;
AbstractCharacter target = (AbstractCharacter) mob.getCombatTarget(); AbstractCharacter target = (AbstractCharacter) mob.getCombatTarget();
if (mob.behaviourType.callsForHelp) if (mob.BehaviourType.callsForHelp)
MobCallForHelp(mob); MobCallForHelp(mob);
// Generate a list of tokens from the mob powers for this mobile. // Generate a list of tokens from the mob powers for this mobile.
@@ -564,7 +564,7 @@ public class MobAI {
Zone mobCamp = mob.getParentZone(); Zone mobCamp = mob.getParentZone();
for (Mob helper : mobCamp.zoneMobSet) { for (Mob helper : mobCamp.zoneMobSet) {
if (helper.behaviourType.respondsToCallForHelp && helper.behaviourType.BehaviourHelperType.equals(mob.behaviourType)) { if (helper.BehaviourType.respondsToCallForHelp && helper.BehaviourType.BehaviourHelperType.equals(mob.BehaviourType)) {
helper.setCombatTarget(mob.getCombatTarget()); helper.setCombatTarget(mob.getCombatTarget());
callGotResponse = true; callGotResponse = true;
} }
@@ -608,8 +608,8 @@ public class MobAI {
if (mob.despawned && mob.isPlayerGuard) { if (mob.despawned && mob.isPlayerGuard) {
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardMinion)) { if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardMinion.ordinal()) {
if (mob.guardCaptain.isAlive() == false || ((Mob) mob.guardCaptain).despawned == true) { if (mob.npcOwner.isAlive() == false || ((Mob) mob.npcOwner).despawned == true) {
//minions don't respawn while guard captain is dead //minions don't respawn while guard captain is dead
@@ -625,7 +625,7 @@ public class MobAI {
//check to send mob home for player guards to prevent exploit of dragging guards away and then teleporting //check to send mob home for player guards to prevent exploit of dragging guards away and then teleporting
if (mob.behaviourType.equals(Enum.MobBehaviourType.Pet1) == false) if (mob.BehaviourType.ordinal() != Enum.MobBehaviourType.Pet1.ordinal())
CheckToSendMobHome(mob); CheckToSendMobHome(mob);
return; return;
@@ -646,7 +646,7 @@ public class MobAI {
return; return;
} }
if (mob.behaviourType.equals(Enum.MobBehaviourType.Pet1) == false) if (mob.BehaviourType.ordinal() != Enum.MobBehaviourType.Pet1.ordinal())
CheckToSendMobHome(mob); CheckToSendMobHome(mob);
if (mob.getCombatTarget() != null) { if (mob.getCombatTarget() != null) {
@@ -673,7 +673,7 @@ public class MobAI {
} }
} }
switch (mob.behaviourType) { switch (mob.BehaviourType) {
case GuardCaptain: case GuardCaptain:
GuardCaptainLogic(mob); GuardCaptainLogic(mob);
break; break;
@@ -684,7 +684,6 @@ public class MobAI {
GuardWallArcherLogic(mob); GuardWallArcherLogic(mob);
break; break;
case Pet1: case Pet1:
case SiegeEngine:
PetLogic(mob); PetLogic(mob);
break; break;
case HamletGuard: case HamletGuard:
@@ -694,6 +693,8 @@ public class MobAI {
DefaultLogic(mob); DefaultLogic(mob);
break; break;
} }
if(mob.isAlive())
RecoverHealth(mob);
} catch (Exception e) { } catch (Exception e) {
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: DetermineAction" + " " + e.getMessage()); Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: DetermineAction" + " " + e.getMessage());
} }
@@ -708,7 +709,7 @@ public class MobAI {
if (!aiAgent.isAlive()) if (!aiAgent.isAlive())
return; return;
ConcurrentHashMap<Integer, Float> loadedPlayers = aiAgent.playerAgroMap; ConcurrentHashMap<Integer, Boolean> loadedPlayers = aiAgent.playerAgroMap;
for (Entry playerEntry : loadedPlayers.entrySet()) { for (Entry playerEntry : loadedPlayers.entrySet()) {
@@ -783,39 +784,33 @@ public class MobAI {
mob.updateLocation(); mob.updateLocation();
switch (mob.behaviourType) { switch (mob.BehaviourType) {
case Pet1: case Pet1:
if (mob.getOwner() == null)
if ((PlayerCharacter) mob.guardCaptain == null)
return; return;
if (!mob.playerAgroMap.containsKey(mob.getOwner().getObjectUUID())) {
if (!mob.playerAgroMap.containsKey(((PlayerCharacter) mob.guardCaptain).getObjectUUID())) {
//mob no longer has its owner loaded, translocate pet to owner //mob no longer has its owner loaded, translocate pet to owner
MovementManager.translocate(mob, mob.getOwner().getLoc(), null);
MovementManager.translocate(mob, ((PlayerCharacter) mob.guardCaptain).getLoc(), null);
return; return;
} }
if (mob.getCombatTarget() == null) { if (mob.getCombatTarget() == null) {
//move back to owner //move back to owner
if (CombatUtilities.inRange2D(mob, mob.getOwner(), 6))
if (CombatUtilities.inRange2D(mob, (PlayerCharacter) mob.guardCaptain, 6))
return; return;
mob.destination = mob.getOwner().getLoc();
mob.destination = ((PlayerCharacter) mob.guardCaptain).getLoc();
MovementUtilities.moveToLocation(mob, mob.destination, 5); MovementUtilities.moveToLocation(mob, mob.destination, 5);
} else } else
chaseTarget(mob); chaseTarget(mob);
break; break;
case GuardMinion: case GuardMinion:
if (!mob.guardCaptain.isAlive() || ((Mob) mob.guardCaptain).despawned) if (!mob.npcOwner.isAlive() && mob.getCombatTarget() == null)
randomGuardPatrolPoint(mob); randomGuardPatrolPoint(mob);
else { else {
if (mob.getCombatTarget() != null) { if (mob.getCombatTarget() != null) {
@@ -834,6 +829,7 @@ public class MobAI {
chaseTarget(mob); chaseTarget(mob);
} }
break; break;
} }
} catch (Exception e) { } catch (Exception e) {
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckMobMovement" + " " + e.getMessage()); Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckMobMovement" + " " + e.getMessage());
@@ -878,7 +874,7 @@ public class MobAI {
} }
} }
} }
} else if (System.currentTimeMillis() > (aiAgent.deathTime + (aiAgent.spawnTime * 1000))) { } else if (System.currentTimeMillis() > aiAgent.deathTime + (aiAgent.spawnTime * 1000)) {
if (Zone.respawnQue.contains(aiAgent) == false) { if (Zone.respawnQue.contains(aiAgent) == false) {
Zone.respawnQue.add(aiAgent); Zone.respawnQue.add(aiAgent);
@@ -900,8 +896,7 @@ public class MobAI {
if (mob.getCombatTarget() == null) if (mob.getCombatTarget() == null)
return; return;
if (mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter) && MovementUtilities.inRangeDropAggro(mob, (PlayerCharacter) mob.getCombatTarget()) == false && if (mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter) && MovementUtilities.inRangeDropAggro(mob, (PlayerCharacter) mob.getCombatTarget()) == false && mob.BehaviourType.ordinal() != Enum.MobBehaviourType.Pet1.ordinal()) {
mob.behaviourType.equals(Enum.MobBehaviourType.Pet1) == false) {
mob.setCombatTarget(null); mob.setCombatTarget(null);
return; return;
@@ -917,10 +912,10 @@ public class MobAI {
private static void CheckToSendMobHome(Mob mob) { private static void CheckToSendMobHome(Mob mob) {
try { try {
if (mob.behaviourType.isAgressive) { if (mob.BehaviourType.isAgressive) {
if (mob.isPlayerGuard()) { if (mob.isPlayerGuard()) {
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardCaptain)) if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal())
CheckForPlayerGuardAggro(mob); CheckForPlayerGuardAggro(mob);
} else { } else {
CheckForAggro(mob); CheckForAggro(mob);
@@ -940,7 +935,7 @@ public class MobAI {
PowersManager.useMobPower(mob, mob, recall, 40); PowersManager.useMobPower(mob, mob, recall, 40);
mob.setCombatTarget(null); mob.setCombatTarget(null);
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardCaptain) && mob.isAlive()) { if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal() && mob.isAlive()) {
//guard captain pulls his minions home with him //guard captain pulls his minions home with him
@@ -956,8 +951,8 @@ public class MobAI {
PowersManager.useMobPower(mob, mob, recall, 40); PowersManager.useMobPower(mob, mob, recall, 40);
mob.setCombatTarget(null); mob.setCombatTarget(null);
for (Integer playerEntry : mob.playerAgroMap.keySet()) for (Entry playerEntry : mob.playerAgroMap.entrySet())
mob.playerAgroMap.put(playerEntry,0f); PlayerCharacter.getFromCache((int) playerEntry.getKey()).setHateValue(0);
} }
} catch (Exception e) { } catch (Exception e) {
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckToSendMobHome" + " " + e.getMessage()); Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckToSendMobHome" + " " + e.getMessage());
@@ -1021,7 +1016,7 @@ public class MobAI {
if ((aggroMob.agentType.equals(Enum.AIAgentType.GUARD))) if ((aggroMob.agentType.equals(Enum.AIAgentType.GUARD)))
continue; continue;
if (aggroMob.behaviourType.equals(Enum.MobBehaviourType.Pet1)) if(aggroMob.BehaviourType.equals(Enum.MobBehaviourType.Pet1))
continue; continue;
if (mob.getLoc().distanceSquared2D(aggroMob.getLoc()) > sqr(50)) if (mob.getLoc().distanceSquared2D(aggroMob.getLoc()) > sqr(50))
@@ -1035,7 +1030,10 @@ public class MobAI {
} }
public static void GuardCaptainLogic(Mob mob) { public static void GuardCaptainLogic(Mob mob) {
if(mob.guardedCity.getBane() == null){
CheckMobMovement(mob);
return;
}
try { try {
if (mob.getCombatTarget() == null) if (mob.getCombatTarget() == null)
CheckForPlayerGuardAggro(mob); CheckForPlayerGuardAggro(mob);
@@ -1051,7 +1049,6 @@ public class MobAI {
mob.setCombatTarget(newTarget); mob.setCombatTarget(newTarget);
} }
CheckMobMovement(mob); CheckMobMovement(mob);
CheckForAttack(mob); CheckForAttack(mob);
} catch (Exception e) { } catch (Exception e) {
@@ -1060,31 +1057,20 @@ public class MobAI {
} }
public static void GuardMinionLogic(Mob mob) { public static void GuardMinionLogic(Mob mob) {
if(mob.guardedCity.getBane() == null){
CheckMobMovement(mob);
return;
}
try { try {
if (!mob.guardCaptain.isAlive()) { boolean isComanded = mob.npcOwner.isAlive();
if (!isComanded) {
if (mob.getCombatTarget() == null) { GuardCaptainLogic(mob);
CheckForPlayerGuardAggro(mob);
} else {
AbstractWorldObject newTarget = ChangeTargetFromHateValue(mob);
if (newTarget != null) {
if (newTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
if (GuardCanAggro(mob, (PlayerCharacter) newTarget))
mob.setCombatTarget(newTarget);
} else
mob.setCombatTarget(newTarget);
}
}
}else { }else {
if (mob.guardCaptain.getCombatTarget() != null) if (mob.npcOwner.getCombatTarget() != null)
mob.setCombatTarget(mob.guardCaptain.getCombatTarget()); mob.setCombatTarget(mob.npcOwner.getCombatTarget());
else if (mob.getCombatTarget() != null) else
mob.setCombatTarget(null); if (mob.getCombatTarget() != null)
mob.setCombatTarget(null);
} }
CheckMobMovement(mob); CheckMobMovement(mob);
CheckForAttack(mob); CheckForAttack(mob);
@@ -1094,7 +1080,10 @@ public class MobAI {
} }
public static void GuardWallArcherLogic(Mob mob) { public static void GuardWallArcherLogic(Mob mob) {
if(mob.guardedCity.getBane() == null){
CheckMobMovement(mob);
return;
}
try { try {
if (mob.getCombatTarget() == null) if (mob.getCombatTarget() == null)
CheckForPlayerGuardAggro(mob); CheckForPlayerGuardAggro(mob);
@@ -1109,31 +1098,14 @@ public class MobAI {
try { try {
if (mob.getOwner() == null && mob.isNecroPet() == false && mob.isSiege() == false)
if (mob.guardCaptain == null && mob.isNecroPet() == false && mob.isSiege() == false)
if (ZoneManager.getSeaFloor().zoneMobSet.contains(mob)) if (ZoneManager.getSeaFloor().zoneMobSet.contains(mob))
mob.killCharacter("no owner"); mob.killCharacter("no owner");
if (MovementUtilities.canMove(mob) && mob.behaviourType.canRoam) if (MovementUtilities.canMove(mob) && mob.BehaviourType.canRoam)
CheckMobMovement(mob); CheckMobMovement(mob);
CheckForAttack(mob); CheckForAttack(mob);
//recover health
if (mob.getTimestamps().containsKey("HEALTHRECOVERED") == false)
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
if (mob.isSit() && mob.getTimeStamp("HEALTHRECOVERED") < System.currentTimeMillis() + 3000)
if (mob.getHealth() < mob.getHealthMax()) {
float recoveredHealth = mob.getHealthMax() * ((1 + mob.getBonuses().getFloatPercentAll(Enum.ModType.HealthRecoverRate, Enum.SourceType.None)) * 0.01f);
mob.setHealth(mob.getHealth() + recoveredHealth);
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
if (mob.getHealth() > mob.getHealthMax())
mob.setHealth(mob.getHealthMax());
}
} catch (Exception e) { } catch (Exception e) {
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: PetLogic" + " " + e.getMessage()); Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: PetLogic" + " " + e.getMessage());
} }
@@ -1164,7 +1136,7 @@ public class MobAI {
if (mob.getCombatTarget() != null && mob.playerAgroMap.containsKey(mob.getCombatTarget().getObjectUUID()) == false) if (mob.getCombatTarget() != null && mob.playerAgroMap.containsKey(mob.getCombatTarget().getObjectUUID()) == false)
mob.setCombatTarget(null); mob.setCombatTarget(null);
if (mob.behaviourType.isAgressive) { if (mob.BehaviourType.isAgressive) {
AbstractWorldObject newTarget = ChangeTargetFromHateValue(mob); AbstractWorldObject newTarget = ChangeTargetFromHateValue(mob);
@@ -1172,7 +1144,7 @@ public class MobAI {
mob.setCombatTarget(newTarget); mob.setCombatTarget(newTarget);
else { else {
if (mob.getCombatTarget() == null) { if (mob.getCombatTarget() == null) {
if (mob.behaviourType == Enum.MobBehaviourType.HamletGuard) if (mob.BehaviourType == Enum.MobBehaviourType.HamletGuard)
SafeGuardAggro(mob); //safehold guard SafeGuardAggro(mob); //safehold guard
else else
CheckForAggro(mob); //normal aggro CheckForAggro(mob); //normal aggro
@@ -1182,12 +1154,12 @@ public class MobAI {
//check if mob can move for patrol or moving to target //check if mob can move for patrol or moving to target
if (mob.behaviourType.canRoam) if (mob.BehaviourType.canRoam)
CheckMobMovement(mob); CheckMobMovement(mob);
//check if mob can attack if it isn't wimpy //check if mob can attack if it isn't wimpy
if (!mob.behaviourType.isWimpy && mob.getCombatTarget() != null) if (!mob.BehaviourType.isWimpy && mob.getCombatTarget() != null)
CheckForAttack(mob); CheckForAttack(mob);
} catch (Exception e) { } catch (Exception e) {
@@ -1204,7 +1176,7 @@ public class MobAI {
if (!mob.isAlive()) if (!mob.isAlive())
return; return;
ConcurrentHashMap<Integer, Float> loadedPlayers = mob.playerAgroMap; ConcurrentHashMap<Integer, Boolean> loadedPlayers = mob.playerAgroMap;
for (Entry playerEntry : loadedPlayers.entrySet()) { for (Entry playerEntry : loadedPlayers.entrySet()) {
@@ -1252,8 +1224,8 @@ public class MobAI {
if (mob.getGuild().getNation().equals(target.getGuild().getNation())) if (mob.getGuild().getNation().equals(target.getGuild().getNation()))
return false; return false;
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardMinion)) { if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardMinion.ordinal()) {
if (((Mob) mob.guardCaptain).building.getCity().cityOutlaws.contains(target.getObjectUUID()) == true) { if (((Mob) mob.npcOwner).building.getCity().cityOutlaws.contains(target.getObjectUUID()) == true) {
return true; return true;
} }
} else if (mob.building.getCity().cityOutlaws.contains(target.getObjectUUID()) == true) { } else if (mob.building.getCity().cityOutlaws.contains(target.getObjectUUID()) == true) {
@@ -1337,7 +1309,7 @@ public class MobAI {
MovementUtilities.aiMove(mob, mob.destination, true); MovementUtilities.aiMove(mob, mob.destination, true);
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardCaptain)) { if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal()) {
for (Entry<Mob, Integer> minion : mob.siegeMinionMap.entrySet()) { for (Entry<Mob, Integer> minion : mob.siegeMinionMap.entrySet()) {
//make sure mob is out of combat stance //make sure mob is out of combat stance
@@ -1364,7 +1336,7 @@ public class MobAI {
float CurrentHateValue = 0; float CurrentHateValue = 0;
if (mob.getCombatTarget() != null && mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) if (mob.getCombatTarget() != null && mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter))
CurrentHateValue = mob.playerAgroMap.get(mob.combatTarget.getObjectUUID()).floatValue(); CurrentHateValue = ((PlayerCharacter) mob.getCombatTarget()).getHateValue();
AbstractWorldObject mostHatedTarget = null; AbstractWorldObject mostHatedTarget = null;
@@ -1375,8 +1347,8 @@ public class MobAI {
if (potentialTarget.equals(mob.getCombatTarget())) if (potentialTarget.equals(mob.getCombatTarget()))
continue; continue;
if (potentialTarget != null && mob.playerAgroMap.get(potentialTarget.getObjectUUID()).floatValue() > CurrentHateValue && MovementUtilities.inRangeToAggro(mob, potentialTarget)) { if (potentialTarget != null && potentialTarget.getHateValue() > CurrentHateValue && MovementUtilities.inRangeToAggro(mob, potentialTarget)) {
CurrentHateValue = mob.playerAgroMap.get(potentialTarget.getObjectUUID()).floatValue(); CurrentHateValue = potentialTarget.getHateValue();
mostHatedTarget = potentialTarget; mostHatedTarget = potentialTarget;
} }
@@ -1387,4 +1359,22 @@ public class MobAI {
} }
return null; return null;
} }
public static void RecoverHealth(Mob mob){
//recover health
if (mob.getTimestamps().containsKey("HEALTHRECOVERED") == false)
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
if (mob.isSit() && mob.getTimeStamp("HEALTHRECOVERED") < System.currentTimeMillis() + 3000)
if (mob.getHealth() < mob.getHealthMax()) {
float recoveredHealth = mob.getHealthMax() * ((1 + mob.getBonuses().getFloatPercentAll(Enum.ModType.HealthRecoverRate, Enum.SourceType.None)) * 0.01f);
mob.setHealth(mob.getHealth() + recoveredHealth);
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
if (mob.getHealth() > mob.getHealthMax())
mob.setHealth(mob.getHealthMax());
}
}
} }
@@ -48,7 +48,7 @@ public class CombatUtilities {
} }
public static boolean inRange2D(AbstractWorldObject entity1, AbstractWorldObject entity2, double range) { public static boolean inRange2D(AbstractWorldObject entity1, AbstractWorldObject entity2, double range) {
return entity1.getLoc().distanceSquared2D(entity2.getLoc()) < range * range; return entity1.getLoc().distance2D(entity2.getLoc()) < range;
} }
public static void swingIsBlock(Mob agent, AbstractWorldObject target, int animation) { public static void swingIsBlock(Mob agent, AbstractWorldObject target, int animation) {
@@ -13,10 +13,10 @@ import engine.Enum;
import engine.Enum.GameObjectType; import engine.Enum.GameObjectType;
import engine.Enum.ModType; import engine.Enum.ModType;
import engine.Enum.SourceType; import engine.Enum.SourceType;
import engine.mobileAI.Threads.MobAIThread;
import engine.exception.MsgSendException; import engine.exception.MsgSendException;
import engine.gameManager.MovementManager; import engine.gameManager.MovementManager;
import engine.math.Vector3fImmutable; import engine.math.Vector3fImmutable;
import engine.mobileAI.Threads.MobAIThread;
import engine.net.client.msg.MoveToPointMsg; import engine.net.client.msg.MoveToPointMsg;
import engine.objects.*; import engine.objects.*;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
@@ -38,7 +38,7 @@ public class MovementUtilities {
if (agent.getContract() != null) if (agent.getContract() != null)
guardCaptain = agent; guardCaptain = agent;
else else
guardCaptain = (Mob) agent.guardCaptain; guardCaptain = (Mob) agent.npcOwner;
if (guardCaptain != null) { if (guardCaptain != null) {
Building barracks = guardCaptain.building; Building barracks = guardCaptain.building;
@@ -562,6 +562,9 @@ public class ClientMessagePump implements NetMsgHandler {
if (i.isCanDestroy()) if (i.isCanDestroy())
if (itemManager.delete(i) == true) { if (itemManager.delete(i) == true) {
int value = i.getItemBase().getBaseValue();
sourcePlayer.getCharItemManager().addGoldToInventory(value,false);
sourcePlayer.getCharItemManager().updateInventory();
Dispatch dispatch = Dispatch.borrow(sourcePlayer, msg); Dispatch dispatch = Dispatch.borrow(sourcePlayer, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY); DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
} }
@@ -57,6 +57,21 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler {
if (contract.canSlotinBuilding(building)) if (contract.canSlotinBuilding(building))
ItemLists.add(hirelings); ItemLists.add(hirelings);
if(building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.TOL)){
if(contract.getContractID() == 899)//alchemist
ItemLists.add(hirelings);
if(contract.getContractID() == 866)//banker
ItemLists.add(hirelings);
if(contract.getContractID() == 865)//siege engineer
ItemLists.add(hirelings);
}
if(building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.SIEGETENT)){
if(contract.getContractID() == 865)//siege engineer
ItemLists.add(hirelings);
}
} }
} }
@@ -78,13 +93,20 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler {
return false; return false;
} }
if (building.getBlueprint().getMaxSlots() == building.getHirelings().size()) if (building.getBlueprint().getSlotsForRank(building.getRank()) == building.getHirelings().size())
return false; return false;
Item contractItem = Item.getFromCache(msg.getContractItem()); Item contractItem = Item.getFromCache(msg.getContractItem());
if (contractItem == null) if (contractItem == null)
return false; return false;
if (msg.getContractItem() == 850) {//runemaster
for (AbstractCharacter abs : building.getHirelings().keySet()) {
NPC npc = (NPC) abs;
if (npc.contract.getContractID() == 850)
return false; //can only have 1 runemaster
}
}
if (!player.getCharItemManager().doesCharOwnThisItem(contractItem.getObjectUUID())) { if (!player.getCharItemManager().doesCharOwnThisItem(contractItem.getObjectUUID())) {
Logger.error(player.getName() + "has attempted to place Hireling : " + contractItem.getName() + "without a valid contract!"); Logger.error(player.getName() + "has attempted to place Hireling : " + contractItem.getName() + "without a valid contract!");
@@ -104,10 +126,29 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler {
return false; return false;
// Check if contract can be slotted in this building // Check if contract can be slotted in this building
//Logger.error("inserting contract: " + contract.getContractID());
if (contract.canSlotinBuilding(building) == false) {
boolean override = false;
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.TOL)) {
if (contract.getContractID() == 899)//alchemist
override = true;
if (contract.canSlotinBuilding(building) == false) if (contract.getContractID() == 866)//banker
return false; override = true;
if (contract.getContractID() == 865)//siege engineer
override = true;
}
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.SIEGETENT)) {
if (contract.getContractID() == 865)//siege engineer
override = true;
}
if(override == false) {
Logger.error("failed at override with contract: " + contract.getContractID());
return false;
}
}
//Logger.error("override successful: " + contract.getContractID());
if (!BuildingManager.addHireling(building, player, zone, contract, contractItem)) if (!BuildingManager.addHireling(building, player, zone, contract, contractItem))
return false; return false;
@@ -294,7 +294,7 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler {
// Owner is obviously allowed to upgrade his own buildings // Owner is obviously allowed to upgrade his own buildings
if (building.getOwner().equals(player)) { if (building.getOwner() != null && building.getOwner().equals(player)) {
// Players cannot destroy or transfer a TOL. // Players cannot destroy or transfer a TOL.
@@ -15,6 +15,7 @@ import engine.net.client.msg.*;
import engine.objects.*; import engine.objects.*;
import engine.powers.PowersBase; import engine.powers.PowersBase;
import engine.server.MBServerStatics; import engine.server.MBServerStatics;
import org.joda.time.DateTime;
import java.util.ArrayList; import java.util.ArrayList;
@@ -98,6 +99,10 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
private static void requestHermitBlessing(MerchantMsg msg, ClientConnection origin, PlayerCharacter player, NPC npc) { private static void requestHermitBlessing(MerchantMsg msg, ClientConnection origin, PlayerCharacter player, NPC npc) {
if(DateTime.now().getHourOfDay() < 18 || DateTime.now().getHourOfDay() > 21){
ChatManager.chatSystemInfo(player, "Blessing can only be received between 6:00 pm and 10:00 pm");
}
Guild guild; Guild guild;
Realm realm; Realm realm;
City city; City city;
@@ -8,6 +8,7 @@ import engine.gameManager.BuildingManager;
import engine.gameManager.DbManager; import engine.gameManager.DbManager;
import engine.gameManager.NPCManager; import engine.gameManager.NPCManager;
import engine.gameManager.SessionManager; import engine.gameManager.SessionManager;
import engine.math.Vector3fImmutable;
import engine.net.Dispatch; import engine.net.Dispatch;
import engine.net.DispatchMessage; import engine.net.DispatchMessage;
import engine.net.client.ClientConnection; import engine.net.client.ClientConnection;
@@ -41,6 +42,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
if (player == null) if (player == null)
return true; return true;
if (minionMsg.getNpcType() == Enum.GameObjectType.NPC.ordinal()) { if (minionMsg.getNpcType() == Enum.GameObjectType.NPC.ordinal()) {
NPC npc = NPC.getFromCache(minionMsg.getNpcID()); NPC npc = NPC.getFromCache(minionMsg.getNpcID());
@@ -61,10 +63,10 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
Mob toRemove = Mob.getFromCache(minionMsg.getUUID()); Mob toRemove = Mob.getFromCache(minionMsg.getUUID());
if (!npc.siegeMinionMap.containsKey(toRemove)) if (!npc.getSiegeMinionMap().containsKey(toRemove))
return true; return true;
npc.siegeMinionMap.remove(toRemove); npc.getSiegeMinionMap().remove(toRemove);
WorldGrid.RemoveWorldObject(toRemove); WorldGrid.RemoveWorldObject(toRemove);
@@ -72,18 +74,14 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
toRemove.getParentZone().zoneMobSet.remove(toRemove); toRemove.getParentZone().zoneMobSet.remove(toRemove);
DbManager.removeFromCache(toRemove); DbManager.removeFromCache(toRemove);
PlayerCharacter petOwner = toRemove.getOwner();
if(toRemove.guardCaptain.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) { if (petOwner != null) {
PlayerCharacter petOwner = (PlayerCharacter) toRemove.guardCaptain; petOwner.setPet(null);
toRemove.setOwner(null);
if (petOwner != null) { PetMsg petMsg = new PetMsg(5, null);
petOwner.setPet(null); Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
toRemove.guardCaptain = null;
PetMsg petMsg = new PetMsg(5, null);
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
}
} }
// we Found the move to remove, lets break the for loop so it doesnt look for more. // we Found the move to remove, lets break the for loop so it doesnt look for more.
@@ -117,7 +115,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
if (npc.getContractID() == 842) if (npc.getContractID() == 842)
maxSlots = 1; maxSlots = 1;
if (npc.siegeMinionMap.size() == maxSlots) if (npc.getSiegeMinionMap().size() == maxSlots)
return true; return true;
int mobBase; int mobBase;
@@ -148,10 +146,42 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
if (mobBase == 0) if (mobBase == 0)
return true; return true;
Mob siegeMob = Mob.createSiegeMinion(npc, mobBase); Mob siegeMob = Mob.createSiegeMob(npc, mobBase, npc.getGuild(), zone, b.getLoc(), (short) 1);
if (siegeMob == null) if (siegeMob == null)
return true; return true;
if (siegeMob != null) {
siegeMob.setSpawnTime(60 * 15);
Building building = BuildingManager.getBuilding(((MinionTrainingMessage) baseMsg).getBuildingID());
siegeMob.building = building;
siegeMob.parentZone = zone;
// Slot siege minion
// Can be either corner tower or bulwark.
int slot;
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.ARTYTOWER))
slot = 2;
else
slot = ((NPC) siegeMob.npcOwner).getSiegeMinionMap().get(siegeMob) + 1; // First slot is for the captain
BuildingLocation slotLocation = BuildingManager._slotLocations.get(building.meshUUID).get(slot);
siegeMob.bindLoc = building.getLoc().add(slotLocation.getLocation());
// Rotate slot position by the building rotation
siegeMob.bindLoc = Vector3fImmutable.rotateAroundPoint(building.getLoc(), siegeMob.bindLoc, building.getBounds().getQuaternion().angleY);
siegeMob.loc = new Vector3fImmutable(siegeMob.bindLoc);
siegeMob.endLoc = new Vector3fImmutable(siegeMob.bindLoc);
zone.zoneMobSet.add(siegeMob);
siegeMob.setLoc(siegeMob.bindLoc);
}
} }
ManageNPCMsg mnm = new ManageNPCMsg(npc); ManageNPCMsg mnm = new ManageNPCMsg(npc);
@@ -198,14 +228,11 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
toRemove.getParentZone().zoneMobSet.remove(toRemove); toRemove.getParentZone().zoneMobSet.remove(toRemove);
DbManager.removeFromCache(toRemove); DbManager.removeFromCache(toRemove);
PlayerCharacter petOwner = toRemove.getOwner();
PlayerCharacter petOwner = (PlayerCharacter) toRemove.guardCaptain;
if (petOwner != null) { if (petOwner != null) {
petOwner.setPet(null); petOwner.setPet(null);
toRemove.setOwner(null);
toRemove.guardCaptain = null;
PetMsg petMsg = new PetMsg(5, null); PetMsg petMsg = new PetMsg(5, null);
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg); Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY); DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
@@ -271,12 +298,12 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
String pirateName = NPCManager.getPirateName(mobBase); String pirateName = NPCManager.getPirateName(mobBase);
Mob toCreate = Mob.createGuardMinion(npc, npc.getLevel(), pirateName); if (!DbManager.MobQueries.ADD_TO_GUARDS(npc.getObjectUUID(), mobBase, pirateName, npc.getSiegeMinionMap().size() + 1))
if (toCreate == null)
return true; return true;
if (!DbManager.MobQueries.ADD_TO_GUARDS(npc.getObjectUUID(), mobBase, pirateName, npc.getSiegeMinionMap().size() + 1)) Mob toCreate = Mob.createGuardMob(npc, npc.getGuild(), zone, building.getLoc(), npc.getLevel(), pirateName);
if (toCreate == null)
return true; return true;
if (toCreate != null) { if (toCreate != null) {
@@ -123,6 +123,11 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
if (resourceValue < 15) if (resourceValue < 15)
hasResources = false; hasResources = false;
resourceValue = warehouse.getResources().get(Warehouse.mithrilIB);
if (resourceValue < 1)
hasResources = false;
if (hasResources == false) { if (hasResources == false) {
ErrorPopupMsg.sendErrorPopup(player, 184); // Insufficient gold or resources to upgrade to capital ErrorPopupMsg.sendErrorPopup(player, 184); // Insufficient gold or resources to upgrade to capital
return false; return false;
@@ -180,6 +185,16 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
return false; return false;
} }
resourceValue = warehouse.getResources().get(Warehouse.mithrilIB);
if (DbManager.WarehouseQueries.updateWormwood(warehouse, resourceValue - 1) == true) {
warehouse.getResources().put(Warehouse.mithrilIB, resourceValue - 1);
warehouse.AddTransactionToWarehouse(engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.MITHRIL, 1);
} else {
Logger.error("wormwood update failed for warehouse of UUID:" + warehouse.getObjectUUID());
return false;
}
realm.claimRealmForCity(city, charterUUID); realm.claimRealmForCity(city, charterUUID);
tol.setRank(8); tol.setRank(8);
+4 -4
View File
@@ -343,7 +343,7 @@ public class ManageNPCMsg extends ClientNetMsg {
writer.putInt(0); //runemaster list writer.putInt(0); //runemaster list
//artillery captain list //artillery captain list
ConcurrentHashMap<Mob, Integer> siegeMinions = npc.siegeMinionMap; ConcurrentHashMap<Mob, Integer> siegeMinions = npc.getSiegeMinionMap();
writer.putInt(1 + siegeMinions.size()); writer.putInt(1 + siegeMinions.size());
serializeBulwarkList(writer, 1); //Trebuchet serializeBulwarkList(writer, 1); //Trebuchet
//serializeBulwarkList(writer, 2); //Ballista //serializeBulwarkList(writer, 2); //Ballista
@@ -366,7 +366,7 @@ public class ManageNPCMsg extends ClientNetMsg {
long timeLife = upgradeTime - curTime; long timeLife = upgradeTime - curTime;
if (upgradeTime * 1000 > System.currentTimeMillis()) { if (upgradeTime * 1000 > System.currentTimeMillis()) {
if (mob.guardCaptain.isAlive()) { if (mob.npcOwner.isAlive()) {
writer.put((byte) 0);//shows respawning timer writer.put((byte) 0);//shows respawning timer
writer.putInt(mob.spawnTime); writer.putInt(mob.spawnTime);
writer.putInt(mob.spawnTime); writer.putInt(mob.spawnTime);
@@ -557,7 +557,7 @@ public class ManageNPCMsg extends ClientNetMsg {
} else if (this.targetType == GameObjectType.Mob.ordinal()) { } else if (this.targetType == GameObjectType.Mob.ordinal()) {
mobA = Mob.getMob(this.targetID); mobA = Mob.getFromCacheDBID(this.targetID);
if (mobA == null) { if (mobA == null) {
Logger.error("Missing Mob of ID " + this.targetID); Logger.error("Missing Mob of ID " + this.targetID);
@@ -689,7 +689,7 @@ public class ManageNPCMsg extends ClientNetMsg {
long timeLife = upgradeTime - curTime; long timeLife = upgradeTime - curTime;
if (upgradeTime * 1000 > System.currentTimeMillis()) { if (upgradeTime * 1000 > System.currentTimeMillis()) {
if (mob.guardCaptain.isAlive()) { if (mob.npcOwner.isAlive()) {
writer.put((byte) 0);//shows respawning timer writer.put((byte) 0);//shows respawning timer
writer.putInt(mob.spawnTime); writer.putInt(mob.spawnTime);
writer.putInt(mob.spawnTime); writer.putInt(mob.spawnTime);
@@ -81,6 +81,7 @@ public class TeleportRepledgeListMsg extends ClientNetMsg {
cities = City.getCitiesToTeleportTo(player); cities = City.getCitiesToTeleportTo(player);
else else
cities = City.getCitiesToRepledgeTo(player); cities = City.getCitiesToRepledgeTo(player);
} }
/** /**
+38 -23
View File
@@ -52,8 +52,8 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
public int contractUUID; public int contractUUID;
public Contract contract; public Contract contract;
public String firstName; protected String firstName;
public String lastName; protected String lastName;
protected short statStrCurrent; protected short statStrCurrent;
protected short statDexCurrent; protected short statDexCurrent;
protected short statConCurrent; protected short statConCurrent;
@@ -117,33 +117,16 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
protected boolean movingUp = false; protected boolean movingUp = false;
private float desiredAltitude = 0; private float desiredAltitude = 0;
private long takeOffTime = 0; private long takeOffTime = 0;
private float hateValue = 0;
private long lastHateUpdate = 0; private long lastHateUpdate = 0;
private boolean collided = false;
private byte aoecntr = 0; private byte aoecntr = 0;
public final ConcurrentHashMap<Mob, Integer> siegeMinionMap = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
public AbstractCharacter() { public AbstractCharacter() {
super(); super();
this.firstName = "";
this.lastName = "";
this.statStrCurrent = (short) 0; this.powers = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
this.statDexCurrent = (short) 0; this.skills = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
this.statConCurrent = (short) 0;
this.statIntCurrent = (short) 0;
this.statSpiCurrent = (short) 0;
this.unusedStatPoints = (short) 0;
this.level = (short) 0; // TODO get this from MobsBase later
this.exp = 1;
this.walkMode = true;
this.bindLoc = Vector3fImmutable.ZERO;
this.faceDir = Vector3fImmutable.ZERO;
this.runningTrains = (byte) 0;
this.skills = new ConcurrentHashMap<>();
this.powers = new ConcurrentHashMap<>();
this.initializeCharacter(); this.initializeCharacter();
} }
@@ -231,6 +214,8 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
this.skills = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); this.skills = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
this.initializeCharacter(); this.initializeCharacter();
// Dangerous to use THIS in a constructor!!!
this.charItemManager = new CharacterItemManager(this);
} }
/** /**
@@ -273,6 +258,8 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
this.powers = new ConcurrentHashMap<>(); this.powers = new ConcurrentHashMap<>();
this.initializeCharacter(); this.initializeCharacter();
// Dangerous to use THIS in a constructor!!!
this.charItemManager = new CharacterItemManager(this);
} }
/** /**
@@ -304,6 +291,8 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
this.powers = new ConcurrentHashMap<>(); this.powers = new ConcurrentHashMap<>();
initializeCharacter(); initializeCharacter();
// Dangerous to use THIS in a constructor!!!
this.charItemManager = new CharacterItemManager(this);
} }
/** /**
@@ -353,6 +342,9 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
this.powers = new ConcurrentHashMap<>(); this.powers = new ConcurrentHashMap<>();
this.initializeCharacter(); this.initializeCharacter();
// Dangerous to use THIS in a constructor!!!
this.charItemManager = new CharacterItemManager(this);
} }
public static int getBankCapacity() { public static int getBankCapacity() {
@@ -1766,6 +1758,29 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
this.inBuildingID = inBuildingID; this.inBuildingID = inBuildingID;
} }
public float getHateValue() {
if (this.hateValue <= 0) {
this.hateValue = 0;
return hateValue;
}
if (this.lastHateUpdate == 0) {
this.lastHateUpdate = System.currentTimeMillis();
return this.hateValue;
}
long duration = System.currentTimeMillis() - this.lastHateUpdate;
//convert duration to seconds and multiply Hate Delimiter.
float modAmount = duration / 1000 * MBServerStatics.PLAYER_HATE_DELIMITER;
this.hateValue -= modAmount;
this.lastHateUpdate = System.currentTimeMillis();
return this.hateValue;
}
public void setHateValue(float hateValue) {
this.lastHateUpdate = System.currentTimeMillis();
this.hateValue = hateValue;
}
public int getInFloorID() { public int getInFloorID() {
return inFloorID; return inFloorID;
} }
@@ -9,7 +9,6 @@
package engine.objects; package engine.objects;
import ch.claude_martin.enumbitset.EnumBitSet;
import engine.Enum; import engine.Enum;
import engine.Enum.GameObjectType; import engine.Enum.GameObjectType;
import engine.Enum.ModType; import engine.Enum.ModType;
@@ -32,20 +31,7 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
protected Vector3fImmutable lastBindLoc; protected Vector3fImmutable lastBindLoc;
public boolean assist = false; public boolean assist = false;
public Enum.AIAgentType agentType = Enum.AIAgentType.MOBILE; public Enum.AIAgentType agentType = Enum.AIAgentType.MOBILE;
public boolean isPlayerGuard = false;
public AbstractCharacter guardCaptain;
public EnumBitSet<Enum.MonsterType> notEnemy = EnumBitSet.noneOf(Enum.MonsterType.class);
public EnumBitSet<Enum.MonsterType> enemy = EnumBitSet.noneOf(Enum.MonsterType.class);
;
public Enum.MobBehaviourType behaviourType;
public ArrayList<Vector3fImmutable> patrolPoints;
public int lastPatrolPointIndex = 0;
public long stopPatrolTime = 0;
public City guardedCity;
public AbstractIntelligenceAgent() {
super();
}
public AbstractIntelligenceAgent(ResultSet rs) throws SQLException { public AbstractIntelligenceAgent(ResultSet rs) throws SQLException {
super(rs); super(rs);
@@ -101,8 +87,7 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
this.agentType = Enum.AIAgentType.CHARMED; this.agentType = Enum.AIAgentType.CHARMED;
if (this.getObjectType().equals(GameObjectType.Mob)) { if (this.getObjectType().equals(GameObjectType.Mob)) {
((Mob) this).setOwner(owner);
((Mob) this).guardCaptain = owner;
} }
} }
@@ -125,6 +110,14 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
return 0; return 0;
} }
public PlayerCharacter getOwner() {
if (this.getObjectType().equals(GameObjectType.Mob))
return this.getOwner();
return null;
}
public boolean getSafeZone() { public boolean getSafeZone() {
ArrayList<Zone> allIn = ZoneManager.getAllZonesIn(this.getLoc()); ArrayList<Zone> allIn = ZoneManager.getAllZonesIn(this.getLoc());
@@ -165,7 +158,7 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
//clear owner //clear owner
PlayerCharacter owner = (PlayerCharacter) this.guardCaptain; PlayerCharacter owner = this.getOwner();
//close pet window //close pet window
@@ -181,7 +174,7 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
owner.setPet(null); owner.setPet(null);
if (this.getObjectType().equals(GameObjectType.Mob)) if (this.getObjectType().equals(GameObjectType.Mob))
((Mob) this).guardCaptain = null; ((Mob) this).setOwner(null);
} }
+1 -3
View File
@@ -357,9 +357,7 @@ public abstract class AbstractWorldObject extends AbstractGameObject {
Mob mob = (Mob) this; Mob mob = (Mob) this;
if (mob.isSiege()) { if (mob.isSiege()) {
if (mob.isPet()) { if (mob.isPet()) {
PlayerCharacter petOwner = mob.getOwner();
PlayerCharacter petOwner = (PlayerCharacter) mob.guardCaptain;
if (petOwner != null && source.equals(EffectSourceType.Effect)) { if (petOwner != null && source.equals(EffectSourceType.Effect)) {
petOwner.dismissPet(); petOwner.dismissPet();
return; return;
+20 -53
View File
@@ -171,7 +171,7 @@ public class Blueprint {
maintCost = (9730 * rank) + 1890; maintCost = (9730 * rank) + 1890;
return maintCost; return maintCost * 2;
} }
public int getMaxRank() { public int getMaxRank() {
@@ -313,10 +313,10 @@ public class Blueprint {
// Early exit for buildings with single or no slots // Early exit for buildings with single or no slots
if (this.maxSlots <= 1) if (this.maxSlots <= 1 && this.buildingGroup.equals(BuildingGroup.TOL) == false)
return maxSlots; return maxSlots;
if (this.maxRank == 1 && currentRank == 1) if (this.maxRank == 1 && currentRank == 1&& this.buildingGroup.equals(BuildingGroup.TOL) == false)
return getMaxSlots(); return getMaxSlots();
switch (currentRank) { switch (currentRank) {
@@ -328,20 +328,22 @@ public class Blueprint {
case 3: case 3:
case 4: case 4:
case 5: case 5:
case 6:
availableSlots = 2; availableSlots = 2;
break; break;
case 6:
case 7: case 7:
availableSlots = 3; availableSlots = 3;
break; break;
case 8: case 8:
availableSlots = 1; availableSlots = 3;
break; break;
default: default:
availableSlots = 0; availableSlots = 0;
break; break;
} }
if(this.buildingGroup.equals(BuildingGroup.TOL)){
availableSlots += 1;
}
return availableSlots; return availableSlots;
} }
@@ -492,54 +494,19 @@ public class Blueprint {
// Select equation for rank time based upon the // Select equation for rank time based upon the
// buildings current Maintenance BuildingGroup. These values // buildings current Maintenance BuildingGroup. These values
// are expressed in hours // are expressed in hours
if(this.getBuildingGroup().equals(BuildingGroup.TOL))
switch(targetRank){
case 2:
case 3:
case 4:
case 5:
return 6;
case 6:
case 7:
return 36;
}
switch (this.buildingGroup) { return 5;
case GENERICNOUPGRADE:
break; // Cannot be upgraded
case VILLA:
case ESTATE:
case FORTRESS:
case CITADEL:
rankTime = (7 * targetRank) - 7;
break;
case TOL:
rankTime = (7 * targetRank) - 7;
break;
case BARRACK:
rankTime = (7 * targetRank) - 7;
break;
case CHURCH:
rankTime = (7 * targetRank) - 7;
break;
case FORGE:
case INN:
case TAILOR:
case MAGICSHOP:
rankTime = (7 * targetRank) - 7;
break;
case SPIRE:
rankTime = (4 * targetRank) + 4;
break;
case AMAZONHALL:
case CATHEDRAL:
case GREATHALL:
case KEEP:
case THIEFHALL:
case TEMPLEHALL:
case WIZARDHALL:
case ELVENHALL:
case ELVENSANCTUM:
case IREKEIHALL:
case FORESTHALL:
rankTime = (7 * targetRank) - 7;
break;
default:
Logger.error("Attempt to retrieve ranktime without MaintGroup");
break;
}
return rankTime;
} }
public Vector2f getExtents() { public Vector2f getExtents() {
+1 -1
View File
@@ -784,7 +784,7 @@ public class Building extends AbstractWorldObject {
// Add cost for building structure // Add cost for building structure
maintCost += this.getBlueprint().getMaintCost(rank); maintCost += this.getBlueprint().getMaintCost(rank) * 2;
// Add costs associated with hirelings // Add costs associated with hirelings
-16
View File
@@ -75,9 +75,6 @@ public class City extends AbstractWorldObject {
private byte isCapital = 0; private byte isCapital = 0;
private byte isSafeHold; private byte isSafeHold;
private boolean forceRename = false; private boolean forceRename = false;
private boolean noTeleport = false; //used by npc cities
private boolean noRepledge = false; //used by npc cities
private boolean isOpen = false;
private int treeOfLifeID; private int treeOfLifeID;
private Vector3fImmutable location = Vector3fImmutable.ZERO; private Vector3fImmutable location = Vector3fImmutable.ZERO;
@@ -142,14 +139,6 @@ public class City extends AbstractWorldObject {
this.forceRename = rs.getInt("forceRename") == 1; this.forceRename = rs.getInt("forceRename") == 1;
this.open = rs.getInt("open") == 1; this.open = rs.getInt("open") == 1;
if (this.cityName.equals("Perdition") || this.cityName.equals("Bastion")) {
this.noTeleport = true;
this.noRepledge = true;
} else {
this.noTeleport = false;
this.noRepledge = false;
}
this.hash = rs.getString("hash"); this.hash = rs.getString("hash");
if (this.motto.isEmpty()) { if (this.motto.isEmpty()) {
@@ -356,9 +345,6 @@ public class City extends AbstractWorldObject {
if (ago.getObjectType().equals(GameObjectType.City)) { if (ago.getObjectType().equals(GameObjectType.City)) {
City city = (City) ago; City city = (City) ago;
if (city.noTeleport)
continue;
if (city.parentZone != null && city.parentZone.isPlayerCity()) { if (city.parentZone != null && city.parentZone.isPlayerCity()) {
if (pc.getAccount().status.equals(AccountStatus.ADMIN)) { if (pc.getAccount().status.equals(AccountStatus.ADMIN)) {
@@ -412,8 +398,6 @@ public class City extends AbstractWorldObject {
for (AbstractGameObject ago : worldCities.values()) { for (AbstractGameObject ago : worldCities.values()) {
if (ago.getObjectType().equals(GameObjectType.City)) { if (ago.getObjectType().equals(GameObjectType.City)) {
City city = (City) ago; City city = (City) ago;
if (city.noRepledge)
continue;
if (city.parentZone != null && city.parentZone.isPlayerCity()) { if (city.parentZone != null && city.parentZone.isPlayerCity()) {
+20
View File
@@ -13,6 +13,7 @@ import engine.Enum.DamageType;
import engine.Enum.GameObjectType; import engine.Enum.GameObjectType;
import engine.Enum.ItemType; import engine.Enum.ItemType;
import engine.gameManager.DbManager; import engine.gameManager.DbManager;
import engine.gameManager.LootManager;
import engine.server.MBServerStatics; import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
@@ -914,4 +915,23 @@ public class ItemBase {
public void setAutoID(boolean autoID) { public void setAutoID(boolean autoID) {
this.autoID = autoID; this.autoID = autoID;
} }
public boolean isVorg(){
return LootManager.vorg_ha_uuids.contains(this.uuid) || LootManager.vorg_ma_uuids.contains(this.uuid) || LootManager.vorg_la_uuids.contains(this.uuid) || LootManager.vorg_cloth_uuids.contains(this.uuid);
}
public String[] getVorgStats() {
if(this.isLightArmor() || this.isMediumArmor() || this.isHeavyArmor() || this.isClothArmor()){
if(this.getValidSlot() == MBServerStatics.SLOT_FEET) {
return new String[]{"PRE-130", "PRE-232", "PRE-212", "PRE-222", "SUF-007","SUF-150"};
}else {
return new String[]{"PRE-130", "PRE-232", "PRE-212", "PRE-222", "SUF-007"};
}
} else if(this.isShield()){//shield
return new String[]{"SUF-265","PRE-123","PRE-232", "PRE-212", "PRE-222"};
} else{//weapon
return new String[]{"PRE-020","PRE-033",};
}
}
} }
File diff suppressed because it is too large Load Diff
+20 -12
View File
@@ -50,6 +50,7 @@ public class NPC extends AbstractCharacter {
// Used for thread safety // Used for thread safety
public final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); public final ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
private final ArrayList<MobLoot> rolling = new ArrayList<>(); private final ArrayList<MobLoot> rolling = new ArrayList<>();
private final ConcurrentHashMap<Mob, Integer> siegeMinionMap = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
public ReentrantReadWriteLock minionLock = new ReentrantReadWriteLock(); public ReentrantReadWriteLock minionLock = new ReentrantReadWriteLock();
public ArrayList<ProducedItem> forgedItems = new ArrayList<>(); public ArrayList<ProducedItem> forgedItems = new ArrayList<>();
public HashMap<Integer, MobEquipment> equip = null; public HashMap<Integer, MobEquipment> equip = null;
@@ -85,7 +86,6 @@ public class NPC extends AbstractCharacter {
public NPC() { public NPC() {
super();
this.dbID = MBServerStatics.NO_DB_ROW_ASSIGNED_YET; this.dbID = MBServerStatics.NO_DB_ROW_ASSIGNED_YET;
this.currentID = MBServerStatics.NO_DB_ROW_ASSIGNED_YET; this.currentID = MBServerStatics.NO_DB_ROW_ASSIGNED_YET;
} }
@@ -654,14 +654,12 @@ public class NPC extends AbstractCharacter {
WorldGrid.RemoveWorldObject(toRemove); WorldGrid.RemoveWorldObject(toRemove);
DbManager.removeFromCache(toRemove); DbManager.removeFromCache(toRemove);
PlayerCharacter petOwner = toRemove.getOwner();
PlayerCharacter petOwner = (PlayerCharacter) toRemove.guardCaptain;
if (petOwner != null) { if (petOwner != null) {
petOwner.setPet(null); petOwner.setPet(null);
toRemove.setOwner(null);
toRemove.guardCaptain = null;
PetMsg petMsg = new PetMsg(5, null); PetMsg petMsg = new PetMsg(5, null);
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg); Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
@@ -807,8 +805,6 @@ public class NPC extends AbstractCharacter {
@Override @Override
public void runAfterLoad() { public void runAfterLoad() {
this.charItemManager = new CharacterItemManager(this);
if (ConfigManager.serverType.equals(ServerType.LOGINSERVER)) if (ConfigManager.serverType.equals(ServerType.LOGINSERVER))
return; return;
@@ -850,6 +846,10 @@ public class NPC extends AbstractCharacter {
if (wordCount(this.name) < 2 && this.contract != null) if (wordCount(this.name) < 2 && this.contract != null)
this.name += " the " + this.contract.getName(); this.name += " the " + this.contract.getName();
// Initialize inventory
this.charItemManager = new CharacterItemManager(this);
// Configure parent zone adding this NPC to the // Configure parent zone adding this NPC to the
// zone collection // zone collection
@@ -1074,8 +1074,8 @@ public class NPC extends AbstractCharacter {
filteredItemList.add(910010 + subID); filteredItemList.add(910010 + subID);
} }
if (this.getRank() == 7) //if (this.getRank() == 7)
filteredItemList.add(910018); // filteredItemList.add(910018);
} }
return filteredItemList; return filteredItemList;
@@ -1103,6 +1103,10 @@ public class NPC extends AbstractCharacter {
return (int) time; return (int) time;
} }
public ConcurrentHashMap<Mob, Integer> getSiegeMinionMap() {
return siegeMinionMap;
}
public boolean remove() { public boolean remove() {
Building building; Building building;
@@ -1148,9 +1152,13 @@ public class NPC extends AbstractCharacter {
upgradeTime = Integer.MAX_VALUE; upgradeTime = Integer.MAX_VALUE;
if (this.getRank() < 7) if (this.getRank() < 7) {
return (this.getRank() * 8); if(this.contract.getName().contains("Trainer") == false){
return 5;
}else{
return this.getRank() * 8;
}
}
return 0; return 0;
} }
+24 -9
View File
@@ -53,6 +53,8 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock;
import static engine.InterestManagement.RealmMap.getRealmAtLocation;
public class PlayerCharacter extends AbstractCharacter { public class PlayerCharacter extends AbstractCharacter {
@@ -144,6 +146,7 @@ public class PlayerCharacter extends AbstractCharacter {
private long lastUpdateTime = System.currentTimeMillis(); private long lastUpdateTime = System.currentTimeMillis();
private long lastStamUpdateTime = System.currentTimeMillis(); private long lastStamUpdateTime = System.currentTimeMillis();
private boolean safeZone = false; private boolean safeZone = false;
private int bindBuildingID;
/* /*
DataWarehouse based kill/death tracking. DataWarehouse based kill/death tracking.
@@ -204,18 +207,15 @@ public class PlayerCharacter extends AbstractCharacter {
this.spiMod.set(spiMod); this.spiMod.set(spiMod);
this.guildStatus = new AtomicInteger(0); this.guildStatus = new AtomicInteger(0);
this.buildingUUID = -1; this.bindBuildingID = -1;
} }
/** /**
* ResultSet Constructor * ResultSet Constructor
*/ */
public PlayerCharacter(ResultSet rs) throws SQLException { public PlayerCharacter(ResultSet rs) throws SQLException {
super(rs, true); super(rs, true);
this.charItemManager = new CharacterItemManager(this);
this.runes = DbManager.CharacterRuneQueries.GET_RUNES_FOR_CHARACTER(this.getObjectUUID()); this.runes = DbManager.CharacterRuneQueries.GET_RUNES_FOR_CHARACTER(this.getObjectUUID());
int accountID = rs.getInt("parent"); int accountID = rs.getInt("parent");
this.account = DbManager.AccountQueries.GET_ACCOUNT(accountID); this.account = DbManager.AccountQueries.GET_ACCOUNT(accountID);
@@ -267,7 +267,7 @@ public class PlayerCharacter extends AbstractCharacter {
this.intMod.set(rs.getShort("char_intMod")); this.intMod.set(rs.getShort("char_intMod"));
this.spiMod.set(rs.getShort("char_spiMod")); this.spiMod.set(rs.getShort("char_spiMod"));
this.buildingUUID = rs.getInt("char_bindBuilding"); this.bindBuildingID = rs.getInt("char_bindBuilding");
this.hash = rs.getString("hash"); this.hash = rs.getString("hash");
@@ -2723,12 +2723,12 @@ public class PlayerCharacter extends AbstractCharacter {
*/ */
public synchronized int getBindBuildingID() { public synchronized int getBindBuildingID() {
return this.buildingUUID; return this.bindBuildingID;
} }
public synchronized void setBindBuildingID(int value) { public synchronized void setBindBuildingID(int value) {
DbManager.PlayerCharacterQueries.SET_BIND_BUILDING(this, value); DbManager.PlayerCharacterQueries.SET_BIND_BUILDING(this, value);
this.buildingUUID = value; this.bindBuildingID = value;
} }
public AbstractGameObject getLastTarget() { public AbstractGameObject getLastTarget() {
@@ -4563,6 +4563,10 @@ public class PlayerCharacter extends AbstractCharacter {
@Override @Override
public void runAfterLoad() { public void runAfterLoad() {
// Init inventory
this.charItemManager = new CharacterItemManager(this);
Bounds playerBounds = Bounds.borrow(); Bounds playerBounds = Bounds.borrow();
playerBounds.setBounds(this.getLoc()); playerBounds.setBounds(this.getLoc());
this.setBounds(playerBounds); this.setBounds(playerBounds);
@@ -4690,8 +4694,7 @@ public class PlayerCharacter extends AbstractCharacter {
} else if (currentPet.isSiege()) { } else if (currentPet.isSiege()) {
currentPet.agentType = AIAgentType.MOBILE; currentPet.agentType = AIAgentType.MOBILE;
currentPet.setOwner(null);
currentPet.guardCaptain = null;
currentPet.setCombatTarget(null); currentPet.setCombatTarget(null);
if (currentPet.isAlive()) if (currentPet.isAlive())
WorldGrid.updateObject(currentPet); WorldGrid.updateObject(currentPet);
@@ -4810,6 +4813,18 @@ public class PlayerCharacter extends AbstractCharacter {
updateBlessingMessage(); updateBlessingMessage();
this.safeZone = this.isInSafeZone(); this.safeZone = this.isInSafeZone();
Realm currentRealm = getRealmAtLocation(this.getLoc());
if(currentRealm != null) {
boolean forbiddenRealm = false;
if (Realm.overridePlacement(currentRealm.getRealmName()))
forbiddenRealm = true;
if (forbiddenRealm && this.containsEffect(1672601862) == false) {//Deathshroud
PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false);
}
}
//if(this.isBoxed && this.containsEffect(429611355) == false) {//pathfinding
// PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 429611355, 40, false);
//}
} catch (Exception e) { } catch (Exception e) {
Logger.error(e); Logger.error(e);
+45 -8
View File
@@ -76,18 +76,40 @@ public class Realm {
this.mapG = (float) (mapColor.getGreen() * 0.00392156863); this.mapG = (float) (mapColor.getGreen() * 0.00392156863);
this.mapB = (float) (mapColor.getBlue() * 0.00392156863); this.mapB = (float) (mapColor.getBlue() * 0.00392156863);
this.mapA = 1; this.mapA = 1;
this.canBeClaimed = rs.getBoolean("canBeClaimed"); if (overridePlacement(rs.getString("realmName"))) {
this.canPlaceCities = rs.getBoolean("canPlaceCities"); this.canBeClaimed = false;
this.numCities = rs.getInt("numCities"); this.canPlaceCities = false;
this.realmName = rs.getString("realmName"); this.numCities = 0;
this.rulingCityUUID = rs.getInt("rulingCityUID"); this.rulingCityUUID = 0;
this.charterType = rs.getInt("charterType"); this.charterType = 0;
this.realmName = "Plagued Land";
} else {
this.canPlaceCities = rs.getBoolean("canPlaceCities");
this.numCities = rs.getInt("numCities");
if(this.numCities > 0){
this.canBeClaimed = true;
}else{
this.canBeClaimed = false;
}
this.rulingCityUUID = rs.getInt("rulingCityUID");
if (this.rulingCityUUID != 0) {
this.charterType = rs.getInt("charterType");
} else {
this.charterType = 0;
}
this.realmName = rs.getString("realmName");
}
java.sql.Timestamp ruledTimeStamp = rs.getTimestamp("ruledSince"); java.sql.Timestamp ruledTimeStamp = rs.getTimestamp("ruledSince");
if (ruledTimeStamp != null) if (ruledTimeStamp != null){
this.ruledSince = LocalDateTime.ofInstant(ruledTimeStamp.toInstant(), ZoneId.systemDefault()); this.ruledSince = LocalDateTime.ofInstant(ruledTimeStamp.toInstant(), ZoneId.systemDefault());
}else {
this.rulingCityUUID = 0;
this.charterType = 0;
}
this.mapY1 = rs.getFloat("mapY1"); this.mapY1 = rs.getFloat("mapY1");
this.mapX1 = rs.getFloat("mapX1"); this.mapX1 = rs.getFloat("mapX1");
this.mapY2 = rs.getFloat("mapY2"); this.mapY2 = rs.getFloat("mapY2");
@@ -100,6 +122,21 @@ public class Realm {
this.hash = rs.getString("hash"); this.hash = rs.getString("hash");
} }
public static boolean overridePlacement(String realm){
switch(realm.toLowerCase()) {
case "neshraa":
case "adduram":
case "letharuun":
case "kralgaard":
//case "ecklund":
case "nordenthol":
case "thollmar":
case "haldorn isles":
case "hregenlund":
return true;
}
return false;
}
public static void configureAllRealms() { public static void configureAllRealms() {
for (Realm realm : Realm._realms.values()) { for (Realm realm : Realm._realms.values()) {
+42 -1
View File
@@ -74,7 +74,11 @@ public class Zone extends AbstractGameObject {
this.zCoord = rs.getFloat("ZCoord"); this.zCoord = rs.getFloat("ZCoord");
this.yCoord = rs.getFloat("YOffset"); this.yCoord = rs.getFloat("YOffset");
this.loadNum = rs.getInt("LoadNum"); this.loadNum = rs.getInt("LoadNum");
this.safeZone = rs.getByte("SafeZone"); if(overrideSafety(rs.getString("Name"))){
this.safeZone = (byte) 0;
}else {
this.safeZone = rs.getByte("SafeZone");
}
this.Icon1 = rs.getString("Icon1"); this.Icon1 = rs.getString("Icon1");
this.Icon2 = rs.getString("Icon2"); this.Icon2 = rs.getString("Icon2");
this.Icon3 = rs.getString("Icon3"); this.Icon3 = rs.getString("Icon3");
@@ -103,7 +107,44 @@ public class Zone extends AbstractGameObject {
} }
public static boolean skipZone(String name){
switch(name){
case "Kralgar Holm":
case "Doomhorn Skrae":
case "Ymur's Crown":
case "Ecklund Wilds":
case "Ragnir Holm":
case "Aurrochs Skrae":
case "Hregerend Wildlands":
case "The Blood Sands":
case "Vale of Nar Addad":
case "Kharsoom":
case "Leth'khalivar Desert":
case "Thollok Marsh":
case "The Black Bog":
case "sevaath Mere":
return true;
}
return false;
}
public static boolean overrideSafety(String name){
switch(name){
case"Sanctuary":
case "All-Father's Rest":
case "Hamlet of Hothor's Doom":
case"Hamlet of Hrimdal":
case "Hamlet of Valkirch":
case "Hamlet of Scraefahl":
case "Hamlet of Hengest":
case "Starkholm":
case "Aeldreth Havens":
case "Erkeng Hold":
case "Sea Dog's Rest":
return false;
}
return true;
}
public static void serializeForClientMsg(Zone zone, ByteBufferWriter writer) { public static void serializeForClientMsg(Zone zone, ByteBufferWriter writer) {
if (zone.loadNum == 0 && zone.playerCityID == 0) if (zone.loadNum == 0 && zone.playerCityID == 0)
@@ -11,7 +11,6 @@ package engine.powers.poweractions;
import engine.Enum.GameObjectType; import engine.Enum.GameObjectType;
import engine.Enum.ModType; import engine.Enum.ModType;
import engine.Enum.SourceType; import engine.Enum.SourceType;
import engine.InterestManagement.WorldGrid;
import engine.gameManager.ChatManager; import engine.gameManager.ChatManager;
import engine.jobs.ChantJob; import engine.jobs.ChantJob;
import engine.jobs.DeferredPowerJob; import engine.jobs.DeferredPowerJob;
@@ -23,7 +22,6 @@ import engine.objects.*;
import engine.powers.ActionsBase; import engine.powers.ActionsBase;
import engine.powers.EffectsBase; import engine.powers.EffectsBase;
import engine.powers.PowersBase; import engine.powers.PowersBase;
import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
import java.sql.ResultSet; import java.sql.ResultSet;
@@ -119,12 +117,20 @@ public class ApplyEffectPowerAction extends AbstractPowerAction {
awo.addEffect(stackType, duration, eff, effect, trains); awo.addEffect(stackType, duration, eff, effect, trains);
} else } else
awo.applyAllBonuses(); awo.applyAllBonuses();
// //TODO if chant, start cycle
// if (pb.isChant() && source.equals(awo)) {
// ChantJob cj = new ChantJob(source, awo, stackType, trains, ab, pb, effect, eff);
// source.setLastChant((int)(pb.getChantDuration()-2) * 1000, cj);
// eff.setChant(true);
// }
if (this.effectID.equals("TAUNT")) { if (this.effectID.equals("TAUNT")) {
if (awo != null && awo.getObjectType() == GameObjectType.Mob) { if (awo != null && awo.getObjectType() == GameObjectType.Mob) {
((Mob) awo).setCombatTarget(source);
ChatSystemMsg msg = ChatManager.CombatInfo(source, awo); ChatSystemMsg msg = ChatManager.CombatInfo(source, awo);
DispatchMessage.sendToAllInRange(source, msg); DispatchMessage.sendToAllInRange(source, msg);
((Mob)awo).refresh();
} }
} }
if (awo != null && awo.getObjectType() == GameObjectType.Mob) { if (awo != null && awo.getObjectType() == GameObjectType.Mob) {
@@ -134,21 +140,7 @@ public class ApplyEffectPowerAction extends AbstractPowerAction {
} }
this.effect.startEffect(source, awo, trains, eff); this.effect.startEffect(source, awo, trains, eff);
} }
//apply effects to mobs within range for chants
if(pb.isChant){
for(AbstractGameObject ago : WorldGrid.getObjectsInRangePartial(awo.loc,pb.range, MBServerStatics.MASK_MOB)){
Mob mob = (Mob)ago;
if(mob.playerAgroMap.containsKey(source.getObjectUUID()))
mob.playerAgroMap.put(source.getObjectUUID(), mob.playerAgroMap.get(source.getObjectUUID()).floatValue() + pb.hateValue);
}
}else {
if (awo != null && awo.getObjectType() == GameObjectType.Mob) {
Mob mob = (Mob) awo;
if (mob.playerAgroMap.containsKey(source.getObjectUUID()))
mob.playerAgroMap.put(source.getObjectUUID(), mob.playerAgroMap.get(source.getObjectUUID()).floatValue() + pb.hateValue);
}
}
} }
protected void _applyEffectForItem(Item item, int trains) { protected void _applyEffectForItem(Item item, int trains) {
@@ -12,6 +12,7 @@ package engine.powers.poweractions;
import engine.Enum; import engine.Enum;
import engine.InterestManagement.WorldGrid; import engine.InterestManagement.WorldGrid;
import engine.gameManager.DbManager; import engine.gameManager.DbManager;
import engine.gameManager.MovementManager;
import engine.gameManager.NPCManager; import engine.gameManager.NPCManager;
import engine.gameManager.ZoneManager; import engine.gameManager.ZoneManager;
import engine.math.Vector3fImmutable; import engine.math.Vector3fImmutable;
@@ -74,7 +75,7 @@ public class CreateMobPowerAction extends AbstractPowerAction {
return; return;
//create Pet //create Pet
Mob pet = Mob.createPetMinion(mobID, seaFloor, owner, (short) mobLevel); Mob pet = Mob.createPet(mobID, guild, seaFloor, owner, (short) mobLevel);
if (pet.getMobBaseID() == 12021 || pet.getMobBaseID() == 12022) { //is a necro pet if (pet.getMobBaseID() == 12021 || pet.getMobBaseID() == 12022) { //is a necro pet
@@ -83,6 +84,8 @@ public class CreateMobPowerAction extends AbstractPowerAction {
WorldGrid.RemoveWorldObject(currentPet); WorldGrid.RemoveWorldObject(currentPet);
currentPet.setCombatTarget(null); currentPet.setCombatTarget(null);
//if (currentPet.getParentZone() != null)
//currentPet.getParentZone().zoneMobSet.remove(currentPet);
seaFloor.zoneMobSet.remove(currentPet); seaFloor.zoneMobSet.remove(currentPet);
currentPet.playerAgroMap.clear(); currentPet.playerAgroMap.clear();
@@ -92,10 +95,10 @@ public class CreateMobPowerAction extends AbstractPowerAction {
Logger.error(e.getMessage()); Logger.error(e.getMessage());
} }
//currentPet.disableIntelligence();
} else if (currentPet != null && currentPet.isSiege()) { } else if (currentPet != null && currentPet.isSiege()) {
currentPet.agentType = Enum.AIAgentType.MOBILE; currentPet.agentType = Enum.AIAgentType.MOBILE;
currentPet.setOwner(null);
currentPet.guardCaptain = null;
currentPet.setCombatTarget(null); currentPet.setCombatTarget(null);
if (currentPet.isAlive()) if (currentPet.isAlive())
@@ -103,6 +106,7 @@ public class CreateMobPowerAction extends AbstractPowerAction {
} }
//remove 10th pet //remove 10th pet
NPCManager.spawnNecroPet(owner, pet); NPCManager.spawnNecroPet(owner, pet);
} else { //is not a necro pet } else { //is not a necro pet
@@ -111,7 +115,7 @@ public class CreateMobPowerAction extends AbstractPowerAction {
DbManager.removeFromCache(currentPet); DbManager.removeFromCache(currentPet);
currentPet.setCombatTarget(null); currentPet.setCombatTarget(null);
currentPet.guardCaptain = null; currentPet.setOwner(null);
WorldGrid.RemoveWorldObject(currentPet); WorldGrid.RemoveWorldObject(currentPet);
//currentPet.getParentZone().zoneMobSet.remove(currentPet); //currentPet.getParentZone().zoneMobSet.remove(currentPet);
seaFloor.zoneMobSet.remove(currentPet); seaFloor.zoneMobSet.remove(currentPet);
@@ -121,8 +125,7 @@ public class CreateMobPowerAction extends AbstractPowerAction {
} else { } else {
if (currentPet.isSiege()) { if (currentPet.isSiege()) {
currentPet.agentType = Enum.AIAgentType.MOBILE; currentPet.agentType = Enum.AIAgentType.MOBILE;
currentPet.setOwner(null);
currentPet.guardCaptain = null;
currentPet.setCombatTarget(null); currentPet.setCombatTarget(null);
if (currentPet.isAlive()) if (currentPet.isAlive())
@@ -134,9 +137,26 @@ public class CreateMobPowerAction extends AbstractPowerAction {
NPCManager.resetNecroPets(owner); NPCManager.resetNecroPets(owner);
} }
} }
/* if(owner.getPet() != null) {
if(owner.getPet().getMobBaseID() != 12021 && owner.getPet().getMobBaseID() != 12022) {
//if not a necro pet, remove pet
WorldGrid.removeWorldObject(owner.getPet());
owner.getPet().disableIntelligence();
Mob.removePet(owner.getPet().getUUID());
owner.setPet(null);
}
else {
//if it is a necro pet, add it to the line and set as mob
owner.getPet().setMob();
}
}*/
// if (mobID == 12021 || mobID == 12022) //Necro Pets
// pet.setPet(owner, true);
owner.setPet(pet); owner.setPet(pet);
if(pet.isSiege() == false) {
MovementManager.translocate(pet, owner.getLoc(), owner.region);
}
pet.recalculateStats(); pet.recalculateStats();
pet.healthMax = pet.level * 0.5f * 120; pet.healthMax = pet.level * 0.5f * 120;
pet.setHealth(pet.healthMax); pet.setHealth(pet.healthMax);
@@ -59,7 +59,7 @@ public class FearPowerAction extends AbstractPowerAction {
int duration = 10 + ((int) (trains * 0.5)); int duration = 10 + ((int) (trains * 0.5));
String stackType = ab.getStackType(); String stackType = ab.getStackType();
EndFearJob efj = new EndFearJob(source, awo, stackType, trains, ab, pb, null); EndFearJob efj = new EndFearJob(source, awo, stackType, trains, ab, pb, null);
((Mob) awo).fearedObject = source; ((Mob) awo).setFearedObject(source);
JobScheduler.getInstance().scheduleJob(efj, duration * 1000); JobScheduler.getInstance().scheduleJob(efj, duration * 1000);
} }
+44 -43
View File
@@ -10,14 +10,15 @@
package engine.server.world; package engine.server.world;
import engine.Enum; import engine.Enum;
import engine.Enum.BuildingGroup;
import engine.Enum.DispatchChannel; import engine.Enum.DispatchChannel;
import engine.Enum.MinionType; import engine.Enum.MinionType;
import engine.Enum.SupportMsgType; import engine.Enum.SupportMsgType;
import engine.InterestManagement.HeightMap; import engine.InterestManagement.HeightMap;
import engine.InterestManagement.InterestManager;
import engine.InterestManagement.RealmMap; import engine.InterestManagement.RealmMap;
import engine.InterestManagement.WorldGrid; import engine.InterestManagement.WorldGrid;
import engine.db.archive.DataWarehouse; import engine.db.archive.DataWarehouse;
import engine.db.handlers.dbPowerHandler;
import engine.exception.MsgSendException; import engine.exception.MsgSendException;
import engine.gameManager.*; import engine.gameManager.*;
import engine.job.JobContainer; import engine.job.JobContainer;
@@ -334,7 +335,7 @@ public class WorldServer {
DbManager.PromotionQueries.GET_ALL_PROMOTIONS(); DbManager.PromotionQueries.GET_ALL_PROMOTIONS();
Logger.info("Loading NPC and Mob Rune Sets"); Logger.info("Loading NPC and Mob Rune Sets");
NPCManager._runeSetMap = DbManager.ItemBaseQueries.LOAD_RUNES_FOR_NPC_AND_MOBS(); NPCManager.LoadAllRuneSets();
Logger.info("Loading Booty Sets"); Logger.info("Loading Booty Sets");
LootManager._bootySetMap = DbManager.LootQueries.LOAD_BOOTY_TABLES(); LootManager._bootySetMap = DbManager.LootQueries.LOAD_BOOTY_TABLES();
@@ -352,7 +353,7 @@ public class WorldServer {
DbManager.MobBaseQueries.GET_ALL_MOBBASES(); DbManager.MobBaseQueries.GET_ALL_MOBBASES();
Logger.info("Loading Mob Powers"); Logger.info("Loading Mob Powers");
PowersManager.AllMobPowers = dbPowerHandler.LOAD_MOB_POWERS(); PowersManager.AllMobPowers = DbManager.PowerQueries.LOAD_MOB_POWERS();
Logger.info("Loading item enchants"); Logger.info("Loading item enchants");
DbManager.LootQueries.LOAD_ENCHANT_VALUES(); DbManager.LootQueries.LOAD_ENCHANT_VALUES();
@@ -551,40 +552,44 @@ public class WorldServer {
} }
//Set sea floor object for server //Set sea floor object for server
Zone seaFloor = rootParent.get(0); Zone seaFloor = rootParent.get(0);
seaFloor.setParent(null); seaFloor.setParent(null);
ZoneManager.setSeaFloor(seaFloor); ZoneManager.setSeaFloor(seaFloor);
// zoneManager.addZone(seaFloor.getLoadNum(), seaFloor); <- DIE IN A FUCKING CAR FIRE BONUS CODE LIKE THIS SUCKS FUCKING DICK
rootParent.addAll(DbManager.ZoneQueries.GET_ALL_NODES(seaFloor)); rootParent.addAll(DbManager.ZoneQueries.GET_ALL_NODES(seaFloor));
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
for (Zone zone : rootParent) { for (Zone zone : rootParent) {
ZoneManager.addZone(zone.getLoadNum(), zone);
zone.generateWorldAltitude();
//Handle Buildings
try { try {
ZoneManager.addZone(zone.getLoadNum(), zone);
try {
zone.generateWorldAltitude();
} catch (Exception e) {
Logger.error(e.getMessage());
e.printStackTrace();
}
//Handle Buildings
ArrayList<Building> bList; ArrayList<Building> bList;
bList = DbManager.BuildingQueries.GET_ALL_BUILDINGS_FOR_ZONE(zone); bList = DbManager.BuildingQueries.GET_ALL_BUILDINGS_FOR_ZONE(zone);
for (Building b : bList) { for (Building b : bList) {
b.setObjectTypeMask(MBServerStatics.MASK_BUILDING); try {
b.setLoc(b.getLoc()); b.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
b.setLoc(b.getLoc());
} catch (Exception e) {
Logger.error(b.getObjectUUID() + " returned an Error Message :" + e.getMessage());
}
} }
} catch (Exception e) {
Logger.error(e);
e.printStackTrace();
}
//Handle Mobs //Handle Mobs
try {
ArrayList<Mob> mobs; ArrayList<Mob> mobs;
mobs = DbManager.MobQueries.GET_ALL_MOBS_FOR_ZONE(zone); mobs = DbManager.MobQueries.GET_ALL_MOBS_FOR_ZONE(zone);
@@ -592,22 +597,15 @@ public class WorldServer {
m.setObjectTypeMask(MBServerStatics.MASK_MOB | m.getTypeMasks()); m.setObjectTypeMask(MBServerStatics.MASK_MOB | m.getTypeMasks());
m.setLoc(m.getLoc()); m.setLoc(m.getLoc());
// Load Minions for Guard Captains here. //ADD GUARDS HERE.
if (m.building != null && m.building.getBlueprint() != null && m.building.getBlueprint().getBuildingGroup() == BuildingGroup.BARRACK)
if (m.building != null && m.building.getBlueprint() != null && m.building.getBlueprint().getBuildingGroup() == Enum.BuildingGroup.BARRACK) DbManager.MobQueries.LOAD_PATROL_POINTS(m);
DbManager.MobQueries.LOAD_GUARD_MINIONS(m);
} }
} catch (Exception e) {
Logger.error(e);
e.printStackTrace();
}
//Handle NPCs //Handle npc's
try {
ArrayList<NPC> npcs; ArrayList<NPC> npcs;
// Ignore NPCs on the seafloor (npc guild leaders, etc) // Ignore npc's on the seafloor (npc guild leaders, etc)
if (zone.equals(seaFloor)) if (zone.equals(seaFloor))
continue; continue;
@@ -615,22 +613,26 @@ public class WorldServer {
npcs = DbManager.NPCQueries.GET_ALL_NPCS_FOR_ZONE(zone); npcs = DbManager.NPCQueries.GET_ALL_NPCS_FOR_ZONE(zone);
for (NPC n : npcs) { for (NPC n : npcs) {
n.setObjectTypeMask(MBServerStatics.MASK_NPC);
n.setLoc(n.getLoc()); try {
n.setObjectTypeMask(MBServerStatics.MASK_NPC);
n.setLoc(n.getLoc());
} catch (Exception e) {
Logger.error(n.getObjectUUID() + " returned an Error Message :" + e.getMessage());
}
} }
//Handle cities
ZoneManager.loadCities(zone);
ZoneManager.populateWorldZones(zone);
} catch (Exception e) { } catch (Exception e) {
Logger.error(e); Logger.info(e.getMessage() + zone.getName() + ' ' + zone.getObjectUUID());
e.printStackTrace();
} }
//Handle cities
ZoneManager.loadCities(zone);
ZoneManager.populateWorldZones(zone);
} }
Logger.info("time to load World Objects: " + (System.currentTimeMillis() - start) + " ms"); Logger.info("time to load: " + (System.currentTimeMillis() - start) + " ms");
} }
/** /**
@@ -703,13 +705,12 @@ public class WorldServer {
return; return;
} }
//remove player from loaded mobs agro maps //remove player from loaded mobs agro maps
for (AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(player.getLoc(), MBServerStatics.CHARACTER_LOAD_RANGE, MBServerStatics.MASK_MOB)) { for(AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(player.getLoc(),MBServerStatics.CHARACTER_LOAD_RANGE,MBServerStatics.MASK_MOB)) {
Mob loadedMob = (Mob) awo; Mob loadedMob = (Mob) awo;
loadedMob.playerAgroMap.remove(player.getObjectUUID()); loadedMob.playerAgroMap.remove(player.getObjectUUID());
} }
player.getTimestamps().put("logout", System.currentTimeMillis()); player.getTimestamps().put("logout", System.currentTimeMillis());
player.setEnteredWorld(false); player.setEnteredWorld(false);
// remove from simulation and zero current loc // remove from simulation and zero current loc
WorldGrid.RemoveWorldObject(player); WorldGrid.RemoveWorldObject(player);