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


C++ CMonster::RefreshBuff方法代码示例

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


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

示例1: MapProcess

// Map Process
PVOID MapProcess( PVOID TS )
{
    bool ok_cont=false;
    UINT loopcount=0;
    clock_t time_skill=0;
    bool only_npc=false;    //LMA: AIP is done by NPC even when no player in map.
    bool only_summon=false;  //LMA: test for summons when no one's around (sad is a summon's life ^_^).
    UINT nb_summons_map=0;  //LMA: test for summons when no one's around (sad is a summon's life ^_^).

    //LMA: temp monster used for NPCs.
    fPoint tempPos;
    tempPos.x=0;
    tempPos.y=0;
    tempPos.z=0;
    CMonster* NPCmonster = new (nothrow) CMonster( tempPos, 0, 0, 0, 0  );

    while(GServer->ServerOnline)
    {
        loopcount++;            //geobot: refresh only every 100 cycles
        if (loopcount < 100)
        {
            continue;
        }

        loopcount = 0;

        pthread_mutex_lock( &GServer->PlayerMutex );
        pthread_mutex_lock( &GServer->MapMutex );

		

        for(UINT i=0;i<GServer->MapList.Map.size();i++)
        {
            CMap* map = GServer->MapList.Map.at(i);

            //LMA: test for Union.
            only_npc=false;
            only_summon=false;  //LMA: test for summons when no one's around (sad is a summon's life ^_^).
            nb_summons_map=0;
            if( map->PlayerList.size()<1 )
            {
                only_npc = true;    //LMA: AIP is done by NPC even when no player in map.

                //LMA: doing summons too if there are any in map.
                if(map->nb_summons > 0)
                {
                    only_summon = true;
                }
                //continue;
            }

            if (!only_npc||only_summon)
            {
                // Player update //------------------------
                for(UINT j=0;j<map->PlayerList.size();j++)
                {
                    CPlayer* player = map->PlayerList.at(j);
					//check for delayed trigger
					if(player->TriggerDelay != 0 )	//only one problem. If the player logs out before the delayed action trigger is executed than it never will be. Oh Dear! The missing children will really be missing. lol. It's fine though because they never truly despawn. they just disappear from the player's visibility list.
					{
						clock_t etime = clock() - player->DelayStartTime;
						if( etime >= player->TriggerDelay )
						{
							player->ExecuteQuestTrigger(player->TriggerHash,true);
							player->TriggerDelay = 0;	//reset delays and stuff
							player->TriggerHash = 0;
						}
					}
                    if(!player->Session->inGame) continue;

                    if(player->IsDead( ))
                    {
                          player->lastRegenTime = 0;
                          player->lastShowTime = 0;
                          continue;
                     }
                    player->RefreshHPMP();         //LMA HP / MP Jumping
                    if(player->UpdateValues( )) //Does nothing except for rides... equals to true if player isn't on the back seat
                        player->UpdatePosition(false);
                    if(player->IsOnBattle( ))
                        player->DoAttack( );

                    player->RefreshBuff( );
                    player->PlayerHeal( );
                    player->Regeneration( );
                    player->CheckPlayerLevelUP( );

                    player->CheckDoubleEquip(); //LMA: Core fix for double weapon and shield
                    player->CheckZulies( );

                    //Fuel handling.
                    if (player->Status->Stance == DRIVING && (player->last_fuel>0) && (clock()-player->last_fuel > 60000))
                    {
                      //We kill some fuel every now and then :)
                      player->TakeFuel();
                      player->last_fuel=clock();
                    }

                    //LMA: mileage coupon checks.
//.........这里部分代码省略.........
开发者ID:PurpleYouko,项目名称:KTRose_Server,代码行数:101,代码来源:MainProcess.cpp

示例2: MapProcess

// Map Process
PVOID MapProcess( PVOID TS )
{
    bool only_npc = false;
    while(GServer->ServerOnline)
    {
        pthread_mutex_lock( &GServer->PlayerMutex );
        pthread_mutex_lock( &GServer->MapMutex );
        for(UINT i=0;i<GServer->MapList.Map.size();i++)
        {
            CMap* map = GServer->MapList.Map.at(i);
            if( map->PlayerList.size()<1 )
                only_npc = true;
            else
                only_npc = false;
                //continue;
            if(!only_npc)
            {
                // Player update //------------------------
                for(UINT j=0;j<map->PlayerList.size();j++)
                {
                    CPlayer* player = map->PlayerList.at(j);
                    if(!player->Session->inGame) continue;
                    if(player->IsDead( )) continue;
                    //if(player->UpdateValues( ))
                        player->UpdatePosition( );
                    if(player->IsOnBattle( ))
                        player->DoAttack( );
                    player->RefreshBuff( );
                    player->PlayerHeal( );
                    player->Regeneration( );
                    player->CheckPlayerLevelUP( );
                    if( GServer->Config.AUTOSAVE == 1 )
                    {
                        clock_t etime = clock() - player->lastSaveTime;
                        if( etime >= GServer->Config.SAVETIME*1000 )
                        {
                            player->savedata( );
                            player->lastSaveTime = clock();
                        }
                    }
                }
                // Monster update //------------------------
                pthread_mutex_lock( &map->MonsterMutex );
                for(UINT j=0;j<map->MonsterList.size();j++)
                {
                    CMonster* monster = map->MonsterList.at(j);
                    
                    UINT thistimer = monster->AItimer; 
    				if(monster->hitcount == 0xFF)//this is a delay for new monster spawns this might olso fix invisible monsters(if they attack directly on spawning the client dosn't get the attack packet(its not in it's visible list yet))
                    {
                        if(thistimer < (UINT)GServer->round((clock( ) - monster->lastAiUpdate)))
                        {
                            monster->hitcount = 0;
                            //monster->DoAi(monster->thisnpc->AI, 0);
                            monster->DoAi(monster->monAI, 0);
                            monster->lastAiUpdate=clock();
                        }
                    }
                    //still need this for special spawns
                    if(!map->IsNight( ) && monster->Status->nightonly)// if day, delete all night time monsters
                    {
                        //Log( MSG_INFO, "Night Only monster deleted. Type %i", monster->montype);
                        map->DeleteMonster( monster, true, j );
                        continue;
                    }
                    if(map->IsNight() && monster->Status->dayonly)
                    {
                        //Log( MSG_INFO, "Day Only monster deleted. Type %i", monster->montype);
                        map->DeleteMonster( monster, true, j );
                        continue;
                    }
    
                    if(!monster->PlayerInRange( )) continue;
                    if(!monster->UpdateValues( )) continue;
                        monster->UpdatePosition( );
                    if(monster->IsOnBattle( ))
                    {
                        //monster->DoAttack( );
                        if(thistimer<(UINT)GServer->round((clock( ) - monster->lastAiUpdate)))
                        {
                             //monster->DoAi(monster->thisnpc->AI, 2);
                             monster->DoAi(monster->monAI, 2);
                             monster->lastAiUpdate = clock();
                             //Log(MSG_INFO,"Monster type: %i current HP: %i",monster->montype, monster->Stats->HP);
                        }
                        else
                        {
                             //Log(MSG_INFO,"Monster doing attack");
                             monster->DoAttack( );
                        }
                    }
                    else if(!monster->IsOnBattle() && !monster->IsDead( ))
                    {
                        if(thistimer<(UINT)GServer->round((clock( ) - monster->lastAiUpdate)))
                        {
                            //monster->DoAi(monster->thisnpc->AI, 1);
                            monster->DoAi(monster->monAI, 1);
                            monster->lastAiUpdate = clock();
                        }
//.........这里部分代码省略.........
开发者ID:osROSE,项目名称:osprose,代码行数:101,代码来源:MainProcess.cpp


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