mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[7948] Use SetFaction instead explcit field set, other cleanups.
Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
de2338c9a4
commit
be6e3923d1
7 changed files with 23 additions and 23 deletions
|
|
@ -266,9 +266,9 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data )
|
||||||
|
|
||||||
SelectLevel(GetCreatureInfo());
|
SelectLevel(GetCreatureInfo());
|
||||||
if (team == HORDE)
|
if (team == HORDE)
|
||||||
SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, GetCreatureInfo()->faction_H);
|
setFaction(GetCreatureInfo()->faction_H);
|
||||||
else
|
else
|
||||||
SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, GetCreatureInfo()->faction_A);
|
setFaction(GetCreatureInfo()->faction_A);
|
||||||
|
|
||||||
SetUInt32Value(UNIT_NPC_FLAGS,GetCreatureInfo()->npcflag);
|
SetUInt32Value(UNIT_NPC_FLAGS,GetCreatureInfo()->npcflag);
|
||||||
|
|
||||||
|
|
@ -1502,7 +1502,7 @@ void Creature::setDeathState(DeathState s)
|
||||||
if(s == JUST_DIED)
|
if(s == JUST_DIED)
|
||||||
{
|
{
|
||||||
SetUInt64Value(UNIT_FIELD_TARGET,0); // remove target selection in any cases (can be set at aura remove in Unit::setDeathState)
|
SetUInt64Value(UNIT_FIELD_TARGET,0); // remove target selection in any cases (can be set at aura remove in Unit::setDeathState)
|
||||||
SetUInt32Value(UNIT_NPC_FLAGS, 0);
|
SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
|
||||||
|
|
||||||
if(!isPet() && GetCreatureInfo()->SkinLootId)
|
if(!isPet() && GetCreatureInfo()->SkinLootId)
|
||||||
if ( LootTemplates_Skinning.HaveLootFor(GetCreatureInfo()->SkinLootId) )
|
if ( LootTemplates_Skinning.HaveLootFor(GetCreatureInfo()->SkinLootId) )
|
||||||
|
|
|
||||||
|
|
@ -1602,7 +1602,7 @@ bool ChatHandler::HandleModifyMountCommand(const char* args)
|
||||||
if (needReportToTarget(chr))
|
if (needReportToTarget(chr))
|
||||||
ChatHandler(chr).PSendSysMessage(LANG_MOUNT_GIVED, GetNameLink().c_str());
|
ChatHandler(chr).PSendSysMessage(LANG_MOUNT_GIVED, GetNameLink().c_str());
|
||||||
|
|
||||||
chr->SetUInt32Value( UNIT_FIELD_FLAGS , 0x001000 );
|
chr->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP);
|
||||||
chr->Mount(mId);
|
chr->Mount(mId);
|
||||||
|
|
||||||
WorldPacket data( SMSG_FORCE_RUN_SPEED_CHANGE, (8+4+1+4) );
|
WorldPacket data( SMSG_FORCE_RUN_SPEED_CHANGE, (8+4+1+4) );
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,7 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
|
||||||
}
|
}
|
||||||
|
|
||||||
setPetType(PetType(fields[18].GetUInt8()));
|
setPetType(PetType(fields[18].GetUInt8()));
|
||||||
SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, owner->getFaction());
|
setFaction(owner->getFaction());
|
||||||
SetUInt32Value(UNIT_CREATED_BY_SPELL, summon_spell_id);
|
SetUInt32Value(UNIT_CREATED_BY_SPELL, summon_spell_id);
|
||||||
|
|
||||||
CreatureInfo const *cinfo = GetCreatureInfo();
|
CreatureInfo const *cinfo = GetCreatureInfo();
|
||||||
|
|
@ -183,7 +183,7 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
|
||||||
SetDisplayId(fields[3].GetUInt32());
|
SetDisplayId(fields[3].GetUInt32());
|
||||||
SetNativeDisplayId(fields[3].GetUInt32());
|
SetNativeDisplayId(fields[3].GetUInt32());
|
||||||
uint32 petlevel = fields[4].GetUInt32();
|
uint32 petlevel = fields[4].GetUInt32();
|
||||||
SetUInt32Value(UNIT_NPC_FLAGS, 0);
|
SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
|
||||||
SetName(fields[8].GetString());
|
SetName(fields[8].GetString());
|
||||||
|
|
||||||
switch (getPetType())
|
switch (getPetType())
|
||||||
|
|
@ -769,7 +769,7 @@ bool Pet::CreateBaseAtCreature(Creature* creature)
|
||||||
SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, 0);
|
SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, 0);
|
||||||
SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0);
|
SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0);
|
||||||
SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, objmgr.GetXPForLevel(creature->getLevel())/4);
|
SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, objmgr.GetXPForLevel(creature->getLevel())/4);
|
||||||
SetUInt32Value(UNIT_NPC_FLAGS, 0);
|
SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
|
||||||
|
|
||||||
if(CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(cinfo->family))
|
if(CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(cinfo->family))
|
||||||
SetName(cFamily->Name[sWorld.GetDefaultDbcLocale()]);
|
SetName(cFamily->Name[sWorld.GetDefaultDbcLocale()]);
|
||||||
|
|
|
||||||
|
|
@ -3068,7 +3068,7 @@ void Aura::HandleModPossess(bool apply, bool Real)
|
||||||
if( apply )
|
if( apply )
|
||||||
{
|
{
|
||||||
m_target->SetCharmerGUID(GetCasterGUID());
|
m_target->SetCharmerGUID(GetCasterGUID());
|
||||||
m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, caster->getFaction());
|
m_target->setFaction(caster->getFaction());
|
||||||
|
|
||||||
caster->SetCharm(m_target);
|
caster->SetCharm(m_target);
|
||||||
|
|
||||||
|
|
@ -3110,7 +3110,7 @@ void Aura::HandleModPossess(bool apply, bool Real)
|
||||||
else if(m_target->GetTypeId() == TYPEID_UNIT)
|
else if(m_target->GetTypeId() == TYPEID_UNIT)
|
||||||
{
|
{
|
||||||
CreatureInfo const *cinfo = ((Creature*)m_target)->GetCreatureInfo();
|
CreatureInfo const *cinfo = ((Creature*)m_target)->GetCreatureInfo();
|
||||||
m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, cinfo->faction_A);
|
m_target->setFaction(cinfo->faction_A);
|
||||||
}
|
}
|
||||||
|
|
||||||
caster->SetCharm(NULL);
|
caster->SetCharm(NULL);
|
||||||
|
|
@ -3200,7 +3200,7 @@ void Aura::HandleModCharm(bool apply, bool Real)
|
||||||
if( apply )
|
if( apply )
|
||||||
{
|
{
|
||||||
m_target->SetCharmerGUID(GetCasterGUID());
|
m_target->SetCharmerGUID(GetCasterGUID());
|
||||||
m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, caster->getFaction());
|
m_target->setFaction(caster->getFaction());
|
||||||
m_target->CastStop(m_target == caster ? GetId() : 0);
|
m_target->CastStop(m_target == caster ? GetId() : 0);
|
||||||
caster->SetCharm(m_target);
|
caster->SetCharm(m_target);
|
||||||
|
|
||||||
|
|
@ -3249,12 +3249,12 @@ void Aura::HandleModCharm(bool apply, bool Real)
|
||||||
if(((Creature*)m_target)->isPet())
|
if(((Creature*)m_target)->isPet())
|
||||||
{
|
{
|
||||||
if(Unit* owner = m_target->GetOwner())
|
if(Unit* owner = m_target->GetOwner())
|
||||||
m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, owner->getFaction());
|
m_target->setFaction(owner->getFaction());
|
||||||
else if(cinfo)
|
else if(cinfo)
|
||||||
m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, cinfo->faction_A);
|
m_target->setFaction(cinfo->faction_A);
|
||||||
}
|
}
|
||||||
else if(cinfo) // normal creature
|
else if(cinfo) // normal creature
|
||||||
m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, cinfo->faction_A);
|
m_target->setFaction(cinfo->faction_A);
|
||||||
|
|
||||||
// restore UNIT_FIELD_BYTES_0
|
// restore UNIT_FIELD_BYTES_0
|
||||||
if(cinfo && caster->GetTypeId() == TYPEID_PLAYER && caster->getClass() == CLASS_WARLOCK && cinfo->type == CREATURE_TYPE_DEMON)
|
if(cinfo && caster->GetTypeId() == TYPEID_PLAYER && caster->getClass() == CLASS_WARLOCK && cinfo->type == CREATURE_TYPE_DEMON)
|
||||||
|
|
|
||||||
|
|
@ -3265,9 +3265,9 @@ void Spell::EffectSummon(uint32 i)
|
||||||
spawnCreature->SetDuration(duration);
|
spawnCreature->SetDuration(duration);
|
||||||
|
|
||||||
spawnCreature->SetOwnerGUID(m_caster->GetGUID());
|
spawnCreature->SetOwnerGUID(m_caster->GetGUID());
|
||||||
spawnCreature->SetUInt32Value(UNIT_NPC_FLAGS, 0);
|
spawnCreature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
|
||||||
spawnCreature->setPowerType(POWER_MANA);
|
spawnCreature->setPowerType(POWER_MANA);
|
||||||
spawnCreature->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, m_caster->getFaction());
|
spawnCreature->setFaction(m_caster->getFaction());
|
||||||
spawnCreature->SetUInt32Value(UNIT_FIELD_FLAGS, 0);
|
spawnCreature->SetUInt32Value(UNIT_FIELD_FLAGS, 0);
|
||||||
spawnCreature->SetUInt32Value(UNIT_FIELD_BYTES_0, 2048);
|
spawnCreature->SetUInt32Value(UNIT_FIELD_BYTES_0, 2048);
|
||||||
spawnCreature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
|
spawnCreature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
|
||||||
|
|
@ -3699,8 +3699,8 @@ void Spell::EffectSummonGuardian(uint32 i)
|
||||||
|
|
||||||
spawnCreature->SetOwnerGUID(m_caster->GetGUID());
|
spawnCreature->SetOwnerGUID(m_caster->GetGUID());
|
||||||
spawnCreature->setPowerType(POWER_MANA);
|
spawnCreature->setPowerType(POWER_MANA);
|
||||||
spawnCreature->SetUInt32Value(UNIT_NPC_FLAGS, 0);
|
spawnCreature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
|
||||||
spawnCreature->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, m_caster->getFaction());
|
spawnCreature->setFaction(m_caster->getFaction());
|
||||||
spawnCreature->SetUInt32Value(UNIT_FIELD_FLAGS, 0);
|
spawnCreature->SetUInt32Value(UNIT_FIELD_FLAGS, 0);
|
||||||
spawnCreature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
|
spawnCreature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
|
||||||
spawnCreature->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, 0);
|
spawnCreature->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, 0);
|
||||||
|
|
@ -4181,8 +4181,8 @@ void Spell::EffectSummonPet(uint32 i)
|
||||||
|
|
||||||
NewSummon->SetOwnerGUID(m_caster->GetGUID());
|
NewSummon->SetOwnerGUID(m_caster->GetGUID());
|
||||||
NewSummon->SetCreatorGUID(m_caster->GetGUID());
|
NewSummon->SetCreatorGUID(m_caster->GetGUID());
|
||||||
NewSummon->SetUInt32Value(UNIT_NPC_FLAGS, 0);
|
NewSummon->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
|
||||||
NewSummon->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, faction);
|
NewSummon->setFaction(faction);
|
||||||
NewSummon->SetUInt32Value(UNIT_FIELD_BYTES_0, 2048);
|
NewSummon->SetUInt32Value(UNIT_FIELD_BYTES_0, 2048);
|
||||||
NewSummon->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
|
NewSummon->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
|
||||||
NewSummon->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, time(NULL));
|
NewSummon->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, time(NULL));
|
||||||
|
|
@ -5980,7 +5980,7 @@ void Spell::EffectSummonCritter(uint32 i)
|
||||||
|
|
||||||
critter->SetOwnerGUID(m_caster->GetGUID());
|
critter->SetOwnerGUID(m_caster->GetGUID());
|
||||||
critter->SetCreatorGUID(m_caster->GetGUID());
|
critter->SetCreatorGUID(m_caster->GetGUID());
|
||||||
critter->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,m_caster->getFaction());
|
critter->setFaction(m_caster->getFaction());
|
||||||
critter->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
|
critter->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
|
||||||
|
|
||||||
critter->AIM_Initialize();
|
critter->AIM_Initialize();
|
||||||
|
|
|
||||||
|
|
@ -11453,7 +11453,7 @@ Pet* Unit::CreateTamedPetFrom(Creature* creatureTarget,uint32 spell_id)
|
||||||
|
|
||||||
pet->SetOwnerGUID(GetGUID());
|
pet->SetOwnerGUID(GetGUID());
|
||||||
pet->SetCreatorGUID(GetGUID());
|
pet->SetCreatorGUID(GetGUID());
|
||||||
pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, getFaction());
|
pet->setFaction(getFaction());
|
||||||
pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, spell_id);
|
pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, spell_id);
|
||||||
|
|
||||||
if(GetTypeId()==TYPEID_PLAYER)
|
if(GetTypeId()==TYPEID_PLAYER)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "7947"
|
#define REVISION_NR "7948"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue