From 03c226f76e7bd5dc807df053f42ae2eadb43c43f Mon Sep 17 00:00:00 2001 From: MagicBot Date: Thu, 28 Mar 2024 05:04:59 -0400 Subject: [PATCH] More itembase refactor --- src/engine/gameManager/ChatManager.java | 29 ++++++++++++------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/engine/gameManager/ChatManager.java b/src/engine/gameManager/ChatManager.java index 48914dc2..6e882416 100644 --- a/src/engine/gameManager/ChatManager.java +++ b/src/engine/gameManager/ChatManager.java @@ -275,7 +275,7 @@ public enum ChatManager { PlayerCharacter pcSender = null; if (sender.getObjectType().equals(GameObjectType.PlayerCharacter)) - pcSender = (PlayerCharacter) sender; + pcSender = sender; if (isFlood) { ChatManager.chatSayError(pcSender, FLOOD_USER_ERROR); @@ -597,7 +597,6 @@ public enum ChatManager { distroList.remove(awo); else if (awo.getObjectUUID() == tar.getObjectUUID()) distroList.remove(awo); - } String textToThief = ""; @@ -607,19 +606,18 @@ public enum ChatManager { if (item != null) //Steal if (success) { String name = ""; - if (item.getItemBase() != null) - if (item.getItemBase().getUUID() == 7) - name = amount + " gold "; - else { - String vowels = "aeiou"; - ItemTemplate template = ItemTemplate.templates.get(item.getTemplateID()); - String iName = template.item_base_name; - if (iName.length() > 0) - if (vowels.indexOf(iName.substring(0, 1).toLowerCase()) >= 0) - name = "an " + iName + ' '; - else - name = "a " + iName + ' '; - } + if (item.getItemBase().getUUID() == 7) + name = amount + " gold "; + else { + String vowels = "aeiou"; + ItemTemplate template = ItemTemplate.templates.get(item.getTemplateID()); + String iName = template.item_base_name; + if (iName.length() > 0) + if (vowels.indexOf(iName.substring(0, 1).toLowerCase()) >= 0) + name = "an " + iName + ' '; + else + name = "a " + iName + ' '; + } textToThief = "You have stolen " + name + "from " + tar.getFirstName() + '!'; textToVictim = sender.getFirstName() + "is caught with thier hands in your pocket!"; //textToOthers = sender.getFirstName() + " steals " + name + "from " + target.getFirstName() + "."; @@ -641,6 +639,7 @@ public enum ChatManager { //Send msg to thief HashSet senderList = new HashSet<>(); senderList.add(sender); + if (!textToThief.isEmpty()) ChatManager.chatSystemSend(senderList, textToThief, 1, 2);