converted all tabs to 4 spaces

This commit is contained in:
Yehonal
2016-06-26 19:23:57 +02:00
parent 52f305111c
commit f6eefedcd5
717 changed files with 132388 additions and 132388 deletions

View File

@@ -111,29 +111,29 @@ uint32 CreatureTemplate::GetFirstValidModelId() const
void CreatureTemplate::InitializeQueryData()
{
queryData.Initialize(SMSG_CREATURE_QUERY_RESPONSE, 1);
queryData.Initialize(SMSG_CREATURE_QUERY_RESPONSE, 1);
queryData << uint32(Entry); // creature entry
queryData << Name;
queryData << uint8(0) << uint8(0) << uint8(0); // name2, name3, name4, always empty
queryData << SubName;
queryData << IconName; // "Directions" for guard, string for Icons 2.3.0
queryData << uint32(type_flags); // flags
queryData << uint32(type); // CreatureType.dbc
queryData << uint32(family); // CreatureFamily.dbc
queryData << uint32(rank); // Creature Rank (elite, boss, etc)
queryData << uint32(KillCredit[0]); // new in 3.1, kill credit
queryData << uint32(KillCredit[1]); // new in 3.1, kill credit
queryData << uint32(Modelid1); // Modelid1
queryData << uint32(Modelid2); // Modelid2
queryData << uint32(Modelid3); // Modelid3
queryData << uint32(Modelid4); // Modelid4
queryData << float(ModHealth); // dmg/hp modifier
queryData << float(ModMana); // dmg/mana modifier
queryData << uint8(RacialLeader);
for (uint32 i = 0; i < MAX_CREATURE_QUEST_ITEMS; ++i)
queryData << uint32(questItems[i]); // itemId[6], quest drop
queryData << uint32(movementId); // CreatureMovementInfo.dbc
queryData << uint32(Entry); // creature entry
queryData << Name;
queryData << uint8(0) << uint8(0) << uint8(0); // name2, name3, name4, always empty
queryData << SubName;
queryData << IconName; // "Directions" for guard, string for Icons 2.3.0
queryData << uint32(type_flags); // flags
queryData << uint32(type); // CreatureType.dbc
queryData << uint32(family); // CreatureFamily.dbc
queryData << uint32(rank); // Creature Rank (elite, boss, etc)
queryData << uint32(KillCredit[0]); // new in 3.1, kill credit
queryData << uint32(KillCredit[1]); // new in 3.1, kill credit
queryData << uint32(Modelid1); // Modelid1
queryData << uint32(Modelid2); // Modelid2
queryData << uint32(Modelid3); // Modelid3
queryData << uint32(Modelid4); // Modelid4
queryData << float(ModHealth); // dmg/hp modifier
queryData << float(ModMana); // dmg/mana modifier
queryData << uint8(RacialLeader);
for (uint32 i = 0; i < MAX_CREATURE_QUEST_ITEMS; ++i)
queryData << uint32(questItems[i]); // itemId[6], quest drop
queryData << uint32(movementId); // CreatureMovementInfo.dbc
}
bool AssistDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
@@ -182,8 +182,8 @@ m_originalEntry(0), m_homePosition(), m_transportHomePosition(), m_creatureInfo(
for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i)
m_spells[i] = 0;
for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
m_ProhibitSchoolTime[i] = 0;
for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
m_ProhibitSchoolTime[i] = 0;
m_CreatureSpellCooldowns.clear();
DisableReputationGain = false;
@@ -213,9 +213,9 @@ void Creature::AddToWorld()
///- Register the creature for guid lookup
if (!IsInWorld())
{
// pussywizard: motion master needs to be initialized before OnCreatureCreate, which may set death state to JUST_DIED, to prevent crash
// it's also initialized in AIM_Initialize(), few lines below, but it's not a problem
Motion_Initialize();
// pussywizard: motion master needs to be initialized before OnCreatureCreate, which may set death state to JUST_DIED, to prevent crash
// it's also initialized in AIM_Initialize(), few lines below, but it's not a problem
Motion_Initialize();
if (GetZoneScript())
GetZoneScript()->OnCreatureCreate(this);
@@ -237,8 +237,8 @@ void Creature::RemoveFromWorld()
GetZoneScript()->OnCreatureRemove(this);
if (m_formation)
sFormationMgr->RemoveCreatureFromGroup(m_formation, this);
if (Transport* transport = GetTransport())
transport->RemovePassenger(this, true);
if (Transport* transport = GetTransport())
transport->RemovePassenger(this, true);
Unit::RemoveFromWorld();
sObjectAccessor->RemoveObject(this);
}
@@ -285,22 +285,22 @@ void Creature::RemoveCorpse(bool setSpawnTime, bool skipVisibility)
// Should get removed later, just keep "compatibility" with scripts
if (setSpawnTime)
{
{
m_respawnTime = time(NULL) + respawnDelay;
//SaveRespawnTime();
}
//SaveRespawnTime();
}
float x, y, z, o;
GetRespawnPosition(x, y, z, &o);
SetHomePosition(x, y, z, o);
SetPosition(x, y, z, o);
// xinef: relocate notifier
m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f);
// xinef: relocate notifier
m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f);
// pussywizard: if corpse was removed during falling then the falling will continue after respawn, so stop falling is such case
if (IsFalling())
StopMoving();
// pussywizard: if corpse was removed during falling then the falling will continue after respawn, so stop falling is such case
if (IsFalling())
StopMoving();
}
/**
@@ -316,7 +316,7 @@ bool Creature::InitEntry(uint32 Entry, const CreatureData* data)
}
// get difficulty 1 mode entry
// Xinef: Skip for pets!
// Xinef: Skip for pets!
CreatureTemplate const* cinfo = normalInfo;
for (uint8 diff = uint8(GetMap()->GetSpawnMode()); diff > 0 && !IsPet();)
{
@@ -423,10 +423,10 @@ bool Creature::UpdateEntry(uint32 Entry, const CreatureData* data, bool changele
else
SetUInt32Value(UNIT_NPC_FLAGS, npcflag);
// Xinef: NPC is in combat, keep this flag!
unit_flags &= ~UNIT_FLAG_IN_COMBAT;
if (IsInCombat())
unit_flags |= UNIT_FLAG_IN_COMBAT;
// Xinef: NPC is in combat, keep this flag!
unit_flags &= ~UNIT_FLAG_IN_COMBAT;
if (IsInCombat())
unit_flags |= UNIT_FLAG_IN_COMBAT;
SetUInt32Value(UNIT_FIELD_FLAGS, unit_flags);
SetUInt32Value(UNIT_FIELD_FLAGS_2, cInfo->unit_flags2);
@@ -576,8 +576,8 @@ void Creature::Update(uint32 diff)
NeedChangeAI = false;
IsAIEnabled = true;
// xinef: update combat state, if npc is not in combat - return to spawn correctly by calling EnterEvadeMode
SelectVictim();
// xinef: update combat state, if npc is not in combat - return to spawn correctly by calling EnterEvadeMode
SelectVictim();
}
if (!IsInEvadeMode() && IsAIEnabled)
@@ -612,31 +612,31 @@ void Creature::Update(uint32 diff)
break;
}
if (IsInWorld() && !IsDuringRemoveFromWorld())
{
// pussywizard:
if (IS_PLAYER_GUID(GetOwnerGUID()))
{
if (m_transportCheckTimer <= diff)
{
m_transportCheckTimer = 1000;
Transport* newTransport = GetMap()->GetTransportForPos(GetPhaseMask(), GetPositionX(), GetPositionY(), GetPositionZ(), this);
if (newTransport != GetTransport())
{
if (GetTransport())
GetTransport()->RemovePassenger(this, true);
if (newTransport)
newTransport->AddPassenger(this, true);
this->StopMovingOnCurrentPos();
//SendMovementFlagUpdate();
}
}
else
m_transportCheckTimer -= diff;
}
if (IsInWorld() && !IsDuringRemoveFromWorld())
{
// pussywizard:
if (IS_PLAYER_GUID(GetOwnerGUID()))
{
if (m_transportCheckTimer <= diff)
{
m_transportCheckTimer = 1000;
Transport* newTransport = GetMap()->GetTransportForPos(GetPhaseMask(), GetPositionX(), GetPositionY(), GetPositionZ(), this);
if (newTransport != GetTransport())
{
if (GetTransport())
GetTransport()->RemovePassenger(this, true);
if (newTransport)
newTransport->AddPassenger(this, true);
this->StopMovingOnCurrentPos();
//SendMovementFlagUpdate();
}
}
else
m_transportCheckTimer -= diff;
}
sScriptMgr->OnCreatureUpdate(this, diff);
}
sScriptMgr->OnCreatureUpdate(this, diff);
}
}
void Creature::Regenerate(Powers power)
@@ -644,9 +644,9 @@ void Creature::Regenerate(Powers power)
uint32 curValue = GetPower(power);
uint32 maxValue = GetMaxPower(power);
// Xinef: implement power regeneration flag
if (!HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER) && !IS_PLAYER_GUID(GetOwnerGUID()))
return;
// Xinef: implement power regeneration flag
if (!HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER) && !IS_PLAYER_GUID(GetOwnerGUID()))
return;
if (curValue >= maxValue)
return;
@@ -667,27 +667,27 @@ void Creature::Regenerate(Powers power)
addvalue = 20;
break;
}
case POWER_MANA:
{
// Combat and any controlled creature
if (IsInCombat() || GetCharmerOrOwnerGUID())
{
if (GetEntry() == NPC_IMP || GetEntry() == NPC_WATER_ELEMENTAL_TEMP || GetEntry() == NPC_WATER_ELEMENTAL_PERM)
{
addvalue = uint32((GetStat(STAT_SPIRIT) / (IsUnderLastManaUseEffect() ? 8.0f : 5.0f) + 17.0f));
}
else if (!IsUnderLastManaUseEffect())
{
float ManaIncreaseRate = sWorld->getRate(RATE_POWER_MANA);
float Spirit = GetStat(STAT_SPIRIT);
case POWER_MANA:
{
// Combat and any controlled creature
if (IsInCombat() || GetCharmerOrOwnerGUID())
{
if (GetEntry() == NPC_IMP || GetEntry() == NPC_WATER_ELEMENTAL_TEMP || GetEntry() == NPC_WATER_ELEMENTAL_PERM)
{
addvalue = uint32((GetStat(STAT_SPIRIT) / (IsUnderLastManaUseEffect() ? 8.0f : 5.0f) + 17.0f));
}
else if (!IsUnderLastManaUseEffect())
{
float ManaIncreaseRate = sWorld->getRate(RATE_POWER_MANA);
float Spirit = GetStat(STAT_SPIRIT);
addvalue = uint32((Spirit / 5.0f + 17.0f) * ManaIncreaseRate);
}
}
else
addvalue = maxValue / 3;
break;
}
addvalue = uint32((Spirit / 5.0f + 17.0f) * ManaIncreaseRate);
}
}
else
addvalue = maxValue / 3;
break;
}
default:
return;
}
@@ -717,8 +717,8 @@ void Creature::RegenerateHealth()
uint32 addvalue = 0;
// Not only pet, but any controlled creature
// Xinef: fix polymorph rapid regen
if (!GetCharmerOrOwnerGUID() || IsPolymorphed())
// Xinef: fix polymorph rapid regen
if (!GetCharmerOrOwnerGUID() || IsPolymorphed())
addvalue = maxValue/3;
else //if (GetCharmerOrOwnerGUID())
{
@@ -788,7 +788,7 @@ bool Creature::AIM_Initialize(CreatureAI* ai)
UnitAI* oldAI = i_AI;
// Xinef: called in add to world
// Xinef: called in add to world
//Motion_Initialize();
i_AI = ai ? ai : FactorySelector::selectAI(this);
@@ -856,11 +856,11 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry,
m_corpseDelay = sWorld->getIntConfig(CONFIG_CORPSE_DECAY_RAREELITE);
break;
case CREATURE_ELITE_WORLDBOSS:
// Xinef: Reduce corpse delay for bossess outside of instance
if (!GetInstanceId())
m_corpseDelay = sWorld->getIntConfig(CONFIG_CORPSE_DECAY_ELITE)*2;
else
m_corpseDelay = sWorld->getIntConfig(CONFIG_CORPSE_DECAY_WORLDBOSS);
// Xinef: Reduce corpse delay for bossess outside of instance
if (!GetInstanceId())
m_corpseDelay = sWorld->getIntConfig(CONFIG_CORPSE_DECAY_ELITE)*2;
else
m_corpseDelay = sWorld->getIntConfig(CONFIG_CORPSE_DECAY_WORLDBOSS);
break;
default:
m_corpseDelay = sWorld->getIntConfig(CONFIG_CORPSE_DECAY_NORMAL);
@@ -886,8 +886,8 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry,
m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_GHOST);
m_serverSideVisibilityDetect.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_GHOST);
}
else if (cinfo->type_flags & CREATURE_TYPEFLAGS_GHOST) // Xinef: Add ghost visibility for ghost units
m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE | GHOST_VISIBILITY_GHOST);
else if (cinfo->type_flags & CREATURE_TYPEFLAGS_GHOST) // Xinef: Add ghost visibility for ghost units
m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE | GHOST_VISIBILITY_GHOST);
if (Entry == VISUAL_WAYPOINT)
SetVisible(false);
@@ -974,13 +974,13 @@ void Creature::SetLootRecipient(Unit* unit, bool withGroup)
m_lootRecipient = player->GetGUID();
if (withGroup)
{
if (Group* group = player->GetGroup())
m_lootRecipientGroup = group->GetLowGUID();
}
else
m_lootRecipientGroup = 0;
if (withGroup)
{
if (Group* group = player->GetGroup())
m_lootRecipientGroup = group->GetLowGUID();
}
else
m_lootRecipientGroup = 0;
SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TAPPED);
}
@@ -1153,7 +1153,7 @@ void Creature::SelectLevel(bool changelevel)
// damage
// pussywizard: disabled until it's fixed
// pussywizard: disabled until it's fixed
/*float basedamage = stats->GenerateBaseDamage(cInfo);
float weaponBaseMinDamage = basedamage;
@@ -1174,14 +1174,14 @@ void Creature::SelectLevel(bool changelevel)
SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, cInfo->mindmg);
SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, cInfo->maxdmg);
SetBaseWeaponDamage(OFF_ATTACK, MINDAMAGE, cInfo->mindmg);
SetBaseWeaponDamage(OFF_ATTACK, MINDAMAGE, cInfo->mindmg);
SetBaseWeaponDamage(OFF_ATTACK, MAXDAMAGE, cInfo->maxdmg);
SetBaseWeaponDamage(RANGED_ATTACK, MINDAMAGE, cInfo->minrangedmg);
SetBaseWeaponDamage(RANGED_ATTACK, MAXDAMAGE, cInfo->maxrangedmg);
SetBaseWeaponDamage(RANGED_ATTACK, MINDAMAGE, cInfo->minrangedmg);
SetBaseWeaponDamage(RANGED_ATTACK, MAXDAMAGE, cInfo->maxrangedmg);
SetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE, cInfo->attackpower);
SetModifierValue(UNIT_MOD_ATTACK_POWER_RANGED, BASE_VALUE, cInfo->rangedattackpower);
SetModifierValue(UNIT_MOD_ATTACK_POWER_RANGED, BASE_VALUE, cInfo->rangedattackpower);
}
float Creature::_GetHealthMod(int32 Rank)
@@ -1262,34 +1262,34 @@ bool Creature::CreateFromProto(uint32 guidlow, uint32 Entry, uint32 vehId, const
Object::_Create(guidlow, Entry, (vehId || normalInfo->VehicleId) ? HIGHGUID_VEHICLE : HIGHGUID_UNIT);
// Xinef: select proper vehicle id
if (!vehId)
{
CreatureTemplate const* cinfo = normalInfo;
for (uint8 diff = uint8(GetMap()->GetSpawnMode()); diff > 0 && !IsPet();)
{
// we already have valid Map pointer for current creature!
if (cinfo->DifficultyEntry[diff - 1])
{
cinfo = sObjectMgr->GetCreatureTemplate(normalInfo->DifficultyEntry[diff - 1]);
if (cinfo && cinfo->VehicleId)
break; // template found
// Xinef: select proper vehicle id
if (!vehId)
{
CreatureTemplate const* cinfo = normalInfo;
for (uint8 diff = uint8(GetMap()->GetSpawnMode()); diff > 0 && !IsPet();)
{
// we already have valid Map pointer for current creature!
if (cinfo->DifficultyEntry[diff - 1])
{
cinfo = sObjectMgr->GetCreatureTemplate(normalInfo->DifficultyEntry[diff - 1]);
if (cinfo && cinfo->VehicleId)
break; // template found
// check and reported at startup, so just ignore (restore normalInfo)
cinfo = normalInfo;
}
// check and reported at startup, so just ignore (restore normalInfo)
cinfo = normalInfo;
}
// for instances heroic to normal, other cases attempt to retrieve previous difficulty
if (diff >= RAID_DIFFICULTY_10MAN_HEROIC && GetMap()->IsRaid())
diff -= 2; // to normal raid difficulty cases
else
--diff;
}
// for instances heroic to normal, other cases attempt to retrieve previous difficulty
if (diff >= RAID_DIFFICULTY_10MAN_HEROIC && GetMap()->IsRaid())
diff -= 2; // to normal raid difficulty cases
else
--diff;
}
if (cinfo->VehicleId)
CreateVehicleKit(cinfo->VehicleId, (cinfo->VehicleId != normalInfo->VehicleId ? cinfo->Entry : normalInfo->Entry));
}
else
if (cinfo->VehicleId)
CreateVehicleKit(cinfo->VehicleId, (cinfo->VehicleId != normalInfo->VehicleId ? cinfo->Entry : normalInfo->Entry));
}
else
CreateVehicleKit(vehId, Entry);
@@ -1309,17 +1309,17 @@ bool Creature::LoadCreatureFromDB(uint32 guid, Map* map, bool addToMap, bool gri
return false;
}
// xinef: fix shitness from db
if ((addToMap || gridLoad) && !data->overwrittenZ)
{
float tz = map->GetHeight(data->posX, data->posY, data->posZ+1.0f, true);
if (tz >= data->posZ && tz - data->posZ <= 1.0f)
const_cast<CreatureData*>(data)->posZ = tz+0.1f;
// xinef: fix shitness from db
if ((addToMap || gridLoad) && !data->overwrittenZ)
{
float tz = map->GetHeight(data->posX, data->posY, data->posZ+1.0f, true);
if (tz >= data->posZ && tz - data->posZ <= 1.0f)
const_cast<CreatureData*>(data)->posZ = tz+0.1f;
const_cast<CreatureData*>(data)->overwrittenZ = true;
}
const_cast<CreatureData*>(data)->overwrittenZ = true;
}
// xinef: this has to be assigned before Create function, properly loads equipment id from DB
// xinef: this has to be assigned before Create function, properly loads equipment id from DB
m_creatureData = data;
m_DBTableGuid = guid;
@@ -1577,12 +1577,12 @@ void Creature::setDeathState(DeathState s, bool despawn)
SetLootRecipient(NULL);
ResetPlayerDamageReq();
CreatureTemplate const* cinfo = GetCreatureTemplate();
// Xinef: npc run by default
// Xinef: npc run by default
//SetWalk(true);
// pussywizard:
if (HasUnitMovementFlag(MOVEMENTFLAG_FALLING))
RemoveUnitMovementFlag(MOVEMENTFLAG_FALLING);
// pussywizard:
if (HasUnitMovementFlag(MOVEMENTFLAG_FALLING))
RemoveUnitMovementFlag(MOVEMENTFLAG_FALLING);
UpdateEnvironmentIfNeeded(3);
SetUInt32Value(UNIT_NPC_FLAGS, cinfo->npcflag);
@@ -1592,7 +1592,7 @@ void Creature::setDeathState(DeathState s, bool despawn)
Unit::setDeathState(ALIVE, despawn);
// Xinef: Load auras AFTER setting alive state
LoadCreaturesAddon(true);
LoadCreaturesAddon(true);
Motion_Initialize();
if (GetCreatureData() && GetPhaseMask() != GetCreatureData()->phaseMask)
SetPhaseMask(GetCreatureData()->phaseMask, false);
@@ -1620,7 +1620,7 @@ void Creature::Respawn(bool force)
;//sLog->outStaticDebug("Respawning creature %s (GuidLow: %u, Full GUID: " UI64FMTD " Entry: %u)", GetName().c_str(), GetGUIDLow(), GetGUID(), GetEntry());
m_respawnTime = 0;
ResetPickPocketLootTime();
ResetPickPocketLootTime();
if (m_originalEntry != GetEntry())
UpdateEntry(m_originalEntry);
@@ -1656,8 +1656,8 @@ void Creature::Respawn(bool force)
InitializeReactState();
}
// xinef: relocate notifier, fixes npc appearing in corpse position after forced respawn (instead of spawn)
m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f);
// xinef: relocate notifier, fixes npc appearing in corpse position after forced respawn (instead of spawn)
m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f);
UpdateObjectVisibility(false);
}
@@ -1674,7 +1674,7 @@ void Creature::ForcedDespawn(uint32 timeMSToDespawn)
if (IsAlive())
setDeathState(JUST_DIED, true);
// Xinef: set new respawn time, ignore corpse decay time...
// Xinef: set new respawn time, ignore corpse decay time...
RemoveCorpse(true);
}
@@ -1698,7 +1698,7 @@ void Creature::InitializeReactState()
bool Creature::HasMechanicTemplateImmunity(uint32 mask) const
{
return !IS_PLAYER_GUID(GetOwnerGUID()) && (GetCreatureTemplate()->MechanicImmuneMask & mask);
return !IS_PLAYER_GUID(GetOwnerGUID()) && (GetCreatureTemplate()->MechanicImmuneMask & mask);
}
bool Creature::IsImmunedToSpell(SpellInfo const* spellInfo)
@@ -1706,7 +1706,7 @@ bool Creature::IsImmunedToSpell(SpellInfo const* spellInfo)
if (!spellInfo)
return false;
// Xinef: this should exclude self casts...
// Xinef: this should exclude self casts...
// Spells that don't have effectMechanics.
if (spellInfo->Mechanic > MECHANIC_NONE && HasMechanicTemplateImmunity(1 << (spellInfo->Mechanic - 1)))
return true;
@@ -1728,7 +1728,7 @@ bool Creature::IsImmunedToSpell(SpellInfo const* spellInfo)
bool Creature::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const
{
// Xinef: this should exclude self casts...
// Xinef: this should exclude self casts...
if (spellInfo->Effects[index].Mechanic > MECHANIC_NONE && HasMechanicTemplateImmunity(1 << (spellInfo->Effects[index].Mechanic - 1)))
return true;
@@ -1868,8 +1868,8 @@ Unit* Creature::SelectNearestTargetInAttackDistance(float dist) const
Unit* target = NULL;
if (dist < ATTACK_DISTANCE)
dist = ATTACK_DISTANCE;
if (dist < ATTACK_DISTANCE)
dist = ATTACK_DISTANCE;
if (dist > MAX_SEARCHER_DISTANCE)
dist = MAX_SEARCHER_DISTANCE;
@@ -1966,13 +1966,13 @@ bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction /
if (!IsAlive())
return false;
// Xinef: we cannot assist in evade mode
if (IsInEvadeMode())
return false;
// Xinef: we cannot assist in evade mode
if (IsInEvadeMode())
return false;
// pussywizard: or if enemy is in evade mode
if (enemy->GetTypeId() == TYPEID_UNIT && enemy->ToCreature()->IsInEvadeMode())
return false;
// pussywizard: or if enemy is in evade mode
if (enemy->GetTypeId() == TYPEID_UNIT && enemy->ToCreature()->IsInEvadeMode())
return false;
// we don't need help from non-combatant ;)
if (IsCivilian())
@@ -2051,31 +2051,31 @@ bool Creature::_CanDetectFeignDeathOf(const Unit* target) const
void Creature::UpdateMoveInLineOfSightState()
{
// xinef: pets, guardians and units with scripts / smartAI should be skipped
if (IsPet() || HasUnitTypeMask(UNIT_MASK_MINION|UNIT_MASK_SUMMON|UNIT_MASK_GUARDIAN|UNIT_MASK_CONTROLABLE_GUARDIAN) ||
GetScriptId() || GetAIName() == "SmartAI")
{
m_moveInLineOfSightStrictlyDisabled = false;
m_moveInLineOfSightDisabled = false;
return;
}
// xinef: pets, guardians and units with scripts / smartAI should be skipped
if (IsPet() || HasUnitTypeMask(UNIT_MASK_MINION|UNIT_MASK_SUMMON|UNIT_MASK_GUARDIAN|UNIT_MASK_CONTROLABLE_GUARDIAN) ||
GetScriptId() || GetAIName() == "SmartAI")
{
m_moveInLineOfSightStrictlyDisabled = false;
m_moveInLineOfSightDisabled = false;
return;
}
if (IsTrigger() || IsCivilian() || GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET || IsCritter() || GetAIName() == "NullCreatureAI")
{
m_moveInLineOfSightDisabled = true;
m_moveInLineOfSightStrictlyDisabled = true;
return;
}
if (IsTrigger() || IsCivilian() || GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET || IsCritter() || GetAIName() == "NullCreatureAI")
{
m_moveInLineOfSightDisabled = true;
m_moveInLineOfSightStrictlyDisabled = true;
return;
}
bool nonHostile = true;
if (FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(getFaction()))
if (factionTemplate->hostileMask || factionTemplate->enemyFaction[0] || factionTemplate->enemyFaction[1] || factionTemplate->enemyFaction[2] || factionTemplate->enemyFaction[3])
nonHostile = false;
bool nonHostile = true;
if (FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(getFaction()))
if (factionTemplate->hostileMask || factionTemplate->enemyFaction[0] || factionTemplate->enemyFaction[1] || factionTemplate->enemyFaction[2] || factionTemplate->enemyFaction[3])
nonHostile = false;
if (nonHostile)
m_moveInLineOfSightDisabled = true;
else
m_moveInLineOfSightDisabled = false;
if (nonHostile)
m_moveInLineOfSightDisabled = true;
else
m_moveInLineOfSightDisabled = false;
}
void Creature::SaveRespawnTime()
@@ -2100,30 +2100,30 @@ bool Creature::CanCreatureAttack(Unit const* victim, bool skipDistCheck) const
if (IsAIEnabled && !AI()->CanAIAttack(victim))
return false;
// pussywizard: we cannot attack in evade mode
if (IsInEvadeMode())
return false;
// pussywizard: we cannot attack in evade mode
if (IsInEvadeMode())
return false;
// pussywizard: or if enemy is in evade mode
if (victim->GetTypeId() == TYPEID_UNIT && victim->ToCreature()->IsInEvadeMode())
return false;
// pussywizard: or if enemy is in evade mode
if (victim->GetTypeId() == TYPEID_UNIT && victim->ToCreature()->IsInEvadeMode())
return false;
if (!IS_PLAYER_GUID(GetCharmerOrOwnerGUID()))
{
if (GetMap()->IsDungeon())
return true;
{
if (GetMap()->IsDungeon())
return true;
// pussywizard: don't check distance to home position if recently damaged (allow kiting away from spawnpoint!)
// xinef: this should include taunt auras
if (!isWorldBoss() && (GetLastDamagedTime() > sWorld->GetGameTime() || HasAuraType(SPELL_AURA_MOD_TAUNT)))
return true;
}
// pussywizard: don't check distance to home position if recently damaged (allow kiting away from spawnpoint!)
// xinef: this should include taunt auras
if (!isWorldBoss() && (GetLastDamagedTime() > sWorld->GetGameTime() || HasAuraType(SPELL_AURA_MOD_TAUNT)))
return true;
}
if (skipDistCheck)
return true;
if (skipDistCheck)
return true;
// xinef: added size factor for huge npcs
float dist = std::min<float>(GetMap()->GetVisibilityRange() + GetObjectSize()*2, 150.0f);
// xinef: added size factor for huge npcs
float dist = std::min<float>(GetMap()->GetVisibilityRange() + GetObjectSize()*2, 150.0f);
if (Unit* unit = GetCharmerOrOwner())
return victim->IsWithinDist(unit, dist);
@@ -2279,23 +2279,23 @@ void Creature::SetInCombatWithZone()
void Creature::ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs)
{
for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
if (idSchoolMask & (1 << i))
m_ProhibitSchoolTime[i] = World::GetGameTimeMS() + unTimeMs;
for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
if (idSchoolMask & (1 << i))
m_ProhibitSchoolTime[i] = World::GetGameTimeMS() + unTimeMs;
}
bool Creature::IsSpellProhibited(SpellSchoolMask idSchoolMask) const
{
const CreatureTemplate* cinfo = GetCreatureTemplate();
if (!(cinfo && cinfo->flags_extra & CREATURE_FLAG_EXTRA_ALL_DIMINISH) && (isWorldBoss() || IsDungeonBoss()))
return false;
const CreatureTemplate* cinfo = GetCreatureTemplate();
if (!(cinfo && cinfo->flags_extra & CREATURE_FLAG_EXTRA_ALL_DIMINISH) && (isWorldBoss() || IsDungeonBoss()))
return false;
for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
if (idSchoolMask & (1 << i))
if (m_ProhibitSchoolTime[i] >= World::GetGameTimeMS())
return true;
for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
if (idSchoolMask & (1 << i))
if (m_ProhibitSchoolTime[i] >= World::GetGameTimeMS())
return true;
return false;
return false;
}
void Creature::_AddCreatureSpellCooldown(uint32 spell_id, uint32 end_time)
@@ -2309,45 +2309,45 @@ void Creature::AddSpellCooldown(uint32 spell_id, uint32 /*itemid*/, uint32 end_t
if (!spellInfo)
return;
// used in proc system, otherwise normal creature cooldown
if (end_time)
{
_AddCreatureSpellCooldown(spellInfo->Id, end_time);
return;
}
// used in proc system, otherwise normal creature cooldown
if (end_time)
{
_AddCreatureSpellCooldown(spellInfo->Id, end_time);
return;
}
uint32 spellcooldown = spellInfo->RecoveryTime;
uint32 categorycooldown = spellInfo->CategoryRecoveryTime;
uint32 categorycooldown = spellInfo->CategoryRecoveryTime;
if(Player* modOwner = GetSpellModOwner())
{
{
modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_COOLDOWN, spellcooldown);
modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_COOLDOWN, categorycooldown);
}
}
if (spellcooldown)
_AddCreatureSpellCooldown(spellInfo->Id, spellcooldown);
if (categorycooldown)
if (spellInfo->GetCategory())
{
SpellCategoryStore::const_iterator i_scstore = sSpellsByCategoryStore.find(spellInfo->GetCategory());
if (i_scstore != sSpellsByCategoryStore.end())
{
uint32 cattime = categorycooldown;
for (SpellCategorySet::const_iterator i_scset = i_scstore->second.begin(); i_scset != i_scstore->second.end(); ++i_scset)
if (GetSpellCooldown(*i_scset) < cattime)
_AddCreatureSpellCooldown(*i_scset, cattime);
}
}
if (categorycooldown)
if (spellInfo->GetCategory())
{
SpellCategoryStore::const_iterator i_scstore = sSpellsByCategoryStore.find(spellInfo->GetCategory());
if (i_scstore != sSpellsByCategoryStore.end())
{
uint32 cattime = categorycooldown;
for (SpellCategorySet::const_iterator i_scset = i_scstore->second.begin(); i_scset != i_scstore->second.end(); ++i_scset)
if (GetSpellCooldown(*i_scset) < cattime)
_AddCreatureSpellCooldown(*i_scset, cattime);
}
}
}
uint32 Creature::GetSpellCooldown(uint32 spell_id) const
{
CreatureSpellCooldowns::const_iterator itr = m_CreatureSpellCooldowns.find(spell_id);
if (itr == m_CreatureSpellCooldowns.end())
return 0;
return itr->second > World::GetGameTimeMS() ? itr->second - World::GetGameTimeMS() : 0;
return 0;
return itr->second > World::GetGameTimeMS() ? itr->second - World::GetGameTimeMS() : 0;
}
bool Creature::HasSpellCooldown(uint32 spell_id) const
@@ -2392,24 +2392,24 @@ void Creature::GetRespawnPosition(float &x, float &y, float &z, float* ori, floa
}
}
// xinef: changed this from current position to home position, fixes world summons with infinite duration
if (GetTransport())
{
x = GetPositionX();
y = GetPositionY();
z = GetPositionZ();
if (ori)
*ori = GetOrientation();
}
else
{
Position homePos = GetHomePosition();
x = homePos.GetPositionX();
y = homePos.GetPositionY();
z = homePos.GetPositionZ();
if (ori)
*ori = homePos.GetOrientation();
}
// xinef: changed this from current position to home position, fixes world summons with infinite duration
if (GetTransport())
{
x = GetPositionX();
y = GetPositionY();
z = GetPositionZ();
if (ori)
*ori = GetOrientation();
}
else
{
Position homePos = GetHomePosition();
x = homePos.GetPositionX();
y = homePos.GetPositionY();
z = homePos.GetPositionZ();
if (ori)
*ori = homePos.GetOrientation();
}
if (dist)
*dist = 0;
}
@@ -2601,9 +2601,9 @@ bool Creature::SetDisableGravity(bool disable, bool packetOnly/*=false*/)
if (!movespline->Initialized())
return true;
// pussywizard: artificial disable_gravity to hovering npcs, don't send!
if (!disable && GetHoverHeight() >= 2.0f)
return true;
// pussywizard: artificial disable_gravity to hovering npcs, don't send!
if (!disable && GetHoverHeight() >= 2.0f)
return true;
WorldPacket data(disable ? SMSG_SPLINE_MOVE_GRAVITY_DISABLE : SMSG_SPLINE_MOVE_GRAVITY_ENABLE, 9);
data.append(GetPackGUID());
@@ -2743,8 +2743,8 @@ void Creature::SetDisplayId(uint32 modelId)
if (CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelInfo(modelId))
{
SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, (IsPet() ? 1.0f : minfo->bounding_radius) * GetFloatValue(OBJECT_FIELD_SCALE_X));
SetFloatValue(UNIT_FIELD_COMBATREACH, (IsPet() ? DEFAULT_COMBAT_REACH : minfo->combat_reach) * GetFloatValue(OBJECT_FIELD_SCALE_X));
SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, (IsPet() ? 1.0f : minfo->bounding_radius) * GetFloatValue(OBJECT_FIELD_SCALE_X));
SetFloatValue(UNIT_FIELD_COMBATREACH, (IsPet() ? DEFAULT_COMBAT_REACH : minfo->combat_reach) * GetFloatValue(OBJECT_FIELD_SCALE_X));
}
}
@@ -2766,10 +2766,10 @@ void Creature::FocusTarget(Spell const* focusSpell, WorldObject const* target)
AddUnitState(UNIT_STATE_ROTATING);
// Set serverside orientation if needed (needs to be after attribute check)
if (this == target && (movespline->Finalized() || GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE))
SetFacingTo(GetOrientation());
else
SetInFront(target);
if (this == target && (movespline->Finalized() || GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE))
SetFacingTo(GetOrientation());
else
SetInFront(target);
}
void Creature::ReleaseFocus(Spell const* focusSpell)

View File

@@ -56,7 +56,7 @@ enum CreatureFlagsExtra
CREATURE_FLAG_EXTRA_ALL_DIMINISH = 0x00100000, // Creature is subject to all diminishing returns as player are
CREATURE_FLAG_EXTRA_KNOCKBACK_IMMUNE= 0x00200000, // pussywizard: set mostly for dungeon bosses and their summons
CREATURE_FLAG_EXTRA_AVOID_AOE = 0x00400000, // pussywizard: ignored by aoe attacks (for icc blood prince council npc - Dark Nucleus)
CREATURE_FLAG_EXTRA_NO_DODGE = 0x00800000, // xinef: target cannot dodge
CREATURE_FLAG_EXTRA_NO_DODGE = 0x00800000, // xinef: target cannot dodge
CREATURE_FLAG_EXTRA_DUNGEON_BOSS = 0x10000000, // creature is a dungeon boss (SET DYNAMICALLY, DO NOT ADD IN DB)
CREATURE_FLAG_EXTRA_IGNORE_PATHFINDING = 0x20000000 // creature ignore pathfinding
};
@@ -67,7 +67,7 @@ enum CreatureFlagsExtra
CREATURE_FLAG_EXTRA_NO_TAUNT | CREATURE_FLAG_EXTRA_WORLDEVENT | CREATURE_FLAG_EXTRA_NO_CRIT | \
CREATURE_FLAG_EXTRA_NO_SKILLGAIN | CREATURE_FLAG_EXTRA_TAUNT_DIMINISH | CREATURE_FLAG_EXTRA_ALL_DIMINISH | \
CREATURE_FLAG_EXTRA_GUARD | CREATURE_FLAG_EXTRA_KNOCKBACK_IMMUNE | CREATURE_FLAG_EXTRA_AVOID_AOE | \
CREATURE_FLAG_EXTRA_NO_DODGE | CREATURE_FLAG_EXTRA_IGNORE_PATHFINDING)
CREATURE_FLAG_EXTRA_NO_DODGE | CREATURE_FLAG_EXTRA_IGNORE_PATHFINDING)
#define MAX_AGGRO_RESET_TIME 10 // in seconds
@@ -280,7 +280,7 @@ struct CreatureData
uint32 unit_flags; // enum UnitFlags mask values
uint32 dynamicflags;
bool dbData;
bool overwrittenZ;
bool overwrittenZ;
};
struct CreatureModelInfo
@@ -475,7 +475,7 @@ class Creature : public Unit, public GridObject<Creature>, public MovableMapObje
bool CanCreatureAttack(Unit const* victim, bool skipDistCheck = false) const;
bool IsImmunedToSpell(SpellInfo const* spellInfo);
bool HasMechanicTemplateImmunity(uint32 mask) const;
bool HasMechanicTemplateImmunity(uint32 mask) const;
// redefine Unit::IsImmunedToSpell
bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const;
// redefine Unit::IsImmunedToSpellEffect
@@ -498,7 +498,7 @@ class Creature : public Unit, public GridObject<Creature>, public MovableMapObje
bool IsDungeonBoss() const;
bool IsImmuneToKnockback() const;
bool IsAvoidingAOE() const { return GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_AVOID_AOE; }
bool IsAvoidingAOE() const { return GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_AVOID_AOE; }
uint8 getLevelForTarget(WorldObject const* target) const; // overwrite Unit::getLevelForTarget for boss level support
@@ -526,11 +526,11 @@ class Creature : public Unit, public GridObject<Creature>, public MovableMapObje
void SetMeleeDamageSchool(SpellSchools school) { m_meleeDamageSchoolMask = SpellSchoolMask(1 << school); }
void _AddCreatureSpellCooldown(uint32 spell_id, uint32 end_time);
virtual void AddSpellCooldown(uint32 spell_id, uint32 /*itemid*/, uint32 end_time, bool needSendToClient = false, bool forceSendToSpectator = false);
virtual void AddSpellCooldown(uint32 spell_id, uint32 /*itemid*/, uint32 end_time, bool needSendToClient = false, bool forceSendToSpectator = false);
virtual bool HasSpellCooldown(uint32 spell_id) const;
uint32 GetSpellCooldown(uint32 spell_id) const;
void ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs);
bool IsSpellProhibited(SpellSchoolMask idSchoolMask) const;
uint32 GetSpellCooldown(uint32 spell_id) const;
void ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs);
bool IsSpellProhibited(SpellSchoolMask idSchoolMask) const;
bool HasSpell(uint32 spellID) const;
@@ -578,14 +578,14 @@ class Creature : public Unit, public GridObject<Creature>, public MovableMapObje
virtual void DeleteFromDB(); // overriden in Pet
Loot loot;
uint64 GetLootRecipientGUID() const { return m_lootRecipient; }
uint64 GetLootRecipientGUID() const { return m_lootRecipient; }
Player* GetLootRecipient() const;
Group* GetLootRecipientGroup() const;
bool hasLootRecipient() const { return m_lootRecipient || m_lootRecipientGroup; }
bool isTappedBy(Player const* player) const; // return true if the creature is tapped by the player or a member of his party.
bool CanGeneratePickPocketLoot() const { return lootPickPocketRestoreTime == 0 || lootPickPocketRestoreTime < time(NULL); }
void SetPickPocketLootTime() { lootPickPocketRestoreTime = time(NULL) + MINUTE + GetCorpseDelay() + GetRespawnTime(); }
void ResetPickPocketLootTime() { lootPickPocketRestoreTime = 0; }
bool CanGeneratePickPocketLoot() const { return lootPickPocketRestoreTime == 0 || lootPickPocketRestoreTime < time(NULL); }
void SetPickPocketLootTime() { lootPickPocketRestoreTime = time(NULL) + MINUTE + GetCorpseDelay() + GetRespawnTime(); }
void ResetPickPocketLootTime() { lootPickPocketRestoreTime = 0; }
void SetLootRecipient (Unit* unit, bool withGroup = true);
void AllLootRemovedFromCorpse();
@@ -602,7 +602,7 @@ class Creature : public Unit, public GridObject<Creature>, public MovableMapObje
uint32 m_spells[CREATURE_MAX_SPELLS];
CreatureSpellCooldowns m_CreatureSpellCooldowns;
uint32 m_ProhibitSchoolTime[7];
uint32 m_ProhibitSchoolTime[7];
bool CanStartAttack(Unit const* u) const;
float GetAggroRange(Unit const* target) const;
@@ -622,10 +622,10 @@ class Creature : public Unit, public GridObject<Creature>, public MovableMapObje
bool _IsTargetAcceptable(const Unit* target) const;
bool _CanDetectFeignDeathOf(const Unit* target) const; // pussywizard
// pussywizard: updated at faction change, disable move in line of sight if actual faction is not hostile to anyone
void UpdateMoveInLineOfSightState();
bool IsMoveInLineOfSightDisabled() { return m_moveInLineOfSightDisabled; }
bool IsMoveInLineOfSightStrictlyDisabled() { return m_moveInLineOfSightStrictlyDisabled; }
// pussywizard: updated at faction change, disable move in line of sight if actual faction is not hostile to anyone
void UpdateMoveInLineOfSightState();
bool IsMoveInLineOfSightDisabled() { return m_moveInLineOfSightDisabled; }
bool IsMoveInLineOfSightStrictlyDisabled() { return m_moveInLineOfSightStrictlyDisabled; }
MovementGeneratorType GetDefaultMovementType() const { return m_defaultMovementType; }
void SetDefaultMovementType(MovementGeneratorType mgt) { m_defaultMovementType = mgt; }
@@ -657,7 +657,7 @@ class Creature : public Unit, public GridObject<Creature>, public MovableMapObje
bool hasInvolvedQuest(uint32 quest_id) const;
bool isRegeneratingHealth() { return m_regenHealth; }
void SetRegeneratingHealth(bool c) { m_regenHealth = c; }
void SetRegeneratingHealth(bool c) { m_regenHealth = c; }
virtual uint8 GetPetAutoSpellSize() const { return MAX_SPELL_CHARM; }
virtual uint32 GetPetAutoSpellOnPos(uint8 pos) const
{
@@ -739,7 +739,7 @@ class Creature : public Unit, public GridObject<Creature>, public MovableMapObje
uint32 m_respawnDelay; // (secs) delay between corpse disappearance and respawning
uint32 m_corpseDelay; // (secs) delay between death and corpse disappearance
float m_respawnradius;
uint16 m_transportCheckTimer;
uint16 m_transportCheckTimer;
uint32 lootPickPocketRestoreTime;
ReactStates m_reactState; // for AI, not charmInfo
@@ -757,12 +757,12 @@ class Creature : public Unit, public GridObject<Creature>, public MovableMapObje
SpellSchoolMask m_meleeDamageSchoolMask;
uint32 m_originalEntry;
bool m_moveInLineOfSightDisabled;
bool m_moveInLineOfSightStrictlyDisabled;
bool m_moveInLineOfSightDisabled;
bool m_moveInLineOfSightStrictlyDisabled;
Position m_homePosition;
Position m_transportHomePosition;
Position m_transportHomePosition;
bool DisableReputationGain;
@@ -775,7 +775,7 @@ class Creature : public Unit, public GridObject<Creature>, public MovableMapObje
bool CanAlwaysSee(WorldObject const* obj) const;
private:
void ForcedDespawn(uint32 timeMSToDespawn = 0);
void ForcedDespawn(uint32 timeMSToDespawn = 0);
//WaypointMovementGenerator vars
uint32 m_waypointID;

View File

@@ -196,9 +196,9 @@ void CreatureGroup::MemberAttackStart(Creature* member, Unit* target)
void CreatureGroup::FormationReset(bool dismiss)
{
if (m_members.size() && m_members.begin()->second->groupAI == 5)
return;
if (m_members.size() && m_members.begin()->second->groupAI == 5)
return;
for (CreatureGroupMemberType::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
{
if (itr->first != m_leader && itr->first->IsAlive())
@@ -220,11 +220,11 @@ void CreatureGroup::LeaderMoveTo(float x, float y, float z, bool run)
if (!m_leader)
return;
uint8 groupAI = sFormationMgr->CreatureGroupMap[m_leader->GetDBTableGUIDLow()]->groupAI;
if (groupAI == 5)
return;
uint8 groupAI = sFormationMgr->CreatureGroupMap[m_leader->GetDBTableGUIDLow()]->groupAI;
if (groupAI == 5)
return;
float pathDist = m_leader->GetExactDist(x, y, z);
float pathDist = m_leader->GetExactDist(x, y, z);
float pathAngle = m_leader->GetAngle(x, y);
for (CreatureGroupMemberType::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
@@ -233,18 +233,18 @@ void CreatureGroup::LeaderMoveTo(float x, float y, float z, bool run)
if (member == m_leader || !member->IsAlive() || member->GetVictim())
continue;
// Xinef: If member is stunned / rooted etc don't allow to move him
if (member->HasUnitState(UNIT_STATE_NOT_MOVE))
continue;
// Xinef: If member is stunned / rooted etc don't allow to move him
if (member->HasUnitState(UNIT_STATE_NOT_MOVE))
continue;
// Xinef: this should be automatized, if turn angle is greater than PI/2 (90°) we should swap formation angle
// Xinef: this should be automatized, if turn angle is greater than PI/2 (90°) we should swap formation angle
if (M_PI - fabs(fabs(m_leader->GetOrientation() - pathAngle) - M_PI) > M_PI*0.50f)
{
// pussywizard: in both cases should be 2*M_PI - follow_angle
// pussywizard: also, GetCurrentWaypointID() returns 0..n-1, while point_1 must be > 0, so +1
// pussywizard: db table waypoint_data shouldn't have point id 0 and shouldn't have any gaps for this to work!
// pussywizard: in both cases should be 2*M_PI - follow_angle
// pussywizard: also, GetCurrentWaypointID() returns 0..n-1, while point_1 must be > 0, so +1
// pussywizard: db table waypoint_data shouldn't have point id 0 and shouldn't have any gaps for this to work!
// if (m_leader->GetCurrentWaypointID()+1 == itr->second->point_1 || m_leader->GetCurrentWaypointID()+1 == itr->second->point_2)
itr->second->follow_angle = Position::NormalizeOrientation(itr->second->follow_angle + M_PI); //(2 * M_PI) - itr->second->follow_angle;
itr->second->follow_angle = Position::NormalizeOrientation(itr->second->follow_angle + M_PI); //(2 * M_PI) - itr->second->follow_angle;
}
float followAngle = itr->second->follow_angle;
@@ -260,16 +260,16 @@ void CreatureGroup::LeaderMoveTo(float x, float y, float z, bool run)
member->UpdateGroundPositionZ(dx, dy, dz);
member->SetUnitMovementFlags(m_leader->GetUnitMovementFlags());
// pussywizard: setting the same movementflags is not enough, spline decides whether leader walks/runs, so spline param is now passed as "run" parameter to this function
// pussywizard: setting the same movementflags is not enough, spline decides whether leader walks/runs, so spline param is now passed as "run" parameter to this function
if (run && member->IsWalking())
member->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
else if (!run && !member->IsWalking())
member->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
// xinef: if we move members to position without taking care of sizes, we should compare distance without sizes
// xinef: change members speed basing on distance - if too far speed up, if too close slow down
UnitMoveType mtype = Movement::SelectSpeedType(member->GetUnitMovementFlags());
member->SetSpeedRate(mtype, m_leader->GetSpeedRate(mtype) * member->GetExactDist(dx, dy, dz) / pathDist);
// xinef: if we move members to position without taking care of sizes, we should compare distance without sizes
// xinef: change members speed basing on distance - if too far speed up, if too close slow down
UnitMoveType mtype = Movement::SelectSpeedType(member->GetUnitMovementFlags());
member->SetSpeedRate(mtype, m_leader->GetSpeedRate(mtype) * member->GetExactDist(dx, dy, dz) / pathDist);
member->GetMotionMaster()->MovePoint(0, dx, dy, dz);
member->SetHomePosition(dx, dy, dz, pathAngle);

View File

@@ -36,7 +36,7 @@ GossipMenu::~GossipMenu()
void GossipMenu::AddMenuItem(int32 menuItemId, uint8 icon, std::string const& message, uint32 sender, uint32 action, std::string const& boxMessage, uint32 boxMoney, bool coded /*= false*/)
{
//TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, GetLock());
//TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, GetLock());
ASSERT(_menuItems.size() <= GOSSIP_MAX_MENU_ITEMS);
// Find a free new id - script case
@@ -68,7 +68,7 @@ void GossipMenu::AddMenuItem(int32 menuItemId, uint8 icon, std::string const& me
void GossipMenu::AddGossipMenuItemData(uint32 menuItemId, uint32 gossipActionMenuId, uint32 gossipActionPoi)
{
//TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, GetLock());
//TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, GetLock());
GossipMenuItemData& itemData = _menuItemData[menuItemId];
itemData.GossipActionMenuId = gossipActionMenuId;
@@ -77,7 +77,7 @@ void GossipMenu::AddGossipMenuItemData(uint32 menuItemId, uint32 gossipActionMen
uint32 GossipMenu::GetMenuItemSender(uint32 menuItemId) const
{
//TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock());
//TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock());
GossipMenuItemContainer::const_iterator itr = _menuItems.find(menuItemId);
if (itr == _menuItems.end())
return 0;
@@ -87,7 +87,7 @@ uint32 GossipMenu::GetMenuItemSender(uint32 menuItemId) const
uint32 GossipMenu::GetMenuItemAction(uint32 menuItemId) const
{
//TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock());
//TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock());
GossipMenuItemContainer::const_iterator itr = _menuItems.find(menuItemId);
if (itr == _menuItems.end())
return 0;
@@ -97,7 +97,7 @@ uint32 GossipMenu::GetMenuItemAction(uint32 menuItemId) const
bool GossipMenu::IsMenuItemCoded(uint32 menuItemId) const
{
//TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock());
//TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock());
GossipMenuItemContainer::const_iterator itr = _menuItems.find(menuItemId);
if (itr == _menuItems.end())
return false;
@@ -107,7 +107,7 @@ bool GossipMenu::IsMenuItemCoded(uint32 menuItemId) const
void GossipMenu::ClearMenu()
{
//TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, GetLock());
//TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, GetLock());
_menuItems.clear();
_menuItemData.clear();
}
@@ -129,8 +129,8 @@ void PlayerMenu::ClearMenus()
void PlayerMenu::SendGossipMenu(uint32 titleTextId, uint64 objectGUID) const
{
//ACE_Read_Guard<ACE_RW_Thread_Mutex> lock1(_gossipMenu.GetLock());
//ACE_Read_Guard<ACE_RW_Thread_Mutex> lock2(_questMenu.GetLock());
//ACE_Read_Guard<ACE_RW_Thread_Mutex> lock1(_gossipMenu.GetLock());
//ACE_Read_Guard<ACE_RW_Thread_Mutex> lock2(_questMenu.GetLock());
WorldPacket data(SMSG_GOSSIP_MESSAGE, 24 + _gossipMenu.GetMenuItemCount()*100 + _questMenu.GetMenuItemCount()*75); // guess size
data << uint64(objectGUID);
@@ -213,7 +213,7 @@ void QuestMenu::AddMenuItem(uint32 QuestId, uint8 Icon)
if (!sObjectMgr->GetQuestTemplate(QuestId))
return;
//TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, GetLock());
//TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, GetLock());
ASSERT(_questMenuItems.size() <= GOSSIP_MAX_MENU_ITEMS);
@@ -227,7 +227,7 @@ void QuestMenu::AddMenuItem(uint32 QuestId, uint8 Icon)
bool QuestMenu::HasItem(uint32 questId) const
{
//TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock());
//TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock());
for (QuestMenuItemList::const_iterator i = _questMenuItems.begin(); i != _questMenuItems.end(); ++i)
if (i->QuestId == questId)
return true;
@@ -237,7 +237,7 @@ bool QuestMenu::HasItem(uint32 questId) const
void QuestMenu::ClearMenu()
{
//TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, GetLock());
//TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, GetLock());
_questMenuItems.clear();
}
@@ -467,22 +467,22 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID,
return;
}
// Xinef: recheck completion on reward display
Player* _player = _session->GetPlayer();
QuestStatusMap::iterator qsitr = _player->getQuestStatusMap().find(quest->GetQuestId());
if (qsitr != _player->getQuestStatusMap().end() && qsitr->second.Status == QUEST_STATUS_INCOMPLETE)
{
for (uint8 i=0; i<6; ++i)
if (quest->RequiredItemId[i] && qsitr->second.ItemCount[i] < quest->RequiredItemCount[i])
if (_player->GetItemCount(quest->RequiredItemId[i], false) >= quest->RequiredItemCount[i])
qsitr->second.ItemCount[i] = quest->RequiredItemCount[i];
// Xinef: recheck completion on reward display
Player* _player = _session->GetPlayer();
QuestStatusMap::iterator qsitr = _player->getQuestStatusMap().find(quest->GetQuestId());
if (qsitr != _player->getQuestStatusMap().end() && qsitr->second.Status == QUEST_STATUS_INCOMPLETE)
{
for (uint8 i=0; i<6; ++i)
if (quest->RequiredItemId[i] && qsitr->second.ItemCount[i] < quest->RequiredItemCount[i])
if (_player->GetItemCount(quest->RequiredItemId[i], false) >= quest->RequiredItemCount[i])
qsitr->second.ItemCount[i] = quest->RequiredItemCount[i];
if (_player->CanCompleteQuest(quest->GetQuestId()))
{
_player->CompleteQuest(quest->GetQuestId());
canComplete = true;
}
}
if (_player->CanCompleteQuest(quest->GetQuestId()))
{
_player->CompleteQuest(quest->GetQuestId());
canComplete = true;
}
}
WorldPacket data(SMSG_QUESTGIVER_REQUEST_ITEMS, 300); // guess size
data << uint64(npcGUID);

View File

@@ -171,19 +171,19 @@ class GossipMenu
uint32 GetMenuItemCount() const
{
//TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock());
//TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock());
return _menuItems.size();
}
bool Empty() const
{
//TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock());
//TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock());
return _menuItems.empty();
}
GossipMenuItem const* GetItem(uint32 id) const
{
//TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock());
//TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock());
GossipMenuItemContainer::const_iterator itr = _menuItems.find(id);
if (itr != _menuItems.end())
return &itr->second;
@@ -193,7 +193,7 @@ class GossipMenu
GossipMenuItemData const* GetItemData(uint32 indexId) const
{
//TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock());
//TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock());
GossipMenuItemDataContainer::const_iterator itr = _menuItemData.find(indexId);
if (itr != _menuItemData.end())
return &itr->second;
@@ -212,8 +212,8 @@ class GossipMenu
return _menuItems;
}
//ACE_RW_Thread_Mutex& GetLock() const { return *(const_cast<ACE_RW_Thread_Mutex*>(&_menuLock)); }
//ACE_RW_Thread_Mutex _menuLock; // pussywizard
//ACE_RW_Thread_Mutex& GetLock() const { return *(const_cast<ACE_RW_Thread_Mutex*>(&_menuLock)); }
//ACE_RW_Thread_Mutex _menuLock; // pussywizard
private:
GossipMenuItemContainer _menuItems;
@@ -232,13 +232,13 @@ class QuestMenu
uint8 GetMenuItemCount() const
{
//TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock());
//TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock());
return _questMenuItems.size();
}
bool Empty() const
{
//TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock());
//TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock());
return _questMenuItems.empty();
}
@@ -246,12 +246,12 @@ class QuestMenu
QuestMenuItem const& GetItem(uint16 index) const
{
//TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, GetLock());
//TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, GetLock());
return _questMenuItems[index];
}
//ACE_RW_Thread_Mutex& GetLock() const { return *(const_cast<ACE_RW_Thread_Mutex*>(&_menuLock)); }
//ACE_RW_Thread_Mutex _menuLock; // pussywizard
//ACE_RW_Thread_Mutex& GetLock() const { return *(const_cast<ACE_RW_Thread_Mutex*>(&_menuLock)); }
//ACE_RW_Thread_Mutex _menuLock; // pussywizard
private:
QuestMenuItemList _questMenuItems;

View File

@@ -49,7 +49,7 @@ void TempSummon::Update(uint32 diff)
switch (m_type)
{
case TEMPSUMMON_MANUAL_DESPAWN:
case TEMPSUMMON_DESPAWNED:
case TEMPSUMMON_DESPAWNED:
break;
case TEMPSUMMON_TIMED_DESPAWN:
{
@@ -179,17 +179,17 @@ void TempSummon::InitStats(uint32 duration)
Unit* owner = GetSummoner();
if (owner)
{
if (IsTrigger() && m_spells[0])
{
setFaction(owner->getFaction());
SetLevel(owner->getLevel());
if (owner->GetTypeId() == TYPEID_PLAYER)
m_ControlledByPlayer = true;
}
{
if (IsTrigger() && m_spells[0])
{
setFaction(owner->getFaction());
SetLevel(owner->getLevel());
if (owner->GetTypeId() == TYPEID_PLAYER)
m_ControlledByPlayer = true;
}
if (owner->GetTypeId() == TYPEID_PLAYER)
m_CreatedByPlayer = true;
if (owner->GetTypeId() == TYPEID_PLAYER)
m_CreatedByPlayer = true;
}
if (!m_Properties)
@@ -224,9 +224,9 @@ void TempSummon::InitSummon()
owner->ToCreature()->AI()->JustSummoned(this);
}
// Xinef: Allow to call this hook when npc is summoned by gameobject, in this case pass this as summoner to avoid possible null checks
if (IsAIEnabled)
AI()->IsSummonedBy(owner);
// Xinef: Allow to call this hook when npc is summoned by gameobject, in this case pass this as summoner to avoid possible null checks
if (IsAIEnabled)
AI()->IsSummonedBy(owner);
}
void TempSummon::SetTempSummonType(TempSummonType type)
@@ -244,10 +244,10 @@ void TempSummon::UnSummon(uint32 msTime)
return;
}
// Dont allow to call this function twice (possible)
if (m_type == TEMPSUMMON_DESPAWNED)
return;
SetTempSummonType(TEMPSUMMON_DESPAWNED);
// Dont allow to call this function twice (possible)
if (m_type == TEMPSUMMON_DESPAWNED)
return;
SetTempSummonType(TEMPSUMMON_DESPAWNED);
//ASSERT(!IsPet());
if (IsPet())
@@ -301,7 +301,7 @@ void Minion::InitStats(uint32 duration)
SetReactState(REACT_PASSIVE);
Unit *m_owner = GetOwner();
Unit *m_owner = GetOwner();
SetCreatorGUID(m_owner->GetGUID());
setFaction(m_owner->getFaction());
@@ -313,15 +313,15 @@ void Minion::RemoveFromWorld()
if (!IsInWorld())
return;
if (Unit *owner = GetOwner())
owner->SetMinion(this, false);
if (Unit *owner = GetOwner())
owner->SetMinion(this, false);
TempSummon::RemoveFromWorld();
}
Unit* Minion::GetOwner() const
{
return ObjectAccessor::GetUnit(*this, m_owner);
return ObjectAccessor::GetUnit(*this, m_owner);
}
bool Minion::IsGuardianPet() const
@@ -332,16 +332,16 @@ bool Minion::IsGuardianPet() const
void Minion::setDeathState(DeathState s, bool despawn)
{
Creature::setDeathState(s, despawn);
if (s == JUST_DIED && IsGuardianPet())
if (Unit* owner = GetOwner())
if (owner->GetTypeId() == TYPEID_PLAYER && owner->GetMinionGUID() == GetGUID())
for (Unit::ControlSet::const_iterator itr = owner->m_Controlled.begin(); itr != owner->m_Controlled.end(); ++itr)
if ((*itr)->IsAlive() && (*itr)->GetEntry() == GetEntry())
{
owner->SetMinionGUID((*itr)->GetGUID());
owner->SetPetGUID((*itr)->GetGUID());
owner->ToPlayer()->CharmSpellInitialize();
}
if (s == JUST_DIED && IsGuardianPet())
if (Unit* owner = GetOwner())
if (owner->GetTypeId() == TYPEID_PLAYER && owner->GetMinionGUID() == GetGUID())
for (Unit::ControlSet::const_iterator itr = owner->m_Controlled.begin(); itr != owner->m_Controlled.end(); ++itr)
if ((*itr)->IsAlive() && (*itr)->GetEntry() == GetEntry())
{
owner->SetMinionGUID((*itr)->GetGUID());
owner->SetPetGUID((*itr)->GetGUID());
owner->ToPlayer()->CharmSpellInitialize();
}
}
Guardian::Guardian(SummonPropertiesEntry const* properties, uint64 owner, bool isWorldObject) : Minion(properties, owner, isWorldObject)
@@ -358,7 +358,7 @@ void Guardian::InitStats(uint32 duration)
{
Minion::InitStats(duration);
Unit *m_owner = GetOwner();
Unit *m_owner = GetOwner();
InitStatsForLevel(m_owner->getLevel());
if (m_owner->GetTypeId() == TYPEID_PLAYER && HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN))
@@ -371,7 +371,7 @@ void Guardian::InitSummon()
{
TempSummon::InitSummon();
Unit *m_owner = GetOwner();
Unit *m_owner = GetOwner();
if (m_owner->GetTypeId() == TYPEID_PLAYER
&& m_owner->GetMinionGUID() == GetGUID()
&& !m_owner->GetCharmGUID())
@@ -395,15 +395,15 @@ void Puppet::InitSummon()
{
Minion::InitSummon();
if (!SetCharmedBy(GetOwner(), CHARM_TYPE_POSSESS))
{
if (Player* p = GetOwner())
sLog->outMisc("Puppet::InitSummon (A1) - %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u", p->GetTypeId(), p->GetEntry(), p->GetUnitTypeMask(), p->GetGUIDLow(), p->GetMapId(), p->GetInstanceId(), p->FindMap(), p->IsInWorld() ? 1 : 0, p->IsDuringRemoveFromWorld() ? 1 : 0, p->IsBeingTeleported() ? 1 : 0, p->isBeingLoaded() ? 1 : 0);
else
{
sLog->outMisc("Puppet::InitSummon (B1)");
//ASSERT(false); // ZOMG!
}
}
{
if (Player* p = GetOwner())
sLog->outMisc("Puppet::InitSummon (A1) - %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u", p->GetTypeId(), p->GetEntry(), p->GetUnitTypeMask(), p->GetGUIDLow(), p->GetMapId(), p->GetInstanceId(), p->FindMap(), p->IsInWorld() ? 1 : 0, p->IsDuringRemoveFromWorld() ? 1 : 0, p->IsBeingTeleported() ? 1 : 0, p->isBeingLoaded() ? 1 : 0);
else
{
sLog->outMisc("Puppet::InitSummon (B1)");
//ASSERT(false); // ZOMG!
}
}
}
void Puppet::Update(uint32 time)
@@ -431,5 +431,5 @@ void Puppet::RemoveFromWorld()
Player* Puppet::GetOwner() const
{
return ObjectAccessor::GetPlayer(*this, m_owner);
return ObjectAccessor::GetPlayer(*this, m_owner);
}

View File

@@ -52,8 +52,8 @@ class TempSummon : public Creature
Unit* GetSummoner() const;
uint64 GetSummonerGUID() { return m_summonerGUID; }
TempSummonType const& GetSummonType() { return m_type; }
uint32 GetTimer() { return m_timer; }
void SetTimer(uint32 t) { m_timer = t; }
uint32 GetTimer() { return m_timer; }
void SetTimer(uint32 t) { m_timer = t; }
const SummonPropertiesEntry* const m_Properties;
private:
@@ -69,12 +69,12 @@ class Minion : public TempSummon
Minion(SummonPropertiesEntry const* properties, uint64 owner, bool isWorldObject);
void InitStats(uint32 duration);
void RemoveFromWorld();
Unit* GetOwner() const;
Unit* GetOwner() const;
float GetFollowAngle() const { return m_followAngle; }
void SetFollowAngle(float angle) { m_followAngle = angle; }
bool IsPetGhoul() const {return GetEntry() == 26125 /*normal ghoul*/ || GetEntry() == 30230 /*Raise Ally ghoul*/;} // Ghoul may be guardian or pet
bool IsGuardianPet() const;
void setDeathState(DeathState s, bool despawn = false); // override virtual Unit::setDeathState
void setDeathState(DeathState s, bool despawn = false); // override virtual Unit::setDeathState
protected:
const uint64 m_owner;
float m_followAngle;
@@ -106,7 +106,7 @@ class Puppet : public Minion
void Update(uint32 time);
void RemoveFromWorld();
protected:
Player* GetOwner() const;
Player* GetOwner() const;
const uint64 m_owner;
};