本文整理汇总了C++中DelMember函数的典型用法代码示例。如果您正苦于以下问题:C++ DelMember函数的具体用法?C++ DelMember怎么用?C++ DelMember使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DelMember函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ObjectGuid
bool ArenaTeam::LoadMembersFromDB(QueryResult result)
{
if (!result)
return false;
bool captainPresentInTeam = false;
do
{
Field* fields = result->Fetch();
// Prevent crash if db records are broken when all members in result are already processed and current team doesn't have any members
if (!fields)
break;
uint32 arenaTeamId = fields[0].GetUInt32();
// We loaded all members for this arena_team already, break cycle
if (arenaTeamId > TeamId)
break;
ArenaTeamMember newMember;
newMember.Guid = ObjectGuid(HighGuid::Player, fields[1].GetUInt32());
newMember.WeekGames = fields[2].GetUInt16();
newMember.WeekWins = fields[3].GetUInt16();
newMember.SeasonGames = fields[4].GetUInt16();
newMember.SeasonWins = fields[5].GetUInt16();
newMember.Name = fields[6].GetString();
newMember.Class = fields[7].GetUInt8();
newMember.PersonalRating = fields[8].GetUInt16();
newMember.MatchMakerRating = fields[9].GetUInt16() > 0 ? fields[9].GetUInt16() : sWorld->getIntConfig(CONFIG_ARENA_START_MATCHMAKER_RATING);
// Delete member if character information is missing
if (newMember.Name.empty())
{
TC_LOG_ERROR("sql.sql", "ArenaTeam %u has member with empty name - probably %s doesn't exist, deleting him from memberlist!", arenaTeamId, newMember.Guid.ToString().c_str());
DelMember(newMember.Guid, true);
continue;
}
// Check if team team has a valid captain
if (newMember.Guid == GetCaptain())
captainPresentInTeam = true;
// Put the player in the team
Members.push_back(newMember);
sCharacterCache->UpdateCharacterArenaTeamId(newMember.Guid, GetSlot(), GetId());
}
while (result->NextRow());
if (Empty() || !captainPresentInTeam)
{
// Arena team is empty or captain is not in team, delete from db
TC_LOG_DEBUG("bg.arena", "ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", TeamId);
return false;
}
return true;
}
示例2: MAKE_NEW_GUID
bool ArenaTeam::LoadMembersFromDB(QueryResult result)
{
if (!result)
return false;
bool captainPresentInTeam = false;
do
{
Field* fields = result->Fetch();
// Prevent crash if db records are broken when all members in result are already processed and current team doesn't have any members
if (!fields)
break;
uint32 arenaTeamId = fields[0].GetUInt32();
// We loaded all members for this arena_team already, break cycle
if (arenaTeamId > TeamId)
break;
ArenaTeamMember newMember;
newMember.Guid = MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_PLAYER);
newMember.WeekGames = fields[2].GetUInt16();
newMember.WeekWins = fields[3].GetUInt16();
newMember.SeasonGames = fields[4].GetUInt16();
newMember.SeasonWins = fields[5].GetUInt16();
newMember.Name = fields[6].GetString();
newMember.Class = fields[7].GetUInt8();
newMember.PersonalRating = fields[8].GetUInt16();
newMember.MatchMakerRating = fields[9].GetUInt16() > 0 ? fields[9].GetUInt16() : 1500;
// Delete member if character information is missing
if (newMember.Name.empty())
{
sLog->outError(LOG_FILTER_SQL, "ArenaTeam %u has member with empty name - probably player %u doesn't exist, deleting him from memberlist!", arenaTeamId, GUID_LOPART(newMember.Guid));
DelMember(newMember.Guid, true);
continue;
}
// Check if team team has a valid captain
if (newMember.Guid == GetCaptain())
captainPresentInTeam = true;
// Put the player in the team
Members.push_back(newMember);
}
while (result->NextRow());
if (Empty() || !captainPresentInTeam)
{
// Arena team is empty or captain is not in team, delete from db
sLog->outDebug(LOG_FILTER_ARENAS, "ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", TeamId);
return false;
}
return true;
}
示例3: ObjectGuid
bool ArenaTeam::LoadMembersFromDB(QueryResult *arenaTeamMembersResult)
{
if(!arenaTeamMembersResult)
return false;
bool captainPresentInTeam = false;
do
{
Field *fields = arenaTeamMembersResult->Fetch();
//prevent crash if db records are broken, when all members in result are already processed and current team hasn't got any members
if (!fields)
break;
uint32 arenaTeamId = fields[0].GetUInt32();
if (arenaTeamId < m_TeamId)
{
//there is in table arena_team_member record which doesn't have arenateamid in arena_team table, report error
sLog.outErrorDb("ArenaTeam %u does not exist but it has record in arena_team_member table, deleting it!", arenaTeamId);
CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid = '%u'", arenaTeamId);
continue;
}
if (arenaTeamId > m_TeamId)
//we loaded all members for this arena_team already, break cycle
break;
ArenaTeamMember newmember;
newmember.guid = ObjectGuid(HIGHGUID_PLAYER, fields[1].GetUInt32());
newmember.games_week = fields[2].GetUInt32();
newmember.wins_week = fields[3].GetUInt32();
newmember.games_season = fields[4].GetUInt32();
newmember.wins_season = fields[5].GetUInt32();
newmember.personal_rating = fields[6].GetUInt32();
newmember.name = fields[7].GetCppString();
newmember.Class = fields[8].GetUInt8();
//check if member exists in characters table
if (newmember.name.empty())
{
sLog.outErrorDb("ArenaTeam %u has member with empty name - probably player %s doesn't exist, deleting him from memberlist!", arenaTeamId, newmember.guid.GetString().c_str());
DelMember(newmember.guid);
continue;
}
if (newmember.guid == GetCaptainGuid())
captainPresentInTeam = true;
m_members.push_back(newmember);
} while (arenaTeamMembersResult->NextRow());
if (Empty() || !captainPresentInTeam)
{
// arena team is empty or captain is not in team, delete from db
sLog.outErrorDb("ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", m_TeamId);
return false;
}
return true;
}
示例4: BroadcastEvent
void Guild::Disband()
{
BroadcastEvent(GE_DISBANDED);
while (!members.empty())
{
MemberList::const_iterator itr = members.begin();
DelMember(ObjectGuid(HIGHGUID_PLAYER, itr->first), true);
}
CharacterDatabase.BeginTransaction();
CharacterDatabase.PExecute("DELETE FROM guild WHERE guildid = '%u'", m_Id);
CharacterDatabase.PExecute("DELETE FROM guild_rank WHERE guildid = '%u'", m_Id);
CharacterDatabase.PExecute("DELETE FROM guild_eventlog WHERE guildid = '%u'", m_Id);
CharacterDatabase.CommitTransaction();
sObjectMgr.RemoveGuild(m_Id);
}
示例5: BroadcastEvent
void Guild::Disband()
{
BroadcastEvent(GE_DISBANDED, 0, 0, "", "", "");
while (!members.empty())
{
MemberList::const_iterator itr = members.begin();
DelMember(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER), true);
}
CharacterDatabase.BeginTransaction();
CharacterDatabase.PExecute("DELETE FROM guild WHERE guildid = '%u'", m_Id);
CharacterDatabase.PExecute("DELETE FROM guild_rank WHERE guildid = '%u'", m_Id);
// TODO item_instance should be deleted ?
CharacterDatabase.PExecute("DELETE FROM guild_eventlog WHERE guildid = '%u'", m_Id);
CharacterDatabase.CommitTransaction();
sObjectMgr.RemoveGuild(m_Id);
}
示例6: GetName
void ArenaTeam::Disband(WorldSession *session)
{
// event
WorldPacket data;
session->BuildArenaTeamEventPacket(&data, ERR_ARENA_TEAM_DISBANDED_S, 2, session->GetPlayerName(), GetName(), "");
BroadcastPacket(&data);
while (!members.empty())
{
// Removing from members is done in DelMember.
DelMember(members.front().guid);
}
CharacterDatabase.BeginTransaction();
CharacterDatabase.PExecute("DELETE FROM arena_team WHERE arenateamid = '%u'", Id);
CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid = '%u'", Id); //< this should be alredy done by calling DelMember(memberGuids[j]); for each member
CharacterDatabase.PExecute("DELETE FROM arena_team_stats WHERE arenateamid = '%u'", Id);
CharacterDatabase.CommitTransaction();
objmgr.RemoveArenaTeam(Id);
}
示例7: BroadcastEvent
void ArenaTeam::Disband(WorldSession *session)
{
// event
if (session)
BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, session->GetPlayerName(), GetName().c_str());
while (!m_members.empty())
// Removing from members is done in DelMember.
DelMember(m_members.front().guid);
if (session)
if (Player* player = session->GetPlayer())
sLog->outArena("Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId());
CharacterDatabase.BeginTransaction();
CharacterDatabase.PExecute("DELETE FROM arena_team WHERE arenateamid = '%u'", m_TeamId);
CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid = '%u'", m_TeamId); // this should be alredy done by calling DelMember(memberGuids[j]); for each member
CharacterDatabase.PExecute("DELETE FROM arena_team_stats WHERE arenateamid = '%u'", m_TeamId);
CharacterDatabase.CommitTransaction();
sObjectMgr->RemoveArenaTeam(m_TeamId);
}
示例8: GetRank
bool Guild::CheckGuildStructure()
{
// Repair the structure of guild
// If the guildmaster doesn't exist or isn't the member of guild
// attempt to promote another member
int32 GM_rights = GetRank(m_LeaderGuid);
if (GM_rights == -1)
{
if (DelMember(m_LeaderGuid))
return false; // guild will disbanded and deleted in caller
}
else if (GM_rights != GR_GUILDMASTER)
SetLeader(m_LeaderGuid);
// Allow only 1 guildmaster, set other to officer
for (MemberList::iterator itr = members.begin(); itr != members.end(); ++itr)
if (itr->second.RankId == GR_GUILDMASTER && m_LeaderGuid != itr->second.guid)
itr->second.ChangeRank(GR_OFFICER);
return true;
}
示例9: while
void ArenaTeam::Disband()
{
// Remove all members from arena team
while (!Members.empty())
DelMember(Members.front().Guid, false);
// Update database
SQLTransaction trans = CharacterDatabase.BeginTransaction();
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ARENA_TEAM);
stmt->setUInt32(0, TeamId);
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ARENA_TEAM_MEMBERS);
stmt->setUInt32(0, TeamId);
trans->Append(stmt);
CharacterDatabase.CommitTransaction(trans);
// Remove arena team from ArenaTeamMgr
sArenaTeamMgr->RemoveArenaTeam(TeamId);
}
示例10: BroadcastEvent
void ArenaTeam::Disband(WorldSession *session)
{
// event
if (session)
{
// probably only 1 string required...
BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, session->GetPlayerName(), GetName().c_str());
}
while (!m_members.empty())
{
// Removing from members is done in DelMember.
DelMember(m_members.front().guid);
}
CharacterDatabase.BeginTransaction();
CharacterDatabase.PExecute("DELETE FROM arena_team WHERE arenateamid = '%u'", m_TeamId);
CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid = '%u'", m_TeamId); //< this should be already done by calling DelMember(memberGuids[j]); for each member
CharacterDatabase.PExecute("DELETE FROM arena_team_stats WHERE arenateamid = '%u'", m_TeamId);
CharacterDatabase.CommitTransaction();
sObjectMgr.RemoveArenaTeam(m_TeamId);
}
示例11: ObjectGuid
bool ArenaTeam::LoadMembersFromDB(QueryResult *arenaTeamMembersResult)
{
if(!arenaTeamMembersResult)
return false;
bool captainPresentInTeam = false;
do
{
Field *fields = arenaTeamMembersResult->Fetch();
//prevent crash if db records are broken, when all members in result are already processed and current team hasn't got any members
if (!fields)
break;
uint32 arenaTeamId = fields[0].GetUInt32();
if (arenaTeamId < m_TeamId)
{
//there is in table arena_team_member record which doesn't have arenateamid in arena_team table, report error
sLog.outErrorDb("ArenaTeam %u does not exist but it has record in arena_team_member table, deleting it!", arenaTeamId);
CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid = '%u'", arenaTeamId);
continue;
}
if (arenaTeamId > m_TeamId)
//we loaded all members for this arena_team already, break cycle
break;
ArenaTeamMember newmember;
newmember.guid = ObjectGuid(HIGHGUID_PLAYER, fields[1].GetUInt32());
newmember.games_week = fields[2].GetUInt32();
newmember.wins_week = fields[3].GetUInt32();
newmember.games_season = fields[4].GetUInt32();
newmember.wins_season = fields[5].GetUInt32();
newmember.personal_rating = fields[6].GetUInt32();
newmember.name = fields[7].GetCppString();
newmember.Class = fields[8].GetUInt8();
if (GetType() == ARENA_TYPE_2v2)
{
QueryResult *result = CharacterDatabase.PQuery("SELECT rating2 FROM hidden_rating WHERE guid='%u'", fields[1].GetUInt32());
if (!result)
{
CharacterDatabase.PExecute("INSERT INTO hidden_rating (guid, rating2, rating3, rating5) VALUES""('%u', '%u', '%u', '%u')", fields[1].GetUInt32(), 1500, 1500, 1500);
newmember.matchmaker_rating = 1500;
}
else
{
newmember.matchmaker_rating = (*result)[0].GetUInt32();
delete result;
}
}
if (GetType() == ARENA_TYPE_3v3)
{
QueryResult *result = CharacterDatabase.PQuery("SELECT rating3 FROM hidden_rating WHERE guid='%u'", fields[1].GetUInt32());
if (!result)
{
CharacterDatabase.PExecute("INSERT INTO hidden_rating (guid, rating2, rating3, rating5) VALUES""('%u', '%u', '%u', '%u')", fields[1].GetUInt32(), 1500, 1500, 1500);
newmember.matchmaker_rating = 1500;
}
else
{
newmember.matchmaker_rating = (*result)[0].GetUInt32();
delete result;
}
}
if (GetType() == ARENA_TYPE_5v5)
{
QueryResult *result = CharacterDatabase.PQuery("SELECT rating5 FROM hidden_rating WHERE guid='%u'", fields[1].GetUInt32());
if (!result)
{
CharacterDatabase.PExecute("INSERT INTO hidden_rating (guid, rating2, rating3, rating5) VALUES""('%u', '%u', '%u', '%u')", fields[1].GetUInt32(), 1500, 1500, 1500);
newmember.matchmaker_rating = 1500;
}
else
{
newmember.matchmaker_rating = (*result)[0].GetUInt32();
delete result;
}
}
//check if member exists in characters table
if (newmember.name.empty())
{
CharacterDatabase.PExecute("DELETE FROM hidden_rating where guid = '%u'", fields[1].GetUInt32());
sLog.outErrorDb("ArenaTeam %u has member with empty name - probably player %s doesn't exist, deleting him from memberlist!", arenaTeamId, newmember.guid.GetString().c_str());
DelMember(newmember.guid);
continue;
}
// arena team can't be > 2 * arenatype (2 for 2x2, 3 for 3x3, 5 for 5x5)
if (GetMembersSize() >= GetMaxMembersSize())
return false;
if (newmember.guid == GetCaptainGuid())
captainPresentInTeam = true;
m_members.push_back(newmember);
} while (arenaTeamMembersResult->NextRow());
//.........这里部分代码省略.........
示例12: MAKE_NEW_GUID
bool Guild::LoadGuildFromDB(uint32 GuildId)
{
//set m_Id in case guild data are broken in DB and Guild will be Disbanded (deleted from DB)
m_Id = GuildId;
if (!LoadRanksFromDB(GuildId))
return false;
if (!LoadMembersFromDB(GuildId))
return false;
// 0 1 2 3 4 5
QueryResult *result = CharacterDatabase.PQuery("SELECT name, leaderguid, EmblemStyle, EmblemColor, BorderStyle, BorderColor,"
// 6 7 8 9
"BackgroundColor, info, motd, createdate FROM guild WHERE guildid = '%u'", GuildId);
if (!result)
return false;
Field *fields = result->Fetch();
m_Name = fields[0].GetCppString();
m_LeaderGuid = MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_PLAYER);
m_EmblemStyle = fields[2].GetUInt32();
m_EmblemColor = fields[3].GetUInt32();
m_BorderStyle = fields[4].GetUInt32();
m_BorderColor = fields[5].GetUInt32();
m_BackgroundColor = fields[6].GetUInt32();
GINFO = fields[7].GetCppString();
MOTD = fields[8].GetCppString();
time_t time = fields[9].GetUInt64();
delete result;
if (time > 0)
{
tm local = *(localtime(&time)); // dereference and assign
m_CreatedDay = local.tm_mday;
m_CreatedMonth = local.tm_mon + 1;
m_CreatedYear = local.tm_year + 1900;
}
// Repair the structure of guild
// If the guildmaster doesn't exist or isn't the member of guild
// attempt to promote another member
int32 GM_rights = GetRank(GUID_LOPART(m_LeaderGuid));
if (GM_rights == -1)
{
DelMember(m_LeaderGuid);
// check no members case (disbanded)
if (members.empty())
return false;
}
else if (GM_rights != GR_GUILDMASTER)
SetLeader(m_LeaderGuid);
// Allow only 1 guildmaster
for (MemberList::const_iterator itr = members.begin(); itr != members.end(); ++itr)
{
if (itr->second.RankId == GR_GUILDMASTER && GUID_LOPART(m_LeaderGuid) != itr->first)
//set right of member to officer
ChangeRank(itr->first, GR_OFFICER);
}
sLog.outDebug("Guild %u Creation time Loaded day: %u, month: %u, year: %u", GuildId, m_CreatedDay, m_CreatedMonth, m_CreatedYear);
return true;
}