本文整理汇总了C++中DynamicObject::Create方法的典型用法代码示例。如果您正苦于以下问题:C++ DynamicObject::Create方法的具体用法?C++ DynamicObject::Create怎么用?C++ DynamicObject::Create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DynamicObject
的用法示例。
在下文中一共展示了DynamicObject::Create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DynamicObject
void
Spell::Effect_Persistent_Area_Aura(uint32 i)
{
if(m_AreaAura == true) return;
m_AreaAura = true;
// Spawn dyn GameObject
DynamicObject* dynObj = new DynamicObject();
dynObj->Create(objmgr.GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), m_caster,
m_spellInfo, m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ,
duration);
uint32 damage = m_spellInfo->EffectBasePoints[i]+1;
dynObj->PeriodicTriggerDamage (damage, m_spellInfo->EffectAmplitude[i],
GetRadius(sSpellRadius.LookupEntry(m_spellInfo->EffectRadiusIndex[i])));
objmgr.AddObject(dynObj);
dynObj->PlaceOnMap();
m_caster->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, dynObj->GetGUID());
m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL, m_spellInfo->Id);
}
示例2: _HandleUpdateObjectOpcode
void WorldSession::_HandleUpdateObjectOpcode(WorldPacket& recvPacket)
{
uint8 utype;
//uint8 hasTransport;
uint32 usize, ublocks, readblocks=0;
uint64 uguid;
recvPacket >> ublocks; // >> hasTransport;
//logdev("UpdateObject: blocks = %u, hasTransport = %u", ublocks, hasTransport);
logdev("UpdateObject: blocks = %u", ublocks);
while((recvPacket.rpos() < recvPacket.size())&& (readblocks < ublocks))
{
recvPacket >> utype;
switch(utype)
{
case UPDATETYPE_VALUES:
{
uguid = recvPacket.GetPackedGuid();
_ValuesUpdate(uguid,recvPacket);
}
break;
case UPDATETYPE_MOVEMENT:
{
recvPacket >> uguid; // the guid is NOT packed here!
uint8 tyid;
Object *obj = objmgr.GetObj(uguid, true); // here we update also depleted objects, its just safer
if(obj)
tyid = obj->GetTypeId();
else // sometimes objects get deleted BEFORE a last update packet arrives, this must be handled also
{
tyid = GetTypeIdByGuid(uguid);
logerror("Got UpdateObject_Movement for unknown object "I64FMT". Using typeid %u",uguid,(uint32)tyid);
}
if(obj)
this->_MovementUpdate(tyid,uguid,recvPacket);
}
break;
case UPDATETYPE_CREATE_OBJECT2: // will be sent when our very own character is created
case UPDATETYPE_CREATE_OBJECT: // will be sent on any other object creation
{
uguid = recvPacket.GetPackedGuid();
uint8 objtypeid;
recvPacket >> objtypeid;
logdebug("Create Object type %u with guid "I64FMT,objtypeid,uguid);
// dont create objects if already present in memory.
// recreate every object except ourself!
if(objmgr.GetObj(uguid))
{
if(uguid != GetGuid())
{
logdev("- already exists, deleting old, creating new object");
objmgr.Remove(uguid, false);
// do not call script here, since the object does not really get deleted
}
else
{
logdev("- already exists, but not deleted (has our current GUID)");
}
}
// only if the obj didnt exist or was just deleted above, create it....
if(!objmgr.GetObj(uguid))
{
switch(objtypeid)
{
case TYPEID_OBJECT: // no data to read
{
logerror("Recieved wrong UPDATETYPE_CREATE_OBJECT to create Object base type!");
logerror("%s",toHexDump((uint8*)recvPacket.contents(),recvPacket.size(),true).c_str());
}
case TYPEID_ITEM:
{
Item *item = new Item();
item->Create(uguid);
objmgr.Add(item);
break;
}
case TYPEID_CONTAINER:
{
Bag *bag = new Bag();
bag->Create(uguid);
objmgr.Add(bag);
break;
}
case TYPEID_UNIT:
{
Unit *unit = new Unit();
unit->Create(uguid);
objmgr.Add(unit);
break;
}
case TYPEID_PLAYER:
{
if(GetGuid() == uguid) // objmgr.Add() would cause quite some trouble if we added ourself again
break;
Player *player = new Player();
player->Create(uguid);
objmgr.Add(player);
//.........这里部分代码省略.........