本文整理汇总了C++中Corpse::GetGUID方法的典型用法代码示例。如果您正苦于以下问题:C++ Corpse::GetGUID方法的具体用法?C++ Corpse::GetGUID怎么用?C++ Corpse::GetGUID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Corpse
的用法示例。
在下文中一共展示了Corpse::GetGUID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SendLoot
/*Loot type MUST be
1-corpse, go
2-skinning/herbalism/minning
3-Fishing
*/
void Player::SendLoot(uint64 guid,uint8 loot_type, uint32 mapid)
{
Group * m_Group = m_playerInfo->m_Group;
if( !IsInWorld() )
return;
Loot * pLoot = NULL;
uint32 guidtype = GET_TYPE_FROM_GUID(guid);
int8 loot_method;
if( m_Group != NULL )
loot_method = m_Group->GetMethod();
else
loot_method = PARTY_LOOT_FFA;
if(guidtype == HIGHGUID_TYPE_UNIT)
{
Creature* pCreature = GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid));
if(!pCreature)return;
pLoot=&pCreature->loot;
m_currentLoot = pCreature->GetGUID();
}else if(guidtype == HIGHGUID_TYPE_GAMEOBJECT)
{
GameObject* pGO = GetMapMgr()->GetGameObject(GET_LOWGUID_PART(guid));
if(!pGO)return;
pGO->SetByte(GAMEOBJECT_BYTES_1, 0,0);
pLoot=&pGO->loot;
m_currentLoot = pGO->GetGUID();
}
else if((guidtype == HIGHGUID_TYPE_PLAYER) )
{
Player *p=GetMapMgr()->GetPlayer((uint32)guid);
if(!p)return;
pLoot=&p->loot;
m_currentLoot = p->GetGUID();
}
else if( (guidtype == HIGHGUID_TYPE_CORPSE))
{
Corpse *pCorpse = objmgr.GetCorpse((uint32)guid);
if(!pCorpse)return;
pLoot=&pCorpse->loot;
m_currentLoot = pCorpse->GetGUID();
}
else if( (guidtype == HIGHGUID_TYPE_ITEM) )
{
Item *pItem = GetItemInterface()->GetItemByGUID(guid);
if(!pItem)
return;
pLoot = pItem->loot;
m_currentLoot = pItem->GetGUID();
}
if(!pLoot)
{
// something whack happened.. damn cheaters..
return;
}
// add to looter set
pLoot->looters.insert( GetLowGUID() );
WorldPacket data, data2(32);
data.SetOpcode( SMSG_LOOT_RESPONSE );
m_lootGuid = guid;
data << uint64( guid );
data << uint8( loot_type );//loot_type;
data << uint32( pLoot->gold );
data << uint8( 0 ); //loot size reserve
std::vector<__LootItem>::iterator iter=pLoot->items.begin();
uint32 count= 0;
uint8 slottype = 0;
for(uint32 x= 0;iter!=pLoot->items.end();iter++,x++)
{
if (iter->iItemsCount == 0)
continue;
LooterSet::iterator itr = iter->has_looted.find(GetLowGUID());
if (iter->has_looted.end() != itr)
continue;
ItemPrototype* itemProto =iter->item.itemproto;
if (!itemProto)
continue;
// check if it's on ML if so only quest items and ffa loot should be shown based on mob
//.........这里部分代码省略.........
示例2:
Corpse * ObjectAccessor::GetCorpse(uint32 mapid, float x, float y, uint64 guid)
{
Corpse * corpse = HashMapHolder<Corpse>::Find(guid);
if (corpse && corpse->GetMapId() == mapid)
{
CellPair p = Looking4group::ComputeCellPair(x,y);
if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP)
{
sLog.outLog(LOG_DEFAULT, "ERROR: ObjectAccessor::GetCorpse: invalid coordinates supplied X:%f Y:%f grid cell [%u:%u]", x, y, p.x_coord, p.y_coord);
return NULL;
}
CellPair q = Looking4group::ComputeCellPair(corpse->GetPositionX(), corpse->GetPositionY());
if (q.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || q.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP)
{
sLog.outLog(LOG_DEFAULT, "ERROR: ObjectAccessor::GetCorpse: object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", corpse->GetGUID(), corpse->GetPositionX(), corpse->GetPositionY(), q.x_coord, q.y_coord);
return NULL;
}
int32 dx = int32(p.x_coord) - int32(q.x_coord);
int32 dy = int32(p.y_coord) - int32(q.y_coord);
if (dx > -2 && dx < 2 && dy > -2 && dy < 2)
return corpse;
}
return NULL;
}