mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[10810] More ObjectGuids specially in petition code.
Some uint64<->uin32 bugs fixed at read guids from DB in petition code. Still exist 29 GUID_LOPART uses in code.
This commit is contained in:
parent
1fbc09e1fd
commit
c6d3c5e0d6
9 changed files with 130 additions and 135 deletions
|
|
@ -649,11 +649,12 @@ void WorldSession::HandleBuybackItem(WorldPacket & recv_data)
|
|||
void WorldSession::HandleBuyItemInSlotOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
DEBUG_LOG( "WORLD: Received CMSG_BUY_ITEM_IN_SLOT" );
|
||||
uint64 vendorguid, bagguid;
|
||||
ObjectGuid vendorGuid;
|
||||
ObjectGuid bagGuid;
|
||||
uint32 item, slot, count;
|
||||
uint8 bagslot;
|
||||
|
||||
recv_data >> vendorguid >> item >> slot >> bagguid >> bagslot >> count;
|
||||
recv_data >> vendorGuid >> item >> slot >> bagGuid >> bagslot >> count;
|
||||
|
||||
// client side expected counting from 1, and we send to client vendorslot+1 already
|
||||
if (slot > 0)
|
||||
|
|
@ -664,7 +665,7 @@ void WorldSession::HandleBuyItemInSlotOpcode( WorldPacket & recv_data )
|
|||
uint8 bag = NULL_BAG; // init for case invalid bagGUID
|
||||
|
||||
// find bag slot by bag guid
|
||||
if (bagguid == _player->GetGUID())
|
||||
if (bagGuid == _player->GetObjectGuid())
|
||||
bag = INVENTORY_SLOT_BAG_0;
|
||||
else
|
||||
{
|
||||
|
|
@ -672,7 +673,7 @@ void WorldSession::HandleBuyItemInSlotOpcode( WorldPacket & recv_data )
|
|||
{
|
||||
if (Bag *pBag = (Bag*)_player->GetItemByPos(INVENTORY_SLOT_BAG_0,i))
|
||||
{
|
||||
if (bagguid == pBag->GetGUID())
|
||||
if (bagGuid == pBag->GetObjectGuid())
|
||||
{
|
||||
bag = i;
|
||||
break;
|
||||
|
|
@ -685,17 +686,17 @@ void WorldSession::HandleBuyItemInSlotOpcode( WorldPacket & recv_data )
|
|||
if (bag == NULL_BAG)
|
||||
return;
|
||||
|
||||
GetPlayer()->BuyItemFromVendorSlot(vendorguid, slot, item, count, bag, bagslot);
|
||||
GetPlayer()->BuyItemFromVendorSlot(vendorGuid, slot, item, count, bag, bagslot);
|
||||
}
|
||||
|
||||
void WorldSession::HandleBuyItemOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
DEBUG_LOG( "WORLD: Received CMSG_BUY_ITEM" );
|
||||
uint64 vendorguid;
|
||||
ObjectGuid vendorGuid;
|
||||
uint32 item, slot, count;
|
||||
uint8 unk1;
|
||||
|
||||
recv_data >> vendorguid >> item >> slot >> count >> unk1;
|
||||
recv_data >> vendorGuid >> item >> slot >> count >> unk1;
|
||||
|
||||
// client side expected counting from 1, and we send to client vendorslot+1 already
|
||||
if (slot > 0)
|
||||
|
|
@ -703,7 +704,7 @@ void WorldSession::HandleBuyItemOpcode( WorldPacket & recv_data )
|
|||
else
|
||||
return; // cheating
|
||||
|
||||
GetPlayer()->BuyItemFromVendorSlot(vendorguid, slot, item, count, NULL_BAG, NULL_SLOT);
|
||||
GetPlayer()->BuyItemFromVendorSlot(vendorGuid, slot, item, count, NULL_BAG, NULL_SLOT);
|
||||
}
|
||||
|
||||
void WorldSession::HandleListInventoryOpcode( WorldPacket & recv_data )
|
||||
|
|
@ -1474,22 +1475,22 @@ void WorldSession::HandleItemRefundInfoRequest(WorldPacket& recv_data)
|
|||
*/
|
||||
void WorldSession::HandleItemTextQuery(WorldPacket & recv_data )
|
||||
{
|
||||
uint64 itemGuid;
|
||||
ObjectGuid itemGuid;
|
||||
recv_data >> itemGuid;
|
||||
|
||||
DEBUG_LOG("CMSG_ITEM_TEXT_QUERY item guid: %u", GUID_LOPART(itemGuid));
|
||||
DEBUG_LOG("CMSG_ITEM_TEXT_QUERY item guid: %u", itemGuid.GetCounter());
|
||||
|
||||
WorldPacket data(SMSG_ITEM_TEXT_QUERY_RESPONSE, (4+10)); // guess size
|
||||
WorldPacket data(SMSG_ITEM_TEXT_QUERY_RESPONSE, (4+10));// guess size
|
||||
|
||||
if(Item *item = _player->GetItemByGuid(itemGuid))
|
||||
{
|
||||
data << uint8(0); // has text
|
||||
data << uint64(itemGuid); // item guid
|
||||
data << uint8(0); // has text
|
||||
data << ObjectGuid(itemGuid); // item guid
|
||||
data << item->GetText();
|
||||
}
|
||||
else
|
||||
{
|
||||
data << uint8(1); // no text
|
||||
data << uint8(1); // no text
|
||||
}
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -360,7 +360,7 @@ Map::Add(T *obj)
|
|||
if(obj->isActiveObject())
|
||||
AddToActive(obj);
|
||||
|
||||
DEBUG_LOG("Object %u enters grid[%u,%u]", GUID_LOPART(obj->GetGUID()), cell.GridX(), cell.GridY());
|
||||
DEBUG_LOG("%s enters grid[%u,%u]", obj->GetObjectGuid().GetString().c_str(), cell.GridX(), cell.GridY());
|
||||
|
||||
obj->GetViewPoint().Event_AddedToWorld(&(*grid)(cell.CellX(), cell.CellY()));
|
||||
UpdateObjectVisibility(obj,cell,p);
|
||||
|
|
|
|||
|
|
@ -1228,14 +1228,14 @@ void WorldSession::HandleComplainOpcode( WorldPacket & recv_data )
|
|||
recv_data.hexlike();
|
||||
|
||||
uint8 spam_type; // 0 - mail, 1 - chat
|
||||
uint64 spammer_guid;
|
||||
ObjectGuid spammerGuid;
|
||||
uint32 unk1 = 0;
|
||||
uint32 unk2 = 0;
|
||||
uint32 unk3 = 0;
|
||||
uint32 unk4 = 0;
|
||||
std::string description = "";
|
||||
recv_data >> spam_type; // unk 0x01 const, may be spam type (mail/chat)
|
||||
recv_data >> spammer_guid; // player guid
|
||||
recv_data >> spammerGuid; // player guid
|
||||
switch(spam_type)
|
||||
{
|
||||
case 0:
|
||||
|
|
@ -1260,7 +1260,7 @@ void WorldSession::HandleComplainOpcode( WorldPacket & recv_data )
|
|||
data << uint8(0);
|
||||
SendPacket(&data);
|
||||
|
||||
DEBUG_LOG("REPORT SPAM: type %u, guid %u, unk1 %u, unk2 %u, unk3 %u, unk4 %u, message %s", spam_type, GUID_LOPART(spammer_guid), unk1, unk2, unk3, unk4, description.c_str());
|
||||
DEBUG_LOG("REPORT SPAM: type %u, spammer %s, unk1 %u, unk2 %u, unk3 %u, unk4 %u, message %s", spam_type, spammerGuid.GetString().c_str(), unk1, unk2, unk3, unk4, description.c_str());
|
||||
}
|
||||
|
||||
void WorldSession::HandleRealmSplitOpcode( WorldPacket & recv_data )
|
||||
|
|
|
|||
|
|
@ -414,16 +414,16 @@ void WorldSession::SendSpiritResurrect()
|
|||
|
||||
void WorldSession::HandleBinderActivateOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
uint64 npcGUID;
|
||||
recv_data >> npcGUID;
|
||||
ObjectGuid npcGuid;
|
||||
recv_data >> npcGuid;
|
||||
|
||||
if(!GetPlayer()->IsInWorld() || !GetPlayer()->isAlive())
|
||||
return;
|
||||
|
||||
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID,UNIT_NPC_FLAG_INNKEEPER);
|
||||
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGuid,UNIT_NPC_FLAG_INNKEEPER);
|
||||
if (!unit)
|
||||
{
|
||||
DEBUG_LOG( "WORLD: HandleBinderActivateOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID)) );
|
||||
DEBUG_LOG("WORLD: HandleBinderActivateOpcode - %s not found or you can't interact with him.", npcGuid.GetString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -807,15 +807,16 @@ void WorldSession::HandleRepairItemOpcode( WorldPacket & recv_data )
|
|||
{
|
||||
DEBUG_LOG("WORLD: CMSG_REPAIR_ITEM");
|
||||
|
||||
uint64 npcGUID, itemGUID;
|
||||
ObjectGuid npcGuid;
|
||||
ObjectGuid itemGuid;
|
||||
uint8 guildBank; // new in 2.3.2, bool that means from guild bank money
|
||||
|
||||
recv_data >> npcGUID >> itemGUID >> guildBank;
|
||||
recv_data >> npcGuid >> itemGuid >> guildBank;
|
||||
|
||||
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_REPAIR);
|
||||
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGuid, UNIT_NPC_FLAG_REPAIR);
|
||||
if (!unit)
|
||||
{
|
||||
DEBUG_LOG( "WORLD: HandleRepairItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID)) );
|
||||
DEBUG_LOG( "WORLD: HandleRepairItemOpcode - %s not found or you can't interact with him.", npcGuid.GetString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -827,20 +828,20 @@ void WorldSession::HandleRepairItemOpcode( WorldPacket & recv_data )
|
|||
float discountMod = _player->GetReputationPriceDiscount(unit);
|
||||
|
||||
uint32 TotalCost = 0;
|
||||
if (itemGUID)
|
||||
if (!itemGuid.IsEmpty())
|
||||
{
|
||||
DEBUG_LOG("ITEM: Repair item, itemGUID = %u, npcGUID = %u", GUID_LOPART(itemGUID), GUID_LOPART(npcGUID));
|
||||
DEBUG_LOG("ITEM: %s repair of %s", npcGuid.GetString().c_str(), itemGuid.GetString().c_str());
|
||||
|
||||
Item* item = _player->GetItemByGuid(itemGUID);
|
||||
Item* item = _player->GetItemByGuid(itemGuid);
|
||||
|
||||
if(item)
|
||||
TotalCost= _player->DurabilityRepair(item->GetPos(),true,discountMod,guildBank>0?true:false);
|
||||
TotalCost= _player->DurabilityRepair(item->GetPos(), true, discountMod, (guildBank > 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_LOG("ITEM: Repair all items, npcGUID = %u", GUID_LOPART(npcGUID));
|
||||
DEBUG_LOG("ITEM: %s repair all items", npcGuid.GetString().c_str());
|
||||
|
||||
TotalCost = _player->DurabilityRepairAll(true,discountMod,guildBank>0?true:false);
|
||||
TotalCost = _player->DurabilityRepairAll(true, discountMod, (guildBank > 0));
|
||||
}
|
||||
if (guildBank)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ class MANGOS_DLL_SPEC Object
|
|||
|
||||
ObjectGuid const& GetObjectGuid() const { return GetGuidValue(OBJECT_FIELD_GUID); }
|
||||
const uint64& GetGUID() const { return GetUInt64Value(OBJECT_FIELD_GUID); }
|
||||
uint32 GetGUIDLow() const { return GUID_LOPART(GetUInt64Value(OBJECT_FIELD_GUID)); }
|
||||
uint32 GetGUIDLow() const { return GetObjectGuid().GetCounter(); }
|
||||
PackedGuid const& GetPackGUID() const { return m_PackGUID; }
|
||||
std::string GetGuidStr() const { return GetObjectGuid().GetString(); }
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
|
|||
DEBUG_LOG("Received opcode CMSG_PETITION_BUY");
|
||||
recv_data.hexlike();
|
||||
|
||||
uint64 guidNPC;
|
||||
ObjectGuid guidNPC;
|
||||
uint32 clientIndex; // 1 for guild and arenaslot+1 for arenas in client
|
||||
std::string name;
|
||||
|
||||
|
|
@ -78,13 +78,13 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
|
|||
recv_data >> clientIndex; // index
|
||||
recv_data.read_skip<uint32>(); // 0
|
||||
|
||||
DEBUG_LOG("Petitioner with GUID %u tried sell petition: name %s", GUID_LOPART(guidNPC), name.c_str());
|
||||
DEBUG_LOG("Petitioner %s tried sell petition: name %s", guidNPC.GetString().c_str(), name.c_str());
|
||||
|
||||
// prevent cheating
|
||||
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guidNPC,UNIT_NPC_FLAG_PETITIONER);
|
||||
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guidNPC, UNIT_NPC_FLAG_PETITIONER);
|
||||
if (!pCreature)
|
||||
{
|
||||
DEBUG_LOG("WORLD: HandlePetitionBuyOpcode - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(guidNPC));
|
||||
DEBUG_LOG("WORLD: HandlePetitionBuyOpcode - %s not found or you can't interact with him.", guidNPC.GetString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -240,11 +240,11 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket & recv_data)
|
|||
//recv_data.hexlike();
|
||||
|
||||
uint8 signs = 0;
|
||||
uint64 petitionguid;
|
||||
ObjectGuid petitionguid;
|
||||
recv_data >> petitionguid; // petition guid
|
||||
|
||||
// solve (possible) some strange compile problems with explicit use GUID_LOPART(petitionguid) at some GCC versions (wrong code optimization in compiler?)
|
||||
uint32 petitionguid_low = GUID_LOPART(petitionguid);
|
||||
uint32 petitionguid_low = petitionguid.GetCounter();
|
||||
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT type FROM petition WHERE petitionguid = '%u'", petitionguid_low);
|
||||
if(!result)
|
||||
|
|
@ -266,10 +266,10 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket & recv_data)
|
|||
if(result)
|
||||
signs = (uint8)result->GetRowCount();
|
||||
|
||||
DEBUG_LOG("CMSG_PETITION_SHOW_SIGNATURES petition entry: '%u'", petitionguid_low);
|
||||
DEBUG_LOG("CMSG_PETITION_SHOW_SIGNATURES petition: %s", petitionguid.GetString().c_str());
|
||||
|
||||
WorldPacket data(SMSG_PETITION_SHOW_SIGNATURES, (8+8+4+1+signs*12));
|
||||
data << uint64(petitionguid); // petition guid
|
||||
data << ObjectGuid(petitionguid); // petition guid
|
||||
data << _player->GetObjectGuid(); // owner guid
|
||||
data << uint32(petitionguid_low); // guild guid (in mangos always same as GUID_LOPART(petitionguid)
|
||||
data << uint8(signs); // sign's count
|
||||
|
|
@ -277,9 +277,9 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket & recv_data)
|
|||
for(uint8 i = 1; i <= signs; ++i)
|
||||
{
|
||||
Field *fields2 = result->Fetch();
|
||||
uint64 plguid = fields2[0].GetUInt64();
|
||||
ObjectGuid signerGuid = ObjectGuid(HIGHGUID_PLAYER, fields2[0].GetUInt32());
|
||||
|
||||
data << uint64(plguid); // Player GUID
|
||||
data << ObjectGuid(signerGuid); // Player GUID
|
||||
data << uint32(0); // there 0 ...
|
||||
|
||||
result->NextRow();
|
||||
|
|
@ -306,7 +306,7 @@ void WorldSession::SendPetitionQueryOpcode(ObjectGuid petitionguid)
|
|||
{
|
||||
uint32 petitionLowGuid = petitionguid.GetCounter();
|
||||
|
||||
ObjectGuid ownerguid;
|
||||
ObjectGuid ownerGuid;
|
||||
uint32 type;
|
||||
std::string name = "NO_NAME_FOR_GUID";
|
||||
uint8 signs = 0;
|
||||
|
|
@ -320,7 +320,7 @@ void WorldSession::SendPetitionQueryOpcode(ObjectGuid petitionguid)
|
|||
if (result)
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
ownerguid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
|
||||
ownerGuid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
|
||||
name = fields[1].GetCppString();
|
||||
signs = fields[2].GetUInt8();
|
||||
type = fields[3].GetUInt32();
|
||||
|
|
@ -334,7 +334,7 @@ void WorldSession::SendPetitionQueryOpcode(ObjectGuid petitionguid)
|
|||
|
||||
WorldPacket data(SMSG_PETITION_QUERY_RESPONSE, (4+8+name.size()+1+1+4*12+2+10));
|
||||
data << uint32(petitionLowGuid); // guild/team guid (in mangos always same as GUID_LOPART(petition guid)
|
||||
data << ownerguid; // charter owner guid
|
||||
data << ObjectGuid(ownerGuid); // charter owner guid
|
||||
data << name; // name (guild/arena team)
|
||||
data << uint8(0); // some string
|
||||
if (type == 9)
|
||||
|
|
@ -376,18 +376,18 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket & recv_data)
|
|||
DEBUG_LOG("Received opcode MSG_PETITION_RENAME"); // ok
|
||||
//recv_data.hexlike();
|
||||
|
||||
uint64 petitionguid;
|
||||
ObjectGuid petitionGuid;
|
||||
uint32 type;
|
||||
std::string newname;
|
||||
|
||||
recv_data >> petitionguid; // guid
|
||||
recv_data >> petitionGuid; // guid
|
||||
recv_data >> newname; // new name
|
||||
|
||||
Item *item = _player->GetItemByGuid(petitionguid);
|
||||
Item *item = _player->GetItemByGuid(petitionGuid);
|
||||
if(!item)
|
||||
return;
|
||||
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT type FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT type FROM petition WHERE petitionguid = '%u'", petitionGuid.GetCounter());
|
||||
|
||||
if(result)
|
||||
{
|
||||
|
|
@ -397,7 +397,7 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket & recv_data)
|
|||
}
|
||||
else
|
||||
{
|
||||
DEBUG_LOG("CMSG_PETITION_QUERY failed for petition (GUID: %u)", GUID_LOPART(petitionguid));
|
||||
DEBUG_LOG("CMSG_PETITION_QUERY failed for petition: %s", petitionGuid.GetString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -431,12 +431,12 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket & recv_data)
|
|||
std::string db_newname = newname;
|
||||
CharacterDatabase.escape_string(db_newname);
|
||||
CharacterDatabase.PExecute("UPDATE petition SET name = '%s' WHERE petitionguid = '%u'",
|
||||
db_newname.c_str(), GUID_LOPART(petitionguid));
|
||||
db_newname.c_str(), petitionGuid.GetCounter());
|
||||
|
||||
DEBUG_LOG("Petition (GUID: %u) renamed to '%s'", GUID_LOPART(petitionguid), newname.c_str());
|
||||
DEBUG_LOG("Petition %s renamed to '%s'", petitionGuid.GetString().c_str(), newname.c_str());
|
||||
|
||||
WorldPacket data(MSG_PETITION_RENAME, (8+newname.size()+1));
|
||||
data << uint64(petitionguid);
|
||||
data << ObjectGuid(petitionGuid);
|
||||
data << newname;
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
|
@ -468,18 +468,18 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
|
|||
|
||||
fields = result->Fetch();
|
||||
uint32 ownerLowGuid = fields[0].GetUInt32();
|
||||
ObjectGuid ownerguid = ObjectGuid(HIGHGUID_PLAYER, ownerLowGuid);
|
||||
ObjectGuid ownerGuid = ObjectGuid(HIGHGUID_PLAYER, ownerLowGuid);
|
||||
uint8 signs = fields[1].GetUInt8();
|
||||
uint32 type = fields[2].GetUInt32();
|
||||
|
||||
delete result;
|
||||
|
||||
if (ownerguid == _player->GetObjectGuid())
|
||||
if (ownerGuid == _player->GetObjectGuid())
|
||||
return;
|
||||
|
||||
// not let enemies sign guild charter
|
||||
if (!sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GUILD) &&
|
||||
GetPlayer()->GetTeam() != sObjectMgr.GetPlayerTeamByGUID(ownerguid))
|
||||
GetPlayer()->GetTeam() != sObjectMgr.GetPlayerTeamByGUID(ownerGuid))
|
||||
{
|
||||
if(type != 9)
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", "", ERR_ARENA_TEAM_NOT_ALLIED);
|
||||
|
|
@ -537,15 +537,15 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
|
|||
{
|
||||
delete result;
|
||||
WorldPacket data(SMSG_PETITION_SIGN_RESULTS, (8+8+4));
|
||||
data << petitionGuid;
|
||||
data << _player->GetObjectGuid();
|
||||
data << ObjectGuid(petitionGuid);
|
||||
data << ObjectGuid(_player->GetObjectGuid());
|
||||
data << uint32(PETITION_SIGN_ALREADY_SIGNED);
|
||||
|
||||
// close at signer side
|
||||
SendPacket(&data);
|
||||
|
||||
// update for owner if online
|
||||
if(Player *owner = sObjectMgr.GetPlayer(ownerguid))
|
||||
if(Player *owner = sObjectMgr.GetPlayer(ownerGuid))
|
||||
owner->GetSession()->SendPacket(&data);
|
||||
return;
|
||||
}
|
||||
|
|
@ -553,12 +553,11 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
|
|||
CharacterDatabase.PExecute("INSERT INTO petition_sign (ownerguid,petitionguid, playerguid, player_account) VALUES ('%u', '%u', '%u','%u')",
|
||||
ownerLowGuid, petitionLowGuid, _player->GetGUIDLow(), GetAccountId());
|
||||
|
||||
DEBUG_LOG("PETITION SIGN: GUID %u by player: %s (GUID: %u Account: %u)",
|
||||
petitionLowGuid, _player->GetName(), _player->GetGUIDLow(), GetAccountId());
|
||||
DEBUG_LOG("PETITION SIGN: %s by %s", petitionGuid.GetString().c_str(), _player->GetGuidStr().c_str());
|
||||
|
||||
WorldPacket data(SMSG_PETITION_SIGN_RESULTS, (8+8+4));
|
||||
data << petitionGuid;
|
||||
data << _player->GetObjectGuid();
|
||||
data << ObjectGuid(petitionGuid);
|
||||
data << ObjectGuid(_player->GetObjectGuid());
|
||||
data << uint32(PETITION_SIGN_OK);
|
||||
|
||||
// close at signer side
|
||||
|
|
@ -570,7 +569,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
|
|||
// item->SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1+1, signs);
|
||||
|
||||
// update for owner if online
|
||||
if(Player *owner = sObjectMgr.GetPlayer(ownerguid))
|
||||
if(Player *owner = sObjectMgr.GetPlayer(ownerGuid))
|
||||
owner->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
|
|
@ -608,27 +607,27 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data)
|
|||
DEBUG_LOG("Received opcode CMSG_OFFER_PETITION"); // ok
|
||||
//recv_data.hexlike();
|
||||
|
||||
uint8 signs = 0;
|
||||
uint64 petitionguid, plguid;
|
||||
uint32 type, junk;
|
||||
Player *player;
|
||||
ObjectGuid petitionGuid;
|
||||
ObjectGuid playerGuid;
|
||||
uint32 junk;
|
||||
recv_data >> junk; // this is not petition type!
|
||||
recv_data >> petitionguid; // petition guid
|
||||
recv_data >> plguid; // player guid
|
||||
recv_data >> petitionGuid; // petition guid
|
||||
recv_data >> playerGuid; // player guid
|
||||
|
||||
player = ObjectAccessor::FindPlayer(plguid);
|
||||
Player *player = ObjectAccessor::FindPlayer(playerGuid);
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT type FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
|
||||
/// Get petition type and check
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT type FROM petition WHERE petitionguid = '%u'", petitionGuid.GetCounter());
|
||||
if (!result)
|
||||
return;
|
||||
|
||||
Field *fields = result->Fetch();
|
||||
type = fields[0].GetUInt32();
|
||||
uint32 type = fields[0].GetUInt32();
|
||||
delete result;
|
||||
|
||||
DEBUG_LOG("OFFER PETITION: type %u, GUID1 %u, to player id: %u", type, GUID_LOPART(petitionguid), GUID_LOPART(plguid));
|
||||
DEBUG_LOG("OFFER PETITION: type %u petition %s to %s", type, petitionGuid.GetString().c_str(), playerGuid.GetString().c_str());
|
||||
|
||||
if (!sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GUILD) && GetPlayer()->GetTeam() != player->GetTeam() )
|
||||
{
|
||||
|
|
@ -680,23 +679,26 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data)
|
|||
}
|
||||
}
|
||||
|
||||
result = CharacterDatabase.PQuery("SELECT playerguid FROM petition_sign WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
|
||||
/// Get petition signs count
|
||||
uint8 signs = 0;
|
||||
result = CharacterDatabase.PQuery("SELECT playerguid FROM petition_sign WHERE petitionguid = '%u'", petitionGuid.GetCounter());
|
||||
// result==NULL also correct charter without signs
|
||||
if(result)
|
||||
signs = (uint8)result->GetRowCount();
|
||||
|
||||
/// Send response
|
||||
WorldPacket data(SMSG_PETITION_SHOW_SIGNATURES, (8+8+4+signs+signs*12));
|
||||
data << uint64(petitionguid); // petition guid
|
||||
data << _player->GetObjectGuid(); // owner guid
|
||||
data << uint32(GUID_LOPART(petitionguid)); // guild guid (in mangos always same as GUID_LOPART(petition guid)
|
||||
data << ObjectGuid(petitionGuid); // petition guid
|
||||
data << ObjectGuid(_player->GetObjectGuid()); // owner guid
|
||||
data << uint32(petitionGuid.GetCounter()); // guild guid (in mangos always same as low part of petition guid)
|
||||
data << uint8(signs); // sign's count
|
||||
|
||||
for(uint8 i = 1; i <= signs; ++i)
|
||||
{
|
||||
Field *fields2 = result->Fetch();
|
||||
plguid = fields2[0].GetUInt64();
|
||||
ObjectGuid signerGuid = ObjectGuid(HIGHGUID_PLAYER, fields2[0].GetUInt32());
|
||||
|
||||
data << uint64(plguid); // Player GUID
|
||||
data << ObjectGuid(signerGuid); // Player GUID
|
||||
data << uint32(0); // there 0 ...
|
||||
|
||||
result->NextRow();
|
||||
|
|
@ -711,23 +713,23 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
|
|||
DEBUG_LOG("Received opcode CMSG_TURN_IN_PETITION"); // ok
|
||||
//recv_data.hexlike();
|
||||
|
||||
WorldPacket data;
|
||||
uint64 petitionguid;
|
||||
ObjectGuid petitionGuid;
|
||||
|
||||
uint32 ownerguidlo;
|
||||
recv_data >> petitionGuid;
|
||||
|
||||
DEBUG_LOG("Petition %s turned in by %s", petitionGuid.GetString().c_str(), _player->GetGuidStr().c_str());
|
||||
|
||||
/// Collect petition info data
|
||||
ObjectGuid ownerGuid;
|
||||
uint32 type;
|
||||
std::string name;
|
||||
|
||||
recv_data >> petitionguid;
|
||||
|
||||
DEBUG_LOG("Petition %u turned in by %u", GUID_LOPART(petitionguid), _player->GetGUIDLow());
|
||||
|
||||
// data
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT ownerguid, name, type FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
|
||||
if(result)
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT ownerguid, name, type FROM petition WHERE petitionguid = '%u'", petitionGuid.GetCounter());
|
||||
if (result)
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
ownerguidlo = fields[0].GetUInt32();
|
||||
ownerGuid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
|
||||
name = fields[1].GetCppString();
|
||||
type = fields[2].GetUInt32();
|
||||
delete result;
|
||||
|
|
@ -742,7 +744,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
|
|||
{
|
||||
if(_player->GetGuildId())
|
||||
{
|
||||
data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4);
|
||||
WorldPacket data(SMSG_TURN_IN_PETITION_RESULTS, 4);
|
||||
data << uint32(PETITION_TURN_ALREADY_IN_GUILD); // already in guild
|
||||
_player->GetSession()->SendPacket(&data);
|
||||
return;
|
||||
|
|
@ -751,10 +753,10 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
|
|||
else
|
||||
{
|
||||
uint8 slot = ArenaTeam::GetSlotByType(type);
|
||||
if(slot >= MAX_ARENA_SLOT)
|
||||
if (slot >= MAX_ARENA_SLOT)
|
||||
return;
|
||||
|
||||
if(_player->GetArenaTeamId(slot))
|
||||
if (_player->GetArenaTeamId(slot))
|
||||
{
|
||||
//data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4);
|
||||
//data << (uint32)PETITION_TURN_ALREADY_IN_GUILD; // already in guild
|
||||
|
|
@ -764,26 +766,17 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
|
|||
}
|
||||
}
|
||||
|
||||
if(_player->GetGUIDLow() != ownerguidlo)
|
||||
if (_player->GetObjectGuid() != ownerGuid)
|
||||
return;
|
||||
|
||||
// signs
|
||||
uint8 signs;
|
||||
result = CharacterDatabase.PQuery("SELECT playerguid FROM petition_sign WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
|
||||
if(result)
|
||||
signs = (uint8)result->GetRowCount();
|
||||
else
|
||||
signs = 0;
|
||||
result = CharacterDatabase.PQuery("SELECT playerguid FROM petition_sign WHERE petitionguid = '%u'", petitionGuid.GetCounter());
|
||||
uint8 signs = result ? (uint8)result->GetRowCount() : 0;
|
||||
|
||||
uint32 count;
|
||||
//if(signs < sWorld.getConfig(CONFIG_UINT32_MIN_PETITION_SIGNS))
|
||||
if(type == 9)
|
||||
count = sWorld.getConfig(CONFIG_UINT32_MIN_PETITION_SIGNS);
|
||||
else
|
||||
count = type - 1;
|
||||
if(signs < count)
|
||||
uint32 count = type == 9 ? sWorld.getConfig(CONFIG_UINT32_MIN_PETITION_SIGNS) : type - 1;
|
||||
if (signs < count)
|
||||
{
|
||||
data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4);
|
||||
WorldPacket data(SMSG_TURN_IN_PETITION_RESULTS, 4);
|
||||
data << uint32(PETITION_TURN_NEED_MORE_SIGNATURES); // need more signatures...
|
||||
SendPacket(&data);
|
||||
delete result;
|
||||
|
|
@ -810,8 +803,8 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
|
|||
}
|
||||
|
||||
// and at last charter item check
|
||||
Item *item = _player->GetItemByGuid(petitionguid);
|
||||
if(!item)
|
||||
Item *item = _player->GetItemByGuid(petitionGuid);
|
||||
if (!item)
|
||||
{
|
||||
delete result;
|
||||
return;
|
||||
|
|
@ -840,11 +833,11 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
|
|||
{
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
ObjectGuid signguid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
|
||||
if (signguid.IsEmpty())
|
||||
ObjectGuid signGuid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
|
||||
if (signGuid.IsEmpty())
|
||||
continue;
|
||||
|
||||
guild->AddMember(signguid, guild->GetLowestRank());
|
||||
guild->AddMember(signGuid, guild->GetLowestRank());
|
||||
result->NextRow();
|
||||
}
|
||||
}
|
||||
|
|
@ -885,14 +878,14 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
|
|||
delete result;
|
||||
|
||||
CharacterDatabase.BeginTransaction();
|
||||
CharacterDatabase.PExecute("DELETE FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
|
||||
CharacterDatabase.PExecute("DELETE FROM petition_sign WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
|
||||
CharacterDatabase.PExecute("DELETE FROM petition WHERE petitionguid = '%u'", petitionGuid.GetCounter());
|
||||
CharacterDatabase.PExecute("DELETE FROM petition_sign WHERE petitionguid = '%u'", petitionGuid.GetCounter());
|
||||
CharacterDatabase.CommitTransaction();
|
||||
|
||||
// created
|
||||
DEBUG_LOG("TURN IN PETITION GUID %u", GUID_LOPART(petitionguid));
|
||||
DEBUG_LOG("TURN IN PETITION %s", petitionGuid.GetString().c_str());
|
||||
|
||||
data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4);
|
||||
WorldPacket data(SMSG_TURN_IN_PETITION_RESULTS, 4);
|
||||
data << uint32(PETITION_TURN_OK);
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6605,10 +6605,10 @@ uint32 Player::GetGuildIdFromDB(ObjectGuid guid)
|
|||
return id;
|
||||
}
|
||||
|
||||
uint32 Player::GetRankFromDB(uint64 guid)
|
||||
uint32 Player::GetRankFromDB(ObjectGuid guid)
|
||||
{
|
||||
QueryResult *result = CharacterDatabase.PQuery( "SELECT rank FROM guild_member WHERE guid='%u'", GUID_LOPART(guid) );
|
||||
if( result )
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT rank FROM guild_member WHERE guid='%u'", guid.GetCounter());
|
||||
if (result)
|
||||
{
|
||||
uint32 v = result->Fetch()[0].GetUInt32();
|
||||
delete result;
|
||||
|
|
@ -15035,9 +15035,9 @@ void Player::_LoadBGData(QueryResult* result)
|
|||
delete result;
|
||||
}
|
||||
|
||||
bool Player::LoadPositionFromDB(uint32& mapid, float& x,float& y,float& z,float& o, bool& in_flight, uint64 guid)
|
||||
bool Player::LoadPositionFromDB(uint32& mapid, float& x,float& y,float& z,float& o, bool& in_flight, ObjectGuid guid)
|
||||
{
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT position_x,position_y,position_z,orientation,map,taxi_path FROM characters WHERE guid = '%u'",GUID_LOPART(guid));
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT position_x,position_y,position_z,orientation,map,taxi_path FROM characters WHERE guid = '%u'", guid.GetCounter());
|
||||
if(!result)
|
||||
return false;
|
||||
|
||||
|
|
@ -17572,13 +17572,13 @@ void Player::SendAttackSwingNotInRange()
|
|||
GetSession()->SendPacket( &data );
|
||||
}
|
||||
|
||||
void Player::SavePositionInDB(uint32 mapid, float x,float y,float z,float o,uint32 zone,uint64 guid)
|
||||
void Player::SavePositionInDB(uint32 mapid, float x, float y, float z, float o, uint32 zone, ObjectGuid guid)
|
||||
{
|
||||
std::ostringstream ss;
|
||||
ss << "UPDATE characters SET position_x='"<<x<<"',position_y='"<<y
|
||||
<< "',position_z='"<<z<<"',orientation='"<<o<<"',map='"<<mapid
|
||||
<< "',zone='"<<zone<<"',trans_x='0',trans_y='0',trans_z='0',"
|
||||
<< "transguid='0',taxi_path='' WHERE guid='"<< GUID_LOPART(guid) <<"'";
|
||||
<< "transguid='0',taxi_path='' WHERE guid='"<< guid.GetCounter() <<"'";
|
||||
DEBUG_LOG("%s", ss.str().c_str());
|
||||
CharacterDatabase.Execute(ss.str().c_str());
|
||||
}
|
||||
|
|
@ -18643,7 +18643,7 @@ void Player::InitDisplayIds()
|
|||
}
|
||||
|
||||
// Return true is the bought item has a max count to force refresh of window by caller
|
||||
bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot)
|
||||
bool Player::BuyItemFromVendorSlot(ObjectGuid vendorGuid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot)
|
||||
{
|
||||
// cheating attempt
|
||||
if (count < 1) count = 1;
|
||||
|
|
@ -18658,11 +18658,11 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
|
|||
return false;
|
||||
}
|
||||
|
||||
Creature *pCreature = GetNPCIfCanInteractWith(vendorguid,UNIT_NPC_FLAG_VENDOR);
|
||||
Creature *pCreature = GetNPCIfCanInteractWith(vendorGuid, UNIT_NPC_FLAG_VENDOR);
|
||||
if (!pCreature)
|
||||
{
|
||||
DEBUG_LOG( "WORLD: BuyItemFromVendor - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid)) );
|
||||
SendBuyError( BUY_ERR_DISTANCE_TOO_FAR, NULL, item, 0);
|
||||
DEBUG_LOG("WORLD: BuyItemFromVendor - %s not found or you can't interact with him.", vendorGuid.GetString().c_str());
|
||||
SendBuyError(BUY_ERR_DISTANCE_TOO_FAR, NULL, item, 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1232,7 +1232,7 @@ class MANGOS_DLL_SPEC Player : public Unit
|
|||
uint8 FindEquipSlot(ItemPrototype const* proto, uint32 slot, bool swap) const;
|
||||
uint32 GetItemCount(uint32 item, bool inBankAlso = false, Item* skipItem = NULL) const;
|
||||
uint32 GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipItem = NULL) const;
|
||||
Item* GetItemByGuid(ObjectGuid uint64) const;
|
||||
Item* GetItemByGuid(ObjectGuid guid) const;
|
||||
Item* GetItemByEntry(uint32 item) const; // only for special cases
|
||||
Item* GetItemByLimitedCategory(uint32 limitedCategory) const;
|
||||
Item* GetItemByPos( uint16 pos ) const;
|
||||
|
|
@ -1353,7 +1353,7 @@ class MANGOS_DLL_SPEC Player : public Unit
|
|||
return offItem && ((mainItem && mainItem->GetProto()->InventoryType == INVTYPE_2HWEAPON) || offItem->GetProto()->InventoryType == INVTYPE_2HWEAPON);
|
||||
}
|
||||
void SendNewItem( Item *item, uint32 count, bool received, bool created, bool broadcast = false );
|
||||
bool BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot);
|
||||
bool BuyItemFromVendorSlot(ObjectGuid vendorGuid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot);
|
||||
|
||||
float GetReputationPriceDiscount( Creature const* pCreature ) const;
|
||||
|
||||
|
|
@ -1523,7 +1523,7 @@ class MANGOS_DLL_SPEC Player : public Unit
|
|||
|
||||
static uint32 GetZoneIdFromDB(ObjectGuid guid);
|
||||
static uint32 GetLevelFromDB(ObjectGuid guid);
|
||||
static bool LoadPositionFromDB(uint32& mapid, float& x,float& y,float& z,float& o, bool& in_flight, uint64 guid);
|
||||
static bool LoadPositionFromDB(uint32& mapid, float& x,float& y,float& z,float& o, bool& in_flight, ObjectGuid guid);
|
||||
|
||||
/*********************************************************/
|
||||
/*** SAVE SYSTEM ***/
|
||||
|
|
@ -1535,7 +1535,7 @@ class MANGOS_DLL_SPEC Player : public Unit
|
|||
static void SetUInt32ValueInArray(Tokens& data,uint16 index, uint32 value);
|
||||
static void SetFloatValueInArray(Tokens& data,uint16 index, float value);
|
||||
static void Customize(ObjectGuid guid, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair);
|
||||
static void SavePositionInDB(uint32 mapid, float x,float y,float z,float o,uint32 zone,uint64 guid);
|
||||
static void SavePositionInDB(uint32 mapid, float x, float y, float z, float o, uint32 zone, ObjectGuid guid);
|
||||
|
||||
static void DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRealmChars = true, bool deleteFinally = false);
|
||||
static void DeleteOldCharacters();
|
||||
|
|
@ -1803,7 +1803,7 @@ class MANGOS_DLL_SPEC Player : public Unit
|
|||
uint32 GetGuildId() { return GetUInt32Value(PLAYER_GUILDID); }
|
||||
static uint32 GetGuildIdFromDB(ObjectGuid guid);
|
||||
uint32 GetRank(){ return GetUInt32Value(PLAYER_GUILDRANK); }
|
||||
static uint32 GetRankFromDB(uint64 guid);
|
||||
static uint32 GetRankFromDB(ObjectGuid guid);
|
||||
int GetGuildIdInvited() { return m_GuildIdInvited; }
|
||||
static void RemovePetitionsAndSigns(ObjectGuid guid, uint32 type);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "10809"
|
||||
#define REVISION_NR "10810"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue