More refactoring of code.

This commit is contained in:
hondacrx
2019-09-23 21:41:13 -04:00
parent 2418715800
commit 570aebce26
176 changed files with 2261 additions and 2265 deletions
+21 -21
View File
@@ -25,13 +25,13 @@ namespace Framework.Dynamic
FROM _RefFrom; FROM _RefFrom;
// Tell our refTo (target) object that we have a link // Tell our refTo (target) object that we have a link
public virtual void targetObjectBuildLink() { } public virtual void TargetObjectBuildLink() { }
// Tell our refTo (taget) object, that the link is cut // Tell our refTo (taget) object, that the link is cut
public virtual void targetObjectDestroyLink() { } public virtual void TargetObjectDestroyLink() { }
// Tell our refFrom (source) object, that the link is cut (Target destroyed) // Tell our refFrom (source) object, that the link is cut (Target destroyed)
public virtual void sourceObjectDestroyLink() { } public virtual void SourceObjectDestroyLink() { }
public Reference() public Reference()
{ {
@@ -39,24 +39,24 @@ namespace Framework.Dynamic
} }
// Create new link // Create new link
public void link(TO toObj, FROM fromObj) public void Link(TO toObj, FROM fromObj)
{ {
Cypher.Assert(fromObj != null); // fromObj MUST not be NULL Cypher.Assert(fromObj != null); // fromObj MUST not be NULL
if (isValid()) if (IsValid())
unlink(); Unlink();
if (toObj != null) if (toObj != null)
{ {
_RefTo = toObj; _RefTo = toObj;
_RefFrom = fromObj; _RefFrom = fromObj;
targetObjectBuildLink(); TargetObjectBuildLink();
} }
} }
// We don't need the reference anymore. Call comes from the refFrom object // We don't need the reference anymore. Call comes from the refFrom object
// Tell our refTo object, that the link is cut // Tell our refTo object, that the link is cut
public void unlink() public void Unlink()
{ {
targetObjectDestroyLink(); TargetObjectDestroyLink();
Delink(); Delink();
_RefTo = null; _RefTo = null;
_RefFrom = null; _RefFrom = null;
@@ -64,38 +64,38 @@ namespace Framework.Dynamic
// Link is invalid due to destruction of referenced target object. Call comes from the refTo object // Link is invalid due to destruction of referenced target object. Call comes from the refTo object
// Tell our refFrom object, that the link is cut // Tell our refFrom object, that the link is cut
public void invalidate() // the iRefFrom MUST remain!! public void Invalidate() // the iRefFrom MUST remain!!
{ {
sourceObjectDestroyLink(); SourceObjectDestroyLink();
Delink(); Delink();
_RefTo = null; _RefTo = null;
} }
public bool isValid() // Only check the iRefTo public bool IsValid() // Only check the iRefTo
{ {
return _RefTo != null; return _RefTo != null;
} }
public Reference<TO, FROM> next() { return ((Reference<TO, FROM>)GetNextElement()); } public Reference<TO, FROM> Next() { return ((Reference<TO, FROM>)GetNextElement()); }
public Reference<TO, FROM> prev() { return ((Reference<TO, FROM>)GetPrevElement()); } public Reference<TO, FROM> Prev() { return ((Reference<TO, FROM>)GetPrevElement()); }
public TO getTarget() { return _RefTo; } public TO GetTarget() { return _RefTo; }
public FROM GetSource() { return _RefFrom; } public FROM GetSource() { return _RefFrom; }
} }
public class RefManager<TO, FROM> : LinkedListHead where TO : class where FROM : class public class RefManager<TO, FROM> : LinkedListHead where TO : class where FROM : class
{ {
~RefManager() { clearReferences(); } ~RefManager() { ClearReferences(); }
public Reference<TO, FROM> getFirst() { return (Reference<TO, FROM>)base.GetFirstElement(); } public Reference<TO, FROM> GetFirst() { return (Reference<TO, FROM>)base.GetFirstElement(); }
public Reference<TO, FROM> getLast() { return (Reference<TO, FROM>)base.GetLastElement(); } public Reference<TO, FROM> GetLast() { return (Reference<TO, FROM>)base.GetLastElement(); }
public void clearReferences() public void ClearReferences()
{ {
Reference<TO, FROM> refe; Reference<TO, FROM> refe;
while ((refe = getFirst()) != null) while ((refe = GetFirst()) != null)
refe.invalidate(); refe.Invalidate();
} }
} }
} }
+3 -3
View File
@@ -73,8 +73,8 @@ namespace Game.AI
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)))
creature.GetAI().AttackStart(target); creature.GetAI().AttackStart(target);
} }
@@ -238,7 +238,7 @@ namespace Game.AI
return me.GetVictim() != null; return me.GetVictim() != null;
} }
else if (me.GetThreatManager().isThreatListEmpty()) else if (me.GetThreatManager().IsThreatListEmpty())
{ {
EnterEvadeMode(EvadeReason.NoHostiles); EnterEvadeMode(EvadeReason.NoHostiles);
return false; return false;
+2 -2
View File
@@ -37,9 +37,9 @@ namespace Game.AI
if (!obj.IsTypeMask(TypeMask.Unit)) if (!obj.IsTypeMask(TypeMask.Unit))
return false; return false;
var threatList = me.GetThreatManager().getThreatList(); var threatList = me.GetThreatManager().GetThreatList();
foreach (var refe in threatList) foreach (var refe in threatList)
if (refe.getUnitGuid() == obj.GetGUID()) if (refe.GetUnitGuid() == obj.GetGUID())
return true; return true;
return false; return false;
+4 -4
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;
} }
@@ -230,7 +230,7 @@ namespace Game.AI
SpellCastTargets targets = new SpellCastTargets(); SpellCastTargets targets = new SpellCastTargets();
targets.SetUnitTarget(target); targets.SetUnitTarget(target);
spell.prepare(targets); spell.Prepare(targets);
} }
// deleted cached Spell objects // deleted cached Spell objects
@@ -262,14 +262,14 @@ namespace Game.AI
return; return;
//owner is in group; group members filled in already (no raid . subgroupcount = whole count) //owner is in group; group members filled in already (no raid . subgroupcount = whole count)
if (group && !group.isRaidGroup() && m_AllySet.Count == (group.GetMembersCount() + 2)) if (group && !group.IsRaidGroup() && m_AllySet.Count == (group.GetMembersCount() + 2))
return; return;
m_AllySet.Clear(); m_AllySet.Clear();
m_AllySet.Add(me.GetGUID()); m_AllySet.Add(me.GetGUID());
if (group) //add group if (group) //add group
{ {
for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.next()) for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next())
{ {
Player target = refe.GetSource(); Player target = refe.GetSource();
if (!target || !target.IsInMap(owner) || !group.SameSubGroup(owner.ToPlayer(), target)) if (!target || !target.IsInMap(owner) || !group.SameSubGroup(owner.ToPlayer(), target))
+21 -21
View File
@@ -113,17 +113,17 @@ namespace Game.AI
// Select the targets satifying the predicate. // Select the targets satifying the predicate.
public Unit SelectTarget(SelectAggroTarget targetType, uint position, ISelector selector) public Unit SelectTarget(SelectAggroTarget targetType, uint position, ISelector selector)
{ {
var threatlist = GetThreatManager().getThreatList(); var threatlist = GetThreatManager().GetThreatList();
if (position >= threatlist.Count) if (position >= threatlist.Count)
return null; return null;
List<Unit> targetList = new List<Unit>(); List<Unit> targetList = new List<Unit>();
Unit currentVictim = null; Unit currentVictim = null;
var currentVictimReference = GetThreatManager().getCurrentVictim(); var currentVictimReference = GetThreatManager().GetCurrentVictim();
if (currentVictimReference != null) if (currentVictimReference != null)
{ {
currentVictim = currentVictimReference.getTarget(); currentVictim = currentVictimReference.GetTarget();
// Current victim always goes first // Current victim always goes first
if (currentVictim && selector.Check(currentVictim)) if (currentVictim && selector.Check(currentVictim))
@@ -132,10 +132,10 @@ namespace Game.AI
foreach (var hostileRef in threatlist) foreach (var hostileRef in threatlist)
{ {
if (currentVictim != null && hostileRef.getTarget() != currentVictim && selector.Check(hostileRef.getTarget())) if (currentVictim != null && hostileRef.GetTarget() != currentVictim && selector.Check(hostileRef.GetTarget()))
targetList.Add(hostileRef.getTarget()); targetList.Add(hostileRef.GetTarget());
else if (currentVictim == null && selector.Check(hostileRef.getTarget())) else if (currentVictim == null && selector.Check(hostileRef.GetTarget()))
targetList.Add(hostileRef.getTarget()); targetList.Add(hostileRef.GetTarget());
} }
if (position >= targetList.Count) if (position >= targetList.Count)
@@ -178,13 +178,13 @@ namespace Game.AI
{ {
var targetList = new List<Unit>(); var targetList = new List<Unit>();
var threatlist = GetThreatManager().getThreatList(); var threatlist = GetThreatManager().GetThreatList();
if (threatlist.Empty()) if (threatlist.Empty())
return targetList; return targetList;
foreach (var hostileRef in threatlist) foreach (var hostileRef in threatlist)
if (selector.Check(hostileRef.getTarget())) if (selector.Check(hostileRef.GetTarget()))
targetList.Add(hostileRef.getTarget()); targetList.Add(hostileRef.GetTarget());
if (targetList.Count < maxTargets) if (targetList.Count < maxTargets)
return targetList; return targetList;
@@ -368,15 +368,15 @@ namespace Game.AI
public virtual void HealDone(Unit to, uint addhealth) { } public virtual void HealDone(Unit to, uint addhealth) { }
public virtual void SpellInterrupted(uint spellId, uint unTimeMs) {} public virtual void SpellInterrupted(uint spellId, uint unTimeMs) {}
public virtual void sGossipHello(Player player) { } public virtual void GossipHello(Player player) { }
public virtual void sGossipSelect(Player player, uint menuId, uint gossipListId) { } public virtual void GossipSelect(Player player, uint menuId, uint gossipListId) { }
public virtual void sGossipSelectCode(Player player, uint menuId, uint gossipListId, string code) { } public virtual void GossipSelectCode(Player player, uint menuId, uint gossipListId, string code) { }
public virtual void sQuestAccept(Player player, Quest quest) { } public virtual void QuestAccept(Player player, Quest quest) { }
public virtual void sQuestSelect(Player player, Quest quest) { } public virtual void QuestSelect(Player player, Quest quest) { }
public virtual void sQuestComplete(Player player, Quest quest) { } public virtual void QuestComplete(Player player, Quest quest) { }
public virtual void sQuestReward(Player player, Quest quest, uint opt) { } public virtual void QuestReward(Player player, Quest quest, uint opt) { }
public virtual bool sOnDummyEffect(Unit caster, uint spellId, int effIndex) { return false; } public virtual bool OnDummyEffect(Unit caster, uint spellId, int effIndex) { return false; }
public virtual void sOnGameEvent(bool start, ushort eventId) { } public virtual void OnGameEvent(bool start, ushort eventId) { }
public static AISpellInfoType[] AISpellInfo; public static AISpellInfoType[] AISpellInfo;
@@ -552,9 +552,9 @@ namespace Game.AI
if (_playerOnly && !target.IsTypeId(TypeId.Player)) if (_playerOnly && !target.IsTypeId(TypeId.Player))
return false; return false;
HostileReference currentVictim = _source.GetThreatManager().getCurrentVictim(); HostileReference currentVictim = _source.GetThreatManager().GetCurrentVictim();
if (currentVictim != null) if (currentVictim != null)
return target.GetGUID() != currentVictim.getUnitGuid(); return target.GetGUID() != currentVictim.GetUnitGuid();
return target != _source.GetVictim(); return target != _source.GetVictim();
} }
+1 -1
View File
@@ -569,7 +569,7 @@ namespace Game.AI
{ {
SpellCastTargets targets = new SpellCastTargets(); SpellCastTargets targets = new SpellCastTargets();
targets.SetUnitTarget(spell.Item2); targets.SetUnitTarget(spell.Item2);
spell.Item1.prepare(targets); spell.Item1.Prepare(targets);
} }
void DoRangedAttackIfReady() void DoRangedAttackIfReady()
+7 -7
View File
@@ -184,17 +184,17 @@ namespace Game.AI
//Drops all threat to 0%. Does not remove players from the threat list //Drops all threat to 0%. Does not remove players from the threat list
public void DoResetThreat() public void DoResetThreat()
{ {
if (!me.CanHaveThreatList() || me.GetThreatManager().isThreatListEmpty()) if (!me.CanHaveThreatList() || me.GetThreatManager().IsThreatListEmpty())
{ {
Log.outError(LogFilter.Scripts, "DoResetThreat called for creature that either cannot have threat list or has empty threat list (me entry = {0})", me.GetEntry()); Log.outError(LogFilter.Scripts, "DoResetThreat called for creature that either cannot have threat list or has empty threat list (me entry = {0})", me.GetEntry());
return; return;
} }
var threatlist = me.GetThreatManager().getThreatList(); var threatlist = me.GetThreatManager().GetThreatList();
foreach (var refe in threatlist) foreach (var refe in threatlist)
{ {
Unit unit = Global.ObjAccessor.GetUnit(me, refe.getUnitGuid()); Unit unit = Global.ObjAccessor.GetUnit(me, refe.GetUnitGuid());
if (unit != null && DoGetThreat(unit) != 0) if (unit != null && DoGetThreat(unit) != 0)
DoModifyThreatPercent(unit, -100); DoModifyThreatPercent(unit, -100);
} }
@@ -204,14 +204,14 @@ namespace Game.AI
{ {
if (unit == null) if (unit == null)
return 0.0f; return 0.0f;
return me.GetThreatManager().getThreat(unit); return me.GetThreatManager().GetThreat(unit);
} }
public void DoModifyThreatPercent(Unit unit, int pct) public void DoModifyThreatPercent(Unit unit, int pct)
{ {
if (unit == null) if (unit == null)
return; return;
me.GetThreatManager().modifyThreatPercent(unit, pct); me.GetThreatManager().ModifyThreatPercent(unit, pct);
} }
void DoTeleportTo(float x, float y, float z, uint time = 0) void DoTeleportTo(float x, float y, float z, uint time = 0)
@@ -485,10 +485,10 @@ namespace Game.AI
float x, y, z; float x, y, z;
me.GetPosition(out x, out y, out z); me.GetPosition(out x, out y, out z);
var threatList = me.GetThreatManager().getThreatList(); var threatList = me.GetThreatManager().GetThreatList();
foreach (var refe in threatList) foreach (var refe in threatList)
{ {
Unit target = refe.getTarget(); Unit target = refe.GetTarget();
if (target) if (target)
if (target.IsTypeId(TypeId.Player) && !CheckBoundary(target)) if (target.IsTypeId(TypeId.Player) && !CheckBoundary(target))
target.NearTeleportTo(x, y, z, 0); target.NearTeleportTo(x, y, z, 0);
+26 -26
View File
@@ -24,14 +24,14 @@ using System.Linq;
namespace Game.AI namespace Game.AI
{ {
public class npc_escortAI : ScriptedAI public class NpcEscortAI : ScriptedAI
{ {
public npc_escortAI(Creature creature) : base(creature) public NpcEscortAI(Creature creature) : base(creature)
{ {
m_uiPlayerGUID = ObjectGuid.Empty; m_uiPlayerGUID = ObjectGuid.Empty;
m_uiWPWaitTimer = 2500; m_uiWPWaitTimer = 2500;
m_uiPlayerCheckTimer = 1000; m_uiPlayerCheckTimer = 1000;
m_uiEscortState = eEscortState.None; m_uiEscortState = EscortState.None;
MaxPlayerDistance = 50; MaxPlayerDistance = 50;
m_pQuestForEscort = null; m_pQuestForEscort = null;
m_bIsActiveAttacker = true; m_bIsActiveAttacker = true;
@@ -101,7 +101,7 @@ namespace Game.AI
{ {
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(EscortState.Escorting) && AssistPlayerInCombatAgainst(who))
return; return;
if (!me.CanFly() && me.GetDistanceZ(who) > SharedConst.CreatureAttackRangeZ) if (!me.CanFly() && me.GetDistanceZ(who) > SharedConst.CreatureAttackRangeZ)
@@ -135,7 +135,7 @@ namespace Game.AI
public override void JustDied(Unit killer) public override void JustDied(Unit killer)
{ {
if (!HasEscortState(eEscortState.Escorting) || m_uiPlayerGUID.IsEmpty() || m_pQuestForEscort == null) if (!HasEscortState(EscortState.Escorting) || m_uiPlayerGUID.IsEmpty() || m_pQuestForEscort == null)
return; return;
Player player = GetPlayerForEscort(); Player player = GetPlayerForEscort();
@@ -144,7 +144,7 @@ namespace Game.AI
Group group = player.GetGroup(); Group group = player.GetGroup();
if (group) if (group)
{ {
for (GroupReference groupRef = group.GetFirstMember(); groupRef != null; groupRef = groupRef.next()) for (GroupReference groupRef = group.GetFirstMember(); groupRef != null; groupRef = groupRef.Next())
{ {
Player member = groupRef.GetSource(); Player member = groupRef.GetSource();
if (member) if (member)
@@ -159,7 +159,7 @@ namespace Game.AI
public override void JustRespawned() public override void JustRespawned()
{ {
m_uiEscortState = eEscortState.None; m_uiEscortState = EscortState.None;
if (!IsCombatMovementAllowed()) if (!IsCombatMovementAllowed())
SetCombatMovement(true); SetCombatMovement(true);
@@ -185,9 +185,9 @@ namespace Game.AI
me.CombatStop(true); me.CombatStop(true);
me.SetLootRecipient(null); me.SetLootRecipient(null);
if (HasEscortState(eEscortState.Escorting)) if (HasEscortState(EscortState.Escorting))
{ {
AddEscortState(eEscortState.Returning); AddEscortState(EscortState.Returning);
ReturnToLastPoint(); ReturnToLastPoint();
Log.outDebug(LogFilter.Scripts, "EscortAI has left combat and is now returning to last point"); Log.outDebug(LogFilter.Scripts, "EscortAI has left combat and is now returning to last point");
} }
@@ -208,7 +208,7 @@ namespace Game.AI
Group group = player.GetGroup(); Group group = player.GetGroup();
if (group) if (group)
{ {
for (GroupReference groupRef = group.GetFirstMember(); groupRef != null; groupRef = groupRef.next()) for (GroupReference groupRef = group.GetFirstMember(); groupRef != null; groupRef = groupRef.Next())
{ {
Player member = groupRef.GetSource(); Player member = groupRef.GetSource();
if (member) if (member)
@@ -226,7 +226,7 @@ namespace Game.AI
public override void UpdateAI(uint diff) public override void UpdateAI(uint diff)
{ {
//Waypoint Updating //Waypoint Updating
if (HasEscortState(eEscortState.Escorting) && !me.GetVictim() && m_uiWPWaitTimer != 0 && !HasEscortState(eEscortState.Returning)) if (HasEscortState(EscortState.Escorting) && !me.GetVictim() && m_uiWPWaitTimer != 0 && !HasEscortState(EscortState.Returning))
{ {
if (m_uiWPWaitTimer <= diff) if (m_uiWPWaitTimer <= diff)
{ {
@@ -270,7 +270,7 @@ namespace Game.AI
} }
if (!HasEscortState(eEscortState.Paused)) if (!HasEscortState(EscortState.Paused))
{ {
var currentWp = WaypointList[CurrentWPIndex]; var currentWp = WaypointList[CurrentWPIndex];
me.GetMotionMaster().MovePoint(currentWp.Id, currentWp.X, currentWp.Y, currentWp.Z); me.GetMotionMaster().MovePoint(currentWp.Id, currentWp.X, currentWp.Y, currentWp.Z);
@@ -284,7 +284,7 @@ namespace Game.AI
} }
//Check if player or any member of his group is within range //Check if player or any member of his group is within range
if (HasEscortState(eEscortState.Escorting) && !m_uiPlayerGUID.IsEmpty() && !me.GetVictim() && !HasEscortState(eEscortState.Returning)) if (HasEscortState(EscortState.Escorting) && !m_uiPlayerGUID.IsEmpty() && !me.GetVictim() && !HasEscortState(EscortState.Returning))
{ {
if (m_uiPlayerCheckTimer <= diff) if (m_uiPlayerCheckTimer <= diff)
{ {
@@ -322,7 +322,7 @@ namespace Game.AI
public override void MovementInform(MovementGeneratorType moveType, uint pointId) public override void MovementInform(MovementGeneratorType moveType, uint pointId)
{ {
if (moveType != MovementGeneratorType.Point || !HasEscortState(eEscortState.Escorting)) if (moveType != MovementGeneratorType.Point || !HasEscortState(EscortState.Escorting))
return; return;
//Combat start position reached, continue waypoint movement //Combat start position reached, continue waypoint movement
@@ -331,7 +331,7 @@ namespace Game.AI
Log.outDebug(LogFilter.Scripts, "EscortAI has returned to original position before combat"); Log.outDebug(LogFilter.Scripts, "EscortAI has returned to original position before combat");
me.SetWalk(!m_bIsRunning); me.SetWalk(!m_bIsRunning);
RemoveEscortState(eEscortState.Returning); RemoveEscortState(EscortState.Returning);
if (m_uiWPWaitTimer == 0) if (m_uiWPWaitTimer == 0)
m_uiWPWaitTimer = 1; m_uiWPWaitTimer = 1;
@@ -415,7 +415,7 @@ namespace Game.AI
return; return;
} }
if (HasEscortState(eEscortState.Escorting)) if (HasEscortState(EscortState.Escorting))
{ {
Log.outError(LogFilter.Scripts, "EscortAI (script: {0}, creature entry: {1}) attempts to Start while already escorting", me.GetScriptName(), me.GetEntry()); Log.outError(LogFilter.Scripts, "EscortAI (script: {0}, creature entry: {1}) attempts to Start while already escorting", me.GetScriptName(), me.GetEntry());
return; return;
@@ -474,18 +474,18 @@ namespace Game.AI
else else
me.SetWalk(true); me.SetWalk(true);
AddEscortState(eEscortState.Escorting); AddEscortState(EscortState.Escorting);
} }
public void SetEscortPaused(bool on) public void SetEscortPaused(bool on)
{ {
if (!HasEscortState(eEscortState.Escorting)) if (!HasEscortState(EscortState.Escorting))
return; return;
if (on) if (on)
AddEscortState(eEscortState.Paused); AddEscortState(EscortState.Paused);
else else
RemoveEscortState(eEscortState.Paused); RemoveEscortState(EscortState.Paused);
} }
bool SetNextWaypoint(uint pointId, float x, float y, float z, float orientation) bool SetNextWaypoint(uint pointId, float x, float y, float z, float orientation)
@@ -557,8 +557,8 @@ namespace Game.AI
public virtual void WaypointReached(uint pointId) { } public virtual void WaypointReached(uint pointId) { }
public virtual void WaypointStart(uint pointId) { } public virtual void WaypointStart(uint pointId) { }
public bool HasEscortState(eEscortState escortState) { return m_uiEscortState.HasAnyFlag(escortState); } public bool HasEscortState(EscortState escortState) { return m_uiEscortState.HasAnyFlag(escortState); }
public override bool IsEscorted() { return m_uiEscortState.HasAnyFlag(eEscortState.Escorting); } public override bool IsEscorted() { return m_uiEscortState.HasAnyFlag(EscortState.Escorting); }
public void SetMaxPlayerDistance(float newMax) { MaxPlayerDistance = newMax; } public void SetMaxPlayerDistance(float newMax) { MaxPlayerDistance = newMax; }
public float GetMaxPlayerDistance() { return MaxPlayerDistance; } public float GetMaxPlayerDistance() { return MaxPlayerDistance; }
@@ -571,13 +571,13 @@ namespace Game.AI
public Player GetPlayerForEscort() { return Global.ObjAccessor.GetPlayer(me, m_uiPlayerGUID); } public Player GetPlayerForEscort() { return Global.ObjAccessor.GetPlayer(me, m_uiPlayerGUID); }
void AddEscortState(eEscortState escortState) { m_uiEscortState |= escortState; } void AddEscortState(EscortState escortState) { m_uiEscortState |= escortState; }
void RemoveEscortState(eEscortState escortState) { m_uiEscortState &= ~escortState; } void RemoveEscortState(EscortState escortState) { m_uiEscortState &= ~escortState; }
ObjectGuid m_uiPlayerGUID; ObjectGuid m_uiPlayerGUID;
uint m_uiWPWaitTimer; uint m_uiWPWaitTimer;
uint m_uiPlayerCheckTimer; uint m_uiPlayerCheckTimer;
eEscortState m_uiEscortState; EscortState m_uiEscortState;
float MaxPlayerDistance; float MaxPlayerDistance;
Quest m_pQuestForEscort; //generally passed in Start() when regular escort script. Quest m_pQuestForEscort; //generally passed in Start() when regular escort script.
@@ -595,7 +595,7 @@ namespace Game.AI
bool HasImmuneToNPCFlags; bool HasImmuneToNPCFlags;
} }
public enum eEscortState public enum EscortState
{ {
None = 0x000, //nothing in progress None = 0x000, //nothing in progress
Escorting = 0x001, //escort are in progress Escorting = 0x001, //escort are in progress
+26 -26
View File
@@ -22,7 +22,7 @@ using System;
namespace Game.AI namespace Game.AI
{ {
enum eFollowState enum FollowState
{ {
None = 0x000, None = 0x000,
Inprogress = 0x001, //must always have this state for any follow Inprogress = 0x001, //must always have this state for any follow
@@ -38,7 +38,7 @@ namespace Game.AI
public FollowerAI(Creature creature) : base(creature) public FollowerAI(Creature creature) : base(creature)
{ {
m_uiUpdateFollowTimer = 2500; m_uiUpdateFollowTimer = 2500;
m_uiFollowState = eFollowState.None; m_uiFollowState = FollowState.None;
m_pQuestForFollow = null; m_pQuestForFollow = null;
} }
@@ -105,7 +105,7 @@ namespace Game.AI
{ {
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(FollowState.Inprogress) && AssistPlayerInCombatAgainst(who))
return; return;
if (!me.CanFly() && me.GetDistanceZ(who) > SharedConst.CreatureAttackRangeZ) if (!me.CanFly() && me.GetDistanceZ(who) > SharedConst.CreatureAttackRangeZ)
@@ -139,7 +139,7 @@ namespace Game.AI
public override void JustDied(Unit killer) public override void JustDied(Unit killer)
{ {
if (!HasFollowState(eFollowState.Inprogress) || m_uiLeaderGUID.IsEmpty() || m_pQuestForFollow == null) if (!HasFollowState(FollowState.Inprogress) || m_uiLeaderGUID.IsEmpty() || m_pQuestForFollow == null)
return; return;
// @todo need a better check for quests with time limit. // @todo need a better check for quests with time limit.
@@ -149,7 +149,7 @@ namespace Game.AI
Group group = player.GetGroup(); Group group = player.GetGroup();
if (group) if (group)
{ {
for (GroupReference groupRef = group.GetFirstMember(); groupRef != null; groupRef = groupRef.next()) for (GroupReference groupRef = group.GetFirstMember(); groupRef != null; groupRef = groupRef.Next())
{ {
Player member = groupRef.GetSource(); Player member = groupRef.GetSource();
if (member) if (member)
@@ -164,7 +164,7 @@ namespace Game.AI
public override void JustRespawned() public override void JustRespawned()
{ {
m_uiFollowState = eFollowState.None; m_uiFollowState = FollowState.None;
if (!IsCombatMovementAllowed()) if (!IsCombatMovementAllowed())
SetCombatMovement(true); SetCombatMovement(true);
@@ -182,7 +182,7 @@ namespace Game.AI
me.CombatStop(true); me.CombatStop(true);
me.SetLootRecipient(null); me.SetLootRecipient(null);
if (HasFollowState(eFollowState.Inprogress)) if (HasFollowState(FollowState.Inprogress))
{ {
Log.outDebug(LogFilter.Scripts, "FollowerAI left combat, returning to CombatStartPosition."); Log.outDebug(LogFilter.Scripts, "FollowerAI left combat, returning to CombatStartPosition.");
@@ -204,11 +204,11 @@ namespace Game.AI
public override void UpdateAI(uint uiDiff) public override void UpdateAI(uint uiDiff)
{ {
if (HasFollowState(eFollowState.Inprogress) && !me.GetVictim()) if (HasFollowState(FollowState.Inprogress) && !me.GetVictim())
{ {
if (m_uiUpdateFollowTimer <= uiDiff) if (m_uiUpdateFollowTimer <= uiDiff)
{ {
if (HasFollowState(eFollowState.Complete) && !HasFollowState(eFollowState.PostEvent)) if (HasFollowState(FollowState.Complete) && !HasFollowState(FollowState.PostEvent))
{ {
Log.outDebug(LogFilter.Scripts, "FollowerAI is set completed, despawns."); Log.outDebug(LogFilter.Scripts, "FollowerAI is set completed, despawns.");
me.DespawnOrUnsummon(); me.DespawnOrUnsummon();
@@ -220,11 +220,11 @@ namespace Game.AI
Player player = GetLeaderForFollower(); Player player = GetLeaderForFollower();
if (player) if (player)
{ {
if (HasFollowState(eFollowState.Returning)) if (HasFollowState(FollowState.Returning))
{ {
Log.outDebug(LogFilter.Scripts, "FollowerAI is returning to leader."); Log.outDebug(LogFilter.Scripts, "FollowerAI is returning to leader.");
RemoveFollowState(eFollowState.Returning); RemoveFollowState(FollowState.Returning);
me.GetMotionMaster().MoveFollow(player, SharedConst.PetFollowDist, SharedConst.PetFollowAngle); me.GetMotionMaster().MoveFollow(player, SharedConst.PetFollowDist, SharedConst.PetFollowAngle);
return; return;
} }
@@ -232,7 +232,7 @@ namespace Game.AI
Group group = player.GetGroup(); Group group = player.GetGroup();
if (group) if (group)
{ {
for (GroupReference groupRef = group.GetFirstMember(); groupRef != null; groupRef = groupRef.next()) for (GroupReference groupRef = group.GetFirstMember(); groupRef != null; groupRef = groupRef.Next())
{ {
Player member = groupRef.GetSource(); Player member = groupRef.GetSource();
if (member && me.IsWithinDistInMap(member, 100.0f)) if (member && me.IsWithinDistInMap(member, 100.0f))
@@ -275,15 +275,15 @@ namespace Game.AI
public override void MovementInform(MovementGeneratorType motionType, uint pointId) public override void MovementInform(MovementGeneratorType motionType, uint pointId)
{ {
if (motionType != MovementGeneratorType.Point || !HasFollowState(eFollowState.Inprogress)) if (motionType != MovementGeneratorType.Point || !HasFollowState(FollowState.Inprogress))
return; return;
if (pointId == 0xFFFFFF) if (pointId == 0xFFFFFF)
{ {
if (GetLeaderForFollower()) if (GetLeaderForFollower())
{ {
if (!HasFollowState(eFollowState.Paused)) if (!HasFollowState(FollowState.Paused))
AddFollowState(eFollowState.Returning); AddFollowState(FollowState.Returning);
} }
else else
me.DespawnOrUnsummon(); me.DespawnOrUnsummon();
@@ -298,7 +298,7 @@ namespace Game.AI
return; return;
} }
if (HasFollowState(eFollowState.Inprogress)) if (HasFollowState(FollowState.Inprogress))
{ {
Log.outError(LogFilter.Scenario, "FollowerAI attempt to StartFollow while already following."); Log.outError(LogFilter.Scenario, "FollowerAI attempt to StartFollow while already following.");
return; return;
@@ -322,7 +322,7 @@ namespace Game.AI
me.SetNpcFlags(NPCFlags.None); me.SetNpcFlags(NPCFlags.None);
me.SetNpcFlags2(NPCFlags2.None); me.SetNpcFlags2(NPCFlags2.None);
AddFollowState(eFollowState.Inprogress); AddFollowState(FollowState.Inprogress);
me.GetMotionMaster().MoveFollow(player, SharedConst.PetFollowDist, SharedConst.PetFollowAngle); me.GetMotionMaster().MoveFollow(player, SharedConst.PetFollowDist, SharedConst.PetFollowAngle);
@@ -341,7 +341,7 @@ namespace Game.AI
Group group = player.GetGroup(); Group group = player.GetGroup();
if (group) if (group)
{ {
for (GroupReference groupRef = group.GetFirstMember(); groupRef != null; groupRef = groupRef.next()) for (GroupReference groupRef = group.GetFirstMember(); groupRef != null; groupRef = groupRef.Next())
{ {
Player member = groupRef.GetSource(); Player member = groupRef.GetSource();
if (member && me.IsWithinDistInMap(member, 100.0f) && member.IsAlive()) if (member && me.IsWithinDistInMap(member, 100.0f) && member.IsAlive())
@@ -371,24 +371,24 @@ namespace Game.AI
} }
if (bWithEndEvent) if (bWithEndEvent)
AddFollowState(eFollowState.PostEvent); AddFollowState(FollowState.PostEvent);
else else
{ {
if (HasFollowState(eFollowState.PostEvent)) if (HasFollowState(FollowState.PostEvent))
RemoveFollowState(eFollowState.PostEvent); RemoveFollowState(FollowState.PostEvent);
} }
AddFollowState(eFollowState.Complete); AddFollowState(FollowState.Complete);
} }
bool HasFollowState(eFollowState uiFollowState) { return (m_uiFollowState & uiFollowState) != 0; } bool HasFollowState(FollowState uiFollowState) { return (m_uiFollowState & uiFollowState) != 0; }
void AddFollowState(eFollowState uiFollowState) { m_uiFollowState |= uiFollowState; } void AddFollowState(FollowState uiFollowState) { m_uiFollowState |= uiFollowState; }
void RemoveFollowState(eFollowState uiFollowState) { m_uiFollowState &= ~uiFollowState; } void RemoveFollowState(FollowState uiFollowState) { m_uiFollowState &= ~uiFollowState; }
ObjectGuid m_uiLeaderGUID; ObjectGuid m_uiLeaderGUID;
uint m_uiUpdateFollowTimer; uint m_uiUpdateFollowTimer;
eFollowState m_uiFollowState; FollowState m_uiFollowState;
Quest m_pQuestForFollow; //normally we have a quest Quest m_pQuestForFollow; //normally we have a quest
} }
+9 -9
View File
@@ -235,7 +235,7 @@ namespace Game.AI
Group group = player.GetGroup(); Group group = player.GetGroup();
if (group) if (group)
{ {
for (GroupReference groupRef = group.GetFirstMember(); groupRef != null; groupRef = groupRef.next()) for (GroupReference groupRef = group.GetFirstMember(); groupRef != null; groupRef = groupRef.Next())
{ {
Player groupGuy = groupRef.GetSource(); Player groupGuy = groupRef.GetSource();
if (!groupGuy.IsInMap(player)) if (!groupGuy.IsInMap(player))
@@ -399,7 +399,7 @@ namespace Game.AI
Group group = player.GetGroup(); Group group = player.GetGroup();
if (group) if (group)
{ {
for (GroupReference groupRef = group.GetFirstMember(); groupRef != null; groupRef = groupRef.next()) for (GroupReference groupRef = group.GetFirstMember(); groupRef != null; groupRef = groupRef.Next())
{ {
Player groupGuy = groupRef.GetSource(); Player groupGuy = groupRef.GetSource();
if (groupGuy.IsInMap(player) && me.GetDistance(groupGuy) <= checkDist) if (groupGuy.IsInMap(player) && me.GetDistance(groupGuy) <= checkDist)
@@ -800,29 +800,29 @@ namespace Game.AI
mEvadeDisabled = disable; mEvadeDisabled = disable;
} }
public override void sGossipHello(Player player) public override void GossipHello(Player player)
{ {
GetScript().ProcessEventsFor(SmartEvents.GossipHello, player); GetScript().ProcessEventsFor(SmartEvents.GossipHello, player);
} }
public override void sGossipSelect(Player player, uint menuId, uint gossipListId) public override void GossipSelect(Player player, uint menuId, uint gossipListId)
{ {
GetScript().ProcessEventsFor(SmartEvents.GossipSelect, player, menuId, gossipListId); GetScript().ProcessEventsFor(SmartEvents.GossipSelect, player, menuId, gossipListId);
} }
public override void sGossipSelectCode(Player player, uint menuId, uint gossipListId, string code) { } public override void GossipSelectCode(Player player, uint menuId, uint gossipListId, string code) { }
public override void sQuestAccept(Player player, Quest quest) public override void QuestAccept(Player player, Quest quest)
{ {
GetScript().ProcessEventsFor(SmartEvents.AcceptedQuest, player, quest.Id); GetScript().ProcessEventsFor(SmartEvents.AcceptedQuest, player, quest.Id);
} }
public override void sQuestReward(Player player, Quest quest, uint opt) public override void QuestReward(Player player, Quest quest, uint opt)
{ {
GetScript().ProcessEventsFor(SmartEvents.RewardQuest, player, quest.Id, opt); GetScript().ProcessEventsFor(SmartEvents.RewardQuest, player, quest.Id, opt);
} }
public override bool sOnDummyEffect(Unit caster, uint spellId, int effIndex) public override bool OnDummyEffect(Unit caster, uint spellId, int effIndex)
{ {
GetScript().ProcessEventsFor(SmartEvents.DummyEffect, caster, spellId, (uint)effIndex); GetScript().ProcessEventsFor(SmartEvents.DummyEffect, caster, spellId, (uint)effIndex);
return true; return true;
@@ -916,7 +916,7 @@ namespace Game.AI
GetScript().SetScript9(e, entry); GetScript().SetScript9(e, entry);
} }
public override void sOnGameEvent(bool start, ushort eventId) public override void OnGameEvent(bool start, ushort eventId)
{ {
GetScript().ProcessEventsFor(start ? SmartEvents.GameEventStart : SmartEvents.GameEventEnd, null, eventId); GetScript().ProcessEventsFor(start ? SmartEvents.GameEventStart : SmartEvents.GameEventEnd, null, eventId);
} }
@@ -660,7 +660,7 @@ namespace Game.AI
case SmartEvents.GameEventEnd: case SmartEvents.GameEventEnd:
{ {
var events = Global.GameEventMgr.GetEventMap(); var events = Global.GameEventMgr.GetEventMap();
if (e.Event.gameEvent.gameEventId >= events.Length || !events[e.Event.gameEvent.gameEventId].isValid()) if (e.Event.gameEvent.gameEventId >= events.Length || !events[e.Event.gameEvent.gameEventId].IsValid())
return false; return false;
break; break;
@@ -1139,7 +1139,7 @@ namespace Game.AI
} }
GameEventData eventData = events[eventId]; GameEventData eventData = events[eventId];
if (!eventData.isValid()) if (!eventData.IsValid())
{ {
Log.outError(LogFilter.Sql, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent event, eventId {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.Action.gameEventStop.id); Log.outError(LogFilter.Sql, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent event, eventId {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.Action.gameEventStop.id);
return false; return false;
@@ -1158,7 +1158,7 @@ namespace Game.AI
} }
GameEventData eventData = events[eventId]; GameEventData eventData = events[eventId];
if (!eventData.isValid()) if (!eventData.IsValid())
{ {
Log.outError(LogFilter.Sql, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent event, eventId {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.Action.gameEventStart.id); Log.outError(LogFilter.Sql, "SmartAIMgr: Entry {0} SourceType {1} Event {2} Action {3} uses non-existent event, eventId {4}, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.Action.gameEventStart.id);
return false; return false;
+8 -8
View File
@@ -392,13 +392,13 @@ namespace Game.AI
if (me == null) if (me == null)
break; break;
var threatList = me.GetThreatManager().getThreatList(); var threatList = me.GetThreatManager().GetThreatList();
foreach (var refe in threatList) foreach (var refe in threatList)
{ {
Unit target = Global.ObjAccessor.GetUnit(me, refe.getUnitGuid()); Unit target = Global.ObjAccessor.GetUnit(me, refe.GetUnitGuid());
if (target != null) if (target != null)
{ {
me.GetThreatManager().modifyThreatPercent(target, e.Action.threatPCT.threatINC != 0 ? (int)e.Action.threatPCT.threatINC : -(int)e.Action.threatPCT.threatDEC); me.GetThreatManager().ModifyThreatPercent(target, e.Action.threatPCT.threatINC != 0 ? (int)e.Action.threatPCT.threatINC : -(int)e.Action.threatPCT.threatDEC);
Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction. SMART_ACTION_THREAT_ALL_PCT: Creature guidLow {0} modify threat for unit {1}, value {2}", Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction. SMART_ACTION_THREAT_ALL_PCT: Creature guidLow {0} modify threat for unit {1}, value {2}",
me.GetGUID().ToString(), target.GetGUID().ToString(), e.Action.threatPCT.threatINC != 0 ? (int)e.Action.threatPCT.threatINC : -(int)e.Action.threatPCT.threatDEC); me.GetGUID().ToString(), target.GetGUID().ToString(), e.Action.threatPCT.threatINC != 0 ? (int)e.Action.threatPCT.threatINC : -(int)e.Action.threatPCT.threatDEC);
} }
@@ -418,7 +418,7 @@ namespace Game.AI
{ {
if (IsUnit(obj)) if (IsUnit(obj))
{ {
me.GetThreatManager().modifyThreatPercent(obj.ToUnit(), e.Action.threatPCT.threatINC != 0 ? (int)e.Action.threatPCT.threatINC : -(int)e.Action.threatPCT.threatDEC); me.GetThreatManager().ModifyThreatPercent(obj.ToUnit(), e.Action.threatPCT.threatINC != 0 ? (int)e.Action.threatPCT.threatINC : -(int)e.Action.threatPCT.threatDEC);
Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction. SMART_ACTION_THREAT_SINGLE_PCT: Creature guidLow {0} modify threat for unit {1}, value {2}", Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction. SMART_ACTION_THREAT_SINGLE_PCT: Creature guidLow {0} modify threat for unit {1}, value {2}",
me.GetGUID().ToString(), obj.GetGUID().ToString(), e.Action.threatPCT.threatINC != 0 ? (int)e.Action.threatPCT.threatINC : -(int)e.Action.threatPCT.threatDEC); me.GetGUID().ToString(), obj.GetGUID().ToString(), e.Action.threatPCT.threatINC != 0 ? (int)e.Action.threatPCT.threatINC : -(int)e.Action.threatPCT.threatDEC);
} }
@@ -2913,7 +2913,7 @@ namespace Game.AI
Group group = player.GetGroup(); Group group = player.GetGroup();
if (group) if (group)
{ {
for (GroupReference groupRef = group.GetFirstMember(); groupRef != null; groupRef = groupRef.next()) for (GroupReference groupRef = group.GetFirstMember(); groupRef != null; groupRef = groupRef.Next())
{ {
Player member = groupRef.GetSource(); Player member = groupRef.GetSource();
if (member) if (member)
@@ -3118,10 +3118,10 @@ namespace Game.AI
{ {
if (me != null) if (me != null)
{ {
var threatList = me.GetThreatManager().getThreatList(); var threatList = me.GetThreatManager().GetThreatList();
foreach (var i in threatList) foreach (var i in threatList)
{ {
Unit temp = Global.ObjAccessor.GetUnit(me, i.getUnitGuid()); Unit temp = Global.ObjAccessor.GetUnit(me, i.GetUnitGuid());
if (temp != null) if (temp != null)
if (e.Target.hostilRandom.maxDist == 0 || me.IsWithinCombatRange(temp, (float)e.Target.hostilRandom.maxDist)) if (e.Target.hostilRandom.maxDist == 0 || me.IsWithinCombatRange(temp, (float)e.Target.hostilRandom.maxDist))
l.Add(temp); l.Add(temp);
@@ -3157,7 +3157,7 @@ namespace Game.AI
Group lootGroup = me.GetLootRecipientGroup(); Group lootGroup = me.GetLootRecipientGroup();
if (lootGroup) if (lootGroup)
{ {
for (GroupReference refe = lootGroup.GetFirstMember(); refe != null; refe = refe.next()) for (GroupReference refe = lootGroup.GetFirstMember(); refe != null; refe = refe.Next())
{ {
Player recipient = refe.GetSource(); Player recipient = refe.GetSource();
if (recipient) if (recipient)
@@ -940,7 +940,7 @@ namespace Game.Achievements
Group group = referencePlayer.GetGroup(); Group group = referencePlayer.GetGroup();
if (group) if (group)
{ {
for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.next()) for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next())
{ {
Player groupMember = refe.GetSource(); Player groupMember = refe.GetSource();
if (groupMember) if (groupMember)
+1 -1
View File
@@ -1292,7 +1292,7 @@ namespace Game.Achievements
case CriteriaAdditionalCondition.ArenaType: // 24 case CriteriaAdditionalCondition.ArenaType: // 24
{ {
Battleground bg = referencePlayer.GetBattleground(); Battleground bg = referencePlayer.GetBattleground();
if (!bg || !bg.isArena() || bg.GetArenaType() != (ArenaTypes)reqValue) if (!bg || !bg.IsArena() || bg.GetArenaType() != (ArenaTypes)reqValue)
return false; return false;
break; break;
} }
+3 -3
View File
@@ -99,7 +99,7 @@ namespace Game.Arenas
{ {
base.BuildPvPLogDataPacket(out pvpLogData); base.BuildPvPLogDataPacket(out pvpLogData);
if (isRated()) if (IsRated())
{ {
pvpLogData.Ratings.HasValue = true; pvpLogData.Ratings.HasValue = true;
@@ -114,7 +114,7 @@ namespace Game.Arenas
public override void RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool SendPacket) public override void RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool SendPacket)
{ {
if (isRated() && GetStatus() == BattlegroundStatus.InProgress) if (IsRated() && GetStatus() == BattlegroundStatus.InProgress)
{ {
var bgPlayer = GetPlayers().LookupByKey(guid); var bgPlayer = GetPlayers().LookupByKey(guid);
if (bgPlayer != null) // check if the player was a participant of the match, or only entered through gm command (appear) if (bgPlayer != null) // check if the player was a participant of the match, or only entered through gm command (appear)
@@ -151,7 +151,7 @@ namespace Game.Arenas
public override void EndBattleground(Team winner) public override void EndBattleground(Team winner)
{ {
// arena rating calculation // arena rating calculation
if (isRated()) if (IsRated())
{ {
uint loserTeamRating = 0; uint loserTeamRating = 0;
uint loserMatchmakerRating = 0; uint loserMatchmakerRating = 0;
+21 -21
View File
@@ -61,27 +61,27 @@ namespace Game.BattleFields
m_saveTimer = 60000; m_saveTimer = 60000;
// Load from db // Load from db
if ((Global.WorldMgr.getWorldState(WGWorldStates.Active) == 0) && (Global.WorldMgr.getWorldState(WGWorldStates.Defender) == 0) && (Global.WorldMgr.getWorldState(WGConst.ClockWorldState[0]) == 0)) if ((Global.WorldMgr.GetWorldState(WGWorldStates.Active) == 0) && (Global.WorldMgr.GetWorldState(WGWorldStates.Defender) == 0) && (Global.WorldMgr.GetWorldState(WGConst.ClockWorldState[0]) == 0))
{ {
Global.WorldMgr.setWorldState(WGWorldStates.Active, 0); Global.WorldMgr.SetWorldState(WGWorldStates.Active, 0);
Global.WorldMgr.setWorldState(WGWorldStates.Defender, RandomHelper.URand(0, 1)); Global.WorldMgr.SetWorldState(WGWorldStates.Defender, RandomHelper.URand(0, 1));
Global.WorldMgr.setWorldState(WGConst.ClockWorldState[0], m_NoWarBattleTime); Global.WorldMgr.SetWorldState(WGConst.ClockWorldState[0], m_NoWarBattleTime);
} }
m_isActive = Global.WorldMgr.getWorldState(WGWorldStates.Active) != 0; m_isActive = Global.WorldMgr.GetWorldState(WGWorldStates.Active) != 0;
m_DefenderTeam = Global.WorldMgr.getWorldState(WGWorldStates.Defender); m_DefenderTeam = Global.WorldMgr.GetWorldState(WGWorldStates.Defender);
m_Timer = Global.WorldMgr.getWorldState(WGConst.ClockWorldState[0]); m_Timer = Global.WorldMgr.GetWorldState(WGConst.ClockWorldState[0]);
if (m_isActive) if (m_isActive)
{ {
m_isActive = false; m_isActive = false;
m_Timer = m_RestartAfterCrash; m_Timer = m_RestartAfterCrash;
} }
SetData(WGData.WonA, Global.WorldMgr.getWorldState(WGWorldStates.AttackedA)); SetData(WGData.WonA, Global.WorldMgr.GetWorldState(WGWorldStates.AttackedA));
SetData(WGData.DefA, Global.WorldMgr.getWorldState(WGWorldStates.DefendedA)); SetData(WGData.DefA, Global.WorldMgr.GetWorldState(WGWorldStates.DefendedA));
SetData(WGData.WonH, Global.WorldMgr.getWorldState(WGWorldStates.AttackedH)); SetData(WGData.WonH, Global.WorldMgr.GetWorldState(WGWorldStates.AttackedH));
SetData(WGData.DefH, Global.WorldMgr.getWorldState(WGWorldStates.DefendedH)); SetData(WGData.DefH, Global.WorldMgr.GetWorldState(WGWorldStates.DefendedH));
foreach (var gy in WGConst.WGGraveYard) foreach (var gy in WGConst.WGGraveYard)
{ {
@@ -163,13 +163,13 @@ namespace Game.BattleFields
bool m_return = base.Update(diff); bool m_return = base.Update(diff);
if (m_saveTimer <= diff) if (m_saveTimer <= diff)
{ {
Global.WorldMgr.setWorldState(WGWorldStates.Active, m_isActive); Global.WorldMgr.SetWorldState(WGWorldStates.Active, m_isActive);
Global.WorldMgr.setWorldState(WGWorldStates.Defender, m_DefenderTeam); Global.WorldMgr.SetWorldState(WGWorldStates.Defender, m_DefenderTeam);
Global.WorldMgr.setWorldState(WGConst.ClockWorldState[0], m_Timer); Global.WorldMgr.SetWorldState(WGConst.ClockWorldState[0], m_Timer);
Global.WorldMgr.setWorldState(WGWorldStates.AttackedA, GetData(WGData.WonA)); Global.WorldMgr.SetWorldState(WGWorldStates.AttackedA, GetData(WGData.WonA));
Global.WorldMgr.setWorldState(WGWorldStates.DefendedA, GetData(WGData.DefA)); Global.WorldMgr.SetWorldState(WGWorldStates.DefendedA, GetData(WGData.DefA));
Global.WorldMgr.setWorldState(WGWorldStates.AttackedH, GetData(WGData.WonH)); Global.WorldMgr.SetWorldState(WGWorldStates.AttackedH, GetData(WGData.WonH));
Global.WorldMgr.setWorldState(WGWorldStates.DefendedH, GetData(WGData.DefH)); Global.WorldMgr.SetWorldState(WGWorldStates.DefendedH, GetData(WGData.DefH));
m_saveTimer = 60 * Time.InMilliseconds; m_saveTimer = 60 * Time.InMilliseconds;
} }
else else
@@ -1194,7 +1194,7 @@ namespace Game.BattleFields
break; break;
} }
_state = (WGGameObjectState)Global.WorldMgr.getWorldState(_worldState); _state = (WGGameObjectState)Global.WorldMgr.GetWorldState(_worldState);
switch (_state) switch (_state)
{ {
case WGGameObjectState.NeutralIntact: case WGGameObjectState.NeutralIntact:
@@ -1449,7 +1449,7 @@ namespace Game.BattleFields
public void Save() public void Save()
{ {
Global.WorldMgr.setWorldState(_worldState, (ulong)_state); Global.WorldMgr.SetWorldState(_worldState, (ulong)_state);
} }
public ObjectGuid GetGUID() { return _buildGUID; } public ObjectGuid GetGUID() { return _buildGUID; }
@@ -1568,7 +1568,7 @@ namespace Game.BattleFields
public void Save() public void Save()
{ {
Global.WorldMgr.setWorldState(_staticInfo.WorldStateId, (uint)_state); Global.WorldMgr.SetWorldState(_staticInfo.WorldStateId, (uint)_state);
} }
public uint GetTeamControl() { return _teamControl; } public uint GetTeamControl() { return _teamControl; }
+22 -22
View File
@@ -116,7 +116,7 @@ namespace Game.BattleGrounds
_ProcessOfflineQueue(); _ProcessOfflineQueue();
_ProcessPlayerPositionBroadcast(diff); _ProcessPlayerPositionBroadcast(diff);
// after 47 Time.Minutes without one team losing, the arena closes with no winner and no rating change // after 47 Time.Minutes without one team losing, the arena closes with no winner and no rating change
if (isArena()) if (IsArena())
{ {
if (GetElapsedTime() >= 47 * Time.Minute * Time.InMilliseconds) if (GetElapsedTime() >= 47 * Time.Minute * Time.InMilliseconds)
{ {
@@ -298,7 +298,7 @@ namespace Game.BattleGrounds
EndBattleground(GetPrematureWinner()); EndBattleground(GetPrematureWinner());
m_PrematureCountDown = false; m_PrematureCountDown = false;
} }
else if (!Global.BattlegroundMgr.isTesting()) else if (!Global.BattlegroundMgr.IsTesting())
{ {
uint newtime = m_PrematureCountDownTimer - diff; uint newtime = m_PrematureCountDownTimer - diff;
// announce every Time.Minute // announce every Time.Minute
@@ -324,7 +324,7 @@ namespace Game.BattleGrounds
// ********************************************************* // *********************************************************
ModifyStartDelayTime((int)diff); ModifyStartDelayTime((int)diff);
if (!isArena()) if (!IsArena())
SetRemainingTime(300000); SetRemainingTime(300000);
if (m_ResetStatTimer > 5000) if (m_ResetStatTimer > 5000)
@@ -341,7 +341,7 @@ namespace Game.BattleGrounds
// Send packet every 10 seconds until the 2nd field reach 0 // Send packet every 10 seconds until the 2nd field reach 0
if (m_CountdownTimer >= 10000) if (m_CountdownTimer >= 10000)
{ {
uint countdownMaxForBGType = isArena() ? BattlegroundConst.ArenaCountdownMax : BattlegroundConst.BattlegroundCountdownMax; uint countdownMaxForBGType = IsArena() ? BattlegroundConst.ArenaCountdownMax : BattlegroundConst.BattlegroundCountdownMax;
StartTimer timer = new StartTimer(); StartTimer timer = new StartTimer();
timer.Type = TimerType.Pvp; timer.Type = TimerType.Pvp;
@@ -409,7 +409,7 @@ namespace Game.BattleGrounds
SetStartDelayTime(StartDelayTimes[BattlegroundConst.EventIdFourth]); SetStartDelayTime(StartDelayTimes[BattlegroundConst.EventIdFourth]);
// Remove preparation // Remove preparation
if (isArena()) if (IsArena())
{ {
//todo add arena sound PlaySoundToAll(SOUND_ARENA_START); //todo add arena sound PlaySoundToAll(SOUND_ARENA_START);
foreach (var guid in GetPlayers().Keys) foreach (var guid in GetPlayers().Keys)
@@ -655,7 +655,7 @@ namespace Game.BattleGrounds
if (winner == Team.Alliance) if (winner == Team.Alliance)
{ {
if (isBattleground()) if (IsBattleground())
SendBroadcastText(BattlegroundBroadcastTexts.AllianceWins, ChatMsg.BgSystemNeutral); SendBroadcastText(BattlegroundBroadcastTexts.AllianceWins, ChatMsg.BgSystemNeutral);
PlaySoundToAll((uint)BattlegroundSounds.AllianceWins); PlaySoundToAll((uint)BattlegroundSounds.AllianceWins);
@@ -663,7 +663,7 @@ namespace Game.BattleGrounds
} }
else if (winner == Team.Horde) else if (winner == Team.Horde)
{ {
if (isBattleground()) if (IsBattleground())
SendBroadcastText(BattlegroundBroadcastTexts.HordeWins, ChatMsg.BgSystemNeutral); SendBroadcastText(BattlegroundBroadcastTexts.HordeWins, ChatMsg.BgSystemNeutral);
PlaySoundToAll((uint)BattlegroundSounds.HordeWins); PlaySoundToAll((uint)BattlegroundSounds.HordeWins);
@@ -676,7 +676,7 @@ namespace Game.BattleGrounds
PreparedStatement stmt = null; PreparedStatement stmt = null;
ulong battlegroundId = 1; ulong battlegroundId = 1;
if (isBattleground() && WorldConfig.GetBoolValue(WorldCfg.BattlegroundStoreStatisticsEnable)) if (IsBattleground() && WorldConfig.GetBoolValue(WorldCfg.BattlegroundStoreStatisticsEnable))
{ {
stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_PVPSTATS_MAXID); stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_PVPSTATS_MAXID);
SQLResult result = DB.Characters.Query(stmt); SQLResult result = DB.Characters.Query(stmt);
@@ -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
@@ -732,7 +732,7 @@ namespace Game.BattleGrounds
uint winnerKills = player.GetRandomWinner() ? WorldConfig.GetUIntValue(WorldCfg.BgRewardWinnerHonorLast) : WorldConfig.GetUIntValue(WorldCfg.BgRewardWinnerHonorFirst); uint winnerKills = player.GetRandomWinner() ? WorldConfig.GetUIntValue(WorldCfg.BgRewardWinnerHonorLast) : WorldConfig.GetUIntValue(WorldCfg.BgRewardWinnerHonorFirst);
uint loserKills = player.GetRandomWinner() ? WorldConfig.GetUIntValue(WorldCfg.BgRewardLoserHonorLast) : WorldConfig.GetUIntValue(WorldCfg.BgRewardLoserHonorFirst); uint loserKills = player.GetRandomWinner() ? WorldConfig.GetUIntValue(WorldCfg.BgRewardLoserHonorLast) : WorldConfig.GetUIntValue(WorldCfg.BgRewardLoserHonorFirst);
if (isBattleground() && WorldConfig.GetBoolValue(WorldCfg.BattlegroundStoreStatisticsEnable)) if (IsBattleground() && WorldConfig.GetBoolValue(WorldCfg.BattlegroundStoreStatisticsEnable))
{ {
stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_PVPSTATS_PLAYER); stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_PVPSTATS_PLAYER);
var score = PlayerScores.LookupByKey(player.GetGUID()); var score = PlayerScores.LookupByKey(player.GetGUID());
@@ -810,7 +810,7 @@ namespace Game.BattleGrounds
{ {
//variable kills means how many honorable kills you scored (so we need kills * honor_for_one_kill) //variable kills means how many honorable kills you scored (so we need kills * honor_for_one_kill)
uint maxLevel = Math.Min(GetMaxLevel(), 80U); uint maxLevel = Math.Min(GetMaxLevel(), 80U);
return Formulas.hk_honor_at_level(maxLevel, kills); return Formulas.HKHonorAtLevel(maxLevel, kills);
} }
void BlockMovement(Player player) void BlockMovement(Player player)
@@ -867,7 +867,7 @@ namespace Game.BattleGrounds
player.ClearAfkReports(); player.ClearAfkReports();
// if arena, remove the specific arena auras // if arena, remove the specific arena auras
if (isArena()) if (IsArena())
{ {
bgTypeId = BattlegroundTypeId.AA; // set the bg type to all arenas (it will be used for queue refreshing) bgTypeId = BattlegroundTypeId.AA; // set the bg type to all arenas (it will be used for queue refreshing)
@@ -895,7 +895,7 @@ namespace Game.BattleGrounds
} }
DecreaseInvitedCount(team); DecreaseInvitedCount(team);
//we should update Battleground queue, but only if bg isn't ending //we should update Battleground queue, but only if bg isn't ending
if (isBattleground() && GetStatus() < BattlegroundStatus.WaitLeave) if (IsBattleground() && GetStatus() < BattlegroundStatus.WaitLeave)
{ {
// a player has left the Battleground, so there are free slots . add to queue // a player has left the Battleground, so there are free slots . add to queue
AddToBGFreeSlotQueue(); AddToBGFreeSlotQueue();
@@ -1007,7 +1007,7 @@ namespace Game.BattleGrounds
player.RemoveAurasByType(AuraType.Mounted); player.RemoveAurasByType(AuraType.Mounted);
// add arena specific auras // add arena specific auras
if (isArena()) if (IsArena())
{ {
player.RemoveArenaEnchantments(EnchantmentSlot.Temp); player.RemoveArenaEnchantments(EnchantmentSlot.Temp);
@@ -1026,7 +1026,7 @@ namespace Game.BattleGrounds
{ {
player.CastSpell(player, BattlegroundConst.SpellPreparation, true); // reduces all mana cost of spells. player.CastSpell(player, BattlegroundConst.SpellPreparation, true); // reduces all mana cost of spells.
uint countdownMaxForBGType = isArena() ? BattlegroundConst.ArenaCountdownMax : BattlegroundConst.BattlegroundCountdownMax; uint countdownMaxForBGType = IsArena() ? BattlegroundConst.ArenaCountdownMax : BattlegroundConst.BattlegroundCountdownMax;
StartTimer timer = new StartTimer(); StartTimer timer = new StartTimer();
timer.Type = TimerType.Pvp; timer.Type = TimerType.Pvp;
timer.TimeRemaining = countdownMaxForBGType - (GetElapsedTime() / 1000); timer.TimeRemaining = countdownMaxForBGType - (GetElapsedTime() / 1000);
@@ -1120,7 +1120,7 @@ namespace Game.BattleGrounds
RemovePlayer(player, guid, GetPlayerTeam(guid)); RemovePlayer(player, guid, GetPlayerTeam(guid));
// 1 player is logging out, if it is the last, then end arena! // 1 player is logging out, if it is the last, then end arena!
if (isArena()) if (IsArena())
if (GetAlivePlayersCountByTeam(player.GetBGTeam()) <= 1 && GetPlayersCountByTeam(GetOtherTeam(player.GetBGTeam())) != 0) if (GetAlivePlayersCountByTeam(player.GetBGTeam()) <= 1 && GetPlayersCountByTeam(GetOtherTeam(player.GetBGTeam())) != 0)
EndBattleground(GetOtherTeam(player.GetBGTeam())); EndBattleground(GetOtherTeam(player.GetBGTeam()));
} }
@@ -1129,7 +1129,7 @@ namespace Game.BattleGrounds
// This method should be called only once ... it adds pointer to queue // This method should be called only once ... it adds pointer to queue
void AddToBGFreeSlotQueue() void AddToBGFreeSlotQueue()
{ {
if (!m_InBGFreeSlotQueue && isBattleground()) if (!m_InBGFreeSlotQueue && IsBattleground())
{ {
Global.BattlegroundMgr.AddToBGFreeSlotQueue(m_TypeID, this); Global.BattlegroundMgr.AddToBGFreeSlotQueue(m_TypeID, this);
m_InBGFreeSlotQueue = true; m_InBGFreeSlotQueue = true;
@@ -1251,7 +1251,7 @@ namespace Game.BattleGrounds
if (bgScore == null) // player not found... if (bgScore == null) // player not found...
return false; return false;
if (type == ScoreType.BonusHonor && doAddHonor && isBattleground()) if (type == ScoreType.BonusHonor && doAddHonor && IsBattleground())
player.RewardHonor(null, 1, (int)value); player.RewardHonor(null, 1, (int)value);
else else
bgScore.UpdateScore(type, value); bgScore.UpdateScore(type, value);
@@ -1640,7 +1640,7 @@ namespace Game.BattleGrounds
} }
} }
if (!isArena()) if (!IsArena())
{ {
// To be able to remove insignia -- ONLY IN Battlegrounds // To be able to remove insignia -- ONLY IN Battlegrounds
victim.AddUnitFlag(UnitFlags.Skinnable); victim.AddUnitFlag(UnitFlags.Skinnable);
@@ -1869,9 +1869,9 @@ namespace Game.BattleGrounds
public void SetRandom(bool isRandom) { m_IsRandom = isRandom; } public void SetRandom(bool isRandom) { m_IsRandom = isRandom; }
uint GetInvitedCount(Team team) { return (team == Team.Alliance) ? m_InvitedAlliance : m_InvitedHorde; } uint GetInvitedCount(Team team) { return (team == Team.Alliance) ? m_InvitedAlliance : m_InvitedHorde; }
public bool isArena() { return m_IsArena; } public bool IsArena() { return m_IsArena; }
public bool isBattleground() { return !m_IsArena; } public bool IsBattleground() { return !m_IsArena; }
public bool isRated() { return m_IsRated; } public bool IsRated() { return m_IsRated; }
public Dictionary<ObjectGuid, BattlegroundPlayer> GetPlayers() { return m_Players; } public Dictionary<ObjectGuid, BattlegroundPlayer> GetPlayers() { return m_Players; }
uint GetPlayersSize() { return (uint)m_Players.Count; } uint GetPlayersSize() { return (uint)m_Players.Count; }
@@ -134,9 +134,9 @@ namespace Game.BattleGrounds
header.QueueID = bg.GetQueueId(); header.QueueID = bg.GetQueueId();
header.RangeMin = (byte)bg.GetMinLevel(); header.RangeMin = (byte)bg.GetMinLevel();
header.RangeMax = (byte)bg.GetMaxLevel(); header.RangeMax = (byte)bg.GetMaxLevel();
header.TeamSize = (byte)(bg.isArena() ? arenaType : 0); header.TeamSize = (byte)(bg.IsArena() ? arenaType : 0);
header.InstanceID = bg.GetClientInstanceID(); header.InstanceID = bg.GetClientInstanceID();
header.RegisteredMatch = bg.isRated(); header.RegisteredMatch = bg.IsRated();
header.TournamentRules = false; header.TournamentRules = false;
} }
@@ -267,7 +267,7 @@ namespace Game.BattleGrounds
// create a copy of the BG template // create a copy of the BG template
Battleground bg = bg_template.GetCopy(); Battleground bg = bg_template.GetCopy();
bool isRandom = bgTypeId != originalBgTypeId && !bg.isArena(); bool isRandom = bgTypeId != originalBgTypeId && !bg.IsArena();
bg.SetBracket(bracketEntry); bg.SetBracket(bracketEntry);
bg.SetInstanceID(Global.MapMgr.GenerateInstanceId()); bg.SetInstanceID(Global.MapMgr.GenerateInstanceId());
@@ -282,7 +282,7 @@ namespace Game.BattleGrounds
bg.SetQueueId((ulong)bgTypeId | 0x1F10000000000000); bg.SetQueueId((ulong)bgTypeId | 0x1F10000000000000);
// Set up correct min/max player counts for scoreboards // Set up correct min/max player counts for scoreboards
if (bg.isArena()) if (bg.IsArena())
{ {
uint maxPlayersPerTeam = 0; uint maxPlayersPerTeam = 0;
switch (arenaType) switch (arenaType)
@@ -857,8 +857,8 @@ namespace Game.BattleGrounds
public BattlegroundQueue GetBattlegroundQueue(BattlegroundQueueTypeId bgQueueTypeId) { return m_BattlegroundQueues[(int)bgQueueTypeId]; } public BattlegroundQueue GetBattlegroundQueue(BattlegroundQueueTypeId bgQueueTypeId) { return m_BattlegroundQueues[(int)bgQueueTypeId]; }
public bool isArenaTesting() { return m_ArenaTesting; } public bool IsArenaTesting() { return m_ArenaTesting; }
public bool isTesting() { return m_Testing; } public bool IsTesting() { return m_Testing; }
public BattlegroundTypeId GetBattleMasterBG(uint entry) public BattlegroundTypeId GetBattleMasterBG(uint entry)
{ {
+11 -11
View File
@@ -97,7 +97,7 @@ namespace Game.BattleGrounds
//add players from group to ginfo //add players from group to ginfo
if (grp) if (grp)
{ {
for (GroupReference refe = grp.GetFirstMember(); refe != null; refe = refe.next()) for (GroupReference refe = grp.GetFirstMember(); refe != null; refe = refe.Next())
{ {
Player member = refe.GetSource(); Player member = refe.GetSource();
if (!member) if (!member)
@@ -385,7 +385,7 @@ namespace Game.BattleGrounds
BattlegroundBracketId bracket_id = bg.GetBracketId(); BattlegroundBracketId bracket_id = bg.GetBracketId();
// set ArenaTeamId for rated matches // set ArenaTeamId for rated matches
if (bg.isArena() && bg.isRated()) if (bg.IsArena() && bg.IsRated())
bg.SetArenaTeamIdForTeam(ginfo.Team, ginfo.ArenaTeamId); bg.SetArenaTeamIdForTeam(ginfo.Team, ginfo.ArenaTeamId);
ginfo.RemoveInviteTime = GameTime.GetGameTimeMS() + BattlegroundConst.InviteAcceptWaitTime; ginfo.RemoveInviteTime = GameTime.GetGameTimeMS() + BattlegroundConst.InviteAcceptWaitTime;
@@ -644,7 +644,7 @@ namespace Game.BattleGrounds
return false; return false;
} }
//allow 1v0 if debug bg //allow 1v0 if debug bg
if (Global.BattlegroundMgr.isTesting() && (m_SelectionPools[TeamId.Alliance].GetPlayerCount() != 0 || m_SelectionPools[TeamId.Horde].GetPlayerCount() != 0)) if (Global.BattlegroundMgr.IsTesting() && (m_SelectionPools[TeamId.Alliance].GetPlayerCount() != 0 || m_SelectionPools[TeamId.Horde].GetPlayerCount() != 0))
return true; return true;
//return true if there are enough players in selection pools - enable to work .debug bg command correctly //return true if there are enough players in selection pools - enable to work .debug bg command correctly
return m_SelectionPools[TeamId.Alliance].GetPlayerCount() >= minPlayers && m_SelectionPools[TeamId.Horde].GetPlayerCount() >= minPlayers; return m_SelectionPools[TeamId.Alliance].GetPlayerCount() >= minPlayers && m_SelectionPools[TeamId.Horde].GetPlayerCount() >= minPlayers;
@@ -745,7 +745,7 @@ namespace Game.BattleGrounds
foreach (var bg in bgQueues) foreach (var bg in bgQueues)
{ {
// DO NOT allow queue manager to invite new player to rated games // DO NOT allow queue manager to invite new player to rated games
if (!bg.isRated() && bg.GetTypeID() == bgTypeId && bg.GetBracketId() == bracket_id && if (!bg.IsRated() && bg.GetTypeID() == bgTypeId && bg.GetBracketId() == bracket_id &&
bg.GetStatus() > BattlegroundStatus.WaitQueue && bg.GetStatus() < BattlegroundStatus.WaitLeave) bg.GetStatus() > BattlegroundStatus.WaitQueue && bg.GetStatus() < BattlegroundStatus.WaitLeave)
{ {
// clear selection pools // clear selection pools
@@ -787,18 +787,18 @@ namespace Game.BattleGrounds
uint MinPlayersPerTeam = bg_template.GetMinPlayersPerTeam(); uint MinPlayersPerTeam = bg_template.GetMinPlayersPerTeam();
uint MaxPlayersPerTeam = bg_template.GetMaxPlayersPerTeam(); uint MaxPlayersPerTeam = bg_template.GetMaxPlayersPerTeam();
if (bg_template.isArena()) if (bg_template.IsArena())
{ {
MaxPlayersPerTeam = arenaType; MaxPlayersPerTeam = arenaType;
MinPlayersPerTeam = (uint)(Global.BattlegroundMgr.isArenaTesting() ? 1 : arenaType); MinPlayersPerTeam = (uint)(Global.BattlegroundMgr.IsArenaTesting() ? 1 : arenaType);
} }
else if (Global.BattlegroundMgr.isTesting()) else if (Global.BattlegroundMgr.IsTesting())
MinPlayersPerTeam = 1; MinPlayersPerTeam = 1;
m_SelectionPools[TeamId.Alliance].Init(); m_SelectionPools[TeamId.Alliance].Init();
m_SelectionPools[TeamId.Horde].Init(); m_SelectionPools[TeamId.Horde].Init();
if (bg_template.isBattleground()) if (bg_template.IsBattleground())
{ {
if (CheckPremadeMatch(bracket_id, MinPlayersPerTeam, MaxPlayersPerTeam)) if (CheckPremadeMatch(bracket_id, MinPlayersPerTeam, MaxPlayersPerTeam))
{ {
@@ -826,7 +826,7 @@ namespace Game.BattleGrounds
{ {
// if there are enough players in pools, start new Battleground or non rated arena // if there are enough players in pools, start new Battleground or non rated arena
if (CheckNormalMatch(bg_template, bracket_id, MinPlayersPerTeam, MaxPlayersPerTeam) if (CheckNormalMatch(bg_template, bracket_id, MinPlayersPerTeam, MaxPlayersPerTeam)
|| (bg_template.isArena() && CheckSkirmishForSameFaction(bracket_id, MinPlayersPerTeam))) || (bg_template.IsArena() && CheckSkirmishForSameFaction(bracket_id, MinPlayersPerTeam)))
{ {
// we successfully created a pool // we successfully created a pool
Battleground bg2 = Global.BattlegroundMgr.CreateNewBattleground(bgTypeId, bracketEntry, (ArenaTypes)arenaType, false); Battleground bg2 = Global.BattlegroundMgr.CreateNewBattleground(bgTypeId, bracketEntry, (ArenaTypes)arenaType, false);
@@ -846,7 +846,7 @@ namespace Game.BattleGrounds
bg2.StartBattleground(); bg2.StartBattleground();
} }
} }
else if (bg_template.isArena()) else if (bg_template.IsArena())
{ {
// found out the minimum and maximum ratings the newly added team should battle against // found out the minimum and maximum ratings the newly added team should battle against
// arenaRating is the rating of the latest joined team, or 0 // arenaRating is the rating of the latest joined team, or 0
@@ -1166,7 +1166,7 @@ namespace Game.BattleGrounds
player.RemoveBattlegroundQueueId(m_BgQueueTypeId); player.RemoveBattlegroundQueueId(m_BgQueueTypeId);
bgQueue.RemovePlayer(m_PlayerGuid, true); bgQueue.RemovePlayer(m_PlayerGuid, true);
//update queues if Battleground isn't ended //update queues if Battleground isn't ended
if (bg && bg.isBattleground() && bg.GetStatus() != BattlegroundStatus.WaitLeave) if (bg && bg.IsBattleground() && bg.GetStatus() != BattlegroundStatus.WaitLeave)
Global.BattlegroundMgr.ScheduleQueueUpdate(0, 0, m_BgQueueTypeId, m_BgTypeId, bg.GetBracketId()); Global.BattlegroundMgr.ScheduleQueueUpdate(0, 0, m_BgQueueTypeId, m_BgTypeId, bg.GetBracketId());
BattlefieldStatusNone battlefieldStatus; BattlefieldStatusNone battlefieldStatus;
+37 -37
View File
@@ -81,7 +81,7 @@ namespace Game.Chat
//if (!command.Name.Equals(cmd)) //if (!command.Name.Equals(cmd))
//continue; //continue;
if (!hasStringAbbr(command.Name, cmd)) if (!HasStringAbbr(command.Name, cmd))
continue; continue;
bool match = false; bool match = false;
@@ -89,7 +89,7 @@ namespace Game.Chat
{ {
foreach (var command2 in table) foreach (var command2 in table)
{ {
if (!hasStringAbbr(command2.Name, cmd)) if (!HasStringAbbr(command2.Name, cmd))
continue; continue;
if (command2.Name.Equals(cmd)) if (command2.Name.Equals(cmd))
@@ -180,7 +180,7 @@ namespace Game.Chat
if (!IsAvailable(command)) if (!IsAvailable(command))
continue; continue;
if (!hasStringAbbr(command.Name, cmd)) if (!HasStringAbbr(command.Name, cmd))
continue; continue;
// have subcommand // have subcommand
@@ -236,7 +236,7 @@ namespace Game.Chat
continue; continue;
// for empty subcmd show all available // for empty subcmd show all available
if (!subcmd.IsEmpty() && !hasStringAbbr(command.Name, subcmd)) if (!subcmd.IsEmpty() && !HasStringAbbr(command.Name, subcmd))
continue; continue;
if (GetSession() != null) if (GetSession() != null)
@@ -271,17 +271,17 @@ namespace Game.Chat
public virtual bool HasPermission(RBACPermissions permission) { return _session.HasPermission(permission); } public virtual bool HasPermission(RBACPermissions permission) { return _session.HasPermission(permission); }
public string extractKeyFromLink(StringArguments args, params string[] linkType) public string ExtractKeyFromLink(StringArguments args, params string[] linkType)
{ {
int throwaway; int throwaway;
return extractKeyFromLink(args, linkType, out throwaway); return ExtractKeyFromLink(args, linkType, out throwaway);
} }
public string extractKeyFromLink(StringArguments args, string[] linkType, out int found_idx) public string ExtractKeyFromLink(StringArguments args, string[] linkType, out int found_idx)
{ {
string throwaway; string throwaway;
return extractKeyFromLink(args, linkType, out found_idx, out throwaway); return ExtractKeyFromLink(args, linkType, out found_idx, out throwaway);
} }
public string extractKeyFromLink(StringArguments args, string[] linkType, out int found_idx, out string something1) public string ExtractKeyFromLink(StringArguments args, string[] linkType, out int found_idx, out string something1)
{ {
found_idx = 0; found_idx = 0;
something1 = null; something1 = null;
@@ -327,7 +327,7 @@ namespace Game.Chat
return null; return null;
} }
public void extractOptFirstArg(StringArguments args, out string arg1, out string arg2) public void ExtractOptFirstArg(StringArguments args, out string arg1, out string arg2)
{ {
string p1 = args.NextString(); string p1 = args.NextString();
string p2 = args.NextString(); string p2 = args.NextString();
@@ -342,9 +342,9 @@ namespace Game.Chat
arg2 = p2; arg2 = p2;
} }
public GameTele extractGameTeleFromLink(StringArguments args) public GameTele ExtractGameTeleFromLink(StringArguments args)
{ {
string cId = extractKeyFromLink(args, "Htele"); string cId = ExtractKeyFromLink(args, "Htele");
if (string.IsNullOrEmpty(cId)) if (string.IsNullOrEmpty(cId))
return null; return null;
@@ -354,7 +354,7 @@ namespace Game.Chat
return Global.ObjectMgr.GetGameTele(id); return Global.ObjectMgr.GetGameTele(id);
} }
public string extractQuotedArg(string str) public string ExtractQuotedArg(string str)
{ {
if (string.IsNullOrEmpty(str)) if (string.IsNullOrEmpty(str))
return null; return null;
@@ -364,10 +364,10 @@ namespace Game.Chat
return str.Replace("\"", String.Empty); return str.Replace("\"", String.Empty);
} }
string extractPlayerNameFromLink(StringArguments args) string ExtractPlayerNameFromLink(StringArguments args)
{ {
// |color|Hplayer:name|h[name]|h|r // |color|Hplayer:name|h[name]|h|r
string name = extractKeyFromLink(args, "Hplayer"); string name = ExtractKeyFromLink(args, "Hplayer");
if (name.IsEmpty()) if (name.IsEmpty())
return ""; return "";
@@ -376,19 +376,19 @@ namespace Game.Chat
return name; return name;
} }
public bool extractPlayerTarget(StringArguments args, out Player player) public bool ExtractPlayerTarget(StringArguments args, out Player player)
{ {
ObjectGuid guid; ObjectGuid guid;
string name; string name;
return extractPlayerTarget(args, out player, out guid, out name); return ExtractPlayerTarget(args, out player, out guid, out name);
} }
public bool extractPlayerTarget(StringArguments args, out Player player, out ObjectGuid playerGuid) public bool ExtractPlayerTarget(StringArguments args, out Player player, out ObjectGuid playerGuid)
{ {
string name; string name;
return extractPlayerTarget(args, out player, out playerGuid, out name); return ExtractPlayerTarget(args, out player, out playerGuid, out name);
} }
public bool extractPlayerTarget(StringArguments args, out Player player, out ObjectGuid playerGuid, out string playerName) public bool ExtractPlayerTarget(StringArguments args, out Player player, out ObjectGuid playerGuid, out string playerName)
{ {
player = null; player = null;
playerGuid = ObjectGuid.Empty; playerGuid = ObjectGuid.Empty;
@@ -396,7 +396,7 @@ namespace Game.Chat
if (!args.Empty()) if (!args.Empty())
{ {
string name = extractPlayerNameFromLink(args); string name = ExtractPlayerNameFromLink(args);
if (string.IsNullOrEmpty(name)) if (string.IsNullOrEmpty(name))
{ {
SendSysMessage(CypherStrings.PlayerNotFound); SendSysMessage(CypherStrings.PlayerNotFound);
@@ -412,7 +412,7 @@ namespace Game.Chat
} }
else else
{ {
player = getSelectedPlayer(); player = GetSelectedPlayer();
playerGuid = player != null ? player.GetGUID() : ObjectGuid.Empty; playerGuid = player != null ? player.GetGUID() : ObjectGuid.Empty;
playerName = player != null ? player.GetName() : ""; playerName = player != null ? player.GetName() : "";
} }
@@ -426,7 +426,7 @@ namespace Game.Chat
return true; return true;
} }
public ulong extractLowGuidFromLink(StringArguments args, ref HighGuid guidHigh) public ulong ExtractLowGuidFromLink(StringArguments args, ref HighGuid guidHigh)
{ {
int type; int type;
@@ -439,7 +439,7 @@ namespace Game.Chat
// |color|Hcreature:creature_guid|h[name]|h|r // |color|Hcreature:creature_guid|h[name]|h|r
// |color|Hgameobject:go_guid|h[name]|h|r // |color|Hgameobject:go_guid|h[name]|h|r
// |color|Hplayer:name|h[name]|h|r // |color|Hplayer:name|h[name]|h|r
string idS = extractKeyFromLink(args, guidKeys, out type); string idS = ExtractKeyFromLink(args, guidKeys, out type);
if (string.IsNullOrEmpty(idS)) if (string.IsNullOrEmpty(idS))
return 0; return 0;
@@ -489,7 +489,7 @@ namespace Game.Chat
"Htrade", // profession/skill spell "Htrade", // profession/skill spell
"Hglyph", // glyph "Hglyph", // glyph
}; };
public uint extractSpellIdFromLink(StringArguments args) public uint ExtractSpellIdFromLink(StringArguments args)
{ {
// number or [name] Shift-click form |color|Henchant:recipe_spell_id|h[prof_name: recipe_name]|h|r // number or [name] Shift-click form |color|Henchant:recipe_spell_id|h[prof_name: recipe_name]|h|r
// number or [name] Shift-click form |color|Hglyph:glyph_slot_id:glyph_prop_id|h[value]|h|r // number or [name] Shift-click form |color|Hglyph:glyph_slot_id:glyph_prop_id|h[value]|h|r
@@ -498,7 +498,7 @@ namespace Game.Chat
// number or [name] Shift-click form |color|Htrade:spell_id, skill_id, max_value, cur_value|h[name]|h|r // number or [name] Shift-click form |color|Htrade:spell_id, skill_id, max_value, cur_value|h[name]|h|r
int type = 0; int type = 0;
string param1Str = null; string param1Str = null;
string idS = extractKeyFromLink(args, spellKeys, out type, out param1Str); string idS = ExtractKeyFromLink(args, spellKeys, out type, out param1Str);
if (string.IsNullOrEmpty(idS)) if (string.IsNullOrEmpty(idS))
return 0; return 0;
@@ -538,7 +538,7 @@ namespace Game.Chat
return 0; return 0;
} }
public Player getSelectedPlayer() public Player GetSelectedPlayer()
{ {
if (_session == null) if (_session == null)
return null; return null;
@@ -550,7 +550,7 @@ namespace Game.Chat
return Global.ObjAccessor.FindPlayer(selected); return Global.ObjAccessor.FindPlayer(selected);
} }
public Unit getSelectedUnit() public Unit GetSelectedUnit()
{ {
if (_session == null) if (_session == null)
return null; return null;
@@ -573,14 +573,14 @@ namespace Game.Chat
return Global.ObjAccessor.GetUnit(_session.GetPlayer(), selected); return Global.ObjAccessor.GetUnit(_session.GetPlayer(), selected);
} }
public Creature getSelectedCreature() public Creature GetSelectedCreature()
{ {
if (_session == null) if (_session == null)
return null; return null;
return ObjectAccessor.GetCreatureOrPetOrVehicle(_session.GetPlayer(), _session.GetPlayer().GetTarget()); return ObjectAccessor.GetCreatureOrPetOrVehicle(_session.GetPlayer(), _session.GetPlayer().GetTarget());
} }
public Player getSelectedPlayerOrSelf() public Player GetSelectedPlayerOrSelf()
{ {
if (_session == null) if (_session == null)
return null; return null;
@@ -639,7 +639,7 @@ namespace Game.Chat
return searcher.GetTarget(); return searcher.GetTarget();
} }
public string playerLink(string name, bool console = false) public string PlayerLink(string name, bool console = false)
{ {
return console ? name : "|cffffffff|Hplayer:" + name + "|h[" + name + "]|h|r"; return console ? name : "|cffffffff|Hplayer:" + name + "|h[" + name + "]|h|r";
} }
@@ -649,9 +649,9 @@ namespace Game.Chat
} }
public string GetNameLink(Player obj) public string GetNameLink(Player obj)
{ {
return playerLink(obj.GetName()); return PlayerLink(obj.GetName());
} }
public virtual bool needReportToTarget(Player chr) public virtual bool NeedReportToTarget(Player chr)
{ {
Player pl = _session.GetPlayer(); Player pl = _session.GetPlayer();
return pl != chr && pl.IsVisibleGloballyFor(chr); return pl != chr && pl.IsVisibleGloballyFor(chr);
@@ -703,7 +703,7 @@ namespace Game.Chat
return false; return false;
} }
bool hasStringAbbr(string name, string part) bool HasStringAbbr(string name, string part)
{ {
// non "" command // non "" command
if (!name.IsEmpty()) if (!name.IsEmpty())
@@ -822,8 +822,8 @@ namespace Game.Chat
} }
else else
{ {
if (getSelectedPlayer()) if (GetSelectedPlayer())
player = getSelectedPlayer(); player = GetSelectedPlayer();
else else
player = _session.GetPlayer(); player = _session.GetPlayer();
@@ -866,7 +866,7 @@ namespace Game.Chat
return GetCypherString(CypherStrings.ConsoleCommand); return GetCypherString(CypherStrings.ConsoleCommand);
} }
public override bool needReportToTarget(Player chr) public override bool NeedReportToTarget(Player chr)
{ {
return true; return true;
} }
+4 -4
View File
@@ -467,7 +467,7 @@ namespace Game.Chat
if (string.IsNullOrEmpty(exp)) if (string.IsNullOrEmpty(exp))
{ {
Player player = handler.getSelectedPlayer(); Player player = handler.GetSelectedPlayer();
if (!player) if (!player)
return false; return false;
@@ -531,7 +531,7 @@ namespace Game.Chat
if (string.IsNullOrEmpty(arg3)) if (string.IsNullOrEmpty(arg3))
{ {
if (!handler.getSelectedPlayer()) if (!handler.GetSelectedPlayer())
return false; return false;
isAccountNameGiven = false; isAccountNameGiven = false;
} }
@@ -560,7 +560,7 @@ namespace Game.Chat
} }
// command.getSession() == NULL only for console // command.getSession() == NULL only for console
targetAccountId = (isAccountNameGiven) ? Global.AccountMgr.GetId(targetAccountName) : handler.getSelectedPlayer().GetSession().GetAccountId(); targetAccountId = (isAccountNameGiven) ? Global.AccountMgr.GetId(targetAccountName) : handler.GetSelectedPlayer().GetSession().GetAccountId();
if (!int.TryParse(isAccountNameGiven ? arg3 : arg2, out int gmRealmID)) if (!int.TryParse(isAccountNameGiven ? arg3 : arg2, out int gmRealmID))
return false; return false;
@@ -602,7 +602,7 @@ namespace Game.Chat
return false; return false;
} }
RBACData rbac = isAccountNameGiven ? null : handler.getSelectedPlayer().GetSession().GetRBACData(); RBACData rbac = isAccountNameGiven ? null : handler.GetSelectedPlayer().GetSession().GetRBACData();
Global.AccountMgr.UpdateAccountAccess(rbac, targetAccountId, (byte)gm, gmRealmID); Global.AccountMgr.UpdateAccountAccess(rbac, targetAccountId, (byte)gm, gmRealmID);
handler.SendSysMessage(CypherStrings.YouChangeSecurity, targetAccountName, gm); handler.SendSysMessage(CypherStrings.YouChangeSecurity, targetAccountName, gm);
return true; return true;
+6 -6
View File
@@ -32,10 +32,10 @@ namespace Game.Chat
return false; return false;
Player target; Player target;
if (!handler.extractPlayerTarget(args[0] != '"' ? args : null, out target)) if (!handler.ExtractPlayerTarget(args[0] != '"' ? args : null, out target))
return false; return false;
string name = handler.extractQuotedArg(args.NextString()); string name = handler.ExtractQuotedArg(args.NextString());
if (string.IsNullOrEmpty(name)) if (string.IsNullOrEmpty(name))
return false; return false;
@@ -119,14 +119,14 @@ namespace Game.Chat
if (args.Empty()) if (args.Empty())
return false; return false;
string oldArenaStr = handler.extractQuotedArg(args.NextString()); string oldArenaStr = handler.ExtractQuotedArg(args.NextString());
if (string.IsNullOrEmpty(oldArenaStr)) if (string.IsNullOrEmpty(oldArenaStr))
{ {
handler.SendSysMessage(CypherStrings.BadValue); handler.SendSysMessage(CypherStrings.BadValue);
return false; return false;
} }
string newArenaStr = handler.extractQuotedArg(args.NextString()); string newArenaStr = handler.ExtractQuotedArg(args.NextString());
if (string.IsNullOrEmpty(newArenaStr)) if (string.IsNullOrEmpty(newArenaStr))
{ {
handler.SendSysMessage(CypherStrings.BadValue); handler.SendSysMessage(CypherStrings.BadValue);
@@ -176,7 +176,7 @@ namespace Game.Chat
string idStr; string idStr;
string nameStr; string nameStr;
handler.extractOptFirstArg(args, out idStr, out nameStr); handler.ExtractOptFirstArg(args, out idStr, out nameStr);
if (string.IsNullOrEmpty(idStr)) if (string.IsNullOrEmpty(idStr))
return false; return false;
@@ -185,7 +185,7 @@ namespace Game.Chat
Player target; Player target;
ObjectGuid targetGuid; ObjectGuid targetGuid;
if (!handler.extractPlayerTarget(new StringArguments(nameStr), out target, out targetGuid)) if (!handler.ExtractPlayerTarget(new StringArguments(nameStr), out target, out targetGuid))
return false; return false;
ArenaTeam arena = Global.ArenaTeamMgr.GetArenaTeamById(teamId); ArenaTeam arena = Global.ArenaTeamMgr.GetArenaTeamById(teamId);
+11 -11
View File
@@ -32,7 +32,7 @@ namespace Game.Chat
if (args.Empty()) if (args.Empty())
return false; return false;
Unit target = handler.getSelectedUnit(); Unit target = handler.GetSelectedUnit();
if (!target) if (!target)
{ {
handler.SendSysMessage(CypherStrings.SelectCharOrCreature); handler.SendSysMessage(CypherStrings.SelectCharOrCreature);
@@ -40,7 +40,7 @@ namespace Game.Chat
} }
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint spellId = handler.extractSpellIdFromLink(args); uint spellId = handler.ExtractSpellIdFromLink(args);
if (spellId == 0) if (spellId == 0)
return false; return false;
@@ -61,7 +61,7 @@ namespace Game.Chat
[Command("back", RBACPermissions.CommandCastBack)] [Command("back", RBACPermissions.CommandCastBack)]
static bool HandleCastBackCommand(StringArguments args, CommandHandler handler) static bool HandleCastBackCommand(StringArguments args, CommandHandler handler)
{ {
Creature caster = handler.getSelectedCreature(); Creature caster = handler.GetSelectedCreature();
if (!caster) if (!caster)
{ {
handler.SendSysMessage(CypherStrings.SelectCharOrCreature); handler.SendSysMessage(CypherStrings.SelectCharOrCreature);
@@ -69,7 +69,7 @@ namespace Game.Chat
} }
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint spellId = handler.extractSpellIdFromLink(args); uint spellId = handler.ExtractSpellIdFromLink(args);
if (spellId == 0) if (spellId == 0)
return false; return false;
@@ -97,7 +97,7 @@ namespace Game.Chat
return false; return false;
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint spellId = handler.extractSpellIdFromLink(args); uint spellId = handler.ExtractSpellIdFromLink(args);
if (spellId == 0) if (spellId == 0)
return false; return false;
@@ -129,7 +129,7 @@ namespace Game.Chat
if (args.Empty()) if (args.Empty())
return false; return false;
Unit target = handler.getSelectedUnit(); Unit target = handler.GetSelectedUnit();
if (!target) if (!target)
{ {
handler.SendSysMessage(CypherStrings.SelectCharOrCreature); handler.SendSysMessage(CypherStrings.SelectCharOrCreature);
@@ -137,7 +137,7 @@ namespace Game.Chat
} }
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint spellId = handler.extractSpellIdFromLink(args); uint spellId = handler.ExtractSpellIdFromLink(args);
if (spellId == 0) if (spellId == 0)
return false; return false;
@@ -152,7 +152,7 @@ namespace Game.Chat
[Command("target", RBACPermissions.CommandCastTarget)] [Command("target", RBACPermissions.CommandCastTarget)]
static bool HandleCastTargetCommad(StringArguments args, CommandHandler handler) static bool HandleCastTargetCommad(StringArguments args, CommandHandler handler)
{ {
Creature caster = handler.getSelectedCreature(); Creature caster = handler.GetSelectedCreature();
if (!caster) if (!caster)
{ {
handler.SendSysMessage(CypherStrings.SelectCharOrCreature); handler.SendSysMessage(CypherStrings.SelectCharOrCreature);
@@ -166,7 +166,7 @@ namespace Game.Chat
} }
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint spellId = handler.extractSpellIdFromLink(args); uint spellId = handler.ExtractSpellIdFromLink(args);
if (spellId == 0) if (spellId == 0)
return false; return false;
@@ -190,7 +190,7 @@ namespace Game.Chat
[Command("dest", RBACPermissions.CommandCastDest)] [Command("dest", RBACPermissions.CommandCastDest)]
static bool HandleCastDestCommand(StringArguments args, CommandHandler handler) static bool HandleCastDestCommand(StringArguments args, CommandHandler handler)
{ {
Unit caster = handler.getSelectedUnit(); Unit caster = handler.GetSelectedUnit();
if (!caster) if (!caster)
{ {
handler.SendSysMessage(CypherStrings.SelectCharOrCreature); handler.SendSysMessage(CypherStrings.SelectCharOrCreature);
@@ -198,7 +198,7 @@ namespace Game.Chat
} }
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint spellId = handler.extractSpellIdFromLink(args); uint spellId = handler.ExtractSpellIdFromLink(args);
if (spellId == 0) if (spellId == 0)
return false; return false;
+19 -19
View File
@@ -37,7 +37,7 @@ namespace Game.Chat
return false; return false;
Player target; Player target;
if (!handler.extractPlayerTarget(args, out target)) if (!handler.ExtractPlayerTarget(args, out target))
return false; return false;
LocaleConstant loc = handler.GetSessionDbcLocale(); LocaleConstant loc = handler.GetSessionDbcLocale();
@@ -76,7 +76,7 @@ namespace Game.Chat
Player target; Player target;
ObjectGuid targetGuid; ObjectGuid targetGuid;
string targetName; string targetName;
if (!handler.extractPlayerTarget(args, out target, out targetGuid, out targetName)) if (!handler.ExtractPlayerTarget(args, out target, out targetGuid, out targetName))
return false; return false;
string newNameStr = args.NextString(); string newNameStr = args.NextString();
@@ -181,7 +181,7 @@ namespace Game.Chat
if (handler.HasLowerSecurity(null, targetGuid)) if (handler.HasLowerSecurity(null, targetGuid))
return false; return false;
string oldNameLink = handler.playerLink(targetName); string oldNameLink = handler.PlayerLink(targetName);
handler.SendSysMessage(CypherStrings.RenamePlayerGuid, oldNameLink, targetGuid.ToString()); handler.SendSysMessage(CypherStrings.RenamePlayerGuid, oldNameLink, targetGuid.ToString());
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG);
@@ -199,7 +199,7 @@ namespace Game.Chat
{ {
string nameStr; string nameStr;
string levelStr; string levelStr;
handler.extractOptFirstArg(args, out nameStr, out levelStr); handler.ExtractOptFirstArg(args, out nameStr, out levelStr);
if (string.IsNullOrEmpty(levelStr)) if (string.IsNullOrEmpty(levelStr))
return false; return false;
@@ -213,7 +213,7 @@ namespace Game.Chat
Player target; Player target;
ObjectGuid targetGuid; ObjectGuid targetGuid;
string targetName; string targetName;
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));
@@ -230,7 +230,7 @@ namespace Game.Chat
HandleCharacterLevel(target, targetGuid, oldlevel, newlevel, handler); HandleCharacterLevel(target, targetGuid, oldlevel, newlevel, handler);
if (handler.GetSession() == null || handler.GetSession().GetPlayer() != target) // including player == NULL if (handler.GetSession() == null || handler.GetSession().GetPlayer() != target) // including player == NULL
{ {
string nameLink = handler.playerLink(targetName); string nameLink = handler.PlayerLink(targetName);
handler.SendSysMessage(CypherStrings.YouChangeLvl, nameLink, newlevel); handler.SendSysMessage(CypherStrings.YouChangeLvl, nameLink, newlevel);
} }
@@ -244,7 +244,7 @@ namespace Game.Chat
Player target; Player target;
ObjectGuid targetGuid; ObjectGuid targetGuid;
string targetName; string targetName;
if (!handler.extractPlayerTarget(args, out target, out targetGuid, out targetName)) if (!handler.ExtractPlayerTarget(args, out target, out targetGuid, out targetName))
return false; return false;
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG);
@@ -257,7 +257,7 @@ namespace Game.Chat
} }
else else
{ {
string oldNameLink = handler.playerLink(targetName); string oldNameLink = handler.PlayerLink(targetName);
stmt.AddValue(1, targetGuid.GetCounter()); stmt.AddValue(1, targetGuid.GetCounter());
handler.SendSysMessage(CypherStrings.CustomizePlayerGuid, oldNameLink, targetGuid.ToString()); handler.SendSysMessage(CypherStrings.CustomizePlayerGuid, oldNameLink, targetGuid.ToString());
} }
@@ -271,14 +271,14 @@ namespace Game.Chat
{ {
string playerNameStr; string playerNameStr;
string accountName; string accountName;
handler.extractOptFirstArg(args, out playerNameStr, out accountName); handler.ExtractOptFirstArg(args, out playerNameStr, out accountName);
if (accountName.IsEmpty()) if (accountName.IsEmpty())
return false; return false;
ObjectGuid targetGuid; ObjectGuid targetGuid;
string targetName; string targetName;
Player playerNotUsed; Player playerNotUsed;
if (!handler.extractPlayerTarget(new StringArguments(playerNameStr), out playerNotUsed, out targetGuid, out targetName)) if (!handler.ExtractPlayerTarget(new StringArguments(playerNameStr), out playerNotUsed, out targetGuid, out targetName))
return false; return false;
CharacterCacheEntry characterInfo = Global.CharacterCacheStorage.GetCharacterCacheByGuid(targetGuid); CharacterCacheEntry characterInfo = Global.CharacterCacheStorage.GetCharacterCacheByGuid(targetGuid);
@@ -347,7 +347,7 @@ namespace Game.Chat
Player target; Player target;
ObjectGuid targetGuid; ObjectGuid targetGuid;
string targetName; string targetName;
if (!handler.extractPlayerTarget(args, out target, out targetGuid, out targetName)) if (!handler.ExtractPlayerTarget(args, out target, out targetGuid, out targetName))
return false; return false;
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG);
@@ -360,7 +360,7 @@ namespace Game.Chat
} }
else else
{ {
string oldNameLink = handler.playerLink(targetName); string oldNameLink = handler.PlayerLink(targetName);
handler.SendSysMessage(CypherStrings.CustomizePlayerGuid, oldNameLink, targetGuid.ToString()); handler.SendSysMessage(CypherStrings.CustomizePlayerGuid, oldNameLink, targetGuid.ToString());
stmt.AddValue(1, targetGuid.GetCounter()); stmt.AddValue(1, targetGuid.GetCounter());
} }
@@ -375,7 +375,7 @@ namespace Game.Chat
Player target; Player target;
ObjectGuid targetGuid; ObjectGuid targetGuid;
string targetName; string targetName;
if (!handler.extractPlayerTarget(args, out target, out targetGuid, out targetName)) if (!handler.ExtractPlayerTarget(args, out target, out targetGuid, out targetName))
return false; return false;
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG);
@@ -389,7 +389,7 @@ namespace Game.Chat
} }
else else
{ {
string oldNameLink = handler.playerLink(targetName); string oldNameLink = handler.PlayerLink(targetName);
// @todo add text into database // @todo add text into database
handler.SendSysMessage(CypherStrings.CustomizePlayerGuid, oldNameLink, targetGuid.ToString()); handler.SendSysMessage(CypherStrings.CustomizePlayerGuid, oldNameLink, targetGuid.ToString());
stmt.AddValue(1, targetGuid.GetCounter()); stmt.AddValue(1, targetGuid.GetCounter());
@@ -403,7 +403,7 @@ namespace Game.Chat
static bool HandleCharacterReputationCommand(StringArguments args, CommandHandler handler) static bool HandleCharacterReputationCommand(StringArguments args, CommandHandler handler)
{ {
Player target; Player target;
if (!handler.extractPlayerTarget(args, out target)) if (!handler.ExtractPlayerTarget(args, out target))
return false; return false;
LocaleConstant loc = handler.GetSessionDbcLocale(); LocaleConstant loc = handler.GetSessionDbcLocale();
@@ -735,7 +735,7 @@ namespace Game.Chat
{ {
string nameStr; string nameStr;
string levelStr; string levelStr;
handler.extractOptFirstArg(args, out nameStr, out levelStr); handler.ExtractOptFirstArg(args, out nameStr, out levelStr);
// exception opt second arg: .character level $name // exception opt second arg: .character level $name
if (!string.IsNullOrEmpty(levelStr) && !levelStr.IsNumber()) if (!string.IsNullOrEmpty(levelStr) && !levelStr.IsNumber())
@@ -747,7 +747,7 @@ namespace Game.Chat
Player target; Player target;
ObjectGuid targetGuid; ObjectGuid targetGuid;
string targetName; string targetName;
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));
@@ -765,7 +765,7 @@ namespace Game.Chat
if (handler.GetSession() == null || handler.GetSession().GetPlayer() != target) // including chr == NULL if (handler.GetSession() == null || handler.GetSession().GetPlayer() != target) // including chr == NULL
{ {
string nameLink = handler.playerLink(targetName); string nameLink = handler.PlayerLink(targetName);
handler.SendSysMessage(CypherStrings.YouChangeLvl, nameLink, newlevel); handler.SendSysMessage(CypherStrings.YouChangeLvl, nameLink, newlevel);
} }
@@ -780,7 +780,7 @@ namespace Game.Chat
player.InitTalentForLevel(); player.InitTalentForLevel();
player.SetXP(0); player.SetXP(0);
if (handler.needReportToTarget(player)) if (handler.NeedReportToTarget(player))
{ {
if (oldLevel == newLevel) if (oldLevel == newLevel)
player.SendSysMessage(CypherStrings.YoursLevelProgressReset, handler.GetNameLink()); player.SendSysMessage(CypherStrings.YoursLevelProgressReset, handler.GetNameLink());
+6 -6
View File
@@ -184,7 +184,7 @@ namespace Game.Chat.Commands
{ {
string argstr = args.NextString(); string argstr = args.NextString();
Player chr = handler.getSelectedPlayer(); Player chr = handler.GetSelectedPlayer();
if (!chr) if (!chr)
chr = handler.GetSession().GetPlayer(); chr = handler.GetSession().GetPlayer();
else if (handler.HasLowerSecurity(chr, ObjectGuid.Empty)) // check online security else if (handler.HasLowerSecurity(chr, ObjectGuid.Empty)) // check online security
@@ -197,7 +197,7 @@ namespace Game.Chat.Commands
{ {
chr.SetTaxiCheater(false); chr.SetTaxiCheater(false);
handler.SendSysMessage(CypherStrings.YouRemoveTaxis, handler.GetNameLink(chr)); handler.SendSysMessage(CypherStrings.YouRemoveTaxis, handler.GetNameLink(chr));
if (handler.needReportToTarget(chr)) if (handler.NeedReportToTarget(chr))
chr.SendSysMessage(CypherStrings.YoursTaxisRemoved, handler.GetNameLink()); chr.SendSysMessage(CypherStrings.YoursTaxisRemoved, handler.GetNameLink());
return true; return true;
@@ -206,7 +206,7 @@ namespace Game.Chat.Commands
{ {
chr.SetTaxiCheater(true); chr.SetTaxiCheater(true);
handler.SendSysMessage(CypherStrings.YouGiveTaxis, handler.GetNameLink(chr)); handler.SendSysMessage(CypherStrings.YouGiveTaxis, handler.GetNameLink(chr));
if (handler.needReportToTarget(chr)) if (handler.NeedReportToTarget(chr))
chr.SendSysMessage(CypherStrings.YoursTaxisAdded, handler.GetNameLink()); chr.SendSysMessage(CypherStrings.YoursTaxisAdded, handler.GetNameLink());
return true; return true;
} }
@@ -222,7 +222,7 @@ namespace Game.Chat.Commands
return false; return false;
int flag = args.NextInt32(); int flag = args.NextInt32();
Player chr = handler.getSelectedPlayer(); Player chr = handler.GetSelectedPlayer();
if (!chr) if (!chr)
{ {
handler.SendSysMessage(CypherStrings.NoCharSelected); handler.SendSysMessage(CypherStrings.NoCharSelected);
@@ -232,13 +232,13 @@ namespace Game.Chat.Commands
if (flag != 0) if (flag != 0)
{ {
handler.SendSysMessage(CypherStrings.YouSetExploreAll, handler.GetNameLink(chr)); handler.SendSysMessage(CypherStrings.YouSetExploreAll, handler.GetNameLink(chr));
if (handler.needReportToTarget(chr)) if (handler.NeedReportToTarget(chr))
chr.SendSysMessage(CypherStrings.YoursExploreSetAll, handler.GetNameLink()); chr.SendSysMessage(CypherStrings.YoursExploreSetAll, handler.GetNameLink());
} }
else else
{ {
handler.SendSysMessage(CypherStrings.YouSetExploreNothing, handler.GetNameLink(chr)); handler.SendSysMessage(CypherStrings.YouSetExploreNothing, handler.GetNameLink(chr));
if (handler.needReportToTarget(chr)) if (handler.NeedReportToTarget(chr))
chr.SendSysMessage(CypherStrings.YoursExploreSetNothing, handler.GetNameLink()); chr.SendSysMessage(CypherStrings.YoursExploreSetNothing, handler.GetNameLink());
} }
+24 -24
View File
@@ -40,7 +40,7 @@ namespace Game.Chat
return false; return false;
uint animId = args.NextUInt32(); uint animId = args.NextUInt32();
Unit unit = handler.getSelectedUnit(); Unit unit = handler.GetSelectedUnit();
if (unit) if (unit)
unit.HandleEmoteCommand((Emote)animId); unit.HandleEmoteCommand((Emote)animId);
return true; return true;
@@ -84,7 +84,7 @@ namespace Game.Chat
if (!player) if (!player)
return false; return false;
Creature target = handler.getSelectedCreature(); Creature target = handler.GetSelectedCreature();
if (!target || !target.IsAIEnabled || target.GetAI() == null) if (!target || !target.IsAIEnabled || target.GetAI() == null)
return false; return false;
@@ -115,7 +115,7 @@ namespace Game.Chat
if (conversationEntry == 0) if (conversationEntry == 0)
return false; return false;
Player target = handler.getSelectedPlayerOrSelf(); Player target = handler.GetSelectedPlayerOrSelf();
if (!target) if (!target)
{ {
handler.SendSysMessage(CypherStrings.PlayerNotFound); handler.SendSysMessage(CypherStrings.PlayerNotFound);
@@ -128,7 +128,7 @@ namespace Game.Chat
[Command("entervehicle", RBACPermissions.CommandDebugEntervehicle)] [Command("entervehicle", RBACPermissions.CommandDebugEntervehicle)]
static bool HandleDebugEnterVehicleCommand(StringArguments args, CommandHandler handler) static bool HandleDebugEnterVehicleCommand(StringArguments args, CommandHandler handler)
{ {
Unit target = handler.getSelectedUnit(); Unit target = handler.GetSelectedUnit();
if (!target || !target.IsVehicle()) if (!target || !target.IsVehicle())
return false; return false;
@@ -183,7 +183,7 @@ namespace Game.Chat
else else
return false; return false;
Player player = handler.getSelectedPlayer(); Player player = handler.GetSelectedPlayer();
if (!player) if (!player)
player = handler.GetSession().GetPlayer(); player = handler.GetSession().GetPlayer();
@@ -438,10 +438,10 @@ namespace Game.Chat
[Command("hostil", RBACPermissions.CommandDebugHostil)] [Command("hostil", RBACPermissions.CommandDebugHostil)]
static bool HandleDebugHostileRefListCommand(StringArguments args, CommandHandler handler) static bool HandleDebugHostileRefListCommand(StringArguments args, CommandHandler handler)
{ {
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)
@@ -450,9 +450,9 @@ namespace Game.Chat
if (unit) if (unit)
{ {
++count; ++count;
handler.SendSysMessage(" {0}. {1} ({2}, SpawnId: {3}) - threat {4}", count, unit.GetName(), unit.GetGUID().ToString(), unit.IsTypeId(TypeId.Unit) ? unit.ToCreature().GetSpawnId() : 0, refe.getThreat()); handler.SendSysMessage(" {0}. {1} ({2}, SpawnId: {3}) - threat {4}", count, unit.GetName(), unit.GetGUID().ToString(), unit.IsTypeId(TypeId.Unit) ? unit.ToCreature().GetSpawnId() : 0, refe.GetThreat());
} }
refe = refe.next(); refe = refe.Next();
} }
handler.SendSysMessage("End of hostil reference list."); handler.SendSysMessage("End of hostil reference list.");
return true; return true;
@@ -480,7 +480,7 @@ namespace Game.Chat
[Command("lootrecipient", RBACPermissions.CommandDebugLootrecipient)] [Command("lootrecipient", RBACPermissions.CommandDebugLootrecipient)]
static bool HandleDebugGetLootRecipientCommand(StringArguments args, CommandHandler handler) static bool HandleDebugGetLootRecipientCommand(StringArguments args, CommandHandler handler)
{ {
Creature target = handler.getSelectedCreature(); Creature target = handler.GetSelectedCreature();
if (!target) if (!target)
return false; return false;
@@ -492,7 +492,7 @@ namespace Game.Chat
[Command("los", RBACPermissions.CommandDebugLos)] [Command("los", RBACPermissions.CommandDebugLos)]
static bool HandleDebugLoSCommand(StringArguments args, CommandHandler handler) static bool HandleDebugLoSCommand(StringArguments args, CommandHandler handler)
{ {
Unit unit = handler.getSelectedUnit(); Unit unit = handler.GetSelectedUnit();
if (unit) if (unit)
handler.SendSysMessage("Unit {0} (GuidLow: {1}) is {2}in LoS", unit.GetName(), unit.GetGUID().ToString(), handler.GetSession().GetPlayer().IsWithinLOSInMap(unit) ? "" : "not "); handler.SendSysMessage("Unit {0} (GuidLow: {1}) is {2}in LoS", unit.GetName(), unit.GetGUID().ToString(), handler.GetSession().GetPlayer().IsWithinLOSInMap(unit) ? "" : "not ");
return true; return true;
@@ -501,7 +501,7 @@ namespace Game.Chat
[Command("moveflags", RBACPermissions.CommandDebugMoveflags)] [Command("moveflags", RBACPermissions.CommandDebugMoveflags)]
static bool HandleDebugMoveflagsCommand(StringArguments args, CommandHandler handler) static bool HandleDebugMoveflagsCommand(StringArguments args, CommandHandler handler)
{ {
Unit target = handler.getSelectedUnit(); Unit target = handler.GetSelectedUnit();
if (!target) if (!target)
target = handler.GetSession().GetPlayer(); target = handler.GetSession().GetPlayer();
@@ -621,7 +621,7 @@ namespace Game.Chat
[Command("phase", RBACPermissions.CommandDebugPhase)] [Command("phase", RBACPermissions.CommandDebugPhase)]
static bool HandleDebugPhaseCommand(StringArguments args, CommandHandler handler) static bool HandleDebugPhaseCommand(StringArguments args, CommandHandler handler)
{ {
Unit target = handler.getSelectedUnit(); Unit target = handler.GetSelectedUnit();
if (!target) if (!target)
{ {
handler.SendSysMessage(CypherStrings.SelectCreature); handler.SendSysMessage(CypherStrings.SelectCreature);
@@ -677,7 +677,7 @@ namespace Game.Chat
return false; return false;
} }
Unit unit = handler.getSelectedUnit(); Unit unit = handler.GetSelectedUnit();
if (!unit) if (!unit)
{ {
handler.SendSysMessage(CypherStrings.SelectCharOrCreature); handler.SendSysMessage(CypherStrings.SelectCharOrCreature);
@@ -700,7 +700,7 @@ namespace Game.Chat
[Command("setvid", RBACPermissions.CommandDebugSetvid)] [Command("setvid", RBACPermissions.CommandDebugSetvid)]
static bool HandleDebugSetVehicleIdCommand(StringArguments args, CommandHandler handler) static bool HandleDebugSetVehicleIdCommand(StringArguments args, CommandHandler handler)
{ {
Unit target = handler.getSelectedUnit(); Unit target = handler.GetSelectedUnit();
if (!target || target.IsVehicle()) if (!target || target.IsVehicle())
return false; return false;
@@ -751,20 +751,20 @@ namespace Game.Chat
[Command("threat", RBACPermissions.CommandDebugThreat)] [Command("threat", RBACPermissions.CommandDebugThreat)]
static bool HandleDebugThreatListCommand(StringArguments args, CommandHandler handler) static bool HandleDebugThreatListCommand(StringArguments args, CommandHandler handler)
{ {
Creature target = handler.getSelectedCreature(); Creature target = handler.GetSelectedCreature();
if (!target || target.IsTotem() || target.IsPet()) if (!target || target.IsTotem() || target.IsPet())
return false; return false;
var threatList = target.GetThreatManager().getThreatList(); var threatList = target.GetThreatManager().GetThreatList();
uint count = 0; uint count = 0;
handler.SendSysMessage("Threat list of {0} (guid {1})", target.GetName(), target.GetGUID().ToString()); handler.SendSysMessage("Threat list of {0} (guid {1})", target.GetName(), target.GetGUID().ToString());
foreach (var refe in threatList) foreach (var refe in threatList)
{ {
Unit unit = refe.getTarget(); Unit unit = refe.GetTarget();
if (!unit) if (!unit)
continue; continue;
++count; ++count;
handler.SendSysMessage(" {0}. {1} (guid {2}) - threat {3}", count, unit.GetName(), unit.GetGUID().ToString(), refe.getThreat()); handler.SendSysMessage(" {0}. {1} (guid {2}) - threat {3}", count, unit.GetName(), unit.GetGUID().ToString(), refe.GetThreat());
} }
handler.SendSysMessage("End of threat list."); handler.SendSysMessage("End of threat list.");
return true; return true;
@@ -832,7 +832,7 @@ namespace Game.Chat
if (worldStateIdStr.IsEmpty()) if (worldStateIdStr.IsEmpty())
return false; return false;
Player target = handler.getSelectedPlayerOrSelf(); Player target = handler.GetSelectedPlayerOrSelf();
if (target == null) if (target == null)
{ {
handler.SendSysMessage(CypherStrings.PlayerNotFound); handler.SendSysMessage(CypherStrings.PlayerNotFound);
@@ -844,11 +844,11 @@ namespace Game.Chat
if (value != 0) if (value != 0)
{ {
Global.WorldMgr.setWorldState(worldStateId, value); Global.WorldMgr.SetWorldState(worldStateId, value);
target.SendUpdateWorldState(worldStateId, value); target.SendUpdateWorldState(worldStateId, value);
} }
else else
handler.SendSysMessage($"Worldstate {worldStateId} actual value : {Global.WorldMgr.getWorldState(worldStateId)}"); handler.SendSysMessage($"Worldstate {worldStateId} actual value : {Global.WorldMgr.GetWorldState(worldStateId)}");
return true; return true;
} }
@@ -866,7 +866,7 @@ namespace Game.Chat
uint expressionId = uint.Parse(expressionIdStr); uint expressionId = uint.Parse(expressionIdStr);
Player target = handler.getSelectedPlayerOrSelf(); Player target = handler.GetSelectedPlayerOrSelf();
if (target == null) if (target == null)
{ {
handler.SendSysMessage(CypherStrings.PlayerNotFound); handler.SendSysMessage(CypherStrings.PlayerNotFound);
@@ -1126,7 +1126,7 @@ namespace Game.Chat
return false; return false;
} }
Unit unit = handler.getSelectedUnit(); Unit unit = handler.GetSelectedUnit();
if (!unit) if (!unit)
{ {
handler.SendSysMessage(CypherStrings.SelectCharOrCreature); handler.SendSysMessage(CypherStrings.SelectCharOrCreature);
@@ -68,7 +68,7 @@ namespace Game.Chat.Commands
if (args.Empty()) if (args.Empty())
return false; return false;
Player player = handler.getSelectedPlayer(); Player player = handler.GetSelectedPlayer();
if (!player) if (!player)
{ {
handler.SendSysMessage(CypherStrings.NoCharSelected); handler.SendSysMessage(CypherStrings.NoCharSelected);
@@ -94,7 +94,7 @@ namespace Game.Chat.Commands
static bool HandleDeserterRemove(StringArguments args, CommandHandler handler, bool isInstance) static bool HandleDeserterRemove(StringArguments args, CommandHandler handler, bool isInstance)
{ {
Player player = handler.getSelectedPlayer(); Player player = handler.GetSelectedPlayer();
if (!player) if (!player)
{ {
handler.SendSysMessage(CypherStrings.NoCharSelected); handler.SendSysMessage(CypherStrings.NoCharSelected);
+6 -6
View File
@@ -30,7 +30,7 @@ namespace Game.Chat
return false; return false;
// id or [name] Shift-click form |color|Hgameevent:id|h[name]|h|r // id or [name] Shift-click form |color|Hgameevent:id|h[name]|h|r
string id = handler.extractKeyFromLink(args, "Hgameevent"); string id = handler.ExtractKeyFromLink(args, "Hgameevent");
if (string.IsNullOrEmpty(id)) if (string.IsNullOrEmpty(id))
return false; return false;
@@ -45,7 +45,7 @@ namespace Game.Chat
} }
GameEventData eventData = events[eventId]; GameEventData eventData = events[eventId];
if (!eventData.isValid()) if (!eventData.IsValid())
{ {
handler.SendSysMessage(CypherStrings.EventNotExist); handler.SendSysMessage(CypherStrings.EventNotExist);
return false; return false;
@@ -105,7 +105,7 @@ namespace Game.Chat
return false; return false;
// id or [name] Shift-click form |color|Hgameevent:id|h[name]|h|r // id or [name] Shift-click form |color|Hgameevent:id|h[name]|h|r
string id = handler.extractKeyFromLink(args, "Hgameevent"); string id = handler.ExtractKeyFromLink(args, "Hgameevent");
if (string.IsNullOrEmpty(id)) if (string.IsNullOrEmpty(id))
return false; return false;
@@ -120,7 +120,7 @@ namespace Game.Chat
} }
GameEventData eventData = events[eventId]; GameEventData eventData = events[eventId];
if (!eventData.isValid()) if (!eventData.IsValid())
{ {
handler.SendSysMessage(CypherStrings.EventNotExist); handler.SendSysMessage(CypherStrings.EventNotExist);
return false; return false;
@@ -144,7 +144,7 @@ namespace Game.Chat
return false; return false;
// id or [name] Shift-click form |color|Hgameevent:id|h[name]|h|r // id or [name] Shift-click form |color|Hgameevent:id|h[name]|h|r
string id = handler.extractKeyFromLink(args, "Hgameevent"); string id = handler.ExtractKeyFromLink(args, "Hgameevent");
if (string.IsNullOrEmpty(id)) if (string.IsNullOrEmpty(id))
return false; return false;
@@ -159,7 +159,7 @@ namespace Game.Chat
} }
GameEventData eventData = events[eventId]; GameEventData eventData = events[eventId];
if (!eventData.isValid()) if (!eventData.IsValid())
{ {
handler.SendSysMessage(CypherStrings.EventNotExist); handler.SendSysMessage(CypherStrings.EventNotExist);
return false; return false;
+1 -1
View File
@@ -98,7 +98,7 @@ namespace Game.Chat
if (args.Empty()) if (args.Empty())
return false; return false;
Player target = handler.getSelectedPlayer(); Player target = handler.GetSelectedPlayer();
if (target == null) if (target == null)
target = handler.GetPlayer(); target = handler.GetPlayer();
@@ -37,7 +37,7 @@ namespace Game.Chat
if (args.Empty()) if (args.Empty())
return false; return false;
string id = handler.extractKeyFromLink(args, "Hgameobject"); string id = handler.ExtractKeyFromLink(args, "Hgameobject");
if (string.IsNullOrEmpty(id)) if (string.IsNullOrEmpty(id))
return false; return false;
@@ -63,7 +63,7 @@ namespace Game.Chat
static bool HandleGameObjectDeleteCommand(StringArguments args, CommandHandler handler) static bool HandleGameObjectDeleteCommand(StringArguments args, CommandHandler handler)
{ {
// number or [name] Shift-click form |color|Hgameobject:go_guid|h[name]|h|r // number or [name] Shift-click form |color|Hgameobject:go_guid|h[name]|h|r
string id = handler.extractKeyFromLink(args, "Hgameobject"); string id = handler.ExtractKeyFromLink(args, "Hgameobject");
if (string.IsNullOrEmpty(id)) if (string.IsNullOrEmpty(id))
return false; return false;
@@ -103,7 +103,7 @@ namespace Game.Chat
static bool HandleGameObjectMoveCommand(StringArguments args, CommandHandler handler) static bool HandleGameObjectMoveCommand(StringArguments args, CommandHandler handler)
{ {
// number or [name] Shift-click form |color|Hgameobject:go_guid|h[name]|h|r // number or [name] Shift-click form |color|Hgameobject:go_guid|h[name]|h|r
string id = handler.extractKeyFromLink(args, "Hgameobject"); string id = handler.ExtractKeyFromLink(args, "Hgameobject");
if (string.IsNullOrEmpty(id)) if (string.IsNullOrEmpty(id))
return false; return false;
@@ -219,7 +219,7 @@ namespace Game.Chat
if (!args.Empty()) if (!args.Empty())
{ {
// number or [name] Shift-click form |color|Hgameobject_entry:go_id|h[name]|h|r // number or [name] Shift-click form |color|Hgameobject_entry:go_id|h[name]|h|r
string idStr = handler.extractKeyFromLink(args, "Hgameobject_entry"); string idStr = handler.ExtractKeyFromLink(args, "Hgameobject_entry");
if (string.IsNullOrEmpty(idStr)) if (string.IsNullOrEmpty(idStr))
return false; return false;
@@ -328,7 +328,7 @@ namespace Game.Chat
static bool HandleGameObjectTurnCommand(StringArguments args, CommandHandler handler) static bool HandleGameObjectTurnCommand(StringArguments args, CommandHandler handler)
{ {
// number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r // number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r
string id = handler.extractKeyFromLink(args, "Hgameobject"); string id = handler.ExtractKeyFromLink(args, "Hgameobject");
if (string.IsNullOrEmpty(id)) if (string.IsNullOrEmpty(id))
return false; return false;
@@ -401,13 +401,13 @@ namespace Game.Chat
if (args.Empty()) if (args.Empty())
return false; return false;
string param1 = handler.extractKeyFromLink(args, "Hgameobject_entry"); string param1 = handler.ExtractKeyFromLink(args, "Hgameobject_entry");
if (param1.IsEmpty()) if (param1.IsEmpty())
return false; return false;
if (param1.Equals("guid")) if (param1.Equals("guid"))
{ {
string cValue = handler.extractKeyFromLink(args, "Hgameobject"); string cValue = handler.ExtractKeyFromLink(args, "Hgameobject");
if (cValue.IsEmpty()) if (cValue.IsEmpty())
return false; return false;
@@ -462,7 +462,7 @@ namespace Game.Chat
return false; return false;
// number or [name] Shift-click form |color|Hgameobject_entry:go_id|h[name]|h|r // number or [name] Shift-click form |color|Hgameobject_entry:go_id|h[name]|h|r
string idStr = handler.extractKeyFromLink(args, "Hgameobject_entry"); string idStr = handler.ExtractKeyFromLink(args, "Hgameobject_entry");
if (string.IsNullOrEmpty(idStr)) if (string.IsNullOrEmpty(idStr))
return false; return false;
@@ -591,7 +591,7 @@ namespace Game.Chat
static bool HandleGameObjectSetStateCommand(StringArguments args, CommandHandler handler) static bool HandleGameObjectSetStateCommand(StringArguments args, CommandHandler handler)
{ {
// number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r // number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r
string id = handler.extractKeyFromLink(args, "Hgameobject"); string id = handler.ExtractKeyFromLink(args, "Hgameobject");
if (string.IsNullOrEmpty(id)) if (string.IsNullOrEmpty(id))
return false; return false;
+5 -5
View File
@@ -39,7 +39,7 @@ namespace Game.Chat.Commands
Player player = handler.GetSession().GetPlayer(); Player player = handler.GetSession().GetPlayer();
// "id" or number or [name] Shift-click form |color|Hcreature_entry:creature_id|h[name]|h|r // "id" or number or [name] Shift-click form |color|Hcreature_entry:creature_id|h[name]|h|r
string param1 = handler.extractKeyFromLink(args, "Hcreature", "Hcreature_entry"); string param1 = handler.ExtractKeyFromLink(args, "Hcreature", "Hcreature_entry");
if (string.IsNullOrEmpty(param1)) if (string.IsNullOrEmpty(param1))
return false; return false;
@@ -195,7 +195,7 @@ namespace Game.Chat.Commands
Player player = handler.GetSession().GetPlayer(); Player player = handler.GetSession().GetPlayer();
// number or [name] Shift-click form |color|Hgameobject:go_guid|h[name]|h|r // number or [name] Shift-click form |color|Hgameobject:go_guid|h[name]|h|r
string id = handler.extractKeyFromLink(args, "Hgameobject"); string id = handler.ExtractKeyFromLink(args, "Hgameobject");
if (string.IsNullOrEmpty(id)) if (string.IsNullOrEmpty(id))
return false; return false;
@@ -249,7 +249,7 @@ namespace Game.Chat.Commands
Player player = handler.GetSession().GetPlayer(); Player player = handler.GetSession().GetPlayer();
string id = handler.extractKeyFromLink(args, "Hquest"); string id = handler.ExtractKeyFromLink(args, "Hquest");
if (string.IsNullOrEmpty(id)) if (string.IsNullOrEmpty(id))
return false; return false;
@@ -312,7 +312,7 @@ namespace Game.Chat.Commands
if (args.Empty()) if (args.Empty())
return false; return false;
string id = handler.extractKeyFromLink(args, "Htaxinode"); string id = handler.ExtractKeyFromLink(args, "Htaxinode");
if (string.IsNullOrEmpty(id)) if (string.IsNullOrEmpty(id))
return false; return false;
@@ -405,7 +405,7 @@ namespace Game.Chat.Commands
if (x == 0.0f || y == 0.0f) if (x == 0.0f || y == 0.0f)
return false; return false;
string idStr = handler.extractKeyFromLink(args, "Harea"); // string or [name] Shift-click form |color|Harea:area_id|h[name]|h|r string idStr = handler.ExtractKeyFromLink(args, "Harea"); // string or [name] Shift-click form |color|Harea:area_id|h[name]|h|r
if (!uint.TryParse(idStr, out uint areaId)) if (!uint.TryParse(idStr, out uint areaId))
areaId = player.GetZoneId(); areaId = player.GetZoneId();
+5 -5
View File
@@ -36,7 +36,7 @@ namespace Game.Chat
static bool HandleGroupSummonCommand(StringArguments args, CommandHandler handler) static bool HandleGroupSummonCommand(StringArguments args, CommandHandler handler)
{ {
Player target; Player target;
if (!handler.extractPlayerTarget(args, out target)) if (!handler.ExtractPlayerTarget(args, out target))
return false; return false;
// check online security // check online security
@@ -68,7 +68,7 @@ namespace Game.Chat
return false; return false;
} }
for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.next()) for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next())
{ {
Player player = refe.GetSource(); Player player = refe.GetSource();
@@ -100,7 +100,7 @@ namespace Game.Chat
} }
handler.SendSysMessage(CypherStrings.Summoning, plNameLink, ""); handler.SendSysMessage(CypherStrings.Summoning, plNameLink, "");
if (handler.needReportToTarget(player)) if (handler.NeedReportToTarget(player))
player.SendSysMessage(CypherStrings.SummonedBy, handler.GetNameLink()); player.SendSysMessage(CypherStrings.SummonedBy, handler.GetNameLink());
// stop flight if need // stop flight if need
@@ -255,7 +255,7 @@ namespace Game.Chat
guidTarget = parseGUID; guidTarget = parseGUID;
} }
// If not, we return false and end right away. // If not, we return false and end right away.
else if (!handler.extractPlayerTarget(args, out playerTarget, out guidTarget, out nameTarget)) else if (!handler.ExtractPlayerTarget(args, out playerTarget, out guidTarget, out nameTarget))
return false; return false;
// Next, we need a group. So we define a group variable. // Next, we need a group. So we define a group variable.
@@ -286,7 +286,7 @@ namespace Game.Chat
var members = groupTarget.GetMemberSlots(); var members = groupTarget.GetMemberSlots();
// To avoid a cluster fuck, namely trying multiple queries to simply get a group member count... // To avoid a cluster fuck, namely trying multiple queries to simply get a group member count...
handler.SendSysMessage(CypherStrings.GroupType, (groupTarget.isRaidGroup() ? "raid" : "party"), members.Count); handler.SendSysMessage(CypherStrings.GroupType, (groupTarget.IsRaidGroup() ? "raid" : "party"), members.Count);
// ... we simply move the group type and member count print after retrieving the slots and simply output it's size. // ... we simply move the group type and member count print after retrieving the slots and simply output it's size.
// While rather dirty codestyle-wise, it saves space (if only a little). For each member, we look several informations up. // While rather dirty codestyle-wise, it saves space (if only a little). For each member, we look several informations up.
+11 -11
View File
@@ -32,10 +32,10 @@ namespace Game.Chat
return false; return false;
Player target; Player target;
if (!handler.extractPlayerTarget(args[0] != '"' ? args : null, out target)) if (!handler.ExtractPlayerTarget(args[0] != '"' ? args : null, out target))
return false; return false;
string guildname = handler.extractQuotedArg(args.NextString()); string guildname = handler.ExtractQuotedArg(args.NextString());
if (string.IsNullOrEmpty(guildname)) if (string.IsNullOrEmpty(guildname))
return false; return false;
@@ -60,7 +60,7 @@ namespace Game.Chat
[Command("delete", RBACPermissions.CommandGuildDelete, true)] [Command("delete", RBACPermissions.CommandGuildDelete, true)]
static bool HandleGuildDeleteCommand(StringArguments args, CommandHandler handler) static bool HandleGuildDeleteCommand(StringArguments args, CommandHandler handler)
{ {
string guildName = handler.extractQuotedArg(args.NextString()); string guildName = handler.ExtractQuotedArg(args.NextString());
if (string.IsNullOrEmpty(guildName)) if (string.IsNullOrEmpty(guildName))
return false; return false;
@@ -79,10 +79,10 @@ namespace Game.Chat
return false; return false;
Player target; Player target;
if (!handler.extractPlayerTarget(args[0] != '"' ? args : null, out target)) if (!handler.ExtractPlayerTarget(args[0] != '"' ? args : null, out target))
return false; return false;
string guildName = handler.extractQuotedArg(args.NextString()); string guildName = handler.ExtractQuotedArg(args.NextString());
if (string.IsNullOrEmpty(guildName)) if (string.IsNullOrEmpty(guildName))
return false; return false;
@@ -100,7 +100,7 @@ namespace Game.Chat
{ {
Player target; Player target;
ObjectGuid targetGuid = ObjectGuid.Empty; ObjectGuid targetGuid = ObjectGuid.Empty;
if (!handler.extractPlayerTarget(args, out target, out targetGuid)) if (!handler.ExtractPlayerTarget(args, out target, out targetGuid))
return false; return false;
ulong guildId = target != null ? target.GetGuildId() : Global.CharacterCacheStorage.GetCharacterGuildIdByGuid(targetGuid); ulong guildId = target != null ? target.GetGuildId() : Global.CharacterCacheStorage.GetCharacterGuildIdByGuid(targetGuid);
@@ -120,14 +120,14 @@ namespace Game.Chat
{ {
string nameStr; string nameStr;
string rankStr; string rankStr;
handler.extractOptFirstArg(args, out nameStr, out rankStr); handler.ExtractOptFirstArg(args, out nameStr, out rankStr);
if (string.IsNullOrEmpty(rankStr)) if (string.IsNullOrEmpty(rankStr))
return false; return false;
Player target; Player target;
ObjectGuid targetGuid; ObjectGuid targetGuid;
string target_name; string target_name;
if (!handler.extractPlayerTarget(new StringArguments(nameStr), out target, out targetGuid, out target_name)) if (!handler.ExtractPlayerTarget(new StringArguments(nameStr), out target, out targetGuid, out target_name))
return false; return false;
ulong guildId = target ? target.GetGuildId() : Global.CharacterCacheStorage.GetCharacterGuildIdByGuid(targetGuid); ulong guildId = target ? target.GetGuildId() : Global.CharacterCacheStorage.GetCharacterGuildIdByGuid(targetGuid);
@@ -150,14 +150,14 @@ namespace Game.Chat
if (args.Empty()) if (args.Empty())
return false; return false;
string oldGuildStr = handler.extractQuotedArg(args.NextString()); string oldGuildStr = handler.ExtractQuotedArg(args.NextString());
if (string.IsNullOrEmpty(oldGuildStr)) if (string.IsNullOrEmpty(oldGuildStr))
{ {
handler.SendSysMessage(CypherStrings.BadValue); handler.SendSysMessage(CypherStrings.BadValue);
return false; return false;
} }
string newGuildStr = handler.extractQuotedArg(args.NextString()); string newGuildStr = handler.ExtractQuotedArg(args.NextString());
if (string.IsNullOrEmpty(newGuildStr)) if (string.IsNullOrEmpty(newGuildStr))
{ {
handler.SendSysMessage(CypherStrings.InsertGuildName); handler.SendSysMessage(CypherStrings.InsertGuildName);
@@ -191,7 +191,7 @@ namespace Game.Chat
static bool HandleGuildInfoCommand(StringArguments args, CommandHandler handler) static bool HandleGuildInfoCommand(StringArguments args, CommandHandler handler)
{ {
Guild guild = null; Guild guild = null;
Player target = handler.getSelectedPlayerOrSelf(); Player target = handler.GetSelectedPlayerOrSelf();
if (!args.Empty() && args[0] != '\0') if (!args.Empty() && args[0] != '\0')
{ {
+3 -3
View File
@@ -27,7 +27,7 @@ namespace Game.Chat.Commands
[Command("update", RBACPermissions.CommandHonorUpdate)] [Command("update", RBACPermissions.CommandHonorUpdate)]
static bool HandleHonorUpdateCommand(StringArguments args, CommandHandler handler) static bool HandleHonorUpdateCommand(StringArguments args, CommandHandler handler)
{ {
Player target = handler.getSelectedPlayer(); Player target = handler.GetSelectedPlayer();
if (!target) if (!target)
{ {
handler.SendSysMessage(CypherStrings.PlayerNotFound); handler.SendSysMessage(CypherStrings.PlayerNotFound);
@@ -51,7 +51,7 @@ namespace Game.Chat.Commands
if (args.Empty()) if (args.Empty())
return false; return false;
Player target = handler.getSelectedPlayer(); Player target = handler.GetSelectedPlayer();
if (!target) if (!target)
{ {
handler.SendSysMessage(CypherStrings.PlayerNotFound); handler.SendSysMessage(CypherStrings.PlayerNotFound);
@@ -70,7 +70,7 @@ namespace Game.Chat.Commands
[Command("kill", RBACPermissions.CommandHonorAddKill)] [Command("kill", RBACPermissions.CommandHonorAddKill)]
static bool HandleHonorAddKillCommand(StringArguments args, CommandHandler handler) static bool HandleHonorAddKillCommand(StringArguments args, CommandHandler handler)
{ {
Unit target = handler.getSelectedUnit(); Unit target = handler.GetSelectedUnit();
if (!target) if (!target)
{ {
handler.SendSysMessage(CypherStrings.PlayerNotFound); handler.SendSysMessage(CypherStrings.PlayerNotFound);
@@ -29,7 +29,7 @@ namespace Game.Chat
[Command("listbinds", RBACPermissions.CommandInstanceListbinds)] [Command("listbinds", RBACPermissions.CommandInstanceListbinds)]
static bool HandleInstanceListBinds(StringArguments args, CommandHandler handler) static bool HandleInstanceListBinds(StringArguments args, CommandHandler handler)
{ {
Player player = handler.getSelectedPlayer(); Player player = handler.GetSelectedPlayer();
if (!player) if (!player)
player = handler.GetSession().GetPlayer(); player = handler.GetSession().GetPlayer();
@@ -76,7 +76,7 @@ namespace Game.Chat
if (args.Empty()) if (args.Empty())
return false; return false;
Player player = handler.getSelectedPlayer(); Player player = handler.GetSelectedPlayer();
if (!player) if (!player)
player = handler.GetSession().GetPlayer(); player = handler.GetSession().GetPlayer();
+3 -3
View File
@@ -33,7 +33,7 @@ namespace Game.Chat
Player target = null; Player target = null;
string playerName; string playerName;
ObjectGuid guid; ObjectGuid guid;
if (!handler.extractPlayerTarget(args, out target, out guid, out playerName)) if (!handler.ExtractPlayerTarget(args, out target, out guid, out playerName))
return false; return false;
GetPlayerInfo(handler, target); GetPlayerInfo(handler, target);
@@ -56,7 +56,7 @@ namespace Game.Chat
playerTarget = Global.ObjAccessor.FindPlayer(parseGUID); playerTarget = Global.ObjAccessor.FindPlayer(parseGUID);
guidTarget = parseGUID; guidTarget = parseGUID;
} }
else if (!handler.extractPlayerTarget(args, out playerTarget, out guidTarget, out nameTarget)) else if (!handler.ExtractPlayerTarget(args, out playerTarget, out guidTarget, out nameTarget))
return false; return false;
Group groupTarget = null; Group groupTarget = null;
@@ -78,7 +78,7 @@ namespace Game.Chat
} }
ObjectGuid guid = groupTarget.GetGUID(); ObjectGuid guid = groupTarget.GetGUID();
handler.SendSysMessage(CypherStrings.LfgGroupInfo, groupTarget.isLFGGroup(), Global.LFGMgr.GetState(guid), Global.LFGMgr.GetDungeon(guid)); handler.SendSysMessage(CypherStrings.LfgGroupInfo, groupTarget.IsLFGGroup(), Global.LFGMgr.GetState(guid), Global.LFGMgr.GetDungeon(guid));
foreach (var slot in groupTarget.GetMemberSlots()) foreach (var slot in groupTarget.GetMemberSlots())
{ {
+7 -7
View File
@@ -31,7 +31,7 @@ namespace Game.Chat.Commands
[Command("", RBACPermissions.CommandLearn)] [Command("", RBACPermissions.CommandLearn)]
static bool HandleLearnCommand(StringArguments args, CommandHandler handler) static bool HandleLearnCommand(StringArguments args, CommandHandler handler)
{ {
Player targetPlayer = handler.getSelectedPlayerOrSelf(); Player targetPlayer = handler.GetSelectedPlayerOrSelf();
if (!targetPlayer) if (!targetPlayer)
{ {
@@ -40,7 +40,7 @@ namespace Game.Chat.Commands
} }
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint spell = handler.extractSpellIdFromLink(args); uint spell = handler.ExtractSpellIdFromLink(args);
if (spell == 0 || !Global.SpellMgr.HasSpellInfo(spell)) if (spell == 0 || !Global.SpellMgr.HasSpellInfo(spell))
return false; return false;
@@ -108,7 +108,7 @@ namespace Game.Chat.Commands
static bool HandleLearnAllDefaultCommand(StringArguments args, CommandHandler handler) static bool HandleLearnAllDefaultCommand(StringArguments args, CommandHandler handler)
{ {
Player target; Player target;
if (!handler.extractPlayerTarget(args, out target)) if (!handler.ExtractPlayerTarget(args, out target))
return false; return false;
target.LearnDefaultSkills(); target.LearnDefaultSkills();
@@ -123,7 +123,7 @@ namespace Game.Chat.Commands
static bool HandleLearnAllCraftsCommand(StringArguments args, CommandHandler handler) static bool HandleLearnAllCraftsCommand(StringArguments args, CommandHandler handler)
{ {
Player target; Player target;
if (!handler.extractPlayerTarget(args, out target)) if (!handler.ExtractPlayerTarget(args, out target))
return false; return false;
foreach (var skillInfo in CliDB.SkillLineStorage.Values) foreach (var skillInfo in CliDB.SkillLineStorage.Values)
@@ -144,7 +144,7 @@ namespace Game.Chat.Commands
// Learns all recipes of specified profession and sets skill to max // Learns all recipes of specified profession and sets skill to max
// Example: .learn all_recipes enchanting // Example: .learn all_recipes enchanting
Player target = handler.getSelectedPlayer(); Player target = handler.GetSelectedPlayer();
if (!target) if (!target)
{ {
handler.SendSysMessage(CypherStrings.PlayerNotFound); handler.SendSysMessage(CypherStrings.PlayerNotFound);
@@ -320,14 +320,14 @@ namespace Game.Chat.Commands
return false; return false;
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r
uint spellId = handler.extractSpellIdFromLink(args); uint spellId = handler.ExtractSpellIdFromLink(args);
if (spellId == 0) if (spellId == 0)
return false; return false;
string allStr = args.NextString(); string allStr = args.NextString();
bool allRanks = !string.IsNullOrEmpty(allStr) && allStr == "all"; bool allRanks = !string.IsNullOrEmpty(allStr) && allStr == "all";
Player target = handler.getSelectedPlayer(); Player target = handler.GetSelectedPlayer();
if (!target) if (!target)
{ {
handler.SendSysMessage(CypherStrings.NoCharSelected); handler.SendSysMessage(CypherStrings.NoCharSelected);
+9 -9
View File
@@ -30,7 +30,7 @@ namespace Game.Chat.Commands
[Command("auras", RBACPermissions.CommandListAuras)] [Command("auras", RBACPermissions.CommandListAuras)]
static bool HandleListAurasCommand(StringArguments args, CommandHandler handler) static bool HandleListAurasCommand(StringArguments args, CommandHandler handler)
{ {
Unit unit = handler.getSelectedUnit(); Unit unit = handler.GetSelectedUnit();
if (!unit) if (!unit)
{ {
handler.SendSysMessage(CypherStrings.SelectCharOrCreature); handler.SendSysMessage(CypherStrings.SelectCharOrCreature);
@@ -81,7 +81,7 @@ namespace Game.Chat.Commands
return false; return false;
// number or [name] Shift-click form |color|Hcreature_entry:creature_id|h[name]|h|r // number or [name] Shift-click form |color|Hcreature_entry:creature_id|h[name]|h|r
string id = handler.extractKeyFromLink(args, "Hcreature_entry"); string id = handler.ExtractKeyFromLink(args, "Hcreature_entry");
if (string.IsNullOrEmpty(id)) if (string.IsNullOrEmpty(id))
return false; return false;
@@ -148,7 +148,7 @@ namespace Game.Chat.Commands
if (args.Empty()) if (args.Empty())
return false; return false;
string id = handler.extractKeyFromLink(args, "Hitem"); string id = handler.ExtractKeyFromLink(args, "Hitem");
if (string.IsNullOrEmpty(id)) if (string.IsNullOrEmpty(id))
return false; return false;
@@ -350,7 +350,7 @@ namespace Game.Chat.Commands
target = Global.ObjAccessor.FindPlayer(parseGUID); target = Global.ObjAccessor.FindPlayer(parseGUID);
targetGuid = parseGUID; targetGuid = parseGUID;
} }
else if (!handler.extractPlayerTarget(args, out target, out targetGuid, out targetName)) else if (!handler.ExtractPlayerTarget(args, out target, out targetGuid, out targetName))
return false; return false;
stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_MAIL_LIST_COUNT); stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_MAIL_LIST_COUNT);
@@ -360,7 +360,7 @@ namespace Game.Chat.Commands
{ {
uint countMail = result.Read<uint>(0); uint countMail = result.Read<uint>(0);
string nameLink = handler.playerLink(targetName); string nameLink = handler.PlayerLink(targetName);
handler.SendSysMessage(CypherStrings.ListMailHeader, countMail, nameLink, targetGuid.ToString()); handler.SendSysMessage(CypherStrings.ListMailHeader, countMail, nameLink, targetGuid.ToString());
handler.SendSysMessage(CypherStrings.AccountListBar); handler.SendSysMessage(CypherStrings.AccountListBar);
@@ -385,8 +385,8 @@ namespace Game.Chat.Commands
uint gold = (uint)(money / MoneyConstants.Gold); uint gold = (uint)(money / MoneyConstants.Gold);
uint silv = (uint)(money % MoneyConstants.Gold) / MoneyConstants.Silver; uint silv = (uint)(money % MoneyConstants.Gold) / MoneyConstants.Silver;
uint copp = (uint)(money % MoneyConstants.Gold) % MoneyConstants.Silver; uint copp = (uint)(money % MoneyConstants.Gold) % MoneyConstants.Silver;
string receiverStr = handler.playerLink(receiver); string receiverStr = handler.PlayerLink(receiver);
string senderStr = handler.playerLink(sender); string senderStr = handler.PlayerLink(sender);
handler.SendSysMessage(CypherStrings.ListMailInfo1, messageId, subject, gold, silv, copp); handler.SendSysMessage(CypherStrings.ListMailInfo1, messageId, subject, gold, silv, copp);
handler.SendSysMessage(CypherStrings.ListMailInfo2, senderStr, senderId, receiverStr, receiverId); handler.SendSysMessage(CypherStrings.ListMailInfo2, senderStr, senderId, receiverStr, receiverId);
handler.SendSysMessage(CypherStrings.ListMailInfo3, Time.UnixTimeToDateTime(deliverTime).ToLongDateString(), Time.UnixTimeToDateTime(expireTime).ToLongDateString()); handler.SendSysMessage(CypherStrings.ListMailInfo3, Time.UnixTimeToDateTime(deliverTime).ToLongDateString(), Time.UnixTimeToDateTime(expireTime).ToLongDateString());
@@ -447,7 +447,7 @@ namespace Game.Chat.Commands
return false; return false;
// number or [name] Shift-click form |color|Hgameobject_entry:go_id|h[name]|h|r // number or [name] Shift-click form |color|Hgameobject_entry:go_id|h[name]|h|r
string id = handler.extractKeyFromLink(args, "Hgameobject_entry"); string id = handler.ExtractKeyFromLink(args, "Hgameobject_entry");
if (string.IsNullOrEmpty(id)) if (string.IsNullOrEmpty(id))
return false; return false;
@@ -512,7 +512,7 @@ namespace Game.Chat.Commands
[Command("scenes", RBACPermissions.CommandListScenes)] [Command("scenes", RBACPermissions.CommandListScenes)]
static bool HandleListScenesCommand(StringArguments args, CommandHandler handler) static bool HandleListScenesCommand(StringArguments args, CommandHandler handler)
{ {
Player target = handler.getSelectedPlayer(); Player target = handler.GetSelectedPlayer();
if (!target) if (!target)
target = handler.GetSession().GetPlayer(); target = handler.GetSession().GetPlayer();
+7 -7
View File
@@ -222,7 +222,7 @@ namespace Game.Chat
return false; return false;
// Can be NULL at console call // Can be NULL at console call
Player target = handler.getSelectedPlayer(); Player target = handler.GetSelectedPlayer();
string namePart = args.NextString().ToLower(); string namePart = args.NextString().ToLower();
@@ -490,7 +490,7 @@ namespace Game.Chat
return false; return false;
// can be NULL at console call // can be NULL at console call
Player target = handler.getSelectedPlayer(); Player target = handler.GetSelectedPlayer();
string namePart = args.NextString().ToLower(); string namePart = args.NextString().ToLower();
@@ -620,7 +620,7 @@ namespace Game.Chat
return false; return false;
// can be NULL in console call // can be NULL in console call
Player target = handler.getSelectedPlayer(); Player target = handler.GetSelectedPlayer();
string namePart = args.NextString(); string namePart = args.NextString();
@@ -786,7 +786,7 @@ namespace Game.Chat
return false; return false;
// can be NULL in console call // can be NULL in console call
Player target = handler.getSelectedPlayer(); Player target = handler.GetSelectedPlayer();
// title name have single string arg for player name // title name have single string arg for player name
string targetName = target ? target.GetName() : "NAME"; string targetName = target ? target.GetName() : "NAME";
@@ -943,7 +943,7 @@ namespace Game.Chat
int limit; int limit;
string limitStr; string limitStr;
Player target = handler.getSelectedPlayer(); Player target = handler.GetSelectedPlayer();
if (args.Empty()) if (args.Empty())
{ {
// NULL only if used from console // NULL only if used from console
@@ -1058,7 +1058,7 @@ namespace Game.Chat
return false; return false;
// can be NULL at console call // can be NULL at console call
Player target = handler.getSelectedPlayer(); Player target = handler.GetSelectedPlayer();
string namePart = args.NextString(); string namePart = args.NextString();
@@ -1157,7 +1157,7 @@ namespace Game.Chat
return false; return false;
// can be NULL at console call // can be NULL at console call
Player target = handler.getSelectedPlayer(); Player target = handler.GetSelectedPlayer();
uint id = args.NextUInt32(); uint id = args.NextUInt32();
+2 -2
View File
@@ -40,7 +40,7 @@ namespace Game.Chat
// units // units
Player player = handler.GetPlayer(); Player player = handler.GetPlayer();
Unit target = handler.getSelectedUnit(); Unit target = handler.GetSelectedUnit();
if (player == null || target == null) if (player == null || target == null)
{ {
handler.SendSysMessage("Invalid target/source selection."); handler.SendSysMessage("Invalid target/source selection.");
@@ -187,7 +187,7 @@ namespace Game.Chat
uint terrainMapId = PhasingHandler.GetTerrainMapId(player.GetPhaseShift(), player.GetMap(), player.GetPositionX(), player.GetPositionY()); uint terrainMapId = PhasingHandler.GetTerrainMapId(player.GetPhaseShift(), player.GetMap(), player.GetPositionX(), player.GetPositionY());
handler.SendSysMessage("mmap stats:"); handler.SendSysMessage("mmap stats:");
handler.SendSysMessage(" global mmap pathfinding is {0}abled", Global.DisableMgr.IsPathfindingEnabled(player.GetMapId()) ? "En" : "Dis"); handler.SendSysMessage(" global mmap pathfinding is {0}abled", Global.DisableMgr.IsPathfindingEnabled(player.GetMapId()) ? "En" : "Dis");
handler.SendSysMessage(" {0} maps loaded with {1} tiles overall", Global.MMapMgr.getLoadedMapsCount(), Global.MMapMgr.getLoadedTilesCount()); handler.SendSysMessage(" {0} maps loaded with {1} tiles overall", Global.MMapMgr.GetLoadedMapsCount(), Global.MMapMgr.GetLoadedTilesCount());
Detour.dtNavMesh navmesh = Global.MMapMgr.GetNavMesh(terrainMapId); Detour.dtNavMesh navmesh = Global.MMapMgr.GetNavMesh(terrainMapId);
if (navmesh == null) if (navmesh == null)
+55 -55
View File
@@ -85,7 +85,7 @@ namespace Game.Chat
{ {
Player target; Player target;
ObjectGuid targetGuid; ObjectGuid targetGuid;
if (!handler.extractPlayerTarget(args, out target, out targetGuid)) if (!handler.ExtractPlayerTarget(args, out target, out targetGuid))
return false; return false;
if (target != null) if (target != null)
@@ -103,7 +103,7 @@ namespace Game.Chat
[CommandNonGroup("die", RBACPermissions.CommandDie)] [CommandNonGroup("die", RBACPermissions.CommandDie)]
static bool Die(StringArguments args, CommandHandler handler) static bool Die(StringArguments args, CommandHandler handler)
{ {
Unit target = handler.getSelectedUnit(); Unit target = handler.GetSelectedUnit();
if (!target && handler.GetPlayer().GetTarget().IsEmpty()) if (!target && handler.GetPlayer().GetTarget().IsEmpty())
{ {
@@ -129,7 +129,7 @@ namespace Game.Chat
if (!args.Empty()) if (!args.Empty())
{ {
HighGuid guidHigh = 0; HighGuid guidHigh = 0;
ulong guidLow = handler.extractLowGuidFromLink(args, ref guidHigh); ulong guidLow = handler.ExtractLowGuidFromLink(args, ref guidHigh);
if (guidLow == 0) if (guidLow == 0)
return false; return false;
switch (guidHigh) switch (guidHigh)
@@ -169,7 +169,7 @@ namespace Game.Chat
} }
else else
{ {
obj = handler.getSelectedUnit(); obj = handler.GetSelectedUnit();
if (!obj) if (!obj)
{ {
@@ -201,8 +201,8 @@ namespace Game.Chat
GridCoord gridCoord = GridDefines.ComputeGridCoord(obj.GetPositionX(), obj.GetPositionY()); GridCoord gridCoord = GridDefines.ComputeGridCoord(obj.GetPositionX(), obj.GetPositionY());
// 63? WHY? // 63? WHY?
uint gridX = (MapConst.MaxGrids - 1) - gridCoord.x_coord; uint gridX = (MapConst.MaxGrids - 1) - gridCoord.X_coord;
uint gridY = (MapConst.MaxGrids - 1) - gridCoord.y_coord; uint gridY = (MapConst.MaxGrids - 1) - gridCoord.Y_coord;
bool haveMap = Map.ExistMap(mapId, gridX, gridY); bool haveMap = Map.ExistMap(mapId, gridX, gridY);
bool haveVMap = Map.ExistVMap(mapId, gridX, gridY); bool haveVMap = Map.ExistVMap(mapId, gridX, gridY);
@@ -237,7 +237,7 @@ namespace Game.Chat
zoneX, zoneY, groundZ, floorZ, haveMap, haveVMap, haveMMap); zoneX, zoneY, groundZ, floorZ, haveMap, haveVMap, haveMMap);
LiquidData liquidStatus; LiquidData liquidStatus;
ZLiquidStatus status = map.getLiquidStatus(obj.GetPhaseShift(), obj.GetPositionX(), obj.GetPositionY(), obj.GetPositionZ(), MapConst.MapAllLiquidTypes, out liquidStatus); ZLiquidStatus status = map.GetLiquidStatus(obj.GetPhaseShift(), obj.GetPositionX(), obj.GetPositionY(), obj.GetPositionZ(), MapConst.MapAllLiquidTypes, out liquidStatus);
if (liquidStatus != null) if (liquidStatus != null)
handler.SendSysMessage(CypherStrings.LiquidStatus, liquidStatus.level, liquidStatus.depth_level, liquidStatus.entry, liquidStatus.type_flags, status); handler.SendSysMessage(CypherStrings.LiquidStatus, liquidStatus.level, liquidStatus.depth_level, liquidStatus.entry, liquidStatus.type_flags, status);
@@ -281,7 +281,7 @@ namespace Game.Chat
} }
else // item_id or [name] Shift-click form |color|Hitem:item_id:0:0:0|h[name]|h|r else // item_id or [name] Shift-click form |color|Hitem:item_id:0:0:0|h[name]|h|r
{ {
string idStr = handler.extractKeyFromLink(args, "Hitem"); string idStr = handler.ExtractKeyFromLink(args, "Hitem");
if (string.IsNullOrEmpty(idStr)) if (string.IsNullOrEmpty(idStr))
return false; return false;
@@ -309,7 +309,7 @@ namespace Game.Chat
} }
Player player = handler.GetSession().GetPlayer(); Player player = handler.GetSession().GetPlayer();
Player playerTarget = handler.getSelectedPlayer(); Player playerTarget = handler.GetSelectedPlayer();
if (!playerTarget) if (!playerTarget)
playerTarget = player; playerTarget = player;
@@ -377,7 +377,7 @@ namespace Game.Chat
if (args.Empty()) if (args.Empty())
return false; return false;
string idStr = handler.extractKeyFromLink(args, "Hitemset"); // number or [name] Shift-click form |color|Hitemset:itemset_id|h[name]|h|r string idStr = handler.ExtractKeyFromLink(args, "Hitemset"); // number or [name] Shift-click form |color|Hitemset:itemset_id|h[name]|h|r
if (string.IsNullOrEmpty(idStr)) if (string.IsNullOrEmpty(idStr))
return false; return false;
@@ -403,7 +403,7 @@ namespace Game.Chat
} }
Player player = handler.GetSession().GetPlayer(); Player player = handler.GetSession().GetPlayer();
Player playerTarget = handler.getSelectedPlayer(); Player playerTarget = handler.GetSelectedPlayer();
if (!playerTarget) if (!playerTarget)
playerTarget = player; playerTarget = player;
@@ -485,7 +485,7 @@ namespace Game.Chat
Player target; Player target;
ObjectGuid targetGuid; ObjectGuid targetGuid;
string targetName; string targetName;
if (!handler.extractPlayerTarget(args, out target, out targetGuid, out targetName)) if (!handler.ExtractPlayerTarget(args, out target, out targetGuid, out targetName))
return false; return false;
Player _player = handler.GetSession().GetPlayer(); Player _player = handler.GetSession().GetPlayer();
@@ -501,7 +501,7 @@ namespace Game.Chat
if (handler.HasLowerSecurity(target, ObjectGuid.Empty)) if (handler.HasLowerSecurity(target, ObjectGuid.Empty))
return false; return false;
string chrNameLink = handler.playerLink(targetName); string chrNameLink = handler.PlayerLink(targetName);
Map map = target.GetMap(); Map map = target.GetMap();
if (map.IsBattlegroundOrArena()) if (map.IsBattlegroundOrArena())
@@ -598,7 +598,7 @@ namespace Game.Chat
if (handler.HasLowerSecurity(null, targetGuid)) if (handler.HasLowerSecurity(null, targetGuid))
return false; return false;
string nameLink = handler.playerLink(targetName); string nameLink = handler.PlayerLink(targetName);
handler.SendSysMessage(CypherStrings.AppearingAt, nameLink); handler.SendSysMessage(CypherStrings.AppearingAt, nameLink);
@@ -632,7 +632,7 @@ namespace Game.Chat
Player target; Player target;
ObjectGuid targetGuid; ObjectGuid targetGuid;
string targetName; string targetName;
if (!handler.extractPlayerTarget(args, out target, out targetGuid, out targetName)) if (!handler.ExtractPlayerTarget(args, out target, out targetGuid, out targetName))
return false; return false;
Player _player = handler.GetSession().GetPlayer(); Player _player = handler.GetSession().GetPlayer();
@@ -645,7 +645,7 @@ namespace Game.Chat
if (target) if (target)
{ {
string nameLink = handler.playerLink(targetName); string nameLink = handler.PlayerLink(targetName);
// check online security // check online security
if (handler.HasLowerSecurity(target, ObjectGuid.Empty)) if (handler.HasLowerSecurity(target, ObjectGuid.Empty))
return false; return false;
@@ -698,8 +698,8 @@ namespace Game.Chat
} }
handler.SendSysMessage(CypherStrings.Summoning, nameLink, ""); handler.SendSysMessage(CypherStrings.Summoning, nameLink, "");
if (handler.needReportToTarget(target)) if (handler.NeedReportToTarget(target))
target.SendSysMessage(CypherStrings.SummonedBy, handler.playerLink(_player.GetName())); target.SendSysMessage(CypherStrings.SummonedBy, handler.PlayerLink(_player.GetName()));
// stop flight if need // stop flight if need
if (target.IsInFlight()) if (target.IsInFlight())
@@ -724,7 +724,7 @@ namespace Game.Chat
if (handler.HasLowerSecurity(null, targetGuid)) if (handler.HasLowerSecurity(null, targetGuid))
return false; return false;
string nameLink = handler.playerLink(targetName); string nameLink = handler.PlayerLink(targetName);
handler.SendSysMessage(CypherStrings.Summoning, nameLink, handler.GetCypherString(CypherStrings.Offline)); handler.SendSysMessage(CypherStrings.Summoning, nameLink, handler.GetCypherString(CypherStrings.Offline));
@@ -814,7 +814,7 @@ namespace Game.Chat
if (!args.Empty()) if (!args.Empty())
{ {
HighGuid guidHigh = 0; HighGuid guidHigh = 0;
ulong guidLow = handler.extractLowGuidFromLink(args, ref guidHigh); ulong guidLow = handler.ExtractLowGuidFromLink(args, ref guidHigh);
if (guidLow == 0) if (guidLow == 0)
return false; return false;
switch (guidHigh) switch (guidHigh)
@@ -854,7 +854,7 @@ namespace Game.Chat
} }
else else
{ {
obj = handler.getSelectedUnit(); obj = handler.GetSelectedUnit();
if (!obj) if (!obj)
{ {
@@ -872,7 +872,7 @@ namespace Game.Chat
static bool Recall(StringArguments args, CommandHandler handler) static bool Recall(StringArguments args, CommandHandler handler)
{ {
Player target; Player target;
if (!handler.extractPlayerTarget(args, out target)) if (!handler.ExtractPlayerTarget(args, out target))
return false; return false;
// check online security // check online security
@@ -905,7 +905,7 @@ namespace Game.Chat
// save GM account without delay and output message // save GM account without delay and output message
if (handler.GetSession().HasPermission(RBACPermissions.CommandsSaveWithoutDelay)) if (handler.GetSession().HasPermission(RBACPermissions.CommandsSaveWithoutDelay))
{ {
Player target = handler.getSelectedPlayer(); Player target = handler.GetSelectedPlayer();
if (target) if (target)
target.SaveToDB(); target.SaveToDB();
else else
@@ -938,7 +938,7 @@ namespace Game.Chat
Player target = null; Player target = null;
string playerName; string playerName;
ObjectGuid guid; ObjectGuid guid;
if (!handler.extractPlayerTarget(args, out target, out guid, out playerName)) if (!handler.ExtractPlayerTarget(args, out target, out guid, out playerName))
return false; return false;
if (handler.GetSession() != null && target == handler.GetSession().GetPlayer()) if (handler.GetSession() != null && target == handler.GetSession().GetPlayer())
@@ -992,7 +992,7 @@ namespace Game.Chat
Player player = null; Player player = null;
ObjectGuid targetGUID; ObjectGuid targetGUID;
if (!handler.extractPlayerTarget(args, out player, out targetGUID)) if (!handler.ExtractPlayerTarget(args, out player, out targetGUID))
return false; return false;
if (!player) if (!player)
@@ -1161,7 +1161,7 @@ namespace Game.Chat
if (args.Empty()) if (args.Empty())
return false; return false;
Player playerTarget = handler.getSelectedPlayer(); Player playerTarget = handler.GetSelectedPlayer();
if (!playerTarget) if (!playerTarget)
{ {
handler.SendSysMessage(CypherStrings.NoCharSelected); handler.SendSysMessage(CypherStrings.NoCharSelected);
@@ -1201,7 +1201,7 @@ namespace Game.Chat
if (args.Empty()) if (args.Empty())
return false; return false;
Player playerTarget = handler.getSelectedPlayer(); Player playerTarget = handler.GetSelectedPlayer();
if (!playerTarget) if (!playerTarget)
{ {
handler.SendSysMessage(CypherStrings.NoCharSelected); handler.SendSysMessage(CypherStrings.NoCharSelected);
@@ -1297,7 +1297,7 @@ namespace Game.Chat
targetGuid = parseGUID; targetGuid = parseGUID;
} }
// if not, then return false. Which shouldn't happen, now should it ? // if not, then return false. Which shouldn't happen, now should it ?
else if (!handler.extractPlayerTarget(args, out target, out targetGuid, out targetName)) else if (!handler.ExtractPlayerTarget(args, out target, out targetGuid, out targetName))
return false; return false;
/* The variables we extract for the command. They are /* The variables we extract for the command. They are
@@ -1473,7 +1473,7 @@ namespace Game.Chat
} }
// Creates a chat link to the character. Returns nameLink // Creates a chat link to the character. Returns nameLink
string nameLink = handler.playerLink(targetName); string nameLink = handler.PlayerLink(targetName);
// Returns banType, banTime, bannedBy, banreason // Returns banType, banTime, bannedBy, banreason
PreparedStatement stmt2 = DB.Login.GetPreparedStatement(LoginStatements.SEL_PINFO_BANS); PreparedStatement stmt2 = DB.Login.GetPreparedStatement(LoginStatements.SEL_PINFO_BANS);
@@ -1632,7 +1632,7 @@ namespace Game.Chat
Player player = handler.GetSession().GetPlayer(); Player player = handler.GetSession().GetPlayer();
// accept only explicitly selected target (not implicitly self targeting case) // accept only explicitly selected target (not implicitly self targeting case)
Creature target = !player.GetTarget().IsEmpty() ? handler.getSelectedCreature() : null; Creature target = !player.GetTarget().IsEmpty() ? handler.GetSelectedCreature() : null;
if (target) if (target)
{ {
if (target.IsPet()) if (target.IsPet())
@@ -1658,7 +1658,7 @@ namespace Game.Chat
{ {
string nameStr; string nameStr;
string delayStr; string delayStr;
handler.extractOptFirstArg(args, out nameStr, out delayStr); handler.ExtractOptFirstArg(args, out nameStr, out delayStr);
if (string.IsNullOrEmpty(delayStr)) if (string.IsNullOrEmpty(delayStr))
return false; return false;
@@ -1670,7 +1670,7 @@ namespace Game.Chat
Player target; Player target;
ObjectGuid targetGuid; ObjectGuid targetGuid;
string targetName; string targetName;
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;
uint accountId = target ? target.GetSession().GetAccountId() : Global.CharacterCacheStorage.GetCharacterAccountIdByGuid(targetGuid); uint accountId = target ? target.GetSession().GetAccountId() : Global.CharacterCacheStorage.GetCharacterAccountIdByGuid(targetGuid);
@@ -1703,7 +1703,7 @@ namespace Game.Chat
long muteTime = Time.UnixTime + notSpeakTime * Time.Minute; long muteTime = Time.UnixTime + notSpeakTime * Time.Minute;
target.GetSession().m_muteTime = muteTime; target.GetSession().m_muteTime = muteTime;
stmt.AddValue(0, muteTime); stmt.AddValue(0, muteTime);
string nameLink = handler.playerLink(targetName); string nameLink = handler.PlayerLink(targetName);
if (WorldConfig.GetBoolValue(WorldCfg.ShowMuteInWorld)) if (WorldConfig.GetBoolValue(WorldCfg.ShowMuteInWorld))
{ {
@@ -1726,7 +1726,7 @@ namespace Game.Chat
stmt.AddValue(2, muteBy); stmt.AddValue(2, muteBy);
stmt.AddValue(3, accountId); stmt.AddValue(3, accountId);
DB.Login.Execute(stmt); DB.Login.Execute(stmt);
string nameLink_ = handler.playerLink(targetName); string nameLink_ = handler.PlayerLink(targetName);
if (WorldConfig.GetBoolValue(WorldCfg.ShowMuteInWorld) && !target) if (WorldConfig.GetBoolValue(WorldCfg.ShowMuteInWorld) && !target)
Global.WorldMgr.SendWorldText(CypherStrings.CommandMutemessageWorld, handler.GetSession().GetPlayerName(), nameLink_, notSpeakTime, muteReasonStr); Global.WorldMgr.SendWorldText(CypherStrings.CommandMutemessageWorld, handler.GetSession().GetPlayerName(), nameLink_, notSpeakTime, muteReasonStr);
@@ -1742,7 +1742,7 @@ namespace Game.Chat
Player target; Player target;
ObjectGuid targetGuid; ObjectGuid targetGuid;
string targetName; string targetName;
if (!handler.extractPlayerTarget(args, out target, out targetGuid, out targetName)) if (!handler.ExtractPlayerTarget(args, out target, out targetGuid, out targetName))
return false; return false;
uint accountId = target ? target.GetSession().GetAccountId() : Global.CharacterCacheStorage.GetCharacterAccountIdByGuid(targetGuid); uint accountId = target ? target.GetSession().GetAccountId() : Global.CharacterCacheStorage.GetCharacterAccountIdByGuid(targetGuid);
@@ -1780,7 +1780,7 @@ namespace Game.Chat
if (target) if (target)
target.SendSysMessage(CypherStrings.YourChatEnabled); target.SendSysMessage(CypherStrings.YourChatEnabled);
string nameLink = handler.playerLink(targetName); string nameLink = handler.PlayerLink(targetName);
handler.SendSysMessage(CypherStrings.YouEnableChat, nameLink); handler.SendSysMessage(CypherStrings.YouEnableChat, nameLink);
@@ -1833,7 +1833,7 @@ namespace Game.Chat
[CommandNonGroup("movegens", RBACPermissions.CommandMovegens)] [CommandNonGroup("movegens", RBACPermissions.CommandMovegens)]
static bool MoveGens(StringArguments args, CommandHandler handler) static bool MoveGens(StringArguments args, CommandHandler handler)
{ {
Unit unit = handler.getSelectedUnit(); Unit unit = handler.GetSelectedUnit();
if (!unit) if (!unit)
{ {
handler.SendSysMessage(CypherStrings.SelectCharOrCreature); handler.SendSysMessage(CypherStrings.SelectCharOrCreature);
@@ -1877,9 +1877,9 @@ namespace Game.Chat
{ {
Unit target = null; Unit target = null;
if (unit.IsTypeId(TypeId.Player)) if (unit.IsTypeId(TypeId.Player))
target = ((ChaseMovementGenerator<Player>)movementGenerator).target; target = ((ChaseMovementGenerator<Player>)movementGenerator).Target;
else else
target = ((ChaseMovementGenerator<Creature>)movementGenerator).target; target = ((ChaseMovementGenerator<Creature>)movementGenerator).Target;
if (!target) if (!target)
handler.SendSysMessage(CypherStrings.MovegensChaseNull); handler.SendSysMessage(CypherStrings.MovegensChaseNull);
@@ -1893,9 +1893,9 @@ namespace Game.Chat
{ {
Unit target = null; Unit target = null;
if (unit.IsTypeId(TypeId.Player)) if (unit.IsTypeId(TypeId.Player))
target = ((FollowMovementGenerator<Player>)movementGenerator).target; target = ((FollowMovementGenerator<Player>)movementGenerator).Target;
else else
target = ((FollowMovementGenerator<Creature>)movementGenerator).target; target = ((FollowMovementGenerator<Creature>)movementGenerator).Target;
if (!target) if (!target)
handler.SendSysMessage(CypherStrings.MovegensFollowNull); handler.SendSysMessage(CypherStrings.MovegensFollowNull);
@@ -1941,7 +1941,7 @@ namespace Game.Chat
[CommandNonGroup("cometome", RBACPermissions.CommandCometome)] [CommandNonGroup("cometome", RBACPermissions.CommandCometome)]
static bool HandleComeToMeCommand(StringArguments args, CommandHandler handler) static bool HandleComeToMeCommand(StringArguments args, CommandHandler handler)
{ {
Creature caster = handler.getSelectedCreature(); Creature caster = handler.GetSelectedCreature();
if (!caster) if (!caster)
{ {
handler.SendSysMessage(CypherStrings.SelectCreature); handler.SendSysMessage(CypherStrings.SelectCreature);
@@ -2000,7 +2000,7 @@ namespace Game.Chat
return true; return true;
} }
Unit target = handler.getSelectedUnit(); Unit target = handler.GetSelectedUnit();
if (!target || handler.GetSession().GetPlayer().GetTarget().IsEmpty()) if (!target || handler.GetSession().GetPlayer().GetTarget().IsEmpty())
{ {
handler.SendSysMessage(CypherStrings.SelectCharOrCreature); handler.SendSysMessage(CypherStrings.SelectCharOrCreature);
@@ -2066,7 +2066,7 @@ namespace Game.Chat
// non-melee damage // non-melee damage
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint spellid = handler.extractSpellIdFromLink(args); uint spellid = handler.ExtractSpellIdFromLink(args);
if (spellid == 0) if (spellid == 0)
return false; return false;
@@ -2099,7 +2099,7 @@ namespace Game.Chat
if (!target) if (!target)
{ {
if (!handler.extractPlayerTarget(args, out target)) if (!handler.ExtractPlayerTarget(args, out target))
return false; return false;
} }
@@ -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;
} }
@@ -2116,7 +2116,7 @@ namespace Game.Chat
static bool RepairItems(StringArguments args, CommandHandler handler) static bool RepairItems(StringArguments args, CommandHandler handler)
{ {
Player target; Player target;
if (!handler.extractPlayerTarget(args, out target)) if (!handler.ExtractPlayerTarget(args, out target))
return false; return false;
// check online security // check online security
@@ -2127,7 +2127,7 @@ namespace Game.Chat
target.DurabilityRepairAll(false, 0, false); target.DurabilityRepairAll(false, 0, false);
handler.SendSysMessage(CypherStrings.YouRepairItems, handler.GetNameLink(target)); handler.SendSysMessage(CypherStrings.YouRepairItems, handler.GetNameLink(target));
if (handler.needReportToTarget(target)) if (handler.NeedReportToTarget(target))
target.SendSysMessage(CypherStrings.YourItemsRepaired, handler.GetNameLink()); target.SendSysMessage(CypherStrings.YourItemsRepaired, handler.GetNameLink());
return true; return true;
@@ -2136,7 +2136,7 @@ namespace Game.Chat
[CommandNonGroup("freeze", RBACPermissions.CommandFreeze)] [CommandNonGroup("freeze", RBACPermissions.CommandFreeze)]
static bool HandleFreezeCommand(StringArguments args, CommandHandler handler) static bool HandleFreezeCommand(StringArguments args, CommandHandler handler)
{ {
Player player = handler.getSelectedPlayer(); // Selected player, if any. Might be null. Player player = handler.GetSelectedPlayer(); // Selected player, if any. Might be null.
int freezeDuration = 0; // Freeze Duration (in seconds) int freezeDuration = 0; // Freeze Duration (in seconds)
bool canApplyFreeze = false; // Determines if every possible argument is set so Freeze can be applied bool canApplyFreeze = false; // Determines if every possible argument is set so Freeze can be applied
bool getDurationFromConfig = false; // If there's no given duration, we'll retrieve the world cfg value later bool getDurationFromConfig = false; // If there's no given duration, we'll retrieve the world cfg value later
@@ -2240,7 +2240,7 @@ namespace Game.Chat
} }
else // If no name was entered - use target else // If no name was entered - use target
{ {
player = handler.getSelectedPlayer(); player = handler.GetSelectedPlayer();
if (player) if (player)
name = player.GetName(); name = player.GetName();
} }
@@ -2344,7 +2344,7 @@ namespace Game.Chat
[CommandNonGroup("possess", RBACPermissions.CommandPossess)] [CommandNonGroup("possess", RBACPermissions.CommandPossess)]
static bool Possess(StringArguments args, CommandHandler handler) static bool Possess(StringArguments args, CommandHandler handler)
{ {
Unit unit = handler.getSelectedUnit(); Unit unit = handler.GetSelectedUnit();
if (!unit) if (!unit)
return false; return false;
@@ -2355,7 +2355,7 @@ namespace Game.Chat
[CommandNonGroup("unpossess", RBACPermissions.CommandUnpossess)] [CommandNonGroup("unpossess", RBACPermissions.CommandUnpossess)]
static bool UnPossess(StringArguments args, CommandHandler handler) static bool UnPossess(StringArguments args, CommandHandler handler)
{ {
Unit unit = handler.getSelectedUnit(); Unit unit = handler.GetSelectedUnit();
if (!unit) if (!unit)
unit = handler.GetSession().GetPlayer(); unit = handler.GetSession().GetPlayer();
@@ -2367,7 +2367,7 @@ namespace Game.Chat
[CommandNonGroup("bindsight", RBACPermissions.CommandBindsight)] [CommandNonGroup("bindsight", RBACPermissions.CommandBindsight)]
static bool BindSight(StringArguments args, CommandHandler handler) static bool BindSight(StringArguments args, CommandHandler handler)
{ {
Unit unit = handler.getSelectedUnit(); Unit unit = handler.GetSelectedUnit();
if (!unit) if (!unit)
return false; return false;
@@ -2434,14 +2434,14 @@ namespace Game.Chat
if (args.Empty()) if (args.Empty())
return false; return false;
string idStr = handler.extractKeyFromLink(args, "Hachievement"); string idStr = handler.ExtractKeyFromLink(args, "Hachievement");
if (string.IsNullOrEmpty(idStr)) if (string.IsNullOrEmpty(idStr))
return false; return false;
if (!uint.TryParse(idStr, out uint achievementId) || achievementId == 0) if (!uint.TryParse(idStr, out uint achievementId) || achievementId == 0)
return false; return false;
Player target = handler.getSelectedPlayer(); Player target = handler.GetSelectedPlayer();
if (!target) if (!target)
{ {
handler.SendSysMessage(CypherStrings.NoCharSelected); handler.SendSysMessage(CypherStrings.NoCharSelected);
+33 -33
View File
@@ -32,7 +32,7 @@ namespace Game.Chat
static bool HandleModifyHPCommand(StringArguments args, CommandHandler handler) static bool HandleModifyHPCommand(StringArguments args, CommandHandler handler)
{ {
int hp, hpmax = 0; int hp, hpmax = 0;
Player target = handler.getSelectedPlayerOrSelf(); Player target = handler.GetSelectedPlayerOrSelf();
if (CheckModifyResources(args, handler, target, out hp, out hpmax)) if (CheckModifyResources(args, handler, target, out hp, out hpmax))
{ {
NotifyModification(handler, target, CypherStrings.YouChangeHp, CypherStrings.YoursHpChanged, hp, hpmax); NotifyModification(handler, target, CypherStrings.YouChangeHp, CypherStrings.YoursHpChanged, hp, hpmax);
@@ -47,7 +47,7 @@ namespace Game.Chat
static bool HandleModifyManaCommand(StringArguments args, CommandHandler handler) static bool HandleModifyManaCommand(StringArguments args, CommandHandler handler)
{ {
int mana, manamax; int mana, manamax;
Player target = handler.getSelectedPlayerOrSelf(); Player target = handler.GetSelectedPlayerOrSelf();
if (CheckModifyResources(args, handler, target, out mana, out manamax)) if (CheckModifyResources(args, handler, target, out mana, out manamax))
{ {
@@ -64,7 +64,7 @@ namespace Game.Chat
static bool HandleModifyEnergyCommand(StringArguments args, CommandHandler handler) static bool HandleModifyEnergyCommand(StringArguments args, CommandHandler handler)
{ {
int energy, energymax; int energy, energymax;
Player target = handler.getSelectedPlayerOrSelf(); Player target = handler.GetSelectedPlayerOrSelf();
byte energyMultiplier = 10; byte energyMultiplier = 10;
if (CheckModifyResources(args, handler, target, out energy, out energymax, energyMultiplier)) if (CheckModifyResources(args, handler, target, out energy, out energymax, energyMultiplier))
{ {
@@ -80,7 +80,7 @@ namespace Game.Chat
static bool HandleModifyRageCommand(StringArguments args, CommandHandler handler) static bool HandleModifyRageCommand(StringArguments args, CommandHandler handler)
{ {
int rage, ragemax; int rage, ragemax;
Player target = handler.getSelectedPlayerOrSelf(); Player target = handler.GetSelectedPlayerOrSelf();
byte rageMultiplier = 10; byte rageMultiplier = 10;
if (CheckModifyResources(args, handler, target, out rage, out ragemax, rageMultiplier)) if (CheckModifyResources(args, handler, target, out rage, out ragemax, rageMultiplier))
{ {
@@ -96,7 +96,7 @@ namespace Game.Chat
static bool HandleModifyRunicPowerCommand(StringArguments args, CommandHandler handler) static bool HandleModifyRunicPowerCommand(StringArguments args, CommandHandler handler)
{ {
int rune, runemax; int rune, runemax;
Player target = handler.getSelectedPlayerOrSelf(); Player target = handler.GetSelectedPlayerOrSelf();
byte runeMultiplier = 10; byte runeMultiplier = 10;
if (CheckModifyResources(args, handler, target, out rune, out runemax, runeMultiplier)) if (CheckModifyResources(args, handler, target, out rune, out runemax, runeMultiplier))
{ {
@@ -111,9 +111,9 @@ namespace Game.Chat
[Command("faction", RBACPermissions.CommandModifyFaction)] [Command("faction", RBACPermissions.CommandModifyFaction)]
static bool HandleModifyFactionCommand(StringArguments args, CommandHandler handler) static bool HandleModifyFactionCommand(StringArguments args, CommandHandler handler)
{ {
string pfactionid = handler.extractKeyFromLink(args, "Hfaction"); string pfactionid = handler.ExtractKeyFromLink(args, "Hfaction");
Creature target = handler.getSelectedCreature(); Creature target = handler.GetSelectedCreature();
if (!target) if (!target)
{ {
handler.SendSysMessage(CypherStrings.SelectCreature); handler.SendSysMessage(CypherStrings.SelectCreature);
@@ -177,7 +177,7 @@ namespace Game.Chat
if (!ushort.TryParse(args.NextString(), out ushort mark)) if (!ushort.TryParse(args.NextString(), out ushort mark))
mark = 65535; mark = 65535;
Player target = handler.getSelectedPlayerOrSelf(); Player target = handler.GetSelectedPlayerOrSelf();
if (!target) if (!target)
{ {
handler.SendSysMessage(CypherStrings.NoCharSelected); handler.SendSysMessage(CypherStrings.NoCharSelected);
@@ -189,7 +189,7 @@ namespace Game.Chat
return false; return false;
handler.SendSysMessage(CypherStrings.YouChangeSpellflatid, spellflatid, val, mark, handler.GetNameLink(target)); handler.SendSysMessage(CypherStrings.YouChangeSpellflatid, spellflatid, val, mark, handler.GetNameLink(target));
if (handler.needReportToTarget(target)) if (handler.NeedReportToTarget(target))
target.SendSysMessage(CypherStrings.YoursSpellflatidChanged, handler.GetNameLink(), spellflatid, val, mark); target.SendSysMessage(CypherStrings.YoursSpellflatidChanged, handler.GetNameLink(), spellflatid, val, mark);
SetSpellModifier packet = new SetSpellModifier(ServerOpcodes.SetFlatSpellModifier); SetSpellModifier packet = new SetSpellModifier(ServerOpcodes.SetFlatSpellModifier);
@@ -212,7 +212,7 @@ namespace Game.Chat
static bool HandleModifyScaleCommand(StringArguments args, CommandHandler handler) static bool HandleModifyScaleCommand(StringArguments args, CommandHandler handler)
{ {
float Scale; float Scale;
Unit target = handler.getSelectedUnit(); Unit target = handler.GetSelectedUnit();
if (CheckModifySpeed(args, handler, target, out Scale, 0.1f, 10.0f, false)) if (CheckModifySpeed(args, handler, target, out Scale, 0.1f, 10.0f, false))
{ {
NotifyModification(handler, target, CypherStrings.YouChangeSize, CypherStrings.YoursSizeChanged, Scale); NotifyModification(handler, target, CypherStrings.YouChangeSize, CypherStrings.YoursSizeChanged, Scale);
@@ -241,7 +241,7 @@ namespace Game.Chat
return false; return false;
} }
Player target = handler.getSelectedPlayerOrSelf(); Player target = handler.GetSelectedPlayerOrSelf();
if (!target) if (!target)
{ {
handler.SendSysMessage(CypherStrings.NoCharSelected); handler.SendSysMessage(CypherStrings.NoCharSelected);
@@ -266,7 +266,7 @@ namespace Game.Chat
[Command("money", RBACPermissions.CommandModifyMoney)] [Command("money", RBACPermissions.CommandModifyMoney)]
static bool HandleModifyMoneyCommand(StringArguments args, CommandHandler handler) static bool HandleModifyMoneyCommand(StringArguments args, CommandHandler handler)
{ {
Player target = handler.getSelectedPlayerOrSelf(); Player target = handler.GetSelectedPlayerOrSelf();
if (!target) if (!target)
{ {
handler.SendSysMessage(CypherStrings.NoCharSelected); handler.SendSysMessage(CypherStrings.NoCharSelected);
@@ -288,7 +288,7 @@ namespace Game.Chat
if (newmoney <= 0) if (newmoney <= 0)
{ {
handler.SendSysMessage(CypherStrings.YouTakeAllMoney, handler.GetNameLink(target)); handler.SendSysMessage(CypherStrings.YouTakeAllMoney, handler.GetNameLink(target));
if (handler.needReportToTarget(target)) if (handler.NeedReportToTarget(target))
target.SendSysMessage(CypherStrings.YoursAllMoneyGone, handler.GetNameLink()); target.SendSysMessage(CypherStrings.YoursAllMoneyGone, handler.GetNameLink());
target.SetMoney(0); target.SetMoney(0);
@@ -300,7 +300,7 @@ namespace Game.Chat
newmoney = (long)PlayerConst.MaxMoneyAmount; newmoney = (long)PlayerConst.MaxMoneyAmount;
handler.SendSysMessage(CypherStrings.YouTakeMoney, moneyToAddMsg, handler.GetNameLink(target)); handler.SendSysMessage(CypherStrings.YouTakeMoney, moneyToAddMsg, handler.GetNameLink(target));
if (handler.needReportToTarget(target)) if (handler.NeedReportToTarget(target))
target.SendSysMessage(CypherStrings.YoursMoneyTaken, handler.GetNameLink(), moneyToAddMsg); target.SendSysMessage(CypherStrings.YoursMoneyTaken, handler.GetNameLink(), moneyToAddMsg);
target.SetMoney((ulong)newmoney); target.SetMoney((ulong)newmoney);
} }
@@ -308,7 +308,7 @@ namespace Game.Chat
else else
{ {
handler.SendSysMessage(CypherStrings.YouGiveMoney, moneyToAdd, handler.GetNameLink(target)); handler.SendSysMessage(CypherStrings.YouGiveMoney, moneyToAdd, handler.GetNameLink(target));
if (handler.needReportToTarget(target)) if (handler.NeedReportToTarget(target))
target.SendSysMessage(CypherStrings.YoursMoneyGiven, handler.GetNameLink(), moneyToAdd); target.SendSysMessage(CypherStrings.YoursMoneyGiven, handler.GetNameLink(), moneyToAdd);
if ((ulong)moneyToAdd >= PlayerConst.MaxMoneyAmount) if ((ulong)moneyToAdd >= PlayerConst.MaxMoneyAmount)
@@ -329,7 +329,7 @@ namespace Game.Chat
if (args.Empty()) if (args.Empty())
return false; return false;
Player target = handler.getSelectedPlayerOrSelf(); Player target = handler.GetSelectedPlayerOrSelf();
if (!target) if (!target)
{ {
handler.SendSysMessage(CypherStrings.PlayerNotFound); handler.SendSysMessage(CypherStrings.PlayerNotFound);
@@ -359,7 +359,7 @@ namespace Game.Chat
if (drunklevel > 100) if (drunklevel > 100)
drunklevel = 100; drunklevel = 100;
Player target = handler.getSelectedPlayerOrSelf(); Player target = handler.GetSelectedPlayerOrSelf();
if (target) if (target)
target.SetDrunkValue(drunklevel); target.SetDrunkValue(drunklevel);
@@ -372,7 +372,7 @@ namespace Game.Chat
if (args.Empty()) if (args.Empty())
return false; return false;
Player target = handler.getSelectedPlayerOrSelf(); Player target = handler.GetSelectedPlayerOrSelf();
if (!target) if (!target)
{ {
handler.SendSysMessage(CypherStrings.PlayerNotFound); handler.SendSysMessage(CypherStrings.PlayerNotFound);
@@ -383,7 +383,7 @@ namespace Game.Chat
if (handler.HasLowerSecurity(target, ObjectGuid.Empty)) if (handler.HasLowerSecurity(target, ObjectGuid.Empty))
return false; return false;
string factionTxt = handler.extractKeyFromLink(args, "Hfaction"); string factionTxt = handler.ExtractKeyFromLink(args, "Hfaction");
if (string.IsNullOrEmpty(factionTxt)) if (string.IsNullOrEmpty(factionTxt))
return false; return false;
@@ -465,7 +465,7 @@ namespace Game.Chat
return false; return false;
} }
Unit target = handler.getSelectedUnit(); Unit target = handler.GetSelectedUnit();
if (visibleMapId != 0) if (visibleMapId != 0)
{ {
@@ -499,7 +499,7 @@ namespace Game.Chat
if (args.Empty()) if (args.Empty())
return false; return false;
Player target = handler.getSelectedPlayerOrSelf(); Player target = handler.GetSelectedPlayerOrSelf();
if (!target) if (!target)
{ {
handler.SendSysMessage(CypherStrings.NoCharSelected); handler.SendSysMessage(CypherStrings.NoCharSelected);
@@ -558,7 +558,7 @@ namespace Game.Chat
if (args.Empty()) if (args.Empty())
return false; return false;
Player target = handler.getSelectedPlayerOrSelf(); Player target = handler.GetSelectedPlayerOrSelf();
if (!target) if (!target)
{ {
handler.SendSysMessage(CypherStrings.PlayerNotFound); handler.SendSysMessage(CypherStrings.PlayerNotFound);
@@ -601,7 +601,7 @@ namespace Game.Chat
handler.SendSysMessage(CypherStrings.YouChangeGender, handler.GetNameLink(target), gender); handler.SendSysMessage(CypherStrings.YouChangeGender, handler.GetNameLink(target), gender);
if (handler.needReportToTarget(target)) if (handler.NeedReportToTarget(target))
target.SendSysMessage(CypherStrings.YourGenderChanged, gender, handler.GetNameLink()); target.SendSysMessage(CypherStrings.YourGenderChanged, gender, handler.GetNameLink());
return true; return true;
@@ -613,7 +613,7 @@ namespace Game.Chat
if (args.Empty()) if (args.Empty())
return false; return false;
Player target = handler.getSelectedPlayerOrSelf(); Player target = handler.GetSelectedPlayerOrSelf();
if (!target) if (!target)
{ {
handler.SendSysMessage(CypherStrings.PlayerNotFound); handler.SendSysMessage(CypherStrings.PlayerNotFound);
@@ -642,7 +642,7 @@ namespace Game.Chat
uint display_id = args.NextUInt32(); uint display_id = args.NextUInt32();
Unit target = handler.getSelectedUnit(); Unit target = handler.GetSelectedUnit();
if (!target) if (!target)
target = handler.GetSession().GetPlayer(); target = handler.GetSession().GetPlayer();
@@ -658,7 +658,7 @@ namespace Game.Chat
[CommandNonGroup("demorph", RBACPermissions.CommandDemorph)] [CommandNonGroup("demorph", RBACPermissions.CommandDemorph)]
static bool HandleDeMorphCommand(StringArguments args, CommandHandler handler) static bool HandleDeMorphCommand(StringArguments args, CommandHandler handler)
{ {
Unit target = handler.getSelectedUnit(); Unit target = handler.GetSelectedUnit();
if (!target) if (!target)
target = handler.GetSession().GetPlayer(); target = handler.GetSession().GetPlayer();
@@ -685,7 +685,7 @@ namespace Game.Chat
return false; return false;
} }
Player target = handler.getSelectedPlayerOrSelf(); Player target = handler.GetSelectedPlayerOrSelf();
if (!target) if (!target)
{ {
handler.SendSysMessage(CypherStrings.NoCharSelected); handler.SendSysMessage(CypherStrings.NoCharSelected);
@@ -713,7 +713,7 @@ namespace Game.Chat
static bool HandleModifyASpeedCommand(StringArguments args, CommandHandler handler) static bool HandleModifyASpeedCommand(StringArguments args, CommandHandler handler)
{ {
float allSpeed; float allSpeed;
Player target = handler.getSelectedPlayerOrSelf(); Player target = handler.GetSelectedPlayerOrSelf();
if (CheckModifySpeed(args, handler, target, out allSpeed, 0.1f, 50.0f)) if (CheckModifySpeed(args, handler, target, out allSpeed, 0.1f, 50.0f))
{ {
NotifyModification(handler, target, CypherStrings.YouChangeAspeed, CypherStrings.YoursAspeedChanged, allSpeed); NotifyModification(handler, target, CypherStrings.YouChangeAspeed, CypherStrings.YoursAspeedChanged, allSpeed);
@@ -730,7 +730,7 @@ namespace Game.Chat
static bool HandleModifySwimCommand(StringArguments args, CommandHandler handler) static bool HandleModifySwimCommand(StringArguments args, CommandHandler handler)
{ {
float swimSpeed; float swimSpeed;
Player target = handler.getSelectedPlayerOrSelf(); Player target = handler.GetSelectedPlayerOrSelf();
if (CheckModifySpeed(args, handler, target, out swimSpeed, 0.1f, 50.0f)) if (CheckModifySpeed(args, handler, target, out swimSpeed, 0.1f, 50.0f))
{ {
NotifyModification(handler, target, CypherStrings.YouChangeSwimSpeed, CypherStrings.YoursSwimSpeedChanged, swimSpeed); NotifyModification(handler, target, CypherStrings.YouChangeSwimSpeed, CypherStrings.YoursSwimSpeedChanged, swimSpeed);
@@ -744,7 +744,7 @@ namespace Game.Chat
static bool HandleModifyBWalkCommand(StringArguments args, CommandHandler handler) static bool HandleModifyBWalkCommand(StringArguments args, CommandHandler handler)
{ {
float backSpeed; float backSpeed;
Player target = handler.getSelectedPlayerOrSelf(); Player target = handler.GetSelectedPlayerOrSelf();
if (CheckModifySpeed(args, handler, target, out backSpeed, 0.1f, 50.0f)) if (CheckModifySpeed(args, handler, target, out backSpeed, 0.1f, 50.0f))
{ {
NotifyModification(handler, target, CypherStrings.YouChangeBackSpeed, CypherStrings.YoursBackSpeedChanged, backSpeed); NotifyModification(handler, target, CypherStrings.YouChangeBackSpeed, CypherStrings.YoursBackSpeedChanged, backSpeed);
@@ -758,7 +758,7 @@ namespace Game.Chat
static bool HandleModifyFlyCommand(StringArguments args, CommandHandler handler) static bool HandleModifyFlyCommand(StringArguments args, CommandHandler handler)
{ {
float flySpeed; float flySpeed;
Player target = handler.getSelectedPlayerOrSelf(); Player target = handler.GetSelectedPlayerOrSelf();
if (CheckModifySpeed(args, handler, target, out flySpeed, 0.1f, 50.0f, false)) if (CheckModifySpeed(args, handler, target, out flySpeed, 0.1f, 50.0f, false))
{ {
NotifyModification(handler, target, CypherStrings.YouChangeFlySpeed, CypherStrings.YoursFlySpeedChanged, flySpeed); NotifyModification(handler, target, CypherStrings.YouChangeFlySpeed, CypherStrings.YoursFlySpeedChanged, flySpeed);
@@ -772,7 +772,7 @@ namespace Game.Chat
static bool HandleModifyWalkSpeedCommand(StringArguments args, CommandHandler handler) static bool HandleModifyWalkSpeedCommand(StringArguments args, CommandHandler handler)
{ {
float Speed; float Speed;
Player target = handler.getSelectedPlayerOrSelf(); Player target = handler.GetSelectedPlayerOrSelf();
if (CheckModifySpeed(args, handler, target, out Speed, 0.1f, 50.0f)) if (CheckModifySpeed(args, handler, target, out Speed, 0.1f, 50.0f))
{ {
NotifyModification(handler, target, CypherStrings.YouChangeSpeed, CypherStrings.YoursSpeedChanged, Speed); NotifyModification(handler, target, CypherStrings.YouChangeSpeed, CypherStrings.YoursSpeedChanged, Speed);
@@ -789,7 +789,7 @@ namespace Game.Chat
if (player) if (player)
{ {
handler.SendSysMessage(resourceMessage, new object[] { handler.GetNameLink(player) }.Combine(args)); handler.SendSysMessage(resourceMessage, new object[] { handler.GetNameLink(player) }.Combine(args));
if (handler.needReportToTarget(player)) if (handler.NeedReportToTarget(player))
player.SendSysMessage(resourceReportMessage, new object[] { handler.GetNameLink() }.Combine(args)); player.SendSysMessage(resourceReportMessage, new object[] { handler.GetNameLink() }.Combine(args));
} }
} }
+35 -35
View File
@@ -35,7 +35,7 @@ namespace Game.Chat
[Command("info", RBACPermissions.CommandNpcInfo)] [Command("info", RBACPermissions.CommandNpcInfo)]
static bool Info(StringArguments args, CommandHandler handler) static bool Info(StringArguments args, CommandHandler handler)
{ {
Creature target = handler.getSelectedCreature(); Creature target = handler.GetSelectedCreature();
if (!target) if (!target)
{ {
handler.SendSysMessage(CypherStrings.SelectCreature); handler.SendSysMessage(CypherStrings.SelectCreature);
@@ -115,11 +115,11 @@ namespace Game.Chat
{ {
ulong lowguid = 0; ulong lowguid = 0;
Creature creature = handler.getSelectedCreature(); Creature creature = handler.GetSelectedCreature();
if (!creature) if (!creature)
{ {
// number or [name] Shift-click form |color|Hcreature:creature_guid|h[name]|h|r // number or [name] Shift-click form |color|Hcreature:creature_guid|h[name]|h|r
string cId = handler.extractKeyFromLink(args, "Hcreature"); string cId = handler.ExtractKeyFromLink(args, "Hcreature");
if (string.IsNullOrEmpty(cId)) if (string.IsNullOrEmpty(cId))
return false; return false;
@@ -236,7 +236,7 @@ namespace Game.Chat
{ {
uint emote = args.NextUInt32(); uint emote = args.NextUInt32();
Creature target = handler.getSelectedCreature(); Creature target = handler.GetSelectedCreature();
if (!target) if (!target)
{ {
handler.SendSysMessage(CypherStrings.SelectCreature); handler.SendSysMessage(CypherStrings.SelectCreature);
@@ -254,7 +254,7 @@ namespace Game.Chat
if (args.Empty()) if (args.Empty())
return false; return false;
Creature creature = handler.getSelectedCreature(); Creature creature = handler.GetSelectedCreature();
if (!creature) if (!creature)
{ {
@@ -273,7 +273,7 @@ namespace Game.Chat
if (args.Empty()) if (args.Empty())
return false; return false;
Creature creature = handler.getSelectedCreature(); Creature creature = handler.GetSelectedCreature();
if (!creature) if (!creature)
{ {
handler.SendSysMessage(CypherStrings.SelectCreature); handler.SendSysMessage(CypherStrings.SelectCreature);
@@ -314,7 +314,7 @@ namespace Game.Chat
return false; return false;
} }
Creature creature = handler.getSelectedCreature(); Creature creature = handler.GetSelectedCreature();
if (!creature) if (!creature)
{ {
handler.SendSysMessage(CypherStrings.SelectCreature); handler.SendSysMessage(CypherStrings.SelectCreature);
@@ -341,7 +341,7 @@ namespace Game.Chat
if (args.Empty()) if (args.Empty())
return false; return false;
Creature creature = handler.getSelectedCreature(); Creature creature = handler.GetSelectedCreature();
if (!creature) if (!creature)
{ {
handler.SendSysMessage(CypherStrings.SelectCreature); handler.SendSysMessage(CypherStrings.SelectCreature);
@@ -359,7 +359,7 @@ namespace Game.Chat
[Command("tame", RBACPermissions.CommandNpcTame)] [Command("tame", RBACPermissions.CommandNpcTame)]
static bool Tame(StringArguments args, CommandHandler handler) static bool Tame(StringArguments args, CommandHandler handler)
{ {
Creature creatureTarget = handler.getSelectedCreature(); Creature creatureTarget = handler.GetSelectedCreature();
if (!creatureTarget || creatureTarget.IsPet()) if (!creatureTarget || creatureTarget.IsPet())
{ {
handler.SendSysMessage(CypherStrings.SelectCreature); handler.SendSysMessage(CypherStrings.SelectCreature);
@@ -422,7 +422,7 @@ namespace Game.Chat
[Command("evade", RBACPermissions.CommandNpcEvade)] [Command("evade", RBACPermissions.CommandNpcEvade)]
static bool HandleNpcEvadeCommand(StringArguments args, CommandHandler handler) static bool HandleNpcEvadeCommand(StringArguments args, CommandHandler handler)
{ {
Creature creatureTarget = handler.getSelectedCreature(); Creature creatureTarget = handler.GetSelectedCreature();
if (!creatureTarget || creatureTarget.IsPet()) if (!creatureTarget || creatureTarget.IsPet())
{ {
handler.SendSysMessage(CypherStrings.SelectCreature); handler.SendSysMessage(CypherStrings.SelectCreature);
@@ -470,7 +470,7 @@ namespace Game.Chat
static bool HandleNpcFollowCommand(StringArguments args, CommandHandler handler) static bool HandleNpcFollowCommand(StringArguments args, CommandHandler handler)
{ {
Player player = handler.GetSession().GetPlayer(); Player player = handler.GetSession().GetPlayer();
Creature creature = handler.getSelectedCreature(); Creature creature = handler.GetSelectedCreature();
if (!creature) if (!creature)
{ {
@@ -489,7 +489,7 @@ namespace Game.Chat
static bool HandleNpcUnFollowCommand(StringArguments args, CommandHandler handler) static bool HandleNpcUnFollowCommand(StringArguments args, CommandHandler handler)
{ {
Player player = handler.GetPlayer(); Player player = handler.GetPlayer();
Creature creature = handler.getSelectedCreature(); Creature creature = handler.GetSelectedCreature();
if (!creature) if (!creature)
{ {
@@ -504,9 +504,9 @@ namespace Game.Chat
return false; return false;
} }
FollowMovementGenerator<Creature> mgen = (FollowMovementGenerator<Creature>)creature.GetMotionMaster().top(); FollowMovementGenerator<Creature> mgen = (FollowMovementGenerator<Creature>)creature.GetMotionMaster().Top();
if (mgen.target != player) if (mgen.Target != player)
{ {
handler.SendSysMessage(CypherStrings.CreatureNotFollowYou, creature.GetName()); handler.SendSysMessage(CypherStrings.CreatureNotFollowYou, creature.GetName());
return false; return false;
@@ -531,7 +531,7 @@ namespace Game.Chat
if (!args.Empty()) if (!args.Empty())
{ {
// number or [name] Shift-click form |color|Hcreature:creature_guid|h[name]|h|r // number or [name] Shift-click form |color|Hcreature:creature_guid|h[name]|h|r
string cId = handler.extractKeyFromLink(args, "Hcreature"); string cId = handler.ExtractKeyFromLink(args, "Hcreature");
if (string.IsNullOrEmpty(cId)) if (string.IsNullOrEmpty(cId))
return false; return false;
@@ -541,7 +541,7 @@ namespace Game.Chat
unit = handler.GetCreatureFromPlayerMapByDbGuid(guidLow); unit = handler.GetCreatureFromPlayerMapByDbGuid(guidLow);
} }
else else
unit = handler.getSelectedCreature(); unit = handler.GetSelectedCreature();
if (!unit || unit.IsPet() || unit.IsTotem()) if (!unit || unit.IsPet() || unit.IsTotem())
{ {
@@ -565,14 +565,14 @@ namespace Game.Chat
if (args.Empty()) if (args.Empty())
return false; return false;
Creature vendor = handler.getSelectedCreature(); Creature vendor = handler.GetSelectedCreature();
if (!vendor || !vendor.IsVendor()) if (!vendor || !vendor.IsVendor())
{ {
handler.SendSysMessage(CypherStrings.CommandVendorselection); handler.SendSysMessage(CypherStrings.CommandVendorselection);
return false; return false;
} }
string pitem = handler.extractKeyFromLink(args, "Hitem"); string pitem = handler.ExtractKeyFromLink(args, "Hitem");
if (string.IsNullOrEmpty(pitem)) if (string.IsNullOrEmpty(pitem))
{ {
handler.SendSysMessage(CypherStrings.CommandNeeditemsend); handler.SendSysMessage(CypherStrings.CommandNeeditemsend);
@@ -627,7 +627,7 @@ namespace Game.Chat
if (newEntryNum == 0) if (newEntryNum == 0)
return false; return false;
Unit unit = handler.getSelectedUnit(); Unit unit = handler.GetSelectedUnit();
if (!unit || !unit.IsTypeId(TypeId.Unit)) if (!unit || !unit.IsTypeId(TypeId.Unit))
{ {
handler.SendSysMessage(CypherStrings.SelectCreature); handler.SendSysMessage(CypherStrings.SelectCreature);
@@ -655,7 +655,7 @@ namespace Game.Chat
return false; return false;
} }
Creature creature = handler.getSelectedCreature(); Creature creature = handler.GetSelectedCreature();
if (!creature || creature.IsPet()) if (!creature || creature.IsPet())
{ {
handler.SendSysMessage(CypherStrings.SelectCreature); handler.SendSysMessage(CypherStrings.SelectCreature);
@@ -678,7 +678,7 @@ namespace Game.Chat
ulong npcFlags = args.NextUInt64(); ulong npcFlags = args.NextUInt64();
Creature creature = handler.getSelectedCreature(); Creature creature = handler.GetSelectedCreature();
if (!creature) if (!creature)
{ {
handler.SendSysMessage(CypherStrings.SelectCreature); handler.SendSysMessage(CypherStrings.SelectCreature);
@@ -712,7 +712,7 @@ namespace Game.Chat
return false; return false;
} }
Creature creature = handler.getSelectedCreature(); Creature creature = handler.GetSelectedCreature();
if (!creature) if (!creature)
{ {
@@ -753,7 +753,7 @@ namespace Game.Chat
if (data_1 == 0 || data_2 == 0) if (data_1 == 0 || data_2 == 0)
return false; return false;
Creature creature = handler.getSelectedCreature(); Creature creature = handler.GetSelectedCreature();
if (!creature) if (!creature)
{ {
handler.SendSysMessage(CypherStrings.SelectCreature); handler.SendSysMessage(CypherStrings.SelectCreature);
@@ -774,7 +774,7 @@ namespace Game.Chat
uint displayId = args.NextUInt32(); uint displayId = args.NextUInt32();
Creature creature = handler.getSelectedCreature(); Creature creature = handler.GetSelectedCreature();
if (!creature || creature.IsPet()) if (!creature || creature.IsPet())
{ {
@@ -843,7 +843,7 @@ namespace Game.Chat
if (string.IsNullOrEmpty(type)) // case .setmovetype $move_type (with selected creature) if (string.IsNullOrEmpty(type)) // case .setmovetype $move_type (with selected creature)
{ {
type = guid_str; type = guid_str;
creature = handler.getSelectedCreature(); creature = handler.GetSelectedCreature();
if (!creature || creature.IsPet()) if (!creature || creature.IsPet())
return false; return false;
lowguid = creature.GetSpawnId(); lowguid = creature.GetSpawnId();
@@ -923,7 +923,7 @@ namespace Game.Chat
return false; return false;
} }
Creature creature = handler.getSelectedCreature(); Creature creature = handler.GetSelectedCreature();
if (!creature || creature.IsPet()) if (!creature || creature.IsPet())
{ {
handler.SendSysMessage(CypherStrings.SelectCreature); handler.SendSysMessage(CypherStrings.SelectCreature);
@@ -946,7 +946,7 @@ namespace Game.Chat
int phaseGroupId = args.NextInt32(); int phaseGroupId = args.NextInt32();
Creature creature = handler.getSelectedCreature(); Creature creature = handler.GetSelectedCreature();
if (!creature || creature.IsPet()) if (!creature || creature.IsPet())
{ {
handler.SendSysMessage(CypherStrings.SelectCreature); handler.SendSysMessage(CypherStrings.SelectCreature);
@@ -979,7 +979,7 @@ namespace Game.Chat
if (option > 0.0f) if (option > 0.0f)
mtype = MovementGeneratorType.Random; mtype = MovementGeneratorType.Random;
Creature creature = handler.getSelectedCreature(); Creature creature = handler.GetSelectedCreature();
ulong guidLow = 0; ulong guidLow = 0;
if (creature) if (creature)
@@ -1015,7 +1015,7 @@ namespace Game.Chat
uint spawnTime = args.NextUInt32(); uint spawnTime = args.NextUInt32();
Creature creature = handler.getSelectedCreature(); Creature creature = handler.GetSelectedCreature();
if (!creature) if (!creature)
return false; return false;
@@ -1040,7 +1040,7 @@ namespace Game.Chat
ulong linkguid = args.NextUInt64(); ulong linkguid = args.NextUInt64();
Creature creature = handler.getSelectedCreature(); Creature creature = handler.GetSelectedCreature();
if (!creature) if (!creature)
{ {
handler.SendSysMessage(CypherStrings.SelectCreature); handler.SendSysMessage(CypherStrings.SelectCreature);
@@ -1073,7 +1073,7 @@ namespace Game.Chat
if (args.Empty()) if (args.Empty())
return false; return false;
string charID = handler.extractKeyFromLink(args, "Hcreature_entry"); string charID = handler.ExtractKeyFromLink(args, "Hcreature_entry");
if (string.IsNullOrEmpty(charID)) if (string.IsNullOrEmpty(charID))
return false; return false;
@@ -1130,7 +1130,7 @@ namespace Game.Chat
byte type = 1; // FIXME: make type (1 item, 2 currency) an argument byte type = 1; // FIXME: make type (1 item, 2 currency) an argument
string pitem = handler.extractKeyFromLink(args, "Hitem"); string pitem = handler.ExtractKeyFromLink(args, "Hitem");
if (string.IsNullOrEmpty(pitem)) if (string.IsNullOrEmpty(pitem))
{ {
handler.SendSysMessage(CypherStrings.CommandNeeditemsend); handler.SendSysMessage(CypherStrings.CommandNeeditemsend);
@@ -1145,7 +1145,7 @@ namespace Game.Chat
uint extendedcost = args.NextUInt32(); uint extendedcost = args.NextUInt32();
string fbonuslist = args.NextString(); string fbonuslist = args.NextString();
Creature vendor = handler.getSelectedCreature(); Creature vendor = handler.GetSelectedCreature();
if (!vendor) if (!vendor)
{ {
handler.SendSysMessage(CypherStrings.SelectCreature); handler.SendSysMessage(CypherStrings.SelectCreature);
@@ -1223,7 +1223,7 @@ namespace Game.Chat
return false; return false;
uint leaderGUID = args.NextUInt32(); uint leaderGUID = args.NextUInt32();
Creature creature = handler.getSelectedCreature(); Creature creature = handler.GetSelectedCreature();
if (!creature || creature.GetSpawnId() == 0) if (!creature || creature.GetSpawnId() == 0)
{ {
@@ -1278,7 +1278,7 @@ namespace Game.Chat
else if (spawntype_str.Equals("NOLOOT")) else if (spawntype_str.Equals("NOLOOT"))
loot = false; loot = false;
string charID = handler.extractKeyFromLink(args, "Hcreature_entry"); string charID = handler.ExtractKeyFromLink(args, "Hcreature_entry");
if (string.IsNullOrEmpty(charID)) if (string.IsNullOrEmpty(charID))
return false; return false;
+4 -4
View File
@@ -29,7 +29,7 @@ namespace Game.Chat
static bool HandlePetCreateCommand(StringArguments args, CommandHandler handler) static bool HandlePetCreateCommand(StringArguments args, CommandHandler handler)
{ {
Player player = handler.GetSession().GetPlayer(); Player player = handler.GetSession().GetPlayer();
Creature creatureTarget = handler.getSelectedCreature(); Creature creatureTarget = handler.GetSelectedCreature();
if (!creatureTarget || creatureTarget.IsPet() || creatureTarget.IsTypeId(TypeId.Player)) if (!creatureTarget || creatureTarget.IsPet() || creatureTarget.IsTypeId(TypeId.Player))
{ {
@@ -106,7 +106,7 @@ namespace Game.Chat
return false; return false;
} }
uint spellId = handler.extractSpellIdFromLink(args); uint spellId = handler.ExtractSpellIdFromLink(args);
if (spellId == 0 || !Global.SpellMgr.HasSpellInfo(spellId)) if (spellId == 0 || !Global.SpellMgr.HasSpellInfo(spellId))
return false; return false;
@@ -144,7 +144,7 @@ namespace Game.Chat
return false; return false;
} }
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);
@@ -186,7 +186,7 @@ namespace Game.Chat
static Pet GetSelectedPlayerPetOrOwn(CommandHandler handler) static Pet GetSelectedPlayerPetOrOwn(CommandHandler handler)
{ {
Unit target = handler.getSelectedUnit(); Unit target = handler.GetSelectedUnit();
if (target) if (target)
{ {
if (target.IsTypeId(TypeId.Player)) if (target.IsTypeId(TypeId.Player))
+8 -8
View File
@@ -30,7 +30,7 @@ namespace Game.Chat
[Command("add", RBACPermissions.CommandQuestAdd)] [Command("add", RBACPermissions.CommandQuestAdd)]
static bool Add(StringArguments args, CommandHandler handler) static bool Add(StringArguments args, CommandHandler handler)
{ {
Player player = handler.getSelectedPlayer(); Player player = handler.GetSelectedPlayer();
if (!player) if (!player)
{ {
handler.SendSysMessage(CypherStrings.NoCharSelected); handler.SendSysMessage(CypherStrings.NoCharSelected);
@@ -39,7 +39,7 @@ namespace Game.Chat
// .addquest #entry' // .addquest #entry'
// number or [name] Shift-click form |color|Hquest:quest_id:quest_level:min_level:max_level:scaling_faction|h[name]|h|r // number or [name] Shift-click form |color|Hquest:quest_id:quest_level:min_level:max_level:scaling_faction|h[name]|h|r
string cId = handler.extractKeyFromLink(args, "Hquest"); string cId = handler.ExtractKeyFromLink(args, "Hquest");
if (!uint.TryParse(cId, out uint entry)) if (!uint.TryParse(cId, out uint entry))
return false; return false;
@@ -70,7 +70,7 @@ namespace Game.Chat
[Command("complete", RBACPermissions.CommandQuestComplete)] [Command("complete", RBACPermissions.CommandQuestComplete)]
static bool Complete(StringArguments args, CommandHandler handler) static bool Complete(StringArguments args, CommandHandler handler)
{ {
Player player = handler.getSelectedPlayer(); Player player = handler.GetSelectedPlayer();
if (!player) if (!player)
{ {
handler.SendSysMessage(CypherStrings.NoCharSelected); handler.SendSysMessage(CypherStrings.NoCharSelected);
@@ -79,7 +79,7 @@ namespace Game.Chat
// .quest complete #entry // .quest complete #entry
// number or [name] Shift-click form |color|Hquest:quest_id:quest_level:min_level:max_level:scaling_faction|h[name]|h|r // number or [name] Shift-click form |color|Hquest:quest_id:quest_level:min_level:max_level:scaling_faction|h[name]|h|r
string cId = handler.extractKeyFromLink(args, "Hquest"); string cId = handler.ExtractKeyFromLink(args, "Hquest");
if (!uint.TryParse(cId, out uint entry)) if (!uint.TryParse(cId, out uint entry))
return false; return false;
@@ -162,7 +162,7 @@ namespace Game.Chat
[Command("remove", RBACPermissions.CommandQuestRemove)] [Command("remove", RBACPermissions.CommandQuestRemove)]
static bool Remove(StringArguments args, CommandHandler handler) static bool Remove(StringArguments args, CommandHandler handler)
{ {
Player player = handler.getSelectedPlayer(); Player player = handler.GetSelectedPlayer();
if (!player) if (!player)
{ {
handler.SendSysMessage(CypherStrings.NoCharSelected); handler.SendSysMessage(CypherStrings.NoCharSelected);
@@ -171,7 +171,7 @@ namespace Game.Chat
// .removequest #entry' // .removequest #entry'
// number or [name] Shift-click form |color|Hquest:quest_id:quest_level:min_level:max_level:scaling_faction|h[name]|h|r // number or [name] Shift-click form |color|Hquest:quest_id:quest_level:min_level:max_level:scaling_faction|h[name]|h|r
string cId = handler.extractKeyFromLink(args, "Hquest"); string cId = handler.ExtractKeyFromLink(args, "Hquest");
if (!uint.TryParse(cId, out uint entry)) if (!uint.TryParse(cId, out uint entry))
return false; return false;
@@ -216,7 +216,7 @@ namespace Game.Chat
[Command("reward", RBACPermissions.CommandQuestReward)] [Command("reward", RBACPermissions.CommandQuestReward)]
static bool Reward(StringArguments args, CommandHandler handler) static bool Reward(StringArguments args, CommandHandler handler)
{ {
Player player = handler.getSelectedPlayer(); Player player = handler.GetSelectedPlayer();
if (!player) if (!player)
{ {
handler.SendSysMessage(CypherStrings.NoCharSelected); handler.SendSysMessage(CypherStrings.NoCharSelected);
@@ -225,7 +225,7 @@ namespace Game.Chat
// .quest reward #entry // .quest reward #entry
// number or [name] Shift-click form |color|Hquest:quest_id:quest_level:min_level:max_level:scaling_faction|h[name]|h|r // number or [name] Shift-click form |color|Hquest:quest_id:quest_level:min_level:max_level:scaling_faction|h[name]|h|r
string cId = handler.extractKeyFromLink(args, "Hquest"); string cId = handler.ExtractKeyFromLink(args, "Hquest");
if (!uint.TryParse(cId, out uint entry)) if (!uint.TryParse(cId, out uint entry))
return false; return false;
+1 -1
View File
@@ -269,7 +269,7 @@ namespace Game.Chat.Commands
if (useSelectedPlayer) if (useSelectedPlayer)
{ {
Player player = handler.getSelectedPlayer(); Player player = handler.GetSelectedPlayer();
if (!player) if (!player)
return null; return null;
+7 -7
View File
@@ -33,7 +33,7 @@ namespace Game.Chat
{ {
Player target; Player target;
ObjectGuid targetGuid; ObjectGuid targetGuid;
if (!handler.extractPlayerTarget(args, out target, out targetGuid)) if (!handler.ExtractPlayerTarget(args, out target, out targetGuid))
return false; return false;
if (target) if (target)
@@ -48,7 +48,7 @@ namespace Game.Chat
static bool HandleResetHonorCommand(StringArguments args, CommandHandler handler) static bool HandleResetHonorCommand(StringArguments args, CommandHandler handler)
{ {
Player target; Player target;
if (!handler.extractPlayerTarget(args, out target)) if (!handler.ExtractPlayerTarget(args, out target))
return false; return false;
target.ResetHonorStats(); target.ResetHonorStats();
@@ -92,7 +92,7 @@ namespace Game.Chat
static bool HandleResetLevelCommand(StringArguments args, CommandHandler handler) static bool HandleResetLevelCommand(StringArguments args, CommandHandler handler)
{ {
Player target; Player target;
if (!handler.extractPlayerTarget(args, out target)) if (!handler.ExtractPlayerTarget(args, out target))
return false; return false;
if (!HandleResetStatsOrLevelHelper(target)) if (!HandleResetStatsOrLevelHelper(target))
@@ -129,7 +129,7 @@ namespace Game.Chat
Player target; Player target;
ObjectGuid targetGuid; ObjectGuid targetGuid;
string targetName; string targetName;
if (!handler.extractPlayerTarget(args, out target, out targetGuid, out targetName)) if (!handler.ExtractPlayerTarget(args, out target, out targetGuid, out targetName))
return false; return false;
if (target) if (target)
@@ -157,7 +157,7 @@ namespace Game.Chat
static bool HandleResetStatsCommand(StringArguments args, CommandHandler handler) static bool HandleResetStatsCommand(StringArguments args, CommandHandler handler)
{ {
Player target; Player target;
if (!handler.extractPlayerTarget(args, out target)) if (!handler.ExtractPlayerTarget(args, out target))
return false; return false;
if (!HandleResetStatsOrLevelHelper(target)) if (!HandleResetStatsOrLevelHelper(target))
@@ -178,7 +178,7 @@ namespace Game.Chat
ObjectGuid targetGuid; ObjectGuid targetGuid;
string targetName; string targetName;
if (!handler.extractPlayerTarget(args, out target, out targetGuid, out targetName)) if (!handler.ExtractPlayerTarget(args, out target, out targetGuid, out targetName))
{ {
/* TODO: 6.x remove/update pet talents /* TODO: 6.x remove/update pet talents
// Try reset talents as Hunter Pet // Try reset talents as Hunter Pet
@@ -227,7 +227,7 @@ namespace Game.Chat
stmt.AddValue(1, targetGuid.GetCounter()); stmt.AddValue(1, targetGuid.GetCounter());
DB.Characters.Execute(stmt); DB.Characters.Execute(stmt);
string nameLink = handler.playerLink(targetName); string nameLink = handler.PlayerLink(targetName);
handler.SendSysMessage(CypherStrings.ResetTalentsOffline, nameLink); handler.SendSysMessage(CypherStrings.ResetTalentsOffline, nameLink);
return true; return true;
} }
+3 -3
View File
@@ -31,7 +31,7 @@ namespace Game.Chat
if (args.Empty()) if (args.Empty())
return false; return false;
Player target = handler.getSelectedPlayerOrSelf(); Player target = handler.GetSelectedPlayerOrSelf();
if (!target) if (!target)
{ {
handler.SendSysMessage(CypherStrings.PlayerNotFound); handler.SendSysMessage(CypherStrings.PlayerNotFound);
@@ -67,7 +67,7 @@ namespace Game.Chat
return false; return false;
uint sceneId = args.NextUInt32(); uint sceneId = args.NextUInt32();
Player target = handler.getSelectedPlayerOrSelf(); Player target = handler.GetSelectedPlayerOrSelf();
if (!target) if (!target)
{ {
handler.SendSysMessage(CypherStrings.PlayerNotFound); handler.SendSysMessage(CypherStrings.PlayerNotFound);
@@ -91,7 +91,7 @@ namespace Game.Chat
if (!uint.TryParse(args.NextString(""), out uint flags)) if (!uint.TryParse(args.NextString(""), out uint flags))
flags = (uint)SceneFlags.Unk16; flags = (uint)SceneFlags.Unk16;
Player target = handler.getSelectedPlayerOrSelf(); Player target = handler.GetSelectedPlayerOrSelf();
if (!target) if (!target)
{ {
handler.SendSysMessage(CypherStrings.PlayerNotFound); handler.SendSysMessage(CypherStrings.PlayerNotFound);
+14 -14
View File
@@ -34,14 +34,14 @@ namespace Game.Chat.Commands
Player target; Player target;
ObjectGuid targetGuid; ObjectGuid targetGuid;
string targetName; string targetName;
if (!handler.extractPlayerTarget(args, out target, out targetGuid, out targetName)) if (!handler.ExtractPlayerTarget(args, out target, out targetGuid, out targetName))
return false; return false;
string tail1 = args.NextString(""); string tail1 = args.NextString("");
if (string.IsNullOrEmpty(tail1)) if (string.IsNullOrEmpty(tail1))
return false; return false;
string subject = handler.extractQuotedArg(tail1); string subject = handler.ExtractQuotedArg(tail1);
if (string.IsNullOrEmpty(subject)) if (string.IsNullOrEmpty(subject))
return false; return false;
@@ -49,7 +49,7 @@ namespace Game.Chat.Commands
if (string.IsNullOrEmpty(tail2)) if (string.IsNullOrEmpty(tail2))
return false; return false;
string text = handler.extractQuotedArg(tail2); string text = handler.ExtractQuotedArg(tail2);
if (string.IsNullOrEmpty(text)) if (string.IsNullOrEmpty(text))
return false; return false;
@@ -63,7 +63,7 @@ namespace Game.Chat.Commands
DB.Characters.CommitTransaction(trans); DB.Characters.CommitTransaction(trans);
string nameLink = handler.playerLink(targetName); string nameLink = handler.PlayerLink(targetName);
handler.SendSysMessage(CypherStrings.MailSent, nameLink); handler.SendSysMessage(CypherStrings.MailSent, nameLink);
return true; return true;
} }
@@ -75,14 +75,14 @@ namespace Game.Chat.Commands
Player receiver; Player receiver;
ObjectGuid receiverGuid; ObjectGuid receiverGuid;
string receiverName; string receiverName;
if (!handler.extractPlayerTarget(args, out receiver, out receiverGuid, out receiverName)) if (!handler.ExtractPlayerTarget(args, out receiver, out receiverGuid, out receiverName))
return false; return false;
string tail1 = args.NextString(""); string tail1 = args.NextString("");
if (string.IsNullOrEmpty(tail1)) if (string.IsNullOrEmpty(tail1))
return false; return false;
string subject = handler.extractQuotedArg(tail1); string subject = handler.ExtractQuotedArg(tail1);
if (string.IsNullOrEmpty(subject)) if (string.IsNullOrEmpty(subject))
return false; return false;
@@ -90,7 +90,7 @@ namespace Game.Chat.Commands
if (string.IsNullOrEmpty(tail2)) if (string.IsNullOrEmpty(tail2))
return false; return false;
string text = handler.extractQuotedArg(tail2); string text = handler.ExtractQuotedArg(tail2);
if (string.IsNullOrEmpty(text)) if (string.IsNullOrEmpty(text))
return false; return false;
@@ -164,7 +164,7 @@ namespace Game.Chat.Commands
draft.SendMailTo(trans, new MailReceiver(receiver, receiverGuid.GetCounter()), sender); draft.SendMailTo(trans, new MailReceiver(receiver, receiverGuid.GetCounter()), sender);
DB.Characters.CommitTransaction(trans); DB.Characters.CommitTransaction(trans);
string nameLink = handler.playerLink(receiverName); string nameLink = handler.PlayerLink(receiverName);
handler.SendSysMessage(CypherStrings.MailSent, nameLink); handler.SendSysMessage(CypherStrings.MailSent, nameLink);
return true; return true;
} }
@@ -177,14 +177,14 @@ namespace Game.Chat.Commands
Player receiver; Player receiver;
ObjectGuid receiverGuid; ObjectGuid receiverGuid;
string receiverName; string receiverName;
if (!handler.extractPlayerTarget(args, out receiver, out receiverGuid, out receiverName)) if (!handler.ExtractPlayerTarget(args, out receiver, out receiverGuid, out receiverName))
return false; return false;
string tail1 = args.NextString(""); string tail1 = args.NextString("");
if (string.IsNullOrEmpty(tail1)) if (string.IsNullOrEmpty(tail1))
return false; return false;
string subject = handler.extractQuotedArg(tail1); string subject = handler.ExtractQuotedArg(tail1);
if (string.IsNullOrEmpty(subject)) if (string.IsNullOrEmpty(subject))
return false; return false;
@@ -192,7 +192,7 @@ namespace Game.Chat.Commands
if (string.IsNullOrEmpty(tail2)) if (string.IsNullOrEmpty(tail2))
return false; return false;
string text = handler.extractQuotedArg(tail2); string text = handler.ExtractQuotedArg(tail2);
if (string.IsNullOrEmpty(text)) if (string.IsNullOrEmpty(text))
return false; return false;
@@ -213,7 +213,7 @@ namespace Game.Chat.Commands
DB.Characters.CommitTransaction(trans); DB.Characters.CommitTransaction(trans);
string nameLink = handler.playerLink(receiverName); string nameLink = handler.PlayerLink(receiverName);
handler.SendSysMessage(CypherStrings.MailSent, nameLink); handler.SendSysMessage(CypherStrings.MailSent, nameLink);
return true; return true;
} }
@@ -223,7 +223,7 @@ namespace Game.Chat.Commands
{ {
// - Find the player // - Find the player
Player player; Player player;
if (!handler.extractPlayerTarget(args, out player)) if (!handler.ExtractPlayerTarget(args, out player))
return false; return false;
string msgStr = args.NextString(""); string msgStr = args.NextString("");
@@ -231,7 +231,7 @@ namespace Game.Chat.Commands
return false; return false;
// Check that he is not logging out. // Check that he is not logging out.
if (player.GetSession().isLogingOut()) if (player.GetSession().IsLogingOut())
{ {
handler.SendSysMessage(CypherStrings.PlayerNotFound); handler.SendSysMessage(CypherStrings.PlayerNotFound);
return false; return false;
+9 -9
View File
@@ -29,7 +29,7 @@ namespace Game.Chat
[CommandNonGroup("cooldown", RBACPermissions.CommandCooldown)] [CommandNonGroup("cooldown", RBACPermissions.CommandCooldown)]
static bool HandleCooldownCommand(StringArguments args, CommandHandler handler) static bool HandleCooldownCommand(StringArguments args, CommandHandler handler)
{ {
Unit target = handler.getSelectedUnit(); Unit target = handler.GetSelectedUnit();
if (!target) if (!target)
{ {
handler.SendSysMessage(CypherStrings.PlayerNotFound); handler.SendSysMessage(CypherStrings.PlayerNotFound);
@@ -53,7 +53,7 @@ namespace Game.Chat
else else
{ {
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint spellIid = handler.extractSpellIdFromLink(args); uint spellIid = handler.ExtractSpellIdFromLink(args);
if (spellIid == 0) if (spellIid == 0)
return false; return false;
@@ -74,7 +74,7 @@ namespace Game.Chat
[CommandNonGroup("aura", RBACPermissions.CommandAura)] [CommandNonGroup("aura", RBACPermissions.CommandAura)]
static bool Auracommand(StringArguments args, CommandHandler handler) static bool Auracommand(StringArguments args, CommandHandler handler)
{ {
Unit target = handler.getSelectedUnit(); Unit target = handler.GetSelectedUnit();
if (!target) if (!target)
{ {
handler.SendSysMessage(CypherStrings.SelectCharOrCreature); handler.SendSysMessage(CypherStrings.SelectCharOrCreature);
@@ -83,7 +83,7 @@ namespace Game.Chat
} }
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint spellId = handler.extractSpellIdFromLink(args); uint spellId = handler.ExtractSpellIdFromLink(args);
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId);
if (spellInfo != null) if (spellInfo != null)
@@ -98,7 +98,7 @@ namespace Game.Chat
[CommandNonGroup("unaura", RBACPermissions.CommandUnaura)] [CommandNonGroup("unaura", RBACPermissions.CommandUnaura)]
static bool UnAura(StringArguments args, CommandHandler handler) static bool UnAura(StringArguments args, CommandHandler handler)
{ {
Unit target = handler.getSelectedUnit(); Unit target = handler.GetSelectedUnit();
if (!target) if (!target)
{ {
handler.SendSysMessage(CypherStrings.SelectCharOrCreature); handler.SendSysMessage(CypherStrings.SelectCharOrCreature);
@@ -114,7 +114,7 @@ namespace Game.Chat
} }
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint spellId = handler.extractSpellIdFromLink(args); uint spellId = handler.ExtractSpellIdFromLink(args);
if (spellId == 0) if (spellId == 0)
return false; return false;
@@ -126,7 +126,7 @@ namespace Game.Chat
[CommandNonGroup("maxskill", RBACPermissions.CommandMaxskill)] [CommandNonGroup("maxskill", RBACPermissions.CommandMaxskill)]
static bool HandleMaxSkillCommand(StringArguments args, CommandHandler handler) static bool HandleMaxSkillCommand(StringArguments args, CommandHandler handler)
{ {
Player player = handler.getSelectedPlayerOrSelf(); Player player = handler.GetSelectedPlayerOrSelf();
if (!player) if (!player)
{ {
handler.SendSysMessage(CypherStrings.NoCharSelected); handler.SendSysMessage(CypherStrings.NoCharSelected);
@@ -142,7 +142,7 @@ namespace Game.Chat
static bool SetSkill(StringArguments args, CommandHandler handler) static bool SetSkill(StringArguments args, CommandHandler handler)
{ {
// number or [name] Shift-click form |color|Hskill:skill_id|h[name]|h|r // number or [name] Shift-click form |color|Hskill:skill_id|h[name]|h|r
string skillStr = handler.extractKeyFromLink(args, "Hskill"); string skillStr = handler.ExtractKeyFromLink(args, "Hskill");
if (string.IsNullOrEmpty(skillStr)) if (string.IsNullOrEmpty(skillStr))
return false; return false;
@@ -156,7 +156,7 @@ namespace Game.Chat
if (level == 0) if (level == 0)
return false; return false;
Player target = handler.getSelectedPlayerOrSelf(); Player target = handler.GetSelectedPlayerOrSelf();
if (!target) if (!target)
{ {
handler.SendSysMessage(CypherStrings.NoCharSelected); handler.SendSysMessage(CypherStrings.NoCharSelected);
+5 -5
View File
@@ -35,7 +35,7 @@ namespace Game.Chat
Player me = handler.GetPlayer(); Player me = handler.GetPlayer();
GameTele tele = handler.extractGameTeleFromLink(args); GameTele tele = handler.ExtractGameTeleFromLink(args);
if (tele == null) if (tele == null)
{ {
@@ -88,7 +88,7 @@ namespace Game.Chat
if (args.Empty()) if (args.Empty())
return false; return false;
Player target = handler.getSelectedPlayer(); Player target = handler.GetSelectedPlayer();
if (!target) if (!target)
{ {
handler.SendSysMessage(CypherStrings.NoCharSelected); handler.SendSysMessage(CypherStrings.NoCharSelected);
@@ -100,7 +100,7 @@ namespace Game.Chat
return false; return false;
// id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
GameTele tele = handler.extractGameTeleFromLink(args); GameTele tele = handler.ExtractGameTeleFromLink(args);
if (tele == null) if (tele == null)
{ {
handler.SendSysMessage(CypherStrings.CommandTeleNotfound); handler.SendSysMessage(CypherStrings.CommandTeleNotfound);
@@ -123,7 +123,7 @@ namespace Game.Chat
return false; return false;
} }
for (GroupReference refe = grp.GetFirstMember(); refe != null; refe = refe.next()) for (GroupReference refe = grp.GetFirstMember(); refe != null; refe = refe.Next())
{ {
Player player = refe.GetSource(); Player player = refe.GetSource();
if (!player || !player.GetSession()) if (!player || !player.GetSession())
@@ -142,7 +142,7 @@ namespace Game.Chat
} }
handler.SendSysMessage(CypherStrings.TeleportingTo, plNameLink, "", tele.name); handler.SendSysMessage(CypherStrings.TeleportingTo, plNameLink, "", tele.name);
if (handler.needReportToTarget(player)) if (handler.NeedReportToTarget(player))
player.SendSysMessage(CypherStrings.TeleportedToBy, nameLink); player.SendSysMessage(CypherStrings.TeleportedToBy, nameLink);
// stop flight if need // stop flight if need
+7 -7
View File
@@ -31,7 +31,7 @@ namespace Game.Chat.Commands
static bool HandleTitlesCurrentCommand(StringArguments args, CommandHandler handler) static bool HandleTitlesCurrentCommand(StringArguments args, CommandHandler handler)
{ {
// number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r // number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r
string id_p = handler.extractKeyFromLink(args, "Htitle"); string id_p = handler.ExtractKeyFromLink(args, "Htitle");
if (string.IsNullOrEmpty(id_p)) if (string.IsNullOrEmpty(id_p))
return false; return false;
@@ -41,7 +41,7 @@ namespace Game.Chat.Commands
return false; return false;
} }
Player target = handler.getSelectedPlayer(); Player target = handler.GetSelectedPlayer();
if (!target) if (!target)
{ {
handler.SendSysMessage(CypherStrings.NoCharSelected); handler.SendSysMessage(CypherStrings.NoCharSelected);
@@ -72,7 +72,7 @@ namespace Game.Chat.Commands
static bool HandleTitlesAddCommand(StringArguments args, CommandHandler handler) static bool HandleTitlesAddCommand(StringArguments args, CommandHandler handler)
{ {
// number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r // number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r
string id_p = handler.extractKeyFromLink(args, "Htitle"); string id_p = handler.ExtractKeyFromLink(args, "Htitle");
if (string.IsNullOrEmpty(id_p)) if (string.IsNullOrEmpty(id_p))
return false; return false;
@@ -82,7 +82,7 @@ namespace Game.Chat.Commands
return false; return false;
} }
Player target = handler.getSelectedPlayer(); Player target = handler.GetSelectedPlayer();
if (!target) if (!target)
{ {
handler.SendSysMessage(CypherStrings.NoCharSelected); handler.SendSysMessage(CypherStrings.NoCharSelected);
@@ -114,7 +114,7 @@ namespace Game.Chat.Commands
static bool HandleTitlesRemoveCommand(StringArguments args, CommandHandler handler) static bool HandleTitlesRemoveCommand(StringArguments args, CommandHandler handler)
{ {
// number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r // number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r
string id_p = handler.extractKeyFromLink(args, "Htitle"); string id_p = handler.ExtractKeyFromLink(args, "Htitle");
if (string.IsNullOrEmpty(id_p)) if (string.IsNullOrEmpty(id_p))
return false; return false;
@@ -124,7 +124,7 @@ namespace Game.Chat.Commands
return false; return false;
} }
Player target = handler.getSelectedPlayer(); Player target = handler.GetSelectedPlayer();
if (!target) if (!target)
{ {
handler.SendSysMessage(CypherStrings.NoCharSelected); handler.SendSysMessage(CypherStrings.NoCharSelected);
@@ -171,7 +171,7 @@ namespace Game.Chat.Commands
ulong titles = args.NextUInt64(); ulong titles = args.NextUInt64();
Player target = handler.getSelectedPlayer(); Player target = handler.GetSelectedPlayer();
if (!target) if (!target)
{ {
handler.SendSysMessage(CypherStrings.NoCharSelected); handler.SendSysMessage(CypherStrings.NoCharSelected);
+5 -5
View File
@@ -39,7 +39,7 @@ namespace Game.Chat.Commands
path_number = args.NextString(); path_number = args.NextString();
uint point = 0; uint point = 0;
Creature target = handler.getSelectedCreature(); Creature target = handler.GetSelectedCreature();
PreparedStatement stmt; PreparedStatement stmt;
@@ -365,7 +365,7 @@ namespace Game.Chat.Commands
string path_number = args.NextString(); string path_number = args.NextString();
uint pathid; uint pathid;
Creature target = handler.getSelectedCreature(); Creature target = handler.GetSelectedCreature();
// Did player provide a path_id? // Did player provide a path_id?
if (string.IsNullOrEmpty(path_number)) if (string.IsNullOrEmpty(path_number))
@@ -450,7 +450,7 @@ namespace Game.Chat.Commands
// . variable lowguid is filled with the GUID of the NPC // . variable lowguid is filled with the GUID of the NPC
uint pathid; uint pathid;
uint point; uint point;
Creature target = handler.getSelectedCreature(); Creature target = handler.GetSelectedCreature();
// User did select a visual waypoint? // User did select a visual waypoint?
if (!target || target.GetEntry() != 1) if (!target || target.GetEntry() != 1)
@@ -625,7 +625,7 @@ namespace Game.Chat.Commands
string guid_str = args.NextString(); string guid_str = args.NextString();
uint pathid = 0; uint pathid = 0;
Creature target = handler.getSelectedCreature(); Creature target = handler.GetSelectedCreature();
// Did player provide a PathID? // Did player provide a PathID?
@@ -973,7 +973,7 @@ namespace Game.Chat.Commands
[Command("unload", RBACPermissions.CommandWpUnload)] [Command("unload", RBACPermissions.CommandWpUnload)]
static bool HandleWpUnLoadCommand(StringArguments args, CommandHandler handler) static bool HandleWpUnLoadCommand(StringArguments args, CommandHandler handler)
{ {
Creature target = handler.getSelectedCreature(); Creature target = handler.GetSelectedCreature();
if (!target) if (!target)
{ {
handler.SendSysMessage("|cff33ffffYou must select a target.|r"); handler.SendSysMessage("|cff33ffffYou must select a target.|r");
@@ -27,10 +27,10 @@ namespace Game.Collision
{ {
public BIH() public BIH()
{ {
init_empty(); InitEmpty();
} }
void init_empty() void InitEmpty()
{ {
tree= new uint[3]; tree= new uint[3];
objects = new uint[0]; objects = new uint[0];
@@ -38,7 +38,7 @@ namespace Game.Collision
tree[0] = (3u << 30); // dummy leaf tree[0] = (3u << 30); // dummy leaf
} }
void buildHierarchy(List<uint> tempTree, buildData dat, BuildStats stats) void BuildHierarchy(List<uint> tempTree, buildData dat, BuildStats stats)
{ {
// create space for the first node // create space for the first node
tempTree.Add(3u << 30); // dummy leaf tempTree.Add(3u << 30); // dummy leaf
@@ -51,16 +51,16 @@ namespace Game.Collision
gridBox.hi = bounds.Hi; gridBox.hi = bounds.Hi;
AABound nodeBox = gridBox; AABound nodeBox = gridBox;
// seed subdivide function // seed subdivide function
subdivide(0, (int)(dat.numPrims - 1), tempTree, dat, gridBox, nodeBox, 0, 1, stats); Subdivide(0, (int)(dat.numPrims - 1), tempTree, dat, gridBox, nodeBox, 0, 1, stats);
} }
void subdivide(int left, int right, List<uint> tempTree, buildData dat, AABound gridBox, AABound nodeBox, int nodeIndex, int depth, BuildStats stats) void Subdivide(int left, int right, List<uint> tempTree, buildData dat, AABound gridBox, AABound nodeBox, int nodeIndex, int depth, BuildStats stats)
{ {
if ((right - left + 1) <= dat.maxPrims || depth >= 64) if ((right - left + 1) <= dat.maxPrims || depth >= 64)
{ {
// write leaf node // write leaf node
stats.updateLeaf(depth, right - left + 1); stats.UpdateLeaf(depth, right - left + 1);
createNode(tempTree, nodeIndex, left, right); CreateNode(tempTree, nodeIndex, left, right);
return; return;
} }
// calculate extents // calculate extents
@@ -122,21 +122,21 @@ namespace Game.Collision
// node box is too big compare to space occupied by primitives? // node box is too big compare to space occupied by primitives?
if (1.3f * nodeNewW < nodeBoxW) if (1.3f * nodeNewW < nodeBoxW)
{ {
stats.updateBVH2(); stats.UpdateBVH2();
int nextIndex1 = tempTree.Count; int nextIndex1 = tempTree.Count;
// allocate child // allocate child
tempTree.Add(0); tempTree.Add(0);
tempTree.Add(0); tempTree.Add(0);
tempTree.Add(0); tempTree.Add(0);
// write bvh2 clip node // write bvh2 clip node
stats.updateInner(); stats.UpdateInner();
tempTree[nodeIndex + 0] = (uint)((axis << 30) | (1 << 29) | nextIndex1); tempTree[nodeIndex + 0] = (uint)((axis << 30) | (1 << 29) | nextIndex1);
tempTree[nodeIndex + 1] = floatToRawIntBits(nodeL); tempTree[nodeIndex + 1] = FloatToRawIntBits(nodeL);
tempTree[nodeIndex + 2] = floatToRawIntBits(nodeR); tempTree[nodeIndex + 2] = FloatToRawIntBits(nodeR);
// update nodebox and recurse // update nodebox and recurse
nodeBox.lo[axis] = nodeL; nodeBox.lo[axis] = nodeL;
nodeBox.hi[axis] = nodeR; nodeBox.hi[axis] = nodeR;
subdivide(left, rightOrig, tempTree, dat, gridBox, nodeBox, nextIndex1, depth + 1, stats); Subdivide(left, rightOrig, tempTree, dat, gridBox, nodeBox, nextIndex1, depth + 1, stats);
return; return;
} }
} }
@@ -147,8 +147,8 @@ namespace Game.Collision
if (prevAxis == axis && MathFunctions.fuzzyEq(prevSplit, split)) if (prevAxis == axis && MathFunctions.fuzzyEq(prevSplit, split))
{ {
// we are stuck here - create a leaf // we are stuck here - create a leaf
stats.updateLeaf(depth, right - left + 1); stats.UpdateLeaf(depth, right - left + 1);
createNode(tempTree, nodeIndex, left, right); CreateNode(tempTree, nodeIndex, left, right);
return; return;
} }
if (clipL <= split) if (clipL <= split)
@@ -169,8 +169,8 @@ namespace Game.Collision
if (prevAxis == axis && MathFunctions.fuzzyEq(prevSplit, split)) if (prevAxis == axis && MathFunctions.fuzzyEq(prevSplit, split))
{ {
// we are stuck here - create a leaf // we are stuck here - create a leaf
stats.updateLeaf(depth, right - left + 1); stats.UpdateLeaf(depth, right - left + 1);
createNode(tempTree, nodeIndex, left, right); CreateNode(tempTree, nodeIndex, left, right);
return; return;
} }
@@ -201,23 +201,23 @@ namespace Game.Collision
{ {
// create a node with a left child // create a node with a left child
// write leaf node // write leaf node
stats.updateInner(); stats.UpdateInner();
tempTree[nodeIndex + 0] = (uint)((prevAxis << 30) | nextIndex0); tempTree[nodeIndex + 0] = (uint)((prevAxis << 30) | nextIndex0);
tempTree[nodeIndex + 1] = floatToRawIntBits(prevClip); tempTree[nodeIndex + 1] = FloatToRawIntBits(prevClip);
tempTree[nodeIndex + 2] = floatToRawIntBits(float.PositiveInfinity); tempTree[nodeIndex + 2] = FloatToRawIntBits(float.PositiveInfinity);
} }
else else
{ {
// create a node with a right child // create a node with a right child
// write leaf node // write leaf node
stats.updateInner(); stats.UpdateInner();
tempTree[nodeIndex + 0] = (uint)((prevAxis << 30) | (nextIndex0 - 3)); tempTree[nodeIndex + 0] = (uint)((prevAxis << 30) | (nextIndex0 - 3));
tempTree[nodeIndex + 1] = floatToRawIntBits(float.NegativeInfinity); tempTree[nodeIndex + 1] = FloatToRawIntBits(float.NegativeInfinity);
tempTree[nodeIndex + 2] = floatToRawIntBits(prevClip); tempTree[nodeIndex + 2] = FloatToRawIntBits(prevClip);
} }
// count stats for the unused leaf // count stats for the unused leaf
depth++; depth++;
stats.updateLeaf(depth, 0); stats.UpdateLeaf(depth, 0);
// now we keep going as we are, with a new nodeIndex: // now we keep going as we are, with a new nodeIndex:
nodeIndex = nextIndex0; nodeIndex = nextIndex0;
} }
@@ -245,10 +245,10 @@ namespace Game.Collision
tempTree.Add(0); tempTree.Add(0);
} }
// write leaf node // write leaf node
stats.updateInner(); stats.UpdateInner();
tempTree[nodeIndex + 0] = (uint)((axis << 30) | nextIndex); tempTree[nodeIndex + 0] = (uint)((axis << 30) | nextIndex);
tempTree[nodeIndex + 1] = floatToRawIntBits(clipL); tempTree[nodeIndex + 1] = FloatToRawIntBits(clipL);
tempTree[nodeIndex + 2] = floatToRawIntBits(clipR); tempTree[nodeIndex + 2] = FloatToRawIntBits(clipR);
// prepare L/R child boxes // prepare L/R child boxes
AABound gridBoxL = gridBox; AABound gridBoxL = gridBox;
AABound gridBoxR = gridBox; AABound gridBoxR = gridBox;
@@ -259,16 +259,16 @@ namespace Game.Collision
nodeBoxR.lo[axis] = clipR; nodeBoxR.lo[axis] = clipR;
// recurse // recurse
if (nl > 0) if (nl > 0)
subdivide(left, right, tempTree, dat, gridBoxL, nodeBoxL, nextIndex, depth + 1, stats); Subdivide(left, right, tempTree, dat, gridBoxL, nodeBoxL, nextIndex, depth + 1, stats);
else else
stats.updateLeaf(depth + 1, 0); stats.UpdateLeaf(depth + 1, 0);
if (nr > 0) if (nr > 0)
subdivide(right + 1, rightOrig, tempTree, dat, gridBoxR, nodeBoxR, nextIndex + 3, depth + 1, stats); Subdivide(right + 1, rightOrig, tempTree, dat, gridBoxR, nodeBoxR, nextIndex + 3, depth + 1, stats);
else else
stats.updateLeaf(depth + 1, 0); stats.UpdateLeaf(depth + 1, 0);
} }
public bool readFromFile(BinaryReader reader) public bool ReadFromFile(BinaryReader reader)
{ {
var lo = reader.Read<Vector3>(); var lo = reader.Read<Vector3>();
var hi = reader.Read<Vector3>(); var hi = reader.Read<Vector3>();
@@ -283,11 +283,11 @@ namespace Game.Collision
return true; return true;
} }
public void build<T>(List<T> primitives, uint leafSize = 3, bool printStats = false) where T : IModel public void Build<T>(List<T> primitives, uint leafSize = 3, bool printStats = false) where T : IModel
{ {
if (primitives.Count == 0) if (primitives.Count == 0)
{ {
init_empty(); InitEmpty();
return; return;
} }
@@ -296,16 +296,16 @@ namespace Game.Collision
dat.numPrims = (uint)primitives.Count; dat.numPrims = (uint)primitives.Count;
dat.indices = new uint[dat.numPrims]; dat.indices = new uint[dat.numPrims];
dat.primBound = new AxisAlignedBox[dat.numPrims]; dat.primBound = new AxisAlignedBox[dat.numPrims];
bounds = primitives[0].getBounds(); bounds = primitives[0].GetBounds();
for (int i = 0; i < dat.numPrims; ++i) for (int i = 0; i < dat.numPrims; ++i)
{ {
dat.indices[i] = (uint)i; dat.indices[i] = (uint)i;
dat.primBound[i] = primitives[i].getBounds(); dat.primBound[i] = primitives[i].GetBounds();
bounds.merge(dat.primBound[i]); bounds.merge(dat.primBound[i]);
} }
List<uint> tempTree = new List<uint>(); List<uint> tempTree = new List<uint>();
BuildStats stats = new BuildStats(); BuildStats stats = new BuildStats();
buildHierarchy(tempTree, dat, stats); BuildHierarchy(tempTree, dat, stats);
objects = new uint[dat.numPrims]; objects = new uint[dat.numPrims];
for (int i = 0; i < dat.numPrims; ++i) for (int i = 0; i < dat.numPrims; ++i)
@@ -314,9 +314,9 @@ namespace Game.Collision
tree = tempTree.ToArray(); tree = tempTree.ToArray();
} }
public uint primCount() { return (uint)objects.Length; } public uint PrimCount() { return (uint)objects.Length; }
public void intersectRay(Ray r, WorkerCallback intersectCallback, ref float maxDist, bool stopAtFirst = false) public void IntersectRay(Ray r, WorkerCallback intersectCallback, ref float maxDist, bool stopAtFirst = false)
{ {
float intervalMin = -1.0f; float intervalMin = -1.0f;
float intervalMax = -1.0f; float intervalMax = -1.0f;
@@ -356,7 +356,7 @@ namespace Game.Collision
for (int i = 0; i < 3; ++i) for (int i = 0; i < 3; ++i)
{ {
offsetFront[i] = floatToRawIntBits(dir[i]) >> 31; offsetFront[i] = FloatToRawIntBits(dir[i]) >> 31;
offsetBack[i] = offsetFront[i] ^ 1; offsetBack[i] = offsetFront[i] ^ 1;
offsetFront3[i] = offsetFront[i] * 3; offsetFront3[i] = offsetFront[i] * 3;
offsetBack3[i] = offsetBack[i] * 3; offsetBack3[i] = offsetBack[i] * 3;
@@ -383,8 +383,8 @@ namespace Game.Collision
if (axis < 3) if (axis < 3)
{ {
// "normal" interior node // "normal" interior node
float tf = (intBitsToFloat(tree[(int)(node + offsetFront[axis])]) - org[axis]) * invDir[axis]; float tf = (IntBitsToFloat(tree[(int)(node + offsetFront[axis])]) - org[axis]) * invDir[axis];
float tb = (intBitsToFloat(tree[(int)(node + offsetBack[axis])]) - org[axis]) * invDir[axis]; float tb = (IntBitsToFloat(tree[(int)(node + offsetBack[axis])]) - org[axis]) * invDir[axis];
// ray passes between clip zones // ray passes between clip zones
if (tf < intervalMin && tb > intervalMax) if (tf < intervalMin && tb > intervalMax)
break; break;
@@ -432,8 +432,8 @@ namespace Game.Collision
{ {
if (axis > 2) if (axis > 2)
return; // should not happen return; // should not happen
float tf = (intBitsToFloat(tree[(int)(node + offsetFront[axis])]) - org[axis]) * invDir[axis]; float tf = (IntBitsToFloat(tree[(int)(node + offsetFront[axis])]) - org[axis]) * invDir[axis];
float tb = (intBitsToFloat(tree[(int)(node + offsetBack[axis])]) - org[axis]) * invDir[axis]; float tb = (IntBitsToFloat(tree[(int)(node + offsetBack[axis])]) - org[axis]) * invDir[axis];
node = offset; node = offset;
intervalMin = (tf >= intervalMin) ? tf : intervalMin; intervalMin = (tf >= intervalMin) ? tf : intervalMin;
intervalMax = (tb <= intervalMax) ? tb : intervalMax; intervalMax = (tb <= intervalMax) ? tb : intervalMax;
@@ -459,7 +459,7 @@ namespace Game.Collision
} }
} }
public void intersectPoint(Vector3 p, WorkerCallback intersectCallback) public void IntersectPoint(Vector3 p, WorkerCallback intersectCallback)
{ {
if (!bounds.contains(p)) if (!bounds.contains(p))
return; return;
@@ -481,8 +481,8 @@ namespace Game.Collision
if (axis < 3) if (axis < 3)
{ {
// "normal" interior node // "normal" interior node
float tl = intBitsToFloat(tree[node + 1]); float tl = IntBitsToFloat(tree[node + 1]);
float tr = intBitsToFloat(tree[node + 2]); float tr = IntBitsToFloat(tree[node + 2]);
// point is between clip zones // point is between clip zones
if (tl < p[(int)axis] && tr > p[axis]) if (tl < p[(int)axis] && tr > p[axis])
break; break;
@@ -522,8 +522,8 @@ namespace Game.Collision
{ {
if (axis > 2) if (axis > 2)
return; // should not happen return; // should not happen
float tl = intBitsToFloat(tree[node + 1]); float tl = IntBitsToFloat(tree[node + 1]);
float tr = intBitsToFloat(tree[node + 2]); float tr = IntBitsToFloat(tree[node + 2]);
node = offset; node = offset;
if (tl > p[axis] || tr < p[axis]) if (tl > p[axis] || tr < p[axis])
break; break;
@@ -540,7 +540,7 @@ namespace Game.Collision
} }
} }
void createNode(List<uint> tempTree, int nodeIndex, int left, int right) void CreateNode(List<uint> tempTree, int nodeIndex, int left, int right)
{ {
// write leaf node // write leaf node
tempTree[nodeIndex + 0] = (uint)((3 << 30) | left); tempTree[nodeIndex + 0] = (uint)((3 << 30) | left);
@@ -589,9 +589,9 @@ namespace Game.Collision
numLeavesN[i] = 0; numLeavesN[i] = 0;
} }
public void updateInner() { numNodes++; } public void UpdateInner() { numNodes++; }
public void updateBVH2() { numBVH2++; } public void UpdateBVH2() { numBVH2++; }
public void updateLeaf(int depth, int n) public void UpdateLeaf(int depth, int n)
{ {
numLeaves++; numLeaves++;
minDepth = Math.Min(depth, minDepth); minDepth = Math.Min(depth, minDepth);
@@ -619,13 +619,13 @@ namespace Game.Collision
public float FloatValue; public float FloatValue;
} }
uint floatToRawIntBits(float f) uint FloatToRawIntBits(float f)
{ {
FloatToIntConverter converter = new FloatToIntConverter(); FloatToIntConverter converter = new FloatToIntConverter();
converter.FloatValue = f; converter.FloatValue = f;
return converter.IntValue; return converter.IntValue;
} }
float intBitsToFloat(uint i) float IntBitsToFloat(uint i)
{ {
FloatToIntConverter converter = new FloatToIntConverter(); FloatToIntConverter converter = new FloatToIntConverter();
converter.IntValue = i; converter.IntValue = i;
@@ -22,12 +22,12 @@ namespace Game.Collision
{ {
public class BIHWrap<T> where T : IModel public class BIHWrap<T> where T : IModel
{ {
public void insert(T obj) public void Insert(T obj)
{ {
++unbalanced_times; ++unbalanced_times;
m_objects_to_push.Add(obj); m_objects_to_push.Add(obj);
} }
public void remove(T obj) public void Remove(T obj)
{ {
++unbalanced_times; ++unbalanced_times;
uint Idx = 0; uint Idx = 0;
@@ -37,7 +37,7 @@ namespace Game.Collision
m_objects_to_push.Remove(obj); m_objects_to_push.Remove(obj);
} }
public void balance() public void Balance()
{ {
if (unbalanced_times == 0) if (unbalanced_times == 0)
return; return;
@@ -47,21 +47,21 @@ namespace Game.Collision
m_objects.AddRange(m_obj2Idx.Keys); m_objects.AddRange(m_obj2Idx.Keys);
m_objects.AddRange(m_objects_to_push); m_objects.AddRange(m_objects_to_push);
m_tree.build(m_objects); m_tree.Build(m_objects);
} }
public void intersectRay(Ray ray, WorkerCallback intersectCallback, ref float maxDist) public void IntersectRay(Ray ray, WorkerCallback intersectCallback, ref float maxDist)
{ {
balance(); Balance();
MDLCallback temp_cb = new MDLCallback(intersectCallback, m_objects.ToArray(), (uint)m_objects.Count); MDLCallback temp_cb = new MDLCallback(intersectCallback, m_objects.ToArray(), (uint)m_objects.Count);
m_tree.intersectRay(ray, temp_cb, ref maxDist, true); m_tree.IntersectRay(ray, temp_cb, ref maxDist, true);
} }
public void intersectPoint(Vector3 point, WorkerCallback intersectCallback) public void IntersectPoint(Vector3 point, WorkerCallback intersectCallback)
{ {
balance(); Balance();
MDLCallback callback = new MDLCallback(intersectCallback, m_objects.ToArray(), (uint)m_objects.Count); MDLCallback callback = new MDLCallback(intersectCallback, m_objects.ToArray(), (uint)m_objects.Count);
m_tree.intersectPoint(point, callback); m_tree.IntersectPoint(point, callback);
} }
BIH m_tree = new BIH(); BIH m_tree = new BIH();
+5 -5
View File
@@ -15,10 +15,10 @@
* 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.GameMath; using Framework.GameMath;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Framework.Constants;
namespace Game.Collision namespace Game.Collision
{ {
@@ -178,12 +178,12 @@ namespace Game.Collision
{ {
if (prims[entry] == null) if (prims[entry] == null)
return false; return false;
bool result = prims[entry].intersectRay(ray, ref distance, pStopAtFirstHit, flags); bool result = prims[entry].IntersectRay(ray, ref distance, pStopAtFirstHit, flags);
if (result) if (result)
hit = true; hit = true;
return result; return result;
} }
public bool didHit() { return hit; } public bool DidHit() { return hit; }
ModelInstance[] prims; ModelInstance[] prims;
bool hit; bool hit;
@@ -201,7 +201,7 @@ namespace Game.Collision
if (prims[entry] == null) if (prims[entry] == null)
return; return;
prims[entry].intersectPoint(point, aInfo); prims[entry].IntersectPoint(point, aInfo);
} }
ModelInstance[] prims; ModelInstance[] prims;
@@ -242,7 +242,7 @@ namespace Game.Collision
return _didHit; return _didHit;
} }
public bool didHit() { return _didHit; } public bool DidHit() { return _didHit; }
bool _didHit; bool _didHit;
PhaseShift _phaseShift; PhaseShift _phaseShift;
+33 -33
View File
@@ -26,42 +26,42 @@ namespace Game.Collision
impl = new DynTreeImpl(); impl = new DynTreeImpl();
} }
public void insert(GameObjectModel mdl) public void Insert(GameObjectModel mdl)
{ {
impl.insert(mdl); impl.Insert(mdl);
} }
public void remove(GameObjectModel mdl) public void Remove(GameObjectModel mdl)
{ {
impl.remove(mdl); impl.Remove(mdl);
} }
public bool contains(GameObjectModel mdl) public bool Contains(GameObjectModel mdl)
{ {
return impl.contains(mdl); return impl.Contains(mdl);
} }
public void balance() public void Balance()
{ {
impl.balance(); impl.Balance();
} }
public void update(uint diff) public void Update(uint diff)
{ {
impl.update(diff); impl.Update(diff);
} }
public bool getIntersectionTime(Ray ray, Vector3 endPos, PhaseShift phaseShift, float maxDist) public bool GetIntersectionTime(Ray ray, Vector3 endPos, PhaseShift phaseShift, float maxDist)
{ {
float distance = maxDist; float distance = maxDist;
DynamicTreeIntersectionCallback callback = new DynamicTreeIntersectionCallback(phaseShift); DynamicTreeIntersectionCallback callback = new DynamicTreeIntersectionCallback(phaseShift);
impl.intersectRay(ray, callback, ref distance, endPos); impl.IntersectRay(ray, callback, ref distance, endPos);
if (callback.didHit()) if (callback.DidHit())
maxDist = distance; maxDist = distance;
return callback.didHit(); return callback.DidHit();
} }
public bool getObjectHitPos(Vector3 startPos, Vector3 endPos, ref Vector3 resultHitPos, float modifyDist, PhaseShift phaseShift) public bool GetObjectHitPos(Vector3 startPos, Vector3 endPos, ref Vector3 resultHitPos, float modifyDist, PhaseShift phaseShift)
{ {
bool result = false; bool result = false;
float maxDist = (endPos - startPos).magnitude(); float maxDist = (endPos - startPos).magnitude();
@@ -76,7 +76,7 @@ namespace Game.Collision
Vector3 dir = (endPos - startPos) / maxDist; // direction with length of 1 Vector3 dir = (endPos - startPos) / maxDist; // direction with length of 1
Ray ray = new Ray(startPos, dir); Ray ray = new Ray(startPos, dir);
float dist = maxDist; float dist = maxDist;
if (getIntersectionTime(ray, endPos, phaseShift, dist)) if (GetIntersectionTime(ray, endPos, phaseShift, dist))
{ {
resultHitPos = startPos + dir * dist; resultHitPos = startPos + dir * dist;
if (modifyDist < 0) if (modifyDist < 0)
@@ -99,7 +99,7 @@ namespace Game.Collision
return result; return result;
} }
public bool isInLineOfSight(Vector3 startPos, Vector3 endPos, PhaseShift phaseShift) public bool IsInLineOfSight(Vector3 startPos, Vector3 endPos, PhaseShift phaseShift)
{ {
float maxDist = (endPos - startPos).magnitude(); float maxDist = (endPos - startPos).magnitude();
@@ -108,25 +108,25 @@ namespace Game.Collision
Ray r = new Ray(startPos, (endPos - startPos) / maxDist); Ray r = new Ray(startPos, (endPos - startPos) / maxDist);
DynamicTreeIntersectionCallback callback = new DynamicTreeIntersectionCallback(phaseShift); DynamicTreeIntersectionCallback callback = new DynamicTreeIntersectionCallback(phaseShift);
impl.intersectRay(r, callback, ref maxDist, endPos); impl.IntersectRay(r, callback, ref maxDist, endPos);
return !callback.didHit(); return !callback.DidHit();
} }
public float getHeight(float x, float y, float z, float maxSearchDist, PhaseShift phaseShift) public float GetHeight(float x, float y, float z, float maxSearchDist, PhaseShift phaseShift)
{ {
Vector3 v = new Vector3(x, y, z + 0.5f); Vector3 v = new Vector3(x, y, z + 0.5f);
Ray r = new Ray(v, new Vector3(0, 0, -1)); Ray r = new Ray(v, new Vector3(0, 0, -1));
DynamicTreeIntersectionCallback callback = new DynamicTreeIntersectionCallback(phaseShift); DynamicTreeIntersectionCallback callback = new DynamicTreeIntersectionCallback(phaseShift);
impl.intersectZAllignedRay(r, callback, ref maxSearchDist); impl.IntersectZAllignedRay(r, callback, ref maxSearchDist);
if (callback.didHit()) if (callback.DidHit())
return v.Z - maxSearchDist; return v.Z - maxSearchDist;
else else
return float.NegativeInfinity; return float.NegativeInfinity;
} }
public bool getAreaInfo(float x, float y, ref float z, PhaseShift phaseShift, out uint flags, out int adtId, out int rootId, out int groupId) public bool GetAreaInfo(float x, float y, ref float z, PhaseShift phaseShift, out uint flags, out int adtId, out int rootId, out int groupId)
{ {
flags = 0; flags = 0;
adtId = 0; adtId = 0;
@@ -135,7 +135,7 @@ namespace Game.Collision
Vector3 v = new Vector3(x, y, z + 0.5f); Vector3 v = new Vector3(x, y, z + 0.5f);
DynamicTreeAreaInfoCallback intersectionCallBack = new DynamicTreeAreaInfoCallback(phaseShift); DynamicTreeAreaInfoCallback intersectionCallBack = new DynamicTreeAreaInfoCallback(phaseShift);
impl.intersectPoint(v, intersectionCallBack); impl.IntersectPoint(v, intersectionCallBack);
if (intersectionCallBack.GetAreaInfo().result) if (intersectionCallBack.GetAreaInfo().result)
{ {
flags = intersectionCallBack.GetAreaInfo().flags; flags = intersectionCallBack.GetAreaInfo().flags;
@@ -159,27 +159,27 @@ namespace Game.Collision
unbalanced_times = 0; unbalanced_times = 0;
} }
public override void insert(GameObjectModel mdl) public override void Insert(GameObjectModel mdl)
{ {
base.insert(mdl); base.Insert(mdl);
++unbalanced_times; ++unbalanced_times;
} }
public override void remove(GameObjectModel mdl) public override void Remove(GameObjectModel mdl)
{ {
base.remove(mdl); base.Remove(mdl);
++unbalanced_times; ++unbalanced_times;
} }
public override void balance() public override void Balance()
{ {
base.balance(); base.Balance();
unbalanced_times = 0; unbalanced_times = 0;
} }
public void update(uint difftime) public void Update(uint difftime)
{ {
if (empty()) if (Empty())
return; return;
rebalance_timer.Update((int)difftime); rebalance_timer.Update((int)difftime);
@@ -187,7 +187,7 @@ namespace Game.Collision
{ {
rebalance_timer.Reset(200); rebalance_timer.Reset(200);
if (unbalanced_times > 0) if (unbalanced_times > 0)
balance(); Balance();
} }
} }
+55 -55
View File
@@ -49,17 +49,17 @@ namespace Game.Collision
iParentMapData[pair.Value] = pair.Key; iParentMapData[pair.Value] = pair.Key;
} }
public VMAPLoadResult loadMap(uint mapId, uint x, uint y) public VMAPLoadResult LoadMap(uint mapId, uint x, uint y)
{ {
var result = VMAPLoadResult.Ignored; var result = VMAPLoadResult.Ignored;
if (isMapLoadingEnabled()) if (IsMapLoadingEnabled())
{ {
if (loadSingleMap(mapId, x, y)) if (LoadSingleMap(mapId, x, y))
{ {
result = VMAPLoadResult.OK; result = VMAPLoadResult.OK;
var childMaps = iChildMapData.LookupByKey(mapId); var childMaps = iChildMapData.LookupByKey(mapId);
foreach (uint childMapId in childMaps) foreach (uint childMapId in childMaps)
if (!loadSingleMap(childMapId, x, y)) if (!LoadSingleMap(childMapId, x, y))
result = VMAPLoadResult.Error; result = VMAPLoadResult.Error;
} }
else else
@@ -69,12 +69,12 @@ namespace Game.Collision
return result; return result;
} }
bool loadSingleMap(uint mapId, uint tileX, uint tileY) bool LoadSingleMap(uint mapId, uint tileX, uint tileY)
{ {
var instanceTree = iInstanceMapTrees.LookupByKey(mapId); var instanceTree = iInstanceMapTrees.LookupByKey(mapId);
if (instanceTree == null) if (instanceTree == null)
{ {
string filename = VMapPath + getMapFileName(mapId); string filename = VMapPath + GetMapFileName(mapId);
StaticMapTree newTree = new StaticMapTree(mapId); StaticMapTree newTree = new StaticMapTree(mapId);
if (!newTree.InitMap(filename)) if (!newTree.InitMap(filename))
return false; return false;
@@ -87,79 +87,79 @@ namespace Game.Collision
return instanceTree.LoadMapTile(tileX, tileY, this); return instanceTree.LoadMapTile(tileX, tileY, this);
} }
public void unloadMap(uint mapId, uint x, uint y) public void UnloadMap(uint mapId, uint x, uint y)
{ {
var childMaps = iChildMapData.LookupByKey(mapId); var childMaps = iChildMapData.LookupByKey(mapId);
foreach (uint childMapId in childMaps) foreach (uint childMapId in childMaps)
unloadSingleMap(childMapId, x, y); UnloadSingleMap(childMapId, x, y);
unloadSingleMap(mapId, x, y); UnloadSingleMap(mapId, x, y);
} }
void unloadSingleMap(uint mapId, uint x, uint y) void UnloadSingleMap(uint mapId, uint x, uint y)
{ {
var instanceTree = iInstanceMapTrees.LookupByKey(mapId); var instanceTree = iInstanceMapTrees.LookupByKey(mapId);
if (instanceTree != null) if (instanceTree != null)
{ {
instanceTree.UnloadMapTile(x, y, this); instanceTree.UnloadMapTile(x, y, this);
if (instanceTree.numLoadedTiles() == 0) if (instanceTree.NumLoadedTiles() == 0)
{ {
iInstanceMapTrees.Remove(mapId); iInstanceMapTrees.Remove(mapId);
} }
} }
} }
public void unloadMap(uint mapId) public void UnloadMap(uint mapId)
{ {
var childMaps = iChildMapData.LookupByKey(mapId); var childMaps = iChildMapData.LookupByKey(mapId);
foreach (uint childMapId in childMaps) foreach (uint childMapId in childMaps)
unloadSingleMap(childMapId); UnloadSingleMap(childMapId);
unloadSingleMap(mapId); UnloadSingleMap(mapId);
} }
void unloadSingleMap(uint mapId) void UnloadSingleMap(uint mapId)
{ {
var instanceTree = iInstanceMapTrees.LookupByKey(mapId); var instanceTree = iInstanceMapTrees.LookupByKey(mapId);
if (instanceTree != null) if (instanceTree != null)
{ {
instanceTree.UnloadMap(this); instanceTree.UnloadMap(this);
if (instanceTree.numLoadedTiles() == 0) if (instanceTree.NumLoadedTiles() == 0)
{ {
iInstanceMapTrees.Remove(mapId); iInstanceMapTrees.Remove(mapId);
} }
} }
} }
public bool isInLineOfSight(uint mapId, float x1, float y1, float z1, float x2, float y2, float z2, ModelIgnoreFlags ignoreFlags) public bool IsInLineOfSight(uint mapId, float x1, float y1, float z1, float x2, float y2, float z2, ModelIgnoreFlags ignoreFlags)
{ {
if (!isLineOfSightCalcEnabled() || Global.DisableMgr.IsDisabledFor(DisableType.VMAP, mapId, null, DisableFlags.VmapLOS)) if (!IsLineOfSightCalcEnabled() || Global.DisableMgr.IsDisabledFor(DisableType.VMAP, mapId, null, DisableFlags.VmapLOS))
return true; return true;
var instanceTree = iInstanceMapTrees.LookupByKey(mapId); var instanceTree = iInstanceMapTrees.LookupByKey(mapId);
if (instanceTree != null) if (instanceTree != null)
{ {
Vector3 pos1 = convertPositionToInternalRep(x1, y1, z1); Vector3 pos1 = ConvertPositionToInternalRep(x1, y1, z1);
Vector3 pos2 = convertPositionToInternalRep(x2, y2, z2); Vector3 pos2 = ConvertPositionToInternalRep(x2, y2, z2);
if (pos1 != pos2) if (pos1 != pos2)
return instanceTree.isInLineOfSight(pos1, pos2, ignoreFlags); return instanceTree.IsInLineOfSight(pos1, pos2, ignoreFlags);
} }
return true; return true;
} }
public bool getObjectHitPos(uint mapId, float x1, float y1, float z1, float x2, float y2, float z2, out float rx, out float ry, out float rz, float modifyDist) public bool GetObjectHitPos(uint mapId, float x1, float y1, float z1, float x2, float y2, float z2, out float rx, out float ry, out float rz, float modifyDist)
{ {
if (isLineOfSightCalcEnabled() && !Global.DisableMgr.IsDisabledFor(DisableType.VMAP, mapId, null, DisableFlags.VmapLOS)) if (IsLineOfSightCalcEnabled() && !Global.DisableMgr.IsDisabledFor(DisableType.VMAP, mapId, null, DisableFlags.VmapLOS))
{ {
var instanceTree = iInstanceMapTrees.LookupByKey(mapId); var instanceTree = iInstanceMapTrees.LookupByKey(mapId);
if (instanceTree != null) if (instanceTree != null)
{ {
Vector3 resultPos; Vector3 resultPos;
Vector3 pos1 = convertPositionToInternalRep(x1, y1, z1); Vector3 pos1 = ConvertPositionToInternalRep(x1, y1, z1);
Vector3 pos2 = convertPositionToInternalRep(x2, y2, z2); Vector3 pos2 = ConvertPositionToInternalRep(x2, y2, z2);
bool result = instanceTree.getObjectHitPos(pos1, pos2, out resultPos, modifyDist); bool result = instanceTree.GetObjectHitPos(pos1, pos2, out resultPos, modifyDist);
resultPos = convertPositionToInternalRep(resultPos.X, resultPos.Y, resultPos.Z); resultPos = ConvertPositionToInternalRep(resultPos.X, resultPos.Y, resultPos.Z);
rx = resultPos.X; rx = resultPos.X;
ry = resultPos.Y; ry = resultPos.Y;
rz = resultPos.Z; rz = resultPos.Z;
@@ -174,15 +174,15 @@ namespace Game.Collision
return false; return false;
} }
public float getHeight(uint mapId, float x, float y, float z, float maxSearchDist) public float GetHeight(uint mapId, float x, float y, float z, float maxSearchDist)
{ {
if (isHeightCalcEnabled() && !Global.DisableMgr.IsDisabledFor(DisableType.VMAP, mapId, null, DisableFlags.VmapHeight)) if (IsHeightCalcEnabled() && !Global.DisableMgr.IsDisabledFor(DisableType.VMAP, mapId, null, DisableFlags.VmapHeight))
{ {
var instanceTree = iInstanceMapTrees.LookupByKey(mapId); var instanceTree = iInstanceMapTrees.LookupByKey(mapId);
if (instanceTree != null) if (instanceTree != null)
{ {
Vector3 pos = convertPositionToInternalRep(x, y, z); Vector3 pos = ConvertPositionToInternalRep(x, y, z);
float height = instanceTree.getHeight(pos, maxSearchDist); float height = instanceTree.GetHeight(pos, maxSearchDist);
if (float.IsInfinity(height)) if (float.IsInfinity(height))
height = MapConst.VMAPInvalidHeightValue; // No height height = MapConst.VMAPInvalidHeightValue; // No height
@@ -193,7 +193,7 @@ namespace Game.Collision
return MapConst.VMAPInvalidHeightValue; return MapConst.VMAPInvalidHeightValue;
} }
public bool getAreaInfo(uint mapId, float x, float y, ref float z, out uint flags, out int adtId, out int rootId, out int groupId) public bool GetAreaInfo(uint mapId, float x, float y, ref float z, out uint flags, out int adtId, out int rootId, out int groupId)
{ {
flags = 0; flags = 0;
adtId = 0; adtId = 0;
@@ -204,8 +204,8 @@ namespace Game.Collision
var instanceTree = iInstanceMapTrees.LookupByKey(mapId); var instanceTree = iInstanceMapTrees.LookupByKey(mapId);
if (instanceTree != null) if (instanceTree != null)
{ {
Vector3 pos = convertPositionToInternalRep(x, y, z); Vector3 pos = ConvertPositionToInternalRep(x, y, z);
bool result = instanceTree.getAreaInfo(ref pos, out flags, out adtId, out rootId, out groupId); bool result = instanceTree.GetAreaInfo(ref pos, out flags, out adtId, out rootId, out groupId);
// z is not touched by convertPositionToInternalRep(), so just copy // z is not touched by convertPositionToInternalRep(), so just copy
z = pos.Z; z = pos.Z;
return result; return result;
@@ -223,7 +223,7 @@ namespace Game.Collision
if (instanceTree != null) if (instanceTree != null)
{ {
LocationInfo info = new LocationInfo(); LocationInfo info = new LocationInfo();
Vector3 pos = convertPositionToInternalRep(x, y, z); Vector3 pos = ConvertPositionToInternalRep(x, y, z);
if (instanceTree.GetLocationInfo(pos, info)) if (instanceTree.GetLocationInfo(pos, info))
{ {
floor = info.ground_Z; floor = info.ground_Z;
@@ -239,7 +239,7 @@ namespace Game.Collision
return false; return false;
} }
public WorldModel acquireModelInstance(string filename, uint flags = 0) public WorldModel AcquireModelInstance(string filename, uint flags = 0)
{ {
lock (LoadedModelFilesLock) lock (LoadedModelFilesLock)
{ {
@@ -248,7 +248,7 @@ namespace Game.Collision
if (model == null) if (model == null)
{ {
WorldModel worldmodel = new WorldModel(); WorldModel worldmodel = new WorldModel();
if (!worldmodel.readFile(VMapPath + filename)) if (!worldmodel.ReadFile(VMapPath + filename))
{ {
Log.outError(LogFilter.Server, "VMapManager: could not load '{0}'", filename); Log.outError(LogFilter.Server, "VMapManager: could not load '{0}'", filename);
return null; return null;
@@ -259,16 +259,16 @@ namespace Game.Collision
worldmodel.Flags = flags; worldmodel.Flags = flags;
model = new ManagedModel(); model = new ManagedModel();
model.setModel(worldmodel); model.SetModel(worldmodel);
iLoadedModelFiles.Add(filename, model); iLoadedModelFiles.Add(filename, model);
} }
model.incRefCount(); model.IncRefCount();
return model.getModel(); return model.GetModel();
} }
} }
public void releaseModelInstance(string filename) public void ReleaseModelInstance(string filename)
{ {
lock (LoadedModelFilesLock) lock (LoadedModelFilesLock)
{ {
@@ -279,7 +279,7 @@ namespace Game.Collision
Log.outError(LogFilter.Server, "VMapManager: trying to unload non-loaded file '{0}'", filename); Log.outError(LogFilter.Server, "VMapManager: trying to unload non-loaded file '{0}'", filename);
return; return;
} }
if (model.decRefCount() == 0) if (model.DecRefCount() == 0)
{ {
Log.outDebug(LogFilter.Maps, "VMapManager: unloading file '{0}'", filename); Log.outDebug(LogFilter.Maps, "VMapManager: unloading file '{0}'", filename);
iLoadedModelFiles.Remove(filename); iLoadedModelFiles.Remove(filename);
@@ -287,12 +287,12 @@ namespace Game.Collision
} }
} }
public LoadResult existsMap(uint mapId, uint x, uint y) public LoadResult ExistsMap(uint mapId, uint x, uint y)
{ {
return StaticMapTree.CanLoadMap(VMapPath, mapId, x, y, this); return StaticMapTree.CanLoadMap(VMapPath, mapId, x, y, this);
} }
public int getParentMapId(uint mapId) public int GetParentMapId(uint mapId)
{ {
if (iParentMapData.ContainsKey(mapId)) if (iParentMapData.ContainsKey(mapId))
return (int)iParentMapData[mapId]; return (int)iParentMapData[mapId];
@@ -300,7 +300,7 @@ namespace Game.Collision
return -1; return -1;
} }
Vector3 convertPositionToInternalRep(float x, float y, float z) Vector3 ConvertPositionToInternalRep(float x, float y, float z)
{ {
Vector3 pos = new Vector3(); Vector3 pos = new Vector3();
float mid = 0.5f * 64.0f * 533.33333333f; float mid = 0.5f * 64.0f * 533.33333333f;
@@ -311,17 +311,17 @@ namespace Game.Collision
return pos; return pos;
} }
public static string getMapFileName(uint mapId) public static string GetMapFileName(uint mapId)
{ {
return $"{mapId:D4}.vmtree"; return $"{mapId:D4}.vmtree";
} }
public void setEnableLineOfSightCalc(bool pVal) { _enableLineOfSightCalc = pVal; } public void SetEnableLineOfSightCalc(bool pVal) { _enableLineOfSightCalc = pVal; }
public void setEnableHeightCalc(bool pVal) { _enableHeightCalc = pVal; } public void SetEnableHeightCalc(bool pVal) { _enableHeightCalc = pVal; }
public bool isLineOfSightCalcEnabled() { return _enableLineOfSightCalc; } public bool IsLineOfSightCalcEnabled() { return _enableLineOfSightCalc; }
public bool isHeightCalcEnabled() { return _enableHeightCalc; } public bool IsHeightCalcEnabled() { return _enableHeightCalc; }
public bool isMapLoadingEnabled() { return _enableLineOfSightCalc || _enableHeightCalc; } public bool IsMapLoadingEnabled() { return _enableLineOfSightCalc || _enableHeightCalc; }
Dictionary<string, ManagedModel> iLoadedModelFiles = new Dictionary<string, ManagedModel>(); Dictionary<string, ManagedModel> iLoadedModelFiles = new Dictionary<string, ManagedModel>();
Dictionary<uint, StaticMapTree> iInstanceMapTrees = new Dictionary<uint, StaticMapTree>(); Dictionary<uint, StaticMapTree> iInstanceMapTrees = new Dictionary<uint, StaticMapTree>();
@@ -341,10 +341,10 @@ namespace Game.Collision
iRefCount = 0; iRefCount = 0;
} }
public void setModel(WorldModel model) { iModel = model; } public void SetModel(WorldModel model) { iModel = model; }
public WorldModel getModel() { return iModel; } public WorldModel GetModel() { return iModel; }
public void incRefCount() { ++iRefCount; } public void IncRefCount() { ++iRefCount; }
public int decRefCount() { return --iRefCount; } public int DecRefCount() { return --iRefCount; }
WorldModel iModel; WorldModel iModel;
int iRefCount; int iRefCount;
+33 -33
View File
@@ -69,9 +69,9 @@ namespace Game.Collision
var magic = reader.ReadStringFromChars(8); var magic = reader.ReadStringFromChars(8);
var node = reader.ReadStringFromChars(4); var node = reader.ReadStringFromChars(4);
if (magic == MapConst.VMapMagic && node == "NODE" && iTree.readFromFile(reader)) if (magic == MapConst.VMapMagic && node == "NODE" && iTree.ReadFromFile(reader))
{ {
iNTreeValues = iTree.primCount(); iNTreeValues = iTree.PrimCount();
iTreeValues = new ModelInstance[iNTreeValues]; iTreeValues = new ModelInstance[iNTreeValues];
success = true; success = true;
} }
@@ -98,9 +98,9 @@ namespace Game.Collision
{ {
foreach (var id in iLoadedSpawns) foreach (var id in iLoadedSpawns)
{ {
iTreeValues[id.Key].setUnloaded(); iTreeValues[id.Key].SetUnloaded();
for (uint refCount = 0; refCount < id.Key; ++refCount) for (uint refCount = 0; refCount < id.Key; ++refCount)
vm.releaseModelInstance(iTreeValues[id.Key].name); vm.ReleaseModelInstance(iTreeValues[id.Key].name);
} }
iLoadedSpawns.Clear(); iLoadedSpawns.Clear();
iLoadedTiles.Clear(); iLoadedTiles.Clear();
@@ -118,7 +118,7 @@ namespace Game.Collision
FileStream stream = OpenMapTileFile(VMapManager.VMapPath, iMapID, tileX, tileY, vm); FileStream stream = OpenMapTileFile(VMapManager.VMapPath, iMapID, tileX, tileY, vm);
if (stream == null) if (stream == null)
{ {
iLoadedTiles[packTileID(tileX, tileY)] = false; iLoadedTiles[PackTileID(tileX, tileY)] = false;
} }
else else
{ {
@@ -133,11 +133,11 @@ namespace Game.Collision
{ {
// read model spawns // read model spawns
ModelSpawn spawn; ModelSpawn spawn;
result = ModelSpawn.readFromFile(reader, out spawn); result = ModelSpawn.ReadFromFile(reader, out spawn);
if (result) if (result)
{ {
// acquire model instance // acquire model instance
WorldModel model = vm.acquireModelInstance(spawn.name, spawn.flags); WorldModel model = vm.AcquireModelInstance(spawn.name, spawn.flags);
if (model == null) if (model == null)
Log.outError(LogFilter.Server, "StaticMapTree.LoadMapTile() : could not acquire WorldModel [{0}, {1}]", tileX, tileY); Log.outError(LogFilter.Server, "StaticMapTree.LoadMapTile() : could not acquire WorldModel [{0}, {1}]", tileX, tileY);
@@ -165,14 +165,14 @@ namespace Game.Collision
} }
} }
} }
iLoadedTiles[packTileID(tileX, tileY)] = true; iLoadedTiles[PackTileID(tileX, tileY)] = true;
} }
return result; return result;
} }
public void UnloadMapTile(uint tileX, uint tileY, VMapManager vm) public void UnloadMapTile(uint tileX, uint tileY, VMapManager vm)
{ {
uint tileID = packTileID(tileX, tileY); uint tileID = PackTileID(tileX, tileY);
var tile = iLoadedTiles.LookupByKey(tileID); var tile = iLoadedTiles.LookupByKey(tileID);
if (!iLoadedTiles.ContainsKey(tileID)) if (!iLoadedTiles.ContainsKey(tileID))
{ {
@@ -195,11 +195,11 @@ namespace Game.Collision
{ {
// read model spawns // read model spawns
ModelSpawn spawn; ModelSpawn spawn;
result = ModelSpawn.readFromFile(reader, out spawn); result = ModelSpawn.ReadFromFile(reader, out spawn);
if (result) if (result)
{ {
// release model instance // release model instance
vm.releaseModelInstance(spawn.name); vm.ReleaseModelInstance(spawn.name);
// update tree // update tree
if (!iSpawnIndices.ContainsKey(spawn.ID)) if (!iSpawnIndices.ContainsKey(spawn.ID))
@@ -211,7 +211,7 @@ namespace Game.Collision
Log.outError(LogFilter.Server, "StaticMapTree.UnloadMapTile() : trying to unload non-referenced model '{0}' (ID:{1})", spawn.name, spawn.ID); Log.outError(LogFilter.Server, "StaticMapTree.UnloadMapTile() : trying to unload non-referenced model '{0}' (ID:{1})", spawn.name, spawn.ID);
else if (--iLoadedSpawns[referencedNode] == 0) else if (--iLoadedSpawns[referencedNode] == 0)
{ {
iTreeValues[referencedNode].setUnloaded(); iTreeValues[referencedNode].SetUnloaded();
iLoadedSpawns.Remove(referencedNode); iLoadedSpawns.Remove(referencedNode);
} }
} }
@@ -224,17 +224,17 @@ namespace Game.Collision
iLoadedTiles.Remove(tileID); iLoadedTiles.Remove(tileID);
} }
static uint packTileID(uint tileX, uint tileY) { return tileX << 16 | tileY; } static uint PackTileID(uint tileX, uint tileY) { return tileX << 16 | tileY; }
static void unpackTileID(uint ID, ref uint tileX, ref uint tileY) { tileX = ID >> 16; tileY = ID & 0xFF; } static void UnpackTileID(uint ID, ref uint tileX, ref uint tileY) { tileX = ID >> 16; tileY = ID & 0xFF; }
static FileStream OpenMapTileFile(string vmapPath, uint mapID, uint tileX, uint tileY, VMapManager vm) static FileStream OpenMapTileFile(string vmapPath, uint mapID, uint tileX, uint tileY, VMapManager vm)
{ {
string tilefile = vmapPath + getTileFileName(mapID, tileX, tileY); string tilefile = vmapPath + GetTileFileName(mapID, tileX, tileY);
if (!File.Exists(tilefile)) if (!File.Exists(tilefile))
{ {
int parentMapId = vm.getParentMapId(mapID); int parentMapId = vm.GetParentMapId(mapID);
if (parentMapId != -1) if (parentMapId != -1)
tilefile = vmapPath + getTileFileName((uint)parentMapId, tileX, tileY); tilefile = vmapPath + GetTileFileName((uint)parentMapId, tileX, tileY);
} }
if (!File.Exists(tilefile)) if (!File.Exists(tilefile))
@@ -245,7 +245,7 @@ namespace Game.Collision
public static LoadResult CanLoadMap(string vmapPath, uint mapID, uint tileX, uint tileY, VMapManager vm) public static LoadResult CanLoadMap(string vmapPath, uint mapID, uint tileX, uint tileY, VMapManager vm)
{ {
string fullname = vmapPath + VMapManager.getMapFileName(mapID); string fullname = vmapPath + VMapManager.GetMapFileName(mapID);
if (!File.Exists(fullname)) if (!File.Exists(fullname))
return LoadResult.FileNotFound; return LoadResult.FileNotFound;
@@ -268,12 +268,12 @@ namespace Game.Collision
return LoadResult.Success; return LoadResult.Success;
} }
public static string getTileFileName(uint mapID, uint tileX, uint tileY) public static string GetTileFileName(uint mapID, uint tileX, uint tileY)
{ {
return $"{mapID:D4}_{tileY:D2}_{tileX:D2}.vmtile"; return $"{mapID:D4}_{tileY:D2}_{tileX:D2}.vmtile";
} }
public bool getAreaInfo(ref Vector3 pos, out uint flags, out int adtId, out int rootId, out int groupId) public bool GetAreaInfo(ref Vector3 pos, out uint flags, out int adtId, out int rootId, out int groupId)
{ {
flags = 0; flags = 0;
adtId = 0; adtId = 0;
@@ -281,7 +281,7 @@ namespace Game.Collision
groupId = 0; groupId = 0;
AreaInfoCallback intersectionCallBack = new AreaInfoCallback(iTreeValues); AreaInfoCallback intersectionCallBack = new AreaInfoCallback(iTreeValues);
iTree.intersectPoint(pos, intersectionCallBack); iTree.IntersectPoint(pos, intersectionCallBack);
if (intersectionCallBack.aInfo.result) if (intersectionCallBack.aInfo.result)
{ {
flags = intersectionCallBack.aInfo.flags; flags = intersectionCallBack.aInfo.flags;
@@ -297,32 +297,32 @@ namespace Game.Collision
public bool GetLocationInfo(Vector3 pos, LocationInfo info) public bool GetLocationInfo(Vector3 pos, LocationInfo info)
{ {
LocationInfoCallback intersectionCallBack = new LocationInfoCallback(iTreeValues, info); LocationInfoCallback intersectionCallBack = new LocationInfoCallback(iTreeValues, info);
iTree.intersectPoint(pos, intersectionCallBack); iTree.IntersectPoint(pos, intersectionCallBack);
return intersectionCallBack.result; return intersectionCallBack.result;
} }
public float getHeight(Vector3 pPos, float maxSearchDist) public float GetHeight(Vector3 pPos, float maxSearchDist)
{ {
float height = float.PositiveInfinity; float height = float.PositiveInfinity;
Vector3 dir = new Vector3(0, 0, -1); Vector3 dir = new Vector3(0, 0, -1);
Ray ray = new Ray(pPos, dir); // direction with length of 1 Ray ray = new Ray(pPos, dir); // direction with length of 1
float maxDist = maxSearchDist; float maxDist = maxSearchDist;
if (getIntersectionTime(ray, ref maxDist, false, ModelIgnoreFlags.Nothing)) if (GetIntersectionTime(ray, ref maxDist, false, ModelIgnoreFlags.Nothing))
height = pPos.Z - maxDist; height = pPos.Z - maxDist;
return height; return height;
} }
bool getIntersectionTime(Ray pRay, ref float pMaxDist, bool pStopAtFirstHit, ModelIgnoreFlags ignoreFlags) bool GetIntersectionTime(Ray pRay, ref float pMaxDist, bool pStopAtFirstHit, ModelIgnoreFlags ignoreFlags)
{ {
float distance = pMaxDist; float distance = pMaxDist;
MapRayCallback intersectionCallBack = new MapRayCallback(iTreeValues, ignoreFlags); MapRayCallback intersectionCallBack = new MapRayCallback(iTreeValues, ignoreFlags);
iTree.intersectRay(pRay, intersectionCallBack, ref distance, pStopAtFirstHit); iTree.IntersectRay(pRay, intersectionCallBack, ref distance, pStopAtFirstHit);
if (intersectionCallBack.didHit()) if (intersectionCallBack.DidHit())
pMaxDist = distance; pMaxDist = distance;
return intersectionCallBack.didHit(); return intersectionCallBack.DidHit();
} }
public bool getObjectHitPos(Vector3 pPos1, Vector3 pPos2, out Vector3 pResultHitPos, float pModifyDist) public bool GetObjectHitPos(Vector3 pPos1, Vector3 pPos2, out Vector3 pResultHitPos, float pModifyDist)
{ {
bool result = false; bool result = false;
float maxDist = (pPos2 - pPos1).magnitude(); float maxDist = (pPos2 - pPos1).magnitude();
@@ -337,7 +337,7 @@ namespace Game.Collision
Vector3 dir = (pPos2 - pPos1) / maxDist; // direction with length of 1 Vector3 dir = (pPos2 - pPos1) / maxDist; // direction with length of 1
Ray ray = new Ray(pPos1, dir); Ray ray = new Ray(pPos1, dir);
float dist = maxDist; float dist = maxDist;
if (getIntersectionTime(ray, ref dist, false, ModelIgnoreFlags.Nothing)) if (GetIntersectionTime(ray, ref dist, false, ModelIgnoreFlags.Nothing))
{ {
pResultHitPos = pPos1 + dir * dist; pResultHitPos = pPos1 + dir * dist;
if (pModifyDist < 0) if (pModifyDist < 0)
@@ -365,7 +365,7 @@ namespace Game.Collision
return result; return result;
} }
public bool isInLineOfSight(Vector3 pos1, Vector3 pos2, ModelIgnoreFlags ignoreFlags) public bool IsInLineOfSight(Vector3 pos1, Vector3 pos2, ModelIgnoreFlags ignoreFlags)
{ {
float maxDist = (pos2 - pos1).magnitude(); float maxDist = (pos2 - pos1).magnitude();
// return false if distance is over max float, in case of cheater teleporting to the end of the universe // return false if distance is over max float, in case of cheater teleporting to the end of the universe
@@ -380,13 +380,13 @@ namespace Game.Collision
return true; return true;
// direction with length of 1 // direction with length of 1
Ray ray = new Ray(pos1, (pos2 - pos1) / maxDist); Ray ray = new Ray(pos1, (pos2 - pos1) / maxDist);
if (getIntersectionTime(ray, ref maxDist, true, ignoreFlags)) if (GetIntersectionTime(ray, ref maxDist, true, ignoreFlags))
return false; return false;
return true; return true;
} }
public int numLoadedTiles() { return iLoadedTiles.Count; } public int NumLoadedTiles() { return iLoadedTiles.Count; }
uint iMapID; uint iMapID;
BIH iTree = new BIH(); BIH iTree = new BIH();
+10 -10
View File
@@ -41,7 +41,7 @@ namespace Game.Collision
public class GameObjectModel : IModel public class GameObjectModel : IModel
{ {
bool initialize(GameObjectModelOwnerBase modelOwner) bool Initialize(GameObjectModelOwnerBase modelOwner)
{ {
var modelData = StaticModelList.models.LookupByKey(modelOwner.GetDisplayId()); var modelData = StaticModelList.models.LookupByKey(modelOwner.GetDisplayId());
if (modelData == null) if (modelData == null)
@@ -55,7 +55,7 @@ namespace Game.Collision
return false; return false;
} }
iModel = Global.VMapMgr.acquireModelInstance(modelData.name); iModel = Global.VMapMgr.AcquireModelInstance(modelData.name);
if (iModel == null) if (iModel == null)
return false; return false;
@@ -82,7 +82,7 @@ namespace Game.Collision
public static GameObjectModel Create(GameObjectModelOwnerBase modelOwner) public static GameObjectModel Create(GameObjectModelOwnerBase modelOwner)
{ {
GameObjectModel mdl = new GameObjectModel(); GameObjectModel mdl = new GameObjectModel();
if (!mdl.initialize(modelOwner)) if (!mdl.Initialize(modelOwner))
return null; return null;
return mdl; return mdl;
@@ -90,7 +90,7 @@ namespace Game.Collision
public override bool IntersectRay(Ray ray, ref float maxDist, bool stopAtFirstHit, PhaseShift phaseShift, ModelIgnoreFlags ignoreFlags) public override bool IntersectRay(Ray ray, ref float maxDist, bool stopAtFirstHit, PhaseShift phaseShift, ModelIgnoreFlags ignoreFlags)
{ {
if (!isCollisionEnabled() || !owner.IsSpawned()) if (!IsCollisionEnabled() || !owner.IsSpawned())
return false; return false;
if (!owner.IsInPhase(phaseShift)) if (!owner.IsInPhase(phaseShift))
@@ -115,7 +115,7 @@ namespace Game.Collision
public override void IntersectPoint(Vector3 point, AreaInfo info, PhaseShift phaseShift) public override void IntersectPoint(Vector3 point, AreaInfo info, PhaseShift phaseShift)
{ {
if (!isCollisionEnabled() || !owner.IsSpawned() || !isMapObject()) if (!IsCollisionEnabled() || !owner.IsSpawned() || !IsMapObject())
return; return;
if (!owner.IsInPhase(phaseShift)) if (!owner.IsInPhase(phaseShift))
@@ -172,12 +172,12 @@ namespace Game.Collision
return true; return true;
} }
public override Vector3 getPosition() { return iPos; } public override Vector3 GetPosition() { return iPos; }
public override AxisAlignedBox getBounds() { return iBound; } public override AxisAlignedBox GetBounds() { return iBound; }
public void enableCollision(bool enable) { _collisionEnabled = enable; } public void EnableCollision(bool enable) { _collisionEnabled = enable; }
bool isCollisionEnabled() { return _collisionEnabled; } bool IsCollisionEnabled() { return _collisionEnabled; }
public bool isMapObject() { return isWmo; } public bool IsMapObject() { return isWmo; }
public static void LoadGameObjectModelList() public static void LoadGameObjectModelList()
{ {
+2 -2
View File
@@ -22,8 +22,8 @@ namespace Game.Collision
{ {
public class IModel public class IModel
{ {
public virtual Vector3 getPosition() { return default; } public virtual Vector3 GetPosition() { return default; }
public virtual AxisAlignedBox getBounds() { return default; } 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; }
@@ -44,7 +44,7 @@ namespace Game.Collision
name = spawn.name; name = spawn.name;
} }
public static bool readFromFile(BinaryReader reader, out ModelSpawn spawn) public static bool ReadFromFile(BinaryReader reader, out ModelSpawn spawn)
{ {
spawn = new ModelSpawn(); spawn = new ModelSpawn();
@@ -94,7 +94,7 @@ namespace Game.Collision
iInvScale = 1.0f / iScale; iInvScale = 1.0f / iScale;
} }
public bool intersectRay(Ray pRay, ref float pMaxDist, bool pStopAtFirstHit, ModelIgnoreFlags ignoreFlags) public bool IntersectRay(Ray pRay, ref float pMaxDist, bool pStopAtFirstHit, ModelIgnoreFlags ignoreFlags)
{ {
if (iModel == null) if (iModel == null)
return false; return false;
@@ -116,7 +116,7 @@ namespace Game.Collision
return hit; return hit;
} }
public void intersectPoint(Vector3 p, AreaInfo info) public void IntersectPoint(Vector3 p, AreaInfo info)
{ {
if (iModel == null) if (iModel == null)
return; return;
@@ -192,7 +192,7 @@ namespace Game.Collision
return false; return false;
} }
public void setUnloaded() { iModel = null; } public void SetUnloaded() { iModel = null; }
Matrix3 iInvRot; Matrix3 iInvRot;
float iInvScale; float iInvScale;
+13 -13
View File
@@ -128,7 +128,7 @@ namespace Game.Collision
return true; return true;
} }
public static WmoLiquid readFromFile(BinaryReader reader) public static WmoLiquid ReadFromFile(BinaryReader reader)
{ {
WmoLiquid liquid = new WmoLiquid(); WmoLiquid liquid = new WmoLiquid();
@@ -193,13 +193,13 @@ namespace Game.Collision
iLiquid = null; iLiquid = null;
} }
void setLiquidData(WmoLiquid liquid) void SetLiquidData(WmoLiquid liquid)
{ {
iLiquid = liquid; iLiquid = liquid;
liquid = null; liquid = null;
} }
public bool readFromFile(BinaryReader reader) public bool ReadFromFile(BinaryReader reader)
{ {
triangles.Clear(); triangles.Clear();
vertices.Clear(); vertices.Clear();
@@ -237,7 +237,7 @@ namespace Game.Collision
if (reader.ReadStringFromChars(4) != "MBIH") if (reader.ReadStringFromChars(4) != "MBIH")
return false; return false;
meshTree.readFromFile(reader); meshTree.ReadFromFile(reader);
// write liquid data // write liquid data
if (reader.ReadStringFromChars(4) != "LIQU") if (reader.ReadStringFromChars(4) != "LIQU")
@@ -245,7 +245,7 @@ namespace Game.Collision
chunkSize = reader.ReadUInt32(); chunkSize = reader.ReadUInt32();
if (chunkSize > 0) if (chunkSize > 0)
iLiquid = WmoLiquid.readFromFile(reader); iLiquid = WmoLiquid.ReadFromFile(reader);
return true; return true;
} }
@@ -256,7 +256,7 @@ namespace Game.Collision
return false; return false;
GModelRayCallback callback = new GModelRayCallback(triangles, vertices); GModelRayCallback callback = new GModelRayCallback(triangles, vertices);
meshTree.intersectRay(ray, callback, ref distance, stopAtFirstHit); meshTree.IntersectRay(ray, callback, ref distance, stopAtFirstHit);
return callback.hit; return callback.hit;
} }
@@ -290,7 +290,7 @@ namespace Game.Collision
return 0; return 0;
} }
public override AxisAlignedBox getBounds() { return iBound; } public override AxisAlignedBox GetBounds() { return iBound; }
public uint GetMogpFlags() { return iMogpFlags; } public uint GetMogpFlags() { return iMogpFlags; }
@@ -328,7 +328,7 @@ namespace Game.Collision
return groupModels[0].IntersectRay(ray, ref distance, stopAtFirstHit); return groupModels[0].IntersectRay(ray, ref distance, stopAtFirstHit);
WModelRayCallBack isc = new WModelRayCallBack(groupModels); WModelRayCallBack isc = new WModelRayCallBack(groupModels);
groupTree.intersectRay(ray, isc, ref distance, stopAtFirstHit); groupTree.IntersectRay(ray, isc, ref distance, stopAtFirstHit);
return isc.hit; return isc.hit;
} }
@@ -339,7 +339,7 @@ namespace Game.Collision
return false; return false;
WModelAreaCallback callback = new WModelAreaCallback(groupModels, down); WModelAreaCallback callback = new WModelAreaCallback(groupModels, down);
groupTree.intersectPoint(p, callback); groupTree.IntersectPoint(p, callback);
if (callback.hit != null) if (callback.hit != null)
{ {
info.rootId = (int)RootWMOID; info.rootId = (int)RootWMOID;
@@ -359,7 +359,7 @@ namespace Game.Collision
return false; return false;
WModelAreaCallback callback = new WModelAreaCallback(groupModels, down); WModelAreaCallback callback = new WModelAreaCallback(groupModels, down);
groupTree.intersectPoint(p, callback); groupTree.IntersectPoint(p, callback);
if (callback.hit != null) if (callback.hit != null)
{ {
info.hitModel = callback.hit; info.hitModel = callback.hit;
@@ -369,7 +369,7 @@ namespace Game.Collision
return false; return false;
} }
public bool readFile(string filename) public bool ReadFile(string filename)
{ {
if (!File.Exists(filename)) if (!File.Exists(filename))
{ {
@@ -397,7 +397,7 @@ namespace Game.Collision
for (var i = 0; i < count; ++i) for (var i = 0; i < count; ++i)
{ {
GroupModel group = new GroupModel(); GroupModel group = new GroupModel();
group.readFromFile(reader); group.ReadFromFile(reader);
groupModels.Add(group); groupModels.Add(group);
} }
@@ -405,7 +405,7 @@ namespace Game.Collision
if (reader.ReadStringFromChars(4) != "GBIH") if (reader.ReadStringFromChars(4) != "GBIH")
return false; return false;
return groupTree.readFromFile(reader); return groupTree.ReadFromFile(reader);
} }
} }
+24 -24
View File
@@ -33,29 +33,29 @@ namespace Game.Collision
nodes[x] = new Node[CELL_NUMBER]; nodes[x] = new Node[CELL_NUMBER];
} }
public virtual void insert(T value) public virtual void Insert(T value)
{ {
AxisAlignedBox bounds = value.getBounds(); AxisAlignedBox bounds = value.GetBounds();
Cell low = Cell.ComputeCell(bounds.Lo.X, bounds.Lo.Y); Cell low = Cell.ComputeCell(bounds.Lo.X, bounds.Lo.Y);
Cell high = Cell.ComputeCell(bounds.Hi.X, bounds.Hi.Y); Cell high = Cell.ComputeCell(bounds.Hi.X, bounds.Hi.Y);
for (int x = low.x; x <= high.x; ++x) for (int x = low.x; x <= high.x; ++x)
{ {
for (int y = low.y; y <= high.y; ++y) for (int y = low.y; y <= high.y; ++y)
{ {
Node node = getGrid(x, y); Node node = GetGrid(x, y);
node.insert(value); node.Insert(value);
memberTable.Add(value, node); memberTable.Add(value, node);
} }
} }
} }
public virtual void remove(T value) public virtual void Remove(T value)
{ {
// Remove the member // Remove the member
memberTable.Remove(value); memberTable.Remove(value);
} }
public virtual void balance() public virtual void Balance()
{ {
for (int x = 0; x < CELL_NUMBER; ++x) for (int x = 0; x < CELL_NUMBER; ++x)
{ {
@@ -63,13 +63,13 @@ namespace Game.Collision
{ {
Node n = nodes[x][y]; Node n = nodes[x][y];
if (n != null) if (n != null)
n.balance(); n.Balance();
} }
} }
} }
public bool contains(T value) { return memberTable.ContainsKey(value); } public bool Contains(T value) { return memberTable.ContainsKey(value); }
public bool empty() { return memberTable.Empty(); } public bool Empty() { return memberTable.Empty(); }
public struct Cell public struct Cell
{ {
@@ -95,10 +95,10 @@ namespace Game.Collision
return c; return c;
} }
public bool isValid() { return x >= 0 && x < CELL_NUMBER && y >= 0 && y < CELL_NUMBER; } public bool IsValid() { return x >= 0 && x < CELL_NUMBER && y >= 0 && y < CELL_NUMBER; }
} }
Node getGrid(int x, int y) Node GetGrid(int x, int y)
{ {
Cypher.Assert(x < CELL_NUMBER && y < CELL_NUMBER); Cypher.Assert(x < CELL_NUMBER && y < CELL_NUMBER);
if (nodes[x][y] == null) if (nodes[x][y] == null)
@@ -106,15 +106,15 @@ namespace Game.Collision
return nodes[x][y]; return nodes[x][y];
} }
public void intersectRay(Ray ray, WorkerCallback intersectCallback, ref float max_dist) public void IntersectRay(Ray ray, WorkerCallback intersectCallback, ref float max_dist)
{ {
intersectRay(ray, intersectCallback, ref max_dist, ray.Origin + ray.Direction * max_dist); IntersectRay(ray, intersectCallback, ref max_dist, ray.Origin + ray.Direction * max_dist);
} }
public void intersectRay(Ray ray, WorkerCallback intersectCallback, ref float max_dist, Vector3 end) public void IntersectRay(Ray ray, WorkerCallback intersectCallback, ref float max_dist, Vector3 end)
{ {
Cell cell = Cell.ComputeCell(ray.Origin.X, ray.Origin.Y); Cell cell = Cell.ComputeCell(ray.Origin.X, ray.Origin.Y);
if (!cell.isValid()) if (!cell.IsValid())
return; return;
Cell last_cell = Cell.ComputeCell(end.X, end.Y); Cell last_cell = Cell.ComputeCell(end.X, end.Y);
@@ -123,7 +123,7 @@ namespace Game.Collision
{ {
Node node = nodes[cell.x][cell.y]; Node node = nodes[cell.x][cell.y];
if (node != null) if (node != null)
node.intersectRay(ray, intersectCallback, ref max_dist); node.IntersectRay(ray, intersectCallback, ref max_dist);
return; return;
} }
@@ -166,7 +166,7 @@ namespace Game.Collision
Node node = nodes[cell.x][cell.y]; Node node = nodes[cell.x][cell.y];
if (node != null) if (node != null)
{ {
node.intersectRay(ray, intersectCallback, ref max_dist); node.IntersectRay(ray, intersectCallback, ref max_dist);
} }
if (cell == last_cell) if (cell == last_cell)
break; break;
@@ -180,30 +180,30 @@ namespace Game.Collision
tMaxY += tDeltaY; tMaxY += tDeltaY;
cell.y += stepY; cell.y += stepY;
} }
} while (cell.isValid()); } while (cell.IsValid());
} }
public void intersectPoint(Vector3 point, WorkerCallback intersectCallback) public void IntersectPoint(Vector3 point, WorkerCallback intersectCallback)
{ {
Cell cell = Cell.ComputeCell(point.X, point.Y); Cell cell = Cell.ComputeCell(point.X, point.Y);
if (!cell.isValid()) if (!cell.IsValid())
return; return;
Node node = nodes[cell.x][cell.y]; Node node = nodes[cell.x][cell.y];
if (node != null) if (node != null)
node.intersectPoint(point, intersectCallback); node.IntersectPoint(point, intersectCallback);
} }
// Optimized verson of intersectRay function for rays with vertical directions // Optimized verson of intersectRay function for rays with vertical directions
public void intersectZAllignedRay(Ray ray, WorkerCallback intersectCallback, ref float max_dist) public void IntersectZAllignedRay(Ray ray, WorkerCallback intersectCallback, ref float max_dist)
{ {
Cell cell = Cell.ComputeCell(ray.Origin.X, ray.Origin.Y); Cell cell = Cell.ComputeCell(ray.Origin.X, ray.Origin.Y);
if (!cell.isValid()) if (!cell.IsValid())
return; return;
Node node = nodes[cell.x][cell.y]; Node node = nodes[cell.x][cell.y];
if (node != null) if (node != null)
node.intersectRay(ray, intersectCallback, ref max_dist); node.IntersectRay(ray, intersectCallback, ref max_dist);
} }
MultiMap<T, Node> memberTable = new MultiMap<T, Node>(); MultiMap<T, Node> memberTable = new MultiMap<T, Node>();
+9 -9
View File
@@ -25,16 +25,16 @@ namespace Game.Combat
{ {
iType = pType; iType = pType;
} }
public UnitEventTypes getType() public UnitEventTypes GetEventType()
{ {
return iType; return iType;
} }
bool matchesTypeMask(uint pMask) bool MatchesTypeMask(uint pMask)
{ {
return Convert.ToBoolean((uint)iType & pMask); return Convert.ToBoolean((uint)iType & pMask);
} }
void setType(UnitEventTypes pType) void SetEventType(UnitEventTypes pType)
{ {
iType = pType; iType = pType;
} }
@@ -67,32 +67,32 @@ namespace Game.Combat
iBValue = pValue; iBValue = pValue;
} }
public float getFValue() public float GetFValue()
{ {
return iFValue; return iFValue;
} }
bool getBValue() bool GetBValue()
{ {
return iBValue; return iBValue;
} }
void setBValue(bool pValue) void SetBValue(bool pValue)
{ {
iBValue = pValue; iBValue = pValue;
} }
public HostileReference getReference() public HostileReference GetReference()
{ {
return iHostileReference; return iHostileReference;
} }
public void setThreatManager(ThreatManager pThreatManager) public void SetThreatManager(ThreatManager pThreatManager)
{ {
iThreatManager = pThreatManager; iThreatManager = pThreatManager;
} }
ThreatManager getThreatManager() ThreatManager GetThreatManager()
{ {
return iThreatManager; return iThreatManager;
} }
+107 -107
View File
@@ -31,130 +31,130 @@ namespace Game.Combat
Owner = owner; Owner = owner;
} }
Unit getOwner() { return Owner; } Unit GetOwner() { return Owner; }
// send threat to all my haters for the victim // send threat to all my haters for the victim
// The victim is then hated by them as well // The victim is then hated by them as well
// use for buffs and healing threat functionality // use for buffs and healing threat functionality
public void threatAssist(Unit victim, float baseThreat, SpellInfo threatSpell = null) public void ThreatAssist(Unit victim, float baseThreat, SpellInfo threatSpell = null)
{ {
float threat = ThreatManager.calcThreat(victim, Owner, baseThreat, (threatSpell != null ? threatSpell.GetSchoolMask() : SpellSchoolMask.Normal), threatSpell); float threat = ThreatManager.CalcThreat(victim, Owner, baseThreat, (threatSpell != null ? threatSpell.GetSchoolMask() : SpellSchoolMask.Normal), threatSpell);
threat /= GetSize(); threat /= GetSize();
HostileReference refe = getFirst(); HostileReference refe = GetFirst();
while (refe != null) while (refe != null)
{ {
if (ThreatManager.isValidProcess(victim, refe.GetSource().GetOwner(), threatSpell)) if (ThreatManager.IsValidProcess(victim, refe.GetSource().GetOwner(), threatSpell))
refe.GetSource().doAddThreat(victim, threat); refe.GetSource().DoAddThreat(victim, threat);
refe = refe.next(); refe = refe.Next();
} }
} }
public void addTempThreat(float threat, bool apply) public void AddTempThreat(float threat, bool apply)
{ {
HostileReference refe = getFirst(); HostileReference refe = GetFirst();
while (refe != null) while (refe != null)
{ {
if (apply) if (apply)
{ {
if (refe.getTempThreatModifier() == 0.0f) if (refe.GetTempThreatModifier() == 0.0f)
refe.addTempThreat(threat); refe.AddTempThreat(threat);
} }
else else
refe.resetTempThreat(); refe.ResetTempThreat();
refe = refe.next(); refe = refe.Next();
} }
} }
void addThreatPercent(int percent) void AddThreatPercent(int percent)
{ {
HostileReference refe = getFirst(); HostileReference refe = GetFirst();
while (refe != null) while (refe != null)
{ {
refe.addThreatPercent(percent); refe.AddThreatPercent(percent);
refe = refe.next(); refe = refe.Next();
} }
} }
// The references are not needed anymore // The references are not needed anymore
// tell the source to remove them from the list and free the mem // tell the source to remove them from the list and free the mem
public void deleteReferences() public void DeleteReferences()
{ {
HostileReference refe = getFirst(); HostileReference refe = GetFirst();
while (refe != null) while (refe != null)
{ {
HostileReference nextRef = refe.next(); HostileReference nextRef = refe.Next();
refe.removeReference(); refe.RemoveReference();
refe = nextRef; refe = nextRef;
} }
} }
// Remove specific faction references // Remove specific faction references
public void deleteReferencesForFaction(uint faction) public void DeleteReferencesForFaction(uint faction)
{ {
HostileReference refe = getFirst(); HostileReference refe = GetFirst();
while (refe != null) while (refe != null)
{ {
HostileReference nextRef = refe.next(); HostileReference nextRef = refe.Next();
if (refe.GetSource().GetOwner().GetFactionTemplateEntry().Faction == faction) if (refe.GetSource().GetOwner().GetFactionTemplateEntry().Faction == faction)
{ {
refe.removeReference(); refe.RemoveReference();
} }
refe = nextRef; refe = nextRef;
} }
} }
// delete all references out of specified range // delete all references out of specified range
public void deleteReferencesOutOfRange(float range) public void DeleteReferencesOutOfRange(float range)
{ {
HostileReference refe = getFirst(); HostileReference refe = GetFirst();
range = range * range; range = range * range;
while (refe != null) while (refe != null)
{ {
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();
} }
refe = nextRef; refe = nextRef;
} }
} }
public new HostileReference getFirst() { return ((HostileReference)base.getFirst()); } public new HostileReference GetFirst() { return (HostileReference)base.GetFirst(); }
public void updateThreatTables() public void UpdateThreatTables()
{ {
HostileReference refe = getFirst(); HostileReference refe = GetFirst();
while (refe != null) while (refe != null)
{ {
refe.updateOnlineStatus(); refe.UpdateOnlineStatus();
refe = refe.next(); refe = refe.Next();
} }
} }
public void setOnlineOfflineState(bool isOnline) public void SetOnlineOfflineState(bool isOnline)
{ {
HostileReference refe = getFirst(); HostileReference refe = GetFirst();
while (refe != null) while (refe != null)
{ {
refe.setOnlineOfflineState(isOnline); refe.SetOnlineOfflineState(isOnline);
refe = refe.next(); refe = refe.Next();
} }
} }
// set state for one reference, defined by Unit // set state for one reference, defined by Unit
public void setOnlineOfflineState(Unit creature, bool isOnline) public void SetOnlineOfflineState(Unit creature, bool isOnline)
{ {
HostileReference refe = getFirst(); HostileReference refe = GetFirst();
while (refe != null) while (refe != null)
{ {
HostileReference nextRef = refe.next(); HostileReference nextRef = refe.Next();
if (refe.GetSource().GetOwner() == creature) if (refe.GetSource().GetOwner() == creature)
{ {
refe.setOnlineOfflineState(isOnline); refe.SetOnlineOfflineState(isOnline);
break; break;
} }
refe = nextRef; refe = nextRef;
@@ -162,15 +162,15 @@ namespace Game.Combat
} }
// delete one reference, defined by Unit // delete one reference, defined by Unit
public void deleteReference(Unit creature) public void DeleteReference(Unit creature)
{ {
HostileReference refe = getFirst(); HostileReference refe = GetFirst();
while (refe != null) while (refe != null)
{ {
HostileReference nextRef = refe.next(); HostileReference nextRef = refe.Next();
if (refe.GetSource().GetOwner() == creature) if (refe.GetSource().GetOwner() == creature)
{ {
refe.removeReference(); refe.RemoveReference();
break; break;
} }
refe = nextRef; refe = nextRef;
@@ -179,14 +179,14 @@ namespace Game.Combat
public void UpdateVisibility() public void UpdateVisibility()
{ {
HostileReference refe = getFirst(); HostileReference refe = GetFirst();
while (refe != null) while (refe != null)
{ {
HostileReference nextRef = refe.next(); HostileReference nextRef = refe.Next();
if (!refe.GetSource().GetOwner().CanSeeOrDetect(getOwner())) if (!refe.GetSource().GetOwner().CanSeeOrDetect(GetOwner()))
{ {
nextRef = refe.next(); nextRef = refe.Next();
refe.removeReference(); refe.RemoveReference();
} }
refe = nextRef; refe = nextRef;
} }
@@ -199,32 +199,32 @@ namespace Game.Combat
{ {
iThreat = threat; iThreat = threat;
iTempThreatModifier = 0.0f; iTempThreatModifier = 0.0f;
link(refUnit, threatManager); Link(refUnit, threatManager);
iUnitGuid = refUnit.GetGUID(); iUnitGuid = refUnit.GetGUID();
iOnline = true; iOnline = true;
iAccessible = true; iAccessible = true;
} }
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()
{ {
setOnlineOfflineState(false); SetOnlineOfflineState(false);
} }
void fireStatusChanged(ThreatRefStatusChangeEvent threatRefStatusChangeEvent) void FireStatusChanged(ThreatRefStatusChangeEvent threatRefStatusChangeEvent)
{ {
if (GetSource() != null) if (GetSource() != null)
GetSource().processThreatEvent(threatRefStatusChangeEvent); GetSource().ProcessThreatEvent(threatRefStatusChangeEvent);
} }
public void addThreat(float modThreat) public void AddThreat(float modThreat)
{ {
if (modThreat == 0.0f) if (modThreat == 0.0f)
return; return;
@@ -233,131 +233,131 @@ namespace Game.Combat
// the threat is changed. Source and target unit have to be available // the threat is changed. Source and target unit have to be available
// if the link was cut before relink it again // if the link was cut before relink it again
if (!isOnline()) if (!IsOnline())
updateOnlineStatus(); UpdateOnlineStatus();
ThreatRefStatusChangeEvent Event = new ThreatRefStatusChangeEvent(UnitEventTypes.ThreatRefThreatChange, this, modThreat); ThreatRefStatusChangeEvent Event = new ThreatRefStatusChangeEvent(UnitEventTypes.ThreatRefThreatChange, this, modThreat);
fireStatusChanged(Event); FireStatusChanged(Event);
if (isValid() && modThreat > 0.0f) if (IsValid() && modThreat > 0.0f)
{ {
Unit victimOwner = getTarget().GetCharmerOrOwner(); Unit victimOwner = GetTarget().GetCharmerOrOwner();
if (victimOwner != null && victimOwner.IsAlive()) if (victimOwner != null && victimOwner.IsAlive())
GetSource().addThreat(victimOwner, 0.0f); // create a threat to the owner of a pet, if the pet attacks GetSource().AddThreat(victimOwner, 0.0f); // create a threat to the owner of a pet, if the pet attacks
} }
} }
public void addThreatPercent(int percent) public void AddThreatPercent(int percent)
{ {
addThreat(MathFunctions.CalculatePct(iThreat, percent)); AddThreat(MathFunctions.CalculatePct(iThreat, percent));
} }
// check, if source can reach target and set the status // check, if source can reach target and set the status
public void updateOnlineStatus() public void UpdateOnlineStatus()
{ {
bool online = false; bool online = false;
bool accessible = false; bool accessible = false;
if (!isValid()) if (!IsValid())
{ {
Unit target = Global.ObjAccessor.GetUnit(getSourceUnit(), getUnitGuid()); Unit target = Global.ObjAccessor.GetUnit(GetSourceUnit(), GetUnitGuid());
if (target != null) if (target != null)
link(target, GetSource()); Link(target, GetSource());
} }
// only check for online status if // only check for online status if
// ref is valid // ref is valid
// target is no player or not gamemaster // target is no player or not gamemaster
// target is not in flight // target is not in flight
if (isValid() if (IsValid()
&& (getTarget().IsTypeId(TypeId.Player) || !getTarget().ToPlayer().IsGameMaster()) && (GetTarget().IsTypeId(TypeId.Player) || !GetTarget().ToPlayer().IsGameMaster())
&& !getTarget().HasUnitState(UnitState.InFlight) && !GetTarget().HasUnitState(UnitState.InFlight)
&& getTarget().IsInMap(getSourceUnit()) && GetTarget().IsInMap(GetSourceUnit())
&& getTarget().IsInPhase(getSourceUnit()) && GetTarget().IsInPhase(GetSourceUnit())
) )
{ {
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))
online = true; // not accessible but stays online online = true; // not accessible but stays online
} }
else else
accessible = true; accessible = true;
} }
setAccessibleState(accessible); SetAccessibleState(accessible);
setOnlineOfflineState(online); SetOnlineOfflineState(online);
} }
public void setOnlineOfflineState(bool isOnline) public void SetOnlineOfflineState(bool isOnline)
{ {
if (iOnline != isOnline) if (iOnline != isOnline)
{ {
iOnline = isOnline; iOnline = isOnline;
if (!iOnline) if (!iOnline)
setAccessibleState(false); // if not online that not accessable as well SetAccessibleState(false); // if not online that not accessable as well
ThreatRefStatusChangeEvent Event = new ThreatRefStatusChangeEvent(UnitEventTypes.ThreatRefOnlineStatus, this); ThreatRefStatusChangeEvent Event = new ThreatRefStatusChangeEvent(UnitEventTypes.ThreatRefOnlineStatus, this);
fireStatusChanged(Event); FireStatusChanged(Event);
} }
} }
void setAccessibleState(bool isAccessible) void SetAccessibleState(bool isAccessible)
{ {
if (iAccessible != isAccessible) if (iAccessible != isAccessible)
{ {
iAccessible = isAccessible; iAccessible = isAccessible;
ThreatRefStatusChangeEvent Event = new ThreatRefStatusChangeEvent(UnitEventTypes.ThreatRefAccessibleStatus, this); ThreatRefStatusChangeEvent Event = new ThreatRefStatusChangeEvent(UnitEventTypes.ThreatRefAccessibleStatus, this);
fireStatusChanged(Event); FireStatusChanged(Event);
} }
} }
// reference is not needed anymore. realy delete it ! // reference is not needed anymore. realy delete it !
public void removeReference() public void RemoveReference()
{ {
invalidate(); Invalidate();
ThreatRefStatusChangeEvent Event = new ThreatRefStatusChangeEvent(UnitEventTypes.ThreatRefRemoveFromList, this); ThreatRefStatusChangeEvent Event = new ThreatRefStatusChangeEvent(UnitEventTypes.ThreatRefRemoveFromList, this);
fireStatusChanged(Event); FireStatusChanged(Event);
} }
Unit getSourceUnit() Unit GetSourceUnit()
{ {
return GetSource().GetOwner(); return GetSource().GetOwner();
} }
public void setThreat(float threat) public void SetThreat(float threat)
{ {
addThreat(threat - iThreat); AddThreat(threat - iThreat);
} }
public float getThreat() public float GetThreat()
{ {
return iThreat + iTempThreatModifier; return iThreat + iTempThreatModifier;
} }
public bool isOnline() public bool IsOnline()
{ {
return iOnline; return iOnline;
} }
// The Unit might be in water and the creature can not enter the water, but has range attack // The Unit might be in water and the creature can not enter the water, but has range attack
// in this case online = true, but accessible = false // in this case online = true, but accessible = false
bool isAccessible() bool IsAccessible()
{ {
return iAccessible; return iAccessible;
} }
// used for temporary setting a threat and reducing it later again. // used for temporary setting a threat and reducing it later again.
// the threat modification is stored // the threat modification is stored
public void setTempThreat(float threat) public void SetTempThreat(float threat)
{ {
addTempThreat(threat - iTempThreatModifier); AddTempThreat(threat - iTempThreatModifier);
} }
public void addTempThreat(float threat) public void AddTempThreat(float threat)
{ {
if (threat == 0.0f) if (threat == 0.0f)
return; return;
@@ -365,25 +365,25 @@ namespace Game.Combat
iTempThreatModifier += threat; iTempThreatModifier += threat;
ThreatRefStatusChangeEvent Event = new ThreatRefStatusChangeEvent(UnitEventTypes.ThreatRefThreatChange, this, threat); ThreatRefStatusChangeEvent Event = new ThreatRefStatusChangeEvent(UnitEventTypes.ThreatRefThreatChange, this, threat);
fireStatusChanged(Event); FireStatusChanged(Event);
} }
public void resetTempThreat() public void ResetTempThreat()
{ {
addTempThreat(-iTempThreatModifier); AddTempThreat(-iTempThreatModifier);
} }
public float getTempThreatModifier() public float GetTempThreatModifier()
{ {
return iTempThreatModifier; return iTempThreatModifier;
} }
public ObjectGuid getUnitGuid() public ObjectGuid GetUnitGuid()
{ {
return iUnitGuid; return iUnitGuid;
} }
public new HostileReference next() { return (HostileReference)base.next(); } public new HostileReference Next() { return (HostileReference)base.Next(); }
float iThreat; float iThreat;
float iTempThreatModifier; // used for SPELL_AURA_MOD_TOTAL_THREAT float iTempThreatModifier; // used for SPELL_AURA_MOD_TOTAL_THREAT
+103 -103
View File
@@ -36,23 +36,23 @@ namespace Game.Combat
const int ThreatUpdateInternal = 1 * Time.InMilliseconds; const int ThreatUpdateInternal = 1 * Time.InMilliseconds;
public void clearReferences() public void ClearReferences()
{ {
threatContainer.clearReferences(); threatContainer.ClearReferences();
threatOfflineContainer.clearReferences(); threatOfflineContainer.ClearReferences();
currentVictim = null; currentVictim = null;
updateTimer = ThreatUpdateInternal; updateTimer = ThreatUpdateInternal;
} }
public void addThreat(Unit victim, float threat, SpellSchoolMask schoolMask = SpellSchoolMask.Normal, SpellInfo threatSpell = null) public void AddThreat(Unit victim, float threat, SpellSchoolMask schoolMask = SpellSchoolMask.Normal, SpellInfo threatSpell = null)
{ {
if (!isValidProcess(victim, Owner, threatSpell)) if (!IsValidProcess(victim, Owner, threatSpell))
return; return;
doAddThreat(victim, calcThreat(victim, Owner, threat, schoolMask, threatSpell)); DoAddThreat(victim, CalcThreat(victim, Owner, threat, schoolMask, threatSpell));
} }
public void doAddThreat(Unit victim, float threat) public void DoAddThreat(Unit victim, float threat)
{ {
uint redirectThreadPct = victim.GetRedirectThreatPercent(); uint redirectThreadPct = victim.GetRedirectThreatPercent();
Unit redirectTarget = victim.GetRedirectThreatTarget(); Unit redirectTarget = victim.GetRedirectThreatTarget();
@@ -81,78 +81,78 @@ namespace Game.Combat
{ {
float redirectThreat = MathFunctions.CalculatePct(threat, redirectThreadPct); float redirectThreat = MathFunctions.CalculatePct(threat, redirectThreadPct);
threat -= redirectThreat; threat -= redirectThreat;
if (isValidProcess(redirectTarget, GetOwner())) if (IsValidProcess(redirectTarget, GetOwner()))
_addThreat(redirectTarget, redirectThreat); AddThreat(redirectTarget, redirectThreat);
} }
} }
_addThreat(victim, threat); AddThreat(victim, threat);
} }
void _addThreat(Unit victim, float threat) void AddThreat(Unit victim, float threat)
{ {
var reff = threatContainer.addThreat(victim, threat); var reff = threatContainer.AddThreat(victim, threat);
// Ref is not in the online refs, search the offline refs next // Ref is not in the online refs, search the offline refs next
if (reff == null) if (reff == null)
reff = threatOfflineContainer.addThreat(victim, threat); reff = threatOfflineContainer.AddThreat(victim, threat);
if (reff == null) // there was no ref => create a new one if (reff == null) // there was no ref => create a new one
{ {
bool isFirst = threatContainer.empty(); bool isFirst = threatContainer.Empty();
// threat has to be 0 here // threat has to be 0 here
var hostileRef = new HostileReference(victim, this, 0); var hostileRef = new HostileReference(victim, this, 0);
threatContainer.addReference(hostileRef); threatContainer.AddReference(hostileRef);
hostileRef.addThreat(threat); // now we add the real threat hostileRef.AddThreat(threat); // now we add the real threat
if (victim.IsTypeId(TypeId.Player) && victim.ToPlayer().IsGameMaster()) if (victim.IsTypeId(TypeId.Player) && victim.ToPlayer().IsGameMaster())
hostileRef.setOnlineOfflineState(false); // GM is always offline hostileRef.SetOnlineOfflineState(false); // GM is always offline
else if (isFirst) else if (isFirst)
setCurrentVictim(hostileRef); SetCurrentVictim(hostileRef);
} }
} }
public void modifyThreatPercent(Unit victim, int percent) public void ModifyThreatPercent(Unit victim, int percent)
{ {
threatContainer.modifyThreatPercent(victim, percent); threatContainer.ModifyThreatPercent(victim, percent);
} }
public Unit getHostilTarget() public Unit GetHostilTarget()
{ {
threatContainer.update(); threatContainer.Update();
HostileReference nextVictim = threatContainer.selectNextVictim(GetOwner().ToCreature(), getCurrentVictim()); HostileReference nextVictim = threatContainer.SelectNextVictim(GetOwner().ToCreature(), GetCurrentVictim());
setCurrentVictim(nextVictim); SetCurrentVictim(nextVictim);
return getCurrentVictim() != null ? getCurrentVictim().getTarget() : null; return GetCurrentVictim() != null ? GetCurrentVictim().GetTarget() : null;
} }
public float getThreat(Unit victim, bool alsoSearchOfflineList = false) public float GetThreat(Unit victim, bool alsoSearchOfflineList = false)
{ {
float threat = 0.0f; float threat = 0.0f;
HostileReference refe = threatContainer.getReferenceByTarget(victim); HostileReference refe = threatContainer.GetReferenceByTarget(victim);
if (refe == null && alsoSearchOfflineList) if (refe == null && alsoSearchOfflineList)
refe = threatOfflineContainer.getReferenceByTarget(victim); refe = threatOfflineContainer.GetReferenceByTarget(victim);
if (refe != null) if (refe != null)
threat = refe.getThreat(); threat = refe.GetThreat();
return threat; return threat;
} }
void tauntApply(Unit taunter) void TauntApply(Unit taunter)
{ {
HostileReference refe = threatContainer.getReferenceByTarget(taunter); HostileReference refe = threatContainer.GetReferenceByTarget(taunter);
if (getCurrentVictim() != null && refe != null && (refe.getThreat() < getCurrentVictim().getThreat())) if (GetCurrentVictim() != null && refe != null && (refe.GetThreat() < GetCurrentVictim().GetThreat()))
{ {
if (refe.getTempThreatModifier() == 0.0f) // Ok, temp threat is unused if (refe.GetTempThreatModifier() == 0.0f) // Ok, temp threat is unused
refe.setTempThreat(getCurrentVictim().getThreat()); refe.SetTempThreat(GetCurrentVictim().GetThreat());
} }
} }
void tauntFadeOut(Unit taunter) void TauntFadeOut(Unit taunter)
{ {
HostileReference refe = threatContainer.getReferenceByTarget(taunter); HostileReference refe = threatContainer.GetReferenceByTarget(taunter);
if (refe != null) if (refe != null)
refe.resetTempThreat(); refe.ResetTempThreat();
} }
public void setCurrentVictim(HostileReference pHostileReference) public void SetCurrentVictim(HostileReference pHostileReference)
{ {
if (pHostileReference != null && pHostileReference != currentVictim) if (pHostileReference != null && pHostileReference != currentVictim)
{ {
@@ -161,58 +161,58 @@ namespace Game.Combat
currentVictim = pHostileReference; currentVictim = pHostileReference;
} }
public void processThreatEvent(ThreatRefStatusChangeEvent threatRefStatusChangeEvent) public void ProcessThreatEvent(ThreatRefStatusChangeEvent threatRefStatusChangeEvent)
{ {
threatRefStatusChangeEvent.setThreatManager(this); // now we can set the threat manager threatRefStatusChangeEvent.SetThreatManager(this); // now we can set the threat manager
HostileReference hostilRef = threatRefStatusChangeEvent.getReference(); HostileReference hostilRef = threatRefStatusChangeEvent.GetReference();
switch (threatRefStatusChangeEvent.getType()) switch (threatRefStatusChangeEvent.GetEventType())
{ {
case UnitEventTypes.ThreatRefThreatChange: case UnitEventTypes.ThreatRefThreatChange:
if ((getCurrentVictim() == hostilRef && threatRefStatusChangeEvent.getFValue() < 0.0f) || if ((GetCurrentVictim() == hostilRef && threatRefStatusChangeEvent.GetFValue() < 0.0f) ||
(getCurrentVictim() != hostilRef && threatRefStatusChangeEvent.getFValue() > 0.0f)) (GetCurrentVictim() != hostilRef && threatRefStatusChangeEvent.GetFValue() > 0.0f))
setDirty(true); // the order in the threat list might have changed SetDirty(true); // the order in the threat list might have changed
break; break;
case UnitEventTypes.ThreatRefOnlineStatus: case UnitEventTypes.ThreatRefOnlineStatus:
if (!hostilRef.isOnline()) if (!hostilRef.IsOnline())
{ {
if (hostilRef == getCurrentVictim()) if (hostilRef == GetCurrentVictim())
{ {
setCurrentVictim(null); SetCurrentVictim(null);
setDirty(true); SetDirty(true);
} }
Owner.SendRemoveFromThreatList(hostilRef); Owner.SendRemoveFromThreatList(hostilRef);
threatContainer.remove(hostilRef); threatContainer.Remove(hostilRef);
threatOfflineContainer.addReference(hostilRef); threatOfflineContainer.AddReference(hostilRef);
} }
else else
{ {
if (getCurrentVictim() != null && hostilRef.getThreat() > (1.1f * getCurrentVictim().getThreat())) if (GetCurrentVictim() != null && hostilRef.GetThreat() > (1.1f * GetCurrentVictim().GetThreat()))
setDirty(true); SetDirty(true);
threatContainer.addReference(hostilRef); threatContainer.AddReference(hostilRef);
threatOfflineContainer.remove(hostilRef); threatOfflineContainer.Remove(hostilRef);
} }
break; break;
case UnitEventTypes.ThreatRefRemoveFromList: case UnitEventTypes.ThreatRefRemoveFromList:
if (hostilRef == getCurrentVictim()) if (hostilRef == GetCurrentVictim())
{ {
setCurrentVictim(null); SetCurrentVictim(null);
setDirty(true); SetDirty(true);
} }
Owner.SendRemoveFromThreatList(hostilRef); Owner.SendRemoveFromThreatList(hostilRef);
if (hostilRef.isOnline()) if (hostilRef.IsOnline())
threatContainer.remove(hostilRef); threatContainer.Remove(hostilRef);
else else
threatOfflineContainer.remove(hostilRef); threatOfflineContainer.Remove(hostilRef);
break; break;
} }
} }
public bool isNeedUpdateToClient(uint time) public bool IsNeedUpdateToClient(uint time)
{ {
if (isThreatListEmpty()) if (IsThreatListEmpty())
return false; return false;
if (time >= updateTimer) if (time >= updateTimer)
@@ -225,27 +225,27 @@ namespace Game.Combat
} }
// Reset all aggro without modifying the threatlist. // Reset all aggro without modifying the threatlist.
void resetAllAggro() void ResetAllAggro()
{ {
var threatList = threatContainer.threatList; var threatList = threatContainer.threatList;
if (threatList.Empty()) if (threatList.Empty())
return; return;
foreach (var refe in threatList) foreach (var refe in threatList)
refe.setThreat(0); refe.SetThreat(0);
setDirty(true); SetDirty(true);
} }
public bool isThreatListEmpty() public bool IsThreatListEmpty()
{ {
return threatContainer.empty(); return threatContainer.Empty();
} }
public bool areThreatListsEmpty() public bool IsThreatListsEmpty()
{ {
return threatContainer.empty() && threatOfflineContainer.empty(); return threatContainer.Empty() && threatOfflineContainer.Empty();
} }
public HostileReference getCurrentVictim() public HostileReference GetCurrentVictim()
{ {
return currentVictim; return currentVictim;
} }
@@ -255,17 +255,17 @@ namespace Game.Combat
return Owner; return Owner;
} }
void setDirty(bool isDirty) void SetDirty(bool isDirty)
{ {
threatContainer.setDirty(isDirty); threatContainer.SetDirty(isDirty);
} }
public List<HostileReference> getThreatList() { return threatContainer.getThreatList(); } public List<HostileReference> GetThreatList() { return threatContainer.GetThreatList(); }
public List<HostileReference> getOfflineThreatList() { return threatOfflineContainer.getThreatList(); } public List<HostileReference> GetOfflineThreatList() { return threatOfflineContainer.GetThreatList(); }
public ThreatContainer getOnlineContainer() { return threatContainer; } public ThreatContainer GetOnlineContainer() { return threatContainer; }
// The hatingUnit is not used yet // The hatingUnit is not used yet
public static float calcThreat(Unit hatedUnit, Unit hatingUnit, float threat, SpellSchoolMask schoolMask = SpellSchoolMask.Normal, SpellInfo threatSpell = null) public static float CalcThreat(Unit hatedUnit, Unit hatingUnit, float threat, SpellSchoolMask schoolMask = SpellSchoolMask.Normal, SpellInfo threatSpell = null)
{ {
if (threatSpell != null) if (threatSpell != null)
{ {
@@ -287,7 +287,7 @@ namespace Game.Combat
return hatedUnit.ApplyTotalThreatModifier(threat, schoolMask); return hatedUnit.ApplyTotalThreatModifier(threat, schoolMask);
} }
public static bool isValidProcess(Unit hatedUnit, Unit hatingUnit, SpellInfo threatSpell = null) public static bool IsValidProcess(Unit hatedUnit, Unit hatingUnit, SpellInfo threatSpell = null)
{ {
//function deals with adding threat and adding players and pets into ThreatList //function deals with adding threat and adding players and pets into ThreatList
//mobs, NPCs, guards have ThreatList and HateOfflineList //mobs, NPCs, guards have ThreatList and HateOfflineList
@@ -337,17 +337,17 @@ namespace Game.Combat
iDirty = false; iDirty = false;
} }
public void clearReferences() public void ClearReferences()
{ {
foreach (var reff in threatList) foreach (var reff in threatList)
{ {
reff.unlink(); reff.Unlink();
} }
threatList.Clear(); threatList.Clear();
} }
public HostileReference getReferenceByTarget(Unit victim) public HostileReference GetReferenceByTarget(Unit victim)
{ {
if (victim == null) if (victim == null)
return null; return null;
@@ -355,37 +355,37 @@ namespace Game.Combat
ObjectGuid guid = victim.GetGUID(); ObjectGuid guid = victim.GetGUID();
foreach (var reff in threatList) foreach (var reff in threatList)
{ {
if (reff != null && reff.getUnitGuid() == guid) if (reff != null && reff.GetUnitGuid() == guid)
return reff; return reff;
} }
return null; return null;
} }
public HostileReference addThreat(Unit victim, float threat) public HostileReference AddThreat(Unit victim, float threat)
{ {
var reff = getReferenceByTarget(victim); var reff = GetReferenceByTarget(victim);
if (reff != null) if (reff != null)
reff.addThreat(threat); reff.AddThreat(threat);
return reff; return reff;
} }
public void modifyThreatPercent(Unit victim, int percent) public void ModifyThreatPercent(Unit victim, int percent)
{ {
HostileReference refe = getReferenceByTarget(victim); HostileReference refe = GetReferenceByTarget(victim);
if (refe != null) if (refe != null)
refe.addThreatPercent(percent); refe.AddThreatPercent(percent);
} }
public void update() public void Update()
{ {
if (iDirty && threatList.Count > 1) if (iDirty && threatList.Count > 1)
threatList = threatList.OrderByDescending(p => p.getThreat()).ToList(); threatList = threatList.OrderByDescending(p => p.GetThreat()).ToList();
iDirty = false; iDirty = false;
} }
public HostileReference selectNextVictim(Creature attacker, HostileReference currentVictim) public HostileReference SelectNextVictim(Creature attacker, HostileReference currentVictim)
{ {
HostileReference currentRef = null; HostileReference currentRef = null;
bool found = false; bool found = false;
@@ -398,7 +398,7 @@ namespace Game.Combat
currentRef = threatList[i]; currentRef = threatList[i];
Unit target = currentRef.getTarget(); Unit target = currentRef.GetTarget();
Cypher.Assert(target); // if the ref has status online the target must be there ! Cypher.Assert(target); // if the ref has status online the target must be there !
// some units are prefered in comparison to others // some units are prefered in comparison to others
@@ -425,17 +425,17 @@ namespace Game.Combat
if (currentVictim != null) // select 1.3/1.1 better target in comparison current target if (currentVictim != null) // select 1.3/1.1 better target in comparison current target
{ {
// list sorted and and we check current target, then this is best case // list sorted and and we check current target, then this is best case
if (currentVictim == currentRef || currentRef.getThreat() <= 1.1f * currentVictim.getThreat()) if (currentVictim == currentRef || currentRef.GetThreat() <= 1.1f * currentVictim.GetThreat())
{ {
if (currentVictim != currentRef && attacker.CanCreatureAttack(currentVictim.getTarget())) if (currentVictim != currentRef && attacker.CanCreatureAttack(currentVictim.GetTarget()))
currentRef = currentVictim; // for second case, if currentvictim is attackable currentRef = currentVictim; // for second case, if currentvictim is attackable
found = true; found = true;
break; break;
} }
if (currentRef.getThreat() > 1.3f * currentVictim.getThreat() || if (currentRef.GetThreat() > 1.3f * currentVictim.GetThreat() ||
(currentRef.getThreat() > 1.1f * currentVictim.getThreat() && (currentRef.GetThreat() > 1.1f * currentVictim.GetThreat() &&
attacker.IsWithinMeleeRange(target))) attacker.IsWithinMeleeRange(target)))
{ //implement 110% threat rule for targets in melee range { //implement 110% threat rule for targets in melee range
found = true; //and 130% rule for targets in ranged distances found = true; //and 130% rule for targets in ranged distances
@@ -455,35 +455,35 @@ namespace Game.Combat
return currentRef; return currentRef;
} }
public void setDirty(bool isDirty) public void SetDirty(bool isDirty)
{ {
iDirty = isDirty; iDirty = isDirty;
} }
bool isDirty() bool IsDirty()
{ {
return iDirty; return iDirty;
} }
public bool empty() public bool Empty()
{ {
return threatList.Empty(); return threatList.Empty();
} }
public HostileReference getMostHated() public HostileReference GetMostHated()
{ {
return threatList.Count == 0 ? null : threatList[0]; return threatList.Count == 0 ? null : threatList[0];
} }
public void remove(HostileReference hostileRef) public void Remove(HostileReference hostileRef)
{ {
threatList.Remove(hostileRef); threatList.Remove(hostileRef);
} }
public void addReference(HostileReference hostileRef) public void AddReference(HostileReference hostileRef)
{ {
threatList.Add(hostileRef); threatList.Add(hostileRef);
} }
public List<HostileReference> getThreatList() { return threatList; } public List<HostileReference> GetThreatList() { return threatList; }
public List<HostileReference> threatList { get; set; } public List<HostileReference> threatList { get; set; }
bool iDirty; bool iDirty;
+2 -2
View File
@@ -267,7 +267,7 @@ namespace Game.Conditions
condMeets = MathFunctions.CompareValues((ComparisionType)ConditionValue2, unit.GetHealthPct(), ConditionValue1); condMeets = MathFunctions.CompareValues((ComparisionType)ConditionValue2, unit.GetHealthPct(), ConditionValue1);
break; break;
case ConditionTypes.WorldState: case ConditionTypes.WorldState:
condMeets = (ConditionValue2 == Global.WorldMgr.getWorldState((WorldStates)ConditionValue1)); condMeets = (ConditionValue2 == Global.WorldMgr.GetWorldState((WorldStates)ConditionValue1));
break; break;
case ConditionTypes.PhaseId: case ConditionTypes.PhaseId:
condMeets = obj.GetPhaseShift().HasPhase(ConditionValue1); condMeets = obj.GetPhaseShift().HasPhase(ConditionValue1);
@@ -493,7 +493,7 @@ namespace Game.Conditions
return mask; return mask;
} }
public bool isLoaded() public bool IsLoaded()
{ {
return ConditionType > ConditionTypes.None || ReferenceId != 0; return ConditionType > ConditionTypes.None || ReferenceId != 0;
} }
+46 -46
View File
@@ -42,7 +42,7 @@ namespace Game
foreach (var i in conditions) foreach (var i in conditions)
{ {
// no point of having not loaded conditions in list // no point of having not loaded conditions in list
Cypher.Assert(i.isLoaded(), "ConditionMgr.GetSearcherTypeMaskForConditionList - not yet loaded condition found in list"); Cypher.Assert(i.IsLoaded(), "ConditionMgr.GetSearcherTypeMaskForConditionList - not yet loaded condition found in list");
// group not filled yet, fill with widest mask possible // group not filled yet, fill with widest mask possible
if (!elseGroupSearcherTypeMasks.ContainsKey(i.ElseGroup)) if (!elseGroupSearcherTypeMasks.ContainsKey(i.ElseGroup))
elseGroupSearcherTypeMasks[i.ElseGroup] = GridMapTypeMask.All; elseGroupSearcherTypeMasks[i.ElseGroup] = GridMapTypeMask.All;
@@ -79,7 +79,7 @@ namespace Game
foreach (var condition in conditions) foreach (var condition in conditions)
{ {
Log.outDebug(LogFilter.Condition, "ConditionMgr.IsPlayerMeetToConditionList condType: {0} val1: {1}", condition.ConditionType, condition.ConditionValue1); Log.outDebug(LogFilter.Condition, "ConditionMgr.IsPlayerMeetToConditionList condType: {0} val1: {1}", condition.ConditionType, condition.ConditionValue1);
if (condition.isLoaded()) if (condition.IsLoaded())
{ {
//! Find ElseGroup in ElseGroupStore //! Find ElseGroup in ElseGroupStore
//! If not found, add an entry in the store and set to true (placeholder) //! If not found, add an entry in the store and set to true (placeholder)
@@ -371,7 +371,7 @@ namespace Game
if (cond.SourceEntry != 0 && iSourceTypeOrReferenceId < 0) if (cond.SourceEntry != 0 && iSourceTypeOrReferenceId < 0)
Log.outError(LogFilter.Sql, "Condition {0} {1} has useless data in SourceEntry ({2})!", rowType, iSourceTypeOrReferenceId, cond.SourceEntry); Log.outError(LogFilter.Sql, "Condition {0} {1} has useless data in SourceEntry ({2})!", rowType, iSourceTypeOrReferenceId, cond.SourceEntry);
} }
else if (!isConditionTypeValid(cond))//doesn't have reference, validate ConditionType else if (!IsConditionTypeValid(cond))//doesn't have reference, validate ConditionType
continue; continue;
if (iSourceTypeOrReferenceId < 0)//it is a reference template if (iSourceTypeOrReferenceId < 0)//it is a reference template
@@ -382,7 +382,7 @@ namespace Game
}//end of reference templates }//end of reference templates
//if not a reference and SourceType is invalid, skip //if not a reference and SourceType is invalid, skip
if (iConditionTypeOrReference >= 0 && !isSourceTypeValid(cond)) if (iConditionTypeOrReference >= 0 && !IsSourceTypeValid(cond))
continue; continue;
//Grouping is only allowed for some types (loot templates, gossip menus, gossip items) //Grouping is only allowed for some types (loot templates, gossip menus, gossip items)
@@ -416,46 +416,46 @@ namespace Game
switch (cond.SourceType) switch (cond.SourceType)
{ {
case ConditionSourceType.CreatureLootTemplate: case ConditionSourceType.CreatureLootTemplate:
valid = addToLootTemplate(cond, LootStorage.Creature.GetLootForConditionFill(cond.SourceGroup)); valid = AddToLootTemplate(cond, LootStorage.Creature.GetLootForConditionFill(cond.SourceGroup));
break; break;
case ConditionSourceType.DisenchantLootTemplate: case ConditionSourceType.DisenchantLootTemplate:
valid = addToLootTemplate(cond, LootStorage.Disenchant.GetLootForConditionFill(cond.SourceGroup)); valid = AddToLootTemplate(cond, LootStorage.Disenchant.GetLootForConditionFill(cond.SourceGroup));
break; break;
case ConditionSourceType.FishingLootTemplate: case ConditionSourceType.FishingLootTemplate:
valid = addToLootTemplate(cond, LootStorage.Fishing.GetLootForConditionFill(cond.SourceGroup)); valid = AddToLootTemplate(cond, LootStorage.Fishing.GetLootForConditionFill(cond.SourceGroup));
break; break;
case ConditionSourceType.GameobjectLootTemplate: case ConditionSourceType.GameobjectLootTemplate:
valid = addToLootTemplate(cond, LootStorage.Gameobject.GetLootForConditionFill(cond.SourceGroup)); valid = AddToLootTemplate(cond, LootStorage.Gameobject.GetLootForConditionFill(cond.SourceGroup));
break; break;
case ConditionSourceType.ItemLootTemplate: case ConditionSourceType.ItemLootTemplate:
valid = addToLootTemplate(cond, LootStorage.Items.GetLootForConditionFill(cond.SourceGroup)); valid = AddToLootTemplate(cond, LootStorage.Items.GetLootForConditionFill(cond.SourceGroup));
break; break;
case ConditionSourceType.MailLootTemplate: case ConditionSourceType.MailLootTemplate:
valid = addToLootTemplate(cond, LootStorage.Mail.GetLootForConditionFill(cond.SourceGroup)); valid = AddToLootTemplate(cond, LootStorage.Mail.GetLootForConditionFill(cond.SourceGroup));
break; break;
case ConditionSourceType.MillingLootTemplate: case ConditionSourceType.MillingLootTemplate:
valid = addToLootTemplate(cond, LootStorage.Milling.GetLootForConditionFill(cond.SourceGroup)); valid = AddToLootTemplate(cond, LootStorage.Milling.GetLootForConditionFill(cond.SourceGroup));
break; break;
case ConditionSourceType.PickpocketingLootTemplate: case ConditionSourceType.PickpocketingLootTemplate:
valid = addToLootTemplate(cond, LootStorage.Pickpocketing.GetLootForConditionFill(cond.SourceGroup)); valid = AddToLootTemplate(cond, LootStorage.Pickpocketing.GetLootForConditionFill(cond.SourceGroup));
break; break;
case ConditionSourceType.ProspectingLootTemplate: case ConditionSourceType.ProspectingLootTemplate:
valid = addToLootTemplate(cond, LootStorage.Prospecting.GetLootForConditionFill(cond.SourceGroup)); valid = AddToLootTemplate(cond, LootStorage.Prospecting.GetLootForConditionFill(cond.SourceGroup));
break; break;
case ConditionSourceType.ReferenceLootTemplate: case ConditionSourceType.ReferenceLootTemplate:
valid = addToLootTemplate(cond, LootStorage.Reference.GetLootForConditionFill(cond.SourceGroup)); valid = AddToLootTemplate(cond, LootStorage.Reference.GetLootForConditionFill(cond.SourceGroup));
break; break;
case ConditionSourceType.SkinningLootTemplate: case ConditionSourceType.SkinningLootTemplate:
valid = addToLootTemplate(cond, LootStorage.Skinning.GetLootForConditionFill(cond.SourceGroup)); valid = AddToLootTemplate(cond, LootStorage.Skinning.GetLootForConditionFill(cond.SourceGroup));
break; break;
case ConditionSourceType.SpellLootTemplate: case ConditionSourceType.SpellLootTemplate:
valid = addToLootTemplate(cond, LootStorage.Spell.GetLootForConditionFill(cond.SourceGroup)); valid = AddToLootTemplate(cond, LootStorage.Spell.GetLootForConditionFill(cond.SourceGroup));
break; break;
case ConditionSourceType.GossipMenu: case ConditionSourceType.GossipMenu:
valid = addToGossipMenus(cond); valid = AddToGossipMenus(cond);
break; break;
case ConditionSourceType.GossipMenuOption: case ConditionSourceType.GossipMenuOption:
valid = addToGossipMenuItems(cond); valid = AddToGossipMenuItems(cond);
break; break;
case ConditionSourceType.SpellClickEvent: case ConditionSourceType.SpellClickEvent:
{ {
@@ -468,7 +468,7 @@ namespace Game
continue; // do not add to m_AllocatedMemory to avoid double deleting continue; // do not add to m_AllocatedMemory to avoid double deleting
} }
case ConditionSourceType.SpellImplicitTarget: case ConditionSourceType.SpellImplicitTarget:
valid = addToSpellImplicitTargetConditions(cond); valid = AddToSpellImplicitTargetConditions(cond);
break; break;
case ConditionSourceType.VehicleSpell: case ConditionSourceType.VehicleSpell:
{ {
@@ -503,7 +503,7 @@ namespace Game
continue; continue;
} }
case ConditionSourceType.Phase: case ConditionSourceType.Phase:
valid = addToPhases(cond); valid = AddToPhases(cond);
break; break;
default: default:
break; break;
@@ -526,7 +526,7 @@ namespace Game
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} conditions in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime)); Log.outInfo(LogFilter.ServerLoading, "Loaded {0} conditions in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
} }
bool addToLootTemplate(Condition cond, LootTemplate loot) bool AddToLootTemplate(Condition cond, LootTemplate loot)
{ {
if (loot == null) if (loot == null)
{ {
@@ -534,14 +534,14 @@ namespace Game
return false; return false;
} }
if (loot.addConditionItem(cond)) if (loot.AddConditionItem(cond))
return true; return true;
Log.outError(LogFilter.Sql, "{0} Item {1} not found in LootTemplate {2}.", cond.ToString(), cond.SourceEntry, cond.SourceGroup); Log.outError(LogFilter.Sql, "{0} Item {1} not found in LootTemplate {2}.", cond.ToString(), cond.SourceEntry, cond.SourceGroup);
return false; return false;
} }
bool addToGossipMenus(Condition cond) bool AddToGossipMenus(Condition cond)
{ {
var pMenuBounds = Global.ObjectMgr.GetGossipMenusMapBounds(cond.SourceGroup); var pMenuBounds = Global.ObjectMgr.GetGossipMenusMapBounds(cond.SourceGroup);
@@ -558,7 +558,7 @@ namespace Game
return false; return false;
} }
bool addToGossipMenuItems(Condition cond) bool AddToGossipMenuItems(Condition cond)
{ {
var pMenuItemBounds = Global.ObjectMgr.GetGossipMenuItemsMapBounds(cond.SourceGroup); var pMenuItemBounds = Global.ObjectMgr.GetGossipMenuItemsMapBounds(cond.SourceGroup);
foreach (var menuItems in pMenuItemBounds) foreach (var menuItems in pMenuItemBounds)
@@ -574,7 +574,7 @@ namespace Game
return false; return false;
} }
bool addToSpellImplicitTargetConditions(Condition cond) bool AddToSpellImplicitTargetConditions(Condition cond)
{ {
uint conditionEffMask = cond.SourceGroup; uint conditionEffMask = cond.SourceGroup;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo((uint)cond.SourceEntry); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo((uint)cond.SourceEntry);
@@ -674,7 +674,7 @@ namespace Game
return true; return true;
} }
bool addToPhases(Condition cond) bool AddToPhases(Condition cond)
{ {
if (cond.SourceEntry == 0) if (cond.SourceEntry == 0)
{ {
@@ -719,7 +719,7 @@ namespace Game
return false; return false;
} }
bool isSourceTypeValid(Condition cond) bool IsSourceTypeValid(Condition cond)
{ {
switch (cond.SourceType) switch (cond.SourceType)
{ {
@@ -733,7 +733,7 @@ namespace Game
LootTemplate loot = LootStorage.Creature.GetLootForConditionFill(cond.SourceGroup); LootTemplate loot = LootStorage.Creature.GetLootForConditionFill(cond.SourceGroup);
ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry); ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry);
if (pItemProto == null && !loot.isReference((uint)cond.SourceEntry)) if (pItemProto == null && !loot.IsReference((uint)cond.SourceEntry))
{ {
Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString()); Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString());
return false; return false;
@@ -750,7 +750,7 @@ namespace Game
LootTemplate loot = LootStorage.Disenchant.GetLootForConditionFill(cond.SourceGroup); LootTemplate loot = LootStorage.Disenchant.GetLootForConditionFill(cond.SourceGroup);
ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry); ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry);
if (pItemProto == null && !loot.isReference((uint)cond.SourceEntry)) if (pItemProto == null && !loot.IsReference((uint)cond.SourceEntry))
{ {
Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString()); Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString());
return false; return false;
@@ -767,7 +767,7 @@ namespace Game
LootTemplate loot = LootStorage.Fishing.GetLootForConditionFill(cond.SourceGroup); LootTemplate loot = LootStorage.Fishing.GetLootForConditionFill(cond.SourceGroup);
ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry); ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry);
if (pItemProto == null && !loot.isReference((uint)cond.SourceEntry)) if (pItemProto == null && !loot.IsReference((uint)cond.SourceEntry))
{ {
Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString()); Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString());
return false; return false;
@@ -784,7 +784,7 @@ namespace Game
LootTemplate loot = LootStorage.Gameobject.GetLootForConditionFill(cond.SourceGroup); LootTemplate loot = LootStorage.Gameobject.GetLootForConditionFill(cond.SourceGroup);
ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry); ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry);
if (pItemProto == null && !loot.isReference((uint)cond.SourceEntry)) if (pItemProto == null && !loot.IsReference((uint)cond.SourceEntry))
{ {
Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString()); Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString());
return false; return false;
@@ -801,7 +801,7 @@ namespace Game
LootTemplate loot = LootStorage.Items.GetLootForConditionFill(cond.SourceGroup); LootTemplate loot = LootStorage.Items.GetLootForConditionFill(cond.SourceGroup);
ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry); ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry);
if (pItemProto == null && !loot.isReference((uint)cond.SourceEntry)) if (pItemProto == null && !loot.IsReference((uint)cond.SourceEntry))
{ {
Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString()); Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString());
return false; return false;
@@ -818,7 +818,7 @@ namespace Game
LootTemplate loot = LootStorage.Mail.GetLootForConditionFill(cond.SourceGroup); LootTemplate loot = LootStorage.Mail.GetLootForConditionFill(cond.SourceGroup);
ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry); ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry);
if (pItemProto == null && !loot.isReference((uint)cond.SourceEntry)) if (pItemProto == null && !loot.IsReference((uint)cond.SourceEntry))
{ {
Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString()); Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString());
return false; return false;
@@ -835,7 +835,7 @@ namespace Game
LootTemplate loot = LootStorage.Milling.GetLootForConditionFill(cond.SourceGroup); LootTemplate loot = LootStorage.Milling.GetLootForConditionFill(cond.SourceGroup);
ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry); ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry);
if (pItemProto == null && !loot.isReference((uint)cond.SourceEntry)) if (pItemProto == null && !loot.IsReference((uint)cond.SourceEntry))
{ {
Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString()); Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString());
return false; return false;
@@ -852,7 +852,7 @@ namespace Game
LootTemplate loot = LootStorage.Pickpocketing.GetLootForConditionFill(cond.SourceGroup); LootTemplate loot = LootStorage.Pickpocketing.GetLootForConditionFill(cond.SourceGroup);
ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry); ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry);
if (pItemProto == null && !loot.isReference((uint)cond.SourceEntry)) if (pItemProto == null && !loot.IsReference((uint)cond.SourceEntry))
{ {
Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString()); Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString());
return false; return false;
@@ -869,7 +869,7 @@ namespace Game
LootTemplate loot = LootStorage.Prospecting.GetLootForConditionFill(cond.SourceGroup); LootTemplate loot = LootStorage.Prospecting.GetLootForConditionFill(cond.SourceGroup);
ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry); ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry);
if (pItemProto == null && !loot.isReference((uint)cond.SourceEntry)) if (pItemProto == null && !loot.IsReference((uint)cond.SourceEntry))
{ {
Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString()); Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString());
return false; return false;
@@ -886,7 +886,7 @@ namespace Game
LootTemplate loot = LootStorage.Reference.GetLootForConditionFill(cond.SourceGroup); LootTemplate loot = LootStorage.Reference.GetLootForConditionFill(cond.SourceGroup);
ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry); ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry);
if (pItemProto == null && !loot.isReference((uint)cond.SourceEntry)) if (pItemProto == null && !loot.IsReference((uint)cond.SourceEntry))
{ {
Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString()); Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString());
return false; return false;
@@ -903,7 +903,7 @@ namespace Game
LootTemplate loot = LootStorage.Skinning.GetLootForConditionFill(cond.SourceGroup); LootTemplate loot = LootStorage.Skinning.GetLootForConditionFill(cond.SourceGroup);
ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry); ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry);
if (pItemProto == null && !loot.isReference((uint)cond.SourceEntry)) if (pItemProto == null && !loot.IsReference((uint)cond.SourceEntry))
{ {
Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString()); Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString());
return false; return false;
@@ -920,7 +920,7 @@ namespace Game
LootTemplate loot = LootStorage.Spell.GetLootForConditionFill(cond.SourceGroup); LootTemplate loot = LootStorage.Spell.GetLootForConditionFill(cond.SourceGroup);
ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry); ItemTemplate pItemProto = Global.ObjectMgr.GetItemTemplate((uint)cond.SourceEntry);
if (pItemProto == null && !loot.isReference((uint)cond.SourceEntry)) if (pItemProto == null && !loot.IsReference((uint)cond.SourceEntry))
{ {
Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString()); Log.outError(LogFilter.Sql, "{0} SourceType, SourceEntry in `condition` table, does not exist in `item_template`, ignoring.", cond.ToString());
return false; return false;
@@ -1087,7 +1087,7 @@ namespace Game
return true; return true;
} }
bool isConditionTypeValid(Condition cond) bool IsConditionTypeValid(Condition cond)
{ {
switch (cond.ConditionType) switch (cond.ConditionType)
{ {
@@ -1212,7 +1212,7 @@ namespace Game
case ConditionTypes.ActiveEvent: case ConditionTypes.ActiveEvent:
{ {
var events = Global.GameEventMgr.GetEventMap(); var events = Global.GameEventMgr.GetEventMap();
if (cond.ConditionValue1 >= events.Length || !events[cond.ConditionValue1].isValid()) if (cond.ConditionValue1 >= events.Length || !events[cond.ConditionValue1].IsValid())
{ {
Log.outError(LogFilter.Sql, "{0} has non existing event id ({1}), skipped.", cond.ToString(true), cond.ConditionValue1); Log.outError(LogFilter.Sql, "{0} has non existing event id ({1}), skipped.", cond.ToString(true), cond.ConditionValue1);
return false; return false;
@@ -1467,7 +1467,7 @@ namespace Game
} }
case ConditionTypes.WorldState: case ConditionTypes.WorldState:
{ {
if (Global.WorldMgr.getWorldState((WorldStates)cond.ConditionValue1) == 0) if (Global.WorldMgr.GetWorldState((WorldStates)cond.ConditionValue1) == 0)
{ {
Log.outError(LogFilter.Sql, "{0} has non existing world state in value1 ({1}), skipped.", cond.ToString(true), cond.ConditionValue1); Log.outError(LogFilter.Sql, "{0} has non existing world state in value1 ({1}), skipped.", cond.ToString(true), cond.ConditionValue1);
return false; return false;
@@ -1820,15 +1820,15 @@ namespace Game
return false; return false;
break; break;
case 3: case 3:
if (!group || group.isRaidGroup()) if (!group || group.IsRaidGroup())
return false; return false;
break; break;
case 4: case 4:
if (!group || !group.isRaidGroup()) if (!group || !group.IsRaidGroup())
return false; return false;
break; break;
case 5: case 5:
if (group && group.isRaidGroup()) if (group && group.IsRaidGroup())
return false; return false;
break; break;
default: default:
@@ -2100,7 +2100,7 @@ namespace Game
case WorldStateExpressionValueType.WorldState: case WorldStateExpressionValueType.WorldState:
{ {
uint worldStateId = buffer.ReadUInt32(); uint worldStateId = buffer.ReadUInt32();
value = (int)Global.WorldMgr.getWorldState(worldStateId); value = (int)Global.WorldMgr.GetWorldState(worldStateId);
break; break;
} }
case WorldStateExpressionValueType.Function: case WorldStateExpressionValueType.Function:
+5 -5
View File
@@ -25,7 +25,7 @@ namespace Game.DataStorage
public class M2Storage public class M2Storage
{ {
// Convert the geomoetry from a spline value, to an actual WoW XYZ // Convert the geomoetry from a spline value, to an actual WoW XYZ
static Vector3 translateLocation(Vector4 dbcLocation, Vector3 basePosition, Vector3 splineVector) static Vector3 TranslateLocation(Vector4 dbcLocation, Vector3 basePosition, Vector3 splineVector)
{ {
Vector3 work = new Vector3(); Vector3 work = new Vector3();
float x = basePosition.X + splineVector.X; float x = basePosition.X + splineVector.X;
@@ -44,7 +44,7 @@ namespace Game.DataStorage
} }
// Number of cameras not used. Multiple cameras never used in 7.1.5 // Number of cameras not used. Multiple cameras never used in 7.1.5
static void readCamera(M2Camera cam, BinaryReader reader, CinematicCameraRecord dbcentry) static void ReadCamera(M2Camera cam, BinaryReader reader, CinematicCameraRecord dbcentry)
{ {
List<FlyByCamera> cameras = new List<FlyByCamera>(); List<FlyByCamera> cameras = new List<FlyByCamera>();
List<FlyByCamera> targetcam = new List<FlyByCamera>(); List<FlyByCamera> targetcam = new List<FlyByCamera>();
@@ -73,7 +73,7 @@ namespace Game.DataStorage
for (uint i = 0; i < targTsArray.number; ++i) for (uint i = 0; i < targTsArray.number; ++i)
{ {
// Translate co-ordinates // Translate co-ordinates
Vector3 newPos = translateLocation(dbcData, cam.target_position_base, targPositions[i].p0); Vector3 newPos = TranslateLocation(dbcData, cam.target_position_base, targPositions[i].p0);
// Add to vector // Add to vector
FlyByCamera thisCam = new FlyByCamera(); FlyByCamera thisCam = new FlyByCamera();
@@ -105,7 +105,7 @@ namespace Game.DataStorage
for (uint i = 0; i < posTsArray.number; ++i) for (uint i = 0; i < posTsArray.number; ++i)
{ {
// Translate co-ordinates // Translate co-ordinates
Vector3 newPos = translateLocation(dbcData, cam.position_base, positions[i].p0); Vector3 newPos = TranslateLocation(dbcData, cam.position_base, positions[i].p0);
// Add to vector // Add to vector
FlyByCamera thisCam = new FlyByCamera(); FlyByCamera thisCam = new FlyByCamera();
@@ -189,7 +189,7 @@ namespace Game.DataStorage
M2Camera cam = m2file.Read<M2Camera>(); M2Camera cam = m2file.Read<M2Camera>();
m2file.BaseStream.Position = 8; m2file.BaseStream.Position = 8;
readCamera(cam, new BinaryReader(new MemoryStream(m2file.ReadBytes((int)m2file.BaseStream.Length - 8))), cameraEntry); ReadCamera(cam, new BinaryReader(new MemoryStream(m2file.ReadBytes((int)m2file.BaseStream.Length - 8))), cameraEntry);
} }
} }
catch (EndOfStreamException) catch (EndOfStreamException)
+9 -9
View File
@@ -252,7 +252,7 @@ namespace Game.DungeonFinding
public void Update(uint diff) public void Update(uint diff)
{ {
if (!isOptionEnabled(LfgOptions.EnableDungeonFinder | LfgOptions.EnableRaidBrowser)) if (!IsOptionEnabled(LfgOptions.EnableDungeonFinder | LfgOptions.EnableRaidBrowser))
return; return;
long currTime = Time.UnixTime; long currTime = Time.UnixTime;
@@ -363,7 +363,7 @@ namespace Game.DungeonFinding
LfgJoinResultData joinData = new LfgJoinResultData(); LfgJoinResultData joinData = new LfgJoinResultData();
List<ObjectGuid> players = new List<ObjectGuid>(); List<ObjectGuid> players = new List<ObjectGuid>();
uint rDungeonId = 0; uint rDungeonId = 0;
bool isContinue = grp && grp.isLFGGroup() && GetState(gguid) != LfgState.FinishedDungeon; bool isContinue = grp && grp.IsLFGGroup() && GetState(gguid) != LfgState.FinishedDungeon;
// Do not allow to change dungeon in the middle of a current dungeon // Do not allow to change dungeon in the middle of a current dungeon
if (isContinue) if (isContinue)
@@ -400,7 +400,7 @@ namespace Game.DungeonFinding
else else
{ {
byte memberCount = 0; byte memberCount = 0;
for (GroupReference refe = grp.GetFirstMember(); refe != null && joinData.result == LfgJoinResult.Ok; refe = refe.next()) for (GroupReference refe = grp.GetFirstMember(); refe != null && joinData.result == LfgJoinResult.Ok; refe = refe.Next())
{ {
Player plrg = refe.GetSource(); Player plrg = refe.GetSource();
if (plrg) if (plrg)
@@ -524,7 +524,7 @@ namespace Game.DungeonFinding
SetState(gguid, LfgState.Rolecheck); SetState(gguid, LfgState.Rolecheck);
// Send update to player // Send update to player
LfgUpdateData updateData = new LfgUpdateData(LfgUpdateType.JoinQueue, dungeons); LfgUpdateData updateData = new LfgUpdateData(LfgUpdateType.JoinQueue, dungeons);
for (GroupReference refe = grp.GetFirstMember(); refe != null; refe = refe.next()) for (GroupReference refe = grp.GetFirstMember(); refe != null; refe = refe.Next())
{ {
Player plrg = refe.GetSource(); Player plrg = refe.GetSource();
if (plrg) if (plrg)
@@ -1201,7 +1201,7 @@ namespace Game.DungeonFinding
LFGDungeonData dungeon = null; LFGDungeonData dungeon = null;
Group group = player.GetGroup(); Group group = player.GetGroup();
if (group && group.isLFGGroup()) if (group && group.IsLFGGroup())
dungeon = GetLFGDungeon(GetDungeon(group.GetGUID())); dungeon = GetLFGDungeon(GetDungeon(group.GetGUID()));
if (dungeon == null) if (dungeon == null)
@@ -1244,7 +1244,7 @@ namespace Game.DungeonFinding
if (!fromOpcode) if (!fromOpcode)
{ {
// Select a player inside to be teleported to // Select a player inside to be teleported to
for (GroupReference refe = group.GetFirstMember(); refe != null && mapid == 0; refe = refe.next()) for (GroupReference refe = group.GetFirstMember(); refe != null && mapid == 0; refe = refe.Next())
{ {
Player plrg = refe.GetSource(); Player plrg = refe.GetSource();
if (plrg && plrg != player && plrg.GetMapId() == dungeon.map) if (plrg && plrg != player && plrg.GetMapId() == dungeon.map)
@@ -1855,7 +1855,7 @@ namespace Game.DungeonFinding
QueuesStore.Clear(); QueuesStore.Clear();
} }
public bool isOptionEnabled(LfgOptions option) public bool IsOptionEnabled(LfgOptions option)
{ {
return m_options.HasAnyFlag(option); return m_options.HasAnyFlag(option);
} }
@@ -1924,7 +1924,7 @@ namespace Game.DungeonFinding
AddPlayerToGroup(gguid, guid); AddPlayerToGroup(gguid, guid);
} }
public bool selectedRandomLfgDungeon(ObjectGuid guid) public bool SelectedRandomLfgDungeon(ObjectGuid guid)
{ {
if (GetState(guid) != LfgState.None) if (GetState(guid) != LfgState.None)
{ {
@@ -1940,7 +1940,7 @@ namespace Game.DungeonFinding
return false; return false;
} }
public bool inLfgDungeonMap(ObjectGuid guid, uint map, Difficulty difficulty) public bool InLfgDungeonMap(ObjectGuid guid, uint map, Difficulty difficulty)
{ {
if (!guid.IsParty()) if (!guid.IsParty())
guid = GetGroup(guid); guid = GetGroup(guid);
+11 -11
View File
@@ -30,7 +30,7 @@ namespace Game.DungeonFinding
// Player Hooks // Player Hooks
public override void OnLogout(Player player) public override void OnLogout(Player player)
{ {
if (!Global.LFGMgr.isOptionEnabled(LfgOptions.EnableDungeonFinder | LfgOptions.EnableRaidBrowser)) if (!Global.LFGMgr.IsOptionEnabled(LfgOptions.EnableDungeonFinder | LfgOptions.EnableRaidBrowser))
return; return;
if (!player.GetGroup()) if (!player.GetGroup())
@@ -41,7 +41,7 @@ namespace Game.DungeonFinding
public override void OnLogin(Player player) public override void OnLogin(Player player)
{ {
if (!Global.LFGMgr.isOptionEnabled(LfgOptions.EnableDungeonFinder | LfgOptions.EnableRaidBrowser)) if (!Global.LFGMgr.IsOptionEnabled(LfgOptions.EnableDungeonFinder | LfgOptions.EnableRaidBrowser))
return; return;
// Temporal: Trying to determine when group data and LFG data gets desynched // Temporal: Trying to determine when group data and LFG data gets desynched
@@ -67,7 +67,7 @@ namespace Game.DungeonFinding
{ {
Map map = player.GetMap(); Map map = player.GetMap();
if (Global.LFGMgr.inLfgDungeonMap(player.GetGUID(), map.GetId(), map.GetDifficultyID())) if (Global.LFGMgr.InLfgDungeonMap(player.GetGUID(), map.GetId(), map.GetDifficultyID()))
{ {
Group group = player.GetGroup(); Group group = player.GetGroup();
// This function is also called when players log in // This function is also called when players log in
@@ -84,14 +84,14 @@ namespace Game.DungeonFinding
return; return;
} }
for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.next()) for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next())
{ {
Player member = refe.GetSource(); Player member = refe.GetSource();
if (member) if (member)
player.GetSession().SendNameQuery(member.GetGUID()); player.GetSession().SendNameQuery(member.GetGUID());
} }
if (Global.LFGMgr.selectedRandomLfgDungeon(player.GetGUID())) if (Global.LFGMgr.SelectedRandomLfgDungeon(player.GetGUID()))
player.CastSpell(player, SharedConst.LFGSpellLuckOfTheDraw, true); player.CastSpell(player, SharedConst.LFGSpellLuckOfTheDraw, true);
} }
else else
@@ -117,7 +117,7 @@ namespace Game.DungeonFinding
// Group Hooks // Group Hooks
public override void OnAddMember(Group group, ObjectGuid guid) public override void OnAddMember(Group group, ObjectGuid guid)
{ {
if (!Global.LFGMgr.isOptionEnabled(LfgOptions.EnableDungeonFinder | LfgOptions.EnableRaidBrowser)) if (!Global.LFGMgr.IsOptionEnabled(LfgOptions.EnableDungeonFinder | LfgOptions.EnableRaidBrowser))
return; return;
ObjectGuid gguid = group.GetGUID(); ObjectGuid gguid = group.GetGUID();
@@ -147,13 +147,13 @@ namespace Game.DungeonFinding
public override void OnRemoveMember(Group group, ObjectGuid guid, RemoveMethod method, ObjectGuid kicker, string reason) public override void OnRemoveMember(Group group, ObjectGuid guid, RemoveMethod method, ObjectGuid kicker, string reason)
{ {
if (!Global.LFGMgr.isOptionEnabled(LfgOptions.EnableDungeonFinder | LfgOptions.EnableRaidBrowser)) if (!Global.LFGMgr.IsOptionEnabled(LfgOptions.EnableDungeonFinder | LfgOptions.EnableRaidBrowser))
return; return;
ObjectGuid gguid = group.GetGUID(); ObjectGuid gguid = group.GetGUID();
Log.outDebug(LogFilter.Lfg, "LFGScripts.OnRemoveMember [{0}]: remove [{1}] Method: {2} Kicker: {3} Reason: {4}", gguid, guid, method, kicker, reason); Log.outDebug(LogFilter.Lfg, "LFGScripts.OnRemoveMember [{0}]: remove [{1}] Method: {2} Kicker: {3} Reason: {4}", gguid, guid, method, kicker, reason);
bool isLFG = group.isLFGGroup(); bool isLFG = group.IsLFGGroup();
if (isLFG && method == RemoveMethod.Kick) // Player have been kicked if (isLFG && method == RemoveMethod.Kick) // Player have been kicked
{ {
@@ -204,7 +204,7 @@ namespace Game.DungeonFinding
public override void OnDisband(Group group) public override void OnDisband(Group group)
{ {
if (!Global.LFGMgr.isOptionEnabled(LfgOptions.EnableDungeonFinder | LfgOptions.EnableRaidBrowser)) if (!Global.LFGMgr.IsOptionEnabled(LfgOptions.EnableDungeonFinder | LfgOptions.EnableRaidBrowser))
return; return;
ObjectGuid gguid = group.GetGUID(); ObjectGuid gguid = group.GetGUID();
@@ -215,7 +215,7 @@ namespace Game.DungeonFinding
public override void OnChangeLeader(Group group, ObjectGuid newLeaderGuid, ObjectGuid oldLeaderGuid) public override void OnChangeLeader(Group group, ObjectGuid newLeaderGuid, ObjectGuid oldLeaderGuid)
{ {
if (!Global.LFGMgr.isOptionEnabled(LfgOptions.EnableDungeonFinder | LfgOptions.EnableRaidBrowser)) if (!Global.LFGMgr.IsOptionEnabled(LfgOptions.EnableDungeonFinder | LfgOptions.EnableRaidBrowser))
return; return;
ObjectGuid gguid = group.GetGUID(); ObjectGuid gguid = group.GetGUID();
@@ -226,7 +226,7 @@ namespace Game.DungeonFinding
public override void OnInviteMember(Group group, ObjectGuid guid) public override void OnInviteMember(Group group, ObjectGuid guid)
{ {
if (!Global.LFGMgr.isOptionEnabled(LfgOptions.EnableDungeonFinder | LfgOptions.EnableRaidBrowser)) if (!Global.LFGMgr.IsOptionEnabled(LfgOptions.EnableDungeonFinder | LfgOptions.EnableRaidBrowser))
return; return;
ObjectGuid gguid = group.GetGUID(); ObjectGuid gguid = group.GetGUID();
@@ -632,8 +632,8 @@ namespace Game.Entities
_movementTime = 0; _movementTime = 0;
_spline.Init_Spline(splinePoints.ToArray(), splinePoints.Count, Spline.EvaluationMode.Linear); _spline.InitSpline(splinePoints.ToArray(), splinePoints.Count, Spline.EvaluationMode.Linear);
_spline.initLengths(); _spline.InitLengths();
// should be sent in object create packets only // should be sent in object create packets only
SetUpdateFieldValue(m_values.ModifyValue(m_areaTriggerData).ModifyValue(m_areaTriggerData.TimeToTarget), timeToTarget); SetUpdateFieldValue(m_values.ModifyValue(m_areaTriggerData).ModifyValue(m_areaTriggerData.TimeToTarget), timeToTarget);
@@ -771,9 +771,9 @@ namespace Game.Entities
if (_movementTime >= GetTimeToTarget()) if (_movementTime >= GetTimeToTarget())
{ {
_reachedDestination = true; _reachedDestination = true;
_lastSplineIndex = _spline.last(); _lastSplineIndex = _spline.Last();
Vector3 lastSplinePosition = _spline.getPoint(_lastSplineIndex); Vector3 lastSplinePosition = _spline.GetPoint(_lastSplineIndex);
GetMap().AreaTriggerRelocation(this, lastSplinePosition.X, lastSplinePosition.Y, lastSplinePosition.Z, GetOrientation()); GetMap().AreaTriggerRelocation(this, lastSplinePosition.X, lastSplinePosition.Y, lastSplinePosition.Z, GetOrientation());
DebugVisualizePosition(); DebugVisualizePosition();
@@ -802,7 +802,7 @@ namespace Game.Entities
int lastPositionIndex = 0; int lastPositionIndex = 0;
float percentFromLastPoint = 0; float percentFromLastPoint = 0;
_spline.computeIndex(currentTimePercent, ref lastPositionIndex, ref percentFromLastPoint); _spline.ComputeIndex(currentTimePercent, ref lastPositionIndex, ref percentFromLastPoint);
Vector3 currentPosition; Vector3 currentPosition;
_spline.Evaluate_Percent(lastPositionIndex, percentFromLastPoint, out currentPosition); _spline.Evaluate_Percent(lastPositionIndex, percentFromLastPoint, out currentPosition);
@@ -810,7 +810,7 @@ namespace Game.Entities
float orientation = GetOrientation(); float orientation = GetOrientation();
if (GetTemplate().HasFlag(AreaTriggerFlags.HasFaceMovementDir)) if (GetTemplate().HasFlag(AreaTriggerFlags.HasFaceMovementDir))
{ {
Vector3 nextPoint = _spline.getPoint(lastPositionIndex + 1); Vector3 nextPoint = _spline.GetPoint(lastPositionIndex + 1);
orientation = GetAngle(nextPoint.X, nextPoint.Y); orientation = GetAngle(nextPoint.X, nextPoint.Y);
} }
@@ -911,7 +911,7 @@ namespace Game.Entities
public Vector3 GetRollPitchYaw() { return _rollPitchYaw; } public Vector3 GetRollPitchYaw() { return _rollPitchYaw; }
public Vector3 GetTargetRollPitchYaw() { return _targetRollPitchYaw; } public Vector3 GetTargetRollPitchYaw() { return _targetRollPitchYaw; }
public bool HasSplines() { return !_spline.empty(); } public bool HasSplines() { return !_spline.Empty(); }
public Spline GetSpline() { return _spline; } public Spline GetSpline() { return _spline; }
public uint GetElapsedTimeForMovement() { return GetTimeSinceCreated(); } // @todo: research the right value, in sniffs both timers are nearly identical public uint GetElapsedTimeForMovement() { return GetTimeSinceCreated(); } // @todo: research the right value, in sniffs both timers are nearly identical
+4 -4
View File
@@ -127,7 +127,7 @@ namespace Game.Entities
SetDeathState(DeathState.Dead); SetDeathState(DeathState.Dead);
RemoveAllAuras(); RemoveAllAuras();
DestroyForNearbyPlayers(); // old UpdateObjectVisibility() DestroyForNearbyPlayers(); // old UpdateObjectVisibility()
loot.clear(); loot.Clear();
uint respawnDelay = m_respawnDelay; uint respawnDelay = m_respawnDelay;
if (IsAIEnabled) if (IsAIEnabled)
GetAI().CorpseRemoved(respawnDelay); GetAI().CorpseRemoved(respawnDelay);
@@ -1625,7 +1625,7 @@ namespace Game.Entities
Log.outDebug(LogFilter.Unit, "Respawning creature {0} ({1})", GetName(), GetGUID().ToString()); Log.outDebug(LogFilter.Unit, "Respawning creature {0} ({1})", GetName(), GetGUID().ToString());
m_respawnTime = 0; m_respawnTime = 0;
ResetPickPocketRefillTimer(); ResetPickPocketRefillTimer();
loot.clear(); loot.Clear();
if (m_originalEntry != GetEntry()) if (m_originalEntry != GetEntry())
UpdateEntry(m_originalEntry); UpdateEntry(m_originalEntry);
@@ -3110,9 +3110,9 @@ namespace Game.Entities
if (CanHaveThreatList()) if (CanHaveThreatList())
{ {
if (target == null && !GetThreatManager().isThreatListEmpty()) if (target == null && !GetThreatManager().IsThreatListEmpty())
// No taunt aura or taunt aura caster is dead standard target selection // No taunt aura or taunt aura caster is dead standard target selection
target = GetThreatManager().getHostilTarget(); target = GetThreatManager().GetHostilTarget();
} }
else if (!HasReactState(ReactStates.Passive)) else if (!HasReactState(ReactStates.Passive))
{ {
+11 -11
View File
@@ -267,7 +267,7 @@ namespace Game.Entities
SetDisplayId(goInfo.displayId); SetDisplayId(goInfo.displayId);
m_model = CreateModel(); m_model = CreateModel();
if (m_model != null && m_model.isMapObject()) if (m_model != null && m_model.IsMapObject())
AddFlag(GameObjectFlags.MapObject); AddFlag(GameObjectFlags.MapObject);
// GAMEOBJECT_BYTES_1, index at 0, 1, 2 and 3 // GAMEOBJECT_BYTES_1, index at 0, 1, 2 and 3
@@ -759,7 +759,7 @@ namespace Game.Entities
return; return;
} }
loot.clear(); loot.Clear();
//! If this is summoned by a spell with ie. SPELL_EFFECT_SUMMON_OBJECT_WILD, with or without owner, we check respawn criteria based on spell //! If this is summoned by a spell with ie. SPELL_EFFECT_SUMMON_OBJECT_WILD, with or without owner, we check respawn criteria based on spell
//! The GetOwnerGUID() check is mostly for compatibility with hacky scripts - 99% of the time summoning should be done trough spells. //! The GetOwnerGUID() check is mostly for compatibility with hacky scripts - 99% of the time summoning should be done trough spells.
@@ -849,7 +849,7 @@ namespace Game.Entities
public void GetFishLoot(Loot fishloot, Player loot_owner) public void GetFishLoot(Loot fishloot, Player loot_owner)
{ {
fishloot.clear(); fishloot.Clear();
uint zone, subzone; uint zone, subzone;
uint defaultzone = 1; uint defaultzone = 1;
@@ -857,19 +857,19 @@ namespace Game.Entities
// if subzone loot exist use it // if subzone loot exist use it
fishloot.FillLoot(subzone, LootStorage.Fishing, loot_owner, true, true); fishloot.FillLoot(subzone, LootStorage.Fishing, loot_owner, true, true);
if (fishloot.empty()) if (fishloot.Empty())
{ {
//subzone no result,use zone loot //subzone no result,use zone loot
fishloot.FillLoot(zone, LootStorage.Fishing, loot_owner, true); fishloot.FillLoot(zone, LootStorage.Fishing, loot_owner, true);
//use zone 1 as default, somewhere fishing got nothing,becase subzone and zone not set, like Off the coast of Storm Peaks. //use zone 1 as default, somewhere fishing got nothing,becase subzone and zone not set, like Off the coast of Storm Peaks.
if (fishloot.empty()) if (fishloot.Empty())
fishloot.FillLoot(defaultzone, LootStorage.Fishing, loot_owner, true, true); fishloot.FillLoot(defaultzone, LootStorage.Fishing, loot_owner, true, true);
} }
} }
public void GetFishLootJunk(Loot fishloot, Player loot_owner) public void GetFishLootJunk(Loot fishloot, Player loot_owner)
{ {
fishloot.clear(); fishloot.Clear();
uint zone, subzone; uint zone, subzone;
uint defaultzone = 1; uint defaultzone = 1;
@@ -877,11 +877,11 @@ namespace Game.Entities
// if subzone loot exist use it // if subzone loot exist use it
fishloot.FillLoot(subzone, LootStorage.Fishing, loot_owner, true, true, LootModes.JunkFish); fishloot.FillLoot(subzone, LootStorage.Fishing, loot_owner, true, true, LootModes.JunkFish);
if (fishloot.empty()) //use this becase if zone or subzone has normal mask drop, then fishloot.FillLoot return true. if (fishloot.Empty()) //use this becase if zone or subzone has normal mask drop, then fishloot.FillLoot return true.
{ {
//use zone loot //use zone loot
fishloot.FillLoot(zone, LootStorage.Fishing, loot_owner, true, true, LootModes.JunkFish); fishloot.FillLoot(zone, LootStorage.Fishing, loot_owner, true, true, LootModes.JunkFish);
if (fishloot.empty()) if (fishloot.Empty())
//use zone 1 as default //use zone 1 as default
fishloot.FillLoot(defaultzone, LootStorage.Fishing, loot_owner, true, true, LootModes.JunkFish); fishloot.FillLoot(defaultzone, LootStorage.Fishing, loot_owner, true, true, LootModes.JunkFish);
} }
@@ -1479,7 +1479,7 @@ namespace Game.Entities
Group group = player.GetGroup(); Group group = player.GetGroup();
if (group) if (group)
{ {
for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.next()) for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next())
{ {
Player member = refe.GetSource(); Player member = refe.GetSource();
if (member) if (member)
@@ -2376,7 +2376,7 @@ namespace Game.Entities
if (m_model == null) if (m_model == null)
return; return;
m_model.enableCollision(enable); m_model.EnableCollision(enable);
} }
void UpdateModel() void UpdateModel()
@@ -2392,7 +2392,7 @@ namespace Game.Entities
if (m_model != null) if (m_model != null)
GetMap().InsertGameObjectModel(m_model); GetMap().InsertGameObjectModel(m_model);
if (m_model != null && m_model.isMapObject()) if (m_model != null && m_model.IsMapObject())
AddFlag(GameObjectFlags.MapObject); AddFlag(GameObjectFlags.MapObject);
else else
RemoveFlag(GameObjectFlags.MapObject); RemoveFlag(GameObjectFlags.MapObject);
+5 -5
View File
@@ -355,7 +355,7 @@ namespace Game.Entities
} }
// Delete the items if this is a container // Delete the items if this is a container
if (!loot.isLooted()) if (!loot.IsLooted())
ItemContainerDeleteLootMoneyAndLootItemsFromDB(); ItemContainerDeleteLootMoneyAndLootItemsFromDB();
Dispose(); Dispose();
@@ -642,7 +642,7 @@ namespace Game.Entities
DeleteFromDB(trans, GetGUID().GetCounter()); DeleteFromDB(trans, GetGUID().GetCounter());
// Delete the items if this is a container // Delete the items if this is a container
if (!loot.isLooted()) if (!loot.IsLooted())
ItemContainerDeleteLootMoneyAndLootItemsFromDB(); ItemContainerDeleteLootMoneyAndLootItemsFromDB();
} }
@@ -1707,7 +1707,7 @@ namespace Game.Entities
public void ItemContainerSaveLootToDB() public void ItemContainerSaveLootToDB()
{ {
// Saves the money and item loot associated with an openable item to the DB // Saves the money and item loot associated with an openable item to the DB
if (loot.isLooted()) // no money and no loot if (loot.IsLooted()) // no money and no loot
return; return;
SQLTransaction trans = new SQLTransaction(); SQLTransaction trans = new SQLTransaction();
@@ -1728,7 +1728,7 @@ namespace Game.Entities
} }
// Save items // Save items
if (!loot.isLooted()) if (!loot.IsLooted())
{ {
PreparedStatement stmt_items = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEMCONTAINER_ITEMS); PreparedStatement stmt_items = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEMCONTAINER_ITEMS);
stmt_items.AddValue(0, loot.containerID.GetCounter()); stmt_items.AddValue(0, loot.containerID.GetCounter());
@@ -1849,7 +1849,7 @@ namespace Game.Entities
} }
// Mark the item if it has loot so it won't be generated again on open // Mark the item if it has loot so it won't be generated again on open
m_lootGenerated = !loot.isLooted(); m_lootGenerated = !loot.IsLooted();
return m_lootGenerated; return m_lootGenerated;
} }
+4 -4
View File
@@ -1909,7 +1909,7 @@ namespace Game.Entities
else else
GetHitSpherePointFor(new Position(ox, oy, oz), out x, out y, out z); GetHitSpherePointFor(new Position(ox, oy, oz), out x, out y, out z);
return GetMap().isInLineOfSight(GetPhaseShift(), x, y, z + 2.0f, ox, oy, oz + 2.0f, ignoreFlags); return GetMap().IsInLineOfSight(GetPhaseShift(), x, y, z + 2.0f, ox, oy, oz + 2.0f, ignoreFlags);
} }
return true; return true;
@@ -2248,7 +2248,7 @@ namespace Game.Entities
return z; return z;
} }
LiquidData liquid_status; LiquidData liquid_status;
ZLiquidStatus res = obj.GetMap().getLiquidStatus(obj.GetPhaseShift(), x, y, z, MapConst.MapAllLiquidTypes, out liquid_status); ZLiquidStatus res = obj.GetMap().GetLiquidStatus(obj.GetPhaseShift(), x, y, z, MapConst.MapAllLiquidTypes, out liquid_status);
if (res != 0 && liquid_status.level > helper) // water must be above ground if (res != 0 && liquid_status.level > helper) // water must be above ground
{ {
if (liquid_status.level > z) // z is underwater if (liquid_status.level > z) // z is underwater
@@ -2274,7 +2274,7 @@ namespace Game.Entities
} }
float destz = NormalizeZforCollision(this, destx, desty, pos.GetPositionZ()); float destz = NormalizeZforCollision(this, destx, desty, pos.GetPositionZ());
bool col = Global.VMapMgr.getObjectHitPos(PhasingHandler.GetTerrainMapId(GetPhaseShift(), GetMap(), pos.posX, pos.posY), pos.posX, pos.posY, pos.posZ + 0.5f, destx, desty, destz + 0.5f, out destx, out desty, out destz, -0.5f); bool col = Global.VMapMgr.GetObjectHitPos(PhasingHandler.GetTerrainMapId(GetPhaseShift(), GetMap(), pos.posX, pos.posY), pos.posX, pos.posY, pos.posZ + 0.5f, destx, desty, destz + 0.5f, out destx, out desty, out destz, -0.5f);
// collision occured // collision occured
if (col) if (col)
@@ -2286,7 +2286,7 @@ namespace Game.Entities
} }
// check dynamic collision // check dynamic collision
col = GetMap().getObjectHitPos(GetPhaseShift(), pos.posX, pos.posY, pos.posZ + 0.5f, destx, desty, destz + 0.5f, out destx, out desty, out destz, -0.5f); col = GetMap().GetObjectHitPos(GetPhaseShift(), pos.posX, pos.posY, pos.posZ + 0.5f, destx, desty, destz + 0.5f, out destx, out desty, out destz, -0.5f);
// Collided with a gameobject // Collided with a gameobject
if (col) if (col)
+3 -3
View File
@@ -112,7 +112,7 @@ namespace Game.Entities
if (_group) if (_group)
{ {
// 2. In case when player is in group, initialize variables necessary for group calculations: // 2. In case when player is in group, initialize variables necessary for group calculations:
for (GroupReference refe = _group.GetFirstMember(); refe != null; refe = refe.next()) for (GroupReference refe = _group.GetFirstMember(); refe != null; refe = refe.Next())
{ {
Player member = refe.GetSource(); Player member = refe.GetSource();
if (member) if (member)
@@ -258,11 +258,11 @@ namespace Game.Entities
if (!_isBattleground) if (!_isBattleground)
{ {
// 3.1.2. Alter group rate if group is in raid (not for Battlegrounds). // 3.1.2. Alter group rate if group is in raid (not for Battlegrounds).
bool isRaid = !_isPvP && CliDB.MapStorage.LookupByKey(_killer.GetMapId()).IsRaid() && _group.isRaidGroup(); bool isRaid = !_isPvP && CliDB.MapStorage.LookupByKey(_killer.GetMapId()).IsRaid() && _group.IsRaidGroup();
_groupRate = Formulas.XPInGroupRate(_count, isRaid); _groupRate = Formulas.XPInGroupRate(_count, isRaid);
} }
// 3.1.3. Reward each group member (even dead or corpse) within reward distance. // 3.1.3. Reward each group member (even dead or corpse) within reward distance.
for (GroupReference refe = _group.GetFirstMember(); refe != null; refe = refe.next()) for (GroupReference refe = _group.GetFirstMember(); refe != null; refe = refe.Next())
{ {
Player member = refe.GetSource(); Player member = refe.GetSource();
if (member) if (member)
+1 -1
View File
@@ -58,7 +58,7 @@ namespace Game.Entities
Group group = GetGroup(); Group group = GetGroup();
if (group) if (group)
{ {
for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.next()) for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next())
{ {
Player player = refe.GetSource(); Player player = refe.GetSource();
if (!player) if (!player)
+1 -1
View File
@@ -3431,7 +3431,7 @@ namespace Game.Entities
// check if stats should only be saved on logout // check if stats should only be saved on logout
// save stats can be out of transaction // save stats can be out of transaction
if (GetSession().isLogingOut() || !WorldConfig.GetBoolValue(WorldCfg.StatsSaveOnlyOnLogout)) if (GetSession().IsLogingOut() || !WorldConfig.GetBoolValue(WorldCfg.StatsSaveOnlyOnLogout))
_SaveStats(trans); _SaveStats(trans);
DB.Characters.CommitTransaction(trans); DB.Characters.CommitTransaction(trans);
+22 -22
View File
@@ -32,7 +32,7 @@ namespace Game.Entities
List<Player> nearMembers = new List<Player>(); List<Player> nearMembers = new List<Player>();
for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.next()) for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next())
{ {
Player Target = refe.GetSource(); Player Target = refe.GetSource();
@@ -55,7 +55,7 @@ namespace Game.Entities
if (!grp) if (!grp)
return PartyResult.NotInGroup; return PartyResult.NotInGroup;
if (grp.isLFGGroup()) if (grp.IsLFGGroup())
{ {
ObjectGuid gguid = grp.GetGUID(); ObjectGuid gguid = grp.GetGUID();
if (Global.LFGMgr.GetKicksLeft(gguid) == 0) if (Global.LFGMgr.GetKicksLeft(gguid) == 0)
@@ -71,11 +71,11 @@ namespace Game.Entities
if (state == LfgState.FinishedDungeon) if (state == LfgState.FinishedDungeon)
return PartyResult.PartyLfgBootDungeonComplete; return PartyResult.PartyLfgBootDungeonComplete;
if (grp.isRollLootActive()) if (grp.IsRollLootActive())
return PartyResult.PartyLfgBootLootRolls; return PartyResult.PartyLfgBootLootRolls;
// @todo Should also be sent when anyone has recently left combat, with an aprox ~5 seconds timer. // @todo Should also be sent when anyone has recently left combat, with an aprox ~5 seconds timer.
for (GroupReference refe = grp.GetFirstMember(); refe != null; refe = refe.next()) for (GroupReference refe = grp.GetFirstMember(); refe != null; refe = refe.Next())
if (refe.GetSource() && refe.GetSource().IsInMap(this) && refe.GetSource().IsInCombat()) if (refe.GetSource() && refe.GetSource().IsInMap(this) && refe.GetSource().IsInCombat())
return PartyResult.PartyLfgBootInCombat; return PartyResult.PartyLfgBootInCombat;
@@ -106,10 +106,10 @@ namespace Game.Entities
bool InRandomLfgDungeon() bool InRandomLfgDungeon()
{ {
if (Global.LFGMgr.selectedRandomLfgDungeon(GetGUID())) if (Global.LFGMgr.SelectedRandomLfgDungeon(GetGUID()))
{ {
Map map = GetMap(); Map map = GetMap();
return Global.LFGMgr.inLfgDungeonMap(GetGUID(), map.GetId(), map.GetDifficultyID()); return Global.LFGMgr.InLfgDungeonMap(GetGUID(), map.GetId(), map.GetDifficultyID());
} }
return false; return false;
@@ -120,20 +120,20 @@ namespace Game.Entities
//we must move references from m_group to m_originalGroup //we must move references from m_group to m_originalGroup
SetOriginalGroup(GetGroup(), GetSubGroup()); SetOriginalGroup(GetGroup(), GetSubGroup());
m_group.unlink(); m_group.Unlink();
m_group.link(group, this); m_group.Link(group, this);
m_group.setSubGroup(subgroup); m_group.SetSubGroup(subgroup);
} }
public void RemoveFromBattlegroundOrBattlefieldRaid() public void RemoveFromBattlegroundOrBattlefieldRaid()
{ {
//remove existing reference //remove existing reference
m_group.unlink(); m_group.Unlink();
Group group = GetOriginalGroup(); Group group = GetOriginalGroup();
if (group) if (group)
{ {
m_group.link(group, this); m_group.Link(group, this);
m_group.setSubGroup(GetOriginalSubGroup()); m_group.SetSubGroup(GetOriginalSubGroup());
} }
SetOriginalGroup(null); SetOriginalGroup(null);
} }
@@ -141,22 +141,22 @@ namespace Game.Entities
public void SetOriginalGroup(Group group, byte subgroup = 0) public void SetOriginalGroup(Group group, byte subgroup = 0)
{ {
if (!group) if (!group)
m_originalGroup.unlink(); m_originalGroup.Unlink();
else else
{ {
m_originalGroup.link(group, this); m_originalGroup.Link(group, this);
m_originalGroup.setSubGroup(subgroup); m_originalGroup.SetSubGroup(subgroup);
} }
} }
public void SetGroup(Group group, byte subgroup = 0) public void SetGroup(Group group, byte subgroup = 0)
{ {
if (!group) if (!group)
m_group.unlink(); m_group.Unlink();
else else
{ {
m_group.link(group, this); m_group.Link(group, this);
m_group.setSubGroup(subgroup); m_group.SetSubGroup(subgroup);
} }
UpdateObjectVisibility(false); UpdateObjectVisibility(false);
@@ -206,16 +206,16 @@ namespace Game.Entities
public Group GetGroupInvite() { return m_groupInvite; } public Group GetGroupInvite() { return m_groupInvite; }
public void SetGroupInvite(Group group) { m_groupInvite = group; } public void SetGroupInvite(Group group) { m_groupInvite = group; }
public Group GetGroup() { return m_group.getTarget(); } public Group GetGroup() { return m_group.GetTarget(); }
public GroupReference GetGroupRef() { return m_group; } public GroupReference GetGroupRef() { return m_group; }
public byte GetSubGroup() { return m_group.getSubGroup(); } public byte GetSubGroup() { return m_group.GetSubGroup(); }
public GroupUpdateFlags GetGroupUpdateFlag() { return m_groupUpdateMask; } public GroupUpdateFlags GetGroupUpdateFlag() { return m_groupUpdateMask; }
public void SetGroupUpdateFlag(GroupUpdateFlags flag) { m_groupUpdateMask |= flag; } public void SetGroupUpdateFlag(GroupUpdateFlags flag) { m_groupUpdateMask |= flag; }
public void RemoveGroupUpdateFlag(GroupUpdateFlags flag) { m_groupUpdateMask &= ~flag; } public void RemoveGroupUpdateFlag(GroupUpdateFlags flag) { m_groupUpdateMask &= ~flag; }
public Group GetOriginalGroup() { return m_originalGroup.getTarget(); } public Group GetOriginalGroup() { return m_originalGroup.GetTarget(); }
public GroupReference GetOriginalGroupRef() { return m_originalGroup; } public GroupReference GetOriginalGroupRef() { return m_originalGroup; }
public byte GetOriginalSubGroup() { return m_originalGroup.getSubGroup(); } public byte GetOriginalSubGroup() { return m_originalGroup.GetSubGroup(); }
public void SetPassOnGroupLoot(bool bPassOnGroupLoot) { m_bPassOnGroupLoot = bPassOnGroupLoot; } public void SetPassOnGroupLoot(bool bPassOnGroupLoot) { m_bPassOnGroupLoot = bPassOnGroupLoot; }
public bool GetPassOnGroupLoot() { return m_bPassOnGroupLoot; } public bool GetPassOnGroupLoot() { return m_bPassOnGroupLoot; }
+12 -12
View File
@@ -3309,12 +3309,12 @@ namespace Game.Entities
public InventoryResult CanRollForItemInLFG(ItemTemplate proto, WorldObject lootedObject) public InventoryResult CanRollForItemInLFG(ItemTemplate proto, WorldObject lootedObject)
{ {
if (!GetGroup() || !GetGroup().isLFGGroup()) if (!GetGroup() || !GetGroup().IsLFGGroup())
return InventoryResult.Ok; // not in LFG group return InventoryResult.Ok; // not in LFG group
// check if looted object is inside the lfg dungeon // check if looted object is inside the lfg dungeon
Map map = lootedObject.GetMap(); Map map = lootedObject.GetMap();
if (!Global.LFGMgr.inLfgDungeonMap(GetGroup().GetGUID(), map.GetId(), map.GetDifficultyID())) if (!Global.LFGMgr.InLfgDungeonMap(GetGroup().GetGUID(), map.GetId(), map.GetDifficultyID()))
return InventoryResult.Ok; return InventoryResult.Ok;
if (proto == null) if (proto == null)
@@ -5138,7 +5138,7 @@ namespace Game.Entities
return InventoryResult.NotInCombat; return InventoryResult.NotInCombat;
Battleground bg = GetBattleground(); Battleground bg = GetBattleground();
if (bg) if (bg)
if (bg.isArena() && bg.GetStatus() == BattlegroundStatus.InProgress) if (bg.IsArena() && bg.GetStatus() == BattlegroundStatus.InProgress)
return InventoryResult.NotDuringArenaMatch; return InventoryResult.NotDuringArenaMatch;
} }
@@ -5371,7 +5371,7 @@ namespace Game.Entities
return InventoryResult.NotInCombat; return InventoryResult.NotInCombat;
Battleground bg = GetBattleground(); Battleground bg = GetBattleground();
if (bg) if (bg)
if (bg.isArena() && bg.GetStatus() == BattlegroundStatus.InProgress) if (bg.IsArena() && bg.GetStatus() == BattlegroundStatus.InProgress)
return InventoryResult.NotDuringArenaMatch; return InventoryResult.NotDuringArenaMatch;
} }
@@ -6235,7 +6235,7 @@ 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)
@@ -6253,7 +6253,7 @@ namespace Game.Entities
if (lootid != 0) if (lootid != 0)
{ {
loot.clear(); loot.Clear();
Group group = GetGroup(); Group group = GetGroup();
bool groupRules = (group && go.GetGoInfo().type == GameObjectTypes.Chest && go.GetGoInfo().Chest.usegrouplootrules != 0); bool groupRules = (group && go.GetGoInfo().type == GameObjectTypes.Chest && go.GetGoInfo().Chest.usegrouplootrules != 0);
@@ -6274,7 +6274,7 @@ namespace Game.Entities
{ {
GameObjectTemplateAddon addon = go.GetTemplateAddon(); GameObjectTemplateAddon addon = go.GetTemplateAddon();
if (addon != null) if (addon != null)
loot.generateMoneyLoot(addon.mingold, addon.maxgold); loot.GenerateMoneyLoot(addon.mingold, addon.maxgold);
} }
if (loot_type == LootType.Fishing) if (loot_type == LootType.Fishing)
@@ -6346,7 +6346,7 @@ namespace Game.Entities
if (!item.m_lootGenerated && !item.ItemContainerLoadLootFromDB()) if (!item.m_lootGenerated && !item.ItemContainerLoadLootFromDB())
{ {
item.m_lootGenerated = true; item.m_lootGenerated = true;
loot.clear(); loot.Clear();
switch (loot_type) switch (loot_type)
{ {
@@ -6360,7 +6360,7 @@ namespace Game.Entities
loot.FillLoot(item.GetEntry(), LootStorage.Milling, this, true); loot.FillLoot(item.GetEntry(), LootStorage.Milling, this, true);
break; break;
default: default:
loot.generateMoneyLoot(item.GetTemplate().MinMoneyLoot, item.GetTemplate().MaxMoneyLoot); loot.GenerateMoneyLoot(item.GetTemplate().MinMoneyLoot, item.GetTemplate().MaxMoneyLoot);
loot.FillLoot(item.GetEntry(), LootStorage.Items, this, true, loot.gold != 0); loot.FillLoot(item.GetEntry(), LootStorage.Items, this, true, loot.gold != 0);
// Force save the loot and money items that were just rolled // Force save the loot and money items that were just rolled
@@ -6387,7 +6387,7 @@ namespace Game.Entities
if (loot.loot_type == LootType.None) if (loot.loot_type == LootType.None)
{ {
uint pLevel = bones.loot.gold; uint pLevel = bones.loot.gold;
bones.loot.clear(); bones.loot.Clear();
// For AV Achievement // For AV Achievement
Battleground bg = GetBattleground(); Battleground bg = GetBattleground();
@@ -6435,7 +6435,7 @@ namespace Game.Entities
if (creature.CanGeneratePickPocketLoot()) if (creature.CanGeneratePickPocketLoot())
{ {
creature.StartPickPocketRefillTimer(); creature.StartPickPocketRefillTimer();
loot.clear(); loot.Clear();
uint lootid = creature.GetCreatureTemplate().PickPocketId; uint lootid = creature.GetCreatureTemplate().PickPocketId;
if (lootid != 0) if (lootid != 0)
@@ -6500,7 +6500,7 @@ namespace Game.Entities
} }
else if (loot_type == LootType.Skinning) else if (loot_type == LootType.Skinning)
{ {
loot.clear(); loot.Clear();
loot.FillLoot(creature.GetCreatureTemplate().SkinLootId, LootStorage.Skinning, this, true); loot.FillLoot(creature.GetCreatureTemplate().SkinLootId, LootStorage.Skinning, this, true);
permission = PermissionTypes.Owner; permission = PermissionTypes.Owner;
+2 -2
View File
@@ -537,7 +537,7 @@ namespace Game.Entities
// raid instances require the player to be in a raid group to be valid // raid instances require the player to be in a raid group to be valid
if (map.IsRaid() && !WorldConfig.GetBoolValue(WorldCfg.InstanceIgnoreRaid) && (map.GetEntry().Expansion() >= (Expansion)WorldConfig.GetIntValue(WorldCfg.Expansion))) if (map.IsRaid() && !WorldConfig.GetBoolValue(WorldCfg.InstanceIgnoreRaid) && (map.GetEntry().Expansion() >= (Expansion)WorldConfig.GetIntValue(WorldCfg.Expansion)))
if (!GetGroup() || !GetGroup().isRaidGroup()) if (!GetGroup() || !GetGroup().IsRaidGroup())
return false; return false;
Group group = GetGroup(); Group group = GetGroup();
@@ -715,7 +715,7 @@ namespace Game.Entities
public override void UpdateUnderwaterState(Map m, float x, float y, float z) public override void UpdateUnderwaterState(Map m, float x, float y, float z)
{ {
LiquidData liquid_status; LiquidData liquid_status;
ZLiquidStatus res = m.getLiquidStatus(GetPhaseShift(), x, y, z, MapConst.MapAllLiquidTypes, out liquid_status); ZLiquidStatus res = m.GetLiquidStatus(GetPhaseShift(), x, y, z, MapConst.MapAllLiquidTypes, out liquid_status);
if (res == 0) if (res == 0)
{ {
m_MirrorTimerFlags &= ~(PlayerUnderwaterState.InWater | PlayerUnderwaterState.InLava | PlayerUnderwaterState.InSlime | PlayerUnderwaterState.InDarkWater); m_MirrorTimerFlags &= ~(PlayerUnderwaterState.InWater | PlayerUnderwaterState.InLava | PlayerUnderwaterState.InSlime | PlayerUnderwaterState.InDarkWater);
+4 -4
View File
@@ -85,7 +85,7 @@ namespace Game.Entities
UpdateHonorFields(); UpdateHonorFields();
// do not reward honor in arenas, but return true to enable onkill spellproc // do not reward honor in arenas, but return true to enable onkill spellproc
if (InBattleground() && GetBattleground() && GetBattleground().isArena()) if (InBattleground() && GetBattleground() && GetBattleground().IsArena())
return true; return true;
// Promote to float for calculations // Promote to float for calculations
@@ -132,7 +132,7 @@ namespace Game.Entities
else else
victim_guid.Clear(); // Don't show HK: <rank> message, only log. victim_guid.Clear(); // Don't show HK: <rank> message, only log.
honor_f = (float)Math.Ceiling(Formulas.hk_honor_at_level_f(k_level) * (v_level - k_grey) / (k_level - k_grey)); honor_f = (float)Math.Ceiling(Formulas.HKHonorAtLevelF(k_level) * (v_level - k_grey) / (k_level - k_grey));
// count the number of playerkills in one day // count the number of playerkills in one day
ApplyModUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.TodayHonorableKills), (ushort)1, true); ApplyModUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.TodayHonorableKills), (ushort)1, true);
@@ -729,7 +729,7 @@ namespace Game.Entities
bg.RemovePlayerAtLeave(GetGUID(), teleportToEntryPoint, true); bg.RemovePlayerAtLeave(GetGUID(), teleportToEntryPoint, true);
// call after remove to be sure that player resurrected for correct cast // call after remove to be sure that player resurrected for correct cast
if (bg.isBattleground() && !IsGameMaster() && WorldConfig.GetBoolValue(WorldCfg.BattlegroundCastDeserter)) if (bg.IsBattleground() && !IsGameMaster() && WorldConfig.GetBoolValue(WorldCfg.BattlegroundCastDeserter))
{ {
if (bg.GetStatus() == BattlegroundStatus.InProgress || bg.GetStatus() == BattlegroundStatus.WaitJoin) if (bg.GetStatus() == BattlegroundStatus.InProgress || bg.GetStatus() == BattlegroundStatus.WaitJoin)
{ {
@@ -752,7 +752,7 @@ namespace Game.Entities
if (HasAura(26013)) if (HasAura(26013))
return false; return false;
if (bg.isArena() && !GetSession().HasPermission(RBACPermissions.JoinArenas)) if (bg.IsArena() && !GetSession().HasPermission(RBACPermissions.JoinArenas))
return false; return false;
if (bg.IsRandom() && !GetSession().HasPermission(RBACPermissions.JoinRandomBg)) if (bg.IsRandom() && !GetSession().HasPermission(RBACPermissions.JoinRandomBg))
+6 -6
View File
@@ -580,7 +580,7 @@ namespace Game.Entities
{ {
case TypeId.Unit: case TypeId.Unit:
Global.ScriptMgr.OnQuestAccept(this, (questGiver.ToCreature()), quest); Global.ScriptMgr.OnQuestAccept(this, (questGiver.ToCreature()), quest);
questGiver.ToCreature().GetAI().sQuestAccept(this, quest); questGiver.ToCreature().GetAI().QuestAccept(this, quest);
break; break;
case TypeId.Item: case TypeId.Item:
case TypeId.Container: case TypeId.Container:
@@ -2077,7 +2077,7 @@ namespace Game.Entities
var group = GetGroup(); var group = GetGroup();
if (group) if (group)
{ {
for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.next()) for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next())
{ {
Player player = refe.GetSource(); Player player = refe.GetSource();
@@ -2216,7 +2216,7 @@ namespace Game.Entities
// just if !ingroup || !noraidgroup || raidgroup // just if !ingroup || !noraidgroup || raidgroup
QuestStatusData q_status = m_QuestStatus[questid]; QuestStatusData q_status = m_QuestStatus[questid];
if (q_status.Status == QuestStatus.Incomplete && (GetGroup() == null || !GetGroup().isRaidGroup() || qInfo.IsAllowedInRaid(GetMap().GetDifficultyID()))) if (q_status.Status == QuestStatus.Incomplete && (GetGroup() == null || !GetGroup().IsRaidGroup() || qInfo.IsAllowedInRaid(GetMap().GetDifficultyID())))
{ {
if (qInfo.HasSpecialFlag(QuestSpecialFlags.Kill))// && !qInfo.HasSpecialFlag(QuestSpecialFlags.Cast)) if (qInfo.HasSpecialFlag(QuestSpecialFlags.Kill))// && !qInfo.HasSpecialFlag(QuestSpecialFlags.Cast))
{ {
@@ -2263,7 +2263,7 @@ namespace Game.Entities
// just if !ingroup || !noraidgroup || raidgroup // just if !ingroup || !noraidgroup || raidgroup
QuestStatusData q_status = m_QuestStatus[questid]; QuestStatusData q_status = m_QuestStatus[questid];
if (q_status.Status == QuestStatus.Incomplete && (GetGroup() == null || !GetGroup().isRaidGroup() || qInfo.IsAllowedInRaid(GetMap().GetDifficultyID()))) if (q_status.Status == QuestStatus.Incomplete && (GetGroup() == null || !GetGroup().IsRaidGroup() || qInfo.IsAllowedInRaid(GetMap().GetDifficultyID())))
{ {
foreach (QuestObjective obj in qInfo.Objectives) foreach (QuestObjective obj in qInfo.Objectives)
{ {
@@ -2550,7 +2550,7 @@ namespace Game.Entities
continue; continue;
// hide quest if player is in raid-group and quest is no raid quest // hide quest if player is in raid-group and quest is no raid quest
if (GetGroup() != null && GetGroup().isRaidGroup() && !qInfo.IsAllowedInRaid(GetMap().GetDifficultyID())) if (GetGroup() != null && GetGroup().IsRaidGroup() && !qInfo.IsAllowedInRaid(GetMap().GetDifficultyID()))
if (!InBattleground()) //there are two ways.. we can make every bg-quest a raidquest, or add this code here.. i don't know if this can be exploited by other quests, but i think all other quests depend on a specific area.. but keep this in mind, if something strange happens later if (!InBattleground()) //there are two ways.. we can make every bg-quest a raidquest, or add this code here.. i don't know if this can be exploited by other quests, but i think all other quests depend on a specific area.. but keep this in mind, if something strange happens later
continue; continue;
@@ -2943,7 +2943,7 @@ namespace Game.Entities
if (qInfo == null) if (qInfo == null)
continue; continue;
if (GetGroup() != null && GetGroup().isRaidGroup() && !qInfo.IsAllowedInRaid(GetMap().GetDifficultyID())) if (GetGroup() != null && GetGroup().IsRaidGroup() && !qInfo.IsAllowedInRaid(GetMap().GetDifficultyID()))
continue; continue;
foreach (QuestObjective obj in qInfo.Objectives) foreach (QuestObjective obj in qInfo.Objectives)
+4 -4
View File
@@ -1529,7 +1529,7 @@ namespace Game.Entities
spell.m_fromClient = true; spell.m_fromClient = true;
spell.m_CastItem = item; spell.m_CastItem = item;
spell.SetSpellValue(SpellValueMod.BasePoint0, (int)learning_spell_id); spell.SetSpellValue(SpellValueMod.BasePoint0, (int)learning_spell_id);
spell.prepare(targets); spell.Prepare(targets);
return; return;
} }
} }
@@ -1565,7 +1565,7 @@ namespace Game.Entities
spell.m_CastItem = item; spell.m_CastItem = item;
spell.m_misc.Data0 = misc[0]; spell.m_misc.Data0 = misc[0];
spell.m_misc.Data1 = misc[1]; spell.m_misc.Data1 = misc[1];
spell.prepare(targets); spell.Prepare(targets);
return; return;
} }
@@ -1599,7 +1599,7 @@ namespace Game.Entities
spell.m_CastItem = item; spell.m_CastItem = item;
spell.m_misc.Data0 = misc[0]; spell.m_misc.Data0 = misc[0];
spell.m_misc.Data1 = misc[1]; spell.m_misc.Data1 = misc[1];
spell.prepare(targets); spell.Prepare(targets);
return; return;
} }
} }
@@ -1697,7 +1697,7 @@ namespace Game.Entities
{ {
Spell spell = GetCurrentSpell(i); Spell spell = GetCurrentSpell(i);
if (spell != null) if (spell != null)
if (spell.getState() != SpellState.Delayed && !HasItemFitToSpellRequirements(spell.m_spellInfo, pItem)) if (spell.GetState() != SpellState.Delayed && !HasItemFitToSpellRequirements(spell.m_spellInfo, pItem))
InterruptSpell(i); InterruptSpell(i);
} }
} }
+15 -15
View File
@@ -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;
@@ -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)
{ {
@@ -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,7 +2235,7 @@ 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);
} }
@@ -3652,9 +3652,9 @@ namespace Game.Entities
return false; return false;
Loot loot = creature.loot; Loot loot = creature.loot;
if (loot.isLooted()) // nothing to loot or everything looted. if (loot.IsLooted()) // nothing to loot or everything looted.
return false; return false;
if (!loot.hasItemForAll() && !loot.hasItemFor(this)) // no loot in creature for this player if (!loot.HasItemForAll() && !loot.HasItemFor(this)) // no loot in creature for this player
return false; return false;
if (loot.loot_type == LootType.Skinning) if (loot.loot_type == LootType.Skinning)
@@ -3680,10 +3680,10 @@ namespace Game.Entities
if (loot.roundRobinPlayer.IsEmpty() || loot.roundRobinPlayer == GetGUID()) if (loot.roundRobinPlayer.IsEmpty() || loot.roundRobinPlayer == GetGUID())
return true; return true;
if (loot.hasOverThresholdItem()) if (loot.HasOverThresholdItem())
return true; return true;
return loot.hasItemFor(this); return loot.HasItemFor(this);
} }
return false; return false;
@@ -4241,7 +4241,7 @@ namespace Game.Entities
SetHealth(1); SetHealth(1);
SetWaterWalking(true); SetWaterWalking(true);
if (!GetSession().isLogingOut() && !HasUnitState(UnitState.Stunned)) if (!GetSession().IsLogingOut() && !HasUnitState(UnitState.Stunned))
SetRooted(false); SetRooted(false);
// BG - remove insignia related // BG - remove insignia related
@@ -4966,7 +4966,7 @@ namespace Game.Entities
public bool InArena() public bool InArena()
{ {
Battleground bg = GetBattleground(); Battleground bg = GetBattleground();
if (!bg || !bg.isArena()) if (!bg || !bg.IsArena())
return false; return false;
return true; return true;
@@ -6732,7 +6732,7 @@ namespace Game.Entities
} }
// not let cheating with start flight in time of logout process || while in combat || has type state: stunned || has type state: root // not let cheating with start flight in time of logout process || while in combat || has type state: stunned || has type state: root
if (GetSession().isLogingOut() || IsInCombat() || HasUnitState(UnitState.Stunned) || HasUnitState(UnitState.Root)) if (GetSession().IsLogingOut() || IsInCombat() || HasUnitState(UnitState.Stunned) || HasUnitState(UnitState.Root))
{ {
GetSession().SendActivateTaxiReply(ActivateTaxiReply.PlayerBusy); GetSession().SendActivateTaxiReply(ActivateTaxiReply.PlayerBusy);
return false; return false;
@@ -6924,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()
@@ -6987,7 +6987,7 @@ namespace Game.Entities
Group group = GetGroup(); Group group = GetGroup();
if (group) if (group)
{ {
for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.next()) for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next())
{ {
Player player = refe.GetSource(); Player player = refe.GetSource();
if (!player) if (!player)
+1 -1
View File
@@ -131,7 +131,7 @@ namespace Game.Entities
Group group = owner.GetGroup(); Group group = owner.GetGroup();
if (group) if (group)
{ {
for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.next()) for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next())
{ {
Player target = refe.GetSource(); Player target = refe.GetSource();
if (target && target.IsInMap(owner) && group.SameSubGroup(owner, target)) if (target && target.IsInMap(owner) && group.SameSubGroup(owner, target))
+26 -26
View File
@@ -43,10 +43,10 @@ namespace Game.Entities
// Search in threat list // Search in threat list
ObjectGuid guid = who.GetGUID(); ObjectGuid guid = who.GetGUID();
foreach (var refe in GetThreatManager().getThreatList()) foreach (var refe in GetThreatManager().GetThreatList())
{ {
// Return true if the unit matches // Return true if the unit matches
if (refe != null && refe.getUnitGuid() == guid) if (refe != null && refe.GetUnitGuid() == guid)
return true; return true;
} }
@@ -60,18 +60,18 @@ namespace Game.Entities
public void SendChangeCurrentVictim(HostileReference pHostileReference) public void SendChangeCurrentVictim(HostileReference pHostileReference)
{ {
if (!GetThreatManager().isThreatListEmpty()) if (!GetThreatManager().IsThreatListEmpty())
{ {
HighestThreatUpdate packet = new HighestThreatUpdate(); HighestThreatUpdate packet = new HighestThreatUpdate();
packet.UnitGUID = GetGUID(); packet.UnitGUID = GetGUID();
packet.HighestThreatGUID = pHostileReference.getUnitGuid(); packet.HighestThreatGUID = pHostileReference.GetUnitGuid();
var refeList = GetThreatManager().getThreatList(); var refeList = GetThreatManager().GetThreatList();
foreach (var refe in refeList) foreach (var refe in refeList)
{ {
ThreatInfo info = new ThreatInfo(); ThreatInfo info = new ThreatInfo();
info.UnitGUID = refe.getUnitGuid(); info.UnitGUID = refe.GetUnitGuid();
info.Threat = (long)refe.getThreat() * 100; info.Threat = (long)refe.GetThreat() * 100;
packet.ThreatList.Add(info); packet.ThreatList.Add(info);
} }
SendMessageToSet(packet, false); SendMessageToSet(packet, false);
@@ -108,7 +108,7 @@ namespace Game.Entities
++i; ++i;
} }
GetHostileRefManager().deleteReferencesForFaction(factionId); GetHostileRefManager().DeleteReferencesForFaction(factionId);
foreach (var control in m_Controlled) foreach (var control in m_Controlled)
control.StopAttackFaction(factionId); control.StopAttackFaction(factionId);
@@ -136,22 +136,22 @@ namespace Game.Entities
{ {
ThreatRemove packet = new ThreatRemove(); ThreatRemove packet = new ThreatRemove();
packet.UnitGUID = GetGUID(); packet.UnitGUID = GetGUID();
packet.AboutGUID = pHostileReference.getUnitGuid(); packet.AboutGUID = pHostileReference.GetUnitGuid();
SendMessageToSet(packet, false); SendMessageToSet(packet, false);
} }
void SendThreatListUpdate() void SendThreatListUpdate()
{ {
if (!GetThreatManager().isThreatListEmpty()) if (!GetThreatManager().IsThreatListEmpty())
{ {
ThreatUpdate packet = new ThreatUpdate(); ThreatUpdate packet = new ThreatUpdate();
packet.UnitGUID = GetGUID(); packet.UnitGUID = GetGUID();
var tlist = GetThreatManager().getThreatList(); var tlist = GetThreatManager().GetThreatList();
foreach (var refe in tlist) foreach (var refe in tlist)
{ {
ThreatInfo info = new ThreatInfo(); ThreatInfo info = new ThreatInfo();
info.UnitGUID = refe.getUnitGuid(); info.UnitGUID = refe.GetUnitGuid();
info.Threat = (long)refe.getThreat() * 100; info.Threat = (long)refe.GetThreat() * 100;
packet.ThreatList.Add(info); packet.ThreatList.Add(info);
} }
SendMessageToSet(packet, false); SendMessageToSet(packet, false);
@@ -160,9 +160,9 @@ namespace Game.Entities
public void DeleteThreatList() public void DeleteThreatList()
{ {
if (CanHaveThreatList(true) && !threatManager.isThreatListEmpty()) if (CanHaveThreatList(true) && !threatManager.IsThreatListEmpty())
SendClearThreatList(); SendClearThreatList();
threatManager.clearReferences(); threatManager.ClearReferences();
} }
public void TauntApply(Unit taunter) public void TauntApply(Unit taunter)
@@ -208,7 +208,7 @@ namespace Game.Entities
if (!target || target != taunter) if (!target || target != taunter)
return; return;
if (threatManager.isThreatListEmpty()) if (threatManager.IsThreatListEmpty())
{ {
if (creature.IsAIEnabled) if (creature.IsAIEnabled)
creature.GetAI().EnterEvadeMode(EvadeReason.NoHostiles); creature.GetAI().EnterEvadeMode(EvadeReason.NoHostiles);
@@ -326,7 +326,7 @@ namespace Game.Entities
{ {
// Only mobs can manage threat lists // Only mobs can manage threat lists
if (CanHaveThreatList() && !HasUnitState(UnitState.Evade)) if (CanHaveThreatList() && !HasUnitState(UnitState.Evade))
threatManager.addThreat(victim, fThreat, schoolMask, threatSpell); threatManager.AddThreat(victim, fThreat, schoolMask, threatSpell);
} }
public float ApplyTotalThreatModifier(float fThreat, SpellSchoolMask schoolMask = SpellSchoolMask.Normal) public float ApplyTotalThreatModifier(float fThreat, SpellSchoolMask schoolMask = SpellSchoolMask.Normal)
{ {
@@ -601,7 +601,7 @@ namespace Game.Entities
// melee attack spell casted at main hand attack only - no normal melee dmg dealt // melee attack spell casted at main hand attack only - no normal melee dmg dealt
if (attType == WeaponAttackType.BaseAttack && GetCurrentSpell(CurrentSpellTypes.Melee) != null && !extra) if (attType == WeaponAttackType.BaseAttack && GetCurrentSpell(CurrentSpellTypes.Melee) != null && !extra)
m_currentSpells[CurrentSpellTypes.Melee].cast(); m_currentSpells[CurrentSpellTypes.Melee].Cast();
else else
{ {
// attack can be redirected to another target // attack can be redirected to another target
@@ -975,7 +975,7 @@ namespace Game.Entities
Spell spell = victim.GetCurrentSpell(CurrentSpellTypes.Generic); Spell spell = victim.GetCurrentSpell(CurrentSpellTypes.Generic);
if (spell) if (spell)
{ {
if (spell.getState() == SpellState.Preparing) if (spell.GetState() == SpellState.Preparing)
{ {
SpellInterruptFlags interruptFlags = spell.m_spellInfo.InterruptFlags; SpellInterruptFlags interruptFlags = spell.m_spellInfo.InterruptFlags;
if (interruptFlags.HasAnyFlag(SpellInterruptFlags.AbortOnDmg)) if (interruptFlags.HasAnyFlag(SpellInterruptFlags.AbortOnDmg))
@@ -1143,7 +1143,7 @@ namespace Game.Entities
{ {
Spell spell = victim.GetCurrentSpell(CurrentSpellTypes.Generic); Spell spell = victim.GetCurrentSpell(CurrentSpellTypes.Generic);
if (spell != null) if (spell != null)
if (spell.getState() == SpellState.Preparing) if (spell.GetState() == SpellState.Preparing)
{ {
var interruptFlags = spell.m_spellInfo.InterruptFlags; var interruptFlags = spell.m_spellInfo.InterruptFlags;
if (interruptFlags.HasAnyFlag(SpellInterruptFlags.AbortOnDmg)) if (interruptFlags.HasAnyFlag(SpellInterruptFlags.AbortOnDmg))
@@ -1154,7 +1154,7 @@ namespace Game.Entities
} }
Spell spell1 = victim.GetCurrentSpell(CurrentSpellTypes.Channeled); Spell spell1 = victim.GetCurrentSpell(CurrentSpellTypes.Channeled);
if (spell1 != null) if (spell1 != null)
if (spell1.getState() == SpellState.Casting && spell1.m_spellInfo.HasChannelInterruptFlag(SpellChannelInterruptFlags.Delay) && damagetype != DamageEffectType.DOT) if (spell1.GetState() == SpellState.Casting && spell1.m_spellInfo.HasChannelInterruptFlag(SpellChannelInterruptFlags.Delay) && damagetype != DamageEffectType.DOT)
spell1.DelayedChannel(); spell1.DelayedChannel();
} }
} }
@@ -1474,13 +1474,13 @@ namespace Game.Entities
{ {
Loot loot = creature.loot; Loot loot = creature.loot;
loot.clear(); loot.Clear();
uint lootid = creature.GetCreatureTemplate().LootId; uint lootid = creature.GetCreatureTemplate().LootId;
if (lootid != 0) if (lootid != 0)
loot.FillLoot(lootid, LootStorage.Creature, looter, false, false, creature.GetLootMode()); loot.FillLoot(lootid, LootStorage.Creature, looter, false, false, creature.GetLootMode());
if (creature.GetLootMode() > 0) if (creature.GetLootMode() > 0)
loot.generateMoneyLoot(creature.GetCreatureTemplate().MinGold, creature.GetCreatureTemplate().MaxGold); loot.GenerateMoneyLoot(creature.GetCreatureTemplate().MinGold, creature.GetCreatureTemplate().MaxGold);
if (group) if (group)
{ {
@@ -1490,7 +1490,7 @@ namespace Game.Entities
group.SendLooter(creature, null); group.SendLooter(creature, null);
// Update round robin looter only if the creature had loot // Update round robin looter only if the creature had loot
if (!loot.empty()) if (!loot.Empty())
group.UpdateLooterGuid(creature); group.UpdateLooterGuid(creature);
} }
} }
@@ -1572,7 +1572,7 @@ namespace Game.Entities
creature.DeleteThreatList(); creature.DeleteThreatList();
// must be after setDeathState which resets dynamic flags // must be after setDeathState which resets dynamic flags
if (!creature.loot.isLooted()) if (!creature.loot.IsLooted())
creature.AddDynamicFlag(UnitDynFlags.Lootable); creature.AddDynamicFlag(UnitDynFlags.Lootable);
else else
creature.AllLootRemovedFromCorpse(); creature.AllLootRemovedFromCorpse();
@@ -1798,7 +1798,7 @@ namespace Game.Entities
List<Unit> nearMembers = new List<Unit>(); List<Unit> nearMembers = new List<Unit>();
// reserve place for players and pets because resizing vector every unit push is unefficient (vector is reallocated then) // reserve place for players and pets because resizing vector every unit push is unefficient (vector is reallocated then)
for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.next()) for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next())
{ {
Player target = refe.GetSource(); Player target = refe.GetSource();
if (target) if (target)
+1 -1
View File
@@ -40,7 +40,7 @@ namespace Game.Entities
//Movement //Movement
protected float[] m_speed_rate = new float[(int)UnitMoveType.Max]; protected float[] m_speed_rate = new float[(int)UnitMoveType.Max];
RefManager<Unit, TargetedMovementGeneratorBase> m_FollowingRefManager; RefManager<Unit, ITargetedMovementGeneratorBase> m_FollowingRefManager;
public MoveSpline MoveSpline { get; set; } public MoveSpline MoveSpline { get; set; }
MotionMaster i_motionMaster; MotionMaster i_motionMaster;
public uint m_movementCounter; //< Incrementing counter used in movement packets public uint m_movementCounter; //< Incrementing counter used in movement packets
+6 -6
View File
@@ -46,7 +46,7 @@ namespace Game.Entities
public bool IsFlying() { return m_movementInfo.HasMovementFlag(MovementFlag.Flying | MovementFlag.DisableGravity); } public bool IsFlying() { return m_movementInfo.HasMovementFlag(MovementFlag.Flying | MovementFlag.DisableGravity); }
public bool IsFalling() public bool IsFalling()
{ {
return m_movementInfo.HasMovementFlag(MovementFlag.Falling | MovementFlag.FallingFar) || MoveSpline.isFalling(); return m_movementInfo.HasMovementFlag(MovementFlag.Falling | MovementFlag.FallingFar) || MoveSpline.IsFalling();
} }
public virtual bool CanSwim() public virtual bool CanSwim()
{ {
@@ -68,7 +68,7 @@ namespace Game.Entities
return GetMap().IsUnderWater(GetPhaseShift(), GetPositionX(), GetPositionY(), GetPositionZ()); return GetMap().IsUnderWater(GetPhaseShift(), GetPositionX(), GetPositionY(), GetPositionZ());
} }
void PropagateSpeedChange() { GetMotionMaster().propagateSpeedChange(); } void PropagateSpeedChange() { GetMotionMaster().PropagateSpeedChange(); }
public float GetSpeed(UnitMoveType mtype) public float GetSpeed(UnitMoveType mtype)
{ {
@@ -679,7 +679,7 @@ namespace Game.Entities
} }
LiquidData liquid; LiquidData liquid;
ZLiquidStatus liquidStatus = GetMap().getLiquidStatus(GetPhaseShift(), GetPositionX(), GetPositionY(), GetPositionZ(), MapConst.MapAllLiquidTypes, out liquid); ZLiquidStatus liquidStatus = GetMap().GetLiquidStatus(GetPhaseShift(), GetPositionX(), GetPositionY(), GetPositionZ(), MapConst.MapAllLiquidTypes, out liquid);
isSubmerged = liquidStatus.HasAnyFlag(ZLiquidStatus.UnderWater) || HasUnitMovementFlag(MovementFlag.Swimming); isSubmerged = liquidStatus.HasAnyFlag(ZLiquidStatus.UnderWater) || HasUnitMovementFlag(MovementFlag.Swimming);
isInWater = liquidStatus.HasAnyFlag(ZLiquidStatus.InWater | ZLiquidStatus.UnderWater); isInWater = liquidStatus.HasAnyFlag(ZLiquidStatus.InWater | ZLiquidStatus.UnderWater);
@@ -759,7 +759,7 @@ namespace Game.Entities
return; return;
LiquidData liquid_status; LiquidData liquid_status;
ZLiquidStatus res = m.getLiquidStatus(GetPhaseShift(), x, y, z, MapConst.MapAllLiquidTypes, out liquid_status); ZLiquidStatus res = m.GetLiquidStatus(GetPhaseShift(), x, y, z, MapConst.MapAllLiquidTypes, out liquid_status);
if (res == 0) if (res == 0)
{ {
if (_lastLiquid != null && _lastLiquid.SpellID != 0) if (_lastLiquid != null && _lastLiquid.SpellID != 0)
@@ -1295,7 +1295,7 @@ namespace Game.Entities
{ {
Battleground bg = ToPlayer().GetBattleground(); Battleground bg = ToPlayer().GetBattleground();
// don't unsummon pet in arena but SetFlag UNIT_FLAG_STUNNED to disable pet's interface // don't unsummon pet in arena but SetFlag UNIT_FLAG_STUNNED to disable pet's interface
if (bg && bg.isArena()) if (bg && bg.IsArena())
pet.AddUnitFlag(UnitFlags.Stunned); pet.AddUnitFlag(UnitFlags.Stunned);
else else
player.UnsummonPetTemporaryIfAny(); player.UnsummonPetTemporaryIfAny();
@@ -1636,7 +1636,7 @@ namespace Game.Entities
if (MoveSpline.Finalized()) if (MoveSpline.Finalized())
return; return;
MoveSpline.updateState((int)diff); MoveSpline.UpdateState((int)diff);
bool arrived = MoveSpline.Finalized(); bool arrived = MoveSpline.Finalized();
if (arrived) if (arrived)
+1 -1
View File
@@ -477,7 +477,7 @@ namespace Game.Entities
CastStop(); CastStop();
CombatStop(); // @todo CombatStop(true) may cause crash (interrupt spells) CombatStop(); // @todo CombatStop(true) may cause crash (interrupt spells)
GetHostileRefManager().deleteReferences(); GetHostileRefManager().DeleteReferences();
DeleteThreatList(); DeleteThreatList();
if (_oldFactionId != 0) if (_oldFactionId != 0)
+13 -13
View File
@@ -1034,7 +1034,7 @@ namespace Game.Entities
spell.SetSpellValue(pair.Key, pair.Value); spell.SetSpellValue(pair.Key, pair.Value);
spell.m_CastItem = castItem; spell.m_CastItem = castItem;
spell.prepare(targets, triggeredByAura); spell.Prepare(targets, triggeredByAura);
} }
public void CastSpell(Unit victim, uint spellId, bool triggered, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default) public void CastSpell(Unit victim, uint spellId, bool triggered, Item castItem = null, AuraEffect triggeredByAura = null, ObjectGuid originalCaster = default)
{ {
@@ -1134,7 +1134,7 @@ namespace Game.Entities
if (spellType == CurrentSpellTypes.Channeled) if (spellType == CurrentSpellTypes.Channeled)
spell.SendChannelUpdate(0); spell.SendChannelUpdate(0);
spell.finish(ok); spell.Finish(ok);
} }
uint GetCastingTimeForBonus(SpellInfo spellProto, DamageEffectType damagetype, uint CastingTime) uint GetCastingTimeForBonus(SpellInfo spellProto, DamageEffectType damagetype, uint CastingTime)
@@ -1385,7 +1385,7 @@ namespace Game.Entities
// channeled spells during channel stage (after the initial cast timer) allow movement with a specific spell attribute // channeled spells during channel stage (after the initial cast timer) allow movement with a specific spell attribute
Spell spell = m_currentSpells.LookupByKey(CurrentSpellTypes.Channeled); Spell spell = m_currentSpells.LookupByKey(CurrentSpellTypes.Channeled);
if (spell) if (spell)
if (spell.getState() != SpellState.Finished && spell.IsChannelActive()) if (spell.GetState() != SpellState.Finished && spell.IsChannelActive())
if (spell.GetSpellInfo().IsMoveAllowedChannel()) if (spell.GetSpellInfo().IsMoveAllowedChannel())
return false; return false;
@@ -1501,7 +1501,7 @@ namespace Game.Entities
int overEnergize = damage - gain; int overEnergize = damage - gain;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId); SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId);
victim.GetHostileRefManager().threatAssist(this, damage * 0.5f, spellInfo); victim.GetHostileRefManager().ThreatAssist(this, damage * 0.5f, spellInfo);
SendEnergizeSpellLog(victim, spellId, damage, overEnergize, powerType); SendEnergizeSpellLog(victim, spellId, damage, overEnergize, powerType);
} }
@@ -2100,8 +2100,8 @@ namespace Game.Entities
// generic spells are cast when they are not finished and not delayed // generic spells are cast when they are not finished and not delayed
var currentSpell = GetCurrentSpell(CurrentSpellTypes.Generic); var currentSpell = GetCurrentSpell(CurrentSpellTypes.Generic);
if (currentSpell && if (currentSpell &&
(currentSpell.getState() != SpellState.Finished) && (currentSpell.GetState() != SpellState.Finished) &&
(withDelayed || currentSpell.getState() != SpellState.Delayed)) (withDelayed || currentSpell.GetState() != SpellState.Delayed))
{ {
if (!skipInstant || currentSpell.GetCastTime() != 0) if (!skipInstant || currentSpell.GetCastTime() != 0)
{ {
@@ -2112,7 +2112,7 @@ namespace Game.Entities
currentSpell = GetCurrentSpell(CurrentSpellTypes.Channeled); currentSpell = GetCurrentSpell(CurrentSpellTypes.Channeled);
// channeled spells may be delayed, but they are still considered cast // channeled spells may be delayed, but they are still considered cast
if (!skipChanneled && currentSpell && if (!skipChanneled && currentSpell &&
(currentSpell.getState() != SpellState.Finished)) (currentSpell.GetState() != SpellState.Finished))
{ {
if (!isAutoshoot || !currentSpell.m_spellInfo.HasAttribute(SpellAttr2.NotResetAutoActions)) if (!isAutoshoot || !currentSpell.m_spellInfo.HasAttribute(SpellAttr2.NotResetAutoActions))
return true; return true;
@@ -2833,8 +2833,8 @@ namespace Game.Entities
Log.outDebug(LogFilter.Unit, "Interrupt spell for unit {0}", GetEntry()); Log.outDebug(LogFilter.Unit, "Interrupt spell for unit {0}", GetEntry());
Spell spell = m_currentSpells.LookupByKey(spellType); Spell spell = m_currentSpells.LookupByKey(spellType);
if (spell != null if (spell != null
&& (withDelayed || spell.getState() != SpellState.Delayed) && (withDelayed || spell.GetState() != SpellState.Delayed)
&& (withInstant || spell.GetCastTime() > 0 || spell.getState() == SpellState.Casting)) && (withInstant || spell.GetCastTime() > 0 || spell.GetState() == SpellState.Casting))
{ {
// for example, do not let self-stun aura interrupt itself // for example, do not let self-stun aura interrupt itself
if (!spell.IsInterruptable()) if (!spell.IsInterruptable())
@@ -2845,8 +2845,8 @@ namespace Game.Entities
if (IsTypeId(TypeId.Player)) if (IsTypeId(TypeId.Player))
ToPlayer().SendAutoRepeatCancel(this); ToPlayer().SendAutoRepeatCancel(this);
if (spell.getState() != SpellState.Finished) if (spell.GetState() != SpellState.Finished)
spell.cancel(); spell.Cancel();
if (IsCreature() && IsAIEnabled) if (IsCreature() && IsAIEnabled)
ToCreature().GetAI().OnSpellCastInterrupt(spell.GetSpellInfo()); ToCreature().GetAI().OnSpellCastInterrupt(spell.GetSpellInfo());
@@ -2867,7 +2867,7 @@ namespace Game.Entities
Spell spell = GetCurrentSpell(CurrentSpellTypes.Channeled); Spell spell = GetCurrentSpell(CurrentSpellTypes.Channeled);
if (spell != null) if (spell != null)
{ {
if (spell.getState() == SpellState.Casting) if (spell.GetState() == SpellState.Casting)
{ {
for (var i = 0; i < m_interruptMask.Length; ++i) for (var i = 0; i < m_interruptMask.Length; ++i)
m_interruptMask[i] |= spell.m_spellInfo.ChannelInterruptFlags[i]; m_interruptMask[i] |= spell.m_spellInfo.ChannelInterruptFlags[i];
@@ -3243,7 +3243,7 @@ namespace Game.Entities
Spell spell = GetCurrentSpell(CurrentSpellTypes.Channeled); Spell spell = GetCurrentSpell(CurrentSpellTypes.Channeled);
if (spell != null) if (spell != null)
{ {
if (spell.getState() == SpellState.Casting if (spell.GetState() == SpellState.Casting
&& Convert.ToBoolean(spell.GetSpellInfo().ChannelInterruptFlags[index] & flag) && Convert.ToBoolean(spell.GetSpellInfo().ChannelInterruptFlags[index] & flag)
&& spell.GetSpellInfo().Id != except && spell.GetSpellInfo().Id != except
&& !(Convert.ToBoolean(flag & (uint)SpellAuraInterruptFlags.Move) && HasAuraTypeWithAffectMask(AuraType.CastWhileWalking, spell.GetSpellInfo()))) && !(Convert.ToBoolean(flag & (uint)SpellAuraInterruptFlags.Move) && HasAuraTypeWithAffectMask(AuraType.CastWhileWalking, spell.GetSpellInfo())))
+14 -14
View File
@@ -44,7 +44,7 @@ namespace Game.Entities
UnitTypeMask = UnitTypeMask.None; UnitTypeMask = UnitTypeMask.None;
hostileRefManager = new HostileRefManager(this); hostileRefManager = new HostileRefManager(this);
_spellHistory = new SpellHistory(this); _spellHistory = new SpellHistory(this);
m_FollowingRefManager = new RefManager<Unit, TargetedMovementGeneratorBase>(); m_FollowingRefManager = new RefManager<Unit, ITargetedMovementGeneratorBase>();
ObjectTypeId = TypeId.Unit; ObjectTypeId = TypeId.Unit;
ObjectTypeMask |= TypeMask.Unit; ObjectTypeMask |= TypeMask.Unit;
@@ -142,7 +142,7 @@ namespace Game.Entities
// Having this would prevent spells from being proced, so let's crash // Having this would prevent spells from being proced, so let's crash
Cypher.Assert(m_procDeep == 0); Cypher.Assert(m_procDeep == 0);
if (CanHaveThreatList() && GetThreatManager().isNeedUpdateToClient(diff)) if (CanHaveThreatList() && GetThreatManager().IsNeedUpdateToClient(diff))
SendThreatListUpdate(); SendThreatListUpdate();
// update combat timer only for players and pets (only pets with PetAI) // update combat timer only for players and pets (only pets with PetAI)
@@ -191,7 +191,7 @@ namespace Game.Entities
for (CurrentSpellTypes i = 0; i < CurrentSpellTypes.Max; ++i) for (CurrentSpellTypes i = 0; i < CurrentSpellTypes.Max; ++i)
{ {
if (GetCurrentSpell(i) != null && m_currentSpells[i].getState() == SpellState.Finished) if (GetCurrentSpell(i) != null && m_currentSpells[i].GetState() == SpellState.Finished)
{ {
m_currentSpells[i].SetReferencedFromCurrent(false); m_currentSpells[i].SetReferencedFromCurrent(false);
m_currentSpells[i] = null; m_currentSpells[i] = null;
@@ -484,7 +484,7 @@ namespace Game.Entities
m_Events.KillAllEvents(false); // non-delatable (currently casted spells) will not deleted now but it will deleted at call in Map.RemoveAllObjectsInRemoveList m_Events.KillAllEvents(false); // non-delatable (currently casted spells) will not deleted now but it will deleted at call in Map.RemoveAllObjectsInRemoveList
CombatStop(); CombatStop();
DeleteThreatList(); DeleteThreatList();
GetHostileRefManager().deleteReferences(); GetHostileRefManager().DeleteReferences();
GetMotionMaster().Clear(false); // remove different non-standard movement generators. GetMotionMaster().Clear(false); // remove different non-standard movement generators.
} }
public override void CleanupsBeforeDelete(bool finalCleanup = true) public override void CleanupsBeforeDelete(bool finalCleanup = true)
@@ -1118,7 +1118,7 @@ namespace Game.Entities
if (IsTypeId(TypeId.Unit) || !ToPlayer().GetSession().PlayerLogout()) if (IsTypeId(TypeId.Unit) || !ToPlayer().GetSession().PlayerLogout())
{ {
HostileRefManager refManager = GetHostileRefManager(); HostileRefManager refManager = GetHostileRefManager();
HostileReference refe = refManager.getFirst(); HostileReference refe = refManager.GetFirst();
while (refe != null) while (refe != null)
{ {
@@ -1127,17 +1127,17 @@ namespace Game.Entities
{ {
Creature creature = unit.ToCreature(); Creature creature = unit.ToCreature();
if (creature != null) if (creature != null)
refManager.setOnlineOfflineState(creature, creature.IsInPhase(this)); refManager.SetOnlineOfflineState(creature, creature.IsInPhase(this));
} }
refe = refe.next(); refe = refe.Next();
} }
// modify threat lists for new phasemask // modify threat lists for new phasemask
if (!IsTypeId(TypeId.Player)) if (!IsTypeId(TypeId.Player))
{ {
List<HostileReference> threatList = GetThreatManager().getThreatList(); List<HostileReference> threatList = GetThreatManager().GetThreatList();
List<HostileReference> offlineThreatList = GetThreatManager().getOfflineThreatList(); List<HostileReference> offlineThreatList = GetThreatManager().GetOfflineThreatList();
// merge expects sorted lists // merge expects sorted lists
threatList.Sort(); threatList.Sort();
@@ -1146,9 +1146,9 @@ namespace Game.Entities
foreach (var host in threatList) foreach (var host in threatList)
{ {
Unit unit = host.getTarget(); Unit unit = host.GetTarget();
if (unit != null) if (unit != null)
unit.GetHostileRefManager().setOnlineOfflineState(ToCreature(), unit.IsInPhase(this)); unit.GetHostileRefManager().SetOnlineOfflineState(ToCreature(), unit.IsInPhase(this));
} }
} }
} }
@@ -1603,7 +1603,7 @@ namespace Game.Entities
{ {
CombatStop(); CombatStop();
DeleteThreatList(); DeleteThreatList();
GetHostileRefManager().deleteReferences(); GetHostileRefManager().DeleteReferences();
if (IsNonMeleeSpellCast(false)) if (IsNonMeleeSpellCast(false))
InterruptNonMeleeSpells(false); InterruptNonMeleeSpells(false);
@@ -1860,7 +1860,7 @@ namespace Game.Entities
// we want to shoot // we want to shoot
Spell spell = new Spell(this, autoRepeatSpellInfo, TriggerCastFlags.FullMask); Spell spell = new Spell(this, autoRepeatSpellInfo, TriggerCastFlags.FullMask);
spell.prepare(m_currentSpells[CurrentSpellTypes.AutoRepeat].m_targets); spell.Prepare(m_currentSpells[CurrentSpellTypes.AutoRepeat].m_targets);
// all went good, reset attack // all went good, reset attack
ResetAttackTimer(WeaponAttackType.RangedAttack); ResetAttackTimer(WeaponAttackType.RangedAttack);
@@ -2753,7 +2753,7 @@ namespace Game.Entities
Battleground bg = target.GetBattleground(); Battleground bg = target.GetBattleground();
if (bg != null) if (bg != null)
{ {
if (bg.isArena()) if (bg.IsArena())
{ {
DestroyArenaUnit destroyArenaUnit = new DestroyArenaUnit(); DestroyArenaUnit destroyArenaUnit = new DestroyArenaUnit();
destroyArenaUnit.Guid = GetGUID(); destroyArenaUnit.Guid = GetGUID();
+18 -18
View File
@@ -113,7 +113,7 @@ namespace Game
if (event_id < 1 || event_id >= mGameEvent.Length) if (event_id < 1 || event_id >= mGameEvent.Length)
return; return;
if (!mGameEvent[event_id].isValid()) if (!mGameEvent[event_id].IsValid())
return; return;
if (m_ActiveEvents.Contains(event_id)) if (m_ActiveEvents.Contains(event_id))
@@ -137,7 +137,7 @@ namespace Game
} }
// When event is started, set its worldstate to current time // When event is started, set its worldstate to current time
Global.WorldMgr.setWorldState(event_id, Time.UnixTime); Global.WorldMgr.SetWorldState(event_id, Time.UnixTime);
return false; return false;
} }
else else
@@ -174,7 +174,7 @@ namespace Game
UnApplyEvent(event_id); UnApplyEvent(event_id);
// When event is stopped, clean up its worldstate // When event is stopped, clean up its worldstate
Global.WorldMgr.setWorldState(event_id, 0); Global.WorldMgr.SetWorldState(event_id, 0);
if (overwrite && !serverwide_evt) if (overwrite && !serverwide_evt)
{ {
@@ -1000,7 +1000,7 @@ namespace Game
else else
{ {
// If event is inactive, periodically clean up its worldstate // If event is inactive, periodically clean up its worldstate
Global.WorldMgr.setWorldState(id, 0); Global.WorldMgr.SetWorldState(id, 0);
Log.outDebug(LogFilter.Misc, "GameEvent {0} is not active", id); Log.outDebug(LogFilter.Misc, "GameEvent {0} is not active", id);
if (IsActiveEvent(id)) if (IsActiveEvent(id))
deactivate.Add(id); deactivate.Add(id);
@@ -1089,7 +1089,7 @@ namespace Game
UpdateBattlegroundSettings(); UpdateBattlegroundSettings();
// If event's worldstate is 0, it means the event hasn't been started yet. In that case, reset seasonal quests. // If event's worldstate is 0, it means the event hasn't been started yet. In that case, reset seasonal quests.
// When event ends (if it expires or if it's stopped via commands) worldstate will be set to 0 again, ready for another seasonal quest reset. // When event ends (if it expires or if it's stopped via commands) worldstate will be set to 0 again, ready for another seasonal quest reset.
if (Global.WorldMgr.getWorldState(event_id) == 0) if (Global.WorldMgr.GetWorldState(event_id) == 0)
Global.WorldMgr.ResetEventSeasonalQuests(event_id); Global.WorldMgr.ResetEventSeasonalQuests(event_id);
} }
@@ -1098,12 +1098,12 @@ namespace Game
MultiMap<uint, ulong> creaturesByMap = new MultiMap<uint, ulong>(); MultiMap<uint, ulong> creaturesByMap = new MultiMap<uint, ulong>();
// go through the creatures whose npcflags are changed in the event // go through the creatures whose npcflags are changed in the event
foreach (var pair in mGameEventNPCFlags[event_id]) foreach (var (guid, npcflag) in mGameEventNPCFlags[event_id])
{ {
// get the creature data from the low guid to get the entry, to be able to find out the whole guid // get the creature data from the low guid to get the entry, to be able to find out the whole guid
CreatureData data = Global.ObjectMgr.GetCreatureData(pair.guid); CreatureData data = Global.ObjectMgr.GetCreatureData(guid);
if (data != null) if (data != null)
creaturesByMap.Add(data.mapid, pair.guid); creaturesByMap.Add(data.mapid, guid);
} }
foreach (var key in creaturesByMap.Keys) foreach (var key in creaturesByMap.Keys)
@@ -1234,7 +1234,7 @@ namespace Game
foreach (var guid in mGameEventCreatureGuids[internal_event_id]) foreach (var guid in mGameEventCreatureGuids[internal_event_id])
{ {
// check if it's needed by another event, if so, don't remove // check if it's needed by another event, if so, don't remove
if (event_id > 0 && hasCreatureActiveEventExcept(guid, (ushort)event_id)) if (event_id > 0 && HasCreatureActiveEventExcept(guid, (ushort)event_id))
continue; continue;
// Remove the creature from grid // Remove the creature from grid
@@ -1262,7 +1262,7 @@ namespace Game
foreach (var guid in mGameEventGameobjectGuids[internal_event_id]) foreach (var guid in mGameEventGameobjectGuids[internal_event_id])
{ {
// check if it's needed by another event, if so, don't remove // check if it's needed by another event, if so, don't remove
if (event_id > 0 && hasGameObjectActiveEventExcept(guid, (ushort)event_id)) if (event_id > 0 && HasGameObjectActiveEventExcept(guid, (ushort)event_id))
continue; continue;
// Remove the gameobject from grid // Remove the gameobject from grid
GameObjectData data = Global.ObjectMgr.GetGOData(guid); GameObjectData data = Global.ObjectMgr.GetGOData(guid);
@@ -1347,7 +1347,7 @@ namespace Game
} }
} }
bool hasCreatureQuestActiveEventExcept(uint questId, ushort eventId) bool HasCreatureQuestActiveEventExcept(uint questId, ushort eventId)
{ {
foreach (var activeEventId in m_ActiveEvents) foreach (var activeEventId in m_ActiveEvents)
{ {
@@ -1359,7 +1359,7 @@ namespace Game
return false; return false;
} }
bool hasGameObjectQuestActiveEventExcept(uint questId, ushort eventId) bool HasGameObjectQuestActiveEventExcept(uint questId, ushort eventId)
{ {
foreach (var activeEventId in m_ActiveEvents) foreach (var activeEventId in m_ActiveEvents)
{ {
@@ -1370,7 +1370,7 @@ namespace Game
} }
return false; return false;
} }
bool hasCreatureActiveEventExcept(ulong creatureId, ushort eventId) bool HasCreatureActiveEventExcept(ulong creatureId, ushort eventId)
{ {
foreach (var activeEventId in m_ActiveEvents) foreach (var activeEventId in m_ActiveEvents)
{ {
@@ -1384,7 +1384,7 @@ namespace Game
} }
return false; return false;
} }
bool hasGameObjectActiveEventExcept(ulong goId, ushort eventId) bool HasGameObjectActiveEventExcept(ulong goId, ushort eventId)
{ {
foreach (var activeEventId in m_ActiveEvents) foreach (var activeEventId in m_ActiveEvents)
{ {
@@ -1408,7 +1408,7 @@ namespace Game
CreatureQuestMap.Add(pair.Item1, pair.Item2); CreatureQuestMap.Add(pair.Item1, pair.Item2);
else else
{ {
if (!hasCreatureQuestActiveEventExcept(pair.Item2, eventId)) if (!HasCreatureQuestActiveEventExcept(pair.Item2, eventId))
{ {
// Remove the pair(id, quest) from the multimap // Remove the pair(id, quest) from the multimap
CreatureQuestMap.Remove(pair.Item1, pair.Item2); CreatureQuestMap.Remove(pair.Item1, pair.Item2);
@@ -1422,7 +1422,7 @@ namespace Game
GameObjectQuestMap.Add(pair.Item1, pair.Item2); GameObjectQuestMap.Add(pair.Item1, pair.Item2);
else else
{ {
if (!hasGameObjectQuestActiveEventExcept(pair.Item2, eventId)) if (!HasGameObjectQuestActiveEventExcept(pair.Item2, eventId))
{ {
// Remove the pair(id, quest) from the multimap // Remove the pair(id, quest) from the multimap
GameObjectQuestMap.Remove(pair.Item1, pair.Item2); GameObjectQuestMap.Remove(pair.Item1, pair.Item2);
@@ -1643,7 +1643,7 @@ namespace Game
public string description; public string description;
public byte announce; // if 0 dont announce, if 1 announce, if 2 take config value public byte announce; // if 0 dont announce, if 1 announce, if 2 take config value
public bool isValid() { return length > 0 || state > GameEventState.Normal; } public bool IsValid() { return length > 0 || state > GameEventState.Normal; }
} }
public class ModelEquip public class ModelEquip
@@ -1666,7 +1666,7 @@ namespace Game
{ {
foreach (var creature in objs) foreach (var creature in objs)
if (creature.IsInWorld && creature.IsAIEnabled) if (creature.IsInWorld && creature.IsAIEnabled)
creature.GetAI().sOnGameEvent(_activate, _eventId); creature.GetAI().OnGameEvent(_activate, _eventId);
} }
public override void Visit(IList<GameObject> objs) public override void Visit(IList<GameObject> objs)
{ {
+98 -98
View File
@@ -53,7 +53,7 @@ namespace Game.Groups
m_leaderName = leader.GetName(); m_leaderName = leader.GetName();
leader.AddPlayerFlag(PlayerFlags.GroupLeader); leader.AddPlayerFlag(PlayerFlags.GroupLeader);
if (isBGGroup() || isBFGroup()) if (IsBGGroup() || IsBFGroup())
{ {
m_groupFlags = GroupFlags.MaskBgRaid; m_groupFlags = GroupFlags.MaskBgRaid;
m_groupCategory = GroupCategory.Instance; m_groupCategory = GroupCategory.Instance;
@@ -62,7 +62,7 @@ namespace Game.Groups
if (m_groupFlags.HasAnyFlag(GroupFlags.Raid)) if (m_groupFlags.HasAnyFlag(GroupFlags.Raid))
_initRaidSubGroupsCounter(); _initRaidSubGroupsCounter();
if (!isLFGGroup()) if (!IsLFGGroup())
m_lootMethod = LootMethod.GroupLoot; m_lootMethod = LootMethod.GroupLoot;
m_lootThreshold = ItemQuality.Uncommon; m_lootThreshold = ItemQuality.Uncommon;
@@ -72,7 +72,7 @@ namespace Game.Groups
m_raidDifficulty = Difficulty.NormalRaid; m_raidDifficulty = Difficulty.NormalRaid;
m_legacyRaidDifficulty = Difficulty.Raid10N; m_legacyRaidDifficulty = Difficulty.Raid10N;
if (!isBGGroup() && !isBFGroup()) if (!IsBGGroup() && !IsBFGroup())
{ {
m_dungeonDifficulty = leader.GetDungeonDifficultyID(); m_dungeonDifficulty = leader.GetDungeonDifficultyID();
m_raidDifficulty = leader.GetRaidDifficultyID(); m_raidDifficulty = leader.GetRaidDifficultyID();
@@ -180,7 +180,7 @@ namespace Game.Groups
m_groupFlags = (m_groupFlags | GroupFlags.Lfg | GroupFlags.LfgRestricted); m_groupFlags = (m_groupFlags | GroupFlags.Lfg | GroupFlags.LfgRestricted);
m_groupCategory = GroupCategory.Instance; m_groupCategory = GroupCategory.Instance;
m_lootMethod = LootMethod.GroupLoot; m_lootMethod = LootMethod.GroupLoot;
if (!isBGGroup() && !isBFGroup()) if (!IsBGGroup() && !IsBFGroup())
{ {
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_TYPE); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_TYPE);
@@ -199,7 +199,7 @@ namespace Game.Groups
_initRaidSubGroupsCounter(); _initRaidSubGroupsCounter();
if (!isBGGroup() && !isBFGroup()) if (!IsBGGroup() && !IsBFGroup())
{ {
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_TYPE); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_TYPE);
@@ -229,7 +229,7 @@ namespace Game.Groups
m_subGroupsCounts = null; m_subGroupsCounts = null;
if (!isBGGroup() && !isBFGroup()) if (!IsBGGroup() && !IsBFGroup())
{ {
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_TYPE); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_TYPE);
@@ -255,7 +255,7 @@ namespace Game.Groups
if (player == null || player.GetGroupInvite()) if (player == null || player.GetGroupInvite())
return false; return false;
Group group = player.GetGroup(); Group group = player.GetGroup();
if (group && (group.isBGGroup() || group.isBFGroup())) if (group && (group.IsBGGroup() || group.IsBFGroup()))
group = player.GetOriginalGroup(); group = player.GetOriginalGroup();
if (group) if (group)
return false; return false;
@@ -354,7 +354,7 @@ namespace Game.Groups
player.SetGroupInvite(null); player.SetGroupInvite(null);
if (player.GetGroup() != null) if (player.GetGroup() != null)
{ {
if (isBGGroup() || isBFGroup()) // if player is in group and he is being added to BG raid group, then call SetBattlegroundRaid() if (IsBGGroup() || IsBFGroup()) // if player is in group and he is being added to BG raid group, then call SetBattlegroundRaid()
player.SetBattlegroundOrBattlefieldRaid(this, subGroup); player.SetBattlegroundOrBattlefieldRaid(this, subGroup);
else //if player is in bg raid and we are adding him to normal group, then call SetOriginalGroup() else //if player is in bg raid and we are adding him to normal group, then call SetOriginalGroup()
player.SetOriginalGroup(this, subGroup); player.SetOriginalGroup(this, subGroup);
@@ -368,14 +368,14 @@ namespace Game.Groups
// if the same group invites the player back, cancel the homebind timer // if the same group invites the player back, cancel the homebind timer
player.m_InstanceValid = player.CheckInstanceValidity(false); player.m_InstanceValid = player.CheckInstanceValidity(false);
if (!isRaidGroup()) // reset targetIcons for non-raid-groups if (!IsRaidGroup()) // reset targetIcons for non-raid-groups
{ {
for (byte i = 0; i < MapConst.TargetIconsCount; ++i) for (byte i = 0; i < MapConst.TargetIconsCount; ++i)
m_targetIcons[i].Clear(); m_targetIcons[i].Clear();
} }
// insert into the table if we're not a Battlegroundgroup // insert into the table if we're not a Battlegroundgroup
if (!isBGGroup() && !isBFGroup()) if (!IsBGGroup() && !IsBFGroup())
{ {
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_GROUP_MEMBER); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_GROUP_MEMBER);
@@ -392,7 +392,7 @@ namespace Game.Groups
SendUpdate(); SendUpdate();
Global.ScriptMgr.OnGroupAddMember(this, player.GetGUID()); Global.ScriptMgr.OnGroupAddMember(this, player.GetGUID());
if (!IsLeader(player.GetGUID()) && !isBGGroup() && !isBFGroup()) if (!IsLeader(player.GetGUID()) && !IsBGGroup() && !IsBFGroup())
{ {
// reset the new member's instances, unless he is currently in one of them // reset the new member's instances, unless he is currently in one of them
// including raid/heroic instances that they are not permanently bound to! // including raid/heroic instances that they are not permanently bound to!
@@ -424,7 +424,7 @@ namespace Game.Groups
UpdatePlayerOutOfRange(player); UpdatePlayerOutOfRange(player);
// quest related GO state dependent from raid membership // quest related GO state dependent from raid membership
if (isRaidGroup()) if (IsRaidGroup())
player.UpdateForQuestWorldObjects(); player.UpdateForQuestWorldObjects();
{ {
@@ -433,7 +433,7 @@ namespace Game.Groups
UpdateObject groupDataPacket; UpdateObject groupDataPacket;
// Broadcast group members' fields to player // Broadcast group members' fields to player
for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.next()) for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.Next())
{ {
if (refe.GetSource() == player) if (refe.GetSource() == player)
continue; continue;
@@ -480,7 +480,7 @@ namespace Game.Groups
Player player = Global.ObjAccessor.FindConnectedPlayer(guid); Player player = Global.ObjAccessor.FindConnectedPlayer(guid);
if (player) if (player)
{ {
for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.next()) for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.Next())
{ {
Player groupMember = refe.GetSource(); Player groupMember = refe.GetSource();
if (groupMember) if (groupMember)
@@ -495,16 +495,16 @@ namespace Game.Groups
} }
// LFG group vote kick handled in scripts // LFG group vote kick handled in scripts
if (isLFGGroup() && method == RemoveMethod.Kick) if (IsLFGGroup() && method == RemoveMethod.Kick)
return m_memberSlots.Count != 0; return m_memberSlots.Count != 0;
// remove member and change leader (if need) only if strong more 2 members _before_ member remove (BG/BF allow 1 member group) // remove member and change leader (if need) only if strong more 2 members _before_ member remove (BG/BF allow 1 member group)
if (GetMembersCount() > ((isBGGroup() || isLFGGroup() || isBFGroup()) ? 1 : 2)) if (GetMembersCount() > ((IsBGGroup() || IsLFGGroup() || IsBFGroup()) ? 1 : 2))
{ {
if (player) if (player)
{ {
// Battlegroundgroup handling // Battlegroundgroup handling
if (isBGGroup() || isBFGroup()) if (IsBGGroup() || IsBFGroup())
player.RemoveFromBattlegroundOrBattlefieldRaid(); player.RemoveFromBattlegroundOrBattlefieldRaid();
else else
// Regular group // Regular group
@@ -528,7 +528,7 @@ namespace Game.Groups
} }
// Remove player from group in DB // Remove player from group in DB
if (!isBGGroup() && !isBFGroup()) if (!IsBGGroup() && !IsBFGroup())
{ {
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GROUP_MEMBER); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GROUP_MEMBER);
stmt.AddValue(0, guid.GetCounter()); stmt.AddValue(0, guid.GetCounter());
@@ -586,7 +586,7 @@ namespace Game.Groups
SendUpdate(); SendUpdate();
if (isLFGGroup() && GetMembersCount() == 1) if (IsLFGGroup() && GetMembersCount() == 1)
{ {
Player leader = Global.ObjAccessor.FindPlayer(GetLeaderGUID()); Player leader = Global.ObjAccessor.FindPlayer(GetLeaderGUID());
uint mapId = Global.LFGMgr.GetDungeonMapId(GetGUID()); uint mapId = Global.LFGMgr.GetDungeonMapId(GetGUID());
@@ -597,7 +597,7 @@ namespace Game.Groups
} }
} }
if (m_memberMgr.GetSize() < ((isLFGGroup() || isBGGroup()) ? 1 : 2)) if (m_memberMgr.GetSize() < ((IsLFGGroup() || IsBGGroup()) ? 1 : 2))
Disband(); Disband();
else if (player) else if (player)
{ {
@@ -629,7 +629,7 @@ namespace Game.Groups
Global.ScriptMgr.OnGroupChangeLeader(this, newLeaderGuid, m_leaderGuid); Global.ScriptMgr.OnGroupChangeLeader(this, newLeaderGuid, m_leaderGuid);
if (!isBGGroup() && !isBFGroup()) if (!IsBGGroup() && !IsBFGroup())
{ {
PreparedStatement stmt; PreparedStatement stmt;
SQLTransaction trans = new SQLTransaction(); SQLTransaction trans = new SQLTransaction();
@@ -737,7 +737,7 @@ namespace Game.Groups
//we cannot call _removeMember because it would invalidate member iterator //we cannot call _removeMember because it would invalidate member iterator
//if we are removing player from Battlegroundraid //if we are removing player from Battlegroundraid
if (isBGGroup() || isBFGroup()) if (IsBGGroup() || IsBFGroup())
player.RemoveFromBattlegroundOrBattlefieldRaid(); player.RemoveFromBattlegroundOrBattlefieldRaid();
else else
{ {
@@ -751,7 +751,7 @@ namespace Game.Groups
player.SetPartyType(m_groupCategory, GroupType.None); player.SetPartyType(m_groupCategory, GroupType.None);
// quest related GO state dependent from raid membership // quest related GO state dependent from raid membership
if (isRaidGroup()) if (IsRaidGroup())
player.UpdateForQuestWorldObjects(); player.UpdateForQuestWorldObjects();
if (!hideDestroy) if (!hideDestroy)
@@ -766,7 +766,7 @@ namespace Game.Groups
RemoveAllInvites(); RemoveAllInvites();
if (!isBGGroup() && !isBFGroup()) if (!IsBGGroup() && !IsBFGroup())
{ {
SQLTransaction trans = new SQLTransaction(); SQLTransaction trans = new SQLTransaction();
@@ -797,7 +797,7 @@ namespace Game.Groups
void SendLootStartRollToPlayer(uint countDown, uint mapId, Player p, bool canNeed, Roll r) void SendLootStartRollToPlayer(uint countDown, uint mapId, Player p, bool canNeed, Roll r)
{ {
StartLootRoll startLootRoll = new StartLootRoll(); StartLootRoll startLootRoll = new StartLootRoll();
startLootRoll.LootObj = r.getTarget().GetGUID(); startLootRoll.LootObj = r.GetTarget().GetGUID();
startLootRoll.MapID = (int)mapId; startLootRoll.MapID = (int)mapId;
startLootRoll.RollTime = countDown; startLootRoll.RollTime = countDown;
startLootRoll.ValidRolls = r.rollTypeMask; startLootRoll.ValidRolls = r.rollTypeMask;
@@ -817,7 +817,7 @@ namespace Game.Groups
void SendLootRoll(ObjectGuid playerGuid, int rollNumber, RollType rollType, Roll roll) void SendLootRoll(ObjectGuid playerGuid, int rollNumber, RollType rollType, Roll roll)
{ {
LootRollBroadcast lootRoll = new LootRollBroadcast(); LootRollBroadcast lootRoll = new LootRollBroadcast();
lootRoll.LootObj = roll.getTarget().GetGUID(); lootRoll.LootObj = roll.GetTarget().GetGUID();
lootRoll.Player = playerGuid; lootRoll.Player = playerGuid;
lootRoll.Roll = rollNumber; lootRoll.Roll = rollNumber;
lootRoll.RollType = rollType; lootRoll.RollType = rollType;
@@ -837,7 +837,7 @@ namespace Game.Groups
void SendLootRollWon(ObjectGuid winnerGuid, int rollNumber, RollType rollType, Roll roll) void SendLootRollWon(ObjectGuid winnerGuid, int rollNumber, RollType rollType, Roll roll)
{ {
LootRollWon lootRollWon = new LootRollWon(); LootRollWon lootRollWon = new LootRollWon();
lootRollWon.LootObj = roll.getTarget().GetGUID(); lootRollWon.LootObj = roll.GetTarget().GetGUID();
lootRollWon.Winner = winnerGuid; lootRollWon.Winner = winnerGuid;
lootRollWon.Roll = rollNumber; lootRollWon.Roll = rollNumber;
lootRollWon.RollType = rollType; lootRollWon.RollType = rollType;
@@ -858,7 +858,7 @@ namespace Game.Groups
void SendLootAllPassed(Roll roll) void SendLootAllPassed(Roll roll)
{ {
LootAllPassed lootAllPassed = new LootAllPassed(); LootAllPassed lootAllPassed = new LootAllPassed();
lootAllPassed.LootObj = roll.getTarget().GetGUID(); lootAllPassed.LootObj = roll.GetTarget().GetGUID();
roll.FillPacket(lootAllPassed.Item); roll.FillPacket(lootAllPassed.Item);
foreach (var pair in roll.playerVote) foreach (var pair in roll.playerVote)
@@ -875,7 +875,7 @@ namespace Game.Groups
void SendLootRollsComplete(Roll roll) void SendLootRollsComplete(Roll roll)
{ {
LootRollsComplete lootRollsComplete = new LootRollsComplete(); LootRollsComplete lootRollsComplete = new LootRollsComplete();
lootRollsComplete.LootObj = roll.getTarget().GetGUID(); lootRollsComplete.LootObj = roll.GetTarget().GetGUID();
lootRollsComplete.LootListID = (byte)(roll.itemSlot + 1); lootRollsComplete.LootListID = (byte)(roll.itemSlot + 1);
foreach (var pair in roll.playerVote) foreach (var pair in roll.playerVote)
@@ -898,7 +898,7 @@ namespace Game.Groups
lootList.Owner = creature.GetGUID(); lootList.Owner = creature.GetGUID();
lootList.LootObj = creature.loot.GetGUID(); lootList.LootObj = creature.loot.GetGUID();
if (GetLootMethod() == LootMethod.MasterLoot && creature.loot.hasOverThresholdItem()) if (GetLootMethod() == LootMethod.MasterLoot && creature.loot.HasOverThresholdItem())
lootList.Master.Set(GetMasterLooterGuid()); lootList.Master.Set(GetMasterLooterGuid());
if (groupLooter) if (groupLooter)
@@ -925,7 +925,7 @@ namespace Game.Groups
{ {
Roll r = new Roll(lootItem); Roll r = new Roll(lootItem);
for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.next()) for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.Next())
{ {
Player playerToRoll = refe.GetSource(); Player playerToRoll = refe.GetSource();
if (!playerToRoll || playerToRoll.GetSession() == null) if (!playerToRoll || playerToRoll.GetSession() == null)
@@ -948,7 +948,7 @@ namespace Game.Groups
if (r.totalPlayersRolling > 0) if (r.totalPlayersRolling > 0)
{ {
r.setLoot(loot); r.SetLoot(loot);
r.itemSlot = itemSlot; r.itemSlot = itemSlot;
if (item.GetFlags2().HasAnyFlag(ItemFlags2.CanOnlyRollGreed)) if (item.GetFlags2().HasAnyFlag(ItemFlags2.CanOnlyRollGreed))
@@ -996,7 +996,7 @@ namespace Game.Groups
ItemTemplate item = Global.ObjectMgr.GetItemTemplate(i.itemid); ItemTemplate item = Global.ObjectMgr.GetItemTemplate(i.itemid);
Roll r = new Roll(i); Roll r = new Roll(i);
for (var refe = GetFirstMember(); refe != null; refe = refe.next()) for (var refe = GetFirstMember(); refe != null; refe = refe.Next())
{ {
Player playerToRoll = refe.GetSource(); Player playerToRoll = refe.GetSource();
if (!playerToRoll || playerToRoll.GetSession() == null) if (!playerToRoll || playerToRoll.GetSession() == null)
@@ -1012,7 +1012,7 @@ namespace Game.Groups
if (r.totalPlayersRolling > 0) if (r.totalPlayersRolling > 0)
{ {
r.setLoot(loot); r.SetLoot(loot);
r.itemSlot = itemSlot; r.itemSlot = itemSlot;
loot.quest_items[itemSlot - loot.items.Count].is_blocked = true; loot.quest_items[itemSlot - loot.items.Count].is_blocked = true;
@@ -1053,7 +1053,7 @@ namespace Game.Groups
MasterLootCandidateList data = new MasterLootCandidateList(); MasterLootCandidateList data = new MasterLootCandidateList();
data.LootObj = loot.GetGUID(); data.LootObj = loot.GetGUID();
for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.next()) for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.Next())
{ {
Player looter = refe.GetSource(); Player looter = refe.GetSource();
if (!looter.IsInWorld) if (!looter.IsInWorld)
@@ -1063,7 +1063,7 @@ namespace Game.Groups
data.Players.Add(looter.GetGUID()); data.Players.Add(looter.GetGUID());
} }
for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.next()) for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.Next())
{ {
Player looter = refe.GetSource(); Player looter = refe.GetSource();
if (looter.IsAtGroupRewardDistance(pLootedObject)) if (looter.IsAtGroupRewardDistance(pLootedObject))
@@ -1081,8 +1081,8 @@ namespace Game.Groups
if (!roll.playerVote.ContainsKey(playerGuid)) if (!roll.playerVote.ContainsKey(playerGuid))
return; return;
if (roll.getLoot() != null) if (roll.GetLoot() != null)
if (roll.getLoot().items.Empty()) if (roll.GetLoot().items.Empty())
return; return;
RollType rollType = RollType.MaxTypes; RollType rollType = RollType.MaxTypes;
@@ -1120,7 +1120,7 @@ namespace Game.Groups
{ {
foreach (var roll in RollId.ToList()) foreach (var roll in RollId.ToList())
{ {
if (roll.getLoot() == pLoot) if (roll.GetLoot() == pLoot)
{ {
CountTheRoll(roll, allowedMap); //i don't have to edit player votes, who didn't vote ... he will pass CountTheRoll(roll, allowedMap); //i don't have to edit player votes, who didn't vote ... he will pass
} }
@@ -1129,7 +1129,7 @@ namespace Game.Groups
void CountTheRoll(Roll roll, Map allowedMap) void CountTheRoll(Roll roll, Map allowedMap)
{ {
if (!roll.isValid()) // is loot already deleted ? if (!roll.IsValid()) // is loot already deleted ?
{ {
RollId.Remove(roll); RollId.Remove(roll);
return; return;
@@ -1175,13 +1175,13 @@ namespace Game.Groups
player.UpdateCriteria(CriteriaTypes.RollNeedOnLoot, roll.itemid, maxresul); player.UpdateCriteria(CriteriaTypes.RollNeedOnLoot, roll.itemid, maxresul);
List<ItemPosCount> dest = new List<ItemPosCount>(); List<ItemPosCount> dest = new List<ItemPosCount>();
LootItem item = (roll.itemSlot >= roll.getLoot().items.Count ? roll.getLoot().quest_items[roll.itemSlot - roll.getLoot().items.Count] : roll.getLoot().items[roll.itemSlot]); LootItem item = (roll.itemSlot >= roll.GetLoot().items.Count ? roll.GetLoot().quest_items[roll.itemSlot - roll.GetLoot().items.Count] : roll.GetLoot().items[roll.itemSlot]);
InventoryResult msg = player.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, roll.itemid, item.count); InventoryResult msg = player.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, roll.itemid, item.count);
if (msg == InventoryResult.Ok) if (msg == InventoryResult.Ok)
{ {
item.is_looted = true; item.is_looted = true;
roll.getLoot().NotifyItemRemoved(roll.itemSlot); roll.GetLoot().NotifyItemRemoved(roll.itemSlot);
roll.getLoot().unlootedCount--; roll.GetLoot().unlootedCount--;
player.StoreNewItem(dest, roll.itemid, true, item.randomBonusListId, item.GetAllowedLooters(), item.context, item.BonusListIDs); player.StoreNewItem(dest, roll.itemid, true, item.randomBonusListId, item.GetAllowedLooters(), item.context, item.BonusListIDs);
} }
else else
@@ -1237,7 +1237,7 @@ namespace Game.Groups
{ {
player.UpdateCriteria(CriteriaTypes.RollGreedOnLoot, roll.itemid, maxresul); player.UpdateCriteria(CriteriaTypes.RollGreedOnLoot, roll.itemid, maxresul);
LootItem item = roll.itemSlot >= roll.getLoot().items.Count ? roll.getLoot().quest_items[roll.itemSlot - roll.getLoot().items.Count] : roll.getLoot().items[roll.itemSlot]; LootItem item = roll.itemSlot >= roll.GetLoot().items.Count ? roll.GetLoot().quest_items[roll.itemSlot - roll.GetLoot().items.Count] : roll.GetLoot().items[roll.itemSlot];
if (rollVote == RollType.Greed) if (rollVote == RollType.Greed)
{ {
@@ -1246,8 +1246,8 @@ namespace Game.Groups
if (msg == InventoryResult.Ok) if (msg == InventoryResult.Ok)
{ {
item.is_looted = true; item.is_looted = true;
roll.getLoot().NotifyItemRemoved(roll.itemSlot); roll.GetLoot().NotifyItemRemoved(roll.itemSlot);
roll.getLoot().unlootedCount--; roll.GetLoot().unlootedCount--;
player.StoreNewItem(dest, roll.itemid, true, item.randomBonusListId, item.GetAllowedLooters(), item.context, item.BonusListIDs); player.StoreNewItem(dest, roll.itemid, true, item.randomBonusListId, item.GetAllowedLooters(), item.context, item.BonusListIDs);
} }
else else
@@ -1260,8 +1260,8 @@ namespace Game.Groups
else if (rollVote == RollType.Disenchant) else if (rollVote == RollType.Disenchant)
{ {
item.is_looted = true; item.is_looted = true;
roll.getLoot().NotifyItemRemoved(roll.itemSlot); roll.GetLoot().NotifyItemRemoved(roll.itemSlot);
roll.getLoot().unlootedCount--; roll.GetLoot().unlootedCount--;
player.UpdateCriteria(CriteriaTypes.CastSpell, 13262); // Disenchant player.UpdateCriteria(CriteriaTypes.CastSpell, 13262); // Disenchant
ItemDisenchantLootRecord disenchant = roll.GetItemDisenchantLoot(player); ItemDisenchantLootRecord disenchant = roll.GetItemDisenchantLoot(player);
@@ -1296,7 +1296,7 @@ namespace Game.Groups
SendLootAllPassed(roll); SendLootAllPassed(roll);
// remove is_blocked so that the item is lootable by all players // remove is_blocked so that the item is lootable by all players
LootItem item = roll.itemSlot >= roll.getLoot().items.Count ? roll.getLoot().quest_items[roll.itemSlot - roll.getLoot().items.Count] : roll.getLoot().items[roll.itemSlot]; LootItem item = roll.itemSlot >= roll.GetLoot().items.Count ? roll.GetLoot().quest_items[roll.itemSlot - roll.GetLoot().items.Count] : roll.GetLoot().items[roll.itemSlot];
item.is_blocked = false; item.is_blocked = false;
} }
@@ -1390,7 +1390,7 @@ namespace Game.Groups
playerInfos.Status = GroupMemberOnlineStatus.Offline; playerInfos.Status = GroupMemberOnlineStatus.Offline;
if (memberPlayer && memberPlayer.GetSession() && !memberPlayer.GetSession().PlayerLogout()) if (memberPlayer && memberPlayer.GetSession() && !memberPlayer.GetSession().PlayerLogout())
playerInfos.Status = GroupMemberOnlineStatus.Online | (isBGGroup() || isBFGroup() ? GroupMemberOnlineStatus.PVP : 0); playerInfos.Status = GroupMemberOnlineStatus.Online | (IsBGGroup() || IsBFGroup() ? GroupMemberOnlineStatus.PVP : 0);
playerInfos.Subgroup = member.group; // groupid playerInfos.Subgroup = member.group; // groupid
playerInfos.Flags = (byte)member.flags; // See enum GroupMemberFlags playerInfos.Flags = (byte)member.flags; // See enum GroupMemberFlags
@@ -1417,7 +1417,7 @@ namespace Game.Groups
} }
// LfgInfos // LfgInfos
if (isLFGGroup()) if (IsLFGGroup())
{ {
partyUpdate.LfgInfos.HasValue = true; partyUpdate.LfgInfos.HasValue = true;
@@ -1470,7 +1470,7 @@ namespace Game.Groups
PartyMemberState packet = new PartyMemberState(); PartyMemberState packet = new PartyMemberState();
packet.Initialize(player); packet.Initialize(player);
for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.next()) for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.Next())
{ {
Player member = refe.GetSource(); Player member = refe.GetSource();
if (member && member != player && (!member.IsInMap(player) || !member.IsWithinDist(player, member.GetSightRange(), false))) if (member && member != player && (!member.IsInMap(player) || !member.IsWithinDist(player, member.GetSightRange(), false)))
@@ -1480,13 +1480,13 @@ namespace Game.Groups
public void BroadcastAddonMessagePacket(ServerPacket packet, string prefix, bool ignorePlayersInBGRaid, int group = -1, ObjectGuid ignore = default) public void BroadcastAddonMessagePacket(ServerPacket packet, string prefix, bool ignorePlayersInBGRaid, int group = -1, ObjectGuid ignore = default)
{ {
for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.next()) for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.Next())
{ {
Player player = refe.GetSource(); Player player = refe.GetSource();
if (player == null || (!ignore.IsEmpty() && player.GetGUID() == ignore) || (ignorePlayersInBGRaid && player.GetGroup() != this)) if (player == null || (!ignore.IsEmpty() && player.GetGUID() == ignore) || (ignorePlayersInBGRaid && player.GetGroup() != this))
continue; continue;
if ((group == -1 || refe.getSubGroup() == group)) if ((group == -1 || refe.GetSubGroup() == group))
if (player.GetSession().IsAddonRegistered(prefix)) if (player.GetSession().IsAddonRegistered(prefix))
player.SendPacket(packet); player.SendPacket(packet);
} }
@@ -1494,13 +1494,13 @@ namespace Game.Groups
public void BroadcastPacket(ServerPacket packet, bool ignorePlayersInBGRaid, int group = -1, ObjectGuid ignore = default) public void BroadcastPacket(ServerPacket packet, bool ignorePlayersInBGRaid, int group = -1, ObjectGuid ignore = default)
{ {
for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.next()) for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.Next())
{ {
Player player = refe.GetSource(); Player player = refe.GetSource();
if (!player || (!ignore.IsEmpty() && player.GetGUID() == ignore) || (ignorePlayersInBGRaid && player.GetGroup() != this)) if (!player || (!ignore.IsEmpty() && player.GetGUID() == ignore) || (ignorePlayersInBGRaid && player.GetGroup() != this))
continue; continue;
if (player.GetSession() != null && (group == -1 || refe.getSubGroup() == group)) if (player.GetSession() != null && (group == -1 || refe.GetSubGroup() == group))
player.SendPacket(packet); player.SendPacket(packet);
} }
} }
@@ -1515,7 +1515,7 @@ namespace Game.Groups
SubGroupCounterIncrease(group); SubGroupCounterIncrease(group);
if (!isBGGroup() && !isBFGroup()) if (!IsBGGroup() && !IsBFGroup())
{ {
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_MEMBER_SUBGROUP); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_MEMBER_SUBGROUP);
@@ -1542,7 +1542,7 @@ namespace Game.Groups
public void ChangeMembersGroup(ObjectGuid guid, byte group) public void ChangeMembersGroup(ObjectGuid guid, byte group)
{ {
// Only raid groups have sub groups // Only raid groups have sub groups
if (!isRaidGroup()) if (!IsRaidGroup())
return; return;
// Check if player is really in the raid // Check if player is really in the raid
@@ -1565,7 +1565,7 @@ namespace Game.Groups
SubGroupCounterDecrease(prevSubGroup); SubGroupCounterDecrease(prevSubGroup);
// Preserve new sub group in database for non-raid groups // Preserve new sub group in database for non-raid groups
if (!isBGGroup() && !isBFGroup()) if (!IsBGGroup() && !IsBFGroup())
{ {
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_MEMBER_SUBGROUP); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_MEMBER_SUBGROUP);
@@ -1580,11 +1580,11 @@ namespace Game.Groups
if (player) if (player)
{ {
if (player.GetGroup() == this) if (player.GetGroup() == this)
player.GetGroupRef().setSubGroup(group); player.GetGroupRef().SetSubGroup(group);
else else
{ {
// If player is in BG raid, it is possible that he is also in normal raid - and that normal raid is stored in m_originalGroup reference // If player is in BG raid, it is possible that he is also in normal raid - and that normal raid is stored in m_originalGroup reference
player.GetOriginalGroupRef().setSubGroup(group); player.GetOriginalGroupRef().SetSubGroup(group);
} }
} }
@@ -1594,7 +1594,7 @@ namespace Game.Groups
public void SwapMembersGroups(ObjectGuid firstGuid, ObjectGuid secondGuid) public void SwapMembersGroups(ObjectGuid firstGuid, ObjectGuid secondGuid)
{ {
if (!isRaidGroup()) if (!IsRaidGroup())
return; return;
MemberSlot[] slots = new MemberSlot[2]; MemberSlot[] slots = new MemberSlot[2];
@@ -1614,7 +1614,7 @@ namespace Game.Groups
for (byte i = 0; i < 2; i++) for (byte i = 0; i < 2; i++)
{ {
// Preserve new sub group in database for non-raid groups // Preserve new sub group in database for non-raid groups
if (!isBGGroup() && !isBFGroup()) if (!IsBGGroup() && !IsBFGroup())
{ {
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_MEMBER_SUBGROUP); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_MEMBER_SUBGROUP);
stmt.AddValue(0, slots[i].group); stmt.AddValue(0, slots[i].group);
@@ -1627,9 +1627,9 @@ namespace Game.Groups
if (player) if (player)
{ {
if (player.GetGroup() == this) if (player.GetGroup() == this)
player.GetGroupRef().setSubGroup(slots[i].group); player.GetGroupRef().SetSubGroup(slots[i].group);
else else
player.GetOriginalGroupRef().setSubGroup(slots[i].group); player.GetOriginalGroupRef().SetSubGroup(slots[i].group);
} }
} }
DB.Characters.CommitTransaction(trans); DB.Characters.CommitTransaction(trans);
@@ -1713,7 +1713,7 @@ namespace Game.Groups
{ {
errorGuid = new ObjectGuid(); errorGuid = new ObjectGuid();
// check if this group is LFG group // check if this group is LFG group
if (isLFGGroup()) if (IsLFGGroup())
return GroupJoinBattlegroundResult.LfgCantUseBattleground; return GroupJoinBattlegroundResult.LfgCantUseBattleground;
BattlemasterListRecord bgEntry = CliDB.BattlemasterListStorage.LookupByKey(bgOrTemplate.GetTypeID()); BattlemasterListRecord bgEntry = CliDB.BattlemasterListStorage.LookupByKey(bgOrTemplate.GetTypeID());
@@ -1743,7 +1743,7 @@ namespace Game.Groups
// check every member of the group to be able to join // check every member of the group to be able to join
memberscount = 0; memberscount = 0;
for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.next(), ++memberscount) for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.Next(), ++memberscount)
{ {
Player member = refe.GetSource(); Player member = refe.GetSource();
// offline member? don't let join // offline member? don't let join
@@ -1786,7 +1786,7 @@ namespace Game.Groups
} }
// only check for MinPlayerCount since MinPlayerCount == MaxPlayerCount for arenas... // only check for MinPlayerCount since MinPlayerCount == MaxPlayerCount for arenas...
if (bgOrTemplate.isArena() && memberscount != MinPlayerCount) if (bgOrTemplate.IsArena() && memberscount != MinPlayerCount)
return GroupJoinBattlegroundResult.ArenaTeamPartySize; return GroupJoinBattlegroundResult.ArenaTeamPartySize;
return GroupJoinBattlegroundResult.None; return GroupJoinBattlegroundResult.None;
@@ -1795,7 +1795,7 @@ namespace Game.Groups
public void SetDungeonDifficultyID(Difficulty difficulty) public void SetDungeonDifficultyID(Difficulty difficulty)
{ {
m_dungeonDifficulty = difficulty; m_dungeonDifficulty = difficulty;
if (!isBGGroup() && !isBFGroup()) if (!IsBGGroup() && !IsBFGroup())
{ {
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_DIFFICULTY); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_DIFFICULTY);
@@ -1805,7 +1805,7 @@ namespace Game.Groups
DB.Characters.Execute(stmt); DB.Characters.Execute(stmt);
} }
for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.next()) for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.Next())
{ {
Player player = refe.GetSource(); Player player = refe.GetSource();
if (player.GetSession() == null) if (player.GetSession() == null)
@@ -1819,7 +1819,7 @@ namespace Game.Groups
public void SetRaidDifficultyID(Difficulty difficulty) public void SetRaidDifficultyID(Difficulty difficulty)
{ {
m_raidDifficulty = difficulty; m_raidDifficulty = difficulty;
if (!isBGGroup() && !isBFGroup()) if (!IsBGGroup() && !IsBFGroup())
{ {
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_RAID_DIFFICULTY); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_RAID_DIFFICULTY);
@@ -1829,7 +1829,7 @@ namespace Game.Groups
DB.Characters.Execute(stmt); DB.Characters.Execute(stmt);
} }
for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.next()) for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.Next())
{ {
Player player = refe.GetSource(); Player player = refe.GetSource();
if (player.GetSession() == null) if (player.GetSession() == null)
@@ -1843,7 +1843,7 @@ namespace Game.Groups
public void SetLegacyRaidDifficultyID(Difficulty difficulty) public void SetLegacyRaidDifficultyID(Difficulty difficulty)
{ {
m_legacyRaidDifficulty = difficulty; m_legacyRaidDifficulty = difficulty;
if (!isBGGroup() && !isBFGroup()) if (!IsBGGroup() && !IsBFGroup())
{ {
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_LEGACY_RAID_DIFFICULTY); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_LEGACY_RAID_DIFFICULTY);
@@ -1853,7 +1853,7 @@ namespace Game.Groups
DB.Characters.Execute(stmt); DB.Characters.Execute(stmt);
} }
for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.next()) for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.Next())
{ {
Player player = refe.GetSource(); Player player = refe.GetSource();
if (player.GetSession() == null) if (player.GetSession() == null)
@@ -1886,7 +1886,7 @@ namespace Game.Groups
public void ResetInstances(InstanceResetMethod method, bool isRaid, bool isLegacy, Player SendMsgTo) public void ResetInstances(InstanceResetMethod method, bool isRaid, bool isLegacy, Player SendMsgTo)
{ {
if (isBGGroup() || isBFGroup()) if (IsBGGroup() || IsBFGroup())
return; return;
// method can be INSTANCE_RESET_ALL, INSTANCE_RESET_CHANGE_DIFFICULTY, INSTANCE_RESET_GROUP_DISBAND // method can be INSTANCE_RESET_ALL, INSTANCE_RESET_CHANGE_DIFFICULTY, INSTANCE_RESET_GROUP_DISBAND
@@ -1939,7 +1939,7 @@ namespace Game.Groups
Group group = SendMsgTo.GetGroup(); Group group = SendMsgTo.GetGroup();
if (group) if (group)
{ {
for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.next()) for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next())
{ {
Player player = refe.GetSource(); Player player = refe.GetSource();
if (player) if (player)
@@ -2014,7 +2014,7 @@ namespace Game.Groups
public InstanceBind BindToInstance(InstanceSave save, bool permanent, bool load = false) public InstanceBind BindToInstance(InstanceSave save, bool permanent, bool load = false)
{ {
if (save == null || isBGGroup() || isBFGroup()) if (save == null || IsBGGroup() || IsBFGroup())
return null; return null;
if (!m_boundInstances.ContainsKey(save.GetDifficultyID())) if (!m_boundInstances.ContainsKey(save.GetDifficultyID()))
@@ -2306,24 +2306,24 @@ namespace Game.Groups
public bool IsFull() public bool IsFull()
{ {
return isRaidGroup() ? (m_memberSlots.Count >= MapConst.MaxRaidSize) : (m_memberSlots.Count >= MapConst.MaxGroupSize); return IsRaidGroup() ? (m_memberSlots.Count >= MapConst.MaxRaidSize) : (m_memberSlots.Count >= MapConst.MaxGroupSize);
} }
public bool isLFGGroup() public bool IsLFGGroup()
{ {
return m_groupFlags.HasAnyFlag(GroupFlags.Lfg); return m_groupFlags.HasAnyFlag(GroupFlags.Lfg);
} }
public bool isRaidGroup() public bool IsRaidGroup()
{ {
return m_groupFlags.HasAnyFlag(GroupFlags.Raid); return m_groupFlags.HasAnyFlag(GroupFlags.Raid);
} }
public bool isBGGroup() public bool IsBGGroup()
{ {
return m_bgGroup != null; return m_bgGroup != null;
} }
public bool isBFGroup() public bool IsBFGroup()
{ {
return m_bfGroup != null; return m_bfGroup != null;
} }
@@ -2333,7 +2333,7 @@ namespace Game.Groups
return GetMembersCount() > 0; return GetMembersCount() > 0;
} }
public bool isRollLootActive() { return !RollId.Empty(); } public bool IsRollLootActive() { return !RollId.Empty(); }
public ObjectGuid GetLeaderGUID() public ObjectGuid GetLeaderGUID()
{ {
@@ -2446,7 +2446,7 @@ namespace Game.Groups
public void SetGroupMemberFlag(ObjectGuid guid, bool apply, GroupMemberFlags flag) public void SetGroupMemberFlag(ObjectGuid guid, bool apply, GroupMemberFlags flag)
{ {
// Assistants, main assistants and main tanks are only available in raid groups // Assistants, main assistants and main tanks are only available in raid groups
if (!isRaidGroup()) if (!IsRaidGroup())
return; return;
// Check if player is really in the raid // Check if player is really in the raid
@@ -2487,7 +2487,7 @@ namespace Game.Groups
Roll GetRoll(ObjectGuid lootObjectGuid, byte lootListId) Roll GetRoll(ObjectGuid lootObjectGuid, byte lootListId)
{ {
foreach (var roll in RollId) foreach (var roll in RollId)
if (roll.getTarget() != null && roll.getTarget().GetGUID() == lootObjectGuid && roll.itemSlot == lootListId && roll.isValid()) if (roll.GetTarget() != null && roll.GetTarget().GetGUID() == lootObjectGuid && roll.itemSlot == lootListId && roll.IsValid())
return roll; return roll;
return null; return null;
} }
@@ -2499,13 +2499,13 @@ namespace Game.Groups
void DelinkMember(ObjectGuid guid) void DelinkMember(ObjectGuid guid)
{ {
GroupReference refe = m_memberMgr.getFirst(); GroupReference refe = m_memberMgr.GetFirst();
while (refe != null) while (refe != null)
{ {
GroupReference nextRef = refe.next(); GroupReference nextRef = refe.Next();
if (refe.GetSource().GetGUID() == guid) if (refe.GetSource().GetGUID() == guid)
{ {
refe.unlink(); refe.Unlink();
break; break;
} }
refe = nextRef; refe = nextRef;
@@ -2579,7 +2579,7 @@ namespace Game.Groups
public uint GetDbStoreId() { return m_dbStoreId; } public uint GetDbStoreId() { return m_dbStoreId; }
public List<MemberSlot> GetMemberSlots() { return m_memberSlots; } public List<MemberSlot> GetMemberSlots() { return m_memberSlots; }
public GroupReference GetFirstMember() { return (GroupReference)m_memberMgr.getFirst(); } public GroupReference GetFirstMember() { return (GroupReference)m_memberMgr.GetFirst(); }
public uint GetMembersCount() { return (uint)m_memberSlots.Count; } public uint GetMembersCount() { return (uint)m_memberSlots.Count; }
public GroupFlags GetGroupFlags() { return m_groupFlags; } public GroupFlags GetGroupFlags() { return m_groupFlags; }
@@ -2587,7 +2587,7 @@ namespace Game.Groups
public void BroadcastWorker(Action<Player> worker) public void BroadcastWorker(Action<Player> worker)
{ {
for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.next()) for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.Next())
worker(refe.GetSource()); worker(refe.GetSource());
} }
@@ -2639,20 +2639,20 @@ namespace Game.Groups
rollTypeMask = RollMask.AllNoDisenchant; rollTypeMask = RollMask.AllNoDisenchant;
} }
public void setLoot(Loot pLoot) public void SetLoot(Loot pLoot)
{ {
link(pLoot, this); Link(pLoot, this);
} }
public Loot getLoot() public Loot GetLoot()
{ {
return getTarget(); return GetTarget();
} }
public override void targetObjectBuildLink() public override void TargetObjectBuildLink()
{ {
// called from link() // called from link()
getTarget().addLootValidatorRef(this); GetTarget().AddLootValidatorRef(this);
} }
public void FillPacket(LootItemData lootItem) public void FillPacket(LootItemData lootItem)
@@ -2661,7 +2661,7 @@ namespace Game.Groups
lootItem.Quantity = itemCount; lootItem.Quantity = itemCount;
lootItem.LootListID = (byte)(itemSlot + 1); lootItem.LootListID = (byte)(itemSlot + 1);
LootItem lootItemInSlot = getTarget().GetItemInSlot(itemSlot); LootItem lootItemInSlot = GetTarget().GetItemInSlot(itemSlot);
if (lootItemInSlot != null) if (lootItemInSlot != null)
{ {
lootItem.CanTradeToTapList = lootItemInSlot.allowedGUIDs.Count > 1; lootItem.CanTradeToTapList = lootItemInSlot.allowedGUIDs.Count > 1;
@@ -2671,7 +2671,7 @@ namespace Game.Groups
public ItemDisenchantLootRecord GetItemDisenchantLoot(Player player) public ItemDisenchantLootRecord GetItemDisenchantLoot(Player player)
{ {
LootItem lootItemInSlot = getTarget().GetItemInSlot(itemSlot); LootItem lootItemInSlot = GetTarget().GetItemInSlot(itemSlot);
if (lootItemInSlot != null) if (lootItemInSlot != null)
{ {
ItemInstance itemInstance = new ItemInstance(lootItemInSlot); ItemInstance itemInstance = new ItemInstance(lootItemInSlot);
+7 -7
View File
@@ -27,24 +27,24 @@ namespace Game.Groups
iSubGroup = 0; iSubGroup = 0;
} }
~GroupReference() { unlink(); } ~GroupReference() { Unlink(); }
public override void targetObjectBuildLink() public override void TargetObjectBuildLink()
{ {
getTarget().LinkMember(this); GetTarget().LinkMember(this);
} }
public new GroupReference next() { return (GroupReference)base.next(); } public new GroupReference Next() { return (GroupReference)base.Next(); }
public byte getSubGroup() { return iSubGroup; } public byte GetSubGroup() { return iSubGroup; }
public void setSubGroup(byte pSubGroup) { iSubGroup = pSubGroup; } public void SetSubGroup(byte pSubGroup) { iSubGroup = pSubGroup; }
byte iSubGroup; byte iSubGroup;
} }
public class GroupRefManager : RefManager<Group, Player> public class GroupRefManager : RefManager<Group, Player>
{ {
public new GroupReference getFirst() { return (GroupReference)base.getFirst(); } public new GroupReference GetFirst() { return (GroupReference)base.GetFirst(); }
} }
} }
+3 -3
View File
@@ -184,7 +184,7 @@ namespace Game
avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, bracketEntry.GetBracketId()); avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, bracketEntry.GetBracketId());
} }
for (GroupReference refe = grp.GetFirstMember(); refe != null; refe = refe.next()) for (GroupReference refe = grp.GetFirstMember(); refe != null; refe = refe.Next())
{ {
Player member = refe.GetSource(); Player member = refe.GetSource();
if (!member) if (!member)
@@ -221,7 +221,7 @@ namespace Game
return; return;
// Prevent players from sending BuildPvpLogDataPacket in an arena except for when sent in Battleground.EndBattleground. // Prevent players from sending BuildPvpLogDataPacket in an arena except for when sent in Battleground.EndBattleground.
if (bg.isArena()) if (bg.IsArena())
return; return;
PVPLogData pvpLogData; PVPLogData pvpLogData;
@@ -544,7 +544,7 @@ namespace Game
avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, bracketEntry.GetBracketId()); avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, bracketEntry.GetBracketId());
} }
for (GroupReference refe = grp.GetFirstMember(); refe != null; refe = refe.next()) for (GroupReference refe = grp.GetFirstMember(); refe != null; refe = refe.Next())
{ {
Player member = refe.GetSource(); Player member = refe.GetSource();
if (!member) if (!member)
+3 -3
View File
@@ -273,7 +273,7 @@ namespace Game
if (!group) if (!group)
{ {
group = GetPlayer().GetGroup(); group = GetPlayer().GetGroup();
if (!group || group.isBGGroup()) if (!group || group.IsBGGroup())
return; return;
} }
@@ -314,7 +314,7 @@ namespace Game
case ChatMsg.Raid: case ChatMsg.Raid:
{ {
Group group = GetPlayer().GetGroup(); Group group = GetPlayer().GetGroup();
if (!group || !group.isRaidGroup() || group.isBGGroup()) if (!group || !group.IsRaidGroup() || group.IsBGGroup())
return; return;
if (group.IsLeader(GetPlayer().GetGUID())) if (group.IsLeader(GetPlayer().GetGUID()))
@@ -330,7 +330,7 @@ namespace Game
case ChatMsg.RaidWarning: case ChatMsg.RaidWarning:
{ {
Group group = GetPlayer().GetGroup(); Group group = GetPlayer().GetGroup();
if (!group || !(group.isRaidGroup() || WorldConfig.GetBoolValue(WorldCfg.ChatPartyRaidWarnings)) || !(group.IsLeader(GetPlayer().GetGUID()) || group.IsAssistant(GetPlayer().GetGUID())) || group.isBGGroup()) if (!group || !(group.IsRaidGroup() || WorldConfig.GetBoolValue(WorldCfg.ChatPartyRaidWarnings)) || !(group.IsLeader(GetPlayer().GetGUID()) || group.IsAssistant(GetPlayer().GetGUID())) || group.IsBGGroup())
return; return;
Global.ScriptMgr.OnPlayerChat(GetPlayer(), type, lang, msg, group); Global.ScriptMgr.OnPlayerChat(GetPlayer(), type, lang, msg, group);
+4 -4
View File
@@ -95,11 +95,11 @@ namespace Game
} }
Group group = GetPlayer().GetGroup(); Group group = GetPlayer().GetGroup();
if (group && group.isBGGroup()) if (group && group.IsBGGroup())
group = GetPlayer().GetOriginalGroup(); group = GetPlayer().GetOriginalGroup();
Group group2 = player.GetGroup(); Group group2 = player.GetGroup();
if (group2 && group2.isBGGroup()) if (group2 && group2.IsBGGroup())
group2 = player.GetOriginalGroup(); group2 = player.GetOriginalGroup();
PartyInvite partyInvite; PartyInvite partyInvite;
@@ -421,7 +421,7 @@ namespace Game
group.SendTargetIconList(this, packet.PartyIndex); group.SendTargetIconList(this, packet.PartyIndex);
else // target icon update else // target icon update
{ {
if (group.isRaidGroup() && !group.IsLeader(GetPlayer().GetGUID()) && !group.IsAssistant(GetPlayer().GetGUID())) if (group.IsRaidGroup() && !group.IsLeader(GetPlayer().GetGUID()) && !group.IsAssistant(GetPlayer().GetGUID()))
return; return;
if (packet.Target.IsPlayer()) if (packet.Target.IsPlayer())
@@ -645,7 +645,7 @@ namespace Game
if (!group) if (!group)
return; return;
if (group.isRaidGroup() && !group.IsLeader(GetPlayer().GetGUID()) && !group.IsAssistant(GetPlayer().GetGUID())) if (group.IsRaidGroup() && !group.IsLeader(GetPlayer().GetGUID()) && !group.IsAssistant(GetPlayer().GetGUID()))
return; return;
group.DeleteRaidMarker(packet.MarkerId); group.DeleteRaidMarker(packet.MarkerId);

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