static bool HandleArenaCreateCommand(ChatHandler* handler, char const* args) { if (!*args) return false; Player* target; if (!handler->extractPlayerTarget(*args != '"' ? (char*)args : NULL, &target)) return false; char* tailStr = *args != '"' ? strtok(NULL, "") : (char*)args; if (!tailStr) return false; char* name = handler->extractQuotedArg(tailStr); if (!name) return false; char* typeStr = strtok(NULL, ""); if (!typeStr) return false; int8 type = atoi(typeStr); if (sArenaTeamMgr->GetArenaTeamByName(name)) { handler->PSendSysMessage(LANG_ARENA_ERROR_NAME_EXISTS, name); handler->SetSentErrorMessage(true); return false; } if (type == 2 || type == 3 || type == 5 ) { if (Player::GetArenaTeamIdFromDB(target->GetGUID(), type) != 0) { handler->PSendSysMessage(LANG_ARENA_ERROR_SIZE, target->GetName().c_str()); handler->SetSentErrorMessage(true); return false; } ArenaTeam* arena = new ArenaTeam(); if (!arena->Create(target->GetGUID(), type, name, 4293102085, 101, 4293253939, 4, 4284049911)) { delete arena; handler->SendSysMessage(LANG_BAD_VALUE); handler->SetSentErrorMessage(true); return false; } sArenaTeamMgr->AddArenaTeam(arena); handler->PSendSysMessage(LANG_ARENA_CREATE, arena->GetName().c_str(), arena->GetId(), arena->GetType(), arena->GetCaptain().GetCounter()); } else { handler->SendSysMessage(LANG_BAD_VALUE); handler->SetSentErrorMessage(true); return false; } return true; }
void WorldSession::HandleArenaTeamCreateOpcode(WorldPacket & recvData) { sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_CREATE"); // empty opcode uint32 slot; uint32 background; uint32 icon; uint32 iconcolor; uint32 border; uint32 bordercolor; uint8 strLeng; std::string name; recvData >> slot >> icon >> iconcolor >> border >> bordercolor >> background; recvData >> strLeng >> name; // Check for valid arena bracket (2v2, 3v3, 5v5) if (slot >= MAX_ARENA_SLOT) return; uint32 type = ArenaTeam::GetTypeBySlot(slot); if (type >= MAX_ARENA_TYPE) return; // Check if player is already in an arena team if (_player->GetArenaTeamId(slot)) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ALREADY_IN_ARENA_TEAM); return; } // Check if arena team name is already taken if (sArenaTeamMgr->GetArenaTeamByName(name)) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ARENA_TEAM_NAME_EXISTS_S); return; } // Create arena team ArenaTeam* arenaTeam = new ArenaTeam(); if (!arenaTeam->Create(_player->GetGUID(), type, name, background, icon, iconcolor, border, bordercolor)) { delete arenaTeam; return; } // Register arena team sArenaTeamMgr->AddArenaTeam(arenaTeam); sLog->outDebug(LOG_FILTER_NETWORKIO, "ArenaTeamHandler: Arena team (guid: %u) added to ObjectMgr", arenaTeam->GetId()); // Broadcast event arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_JOIN_SS, _player->GetGUID(), 2, _player->GetName(), arenaTeam->GetName(), ""); }
bool CreateArenateam(Player* player, Creature* me) { if (!player || !me) return false; uint8 slot = ArenaTeam::GetSlotByType(ARENA_TEAM_5v5); if (slot >= MAX_ARENA_SLOT) return false; // Check if player is already in an arena team if (player->GetArenaTeamId(slot)) { player->GetSession()->SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, player->GetName(), "", ERR_ALREADY_IN_ARENA_TEAM); return false; } // Teamname = playername // if team name exist, we have to choose another name (playername + number) int i = 1; std::stringstream teamName; //teamName << "3vs3 Solo - " << player->GetName(); teamName << player->GetName(); do { if (sArenaTeamMgr->GetArenaTeamByName(teamName.str()) != NULL) // teamname exist, so choose another name { teamName.str(std::string()); teamName << player->GetName() << i++; } else break; } while (i < 100); // should never happen // Create arena team ArenaTeam* arenaTeam = new ArenaTeam(); if (!arenaTeam->Create(player->GetGUID(), ARENA_TEAM_5v5, teamName.str(), 4283124816, 45, 4294242303, 5, 4294705149)) { delete arenaTeam; return false; } // Register arena team sArenaTeamMgr->AddArenaTeam(arenaTeam); arenaTeam->AddMember(player->GetGUID()); ChatHandler(player->GetSession()).SendSysMessage("Arena team successful created!"); return true; }
void WorldSession::HandleArenaTeamCreateOpcode(WorldPacket & recvData) { sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_CREATE"); uint32 icon, backgroundColor, borderColor, iconColor, border, slot; std::string name; recvData >> icon; recvData >> backgroundColor; recvData >> borderColor; recvData >> iconColor; recvData >> border; recvData >> slot; recvData >> name; // Perform checks if (_player->getLevel() < sWorld->getIntConfig(CONFIG_ARENA_MIN_LEVEL)) // TODO: implement error message return; if (_player->GetArenaTeamId(slot)) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ALREADY_IN_ARENA_TEAM); return; } if (sArenaTeamMgr->GetArenaTeamByName(name)) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ARENA_TEAM_NAME_EXISTS_S); return; } if (sObjectMgr->IsReservedName(name) || !ObjectMgr::IsValidCharterName(name)) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ARENA_TEAM_NAME_INVALID); return; } // Create arena team ArenaTeam* arenaTeam = new ArenaTeam(); if (!arenaTeam->Create(_player->GetGUID(), ArenaTeam::GetTypeBySlot(slot), name, backgroundColor, icon, iconColor, border, borderColor)) { delete arenaTeam; return; } // Register arena team sArenaTeamMgr->AddArenaTeam(arenaTeam); sLog->outDebug(LOG_FILTER_NETWORKIO, "PetitonsHandler: Arena team (guid: %u) added to ObjectMgr", arenaTeam->GetId()); }
void WorldSession::HandleArenaTeamCreateOpcode(WorldPacket & recvData) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ARENA_TEAM_CREATE"); uint32 slot, icon, iconcolor, border, bordercolor, background; std::string name; recvData >> slot; recvData >> icon; recvData >> bordercolor; recvData >> border; recvData >> background; recvData >> iconcolor; name = recvData.ReadString(recvData.ReadBits(8)); uint8 type = ArenaTeam::GetTypeBySlot(slot); if (_player->GetArenaTeamId(slot)) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", _player->GetName(), ERR_ALREADY_IN_ARENA_TEAM_S); return; } if (sObjectMgr->IsReservedName(name) || !ObjectMgr::IsValidCharterName(name)) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ARENA_TEAM_NAME_INVALID); return; } if (sArenaTeamMgr->GetArenaTeamByName(name)) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ARENA_TEAM_NAME_EXISTS_S); return; } ArenaTeam* arenaTeam = new ArenaTeam; if (!arenaTeam->Create(GUID_LOPART(_player->GetGUID()), type, name, background, icon, iconcolor, border, bordercolor)) { sLog->outError(LOG_FILTER_ARENAS, "Arena team create failed."); delete arenaTeam; return; } sArenaTeamMgr->AddArenaTeam(arenaTeam); SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ARENA_TEAM_CREATED); }
void WorldSession::HandleArenaTeamCreate(WorldPacket & recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_CREATE"); uint32 type, icon, iconcolor, border, bordercolor, background; std::string name; recv_data >> background >> icon >> iconcolor >> border >> bordercolor; recv_data >> type; recv_data >> name; ArenaTeam* at = new ArenaTeam; if (!at->Create(GUID_LOPART(_player->GetGUIDLow()), type, name, background, icon, iconcolor, border, bordercolor)) { sLog->outError("ArenaTeamHandler: arena team create failed."); delete at; return; } // register team and add captain sArenaTeamMgr->AddArenaTeam(at); }
void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recv_data) { DEBUG_LOG("Received opcode CMSG_TURN_IN_PETITION"); // ok // recv_data.hexlike(); ObjectGuid petitionGuid; 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; // data QueryResult* result = CharacterDatabase.PQuery("SELECT ownerguid, name, type FROM petition WHERE petitionguid = '%u'", petitionGuid.GetCounter()); if (result) { Field* fields = result->Fetch(); ownerGuid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32()); name = fields[1].GetCppString(); type = fields[2].GetUInt32(); delete result; } else { sLog.outError("CMSG_TURN_IN_PETITION: petition table not have data for guid %u!", petitionGuid.GetCounter()); return; } if (type == 9) { if (_player->GetGuildId()) { WorldPacket data(SMSG_TURN_IN_PETITION_RESULTS, 4); data << uint32(PETITION_TURN_ALREADY_IN_GUILD); // already in guild _player->GetSession()->SendPacket(data); return; } } else { if (!IsArenaTypeValid(ArenaType(type))) return; uint8 slot = ArenaTeam::GetSlotByType(ArenaType(type)); if (slot >= MAX_ARENA_SLOT) return; if (_player->GetArenaTeamId(slot)) { // data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4); // data << (uint32)PETITION_TURN_ALREADY_IN_GUILD; // already in guild //_player->GetSession()->SendPacket(data); SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ALREADY_IN_ARENA_TEAM); return; } } if (_player->GetObjectGuid() != ownerGuid) return; // signs result = CharacterDatabase.PQuery("SELECT playerguid FROM petition_sign WHERE petitionguid = '%u'", petitionGuid.GetCounter()); uint8 signs = result ? (uint8)result->GetRowCount() : 0; uint32 count = type == 9 ? sWorld.getConfig(CONFIG_UINT32_MIN_PETITION_SIGNS) : type - 1; if (signs < count) { WorldPacket data(SMSG_TURN_IN_PETITION_RESULTS, 4); data << uint32(PETITION_TURN_NEED_MORE_SIGNATURES); // need more signatures... SendPacket(data); delete result; return; } if (type == 9) { if (sGuildMgr.GetGuildByName(name)) { SendGuildCommandResult(GUILD_CREATE_S, name, ERR_GUILD_NAME_EXISTS_S); delete result; return; } } else { if (sObjectMgr.GetArenaTeamByName(name)) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ARENA_TEAM_NAME_EXISTS_S); delete result; return; } } // and at last charter item check Item* item = _player->GetItemByGuid(petitionGuid); if (!item) { delete result; return; } // OK! // delete charter item _player->DestroyItem(item->GetBagSlot(), item->GetSlot(), true); if (type == 9) // create guild { Guild* guild = new Guild; if (!guild->Create(_player, name)) { delete guild; delete result; return; } // register guild and add guildmaster sGuildMgr.AddGuild(guild); // add members for (uint8 i = 0; i < signs; ++i) { Field* fields = result->Fetch(); ObjectGuid signGuid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32()); if (!signGuid) continue; guild->AddMember(signGuid, guild->GetLowestRank()); result->NextRow(); } } else // or arena team { ArenaTeam* at = new ArenaTeam; if (!at->Create(_player->GetObjectGuid(), ArenaType(type), name)) { sLog.outError("PetitionsHandler: arena team create failed."); delete at; delete result; return; } uint32 icon, iconcolor, border, bordercolor, backgroud; recv_data >> backgroud >> icon >> iconcolor >> border >> bordercolor; at->SetEmblem(backgroud, icon, iconcolor, border, bordercolor); // register team and add captain sObjectMgr.AddArenaTeam(at); DEBUG_LOG("PetitonsHandler: arena team added to objmrg"); // add members for (uint8 i = 0; i < signs; ++i) { Field* fields = result->Fetch(); ObjectGuid memberGUID = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32()); if (!memberGUID) continue; DEBUG_LOG("PetitionsHandler: adding arena member %s", memberGUID.GetString().c_str()); at->AddMember(memberGUID); result->NextRow(); } } delete result; CharacterDatabase.BeginTransaction(); 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 %s", petitionGuid.GetString().c_str()); WorldPacket data(SMSG_TURN_IN_PETITION_RESULTS, 4); data << uint32(PETITION_TURN_OK); SendPacket(data); }
void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_TURN_IN_PETITION"); // Get petition guid from packet WorldPacket data; uint64 petitionGuid; recvData >> petitionGuid; // Check if player really has the required petition charter Item* item = _player->GetItemByGuid(petitionGuid); if (!item) return; sLog->outDebug(LOG_FILTER_NETWORKIO, "Petition %u turned in by %u", GUID_LOPART(petitionGuid), _player->GetGUIDLow()); // Get petition data from db uint32 ownerguidlo; uint32 type; std::string name; PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION); stmt->setUInt32(0, GUID_LOPART(petitionGuid)); PreparedQueryResult result = CharacterDatabase.Query(stmt); if (result) { Field* fields = result->Fetch(); ownerguidlo = fields[0].GetUInt32(); name = fields[1].GetString(); type = fields[2].GetUInt8(); } else { sLog->outError(LOG_FILTER_NETWORKIO, "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)); return; } // Only the petition owner can turn in the petition if (_player->GetGUIDLow() != ownerguidlo) return; // Petition type (guild/arena) specific checks if (type == GUILD_CHARTER_TYPE) { // Check if player is already in a guild if (_player->GetGuildId()) { data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4); data << uint32(PETITION_TURN_ALREADY_IN_GUILD); _player->GetSession()->SendPacket(&data); return; } // Check if guild name is already taken if (sGuildMgr->GetGuildByName(name)) { Guild::SendCommandResult(this, GUILD_COMMAND_CREATE, ERR_GUILD_NAME_EXISTS_S, name); return; } } else { // Check for valid arena bracket (2v2, 3v3, 5v5) uint8 slot = ArenaTeam::GetSlotByType(type); if (slot >= MAX_ARENA_SLOT) return; // Check if player is already in an arena team if (_player->GetArenaTeamId(slot)) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ALREADY_IN_ARENA_TEAM); return; } // Check if arena team name is already taken if (sArenaTeamMgr->GetArenaTeamByName(name)) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ARENA_TEAM_NAME_EXISTS_S); return; } } // Get petition signatures from db uint8 signatures; stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_SIGNATURE); stmt->setUInt32(0, GUID_LOPART(petitionGuid)); result = CharacterDatabase.Query(stmt); if (result) signatures = uint8(result->GetRowCount()); else signatures = 0; uint32 requiredSignatures; if (type == GUILD_CHARTER_TYPE) requiredSignatures = sWorld->getIntConfig(CONFIG_MIN_PETITION_SIGNS); else requiredSignatures = type-1; // Notify player if signatures are missing if (signatures < requiredSignatures) { data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4); data << (uint32)PETITION_TURN_NEED_MORE_SIGNATURES; SendPacket(&data); return; } // Proceed with guild/arena team creation // Delete charter item _player->DestroyItem(item->GetBagSlot(), item->GetSlot(), true); if (type == GUILD_CHARTER_TYPE) { // Create guild Guild* guild = new Guild; if (!guild->Create(_player, name)) { delete guild; return; } // Register guild and add guild master sGuildMgr->AddGuild(guild); Guild::SendCommandResult(this, GUILD_COMMAND_CREATE, ERR_GUILD_COMMAND_SUCCESS, name); // Add members from signatures for (uint8 i = 0; i < signatures; ++i) { Field* fields = result->Fetch(); guild->AddMember(MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER)); result->NextRow(); } } else { // Receive the rest of the packet in arena team creation case uint32 background, icon, iconcolor, border, bordercolor; recvData >> background >> icon >> iconcolor >> border >> bordercolor; // Create arena team ArenaTeam* arenaTeam = new ArenaTeam(); if (!arenaTeam->Create(_player->GetGUID(), type, name, background, icon, iconcolor, border, bordercolor)) { delete arenaTeam; return; } // Register arena team sArenaTeamMgr->AddArenaTeam(arenaTeam); sLog->outDebug(LOG_FILTER_NETWORKIO, "PetitonsHandler: Arena team (guid: %u) added to ObjectMgr", arenaTeam->GetId()); // Add members for (uint8 i = 0; i < signatures; ++i) { Field* fields = result->Fetch(); uint32 memberGUID = fields[0].GetUInt32(); sLog->outDebug(LOG_FILTER_NETWORKIO, "PetitionsHandler: Adding arena team (guid: %u) member %u", arenaTeam->GetId(), memberGUID); arenaTeam->AddMember(MAKE_NEW_GUID(memberGUID, 0, HIGHGUID_PLAYER)); result->NextRow(); } } SQLTransaction trans = CharacterDatabase.BeginTransaction(); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_BY_GUID); stmt->setUInt32(0, GUID_LOPART(petitionGuid)); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_SIGNATURE_BY_GUID); stmt->setUInt32(0, GUID_LOPART(petitionGuid)); trans->Append(stmt); CharacterDatabase.CommitTransaction(trans); // created sLog->outDebug(LOG_FILTER_NETWORKIO, "TURN IN PETITION GUID %u", GUID_LOPART(petitionGuid)); data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4); data << (uint32)PETITION_TURN_OK; SendPacket(&data); }
void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data) { CHECK_PACKET_SIZE(recv_data, 8); sLog.outDebug("Received opcode CMSG_TURN_IN_PETITION"); // ok //recv_data.hexlike(); WorldPacket data; uint64 petitionguid; uint32 ownerguidlo; uint32 type; std::string name; recv_data >> petitionguid; sLog.outDebug("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) { Field *fields = result->Fetch(); ownerguidlo = fields[0].GetUInt32(); name = fields[1].GetCppString(); type = fields[2].GetUInt32(); delete result; } else { sLog.outError("petition table has broken data!"); return; } if(type == 9) { if(_player->GetGuildId()) { data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4); data << (uint32)PETITION_TURN_ALREADY_IN_GUILD; // already in guild _player->GetSession()->SendPacket(&data); return; } } else { uint8 slot = ArenaTeam::GetSlotByType(type); if(slot >= MAX_ARENA_SLOT) return; if(_player->GetArenaTeamId(slot)) { //data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4); //data << (uint32)PETITION_TURN_ALREADY_IN_GUILD; // already in guild //_player->GetSession()->SendPacket(&data); SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ALREADY_IN_ARENA_TEAM); return; } } if(_player->GetGUIDLow() != ownerguidlo) return; // signs uint8 signs; result = CharacterDatabase.PQuery("SELECT playerguid FROM petition_sign WHERE petitionguid = '%u'", GUID_LOPART(petitionguid)); if(result) signs = result->GetRowCount(); else signs = 0; uint32 count; //if(signs < sWorld.getConfig(CONFIG_MIN_PETITION_SIGNS)) if(type == 9) count = sWorld.getConfig(CONFIG_MIN_PETITION_SIGNS); else count = type-1; if(signs < count) { data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4); data << (uint32)PETITION_TURN_NEED_MORE_SIGNATURES; // need more signatures... SendPacket(&data); delete result; return; } if(type == 9) { if(objmgr.GetGuildByName(name)) { SendGuildCommandResult(GUILD_CREATE_S, name, GUILD_NAME_EXISTS); delete result; return; } } else { if(objmgr.GetArenaTeamByName(name)) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ARENA_TEAM_NAME_EXISTS_S); delete result; return; } } // and at last charter item check Item *item = _player->GetItemByGuid(petitionguid); if(!item) { delete result; return; } // OK! // delete charter item _player->DestroyItem(item->GetBagSlot(),item->GetSlot(), true); if(type == 9) // create guild { Guild* guild = new Guild; if(!guild->create(_player->GetGUID(), name)) { delete guild; delete result; return; } // register guild and add guildmaster objmgr.AddGuild(guild); // add members for(uint8 i = 0; i < signs; ++i) { Field* fields = result->Fetch(); guild->AddMember(fields[0].GetUInt64(), guild->GetLowestRank()); result->NextRow(); } } else // or arena team { ArenaTeam* at = new ArenaTeam; if(!at->Create(_player->GetGUID(), type, name)) { sLog.outError("PetitionsHandler: arena team create failed."); delete at; delete result; return; } CHECK_PACKET_SIZE(recv_data, 8+5*4); uint32 icon, iconcolor, border, bordercolor, backgroud; recv_data >> backgroud >> icon >> iconcolor >> border >> bordercolor; at->SetEmblem(backgroud, icon, iconcolor, border, bordercolor); // register team and add captain objmgr.AddArenaTeam(at); sLog.outDebug("PetitonsHandler: arena team added to objmrg"); // add members for(uint8 i = 0; i < signs; ++i) { Field* fields = result->Fetch(); uint64 memberGUID = fields[0].GetUInt64(); sLog.outDebug("PetitionsHandler: adding arena member %u", GUID_LOPART(memberGUID)); at->AddMember(memberGUID); result->NextRow(); } } 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.CommitTransaction(); // created sLog.outDebug("TURN IN PETITION GUID %u", GUID_LOPART(petitionguid)); data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4); data << (uint32)PETITION_TURN_OK; SendPacket(&data); }