aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Chat/Chat.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Chat/Chat.cpp')
-rw-r--r--src/server/game/Chat/Chat.cpp75
1 files changed, 3 insertions, 72 deletions
diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp
index b1b1a221c2f..832d14631bc 100644
--- a/src/server/game/Chat/Chat.cpp
+++ b/src/server/game/Chat/Chat.cpp
@@ -22,18 +22,15 @@
#include "ChatCommand.h"
#include "ChatPackets.h"
#include "Common.h"
-#include "DatabaseEnv.h"
-#include "DB2Stores.h"
#include "GridNotifiersImpl.h"
#include "Group.h"
#include "Language.h"
-#include "Log.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Optional.h"
#include "Player.h"
#include "Realm.h"
-#include "ScriptMgr.h"
+#include "StringConvert.h"
#include "World.h"
#include "WorldSession.h"
#include <boost/algorithm/string/replace.hpp>
@@ -413,72 +410,6 @@ Creature* ChatHandler::GetCreatureFromPlayerMapByDbGuid(ObjectGuid::LowType lowg
return creature;
}
-enum SpellLinkType
-{
- SPELL_LINK_SPELL = 0,
- SPELL_LINK_TALENT = 1,
- SPELL_LINK_ENCHANT = 2,
- SPELL_LINK_TRADE = 3,
- SPELL_LINK_GLYPH = 4
-};
-
-static char const* const spellKeys[] =
-{
- "Hspell", // normal spell
- "Htalent", // talent spell
- "Henchant", // enchanting recipe spell
- "Htrade", // profession/skill spell
- "Hglyph", // glyph
- nullptr
-};
-
-uint32 ChatHandler::extractSpellIdFromLink(char* text)
-{
- // number or [name] Shift-click form |color|Henchant:recipe_spell_id|h[prof_name: recipe_name]|h|r
- // number or [name] Shift-click form |color|Hglyph:glyph_slot_id:glyph_prop_id|h[%s]|h|r
- // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r
- // number or [name] Shift-click form |color|Htalent:talent_id, rank|h[name]|h|r
- // number or [name] Shift-click form |color|Htrade:spell_id, skill_id, max_value, cur_value|h[name]|h|r
- int type = 0;
- char* param1_str = nullptr;
- char* idS = extractKeyFromLink(text, spellKeys, &type, &param1_str);
- if (!idS)
- return 0;
-
- uint32 id = atoul(idS);
-
- switch (type)
- {
- case SPELL_LINK_SPELL:
- return id;
- case SPELL_LINK_TALENT:
- {
- // talent
- TalentEntry const* talentEntry = sTalentStore.LookupEntry(id);
- if (!talentEntry)
- return 0;
-
- return talentEntry->SpellID;
- }
- case SPELL_LINK_ENCHANT:
- case SPELL_LINK_TRADE:
- return id;
- case SPELL_LINK_GLYPH:
- {
- uint32 glyph_prop_id = param1_str ? atoul(param1_str) : 0;
-
- GlyphPropertiesEntry const* glyphPropEntry = sGlyphPropertiesStore.LookupEntry(glyph_prop_id);
- if (!glyphPropEntry)
- return 0;
-
- return glyphPropEntry->SpellID;
- }
- }
-
- // unknown type?
- return 0;
-}
-
enum GuidLinkType
{
GUID_LINK_PLAYER = 0, // must be first for selection in not link case
@@ -526,13 +457,13 @@ ObjectGuid::LowType ChatHandler::extractLowGuidFromLink(char* text, HighGuid& gu
case GUID_LINK_CREATURE:
{
guidHigh = HighGuid::Creature;
- ObjectGuid::LowType lowguid = atoull(idS);
+ ObjectGuid::LowType lowguid = Trinity::StringTo<ObjectGuid::LowType>(idS).value_or(UI64LIT(0));
return lowguid;
}
case GUID_LINK_GAMEOBJECT:
{
guidHigh = HighGuid::GameObject;
- ObjectGuid::LowType lowguid = atoull(idS);
+ ObjectGuid::LowType lowguid = Trinity::StringTo<ObjectGuid::LowType>(idS).value_or(UI64LIT(0));
return lowguid;
}
}