Browse Source

Project reformat.

combat-2
MagicBot 8 months ago
parent
commit
943d274e5f
  1. 4
      src/engine/devcmd/cmds/AddGoldCmd.java
  2. 6
      src/engine/devcmd/cmds/InfoCmd.java
  3. 2
      src/engine/devcmd/cmds/PrintEffectsCmd.java
  4. 2
      src/engine/devcmd/cmds/PrintRunesCmd.java
  5. 17
      src/engine/devcmd/cmds/RegionCmd.java
  6. 8
      src/engine/devcmd/cmds/aiInfoCmd.java
  7. 3
      src/engine/gameManager/BuildingManager.java
  8. 9
      src/engine/gameManager/GuildManager.java
  9. 56
      src/engine/gameManager/LootManager.java
  10. 62
      src/engine/gameManager/NPCManager.java
  11. 6
      src/engine/gameManager/PowersManager.java
  12. 42
      src/engine/mobileAI/MobAI.java
  13. 8
      src/engine/mobileAI/Threads/MobAIThread.java
  14. 1
      src/engine/mobileAI/Threads/Respawner.java
  15. 4
      src/engine/net/client/ClientMessagePump.java
  16. 4
      src/engine/net/client/handlers/AttackCmdMsgHandler.java
  17. 5
      src/engine/net/client/handlers/GroupInviteHandler.java
  18. 4
      src/engine/net/client/handlers/GuildCreationFinalizeHandler.java
  19. 4
      src/engine/net/client/handlers/InviteToGuildHandler.java
  20. 9
      src/engine/net/client/handlers/InviteToSubHandler.java
  21. 14
      src/engine/net/client/handlers/LeaveGuildHandler.java
  22. 2
      src/engine/net/client/handlers/MinionTrainingMsgHandler.java
  23. 6
      src/engine/net/client/handlers/MoveToPointHandler.java
  24. 401
      src/engine/net/client/handlers/ObjectActionMsgHandler.java
  25. 20
      src/engine/net/client/handlers/PetitionReceivedMsgHandler.java
  26. 2
      src/engine/net/client/handlers/RepairBuildingMsgHandler.java
  27. 1
      src/engine/net/client/handlers/RequestEnterWorldHandler.java
  28. 5
      src/engine/net/client/handlers/TransferGoldToFromBuildingMsgHandler.java
  29. 5
      src/engine/net/client/handlers/TransferItemFromEquipToInventoryHandler.java
  30. 5
      src/engine/net/client/handlers/TransferItemFromInventoryToEquipHandler.java
  31. 2
      src/engine/net/client/msg/LootMsg.java
  32. 25
      src/engine/net/client/msg/ManageNPCMsg.java
  33. 1
      src/engine/net/client/msg/MoveToPointMsg.java
  34. 5
      src/engine/net/client/msg/UpdateGoldMsg.java
  35. 32
      src/engine/objects/AbstractCharacter.java
  36. 4
      src/engine/objects/AbstractWorldObject.java
  37. 34
      src/engine/objects/CharacterSkill.java
  38. 26
      src/engine/objects/City.java
  39. 2
      src/engine/objects/Item.java
  40. 4
      src/engine/objects/ItemBase.java
  41. 2
      src/engine/objects/ItemTemplate.java
  42. 88
      src/engine/objects/Mob.java
  43. 1
      src/engine/objects/MobBase.java
  44. 8
      src/engine/objects/MobBaseStats.java
  45. 1
      src/engine/objects/Petition.java
  46. 14
      src/engine/objects/PlayerCharacter.java
  47. 3
      src/engine/objects/Portal.java
  48. 6
      src/engine/objects/Regions.java
  49. 1
      src/engine/powers/DamageShield.java
  50. 1
      src/engine/powers/effectmodifiers/DamageShieldEffectModifier.java
  51. 1
      src/engine/powers/effectmodifiers/HealthEffectModifier.java
  52. 13
      src/engine/powers/poweractions/ApplyEffectPowerAction.java
  53. 982
      src/engine/server/world/WorldServer.java

4
src/engine/devcmd/cmds/AddGoldCmd.java

@ -11,7 +11,9 @@ package engine.devcmd.cmds;
import engine.devcmd.AbstractDevCmd; import engine.devcmd.AbstractDevCmd;
import engine.gameManager.ChatManager; import engine.gameManager.ChatManager;
import engine.objects.*; import engine.objects.AbstractGameObject;
import engine.objects.Item;
import engine.objects.PlayerCharacter;
/** /**
* @author Eighty * @author Eighty

6
src/engine/devcmd/cmds/InfoCmd.java

@ -494,11 +494,11 @@ public class InfoCmd extends AbstractDevCmd {
output += newline; output += newline;
output += "No building found." + newline; output += "No building found." + newline;
} }
int max = (int)(4.882 * targetMob.level + 121.0); int max = (int) (4.882 * targetMob.level + 121.0);
if(max > 321){ if (max > 321) {
max = 321; max = 321;
} }
int min = (int)(4.469 * targetMob.level - 3.469); int min = (int) (4.469 * targetMob.level - 3.469);
output += "Min Loot Roll = " + min; output += "Min Loot Roll = " + min;
output += "Max Loot Roll = " + max; output += "Max Loot Roll = " + max;
break; break;

2
src/engine/devcmd/cmds/PrintEffectsCmd.java

@ -47,7 +47,7 @@ public class PrintEffectsCmd extends AbstractDevCmd {
String newline = "\r\n "; String newline = "\r\n ";
String output = "Effects For Character: " + tar.getName() + newline; String output = "Effects For Character: " + tar.getName() + newline;
for(String effect : tar.effects.keySet()){ for (String effect : tar.effects.keySet()) {
output += effect + newline; output += effect + newline;
} }
throwbackInfo(pc, output); throwbackInfo(pc, output);

2
src/engine/devcmd/cmds/PrintRunesCmd.java

@ -47,7 +47,7 @@ public class PrintRunesCmd extends AbstractDevCmd {
String newline = "\r\n "; String newline = "\r\n ";
String output = "Applied Runes For Character: " + ((AbstractCharacter) target).getName() + newline; String output = "Applied Runes For Character: " + ((AbstractCharacter) target).getName() + newline;
for(CharacterRune rune : ((AbstractCharacter)target).runes){ for (CharacterRune rune : ((AbstractCharacter) target).runes) {
output += rune.getRuneBaseID() + " " + rune.getRuneBase().getName() + newline; output += rune.getRuneBaseID() + " " + rune.getRuneBase().getName() + newline;
} }
throwbackInfo(pc, output); throwbackInfo(pc, output);

17
src/engine/devcmd/cmds/RegionCmd.java

@ -9,13 +9,10 @@
package engine.devcmd.cmds; package engine.devcmd.cmds;
import engine.Enum;
import engine.devcmd.AbstractDevCmd; import engine.devcmd.AbstractDevCmd;
import engine.gameManager.BuildingManager; import engine.gameManager.BuildingManager;
import engine.objects.*; import engine.objects.*;
import java.lang.reflect.Field;
public class RegionCmd extends AbstractDevCmd { public class RegionCmd extends AbstractDevCmd {
public RegionCmd() { public RegionCmd() {
@ -31,20 +28,20 @@ public class RegionCmd extends AbstractDevCmd {
output = "Target Region Information:" + newline; output = "Target Region Information:" + newline;
Building building = BuildingManager.getBuildingAtLocation(((AbstractCharacter) target).loc); Building building = BuildingManager.getBuildingAtLocation(((AbstractCharacter) target).loc);
if(building == null){ if (building == null) {
this.throwbackInfo(pc, "No Building At This Location.") ; this.throwbackInfo(pc, "No Building At This Location.");
} }
Regions region = ((AbstractCharacter)target).region; Regions region = ((AbstractCharacter) target).region;
if (region == null) { if (region == null) {
this.throwbackInfo(pc, "No Region Found."); this.throwbackInfo(pc, "No Region Found.");
return; return;
} }
if(region != null) { if (region != null) {
output += "Player Info: " + ((AbstractCharacter) target).getName() + newline; output += "Player Info: " + ((AbstractCharacter) target).getName() + newline;
output += "Region Building: " + building.getName() + newline; output += "Region Building: " + building.getName() + newline;
output += "Region Height: " + region.lerpY((AbstractCharacter)target) + newline; output += "Region Height: " + region.lerpY((AbstractCharacter) target) + newline;
output += "is Stairs: " + region.isStairs() + newline; output += "is Stairs: " + region.isStairs() + newline;
output += "is Outside: " + region.isOutside(); output += "is Outside: " + region.isOutside();
this.throwbackInfo(pc, output); this.throwbackInfo(pc, output);
} }

8
src/engine/devcmd/cmds/aiInfoCmd.java

@ -96,9 +96,9 @@ public class aiInfoCmd extends AbstractDevCmd {
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;
} }
@ -112,7 +112,7 @@ public class aiInfoCmd extends AbstractDevCmd {
if (mob.guardedCity != null) if (mob.guardedCity != null)
output += "Patrolling: " + mob.guardedCity.getCityName() + newline; output += "Patrolling: " + mob.guardedCity.getCityName() + newline;
output += "See Invis Level: " + mob.mobBase.getSeeInvis() + newline; output += "See Invis Level: " + mob.mobBase.getSeeInvis() + newline;
output += "Can Cast: " + MobAI.canCast(mob) + newline; output += "Can Cast: " + MobAI.canCast(mob) + newline;
output += "Powers:" + newline; output += "Powers:" + newline;

3
src/engine/gameManager/BuildingManager.java

@ -42,6 +42,7 @@ public enum BuildingManager {
public static HashMap<Integer, ConcurrentHashMap<Integer, BuildingFriends>> _buildingFriends = new HashMap<>(); public static HashMap<Integer, ConcurrentHashMap<Integer, BuildingFriends>> _buildingFriends = new HashMap<>();
public static HashMap<Integer, ConcurrentHashMap<Integer, Condemned>> _buildingCondemned = new HashMap<>(); public static HashMap<Integer, ConcurrentHashMap<Integer, Condemned>> _buildingCondemned = new HashMap<>();
public static HashMap<Integer, ArrayList<Vector3fImmutable>> _buildingPatrolPoints = new HashMap<>(); public static HashMap<Integer, ArrayList<Vector3fImmutable>> _buildingPatrolPoints = new HashMap<>();
public static int getAvailableSlot(Building building) { public static int getAvailableSlot(Building building) {
ArrayList<BuildingLocation> slotLocations = _slotLocations.get(building.meshUUID); ArrayList<BuildingLocation> slotLocations = _slotLocations.get(building.meshUUID);
@ -838,7 +839,7 @@ public enum BuildingManager {
// New rank means new mesh // New rank means new mesh
newMeshUUID = building.getBlueprint().getMeshForRank(building.rank); newMeshUUID = building.getBlueprint().getMeshForRank(building.rank);
if ((building.getBlueprint().getBuildingGroup() == BuildingGroup.TOL)&& (building.rank == 8)) if ((building.getBlueprint().getBuildingGroup() == BuildingGroup.TOL) && (building.rank == 8))
newMeshUUID = Realm.getRealmMesh(building.getCity()); newMeshUUID = Realm.getRealmMesh(building.getCity());
building.meshUUID = newMeshUUID; building.meshUUID = newMeshUUID;

9
src/engine/gameManager/GuildManager.java

@ -200,11 +200,12 @@ public enum GuildManager {
} }
} }
public static Boolean meetsLoreRequirements(Guild guild, PlayerCharacter player){
public static Boolean meetsLoreRequirements(Guild guild, PlayerCharacter player) {
Enum.GuildCharterType charter = guild.getGuildType(); Enum.GuildCharterType charter = guild.getGuildType();
if(charter.requiredClasses.contains(player.absPromotionClass)) if (charter.requiredClasses.contains(player.absPromotionClass))
if(charter.requiredRaces.contains(player.absRace)) if (charter.requiredRaces.contains(player.absRace))
if(charter.sexRequired.contains(player.absGender)) if (charter.sexRequired.contains(player.absGender))
return true; return true;
return false; return false;

56
src/engine/gameManager/LootManager.java

@ -80,22 +80,22 @@ public enum LootManager {
RunBootySet(_bootySetMap.get(mob.bootySet), mob, inHotzone); RunBootySet(_bootySetMap.get(mob.bootySet), mob, inHotzone);
//lastly, check mobs inventory for godly or disc runes to send a server announcement //lastly, check mobs inventory for godly or disc runes to send a server announcement
for (Item it : mob.getInventory()) { for (Item it : mob.getInventory()) {
ItemBase ib = it.getItemBase(); ItemBase ib = it.getItemBase();
if (ib == null) if (ib == null)
break; break;
ItemTemplate template = ItemTemplate.templates.get(it.getTemplateID()); ItemTemplate template = ItemTemplate.templates.get(it.getTemplateID());
if (ib.isDiscRune() || template.item_base_name.toLowerCase().contains("of the gods")) { if (ib.isDiscRune() || template.item_base_name.toLowerCase().contains("of the gods")) {
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().zoneName + " has found the " + template.item_base_name + ". Are you tough enough to take it?"); ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().zoneName + " has found the " + template.item_base_name + ". 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);
}
} }
}
} }
@ -146,7 +146,7 @@ public enum LootManager {
MobLoot outItem; MobLoot outItem;
int genRoll = ThreadLocalRandom.current().nextInt(1,100 + 1); int genRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1);
GenTableEntry selectedRow = GenTableEntry.rollTable(genTableID, genRoll, 1.0f); GenTableEntry selectedRow = GenTableEntry.rollTable(genTableID, genRoll, 1.0f);
@ -161,9 +161,9 @@ public enum LootManager {
//gets the 1-320 roll for this mob //gets the 1-320 roll for this mob
int itemTableRoll = 0; int itemTableRoll = 0;
int objectType = mob.getObjectType().ordinal(); int objectType = mob.getObjectType().ordinal();
if(mob.getObjectType().ordinal() == 52) { //52 = player character if (mob.getObjectType().ordinal() == 52) { //52 = player character
itemTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1); itemTableRoll = ThreadLocalRandom.current().nextInt(1, 320 + 1);
} else{ } else {
itemTableRoll = TableRoll(mob.level, inHotzone); itemTableRoll = TableRoll(mob.level, inHotzone);
} }
ItemTableEntry tableRow = ItemTableEntry.rollTable(itemTableId, itemTableRoll); ItemTableEntry tableRow = ItemTableEntry.rollTable(itemTableId, itemTableRoll);
@ -182,7 +182,7 @@ public enum LootManager {
outItem = new MobLoot(mob, ItemTemplate.templates.get(itemUUID), false); outItem = new MobLoot(mob, ItemTemplate.templates.get(itemUUID), false);
if(selectedRow.pModTable != 0){ if (selectedRow.pModTable != 0) {
try { try {
outItem = GeneratePrefix(mob, outItem, genTableID, genRoll, inHotzone); outItem = GeneratePrefix(mob, outItem, genTableID, genRoll, inHotzone);
outItem.flags.remove(Enum.ItemFlags.Identified); outItem.flags.remove(Enum.ItemFlags.Identified);
@ -190,7 +190,7 @@ public enum LootManager {
Logger.error("Failed to GeneratePrefix for item: " + outItem.getName()); Logger.error("Failed to GeneratePrefix for item: " + outItem.getName());
} }
} }
if(selectedRow.sModTable != 0){ if (selectedRow.sModTable != 0) {
try { try {
outItem = GenerateSuffix(mob, outItem, genTableID, genRoll, inHotzone); outItem = GenerateSuffix(mob, outItem, genTableID, genRoll, inHotzone);
outItem.flags.remove(Enum.ItemFlags.Identified); outItem.flags.remove(Enum.ItemFlags.Identified);
@ -215,9 +215,9 @@ public enum LootManager {
if (prefixTable == null) if (prefixTable == null)
return inItem; return inItem;
int prefixTableRoll = 0; int prefixTableRoll = 0;
if(mob.getObjectType().ordinal() == 52) { if (mob.getObjectType().ordinal() == 52) {
prefixTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1); prefixTableRoll = ThreadLocalRandom.current().nextInt(1, 320 + 1);
} else{ } else {
prefixTableRoll = TableRoll(mob.level, inHotzone); prefixTableRoll = TableRoll(mob.level, inHotzone);
} }
ModTableEntry prefixMod = ModTableEntry.rollTable(prefixTable.modTableID, prefixTableRoll); ModTableEntry prefixMod = ModTableEntry.rollTable(prefixTable.modTableID, prefixTableRoll);
@ -247,9 +247,9 @@ public enum LootManager {
if (suffixTable == null) if (suffixTable == null)
return inItem; return inItem;
int suffixTableRoll = 0; int suffixTableRoll = 0;
if(mob.getObjectType().ordinal() == 52) { if (mob.getObjectType().ordinal() == 52) {
suffixTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1); suffixTableRoll = ThreadLocalRandom.current().nextInt(1, 320 + 1);
} else{ } else {
suffixTableRoll = TableRoll(mob.level, inHotzone); suffixTableRoll = TableRoll(mob.level, inHotzone);
} }
ModTableEntry suffixMod = ModTableEntry.rollTable(suffixTable.modTableID, suffixTableRoll); ModTableEntry suffixMod = ModTableEntry.rollTable(suffixTable.modTableID, suffixTableRoll);
@ -332,7 +332,7 @@ public enum LootManager {
public static void GenerateEquipmentDrop(Mob mob) { public static void GenerateEquipmentDrop(Mob mob) {
if(mob.behaviourType.equals(Enum.MobBehaviourType.HamletGuard)) if (mob.behaviourType.equals(Enum.MobBehaviourType.HamletGuard))
return; // safehold guards don't drop their equipment return; // safehold guards don't drop their equipment
//do equipment here //do equipment here
int dropCount = 0; int dropCount = 0;
@ -404,7 +404,7 @@ public enum LootManager {
int genRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1); int genRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1);
GenTableEntry selectedRow = GenTableEntry.rollTable(tableID, genRoll, LootManager.NORMAL_DROP_RATE); GenTableEntry selectedRow = GenTableEntry.rollTable(tableID, genRoll, LootManager.NORMAL_DROP_RATE);
if(selectedRow == null) if (selectedRow == null)
return; return;
//roll 220-320 for the item table selection //roll 220-320 for the item table selection
@ -431,10 +431,10 @@ public enum LootManager {
//determine if the winning item needs a prefix //determine if the winning item needs a prefix
if(selectedRow.pModTable != 0){ if (selectedRow.pModTable != 0) {
int prefixRoll = ThreadLocalRandom.current().nextInt(220,320 + 1); int prefixRoll = ThreadLocalRandom.current().nextInt(220, 320 + 1);
ModTableEntry prefix = ModTableEntry.rollTable(selectedRow.pModTable, prefixRoll); ModTableEntry prefix = ModTableEntry.rollTable(selectedRow.pModTable, prefixRoll);
if(prefix != null) if (prefix != null)
winnings.addPermanentEnchantment(prefix.action, 0, prefix.level, true); winnings.addPermanentEnchantment(prefix.action, 0, prefix.level, true);
} }

62
src/engine/gameManager/NPCManager.java

@ -247,30 +247,30 @@ public enum NPCManager {
} }
} }
public static void applyGuardStanceModifiers(Mob guard){ public static void applyGuardStanceModifiers(Mob guard) {
float damageModifier = 1; float damageModifier = 1;
float attackRatingModifier = 1; float attackRatingModifier = 1;
float defenseModifier = 1; float defenseModifier = 1;
float attackSpeedModifier = 1; float attackSpeedModifier = 1;
float powerDamageModifier = 1; float powerDamageModifier = 1;
//handle stance modifiers for guard mob //handle stance modifiers for guard mob
if(guard.agentType.equals(Enum.AIAgentType.GUARDWALLARCHER)){ if (guard.agentType.equals(Enum.AIAgentType.GUARDWALLARCHER)) {
//apply rogue bonuses //apply rogue bonuses
attackRatingModifier += 0.5f; attackRatingModifier += 0.5f;
defenseModifier += 0.5f; defenseModifier += 0.5f;
damageModifier += 0.5f; damageModifier += 0.5f;
attackSpeedModifier -= 0.36f; attackSpeedModifier -= 0.36f;
}else { } else {
Integer contractID; Integer contractID;
if (guard.agentType.equals(Enum.AIAgentType.GUARDMINION)) { if (guard.agentType.equals(Enum.AIAgentType.GUARDMINION)) {
contractID = guard.guardCaptain.contract.getContractID(); contractID = guard.guardCaptain.contract.getContractID();
} else{ } else {
contractID = guard.contract.getContractID(); contractID = guard.contract.getContractID();
} }
if (Enum.MinionType.ContractToMinionMap.get(contractID) != null && Enum.MinionType.ContractToMinionMap.get(contractID).isMage()){ if (Enum.MinionType.ContractToMinionMap.get(contractID) != null && Enum.MinionType.ContractToMinionMap.get(contractID).isMage()) {
//apply mage offensive Stance //apply mage offensive Stance
powerDamageModifier += 0.5f; powerDamageModifier += 0.5f;
} else{ } else {
//apply fighter offensive stance //apply fighter offensive stance
damageModifier += 0.5f; damageModifier += 0.5f;
attackSpeedModifier -= 0.36f; attackSpeedModifier -= 0.36f;
@ -289,7 +289,7 @@ public enum NPCManager {
//TODO figure out how to apply +50% powerdamage to mage guards //TODO figure out how to apply +50% powerdamage to mage guards
} }
public static void setDamageAndSpeedForGuard(Mob guard){ public static void setDamageAndSpeedForGuard(Mob guard) {
float rankModifier = 1 + (guard.getRank() * 0.1f); float rankModifier = 1 + (guard.getRank() * 0.1f);
int primaryStat = 0; int primaryStat = 0;
@ -324,17 +324,17 @@ public enum NPCManager {
guard.rangeHandOne = weapon.template.item_weapon_max_range; guard.rangeHandOne = weapon.template.item_weapon_max_range;
} else { } else {
primaryStat = guard.getStatStrCurrent(); primaryStat = guard.getStatStrCurrent();
guard.minDamageHandOne = (int)((guard.mobBase.getDamageMin()) * rankModifier) + primaryStat; guard.minDamageHandOne = (int) ((guard.mobBase.getDamageMin()) * rankModifier) + primaryStat;
guard.maxDamageHandOne = (int)((guard.mobBase.getDamageMax()) * rankModifier) + primaryStat; guard.maxDamageHandOne = (int) ((guard.mobBase.getDamageMax()) * rankModifier) + primaryStat;
guard.speedHandOne = 30.0f; guard.speedHandOne = 30.0f;
guard.rangeHandOne = 3; guard.rangeHandOne = 3;
} }
} }
} }
public static void setDefenseForGuard(Mob guard){ public static void setDefenseForGuard(Mob guard) {
int dexterity = guard.getStatDexCurrent(); int dexterity = guard.getStatDexCurrent();
if(dexterity < 1) if (dexterity < 1)
dexterity = 1; dexterity = 1;
int baseDef = guard.mobBase.getDefenseRating(); int baseDef = guard.mobBase.getDefenseRating();
int armorDefense = 0; int armorDefense = 0;
@ -355,29 +355,29 @@ public enum NPCManager {
guard.atrHandOne = baseAtr; guard.atrHandOne = baseAtr;
} }
public static void setMaxHealthForGuard(Mob guard){ public static void setMaxHealthForGuard(Mob guard) {
//values derived fom reading memory address for health on client when selecting player guards //values derived fom reading memory address for health on client when selecting player guards
switch(guard.getRank()){ switch (guard.getRank()) {
default: default:
guard.healthMax = 750; //rank 1 guard.healthMax = 750; //rank 1
break; break;
case 2: case 2:
guard.healthMax = 2082; guard.healthMax = 2082;
break; break;
case 3: case 3:
guard.healthMax = 2740; guard.healthMax = 2740;
break; break;
case 4: case 4:
guard.healthMax = 3414; guard.healthMax = 3414;
break; break;
case 5: case 5:
guard.healthMax = 4080; guard.healthMax = 4080;
break; break;
case 6: case 6:
guard.healthMax = 4746; guard.healthMax = 4746;
break; break;
case 7: case 7:
guard.healthMax = 5412; guard.healthMax = 5412;
break; break;
} }
} }
@ -422,7 +422,7 @@ public enum NPCManager {
} }
} }
public static void applyEquipmentResists(Mob mob){ public static void applyEquipmentResists(Mob mob) {
if (mob.charItemManager.equipped.isEmpty()) if (mob.charItemManager.equipped.isEmpty())
return; return;
@ -438,18 +438,18 @@ public enum NPCManager {
public static void applyMobbaseSkill(Mob mob) { public static void applyMobbaseSkill(Mob mob) {
SkillsBase baseSkill = DbManager.SkillsBaseQueries.GET_BASE_BY_TOKEN(mob.mobBase.getMobBaseStats().getBaseSkill()); SkillsBase baseSkill = DbManager.SkillsBaseQueries.GET_BASE_BY_TOKEN(mob.mobBase.getMobBaseStats().getBaseSkill());
if(baseSkill != null) if (baseSkill != null)
mob.getSkills().put(baseSkill.getName(),new CharacterSkill(baseSkill,mob,mob.mobBase.getMobBaseStats().getBaseSkillAmount())); mob.getSkills().put(baseSkill.getName(), new CharacterSkill(baseSkill, mob, mob.mobBase.getMobBaseStats().getBaseSkillAmount()));
} }
public static void applyRuneSkills(Mob mob, int runeID){ public static void applyRuneSkills(Mob mob, int runeID) {
//load mob skill adjustments from mobbase rune //load mob skill adjustments from mobbase rune
if(PowersManager._allRuneSkillAdjusts.containsKey(runeID)) if (PowersManager._allRuneSkillAdjusts.containsKey(runeID))
for(RuneSkillAdjustEntry entry : PowersManager._allRuneSkillAdjusts.get(runeID)) { for (RuneSkillAdjustEntry entry : PowersManager._allRuneSkillAdjusts.get(runeID)) {
if(SkillsBase.getFromCache(entry.skill_type) == null) if (SkillsBase.getFromCache(entry.skill_type) == null)
SkillsBase.putInCache(DbManager.SkillsBaseQueries.GET_BASE_BY_NAME(entry.skill_type)); SkillsBase.putInCache(DbManager.SkillsBaseQueries.GET_BASE_BY_NAME(entry.skill_type));
SkillsBase skillBase = SkillsBase.getFromCache(entry.skill_type); SkillsBase skillBase = SkillsBase.getFromCache(entry.skill_type);
if(skillBase == null) if (skillBase == null)
continue; continue;
if (entry.level <= mob.level) if (entry.level <= mob.level)
if (mob.skills.containsKey(entry.name) == false) if (mob.skills.containsKey(entry.name) == false)
@ -459,15 +459,15 @@ public enum NPCManager {
} }
} }
public static void applyRunesForNPC(NPC npc){ public static void applyRunesForNPC(NPC npc) {
npc.runes = new ArrayList<>(); npc.runes = new ArrayList<>();
RuneBase shopkeeperBase = RuneBase.getRuneBase(252620); RuneBase shopkeeperBase = RuneBase.getRuneBase(252620);
CharacterRune shopkeeper = new CharacterRune(shopkeeperBase,npc.getObjectUUID()); CharacterRune shopkeeper = new CharacterRune(shopkeeperBase, npc.getObjectUUID());
npc.runes.add(shopkeeper); npc.runes.add(shopkeeper);
if(NPCManager._runeSetMap.containsKey(npc.runeSetID)) { if (NPCManager._runeSetMap.containsKey(npc.runeSetID)) {
for (int runeID : _runeSetMap.get(npc.runeSetID)) { for (int runeID : _runeSetMap.get(npc.runeSetID)) {
RuneBase rb = RuneBase.getRuneBase(runeID); RuneBase rb = RuneBase.getRuneBase(runeID);
if(rb != null) { if (rb != null) {
CharacterRune toApply = new CharacterRune(rb, npc.getObjectUUID()); CharacterRune toApply = new CharacterRune(rb, npc.getObjectUUID());
npc.runes.add(toApply); npc.runes.add(toApply);
} }

6
src/engine/gameManager/PowersManager.java

@ -170,11 +170,11 @@ public enum PowersManager {
public static void usePower(final PerformActionMsg msg, ClientConnection origin, public static void usePower(final PerformActionMsg msg, ClientConnection origin,
boolean sendCastToSelf) { boolean sendCastToSelf) {
if(ConfigManager.MB_RULESET.getValue() == "LORE") { if (ConfigManager.MB_RULESET.getValue() == "LORE") {
PowersBase pb = PowersManager.powersBaseByToken.get(msg.getPowerUsedID()); PowersBase pb = PowersManager.powersBaseByToken.get(msg.getPowerUsedID());
PlayerCharacter caster = origin.getPlayerCharacter(); PlayerCharacter caster = origin.getPlayerCharacter();
PlayerCharacter target = PlayerCharacter.getFromCache(msg.getTargetID()); PlayerCharacter target = PlayerCharacter.getFromCache(msg.getTargetID());
if(pb != null && pb.isHarmful == false) { if (pb != null && pb.isHarmful == false) {
if (caster.guild.equals(Guild.getErrantGuild())) if (caster.guild.equals(Guild.getErrantGuild()))
return; return;
@ -1271,7 +1271,7 @@ public enum PowersManager {
return; return;
} }
if(ConfigManager.MB_RULESET.getValue() == "LORE") { if (ConfigManager.MB_RULESET.getValue() == "LORE") {
if (pc.guild.getGuildType().equals(target.guild.getGuildType()) == false) { if (pc.guild.getGuildType().equals(target.guild.getGuildType()) == false) {
ChatManager.chatInfoError(pc, ChatManager.chatInfoError(pc,
"Cannot summon player outside your charter."); "Cannot summon player outside your charter.");

42
src/engine/mobileAI/MobAI.java

@ -323,7 +323,7 @@ public class MobAI {
if (mob.isPlayerGuard() == true) { if (mob.isPlayerGuard() == true) {
if(mob.agentType.equals(Enum.AIAgentType.GUARDWALLARCHER)) if (mob.agentType.equals(Enum.AIAgentType.GUARDWALLARCHER))
return false; //wall archers don't cast return false; //wall archers don't cast
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION)) if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION))
contractID = mob.guardCaptain.contract.getContractID(); contractID = mob.guardCaptain.contract.getContractID();
@ -574,10 +574,10 @@ public class MobAI {
//no players loaded, no need to proceed unless it's a player guard //no players loaded, no need to proceed unless it's a player guard
boolean bypassLoadedPlayerCheck = false; boolean bypassLoadedPlayerCheck = false;
if(mob.isPlayerGuard() || mob.isSiege()) { if (mob.isPlayerGuard() || mob.isSiege()) {
bypassLoadedPlayerCheck = true; bypassLoadedPlayerCheck = true;
if(mob.combatTarget != null && mob.combatTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) if (mob.combatTarget != null && mob.combatTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter))
if(mob.combatTarget.loc.distanceSquared(mob.loc) > 10000) if (mob.combatTarget.loc.distanceSquared(mob.loc) > 10000)
mob.setCombatTarget(null); mob.setCombatTarget(null);
} }
@ -845,7 +845,7 @@ public class MobAI {
try { try {
if (mob.getCombatTarget() != null && mob.getRange() * mob.getRange() >= MobAIThread.AI_BASE_AGGRO_RANGE * 0.5f) if (mob.getCombatTarget() != null && mob.getRange() * mob.getRange() >= MobAIThread.AI_BASE_AGGRO_RANGE * 0.5f)
return; return;
if (mob.isPlayerGuard() && !mob.despawned) { if (mob.isPlayerGuard() && !mob.despawned) {
@ -888,12 +888,12 @@ public class MobAI {
try { try {
if(mob.getTimestamps().containsKey("lastChase") == false) if (mob.getTimestamps().containsKey("lastChase") == false)
mob.getTimestamps().put("lastChase",System.currentTimeMillis()); mob.getTimestamps().put("lastChase", System.currentTimeMillis());
else if(System.currentTimeMillis() < mob.getTimestamps().get("lastChase").longValue() + (750 + ThreadLocalRandom.current().nextInt(0,500))) else if (System.currentTimeMillis() < mob.getTimestamps().get("lastChase").longValue() + (750 + ThreadLocalRandom.current().nextInt(0, 500)))
return; return;
mob.getTimestamps().put("lastChase",System.currentTimeMillis()); mob.getTimestamps().put("lastChase", System.currentTimeMillis());
if (mob.getRange() * mob.getRange() <= mob.loc.distanceSquared(mob.combatTarget.loc)) { if (mob.getRange() * mob.getRange() <= mob.loc.distanceSquared(mob.combatTarget.loc)) {
if (mob.getRange() > 15) { if (mob.getRange() > 15) {
@ -974,10 +974,10 @@ public class MobAI {
} }
} }
if(mob.behaviourType.canRoam) if (mob.behaviourType.canRoam)
CheckMobMovement(mob);//all guards that can move check to move CheckMobMovement(mob);//all guards that can move check to move
if(mob.combatTarget != null) if (mob.combatTarget != null)
CheckForAttack(mob); //only check to attack if combat target is not null CheckForAttack(mob); //only check to attack if combat target is not null
} catch (Exception e) { } catch (Exception e) {
@ -1128,21 +1128,21 @@ public class MobAI {
return; return;
} }
} }
if (mob.getCombatTarget() == null) { if (mob.getCombatTarget() == null) {
//look for siege equipment to aggro if no players found to aggro //look for siege equipment to aggro if no players found to aggro
HashSet<AbstractWorldObject> awoList = WorldGrid.getObjectsInRangePartial(mob, MobAIThread.AI_BASE_AGGRO_RANGE, MBServerStatics.MASK_SIEGE); HashSet<AbstractWorldObject> awoList = WorldGrid.getObjectsInRangePartial(mob, MobAIThread.AI_BASE_AGGRO_RANGE, MBServerStatics.MASK_SIEGE);
for (AbstractWorldObject awoMob : awoList) { for (AbstractWorldObject awoMob : awoList) {
Mob aggroMob = (Mob) awoMob; Mob aggroMob = (Mob) awoMob;
if(GuardCanAggro(mob,aggroMob)) { if (GuardCanAggro(mob, aggroMob)) {
mob.setCombatTarget(aggroMob); mob.setCombatTarget(aggroMob);
return; return;
}
} }
}
} }
} catch (Exception e) { } catch (Exception e) {

8
src/engine/mobileAI/Threads/MobAIThread.java

@ -1,14 +1,13 @@
package engine.mobileAI.Threads; package engine.mobileAI.Threads;
import engine.gameManager.ConfigManager; import engine.gameManager.ConfigManager;
import engine.mobileAI.MobAI;
import engine.gameManager.ZoneManager; import engine.gameManager.ZoneManager;
import engine.mobileAI.MobAI;
import engine.objects.Mob; import engine.objects.Mob;
import engine.objects.Zone; import engine.objects.Zone;
import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
public class MobAIThread implements Runnable{ public class MobAIThread implements Runnable {
public static int AI_BASE_AGGRO_RANGE = 60; public static int AI_BASE_AGGRO_RANGE = 60;
public static int AI_DROP_AGGRO_RANGE = 60; public static int AI_DROP_AGGRO_RANGE = 60;
public static int AI_PULSE_MOB_THRESHOLD = 200; public static int AI_PULSE_MOB_THRESHOLD = 200;
@ -25,7 +24,7 @@ public class MobAIThread implements Runnable{
public void run() { public void run() {
//cache config value for mobile casting delay //cache config value for mobile casting delay
AI_CAST_FREQUENCY = Float.parseFloat(ConfigManager.MB_AI_CAST_FREQUENCY.getValue()); AI_CAST_FREQUENCY = Float.parseFloat(ConfigManager.MB_AI_CAST_FREQUENCY.getValue());
AI_BASE_AGGRO_RANGE = (int)(60 * Float.parseFloat(ConfigManager.MB_AI_AGGRO_RANGE.getValue())); AI_BASE_AGGRO_RANGE = (int) (60 * Float.parseFloat(ConfigManager.MB_AI_AGGRO_RANGE.getValue()));
while (true) { while (true) {
for (Zone zone : ZoneManager.getAllZones()) { for (Zone zone : ZoneManager.getAllZones()) {
@ -42,6 +41,7 @@ public class MobAIThread implements Runnable{
} }
} }
} }
public static void startAIThread() { public static void startAIThread() {
Thread aiThread; Thread aiThread;
aiThread = new Thread(new MobAIThread()); aiThread = new Thread(new MobAIThread());

1
src/engine/mobileAI/Threads/Respawner.java

@ -8,6 +8,7 @@
package engine.mobileAI.Threads; package engine.mobileAI.Threads;
import engine.objects.Mob; import engine.objects.Mob;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;

4
src/engine/net/client/ClientMessagePump.java

@ -1070,10 +1070,10 @@ public class ClientMessagePump implements NetMsgHandler {
return; return;
//CombatManager.setAttackTarget(msg, conn); //CombatManager.setAttackTarget(msg, conn);
if(msg.getTargetType() == GameObjectType.Building.ordinal()){ if (msg.getTargetType() == GameObjectType.Building.ordinal()) {
conn.getPlayerCharacter().getPet().setCombatTarget(PlayerCharacter.getPlayerCharacter(msg.getTargetID())); conn.getPlayerCharacter().getPet().setCombatTarget(PlayerCharacter.getPlayerCharacter(msg.getTargetID()));
} }
switch(msg.getTargetType()) { switch (msg.getTargetType()) {
case 53: //player character case 53: //player character
conn.getPlayerCharacter().getPet().setCombatTarget(PlayerCharacter.getPlayerCharacter(msg.getTargetID())); conn.getPlayerCharacter().getPet().setCombatTarget(PlayerCharacter.getPlayerCharacter(msg.getTargetID()));
break; break;

4
src/engine/net/client/handlers/AttackCmdMsgHandler.java

@ -49,7 +49,7 @@ public class AttackCmdMsgHandler extends AbstractClientMsgHandler {
targetType = Enum.GameObjectType.values()[msg.getTargetType()]; targetType = Enum.GameObjectType.values()[msg.getTargetType()];
switch(targetType){ switch (targetType) {
case Mob: case Mob:
target = Mob.getMob(msg.getTargetID()); target = Mob.getMob(msg.getTargetID());
break; break;
@ -63,7 +63,7 @@ public class AttackCmdMsgHandler extends AbstractClientMsgHandler {
target = NPC.getNPC(msg.getTargetID()); target = NPC.getNPC(msg.getTargetID());
break; break;
} }
if(target == null) { if (target == null) {
playerCharacter.setCombatTarget(null); playerCharacter.setCombatTarget(null);
return true; // cannot attack a null target return true; // cannot attack a null target
} }

5
src/engine/net/client/handlers/GroupInviteHandler.java

@ -14,7 +14,6 @@ import engine.Enum.GameObjectType;
import engine.exception.MsgSendException; import engine.exception.MsgSendException;
import engine.gameManager.ConfigManager; import engine.gameManager.ConfigManager;
import engine.gameManager.GroupManager; import engine.gameManager.GroupManager;
import engine.gameManager.GuildManager;
import engine.gameManager.SessionManager; import engine.gameManager.SessionManager;
import engine.net.Dispatch; import engine.net.Dispatch;
import engine.net.DispatchMessage; import engine.net.DispatchMessage;
@ -106,8 +105,8 @@ public class GroupInviteHandler extends AbstractClientMsgHandler {
if (target.isIgnoringPlayer(source)) if (target.isIgnoringPlayer(source))
return false; return false;
if(ConfigManager.MB_RULESET.getValue() == "LORE") { if (ConfigManager.MB_RULESET.getValue() == "LORE") {
if(source.guild.equals(Guild.getErrantGuild())) if (source.guild.equals(Guild.getErrantGuild()))
return false; return false;
if (source.guild.getGuildType() != null) { if (source.guild.getGuildType() != null) {

4
src/engine/net/client/handlers/GuildCreationFinalizeHandler.java

@ -26,7 +26,9 @@ import engine.net.client.msg.ClientNetMsg;
import engine.net.client.msg.ErrorPopupMsg; import engine.net.client.msg.ErrorPopupMsg;
import engine.net.client.msg.guild.GuildCreationFinalizeMsg; import engine.net.client.msg.guild.GuildCreationFinalizeMsg;
import engine.net.client.msg.guild.GuildInfoMsg; import engine.net.client.msg.guild.GuildInfoMsg;
import engine.objects.*; import engine.objects.Guild;
import engine.objects.Item;
import engine.objects.PlayerCharacter;
import engine.util.StringUtils; import engine.util.StringUtils;
public class GuildCreationFinalizeHandler extends AbstractClientMsgHandler { public class GuildCreationFinalizeHandler extends AbstractClientMsgHandler {

4
src/engine/net/client/handlers/InviteToGuildHandler.java

@ -125,9 +125,9 @@ public class InviteToGuildHandler extends AbstractClientMsgHandler {
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 135);// you do not meet the level required for this SWORN guild ErrorPopupMsg.sendErrorPopup(sourcePlayer, 135);// you do not meet the level required for this SWORN guild
return true; return true;
} }
if(ConfigManager.MB_RULESET.getValue() == "LORE") { if (ConfigManager.MB_RULESET.getValue() == "LORE") {
if (GuildManager.meetsLoreRequirements(sourcePlayer.guild, targetPlayer) == false) { if (GuildManager.meetsLoreRequirements(sourcePlayer.guild, targetPlayer) == false) {
ChatManager.chatGuildError(sourcePlayer,targetPlayer.getFirstName() + " does not meet charter requirements!"); ChatManager.chatGuildError(sourcePlayer, targetPlayer.getFirstName() + " does not meet charter requirements!");
return true; return true;
} }
} }

9
src/engine/net/client/handlers/InviteToSubHandler.java

@ -12,7 +12,10 @@ package engine.net.client.handlers;
import engine.Enum; import engine.Enum;
import engine.Enum.GameObjectType; import engine.Enum.GameObjectType;
import engine.exception.MsgSendException; import engine.exception.MsgSendException;
import engine.gameManager.*; import engine.gameManager.ChatManager;
import engine.gameManager.ConfigManager;
import engine.gameManager.DbManager;
import engine.gameManager.SessionManager;
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;
@ -109,8 +112,8 @@ public class InviteToSubHandler extends AbstractClientMsgHandler {
sendChat(source, "This Guild can't be subbed."); sendChat(source, "This Guild can't be subbed.");
return true; return true;
} }
if(ConfigManager.MB_RULESET.getValue() == "LORE") { if (ConfigManager.MB_RULESET.getValue() == "LORE") {
if (source.guild.getGuildType().equals(target.guild.getGuildType()) == false){ if (source.guild.getGuildType().equals(target.guild.getGuildType()) == false) {
sendChat(source, "You Must Be The Same Charter To Form A Nation."); sendChat(source, "You Must Be The Same Charter To Form A Nation.");
return true; return true;
} }

14
src/engine/net/client/handlers/LeaveGuildHandler.java

@ -11,13 +11,19 @@ package engine.net.client.handlers;
import engine.Enum.GuildHistoryType; import engine.Enum.GuildHistoryType;
import engine.exception.MsgSendException; import engine.exception.MsgSendException;
import engine.gameManager.*; import engine.gameManager.ChatManager;
import engine.gameManager.ConfigManager;
import engine.gameManager.GroupManager;
import engine.gameManager.SessionManager;
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.msg.ClientNetMsg; import engine.net.client.msg.ClientNetMsg;
import engine.net.client.msg.guild.LeaveGuildMsg; import engine.net.client.msg.guild.LeaveGuildMsg;
import engine.objects.*; import engine.objects.Guild;
import engine.objects.GuildStatusController;
import engine.objects.Mine;
import engine.objects.PlayerCharacter;
public class LeaveGuildHandler extends AbstractClientMsgHandler { public class LeaveGuildHandler extends AbstractClientMsgHandler {
@ -61,8 +67,8 @@ public class LeaveGuildHandler extends AbstractClientMsgHandler {
ChatManager.chatGuildInfo(oldGuild, playerCharacter.getFirstName() + " has left the guild."); ChatManager.chatGuildInfo(oldGuild, playerCharacter.getFirstName() + " has left the guild.");
oldGuild.removePlayer(playerCharacter, GuildHistoryType.LEAVE); oldGuild.removePlayer(playerCharacter, GuildHistoryType.LEAVE);
if(ConfigManager.MB_RULESET.getValue() == "LORE") { if (ConfigManager.MB_RULESET.getValue() == "LORE") {
if(GroupManager.getGroup(playerCharacter) != null) if (GroupManager.getGroup(playerCharacter) != null)
GroupManager.getGroup(playerCharacter).removeGroupMember(playerCharacter); GroupManager.getGroup(playerCharacter).removeGroupMember(playerCharacter);
} }
// Send message back to client // Send message back to client

2
src/engine/net/client/handlers/MinionTrainingMsgHandler.java

@ -70,7 +70,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
DbManager.removeFromCache(toRemove); DbManager.removeFromCache(toRemove);
if(toRemove.guardCaptain.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) { if (toRemove.guardCaptain.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
PlayerCharacter petOwner = (PlayerCharacter) toRemove.guardCaptain; PlayerCharacter petOwner = (PlayerCharacter) toRemove.guardCaptain;
if (petOwner != null) { if (petOwner != null) {

6
src/engine/net/client/handlers/MoveToPointHandler.java

@ -9,14 +9,12 @@
package engine.net.client.handlers; package engine.net.client.handlers;
import engine.Enum;
import engine.exception.MsgSendException; import engine.exception.MsgSendException;
import engine.gameManager.BuildingManager;
import engine.gameManager.MovementManager; import engine.gameManager.MovementManager;
import engine.net.client.ClientConnection; import engine.net.client.ClientConnection;
import engine.net.client.msg.ClientNetMsg; import engine.net.client.msg.ClientNetMsg;
import engine.net.client.msg.MoveToPointMsg; import engine.net.client.msg.MoveToPointMsg;
import engine.objects.*; import engine.objects.PlayerCharacter;
public class MoveToPointHandler extends AbstractClientMsgHandler { public class MoveToPointHandler extends AbstractClientMsgHandler {
@ -29,7 +27,7 @@ public class MoveToPointHandler extends AbstractClientMsgHandler {
ClientConnection origin) throws MsgSendException { ClientConnection origin) throws MsgSendException {
MoveToPointMsg msg = (MoveToPointMsg) baseMsg; MoveToPointMsg msg = (MoveToPointMsg) baseMsg;
PlayerCharacter pc = origin.getPlayerCharacter(); PlayerCharacter pc = origin.getPlayerCharacter();
if(pc == null) if (pc == null)
return true; return true;
MovementManager.movement(msg, pc); MovementManager.movement(msg, pc);

401
src/engine/net/client/handlers/ObjectActionMsgHandler.java

@ -30,6 +30,7 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
public ObjectActionMsgHandler() { public ObjectActionMsgHandler() {
super(ObjectActionMsg.class); super(ObjectActionMsg.class);
} }
@Override @Override
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException { protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
@ -79,235 +80,235 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
int uuid = item.templateID; int uuid = item.templateID;
switch (item.template.item_type) { switch (item.template.item_type) {
case DEED: //buildings
//Call add building screen here, ib.getUseID() get's building ID
//if inside player city, center loc on tol. otherwise center on player.
Vector3fImmutable loc = player.getLoc();
Zone zone = ZoneManager.findSmallestZone(player.getLoc());
if (zone != null) { case DEED: //buildings
if (zone.guild_zone) { //Call add building screen here, ib.getUseID() get's building ID
loc = zone.getLoc();
}
}
PlaceAssetMsg pam = new PlaceAssetMsg(); //if inside player city, center loc on tol. otherwise center on player.
pam.setActionType(2); Vector3fImmutable loc = player.getLoc();
pam.setContractID(item.getObjectUUID()); Zone zone = ZoneManager.findSmallestZone(player.getLoc());
pam.setX(loc.getX() + 64); //offset grid from tol
pam.setY(loc.getY());
pam.setZ(loc.getZ() + 64); //offset grid from tol
pam.addPlacementInfo(item.template.deed_structure_id);
dispatch = Dispatch.borrow(player, pam); if (zone != null) {
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY); if (zone.guild_zone) {
loc = zone.getLoc();
//itemMan.consume(item); //temporary fix for dupe.. TODO Make Item Unusable after This message is sent.
break;
case FURNITUREDEED: //furniture
//Call add furniture screen here. ib.getUseID() get's furniture ID
break;
case OFFERING:
long shrineCompID = comps.get(1);
Building shrineBuilding = BuildingManager.getBuilding((int) shrineCompID);
if (shrineBuilding == null) {
return true;
}
if (shrineBuilding.getBlueprint() != null && shrineBuilding.getBlueprint().getBuildingGroup() != engine.Enum.BuildingGroup.SHRINE) {
return true;
}
if (shrineBuilding.getRank() == -1) {
return true;
}
Shrine shrine = Shrine.shrinesByBuildingUUID.get(shrineBuilding.getObjectUUID());
if (shrine == null) {
return true;
} }
}
if (shrine.addFavor(player, item)) {
shrineBuilding.addEffectBit(1000000 << 2); PlaceAssetMsg pam = new PlaceAssetMsg();
shrineBuilding.updateEffects(); pam.setActionType(2);
shrineBuilding.removeEffectBit(1000000 << 2); pam.setContractID(item.getObjectUUID());
pam.setX(loc.getX() + 64); //offset grid from tol
pam.setY(loc.getY());
pam.setZ(loc.getZ() + 64); //offset grid from tol
pam.addPlacementInfo(item.template.deed_structure_id);
dispatch = Dispatch.borrow(player, pam);
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
//itemMan.consume(item); //temporary fix for dupe.. TODO Make Item Unusable after This message is sent.
break;
case FURNITUREDEED: //furniture
//Call add furniture screen here. ib.getUseID() get's furniture ID
break;
case OFFERING:
long shrineCompID = comps.get(1);
Building shrineBuilding = BuildingManager.getBuilding((int) shrineCompID);
if (shrineBuilding == null) {
return true;
}
if (shrineBuilding.getBlueprint() != null && shrineBuilding.getBlueprint().getBuildingGroup() != engine.Enum.BuildingGroup.SHRINE) {
return true;
}
if (shrineBuilding.getRank() == -1) {
return true;
}
Shrine shrine = Shrine.shrinesByBuildingUUID.get(shrineBuilding.getObjectUUID());
if (shrine == null) {
return true;
}
if (shrine.addFavor(player, item)) {
shrineBuilding.addEffectBit(1000000 << 2);
shrineBuilding.updateEffects();
shrineBuilding.removeEffectBit(1000000 << 2);
}
break;
case REALMCHARTER:
int charterType = 0;
switch (uuid) {
case 910020:
charterType = 762228431;
break;
case 910021:
charterType = -15978914;
break;
case 910022:
charterType = -600065291;
break;
}
if (Realm.claimRealm(player, charterType) == true) {
itemMan.consume(item);
}
break;
case WAND: //rod of command
long compID = comps.get(1);
int objectType = AbstractWorldObject.extractTypeID(compID).ordinal();
Mob toCommand;
if (objectType == engine.Enum.GameObjectType.Mob.ordinal()) {
toCommand = Mob.getFromCache((int) compID);
} //Only Command Mob Types.
else {
return true;
}
if (toCommand == null) {
return true;
}
if (!toCommand.isSiege())
return true;
if (player.commandSiegeMinion(toCommand)) {
itemMan.consume(item);
}
break;
//ANNIVERSERY GIFT
case TREASURE:
// *** Disabled for now: Needs bootyset created
//if (ib.getUUID() == 971012) {
// int random = ThreadLocalRandom.current().nextInt(ItemBase.AnniverseryGifts.size());
// int annyID = ItemBase.AnniverseryGifts.get(random);
// ItemBase annyIB = ItemBase.getItemBase(annyID);
// if (annyIB != null) {
// Item gift = MobLoot.createItemForPlayer(player, annyIB);
// if (gift != null) {
// itemMan.addItemToInventory(gift);
// itemMan.consume(item);
// }
// }
// break;
//}
LootManager.peddleFate(player, item);
break;
case BUCKET: //water bucket
case POTION: //potions, tears of saedron
case SCROLL: //runes, petition, warrant, scrolls
if (uuid > 3000 && uuid < 3050) { //Discipline Runes
if (ApplyRuneMsg.applyRune(uuid, origin, player)) {
itemMan.consume(item);
} }
break; break;
} else if (uuid > 249999 && uuid < 250123) { //stat and mastery runes
case REALMCHARTER: if (ApplyRuneMsg.applyRune(uuid, origin, player)) {
int charterType = 0; itemMan.consume(item);
switch (uuid) {
case 910020:
charterType = 762228431;
break;
case 910021:
charterType = -15978914;
break;
case 910022:
charterType = -600065291;
break;
} }
if (Realm.claimRealm(player, charterType) == true) { break;
} else if (uuid > 250114 && uuid < 250123) { //mastery runes
if (ApplyRuneMsg.applyRune(uuid, origin, player)) {
itemMan.consume(item); itemMan.consume(item);
} }
break; break;
case WAND: //rod of command } else if (uuid > 252122 && uuid < 252128) { //mastery runes
long compID = comps.get(1); if (ApplyRuneMsg.applyRune(uuid, origin, player)) {
itemMan.consume(item);
int objectType = AbstractWorldObject.extractTypeID(compID).ordinal();
Mob toCommand;
if (objectType == engine.Enum.GameObjectType.Mob.ordinal()) {
toCommand = Mob.getFromCache((int) compID);
} //Only Command Mob Types.
else {
return true;
} }
break;
} else if (uuid > 680069 && uuid < 680074) //Handle Charter, Deed, Petition, Warrant here
{
break;
} else if (uuid > 910010 && uuid < 910019) {
if (toCommand == null) { int rank = uuid - 910010;
return true;
}
if (!toCommand.isSiege()) if (rank < 1 || rank > 8) {
ChatManager.chatSystemError(player, "Invalid Rank for bane scroll!");
return true; return true;
}
// Only one banestone at a time
lock.writeLock().lock();
if (player.commandSiegeMinion(toCommand)) { try {
itemMan.consume(item); if (Bane.summonBanestone(player, origin, rank) == true)
itemMan.consume(item);
} finally {
lock.writeLock().unlock();
} }
break; break;
//ANNIVERSERY GIFT } else if (uuid == 910010) { //tears of saedron
case TREASURE: if (comps.size() > 1) {
// *** Disabled for now: Needs bootyset created AbstractCharacter.removeRune(player, origin, comps.get(1).intValue());
}
//if (ib.getUUID() == 971012) {
// int random = ThreadLocalRandom.current().nextInt(ItemBase.AnniverseryGifts.size());
// int annyID = ItemBase.AnniverseryGifts.get(random);
// ItemBase annyIB = ItemBase.getItemBase(annyID);
// if (annyIB != null) {
// Item gift = MobLoot.createItemForPlayer(player, annyIB);
// if (gift != null) {
// itemMan.addItemToInventory(gift);
// itemMan.consume(item);
// }
// }
// break;
//}
LootManager.peddleFate(player, item);
break; break;
} else if ((byte) item.chargesRemaining > 0) {
case BUCKET: //water bucket ArrayList<Long> tarList = msg.getTargetCompID();
case POTION: //potions, tears of saedron AbstractWorldObject target = player;
if (tarList.size() > 1) {
case SCROLL: //runes, petition, warrant, scrolls long tarID = tarList.get(1);
if (uuid > 3000 && uuid < 3050) { //Discipline Runes if (tarID != 0) {
if (ApplyRuneMsg.applyRune(uuid, origin, player)) { AbstractGameObject tarAgo = AbstractGameObject.getFromTypeAndID(tarID);
itemMan.consume(item); if (tarAgo != null && tarAgo instanceof AbstractWorldObject) {
} target = (AbstractWorldObject) tarAgo;
break;
} else if (uuid > 249999 && uuid < 250123) { //stat and mastery runes
if (ApplyRuneMsg.applyRune(uuid, origin, player)) {
itemMan.consume(item);
}
break;
} else if (uuid > 250114 && uuid < 250123) { //mastery runes
if (ApplyRuneMsg.applyRune(uuid, origin, player)) {
itemMan.consume(item);
}
break;
} else if (uuid > 252122 && uuid < 252128) { //mastery runes
if (ApplyRuneMsg.applyRune(uuid, origin, player)) {
itemMan.consume(item);
}
break;
} else if (uuid > 680069 && uuid < 680074) //Handle Charter, Deed, Petition, Warrant here
{
break;
} else if (uuid > 910010 && uuid < 910019) {
int rank = uuid - 910010;
if (rank < 1 || rank > 8) {
ChatManager.chatSystemError(player, "Invalid Rank for bane scroll!");
return true;
}
// Only one banestone at a time
lock.writeLock().lock();
try {
if (Bane.summonBanestone(player, origin, rank) == true)
itemMan.consume(item);
} finally {
lock.writeLock().unlock();
}
break;
} else if (uuid == 910010) { //tears of saedron
if (comps.size() > 1) {
AbstractCharacter.removeRune(player, origin, comps.get(1).intValue());
}
break;
} else if ((byte) item.chargesRemaining > 0) {
ArrayList<Long> tarList = msg.getTargetCompID();
AbstractWorldObject target = player;
if (tarList.size() > 1) {
long tarID = tarList.get(1);
if (tarID != 0) {
AbstractGameObject tarAgo = AbstractGameObject.getFromTypeAndID(tarID);
if (tarAgo != null && tarAgo instanceof AbstractWorldObject) {
target = (AbstractWorldObject) tarAgo;
}
} }
} }
}
// Bypass for waterbuckets // Bypass for waterbuckets
// test character targeted // test character targeted
if (item.template.template_id == 910005) { if (item.template.template_id == 910005) {
// test for valid target type // test for valid target type
if (target.getObjectType() == Enum.GameObjectType.PlayerCharacter) if (target.getObjectType() == Enum.GameObjectType.PlayerCharacter)
waterbucketBypass = true; waterbucketBypass = true;
else { else {
// test distance to structure // test distance to structure
Building targetBuilding = (Building) target; Building targetBuilding = (Building) target;
Bounds testBounds = Bounds.borrow(); Bounds testBounds = Bounds.borrow();
testBounds.setBounds(player.getLoc(), 25); testBounds.setBounds(player.getLoc(), 25);
if (Bounds.collide(targetBuilding.getBounds(), testBounds, .1f) == false) { if (Bounds.collide(targetBuilding.getBounds(), testBounds, .1f) == false) {
ChatManager.chatSystemError(player, "Not in range of structura for to heal!"); ChatManager.chatSystemError(player, "Not in range of structura for to heal!");
return true; return true;
}
} }
// Send piss bucket animation
VisualUpdateMessage vum = new VisualUpdateMessage(player, 16323);
vum.configure();
DispatchMessage.sendToAllInRange(player, vum);
} }
if (waterbucketBypass == false) { // Send piss bucket animation
String powerString = item.template.item_power_action.keySet().iterator().next();
PowersBase powerAction = PowersManager.powersBaseByIDString.get(powerString);
int powerValue = item.template.item_power_action.get(powerString)[0];
PowersManager.applyPower(player, target, Vector3fImmutable.ZERO, powerAction.getToken(), powerValue, true);
}
itemMan.consume(item);
} else //just remove the item at this point
itemMan.consume(item);
dispatch = Dispatch.borrow(player, msg); VisualUpdateMessage vum = new VisualUpdateMessage(player, 16323);
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY); vum.configure();
player.cancelOnSpell(); DispatchMessage.sendToAllInRange(player, vum);
break; }
default: //shouldn't be here, consume item
dispatch = Dispatch.borrow(player, msg); if (waterbucketBypass == false) {
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY); String powerString = item.template.item_power_action.keySet().iterator().next();
// itemMan.consume(item); PowersBase powerAction = PowersManager.powersBaseByIDString.get(powerString);
} int powerValue = item.template.item_power_action.get(powerString)[0];
PowersManager.applyPower(player, target, Vector3fImmutable.ZERO, powerAction.getToken(), powerValue, true);
}
itemMan.consume(item);
} else //just remove the item at this point
itemMan.consume(item);
dispatch = Dispatch.borrow(player, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
player.cancelOnSpell();
break;
default: //shouldn't be here, consume item
dispatch = Dispatch.borrow(player, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
// itemMan.consume(item);
}
} else { } else {
// TODO log item does not belong to player // TODO log item does not belong to player
// System.out.println("Item does not belong to player"); // System.out.println("Item does not belong to player");

20
src/engine/net/client/handlers/PetitionReceivedMsgHandler.java

@ -39,21 +39,21 @@ public class PetitionReceivedMsgHandler extends AbstractClientMsgHandler {
Petition petition = new Petition(petitionReceivedMsg, origin); Petition petition = new Petition(petitionReceivedMsg, origin);
// Write petition to database // Write petition to database
if (petitionReceivedMsg.petition == PETITION_NEW) if (petitionReceivedMsg.petition == PETITION_NEW)
DbManager.PetitionQueries.WRITE_PETITION_TO_TABLE(petition); DbManager.PetitionQueries.WRITE_PETITION_TO_TABLE(petition);
// Close the petition window // Close the petition window
if (petitionReceivedMsg.petition == PETITION_NEW) if (petitionReceivedMsg.petition == PETITION_NEW)
petitionReceivedMsg.petition = PETITION_CLOSE; petitionReceivedMsg.petition = PETITION_CLOSE;
petitionReceivedMsg.unknownByte01 = 0; petitionReceivedMsg.unknownByte01 = 0;
petitionReceivedMsg.unknown04 = 0; petitionReceivedMsg.unknown04 = 0;
Dispatch dispatch = Dispatch.borrow(playerCharacter, petitionReceivedMsg); Dispatch dispatch = Dispatch.borrow(playerCharacter, petitionReceivedMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY); DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
return true; return true;
} }

2
src/engine/net/client/handlers/RepairBuildingMsgHandler.java

@ -59,7 +59,7 @@ public class RepairBuildingMsgHandler extends AbstractClientMsgHandler {
//cannot repair mines during 24/7 activity. //cannot repair mines during 24/7 activity.
if (targetBuilding.getBlueprint() != null && targetBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.MINE && Mine.getMineFromTower(targetBuilding.getObjectUUID()).isActive == true) { if (targetBuilding.getBlueprint() != null && targetBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.MINE && Mine.getMineFromTower(targetBuilding.getObjectUUID()).isActive == true) {
return; return;
} }

1
src/engine/net/client/handlers/RequestEnterWorldHandler.java

@ -14,7 +14,6 @@ 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.msg.*; import engine.net.client.msg.*;
import engine.objects.AbstractWorldObject;
import engine.objects.Account; import engine.objects.Account;
import engine.objects.PlayerCharacter; import engine.objects.PlayerCharacter;
import engine.server.MBServerStatics; import engine.server.MBServerStatics;

5
src/engine/net/client/handlers/TransferGoldToFromBuildingMsgHandler.java

@ -12,7 +12,10 @@ import engine.net.client.msg.ClientNetMsg;
import engine.net.client.msg.PlaceAssetMsg; import engine.net.client.msg.PlaceAssetMsg;
import engine.net.client.msg.TransferGoldToFromBuildingMsg; import engine.net.client.msg.TransferGoldToFromBuildingMsg;
import engine.net.client.msg.UpdateGoldMsg; import engine.net.client.msg.UpdateGoldMsg;
import engine.objects.*; import engine.objects.Building;
import engine.objects.CharacterItemManager;
import engine.objects.Item;
import engine.objects.PlayerCharacter;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
/* /*

5
src/engine/net/client/handlers/TransferItemFromEquipToInventoryHandler.java

@ -16,7 +16,10 @@ import engine.net.client.ClientConnection;
import engine.net.client.msg.ApplyEffectMsg; import engine.net.client.msg.ApplyEffectMsg;
import engine.net.client.msg.ClientNetMsg; import engine.net.client.msg.ClientNetMsg;
import engine.net.client.msg.TransferItemFromEquipToInventoryMsg; import engine.net.client.msg.TransferItemFromEquipToInventoryMsg;
import engine.objects.*; import engine.objects.CharacterItemManager;
import engine.objects.Effect;
import engine.objects.Item;
import engine.objects.PlayerCharacter;
import engine.server.MBServerStatics; import engine.server.MBServerStatics;
public class TransferItemFromEquipToInventoryHandler extends AbstractClientMsgHandler { public class TransferItemFromEquipToInventoryHandler extends AbstractClientMsgHandler {

5
src/engine/net/client/handlers/TransferItemFromInventoryToEquipHandler.java

@ -19,7 +19,10 @@ import engine.net.client.msg.ApplyEffectMsg;
import engine.net.client.msg.ClientNetMsg; import engine.net.client.msg.ClientNetMsg;
import engine.net.client.msg.TransferItemFromEquipToInventoryMsg; import engine.net.client.msg.TransferItemFromEquipToInventoryMsg;
import engine.net.client.msg.TransferItemFromInventoryToEquipMsg; import engine.net.client.msg.TransferItemFromInventoryToEquipMsg;
import engine.objects.*; import engine.objects.CharacterItemManager;
import engine.objects.Effect;
import engine.objects.Item;
import engine.objects.PlayerCharacter;
import engine.server.MBServerStatics; import engine.server.MBServerStatics;
public class TransferItemFromInventoryToEquipHandler extends AbstractClientMsgHandler { public class TransferItemFromInventoryToEquipHandler extends AbstractClientMsgHandler {

2
src/engine/net/client/msg/LootMsg.java

@ -10,13 +10,11 @@
package engine.net.client.msg; package engine.net.client.msg;
import engine.exception.SerializationException;
import engine.net.AbstractConnection; import engine.net.AbstractConnection;
import engine.net.ByteBufferReader; import engine.net.ByteBufferReader;
import engine.net.ByteBufferWriter; import engine.net.ByteBufferWriter;
import engine.net.client.Protocol; import engine.net.client.Protocol;
import engine.objects.Item; import engine.objects.Item;
import engine.objects.Item;
public class LootMsg extends ClientNetMsg { public class LootMsg extends ClientNetMsg {

25
src/engine/net/client/msg/ManageNPCMsg.java

@ -467,21 +467,21 @@ public class ManageNPCMsg extends ClientNetMsg {
ArrayList<String> effectsList = item.getEffectNames(); ArrayList<String> effectsList = item.getEffectNames();
EffectsBase prefix = null; EffectsBase prefix = null;
EffectsBase suffix = null; EffectsBase suffix = null;
for (String effectName : effectsList) { for (String effectName : effectsList) {
if (effectName.contains("PRE")) if (effectName.contains("PRE"))
prefix = PowersManager.getEffectByIDString(effectName); prefix = PowersManager.getEffectByIDString(effectName);
if (effectName.contains("SUF")) if (effectName.contains("SUF"))
suffix = PowersManager.getEffectByIDString(effectName); suffix = PowersManager.getEffectByIDString(effectName);
} }
if ((prefix == null && suffix == null)) if ((prefix == null && suffix == null))
writer.putInt(0); writer.putInt(0);
else else
writer.putInt(-1497023830); writer.putInt(-1497023830);
if ((prefix != null && !item.isRandom()) || (prefix != null && item.isComplete())) if ((prefix != null && !item.isRandom()) || (prefix != null && item.isComplete()))
writer.putInt(prefix.getToken()); writer.putInt(prefix.getToken());
@ -494,7 +494,7 @@ public class ManageNPCMsg extends ClientNetMsg {
writer.putInt(0); writer.putInt(0);
writer.putString(item.name); writer.putString(item.name);
} }
writer.putInt(0); writer.putInt(0);
writer.putInt(0); writer.putInt(0);
@ -771,6 +771,7 @@ public class ManageNPCMsg extends ClientNetMsg {
public void setUnknown06(int unknown06) { public void setUnknown06(int unknown06) {
this.unknown06 = unknown06; this.unknown06 = unknown06;
} }
public int getMessageType() { public int getMessageType() {
return messageType; return messageType;
} }

1
src/engine/net/client/msg/MoveToPointMsg.java

@ -10,7 +10,6 @@
package engine.net.client.msg; package engine.net.client.msg;
import engine.Enum.GameObjectType; import engine.Enum.GameObjectType;
import engine.gameManager.BuildingManager;
import engine.gameManager.ZoneManager; import engine.gameManager.ZoneManager;
import engine.math.Vector3fImmutable; import engine.math.Vector3fImmutable;
import engine.net.AbstractConnection; import engine.net.AbstractConnection;

5
src/engine/net/client/msg/UpdateGoldMsg.java

@ -15,7 +15,10 @@ import engine.net.AbstractConnection;
import engine.net.ByteBufferReader; import engine.net.ByteBufferReader;
import engine.net.ByteBufferWriter; import engine.net.ByteBufferWriter;
import engine.net.client.Protocol; import engine.net.client.Protocol;
import engine.objects.*; import engine.objects.AbstractWorldObject;
import engine.objects.CharacterItemManager;
import engine.objects.Item;
import engine.objects.PlayerCharacter;
/** /**
* Update gold in inventory and/or bank * Update gold in inventory and/or bank

32
src/engine/objects/AbstractCharacter.java

@ -986,7 +986,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
return 300; return 300;
} }
float range = 8; float range = 8;
if (( this).charItemManager.equipped.get(EquipSlotType.RHELD) != null) { if ((this).charItemManager.equipped.get(EquipSlotType.RHELD) != null) {
range = ((Mob) this).charItemManager.equipped.get(EquipSlotType.RHELD).template.item_weapon_max_range; range = ((Mob) this).charItemManager.equipped.get(EquipSlotType.RHELD).template.item_weapon_max_range;
} else if (((Mob) this).charItemManager.equipped.get(EquipSlotType.LHELD) != null) { } else if (((Mob) this).charItemManager.equipped.get(EquipSlotType.LHELD) != null) {
range = ((Mob) this).charItemManager.equipped.get(EquipSlotType.LHELD).template.item_weapon_max_range; range = ((Mob) this).charItemManager.equipped.get(EquipSlotType.LHELD).template.item_weapon_max_range;
@ -1046,18 +1046,18 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
Building building = BuildingManager.getBuildingAtLocation(this.loc); Building building = BuildingManager.getBuildingAtLocation(this.loc);
Regions region = null; Regions region = null;
if(building != null) { if (building != null) {
//look for region in the building we are in //look for region in the building we are in
for (Regions regionCycle : building.getBounds().getRegions()) { for (Regions regionCycle : building.getBounds().getRegions()) {
float regionHeight = regionCycle.highLerp.y - regionCycle.lowLerp.y; float regionHeight = regionCycle.highLerp.y - regionCycle.lowLerp.y;
if(regionHeight < 10) if (regionHeight < 10)
regionHeight = 10; regionHeight = 10;
if (regionCycle.isPointInPolygon(value) && Math.abs(regionCycle.highLerp.y - value.y) < regionHeight) if (regionCycle.isPointInPolygon(value) && Math.abs(regionCycle.highLerp.y - value.y) < regionHeight)
region = regionCycle; region = regionCycle;
} }
} }
float regionHeightOffset = 0; float regionHeightOffset = 0;
if(region != null){ if (region != null) {
this.region = region; this.region = region;
regionHeightOffset = region.lerpY(this); regionHeightOffset = region.lerpY(this);
this.inBuilding = region.level; // -1 not in building 0 on ground floor, 1 on first floor etc this.inBuilding = region.level; // -1 not in building 0 on ground floor, 1 on first floor etc
@ -1071,7 +1071,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
} }
float terrainHeight = Terrain.getWorldHeight(value); float terrainHeight = Terrain.getWorldHeight(value);
Vector3fImmutable finalLocation = new Vector3fImmutable(value.x,terrainHeight + regionHeightOffset, value.z); Vector3fImmutable finalLocation = new Vector3fImmutable(value.x, terrainHeight + regionHeightOffset, value.z);
super.setLoc(finalLocation); // set the location in the world super.setLoc(finalLocation); // set the location in the world
this.resetLastSetLocUpdate(); this.resetLastSetLocUpdate();
@ -1195,7 +1195,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
public final void setCombatTarget(final AbstractWorldObject value) { public final void setCombatTarget(final AbstractWorldObject value) {
if(this.getObjectTypeMask() == 2050) {//MOB? if (this.getObjectTypeMask() == 2050) {//MOB?
if (value == null) { if (value == null) {
if (this.isCombat()) { if (this.isCombat()) {
this.setCombat(false); this.setCombat(false);
@ -1203,7 +1203,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
rwss.setPlayer(this); rwss.setPlayer(this);
DispatchMessage.sendToAllInRange(this, rwss); DispatchMessage.sendToAllInRange(this, rwss);
} }
}else { } else {
if (!this.isCombat()) { if (!this.isCombat()) {
this.setCombat(true); this.setCombat(true);
UpdateStateMsg rwss = new UpdateStateMsg(); UpdateStateMsg rwss = new UpdateStateMsg();
@ -1331,22 +1331,22 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
CombatManager.handleRetaliate(this, attacker); CombatManager.handleRetaliate(this, attacker);
} }
if(this.getObjectType().equals(GameObjectType.Mob)){ if (this.getObjectType().equals(GameObjectType.Mob)) {
//handle hate value addition //handle hate value addition
Mob target = (Mob)this; Mob target = (Mob) this;
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter)) { if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter)) {
target.playerAgroMap.put(attacker.getObjectUUID(), target.playerAgroMap.get(attacker.getObjectUUID()) + value); target.playerAgroMap.put(attacker.getObjectUUID(), target.playerAgroMap.get(attacker.getObjectUUID()) + value);
if (target.isPlayerGuard()){ if (target.isPlayerGuard()) {
if(target.guardedCity != null && target.guardedCity.cityOutlaws.contains(attacker.getObjectUUID()) == false) if (target.guardedCity != null && target.guardedCity.cityOutlaws.contains(attacker.getObjectUUID()) == false)
target.guardedCity.cityOutlaws.add(attacker.getObjectUUID()); target.guardedCity.cityOutlaws.add(attacker.getObjectUUID());
} }
} }
} else if(this.getObjectType().equals(GameObjectType.PlayerCharacter)){ } else if (this.getObjectType().equals(GameObjectType.PlayerCharacter)) {
City playerCity = ZoneManager.getCityAtLocation(this.loc); City playerCity = ZoneManager.getCityAtLocation(this.loc);
if(playerCity != null){ if (playerCity != null) {
if(!attacker.getGuild().getNation().equals(playerCity.getGuild().getNation())) if (!attacker.getGuild().getNation().equals(playerCity.getGuild().getNation()))
if(!playerCity.getGuild().getNation().getAllyList().contains(attacker.getGuild().getNation())) if (!playerCity.getGuild().getNation().getAllyList().contains(attacker.getGuild().getNation()))
if(!playerCity.cityOutlaws.contains(attacker.getObjectUUID())) if (!playerCity.cityOutlaws.contains(attacker.getObjectUUID()))
playerCity.cityOutlaws.add(attacker.getObjectUUID()); playerCity.cityOutlaws.add(attacker.getObjectUUID());
} }
} }

4
src/engine/objects/AbstractWorldObject.java

@ -503,9 +503,9 @@ public abstract class AbstractWorldObject extends AbstractGameObject {
this.lastLoc = new Vector3fImmutable(this.loc); this.lastLoc = new Vector3fImmutable(this.loc);
this.loc = loc; this.loc = loc;
if(this instanceof AbstractCharacter && this.region != null){ if (this instanceof AbstractCharacter && this.region != null) {
this.loc = this.loc.setY(this.region.lerpY(this) + this.getAltitude()); this.loc = this.loc.setY(this.region.lerpY(this) + this.getAltitude());
} else{ } else {
this.loc = this.loc.setY(Terrain.getWorldHeight(this.getLoc()) + this.getAltitude()); this.loc = this.loc.setY(Terrain.getWorldHeight(this.getLoc()) + this.getAltitude());
} }

34
src/engine/objects/CharacterSkill.java

@ -1013,7 +1013,7 @@ public class CharacterSkill extends AbstractGameObject {
} }
public void calculateMobBaseAmount(boolean isGuard) { public void calculateMobBaseAmount(boolean isGuard) {
if(!isGuard) { if (!isGuard) {
if (CharacterSkill.GetOwner(this) == null) { if (CharacterSkill.GetOwner(this) == null) {
Logger.error("owner not found for owner uuid : " + this.ownerUID); Logger.error("owner not found for owner uuid : " + this.ownerUID);
this.baseAmount = 1; this.baseAmount = 1;
@ -1037,23 +1037,23 @@ public class CharacterSkill extends AbstractGameObject {
//Get bonuses from runes //Get bonuses from runes
bonus = CharacterSkill.GetOwner(this).getBonuses().getSkillBonus(this.skillsBase.sourceType); bonus = CharacterSkill.GetOwner(this).getBonuses().getSkillBonus(this.skillsBase.sourceType);
//Get Base skill for unmodified stats //Get Base skill for unmodified stats
if (this.skillsBase.getStrMod() > 0) if (this.skillsBase.getStrMod() > 0)
statMod += (float) this.skillsBase.getStrMod() * (float) ((Mob) CharacterSkill.GetOwner(this)).getMobBase().getMobBaseStats().getBaseStr() / 100f; statMod += (float) this.skillsBase.getStrMod() * (float) ((Mob) CharacterSkill.GetOwner(this)).getMobBase().getMobBaseStats().getBaseStr() / 100f;
if (this.skillsBase.getDexMod() > 0) if (this.skillsBase.getDexMod() > 0)
statMod += (float) this.skillsBase.getDexMod() * (float) ((Mob) CharacterSkill.GetOwner(this)).getMobBase().getMobBaseStats().getBaseDex() / 100f; statMod += (float) this.skillsBase.getDexMod() * (float) ((Mob) CharacterSkill.GetOwner(this)).getMobBase().getMobBaseStats().getBaseDex() / 100f;
if (this.skillsBase.getConMod() > 0) if (this.skillsBase.getConMod() > 0)
statMod += (float) this.skillsBase.getConMod() * (float) ((Mob) CharacterSkill.GetOwner(this)).getMobBase().getMobBaseStats().getBaseCon() / 100f; statMod += (float) this.skillsBase.getConMod() * (float) ((Mob) CharacterSkill.GetOwner(this)).getMobBase().getMobBaseStats().getBaseCon() / 100f;
if (this.skillsBase.getIntMod() > 0) if (this.skillsBase.getIntMod() > 0)
statMod += (float) this.skillsBase.getIntMod() * (float) ((Mob) CharacterSkill.GetOwner(this)).getMobBase().getMobBaseStats().getBaseInt() / 100f; statMod += (float) this.skillsBase.getIntMod() * (float) ((Mob) CharacterSkill.GetOwner(this)).getMobBase().getMobBaseStats().getBaseInt() / 100f;
if (this.skillsBase.getSpiMod() > 0) if (this.skillsBase.getSpiMod() > 0)
statMod += (float) this.skillsBase.getSpiMod() * (float) ((Mob) CharacterSkill.GetOwner(this)).getMobBase().getMobBaseStats().getBaseSpi() / 100f; statMod += (float) this.skillsBase.getSpiMod() * (float) ((Mob) CharacterSkill.GetOwner(this)).getMobBase().getMobBaseStats().getBaseSpi() / 100f;
if (statMod < 1) if (statMod < 1)
statMod = 1f; statMod = 1f;
else if (statMod > 600) else if (statMod > 600)
statMod = 600f; statMod = 600f;
} }
base += CharacterSkill.baseSkillValues[(int) statMod]; base += CharacterSkill.baseSkillValues[(int) statMod];
@ -1065,7 +1065,7 @@ public class CharacterSkill extends AbstractGameObject {
} }
public void calculateModifiedAmount(boolean isGuard) { public void calculateModifiedAmount(boolean isGuard) {
if(!isGuard) { if (!isGuard) {
if (CharacterSkill.GetOwner(this) == null || this.skillsBase == null) { if (CharacterSkill.GetOwner(this) == null || this.skillsBase == null) {
Logger.error("owner or SkillsBase not found for skill " + this.getObjectUUID()); Logger.error("owner or SkillsBase not found for skill " + this.getObjectUUID());
this.baseAmount = 1; this.baseAmount = 1;

26
src/engine/objects/City.java

@ -325,11 +325,11 @@ public class City extends AbstractWorldObject {
if (city.open && city.getTOL() != null && city.getTOL().getRank() > 4) { if (city.open && city.getTOL() != null && city.getTOL().getRank() > 4) {
if (!BuildingManager.IsPlayerHostile(city.getTOL(), pc)) { if (!BuildingManager.IsPlayerHostile(city.getTOL(), pc)) {
if(ConfigManager.MB_RULESET.getValue() == "LORE") { if (ConfigManager.MB_RULESET.getValue() == "LORE") {
if(city.getGuild().getGuildType().equals(pc.guild.getGuildType())){ if (city.getGuild().getGuildType().equals(pc.guild.getGuildType())) {
cities.add(city); cities.add(city);
} }
}else { } else {
cities.add(city); //verify nation or guild is same cities.add(city); //verify nation or guild is same
} }
} }
@ -351,11 +351,11 @@ public class City extends AbstractWorldObject {
cities.add(city); cities.add(city);
} else if (pc.getLevel() >= g.getTeleportMin() && pc.getLevel() <= g.getTeleportMax()) } else if (pc.getLevel() >= g.getTeleportMin() && pc.getLevel() <= g.getTeleportMax())
if(ConfigManager.MB_RULESET.getValue() == "LORE") { if (ConfigManager.MB_RULESET.getValue() == "LORE") {
if(city.getGuild().getGuildType().equals(pc.guild.getGuildType())){ if (city.getGuild().getGuildType().equals(pc.guild.getGuildType())) {
cities.add(city); cities.add(city);
} }
}else { } else {
cities.add(city); //verify nation or guild is same cities.add(city); //verify nation or guild is same
} }
} }
@ -410,22 +410,22 @@ public class City extends AbstractWorldObject {
if (city.isNpc == 1) if (city.isNpc == 1)
if (city.isNoobIsle == 1) { if (city.isNoobIsle == 1) {
if (playerCharacter.getLevel() < 21) if (playerCharacter.getLevel() < 21)
cities.add(city); //verify nation or guild is same cities.add(city); //verify nation or guild is same
} else if (playerCharacter.getLevel() > 9) } else if (playerCharacter.getLevel() > 9)
if(ConfigManager.MB_RULESET.getValue() == "LORE") { if (ConfigManager.MB_RULESET.getValue() == "LORE") {
if(city.getGuild().getGuildType().equals(playerCharacter.guild.getGuildType())){ if (city.getGuild().getGuildType().equals(playerCharacter.guild.getGuildType())) {
cities.add(city); cities.add(city);
} }
}else { } else {
cities.add(city); //verify nation or guild is same cities.add(city); //verify nation or guild is same
} }
} else if (playerCharacter.getLevel() >= guild.getRepledgeMin() && playerCharacter.getLevel() <= guild.getRepledgeMax()) { } else if (playerCharacter.getLevel() >= guild.getRepledgeMin() && playerCharacter.getLevel() <= guild.getRepledgeMax()) {
if(ConfigManager.MB_RULESET.getValue() == "LORE") { if (ConfigManager.MB_RULESET.getValue() == "LORE") {
if(city.getGuild().getGuildType().equals(playerCharacter.guild.getGuildType())){ if (city.getGuild().getGuildType().equals(playerCharacter.guild.getGuildType())) {
cities.add(city); cities.add(city);
} }
}else { } else {
cities.add(city); //verify nation or guild is same cities.add(city); //verify nation or guild is same
} }
} }

2
src/engine/objects/Item.java

@ -993,7 +993,7 @@ public class Item extends AbstractWorldObject {
AbstractPowerAction apa = PowersManager.getPowerActionByIDString(effect.getIDString()); AbstractPowerAction apa = PowersManager.getPowerActionByIDString(effect.getIDString());
apa.applyBakedInStatsForItem(this, this.template.item_user_power_action.get(effectID)[0]); apa.applyBakedInStatsForItem(this, this.template.item_user_power_action.get(effectID)[0]);
} }
} }
public final void loadEnchantments() { public final void loadEnchantments() {

4
src/engine/objects/ItemBase.java

@ -10,13 +10,11 @@
package engine.objects; package engine.objects;
import engine.Enum; import engine.Enum;
import engine.Enum.ItemType;
import engine.gameManager.DbManager; import engine.gameManager.DbManager;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
public class ItemBase { public class ItemBase {
@ -96,6 +94,7 @@ public class ItemBase {
public final int getUUID() { public final int getUUID() {
return uuid; return uuid;
} }
public String getMastery() { public String getMastery() {
return mastery; return mastery;
} }
@ -127,6 +126,7 @@ public class ItemBase {
public short getMinDamage() { public short getMinDamage() {
return minDamage; return minDamage;
} }
public Enum.SourceType getDamageType() { public Enum.SourceType getDamageType() {
return damageType; return damageType;
} }

2
src/engine/objects/ItemTemplate.java

@ -534,7 +534,7 @@ public class ItemTemplate {
return false; return false;
//Item not valid for slot //Item not valid for slot
if(item.template.item_eq_slots_or.contains(slot) == false) if (item.template.item_eq_slots_or.contains(slot) == false)
return false; return false;
// Slot is taken // Slot is taken

88
src/engine/objects/Mob.java

@ -1037,13 +1037,13 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed {
} }
public void recalculateStats() { public void recalculateStats() {
if(this.isPlayerGuard()){ if (this.isPlayerGuard()) {
NPCManager.setMaxHealthForGuard(this); NPCManager.setMaxHealthForGuard(this);
NPCManager.setAttackRatingForGuard(this); NPCManager.setAttackRatingForGuard(this);
NPCManager.setDefenseForGuard(this); NPCManager.setDefenseForGuard(this);
NPCManager.setDamageAndSpeedForGuard(this); NPCManager.setDamageAndSpeedForGuard(this);
NPCManager.applyGuardStanceModifiers(this); NPCManager.applyGuardStanceModifiers(this);
}else { } else {
try { try {
calculateAtrDefenseDamage(); calculateAtrDefenseDamage();
@ -1061,64 +1061,64 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed {
} catch (Exception e) { } catch (Exception e) {
Logger.error(e.getMessage()); Logger.error(e.getMessage());
} }
if(this.isSiege()) if (this.isSiege())
this.healthMax = 10000; this.healthMax = 10000;
Resists.calculateResists(this); Resists.calculateResists(this);
} }
public void calculateMaxHealthManaStamina() { public void calculateMaxHealthManaStamina() {
float h; float h;
float m; float m;
float s; float s;
h = this.mobBase.getHealthMax(); h = this.mobBase.getHealthMax();
if (this.isPet()) { if (this.isPet()) {
h = this.level * 0.5f * 120; h = this.level * 0.5f * 120;
} }
m = this.statSpiCurrent; m = this.statSpiCurrent;
s = this.statConCurrent; s = this.statConCurrent;
// Apply any bonuses from runes and effects // Apply any bonuses from runes and effects
if (this.bonuses != null) { if (this.bonuses != null) {
h += this.bonuses.getFloat(ModType.HealthFull, SourceType.NONE); h += this.bonuses.getFloat(ModType.HealthFull, SourceType.NONE);
m += this.bonuses.getFloat(ModType.ManaFull, SourceType.NONE); m += this.bonuses.getFloat(ModType.ManaFull, SourceType.NONE);
s += this.bonuses.getFloat(ModType.StaminaFull, SourceType.NONE); s += this.bonuses.getFloat(ModType.StaminaFull, SourceType.NONE);
//apply effects percent modifiers. DO THIS LAST! //apply effects percent modifiers. DO THIS LAST!
h *= (1 + this.bonuses.getFloatPercentAll(ModType.HealthFull, SourceType.NONE)); h *= (1 + this.bonuses.getFloatPercentAll(ModType.HealthFull, SourceType.NONE));
m *= (1 + this.bonuses.getFloatPercentAll(ModType.ManaFull, SourceType.NONE)); m *= (1 + this.bonuses.getFloatPercentAll(ModType.ManaFull, SourceType.NONE));
s *= (1 + this.bonuses.getFloatPercentAll(ModType.StaminaFull, SourceType.NONE)); s *= (1 + this.bonuses.getFloatPercentAll(ModType.StaminaFull, SourceType.NONE));
} }
// Set max health, mana and stamina // Set max health, mana and stamina
if (h > 0) if (h > 0)
this.healthMax = h; this.healthMax = h;
else else
this.healthMax = 1; this.healthMax = 1;
if (m > -1) if (m > -1)
this.manaMax = m; this.manaMax = m;
else else
this.manaMax = 0; this.manaMax = 0;
if (s > -1) if (s > -1)
this.staminaMax = s; this.staminaMax = s;
else else
this.staminaMax = 0; this.staminaMax = 0;
// Update health, mana and stamina if needed // Update health, mana and stamina if needed
if (this.getHealth() > this.healthMax) if (this.getHealth() > this.healthMax)
this.setHealth(this.healthMax); this.setHealth(this.healthMax);
if (this.mana.get() > this.manaMax) if (this.mana.get() > this.manaMax)
this.mana.set(this.manaMax); this.mana.set(this.manaMax);
if (this.stamina.get() > this.staminaMax) if (this.stamina.get() > this.staminaMax)
this.stamina.set(staminaMax); this.stamina.set(staminaMax);
} }
@ -1885,9 +1885,9 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed {
} }
} }
public Boolean isGuard(){ public Boolean isGuard() {
switch(this.behaviourType){ switch (this.behaviourType) {
case GuardMinion: case GuardMinion:
case GuardCaptain: case GuardCaptain:
case GuardWallArcher: case GuardWallArcher:

1
src/engine/objects/MobBase.java

@ -19,7 +19,6 @@ import engine.server.MBServerStatics;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
public class MobBase extends AbstractGameObject { public class MobBase extends AbstractGameObject {

8
src/engine/objects/MobBaseStats.java

@ -79,8 +79,12 @@ public class MobBaseStats {
return baseDex; return baseDex;
} }
public int getBaseSkill(){return mobbaseSkill;} public int getBaseSkill() {
return mobbaseSkill;
}
public int getBaseSkillAmount(){return mobbaseSkillAmount;} public int getBaseSkillAmount() {
return mobbaseSkillAmount;
}
} }

1
src/engine/objects/Petition.java

@ -7,6 +7,7 @@
// www.magicbane.com // www.magicbane.com
package engine.objects; package engine.objects;
import engine.math.Vector3fImmutable; import engine.math.Vector3fImmutable;
import engine.net.client.ClientConnection; import engine.net.client.ClientConnection;
import engine.net.client.msg.PetitionReceivedMsg; import engine.net.client.msg.PetitionReceivedMsg;

14
src/engine/objects/PlayerCharacter.java

@ -4572,31 +4572,31 @@ public class PlayerCharacter extends AbstractCharacter {
this.setBounds(playerBounds); this.setBounds(playerBounds);
//assign enum values for restrictions //assign enum values for restrictions
String race = this.getRace().getName().replace("-","").replace(", Male","").replace(", Female",""); String race = this.getRace().getName().replace("-", "").replace(", Male", "").replace(", Female", "");
this.absRace = Enum.MonsterType.valueOf(race); this.absRace = Enum.MonsterType.valueOf(race);
if(this.baseClass != null) if (this.baseClass != null)
this.absBaseClass = ClassType.valueOf(this.getBaseClass().getName()); this.absBaseClass = ClassType.valueOf(this.getBaseClass().getName());
if(this.promotionClass != null) if (this.promotionClass != null)
this.absPromotionClass = ClassType.valueOf(this.getPromotionClass().getName()); this.absPromotionClass = ClassType.valueOf(this.getPromotionClass().getName());
if(this.isMale()) if (this.isMale())
this.absGender = SexType.MALE; this.absGender = SexType.MALE;
else else
this.absGender = SexType.FEMALE; this.absGender = SexType.FEMALE;
for(CharacterRune rune : this.runes){ for (CharacterRune rune : this.runes) {
try { try {
DisciplineType disc = DisciplineType.valueOf(RuneBase.getRuneBase(rune.getRuneBaseID()).getName().replace("-", "").replace(" ", "")); DisciplineType disc = DisciplineType.valueOf(RuneBase.getRuneBase(rune.getRuneBaseID()).getName().replace("-", "").replace(" ", ""));
if (disc != null) { if (disc != null) {
if(this.absDisciplines == null) if (this.absDisciplines == null)
this.absDisciplines = EnumSet.of(disc); this.absDisciplines = EnumSet.of(disc);
else else
this.absDisciplines.add(disc); this.absDisciplines.add(disc);
} }
} catch(Exception e){ } catch (Exception e) {
} }
} }

3
src/engine/objects/Portal.java

@ -3,7 +3,6 @@ package engine.objects;
import engine.Enum; import engine.Enum;
import engine.Enum.PortalType; import engine.Enum.PortalType;
import engine.InterestManagement.WorldGrid; import engine.InterestManagement.WorldGrid;
import engine.gameManager.BuildingManager;
import engine.gameManager.ConfigManager; import engine.gameManager.ConfigManager;
import engine.job.JobScheduler; import engine.job.JobScheduler;
import engine.jobs.CloseGateJob; import engine.jobs.CloseGateJob;
@ -105,7 +104,7 @@ public class Portal {
if (player.getTimeStamp("lastMoveGate") < this.lastActive) if (player.getTimeStamp("lastMoveGate") < this.lastActive)
return; return;
player.teleport(targetGate.getLoc().add(0,6,0));//offset height of runegate player.teleport(targetGate.getLoc().add(0, 6, 0));//offset height of runegate
player.setSafeMode(); player.setSafeMode();
} }

6
src/engine/objects/Regions.java

@ -279,7 +279,7 @@ public class Regions {
Building building = (Building) awo; Building building = (Building) awo;
if (!Bounds.collide(location, building.getBounds())) if (!Bounds.collide(location, building.getBounds()))
continue; continue;
if(building != null) { if (building != null) {
region = BuildingManager.GetRegion(building, location.x, location.y, location.z); region = BuildingManager.GetRegion(building, location.x, location.y, location.z);
} }
//find regions that intersect x and z, check if object can enter. //find regions that intersect x and z, check if object can enter.
@ -289,13 +289,13 @@ public class Regions {
// if (region == null) // if (region == null)
// region = toEnter; // region = toEnter;
// else // we're using a low level to high level tree structure, database not always in order low to high. // else // we're using a low level to high level tree structure, database not always in order low to high.
//check for highest level index. //check for highest level index.
// if (region != null && toEnter.highLerp.y > region.highLerp.y) // if (region != null && toEnter.highLerp.y > region.highLerp.y)
// region = toEnter; // region = toEnter;
// } // }
// } // }
} }
return region; return region;
} }

1
src/engine/powers/DamageShield.java

@ -8,6 +8,7 @@
package engine.powers; package engine.powers;
import engine.Enum; import engine.Enum;
public class DamageShield { public class DamageShield {

1
src/engine/powers/effectmodifiers/DamageShieldEffectModifier.java

@ -8,6 +8,7 @@
package engine.powers.effectmodifiers; package engine.powers.effectmodifiers;
import engine.Enum; import engine.Enum;
import engine.jobs.AbstractEffectJob; import engine.jobs.AbstractEffectJob;
import engine.objects.*; import engine.objects.*;

1
src/engine/powers/effectmodifiers/HealthEffectModifier.java

@ -8,6 +8,7 @@
package engine.powers.effectmodifiers; package engine.powers.effectmodifiers;
import engine.Enum.GameObjectType; import engine.Enum.GameObjectType;
import engine.Enum.ModType; import engine.Enum.ModType;
import engine.Enum.SourceType; import engine.Enum.SourceType;

13
src/engine/powers/poweractions/ApplyEffectPowerAction.java

@ -8,6 +8,7 @@
package engine.powers.poweractions; 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;
@ -128,21 +129,21 @@ public class ApplyEffectPowerAction extends AbstractPowerAction {
} }
} }
if (awo != null && awo.getObjectType() == GameObjectType.Mob) { if (awo != null && awo.getObjectType() == GameObjectType.Mob) {
if(((Mob)awo).isPet()) { if (((Mob) awo).isPet()) {
((Mob) awo).recalculateStats(); ((Mob) awo).recalculateStats();
} }
} }
this.effect.startEffect(source, awo, trains, eff); this.effect.startEffect(source, awo, trains, eff);
} }
//apply effects to mobs within range for chants //apply effects to mobs within range for chants
if(pb.isChant){ if (pb.isChant) {
for(AbstractGameObject ago : WorldGrid.getObjectsInRangePartial(awo.loc,pb.range, MBServerStatics.MASK_MOB)){ for (AbstractGameObject ago : WorldGrid.getObjectsInRangePartial(awo.loc, pb.range, MBServerStatics.MASK_MOB)) {
Mob mob = (Mob)ago; Mob mob = (Mob) ago;
if(mob.playerAgroMap.containsKey(source.getObjectUUID())) if (mob.playerAgroMap.containsKey(source.getObjectUUID()))
mob.playerAgroMap.put(source.getObjectUUID(), mob.playerAgroMap.get(source.getObjectUUID()).floatValue() + pb.hateValue); mob.playerAgroMap.put(source.getObjectUUID(), mob.playerAgroMap.get(source.getObjectUUID()).floatValue() + pb.hateValue);
} }
}else { } else {
if (awo != null && awo.getObjectType() == GameObjectType.Mob) { if (awo != null && awo.getObjectType() == GameObjectType.Mob) {
Mob mob = (Mob) awo; Mob mob = (Mob) awo;
if (mob.playerAgroMap.containsKey(source.getObjectUUID())) if (mob.playerAgroMap.containsKey(source.getObjectUUID()))

982
src/engine/server/world/WorldServer.java

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save