From 78f95d01731a4a856a67c70cd6512a7333415200 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Wed, 12 Mar 2025 21:07:38 -0500 Subject: [PATCH] /zerg command --- src/engine/gameManager/ChatManager.java | 5 +++ src/engine/gameManager/ZergManager.java | 43 +++++++++++++++++++++++-- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/src/engine/gameManager/ChatManager.java b/src/engine/gameManager/ChatManager.java index b2542227..5a465aaf 100644 --- a/src/engine/gameManager/ChatManager.java +++ b/src/engine/gameManager/ChatManager.java @@ -89,6 +89,11 @@ public enum ChatManager { return; } + if(msg.getMessage().equalsIgnoreCase("/zerg")){ + ZergManager.PrintDetailsToClient(pc); + return; + } + switch (protocolMsg) { case CHATSAY: ChatManager.chatSay(pc, msg.getMessage(), isFlood); diff --git a/src/engine/gameManager/ZergManager.java b/src/engine/gameManager/ZergManager.java index 90c48350..1979857f 100644 --- a/src/engine/gameManager/ZergManager.java +++ b/src/engine/gameManager/ZergManager.java @@ -1,7 +1,6 @@ package engine.gameManager; -import engine.objects.Building; -import engine.objects.Guild; -import engine.objects.Mine; +import engine.InterestManagement.WorldGrid; +import engine.objects.*; import engine.server.MBServerStatics; public class ZergManager { @@ -209,4 +208,42 @@ public class ZergManager { mine.zergTracker.processLeaveQue(); mine.zergTracker.applyMultiplier(mine.capSize); } + + public static void PrintDetailsToClient(PlayerCharacter pc){ + String outstring = "ZERG MANAGER DETAILS FOR: " + pc.getFirstName(); + String newline = "\r\n "; + Mine attended = null; + for(Mine mine : Mine.getMines()){ + Building tower = BuildingManager.getBuilding(mine.getBuildingID()); + if(tower == null) + continue; + + float rangeSquared = (MBServerStatics.CHARACTER_LOAD_RANGE * 3) * (MBServerStatics.CHARACTER_LOAD_RANGE * 3); + + if(pc.loc.distanceSquared(tower.loc) < rangeSquared){ + attended = mine; + } + } + if(attended != null){ + outstring += "Mine Cap: " + attended.capSize; + Building tower = BuildingManager.getBuilding(attended.getBuildingID()); + if(tower == null) + return; + int count = 1; + for(AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(tower.loc,MBServerStatics.CHARACTER_LOAD_RANGE * 3,MBServerStatics.MASK_PLAYER)){ + PlayerCharacter player = (PlayerCharacter)awo; + if(player.equals(pc)) + continue; + if(player.guild.getNation().equals(pc.guild.getNation())) + count ++; + } + outstring += "Nation Members Present " + count; + }else{ + outstring += "Mine: Not Within Mine Distance"; + } + + outstring += "Zerg Multiplier: " + pc.ZergMultiplier; + + ChatManager.chatSystemInfo(pc, outstring); + } }