本文整理汇总了C++中CreaturePointer::GetCreatureName方法的典型用法代码示例。如果您正苦于以下问题:C++ CreaturePointer::GetCreatureName方法的具体用法?C++ CreaturePointer::GetCreatureName怎么用?C++ CreaturePointer::GetCreatureName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CreaturePointer
的用法示例。
在下文中一共展示了CreaturePointer::GetCreatureName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}