Some refactoring of code. and some cleanups

This commit is contained in:
hondacrx
2019-09-21 12:11:16 -04:00
parent 7c405230cc
commit 35c06c09fd
214 changed files with 1235 additions and 1341 deletions
@@ -24,7 +24,6 @@ using Game.Network.Packets;
using Game.Spells;
using System;
using System.Collections.Generic;
using Game;
using Framework.Dynamic;
using Game.Network;
@@ -37,8 +36,8 @@ namespace Game.Entities
_previousCheckOrientation = float.PositiveInfinity;
_reachedDestination = true;
objectTypeMask |= TypeMask.AreaTrigger;
objectTypeId = TypeId.AreaTrigger;
ObjectTypeMask |= TypeMask.AreaTrigger;
ObjectTypeId = TypeId.AreaTrigger;
m_updateFlag.Stationary = true;
m_updateFlag.AreaTrigger = true;
@@ -79,7 +78,7 @@ namespace Game.Entities
}
}
public static AreaTrigger CreateAreaTrigger(uint spellMiscId, Unit caster, Unit target, SpellInfo spell, Position pos, int duration, uint spellXSpellVisualId, ObjectGuid castId = default(ObjectGuid), AuraEffect aurEff = null)
public static AreaTrigger CreateAreaTrigger(uint spellMiscId, Unit caster, Unit target, SpellInfo spell, Position pos, int duration, uint spellXSpellVisualId, ObjectGuid castId = default, AuraEffect aurEff = null)
{
AreaTrigger at = new AreaTrigger();
if (!at.Create(spellMiscId, caster, target, spell, pos, duration, spellXSpellVisualId, castId, aurEff))
@@ -393,7 +392,7 @@ namespace Game.Entities
{
Player player = unit.ToPlayer();
if (player)
if (player.isDebugAreaTriggers)
if (player.IsDebugAreaTriggers)
player.SendSysMessage(CypherStrings.DebugAreatriggerEntered, GetTemplate().Id);
DoActions(unit);
@@ -408,7 +407,7 @@ namespace Game.Entities
{
Player player = leavingUnit.ToPlayer();
if (player)
if (player.isDebugAreaTriggers)
if (player.IsDebugAreaTriggers)
player.SendSysMessage(CypherStrings.DebugAreatriggerLeft, GetTemplate().Id);
UndoActions(leavingUnit);
@@ -887,7 +886,7 @@ namespace Game.Entities
{
Player player = caster.ToPlayer();
if (player)
if (player.isDebugAreaTriggers)
if (player.IsDebugAreaTriggers)
player.SummonCreature(1, this, TempSummonType.TimedDespawn, GetTimeToTarget());
}
}
+2 -2
View File
@@ -30,8 +30,8 @@ namespace Game.Entities
{
_duration = 0;
objectTypeMask |= TypeMask.Conversation;
objectTypeId = TypeId.Conversation;
ObjectTypeMask |= TypeMask.Conversation;
ObjectTypeId = TypeId.Conversation;
m_updateFlag.Stationary = true;
m_updateFlag.Conversation = true;
+2 -2
View File
@@ -32,8 +32,8 @@ namespace Game.Entities
public Corpse(CorpseType type = CorpseType.Bones) : base(type != CorpseType.Bones)
{
m_type = type;
objectTypeId = TypeId.Corpse;
objectTypeMask |= TypeMask.Corpse;
ObjectTypeId = TypeId.Corpse;
ObjectTypeMask |= TypeMask.Corpse;
m_updateFlag.Stationary = true;
@@ -42,7 +42,7 @@ namespace Game.Entities
public bool m_isTempWorldObject; //true when possessed
ReactStates reactState; // for AI, not charmInfo
public MovementGeneratorType m_defaultMovementType { get; set; }
public MovementGeneratorType DefaultMovementType { get; set; }
public ulong m_spawnId;
byte m_equipmentId;
sbyte m_originalEquipmentId; // can be -1
+68 -68
View File
@@ -41,11 +41,11 @@ namespace Game.Entities
m_corpseDelay = 60;
m_boundaryCheckTime = 2500;
reactState = ReactStates.Aggressive;
m_defaultMovementType = MovementGeneratorType.Idle;
DefaultMovementType = MovementGeneratorType.Idle;
m_regenHealth = true;
m_meleeDamageSchoolMask = SpellSchoolMask.Normal;
m_regenTimer = SharedConst.CreatureRegenInterval;
RegenTimer = SharedConst.CreatureRegenInterval;
m_SightDistance = SharedConst.SightRangeUnit;
@@ -120,11 +120,11 @@ namespace Game.Entities
public void RemoveCorpse(bool setSpawnTime = true, bool destroyForNearbyPlayers = true)
{
if (getDeathState() != DeathState.Corpse)
if (GetDeathState() != DeathState.Corpse)
return;
m_corpseRemoveTime = Time.UnixTime;
setDeathState(DeathState.Dead);
SetDeathState(DeathState.Dead);
RemoveAllAuras();
DestroyForNearbyPlayers(); // old UpdateObjectVisibility()
loot.clear();
@@ -254,9 +254,9 @@ namespace Game.Entities
SetHoverHeight(cinfo.HoverHeight);
// checked at loading
m_defaultMovementType = (MovementGeneratorType)(data != null ? data.movementType : cinfo.MovementType);
if (m_respawnradius == 0 && m_defaultMovementType == MovementGeneratorType.Random)
m_defaultMovementType = MovementGeneratorType.Idle;
DefaultMovementType = (MovementGeneratorType)(data != null ? data.movementType : cinfo.MovementType);
if (m_respawnradius == 0 && DefaultMovementType == MovementGeneratorType.Random)
DefaultMovementType = MovementGeneratorType.Idle;
for (byte i = 0; i < SharedConst.MaxCreatureSpells; ++i)
m_spells[i] = GetCreatureTemplate().Spells[i];
@@ -365,8 +365,8 @@ namespace Game.Entities
{
TriggerJustRespawned = false;
GetAI().JustRespawned();
if (m_vehicleKit != null)
m_vehicleKit.Reset();
if (VehicleKit != null)
VehicleKit.Reset();
}
UpdateMovementFlags();
@@ -514,15 +514,15 @@ namespace Game.Entities
if (!IsAlive())
break;
if (m_regenTimer > 0)
if (RegenTimer > 0)
{
if (diff >= m_regenTimer)
m_regenTimer = 0;
if (diff >= RegenTimer)
RegenTimer = 0;
else
m_regenTimer -= diff;
RegenTimer -= diff;
}
if (m_regenTimer == 0)
if (RegenTimer == 0)
{
bool bInCombat = IsInCombat() && (!GetVictim() || // if IsInCombat() is true and this has no victim
!GetVictim().GetCharmerOrOwnerPlayerOrPlayerItself() || // or the victim/owner/charmer is not a player
@@ -536,7 +536,7 @@ namespace Game.Entities
else
Regenerate(PowerType.Mana);
m_regenTimer = SharedConst.CreatureRegenInterval;
RegenTimer = SharedConst.CreatureRegenInterval;
}
if (CanNotReachTarget() && !IsInEvadeMode() && !GetMap().IsRaid())
@@ -605,7 +605,7 @@ namespace Game.Entities
void RegenerateHealth()
{
if (!isRegeneratingHealth())
if (!IsRegeneratingHealth())
return;
ulong curValue = GetHealth();
@@ -703,12 +703,12 @@ namespace Game.Entities
{
if (m_formation == null)
GetMotionMaster().Initialize();
else if (m_formation.getLeader() == this)
else if (m_formation.GetLeader() == this)
{
m_formation.FormationReset(false);
GetMotionMaster().Initialize();
}
else if (m_formation.isFormed())
else if (m_formation.IsFormed())
GetMotionMaster().MoveIdle(); //wait the order of leader
else
GetMotionMaster().Initialize();
@@ -840,7 +840,7 @@ namespace Game.Entities
SetReactState(ReactStates.Aggressive);
}
public bool isCanInteractWithBattleMaster(Player player, bool msg)
public bool CanInteractWithBattleMaster(Player player, bool msg)
{
if (!IsBattleMaster())
return false;
@@ -882,7 +882,7 @@ namespace Game.Entities
public bool CanResetTalents(Player player)
{
return player.getLevel() >= 15 && player.GetClass() == GetCreatureTemplate().TrainerClass;
return player.GetLevel() >= 15 && player.GetClass() == GetCreatureTemplate().TrainerClass;
}
public void SetTextRepeatId(byte textGroup, byte id)
@@ -977,7 +977,7 @@ namespace Game.Entities
AddDynamicFlag(UnitDynFlags.Tapped);
}
public bool isTappedBy(Player player)
public bool IsTappedBy(Player player)
{
if (player.GetGUID() == m_lootRecipient)
return true;
@@ -1138,7 +1138,7 @@ namespace Game.Entities
{
CreatureTemplate cInfo = GetCreatureTemplate();
CreatureEliteType rank = IsPet() ? 0 : cInfo.Rank;
CreatureBaseStats stats = Global.ObjectMgr.GetCreatureBaseStats(getLevel(), cInfo.UnitClass);
CreatureBaseStats stats = Global.ObjectMgr.GetCreatureBaseStats(GetLevel(), cInfo.UnitClass);
// health
float healthmod = _GetHealthMod(rank);
@@ -1357,7 +1357,7 @@ namespace Game.Entities
SetHealth((m_deathState == DeathState.Alive || m_deathState == DeathState.JustRespawned) ? curhealth : 0);
}
public override bool hasQuest(uint quest_id)
public override bool HasQuest(uint quest_id)
{
var qr = Global.ObjectMgr.GetCreatureQuestRelationBounds(GetEntry());
foreach (var id in qr)
@@ -1368,7 +1368,7 @@ namespace Game.Entities
return false;
}
public override bool hasInvolvedQuest(uint quest_id)
public override bool HasInvolvedQuest(uint quest_id)
{
var qir = Global.ObjectMgr.GetCreatureQuestInvolvedRelationBounds(GetEntry());
foreach (var id in qir)
@@ -1455,7 +1455,7 @@ namespace Game.Entities
if (who.IsInCombat() && IsWithinDist(who, SharedConst.AttackDistance))
{
Unit victim = who.getAttackerForHelper();
Unit victim = who.GetAttackerForHelper();
if (victim != null)
if (IsWithinDistInMap(victim, WorldConfig.GetFloatValue(WorldCfg.CreatureFamilyAssistanceRadius)))
force = true;
@@ -1515,9 +1515,9 @@ namespace Game.Entities
return (aggroRadius * aggroRate);
}
public override void setDeathState(DeathState s)
public override void SetDeathState(DeathState s)
{
base.setDeathState(s);
base.SetDeathState(s);
if (s == DeathState.JustDied)
{
@@ -1528,7 +1528,7 @@ namespace Game.Entities
m_respawnTime = Time.UnixTime + m_respawnDelay + m_corpseDelay;
// always save boss respawn time at death to prevent crash cheating
if (WorldConfig.GetBoolValue(WorldCfg.SaveRespawnTimeImmediately) || isWorldBoss())
if (WorldConfig.GetBoolValue(WorldCfg.SaveRespawnTimeImmediately) || IsWorldBoss())
SaveRespawnTime();
ReleaseFocus(null, false); // remove spellcast focus
@@ -1540,7 +1540,7 @@ namespace Game.Entities
SetMountDisplayId(0); // if creature is mounted on a virtual mount, remove it at death
setActive(false);
SetActive(false);
if (HasSearchedAssistance())
{
@@ -1549,13 +1549,13 @@ namespace Game.Entities
}
//Dismiss group if is leader
if (m_formation != null && m_formation.getLeader() == this)
if (m_formation != null && m_formation.GetLeader() == this)
m_formation.FormationReset(true);
if ((CanFly() || IsFlying()))
GetMotionMaster().MoveFall();
base.setDeathState(DeathState.Corpse);
base.SetDeathState(DeathState.Corpse);
}
else if (s == DeathState.JustRespawned)
{
@@ -1598,7 +1598,7 @@ namespace Game.Entities
}
InitializeMovementAI();
base.setDeathState(DeathState.Alive);
base.SetDeathState(DeathState.Alive);
LoadCreaturesAddon();
}
}
@@ -1610,14 +1610,14 @@ namespace Game.Entities
if (force)
{
if (IsAlive())
setDeathState(DeathState.JustDied);
else if (getDeathState() != DeathState.Corpse)
setDeathState(DeathState.Corpse);
SetDeathState(DeathState.JustDied);
else if (GetDeathState() != DeathState.Corpse)
SetDeathState(DeathState.Corpse);
}
RemoveCorpse(false, false);
if (getDeathState() == DeathState.Dead)
if (GetDeathState() == DeathState.Dead)
{
if (m_spawnId != 0)
GetMap().RemoveCreatureRespawnTime(m_spawnId);
@@ -1632,7 +1632,7 @@ namespace Game.Entities
else
SelectLevel();
setDeathState(DeathState.JustRespawned);
SetDeathState(DeathState.JustRespawned);
CreatureModel display = new CreatureModel(GetNativeDisplayId(), GetNativeDisplayScale(), 1.0f);
if (Global.ObjectMgr.GetCreatureModelRandomGender(ref display, GetCreatureTemplate()) != null)
@@ -1660,7 +1660,7 @@ namespace Game.Entities
UpdateObjectVisibility();
}
public void ForcedDespawn(uint timeMSToDespawn = 0, TimeSpan forceRespawnTimer = default(TimeSpan))
public void ForcedDespawn(uint timeMSToDespawn = 0, TimeSpan forceRespawnTimer = default)
{
if (timeMSToDespawn != 0)
{
@@ -1674,7 +1674,7 @@ namespace Game.Entities
DestroyForNearbyPlayers();
if (IsAlive())
setDeathState(DeathState.JustDied);
SetDeathState(DeathState.JustDied);
bool overrideRespawnTime = true;
if (forceRespawnTimer > TimeSpan.Zero)
@@ -1687,9 +1687,9 @@ namespace Game.Entities
RemoveCorpse(overrideRespawnTime, false);
}
public void DespawnOrUnsummon(TimeSpan time, TimeSpan forceRespawnTimer = default(TimeSpan)) { DespawnOrUnsummon((uint)time.TotalMilliseconds, forceRespawnTimer); }
public void DespawnOrUnsummon(TimeSpan time, TimeSpan forceRespawnTimer = default) { DespawnOrUnsummon((uint)time.TotalMilliseconds, forceRespawnTimer); }
public void DespawnOrUnsummon(uint msTimeToDespawn = 0, TimeSpan forceRespawnTimer = default(TimeSpan))
public void DespawnOrUnsummon(uint msTimeToDespawn = 0, TimeSpan forceRespawnTimer = default)
{
TempSummon summon = ToTempSummon();
if (summon != null)
@@ -1759,7 +1759,7 @@ namespace Game.Entities
return base.IsImmunedToSpellEffect(spellInfo, index, caster);
}
public bool isElite()
public bool IsElite()
{
if (IsPet())
return false;
@@ -1768,7 +1768,7 @@ namespace Game.Entities
return rank != CreatureEliteType.Elite && rank != CreatureEliteType.RareElite;
}
public bool isWorldBoss()
public bool IsWorldBoss()
{
if (IsPet())
return false;
@@ -1776,7 +1776,7 @@ namespace Game.Entities
return Convert.ToBoolean(GetCreatureTemplate().TypeFlags & CreatureTypeFlags.BossMob);
}
public SpellInfo reachWithSpellAttack(Unit victim)
public SpellInfo ReachWithSpellAttack(Unit victim)
{
if (victim == null)
return null;
@@ -1825,7 +1825,7 @@ namespace Game.Entities
return null;
}
SpellInfo reachWithSpellCure(Unit victim)
SpellInfo ReachWithSpellCure(Unit victim)
{
if (victim == null)
return null;
@@ -2013,7 +2013,7 @@ namespace Game.Entities
public bool _IsTargetAcceptable(Unit target)
{
// if the target cannot be attacked, the target is not acceptable
if (IsFriendlyTo(target) || !target.isTargetableForAttack(false)
if (IsFriendlyTo(target) || !target.IsTargetableForAttack(false)
|| (m_vehicle != null && (IsOnVehicle(target) || m_vehicle.GetBase().IsOnVehicle(target))))
return false;
@@ -2026,8 +2026,8 @@ namespace Game.Entities
return false;
}
Unit myVictim = getAttackerForHelper();
Unit targetVictim = target.getAttackerForHelper();
Unit myVictim = GetAttackerForHelper();
Unit targetVictim = target.GetAttackerForHelper();
// if I'm already fighting target, or I'm hostile towards the target, the target is acceptable
if (GetVictim() == target || IsHostileTo(target))
@@ -2062,7 +2062,7 @@ namespace Game.Entities
if (!IsValidAttackTarget(victim))
return false;
if (!victim.isInAccessiblePlaceFor(this))
if (!victim.IsInAccessiblePlaceFor(this))
return false;
if (IsAIEnabled && !GetAI().CanAIAttack(victim))
@@ -2082,7 +2082,7 @@ namespace Game.Entities
return true;
// don't check distance to home position if recently damaged, this should include taunt auras
if (!isWorldBoss() && (GetLastDamagedTime() > GameTime.GetGameTime() || HasAuraType(AuraType.ModTaunt)))
if (!IsWorldBoss() && (GetLastDamagedTime() > GameTime.GetGameTime() || HasAuraType(AuraType.ModTaunt)))
return true;
}
@@ -2302,7 +2302,7 @@ namespace Game.Entities
public void AllLootRemovedFromCorpse()
{
if (loot.loot_type != LootType.Skinning && !IsPet() && GetCreatureTemplate().SkinLootId != 0 && hasLootRecipient())
if (loot.loot_type != LootType.Skinning && !IsPet() && GetCreatureTemplate().SkinLootId != 0 && HasLootRecipient())
if (LootStorage.Skinning.HaveLootFor(GetCreatureTemplate().SkinLootId))
AddUnitFlag(UnitFlags.Skinnable);
@@ -2340,7 +2340,7 @@ namespace Game.Entities
return 1.0f;
uint levelForTarget = GetLevelForTarget(target);
if (getLevel() < levelForTarget)
if (GetLevel() < levelForTarget)
return 1.0f;
return (float)GetMaxHealthByLevel(levelForTarget) / GetCreateHealth();
@@ -2360,7 +2360,7 @@ namespace Game.Entities
uint levelForTarget = GetLevelForTarget(target);
return GetBaseDamageForLevel(levelForTarget) / GetBaseDamageForLevel(getLevel());
return GetBaseDamageForLevel(levelForTarget) / GetBaseDamageForLevel(GetLevel());
}
float GetBaseArmorForLevel(uint level)
@@ -2377,7 +2377,7 @@ namespace Game.Entities
uint levelForTarget = GetLevelForTarget(target);
return GetBaseArmorForLevel(levelForTarget) / GetBaseArmorForLevel(getLevel());
return GetBaseArmorForLevel(levelForTarget) / GetBaseArmorForLevel(GetLevel());
}
public override uint GetLevelForTarget(WorldObject target)
@@ -2385,9 +2385,9 @@ namespace Game.Entities
Unit unitTarget = target.ToUnit();
if (unitTarget)
{
if (isWorldBoss())
if (IsWorldBoss())
{
int level = (int)(unitTarget.getLevel() + WorldConfig.GetIntValue(WorldCfg.WorldBossLevelDiff));
int level = (int)(unitTarget.GetLevel() + WorldConfig.GetIntValue(WorldCfg.WorldBossLevelDiff));
return (uint)MathFunctions.RoundToInterval(ref level, 1u, 255u);
}
@@ -2395,7 +2395,7 @@ namespace Game.Entities
// between UNIT_FIELD_SCALING_LEVEL_MIN and UNIT_FIELD_SCALING_LEVEL_MAX
if (HasScalableLevels())
{
int targetLevelWithDelta = (int)unitTarget.getLevel() + m_unitData.ScalingLevelDelta;
int targetLevelWithDelta = (int)unitTarget.GetLevel() + m_unitData.ScalingLevelDelta;
if (target.IsPlayer())
targetLevelWithDelta += target.ToPlayer().m_activePlayerData.ScalingPlayerLevelDelta;
@@ -2975,7 +2975,7 @@ namespace Game.Entities
SetSpawnHealth();
m_defaultMovementType = (MovementGeneratorType)data.movementType;
DefaultMovementType = (MovementGeneratorType)data.movementType;
loot.SetGUID(ObjectGuid.Create(HighGuid.LootObject, data.mapid, data.id, GetMap().GenerateLowGuid(HighGuid.LootObject)));
@@ -2984,7 +2984,7 @@ namespace Game.Entities
return true;
}
public bool hasLootRecipient() { return !m_lootRecipient.IsEmpty() || !m_lootRecipientGroup.IsEmpty(); }
public bool HasLootRecipient() { return !m_lootRecipient.IsEmpty() || !m_lootRecipientGroup.IsEmpty(); }
public LootModes GetLootMode() { return m_LootMode; }
public bool HasLootMode(LootModes lootMode) { return Convert.ToBoolean(m_LootMode & lootMode); }
@@ -2997,8 +2997,8 @@ namespace Game.Entities
public void SetNoSearchAssistance(bool val) { m_AlreadySearchedAssistance = val; }
public bool HasSearchedAssistance() { return m_AlreadySearchedAssistance; }
MovementGeneratorType GetDefaultMovementType() { return m_defaultMovementType; }
public void SetDefaultMovementType(MovementGeneratorType mgt) { m_defaultMovementType = mgt; }
MovementGeneratorType GetDefaultMovementType() { return DefaultMovementType; }
public void SetDefaultMovementType(MovementGeneratorType mgt) { DefaultMovementType = mgt; }
public long GetRespawnTime() { return m_respawnTime; }
public void SetRespawnTime(uint respawn) { m_respawnTime = respawn != 0 ? Time.UnixTime + respawn : 0; }
@@ -3018,8 +3018,8 @@ namespace Game.Entities
m_combatPulseTime = delay;
}
bool isRegeneratingHealth() { return m_regenHealth; }
public void setRegeneratingHealth(bool regenHealth) { m_regenHealth = regenHealth; }
bool IsRegeneratingHealth() { return m_regenHealth; }
public void SetRegeneratingHealth(bool regenHealth) { m_regenHealth = regenHealth; }
public void SetHomePosition(float x, float y, float z, float o)
{
@@ -3097,7 +3097,7 @@ namespace Game.Entities
for (var i = tauntAuras.Count - 1; i >= 0; i--)
{
caster = tauntAuras[i].GetCaster();
if (caster != null && CanSeeOrDetect(caster, true) && IsValidAttackTarget(caster) && caster.isInAccessiblePlaceFor(ToCreature()))
if (caster != null && CanSeeOrDetect(caster, true) && IsValidAttackTarget(caster) && caster.IsInAccessiblePlaceFor(ToCreature()))
{
target = caster;
break;
@@ -3117,21 +3117,21 @@ namespace Game.Entities
else if (!HasReactState(ReactStates.Passive))
{
// We have player pet probably
target = getAttackerForHelper();
target = GetAttackerForHelper();
if (target == null && IsSummon())
{
Unit owner = ToTempSummon().GetOwner();
if (owner != null)
{
if (owner.IsInCombat())
target = owner.getAttackerForHelper();
target = owner.GetAttackerForHelper();
if (target == null)
{
foreach (var unit in owner.m_Controlled)
{
if (unit.IsInCombat())
{
target = unit.getAttackerForHelper();
target = unit.GetAttackerForHelper();
if (target)
break;
}
@@ -3247,7 +3247,7 @@ namespace Game.Entities
public class ForcedDespawnDelayEvent : BasicEvent
{
public ForcedDespawnDelayEvent(Creature owner, TimeSpan respawnTimer = default(TimeSpan))
public ForcedDespawnDelayEvent(Creature owner, TimeSpan respawnTimer = default)
{
m_owner = owner;
m_respawnTimer = respawnTimer;
@@ -21,7 +21,6 @@ using System;
using System.Collections.Generic;
using Framework.Dynamic;
using Game.Network.Packets;
using Game.Network;
namespace Game.Entities
{
@@ -54,7 +54,7 @@ namespace Game.Entities
Log.outDebug(LogFilter.Unit, "Deleting member GUID: {0} from group {1}", group.GetId(), member.GetSpawnId());
group.RemoveMember(member);
if (group.isEmpty())
if (group.IsEmpty())
{
Map map = member.GetMap();
if (!map)
@@ -264,10 +264,10 @@ namespace Game.Entities
}
}
public Creature getLeader() { return m_leader; }
public Creature GetLeader() { return m_leader; }
public uint GetId() { return m_groupID; }
public bool isEmpty() { return m_members.Empty(); }
public bool isFormed() { return m_Formed; }
public bool IsEmpty() { return m_members.Empty(); }
public bool IsFormed() { return m_Formed; }
Creature m_leader;
Dictionary<Creature, FormationInfo> m_members = new Dictionary<Creature, FormationInfo>();
+1 -1
View File
@@ -123,7 +123,7 @@ namespace Game.Entities
return TrainerSpellState.Unavailable;
// check level requirement
if (player.getLevel() < trainerSpell.ReqLevel)
if (player.GetLevel() < trainerSpell.ReqLevel)
return TrainerSpellState.Unavailable;
// check ranks
+3 -3
View File
@@ -25,8 +25,8 @@ namespace Game.Entities
{
public DynamicObject(bool isWorldObject) : base(isWorldObject)
{
objectTypeMask |= TypeMask.DynamicObject;
objectTypeId = TypeId.DynamicObject;
ObjectTypeMask |= TypeMask.DynamicObject;
ObjectTypeId = TypeId.DynamicObject;
m_updateFlag.Stationary = true;
@@ -100,7 +100,7 @@ namespace Game.Entities
SetUpdateFieldValue(m_values.ModifyValue(m_dynamicObjectData).ModifyValue(m_dynamicObjectData.CastTime), GameTime.GetGameTimeMS());
if (IsWorldObject())
setActive(true); //must before add to map to be put in world container
SetActive(true); //must before add to map to be put in world container
Transport transport = caster.GetTransport();
if (transport)
+26 -27
View File
@@ -18,7 +18,6 @@
using Framework.Constants;
using Framework.Database;
using Framework.GameMath;
using Framework.IO;
using Game.AI;
using Game.BattleGrounds;
using Game.Collision;
@@ -39,8 +38,8 @@ namespace Game.Entities
{
public GameObject() : base(false)
{
objectTypeMask |= TypeMask.GameObject;
objectTypeId = TypeId.GameObject;
ObjectTypeMask |= TypeMask.GameObject;
ObjectTypeId = TypeId.GameObject;
m_updateFlag.Stationary = true;
m_updateFlag.Rotation = true;
@@ -50,7 +49,7 @@ namespace Game.Entities
m_spawnedByDefault = true;
ResetLootMode(); // restore default loot mode
m_stationaryPosition = new Position();
StationaryPosition = new Position();
m_gameObjectData = new GameObjectFieldData();
}
@@ -125,7 +124,7 @@ namespace Game.Entities
GetMap().GetGameObjectBySpawnIdStore().Add(m_spawnId, this);
// The state can be changed after GameObject.Create but before GameObject.AddToWorld
bool toggledState = GetGoType() == GameObjectTypes.Chest ? getLootState() == LootState.Ready : (GetGoState() == GameObjectState.Ready || IsTransport());
bool toggledState = GetGoType() == GameObjectTypes.Chest ? GetLootState() == LootState.Ready : (GetGoState() == GameObjectState.Ready || IsTransport());
if (m_model != null)
{
Transport trans = ToTransport();
@@ -188,7 +187,7 @@ namespace Game.Entities
SetMap(map);
Relocate(pos);
m_stationaryPosition.Relocate(pos);
StationaryPosition.Relocate(pos);
if (!IsPositionValid())
{
Log.outError(LogFilter.Server, "Gameobject (Spawn id: {0} Entry: {1}) not created. Suggested coordinates isn't valid (X: {2} Y: {3})", GetSpawnId(), entry, pos.GetPositionX(), pos.GetPositionY());
@@ -583,7 +582,7 @@ namespace Game.Entities
}
}
if (isSpawned())
if (IsSpawned())
{
GameObjectTemplate goInfo = GetGoInfo();
uint max_charges;
@@ -812,7 +811,7 @@ namespace Game.Entities
if (m_respawnTime > 0 && m_spawnedByDefault)
return;
if (isSpawned())
if (IsSpawned())
GetMap().AddToMap(this);
}
@@ -848,7 +847,7 @@ namespace Game.Entities
SendMessageToSet(packet, true);
}
public void getFishLoot(Loot fishloot, Player loot_owner)
public void GetFishLoot(Loot fishloot, Player loot_owner)
{
fishloot.clear();
@@ -868,7 +867,7 @@ namespace Game.Entities
}
}
public void getFishLootJunk(Loot fishloot, Player loot_owner)
public void GetFishLootJunk(Loot fishloot, Player loot_owner)
{
fishloot.clear();
@@ -1039,7 +1038,7 @@ namespace Game.Entities
DB.World.Execute(stmt);
}
public override bool hasQuest(uint quest_id)
public override bool HasQuest(uint quest_id)
{
var qr = Global.ObjectMgr.GetGOQuestRelationBounds(GetEntry());
@@ -1051,7 +1050,7 @@ namespace Game.Entities
return false;
}
public override bool hasInvolvedQuest(uint quest_id)
public override bool HasInvolvedQuest(uint quest_id)
{
var qir = Global.ObjectMgr.GetGOQuestInvolvedRelationBounds(GetEntry());
foreach (var id in qir)
@@ -1138,7 +1137,7 @@ namespace Game.Entities
return true;
Unit owner = GetOwner();
if (owner != null && seer.isTypeMask(TypeMask.Unit) && owner.IsFriendlyTo(seer.ToUnit()))
if (owner != null && seer.IsTypeMask(TypeMask.Unit) && owner.IsFriendlyTo(seer.ToUnit()))
return true;
}
@@ -1151,7 +1150,7 @@ namespace Game.Entities
return true;
// Despawned
if (!isSpawned())
if (!IsSpawned())
return true;
return false;
@@ -1545,7 +1544,7 @@ namespace Game.Entities
if (player.GetGUID() != GetOwnerGUID())
return;
switch (getLootState())
switch (GetLootState())
{
case LootState.Ready: // ready for loot
{
@@ -1752,10 +1751,10 @@ namespace Game.Entities
return;
//required lvl checks!
uint level = player.getLevel();
uint level = player.GetLevel();
if (level < info.MeetingStone.minLevel)
return;
level = targetPlayer.getLevel();
level = targetPlayer.GetLevel();
if (level < info.MeetingStone.minLevel)
return;
@@ -2625,13 +2624,13 @@ namespace Game.Entities
m_respawnDelayTime = (uint)(respawn > 0 ? respawn : 0);
}
public bool isSpawned()
public bool IsSpawned()
{
return m_respawnDelayTime == 0 ||
(m_respawnTime > 0 && !m_spawnedByDefault) ||
(m_respawnTime == 0 && m_spawnedByDefault);
}
public bool isSpawnedByDefault() { return m_spawnedByDefault; }
public bool IsSpawnedByDefault() { return m_spawnedByDefault; }
public void SetSpawnedByDefault(bool b) { m_spawnedByDefault = b; }
public uint GetRespawnDelay() { return m_respawnDelayTime; }
@@ -2648,7 +2647,7 @@ namespace Game.Entities
byte GetGoAnimProgress() { return m_gameObjectData.PercentHealth; }
public void SetGoAnimProgress(uint animprogress) { SetUpdateFieldValue(m_values.ModifyValue(m_gameObjectData).ModifyValue(m_gameObjectData.PercentHealth), (byte)animprogress); }
public LootState getLootState() { return m_lootState; }
public LootState GetLootState() { return m_lootState; }
public LootModes GetLootMode() { return m_LootMode; }
bool HasLootMode(LootModes lootMode) { return Convert.ToBoolean(m_LootMode & lootMode); }
void SetLootMode(LootModes lootMode) { m_LootMode = lootMode; }
@@ -2701,12 +2700,12 @@ namespace Game.Entities
public uint GetFaction() { return m_gameObjectData.FactionTemplate; }
public void SetFaction(uint faction) { SetUpdateFieldValue(m_values.ModifyValue(m_gameObjectData).ModifyValue(m_gameObjectData.FactionTemplate), faction); }
public override float GetStationaryX() { return m_stationaryPosition.GetPositionX(); }
public override float GetStationaryY() { return m_stationaryPosition.GetPositionY(); }
public override float GetStationaryZ() { return m_stationaryPosition.GetPositionZ(); }
public override float GetStationaryO() { return m_stationaryPosition.GetOrientation(); }
public override float GetStationaryX() { return StationaryPosition.GetPositionX(); }
public override float GetStationaryY() { return StationaryPosition.GetPositionY(); }
public override float GetStationaryZ() { return StationaryPosition.GetPositionZ(); }
public override float GetStationaryO() { return StationaryPosition.GetOrientation(); }
public void RelocateStationaryPosition(float x, float y, float z, float o) { m_stationaryPosition.Relocate(x, y, z, o); }
public void RelocateStationaryPosition(float x, float y, float z, float o) { StationaryPosition.Relocate(x, y, z, o); }
//! Object distance/size - overridden from Object._IsWithinDist. Needs to take in account proper GO size.
public override bool _IsWithinDist(WorldObject obj, float dist2compare, bool is3D)
@@ -2748,7 +2747,7 @@ namespace Game.Entities
public ObjectGuid lootingGroupLowGUID; // used to find group which is looting
long m_packedRotation;
Quaternion m_worldRotation;
public Position m_stationaryPosition { get; set; }
public Position StationaryPosition { get; set; }
GameObjectAI m_AI;
ushort _animKitId;
@@ -2774,7 +2773,7 @@ namespace Game.Entities
_owner = owner;
}
public override bool IsSpawned() { return _owner.isSpawned(); }
public override bool IsSpawned() { return _owner.IsSpawned(); }
public override uint GetDisplayId() { return _owner.GetDisplayId(); }
public override byte GetNameSetId() { return _owner.GetNameSetId(); }
public override bool IsInPhase(PhaseShift phaseShift) { return _owner.GetPhaseShift().CanSee(phaseShift); }
@@ -20,7 +20,6 @@ using Framework.Constants;
using Framework.GameMath;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Game.Network;
using Game.Network.Packets;
namespace Game.Entities
+2 -2
View File
@@ -25,8 +25,8 @@ namespace Game.Entities
{
public Bag()
{
objectTypeMask |= TypeMask.Container;
objectTypeId = TypeId.Container;
ObjectTypeMask |= TypeMask.Container;
ObjectTypeId = TypeId.Container;
m_containerData = new ContainerData();
}
+8 -9
View File
@@ -18,7 +18,6 @@
using Framework.Collections;
using Framework.Constants;
using Framework.Database;
using Framework.IO;
using Game.DataStorage;
using Game.Loots;
using Game.Network;
@@ -36,8 +35,8 @@ namespace Game.Entities
{
public Item() : base(false)
{
objectTypeMask |= TypeMask.Item;
objectTypeId = TypeId.Item;
ObjectTypeMask |= TypeMask.Item;
ObjectTypeId = TypeId.Item;
m_itemData = new ItemData();
@@ -911,7 +910,7 @@ namespace Game.Entities
return true;
}
public void SetEnchantment(EnchantmentSlot slot, uint id, uint duration, uint charges, ObjectGuid caster = default(ObjectGuid))
public void SetEnchantment(EnchantmentSlot slot, uint id, uint duration, uint charges, ObjectGuid caster = default)
{
// Better lost small time at check in comparison lost time at item save to DB.
if ((GetEnchantmentId(slot) == id) && (GetEnchantmentDuration(slot) == duration) && (GetEnchantmentCharges(slot) == charges))
@@ -922,7 +921,7 @@ namespace Game.Entities
{
uint oldEnchant = GetEnchantmentId(slot);
if (oldEnchant != 0)
owner.GetSession().SendEnchantmentLog(GetOwnerGUID(), ObjectGuid.Empty, GetGUID(), GetEntry(), (uint)oldEnchant, (uint)slot);
owner.GetSession().SendEnchantmentLog(GetOwnerGUID(), ObjectGuid.Empty, GetGUID(), GetEntry(), oldEnchant, (uint)slot);
if (id != 0)
owner.GetSession().SendEnchantmentLog(GetOwnerGUID(), caster, GetGUID(), GetEntry(), id, (uint)slot);
@@ -1893,7 +1892,7 @@ namespace Game.Entities
uint minItemLevelCutoff = owner.m_unitData.MinItemLevelCutoff;
uint maxItemLevel = GetTemplate().GetFlags3().HasAnyFlag(ItemFlags3.IgnoreItemLevelCapInPvp) ? 0u : owner.m_unitData.MaxItemLevel;
bool pvpBonus = owner.IsUsingPvpItemLevels();
return GetItemLevel(GetTemplate(), _bonusData, owner.getLevel(), GetModifier(ItemModifier.ScalingStatDistributionFixedLevel), GetModifier(ItemModifier.UpgradeId),
return GetItemLevel(GetTemplate(), _bonusData, owner.GetLevel(), GetModifier(ItemModifier.ScalingStatDistributionFixedLevel), GetModifier(ItemModifier.UpgradeId),
minItemLevel, minItemLevelCutoff, maxItemLevel, pvpBonus);
}
@@ -2607,8 +2606,8 @@ namespace Game.Entities
uState = state;
}
public override bool hasQuest(uint quest_id) { return GetTemplate().GetStartQuest() == quest_id; }
public override bool hasInvolvedQuest(uint quest_id) { return false; }
public override bool HasQuest(uint quest_id) { return GetTemplate().GetStartQuest() == quest_id; }
public override bool HasInvolvedQuest(uint quest_id) { return false; }
public bool IsPotion() { return GetTemplate().IsPotion(); }
public bool IsVellum() { return GetTemplate().IsVellum(); }
public bool IsConjuredConsumable() { return GetTemplate().IsConjuredConsumable(); }
@@ -2762,7 +2761,7 @@ namespace Game.Entities
count = _count;
}
public bool isContainedIn(List<ItemPosCount> vec)
public bool IsContainedIn(List<ItemPosCount> vec)
{
foreach (var posCount in vec)
if (posCount.pos == pos)
+2 -2
View File
@@ -234,9 +234,9 @@ namespace Game.Entities
return false;
int levelIndex = 0;
if (player.getLevel() >= 110)
if (player.GetLevel() >= 110)
levelIndex = 2;
else if (player.getLevel() > 40)
else if (player.GetLevel() > 40)
levelIndex = 1;
return Specializations[levelIndex].Get(CalculateItemSpecBit(chrSpecialization));
+6 -6
View File
@@ -25,6 +25,9 @@ namespace Game.Entities
public static ObjectGuid Empty = new ObjectGuid();
public static ObjectGuid TradeItem = Create(HighGuid.Uniq, 10ul);
ulong _low;
ulong _high;
public ObjectGuid(ulong high, ulong low)
{
_low = low;
@@ -321,13 +324,13 @@ namespace Game.Entities
return false;
}
}
ulong _low;
ulong _high;
}
public class ObjectGuidGenerator
{
ulong _nextGuid;
HighGuid _highGuid;
public ObjectGuidGenerator(HighGuid highGuid, ulong start = 1)
{
_highGuid = highGuid;
@@ -350,8 +353,5 @@ namespace Game.Entities
Log.outFatal(LogFilter.Server, "{0} guid overflow!! Can't continue, shutting down server. ", _highGuid);
Global.WorldMgr.StopNow();
}
ulong _nextGuid;
HighGuid _highGuid;
}
}
+11 -11
View File
@@ -23,6 +23,11 @@ namespace Game.Entities
{
public class Position
{
public float posX;
public float posY;
public float posZ;
public float Orientation;
public Position(float x = 0f, float y = 0f, float z = 0f, float o = 0f)
{
posX = x;
@@ -321,15 +326,16 @@ namespace Game.Entities
{
return $"X: {posX} Y: {posY} Z: {posZ} O: {Orientation}";
}
public float posX;
public float posY;
public float posZ;
public float Orientation;
}
public class WorldLocation : Position
{
uint _mapId;
Cell currentCell;
public ObjectCellMoveState _moveState;
public Position _newPosition = new Position();
public WorldLocation(uint mapId = 0xFFFFFFFF, float x = 0, float y = 0, float z = 0, float o = 0)
{
_mapId = mapId;
@@ -384,11 +390,5 @@ namespace Game.Entities
{
return this;
}
uint _mapId;
Cell currentCell;
public ObjectCellMoveState _moveState;
public Position _newPosition = new Position();
}
}
@@ -24,6 +24,11 @@ namespace Game.Entities
{
public class UpdateData
{
uint MapId;
uint BlockCount;
List<ObjectGuid> outOfRangeGUIDs = new List<ObjectGuid>();
ByteBuffer data = new ByteBuffer();
public UpdateData(uint mapId)
{
MapId = mapId;
@@ -82,10 +87,5 @@ namespace Game.Entities
public List<ObjectGuid> GetOutOfRangeGUIDs() { return outOfRangeGUIDs; }
public void SetMapId(ushort mapId) { MapId = mapId; }
uint MapId;
uint BlockCount;
List<ObjectGuid> outOfRangeGUIDs = new List<ObjectGuid>();
ByteBuffer data = new ByteBuffer();
}
}
@@ -27,6 +27,9 @@ namespace Game.Entities
{
public class UpdateFieldHolder
{
UpdateMask _changesMask = new UpdateMask((int)TypeId.Max);
WorldObject _owner;
public UpdateFieldHolder(WorldObject owner) { _owner = owner; }
public BaseUpdateData<T> ModifyValue<T>(BaseUpdateData<T> updateData)
@@ -59,9 +62,6 @@ namespace Game.Entities
{
return _changesMask[(int)index];
}
UpdateMask _changesMask = new UpdateMask((int)TypeId.Max);
WorldObject _owner;
}
public interface IUpdateField<T>
@@ -430,6 +430,9 @@ namespace Game.Entities
public class DynamicUpdateFieldSetter<T> : IUpdateField<T> where T : new()
{
DynamicUpdateField<T> _dynamicUpdateField;
int _index;
public DynamicUpdateFieldSetter(DynamicUpdateField<T> dynamicUpdateField, int index)
{
_dynamicUpdateField = dynamicUpdateField;
@@ -447,8 +450,5 @@ namespace Game.Entities
{
return dynamicUpdateFieldSetter.GetValue();
}
DynamicUpdateField<T> _dynamicUpdateField;
int _index;
}
}
@@ -19,9 +19,7 @@ using Framework.Constants;
using Game.Network;
using System;
using System.Collections.Generic;
using System.Linq;
using Framework.GameMath;
using System.Runtime.CompilerServices;
using Game.Spells;
using Game.DataStorage;
@@ -84,10 +82,10 @@ namespace Game.Entities
Creature creature = obj.ToCreature();
if (creature != null)
{
if (creature.hasLootRecipient() && !creature.isTappedBy(receiver))
if (creature.HasLootRecipient() && !creature.IsTappedBy(receiver))
unitDynFlags |= UnitDynFlags.Tapped;
if (!receiver.isAllowedToLoot(creature))
if (!receiver.IsAllowedToLoot(creature))
unitDynFlags &= ~UnitDynFlags.Lootable;
}
@@ -1998,7 +1996,7 @@ namespace Game.Entities
CreatureTemplate cinfo = unit.ToCreature().GetCreatureTemplate();
// this also applies for transform auras
SpellInfo transform = Global.SpellMgr.GetSpellInfo(unit.getTransForm());
SpellInfo transform = Global.SpellMgr.GetSpellInfo(unit.GetTransForm());
if (transform != null)
{
foreach (SpellEffectInfo effect in transform.GetEffectsForDifficulty(unit.GetMap().GetDifficultyID()))
@@ -15,9 +15,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Framework.IO;
using System.Collections;
using System;
namespace Game.Entities
+49 -56
View File
@@ -15,26 +15,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Collections;
using Framework.Constants;
using Framework.Dynamic;
using Framework.GameMath;
using Framework.IO;
using Game.AI;
using Game.BattleFields;
using Game.DataStorage;
using Game.Maps;
using Game.Network;
using Game.Network.Packets;
using Game.Scenarios;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Linq.Expressions;
using System.Reflection;
namespace Game.Entities
{
@@ -48,8 +39,8 @@ namespace Game.Entities
m_serverSideVisibility.SetValue(ServerSideVisibilityType.Ghost, GhostVisibilityType.Alive | GhostVisibilityType.Ghost);
m_serverSideVisibilityDetect.SetValue(ServerSideVisibilityType.Ghost, GhostVisibilityType.Alive);
objectTypeId = TypeId.Object;
objectTypeMask = TypeMask.Object;
ObjectTypeId = TypeId.Object;
ObjectTypeMask = TypeMask.Object;
m_values = new UpdateFieldHolder(this);
@@ -75,7 +66,7 @@ namespace Game.Entities
if (IsInWorld)
{
Log.outFatal(LogFilter.Misc, "WorldObject.Dispose() {0} deleted but still in world!!", GetGUID().ToString());
if (isTypeMask(TypeMask.Item))
if (IsTypeMask(TypeMask.Item))
Log.outFatal(LogFilter.Misc, "Item slot {0}", ((Item)this).GetSlot());
Cypher.Assert(false);
}
@@ -107,7 +98,7 @@ namespace Game.Entities
if (!IsInWorld)
return;
if (!objectTypeMask.HasAnyFlag(TypeMask.Item | TypeMask.Container))
if (!ObjectTypeMask.HasAnyFlag(TypeMask.Item | TypeMask.Container))
DestroyForNearbyPlayers();
IsInWorld = false;
@@ -120,8 +111,8 @@ namespace Game.Entities
return;
UpdateType updateType = UpdateType.CreateObject;
TypeId tempObjectType = objectTypeId;
TypeMask tempObjectTypeMask = objectTypeMask;
TypeId tempObjectType = ObjectTypeId;
TypeMask tempObjectTypeMask = ObjectTypeMask;
CreateObjectBits flags = m_updateFlag;
if (target == this)
@@ -164,7 +155,7 @@ namespace Game.Entities
if (flags.Stationary)
{
// UPDATETYPE_CREATE_OBJECT2 for some gameobject types...
if (isTypeMask(TypeMask.GameObject))
if (IsTypeMask(TypeMask.GameObject))
{
switch (ToGameObject().GetGoType())
{
@@ -357,7 +348,7 @@ namespace Game.Entities
// HasMovementSpline - marks that spline data is present in packet
if (HasSpline)
MovementExtensions.WriteCreateObjectSplineDataBlock(unit.moveSpline, data);
MovementExtensions.WriteCreateObjectSplineDataBlock(unit.MoveSpline, data);
}
data.WriteInt32(PauseTimesCount);
@@ -949,7 +940,7 @@ namespace Game.Entities
GetMap().AddObjectToSwitchList(this, on);
}
public void setActive(bool on)
public void SetActive(bool on)
{
if (m_isActive == on)
return;
@@ -1039,7 +1030,7 @@ namespace Game.Entities
public float GetGridActivationRange()
{
if (isActiveObject())
if (IsActiveObject())
{
if (GetTypeId() == TypeId.Player && ToPlayer().GetCinematicMgr().IsOnCinematic())
return Math.Max(SharedConst.DefaultVisibilityInstance, GetMap().GetVisibilityRange());
@@ -1057,7 +1048,7 @@ namespace Game.Entities
{
if (IsVisibilityOverridden() && !IsTypeId(TypeId.Player))
return m_visibilityDistanceOverride.Value;
else if (isActiveObject() && !IsTypeId(TypeId.Player))
else if (IsActiveObject() && !IsTypeId(TypeId.Player))
return SharedConst.MaxVisibilityDistance;
else
return GetMap().GetVisibilityRange();
@@ -1071,7 +1062,7 @@ namespace Game.Entities
{
if (target != null && target.IsVisibilityOverridden() && !target.IsTypeId(TypeId.Player))
return target.m_visibilityDistanceOverride.Value;
else if (target != null && target.isActiveObject() && !target.IsTypeId(TypeId.Player))
else if (target != null && target.IsActiveObject() && !target.IsTypeId(TypeId.Player))
return SharedConst.MaxVisibilityDistance;
else if (ToPlayer().GetCinematicMgr().IsOnCinematic())
return SharedConst.DefaultVisibilityInstance;
@@ -1084,7 +1075,7 @@ namespace Game.Entities
return SharedConst.SightRangeUnit;
}
if (IsTypeId(TypeId.DynamicObject) && isActiveObject())
if (IsTypeId(TypeId.DynamicObject) && IsActiveObject())
{
return GetMap().GetVisibilityRange();
}
@@ -1493,7 +1484,7 @@ namespace Game.Entities
if (IsTypeId(TypeId.Player) || IsTypeId(TypeId.Unit))
{
summon.SetFaction(ToUnit().GetFaction());
summon.SetLevel(ToUnit().getLevel());
summon.SetLevel(ToUnit().GetLevel());
}
if (AI != null)
@@ -1647,7 +1638,7 @@ namespace Game.Entities
if (!player.HaveAtClient(this))
continue;
if (isTypeMask(TypeMask.Unit) && (ToUnit().GetCharmerGUID() == player.GetGUID()))// @todo this is for puppet
if (IsTypeMask(TypeMask.Unit) && (ToUnit().GetCharmerGUID() == player.GetGUID()))// @todo this is for puppet
continue;
DestroyForPlayer(player);
@@ -1707,17 +1698,17 @@ namespace Game.Entities
public void RemoveDynamicFlag(UnitDynFlags flag) { RemoveUpdateFieldFlagValue(m_values.ModifyValue(m_objectData).ModifyValue(m_objectData.DynamicFlags), (uint)flag); }
public void SetDynamicFlags(UnitDynFlags flag) { SetUpdateFieldValue(m_values.ModifyValue(m_objectData).ModifyValue(m_objectData.DynamicFlags), (uint)flag); }
public TypeId GetTypeId() { return objectTypeId; }
public TypeId GetTypeId() { return ObjectTypeId; }
public bool IsTypeId(TypeId typeId) { return GetTypeId() == typeId; }
public bool isTypeMask(TypeMask mask) { return Convert.ToBoolean(mask & objectTypeMask); }
public bool IsTypeMask(TypeMask mask) { return Convert.ToBoolean(mask & ObjectTypeMask); }
public virtual bool hasQuest(uint questId) { return false; }
public virtual bool hasInvolvedQuest(uint questId) { return false; }
public virtual bool HasQuest(uint questId) { return false; }
public virtual bool HasInvolvedQuest(uint questId) { return false; }
public bool IsCreature() { return GetTypeId() == TypeId.Unit; }
public bool IsPlayer() { return GetTypeId() == TypeId.Player; }
public bool IsGameObject() { return GetTypeId() == TypeId.GameObject; }
public bool IsUnit() { return isTypeMask(TypeMask.Unit); }
public bool IsUnit() { return IsTypeMask(TypeMask.Unit); }
public bool IsCorpse() { return GetTypeId() == TypeId.Corpse; }
public bool IsDynObject() { return GetTypeId() == TypeId.DynamicObject; }
public bool IsAreaTrigger() { return GetTypeId() == TypeId.AreaTrigger; }
@@ -1741,13 +1732,13 @@ namespace Game.Entities
public ZoneScript GetZoneScript() { return m_zoneScript; }
public void AddToNotify(NotifyFlags f) { m_notifyflags |= f; }
public bool isNeedNotify(NotifyFlags f) { return Convert.ToBoolean(m_notifyflags & f); }
public bool IsNeedNotify(NotifyFlags f) { return Convert.ToBoolean(m_notifyflags & f); }
NotifyFlags GetNotifyFlags() { return m_notifyflags; }
bool NotifyExecuted(NotifyFlags f) { return Convert.ToBoolean(m_executed_notifies & f); }
void SetNotified(NotifyFlags f) { m_executed_notifies |= f; }
public void ResetAllNotifies() { m_notifyflags = 0; m_executed_notifies = 0; }
public bool isActiveObject() { return m_isActive; }
public bool IsActiveObject() { return m_isActive; }
public bool IsPermanentWorldObject() { return m_isWorldObject; }
public Transport GetTransport() { return m_transport; }
@@ -2007,12 +1998,12 @@ namespace Game.Entities
return (size * size) >= GetExactDist2dSq(pos1.GetPositionX() + (float)Math.Cos(angle) * dist, pos1.GetPositionY() + (float)Math.Sin(angle) * dist);
}
public bool isInFront(WorldObject target, float arc = MathFunctions.PI)
public bool IsInFront(WorldObject target, float arc = MathFunctions.PI)
{
return HasInArc(arc, target);
}
public bool isInBack(WorldObject target, float arc = MathFunctions.PI)
public bool IsInBack(WorldObject target, float arc = MathFunctions.PI)
{
return !HasInArc(2 * MathFunctions.PI - arc, target);
}
@@ -2333,8 +2324,8 @@ namespace Game.Entities
public void SetLocationInstanceId(uint _instanceId) { instanceId = _instanceId; }
#region Fields
public TypeMask objectTypeMask { get; set; }
protected TypeId objectTypeId { get; set; }
public TypeMask ObjectTypeMask { get; set; }
protected TypeId ObjectTypeId { get; set; }
protected CreateObjectBits m_updateFlag;
ObjectGuid m_guid;
@@ -2381,11 +2372,21 @@ namespace Game.Entities
public class MovementInfo
{
public ObjectGuid Guid { get; set; }
MovementFlag flags;
MovementFlag2 flags2;
public Position Pos { get; set; }
public uint Time { get; set; }
public TransportInfo transport;
public float Pitch { get; set; }
public JumpInfo jump;
public float SplineElevation { get; set; }
public MovementInfo()
{
Guid = ObjectGuid.Empty;
Flags = MovementFlag.None;
Flags2 = MovementFlag2.None;
flags = MovementFlag.None;
flags2 = MovementFlag2.None;
Time = 0;
Pitch = 0.0f;
@@ -2394,17 +2395,17 @@ namespace Game.Entities
jump.Reset();
}
public MovementFlag GetMovementFlags() { return Flags; }
public void SetMovementFlags(MovementFlag f) { Flags = f; }
public void AddMovementFlag(MovementFlag f) { Flags |= f; }
public void RemoveMovementFlag(MovementFlag f) { Flags &= ~f; }
public bool HasMovementFlag(MovementFlag f) { return Convert.ToBoolean(Flags & f); }
public MovementFlag GetMovementFlags() { return flags; }
public void SetMovementFlags(MovementFlag f) { flags = f; }
public void AddMovementFlag(MovementFlag f) { flags |= f; }
public void RemoveMovementFlag(MovementFlag f) { flags &= ~f; }
public bool HasMovementFlag(MovementFlag f) { return Convert.ToBoolean(flags & f); }
public MovementFlag2 GetMovementFlags2() { return Flags2; }
public void SetMovementFlags2(MovementFlag2 f) { Flags2 = f; }
public void AddMovementFlag2(MovementFlag2 f) { Flags2 |= f; }
public void RemoveMovementFlag2(MovementFlag2 f) { Flags2 &= ~f; }
public bool HasMovementFlag2(MovementFlag2 f) { return Convert.ToBoolean(Flags2 & f); }
public MovementFlag2 GetMovementFlags2() { return flags2; }
public void SetMovementFlags2(MovementFlag2 f) { flags2 = f; }
public void AddMovementFlag2(MovementFlag2 f) { flags2 |= f; }
public void RemoveMovementFlag2(MovementFlag2 f) { flags2 &= ~f; }
public bool HasMovementFlag2(MovementFlag2 f) { return Convert.ToBoolean(flags2 & f); }
public void SetFallTime(uint time) { jump.fallTime = time; }
@@ -2418,15 +2419,7 @@ namespace Game.Entities
jump.Reset();
}
public ObjectGuid Guid { get; set; }
MovementFlag Flags { get; set; }
MovementFlag2 Flags2 { get; set; }
public Position Pos { get; set; }
public uint Time { get; set; }
public TransportInfo transport;
public float Pitch { get; set; }
public JumpInfo jump;
public float SplineElevation { get; set; }
public struct TransportInfo
{
+79 -79
View File
@@ -40,13 +40,13 @@ namespace Game.Entities
Cypher.Assert(GetOwner().IsTypeId(TypeId.Player));
m_unitTypeMask |= UnitTypeMask.Pet;
UnitTypeMask |= UnitTypeMask.Pet;
if (type == PetType.Hunter)
m_unitTypeMask |= UnitTypeMask.HunterPet;
UnitTypeMask |= UnitTypeMask.HunterPet;
if (!m_unitTypeMask.HasAnyFlag(UnitTypeMask.ControlableGuardian))
if (!UnitTypeMask.HasAnyFlag(UnitTypeMask.ControlableGuardian))
{
m_unitTypeMask |= UnitTypeMask.ControlableGuardian;
UnitTypeMask |= UnitTypeMask.ControlableGuardian;
InitCharmInfo();
}
@@ -173,7 +173,7 @@ namespace Game.Entities
PhasingHandler.InheritPhaseShift(this, owner);
setPetType(petType);
SetPetType(petType);
SetFaction(owner.GetFaction());
SetCreatedBySpell(summonSpellId);
@@ -203,10 +203,10 @@ namespace Game.Entities
SetNpcFlags2(NPCFlags2.None);
SetName(result.Read<string>(8));
switch (getPetType())
switch (GetPetType())
{
case PetType.Summon:
petlevel = owner.getLevel();
petlevel = owner.GetLevel();
SetClass(Class.Mage);
SetUnitFlags(UnitFlags.PvpAttackable); // this enables popup window (pet dismiss, cancel)
@@ -220,7 +220,7 @@ namespace Game.Entities
break;
default:
if (!IsPetGhoul())
Log.outError(LogFilter.Pet, "Pet have incorrect type ({0}) for pet loading.", getPetType());
Log.outError(LogFilter.Pet, "Pet have incorrect type ({0}) for pet loading.", GetPetType());
break;
}
@@ -244,14 +244,14 @@ namespace Game.Entities
SetReactState((ReactStates)result.Read<byte>(6));
SetCanModifyStats(true);
if (getPetType() == PetType.Summon && !current) //all (?) summon pets come with full health when called, but not when they are current
if (GetPetType() == PetType.Summon && !current) //all (?) summon pets come with full health when called, but not when they are current
SetFullPower(PowerType.Mana);
else
{
uint savedhealth = result.Read<uint>(10);
uint savedmana = result.Read<uint>(11);
if (savedhealth == 0 && getPetType() == PetType.Hunter)
setDeathState(DeathState.JustDied);
if (savedhealth == 0 && GetPetType() == PetType.Hunter)
SetDeathState(DeathState.JustDied);
else
{
SetHealth(savedhealth);
@@ -335,7 +335,7 @@ namespace Game.Entities
SetGroupUpdateFlag(GroupUpdatePetFlags.Full);
if (getPetType() == PetType.Hunter)
if (GetPetType() == PetType.Hunter)
{
stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_PET_DECLINED_NAME);
stmt.AddValue(0, owner.GetGUID().GetCounter());
@@ -353,7 +353,7 @@ namespace Game.Entities
}
//set last used pet number (for use in BG's)
if (owner.IsTypeId(TypeId.Player) && isControlled() && !isTemporarySummoned() && (getPetType() == PetType.Summon || getPetType() == PetType.Hunter))
if (owner.IsTypeId(TypeId.Player) && IsControlled() && !IsTemporarySummoned() && (GetPetType() == PetType.Summon || GetPetType() == PetType.Hunter))
owner.ToPlayer().SetLastPetNumber(petId);
m_loading = false;
@@ -367,7 +367,7 @@ namespace Game.Entities
return;
// save only fully controlled creature
if (!isControlled())
if (!IsControlled())
return;
// not save not player pets
@@ -383,7 +383,7 @@ namespace Game.Entities
owner.GetTemporaryUnsummonedPetNumber() != GetCharmInfo().GetPetNumber())
{
// pet will lost anyway at restore temporary unsummoned
if (getPetType() == PetType.Hunter)
if (GetPetType() == PetType.Hunter)
return;
// for warlock case
@@ -427,7 +427,7 @@ namespace Game.Entities
}
// prevent existence another hunter pet in PET_SAVE_AS_CURRENT and PET_SAVE_NOT_IN_SLOT
if (getPetType() == PetType.Hunter && (mode == PetSaveMode.AsCurrent || mode > PetSaveMode.LastStableSlot))
if (GetPetType() == PetType.Hunter && (mode == PetSaveMode.AsCurrent || mode > PetSaveMode.LastStableSlot))
{
stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_PET_BY_SLOT);
stmt.AddValue(0, ownerLowGUID);
@@ -442,7 +442,7 @@ namespace Game.Entities
stmt.AddValue(1, GetEntry());
stmt.AddValue(2, ownerLowGUID);
stmt.AddValue(3, GetNativeDisplayId());
stmt.AddValue(4, getLevel());
stmt.AddValue(4, GetLevel());
stmt.AddValue(5, (uint)m_unitData.PetExperience);
stmt.AddValue(6, GetReactState());
stmt.AddValue(7, mode);
@@ -453,7 +453,7 @@ namespace Game.Entities
stmt.AddValue(12, GenerateActionBarData());
stmt.AddValue(13, Time.UnixTime);
stmt.AddValue(14, (uint)m_unitData.CreatedBySpell);
stmt.AddValue(15, getPetType());
stmt.AddValue(15, GetPetType());
stmt.AddValue(16, m_petSpecialization);
trans.Append(stmt);
@@ -502,19 +502,19 @@ namespace Game.Entities
DB.Characters.CommitTransaction(trans);
}
public override void setDeathState(DeathState s)
public override void SetDeathState(DeathState s)
{
base.setDeathState(s);
if (getDeathState() == DeathState.Corpse)
base.SetDeathState(s);
if (GetDeathState() == DeathState.Corpse)
{
if (getPetType() == PetType.Hunter)
if (GetPetType() == PetType.Hunter)
{
// pet corpse non lootable and non skinnable
SetDynamicFlags(UnitDynFlags.None);
RemoveUnitFlag(UnitFlags.Skinnable);
}
}
else if (getDeathState() == DeathState.Alive)
else if (GetDeathState() == DeathState.Alive)
{
CastPetAuras(true);
}
@@ -532,7 +532,7 @@ namespace Game.Entities
{
case DeathState.Corpse:
{
if (getPetType() != PetType.Hunter || m_corpseRemoveTime <= Time.UnixTime)
if (GetPetType() != PetType.Hunter || m_corpseRemoveTime <= Time.UnixTime)
{
Remove(PetSaveMode.NotInSlot); //hunters' pets never get removed because of death, NEVER!
return;
@@ -543,18 +543,18 @@ namespace Game.Entities
{
// unsummon pet that lost owner
Player owner = GetOwner();
if (owner == null || (!IsWithinDistInMap(owner, GetMap().GetVisibilityRange()) && !isPossessed()) || (isControlled() && owner.GetPetGUID().IsEmpty()))
if (owner == null || (!IsWithinDistInMap(owner, GetMap().GetVisibilityRange()) && !IsPossessed()) || (IsControlled() && owner.GetPetGUID().IsEmpty()))
{
Remove(PetSaveMode.NotInSlot, true);
return;
}
if (isControlled())
if (IsControlled())
{
if (owner.GetPetGUID() != GetGUID())
{
Log.outError(LogFilter.Pet, "Pet {0} is not pet of owner {1}, removed", GetEntry(), GetOwner().GetName());
Remove(getPetType() == PetType.Hunter ? PetSaveMode.AsDeleted : PetSaveMode.NotInSlot);
Remove(GetPetType() == PetType.Hunter ? PetSaveMode.AsDeleted : PetSaveMode.NotInSlot);
return;
}
}
@@ -565,7 +565,7 @@ namespace Game.Entities
m_duration -= (int)diff;
else
{
Remove(getPetType() != PetType.Summon ? PetSaveMode.AsDeleted : PetSaveMode.NotInSlot);
Remove(GetPetType() != PetType.Summon ? PetSaveMode.AsDeleted : PetSaveMode.NotInSlot);
return;
}
}
@@ -610,7 +610,7 @@ namespace Game.Entities
public void GivePetXP(uint xp)
{
if (getPetType() != PetType.Hunter)
if (GetPetType() != PetType.Hunter)
return;
if (xp < 1)
@@ -619,8 +619,8 @@ namespace Game.Entities
if (!IsAlive())
return;
uint maxlevel = Math.Min(WorldConfig.GetUIntValue(WorldCfg.MaxPlayerLevel), GetOwner().getLevel());
uint petlevel = getLevel();
uint maxlevel = Math.Min(WorldConfig.GetUIntValue(WorldCfg.MaxPlayerLevel), GetOwner().GetLevel());
uint petlevel = GetLevel();
// If pet is detected to be at, or above(?) the players level, don't hand out XP
if (petlevel >= maxlevel)
@@ -647,10 +647,10 @@ namespace Game.Entities
public void GivePetLevel(int level)
{
if (level == 0 || level == getLevel())
if (level == 0 || level == GetLevel())
return;
if (getPetType() == PetType.Hunter)
if (GetPetType() == PetType.Hunter)
{
SetPetExperience(0);
SetPetNextLevelExperience((uint)(Global.ObjectMgr.GetXPForLevel((uint)level) * PetXPFactor));
@@ -714,7 +714,7 @@ namespace Game.Entities
SetPetNameTimestamp(0);
SetPetExperience(0);
SetPetNextLevelExperience((uint)(Global.ObjectMgr.GetXPForLevel(getLevel() + 1) * PetXPFactor));
SetPetNextLevelExperience((uint)(Global.ObjectMgr.GetXPForLevel(GetLevel() + 1) * PetXPFactor));
SetNpcFlags(NPCFlags.None);
SetNpcFlags2(NPCFlags2.None);
@@ -751,13 +751,13 @@ namespace Game.Entities
public uint GetCurrentFoodBenefitLevel(uint itemlevel)
{
// -5 or greater food level
if (getLevel() <= itemlevel + 5) //possible to feed level 60 pet with level 55 level food for full effect
if (GetLevel() <= itemlevel + 5) //possible to feed level 60 pet with level 55 level food for full effect
return 35000;
// -10..-6
else if (getLevel() <= itemlevel + 10) //pure guess, but sounds good
else if (GetLevel() <= itemlevel + 10) //pure guess, but sounds good
return 17000;
// -14..-11
else if (getLevel() <= itemlevel + 14) //level 55 food gets green on 70, makes sense to me
else if (GetLevel() <= itemlevel + 14) //level 55 food gets green on 70, makes sense to me
return 8000;
// -15 or less
else
@@ -786,7 +786,7 @@ namespace Game.Entities
{
do
{
addSpell(result.Read<uint>(0), (ActiveStates)result.Read<byte>(1), PetSpellState.Unchanged);
AddSpell(result.Read<uint>(0), (ActiveStates)result.Read<byte>(1), PetSpellState.Unchanged);
}
while (result.NextRow());
}
@@ -992,7 +992,7 @@ namespace Game.Entities
}
}
bool addSpell(uint spellId, ActiveStates active = ActiveStates.Decide, PetSpellState state = PetSpellState.New, PetSpellType type = PetSpellType.Normal)
bool AddSpell(uint spellId, ActiveStates active = ActiveStates.Decide, PetSpellState state = PetSpellState.New, PetSpellType type = PetSpellType.Normal)
{
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId);
if (spellInfo == null)
@@ -1075,7 +1075,7 @@ namespace Game.Entities
if (newspell.active == ActiveStates.Enabled)
ToggleAutocast(oldRankSpellInfo, false);
unlearnSpell(pair.Key, false, false);
UnlearnSpell(pair.Key, false, false);
break;
}
// ignore new lesser rank
@@ -1098,29 +1098,29 @@ namespace Game.Entities
return true;
}
public bool learnSpell(uint spell_id)
public bool LearnSpell(uint spellId)
{
// prevent duplicated entires in spell book
if (!addSpell(spell_id))
if (!AddSpell(spellId))
return false;
if (!m_loading)
{
PetLearnedSpells packet = new PetLearnedSpells();
packet.Spells.Add(spell_id);
packet.Spells.Add(spellId);
GetOwner().SendPacket(packet);
GetOwner().PetSpellInitialize();
}
return true;
}
void learnSpells(List<uint> spellIds)
void LearnSpells(List<uint> spellIds)
{
PetLearnedSpells packet = new PetLearnedSpells();
foreach (uint spell in spellIds)
{
if (!addSpell(spell))
if (!AddSpell(spell))
continue;
packet.Spells.Add(spell);
@@ -1132,7 +1132,7 @@ namespace Game.Entities
void InitLevelupSpellsForLevel()
{
uint level = getLevel();
uint level = GetLevel();
var levelupSpells = GetCreatureTemplate().Family != 0 ? Global.SpellMgr.GetPetLevelupSpellList(GetCreatureTemplate().Family) : null;
if (levelupSpells != null)
{
@@ -1141,10 +1141,10 @@ namespace Game.Entities
{
// will called first if level down
if (pair.Key > level)
unlearnSpell(pair.Value, true); // will learn prev rank if any
UnlearnSpell(pair.Value, true); // will learn prev rank if any
// will called if level up
else
learnSpell(pair.Value); // will unlearn prev rank if any
LearnSpell(pair.Value); // will unlearn prev rank if any
}
}
@@ -1160,22 +1160,22 @@ namespace Game.Entities
// will called first if level down
if (spellInfo.SpellLevel > level)
unlearnSpell(spellInfo.Id, true);
UnlearnSpell(spellInfo.Id, true);
// will called if level up
else
learnSpell(spellInfo.Id);
LearnSpell(spellInfo.Id);
}
}
}
bool unlearnSpell(uint spell_id, bool learn_prev, bool clear_ab = true)
bool UnlearnSpell(uint spellId, bool learnPrev, bool clearActionBar = true)
{
if (removeSpell(spell_id, learn_prev, clear_ab))
if (RemoveSpell(spellId, learnPrev, clearActionBar))
{
if (!m_loading)
{
PetUnlearnedSpells packet = new PetUnlearnedSpells();
packet.Spells.Add(spell_id);
packet.Spells.Add(spellId);
GetOwner().SendPacket(packet);
}
return true;
@@ -1183,13 +1183,13 @@ namespace Game.Entities
return false;
}
void unlearnSpells(List<uint> spellIds, bool learn_prev, bool clear_ab)
void UnlearnSpells(List<uint> spellIds, bool learnPrev, bool clearActionBar)
{
PetUnlearnedSpells packet = new PetUnlearnedSpells();
foreach (uint spell in spellIds)
{
if (!removeSpell(spell, learn_prev, clear_ab))
if (!RemoveSpell(spell, learnPrev, clearActionBar))
continue;
packet.Spells.Add(spell);
@@ -1199,9 +1199,9 @@ namespace Game.Entities
GetOwner().SendPacket(packet);
}
public bool removeSpell(uint spell_id, bool learn_prev, bool clear_ab = true)
public bool RemoveSpell(uint spellId, bool learnPrev, bool clearActionBar = true)
{
var petSpell = m_spells.LookupByKey(spell_id);
var petSpell = m_spells.LookupByKey(spellId);
if (petSpell == null)
return false;
@@ -1209,23 +1209,23 @@ namespace Game.Entities
return false;
if (petSpell.state == PetSpellState.New)
m_spells.Remove(spell_id);
m_spells.Remove(spellId);
else
petSpell.state = PetSpellState.Removed;
RemoveAurasDueToSpell(spell_id);
RemoveAurasDueToSpell(spellId);
if (learn_prev)
if (learnPrev)
{
uint prev_id = Global.SpellMgr.GetPrevSpellInChain(spell_id);
uint prev_id = Global.SpellMgr.GetPrevSpellInChain(spellId);
if (prev_id != 0)
learnSpell(prev_id);
LearnSpell(prev_id);
else
learn_prev = false;
learnPrev = false;
}
// if remove last rank or non-ranked then update action bar at server and client if need
if (GetCharmInfo().RemoveSpellFromActionBar(spell_id) && !learn_prev && clear_ab)
if (GetCharmInfo().RemoveSpellFromActionBar(spellId) && !learnPrev && clearActionBar)
{
if (!m_loading)
{
@@ -1313,7 +1313,7 @@ namespace Game.Entities
public bool IsPermanentPetFor(Player owner)
{
switch (getPetType())
switch (GetPetType())
{
case PetType.Summon:
switch (owner.GetClass())
@@ -1378,7 +1378,7 @@ namespace Game.Entities
// Passive 01~10, Passive 00 (20782, not used), Ferocious Inspiration (34457)
// Scale 01~03 (34902~34904, bonus from owner, not used)
foreach (var petSet in petStore)
addSpell(petSet, ActiveStates.Decide, PetSpellState.New, PetSpellType.Family);
AddSpell(petSet, ActiveStates.Decide, PetSpellState.New, PetSpellType.Family);
}
}
@@ -1431,12 +1431,12 @@ namespace Game.Entities
return false;
}
void learnSpellHighRank(uint spellid)
void LearnSpellHighRank(uint spellid)
{
learnSpell(spellid);
LearnSpell(spellid);
uint next = Global.SpellMgr.GetNextSpellInChain(spellid);
if (next != 0)
learnSpellHighRank(next);
LearnSpellHighRank(next);
}
public void SynchronizeLevelWithOwner()
@@ -1445,12 +1445,12 @@ namespace Game.Entities
if (!owner || !owner.IsTypeId(TypeId.Player))
return;
switch (getPetType())
switch (GetPetType())
{
// always same level
case PetType.Summon:
case PetType.Hunter:
GivePetLevel((int)owner.getLevel());
GivePetLevel((int)owner.GetLevel());
break;
default:
break;
@@ -1466,16 +1466,16 @@ namespace Game.Entities
{
base.SetDisplayId(modelId, displayScale);
if (!isControlled())
if (!IsControlled())
return;
SetGroupUpdateFlag(GroupUpdatePetFlags.ModelId);
}
public PetType getPetType() { return m_petType; }
public void setPetType(PetType type) { m_petType = type; }
public bool isControlled() { return getPetType() == PetType.Summon || getPetType() == PetType.Hunter; }
public bool isTemporarySummoned() { return m_duration > 0; }
public PetType GetPetType() { return m_petType; }
public void SetPetType(PetType type) { m_petType = type; }
public bool IsControlled() { return GetPetType() == PetType.Summon || GetPetType() == PetType.Hunter; }
public bool IsTemporarySummoned() { return m_duration > 0; }
public override bool IsLoading() { return m_loading; }
@@ -1522,14 +1522,14 @@ namespace Game.Entities
foreach (var specSpell in specSpells)
{
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(specSpell.SpellID);
if (spellInfo == null || spellInfo.SpellLevel > getLevel())
if (spellInfo == null || spellInfo.SpellLevel > GetLevel())
continue;
learnedSpells.Add(specSpell.SpellID);
}
}
learnSpells(learnedSpells);
LearnSpells(learnedSpells);
}
void RemoveSpecializationSpells(bool clearActionBar)
@@ -1561,7 +1561,7 @@ namespace Game.Entities
}
}
unlearnSpells(unlearnedSpells, true, clearActionBar);
UnlearnSpells(unlearnedSpells, true, clearActionBar);
}
public void SetSpecialization(uint spec)
+12 -12
View File
@@ -25,6 +25,17 @@ namespace Game.Entities
{
public class CinematicManager : IDisposable
{
// Remote location information
Player player;
public uint m_cinematicDiff;
public uint m_lastCinematicCheck;
public uint m_activeCinematicCameraId;
public uint m_cinematicLength;
List<FlyByCamera> m_cinematicCamera;
Position m_remoteSightPosition;
TempSummon m_CinematicObject;
public CinematicManager(Player playerref)
{
player = playerref;
@@ -67,7 +78,7 @@ namespace Game.Entities
m_CinematicObject = player.SummonCreature(1, pos.posX, pos.posY, pos.posZ, 0.0f, TempSummonType.TimedDespawn, 5 * Time.Minute * Time.InMilliseconds);
if (m_CinematicObject)
{
m_CinematicObject.setActive(true);
m_CinematicObject.SetActive(true);
player.SetViewpoint(m_CinematicObject, true);
}
@@ -177,16 +188,5 @@ namespace Game.Entities
uint GetActiveCinematicCamera() { return m_activeCinematicCameraId; }
public void SetActiveCinematicCamera(uint cinematicCameraId = 0) { m_activeCinematicCameraId = cinematicCameraId; }
public bool IsOnCinematic() { return (m_cinematicCamera != null); }
// Remote location information
Player player;
public uint m_cinematicDiff;
public uint m_lastCinematicCheck;
public uint m_activeCinematicCameraId;
public uint m_cinematicLength;
List<FlyByCamera> m_cinematicCamera;
Position m_remoteSightPosition;
TempSummon m_CinematicObject;
}
}
@@ -22,11 +22,22 @@ using Game.Network.Packets;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Collections;
namespace Game.Entities
{
public class CollectionMgr
{
static Dictionary<uint, uint> FactionSpecificMounts = new Dictionary<uint, uint>();
WorldSession _owner;
Dictionary<uint, ToyFlags> _toys = new Dictionary<uint, ToyFlags>();
Dictionary<uint, HeirloomData> _heirlooms = new Dictionary<uint, HeirloomData>();
Dictionary<uint, MountStatusFlags> _mounts = new Dictionary<uint, MountStatusFlags>();
BitSet _appearances;
MultiMap<uint, ObjectGuid> _temporaryAppearances = new MultiMap<uint, ObjectGuid>();
Dictionary<uint, FavoriteAppearanceState> _favoriteAppearances = new Dictionary<uint, FavoriteAppearanceState>();
public static void LoadMountDefinitions()
{
uint oldMSTime = Time.GetMSTime();
@@ -64,7 +75,7 @@ namespace Game.Entities
public CollectionMgr(WorldSession owner)
{
_owner = owner;
_appearances = new System.Collections.BitSet(0);
_appearances = new BitSet(0);
}
public void LoadToys()
@@ -483,7 +494,7 @@ namespace Game.Entities
} while (knownAppearances.NextRow());
_appearances = new System.Collections.BitSet(blocks);
_appearances = new BitSet(blocks);
}
if (!favoriteAppearances.IsEmpty())
@@ -664,7 +675,7 @@ namespace Game.Entities
return false;
}
if (itemTemplate.GetInventoryType() != InventoryType.Cloak)
if (!Convert.ToBoolean(PlayerClassByArmorSubclass[itemTemplate.GetSubClass()] & _owner.GetPlayer().getClassMask()))
if (!Convert.ToBoolean(PlayerClassByArmorSubclass[itemTemplate.GetSubClass()] & _owner.GetPlayer().GetClassMask()))
return false;
break;
}
@@ -857,17 +868,6 @@ namespace Game.Entities
public Dictionary<uint, ToyFlags> GetAccountToys() { return _toys; }
public Dictionary<uint, HeirloomData> GetAccountHeirlooms() { return _heirlooms; }
public Dictionary<uint, MountStatusFlags> GetAccountMounts() { return _mounts; }
WorldSession _owner;
Dictionary<uint, ToyFlags> _toys = new Dictionary<uint, ToyFlags>();
Dictionary<uint, HeirloomData> _heirlooms = new Dictionary<uint, HeirloomData>();
Dictionary<uint, MountStatusFlags> _mounts = new Dictionary<uint, MountStatusFlags>();
System.Collections.BitSet _appearances;
MultiMap<uint, ObjectGuid> _temporaryAppearances = new MultiMap<uint, ObjectGuid>();
Dictionary<uint, FavoriteAppearanceState> _favoriteAppearances = new Dictionary<uint, FavoriteAppearanceState>();
static Dictionary<uint, uint> FactionSpecificMounts = new Dictionary<uint, uint>();
}
enum FavoriteAppearanceState
@@ -879,13 +879,13 @@ namespace Game.Entities
public class HeirloomData
{
public HeirloomPlayerFlags flags;
public uint bonusId;
public HeirloomData(HeirloomPlayerFlags _flags = 0, uint _bonusId = 0)
{
flags = _flags;
bonusId = _bonusId;
}
public HeirloomPlayerFlags flags;
public uint bonusId;
}
}
+18 -18
View File
@@ -26,6 +26,19 @@ namespace Game.Entities
{
public class KillRewarder
{
Player _killer;
Unit _victim;
Group _group;
float _groupRate;
Player _maxNotGrayMember;
uint _count;
uint _sumLevel;
uint _xp;
bool _isFullXP;
byte _maxLevel;
bool _isBattleground;
bool _isPvP;
public KillRewarder(Player killer, Unit victim, bool isBattleground)
{
_killer = killer;
@@ -106,7 +119,7 @@ namespace Game.Entities
{
if (_killer == member || (member.IsAtGroupRewardDistance(_victim) && member.IsAlive()))
{
uint lvl = member.getLevel();
uint lvl = member.GetLevel();
// 2.1. _count - number of alive group members within reward distance;
++_count;
// 2.2. _sumLevel - sum of levels of alive group members within reward distance;
@@ -117,14 +130,14 @@ namespace Game.Entities
// 2.4. _maxNotGrayMember - maximum level of alive group member within reward distance,
// for whom victim is not gray;
uint grayLevel = Formulas.GetGrayLevel(lvl);
if (_victim.GetLevelForTarget(member) > grayLevel && (!_maxNotGrayMember || _maxNotGrayMember.getLevel() < lvl))
if (_victim.GetLevelForTarget(member) > grayLevel && (!_maxNotGrayMember || _maxNotGrayMember.GetLevel() < lvl))
_maxNotGrayMember = member;
}
}
}
// 2.5. _isFullXP - flag identifying that for all group members victim is not gray,
// so 100% XP will be rewarded (50% otherwise).
_isFullXP = _maxNotGrayMember && (_maxLevel == _maxNotGrayMember.getLevel());
_isFullXP = _maxNotGrayMember && (_maxLevel == _maxNotGrayMember.GetLevel());
}
else
_count = 1;
@@ -157,7 +170,7 @@ namespace Game.Entities
// * set to 0 if player's level is more than maximum level of not gray member;
// * cut XP in half if _isFullXP is false.
if (_maxNotGrayMember != null && player.IsAlive() &&
_maxNotGrayMember.getLevel() >= player.getLevel())
_maxNotGrayMember.GetLevel() >= player.GetLevel())
xp = _isFullXP ?
(uint)(xp * rate) : // Reward FULL XP if all group members are not gray.
(uint)(xp * rate / 2) + 1; // Reward only HALF of XP if some of group members are gray.
@@ -215,7 +228,7 @@ namespace Game.Entities
// Give reputation and kill credit only in PvE.
if (!_isPvP || _isBattleground)
{
float rate = _group ? _groupRate * player.getLevel() / _sumLevel : 1.0f;
float rate = _group ? _groupRate * player.GetLevel() / _sumLevel : 1.0f;
if (_xp != 0)
// 4.2. Give XP.
_RewardXP(player, rate);
@@ -265,18 +278,5 @@ namespace Game.Entities
}
}
}
Player _killer;
Unit _victim;
Group _group;
float _groupRate;
Player _maxNotGrayMember;
uint _count;
uint _sumLevel;
uint _xp;
bool _isFullXP;
byte _maxLevel;
bool _isBattleground;
bool _isPvP;
}
}
+1 -1
View File
@@ -94,7 +94,7 @@ namespace Game.Entities
float GetRatingMultiplier(CombatRating cr)
{
GtCombatRatingsRecord Rating = CliDB.CombatRatingsGameTable.GetRow(getLevel());
GtCombatRatingsRecord Rating = CliDB.CombatRatingsGameTable.GetRow(GetLevel());
if (Rating == null)
return 1.0f;
+5 -5
View File
@@ -813,7 +813,7 @@ namespace Game.Entities
{
ItemTemplate rewardProto = Global.ObjectMgr.GetItemTemplate(questPackageItem.ItemID);
if (rewardProto != null)
if (rewardProto.ItemSpecClassMask.HasAnyFlag(getClassMask()))
if (rewardProto.ItemSpecClassMask.HasAnyFlag(GetClassMask()))
GetSession().GetCollectionMgr().AddItemAppearance(questPackageItem.ItemID);
}
}
@@ -2085,7 +2085,7 @@ namespace Game.Entities
void _SaveStats(SQLTransaction trans)
{
// check if stat saving is enabled and if char level is high enough
if (WorldConfig.GetIntValue(WorldCfg.MinLevelStatSave) == 0 || getLevel() < WorldConfig.GetIntValue(WorldCfg.MinLevelStatSave))
if (WorldConfig.GetIntValue(WorldCfg.MinLevelStatSave) == 0 || GetLevel() < WorldConfig.GetIntValue(WorldCfg.MinLevelStatSave))
return;
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_STATS);
@@ -2886,7 +2886,7 @@ namespace Game.Entities
InitTalentForLevel();
LearnDefaultSkills();
LearnCustomSpells();
if (getLevel() < PlayerConst.LevelMinHonor)
if (GetLevel() < PlayerConst.LevelMinHonor)
ResetPvpTalents();
// must be before inventory (some items required reputation check)
@@ -3107,7 +3107,7 @@ namespace Game.Entities
stmt.AddValue(index++, (byte)GetRace());
stmt.AddValue(index++, (byte)GetClass());
stmt.AddValue(index++, (byte)m_playerData.NativeSex); // save gender from PLAYER_BYTES_3, UNIT_BYTES_0 changes with every transform effect
stmt.AddValue(index++, getLevel());
stmt.AddValue(index++, GetLevel());
stmt.AddValue(index++, (uint)m_activePlayerData.XP);
stmt.AddValue(index++, GetMoney());
stmt.AddValue(index++, (byte)m_playerData.SkinID);
@@ -3238,7 +3238,7 @@ namespace Game.Entities
stmt.AddValue(index++, (byte)GetRace());
stmt.AddValue(index++, (byte)GetClass());
stmt.AddValue(index++, (byte)m_playerData.NativeSex); // save gender from PLAYER_BYTES_3, UNIT_BYTES_0 changes with every transform effect
stmt.AddValue(index++, getLevel());
stmt.AddValue(index++, GetLevel());
stmt.AddValue(index++, (uint)m_activePlayerData.XP);
stmt.AddValue(index++, GetMoney());
stmt.AddValue(index++, (byte)m_playerData.SkinID);
+1 -1
View File
@@ -212,7 +212,7 @@ namespace Game.Entities
PlayerExtraFlags m_ExtraFlags;
public bool isDebugAreaTriggers { get; set; }
public bool IsDebugAreaTriggers { get; set; }
uint m_zoneUpdateId;
uint m_areaUpdateId;
uint m_zoneUpdateTimer;
+4 -4
View File
@@ -49,7 +49,7 @@ namespace Game.Entities
return nearMembers[randTarget];
}
public PartyResult CanUninviteFromGroup(ObjectGuid guidMember = default(ObjectGuid))
public PartyResult CanUninviteFromGroup(ObjectGuid guidMember = default)
{
Group grp = GetGroup();
if (!grp)
@@ -99,12 +99,12 @@ namespace Game.Entities
return PartyResult.Ok;
}
public bool isUsingLfg()
public bool IsUsingLfg()
{
return Global.LFGMgr.GetState(GetGUID()) != LfgState.None;
}
bool inRandomLfgDungeon()
bool InRandomLfgDungeon()
{
if (Global.LFGMgr.selectedRandomLfgDungeon(GetGUID()))
{
@@ -263,7 +263,7 @@ namespace Game.Entities
}
public void RemoveFromGroup(RemoveMethod method = RemoveMethod.Default) { RemoveFromGroup(GetGroup(), GetGUID(), method); }
public static void RemoveFromGroup(Group group, ObjectGuid guid, RemoveMethod method = RemoveMethod.Default, ObjectGuid kicker = default(ObjectGuid), string reason = null)
public static void RemoveFromGroup(Group group, ObjectGuid guid, RemoveMethod method = RemoveMethod.Default, ObjectGuid kicker = default, string reason = null)
{
if (!group)
return;
+22 -22
View File
@@ -1284,7 +1284,7 @@ namespace Game.Entities
item = StoreItem(pos, item, update);
item.SetFixedLevel(getLevel());
item.SetFixedLevel(GetLevel());
item.SetItemRandomBonusList(randomPropertyId);
if (allowedLooters != null && allowedLooters.Count > 1 && item.GetTemplate().GetMaxStackSize() == 1 && item.IsSoulBound())
@@ -1412,7 +1412,7 @@ namespace Game.Entities
if (pItem.IsBindedNotWith(this))
return InventoryResult.NotOwner;
if (getLevel() < pItem.GetRequiredLevel())
if (GetLevel() < pItem.GetRequiredLevel())
return InventoryResult.CantEquipLevelI;
InventoryResult res = CanUseItem(pProto);
@@ -1468,7 +1468,7 @@ namespace Game.Entities
if (Convert.ToBoolean(proto.GetFlags2() & ItemFlags2.FactionAlliance) && GetTeam() != Team.Alliance)
return InventoryResult.CantEquipEver;
if ((proto.GetAllowableClass() & getClassMask()) == 0 || (proto.GetAllowableRace() & (long)getRaceMask()) == 0)
if ((proto.GetAllowableClass() & GetClassMask()) == 0 || (proto.GetAllowableRace() & (long)GetRaceMask()) == 0)
return InventoryResult.CantEquipEver;
if (proto.GetRequiredSkill() != 0)
@@ -1482,7 +1482,7 @@ namespace Game.Entities
if (proto.GetRequiredSpell() != 0 && !HasSpell(proto.GetRequiredSpell()))
return InventoryResult.ProficiencyNeeded;
if (getLevel() < proto.GetBaseRequiredLevel())
if (GetLevel() < proto.GetBaseRequiredLevel())
return InventoryResult.CantEquipLevelI;
// If World Event is not active, prevent using event dependant items
@@ -3321,7 +3321,7 @@ namespace Game.Entities
return InventoryResult.ItemNotFound;
// Used by group, function GroupLoot, to know if a prototype can be used by a player
if ((proto.GetAllowableClass() & getClassMask()) == 0 || (proto.GetAllowableRace() & (long)getRaceMask()) == 0)
if ((proto.GetAllowableClass() & GetClassMask()) == 0 || (proto.GetAllowableRace() & (long)GetRaceMask()) == 0)
return InventoryResult.CantEquipEver;
if (proto.GetRequiredSpell() != 0 && !HasSpell(proto.GetRequiredSpell()))
@@ -3344,7 +3344,7 @@ namespace Game.Entities
{
if (_class == Class.Warrior || _class == Class.Paladin || _class == Class.Deathknight)
{
if (getLevel() < 40)
if (GetLevel() < 40)
{
if (proto.GetSubClass() != (uint)ItemSubClassArmor.Mail)
return InventoryResult.ClientLockedOut;
@@ -3354,7 +3354,7 @@ namespace Game.Entities
}
else if (_class == Class.Hunter || _class == Class.Shaman)
{
if (getLevel() < 40)
if (GetLevel() < 40)
{
if (proto.GetSubClass() != (uint)ItemSubClassArmor.Leather)
return InventoryResult.ClientLockedOut;
@@ -3605,7 +3605,7 @@ namespace Game.Entities
return false;
}
if (!Convert.ToBoolean(pProto.GetAllowableClass() & getClassMask()) && pProto.GetBonding() == ItemBondingType.OnAcquire && !IsGameMaster())
if (!Convert.ToBoolean(pProto.GetAllowableClass() & GetClassMask()) && pProto.GetBonding() == ItemBondingType.OnAcquire && !IsGameMaster())
{
SendBuyError(BuyResult.CantFindItem, null, item);
return false;
@@ -4251,7 +4251,7 @@ namespace Game.Entities
if (spellproto == null)
continue;
if (spellproto.HasAura(GetMap().GetDifficultyID(), AuraType.ModXpPct) && !GetSession().GetCollectionMgr().CanApplyHeirloomXpBonus(item.GetEntry(), getLevel())
if (spellproto.HasAura(GetMap().GetDifficultyID(), AuraType.ModXpPct) && !GetSession().GetCollectionMgr().CanApplyHeirloomXpBonus(item.GetEntry(), GetLevel())
&& Global.DB2Mgr.GetHeirloomByItemId(item.GetEntry()) != null)
continue;
@@ -4520,7 +4520,7 @@ namespace Game.Entities
need_space = count;
ItemPosCount newPosition = new ItemPosCount((ushort)(InventorySlots.Bag0 << 8 | j), need_space);
if (!newPosition.isContainedIn(dest))
if (!newPosition.IsContainedIn(dest))
{
dest.Add(newPosition);
count -= need_space;
@@ -4598,7 +4598,7 @@ namespace Game.Entities
need_space = count;
ItemPosCount newPosition = new ItemPosCount((ushort)(bag << 8 | slot), need_space);
if (!newPosition.isContainedIn(dest))
if (!newPosition.IsContainedIn(dest))
{
dest.Add(newPosition);
count -= need_space;
@@ -4938,7 +4938,7 @@ namespace Game.Entities
need_space = count;
ItemPosCount newPosition = new ItemPosCount((ushort)(bag << 8 | j), need_space);
if (!newPosition.isContainedIn(dest))
if (!newPosition.IsContainedIn(dest))
{
dest.Add(newPosition);
count -= need_space;
@@ -5151,7 +5151,7 @@ namespace Game.Entities
ScalingStatDistributionRecord ssd = CliDB.ScalingStatDistributionStorage.LookupByKey(pItem.GetScalingStatDistribution());
// check allowed level (extend range to upper values if MaxLevel more or equal max player level, this let GM set high level with 1...max range items)
if (ssd != null && ssd.MaxLevel < WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel) && ssd.MaxLevel < getLevel() && Global.DB2Mgr.GetHeirloomByItemId(pProto.GetId()) == null)
if (ssd != null && ssd.MaxLevel < WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel) && ssd.MaxLevel < GetLevel() && Global.DB2Mgr.GetHeirloomByItemId(pProto.GetId()) == null)
return InventoryResult.NotEquippable;
byte eslot = FindEquipSlot(pProto, slot, swap);
@@ -6190,7 +6190,7 @@ namespace Game.Entities
// We store the level of our player in the gold field
// We retrieve this information at Player.SendLoot()
bones.loot.gold = getLevel();
bones.loot.gold = GetLevel();
bones.lootRecipient = looterPlr;
looterPlr.SendLoot(bones.GetGUID(), LootType.Insignia);
}
@@ -6225,7 +6225,7 @@ namespace Game.Entities
// not check distance for GO in case owned GO (fishing bobber case, for example)
// And permit out of range GO with no owner in case fishing hole
if (!go || (loot_type != LootType.Fishinghole && ((loot_type != LootType.Fishing && loot_type != LootType.FishingJunk) || go.GetOwnerGUID() != GetGUID())
&& !go.IsWithinDistInMap(this, SharedConst.InteractionDistance)) || (loot_type == LootType.Corpse && go.GetRespawnTime() != 0 && go.isSpawnedByDefault()))
&& !go.IsWithinDistInMap(this, SharedConst.InteractionDistance)) || (loot_type == LootType.Corpse && go.GetRespawnTime() != 0 && go.IsSpawnedByDefault()))
{
SendLootRelease(guid);
return;
@@ -6235,10 +6235,10 @@ namespace Game.Entities
// loot was generated and respawntime has passed since then, allow to recreate loot
// to avoid bugs, this rule covers spawned gameobjects only
if (go.isSpawnedByDefault() && go.getLootState() == LootState.Activated && !go.loot.isLooted() && go.GetLootGenerationTime() + go.GetRespawnDelay() < Time.UnixTime)
if (go.IsSpawnedByDefault() && go.GetLootState() == LootState.Activated && !go.loot.isLooted() && go.GetLootGenerationTime() + go.GetRespawnDelay() < Time.UnixTime)
go.SetLootState(LootState.Ready);
if (go.getLootState() == LootState.Ready)
if (go.GetLootState() == LootState.Ready)
{
uint lootid = go.GetGoInfo().GetLootId();
Battleground bg = GetBattleground();
@@ -6278,9 +6278,9 @@ namespace Game.Entities
}
if (loot_type == LootType.Fishing)
go.getFishLoot(loot, this);
go.GetFishLoot(loot, this);
else if (loot_type == LootType.FishingJunk)
go.getFishLootJunk(loot, this);
go.GetFishLootJunk(loot, this);
if (go.GetGoInfo().type == GameObjectTypes.Chest && go.GetGoInfo().Chest.usegrouplootrules != 0)
{
@@ -6305,7 +6305,7 @@ namespace Game.Entities
go.SetLootState(LootState.Activated, this);
}
if (go.getLootState() == LootState.Activated)
if (go.GetLootState() == LootState.Activated)
{
Group group = GetGroup();
if (group)
@@ -6442,8 +6442,8 @@ namespace Game.Entities
loot.FillLoot(lootid, LootStorage.Pickpocketing, this, true);
// Generate extra money for pick pocket loot
uint a = RandomHelper.URand(0, creature.getLevel() / 2);
uint b = RandomHelper.URand(0, getLevel() / 2);
uint a = RandomHelper.URand(0, creature.GetLevel() / 2);
uint b = RandomHelper.URand(0, GetLevel() / 2);
loot.gold = (uint)(10 * (a + b) * WorldConfig.GetFloatValue(WorldCfg.RateDropMoney));
permission = PermissionTypes.Owner;
}
+2 -2
View File
@@ -456,9 +456,9 @@ namespace Game.Entities
if (!WorldConfig.GetBoolValue(WorldCfg.InstanceIgnoreLevel))
{
if (ar.levelMin != 0 && getLevel() < ar.levelMin)
if (ar.levelMin != 0 && GetLevel() < ar.levelMin)
LevelMin = ar.levelMin;
if (ar.levelMax != 0 && getLevel() > ar.levelMax)
if (ar.levelMax != 0 && GetLevel() > ar.levelMax)
LevelMax = ar.levelMax;
}
+7 -7
View File
@@ -103,7 +103,7 @@ namespace Game.Entities
if (GetTeam() == plrVictim.GetTeam() && !Global.WorldMgr.IsFFAPvPRealm())
return false;
byte k_level = (byte)getLevel();
byte k_level = (byte)GetLevel();
byte k_grey = (byte)Formulas.GetGrayLevel(k_level);
byte v_level = (byte)victim.GetLevelForTarget(this);
@@ -263,7 +263,7 @@ namespace Game.Entities
uint newHonorXP = currentHonorXP + xp;
uint honorLevel = GetHonorLevel();
if (xp < 1 || getLevel() < PlayerConst.LevelMinHonor || IsMaxHonorLevel())
if (xp < 1 || GetLevel() < PlayerConst.LevelMinHonor || IsMaxHonorLevel())
return;
while (newHonorXP >= nextHonorLevelXP)
@@ -340,10 +340,10 @@ namespace Game.Entities
if (talentInfo.SpecID != GetPrimarySpecialization())
return TalentLearnResult.FailedUnknown;
if (talentInfo.LevelRequired > getLevel())
if (talentInfo.LevelRequired > GetLevel())
return TalentLearnResult.FailedUnknown;
if (Global.DB2Mgr.GetRequiredLevelForPvpTalentSlot(slot, GetClass()) > getLevel())
if (Global.DB2Mgr.GetRequiredLevelForPvpTalentSlot(slot, GetClass()) > GetLevel())
return TalentLearnResult.FailedUnknown;
PvpTalentCategoryRecord talentCategory = CliDB.PvpTalentCategoryStorage.LookupByKey(talentInfo.PvpTalentCategoryID);
@@ -654,7 +654,7 @@ namespace Game.Entities
// BUG: sometimes when player clicks on flag in AB - client won't send gameobject_use, only gameobject_report_use packet
// Note: Mount, stealth and invisibility will be removed when used
return (!isTotalImmune() && // Damage immune
return (!IsTotalImmune() && // Damage immune
!HasAura(BattlegroundConst.SpellRecentlyDroppedFlag) && // Still has recently held flag debuff
IsAlive()); // Alive
}
@@ -669,7 +669,7 @@ namespace Game.Entities
public void SetBattlegroundEntryPoint()
{
// Taxi path store
if (!m_taxi.empty())
if (!m_taxi.Empty())
{
m_bgData.mountSpell = 0;
m_bgData.taxiPath[0] = m_taxi.GetTaxiSource();
@@ -830,7 +830,7 @@ namespace Game.Entities
return false;
// limit check leel to dbc compatible level range
uint level = getLevel();
uint level = GetLevel();
if (level > WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel))
level = WorldConfig.GetUIntValue(WorldCfg.MaxPlayerLevel);
+19 -19
View File
@@ -41,8 +41,8 @@ namespace Game.Entities
void AddTimedQuest(uint questId) { m_timedquests.Add(questId); }
public void RemoveTimedQuest(uint questId) { m_timedquests.Remove(questId); }
public List<uint> getRewardedQuests() { return m_RewardedQuests; }
Dictionary<uint, QuestStatusData> getQuestStatusMap() { return m_QuestStatus; }
public List<uint> GetRewardedQuests() { return m_RewardedQuests; }
Dictionary<uint, QuestStatusData> GetQuestStatusMap() { return m_QuestStatus; }
public int GetQuestMinLevel(Quest quest)
{
@@ -65,7 +65,7 @@ namespace Game.Entities
{
int minLevel = GetQuestMinLevel(quest);
int maxLevel = quest.MaxScalingLevel;
int level = (int)getLevel();
int level = (int)GetLevel();
if (level >= minLevel)
return Math.Min(level, maxLevel);
return minLevel;
@@ -325,7 +325,7 @@ namespace Game.Entities
// @todo verify if check for !quest.IsDaily() is really correct (possibly not)
else
{
if (!source.hasQuest(questId) && !source.hasInvolvedQuest(questId))
if (!source.HasQuest(questId) && !source.HasInvolvedQuest(questId))
{
PlayerTalkClass.SendCloseGossip();
return;
@@ -410,7 +410,7 @@ namespace Game.Entities
SatisfyQuestPrevChain(quest, false) && SatisfyQuestDay(quest, false) && SatisfyQuestWeek(quest, false) &&
SatisfyQuestMonth(quest, false) && SatisfyQuestSeasonal(quest, false))
{
return getLevel() + WorldConfig.GetIntValue(WorldCfg.QuestHighLevelHideDiff) >= GetQuestMinLevel(quest);
return GetLevel() + WorldConfig.GetIntValue(WorldCfg.QuestHighLevelHideDiff) >= GetQuestMinLevel(quest);
}
return false;
@@ -778,7 +778,7 @@ namespace Game.Entities
{
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(quest.SourceSpellID);
Unit caster = this;
if (questGiver != null && questGiver.isTypeMask(TypeMask.Unit) && !quest.HasFlag(QuestFlags.PlayerCastOnAccept) && !spellInfo.HasTargetType(Targets.UnitCaster) && !spellInfo.HasTargetType(Targets.DestCasterSummon))
if (questGiver != null && questGiver.IsTypeMask(TypeMask.Unit) && !quest.HasFlag(QuestFlags.PlayerCastOnAccept) && !spellInfo.HasTargetType(Targets.UnitCaster) && !spellInfo.HasTargetType(Targets.DestCasterSummon))
{
Unit unit = questGiver.ToUnit();
if (unit != null)
@@ -867,7 +867,7 @@ namespace Game.Entities
case QuestPackageFilter.LootSpecialization:
return rewardProto.IsUsableByLootSpecialization(this, true);
case QuestPackageFilter.Class:
return rewardProto.ItemSpecClassMask == 0 || (rewardProto.ItemSpecClassMask & getClassMask()) != 0;
return rewardProto.ItemSpecClassMask == 0 || (rewardProto.ItemSpecClassMask & GetClassMask()) != 0;
case QuestPackageFilter.Everyone:
return true;
default:
@@ -1017,7 +1017,7 @@ namespace Game.Entities
uint XP = GetQuestXPReward(quest);
int moneyRew = 0;
if (getLevel() < WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel))
if (GetLevel() < WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel))
GiveXP(XP, null);
else
moneyRew = (int)(quest.GetRewMoneyMaxLevel() * WorldConfig.GetFloatValue(WorldCfg.RateDropMoney));
@@ -1033,7 +1033,7 @@ namespace Game.Entities
}
// honor reward
uint honor = quest.CalculateHonorGain(getLevel());
uint honor = quest.CalculateHonorGain(GetLevel());
if (honor != 0)
RewardHonor(null, 0, (int)honor);
@@ -1091,7 +1091,7 @@ namespace Game.Entities
{
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(quest.RewardSpell);
Unit caster = this;
if (questGiver != null && questGiver.isTypeMask(TypeMask.Unit) && !quest.HasFlag(QuestFlags.PlayerCastOnComplete) && !spellInfo.HasTargetType(Targets.UnitCaster))
if (questGiver != null && questGiver.IsTypeMask(TypeMask.Unit) && !quest.HasFlag(QuestFlags.PlayerCastOnComplete) && !spellInfo.HasTargetType(Targets.UnitCaster))
{
Unit unit = questGiver.ToUnit();
if (unit != null)
@@ -1108,7 +1108,7 @@ namespace Game.Entities
{
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(quest.RewardDisplaySpell[i]);
Unit caster = this;
if (questGiver != null && questGiver.isTypeMask(TypeMask.Unit) && !quest.HasFlag(QuestFlags.PlayerCastOnComplete) && !spellInfo.HasTargetType(Targets.UnitCaster))
if (questGiver != null && questGiver.IsTypeMask(TypeMask.Unit) && !quest.HasFlag(QuestFlags.PlayerCastOnComplete) && !spellInfo.HasTargetType(Targets.UnitCaster))
{
Unit unit = questGiver.ToUnit();
if (unit != null)
@@ -1263,7 +1263,7 @@ namespace Game.Entities
public bool SatisfyQuestLevel(Quest qInfo, bool msg)
{
if (getLevel() < GetQuestMinLevel(qInfo))
if (GetLevel() < GetQuestMinLevel(qInfo))
{
if (msg)
{
@@ -1273,7 +1273,7 @@ namespace Game.Entities
return false;
}
if (qInfo.MaxLevel > 0 && getLevel() > qInfo.MaxLevel)
if (qInfo.MaxLevel > 0 && GetLevel() > qInfo.MaxLevel)
{
if (msg)
{
@@ -1392,7 +1392,7 @@ namespace Game.Entities
if (reqClass == 0)
return true;
if ((reqClass & getClassMask()) == 0)
if ((reqClass & GetClassMask()) == 0)
{
if (msg)
{
@@ -1412,7 +1412,7 @@ namespace Game.Entities
if (reqraces == -1)
return true;
if ((reqraces & (long)getRaceMask()) == 0)
if ((reqraces & (long)GetRaceMask()) == 0)
{
if (msg)
{
@@ -1909,7 +1909,7 @@ namespace Game.Entities
{
if (SatisfyQuestLevel(quest, false))
{
if (getLevel() <= (GetQuestLevel(quest) + WorldConfig.GetIntValue(WorldCfg.QuestLowLevelHideDiff)))
if (GetLevel() <= (GetQuestLevel(quest) + WorldConfig.GetIntValue(WorldCfg.QuestLowLevelHideDiff)))
{
if (quest.IsDaily())
result2 = QuestGiverStatus.AvailableRep;
@@ -2189,7 +2189,7 @@ namespace Game.Entities
KilledMonsterCredit(cInfo.KillCredit[i]);
}
public void KilledMonsterCredit(uint entry, ObjectGuid guid = default(ObjectGuid))
public void KilledMonsterCredit(uint entry, ObjectGuid guid = default)
{
ushort addKillCount = 1;
uint real_entry = entry;
@@ -2287,7 +2287,7 @@ namespace Game.Entities
}
}
public void KillCreditGO(uint entry, ObjectGuid guid = default(ObjectGuid))
public void KillCreditGO(uint entry, ObjectGuid guid = default)
{
ushort addCastCount = 1;
for (byte i = 0; i < SharedConst.MaxQuestLogSize; ++i)
@@ -2747,7 +2747,7 @@ namespace Game.Entities
uint moneyReward;
if (getLevel() < WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel))
if (GetLevel() < WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel))
{
moneyReward = GetQuestMoneyReward(quest);
}
+18 -18
View File
@@ -342,7 +342,7 @@ namespace Game.Entities
{
SpecializationSpellsRecord specSpell = specSpells[j];
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(specSpell.SpellID);
if (spellInfo == null || spellInfo.SpellLevel > getLevel())
if (spellInfo == null || spellInfo.SpellLevel > GetLevel())
continue;
LearnSpell(specSpell.SpellID, false);
@@ -568,7 +568,7 @@ namespace Game.Entities
if (!ignore_condition && pEnchant.ConditionID != 0 && !EnchantmentFitsRequirements(pEnchant.ConditionID, -1))
return;
if (pEnchant.MinLevel > getLevel())
if (pEnchant.MinLevel > GetLevel())
return;
if (pEnchant.RequiredSkillID > 0 && pEnchant.RequiredSkillRank > GetSkillValue((SkillType)pEnchant.RequiredSkillID))
@@ -640,12 +640,12 @@ namespace Game.Entities
scalingClass = pEnchant.ScalingClassRestricted;
uint minLevel = ((uint)(pEnchant.Flags)).HasAnyFlag(0x20u) ? 1 : 60u;
uint scalingLevel = getLevel();
uint scalingLevel = GetLevel();
byte maxLevel = (byte)(pEnchant.MaxLevel != 0 ? pEnchant.MaxLevel : CliDB.SpellScalingGameTable.GetTableRowCount() - 1);
if (minLevel > getLevel())
if (minLevel > GetLevel())
scalingLevel = minLevel;
else if (maxLevel < getLevel())
else if (maxLevel < GetLevel())
scalingLevel = maxLevel;
GtSpellScalingRecord spellScaling = CliDB.SpellScalingGameTable.GetRow(scalingLevel);
@@ -665,12 +665,12 @@ namespace Game.Entities
scalingClass = pEnchant.ScalingClassRestricted;
uint minLevel = ((uint)(pEnchant.Flags)).HasAnyFlag(0x20u) ? 1 : 60u;
uint scalingLevel = getLevel();
uint scalingLevel = GetLevel();
byte maxLevel = (byte)(pEnchant.MaxLevel != 0 ? pEnchant.MaxLevel : CliDB.SpellScalingGameTable.GetTableRowCount() - 1);
if (minLevel > getLevel())
if (minLevel > GetLevel())
scalingLevel = minLevel;
else if (maxLevel < getLevel())
else if (maxLevel < GetLevel())
scalingLevel = maxLevel;
GtSpellScalingRecord spellScaling = CliDB.SpellScalingGameTable.GetRow(scalingLevel);
@@ -911,7 +911,7 @@ namespace Game.Entities
WorldObject target = GetViewpoint();
if (target)
{
if (target.isTypeMask(TypeMask.Unit))
if (target.IsTypeMask(TypeMask.Unit))
{
((Unit)target).RemoveAurasByType(AuraType.BindSight, GetGUID());
((Unit)target).RemoveAurasByType(AuraType.ModPossess, GetGUID());
@@ -1610,8 +1610,8 @@ namespace Game.Entities
void LearnSkillRewardedSpells(uint skillId, uint skillValue)
{
ulong raceMask = getRaceMask();
uint classMask = getClassMask();
ulong raceMask = GetRaceMask();
uint classMask = GetClassMask();
List<SkillLineAbilityRecord> skillLineAbilities = Global.DB2Mgr.GetSkillLineAbilitiesBySkill(skillId);
foreach (var ability in skillLineAbilities)
@@ -1639,7 +1639,7 @@ namespace Game.Entities
continue;
// check level, skip class spells if not high enough
if (getLevel() < spellInfo.SpellLevel)
if (GetLevel() < spellInfo.SpellLevel)
continue;
// need unlearn spell
@@ -1932,7 +1932,7 @@ namespace Game.Entities
if (HasSkill((SkillType)rcInfo.SkillID))
continue;
if (rcInfo.MinLevel > getLevel())
if (rcInfo.MinLevel > GetLevel())
continue;
LearnDefaultSkill(rcInfo);
@@ -1954,7 +1954,7 @@ namespace Game.Entities
if (rcInfo.Flags.HasAnyFlag(SkillRaceClassInfoFlags.AlwaysMaxValue))
skillValue = maxValue;
else if (GetClass() == Class.Deathknight)
skillValue = (ushort)Math.Min(Math.Max(1, (getLevel() - 1) * 5), maxValue);
skillValue = (ushort)Math.Min(Math.Max(1, (GetLevel() - 1) * 5), maxValue);
else if (skillId == SkillType.FistWeapons)
skillValue = Math.Max((ushort)1, GetSkillValue(SkillType.Unarmed));
@@ -1972,7 +1972,7 @@ namespace Game.Entities
if (rcInfo.Flags.HasAnyFlag(SkillRaceClassInfoFlags.AlwaysMaxValue))
skillValue = maxValue;
else if (GetClass() == Class.Deathknight)
skillValue = (ushort)Math.Min(Math.Max(1, (getLevel() - 1) * 5), maxValue);
skillValue = (ushort)Math.Min(Math.Max(1, (GetLevel() - 1) * 5), maxValue);
SetSkill(skillId, 1, skillValue, maxValue);
break;
@@ -3291,7 +3291,7 @@ namespace Game.Entities
}
// not allow proc extra attack spell at extra attack
if (m_extraAttacks != 0 && spellInfo.HasEffect(SpellEffectName.AddExtraAttacks))
if (ExtraAttacks != 0 && spellInfo.HasEffect(SpellEffectName.AddExtraAttacks))
return;
float chance = spellInfo.ProcChance;
@@ -3404,9 +3404,9 @@ namespace Game.Entities
{
// normalized proc chance for weapon attack speed
// (odd formula...)
if (isAttackReady(WeaponAttackType.BaseAttack))
if (IsAttackReady(WeaponAttackType.BaseAttack))
return (GetBaseAttackTime(WeaponAttackType.BaseAttack) * 1.8f / 1000.0f);
else if (haveOffhandWeapon() && isAttackReady(WeaponAttackType.OffAttack))
else if (HaveOffhandWeapon() && IsAttackReady(WeaponAttackType.OffAttack))
return (GetBaseAttackTime(WeaponAttackType.OffAttack) * 1.6f / 1000.0f);
return 0;
}
@@ -28,7 +28,7 @@ namespace Game.Entities
{
public void InitTalentForLevel()
{
uint level = getLevel();
uint level = GetLevel();
// talents base at level diff (talents = level - 9 but some can be used already)
if (level < PlayerConst.MinSpecializationLevel)
ResetTalentSpecialization();
+105 -112
View File
@@ -45,8 +45,8 @@ namespace Game.Entities
{
public Player(WorldSession session) : base(true)
{
objectTypeMask |= TypeMask.Player;
objectTypeId = TypeId.Player;
ObjectTypeMask |= TypeMask.Player;
ObjectTypeId = TypeId.Player;
m_playerData = new PlayerData();
m_activePlayerData = new ActivePlayerData();
@@ -536,11 +536,11 @@ namespace Game.Entities
// default combat reach 10
// TODO add weapon, skill check
if (isAttackReady(WeaponAttackType.BaseAttack))
if (IsAttackReady(WeaponAttackType.BaseAttack))
{
if (!IsWithinMeleeRange(victim))
{
setAttackTimer(WeaponAttackType.BaseAttack, 100);
SetAttackTimer(WeaponAttackType.BaseAttack, 100);
if (m_swingErrorMsg != 1) // send single time (client auto repeat)
{
SendAttackSwingNotInRange();
@@ -550,7 +550,7 @@ namespace Game.Entities
//120 degrees of radiant range, if player is not in boundary radius
else if (!IsWithinBoundaryRadius(victim) && !HasInArc(2 * MathFunctions.PI / 3, victim))
{
setAttackTimer(WeaponAttackType.BaseAttack, 100);
SetAttackTimer(WeaponAttackType.BaseAttack, 100);
if (m_swingErrorMsg != 2) // send single time (client auto repeat)
{
SendAttackSwingBadFacingAttack();
@@ -562,31 +562,31 @@ namespace Game.Entities
m_swingErrorMsg = 0; // reset swing error state
// prevent base and off attack in same time, delay attack at 0.2 sec
if (haveOffhandWeapon())
if (getAttackTimer(WeaponAttackType.OffAttack) < SharedConst.AttackDisplayDelay)
setAttackTimer(WeaponAttackType.OffAttack, SharedConst.AttackDisplayDelay);
if (HaveOffhandWeapon())
if (GetAttackTimer(WeaponAttackType.OffAttack) < SharedConst.AttackDisplayDelay)
SetAttackTimer(WeaponAttackType.OffAttack, SharedConst.AttackDisplayDelay);
// do attack
AttackerStateUpdate(victim, WeaponAttackType.BaseAttack);
resetAttackTimer(WeaponAttackType.BaseAttack);
ResetAttackTimer(WeaponAttackType.BaseAttack);
}
}
if (!IsInFeralForm() && haveOffhandWeapon() && isAttackReady(WeaponAttackType.OffAttack))
if (!IsInFeralForm() && HaveOffhandWeapon() && IsAttackReady(WeaponAttackType.OffAttack))
{
if (!IsWithinMeleeRange(victim))
setAttackTimer(WeaponAttackType.OffAttack, 100);
SetAttackTimer(WeaponAttackType.OffAttack, 100);
else if (!IsWithinBoundaryRadius(victim) && !HasInArc(2 * MathFunctions.PI / 3, victim))
setAttackTimer(WeaponAttackType.BaseAttack, 100);
SetAttackTimer(WeaponAttackType.BaseAttack, 100);
else
{
// prevent base and off attack in same time, delay attack at 0.2 sec
if (getAttackTimer(WeaponAttackType.BaseAttack) < SharedConst.AttackDisplayDelay)
setAttackTimer(WeaponAttackType.BaseAttack, SharedConst.AttackDisplayDelay);
if (GetAttackTimer(WeaponAttackType.BaseAttack) < SharedConst.AttackDisplayDelay)
SetAttackTimer(WeaponAttackType.BaseAttack, SharedConst.AttackDisplayDelay);
// do attack
AttackerStateUpdate(victim, WeaponAttackType.OffAttack);
resetAttackTimer(WeaponAttackType.OffAttack);
ResetAttackTimer(WeaponAttackType.OffAttack);
}
}
}
@@ -643,7 +643,7 @@ namespace Game.Entities
if (IsAlive())
{
m_regenTimer += diff;
RegenTimer += diff;
RegenerateAll();
}
@@ -722,7 +722,7 @@ namespace Game.Entities
SendUpdateToOutOfRangeGroupMembers();
Pet pet = GetPet();
if (pet != null && !pet.IsWithinDistInMap(this, GetMap().GetVisibilityRange()) && !pet.isPossessed())
if (pet != null && !pet.IsWithinDistInMap(this, GetMap().GetVisibilityRange()) && !pet.IsPossessed())
RemovePet(pet, PetSaveMode.NotInSlot, true);
if (IsAlive())
@@ -731,7 +731,7 @@ namespace Game.Entities
{
m_hostileReferenceCheckTimer = 15 * Time.InMilliseconds;
if (!GetMap().IsDungeon())
getHostileRefManager().deleteReferencesOutOfRange(GetVisibilityRange());
GetHostileRefManager().deleteReferencesOutOfRange(GetVisibilityRange());
}
else
m_hostileReferenceCheckTimer -= diff;
@@ -743,7 +743,7 @@ namespace Game.Entities
TeleportTo(teleportDest, m_teleport_options);
}
public override void setDeathState(DeathState s)
public override void SetDeathState(DeathState s)
{
bool oldIsAlive = IsAlive();
@@ -775,7 +775,7 @@ namespace Game.Entities
ResetCriteria(CriteriaTypes.GetKillingBlows, (uint)CriteriaCondition.NoDeath);
}
base.setDeathState(s);
base.SetDeathState(s);
if (IsAlive() && !oldIsAlive)
//clear aura case after resurrection by another way (spells will be applied before next death)
@@ -1001,7 +1001,7 @@ namespace Game.Entities
public void SetInvSlot(uint slot, ObjectGuid guid) { SetUpdateFieldValue(ref m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.InvSlots, (int)slot), guid); }
//Taxi
public void InitTaxiNodesForLevel() { m_taxi.InitTaxiNodesForLevel(GetRace(), GetClass(), getLevel()); }
public void InitTaxiNodesForLevel() { m_taxi.InitTaxiNodesForLevel(GetRace(), GetClass(), GetLevel()); }
//Cheat Commands
public bool GetCommandStatus(PlayerCommandStates command) { return (_activeCheats & command) != 0; }
@@ -1031,7 +1031,7 @@ namespace Game.Entities
if (!pet)
return;
if (m_temporaryUnsummonedPetNumber == 0 && pet.isControlled() && !pet.isTemporarySummoned())
if (m_temporaryUnsummonedPetNumber == 0 && pet.IsControlled() && !pet.IsTemporarySummoned())
{
m_temporaryUnsummonedPetNumber = pet.GetCharmInfo().GetPetNumber();
m_oldpetspell = pet.m_unitData.CreatedBySpell;
@@ -1528,7 +1528,7 @@ namespace Game.Entities
break;
}
if (rate != 1.0f && creatureOrQuestLevel < Formulas.GetGrayLevel(getLevel()))
if (rate != 1.0f && creatureOrQuestLevel < Formulas.GetGrayLevel(GetLevel()))
percent *= rate;
if (percent <= 0.0f)
@@ -1958,7 +1958,7 @@ namespace Game.Entities
// remove auras that need water/land
RemoveAurasWithInterruptFlags((apply ? SpellAuraInterruptFlags.NotAbovewater : SpellAuraInterruptFlags.NotUnderwater));
getHostileRefManager().updateThreatTables();
GetHostileRefManager().updateThreatTables();
}
public void ValidateMovementInfo(MovementInfo mi)
{
@@ -2177,7 +2177,7 @@ namespace Game.Entities
}
//GM
public bool isAcceptWhispers() { return m_ExtraFlags.HasAnyFlag(PlayerExtraFlags.AcceptWhispers); }
public bool IsAcceptWhispers() { return m_ExtraFlags.HasAnyFlag(PlayerExtraFlags.AcceptWhispers); }
public void SetAcceptWhispers(bool on)
{
if (on)
@@ -2200,13 +2200,13 @@ namespace Game.Entities
if (pet != null)
{
pet.SetFaction(35);
pet.getHostileRefManager().setOnlineOfflineState(false);
pet.GetHostileRefManager().setOnlineOfflineState(false);
}
RemovePvpFlag(UnitPVPStateFlags.FFAPvp);
ResetContestedPvP();
getHostileRefManager().setOnlineOfflineState(false);
GetHostileRefManager().setOnlineOfflineState(false);
CombatStopWithPets();
PhasingHandler.SetAlwaysVisible(GetPhaseShift(), true);
@@ -2225,7 +2225,7 @@ namespace Game.Entities
if (pet != null)
{
pet.SetFaction(GetFaction());
pet.getHostileRefManager().setOnlineOfflineState(true);
pet.GetHostileRefManager().setOnlineOfflineState(true);
}
// restore FFA PvP Server state
@@ -2235,13 +2235,13 @@ namespace Game.Entities
// restore FFA PvP area state, remove not allowed for GM mounts
UpdateArea(m_areaUpdateId);
getHostileRefManager().setOnlineOfflineState(true);
GetHostileRefManager().setOnlineOfflineState(true);
m_serverSideVisibilityDetect.SetValue(ServerSideVisibilityType.GM, AccountTypes.Player);
}
UpdateObjectVisibility();
}
public bool isGMChat() { return m_ExtraFlags.HasAnyFlag(PlayerExtraFlags.GMChat); }
public bool IsGMChat() { return m_ExtraFlags.HasAnyFlag(PlayerExtraFlags.GMChat); }
public void SetGMChat(bool on)
{
if (on)
@@ -2249,7 +2249,7 @@ namespace Game.Entities
else
m_ExtraFlags &= ~PlayerExtraFlags.GMChat;
}
public bool isTaxiCheater() { return m_ExtraFlags.HasAnyFlag(PlayerExtraFlags.TaxiCheat); }
public bool IsTaxiCheater() { return m_ExtraFlags.HasAnyFlag(PlayerExtraFlags.TaxiCheat); }
public void SetTaxiCheater(bool on)
{
if (on)
@@ -2257,7 +2257,7 @@ namespace Game.Entities
else
m_ExtraFlags &= ~PlayerExtraFlags.TaxiCheat;
}
public bool isGMVisible() { return !m_ExtraFlags.HasAnyFlag(PlayerExtraFlags.GMInvisible); }
public bool IsGMVisible() { return !m_ExtraFlags.HasAnyFlag(PlayerExtraFlags.GMInvisible); }
public void SetGMVisible(bool on)
{
if (on)
@@ -2347,7 +2347,7 @@ namespace Game.Entities
return;
break;
case GossipOption.Battlefield:
if (!creature.isCanInteractWithBattleMaster(this, false))
if (!creature.CanInteractWithBattleMaster(this, false))
canTalk = false;
break;
case GossipOption.Stablepet:
@@ -3506,7 +3506,7 @@ namespace Game.Entities
(newCustomDisplay[2] == null || (newCustomDisplay[2].Data == customDisplay[2])))
return 0;
GtBarberShopCostBaseRecord bsc = CliDB.BarberShopCostBaseGameTable.GetRow(getLevel());
GtBarberShopCostBaseRecord bsc = CliDB.BarberShopCostBaseGameTable.GetRow(GetLevel());
if (bsc == null) // shouldn't happen
return 0xFFFFFFFF;
@@ -3535,7 +3535,7 @@ namespace Game.Entities
uint GetChampioningFaction() { return m_ChampioningFaction; }
public void SetChampioningFaction(uint faction) { m_ChampioningFaction = faction; }
public void setFactionForRace(Race race)
public void SetFactionForRace(Race race)
{
m_team = TeamForRace(race);
@@ -3643,7 +3643,7 @@ namespace Game.Entities
SendPacket(packet);
}
public bool isAllowedToLoot(Creature creature)
public bool IsAllowedToLoot(Creature creature)
{
if (!creature.IsDead() || !creature.IsDamageEnoughForLootingAndReward())
return false;
@@ -3706,7 +3706,7 @@ namespace Game.Entities
void RegenerateAll()
{
m_regenTimerCount += m_regenTimer;
m_regenTimerCount += RegenTimer;
for (PowerType power = PowerType.Mana; power < PowerType.Max; power++)// = power + 1)
if (power != PowerType.Runes)
@@ -3721,9 +3721,9 @@ namespace Game.Entities
{
byte runeToRegen = m_runes.CooldownOrder[regenIndex];
uint runeCooldown = GetRuneCooldown(runeToRegen);
if (runeCooldown > m_regenTimer)
if (runeCooldown > RegenTimer)
{
SetRuneCooldown(runeToRegen, runeCooldown - m_regenTimer);
SetRuneCooldown(runeToRegen, runeCooldown - RegenTimer);
++regenIndex;
}
else
@@ -3742,7 +3742,7 @@ namespace Game.Entities
m_regenTimerCount -= 2000;
}
m_regenTimer = 0;
RegenTimer = 0;
}
void Regenerate(PowerType power)
{
@@ -3769,10 +3769,10 @@ namespace Game.Entities
if (powerType.RegenInterruptTimeMS != 0 && Time.GetMSTimeDiffToNow(m_combatExitTime) < powerType.RegenInterruptTimeMS)
return;
addvalue = (powerType.RegenPeace + m_unitData.PowerRegenFlatModifier[(int)powerIndex]) * 0.001f * m_regenTimer;
addvalue = (powerType.RegenPeace + m_unitData.PowerRegenFlatModifier[(int)powerIndex]) * 0.001f * RegenTimer;
}
else
addvalue = (powerType.RegenCombat + m_unitData.PowerRegenInterruptedFlatModifier[(int)powerIndex]) * 0.001f * m_regenTimer;
addvalue = (powerType.RegenCombat + m_unitData.PowerRegenInterruptedFlatModifier[(int)powerIndex]) * 0.001f * RegenTimer;
WorldCfg[] RatesForPower =
{
@@ -3804,7 +3804,7 @@ namespace Game.Entities
if (power != PowerType.Mana)
{
addvalue *= GetTotalAuraMultiplierByMiscValue(AuraType.ModPowerRegenPercent, (int)power);
addvalue += GetTotalAuraModifierByMiscValue(AuraType.ModPowerRegen, (int)power) * ((power != PowerType.Energy) ? m_regenTimerCount : m_regenTimer) / (5 * Time.InMilliseconds);
addvalue += GetTotalAuraModifierByMiscValue(AuraType.ModPowerRegen, (int)power) * ((power != PowerType.Energy) ? m_regenTimerCount : RegenTimer) / (5 * Time.InMilliseconds);
}
int minPower = powerType.MinPower;
@@ -3898,8 +3898,8 @@ namespace Game.Entities
addValue = HealthIncreaseRate;
if (!IsInCombat())
{
if (getLevel() < 15)
addValue = (0.20f * (GetMaxHealth()) / getLevel() * HealthIncreaseRate);
if (GetLevel() < 15)
addValue = (0.20f * (GetMaxHealth()) / GetLevel() * HealthIncreaseRate);
else
addValue = 0.015f * (GetMaxHealth()) * HealthIncreaseRate;
@@ -4116,7 +4116,7 @@ namespace Game.Entities
bool IsImmuneToEnvironmentalDamage()
{
// check for GM and death state included in isAttackableByAOE
return (!isTargetableForAttack(false));
return (!IsTargetableForAttack(false));
}
public uint EnvironmentalDamage(EnviromentalDamage type, uint damage)
{
@@ -4168,7 +4168,7 @@ namespace Game.Entities
return final_damage;
}
bool isTotalImmune()
bool IsTotalImmune()
{
var immune = GetAuraEffectsByType(AuraType.SchoolImmunity);
@@ -4273,7 +4273,7 @@ namespace Game.Entities
public bool IsMirrorTimerActive(MirrorTimerType type)
{
return m_MirrorTimer[(int)type] == getMaxTimer(type);
return m_MirrorTimer[(int)type] == GetMaxTimer(type);
}
void HandleDrowning(uint time_diff)
@@ -4291,7 +4291,7 @@ namespace Game.Entities
// Breath timer not activated - activate it
if (m_MirrorTimer[breathTimer] == -1)
{
m_MirrorTimer[breathTimer] = getMaxTimer(MirrorTimerType.Breath);
m_MirrorTimer[breathTimer] = GetMaxTimer(MirrorTimerType.Breath);
SendMirrorTimer(MirrorTimerType.Breath, m_MirrorTimer[breathTimer], m_MirrorTimer[breathTimer], -1);
}
else // If activated - do tick
@@ -4303,16 +4303,16 @@ namespace Game.Entities
m_MirrorTimer[breathTimer] += 1 * Time.InMilliseconds;
// Calculate and deal damage
// @todo Check this formula
uint damage = (uint)(GetMaxHealth() / 5 + RandomHelper.URand(0, getLevel() - 1));
uint damage = (uint)(GetMaxHealth() / 5 + RandomHelper.URand(0, GetLevel() - 1));
EnvironmentalDamage(EnviromentalDamage.Drowning, damage);
}
else if (!m_MirrorTimerFlagsLast.HasAnyFlag(PlayerUnderwaterState.InWater)) // Update time in client if need
SendMirrorTimer(MirrorTimerType.Breath, getMaxTimer(MirrorTimerType.Breath), m_MirrorTimer[breathTimer], -1);
SendMirrorTimer(MirrorTimerType.Breath, GetMaxTimer(MirrorTimerType.Breath), m_MirrorTimer[breathTimer], -1);
}
}
else if (m_MirrorTimer[breathTimer] != -1) // Regen timer
{
int UnderWaterTime = getMaxTimer(MirrorTimerType.Breath);
int UnderWaterTime = GetMaxTimer(MirrorTimerType.Breath);
// Need breath regen
m_MirrorTimer[breathTimer] += (int)(10 * time_diff);
if (m_MirrorTimer[breathTimer] >= UnderWaterTime || !IsAlive())
@@ -4327,7 +4327,7 @@ namespace Game.Entities
// Fatigue timer not activated - activate it
if (m_MirrorTimer[fatigueTimer] == -1)
{
m_MirrorTimer[fatigueTimer] = getMaxTimer(MirrorTimerType.Fatigue);
m_MirrorTimer[fatigueTimer] = GetMaxTimer(MirrorTimerType.Fatigue);
SendMirrorTimer(MirrorTimerType.Fatigue, m_MirrorTimer[fatigueTimer], m_MirrorTimer[fatigueTimer], -1);
}
else
@@ -4339,19 +4339,19 @@ namespace Game.Entities
m_MirrorTimer[fatigueTimer] += 1 * Time.InMilliseconds;
if (IsAlive()) // Calculate and deal damage
{
uint damage = (uint)(GetMaxHealth() / 5 + RandomHelper.URand(0, getLevel() - 1));
uint damage = (uint)(GetMaxHealth() / 5 + RandomHelper.URand(0, GetLevel() - 1));
EnvironmentalDamage(EnviromentalDamage.Exhausted, damage);
}
else if (HasPlayerFlag(PlayerFlags.Ghost)) // Teleport ghost to graveyard
RepopAtGraveyard();
}
else if (!m_MirrorTimerFlagsLast.HasAnyFlag(PlayerUnderwaterState.InDarkWater))
SendMirrorTimer(MirrorTimerType.Fatigue, getMaxTimer(MirrorTimerType.Fatigue), m_MirrorTimer[fatigueTimer], -1);
SendMirrorTimer(MirrorTimerType.Fatigue, GetMaxTimer(MirrorTimerType.Fatigue), m_MirrorTimer[fatigueTimer], -1);
}
}
else if (m_MirrorTimer[fatigueTimer] != -1) // Regen timer
{
int DarkWaterTime = getMaxTimer(MirrorTimerType.Fatigue);
int DarkWaterTime = GetMaxTimer(MirrorTimerType.Fatigue);
m_MirrorTimer[fatigueTimer] += (int)(10 * time_diff);
if (m_MirrorTimer[fatigueTimer] >= DarkWaterTime || !IsAlive())
StopMirrorTimer(MirrorTimerType.Fatigue);
@@ -4363,7 +4363,7 @@ namespace Game.Entities
{
// Breath timer not activated - activate it
if (m_MirrorTimer[fireTimer] == -1)
m_MirrorTimer[fireTimer] = getMaxTimer(MirrorTimerType.Fire);
m_MirrorTimer[fireTimer] = GetMaxTimer(MirrorTimerType.Fire);
else
{
m_MirrorTimer[fireTimer] -= (int)time_diff;
@@ -4425,7 +4425,7 @@ namespace Game.Entities
SendPacket(new StopMirrorTimer(Type));
}
int getMaxTimer(MirrorTimerType timer)
int GetMaxTimer(MirrorTimerType timer)
{
switch (timer)
{
@@ -4476,7 +4476,7 @@ namespace Game.Entities
if (GetSession().IsARecruiter() || (GetSession().GetRecruiterId() != 0))
AddDynamicFlag(UnitDynFlags.ReferAFriend);
setDeathState(DeathState.Alive);
SetDeathState(DeathState.Alive);
// add the flag to make sure opcode is always sent
AddUnitMovementFlag(MovementFlag.WaterWalk);
@@ -4525,15 +4525,15 @@ namespace Game.Entities
//Characters level 20 and up suffer from ten minutes of sickness.
int startLevel = WorldConfig.GetIntValue(WorldCfg.DeathSicknessLevel);
if (getLevel() >= startLevel)
if (GetLevel() >= startLevel)
{
// set resurrection sickness
CastSpell(this, 15007, true);
// not full duration
if (getLevel() < startLevel + 9)
if (GetLevel() < startLevel + 9)
{
int delta = (int)(getLevel() - startLevel + 1) * Time.Minute;
int delta = (int)(GetLevel() - startLevel + 1) * Time.Minute;
Aura aur = GetAura(15007, GetGUID());
if (aur != null)
aur.SetDuration(delta * Time.InMilliseconds);
@@ -4551,7 +4551,7 @@ namespace Game.Entities
StopMirrorTimers(); //disable timers(bars)
setDeathState(DeathState.Corpse);
SetDeathState(DeathState.Corpse);
SetDynamicFlags(UnitDynFlags.None);
if (!CliDB.MapStorage.LookupByKey(GetMapId()).Instanceable() && !HasAuraType(AuraType.PreventResurrection))
@@ -4847,7 +4847,7 @@ namespace Game.Entities
pet.SetFaction(GetFaction());
pet.SetNpcFlags(NPCFlags.None);
pet.SetNpcFlags2(NPCFlags2.None);
pet.InitStatsForLevel(getLevel());
pet.InitStatsForLevel(GetLevel());
SetMinion(pet, true);
@@ -4954,7 +4954,7 @@ namespace Game.Entities
pet.AddObjectToRemoveList();
pet.m_removed = true;
if (pet.isControlled())
if (pet.IsControlled())
{
SendPacket(new PetSpells());
@@ -5149,10 +5149,10 @@ namespace Game.Entities
}
// Used in triggers for check "Only to targets that grant experience or honor" req
public bool isHonorOrXPTarget(Unit victim)
public bool IsHonorOrXPTarget(Unit victim)
{
uint v_level = victim.GetLevelForTarget(this);
uint k_grey = Formulas.GetGrayLevel(getLevel());
uint k_grey = Formulas.GetGrayLevel(GetLevel());
// Victim level less gray level
if (v_level < k_grey)
@@ -5167,8 +5167,8 @@ namespace Game.Entities
return true;
}
public void setRegenTimerCount(uint time) { m_regenTimerCount = time; }
void setWeaponChangeTimer(uint time) { m_weaponChangeTimer = time; }
public void SetRegenTimerCount(uint time) { m_regenTimerCount = time; }
void SetWeaponChangeTimer(uint time) { m_weaponChangeTimer = time; }
//Team
public static Team TeamForRace(Race race)
@@ -5257,13 +5257,6 @@ namespace Game.Entities
DB.Characters.Execute(stmt);
}
}
void SetFactionForRace(Race race)
{
m_team = TeamForRace(race);
var rEntry = CliDB.ChrRacesStorage.LookupByKey(race);
SetFaction(rEntry.FactionID);
}
//Guild
public void SetInGuild(ulong guildId)
@@ -5301,7 +5294,7 @@ namespace Game.Entities
public void SetFreePrimaryProfessions(uint profs) { SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.CharacterPoints), profs); }
public void GiveLevel(uint level)
{
var oldLevel = getLevel();
var oldLevel = GetLevel();
if (level == oldLevel)
return;
@@ -5384,7 +5377,7 @@ namespace Game.Entities
if (pet)
pet.SynchronizeLevelWithOwner();
MailLevelReward mailReward = Global.ObjectMgr.GetMailLevelReward(level, (uint)getRaceMask());
MailLevelReward mailReward = Global.ObjectMgr.GetMailLevelReward(level, (uint)GetRaceMask());
if (mailReward != null)
{
//- TODO: Poor design of mail system
@@ -5423,33 +5416,33 @@ namespace Game.Entities
public void ToggleAFK()
{
if (isAFK())
if (IsAFK())
RemovePlayerFlag(PlayerFlags.AFK);
else
AddPlayerFlag(PlayerFlags.AFK);
// afk player not allowed in Battleground
if (!IsGameMaster() && isAFK() && InBattleground() && !InArena())
if (!IsGameMaster() && IsAFK() && InBattleground() && !InArena())
LeaveBattleground();
}
public void ToggleDND()
{
if (isDND())
if (IsDND())
RemovePlayerFlag(PlayerFlags.DND);
else
AddPlayerFlag(PlayerFlags.DND);
}
public bool isAFK() { return HasPlayerFlag(PlayerFlags.AFK); }
public bool isDND() { return HasPlayerFlag(PlayerFlags.DND); }
public bool IsAFK() { return HasPlayerFlag(PlayerFlags.AFK); }
public bool IsDND() { return HasPlayerFlag(PlayerFlags.DND); }
public ChatFlags GetChatFlags()
{
ChatFlags tag = ChatFlags.None;
if (isGMChat())
if (IsGMChat())
tag |= ChatFlags.GM;
if (isDND())
if (IsDND())
tag |= ChatFlags.DND;
if (isAFK())
if (IsAFK())
tag |= ChatFlags.AFK;
if (HasPlayerFlag(PlayerFlags.Developer))
tag |= ChatFlags.Dev;
@@ -5823,12 +5816,12 @@ namespace Game.Entities
_RemoveAllStatBonuses();
uint basemana;
Global.ObjectMgr.GetPlayerClassLevelInfo(GetClass(), getLevel(), out basemana);
Global.ObjectMgr.GetPlayerClassLevelInfo(GetClass(), GetLevel(), out basemana);
PlayerLevelInfo info = Global.ObjectMgr.GetPlayerLevelInfo(GetRace(), GetClass(), getLevel());
PlayerLevelInfo info = Global.ObjectMgr.GetPlayerLevelInfo(GetRace(), GetClass(), GetLevel());
SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.MaxLevel), WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel));
SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.NextLevelXP), Global.ObjectMgr.GetXPForLevel(getLevel()));
SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.NextLevelXP), Global.ObjectMgr.GetXPForLevel(GetLevel()));
// reset before any aura state sources (health set/aura apply)
SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.AuraState), 0u);
@@ -6052,7 +6045,7 @@ namespace Game.Entities
// target aura duration for caster show only if target exist at caster client
// send data at target visibility change (adding to client)
if (target.isTypeMask(TypeMask.Unit))
if (target.IsTypeMask(TypeMask.Unit))
SendInitialVisiblePackets(target.ToUnit());
}
}
@@ -6311,17 +6304,17 @@ namespace Game.Entities
if (areaEntry.ExplorationLevel > 0)
{
if (getLevel() >= WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel))
if (GetLevel() >= WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel))
{
SendExplorationExperience(areaId, 0);
}
else
{
int diff = (int)(getLevel() - areaEntry.ExplorationLevel);
int diff = (int)(GetLevel() - areaEntry.ExplorationLevel);
uint XP = 0;
if (diff < -5)
{
XP = (uint)(Global.ObjectMgr.GetBaseXP(getLevel() + 5) * WorldConfig.GetFloatValue(WorldCfg.RateXpExplore));
XP = (uint)(Global.ObjectMgr.GetBaseXP(GetLevel() + 5) * WorldConfig.GetFloatValue(WorldCfg.RateXpExplore));
}
else if (diff > 5)
{
@@ -6453,16 +6446,16 @@ namespace Game.Entities
data.Initialize(ChatMsg.WhisperInform, language, target, target, text);
SendPacket(data);
if (!isAcceptWhispers() && !IsGameMaster() && !target.IsGameMaster())
if (!IsAcceptWhispers() && !IsGameMaster() && !target.IsGameMaster())
{
SetAcceptWhispers(true);
SendSysMessage(CypherStrings.CommandWhisperon);
}
// announce afk or dnd message
if (target.isAFK())
if (target.IsAFK())
SendSysMessage(CypherStrings.PlayerAfk, target.GetName(), target.autoReplyMsg);
else if (target.isDND())
else if (target.IsDND())
SendSysMessage(CypherStrings.PlayerDnd, target.GetName(), target.autoReplyMsg);
}
@@ -6496,8 +6489,8 @@ namespace Game.Entities
m_lastFallZ = z;
}
public byte getCinematic() { return m_cinematic; }
public void setCinematic(byte cine) { m_cinematic = cine; }
public byte GetCinematic() { return m_cinematic; }
public void SetCinematic(byte cine) { m_cinematic = cine; }
public uint GetMovie() { return m_movie; }
public void SetMovie(uint movie) { m_movie = movie; }
@@ -6536,7 +6529,7 @@ namespace Game.Entities
int playerLevelDelta = 0;
// If XP < 50%, player should see scaling creature with -1 level except for level max
if (getLevel() < SharedConst.MaxLevel && xp < (m_activePlayerData.NextLevelXP / 2))
if (GetLevel() < SharedConst.MaxLevel && xp < (m_activePlayerData.NextLevelXP / 2))
playerLevelDelta = -1;
SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.ScalingPlayerLevelDelta), playerLevelDelta);
@@ -6553,10 +6546,10 @@ namespace Game.Entities
if (HasPlayerFlag(PlayerFlags.NoXPGain))
return;
if (victim != null && victim.IsTypeId(TypeId.Unit) && !victim.ToCreature().hasLootRecipient())
if (victim != null && victim.IsTypeId(TypeId.Unit) && !victim.ToCreature().HasLootRecipient())
return;
uint level = getLevel();
uint level = GetLevel();
Global.ScriptMgr.OnGivePlayerXP(this, xp, victim);
@@ -6593,7 +6586,7 @@ namespace Game.Entities
if (level < WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel))
GiveLevel(level + 1);
level = getLevel();
level = GetLevel();
nextLvlXP = m_activePlayerData.NextLevelXP;
}
@@ -6757,7 +6750,7 @@ namespace Game.Entities
if (GetDisplayId() != GetNativeDisplayId())
RestoreDisplayId(true);
if (IsDisallowedMountForm(getTransForm(), ShapeShiftForm.None, GetDisplayId()))
if (IsDisallowedMountForm(GetTransForm(), ShapeShiftForm.None, GetDisplayId()))
{
GetSession().SendActivateTaxiReply(ActivateTaxiReply.PlayerShapeshifted);
return false;
@@ -6931,7 +6924,7 @@ namespace Game.Entities
m_taxi.ClearTaxiDestinations(); // not destinations, clear source node
Dismount();
RemoveUnitFlag(UnitFlags.RemoveClientControl | UnitFlags.TaxiFlight);
getHostileRefManager().setOnlineOfflineState(true);
GetHostileRefManager().setOnlineOfflineState(true);
}
public void ContinueTaxiFlight()
@@ -6989,7 +6982,7 @@ namespace Game.Entities
public bool GetsRecruitAFriendBonus(bool forXP)
{
bool recruitAFriend = false;
if (getLevel() <= WorldConfig.GetIntValue(WorldCfg.MaxRecruitAFriendBonusPlayerLevel) || !forXP)
if (GetLevel() <= WorldConfig.GetIntValue(WorldCfg.MaxRecruitAFriendBonusPlayerLevel) || !forXP)
{
Group group = GetGroup();
if (group)
@@ -7006,12 +6999,12 @@ namespace Game.Entities
if (forXP)
{
// level must be allowed to get RaF bonus
if (player.getLevel() > WorldConfig.GetIntValue(WorldCfg.MaxRecruitAFriendBonusPlayerLevel))
if (player.GetLevel() > WorldConfig.GetIntValue(WorldCfg.MaxRecruitAFriendBonusPlayerLevel))
continue;
// level difference must be small enough to get RaF bonus, UNLESS we are lower level
if (player.getLevel() < getLevel())
if (getLevel() - player.getLevel() > WorldConfig.GetIntValue(WorldCfg.MaxRecruitAFriendBonusPlayerLevelDifference))
if (player.GetLevel() < GetLevel())
if (GetLevel() - player.GetLevel() > WorldConfig.GetIntValue(WorldCfg.MaxRecruitAFriendBonusPlayerLevelDifference))
continue;
}
@@ -7109,8 +7102,8 @@ namespace Game.Entities
}
public bool IsSpellFitByClassAndRace(uint spell_id)
{
ulong racemask = getRaceMask();
uint classmask = getClassMask();
ulong racemask = GetRaceMask();
uint classmask = GetClassMask();
var bounds = Global.SpellMgr.GetSkillLineAbilityMapBounds(spell_id);
@@ -7202,7 +7195,7 @@ namespace Game.Entities
// farsight dynobj or puppet may be very far away
UpdateVisibilityOf(target);
if (target.isTypeMask(TypeMask.Unit) && target != GetVehicleBase())
if (target.IsTypeMask(TypeMask.Unit) && target != GetVehicleBase())
target.ToUnit().AddPlayerToVision(this);
SetSeer(target);
}
@@ -7218,7 +7211,7 @@ namespace Game.Entities
SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.FarsightObject), ObjectGuid.Empty);
if (target.isTypeMask(TypeMask.Unit) && target != GetVehicleBase())
if (target.IsTypeMask(TypeMask.Unit) && target != GetVehicleBase())
target.ToUnit().RemovePlayerFromVision(this);
//must immediately set seer back otherwise may crash
+5 -5
View File
@@ -27,6 +27,10 @@ namespace Game.Entities
{
public class PlayerTaxi
{
public byte[] m_taximask = new byte[PlayerConst.TaxiMaskSize];
List<uint> m_TaxiDestinations = new List<uint>();
uint m_flightMasterFactionId;
public void InitTaxiNodesForLevel(Race race, Class chrClass, uint level)
{
// class specific initial known nodes
@@ -261,10 +265,6 @@ namespace Game.Entities
return GetTaxiDestination();
}
public List<uint> GetPath() { return m_TaxiDestinations; }
public bool empty() { return m_TaxiDestinations.Empty(); }
public byte[] m_taximask = new byte[PlayerConst.TaxiMaskSize];
List<uint> m_TaxiDestinations = new List<uint>();
uint m_flightMasterFactionId;
public bool Empty() { return m_TaxiDestinations.Empty(); }
}
}
+8 -8
View File
@@ -4,6 +4,12 @@ namespace Game.Entities
{
public class RestMgr
{
Player _player;
long _restTime;
uint _innAreaTriggerId;
float[] _restBonus = new float[(int)RestTypes.Max];
RestFlag _restFlagMask;
public RestMgr(Player player)
{
_player = player;
@@ -18,7 +24,7 @@ namespace Game.Entities
{
case RestTypes.XP:
// Reset restBonus (XP only) for max level players
if (_player.getLevel() >= WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel))
if (_player.GetLevel() >= WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel))
restBonus = 0;
next_level_xp = _player.m_activePlayerData.NextLevelXP;
@@ -67,7 +73,7 @@ namespace Game.Entities
public void AddRestBonus(RestTypes restType, float restBonus)
{
// Don't add extra rest bonus to max level players. Note: Might need different condition in next expansion for honor XP (PLAYER_LEVEL_MIN_HONOR perhaps).
if (_player.getLevel() >= WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel))
if (_player.GetLevel() >= WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel))
restBonus = 0;
float totalRestBonus = GetRestBonus(restType) + restBonus;
@@ -153,11 +159,5 @@ namespace Game.Entities
public float GetRestBonus(RestTypes restType) { return _restBonus[(int)restType]; }
public bool HasRestFlag(RestFlag restFlag) { return (_restFlagMask & restFlag) != 0; }
public uint GetInnTriggerId() { return _innAreaTriggerId; }
Player _player;
long _restTime;
uint _innAreaTriggerId;
float[] _restBonus = new float[(int)RestTypes.Max];
RestFlag _restFlagMask;
}
}
+5 -5
View File
@@ -25,6 +25,11 @@ namespace Game.Entities
{
public class SceneMgr
{
Player _player;
Dictionary<uint, SceneTemplate> _scenesByInstance = new Dictionary<uint, SceneTemplate>();
uint _standaloneSceneInstanceID;
bool _isDebuggingScenes;
public SceneMgr(Player player)
{
_player = player;
@@ -237,10 +242,5 @@ namespace Game.Entities
public void ToggleDebugSceneMode() { _isDebuggingScenes = !_isDebuggingScenes; }
public bool IsInDebugSceneMode() { return _isDebuggingScenes; }
Player _player;
Dictionary<uint, SceneTemplate> _scenesByInstance = new Dictionary<uint, SceneTemplate>();
uint _standaloneSceneInstanceID;
bool _isDebuggingScenes;
}
}
+16 -16
View File
@@ -26,6 +26,8 @@ namespace Game.Entities
{
public class SocialManager : Singleton<SocialManager>
{
Dictionary<ObjectGuid, PlayerSocial> _socialMap = new Dictionary<ObjectGuid, PlayerSocial>();
SocialManager() { }
public const int FriendLimit = 50;
@@ -62,15 +64,15 @@ namespace Game.Entities
if (target.IsVisibleGloballyFor(player))
{
if (target.isDND())
if (target.IsDND())
friendInfo.Status = FriendStatus.DND;
else if (target.isAFK())
else if (target.IsAFK())
friendInfo.Status = FriendStatus.AFK;
else
friendInfo.Status = FriendStatus.Online;
friendInfo.Area = target.GetZoneId();
friendInfo.Level = target.getLevel();
friendInfo.Level = target.GetLevel();
friendInfo.Class = target.GetClass();
}
}
@@ -141,12 +143,13 @@ namespace Game.Entities
}
public void RemovePlayerSocial(ObjectGuid guid) { _socialMap.Remove(guid); }
Dictionary<ObjectGuid, PlayerSocial> _socialMap = new Dictionary<ObjectGuid, PlayerSocial>();
}
public class PlayerSocial
{
public Dictionary<ObjectGuid, FriendInfo> _playerSocialMap = new Dictionary<ObjectGuid, FriendInfo>();
ObjectGuid m_playerGUID;
uint GetNumberOfSocialsWithFlag(SocialFlag flag)
{
uint counter = 0;
@@ -277,13 +280,18 @@ namespace Game.Entities
ObjectGuid GetPlayerGUID() { return m_playerGUID; }
public void SetPlayerGUID(ObjectGuid guid) { m_playerGUID = guid; }
public Dictionary<ObjectGuid, FriendInfo> _playerSocialMap = new Dictionary<ObjectGuid, FriendInfo>();
ObjectGuid m_playerGUID;
}
public class FriendInfo
{
public ObjectGuid WowAccountGuid;
public FriendStatus Status;
public SocialFlag Flags;
public uint Area;
public uint Level;
public Class Class;
public string Note;
public FriendInfo()
{
Status = FriendStatus.Offline;
@@ -297,14 +305,6 @@ namespace Game.Entities
Flags = flags;
Note = note;
}
public ObjectGuid WowAccountGuid;
public FriendStatus Status;
public SocialFlag Flags;
public uint Area;
public uint Level;
public Class Class;
public string Note;
}
public enum FriendStatus
+17 -17
View File
@@ -344,9 +344,9 @@ namespace Game.Entities
public ulong GetHealth() { return m_unitData.Health; }
public void SetHealth(ulong val)
{
if (getDeathState() == DeathState.JustDied)
if (GetDeathState() == DeathState.JustDied)
val = 0;
else if (IsTypeId(TypeId.Player) && getDeathState() == DeathState.Dead)
else if (IsTypeId(TypeId.Player) && GetDeathState() == DeathState.Dead)
val = 1;
else
{
@@ -367,7 +367,7 @@ namespace Game.Entities
else if (IsPet())
{
Pet pet = ToCreature().ToPet();
if (pet.isControlled())
if (pet.IsControlled())
pet.SetGroupUpdateFlag(GroupUpdatePetFlags.CurHp);
}
}
@@ -389,7 +389,7 @@ namespace Game.Entities
else if (IsPet())
{
Pet pet = ToCreature().ToPet();
if (pet.isControlled())
if (pet.IsControlled())
pet.SetGroupUpdateFlag(GroupUpdatePetFlags.MaxHp);
}
@@ -605,7 +605,7 @@ namespace Game.Entities
//calculate miss chance
float missChance = victim.GetUnitMissChance(attType);
if (spellId == 0 && haveOffhandWeapon() && !IsInFeralForm())
if (spellId == 0 && HaveOffhandWeapon() && !IsInFeralForm())
missChance += 19;
// Calculate hit chance
@@ -622,9 +622,9 @@ namespace Game.Entities
missChance += hitChance - 100.0f;
if (attType == WeaponAttackType.RangedAttack)
missChance -= m_modRangedHitChance;
missChance -= ModRangedHitChance;
else
missChance -= m_modMeleeHitChance;
missChance -= ModMeleeHitChance;
// Limit miss chance from 0 to 77%
if (missChance < 0.0f)
@@ -1024,7 +1024,7 @@ namespace Game.Entities
// Get base of Mana Pool in sBaseMPGameTable
uint basemana;
Global.ObjectMgr.GetPlayerClassLevelInfo(GetClass(), getLevel(), out basemana);
Global.ObjectMgr.GetPlayerClassLevelInfo(GetClass(), GetLevel(), out basemana);
float base_regen = basemana / 100.0f;
base_regen += GetTotalAuraModifierByMiscValue(AuraType.ModPowerRegen, (int)PowerType.Mana);
@@ -1070,7 +1070,7 @@ namespace Game.Entities
public override void UpdateAttackPowerAndDamage(bool ranged = false)
{
float val2 = 0.0f;
float level = getLevel();
float level = GetLevel();
var entry = CliDB.ChrClassesStorage.LookupByKey(GetClass());
UnitMods unitMod = ranged ? UnitMods.AttackPowerRanged : UnitMods.AttackPower;
@@ -1626,20 +1626,20 @@ namespace Game.Entities
public void UpdateMeleeHitChances()
{
m_modMeleeHitChance = 7.5f + GetTotalAuraModifier(AuraType.ModHitChance);
m_modMeleeHitChance += GetRatingBonusValue(CombatRating.HitMelee);
ModMeleeHitChance = 7.5f + GetTotalAuraModifier(AuraType.ModHitChance);
ModMeleeHitChance += GetRatingBonusValue(CombatRating.HitMelee);
}
public void UpdateRangedHitChances()
{
m_modRangedHitChance = 7.5f + GetTotalAuraModifier(AuraType.ModHitChance);
m_modRangedHitChance += GetRatingBonusValue(CombatRating.HitRanged);
ModRangedHitChance = 7.5f + GetTotalAuraModifier(AuraType.ModHitChance);
ModRangedHitChance += GetRatingBonusValue(CombatRating.HitRanged);
}
public void UpdateSpellHitChances()
{
m_modSpellHitChance = 15.0f + GetTotalAuraModifier(AuraType.ModSpellHitChance);
m_modSpellHitChance += GetRatingBonusValue(CombatRating.HitSpell);
ModSpellHitChance = 15.0f + GetTotalAuraModifier(AuraType.ModSpellHitChance);
ModSpellHitChance += GetRatingBonusValue(CombatRating.HitSpell);
}
public override void UpdateMaxHealth()
{
@@ -1656,7 +1656,7 @@ namespace Game.Entities
{
// Taken from PaperDollFrame.lua - 6.0.3.19085
float ratio = 10.0f;
GtHpPerStaRecord hpBase = CliDB.HpPerStaGameTable.GetRow(getLevel());
GtHpPerStaRecord hpBase = CliDB.HpPerStaGameTable.GetRow(GetLevel());
if (hpBase != null)
ratio = hpBase.Health;
@@ -1869,7 +1869,7 @@ namespace Game.Entities
break;
}
if (attType == WeaponAttackType.OffAttack && !haveOffhandWeapon())
if (attType == WeaponAttackType.OffAttack && !HaveOffhandWeapon())
{
minDamage = 0.0f;
maxDamage = 0.0f;
+12 -13
View File
@@ -18,7 +18,6 @@
using Framework.Constants;
using Framework.Dynamic;
using Game.DataStorage;
using System;
using System.Collections.Generic;
namespace Game.Entities
@@ -31,7 +30,7 @@ namespace Game.Entities
m_type = TempSummonType.ManualDespawn;
m_summonerGUID = owner != null ? owner.GetGUID() : ObjectGuid.Empty;
m_unitTypeMask |= UnitTypeMask.Summon;
UnitTypeMask |= UnitTypeMask.Summon;
}
public Unit GetSummoner()
@@ -188,7 +187,7 @@ namespace Game.Entities
if (owner != null && IsTrigger() && m_spells[0] != 0)
{
SetFaction(owner.GetFaction());
SetLevel(owner.getLevel());
SetLevel(owner.GetLevel());
if (owner.IsTypeId(TypeId.Player))
m_ControlledByPlayer = true;
}
@@ -314,7 +313,7 @@ namespace Game.Entities
{
m_owner = owner;
Cypher.Assert(m_owner);
m_unitTypeMask |= UnitTypeMask.Minion;
UnitTypeMask |= UnitTypeMask.Minion;
m_followAngle = SharedConst.PetFollowAngle;
/// @todo: Find correct way
InitCharmInfo();
@@ -378,10 +377,10 @@ namespace Game.Entities
{
m_bonusSpellDamage = 0;
m_unitTypeMask |= UnitTypeMask.Guardian;
UnitTypeMask |= UnitTypeMask.Guardian;
if (properties != null && (properties.Title == SummonType.Pet || properties.Control == SummonCategory.Pet))
{
m_unitTypeMask |= UnitTypeMask.ControlableGuardian;
UnitTypeMask |= UnitTypeMask.ControlableGuardian;
InitCharmInfo();
}
}
@@ -390,7 +389,7 @@ namespace Game.Entities
{
base.InitStats(duration);
InitStatsForLevel(GetOwner().getLevel());
InitStatsForLevel(GetOwner().GetLevel());
if (GetOwner().IsTypeId(TypeId.Player) && HasUnitTypeMask(UnitTypeMask.ControlableGuardian))
GetCharmInfo().InitCharmCreateSpells();
@@ -430,7 +429,7 @@ namespace Game.Entities
else if (GetOwner().GetClass() == Class.Hunter)
{
petType = PetType.Hunter;
m_unitTypeMask |= UnitTypeMask.HunterPet;
UnitTypeMask |= UnitTypeMask.HunterPet;
}
else
{
@@ -453,12 +452,12 @@ namespace Game.Entities
if (cFamily != null && cFamily.MinScale > 0.0f && petType == PetType.Hunter)
{
float scale;
if (getLevel() >= cFamily.MaxScaleLevel)
if (GetLevel() >= cFamily.MaxScaleLevel)
scale = cFamily.MaxScale;
else if (getLevel() <= cFamily.MinScaleLevel)
else if (GetLevel() <= cFamily.MinScaleLevel)
scale = cFamily.MinScale;
else
scale = cFamily.MinScale + (float)(getLevel() - cFamily.MinScaleLevel) / cFamily.MaxScaleLevel * (cFamily.MaxScale - cFamily.MinScale);
scale = cFamily.MinScale + (float)(GetLevel() - cFamily.MinScaleLevel) / cFamily.MaxScaleLevel * (cFamily.MaxScale - cFamily.MinScale);
SetObjectScale(scale);
}
@@ -979,14 +978,14 @@ namespace Game.Entities
public Puppet(SummonPropertiesRecord properties, Unit owner) : base(properties, owner, false)
{
Cypher.Assert(owner.IsTypeId(TypeId.Player));
m_unitTypeMask |= UnitTypeMask.Puppet;
UnitTypeMask |= UnitTypeMask.Puppet;
}
public override void InitStats(uint duration)
{
base.InitStats(duration);
SetLevel(GetOwner().getLevel());
SetLevel(GetOwner().GetLevel());
SetReactState(ReactStates.Passive);
}
+3 -4
View File
@@ -20,7 +20,6 @@ using Game.DataStorage;
using Game.Groups;
using Game.Network.Packets;
using Game.Spells;
using System.Linq;
namespace Game.Entities
{
@@ -28,7 +27,7 @@ namespace Game.Entities
{
public Totem(SummonPropertiesRecord properties, Unit owner) : base(properties, owner, false)
{
m_unitTypeMask |= UnitTypeMask.Totem;
UnitTypeMask |= UnitTypeMask.Totem;
m_type = TotemType.Passive;
}
@@ -78,12 +77,12 @@ namespace Game.Entities
// Get spell cast by totem
SpellInfo totemSpell = Global.SpellMgr.GetSpellInfo(GetSpell());
if (totemSpell != null)
if (totemSpell.CalcCastTime(getLevel()) != 0) // If spell has cast time . its an active totem
if (totemSpell.CalcCastTime(GetLevel()) != 0) // If spell has cast time . its an active totem
m_type = TotemType.Active;
m_duration = duration;
SetLevel(GetOwner().getLevel());
SetLevel(GetOwner().GetLevel());
}
public override void InitSummon()
+1 -1
View File
@@ -519,7 +519,7 @@ namespace Game.Entities
Cell oldCell = new Cell(GetPositionX(), GetPositionY());
Relocate(x, y, z, o);
m_stationaryPosition.SetOrientation(o);
StationaryPosition.SetOrientation(o);
UpdateModelPosition();
UpdatePassengerPositions(_passengers);
+2 -2
View File
@@ -310,9 +310,9 @@ namespace Game.Entities
public void SaveStayPosition()
{
//! At this point a new spline destination is enabled because of Unit.StopMoving()
Vector3 stayPos = _unit.moveSpline.FinalDestination();
Vector3 stayPos = _unit.MoveSpline.FinalDestination();
if (_unit.moveSpline.onTransport)
if (_unit.MoveSpline.onTransport)
{
float o = 0;
ITransport transport = _unit.GetDirectTransport();
+49 -49
View File
@@ -95,7 +95,7 @@ namespace Game.Entities
}
}
var attackers = getAttackers();
var attackers = GetAttackers();
for (var i = 0; i < attackers.Count;)
{
var unit = attackers[i];
@@ -108,7 +108,7 @@ namespace Game.Entities
++i;
}
getHostileRefManager().deleteReferencesForFaction(factionId);
GetHostileRefManager().deleteReferencesForFaction(factionId);
foreach (var control in m_Controlled)
control.StopAttackFaction(factionId);
@@ -116,10 +116,10 @@ namespace Game.Entities
public void HandleProcExtraAttackFor(Unit victim)
{
while (m_extraAttacks != 0)
while (ExtraAttacks != 0)
{
AttackerStateUpdate(victim, WeaponAttackType.BaseAttack, true);
--m_extraAttacks;
--ExtraAttacks;
}
}
@@ -229,7 +229,7 @@ namespace Game.Entities
{
// iterate attackers
List<Unit> toRemove = new List<Unit>();
foreach (Unit attacker in getAttackers())
foreach (Unit attacker in GetAttackers())
if (!attacker.IsValidAttackTarget(this))
toRemove.Add(attacker);
@@ -267,7 +267,7 @@ namespace Game.Entities
}
public void ClearInCombat()
{
m_CombatTimer = 0;
combatTimer = 0;
RemoveUnitFlag(UnitFlags.InCombat);
// Player's state will be cleared in Player.UpdateContestedPvP
@@ -316,11 +316,11 @@ namespace Game.Entities
}
}
public void addHatedBy(HostileReference pHostileReference)
public void AddHatedBy(HostileReference pHostileReference)
{
m_HostileRefManager.InsertFirst(pHostileReference);
hostileRefManager.InsertFirst(pHostileReference);
}
public void removeHatedBy(HostileReference pHostileReference) { } //nothing to do yet
public void RemoveHatedBy(HostileReference pHostileReference) { } //nothing to do yet
public void AddThreat(Unit victim, float fThreat, SpellSchoolMask schoolMask = SpellSchoolMask.Normal, SpellInfo threatSpell = null)
{
@@ -338,7 +338,7 @@ namespace Game.Entities
return fThreat * m_threatModifier[(int)school];
}
public bool isTargetableForAttack(bool checkFakeDeath = true)
public bool IsTargetableForAttack(bool checkFakeDeath = true)
{
if (!IsAlive())
return false;
@@ -352,7 +352,7 @@ namespace Game.Entities
return !HasUnitState(UnitState.Unattackable) && (!checkFakeDeath || !HasUnitState(UnitState.Died));
}
public DeathState getDeathState()
public DeathState GetDeathState()
{
return m_deathState;
}
@@ -392,9 +392,9 @@ namespace Game.Entities
if (HasAuraType(AuraType.ModUnattackable))
RemoveAurasByType(AuraType.ModUnattackable);
if (m_attacking != null)
if (attacking != null)
{
if (m_attacking == victim)
if (attacking == victim)
{
// switch to melee attack from ranged/magic
if (meleeAttack)
@@ -421,11 +421,11 @@ namespace Game.Entities
ClearUnitState(UnitState.MeleeAttacking);
}
if (m_attacking != null)
m_attacking._removeAttacker(this);
if (attacking != null)
attacking._removeAttacker(this);
m_attacking = victim;
m_attacking._addAttacker(this);
attacking = victim;
attacking._addAttacker(this);
// Set our target
SetTarget(victim.GetGUID());
@@ -450,8 +450,8 @@ namespace Game.Entities
}
// delay offhand weapon attack to next attack time
if (haveOffhandWeapon() && GetTypeId() != TypeId.Player)
resetAttackTimer(WeaponAttackType.OffAttack);
if (HaveOffhandWeapon() && GetTypeId() != TypeId.Player)
ResetAttackTimer(WeaponAttackType.OffAttack);
if (meleeAttack)
SendMeleeAttackStart(victim);
@@ -488,13 +488,13 @@ namespace Game.Entities
public virtual void SetTarget(ObjectGuid guid) { }
public bool AttackStop()
{
if (m_attacking == null)
if (attacking == null)
return false;
Unit victim = m_attacking;
Unit victim = attacking;
m_attacking._removeAttacker(this);
m_attacking = null;
attacking._removeAttacker(this);
attacking = null;
// Clear our target
SetTarget(ObjectGuid.Empty);
@@ -529,9 +529,9 @@ namespace Game.Entities
}
public Unit GetVictim()
{
return m_attacking;
return attacking;
}
public Unit getAttackerForHelper()
public Unit GetAttackerForHelper()
{
if (GetVictim() != null)
return GetVictim();
@@ -541,7 +541,7 @@ namespace Game.Entities
return null;
}
public List<Unit> getAttackers()
public List<Unit> GetAttackers()
{
return attackerList;
}
@@ -551,26 +551,26 @@ namespace Game.Entities
public float GetBoundingRadius() { return m_unitData.BoundingRadius; }
public void SetBoundingRadius(float boundingRadius) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.BoundingRadius), boundingRadius); }
public bool haveOffhandWeapon()
public bool HaveOffhandWeapon()
{
if (IsTypeId(TypeId.Player))
return ToPlayer().GetWeaponForAttack(WeaponAttackType.OffAttack, true) != null;
else
return m_canDualWield;
}
public void resetAttackTimer(WeaponAttackType type = WeaponAttackType.BaseAttack)
public void ResetAttackTimer(WeaponAttackType type = WeaponAttackType.BaseAttack)
{
m_attackTimer[(int)type] = (uint)(GetBaseAttackTime(type) * m_modAttackSpeedPct[(int)type]);
}
public void setAttackTimer(WeaponAttackType type, uint time)
public void SetAttackTimer(WeaponAttackType type, uint time)
{
m_attackTimer[(int)type] = time;
}
public uint getAttackTimer(WeaponAttackType type)
public uint GetAttackTimer(WeaponAttackType type)
{
return m_attackTimer[(int)type];
}
public bool isAttackReady(WeaponAttackType type = WeaponAttackType.BaseAttack)
public bool IsAttackReady(WeaponAttackType type = WeaponAttackType.BaseAttack)
{
return m_attackTimer[(int)type] == 0;
}
@@ -803,19 +803,19 @@ namespace Game.Entities
(!IsTypeId(TypeId.Unit) || !ToCreature().GetCreatureTemplate().FlagsExtra.HasAnyFlag(CreatureFlagsExtra.NoParryHasten)))
{
// Get attack timers
float offtime = victim.getAttackTimer(WeaponAttackType.OffAttack);
float basetime = victim.getAttackTimer(WeaponAttackType.BaseAttack);
float offtime = victim.GetAttackTimer(WeaponAttackType.OffAttack);
float basetime = victim.GetAttackTimer(WeaponAttackType.BaseAttack);
// Reduce attack time
if (victim.haveOffhandWeapon() && offtime < basetime)
if (victim.HaveOffhandWeapon() && offtime < basetime)
{
float percent20 = victim.GetBaseAttackTime(WeaponAttackType.OffAttack) * 0.20f;
float percent60 = 3.0f * percent20;
if (offtime > percent20 && offtime <= percent60)
victim.setAttackTimer(WeaponAttackType.OffAttack, (uint)percent20);
victim.SetAttackTimer(WeaponAttackType.OffAttack, (uint)percent20);
else if (offtime > percent60)
{
offtime -= 2.0f * percent20;
victim.setAttackTimer(WeaponAttackType.OffAttack, (uint)offtime);
victim.SetAttackTimer(WeaponAttackType.OffAttack, (uint)offtime);
}
}
else
@@ -823,11 +823,11 @@ namespace Game.Entities
float percent20 = victim.GetBaseAttackTime(WeaponAttackType.BaseAttack) * 0.20f;
float percent60 = 3.0f * percent20;
if (basetime > percent20 && basetime <= percent60)
victim.setAttackTimer(WeaponAttackType.BaseAttack, (uint)percent20);
victim.SetAttackTimer(WeaponAttackType.BaseAttack, (uint)percent20);
else if (basetime > percent60)
{
basetime -= 2.0f * percent20;
victim.setAttackTimer(WeaponAttackType.BaseAttack, (uint)basetime);
victim.SetAttackTimer(WeaponAttackType.BaseAttack, (uint)basetime);
}
}
}
@@ -839,14 +839,14 @@ namespace Game.Entities
// If this is a creature and it attacks from behind it has a probability to daze it's victim
if ((damageInfo.hitOutCome == MeleeHitOutcome.Crit || damageInfo.hitOutCome == MeleeHitOutcome.Crushing || damageInfo.hitOutCome == MeleeHitOutcome.Normal || damageInfo.hitOutCome == MeleeHitOutcome.Glancing) &&
!IsTypeId(TypeId.Player) && !ToCreature().IsControlledByPlayer() && !victim.HasInArc(MathFunctions.PI, this)
&& (victim.IsTypeId(TypeId.Player) || !victim.ToCreature().isWorldBoss()) && !victim.IsVehicle())
&& (victim.IsTypeId(TypeId.Player) || !victim.ToCreature().IsWorldBoss()) && !victim.IsVehicle())
{
// -probability is between 0% and 40%
// 20% base chance
float Probability = 20.0f;
// there is a newbie protection, at level 10 just 7% base chance; assuming linear function
if (victim.getLevel() < 30)
if (victim.GetLevel() < 30)
Probability = 0.65f * victim.GetLevelForTarget(this) + 0.5f;
uint VictimDefense = victim.GetMaxSkillValueForLevel(this);
@@ -1076,7 +1076,7 @@ namespace Game.Entities
}
else if (!victim.IsControlledByPlayer() || victim.IsVehicle())
{
if (!victim.ToCreature().hasLootRecipient())
if (!victim.ToCreature().HasLootRecipient())
victim.ToCreature().SetLootRecipient(this);
if (IsControlledByPlayer())
@@ -1352,7 +1352,7 @@ namespace Game.Entities
if (PvP)
{
m_CombatTimer = 5000;
combatTimer = 5000;
Player me = ToPlayer();
if (me)
me.EnablePvpRules(true);
@@ -1519,7 +1519,7 @@ namespace Game.Entities
player.UpdateCriteria(CriteriaTypes.GetKillingBlows, 1, 0, 0, victim);
Log.outDebug(LogFilter.Unit, "SET JUST_DIED");
victim.setDeathState(DeathState.JustDied);
victim.SetDeathState(DeathState.JustDied);
// Inform pets (if any) when player kills target)
// MUST come after victim.setDeathState(JUST_DIED); or pet next target
@@ -1527,7 +1527,7 @@ namespace Game.Entities
if (player != null)
{
Pet pet = player.GetPet();
if (pet != null && pet.IsAlive() && pet.isControlled())
if (pet != null && pet.IsAlive() && pet.IsControlled())
pet.GetAI().KilledUnit(victim);
}
@@ -1975,7 +1975,7 @@ namespace Game.Entities
damageInfo.HitInfo |= HitInfo.Block;
damageInfo.originalDamage = damageInfo.damage;
// 30% damage blocked, double blocked amount if block is critical
damageInfo.blocked_amount = MathFunctions.CalculatePct(damageInfo.damage, damageInfo.target.isBlockCritical() ? damageInfo.target.GetBlockPercent() * 2 : damageInfo.target.GetBlockPercent());
damageInfo.blocked_amount = MathFunctions.CalculatePct(damageInfo.damage, damageInfo.target.IsBlockCritical() ? damageInfo.target.GetBlockPercent() * 2 : damageInfo.target.GetBlockPercent());
damageInfo.damage -= damageInfo.blocked_amount;
damageInfo.cleanDamage += damageInfo.blocked_amount;
break;
@@ -1983,7 +1983,7 @@ namespace Game.Entities
damageInfo.HitInfo |= HitInfo.Glancing;
damageInfo.TargetState = VictimState.Hit;
damageInfo.originalDamage = damageInfo.damage;
int leveldif = (int)victim.getLevel() - (int)getLevel();
int leveldif = (int)victim.GetLevel() - (int)GetLevel();
if (leveldif > 3)
leveldif = 3;
@@ -2207,7 +2207,7 @@ namespace Game.Entities
}
public float GetWeaponDamageRange(WeaponAttackType attType, WeaponDamageRange type)
{
if (attType == WeaponAttackType.OffAttack && !haveOffhandWeapon())
if (attType == WeaponAttackType.OffAttack && !HaveOffhandWeapon())
return 0.0f;
return m_weaponDamage[(int)attType][(int)type];
@@ -2972,7 +2972,7 @@ namespace Game.Entities
return (uint)Math.Max(tmpDamage, 0.0f);
}
bool isBlockCritical()
bool IsBlockCritical()
{
if (RandomHelper.randChance(GetTotalAuraModifier(AuraType.ModBlockCritChance)))
return true;
@@ -3056,7 +3056,7 @@ namespace Game.Entities
// visibility checks
// skip visibility check for GO casts, needs removal when go cast is implemented. Also ignore for gameobject and dynauras
if (GetEntry() != SharedConst.WorldTrigger && (!obj || !obj.isTypeMask(TypeMask.GameObject | TypeMask.DynamicObject)))
if (GetEntry() != SharedConst.WorldTrigger && (!obj || !obj.IsTypeMask(TypeMask.GameObject | TypeMask.DynamicObject)))
{
// can't attack invisible
if (bySpell == null || !bySpell.HasAttribute(SpellAttr6.CanTargetInvisible))
+14 -14
View File
@@ -41,7 +41,7 @@ namespace Game.Entities
//Movement
protected float[] m_speed_rate = new float[(int)UnitMoveType.Max];
RefManager<Unit, TargetedMovementGeneratorBase> m_FollowingRefManager;
public MoveSpline moveSpline { get; set; }
public MoveSpline MoveSpline { get; set; }
MotionMaster i_motionMaster;
public uint m_movementCounter; //< Incrementing counter used in movement packets
TimeTrackerSmall movesplineTimer;
@@ -59,18 +59,18 @@ namespace Game.Entities
protected uint[] m_attackTimer = new uint[(int)WeaponAttackType.Max];
ThreatManager threatManager;
HostileRefManager m_HostileRefManager;
HostileRefManager hostileRefManager;
RedirectThreatInfo _redirectThreatInfo;
protected Unit m_attacking;
protected Unit attacking;
public float m_modMeleeHitChance { get; set; }
public float m_modRangedHitChance { get; set; }
public float m_modSpellHitChance { get; set; }
public float ModMeleeHitChance { get; set; }
public float ModRangedHitChance { get; set; }
public float ModSpellHitChance { get; set; }
bool m_canDualWield;
public int m_baseSpellCritChance { get; set; }
public uint m_regenTimer { get; set; }
uint m_CombatTimer;
public uint m_extraAttacks { get; set; }
public int BaseSpellCritChance { get; set; }
public uint RegenTimer { get; set; }
uint combatTimer;
public uint ExtraAttacks { get; set; }
//Charm
public List<Unit> m_Controlled = new List<Unit>();
@@ -119,14 +119,14 @@ namespace Game.Entities
public ObjectGuid[] m_SummonSlot = new ObjectGuid[7];
public ObjectGuid[] m_ObjectSlot = new ObjectGuid[4];
public EventSystem m_Events = new EventSystem();
public UnitTypeMask m_unitTypeMask { get; set; }
public UnitTypeMask UnitTypeMask { get; set; }
UnitState m_state;
protected LiquidTypeRecord _lastLiquid;
protected DeathState m_deathState;
public Vehicle m_vehicle { get; set; }
public Vehicle m_vehicleKit { get; set; }
public Vehicle VehicleKit { get; set; }
bool canModifyStats;
public uint m_lastSanctuaryTime { get; set; }
public uint LastSanctuaryTime { get; set; }
uint m_transform;
bool m_cleanupDone; // lock made to not add stuff after cleanup before delete
bool m_duringRemoveFromWorld; // lock made to not add stuff after begining removing from world
@@ -449,7 +449,7 @@ namespace Game.Entities
public class SpellNonMeleeDamage
{
public SpellNonMeleeDamage(Unit _attacker, Unit _target, uint _SpellID, uint _SpellXSpellVisualID, SpellSchoolMask _schoolMask, ObjectGuid _castId = default(ObjectGuid))
public SpellNonMeleeDamage(Unit _attacker, Unit _target, uint _SpellID, uint _SpellXSpellVisualID, SpellSchoolMask _schoolMask, ObjectGuid _castId = default)
{
target = _target;
attacker = _attacker;
+25 -28
View File
@@ -39,17 +39,14 @@ namespace Game.Entities
return m_movementInfo.HasMovementFlag(MovementFlag.Walking);
}
bool IsHovering() { return m_movementInfo.HasMovementFlag(MovementFlag.Hover); }
public bool isStopped()
{
return !(HasUnitState(UnitState.Moving));
}
public bool isMoving() { return m_movementInfo.HasMovementFlag(MovementFlag.MaskMoving); }
public bool isTurning() { return m_movementInfo.HasMovementFlag(MovementFlag.MaskTurning); }
public bool IsStopped() { return !HasUnitState(UnitState.Moving); }
public bool IsMoving() { return m_movementInfo.HasMovementFlag(MovementFlag.MaskMoving); }
public bool IsTurning() { return m_movementInfo.HasMovementFlag(MovementFlag.MaskTurning); }
public virtual bool CanFly() { return false; }
public bool IsFlying() { return m_movementInfo.HasMovementFlag(MovementFlag.Flying | MovementFlag.DisableGravity); }
public bool IsFalling()
{
return m_movementInfo.HasMovementFlag(MovementFlag.Falling | MovementFlag.FallingFar) || moveSpline.isFalling();
return m_movementInfo.HasMovementFlag(MovementFlag.Falling | MovementFlag.FallingFar) || MoveSpline.isFalling();
}
public virtual bool CanSwim()
{
@@ -71,7 +68,7 @@ namespace Game.Entities
return GetMap().IsUnderWater(GetPhaseShift(), GetPositionX(), GetPositionY(), GetPositionZ());
}
void propagateSpeedChange() { GetMotionMaster().propagateSpeedChange(); }
void PropagateSpeedChange() { GetMotionMaster().propagateSpeedChange(); }
public float GetSpeed(UnitMoveType mtype)
{
@@ -92,7 +89,7 @@ namespace Game.Entities
m_speed_rate[(int)mtype] = rate;
propagateSpeedChange();
PropagateSpeedChange();
// Spline packets are for creatures and move_update are for players
ServerOpcodes[,] moveTypeToOpcode = new ServerOpcodes[(int)UnitMoveType.Max, 3]
@@ -154,7 +151,7 @@ namespace Game.Entities
ClearUnitState(UnitState.Moving);
// not need send any packets if not in world or not moving
if (!IsInWorld || moveSpline.Finalized())
if (!IsInWorld || MoveSpline.Finalized())
return;
MoveSplineInit init = new MoveSplineInit(this);
@@ -608,7 +605,7 @@ namespace Game.Entities
if (combat_reach < 0.1f)
combat_reach = SharedConst.DefaultCombatReach;
int attacker_number = getAttackers().Count;
int attacker_number = GetAttackers().Count;
if (attacker_number > 0)
--attacker_number;
GetNearPoint(obj, out x, out y, out z, obj.GetCombatReach(), distance2dMin + (distance2dMax - distance2dMin) * (float)RandomHelper.NextDouble()
@@ -1014,16 +1011,16 @@ namespace Game.Entities
return distsq < maxdist * maxdist;
}
public bool isInFrontInMap(Unit target, float distance, float arc = MathFunctions.PI)
public bool IsInFrontInMap(Unit target, float distance, float arc = MathFunctions.PI)
{
return IsWithinDistInMap(target, distance) && HasInArc(arc, target);
}
public bool isInBackInMap(Unit target, float distance, float arc = MathFunctions.PI)
public bool IsInBackInMap(Unit target, float distance, float arc = MathFunctions.PI)
{
return IsWithinDistInMap(target, distance) && !HasInArc(MathFunctions.TwoPi - arc, target);
}
public bool isInAccessiblePlaceFor(Creature c)
public bool IsInAccessiblePlaceFor(Creature c)
{
if (IsInWater())
return c.CanSwim();
@@ -1220,7 +1217,7 @@ namespace Game.Entities
if (!fearAuras.Empty())
caster = Global.ObjAccessor.GetUnit(this, fearAuras[0].GetCasterGUID());
if (caster == null)
caster = getAttackerForHelper();
caster = GetAttackerForHelper();
GetMotionMaster().MoveFleeing(caster, (uint)(fearAuras.Empty() ? WorldConfig.GetIntValue(WorldCfg.CreatureFamilyFleeDelay) : 0)); // caster == NULL processed in MoveFleeing
}
else
@@ -1370,9 +1367,9 @@ namespace Game.Entities
if (vehInfo == null)
return false;
m_vehicleKit = new Vehicle(this, vehInfo, creatureEntry);
VehicleKit = new Vehicle(this, vehInfo, creatureEntry);
m_updateFlag.Vehicle = true;
m_unitTypeMask |= UnitTypeMask.Vehicle;
UnitTypeMask |= UnitTypeMask.Vehicle;
if (!loading)
SendSetVehicleRecId(id);
@@ -1382,18 +1379,18 @@ namespace Game.Entities
public void RemoveVehicleKit(bool onRemoveFromWorld = false)
{
if (m_vehicleKit == null)
if (VehicleKit == null)
return;
if (!onRemoveFromWorld)
SendSetVehicleRecId(0);
m_vehicleKit.Uninstall();
VehicleKit.Uninstall();
m_vehicleKit = null;
VehicleKit = null;
m_updateFlag.Vehicle = false;
m_unitTypeMask &= ~UnitTypeMask.Vehicle;
UnitTypeMask &= ~UnitTypeMask.Vehicle;
RemoveNpcFlag(NPCFlags.SpellClick | NPCFlags.PlayerVehicle);
}
@@ -1630,17 +1627,17 @@ namespace Game.Entities
//Spline
public bool IsSplineEnabled()
{
return moveSpline.Initialized() && !moveSpline.Finalized();
return MoveSpline.Initialized() && !MoveSpline.Finalized();
}
void UpdateSplineMovement(uint diff)
{
int positionUpdateDelay = 400;
if (moveSpline.Finalized())
if (MoveSpline.Finalized())
return;
moveSpline.updateState((int)diff);
bool arrived = moveSpline.Finalized();
MoveSpline.updateState((int)diff);
bool arrived = MoveSpline.Finalized();
if (arrived)
DisableSpline();
@@ -1649,13 +1646,13 @@ namespace Game.Entities
if (movesplineTimer.Passed() || arrived)
{
movesplineTimer.Reset(positionUpdateDelay);
Vector4 loc = moveSpline.ComputePosition();
Vector4 loc = MoveSpline.ComputePosition();
float x = loc.X;
float y = loc.Y;
float z = loc.Z;
float o = loc.W;
if (moveSpline.onTransport)
if (MoveSpline.onTransport)
{
m_movementInfo.transport.pos.Relocate(x, y, z, o);
@@ -1672,7 +1669,7 @@ namespace Game.Entities
public void DisableSpline()
{
m_movementInfo.RemoveMovementFlag(MovementFlag.Forward);
moveSpline.Interrupt();
MoveSpline.Interrupt();
}
//Transport
+5 -5
View File
@@ -88,7 +88,7 @@ namespace Game.Entities
if (IsCharmed())
{
i_disabledAI = i_AI;
if (isPossessed() || IsVehicle())
if (IsPossessed() || IsVehicle())
i_AI = new PossessedAI(ToCreature());
else
i_AI = new PetAI(ToCreature());
@@ -381,7 +381,7 @@ namespace Game.Entities
Player player = ToPlayer();
if (player)
{
if (player.isAFK())
if (player.IsAFK())
player.ToggleAFK();
if (charmer.IsTypeId(TypeId.Unit)) // we are charmed by a creature
@@ -477,7 +477,7 @@ namespace Game.Entities
CastStop();
CombatStop(); // @todo CombatStop(true) may cause crash (interrupt spells)
getHostileRefManager().deleteReferences();
GetHostileRefManager().deleteReferences();
DeleteThreatList();
if (_oldFactionId != 0)
@@ -760,7 +760,7 @@ namespace Game.Entities
if (!pet.CreateBaseAtCreature(creatureTarget))
return null;
uint level = creatureTarget.GetLevelForTarget(this) + 5 < getLevel() ? (getLevel() - 5) : creatureTarget.GetLevelForTarget(this);
uint level = creatureTarget.GetLevelForTarget(this) + 5 < GetLevel() ? (GetLevel() - 5) : creatureTarget.GetLevelForTarget(this);
InitTamedPet(pet, level, spell_id);
@@ -778,7 +778,7 @@ namespace Game.Entities
Pet pet = new Pet(ToPlayer(), PetType.Hunter);
if (!pet.CreateBaseAtCreatureInfo(creatureInfo, this) || !InitTamedPet(pet, getLevel(), spell_id))
if (!pet.CreateBaseAtCreatureInfo(creatureInfo, this) || !InitTamedPet(pet, GetLevel(), spell_id))
return null;
return pet;
+46 -48
View File
@@ -648,7 +648,7 @@ namespace Game.Entities
else if (IsTypeId(TypeId.Player))
crit_chance = ToPlayer().m_activePlayerData.SpellCritPercentage;
else
crit_chance = m_baseSpellCritChance;
crit_chance = BaseSpellCritChance;
// taken
if (victim)
@@ -703,7 +703,7 @@ namespace Game.Entities
// Spell crit suppression
if (victim.GetTypeId() == TypeId.Unit)
{
int levelDiff = (int)(victim.GetLevelForTarget(this) - getLevel());
int levelDiff = (int)(victim.GetLevelForTarget(this) - GetLevel());
crit_chance -= levelDiff * 1.0f;
}
}
@@ -1019,7 +1019,7 @@ namespace Game.Entities
return SpellMissInfo.None;
}
public void CastSpell(SpellCastTargets targets, SpellInfo spellInfo, Dictionary<SpellValueMod, int> values, TriggerCastFlags triggerFlags = TriggerCastFlags.None, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default(ObjectGuid))
public void CastSpell(SpellCastTargets targets, SpellInfo spellInfo, Dictionary<SpellValueMod, int> values, TriggerCastFlags triggerFlags = TriggerCastFlags.None, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default)
{
if (spellInfo == null)
{
@@ -1036,11 +1036,11 @@ namespace Game.Entities
spell.m_CastItem = castItem;
spell.prepare(targets, triggeredByAura);
}
public void CastSpell(Unit victim, uint spellId, bool triggered, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default(ObjectGuid))
public void CastSpell(Unit victim, uint spellId, bool triggered, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default)
{
CastSpell(victim, spellId, triggered ? TriggerCastFlags.FullMask : TriggerCastFlags.None, castItem, triggeredByAura, originalCaster);
}
public void CastSpell(Unit victim, uint spellId, TriggerCastFlags triggerFlags = TriggerCastFlags.None, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default(ObjectGuid))
public void CastSpell(Unit victim, uint spellId, TriggerCastFlags triggerFlags = TriggerCastFlags.None, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default)
{
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId);
if (spellInfo == null)
@@ -1051,17 +1051,17 @@ namespace Game.Entities
CastSpell(victim, spellInfo, triggerFlags, castItem, triggeredByAura, originalCaster);
}
public void CastSpell(Unit victim, SpellInfo spellInfo, bool triggered, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default(ObjectGuid))
public void CastSpell(Unit victim, SpellInfo spellInfo, bool triggered, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default)
{
CastSpell(victim, spellInfo, triggered ? TriggerCastFlags.FullMask : TriggerCastFlags.None, castItem, triggeredByAura, originalCaster);
}
public void CastSpell(Unit victim, SpellInfo spellInfo, TriggerCastFlags triggerFlags = TriggerCastFlags.None, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default(ObjectGuid))
public void CastSpell(Unit victim, SpellInfo spellInfo, TriggerCastFlags triggerFlags = TriggerCastFlags.None, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default)
{
SpellCastTargets targets = new SpellCastTargets();
targets.SetUnitTarget(victim);
CastSpell(targets, spellInfo, null, triggerFlags, castItem, triggeredByAura, originalCaster);
}
public void CastSpell(float x, float y, float z, uint spellId, bool triggered, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default(ObjectGuid))
public void CastSpell(float x, float y, float z, uint spellId, bool triggered, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default)
{
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId);
if (spellInfo == null)
@@ -1074,7 +1074,7 @@ namespace Game.Entities
CastSpell(targets, spellInfo, null, triggered ? TriggerCastFlags.FullMask : TriggerCastFlags.None, castItem, triggeredByAura, originalCaster);
}
public void CastSpell(GameObject go, uint spellId, bool triggered, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default(ObjectGuid))
public void CastSpell(GameObject go, uint spellId, bool triggered, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default)
{
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId);
if (spellInfo == null)
@@ -1088,7 +1088,7 @@ namespace Game.Entities
CastSpell(targets, spellInfo, null, triggered ? TriggerCastFlags.FullMask : TriggerCastFlags.None, castItem, triggeredByAura, originalCaster);
}
public void CastCustomSpell(Unit target, uint spellId, int bp0, int bp1, int bp2, bool triggered, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default(ObjectGuid))
public void CastCustomSpell(Unit target, uint spellId, int bp0, int bp1, int bp2, bool triggered, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default)
{
Dictionary<SpellValueMod, int> values = new Dictionary<SpellValueMod, int>();
if (bp0 != 0)
@@ -1099,19 +1099,19 @@ namespace Game.Entities
values.Add(SpellValueMod.BasePoint2, bp2);
CastCustomSpell(spellId, values, target, triggered ? TriggerCastFlags.FullMask : TriggerCastFlags.None, castItem, triggeredByAura, originalCaster);
}
public void CastCustomSpell(uint spellId, SpellValueMod mod, int value, Unit target, bool triggered, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default(ObjectGuid))
public void CastCustomSpell(uint spellId, SpellValueMod mod, int value, Unit target, bool triggered, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default)
{
Dictionary<SpellValueMod, int> values = new Dictionary<SpellValueMod, int>();
values.Add(mod, value);
CastCustomSpell(spellId, values, target, triggered ? TriggerCastFlags.FullMask : TriggerCastFlags.None, castItem, triggeredByAura, originalCaster);
}
public void CastCustomSpell(uint spellId, SpellValueMod mod, int value, Unit target = null, TriggerCastFlags triggerFlags = TriggerCastFlags.None, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default(ObjectGuid))
public void CastCustomSpell(uint spellId, SpellValueMod mod, int value, Unit target = null, TriggerCastFlags triggerFlags = TriggerCastFlags.None, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default)
{
Dictionary<SpellValueMod, int> values = new Dictionary<SpellValueMod, int>();
values.Add(mod, value);
CastCustomSpell(spellId, values, target, triggerFlags, castItem, triggeredByAura, originalCaster);
}
public void CastCustomSpell(uint spellId, Dictionary<SpellValueMod, int> values, Unit victim = null, TriggerCastFlags triggerFlags = TriggerCastFlags.None, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default(ObjectGuid))
public void CastCustomSpell(uint spellId, Dictionary<SpellValueMod, int> values, Unit victim = null, TriggerCastFlags triggerFlags = TriggerCastFlags.None, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default)
{
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId);
if (spellInfo == null)
@@ -1273,7 +1273,7 @@ namespace Game.Entities
public SpellHistory GetSpellHistory() { return _spellHistory; }
public static ProcFlagsHit createProcHitMask(SpellNonMeleeDamage damageInfo, SpellMissInfo missCondition)
public static ProcFlagsHit CreateProcHitMask(SpellNonMeleeDamage damageInfo, SpellMissInfo missCondition)
{
ProcFlagsHit hitMask = ProcFlagsHit.None;
// Check victim state
@@ -1501,7 +1501,7 @@ namespace Game.Entities
int overEnergize = damage - gain;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId);
victim.getHostileRefManager().threatAssist(this, damage * 0.5f, spellInfo);
victim.GetHostileRefManager().threatAssist(this, damage * 0.5f, spellInfo);
SendEnergizeSpellLog(victim, spellId, damage, overEnergize, powerType);
}
@@ -1997,7 +1997,7 @@ namespace Game.Entities
public ushort GetMaxSkillValueForLevel(Unit target = null)
{
return (ushort)(target != null ? GetLevelForTarget(target) : getLevel() * 5);
return (ushort)(target != null ? GetLevelForTarget(target) : GetLevel() * 5);
}
public Player GetSpellModOwner()
{
@@ -2044,7 +2044,7 @@ namespace Game.Entities
InterruptSpell(CurrentSpellTypes.AutoRepeat);
m_AutoRepeatFirstCast = true;
}
if (pSpell.m_spellInfo.CalcCastTime(getLevel()) > 0)
if (pSpell.m_spellInfo.CalcCastTime(GetLevel()) > 0)
AddUnitState(UnitState.Casting);
break;
@@ -2163,7 +2163,7 @@ namespace Game.Entities
return (uint)crit_bonus;
}
bool isSpellBlocked(Unit victim, SpellInfo spellProto, WeaponAttackType attackType = WeaponAttackType.BaseAttack)
bool IsSpellBlocked(Unit victim, SpellInfo spellProto, WeaponAttackType attackType = WeaponAttackType.BaseAttack)
{
// These spells can't be blocked
if (spellProto != null && (spellProto.HasAttribute(SpellAttr0.ImpossibleDodgeParryBlock) || spellProto.HasAttribute(SpellAttr3.IgnoreHitResult)))
@@ -2190,15 +2190,13 @@ namespace Game.Entities
}
}
public uint getTransForm() { return m_transform; }
public bool HasStealthAura() { return HasAuraType(AuraType.ModStealth); }
public bool HasInvisibilityAura() { return HasAuraType(AuraType.ModInvisibility); }
public bool isFeared() { return HasAuraType(AuraType.ModFear); }
public bool isFrozen() { return HasAuraState(AuraStateType.Frozen); }
public bool IsFeared() { return HasAuraType(AuraType.ModFear); }
public bool IsFrozen() { return HasAuraState(AuraStateType.Frozen); }
public bool IsPolymorphed()
{
uint transformId = getTransForm();
uint transformId = GetTransForm();
if (transformId == 0)
return false;
@@ -2359,7 +2357,7 @@ namespace Game.Entities
if (!spellInfo.HasAttribute(SpellAttr3.BlockableSpell))
{
// Get blocked status
blocked = isSpellBlocked(victim, spellInfo, attackType);
blocked = IsSpellBlocked(victim, spellInfo, attackType);
}
}
@@ -2387,7 +2385,7 @@ namespace Game.Entities
{
// double blocked amount if block is critical
uint value = victim.GetBlockPercent();
if (victim.isBlockCritical())
if (victim.IsBlockCritical())
value *= 2; // double blocked percent
damageInfo.blocked = (uint)MathFunctions.CalculatePct(damage, value);
if (damage <= damageInfo.blocked)
@@ -3008,13 +3006,13 @@ namespace Game.Entities
return result;
}
public bool HasAura(uint spellId, ObjectGuid casterGUID = default(ObjectGuid), ObjectGuid itemCasterGUID = default(ObjectGuid), uint reqEffMask = 0)
public bool HasAura(uint spellId, ObjectGuid casterGUID = default, ObjectGuid itemCasterGUID = default, uint reqEffMask = 0)
{
if (GetAuraApplication(spellId, casterGUID, itemCasterGUID, reqEffMask) != null)
return true;
return false;
}
public bool HasAuraEffect(uint spellId, uint effIndex, ObjectGuid casterGUID = default(ObjectGuid))
public bool HasAuraEffect(uint spellId, uint effIndex, ObjectGuid casterGUID = default)
{
var range = m_appliedAuras.LookupByKey(spellId);
if (!range.Empty())
@@ -3103,17 +3101,17 @@ namespace Game.Entities
return false;
}
public bool HasNegativeAuraWithInterruptFlag(SpellAuraInterruptFlags flag, ObjectGuid guid = default(ObjectGuid))
public bool HasNegativeAuraWithInterruptFlag(SpellAuraInterruptFlags flag, ObjectGuid guid = default)
{
return HasNegativeAuraWithInterruptFlag((uint)flag, 0, guid);
}
public bool HasNegativeAuraWithInterruptFlag(SpellAuraInterruptFlags2 flag, ObjectGuid guid = default(ObjectGuid))
public bool HasNegativeAuraWithInterruptFlag(SpellAuraInterruptFlags2 flag, ObjectGuid guid = default)
{
return HasNegativeAuraWithInterruptFlag((uint)flag, 1, guid);
}
public bool HasNegativeAuraWithInterruptFlag(uint flag, int index, ObjectGuid guid = default(ObjectGuid))
public bool HasNegativeAuraWithInterruptFlag(uint flag, int index, ObjectGuid guid = default)
{
if (!Convert.ToBoolean(m_interruptMask[index] & flag))
return false;
@@ -3126,7 +3124,7 @@ namespace Game.Entities
}
return false;
}
bool HasNegativeAuraWithAttribute(SpellAttr0 flag, ObjectGuid guid = default(ObjectGuid))
bool HasNegativeAuraWithAttribute(SpellAttr0 flag, ObjectGuid guid = default)
{
foreach (var list in GetAppliedAuras())
{
@@ -3151,12 +3149,12 @@ namespace Game.Entities
return count;
}
public Aura GetAuraOfRankedSpell(uint spellId, ObjectGuid casterGUID = default(ObjectGuid), ObjectGuid itemCasterGUID = default(ObjectGuid), uint reqEffMask = 0)
public Aura GetAuraOfRankedSpell(uint spellId, ObjectGuid casterGUID = default, ObjectGuid itemCasterGUID = default, uint reqEffMask = 0)
{
var aurApp = GetAuraApplicationOfRankedSpell(spellId, casterGUID, itemCasterGUID, reqEffMask);
return aurApp?.GetBase();
}
AuraApplication GetAuraApplicationOfRankedSpell(uint spellId, ObjectGuid casterGUID = default(ObjectGuid), ObjectGuid itemCasterGUID = default(ObjectGuid), uint reqEffMask = 0, AuraApplication except = null)
AuraApplication GetAuraApplicationOfRankedSpell(uint spellId, ObjectGuid casterGUID = default, ObjectGuid itemCasterGUID = default, uint reqEffMask = 0, AuraApplication except = null)
{
uint rankSpell = Global.SpellMgr.GetFirstSpellInChain(spellId);
while (rankSpell != 0)
@@ -3358,7 +3356,7 @@ namespace Game.Entities
}
}
}
public void RemoveAurasByType(AuraType auraType, ObjectGuid casterGUID = default(ObjectGuid), Aura except = null, bool negative = true, bool positive = true)
public void RemoveAurasByType(AuraType auraType, ObjectGuid casterGUID = default, Aura except = null, bool negative = true, bool positive = true)
{
var list = m_modAuras[auraType];
for (var i = 0; i < list.Count; i++)
@@ -3427,7 +3425,7 @@ namespace Game.Entities
aura._Remove(removeMode);
}
public void RemoveOwnedAura(uint spellId, ObjectGuid casterGUID = default(ObjectGuid), uint reqEffMask = 0, AuraRemoveMode removeMode = AuraRemoveMode.Default)
public void RemoveOwnedAura(uint spellId, ObjectGuid casterGUID = default, uint reqEffMask = 0, AuraRemoveMode removeMode = AuraRemoveMode.Default)
{
foreach (var pair in GetOwnedAuras())
{
@@ -3467,7 +3465,7 @@ namespace Game.Entities
Cypher.Assert(false);
}
public void RemoveAurasDueToSpell(uint spellId, ObjectGuid casterGUID = default(ObjectGuid), uint reqEffMask = 0, AuraRemoveMode removeMode = AuraRemoveMode.Default)
public void RemoveAurasDueToSpell(uint spellId, ObjectGuid casterGUID = default, uint reqEffMask = 0, AuraRemoveMode removeMode = AuraRemoveMode.Default)
{
foreach (var pair in GetAppliedAuras())
{
@@ -3507,7 +3505,7 @@ namespace Game.Entities
}
}
}
public void RemoveAuraFromStack(uint spellId, ObjectGuid casterGUID = default(ObjectGuid), AuraRemoveMode removeMode = AuraRemoveMode.Default, ushort num = 1)
public void RemoveAuraFromStack(uint spellId, ObjectGuid casterGUID = default, AuraRemoveMode removeMode = AuraRemoveMode.Default, ushort num = 1)
{
var range = m_ownedAuras.LookupByKey(spellId);
foreach (var aura in range)
@@ -3531,7 +3529,7 @@ namespace Game.Entities
if (aura.GetOwner() == this)
aura.Remove(mode);
}
public void RemoveAura(uint spellId, ObjectGuid caster = default(ObjectGuid), uint reqEffMask = 0, AuraRemoveMode removeMode = AuraRemoveMode.Default)
public void RemoveAura(uint spellId, ObjectGuid caster = default, uint reqEffMask = 0, AuraRemoveMode removeMode = AuraRemoveMode.Default)
{
var range = m_appliedAuras.LookupByKey(spellId);
foreach (var iter in range)
@@ -3685,7 +3683,7 @@ namespace Game.Entities
foreach (var pair in GetOwnedAuras())
{
var appMap = pair.Value.GetApplicationMap();
foreach (var aurApp in appMap.Values)
foreach (var aurApp in appMap.Values.ToList())
{
Unit target = aurApp.GetTarget();
if (target == this)
@@ -3951,7 +3949,7 @@ namespace Game.Entities
if (aurApp.GetRemoveMode() == AuraRemoveMode.Expire && IsTypeId(TypeId.Unit) && IsTotem())
{
if (ToTotem().GetSpell() == aura.GetId() && ToTotem().GetTotemType() == TotemType.Passive)
ToTotem().setDeathState(DeathState.JustDied);
ToTotem().SetDeathState(DeathState.JustDied);
}
// Remove aurastates only if were not found
@@ -3980,7 +3978,7 @@ namespace Game.Entities
Cypher.Assert(false);
}
public AuraEffect GetAuraEffect(uint spellId, uint effIndex, ObjectGuid casterGUID = default(ObjectGuid))
public AuraEffect GetAuraEffect(uint spellId, uint effIndex, ObjectGuid casterGUID = default)
{
var range = m_appliedAuras.LookupByKey(spellId);
if (!range.Empty())
@@ -3996,7 +3994,7 @@ namespace Game.Entities
}
return null;
}
public AuraEffect GetAuraEffectOfRankedSpell(uint spellId, uint effIndex, ObjectGuid casterGUID = default(ObjectGuid))
public AuraEffect GetAuraEffectOfRankedSpell(uint spellId, uint effIndex, ObjectGuid casterGUID = default)
{
uint rankSpell = Global.SpellMgr.GetFirstSpellInChain(spellId);
while (rankSpell != 0)
@@ -4010,7 +4008,7 @@ namespace Game.Entities
}
// spell mustn't have familyflags
public AuraEffect GetAuraEffect(AuraType type, SpellFamilyNames family, FlagArray128 familyFlag, ObjectGuid casterGUID = default(ObjectGuid))
public AuraEffect GetAuraEffect(AuraType type, SpellFamilyNames family, FlagArray128 familyFlag, ObjectGuid casterGUID = default)
{
var auras = GetAuraEffectsByType(type);
foreach (var aura in auras)
@@ -4027,7 +4025,7 @@ namespace Game.Entities
}
public AuraApplication GetAuraApplication(uint spellId, ObjectGuid casterGUID = default(ObjectGuid), ObjectGuid itemCasterGUID = default(ObjectGuid), uint reqEffMask = 0, AuraApplication except = null)
public AuraApplication GetAuraApplication(uint spellId, ObjectGuid casterGUID = default, ObjectGuid itemCasterGUID = default, uint reqEffMask = 0, AuraApplication except = null)
{
var range = m_appliedAuras.LookupByKey(spellId);
if (!range.Empty())
@@ -4044,7 +4042,7 @@ namespace Game.Entities
}
return null;
}
public Aura GetAura(uint spellId, ObjectGuid casterGUID = default(ObjectGuid), ObjectGuid itemCasterGUID = default(ObjectGuid), uint reqEffMask = 0)
public Aura GetAura(uint spellId, ObjectGuid casterGUID = default, ObjectGuid itemCasterGUID = default, uint reqEffMask = 0)
{
AuraApplication aurApp = GetAuraApplication(spellId, casterGUID, itemCasterGUID, reqEffMask);
return aurApp?.GetBase();
@@ -4144,7 +4142,7 @@ namespace Game.Entities
}
}
}
public Aura _TryStackingOrRefreshingExistingAura(SpellInfo newAura, uint effMask, Unit caster, int[] baseAmount = null, Item castItem = null, ObjectGuid casterGUID = default(ObjectGuid), bool resetPeriodicTimer = true, ObjectGuid castItemGuid = default(ObjectGuid), int castItemLevel = -1)
public Aura _TryStackingOrRefreshingExistingAura(SpellInfo newAura, uint effMask, Unit caster, int[] baseAmount = null, Item castItem = null, ObjectGuid casterGUID = default, bool resetPeriodicTimer = true, ObjectGuid castItemGuid = default, int castItemLevel = -1)
{
Cypher.Assert(!casterGUID.IsEmpty() || caster);
@@ -4323,7 +4321,7 @@ namespace Game.Entities
return true;
}
public Aura GetOwnedAura(uint spellId, ObjectGuid casterGUID = default(ObjectGuid), ObjectGuid itemCasterGUID = default(ObjectGuid), uint reqEffMask = 0, Aura except = null)
public Aura GetOwnedAura(uint spellId, ObjectGuid casterGUID = default, ObjectGuid itemCasterGUID = default, uint reqEffMask = 0, Aura except = null)
{
var range = m_ownedAuras.LookupByKey(spellId);
foreach (var aura in range)
@@ -4574,7 +4572,7 @@ namespace Game.Entities
else if (IsPet())
{
Pet pet = ToPet();
if (pet.isControlled())
if (pet.IsControlled())
pet.SetGroupUpdateFlag(GroupUpdatePetFlags.Auras);
}
}
+59 -62
View File
@@ -18,7 +18,6 @@
using Framework.Constants;
using Framework.Dynamic;
using Framework.GameMath;
using Framework.IO;
using Game.AI;
using Game.BattleGrounds;
using Game.Chat;
@@ -39,16 +38,16 @@ namespace Game.Entities
{
public Unit(bool isWorldObject) : base(isWorldObject)
{
moveSpline = new MoveSpline();
MoveSpline = new MoveSpline();
i_motionMaster = new MotionMaster(this);
threatManager = new ThreatManager(this);
m_unitTypeMask = UnitTypeMask.None;
m_HostileRefManager = new HostileRefManager(this);
UnitTypeMask = UnitTypeMask.None;
hostileRefManager = new HostileRefManager(this);
_spellHistory = new SpellHistory(this);
m_FollowingRefManager = new RefManager<Unit, TargetedMovementGeneratorBase>();
objectTypeId = TypeId.Unit;
objectTypeMask |= TypeMask.Unit;
ObjectTypeId = TypeId.Unit;
ObjectTypeMask |= TypeMask.Unit;
m_updateFlag.MovementUpdate = true;
m_modAttackSpeedPct = new float[] { 1.0f, 1.0f, 1.0f };
@@ -70,11 +69,11 @@ namespace Game.Entities
if (IsTypeId(TypeId.Player))
{
m_modMeleeHitChance = 7.5f;
m_modRangedHitChance = 7.5f;
m_modSpellHitChance = 15.0f;
ModMeleeHitChance = 7.5f;
ModRangedHitChance = 7.5f;
ModSpellHitChance = 15.0f;
}
m_baseSpellCritChance = 5;
BaseSpellCritChance = 5;
for (byte i = 0; i < (int)SpellSchools.Max; ++i)
m_threatModifier[i] = 1.0f;
@@ -111,7 +110,7 @@ namespace Game.Entities
//i_motionMaster = null;
m_charmInfo = null;
moveSpline = null;
MoveSpline = null;
_spellHistory = null;
/*ASSERT(!m_duringRemoveFromWorld);
@@ -152,24 +151,24 @@ namespace Game.Entities
// Check UNIT_STATE_MELEE_ATTACKING or UNIT_STATE_CHASE (without UNIT_STATE_FOLLOW in this case) so pets can reach far away
// targets without stopping half way there and running off.
// These flags are reset after target dies or another command is given.
if (m_HostileRefManager.IsEmpty())
if (hostileRefManager.IsEmpty())
{
// m_CombatTimer set at aura start and it will be freeze until aura removing
if (m_CombatTimer <= diff)
if (combatTimer <= diff)
ClearInCombat();
else
m_CombatTimer -= diff;
combatTimer -= diff;
}
}
uint att;
// not implemented before 3.0.2
if ((att = getAttackTimer(WeaponAttackType.BaseAttack)) != 0)
setAttackTimer(WeaponAttackType.BaseAttack, (diff >= att ? 0 : att - diff));
if ((att = getAttackTimer(WeaponAttackType.RangedAttack)) != 0)
setAttackTimer(WeaponAttackType.RangedAttack, (diff >= att ? 0 : att - diff));
if ((att = getAttackTimer(WeaponAttackType.OffAttack)) != 0)
setAttackTimer(WeaponAttackType.OffAttack, (diff >= att ? 0 : att - diff));
if ((att = GetAttackTimer(WeaponAttackType.BaseAttack)) != 0)
SetAttackTimer(WeaponAttackType.BaseAttack, (diff >= att ? 0 : att - diff));
if ((att = GetAttackTimer(WeaponAttackType.RangedAttack)) != 0)
SetAttackTimer(WeaponAttackType.RangedAttack, (diff >= att ? 0 : att - diff));
if ((att = GetAttackTimer(WeaponAttackType.OffAttack)) != 0)
SetAttackTimer(WeaponAttackType.OffAttack, (diff >= att ? 0 : att - diff));
// update abilities available only for fraction of time
UpdateReactives(diff);
@@ -227,7 +226,7 @@ namespace Game.Entities
for (var i = 0; i < m_gameObj.Count; ++i)
{
GameObject go = m_gameObj[i];
if (!go.isSpawned())
if (!go.IsSpawned())
{
go.SetOwnerGUID(ObjectGuid.Empty);
go.SetRespawnTime(0);
@@ -256,12 +255,12 @@ namespace Game.Entities
public bool IsInDisallowedMountForm()
{
return IsDisallowedMountForm(getTransForm(), GetShapeshiftForm(), GetDisplayId());
return IsDisallowedMountForm(GetTransForm(), GetShapeshiftForm(), GetDisplayId());
}
public bool IsDisallowedMountForm(uint spellId, ShapeShiftForm form, uint displayId)
{
SpellInfo transformSpellInfo = Global.SpellMgr.GetSpellInfo(getTransForm());
SpellInfo transformSpellInfo = Global.SpellMgr.GetSpellInfo(GetTransForm());
if (transformSpellInfo != null)
if (transformSpellInfo.HasAttribute(SpellAttr0.CastableWhileMounted))
return false;
@@ -313,7 +312,7 @@ namespace Game.Entities
{
if (m_sharedVision.Empty())
{
setActive(true);
SetActive(true);
SetWorldObject(true);
}
m_sharedVision.Add(player);
@@ -325,7 +324,7 @@ namespace Game.Entities
m_sharedVision.Remove(player);
if (m_sharedVision.Empty())
{
setActive(false);
SetActive(false);
SetWorldObject(false);
}
}
@@ -485,7 +484,7 @@ namespace Game.Entities
m_Events.KillAllEvents(false); // non-delatable (currently casted spells) will not deleted now but it will deleted at call in Map.RemoveAllObjectsInRemoveList
CombatStop();
DeleteThreatList();
getHostileRefManager().deleteReferences();
GetHostileRefManager().deleteReferences();
GetMotionMaster().Clear(false); // remove different non-standard movement generators.
}
public override void CleanupsBeforeDelete(bool finalCleanup = true)
@@ -495,10 +494,10 @@ namespace Game.Entities
base.CleanupsBeforeDelete(finalCleanup);
}
public void setTransForm(uint spellid) { m_transform = spellid; }
public void SetTransForm(uint spellid) { m_transform = spellid; }
public uint GetTransForm() { return m_transform; }
public Vehicle GetVehicleKit() { return m_vehicleKit; }
public Vehicle GetVehicleKit() { return VehicleKit; }
public Vehicle GetVehicle() { return m_vehicle; }
public void SetVehicle(Vehicle vehicle) { m_vehicle = vehicle; }
public Unit GetVehicleBase()
@@ -965,8 +964,8 @@ namespace Game.Entities
if (HasUnitTypeMask(UnitTypeMask.Accessory))
{
// Vehicle just died, we die too
if (vehicle.GetBase().getDeathState() == DeathState.JustDied)
setDeathState(DeathState.JustDied);
if (vehicle.GetBase().GetDeathState() == DeathState.JustDied)
SetDeathState(DeathState.JustDied);
// If for other reason we as minion are exiting the vehicle (ejected, master dismounted) - unsummon
else
ToTempSummon().UnSummon(2000); // Approximation
@@ -1083,11 +1082,11 @@ namespace Game.Entities
public UnitAI GetAI() { return i_AI; }
void SetAI(UnitAI newAI) { i_AI = newAI; }
public bool isPossessing()
public bool IsPossessing()
{
Unit u = GetCharm();
if (u != null)
return u.isPossessed();
return u.IsPossessed();
else
return false;
}
@@ -1107,9 +1106,9 @@ namespace Game.Entities
return null;
}
public bool IsCharmed() { return !GetCharmerGUID().IsEmpty(); }
public bool isPossessed() { return HasUnitState(UnitState.Possessed); }
public bool IsPossessed() { return HasUnitState(UnitState.Possessed); }
public HostileRefManager getHostileRefManager() { return m_HostileRefManager; }
public HostileRefManager GetHostileRefManager() { return hostileRefManager; }
public void OnPhaseChange()
{
@@ -1118,7 +1117,7 @@ namespace Game.Entities
if (IsTypeId(TypeId.Unit) || !ToPlayer().GetSession().PlayerLogout())
{
HostileRefManager refManager = getHostileRefManager();
HostileRefManager refManager = GetHostileRefManager();
HostileReference refe = refManager.getFirst();
while (refe != null)
@@ -1149,7 +1148,7 @@ namespace Game.Entities
{
Unit unit = host.getTarget();
if (unit != null)
unit.getHostileRefManager().setOnlineOfflineState(ToCreature(), unit.IsInPhase(this));
unit.GetHostileRefManager().setOnlineOfflineState(ToCreature(), unit.IsInPhase(this));
}
}
}
@@ -1595,7 +1594,7 @@ namespace Game.Entities
public Totem ToTotem() { return IsTotem() ? (this as Totem) : null; }
public TempSummon ToTempSummon() { return IsSummon() ? (this as TempSummon) : null; }
public virtual void setDeathState(DeathState s)
public virtual void SetDeathState(DeathState s)
{
// Death state needs to be updated before RemoveAllAurasOnDeath() is called, to prevent entering combat
m_deathState = s;
@@ -1604,7 +1603,7 @@ namespace Game.Entities
{
CombatStop();
DeleteThreatList();
getHostileRefManager().deleteReferences();
GetHostileRefManager().deleteReferences();
if (IsNonMeleeSpellCast(false))
InterruptNonMeleeSpells(false);
@@ -1829,7 +1828,7 @@ namespace Game.Entities
// check "realtime" interrupts
// don't cancel spells which are affected by a SPELL_AURA_CAST_WHILE_WALKING effect
if (((IsTypeId(TypeId.Player) && ToPlayer().isMoving()) || IsNonMeleeSpellCast(false, false, true, autoRepeatSpellInfo.Id == 75)) &&
if (((IsTypeId(TypeId.Player) && ToPlayer().IsMoving()) || IsNonMeleeSpellCast(false, false, true, autoRepeatSpellInfo.Id == 75)) &&
!HasAuraTypeWithAffectMask(AuraType.CastWhileWalking, autoRepeatSpellInfo))
{
// cancel wand shoot
@@ -1840,12 +1839,12 @@ namespace Game.Entities
}
// apply delay (Auto Shot (spellID 75) not affected)
if (m_AutoRepeatFirstCast && getAttackTimer(WeaponAttackType.RangedAttack) < 500 && autoRepeatSpellInfo.Id != 75)
setAttackTimer(WeaponAttackType.RangedAttack, 500);
if (m_AutoRepeatFirstCast && GetAttackTimer(WeaponAttackType.RangedAttack) < 500 && autoRepeatSpellInfo.Id != 75)
SetAttackTimer(WeaponAttackType.RangedAttack, 500);
m_AutoRepeatFirstCast = false;
// castroutine
if (isAttackReady(WeaponAttackType.RangedAttack))
if (IsAttackReady(WeaponAttackType.RangedAttack))
{
// Check if able to cast
SpellCastResult result = m_currentSpells[CurrentSpellTypes.AutoRepeat].CheckCast(true);
@@ -1864,7 +1863,7 @@ namespace Game.Entities
spell.prepare(m_currentSpells[CurrentSpellTypes.AutoRepeat].m_targets);
// all went good, reset attack
resetAttackTimer(WeaponAttackType.RangedAttack);
ResetAttackTimer(WeaponAttackType.RangedAttack);
}
}
@@ -1914,7 +1913,7 @@ namespace Game.Entities
Pet pet = ToPet();
if (pet)
{
if (pet.getPetType() == PetType.Hunter) // Hunter pets have focus
if (pet.GetPetType() == PetType.Hunter) // Hunter pets have focus
displayPower = PowerType.Focus;
else if (pet.IsPetGhoul() || pet.IsPetAbomination()) // DK pets have energy
displayPower = PowerType.Energy;
@@ -1961,11 +1960,11 @@ namespace Game.Entities
public bool IsCharmedOwnedByPlayerOrPlayer() { return GetCharmerOrOwnerOrOwnGUID().IsPlayer(); }
public void addFollower(FollowerReference pRef)
public void AddFollower(FollowerReference pRef)
{
m_FollowingRefManager.InsertFirst(pRef);
}
public void removeFollower(FollowerReference pRef) { } //nothing to do yet
public void RemoveFollower(FollowerReference pRef) { } //nothing to do yet
public uint GetCreatureTypeMask()
{
@@ -2088,15 +2087,15 @@ namespace Game.Entities
Global.CharacterCacheStorage.UpdateCharacterLevel(ToPlayer().GetGUID(), (byte)lvl);
}
}
public uint getLevel() { return m_unitData.Level; }
public override uint GetLevelForTarget(WorldObject target) { return getLevel(); }
public uint GetLevel() { return m_unitData.Level; }
public override uint GetLevelForTarget(WorldObject target) { return GetLevel(); }
public Race GetRace() { return (Race)(byte)m_unitData.Race; }
public void SetRace(Race race) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.Race), (byte)race); }
public ulong getRaceMask() { return 1ul << ((int)GetRace() - 1); }
public ulong GetRaceMask() { return 1ul << ((int)GetRace() - 1); }
public Class GetClass() { return (Class)(byte)m_unitData.ClassId; }
public void SetClass(Class classId) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.ClassId), (byte)classId); }
public uint getClassMask() { return (uint)(1 << ((int)GetClass() - 1)); }
public uint GetClassMask() { return (uint)(1 << ((int)GetClass() - 1)); }
public Gender GetGender() { return (Gender)(byte)m_unitData.Sex; }
public void SetGender(Gender sex) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.Sex), (byte)sex); }
@@ -2289,7 +2288,7 @@ namespace Game.Entities
public SheathState GetSheath() { return (SheathState)(byte)m_unitData.SheatheState; }
public void SetSheath(SheathState sheathed) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.SheatheState), (byte)sheathed); }
public uint GetCombatTimer() { return m_CombatTimer; }
public uint GetCombatTimer() { return combatTimer; }
public UnitPVPStateFlags GetPvpFlags() { return (UnitPVPStateFlags)(byte)m_unitData.PvpFlags; }
public bool HasPvpFlag(UnitPVPStateFlags flags) { return (m_unitData.PvpFlags & (uint)flags) != 0; }
public void AddPvpFlag(UnitPVPStateFlags flags) { SetUpdateFieldFlagValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.PvpFlags), (byte)flags); }
@@ -2342,20 +2341,18 @@ namespace Game.Entities
SetDisplayId(GetNativeDisplayId());
}
public bool IsStopped() { return !HasUnitState(UnitState.Moving); }
public bool HasUnitTypeMask(UnitTypeMask mask) { return Convert.ToBoolean(mask & m_unitTypeMask); }
public void AddUnitTypeMask(UnitTypeMask mask) { m_unitTypeMask |= mask; }
public bool HasUnitTypeMask(UnitTypeMask mask) { return Convert.ToBoolean(mask & UnitTypeMask); }
public void AddUnitTypeMask(UnitTypeMask mask) { UnitTypeMask |= mask; }
public bool IsAlive() { return m_deathState == DeathState.Alive; }
public bool IsDying() { return m_deathState == DeathState.JustDied; }
public bool IsDead() { return (m_deathState == DeathState.Dead || m_deathState == DeathState.Corpse); }
public bool IsSummon() { return m_unitTypeMask.HasAnyFlag(UnitTypeMask.Summon); }
public bool IsGuardian() { return m_unitTypeMask.HasAnyFlag(UnitTypeMask.Guardian); }
public bool IsPet() { return m_unitTypeMask.HasAnyFlag(UnitTypeMask.Pet); }
public bool IsHunterPet() { return m_unitTypeMask.HasAnyFlag(UnitTypeMask.HunterPet); }
public bool IsTotem() { return m_unitTypeMask.HasAnyFlag(UnitTypeMask.Totem); }
public bool IsVehicle() { return m_unitTypeMask.HasAnyFlag(UnitTypeMask.Vehicle); }
public bool IsSummon() { return UnitTypeMask.HasAnyFlag(UnitTypeMask.Summon); }
public bool IsGuardian() { return UnitTypeMask.HasAnyFlag(UnitTypeMask.Guardian); }
public bool IsPet() { return UnitTypeMask.HasAnyFlag(UnitTypeMask.Pet); }
public bool IsHunterPet() { return UnitTypeMask.HasAnyFlag(UnitTypeMask.HunterPet); }
public bool IsTotem() { return UnitTypeMask.HasAnyFlag(UnitTypeMask.Totem); }
public bool IsVehicle() { return UnitTypeMask.HasAnyFlag(UnitTypeMask.Vehicle); }
public void AddUnitState(UnitState f)
{
@@ -2541,7 +2538,7 @@ namespace Game.Entities
public void RestoreFaction()
{
if (IsTypeId(TypeId.Player))
ToPlayer().setFactionForRace(GetRace());
ToPlayer().SetFactionForRace(GetRace());
else
{
if (HasUnitTypeMask(UnitTypeMask.Minion))
+1 -1
View File
@@ -138,7 +138,7 @@ namespace Game.Entities
_me.ApplySpellImmune(0, SpellImmunity.Effect, SpellEffectName.KnockBackDest, true);
// Mechanical units & vehicles ( which are not Bosses, they have own immunities in DB ) should be also immune on healing ( exceptions in switch below )
if (_me.IsTypeId(TypeId.Unit) && _me.ToCreature().GetCreatureTemplate().CreatureType == CreatureType.Mechanical && !_me.ToCreature().isWorldBoss())
if (_me.IsTypeId(TypeId.Unit) && _me.ToCreature().GetCreatureTemplate().CreatureType == CreatureType.Mechanical && !_me.ToCreature().IsWorldBoss())
{
// Heal & dispel ...
_me.ApplySpellImmune(0, SpellImmunity.Effect, SpellEffectName.Heal, true);