mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-30 00:53:46 +00:00
Merge branch 'master' into Playerbot
# Conflicts: # src/server/game/World/World.h
This commit is contained in:
@@ -217,7 +217,7 @@ bool TemporaryThreatModifierEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||
|
||||
Creature::Creature(bool isWorldObject): Unit(isWorldObject), MovableMapObject(), m_groupLootTimer(0), lootingGroupLowGUID(0), m_lootRecipientGroup(0),
|
||||
m_corpseRemoveTime(0), m_respawnTime(0), m_respawnDelay(300), m_corpseDelay(60), m_wanderDistance(0.0f), m_boundaryCheckTime(2500),
|
||||
m_transportCheckTimer(1000), lootPickPocketRestoreTime(0), m_reactState(REACT_AGGRESSIVE), m_defaultMovementType(IDLE_MOTION_TYPE),
|
||||
m_transportCheckTimer(1000), lootPickPocketRestoreTime(0), m_combatPulseTime(0), m_combatPulseDelay(0), m_reactState(REACT_AGGRESSIVE), m_defaultMovementType(IDLE_MOTION_TYPE),
|
||||
m_spawnId(0), m_equipmentId(0), m_originalEquipmentId(0), m_AlreadyCallAssistance(false),
|
||||
m_AlreadySearchedAssistance(false), m_regenHealth(true), m_regenPower(true), m_AI_locked(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL), m_originalEntry(0), m_moveInLineOfSightDisabled(false), m_moveInLineOfSightStrictlyDisabled(false),
|
||||
m_homePosition(), m_transportHomePosition(), m_creatureInfo(nullptr), m_creatureData(nullptr), m_detectionDistance(20.0f), m_waypointID(0), m_path_id(0), m_formation(nullptr), _lastDamagedTime(nullptr), m_cannotReachTimer(0),
|
||||
@@ -474,7 +474,7 @@ bool Creature::InitEntry(uint32 Entry, const CreatureData* data)
|
||||
SetSpeed(MOVE_FLIGHT, cinfo->speed_flight);
|
||||
|
||||
// Will set UNIT_FIELD_BOUNDINGRADIUS and UNIT_FIELD_COMBATREACH
|
||||
SetObjectScale(cinfo->scale);
|
||||
SetObjectScale(GetNativeObjectScale());
|
||||
|
||||
SetFloatValue(UNIT_FIELD_HOVERHEIGHT, cinfo->HoverHeight);
|
||||
|
||||
@@ -546,7 +546,7 @@ bool Creature::UpdateEntry(uint32 Entry, const CreatureData* data, bool changele
|
||||
}
|
||||
|
||||
SetMeleeDamageSchool(SpellSchools(cInfo->dmgschool));
|
||||
CreatureBaseStats const* stats = sObjectMgr->GetCreatureBaseStats(getLevel(), cInfo->unit_class);
|
||||
CreatureBaseStats const* stats = sObjectMgr->GetCreatureBaseStats(GetLevel(), cInfo->unit_class);
|
||||
float armor = (float)stats->GenerateArmor(cInfo); // TODO: Why is this treated as uint32 when it's a float?
|
||||
SetModifierValue(UNIT_MOD_ARMOR, BASE_VALUE, armor);
|
||||
SetModifierValue(UNIT_MOD_RESISTANCE_HOLY, BASE_VALUE, float(cInfo->resistance[SPELL_SCHOOL_HOLY]));
|
||||
@@ -648,15 +648,22 @@ void Creature::Update(uint32 diff)
|
||||
|
||||
ObjectGuid dbtableHighGuid = ObjectGuid::Create<HighGuid::Unit>(m_creatureData ? m_creatureData->id1 : GetEntry(), m_spawnId);
|
||||
time_t linkedRespawntime = GetMap()->GetLinkedRespawnTime(dbtableHighGuid);
|
||||
if (!linkedRespawntime) // Can respawn
|
||||
|
||||
CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(GetEntry());
|
||||
|
||||
if (!linkedRespawntime || (cInfo && cInfo->HasFlagsExtra(CREATURE_FLAG_EXTRA_HARD_RESET))) // Can respawn
|
||||
Respawn();
|
||||
else // the master is dead
|
||||
{
|
||||
ObjectGuid targetGuid = sObjectMgr->GetLinkedRespawnGuid(dbtableHighGuid);
|
||||
if (targetGuid == dbtableHighGuid) // if linking self, never respawn (check delayed to next day)
|
||||
{
|
||||
SetRespawnTime(DAY);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_respawnTime = (now > linkedRespawntime ? now : linkedRespawntime) + urand(5, MINUTE); // else copy time from master and add a little
|
||||
}
|
||||
SaveRespawnTime(); // also save to DB immediately
|
||||
}
|
||||
}
|
||||
@@ -711,6 +718,24 @@ void Creature::Update(uint32 diff)
|
||||
SelectVictim();
|
||||
}
|
||||
|
||||
// if periodic combat pulse is enabled and we are both in combat and in a dungeon, do this now
|
||||
if (m_combatPulseDelay > 0 && IsInCombat() && GetMap()->IsDungeon())
|
||||
{
|
||||
if (diff > m_combatPulseTime)
|
||||
m_combatPulseTime = 0;
|
||||
else
|
||||
m_combatPulseTime -= diff;
|
||||
|
||||
if (m_combatPulseTime == 0)
|
||||
{
|
||||
if (AI())
|
||||
AI()->DoZoneInCombat();
|
||||
else
|
||||
SetInCombatWithZone();
|
||||
m_combatPulseTime = m_combatPulseDelay * IN_MILLISECONDS;
|
||||
}
|
||||
}
|
||||
|
||||
// periodic check to see if the creature has passed an evade boundary
|
||||
if (IsAIEnabled && !IsInEvadeMode() && IsEngaged())
|
||||
{
|
||||
@@ -1036,7 +1061,7 @@ void Creature::DoFleeToGetAssistance()
|
||||
if (!creature)
|
||||
//SetFeared(true, GetVictim()->GetGUID(), 0, sWorld->getIntConfig(CONFIG_CREATURE_FAMILY_FLEE_DELAY));
|
||||
//TODO: use 31365
|
||||
SetControlled(true, UNIT_STATE_FLEEING);
|
||||
SetControlled(true, UNIT_STATE_FLEEING, GetVictim());
|
||||
else
|
||||
GetMotionMaster()->MoveSeekAssistance(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ());
|
||||
}
|
||||
@@ -1213,7 +1238,7 @@ bool Creature::isCanInteractWithBattleMaster(Player* player, bool msg) const
|
||||
|
||||
bool Creature::isCanTrainingAndResetTalentsOf(Player* player) const
|
||||
{
|
||||
return player->getLevel() >= 10
|
||||
return player->GetLevel() >= 10
|
||||
&& GetCreatureTemplate()->trainer_type == TRAINER_TYPE_CLASS
|
||||
&& player->getClass() == GetCreatureTemplate()->trainer_class;
|
||||
}
|
||||
@@ -2098,22 +2123,24 @@ void Creature::DespawnOrUnsummon(Milliseconds msTimeToDespawn /*= 0*/, Seconds f
|
||||
ForcedDespawn(msTimeToDespawn.count(), forcedRespawnTimer);
|
||||
}
|
||||
|
||||
void Creature::DespawnOnEvade()
|
||||
void Creature::DespawnOnEvade(Seconds respawnDelay)
|
||||
{
|
||||
SetVisible(false);
|
||||
AI()->SummonedCreatureDespawnAll();
|
||||
}
|
||||
|
||||
void Creature::RespawnOnEvade()
|
||||
{
|
||||
SetVisible(true);
|
||||
UpdateMovementFlags();
|
||||
AI()->Reset();
|
||||
AI()->JustReachedHome();
|
||||
if (IsVehicle()) // use the same sequence of addtoworld, aireset may remove all summons!
|
||||
if (respawnDelay < 2s)
|
||||
{
|
||||
GetVehicleKit()->Reset(true);
|
||||
LOG_WARN("entities.unit", "DespawnOnEvade called with delay of {} seconds, defaulting to 2.", respawnDelay.count());
|
||||
respawnDelay = 2s;
|
||||
}
|
||||
|
||||
if (TempSummon* whoSummon = ToTempSummon())
|
||||
{
|
||||
LOG_WARN("entities.unit", "DespawnOnEvade called on a temporary summon.");
|
||||
whoSummon->UnSummon();
|
||||
return;
|
||||
}
|
||||
|
||||
DespawnOrUnsummon(Milliseconds(0), respawnDelay);
|
||||
}
|
||||
|
||||
void Creature::InitializeReactState()
|
||||
@@ -2899,7 +2926,7 @@ uint8 Creature::getLevelForTarget(WorldObject const* target) const
|
||||
if (!isWorldBoss() || !target->ToUnit())
|
||||
return Unit::getLevelForTarget(target);
|
||||
|
||||
uint16 level = target->ToUnit()->getLevel() + sWorld->getIntConfig(CONFIG_WORLD_BOSS_LEVEL_DIFF);
|
||||
uint16 level = target->ToUnit()->GetLevel() + sWorld->getIntConfig(CONFIG_WORLD_BOSS_LEVEL_DIFF);
|
||||
if (level < 1)
|
||||
return 1;
|
||||
if (level > 255)
|
||||
@@ -3351,6 +3378,11 @@ void Creature::UpdateMovementFlags()
|
||||
SetSwim(CanSwim() && Swim);
|
||||
}
|
||||
|
||||
float Creature::GetNativeObjectScale() const
|
||||
{
|
||||
return GetCreatureTemplate()->scale;
|
||||
}
|
||||
|
||||
void Creature::SetObjectScale(float scale)
|
||||
{
|
||||
Unit::SetObjectScale(scale);
|
||||
|
||||
Reference in New Issue
Block a user