* Added reading items from chat messages and querying them if they are unknown
This commit is contained in:
parent
d6b6960c29
commit
931435b751
@ -5,4 +5,6 @@
|
|||||||
#define GUID_LOPART(x) (*((uint32*)&(x)))
|
#define GUID_LOPART(x) (*((uint32*)&(x)))
|
||||||
#define MAKE_GUID(l, h) uint64( uint32(l) | ( uint64(h) << 32 ) )
|
#define MAKE_GUID(l, h) uint64( uint32(l) | ( uint64(h) << 32 ) )
|
||||||
|
|
||||||
|
#define CHAT_ITEM_BEGIN_STRING "|Hitem:"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -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);
|
logdebug("Skipped query of item %u (was marked as nonexistent before)",id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
logdebug("Sending Item query, id=%u",id);
|
||||||
WorldPacket packet;
|
WorldPacket packet;
|
||||||
packet << id << guid;
|
packet << id << guid;
|
||||||
packet.SetOpcode(CMSG_ITEM_QUERY_SINGLE);
|
packet.SetOpcode(CMSG_ITEM_QUERY_SINGLE);
|
||||||
|
|||||||
@ -461,6 +461,30 @@ void WorldSession::_HandleMessageChatOpcode(WorldPacket& recvPacket)
|
|||||||
GetInstance()->GetScripts()->variables.Set("@thiswhisper_lang",toString((uint64)lang));
|
GetInstance()->GetScripts()->variables.Set("@thiswhisper_lang",toString((uint64)lang));
|
||||||
GetInstance()->GetScripts()->RunScript("_onwhisper",NULL);
|
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<msg.length()-strlen(CHAT_ITEM_BEGIN_STRING);pos++)
|
||||||
|
{
|
||||||
|
if(!memcmp(msg.c_str()+pos,CHAT_ITEM_BEGIN_STRING,strlen(CHAT_ITEM_BEGIN_STRING)))
|
||||||
|
{
|
||||||
|
std::string itemid;
|
||||||
|
uint32 id;
|
||||||
|
|
||||||
|
while(msg[pos] != ':')
|
||||||
|
{
|
||||||
|
itemid += msg[pos+strlen(CHAT_ITEM_BEGIN_STRING)];
|
||||||
|
pos++;
|
||||||
|
}
|
||||||
|
id = atoi(itemid.c_str());
|
||||||
|
logdebug("Found Item in chat message: %u",id);
|
||||||
|
if(objmgr.GetItemProto(id)==NULL)
|
||||||
|
SendQueryItem(id,0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
void WorldSession::_HandleNameQueryResponseOpcode(WorldPacket& recvPacket)
|
void WorldSession::_HandleNameQueryResponseOpcode(WorldPacket& recvPacket)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user