@@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-GPL2
|
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-GPL2
|
||||||
* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
|
* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
|
||||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||||
@@ -241,49 +241,52 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recvData)
|
|||||||
|
|
||||||
void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recvData)
|
void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recvData)
|
||||||
{
|
{
|
||||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
uint8 signs = 0;
|
||||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_PETITION_SHOW_SIGNATURES");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uint64 petitionguid;
|
uint64 petitionguid;
|
||||||
recvData >> petitionguid; // petition guid
|
recvData >> petitionguid; // petition guid
|
||||||
|
|
||||||
// solve (possible) some strange compile problems with explicit use GUID_LOPART(petitionguid) at some GCC versions (wrong code optimization in compiler?)
|
// solve (possible) some strange compile problems with explicit use GUID_LOPART(petitionguid) at some GCC versions (wrong code optimization in compiler?)
|
||||||
uint32 petitionGuidLow = GUID_LOPART(petitionguid);
|
uint32 petitionguid_low = GUID_LOPART(petitionguid);
|
||||||
|
|
||||||
Petition const* petition = sPetitionMgr->GetPetition(petitionGuidLow);
|
QueryResult result = CharacterDatabase.PQuery("SELECT type FROM petition WHERE petitionguid = '%u'", petitionguid_low);
|
||||||
if (!petition)
|
|
||||||
|
if (!result)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint32 type = petition->petitionType;
|
|
||||||
|
Field* fields = result->Fetch();
|
||||||
|
uint32 type = fields[0].GetUInt32();
|
||||||
|
|
||||||
// if guild petition and has guild => error, return;
|
// if guild petition and has guild => error, return;
|
||||||
if (type == GUILD_CHARTER_TYPE && _player->GetGuildId())
|
if (type == GUILD_CHARTER_TYPE && _player->GetGuildId())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Signatures const* signatures = sPetitionMgr->GetSignature(petitionGuidLow);
|
result = CharacterDatabase.PQuery("SELECT playerguid FROM petition_sign WHERE petitionguid = '%u'", petitionguid_low);
|
||||||
uint8 signs = signatures ? signatures->signatureMap.size() : 0;
|
|
||||||
|
|
||||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
// result == NULL also correct in case no sign yet
|
||||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_PETITION_SHOW_SIGNATURES petition entry: '%u'", petitionGuidLow);
|
if (result)
|
||||||
#endif
|
signs = result->GetRowCount();
|
||||||
|
|
||||||
WorldPacket data(SMSG_PETITION_SHOW_SIGNATURES, (8+8+4+1+signs*12));
|
WorldPacket data(SMSG_PETITION_SHOW_SIGNATURES, (8 + 8 + 4 + 1 + signs * 12));
|
||||||
data << uint64(petitionguid); // petition guid
|
data << petitionguid; // petition guid
|
||||||
data << uint64(_player->GetGUID()); // owner guid
|
data << _player->GetGUID(); // owner guid
|
||||||
data << uint32(petitionGuidLow); // guild guid
|
data << petitionguid_low; // guild guid (in Oregon always same as GUID_LOPART(petitionguid)
|
||||||
data << uint8(signs); // sign's count
|
data << signs; // sign's count
|
||||||
|
|
||||||
if (signs)
|
for (uint8 i = 1; i <= signs; ++i)
|
||||||
for (SignatureMap::const_iterator itr = signatures->signatureMap.begin(); itr != signatures->signatureMap.begin(); ++itr)
|
{
|
||||||
{
|
Field* fields = result->Fetch();
|
||||||
data << uint64(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)); // Player GUID
|
uint64 plguid = fields[0].GetUInt64();
|
||||||
data << uint32(0); // there 0 ...
|
|
||||||
}
|
|
||||||
|
|
||||||
|
data << plguid; // Player GUID
|
||||||
|
data << (uint32)0; // there 0 ...
|
||||||
|
|
||||||
|
result->NextRow();
|
||||||
|
}
|
||||||
SendPacket(&data);
|
SendPacket(&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WorldSession::HandlePetitionQueryOpcode(WorldPacket & recvData)
|
void WorldSession::HandlePetitionQueryOpcode(WorldPacket & recvData)
|
||||||
{
|
{
|
||||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||||
|
|||||||
Reference in New Issue
Block a user