21#define CHARTER_DISPLAY_ID 16161
29 SF_LOG_DEBUG(
"network",
"Received opcode CMSG_PETITION_BUY");
42 SF_LOG_DEBUG(
"network",
"Petitioner with GUID %u tried sell petition: name %s",
GUID_LOPART(npcGuid), name.c_str());
48 SF_LOG_DEBUG(
"network",
"WORLD: HandlePetitionBuyOpcode - Unit (GUID: %u) not found or you can't interact with him.",
GUID_LOPART(npcGuid));
103 _player->SendNewItem(charter, 1,
true,
false);
113 std::ostringstream ssInvalidPetitionGUIDs;
119 Field* fields = result->Fetch();
120 ssInvalidPetitionGUIDs <<
'\'' << fields[0].
GetUInt32() <<
"', ";
121 }
while (result->NextRow());
125 ssInvalidPetitionGUIDs <<
'\'' << charter->
GetGUIDLow() <<
'\'';
127 SF_LOG_DEBUG(
"network",
"Invalid petition GUIDs: %s", ssInvalidPetitionGUIDs.str().c_str());
130 trans->PAppend(
"DELETE FROM petition WHERE petitionguid IN (%s)", ssInvalidPetitionGUIDs.str().c_str());
131 trans->PAppend(
"DELETE FROM petition_sign WHERE petitionguid IN (%s)", ssInvalidPetitionGUIDs.str().c_str());
145 SF_LOG_DEBUG(
"network",
"Received opcode CMSG_PETITION_SHOW_SIGNATURES");
147 uint8 playerCount = 0;
150 recvData.
ReadGuidMask(petitionGuid, 3, 7, 2, 4, 5, 6, 0, 1);
151 recvData.
ReadGuidBytes(petitionGuid, 2, 4, 5, 7, 1, 0, 3, 6);
168 playerCount =
uint8(result->GetRowCount());
170 SF_LOG_DEBUG(
"network",
"CMSG_PETITION_SHOW_SIGNATURES petition entry: '%u'", petitionGuidLow);
175 for (
uint8 i = 0; i < playerCount; ++i)
177 Field* fields2 = result->Fetch();
196 for (
int i = 0; i < playerCount; i++)
203 for (
int i = 0; i < playerCount; i++)
212 data <<
uint32(petitionGuidLow);
217 delete[] playerGuids;
223 SF_LOG_DEBUG(
"network",
"Received opcode CMSG_PETITION_QUERY");
228 recvData >> guildguid;
230 recvData.
ReadGuidMask(petitionGuid, 2, 3, 1, 0, 4, 7, 6, 5);
231 recvData.
ReadGuidBytes(petitionGuid, 0, 4, 7, 5, 1, 6, 3, 2);
233 SF_LOG_DEBUG(
"network",
"CMSG_PETITION_QUERY Petition GUID %u Guild GUID %u",
GUID_LOPART(petitionGuid), guildguid);
242 std::string name =
"NO_NAME_FOR_GUID";
252 Field* fields = result->Fetch();
267 for (
int i = 0; i < 10; i++)
305 SF_LOG_DEBUG(
"network",
"Received opcode CMSG_PETITION_RENAME");
313 recvData.
ReadGuidMask(petitionGuid, 7, 4, 6, 2, 0, 5, 3, 1);
353 SF_LOG_DEBUG(
"network",
"Received opcode CMSG_PETITION_SIGN");
359 recvData.
ReadGuidMask(petitionGuid, 4, 2, 0, 1, 5, 3, 6, 7);
360 recvData.
ReadGuidBytes(petitionGuid, 6, 1, 7, 2, 5, 3, 0, 4);
375 fields = result->Fetch();
396 if (
_player->GetGuildIdInvited())
447 SF_LOG_DEBUG(
"network",
"Received opcode MSG_PETITION_DECLINE");
452 recvData.
ReadGuidMask(petitionGuid, 5, 6, 4, 3, 1, 7, 0, 2);
453 recvData.
ReadGuidBytes(petitionGuid, 6, 2, 1, 5, 0, 7, 4, 3);
466 Field* fields = result->Fetch();
476 SF_LOG_DEBUG(
"network",
"Received opcode CMSG_OFFER_PETITION");
478 uint8 playerCount = 0;
534 playerCount =
uint8(result->GetRowCount());
538 for (
uint8 i = 0; i < playerCount; ++i)
540 Field* fields2 = result->Fetch();
559 for (
int i = 0; i < playerCount; i++)
566 for (
int i = 0; i < playerCount; i++)
580 delete[] playerGuids;
587 SF_LOG_DEBUG(
"network",
"Received opcode CMSG_TURN_IN_PETITION");
593 recvData.
ReadGuidMask(petitionGuid, 1, 2, 3, 0, 5, 7, 4, 6);
594 recvData.
ReadGuidBytes(petitionGuid, 2, 1, 4, 6, 0, 7, 5, 3);
614 Field* fields = result->Fetch();
621 SF_LOG_ERROR(
"network",
"Player %s (guid: %u) tried to turn in petition (guid: %u) that is not present in the database",
_player->GetName().c_str(),
_player->GetGUIDLow(),
GUID_LOPART(petitionGuid));
626 if (
_player->GetGUIDLow() != ownerguidlo)
636 _player->GetSession()->SendPacket(&data);
655 signatures =
uint8(result->GetRowCount());
662 if (signatures < requiredSignatures)
691 for (
uint8 i = 0; i < signatures; ++i)
693 Field* fields = result->Fetch();
721 SF_LOG_DEBUG(
"network",
"Received CMSG_PETITION_SHOWLIST");
731 SF_LOG_DEBUG(
"network",
"WORLD: HandlePetitionerShowListOpcode - Unit (GUID: %u) not found or you can't interact with him.",
uint32(
GUID_LOPART(guid)));
743 SF_LOG_DEBUG(
"network",
"WORLD: HandlePetitionShowListOpcode - Unit (GUID: %u) not found or you can't interact with him.",
uint32(
GUID_LOPART(guid)));
@ CHAR_INS_PETITION_SIGNATURE
@ CHAR_DEL_PETITION_BY_GUID
@ CHAR_SEL_PETITION_OWNER_BY_GUID
@ CHAR_SEL_PETITION_BY_OWNER
@ CHAR_SEL_PETITION_SIG_BY_ACCOUNT
@ CHAR_SEL_PETITION_SIGNATURE
@ CHAR_SEL_PETITION_SIGNATURES
@ CHAR_DEL_PETITION_SIGNATURE_BY_GUID
@ ERR_GUILD_COMMAND_SUCCESS
@ ERR_GUILD_NAME_EXISTS_S
@ ERR_ALREADY_INVITED_TO_GUILD_S
@ PETITION_SIGN_ALREADY_SIGNED
@ PETITION_TURN_NEED_MORE_SIGNATURES
@ PETITION_TURN_ALREADY_IN_GUILD
@ BUY_ERR_NOT_ENOUGHT_MONEY
#define SF_LOG_DEBUG(filterType__,...)
#define SF_LOG_ERROR(filterType__,...)
uint32 GUID_LOPART(uint64 x)
uint64 MAKE_NEW_GUID(uint32 l, uint32 e, uint32 h)
constexpr uint64 GUILD_CHARTER_COST
constexpr uint8 GUILD_CHARTER_TYPE
constexpr uint32 GUILD_CHARTER
std::vector< ItemPosCount > ItemPosCountVec
Skyfire::AutoPtr< PreparedResultSet, Skyfire::Mutex > PreparedQueryResult
Skyfire::AutoPtr< Transaction, Skyfire::Mutex > SQLTransaction
@ UNIT_NPC_FLAG_PETITIONER
void WriteGuidBytes(const ObjectGuid &guid, Offsets... offsets)
bool WriteBit(uint32 bit)
void WriteGuidMask(const ObjectGuid &guid, Offsets... offsets)
void WriteString(std::string const &str)
uint32 ReadBits(size_t bits)
void ReadGuidBytes(ObjectGuid &guid, Offsets... offsets)
std::string ReadString(size_t length)
void ReadGuidMask(ObjectGuid &guid, Offsets... offsets)
void WriteBits(T value, size_t bits)
std::string GetString() const
bool Create(Player *pLeader, std::string const &name)
static void SendCommandResult(WorldSession *session, GuildCommandType type, GuildCommandError errCode, std::string const ¶m="")
bool AddMember(uint64 guid, uint8 rankId=GUILD_RANK_NONE)
void SetState(ItemUpdateState state, Player *forplayer=NULL)
static Player * FindPlayer(uint64)
ObjectGuid GetObjectGUID() const
uint32 GetGUIDLow() const
void SetUInt32Value(uint16 index, uint32 value)
static bool IsValidCharterName(std::string const &name)
uint32 GetGuildId() const
WorldSession * GetSession() const
int GetGuildIdInvited() const
Creature * GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask)
void setString(const uint8 index, const std::string &value)
void setUInt32(const uint8 index, const uint32 value)
void setUInt8(const uint8 index, const uint8 value)
void RemoveAurasByType(AuraType auraType, uint64 casterGUID=0, Aura *except=NULL, bool negative=true, bool positive=true)
void Initialize(Opcodes opcode, size_t newres=200)
void HandlePetitionShowListOpcode(WorldPacket &recvPacket)
void HandleTurnInPetitionOpcode(WorldPacket &recvData)
void SendPetitionSignResults(ObjectGuid petitionGuid, ObjectGuid playerGuid, uint8 result)
void HandlePetitionShowSignOpcode(WorldPacket &recvData)
Player * GetPlayer() const
void HandlePetitionBuyOpcode(WorldPacket &recvData)
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
uint32 GetAccountId() const
void HandlePetitionQueryOpcode(WorldPacket &recvData)
void SendPetitionShowList(uint64 guid)
void HandlePetitionRenameOpcode(WorldPacket &recvData)
void SendPetitionQueryOpcode(uint64 petitionguid)
void HandleOfferPetitionOpcode(WorldPacket &recvData)
void HandlePetitionDeclineOpcode(WorldPacket &recvData)
void HandlePetitionSignOpcode(WorldPacket &recvData)
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
@ SMSG_PETITION_SHOW_SIGNATURES
@ SMSG_PETITION_QUERY_RESPONSE
@ SMSG_TURN_IN_PETITION_RESULTS
@ SMSG_PETITION_SIGN_RESULTS
@ SMSG_PETITION_RENAME_RESULT
@ CONFIG_MIN_PETITION_SIGNS
@ CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD