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


C++ CreaturePointer::GetPositionZ方法代码示例

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


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

示例1: OnActivate

    void OnActivate(PlayerPointer pPlayer)
    {
        if(!pPlayer)
            return;

        QuestLogEntry *qle = pPlayer->GetQuestLogForEntry(9582);
        if(qle == NULL)
            return;

        // What is this ? :O To remove ?
        CreaturePointer reaver = pPlayer->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), 17556);
        if(reaver)
        {
            CreaturePointer reaver2 = pPlayer->GetMapMgr()->GetInterface()->SpawnCreature(17556, reaver->GetPositionX(), reaver->GetPositionY(), reaver->GetPositionZ(), reaver->GetOrientation(), true, false, 0, 0);
            reaver2->Despawn(5*60*1000, 0);
            reaver->Despawn(1, 5*60*1000);
        }

    }
开发者ID:Vanj-crew,项目名称:HearthStone-Emu,代码行数:19,代码来源:GameObjects.cpp

示例2: HandleDeleteCommand

bool ChatHandler::HandleDeleteCommand(const char* args, WorldSession *m_session)
{
    uint64 guid = m_session->GetPlayer()->GetSelection();
    if (guid == 0)
    {
        SystemMessage(m_session, "No selection.");
        return true;
    }

    CreaturePointer unit = m_session->GetPlayer()->GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid));
    if(!unit)
    {
        SystemMessage(m_session, "You should select a creature.");
        return true;
    }

    if( unit->m_spawn != NULL && !m_session->CanUseCommand('z') )
    {
        SystemMessage(m_session, "You do not have permission to do that. Please contact higher staff for removing of saved spawns.");
        return true;
    }

    sGMLog.writefromsession(m_session, "used npc delete, sqlid %u, creature %s, pos %f %f %f",
        unit->m_spawn ? unit->m_spawn : 0, unit->GetCreatureName() ? unit->GetCreatureName()->Name : "wtfbbqhax", unit->GetPositionX(), unit->GetPositionY(),
        unit->GetPositionZ());

    BlueSystemMessage(m_session, "Deleted creature ID %u", unit->spawnid);
    
    MapMgrPointer unitMgr = unit->GetMapMgr();
    if(unit->IsInWorld())
    {
        unit->RemoveFromWorld(false,true);
    }

    if(unit->m_spawn == NULL)
        return true;

    unit->DeleteFromDB();
    if(unit->m_spawn)
    {
        uint32 cellx=float2int32(((_maxX-unit->m_spawn->x)/_cellSize));
        uint32 celly=float2int32(((_maxY-unit->m_spawn->y)/_cellSize));
        if(cellx <= _sizeX && celly <= _sizeY && unitMgr != NULL)
        {
            CellSpawns * c = unitMgr->GetBaseMap()->GetSpawnsList(cellx, celly);
            if( c != NULL )
            {
                for(CreatureSpawnList::iterator itr = c->CreatureSpawns.begin(); itr != c->CreatureSpawns.end(); ++itr)
                {
                    if((*itr) == unit->m_spawn)
                    {
                        c->CreatureSpawns.erase(itr);
                        delete unit->m_spawn;
                        break;
                    }
                }
            }
        }
    }

    unit->Destructor();
    unit = NULLCREATURE;

    return true;
}
开发者ID:CadeLaRen,项目名称:Xeon-MMORPG-Emulator,代码行数:65,代码来源:Level2.cpp


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