本文整理汇总了C++中Battleground::PSendMessageToAll方法的典型用法代码示例。如果您正苦于以下问题:C++ Battleground::PSendMessageToAll方法的具体用法?C++ Battleground::PSendMessageToAll怎么用?C++ Battleground::PSendMessageToAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Battleground
的用法示例。
在下文中一共展示了Battleground::PSendMessageToAll方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Reward
void Reward(Player* player, uint8 killed, uint8 killedType)
{
if (!MultiKillEnable)
return;
for (uint16 i = 0; i < MultiKillInfo.size(); ++i)
{
if (MultiKillInfo[i].Count == killed && MultiKillInfo[i].Type == killedType)
{
Battleground* bg = NULL;
if (player->InBattleground())
bg = player->GetBattleground();
if (MultiKillInfo[i].BuffFirst != 0)
player->CastSpell(player, MultiKillInfo[i].BuffFirst, true);
if (MultiKillInfo[i].BuffSecond != 0)
player->CastSpell(player, MultiKillInfo[i].BuffSecond, true);
if (MultiKillInfo[i].Gold != 0)
player->ModifyMoney(MultiKillInfo[i].Gold * GOLD);
if (MultiKillInfo[i].Sound != 0)
{
if (bg)
bg->PlaySoundToAll(MultiKillInfo[i].Sound);
else
{
WorldPacket data(SMSG_PLAY_SOUND, 4);
data << uint32(MultiKillInfo[i].Sound) << player->GetGUIDLow();
sWorld->SendGlobalMessage(&data);
}
}
// Reward Honor
if (MultiKillInfo[i].Honor != 0)
player->RewardHonor(NULL, 1, MultiKillInfo[i].Honor);
// TrinityStringId
if (MultiKillInfo[i].Text != 0)
{
if (bg)
bg->PSendMessageToAll(MultiKillInfo[i].Text, CHAT_MSG_SYSTEM, NULL, player->GetName().c_str());
else
sWorld->SendWorldText(MultiKillInfo[i].Text, player->GetName().c_str());
}
// KillCredit for quests/achi.
if (MultiKillInfo[i].KillCredit != 0)
player->KilledMonsterCredit(MultiKillInfo[i].KillCredit, 0);
if (!MultiKillLog)
return;
CharacterDatabase.PExecute(
"INSERT INTO `character_multikill` (`guid`, `count`, `type`, `time`) VALUES ('%u', '%u', '%u', CURRENT_TIMESTAMP())",
player->GetGUIDLow(), killed, killedType
);
return;
}
}
}