本文整理汇总了C++中Guild::GetLeaderGUID方法的典型用法代码示例。如果您正苦于以下问题:C++ Guild::GetLeaderGUID方法的具体用法?C++ Guild::GetLeaderGUID怎么用?C++ Guild::GetLeaderGUID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Guild
的用法示例。
在下文中一共展示了Guild::GetLeaderGUID方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SendApplicantListUpdate
void GuildFinderMgr::SendApplicantListUpdate(Guild& guild)
{
WorldPacket data(SMSG_LF_GUILD_APPLICANT_LIST_UPDATED, 0);
if (Player* player = ObjectAccessor::FindPlayer(guild.GetLeaderGUID()))
player->SendDirectMessage(&data);
guild.BroadcastPacketToRank(&data, GR_OFFICER);
}
示例2: SendKillAdvertisement
bool GuildTaskMgr::SendKillAdvertisement(uint32 creatureId, uint32 owner, uint32 guildId, uint32 validIn)
{
Guild *guild = sGuildMgr->GetGuildById(guildId);
Player* player = sObjectMgr->GetPlayerByLowGUID(owner);
Player* leader = sObjectMgr->GetPlayerByLowGUID(guild->GetLeaderGUID());
CreatureTemplate const* proto = sObjectMgr->GetCreatureTemplate(creatureId);
if (!proto)
return false;
SQLTransaction trans = CharacterDatabase.BeginTransaction();
ostringstream body;
body << "Hello, " << player->GetName() << ",\n";
body << "\n";
body << "As you probably know " << proto->Name << " is wanted dead for the crimes it did against our guild. If you should kill it ";
body << "we'd really appreciate that.\n";
body << "The task will expire in " << formatTime(validIn) << "\n";
body << "\n";
body << "Best Regards,\n";
body << guild->GetName() << "\n";
body << leader->GetName() << "\n";
ostringstream subject;
subject << "Guild Task: " << proto->Name;
MailDraft(subject.str(), body.str()).SendMailTo(trans, MailReceiver(player), MailSender(leader));
CharacterDatabase.CommitTransaction(trans);
return true;
}
示例3: HandleGuildSwitchRankOpcode
void WorldSession::HandleGuildSwitchRankOpcode(WorldPacket& recvPacket)
{
uint32 rankId;
bool up;
recvPacket >> rankId;
up = recvPacket.ReadBit();
sLog->outDebug(LOG_FILTER_NETWORKIO,"WORLD: Received CMSG_GUILD_SWITCH_RANK rank %u up %u", rankId, up);
Guild* guild = GetPlayer()->GetGuild();
if (!guild)
{
Guild::SendCommandResult(this, GUILD_COMMAND_CREATE, ERR_GUILD_PLAYER_NOT_IN_GUILD);
return;
}
if (GetPlayer()->GetGUID() != guild->GetLeaderGUID())
{
Guild::SendCommandResult(this, GUILD_COMMAND_INVITE, ERR_GUILD_PERMISSIONS);
return;
}
guild->SwitchRank(rankId, up);
guild->HandleRoster();
guild->HandleQuery(GetPlayer()->GetSession());
guild->SendGuildRankInfo(GetPlayer()->GetSession());
}
示例4: SendItemAdvertisement
bool GuildTaskMgr::SendItemAdvertisement(uint32 itemId, uint32 owner, uint32 guildId, uint32 validIn)
{
Guild *guild = sGuildMgr->GetGuildById(guildId);
Player* player = sObjectMgr->GetPlayerByLowGUID(owner);
Player* leader = sObjectMgr->GetPlayerByLowGUID(guild->GetLeaderGUID());
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemId);
if (!proto)
return false;
SQLTransaction trans = CharacterDatabase.BeginTransaction();
ostringstream body;
body << "Hello, " << player->GetName() << ",\n";
body << "\n";
body << "We are in a great need of " << proto->Name1 << ". If you could sell us ";
uint32 count = GetTaskValue(owner, guildId, "itemCount");
if (count > 1)
body << "at least " << count << " of them ";
else
body << "some ";
body << "we'd really appreciate that and pay a high price.\n";
body << "The task will expire in " << formatTime(validIn) << "\n";
body << "\n";
body << "Best Regards,\n";
body << guild->GetName() << "\n";
body << leader->GetName() << "\n";
ostringstream subject;
subject << "Guild Task: " << proto->Name1;
MailDraft(subject.str(), body.str()).SendMailTo(trans, MailReceiver(player), MailSender(leader));
CharacterDatabase.CommitTransaction(trans);
return true;
}
示例5: SendAdvertisement
bool GuildTaskMgr::SendAdvertisement(uint32 owner, uint32 guildId)
{
Guild *guild = sGuildMgr->GetGuildById(guildId);
if (!guild)
return false;
Player* player = sObjectMgr->GetPlayerByLowGUID(owner);
if (!player)
return false;
Player* leader = sObjectMgr->GetPlayerByLowGUID(guild->GetLeaderGUID());
if (!leader)
return false;
uint32 validIn;
uint32 itemTask = GetTaskValue(owner, guildId, "itemTask", &validIn);
if (itemTask)
return SendItemAdvertisement(itemTask, owner, guildId, validIn);
uint32 killTask = GetTaskValue(owner, guildId, "killTask", &validIn);
if (killTask)
return SendKillAdvertisement(killTask, owner, guildId, validIn);
return false;
}
示例6: HandleGuildInfoCommand
static bool HandleGuildInfoCommand(ChatHandler* handler, char const* args)
{
Player* target;
uint32 guildId;
std::string guildName;
std::string guildMasterName;
Guild* guild;
if (!*args)
{
if (target = handler->getSelectedPlayer())
guild = target->GetGuild();
else
return false;
}
else if (guildId = atoi(args))
guild = sGuildMgr->GetGuildById(guildId);
else
{
char* tailStr = *args != '"' ? strtok(NULL, "") : (char*)args;
if (!tailStr)
return false;
char* guildStr = handler->extractQuotedArg((char*)args);
if (!guildStr)
return false;
guildName = guildStr;
guild = sGuildMgr->GetGuildByName(guildName);
}
if (!guild)
return false;
handler->PSendSysMessage(LANG_GUILD_INFO_NAME, guild->GetName().c_str(), guild->GetId());
if (sObjectMgr->GetPlayerNameByGUID(guild->GetLeaderGUID(), guildMasterName))
handler->PSendSysMessage(LANG_GUILD_INFO_GUILD_MASTER, guildMasterName.c_str(), guild->GetLeaderGUID());
char createdDateStr[20];
time_t createdDate = guild->GetCreatedDate();
strftime(createdDateStr, 20, "%Y-%m-%d %H:%M:%S", localtime(&createdDate));
handler->PSendSysMessage(LANG_GUILD_INFO_CREATION_DATE, createdDateStr);
handler->PSendSysMessage(LANG_GUILD_INFO_MEMBER_COUNT, guild->GetMemberCount());
handler->PSendSysMessage(LANG_GUILD_INFO_BANK_GOLD, guild->GetBankMoney() / 100 / 100);
handler->PSendSysMessage(LANG_GUILD_INFO_MOTD, guild->GetMOTD().c_str());
handler->PSendSysMessage(LANG_GUILD_INFO_EXTRA_INFO, guild->GetInfo().c_str());
return true;
}
示例7: SendThanks
bool GuildTaskMgr::SendThanks(uint32 owner, uint32 guildId)
{
Guild *guild = sGuildMgr->GetGuildById(guildId);
if (!guild)
return false;
Player* player = sObjectMgr->GetPlayerByLowGUID(owner);
if (!player)
return false;
Player* leader = sObjectMgr->GetPlayerByLowGUID(guild->GetLeaderGUID());
if (!leader)
return false;
uint32 itemTask = GetTaskValue(owner, guildId, "itemTask");
if (itemTask)
{
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemTask);
if (!proto)
return false;
SQLTransaction trans = CharacterDatabase.BeginTransaction();
ostringstream body;
body << "Hello, " << player->GetName() << ",\n";
body << "\n";
body << "One of our guild members wishes to thank you for the " << proto->Name1 << "! If we have another ";
uint32 count = GetTaskValue(owner, guildId, "itemCount");
body << count << " of them that would help us tremendously.\n";
body << "\n";
body << "Thanks again,\n";
body << guild->GetName() << "\n";
body << leader->GetName() << "\n";
MailDraft("Thank You", body.str()).
AddMoney(GetTaskValue(owner, guildId, "payment")).
SendMailTo(trans, MailReceiver(player), MailSender(leader));
CharacterDatabase.CommitTransaction(trans);
return true;
}
return false;
}
示例8: HandleGuildInfoCommand
static bool HandleGuildInfoCommand(ChatHandler* handler, char const* args)
{
Guild* guild = nullptr;
if (args && args[0] != '\0')
{
if (isNumeric(args))
{
uint32 guildId = uint32(atoi(args));
guild = sGuildMgr->GetGuildById(guildId);
}
else
{
std::string guildName = args;
guild = sGuildMgr->GetGuildByName(guildName);
}
}
else if (Player* target = handler->getSelectedPlayerOrSelf())
guild = target->GetGuild();
if (!guild)
return false;
// Display Guild Information
handler->PSendSysMessage(LANG_GUILD_INFO_NAME, guild->GetName().c_str(), guild->GetId()); // Guild Id + Name
std::string guildMasterName;
if (sCharacterCache->GetCharacterNameByGuid(guild->GetLeaderGUID(), guildMasterName))
handler->PSendSysMessage(LANG_GUILD_INFO_GUILD_MASTER, guildMasterName.c_str(), guild->GetLeaderGUID().GetCounter()); // Guild Master
// Format creation date
char createdDateStr[20];
time_t createdDate = guild->GetCreatedDate();
tm localTm;
strftime(createdDateStr, 20, "%Y-%m-%d %H:%M:%S", localtime_r(&createdDate, &localTm));
handler->PSendSysMessage(LANG_GUILD_INFO_CREATION_DATE, createdDateStr); // Creation Date
handler->PSendSysMessage(LANG_GUILD_INFO_MEMBER_COUNT, guild->GetMemberCount()); // Number of Members
handler->PSendSysMessage(LANG_GUILD_INFO_BANK_GOLD, guild->GetBankMoney() / 100 / 100); // Bank Gold (in gold coins)
handler->PSendSysMessage(LANG_GUILD_INFO_MOTD, guild->GetMOTD().c_str()); // Message of the Day
handler->PSendSysMessage(LANG_GUILD_INFO_EXTRA_INFO, guild->GetInfo().c_str()); // Extra Information
return true;
}
示例9: HandleGuildMasterReplaceOpcode
void WorldSession::HandleGuildMasterReplaceOpcode(WorldPacket& recvPacket)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_REPLACE_GUILD_MASTER");
Guild* guild = _GetPlayerGuild(this, true);
if (!guild)
return; // Cheat
uint32 logoutTime = guild->GetMemberLogoutTime(guild->GetLeaderGUID());
if (!logoutTime)
return;
time_t now = time(NULL);
if (time_t(logoutTime + 3 * MONTH) > now)
return; // Cheat
guild->SwitchGuildLeader(GetPlayer()->GetGUID());
}
示例10: Reward
bool GuildTaskMgr::Reward(uint32 owner, uint32 guildId)
{
Guild *guild = sGuildMgr->GetGuildById(guildId);
if (!guild)
return false;
Player* player = sObjectMgr->GetPlayerByLowGUID(owner);
if (!player)
return false;
Player* leader = sObjectMgr->GetPlayerByLowGUID(guild->GetLeaderGUID());
if (!leader)
return false;
uint32 itemTask = GetTaskValue(owner, guildId, "itemTask");
uint32 killTask = GetTaskValue(owner, guildId, "killTask");
if (!itemTask && !killTask)
return false;
ostringstream body;
body << "Hello, " << player->GetName() << ",\n";
body << "\n";
if (itemTask)
{
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemTask);
if (!proto)
return false;
body << "We wish to thank you for the " << proto->Name1 << " you provided so kindly. We really appreciate this and may this small gift bring you our thanks!\n";
body << "\n";
body << "Many thanks,\n";
body << guild->GetName() << "\n";
body << leader->GetName() << "\n";
}
else if (killTask)
{
CreatureTemplate const* proto = sObjectMgr->GetCreatureTemplate(killTask);
if (!proto)
return false;
body << "We wish to thank you for the " << proto->Name << " you've killed recently. We really appreciate this and may this small gift bring you our thanks!\n";
body << "\n";
body << "Many thanks,\n";
body << guild->GetName() << "\n";
body << leader->GetName() << "\n";
}
SQLTransaction trans = CharacterDatabase.BeginTransaction();
MailDraft draft("Thank You", body.str());
uint32 itemId = sRandomItemMgr.GetRandomItem(RANDOM_ITEM_GUILD_TASK_REWARD);
if (itemId)
{
Item* item = Item::CreateItem(itemId, 1, leader);
item->SaveToDB(trans);
draft.AddItem(item);
}
draft.AddMoney(GetTaskValue(owner, guildId, "payment")).SendMailTo(trans, MailReceiver(player), MailSender(leader));
CharacterDatabase.CommitTransaction(trans);
SetTaskValue(owner, guildId, "activeTask", 0, 0);
return true;
}