Fixes alot of little errors.
This commit is contained in:
@@ -72,7 +72,7 @@ namespace Game.AI
|
|||||||
else if (creature.IsCritter() && !creature.HasUnitTypeMask(UnitTypeMask.Guardian))
|
else if (creature.IsCritter() && !creature.HasUnitTypeMask(UnitTypeMask.Guardian))
|
||||||
return new CritterAI(creature);
|
return new CritterAI(creature);
|
||||||
|
|
||||||
if (creature.IsCivilian() && !creature.IsNeutralToAll())
|
if (!creature.IsCivilian() && !creature.IsNeutralToAll())
|
||||||
return new AggressorAI(creature);
|
return new AggressorAI(creature);
|
||||||
|
|
||||||
if (creature.IsCivilian() || creature.IsNeutralToAll())
|
if (creature.IsCivilian() || creature.IsNeutralToAll())
|
||||||
|
|||||||
@@ -487,7 +487,7 @@ namespace Game.BattleFields
|
|||||||
creature.SetVisible(true);
|
creature.SetVisible(true);
|
||||||
creature.RemoveUnitFlag(UnitFlags.NonAttackable);
|
creature.RemoveUnitFlag(UnitFlags.NonAttackable);
|
||||||
creature.SetUninteractible(false);
|
creature.SetUninteractible(false);
|
||||||
if (creature.IsAlive())
|
if (!creature.IsAlive())
|
||||||
creature.Respawn(true);
|
creature.Respawn(true);
|
||||||
if (aggressive)
|
if (aggressive)
|
||||||
creature.SetReactState(ReactStates.Aggressive);
|
creature.SetReactState(ReactStates.Aggressive);
|
||||||
|
|||||||
@@ -3066,6 +3066,9 @@ namespace Game
|
|||||||
|
|
||||||
public bool IsEmpty()
|
public bool IsEmpty()
|
||||||
{
|
{
|
||||||
|
if (Conditions == null)
|
||||||
|
return true;
|
||||||
|
|
||||||
return Conditions.Empty();
|
return Conditions.Empty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -777,7 +777,7 @@ namespace Game.Entities
|
|||||||
lowGuid = map.GenerateLowGuid(HighGuid.Creature);
|
lowGuid = map.GenerateLowGuid(HighGuid.Creature);
|
||||||
|
|
||||||
Creature creature = new();
|
Creature creature = new();
|
||||||
if (creature.Create(lowGuid, map, entry, pos, null, vehId))
|
if (!creature.Create(lowGuid, map, entry, pos, null, vehId))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return creature;
|
return creature;
|
||||||
@@ -786,7 +786,7 @@ namespace Game.Entities
|
|||||||
public static Creature CreateCreatureFromDB(ulong spawnId, Map map, bool addToMap = true, bool allowDuplicate = false)
|
public static Creature CreateCreatureFromDB(ulong spawnId, Map map, bool addToMap = true, bool allowDuplicate = false)
|
||||||
{
|
{
|
||||||
Creature creature = new();
|
Creature creature = new();
|
||||||
if (creature.LoadFromDB(spawnId, map, addToMap, allowDuplicate))
|
if (!creature.LoadFromDB(spawnId, map, addToMap, allowDuplicate))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return creature;
|
return creature;
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public bool CanSeeSpellClickOn(Creature creature)
|
public bool CanSeeSpellClickOn(Creature creature)
|
||||||
{
|
{
|
||||||
if (creature.HasNpcFlag(NPCFlags.SpellClick))
|
if (!creature.HasNpcFlag(NPCFlags.SpellClick))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var clickBounds = Global.ObjectMgr.GetSpellClickInfoMapBounds(creature.GetEntry());
|
var clickBounds = Global.ObjectMgr.GetSpellClickInfoMapBounds(creature.GetEntry());
|
||||||
|
|||||||
@@ -2613,13 +2613,13 @@ namespace Game.Entities
|
|||||||
canTalk = false;
|
canTalk = false;
|
||||||
break;
|
break;
|
||||||
case GossipOptionNpc.Battlemaster:
|
case GossipOptionNpc.Battlemaster:
|
||||||
if (creature.CanInteractWithBattleMaster(this, false))
|
if (!creature.CanInteractWithBattleMaster(this, false))
|
||||||
canTalk = false;
|
canTalk = false;
|
||||||
break;
|
break;
|
||||||
case GossipOptionNpc.TalentMaster:
|
case GossipOptionNpc.TalentMaster:
|
||||||
case GossipOptionNpc.SpecializationMaster:
|
case GossipOptionNpc.SpecializationMaster:
|
||||||
case GossipOptionNpc.GlyphMaster:
|
case GossipOptionNpc.GlyphMaster:
|
||||||
if (creature.CanResetTalents(this))
|
if (!creature.CanResetTalents(this))
|
||||||
canTalk = false;
|
canTalk = false;
|
||||||
break;
|
break;
|
||||||
case GossipOptionNpc.Stablemaster:
|
case GossipOptionNpc.Stablemaster:
|
||||||
@@ -3435,7 +3435,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public bool IsAllowedToLoot(Creature creature)
|
public bool IsAllowedToLoot(Creature creature)
|
||||||
{
|
{
|
||||||
if (creature.IsDead())
|
if (!creature.IsDead())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (HasPendingBind())
|
if (HasPendingBind())
|
||||||
@@ -4303,7 +4303,7 @@ namespace Game.Entities
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (creature.IsAreaSpiritHealer())
|
if (!creature.IsAreaSpiritHealer())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_areaSpiritHealerGUID = creature.GetGUID();
|
_areaSpiritHealerGUID = creature.GetGUID();
|
||||||
|
|||||||
@@ -377,7 +377,7 @@ namespace Game.Entities
|
|||||||
// because the current GameObjectModel cannot be moved without recreating
|
// because the current GameObjectModel cannot be moved without recreating
|
||||||
creature.AddUnitState(UnitState.IgnorePathfinding);
|
creature.AddUnitState(UnitState.IgnorePathfinding);
|
||||||
|
|
||||||
if (creature.IsPositionValid())
|
if (!creature.IsPositionValid())
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Transport, "Creature (guidlow {0}, entry {1}) not created. Suggested coordinates aren't valid (X: {2} Y: {3})", creature.GetGUID().ToString(), creature.GetEntry(), creature.GetPositionX(), creature.GetPositionY());
|
Log.outError(LogFilter.Transport, "Creature (guidlow {0}, entry {1}) not created. Suggested coordinates aren't valid (X: {2} Y: {3})", creature.GetGUID().ToString(), creature.GetEntry(), creature.GetPositionX(), creature.GetPositionY());
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -1031,10 +1031,10 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
Log.outDebug(LogFilter.Unit, "DealDamageNotPlayer");
|
Log.outDebug(LogFilter.Unit, "DealDamageNotPlayer");
|
||||||
|
|
||||||
if (creature.IsPet())
|
if (!creature.IsPet())
|
||||||
{
|
{
|
||||||
// must be after setDeathState which resets dynamic flags
|
// must be after setDeathState which resets dynamic flags
|
||||||
if (creature.IsFullyLooted())
|
if (!creature.IsFullyLooted())
|
||||||
creature.SetDynamicFlag(UnitDynFlags.Lootable);
|
creature.SetDynamicFlag(UnitDynFlags.Lootable);
|
||||||
else
|
else
|
||||||
creature.AllLootRemovedFromCorpse();
|
creature.AllLootRemovedFromCorpse();
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace Game
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (creature.IsWithinDistInMap(player, AELootCreatureCheck.LootDistance))
|
if (!creature.IsWithinDistInMap(player, AELootCreatureCheck.LootDistance))
|
||||||
{
|
{
|
||||||
player.SendLootError(req.Object, lguid, LootError.TooFar);
|
player.SendLootError(req.Object, lguid, LootError.TooFar);
|
||||||
continue;
|
continue;
|
||||||
@@ -359,7 +359,7 @@ namespace Game
|
|||||||
creature.RemoveDynamicFlag(UnitDynFlags.Lootable);
|
creature.RemoveDynamicFlag(UnitDynFlags.Lootable);
|
||||||
|
|
||||||
// skip pickpocketing loot for speed, skinning timer reduction is no-op in fact
|
// skip pickpocketing loot for speed, skinning timer reduction is no-op in fact
|
||||||
if (creature.IsAlive())
|
if (!creature.IsAlive())
|
||||||
creature.AllLootRemovedFromCorpse();
|
creature.AllLootRemovedFromCorpse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ namespace Game.Maps
|
|||||||
Creature creature = objs[i];
|
Creature creature = objs[i];
|
||||||
CreatureUnitRelocationWorker(i_creature, creature);
|
CreatureUnitRelocationWorker(i_creature, creature);
|
||||||
|
|
||||||
if (creature.IsNeedNotify(NotifyFlags.VisibilityChanged))
|
if (!creature.IsNeedNotify(NotifyFlags.VisibilityChanged))
|
||||||
CreatureUnitRelocationWorker(creature, i_creature);
|
CreatureUnitRelocationWorker(creature, i_creature);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -318,7 +318,7 @@ namespace Game.Maps
|
|||||||
for (var i = 0; i < objs.Count; ++i)
|
for (var i = 0; i < objs.Count; ++i)
|
||||||
{
|
{
|
||||||
Creature creature = objs[i];
|
Creature creature = objs[i];
|
||||||
if (creature.IsNeedNotify(NotifyFlags.VisibilityChanged))
|
if (!creature.IsNeedNotify(NotifyFlags.VisibilityChanged))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
CreatureRelocationNotifier relocate = new(creature);
|
CreatureRelocationNotifier relocate = new(creature);
|
||||||
@@ -450,7 +450,7 @@ namespace Game.Maps
|
|||||||
for (var i = 0; i < objs.Count; ++i)
|
for (var i = 0; i < objs.Count; ++i)
|
||||||
{
|
{
|
||||||
Creature creature = objs[i];
|
Creature creature = objs[i];
|
||||||
if (creature.InSamePhase(i_phaseShift))
|
if (!creature.InSamePhase(i_phaseShift))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((!required3dDist ? creature.GetExactDist2dSq(i_source) : creature.GetExactDistSq(i_source)) > i_distSq)
|
if ((!required3dDist ? creature.GetExactDist2dSq(i_source) : creature.GetExactDistSq(i_source)) > i_distSq)
|
||||||
@@ -545,7 +545,7 @@ namespace Game.Maps
|
|||||||
for (var i = 0; i < objs.Count; ++i)
|
for (var i = 0; i < objs.Count; ++i)
|
||||||
{
|
{
|
||||||
Creature creature = objs[i];
|
Creature creature = objs[i];
|
||||||
if (creature.InSamePhase(i_phaseShift))
|
if (!creature.InSamePhase(i_phaseShift))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (creature.GetExactDist2dSq(i_source) > i_distSq)
|
if (creature.GetExactDist2dSq(i_source) > i_distSq)
|
||||||
@@ -850,7 +850,7 @@ namespace Game.Maps
|
|||||||
for (var i = 0; i < objs.Count; ++i)
|
for (var i = 0; i < objs.Count; ++i)
|
||||||
{
|
{
|
||||||
Creature creature = objs[i];
|
Creature creature = objs[i];
|
||||||
if (creature.GetSharedVisionList().Empty())
|
if (!creature.GetSharedVisionList().Empty())
|
||||||
{
|
{
|
||||||
foreach (var visionPlayer in creature.GetSharedVisionList())
|
foreach (var visionPlayer in creature.GetSharedVisionList())
|
||||||
BuildPacket(visionPlayer);
|
BuildPacket(visionPlayer);
|
||||||
@@ -1070,7 +1070,7 @@ namespace Game.Maps
|
|||||||
for (var i = 0; i < objs.Count; ++i)
|
for (var i = 0; i < objs.Count; ++i)
|
||||||
{
|
{
|
||||||
Creature creature = objs[i];
|
Creature creature = objs[i];
|
||||||
if (creature.InSamePhase(i_phaseShift))
|
if (!creature.InSamePhase(i_phaseShift))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (i_check.Invoke(creature))
|
if (i_check.Invoke(creature))
|
||||||
@@ -1253,7 +1253,7 @@ namespace Game.Maps
|
|||||||
for (var i = 0; i < objs.Count; ++i)
|
for (var i = 0; i < objs.Count; ++i)
|
||||||
{
|
{
|
||||||
Creature creature = objs[i];
|
Creature creature = objs[i];
|
||||||
if (creature.InSamePhase(i_phaseShift))
|
if (!creature.InSamePhase(i_phaseShift))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (i_check.Invoke(creature))
|
if (i_check.Invoke(creature))
|
||||||
@@ -1585,7 +1585,7 @@ namespace Game.Maps
|
|||||||
for (var i = 0; i < objs.Count; ++i)
|
for (var i = 0; i < objs.Count; ++i)
|
||||||
{
|
{
|
||||||
Creature creature = objs[i];
|
Creature creature = objs[i];
|
||||||
if (creature.InSamePhase(i_phaseShift))
|
if (!creature.InSamePhase(i_phaseShift))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (i_check.Invoke(creature))
|
if (i_check.Invoke(creature))
|
||||||
@@ -1629,7 +1629,7 @@ namespace Game.Maps
|
|||||||
for (var i = 0; i < objs.Count; ++i)
|
for (var i = 0; i < objs.Count; ++i)
|
||||||
{
|
{
|
||||||
Creature creature = objs[i];
|
Creature creature = objs[i];
|
||||||
if (creature.InSamePhase(i_phaseShift))
|
if (!creature.InSamePhase(i_phaseShift))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (i_check.Invoke(creature))
|
if (i_check.Invoke(creature))
|
||||||
@@ -1697,7 +1697,7 @@ namespace Game.Maps
|
|||||||
for (var i = 0; i < objs.Count; ++i)
|
for (var i = 0; i < objs.Count; ++i)
|
||||||
{
|
{
|
||||||
Creature creature = objs[i];
|
Creature creature = objs[i];
|
||||||
if (creature.InSamePhase(i_phaseShift))
|
if (!creature.InSamePhase(i_phaseShift))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (i_check.Invoke(creature))
|
if (i_check.Invoke(creature))
|
||||||
@@ -1728,7 +1728,7 @@ namespace Game.Maps
|
|||||||
for (var i = 0; i < objs.Count; ++i)
|
for (var i = 0; i < objs.Count; ++i)
|
||||||
{
|
{
|
||||||
Creature creature = objs[i];
|
Creature creature = objs[i];
|
||||||
if (creature.InSamePhase(i_phaseShift))
|
if (!creature.InSamePhase(i_phaseShift))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (i_check.Invoke(creature))
|
if (i_check.Invoke(creature))
|
||||||
|
|||||||
@@ -1193,7 +1193,7 @@ namespace Game.Maps
|
|||||||
{
|
{
|
||||||
// if creature can't be move in new cell/grid (not loaded) move it to repawn cell/grid
|
// if creature can't be move in new cell/grid (not loaded) move it to repawn cell/grid
|
||||||
// creature coordinates will be updated and notifiers send
|
// creature coordinates will be updated and notifiers send
|
||||||
if (CreatureRespawnRelocation(creature, false))
|
if (!CreatureRespawnRelocation(creature, false))
|
||||||
{
|
{
|
||||||
// ... or unload (if respawn grid also not loaded)
|
// ... or unload (if respawn grid also not loaded)
|
||||||
//This may happen when a player just logs in and a pet moves to a nearby unloaded cell
|
//This may happen when a player just logs in and a pet moves to a nearby unloaded cell
|
||||||
|
|||||||
Reference in New Issue
Block a user