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

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

@ -494,11 +494,11 @@ public class InfoCmd extends AbstractDevCmd { @@ -494,11 +494,11 @@ public class InfoCmd extends AbstractDevCmd {
output += newline;
output += "No building found." + newline;
}
int max = (int)(4.882 * targetMob.level + 121.0);
if(max > 321){
int max = (int) (4.882 * targetMob.level + 121.0);
if (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 += "Max Loot Roll = " + max;
break;

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

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

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

@ -47,7 +47,7 @@ public class PrintRunesCmd extends AbstractDevCmd { @@ -47,7 +47,7 @@ public class PrintRunesCmd extends AbstractDevCmd {
String newline = "\r\n ";
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;
}
throwbackInfo(pc, output);

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

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

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

@ -96,9 +96,9 @@ public class aiInfoCmd extends AbstractDevCmd { @@ -96,9 +96,9 @@ public class aiInfoCmd extends AbstractDevCmd {
output += "Responds To Call For Help: " + mob.behaviourType.respondsToCallForHelp + newline;
} else {
output += "BehaviourType: NULL" + newline;
}
output += "Aggro Range: " + mob.getAggroRange() + newline;
output += "Player Aggro Map Size: " + mob.playerAgroMap.size() + newline;
}
output += "Aggro Range: " + mob.getAggroRange() + newline;
output += "Player Aggro Map Size: " + mob.playerAgroMap.size() + newline;
if (mob.playerAgroMap.size() > 0) {
output += "Players Loaded:" + newline;
}
@ -112,7 +112,7 @@ public class aiInfoCmd extends AbstractDevCmd { @@ -112,7 +112,7 @@ public class aiInfoCmd extends AbstractDevCmd {
if (mob.guardedCity != null)
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 += "Powers:" + newline;

3
src/engine/gameManager/BuildingManager.java

@ -42,6 +42,7 @@ public enum BuildingManager { @@ -42,6 +42,7 @@ public enum BuildingManager {
public static HashMap<Integer, ConcurrentHashMap<Integer, BuildingFriends>> _buildingFriends = new HashMap<>();
public static HashMap<Integer, ConcurrentHashMap<Integer, Condemned>> _buildingCondemned = new HashMap<>();
public static HashMap<Integer, ArrayList<Vector3fImmutable>> _buildingPatrolPoints = new HashMap<>();
public static int getAvailableSlot(Building building) {
ArrayList<BuildingLocation> slotLocations = _slotLocations.get(building.meshUUID);
@ -838,7 +839,7 @@ public enum BuildingManager { @@ -838,7 +839,7 @@ public enum BuildingManager {
// New rank means new mesh
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());
building.meshUUID = newMeshUUID;

9
src/engine/gameManager/GuildManager.java

@ -200,11 +200,12 @@ public enum GuildManager { @@ -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();
if(charter.requiredClasses.contains(player.absPromotionClass))
if(charter.requiredRaces.contains(player.absRace))
if(charter.sexRequired.contains(player.absGender))
if (charter.requiredClasses.contains(player.absPromotionClass))
if (charter.requiredRaces.contains(player.absRace))
if (charter.sexRequired.contains(player.absGender))
return true;
return false;

56
src/engine/gameManager/LootManager.java

@ -80,22 +80,22 @@ public enum LootManager { @@ -80,22 +80,22 @@ public enum LootManager {
RunBootySet(_bootySetMap.get(mob.bootySet), mob, inHotzone);
//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)
break;
if (ib == null)
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")) {
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.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
DispatchMessage.dispatchMsgToAll(chatMsg);
}
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?");
chatMsg.setMessageType(10);
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
DispatchMessage.dispatchMsgToAll(chatMsg);
}
}
}
@ -146,7 +146,7 @@ public enum LootManager { @@ -146,7 +146,7 @@ public enum LootManager {
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);
@ -161,9 +161,9 @@ public enum LootManager { @@ -161,9 +161,9 @@ public enum LootManager {
//gets the 1-320 roll for this mob
int itemTableRoll = 0;
int objectType = mob.getObjectType().ordinal();
if(mob.getObjectType().ordinal() == 52) { //52 = player character
itemTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
} else{
if (mob.getObjectType().ordinal() == 52) { //52 = player character
itemTableRoll = ThreadLocalRandom.current().nextInt(1, 320 + 1);
} else {
itemTableRoll = TableRoll(mob.level, inHotzone);
}
ItemTableEntry tableRow = ItemTableEntry.rollTable(itemTableId, itemTableRoll);
@ -182,7 +182,7 @@ public enum LootManager { @@ -182,7 +182,7 @@ public enum LootManager {
outItem = new MobLoot(mob, ItemTemplate.templates.get(itemUUID), false);
if(selectedRow.pModTable != 0){
if (selectedRow.pModTable != 0) {
try {
outItem = GeneratePrefix(mob, outItem, genTableID, genRoll, inHotzone);
outItem.flags.remove(Enum.ItemFlags.Identified);
@ -190,7 +190,7 @@ public enum LootManager { @@ -190,7 +190,7 @@ public enum LootManager {
Logger.error("Failed to GeneratePrefix for item: " + outItem.getName());
}
}
if(selectedRow.sModTable != 0){
if (selectedRow.sModTable != 0) {
try {
outItem = GenerateSuffix(mob, outItem, genTableID, genRoll, inHotzone);
outItem.flags.remove(Enum.ItemFlags.Identified);
@ -215,9 +215,9 @@ public enum LootManager { @@ -215,9 +215,9 @@ public enum LootManager {
if (prefixTable == null)
return inItem;
int prefixTableRoll = 0;
if(mob.getObjectType().ordinal() == 52) {
prefixTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
} else{
if (mob.getObjectType().ordinal() == 52) {
prefixTableRoll = ThreadLocalRandom.current().nextInt(1, 320 + 1);
} else {
prefixTableRoll = TableRoll(mob.level, inHotzone);
}
ModTableEntry prefixMod = ModTableEntry.rollTable(prefixTable.modTableID, prefixTableRoll);
@ -247,9 +247,9 @@ public enum LootManager { @@ -247,9 +247,9 @@ public enum LootManager {
if (suffixTable == null)
return inItem;
int suffixTableRoll = 0;
if(mob.getObjectType().ordinal() == 52) {
suffixTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
} else{
if (mob.getObjectType().ordinal() == 52) {
suffixTableRoll = ThreadLocalRandom.current().nextInt(1, 320 + 1);
} else {
suffixTableRoll = TableRoll(mob.level, inHotzone);
}
ModTableEntry suffixMod = ModTableEntry.rollTable(suffixTable.modTableID, suffixTableRoll);
@ -332,7 +332,7 @@ public enum LootManager { @@ -332,7 +332,7 @@ public enum LootManager {
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
//do equipment here
int dropCount = 0;
@ -404,7 +404,7 @@ public enum LootManager { @@ -404,7 +404,7 @@ public enum LootManager {
int genRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1);
GenTableEntry selectedRow = GenTableEntry.rollTable(tableID, genRoll, LootManager.NORMAL_DROP_RATE);
if(selectedRow == null)
if (selectedRow == null)
return;
//roll 220-320 for the item table selection
@ -431,10 +431,10 @@ public enum LootManager { @@ -431,10 +431,10 @@ public enum LootManager {
//determine if the winning item needs a prefix
if(selectedRow.pModTable != 0){
int prefixRoll = ThreadLocalRandom.current().nextInt(220,320 + 1);
if (selectedRow.pModTable != 0) {
int prefixRoll = ThreadLocalRandom.current().nextInt(220, 320 + 1);
ModTableEntry prefix = ModTableEntry.rollTable(selectedRow.pModTable, prefixRoll);
if(prefix != null)
if (prefix != null)
winnings.addPermanentEnchantment(prefix.action, 0, prefix.level, true);
}

62
src/engine/gameManager/NPCManager.java

@ -247,30 +247,30 @@ public enum NPCManager { @@ -247,30 +247,30 @@ public enum NPCManager {
}
}
public static void applyGuardStanceModifiers(Mob guard){
public static void applyGuardStanceModifiers(Mob guard) {
float damageModifier = 1;
float attackRatingModifier = 1;
float defenseModifier = 1;
float attackSpeedModifier = 1;
float powerDamageModifier = 1;
//handle stance modifiers for guard mob
if(guard.agentType.equals(Enum.AIAgentType.GUARDWALLARCHER)){
if (guard.agentType.equals(Enum.AIAgentType.GUARDWALLARCHER)) {
//apply rogue bonuses
attackRatingModifier += 0.5f;
defenseModifier += 0.5f;
damageModifier += 0.5f;
attackSpeedModifier -= 0.36f;
}else {
} else {
Integer contractID;
if (guard.agentType.equals(Enum.AIAgentType.GUARDMINION)) {
contractID = guard.guardCaptain.contract.getContractID();
} else{
} else {
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
powerDamageModifier += 0.5f;
} else{
} else {
//apply fighter offensive stance
damageModifier += 0.5f;
attackSpeedModifier -= 0.36f;
@ -289,7 +289,7 @@ public enum NPCManager { @@ -289,7 +289,7 @@ public enum NPCManager {
//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);
int primaryStat = 0;
@ -324,17 +324,17 @@ public enum NPCManager { @@ -324,17 +324,17 @@ public enum NPCManager {
guard.rangeHandOne = weapon.template.item_weapon_max_range;
} else {
primaryStat = guard.getStatStrCurrent();
guard.minDamageHandOne = (int)((guard.mobBase.getDamageMin()) * rankModifier) + primaryStat;
guard.maxDamageHandOne = (int)((guard.mobBase.getDamageMax()) * rankModifier) + primaryStat;
guard.minDamageHandOne = (int) ((guard.mobBase.getDamageMin()) * rankModifier) + primaryStat;
guard.maxDamageHandOne = (int) ((guard.mobBase.getDamageMax()) * rankModifier) + primaryStat;
guard.speedHandOne = 30.0f;
guard.rangeHandOne = 3;
}
}
}
public static void setDefenseForGuard(Mob guard){
public static void setDefenseForGuard(Mob guard) {
int dexterity = guard.getStatDexCurrent();
if(dexterity < 1)
if (dexterity < 1)
dexterity = 1;
int baseDef = guard.mobBase.getDefenseRating();
int armorDefense = 0;
@ -355,29 +355,29 @@ public enum NPCManager { @@ -355,29 +355,29 @@ public enum NPCManager {
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
switch(guard.getRank()){
switch (guard.getRank()) {
default:
guard.healthMax = 750; //rank 1
break;
case 2:
guard.healthMax = 2082;
guard.healthMax = 2082;
break;
case 3:
guard.healthMax = 2740;
guard.healthMax = 2740;
break;
case 4:
guard.healthMax = 3414;
guard.healthMax = 3414;
break;
case 5:
guard.healthMax = 4080;
guard.healthMax = 4080;
break;
case 6:
guard.healthMax = 4746;
guard.healthMax = 4746;
break;
case 7:
guard.healthMax = 5412;
guard.healthMax = 5412;
break;
}
}
@ -422,7 +422,7 @@ public enum NPCManager { @@ -422,7 +422,7 @@ public enum NPCManager {
}
}
public static void applyEquipmentResists(Mob mob){
public static void applyEquipmentResists(Mob mob) {
if (mob.charItemManager.equipped.isEmpty())
return;
@ -438,18 +438,18 @@ public enum NPCManager { @@ -438,18 +438,18 @@ public enum NPCManager {
public static void applyMobbaseSkill(Mob mob) {
SkillsBase baseSkill = DbManager.SkillsBaseQueries.GET_BASE_BY_TOKEN(mob.mobBase.getMobBaseStats().getBaseSkill());
if(baseSkill != null)
mob.getSkills().put(baseSkill.getName(),new CharacterSkill(baseSkill,mob,mob.mobBase.getMobBaseStats().getBaseSkillAmount()));
if (baseSkill != null)
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
if(PowersManager._allRuneSkillAdjusts.containsKey(runeID))
for(RuneSkillAdjustEntry entry : PowersManager._allRuneSkillAdjusts.get(runeID)) {
if(SkillsBase.getFromCache(entry.skill_type) == null)
if (PowersManager._allRuneSkillAdjusts.containsKey(runeID))
for (RuneSkillAdjustEntry entry : PowersManager._allRuneSkillAdjusts.get(runeID)) {
if (SkillsBase.getFromCache(entry.skill_type) == null)
SkillsBase.putInCache(DbManager.SkillsBaseQueries.GET_BASE_BY_NAME(entry.skill_type));
SkillsBase skillBase = SkillsBase.getFromCache(entry.skill_type);
if(skillBase == null)
if (skillBase == null)
continue;
if (entry.level <= mob.level)
if (mob.skills.containsKey(entry.name) == false)
@ -459,15 +459,15 @@ public enum NPCManager { @@ -459,15 +459,15 @@ public enum NPCManager {
}
}
public static void applyRunesForNPC(NPC npc){
public static void applyRunesForNPC(NPC npc) {
npc.runes = new ArrayList<>();
RuneBase shopkeeperBase = RuneBase.getRuneBase(252620);
CharacterRune shopkeeper = new CharacterRune(shopkeeperBase,npc.getObjectUUID());
CharacterRune shopkeeper = new CharacterRune(shopkeeperBase, npc.getObjectUUID());
npc.runes.add(shopkeeper);
if(NPCManager._runeSetMap.containsKey(npc.runeSetID)) {
if (NPCManager._runeSetMap.containsKey(npc.runeSetID)) {
for (int runeID : _runeSetMap.get(npc.runeSetID)) {
RuneBase rb = RuneBase.getRuneBase(runeID);
if(rb != null) {
if (rb != null) {
CharacterRune toApply = new CharacterRune(rb, npc.getObjectUUID());
npc.runes.add(toApply);
}

6
src/engine/gameManager/PowersManager.java

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

42
src/engine/mobileAI/MobAI.java

@ -323,7 +323,7 @@ public class MobAI { @@ -323,7 +323,7 @@ public class MobAI {
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
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION))
contractID = mob.guardCaptain.contract.getContractID();
@ -574,10 +574,10 @@ public class MobAI { @@ -574,10 +574,10 @@ public class MobAI {
//no players loaded, no need to proceed unless it's a player guard
boolean bypassLoadedPlayerCheck = false;
if(mob.isPlayerGuard() || mob.isSiege()) {
if (mob.isPlayerGuard() || mob.isSiege()) {
bypassLoadedPlayerCheck = true;
if(mob.combatTarget != null && mob.combatTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter))
if(mob.combatTarget.loc.distanceSquared(mob.loc) > 10000)
if (mob.combatTarget != null && mob.combatTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter))
if (mob.combatTarget.loc.distanceSquared(mob.loc) > 10000)
mob.setCombatTarget(null);
}
@ -845,7 +845,7 @@ public class MobAI { @@ -845,7 +845,7 @@ public class MobAI {
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;
if (mob.isPlayerGuard() && !mob.despawned) {
@ -888,12 +888,12 @@ public class MobAI { @@ -888,12 +888,12 @@ public class MobAI {
try {
if(mob.getTimestamps().containsKey("lastChase") == false)
mob.getTimestamps().put("lastChase",System.currentTimeMillis());
else if(System.currentTimeMillis() < mob.getTimestamps().get("lastChase").longValue() + (750 + ThreadLocalRandom.current().nextInt(0,500)))
return;
if (mob.getTimestamps().containsKey("lastChase") == false)
mob.getTimestamps().put("lastChase", System.currentTimeMillis());
else if (System.currentTimeMillis() < mob.getTimestamps().get("lastChase").longValue() + (750 + ThreadLocalRandom.current().nextInt(0, 500)))
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() > 15) {
@ -974,10 +974,10 @@ public class MobAI { @@ -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
if(mob.combatTarget != null)
if (mob.combatTarget != null)
CheckForAttack(mob); //only check to attack if combat target is not null
} catch (Exception e) {
@ -1128,21 +1128,21 @@ public class MobAI { @@ -1128,21 +1128,21 @@ public class MobAI {
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;
if(GuardCanAggro(mob,aggroMob)) {
mob.setCombatTarget(aggroMob);
return;
}
Mob aggroMob = (Mob) awoMob;
if (GuardCanAggro(mob, aggroMob)) {
mob.setCombatTarget(aggroMob);
return;
}
}
}
} catch (Exception e) {

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

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

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

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

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

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

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

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

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

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

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

@ -26,7 +26,9 @@ import engine.net.client.msg.ClientNetMsg; @@ -26,7 +26,9 @@ import engine.net.client.msg.ClientNetMsg;
import engine.net.client.msg.ErrorPopupMsg;
import engine.net.client.msg.guild.GuildCreationFinalizeMsg;
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;
public class GuildCreationFinalizeHandler extends AbstractClientMsgHandler {

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

@ -125,9 +125,9 @@ public class InviteToGuildHandler extends AbstractClientMsgHandler { @@ -125,9 +125,9 @@ public class InviteToGuildHandler extends AbstractClientMsgHandler {
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 135);// you do not meet the level required for this SWORN guild
return true;
}
if(ConfigManager.MB_RULESET.getValue() == "LORE") {
if (ConfigManager.MB_RULESET.getValue() == "LORE") {
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;
}
}

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

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

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

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

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

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

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

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

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

@ -30,6 +30,7 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler { @@ -30,6 +30,7 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
public ObjectActionMsgHandler() {
super(ObjectActionMsg.class);
}
@Override
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) throws MsgSendException {
@ -79,235 +80,235 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler { @@ -79,235 +80,235 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
int uuid = item.templateID;
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());
switch (item.template.item_type) {
if (zone != null) {
if (zone.guild_zone) {
loc = zone.getLoc();
}
}
case DEED: //buildings
//Call add building screen here, ib.getUseID() get's building ID
PlaceAssetMsg pam = new PlaceAssetMsg();
pam.setActionType(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);
//if inside player city, center loc on tol. otherwise center on player.
Vector3fImmutable loc = player.getLoc();
Zone zone = ZoneManager.findSmallestZone(player.getLoc());
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 (zone != null) {
if (zone.guild_zone) {
loc = zone.getLoc();
}
if (shrine.addFavor(player, item)) {
shrineBuilding.addEffectBit(1000000 << 2);
shrineBuilding.updateEffects();
shrineBuilding.removeEffectBit(1000000 << 2);
}
PlaceAssetMsg pam = new PlaceAssetMsg();
pam.setActionType(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;
case REALMCHARTER:
int charterType = 0;
switch (uuid) {
case 910020:
charterType = 762228431;
break;
case 910021:
charterType = -15978914;
break;
case 910022:
charterType = -600065291;
break;
} else if (uuid > 249999 && uuid < 250123) { //stat and mastery runes
if (ApplyRuneMsg.applyRune(uuid, origin, player)) {
itemMan.consume(item);
}
if (Realm.claimRealm(player, charterType) == true) {
break;
} else if (uuid > 250114 && uuid < 250123) { //mastery runes
if (ApplyRuneMsg.applyRune(uuid, origin, player)) {
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;
} 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) {
if (toCommand == null) {
return true;
}
int rank = uuid - 910010;
if (!toCommand.isSiege())
if (rank < 1 || rank > 8) {
ChatManager.chatSystemError(player, "Invalid Rank for bane scroll!");
return true;
}
// Only one banestone at a time
lock.writeLock().lock();
if (player.commandSiegeMinion(toCommand)) {
itemMan.consume(item);
try {
if (Bane.summonBanestone(player, origin, rank) == true)
itemMan.consume(item);
} finally {
lock.writeLock().unlock();
}
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);
} else if (uuid == 910010) { //tears of saedron
if (comps.size() > 1) {
AbstractCharacter.removeRune(player, origin, comps.get(1).intValue());
}
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;
} 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;
}
} 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
if (target.getObjectType() == Enum.GameObjectType.PlayerCharacter)
waterbucketBypass = true;
else {
// test distance to structure
Building targetBuilding = (Building) target;
Bounds testBounds = Bounds.borrow();
testBounds.setBounds(player.getLoc(), 25);
// test for valid target type
if (target.getObjectType() == Enum.GameObjectType.PlayerCharacter)
waterbucketBypass = true;
else {
// test distance to structure
Building targetBuilding = (Building) target;
Bounds testBounds = Bounds.borrow();
testBounds.setBounds(player.getLoc(), 25);
if (Bounds.collide(targetBuilding.getBounds(), testBounds, .1f) == false) {
ChatManager.chatSystemError(player, "Not in range of structura for to heal!");
return true;
}
if (Bounds.collide(targetBuilding.getBounds(), testBounds, .1f) == false) {
ChatManager.chatSystemError(player, "Not in range of structura for to heal!");
return true;
}
// Send piss bucket animation
VisualUpdateMessage vum = new VisualUpdateMessage(player, 16323);
vum.configure();
DispatchMessage.sendToAllInRange(player, vum);
}
if (waterbucketBypass == false) {
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);
// Send piss bucket animation
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);
}
VisualUpdateMessage vum = new VisualUpdateMessage(player, 16323);
vum.configure();
DispatchMessage.sendToAllInRange(player, vum);
}
if (waterbucketBypass == false) {
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);
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 {
// TODO log 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 { @@ -39,21 +39,21 @@ public class PetitionReceivedMsgHandler extends AbstractClientMsgHandler {
Petition petition = new Petition(petitionReceivedMsg, origin);
// Write petition to database
// Write petition to database
if (petitionReceivedMsg.petition == PETITION_NEW)
DbManager.PetitionQueries.WRITE_PETITION_TO_TABLE(petition);
if (petitionReceivedMsg.petition == PETITION_NEW)
DbManager.PetitionQueries.WRITE_PETITION_TO_TABLE(petition);
// Close the petition window
// Close the petition window
if (petitionReceivedMsg.petition == PETITION_NEW)
petitionReceivedMsg.petition = PETITION_CLOSE;
if (petitionReceivedMsg.petition == PETITION_NEW)
petitionReceivedMsg.petition = PETITION_CLOSE;
petitionReceivedMsg.unknownByte01 = 0;
petitionReceivedMsg.unknown04 = 0;
petitionReceivedMsg.unknownByte01 = 0;
petitionReceivedMsg.unknown04 = 0;
Dispatch dispatch = Dispatch.borrow(playerCharacter, petitionReceivedMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
Dispatch dispatch = Dispatch.borrow(playerCharacter, petitionReceivedMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
return true;
}

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

@ -59,7 +59,7 @@ public class RepairBuildingMsgHandler extends AbstractClientMsgHandler { @@ -59,7 +59,7 @@ public class RepairBuildingMsgHandler extends AbstractClientMsgHandler {
//cannot repair mines during 24/7 activity.
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; @@ -14,7 +14,6 @@ import engine.net.Dispatch;
import engine.net.DispatchMessage;
import engine.net.client.ClientConnection;
import engine.net.client.msg.*;
import engine.objects.AbstractWorldObject;
import engine.objects.Account;
import engine.objects.PlayerCharacter;
import engine.server.MBServerStatics;

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

@ -12,7 +12,10 @@ import engine.net.client.msg.ClientNetMsg; @@ -12,7 +12,10 @@ import engine.net.client.msg.ClientNetMsg;
import engine.net.client.msg.PlaceAssetMsg;
import engine.net.client.msg.TransferGoldToFromBuildingMsg;
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;
/*

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

@ -16,7 +16,10 @@ import engine.net.client.ClientConnection; @@ -16,7 +16,10 @@ import engine.net.client.ClientConnection;
import engine.net.client.msg.ApplyEffectMsg;
import engine.net.client.msg.ClientNetMsg;
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;
public class TransferItemFromEquipToInventoryHandler extends AbstractClientMsgHandler {

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

@ -19,7 +19,10 @@ import engine.net.client.msg.ApplyEffectMsg; @@ -19,7 +19,10 @@ import engine.net.client.msg.ApplyEffectMsg;
import engine.net.client.msg.ClientNetMsg;
import engine.net.client.msg.TransferItemFromEquipToInventoryMsg;
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;
public class TransferItemFromInventoryToEquipHandler extends AbstractClientMsgHandler {

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

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

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

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

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

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

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

@ -15,7 +15,10 @@ import engine.net.AbstractConnection; @@ -15,7 +15,10 @@ import engine.net.AbstractConnection;
import engine.net.ByteBufferReader;
import engine.net.ByteBufferWriter;
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

32
src/engine/objects/AbstractCharacter.java

@ -986,7 +986,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject { @@ -986,7 +986,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
return 300;
}
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;
} else if (((Mob) this).charItemManager.equipped.get(EquipSlotType.LHELD) != null) {
range = ((Mob) this).charItemManager.equipped.get(EquipSlotType.LHELD).template.item_weapon_max_range;
@ -1046,18 +1046,18 @@ public abstract class AbstractCharacter extends AbstractWorldObject { @@ -1046,18 +1046,18 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
Building building = BuildingManager.getBuildingAtLocation(this.loc);
Regions region = null;
if(building != null) {
if (building != null) {
//look for region in the building we are in
for (Regions regionCycle : building.getBounds().getRegions()) {
float regionHeight = regionCycle.highLerp.y - regionCycle.lowLerp.y;
if(regionHeight < 10)
if (regionHeight < 10)
regionHeight = 10;
if (regionCycle.isPointInPolygon(value) && Math.abs(regionCycle.highLerp.y - value.y) < regionHeight)
region = regionCycle;
}
}
float regionHeightOffset = 0;
if(region != null){
if (region != null) {
this.region = region;
regionHeightOffset = region.lerpY(this);
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 { @@ -1071,7 +1071,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
}
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
this.resetLastSetLocUpdate();
@ -1195,7 +1195,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject { @@ -1195,7 +1195,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
public final void setCombatTarget(final AbstractWorldObject value) {
if(this.getObjectTypeMask() == 2050) {//MOB?
if (this.getObjectTypeMask() == 2050) {//MOB?
if (value == null) {
if (this.isCombat()) {
this.setCombat(false);
@ -1203,7 +1203,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject { @@ -1203,7 +1203,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
rwss.setPlayer(this);
DispatchMessage.sendToAllInRange(this, rwss);
}
}else {
} else {
if (!this.isCombat()) {
this.setCombat(true);
UpdateStateMsg rwss = new UpdateStateMsg();
@ -1331,22 +1331,22 @@ public abstract class AbstractCharacter extends AbstractWorldObject { @@ -1331,22 +1331,22 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
CombatManager.handleRetaliate(this, attacker);
}
if(this.getObjectType().equals(GameObjectType.Mob)){
if (this.getObjectType().equals(GameObjectType.Mob)) {
//handle hate value addition
Mob target = (Mob)this;
Mob target = (Mob) this;
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter)) {
target.playerAgroMap.put(attacker.getObjectUUID(), target.playerAgroMap.get(attacker.getObjectUUID()) + value);
if (target.isPlayerGuard()){
if(target.guardedCity != null && target.guardedCity.cityOutlaws.contains(attacker.getObjectUUID()) == false)
if (target.isPlayerGuard()) {
if (target.guardedCity != null && target.guardedCity.cityOutlaws.contains(attacker.getObjectUUID()) == false)
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);
if(playerCity != null){
if(!attacker.getGuild().getNation().equals(playerCity.getGuild().getNation()))
if(!playerCity.getGuild().getNation().getAllyList().contains(attacker.getGuild().getNation()))
if(!playerCity.cityOutlaws.contains(attacker.getObjectUUID()))
if (playerCity != null) {
if (!attacker.getGuild().getNation().equals(playerCity.getGuild().getNation()))
if (!playerCity.getGuild().getNation().getAllyList().contains(attacker.getGuild().getNation()))
if (!playerCity.cityOutlaws.contains(attacker.getObjectUUID()))
playerCity.cityOutlaws.add(attacker.getObjectUUID());
}
}

4
src/engine/objects/AbstractWorldObject.java

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

26
src/engine/objects/City.java

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

2
src/engine/objects/Item.java

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

4
src/engine/objects/ItemBase.java

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

2
src/engine/objects/ItemTemplate.java

@ -534,7 +534,7 @@ public class ItemTemplate { @@ -534,7 +534,7 @@ public class ItemTemplate {
return false;
//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;
// Slot is taken

88
src/engine/objects/Mob.java

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

1
src/engine/objects/MobBase.java

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

8
src/engine/objects/MobBaseStats.java

@ -79,8 +79,12 @@ public class MobBaseStats { @@ -79,8 +79,12 @@ public class MobBaseStats {
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 @@ @@ -7,6 +7,7 @@
// www.magicbane.com
package engine.objects;
import engine.math.Vector3fImmutable;
import engine.net.client.ClientConnection;
import engine.net.client.msg.PetitionReceivedMsg;

14
src/engine/objects/PlayerCharacter.java

@ -4572,31 +4572,31 @@ public class PlayerCharacter extends AbstractCharacter { @@ -4572,31 +4572,31 @@ public class PlayerCharacter extends AbstractCharacter {
this.setBounds(playerBounds);
//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);
if(this.baseClass != null)
if (this.baseClass != null)
this.absBaseClass = ClassType.valueOf(this.getBaseClass().getName());
if(this.promotionClass != null)
if (this.promotionClass != null)
this.absPromotionClass = ClassType.valueOf(this.getPromotionClass().getName());
if(this.isMale())
if (this.isMale())
this.absGender = SexType.MALE;
else
this.absGender = SexType.FEMALE;
for(CharacterRune rune : this.runes){
for (CharacterRune rune : this.runes) {
try {
DisciplineType disc = DisciplineType.valueOf(RuneBase.getRuneBase(rune.getRuneBaseID()).getName().replace("-", "").replace(" ", ""));
if (disc != null) {
if(this.absDisciplines == null)
if (this.absDisciplines == null)
this.absDisciplines = EnumSet.of(disc);
else
this.absDisciplines.add(disc);
}
} catch(Exception e){
} catch (Exception e) {
}
}

3
src/engine/objects/Portal.java

@ -3,7 +3,6 @@ package engine.objects; @@ -3,7 +3,6 @@ package engine.objects;
import engine.Enum;
import engine.Enum.PortalType;
import engine.InterestManagement.WorldGrid;
import engine.gameManager.BuildingManager;
import engine.gameManager.ConfigManager;
import engine.job.JobScheduler;
import engine.jobs.CloseGateJob;
@ -105,7 +104,7 @@ public class Portal { @@ -105,7 +104,7 @@ public class Portal {
if (player.getTimeStamp("lastMoveGate") < this.lastActive)
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();
}

6
src/engine/objects/Regions.java

@ -279,7 +279,7 @@ public class Regions { @@ -279,7 +279,7 @@ public class Regions {
Building building = (Building) awo;
if (!Bounds.collide(location, building.getBounds()))
continue;
if(building != null) {
if (building != null) {
region = BuildingManager.GetRegion(building, location.x, location.y, location.z);
}
//find regions that intersect x and z, check if object can enter.
@ -289,13 +289,13 @@ public class Regions { @@ -289,13 +289,13 @@ public class Regions {
// if (region == null)
// region = toEnter;
// 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)
// region = toEnter;
// }
// }
// }
}
return region;
}

1
src/engine/powers/DamageShield.java

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

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

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

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

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

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

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