当前位置: 首页>>代码示例>>C++>>正文


C++ Battleground::PlaySoundToAll方法代码示例

本文整理汇总了C++中Battleground::PlaySoundToAll方法的典型用法代码示例。如果您正苦于以下问题:C++ Battleground::PlaySoundToAll方法的具体用法?C++ Battleground::PlaySoundToAll怎么用?C++ Battleground::PlaySoundToAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Battleground的用法示例。


在下文中一共展示了Battleground::PlaySoundToAll方法的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;
            }
        }
    }
开发者ID:Adeer,项目名称:Patchs,代码行数:64,代码来源:mod_MultiKill.cpp


注:本文中的Battleground::PlaySoundToAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。