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


C++ CMobEntity::SetBattleTargetID方法代码示例

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


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

示例1: DecreaseZoneCounter

void CZoneEntities::DecreaseZoneCounter(CCharEntity* PChar)
{
    DSP_DEBUG_BREAK_IF(PChar == nullptr);
    DSP_DEBUG_BREAK_IF(PChar->loc.zone != m_zone);

    //remove pets
    if (PChar->PPet != nullptr)
    {
        charutils::BuildingCharPetAbilityTable(PChar, (CPetEntity*)PChar->PPet, 0);//blank the pet commands
        if (PChar->PPet->isCharmed) {
            petutils::DespawnPet(PChar);
        }
        else {
            PChar->PPet->status = STATUS_DISAPPEAR;
            if (((CPetEntity*)(PChar->PPet))->getPetType() == PETTYPE_AVATAR)
                PChar->setModifier(MOD_AVATAR_PERPETUATION, 0);
        }
        // It may have been nullptred by DespawnPet
        if (PChar->PPet != nullptr) {
            PChar->PPet->PAI->Disengage();

            for (EntityList_t::const_iterator it = m_charList.begin(); it != m_charList.end(); ++it)
            {
                //inform other players of the pets removal
                CCharEntity* PCurrentChar = (CCharEntity*)it->second;
                SpawnIDList_t::iterator PET = PCurrentChar->SpawnPETList.find(PChar->PPet->id);

                if (PET != PCurrentChar->SpawnPETList.end())
                {
                    PCurrentChar->SpawnPETList.erase(PET);
                    PCurrentChar->pushPacket(new CEntityUpdatePacket(PChar->PPet, ENTITY_DESPAWN, UPDATE_NONE));
                }
            }
            PChar->PPet = nullptr;
        }
    }

    //remove bcnm status
    if (m_zone->m_BattlefieldHandler != nullptr && PChar->StatusEffectContainer->HasStatusEffect(EFFECT_BATTLEFIELD))
    {
        if (m_zone->m_BattlefieldHandler->disconnectFromBcnm(PChar)) {
            ShowDebug("Removed %s from the BCNM they were in as they have left the zone.\n", PChar->GetName());
        }

        if (PChar->loc.destination == 0) { //this player is disconnecting/logged out, so move them to the entrance
            //move depending on zone
            int pos[4] = {0, 0, 0, 0};
            battlefieldutils::getStartPosition(m_zone->GetID(), pos);
            if (pos != nullptr) {
                PChar->loc.p.x = pos[0];
                PChar->loc.p.y = pos[1];
                PChar->loc.p.z = pos[2];
                PChar->loc.p.rotation = pos[3];
                PChar->updatemask |= UPDATE_POS;
                charutils::SaveCharPosition(PChar);
            }
            else {
                ShowWarning("%s has disconnected from the BCNM but cannot move them to the lobby as the lobby position is unknown!\n", PChar->GetName());
            }
        }
    }
    else if (m_zone->m_BattlefieldHandler != nullptr && PChar->StatusEffectContainer->HasStatusEffect(EFFECT_DYNAMIS, 0))
    {
        if (m_zone->m_BattlefieldHandler->disconnectFromDynamis(PChar)) {
            ShowDebug("Removed %s from the BCNM they were in as they have left the zone.\n", PChar->GetName());
        }

        if (PChar->loc.destination == 0) { //this player is disconnecting/logged out, so move them to the entrance
            //move depending on zone
            int pos[4] = {0, 0, 0, 0};
            battlefieldutils::getStartPosition(m_zone->GetID(), pos);
            if (!(pos[0] == 0 && pos[1] == 0 && pos[2] == 0 && pos[3] == 0)) {
                PChar->loc.p.x = pos[0];
                PChar->loc.p.y = pos[1];
                PChar->loc.p.z = pos[2];
                PChar->loc.p.rotation = pos[3];
                PChar->updatemask |= UPDATE_POS;
                charutils::SaveCharPosition(PChar);
            }
            else {
                ShowWarning("%s has disconnected from the BCNM but cannot move them to the lobby as the lobby position is unknown!\n", PChar->GetName());
            }
        }
    }

    for (auto PMobIt : m_mobList)
    {
        CMobEntity* PCurrentMob = (CMobEntity*)PMobIt.second;
        PCurrentMob->PEnmityContainer->LogoutReset(PChar->id);
        if (PCurrentMob->m_OwnerID.id == PChar->id)
        {
            PCurrentMob->m_OwnerID.clean();
            PCurrentMob->updatemask |= UPDATE_STATUS;
        }
        if (PCurrentMob->GetBattleTargetID() == PChar->targid)
        {
            PCurrentMob->SetBattleTargetID(0);
        }
    }

//.........这里部分代码省略.........
开发者ID:ciradan,项目名称:darkstar,代码行数:101,代码来源:zone_entities.cpp


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