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
@@ -1,6 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using Framework.Collections; using Framework.Collections;
namespace Framework.Algorithms namespace Framework.Algorithms
@@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using Framework.Collections; using Framework.Collections;
namespace Framework.Algorithms namespace Framework.Algorithms
@@ -1,6 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
namespace Framework.Collections namespace Framework.Collections
{ {
@@ -16,7 +16,6 @@
*/ */
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Threading; using System.Threading;
namespace Framework.Networking namespace Framework.Networking
-1
View File
@@ -16,7 +16,6 @@
*/ */
using Framework.Constants; using Framework.Constants;
using Framework.Cryptography;
using Framework.Database; using Framework.Database;
using Framework.Rest; using Framework.Rest;
using Framework.Serialization; using Framework.Serialization;
@@ -36,7 +36,6 @@ using System;
using System.Diagnostics; using System.Diagnostics;
using dtPolyRef = System.UInt64; using dtPolyRef = System.UInt64;
using dtStatus = System.UInt32; using dtStatus = System.UInt32;
using System.Linq;
// Define DT_VIRTUAL_QUERYFILTER if you wish to derive a custom filter from dtQueryFilter. // Define DT_VIRTUAL_QUERYFILTER if you wish to derive a custom filter from dtQueryFilter.
// On certain platforms indirect or virtual function call is expensive. The default // On certain platforms indirect or virtual function call is expensive. The default
-2
View File
@@ -15,13 +15,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
using Framework.IO;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Numerics; using System.Numerics;
using System.Reflection; using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
+1 -1
View File
@@ -99,7 +99,7 @@ namespace Game.AI
public static IMovementGenerator SelectMovementAI(Creature creature) public static IMovementGenerator SelectMovementAI(Creature creature)
{ {
switch (creature.m_defaultMovementType) switch (creature.DefaultMovementType)
{ {
case MovementGeneratorType.Random: case MovementGeneratorType.Random:
return new RandomMovementGenerator(); return new RandomMovementGenerator();
+1 -1
View File
@@ -72,7 +72,7 @@ namespace Game.AI
Unit summoner = creature.ToTempSummon().GetSummoner(); Unit summoner = creature.ToTempSummon().GetSummoner();
if (summoner != null) if (summoner != null)
{ {
Unit target = summoner.getAttackerForHelper(); Unit target = summoner.GetAttackerForHelper();
if (target == null && summoner.CanHaveThreatList() && !summoner.GetThreatManager().isThreatListEmpty()) if (target == null && summoner.CanHaveThreatList() && !summoner.GetThreatManager().isThreatListEmpty())
target = summoner.GetThreatManager().getHostilTarget(); target = summoner.GetThreatManager().getHostilTarget();
if (target != null && (creature.IsFriendlyTo(summoner) || creature.IsHostileTo(target))) if (target != null && (creature.IsFriendlyTo(summoner) || creature.IsHostileTo(target)))
+1 -1
View File
@@ -34,7 +34,7 @@ namespace Game.AI
public override bool CanSeeAlways(WorldObject obj) public override bool CanSeeAlways(WorldObject obj)
{ {
if (!obj.isTypeMask(TypeMask.Unit)) if (!obj.IsTypeMask(TypeMask.Unit))
return false; return false;
var threatList = me.GetThreatManager().getThreatList(); var threatList = me.GetThreatManager().getThreatList();
+1 -1
View File
@@ -30,7 +30,7 @@ namespace Game.AI
public override void UpdateAI(uint diff) public override void UpdateAI(uint diff)
{ {
if (me.IsInCombat() && me.getAttackers().Empty()) if (me.IsInCombat() && me.GetAttackers().Empty())
EnterEvadeMode(EvadeReason.NoHostiles); EnterEvadeMode(EvadeReason.NoHostiles);
} }
+5 -5
View File
@@ -56,7 +56,7 @@ namespace Game.AI
me.GetMotionMaster().Clear(); me.GetMotionMaster().Clear();
me.GetMotionMaster().MoveIdle(); me.GetMotionMaster().MoveIdle();
me.CombatStop(); me.CombatStop();
me.getHostileRefManager().deleteReferences(); me.GetHostileRefManager().deleteReferences();
return; return;
} }
@@ -163,9 +163,9 @@ namespace Game.AI
// Some spells can target enemy or friendly (DK Ghoul's Leap) // Some spells can target enemy or friendly (DK Ghoul's Leap)
// Check for enemy first (pet then owner) // Check for enemy first (pet then owner)
Unit target = me.getAttackerForHelper(); Unit target = me.GetAttackerForHelper();
if (!target && owner) if (!target && owner)
target = owner.getAttackerForHelper(); target = owner.GetAttackerForHelper();
if (target) if (target)
{ {
@@ -372,7 +372,7 @@ namespace Game.AI
return null; return null;
// Check pet attackers first so we don't drag a bunch of targets to the owner // Check pet attackers first so we don't drag a bunch of targets to the owner
Unit myAttacker = me.getAttackerForHelper(); Unit myAttacker = me.GetAttackerForHelper();
if (myAttacker) if (myAttacker)
if (!myAttacker.HasBreakableByDamageCrowdControlAura()) if (!myAttacker.HasBreakableByDamageCrowdControlAura())
return myAttacker; return myAttacker;
@@ -382,7 +382,7 @@ namespace Game.AI
return null; return null;
// Check owner attackers // Check owner attackers
Unit ownerAttacker = me.GetCharmerOrOwner().getAttackerForHelper(); Unit ownerAttacker = me.GetCharmerOrOwner().GetAttackerForHelper();
if (ownerAttacker) if (ownerAttacker)
if (!ownerAttacker.HasBreakableByDamageCrowdControlAura()) if (!ownerAttacker.HasBreakableByDamageCrowdControlAura())
return ownerAttacker; return ownerAttacker;
+1 -1
View File
@@ -54,7 +54,7 @@ namespace Game.AI
Unit victim = !i_victimGuid.IsEmpty() ? Global.ObjAccessor.GetUnit(me, i_victimGuid) : null; Unit victim = !i_victimGuid.IsEmpty() ? Global.ObjAccessor.GetUnit(me, i_victimGuid) : null;
// Search victim if no, not attackable, or out of range, or friendly (possible in case duel end) // Search victim if no, not attackable, or out of range, or friendly (possible in case duel end)
if (victim == null || !victim.isTargetableForAttack() || !me.IsWithinDistInMap(victim, max_range) || if (victim == null || !victim.IsTargetableForAttack() || !me.IsWithinDistInMap(victim, max_range) ||
me.IsFriendlyTo(victim) || !me.CanSeeOrDetect(victim)) me.IsFriendlyTo(victim) || !me.CanSeeOrDetect(victim))
{ {
var u_check = new NearestAttackableUnitInObjectRangeCheck(me, me.GetCharmerOrOwnerOrSelf(), max_range); var u_check = new NearestAttackableUnitInObjectRangeCheck(me, me.GetCharmerOrOwnerOrSelf(), max_range);
+7 -7
View File
@@ -73,22 +73,22 @@ namespace Game.AI
return; return;
//Make sure our attack is ready and we aren't currently casting before checking distance //Make sure our attack is ready and we aren't currently casting before checking distance
if (me.isAttackReady()) if (me.IsAttackReady())
{ {
me.AttackerStateUpdate(victim); me.AttackerStateUpdate(victim);
me.resetAttackTimer(); me.ResetAttackTimer();
} }
if (me.haveOffhandWeapon() && me.isAttackReady(WeaponAttackType.OffAttack)) if (me.HaveOffhandWeapon() && me.IsAttackReady(WeaponAttackType.OffAttack))
{ {
me.AttackerStateUpdate(victim, WeaponAttackType.OffAttack); me.AttackerStateUpdate(victim, WeaponAttackType.OffAttack);
me.resetAttackTimer(WeaponAttackType.OffAttack); me.ResetAttackTimer(WeaponAttackType.OffAttack);
} }
} }
public bool DoSpellAttackIfReady(uint spell) public bool DoSpellAttackIfReady(uint spell)
{ {
if (me.HasUnitState(UnitState.Casting) || !me.isAttackReady()) if (me.HasUnitState(UnitState.Casting) || !me.IsAttackReady())
return true; return true;
var spellInfo = Global.SpellMgr.GetSpellInfo(spell); var spellInfo = Global.SpellMgr.GetSpellInfo(spell);
@@ -97,7 +97,7 @@ namespace Game.AI
if (me.IsWithinCombatRange(me.GetVictim(), spellInfo.GetMaxRange(false))) if (me.IsWithinCombatRange(me.GetVictim(), spellInfo.GetMaxRange(false)))
{ {
me.CastSpell(me.GetVictim(), spellInfo, TriggerCastFlags.None); me.CastSpell(me.GetVictim(), spellInfo, TriggerCastFlags.None);
me.resetAttackTimer(); me.ResetAttackTimer();
return true; return true;
} }
} }
@@ -507,7 +507,7 @@ namespace Game.AI
minRange += rangeMod; minRange += rangeMod;
} }
if (_caster.isMoving() && target.isMoving() && !_caster.IsWalking() && !target.IsWalking() && if (_caster.IsMoving() && target.IsMoving() && !_caster.IsWalking() && !target.IsWalking() &&
(_spellInfo.RangeEntry.Flags.HasAnyFlag(SpellRangeFlag.Melee) || target.IsTypeId(TypeId.Player))) (_spellInfo.RangeEntry.Flags.HasAnyFlag(SpellRangeFlag.Melee) || target.IsTypeId(TypeId.Player)))
rangeMod += 8.0f / 3.0f; rangeMod += 8.0f / 3.0f;
} }
+2 -2
View File
@@ -577,7 +577,7 @@ namespace Game.AI
if (me.HasUnitState(UnitState.Casting)) if (me.HasUnitState(UnitState.Casting))
return; return;
if (!me.isAttackReady(WeaponAttackType.RangedAttack)) if (!me.IsAttackReady(WeaponAttackType.RangedAttack))
return; return;
Unit victim = me.GetVictim(); Unit victim = me.GetVictim();
@@ -610,7 +610,7 @@ namespace Game.AI
return; return;
me.CastSpell(victim, rangedAttackSpell, TriggerCastFlags.CastDirectly); me.CastSpell(victim, rangedAttackSpell, TriggerCastFlags.CastDirectly);
me.resetAttackTimer(WeaponAttackType.RangedAttack); me.ResetAttackTimer(WeaponAttackType.RangedAttack);
} }
public void DoAutoAttackIfReady() public void DoAutoAttackIfReady()
+2 -2
View File
@@ -475,7 +475,7 @@ namespace Game.AI
} }
me.SetCombatPulseDelay(5); me.SetCombatPulseDelay(5);
me.setActive(true); me.SetActive(true);
DoZoneInCombat(); DoZoneInCombat();
ScheduleTasks(); ScheduleTasks();
} }
@@ -565,7 +565,7 @@ namespace Game.AI
public override bool CanAIAttack(Unit victim) { return CheckBoundary(victim); } public override bool CanAIAttack(Unit victim) { return CheckBoundary(victim); }
public void _JustReachedHome() { me.setActive(false); } public void _JustReachedHome() { me.SetActive(false); }
public InstanceScript instance; public InstanceScript instance;
public SummonList summons; public SummonList summons;
@@ -21,8 +21,6 @@ using Game.Groups;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Game.Movement;
using Game.Maps;
namespace Game.AI namespace Game.AI
{ {
@@ -101,7 +99,7 @@ namespace Game.AI
public override void MoveInLineOfSight(Unit who) public override void MoveInLineOfSight(Unit who)
{ {
if (me.HasReactState(ReactStates.Aggressive) && !me.HasUnitState(UnitState.Stunned) && who.isTargetableForAttack() && who.isInAccessiblePlaceFor(me)) if (me.HasReactState(ReactStates.Aggressive) && !me.HasUnitState(UnitState.Stunned) && who.IsTargetableForAttack() && who.IsInAccessiblePlaceFor(me))
{ {
if (HasEscortState(eEscortState.Escorting) && AssistPlayerInCombatAgainst(who)) if (HasEscortState(eEscortState.Escorting) && AssistPlayerInCombatAgainst(who))
return; return;
@@ -256,7 +254,7 @@ namespace Game.AI
if (m_bCanInstantRespawn) if (m_bCanInstantRespawn)
{ {
me.setDeathState(DeathState.JustDied); me.SetDeathState(DeathState.JustDied);
me.Respawn(); me.Respawn();
} }
else else
@@ -296,7 +294,7 @@ namespace Game.AI
if (m_bCanInstantRespawn) if (m_bCanInstantRespawn)
{ {
me.setDeathState(DeathState.JustDied); me.SetDeathState(DeathState.JustDied);
me.Respawn(); me.Respawn();
} }
else else
@@ -409,7 +407,7 @@ namespace Game.AI
} }
/// todo get rid of this many variables passed in function. /// todo get rid of this many variables passed in function.
public void Start(bool isActiveAttacker = true, bool run = false, ObjectGuid playerGUID = default(ObjectGuid), Quest quest = null, bool instantRespawn = false, bool canLoopPath = false, bool resetWaypoints = true) public void Start(bool isActiveAttacker = true, bool run = false, ObjectGuid playerGUID = default, Quest quest = null, bool instantRespawn = false, bool canLoopPath = false, bool resetWaypoints = true)
{ {
if (me.GetVictim()) if (me.GetVictim())
{ {
@@ -103,7 +103,7 @@ namespace Game.AI
public override void MoveInLineOfSight(Unit who) public override void MoveInLineOfSight(Unit who)
{ {
if (me.HasReactState(ReactStates.Aggressive) && !me.HasUnitState(UnitState.Stunned) && who.isTargetableForAttack() && who.isInAccessiblePlaceFor(me)) if (me.HasReactState(ReactStates.Aggressive) && !me.HasUnitState(UnitState.Stunned) && who.IsTargetableForAttack() && who.IsInAccessiblePlaceFor(me))
{ {
if (HasFollowState(eFollowState.Inprogress) && AssistPlayerInCombatAgainst(who)) if (HasFollowState(eFollowState.Inprogress) && AssistPlayerInCombatAgainst(who))
return; return;
+1 -4
View File
@@ -18,9 +18,6 @@
using Framework.Constants; using Framework.Constants;
using Game.Entities; using Game.Entities;
using Game.Groups; using Game.Groups;
using Game.Maps;
using Game.Movement;
using Game.Scripting;
using Game.Spells; using Game.Spells;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -1065,7 +1062,7 @@ namespace Game.AI
{ {
GetScript().OnInitialize(go); GetScript().OnInitialize(go);
// do not call respawn event if go is not spawned // do not call respawn event if go is not spawned
if (go.isSpawned()) if (go.IsSpawned())
GetScript().ProcessEventsFor(SmartEvents.Respawn); GetScript().ProcessEventsFor(SmartEvents.Respawn);
} }
+3 -3
View File
@@ -1272,7 +1272,7 @@ namespace Game.AI
break; break;
foreach (var obj in targets) foreach (var obj in targets)
obj.setActive(e.Action.active.state != 0); obj.SetActive(e.Action.active.state != 0);
break; break;
} }
@@ -1635,7 +1635,7 @@ namespace Game.AI
else if (IsGameObject(obj)) else if (IsGameObject(obj))
{ {
// do not modify respawndelay of already spawned gameobjects // do not modify respawndelay of already spawned gameobjects
if (obj.ToGameObject().isSpawnedByDefault()) if (obj.ToGameObject().IsSpawnedByDefault())
obj.ToGameObject().Respawn(); obj.ToGameObject().Respawn();
else else
obj.ToGameObject().SetRespawnTime((int)e.Action.respawnTarget.goRespawnTime); obj.ToGameObject().SetRespawnTime((int)e.Action.respawnTarget.goRespawnTime);
@@ -2256,7 +2256,7 @@ namespace Game.AI
foreach (var obj in targets) foreach (var obj in targets)
if (IsCreature(obj)) if (IsCreature(obj))
obj.ToCreature().setRegeneratingHealth(e.Action.setHealthRegen.regenHealth != 0 ? true : false); obj.ToCreature().SetRegeneratingHealth(e.Action.setHealthRegen.regenHealth != 0 ? true : false);
break; break;
} }
case SmartActions.SetRoot: case SmartActions.SetRoot:
@@ -1048,7 +1048,7 @@ namespace Game.Achievements
public bool IsRealmCompleted(AchievementRecord achievement) public bool IsRealmCompleted(AchievementRecord achievement)
{ {
var time = _allCompletedAchievements.LookupByKey(achievement.Id); var time = _allCompletedAchievements.LookupByKey(achievement.Id);
if (time == default(DateTime)) if (time == default)
return false; return false;
if (time == DateTime.MinValue) if (time == DateTime.MinValue)
+4 -4
View File
@@ -171,7 +171,7 @@ namespace Game.Achievements
SetCriteriaProgress(criteria, miscValue1, referencePlayer, ProgressType.Highest); SetCriteriaProgress(criteria, miscValue1, referencePlayer, ProgressType.Highest);
break; break;
case CriteriaTypes.ReachLevel: case CriteriaTypes.ReachLevel:
SetCriteriaProgress(criteria, referencePlayer.getLevel(), referencePlayer); SetCriteriaProgress(criteria, referencePlayer.GetLevel(), referencePlayer);
break; break;
case CriteriaTypes.ReachSkillLevel: case CriteriaTypes.ReachSkillLevel:
uint skillvalue = referencePlayer.GetBaseSkillValue((SkillType)criteria.Entry.Asset); uint skillvalue = referencePlayer.GetBaseSkillValue((SkillType)criteria.Entry.Asset);
@@ -220,7 +220,7 @@ namespace Game.Achievements
{ {
uint counter = 0; uint counter = 0;
var rewQuests = referencePlayer.getRewardedQuests(); var rewQuests = referencePlayer.GetRewardedQuests();
foreach (var id in rewQuests) foreach (var id in rewQuests)
{ {
Quest quest = Global.ObjectMgr.GetQuestTemplate(id); Quest quest = Global.ObjectMgr.GetQuestTemplate(id);
@@ -1334,7 +1334,7 @@ namespace Game.Achievements
return false; return false;
break; break;
case CriteriaAdditionalCondition.SourceLevel: // 39 case CriteriaAdditionalCondition.SourceLevel: // 39
if (referencePlayer.getLevel() != reqValue) if (referencePlayer.GetLevel() != reqValue)
return false; return false;
break; break;
case CriteriaAdditionalCondition.TargetLevel: // 40 case CriteriaAdditionalCondition.TargetLevel: // 40
@@ -1515,7 +1515,7 @@ namespace Game.Achievements
} }
if (obj == null) if (obj == null)
return default(T); return default;
return obj; return obj;
} }
+5 -6
View File
@@ -25,7 +25,6 @@ using Game.Network;
using Game.Network.Packets; using Game.Network.Packets;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
namespace Game.BattleFields namespace Game.BattleFields
{ {
@@ -270,7 +269,7 @@ namespace Game.BattleFields
} }
// If the player does not match minimal level requirements for the battlefield, kick him // If the player does not match minimal level requirements for the battlefield, kick him
if (player.getLevel() < m_MinLevel) if (player.GetLevel() < m_MinLevel)
{ {
if (!m_PlayersWillBeKick[player.GetTeamId()].ContainsKey(player.GetGUID())) if (!m_PlayersWillBeKick[player.GetTeamId()].ContainsKey(player.GetGUID()))
m_PlayersWillBeKick[player.GetTeamId()][player.GetGUID()] = Time.UnixTime + 10; m_PlayersWillBeKick[player.GetTeamId()][player.GetGUID()] = Time.UnixTime + 10;
@@ -303,7 +302,7 @@ namespace Game.BattleFields
{ {
Player player = Global.ObjAccessor.FindPlayer(guid); Player player = Global.ObjAccessor.FindPlayer(guid);
if (player) if (player)
if (player.isAFK()) if (player.IsAFK())
KickPlayerFromBattlefield(guid); KickPlayerFromBattlefield(guid);
} }
} }
@@ -402,7 +401,7 @@ namespace Game.BattleFields
m_PlayersInWar[player.GetTeamId()].Add(player.GetGUID()); m_PlayersInWar[player.GetTeamId()].Add(player.GetGUID());
m_InvitedPlayers[player.GetTeamId()].Remove(player.GetGUID()); m_InvitedPlayers[player.GetTeamId()].Remove(player.GetGUID());
if (player.isAFK()) if (player.IsAFK())
player.ToggleAFK(); player.ToggleAFK();
OnPlayerJoinWar(player); //for scripting OnPlayerJoinWar(player); //for scripting
@@ -689,7 +688,7 @@ namespace Game.BattleFields
// Set creature in world // Set creature in world
map.AddToMap(creature); map.AddToMap(creature);
creature.setActive(true); creature.SetActive(true);
return creature; return creature;
} }
@@ -718,7 +717,7 @@ namespace Game.BattleFields
// Add to world // Add to world
map.AddToMap(go); map.AddToMap(go);
go.setActive(true); go.SetActive(true);
return go; return go;
} }
@@ -949,7 +949,7 @@ namespace Game.BattleFields
{ {
Player player = Global.ObjAccessor.FindPlayer(guid); Player player = Global.ObjAccessor.FindPlayer(guid);
if (player) if (player)
if (player.getLevel() >= m_MinLevel) if (player.GetLevel() >= m_MinLevel)
player.RemoveAurasDueToSpell(WGSpells.Tenacity); player.RemoveAurasDueToSpell(WGSpells.Tenacity);
} }
+6 -6
View File
@@ -722,7 +722,7 @@ namespace Game.BattleGrounds
{ {
//needed cause else in av some creatures will kill the players at the end //needed cause else in av some creatures will kill the players at the end
player.CombatStop(); player.CombatStop();
player.getHostileRefManager().deleteReferences(); player.GetHostileRefManager().deleteReferences();
} }
// remove temporary currency bonus auras before rewarding player // remove temporary currency bonus auras before rewarding player
@@ -974,7 +974,7 @@ namespace Game.BattleGrounds
public virtual void AddPlayer(Player player) public virtual void AddPlayer(Player player)
{ {
// remove afk from player // remove afk from player
if (player.isAFK()) if (player.IsAFK())
player.ToggleAFK(); player.ToggleAFK();
// score struct must be created in inherited class // score struct must be created in inherited class
@@ -1356,7 +1356,7 @@ namespace Game.BattleGrounds
if (obj) if (obj)
{ {
// If doors are open, close it // If doors are open, close it
if (obj.getLootState() == LootState.Activated && obj.GetGoState() != GameObjectState.Ready) if (obj.GetLootState() == LootState.Activated && obj.GetGoState() != GameObjectState.Ready)
{ {
obj.SetLootState(LootState.Ready); obj.SetLootState(LootState.Ready);
obj.SetGoState(GameObjectState.Ready); obj.SetGoState(GameObjectState.Ready);
@@ -1416,7 +1416,7 @@ namespace Game.BattleGrounds
obj.SetLootState(LootState.JustDeactivated); obj.SetLootState(LootState.JustDeactivated);
else else
{ {
if (obj.getLootState() == LootState.JustDeactivated) if (obj.GetLootState() == LootState.JustDeactivated)
// Change state from GO_JUST_DEACTIVATED to GO_READY in case Battleground is starting again // Change state from GO_JUST_DEACTIVATED to GO_READY in case Battleground is starting again
obj.SetLootState(LootState.Ready); obj.SetLootState(LootState.Ready);
} }
@@ -1523,7 +1523,7 @@ namespace Game.BattleGrounds
Creature creature = AddCreature(entry, type, x, y, z, o); Creature creature = AddCreature(entry, type, x, y, z, o);
if (creature) if (creature)
{ {
creature.setDeathState(DeathState.Dead); creature.SetDeathState(DeathState.Dead);
creature.AddChannelObject(creature.GetGUID()); creature.AddChannelObject(creature.GetGUID());
// aura // aura
//todo Fix display here //todo Fix display here
@@ -1578,7 +1578,7 @@ namespace Game.BattleGrounds
public void HandleTriggerBuff(ObjectGuid goGuid) public void HandleTriggerBuff(ObjectGuid goGuid)
{ {
GameObject obj = GetBgMap().GetGameObject(goGuid); GameObject obj = GetBgMap().GetGameObject(goGuid);
if (!obj || obj.GetGoType() != GameObjectTypes.Trap || !obj.isSpawned()) if (!obj || obj.GetGoType() != GameObjectTypes.Trap || !obj.IsSpawned())
return; return;
// Change buff type, when buff is used: // Change buff type, when buff is used:
@@ -180,7 +180,7 @@ namespace Game.BattleGrounds
battlefieldStatus.WaitTime = Time.GetMSTimeDiffToNow(joinTime); battlefieldStatus.WaitTime = Time.GetMSTimeDiffToNow(joinTime);
} }
public void BuildBattlegroundStatusFailed(out BattlefieldStatusFailed battlefieldStatus, Battleground bg, Player pPlayer, uint ticketId, ArenaTypes arenaType, GroupJoinBattlegroundResult result, ObjectGuid errorGuid = default(ObjectGuid)) public void BuildBattlegroundStatusFailed(out BattlefieldStatusFailed battlefieldStatus, Battleground bg, Player pPlayer, uint ticketId, ArenaTypes arenaType, GroupJoinBattlegroundResult result, ObjectGuid errorGuid = default)
{ {
battlefieldStatus = new BattlefieldStatusFailed(); battlefieldStatus = new BattlefieldStatusFailed();
battlefieldStatus.Ticket.RequesterGuid = pPlayer.GetGUID(); battlefieldStatus.Ticket.RequesterGuid = pPlayer.GetGUID();
@@ -21,7 +21,6 @@ using Game.Entities;
using Game.Mails; using Game.Mails;
using Game.Network.Packets; using Game.Network.Packets;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
namespace Game.BlackMarket namespace Game.BlackMarket
{ {
-1
View File
@@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using Game.Entities; using Game.Entities;
using Framework.Database; using Framework.Database;
using Framework.Constants; using Framework.Constants;
+2 -2
View File
@@ -397,7 +397,7 @@ namespace Game
ObjectGuid invitee = invite.InviteeGuid; ObjectGuid invitee = invite.InviteeGuid;
Player player = Global.ObjAccessor.FindPlayer(invitee); Player player = Global.ObjAccessor.FindPlayer(invitee);
uint level = player ? player.getLevel() : Global.CharacterCacheStorage.GetCharacterLevelByGuid(invitee); uint level = player ? player.GetLevel() : Global.CharacterCacheStorage.GetCharacterLevelByGuid(invitee);
SCalendarEventInvite packet = new SCalendarEventInvite(); SCalendarEventInvite packet = new SCalendarEventInvite();
packet.EventID = calendarEvent != null ? calendarEvent.EventId : 0; packet.EventID = calendarEvent != null ? calendarEvent.EventId : 0;
@@ -545,7 +545,7 @@ namespace Game
ObjectGuid inviteeGuid = calendarInvite.InviteeGuid; ObjectGuid inviteeGuid = calendarInvite.InviteeGuid;
Player invitee = Global.ObjAccessor.FindPlayer(inviteeGuid); Player invitee = Global.ObjAccessor.FindPlayer(inviteeGuid);
uint inviteeLevel = invitee ? invitee.getLevel() : Global.CharacterCacheStorage.GetCharacterLevelByGuid(inviteeGuid); uint inviteeLevel = invitee ? invitee.GetLevel() : Global.CharacterCacheStorage.GetCharacterLevelByGuid(inviteeGuid);
ulong inviteeGuildId = invitee ? invitee.GetGuildId() : Global.CharacterCacheStorage.GetCharacterGuildIdByGuid(inviteeGuid); ulong inviteeGuildId = invitee ? invitee.GetGuildId() : Global.CharacterCacheStorage.GetCharacterGuildIdByGuid(inviteeGuid);
CalendarEventInviteInfo inviteInfo = new CalendarEventInviteInfo(); CalendarEventInviteInfo inviteInfo = new CalendarEventInviteInfo();
+4 -4
View File
@@ -218,7 +218,7 @@ namespace Game.Chat
bool newChannel = _playersStore.Empty(); bool newChannel = _playersStore.Empty();
PlayerInfo playerInfo = new PlayerInfo(); PlayerInfo playerInfo = new PlayerInfo();
playerInfo.SetInvisible(!player.isGMVisible()); playerInfo.SetInvisible(!player.IsGMVisible());
_playersStore[guid] = playerInfo; _playersStore[guid] = playerInfo;
/* /*
@@ -696,7 +696,7 @@ namespace Game.Chat
} }
Player newp = Global.ObjAccessor.FindPlayerByName(newname); Player newp = Global.ObjAccessor.FindPlayerByName(newname);
if (!newp || !newp.isGMVisible()) if (!newp || !newp.IsGMVisible())
{ {
ChannelNameBuilder builder = new ChannelNameBuilder(this, new PlayerNotFoundAppend(newname)); ChannelNameBuilder builder = new ChannelNameBuilder(this, new PlayerNotFoundAppend(newname));
SendToOne(builder, guid); SendToOne(builder, guid);
@@ -830,7 +830,7 @@ namespace Game.Chat
} }
} }
void SendToAll(MessageBuilder builder, ObjectGuid guid = default(ObjectGuid)) void SendToAll(MessageBuilder builder, ObjectGuid guid = default)
{ {
LocalizedPacketDo localizer = new LocalizedPacketDo(builder); LocalizedPacketDo localizer = new LocalizedPacketDo(builder);
@@ -867,7 +867,7 @@ namespace Game.Chat
localizer.Invoke(player); localizer.Invoke(player);
} }
void SendToAllWithAddon(MessageBuilder builder, string addonPrefix, ObjectGuid guid = default(ObjectGuid)) void SendToAllWithAddon(MessageBuilder builder, string addonPrefix, ObjectGuid guid = default)
{ {
LocalizedPacketDo localizer = new LocalizedPacketDo(builder); LocalizedPacketDo localizer = new LocalizedPacketDo(builder);
@@ -216,7 +216,7 @@ namespace Game.Chat
if (!handler.extractPlayerTarget(new StringArguments(nameStr), out target, out targetGuid, out targetName)) if (!handler.extractPlayerTarget(new StringArguments(nameStr), out target, out targetGuid, out targetName))
return false; return false;
int oldlevel = (int)(target ? target.getLevel() : Global.CharacterCacheStorage.GetCharacterLevelByGuid(targetGuid)); int oldlevel = (int)(target ? target.GetLevel() : Global.CharacterCacheStorage.GetCharacterLevelByGuid(targetGuid));
if (!int.TryParse(levelStr, out int newlevel)) if (!int.TryParse(levelStr, out int newlevel))
newlevel = oldlevel; newlevel = oldlevel;
@@ -750,7 +750,7 @@ namespace Game.Chat
if (!handler.extractPlayerTarget(new StringArguments(nameStr), out target, out targetGuid, out targetName)) if (!handler.extractPlayerTarget(new StringArguments(nameStr), out target, out targetGuid, out targetName))
return false; return false;
int oldlevel = (int)(target ? target.getLevel() : Global.CharacterCacheStorage.GetCharacterLevelByGuid(targetGuid)); int oldlevel = (int)(target ? target.GetLevel() : Global.CharacterCacheStorage.GetCharacterLevelByGuid(targetGuid));
if (!int.TryParse(levelStr, out int addlevel)) if (!int.TryParse(levelStr, out int addlevel))
addlevel = 1; addlevel = 1;
+2 -2
View File
@@ -145,7 +145,7 @@ namespace Game.Chat.Commands
handler.SendSysMessage(CypherStrings.CommandCheatCt, player.GetCommandStatus(PlayerCommandStates.Casttime) ? enabled : disabled); handler.SendSysMessage(CypherStrings.CommandCheatCt, player.GetCommandStatus(PlayerCommandStates.Casttime) ? enabled : disabled);
handler.SendSysMessage(CypherStrings.CommandCheatPower, player.GetCommandStatus(PlayerCommandStates.Power) ? enabled : disabled); handler.SendSysMessage(CypherStrings.CommandCheatPower, player.GetCommandStatus(PlayerCommandStates.Power) ? enabled : disabled);
handler.SendSysMessage(CypherStrings.CommandCheatWw, player.GetCommandStatus(PlayerCommandStates.Waterwalk) ? enabled : disabled); handler.SendSysMessage(CypherStrings.CommandCheatWw, player.GetCommandStatus(PlayerCommandStates.Waterwalk) ? enabled : disabled);
handler.SendSysMessage(CypherStrings.CommandCheatTaxinodes, player.isTaxiCheater() ? enabled : disabled); handler.SendSysMessage(CypherStrings.CommandCheatTaxinodes, player.IsTaxiCheater() ? enabled : disabled);
return true; return true;
} }
@@ -191,7 +191,7 @@ namespace Game.Chat.Commands
return false; return false;
if (args.Empty()) if (args.Empty())
argstr = (chr.isTaxiCheater()) ? "off" : "on"; argstr = (chr.IsTaxiCheater()) ? "off" : "on";
if (argstr == "off") if (argstr == "off")
{ {
+5 -5
View File
@@ -50,15 +50,15 @@ namespace Game.Chat
static bool HandleDebugAreaTriggersCommand(StringArguments args, CommandHandler handler) static bool HandleDebugAreaTriggersCommand(StringArguments args, CommandHandler handler)
{ {
Player player = handler.GetSession().GetPlayer(); Player player = handler.GetSession().GetPlayer();
if (!player.isDebugAreaTriggers) if (!player.IsDebugAreaTriggers)
{ {
handler.SendSysMessage(CypherStrings.DebugAreatriggerOn); handler.SendSysMessage(CypherStrings.DebugAreatriggerOn);
player.isDebugAreaTriggers = true; player.IsDebugAreaTriggers = true;
} }
else else
{ {
handler.SendSysMessage(CypherStrings.DebugAreatriggerOff); handler.SendSysMessage(CypherStrings.DebugAreatriggerOff);
player.isDebugAreaTriggers = false; player.IsDebugAreaTriggers = false;
} }
return true; return true;
} }
@@ -441,7 +441,7 @@ namespace Game.Chat
Unit target = handler.getSelectedUnit(); Unit target = handler.getSelectedUnit();
if (!target) if (!target)
target = handler.GetSession().GetPlayer(); target = handler.GetSession().GetPlayer();
HostileReference refe = target.getHostileRefManager().getFirst(); HostileReference refe = target.GetHostileRefManager().getFirst();
uint count = 0; uint count = 0;
handler.SendSysMessage("Hostil reference list of {0} (guid {1})", target.GetName(), target.GetGUID().ToString()); handler.SendSysMessage("Hostil reference list of {0} (guid {1})", target.GetName(), target.GetGUID().ToString());
while (refe != null) while (refe != null)
@@ -485,7 +485,7 @@ namespace Game.Chat
return false; return false;
handler.SendSysMessage("Loot recipient for creature {0} (GUID {1}, DB GUID {2}) is {3}", target.GetName(), target.GetGUID().ToString(), target.GetSpawnId(), handler.SendSysMessage("Loot recipient for creature {0} (GUID {1}, DB GUID {2}) is {3}", target.GetName(), target.GetGUID().ToString(), target.GetSpawnId(),
target.hasLootRecipient() ? (target.GetLootRecipient() ? target.GetLootRecipient().GetName() : "offline") : "no loot recipient"); target.HasLootRecipient() ? (target.GetLootRecipient() ? target.GetLootRecipient().GetName() : "offline") : "no loot recipient");
return true; return true;
} }
+2 -2
View File
@@ -64,7 +64,7 @@ namespace Game.Chat
{ {
if (args.Empty()) if (args.Empty())
{ {
if (session.HasPermission(RBACPermissions.ChatUseStaffBadge) && session.GetPlayer().isGMChat()) if (session.HasPermission(RBACPermissions.ChatUseStaffBadge) && session.GetPlayer().IsGMChat())
session.SendNotification(CypherStrings.GmChatOn); session.SendNotification(CypherStrings.GmChatOn);
else else
session.SendNotification(CypherStrings.GmChatOff); session.SendNotification(CypherStrings.GmChatOff);
@@ -206,7 +206,7 @@ namespace Game.Chat
if (args.Empty()) if (args.Empty())
{ {
handler.SendSysMessage(CypherStrings.YouAre, _player.isGMVisible() ? Global.ObjectMgr.GetCypherString(CypherStrings.Visible) : Global.ObjectMgr.GetCypherString(CypherStrings.Invisible)); handler.SendSysMessage(CypherStrings.YouAre, _player.IsGMVisible() ? Global.ObjectMgr.GetCypherString(CypherStrings.Visible) : Global.ObjectMgr.GetCypherString(CypherStrings.Invisible));
return true; return true;
} }
+1 -1
View File
@@ -208,7 +208,7 @@ namespace Game.Chat.Commands
static void HandleLearnSkillRecipesHelper(Player player, uint skillId) static void HandleLearnSkillRecipesHelper(Player player, uint skillId)
{ {
uint classmask = player.getClassMask(); uint classmask = player.GetClassMask();
foreach (var skillLine in CliDB.SkillLineAbilityStorage.Values) foreach (var skillLine in CliDB.SkillLineAbilityStorage.Values)
{ {
+1 -1
View File
@@ -111,7 +111,7 @@ namespace Game.Chat
{ {
if (args.Empty()) if (args.Empty())
{ {
handler.SendSysMessage(CypherStrings.CommandWhisperaccepting, handler.GetSession().GetPlayer().isAcceptWhispers() ? handler.GetCypherString(CypherStrings.On) : handler.GetCypherString(CypherStrings.Off)); handler.SendSysMessage(CypherStrings.CommandWhisperaccepting, handler.GetSession().GetPlayer().IsAcceptWhispers() ? handler.GetCypherString(CypherStrings.On) : handler.GetCypherString(CypherStrings.Off));
return true; return true;
} }
+3 -3
View File
@@ -1394,7 +1394,7 @@ namespace Game.Chat
accId = target.GetSession().GetAccountId(); accId = target.GetSession().GetAccountId();
money = target.GetMoney(); money = target.GetMoney();
totalPlayerTime = target.GetTotalPlayedTime(); totalPlayerTime = target.GetTotalPlayedTime();
level = target.getLevel(); level = target.GetLevel();
latency = target.GetSession().GetLatency(); latency = target.GetSession().GetLatency();
raceid = target.GetRace(); raceid = target.GetRace();
classid = target.GetClass(); classid = target.GetClass();
@@ -2108,7 +2108,7 @@ namespace Game.Chat
return false; return false;
target.CombatStop(); target.CombatStop();
target.getHostileRefManager().deleteReferences(); target.GetHostileRefManager().deleteReferences();
return true; return true;
} }
@@ -2380,7 +2380,7 @@ namespace Game.Chat
{ {
Player player = handler.GetSession().GetPlayer(); Player player = handler.GetSession().GetPlayer();
if (player.isPossessing()) if (player.IsPossessing())
return false; return false;
player.StopCastingBindSight(); player.StopCastingBindSight();
+5 -5
View File
@@ -58,7 +58,7 @@ namespace Game.Chat
string defRespawnDelayStr = Time.secsToTimeString(target.GetRespawnDelay(), true); string defRespawnDelayStr = Time.secsToTimeString(target.GetRespawnDelay(), true);
handler.SendSysMessage(CypherStrings.NpcinfoChar, target.GetSpawnId(), target.GetGUID().ToString(), faction, npcflags, Entry, displayid, nativeid); handler.SendSysMessage(CypherStrings.NpcinfoChar, target.GetSpawnId(), target.GetGUID().ToString(), faction, npcflags, Entry, displayid, nativeid);
handler.SendSysMessage(CypherStrings.NpcinfoLevel, target.getLevel()); handler.SendSysMessage(CypherStrings.NpcinfoLevel, target.GetLevel());
handler.SendSysMessage(CypherStrings.NpcinfoEquipment, target.GetCurrentEquipmentId(), target.GetOriginalEquipmentId()); handler.SendSysMessage(CypherStrings.NpcinfoEquipment, target.GetCurrentEquipmentId(), target.GetOriginalEquipmentId());
handler.SendSysMessage(CypherStrings.NpcinfoHealth, target.GetCreateHealth(), target.GetMaxHealth(), target.GetHealth()); handler.SendSysMessage(CypherStrings.NpcinfoHealth, target.GetCreateHealth(), target.GetMaxHealth(), target.GetHealth());
handler.SendSysMessage(CypherStrings.NpcinfoInhabitType, cInfo.InhabitType); handler.SendSysMessage(CypherStrings.NpcinfoInhabitType, cInfo.InhabitType);
@@ -166,7 +166,7 @@ namespace Game.Chat
creature.GetMotionMaster().Initialize(); creature.GetMotionMaster().Initialize();
if (creature.IsAlive()) // dead creature will reset movement generator at respawn if (creature.IsAlive()) // dead creature will reset movement generator at respawn
{ {
creature.setDeathState(DeathState.JustDied); creature.SetDeathState(DeathState.JustDied);
creature.Respawn(); creature.Respawn();
} }
} }
@@ -399,7 +399,7 @@ namespace Game.Chat
pet.SetReactState(ReactStates.Defensive); pet.SetReactState(ReactStates.Defensive);
// calculate proper level // calculate proper level
uint level = (creatureTarget.getLevel() < (player.getLevel() - 5)) ? (player.getLevel() - 5) : creatureTarget.getLevel(); uint level = (creatureTarget.GetLevel() < (player.GetLevel() - 5)) ? (player.GetLevel() - 5) : creatureTarget.GetLevel();
// prepare visual effect for levelup // prepare visual effect for levelup
pet.SetLevel(level - 1); pet.SetLevel(level - 1);
@@ -893,7 +893,7 @@ namespace Game.Chat
creature.GetMotionMaster().Initialize(); creature.GetMotionMaster().Initialize();
if (creature.IsAlive()) // dead creature will reset movement generator at respawn if (creature.IsAlive()) // dead creature will reset movement generator at respawn
{ {
creature.setDeathState(DeathState.JustDied); creature.SetDeathState(DeathState.JustDied);
creature.Respawn(); creature.Respawn();
} }
creature.SaveToDB(); creature.SaveToDB();
@@ -992,7 +992,7 @@ namespace Game.Chat
creature.GetMotionMaster().Initialize(); creature.GetMotionMaster().Initialize();
if (creature.IsAlive()) // dead creature will reset movement generator at respawn if (creature.IsAlive()) // dead creature will reset movement generator at respawn
{ {
creature.setDeathState(DeathState.JustDied); creature.SetDeathState(DeathState.JustDied);
creature.Respawn(); creature.Respawn();
} }
+10 -10
View File
@@ -59,14 +59,14 @@ namespace Game.Chat
return false; return false;
} }
creatureTarget.setDeathState(DeathState.JustDied); creatureTarget.SetDeathState(DeathState.JustDied);
creatureTarget.RemoveCorpse(); creatureTarget.RemoveCorpse();
creatureTarget.SetHealth(0); // just for nice GM-mode view creatureTarget.SetHealth(0); // just for nice GM-mode view
pet.SetCreatorGUID(player.GetGUID()); pet.SetCreatorGUID(player.GetGUID());
pet.SetFaction(player.GetFaction()); pet.SetFaction(player.GetFaction());
if (!pet.InitStatsForLevel(creatureTarget.getLevel())) if (!pet.InitStatsForLevel(creatureTarget.GetLevel()))
{ {
Log.outError(LogFilter.ChatSystem, "InitStatsForLevel() in EffectTameCreature failed! Pet deleted."); Log.outError(LogFilter.ChatSystem, "InitStatsForLevel() in EffectTameCreature failed! Pet deleted.");
handler.SendSysMessage("Error 2"); handler.SendSysMessage("Error 2");
@@ -74,7 +74,7 @@ namespace Game.Chat
} }
// prepare visual effect for levelup // prepare visual effect for levelup
pet.SetLevel(creatureTarget.getLevel() - 1); pet.SetLevel(creatureTarget.GetLevel() - 1);
pet.GetCharmInfo().SetPetNumber(Global.ObjectMgr.GeneratePetNumber(), true); pet.GetCharmInfo().SetPetNumber(Global.ObjectMgr.GeneratePetNumber(), true);
// this enables pet details window (Shift+P) // this enables pet details window (Shift+P)
@@ -84,7 +84,7 @@ namespace Game.Chat
pet.GetMap().AddToMap(pet.ToCreature()); pet.GetMap().AddToMap(pet.ToCreature());
// visual effect for levelup // visual effect for levelup
pet.SetLevel(creatureTarget.getLevel()); pet.SetLevel(creatureTarget.GetLevel());
player.SetMinion(pet, true); player.SetMinion(pet, true);
pet.SavePetToDB(PetSaveMode.AsCurrent); pet.SavePetToDB(PetSaveMode.AsCurrent);
@@ -125,7 +125,7 @@ namespace Game.Chat
return false; return false;
} }
pet.learnSpell(spellId); pet.LearnSpell(spellId);
handler.SendSysMessage("Pet has learned spell {0}", spellId); handler.SendSysMessage("Pet has learned spell {0}", spellId);
return true; return true;
@@ -147,7 +147,7 @@ namespace Game.Chat
uint spellId = handler.extractSpellIdFromLink(args); uint spellId = handler.extractSpellIdFromLink(args);
if (pet.HasSpell(spellId)) if (pet.HasSpell(spellId))
pet.removeSpell(spellId, false); pet.RemoveSpell(spellId, false);
else else
handler.SendSysMessage("Pet doesn't have that spell"); handler.SendSysMessage("Pet doesn't have that spell");
@@ -167,18 +167,18 @@ namespace Game.Chat
int level = args.NextInt32(); int level = args.NextInt32();
if (level == 0) if (level == 0)
level = (int)(owner.getLevel() - pet.getLevel()); level = (int)(owner.GetLevel() - pet.GetLevel());
if (level == 0 || level < -SharedConst.StrongMaxLevel || level > SharedConst.StrongMaxLevel) if (level == 0 || level < -SharedConst.StrongMaxLevel || level > SharedConst.StrongMaxLevel)
{ {
handler.SendSysMessage(CypherStrings.BadValue); handler.SendSysMessage(CypherStrings.BadValue);
return false; return false;
} }
int newLevel = (int)pet.getLevel() + level; int newLevel = (int)pet.GetLevel() + level;
if (newLevel < 1) if (newLevel < 1)
newLevel = 1; newLevel = 1;
else if (newLevel > owner.getLevel()) else if (newLevel > owner.GetLevel())
newLevel = (int)owner.getLevel(); newLevel = (int)owner.GetLevel();
pet.GivePetLevel(newLevel); pet.GivePetLevel(newLevel);
return true; return true;
+2 -2
View File
@@ -72,7 +72,7 @@ namespace Game.Chat
if (!player.HasAuraType(AuraType.ModShapeshift)) if (!player.HasAuraType(AuraType.ModShapeshift))
player.SetShapeshiftForm(ShapeShiftForm.None); player.SetShapeshiftForm(ShapeShiftForm.None);
player.setFactionForRace(player.GetRace()); player.SetFactionForRace(player.GetRace());
player.SetPowerType(powerType); player.SetPowerType(powerType);
// reset only if player not in some form; // reset only if player not in some form;
@@ -98,7 +98,7 @@ namespace Game.Chat
if (!HandleResetStatsOrLevelHelper(target)) if (!HandleResetStatsOrLevelHelper(target))
return false; return false;
byte oldLevel = (byte)target.getLevel(); byte oldLevel = (byte)target.GetLevel();
// set starting level // set starting level
uint startLevel = (uint)(target.GetClass() != Class.Deathknight ? WorldConfig.GetIntValue(WorldCfg.StartPlayerLevel) : WorldConfig.GetIntValue(WorldCfg.StartDeathKnightPlayerLevel)); uint startLevel = (uint)(target.GetClass() != Class.Deathknight ? WorldConfig.GetIntValue(WorldCfg.StartPlayerLevel) : WorldConfig.GetIntValue(WorldCfg.StartDeathKnightPlayerLevel));
@@ -19,7 +19,6 @@ using Framework.Constants;
using Framework.IO; using Framework.IO;
using Game.DataStorage; using Game.DataStorage;
using Game.Entities; using Game.Entities;
using System;
namespace Game.Chat namespace Game.Chat
{ {
@@ -19,7 +19,6 @@ using Framework.GameMath;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace Game.Collision namespace Game.Collision
@@ -16,7 +16,6 @@
*/ */
using Framework.GameMath; using Framework.GameMath;
using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace Game.Collision namespace Game.Collision
-1
View File
@@ -16,7 +16,6 @@
*/ */
using Framework.GameMath; using Framework.GameMath;
using System.Collections.Generic;
namespace Game.Collision namespace Game.Collision
{ {
+2 -3
View File
@@ -16,15 +16,14 @@
*/ */
using Framework.GameMath; using Framework.GameMath;
using System.Collections.Generic;
using Framework.Constants; using Framework.Constants;
namespace Game.Collision namespace Game.Collision
{ {
public class IModel public class IModel
{ {
public virtual Vector3 getPosition() { return default(Vector3); } public virtual Vector3 getPosition() { return default; }
public virtual AxisAlignedBox getBounds() { return default(AxisAlignedBox); } public virtual AxisAlignedBox getBounds() { return default; }
public virtual bool IntersectRay(Ray ray, ref float maxDist, bool stopAtFirstHit, PhaseShift phaseShift, ModelIgnoreFlags ignoreFlags) { return false; } public virtual bool IntersectRay(Ray ray, ref float maxDist, bool stopAtFirstHit, PhaseShift phaseShift, ModelIgnoreFlags ignoreFlags) { return false; }
public virtual bool IntersectRay(Ray ray, ref float distance, bool stopAtFirstHit, ModelIgnoreFlags ignoreFlags) { return false; } public virtual bool IntersectRay(Ray ray, ref float distance, bool stopAtFirstHit, ModelIgnoreFlags ignoreFlags) { return false; }
-1
View File
@@ -18,7 +18,6 @@
using Framework.GameMath; using Framework.GameMath;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Concurrent;
namespace Game.Collision namespace Game.Collision
{ {
+4 -4
View File
@@ -115,7 +115,7 @@ namespace Game.Combat
{ {
HostileReference nextRef = refe.next(); HostileReference nextRef = refe.next();
Unit owner = refe.GetSource().GetOwner(); Unit owner = refe.GetSource().GetOwner();
if (!owner.isActiveObject() && owner.GetExactDist2dSq(getOwner()) > range) if (!owner.IsActiveObject() && owner.GetExactDist2dSq(getOwner()) > range)
{ {
refe.removeReference(); refe.removeReference();
} }
@@ -207,11 +207,11 @@ namespace Game.Combat
public override void targetObjectBuildLink() public override void targetObjectBuildLink()
{ {
getTarget().addHatedBy(this); getTarget().AddHatedBy(this);
} }
public override void targetObjectDestroyLink() public override void targetObjectDestroyLink()
{ {
getTarget().removeHatedBy(this); getTarget().RemoveHatedBy(this);
} }
public override void sourceObjectDestroyLink() public override void sourceObjectDestroyLink()
{ {
@@ -277,7 +277,7 @@ namespace Game.Combat
) )
{ {
Creature creature = getSourceUnit().ToCreature(); Creature creature = getSourceUnit().ToCreature();
online = getTarget().isInAccessiblePlaceFor(creature); online = getTarget().IsInAccessiblePlaceFor(creature);
if (!online) if (!online)
{ {
if (creature.IsWithinCombatRange(getTarget(), creature.m_CombatDistance)) if (creature.IsWithinCombatRange(getTarget(), creature.m_CombatDistance))
+5 -5
View File
@@ -91,11 +91,11 @@ namespace Game.Conditions
break; break;
case ConditionTypes.Class: case ConditionTypes.Class:
if (unit != null) if (unit != null)
condMeets = Convert.ToBoolean(unit.getClassMask() & ConditionValue1); condMeets = Convert.ToBoolean(unit.GetClassMask() & ConditionValue1);
break; break;
case ConditionTypes.Race: case ConditionTypes.Race:
if (unit != null) if (unit != null)
condMeets = Convert.ToBoolean(unit.getRaceMask() & ConditionValue1); condMeets = Convert.ToBoolean(unit.GetRaceMask() & ConditionValue1);
break; break;
case ConditionTypes.Gender: case ConditionTypes.Gender:
if (player != null) if (player != null)
@@ -169,7 +169,7 @@ namespace Game.Conditions
break; break;
case ConditionTypes.Level: case ConditionTypes.Level:
if (unit != null) if (unit != null)
condMeets = MathFunctions.CompareValues((ComparisionType)ConditionValue2, unit.getLevel(), ConditionValue1); condMeets = MathFunctions.CompareValues((ComparisionType)ConditionValue2, unit.GetLevel(), ConditionValue1);
break; break;
case ConditionTypes.DrunkenState: case ConditionTypes.DrunkenState:
if (player != null) if (player != null)
@@ -201,7 +201,7 @@ namespace Game.Conditions
} }
break; break;
case ConditionTypes.TypeMask: case ConditionTypes.TypeMask:
condMeets = Convert.ToBoolean((TypeMask)ConditionValue1 & obj.objectTypeMask); condMeets = Convert.ToBoolean((TypeMask)ConditionValue1 & obj.ObjectTypeMask);
break; break;
case ConditionTypes.RelationTo: case ConditionTypes.RelationTo:
{ {
@@ -332,7 +332,7 @@ namespace Game.Conditions
{ {
Pet pet = player.GetPet(); Pet pet = player.GetPet();
if (pet) if (pet)
condMeets = (((1 << (int)pet.getPetType()) & ConditionValue1) != 0); condMeets = (((1 << (int)pet.GetPetType()) & ConditionValue1) != 0);
} }
break; break;
} }
+4 -5
View File
@@ -25,7 +25,6 @@ using Game.Loots;
using Game.Spells; using Game.Spells;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using Framework.IO; using Framework.IO;
namespace Game namespace Game
@@ -1677,16 +1676,16 @@ namespace Game
public static bool IsPlayerMeetingCondition(Player player, PlayerConditionRecord condition) public static bool IsPlayerMeetingCondition(Player player, PlayerConditionRecord condition)
{ {
if (condition.MinLevel != 0 && player.getLevel() < condition.MinLevel) if (condition.MinLevel != 0 && player.GetLevel() < condition.MinLevel)
return false; return false;
if (condition.MaxLevel != 0 && player.getLevel() > condition.MaxLevel) if (condition.MaxLevel != 0 && player.GetLevel() > condition.MaxLevel)
return false; return false;
if (condition.RaceMask != 0 && !Convert.ToBoolean(player.getRaceMask() & condition.RaceMask)) if (condition.RaceMask != 0 && !Convert.ToBoolean(player.GetRaceMask() & condition.RaceMask))
return false; return false;
if (condition.ClassMask != 0 && !Convert.ToBoolean(player.getClassMask() & condition.ClassMask)) if (condition.ClassMask != 0 && !Convert.ToBoolean(player.GetClassMask() & condition.ClassMask))
return false; return false;
if (condition.Gender >= 0 && (int)player.GetGender() != condition.Gender) if (condition.Gender >= 0 && (int)player.GetGender() != condition.Gender)
@@ -19,7 +19,6 @@ using Framework.Constants;
using Framework.Database; using Framework.Database;
using Framework.GameMath; using Framework.GameMath;
using Game.Entities; using Game.Entities;
using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace Game.DataStorage namespace Game.DataStorage
@@ -83,7 +83,7 @@ namespace Game.DataStorage
public T GetRow(uint row) public T GetRow(uint row)
{ {
if (row >= _data.Count) if (row >= _data.Count)
return default(T); return default;
return _data[(int)row]; return _data[(int)row];
} }
-1
View File
@@ -21,7 +21,6 @@ using Framework.GameMath;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions;
namespace Game.DataStorage namespace Game.DataStorage
{ {
-1
View File
@@ -19,7 +19,6 @@ using Framework.GameMath;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Runtime.InteropServices;
namespace Game.DataStorage namespace Game.DataStorage
{ {
@@ -16,7 +16,6 @@
*/ */
using Framework.Constants; using Framework.Constants;
using System;
namespace Game.DataStorage namespace Game.DataStorage
{ {
@@ -16,7 +16,6 @@
*/ */
using Framework.Constants; using Framework.Constants;
using Framework.GameMath; using Framework.GameMath;
using System;
namespace Game.DataStorage namespace Game.DataStorage
{ {
@@ -16,7 +16,6 @@
*/ */
using Framework.Constants; using Framework.Constants;
using System;
namespace Game.DataStorage namespace Game.DataStorage
{ {
+1 -1
View File
@@ -85,7 +85,7 @@ namespace Game.DataStorage
if (guild) if (guild)
guildGuid = guild.GetGUID(); guildGuid = guild.GetGUID();
_whoListStorage.Add(new WhoListPlayerInfo(player.GetGUID(), player.GetTeam(), player.GetSession().GetSecurity(), player.getLevel(), _whoListStorage.Add(new WhoListPlayerInfo(player.GetGUID(), player.GetTeam(), player.GetSession().GetSecurity(), player.GetLevel(),
player.GetClass(), player.GetRace(), player.GetZoneId(), player.m_playerData.NativeSex, player.IsVisible(), player.GetClass(), player.GetRace(), player.GetZoneId(), player.m_playerData.NativeSex, player.IsVisible(),
player.IsGameMaster(), playerName, guildName, guildGuid)); player.IsGameMaster(), playerName, guildName, guildGuid));
} }
+3 -3
View File
@@ -649,7 +649,7 @@ namespace Game.DungeonFinding
return null; return null;
} }
public void UpdateRoleCheck(ObjectGuid gguid, ObjectGuid guid = default(ObjectGuid), LfgRoles roles = LfgRoles.None) public void UpdateRoleCheck(ObjectGuid gguid, ObjectGuid guid = default, LfgRoles roles = LfgRoles.None)
{ {
if (gguid.IsEmpty()) if (gguid.IsEmpty())
return; return;
@@ -1342,7 +1342,7 @@ namespace Game.DungeonFinding
if (dungeon.difficulty == Difficulty.Heroic) if (dungeon.difficulty == Difficulty.Heroic)
player.UpdateCriteria(CriteriaTypes.UseLfdToGroupWithPlayers, 1); player.UpdateCriteria(CriteriaTypes.UseLfdToGroupWithPlayers, 1);
LfgReward reward = GetRandomDungeonReward(rDungeonId, player.getLevel()); LfgReward reward = GetRandomDungeonReward(rDungeonId, player.GetLevel());
if (reward == null) if (reward == null)
continue; continue;
@@ -1496,7 +1496,7 @@ namespace Game.DungeonFinding
return lockDic; return lockDic;
} }
uint level = player.getLevel(); uint level = player.GetLevel();
Expansion expansion = player.GetSession().GetExpansion(); Expansion expansion = player.GetSession().GetExpansion();
var dungeons = GetDungeonsByRandom(0); var dungeons = GetDungeonsByRandom(0);
bool denyJoin = !player.GetSession().HasPermission(RBACPermissions.JoinDungeonFinder); bool denyJoin = !player.GetSession().HasPermission(RBACPermissions.JoinDungeonFinder);
@@ -24,7 +24,6 @@ using Game.Network.Packets;
using Game.Spells; using Game.Spells;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Game;
using Framework.Dynamic; using Framework.Dynamic;
using Game.Network; using Game.Network;
@@ -37,8 +36,8 @@ namespace Game.Entities
_previousCheckOrientation = float.PositiveInfinity; _previousCheckOrientation = float.PositiveInfinity;
_reachedDestination = true; _reachedDestination = true;
objectTypeMask |= TypeMask.AreaTrigger; ObjectTypeMask |= TypeMask.AreaTrigger;
objectTypeId = TypeId.AreaTrigger; ObjectTypeId = TypeId.AreaTrigger;
m_updateFlag.Stationary = true; m_updateFlag.Stationary = true;
m_updateFlag.AreaTrigger = 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(); AreaTrigger at = new AreaTrigger();
if (!at.Create(spellMiscId, caster, target, spell, pos, duration, spellXSpellVisualId, castId, aurEff)) if (!at.Create(spellMiscId, caster, target, spell, pos, duration, spellXSpellVisualId, castId, aurEff))
@@ -393,7 +392,7 @@ namespace Game.Entities
{ {
Player player = unit.ToPlayer(); Player player = unit.ToPlayer();
if (player) if (player)
if (player.isDebugAreaTriggers) if (player.IsDebugAreaTriggers)
player.SendSysMessage(CypherStrings.DebugAreatriggerEntered, GetTemplate().Id); player.SendSysMessage(CypherStrings.DebugAreatriggerEntered, GetTemplate().Id);
DoActions(unit); DoActions(unit);
@@ -408,7 +407,7 @@ namespace Game.Entities
{ {
Player player = leavingUnit.ToPlayer(); Player player = leavingUnit.ToPlayer();
if (player) if (player)
if (player.isDebugAreaTriggers) if (player.IsDebugAreaTriggers)
player.SendSysMessage(CypherStrings.DebugAreatriggerLeft, GetTemplate().Id); player.SendSysMessage(CypherStrings.DebugAreatriggerLeft, GetTemplate().Id);
UndoActions(leavingUnit); UndoActions(leavingUnit);
@@ -887,7 +886,7 @@ namespace Game.Entities
{ {
Player player = caster.ToPlayer(); Player player = caster.ToPlayer();
if (player) if (player)
if (player.isDebugAreaTriggers) if (player.IsDebugAreaTriggers)
player.SummonCreature(1, this, TempSummonType.TimedDespawn, GetTimeToTarget()); player.SummonCreature(1, this, TempSummonType.TimedDespawn, GetTimeToTarget());
} }
} }
+2 -2
View File
@@ -30,8 +30,8 @@ namespace Game.Entities
{ {
_duration = 0; _duration = 0;
objectTypeMask |= TypeMask.Conversation; ObjectTypeMask |= TypeMask.Conversation;
objectTypeId = TypeId.Conversation; ObjectTypeId = TypeId.Conversation;
m_updateFlag.Stationary = true; m_updateFlag.Stationary = true;
m_updateFlag.Conversation = 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) public Corpse(CorpseType type = CorpseType.Bones) : base(type != CorpseType.Bones)
{ {
m_type = type; m_type = type;
objectTypeId = TypeId.Corpse; ObjectTypeId = TypeId.Corpse;
objectTypeMask |= TypeMask.Corpse; ObjectTypeMask |= TypeMask.Corpse;
m_updateFlag.Stationary = true; m_updateFlag.Stationary = true;
@@ -42,7 +42,7 @@ namespace Game.Entities
public bool m_isTempWorldObject; //true when possessed public bool m_isTempWorldObject; //true when possessed
ReactStates reactState; // for AI, not charmInfo ReactStates reactState; // for AI, not charmInfo
public MovementGeneratorType m_defaultMovementType { get; set; } public MovementGeneratorType DefaultMovementType { get; set; }
public ulong m_spawnId; public ulong m_spawnId;
byte m_equipmentId; byte m_equipmentId;
sbyte m_originalEquipmentId; // can be -1 sbyte m_originalEquipmentId; // can be -1
+68 -68
View File
@@ -41,11 +41,11 @@ namespace Game.Entities
m_corpseDelay = 60; m_corpseDelay = 60;
m_boundaryCheckTime = 2500; m_boundaryCheckTime = 2500;
reactState = ReactStates.Aggressive; reactState = ReactStates.Aggressive;
m_defaultMovementType = MovementGeneratorType.Idle; DefaultMovementType = MovementGeneratorType.Idle;
m_regenHealth = true; m_regenHealth = true;
m_meleeDamageSchoolMask = SpellSchoolMask.Normal; m_meleeDamageSchoolMask = SpellSchoolMask.Normal;
m_regenTimer = SharedConst.CreatureRegenInterval; RegenTimer = SharedConst.CreatureRegenInterval;
m_SightDistance = SharedConst.SightRangeUnit; m_SightDistance = SharedConst.SightRangeUnit;
@@ -120,11 +120,11 @@ namespace Game.Entities
public void RemoveCorpse(bool setSpawnTime = true, bool destroyForNearbyPlayers = true) public void RemoveCorpse(bool setSpawnTime = true, bool destroyForNearbyPlayers = true)
{ {
if (getDeathState() != DeathState.Corpse) if (GetDeathState() != DeathState.Corpse)
return; return;
m_corpseRemoveTime = Time.UnixTime; m_corpseRemoveTime = Time.UnixTime;
setDeathState(DeathState.Dead); SetDeathState(DeathState.Dead);
RemoveAllAuras(); RemoveAllAuras();
DestroyForNearbyPlayers(); // old UpdateObjectVisibility() DestroyForNearbyPlayers(); // old UpdateObjectVisibility()
loot.clear(); loot.clear();
@@ -254,9 +254,9 @@ namespace Game.Entities
SetHoverHeight(cinfo.HoverHeight); SetHoverHeight(cinfo.HoverHeight);
// checked at loading // checked at loading
m_defaultMovementType = (MovementGeneratorType)(data != null ? data.movementType : cinfo.MovementType); DefaultMovementType = (MovementGeneratorType)(data != null ? data.movementType : cinfo.MovementType);
if (m_respawnradius == 0 && m_defaultMovementType == MovementGeneratorType.Random) if (m_respawnradius == 0 && DefaultMovementType == MovementGeneratorType.Random)
m_defaultMovementType = MovementGeneratorType.Idle; DefaultMovementType = MovementGeneratorType.Idle;
for (byte i = 0; i < SharedConst.MaxCreatureSpells; ++i) for (byte i = 0; i < SharedConst.MaxCreatureSpells; ++i)
m_spells[i] = GetCreatureTemplate().Spells[i]; m_spells[i] = GetCreatureTemplate().Spells[i];
@@ -365,8 +365,8 @@ namespace Game.Entities
{ {
TriggerJustRespawned = false; TriggerJustRespawned = false;
GetAI().JustRespawned(); GetAI().JustRespawned();
if (m_vehicleKit != null) if (VehicleKit != null)
m_vehicleKit.Reset(); VehicleKit.Reset();
} }
UpdateMovementFlags(); UpdateMovementFlags();
@@ -514,15 +514,15 @@ namespace Game.Entities
if (!IsAlive()) if (!IsAlive())
break; break;
if (m_regenTimer > 0) if (RegenTimer > 0)
{ {
if (diff >= m_regenTimer) if (diff >= RegenTimer)
m_regenTimer = 0; RegenTimer = 0;
else 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 bool bInCombat = IsInCombat() && (!GetVictim() || // if IsInCombat() is true and this has no victim
!GetVictim().GetCharmerOrOwnerPlayerOrPlayerItself() || // or the victim/owner/charmer is not a player !GetVictim().GetCharmerOrOwnerPlayerOrPlayerItself() || // or the victim/owner/charmer is not a player
@@ -536,7 +536,7 @@ namespace Game.Entities
else else
Regenerate(PowerType.Mana); Regenerate(PowerType.Mana);
m_regenTimer = SharedConst.CreatureRegenInterval; RegenTimer = SharedConst.CreatureRegenInterval;
} }
if (CanNotReachTarget() && !IsInEvadeMode() && !GetMap().IsRaid()) if (CanNotReachTarget() && !IsInEvadeMode() && !GetMap().IsRaid())
@@ -605,7 +605,7 @@ namespace Game.Entities
void RegenerateHealth() void RegenerateHealth()
{ {
if (!isRegeneratingHealth()) if (!IsRegeneratingHealth())
return; return;
ulong curValue = GetHealth(); ulong curValue = GetHealth();
@@ -703,12 +703,12 @@ namespace Game.Entities
{ {
if (m_formation == null) if (m_formation == null)
GetMotionMaster().Initialize(); GetMotionMaster().Initialize();
else if (m_formation.getLeader() == this) else if (m_formation.GetLeader() == this)
{ {
m_formation.FormationReset(false); m_formation.FormationReset(false);
GetMotionMaster().Initialize(); GetMotionMaster().Initialize();
} }
else if (m_formation.isFormed()) else if (m_formation.IsFormed())
GetMotionMaster().MoveIdle(); //wait the order of leader GetMotionMaster().MoveIdle(); //wait the order of leader
else else
GetMotionMaster().Initialize(); GetMotionMaster().Initialize();
@@ -840,7 +840,7 @@ namespace Game.Entities
SetReactState(ReactStates.Aggressive); SetReactState(ReactStates.Aggressive);
} }
public bool isCanInteractWithBattleMaster(Player player, bool msg) public bool CanInteractWithBattleMaster(Player player, bool msg)
{ {
if (!IsBattleMaster()) if (!IsBattleMaster())
return false; return false;
@@ -882,7 +882,7 @@ namespace Game.Entities
public bool CanResetTalents(Player player) 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) public void SetTextRepeatId(byte textGroup, byte id)
@@ -977,7 +977,7 @@ namespace Game.Entities
AddDynamicFlag(UnitDynFlags.Tapped); AddDynamicFlag(UnitDynFlags.Tapped);
} }
public bool isTappedBy(Player player) public bool IsTappedBy(Player player)
{ {
if (player.GetGUID() == m_lootRecipient) if (player.GetGUID() == m_lootRecipient)
return true; return true;
@@ -1138,7 +1138,7 @@ namespace Game.Entities
{ {
CreatureTemplate cInfo = GetCreatureTemplate(); CreatureTemplate cInfo = GetCreatureTemplate();
CreatureEliteType rank = IsPet() ? 0 : cInfo.Rank; CreatureEliteType rank = IsPet() ? 0 : cInfo.Rank;
CreatureBaseStats stats = Global.ObjectMgr.GetCreatureBaseStats(getLevel(), cInfo.UnitClass); CreatureBaseStats stats = Global.ObjectMgr.GetCreatureBaseStats(GetLevel(), cInfo.UnitClass);
// health // health
float healthmod = _GetHealthMod(rank); float healthmod = _GetHealthMod(rank);
@@ -1357,7 +1357,7 @@ namespace Game.Entities
SetHealth((m_deathState == DeathState.Alive || m_deathState == DeathState.JustRespawned) ? curhealth : 0); 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()); var qr = Global.ObjectMgr.GetCreatureQuestRelationBounds(GetEntry());
foreach (var id in qr) foreach (var id in qr)
@@ -1368,7 +1368,7 @@ namespace Game.Entities
return false; return false;
} }
public override bool hasInvolvedQuest(uint quest_id) public override bool HasInvolvedQuest(uint quest_id)
{ {
var qir = Global.ObjectMgr.GetCreatureQuestInvolvedRelationBounds(GetEntry()); var qir = Global.ObjectMgr.GetCreatureQuestInvolvedRelationBounds(GetEntry());
foreach (var id in qir) foreach (var id in qir)
@@ -1455,7 +1455,7 @@ namespace Game.Entities
if (who.IsInCombat() && IsWithinDist(who, SharedConst.AttackDistance)) if (who.IsInCombat() && IsWithinDist(who, SharedConst.AttackDistance))
{ {
Unit victim = who.getAttackerForHelper(); Unit victim = who.GetAttackerForHelper();
if (victim != null) if (victim != null)
if (IsWithinDistInMap(victim, WorldConfig.GetFloatValue(WorldCfg.CreatureFamilyAssistanceRadius))) if (IsWithinDistInMap(victim, WorldConfig.GetFloatValue(WorldCfg.CreatureFamilyAssistanceRadius)))
force = true; force = true;
@@ -1515,9 +1515,9 @@ namespace Game.Entities
return (aggroRadius * aggroRate); 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) if (s == DeathState.JustDied)
{ {
@@ -1528,7 +1528,7 @@ namespace Game.Entities
m_respawnTime = Time.UnixTime + m_respawnDelay + m_corpseDelay; m_respawnTime = Time.UnixTime + m_respawnDelay + m_corpseDelay;
// always save boss respawn time at death to prevent crash cheating // always save boss respawn time at death to prevent crash cheating
if (WorldConfig.GetBoolValue(WorldCfg.SaveRespawnTimeImmediately) || isWorldBoss()) if (WorldConfig.GetBoolValue(WorldCfg.SaveRespawnTimeImmediately) || IsWorldBoss())
SaveRespawnTime(); SaveRespawnTime();
ReleaseFocus(null, false); // remove spellcast focus 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 SetMountDisplayId(0); // if creature is mounted on a virtual mount, remove it at death
setActive(false); SetActive(false);
if (HasSearchedAssistance()) if (HasSearchedAssistance())
{ {
@@ -1549,13 +1549,13 @@ namespace Game.Entities
} }
//Dismiss group if is leader //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); m_formation.FormationReset(true);
if ((CanFly() || IsFlying())) if ((CanFly() || IsFlying()))
GetMotionMaster().MoveFall(); GetMotionMaster().MoveFall();
base.setDeathState(DeathState.Corpse); base.SetDeathState(DeathState.Corpse);
} }
else if (s == DeathState.JustRespawned) else if (s == DeathState.JustRespawned)
{ {
@@ -1598,7 +1598,7 @@ namespace Game.Entities
} }
InitializeMovementAI(); InitializeMovementAI();
base.setDeathState(DeathState.Alive); base.SetDeathState(DeathState.Alive);
LoadCreaturesAddon(); LoadCreaturesAddon();
} }
} }
@@ -1610,14 +1610,14 @@ namespace Game.Entities
if (force) if (force)
{ {
if (IsAlive()) if (IsAlive())
setDeathState(DeathState.JustDied); SetDeathState(DeathState.JustDied);
else if (getDeathState() != DeathState.Corpse) else if (GetDeathState() != DeathState.Corpse)
setDeathState(DeathState.Corpse); SetDeathState(DeathState.Corpse);
} }
RemoveCorpse(false, false); RemoveCorpse(false, false);
if (getDeathState() == DeathState.Dead) if (GetDeathState() == DeathState.Dead)
{ {
if (m_spawnId != 0) if (m_spawnId != 0)
GetMap().RemoveCreatureRespawnTime(m_spawnId); GetMap().RemoveCreatureRespawnTime(m_spawnId);
@@ -1632,7 +1632,7 @@ namespace Game.Entities
else else
SelectLevel(); SelectLevel();
setDeathState(DeathState.JustRespawned); SetDeathState(DeathState.JustRespawned);
CreatureModel display = new CreatureModel(GetNativeDisplayId(), GetNativeDisplayScale(), 1.0f); CreatureModel display = new CreatureModel(GetNativeDisplayId(), GetNativeDisplayScale(), 1.0f);
if (Global.ObjectMgr.GetCreatureModelRandomGender(ref display, GetCreatureTemplate()) != null) if (Global.ObjectMgr.GetCreatureModelRandomGender(ref display, GetCreatureTemplate()) != null)
@@ -1660,7 +1660,7 @@ namespace Game.Entities
UpdateObjectVisibility(); UpdateObjectVisibility();
} }
public void ForcedDespawn(uint timeMSToDespawn = 0, TimeSpan forceRespawnTimer = default(TimeSpan)) public void ForcedDespawn(uint timeMSToDespawn = 0, TimeSpan forceRespawnTimer = default)
{ {
if (timeMSToDespawn != 0) if (timeMSToDespawn != 0)
{ {
@@ -1674,7 +1674,7 @@ namespace Game.Entities
DestroyForNearbyPlayers(); DestroyForNearbyPlayers();
if (IsAlive()) if (IsAlive())
setDeathState(DeathState.JustDied); SetDeathState(DeathState.JustDied);
bool overrideRespawnTime = true; bool overrideRespawnTime = true;
if (forceRespawnTimer > TimeSpan.Zero) if (forceRespawnTimer > TimeSpan.Zero)
@@ -1687,9 +1687,9 @@ namespace Game.Entities
RemoveCorpse(overrideRespawnTime, false); 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(); TempSummon summon = ToTempSummon();
if (summon != null) if (summon != null)
@@ -1759,7 +1759,7 @@ namespace Game.Entities
return base.IsImmunedToSpellEffect(spellInfo, index, caster); return base.IsImmunedToSpellEffect(spellInfo, index, caster);
} }
public bool isElite() public bool IsElite()
{ {
if (IsPet()) if (IsPet())
return false; return false;
@@ -1768,7 +1768,7 @@ namespace Game.Entities
return rank != CreatureEliteType.Elite && rank != CreatureEliteType.RareElite; return rank != CreatureEliteType.Elite && rank != CreatureEliteType.RareElite;
} }
public bool isWorldBoss() public bool IsWorldBoss()
{ {
if (IsPet()) if (IsPet())
return false; return false;
@@ -1776,7 +1776,7 @@ namespace Game.Entities
return Convert.ToBoolean(GetCreatureTemplate().TypeFlags & CreatureTypeFlags.BossMob); return Convert.ToBoolean(GetCreatureTemplate().TypeFlags & CreatureTypeFlags.BossMob);
} }
public SpellInfo reachWithSpellAttack(Unit victim) public SpellInfo ReachWithSpellAttack(Unit victim)
{ {
if (victim == null) if (victim == null)
return null; return null;
@@ -1825,7 +1825,7 @@ namespace Game.Entities
return null; return null;
} }
SpellInfo reachWithSpellCure(Unit victim) SpellInfo ReachWithSpellCure(Unit victim)
{ {
if (victim == null) if (victim == null)
return null; return null;
@@ -2013,7 +2013,7 @@ namespace Game.Entities
public bool _IsTargetAcceptable(Unit target) public bool _IsTargetAcceptable(Unit target)
{ {
// if the target cannot be attacked, the target is not acceptable // 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)))) || (m_vehicle != null && (IsOnVehicle(target) || m_vehicle.GetBase().IsOnVehicle(target))))
return false; return false;
@@ -2026,8 +2026,8 @@ namespace Game.Entities
return false; return false;
} }
Unit myVictim = getAttackerForHelper(); Unit myVictim = GetAttackerForHelper();
Unit targetVictim = target.getAttackerForHelper(); Unit targetVictim = target.GetAttackerForHelper();
// if I'm already fighting target, or I'm hostile towards the target, the target is acceptable // if I'm already fighting target, or I'm hostile towards the target, the target is acceptable
if (GetVictim() == target || IsHostileTo(target)) if (GetVictim() == target || IsHostileTo(target))
@@ -2062,7 +2062,7 @@ namespace Game.Entities
if (!IsValidAttackTarget(victim)) if (!IsValidAttackTarget(victim))
return false; return false;
if (!victim.isInAccessiblePlaceFor(this)) if (!victim.IsInAccessiblePlaceFor(this))
return false; return false;
if (IsAIEnabled && !GetAI().CanAIAttack(victim)) if (IsAIEnabled && !GetAI().CanAIAttack(victim))
@@ -2082,7 +2082,7 @@ namespace Game.Entities
return true; return true;
// don't check distance to home position if recently damaged, this should include taunt auras // 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; return true;
} }
@@ -2302,7 +2302,7 @@ namespace Game.Entities
public void AllLootRemovedFromCorpse() 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)) if (LootStorage.Skinning.HaveLootFor(GetCreatureTemplate().SkinLootId))
AddUnitFlag(UnitFlags.Skinnable); AddUnitFlag(UnitFlags.Skinnable);
@@ -2340,7 +2340,7 @@ namespace Game.Entities
return 1.0f; return 1.0f;
uint levelForTarget = GetLevelForTarget(target); uint levelForTarget = GetLevelForTarget(target);
if (getLevel() < levelForTarget) if (GetLevel() < levelForTarget)
return 1.0f; return 1.0f;
return (float)GetMaxHealthByLevel(levelForTarget) / GetCreateHealth(); return (float)GetMaxHealthByLevel(levelForTarget) / GetCreateHealth();
@@ -2360,7 +2360,7 @@ namespace Game.Entities
uint levelForTarget = GetLevelForTarget(target); uint levelForTarget = GetLevelForTarget(target);
return GetBaseDamageForLevel(levelForTarget) / GetBaseDamageForLevel(getLevel()); return GetBaseDamageForLevel(levelForTarget) / GetBaseDamageForLevel(GetLevel());
} }
float GetBaseArmorForLevel(uint level) float GetBaseArmorForLevel(uint level)
@@ -2377,7 +2377,7 @@ namespace Game.Entities
uint levelForTarget = GetLevelForTarget(target); uint levelForTarget = GetLevelForTarget(target);
return GetBaseArmorForLevel(levelForTarget) / GetBaseArmorForLevel(getLevel()); return GetBaseArmorForLevel(levelForTarget) / GetBaseArmorForLevel(GetLevel());
} }
public override uint GetLevelForTarget(WorldObject target) public override uint GetLevelForTarget(WorldObject target)
@@ -2385,9 +2385,9 @@ namespace Game.Entities
Unit unitTarget = target.ToUnit(); Unit unitTarget = target.ToUnit();
if (unitTarget) 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); 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 // between UNIT_FIELD_SCALING_LEVEL_MIN and UNIT_FIELD_SCALING_LEVEL_MAX
if (HasScalableLevels()) if (HasScalableLevels())
{ {
int targetLevelWithDelta = (int)unitTarget.getLevel() + m_unitData.ScalingLevelDelta; int targetLevelWithDelta = (int)unitTarget.GetLevel() + m_unitData.ScalingLevelDelta;
if (target.IsPlayer()) if (target.IsPlayer())
targetLevelWithDelta += target.ToPlayer().m_activePlayerData.ScalingPlayerLevelDelta; targetLevelWithDelta += target.ToPlayer().m_activePlayerData.ScalingPlayerLevelDelta;
@@ -2975,7 +2975,7 @@ namespace Game.Entities
SetSpawnHealth(); SetSpawnHealth();
m_defaultMovementType = (MovementGeneratorType)data.movementType; DefaultMovementType = (MovementGeneratorType)data.movementType;
loot.SetGUID(ObjectGuid.Create(HighGuid.LootObject, data.mapid, data.id, GetMap().GenerateLowGuid(HighGuid.LootObject))); loot.SetGUID(ObjectGuid.Create(HighGuid.LootObject, data.mapid, data.id, GetMap().GenerateLowGuid(HighGuid.LootObject)));
@@ -2984,7 +2984,7 @@ namespace Game.Entities
return true; 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 LootModes GetLootMode() { return m_LootMode; }
public bool HasLootMode(LootModes lootMode) { return Convert.ToBoolean(m_LootMode & 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 void SetNoSearchAssistance(bool val) { m_AlreadySearchedAssistance = val; }
public bool HasSearchedAssistance() { return m_AlreadySearchedAssistance; } public bool HasSearchedAssistance() { return m_AlreadySearchedAssistance; }
MovementGeneratorType GetDefaultMovementType() { return m_defaultMovementType; } MovementGeneratorType GetDefaultMovementType() { return DefaultMovementType; }
public void SetDefaultMovementType(MovementGeneratorType mgt) { m_defaultMovementType = mgt; } public void SetDefaultMovementType(MovementGeneratorType mgt) { DefaultMovementType = mgt; }
public long GetRespawnTime() { return m_respawnTime; } public long GetRespawnTime() { return m_respawnTime; }
public void SetRespawnTime(uint respawn) { m_respawnTime = respawn != 0 ? Time.UnixTime + respawn : 0; } public void SetRespawnTime(uint respawn) { m_respawnTime = respawn != 0 ? Time.UnixTime + respawn : 0; }
@@ -3018,8 +3018,8 @@ namespace Game.Entities
m_combatPulseTime = delay; m_combatPulseTime = delay;
} }
bool isRegeneratingHealth() { return m_regenHealth; } bool IsRegeneratingHealth() { return m_regenHealth; }
public void setRegeneratingHealth(bool regenHealth) { m_regenHealth = regenHealth; } public void SetRegeneratingHealth(bool regenHealth) { m_regenHealth = regenHealth; }
public void SetHomePosition(float x, float y, float z, float o) 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--) for (var i = tauntAuras.Count - 1; i >= 0; i--)
{ {
caster = tauntAuras[i].GetCaster(); 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; target = caster;
break; break;
@@ -3117,21 +3117,21 @@ namespace Game.Entities
else if (!HasReactState(ReactStates.Passive)) else if (!HasReactState(ReactStates.Passive))
{ {
// We have player pet probably // We have player pet probably
target = getAttackerForHelper(); target = GetAttackerForHelper();
if (target == null && IsSummon()) if (target == null && IsSummon())
{ {
Unit owner = ToTempSummon().GetOwner(); Unit owner = ToTempSummon().GetOwner();
if (owner != null) if (owner != null)
{ {
if (owner.IsInCombat()) if (owner.IsInCombat())
target = owner.getAttackerForHelper(); target = owner.GetAttackerForHelper();
if (target == null) if (target == null)
{ {
foreach (var unit in owner.m_Controlled) foreach (var unit in owner.m_Controlled)
{ {
if (unit.IsInCombat()) if (unit.IsInCombat())
{ {
target = unit.getAttackerForHelper(); target = unit.GetAttackerForHelper();
if (target) if (target)
break; break;
} }
@@ -3247,7 +3247,7 @@ namespace Game.Entities
public class ForcedDespawnDelayEvent : BasicEvent public class ForcedDespawnDelayEvent : BasicEvent
{ {
public ForcedDespawnDelayEvent(Creature owner, TimeSpan respawnTimer = default(TimeSpan)) public ForcedDespawnDelayEvent(Creature owner, TimeSpan respawnTimer = default)
{ {
m_owner = owner; m_owner = owner;
m_respawnTimer = respawnTimer; m_respawnTimer = respawnTimer;
@@ -21,7 +21,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using Framework.Dynamic; using Framework.Dynamic;
using Game.Network.Packets; using Game.Network.Packets;
using Game.Network;
namespace Game.Entities 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()); Log.outDebug(LogFilter.Unit, "Deleting member GUID: {0} from group {1}", group.GetId(), member.GetSpawnId());
group.RemoveMember(member); group.RemoveMember(member);
if (group.isEmpty()) if (group.IsEmpty())
{ {
Map map = member.GetMap(); Map map = member.GetMap();
if (!map) 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 uint GetId() { return m_groupID; }
public bool isEmpty() { return m_members.Empty(); } public bool IsEmpty() { return m_members.Empty(); }
public bool isFormed() { return m_Formed; } public bool IsFormed() { return m_Formed; }
Creature m_leader; Creature m_leader;
Dictionary<Creature, FormationInfo> m_members = new Dictionary<Creature, FormationInfo>(); Dictionary<Creature, FormationInfo> m_members = new Dictionary<Creature, FormationInfo>();
+1 -1
View File
@@ -123,7 +123,7 @@ namespace Game.Entities
return TrainerSpellState.Unavailable; return TrainerSpellState.Unavailable;
// check level requirement // check level requirement
if (player.getLevel() < trainerSpell.ReqLevel) if (player.GetLevel() < trainerSpell.ReqLevel)
return TrainerSpellState.Unavailable; return TrainerSpellState.Unavailable;
// check ranks // check ranks
+3 -3
View File
@@ -25,8 +25,8 @@ namespace Game.Entities
{ {
public DynamicObject(bool isWorldObject) : base(isWorldObject) public DynamicObject(bool isWorldObject) : base(isWorldObject)
{ {
objectTypeMask |= TypeMask.DynamicObject; ObjectTypeMask |= TypeMask.DynamicObject;
objectTypeId = TypeId.DynamicObject; ObjectTypeId = TypeId.DynamicObject;
m_updateFlag.Stationary = true; m_updateFlag.Stationary = true;
@@ -100,7 +100,7 @@ namespace Game.Entities
SetUpdateFieldValue(m_values.ModifyValue(m_dynamicObjectData).ModifyValue(m_dynamicObjectData.CastTime), GameTime.GetGameTimeMS()); SetUpdateFieldValue(m_values.ModifyValue(m_dynamicObjectData).ModifyValue(m_dynamicObjectData.CastTime), GameTime.GetGameTimeMS());
if (IsWorldObject()) 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(); Transport transport = caster.GetTransport();
if (transport) if (transport)
+26 -27
View File
@@ -18,7 +18,6 @@
using Framework.Constants; using Framework.Constants;
using Framework.Database; using Framework.Database;
using Framework.GameMath; using Framework.GameMath;
using Framework.IO;
using Game.AI; using Game.AI;
using Game.BattleGrounds; using Game.BattleGrounds;
using Game.Collision; using Game.Collision;
@@ -39,8 +38,8 @@ namespace Game.Entities
{ {
public GameObject() : base(false) public GameObject() : base(false)
{ {
objectTypeMask |= TypeMask.GameObject; ObjectTypeMask |= TypeMask.GameObject;
objectTypeId = TypeId.GameObject; ObjectTypeId = TypeId.GameObject;
m_updateFlag.Stationary = true; m_updateFlag.Stationary = true;
m_updateFlag.Rotation = true; m_updateFlag.Rotation = true;
@@ -50,7 +49,7 @@ namespace Game.Entities
m_spawnedByDefault = true; m_spawnedByDefault = true;
ResetLootMode(); // restore default loot mode ResetLootMode(); // restore default loot mode
m_stationaryPosition = new Position(); StationaryPosition = new Position();
m_gameObjectData = new GameObjectFieldData(); m_gameObjectData = new GameObjectFieldData();
} }
@@ -125,7 +124,7 @@ namespace Game.Entities
GetMap().GetGameObjectBySpawnIdStore().Add(m_spawnId, this); GetMap().GetGameObjectBySpawnIdStore().Add(m_spawnId, this);
// The state can be changed after GameObject.Create but before GameObject.AddToWorld // 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) if (m_model != null)
{ {
Transport trans = ToTransport(); Transport trans = ToTransport();
@@ -188,7 +187,7 @@ namespace Game.Entities
SetMap(map); SetMap(map);
Relocate(pos); Relocate(pos);
m_stationaryPosition.Relocate(pos); StationaryPosition.Relocate(pos);
if (!IsPositionValid()) 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()); 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(); GameObjectTemplate goInfo = GetGoInfo();
uint max_charges; uint max_charges;
@@ -812,7 +811,7 @@ namespace Game.Entities
if (m_respawnTime > 0 && m_spawnedByDefault) if (m_respawnTime > 0 && m_spawnedByDefault)
return; return;
if (isSpawned()) if (IsSpawned())
GetMap().AddToMap(this); GetMap().AddToMap(this);
} }
@@ -848,7 +847,7 @@ namespace Game.Entities
SendMessageToSet(packet, true); SendMessageToSet(packet, true);
} }
public void getFishLoot(Loot fishloot, Player loot_owner) public void GetFishLoot(Loot fishloot, Player loot_owner)
{ {
fishloot.clear(); 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(); fishloot.clear();
@@ -1039,7 +1038,7 @@ namespace Game.Entities
DB.World.Execute(stmt); DB.World.Execute(stmt);
} }
public override bool hasQuest(uint quest_id) public override bool HasQuest(uint quest_id)
{ {
var qr = Global.ObjectMgr.GetGOQuestRelationBounds(GetEntry()); var qr = Global.ObjectMgr.GetGOQuestRelationBounds(GetEntry());
@@ -1051,7 +1050,7 @@ namespace Game.Entities
return false; return false;
} }
public override bool hasInvolvedQuest(uint quest_id) public override bool HasInvolvedQuest(uint quest_id)
{ {
var qir = Global.ObjectMgr.GetGOQuestInvolvedRelationBounds(GetEntry()); var qir = Global.ObjectMgr.GetGOQuestInvolvedRelationBounds(GetEntry());
foreach (var id in qir) foreach (var id in qir)
@@ -1138,7 +1137,7 @@ namespace Game.Entities
return true; return true;
Unit owner = GetOwner(); 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; return true;
} }
@@ -1151,7 +1150,7 @@ namespace Game.Entities
return true; return true;
// Despawned // Despawned
if (!isSpawned()) if (!IsSpawned())
return true; return true;
return false; return false;
@@ -1545,7 +1544,7 @@ namespace Game.Entities
if (player.GetGUID() != GetOwnerGUID()) if (player.GetGUID() != GetOwnerGUID())
return; return;
switch (getLootState()) switch (GetLootState())
{ {
case LootState.Ready: // ready for loot case LootState.Ready: // ready for loot
{ {
@@ -1752,10 +1751,10 @@ namespace Game.Entities
return; return;
//required lvl checks! //required lvl checks!
uint level = player.getLevel(); uint level = player.GetLevel();
if (level < info.MeetingStone.minLevel) if (level < info.MeetingStone.minLevel)
return; return;
level = targetPlayer.getLevel(); level = targetPlayer.GetLevel();
if (level < info.MeetingStone.minLevel) if (level < info.MeetingStone.minLevel)
return; return;
@@ -2625,13 +2624,13 @@ namespace Game.Entities
m_respawnDelayTime = (uint)(respawn > 0 ? respawn : 0); m_respawnDelayTime = (uint)(respawn > 0 ? respawn : 0);
} }
public bool isSpawned() public bool IsSpawned()
{ {
return m_respawnDelayTime == 0 || return m_respawnDelayTime == 0 ||
(m_respawnTime > 0 && !m_spawnedByDefault) || (m_respawnTime > 0 && !m_spawnedByDefault) ||
(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 void SetSpawnedByDefault(bool b) { m_spawnedByDefault = b; }
public uint GetRespawnDelay() { return m_respawnDelayTime; } public uint GetRespawnDelay() { return m_respawnDelayTime; }
@@ -2648,7 +2647,7 @@ namespace Game.Entities
byte GetGoAnimProgress() { return m_gameObjectData.PercentHealth; } byte GetGoAnimProgress() { return m_gameObjectData.PercentHealth; }
public void SetGoAnimProgress(uint animprogress) { SetUpdateFieldValue(m_values.ModifyValue(m_gameObjectData).ModifyValue(m_gameObjectData.PercentHealth), (byte)animprogress); } 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; } public LootModes GetLootMode() { return m_LootMode; }
bool HasLootMode(LootModes lootMode) { return Convert.ToBoolean(m_LootMode & lootMode); } bool HasLootMode(LootModes lootMode) { return Convert.ToBoolean(m_LootMode & lootMode); }
void SetLootMode(LootModes lootMode) { 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 uint GetFaction() { return m_gameObjectData.FactionTemplate; }
public void SetFaction(uint faction) { SetUpdateFieldValue(m_values.ModifyValue(m_gameObjectData).ModifyValue(m_gameObjectData.FactionTemplate), faction); } 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 GetStationaryX() { return StationaryPosition.GetPositionX(); }
public override float GetStationaryY() { return m_stationaryPosition.GetPositionY(); } public override float GetStationaryY() { return StationaryPosition.GetPositionY(); }
public override float GetStationaryZ() { return m_stationaryPosition.GetPositionZ(); } public override float GetStationaryZ() { return StationaryPosition.GetPositionZ(); }
public override float GetStationaryO() { return m_stationaryPosition.GetOrientation(); } 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. //! 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) 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 public ObjectGuid lootingGroupLowGUID; // used to find group which is looting
long m_packedRotation; long m_packedRotation;
Quaternion m_worldRotation; Quaternion m_worldRotation;
public Position m_stationaryPosition { get; set; } public Position StationaryPosition { get; set; }
GameObjectAI m_AI; GameObjectAI m_AI;
ushort _animKitId; ushort _animKitId;
@@ -2774,7 +2773,7 @@ namespace Game.Entities
_owner = owner; _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 uint GetDisplayId() { return _owner.GetDisplayId(); }
public override byte GetNameSetId() { return _owner.GetNameSetId(); } public override byte GetNameSetId() { return _owner.GetNameSetId(); }
public override bool IsInPhase(PhaseShift phaseShift) { return _owner.GetPhaseShift().CanSee(phaseShift); } public override bool IsInPhase(PhaseShift phaseShift) { return _owner.GetPhaseShift().CanSee(phaseShift); }
@@ -20,7 +20,6 @@ using Framework.Constants;
using Framework.GameMath; using Framework.GameMath;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Game.Network;
using Game.Network.Packets; using Game.Network.Packets;
namespace Game.Entities namespace Game.Entities
+2 -2
View File
@@ -25,8 +25,8 @@ namespace Game.Entities
{ {
public Bag() public Bag()
{ {
objectTypeMask |= TypeMask.Container; ObjectTypeMask |= TypeMask.Container;
objectTypeId = TypeId.Container; ObjectTypeId = TypeId.Container;
m_containerData = new ContainerData(); m_containerData = new ContainerData();
} }
+8 -9
View File
@@ -18,7 +18,6 @@
using Framework.Collections; using Framework.Collections;
using Framework.Constants; using Framework.Constants;
using Framework.Database; using Framework.Database;
using Framework.IO;
using Game.DataStorage; using Game.DataStorage;
using Game.Loots; using Game.Loots;
using Game.Network; using Game.Network;
@@ -36,8 +35,8 @@ namespace Game.Entities
{ {
public Item() : base(false) public Item() : base(false)
{ {
objectTypeMask |= TypeMask.Item; ObjectTypeMask |= TypeMask.Item;
objectTypeId = TypeId.Item; ObjectTypeId = TypeId.Item;
m_itemData = new ItemData(); m_itemData = new ItemData();
@@ -911,7 +910,7 @@ namespace Game.Entities
return true; 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. // 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)) if ((GetEnchantmentId(slot) == id) && (GetEnchantmentDuration(slot) == duration) && (GetEnchantmentCharges(slot) == charges))
@@ -922,7 +921,7 @@ namespace Game.Entities
{ {
uint oldEnchant = GetEnchantmentId(slot); uint oldEnchant = GetEnchantmentId(slot);
if (oldEnchant != 0) 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) if (id != 0)
owner.GetSession().SendEnchantmentLog(GetOwnerGUID(), caster, GetGUID(), GetEntry(), id, (uint)slot); owner.GetSession().SendEnchantmentLog(GetOwnerGUID(), caster, GetGUID(), GetEntry(), id, (uint)slot);
@@ -1893,7 +1892,7 @@ namespace Game.Entities
uint minItemLevelCutoff = owner.m_unitData.MinItemLevelCutoff; uint minItemLevelCutoff = owner.m_unitData.MinItemLevelCutoff;
uint maxItemLevel = GetTemplate().GetFlags3().HasAnyFlag(ItemFlags3.IgnoreItemLevelCapInPvp) ? 0u : owner.m_unitData.MaxItemLevel; uint maxItemLevel = GetTemplate().GetFlags3().HasAnyFlag(ItemFlags3.IgnoreItemLevelCapInPvp) ? 0u : owner.m_unitData.MaxItemLevel;
bool pvpBonus = owner.IsUsingPvpItemLevels(); 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); minItemLevel, minItemLevelCutoff, maxItemLevel, pvpBonus);
} }
@@ -2607,8 +2606,8 @@ namespace Game.Entities
uState = state; uState = state;
} }
public override bool hasQuest(uint quest_id) { return GetTemplate().GetStartQuest() == quest_id; } public override bool HasQuest(uint quest_id) { return GetTemplate().GetStartQuest() == quest_id; }
public override bool hasInvolvedQuest(uint quest_id) { return false; } public override bool HasInvolvedQuest(uint quest_id) { return false; }
public bool IsPotion() { return GetTemplate().IsPotion(); } public bool IsPotion() { return GetTemplate().IsPotion(); }
public bool IsVellum() { return GetTemplate().IsVellum(); } public bool IsVellum() { return GetTemplate().IsVellum(); }
public bool IsConjuredConsumable() { return GetTemplate().IsConjuredConsumable(); } public bool IsConjuredConsumable() { return GetTemplate().IsConjuredConsumable(); }
@@ -2762,7 +2761,7 @@ namespace Game.Entities
count = _count; count = _count;
} }
public bool isContainedIn(List<ItemPosCount> vec) public bool IsContainedIn(List<ItemPosCount> vec)
{ {
foreach (var posCount in vec) foreach (var posCount in vec)
if (posCount.pos == pos) if (posCount.pos == pos)
+2 -2
View File
@@ -234,9 +234,9 @@ namespace Game.Entities
return false; return false;
int levelIndex = 0; int levelIndex = 0;
if (player.getLevel() >= 110) if (player.GetLevel() >= 110)
levelIndex = 2; levelIndex = 2;
else if (player.getLevel() > 40) else if (player.GetLevel() > 40)
levelIndex = 1; levelIndex = 1;
return Specializations[levelIndex].Get(CalculateItemSpecBit(chrSpecialization)); 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 Empty = new ObjectGuid();
public static ObjectGuid TradeItem = Create(HighGuid.Uniq, 10ul); public static ObjectGuid TradeItem = Create(HighGuid.Uniq, 10ul);
ulong _low;
ulong _high;
public ObjectGuid(ulong high, ulong low) public ObjectGuid(ulong high, ulong low)
{ {
_low = low; _low = low;
@@ -321,13 +324,13 @@ namespace Game.Entities
return false; return false;
} }
} }
ulong _low;
ulong _high;
} }
public class ObjectGuidGenerator public class ObjectGuidGenerator
{ {
ulong _nextGuid;
HighGuid _highGuid;
public ObjectGuidGenerator(HighGuid highGuid, ulong start = 1) public ObjectGuidGenerator(HighGuid highGuid, ulong start = 1)
{ {
_highGuid = highGuid; _highGuid = highGuid;
@@ -350,8 +353,5 @@ namespace Game.Entities
Log.outFatal(LogFilter.Server, "{0} guid overflow!! Can't continue, shutting down server. ", _highGuid); Log.outFatal(LogFilter.Server, "{0} guid overflow!! Can't continue, shutting down server. ", _highGuid);
Global.WorldMgr.StopNow(); Global.WorldMgr.StopNow();
} }
ulong _nextGuid;
HighGuid _highGuid;
} }
} }
+11 -11
View File
@@ -23,6 +23,11 @@ namespace Game.Entities
{ {
public class Position 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) public Position(float x = 0f, float y = 0f, float z = 0f, float o = 0f)
{ {
posX = x; posX = x;
@@ -321,15 +326,16 @@ namespace Game.Entities
{ {
return $"X: {posX} Y: {posY} Z: {posZ} O: {Orientation}"; 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 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) public WorldLocation(uint mapId = 0xFFFFFFFF, float x = 0, float y = 0, float z = 0, float o = 0)
{ {
_mapId = mapId; _mapId = mapId;
@@ -384,11 +390,5 @@ namespace Game.Entities
{ {
return this; return this;
} }
uint _mapId;
Cell currentCell;
public ObjectCellMoveState _moveState;
public Position _newPosition = new Position();
} }
} }
@@ -24,6 +24,11 @@ namespace Game.Entities
{ {
public class UpdateData public class UpdateData
{ {
uint MapId;
uint BlockCount;
List<ObjectGuid> outOfRangeGUIDs = new List<ObjectGuid>();
ByteBuffer data = new ByteBuffer();
public UpdateData(uint mapId) public UpdateData(uint mapId)
{ {
MapId = mapId; MapId = mapId;
@@ -82,10 +87,5 @@ namespace Game.Entities
public List<ObjectGuid> GetOutOfRangeGUIDs() { return outOfRangeGUIDs; } public List<ObjectGuid> GetOutOfRangeGUIDs() { return outOfRangeGUIDs; }
public void SetMapId(ushort mapId) { MapId = mapId; } 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 public class UpdateFieldHolder
{ {
UpdateMask _changesMask = new UpdateMask((int)TypeId.Max);
WorldObject _owner;
public UpdateFieldHolder(WorldObject owner) { _owner = owner; } public UpdateFieldHolder(WorldObject owner) { _owner = owner; }
public BaseUpdateData<T> ModifyValue<T>(BaseUpdateData<T> updateData) public BaseUpdateData<T> ModifyValue<T>(BaseUpdateData<T> updateData)
@@ -59,9 +62,6 @@ namespace Game.Entities
{ {
return _changesMask[(int)index]; return _changesMask[(int)index];
} }
UpdateMask _changesMask = new UpdateMask((int)TypeId.Max);
WorldObject _owner;
} }
public interface IUpdateField<T> public interface IUpdateField<T>
@@ -430,6 +430,9 @@ namespace Game.Entities
public class DynamicUpdateFieldSetter<T> : IUpdateField<T> where T : new() public class DynamicUpdateFieldSetter<T> : IUpdateField<T> where T : new()
{ {
DynamicUpdateField<T> _dynamicUpdateField;
int _index;
public DynamicUpdateFieldSetter(DynamicUpdateField<T> dynamicUpdateField, int index) public DynamicUpdateFieldSetter(DynamicUpdateField<T> dynamicUpdateField, int index)
{ {
_dynamicUpdateField = dynamicUpdateField; _dynamicUpdateField = dynamicUpdateField;
@@ -447,8 +450,5 @@ namespace Game.Entities
{ {
return dynamicUpdateFieldSetter.GetValue(); return dynamicUpdateFieldSetter.GetValue();
} }
DynamicUpdateField<T> _dynamicUpdateField;
int _index;
} }
} }
@@ -19,9 +19,7 @@ using Framework.Constants;
using Game.Network; using Game.Network;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using Framework.GameMath; using Framework.GameMath;
using System.Runtime.CompilerServices;
using Game.Spells; using Game.Spells;
using Game.DataStorage; using Game.DataStorage;
@@ -84,10 +82,10 @@ namespace Game.Entities
Creature creature = obj.ToCreature(); Creature creature = obj.ToCreature();
if (creature != null) if (creature != null)
{ {
if (creature.hasLootRecipient() && !creature.isTappedBy(receiver)) if (creature.HasLootRecipient() && !creature.IsTappedBy(receiver))
unitDynFlags |= UnitDynFlags.Tapped; unitDynFlags |= UnitDynFlags.Tapped;
if (!receiver.isAllowedToLoot(creature)) if (!receiver.IsAllowedToLoot(creature))
unitDynFlags &= ~UnitDynFlags.Lootable; unitDynFlags &= ~UnitDynFlags.Lootable;
} }
@@ -1998,7 +1996,7 @@ namespace Game.Entities
CreatureTemplate cinfo = unit.ToCreature().GetCreatureTemplate(); CreatureTemplate cinfo = unit.ToCreature().GetCreatureTemplate();
// this also applies for transform auras // this also applies for transform auras
SpellInfo transform = Global.SpellMgr.GetSpellInfo(unit.getTransForm()); SpellInfo transform = Global.SpellMgr.GetSpellInfo(unit.GetTransForm());
if (transform != null) if (transform != null)
{ {
foreach (SpellEffectInfo effect in transform.GetEffectsForDifficulty(unit.GetMap().GetDifficultyID())) 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
using Framework.Constants;
using Framework.IO;
using System.Collections;
using System; using System;
namespace Game.Entities namespace Game.Entities
+49 -56
View File
@@ -15,26 +15,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
using Framework.Collections;
using Framework.Constants; using Framework.Constants;
using Framework.Dynamic; using Framework.Dynamic;
using Framework.GameMath; using Framework.GameMath;
using Framework.IO;
using Game.AI; using Game.AI;
using Game.BattleFields; using Game.BattleFields;
using Game.DataStorage;
using Game.Maps; using Game.Maps;
using Game.Network; using Game.Network;
using Game.Network.Packets; using Game.Network.Packets;
using Game.Scenarios; using Game.Scenarios;
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Linq.Expressions;
using System.Reflection;
namespace Game.Entities namespace Game.Entities
{ {
@@ -48,8 +39,8 @@ namespace Game.Entities
m_serverSideVisibility.SetValue(ServerSideVisibilityType.Ghost, GhostVisibilityType.Alive | GhostVisibilityType.Ghost); m_serverSideVisibility.SetValue(ServerSideVisibilityType.Ghost, GhostVisibilityType.Alive | GhostVisibilityType.Ghost);
m_serverSideVisibilityDetect.SetValue(ServerSideVisibilityType.Ghost, GhostVisibilityType.Alive); m_serverSideVisibilityDetect.SetValue(ServerSideVisibilityType.Ghost, GhostVisibilityType.Alive);
objectTypeId = TypeId.Object; ObjectTypeId = TypeId.Object;
objectTypeMask = TypeMask.Object; ObjectTypeMask = TypeMask.Object;
m_values = new UpdateFieldHolder(this); m_values = new UpdateFieldHolder(this);
@@ -75,7 +66,7 @@ namespace Game.Entities
if (IsInWorld) if (IsInWorld)
{ {
Log.outFatal(LogFilter.Misc, "WorldObject.Dispose() {0} deleted but still in world!!", GetGUID().ToString()); 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()); Log.outFatal(LogFilter.Misc, "Item slot {0}", ((Item)this).GetSlot());
Cypher.Assert(false); Cypher.Assert(false);
} }
@@ -107,7 +98,7 @@ namespace Game.Entities
if (!IsInWorld) if (!IsInWorld)
return; return;
if (!objectTypeMask.HasAnyFlag(TypeMask.Item | TypeMask.Container)) if (!ObjectTypeMask.HasAnyFlag(TypeMask.Item | TypeMask.Container))
DestroyForNearbyPlayers(); DestroyForNearbyPlayers();
IsInWorld = false; IsInWorld = false;
@@ -120,8 +111,8 @@ namespace Game.Entities
return; return;
UpdateType updateType = UpdateType.CreateObject; UpdateType updateType = UpdateType.CreateObject;
TypeId tempObjectType = objectTypeId; TypeId tempObjectType = ObjectTypeId;
TypeMask tempObjectTypeMask = objectTypeMask; TypeMask tempObjectTypeMask = ObjectTypeMask;
CreateObjectBits flags = m_updateFlag; CreateObjectBits flags = m_updateFlag;
if (target == this) if (target == this)
@@ -164,7 +155,7 @@ namespace Game.Entities
if (flags.Stationary) if (flags.Stationary)
{ {
// UPDATETYPE_CREATE_OBJECT2 for some gameobject types... // UPDATETYPE_CREATE_OBJECT2 for some gameobject types...
if (isTypeMask(TypeMask.GameObject)) if (IsTypeMask(TypeMask.GameObject))
{ {
switch (ToGameObject().GetGoType()) switch (ToGameObject().GetGoType())
{ {
@@ -357,7 +348,7 @@ namespace Game.Entities
// HasMovementSpline - marks that spline data is present in packet // HasMovementSpline - marks that spline data is present in packet
if (HasSpline) if (HasSpline)
MovementExtensions.WriteCreateObjectSplineDataBlock(unit.moveSpline, data); MovementExtensions.WriteCreateObjectSplineDataBlock(unit.MoveSpline, data);
} }
data.WriteInt32(PauseTimesCount); data.WriteInt32(PauseTimesCount);
@@ -949,7 +940,7 @@ namespace Game.Entities
GetMap().AddObjectToSwitchList(this, on); GetMap().AddObjectToSwitchList(this, on);
} }
public void setActive(bool on) public void SetActive(bool on)
{ {
if (m_isActive == on) if (m_isActive == on)
return; return;
@@ -1039,7 +1030,7 @@ namespace Game.Entities
public float GetGridActivationRange() public float GetGridActivationRange()
{ {
if (isActiveObject()) if (IsActiveObject())
{ {
if (GetTypeId() == TypeId.Player && ToPlayer().GetCinematicMgr().IsOnCinematic()) if (GetTypeId() == TypeId.Player && ToPlayer().GetCinematicMgr().IsOnCinematic())
return Math.Max(SharedConst.DefaultVisibilityInstance, GetMap().GetVisibilityRange()); return Math.Max(SharedConst.DefaultVisibilityInstance, GetMap().GetVisibilityRange());
@@ -1057,7 +1048,7 @@ namespace Game.Entities
{ {
if (IsVisibilityOverridden() && !IsTypeId(TypeId.Player)) if (IsVisibilityOverridden() && !IsTypeId(TypeId.Player))
return m_visibilityDistanceOverride.Value; return m_visibilityDistanceOverride.Value;
else if (isActiveObject() && !IsTypeId(TypeId.Player)) else if (IsActiveObject() && !IsTypeId(TypeId.Player))
return SharedConst.MaxVisibilityDistance; return SharedConst.MaxVisibilityDistance;
else else
return GetMap().GetVisibilityRange(); return GetMap().GetVisibilityRange();
@@ -1071,7 +1062,7 @@ namespace Game.Entities
{ {
if (target != null && target.IsVisibilityOverridden() && !target.IsTypeId(TypeId.Player)) if (target != null && target.IsVisibilityOverridden() && !target.IsTypeId(TypeId.Player))
return target.m_visibilityDistanceOverride.Value; 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; return SharedConst.MaxVisibilityDistance;
else if (ToPlayer().GetCinematicMgr().IsOnCinematic()) else if (ToPlayer().GetCinematicMgr().IsOnCinematic())
return SharedConst.DefaultVisibilityInstance; return SharedConst.DefaultVisibilityInstance;
@@ -1084,7 +1075,7 @@ namespace Game.Entities
return SharedConst.SightRangeUnit; return SharedConst.SightRangeUnit;
} }
if (IsTypeId(TypeId.DynamicObject) && isActiveObject()) if (IsTypeId(TypeId.DynamicObject) && IsActiveObject())
{ {
return GetMap().GetVisibilityRange(); return GetMap().GetVisibilityRange();
} }
@@ -1493,7 +1484,7 @@ namespace Game.Entities
if (IsTypeId(TypeId.Player) || IsTypeId(TypeId.Unit)) if (IsTypeId(TypeId.Player) || IsTypeId(TypeId.Unit))
{ {
summon.SetFaction(ToUnit().GetFaction()); summon.SetFaction(ToUnit().GetFaction());
summon.SetLevel(ToUnit().getLevel()); summon.SetLevel(ToUnit().GetLevel());
} }
if (AI != null) if (AI != null)
@@ -1647,7 +1638,7 @@ namespace Game.Entities
if (!player.HaveAtClient(this)) if (!player.HaveAtClient(this))
continue; 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; continue;
DestroyForPlayer(player); 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 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 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 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 HasQuest(uint questId) { return false; }
public virtual bool hasInvolvedQuest(uint questId) { return false; } public virtual bool HasInvolvedQuest(uint questId) { return false; }
public bool IsCreature() { return GetTypeId() == TypeId.Unit; } public bool IsCreature() { return GetTypeId() == TypeId.Unit; }
public bool IsPlayer() { return GetTypeId() == TypeId.Player; } public bool IsPlayer() { return GetTypeId() == TypeId.Player; }
public bool IsGameObject() { return GetTypeId() == TypeId.GameObject; } 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 IsCorpse() { return GetTypeId() == TypeId.Corpse; }
public bool IsDynObject() { return GetTypeId() == TypeId.DynamicObject; } public bool IsDynObject() { return GetTypeId() == TypeId.DynamicObject; }
public bool IsAreaTrigger() { return GetTypeId() == TypeId.AreaTrigger; } public bool IsAreaTrigger() { return GetTypeId() == TypeId.AreaTrigger; }
@@ -1741,13 +1732,13 @@ namespace Game.Entities
public ZoneScript GetZoneScript() { return m_zoneScript; } public ZoneScript GetZoneScript() { return m_zoneScript; }
public void AddToNotify(NotifyFlags f) { m_notifyflags |= f; } 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; } NotifyFlags GetNotifyFlags() { return m_notifyflags; }
bool NotifyExecuted(NotifyFlags f) { return Convert.ToBoolean(m_executed_notifies & f); } bool NotifyExecuted(NotifyFlags f) { return Convert.ToBoolean(m_executed_notifies & f); }
void SetNotified(NotifyFlags f) { m_executed_notifies |= f; } void SetNotified(NotifyFlags f) { m_executed_notifies |= f; }
public void ResetAllNotifies() { m_notifyflags = 0; m_executed_notifies = 0; } 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 bool IsPermanentWorldObject() { return m_isWorldObject; }
public Transport GetTransport() { return m_transport; } 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); 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); 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); return !HasInArc(2 * MathFunctions.PI - arc, target);
} }
@@ -2333,8 +2324,8 @@ namespace Game.Entities
public void SetLocationInstanceId(uint _instanceId) { instanceId = _instanceId; } public void SetLocationInstanceId(uint _instanceId) { instanceId = _instanceId; }
#region Fields #region Fields
public TypeMask objectTypeMask { get; set; } public TypeMask ObjectTypeMask { get; set; }
protected TypeId objectTypeId { get; set; } protected TypeId ObjectTypeId { get; set; }
protected CreateObjectBits m_updateFlag; protected CreateObjectBits m_updateFlag;
ObjectGuid m_guid; ObjectGuid m_guid;
@@ -2381,11 +2372,21 @@ namespace Game.Entities
public class MovementInfo 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() public MovementInfo()
{ {
Guid = ObjectGuid.Empty; Guid = ObjectGuid.Empty;
Flags = MovementFlag.None; flags = MovementFlag.None;
Flags2 = MovementFlag2.None; flags2 = MovementFlag2.None;
Time = 0; Time = 0;
Pitch = 0.0f; Pitch = 0.0f;
@@ -2394,17 +2395,17 @@ namespace Game.Entities
jump.Reset(); jump.Reset();
} }
public MovementFlag GetMovementFlags() { return Flags; } public MovementFlag GetMovementFlags() { return flags; }
public void SetMovementFlags(MovementFlag f) { Flags = f; } public void SetMovementFlags(MovementFlag f) { flags = f; }
public void AddMovementFlag(MovementFlag f) { Flags |= f; } public void AddMovementFlag(MovementFlag f) { flags |= f; }
public void RemoveMovementFlag(MovementFlag f) { Flags &= ~f; } public void RemoveMovementFlag(MovementFlag f) { flags &= ~f; }
public bool HasMovementFlag(MovementFlag f) { return Convert.ToBoolean(Flags & f); } public bool HasMovementFlag(MovementFlag f) { return Convert.ToBoolean(flags & f); }
public MovementFlag2 GetMovementFlags2() { return Flags2; } public MovementFlag2 GetMovementFlags2() { return flags2; }
public void SetMovementFlags2(MovementFlag2 f) { Flags2 = f; } public void SetMovementFlags2(MovementFlag2 f) { flags2 = f; }
public void AddMovementFlag2(MovementFlag2 f) { Flags2 |= f; } public void AddMovementFlag2(MovementFlag2 f) { flags2 |= f; }
public void RemoveMovementFlag2(MovementFlag2 f) { Flags2 &= ~f; } public void RemoveMovementFlag2(MovementFlag2 f) { flags2 &= ~f; }
public bool HasMovementFlag2(MovementFlag2 f) { return Convert.ToBoolean(Flags2 & f); } public bool HasMovementFlag2(MovementFlag2 f) { return Convert.ToBoolean(flags2 & f); }
public void SetFallTime(uint time) { jump.fallTime = time; } public void SetFallTime(uint time) { jump.fallTime = time; }
@@ -2418,15 +2419,7 @@ namespace Game.Entities
jump.Reset(); 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 public struct TransportInfo
{ {
+79 -79
View File
@@ -40,13 +40,13 @@ namespace Game.Entities
Cypher.Assert(GetOwner().IsTypeId(TypeId.Player)); Cypher.Assert(GetOwner().IsTypeId(TypeId.Player));
m_unitTypeMask |= UnitTypeMask.Pet; UnitTypeMask |= UnitTypeMask.Pet;
if (type == PetType.Hunter) 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(); InitCharmInfo();
} }
@@ -173,7 +173,7 @@ namespace Game.Entities
PhasingHandler.InheritPhaseShift(this, owner); PhasingHandler.InheritPhaseShift(this, owner);
setPetType(petType); SetPetType(petType);
SetFaction(owner.GetFaction()); SetFaction(owner.GetFaction());
SetCreatedBySpell(summonSpellId); SetCreatedBySpell(summonSpellId);
@@ -203,10 +203,10 @@ namespace Game.Entities
SetNpcFlags2(NPCFlags2.None); SetNpcFlags2(NPCFlags2.None);
SetName(result.Read<string>(8)); SetName(result.Read<string>(8));
switch (getPetType()) switch (GetPetType())
{ {
case PetType.Summon: case PetType.Summon:
petlevel = owner.getLevel(); petlevel = owner.GetLevel();
SetClass(Class.Mage); SetClass(Class.Mage);
SetUnitFlags(UnitFlags.PvpAttackable); // this enables popup window (pet dismiss, cancel) SetUnitFlags(UnitFlags.PvpAttackable); // this enables popup window (pet dismiss, cancel)
@@ -220,7 +220,7 @@ namespace Game.Entities
break; break;
default: default:
if (!IsPetGhoul()) 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; break;
} }
@@ -244,14 +244,14 @@ namespace Game.Entities
SetReactState((ReactStates)result.Read<byte>(6)); SetReactState((ReactStates)result.Read<byte>(6));
SetCanModifyStats(true); 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); SetFullPower(PowerType.Mana);
else else
{ {
uint savedhealth = result.Read<uint>(10); uint savedhealth = result.Read<uint>(10);
uint savedmana = result.Read<uint>(11); uint savedmana = result.Read<uint>(11);
if (savedhealth == 0 && getPetType() == PetType.Hunter) if (savedhealth == 0 && GetPetType() == PetType.Hunter)
setDeathState(DeathState.JustDied); SetDeathState(DeathState.JustDied);
else else
{ {
SetHealth(savedhealth); SetHealth(savedhealth);
@@ -335,7 +335,7 @@ namespace Game.Entities
SetGroupUpdateFlag(GroupUpdatePetFlags.Full); SetGroupUpdateFlag(GroupUpdatePetFlags.Full);
if (getPetType() == PetType.Hunter) if (GetPetType() == PetType.Hunter)
{ {
stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_PET_DECLINED_NAME); stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_PET_DECLINED_NAME);
stmt.AddValue(0, owner.GetGUID().GetCounter()); stmt.AddValue(0, owner.GetGUID().GetCounter());
@@ -353,7 +353,7 @@ namespace Game.Entities
} }
//set last used pet number (for use in BG's) //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); owner.ToPlayer().SetLastPetNumber(petId);
m_loading = false; m_loading = false;
@@ -367,7 +367,7 @@ namespace Game.Entities
return; return;
// save only fully controlled creature // save only fully controlled creature
if (!isControlled()) if (!IsControlled())
return; return;
// not save not player pets // not save not player pets
@@ -383,7 +383,7 @@ namespace Game.Entities
owner.GetTemporaryUnsummonedPetNumber() != GetCharmInfo().GetPetNumber()) owner.GetTemporaryUnsummonedPetNumber() != GetCharmInfo().GetPetNumber())
{ {
// pet will lost anyway at restore temporary unsummoned // pet will lost anyway at restore temporary unsummoned
if (getPetType() == PetType.Hunter) if (GetPetType() == PetType.Hunter)
return; return;
// for warlock case // 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 // 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 = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_PET_BY_SLOT);
stmt.AddValue(0, ownerLowGUID); stmt.AddValue(0, ownerLowGUID);
@@ -442,7 +442,7 @@ namespace Game.Entities
stmt.AddValue(1, GetEntry()); stmt.AddValue(1, GetEntry());
stmt.AddValue(2, ownerLowGUID); stmt.AddValue(2, ownerLowGUID);
stmt.AddValue(3, GetNativeDisplayId()); stmt.AddValue(3, GetNativeDisplayId());
stmt.AddValue(4, getLevel()); stmt.AddValue(4, GetLevel());
stmt.AddValue(5, (uint)m_unitData.PetExperience); stmt.AddValue(5, (uint)m_unitData.PetExperience);
stmt.AddValue(6, GetReactState()); stmt.AddValue(6, GetReactState());
stmt.AddValue(7, mode); stmt.AddValue(7, mode);
@@ -453,7 +453,7 @@ namespace Game.Entities
stmt.AddValue(12, GenerateActionBarData()); stmt.AddValue(12, GenerateActionBarData());
stmt.AddValue(13, Time.UnixTime); stmt.AddValue(13, Time.UnixTime);
stmt.AddValue(14, (uint)m_unitData.CreatedBySpell); stmt.AddValue(14, (uint)m_unitData.CreatedBySpell);
stmt.AddValue(15, getPetType()); stmt.AddValue(15, GetPetType());
stmt.AddValue(16, m_petSpecialization); stmt.AddValue(16, m_petSpecialization);
trans.Append(stmt); trans.Append(stmt);
@@ -502,19 +502,19 @@ namespace Game.Entities
DB.Characters.CommitTransaction(trans); DB.Characters.CommitTransaction(trans);
} }
public override void setDeathState(DeathState s) public override void SetDeathState(DeathState s)
{ {
base.setDeathState(s); base.SetDeathState(s);
if (getDeathState() == DeathState.Corpse) if (GetDeathState() == DeathState.Corpse)
{ {
if (getPetType() == PetType.Hunter) if (GetPetType() == PetType.Hunter)
{ {
// pet corpse non lootable and non skinnable // pet corpse non lootable and non skinnable
SetDynamicFlags(UnitDynFlags.None); SetDynamicFlags(UnitDynFlags.None);
RemoveUnitFlag(UnitFlags.Skinnable); RemoveUnitFlag(UnitFlags.Skinnable);
} }
} }
else if (getDeathState() == DeathState.Alive) else if (GetDeathState() == DeathState.Alive)
{ {
CastPetAuras(true); CastPetAuras(true);
} }
@@ -532,7 +532,7 @@ namespace Game.Entities
{ {
case DeathState.Corpse: 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! Remove(PetSaveMode.NotInSlot); //hunters' pets never get removed because of death, NEVER!
return; return;
@@ -543,18 +543,18 @@ namespace Game.Entities
{ {
// unsummon pet that lost owner // unsummon pet that lost owner
Player owner = GetOwner(); 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); Remove(PetSaveMode.NotInSlot, true);
return; return;
} }
if (isControlled()) if (IsControlled())
{ {
if (owner.GetPetGUID() != GetGUID()) if (owner.GetPetGUID() != GetGUID())
{ {
Log.outError(LogFilter.Pet, "Pet {0} is not pet of owner {1}, removed", GetEntry(), GetOwner().GetName()); 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; return;
} }
} }
@@ -565,7 +565,7 @@ namespace Game.Entities
m_duration -= (int)diff; m_duration -= (int)diff;
else else
{ {
Remove(getPetType() != PetType.Summon ? PetSaveMode.AsDeleted : PetSaveMode.NotInSlot); Remove(GetPetType() != PetType.Summon ? PetSaveMode.AsDeleted : PetSaveMode.NotInSlot);
return; return;
} }
} }
@@ -610,7 +610,7 @@ namespace Game.Entities
public void GivePetXP(uint xp) public void GivePetXP(uint xp)
{ {
if (getPetType() != PetType.Hunter) if (GetPetType() != PetType.Hunter)
return; return;
if (xp < 1) if (xp < 1)
@@ -619,8 +619,8 @@ namespace Game.Entities
if (!IsAlive()) if (!IsAlive())
return; return;
uint maxlevel = Math.Min(WorldConfig.GetUIntValue(WorldCfg.MaxPlayerLevel), GetOwner().getLevel()); uint maxlevel = Math.Min(WorldConfig.GetUIntValue(WorldCfg.MaxPlayerLevel), GetOwner().GetLevel());
uint petlevel = getLevel(); uint petlevel = GetLevel();
// If pet is detected to be at, or above(?) the players level, don't hand out XP // If pet is detected to be at, or above(?) the players level, don't hand out XP
if (petlevel >= maxlevel) if (petlevel >= maxlevel)
@@ -647,10 +647,10 @@ namespace Game.Entities
public void GivePetLevel(int level) public void GivePetLevel(int level)
{ {
if (level == 0 || level == getLevel()) if (level == 0 || level == GetLevel())
return; return;
if (getPetType() == PetType.Hunter) if (GetPetType() == PetType.Hunter)
{ {
SetPetExperience(0); SetPetExperience(0);
SetPetNextLevelExperience((uint)(Global.ObjectMgr.GetXPForLevel((uint)level) * PetXPFactor)); SetPetNextLevelExperience((uint)(Global.ObjectMgr.GetXPForLevel((uint)level) * PetXPFactor));
@@ -714,7 +714,7 @@ namespace Game.Entities
SetPetNameTimestamp(0); SetPetNameTimestamp(0);
SetPetExperience(0); SetPetExperience(0);
SetPetNextLevelExperience((uint)(Global.ObjectMgr.GetXPForLevel(getLevel() + 1) * PetXPFactor)); SetPetNextLevelExperience((uint)(Global.ObjectMgr.GetXPForLevel(GetLevel() + 1) * PetXPFactor));
SetNpcFlags(NPCFlags.None); SetNpcFlags(NPCFlags.None);
SetNpcFlags2(NPCFlags2.None); SetNpcFlags2(NPCFlags2.None);
@@ -751,13 +751,13 @@ namespace Game.Entities
public uint GetCurrentFoodBenefitLevel(uint itemlevel) public uint GetCurrentFoodBenefitLevel(uint itemlevel)
{ {
// -5 or greater food level // -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; return 35000;
// -10..-6 // -10..-6
else if (getLevel() <= itemlevel + 10) //pure guess, but sounds good else if (GetLevel() <= itemlevel + 10) //pure guess, but sounds good
return 17000; return 17000;
// -14..-11 // -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; return 8000;
// -15 or less // -15 or less
else else
@@ -786,7 +786,7 @@ namespace Game.Entities
{ {
do 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()); 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); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId);
if (spellInfo == null) if (spellInfo == null)
@@ -1075,7 +1075,7 @@ namespace Game.Entities
if (newspell.active == ActiveStates.Enabled) if (newspell.active == ActiveStates.Enabled)
ToggleAutocast(oldRankSpellInfo, false); ToggleAutocast(oldRankSpellInfo, false);
unlearnSpell(pair.Key, false, false); UnlearnSpell(pair.Key, false, false);
break; break;
} }
// ignore new lesser rank // ignore new lesser rank
@@ -1098,29 +1098,29 @@ namespace Game.Entities
return true; return true;
} }
public bool learnSpell(uint spell_id) public bool LearnSpell(uint spellId)
{ {
// prevent duplicated entires in spell book // prevent duplicated entires in spell book
if (!addSpell(spell_id)) if (!AddSpell(spellId))
return false; return false;
if (!m_loading) if (!m_loading)
{ {
PetLearnedSpells packet = new PetLearnedSpells(); PetLearnedSpells packet = new PetLearnedSpells();
packet.Spells.Add(spell_id); packet.Spells.Add(spellId);
GetOwner().SendPacket(packet); GetOwner().SendPacket(packet);
GetOwner().PetSpellInitialize(); GetOwner().PetSpellInitialize();
} }
return true; return true;
} }
void learnSpells(List<uint> spellIds) void LearnSpells(List<uint> spellIds)
{ {
PetLearnedSpells packet = new PetLearnedSpells(); PetLearnedSpells packet = new PetLearnedSpells();
foreach (uint spell in spellIds) foreach (uint spell in spellIds)
{ {
if (!addSpell(spell)) if (!AddSpell(spell))
continue; continue;
packet.Spells.Add(spell); packet.Spells.Add(spell);
@@ -1132,7 +1132,7 @@ namespace Game.Entities
void InitLevelupSpellsForLevel() void InitLevelupSpellsForLevel()
{ {
uint level = getLevel(); uint level = GetLevel();
var levelupSpells = GetCreatureTemplate().Family != 0 ? Global.SpellMgr.GetPetLevelupSpellList(GetCreatureTemplate().Family) : null; var levelupSpells = GetCreatureTemplate().Family != 0 ? Global.SpellMgr.GetPetLevelupSpellList(GetCreatureTemplate().Family) : null;
if (levelupSpells != null) if (levelupSpells != null)
{ {
@@ -1141,10 +1141,10 @@ namespace Game.Entities
{ {
// will called first if level down // will called first if level down
if (pair.Key > level) 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 // will called if level up
else 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 // will called first if level down
if (spellInfo.SpellLevel > level) if (spellInfo.SpellLevel > level)
unlearnSpell(spellInfo.Id, true); UnlearnSpell(spellInfo.Id, true);
// will called if level up // will called if level up
else 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) if (!m_loading)
{ {
PetUnlearnedSpells packet = new PetUnlearnedSpells(); PetUnlearnedSpells packet = new PetUnlearnedSpells();
packet.Spells.Add(spell_id); packet.Spells.Add(spellId);
GetOwner().SendPacket(packet); GetOwner().SendPacket(packet);
} }
return true; return true;
@@ -1183,13 +1183,13 @@ namespace Game.Entities
return false; 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(); PetUnlearnedSpells packet = new PetUnlearnedSpells();
foreach (uint spell in spellIds) foreach (uint spell in spellIds)
{ {
if (!removeSpell(spell, learn_prev, clear_ab)) if (!RemoveSpell(spell, learnPrev, clearActionBar))
continue; continue;
packet.Spells.Add(spell); packet.Spells.Add(spell);
@@ -1199,9 +1199,9 @@ namespace Game.Entities
GetOwner().SendPacket(packet); 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) if (petSpell == null)
return false; return false;
@@ -1209,23 +1209,23 @@ namespace Game.Entities
return false; return false;
if (petSpell.state == PetSpellState.New) if (petSpell.state == PetSpellState.New)
m_spells.Remove(spell_id); m_spells.Remove(spellId);
else else
petSpell.state = PetSpellState.Removed; 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) if (prev_id != 0)
learnSpell(prev_id); LearnSpell(prev_id);
else else
learn_prev = false; learnPrev = false;
} }
// if remove last rank or non-ranked then update action bar at server and client if need // 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) if (!m_loading)
{ {
@@ -1313,7 +1313,7 @@ namespace Game.Entities
public bool IsPermanentPetFor(Player owner) public bool IsPermanentPetFor(Player owner)
{ {
switch (getPetType()) switch (GetPetType())
{ {
case PetType.Summon: case PetType.Summon:
switch (owner.GetClass()) switch (owner.GetClass())
@@ -1378,7 +1378,7 @@ namespace Game.Entities
// Passive 01~10, Passive 00 (20782, not used), Ferocious Inspiration (34457) // Passive 01~10, Passive 00 (20782, not used), Ferocious Inspiration (34457)
// Scale 01~03 (34902~34904, bonus from owner, not used) // Scale 01~03 (34902~34904, bonus from owner, not used)
foreach (var petSet in petStore) 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; return false;
} }
void learnSpellHighRank(uint spellid) void LearnSpellHighRank(uint spellid)
{ {
learnSpell(spellid); LearnSpell(spellid);
uint next = Global.SpellMgr.GetNextSpellInChain(spellid); uint next = Global.SpellMgr.GetNextSpellInChain(spellid);
if (next != 0) if (next != 0)
learnSpellHighRank(next); LearnSpellHighRank(next);
} }
public void SynchronizeLevelWithOwner() public void SynchronizeLevelWithOwner()
@@ -1445,12 +1445,12 @@ namespace Game.Entities
if (!owner || !owner.IsTypeId(TypeId.Player)) if (!owner || !owner.IsTypeId(TypeId.Player))
return; return;
switch (getPetType()) switch (GetPetType())
{ {
// always same level // always same level
case PetType.Summon: case PetType.Summon:
case PetType.Hunter: case PetType.Hunter:
GivePetLevel((int)owner.getLevel()); GivePetLevel((int)owner.GetLevel());
break; break;
default: default:
break; break;
@@ -1466,16 +1466,16 @@ namespace Game.Entities
{ {
base.SetDisplayId(modelId, displayScale); base.SetDisplayId(modelId, displayScale);
if (!isControlled()) if (!IsControlled())
return; return;
SetGroupUpdateFlag(GroupUpdatePetFlags.ModelId); SetGroupUpdateFlag(GroupUpdatePetFlags.ModelId);
} }
public PetType getPetType() { return m_petType; } public PetType GetPetType() { return m_petType; }
public void setPetType(PetType type) { m_petType = type; } public void SetPetType(PetType type) { m_petType = type; }
public bool isControlled() { return getPetType() == PetType.Summon || getPetType() == PetType.Hunter; } public bool IsControlled() { return GetPetType() == PetType.Summon || GetPetType() == PetType.Hunter; }
public bool isTemporarySummoned() { return m_duration > 0; } public bool IsTemporarySummoned() { return m_duration > 0; }
public override bool IsLoading() { return m_loading; } public override bool IsLoading() { return m_loading; }
@@ -1522,14 +1522,14 @@ namespace Game.Entities
foreach (var specSpell in specSpells) foreach (var specSpell in specSpells)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(specSpell.SpellID); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(specSpell.SpellID);
if (spellInfo == null || spellInfo.SpellLevel > getLevel()) if (spellInfo == null || spellInfo.SpellLevel > GetLevel())
continue; continue;
learnedSpells.Add(specSpell.SpellID); learnedSpells.Add(specSpell.SpellID);
} }
} }
learnSpells(learnedSpells); LearnSpells(learnedSpells);
} }
void RemoveSpecializationSpells(bool clearActionBar) void RemoveSpecializationSpells(bool clearActionBar)
@@ -1561,7 +1561,7 @@ namespace Game.Entities
} }
} }
unlearnSpells(unlearnedSpells, true, clearActionBar); UnlearnSpells(unlearnedSpells, true, clearActionBar);
} }
public void SetSpecialization(uint spec) public void SetSpecialization(uint spec)
+12 -12
View File
@@ -25,6 +25,17 @@ namespace Game.Entities
{ {
public class CinematicManager : IDisposable 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) public CinematicManager(Player playerref)
{ {
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); m_CinematicObject = player.SummonCreature(1, pos.posX, pos.posY, pos.posZ, 0.0f, TempSummonType.TimedDespawn, 5 * Time.Minute * Time.InMilliseconds);
if (m_CinematicObject) if (m_CinematicObject)
{ {
m_CinematicObject.setActive(true); m_CinematicObject.SetActive(true);
player.SetViewpoint(m_CinematicObject, true); player.SetViewpoint(m_CinematicObject, true);
} }
@@ -177,16 +188,5 @@ namespace Game.Entities
uint GetActiveCinematicCamera() { return m_activeCinematicCameraId; } uint GetActiveCinematicCamera() { return m_activeCinematicCameraId; }
public void SetActiveCinematicCamera(uint cinematicCameraId = 0) { m_activeCinematicCameraId = cinematicCameraId; } public void SetActiveCinematicCamera(uint cinematicCameraId = 0) { m_activeCinematicCameraId = cinematicCameraId; }
public bool IsOnCinematic() { return (m_cinematicCamera != null); } 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;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Collections;
namespace Game.Entities namespace Game.Entities
{ {
public class CollectionMgr 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() public static void LoadMountDefinitions()
{ {
uint oldMSTime = Time.GetMSTime(); uint oldMSTime = Time.GetMSTime();
@@ -64,7 +75,7 @@ namespace Game.Entities
public CollectionMgr(WorldSession owner) public CollectionMgr(WorldSession owner)
{ {
_owner = owner; _owner = owner;
_appearances = new System.Collections.BitSet(0); _appearances = new BitSet(0);
} }
public void LoadToys() public void LoadToys()
@@ -483,7 +494,7 @@ namespace Game.Entities
} while (knownAppearances.NextRow()); } while (knownAppearances.NextRow());
_appearances = new System.Collections.BitSet(blocks); _appearances = new BitSet(blocks);
} }
if (!favoriteAppearances.IsEmpty()) if (!favoriteAppearances.IsEmpty())
@@ -664,7 +675,7 @@ namespace Game.Entities
return false; return false;
} }
if (itemTemplate.GetInventoryType() != InventoryType.Cloak) 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; return false;
break; break;
} }
@@ -857,17 +868,6 @@ namespace Game.Entities
public Dictionary<uint, ToyFlags> GetAccountToys() { return _toys; } public Dictionary<uint, ToyFlags> GetAccountToys() { return _toys; }
public Dictionary<uint, HeirloomData> GetAccountHeirlooms() { return _heirlooms; } public Dictionary<uint, HeirloomData> GetAccountHeirlooms() { return _heirlooms; }
public Dictionary<uint, MountStatusFlags> GetAccountMounts() { return _mounts; } 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 enum FavoriteAppearanceState
@@ -879,13 +879,13 @@ namespace Game.Entities
public class HeirloomData public class HeirloomData
{ {
public HeirloomPlayerFlags flags;
public uint bonusId;
public HeirloomData(HeirloomPlayerFlags _flags = 0, uint _bonusId = 0) public HeirloomData(HeirloomPlayerFlags _flags = 0, uint _bonusId = 0)
{ {
flags = _flags; flags = _flags;
bonusId = _bonusId; bonusId = _bonusId;
} }
public HeirloomPlayerFlags flags;
public uint bonusId;
} }
} }
+18 -18
View File
@@ -26,6 +26,19 @@ namespace Game.Entities
{ {
public class KillRewarder 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) public KillRewarder(Player killer, Unit victim, bool isBattleground)
{ {
_killer = killer; _killer = killer;
@@ -106,7 +119,7 @@ namespace Game.Entities
{ {
if (_killer == member || (member.IsAtGroupRewardDistance(_victim) && member.IsAlive())) 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; // 2.1. _count - number of alive group members within reward distance;
++_count; ++_count;
// 2.2. _sumLevel - sum of levels of alive group members within reward distance; // 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, // 2.4. _maxNotGrayMember - maximum level of alive group member within reward distance,
// for whom victim is not gray; // for whom victim is not gray;
uint grayLevel = Formulas.GetGrayLevel(lvl); 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; _maxNotGrayMember = member;
} }
} }
} }
// 2.5. _isFullXP - flag identifying that for all group members victim is not gray, // 2.5. _isFullXP - flag identifying that for all group members victim is not gray,
// so 100% XP will be rewarded (50% otherwise). // so 100% XP will be rewarded (50% otherwise).
_isFullXP = _maxNotGrayMember && (_maxLevel == _maxNotGrayMember.getLevel()); _isFullXP = _maxNotGrayMember && (_maxLevel == _maxNotGrayMember.GetLevel());
} }
else else
_count = 1; _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; // * set to 0 if player's level is more than maximum level of not gray member;
// * cut XP in half if _isFullXP is false. // * cut XP in half if _isFullXP is false.
if (_maxNotGrayMember != null && player.IsAlive() && if (_maxNotGrayMember != null && player.IsAlive() &&
_maxNotGrayMember.getLevel() >= player.getLevel()) _maxNotGrayMember.GetLevel() >= player.GetLevel())
xp = _isFullXP ? xp = _isFullXP ?
(uint)(xp * rate) : // Reward FULL XP if all group members are not gray. (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. (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. // Give reputation and kill credit only in PvE.
if (!_isPvP || _isBattleground) if (!_isPvP || _isBattleground)
{ {
float rate = _group ? _groupRate * player.getLevel() / _sumLevel : 1.0f; float rate = _group ? _groupRate * player.GetLevel() / _sumLevel : 1.0f;
if (_xp != 0) if (_xp != 0)
// 4.2. Give XP. // 4.2. Give XP.
_RewardXP(player, rate); _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) float GetRatingMultiplier(CombatRating cr)
{ {
GtCombatRatingsRecord Rating = CliDB.CombatRatingsGameTable.GetRow(getLevel()); GtCombatRatingsRecord Rating = CliDB.CombatRatingsGameTable.GetRow(GetLevel());
if (Rating == null) if (Rating == null)
return 1.0f; return 1.0f;
+5 -5
View File
@@ -813,7 +813,7 @@ namespace Game.Entities
{ {
ItemTemplate rewardProto = Global.ObjectMgr.GetItemTemplate(questPackageItem.ItemID); ItemTemplate rewardProto = Global.ObjectMgr.GetItemTemplate(questPackageItem.ItemID);
if (rewardProto != null) if (rewardProto != null)
if (rewardProto.ItemSpecClassMask.HasAnyFlag(getClassMask())) if (rewardProto.ItemSpecClassMask.HasAnyFlag(GetClassMask()))
GetSession().GetCollectionMgr().AddItemAppearance(questPackageItem.ItemID); GetSession().GetCollectionMgr().AddItemAppearance(questPackageItem.ItemID);
} }
} }
@@ -2085,7 +2085,7 @@ namespace Game.Entities
void _SaveStats(SQLTransaction trans) void _SaveStats(SQLTransaction trans)
{ {
// check if stat saving is enabled and if char level is high enough // 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; return;
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_STATS); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_STATS);
@@ -2886,7 +2886,7 @@ namespace Game.Entities
InitTalentForLevel(); InitTalentForLevel();
LearnDefaultSkills(); LearnDefaultSkills();
LearnCustomSpells(); LearnCustomSpells();
if (getLevel() < PlayerConst.LevelMinHonor) if (GetLevel() < PlayerConst.LevelMinHonor)
ResetPvpTalents(); ResetPvpTalents();
// must be before inventory (some items required reputation check) // 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)GetRace());
stmt.AddValue(index++, (byte)GetClass()); 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++, (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++, (uint)m_activePlayerData.XP);
stmt.AddValue(index++, GetMoney()); stmt.AddValue(index++, GetMoney());
stmt.AddValue(index++, (byte)m_playerData.SkinID); stmt.AddValue(index++, (byte)m_playerData.SkinID);
@@ -3238,7 +3238,7 @@ namespace Game.Entities
stmt.AddValue(index++, (byte)GetRace()); stmt.AddValue(index++, (byte)GetRace());
stmt.AddValue(index++, (byte)GetClass()); 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++, (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++, (uint)m_activePlayerData.XP);
stmt.AddValue(index++, GetMoney()); stmt.AddValue(index++, GetMoney());
stmt.AddValue(index++, (byte)m_playerData.SkinID); stmt.AddValue(index++, (byte)m_playerData.SkinID);
+1 -1
View File
@@ -212,7 +212,7 @@ namespace Game.Entities
PlayerExtraFlags m_ExtraFlags; PlayerExtraFlags m_ExtraFlags;
public bool isDebugAreaTriggers { get; set; } public bool IsDebugAreaTriggers { get; set; }
uint m_zoneUpdateId; uint m_zoneUpdateId;
uint m_areaUpdateId; uint m_areaUpdateId;
uint m_zoneUpdateTimer; uint m_zoneUpdateTimer;
+4 -4
View File
@@ -49,7 +49,7 @@ namespace Game.Entities
return nearMembers[randTarget]; return nearMembers[randTarget];
} }
public PartyResult CanUninviteFromGroup(ObjectGuid guidMember = default(ObjectGuid)) public PartyResult CanUninviteFromGroup(ObjectGuid guidMember = default)
{ {
Group grp = GetGroup(); Group grp = GetGroup();
if (!grp) if (!grp)
@@ -99,12 +99,12 @@ namespace Game.Entities
return PartyResult.Ok; return PartyResult.Ok;
} }
public bool isUsingLfg() public bool IsUsingLfg()
{ {
return Global.LFGMgr.GetState(GetGUID()) != LfgState.None; return Global.LFGMgr.GetState(GetGUID()) != LfgState.None;
} }
bool inRandomLfgDungeon() bool InRandomLfgDungeon()
{ {
if (Global.LFGMgr.selectedRandomLfgDungeon(GetGUID())) if (Global.LFGMgr.selectedRandomLfgDungeon(GetGUID()))
{ {
@@ -263,7 +263,7 @@ namespace Game.Entities
} }
public void RemoveFromGroup(RemoveMethod method = RemoveMethod.Default) { RemoveFromGroup(GetGroup(), GetGUID(), method); } 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) if (!group)
return; return;
+22 -22
View File
@@ -1284,7 +1284,7 @@ namespace Game.Entities
item = StoreItem(pos, item, update); item = StoreItem(pos, item, update);
item.SetFixedLevel(getLevel()); item.SetFixedLevel(GetLevel());
item.SetItemRandomBonusList(randomPropertyId); item.SetItemRandomBonusList(randomPropertyId);
if (allowedLooters != null && allowedLooters.Count > 1 && item.GetTemplate().GetMaxStackSize() == 1 && item.IsSoulBound()) if (allowedLooters != null && allowedLooters.Count > 1 && item.GetTemplate().GetMaxStackSize() == 1 && item.IsSoulBound())
@@ -1412,7 +1412,7 @@ namespace Game.Entities
if (pItem.IsBindedNotWith(this)) if (pItem.IsBindedNotWith(this))
return InventoryResult.NotOwner; return InventoryResult.NotOwner;
if (getLevel() < pItem.GetRequiredLevel()) if (GetLevel() < pItem.GetRequiredLevel())
return InventoryResult.CantEquipLevelI; return InventoryResult.CantEquipLevelI;
InventoryResult res = CanUseItem(pProto); InventoryResult res = CanUseItem(pProto);
@@ -1468,7 +1468,7 @@ namespace Game.Entities
if (Convert.ToBoolean(proto.GetFlags2() & ItemFlags2.FactionAlliance) && GetTeam() != Team.Alliance) if (Convert.ToBoolean(proto.GetFlags2() & ItemFlags2.FactionAlliance) && GetTeam() != Team.Alliance)
return InventoryResult.CantEquipEver; 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; return InventoryResult.CantEquipEver;
if (proto.GetRequiredSkill() != 0) if (proto.GetRequiredSkill() != 0)
@@ -1482,7 +1482,7 @@ namespace Game.Entities
if (proto.GetRequiredSpell() != 0 && !HasSpell(proto.GetRequiredSpell())) if (proto.GetRequiredSpell() != 0 && !HasSpell(proto.GetRequiredSpell()))
return InventoryResult.ProficiencyNeeded; return InventoryResult.ProficiencyNeeded;
if (getLevel() < proto.GetBaseRequiredLevel()) if (GetLevel() < proto.GetBaseRequiredLevel())
return InventoryResult.CantEquipLevelI; return InventoryResult.CantEquipLevelI;
// If World Event is not active, prevent using event dependant items // If World Event is not active, prevent using event dependant items
@@ -3321,7 +3321,7 @@ namespace Game.Entities
return InventoryResult.ItemNotFound; return InventoryResult.ItemNotFound;
// Used by group, function GroupLoot, to know if a prototype can be used by a player // 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; return InventoryResult.CantEquipEver;
if (proto.GetRequiredSpell() != 0 && !HasSpell(proto.GetRequiredSpell())) 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 (_class == Class.Warrior || _class == Class.Paladin || _class == Class.Deathknight)
{ {
if (getLevel() < 40) if (GetLevel() < 40)
{ {
if (proto.GetSubClass() != (uint)ItemSubClassArmor.Mail) if (proto.GetSubClass() != (uint)ItemSubClassArmor.Mail)
return InventoryResult.ClientLockedOut; return InventoryResult.ClientLockedOut;
@@ -3354,7 +3354,7 @@ namespace Game.Entities
} }
else if (_class == Class.Hunter || _class == Class.Shaman) else if (_class == Class.Hunter || _class == Class.Shaman)
{ {
if (getLevel() < 40) if (GetLevel() < 40)
{ {
if (proto.GetSubClass() != (uint)ItemSubClassArmor.Leather) if (proto.GetSubClass() != (uint)ItemSubClassArmor.Leather)
return InventoryResult.ClientLockedOut; return InventoryResult.ClientLockedOut;
@@ -3605,7 +3605,7 @@ namespace Game.Entities
return false; 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); SendBuyError(BuyResult.CantFindItem, null, item);
return false; return false;
@@ -4251,7 +4251,7 @@ namespace Game.Entities
if (spellproto == null) if (spellproto == null)
continue; 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) && Global.DB2Mgr.GetHeirloomByItemId(item.GetEntry()) != null)
continue; continue;
@@ -4520,7 +4520,7 @@ namespace Game.Entities
need_space = count; need_space = count;
ItemPosCount newPosition = new ItemPosCount((ushort)(InventorySlots.Bag0 << 8 | j), need_space); ItemPosCount newPosition = new ItemPosCount((ushort)(InventorySlots.Bag0 << 8 | j), need_space);
if (!newPosition.isContainedIn(dest)) if (!newPosition.IsContainedIn(dest))
{ {
dest.Add(newPosition); dest.Add(newPosition);
count -= need_space; count -= need_space;
@@ -4598,7 +4598,7 @@ namespace Game.Entities
need_space = count; need_space = count;
ItemPosCount newPosition = new ItemPosCount((ushort)(bag << 8 | slot), need_space); ItemPosCount newPosition = new ItemPosCount((ushort)(bag << 8 | slot), need_space);
if (!newPosition.isContainedIn(dest)) if (!newPosition.IsContainedIn(dest))
{ {
dest.Add(newPosition); dest.Add(newPosition);
count -= need_space; count -= need_space;
@@ -4938,7 +4938,7 @@ namespace Game.Entities
need_space = count; need_space = count;
ItemPosCount newPosition = new ItemPosCount((ushort)(bag << 8 | j), need_space); ItemPosCount newPosition = new ItemPosCount((ushort)(bag << 8 | j), need_space);
if (!newPosition.isContainedIn(dest)) if (!newPosition.IsContainedIn(dest))
{ {
dest.Add(newPosition); dest.Add(newPosition);
count -= need_space; count -= need_space;
@@ -5151,7 +5151,7 @@ namespace Game.Entities
ScalingStatDistributionRecord ssd = CliDB.ScalingStatDistributionStorage.LookupByKey(pItem.GetScalingStatDistribution()); 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) // 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; return InventoryResult.NotEquippable;
byte eslot = FindEquipSlot(pProto, slot, swap); 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 store the level of our player in the gold field
// We retrieve this information at Player.SendLoot() // We retrieve this information at Player.SendLoot()
bones.loot.gold = getLevel(); bones.loot.gold = GetLevel();
bones.lootRecipient = looterPlr; bones.lootRecipient = looterPlr;
looterPlr.SendLoot(bones.GetGUID(), LootType.Insignia); 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) // 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 // 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()) 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); SendLootRelease(guid);
return; return;
@@ -6235,10 +6235,10 @@ namespace Game.Entities
// loot was generated and respawntime has passed since then, allow to recreate loot // loot was generated and respawntime has passed since then, allow to recreate loot
// to avoid bugs, this rule covers spawned gameobjects only // 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); go.SetLootState(LootState.Ready);
if (go.getLootState() == LootState.Ready) if (go.GetLootState() == LootState.Ready)
{ {
uint lootid = go.GetGoInfo().GetLootId(); uint lootid = go.GetGoInfo().GetLootId();
Battleground bg = GetBattleground(); Battleground bg = GetBattleground();
@@ -6278,9 +6278,9 @@ namespace Game.Entities
} }
if (loot_type == LootType.Fishing) if (loot_type == LootType.Fishing)
go.getFishLoot(loot, this); go.GetFishLoot(loot, this);
else if (loot_type == LootType.FishingJunk) 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) if (go.GetGoInfo().type == GameObjectTypes.Chest && go.GetGoInfo().Chest.usegrouplootrules != 0)
{ {
@@ -6305,7 +6305,7 @@ namespace Game.Entities
go.SetLootState(LootState.Activated, this); go.SetLootState(LootState.Activated, this);
} }
if (go.getLootState() == LootState.Activated) if (go.GetLootState() == LootState.Activated)
{ {
Group group = GetGroup(); Group group = GetGroup();
if (group) if (group)
@@ -6442,8 +6442,8 @@ namespace Game.Entities
loot.FillLoot(lootid, LootStorage.Pickpocketing, this, true); loot.FillLoot(lootid, LootStorage.Pickpocketing, this, true);
// Generate extra money for pick pocket loot // Generate extra money for pick pocket loot
uint a = RandomHelper.URand(0, creature.getLevel() / 2); uint a = RandomHelper.URand(0, creature.GetLevel() / 2);
uint b = RandomHelper.URand(0, getLevel() / 2); uint b = RandomHelper.URand(0, GetLevel() / 2);
loot.gold = (uint)(10 * (a + b) * WorldConfig.GetFloatValue(WorldCfg.RateDropMoney)); loot.gold = (uint)(10 * (a + b) * WorldConfig.GetFloatValue(WorldCfg.RateDropMoney));
permission = PermissionTypes.Owner; permission = PermissionTypes.Owner;
} }
+2 -2
View File
@@ -456,9 +456,9 @@ namespace Game.Entities
if (!WorldConfig.GetBoolValue(WorldCfg.InstanceIgnoreLevel)) if (!WorldConfig.GetBoolValue(WorldCfg.InstanceIgnoreLevel))
{ {
if (ar.levelMin != 0 && getLevel() < ar.levelMin) if (ar.levelMin != 0 && GetLevel() < ar.levelMin)
LevelMin = ar.levelMin; LevelMin = ar.levelMin;
if (ar.levelMax != 0 && getLevel() > ar.levelMax) if (ar.levelMax != 0 && GetLevel() > ar.levelMax)
LevelMax = ar.levelMax; LevelMax = ar.levelMax;
} }
+7 -7
View File
@@ -103,7 +103,7 @@ namespace Game.Entities
if (GetTeam() == plrVictim.GetTeam() && !Global.WorldMgr.IsFFAPvPRealm()) if (GetTeam() == plrVictim.GetTeam() && !Global.WorldMgr.IsFFAPvPRealm())
return false; return false;
byte k_level = (byte)getLevel(); byte k_level = (byte)GetLevel();
byte k_grey = (byte)Formulas.GetGrayLevel(k_level); byte k_grey = (byte)Formulas.GetGrayLevel(k_level);
byte v_level = (byte)victim.GetLevelForTarget(this); byte v_level = (byte)victim.GetLevelForTarget(this);
@@ -263,7 +263,7 @@ namespace Game.Entities
uint newHonorXP = currentHonorXP + xp; uint newHonorXP = currentHonorXP + xp;
uint honorLevel = GetHonorLevel(); uint honorLevel = GetHonorLevel();
if (xp < 1 || getLevel() < PlayerConst.LevelMinHonor || IsMaxHonorLevel()) if (xp < 1 || GetLevel() < PlayerConst.LevelMinHonor || IsMaxHonorLevel())
return; return;
while (newHonorXP >= nextHonorLevelXP) while (newHonorXP >= nextHonorLevelXP)
@@ -340,10 +340,10 @@ namespace Game.Entities
if (talentInfo.SpecID != GetPrimarySpecialization()) if (talentInfo.SpecID != GetPrimarySpecialization())
return TalentLearnResult.FailedUnknown; return TalentLearnResult.FailedUnknown;
if (talentInfo.LevelRequired > getLevel()) if (talentInfo.LevelRequired > GetLevel())
return TalentLearnResult.FailedUnknown; return TalentLearnResult.FailedUnknown;
if (Global.DB2Mgr.GetRequiredLevelForPvpTalentSlot(slot, GetClass()) > getLevel()) if (Global.DB2Mgr.GetRequiredLevelForPvpTalentSlot(slot, GetClass()) > GetLevel())
return TalentLearnResult.FailedUnknown; return TalentLearnResult.FailedUnknown;
PvpTalentCategoryRecord talentCategory = CliDB.PvpTalentCategoryStorage.LookupByKey(talentInfo.PvpTalentCategoryID); 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 // 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 // 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 !HasAura(BattlegroundConst.SpellRecentlyDroppedFlag) && // Still has recently held flag debuff
IsAlive()); // Alive IsAlive()); // Alive
} }
@@ -669,7 +669,7 @@ namespace Game.Entities
public void SetBattlegroundEntryPoint() public void SetBattlegroundEntryPoint()
{ {
// Taxi path store // Taxi path store
if (!m_taxi.empty()) if (!m_taxi.Empty())
{ {
m_bgData.mountSpell = 0; m_bgData.mountSpell = 0;
m_bgData.taxiPath[0] = m_taxi.GetTaxiSource(); m_bgData.taxiPath[0] = m_taxi.GetTaxiSource();
@@ -830,7 +830,7 @@ namespace Game.Entities
return false; return false;
// limit check leel to dbc compatible level range // limit check leel to dbc compatible level range
uint level = getLevel(); uint level = GetLevel();
if (level > WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel)) if (level > WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel))
level = WorldConfig.GetUIntValue(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); } void AddTimedQuest(uint questId) { m_timedquests.Add(questId); }
public void RemoveTimedQuest(uint questId) { m_timedquests.Remove(questId); } public void RemoveTimedQuest(uint questId) { m_timedquests.Remove(questId); }
public List<uint> getRewardedQuests() { return m_RewardedQuests; } public List<uint> GetRewardedQuests() { return m_RewardedQuests; }
Dictionary<uint, QuestStatusData> getQuestStatusMap() { return m_QuestStatus; } Dictionary<uint, QuestStatusData> GetQuestStatusMap() { return m_QuestStatus; }
public int GetQuestMinLevel(Quest quest) public int GetQuestMinLevel(Quest quest)
{ {
@@ -65,7 +65,7 @@ namespace Game.Entities
{ {
int minLevel = GetQuestMinLevel(quest); int minLevel = GetQuestMinLevel(quest);
int maxLevel = quest.MaxScalingLevel; int maxLevel = quest.MaxScalingLevel;
int level = (int)getLevel(); int level = (int)GetLevel();
if (level >= minLevel) if (level >= minLevel)
return Math.Min(level, maxLevel); return Math.Min(level, maxLevel);
return minLevel; return minLevel;
@@ -325,7 +325,7 @@ namespace Game.Entities
// @todo verify if check for !quest.IsDaily() is really correct (possibly not) // @todo verify if check for !quest.IsDaily() is really correct (possibly not)
else else
{ {
if (!source.hasQuest(questId) && !source.hasInvolvedQuest(questId)) if (!source.HasQuest(questId) && !source.HasInvolvedQuest(questId))
{ {
PlayerTalkClass.SendCloseGossip(); PlayerTalkClass.SendCloseGossip();
return; return;
@@ -410,7 +410,7 @@ namespace Game.Entities
SatisfyQuestPrevChain(quest, false) && SatisfyQuestDay(quest, false) && SatisfyQuestWeek(quest, false) && SatisfyQuestPrevChain(quest, false) && SatisfyQuestDay(quest, false) && SatisfyQuestWeek(quest, false) &&
SatisfyQuestMonth(quest, false) && SatisfyQuestSeasonal(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; return false;
@@ -778,7 +778,7 @@ namespace Game.Entities
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(quest.SourceSpellID); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(quest.SourceSpellID);
Unit caster = this; 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(); Unit unit = questGiver.ToUnit();
if (unit != null) if (unit != null)
@@ -867,7 +867,7 @@ namespace Game.Entities
case QuestPackageFilter.LootSpecialization: case QuestPackageFilter.LootSpecialization:
return rewardProto.IsUsableByLootSpecialization(this, true); return rewardProto.IsUsableByLootSpecialization(this, true);
case QuestPackageFilter.Class: case QuestPackageFilter.Class:
return rewardProto.ItemSpecClassMask == 0 || (rewardProto.ItemSpecClassMask & getClassMask()) != 0; return rewardProto.ItemSpecClassMask == 0 || (rewardProto.ItemSpecClassMask & GetClassMask()) != 0;
case QuestPackageFilter.Everyone: case QuestPackageFilter.Everyone:
return true; return true;
default: default:
@@ -1017,7 +1017,7 @@ namespace Game.Entities
uint XP = GetQuestXPReward(quest); uint XP = GetQuestXPReward(quest);
int moneyRew = 0; int moneyRew = 0;
if (getLevel() < WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel)) if (GetLevel() < WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel))
GiveXP(XP, null); GiveXP(XP, null);
else else
moneyRew = (int)(quest.GetRewMoneyMaxLevel() * WorldConfig.GetFloatValue(WorldCfg.RateDropMoney)); moneyRew = (int)(quest.GetRewMoneyMaxLevel() * WorldConfig.GetFloatValue(WorldCfg.RateDropMoney));
@@ -1033,7 +1033,7 @@ namespace Game.Entities
} }
// honor reward // honor reward
uint honor = quest.CalculateHonorGain(getLevel()); uint honor = quest.CalculateHonorGain(GetLevel());
if (honor != 0) if (honor != 0)
RewardHonor(null, 0, (int)honor); RewardHonor(null, 0, (int)honor);
@@ -1091,7 +1091,7 @@ namespace Game.Entities
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(quest.RewardSpell); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(quest.RewardSpell);
Unit caster = this; 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(); Unit unit = questGiver.ToUnit();
if (unit != null) if (unit != null)
@@ -1108,7 +1108,7 @@ namespace Game.Entities
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(quest.RewardDisplaySpell[i]); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(quest.RewardDisplaySpell[i]);
Unit caster = this; 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(); Unit unit = questGiver.ToUnit();
if (unit != null) if (unit != null)
@@ -1263,7 +1263,7 @@ namespace Game.Entities
public bool SatisfyQuestLevel(Quest qInfo, bool msg) public bool SatisfyQuestLevel(Quest qInfo, bool msg)
{ {
if (getLevel() < GetQuestMinLevel(qInfo)) if (GetLevel() < GetQuestMinLevel(qInfo))
{ {
if (msg) if (msg)
{ {
@@ -1273,7 +1273,7 @@ namespace Game.Entities
return false; return false;
} }
if (qInfo.MaxLevel > 0 && getLevel() > qInfo.MaxLevel) if (qInfo.MaxLevel > 0 && GetLevel() > qInfo.MaxLevel)
{ {
if (msg) if (msg)
{ {
@@ -1392,7 +1392,7 @@ namespace Game.Entities
if (reqClass == 0) if (reqClass == 0)
return true; return true;
if ((reqClass & getClassMask()) == 0) if ((reqClass & GetClassMask()) == 0)
{ {
if (msg) if (msg)
{ {
@@ -1412,7 +1412,7 @@ namespace Game.Entities
if (reqraces == -1) if (reqraces == -1)
return true; return true;
if ((reqraces & (long)getRaceMask()) == 0) if ((reqraces & (long)GetRaceMask()) == 0)
{ {
if (msg) if (msg)
{ {
@@ -1909,7 +1909,7 @@ namespace Game.Entities
{ {
if (SatisfyQuestLevel(quest, false)) if (SatisfyQuestLevel(quest, false))
{ {
if (getLevel() <= (GetQuestLevel(quest) + WorldConfig.GetIntValue(WorldCfg.QuestLowLevelHideDiff))) if (GetLevel() <= (GetQuestLevel(quest) + WorldConfig.GetIntValue(WorldCfg.QuestLowLevelHideDiff)))
{ {
if (quest.IsDaily()) if (quest.IsDaily())
result2 = QuestGiverStatus.AvailableRep; result2 = QuestGiverStatus.AvailableRep;
@@ -2189,7 +2189,7 @@ namespace Game.Entities
KilledMonsterCredit(cInfo.KillCredit[i]); KilledMonsterCredit(cInfo.KillCredit[i]);
} }
public void KilledMonsterCredit(uint entry, ObjectGuid guid = default(ObjectGuid)) public void KilledMonsterCredit(uint entry, ObjectGuid guid = default)
{ {
ushort addKillCount = 1; ushort addKillCount = 1;
uint real_entry = entry; 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; ushort addCastCount = 1;
for (byte i = 0; i < SharedConst.MaxQuestLogSize; ++i) for (byte i = 0; i < SharedConst.MaxQuestLogSize; ++i)
@@ -2747,7 +2747,7 @@ namespace Game.Entities
uint moneyReward; uint moneyReward;
if (getLevel() < WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel)) if (GetLevel() < WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel))
{ {
moneyReward = GetQuestMoneyReward(quest); moneyReward = GetQuestMoneyReward(quest);
} }
+18 -18
View File
@@ -342,7 +342,7 @@ namespace Game.Entities
{ {
SpecializationSpellsRecord specSpell = specSpells[j]; SpecializationSpellsRecord specSpell = specSpells[j];
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(specSpell.SpellID); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(specSpell.SpellID);
if (spellInfo == null || spellInfo.SpellLevel > getLevel()) if (spellInfo == null || spellInfo.SpellLevel > GetLevel())
continue; continue;
LearnSpell(specSpell.SpellID, false); LearnSpell(specSpell.SpellID, false);
@@ -568,7 +568,7 @@ namespace Game.Entities
if (!ignore_condition && pEnchant.ConditionID != 0 && !EnchantmentFitsRequirements(pEnchant.ConditionID, -1)) if (!ignore_condition && pEnchant.ConditionID != 0 && !EnchantmentFitsRequirements(pEnchant.ConditionID, -1))
return; return;
if (pEnchant.MinLevel > getLevel()) if (pEnchant.MinLevel > GetLevel())
return; return;
if (pEnchant.RequiredSkillID > 0 && pEnchant.RequiredSkillRank > GetSkillValue((SkillType)pEnchant.RequiredSkillID)) if (pEnchant.RequiredSkillID > 0 && pEnchant.RequiredSkillRank > GetSkillValue((SkillType)pEnchant.RequiredSkillID))
@@ -640,12 +640,12 @@ namespace Game.Entities
scalingClass = pEnchant.ScalingClassRestricted; scalingClass = pEnchant.ScalingClassRestricted;
uint minLevel = ((uint)(pEnchant.Flags)).HasAnyFlag(0x20u) ? 1 : 60u; 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); byte maxLevel = (byte)(pEnchant.MaxLevel != 0 ? pEnchant.MaxLevel : CliDB.SpellScalingGameTable.GetTableRowCount() - 1);
if (minLevel > getLevel()) if (minLevel > GetLevel())
scalingLevel = minLevel; scalingLevel = minLevel;
else if (maxLevel < getLevel()) else if (maxLevel < GetLevel())
scalingLevel = maxLevel; scalingLevel = maxLevel;
GtSpellScalingRecord spellScaling = CliDB.SpellScalingGameTable.GetRow(scalingLevel); GtSpellScalingRecord spellScaling = CliDB.SpellScalingGameTable.GetRow(scalingLevel);
@@ -665,12 +665,12 @@ namespace Game.Entities
scalingClass = pEnchant.ScalingClassRestricted; scalingClass = pEnchant.ScalingClassRestricted;
uint minLevel = ((uint)(pEnchant.Flags)).HasAnyFlag(0x20u) ? 1 : 60u; 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); byte maxLevel = (byte)(pEnchant.MaxLevel != 0 ? pEnchant.MaxLevel : CliDB.SpellScalingGameTable.GetTableRowCount() - 1);
if (minLevel > getLevel()) if (minLevel > GetLevel())
scalingLevel = minLevel; scalingLevel = minLevel;
else if (maxLevel < getLevel()) else if (maxLevel < GetLevel())
scalingLevel = maxLevel; scalingLevel = maxLevel;
GtSpellScalingRecord spellScaling = CliDB.SpellScalingGameTable.GetRow(scalingLevel); GtSpellScalingRecord spellScaling = CliDB.SpellScalingGameTable.GetRow(scalingLevel);
@@ -911,7 +911,7 @@ namespace Game.Entities
WorldObject target = GetViewpoint(); WorldObject target = GetViewpoint();
if (target) if (target)
{ {
if (target.isTypeMask(TypeMask.Unit)) if (target.IsTypeMask(TypeMask.Unit))
{ {
((Unit)target).RemoveAurasByType(AuraType.BindSight, GetGUID()); ((Unit)target).RemoveAurasByType(AuraType.BindSight, GetGUID());
((Unit)target).RemoveAurasByType(AuraType.ModPossess, GetGUID()); ((Unit)target).RemoveAurasByType(AuraType.ModPossess, GetGUID());
@@ -1610,8 +1610,8 @@ namespace Game.Entities
void LearnSkillRewardedSpells(uint skillId, uint skillValue) void LearnSkillRewardedSpells(uint skillId, uint skillValue)
{ {
ulong raceMask = getRaceMask(); ulong raceMask = GetRaceMask();
uint classMask = getClassMask(); uint classMask = GetClassMask();
List<SkillLineAbilityRecord> skillLineAbilities = Global.DB2Mgr.GetSkillLineAbilitiesBySkill(skillId); List<SkillLineAbilityRecord> skillLineAbilities = Global.DB2Mgr.GetSkillLineAbilitiesBySkill(skillId);
foreach (var ability in skillLineAbilities) foreach (var ability in skillLineAbilities)
@@ -1639,7 +1639,7 @@ namespace Game.Entities
continue; continue;
// check level, skip class spells if not high enough // check level, skip class spells if not high enough
if (getLevel() < spellInfo.SpellLevel) if (GetLevel() < spellInfo.SpellLevel)
continue; continue;
// need unlearn spell // need unlearn spell
@@ -1932,7 +1932,7 @@ namespace Game.Entities
if (HasSkill((SkillType)rcInfo.SkillID)) if (HasSkill((SkillType)rcInfo.SkillID))
continue; continue;
if (rcInfo.MinLevel > getLevel()) if (rcInfo.MinLevel > GetLevel())
continue; continue;
LearnDefaultSkill(rcInfo); LearnDefaultSkill(rcInfo);
@@ -1954,7 +1954,7 @@ namespace Game.Entities
if (rcInfo.Flags.HasAnyFlag(SkillRaceClassInfoFlags.AlwaysMaxValue)) if (rcInfo.Flags.HasAnyFlag(SkillRaceClassInfoFlags.AlwaysMaxValue))
skillValue = maxValue; skillValue = maxValue;
else if (GetClass() == Class.Deathknight) 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) else if (skillId == SkillType.FistWeapons)
skillValue = Math.Max((ushort)1, GetSkillValue(SkillType.Unarmed)); skillValue = Math.Max((ushort)1, GetSkillValue(SkillType.Unarmed));
@@ -1972,7 +1972,7 @@ namespace Game.Entities
if (rcInfo.Flags.HasAnyFlag(SkillRaceClassInfoFlags.AlwaysMaxValue)) if (rcInfo.Flags.HasAnyFlag(SkillRaceClassInfoFlags.AlwaysMaxValue))
skillValue = maxValue; skillValue = maxValue;
else if (GetClass() == Class.Deathknight) 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); SetSkill(skillId, 1, skillValue, maxValue);
break; break;
@@ -3291,7 +3291,7 @@ namespace Game.Entities
} }
// not allow proc extra attack spell at extra attack // 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; return;
float chance = spellInfo.ProcChance; float chance = spellInfo.ProcChance;
@@ -3404,9 +3404,9 @@ namespace Game.Entities
{ {
// normalized proc chance for weapon attack speed // normalized proc chance for weapon attack speed
// (odd formula...) // (odd formula...)
if (isAttackReady(WeaponAttackType.BaseAttack)) if (IsAttackReady(WeaponAttackType.BaseAttack))
return (GetBaseAttackTime(WeaponAttackType.BaseAttack) * 1.8f / 1000.0f); 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 (GetBaseAttackTime(WeaponAttackType.OffAttack) * 1.6f / 1000.0f);
return 0; return 0;
} }
@@ -28,7 +28,7 @@ namespace Game.Entities
{ {
public void InitTalentForLevel() public void InitTalentForLevel()
{ {
uint level = getLevel(); uint level = GetLevel();
// talents base at level diff (talents = level - 9 but some can be used already) // talents base at level diff (talents = level - 9 but some can be used already)
if (level < PlayerConst.MinSpecializationLevel) if (level < PlayerConst.MinSpecializationLevel)
ResetTalentSpecialization(); ResetTalentSpecialization();
+105 -112
View File
@@ -45,8 +45,8 @@ namespace Game.Entities
{ {
public Player(WorldSession session) : base(true) public Player(WorldSession session) : base(true)
{ {
objectTypeMask |= TypeMask.Player; ObjectTypeMask |= TypeMask.Player;
objectTypeId = TypeId.Player; ObjectTypeId = TypeId.Player;
m_playerData = new PlayerData(); m_playerData = new PlayerData();
m_activePlayerData = new ActivePlayerData(); m_activePlayerData = new ActivePlayerData();
@@ -536,11 +536,11 @@ namespace Game.Entities
// default combat reach 10 // default combat reach 10
// TODO add weapon, skill check // TODO add weapon, skill check
if (isAttackReady(WeaponAttackType.BaseAttack)) if (IsAttackReady(WeaponAttackType.BaseAttack))
{ {
if (!IsWithinMeleeRange(victim)) if (!IsWithinMeleeRange(victim))
{ {
setAttackTimer(WeaponAttackType.BaseAttack, 100); SetAttackTimer(WeaponAttackType.BaseAttack, 100);
if (m_swingErrorMsg != 1) // send single time (client auto repeat) if (m_swingErrorMsg != 1) // send single time (client auto repeat)
{ {
SendAttackSwingNotInRange(); SendAttackSwingNotInRange();
@@ -550,7 +550,7 @@ namespace Game.Entities
//120 degrees of radiant range, if player is not in boundary radius //120 degrees of radiant range, if player is not in boundary radius
else if (!IsWithinBoundaryRadius(victim) && !HasInArc(2 * MathFunctions.PI / 3, victim)) 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) if (m_swingErrorMsg != 2) // send single time (client auto repeat)
{ {
SendAttackSwingBadFacingAttack(); SendAttackSwingBadFacingAttack();
@@ -562,31 +562,31 @@ namespace Game.Entities
m_swingErrorMsg = 0; // reset swing error state m_swingErrorMsg = 0; // reset swing error state
// prevent base and off attack in same time, delay attack at 0.2 sec // prevent base and off attack in same time, delay attack at 0.2 sec
if (haveOffhandWeapon()) if (HaveOffhandWeapon())
if (getAttackTimer(WeaponAttackType.OffAttack) < SharedConst.AttackDisplayDelay) if (GetAttackTimer(WeaponAttackType.OffAttack) < SharedConst.AttackDisplayDelay)
setAttackTimer(WeaponAttackType.OffAttack, SharedConst.AttackDisplayDelay); SetAttackTimer(WeaponAttackType.OffAttack, SharedConst.AttackDisplayDelay);
// do attack // do attack
AttackerStateUpdate(victim, WeaponAttackType.BaseAttack); 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)) if (!IsWithinMeleeRange(victim))
setAttackTimer(WeaponAttackType.OffAttack, 100); SetAttackTimer(WeaponAttackType.OffAttack, 100);
else if (!IsWithinBoundaryRadius(victim) && !HasInArc(2 * MathFunctions.PI / 3, victim)) else if (!IsWithinBoundaryRadius(victim) && !HasInArc(2 * MathFunctions.PI / 3, victim))
setAttackTimer(WeaponAttackType.BaseAttack, 100); SetAttackTimer(WeaponAttackType.BaseAttack, 100);
else else
{ {
// prevent base and off attack in same time, delay attack at 0.2 sec // prevent base and off attack in same time, delay attack at 0.2 sec
if (getAttackTimer(WeaponAttackType.BaseAttack) < SharedConst.AttackDisplayDelay) if (GetAttackTimer(WeaponAttackType.BaseAttack) < SharedConst.AttackDisplayDelay)
setAttackTimer(WeaponAttackType.BaseAttack, SharedConst.AttackDisplayDelay); SetAttackTimer(WeaponAttackType.BaseAttack, SharedConst.AttackDisplayDelay);
// do attack // do attack
AttackerStateUpdate(victim, WeaponAttackType.OffAttack); AttackerStateUpdate(victim, WeaponAttackType.OffAttack);
resetAttackTimer(WeaponAttackType.OffAttack); ResetAttackTimer(WeaponAttackType.OffAttack);
} }
} }
} }
@@ -643,7 +643,7 @@ namespace Game.Entities
if (IsAlive()) if (IsAlive())
{ {
m_regenTimer += diff; RegenTimer += diff;
RegenerateAll(); RegenerateAll();
} }
@@ -722,7 +722,7 @@ namespace Game.Entities
SendUpdateToOutOfRangeGroupMembers(); SendUpdateToOutOfRangeGroupMembers();
Pet pet = GetPet(); 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); RemovePet(pet, PetSaveMode.NotInSlot, true);
if (IsAlive()) if (IsAlive())
@@ -731,7 +731,7 @@ namespace Game.Entities
{ {
m_hostileReferenceCheckTimer = 15 * Time.InMilliseconds; m_hostileReferenceCheckTimer = 15 * Time.InMilliseconds;
if (!GetMap().IsDungeon()) if (!GetMap().IsDungeon())
getHostileRefManager().deleteReferencesOutOfRange(GetVisibilityRange()); GetHostileRefManager().deleteReferencesOutOfRange(GetVisibilityRange());
} }
else else
m_hostileReferenceCheckTimer -= diff; m_hostileReferenceCheckTimer -= diff;
@@ -743,7 +743,7 @@ namespace Game.Entities
TeleportTo(teleportDest, m_teleport_options); TeleportTo(teleportDest, m_teleport_options);
} }
public override void setDeathState(DeathState s) public override void SetDeathState(DeathState s)
{ {
bool oldIsAlive = IsAlive(); bool oldIsAlive = IsAlive();
@@ -775,7 +775,7 @@ namespace Game.Entities
ResetCriteria(CriteriaTypes.GetKillingBlows, (uint)CriteriaCondition.NoDeath); ResetCriteria(CriteriaTypes.GetKillingBlows, (uint)CriteriaCondition.NoDeath);
} }
base.setDeathState(s); base.SetDeathState(s);
if (IsAlive() && !oldIsAlive) if (IsAlive() && !oldIsAlive)
//clear aura case after resurrection by another way (spells will be applied before next death) //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); } public void SetInvSlot(uint slot, ObjectGuid guid) { SetUpdateFieldValue(ref m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.InvSlots, (int)slot), guid); }
//Taxi //Taxi
public void InitTaxiNodesForLevel() { m_taxi.InitTaxiNodesForLevel(GetRace(), GetClass(), getLevel()); } public void InitTaxiNodesForLevel() { m_taxi.InitTaxiNodesForLevel(GetRace(), GetClass(), GetLevel()); }
//Cheat Commands //Cheat Commands
public bool GetCommandStatus(PlayerCommandStates command) { return (_activeCheats & command) != 0; } public bool GetCommandStatus(PlayerCommandStates command) { return (_activeCheats & command) != 0; }
@@ -1031,7 +1031,7 @@ namespace Game.Entities
if (!pet) if (!pet)
return; return;
if (m_temporaryUnsummonedPetNumber == 0 && pet.isControlled() && !pet.isTemporarySummoned()) if (m_temporaryUnsummonedPetNumber == 0 && pet.IsControlled() && !pet.IsTemporarySummoned())
{ {
m_temporaryUnsummonedPetNumber = pet.GetCharmInfo().GetPetNumber(); m_temporaryUnsummonedPetNumber = pet.GetCharmInfo().GetPetNumber();
m_oldpetspell = pet.m_unitData.CreatedBySpell; m_oldpetspell = pet.m_unitData.CreatedBySpell;
@@ -1528,7 +1528,7 @@ namespace Game.Entities
break; break;
} }
if (rate != 1.0f && creatureOrQuestLevel < Formulas.GetGrayLevel(getLevel())) if (rate != 1.0f && creatureOrQuestLevel < Formulas.GetGrayLevel(GetLevel()))
percent *= rate; percent *= rate;
if (percent <= 0.0f) if (percent <= 0.0f)
@@ -1958,7 +1958,7 @@ namespace Game.Entities
// remove auras that need water/land // remove auras that need water/land
RemoveAurasWithInterruptFlags((apply ? SpellAuraInterruptFlags.NotAbovewater : SpellAuraInterruptFlags.NotUnderwater)); RemoveAurasWithInterruptFlags((apply ? SpellAuraInterruptFlags.NotAbovewater : SpellAuraInterruptFlags.NotUnderwater));
getHostileRefManager().updateThreatTables(); GetHostileRefManager().updateThreatTables();
} }
public void ValidateMovementInfo(MovementInfo mi) public void ValidateMovementInfo(MovementInfo mi)
{ {
@@ -2177,7 +2177,7 @@ namespace Game.Entities
} }
//GM //GM
public bool isAcceptWhispers() { return m_ExtraFlags.HasAnyFlag(PlayerExtraFlags.AcceptWhispers); } public bool IsAcceptWhispers() { return m_ExtraFlags.HasAnyFlag(PlayerExtraFlags.AcceptWhispers); }
public void SetAcceptWhispers(bool on) public void SetAcceptWhispers(bool on)
{ {
if (on) if (on)
@@ -2200,13 +2200,13 @@ namespace Game.Entities
if (pet != null) if (pet != null)
{ {
pet.SetFaction(35); pet.SetFaction(35);
pet.getHostileRefManager().setOnlineOfflineState(false); pet.GetHostileRefManager().setOnlineOfflineState(false);
} }
RemovePvpFlag(UnitPVPStateFlags.FFAPvp); RemovePvpFlag(UnitPVPStateFlags.FFAPvp);
ResetContestedPvP(); ResetContestedPvP();
getHostileRefManager().setOnlineOfflineState(false); GetHostileRefManager().setOnlineOfflineState(false);
CombatStopWithPets(); CombatStopWithPets();
PhasingHandler.SetAlwaysVisible(GetPhaseShift(), true); PhasingHandler.SetAlwaysVisible(GetPhaseShift(), true);
@@ -2225,7 +2225,7 @@ namespace Game.Entities
if (pet != null) if (pet != null)
{ {
pet.SetFaction(GetFaction()); pet.SetFaction(GetFaction());
pet.getHostileRefManager().setOnlineOfflineState(true); pet.GetHostileRefManager().setOnlineOfflineState(true);
} }
// restore FFA PvP Server state // restore FFA PvP Server state
@@ -2235,13 +2235,13 @@ namespace Game.Entities
// restore FFA PvP area state, remove not allowed for GM mounts // restore FFA PvP area state, remove not allowed for GM mounts
UpdateArea(m_areaUpdateId); UpdateArea(m_areaUpdateId);
getHostileRefManager().setOnlineOfflineState(true); GetHostileRefManager().setOnlineOfflineState(true);
m_serverSideVisibilityDetect.SetValue(ServerSideVisibilityType.GM, AccountTypes.Player); m_serverSideVisibilityDetect.SetValue(ServerSideVisibilityType.GM, AccountTypes.Player);
} }
UpdateObjectVisibility(); UpdateObjectVisibility();
} }
public bool isGMChat() { return m_ExtraFlags.HasAnyFlag(PlayerExtraFlags.GMChat); } public bool IsGMChat() { return m_ExtraFlags.HasAnyFlag(PlayerExtraFlags.GMChat); }
public void SetGMChat(bool on) public void SetGMChat(bool on)
{ {
if (on) if (on)
@@ -2249,7 +2249,7 @@ namespace Game.Entities
else else
m_ExtraFlags &= ~PlayerExtraFlags.GMChat; 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) public void SetTaxiCheater(bool on)
{ {
if (on) if (on)
@@ -2257,7 +2257,7 @@ namespace Game.Entities
else else
m_ExtraFlags &= ~PlayerExtraFlags.TaxiCheat; 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) public void SetGMVisible(bool on)
{ {
if (on) if (on)
@@ -2347,7 +2347,7 @@ namespace Game.Entities
return; return;
break; break;
case GossipOption.Battlefield: case GossipOption.Battlefield:
if (!creature.isCanInteractWithBattleMaster(this, false)) if (!creature.CanInteractWithBattleMaster(this, false))
canTalk = false; canTalk = false;
break; break;
case GossipOption.Stablepet: case GossipOption.Stablepet:
@@ -3506,7 +3506,7 @@ namespace Game.Entities
(newCustomDisplay[2] == null || (newCustomDisplay[2].Data == customDisplay[2]))) (newCustomDisplay[2] == null || (newCustomDisplay[2].Data == customDisplay[2])))
return 0; return 0;
GtBarberShopCostBaseRecord bsc = CliDB.BarberShopCostBaseGameTable.GetRow(getLevel()); GtBarberShopCostBaseRecord bsc = CliDB.BarberShopCostBaseGameTable.GetRow(GetLevel());
if (bsc == null) // shouldn't happen if (bsc == null) // shouldn't happen
return 0xFFFFFFFF; return 0xFFFFFFFF;
@@ -3535,7 +3535,7 @@ namespace Game.Entities
uint GetChampioningFaction() { return m_ChampioningFaction; } uint GetChampioningFaction() { return m_ChampioningFaction; }
public void SetChampioningFaction(uint faction) { m_ChampioningFaction = faction; } public void SetChampioningFaction(uint faction) { m_ChampioningFaction = faction; }
public void setFactionForRace(Race race) public void SetFactionForRace(Race race)
{ {
m_team = TeamForRace(race); m_team = TeamForRace(race);
@@ -3643,7 +3643,7 @@ namespace Game.Entities
SendPacket(packet); SendPacket(packet);
} }
public bool isAllowedToLoot(Creature creature) public bool IsAllowedToLoot(Creature creature)
{ {
if (!creature.IsDead() || !creature.IsDamageEnoughForLootingAndReward()) if (!creature.IsDead() || !creature.IsDamageEnoughForLootingAndReward())
return false; return false;
@@ -3706,7 +3706,7 @@ namespace Game.Entities
void RegenerateAll() void RegenerateAll()
{ {
m_regenTimerCount += m_regenTimer; m_regenTimerCount += RegenTimer;
for (PowerType power = PowerType.Mana; power < PowerType.Max; power++)// = power + 1) for (PowerType power = PowerType.Mana; power < PowerType.Max; power++)// = power + 1)
if (power != PowerType.Runes) if (power != PowerType.Runes)
@@ -3721,9 +3721,9 @@ namespace Game.Entities
{ {
byte runeToRegen = m_runes.CooldownOrder[regenIndex]; byte runeToRegen = m_runes.CooldownOrder[regenIndex];
uint runeCooldown = GetRuneCooldown(runeToRegen); uint runeCooldown = GetRuneCooldown(runeToRegen);
if (runeCooldown > m_regenTimer) if (runeCooldown > RegenTimer)
{ {
SetRuneCooldown(runeToRegen, runeCooldown - m_regenTimer); SetRuneCooldown(runeToRegen, runeCooldown - RegenTimer);
++regenIndex; ++regenIndex;
} }
else else
@@ -3742,7 +3742,7 @@ namespace Game.Entities
m_regenTimerCount -= 2000; m_regenTimerCount -= 2000;
} }
m_regenTimer = 0; RegenTimer = 0;
} }
void Regenerate(PowerType power) void Regenerate(PowerType power)
{ {
@@ -3769,10 +3769,10 @@ namespace Game.Entities
if (powerType.RegenInterruptTimeMS != 0 && Time.GetMSTimeDiffToNow(m_combatExitTime) < powerType.RegenInterruptTimeMS) if (powerType.RegenInterruptTimeMS != 0 && Time.GetMSTimeDiffToNow(m_combatExitTime) < powerType.RegenInterruptTimeMS)
return; 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 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 = WorldCfg[] RatesForPower =
{ {
@@ -3804,7 +3804,7 @@ namespace Game.Entities
if (power != PowerType.Mana) if (power != PowerType.Mana)
{ {
addvalue *= GetTotalAuraMultiplierByMiscValue(AuraType.ModPowerRegenPercent, (int)power); 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; int minPower = powerType.MinPower;
@@ -3898,8 +3898,8 @@ namespace Game.Entities
addValue = HealthIncreaseRate; addValue = HealthIncreaseRate;
if (!IsInCombat()) if (!IsInCombat())
{ {
if (getLevel() < 15) if (GetLevel() < 15)
addValue = (0.20f * (GetMaxHealth()) / getLevel() * HealthIncreaseRate); addValue = (0.20f * (GetMaxHealth()) / GetLevel() * HealthIncreaseRate);
else else
addValue = 0.015f * (GetMaxHealth()) * HealthIncreaseRate; addValue = 0.015f * (GetMaxHealth()) * HealthIncreaseRate;
@@ -4116,7 +4116,7 @@ namespace Game.Entities
bool IsImmuneToEnvironmentalDamage() bool IsImmuneToEnvironmentalDamage()
{ {
// check for GM and death state included in isAttackableByAOE // check for GM and death state included in isAttackableByAOE
return (!isTargetableForAttack(false)); return (!IsTargetableForAttack(false));
} }
public uint EnvironmentalDamage(EnviromentalDamage type, uint damage) public uint EnvironmentalDamage(EnviromentalDamage type, uint damage)
{ {
@@ -4168,7 +4168,7 @@ namespace Game.Entities
return final_damage; return final_damage;
} }
bool isTotalImmune() bool IsTotalImmune()
{ {
var immune = GetAuraEffectsByType(AuraType.SchoolImmunity); var immune = GetAuraEffectsByType(AuraType.SchoolImmunity);
@@ -4273,7 +4273,7 @@ namespace Game.Entities
public bool IsMirrorTimerActive(MirrorTimerType type) public bool IsMirrorTimerActive(MirrorTimerType type)
{ {
return m_MirrorTimer[(int)type] == getMaxTimer(type); return m_MirrorTimer[(int)type] == GetMaxTimer(type);
} }
void HandleDrowning(uint time_diff) void HandleDrowning(uint time_diff)
@@ -4291,7 +4291,7 @@ namespace Game.Entities
// Breath timer not activated - activate it // Breath timer not activated - activate it
if (m_MirrorTimer[breathTimer] == -1) 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); SendMirrorTimer(MirrorTimerType.Breath, m_MirrorTimer[breathTimer], m_MirrorTimer[breathTimer], -1);
} }
else // If activated - do tick else // If activated - do tick
@@ -4303,16 +4303,16 @@ namespace Game.Entities
m_MirrorTimer[breathTimer] += 1 * Time.InMilliseconds; m_MirrorTimer[breathTimer] += 1 * Time.InMilliseconds;
// Calculate and deal damage // Calculate and deal damage
// @todo Check this formula // @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); EnvironmentalDamage(EnviromentalDamage.Drowning, damage);
} }
else if (!m_MirrorTimerFlagsLast.HasAnyFlag(PlayerUnderwaterState.InWater)) // Update time in client if need 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 else if (m_MirrorTimer[breathTimer] != -1) // Regen timer
{ {
int UnderWaterTime = getMaxTimer(MirrorTimerType.Breath); int UnderWaterTime = GetMaxTimer(MirrorTimerType.Breath);
// Need breath regen // Need breath regen
m_MirrorTimer[breathTimer] += (int)(10 * time_diff); m_MirrorTimer[breathTimer] += (int)(10 * time_diff);
if (m_MirrorTimer[breathTimer] >= UnderWaterTime || !IsAlive()) if (m_MirrorTimer[breathTimer] >= UnderWaterTime || !IsAlive())
@@ -4327,7 +4327,7 @@ namespace Game.Entities
// Fatigue timer not activated - activate it // Fatigue timer not activated - activate it
if (m_MirrorTimer[fatigueTimer] == -1) 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); SendMirrorTimer(MirrorTimerType.Fatigue, m_MirrorTimer[fatigueTimer], m_MirrorTimer[fatigueTimer], -1);
} }
else else
@@ -4339,19 +4339,19 @@ namespace Game.Entities
m_MirrorTimer[fatigueTimer] += 1 * Time.InMilliseconds; m_MirrorTimer[fatigueTimer] += 1 * Time.InMilliseconds;
if (IsAlive()) // Calculate and deal damage 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); EnvironmentalDamage(EnviromentalDamage.Exhausted, damage);
} }
else if (HasPlayerFlag(PlayerFlags.Ghost)) // Teleport ghost to graveyard else if (HasPlayerFlag(PlayerFlags.Ghost)) // Teleport ghost to graveyard
RepopAtGraveyard(); RepopAtGraveyard();
} }
else if (!m_MirrorTimerFlagsLast.HasAnyFlag(PlayerUnderwaterState.InDarkWater)) 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 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); m_MirrorTimer[fatigueTimer] += (int)(10 * time_diff);
if (m_MirrorTimer[fatigueTimer] >= DarkWaterTime || !IsAlive()) if (m_MirrorTimer[fatigueTimer] >= DarkWaterTime || !IsAlive())
StopMirrorTimer(MirrorTimerType.Fatigue); StopMirrorTimer(MirrorTimerType.Fatigue);
@@ -4363,7 +4363,7 @@ namespace Game.Entities
{ {
// Breath timer not activated - activate it // Breath timer not activated - activate it
if (m_MirrorTimer[fireTimer] == -1) if (m_MirrorTimer[fireTimer] == -1)
m_MirrorTimer[fireTimer] = getMaxTimer(MirrorTimerType.Fire); m_MirrorTimer[fireTimer] = GetMaxTimer(MirrorTimerType.Fire);
else else
{ {
m_MirrorTimer[fireTimer] -= (int)time_diff; m_MirrorTimer[fireTimer] -= (int)time_diff;
@@ -4425,7 +4425,7 @@ namespace Game.Entities
SendPacket(new StopMirrorTimer(Type)); SendPacket(new StopMirrorTimer(Type));
} }
int getMaxTimer(MirrorTimerType timer) int GetMaxTimer(MirrorTimerType timer)
{ {
switch (timer) switch (timer)
{ {
@@ -4476,7 +4476,7 @@ namespace Game.Entities
if (GetSession().IsARecruiter() || (GetSession().GetRecruiterId() != 0)) if (GetSession().IsARecruiter() || (GetSession().GetRecruiterId() != 0))
AddDynamicFlag(UnitDynFlags.ReferAFriend); AddDynamicFlag(UnitDynFlags.ReferAFriend);
setDeathState(DeathState.Alive); SetDeathState(DeathState.Alive);
// add the flag to make sure opcode is always sent // add the flag to make sure opcode is always sent
AddUnitMovementFlag(MovementFlag.WaterWalk); AddUnitMovementFlag(MovementFlag.WaterWalk);
@@ -4525,15 +4525,15 @@ namespace Game.Entities
//Characters level 20 and up suffer from ten minutes of sickness. //Characters level 20 and up suffer from ten minutes of sickness.
int startLevel = WorldConfig.GetIntValue(WorldCfg.DeathSicknessLevel); int startLevel = WorldConfig.GetIntValue(WorldCfg.DeathSicknessLevel);
if (getLevel() >= startLevel) if (GetLevel() >= startLevel)
{ {
// set resurrection sickness // set resurrection sickness
CastSpell(this, 15007, true); CastSpell(this, 15007, true);
// not full duration // 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()); Aura aur = GetAura(15007, GetGUID());
if (aur != null) if (aur != null)
aur.SetDuration(delta * Time.InMilliseconds); aur.SetDuration(delta * Time.InMilliseconds);
@@ -4551,7 +4551,7 @@ namespace Game.Entities
StopMirrorTimers(); //disable timers(bars) StopMirrorTimers(); //disable timers(bars)
setDeathState(DeathState.Corpse); SetDeathState(DeathState.Corpse);
SetDynamicFlags(UnitDynFlags.None); SetDynamicFlags(UnitDynFlags.None);
if (!CliDB.MapStorage.LookupByKey(GetMapId()).Instanceable() && !HasAuraType(AuraType.PreventResurrection)) if (!CliDB.MapStorage.LookupByKey(GetMapId()).Instanceable() && !HasAuraType(AuraType.PreventResurrection))
@@ -4847,7 +4847,7 @@ namespace Game.Entities
pet.SetFaction(GetFaction()); pet.SetFaction(GetFaction());
pet.SetNpcFlags(NPCFlags.None); pet.SetNpcFlags(NPCFlags.None);
pet.SetNpcFlags2(NPCFlags2.None); pet.SetNpcFlags2(NPCFlags2.None);
pet.InitStatsForLevel(getLevel()); pet.InitStatsForLevel(GetLevel());
SetMinion(pet, true); SetMinion(pet, true);
@@ -4954,7 +4954,7 @@ namespace Game.Entities
pet.AddObjectToRemoveList(); pet.AddObjectToRemoveList();
pet.m_removed = true; pet.m_removed = true;
if (pet.isControlled()) if (pet.IsControlled())
{ {
SendPacket(new PetSpells()); SendPacket(new PetSpells());
@@ -5149,10 +5149,10 @@ namespace Game.Entities
} }
// Used in triggers for check "Only to targets that grant experience or honor" req // 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 v_level = victim.GetLevelForTarget(this);
uint k_grey = Formulas.GetGrayLevel(getLevel()); uint k_grey = Formulas.GetGrayLevel(GetLevel());
// Victim level less gray level // Victim level less gray level
if (v_level < k_grey) if (v_level < k_grey)
@@ -5167,8 +5167,8 @@ namespace Game.Entities
return true; return true;
} }
public void setRegenTimerCount(uint time) { m_regenTimerCount = time; } public void SetRegenTimerCount(uint time) { m_regenTimerCount = time; }
void setWeaponChangeTimer(uint time) { m_weaponChangeTimer = time; } void SetWeaponChangeTimer(uint time) { m_weaponChangeTimer = time; }
//Team //Team
public static Team TeamForRace(Race race) public static Team TeamForRace(Race race)
@@ -5257,13 +5257,6 @@ namespace Game.Entities
DB.Characters.Execute(stmt); DB.Characters.Execute(stmt);
} }
} }
void SetFactionForRace(Race race)
{
m_team = TeamForRace(race);
var rEntry = CliDB.ChrRacesStorage.LookupByKey(race);
SetFaction(rEntry.FactionID);
}
//Guild //Guild
public void SetInGuild(ulong guildId) 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 SetFreePrimaryProfessions(uint profs) { SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.CharacterPoints), profs); }
public void GiveLevel(uint level) public void GiveLevel(uint level)
{ {
var oldLevel = getLevel(); var oldLevel = GetLevel();
if (level == oldLevel) if (level == oldLevel)
return; return;
@@ -5384,7 +5377,7 @@ namespace Game.Entities
if (pet) if (pet)
pet.SynchronizeLevelWithOwner(); pet.SynchronizeLevelWithOwner();
MailLevelReward mailReward = Global.ObjectMgr.GetMailLevelReward(level, (uint)getRaceMask()); MailLevelReward mailReward = Global.ObjectMgr.GetMailLevelReward(level, (uint)GetRaceMask());
if (mailReward != null) if (mailReward != null)
{ {
//- TODO: Poor design of mail system //- TODO: Poor design of mail system
@@ -5423,33 +5416,33 @@ namespace Game.Entities
public void ToggleAFK() public void ToggleAFK()
{ {
if (isAFK()) if (IsAFK())
RemovePlayerFlag(PlayerFlags.AFK); RemovePlayerFlag(PlayerFlags.AFK);
else else
AddPlayerFlag(PlayerFlags.AFK); AddPlayerFlag(PlayerFlags.AFK);
// afk player not allowed in Battleground // afk player not allowed in Battleground
if (!IsGameMaster() && isAFK() && InBattleground() && !InArena()) if (!IsGameMaster() && IsAFK() && InBattleground() && !InArena())
LeaveBattleground(); LeaveBattleground();
} }
public void ToggleDND() public void ToggleDND()
{ {
if (isDND()) if (IsDND())
RemovePlayerFlag(PlayerFlags.DND); RemovePlayerFlag(PlayerFlags.DND);
else else
AddPlayerFlag(PlayerFlags.DND); AddPlayerFlag(PlayerFlags.DND);
} }
public bool isAFK() { return HasPlayerFlag(PlayerFlags.AFK); } public bool IsAFK() { return HasPlayerFlag(PlayerFlags.AFK); }
public bool isDND() { return HasPlayerFlag(PlayerFlags.DND); } public bool IsDND() { return HasPlayerFlag(PlayerFlags.DND); }
public ChatFlags GetChatFlags() public ChatFlags GetChatFlags()
{ {
ChatFlags tag = ChatFlags.None; ChatFlags tag = ChatFlags.None;
if (isGMChat()) if (IsGMChat())
tag |= ChatFlags.GM; tag |= ChatFlags.GM;
if (isDND()) if (IsDND())
tag |= ChatFlags.DND; tag |= ChatFlags.DND;
if (isAFK()) if (IsAFK())
tag |= ChatFlags.AFK; tag |= ChatFlags.AFK;
if (HasPlayerFlag(PlayerFlags.Developer)) if (HasPlayerFlag(PlayerFlags.Developer))
tag |= ChatFlags.Dev; tag |= ChatFlags.Dev;
@@ -5823,12 +5816,12 @@ namespace Game.Entities
_RemoveAllStatBonuses(); _RemoveAllStatBonuses();
uint basemana; 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.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) // reset before any aura state sources (health set/aura apply)
SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.AuraState), 0u); 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 // target aura duration for caster show only if target exist at caster client
// send data at target visibility change (adding to client) // send data at target visibility change (adding to client)
if (target.isTypeMask(TypeMask.Unit)) if (target.IsTypeMask(TypeMask.Unit))
SendInitialVisiblePackets(target.ToUnit()); SendInitialVisiblePackets(target.ToUnit());
} }
} }
@@ -6311,17 +6304,17 @@ namespace Game.Entities
if (areaEntry.ExplorationLevel > 0) if (areaEntry.ExplorationLevel > 0)
{ {
if (getLevel() >= WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel)) if (GetLevel() >= WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel))
{ {
SendExplorationExperience(areaId, 0); SendExplorationExperience(areaId, 0);
} }
else else
{ {
int diff = (int)(getLevel() - areaEntry.ExplorationLevel); int diff = (int)(GetLevel() - areaEntry.ExplorationLevel);
uint XP = 0; uint XP = 0;
if (diff < -5) 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) else if (diff > 5)
{ {
@@ -6453,16 +6446,16 @@ namespace Game.Entities
data.Initialize(ChatMsg.WhisperInform, language, target, target, text); data.Initialize(ChatMsg.WhisperInform, language, target, target, text);
SendPacket(data); SendPacket(data);
if (!isAcceptWhispers() && !IsGameMaster() && !target.IsGameMaster()) if (!IsAcceptWhispers() && !IsGameMaster() && !target.IsGameMaster())
{ {
SetAcceptWhispers(true); SetAcceptWhispers(true);
SendSysMessage(CypherStrings.CommandWhisperon); SendSysMessage(CypherStrings.CommandWhisperon);
} }
// announce afk or dnd message // announce afk or dnd message
if (target.isAFK()) if (target.IsAFK())
SendSysMessage(CypherStrings.PlayerAfk, target.GetName(), target.autoReplyMsg); SendSysMessage(CypherStrings.PlayerAfk, target.GetName(), target.autoReplyMsg);
else if (target.isDND()) else if (target.IsDND())
SendSysMessage(CypherStrings.PlayerDnd, target.GetName(), target.autoReplyMsg); SendSysMessage(CypherStrings.PlayerDnd, target.GetName(), target.autoReplyMsg);
} }
@@ -6496,8 +6489,8 @@ namespace Game.Entities
m_lastFallZ = z; m_lastFallZ = z;
} }
public byte getCinematic() { return m_cinematic; } public byte GetCinematic() { return m_cinematic; }
public void setCinematic(byte cine) { m_cinematic = cine; } public void SetCinematic(byte cine) { m_cinematic = cine; }
public uint GetMovie() { return m_movie; } public uint GetMovie() { return m_movie; }
public void SetMovie(uint movie) { m_movie = movie; } public void SetMovie(uint movie) { m_movie = movie; }
@@ -6536,7 +6529,7 @@ namespace Game.Entities
int playerLevelDelta = 0; int playerLevelDelta = 0;
// If XP < 50%, player should see scaling creature with -1 level except for level max // 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; playerLevelDelta = -1;
SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.ScalingPlayerLevelDelta), playerLevelDelta); SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.ScalingPlayerLevelDelta), playerLevelDelta);
@@ -6553,10 +6546,10 @@ namespace Game.Entities
if (HasPlayerFlag(PlayerFlags.NoXPGain)) if (HasPlayerFlag(PlayerFlags.NoXPGain))
return; return;
if (victim != null && victim.IsTypeId(TypeId.Unit) && !victim.ToCreature().hasLootRecipient()) if (victim != null && victim.IsTypeId(TypeId.Unit) && !victim.ToCreature().HasLootRecipient())
return; return;
uint level = getLevel(); uint level = GetLevel();
Global.ScriptMgr.OnGivePlayerXP(this, xp, victim); Global.ScriptMgr.OnGivePlayerXP(this, xp, victim);
@@ -6593,7 +6586,7 @@ namespace Game.Entities
if (level < WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel)) if (level < WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel))
GiveLevel(level + 1); GiveLevel(level + 1);
level = getLevel(); level = GetLevel();
nextLvlXP = m_activePlayerData.NextLevelXP; nextLvlXP = m_activePlayerData.NextLevelXP;
} }
@@ -6757,7 +6750,7 @@ namespace Game.Entities
if (GetDisplayId() != GetNativeDisplayId()) if (GetDisplayId() != GetNativeDisplayId())
RestoreDisplayId(true); RestoreDisplayId(true);
if (IsDisallowedMountForm(getTransForm(), ShapeShiftForm.None, GetDisplayId())) if (IsDisallowedMountForm(GetTransForm(), ShapeShiftForm.None, GetDisplayId()))
{ {
GetSession().SendActivateTaxiReply(ActivateTaxiReply.PlayerShapeshifted); GetSession().SendActivateTaxiReply(ActivateTaxiReply.PlayerShapeshifted);
return false; return false;
@@ -6931,7 +6924,7 @@ namespace Game.Entities
m_taxi.ClearTaxiDestinations(); // not destinations, clear source node m_taxi.ClearTaxiDestinations(); // not destinations, clear source node
Dismount(); Dismount();
RemoveUnitFlag(UnitFlags.RemoveClientControl | UnitFlags.TaxiFlight); RemoveUnitFlag(UnitFlags.RemoveClientControl | UnitFlags.TaxiFlight);
getHostileRefManager().setOnlineOfflineState(true); GetHostileRefManager().setOnlineOfflineState(true);
} }
public void ContinueTaxiFlight() public void ContinueTaxiFlight()
@@ -6989,7 +6982,7 @@ namespace Game.Entities
public bool GetsRecruitAFriendBonus(bool forXP) public bool GetsRecruitAFriendBonus(bool forXP)
{ {
bool recruitAFriend = false; bool recruitAFriend = false;
if (getLevel() <= WorldConfig.GetIntValue(WorldCfg.MaxRecruitAFriendBonusPlayerLevel) || !forXP) if (GetLevel() <= WorldConfig.GetIntValue(WorldCfg.MaxRecruitAFriendBonusPlayerLevel) || !forXP)
{ {
Group group = GetGroup(); Group group = GetGroup();
if (group) if (group)
@@ -7006,12 +6999,12 @@ namespace Game.Entities
if (forXP) if (forXP)
{ {
// level must be allowed to get RaF bonus // level must be allowed to get RaF bonus
if (player.getLevel() > WorldConfig.GetIntValue(WorldCfg.MaxRecruitAFriendBonusPlayerLevel)) if (player.GetLevel() > WorldConfig.GetIntValue(WorldCfg.MaxRecruitAFriendBonusPlayerLevel))
continue; continue;
// level difference must be small enough to get RaF bonus, UNLESS we are lower level // level difference must be small enough to get RaF bonus, UNLESS we are lower level
if (player.getLevel() < getLevel()) if (player.GetLevel() < GetLevel())
if (getLevel() - player.getLevel() > WorldConfig.GetIntValue(WorldCfg.MaxRecruitAFriendBonusPlayerLevelDifference)) if (GetLevel() - player.GetLevel() > WorldConfig.GetIntValue(WorldCfg.MaxRecruitAFriendBonusPlayerLevelDifference))
continue; continue;
} }
@@ -7109,8 +7102,8 @@ namespace Game.Entities
} }
public bool IsSpellFitByClassAndRace(uint spell_id) public bool IsSpellFitByClassAndRace(uint spell_id)
{ {
ulong racemask = getRaceMask(); ulong racemask = GetRaceMask();
uint classmask = getClassMask(); uint classmask = GetClassMask();
var bounds = Global.SpellMgr.GetSkillLineAbilityMapBounds(spell_id); var bounds = Global.SpellMgr.GetSkillLineAbilityMapBounds(spell_id);
@@ -7202,7 +7195,7 @@ namespace Game.Entities
// farsight dynobj or puppet may be very far away // farsight dynobj or puppet may be very far away
UpdateVisibilityOf(target); UpdateVisibilityOf(target);
if (target.isTypeMask(TypeMask.Unit) && target != GetVehicleBase()) if (target.IsTypeMask(TypeMask.Unit) && target != GetVehicleBase())
target.ToUnit().AddPlayerToVision(this); target.ToUnit().AddPlayerToVision(this);
SetSeer(target); SetSeer(target);
} }
@@ -7218,7 +7211,7 @@ namespace Game.Entities
SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.FarsightObject), ObjectGuid.Empty); 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); target.ToUnit().RemovePlayerFromVision(this);
//must immediately set seer back otherwise may crash //must immediately set seer back otherwise may crash
+5 -5
View File
@@ -27,6 +27,10 @@ namespace Game.Entities
{ {
public class PlayerTaxi 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) public void InitTaxiNodesForLevel(Race race, Class chrClass, uint level)
{ {
// class specific initial known nodes // class specific initial known nodes
@@ -261,10 +265,6 @@ namespace Game.Entities
return GetTaxiDestination(); return GetTaxiDestination();
} }
public List<uint> GetPath() { return m_TaxiDestinations; } public List<uint> GetPath() { return m_TaxiDestinations; }
public bool empty() { return m_TaxiDestinations.Empty(); } 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;
} }
} }
+8 -8
View File
@@ -4,6 +4,12 @@ namespace Game.Entities
{ {
public class RestMgr public class RestMgr
{ {
Player _player;
long _restTime;
uint _innAreaTriggerId;
float[] _restBonus = new float[(int)RestTypes.Max];
RestFlag _restFlagMask;
public RestMgr(Player player) public RestMgr(Player player)
{ {
_player = player; _player = player;
@@ -18,7 +24,7 @@ namespace Game.Entities
{ {
case RestTypes.XP: case RestTypes.XP:
// Reset restBonus (XP only) for max level players // Reset restBonus (XP only) for max level players
if (_player.getLevel() >= WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel)) if (_player.GetLevel() >= WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel))
restBonus = 0; restBonus = 0;
next_level_xp = _player.m_activePlayerData.NextLevelXP; next_level_xp = _player.m_activePlayerData.NextLevelXP;
@@ -67,7 +73,7 @@ namespace Game.Entities
public void AddRestBonus(RestTypes restType, float restBonus) 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). // 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; restBonus = 0;
float totalRestBonus = GetRestBonus(restType) + restBonus; float totalRestBonus = GetRestBonus(restType) + restBonus;
@@ -153,11 +159,5 @@ namespace Game.Entities
public float GetRestBonus(RestTypes restType) { return _restBonus[(int)restType]; } public float GetRestBonus(RestTypes restType) { return _restBonus[(int)restType]; }
public bool HasRestFlag(RestFlag restFlag) { return (_restFlagMask & restFlag) != 0; } public bool HasRestFlag(RestFlag restFlag) { return (_restFlagMask & restFlag) != 0; }
public uint GetInnTriggerId() { return _innAreaTriggerId; } 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 public class SceneMgr
{ {
Player _player;
Dictionary<uint, SceneTemplate> _scenesByInstance = new Dictionary<uint, SceneTemplate>();
uint _standaloneSceneInstanceID;
bool _isDebuggingScenes;
public SceneMgr(Player player) public SceneMgr(Player player)
{ {
_player = player; _player = player;
@@ -237,10 +242,5 @@ namespace Game.Entities
public void ToggleDebugSceneMode() { _isDebuggingScenes = !_isDebuggingScenes; } public void ToggleDebugSceneMode() { _isDebuggingScenes = !_isDebuggingScenes; }
public bool IsInDebugSceneMode() { return _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> public class SocialManager : Singleton<SocialManager>
{ {
Dictionary<ObjectGuid, PlayerSocial> _socialMap = new Dictionary<ObjectGuid, PlayerSocial>();
SocialManager() { } SocialManager() { }
public const int FriendLimit = 50; public const int FriendLimit = 50;
@@ -62,15 +64,15 @@ namespace Game.Entities
if (target.IsVisibleGloballyFor(player)) if (target.IsVisibleGloballyFor(player))
{ {
if (target.isDND()) if (target.IsDND())
friendInfo.Status = FriendStatus.DND; friendInfo.Status = FriendStatus.DND;
else if (target.isAFK()) else if (target.IsAFK())
friendInfo.Status = FriendStatus.AFK; friendInfo.Status = FriendStatus.AFK;
else else
friendInfo.Status = FriendStatus.Online; friendInfo.Status = FriendStatus.Online;
friendInfo.Area = target.GetZoneId(); friendInfo.Area = target.GetZoneId();
friendInfo.Level = target.getLevel(); friendInfo.Level = target.GetLevel();
friendInfo.Class = target.GetClass(); friendInfo.Class = target.GetClass();
} }
} }
@@ -141,12 +143,13 @@ namespace Game.Entities
} }
public void RemovePlayerSocial(ObjectGuid guid) { _socialMap.Remove(guid); } public void RemovePlayerSocial(ObjectGuid guid) { _socialMap.Remove(guid); }
Dictionary<ObjectGuid, PlayerSocial> _socialMap = new Dictionary<ObjectGuid, PlayerSocial>();
} }
public class PlayerSocial public class PlayerSocial
{ {
public Dictionary<ObjectGuid, FriendInfo> _playerSocialMap = new Dictionary<ObjectGuid, FriendInfo>();
ObjectGuid m_playerGUID;
uint GetNumberOfSocialsWithFlag(SocialFlag flag) uint GetNumberOfSocialsWithFlag(SocialFlag flag)
{ {
uint counter = 0; uint counter = 0;
@@ -277,13 +280,18 @@ namespace Game.Entities
ObjectGuid GetPlayerGUID() { return m_playerGUID; } ObjectGuid GetPlayerGUID() { return m_playerGUID; }
public void SetPlayerGUID(ObjectGuid guid) { m_playerGUID = guid; } public void SetPlayerGUID(ObjectGuid guid) { m_playerGUID = guid; }
public Dictionary<ObjectGuid, FriendInfo> _playerSocialMap = new Dictionary<ObjectGuid, FriendInfo>();
ObjectGuid m_playerGUID;
} }
public class FriendInfo 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() public FriendInfo()
{ {
Status = FriendStatus.Offline; Status = FriendStatus.Offline;
@@ -297,14 +305,6 @@ namespace Game.Entities
Flags = flags; Flags = flags;
Note = note; 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 public enum FriendStatus
+17 -17
View File
@@ -344,9 +344,9 @@ namespace Game.Entities
public ulong GetHealth() { return m_unitData.Health; } public ulong GetHealth() { return m_unitData.Health; }
public void SetHealth(ulong val) public void SetHealth(ulong val)
{ {
if (getDeathState() == DeathState.JustDied) if (GetDeathState() == DeathState.JustDied)
val = 0; val = 0;
else if (IsTypeId(TypeId.Player) && getDeathState() == DeathState.Dead) else if (IsTypeId(TypeId.Player) && GetDeathState() == DeathState.Dead)
val = 1; val = 1;
else else
{ {
@@ -367,7 +367,7 @@ namespace Game.Entities
else if (IsPet()) else if (IsPet())
{ {
Pet pet = ToCreature().ToPet(); Pet pet = ToCreature().ToPet();
if (pet.isControlled()) if (pet.IsControlled())
pet.SetGroupUpdateFlag(GroupUpdatePetFlags.CurHp); pet.SetGroupUpdateFlag(GroupUpdatePetFlags.CurHp);
} }
} }
@@ -389,7 +389,7 @@ namespace Game.Entities
else if (IsPet()) else if (IsPet())
{ {
Pet pet = ToCreature().ToPet(); Pet pet = ToCreature().ToPet();
if (pet.isControlled()) if (pet.IsControlled())
pet.SetGroupUpdateFlag(GroupUpdatePetFlags.MaxHp); pet.SetGroupUpdateFlag(GroupUpdatePetFlags.MaxHp);
} }
@@ -605,7 +605,7 @@ namespace Game.Entities
//calculate miss chance //calculate miss chance
float missChance = victim.GetUnitMissChance(attType); float missChance = victim.GetUnitMissChance(attType);
if (spellId == 0 && haveOffhandWeapon() && !IsInFeralForm()) if (spellId == 0 && HaveOffhandWeapon() && !IsInFeralForm())
missChance += 19; missChance += 19;
// Calculate hit chance // Calculate hit chance
@@ -622,9 +622,9 @@ namespace Game.Entities
missChance += hitChance - 100.0f; missChance += hitChance - 100.0f;
if (attType == WeaponAttackType.RangedAttack) if (attType == WeaponAttackType.RangedAttack)
missChance -= m_modRangedHitChance; missChance -= ModRangedHitChance;
else else
missChance -= m_modMeleeHitChance; missChance -= ModMeleeHitChance;
// Limit miss chance from 0 to 77% // Limit miss chance from 0 to 77%
if (missChance < 0.0f) if (missChance < 0.0f)
@@ -1024,7 +1024,7 @@ namespace Game.Entities
// Get base of Mana Pool in sBaseMPGameTable // Get base of Mana Pool in sBaseMPGameTable
uint basemana; uint basemana;
Global.ObjectMgr.GetPlayerClassLevelInfo(GetClass(), getLevel(), out basemana); Global.ObjectMgr.GetPlayerClassLevelInfo(GetClass(), GetLevel(), out basemana);
float base_regen = basemana / 100.0f; float base_regen = basemana / 100.0f;
base_regen += GetTotalAuraModifierByMiscValue(AuraType.ModPowerRegen, (int)PowerType.Mana); base_regen += GetTotalAuraModifierByMiscValue(AuraType.ModPowerRegen, (int)PowerType.Mana);
@@ -1070,7 +1070,7 @@ namespace Game.Entities
public override void UpdateAttackPowerAndDamage(bool ranged = false) public override void UpdateAttackPowerAndDamage(bool ranged = false)
{ {
float val2 = 0.0f; float val2 = 0.0f;
float level = getLevel(); float level = GetLevel();
var entry = CliDB.ChrClassesStorage.LookupByKey(GetClass()); var entry = CliDB.ChrClassesStorage.LookupByKey(GetClass());
UnitMods unitMod = ranged ? UnitMods.AttackPowerRanged : UnitMods.AttackPower; UnitMods unitMod = ranged ? UnitMods.AttackPowerRanged : UnitMods.AttackPower;
@@ -1626,20 +1626,20 @@ namespace Game.Entities
public void UpdateMeleeHitChances() public void UpdateMeleeHitChances()
{ {
m_modMeleeHitChance = 7.5f + GetTotalAuraModifier(AuraType.ModHitChance); ModMeleeHitChance = 7.5f + GetTotalAuraModifier(AuraType.ModHitChance);
m_modMeleeHitChance += GetRatingBonusValue(CombatRating.HitMelee); ModMeleeHitChance += GetRatingBonusValue(CombatRating.HitMelee);
} }
public void UpdateRangedHitChances() public void UpdateRangedHitChances()
{ {
m_modRangedHitChance = 7.5f + GetTotalAuraModifier(AuraType.ModHitChance); ModRangedHitChance = 7.5f + GetTotalAuraModifier(AuraType.ModHitChance);
m_modRangedHitChance += GetRatingBonusValue(CombatRating.HitRanged); ModRangedHitChance += GetRatingBonusValue(CombatRating.HitRanged);
} }
public void UpdateSpellHitChances() public void UpdateSpellHitChances()
{ {
m_modSpellHitChance = 15.0f + GetTotalAuraModifier(AuraType.ModSpellHitChance); ModSpellHitChance = 15.0f + GetTotalAuraModifier(AuraType.ModSpellHitChance);
m_modSpellHitChance += GetRatingBonusValue(CombatRating.HitSpell); ModSpellHitChance += GetRatingBonusValue(CombatRating.HitSpell);
} }
public override void UpdateMaxHealth() public override void UpdateMaxHealth()
{ {
@@ -1656,7 +1656,7 @@ namespace Game.Entities
{ {
// Taken from PaperDollFrame.lua - 6.0.3.19085 // Taken from PaperDollFrame.lua - 6.0.3.19085
float ratio = 10.0f; float ratio = 10.0f;
GtHpPerStaRecord hpBase = CliDB.HpPerStaGameTable.GetRow(getLevel()); GtHpPerStaRecord hpBase = CliDB.HpPerStaGameTable.GetRow(GetLevel());
if (hpBase != null) if (hpBase != null)
ratio = hpBase.Health; ratio = hpBase.Health;
@@ -1869,7 +1869,7 @@ namespace Game.Entities
break; break;
} }
if (attType == WeaponAttackType.OffAttack && !haveOffhandWeapon()) if (attType == WeaponAttackType.OffAttack && !HaveOffhandWeapon())
{ {
minDamage = 0.0f; minDamage = 0.0f;
maxDamage = 0.0f; maxDamage = 0.0f;
+12 -13
View File
@@ -18,7 +18,6 @@
using Framework.Constants; using Framework.Constants;
using Framework.Dynamic; using Framework.Dynamic;
using Game.DataStorage; using Game.DataStorage;
using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace Game.Entities namespace Game.Entities
@@ -31,7 +30,7 @@ namespace Game.Entities
m_type = TempSummonType.ManualDespawn; m_type = TempSummonType.ManualDespawn;
m_summonerGUID = owner != null ? owner.GetGUID() : ObjectGuid.Empty; m_summonerGUID = owner != null ? owner.GetGUID() : ObjectGuid.Empty;
m_unitTypeMask |= UnitTypeMask.Summon; UnitTypeMask |= UnitTypeMask.Summon;
} }
public Unit GetSummoner() public Unit GetSummoner()
@@ -188,7 +187,7 @@ namespace Game.Entities
if (owner != null && IsTrigger() && m_spells[0] != 0) if (owner != null && IsTrigger() && m_spells[0] != 0)
{ {
SetFaction(owner.GetFaction()); SetFaction(owner.GetFaction());
SetLevel(owner.getLevel()); SetLevel(owner.GetLevel());
if (owner.IsTypeId(TypeId.Player)) if (owner.IsTypeId(TypeId.Player))
m_ControlledByPlayer = true; m_ControlledByPlayer = true;
} }
@@ -314,7 +313,7 @@ namespace Game.Entities
{ {
m_owner = owner; m_owner = owner;
Cypher.Assert(m_owner); Cypher.Assert(m_owner);
m_unitTypeMask |= UnitTypeMask.Minion; UnitTypeMask |= UnitTypeMask.Minion;
m_followAngle = SharedConst.PetFollowAngle; m_followAngle = SharedConst.PetFollowAngle;
/// @todo: Find correct way /// @todo: Find correct way
InitCharmInfo(); InitCharmInfo();
@@ -378,10 +377,10 @@ namespace Game.Entities
{ {
m_bonusSpellDamage = 0; m_bonusSpellDamage = 0;
m_unitTypeMask |= UnitTypeMask.Guardian; UnitTypeMask |= UnitTypeMask.Guardian;
if (properties != null && (properties.Title == SummonType.Pet || properties.Control == SummonCategory.Pet)) if (properties != null && (properties.Title == SummonType.Pet || properties.Control == SummonCategory.Pet))
{ {
m_unitTypeMask |= UnitTypeMask.ControlableGuardian; UnitTypeMask |= UnitTypeMask.ControlableGuardian;
InitCharmInfo(); InitCharmInfo();
} }
} }
@@ -390,7 +389,7 @@ namespace Game.Entities
{ {
base.InitStats(duration); base.InitStats(duration);
InitStatsForLevel(GetOwner().getLevel()); InitStatsForLevel(GetOwner().GetLevel());
if (GetOwner().IsTypeId(TypeId.Player) && HasUnitTypeMask(UnitTypeMask.ControlableGuardian)) if (GetOwner().IsTypeId(TypeId.Player) && HasUnitTypeMask(UnitTypeMask.ControlableGuardian))
GetCharmInfo().InitCharmCreateSpells(); GetCharmInfo().InitCharmCreateSpells();
@@ -430,7 +429,7 @@ namespace Game.Entities
else if (GetOwner().GetClass() == Class.Hunter) else if (GetOwner().GetClass() == Class.Hunter)
{ {
petType = PetType.Hunter; petType = PetType.Hunter;
m_unitTypeMask |= UnitTypeMask.HunterPet; UnitTypeMask |= UnitTypeMask.HunterPet;
} }
else else
{ {
@@ -453,12 +452,12 @@ namespace Game.Entities
if (cFamily != null && cFamily.MinScale > 0.0f && petType == PetType.Hunter) if (cFamily != null && cFamily.MinScale > 0.0f && petType == PetType.Hunter)
{ {
float scale; float scale;
if (getLevel() >= cFamily.MaxScaleLevel) if (GetLevel() >= cFamily.MaxScaleLevel)
scale = cFamily.MaxScale; scale = cFamily.MaxScale;
else if (getLevel() <= cFamily.MinScaleLevel) else if (GetLevel() <= cFamily.MinScaleLevel)
scale = cFamily.MinScale; scale = cFamily.MinScale;
else 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); SetObjectScale(scale);
} }
@@ -979,14 +978,14 @@ namespace Game.Entities
public Puppet(SummonPropertiesRecord properties, Unit owner) : base(properties, owner, false) public Puppet(SummonPropertiesRecord properties, Unit owner) : base(properties, owner, false)
{ {
Cypher.Assert(owner.IsTypeId(TypeId.Player)); Cypher.Assert(owner.IsTypeId(TypeId.Player));
m_unitTypeMask |= UnitTypeMask.Puppet; UnitTypeMask |= UnitTypeMask.Puppet;
} }
public override void InitStats(uint duration) public override void InitStats(uint duration)
{ {
base.InitStats(duration); base.InitStats(duration);
SetLevel(GetOwner().getLevel()); SetLevel(GetOwner().GetLevel());
SetReactState(ReactStates.Passive); SetReactState(ReactStates.Passive);
} }

Some files were not shown because too many files have changed in this diff Show More