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. 13
      src/engine/devcmd/cmds/RegionCmd.java
  6. 3
      src/engine/gameManager/BuildingManager.java
  7. 9
      src/engine/gameManager/GuildManager.java
  8. 34
      src/engine/gameManager/LootManager.java
  9. 50
      src/engine/gameManager/NPCManager.java
  10. 6
      src/engine/gameManager/PowersManager.java
  11. 22
      src/engine/mobileAI/MobAI.java
  12. 8
      src/engine/mobileAI/Threads/MobAIThread.java
  13. 1
      src/engine/mobileAI/Threads/Respawner.java
  14. 4
      src/engine/net/client/ClientMessagePump.java
  15. 4
      src/engine/net/client/handlers/AttackCmdMsgHandler.java
  16. 5
      src/engine/net/client/handlers/GroupInviteHandler.java
  17. 4
      src/engine/net/client/handlers/GuildCreationFinalizeHandler.java
  18. 4
      src/engine/net/client/handlers/InviteToGuildHandler.java
  19. 9
      src/engine/net/client/handlers/InviteToSubHandler.java
  20. 14
      src/engine/net/client/handlers/LeaveGuildHandler.java
  21. 2
      src/engine/net/client/handlers/MinionTrainingMsgHandler.java
  22. 6
      src/engine/net/client/handlers/MoveToPointHandler.java
  23. 1
      src/engine/net/client/handlers/ObjectActionMsgHandler.java
  24. 1
      src/engine/net/client/handlers/RequestEnterWorldHandler.java
  25. 5
      src/engine/net/client/handlers/TransferGoldToFromBuildingMsgHandler.java
  26. 5
      src/engine/net/client/handlers/TransferItemFromEquipToInventoryHandler.java
  27. 5
      src/engine/net/client/handlers/TransferItemFromInventoryToEquipHandler.java
  28. 2
      src/engine/net/client/msg/LootMsg.java
  29. 1
      src/engine/net/client/msg/ManageNPCMsg.java
  30. 1
      src/engine/net/client/msg/MoveToPointMsg.java
  31. 5
      src/engine/net/client/msg/UpdateGoldMsg.java
  32. 32
      src/engine/objects/AbstractCharacter.java
  33. 4
      src/engine/objects/AbstractWorldObject.java
  34. 4
      src/engine/objects/CharacterSkill.java
  35. 24
      src/engine/objects/City.java
  36. 4
      src/engine/objects/ItemBase.java
  37. 2
      src/engine/objects/ItemTemplate.java
  38. 10
      src/engine/objects/Mob.java
  39. 1
      src/engine/objects/MobBase.java
  40. 8
      src/engine/objects/MobBaseStats.java
  41. 1
      src/engine/objects/Petition.java
  42. 14
      src/engine/objects/PlayerCharacter.java
  43. 3
      src/engine/objects/Portal.java
  44. 2
      src/engine/objects/Regions.java
  45. 1
      src/engine/powers/DamageShield.java
  46. 1
      src/engine/powers/effectmodifiers/DamageShieldEffectModifier.java
  47. 1
      src/engine/powers/effectmodifiers/HealthEffectModifier.java
  48. 13
      src/engine/powers/poweractions/ApplyEffectPowerAction.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);

13
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,19 +28,19 @@ 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);

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;

34
src/engine/gameManager/LootManager.java

@ -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);
} }

50
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,9 +355,9 @@ 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;
@ -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.");

22
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);
} }
@ -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) {
@ -1138,7 +1138,7 @@ public class MobAI {
Mob aggroMob = (Mob) awoMob; Mob aggroMob = (Mob) awoMob;
if(GuardCanAggro(mob,aggroMob)) { if (GuardCanAggro(mob, aggroMob)) {
mob.setCombatTarget(aggroMob); mob.setCombatTarget(aggroMob);
return; return;
} }

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);

1
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 {

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 {

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

@ -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());
} }

4
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;
@ -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;

24
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
} }
} }
@ -412,20 +412,20 @@ public class City extends AbstractWorldObject {
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
} }
} }

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

10
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,7 +1061,7 @@ 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);
} }
@ -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();
} }

2
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.

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()))

Loading…
Cancel
Save