From 931435b7514a235b1d8c431cc3753c0d4af20ef7 Mon Sep 17 00:00:00 2001 From: "False.Genesis" Date: Sun, 4 Feb 2007 01:12:16 +0000 Subject: [PATCH] * Added reading items from chat messages and querying them if they are unknown --- src/Client/HelperDefs.h | 2 ++ src/Client/World/CMSGConstructor.cpp | 1 + src/Client/World/WorldSession.cpp | 24 ++++++++++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/src/Client/HelperDefs.h b/src/Client/HelperDefs.h index 9d7c099..bd434d2 100644 --- a/src/Client/HelperDefs.h +++ b/src/Client/HelperDefs.h @@ -5,4 +5,6 @@ #define GUID_LOPART(x) (*((uint32*)&(x))) #define MAKE_GUID(l, h) uint64( uint32(l) | ( uint64(h) << 32 ) ) +#define CHAT_ITEM_BEGIN_STRING "|Hitem:" + #endif \ No newline at end of file diff --git a/src/Client/World/CMSGConstructor.cpp b/src/Client/World/CMSGConstructor.cpp index bda606d..4d4d857 100644 --- a/src/Client/World/CMSGConstructor.cpp +++ b/src/Client/World/CMSGConstructor.cpp @@ -70,6 +70,7 @@ void WorldSession::SendQueryItem(uint32 id, uint64 guid) // is it a guid? not su logdebug("Skipped query of item %u (was marked as nonexistent before)",id); return; } + logdebug("Sending Item query, id=%u",id); WorldPacket packet; packet << id << guid; packet.SetOpcode(CMSG_ITEM_QUERY_SINGLE); diff --git a/src/Client/World/WorldSession.cpp b/src/Client/World/WorldSession.cpp index ccb3606..6a280b3 100644 --- a/src/Client/World/WorldSession.cpp +++ b/src/Client/World/WorldSession.cpp @@ -461,6 +461,30 @@ void WorldSession::_HandleMessageChatOpcode(WorldPacket& recvPacket) GetInstance()->GetScripts()->variables.Set("@thiswhisper_lang",toString((uint64)lang)); GetInstance()->GetScripts()->RunScript("_onwhisper",NULL); } + + // the following block searches for items in chat and queries them if they are unknown + if(!isCmd && target_guid!=_myGUID && msg.length()>strlen(CHAT_ITEM_BEGIN_STRING)) + { + for(uint32 pos=0;pos