void ProcessLoop(void *tmp) { #else void *ProcessLoop(void *tmp) { #endif srand(time(NULL)); bool worldwasconnected = worldserver.Connected(); ProcessLoopRunning = true; while(RunLoops) { if (worldserver.Connected()) { worldserver.Process(); worldwasconnected = true; } else { if (worldwasconnected && ZoneLoaded) entity_list.ChannelMessageFromWorld(0, 0, 6, 0, 0, "WARNING: World server connection lost"); worldwasconnected = false; } if (ZoneLoaded) { if (numclients > 0) // Don't run entity_list Process() unless there are clients inside. entity_list.Process(); else entity_list.BoatProcessOnly(); // Tazadar : We move boats even if the zone is empty ! if (!zone->Process()) { Zone::Shutdown(); } } Sleep(1); } ProcessLoopRunning = false; #ifndef WIN32 return 0; #endif }
void GuildApproval::GuildApproved() { char petitext[PBUFFER] = "A new guild was founded! Guildname: "; char gmembers[MBUFFER] = " "; if(!owner) return; database.GetVariable("GuildCreation", founders, 3); uint8 tmp = atoi(founders); uint32 tmpeq = guild_mgr.CreateGuild(guild, owner->CharacterID()); guild_mgr.SetGuild(owner->CharacterID(),tmpeq,2); owner->SendAppearancePacket(AT_GuildID,true,false); for(int i=0;i<tmp;i++) { if(members[i]) { owner->Message(CC_Default, "%s",members[i]->GetName()); owner->Message(CC_Default, "%i",members[i]->CharacterID()); guild_mgr.SetGuild(members[i]->CharacterID(),tmpeq,0); size_t len = MBUFFER - strlen(gmembers)+1; strncat(gmembers," ",len); strncat(gmembers,members[i]->GetName(),len); } } size_t len = PBUFFER - strlen(petitext)+1; strncat(petitext,guild,len); strncat(petitext," Leader: ",len); strncat(petitext,owner->CastToClient()->GetName(),len); strncat(petitext," Members:",len); strncat(petitext,gmembers,len); Petition* pet = new Petition(owner->CastToClient()->CharacterID()); pet->SetAName(owner->CastToClient()->AccountName()); pet->SetClass(owner->CastToClient()->GetClass()); pet->SetLevel(owner->CastToClient()->GetLevel()); pet->SetCName(owner->CastToClient()->GetName()); pet->SetRace(owner->CastToClient()->GetRace()); pet->SetLastGM(""); pet->SetCName(owner->CastToClient()->GetName()); //aza77 is this really 2 times needed ?? pet->SetPetitionText(petitext); pet->SetZone(zone->GetZoneID()); pet->SetUrgency(0); petition_list.AddPetition(pet); database.InsertPetitionToDB(pet); petition_list.UpdateGMQueue(); petition_list.UpdateZoneListQueue(); worldserver.SendEmoteMessage(0, 0, 80, 15, "%s has made a petition. #%i", owner->CastToClient()->GetName(), pet->GetID()); ServerPacket* pack = new ServerPacket; pack->opcode = ServerOP_RefreshGuild; pack->size = tmp; pack->pBuffer = new uchar[pack->size]; memcpy(pack->pBuffer, &tmpeq, 4); worldserver.SendPacket(pack); safe_delete(pack); owner->Message(CC_Default, "Your guild was created."); owner = 0; }
void Raid::GroupUpdate(uint32 gid, bool initial) { if(gid > 11) //ungrouped member doesn't need grouping. return; for(int x = 0; x < MAX_RAID_MEMBERS; x++) { if(strlen(members[x].membername) > 0){ if(members[x].GroupNumber == gid){ if(members[x].member) { SendGroupUpdate(members[x].member); SendGroupLeadershipAA(members[x].member, gid); } } } } if(initial){ ServerPacket *pack = new ServerPacket(ServerOP_UpdateGroup, sizeof(ServerRaidGeneralAction_Struct)); ServerRaidGeneralAction_Struct* rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer; rga->gid = gid; rga->rid = GetID(); rga->zoneid = zone->GetZoneID(); rga->instance_id = zone->GetInstanceID(); worldserver.SendPacket(pack); safe_delete(pack); } }
void RemoteCallSubscriptionHandler::Process() { //create a check for all these connection ids packet uint32 sz = 12; auto iter = connection_ids.begin(); while(iter != connection_ids.end()) { sz += (uint32)iter->first.size(); sz += 5; ++iter; } if (!zone) return; ServerPacket *pack = new ServerPacket(ServerOP_WIClientSession, sz); pack->WriteUInt32((uint32)zone->GetZoneID()); pack->WriteUInt32((uint32)zone->GetInstanceID()); pack->WriteUInt32((uint32)connection_ids.size()); iter = connection_ids.begin(); while(iter != connection_ids.end()) { pack->WriteUInt32((uint32)iter->first.size()); pack->WriteString(iter->first.c_str()); ++iter; } worldserver.SendPacket(pack); safe_delete(pack); }
void Raid::AddMember(Client *c, uint32 group, bool rleader, bool groupleader, bool looter){ if(!c) return; char errbuf[MYSQL_ERRMSG_SIZE]; char* query = 0; MYSQL_RES *result; if (database.RunQuery(query,MakeAnyLenString(&query, "INSERT INTO raid_members SET raidid=%lu, charid=%lu, groupid=%lu, _class=%d, level=%d, name='%s', isgroupleader=%d, israidleader=%d, islooter=%d", (unsigned long)GetID(), (unsigned long)c->CharacterID(), (unsigned long)group, c->GetClass(), c->GetLevel(), c->GetName(), groupleader, rleader, looter ),errbuf,&result)){ mysql_free_result(result); } safe_delete_array(query); LearnMembers(); VerifyRaid(); if(group < 12) GroupUpdate(group); SendRaidAddAll(c->GetName()); c->SetRaidGrouped(true); ServerPacket *pack = new ServerPacket(ServerOP_RaidAdd, sizeof(ServerRaidGeneralAction_Struct)); ServerRaidGeneralAction_Struct *rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer; rga->rid = GetID(); strn0cpy(rga->playername, c->GetName(), 64); rga->zoneid = zone->GetZoneID(); rga->instance_id = zone->GetInstanceID(); worldserver.SendPacket(pack); safe_delete(pack); }
void Raid::SetGroupLeader(const char *who, bool glFlag) { char errbuf[MYSQL_ERRMSG_SIZE]; char* query = 0; MYSQL_RES *result; if (database.RunQuery(query,MakeAnyLenString(&query, "UPDATE raid_members SET isgroupleader=%lu WHERE name='%s'", (unsigned long)glFlag, who),errbuf,&result)){ mysql_free_result(result); } safe_delete_array(query); LearnMembers(); VerifyRaid(); //if(glFlag == true){ //we're setting the flag //this->SendMakeGroupLeaderPacket(who); //} ServerPacket *pack = new ServerPacket(ServerOP_RaidGroupLeader, sizeof(ServerRaidGeneralAction_Struct)); ServerRaidGeneralAction_Struct *rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer; rga->rid = GetID(); strn0cpy(rga->playername, who, 64); rga->zoneid = zone->GetZoneID(); rga->instance_id = zone->GetInstanceID(); worldserver.SendPacket(pack); safe_delete(pack); }
void Raid::DisbandRaid() { char errbuf[MYSQL_ERRMSG_SIZE]; char* query = 0; MYSQL_RES *result; if (database.RunQuery(query,MakeAnyLenString(&query, "DELETE FROM raid_members WHERE raidid=%lu", (unsigned long)GetID()),errbuf,&result)){ mysql_free_result(result); } safe_delete_array(query); LearnMembers(); VerifyRaid(); SendRaidDisbandAll(); ServerPacket *pack = new ServerPacket(ServerOP_RaidDisband, sizeof(ServerRaidGeneralAction_Struct)); ServerRaidGeneralAction_Struct *rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer; rga->rid = GetID(); strn0cpy(rga->playername, " ", 64); rga->zoneid = zone->GetZoneID(); rga->instance_id = zone->GetInstanceID(); worldserver.SendPacket(pack); safe_delete(pack); forceDisband = true; }
void Raid::LockRaid(bool lockFlag) { char errbuf[MYSQL_ERRMSG_SIZE]; char* query = 0; MYSQL_RES *result; if (database.RunQuery(query,MakeAnyLenString(&query, "UPDATE raid_details SET locked=%d WHERE raidid=%lu", lockFlag, (unsigned long)GetID()),errbuf,&result)){ mysql_free_result(result); } safe_delete_array(query); locked = lockFlag; if(lockFlag) SendRaidLock(); else SendRaidUnlock(); ServerPacket *pack = new ServerPacket(ServerOP_RaidLockFlag, sizeof(ServerRaidGeneralAction_Struct)); ServerRaidGeneralAction_Struct *rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer; rga->rid = GetID(); rga->zoneid = zone->GetZoneID(); rga->gid = lockFlag; rga->instance_id = zone->GetInstanceID(); worldserver.SendPacket(pack); safe_delete(pack); }
void Raid::RemoveMember(const char *c) { char errbuf[MYSQL_ERRMSG_SIZE]; char* query = 0; MYSQL_RES *result; if (database.RunQuery(query,MakeAnyLenString(&query, "DELETE FROM raid_members where name='%s'", c ),errbuf,&result)){ mysql_free_result(result); } Client *m = entity_list.GetClientByName(c); safe_delete_array(query); disbandCheck = true; SendRaidRemoveAll(c); SendRaidDisband(m); LearnMembers(); VerifyRaid(); if(m){ m->SetRaidGrouped(false); } ServerPacket *pack = new ServerPacket(ServerOP_RaidRemove, sizeof(ServerRaidGeneralAction_Struct)); ServerRaidGeneralAction_Struct *rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer; rga->rid = GetID(); rga->instance_id = zone->GetInstanceID(); strn0cpy(rga->playername, c, 64); rga->zoneid = zone->GetZoneID(); worldserver.SendPacket(pack); safe_delete(pack); }
void Raid::SetRaidLeader(const char *wasLead, const char *name) { std::string query = StringFormat("UPDATE raid_members SET israidleader = 0 WHERE name = '%s'", wasLead); auto results = database.QueryDatabase(query); if (!results.Success()) LogFile->write(EQEMuLog::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); query = StringFormat("UPDATE raid_members SET israidleader = 1 WHERE name = '%s'", name); results = database.QueryDatabase(query); if (!results.Success()) LogFile->write(EQEMuLog::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); strn0cpy(leadername, name, 64); Client *c = entity_list.GetClientByName(name); if(c) SetLeader(c); LearnMembers(); VerifyRaid(); SendMakeLeaderPacket(name); ServerPacket *pack = new ServerPacket(ServerOP_RaidLeader, sizeof(ServerRaidGeneralAction_Struct)); ServerRaidGeneralAction_Struct *rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer; rga->rid = GetID(); strn0cpy(rga->playername, name, 64); rga->zoneid = zone->GetZoneID(); rga->instance_id = zone->GetInstanceID(); worldserver.SendPacket(pack); safe_delete(pack); }
void Client::SendGuildMembers() { uint32 len; uint8 *data = guild_mgr.MakeGuildMembers(GuildID(), GetName(), len); if(data == nullptr) return; //invalid guild, shouldent happen. auto outapp = new EQApplicationPacket(OP_GuildMemberList); outapp->size = len; outapp->pBuffer = data; data = nullptr; Log(Logs::Detail, Logs::Guilds, "Sending OP_GuildMemberList of length %d", outapp->size); FastQueuePacket(&outapp); auto pack = new ServerPacket(ServerOP_RequestOnlineGuildMembers, sizeof(ServerRequestOnlineGuildMembers_Struct)); ServerRequestOnlineGuildMembers_Struct *srogms = (ServerRequestOnlineGuildMembers_Struct*)pack->pBuffer; srogms->FromID = CharacterID(); srogms->GuildID = GuildID(); worldserver.SendPacket(pack); safe_delete(pack); // We need to send the Guild URL and Channel name again, as sending OP_GuildMemberList appears to clear this information out. SendGuildURL(); SendGuildChannel(); }
void QueryServ::SendQuery(std::string Query) { ServerPacket* pack = new ServerPacket(ServerOP_QSSendQuery, Query.length() + 5); pack->WriteUInt32(Query.length()); /* Pack Query String Size so it can be dynamically broken out at queryserv */ pack->WriteString(Query.c_str()); /* Query */ worldserver.SendPacket(pack); safe_delete(pack); }
void Shutdown() { Zone::Shutdown(true); RunLoops = false; worldserver.Disconnect(); Log.Out(Logs::General, Logs::Zone_Server, "Shutting down..."); Log.CloseFileLogs(); }
void PetitionList::UpdateZoneListQueue() { ServerPacket* pack = new ServerPacket(ServerOP_Petition, sizeof(ServerPetitionUpdate_Struct)); ServerPetitionUpdate_Struct* pupdate = (ServerPetitionUpdate_Struct*) pack->pBuffer; pupdate->petid = 0x00; pupdate->status = 0x00; worldserver.SendPacket(pack); safe_delete(pack); }
void Shutdown() { Zone::Shutdown(true); RunLoops = false; worldserver.Disconnect(); // safe_delete(worldserver); _log(ZONE__INIT, "Shutting down..."); }
void ZoneGuildManager::SendGuildDelete(uint32 guild_id) { Log.Out(Logs::Detail, Logs::Guilds, "Sending guild delete for guild %d to world", guild_id); ServerPacket* pack = new ServerPacket(ServerOP_DeleteGuild, sizeof(ServerGuildID_Struct)); ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer; s->guild_id = guild_id; worldserver.SendPacket(pack); safe_delete(pack); }
void Shutdown() { Zone::Shutdown(true); RunLoops = false; worldserver.Disconnect(); // safe_delete(worldserver); LogFile->write(EQEMuLog::Status, "Shutting down..."); }
void Shutdown() { Zone::Shutdown(true); MNetLoop.lock(); RunLoops = false; worldserver.Disconnect(); MNetLoop.unlock(); // safe_delete(worldserver); EQC::Common::PrintF(CP_ZONESERVER, "Shutting down...\n"); }
void ZoneGuildManager::RequestOnlineGuildMembers(uint32 FromID, uint32 GuildID) { ServerPacket* pack = new ServerPacket(ServerOP_RequestOnlineGuildMembers, sizeof(ServerRequestOnlineGuildMembers_Struct)); ServerRequestOnlineGuildMembers_Struct *srogm = (ServerRequestOnlineGuildMembers_Struct*)pack->pBuffer; srogm->FromID = FromID; srogm->GuildID = GuildID; worldserver.SendPacket(pack); safe_delete(pack); }
void ZoneGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, bool rank, bool relation) { Log.Out(Logs::Detail, Logs::Guilds, "Sending guild refresh for %d to world, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation); ServerPacket* pack = new ServerPacket(ServerOP_RefreshGuild, sizeof(ServerGuildRefresh_Struct)); ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer; s->guild_id = guild_id; s->name_change = name; s->motd_change = motd; s->rank_change = rank; s->relation_change = relation; worldserver.SendPacket(pack); safe_delete(pack); }
void ServerManager::Process() { ProcessDisconnect(); EmuTCPConnection *tcp_c = nullptr; while(tcp_c = tcps->NewQueuePop()) { in_addr tmp; tmp.s_addr = tcp_c->GetrIP(); server_log->Log(log_network, "New world server connection from %s:%d", inet_ntoa(tmp), tcp_c->GetrPort()); WorldServer *cur = GetServerByAddress(tcp_c->GetrIP()); if(cur) { server_log->Log(log_network, "World server already existed for %s, removing existing connection and updating current.", inet_ntoa(tmp)); cur->GetConnection()->Free(); cur->SetConnection(tcp_c); cur->Reset(); } else { WorldServer *w = new WorldServer(tcp_c); world_servers.push_back(w); } } list<WorldServer*>::iterator iter = world_servers.begin(); while(iter != world_servers.end()) { if((*iter)->Process() == false) { server_log->Log(log_world, "World server %s had a fatal error and had to be removed from the login.", (*iter)->GetLongName().c_str()); delete (*iter); iter = world_servers.erase(iter); } else { ++iter; } } }
void Raid::SendRaidMOTDToWorld() { if (motd.empty()) return; size_t size = motd.size() + 1; ServerPacket *pack = new ServerPacket(ServerOP_RaidMOTD, sizeof(ServerRaidMOTD_Struct) + size); ServerRaidMOTD_Struct *smotd = (ServerRaidMOTD_Struct *)pack->pBuffer; smotd->rid = GetID(); strn0cpy(smotd->motd, motd.c_str(), size); worldserver.SendPacket(pack); safe_delete(pack); }
void ZoneGuildManager::SendGuildMemberUpdateToWorld(const char *MemberName, uint32 GuildID, uint16 ZoneID, uint32 LastSeen) { ServerPacket* pack = new ServerPacket(ServerOP_GuildMemberUpdate, sizeof(ServerGuildMemberUpdate_Struct)); ServerGuildMemberUpdate_Struct *sgmus = (ServerGuildMemberUpdate_Struct*)pack->pBuffer; sgmus->GuildID = GuildID; strn0cpy(sgmus->MemberName, MemberName, sizeof(sgmus->MemberName)); sgmus->ZoneID = ZoneID; sgmus->LastSeen = LastSeen; worldserver.SendPacket(pack); safe_delete(pack); }
void Group::DisbandGroup() { EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate,sizeof(GroupUpdate_Struct)); GroupUpdate_Struct* gu = (GroupUpdate_Struct*) outapp->pBuffer; gu->action = groupActDisband; Client *Leader = nullptr; uint32 i; for (i = 0; i < MAX_GROUP_MEMBERS; i++) { if (members[i] == nullptr) { continue; } if (members[i]->IsClient()) { if(IsLeader(members[i])) { Leader = members[i]->CastToClient(); } strcpy(gu->yourname, members[i]->GetName()); database.SetGroupID(members[i]->GetName(), 0, members[i]->CastToClient()->CharacterID()); members[i]->CastToClient()->QueuePacket(outapp); } members[i]->SetGrouped(false); members[i] = nullptr; membername[i][0] = '\0'; } ServerPacket* pack = new ServerPacket(ServerOP_DisbandGroup, sizeof(ServerDisbandGroup_Struct)); ServerDisbandGroup_Struct* dg = (ServerDisbandGroup_Struct*)pack->pBuffer; dg->zoneid = zone->GetZoneID(); dg->groupid = GetID(); dg->instance_id = zone->GetInstanceID(); worldserver.SendPacket(pack); safe_delete(pack); entity_list.RemoveGroup(GetID()); if(GetID() != 0) { database.ClearGroup(GetID()); } safe_delete(outapp); }
void Raid::RaidSay(const char *msg, Client *c) { if(!c) return; ServerPacket *pack = new ServerPacket(ServerOP_RaidSay, sizeof(ServerRaidMessage_Struct) + strlen(msg) + 1); ServerRaidMessage_Struct *rga = (ServerRaidMessage_Struct*)pack->pBuffer; rga->rid = GetID(); rga->gid = 0xFFFFFFFF; strn0cpy(rga->from, c->GetName(), 64); strcpy(rga->message, msg); // this is safe because we are allocating enough space for the entire msg above worldserver.SendPacket(pack); safe_delete(pack); }
void Raid::SetGroupLeader(const char *who, bool glFlag) { std::string query = StringFormat("UPDATE raid_members SET isgroupleader = %lu WHERE name = '%s'", (unsigned long)glFlag, who); auto results = database.QueryDatabase(query); LearnMembers(); VerifyRaid(); ServerPacket *pack = new ServerPacket(ServerOP_RaidGroupLeader, sizeof(ServerRaidGeneralAction_Struct)); ServerRaidGeneralAction_Struct *rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer; rga->rid = GetID(); strn0cpy(rga->playername, who, 64); rga->zoneid = zone->GetZoneID(); rga->instance_id = zone->GetInstanceID(); worldserver.SendPacket(pack); safe_delete(pack); }
void Raid::AddMember(Client *c, uint32 group, bool rleader, bool groupleader, bool looter){ if(!c) return; std::string query = StringFormat("INSERT INTO raid_members SET raidid = %lu, charid = %lu, " "groupid = %lu, _class = %d, level = %d, name = '%s', " "isgroupleader = %d, israidleader = %d, islooter = %d", (unsigned long)GetID(), (unsigned long)c->CharacterID(), (unsigned long)group, c->GetClass(), c->GetLevel(), c->GetName(), groupleader, rleader, looter); auto results = database.QueryDatabase(query); if(!results.Success()) { LogFile->write(EQEMuLog::Error, "Error inserting into raid members: %s", results.ErrorMessage().c_str()); } LearnMembers(); VerifyRaid(); if (rleader) { database.SetRaidGroupLeaderInfo(RAID_GROUPLESS, GetID()); UpdateRaidAAs(); } if (group != RAID_GROUPLESS && groupleader) { database.SetRaidGroupLeaderInfo(group, GetID()); UpdateGroupAAs(group); } if(group < 12) GroupUpdate(group); else // get raid AAs, GroupUpdate will handles it otherwise SendGroupLeadershipAA(c, RAID_GROUPLESS); SendRaidAddAll(c->GetName()); c->SetRaidGrouped(true); SendRaidMOTD(c); ServerPacket *pack = new ServerPacket(ServerOP_RaidAdd, sizeof(ServerRaidGeneralAction_Struct)); ServerRaidGeneralAction_Struct *rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer; rga->rid = GetID(); strn0cpy(rga->playername, c->GetName(), 64); rga->zoneid = zone->GetZoneID(); rga->instance_id = zone->GetInstanceID(); worldserver.SendPacket(pack); safe_delete(pack); }
void TitleManager::CreateNewPlayerSuffix(Client *c, const char *Suffix) { if(!c || !Suffix) return; char errbuf[MYSQL_ERRMSG_SIZE]; char *query = NULL; MYSQL_RES *result; char *EscSuffix = new char[strlen(Suffix) * 2 + 1]; c->SetTitleSuffix(Suffix); database.DoEscapeString(EscSuffix, Suffix, strlen(Suffix)); if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT `id` from titles where `suffix` = '%s' and char_id = %i", EscSuffix, c->CharacterID()), errbuf, &result)) { if(mysql_num_rows(result) > 0) { mysql_free_result(result); safe_delete_array(query); safe_delete_array(EscSuffix); return; } mysql_free_result(result); } safe_delete_array(query); if(!database.RunQuery(query,MakeAnyLenString(&query, "INSERT into titles (`char_id`, `suffix`) VALUES(%i, '%s')", c->CharacterID(), EscSuffix), errbuf)) LogFile->write(EQEMuLog::Error, "Error adding title suffix: %s %s", query, errbuf); else { ServerPacket* pack = new ServerPacket(ServerOP_ReloadTitles, 0); worldserver.SendPacket(pack); safe_delete(pack); } safe_delete_array(query); safe_delete_array(EscSuffix); }
void Raid::RemoveRaidLooter(const char* looter) { std::string query = StringFormat("UPDATE raid_members SET islooter = 0 WHERE name = '%s'", looter); auto results = database.QueryDatabase(query); for(int x = 0; x < MAX_RAID_MEMBERS; x++) if(strcmp(looter, members[x].membername) == 0) { members[x].IsLooter = 0; break; } ServerPacket *pack = new ServerPacket(ServerOP_DetailsChange, sizeof(ServerRaidGeneralAction_Struct)); ServerRaidGeneralAction_Struct *rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer; rga->rid = GetID(); rga->zoneid = zone->GetZoneID(); rga->instance_id = zone->GetInstanceID(); worldserver.SendPacket(pack); safe_delete(pack); }
void Raid::MoveMember(const char *name, uint32 newGroup) { std::string query = StringFormat("UPDATE raid_members SET groupid = %lu WHERE name = '%s'", (unsigned long)newGroup, name); auto results = database.QueryDatabase(query); LearnMembers(); VerifyRaid(); SendRaidMoveAll(name); ServerPacket *pack = new ServerPacket(ServerOP_RaidChangeGroup, sizeof(ServerRaidGeneralAction_Struct)); ServerRaidGeneralAction_Struct *rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer; rga->rid = GetID(); strn0cpy(rga->playername, name, 64); rga->zoneid = zone->GetZoneID(); rga->instance_id = zone->GetInstanceID(); worldserver.SendPacket(pack); safe_delete(pack); }