本文整理匯總了C++中GetCreatureInfo函數的典型用法代碼示例。如果您正苦於以下問題:C++ GetCreatureInfo函數的具體用法?C++ GetCreatureInfo怎麽用?C++ GetCreatureInfo使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GetCreatureInfo函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: GetCreatureInfo
void Creature::generateMoneyLoot()
{
uint32 maxgold = GetCreatureInfo()->maxgold;
if (GetCreatureInfo()->maxgold > 0)
{
uint32 mingold = GetCreatureInfo()->mingold;
if (maxgold <= mingold)
loot.gold = uint32(maxgold * sWorld.getRate(RATE_DROP_MONEY));
else
loot.gold = uint32(rand32(mingold, maxgold) * sWorld.getRate(RATE_DROP_MONEY));
}
}
示例2: GetOwner
void Totem::Update(uint32 update_diff, uint32 time )
{
Unit *owner = GetOwner();
if (!owner || !owner->isAlive() || !isAlive())
{
UnSummon(); // remove self
return;
}
if (m_duration <= update_diff)
{
UnSummon(); // remove self
return;
}
else
m_duration -= update_diff;
// Grounding totem + polymorph = unsummon
if(GetCreatureInfo()->Entry == 5925 && HasAuraType(SPELL_AURA_MOD_CONFUSE))
{
UnSummon(); // remove self
return;
}
Creature::Update( update_diff, time );
}
示例3: SetInstanceId
void Totem::Summon(Unit* owner)
{
sLog.outDebug("AddObject at Totem.cpp line 49");
SetInstanceId(owner->GetInstanceId());
owner->GetMap()->Add((Creature*)this);
// select totem model in dependent from owner team
CreatureInfo const *cinfo = GetCreatureInfo();
if(owner->GetTypeId()==TYPEID_PLAYER && cinfo)
{
uint32 display_id = objmgr.ChooseDisplayId(((Player*)owner)->GetTeam(),cinfo);
CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(display_id);
if (minfo)
display_id = minfo->modelid;
SetDisplayId(display_id);
}
WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, 8);
data << GetGUID();
SendMessageToSet(&data,true);
AIM_Initialize();
switch(m_type)
{
case TOTEM_PASSIVE: CastSpell(this, GetSpell(), true); break;
case TOTEM_STATUE: CastSpell(GetOwner(), GetSpell(), true); break;
default: break;
}
}
示例4: GetCreatureInfo
void Totem::InitStats(uint32 duration)
{
Minion::InitStats(duration);
CreatureInfo const *cinfo = GetCreatureInfo();
if(m_owner->GetTypeId() == TYPEID_PLAYER && cinfo)
{
uint32 display_id = objmgr.ChooseDisplayId(((Player*)m_owner)->GetTeam(), cinfo);
CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(display_id);
if (minfo)
display_id = minfo->modelid;
SetDisplayId(display_id);
}
// Get spell casted by totem
SpellEntry const * totemSpell = sSpellStore.LookupEntry(GetSpell());
if (totemSpell)
{
// If spell have cast time -> so its active totem
if (GetSpellCastTime(totemSpell))
m_type = TOTEM_ACTIVE;
}
if(GetEntry() == SENTRY_TOTEM_ENTRY)
SetReactState(REACT_AGGRESSIVE);
m_duration = duration;
SetLevel(m_owner->getLevel());
}
示例5: SetMapId
bool Vehicle::Create(uint32 guidlow, Map *map, uint32 Entry, uint32 vehicleId, uint32 team)
{
SetMapId(map->GetId());
SetInstanceId(map->GetInstanceId());
Object::_Create(guidlow, Entry, HIGHGUID_VEHICLE);
if(!InitEntry(Entry, team))
return false;
m_defaultMovementType = IDLE_MOTION_TYPE;
AIM_Initialize();
SetVehicleId(vehicleId);
SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 1.0f);
CreatureInfo const *ci = GetCreatureInfo();
setFaction(team == ALLIANCE ? ci->faction_A : ci->faction_H);
SetMaxHealth(ci->maxhealth);
SelectLevel(ci);
SetHealth(GetMaxHealth());
return true;
}
示例6: GetCreatureInfo
void Totem::InitStats(uint32 duration)
{
Minion::InitStats(duration);
CreatureTemplate const *cinfo = GetCreatureInfo();
if (m_owner->GetTypeId() == TYPEID_PLAYER && cinfo)
{
uint32 displayID = sObjectMgr->ChooseDisplayId(m_owner->ToPlayer()->GetTeam(), cinfo);
sObjectMgr->GetCreatureModelRandomGender(&displayID);
switch (m_owner->ToPlayer()->GetTeam())
{
case ALLIANCE:
displayID = cinfo->Modelid1;
break;
case HORDE:
if (cinfo->Modelid3)
displayID = cinfo->Modelid3;
else
displayID = cinfo->Modelid1;
switch (((Player*)m_owner)->getRace())
{
case RACE_ORC:
if (cinfo->Modelid2)
displayID = cinfo->Modelid2;
else
displayID = cinfo->Modelid1;
break;
case RACE_TROLL:
if (cinfo->Modelid4)
displayID = cinfo->Modelid4;
else
displayID = cinfo->Modelid1;
break;
default:
break;
}
break;
default:
break;
}
SetDisplayId(displayID);
}
// Get spell casted by totem
SpellEntry const * totemSpell = sSpellStore.LookupEntry(GetSpell());
if (totemSpell)
{
// If spell have cast time -> so its active totem
if (GetSpellCastTime(totemSpell))
m_type = TOTEM_ACTIVE;
}
if (GetEntry() == SENTRY_TOTEM_ENTRY)
SetReactState(REACT_AGGRESSIVE);
m_duration = duration;
SetLevel(m_owner->getLevel());
}
示例7: RemoveSpellsCausingAura
void Vehicle::RemovePassenger(Unit *unit)
{
SeatMap::iterator seat;
for(seat = m_Seats.begin(); seat != m_Seats.end(); ++seat)
{
if((seat->second.flags & (SEAT_FULL | SEAT_VEHICLE_FREE | SEAT_VEHICLE_FULL)) && seat->second.passenger == unit)
{
unit->SetVehicleGUID(0);
if(seat->second.vs_flags & SF_MAIN_RIDER)
{
RemoveSpellsCausingAura(SPELL_AURA_CONTROL_VEHICLE);
if(unit->GetTypeId() == TYPEID_PLAYER)
{
((Player*)unit)->SetMover(unit);
((Player*)unit)->SetClientControl(unit, 1);
((Player*)unit)->SetMoverInQueve(NULL);
((Player*)unit)->RemovePetActionBar();
if(((Player*)unit)->GetGroup())
((Player*)unit)->SetGroupUpdateFlag(GROUP_UPDATE_VEHICLE);
}
unit->SetCharm(NULL);
SetCharmerGUID(NULL);
setFaction(GetCreatureInfo()->faction_A);
}
if(GetVehicleFlags() & VF_NON_SELECTABLE)
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
if(seat->second.vs_flags & SF_UNATTACKABLE)
unit->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
// restore player control
if(unit->GetTypeId() == TYPEID_PLAYER)
{
((Player*)unit)->GetCamera().ResetView();
if(seat->second.vs_flags & SF_CAN_CAST)
{
WorldPacket data0(SMSG_FORCE_MOVE_UNROOT, 10);
data0 << unit->GetPackGUID();
data0 << (uint32)(2); // can rotate
unit->SendMessageToSet(&data0,true);
}
else
{
WorldPacket data1(SMSG_FORCE_MOVE_UNROOT, 10);
data1 << unit->GetPackGUID();
data1 << (uint32)(0); // cannot rotate
unit->SendMessageToSet(&data1,true);
}
}
unit->m_movementInfo.ClearTransportData();
seat->second.passenger = NULL;
seat->second.flags = SEAT_FREE;
unit->m_movementInfo.RemoveMovementFlag(MOVEFLAG_ONTRANSPORT);
EmptySeatsCountChanged();
break;
}
}
}
示例8: GetCreatureInfo
void Totem::Summon(Unit* owner)
{
owner->GetMap()->Add((Creature*)this);
// select totem model in dependent from owner team
CreatureInfo const *cinfo = GetCreatureInfo();
if(owner->GetTypeId() == TYPEID_PLAYER && cinfo)
{
uint32 display_id = sObjectMgr.ChooseDisplayId(((Player*)owner)->GetTeam(), cinfo);
CreatureModelInfo const *minfo = sObjectMgr.GetCreatureModelRandomGender(display_id);
if (minfo)
display_id = minfo->modelid;
SetDisplayId(display_id);
}
AIM_Initialize();
// there are some totems, which exist just for their visual appeareance
if (!GetSpell())
return;
switch(m_type)
{
case TOTEM_PASSIVE:
CastSpell(this, GetSpell(), true);
break;
case TOTEM_STATUE:
CastSpell(GetOwner(), GetSpell(), true);
break;
default: break;
}
}
示例9: npc_unworthy_initiateAI
npc_unworthy_initiateAI(Creature *c) : ScriptedAI(c)
{
me->SetReactState(REACT_PASSIVE);
if (!me->GetEquipmentId())
if (const CreatureInfo *info = GetCreatureInfo(28406))
if (info->equipmentId)
const_cast<CreatureInfo*>(me->GetCreatureInfo())->equipmentId = info->equipmentId;
}
示例10: GetCreatureInfo
void Totem::Summon(Unit* owner)
{
CreatureInfo const *cinfo = GetCreatureInfo();
if (owner->GetTypeId()==TYPEID_PLAYER && cinfo)
{
uint32 modelid = 0;
if(((Player*)owner)->GetTeam() == HORDE)
{
if(cinfo->Modelid_H1)
modelid = cinfo->Modelid_H1;
else if(cinfo->Modelid_H2)
modelid = cinfo->Modelid_H2;
}
else
{
if(cinfo->Modelid_A1)
modelid = cinfo->Modelid_A1;
else if(cinfo->Modelid_A2)
modelid = cinfo->Modelid_A2;
}
if (modelid)
SetDisplayId(modelid);
else
sLog.outErrorDb("Totem::Summon: Missing modelid information for entry %u, team %u, totem will use default values.",GetEntry(),((Player*)owner)->GetTeam());
}
// Only add if a display exists.
sLog.outDebug("AddObject at Totem.cpp line 49");
SetInstanceId(owner->GetInstanceId());
owner->GetMap()->Add((Creature*)this);
WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, 8);
data << GetGUID();
SendMessageToSet(&data,true);
AIM_Initialize();
switch(m_type)
{
case TOTEM_PASSIVE: CastSpell(this, GetSpell(), true); break;
case TOTEM_STATUE: CastSpell(GetOwner(), GetSpell(), true); break;
default: break;
}
if(GetEntry() == SENTRY_TOTEM_ENTRY)
SetReactState(REACT_AGGRESSIVE);
}
示例11: GetCreatureInfo
void Totem::InitStats(uint32 duration)
{
Minion::InitStats(duration);
CreatureInfo const *cinfo = GetCreatureInfo();
if (m_owner->GetTypeId() == TYPEID_PLAYER && cinfo)
{
uint32 modelid = 0;
if (m_owner->ToPlayer()->GetTeam() == HORDE)
{
if (cinfo->Modelid_H1)
modelid = cinfo->Modelid_H1;
else if (cinfo->Modelid_H2)
modelid = cinfo->Modelid_H2;
}
else
{
if (cinfo->Modelid_A1)
modelid = cinfo->Modelid_A1;
else if (cinfo->Modelid_A2)
modelid = cinfo->Modelid_A2;
}
if (modelid)
SetDisplayId(modelid);
else
sLog.outErrorDb("Totem::Summon: Missing modelid information for entry %u, team %u, totem will use default values.",GetEntry(),m_owner->ToPlayer()->GetTeam());
}
// Get spell casted by totem
SpellEntry const * totemSpell = sSpellStore.LookupEntry(GetSpell());
if (totemSpell)
{
// If spell have cast time -> so its active totem
if (GetSpellCastTime(totemSpell))
m_type = TOTEM_ACTIVE;
}
if (GetEntry() == SENTRY_TOTEM_ENTRY)
SetReactState(REACT_AGGRESSIVE);
m_duration = duration;
SetLevel(m_owner->getLevel());
}
示例12: SetInstanceId
void Totem::Summon(Unit* owner)
{
sLog.outDebug("AddObject at Totem.cpp line 49");
SetInstanceId(owner->GetInstanceId());
owner->GetMap()->Add((Creature*)this);
// select totem model in dependent from owner team [-ZERO] not implemented/useful
CreatureInfo const *cinfo = GetCreatureInfo();
if(owner->GetTypeId() == TYPEID_PLAYER && cinfo)
{
uint32 display_id = sObjectMgr.ChooseDisplayId(((Player*)owner)->GetTeam(), cinfo);
CreatureModelInfo const *minfo = sObjectMgr.GetCreatureModelRandomGender(display_id);
if (minfo)
display_id = minfo->modelid;
SetDisplayId(display_id);
}
WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, 8);
data << GetGUID();
SendMessageToSet(&data,true);
AIM_Initialize();
if (owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->AI())
((Creature*)owner)->AI()->JustSummoned((Creature*)this);
// there are some totems, which exist just for their visual appeareance
if (!GetSpell())
return;
switch(m_type)
{
case TOTEM_PASSIVE:
CastSpell(this, GetSpell(), true);
break;
case TOTEM_STATUE:
CastSpell(GetOwner(), GetSpell(), true);
break;
default: break;
}
}
示例13: GetModifierValue
void Creature::UpdateDamagePhysical(WeaponAttackType attType)
{
if(attType > BASE_ATTACK)
return;
UnitMods unitMod = UNIT_MOD_DAMAGE_MAINHAND;
float base_value = GetModifierValue(unitMod, BASE_VALUE) + GetTotalAttackPowerValue(attType);
float base_pct = GetModifierValue(unitMod, BASE_PCT);
float total_value = GetModifierValue(unitMod, TOTAL_VALUE);
float total_pct = GetModifierValue(unitMod, TOTAL_PCT);
float dmg_multiplier = GetCreatureInfo()->dmg_multiplier;
float weapon_mindamage = GetWeaponDamageRange(BASE_ATTACK, MINDAMAGE);
float weapon_maxdamage = GetWeaponDamageRange(BASE_ATTACK, MAXDAMAGE);
float mindamage = ((base_value + weapon_mindamage) * base_pct + total_value) * total_pct * dmg_multiplier;
float maxdamage = ((base_value + weapon_maxdamage) * base_pct + total_value) * total_pct * dmg_multiplier;
SetStatFloatValue(UNIT_FIELD_MINDAMAGE, mindamage);
SetStatFloatValue(UNIT_FIELD_MAXDAMAGE, maxdamage);
}
示例14: RemoveSpellsCausingAura
void Vehicle::RemovePassenger(Unit *unit)
{
SeatMap::iterator seat;
for(seat = m_Seats.begin(); seat != m_Seats.end(); ++seat)
{
if((seat->second.flags & (SEAT_FULL | SEAT_VEHICLE_FREE | SEAT_VEHICLE_FULL)) && seat->second.passenger == unit)
{
unit->SetVehicleGUID(0);
if(seat->second.vs_flags & SF_MAIN_RIDER)
{
RemoveSpellsCausingAura(SPELL_AURA_CONTROL_VEHICLE);
if(unit->GetTypeId() == TYPEID_PLAYER)
{
((Player*)unit)->SetMover(unit);
((Player*)unit)->SetClientControl(unit, 1);
((Player*)unit)->SetMoverInQueve(NULL);
((Player*)unit)->RemovePetActionBar();
if(((Player*)unit)->GetGroup())
((Player*)unit)->SetGroupUpdateFlag(GROUP_UPDATE_VEHICLE);
}
unit->SetCharm(NULL);
SetCharmerGUID(NULL);
setFaction(GetCreatureInfo()->faction_A);
}
if(GetVehicleFlags() & VF_NON_SELECTABLE)
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
if(GetVehicleFlags() & VF_CAST_AURA && m_VehicleData && m_VehicleData->v_spells[0] != 0)
unit->RemoveAurasDueToSpell(m_VehicleData->v_spells[0]);
if(seat->second.vs_flags & SF_UNATTACKABLE)
unit->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
// restore player control
if(unit->GetTypeId() == TYPEID_PLAYER)
{
((Player*)unit)->SetFarSightGUID(NULL);
if(seat->second.vs_flags & SF_CAN_CAST)
{
WorldPacket data0(SMSG_FORCE_MOVE_UNROOT, 10);
data0 << unit->GetPackGUID();
data0 << (uint32)(2); // can rotate
unit->SendMessageToSet(&data0,true);
}
else
{
WorldPacket data1(SMSG_FORCE_MOVE_UNROOT, 10);
data1 << unit->GetPackGUID();
data1 << (uint32)(0); // cannot rotate
unit->SendMessageToSet(&data1,true);
}
}
unit->m_SeatData.OffsetX = 0.0f;
unit->m_SeatData.OffsetY = 0.0f;
unit->m_SeatData.OffsetZ = 0.0f;
unit->m_SeatData.Orientation = 0.0f;
unit->m_SeatData.c_time = 0;
unit->m_SeatData.dbc_seat = 0;
unit->m_SeatData.seat = 0;
unit->m_SeatData.s_flags = 0;
unit->m_SeatData.v_flags = 0;
seat->second.passenger = NULL;
seat->second.flags = SEAT_FREE;
EmptySeatsCountChanged();
break;
}
}
}
示例15: ON
bool Creature::LoadFromDB(uint32 guid, QueryResult *result, uint32 InstanceId)
{
bool external = (result != NULL);
if (!external)
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
result = sDatabase.PQuery("SELECT `id`,`map`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`spawn_position_x`,`spawn_position_y`,`spawn_position_z`,`curhealth`,`curmana`,`respawntime`,`DeathState`,`MovementType`,`auras` "
"FROM `creature` LEFT JOIN `creature_respawn` ON ((`creature`.`guid`=`creature_respawn`.`guid`) AND (`creature_respawn`.`instance` = '%u')) WHERE `creature`.`guid` = '%u'", InstanceId, guid);
if(!result)
{
sLog.outErrorDb("Creature (GUID: %u) not found in table `creature`, can't load. ",guid);
return false;
}
Field *fields = result->Fetch();
uint32 stored_guid = guid;
if (InstanceId != 0) guid = objmgr.GenerateLowGuid(HIGHGUID_UNIT);
SetInstanceId(InstanceId);
if(!Create(guid,fields[1].GetUInt32(),fields[2].GetFloat(),fields[3].GetFloat(),
fields[4].GetFloat(),fields[5].GetFloat(),fields[0].GetUInt32()))
{
if (!external) delete result;
return false;
}
m_DBTableGuid = stored_guid;
if(GetCreatureInfo()->rank > 0)
this->m_corpseDelay *= 3; //if creature is elite, then remove corpse later
SetHealth(fields[11].GetUInt32());
SetPower(POWER_MANA,fields[12].GetUInt32());
m_respawnradius = fields[7].GetFloat();
respawn_cord[0] = fields[8].GetFloat();
respawn_cord[1] = fields[9].GetFloat();
respawn_cord[2] = fields[10].GetFloat();
m_respawnDelay = fields[6].GetUInt32();
m_deathState = (DeathState)fields[14].GetUInt32();
if(m_deathState == JUST_DIED) // Dont must be set to JUST_DEAD, see Creature::setDeathState JUST_DIED -> CORPSE promoting.
{
sLog.outErrorDb("Creature (GUIDLow: %u Entry: %u ) in wrong state: JUST_DEAD (1). State set to ALIVE.",GetGUIDLow(),GetEntry());
m_deathState = ALIVE;
}
else
if(m_deathState < ALIVE || m_deathState > DEAD)
{
sLog.outErrorDb("Creature (GUIDLow: %u Entry: %u ) in wrong state: %d. State set to ALIVE.",GetGUIDLow(),GetEntry(),m_deathState);
m_deathState = ALIVE;
}
m_respawnTime = (time_t)fields[13].GetUInt64();
if(m_respawnTime > time(NULL)) // not ready to respawn
m_deathState = DEAD;
else // ready to respawn
{
m_respawnTime = 0;
sDatabase.PExecute("DELETE FROM `creature_respawn` WHERE `guid` = '%u' AND `instance` = '%u'", m_DBTableGuid, GetInstanceId());
}
{
uint32 mtg = fields[15].GetUInt32();
if(mtg < MAX_DB_MOTION_TYPE)
m_defaultMovementType = MovementGeneratorType(mtg);
else
{
m_defaultMovementType = IDLE_MOTION_TYPE;
sLog.outErrorDb("Creature (GUID: %u ID: %u) have wrong movement generator type value %u, ignore and set to IDLE.",guid,GetEntry(),mtg);
}
}
if(!external) delete result;
LoadFlagRelatedData();
AIM_Initialize();
return true;
}