From 9a570de54c4760a7ec3b8a7688ccd8b2b663b503 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Wed, 13 Mar 2024 20:03:32 -0500 Subject: [PATCH 01/27] contract and rune drop work --- src/engine/gameManager/LootManager.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/engine/gameManager/LootManager.java b/src/engine/gameManager/LootManager.java index ce892711..759dac23 100644 --- a/src/engine/gameManager/LootManager.java +++ b/src/engine/gameManager/LootManager.java @@ -127,9 +127,8 @@ public enum LootManager { case "LOOT": if (ThreadLocalRandom.current().nextInt(1, 100 + 1) < (bse.dropChance * dropRate)) GenerateLootDrop(mob, bse.genTable); //generate normal loot drop - if(ThreadLocalRandom.current().nextInt(1,101) < mob.level && mob.parentZone.getSafeZone() == 0) { - if (ThreadLocalRandom.current().nextInt(1, 10000) < mob.level) { - if (_genTables.containsKey(bse.genTable + 1)) { + if(mob.parentZone.getSafeZone() == 0) { + if (ThreadLocalRandom.current().nextInt(1, 10000) < 10) { int roll = ThreadLocalRandom.current().nextInt(1, 101); MobLoot extraLoot = null; if (roll >= 1 && roll <= 50) { @@ -144,7 +143,6 @@ public enum LootManager { if (extraLoot != null) { mob.getCharItemManager().addItemToInventory(extraLoot); } - } } } break; @@ -333,6 +331,8 @@ public enum LootManager { try { MobLoot toAdd = getGenTableItem(tableID, mob); + if(toAdd.getItemBase().getType().equals(Enum.ItemType.CONTRACT) || toAdd.getItemBase().getType().equals(Enum.ItemType.RUNE)) + return;//block all contracts and runes that drop outside the confines of the new system if (toAdd != null) { toAdd.setIsID(true); @@ -340,7 +340,6 @@ public enum LootManager { } } catch (Exception e) { //TODO chase down loot generation error, affects roughly 2% of drops - int i = 0; } } From 60230220774a2374ab07c61954edc02057e1d2c7 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Wed, 13 Mar 2024 21:23:47 -0500 Subject: [PATCH 02/27] drop rate work --- src/engine/devcmd/cmds/SimulateBootyCmd.java | 20 ++++++++++-- src/engine/gameManager/LootManager.java | 32 +++++++++++++++----- 2 files changed, 42 insertions(+), 10 deletions(-) diff --git a/src/engine/devcmd/cmds/SimulateBootyCmd.java b/src/engine/devcmd/cmds/SimulateBootyCmd.java index 7249ee3b..0701df3b 100644 --- a/src/engine/devcmd/cmds/SimulateBootyCmd.java +++ b/src/engine/devcmd/cmds/SimulateBootyCmd.java @@ -1,10 +1,12 @@ package engine.devcmd.cmds; +import engine.Enum; import engine.devcmd.AbstractDevCmd; import engine.gameManager.LootManager; import engine.gameManager.ZoneManager; import engine.loot.BootySetEntry; import engine.objects.*; +import org.pmw.tinylog.Logger; import java.util.ArrayList; import java.util.concurrent.ThreadLocalRandom; @@ -26,7 +28,9 @@ public class SimulateBootyCmd extends AbstractDevCmd { String output; output = "Booty Simulation:" + newline; - + if(target.getObjectType().equals(Enum.GameObjectType.Mob) == false){ + return;//ugh what? + } Mob mob = (Mob) target; output += "Name: " + mob.getName() + newline; output += "Special Loot:" + newline; @@ -51,7 +55,7 @@ public class SimulateBootyCmd extends AbstractDevCmd { int failures = 0; int goldAmount = 0; - for (int i = 0; i < 10000; ++i) { + for (int i = 0; i < 1000; ++i) { try { mob.loadInventory(); @@ -85,6 +89,9 @@ public class SimulateBootyCmd extends AbstractDevCmd { } } catch (Exception ex) { failures++; + //throwbackError(playerCharacter,ex.getLocalizedMessage()); + //Logger.error(ex.fillInStackTrace()); + //return; } if (mob.getEquip() != null) { for (MobEquipment me : mob.getEquip().values()) { @@ -131,8 +138,17 @@ public class SimulateBootyCmd extends AbstractDevCmd { } output += "GLASS DROPS: " + GlassItems.size() + newline; + for(Item glass : GlassItems){ + output += " " + glass.getName() + newline; + } output += "RUNE DROPS: " + Runes.size() + newline; + for(Item rune : Runes){ + output += " " + rune.getName() + newline; + } output += "CONTRACTS DROPS: " + Contracts.size() + newline; + for(Item contract : Contracts){ + output += " " + contract.getName() + newline; + } output += "RESOURCE DROPS: " + Resources.size() + newline; output += "OFFERINGS DROPPED: " + Offerings.size() + newline; output += "ENCHANTED ITEMS DROPPED: " + OtherDrops.size() + newline; diff --git a/src/engine/gameManager/LootManager.java b/src/engine/gameManager/LootManager.java index 759dac23..dd56b1e9 100644 --- a/src/engine/gameManager/LootManager.java +++ b/src/engine/gameManager/LootManager.java @@ -116,10 +116,18 @@ public enum LootManager { private static void RunBootySet(ArrayList entries, Mob mob) { float dropRate = NORMAL_DROP_RATE; - + //roll the geenric world drop table + GenerateLootDrop(mob, 1300); + if(ThreadLocalRandom.current().nextInt(1, 10000) == 5000) { + MobLoot extraLoot = rollForGlass(mob); + if (extraLoot != null) { + mob.getCharItemManager().addItemToInventory(extraLoot); + } + } // Iterate all entries in this bootySet and process accordingly - + boolean hasExtraRolled = false; for (BootySetEntry bse : entries) { + switch (bse.bootyType) { case "GOLD": GenerateGoldDrop(mob, bse); @@ -128,7 +136,7 @@ public enum LootManager { if (ThreadLocalRandom.current().nextInt(1, 100 + 1) < (bse.dropChance * dropRate)) GenerateLootDrop(mob, bse.genTable); //generate normal loot drop if(mob.parentZone.getSafeZone() == 0) { - if (ThreadLocalRandom.current().nextInt(1, 10000) < 10) { + if (hasExtraRolled == false && ThreadLocalRandom.current().nextInt(1, 10000) < 5 * dropRate) { int roll = ThreadLocalRandom.current().nextInt(1, 101); MobLoot extraLoot = null; if (roll >= 1 && roll <= 50) { @@ -137,12 +145,13 @@ public enum LootManager { if (roll >= 51 && roll <= 94) { extraLoot = rollForRune(bse.genTable, mob); } - if (roll >= 95) { - extraLoot = rollForGlass(mob); - } + //if (roll >= 95) { + // extraLoot = rollForGlass(mob); + //} if (extraLoot != null) { mob.getCharItemManager().addItemToInventory(extraLoot); } + hasExtraRolled = true; } } break; @@ -492,7 +501,10 @@ public enum LootManager { } public static MobLoot rollForContract(int table, Mob mob){ - GenTableEntry selectedRow = GenTableEntry.rollTable(table, 99, 1.0f); + int roll = 99; + if (table == 1900 || table == 1500) + roll = 73; + GenTableEntry selectedRow = GenTableEntry.rollTable(table, roll, 1.0f); if (selectedRow == null) return null; @@ -515,7 +527,11 @@ public enum LootManager { return null; } public static MobLoot rollForRune(int table, Mob mob){ - GenTableEntry selectedRow = GenTableEntry.rollTable(table, 97, 1.0f); + int roll = 97; + if(table == 1900 || table == 1500){ + roll = 77; + } + GenTableEntry selectedRow = GenTableEntry.rollTable(table, roll, 1.0f); if (selectedRow == null) return null; From c2e0979dc359ac28ef4927f53ec4c4962113159b Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Wed, 13 Mar 2024 21:51:55 -0500 Subject: [PATCH 03/27] drop rate work --- src/engine/devcmd/cmds/SimulateBootyCmd.java | 8 ++++++-- src/engine/gameManager/LootManager.java | 8 ++++++-- src/engine/mobileAI/MobAI.java | 3 +++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/engine/devcmd/cmds/SimulateBootyCmd.java b/src/engine/devcmd/cmds/SimulateBootyCmd.java index 0701df3b..c80ef070 100644 --- a/src/engine/devcmd/cmds/SimulateBootyCmd.java +++ b/src/engine/devcmd/cmds/SimulateBootyCmd.java @@ -55,7 +55,7 @@ public class SimulateBootyCmd extends AbstractDevCmd { int failures = 0; int goldAmount = 0; - for (int i = 0; i < 1000; ++i) { + for (int i = 0; i < 10000; ++i) { try { mob.loadInventory(); @@ -83,7 +83,11 @@ public class SimulateBootyCmd extends AbstractDevCmd { goldAmount += lootItem.getNumOfItems(); break; default: - OtherDrops.add(lootItem); + if(Warehouse.maxResources.containsKey(lootItem.getItemBaseID())){ + Resources.add(lootItem); + } else { + OtherDrops.add(lootItem); + } break; } } diff --git a/src/engine/gameManager/LootManager.java b/src/engine/gameManager/LootManager.java index dd56b1e9..c122420d 100644 --- a/src/engine/gameManager/LootManager.java +++ b/src/engine/gameManager/LootManager.java @@ -200,9 +200,13 @@ public enum LootManager { if (ItemBase.getItemBase(itemUUID).getType().ordinal() == Enum.ItemType.RESOURCE.ordinal()) { int chance = ThreadLocalRandom.current().nextInt(1,101); - if(chance > 5) + if(chance > 10) return null; - int amount = ThreadLocalRandom.current().nextInt(tableRow.minSpawn, tableRow.maxSpawn + 1); + int amount = ThreadLocalRandom.current().nextInt((int)(tableRow.minSpawn * 0.5f), (int)((tableRow.maxSpawn + 1) * 0.5f)); + ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " HAS FOUND " + amount + " " + ItemBase.getItemBase(itemUUID).getName() + ". "); + chatMsg.setMessageType(10); + chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID()); + DispatchMessage.dispatchMsgToAll(chatMsg); return new MobLoot(mob, ItemBase.getItemBase(itemUUID), amount, false); } diff --git a/src/engine/mobileAI/MobAI.java b/src/engine/mobileAI/MobAI.java index c4ccb590..7c70235f 100644 --- a/src/engine/mobileAI/MobAI.java +++ b/src/engine/mobileAI/MobAI.java @@ -249,6 +249,9 @@ public class MobAI { if(target.isPet() && target.isAlive() == false && target.guardCaptain.isAlive() == true){ mob.setCombatTarget(target.guardCaptain); } + if(target.level > 75){ + AttackMob(target,mob); + } } catch (Exception e) { Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackMob" + " " + e.getMessage()); } From 6fe8b80c871e26d62cf32e86a04a466f9728ddcd Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 14 Mar 2024 18:54:03 -0500 Subject: [PATCH 04/27] remove resource drop server announcement --- src/engine/gameManager/LootManager.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/engine/gameManager/LootManager.java b/src/engine/gameManager/LootManager.java index c122420d..855b1285 100644 --- a/src/engine/gameManager/LootManager.java +++ b/src/engine/gameManager/LootManager.java @@ -203,10 +203,6 @@ public enum LootManager { if(chance > 10) return null; int amount = ThreadLocalRandom.current().nextInt((int)(tableRow.minSpawn * 0.5f), (int)((tableRow.maxSpawn + 1) * 0.5f)); - ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " HAS FOUND " + amount + " " + ItemBase.getItemBase(itemUUID).getName() + ". "); - chatMsg.setMessageType(10); - chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID()); - DispatchMessage.dispatchMsgToAll(chatMsg); return new MobLoot(mob, ItemBase.getItemBase(itemUUID), amount, false); } From 8890e02981281d3d9e0091f4844eb9cc5c7ff432 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 14 Mar 2024 18:55:23 -0500 Subject: [PATCH 05/27] mobs attack pets --- src/engine/mobileAI/MobAI.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/mobileAI/MobAI.java b/src/engine/mobileAI/MobAI.java index 7c70235f..5c859969 100644 --- a/src/engine/mobileAI/MobAI.java +++ b/src/engine/mobileAI/MobAI.java @@ -249,7 +249,7 @@ public class MobAI { if(target.isPet() && target.isAlive() == false && target.guardCaptain.isAlive() == true){ mob.setCombatTarget(target.guardCaptain); } - if(target.level > 75){ + if(mob.isPet()){ AttackMob(target,mob); } } catch (Exception e) { From 92436be3f9e66646f40e97e5ba4792c208926c8a Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 14 Mar 2024 18:59:49 -0500 Subject: [PATCH 06/27] vorg droppers increased difficulty --- src/engine/objects/Mob.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 0824f8a1..30941bc3 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -1736,6 +1736,14 @@ public class Mob extends AbstractIntelligenceAgent { if(this.behaviourType.equals(MobBehaviourType.HamletGuard) && this.getMobBaseID() == 14104) {//guards this.behaviourType = MobBehaviourType.Aggro; } + + for(MobEquipment equipped: this.equip.values()){ + if(equipped.getItemBase().isVorg()){ + this.healthMax = 7500; + this.setHealth(this.healthMax); + this.level = 65; + } + } } @Override From a492e833e84f226ea8b1e6d0e343e2ac7e8cd458 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 14 Mar 2024 19:04:57 -0500 Subject: [PATCH 07/27] disc droppers spawn 6 hours apart --- src/engine/mobileAI/MobAI.java | 5 +---- src/engine/server/world/WorldServer.java | 6 +++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/engine/mobileAI/MobAI.java b/src/engine/mobileAI/MobAI.java index 5c859969..f4d47bce 100644 --- a/src/engine/mobileAI/MobAI.java +++ b/src/engine/mobileAI/MobAI.java @@ -855,9 +855,6 @@ public class MobAI { private static void CheckForRespawn(Mob aiAgent) { try { - if(Mob.disciplineDroppers.contains(aiAgent) == true){ - return; // disc dropper respawns handled elsewhere - } if (aiAgent.deathTime == 0) { aiAgent.setDeathTime(System.currentTimeMillis()); return; @@ -894,7 +891,7 @@ public class MobAI { } } else if (System.currentTimeMillis() > (aiAgent.deathTime + (aiAgent.spawnTime * 1000))) { - if (Zone.respawnQue.contains(aiAgent) == false) { + if (Zone.respawnQue.contains(aiAgent) == false && Mob.disciplineDroppers.contains(aiAgent) == false){ Zone.respawnQue.add(aiAgent); } } diff --git a/src/engine/server/world/WorldServer.java b/src/engine/server/world/WorldServer.java index 1b9990de..32c710b5 100644 --- a/src/engine/server/world/WorldServer.java +++ b/src/engine/server/world/WorldServer.java @@ -201,7 +201,7 @@ public class WorldServer { LocalDateTime nextHeartbeatTime = LocalDateTime.now(); LocalDateTime nextPopulationFileTime = LocalDateTime.now(); LocalDateTime nextFlashTrashCheckTime = LocalDateTime.now(); - LocalDateTime nextHourlyJobTime = LocalDateTime.now().withMinute(0).withSecond(0).plusHours(1); + LocalDateTime nextHourlyJobTime = LocalDateTime.now().withMinute(0).withSecond(0).plusHours(0); LocalDateTime nextWareHousePushTime = LocalDateTime.now(); LocalDateTime nextDiscSpawn = LocalDateTime.now().withMinute(0).withSecond(0).plusHours(1); @@ -236,7 +236,7 @@ public class WorldServer { //}else{ // nextHourlyJobTime = LocalDateTime.now().withMinute(30).withSecond(0); //} - nextHourlyJobTime = LocalDateTime.now().plusMinutes(1); + nextHourlyJobTime = nextHourlyJobTime.plusMinutes(30); } if (LocalDateTime.now().isAfter(nextWareHousePushTime)) { @@ -252,7 +252,7 @@ public class WorldServer { dropper.respawn(); } } - nextDiscSpawn = LocalDateTime.now().plusHours(3).withMinute(0).withSecond(0); + nextDiscSpawn = LocalDateTime.now().plusHours(6).withMinute(0).withSecond(0); } ThreadUtils.sleep(50); } From 5bfeafe8bff260897416fe85e6a29486e436380e Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 14 Mar 2024 19:13:58 -0500 Subject: [PATCH 08/27] fixed scourge mother vorg drops --- src/engine/gameManager/LootManager.java | 2 +- src/engine/objects/Mob.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/engine/gameManager/LootManager.java b/src/engine/gameManager/LootManager.java index 855b1285..367242ad 100644 --- a/src/engine/gameManager/LootManager.java +++ b/src/engine/gameManager/LootManager.java @@ -393,7 +393,7 @@ public enum LootManager { dropCount = 1; //break; // Exit on first successful roll. } - if(ml != null && genericIB.isVorg()){ + if(ml != null && genericIB.isVorg() && mob.getMobBaseID() != 14062){ ml.setIsID(true); ml.setDurabilityCurrent(ml.getDurabilityMax()); mob.getCharItemManager().addItemToInventory(ml); diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 30941bc3..1661d9cf 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -1738,7 +1738,7 @@ public class Mob extends AbstractIntelligenceAgent { } for(MobEquipment equipped: this.equip.values()){ - if(equipped.getItemBase().isVorg()){ + if(equipped.getItemBase().isVorg() && this.getMobBaseID() != 14062){ this.healthMax = 7500; this.setHealth(this.healthMax); this.level = 65; From 678e45ce6b4073b425f7081199182b5057dd3474 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 14 Mar 2024 19:20:25 -0500 Subject: [PATCH 09/27] 2am daily reboot --- src/engine/server/world/WorldServer.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/engine/server/world/WorldServer.java b/src/engine/server/world/WorldServer.java index 32c710b5..0b348715 100644 --- a/src/engine/server/world/WorldServer.java +++ b/src/engine/server/world/WorldServer.java @@ -196,7 +196,7 @@ public class WorldServer { } } - private int exec() { + private int exec() throws IOException { LocalDateTime nextHeartbeatTime = LocalDateTime.now(); LocalDateTime nextPopulationFileTime = LocalDateTime.now(); @@ -210,7 +210,12 @@ public class WorldServer { this.isRunning = true; while (true) { - + LocalDateTime currentTime = LocalDateTime.now(); + if(currentTime.getHour() == 2 && currentTime.getMinute() == 0){ + //daily reboot + Runtime rt = Runtime.getRuntime(); + rt.exec("./mbrestart.sh"); + } if (LocalDateTime.now().isAfter(nextHeartbeatTime)) { SERVERHEARTBEAT.tick(); nextHeartbeatTime = LocalDateTime.now().plusNanos(50000000); From 71687e39c8a5e309c035c26ad8c8064ce7d7a514 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 14 Mar 2024 19:20:43 -0500 Subject: [PATCH 10/27] 2am daily reboot --- src/engine/server/world/WorldServer.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/engine/server/world/WorldServer.java b/src/engine/server/world/WorldServer.java index 0b348715..3dca8c97 100644 --- a/src/engine/server/world/WorldServer.java +++ b/src/engine/server/world/WorldServer.java @@ -213,8 +213,12 @@ public class WorldServer { LocalDateTime currentTime = LocalDateTime.now(); if(currentTime.getHour() == 2 && currentTime.getMinute() == 0){ //daily reboot - Runtime rt = Runtime.getRuntime(); - rt.exec("./mbrestart.sh"); + try { + Runtime rt = Runtime.getRuntime(); + rt.exec("./mbrestart.sh"); + } catch (java.io.IOException err) { + Logger.info(err.getMessage()); + } } if (LocalDateTime.now().isAfter(nextHeartbeatTime)) { SERVERHEARTBEAT.tick(); From a8c768931e5e49cb000078119d071d1261f0a170 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 14 Mar 2024 19:21:21 -0500 Subject: [PATCH 11/27] 2am daily reboot --- src/engine/server/world/WorldServer.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/engine/server/world/WorldServer.java b/src/engine/server/world/WorldServer.java index 3dca8c97..a859e3f5 100644 --- a/src/engine/server/world/WorldServer.java +++ b/src/engine/server/world/WorldServer.java @@ -210,6 +210,11 @@ public class WorldServer { this.isRunning = true; while (true) { + if (LocalDateTime.now().isAfter(nextHeartbeatTime)) { + SERVERHEARTBEAT.tick(); + nextHeartbeatTime = LocalDateTime.now().plusNanos(50000000); + } + LocalDateTime currentTime = LocalDateTime.now(); if(currentTime.getHour() == 2 && currentTime.getMinute() == 0){ //daily reboot @@ -220,10 +225,6 @@ public class WorldServer { Logger.info(err.getMessage()); } } - if (LocalDateTime.now().isAfter(nextHeartbeatTime)) { - SERVERHEARTBEAT.tick(); - nextHeartbeatTime = LocalDateTime.now().plusNanos(50000000); - } if (LocalDateTime.now().isAfter(nextPopulationFileTime)) { writePopulationFile(); From 54b7bcf9072033709afcf06ade46e61745714afc Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 14 Mar 2024 19:40:07 -0500 Subject: [PATCH 12/27] pet buffs castable again --- src/engine/gameManager/PowersManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/engine/gameManager/PowersManager.java b/src/engine/gameManager/PowersManager.java index b81534a5..3d4aac1a 100644 --- a/src/engine/gameManager/PowersManager.java +++ b/src/engine/gameManager/PowersManager.java @@ -2487,11 +2487,11 @@ public enum PowersManager { ChatManager.chatSystemInfo(pc, outmsg); return false; // can't target player, stop here } // target is mob - else if ((target.getObjectTypeMask() & MBServerStatics.MASK_MOB) != 0) + else if ((target.getObjectTypeMask() & MBServerStatics.MASK_MOB) != 0 && ((Mob)target).isPet() == false) return pb.targetMob(); // target is pet - else if ((target.getObjectTypeMask() & MBServerStatics.MASK_PET) != 0) + else if ((target.getObjectTypeMask() & MBServerStatics.MASK_MOB) != 0 && ((Mob)target).isPet() == true) return pb.targetPet(); // target is Building From 1ae1deabdcfad703eec41d7a1ddd2a789222edcd Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 14 Mar 2024 20:48:38 -0500 Subject: [PATCH 13/27] daily auto reboot --- src/engine/server/world/WorldServer.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/engine/server/world/WorldServer.java b/src/engine/server/world/WorldServer.java index a859e3f5..652b7004 100644 --- a/src/engine/server/world/WorldServer.java +++ b/src/engine/server/world/WorldServer.java @@ -210,13 +210,7 @@ public class WorldServer { this.isRunning = true; while (true) { - if (LocalDateTime.now().isAfter(nextHeartbeatTime)) { - SERVERHEARTBEAT.tick(); - nextHeartbeatTime = LocalDateTime.now().plusNanos(50000000); - } - - LocalDateTime currentTime = LocalDateTime.now(); - if(currentTime.getHour() == 2 && currentTime.getMinute() == 0){ + if(LocalDateTime.now().getHour() == 21 && LocalDateTime.now().getMinute() == 48){ //daily reboot try { Runtime rt = Runtime.getRuntime(); @@ -226,6 +220,11 @@ public class WorldServer { } } + if (LocalDateTime.now().isAfter(nextHeartbeatTime)) { + SERVERHEARTBEAT.tick(); + nextHeartbeatTime = LocalDateTime.now().plusNanos(50000000); + } + if (LocalDateTime.now().isAfter(nextPopulationFileTime)) { writePopulationFile(); nextPopulationFileTime = LocalDateTime.now().plusMinutes(1); From 74eff825b0faf5b9f348bf248322eaf95a0a0ced Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 14 Mar 2024 20:50:17 -0500 Subject: [PATCH 14/27] daily auto reboot --- src/engine/server/world/WorldServer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/server/world/WorldServer.java b/src/engine/server/world/WorldServer.java index 652b7004..fe53aba9 100644 --- a/src/engine/server/world/WorldServer.java +++ b/src/engine/server/world/WorldServer.java @@ -210,7 +210,7 @@ public class WorldServer { this.isRunning = true; while (true) { - if(LocalDateTime.now().getHour() == 21 && LocalDateTime.now().getMinute() == 48){ + if(LocalDateTime.now().getHour() == 21 && LocalDateTime.now().getMinute() == 55){ //daily reboot try { Runtime rt = Runtime.getRuntime(); From 1be6884ab0c93f62fa26eb59677b14f4fa6c8c36 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 14 Mar 2024 20:53:12 -0500 Subject: [PATCH 15/27] conc removal --- src/engine/objects/PlayerCharacter.java | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index 3f6ffccc..6687683a 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -4801,17 +4801,6 @@ public class PlayerCharacter extends AbstractCharacter { //} if(this.isEnteredWorld() && this.isActive() && this.getLevel() < 10){ this.setLevel((short) 10); - boolean hasConc = false; - for(Item i : this.getCharItemManager().getInventory()){ - if(i.getItemBaseID() == 980066){ - hasConc = true; - } - } - if(hasConc == false) { - MobLoot conc = new MobLoot(this, ItemBase.getItemBase(980066), false); - this.getCharItemManager().addItemToInventory(conc.promoteToItem(this), 1); - this.getCharItemManager().updateInventory(); - } } } catch (Exception e) { From 4d28cd2b2590f653e6e9d00f3d048b31dcf128b3 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 14 Mar 2024 20:55:33 -0500 Subject: [PATCH 16/27] daily reboot --- src/engine/server/world/WorldServer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/server/world/WorldServer.java b/src/engine/server/world/WorldServer.java index fe53aba9..49ce5e30 100644 --- a/src/engine/server/world/WorldServer.java +++ b/src/engine/server/world/WorldServer.java @@ -210,7 +210,7 @@ public class WorldServer { this.isRunning = true; while (true) { - if(LocalDateTime.now().getHour() == 21 && LocalDateTime.now().getMinute() == 55){ + if(LocalDateTime.now().getHour() == 2 && LocalDateTime.now().getMinute() == 0){ //daily reboot try { Runtime rt = Runtime.getRuntime(); From 4d21fc03530a6a813831f6212014707a28417f8f Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 14 Mar 2024 20:56:34 -0500 Subject: [PATCH 17/27] daily reboot removal --- src/engine/server/world/WorldServer.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/engine/server/world/WorldServer.java b/src/engine/server/world/WorldServer.java index 49ce5e30..84193fbb 100644 --- a/src/engine/server/world/WorldServer.java +++ b/src/engine/server/world/WorldServer.java @@ -210,15 +210,6 @@ public class WorldServer { this.isRunning = true; while (true) { - if(LocalDateTime.now().getHour() == 2 && LocalDateTime.now().getMinute() == 0){ - //daily reboot - try { - Runtime rt = Runtime.getRuntime(); - rt.exec("./mbrestart.sh"); - } catch (java.io.IOException err) { - Logger.info(err.getMessage()); - } - } if (LocalDateTime.now().isAfter(nextHeartbeatTime)) { SERVERHEARTBEAT.tick(); From 4cb0f28e57f8c41c54d8f895dee4d4f1586269e7 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 14 Mar 2024 21:06:26 -0500 Subject: [PATCH 18/27] resource dupe --- src/engine/objects/CharacterItemManager.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/engine/objects/CharacterItemManager.java b/src/engine/objects/CharacterItemManager.java index 3acec039..20b0e060 100644 --- a/src/engine/objects/CharacterItemManager.java +++ b/src/engine/objects/CharacterItemManager.java @@ -1268,7 +1268,9 @@ public class CharacterItemManager { for(Item item : purge){ count += item.getNumOfItems(); this.removeItemFromInventory(item); + item.setOwner(null); item.junk(); + } Item resource = new MobLoot(this.getOwner(),i.getItemBase(),count,false).promoteToItem((PlayerCharacter)this.getOwner()); this.inventory.add(resource); From 8c6637663df40c14b49da5d44d7389d33e7c6824 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 14 Mar 2024 21:22:34 -0500 Subject: [PATCH 19/27] resource dupe --- src/engine/objects/CharacterItemManager.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/engine/objects/CharacterItemManager.java b/src/engine/objects/CharacterItemManager.java index 20b0e060..5861ea6e 100644 --- a/src/engine/objects/CharacterItemManager.java +++ b/src/engine/objects/CharacterItemManager.java @@ -1267,9 +1267,9 @@ public class CharacterItemManager { } for(Item item : purge){ count += item.getNumOfItems(); - this.removeItemFromInventory(item); - item.setOwner(null); - item.junk(); + //this.removeItemFromInventory(item); + //item.setOwner(null); + junk(item); } Item resource = new MobLoot(this.getOwner(),i.getItemBase(),count,false).promoteToItem((PlayerCharacter)this.getOwner()); From edd7be8734b3670b591bf45643798920f8c96205 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 14 Mar 2024 21:29:47 -0500 Subject: [PATCH 20/27] resource dupe --- src/engine/objects/CharacterItemManager.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/engine/objects/CharacterItemManager.java b/src/engine/objects/CharacterItemManager.java index 5861ea6e..f1f45c95 100644 --- a/src/engine/objects/CharacterItemManager.java +++ b/src/engine/objects/CharacterItemManager.java @@ -1257,25 +1257,17 @@ public class CharacterItemManager { } if(ItemBase.getItemBase(i.getItemBaseID()).getType().ordinal() == Enum.ItemType.RESOURCE.ordinal()) { int count = i.getNumOfItems(); - ArrayList purge = new ArrayList<>(); for(Item item : this.inventory){ if(item.getItemBaseID() == i.getItemBaseID()){ if(item.getNumOfItems() + count <= Warehouse.getMaxResources().get(i.getItemBaseID())){ - purge.add(item); + count += item.getNumOfItems(); + delete(item); } } } - for(Item item : purge){ - count += item.getNumOfItems(); - //this.removeItemFromInventory(item); - //item.setOwner(null); - junk(item); - - } Item resource = new MobLoot(this.getOwner(),i.getItemBase(),count,false).promoteToItem((PlayerCharacter)this.getOwner()); this.inventory.add(resource); this.itemIDtoType.put(resource.getObjectUUID(), resource.getObjectType().ordinal()); - this.updateInventory(purge,false); return true; } this.inventory.add(i); From 2d93e408c3e4fbe63c1c304eb6791a45b544dde7 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 14 Mar 2024 21:43:32 -0500 Subject: [PATCH 21/27] resource dupe --- src/engine/net/client/ClientMessagePump.java | 24 ++++++++++++++++---- src/engine/objects/CharacterItemManager.java | 16 +------------ 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/engine/net/client/ClientMessagePump.java b/src/engine/net/client/ClientMessagePump.java index 8c305915..45095cbb 100644 --- a/src/engine/net/client/ClientMessagePump.java +++ b/src/engine/net/client/ClientMessagePump.java @@ -1444,11 +1444,25 @@ public class ClientMessagePump implements NetMsgHandler { return; } - buy = Item.createItemForPlayer(sourcePlayer, ib); - if (buy != null) { - me.transferEnchants(buy); - itemMan.addItemToInventory(buy); - //itemMan.updateInventory(); + if(ib.getType().ordinal() == Enum.ItemType.RESOURCE.ordinal()) { + int count = 1; + for(Item item : itemMan.getInventory()){ + if(item.getItemBaseID() == ib.getUUID()){ + if(item.getNumOfItems() + count <= Warehouse.getMaxResources().get(ib.getUUID())){ + count += item.getNumOfItems(); + itemMan.delete(item); + } + } + } + Item resource = new MobLoot(sourcePlayer,ib,count,false).promoteToItem(sourcePlayer); + itemMan.addItemToInventory(resource); + }else { + buy = Item.createItemForPlayer(sourcePlayer, ib); + if (buy != null) { + me.transferEnchants(buy); + itemMan.addItemToInventory(buy); + //itemMan.updateInventory(); + } } } } diff --git a/src/engine/objects/CharacterItemManager.java b/src/engine/objects/CharacterItemManager.java index f1f45c95..0b664877 100644 --- a/src/engine/objects/CharacterItemManager.java +++ b/src/engine/objects/CharacterItemManager.java @@ -1255,21 +1255,7 @@ public class CharacterItemManager { return false; } } - if(ItemBase.getItemBase(i.getItemBaseID()).getType().ordinal() == Enum.ItemType.RESOURCE.ordinal()) { - int count = i.getNumOfItems(); - for(Item item : this.inventory){ - if(item.getItemBaseID() == i.getItemBaseID()){ - if(item.getNumOfItems() + count <= Warehouse.getMaxResources().get(i.getItemBaseID())){ - count += item.getNumOfItems(); - delete(item); - } - } - } - Item resource = new MobLoot(this.getOwner(),i.getItemBase(),count,false).promoteToItem((PlayerCharacter)this.getOwner()); - this.inventory.add(resource); - this.itemIDtoType.put(resource.getObjectUUID(), resource.getObjectType().ordinal()); - return true; - } + this.inventory.add(i); this.itemIDtoType.put(i.getObjectUUID(), i.getObjectType().ordinal()); return true; From 512aba5cd967fddee77b7ddd9145dc20ede0ef02 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 14 Mar 2024 21:47:27 -0500 Subject: [PATCH 22/27] resource dupe --- src/engine/net/client/ClientMessagePump.java | 29 +++++--------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/src/engine/net/client/ClientMessagePump.java b/src/engine/net/client/ClientMessagePump.java index 45095cbb..069e7b1b 100644 --- a/src/engine/net/client/ClientMessagePump.java +++ b/src/engine/net/client/ClientMessagePump.java @@ -1408,7 +1408,7 @@ public class ClientMessagePump implements NetMsgHandler { } int cost = me.getMagicValue(); int resourceCost = Warehouse.getCostForResource(me.getItemBase().getUUID()); - if(resourceCost != 0) + if (resourceCost != 0) cost = resourceCost; float bargain = sourcePlayer.getBargain(); @@ -1440,29 +1440,14 @@ public class ClientMessagePump implements NetMsgHandler { if (!itemMan.buyFromNPC(b, cost, buildingDeposit)) { // chatMan.chatSystemInfo(pc, "" + "You Failed to buy the item."); - ChatManager.chatSystemError(sourcePlayer,"Failed To Buy Item"); + ChatManager.chatSystemError(sourcePlayer, "Failed To Buy Item"); return; } - - if(ib.getType().ordinal() == Enum.ItemType.RESOURCE.ordinal()) { - int count = 1; - for(Item item : itemMan.getInventory()){ - if(item.getItemBaseID() == ib.getUUID()){ - if(item.getNumOfItems() + count <= Warehouse.getMaxResources().get(ib.getUUID())){ - count += item.getNumOfItems(); - itemMan.delete(item); - } - } - } - Item resource = new MobLoot(sourcePlayer,ib,count,false).promoteToItem(sourcePlayer); - itemMan.addItemToInventory(resource); - }else { - buy = Item.createItemForPlayer(sourcePlayer, ib); - if (buy != null) { - me.transferEnchants(buy); - itemMan.addItemToInventory(buy); - //itemMan.updateInventory(); - } + buy = Item.createItemForPlayer(sourcePlayer, ib); + if (buy != null) { + me.transferEnchants(buy); + itemMan.addItemToInventory(buy); + //itemMan.updateInventory(); } } } From 77e9a4d9bf6425e51c46257b51c21562a234b66c Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 14 Mar 2024 22:00:09 -0500 Subject: [PATCH 23/27] resource dupe --- src/engine/objects/CharacterItemManager.java | 26 +++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/engine/objects/CharacterItemManager.java b/src/engine/objects/CharacterItemManager.java index 0b664877..df143179 100644 --- a/src/engine/objects/CharacterItemManager.java +++ b/src/engine/objects/CharacterItemManager.java @@ -1254,13 +1254,37 @@ public class CharacterItemManager { } return false; } + } else if (i.getItemBase().getType().equals(ItemType.RESOURCE)) { + if(this.inventoryContainsResource(i)){ + Item resource = getResource(i); + if(resource != null){ + resource.setNumOfItems(resource.getNumOfItems() + i.getNumOfItems()); + return true; + } + } } - + this.inventory.add(i); this.itemIDtoType.put(i.getObjectUUID(), i.getObjectType().ordinal()); return true; } + private boolean inventoryContainsResource(Item resource) { + for(Item i : this.inventory){ + if(i.getItemBaseID() == resource.getItemBaseID()) + return true; + } + return false; + } + + private Item getResource(Item resource) { + for(Item i : this.inventory){ + if(i.getItemBaseID() == resource.getItemBaseID()) + return i; + } + return null; + } + //called for adding gold of a specified amount public synchronized boolean addItemToInventory(Item i, int amount) { if (i.getItemBase().getType().equals(ItemType.GOLD)) From b343f4d6d75232aa4cf79887569c8242d0493b37 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 14 Mar 2024 22:05:21 -0500 Subject: [PATCH 24/27] resource dupe --- src/engine/objects/CharacterItemManager.java | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/engine/objects/CharacterItemManager.java b/src/engine/objects/CharacterItemManager.java index df143179..5e92e112 100644 --- a/src/engine/objects/CharacterItemManager.java +++ b/src/engine/objects/CharacterItemManager.java @@ -1254,16 +1254,16 @@ public class CharacterItemManager { } return false; } - } else if (i.getItemBase().getType().equals(ItemType.RESOURCE)) { - if(this.inventoryContainsResource(i)){ - Item resource = getResource(i); - if(resource != null){ - resource.setNumOfItems(resource.getNumOfItems() + i.getNumOfItems()); - return true; - } - } - } - + } //else if (i.getItemBase().getType().equals(ItemType.RESOURCE)) { + // if(this.inventoryContainsResource(i)){ + // Item resource = getResource(i); + // if(resource != null){ + // resource.setNumOfItems(resource.getNumOfItems() + i.getNumOfItems()); + // return true; + // } + //} + // } + this.inventory.add(i); this.itemIDtoType.put(i.getObjectUUID(), i.getObjectType().ordinal()); return true; From 77fda6a18c4b74fe11e6705825f2f583026d24bf Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 17 Mar 2024 16:04:30 -0500 Subject: [PATCH 25/27] altered atr vs def formula --- src/engine/gameManager/CombatManager.java | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/engine/gameManager/CombatManager.java b/src/engine/gameManager/CombatManager.java index 656a6b52..72c0282a 100644 --- a/src/engine/gameManager/CombatManager.java +++ b/src/engine/gameManager/CombatManager.java @@ -645,16 +645,7 @@ public enum CombatManager { errorTrack = 4; //Get hit chance - - int chance; - float dif = atr - defense; - - if (dif > 100) - chance = 94; - else if (dif < -100) - chance = 4; - else - chance = (int) ((0.45 * dif) + 49); + int chance = (int)((atr-((atr+defense)*0.33f))/((defense-((atr+defense)*0.33f))+(atr-((atr+defense)*0.33f)))) * 100; errorTrack = 5; From 7dfc1dea0f0a2de610e382804c23de55e0845210 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 17 Mar 2024 16:07:15 -0500 Subject: [PATCH 26/27] fortitudes handled after resist calculations --- src/engine/objects/Resists.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/engine/objects/Resists.java b/src/engine/objects/Resists.java index e72b1827..46ed5cf0 100644 --- a/src/engine/objects/Resists.java +++ b/src/engine/objects/Resists.java @@ -393,8 +393,6 @@ public class Resists { * Expects heals as negative damage and damage as positive damage for fortitudes. */ public float getResistedDamage(AbstractCharacter source, AbstractCharacter target, DamageType type, float damage, int trains) { - //handle fortitudes - damage = handleFortitude(target, type, damage); //calculate armor piercing float ap = source.getBonuses().getFloatPercentAll(ModType.ArmorPiercing, SourceType.None); float damageAfterResists = damage * (1 - (this.getResist(type, trains) * 0.01f) + ap); @@ -417,6 +415,8 @@ public class Resists { } target.cancelOnTakeDamage(type, (damageAfterResists)); } + //handle fortitudes last + damageAfterResists = handleFortitude(target, type, damageAfterResists); return damageAfterResists; } From c304a59d95d351e598dae561e8e23d441d182e0c Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 17 Mar 2024 16:17:33 -0500 Subject: [PATCH 27/27] See Invis Bug Addressed --- src/engine/mobileAI/MobAI.java | 16 +++++++++++++--- src/engine/objects/PlayerCharacter.java | 4 +++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/engine/mobileAI/MobAI.java b/src/engine/mobileAI/MobAI.java index f4d47bce..748ca798 100644 --- a/src/engine/mobileAI/MobAI.java +++ b/src/engine/mobileAI/MobAI.java @@ -48,7 +48,12 @@ public class MobAI { mob.setCombatTarget(null); return; } - + if (target.getObjectType() == Enum.GameObjectType.PlayerCharacter){ + if(((PlayerCharacter)target).getHidden() > 0){ + mob.setCombatTarget(null); + return; + } + } if (target.getObjectType() == Enum.GameObjectType.PlayerCharacter && canCast(mob)) { if (mob.isPlayerGuard() == false && MobCast(mob)) { @@ -736,7 +741,7 @@ public class MobAI { //Player is Dead, Mob no longer needs to attempt to aggro. Remove them from aggro map. - if (!loadedPlayer.isAlive()) { + if (!loadedPlayer.isAlive() || loadedPlayer.getHidden() > 0) { loadedPlayers.remove(playerID); continue; } @@ -978,7 +983,12 @@ public class MobAI { private static void chaseTarget(Mob mob) { try { - + if (mob.combatTarget.getObjectType() == Enum.GameObjectType.PlayerCharacter){ + if(((PlayerCharacter)mob.combatTarget).getHidden() > 0){ + mob.setCombatTarget(null); + return; + } + } float rangeSquared = mob.getRange() * mob.getRange(); float distanceSquared = mob.getLoc().distanceSquared2D(mob.getCombatTarget().getLoc()); diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index 6687683a..9db242d2 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -3324,7 +3324,9 @@ public class PlayerCharacter extends AbstractCharacter { if (this.equals(tar)) return true; - + if(this.getSeeInvis() >= 20){ + return !tar.safemodeInvis(); + } return this.getSeeInvis() >= tar.hidden && !tar.safemodeInvis(); }