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


C++ AdventureManager::AddFinishedEvent方法代码示例

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


在下文中一共展示了AdventureManager::AddFinishedEvent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Finished

void Adventure::Finished(AdventureWinStatus ws)
{
    list<string>::iterator iter = players.begin();
    while(iter != players.end())
    {
        ClientListEntry *current = client_list.FindCharacter((*iter).c_str());
        if(current)
        {
            if(current->Online() == CLE_Status_InZone)
            {
                //We can send our packets only.
                ServerPacket *pack = new ServerPacket(ServerOP_AdventureFinish, sizeof(ServerAdventureFinish_Struct));
                ServerAdventureFinish_Struct *af = (ServerAdventureFinish_Struct*)pack->pBuffer;
                strcpy(af->player, (*iter).c_str());
                af->theme = GetTemplate()->theme;
                if(ws == AWS_Win)
                {
                    af->win = true;
                    af->points = GetTemplate()->win_points;
                }
                else if(ws == AWS_SecondPlace)
                {
                    af->win = true;
                    af->points = GetTemplate()->lose_points;
                }
                else
                {
                    af->win = false;
                    af->points = 0;
                }
                pack->Deflate();
                zoneserver_list.SendPacket(current->zone(), current->instance(), pack);
                database.UpdateAdventureStatsEntry(database.GetCharacterID((*iter).c_str()), GetTemplate()->theme, (ws != AWS_Lose) ? true : false);
                delete pack;
            }
            else
            {
                AdventureFinishEvent afe;
                afe.name = (*iter);
                if(ws == AWS_Win)
                {
                    afe.theme = GetTemplate()->theme;
                    afe.points = GetTemplate()->win_points;
                    afe.win = true;
                }
                else if(ws == AWS_SecondPlace)
                {
                    afe.theme = GetTemplate()->theme;
                    afe.points = GetTemplate()->lose_points;
                    afe.win = true;
                }
                else
                {
                    afe.win = false;
                    afe.points = 0;
                }
                adventure_manager.AddFinishedEvent(afe);
                database.UpdateAdventureStatsEntry(database.GetCharacterID((*iter).c_str()), GetTemplate()->theme, (ws != AWS_Lose) ? true : false);
            }
        }
        else
        {
            AdventureFinishEvent afe;
            afe.name = (*iter);
            if(ws == AWS_Win)
            {
                afe.theme = GetTemplate()->theme;
                afe.points = GetTemplate()->win_points;
                afe.win = true;
            }
            else if(ws == AWS_SecondPlace)
            {
                afe.theme = GetTemplate()->theme;
                afe.points = GetTemplate()->lose_points;
                afe.win = true;
            }
            else
            {
                afe.win = false;
                afe.points = 0;
            }
            adventure_manager.AddFinishedEvent(afe);
            database.UpdateAdventureStatsEntry(database.GetCharacterID((*iter).c_str()), GetTemplate()->theme, (ws != AWS_Lose) ? true : false);
        }
        iter++;
    }
    adventure_manager.GetAdventureData(this);
}
开发者ID:Vaion,项目名称:Server,代码行数:88,代码来源:Adventure.cpp


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