本文整理汇总了C++中GetCaptain函数的典型用法代码示例。如果您正苦于以下问题:C++ GetCaptain函数的具体用法?C++ GetCaptain怎么用?C++ GetCaptain使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetCaptain函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetCaptain
void ArenaTeam::SetCaptain(uint64 guid)
{
// Disable remove/promote buttons
Player* oldCaptain = ObjectAccessor::FindPlayer(GetCaptain());
if (oldCaptain)
oldCaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1);
// Set new captain
CaptainGuid = guid;
// Update database
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ARENA_TEAM_CAPTAIN);
stmt->setUInt32(0, GUID_LOPART(guid));
stmt->setUInt32(1, GetId());
CharacterDatabase.Execute(stmt);
// Enable remove/promote buttons
if (Player* newCaptain = ObjectAccessor::FindPlayer(guid))
{
newCaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 0);
if (oldCaptain)
{
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u] [Type: %u].",
oldCaptain->GetName().c_str(), oldCaptain->GetGUIDLow(), newCaptain->GetName().c_str(),
newCaptain->GetGUIDLow(), GetId(), GetType());
}
}
}
示例2: data
void ArenaTeam::Roster(WorldSession *session)
{
Player *pl = NULL;
WorldPacket data(SMSG_ARENA_TEAM_ROSTER, 100);
data << uint32(GetId()); // arena team id
data << uint32(GetMembersSize()); // members count
data << uint32(GetType()); // arena team type?
for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
{
pl = sObjectMgr->GetPlayer(itr->guid);
data << uint64(itr->guid); // guid
data << uint8((pl ? 1 : 0)); // online flag
data << itr->name; // member name
data << uint32((itr->guid == GetCaptain() ? 0 : 1));// captain flag 0 captain 1 member
data << uint8((pl ? pl->getLevel() : 0)); // unknown, level?
data << uint8(itr->Class); // class
data << uint32(itr->games_week); // played this week
data << uint32(itr->wins_week); // wins this week
data << uint32(itr->games_season); // played this season
data << uint32(itr->wins_season); // wins this season
data << uint32(itr->personal_rating); // personal rating
}
session->SendPacket(&data);
sLog->outDebug("WORLD: Sent SMSG_ARENA_TEAM_ROSTER");
}
示例3: 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() : sWorld->getIntConfig(CONFIG_ARENA_START_MATCHMAKER_RATING);;
newMember.MaxMMR = std::max(fields[10].GetUInt16(), newMember.MatchMakerRating);
// Delete member if character information is missing
if (fields[6].GetString().empty())
{
sLog->outErrorDb("ArenaTeam %u has member with empty name - probably player %u doesn't exist, deleting him from memberlist!", arenaTeamId, GUID_LOPART(newMember.Guid));
this->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);
sWorld->UpdateGlobalPlayerArenaTeam(GUID_LOPART(newMember.Guid), GetSlot(), GetId());
}
while (result->NextRow());
if (Empty() || !captainPresentInTeam)
{
// Arena team is empty or captain is not in team, delete from db
;//sLog->outDebug(LOG_FILTER_BATTLEGROUND, "ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", TeamId);
return false;
}
return true;
}
示例4: MAKE_NEW_GUID
bool ArenaTeam::LoadMembersFromDB(QueryResult_AutoPtr 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 = MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_PLAYER);
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 %u doesn't exist, deleting him from memberlist!", arenaTeamId, GUID_LOPART(newmember.guid));
this->DelMember(newmember.guid);
continue;
}
if (newmember.guid == GetCaptain())
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;
}
示例5: SetCaptain
void ArenaTeam::SetCaptain(ObjectGuid guid)
{
// Disable remove/promote buttons
Player* oldCaptain = ObjectAccessor::FindPlayer(GetCaptain());
if (oldCaptain)
oldCaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1);
// Set new captain
CaptainGuid = guid;
// Update database
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ARENA_TEAM_CAPTAIN);
stmt->setUInt32(0, guid.GetCounter());
stmt->setUInt32(1, GetId());
CharacterDatabase.Execute(stmt);
// Enable remove/promote buttons
if (Player* newCaptain = ObjectAccessor::FindPlayer(guid))
{
newCaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 0);
if (oldCaptain)
{
TC_LOG_DEBUG("bg.arena", "Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u, Name: %s] [Type: %u].",
oldCaptain->GetName().c_str(), oldCaptain->GetGUID().GetCounter(), newCaptain->GetName().c_str(),
newCaptain->GetGUID().GetCounter(), GetId(), GetName().c_str(), GetType());
}
}
}
示例6: SetCaptain
void ArenaTeam::SetCaptain(const uint64& guid)
{
// Disable remove/promote buttons
Player* oldCaptain = ObjectAccessor::FindPlayer(GetCaptain());
if (oldCaptain)
oldCaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1);
// Set new captain
CaptainGuid = guid;
// Update database
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHARACTER_UPDATE_ARENA_TEAM_CAPTAIN);
stmt->setUInt32(0, GUID_LOPART(guid));
stmt->setUInt32(1, GetId());
CharacterDatabase.Execute(stmt);
// Enable remove/promote buttons
Player* newCaptain = ObjectAccessor::FindPlayer(guid);
if (newCaptain)
{
newCaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 0);
char const* oldCaptainName = oldCaptain ? oldCaptain->GetName() : "";
uint32 oldCaptainLowGuid = oldCaptain ? oldCaptain->GetGUIDLow() : 0;
sLog->outArena("Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u] [Type: %u].",
oldCaptainName, oldCaptainLowGuid, newCaptain->GetName(), newCaptain->GetGUIDLow(), GetId(), GetType());
}
}
示例7: 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;
}
示例8: 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())
{
TC_LOG_ERROR(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
TC_LOG_DEBUG(LOG_FILTER_ARENAS, "ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", TeamId);
return false;
}
return true;
}
示例9: data
void ArenaTeam::Roster(WorldSession *session)
{
Player *pl = NULL;
WorldPacket data(SMSG_ARENA_TEAM_ROSTER, 100);
data << uint32(GetId()); // arena team id
data << uint32(GetMembersSize()); // members count
data << uint32(GetType()); // arena team type?
for (MemberList::iterator itr = members.begin(); itr != members.end(); ++itr)
{
pl = objmgr.GetPlayer(itr->guid);
if(pl)
{
data << uint64(pl->GetGUID()); // guid
data << uint8(1); // online flag
data << pl->GetName(); // member name
data << uint32(itr->guid == GetCaptain() ? 0 : 1);// unknown
data << uint8(pl->getLevel()); // unknown, probably level
data << uint8(pl->getClass()); // class
data << uint32(itr->games_week); // played this week
data << uint32(itr->wins_week); // wins this week
data << uint32(itr->games_season); // played this season
data << uint32(itr->wins_season); // wins this season
data << uint32(itr->personal_rating); // personal rating
}
else
{
data << uint64(itr->guid); // guid
data << uint8(0); // online flag
data << itr->name; // member name
data << uint32(itr->guid == GetCaptain() ? 0 : 1);// unknown
data << uint8(0); // unknown, level?
data << uint8(itr->Class); // class
data << uint32(itr->games_week); // played this week
data << uint32(itr->wins_week); // wins this week
data << uint32(itr->games_season); // played this season
data << uint32(itr->wins_season); // wins this season
data << uint32(itr->personal_rating); // personal rating
}
}
session->SendPacket(&data);
sLog.outDebug("WORLD: Sent SMSG_ARENA_TEAM_ROSTER");
}
示例10: Execute
private func Execute()
{
// Alle Spieler überprüfen
var iPlrCnt, iPlr = 0;
for (iPlrCnt = GetPlayerCount(); iPlrCnt; iPlr++)
if (GetPlayerName(iPlr))
{
iPlrCnt--;
if (GetPlayerTeam(iPlr) != -1) if (!GetCaptain(iPlr))
EliminatePlayer(iPlr);
}
}
示例11: SetCaptain
void ArenaTeam::SetCaptain(const uint64& guid)
{
// disable remove/promote buttons
Player *oldcaptain = sObjectMgr.GetPlayer(GetCaptain());
if (oldcaptain)
oldcaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1);
// set new captain
m_CaptainGuid = guid;
// update database
CharacterDatabase.PExecute("UPDATE arena_team SET captainguid = '%u' WHERE arenateamid = '%u'", GUID_LOPART(guid), m_TeamId);
// enable remove/promote buttons
Player *newcaptain = sObjectMgr.GetPlayer(guid);
if (newcaptain)
newcaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 0);
}
示例12: SetCaptain
void ArenaTeam::SetCaptain(const uint64& guid)
{
// disable remove/promote buttons
Player *oldcaptain = objmgr.GetPlayer(GetCaptain());
if(oldcaptain)
oldcaptain->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_MEMBER, 1);
// set new captain
m_CaptainGuid = guid;
// update database
CharacterDatabase.PExecute("UPDATE arena_team SET captainguid = '%u' WHERE arenateamid = '%u'", GUID_LOPART(guid), m_TeamId);
// enable remove/promote buttons
Player *newcaptain = objmgr.GetPlayer(guid);
if(newcaptain)
newcaptain->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_MEMBER, 0);
}
示例13: data
void ArenaTeam::Roster(WorldSession* session)
{
Player* player = NULL;
uint8 unk308 = 0;
std::string tempName;
WorldPacket data(SMSG_ARENA_TEAM_ROSTER, 100);
data << uint32(GetId()); // team id
data << uint8(unk308); // 308 unknown value but affect packet structure
data << uint32(GetMembersSize()); // members count
data << uint32(GetType()); // arena team type?
for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr)
{
player = ObjectAccessor::FindPlayerInOrOutOfWorld(itr->Guid);
data << uint64(itr->Guid); // guid
data << uint8((player ? 1 : 0)); // online flag
tempName = "";
sObjectMgr->GetPlayerNameByGUID(itr->Guid, tempName);
data << tempName; // member name
data << uint32((itr->Guid == GetCaptain() ? 0 : 1));// captain flag 0 captain 1 member
data << uint8((player ? player->getLevel() : 0)); // unknown, level?
data << uint8(itr->Class); // class
data << uint32(itr->WeekGames); // played this week
data << uint32(itr->WeekWins); // wins this week
data << uint32(itr->SeasonGames); // played this season
data << uint32(itr->SeasonWins); // wins this season
data << uint32(itr->PersonalRating); // personal rating
if (unk308)
{
data << float(0.0f); // 308 unk
data << float(0.0f); // 308 unk
}
}
session->SendPacket(&data);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_ARENA_TEAM_ROSTER");
#endif
}
示例14: SetCaptain
void ArenaTeam::SetCaptain(const uint64& guid)
{
// disable remove/promote buttons
Player *oldcaptain = sObjectMgr->GetPlayer(GetCaptain());
if (oldcaptain)
oldcaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1);
// set new captain
m_CaptainGuid = guid;
// update database
CharacterDatabase.PExecute("UPDATE arena_team SET captainguid = '%u' WHERE arenateamid = '%u'", GUID_LOPART(guid), GetId());
// enable remove/promote buttons
if (Player *newcaptain = sObjectMgr->GetPlayer(guid))
{
newcaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 0);
sLog->outArena("Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u] [Type: %u].", oldcaptain->GetName(), oldcaptain->GetGUIDLow(), newcaptain->GetName(), newcaptain->GetGUIDLow(), GetId(), GetType());
}
}
示例15: SetCaptain
void ArenaTeam::SetCaptain(const uint64& guid)
{
// disable remove/promote buttons
Player *oldcaptain = objmgr.GetPlayer(GetCaptain());
if (oldcaptain)
oldcaptain->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 1 + (GetSlot() * 6), 1);
// set new captain
m_CaptainGuid = guid;
// update database
CharacterDatabase.PExecute("UPDATE arena_team SET captainguid = '%u' WHERE arenateamid = '%u'", GUID_LOPART(guid), GetId());
// enable remove/promote buttons
Player *newcaptain = objmgr.GetPlayer(guid);
if (newcaptain)
{
newcaptain->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 1 + (GetSlot() * 6), 0);
sLog.outArena("Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u] [Type: %u].", oldcaptain->GetName(), oldcaptain->GetGUIDLow(), newcaptain->GetName(), newcaptain->GetGUID(), GetId(), GetType());
}
}