Misc fixes.
This commit is contained in:
@@ -959,7 +959,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
void DespawnForPlayer(Player seer, TimeSpan respawnTime)
|
void DespawnForPlayer(Player seer, TimeSpan respawnTime)
|
||||||
{
|
{
|
||||||
PerPlayerState perPlayerState = GetOrCreatePerPlayerStates()[seer.GetGUID()];
|
PerPlayerState perPlayerState = GetOrCreatePerPlayerStates(seer.GetGUID());
|
||||||
perPlayerState.ValidUntil = GameTime.GetSystemTime() + respawnTime;
|
perPlayerState.ValidUntil = GameTime.GetSystemTime() + respawnTime;
|
||||||
perPlayerState.Despawned = true;
|
perPlayerState.Despawned = true;
|
||||||
seer.UpdateVisibilityOf(this);
|
seer.UpdateVisibilityOf(this);
|
||||||
@@ -3002,7 +3002,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
void SetGoStateFor(GameObjectState state, Player viewer)
|
void SetGoStateFor(GameObjectState state, Player viewer)
|
||||||
{
|
{
|
||||||
PerPlayerState perPlayerState = GetOrCreatePerPlayerStates()[viewer.GetGUID()];
|
PerPlayerState perPlayerState = GetOrCreatePerPlayerStates(viewer.GetGUID());
|
||||||
perPlayerState.ValidUntil = GameTime.GetSystemTime() + TimeSpan.FromSeconds(m_respawnDelayTime);
|
perPlayerState.ValidUntil = GameTime.GetSystemTime() + TimeSpan.FromSeconds(m_respawnDelayTime);
|
||||||
perPlayerState.State = state;
|
perPlayerState.State = state;
|
||||||
|
|
||||||
@@ -3495,12 +3495,15 @@ namespace Game.Entities
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dictionary<ObjectGuid, PerPlayerState> GetOrCreatePerPlayerStates()
|
PerPlayerState GetOrCreatePerPlayerStates(ObjectGuid guid)
|
||||||
{
|
{
|
||||||
if (m_perPlayerState == null)
|
if (m_perPlayerState == null)
|
||||||
m_perPlayerState = new();
|
m_perPlayerState = new();
|
||||||
|
|
||||||
return m_perPlayerState;
|
if (!m_perPlayerState.ContainsKey(guid))
|
||||||
|
m_perPlayerState[guid] = new();
|
||||||
|
|
||||||
|
return m_perPlayerState[guid];
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ushort GetAIAnimKitId() { return _animKitId; }
|
public override ushort GetAIAnimKitId() { return _animKitId; }
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ namespace Game.Entities
|
|||||||
owner.RemovePet(null, PetSaveMode.NotInSlot);
|
owner.RemovePet(null, PetSaveMode.NotInSlot);
|
||||||
|
|
||||||
var unslottedPetIndex = petStable.UnslottedPets.FindIndex(unslottedPet => unslottedPet.PetNumber == petInfoNumber);
|
var unslottedPetIndex = petStable.UnslottedPets.FindIndex(unslottedPet => unslottedPet.PetNumber == petInfoNumber);
|
||||||
Cypher.Assert(petStable.CurrentPetIndex == 0);
|
Cypher.Assert(!petStable.CurrentPetIndex.HasValue);
|
||||||
Cypher.Assert(unslottedPetIndex != -1);
|
Cypher.Assert(unslottedPetIndex != -1);
|
||||||
|
|
||||||
petStable.SetCurrentUnslottedPetIndex((uint)unslottedPetIndex);
|
petStable.SetCurrentUnslottedPetIndex((uint)unslottedPetIndex);
|
||||||
@@ -302,7 +302,7 @@ namespace Game.Entities
|
|||||||
Cypher.Assert(activePetIndex != -1);
|
Cypher.Assert(activePetIndex != -1);
|
||||||
|
|
||||||
// Check that we either have no pet (unsummoned by player) or it matches temporarily unsummoned pet by server (for example on flying mount)
|
// Check that we either have no pet (unsummoned by player) or it matches temporarily unsummoned pet by server (for example on flying mount)
|
||||||
Cypher.Assert(petStable.CurrentPetIndex == 0 || petStable.CurrentPetIndex == activePetIndex);
|
Cypher.Assert(!petStable.CurrentPetIndex.HasValue || petStable.CurrentPetIndex == activePetIndex);
|
||||||
|
|
||||||
petStable.SetCurrentActivePetIndex((uint)activePetIndex);
|
petStable.SetCurrentActivePetIndex((uint)activePetIndex);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4284,7 +4284,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
map.AddToMap(pet.ToCreature());
|
map.AddToMap(pet.ToCreature());
|
||||||
|
|
||||||
Cypher.Assert(petStable.CurrentPetIndex == 0);
|
Cypher.Assert(!petStable.CurrentPetIndex.HasValue);
|
||||||
petStable.SetCurrentUnslottedPetIndex((uint)petStable.UnslottedPets.Count);
|
petStable.SetCurrentUnslottedPetIndex((uint)petStable.UnslottedPets.Count);
|
||||||
PetStable.PetInfo petInfo = new();
|
PetStable.PetInfo petInfo = new();
|
||||||
pet.FillPetInfo(petInfo);
|
pet.FillPetInfo(petInfo);
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ namespace Game.Spells
|
|||||||
if (unitCaster != null && apply_direct_bonus)
|
if (unitCaster != null && apply_direct_bonus)
|
||||||
{
|
{
|
||||||
uint bonus = unitCaster.SpellDamageBonusDone(unitTarget, m_spellInfo, (uint)damage, DamageEffectType.SpellDirect, effectInfo);
|
uint bonus = unitCaster.SpellDamageBonusDone(unitTarget, m_spellInfo, (uint)damage, DamageEffectType.SpellDirect, effectInfo);
|
||||||
damage = (int)(bonus + (bonus * variance));
|
damage = (int)(bonus + (uint)(bonus * variance));
|
||||||
damage = (int)unitTarget.SpellDamageBonusTaken(unitCaster, m_spellInfo, (uint)damage, DamageEffectType.SpellDirect);
|
damage = (int)unitTarget.SpellDamageBonusTaken(unitCaster, m_spellInfo, (uint)damage, DamageEffectType.SpellDirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -697,7 +697,7 @@ namespace Game.Spells
|
|||||||
if (unitCaster != null)
|
if (unitCaster != null)
|
||||||
{
|
{
|
||||||
uint bonus = unitCaster.SpellDamageBonusDone(unitTarget, m_spellInfo, (uint)damage, DamageEffectType.SpellDirect, effectInfo);
|
uint bonus = unitCaster.SpellDamageBonusDone(unitTarget, m_spellInfo, (uint)damage, DamageEffectType.SpellDirect, effectInfo);
|
||||||
damage = (int)(bonus + (bonus * variance));
|
damage = (int)(bonus + (uint)(bonus * variance));
|
||||||
damage = (int)unitTarget.SpellDamageBonusTaken(unitCaster, m_spellInfo, (uint)damage, DamageEffectType.SpellDirect);
|
damage = (int)unitTarget.SpellDamageBonusTaken(unitCaster, m_spellInfo, (uint)damage, DamageEffectType.SpellDirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -886,7 +886,7 @@ namespace Game.Spells
|
|||||||
if (unitCaster != null)
|
if (unitCaster != null)
|
||||||
unitCaster.SpellDamageBonusDone(unitTarget, m_spellInfo, (uint)damage, DamageEffectType.SpellDirect, effectInfo);
|
unitCaster.SpellDamageBonusDone(unitTarget, m_spellInfo, (uint)damage, DamageEffectType.SpellDirect, effectInfo);
|
||||||
|
|
||||||
damage = (int)(bonus + (bonus * variance));
|
damage = (int)(bonus + (uint)(bonus * variance));
|
||||||
|
|
||||||
if (unitCaster != null)
|
if (unitCaster != null)
|
||||||
damage = (int)unitTarget.SpellDamageBonusTaken(unitCaster, m_spellInfo, (uint)damage, DamageEffectType.SpellDirect);
|
damage = (int)unitTarget.SpellDamageBonusTaken(unitCaster, m_spellInfo, (uint)damage, DamageEffectType.SpellDirect);
|
||||||
|
|||||||
Reference in New Issue
Block a user