本文整理汇总了C++中SetEntry函数的典型用法代码示例。如果您正苦于以下问题:C++ SetEntry函数的具体用法?C++ SetEntry怎么用?C++ SetEntry使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetEntry函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetUInt64Value
void DynamicObject::Create(Unit* caster, Spell* pSpell, float x, float y, float z, uint32 duration, float radius)
{
Object::_Create(caster->GetMapId(), x, y, z, 0);
if(pSpell->g_caster)
{
m_parentSpell = pSpell;
}
if(pSpell->p_caster == NULL)
{
// try to find player caster here
if(caster->IsPlayer())
p_caster = TO< Player* >(caster);
}
else
p_caster = pSpell->p_caster;
m_spellProto = pSpell->GetProto();
SetUInt64Value(DYNAMICOBJECT_CASTER, caster->GetGUID());
SetEntry(m_spellProto->Id);
m_uint32Values[DYNAMICOBJECT_BYTES] = 0x01eeeeee;
m_uint32Values[DYNAMICOBJECT_SPELLID] = m_spellProto->Id;
m_floatValues[DYNAMICOBJECT_RADIUS] = radius;
m_position.x = x; //m_floatValues[DYNAMICOBJECT_POS_X] = x;
m_position.y = y; //m_floatValues[DYNAMICOBJECT_POS_Y] = y;
m_position.z = z; //m_floatValues[DYNAMICOBJECT_POS_Z] = z;
m_aliveDuration = duration;
u_caster = caster;
m_faction = caster->m_faction;
m_factionDBC = caster->m_factionDBC;
m_phase = caster->GetPhase();
if(pSpell->g_caster)
PushToWorld(pSpell->g_caster->GetMapMgr());
else
PushToWorld(caster->GetMapMgr());
if(caster->dynObj != NULL)
{
//expires
caster->dynObj->Remove();
}
caster->dynObj = this;
//sEventMgr.AddEvent(this, &DynamicObject::UpdateTargets, EVENT_DYNAMICOBJECT_UPDATE, 100, 0,EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT);
UpdateTargets();
}
示例2: FromPlayerBlackBoardEntry
////////////////////////////////////////////////////////////////////////////////
// Set an entry and send out update events to all listeners.
int LocalBB::ProcessSetEntryMessage(QueuePointer &resp_queue, player_msghdr * hdr, void * data)
{
if (!CheckHeader(hdr))
return -1;
player_blackboard_entry_t *request = reinterpret_cast<player_blackboard_entry_t*>(data);
BlackBoardEntry entry = FromPlayerBlackBoardEntry(*request);
SetEntry(entry);
// Send out update events to other listening devices for key group combinations
std::vector<QueuePointer> &devices = listeners[entry.group][entry.key];
for (std::vector<QueuePointer>::iterator itr=devices.begin(); itr != devices.end(); itr++)
{
QueuePointer device_queue = (*itr);
this->Publish(this->device_addr,
device_queue,
PLAYER_MSGTYPE_DATA,
PLAYER_BLACKBOARD_DATA_UPDATE,
data,
hdr->size,
NULL);
}
// Send out update events to just groups
std::vector<QueuePointer> &devices_groups = group_listeners[entry.group];
for (std::vector<QueuePointer>::iterator itr=devices_groups.begin(); itr != devices_groups.end(); itr++)
{
QueuePointer device_queue = (*itr);
this->Publish(this->device_addr,
device_queue,
PLAYER_MSGTYPE_DATA,
PLAYER_BLACKBOARD_DATA_UPDATE,
data,
hdr->size,
NULL);
}
// Send back an empty ack
this->Publish(this->device_addr,
resp_queue,
PLAYER_MSGTYPE_RESP_ACK,
PLAYER_BLACKBOARD_REQ_SET_ENTRY,
NULL,
0,
NULL);
return 0;
}
示例3: Relocate
bool Transport::Create(uint32 guidlow, uint32 mapid, float x, float y, float z, float ang, uint8 animprogress, uint16 dynamicHighValue)
{
Relocate(x, y, z, ang);
// instance id and phaseMask isn't set to values different from std.
if (!IsPositionValid())
{
sLog.outError("Transport (GUID: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
guidlow, x, y);
return false;
}
Object::_Create(guidlow, 0, HIGHGUID_MO_TRANSPORT);
GameObjectInfo const* goinfo = ObjectMgr::GetGameObjectInfo(guidlow);
if (!goinfo)
{
sLog.outErrorDb("Transport not created: entry in `gameobject_template` not found, guidlow: %u map: %u (X: %f Y: %f Z: %f) ang: %f", guidlow, mapid, x, y, z, ang);
return false;
}
m_goInfo = goinfo;
SetObjectScale(goinfo->size);
SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction);
// SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags);
SetUInt32Value(GAMEOBJECT_FLAGS, (GO_FLAG_TRANSPORT | GO_FLAG_NODESPAWN));
SetUInt32Value(GAMEOBJECT_LEVEL, m_period);
SetEntry(goinfo->id);
//SetDisplayId(goinfo->displayId);
// Use SetDisplayId only if we have the GO assigned to a proper map!
SetUInt32Value(GAMEOBJECT_DISPLAYID, goinfo->displayId);
m_displayInfo = sGameObjectDisplayInfoStore.LookupEntry(goinfo->displayId);
SetGoState(GO_STATE_READY);
SetGoType(GameobjectTypes(goinfo->type));
SetGoArtKit(0);
SetGoAnimProgress(animprogress);
// low part always 0, dynamicHighValue is some kind of progression (not implemented)
SetUInt16Value(GAMEOBJECT_DYNAMIC, 0, 0);
SetUInt16Value(GAMEOBJECT_DYNAMIC, 1, dynamicHighValue);
SetName(goinfo->name);
return true;
}
示例4: SetMap
bool DynamicObject::Create(uint32 guidlow, Unit* caster, uint32 spellId, SpellEffectIndex effIndex, float x, float y, float z, int32 duration, float radius, DynamicObjectType type, Targets target)
{
WorldObject::_Create(guidlow, HIGHGUID_DYNAMICOBJECT, caster->GetPhaseMask());
SetMap(caster->GetMap());
Relocate(x, y, z, 0);
if (!IsPositionValid())
{
sLog.outError("DynamicObject (spell %u eff %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", spellId, effIndex, GetPositionX(), GetPositionY());
return false;
}
SetEntry(spellId);
SetObjectScale(DEFAULT_OBJECT_SCALE);
SetCasterGuid(caster->GetObjectGuid());
/* Bytes field, so it's really 4 bit fields. These flags are unknown, but we do know that 0x00000001 is set for most.
Farsight for example, does not have this flag, instead it has 0x80000002.
Flags are set dynamically with some conditions, so one spell may have different flags set, depending on those conditions.
The size of the visual may be controlled to some degree with these flags.
uint32 bytes = 0x00000000;
bytes |= 0x01;
bytes |= 0x00 << 8;
bytes |= 0x00 << 16;
bytes |= 0x00 << 24;
*/
SetByteValue(DYNAMICOBJECT_BYTES, 0, type);
SetUInt32Value(DYNAMICOBJECT_SPELLID, spellId);
SetFloatValue(DYNAMICOBJECT_RADIUS, radius);
SetUInt32Value(DYNAMICOBJECT_CASTTIME, WorldTimer::getMSTime()); // new 2.4.0
SpellEntry const* spellProto = sSpellTemplate.LookupEntry<SpellEntry>(spellId);
if (!spellProto)
{
sLog.outError("DynamicObject (spell %u) not created. Spell not exist!", spellId);
return false;
}
m_aliveDuration = duration;
m_radius = radius;
m_effIndex = effIndex;
m_spellId = spellId;
m_positive = IsPositiveEffect(spellProto, m_effIndex);
m_target = target;
return true;
}
示例5: Relocate
bool Transport::Create(uint32 guidlow, uint32 entry, uint32 mapid, float x,
float y, float z, float ang, uint32 animprogress, uint32 dynflags) {
Relocate(x, y, z, ang);
// instance id and phaseMask isn't set to values different from std.
if (!IsPositionValid()) {
sLog->outError(
"Transport (GUID: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
guidlow, x, y);
return false;
}
Object::_Create(guidlow, 0, HIGHGUID_MO_TRANSPORT);
GameObjectInfo const* goinfo = ObjectMgr::GetGameObjectInfo(entry);
if (!goinfo) {
sLog->outErrorDb(
"Transport not created: entry in `gameobject_template` not found, guidlow: %u map: %u (X: %f Y: %f Z: %f) ang: %f",
guidlow, mapid, x, y, z, ang);
return false;
}
m_goInfo = goinfo;
SetFloatValue(OBJECT_FIELD_SCALE_X, goinfo->size);
SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction);
//SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags);
SetUInt32Value(GAMEOBJECT_FLAGS, MAKE_PAIR32(0x28, 0x64));
SetUInt32Value(GAMEOBJECT_LEVEL, m_period);
SetEntry(goinfo->id);
SetUInt32Value(GAMEOBJECT_DISPLAYID, goinfo->displayId);
SetGoState(GO_STATE_READY);
SetGoType(GameobjectTypes(goinfo->type));
SetGoAnimProgress(animprogress);
if (dynflags)
SetUInt32Value(GAMEOBJECT_DYNAMIC, MAKE_PAIR32(0, dynflags));
SetName(goinfo->name);
SetZoneScript();
return true;
}
示例6: SetMap
bool DynamicObject::CreateDynamicObject(ObjectGuid::LowType guidlow, Unit* caster, SpellInfo const* spell, Position const& pos, float radius, DynamicObjectType type, uint32 spellXSpellVisualId)
{
_spellXSpellVisualId = spellXSpellVisualId;
SetMap(caster->GetMap());
Relocate(pos);
if (!IsPositionValid())
{
TC_LOG_ERROR("misc", "DynamicObject (spell %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", spell->Id, GetPositionX(), GetPositionY());
return false;
}
WorldObject::_Create(ObjectGuid::Create<HighGuid::DynamicObject>(GetMapId(), spell->Id, guidlow));
SetPhaseMask(caster->GetPhaseMask(), false);
SetEntry(spell->Id);
SetObjectScale(1.0f);
SetGuidValue(DYNAMICOBJECT_CASTER, caster->GetGUID());
SetUInt32Value(DYNAMICOBJECT_TYPE, type);
SetUInt32Value(DYNAMICOBJECT_SPELL_X_SPELL_VISUAL_ID, spellXSpellVisualId);
SetUInt32Value(DYNAMICOBJECT_SPELLID, spell->Id);
SetFloatValue(DYNAMICOBJECT_RADIUS, radius);
SetUInt32Value(DYNAMICOBJECT_CASTTIME, getMSTime());
if (IsWorldObject())
setActive(true); //must before add to map to be put in world container
Transport* transport = caster->GetTransport();
if (transport)
{
float x, y, z, o;
pos.GetPosition(x, y, z, o);
transport->CalculatePassengerOffset(x, y, z, &o);
m_movementInfo.transport.pos.Relocate(x, y, z, o);
// This object must be added to transport before adding to map for the client to properly display it
transport->AddPassenger(this);
}
if (!GetMap()->AddToMap(this))
{
// Returning false will cause the object to be deleted - remove from transport
if (transport)
transport->RemovePassenger(this);
return false;
}
return true;
}
示例7: assert
unsigned CFAT::AllocateCluster (void)
{
m_Lock.Acquire ();
assert (m_pFATInfo != 0);
unsigned nCluster = m_pFATInfo->GetNextFreeCluster ();
while (nCluster < m_pFATInfo->GetClusterCount () + 2)
{
assert (nCluster >= 2);
unsigned nSectorOffset;
TFATBuffer *pBuffer = GetSector (nCluster, &nSectorOffset, m_pFATInfo->GetReadFAT ());
assert (pBuffer != 0);
unsigned nClusterEntry = GetEntry (pBuffer, nSectorOffset);
assert (m_pCache != 0);
m_pCache->FreeSector (pBuffer, 1);
if (nClusterEntry == 0)
{
for (unsigned nFAT = m_pFATInfo->GetFirstWriteFAT ();
nFAT <= m_pFATInfo->GetLastWriteFAT (); nFAT++)
{
pBuffer = GetSector (nCluster, &nSectorOffset, nFAT);
assert (pBuffer != 0);
SetEntry (pBuffer, nSectorOffset, m_pFATInfo->GetFATType () == FAT16 ? 0xFFFF : 0x0FFFFFFF);
m_pCache->MarkDirty (pBuffer);
m_pCache->FreeSector (pBuffer, 1);
}
m_pFATInfo->ClusterAllocated (nCluster);
m_Lock.Release ();
return nCluster;
}
nCluster++;
}
m_Lock.Release ();
return 0;
}
示例8: Relocate
bool Transport::Create(uint32 guidlow, uint32 entry, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress, uint32 dynflags)
{
Relocate(x, y, z, ang);
// instance id and phaseMask isn't set to values different from std.
if (!IsPositionValid())
{
TC_LOG_ERROR("entities.transport", "Transport (GUID: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
guidlow, x, y);
return false;
}
Object::_Create(guidlow, 0, HIGHGUID_MO_TRANSPORT);
GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry);
if (!goinfo)
{
TC_LOG_ERROR("sql.sql", "Transport not created: entry in `gameobject_template` not found, guidlow: %u map: %u (X: %f Y: %f Z: %f) ang: %f", guidlow, mapid, x, y, z, ang);
return false;
}
m_goInfo = goinfo;
SetObjectScale(goinfo->size);
SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction);
//SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags); -- gunship
SetUInt32Value(GAMEOBJECT_FLAGS, MAKE_PAIR32(0x28, 0x64));
SetUInt32Value(GAMEOBJECT_LEVEL, m_period);
SetEntry(goinfo->entry);
SetDisplayId(goinfo->displayId);
SetGoState(GO_STATE_READY);
SetGoType(GameobjectTypes(goinfo->type));
SetGoAnimProgress(animprogress);
if (dynflags)
SetUInt32Value(GAMEOBJECT_FIELD_ANIM_PROGRESS, MAKE_PAIR32(0, dynflags));
SetName(goinfo->name);
SetZoneScript();
return true;
}
示例9: InitKernelControl
void InitKernelControl()
{ // learned from timer lab, remember to modify main.h
IDT_ptr = get_idt_base(); //locate IDT 1st
SetEntry(TIMER_INTR, TimerEntry); //call SetEntry() to plant TimerEntry jump point
outportb(0x21, ~1); //program the mask of PIC(PIC mask == 0x21 and ~1 == mask)
//Phase 2
SetEntry(GETPID_INTR, GetPidEntry); //add 2 new IDT entries.
SetEntry(SLEEP_INTR, SleepEntry); //add 2 new IDT entries.
//phase 3 fill out IDT with new entries
SetEntry(STARTPROC_INTR, StartProcEntry);
SetEntry(SEMGET_INTR, SemGetEntry);
SetEntry(SEMWAIT_INTR, SemWaitEntry);
SetEntry(SEMPOST_INTR, SemPostEntry);
//phase 4
SetEntry(MSGSND_INTR, MsgSndEntry);
SetEntry(MSGRCV_INTR, MsgRcvEntry);
}
示例10: Relocate
bool DynamicObject::Create(uint32 guidlow, Unit* caster, uint32 spellId, SpellEffectIndex effIndex, float x, float y, float z, int32 duration, float radius, DynamicObjectType type)
{
WorldObject::_Create(ObjectGuid(HIGHGUID_DYNAMICOBJECT, guidlow), caster->GetPhaseMask());
Relocate(WorldLocation(caster->GetMapId(), x, y, z, 0.0f, caster->GetPhaseMask(), caster->GetInstanceId()));
SetMap(caster->GetMap());
if (!IsPositionValid())
{
sLog.outError("DynamicObject (spell %u eff %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", spellId, effIndex, GetPositionX(), GetPositionY());
return false;
}
SpellEntry const* spellProto = sSpellStore.LookupEntry(spellId);
if (!spellProto)
{
sLog.outError("DynamicObject (spell %u) not created. Spell not exist!", spellId);
return false;
}
SetEntry(spellId);
SetObjectScale(DEFAULT_OBJECT_SCALE);
if (type == DYNAMIC_OBJECT_RAID_MARKER)
{
MANGOS_ASSERT(caster->GetTypeId() == TYPEID_PLAYER && ((Player*)caster)->GetGroup()
&& "DYNAMIC_OBJECT_RAID_MARKER must only be casted by players and that are in group.");
SetGuidValue(DYNAMICOBJECT_CASTER, ((Player*)caster)->GetGroup()->GetObjectGuid());
}
else
SetGuidValue(DYNAMICOBJECT_CASTER, caster->GetObjectGuid());
SetUInt32Value(DYNAMICOBJECT_BYTES, spellProto->GetSpellVisual() | (type << 28));
SetUInt32Value(DYNAMICOBJECT_SPELLID, spellId);
SetFloatValue(DYNAMICOBJECT_RADIUS, radius);
SetUInt32Value(DYNAMICOBJECT_CASTTIME, WorldTimer::getMSTime()); // new 2.4.0
m_aliveDuration = duration;
m_radius = radius;
m_effIndex = effIndex;
m_spellId = spellId;
m_positive = IsPositiveEffect(spellProto, m_effIndex);
return true;
}
示例11: Relocate
bool Transport::Create(uint32 guidlow, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress, uint32 dynflags)
{
Relocate(x,y,z,ang);
SetMapId(mapid);
if(!IsPositionValid())
{
sLog.outError("ERROR: Transport (GUID: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
guidlow,x,y);
return false;
}
Object::_Create(guidlow, 0, HIGHGUID_MO_TRANSPORT);
GameObjectInfo const* goinfo = objmgr.GetGameObjectInfo(guidlow);
if (!goinfo)
{
sLog.outErrorDb("Transport not created: entry in `gameobject_template` not found, guidlow: %u map: %u (X: %f Y: %f Z: %f) ang: %f",guidlow, mapid, x, y, z, ang);
return false;
}
m_goInfo = goinfo;
SetFloatValue(OBJECT_FIELD_SCALE_X, goinfo->size);
SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction);
//SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags);
SetUInt32Value(GAMEOBJECT_FLAGS, MAKE_PAIR32(0x28, 0x64));
SetUInt32Value(GAMEOBJECT_LEVEL, m_period);
SetEntry(goinfo->id);
SetUInt32Value(GAMEOBJECT_DISPLAYID, goinfo->displayId);
SetGoState(1);
SetGoType(GameobjectTypes(goinfo->type));
SetGoAnimProgress(animprogress);
if(dynflags)
SetUInt32Value(GAMEOBJECT_DYNAMIC, MAKE_PAIR32(0, dynflags));
return true;
}
示例12: BM_generic
// Simple rather than efficient (esp. the call to eval)
std::vector<RingElem> BM_generic(const SparsePolyRing& P, const ConstMatrixView& pts)
{
if (CoeffRing(P) != RingOf(pts)) CoCoA_ERROR(ERR::MixedRings, "Buchberger-Moeller");
if (NumIndets(P) < NumCols(pts)) CoCoA_ERROR(ERR::IncompatDims, "Buchberger-Moeller");
const long NumPts = NumRows(pts);
const long dim = NumCols(pts);
const ring k = CoeffRing(P);
vector<RingElem> GB;
const PPMonoid TT = PPM(P);
QBGenerator QBG(TT);
QBG.myCornerPPIntoQB(one(TT));
matrix M = NewDenseMat(k, 1, NumPts);
// Fill first row with 1:
for (int i=0; i<NumPts; ++i) SetEntry(M,0,i, 1);
// The next loop removes the last indets from consideration.
for (int i=dim; i < NumIndets(TT); ++i)
QBG.myCornerPPIntoAvoidSet(indet(TT,i));
while (!QBG.myCorners().empty())
{
const PPMonoidElem t = QBG.myCorners().front();
const vector<RingElem> v = eval(t, pts);
ConstMatrixView NewRow = RowMat(v);
const matrix a = LinSolve(transpose(M), transpose(NewRow));
if (IsValidSolution(a))
{
QBG.myCornerPPIntoAvoidSet(t);
RingElem NewGBElem = monomial(P, one(k), t);
const vector<PPMonoidElem>& QB = QBG.myQB();
for (int i=0; i < NumRows(M); ++i)
NewGBElem -= monomial(P, a(i,0), QB[i]);
GB.push_back(NewGBElem);
}
else
{
QBG.myCornerPPIntoQB(t);
M = NewDenseMat(ConcatVer(M, NewRow));
}
}
return GB;
}
示例13: SetMap
bool DynamicObject::Create( uint32 guidlow, Unit *caster, uint32 spellId, SpellEffectIndex effIndex, float x, float y, float z, int32 duration, float radius )
{
WorldObject::_Create(guidlow, HIGHGUID_DYNAMICOBJECT);
SetMap(caster->GetMap());
Relocate(x, y, z, 0);
if(!IsPositionValid())
{
sLog.outError("DynamicObject (spell %u eff %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)",spellId,effIndex,GetPositionX(),GetPositionY());
return false;
}
SetEntry(spellId);
SetObjectScale(DEFAULT_OBJECT_SCALE);
SetUInt64Value(DYNAMICOBJECT_CASTER, caster->GetGUID());
/* Bytes field, so it's really 4 bit fields. These flags are unknown, but we do know that 0x00000001 is set for most.
Farsight for example, does not have this flag, instead it has 0x80000002.
Flags are set dynamically with some conditions, so one spell may have different flags set, depending on those conditions.
The size of the visual may be controlled to some degree with these flags.
uint32 bytes = 0x00000000;
bytes |= 0x01;
bytes |= 0x00 << 8;
bytes |= 0x00 << 16;
bytes |= 0x00 << 24;
*/
SetUInt32Value(DYNAMICOBJECT_BYTES, 0x00000001);
SetUInt32Value(DYNAMICOBJECT_SPELLID, spellId);
SetFloatValue(DYNAMICOBJECT_RADIUS, radius);
SetFloatValue(DYNAMICOBJECT_POS_X, x);
SetFloatValue(DYNAMICOBJECT_POS_Y, y);
SetFloatValue(DYNAMICOBJECT_POS_Z, z);
m_aliveDuration = duration;
m_radius = radius;
m_effIndex = effIndex;
m_spellId = spellId;
m_positive = IsPositiveEffect(m_spellId, m_effIndex);
return true;
}
示例14: SetMap
bool DynamicObject::CreateDynamicObject(uint32 guidlow, Unit* caster, uint32 spellId, Position const& pos, float radius, DynamicObjectType type)
{
SetMap(caster->GetMap());
Relocate(pos);
if (!IsPositionValid())
{
sLog->outError(LOG_FILTER_GENERAL, "DynamicObject (spell %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", spellId, GetPositionX(), GetPositionY());
return false;
}
WorldObject::_Create(guidlow, HIGHGUID_DYNAMICOBJECT, caster->GetPhaseMask());
SetEntry(spellId);
SetObjectScale(1.0f);
SetUInt64Value(DYNAMICOBJECT_CASTER, caster->GetGUID());
// The lower word of DYNAMICOBJECT_BYTES must be 0x0001. This value means that the visual radius will be overriden
// by client for most of the "ground patch" visual effect spells and a few "skyfall" ones like Hurricane.
// If any other value is used, the client will _always_ use the radius provided in DYNAMICOBJECT_RADIUS, but
// precompensation is necessary (eg radius *= 2) for many spells. Anyway, blizz sends 0x0001 for all the spells
// I saw sniffed...
// Blizz set visual spell Id in 3 first byte of DYNAMICOBJECT_BYTES after 5.X
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (spellInfo)
{
uint32 visual = spellInfo->SpellVisual[0] ? spellInfo->SpellVisual[0] : spellInfo->SpellVisual[1];
SetUInt32Value(DYNAMICOBJECT_BYTES, 0x10000000 | visual);
}
SetUInt32Value(DYNAMICOBJECT_SPELLID, spellId);
SetFloatValue(DYNAMICOBJECT_RADIUS, radius);
SetUInt32Value(DYNAMICOBJECT_CASTTIME, getMSTime());
if (IsWorldObject())
setActive(true); //must before add to map to be put in world container
if (!GetMap()->AddToMap(this))
return false;
return true;
}
示例15: SetMap
bool DynamicObject::Create(uint32 guidlow, Unit *caster, uint32 spellId, uint32 effIndex, const Position &pos, int32 duration, float radius)
{
SetMap(caster->GetMap());
Relocate(pos);
if (!IsPositionValid())
{
sLog->outError("DynamicObject (spell %u eff %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", spellId, effIndex, GetPositionX(), GetPositionY());
return false;
}
WorldObject::_Create(guidlow, HIGHGUID_DYNAMICOBJECT, caster->GetPhaseMask());
SetEntry(spellId);
SetFloatValue(OBJECT_FIELD_SCALE_X, 1);
SetUInt64Value(DYNAMICOBJECT_CASTER, caster->GetGUID());
// The lower word of DYNAMICOBJECT_BYTES must be 0x0001. This value means that the visual radius will be overriden
// by client for most of the "ground patch" visual effect spells and a few "skyfall" ones like Hurricane.
// If any other value is used, the client will _always_ use the radius provided in DYNAMICOBJECT_RADIUS, but
// precompensation is necessary (eg radius *= 2) for many spells. Anyway, blizz sends 0x0001 for all the spells
// I saw sniffed...
SetUInt32Value(DYNAMICOBJECT_BYTES, 0x00000001);
SetUInt32Value(DYNAMICOBJECT_SPELLID, spellId);
SetFloatValue(DYNAMICOBJECT_RADIUS, radius);
SetFloatValue(DYNAMICOBJECT_POS_X, pos.m_positionX);
SetFloatValue(DYNAMICOBJECT_POS_Y, pos.m_positionY);
SetFloatValue(DYNAMICOBJECT_POS_Z, pos.m_positionZ);
SetUInt32Value(DYNAMICOBJECT_CASTTIME, getMSTime());
m_aliveDuration = duration;
m_radius = radius;
m_effIndex = effIndex;
m_spellId = spellId;
m_casterGuid = caster->GetGUID();
m_updateTimer = 0;
if (m_effIndex == 4)
m_isWorldObject = true;
return true;
}