More refactoring of code.
This commit is contained in:
@@ -25,13 +25,13 @@ namespace Framework.Dynamic
|
||||
FROM _RefFrom;
|
||||
|
||||
// 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
|
||||
public virtual void targetObjectDestroyLink() { }
|
||||
public virtual void TargetObjectDestroyLink() { }
|
||||
|
||||
// Tell our refFrom (source) object, that the link is cut (Target destroyed)
|
||||
public virtual void sourceObjectDestroyLink() { }
|
||||
public virtual void SourceObjectDestroyLink() { }
|
||||
|
||||
public Reference()
|
||||
{
|
||||
@@ -39,24 +39,24 @@ namespace Framework.Dynamic
|
||||
}
|
||||
|
||||
// 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
|
||||
if (isValid())
|
||||
unlink();
|
||||
if (IsValid())
|
||||
Unlink();
|
||||
if (toObj != null)
|
||||
{
|
||||
_RefTo = toObj;
|
||||
_RefFrom = fromObj;
|
||||
targetObjectBuildLink();
|
||||
TargetObjectBuildLink();
|
||||
}
|
||||
}
|
||||
|
||||
// We don't need the reference anymore. Call comes from the refFrom object
|
||||
// Tell our refTo object, that the link is cut
|
||||
public void unlink()
|
||||
public void Unlink()
|
||||
{
|
||||
targetObjectDestroyLink();
|
||||
TargetObjectDestroyLink();
|
||||
Delink();
|
||||
_RefTo = 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
|
||||
// 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();
|
||||
_RefTo = null;
|
||||
}
|
||||
|
||||
public bool isValid() // Only check the iRefTo
|
||||
public bool IsValid() // Only check the iRefTo
|
||||
{
|
||||
return _RefTo != null;
|
||||
}
|
||||
|
||||
public Reference<TO, FROM> next() { return ((Reference<TO, FROM>)GetNextElement()); }
|
||||
public Reference<TO, FROM> prev() { return ((Reference<TO, FROM>)GetPrevElement()); }
|
||||
public Reference<TO, FROM> Next() { return ((Reference<TO, FROM>)GetNextElement()); }
|
||||
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 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> getLast() { return (Reference<TO, FROM>)base.GetLastElement(); }
|
||||
public Reference<TO, FROM> GetFirst() { return (Reference<TO, FROM>)base.GetFirstElement(); }
|
||||
public Reference<TO, FROM> GetLast() { return (Reference<TO, FROM>)base.GetLastElement(); }
|
||||
|
||||
public void clearReferences()
|
||||
public void ClearReferences()
|
||||
{
|
||||
Reference<TO, FROM> refe;
|
||||
while ((refe = getFirst()) != null)
|
||||
refe.invalidate();
|
||||
while ((refe = GetFirst()) != null)
|
||||
refe.Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,8 +73,8 @@ namespace Game.AI
|
||||
if (summoner != null)
|
||||
{
|
||||
Unit target = summoner.GetAttackerForHelper();
|
||||
if (target == null && summoner.CanHaveThreatList() && !summoner.GetThreatManager().isThreatListEmpty())
|
||||
target = summoner.GetThreatManager().getHostilTarget();
|
||||
if (target == null && summoner.CanHaveThreatList() && !summoner.GetThreatManager().IsThreatListEmpty())
|
||||
target = summoner.GetThreatManager().GetHostilTarget();
|
||||
if (target != null && (creature.IsFriendlyTo(summoner) || creature.IsHostileTo(target)))
|
||||
creature.GetAI().AttackStart(target);
|
||||
}
|
||||
@@ -238,7 +238,7 @@ namespace Game.AI
|
||||
|
||||
return me.GetVictim() != null;
|
||||
}
|
||||
else if (me.GetThreatManager().isThreatListEmpty())
|
||||
else if (me.GetThreatManager().IsThreatListEmpty())
|
||||
{
|
||||
EnterEvadeMode(EvadeReason.NoHostiles);
|
||||
return false;
|
||||
|
||||
@@ -37,9 +37,9 @@ namespace Game.AI
|
||||
if (!obj.IsTypeMask(TypeMask.Unit))
|
||||
return false;
|
||||
|
||||
var threatList = me.GetThreatManager().getThreatList();
|
||||
var threatList = me.GetThreatManager().GetThreatList();
|
||||
foreach (var refe in threatList)
|
||||
if (refe.getUnitGuid() == obj.GetGUID())
|
||||
if (refe.GetUnitGuid() == obj.GetGUID())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace Game.AI
|
||||
me.GetMotionMaster().Clear();
|
||||
me.GetMotionMaster().MoveIdle();
|
||||
me.CombatStop();
|
||||
me.GetHostileRefManager().deleteReferences();
|
||||
me.GetHostileRefManager().DeleteReferences();
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -230,7 +230,7 @@ namespace Game.AI
|
||||
SpellCastTargets targets = new SpellCastTargets();
|
||||
targets.SetUnitTarget(target);
|
||||
|
||||
spell.prepare(targets);
|
||||
spell.Prepare(targets);
|
||||
}
|
||||
|
||||
// deleted cached Spell objects
|
||||
@@ -262,14 +262,14 @@ namespace Game.AI
|
||||
return;
|
||||
|
||||
//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;
|
||||
|
||||
m_AllySet.Clear();
|
||||
m_AllySet.Add(me.GetGUID());
|
||||
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();
|
||||
if (!target || !target.IsInMap(owner) || !group.SameSubGroup(owner.ToPlayer(), target))
|
||||
|
||||
@@ -113,17 +113,17 @@ namespace Game.AI
|
||||
// Select the targets satifying the predicate.
|
||||
public Unit SelectTarget(SelectAggroTarget targetType, uint position, ISelector selector)
|
||||
{
|
||||
var threatlist = GetThreatManager().getThreatList();
|
||||
var threatlist = GetThreatManager().GetThreatList();
|
||||
if (position >= threatlist.Count)
|
||||
return null;
|
||||
|
||||
List<Unit> targetList = new List<Unit>();
|
||||
Unit currentVictim = null;
|
||||
|
||||
var currentVictimReference = GetThreatManager().getCurrentVictim();
|
||||
var currentVictimReference = GetThreatManager().GetCurrentVictim();
|
||||
if (currentVictimReference != null)
|
||||
{
|
||||
currentVictim = currentVictimReference.getTarget();
|
||||
currentVictim = currentVictimReference.GetTarget();
|
||||
|
||||
// Current victim always goes first
|
||||
if (currentVictim && selector.Check(currentVictim))
|
||||
@@ -132,10 +132,10 @@ namespace Game.AI
|
||||
|
||||
foreach (var hostileRef in threatlist)
|
||||
{
|
||||
if (currentVictim != null && hostileRef.getTarget() != currentVictim && selector.Check(hostileRef.getTarget()))
|
||||
targetList.Add(hostileRef.getTarget());
|
||||
else if (currentVictim == null && selector.Check(hostileRef.getTarget()))
|
||||
targetList.Add(hostileRef.getTarget());
|
||||
if (currentVictim != null && hostileRef.GetTarget() != currentVictim && selector.Check(hostileRef.GetTarget()))
|
||||
targetList.Add(hostileRef.GetTarget());
|
||||
else if (currentVictim == null && selector.Check(hostileRef.GetTarget()))
|
||||
targetList.Add(hostileRef.GetTarget());
|
||||
}
|
||||
|
||||
if (position >= targetList.Count)
|
||||
@@ -178,13 +178,13 @@ namespace Game.AI
|
||||
{
|
||||
var targetList = new List<Unit>();
|
||||
|
||||
var threatlist = GetThreatManager().getThreatList();
|
||||
var threatlist = GetThreatManager().GetThreatList();
|
||||
if (threatlist.Empty())
|
||||
return targetList;
|
||||
|
||||
foreach (var hostileRef in threatlist)
|
||||
if (selector.Check(hostileRef.getTarget()))
|
||||
targetList.Add(hostileRef.getTarget());
|
||||
if (selector.Check(hostileRef.GetTarget()))
|
||||
targetList.Add(hostileRef.GetTarget());
|
||||
|
||||
if (targetList.Count < maxTargets)
|
||||
return targetList;
|
||||
@@ -368,15 +368,15 @@ namespace Game.AI
|
||||
public virtual void HealDone(Unit to, uint addhealth) { }
|
||||
public virtual void SpellInterrupted(uint spellId, uint unTimeMs) {}
|
||||
|
||||
public virtual void sGossipHello(Player player) { }
|
||||
public virtual void sGossipSelect(Player player, uint menuId, uint gossipListId) { }
|
||||
public virtual void sGossipSelectCode(Player player, uint menuId, uint gossipListId, string code) { }
|
||||
public virtual void sQuestAccept(Player player, Quest quest) { }
|
||||
public virtual void sQuestSelect(Player player, Quest quest) { }
|
||||
public virtual void sQuestComplete(Player player, Quest quest) { }
|
||||
public virtual void sQuestReward(Player player, Quest quest, uint opt) { }
|
||||
public virtual bool sOnDummyEffect(Unit caster, uint spellId, int effIndex) { return false; }
|
||||
public virtual void sOnGameEvent(bool start, ushort eventId) { }
|
||||
public virtual void GossipHello(Player player) { }
|
||||
public virtual void GossipSelect(Player player, uint menuId, uint gossipListId) { }
|
||||
public virtual void GossipSelectCode(Player player, uint menuId, uint gossipListId, string code) { }
|
||||
public virtual void QuestAccept(Player player, Quest quest) { }
|
||||
public virtual void QuestSelect(Player player, Quest quest) { }
|
||||
public virtual void QuestComplete(Player player, Quest quest) { }
|
||||
public virtual void QuestReward(Player player, Quest quest, uint opt) { }
|
||||
public virtual bool OnDummyEffect(Unit caster, uint spellId, int effIndex) { return false; }
|
||||
public virtual void OnGameEvent(bool start, ushort eventId) { }
|
||||
|
||||
public static AISpellInfoType[] AISpellInfo;
|
||||
|
||||
@@ -552,9 +552,9 @@ namespace Game.AI
|
||||
if (_playerOnly && !target.IsTypeId(TypeId.Player))
|
||||
return false;
|
||||
|
||||
HostileReference currentVictim = _source.GetThreatManager().getCurrentVictim();
|
||||
HostileReference currentVictim = _source.GetThreatManager().GetCurrentVictim();
|
||||
if (currentVictim != null)
|
||||
return target.GetGUID() != currentVictim.getUnitGuid();
|
||||
return target.GetGUID() != currentVictim.GetUnitGuid();
|
||||
|
||||
return target != _source.GetVictim();
|
||||
}
|
||||
|
||||
@@ -569,7 +569,7 @@ namespace Game.AI
|
||||
{
|
||||
SpellCastTargets targets = new SpellCastTargets();
|
||||
targets.SetUnitTarget(spell.Item2);
|
||||
spell.Item1.prepare(targets);
|
||||
spell.Item1.Prepare(targets);
|
||||
}
|
||||
|
||||
void DoRangedAttackIfReady()
|
||||
|
||||
@@ -184,17 +184,17 @@ namespace Game.AI
|
||||
//Drops all threat to 0%. Does not remove players from the threat list
|
||||
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());
|
||||
return;
|
||||
}
|
||||
|
||||
var threatlist = me.GetThreatManager().getThreatList();
|
||||
var threatlist = me.GetThreatManager().GetThreatList();
|
||||
|
||||
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)
|
||||
DoModifyThreatPercent(unit, -100);
|
||||
}
|
||||
@@ -204,14 +204,14 @@ namespace Game.AI
|
||||
{
|
||||
if (unit == null)
|
||||
return 0.0f;
|
||||
return me.GetThreatManager().getThreat(unit);
|
||||
return me.GetThreatManager().GetThreat(unit);
|
||||
}
|
||||
|
||||
public void DoModifyThreatPercent(Unit unit, int pct)
|
||||
{
|
||||
if (unit == null)
|
||||
return;
|
||||
me.GetThreatManager().modifyThreatPercent(unit, pct);
|
||||
me.GetThreatManager().ModifyThreatPercent(unit, pct);
|
||||
}
|
||||
|
||||
void DoTeleportTo(float x, float y, float z, uint time = 0)
|
||||
@@ -485,10 +485,10 @@ namespace Game.AI
|
||||
float x, y, z;
|
||||
me.GetPosition(out x, out y, out z);
|
||||
|
||||
var threatList = me.GetThreatManager().getThreatList();
|
||||
var threatList = me.GetThreatManager().GetThreatList();
|
||||
foreach (var refe in threatList)
|
||||
{
|
||||
Unit target = refe.getTarget();
|
||||
Unit target = refe.GetTarget();
|
||||
if (target)
|
||||
if (target.IsTypeId(TypeId.Player) && !CheckBoundary(target))
|
||||
target.NearTeleportTo(x, y, z, 0);
|
||||
|
||||
@@ -24,14 +24,14 @@ using System.Linq;
|
||||
|
||||
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_uiWPWaitTimer = 2500;
|
||||
m_uiPlayerCheckTimer = 1000;
|
||||
m_uiEscortState = eEscortState.None;
|
||||
m_uiEscortState = EscortState.None;
|
||||
MaxPlayerDistance = 50;
|
||||
m_pQuestForEscort = null;
|
||||
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 (HasEscortState(eEscortState.Escorting) && AssistPlayerInCombatAgainst(who))
|
||||
if (HasEscortState(EscortState.Escorting) && AssistPlayerInCombatAgainst(who))
|
||||
return;
|
||||
|
||||
if (!me.CanFly() && me.GetDistanceZ(who) > SharedConst.CreatureAttackRangeZ)
|
||||
@@ -135,7 +135,7 @@ namespace Game.AI
|
||||
|
||||
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;
|
||||
|
||||
Player player = GetPlayerForEscort();
|
||||
@@ -144,7 +144,7 @@ namespace Game.AI
|
||||
Group group = player.GetGroup();
|
||||
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();
|
||||
if (member)
|
||||
@@ -159,7 +159,7 @@ namespace Game.AI
|
||||
|
||||
public override void JustRespawned()
|
||||
{
|
||||
m_uiEscortState = eEscortState.None;
|
||||
m_uiEscortState = EscortState.None;
|
||||
|
||||
if (!IsCombatMovementAllowed())
|
||||
SetCombatMovement(true);
|
||||
@@ -185,9 +185,9 @@ namespace Game.AI
|
||||
me.CombatStop(true);
|
||||
me.SetLootRecipient(null);
|
||||
|
||||
if (HasEscortState(eEscortState.Escorting))
|
||||
if (HasEscortState(EscortState.Escorting))
|
||||
{
|
||||
AddEscortState(eEscortState.Returning);
|
||||
AddEscortState(EscortState.Returning);
|
||||
ReturnToLastPoint();
|
||||
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();
|
||||
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();
|
||||
if (member)
|
||||
@@ -226,7 +226,7 @@ namespace Game.AI
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
//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)
|
||||
{
|
||||
@@ -270,7 +270,7 @@ namespace Game.AI
|
||||
|
||||
}
|
||||
|
||||
if (!HasEscortState(eEscortState.Paused))
|
||||
if (!HasEscortState(EscortState.Paused))
|
||||
{
|
||||
var currentWp = WaypointList[CurrentWPIndex];
|
||||
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
|
||||
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)
|
||||
{
|
||||
@@ -322,7 +322,7 @@ namespace Game.AI
|
||||
|
||||
public override void MovementInform(MovementGeneratorType moveType, uint pointId)
|
||||
{
|
||||
if (moveType != MovementGeneratorType.Point || !HasEscortState(eEscortState.Escorting))
|
||||
if (moveType != MovementGeneratorType.Point || !HasEscortState(EscortState.Escorting))
|
||||
return;
|
||||
|
||||
//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");
|
||||
|
||||
me.SetWalk(!m_bIsRunning);
|
||||
RemoveEscortState(eEscortState.Returning);
|
||||
RemoveEscortState(EscortState.Returning);
|
||||
|
||||
if (m_uiWPWaitTimer == 0)
|
||||
m_uiWPWaitTimer = 1;
|
||||
@@ -415,7 +415,7 @@ namespace Game.AI
|
||||
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());
|
||||
return;
|
||||
@@ -474,18 +474,18 @@ namespace Game.AI
|
||||
else
|
||||
me.SetWalk(true);
|
||||
|
||||
AddEscortState(eEscortState.Escorting);
|
||||
AddEscortState(EscortState.Escorting);
|
||||
}
|
||||
|
||||
public void SetEscortPaused(bool on)
|
||||
{
|
||||
if (!HasEscortState(eEscortState.Escorting))
|
||||
if (!HasEscortState(EscortState.Escorting))
|
||||
return;
|
||||
|
||||
if (on)
|
||||
AddEscortState(eEscortState.Paused);
|
||||
AddEscortState(EscortState.Paused);
|
||||
else
|
||||
RemoveEscortState(eEscortState.Paused);
|
||||
RemoveEscortState(EscortState.Paused);
|
||||
}
|
||||
|
||||
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 WaypointStart(uint pointId) { }
|
||||
|
||||
public bool HasEscortState(eEscortState escortState) { return m_uiEscortState.HasAnyFlag(escortState); }
|
||||
public override bool IsEscorted() { return m_uiEscortState.HasAnyFlag(eEscortState.Escorting); }
|
||||
public bool HasEscortState(EscortState escortState) { return m_uiEscortState.HasAnyFlag(escortState); }
|
||||
public override bool IsEscorted() { return m_uiEscortState.HasAnyFlag(EscortState.Escorting); }
|
||||
|
||||
public void SetMaxPlayerDistance(float newMax) { MaxPlayerDistance = newMax; }
|
||||
public float GetMaxPlayerDistance() { return MaxPlayerDistance; }
|
||||
@@ -571,13 +571,13 @@ namespace Game.AI
|
||||
|
||||
public Player GetPlayerForEscort() { return Global.ObjAccessor.GetPlayer(me, m_uiPlayerGUID); }
|
||||
|
||||
void AddEscortState(eEscortState escortState) { m_uiEscortState |= escortState; }
|
||||
void RemoveEscortState(eEscortState escortState) { m_uiEscortState &= ~escortState; }
|
||||
void AddEscortState(EscortState escortState) { m_uiEscortState |= escortState; }
|
||||
void RemoveEscortState(EscortState escortState) { m_uiEscortState &= ~escortState; }
|
||||
|
||||
ObjectGuid m_uiPlayerGUID;
|
||||
uint m_uiWPWaitTimer;
|
||||
uint m_uiPlayerCheckTimer;
|
||||
eEscortState m_uiEscortState;
|
||||
EscortState m_uiEscortState;
|
||||
float MaxPlayerDistance;
|
||||
|
||||
Quest m_pQuestForEscort; //generally passed in Start() when regular escort script.
|
||||
@@ -595,7 +595,7 @@ namespace Game.AI
|
||||
bool HasImmuneToNPCFlags;
|
||||
}
|
||||
|
||||
public enum eEscortState
|
||||
public enum EscortState
|
||||
{
|
||||
None = 0x000, //nothing in progress
|
||||
Escorting = 0x001, //escort are in progress
|
||||
|
||||
@@ -22,7 +22,7 @@ using System;
|
||||
|
||||
namespace Game.AI
|
||||
{
|
||||
enum eFollowState
|
||||
enum FollowState
|
||||
{
|
||||
None = 0x000,
|
||||
Inprogress = 0x001, //must always have this state for any follow
|
||||
@@ -38,7 +38,7 @@ namespace Game.AI
|
||||
public FollowerAI(Creature creature) : base(creature)
|
||||
{
|
||||
m_uiUpdateFollowTimer = 2500;
|
||||
m_uiFollowState = eFollowState.None;
|
||||
m_uiFollowState = FollowState.None;
|
||||
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 (HasFollowState(eFollowState.Inprogress) && AssistPlayerInCombatAgainst(who))
|
||||
if (HasFollowState(FollowState.Inprogress) && AssistPlayerInCombatAgainst(who))
|
||||
return;
|
||||
|
||||
if (!me.CanFly() && me.GetDistanceZ(who) > SharedConst.CreatureAttackRangeZ)
|
||||
@@ -139,7 +139,7 @@ namespace Game.AI
|
||||
|
||||
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;
|
||||
|
||||
// @todo need a better check for quests with time limit.
|
||||
@@ -149,7 +149,7 @@ namespace Game.AI
|
||||
Group group = player.GetGroup();
|
||||
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();
|
||||
if (member)
|
||||
@@ -164,7 +164,7 @@ namespace Game.AI
|
||||
|
||||
public override void JustRespawned()
|
||||
{
|
||||
m_uiFollowState = eFollowState.None;
|
||||
m_uiFollowState = FollowState.None;
|
||||
|
||||
if (!IsCombatMovementAllowed())
|
||||
SetCombatMovement(true);
|
||||
@@ -182,7 +182,7 @@ namespace Game.AI
|
||||
me.CombatStop(true);
|
||||
me.SetLootRecipient(null);
|
||||
|
||||
if (HasFollowState(eFollowState.Inprogress))
|
||||
if (HasFollowState(FollowState.Inprogress))
|
||||
{
|
||||
Log.outDebug(LogFilter.Scripts, "FollowerAI left combat, returning to CombatStartPosition.");
|
||||
|
||||
@@ -204,11 +204,11 @@ namespace Game.AI
|
||||
|
||||
public override void UpdateAI(uint uiDiff)
|
||||
{
|
||||
if (HasFollowState(eFollowState.Inprogress) && !me.GetVictim())
|
||||
if (HasFollowState(FollowState.Inprogress) && !me.GetVictim())
|
||||
{
|
||||
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.");
|
||||
me.DespawnOrUnsummon();
|
||||
@@ -220,11 +220,11 @@ namespace Game.AI
|
||||
Player player = GetLeaderForFollower();
|
||||
if (player)
|
||||
{
|
||||
if (HasFollowState(eFollowState.Returning))
|
||||
if (HasFollowState(FollowState.Returning))
|
||||
{
|
||||
Log.outDebug(LogFilter.Scripts, "FollowerAI is returning to leader.");
|
||||
|
||||
RemoveFollowState(eFollowState.Returning);
|
||||
RemoveFollowState(FollowState.Returning);
|
||||
me.GetMotionMaster().MoveFollow(player, SharedConst.PetFollowDist, SharedConst.PetFollowAngle);
|
||||
return;
|
||||
}
|
||||
@@ -232,7 +232,7 @@ namespace Game.AI
|
||||
Group group = player.GetGroup();
|
||||
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();
|
||||
if (member && me.IsWithinDistInMap(member, 100.0f))
|
||||
@@ -275,15 +275,15 @@ namespace Game.AI
|
||||
|
||||
public override void MovementInform(MovementGeneratorType motionType, uint pointId)
|
||||
{
|
||||
if (motionType != MovementGeneratorType.Point || !HasFollowState(eFollowState.Inprogress))
|
||||
if (motionType != MovementGeneratorType.Point || !HasFollowState(FollowState.Inprogress))
|
||||
return;
|
||||
|
||||
if (pointId == 0xFFFFFF)
|
||||
{
|
||||
if (GetLeaderForFollower())
|
||||
{
|
||||
if (!HasFollowState(eFollowState.Paused))
|
||||
AddFollowState(eFollowState.Returning);
|
||||
if (!HasFollowState(FollowState.Paused))
|
||||
AddFollowState(FollowState.Returning);
|
||||
}
|
||||
else
|
||||
me.DespawnOrUnsummon();
|
||||
@@ -298,7 +298,7 @@ namespace Game.AI
|
||||
return;
|
||||
}
|
||||
|
||||
if (HasFollowState(eFollowState.Inprogress))
|
||||
if (HasFollowState(FollowState.Inprogress))
|
||||
{
|
||||
Log.outError(LogFilter.Scenario, "FollowerAI attempt to StartFollow while already following.");
|
||||
return;
|
||||
@@ -322,7 +322,7 @@ namespace Game.AI
|
||||
me.SetNpcFlags(NPCFlags.None);
|
||||
me.SetNpcFlags2(NPCFlags2.None);
|
||||
|
||||
AddFollowState(eFollowState.Inprogress);
|
||||
AddFollowState(FollowState.Inprogress);
|
||||
|
||||
me.GetMotionMaster().MoveFollow(player, SharedConst.PetFollowDist, SharedConst.PetFollowAngle);
|
||||
|
||||
@@ -341,7 +341,7 @@ namespace Game.AI
|
||||
Group group = player.GetGroup();
|
||||
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();
|
||||
if (member && me.IsWithinDistInMap(member, 100.0f) && member.IsAlive())
|
||||
@@ -371,24 +371,24 @@ namespace Game.AI
|
||||
}
|
||||
|
||||
if (bWithEndEvent)
|
||||
AddFollowState(eFollowState.PostEvent);
|
||||
AddFollowState(FollowState.PostEvent);
|
||||
else
|
||||
{
|
||||
if (HasFollowState(eFollowState.PostEvent))
|
||||
RemoveFollowState(eFollowState.PostEvent);
|
||||
if (HasFollowState(FollowState.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 RemoveFollowState(eFollowState uiFollowState) { m_uiFollowState &= ~uiFollowState; }
|
||||
void AddFollowState(FollowState uiFollowState) { m_uiFollowState |= uiFollowState; }
|
||||
void RemoveFollowState(FollowState uiFollowState) { m_uiFollowState &= ~uiFollowState; }
|
||||
|
||||
ObjectGuid m_uiLeaderGUID;
|
||||
uint m_uiUpdateFollowTimer;
|
||||
eFollowState m_uiFollowState;
|
||||
FollowState m_uiFollowState;
|
||||
|
||||
Quest m_pQuestForFollow; //normally we have a quest
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ namespace Game.AI
|
||||
Group group = player.GetGroup();
|
||||
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();
|
||||
if (!groupGuy.IsInMap(player))
|
||||
@@ -399,7 +399,7 @@ namespace Game.AI
|
||||
Group group = player.GetGroup();
|
||||
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();
|
||||
if (groupGuy.IsInMap(player) && me.GetDistance(groupGuy) <= checkDist)
|
||||
@@ -800,29 +800,29 @@ namespace Game.AI
|
||||
mEvadeDisabled = disable;
|
||||
}
|
||||
|
||||
public override void sGossipHello(Player player)
|
||||
public override void GossipHello(Player 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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
return true;
|
||||
@@ -916,7 +916,7 @@ namespace Game.AI
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -660,7 +660,7 @@ namespace Game.AI
|
||||
case SmartEvents.GameEventEnd:
|
||||
{
|
||||
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;
|
||||
|
||||
break;
|
||||
@@ -1139,7 +1139,7 @@ namespace Game.AI
|
||||
}
|
||||
|
||||
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);
|
||||
return false;
|
||||
@@ -1158,7 +1158,7 @@ namespace Game.AI
|
||||
}
|
||||
|
||||
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);
|
||||
return false;
|
||||
|
||||
@@ -392,13 +392,13 @@ namespace Game.AI
|
||||
if (me == null)
|
||||
break;
|
||||
|
||||
var threatList = me.GetThreatManager().getThreatList();
|
||||
var threatList = me.GetThreatManager().GetThreatList();
|
||||
foreach (var refe in threatList)
|
||||
{
|
||||
Unit target = Global.ObjAccessor.GetUnit(me, refe.getUnitGuid());
|
||||
Unit target = Global.ObjAccessor.GetUnit(me, refe.GetUnitGuid());
|
||||
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}",
|
||||
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))
|
||||
{
|
||||
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}",
|
||||
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();
|
||||
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();
|
||||
if (member)
|
||||
@@ -3118,10 +3118,10 @@ namespace Game.AI
|
||||
{
|
||||
if (me != null)
|
||||
{
|
||||
var threatList = me.GetThreatManager().getThreatList();
|
||||
var threatList = me.GetThreatManager().GetThreatList();
|
||||
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 (e.Target.hostilRandom.maxDist == 0 || me.IsWithinCombatRange(temp, (float)e.Target.hostilRandom.maxDist))
|
||||
l.Add(temp);
|
||||
@@ -3157,7 +3157,7 @@ namespace Game.AI
|
||||
Group lootGroup = me.GetLootRecipientGroup();
|
||||
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();
|
||||
if (recipient)
|
||||
|
||||
@@ -940,7 +940,7 @@ namespace Game.Achievements
|
||||
Group group = referencePlayer.GetGroup();
|
||||
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();
|
||||
if (groupMember)
|
||||
|
||||
@@ -1292,7 +1292,7 @@ namespace Game.Achievements
|
||||
case CriteriaAdditionalCondition.ArenaType: // 24
|
||||
{
|
||||
Battleground bg = referencePlayer.GetBattleground();
|
||||
if (!bg || !bg.isArena() || bg.GetArenaType() != (ArenaTypes)reqValue)
|
||||
if (!bg || !bg.IsArena() || bg.GetArenaType() != (ArenaTypes)reqValue)
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace Game.Arenas
|
||||
{
|
||||
base.BuildPvPLogDataPacket(out pvpLogData);
|
||||
|
||||
if (isRated())
|
||||
if (IsRated())
|
||||
{
|
||||
pvpLogData.Ratings.HasValue = true;
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace Game.Arenas
|
||||
|
||||
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);
|
||||
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)
|
||||
{
|
||||
// arena rating calculation
|
||||
if (isRated())
|
||||
if (IsRated())
|
||||
{
|
||||
uint loserTeamRating = 0;
|
||||
uint loserMatchmakerRating = 0;
|
||||
|
||||
@@ -61,27 +61,27 @@ namespace Game.BattleFields
|
||||
m_saveTimer = 60000;
|
||||
|
||||
// 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.Defender, RandomHelper.URand(0, 1));
|
||||
Global.WorldMgr.setWorldState(WGConst.ClockWorldState[0], m_NoWarBattleTime);
|
||||
Global.WorldMgr.SetWorldState(WGWorldStates.Active, 0);
|
||||
Global.WorldMgr.SetWorldState(WGWorldStates.Defender, RandomHelper.URand(0, 1));
|
||||
Global.WorldMgr.SetWorldState(WGConst.ClockWorldState[0], m_NoWarBattleTime);
|
||||
}
|
||||
|
||||
m_isActive = Global.WorldMgr.getWorldState(WGWorldStates.Active) != 0;
|
||||
m_DefenderTeam = Global.WorldMgr.getWorldState(WGWorldStates.Defender);
|
||||
m_isActive = Global.WorldMgr.GetWorldState(WGWorldStates.Active) != 0;
|
||||
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)
|
||||
{
|
||||
m_isActive = false;
|
||||
m_Timer = m_RestartAfterCrash;
|
||||
}
|
||||
|
||||
SetData(WGData.WonA, Global.WorldMgr.getWorldState(WGWorldStates.AttackedA));
|
||||
SetData(WGData.DefA, Global.WorldMgr.getWorldState(WGWorldStates.DefendedA));
|
||||
SetData(WGData.WonH, Global.WorldMgr.getWorldState(WGWorldStates.AttackedH));
|
||||
SetData(WGData.DefH, Global.WorldMgr.getWorldState(WGWorldStates.DefendedH));
|
||||
SetData(WGData.WonA, Global.WorldMgr.GetWorldState(WGWorldStates.AttackedA));
|
||||
SetData(WGData.DefA, Global.WorldMgr.GetWorldState(WGWorldStates.DefendedA));
|
||||
SetData(WGData.WonH, Global.WorldMgr.GetWorldState(WGWorldStates.AttackedH));
|
||||
SetData(WGData.DefH, Global.WorldMgr.GetWorldState(WGWorldStates.DefendedH));
|
||||
|
||||
foreach (var gy in WGConst.WGGraveYard)
|
||||
{
|
||||
@@ -163,13 +163,13 @@ namespace Game.BattleFields
|
||||
bool m_return = base.Update(diff);
|
||||
if (m_saveTimer <= diff)
|
||||
{
|
||||
Global.WorldMgr.setWorldState(WGWorldStates.Active, m_isActive);
|
||||
Global.WorldMgr.setWorldState(WGWorldStates.Defender, m_DefenderTeam);
|
||||
Global.WorldMgr.setWorldState(WGConst.ClockWorldState[0], m_Timer);
|
||||
Global.WorldMgr.setWorldState(WGWorldStates.AttackedA, GetData(WGData.WonA));
|
||||
Global.WorldMgr.setWorldState(WGWorldStates.DefendedA, GetData(WGData.DefA));
|
||||
Global.WorldMgr.setWorldState(WGWorldStates.AttackedH, GetData(WGData.WonH));
|
||||
Global.WorldMgr.setWorldState(WGWorldStates.DefendedH, GetData(WGData.DefH));
|
||||
Global.WorldMgr.SetWorldState(WGWorldStates.Active, m_isActive);
|
||||
Global.WorldMgr.SetWorldState(WGWorldStates.Defender, m_DefenderTeam);
|
||||
Global.WorldMgr.SetWorldState(WGConst.ClockWorldState[0], m_Timer);
|
||||
Global.WorldMgr.SetWorldState(WGWorldStates.AttackedA, GetData(WGData.WonA));
|
||||
Global.WorldMgr.SetWorldState(WGWorldStates.DefendedA, GetData(WGData.DefA));
|
||||
Global.WorldMgr.SetWorldState(WGWorldStates.AttackedH, GetData(WGData.WonH));
|
||||
Global.WorldMgr.SetWorldState(WGWorldStates.DefendedH, GetData(WGData.DefH));
|
||||
m_saveTimer = 60 * Time.InMilliseconds;
|
||||
}
|
||||
else
|
||||
@@ -1194,7 +1194,7 @@ namespace Game.BattleFields
|
||||
break;
|
||||
}
|
||||
|
||||
_state = (WGGameObjectState)Global.WorldMgr.getWorldState(_worldState);
|
||||
_state = (WGGameObjectState)Global.WorldMgr.GetWorldState(_worldState);
|
||||
switch (_state)
|
||||
{
|
||||
case WGGameObjectState.NeutralIntact:
|
||||
@@ -1449,7 +1449,7 @@ namespace Game.BattleFields
|
||||
|
||||
public void Save()
|
||||
{
|
||||
Global.WorldMgr.setWorldState(_worldState, (ulong)_state);
|
||||
Global.WorldMgr.SetWorldState(_worldState, (ulong)_state);
|
||||
}
|
||||
|
||||
public ObjectGuid GetGUID() { return _buildGUID; }
|
||||
@@ -1568,7 +1568,7 @@ namespace Game.BattleFields
|
||||
|
||||
public void Save()
|
||||
{
|
||||
Global.WorldMgr.setWorldState(_staticInfo.WorldStateId, (uint)_state);
|
||||
Global.WorldMgr.SetWorldState(_staticInfo.WorldStateId, (uint)_state);
|
||||
}
|
||||
|
||||
public uint GetTeamControl() { return _teamControl; }
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace Game.BattleGrounds
|
||||
_ProcessOfflineQueue();
|
||||
_ProcessPlayerPositionBroadcast(diff);
|
||||
// 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)
|
||||
{
|
||||
@@ -298,7 +298,7 @@ namespace Game.BattleGrounds
|
||||
EndBattleground(GetPrematureWinner());
|
||||
m_PrematureCountDown = false;
|
||||
}
|
||||
else if (!Global.BattlegroundMgr.isTesting())
|
||||
else if (!Global.BattlegroundMgr.IsTesting())
|
||||
{
|
||||
uint newtime = m_PrematureCountDownTimer - diff;
|
||||
// announce every Time.Minute
|
||||
@@ -324,7 +324,7 @@ namespace Game.BattleGrounds
|
||||
// *********************************************************
|
||||
ModifyStartDelayTime((int)diff);
|
||||
|
||||
if (!isArena())
|
||||
if (!IsArena())
|
||||
SetRemainingTime(300000);
|
||||
|
||||
if (m_ResetStatTimer > 5000)
|
||||
@@ -341,7 +341,7 @@ namespace Game.BattleGrounds
|
||||
// Send packet every 10 seconds until the 2nd field reach 0
|
||||
if (m_CountdownTimer >= 10000)
|
||||
{
|
||||
uint countdownMaxForBGType = isArena() ? BattlegroundConst.ArenaCountdownMax : BattlegroundConst.BattlegroundCountdownMax;
|
||||
uint countdownMaxForBGType = IsArena() ? BattlegroundConst.ArenaCountdownMax : BattlegroundConst.BattlegroundCountdownMax;
|
||||
|
||||
StartTimer timer = new StartTimer();
|
||||
timer.Type = TimerType.Pvp;
|
||||
@@ -409,7 +409,7 @@ namespace Game.BattleGrounds
|
||||
SetStartDelayTime(StartDelayTimes[BattlegroundConst.EventIdFourth]);
|
||||
|
||||
// Remove preparation
|
||||
if (isArena())
|
||||
if (IsArena())
|
||||
{
|
||||
//todo add arena sound PlaySoundToAll(SOUND_ARENA_START);
|
||||
foreach (var guid in GetPlayers().Keys)
|
||||
@@ -655,7 +655,7 @@ namespace Game.BattleGrounds
|
||||
|
||||
if (winner == Team.Alliance)
|
||||
{
|
||||
if (isBattleground())
|
||||
if (IsBattleground())
|
||||
SendBroadcastText(BattlegroundBroadcastTexts.AllianceWins, ChatMsg.BgSystemNeutral);
|
||||
|
||||
PlaySoundToAll((uint)BattlegroundSounds.AllianceWins);
|
||||
@@ -663,7 +663,7 @@ namespace Game.BattleGrounds
|
||||
}
|
||||
else if (winner == Team.Horde)
|
||||
{
|
||||
if (isBattleground())
|
||||
if (IsBattleground())
|
||||
SendBroadcastText(BattlegroundBroadcastTexts.HordeWins, ChatMsg.BgSystemNeutral);
|
||||
|
||||
PlaySoundToAll((uint)BattlegroundSounds.HordeWins);
|
||||
@@ -676,7 +676,7 @@ namespace Game.BattleGrounds
|
||||
|
||||
PreparedStatement stmt = null;
|
||||
ulong battlegroundId = 1;
|
||||
if (isBattleground() && WorldConfig.GetBoolValue(WorldCfg.BattlegroundStoreStatisticsEnable))
|
||||
if (IsBattleground() && WorldConfig.GetBoolValue(WorldCfg.BattlegroundStoreStatisticsEnable))
|
||||
{
|
||||
stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_PVPSTATS_MAXID);
|
||||
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
|
||||
player.CombatStop();
|
||||
player.GetHostileRefManager().deleteReferences();
|
||||
player.GetHostileRefManager().DeleteReferences();
|
||||
}
|
||||
|
||||
// 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 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);
|
||||
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)
|
||||
uint maxLevel = Math.Min(GetMaxLevel(), 80U);
|
||||
return Formulas.hk_honor_at_level(maxLevel, kills);
|
||||
return Formulas.HKHonorAtLevel(maxLevel, kills);
|
||||
}
|
||||
|
||||
void BlockMovement(Player player)
|
||||
@@ -867,7 +867,7 @@ namespace Game.BattleGrounds
|
||||
player.ClearAfkReports();
|
||||
|
||||
// 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)
|
||||
|
||||
@@ -895,7 +895,7 @@ namespace Game.BattleGrounds
|
||||
}
|
||||
DecreaseInvitedCount(team);
|
||||
//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
|
||||
AddToBGFreeSlotQueue();
|
||||
@@ -1007,7 +1007,7 @@ namespace Game.BattleGrounds
|
||||
player.RemoveAurasByType(AuraType.Mounted);
|
||||
|
||||
// add arena specific auras
|
||||
if (isArena())
|
||||
if (IsArena())
|
||||
{
|
||||
player.RemoveArenaEnchantments(EnchantmentSlot.Temp);
|
||||
|
||||
@@ -1026,7 +1026,7 @@ namespace Game.BattleGrounds
|
||||
{
|
||||
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();
|
||||
timer.Type = TimerType.Pvp;
|
||||
timer.TimeRemaining = countdownMaxForBGType - (GetElapsedTime() / 1000);
|
||||
@@ -1120,7 +1120,7 @@ namespace Game.BattleGrounds
|
||||
RemovePlayer(player, guid, GetPlayerTeam(guid));
|
||||
|
||||
// 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)
|
||||
EndBattleground(GetOtherTeam(player.GetBGTeam()));
|
||||
}
|
||||
@@ -1129,7 +1129,7 @@ namespace Game.BattleGrounds
|
||||
// This method should be called only once ... it adds pointer to queue
|
||||
void AddToBGFreeSlotQueue()
|
||||
{
|
||||
if (!m_InBGFreeSlotQueue && isBattleground())
|
||||
if (!m_InBGFreeSlotQueue && IsBattleground())
|
||||
{
|
||||
Global.BattlegroundMgr.AddToBGFreeSlotQueue(m_TypeID, this);
|
||||
m_InBGFreeSlotQueue = true;
|
||||
@@ -1251,7 +1251,7 @@ namespace Game.BattleGrounds
|
||||
if (bgScore == null) // player not found...
|
||||
return false;
|
||||
|
||||
if (type == ScoreType.BonusHonor && doAddHonor && isBattleground())
|
||||
if (type == ScoreType.BonusHonor && doAddHonor && IsBattleground())
|
||||
player.RewardHonor(null, 1, (int)value);
|
||||
else
|
||||
bgScore.UpdateScore(type, value);
|
||||
@@ -1640,7 +1640,7 @@ namespace Game.BattleGrounds
|
||||
}
|
||||
}
|
||||
|
||||
if (!isArena())
|
||||
if (!IsArena())
|
||||
{
|
||||
// To be able to remove insignia -- ONLY IN Battlegrounds
|
||||
victim.AddUnitFlag(UnitFlags.Skinnable);
|
||||
@@ -1869,9 +1869,9 @@ namespace Game.BattleGrounds
|
||||
public void SetRandom(bool isRandom) { m_IsRandom = isRandom; }
|
||||
uint GetInvitedCount(Team team) { return (team == Team.Alliance) ? m_InvitedAlliance : m_InvitedHorde; }
|
||||
|
||||
public bool isArena() { return m_IsArena; }
|
||||
public bool isBattleground() { return !m_IsArena; }
|
||||
public bool isRated() { return m_IsRated; }
|
||||
public bool IsArena() { return m_IsArena; }
|
||||
public bool IsBattleground() { return !m_IsArena; }
|
||||
public bool IsRated() { return m_IsRated; }
|
||||
|
||||
public Dictionary<ObjectGuid, BattlegroundPlayer> GetPlayers() { return m_Players; }
|
||||
uint GetPlayersSize() { return (uint)m_Players.Count; }
|
||||
|
||||
@@ -134,9 +134,9 @@ namespace Game.BattleGrounds
|
||||
header.QueueID = bg.GetQueueId();
|
||||
header.RangeMin = (byte)bg.GetMinLevel();
|
||||
header.RangeMax = (byte)bg.GetMaxLevel();
|
||||
header.TeamSize = (byte)(bg.isArena() ? arenaType : 0);
|
||||
header.TeamSize = (byte)(bg.IsArena() ? arenaType : 0);
|
||||
header.InstanceID = bg.GetClientInstanceID();
|
||||
header.RegisteredMatch = bg.isRated();
|
||||
header.RegisteredMatch = bg.IsRated();
|
||||
header.TournamentRules = false;
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ namespace Game.BattleGrounds
|
||||
// create a copy of the BG template
|
||||
Battleground bg = bg_template.GetCopy();
|
||||
|
||||
bool isRandom = bgTypeId != originalBgTypeId && !bg.isArena();
|
||||
bool isRandom = bgTypeId != originalBgTypeId && !bg.IsArena();
|
||||
|
||||
bg.SetBracket(bracketEntry);
|
||||
bg.SetInstanceID(Global.MapMgr.GenerateInstanceId());
|
||||
@@ -282,7 +282,7 @@ namespace Game.BattleGrounds
|
||||
bg.SetQueueId((ulong)bgTypeId | 0x1F10000000000000);
|
||||
|
||||
// Set up correct min/max player counts for scoreboards
|
||||
if (bg.isArena())
|
||||
if (bg.IsArena())
|
||||
{
|
||||
uint maxPlayersPerTeam = 0;
|
||||
switch (arenaType)
|
||||
@@ -857,8 +857,8 @@ namespace Game.BattleGrounds
|
||||
|
||||
public BattlegroundQueue GetBattlegroundQueue(BattlegroundQueueTypeId bgQueueTypeId) { return m_BattlegroundQueues[(int)bgQueueTypeId]; }
|
||||
|
||||
public bool isArenaTesting() { return m_ArenaTesting; }
|
||||
public bool isTesting() { return m_Testing; }
|
||||
public bool IsArenaTesting() { return m_ArenaTesting; }
|
||||
public bool IsTesting() { return m_Testing; }
|
||||
|
||||
public BattlegroundTypeId GetBattleMasterBG(uint entry)
|
||||
{
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace Game.BattleGrounds
|
||||
//add players from group to ginfo
|
||||
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();
|
||||
if (!member)
|
||||
@@ -385,7 +385,7 @@ namespace Game.BattleGrounds
|
||||
BattlegroundBracketId bracket_id = bg.GetBracketId();
|
||||
|
||||
// set ArenaTeamId for rated matches
|
||||
if (bg.isArena() && bg.isRated())
|
||||
if (bg.IsArena() && bg.IsRated())
|
||||
bg.SetArenaTeamIdForTeam(ginfo.Team, ginfo.ArenaTeamId);
|
||||
|
||||
ginfo.RemoveInviteTime = GameTime.GetGameTimeMS() + BattlegroundConst.InviteAcceptWaitTime;
|
||||
@@ -644,7 +644,7 @@ namespace Game.BattleGrounds
|
||||
return false;
|
||||
}
|
||||
//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 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;
|
||||
@@ -745,7 +745,7 @@ namespace Game.BattleGrounds
|
||||
foreach (var bg in bgQueues)
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
// clear selection pools
|
||||
@@ -787,18 +787,18 @@ namespace Game.BattleGrounds
|
||||
uint MinPlayersPerTeam = bg_template.GetMinPlayersPerTeam();
|
||||
uint MaxPlayersPerTeam = bg_template.GetMaxPlayersPerTeam();
|
||||
|
||||
if (bg_template.isArena())
|
||||
if (bg_template.IsArena())
|
||||
{
|
||||
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;
|
||||
|
||||
m_SelectionPools[TeamId.Alliance].Init();
|
||||
m_SelectionPools[TeamId.Horde].Init();
|
||||
|
||||
if (bg_template.isBattleground())
|
||||
if (bg_template.IsBattleground())
|
||||
{
|
||||
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 (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
|
||||
Battleground bg2 = Global.BattlegroundMgr.CreateNewBattleground(bgTypeId, bracketEntry, (ArenaTypes)arenaType, false);
|
||||
@@ -846,7 +846,7 @@ namespace Game.BattleGrounds
|
||||
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
|
||||
// arenaRating is the rating of the latest joined team, or 0
|
||||
@@ -1166,7 +1166,7 @@ namespace Game.BattleGrounds
|
||||
player.RemoveBattlegroundQueueId(m_BgQueueTypeId);
|
||||
bgQueue.RemovePlayer(m_PlayerGuid, true);
|
||||
//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());
|
||||
|
||||
BattlefieldStatusNone battlefieldStatus;
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace Game.Chat
|
||||
//if (!command.Name.Equals(cmd))
|
||||
//continue;
|
||||
|
||||
if (!hasStringAbbr(command.Name, cmd))
|
||||
if (!HasStringAbbr(command.Name, cmd))
|
||||
continue;
|
||||
|
||||
bool match = false;
|
||||
@@ -89,7 +89,7 @@ namespace Game.Chat
|
||||
{
|
||||
foreach (var command2 in table)
|
||||
{
|
||||
if (!hasStringAbbr(command2.Name, cmd))
|
||||
if (!HasStringAbbr(command2.Name, cmd))
|
||||
continue;
|
||||
|
||||
if (command2.Name.Equals(cmd))
|
||||
@@ -180,7 +180,7 @@ namespace Game.Chat
|
||||
if (!IsAvailable(command))
|
||||
continue;
|
||||
|
||||
if (!hasStringAbbr(command.Name, cmd))
|
||||
if (!HasStringAbbr(command.Name, cmd))
|
||||
continue;
|
||||
|
||||
// have subcommand
|
||||
@@ -236,7 +236,7 @@ namespace Game.Chat
|
||||
continue;
|
||||
|
||||
// for empty subcmd show all available
|
||||
if (!subcmd.IsEmpty() && !hasStringAbbr(command.Name, subcmd))
|
||||
if (!subcmd.IsEmpty() && !HasStringAbbr(command.Name, subcmd))
|
||||
continue;
|
||||
|
||||
if (GetSession() != null)
|
||||
@@ -271,17 +271,17 @@ namespace Game.Chat
|
||||
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
something1 = null;
|
||||
@@ -327,7 +327,7 @@ namespace Game.Chat
|
||||
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 p2 = args.NextString();
|
||||
@@ -342,9 +342,9 @@ namespace Game.Chat
|
||||
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))
|
||||
return null;
|
||||
|
||||
@@ -354,7 +354,7 @@ namespace Game.Chat
|
||||
return Global.ObjectMgr.GetGameTele(id);
|
||||
}
|
||||
|
||||
public string extractQuotedArg(string str)
|
||||
public string ExtractQuotedArg(string str)
|
||||
{
|
||||
if (string.IsNullOrEmpty(str))
|
||||
return null;
|
||||
@@ -364,10 +364,10 @@ namespace Game.Chat
|
||||
|
||||
return str.Replace("\"", String.Empty);
|
||||
}
|
||||
string extractPlayerNameFromLink(StringArguments args)
|
||||
string ExtractPlayerNameFromLink(StringArguments args)
|
||||
{
|
||||
// |color|Hplayer:name|h[name]|h|r
|
||||
string name = extractKeyFromLink(args, "Hplayer");
|
||||
string name = ExtractKeyFromLink(args, "Hplayer");
|
||||
if (name.IsEmpty())
|
||||
return "";
|
||||
|
||||
@@ -376,19 +376,19 @@ namespace Game.Chat
|
||||
|
||||
return name;
|
||||
}
|
||||
public bool extractPlayerTarget(StringArguments args, out Player player)
|
||||
public bool ExtractPlayerTarget(StringArguments args, out Player player)
|
||||
{
|
||||
ObjectGuid guid;
|
||||
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;
|
||||
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;
|
||||
playerGuid = ObjectGuid.Empty;
|
||||
@@ -396,7 +396,7 @@ namespace Game.Chat
|
||||
|
||||
if (!args.Empty())
|
||||
{
|
||||
string name = extractPlayerNameFromLink(args);
|
||||
string name = ExtractPlayerNameFromLink(args);
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
@@ -412,7 +412,7 @@ namespace Game.Chat
|
||||
}
|
||||
else
|
||||
{
|
||||
player = getSelectedPlayer();
|
||||
player = GetSelectedPlayer();
|
||||
playerGuid = player != null ? player.GetGUID() : ObjectGuid.Empty;
|
||||
playerName = player != null ? player.GetName() : "";
|
||||
}
|
||||
@@ -426,7 +426,7 @@ namespace Game.Chat
|
||||
|
||||
return true;
|
||||
}
|
||||
public ulong extractLowGuidFromLink(StringArguments args, ref HighGuid guidHigh)
|
||||
public ulong ExtractLowGuidFromLink(StringArguments args, ref HighGuid guidHigh)
|
||||
{
|
||||
int type;
|
||||
|
||||
@@ -439,7 +439,7 @@ namespace Game.Chat
|
||||
// |color|Hcreature:creature_guid|h[name]|h|r
|
||||
// |color|Hgameobject:go_guid|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))
|
||||
return 0;
|
||||
|
||||
@@ -489,7 +489,7 @@ namespace Game.Chat
|
||||
"Htrade", // profession/skill spell
|
||||
"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|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
|
||||
int type = 0;
|
||||
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))
|
||||
return 0;
|
||||
|
||||
@@ -538,7 +538,7 @@ namespace Game.Chat
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Player getSelectedPlayer()
|
||||
public Player GetSelectedPlayer()
|
||||
{
|
||||
if (_session == null)
|
||||
return null;
|
||||
@@ -550,7 +550,7 @@ namespace Game.Chat
|
||||
|
||||
return Global.ObjAccessor.FindPlayer(selected);
|
||||
}
|
||||
public Unit getSelectedUnit()
|
||||
public Unit GetSelectedUnit()
|
||||
{
|
||||
if (_session == null)
|
||||
return null;
|
||||
@@ -573,14 +573,14 @@ namespace Game.Chat
|
||||
|
||||
return Global.ObjAccessor.GetUnit(_session.GetPlayer(), selected);
|
||||
}
|
||||
public Creature getSelectedCreature()
|
||||
public Creature GetSelectedCreature()
|
||||
{
|
||||
if (_session == null)
|
||||
return null;
|
||||
|
||||
return ObjectAccessor.GetCreatureOrPetOrVehicle(_session.GetPlayer(), _session.GetPlayer().GetTarget());
|
||||
}
|
||||
public Player getSelectedPlayerOrSelf()
|
||||
public Player GetSelectedPlayerOrSelf()
|
||||
{
|
||||
if (_session == null)
|
||||
return null;
|
||||
@@ -639,7 +639,7 @@ namespace Game.Chat
|
||||
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";
|
||||
}
|
||||
@@ -649,9 +649,9 @@ namespace Game.Chat
|
||||
}
|
||||
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();
|
||||
return pl != chr && pl.IsVisibleGloballyFor(chr);
|
||||
@@ -703,7 +703,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
}
|
||||
|
||||
bool hasStringAbbr(string name, string part)
|
||||
bool HasStringAbbr(string name, string part)
|
||||
{
|
||||
// non "" command
|
||||
if (!name.IsEmpty())
|
||||
@@ -822,8 +822,8 @@ namespace Game.Chat
|
||||
}
|
||||
else
|
||||
{
|
||||
if (getSelectedPlayer())
|
||||
player = getSelectedPlayer();
|
||||
if (GetSelectedPlayer())
|
||||
player = GetSelectedPlayer();
|
||||
else
|
||||
player = _session.GetPlayer();
|
||||
|
||||
@@ -866,7 +866,7 @@ namespace Game.Chat
|
||||
return GetCypherString(CypherStrings.ConsoleCommand);
|
||||
}
|
||||
|
||||
public override bool needReportToTarget(Player chr)
|
||||
public override bool NeedReportToTarget(Player chr)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -467,7 +467,7 @@ namespace Game.Chat
|
||||
|
||||
if (string.IsNullOrEmpty(exp))
|
||||
{
|
||||
Player player = handler.getSelectedPlayer();
|
||||
Player player = handler.GetSelectedPlayer();
|
||||
if (!player)
|
||||
return false;
|
||||
|
||||
@@ -531,7 +531,7 @@ namespace Game.Chat
|
||||
|
||||
if (string.IsNullOrEmpty(arg3))
|
||||
{
|
||||
if (!handler.getSelectedPlayer())
|
||||
if (!handler.GetSelectedPlayer())
|
||||
return false;
|
||||
isAccountNameGiven = false;
|
||||
}
|
||||
@@ -560,7 +560,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
// 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))
|
||||
return false;
|
||||
|
||||
@@ -602,7 +602,7 @@ namespace Game.Chat
|
||||
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);
|
||||
handler.SendSysMessage(CypherStrings.YouChangeSecurity, targetAccountName, gm);
|
||||
return true;
|
||||
|
||||
@@ -32,10 +32,10 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
Player target;
|
||||
if (!handler.extractPlayerTarget(args[0] != '"' ? args : null, out target))
|
||||
if (!handler.ExtractPlayerTarget(args[0] != '"' ? args : null, out target))
|
||||
return false;
|
||||
|
||||
string name = handler.extractQuotedArg(args.NextString());
|
||||
string name = handler.ExtractQuotedArg(args.NextString());
|
||||
if (string.IsNullOrEmpty(name))
|
||||
return false;
|
||||
|
||||
@@ -119,14 +119,14 @@ namespace Game.Chat
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
string oldArenaStr = handler.extractQuotedArg(args.NextString());
|
||||
string oldArenaStr = handler.ExtractQuotedArg(args.NextString());
|
||||
if (string.IsNullOrEmpty(oldArenaStr))
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.BadValue);
|
||||
return false;
|
||||
}
|
||||
|
||||
string newArenaStr = handler.extractQuotedArg(args.NextString());
|
||||
string newArenaStr = handler.ExtractQuotedArg(args.NextString());
|
||||
if (string.IsNullOrEmpty(newArenaStr))
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.BadValue);
|
||||
@@ -176,7 +176,7 @@ namespace Game.Chat
|
||||
|
||||
string idStr;
|
||||
string nameStr;
|
||||
handler.extractOptFirstArg(args, out idStr, out nameStr);
|
||||
handler.ExtractOptFirstArg(args, out idStr, out nameStr);
|
||||
if (string.IsNullOrEmpty(idStr))
|
||||
return false;
|
||||
|
||||
@@ -185,7 +185,7 @@ namespace Game.Chat
|
||||
|
||||
Player target;
|
||||
ObjectGuid targetGuid;
|
||||
if (!handler.extractPlayerTarget(new StringArguments(nameStr), out target, out targetGuid))
|
||||
if (!handler.ExtractPlayerTarget(new StringArguments(nameStr), out target, out targetGuid))
|
||||
return false;
|
||||
|
||||
ArenaTeam arena = Global.ArenaTeamMgr.GetArenaTeamById(teamId);
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Game.Chat
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
Unit target = handler.getSelectedUnit();
|
||||
Unit target = handler.GetSelectedUnit();
|
||||
if (!target)
|
||||
{
|
||||
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
|
||||
uint spellId = handler.extractSpellIdFromLink(args);
|
||||
uint spellId = handler.ExtractSpellIdFromLink(args);
|
||||
if (spellId == 0)
|
||||
return false;
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace Game.Chat
|
||||
[Command("back", RBACPermissions.CommandCastBack)]
|
||||
static bool HandleCastBackCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Creature caster = handler.getSelectedCreature();
|
||||
Creature caster = handler.GetSelectedCreature();
|
||||
if (!caster)
|
||||
{
|
||||
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
|
||||
uint spellId = handler.extractSpellIdFromLink(args);
|
||||
uint spellId = handler.ExtractSpellIdFromLink(args);
|
||||
if (spellId == 0)
|
||||
return false;
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
// 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)
|
||||
return false;
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace Game.Chat
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
Unit target = handler.getSelectedUnit();
|
||||
Unit target = handler.GetSelectedUnit();
|
||||
if (!target)
|
||||
{
|
||||
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
|
||||
uint spellId = handler.extractSpellIdFromLink(args);
|
||||
uint spellId = handler.ExtractSpellIdFromLink(args);
|
||||
if (spellId == 0)
|
||||
return false;
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace Game.Chat
|
||||
[Command("target", RBACPermissions.CommandCastTarget)]
|
||||
static bool HandleCastTargetCommad(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Creature caster = handler.getSelectedCreature();
|
||||
Creature caster = handler.GetSelectedCreature();
|
||||
if (!caster)
|
||||
{
|
||||
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
|
||||
uint spellId = handler.extractSpellIdFromLink(args);
|
||||
uint spellId = handler.ExtractSpellIdFromLink(args);
|
||||
if (spellId == 0)
|
||||
return false;
|
||||
|
||||
@@ -190,7 +190,7 @@ namespace Game.Chat
|
||||
[Command("dest", RBACPermissions.CommandCastDest)]
|
||||
static bool HandleCastDestCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Unit caster = handler.getSelectedUnit();
|
||||
Unit caster = handler.GetSelectedUnit();
|
||||
if (!caster)
|
||||
{
|
||||
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
|
||||
uint spellId = handler.extractSpellIdFromLink(args);
|
||||
uint spellId = handler.ExtractSpellIdFromLink(args);
|
||||
if (spellId == 0)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
Player target;
|
||||
if (!handler.extractPlayerTarget(args, out target))
|
||||
if (!handler.ExtractPlayerTarget(args, out target))
|
||||
return false;
|
||||
|
||||
LocaleConstant loc = handler.GetSessionDbcLocale();
|
||||
@@ -76,7 +76,7 @@ namespace Game.Chat
|
||||
Player target;
|
||||
ObjectGuid targetGuid;
|
||||
string targetName;
|
||||
if (!handler.extractPlayerTarget(args, out target, out targetGuid, out targetName))
|
||||
if (!handler.ExtractPlayerTarget(args, out target, out targetGuid, out targetName))
|
||||
return false;
|
||||
|
||||
string newNameStr = args.NextString();
|
||||
@@ -181,7 +181,7 @@ namespace Game.Chat
|
||||
if (handler.HasLowerSecurity(null, targetGuid))
|
||||
return false;
|
||||
|
||||
string oldNameLink = handler.playerLink(targetName);
|
||||
string oldNameLink = handler.PlayerLink(targetName);
|
||||
handler.SendSysMessage(CypherStrings.RenamePlayerGuid, oldNameLink, targetGuid.ToString());
|
||||
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG);
|
||||
@@ -199,7 +199,7 @@ namespace Game.Chat
|
||||
{
|
||||
string nameStr;
|
||||
string levelStr;
|
||||
handler.extractOptFirstArg(args, out nameStr, out levelStr);
|
||||
handler.ExtractOptFirstArg(args, out nameStr, out levelStr);
|
||||
if (string.IsNullOrEmpty(levelStr))
|
||||
return false;
|
||||
|
||||
@@ -213,7 +213,7 @@ namespace Game.Chat
|
||||
Player target;
|
||||
ObjectGuid targetGuid;
|
||||
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;
|
||||
|
||||
int oldlevel = (int)(target ? target.GetLevel() : Global.CharacterCacheStorage.GetCharacterLevelByGuid(targetGuid));
|
||||
@@ -230,7 +230,7 @@ namespace Game.Chat
|
||||
HandleCharacterLevel(target, targetGuid, oldlevel, newlevel, handler);
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ namespace Game.Chat
|
||||
Player target;
|
||||
ObjectGuid targetGuid;
|
||||
string targetName;
|
||||
if (!handler.extractPlayerTarget(args, out target, out targetGuid, out targetName))
|
||||
if (!handler.ExtractPlayerTarget(args, out target, out targetGuid, out targetName))
|
||||
return false;
|
||||
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG);
|
||||
@@ -257,7 +257,7 @@ namespace Game.Chat
|
||||
}
|
||||
else
|
||||
{
|
||||
string oldNameLink = handler.playerLink(targetName);
|
||||
string oldNameLink = handler.PlayerLink(targetName);
|
||||
stmt.AddValue(1, targetGuid.GetCounter());
|
||||
handler.SendSysMessage(CypherStrings.CustomizePlayerGuid, oldNameLink, targetGuid.ToString());
|
||||
}
|
||||
@@ -271,14 +271,14 @@ namespace Game.Chat
|
||||
{
|
||||
string playerNameStr;
|
||||
string accountName;
|
||||
handler.extractOptFirstArg(args, out playerNameStr, out accountName);
|
||||
handler.ExtractOptFirstArg(args, out playerNameStr, out accountName);
|
||||
if (accountName.IsEmpty())
|
||||
return false;
|
||||
|
||||
ObjectGuid targetGuid;
|
||||
string targetName;
|
||||
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;
|
||||
|
||||
CharacterCacheEntry characterInfo = Global.CharacterCacheStorage.GetCharacterCacheByGuid(targetGuid);
|
||||
@@ -347,7 +347,7 @@ namespace Game.Chat
|
||||
Player target;
|
||||
ObjectGuid targetGuid;
|
||||
string targetName;
|
||||
if (!handler.extractPlayerTarget(args, out target, out targetGuid, out targetName))
|
||||
if (!handler.ExtractPlayerTarget(args, out target, out targetGuid, out targetName))
|
||||
return false;
|
||||
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG);
|
||||
@@ -360,7 +360,7 @@ namespace Game.Chat
|
||||
}
|
||||
else
|
||||
{
|
||||
string oldNameLink = handler.playerLink(targetName);
|
||||
string oldNameLink = handler.PlayerLink(targetName);
|
||||
handler.SendSysMessage(CypherStrings.CustomizePlayerGuid, oldNameLink, targetGuid.ToString());
|
||||
stmt.AddValue(1, targetGuid.GetCounter());
|
||||
}
|
||||
@@ -375,7 +375,7 @@ namespace Game.Chat
|
||||
Player target;
|
||||
ObjectGuid targetGuid;
|
||||
string targetName;
|
||||
if (!handler.extractPlayerTarget(args, out target, out targetGuid, out targetName))
|
||||
if (!handler.ExtractPlayerTarget(args, out target, out targetGuid, out targetName))
|
||||
return false;
|
||||
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG);
|
||||
@@ -389,7 +389,7 @@ namespace Game.Chat
|
||||
}
|
||||
else
|
||||
{
|
||||
string oldNameLink = handler.playerLink(targetName);
|
||||
string oldNameLink = handler.PlayerLink(targetName);
|
||||
// @todo add text into database
|
||||
handler.SendSysMessage(CypherStrings.CustomizePlayerGuid, oldNameLink, targetGuid.ToString());
|
||||
stmt.AddValue(1, targetGuid.GetCounter());
|
||||
@@ -403,7 +403,7 @@ namespace Game.Chat
|
||||
static bool HandleCharacterReputationCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Player target;
|
||||
if (!handler.extractPlayerTarget(args, out target))
|
||||
if (!handler.ExtractPlayerTarget(args, out target))
|
||||
return false;
|
||||
|
||||
LocaleConstant loc = handler.GetSessionDbcLocale();
|
||||
@@ -735,7 +735,7 @@ namespace Game.Chat
|
||||
{
|
||||
string nameStr;
|
||||
string levelStr;
|
||||
handler.extractOptFirstArg(args, out nameStr, out levelStr);
|
||||
handler.ExtractOptFirstArg(args, out nameStr, out levelStr);
|
||||
|
||||
// exception opt second arg: .character level $name
|
||||
if (!string.IsNullOrEmpty(levelStr) && !levelStr.IsNumber())
|
||||
@@ -747,7 +747,7 @@ namespace Game.Chat
|
||||
Player target;
|
||||
ObjectGuid targetGuid;
|
||||
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;
|
||||
|
||||
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
|
||||
{
|
||||
string nameLink = handler.playerLink(targetName);
|
||||
string nameLink = handler.PlayerLink(targetName);
|
||||
handler.SendSysMessage(CypherStrings.YouChangeLvl, nameLink, newlevel);
|
||||
}
|
||||
|
||||
@@ -780,7 +780,7 @@ namespace Game.Chat
|
||||
player.InitTalentForLevel();
|
||||
player.SetXP(0);
|
||||
|
||||
if (handler.needReportToTarget(player))
|
||||
if (handler.NeedReportToTarget(player))
|
||||
{
|
||||
if (oldLevel == newLevel)
|
||||
player.SendSysMessage(CypherStrings.YoursLevelProgressReset, handler.GetNameLink());
|
||||
|
||||
@@ -184,7 +184,7 @@ namespace Game.Chat.Commands
|
||||
{
|
||||
string argstr = args.NextString();
|
||||
|
||||
Player chr = handler.getSelectedPlayer();
|
||||
Player chr = handler.GetSelectedPlayer();
|
||||
if (!chr)
|
||||
chr = handler.GetSession().GetPlayer();
|
||||
else if (handler.HasLowerSecurity(chr, ObjectGuid.Empty)) // check online security
|
||||
@@ -197,7 +197,7 @@ namespace Game.Chat.Commands
|
||||
{
|
||||
chr.SetTaxiCheater(false);
|
||||
handler.SendSysMessage(CypherStrings.YouRemoveTaxis, handler.GetNameLink(chr));
|
||||
if (handler.needReportToTarget(chr))
|
||||
if (handler.NeedReportToTarget(chr))
|
||||
chr.SendSysMessage(CypherStrings.YoursTaxisRemoved, handler.GetNameLink());
|
||||
|
||||
return true;
|
||||
@@ -206,7 +206,7 @@ namespace Game.Chat.Commands
|
||||
{
|
||||
chr.SetTaxiCheater(true);
|
||||
handler.SendSysMessage(CypherStrings.YouGiveTaxis, handler.GetNameLink(chr));
|
||||
if (handler.needReportToTarget(chr))
|
||||
if (handler.NeedReportToTarget(chr))
|
||||
chr.SendSysMessage(CypherStrings.YoursTaxisAdded, handler.GetNameLink());
|
||||
return true;
|
||||
}
|
||||
@@ -222,7 +222,7 @@ namespace Game.Chat.Commands
|
||||
return false;
|
||||
|
||||
int flag = args.NextInt32();
|
||||
Player chr = handler.getSelectedPlayer();
|
||||
Player chr = handler.GetSelectedPlayer();
|
||||
if (!chr)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
@@ -232,13 +232,13 @@ namespace Game.Chat.Commands
|
||||
if (flag != 0)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.YouSetExploreAll, handler.GetNameLink(chr));
|
||||
if (handler.needReportToTarget(chr))
|
||||
if (handler.NeedReportToTarget(chr))
|
||||
chr.SendSysMessage(CypherStrings.YoursExploreSetAll, handler.GetNameLink());
|
||||
}
|
||||
else
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.YouSetExploreNothing, handler.GetNameLink(chr));
|
||||
if (handler.needReportToTarget(chr))
|
||||
if (handler.NeedReportToTarget(chr))
|
||||
chr.SendSysMessage(CypherStrings.YoursExploreSetNothing, handler.GetNameLink());
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
uint animId = args.NextUInt32();
|
||||
Unit unit = handler.getSelectedUnit();
|
||||
Unit unit = handler.GetSelectedUnit();
|
||||
if (unit)
|
||||
unit.HandleEmoteCommand((Emote)animId);
|
||||
return true;
|
||||
@@ -84,7 +84,7 @@ namespace Game.Chat
|
||||
if (!player)
|
||||
return false;
|
||||
|
||||
Creature target = handler.getSelectedCreature();
|
||||
Creature target = handler.GetSelectedCreature();
|
||||
if (!target || !target.IsAIEnabled || target.GetAI() == null)
|
||||
return false;
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace Game.Chat
|
||||
if (conversationEntry == 0)
|
||||
return false;
|
||||
|
||||
Player target = handler.getSelectedPlayerOrSelf();
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (!target)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
@@ -128,7 +128,7 @@ namespace Game.Chat
|
||||
[Command("entervehicle", RBACPermissions.CommandDebugEntervehicle)]
|
||||
static bool HandleDebugEnterVehicleCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Unit target = handler.getSelectedUnit();
|
||||
Unit target = handler.GetSelectedUnit();
|
||||
if (!target || !target.IsVehicle())
|
||||
return false;
|
||||
|
||||
@@ -183,7 +183,7 @@ namespace Game.Chat
|
||||
else
|
||||
return false;
|
||||
|
||||
Player player = handler.getSelectedPlayer();
|
||||
Player player = handler.GetSelectedPlayer();
|
||||
if (!player)
|
||||
player = handler.GetSession().GetPlayer();
|
||||
|
||||
@@ -438,10 +438,10 @@ namespace Game.Chat
|
||||
[Command("hostil", RBACPermissions.CommandDebugHostil)]
|
||||
static bool HandleDebugHostileRefListCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Unit target = handler.getSelectedUnit();
|
||||
Unit target = handler.GetSelectedUnit();
|
||||
if (!target)
|
||||
target = handler.GetSession().GetPlayer();
|
||||
HostileReference refe = target.GetHostileRefManager().getFirst();
|
||||
HostileReference refe = target.GetHostileRefManager().GetFirst();
|
||||
uint count = 0;
|
||||
handler.SendSysMessage("Hostil reference list of {0} (guid {1})", target.GetName(), target.GetGUID().ToString());
|
||||
while (refe != null)
|
||||
@@ -450,9 +450,9 @@ namespace Game.Chat
|
||||
if (unit)
|
||||
{
|
||||
++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.");
|
||||
return true;
|
||||
@@ -480,7 +480,7 @@ namespace Game.Chat
|
||||
[Command("lootrecipient", RBACPermissions.CommandDebugLootrecipient)]
|
||||
static bool HandleDebugGetLootRecipientCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Creature target = handler.getSelectedCreature();
|
||||
Creature target = handler.GetSelectedCreature();
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
@@ -492,7 +492,7 @@ namespace Game.Chat
|
||||
[Command("los", RBACPermissions.CommandDebugLos)]
|
||||
static bool HandleDebugLoSCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Unit unit = handler.getSelectedUnit();
|
||||
Unit unit = handler.GetSelectedUnit();
|
||||
if (unit)
|
||||
handler.SendSysMessage("Unit {0} (GuidLow: {1}) is {2}in LoS", unit.GetName(), unit.GetGUID().ToString(), handler.GetSession().GetPlayer().IsWithinLOSInMap(unit) ? "" : "not ");
|
||||
return true;
|
||||
@@ -501,7 +501,7 @@ namespace Game.Chat
|
||||
[Command("moveflags", RBACPermissions.CommandDebugMoveflags)]
|
||||
static bool HandleDebugMoveflagsCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Unit target = handler.getSelectedUnit();
|
||||
Unit target = handler.GetSelectedUnit();
|
||||
if (!target)
|
||||
target = handler.GetSession().GetPlayer();
|
||||
|
||||
@@ -621,7 +621,7 @@ namespace Game.Chat
|
||||
[Command("phase", RBACPermissions.CommandDebugPhase)]
|
||||
static bool HandleDebugPhaseCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Unit target = handler.getSelectedUnit();
|
||||
Unit target = handler.GetSelectedUnit();
|
||||
if (!target)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
@@ -677,7 +677,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
}
|
||||
|
||||
Unit unit = handler.getSelectedUnit();
|
||||
Unit unit = handler.GetSelectedUnit();
|
||||
if (!unit)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCharOrCreature);
|
||||
@@ -700,7 +700,7 @@ namespace Game.Chat
|
||||
[Command("setvid", RBACPermissions.CommandDebugSetvid)]
|
||||
static bool HandleDebugSetVehicleIdCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Unit target = handler.getSelectedUnit();
|
||||
Unit target = handler.GetSelectedUnit();
|
||||
if (!target || target.IsVehicle())
|
||||
return false;
|
||||
|
||||
@@ -751,20 +751,20 @@ namespace Game.Chat
|
||||
[Command("threat", RBACPermissions.CommandDebugThreat)]
|
||||
static bool HandleDebugThreatListCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Creature target = handler.getSelectedCreature();
|
||||
Creature target = handler.GetSelectedCreature();
|
||||
if (!target || target.IsTotem() || target.IsPet())
|
||||
return false;
|
||||
|
||||
var threatList = target.GetThreatManager().getThreatList();
|
||||
var threatList = target.GetThreatManager().GetThreatList();
|
||||
uint count = 0;
|
||||
handler.SendSysMessage("Threat list of {0} (guid {1})", target.GetName(), target.GetGUID().ToString());
|
||||
foreach (var refe in threatList)
|
||||
{
|
||||
Unit unit = refe.getTarget();
|
||||
Unit unit = refe.GetTarget();
|
||||
if (!unit)
|
||||
continue;
|
||||
++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.");
|
||||
return true;
|
||||
@@ -832,7 +832,7 @@ namespace Game.Chat
|
||||
if (worldStateIdStr.IsEmpty())
|
||||
return false;
|
||||
|
||||
Player target = handler.getSelectedPlayerOrSelf();
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
@@ -844,11 +844,11 @@ namespace Game.Chat
|
||||
|
||||
if (value != 0)
|
||||
{
|
||||
Global.WorldMgr.setWorldState(worldStateId, value);
|
||||
Global.WorldMgr.SetWorldState(worldStateId, value);
|
||||
target.SendUpdateWorldState(worldStateId, value);
|
||||
}
|
||||
else
|
||||
handler.SendSysMessage($"Worldstate {worldStateId} actual value : {Global.WorldMgr.getWorldState(worldStateId)}");
|
||||
handler.SendSysMessage($"Worldstate {worldStateId} actual value : {Global.WorldMgr.GetWorldState(worldStateId)}");
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -866,7 +866,7 @@ namespace Game.Chat
|
||||
|
||||
uint expressionId = uint.Parse(expressionIdStr);
|
||||
|
||||
Player target = handler.getSelectedPlayerOrSelf();
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
@@ -1126,7 +1126,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
}
|
||||
|
||||
Unit unit = handler.getSelectedUnit();
|
||||
Unit unit = handler.GetSelectedUnit();
|
||||
if (!unit)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCharOrCreature);
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Game.Chat.Commands
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
Player player = handler.getSelectedPlayer();
|
||||
Player player = handler.GetSelectedPlayer();
|
||||
if (!player)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
@@ -94,7 +94,7 @@ namespace Game.Chat.Commands
|
||||
|
||||
static bool HandleDeserterRemove(StringArguments args, CommandHandler handler, bool isInstance)
|
||||
{
|
||||
Player player = handler.getSelectedPlayer();
|
||||
Player player = handler.GetSelectedPlayer();
|
||||
if (!player)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
// 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))
|
||||
return false;
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
GameEventData eventData = events[eventId];
|
||||
if (!eventData.isValid())
|
||||
if (!eventData.IsValid())
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.EventNotExist);
|
||||
return false;
|
||||
@@ -105,7 +105,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
// 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))
|
||||
return false;
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
GameEventData eventData = events[eventId];
|
||||
if (!eventData.isValid())
|
||||
if (!eventData.IsValid())
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.EventNotExist);
|
||||
return false;
|
||||
@@ -144,7 +144,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
// 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))
|
||||
return false;
|
||||
|
||||
@@ -159,7 +159,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
GameEventData eventData = events[eventId];
|
||||
if (!eventData.isValid())
|
||||
if (!eventData.IsValid())
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.EventNotExist);
|
||||
return false;
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace Game.Chat
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
Player target = handler.getSelectedPlayer();
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
if (target == null)
|
||||
target = handler.GetPlayer();
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Game.Chat
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
string id = handler.extractKeyFromLink(args, "Hgameobject");
|
||||
string id = handler.ExtractKeyFromLink(args, "Hgameobject");
|
||||
if (string.IsNullOrEmpty(id))
|
||||
return false;
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Game.Chat
|
||||
static bool HandleGameObjectDeleteCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
// 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))
|
||||
return false;
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace Game.Chat
|
||||
static bool HandleGameObjectMoveCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
// 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))
|
||||
return false;
|
||||
|
||||
@@ -219,7 +219,7 @@ namespace Game.Chat
|
||||
if (!args.Empty())
|
||||
{
|
||||
// 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))
|
||||
return false;
|
||||
|
||||
@@ -328,7 +328,7 @@ namespace Game.Chat
|
||||
static bool HandleGameObjectTurnCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
// 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))
|
||||
return false;
|
||||
|
||||
@@ -401,13 +401,13 @@ namespace Game.Chat
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
string param1 = handler.extractKeyFromLink(args, "Hgameobject_entry");
|
||||
string param1 = handler.ExtractKeyFromLink(args, "Hgameobject_entry");
|
||||
if (param1.IsEmpty())
|
||||
return false;
|
||||
|
||||
if (param1.Equals("guid"))
|
||||
{
|
||||
string cValue = handler.extractKeyFromLink(args, "Hgameobject");
|
||||
string cValue = handler.ExtractKeyFromLink(args, "Hgameobject");
|
||||
if (cValue.IsEmpty())
|
||||
return false;
|
||||
|
||||
@@ -462,7 +462,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
// 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))
|
||||
return false;
|
||||
|
||||
@@ -591,7 +591,7 @@ namespace Game.Chat
|
||||
static bool HandleGameObjectSetStateCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
// 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))
|
||||
return false;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Game.Chat.Commands
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
|
||||
// "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))
|
||||
return false;
|
||||
|
||||
@@ -195,7 +195,7 @@ namespace Game.Chat.Commands
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
|
||||
// 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))
|
||||
return false;
|
||||
|
||||
@@ -249,7 +249,7 @@ namespace Game.Chat.Commands
|
||||
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
|
||||
string id = handler.extractKeyFromLink(args, "Hquest");
|
||||
string id = handler.ExtractKeyFromLink(args, "Hquest");
|
||||
if (string.IsNullOrEmpty(id))
|
||||
return false;
|
||||
|
||||
@@ -312,7 +312,7 @@ namespace Game.Chat.Commands
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
string id = handler.extractKeyFromLink(args, "Htaxinode");
|
||||
string id = handler.ExtractKeyFromLink(args, "Htaxinode");
|
||||
if (string.IsNullOrEmpty(id))
|
||||
return false;
|
||||
|
||||
@@ -405,7 +405,7 @@ namespace Game.Chat.Commands
|
||||
if (x == 0.0f || y == 0.0f)
|
||||
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))
|
||||
areaId = player.GetZoneId();
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Game.Chat
|
||||
static bool HandleGroupSummonCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Player target;
|
||||
if (!handler.extractPlayerTarget(args, out target))
|
||||
if (!handler.ExtractPlayerTarget(args, out target))
|
||||
return false;
|
||||
|
||||
// check online security
|
||||
@@ -68,7 +68,7 @@ namespace Game.Chat
|
||||
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();
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
handler.SendSysMessage(CypherStrings.Summoning, plNameLink, "");
|
||||
if (handler.needReportToTarget(player))
|
||||
if (handler.NeedReportToTarget(player))
|
||||
player.SendSysMessage(CypherStrings.SummonedBy, handler.GetNameLink());
|
||||
|
||||
// stop flight if need
|
||||
@@ -255,7 +255,7 @@ namespace Game.Chat
|
||||
guidTarget = parseGUID;
|
||||
}
|
||||
// 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;
|
||||
|
||||
// Next, we need a group. So we define a group variable.
|
||||
@@ -286,7 +286,7 @@ namespace Game.Chat
|
||||
var members = groupTarget.GetMemberSlots();
|
||||
|
||||
// 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.
|
||||
|
||||
// While rather dirty codestyle-wise, it saves space (if only a little). For each member, we look several informations up.
|
||||
|
||||
@@ -32,10 +32,10 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
Player target;
|
||||
if (!handler.extractPlayerTarget(args[0] != '"' ? args : null, out target))
|
||||
if (!handler.ExtractPlayerTarget(args[0] != '"' ? args : null, out target))
|
||||
return false;
|
||||
|
||||
string guildname = handler.extractQuotedArg(args.NextString());
|
||||
string guildname = handler.ExtractQuotedArg(args.NextString());
|
||||
if (string.IsNullOrEmpty(guildname))
|
||||
return false;
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace Game.Chat
|
||||
[Command("delete", RBACPermissions.CommandGuildDelete, true)]
|
||||
static bool HandleGuildDeleteCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
string guildName = handler.extractQuotedArg(args.NextString());
|
||||
string guildName = handler.ExtractQuotedArg(args.NextString());
|
||||
if (string.IsNullOrEmpty(guildName))
|
||||
return false;
|
||||
|
||||
@@ -79,10 +79,10 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
Player target;
|
||||
if (!handler.extractPlayerTarget(args[0] != '"' ? args : null, out target))
|
||||
if (!handler.ExtractPlayerTarget(args[0] != '"' ? args : null, out target))
|
||||
return false;
|
||||
|
||||
string guildName = handler.extractQuotedArg(args.NextString());
|
||||
string guildName = handler.ExtractQuotedArg(args.NextString());
|
||||
if (string.IsNullOrEmpty(guildName))
|
||||
return false;
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace Game.Chat
|
||||
{
|
||||
Player target;
|
||||
ObjectGuid targetGuid = ObjectGuid.Empty;
|
||||
if (!handler.extractPlayerTarget(args, out target, out targetGuid))
|
||||
if (!handler.ExtractPlayerTarget(args, out target, out targetGuid))
|
||||
return false;
|
||||
|
||||
ulong guildId = target != null ? target.GetGuildId() : Global.CharacterCacheStorage.GetCharacterGuildIdByGuid(targetGuid);
|
||||
@@ -120,14 +120,14 @@ namespace Game.Chat
|
||||
{
|
||||
string nameStr;
|
||||
string rankStr;
|
||||
handler.extractOptFirstArg(args, out nameStr, out rankStr);
|
||||
handler.ExtractOptFirstArg(args, out nameStr, out rankStr);
|
||||
if (string.IsNullOrEmpty(rankStr))
|
||||
return false;
|
||||
|
||||
Player target;
|
||||
ObjectGuid targetGuid;
|
||||
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;
|
||||
|
||||
ulong guildId = target ? target.GetGuildId() : Global.CharacterCacheStorage.GetCharacterGuildIdByGuid(targetGuid);
|
||||
@@ -150,14 +150,14 @@ namespace Game.Chat
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
string oldGuildStr = handler.extractQuotedArg(args.NextString());
|
||||
string oldGuildStr = handler.ExtractQuotedArg(args.NextString());
|
||||
if (string.IsNullOrEmpty(oldGuildStr))
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.BadValue);
|
||||
return false;
|
||||
}
|
||||
|
||||
string newGuildStr = handler.extractQuotedArg(args.NextString());
|
||||
string newGuildStr = handler.ExtractQuotedArg(args.NextString());
|
||||
if (string.IsNullOrEmpty(newGuildStr))
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.InsertGuildName);
|
||||
@@ -191,7 +191,7 @@ namespace Game.Chat
|
||||
static bool HandleGuildInfoCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Guild guild = null;
|
||||
Player target = handler.getSelectedPlayerOrSelf();
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
|
||||
if (!args.Empty() && args[0] != '\0')
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Game.Chat.Commands
|
||||
[Command("update", RBACPermissions.CommandHonorUpdate)]
|
||||
static bool HandleHonorUpdateCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Player target = handler.getSelectedPlayer();
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
if (!target)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
@@ -51,7 +51,7 @@ namespace Game.Chat.Commands
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
Player target = handler.getSelectedPlayer();
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
if (!target)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
@@ -70,7 +70,7 @@ namespace Game.Chat.Commands
|
||||
[Command("kill", RBACPermissions.CommandHonorAddKill)]
|
||||
static bool HandleHonorAddKillCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Unit target = handler.getSelectedUnit();
|
||||
Unit target = handler.GetSelectedUnit();
|
||||
if (!target)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Game.Chat
|
||||
[Command("listbinds", RBACPermissions.CommandInstanceListbinds)]
|
||||
static bool HandleInstanceListBinds(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Player player = handler.getSelectedPlayer();
|
||||
Player player = handler.GetSelectedPlayer();
|
||||
if (!player)
|
||||
player = handler.GetSession().GetPlayer();
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace Game.Chat
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
Player player = handler.getSelectedPlayer();
|
||||
Player player = handler.GetSelectedPlayer();
|
||||
if (!player)
|
||||
player = handler.GetSession().GetPlayer();
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Game.Chat
|
||||
Player target = null;
|
||||
string playerName;
|
||||
ObjectGuid guid;
|
||||
if (!handler.extractPlayerTarget(args, out target, out guid, out playerName))
|
||||
if (!handler.ExtractPlayerTarget(args, out target, out guid, out playerName))
|
||||
return false;
|
||||
|
||||
GetPlayerInfo(handler, target);
|
||||
@@ -56,7 +56,7 @@ namespace Game.Chat
|
||||
playerTarget = Global.ObjAccessor.FindPlayer(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;
|
||||
|
||||
Group groupTarget = null;
|
||||
@@ -78,7 +78,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
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())
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Game.Chat.Commands
|
||||
[Command("", RBACPermissions.CommandLearn)]
|
||||
static bool HandleLearnCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Player targetPlayer = handler.getSelectedPlayerOrSelf();
|
||||
Player targetPlayer = handler.GetSelectedPlayerOrSelf();
|
||||
|
||||
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
|
||||
uint spell = handler.extractSpellIdFromLink(args);
|
||||
uint spell = handler.ExtractSpellIdFromLink(args);
|
||||
if (spell == 0 || !Global.SpellMgr.HasSpellInfo(spell))
|
||||
return false;
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace Game.Chat.Commands
|
||||
static bool HandleLearnAllDefaultCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Player target;
|
||||
if (!handler.extractPlayerTarget(args, out target))
|
||||
if (!handler.ExtractPlayerTarget(args, out target))
|
||||
return false;
|
||||
|
||||
target.LearnDefaultSkills();
|
||||
@@ -123,7 +123,7 @@ namespace Game.Chat.Commands
|
||||
static bool HandleLearnAllCraftsCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Player target;
|
||||
if (!handler.extractPlayerTarget(args, out target))
|
||||
if (!handler.ExtractPlayerTarget(args, out target))
|
||||
return false;
|
||||
|
||||
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
|
||||
// Example: .learn all_recipes enchanting
|
||||
|
||||
Player target = handler.getSelectedPlayer();
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
if (!target)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
@@ -320,14 +320,14 @@ namespace Game.Chat.Commands
|
||||
return false;
|
||||
|
||||
// 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)
|
||||
return false;
|
||||
|
||||
string allStr = args.NextString();
|
||||
bool allRanks = !string.IsNullOrEmpty(allStr) && allStr == "all";
|
||||
|
||||
Player target = handler.getSelectedPlayer();
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
if (!target)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Game.Chat.Commands
|
||||
[Command("auras", RBACPermissions.CommandListAuras)]
|
||||
static bool HandleListAurasCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Unit unit = handler.getSelectedUnit();
|
||||
Unit unit = handler.GetSelectedUnit();
|
||||
if (!unit)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCharOrCreature);
|
||||
@@ -81,7 +81,7 @@ namespace Game.Chat.Commands
|
||||
return false;
|
||||
|
||||
// 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))
|
||||
return false;
|
||||
|
||||
@@ -148,7 +148,7 @@ namespace Game.Chat.Commands
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
string id = handler.extractKeyFromLink(args, "Hitem");
|
||||
string id = handler.ExtractKeyFromLink(args, "Hitem");
|
||||
if (string.IsNullOrEmpty(id))
|
||||
return false;
|
||||
|
||||
@@ -350,7 +350,7 @@ namespace Game.Chat.Commands
|
||||
target = Global.ObjAccessor.FindPlayer(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;
|
||||
|
||||
stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_MAIL_LIST_COUNT);
|
||||
@@ -360,7 +360,7 @@ namespace Game.Chat.Commands
|
||||
{
|
||||
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.AccountListBar);
|
||||
|
||||
@@ -385,8 +385,8 @@ namespace Game.Chat.Commands
|
||||
uint gold = (uint)(money / MoneyConstants.Gold);
|
||||
uint silv = (uint)(money % MoneyConstants.Gold) / MoneyConstants.Silver;
|
||||
uint copp = (uint)(money % MoneyConstants.Gold) % MoneyConstants.Silver;
|
||||
string receiverStr = handler.playerLink(receiver);
|
||||
string senderStr = handler.playerLink(sender);
|
||||
string receiverStr = handler.PlayerLink(receiver);
|
||||
string senderStr = handler.PlayerLink(sender);
|
||||
handler.SendSysMessage(CypherStrings.ListMailInfo1, messageId, subject, gold, silv, copp);
|
||||
handler.SendSysMessage(CypherStrings.ListMailInfo2, senderStr, senderId, receiverStr, receiverId);
|
||||
handler.SendSysMessage(CypherStrings.ListMailInfo3, Time.UnixTimeToDateTime(deliverTime).ToLongDateString(), Time.UnixTimeToDateTime(expireTime).ToLongDateString());
|
||||
@@ -447,7 +447,7 @@ namespace Game.Chat.Commands
|
||||
return false;
|
||||
|
||||
// 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))
|
||||
return false;
|
||||
|
||||
@@ -512,7 +512,7 @@ namespace Game.Chat.Commands
|
||||
[Command("scenes", RBACPermissions.CommandListScenes)]
|
||||
static bool HandleListScenesCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Player target = handler.getSelectedPlayer();
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
if (!target)
|
||||
target = handler.GetSession().GetPlayer();
|
||||
|
||||
|
||||
@@ -222,7 +222,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
// Can be NULL at console call
|
||||
Player target = handler.getSelectedPlayer();
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
|
||||
string namePart = args.NextString().ToLower();
|
||||
|
||||
@@ -490,7 +490,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
// can be NULL at console call
|
||||
Player target = handler.getSelectedPlayer();
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
|
||||
string namePart = args.NextString().ToLower();
|
||||
|
||||
@@ -620,7 +620,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
// can be NULL in console call
|
||||
Player target = handler.getSelectedPlayer();
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
|
||||
string namePart = args.NextString();
|
||||
|
||||
@@ -786,7 +786,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
// can be NULL in console call
|
||||
Player target = handler.getSelectedPlayer();
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
|
||||
// title name have single string arg for player name
|
||||
string targetName = target ? target.GetName() : "NAME";
|
||||
@@ -943,7 +943,7 @@ namespace Game.Chat
|
||||
int limit;
|
||||
string limitStr;
|
||||
|
||||
Player target = handler.getSelectedPlayer();
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
if (args.Empty())
|
||||
{
|
||||
// NULL only if used from console
|
||||
@@ -1058,7 +1058,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
// can be NULL at console call
|
||||
Player target = handler.getSelectedPlayer();
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
|
||||
string namePart = args.NextString();
|
||||
|
||||
@@ -1157,7 +1157,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
// can be NULL at console call
|
||||
Player target = handler.getSelectedPlayer();
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
|
||||
uint id = args.NextUInt32();
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Game.Chat
|
||||
|
||||
// units
|
||||
Player player = handler.GetPlayer();
|
||||
Unit target = handler.getSelectedUnit();
|
||||
Unit target = handler.GetSelectedUnit();
|
||||
if (player == null || target == null)
|
||||
{
|
||||
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());
|
||||
handler.SendSysMessage("mmap stats:");
|
||||
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);
|
||||
if (navmesh == null)
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace Game.Chat
|
||||
{
|
||||
Player target;
|
||||
ObjectGuid targetGuid;
|
||||
if (!handler.extractPlayerTarget(args, out target, out targetGuid))
|
||||
if (!handler.ExtractPlayerTarget(args, out target, out targetGuid))
|
||||
return false;
|
||||
|
||||
if (target != null)
|
||||
@@ -103,7 +103,7 @@ namespace Game.Chat
|
||||
[CommandNonGroup("die", RBACPermissions.CommandDie)]
|
||||
static bool Die(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Unit target = handler.getSelectedUnit();
|
||||
Unit target = handler.GetSelectedUnit();
|
||||
|
||||
if (!target && handler.GetPlayer().GetTarget().IsEmpty())
|
||||
{
|
||||
@@ -129,7 +129,7 @@ namespace Game.Chat
|
||||
if (!args.Empty())
|
||||
{
|
||||
HighGuid guidHigh = 0;
|
||||
ulong guidLow = handler.extractLowGuidFromLink(args, ref guidHigh);
|
||||
ulong guidLow = handler.ExtractLowGuidFromLink(args, ref guidHigh);
|
||||
if (guidLow == 0)
|
||||
return false;
|
||||
switch (guidHigh)
|
||||
@@ -169,7 +169,7 @@ namespace Game.Chat
|
||||
}
|
||||
else
|
||||
{
|
||||
obj = handler.getSelectedUnit();
|
||||
obj = handler.GetSelectedUnit();
|
||||
|
||||
if (!obj)
|
||||
{
|
||||
@@ -201,8 +201,8 @@ namespace Game.Chat
|
||||
GridCoord gridCoord = GridDefines.ComputeGridCoord(obj.GetPositionX(), obj.GetPositionY());
|
||||
|
||||
// 63? WHY?
|
||||
uint gridX = (MapConst.MaxGrids - 1) - gridCoord.x_coord;
|
||||
uint gridY = (MapConst.MaxGrids - 1) - gridCoord.y_coord;
|
||||
uint gridX = (MapConst.MaxGrids - 1) - gridCoord.X_coord;
|
||||
uint gridY = (MapConst.MaxGrids - 1) - gridCoord.Y_coord;
|
||||
|
||||
bool haveMap = Map.ExistMap(mapId, gridX, gridY);
|
||||
bool haveVMap = Map.ExistVMap(mapId, gridX, gridY);
|
||||
@@ -237,7 +237,7 @@ namespace Game.Chat
|
||||
zoneX, zoneY, groundZ, floorZ, haveMap, haveVMap, haveMMap);
|
||||
|
||||
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)
|
||||
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
|
||||
{
|
||||
string idStr = handler.extractKeyFromLink(args, "Hitem");
|
||||
string idStr = handler.ExtractKeyFromLink(args, "Hitem");
|
||||
if (string.IsNullOrEmpty(idStr))
|
||||
return false;
|
||||
|
||||
@@ -309,7 +309,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
Player playerTarget = handler.getSelectedPlayer();
|
||||
Player playerTarget = handler.GetSelectedPlayer();
|
||||
if (!playerTarget)
|
||||
playerTarget = player;
|
||||
|
||||
@@ -377,7 +377,7 @@ namespace Game.Chat
|
||||
if (args.Empty())
|
||||
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))
|
||||
return false;
|
||||
|
||||
@@ -403,7 +403,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
Player playerTarget = handler.getSelectedPlayer();
|
||||
Player playerTarget = handler.GetSelectedPlayer();
|
||||
if (!playerTarget)
|
||||
playerTarget = player;
|
||||
|
||||
@@ -485,7 +485,7 @@ namespace Game.Chat
|
||||
Player target;
|
||||
ObjectGuid targetGuid;
|
||||
string targetName;
|
||||
if (!handler.extractPlayerTarget(args, out target, out targetGuid, out targetName))
|
||||
if (!handler.ExtractPlayerTarget(args, out target, out targetGuid, out targetName))
|
||||
return false;
|
||||
|
||||
Player _player = handler.GetSession().GetPlayer();
|
||||
@@ -501,7 +501,7 @@ namespace Game.Chat
|
||||
if (handler.HasLowerSecurity(target, ObjectGuid.Empty))
|
||||
return false;
|
||||
|
||||
string chrNameLink = handler.playerLink(targetName);
|
||||
string chrNameLink = handler.PlayerLink(targetName);
|
||||
|
||||
Map map = target.GetMap();
|
||||
if (map.IsBattlegroundOrArena())
|
||||
@@ -598,7 +598,7 @@ namespace Game.Chat
|
||||
if (handler.HasLowerSecurity(null, targetGuid))
|
||||
return false;
|
||||
|
||||
string nameLink = handler.playerLink(targetName);
|
||||
string nameLink = handler.PlayerLink(targetName);
|
||||
|
||||
handler.SendSysMessage(CypherStrings.AppearingAt, nameLink);
|
||||
|
||||
@@ -632,7 +632,7 @@ namespace Game.Chat
|
||||
Player target;
|
||||
ObjectGuid targetGuid;
|
||||
string targetName;
|
||||
if (!handler.extractPlayerTarget(args, out target, out targetGuid, out targetName))
|
||||
if (!handler.ExtractPlayerTarget(args, out target, out targetGuid, out targetName))
|
||||
return false;
|
||||
|
||||
Player _player = handler.GetSession().GetPlayer();
|
||||
@@ -645,7 +645,7 @@ namespace Game.Chat
|
||||
|
||||
if (target)
|
||||
{
|
||||
string nameLink = handler.playerLink(targetName);
|
||||
string nameLink = handler.PlayerLink(targetName);
|
||||
// check online security
|
||||
if (handler.HasLowerSecurity(target, ObjectGuid.Empty))
|
||||
return false;
|
||||
@@ -698,8 +698,8 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
handler.SendSysMessage(CypherStrings.Summoning, nameLink, "");
|
||||
if (handler.needReportToTarget(target))
|
||||
target.SendSysMessage(CypherStrings.SummonedBy, handler.playerLink(_player.GetName()));
|
||||
if (handler.NeedReportToTarget(target))
|
||||
target.SendSysMessage(CypherStrings.SummonedBy, handler.PlayerLink(_player.GetName()));
|
||||
|
||||
// stop flight if need
|
||||
if (target.IsInFlight())
|
||||
@@ -724,7 +724,7 @@ namespace Game.Chat
|
||||
if (handler.HasLowerSecurity(null, targetGuid))
|
||||
return false;
|
||||
|
||||
string nameLink = handler.playerLink(targetName);
|
||||
string nameLink = handler.PlayerLink(targetName);
|
||||
|
||||
handler.SendSysMessage(CypherStrings.Summoning, nameLink, handler.GetCypherString(CypherStrings.Offline));
|
||||
|
||||
@@ -814,7 +814,7 @@ namespace Game.Chat
|
||||
if (!args.Empty())
|
||||
{
|
||||
HighGuid guidHigh = 0;
|
||||
ulong guidLow = handler.extractLowGuidFromLink(args, ref guidHigh);
|
||||
ulong guidLow = handler.ExtractLowGuidFromLink(args, ref guidHigh);
|
||||
if (guidLow == 0)
|
||||
return false;
|
||||
switch (guidHigh)
|
||||
@@ -854,7 +854,7 @@ namespace Game.Chat
|
||||
}
|
||||
else
|
||||
{
|
||||
obj = handler.getSelectedUnit();
|
||||
obj = handler.GetSelectedUnit();
|
||||
|
||||
if (!obj)
|
||||
{
|
||||
@@ -872,7 +872,7 @@ namespace Game.Chat
|
||||
static bool Recall(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Player target;
|
||||
if (!handler.extractPlayerTarget(args, out target))
|
||||
if (!handler.ExtractPlayerTarget(args, out target))
|
||||
return false;
|
||||
|
||||
// check online security
|
||||
@@ -905,7 +905,7 @@ namespace Game.Chat
|
||||
// save GM account without delay and output message
|
||||
if (handler.GetSession().HasPermission(RBACPermissions.CommandsSaveWithoutDelay))
|
||||
{
|
||||
Player target = handler.getSelectedPlayer();
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
if (target)
|
||||
target.SaveToDB();
|
||||
else
|
||||
@@ -938,7 +938,7 @@ namespace Game.Chat
|
||||
Player target = null;
|
||||
string playerName;
|
||||
ObjectGuid guid;
|
||||
if (!handler.extractPlayerTarget(args, out target, out guid, out playerName))
|
||||
if (!handler.ExtractPlayerTarget(args, out target, out guid, out playerName))
|
||||
return false;
|
||||
|
||||
if (handler.GetSession() != null && target == handler.GetSession().GetPlayer())
|
||||
@@ -992,7 +992,7 @@ namespace Game.Chat
|
||||
|
||||
Player player = null;
|
||||
ObjectGuid targetGUID;
|
||||
if (!handler.extractPlayerTarget(args, out player, out targetGUID))
|
||||
if (!handler.ExtractPlayerTarget(args, out player, out targetGUID))
|
||||
return false;
|
||||
|
||||
if (!player)
|
||||
@@ -1161,7 +1161,7 @@ namespace Game.Chat
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
Player playerTarget = handler.getSelectedPlayer();
|
||||
Player playerTarget = handler.GetSelectedPlayer();
|
||||
if (!playerTarget)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
@@ -1201,7 +1201,7 @@ namespace Game.Chat
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
Player playerTarget = handler.getSelectedPlayer();
|
||||
Player playerTarget = handler.GetSelectedPlayer();
|
||||
if (!playerTarget)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
@@ -1297,7 +1297,7 @@ namespace Game.Chat
|
||||
targetGuid = parseGUID;
|
||||
}
|
||||
// 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;
|
||||
|
||||
/* 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
|
||||
string nameLink = handler.playerLink(targetName);
|
||||
string nameLink = handler.PlayerLink(targetName);
|
||||
|
||||
// Returns banType, banTime, bannedBy, banreason
|
||||
PreparedStatement stmt2 = DB.Login.GetPreparedStatement(LoginStatements.SEL_PINFO_BANS);
|
||||
@@ -1632,7 +1632,7 @@ namespace Game.Chat
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
|
||||
// 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.IsPet())
|
||||
@@ -1658,7 +1658,7 @@ namespace Game.Chat
|
||||
{
|
||||
string nameStr;
|
||||
string delayStr;
|
||||
handler.extractOptFirstArg(args, out nameStr, out delayStr);
|
||||
handler.ExtractOptFirstArg(args, out nameStr, out delayStr);
|
||||
if (string.IsNullOrEmpty(delayStr))
|
||||
return false;
|
||||
|
||||
@@ -1670,7 +1670,7 @@ namespace Game.Chat
|
||||
Player target;
|
||||
ObjectGuid targetGuid;
|
||||
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;
|
||||
|
||||
uint accountId = target ? target.GetSession().GetAccountId() : Global.CharacterCacheStorage.GetCharacterAccountIdByGuid(targetGuid);
|
||||
@@ -1703,7 +1703,7 @@ namespace Game.Chat
|
||||
long muteTime = Time.UnixTime + notSpeakTime * Time.Minute;
|
||||
target.GetSession().m_muteTime = muteTime;
|
||||
stmt.AddValue(0, muteTime);
|
||||
string nameLink = handler.playerLink(targetName);
|
||||
string nameLink = handler.PlayerLink(targetName);
|
||||
|
||||
if (WorldConfig.GetBoolValue(WorldCfg.ShowMuteInWorld))
|
||||
{
|
||||
@@ -1726,7 +1726,7 @@ namespace Game.Chat
|
||||
stmt.AddValue(2, muteBy);
|
||||
stmt.AddValue(3, accountId);
|
||||
DB.Login.Execute(stmt);
|
||||
string nameLink_ = handler.playerLink(targetName);
|
||||
string nameLink_ = handler.PlayerLink(targetName);
|
||||
|
||||
if (WorldConfig.GetBoolValue(WorldCfg.ShowMuteInWorld) && !target)
|
||||
Global.WorldMgr.SendWorldText(CypherStrings.CommandMutemessageWorld, handler.GetSession().GetPlayerName(), nameLink_, notSpeakTime, muteReasonStr);
|
||||
@@ -1742,7 +1742,7 @@ namespace Game.Chat
|
||||
Player target;
|
||||
ObjectGuid targetGuid;
|
||||
string targetName;
|
||||
if (!handler.extractPlayerTarget(args, out target, out targetGuid, out targetName))
|
||||
if (!handler.ExtractPlayerTarget(args, out target, out targetGuid, out targetName))
|
||||
return false;
|
||||
|
||||
uint accountId = target ? target.GetSession().GetAccountId() : Global.CharacterCacheStorage.GetCharacterAccountIdByGuid(targetGuid);
|
||||
@@ -1780,7 +1780,7 @@ namespace Game.Chat
|
||||
if (target)
|
||||
target.SendSysMessage(CypherStrings.YourChatEnabled);
|
||||
|
||||
string nameLink = handler.playerLink(targetName);
|
||||
string nameLink = handler.PlayerLink(targetName);
|
||||
|
||||
handler.SendSysMessage(CypherStrings.YouEnableChat, nameLink);
|
||||
|
||||
@@ -1833,7 +1833,7 @@ namespace Game.Chat
|
||||
[CommandNonGroup("movegens", RBACPermissions.CommandMovegens)]
|
||||
static bool MoveGens(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Unit unit = handler.getSelectedUnit();
|
||||
Unit unit = handler.GetSelectedUnit();
|
||||
if (!unit)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCharOrCreature);
|
||||
@@ -1877,9 +1877,9 @@ namespace Game.Chat
|
||||
{
|
||||
Unit target = null;
|
||||
if (unit.IsTypeId(TypeId.Player))
|
||||
target = ((ChaseMovementGenerator<Player>)movementGenerator).target;
|
||||
target = ((ChaseMovementGenerator<Player>)movementGenerator).Target;
|
||||
else
|
||||
target = ((ChaseMovementGenerator<Creature>)movementGenerator).target;
|
||||
target = ((ChaseMovementGenerator<Creature>)movementGenerator).Target;
|
||||
|
||||
if (!target)
|
||||
handler.SendSysMessage(CypherStrings.MovegensChaseNull);
|
||||
@@ -1893,9 +1893,9 @@ namespace Game.Chat
|
||||
{
|
||||
Unit target = null;
|
||||
if (unit.IsTypeId(TypeId.Player))
|
||||
target = ((FollowMovementGenerator<Player>)movementGenerator).target;
|
||||
target = ((FollowMovementGenerator<Player>)movementGenerator).Target;
|
||||
else
|
||||
target = ((FollowMovementGenerator<Creature>)movementGenerator).target;
|
||||
target = ((FollowMovementGenerator<Creature>)movementGenerator).Target;
|
||||
|
||||
if (!target)
|
||||
handler.SendSysMessage(CypherStrings.MovegensFollowNull);
|
||||
@@ -1941,7 +1941,7 @@ namespace Game.Chat
|
||||
[CommandNonGroup("cometome", RBACPermissions.CommandCometome)]
|
||||
static bool HandleComeToMeCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Creature caster = handler.getSelectedCreature();
|
||||
Creature caster = handler.GetSelectedCreature();
|
||||
if (!caster)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
@@ -2000,7 +2000,7 @@ namespace Game.Chat
|
||||
return true;
|
||||
}
|
||||
|
||||
Unit target = handler.getSelectedUnit();
|
||||
Unit target = handler.GetSelectedUnit();
|
||||
if (!target || handler.GetSession().GetPlayer().GetTarget().IsEmpty())
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCharOrCreature);
|
||||
@@ -2066,7 +2066,7 @@ namespace Game.Chat
|
||||
|
||||
// non-melee damage
|
||||
// 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)
|
||||
return false;
|
||||
|
||||
@@ -2099,7 +2099,7 @@ namespace Game.Chat
|
||||
|
||||
if (!target)
|
||||
{
|
||||
if (!handler.extractPlayerTarget(args, out target))
|
||||
if (!handler.ExtractPlayerTarget(args, out target))
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2108,7 +2108,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
target.CombatStop();
|
||||
target.GetHostileRefManager().deleteReferences();
|
||||
target.GetHostileRefManager().DeleteReferences();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2116,7 +2116,7 @@ namespace Game.Chat
|
||||
static bool RepairItems(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Player target;
|
||||
if (!handler.extractPlayerTarget(args, out target))
|
||||
if (!handler.ExtractPlayerTarget(args, out target))
|
||||
return false;
|
||||
|
||||
// check online security
|
||||
@@ -2127,7 +2127,7 @@ namespace Game.Chat
|
||||
target.DurabilityRepairAll(false, 0, false);
|
||||
|
||||
handler.SendSysMessage(CypherStrings.YouRepairItems, handler.GetNameLink(target));
|
||||
if (handler.needReportToTarget(target))
|
||||
if (handler.NeedReportToTarget(target))
|
||||
target.SendSysMessage(CypherStrings.YourItemsRepaired, handler.GetNameLink());
|
||||
|
||||
return true;
|
||||
@@ -2136,7 +2136,7 @@ namespace Game.Chat
|
||||
[CommandNonGroup("freeze", RBACPermissions.CommandFreeze)]
|
||||
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)
|
||||
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
|
||||
@@ -2240,7 +2240,7 @@ namespace Game.Chat
|
||||
}
|
||||
else // If no name was entered - use target
|
||||
{
|
||||
player = handler.getSelectedPlayer();
|
||||
player = handler.GetSelectedPlayer();
|
||||
if (player)
|
||||
name = player.GetName();
|
||||
}
|
||||
@@ -2344,7 +2344,7 @@ namespace Game.Chat
|
||||
[CommandNonGroup("possess", RBACPermissions.CommandPossess)]
|
||||
static bool Possess(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Unit unit = handler.getSelectedUnit();
|
||||
Unit unit = handler.GetSelectedUnit();
|
||||
if (!unit)
|
||||
return false;
|
||||
|
||||
@@ -2355,7 +2355,7 @@ namespace Game.Chat
|
||||
[CommandNonGroup("unpossess", RBACPermissions.CommandUnpossess)]
|
||||
static bool UnPossess(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Unit unit = handler.getSelectedUnit();
|
||||
Unit unit = handler.GetSelectedUnit();
|
||||
if (!unit)
|
||||
unit = handler.GetSession().GetPlayer();
|
||||
|
||||
@@ -2367,7 +2367,7 @@ namespace Game.Chat
|
||||
[CommandNonGroup("bindsight", RBACPermissions.CommandBindsight)]
|
||||
static bool BindSight(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Unit unit = handler.getSelectedUnit();
|
||||
Unit unit = handler.GetSelectedUnit();
|
||||
if (!unit)
|
||||
return false;
|
||||
|
||||
@@ -2434,14 +2434,14 @@ namespace Game.Chat
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
string idStr = handler.extractKeyFromLink(args, "Hachievement");
|
||||
string idStr = handler.ExtractKeyFromLink(args, "Hachievement");
|
||||
if (string.IsNullOrEmpty(idStr))
|
||||
return false;
|
||||
|
||||
if (!uint.TryParse(idStr, out uint achievementId) || achievementId == 0)
|
||||
return false;
|
||||
|
||||
Player target = handler.getSelectedPlayer();
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
if (!target)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Game.Chat
|
||||
static bool HandleModifyHPCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
int hp, hpmax = 0;
|
||||
Player target = handler.getSelectedPlayerOrSelf();
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (CheckModifyResources(args, handler, target, out hp, out hpmax))
|
||||
{
|
||||
NotifyModification(handler, target, CypherStrings.YouChangeHp, CypherStrings.YoursHpChanged, hp, hpmax);
|
||||
@@ -47,7 +47,7 @@ namespace Game.Chat
|
||||
static bool HandleModifyManaCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
int mana, manamax;
|
||||
Player target = handler.getSelectedPlayerOrSelf();
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
|
||||
if (CheckModifyResources(args, handler, target, out mana, out manamax))
|
||||
{
|
||||
@@ -64,7 +64,7 @@ namespace Game.Chat
|
||||
static bool HandleModifyEnergyCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
int energy, energymax;
|
||||
Player target = handler.getSelectedPlayerOrSelf();
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
byte energyMultiplier = 10;
|
||||
if (CheckModifyResources(args, handler, target, out energy, out energymax, energyMultiplier))
|
||||
{
|
||||
@@ -80,7 +80,7 @@ namespace Game.Chat
|
||||
static bool HandleModifyRageCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
int rage, ragemax;
|
||||
Player target = handler.getSelectedPlayerOrSelf();
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
byte rageMultiplier = 10;
|
||||
if (CheckModifyResources(args, handler, target, out rage, out ragemax, rageMultiplier))
|
||||
{
|
||||
@@ -96,7 +96,7 @@ namespace Game.Chat
|
||||
static bool HandleModifyRunicPowerCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
int rune, runemax;
|
||||
Player target = handler.getSelectedPlayerOrSelf();
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
byte runeMultiplier = 10;
|
||||
if (CheckModifyResources(args, handler, target, out rune, out runemax, runeMultiplier))
|
||||
{
|
||||
@@ -111,9 +111,9 @@ namespace Game.Chat
|
||||
[Command("faction", RBACPermissions.CommandModifyFaction)]
|
||||
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)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
@@ -177,7 +177,7 @@ namespace Game.Chat
|
||||
if (!ushort.TryParse(args.NextString(), out ushort mark))
|
||||
mark = 65535;
|
||||
|
||||
Player target = handler.getSelectedPlayerOrSelf();
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (!target)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
@@ -189,7 +189,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
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);
|
||||
|
||||
SetSpellModifier packet = new SetSpellModifier(ServerOpcodes.SetFlatSpellModifier);
|
||||
@@ -212,7 +212,7 @@ namespace Game.Chat
|
||||
static bool HandleModifyScaleCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
float Scale;
|
||||
Unit target = handler.getSelectedUnit();
|
||||
Unit target = handler.GetSelectedUnit();
|
||||
if (CheckModifySpeed(args, handler, target, out Scale, 0.1f, 10.0f, false))
|
||||
{
|
||||
NotifyModification(handler, target, CypherStrings.YouChangeSize, CypherStrings.YoursSizeChanged, Scale);
|
||||
@@ -241,7 +241,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
}
|
||||
|
||||
Player target = handler.getSelectedPlayerOrSelf();
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (!target)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
@@ -266,7 +266,7 @@ namespace Game.Chat
|
||||
[Command("money", RBACPermissions.CommandModifyMoney)]
|
||||
static bool HandleModifyMoneyCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Player target = handler.getSelectedPlayerOrSelf();
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (!target)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
@@ -288,7 +288,7 @@ namespace Game.Chat
|
||||
if (newmoney <= 0)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.YouTakeAllMoney, handler.GetNameLink(target));
|
||||
if (handler.needReportToTarget(target))
|
||||
if (handler.NeedReportToTarget(target))
|
||||
target.SendSysMessage(CypherStrings.YoursAllMoneyGone, handler.GetNameLink());
|
||||
|
||||
target.SetMoney(0);
|
||||
@@ -300,7 +300,7 @@ namespace Game.Chat
|
||||
newmoney = (long)PlayerConst.MaxMoneyAmount;
|
||||
|
||||
handler.SendSysMessage(CypherStrings.YouTakeMoney, moneyToAddMsg, handler.GetNameLink(target));
|
||||
if (handler.needReportToTarget(target))
|
||||
if (handler.NeedReportToTarget(target))
|
||||
target.SendSysMessage(CypherStrings.YoursMoneyTaken, handler.GetNameLink(), moneyToAddMsg);
|
||||
target.SetMoney((ulong)newmoney);
|
||||
}
|
||||
@@ -308,7 +308,7 @@ namespace Game.Chat
|
||||
else
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.YouGiveMoney, moneyToAdd, handler.GetNameLink(target));
|
||||
if (handler.needReportToTarget(target))
|
||||
if (handler.NeedReportToTarget(target))
|
||||
target.SendSysMessage(CypherStrings.YoursMoneyGiven, handler.GetNameLink(), moneyToAdd);
|
||||
|
||||
if ((ulong)moneyToAdd >= PlayerConst.MaxMoneyAmount)
|
||||
@@ -329,7 +329,7 @@ namespace Game.Chat
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
Player target = handler.getSelectedPlayerOrSelf();
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (!target)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
@@ -359,7 +359,7 @@ namespace Game.Chat
|
||||
if (drunklevel > 100)
|
||||
drunklevel = 100;
|
||||
|
||||
Player target = handler.getSelectedPlayerOrSelf();
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (target)
|
||||
target.SetDrunkValue(drunklevel);
|
||||
|
||||
@@ -372,7 +372,7 @@ namespace Game.Chat
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
Player target = handler.getSelectedPlayerOrSelf();
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (!target)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
@@ -383,7 +383,7 @@ namespace Game.Chat
|
||||
if (handler.HasLowerSecurity(target, ObjectGuid.Empty))
|
||||
return false;
|
||||
|
||||
string factionTxt = handler.extractKeyFromLink(args, "Hfaction");
|
||||
string factionTxt = handler.ExtractKeyFromLink(args, "Hfaction");
|
||||
if (string.IsNullOrEmpty(factionTxt))
|
||||
return false;
|
||||
|
||||
@@ -465,7 +465,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
}
|
||||
|
||||
Unit target = handler.getSelectedUnit();
|
||||
Unit target = handler.GetSelectedUnit();
|
||||
|
||||
if (visibleMapId != 0)
|
||||
{
|
||||
@@ -499,7 +499,7 @@ namespace Game.Chat
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
Player target = handler.getSelectedPlayerOrSelf();
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (!target)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
@@ -558,7 +558,7 @@ namespace Game.Chat
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
Player target = handler.getSelectedPlayerOrSelf();
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (!target)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
@@ -601,7 +601,7 @@ namespace Game.Chat
|
||||
|
||||
handler.SendSysMessage(CypherStrings.YouChangeGender, handler.GetNameLink(target), gender);
|
||||
|
||||
if (handler.needReportToTarget(target))
|
||||
if (handler.NeedReportToTarget(target))
|
||||
target.SendSysMessage(CypherStrings.YourGenderChanged, gender, handler.GetNameLink());
|
||||
|
||||
return true;
|
||||
@@ -613,7 +613,7 @@ namespace Game.Chat
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
Player target = handler.getSelectedPlayerOrSelf();
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (!target)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
@@ -642,7 +642,7 @@ namespace Game.Chat
|
||||
|
||||
uint display_id = args.NextUInt32();
|
||||
|
||||
Unit target = handler.getSelectedUnit();
|
||||
Unit target = handler.GetSelectedUnit();
|
||||
if (!target)
|
||||
target = handler.GetSession().GetPlayer();
|
||||
|
||||
@@ -658,7 +658,7 @@ namespace Game.Chat
|
||||
[CommandNonGroup("demorph", RBACPermissions.CommandDemorph)]
|
||||
static bool HandleDeMorphCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Unit target = handler.getSelectedUnit();
|
||||
Unit target = handler.GetSelectedUnit();
|
||||
if (!target)
|
||||
target = handler.GetSession().GetPlayer();
|
||||
|
||||
@@ -685,7 +685,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
}
|
||||
|
||||
Player target = handler.getSelectedPlayerOrSelf();
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (!target)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
@@ -713,7 +713,7 @@ namespace Game.Chat
|
||||
static bool HandleModifyASpeedCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
float allSpeed;
|
||||
Player target = handler.getSelectedPlayerOrSelf();
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (CheckModifySpeed(args, handler, target, out allSpeed, 0.1f, 50.0f))
|
||||
{
|
||||
NotifyModification(handler, target, CypherStrings.YouChangeAspeed, CypherStrings.YoursAspeedChanged, allSpeed);
|
||||
@@ -730,7 +730,7 @@ namespace Game.Chat
|
||||
static bool HandleModifySwimCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
float swimSpeed;
|
||||
Player target = handler.getSelectedPlayerOrSelf();
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (CheckModifySpeed(args, handler, target, out swimSpeed, 0.1f, 50.0f))
|
||||
{
|
||||
NotifyModification(handler, target, CypherStrings.YouChangeSwimSpeed, CypherStrings.YoursSwimSpeedChanged, swimSpeed);
|
||||
@@ -744,7 +744,7 @@ namespace Game.Chat
|
||||
static bool HandleModifyBWalkCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
float backSpeed;
|
||||
Player target = handler.getSelectedPlayerOrSelf();
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (CheckModifySpeed(args, handler, target, out backSpeed, 0.1f, 50.0f))
|
||||
{
|
||||
NotifyModification(handler, target, CypherStrings.YouChangeBackSpeed, CypherStrings.YoursBackSpeedChanged, backSpeed);
|
||||
@@ -758,7 +758,7 @@ namespace Game.Chat
|
||||
static bool HandleModifyFlyCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
float flySpeed;
|
||||
Player target = handler.getSelectedPlayerOrSelf();
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (CheckModifySpeed(args, handler, target, out flySpeed, 0.1f, 50.0f, false))
|
||||
{
|
||||
NotifyModification(handler, target, CypherStrings.YouChangeFlySpeed, CypherStrings.YoursFlySpeedChanged, flySpeed);
|
||||
@@ -772,7 +772,7 @@ namespace Game.Chat
|
||||
static bool HandleModifyWalkSpeedCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
float Speed;
|
||||
Player target = handler.getSelectedPlayerOrSelf();
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (CheckModifySpeed(args, handler, target, out Speed, 0.1f, 50.0f))
|
||||
{
|
||||
NotifyModification(handler, target, CypherStrings.YouChangeSpeed, CypherStrings.YoursSpeedChanged, Speed);
|
||||
@@ -789,7 +789,7 @@ namespace Game.Chat
|
||||
if (player)
|
||||
{
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Game.Chat
|
||||
[Command("info", RBACPermissions.CommandNpcInfo)]
|
||||
static bool Info(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Creature target = handler.getSelectedCreature();
|
||||
Creature target = handler.GetSelectedCreature();
|
||||
if (!target)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
@@ -115,11 +115,11 @@ namespace Game.Chat
|
||||
{
|
||||
ulong lowguid = 0;
|
||||
|
||||
Creature creature = handler.getSelectedCreature();
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
if (!creature)
|
||||
{
|
||||
// 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))
|
||||
return false;
|
||||
|
||||
@@ -236,7 +236,7 @@ namespace Game.Chat
|
||||
{
|
||||
uint emote = args.NextUInt32();
|
||||
|
||||
Creature target = handler.getSelectedCreature();
|
||||
Creature target = handler.GetSelectedCreature();
|
||||
if (!target)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
@@ -254,7 +254,7 @@ namespace Game.Chat
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
Creature creature = handler.getSelectedCreature();
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
|
||||
if (!creature)
|
||||
{
|
||||
@@ -273,7 +273,7 @@ namespace Game.Chat
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
Creature creature = handler.getSelectedCreature();
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
if (!creature)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
@@ -314,7 +314,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
}
|
||||
|
||||
Creature creature = handler.getSelectedCreature();
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
if (!creature)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
@@ -341,7 +341,7 @@ namespace Game.Chat
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
Creature creature = handler.getSelectedCreature();
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
if (!creature)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
@@ -359,7 +359,7 @@ namespace Game.Chat
|
||||
[Command("tame", RBACPermissions.CommandNpcTame)]
|
||||
static bool Tame(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Creature creatureTarget = handler.getSelectedCreature();
|
||||
Creature creatureTarget = handler.GetSelectedCreature();
|
||||
if (!creatureTarget || creatureTarget.IsPet())
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
@@ -422,7 +422,7 @@ namespace Game.Chat
|
||||
[Command("evade", RBACPermissions.CommandNpcEvade)]
|
||||
static bool HandleNpcEvadeCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Creature creatureTarget = handler.getSelectedCreature();
|
||||
Creature creatureTarget = handler.GetSelectedCreature();
|
||||
if (!creatureTarget || creatureTarget.IsPet())
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
@@ -470,7 +470,7 @@ namespace Game.Chat
|
||||
static bool HandleNpcFollowCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
Creature creature = handler.getSelectedCreature();
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
|
||||
if (!creature)
|
||||
{
|
||||
@@ -489,7 +489,7 @@ namespace Game.Chat
|
||||
static bool HandleNpcUnFollowCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Player player = handler.GetPlayer();
|
||||
Creature creature = handler.getSelectedCreature();
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
|
||||
if (!creature)
|
||||
{
|
||||
@@ -504,9 +504,9 @@ namespace Game.Chat
|
||||
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());
|
||||
return false;
|
||||
@@ -531,7 +531,7 @@ namespace Game.Chat
|
||||
if (!args.Empty())
|
||||
{
|
||||
// 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))
|
||||
return false;
|
||||
|
||||
@@ -541,7 +541,7 @@ namespace Game.Chat
|
||||
unit = handler.GetCreatureFromPlayerMapByDbGuid(guidLow);
|
||||
}
|
||||
else
|
||||
unit = handler.getSelectedCreature();
|
||||
unit = handler.GetSelectedCreature();
|
||||
|
||||
if (!unit || unit.IsPet() || unit.IsTotem())
|
||||
{
|
||||
@@ -565,14 +565,14 @@ namespace Game.Chat
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
Creature vendor = handler.getSelectedCreature();
|
||||
Creature vendor = handler.GetSelectedCreature();
|
||||
if (!vendor || !vendor.IsVendor())
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandVendorselection);
|
||||
return false;
|
||||
}
|
||||
|
||||
string pitem = handler.extractKeyFromLink(args, "Hitem");
|
||||
string pitem = handler.ExtractKeyFromLink(args, "Hitem");
|
||||
if (string.IsNullOrEmpty(pitem))
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandNeeditemsend);
|
||||
@@ -627,7 +627,7 @@ namespace Game.Chat
|
||||
if (newEntryNum == 0)
|
||||
return false;
|
||||
|
||||
Unit unit = handler.getSelectedUnit();
|
||||
Unit unit = handler.GetSelectedUnit();
|
||||
if (!unit || !unit.IsTypeId(TypeId.Unit))
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
@@ -655,7 +655,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
}
|
||||
|
||||
Creature creature = handler.getSelectedCreature();
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
if (!creature || creature.IsPet())
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
@@ -678,7 +678,7 @@ namespace Game.Chat
|
||||
|
||||
ulong npcFlags = args.NextUInt64();
|
||||
|
||||
Creature creature = handler.getSelectedCreature();
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
if (!creature)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
@@ -712,7 +712,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
}
|
||||
|
||||
Creature creature = handler.getSelectedCreature();
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
|
||||
if (!creature)
|
||||
{
|
||||
@@ -753,7 +753,7 @@ namespace Game.Chat
|
||||
if (data_1 == 0 || data_2 == 0)
|
||||
return false;
|
||||
|
||||
Creature creature = handler.getSelectedCreature();
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
if (!creature)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
@@ -774,7 +774,7 @@ namespace Game.Chat
|
||||
|
||||
uint displayId = args.NextUInt32();
|
||||
|
||||
Creature creature = handler.getSelectedCreature();
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
|
||||
if (!creature || creature.IsPet())
|
||||
{
|
||||
@@ -843,7 +843,7 @@ namespace Game.Chat
|
||||
if (string.IsNullOrEmpty(type)) // case .setmovetype $move_type (with selected creature)
|
||||
{
|
||||
type = guid_str;
|
||||
creature = handler.getSelectedCreature();
|
||||
creature = handler.GetSelectedCreature();
|
||||
if (!creature || creature.IsPet())
|
||||
return false;
|
||||
lowguid = creature.GetSpawnId();
|
||||
@@ -923,7 +923,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
}
|
||||
|
||||
Creature creature = handler.getSelectedCreature();
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
if (!creature || creature.IsPet())
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
@@ -946,7 +946,7 @@ namespace Game.Chat
|
||||
|
||||
int phaseGroupId = args.NextInt32();
|
||||
|
||||
Creature creature = handler.getSelectedCreature();
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
if (!creature || creature.IsPet())
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
@@ -979,7 +979,7 @@ namespace Game.Chat
|
||||
if (option > 0.0f)
|
||||
mtype = MovementGeneratorType.Random;
|
||||
|
||||
Creature creature = handler.getSelectedCreature();
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
ulong guidLow = 0;
|
||||
|
||||
if (creature)
|
||||
@@ -1015,7 +1015,7 @@ namespace Game.Chat
|
||||
|
||||
uint spawnTime = args.NextUInt32();
|
||||
|
||||
Creature creature = handler.getSelectedCreature();
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
if (!creature)
|
||||
return false;
|
||||
|
||||
@@ -1040,7 +1040,7 @@ namespace Game.Chat
|
||||
|
||||
ulong linkguid = args.NextUInt64();
|
||||
|
||||
Creature creature = handler.getSelectedCreature();
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
if (!creature)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
@@ -1073,7 +1073,7 @@ namespace Game.Chat
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
string charID = handler.extractKeyFromLink(args, "Hcreature_entry");
|
||||
string charID = handler.ExtractKeyFromLink(args, "Hcreature_entry");
|
||||
if (string.IsNullOrEmpty(charID))
|
||||
return false;
|
||||
|
||||
@@ -1130,7 +1130,7 @@ namespace Game.Chat
|
||||
|
||||
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))
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandNeeditemsend);
|
||||
@@ -1145,7 +1145,7 @@ namespace Game.Chat
|
||||
uint extendedcost = args.NextUInt32();
|
||||
string fbonuslist = args.NextString();
|
||||
|
||||
Creature vendor = handler.getSelectedCreature();
|
||||
Creature vendor = handler.GetSelectedCreature();
|
||||
if (!vendor)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.SelectCreature);
|
||||
@@ -1223,7 +1223,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
uint leaderGUID = args.NextUInt32();
|
||||
Creature creature = handler.getSelectedCreature();
|
||||
Creature creature = handler.GetSelectedCreature();
|
||||
|
||||
if (!creature || creature.GetSpawnId() == 0)
|
||||
{
|
||||
@@ -1278,7 +1278,7 @@ namespace Game.Chat
|
||||
else if (spawntype_str.Equals("NOLOOT"))
|
||||
loot = false;
|
||||
|
||||
string charID = handler.extractKeyFromLink(args, "Hcreature_entry");
|
||||
string charID = handler.ExtractKeyFromLink(args, "Hcreature_entry");
|
||||
if (string.IsNullOrEmpty(charID))
|
||||
return false;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Game.Chat
|
||||
static bool HandlePetCreateCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
Creature creatureTarget = handler.getSelectedCreature();
|
||||
Creature creatureTarget = handler.GetSelectedCreature();
|
||||
|
||||
if (!creatureTarget || creatureTarget.IsPet() || creatureTarget.IsTypeId(TypeId.Player))
|
||||
{
|
||||
@@ -106,7 +106,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
}
|
||||
|
||||
uint spellId = handler.extractSpellIdFromLink(args);
|
||||
uint spellId = handler.ExtractSpellIdFromLink(args);
|
||||
if (spellId == 0 || !Global.SpellMgr.HasSpellInfo(spellId))
|
||||
return false;
|
||||
|
||||
@@ -144,7 +144,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
}
|
||||
|
||||
uint spellId = handler.extractSpellIdFromLink(args);
|
||||
uint spellId = handler.ExtractSpellIdFromLink(args);
|
||||
|
||||
if (pet.HasSpell(spellId))
|
||||
pet.RemoveSpell(spellId, false);
|
||||
@@ -186,7 +186,7 @@ namespace Game.Chat
|
||||
|
||||
static Pet GetSelectedPlayerPetOrOwn(CommandHandler handler)
|
||||
{
|
||||
Unit target = handler.getSelectedUnit();
|
||||
Unit target = handler.GetSelectedUnit();
|
||||
if (target)
|
||||
{
|
||||
if (target.IsTypeId(TypeId.Player))
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Game.Chat
|
||||
[Command("add", RBACPermissions.CommandQuestAdd)]
|
||||
static bool Add(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Player player = handler.getSelectedPlayer();
|
||||
Player player = handler.GetSelectedPlayer();
|
||||
if (!player)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
@@ -39,7 +39,7 @@ namespace Game.Chat
|
||||
|
||||
// .addquest #entry'
|
||||
// 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))
|
||||
return false;
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace Game.Chat
|
||||
[Command("complete", RBACPermissions.CommandQuestComplete)]
|
||||
static bool Complete(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Player player = handler.getSelectedPlayer();
|
||||
Player player = handler.GetSelectedPlayer();
|
||||
if (!player)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
@@ -79,7 +79,7 @@ namespace Game.Chat
|
||||
|
||||
// .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
|
||||
string cId = handler.extractKeyFromLink(args, "Hquest");
|
||||
string cId = handler.ExtractKeyFromLink(args, "Hquest");
|
||||
if (!uint.TryParse(cId, out uint entry))
|
||||
return false;
|
||||
|
||||
@@ -162,7 +162,7 @@ namespace Game.Chat
|
||||
[Command("remove", RBACPermissions.CommandQuestRemove)]
|
||||
static bool Remove(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Player player = handler.getSelectedPlayer();
|
||||
Player player = handler.GetSelectedPlayer();
|
||||
if (!player)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
@@ -171,7 +171,7 @@ namespace Game.Chat
|
||||
|
||||
// .removequest #entry'
|
||||
// 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))
|
||||
return false;
|
||||
|
||||
@@ -216,7 +216,7 @@ namespace Game.Chat
|
||||
[Command("reward", RBACPermissions.CommandQuestReward)]
|
||||
static bool Reward(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Player player = handler.getSelectedPlayer();
|
||||
Player player = handler.GetSelectedPlayer();
|
||||
if (!player)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
@@ -225,7 +225,7 @@ namespace Game.Chat
|
||||
|
||||
// .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
|
||||
string cId = handler.extractKeyFromLink(args, "Hquest");
|
||||
string cId = handler.ExtractKeyFromLink(args, "Hquest");
|
||||
if (!uint.TryParse(cId, out uint entry))
|
||||
return false;
|
||||
|
||||
|
||||
@@ -269,7 +269,7 @@ namespace Game.Chat.Commands
|
||||
|
||||
if (useSelectedPlayer)
|
||||
{
|
||||
Player player = handler.getSelectedPlayer();
|
||||
Player player = handler.GetSelectedPlayer();
|
||||
if (!player)
|
||||
return null;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Game.Chat
|
||||
{
|
||||
Player target;
|
||||
ObjectGuid targetGuid;
|
||||
if (!handler.extractPlayerTarget(args, out target, out targetGuid))
|
||||
if (!handler.ExtractPlayerTarget(args, out target, out targetGuid))
|
||||
return false;
|
||||
|
||||
if (target)
|
||||
@@ -48,7 +48,7 @@ namespace Game.Chat
|
||||
static bool HandleResetHonorCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Player target;
|
||||
if (!handler.extractPlayerTarget(args, out target))
|
||||
if (!handler.ExtractPlayerTarget(args, out target))
|
||||
return false;
|
||||
|
||||
target.ResetHonorStats();
|
||||
@@ -92,7 +92,7 @@ namespace Game.Chat
|
||||
static bool HandleResetLevelCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Player target;
|
||||
if (!handler.extractPlayerTarget(args, out target))
|
||||
if (!handler.ExtractPlayerTarget(args, out target))
|
||||
return false;
|
||||
|
||||
if (!HandleResetStatsOrLevelHelper(target))
|
||||
@@ -129,7 +129,7 @@ namespace Game.Chat
|
||||
Player target;
|
||||
ObjectGuid targetGuid;
|
||||
string targetName;
|
||||
if (!handler.extractPlayerTarget(args, out target, out targetGuid, out targetName))
|
||||
if (!handler.ExtractPlayerTarget(args, out target, out targetGuid, out targetName))
|
||||
return false;
|
||||
|
||||
if (target)
|
||||
@@ -157,7 +157,7 @@ namespace Game.Chat
|
||||
static bool HandleResetStatsCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Player target;
|
||||
if (!handler.extractPlayerTarget(args, out target))
|
||||
if (!handler.ExtractPlayerTarget(args, out target))
|
||||
return false;
|
||||
|
||||
if (!HandleResetStatsOrLevelHelper(target))
|
||||
@@ -178,7 +178,7 @@ namespace Game.Chat
|
||||
ObjectGuid targetGuid;
|
||||
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
|
||||
// Try reset talents as Hunter Pet
|
||||
@@ -227,7 +227,7 @@ namespace Game.Chat
|
||||
stmt.AddValue(1, targetGuid.GetCounter());
|
||||
DB.Characters.Execute(stmt);
|
||||
|
||||
string nameLink = handler.playerLink(targetName);
|
||||
string nameLink = handler.PlayerLink(targetName);
|
||||
handler.SendSysMessage(CypherStrings.ResetTalentsOffline, nameLink);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Game.Chat
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
Player target = handler.getSelectedPlayerOrSelf();
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (!target)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
@@ -67,7 +67,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
uint sceneId = args.NextUInt32();
|
||||
Player target = handler.getSelectedPlayerOrSelf();
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (!target)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
@@ -91,7 +91,7 @@ namespace Game.Chat
|
||||
if (!uint.TryParse(args.NextString(""), out uint flags))
|
||||
flags = (uint)SceneFlags.Unk16;
|
||||
|
||||
Player target = handler.getSelectedPlayerOrSelf();
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (!target)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
|
||||
@@ -34,14 +34,14 @@ namespace Game.Chat.Commands
|
||||
Player target;
|
||||
ObjectGuid targetGuid;
|
||||
string targetName;
|
||||
if (!handler.extractPlayerTarget(args, out target, out targetGuid, out targetName))
|
||||
if (!handler.ExtractPlayerTarget(args, out target, out targetGuid, out targetName))
|
||||
return false;
|
||||
|
||||
string tail1 = args.NextString("");
|
||||
if (string.IsNullOrEmpty(tail1))
|
||||
return false;
|
||||
|
||||
string subject = handler.extractQuotedArg(tail1);
|
||||
string subject = handler.ExtractQuotedArg(tail1);
|
||||
if (string.IsNullOrEmpty(subject))
|
||||
return false;
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace Game.Chat.Commands
|
||||
if (string.IsNullOrEmpty(tail2))
|
||||
return false;
|
||||
|
||||
string text = handler.extractQuotedArg(tail2);
|
||||
string text = handler.ExtractQuotedArg(tail2);
|
||||
if (string.IsNullOrEmpty(text))
|
||||
return false;
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Game.Chat.Commands
|
||||
|
||||
DB.Characters.CommitTransaction(trans);
|
||||
|
||||
string nameLink = handler.playerLink(targetName);
|
||||
string nameLink = handler.PlayerLink(targetName);
|
||||
handler.SendSysMessage(CypherStrings.MailSent, nameLink);
|
||||
return true;
|
||||
}
|
||||
@@ -75,14 +75,14 @@ namespace Game.Chat.Commands
|
||||
Player receiver;
|
||||
ObjectGuid receiverGuid;
|
||||
string receiverName;
|
||||
if (!handler.extractPlayerTarget(args, out receiver, out receiverGuid, out receiverName))
|
||||
if (!handler.ExtractPlayerTarget(args, out receiver, out receiverGuid, out receiverName))
|
||||
return false;
|
||||
|
||||
string tail1 = args.NextString("");
|
||||
if (string.IsNullOrEmpty(tail1))
|
||||
return false;
|
||||
|
||||
string subject = handler.extractQuotedArg(tail1);
|
||||
string subject = handler.ExtractQuotedArg(tail1);
|
||||
if (string.IsNullOrEmpty(subject))
|
||||
return false;
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace Game.Chat.Commands
|
||||
if (string.IsNullOrEmpty(tail2))
|
||||
return false;
|
||||
|
||||
string text = handler.extractQuotedArg(tail2);
|
||||
string text = handler.ExtractQuotedArg(tail2);
|
||||
if (string.IsNullOrEmpty(text))
|
||||
return false;
|
||||
|
||||
@@ -164,7 +164,7 @@ namespace Game.Chat.Commands
|
||||
draft.SendMailTo(trans, new MailReceiver(receiver, receiverGuid.GetCounter()), sender);
|
||||
DB.Characters.CommitTransaction(trans);
|
||||
|
||||
string nameLink = handler.playerLink(receiverName);
|
||||
string nameLink = handler.PlayerLink(receiverName);
|
||||
handler.SendSysMessage(CypherStrings.MailSent, nameLink);
|
||||
return true;
|
||||
}
|
||||
@@ -177,14 +177,14 @@ namespace Game.Chat.Commands
|
||||
Player receiver;
|
||||
ObjectGuid receiverGuid;
|
||||
string receiverName;
|
||||
if (!handler.extractPlayerTarget(args, out receiver, out receiverGuid, out receiverName))
|
||||
if (!handler.ExtractPlayerTarget(args, out receiver, out receiverGuid, out receiverName))
|
||||
return false;
|
||||
|
||||
string tail1 = args.NextString("");
|
||||
if (string.IsNullOrEmpty(tail1))
|
||||
return false;
|
||||
|
||||
string subject = handler.extractQuotedArg(tail1);
|
||||
string subject = handler.ExtractQuotedArg(tail1);
|
||||
if (string.IsNullOrEmpty(subject))
|
||||
return false;
|
||||
|
||||
@@ -192,7 +192,7 @@ namespace Game.Chat.Commands
|
||||
if (string.IsNullOrEmpty(tail2))
|
||||
return false;
|
||||
|
||||
string text = handler.extractQuotedArg(tail2);
|
||||
string text = handler.ExtractQuotedArg(tail2);
|
||||
if (string.IsNullOrEmpty(text))
|
||||
return false;
|
||||
|
||||
@@ -213,7 +213,7 @@ namespace Game.Chat.Commands
|
||||
|
||||
DB.Characters.CommitTransaction(trans);
|
||||
|
||||
string nameLink = handler.playerLink(receiverName);
|
||||
string nameLink = handler.PlayerLink(receiverName);
|
||||
handler.SendSysMessage(CypherStrings.MailSent, nameLink);
|
||||
return true;
|
||||
}
|
||||
@@ -223,7 +223,7 @@ namespace Game.Chat.Commands
|
||||
{
|
||||
// - Find the player
|
||||
Player player;
|
||||
if (!handler.extractPlayerTarget(args, out player))
|
||||
if (!handler.ExtractPlayerTarget(args, out player))
|
||||
return false;
|
||||
|
||||
string msgStr = args.NextString("");
|
||||
@@ -231,7 +231,7 @@ namespace Game.Chat.Commands
|
||||
return false;
|
||||
|
||||
// Check that he is not logging out.
|
||||
if (player.GetSession().isLogingOut())
|
||||
if (player.GetSession().IsLogingOut())
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
return false;
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Game.Chat
|
||||
[CommandNonGroup("cooldown", RBACPermissions.CommandCooldown)]
|
||||
static bool HandleCooldownCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Unit target = handler.getSelectedUnit();
|
||||
Unit target = handler.GetSelectedUnit();
|
||||
if (!target)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
@@ -53,7 +53,7 @@ namespace Game.Chat
|
||||
else
|
||||
{
|
||||
// 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)
|
||||
return false;
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace Game.Chat
|
||||
[CommandNonGroup("aura", RBACPermissions.CommandAura)]
|
||||
static bool Auracommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Unit target = handler.getSelectedUnit();
|
||||
Unit target = handler.GetSelectedUnit();
|
||||
if (!target)
|
||||
{
|
||||
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
|
||||
uint spellId = handler.extractSpellIdFromLink(args);
|
||||
uint spellId = handler.ExtractSpellIdFromLink(args);
|
||||
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId);
|
||||
if (spellInfo != null)
|
||||
@@ -98,7 +98,7 @@ namespace Game.Chat
|
||||
[CommandNonGroup("unaura", RBACPermissions.CommandUnaura)]
|
||||
static bool UnAura(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Unit target = handler.getSelectedUnit();
|
||||
Unit target = handler.GetSelectedUnit();
|
||||
if (!target)
|
||||
{
|
||||
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
|
||||
uint spellId = handler.extractSpellIdFromLink(args);
|
||||
uint spellId = handler.ExtractSpellIdFromLink(args);
|
||||
if (spellId == 0)
|
||||
return false;
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace Game.Chat
|
||||
[CommandNonGroup("maxskill", RBACPermissions.CommandMaxskill)]
|
||||
static bool HandleMaxSkillCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Player player = handler.getSelectedPlayerOrSelf();
|
||||
Player player = handler.GetSelectedPlayerOrSelf();
|
||||
if (!player)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
@@ -142,7 +142,7 @@ namespace Game.Chat
|
||||
static bool SetSkill(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
// 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))
|
||||
return false;
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace Game.Chat
|
||||
if (level == 0)
|
||||
return false;
|
||||
|
||||
Player target = handler.getSelectedPlayerOrSelf();
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (!target)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Game.Chat
|
||||
|
||||
Player me = handler.GetPlayer();
|
||||
|
||||
GameTele tele = handler.extractGameTeleFromLink(args);
|
||||
GameTele tele = handler.ExtractGameTeleFromLink(args);
|
||||
|
||||
if (tele == null)
|
||||
{
|
||||
@@ -88,7 +88,7 @@ namespace Game.Chat
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
Player target = handler.getSelectedPlayer();
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
if (!target)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
@@ -100,7 +100,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
// 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)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandTeleNotfound);
|
||||
@@ -123,7 +123,7 @@ namespace Game.Chat
|
||||
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();
|
||||
if (!player || !player.GetSession())
|
||||
@@ -142,7 +142,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
handler.SendSysMessage(CypherStrings.TeleportingTo, plNameLink, "", tele.name);
|
||||
if (handler.needReportToTarget(player))
|
||||
if (handler.NeedReportToTarget(player))
|
||||
player.SendSysMessage(CypherStrings.TeleportedToBy, nameLink);
|
||||
|
||||
// stop flight if need
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Game.Chat.Commands
|
||||
static bool HandleTitlesCurrentCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
// 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))
|
||||
return false;
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Game.Chat.Commands
|
||||
return false;
|
||||
}
|
||||
|
||||
Player target = handler.getSelectedPlayer();
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
if (!target)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
@@ -72,7 +72,7 @@ namespace Game.Chat.Commands
|
||||
static bool HandleTitlesAddCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
// 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))
|
||||
return false;
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace Game.Chat.Commands
|
||||
return false;
|
||||
}
|
||||
|
||||
Player target = handler.getSelectedPlayer();
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
if (!target)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
@@ -114,7 +114,7 @@ namespace Game.Chat.Commands
|
||||
static bool HandleTitlesRemoveCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
// 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))
|
||||
return false;
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace Game.Chat.Commands
|
||||
return false;
|
||||
}
|
||||
|
||||
Player target = handler.getSelectedPlayer();
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
if (!target)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
@@ -171,7 +171,7 @@ namespace Game.Chat.Commands
|
||||
|
||||
ulong titles = args.NextUInt64();
|
||||
|
||||
Player target = handler.getSelectedPlayer();
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
if (!target)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Game.Chat.Commands
|
||||
path_number = args.NextString();
|
||||
|
||||
uint point = 0;
|
||||
Creature target = handler.getSelectedCreature();
|
||||
Creature target = handler.GetSelectedCreature();
|
||||
|
||||
PreparedStatement stmt;
|
||||
|
||||
@@ -365,7 +365,7 @@ namespace Game.Chat.Commands
|
||||
string path_number = args.NextString();
|
||||
|
||||
uint pathid;
|
||||
Creature target = handler.getSelectedCreature();
|
||||
Creature target = handler.GetSelectedCreature();
|
||||
|
||||
// Did player provide a path_id?
|
||||
if (string.IsNullOrEmpty(path_number))
|
||||
@@ -450,7 +450,7 @@ namespace Game.Chat.Commands
|
||||
// . variable lowguid is filled with the GUID of the NPC
|
||||
uint pathid;
|
||||
uint point;
|
||||
Creature target = handler.getSelectedCreature();
|
||||
Creature target = handler.GetSelectedCreature();
|
||||
|
||||
// User did select a visual waypoint?
|
||||
if (!target || target.GetEntry() != 1)
|
||||
@@ -625,7 +625,7 @@ namespace Game.Chat.Commands
|
||||
string guid_str = args.NextString();
|
||||
|
||||
uint pathid = 0;
|
||||
Creature target = handler.getSelectedCreature();
|
||||
Creature target = handler.GetSelectedCreature();
|
||||
|
||||
// Did player provide a PathID?
|
||||
|
||||
@@ -973,7 +973,7 @@ namespace Game.Chat.Commands
|
||||
[Command("unload", RBACPermissions.CommandWpUnload)]
|
||||
static bool HandleWpUnLoadCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Creature target = handler.getSelectedCreature();
|
||||
Creature target = handler.GetSelectedCreature();
|
||||
if (!target)
|
||||
{
|
||||
handler.SendSysMessage("|cff33ffffYou must select a target.|r");
|
||||
|
||||
@@ -27,10 +27,10 @@ namespace Game.Collision
|
||||
{
|
||||
public BIH()
|
||||
{
|
||||
init_empty();
|
||||
InitEmpty();
|
||||
}
|
||||
|
||||
void init_empty()
|
||||
void InitEmpty()
|
||||
{
|
||||
tree= new uint[3];
|
||||
objects = new uint[0];
|
||||
@@ -38,7 +38,7 @@ namespace Game.Collision
|
||||
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
|
||||
tempTree.Add(3u << 30); // dummy leaf
|
||||
@@ -51,16 +51,16 @@ namespace Game.Collision
|
||||
gridBox.hi = bounds.Hi;
|
||||
AABound nodeBox = gridBox;
|
||||
// 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)
|
||||
{
|
||||
// write leaf node
|
||||
stats.updateLeaf(depth, right - left + 1);
|
||||
createNode(tempTree, nodeIndex, left, right);
|
||||
stats.UpdateLeaf(depth, right - left + 1);
|
||||
CreateNode(tempTree, nodeIndex, left, right);
|
||||
return;
|
||||
}
|
||||
// calculate extents
|
||||
@@ -122,21 +122,21 @@ namespace Game.Collision
|
||||
// node box is too big compare to space occupied by primitives?
|
||||
if (1.3f * nodeNewW < nodeBoxW)
|
||||
{
|
||||
stats.updateBVH2();
|
||||
stats.UpdateBVH2();
|
||||
int nextIndex1 = tempTree.Count;
|
||||
// allocate child
|
||||
tempTree.Add(0);
|
||||
tempTree.Add(0);
|
||||
tempTree.Add(0);
|
||||
// write bvh2 clip node
|
||||
stats.updateInner();
|
||||
stats.UpdateInner();
|
||||
tempTree[nodeIndex + 0] = (uint)((axis << 30) | (1 << 29) | nextIndex1);
|
||||
tempTree[nodeIndex + 1] = floatToRawIntBits(nodeL);
|
||||
tempTree[nodeIndex + 2] = floatToRawIntBits(nodeR);
|
||||
tempTree[nodeIndex + 1] = FloatToRawIntBits(nodeL);
|
||||
tempTree[nodeIndex + 2] = FloatToRawIntBits(nodeR);
|
||||
// update nodebox and recurse
|
||||
nodeBox.lo[axis] = nodeL;
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -147,8 +147,8 @@ namespace Game.Collision
|
||||
if (prevAxis == axis && MathFunctions.fuzzyEq(prevSplit, split))
|
||||
{
|
||||
// we are stuck here - create a leaf
|
||||
stats.updateLeaf(depth, right - left + 1);
|
||||
createNode(tempTree, nodeIndex, left, right);
|
||||
stats.UpdateLeaf(depth, right - left + 1);
|
||||
CreateNode(tempTree, nodeIndex, left, right);
|
||||
return;
|
||||
}
|
||||
if (clipL <= split)
|
||||
@@ -169,8 +169,8 @@ namespace Game.Collision
|
||||
if (prevAxis == axis && MathFunctions.fuzzyEq(prevSplit, split))
|
||||
{
|
||||
// we are stuck here - create a leaf
|
||||
stats.updateLeaf(depth, right - left + 1);
|
||||
createNode(tempTree, nodeIndex, left, right);
|
||||
stats.UpdateLeaf(depth, right - left + 1);
|
||||
CreateNode(tempTree, nodeIndex, left, right);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -201,23 +201,23 @@ namespace Game.Collision
|
||||
{
|
||||
// create a node with a left child
|
||||
// write leaf node
|
||||
stats.updateInner();
|
||||
stats.UpdateInner();
|
||||
tempTree[nodeIndex + 0] = (uint)((prevAxis << 30) | nextIndex0);
|
||||
tempTree[nodeIndex + 1] = floatToRawIntBits(prevClip);
|
||||
tempTree[nodeIndex + 2] = floatToRawIntBits(float.PositiveInfinity);
|
||||
tempTree[nodeIndex + 1] = FloatToRawIntBits(prevClip);
|
||||
tempTree[nodeIndex + 2] = FloatToRawIntBits(float.PositiveInfinity);
|
||||
}
|
||||
else
|
||||
{
|
||||
// create a node with a right child
|
||||
// write leaf node
|
||||
stats.updateInner();
|
||||
stats.UpdateInner();
|
||||
tempTree[nodeIndex + 0] = (uint)((prevAxis << 30) | (nextIndex0 - 3));
|
||||
tempTree[nodeIndex + 1] = floatToRawIntBits(float.NegativeInfinity);
|
||||
tempTree[nodeIndex + 2] = floatToRawIntBits(prevClip);
|
||||
tempTree[nodeIndex + 1] = FloatToRawIntBits(float.NegativeInfinity);
|
||||
tempTree[nodeIndex + 2] = FloatToRawIntBits(prevClip);
|
||||
}
|
||||
// count stats for the unused leaf
|
||||
depth++;
|
||||
stats.updateLeaf(depth, 0);
|
||||
stats.UpdateLeaf(depth, 0);
|
||||
// now we keep going as we are, with a new nodeIndex:
|
||||
nodeIndex = nextIndex0;
|
||||
}
|
||||
@@ -245,10 +245,10 @@ namespace Game.Collision
|
||||
tempTree.Add(0);
|
||||
}
|
||||
// write leaf node
|
||||
stats.updateInner();
|
||||
stats.UpdateInner();
|
||||
tempTree[nodeIndex + 0] = (uint)((axis << 30) | nextIndex);
|
||||
tempTree[nodeIndex + 1] = floatToRawIntBits(clipL);
|
||||
tempTree[nodeIndex + 2] = floatToRawIntBits(clipR);
|
||||
tempTree[nodeIndex + 1] = FloatToRawIntBits(clipL);
|
||||
tempTree[nodeIndex + 2] = FloatToRawIntBits(clipR);
|
||||
// prepare L/R child boxes
|
||||
AABound gridBoxL = gridBox;
|
||||
AABound gridBoxR = gridBox;
|
||||
@@ -259,16 +259,16 @@ namespace Game.Collision
|
||||
nodeBoxR.lo[axis] = clipR;
|
||||
// recurse
|
||||
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
|
||||
stats.updateLeaf(depth + 1, 0);
|
||||
stats.UpdateLeaf(depth + 1, 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
|
||||
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 hi = reader.Read<Vector3>();
|
||||
@@ -283,11 +283,11 @@ namespace Game.Collision
|
||||
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)
|
||||
{
|
||||
init_empty();
|
||||
InitEmpty();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -296,16 +296,16 @@ namespace Game.Collision
|
||||
dat.numPrims = (uint)primitives.Count;
|
||||
dat.indices = new uint[dat.numPrims];
|
||||
dat.primBound = new AxisAlignedBox[dat.numPrims];
|
||||
bounds = primitives[0].getBounds();
|
||||
bounds = primitives[0].GetBounds();
|
||||
for (int i = 0; i < dat.numPrims; ++i)
|
||||
{
|
||||
dat.indices[i] = (uint)i;
|
||||
dat.primBound[i] = primitives[i].getBounds();
|
||||
dat.primBound[i] = primitives[i].GetBounds();
|
||||
bounds.merge(dat.primBound[i]);
|
||||
}
|
||||
List<uint> tempTree = new List<uint>();
|
||||
BuildStats stats = new BuildStats();
|
||||
buildHierarchy(tempTree, dat, stats);
|
||||
BuildHierarchy(tempTree, dat, stats);
|
||||
|
||||
objects = new uint[dat.numPrims];
|
||||
for (int i = 0; i < dat.numPrims; ++i)
|
||||
@@ -314,9 +314,9 @@ namespace Game.Collision
|
||||
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 intervalMax = -1.0f;
|
||||
@@ -356,7 +356,7 @@ namespace Game.Collision
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
offsetFront[i] = floatToRawIntBits(dir[i]) >> 31;
|
||||
offsetFront[i] = FloatToRawIntBits(dir[i]) >> 31;
|
||||
offsetBack[i] = offsetFront[i] ^ 1;
|
||||
offsetFront3[i] = offsetFront[i] * 3;
|
||||
offsetBack3[i] = offsetBack[i] * 3;
|
||||
@@ -383,8 +383,8 @@ namespace Game.Collision
|
||||
if (axis < 3)
|
||||
{
|
||||
// "normal" interior node
|
||||
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 tf = (IntBitsToFloat(tree[(int)(node + offsetFront[axis])]) - org[axis]) * invDir[axis];
|
||||
float tb = (IntBitsToFloat(tree[(int)(node + offsetBack[axis])]) - org[axis]) * invDir[axis];
|
||||
// ray passes between clip zones
|
||||
if (tf < intervalMin && tb > intervalMax)
|
||||
break;
|
||||
@@ -432,8 +432,8 @@ namespace Game.Collision
|
||||
{
|
||||
if (axis > 2)
|
||||
return; // should not happen
|
||||
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 tf = (IntBitsToFloat(tree[(int)(node + offsetFront[axis])]) - org[axis]) * invDir[axis];
|
||||
float tb = (IntBitsToFloat(tree[(int)(node + offsetBack[axis])]) - org[axis]) * invDir[axis];
|
||||
node = offset;
|
||||
intervalMin = (tf >= intervalMin) ? tf : intervalMin;
|
||||
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))
|
||||
return;
|
||||
@@ -481,8 +481,8 @@ namespace Game.Collision
|
||||
if (axis < 3)
|
||||
{
|
||||
// "normal" interior node
|
||||
float tl = intBitsToFloat(tree[node + 1]);
|
||||
float tr = intBitsToFloat(tree[node + 2]);
|
||||
float tl = IntBitsToFloat(tree[node + 1]);
|
||||
float tr = IntBitsToFloat(tree[node + 2]);
|
||||
// point is between clip zones
|
||||
if (tl < p[(int)axis] && tr > p[axis])
|
||||
break;
|
||||
@@ -522,8 +522,8 @@ namespace Game.Collision
|
||||
{
|
||||
if (axis > 2)
|
||||
return; // should not happen
|
||||
float tl = intBitsToFloat(tree[node + 1]);
|
||||
float tr = intBitsToFloat(tree[node + 2]);
|
||||
float tl = IntBitsToFloat(tree[node + 1]);
|
||||
float tr = IntBitsToFloat(tree[node + 2]);
|
||||
node = offset;
|
||||
if (tl > p[axis] || tr < p[axis])
|
||||
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
|
||||
tempTree[nodeIndex + 0] = (uint)((3 << 30) | left);
|
||||
@@ -589,9 +589,9 @@ namespace Game.Collision
|
||||
numLeavesN[i] = 0;
|
||||
}
|
||||
|
||||
public void updateInner() { numNodes++; }
|
||||
public void updateBVH2() { numBVH2++; }
|
||||
public void updateLeaf(int depth, int n)
|
||||
public void UpdateInner() { numNodes++; }
|
||||
public void UpdateBVH2() { numBVH2++; }
|
||||
public void UpdateLeaf(int depth, int n)
|
||||
{
|
||||
numLeaves++;
|
||||
minDepth = Math.Min(depth, minDepth);
|
||||
@@ -619,13 +619,13 @@ namespace Game.Collision
|
||||
public float FloatValue;
|
||||
}
|
||||
|
||||
uint floatToRawIntBits(float f)
|
||||
uint FloatToRawIntBits(float f)
|
||||
{
|
||||
FloatToIntConverter converter = new FloatToIntConverter();
|
||||
converter.FloatValue = f;
|
||||
return converter.IntValue;
|
||||
}
|
||||
float intBitsToFloat(uint i)
|
||||
float IntBitsToFloat(uint i)
|
||||
{
|
||||
FloatToIntConverter converter = new FloatToIntConverter();
|
||||
converter.IntValue = i;
|
||||
|
||||
@@ -22,12 +22,12 @@ namespace Game.Collision
|
||||
{
|
||||
public class BIHWrap<T> where T : IModel
|
||||
{
|
||||
public void insert(T obj)
|
||||
public void Insert(T obj)
|
||||
{
|
||||
++unbalanced_times;
|
||||
m_objects_to_push.Add(obj);
|
||||
}
|
||||
public void remove(T obj)
|
||||
public void Remove(T obj)
|
||||
{
|
||||
++unbalanced_times;
|
||||
uint Idx = 0;
|
||||
@@ -37,7 +37,7 @@ namespace Game.Collision
|
||||
m_objects_to_push.Remove(obj);
|
||||
}
|
||||
|
||||
public void balance()
|
||||
public void Balance()
|
||||
{
|
||||
if (unbalanced_times == 0)
|
||||
return;
|
||||
@@ -47,21 +47,21 @@ namespace Game.Collision
|
||||
m_objects.AddRange(m_obj2Idx.Keys);
|
||||
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);
|
||||
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);
|
||||
m_tree.intersectPoint(point, callback);
|
||||
m_tree.IntersectPoint(point, callback);
|
||||
}
|
||||
|
||||
BIH m_tree = new BIH();
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Framework.Constants;
|
||||
|
||||
namespace Game.Collision
|
||||
{
|
||||
@@ -178,12 +178,12 @@ namespace Game.Collision
|
||||
{
|
||||
if (prims[entry] == null)
|
||||
return false;
|
||||
bool result = prims[entry].intersectRay(ray, ref distance, pStopAtFirstHit, flags);
|
||||
bool result = prims[entry].IntersectRay(ray, ref distance, pStopAtFirstHit, flags);
|
||||
if (result)
|
||||
hit = true;
|
||||
return result;
|
||||
}
|
||||
public bool didHit() { return hit; }
|
||||
public bool DidHit() { return hit; }
|
||||
|
||||
ModelInstance[] prims;
|
||||
bool hit;
|
||||
@@ -201,7 +201,7 @@ namespace Game.Collision
|
||||
if (prims[entry] == null)
|
||||
return;
|
||||
|
||||
prims[entry].intersectPoint(point, aInfo);
|
||||
prims[entry].IntersectPoint(point, aInfo);
|
||||
}
|
||||
|
||||
ModelInstance[] prims;
|
||||
@@ -242,7 +242,7 @@ namespace Game.Collision
|
||||
return _didHit;
|
||||
}
|
||||
|
||||
public bool didHit() { return _didHit; }
|
||||
public bool DidHit() { return _didHit; }
|
||||
|
||||
bool _didHit;
|
||||
PhaseShift _phaseShift;
|
||||
|
||||
@@ -26,42 +26,42 @@ namespace Game.Collision
|
||||
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;
|
||||
DynamicTreeIntersectionCallback callback = new DynamicTreeIntersectionCallback(phaseShift);
|
||||
impl.intersectRay(ray, callback, ref distance, endPos);
|
||||
if (callback.didHit())
|
||||
impl.IntersectRay(ray, callback, ref distance, endPos);
|
||||
if (callback.DidHit())
|
||||
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;
|
||||
float maxDist = (endPos - startPos).magnitude();
|
||||
@@ -76,7 +76,7 @@ namespace Game.Collision
|
||||
Vector3 dir = (endPos - startPos) / maxDist; // direction with length of 1
|
||||
Ray ray = new Ray(startPos, dir);
|
||||
float dist = maxDist;
|
||||
if (getIntersectionTime(ray, endPos, phaseShift, dist))
|
||||
if (GetIntersectionTime(ray, endPos, phaseShift, dist))
|
||||
{
|
||||
resultHitPos = startPos + dir * dist;
|
||||
if (modifyDist < 0)
|
||||
@@ -99,7 +99,7 @@ namespace Game.Collision
|
||||
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();
|
||||
|
||||
@@ -108,25 +108,25 @@ namespace Game.Collision
|
||||
|
||||
Ray r = new Ray(startPos, (endPos - startPos) / maxDist);
|
||||
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);
|
||||
Ray r = new Ray(v, new Vector3(0, 0, -1));
|
||||
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;
|
||||
else
|
||||
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;
|
||||
adtId = 0;
|
||||
@@ -135,7 +135,7 @@ namespace Game.Collision
|
||||
|
||||
Vector3 v = new Vector3(x, y, z + 0.5f);
|
||||
DynamicTreeAreaInfoCallback intersectionCallBack = new DynamicTreeAreaInfoCallback(phaseShift);
|
||||
impl.intersectPoint(v, intersectionCallBack);
|
||||
impl.IntersectPoint(v, intersectionCallBack);
|
||||
if (intersectionCallBack.GetAreaInfo().result)
|
||||
{
|
||||
flags = intersectionCallBack.GetAreaInfo().flags;
|
||||
@@ -159,27 +159,27 @@ namespace Game.Collision
|
||||
unbalanced_times = 0;
|
||||
}
|
||||
|
||||
public override void insert(GameObjectModel mdl)
|
||||
public override void Insert(GameObjectModel mdl)
|
||||
{
|
||||
base.insert(mdl);
|
||||
base.Insert(mdl);
|
||||
++unbalanced_times;
|
||||
}
|
||||
|
||||
public override void remove(GameObjectModel mdl)
|
||||
public override void Remove(GameObjectModel mdl)
|
||||
{
|
||||
base.remove(mdl);
|
||||
base.Remove(mdl);
|
||||
++unbalanced_times;
|
||||
}
|
||||
|
||||
public override void balance()
|
||||
public override void Balance()
|
||||
{
|
||||
base.balance();
|
||||
base.Balance();
|
||||
unbalanced_times = 0;
|
||||
}
|
||||
|
||||
public void update(uint difftime)
|
||||
public void Update(uint difftime)
|
||||
{
|
||||
if (empty())
|
||||
if (Empty())
|
||||
return;
|
||||
|
||||
rebalance_timer.Update((int)difftime);
|
||||
@@ -187,7 +187,7 @@ namespace Game.Collision
|
||||
{
|
||||
rebalance_timer.Reset(200);
|
||||
if (unbalanced_times > 0)
|
||||
balance();
|
||||
Balance();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,17 +49,17 @@ namespace Game.Collision
|
||||
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;
|
||||
if (isMapLoadingEnabled())
|
||||
if (IsMapLoadingEnabled())
|
||||
{
|
||||
if (loadSingleMap(mapId, x, y))
|
||||
if (LoadSingleMap(mapId, x, y))
|
||||
{
|
||||
result = VMAPLoadResult.OK;
|
||||
var childMaps = iChildMapData.LookupByKey(mapId);
|
||||
foreach (uint childMapId in childMaps)
|
||||
if (!loadSingleMap(childMapId, x, y))
|
||||
if (!LoadSingleMap(childMapId, x, y))
|
||||
result = VMAPLoadResult.Error;
|
||||
}
|
||||
else
|
||||
@@ -69,12 +69,12 @@ namespace Game.Collision
|
||||
return result;
|
||||
}
|
||||
|
||||
bool loadSingleMap(uint mapId, uint tileX, uint tileY)
|
||||
bool LoadSingleMap(uint mapId, uint tileX, uint tileY)
|
||||
{
|
||||
var instanceTree = iInstanceMapTrees.LookupByKey(mapId);
|
||||
if (instanceTree == null)
|
||||
{
|
||||
string filename = VMapPath + getMapFileName(mapId);
|
||||
string filename = VMapPath + GetMapFileName(mapId);
|
||||
StaticMapTree newTree = new StaticMapTree(mapId);
|
||||
if (!newTree.InitMap(filename))
|
||||
return false;
|
||||
@@ -87,79 +87,79 @@ namespace Game.Collision
|
||||
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);
|
||||
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);
|
||||
if (instanceTree != null)
|
||||
{
|
||||
instanceTree.UnloadMapTile(x, y, this);
|
||||
if (instanceTree.numLoadedTiles() == 0)
|
||||
if (instanceTree.NumLoadedTiles() == 0)
|
||||
{
|
||||
iInstanceMapTrees.Remove(mapId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void unloadMap(uint mapId)
|
||||
public void UnloadMap(uint mapId)
|
||||
{
|
||||
var childMaps = iChildMapData.LookupByKey(mapId);
|
||||
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);
|
||||
if (instanceTree != null)
|
||||
{
|
||||
instanceTree.UnloadMap(this);
|
||||
if (instanceTree.numLoadedTiles() == 0)
|
||||
if (instanceTree.NumLoadedTiles() == 0)
|
||||
{
|
||||
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;
|
||||
|
||||
var instanceTree = iInstanceMapTrees.LookupByKey(mapId);
|
||||
if (instanceTree != null)
|
||||
{
|
||||
Vector3 pos1 = convertPositionToInternalRep(x1, y1, z1);
|
||||
Vector3 pos2 = convertPositionToInternalRep(x2, y2, z2);
|
||||
Vector3 pos1 = ConvertPositionToInternalRep(x1, y1, z1);
|
||||
Vector3 pos2 = ConvertPositionToInternalRep(x2, y2, z2);
|
||||
if (pos1 != pos2)
|
||||
return instanceTree.isInLineOfSight(pos1, pos2, ignoreFlags);
|
||||
return instanceTree.IsInLineOfSight(pos1, pos2, ignoreFlags);
|
||||
}
|
||||
|
||||
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);
|
||||
if (instanceTree != null)
|
||||
{
|
||||
Vector3 resultPos;
|
||||
Vector3 pos1 = convertPositionToInternalRep(x1, y1, z1);
|
||||
Vector3 pos2 = convertPositionToInternalRep(x2, y2, z2);
|
||||
bool result = instanceTree.getObjectHitPos(pos1, pos2, out resultPos, modifyDist);
|
||||
resultPos = convertPositionToInternalRep(resultPos.X, resultPos.Y, resultPos.Z);
|
||||
Vector3 pos1 = ConvertPositionToInternalRep(x1, y1, z1);
|
||||
Vector3 pos2 = ConvertPositionToInternalRep(x2, y2, z2);
|
||||
bool result = instanceTree.GetObjectHitPos(pos1, pos2, out resultPos, modifyDist);
|
||||
resultPos = ConvertPositionToInternalRep(resultPos.X, resultPos.Y, resultPos.Z);
|
||||
rx = resultPos.X;
|
||||
ry = resultPos.Y;
|
||||
rz = resultPos.Z;
|
||||
@@ -174,15 +174,15 @@ namespace Game.Collision
|
||||
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);
|
||||
if (instanceTree != null)
|
||||
{
|
||||
Vector3 pos = convertPositionToInternalRep(x, y, z);
|
||||
float height = instanceTree.getHeight(pos, maxSearchDist);
|
||||
Vector3 pos = ConvertPositionToInternalRep(x, y, z);
|
||||
float height = instanceTree.GetHeight(pos, maxSearchDist);
|
||||
if (float.IsInfinity(height))
|
||||
height = MapConst.VMAPInvalidHeightValue; // No height
|
||||
|
||||
@@ -193,7 +193,7 @@ namespace Game.Collision
|
||||
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;
|
||||
adtId = 0;
|
||||
@@ -204,8 +204,8 @@ namespace Game.Collision
|
||||
var instanceTree = iInstanceMapTrees.LookupByKey(mapId);
|
||||
if (instanceTree != null)
|
||||
{
|
||||
Vector3 pos = convertPositionToInternalRep(x, y, z);
|
||||
bool result = instanceTree.getAreaInfo(ref pos, out flags, out adtId, out rootId, out groupId);
|
||||
Vector3 pos = ConvertPositionToInternalRep(x, y, z);
|
||||
bool result = instanceTree.GetAreaInfo(ref pos, out flags, out adtId, out rootId, out groupId);
|
||||
// z is not touched by convertPositionToInternalRep(), so just copy
|
||||
z = pos.Z;
|
||||
return result;
|
||||
@@ -223,7 +223,7 @@ namespace Game.Collision
|
||||
if (instanceTree != null)
|
||||
{
|
||||
LocationInfo info = new LocationInfo();
|
||||
Vector3 pos = convertPositionToInternalRep(x, y, z);
|
||||
Vector3 pos = ConvertPositionToInternalRep(x, y, z);
|
||||
if (instanceTree.GetLocationInfo(pos, info))
|
||||
{
|
||||
floor = info.ground_Z;
|
||||
@@ -239,7 +239,7 @@ namespace Game.Collision
|
||||
return false;
|
||||
}
|
||||
|
||||
public WorldModel acquireModelInstance(string filename, uint flags = 0)
|
||||
public WorldModel AcquireModelInstance(string filename, uint flags = 0)
|
||||
{
|
||||
lock (LoadedModelFilesLock)
|
||||
{
|
||||
@@ -248,7 +248,7 @@ namespace Game.Collision
|
||||
if (model == null)
|
||||
{
|
||||
WorldModel worldmodel = new WorldModel();
|
||||
if (!worldmodel.readFile(VMapPath + filename))
|
||||
if (!worldmodel.ReadFile(VMapPath + filename))
|
||||
{
|
||||
Log.outError(LogFilter.Server, "VMapManager: could not load '{0}'", filename);
|
||||
return null;
|
||||
@@ -259,16 +259,16 @@ namespace Game.Collision
|
||||
worldmodel.Flags = flags;
|
||||
|
||||
model = new ManagedModel();
|
||||
model.setModel(worldmodel);
|
||||
model.SetModel(worldmodel);
|
||||
|
||||
iLoadedModelFiles.Add(filename, model);
|
||||
}
|
||||
model.incRefCount();
|
||||
return model.getModel();
|
||||
model.IncRefCount();
|
||||
return model.GetModel();
|
||||
}
|
||||
}
|
||||
|
||||
public void releaseModelInstance(string filename)
|
||||
public void ReleaseModelInstance(string filename)
|
||||
{
|
||||
lock (LoadedModelFilesLock)
|
||||
{
|
||||
@@ -279,7 +279,7 @@ namespace Game.Collision
|
||||
Log.outError(LogFilter.Server, "VMapManager: trying to unload non-loaded file '{0}'", filename);
|
||||
return;
|
||||
}
|
||||
if (model.decRefCount() == 0)
|
||||
if (model.DecRefCount() == 0)
|
||||
{
|
||||
Log.outDebug(LogFilter.Maps, "VMapManager: unloading file '{0}'", 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);
|
||||
}
|
||||
|
||||
public int getParentMapId(uint mapId)
|
||||
public int GetParentMapId(uint mapId)
|
||||
{
|
||||
if (iParentMapData.ContainsKey(mapId))
|
||||
return (int)iParentMapData[mapId];
|
||||
@@ -300,7 +300,7 @@ namespace Game.Collision
|
||||
return -1;
|
||||
}
|
||||
|
||||
Vector3 convertPositionToInternalRep(float x, float y, float z)
|
||||
Vector3 ConvertPositionToInternalRep(float x, float y, float z)
|
||||
{
|
||||
Vector3 pos = new Vector3();
|
||||
float mid = 0.5f * 64.0f * 533.33333333f;
|
||||
@@ -311,17 +311,17 @@ namespace Game.Collision
|
||||
return pos;
|
||||
}
|
||||
|
||||
public static string getMapFileName(uint mapId)
|
||||
public static string GetMapFileName(uint mapId)
|
||||
{
|
||||
return $"{mapId:D4}.vmtree";
|
||||
}
|
||||
|
||||
public void setEnableLineOfSightCalc(bool pVal) { _enableLineOfSightCalc = pVal; }
|
||||
public void setEnableHeightCalc(bool pVal) { _enableHeightCalc = pVal; }
|
||||
public void SetEnableLineOfSightCalc(bool pVal) { _enableLineOfSightCalc = pVal; }
|
||||
public void SetEnableHeightCalc(bool pVal) { _enableHeightCalc = pVal; }
|
||||
|
||||
public bool isLineOfSightCalcEnabled() { return _enableLineOfSightCalc; }
|
||||
public bool isHeightCalcEnabled() { return _enableHeightCalc; }
|
||||
public bool isMapLoadingEnabled() { return _enableLineOfSightCalc || _enableHeightCalc; }
|
||||
public bool IsLineOfSightCalcEnabled() { return _enableLineOfSightCalc; }
|
||||
public bool IsHeightCalcEnabled() { return _enableHeightCalc; }
|
||||
public bool IsMapLoadingEnabled() { return _enableLineOfSightCalc || _enableHeightCalc; }
|
||||
|
||||
Dictionary<string, ManagedModel> iLoadedModelFiles = new Dictionary<string, ManagedModel>();
|
||||
Dictionary<uint, StaticMapTree> iInstanceMapTrees = new Dictionary<uint, StaticMapTree>();
|
||||
@@ -341,10 +341,10 @@ namespace Game.Collision
|
||||
iRefCount = 0;
|
||||
}
|
||||
|
||||
public void setModel(WorldModel model) { iModel = model; }
|
||||
public WorldModel getModel() { return iModel; }
|
||||
public void incRefCount() { ++iRefCount; }
|
||||
public int decRefCount() { return --iRefCount; }
|
||||
public void SetModel(WorldModel model) { iModel = model; }
|
||||
public WorldModel GetModel() { return iModel; }
|
||||
public void IncRefCount() { ++iRefCount; }
|
||||
public int DecRefCount() { return --iRefCount; }
|
||||
|
||||
WorldModel iModel;
|
||||
int iRefCount;
|
||||
|
||||
@@ -69,9 +69,9 @@ namespace Game.Collision
|
||||
var magic = reader.ReadStringFromChars(8);
|
||||
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];
|
||||
success = true;
|
||||
}
|
||||
@@ -98,9 +98,9 @@ namespace Game.Collision
|
||||
{
|
||||
foreach (var id in iLoadedSpawns)
|
||||
{
|
||||
iTreeValues[id.Key].setUnloaded();
|
||||
iTreeValues[id.Key].SetUnloaded();
|
||||
for (uint refCount = 0; refCount < id.Key; ++refCount)
|
||||
vm.releaseModelInstance(iTreeValues[id.Key].name);
|
||||
vm.ReleaseModelInstance(iTreeValues[id.Key].name);
|
||||
}
|
||||
iLoadedSpawns.Clear();
|
||||
iLoadedTiles.Clear();
|
||||
@@ -118,7 +118,7 @@ namespace Game.Collision
|
||||
FileStream stream = OpenMapTileFile(VMapManager.VMapPath, iMapID, tileX, tileY, vm);
|
||||
if (stream == null)
|
||||
{
|
||||
iLoadedTiles[packTileID(tileX, tileY)] = false;
|
||||
iLoadedTiles[PackTileID(tileX, tileY)] = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -133,11 +133,11 @@ namespace Game.Collision
|
||||
{
|
||||
// read model spawns
|
||||
ModelSpawn spawn;
|
||||
result = ModelSpawn.readFromFile(reader, out spawn);
|
||||
result = ModelSpawn.ReadFromFile(reader, out spawn);
|
||||
if (result)
|
||||
{
|
||||
// acquire model instance
|
||||
WorldModel model = vm.acquireModelInstance(spawn.name, spawn.flags);
|
||||
WorldModel model = vm.AcquireModelInstance(spawn.name, spawn.flags);
|
||||
if (model == null)
|
||||
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;
|
||||
}
|
||||
|
||||
public void UnloadMapTile(uint tileX, uint tileY, VMapManager vm)
|
||||
{
|
||||
uint tileID = packTileID(tileX, tileY);
|
||||
uint tileID = PackTileID(tileX, tileY);
|
||||
var tile = iLoadedTiles.LookupByKey(tileID);
|
||||
if (!iLoadedTiles.ContainsKey(tileID))
|
||||
{
|
||||
@@ -195,11 +195,11 @@ namespace Game.Collision
|
||||
{
|
||||
// read model spawns
|
||||
ModelSpawn spawn;
|
||||
result = ModelSpawn.readFromFile(reader, out spawn);
|
||||
result = ModelSpawn.ReadFromFile(reader, out spawn);
|
||||
if (result)
|
||||
{
|
||||
// release model instance
|
||||
vm.releaseModelInstance(spawn.name);
|
||||
vm.ReleaseModelInstance(spawn.name);
|
||||
|
||||
// update tree
|
||||
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);
|
||||
else if (--iLoadedSpawns[referencedNode] == 0)
|
||||
{
|
||||
iTreeValues[referencedNode].setUnloaded();
|
||||
iTreeValues[referencedNode].SetUnloaded();
|
||||
iLoadedSpawns.Remove(referencedNode);
|
||||
}
|
||||
}
|
||||
@@ -224,17 +224,17 @@ namespace Game.Collision
|
||||
iLoadedTiles.Remove(tileID);
|
||||
}
|
||||
|
||||
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 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 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))
|
||||
{
|
||||
int parentMapId = vm.getParentMapId(mapID);
|
||||
int parentMapId = vm.GetParentMapId(mapID);
|
||||
if (parentMapId != -1)
|
||||
tilefile = vmapPath + getTileFileName((uint)parentMapId, tileX, tileY);
|
||||
tilefile = vmapPath + GetTileFileName((uint)parentMapId, tileX, tileY);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
string fullname = vmapPath + VMapManager.getMapFileName(mapID);
|
||||
string fullname = vmapPath + VMapManager.GetMapFileName(mapID);
|
||||
if (!File.Exists(fullname))
|
||||
return LoadResult.FileNotFound;
|
||||
|
||||
@@ -268,12 +268,12 @@ namespace Game.Collision
|
||||
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";
|
||||
}
|
||||
|
||||
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;
|
||||
adtId = 0;
|
||||
@@ -281,7 +281,7 @@ namespace Game.Collision
|
||||
groupId = 0;
|
||||
|
||||
AreaInfoCallback intersectionCallBack = new AreaInfoCallback(iTreeValues);
|
||||
iTree.intersectPoint(pos, intersectionCallBack);
|
||||
iTree.IntersectPoint(pos, intersectionCallBack);
|
||||
if (intersectionCallBack.aInfo.result)
|
||||
{
|
||||
flags = intersectionCallBack.aInfo.flags;
|
||||
@@ -297,32 +297,32 @@ namespace Game.Collision
|
||||
public bool GetLocationInfo(Vector3 pos, LocationInfo info)
|
||||
{
|
||||
LocationInfoCallback intersectionCallBack = new LocationInfoCallback(iTreeValues, info);
|
||||
iTree.intersectPoint(pos, intersectionCallBack);
|
||||
iTree.IntersectPoint(pos, intersectionCallBack);
|
||||
return intersectionCallBack.result;
|
||||
}
|
||||
|
||||
public float getHeight(Vector3 pPos, float maxSearchDist)
|
||||
public float GetHeight(Vector3 pPos, float maxSearchDist)
|
||||
{
|
||||
float height = float.PositiveInfinity;
|
||||
Vector3 dir = new Vector3(0, 0, -1);
|
||||
Ray ray = new Ray(pPos, dir); // direction with length of 1
|
||||
float maxDist = maxSearchDist;
|
||||
if (getIntersectionTime(ray, ref maxDist, false, ModelIgnoreFlags.Nothing))
|
||||
if (GetIntersectionTime(ray, ref maxDist, false, ModelIgnoreFlags.Nothing))
|
||||
height = pPos.Z - maxDist;
|
||||
|
||||
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;
|
||||
MapRayCallback intersectionCallBack = new MapRayCallback(iTreeValues, ignoreFlags);
|
||||
iTree.intersectRay(pRay, intersectionCallBack, ref distance, pStopAtFirstHit);
|
||||
if (intersectionCallBack.didHit())
|
||||
iTree.IntersectRay(pRay, intersectionCallBack, ref distance, pStopAtFirstHit);
|
||||
if (intersectionCallBack.DidHit())
|
||||
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;
|
||||
float maxDist = (pPos2 - pPos1).magnitude();
|
||||
@@ -337,7 +337,7 @@ namespace Game.Collision
|
||||
Vector3 dir = (pPos2 - pPos1) / maxDist; // direction with length of 1
|
||||
Ray ray = new Ray(pPos1, dir);
|
||||
float dist = maxDist;
|
||||
if (getIntersectionTime(ray, ref dist, false, ModelIgnoreFlags.Nothing))
|
||||
if (GetIntersectionTime(ray, ref dist, false, ModelIgnoreFlags.Nothing))
|
||||
{
|
||||
pResultHitPos = pPos1 + dir * dist;
|
||||
if (pModifyDist < 0)
|
||||
@@ -365,7 +365,7 @@ namespace Game.Collision
|
||||
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();
|
||||
// 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;
|
||||
// direction with length of 1
|
||||
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 true;
|
||||
}
|
||||
|
||||
public int numLoadedTiles() { return iLoadedTiles.Count; }
|
||||
public int NumLoadedTiles() { return iLoadedTiles.Count; }
|
||||
|
||||
uint iMapID;
|
||||
BIH iTree = new BIH();
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Game.Collision
|
||||
|
||||
public class GameObjectModel : IModel
|
||||
{
|
||||
bool initialize(GameObjectModelOwnerBase modelOwner)
|
||||
bool Initialize(GameObjectModelOwnerBase modelOwner)
|
||||
{
|
||||
var modelData = StaticModelList.models.LookupByKey(modelOwner.GetDisplayId());
|
||||
if (modelData == null)
|
||||
@@ -55,7 +55,7 @@ namespace Game.Collision
|
||||
return false;
|
||||
}
|
||||
|
||||
iModel = Global.VMapMgr.acquireModelInstance(modelData.name);
|
||||
iModel = Global.VMapMgr.AcquireModelInstance(modelData.name);
|
||||
|
||||
if (iModel == null)
|
||||
return false;
|
||||
@@ -82,7 +82,7 @@ namespace Game.Collision
|
||||
public static GameObjectModel Create(GameObjectModelOwnerBase modelOwner)
|
||||
{
|
||||
GameObjectModel mdl = new GameObjectModel();
|
||||
if (!mdl.initialize(modelOwner))
|
||||
if (!mdl.Initialize(modelOwner))
|
||||
return null;
|
||||
|
||||
return mdl;
|
||||
@@ -90,7 +90,7 @@ namespace Game.Collision
|
||||
|
||||
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;
|
||||
|
||||
if (!owner.IsInPhase(phaseShift))
|
||||
@@ -115,7 +115,7 @@ namespace Game.Collision
|
||||
|
||||
public override void IntersectPoint(Vector3 point, AreaInfo info, PhaseShift phaseShift)
|
||||
{
|
||||
if (!isCollisionEnabled() || !owner.IsSpawned() || !isMapObject())
|
||||
if (!IsCollisionEnabled() || !owner.IsSpawned() || !IsMapObject())
|
||||
return;
|
||||
|
||||
if (!owner.IsInPhase(phaseShift))
|
||||
@@ -172,12 +172,12 @@ namespace Game.Collision
|
||||
return true;
|
||||
}
|
||||
|
||||
public override Vector3 getPosition() { return iPos; }
|
||||
public override AxisAlignedBox getBounds() { return iBound; }
|
||||
public override Vector3 GetPosition() { return iPos; }
|
||||
public override AxisAlignedBox GetBounds() { return iBound; }
|
||||
|
||||
public void enableCollision(bool enable) { _collisionEnabled = enable; }
|
||||
bool isCollisionEnabled() { return _collisionEnabled; }
|
||||
public bool isMapObject() { return isWmo; }
|
||||
public void EnableCollision(bool enable) { _collisionEnabled = enable; }
|
||||
bool IsCollisionEnabled() { return _collisionEnabled; }
|
||||
public bool IsMapObject() { return isWmo; }
|
||||
|
||||
public static void LoadGameObjectModelList()
|
||||
{
|
||||
|
||||
@@ -22,8 +22,8 @@ namespace Game.Collision
|
||||
{
|
||||
public class IModel
|
||||
{
|
||||
public virtual Vector3 getPosition() { return default; }
|
||||
public virtual AxisAlignedBox getBounds() { return default; }
|
||||
public virtual Vector3 GetPosition() { 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 distance, bool stopAtFirstHit, ModelIgnoreFlags ignoreFlags) { return false; }
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Game.Collision
|
||||
name = spawn.name;
|
||||
}
|
||||
|
||||
public static bool readFromFile(BinaryReader reader, out ModelSpawn spawn)
|
||||
public static bool ReadFromFile(BinaryReader reader, out ModelSpawn spawn)
|
||||
{
|
||||
spawn = new ModelSpawn();
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace Game.Collision
|
||||
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)
|
||||
return false;
|
||||
@@ -116,7 +116,7 @@ namespace Game.Collision
|
||||
return hit;
|
||||
}
|
||||
|
||||
public void intersectPoint(Vector3 p, AreaInfo info)
|
||||
public void IntersectPoint(Vector3 p, AreaInfo info)
|
||||
{
|
||||
if (iModel == null)
|
||||
return;
|
||||
@@ -192,7 +192,7 @@ namespace Game.Collision
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setUnloaded() { iModel = null; }
|
||||
public void SetUnloaded() { iModel = null; }
|
||||
|
||||
Matrix3 iInvRot;
|
||||
float iInvScale;
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace Game.Collision
|
||||
return true;
|
||||
}
|
||||
|
||||
public static WmoLiquid readFromFile(BinaryReader reader)
|
||||
public static WmoLiquid ReadFromFile(BinaryReader reader)
|
||||
{
|
||||
WmoLiquid liquid = new WmoLiquid();
|
||||
|
||||
@@ -193,13 +193,13 @@ namespace Game.Collision
|
||||
iLiquid = null;
|
||||
}
|
||||
|
||||
void setLiquidData(WmoLiquid liquid)
|
||||
void SetLiquidData(WmoLiquid liquid)
|
||||
{
|
||||
iLiquid = liquid;
|
||||
liquid = null;
|
||||
}
|
||||
|
||||
public bool readFromFile(BinaryReader reader)
|
||||
public bool ReadFromFile(BinaryReader reader)
|
||||
{
|
||||
triangles.Clear();
|
||||
vertices.Clear();
|
||||
@@ -237,7 +237,7 @@ namespace Game.Collision
|
||||
if (reader.ReadStringFromChars(4) != "MBIH")
|
||||
return false;
|
||||
|
||||
meshTree.readFromFile(reader);
|
||||
meshTree.ReadFromFile(reader);
|
||||
|
||||
// write liquid data
|
||||
if (reader.ReadStringFromChars(4) != "LIQU")
|
||||
@@ -245,7 +245,7 @@ namespace Game.Collision
|
||||
|
||||
chunkSize = reader.ReadUInt32();
|
||||
if (chunkSize > 0)
|
||||
iLiquid = WmoLiquid.readFromFile(reader);
|
||||
iLiquid = WmoLiquid.ReadFromFile(reader);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -256,7 +256,7 @@ namespace Game.Collision
|
||||
return false;
|
||||
|
||||
GModelRayCallback callback = new GModelRayCallback(triangles, vertices);
|
||||
meshTree.intersectRay(ray, callback, ref distance, stopAtFirstHit);
|
||||
meshTree.IntersectRay(ray, callback, ref distance, stopAtFirstHit);
|
||||
return callback.hit;
|
||||
}
|
||||
|
||||
@@ -290,7 +290,7 @@ namespace Game.Collision
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override AxisAlignedBox getBounds() { return iBound; }
|
||||
public override AxisAlignedBox GetBounds() { return iBound; }
|
||||
|
||||
public uint GetMogpFlags() { return iMogpFlags; }
|
||||
|
||||
@@ -328,7 +328,7 @@ namespace Game.Collision
|
||||
return groupModels[0].IntersectRay(ray, ref distance, stopAtFirstHit);
|
||||
|
||||
WModelRayCallBack isc = new WModelRayCallBack(groupModels);
|
||||
groupTree.intersectRay(ray, isc, ref distance, stopAtFirstHit);
|
||||
groupTree.IntersectRay(ray, isc, ref distance, stopAtFirstHit);
|
||||
return isc.hit;
|
||||
}
|
||||
|
||||
@@ -339,7 +339,7 @@ namespace Game.Collision
|
||||
return false;
|
||||
|
||||
WModelAreaCallback callback = new WModelAreaCallback(groupModels, down);
|
||||
groupTree.intersectPoint(p, callback);
|
||||
groupTree.IntersectPoint(p, callback);
|
||||
if (callback.hit != null)
|
||||
{
|
||||
info.rootId = (int)RootWMOID;
|
||||
@@ -359,7 +359,7 @@ namespace Game.Collision
|
||||
return false;
|
||||
|
||||
WModelAreaCallback callback = new WModelAreaCallback(groupModels, down);
|
||||
groupTree.intersectPoint(p, callback);
|
||||
groupTree.IntersectPoint(p, callback);
|
||||
if (callback.hit != null)
|
||||
{
|
||||
info.hitModel = callback.hit;
|
||||
@@ -369,7 +369,7 @@ namespace Game.Collision
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool readFile(string filename)
|
||||
public bool ReadFile(string filename)
|
||||
{
|
||||
if (!File.Exists(filename))
|
||||
{
|
||||
@@ -397,7 +397,7 @@ namespace Game.Collision
|
||||
for (var i = 0; i < count; ++i)
|
||||
{
|
||||
GroupModel group = new GroupModel();
|
||||
group.readFromFile(reader);
|
||||
group.ReadFromFile(reader);
|
||||
groupModels.Add(group);
|
||||
}
|
||||
|
||||
@@ -405,7 +405,7 @@ namespace Game.Collision
|
||||
if (reader.ReadStringFromChars(4) != "GBIH")
|
||||
return false;
|
||||
|
||||
return groupTree.readFromFile(reader);
|
||||
return groupTree.ReadFromFile(reader);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,29 +33,29 @@ namespace Game.Collision
|
||||
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 high = Cell.ComputeCell(bounds.Hi.X, bounds.Hi.Y);
|
||||
for (int x = low.x; x <= high.x; ++x)
|
||||
{
|
||||
for (int y = low.y; y <= high.y; ++y)
|
||||
{
|
||||
Node node = getGrid(x, y);
|
||||
node.insert(value);
|
||||
Node node = GetGrid(x, y);
|
||||
node.Insert(value);
|
||||
memberTable.Add(value, node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void remove(T value)
|
||||
public virtual void Remove(T value)
|
||||
{
|
||||
// Remove the member
|
||||
memberTable.Remove(value);
|
||||
}
|
||||
|
||||
public virtual void balance()
|
||||
public virtual void Balance()
|
||||
{
|
||||
for (int x = 0; x < CELL_NUMBER; ++x)
|
||||
{
|
||||
@@ -63,13 +63,13 @@ namespace Game.Collision
|
||||
{
|
||||
Node n = nodes[x][y];
|
||||
if (n != null)
|
||||
n.balance();
|
||||
n.Balance();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool contains(T value) { return memberTable.ContainsKey(value); }
|
||||
public bool empty() { return memberTable.Empty(); }
|
||||
public bool Contains(T value) { return memberTable.ContainsKey(value); }
|
||||
public bool Empty() { return memberTable.Empty(); }
|
||||
|
||||
public struct Cell
|
||||
{
|
||||
@@ -95,10 +95,10 @@ namespace Game.Collision
|
||||
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);
|
||||
if (nodes[x][y] == null)
|
||||
@@ -106,15 +106,15 @@ namespace Game.Collision
|
||||
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);
|
||||
if (!cell.isValid())
|
||||
if (!cell.IsValid())
|
||||
return;
|
||||
|
||||
Cell last_cell = Cell.ComputeCell(end.X, end.Y);
|
||||
@@ -123,7 +123,7 @@ namespace Game.Collision
|
||||
{
|
||||
Node node = nodes[cell.x][cell.y];
|
||||
if (node != null)
|
||||
node.intersectRay(ray, intersectCallback, ref max_dist);
|
||||
node.IntersectRay(ray, intersectCallback, ref max_dist);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ namespace Game.Collision
|
||||
Node node = nodes[cell.x][cell.y];
|
||||
if (node != null)
|
||||
{
|
||||
node.intersectRay(ray, intersectCallback, ref max_dist);
|
||||
node.IntersectRay(ray, intersectCallback, ref max_dist);
|
||||
}
|
||||
if (cell == last_cell)
|
||||
break;
|
||||
@@ -180,30 +180,30 @@ namespace Game.Collision
|
||||
tMaxY += tDeltaY;
|
||||
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);
|
||||
if (!cell.isValid())
|
||||
if (!cell.IsValid())
|
||||
return;
|
||||
|
||||
Node node = nodes[cell.x][cell.y];
|
||||
if (node != null)
|
||||
node.intersectPoint(point, intersectCallback);
|
||||
node.IntersectPoint(point, intersectCallback);
|
||||
}
|
||||
|
||||
// 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);
|
||||
if (!cell.isValid())
|
||||
if (!cell.IsValid())
|
||||
return;
|
||||
|
||||
Node node = nodes[cell.x][cell.y];
|
||||
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>();
|
||||
|
||||
@@ -25,16 +25,16 @@ namespace Game.Combat
|
||||
{
|
||||
iType = pType;
|
||||
}
|
||||
public UnitEventTypes getType()
|
||||
public UnitEventTypes GetEventType()
|
||||
{
|
||||
return iType;
|
||||
}
|
||||
bool matchesTypeMask(uint pMask)
|
||||
bool MatchesTypeMask(uint pMask)
|
||||
{
|
||||
return Convert.ToBoolean((uint)iType & pMask);
|
||||
}
|
||||
|
||||
void setType(UnitEventTypes pType)
|
||||
void SetEventType(UnitEventTypes pType)
|
||||
{
|
||||
iType = pType;
|
||||
}
|
||||
@@ -67,32 +67,32 @@ namespace Game.Combat
|
||||
iBValue = pValue;
|
||||
}
|
||||
|
||||
public float getFValue()
|
||||
public float GetFValue()
|
||||
{
|
||||
return iFValue;
|
||||
}
|
||||
|
||||
bool getBValue()
|
||||
bool GetBValue()
|
||||
{
|
||||
return iBValue;
|
||||
}
|
||||
|
||||
void setBValue(bool pValue)
|
||||
void SetBValue(bool pValue)
|
||||
{
|
||||
iBValue = pValue;
|
||||
}
|
||||
|
||||
public HostileReference getReference()
|
||||
public HostileReference GetReference()
|
||||
{
|
||||
return iHostileReference;
|
||||
}
|
||||
|
||||
public void setThreatManager(ThreatManager pThreatManager)
|
||||
public void SetThreatManager(ThreatManager pThreatManager)
|
||||
{
|
||||
iThreatManager = pThreatManager;
|
||||
}
|
||||
|
||||
ThreatManager getThreatManager()
|
||||
ThreatManager GetThreatManager()
|
||||
{
|
||||
return iThreatManager;
|
||||
}
|
||||
|
||||
@@ -31,130 +31,130 @@ namespace Game.Combat
|
||||
Owner = owner;
|
||||
}
|
||||
|
||||
Unit getOwner() { return Owner; }
|
||||
Unit GetOwner() { return Owner; }
|
||||
|
||||
// send threat to all my haters for the victim
|
||||
// The victim is then hated by them as well
|
||||
// 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();
|
||||
|
||||
HostileReference refe = getFirst();
|
||||
HostileReference refe = GetFirst();
|
||||
while (refe != null)
|
||||
{
|
||||
if (ThreatManager.isValidProcess(victim, refe.GetSource().GetOwner(), threatSpell))
|
||||
refe.GetSource().doAddThreat(victim, threat);
|
||||
if (ThreatManager.IsValidProcess(victim, refe.GetSource().GetOwner(), threatSpell))
|
||||
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)
|
||||
{
|
||||
if (apply)
|
||||
{
|
||||
if (refe.getTempThreatModifier() == 0.0f)
|
||||
refe.addTempThreat(threat);
|
||||
if (refe.GetTempThreatModifier() == 0.0f)
|
||||
refe.AddTempThreat(threat);
|
||||
}
|
||||
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)
|
||||
{
|
||||
refe.addThreatPercent(percent);
|
||||
refe = refe.next();
|
||||
refe.AddThreatPercent(percent);
|
||||
refe = refe.Next();
|
||||
}
|
||||
}
|
||||
|
||||
// The references are not needed anymore
|
||||
// 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)
|
||||
{
|
||||
HostileReference nextRef = refe.next();
|
||||
refe.removeReference();
|
||||
HostileReference nextRef = refe.Next();
|
||||
refe.RemoveReference();
|
||||
refe = nextRef;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove specific faction references
|
||||
public void deleteReferencesForFaction(uint faction)
|
||||
public void DeleteReferencesForFaction(uint faction)
|
||||
{
|
||||
HostileReference refe = getFirst();
|
||||
HostileReference refe = GetFirst();
|
||||
while (refe != null)
|
||||
{
|
||||
HostileReference nextRef = refe.next();
|
||||
HostileReference nextRef = refe.Next();
|
||||
if (refe.GetSource().GetOwner().GetFactionTemplateEntry().Faction == faction)
|
||||
{
|
||||
refe.removeReference();
|
||||
refe.RemoveReference();
|
||||
}
|
||||
refe = nextRef;
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
while (refe != null)
|
||||
{
|
||||
HostileReference nextRef = refe.next();
|
||||
HostileReference nextRef = refe.Next();
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
refe.updateOnlineStatus();
|
||||
refe = refe.next();
|
||||
refe.UpdateOnlineStatus();
|
||||
refe = refe.Next();
|
||||
}
|
||||
}
|
||||
|
||||
public void setOnlineOfflineState(bool isOnline)
|
||||
public void SetOnlineOfflineState(bool isOnline)
|
||||
{
|
||||
HostileReference refe = getFirst();
|
||||
HostileReference refe = GetFirst();
|
||||
while (refe != null)
|
||||
{
|
||||
refe.setOnlineOfflineState(isOnline);
|
||||
refe = refe.next();
|
||||
refe.SetOnlineOfflineState(isOnline);
|
||||
refe = refe.Next();
|
||||
}
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
HostileReference nextRef = refe.next();
|
||||
HostileReference nextRef = refe.Next();
|
||||
if (refe.GetSource().GetOwner() == creature)
|
||||
{
|
||||
refe.setOnlineOfflineState(isOnline);
|
||||
refe.SetOnlineOfflineState(isOnline);
|
||||
break;
|
||||
}
|
||||
refe = nextRef;
|
||||
@@ -162,15 +162,15 @@ namespace Game.Combat
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
HostileReference nextRef = refe.next();
|
||||
HostileReference nextRef = refe.Next();
|
||||
if (refe.GetSource().GetOwner() == creature)
|
||||
{
|
||||
refe.removeReference();
|
||||
refe.RemoveReference();
|
||||
break;
|
||||
}
|
||||
refe = nextRef;
|
||||
@@ -179,14 +179,14 @@ namespace Game.Combat
|
||||
|
||||
public void UpdateVisibility()
|
||||
{
|
||||
HostileReference refe = getFirst();
|
||||
HostileReference refe = GetFirst();
|
||||
while (refe != null)
|
||||
{
|
||||
HostileReference nextRef = refe.next();
|
||||
if (!refe.GetSource().GetOwner().CanSeeOrDetect(getOwner()))
|
||||
HostileReference nextRef = refe.Next();
|
||||
if (!refe.GetSource().GetOwner().CanSeeOrDetect(GetOwner()))
|
||||
{
|
||||
nextRef = refe.next();
|
||||
refe.removeReference();
|
||||
nextRef = refe.Next();
|
||||
refe.RemoveReference();
|
||||
}
|
||||
refe = nextRef;
|
||||
}
|
||||
@@ -199,32 +199,32 @@ namespace Game.Combat
|
||||
{
|
||||
iThreat = threat;
|
||||
iTempThreatModifier = 0.0f;
|
||||
link(refUnit, threatManager);
|
||||
Link(refUnit, threatManager);
|
||||
iUnitGuid = refUnit.GetGUID();
|
||||
iOnline = 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)
|
||||
GetSource().processThreatEvent(threatRefStatusChangeEvent);
|
||||
GetSource().ProcessThreatEvent(threatRefStatusChangeEvent);
|
||||
}
|
||||
|
||||
public void addThreat(float modThreat)
|
||||
public void AddThreat(float modThreat)
|
||||
{
|
||||
if (modThreat == 0.0f)
|
||||
return;
|
||||
@@ -233,131 +233,131 @@ namespace Game.Combat
|
||||
|
||||
// the threat is changed. Source and target unit have to be available
|
||||
// if the link was cut before relink it again
|
||||
if (!isOnline())
|
||||
updateOnlineStatus();
|
||||
if (!IsOnline())
|
||||
UpdateOnlineStatus();
|
||||
|
||||
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())
|
||||
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
|
||||
public void updateOnlineStatus()
|
||||
public void UpdateOnlineStatus()
|
||||
{
|
||||
bool online = 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)
|
||||
link(target, GetSource());
|
||||
Link(target, GetSource());
|
||||
}
|
||||
|
||||
// only check for online status if
|
||||
// ref is valid
|
||||
// target is no player or not gamemaster
|
||||
// target is not in flight
|
||||
if (isValid()
|
||||
&& (getTarget().IsTypeId(TypeId.Player) || !getTarget().ToPlayer().IsGameMaster())
|
||||
&& !getTarget().HasUnitState(UnitState.InFlight)
|
||||
&& getTarget().IsInMap(getSourceUnit())
|
||||
&& getTarget().IsInPhase(getSourceUnit())
|
||||
if (IsValid()
|
||||
&& (GetTarget().IsTypeId(TypeId.Player) || !GetTarget().ToPlayer().IsGameMaster())
|
||||
&& !GetTarget().HasUnitState(UnitState.InFlight)
|
||||
&& GetTarget().IsInMap(GetSourceUnit())
|
||||
&& GetTarget().IsInPhase(GetSourceUnit())
|
||||
)
|
||||
{
|
||||
Creature creature = getSourceUnit().ToCreature();
|
||||
online = getTarget().IsInAccessiblePlaceFor(creature);
|
||||
Creature creature = GetSourceUnit().ToCreature();
|
||||
online = GetTarget().IsInAccessiblePlaceFor(creature);
|
||||
if (!online)
|
||||
{
|
||||
if (creature.IsWithinCombatRange(getTarget(), creature.m_CombatDistance))
|
||||
if (creature.IsWithinCombatRange(GetTarget(), creature.m_CombatDistance))
|
||||
online = true; // not accessible but stays online
|
||||
}
|
||||
else
|
||||
accessible = true;
|
||||
}
|
||||
setAccessibleState(accessible);
|
||||
setOnlineOfflineState(online);
|
||||
SetAccessibleState(accessible);
|
||||
SetOnlineOfflineState(online);
|
||||
}
|
||||
|
||||
public void setOnlineOfflineState(bool isOnline)
|
||||
public void SetOnlineOfflineState(bool isOnline)
|
||||
{
|
||||
if (iOnline != isOnline)
|
||||
{
|
||||
iOnline = isOnline;
|
||||
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);
|
||||
fireStatusChanged(Event);
|
||||
FireStatusChanged(Event);
|
||||
}
|
||||
}
|
||||
|
||||
void setAccessibleState(bool isAccessible)
|
||||
void SetAccessibleState(bool isAccessible)
|
||||
{
|
||||
if (iAccessible != isAccessible)
|
||||
{
|
||||
iAccessible = isAccessible;
|
||||
|
||||
ThreatRefStatusChangeEvent Event = new ThreatRefStatusChangeEvent(UnitEventTypes.ThreatRefAccessibleStatus, this);
|
||||
fireStatusChanged(Event);
|
||||
FireStatusChanged(Event);
|
||||
}
|
||||
}
|
||||
|
||||
// reference is not needed anymore. realy delete it !
|
||||
public void removeReference()
|
||||
public void RemoveReference()
|
||||
{
|
||||
invalidate();
|
||||
Invalidate();
|
||||
|
||||
ThreatRefStatusChangeEvent Event = new ThreatRefStatusChangeEvent(UnitEventTypes.ThreatRefRemoveFromList, this);
|
||||
fireStatusChanged(Event);
|
||||
FireStatusChanged(Event);
|
||||
}
|
||||
|
||||
Unit getSourceUnit()
|
||||
Unit GetSourceUnit()
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
public bool isOnline()
|
||||
public bool IsOnline()
|
||||
{
|
||||
return iOnline;
|
||||
}
|
||||
|
||||
// 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
|
||||
bool isAccessible()
|
||||
bool IsAccessible()
|
||||
{
|
||||
return iAccessible;
|
||||
}
|
||||
|
||||
// used for temporary setting a threat and reducing it later again.
|
||||
// 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)
|
||||
return;
|
||||
@@ -365,25 +365,25 @@ namespace Game.Combat
|
||||
iTempThreatModifier += 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;
|
||||
}
|
||||
|
||||
public ObjectGuid getUnitGuid()
|
||||
public ObjectGuid GetUnitGuid()
|
||||
{
|
||||
return iUnitGuid;
|
||||
}
|
||||
|
||||
public new HostileReference next() { return (HostileReference)base.next(); }
|
||||
public new HostileReference Next() { return (HostileReference)base.Next(); }
|
||||
|
||||
float iThreat;
|
||||
float iTempThreatModifier; // used for SPELL_AURA_MOD_TOTAL_THREAT
|
||||
|
||||
+103
-103
@@ -36,23 +36,23 @@ namespace Game.Combat
|
||||
|
||||
const int ThreatUpdateInternal = 1 * Time.InMilliseconds;
|
||||
|
||||
public void clearReferences()
|
||||
public void ClearReferences()
|
||||
{
|
||||
threatContainer.clearReferences();
|
||||
threatOfflineContainer.clearReferences();
|
||||
threatContainer.ClearReferences();
|
||||
threatOfflineContainer.ClearReferences();
|
||||
currentVictim = null;
|
||||
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;
|
||||
|
||||
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();
|
||||
Unit redirectTarget = victim.GetRedirectThreatTarget();
|
||||
@@ -81,78 +81,78 @@ namespace Game.Combat
|
||||
{
|
||||
float redirectThreat = MathFunctions.CalculatePct(threat, redirectThreadPct);
|
||||
threat -= redirectThreat;
|
||||
if (isValidProcess(redirectTarget, GetOwner()))
|
||||
_addThreat(redirectTarget, redirectThreat);
|
||||
if (IsValidProcess(redirectTarget, GetOwner()))
|
||||
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
|
||||
if (reff == null)
|
||||
reff = threatOfflineContainer.addThreat(victim, threat);
|
||||
reff = threatOfflineContainer.AddThreat(victim, threat);
|
||||
|
||||
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
|
||||
var hostileRef = new HostileReference(victim, this, 0);
|
||||
threatContainer.addReference(hostileRef);
|
||||
hostileRef.addThreat(threat); // now we add the real threat
|
||||
threatContainer.AddReference(hostileRef);
|
||||
hostileRef.AddThreat(threat); // now we add the real threat
|
||||
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)
|
||||
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();
|
||||
HostileReference nextVictim = threatContainer.selectNextVictim(GetOwner().ToCreature(), getCurrentVictim());
|
||||
setCurrentVictim(nextVictim);
|
||||
return getCurrentVictim() != null ? getCurrentVictim().getTarget() : null;
|
||||
threatContainer.Update();
|
||||
HostileReference nextVictim = threatContainer.SelectNextVictim(GetOwner().ToCreature(), GetCurrentVictim());
|
||||
SetCurrentVictim(nextVictim);
|
||||
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;
|
||||
HostileReference refe = threatContainer.getReferenceByTarget(victim);
|
||||
HostileReference refe = threatContainer.GetReferenceByTarget(victim);
|
||||
if (refe == null && alsoSearchOfflineList)
|
||||
refe = threatOfflineContainer.getReferenceByTarget(victim);
|
||||
refe = threatOfflineContainer.GetReferenceByTarget(victim);
|
||||
if (refe != null)
|
||||
threat = refe.getThreat();
|
||||
threat = refe.GetThreat();
|
||||
return threat;
|
||||
}
|
||||
|
||||
void tauntApply(Unit taunter)
|
||||
void TauntApply(Unit taunter)
|
||||
{
|
||||
HostileReference refe = threatContainer.getReferenceByTarget(taunter);
|
||||
if (getCurrentVictim() != null && refe != null && (refe.getThreat() < getCurrentVictim().getThreat()))
|
||||
HostileReference refe = threatContainer.GetReferenceByTarget(taunter);
|
||||
if (GetCurrentVictim() != null && refe != null && (refe.GetThreat() < GetCurrentVictim().GetThreat()))
|
||||
{
|
||||
if (refe.getTempThreatModifier() == 0.0f) // Ok, temp threat is unused
|
||||
refe.setTempThreat(getCurrentVictim().getThreat());
|
||||
if (refe.GetTempThreatModifier() == 0.0f) // Ok, temp threat is unused
|
||||
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)
|
||||
refe.resetTempThreat();
|
||||
refe.ResetTempThreat();
|
||||
}
|
||||
|
||||
public void setCurrentVictim(HostileReference pHostileReference)
|
||||
public void SetCurrentVictim(HostileReference pHostileReference)
|
||||
{
|
||||
if (pHostileReference != null && pHostileReference != currentVictim)
|
||||
{
|
||||
@@ -161,58 +161,58 @@ namespace Game.Combat
|
||||
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:
|
||||
if ((getCurrentVictim() == hostilRef && threatRefStatusChangeEvent.getFValue() < 0.0f) ||
|
||||
(getCurrentVictim() != hostilRef && threatRefStatusChangeEvent.getFValue() > 0.0f))
|
||||
setDirty(true); // the order in the threat list might have changed
|
||||
if ((GetCurrentVictim() == hostilRef && threatRefStatusChangeEvent.GetFValue() < 0.0f) ||
|
||||
(GetCurrentVictim() != hostilRef && threatRefStatusChangeEvent.GetFValue() > 0.0f))
|
||||
SetDirty(true); // the order in the threat list might have changed
|
||||
break;
|
||||
case UnitEventTypes.ThreatRefOnlineStatus:
|
||||
if (!hostilRef.isOnline())
|
||||
if (!hostilRef.IsOnline())
|
||||
{
|
||||
if (hostilRef == getCurrentVictim())
|
||||
if (hostilRef == GetCurrentVictim())
|
||||
{
|
||||
setCurrentVictim(null);
|
||||
setDirty(true);
|
||||
SetCurrentVictim(null);
|
||||
SetDirty(true);
|
||||
}
|
||||
Owner.SendRemoveFromThreatList(hostilRef);
|
||||
threatContainer.remove(hostilRef);
|
||||
threatOfflineContainer.addReference(hostilRef);
|
||||
threatContainer.Remove(hostilRef);
|
||||
threatOfflineContainer.AddReference(hostilRef);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (getCurrentVictim() != null && hostilRef.getThreat() > (1.1f * getCurrentVictim().getThreat()))
|
||||
setDirty(true);
|
||||
threatContainer.addReference(hostilRef);
|
||||
threatOfflineContainer.remove(hostilRef);
|
||||
if (GetCurrentVictim() != null && hostilRef.GetThreat() > (1.1f * GetCurrentVictim().GetThreat()))
|
||||
SetDirty(true);
|
||||
threatContainer.AddReference(hostilRef);
|
||||
threatOfflineContainer.Remove(hostilRef);
|
||||
}
|
||||
break;
|
||||
case UnitEventTypes.ThreatRefRemoveFromList:
|
||||
if (hostilRef == getCurrentVictim())
|
||||
if (hostilRef == GetCurrentVictim())
|
||||
{
|
||||
setCurrentVictim(null);
|
||||
setDirty(true);
|
||||
SetCurrentVictim(null);
|
||||
SetDirty(true);
|
||||
}
|
||||
Owner.SendRemoveFromThreatList(hostilRef);
|
||||
if (hostilRef.isOnline())
|
||||
threatContainer.remove(hostilRef);
|
||||
if (hostilRef.IsOnline())
|
||||
threatContainer.Remove(hostilRef);
|
||||
else
|
||||
threatOfflineContainer.remove(hostilRef);
|
||||
threatOfflineContainer.Remove(hostilRef);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool isNeedUpdateToClient(uint time)
|
||||
public bool IsNeedUpdateToClient(uint time)
|
||||
{
|
||||
if (isThreatListEmpty())
|
||||
if (IsThreatListEmpty())
|
||||
return false;
|
||||
|
||||
if (time >= updateTimer)
|
||||
@@ -225,27 +225,27 @@ namespace Game.Combat
|
||||
}
|
||||
|
||||
// Reset all aggro without modifying the threatlist.
|
||||
void resetAllAggro()
|
||||
void ResetAllAggro()
|
||||
{
|
||||
var threatList = threatContainer.threatList;
|
||||
if (threatList.Empty())
|
||||
return;
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -255,17 +255,17 @@ namespace Game.Combat
|
||||
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> getOfflineThreatList() { return threatOfflineContainer.getThreatList(); }
|
||||
public ThreatContainer getOnlineContainer() { return threatContainer; }
|
||||
public List<HostileReference> GetThreatList() { return threatContainer.GetThreatList(); }
|
||||
public List<HostileReference> GetOfflineThreatList() { return threatOfflineContainer.GetThreatList(); }
|
||||
public ThreatContainer GetOnlineContainer() { return threatContainer; }
|
||||
|
||||
// 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)
|
||||
{
|
||||
@@ -287,7 +287,7 @@ namespace Game.Combat
|
||||
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
|
||||
//mobs, NPCs, guards have ThreatList and HateOfflineList
|
||||
@@ -337,17 +337,17 @@ namespace Game.Combat
|
||||
iDirty = false;
|
||||
}
|
||||
|
||||
public void clearReferences()
|
||||
public void ClearReferences()
|
||||
{
|
||||
foreach (var reff in threatList)
|
||||
{
|
||||
reff.unlink();
|
||||
reff.Unlink();
|
||||
}
|
||||
|
||||
threatList.Clear();
|
||||
}
|
||||
|
||||
public HostileReference getReferenceByTarget(Unit victim)
|
||||
public HostileReference GetReferenceByTarget(Unit victim)
|
||||
{
|
||||
if (victim == null)
|
||||
return null;
|
||||
@@ -355,37 +355,37 @@ namespace Game.Combat
|
||||
ObjectGuid guid = victim.GetGUID();
|
||||
foreach (var reff in threatList)
|
||||
{
|
||||
if (reff != null && reff.getUnitGuid() == guid)
|
||||
if (reff != null && reff.GetUnitGuid() == guid)
|
||||
return reff;
|
||||
}
|
||||
|
||||
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)
|
||||
reff.addThreat(threat);
|
||||
reff.AddThreat(threat);
|
||||
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)
|
||||
refe.addThreatPercent(percent);
|
||||
refe.AddThreatPercent(percent);
|
||||
}
|
||||
|
||||
public void update()
|
||||
public void Update()
|
||||
{
|
||||
if (iDirty && threatList.Count > 1)
|
||||
threatList = threatList.OrderByDescending(p => p.getThreat()).ToList();
|
||||
threatList = threatList.OrderByDescending(p => p.GetThreat()).ToList();
|
||||
|
||||
iDirty = false;
|
||||
}
|
||||
|
||||
public HostileReference selectNextVictim(Creature attacker, HostileReference currentVictim)
|
||||
public HostileReference SelectNextVictim(Creature attacker, HostileReference currentVictim)
|
||||
{
|
||||
HostileReference currentRef = null;
|
||||
bool found = false;
|
||||
@@ -398,7 +398,7 @@ namespace Game.Combat
|
||||
|
||||
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 !
|
||||
|
||||
// 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
|
||||
{
|
||||
// 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
|
||||
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (currentRef.getThreat() > 1.3f * currentVictim.getThreat() ||
|
||||
(currentRef.getThreat() > 1.1f * currentVictim.getThreat() &&
|
||||
if (currentRef.GetThreat() > 1.3f * currentVictim.GetThreat() ||
|
||||
(currentRef.GetThreat() > 1.1f * currentVictim.GetThreat() &&
|
||||
attacker.IsWithinMeleeRange(target)))
|
||||
{ //implement 110% threat rule for targets in melee range
|
||||
found = true; //and 130% rule for targets in ranged distances
|
||||
@@ -455,35 +455,35 @@ namespace Game.Combat
|
||||
return currentRef;
|
||||
}
|
||||
|
||||
public void setDirty(bool isDirty)
|
||||
public void SetDirty(bool isDirty)
|
||||
{
|
||||
iDirty = isDirty;
|
||||
}
|
||||
|
||||
bool isDirty()
|
||||
bool IsDirty()
|
||||
{
|
||||
return iDirty;
|
||||
}
|
||||
|
||||
public bool empty()
|
||||
public bool Empty()
|
||||
{
|
||||
return threatList.Empty();
|
||||
}
|
||||
public HostileReference getMostHated()
|
||||
public HostileReference GetMostHated()
|
||||
{
|
||||
return threatList.Count == 0 ? null : threatList[0];
|
||||
}
|
||||
|
||||
public void remove(HostileReference hostileRef)
|
||||
public void Remove(HostileReference hostileRef)
|
||||
{
|
||||
threatList.Remove(hostileRef);
|
||||
}
|
||||
public void addReference(HostileReference hostileRef)
|
||||
public void AddReference(HostileReference hostileRef)
|
||||
{
|
||||
threatList.Add(hostileRef);
|
||||
}
|
||||
|
||||
public List<HostileReference> getThreatList() { return threatList; }
|
||||
public List<HostileReference> GetThreatList() { return threatList; }
|
||||
|
||||
public List<HostileReference> threatList { get; set; }
|
||||
bool iDirty;
|
||||
|
||||
@@ -267,7 +267,7 @@ namespace Game.Conditions
|
||||
condMeets = MathFunctions.CompareValues((ComparisionType)ConditionValue2, unit.GetHealthPct(), ConditionValue1);
|
||||
break;
|
||||
case ConditionTypes.WorldState:
|
||||
condMeets = (ConditionValue2 == Global.WorldMgr.getWorldState((WorldStates)ConditionValue1));
|
||||
condMeets = (ConditionValue2 == Global.WorldMgr.GetWorldState((WorldStates)ConditionValue1));
|
||||
break;
|
||||
case ConditionTypes.PhaseId:
|
||||
condMeets = obj.GetPhaseShift().HasPhase(ConditionValue1);
|
||||
@@ -493,7 +493,7 @@ namespace Game.Conditions
|
||||
return mask;
|
||||
}
|
||||
|
||||
public bool isLoaded()
|
||||
public bool IsLoaded()
|
||||
{
|
||||
return ConditionType > ConditionTypes.None || ReferenceId != 0;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Game
|
||||
foreach (var i in conditions)
|
||||
{
|
||||
// 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
|
||||
if (!elseGroupSearcherTypeMasks.ContainsKey(i.ElseGroup))
|
||||
elseGroupSearcherTypeMasks[i.ElseGroup] = GridMapTypeMask.All;
|
||||
@@ -79,7 +79,7 @@ namespace Game
|
||||
foreach (var condition in conditions)
|
||||
{
|
||||
Log.outDebug(LogFilter.Condition, "ConditionMgr.IsPlayerMeetToConditionList condType: {0} val1: {1}", condition.ConditionType, condition.ConditionValue1);
|
||||
if (condition.isLoaded())
|
||||
if (condition.IsLoaded())
|
||||
{
|
||||
//! Find ElseGroup in ElseGroupStore
|
||||
//! 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)
|
||||
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;
|
||||
|
||||
if (iSourceTypeOrReferenceId < 0)//it is a reference template
|
||||
@@ -382,7 +382,7 @@ namespace Game
|
||||
}//end of reference templates
|
||||
|
||||
//if not a reference and SourceType is invalid, skip
|
||||
if (iConditionTypeOrReference >= 0 && !isSourceTypeValid(cond))
|
||||
if (iConditionTypeOrReference >= 0 && !IsSourceTypeValid(cond))
|
||||
continue;
|
||||
|
||||
//Grouping is only allowed for some types (loot templates, gossip menus, gossip items)
|
||||
@@ -416,46 +416,46 @@ namespace Game
|
||||
switch (cond.SourceType)
|
||||
{
|
||||
case ConditionSourceType.CreatureLootTemplate:
|
||||
valid = addToLootTemplate(cond, LootStorage.Creature.GetLootForConditionFill(cond.SourceGroup));
|
||||
valid = AddToLootTemplate(cond, LootStorage.Creature.GetLootForConditionFill(cond.SourceGroup));
|
||||
break;
|
||||
case ConditionSourceType.DisenchantLootTemplate:
|
||||
valid = addToLootTemplate(cond, LootStorage.Disenchant.GetLootForConditionFill(cond.SourceGroup));
|
||||
valid = AddToLootTemplate(cond, LootStorage.Disenchant.GetLootForConditionFill(cond.SourceGroup));
|
||||
break;
|
||||
case ConditionSourceType.FishingLootTemplate:
|
||||
valid = addToLootTemplate(cond, LootStorage.Fishing.GetLootForConditionFill(cond.SourceGroup));
|
||||
valid = AddToLootTemplate(cond, LootStorage.Fishing.GetLootForConditionFill(cond.SourceGroup));
|
||||
break;
|
||||
case ConditionSourceType.GameobjectLootTemplate:
|
||||
valid = addToLootTemplate(cond, LootStorage.Gameobject.GetLootForConditionFill(cond.SourceGroup));
|
||||
valid = AddToLootTemplate(cond, LootStorage.Gameobject.GetLootForConditionFill(cond.SourceGroup));
|
||||
break;
|
||||
case ConditionSourceType.ItemLootTemplate:
|
||||
valid = addToLootTemplate(cond, LootStorage.Items.GetLootForConditionFill(cond.SourceGroup));
|
||||
valid = AddToLootTemplate(cond, LootStorage.Items.GetLootForConditionFill(cond.SourceGroup));
|
||||
break;
|
||||
case ConditionSourceType.MailLootTemplate:
|
||||
valid = addToLootTemplate(cond, LootStorage.Mail.GetLootForConditionFill(cond.SourceGroup));
|
||||
valid = AddToLootTemplate(cond, LootStorage.Mail.GetLootForConditionFill(cond.SourceGroup));
|
||||
break;
|
||||
case ConditionSourceType.MillingLootTemplate:
|
||||
valid = addToLootTemplate(cond, LootStorage.Milling.GetLootForConditionFill(cond.SourceGroup));
|
||||
valid = AddToLootTemplate(cond, LootStorage.Milling.GetLootForConditionFill(cond.SourceGroup));
|
||||
break;
|
||||
case ConditionSourceType.PickpocketingLootTemplate:
|
||||
valid = addToLootTemplate(cond, LootStorage.Pickpocketing.GetLootForConditionFill(cond.SourceGroup));
|
||||
valid = AddToLootTemplate(cond, LootStorage.Pickpocketing.GetLootForConditionFill(cond.SourceGroup));
|
||||
break;
|
||||
case ConditionSourceType.ProspectingLootTemplate:
|
||||
valid = addToLootTemplate(cond, LootStorage.Prospecting.GetLootForConditionFill(cond.SourceGroup));
|
||||
valid = AddToLootTemplate(cond, LootStorage.Prospecting.GetLootForConditionFill(cond.SourceGroup));
|
||||
break;
|
||||
case ConditionSourceType.ReferenceLootTemplate:
|
||||
valid = addToLootTemplate(cond, LootStorage.Reference.GetLootForConditionFill(cond.SourceGroup));
|
||||
valid = AddToLootTemplate(cond, LootStorage.Reference.GetLootForConditionFill(cond.SourceGroup));
|
||||
break;
|
||||
case ConditionSourceType.SkinningLootTemplate:
|
||||
valid = addToLootTemplate(cond, LootStorage.Skinning.GetLootForConditionFill(cond.SourceGroup));
|
||||
valid = AddToLootTemplate(cond, LootStorage.Skinning.GetLootForConditionFill(cond.SourceGroup));
|
||||
break;
|
||||
case ConditionSourceType.SpellLootTemplate:
|
||||
valid = addToLootTemplate(cond, LootStorage.Spell.GetLootForConditionFill(cond.SourceGroup));
|
||||
valid = AddToLootTemplate(cond, LootStorage.Spell.GetLootForConditionFill(cond.SourceGroup));
|
||||
break;
|
||||
case ConditionSourceType.GossipMenu:
|
||||
valid = addToGossipMenus(cond);
|
||||
valid = AddToGossipMenus(cond);
|
||||
break;
|
||||
case ConditionSourceType.GossipMenuOption:
|
||||
valid = addToGossipMenuItems(cond);
|
||||
valid = AddToGossipMenuItems(cond);
|
||||
break;
|
||||
case ConditionSourceType.SpellClickEvent:
|
||||
{
|
||||
@@ -468,7 +468,7 @@ namespace Game
|
||||
continue; // do not add to m_AllocatedMemory to avoid double deleting
|
||||
}
|
||||
case ConditionSourceType.SpellImplicitTarget:
|
||||
valid = addToSpellImplicitTargetConditions(cond);
|
||||
valid = AddToSpellImplicitTargetConditions(cond);
|
||||
break;
|
||||
case ConditionSourceType.VehicleSpell:
|
||||
{
|
||||
@@ -503,7 +503,7 @@ namespace Game
|
||||
continue;
|
||||
}
|
||||
case ConditionSourceType.Phase:
|
||||
valid = addToPhases(cond);
|
||||
valid = AddToPhases(cond);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -526,7 +526,7 @@ namespace Game
|
||||
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)
|
||||
{
|
||||
@@ -534,14 +534,14 @@ namespace Game
|
||||
return false;
|
||||
}
|
||||
|
||||
if (loot.addConditionItem(cond))
|
||||
if (loot.AddConditionItem(cond))
|
||||
return true;
|
||||
|
||||
Log.outError(LogFilter.Sql, "{0} Item {1} not found in LootTemplate {2}.", cond.ToString(), cond.SourceEntry, cond.SourceGroup);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool addToGossipMenus(Condition cond)
|
||||
bool AddToGossipMenus(Condition cond)
|
||||
{
|
||||
var pMenuBounds = Global.ObjectMgr.GetGossipMenusMapBounds(cond.SourceGroup);
|
||||
|
||||
@@ -558,7 +558,7 @@ namespace Game
|
||||
return false;
|
||||
}
|
||||
|
||||
bool addToGossipMenuItems(Condition cond)
|
||||
bool AddToGossipMenuItems(Condition cond)
|
||||
{
|
||||
var pMenuItemBounds = Global.ObjectMgr.GetGossipMenuItemsMapBounds(cond.SourceGroup);
|
||||
foreach (var menuItems in pMenuItemBounds)
|
||||
@@ -574,7 +574,7 @@ namespace Game
|
||||
return false;
|
||||
}
|
||||
|
||||
bool addToSpellImplicitTargetConditions(Condition cond)
|
||||
bool AddToSpellImplicitTargetConditions(Condition cond)
|
||||
{
|
||||
uint conditionEffMask = cond.SourceGroup;
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo((uint)cond.SourceEntry);
|
||||
@@ -674,7 +674,7 @@ namespace Game
|
||||
return true;
|
||||
}
|
||||
|
||||
bool addToPhases(Condition cond)
|
||||
bool AddToPhases(Condition cond)
|
||||
{
|
||||
if (cond.SourceEntry == 0)
|
||||
{
|
||||
@@ -719,7 +719,7 @@ namespace Game
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isSourceTypeValid(Condition cond)
|
||||
bool IsSourceTypeValid(Condition cond)
|
||||
{
|
||||
switch (cond.SourceType)
|
||||
{
|
||||
@@ -733,7 +733,7 @@ namespace Game
|
||||
|
||||
LootTemplate loot = LootStorage.Creature.GetLootForConditionFill(cond.SourceGroup);
|
||||
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());
|
||||
return false;
|
||||
@@ -750,7 +750,7 @@ namespace Game
|
||||
|
||||
LootTemplate loot = LootStorage.Disenchant.GetLootForConditionFill(cond.SourceGroup);
|
||||
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());
|
||||
return false;
|
||||
@@ -767,7 +767,7 @@ namespace Game
|
||||
|
||||
LootTemplate loot = LootStorage.Fishing.GetLootForConditionFill(cond.SourceGroup);
|
||||
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());
|
||||
return false;
|
||||
@@ -784,7 +784,7 @@ namespace Game
|
||||
|
||||
LootTemplate loot = LootStorage.Gameobject.GetLootForConditionFill(cond.SourceGroup);
|
||||
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());
|
||||
return false;
|
||||
@@ -801,7 +801,7 @@ namespace Game
|
||||
|
||||
LootTemplate loot = LootStorage.Items.GetLootForConditionFill(cond.SourceGroup);
|
||||
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());
|
||||
return false;
|
||||
@@ -818,7 +818,7 @@ namespace Game
|
||||
|
||||
LootTemplate loot = LootStorage.Mail.GetLootForConditionFill(cond.SourceGroup);
|
||||
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());
|
||||
return false;
|
||||
@@ -835,7 +835,7 @@ namespace Game
|
||||
|
||||
LootTemplate loot = LootStorage.Milling.GetLootForConditionFill(cond.SourceGroup);
|
||||
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());
|
||||
return false;
|
||||
@@ -852,7 +852,7 @@ namespace Game
|
||||
|
||||
LootTemplate loot = LootStorage.Pickpocketing.GetLootForConditionFill(cond.SourceGroup);
|
||||
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());
|
||||
return false;
|
||||
@@ -869,7 +869,7 @@ namespace Game
|
||||
|
||||
LootTemplate loot = LootStorage.Prospecting.GetLootForConditionFill(cond.SourceGroup);
|
||||
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());
|
||||
return false;
|
||||
@@ -886,7 +886,7 @@ namespace Game
|
||||
|
||||
LootTemplate loot = LootStorage.Reference.GetLootForConditionFill(cond.SourceGroup);
|
||||
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());
|
||||
return false;
|
||||
@@ -903,7 +903,7 @@ namespace Game
|
||||
|
||||
LootTemplate loot = LootStorage.Skinning.GetLootForConditionFill(cond.SourceGroup);
|
||||
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());
|
||||
return false;
|
||||
@@ -920,7 +920,7 @@ namespace Game
|
||||
|
||||
LootTemplate loot = LootStorage.Spell.GetLootForConditionFill(cond.SourceGroup);
|
||||
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());
|
||||
return false;
|
||||
@@ -1087,7 +1087,7 @@ namespace Game
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isConditionTypeValid(Condition cond)
|
||||
bool IsConditionTypeValid(Condition cond)
|
||||
{
|
||||
switch (cond.ConditionType)
|
||||
{
|
||||
@@ -1212,7 +1212,7 @@ namespace Game
|
||||
case ConditionTypes.ActiveEvent:
|
||||
{
|
||||
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);
|
||||
return false;
|
||||
@@ -1467,7 +1467,7 @@ namespace Game
|
||||
}
|
||||
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);
|
||||
return false;
|
||||
@@ -1820,15 +1820,15 @@ namespace Game
|
||||
return false;
|
||||
break;
|
||||
case 3:
|
||||
if (!group || group.isRaidGroup())
|
||||
if (!group || group.IsRaidGroup())
|
||||
return false;
|
||||
break;
|
||||
case 4:
|
||||
if (!group || !group.isRaidGroup())
|
||||
if (!group || !group.IsRaidGroup())
|
||||
return false;
|
||||
break;
|
||||
case 5:
|
||||
if (group && group.isRaidGroup())
|
||||
if (group && group.IsRaidGroup())
|
||||
return false;
|
||||
break;
|
||||
default:
|
||||
@@ -2100,7 +2100,7 @@ namespace Game
|
||||
case WorldStateExpressionValueType.WorldState:
|
||||
{
|
||||
uint worldStateId = buffer.ReadUInt32();
|
||||
value = (int)Global.WorldMgr.getWorldState(worldStateId);
|
||||
value = (int)Global.WorldMgr.GetWorldState(worldStateId);
|
||||
break;
|
||||
}
|
||||
case WorldStateExpressionValueType.Function:
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Game.DataStorage
|
||||
public class M2Storage
|
||||
{
|
||||
// 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();
|
||||
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
|
||||
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> targetcam = new List<FlyByCamera>();
|
||||
@@ -73,7 +73,7 @@ namespace Game.DataStorage
|
||||
for (uint i = 0; i < targTsArray.number; ++i)
|
||||
{
|
||||
// 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
|
||||
FlyByCamera thisCam = new FlyByCamera();
|
||||
@@ -105,7 +105,7 @@ namespace Game.DataStorage
|
||||
for (uint i = 0; i < posTsArray.number; ++i)
|
||||
{
|
||||
// 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
|
||||
FlyByCamera thisCam = new FlyByCamera();
|
||||
@@ -189,7 +189,7 @@ namespace Game.DataStorage
|
||||
M2Camera cam = m2file.Read<M2Camera>();
|
||||
|
||||
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)
|
||||
|
||||
@@ -252,7 +252,7 @@ namespace Game.DungeonFinding
|
||||
|
||||
public void Update(uint diff)
|
||||
{
|
||||
if (!isOptionEnabled(LfgOptions.EnableDungeonFinder | LfgOptions.EnableRaidBrowser))
|
||||
if (!IsOptionEnabled(LfgOptions.EnableDungeonFinder | LfgOptions.EnableRaidBrowser))
|
||||
return;
|
||||
|
||||
long currTime = Time.UnixTime;
|
||||
@@ -363,7 +363,7 @@ namespace Game.DungeonFinding
|
||||
LfgJoinResultData joinData = new LfgJoinResultData();
|
||||
List<ObjectGuid> players = new List<ObjectGuid>();
|
||||
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
|
||||
if (isContinue)
|
||||
@@ -400,7 +400,7 @@ namespace Game.DungeonFinding
|
||||
else
|
||||
{
|
||||
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();
|
||||
if (plrg)
|
||||
@@ -524,7 +524,7 @@ namespace Game.DungeonFinding
|
||||
SetState(gguid, LfgState.Rolecheck);
|
||||
// Send update to player
|
||||
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();
|
||||
if (plrg)
|
||||
@@ -1201,7 +1201,7 @@ namespace Game.DungeonFinding
|
||||
LFGDungeonData dungeon = null;
|
||||
Group group = player.GetGroup();
|
||||
|
||||
if (group && group.isLFGGroup())
|
||||
if (group && group.IsLFGGroup())
|
||||
dungeon = GetLFGDungeon(GetDungeon(group.GetGUID()));
|
||||
|
||||
if (dungeon == null)
|
||||
@@ -1244,7 +1244,7 @@ namespace Game.DungeonFinding
|
||||
if (!fromOpcode)
|
||||
{
|
||||
// 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();
|
||||
if (plrg && plrg != player && plrg.GetMapId() == dungeon.map)
|
||||
@@ -1855,7 +1855,7 @@ namespace Game.DungeonFinding
|
||||
QueuesStore.Clear();
|
||||
}
|
||||
|
||||
public bool isOptionEnabled(LfgOptions option)
|
||||
public bool IsOptionEnabled(LfgOptions option)
|
||||
{
|
||||
return m_options.HasAnyFlag(option);
|
||||
}
|
||||
@@ -1924,7 +1924,7 @@ namespace Game.DungeonFinding
|
||||
AddPlayerToGroup(gguid, guid);
|
||||
}
|
||||
|
||||
public bool selectedRandomLfgDungeon(ObjectGuid guid)
|
||||
public bool SelectedRandomLfgDungeon(ObjectGuid guid)
|
||||
{
|
||||
if (GetState(guid) != LfgState.None)
|
||||
{
|
||||
@@ -1940,7 +1940,7 @@ namespace Game.DungeonFinding
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool inLfgDungeonMap(ObjectGuid guid, uint map, Difficulty difficulty)
|
||||
public bool InLfgDungeonMap(ObjectGuid guid, uint map, Difficulty difficulty)
|
||||
{
|
||||
if (!guid.IsParty())
|
||||
guid = GetGroup(guid);
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Game.DungeonFinding
|
||||
// Player Hooks
|
||||
public override void OnLogout(Player player)
|
||||
{
|
||||
if (!Global.LFGMgr.isOptionEnabled(LfgOptions.EnableDungeonFinder | LfgOptions.EnableRaidBrowser))
|
||||
if (!Global.LFGMgr.IsOptionEnabled(LfgOptions.EnableDungeonFinder | LfgOptions.EnableRaidBrowser))
|
||||
return;
|
||||
|
||||
if (!player.GetGroup())
|
||||
@@ -41,7 +41,7 @@ namespace Game.DungeonFinding
|
||||
|
||||
public override void OnLogin(Player player)
|
||||
{
|
||||
if (!Global.LFGMgr.isOptionEnabled(LfgOptions.EnableDungeonFinder | LfgOptions.EnableRaidBrowser))
|
||||
if (!Global.LFGMgr.IsOptionEnabled(LfgOptions.EnableDungeonFinder | LfgOptions.EnableRaidBrowser))
|
||||
return;
|
||||
|
||||
// Temporal: Trying to determine when group data and LFG data gets desynched
|
||||
@@ -67,7 +67,7 @@ namespace Game.DungeonFinding
|
||||
{
|
||||
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();
|
||||
// This function is also called when players log in
|
||||
@@ -84,14 +84,14 @@ namespace Game.DungeonFinding
|
||||
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();
|
||||
if (member)
|
||||
player.GetSession().SendNameQuery(member.GetGUID());
|
||||
}
|
||||
|
||||
if (Global.LFGMgr.selectedRandomLfgDungeon(player.GetGUID()))
|
||||
if (Global.LFGMgr.SelectedRandomLfgDungeon(player.GetGUID()))
|
||||
player.CastSpell(player, SharedConst.LFGSpellLuckOfTheDraw, true);
|
||||
}
|
||||
else
|
||||
@@ -117,7 +117,7 @@ namespace Game.DungeonFinding
|
||||
// Group Hooks
|
||||
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;
|
||||
|
||||
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)
|
||||
{
|
||||
if (!Global.LFGMgr.isOptionEnabled(LfgOptions.EnableDungeonFinder | LfgOptions.EnableRaidBrowser))
|
||||
if (!Global.LFGMgr.IsOptionEnabled(LfgOptions.EnableDungeonFinder | LfgOptions.EnableRaidBrowser))
|
||||
return;
|
||||
|
||||
ObjectGuid gguid = group.GetGUID();
|
||||
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
|
||||
{
|
||||
@@ -204,7 +204,7 @@ namespace Game.DungeonFinding
|
||||
|
||||
public override void OnDisband(Group group)
|
||||
{
|
||||
if (!Global.LFGMgr.isOptionEnabled(LfgOptions.EnableDungeonFinder | LfgOptions.EnableRaidBrowser))
|
||||
if (!Global.LFGMgr.IsOptionEnabled(LfgOptions.EnableDungeonFinder | LfgOptions.EnableRaidBrowser))
|
||||
return;
|
||||
|
||||
ObjectGuid gguid = group.GetGUID();
|
||||
@@ -215,7 +215,7 @@ namespace Game.DungeonFinding
|
||||
|
||||
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;
|
||||
|
||||
ObjectGuid gguid = group.GetGUID();
|
||||
@@ -226,7 +226,7 @@ namespace Game.DungeonFinding
|
||||
|
||||
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;
|
||||
|
||||
ObjectGuid gguid = group.GetGUID();
|
||||
|
||||
@@ -632,8 +632,8 @@ namespace Game.Entities
|
||||
|
||||
_movementTime = 0;
|
||||
|
||||
_spline.Init_Spline(splinePoints.ToArray(), splinePoints.Count, Spline.EvaluationMode.Linear);
|
||||
_spline.initLengths();
|
||||
_spline.InitSpline(splinePoints.ToArray(), splinePoints.Count, Spline.EvaluationMode.Linear);
|
||||
_spline.InitLengths();
|
||||
|
||||
// should be sent in object create packets only
|
||||
SetUpdateFieldValue(m_values.ModifyValue(m_areaTriggerData).ModifyValue(m_areaTriggerData.TimeToTarget), timeToTarget);
|
||||
@@ -771,9 +771,9 @@ namespace Game.Entities
|
||||
if (_movementTime >= GetTimeToTarget())
|
||||
{
|
||||
_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());
|
||||
|
||||
DebugVisualizePosition();
|
||||
@@ -802,7 +802,7 @@ namespace Game.Entities
|
||||
|
||||
int lastPositionIndex = 0;
|
||||
float percentFromLastPoint = 0;
|
||||
_spline.computeIndex(currentTimePercent, ref lastPositionIndex, ref percentFromLastPoint);
|
||||
_spline.ComputeIndex(currentTimePercent, ref lastPositionIndex, ref percentFromLastPoint);
|
||||
|
||||
Vector3 currentPosition;
|
||||
_spline.Evaluate_Percent(lastPositionIndex, percentFromLastPoint, out currentPosition);
|
||||
@@ -810,7 +810,7 @@ namespace Game.Entities
|
||||
float orientation = GetOrientation();
|
||||
if (GetTemplate().HasFlag(AreaTriggerFlags.HasFaceMovementDir))
|
||||
{
|
||||
Vector3 nextPoint = _spline.getPoint(lastPositionIndex + 1);
|
||||
Vector3 nextPoint = _spline.GetPoint(lastPositionIndex + 1);
|
||||
orientation = GetAngle(nextPoint.X, nextPoint.Y);
|
||||
}
|
||||
|
||||
@@ -911,7 +911,7 @@ namespace Game.Entities
|
||||
public Vector3 GetRollPitchYaw() { return _rollPitchYaw; }
|
||||
public Vector3 GetTargetRollPitchYaw() { return _targetRollPitchYaw; }
|
||||
|
||||
public bool HasSplines() { return !_spline.empty(); }
|
||||
public bool HasSplines() { return !_spline.Empty(); }
|
||||
public Spline GetSpline() { return _spline; }
|
||||
public uint GetElapsedTimeForMovement() { return GetTimeSinceCreated(); } // @todo: research the right value, in sniffs both timers are nearly identical
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ namespace Game.Entities
|
||||
SetDeathState(DeathState.Dead);
|
||||
RemoveAllAuras();
|
||||
DestroyForNearbyPlayers(); // old UpdateObjectVisibility()
|
||||
loot.clear();
|
||||
loot.Clear();
|
||||
uint respawnDelay = m_respawnDelay;
|
||||
if (IsAIEnabled)
|
||||
GetAI().CorpseRemoved(respawnDelay);
|
||||
@@ -1625,7 +1625,7 @@ namespace Game.Entities
|
||||
Log.outDebug(LogFilter.Unit, "Respawning creature {0} ({1})", GetName(), GetGUID().ToString());
|
||||
m_respawnTime = 0;
|
||||
ResetPickPocketRefillTimer();
|
||||
loot.clear();
|
||||
loot.Clear();
|
||||
|
||||
if (m_originalEntry != GetEntry())
|
||||
UpdateEntry(m_originalEntry);
|
||||
@@ -3110,9 +3110,9 @@ namespace Game.Entities
|
||||
|
||||
if (CanHaveThreatList())
|
||||
{
|
||||
if (target == null && !GetThreatManager().isThreatListEmpty())
|
||||
if (target == null && !GetThreatManager().IsThreatListEmpty())
|
||||
// No taunt aura or taunt aura caster is dead standard target selection
|
||||
target = GetThreatManager().getHostilTarget();
|
||||
target = GetThreatManager().GetHostilTarget();
|
||||
}
|
||||
else if (!HasReactState(ReactStates.Passive))
|
||||
{
|
||||
|
||||
@@ -267,7 +267,7 @@ namespace Game.Entities
|
||||
SetDisplayId(goInfo.displayId);
|
||||
|
||||
m_model = CreateModel();
|
||||
if (m_model != null && m_model.isMapObject())
|
||||
if (m_model != null && m_model.IsMapObject())
|
||||
AddFlag(GameObjectFlags.MapObject);
|
||||
|
||||
// GAMEOBJECT_BYTES_1, index at 0, 1, 2 and 3
|
||||
@@ -759,7 +759,7 @@ namespace Game.Entities
|
||||
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
|
||||
//! 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)
|
||||
{
|
||||
fishloot.clear();
|
||||
fishloot.Clear();
|
||||
|
||||
uint zone, subzone;
|
||||
uint defaultzone = 1;
|
||||
@@ -857,19 +857,19 @@ namespace Game.Entities
|
||||
|
||||
// if subzone loot exist use it
|
||||
fishloot.FillLoot(subzone, LootStorage.Fishing, loot_owner, true, true);
|
||||
if (fishloot.empty())
|
||||
if (fishloot.Empty())
|
||||
{
|
||||
//subzone no result,use zone loot
|
||||
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.
|
||||
if (fishloot.empty())
|
||||
if (fishloot.Empty())
|
||||
fishloot.FillLoot(defaultzone, LootStorage.Fishing, loot_owner, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
public void GetFishLootJunk(Loot fishloot, Player loot_owner)
|
||||
{
|
||||
fishloot.clear();
|
||||
fishloot.Clear();
|
||||
|
||||
uint zone, subzone;
|
||||
uint defaultzone = 1;
|
||||
@@ -877,11 +877,11 @@ namespace Game.Entities
|
||||
|
||||
// if subzone loot exist use it
|
||||
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
|
||||
fishloot.FillLoot(zone, LootStorage.Fishing, loot_owner, true, true, LootModes.JunkFish);
|
||||
if (fishloot.empty())
|
||||
if (fishloot.Empty())
|
||||
//use zone 1 as default
|
||||
fishloot.FillLoot(defaultzone, LootStorage.Fishing, loot_owner, true, true, LootModes.JunkFish);
|
||||
}
|
||||
@@ -1479,7 +1479,7 @@ namespace Game.Entities
|
||||
Group group = player.GetGroup();
|
||||
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();
|
||||
if (member)
|
||||
@@ -2376,7 +2376,7 @@ namespace Game.Entities
|
||||
if (m_model == null)
|
||||
return;
|
||||
|
||||
m_model.enableCollision(enable);
|
||||
m_model.EnableCollision(enable);
|
||||
}
|
||||
|
||||
void UpdateModel()
|
||||
@@ -2392,7 +2392,7 @@ namespace Game.Entities
|
||||
if (m_model != null)
|
||||
GetMap().InsertGameObjectModel(m_model);
|
||||
|
||||
if (m_model != null && m_model.isMapObject())
|
||||
if (m_model != null && m_model.IsMapObject())
|
||||
AddFlag(GameObjectFlags.MapObject);
|
||||
else
|
||||
RemoveFlag(GameObjectFlags.MapObject);
|
||||
|
||||
@@ -355,7 +355,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
// Delete the items if this is a container
|
||||
if (!loot.isLooted())
|
||||
if (!loot.IsLooted())
|
||||
ItemContainerDeleteLootMoneyAndLootItemsFromDB();
|
||||
|
||||
Dispose();
|
||||
@@ -642,7 +642,7 @@ namespace Game.Entities
|
||||
DeleteFromDB(trans, GetGUID().GetCounter());
|
||||
|
||||
// Delete the items if this is a container
|
||||
if (!loot.isLooted())
|
||||
if (!loot.IsLooted())
|
||||
ItemContainerDeleteLootMoneyAndLootItemsFromDB();
|
||||
}
|
||||
|
||||
@@ -1707,7 +1707,7 @@ namespace Game.Entities
|
||||
public void ItemContainerSaveLootToDB()
|
||||
{
|
||||
// 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;
|
||||
|
||||
SQLTransaction trans = new SQLTransaction();
|
||||
@@ -1728,7 +1728,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
// Save items
|
||||
if (!loot.isLooted())
|
||||
if (!loot.IsLooted())
|
||||
{
|
||||
PreparedStatement stmt_items = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEMCONTAINER_ITEMS);
|
||||
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
|
||||
m_lootGenerated = !loot.isLooted();
|
||||
m_lootGenerated = !loot.IsLooted();
|
||||
|
||||
return m_lootGenerated;
|
||||
}
|
||||
|
||||
@@ -1909,7 +1909,7 @@ namespace Game.Entities
|
||||
else
|
||||
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;
|
||||
@@ -2248,7 +2248,7 @@ namespace Game.Entities
|
||||
return z;
|
||||
}
|
||||
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 (liquid_status.level > z) // z is underwater
|
||||
@@ -2274,7 +2274,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
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
|
||||
if (col)
|
||||
@@ -2286,7 +2286,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
// 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
|
||||
if (col)
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace Game.Entities
|
||||
if (_group)
|
||||
{
|
||||
// 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();
|
||||
if (member)
|
||||
@@ -258,11 +258,11 @@ namespace Game.Entities
|
||||
if (!_isBattleground)
|
||||
{
|
||||
// 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);
|
||||
}
|
||||
// 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();
|
||||
if (member)
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Game.Entities
|
||||
Group group = GetGroup();
|
||||
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();
|
||||
if (!player)
|
||||
|
||||
@@ -3431,7 +3431,7 @@ namespace Game.Entities
|
||||
|
||||
// check if stats should only be saved on logout
|
||||
// save stats can be out of transaction
|
||||
if (GetSession().isLogingOut() || !WorldConfig.GetBoolValue(WorldCfg.StatsSaveOnlyOnLogout))
|
||||
if (GetSession().IsLogingOut() || !WorldConfig.GetBoolValue(WorldCfg.StatsSaveOnlyOnLogout))
|
||||
_SaveStats(trans);
|
||||
|
||||
DB.Characters.CommitTransaction(trans);
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Game.Entities
|
||||
|
||||
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();
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace Game.Entities
|
||||
if (!grp)
|
||||
return PartyResult.NotInGroup;
|
||||
|
||||
if (grp.isLFGGroup())
|
||||
if (grp.IsLFGGroup())
|
||||
{
|
||||
ObjectGuid gguid = grp.GetGUID();
|
||||
if (Global.LFGMgr.GetKicksLeft(gguid) == 0)
|
||||
@@ -71,11 +71,11 @@ namespace Game.Entities
|
||||
if (state == LfgState.FinishedDungeon)
|
||||
return PartyResult.PartyLfgBootDungeonComplete;
|
||||
|
||||
if (grp.isRollLootActive())
|
||||
if (grp.IsRollLootActive())
|
||||
return PartyResult.PartyLfgBootLootRolls;
|
||||
|
||||
// @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())
|
||||
return PartyResult.PartyLfgBootInCombat;
|
||||
|
||||
@@ -106,10 +106,10 @@ namespace Game.Entities
|
||||
|
||||
bool InRandomLfgDungeon()
|
||||
{
|
||||
if (Global.LFGMgr.selectedRandomLfgDungeon(GetGUID()))
|
||||
if (Global.LFGMgr.SelectedRandomLfgDungeon(GetGUID()))
|
||||
{
|
||||
Map map = GetMap();
|
||||
return Global.LFGMgr.inLfgDungeonMap(GetGUID(), map.GetId(), map.GetDifficultyID());
|
||||
return Global.LFGMgr.InLfgDungeonMap(GetGUID(), map.GetId(), map.GetDifficultyID());
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -120,20 +120,20 @@ namespace Game.Entities
|
||||
//we must move references from m_group to m_originalGroup
|
||||
SetOriginalGroup(GetGroup(), GetSubGroup());
|
||||
|
||||
m_group.unlink();
|
||||
m_group.link(group, this);
|
||||
m_group.setSubGroup(subgroup);
|
||||
m_group.Unlink();
|
||||
m_group.Link(group, this);
|
||||
m_group.SetSubGroup(subgroup);
|
||||
}
|
||||
|
||||
public void RemoveFromBattlegroundOrBattlefieldRaid()
|
||||
{
|
||||
//remove existing reference
|
||||
m_group.unlink();
|
||||
m_group.Unlink();
|
||||
Group group = GetOriginalGroup();
|
||||
if (group)
|
||||
{
|
||||
m_group.link(group, this);
|
||||
m_group.setSubGroup(GetOriginalSubGroup());
|
||||
m_group.Link(group, this);
|
||||
m_group.SetSubGroup(GetOriginalSubGroup());
|
||||
}
|
||||
SetOriginalGroup(null);
|
||||
}
|
||||
@@ -141,22 +141,22 @@ namespace Game.Entities
|
||||
public void SetOriginalGroup(Group group, byte subgroup = 0)
|
||||
{
|
||||
if (!group)
|
||||
m_originalGroup.unlink();
|
||||
m_originalGroup.Unlink();
|
||||
else
|
||||
{
|
||||
m_originalGroup.link(group, this);
|
||||
m_originalGroup.setSubGroup(subgroup);
|
||||
m_originalGroup.Link(group, this);
|
||||
m_originalGroup.SetSubGroup(subgroup);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetGroup(Group group, byte subgroup = 0)
|
||||
{
|
||||
if (!group)
|
||||
m_group.unlink();
|
||||
m_group.Unlink();
|
||||
else
|
||||
{
|
||||
m_group.link(group, this);
|
||||
m_group.setSubGroup(subgroup);
|
||||
m_group.Link(group, this);
|
||||
m_group.SetSubGroup(subgroup);
|
||||
}
|
||||
|
||||
UpdateObjectVisibility(false);
|
||||
@@ -206,16 +206,16 @@ namespace Game.Entities
|
||||
|
||||
public Group GetGroupInvite() { return m_groupInvite; }
|
||||
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 byte GetSubGroup() { return m_group.getSubGroup(); }
|
||||
public byte GetSubGroup() { return m_group.GetSubGroup(); }
|
||||
public GroupUpdateFlags GetGroupUpdateFlag() { return m_groupUpdateMask; }
|
||||
public void SetGroupUpdateFlag(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 byte GetOriginalSubGroup() { return m_originalGroup.getSubGroup(); }
|
||||
public byte GetOriginalSubGroup() { return m_originalGroup.GetSubGroup(); }
|
||||
|
||||
public void SetPassOnGroupLoot(bool bPassOnGroupLoot) { m_bPassOnGroupLoot = bPassOnGroupLoot; }
|
||||
public bool GetPassOnGroupLoot() { return m_bPassOnGroupLoot; }
|
||||
|
||||
@@ -3309,12 +3309,12 @@ namespace Game.Entities
|
||||
|
||||
public InventoryResult CanRollForItemInLFG(ItemTemplate proto, WorldObject lootedObject)
|
||||
{
|
||||
if (!GetGroup() || !GetGroup().isLFGGroup())
|
||||
if (!GetGroup() || !GetGroup().IsLFGGroup())
|
||||
return InventoryResult.Ok; // not in LFG group
|
||||
|
||||
// check if looted object is inside the lfg dungeon
|
||||
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;
|
||||
|
||||
if (proto == null)
|
||||
@@ -5138,7 +5138,7 @@ namespace Game.Entities
|
||||
return InventoryResult.NotInCombat;
|
||||
Battleground bg = GetBattleground();
|
||||
if (bg)
|
||||
if (bg.isArena() && bg.GetStatus() == BattlegroundStatus.InProgress)
|
||||
if (bg.IsArena() && bg.GetStatus() == BattlegroundStatus.InProgress)
|
||||
return InventoryResult.NotDuringArenaMatch;
|
||||
}
|
||||
|
||||
@@ -5371,7 +5371,7 @@ namespace Game.Entities
|
||||
return InventoryResult.NotInCombat;
|
||||
Battleground bg = GetBattleground();
|
||||
if (bg)
|
||||
if (bg.isArena() && bg.GetStatus() == BattlegroundStatus.InProgress)
|
||||
if (bg.IsArena() && bg.GetStatus() == BattlegroundStatus.InProgress)
|
||||
return InventoryResult.NotDuringArenaMatch;
|
||||
}
|
||||
|
||||
@@ -6235,7 +6235,7 @@ namespace Game.Entities
|
||||
|
||||
// loot was generated and respawntime has passed since then, allow to recreate loot
|
||||
// to avoid bugs, this rule covers spawned gameobjects only
|
||||
if (go.IsSpawnedByDefault() && go.GetLootState() == LootState.Activated && !go.loot.isLooted() && go.GetLootGenerationTime() + go.GetRespawnDelay() < Time.UnixTime)
|
||||
if (go.IsSpawnedByDefault() && go.GetLootState() == LootState.Activated && !go.loot.IsLooted() && go.GetLootGenerationTime() + go.GetRespawnDelay() < Time.UnixTime)
|
||||
go.SetLootState(LootState.Ready);
|
||||
|
||||
if (go.GetLootState() == LootState.Ready)
|
||||
@@ -6253,7 +6253,7 @@ namespace Game.Entities
|
||||
|
||||
if (lootid != 0)
|
||||
{
|
||||
loot.clear();
|
||||
loot.Clear();
|
||||
|
||||
Group group = GetGroup();
|
||||
bool groupRules = (group && go.GetGoInfo().type == GameObjectTypes.Chest && go.GetGoInfo().Chest.usegrouplootrules != 0);
|
||||
@@ -6274,7 +6274,7 @@ namespace Game.Entities
|
||||
{
|
||||
GameObjectTemplateAddon addon = go.GetTemplateAddon();
|
||||
if (addon != null)
|
||||
loot.generateMoneyLoot(addon.mingold, addon.maxgold);
|
||||
loot.GenerateMoneyLoot(addon.mingold, addon.maxgold);
|
||||
}
|
||||
|
||||
if (loot_type == LootType.Fishing)
|
||||
@@ -6346,7 +6346,7 @@ namespace Game.Entities
|
||||
if (!item.m_lootGenerated && !item.ItemContainerLoadLootFromDB())
|
||||
{
|
||||
item.m_lootGenerated = true;
|
||||
loot.clear();
|
||||
loot.Clear();
|
||||
|
||||
switch (loot_type)
|
||||
{
|
||||
@@ -6360,7 +6360,7 @@ namespace Game.Entities
|
||||
loot.FillLoot(item.GetEntry(), LootStorage.Milling, this, true);
|
||||
break;
|
||||
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);
|
||||
|
||||
// Force save the loot and money items that were just rolled
|
||||
@@ -6387,7 +6387,7 @@ namespace Game.Entities
|
||||
if (loot.loot_type == LootType.None)
|
||||
{
|
||||
uint pLevel = bones.loot.gold;
|
||||
bones.loot.clear();
|
||||
bones.loot.Clear();
|
||||
|
||||
// For AV Achievement
|
||||
Battleground bg = GetBattleground();
|
||||
@@ -6435,7 +6435,7 @@ namespace Game.Entities
|
||||
if (creature.CanGeneratePickPocketLoot())
|
||||
{
|
||||
creature.StartPickPocketRefillTimer();
|
||||
loot.clear();
|
||||
loot.Clear();
|
||||
|
||||
uint lootid = creature.GetCreatureTemplate().PickPocketId;
|
||||
if (lootid != 0)
|
||||
@@ -6500,7 +6500,7 @@ namespace Game.Entities
|
||||
}
|
||||
else if (loot_type == LootType.Skinning)
|
||||
{
|
||||
loot.clear();
|
||||
loot.Clear();
|
||||
loot.FillLoot(creature.GetCreatureTemplate().SkinLootId, LootStorage.Skinning, this, true);
|
||||
permission = PermissionTypes.Owner;
|
||||
|
||||
|
||||
@@ -537,7 +537,7 @@ namespace Game.Entities
|
||||
|
||||
// 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 (!GetGroup() || !GetGroup().isRaidGroup())
|
||||
if (!GetGroup() || !GetGroup().IsRaidGroup())
|
||||
return false;
|
||||
|
||||
Group group = GetGroup();
|
||||
@@ -715,7 +715,7 @@ namespace Game.Entities
|
||||
public override void UpdateUnderwaterState(Map m, float x, float y, float z)
|
||||
{
|
||||
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)
|
||||
{
|
||||
m_MirrorTimerFlags &= ~(PlayerUnderwaterState.InWater | PlayerUnderwaterState.InLava | PlayerUnderwaterState.InSlime | PlayerUnderwaterState.InDarkWater);
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace Game.Entities
|
||||
UpdateHonorFields();
|
||||
|
||||
// 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;
|
||||
|
||||
// Promote to float for calculations
|
||||
@@ -132,7 +132,7 @@ namespace Game.Entities
|
||||
else
|
||||
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
|
||||
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);
|
||||
|
||||
// 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)
|
||||
{
|
||||
@@ -752,7 +752,7 @@ namespace Game.Entities
|
||||
if (HasAura(26013))
|
||||
return false;
|
||||
|
||||
if (bg.isArena() && !GetSession().HasPermission(RBACPermissions.JoinArenas))
|
||||
if (bg.IsArena() && !GetSession().HasPermission(RBACPermissions.JoinArenas))
|
||||
return false;
|
||||
|
||||
if (bg.IsRandom() && !GetSession().HasPermission(RBACPermissions.JoinRandomBg))
|
||||
|
||||
@@ -580,7 +580,7 @@ namespace Game.Entities
|
||||
{
|
||||
case TypeId.Unit:
|
||||
Global.ScriptMgr.OnQuestAccept(this, (questGiver.ToCreature()), quest);
|
||||
questGiver.ToCreature().GetAI().sQuestAccept(this, quest);
|
||||
questGiver.ToCreature().GetAI().QuestAccept(this, quest);
|
||||
break;
|
||||
case TypeId.Item:
|
||||
case TypeId.Container:
|
||||
@@ -2077,7 +2077,7 @@ namespace Game.Entities
|
||||
var group = GetGroup();
|
||||
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();
|
||||
|
||||
@@ -2216,7 +2216,7 @@ namespace Game.Entities
|
||||
|
||||
// just if !ingroup || !noraidgroup || raidgroup
|
||||
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))
|
||||
{
|
||||
@@ -2263,7 +2263,7 @@ namespace Game.Entities
|
||||
|
||||
// just if !ingroup || !noraidgroup || raidgroup
|
||||
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)
|
||||
{
|
||||
@@ -2550,7 +2550,7 @@ namespace Game.Entities
|
||||
continue;
|
||||
|
||||
// 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
|
||||
continue;
|
||||
|
||||
@@ -2943,7 +2943,7 @@ namespace Game.Entities
|
||||
if (qInfo == null)
|
||||
continue;
|
||||
|
||||
if (GetGroup() != null && GetGroup().isRaidGroup() && !qInfo.IsAllowedInRaid(GetMap().GetDifficultyID()))
|
||||
if (GetGroup() != null && GetGroup().IsRaidGroup() && !qInfo.IsAllowedInRaid(GetMap().GetDifficultyID()))
|
||||
continue;
|
||||
|
||||
foreach (QuestObjective obj in qInfo.Objectives)
|
||||
|
||||
@@ -1529,7 +1529,7 @@ namespace Game.Entities
|
||||
spell.m_fromClient = true;
|
||||
spell.m_CastItem = item;
|
||||
spell.SetSpellValue(SpellValueMod.BasePoint0, (int)learning_spell_id);
|
||||
spell.prepare(targets);
|
||||
spell.Prepare(targets);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1565,7 +1565,7 @@ namespace Game.Entities
|
||||
spell.m_CastItem = item;
|
||||
spell.m_misc.Data0 = misc[0];
|
||||
spell.m_misc.Data1 = misc[1];
|
||||
spell.prepare(targets);
|
||||
spell.Prepare(targets);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1599,7 +1599,7 @@ namespace Game.Entities
|
||||
spell.m_CastItem = item;
|
||||
spell.m_misc.Data0 = misc[0];
|
||||
spell.m_misc.Data1 = misc[1];
|
||||
spell.prepare(targets);
|
||||
spell.Prepare(targets);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1697,7 +1697,7 @@ namespace Game.Entities
|
||||
{
|
||||
Spell spell = GetCurrentSpell(i);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -731,7 +731,7 @@ namespace Game.Entities
|
||||
{
|
||||
m_hostileReferenceCheckTimer = 15 * Time.InMilliseconds;
|
||||
if (!GetMap().IsDungeon())
|
||||
GetHostileRefManager().deleteReferencesOutOfRange(GetVisibilityRange());
|
||||
GetHostileRefManager().DeleteReferencesOutOfRange(GetVisibilityRange());
|
||||
}
|
||||
else
|
||||
m_hostileReferenceCheckTimer -= diff;
|
||||
@@ -1958,7 +1958,7 @@ namespace Game.Entities
|
||||
// remove auras that need water/land
|
||||
RemoveAurasWithInterruptFlags((apply ? SpellAuraInterruptFlags.NotAbovewater : SpellAuraInterruptFlags.NotUnderwater));
|
||||
|
||||
GetHostileRefManager().updateThreatTables();
|
||||
GetHostileRefManager().UpdateThreatTables();
|
||||
}
|
||||
public void ValidateMovementInfo(MovementInfo mi)
|
||||
{
|
||||
@@ -2200,13 +2200,13 @@ namespace Game.Entities
|
||||
if (pet != null)
|
||||
{
|
||||
pet.SetFaction(35);
|
||||
pet.GetHostileRefManager().setOnlineOfflineState(false);
|
||||
pet.GetHostileRefManager().SetOnlineOfflineState(false);
|
||||
}
|
||||
|
||||
RemovePvpFlag(UnitPVPStateFlags.FFAPvp);
|
||||
ResetContestedPvP();
|
||||
|
||||
GetHostileRefManager().setOnlineOfflineState(false);
|
||||
GetHostileRefManager().SetOnlineOfflineState(false);
|
||||
CombatStopWithPets();
|
||||
|
||||
PhasingHandler.SetAlwaysVisible(GetPhaseShift(), true);
|
||||
@@ -2225,7 +2225,7 @@ namespace Game.Entities
|
||||
if (pet != null)
|
||||
{
|
||||
pet.SetFaction(GetFaction());
|
||||
pet.GetHostileRefManager().setOnlineOfflineState(true);
|
||||
pet.GetHostileRefManager().SetOnlineOfflineState(true);
|
||||
}
|
||||
|
||||
// restore FFA PvP Server state
|
||||
@@ -2235,7 +2235,7 @@ namespace Game.Entities
|
||||
// restore FFA PvP area state, remove not allowed for GM mounts
|
||||
UpdateArea(m_areaUpdateId);
|
||||
|
||||
GetHostileRefManager().setOnlineOfflineState(true);
|
||||
GetHostileRefManager().SetOnlineOfflineState(true);
|
||||
m_serverSideVisibilityDetect.SetValue(ServerSideVisibilityType.GM, AccountTypes.Player);
|
||||
}
|
||||
|
||||
@@ -3652,9 +3652,9 @@ namespace Game.Entities
|
||||
return false;
|
||||
|
||||
Loot loot = creature.loot;
|
||||
if (loot.isLooted()) // nothing to loot or everything looted.
|
||||
if (loot.IsLooted()) // nothing to loot or everything looted.
|
||||
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;
|
||||
|
||||
if (loot.loot_type == LootType.Skinning)
|
||||
@@ -3680,10 +3680,10 @@ namespace Game.Entities
|
||||
if (loot.roundRobinPlayer.IsEmpty() || loot.roundRobinPlayer == GetGUID())
|
||||
return true;
|
||||
|
||||
if (loot.hasOverThresholdItem())
|
||||
if (loot.HasOverThresholdItem())
|
||||
return true;
|
||||
|
||||
return loot.hasItemFor(this);
|
||||
return loot.HasItemFor(this);
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -4241,7 +4241,7 @@ namespace Game.Entities
|
||||
SetHealth(1);
|
||||
|
||||
SetWaterWalking(true);
|
||||
if (!GetSession().isLogingOut() && !HasUnitState(UnitState.Stunned))
|
||||
if (!GetSession().IsLogingOut() && !HasUnitState(UnitState.Stunned))
|
||||
SetRooted(false);
|
||||
|
||||
// BG - remove insignia related
|
||||
@@ -4966,7 +4966,7 @@ namespace Game.Entities
|
||||
public bool InArena()
|
||||
{
|
||||
Battleground bg = GetBattleground();
|
||||
if (!bg || !bg.isArena())
|
||||
if (!bg || !bg.IsArena())
|
||||
return false;
|
||||
|
||||
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
|
||||
if (GetSession().isLogingOut() || IsInCombat() || HasUnitState(UnitState.Stunned) || HasUnitState(UnitState.Root))
|
||||
if (GetSession().IsLogingOut() || IsInCombat() || HasUnitState(UnitState.Stunned) || HasUnitState(UnitState.Root))
|
||||
{
|
||||
GetSession().SendActivateTaxiReply(ActivateTaxiReply.PlayerBusy);
|
||||
return false;
|
||||
@@ -6924,7 +6924,7 @@ namespace Game.Entities
|
||||
m_taxi.ClearTaxiDestinations(); // not destinations, clear source node
|
||||
Dismount();
|
||||
RemoveUnitFlag(UnitFlags.RemoveClientControl | UnitFlags.TaxiFlight);
|
||||
GetHostileRefManager().setOnlineOfflineState(true);
|
||||
GetHostileRefManager().SetOnlineOfflineState(true);
|
||||
}
|
||||
|
||||
public void ContinueTaxiFlight()
|
||||
@@ -6987,7 +6987,7 @@ namespace Game.Entities
|
||||
Group group = GetGroup();
|
||||
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();
|
||||
if (!player)
|
||||
|
||||
@@ -131,7 +131,7 @@ namespace Game.Entities
|
||||
Group group = owner.GetGroup();
|
||||
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();
|
||||
if (target && target.IsInMap(owner) && group.SameSubGroup(owner, target))
|
||||
|
||||
@@ -43,10 +43,10 @@ namespace Game.Entities
|
||||
|
||||
// Search in threat list
|
||||
ObjectGuid guid = who.GetGUID();
|
||||
foreach (var refe in GetThreatManager().getThreatList())
|
||||
foreach (var refe in GetThreatManager().GetThreatList())
|
||||
{
|
||||
// Return true if the unit matches
|
||||
if (refe != null && refe.getUnitGuid() == guid)
|
||||
if (refe != null && refe.GetUnitGuid() == guid)
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -60,18 +60,18 @@ namespace Game.Entities
|
||||
|
||||
public void SendChangeCurrentVictim(HostileReference pHostileReference)
|
||||
{
|
||||
if (!GetThreatManager().isThreatListEmpty())
|
||||
if (!GetThreatManager().IsThreatListEmpty())
|
||||
{
|
||||
HighestThreatUpdate packet = new HighestThreatUpdate();
|
||||
packet.UnitGUID = GetGUID();
|
||||
packet.HighestThreatGUID = pHostileReference.getUnitGuid();
|
||||
packet.HighestThreatGUID = pHostileReference.GetUnitGuid();
|
||||
|
||||
var refeList = GetThreatManager().getThreatList();
|
||||
var refeList = GetThreatManager().GetThreatList();
|
||||
foreach (var refe in refeList)
|
||||
{
|
||||
ThreatInfo info = new ThreatInfo();
|
||||
info.UnitGUID = refe.getUnitGuid();
|
||||
info.Threat = (long)refe.getThreat() * 100;
|
||||
info.UnitGUID = refe.GetUnitGuid();
|
||||
info.Threat = (long)refe.GetThreat() * 100;
|
||||
packet.ThreatList.Add(info);
|
||||
}
|
||||
SendMessageToSet(packet, false);
|
||||
@@ -108,7 +108,7 @@ namespace Game.Entities
|
||||
++i;
|
||||
}
|
||||
|
||||
GetHostileRefManager().deleteReferencesForFaction(factionId);
|
||||
GetHostileRefManager().DeleteReferencesForFaction(factionId);
|
||||
|
||||
foreach (var control in m_Controlled)
|
||||
control.StopAttackFaction(factionId);
|
||||
@@ -136,22 +136,22 @@ namespace Game.Entities
|
||||
{
|
||||
ThreatRemove packet = new ThreatRemove();
|
||||
packet.UnitGUID = GetGUID();
|
||||
packet.AboutGUID = pHostileReference.getUnitGuid();
|
||||
packet.AboutGUID = pHostileReference.GetUnitGuid();
|
||||
SendMessageToSet(packet, false);
|
||||
}
|
||||
|
||||
void SendThreatListUpdate()
|
||||
{
|
||||
if (!GetThreatManager().isThreatListEmpty())
|
||||
if (!GetThreatManager().IsThreatListEmpty())
|
||||
{
|
||||
ThreatUpdate packet = new ThreatUpdate();
|
||||
packet.UnitGUID = GetGUID();
|
||||
var tlist = GetThreatManager().getThreatList();
|
||||
var tlist = GetThreatManager().GetThreatList();
|
||||
foreach (var refe in tlist)
|
||||
{
|
||||
ThreatInfo info = new ThreatInfo();
|
||||
info.UnitGUID = refe.getUnitGuid();
|
||||
info.Threat = (long)refe.getThreat() * 100;
|
||||
info.UnitGUID = refe.GetUnitGuid();
|
||||
info.Threat = (long)refe.GetThreat() * 100;
|
||||
packet.ThreatList.Add(info);
|
||||
}
|
||||
SendMessageToSet(packet, false);
|
||||
@@ -160,9 +160,9 @@ namespace Game.Entities
|
||||
|
||||
public void DeleteThreatList()
|
||||
{
|
||||
if (CanHaveThreatList(true) && !threatManager.isThreatListEmpty())
|
||||
if (CanHaveThreatList(true) && !threatManager.IsThreatListEmpty())
|
||||
SendClearThreatList();
|
||||
threatManager.clearReferences();
|
||||
threatManager.ClearReferences();
|
||||
}
|
||||
|
||||
public void TauntApply(Unit taunter)
|
||||
@@ -208,7 +208,7 @@ namespace Game.Entities
|
||||
if (!target || target != taunter)
|
||||
return;
|
||||
|
||||
if (threatManager.isThreatListEmpty())
|
||||
if (threatManager.IsThreatListEmpty())
|
||||
{
|
||||
if (creature.IsAIEnabled)
|
||||
creature.GetAI().EnterEvadeMode(EvadeReason.NoHostiles);
|
||||
@@ -326,7 +326,7 @@ namespace Game.Entities
|
||||
{
|
||||
// Only mobs can manage threat lists
|
||||
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)
|
||||
{
|
||||
@@ -601,7 +601,7 @@ namespace Game.Entities
|
||||
|
||||
// melee attack spell casted at main hand attack only - no normal melee dmg dealt
|
||||
if (attType == WeaponAttackType.BaseAttack && GetCurrentSpell(CurrentSpellTypes.Melee) != null && !extra)
|
||||
m_currentSpells[CurrentSpellTypes.Melee].cast();
|
||||
m_currentSpells[CurrentSpellTypes.Melee].Cast();
|
||||
else
|
||||
{
|
||||
// attack can be redirected to another target
|
||||
@@ -975,7 +975,7 @@ namespace Game.Entities
|
||||
Spell spell = victim.GetCurrentSpell(CurrentSpellTypes.Generic);
|
||||
if (spell)
|
||||
{
|
||||
if (spell.getState() == SpellState.Preparing)
|
||||
if (spell.GetState() == SpellState.Preparing)
|
||||
{
|
||||
SpellInterruptFlags interruptFlags = spell.m_spellInfo.InterruptFlags;
|
||||
if (interruptFlags.HasAnyFlag(SpellInterruptFlags.AbortOnDmg))
|
||||
@@ -1143,7 +1143,7 @@ namespace Game.Entities
|
||||
{
|
||||
Spell spell = victim.GetCurrentSpell(CurrentSpellTypes.Generic);
|
||||
if (spell != null)
|
||||
if (spell.getState() == SpellState.Preparing)
|
||||
if (spell.GetState() == SpellState.Preparing)
|
||||
{
|
||||
var interruptFlags = spell.m_spellInfo.InterruptFlags;
|
||||
if (interruptFlags.HasAnyFlag(SpellInterruptFlags.AbortOnDmg))
|
||||
@@ -1154,7 +1154,7 @@ namespace Game.Entities
|
||||
}
|
||||
Spell spell1 = victim.GetCurrentSpell(CurrentSpellTypes.Channeled);
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -1474,13 +1474,13 @@ namespace Game.Entities
|
||||
{
|
||||
Loot loot = creature.loot;
|
||||
|
||||
loot.clear();
|
||||
loot.Clear();
|
||||
uint lootid = creature.GetCreatureTemplate().LootId;
|
||||
if (lootid != 0)
|
||||
loot.FillLoot(lootid, LootStorage.Creature, looter, false, false, creature.GetLootMode());
|
||||
|
||||
if (creature.GetLootMode() > 0)
|
||||
loot.generateMoneyLoot(creature.GetCreatureTemplate().MinGold, creature.GetCreatureTemplate().MaxGold);
|
||||
loot.GenerateMoneyLoot(creature.GetCreatureTemplate().MinGold, creature.GetCreatureTemplate().MaxGold);
|
||||
|
||||
if (group)
|
||||
{
|
||||
@@ -1490,7 +1490,7 @@ namespace Game.Entities
|
||||
group.SendLooter(creature, null);
|
||||
|
||||
// Update round robin looter only if the creature had loot
|
||||
if (!loot.empty())
|
||||
if (!loot.Empty())
|
||||
group.UpdateLooterGuid(creature);
|
||||
}
|
||||
}
|
||||
@@ -1572,7 +1572,7 @@ namespace Game.Entities
|
||||
creature.DeleteThreatList();
|
||||
|
||||
// must be after setDeathState which resets dynamic flags
|
||||
if (!creature.loot.isLooted())
|
||||
if (!creature.loot.IsLooted())
|
||||
creature.AddDynamicFlag(UnitDynFlags.Lootable);
|
||||
else
|
||||
creature.AllLootRemovedFromCorpse();
|
||||
@@ -1798,7 +1798,7 @@ namespace Game.Entities
|
||||
List<Unit> nearMembers = new List<Unit>();
|
||||
// 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();
|
||||
if (target)
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Game.Entities
|
||||
|
||||
//Movement
|
||||
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; }
|
||||
MotionMaster i_motionMaster;
|
||||
public uint m_movementCounter; //< Incrementing counter used in movement packets
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Game.Entities
|
||||
public bool IsFlying() { return m_movementInfo.HasMovementFlag(MovementFlag.Flying | MovementFlag.DisableGravity); }
|
||||
public bool IsFalling()
|
||||
{
|
||||
return m_movementInfo.HasMovementFlag(MovementFlag.Falling | MovementFlag.FallingFar) || MoveSpline.isFalling();
|
||||
return m_movementInfo.HasMovementFlag(MovementFlag.Falling | MovementFlag.FallingFar) || MoveSpline.IsFalling();
|
||||
}
|
||||
public virtual bool CanSwim()
|
||||
{
|
||||
@@ -68,7 +68,7 @@ namespace Game.Entities
|
||||
return GetMap().IsUnderWater(GetPhaseShift(), GetPositionX(), GetPositionY(), GetPositionZ());
|
||||
}
|
||||
|
||||
void PropagateSpeedChange() { GetMotionMaster().propagateSpeedChange(); }
|
||||
void PropagateSpeedChange() { GetMotionMaster().PropagateSpeedChange(); }
|
||||
|
||||
public float GetSpeed(UnitMoveType mtype)
|
||||
{
|
||||
@@ -679,7 +679,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
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);
|
||||
isInWater = liquidStatus.HasAnyFlag(ZLiquidStatus.InWater | ZLiquidStatus.UnderWater);
|
||||
|
||||
@@ -759,7 +759,7 @@ namespace Game.Entities
|
||||
return;
|
||||
|
||||
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 (_lastLiquid != null && _lastLiquid.SpellID != 0)
|
||||
@@ -1295,7 +1295,7 @@ namespace Game.Entities
|
||||
{
|
||||
Battleground bg = ToPlayer().GetBattleground();
|
||||
// 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);
|
||||
else
|
||||
player.UnsummonPetTemporaryIfAny();
|
||||
@@ -1636,7 +1636,7 @@ namespace Game.Entities
|
||||
if (MoveSpline.Finalized())
|
||||
return;
|
||||
|
||||
MoveSpline.updateState((int)diff);
|
||||
MoveSpline.UpdateState((int)diff);
|
||||
bool arrived = MoveSpline.Finalized();
|
||||
|
||||
if (arrived)
|
||||
|
||||
@@ -477,7 +477,7 @@ namespace Game.Entities
|
||||
|
||||
CastStop();
|
||||
CombatStop(); // @todo CombatStop(true) may cause crash (interrupt spells)
|
||||
GetHostileRefManager().deleteReferences();
|
||||
GetHostileRefManager().DeleteReferences();
|
||||
DeleteThreatList();
|
||||
|
||||
if (_oldFactionId != 0)
|
||||
|
||||
@@ -1034,7 +1034,7 @@ namespace Game.Entities
|
||||
spell.SetSpellValue(pair.Key, pair.Value);
|
||||
|
||||
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)
|
||||
{
|
||||
@@ -1134,7 +1134,7 @@ namespace Game.Entities
|
||||
if (spellType == CurrentSpellTypes.Channeled)
|
||||
spell.SendChannelUpdate(0);
|
||||
|
||||
spell.finish(ok);
|
||||
spell.Finish(ok);
|
||||
}
|
||||
|
||||
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
|
||||
Spell spell = m_currentSpells.LookupByKey(CurrentSpellTypes.Channeled);
|
||||
if (spell)
|
||||
if (spell.getState() != SpellState.Finished && spell.IsChannelActive())
|
||||
if (spell.GetState() != SpellState.Finished && spell.IsChannelActive())
|
||||
if (spell.GetSpellInfo().IsMoveAllowedChannel())
|
||||
return false;
|
||||
|
||||
@@ -1501,7 +1501,7 @@ namespace Game.Entities
|
||||
int overEnergize = damage - gain;
|
||||
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId);
|
||||
victim.GetHostileRefManager().threatAssist(this, damage * 0.5f, spellInfo);
|
||||
victim.GetHostileRefManager().ThreatAssist(this, damage * 0.5f, spellInfo);
|
||||
|
||||
SendEnergizeSpellLog(victim, spellId, damage, overEnergize, powerType);
|
||||
}
|
||||
@@ -2100,8 +2100,8 @@ namespace Game.Entities
|
||||
// generic spells are cast when they are not finished and not delayed
|
||||
var currentSpell = GetCurrentSpell(CurrentSpellTypes.Generic);
|
||||
if (currentSpell &&
|
||||
(currentSpell.getState() != SpellState.Finished) &&
|
||||
(withDelayed || currentSpell.getState() != SpellState.Delayed))
|
||||
(currentSpell.GetState() != SpellState.Finished) &&
|
||||
(withDelayed || currentSpell.GetState() != SpellState.Delayed))
|
||||
{
|
||||
if (!skipInstant || currentSpell.GetCastTime() != 0)
|
||||
{
|
||||
@@ -2112,7 +2112,7 @@ namespace Game.Entities
|
||||
currentSpell = GetCurrentSpell(CurrentSpellTypes.Channeled);
|
||||
// channeled spells may be delayed, but they are still considered cast
|
||||
if (!skipChanneled && currentSpell &&
|
||||
(currentSpell.getState() != SpellState.Finished))
|
||||
(currentSpell.GetState() != SpellState.Finished))
|
||||
{
|
||||
if (!isAutoshoot || !currentSpell.m_spellInfo.HasAttribute(SpellAttr2.NotResetAutoActions))
|
||||
return true;
|
||||
@@ -2833,8 +2833,8 @@ namespace Game.Entities
|
||||
Log.outDebug(LogFilter.Unit, "Interrupt spell for unit {0}", GetEntry());
|
||||
Spell spell = m_currentSpells.LookupByKey(spellType);
|
||||
if (spell != null
|
||||
&& (withDelayed || spell.getState() != SpellState.Delayed)
|
||||
&& (withInstant || spell.GetCastTime() > 0 || spell.getState() == SpellState.Casting))
|
||||
&& (withDelayed || spell.GetState() != SpellState.Delayed)
|
||||
&& (withInstant || spell.GetCastTime() > 0 || spell.GetState() == SpellState.Casting))
|
||||
{
|
||||
// for example, do not let self-stun aura interrupt itself
|
||||
if (!spell.IsInterruptable())
|
||||
@@ -2845,8 +2845,8 @@ namespace Game.Entities
|
||||
if (IsTypeId(TypeId.Player))
|
||||
ToPlayer().SendAutoRepeatCancel(this);
|
||||
|
||||
if (spell.getState() != SpellState.Finished)
|
||||
spell.cancel();
|
||||
if (spell.GetState() != SpellState.Finished)
|
||||
spell.Cancel();
|
||||
|
||||
if (IsCreature() && IsAIEnabled)
|
||||
ToCreature().GetAI().OnSpellCastInterrupt(spell.GetSpellInfo());
|
||||
@@ -2867,7 +2867,7 @@ namespace Game.Entities
|
||||
Spell spell = GetCurrentSpell(CurrentSpellTypes.Channeled);
|
||||
if (spell != null)
|
||||
{
|
||||
if (spell.getState() == SpellState.Casting)
|
||||
if (spell.GetState() == SpellState.Casting)
|
||||
{
|
||||
for (var i = 0; i < m_interruptMask.Length; ++i)
|
||||
m_interruptMask[i] |= spell.m_spellInfo.ChannelInterruptFlags[i];
|
||||
@@ -3243,7 +3243,7 @@ namespace Game.Entities
|
||||
Spell spell = GetCurrentSpell(CurrentSpellTypes.Channeled);
|
||||
if (spell != null)
|
||||
{
|
||||
if (spell.getState() == SpellState.Casting
|
||||
if (spell.GetState() == SpellState.Casting
|
||||
&& Convert.ToBoolean(spell.GetSpellInfo().ChannelInterruptFlags[index] & flag)
|
||||
&& spell.GetSpellInfo().Id != except
|
||||
&& !(Convert.ToBoolean(flag & (uint)SpellAuraInterruptFlags.Move) && HasAuraTypeWithAffectMask(AuraType.CastWhileWalking, spell.GetSpellInfo())))
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Game.Entities
|
||||
UnitTypeMask = UnitTypeMask.None;
|
||||
hostileRefManager = new HostileRefManager(this);
|
||||
_spellHistory = new SpellHistory(this);
|
||||
m_FollowingRefManager = new RefManager<Unit, TargetedMovementGeneratorBase>();
|
||||
m_FollowingRefManager = new RefManager<Unit, ITargetedMovementGeneratorBase>();
|
||||
|
||||
ObjectTypeId = TypeId.Unit;
|
||||
ObjectTypeMask |= TypeMask.Unit;
|
||||
@@ -142,7 +142,7 @@ namespace Game.Entities
|
||||
// Having this would prevent spells from being proced, so let's crash
|
||||
Cypher.Assert(m_procDeep == 0);
|
||||
|
||||
if (CanHaveThreatList() && GetThreatManager().isNeedUpdateToClient(diff))
|
||||
if (CanHaveThreatList() && GetThreatManager().IsNeedUpdateToClient(diff))
|
||||
SendThreatListUpdate();
|
||||
|
||||
// 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)
|
||||
{
|
||||
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] = 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
|
||||
CombatStop();
|
||||
DeleteThreatList();
|
||||
GetHostileRefManager().deleteReferences();
|
||||
GetHostileRefManager().DeleteReferences();
|
||||
GetMotionMaster().Clear(false); // remove different non-standard movement generators.
|
||||
}
|
||||
public override void CleanupsBeforeDelete(bool finalCleanup = true)
|
||||
@@ -1118,7 +1118,7 @@ namespace Game.Entities
|
||||
if (IsTypeId(TypeId.Unit) || !ToPlayer().GetSession().PlayerLogout())
|
||||
{
|
||||
HostileRefManager refManager = GetHostileRefManager();
|
||||
HostileReference refe = refManager.getFirst();
|
||||
HostileReference refe = refManager.GetFirst();
|
||||
|
||||
while (refe != null)
|
||||
{
|
||||
@@ -1127,17 +1127,17 @@ namespace Game.Entities
|
||||
{
|
||||
Creature creature = unit.ToCreature();
|
||||
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
|
||||
if (!IsTypeId(TypeId.Player))
|
||||
{
|
||||
List<HostileReference> threatList = GetThreatManager().getThreatList();
|
||||
List<HostileReference> offlineThreatList = GetThreatManager().getOfflineThreatList();
|
||||
List<HostileReference> threatList = GetThreatManager().GetThreatList();
|
||||
List<HostileReference> offlineThreatList = GetThreatManager().GetOfflineThreatList();
|
||||
|
||||
// merge expects sorted lists
|
||||
threatList.Sort();
|
||||
@@ -1146,9 +1146,9 @@ namespace Game.Entities
|
||||
|
||||
foreach (var host in threatList)
|
||||
{
|
||||
Unit unit = host.getTarget();
|
||||
Unit unit = host.GetTarget();
|
||||
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();
|
||||
DeleteThreatList();
|
||||
GetHostileRefManager().deleteReferences();
|
||||
GetHostileRefManager().DeleteReferences();
|
||||
|
||||
if (IsNonMeleeSpellCast(false))
|
||||
InterruptNonMeleeSpells(false);
|
||||
@@ -1860,7 +1860,7 @@ namespace Game.Entities
|
||||
|
||||
// we want to shoot
|
||||
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
|
||||
ResetAttackTimer(WeaponAttackType.RangedAttack);
|
||||
@@ -2753,7 +2753,7 @@ namespace Game.Entities
|
||||
Battleground bg = target.GetBattleground();
|
||||
if (bg != null)
|
||||
{
|
||||
if (bg.isArena())
|
||||
if (bg.IsArena())
|
||||
{
|
||||
DestroyArenaUnit destroyArenaUnit = new DestroyArenaUnit();
|
||||
destroyArenaUnit.Guid = GetGUID();
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace Game
|
||||
if (event_id < 1 || event_id >= mGameEvent.Length)
|
||||
return;
|
||||
|
||||
if (!mGameEvent[event_id].isValid())
|
||||
if (!mGameEvent[event_id].IsValid())
|
||||
return;
|
||||
|
||||
if (m_ActiveEvents.Contains(event_id))
|
||||
@@ -137,7 +137,7 @@ namespace Game
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
else
|
||||
@@ -174,7 +174,7 @@ namespace Game
|
||||
UnApplyEvent(event_id);
|
||||
|
||||
// When event is stopped, clean up its worldstate
|
||||
Global.WorldMgr.setWorldState(event_id, 0);
|
||||
Global.WorldMgr.SetWorldState(event_id, 0);
|
||||
|
||||
if (overwrite && !serverwide_evt)
|
||||
{
|
||||
@@ -1000,7 +1000,7 @@ namespace Game
|
||||
else
|
||||
{
|
||||
// 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);
|
||||
if (IsActiveEvent(id))
|
||||
deactivate.Add(id);
|
||||
@@ -1089,7 +1089,7 @@ namespace Game
|
||||
UpdateBattlegroundSettings();
|
||||
// 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.
|
||||
if (Global.WorldMgr.getWorldState(event_id) == 0)
|
||||
if (Global.WorldMgr.GetWorldState(event_id) == 0)
|
||||
Global.WorldMgr.ResetEventSeasonalQuests(event_id);
|
||||
}
|
||||
|
||||
@@ -1098,12 +1098,12 @@ namespace Game
|
||||
MultiMap<uint, ulong> creaturesByMap = new MultiMap<uint, ulong>();
|
||||
|
||||
// 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
|
||||
CreatureData data = Global.ObjectMgr.GetCreatureData(pair.guid);
|
||||
CreatureData data = Global.ObjectMgr.GetCreatureData(guid);
|
||||
if (data != null)
|
||||
creaturesByMap.Add(data.mapid, pair.guid);
|
||||
creaturesByMap.Add(data.mapid, guid);
|
||||
}
|
||||
|
||||
foreach (var key in creaturesByMap.Keys)
|
||||
@@ -1234,7 +1234,7 @@ namespace Game
|
||||
foreach (var guid in mGameEventCreatureGuids[internal_event_id])
|
||||
{
|
||||
// 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;
|
||||
|
||||
// Remove the creature from grid
|
||||
@@ -1262,7 +1262,7 @@ namespace Game
|
||||
foreach (var guid in mGameEventGameobjectGuids[internal_event_id])
|
||||
{
|
||||
// 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;
|
||||
// Remove the gameobject from grid
|
||||
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)
|
||||
{
|
||||
@@ -1359,7 +1359,7 @@ namespace Game
|
||||
return false;
|
||||
}
|
||||
|
||||
bool hasGameObjectQuestActiveEventExcept(uint questId, ushort eventId)
|
||||
bool HasGameObjectQuestActiveEventExcept(uint questId, ushort eventId)
|
||||
{
|
||||
foreach (var activeEventId in m_ActiveEvents)
|
||||
{
|
||||
@@ -1370,7 +1370,7 @@ namespace Game
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool hasCreatureActiveEventExcept(ulong creatureId, ushort eventId)
|
||||
bool HasCreatureActiveEventExcept(ulong creatureId, ushort eventId)
|
||||
{
|
||||
foreach (var activeEventId in m_ActiveEvents)
|
||||
{
|
||||
@@ -1384,7 +1384,7 @@ namespace Game
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool hasGameObjectActiveEventExcept(ulong goId, ushort eventId)
|
||||
bool HasGameObjectActiveEventExcept(ulong goId, ushort eventId)
|
||||
{
|
||||
foreach (var activeEventId in m_ActiveEvents)
|
||||
{
|
||||
@@ -1408,7 +1408,7 @@ namespace Game
|
||||
CreatureQuestMap.Add(pair.Item1, pair.Item2);
|
||||
else
|
||||
{
|
||||
if (!hasCreatureQuestActiveEventExcept(pair.Item2, eventId))
|
||||
if (!HasCreatureQuestActiveEventExcept(pair.Item2, eventId))
|
||||
{
|
||||
// Remove the pair(id, quest) from the multimap
|
||||
CreatureQuestMap.Remove(pair.Item1, pair.Item2);
|
||||
@@ -1422,7 +1422,7 @@ namespace Game
|
||||
GameObjectQuestMap.Add(pair.Item1, pair.Item2);
|
||||
else
|
||||
{
|
||||
if (!hasGameObjectQuestActiveEventExcept(pair.Item2, eventId))
|
||||
if (!HasGameObjectQuestActiveEventExcept(pair.Item2, eventId))
|
||||
{
|
||||
// Remove the pair(id, quest) from the multimap
|
||||
GameObjectQuestMap.Remove(pair.Item1, pair.Item2);
|
||||
@@ -1643,7 +1643,7 @@ namespace Game
|
||||
public string description;
|
||||
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
|
||||
@@ -1666,7 +1666,7 @@ namespace Game
|
||||
{
|
||||
foreach (var creature in objs)
|
||||
if (creature.IsInWorld && creature.IsAIEnabled)
|
||||
creature.GetAI().sOnGameEvent(_activate, _eventId);
|
||||
creature.GetAI().OnGameEvent(_activate, _eventId);
|
||||
}
|
||||
public override void Visit(IList<GameObject> objs)
|
||||
{
|
||||
|
||||
+98
-98
@@ -53,7 +53,7 @@ namespace Game.Groups
|
||||
m_leaderName = leader.GetName();
|
||||
leader.AddPlayerFlag(PlayerFlags.GroupLeader);
|
||||
|
||||
if (isBGGroup() || isBFGroup())
|
||||
if (IsBGGroup() || IsBFGroup())
|
||||
{
|
||||
m_groupFlags = GroupFlags.MaskBgRaid;
|
||||
m_groupCategory = GroupCategory.Instance;
|
||||
@@ -62,7 +62,7 @@ namespace Game.Groups
|
||||
if (m_groupFlags.HasAnyFlag(GroupFlags.Raid))
|
||||
_initRaidSubGroupsCounter();
|
||||
|
||||
if (!isLFGGroup())
|
||||
if (!IsLFGGroup())
|
||||
m_lootMethod = LootMethod.GroupLoot;
|
||||
|
||||
m_lootThreshold = ItemQuality.Uncommon;
|
||||
@@ -72,7 +72,7 @@ namespace Game.Groups
|
||||
m_raidDifficulty = Difficulty.NormalRaid;
|
||||
m_legacyRaidDifficulty = Difficulty.Raid10N;
|
||||
|
||||
if (!isBGGroup() && !isBFGroup())
|
||||
if (!IsBGGroup() && !IsBFGroup())
|
||||
{
|
||||
m_dungeonDifficulty = leader.GetDungeonDifficultyID();
|
||||
m_raidDifficulty = leader.GetRaidDifficultyID();
|
||||
@@ -180,7 +180,7 @@ namespace Game.Groups
|
||||
m_groupFlags = (m_groupFlags | GroupFlags.Lfg | GroupFlags.LfgRestricted);
|
||||
m_groupCategory = GroupCategory.Instance;
|
||||
m_lootMethod = LootMethod.GroupLoot;
|
||||
if (!isBGGroup() && !isBFGroup())
|
||||
if (!IsBGGroup() && !IsBFGroup())
|
||||
{
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_TYPE);
|
||||
|
||||
@@ -199,7 +199,7 @@ namespace Game.Groups
|
||||
|
||||
_initRaidSubGroupsCounter();
|
||||
|
||||
if (!isBGGroup() && !isBFGroup())
|
||||
if (!IsBGGroup() && !IsBFGroup())
|
||||
{
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_TYPE);
|
||||
|
||||
@@ -229,7 +229,7 @@ namespace Game.Groups
|
||||
|
||||
m_subGroupsCounts = null;
|
||||
|
||||
if (!isBGGroup() && !isBFGroup())
|
||||
if (!IsBGGroup() && !IsBFGroup())
|
||||
{
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_TYPE);
|
||||
|
||||
@@ -255,7 +255,7 @@ namespace Game.Groups
|
||||
if (player == null || player.GetGroupInvite())
|
||||
return false;
|
||||
Group group = player.GetGroup();
|
||||
if (group && (group.isBGGroup() || group.isBFGroup()))
|
||||
if (group && (group.IsBGGroup() || group.IsBFGroup()))
|
||||
group = player.GetOriginalGroup();
|
||||
if (group)
|
||||
return false;
|
||||
@@ -354,7 +354,7 @@ namespace Game.Groups
|
||||
player.SetGroupInvite(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);
|
||||
else //if player is in bg raid and we are adding him to normal group, then call SetOriginalGroup()
|
||||
player.SetOriginalGroup(this, subGroup);
|
||||
@@ -368,14 +368,14 @@ namespace Game.Groups
|
||||
// if the same group invites the player back, cancel the homebind timer
|
||||
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)
|
||||
m_targetIcons[i].Clear();
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
@@ -392,7 +392,7 @@ namespace Game.Groups
|
||||
SendUpdate();
|
||||
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
|
||||
// including raid/heroic instances that they are not permanently bound to!
|
||||
@@ -424,7 +424,7 @@ namespace Game.Groups
|
||||
UpdatePlayerOutOfRange(player);
|
||||
|
||||
// quest related GO state dependent from raid membership
|
||||
if (isRaidGroup())
|
||||
if (IsRaidGroup())
|
||||
player.UpdateForQuestWorldObjects();
|
||||
|
||||
{
|
||||
@@ -433,7 +433,7 @@ namespace Game.Groups
|
||||
UpdateObject groupDataPacket;
|
||||
|
||||
// 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)
|
||||
continue;
|
||||
@@ -480,7 +480,7 @@ namespace Game.Groups
|
||||
Player player = Global.ObjAccessor.FindConnectedPlayer(guid);
|
||||
if (player)
|
||||
{
|
||||
for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.next())
|
||||
for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.Next())
|
||||
{
|
||||
Player groupMember = refe.GetSource();
|
||||
if (groupMember)
|
||||
@@ -495,16 +495,16 @@ namespace Game.Groups
|
||||
}
|
||||
|
||||
// LFG group vote kick handled in scripts
|
||||
if (isLFGGroup() && method == RemoveMethod.Kick)
|
||||
if (IsLFGGroup() && method == RemoveMethod.Kick)
|
||||
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)
|
||||
if (GetMembersCount() > ((isBGGroup() || isLFGGroup() || isBFGroup()) ? 1 : 2))
|
||||
if (GetMembersCount() > ((IsBGGroup() || IsLFGGroup() || IsBFGroup()) ? 1 : 2))
|
||||
{
|
||||
if (player)
|
||||
{
|
||||
// Battlegroundgroup handling
|
||||
if (isBGGroup() || isBFGroup())
|
||||
if (IsBGGroup() || IsBFGroup())
|
||||
player.RemoveFromBattlegroundOrBattlefieldRaid();
|
||||
else
|
||||
// Regular group
|
||||
@@ -528,7 +528,7 @@ namespace Game.Groups
|
||||
}
|
||||
|
||||
// Remove player from group in DB
|
||||
if (!isBGGroup() && !isBFGroup())
|
||||
if (!IsBGGroup() && !IsBFGroup())
|
||||
{
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GROUP_MEMBER);
|
||||
stmt.AddValue(0, guid.GetCounter());
|
||||
@@ -586,7 +586,7 @@ namespace Game.Groups
|
||||
|
||||
SendUpdate();
|
||||
|
||||
if (isLFGGroup() && GetMembersCount() == 1)
|
||||
if (IsLFGGroup() && GetMembersCount() == 1)
|
||||
{
|
||||
Player leader = Global.ObjAccessor.FindPlayer(GetLeaderGUID());
|
||||
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();
|
||||
else if (player)
|
||||
{
|
||||
@@ -629,7 +629,7 @@ namespace Game.Groups
|
||||
|
||||
Global.ScriptMgr.OnGroupChangeLeader(this, newLeaderGuid, m_leaderGuid);
|
||||
|
||||
if (!isBGGroup() && !isBFGroup())
|
||||
if (!IsBGGroup() && !IsBFGroup())
|
||||
{
|
||||
PreparedStatement stmt;
|
||||
SQLTransaction trans = new SQLTransaction();
|
||||
@@ -737,7 +737,7 @@ namespace Game.Groups
|
||||
|
||||
//we cannot call _removeMember because it would invalidate member iterator
|
||||
//if we are removing player from Battlegroundraid
|
||||
if (isBGGroup() || isBFGroup())
|
||||
if (IsBGGroup() || IsBFGroup())
|
||||
player.RemoveFromBattlegroundOrBattlefieldRaid();
|
||||
else
|
||||
{
|
||||
@@ -751,7 +751,7 @@ namespace Game.Groups
|
||||
player.SetPartyType(m_groupCategory, GroupType.None);
|
||||
|
||||
// quest related GO state dependent from raid membership
|
||||
if (isRaidGroup())
|
||||
if (IsRaidGroup())
|
||||
player.UpdateForQuestWorldObjects();
|
||||
|
||||
if (!hideDestroy)
|
||||
@@ -766,7 +766,7 @@ namespace Game.Groups
|
||||
|
||||
RemoveAllInvites();
|
||||
|
||||
if (!isBGGroup() && !isBFGroup())
|
||||
if (!IsBGGroup() && !IsBFGroup())
|
||||
{
|
||||
SQLTransaction trans = new SQLTransaction();
|
||||
|
||||
@@ -797,7 +797,7 @@ namespace Game.Groups
|
||||
void SendLootStartRollToPlayer(uint countDown, uint mapId, Player p, bool canNeed, Roll r)
|
||||
{
|
||||
StartLootRoll startLootRoll = new StartLootRoll();
|
||||
startLootRoll.LootObj = r.getTarget().GetGUID();
|
||||
startLootRoll.LootObj = r.GetTarget().GetGUID();
|
||||
startLootRoll.MapID = (int)mapId;
|
||||
startLootRoll.RollTime = countDown;
|
||||
startLootRoll.ValidRolls = r.rollTypeMask;
|
||||
@@ -817,7 +817,7 @@ namespace Game.Groups
|
||||
void SendLootRoll(ObjectGuid playerGuid, int rollNumber, RollType rollType, Roll roll)
|
||||
{
|
||||
LootRollBroadcast lootRoll = new LootRollBroadcast();
|
||||
lootRoll.LootObj = roll.getTarget().GetGUID();
|
||||
lootRoll.LootObj = roll.GetTarget().GetGUID();
|
||||
lootRoll.Player = playerGuid;
|
||||
lootRoll.Roll = rollNumber;
|
||||
lootRoll.RollType = rollType;
|
||||
@@ -837,7 +837,7 @@ namespace Game.Groups
|
||||
void SendLootRollWon(ObjectGuid winnerGuid, int rollNumber, RollType rollType, Roll roll)
|
||||
{
|
||||
LootRollWon lootRollWon = new LootRollWon();
|
||||
lootRollWon.LootObj = roll.getTarget().GetGUID();
|
||||
lootRollWon.LootObj = roll.GetTarget().GetGUID();
|
||||
lootRollWon.Winner = winnerGuid;
|
||||
lootRollWon.Roll = rollNumber;
|
||||
lootRollWon.RollType = rollType;
|
||||
@@ -858,7 +858,7 @@ namespace Game.Groups
|
||||
void SendLootAllPassed(Roll roll)
|
||||
{
|
||||
LootAllPassed lootAllPassed = new LootAllPassed();
|
||||
lootAllPassed.LootObj = roll.getTarget().GetGUID();
|
||||
lootAllPassed.LootObj = roll.GetTarget().GetGUID();
|
||||
roll.FillPacket(lootAllPassed.Item);
|
||||
|
||||
foreach (var pair in roll.playerVote)
|
||||
@@ -875,7 +875,7 @@ namespace Game.Groups
|
||||
void SendLootRollsComplete(Roll roll)
|
||||
{
|
||||
LootRollsComplete lootRollsComplete = new LootRollsComplete();
|
||||
lootRollsComplete.LootObj = roll.getTarget().GetGUID();
|
||||
lootRollsComplete.LootObj = roll.GetTarget().GetGUID();
|
||||
lootRollsComplete.LootListID = (byte)(roll.itemSlot + 1);
|
||||
|
||||
foreach (var pair in roll.playerVote)
|
||||
@@ -898,7 +898,7 @@ namespace Game.Groups
|
||||
lootList.Owner = creature.GetGUID();
|
||||
lootList.LootObj = creature.loot.GetGUID();
|
||||
|
||||
if (GetLootMethod() == LootMethod.MasterLoot && creature.loot.hasOverThresholdItem())
|
||||
if (GetLootMethod() == LootMethod.MasterLoot && creature.loot.HasOverThresholdItem())
|
||||
lootList.Master.Set(GetMasterLooterGuid());
|
||||
|
||||
if (groupLooter)
|
||||
@@ -925,7 +925,7 @@ namespace Game.Groups
|
||||
{
|
||||
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();
|
||||
if (!playerToRoll || playerToRoll.GetSession() == null)
|
||||
@@ -948,7 +948,7 @@ namespace Game.Groups
|
||||
|
||||
if (r.totalPlayersRolling > 0)
|
||||
{
|
||||
r.setLoot(loot);
|
||||
r.SetLoot(loot);
|
||||
r.itemSlot = itemSlot;
|
||||
|
||||
if (item.GetFlags2().HasAnyFlag(ItemFlags2.CanOnlyRollGreed))
|
||||
@@ -996,7 +996,7 @@ namespace Game.Groups
|
||||
ItemTemplate item = Global.ObjectMgr.GetItemTemplate(i.itemid);
|
||||
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();
|
||||
if (!playerToRoll || playerToRoll.GetSession() == null)
|
||||
@@ -1012,7 +1012,7 @@ namespace Game.Groups
|
||||
|
||||
if (r.totalPlayersRolling > 0)
|
||||
{
|
||||
r.setLoot(loot);
|
||||
r.SetLoot(loot);
|
||||
r.itemSlot = itemSlot;
|
||||
|
||||
loot.quest_items[itemSlot - loot.items.Count].is_blocked = true;
|
||||
@@ -1053,7 +1053,7 @@ namespace Game.Groups
|
||||
MasterLootCandidateList data = new MasterLootCandidateList();
|
||||
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();
|
||||
if (!looter.IsInWorld)
|
||||
@@ -1063,7 +1063,7 @@ namespace Game.Groups
|
||||
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();
|
||||
if (looter.IsAtGroupRewardDistance(pLootedObject))
|
||||
@@ -1081,8 +1081,8 @@ namespace Game.Groups
|
||||
if (!roll.playerVote.ContainsKey(playerGuid))
|
||||
return;
|
||||
|
||||
if (roll.getLoot() != null)
|
||||
if (roll.getLoot().items.Empty())
|
||||
if (roll.GetLoot() != null)
|
||||
if (roll.GetLoot().items.Empty())
|
||||
return;
|
||||
|
||||
RollType rollType = RollType.MaxTypes;
|
||||
@@ -1120,7 +1120,7 @@ namespace Game.Groups
|
||||
{
|
||||
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
|
||||
}
|
||||
@@ -1129,7 +1129,7 @@ namespace Game.Groups
|
||||
|
||||
void CountTheRoll(Roll roll, Map allowedMap)
|
||||
{
|
||||
if (!roll.isValid()) // is loot already deleted ?
|
||||
if (!roll.IsValid()) // is loot already deleted ?
|
||||
{
|
||||
RollId.Remove(roll);
|
||||
return;
|
||||
@@ -1175,13 +1175,13 @@ namespace Game.Groups
|
||||
player.UpdateCriteria(CriteriaTypes.RollNeedOnLoot, roll.itemid, maxresul);
|
||||
|
||||
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);
|
||||
if (msg == InventoryResult.Ok)
|
||||
{
|
||||
item.is_looted = true;
|
||||
roll.getLoot().NotifyItemRemoved(roll.itemSlot);
|
||||
roll.getLoot().unlootedCount--;
|
||||
roll.GetLoot().NotifyItemRemoved(roll.itemSlot);
|
||||
roll.GetLoot().unlootedCount--;
|
||||
player.StoreNewItem(dest, roll.itemid, true, item.randomBonusListId, item.GetAllowedLooters(), item.context, item.BonusListIDs);
|
||||
}
|
||||
else
|
||||
@@ -1237,7 +1237,7 @@ namespace Game.Groups
|
||||
{
|
||||
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)
|
||||
{
|
||||
@@ -1246,8 +1246,8 @@ namespace Game.Groups
|
||||
if (msg == InventoryResult.Ok)
|
||||
{
|
||||
item.is_looted = true;
|
||||
roll.getLoot().NotifyItemRemoved(roll.itemSlot);
|
||||
roll.getLoot().unlootedCount--;
|
||||
roll.GetLoot().NotifyItemRemoved(roll.itemSlot);
|
||||
roll.GetLoot().unlootedCount--;
|
||||
player.StoreNewItem(dest, roll.itemid, true, item.randomBonusListId, item.GetAllowedLooters(), item.context, item.BonusListIDs);
|
||||
}
|
||||
else
|
||||
@@ -1260,8 +1260,8 @@ namespace Game.Groups
|
||||
else if (rollVote == RollType.Disenchant)
|
||||
{
|
||||
item.is_looted = true;
|
||||
roll.getLoot().NotifyItemRemoved(roll.itemSlot);
|
||||
roll.getLoot().unlootedCount--;
|
||||
roll.GetLoot().NotifyItemRemoved(roll.itemSlot);
|
||||
roll.GetLoot().unlootedCount--;
|
||||
player.UpdateCriteria(CriteriaTypes.CastSpell, 13262); // Disenchant
|
||||
|
||||
ItemDisenchantLootRecord disenchant = roll.GetItemDisenchantLoot(player);
|
||||
@@ -1296,7 +1296,7 @@ namespace Game.Groups
|
||||
SendLootAllPassed(roll);
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
@@ -1390,7 +1390,7 @@ namespace Game.Groups
|
||||
|
||||
playerInfos.Status = GroupMemberOnlineStatus.Offline;
|
||||
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.Flags = (byte)member.flags; // See enum GroupMemberFlags
|
||||
@@ -1417,7 +1417,7 @@ namespace Game.Groups
|
||||
}
|
||||
|
||||
// LfgInfos
|
||||
if (isLFGGroup())
|
||||
if (IsLFGGroup())
|
||||
{
|
||||
partyUpdate.LfgInfos.HasValue = true;
|
||||
|
||||
@@ -1470,7 +1470,7 @@ namespace Game.Groups
|
||||
PartyMemberState packet = new PartyMemberState();
|
||||
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();
|
||||
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)
|
||||
{
|
||||
for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.next())
|
||||
for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.Next())
|
||||
{
|
||||
Player player = refe.GetSource();
|
||||
if (player == null || (!ignore.IsEmpty() && player.GetGUID() == ignore) || (ignorePlayersInBGRaid && player.GetGroup() != this))
|
||||
continue;
|
||||
|
||||
if ((group == -1 || refe.getSubGroup() == group))
|
||||
if ((group == -1 || refe.GetSubGroup() == group))
|
||||
if (player.GetSession().IsAddonRegistered(prefix))
|
||||
player.SendPacket(packet);
|
||||
}
|
||||
@@ -1494,13 +1494,13 @@ namespace Game.Groups
|
||||
|
||||
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();
|
||||
if (!player || (!ignore.IsEmpty() && player.GetGUID() == ignore) || (ignorePlayersInBGRaid && player.GetGroup() != this))
|
||||
continue;
|
||||
|
||||
if (player.GetSession() != null && (group == -1 || refe.getSubGroup() == group))
|
||||
if (player.GetSession() != null && (group == -1 || refe.GetSubGroup() == group))
|
||||
player.SendPacket(packet);
|
||||
}
|
||||
}
|
||||
@@ -1515,7 +1515,7 @@ namespace Game.Groups
|
||||
|
||||
SubGroupCounterIncrease(group);
|
||||
|
||||
if (!isBGGroup() && !isBFGroup())
|
||||
if (!IsBGGroup() && !IsBFGroup())
|
||||
{
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_MEMBER_SUBGROUP);
|
||||
|
||||
@@ -1542,7 +1542,7 @@ namespace Game.Groups
|
||||
public void ChangeMembersGroup(ObjectGuid guid, byte group)
|
||||
{
|
||||
// Only raid groups have sub groups
|
||||
if (!isRaidGroup())
|
||||
if (!IsRaidGroup())
|
||||
return;
|
||||
|
||||
// Check if player is really in the raid
|
||||
@@ -1565,7 +1565,7 @@ namespace Game.Groups
|
||||
SubGroupCounterDecrease(prevSubGroup);
|
||||
|
||||
// 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);
|
||||
|
||||
@@ -1580,11 +1580,11 @@ namespace Game.Groups
|
||||
if (player)
|
||||
{
|
||||
if (player.GetGroup() == this)
|
||||
player.GetGroupRef().setSubGroup(group);
|
||||
player.GetGroupRef().SetSubGroup(group);
|
||||
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
|
||||
player.GetOriginalGroupRef().setSubGroup(group);
|
||||
player.GetOriginalGroupRef().SetSubGroup(group);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1594,7 +1594,7 @@ namespace Game.Groups
|
||||
|
||||
public void SwapMembersGroups(ObjectGuid firstGuid, ObjectGuid secondGuid)
|
||||
{
|
||||
if (!isRaidGroup())
|
||||
if (!IsRaidGroup())
|
||||
return;
|
||||
|
||||
MemberSlot[] slots = new MemberSlot[2];
|
||||
@@ -1614,7 +1614,7 @@ namespace Game.Groups
|
||||
for (byte i = 0; i < 2; i++)
|
||||
{
|
||||
// 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);
|
||||
stmt.AddValue(0, slots[i].group);
|
||||
@@ -1627,9 +1627,9 @@ namespace Game.Groups
|
||||
if (player)
|
||||
{
|
||||
if (player.GetGroup() == this)
|
||||
player.GetGroupRef().setSubGroup(slots[i].group);
|
||||
player.GetGroupRef().SetSubGroup(slots[i].group);
|
||||
else
|
||||
player.GetOriginalGroupRef().setSubGroup(slots[i].group);
|
||||
player.GetOriginalGroupRef().SetSubGroup(slots[i].group);
|
||||
}
|
||||
}
|
||||
DB.Characters.CommitTransaction(trans);
|
||||
@@ -1713,7 +1713,7 @@ namespace Game.Groups
|
||||
{
|
||||
errorGuid = new ObjectGuid();
|
||||
// check if this group is LFG group
|
||||
if (isLFGGroup())
|
||||
if (IsLFGGroup())
|
||||
return GroupJoinBattlegroundResult.LfgCantUseBattleground;
|
||||
|
||||
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
|
||||
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();
|
||||
// offline member? don't let join
|
||||
@@ -1786,7 +1786,7 @@ namespace Game.Groups
|
||||
}
|
||||
|
||||
// only check for MinPlayerCount since MinPlayerCount == MaxPlayerCount for arenas...
|
||||
if (bgOrTemplate.isArena() && memberscount != MinPlayerCount)
|
||||
if (bgOrTemplate.IsArena() && memberscount != MinPlayerCount)
|
||||
return GroupJoinBattlegroundResult.ArenaTeamPartySize;
|
||||
|
||||
return GroupJoinBattlegroundResult.None;
|
||||
@@ -1795,7 +1795,7 @@ namespace Game.Groups
|
||||
public void SetDungeonDifficultyID(Difficulty difficulty)
|
||||
{
|
||||
m_dungeonDifficulty = difficulty;
|
||||
if (!isBGGroup() && !isBFGroup())
|
||||
if (!IsBGGroup() && !IsBFGroup())
|
||||
{
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_DIFFICULTY);
|
||||
|
||||
@@ -1805,7 +1805,7 @@ namespace Game.Groups
|
||||
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();
|
||||
if (player.GetSession() == null)
|
||||
@@ -1819,7 +1819,7 @@ namespace Game.Groups
|
||||
public void SetRaidDifficultyID(Difficulty difficulty)
|
||||
{
|
||||
m_raidDifficulty = difficulty;
|
||||
if (!isBGGroup() && !isBFGroup())
|
||||
if (!IsBGGroup() && !IsBFGroup())
|
||||
{
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_RAID_DIFFICULTY);
|
||||
|
||||
@@ -1829,7 +1829,7 @@ namespace Game.Groups
|
||||
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();
|
||||
if (player.GetSession() == null)
|
||||
@@ -1843,7 +1843,7 @@ namespace Game.Groups
|
||||
public void SetLegacyRaidDifficultyID(Difficulty difficulty)
|
||||
{
|
||||
m_legacyRaidDifficulty = difficulty;
|
||||
if (!isBGGroup() && !isBFGroup())
|
||||
if (!IsBGGroup() && !IsBFGroup())
|
||||
{
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_LEGACY_RAID_DIFFICULTY);
|
||||
|
||||
@@ -1853,7 +1853,7 @@ namespace Game.Groups
|
||||
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();
|
||||
if (player.GetSession() == null)
|
||||
@@ -1886,7 +1886,7 @@ namespace Game.Groups
|
||||
|
||||
public void ResetInstances(InstanceResetMethod method, bool isRaid, bool isLegacy, Player SendMsgTo)
|
||||
{
|
||||
if (isBGGroup() || isBFGroup())
|
||||
if (IsBGGroup() || IsBFGroup())
|
||||
return;
|
||||
|
||||
// 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();
|
||||
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();
|
||||
if (player)
|
||||
@@ -2014,7 +2014,7 @@ namespace Game.Groups
|
||||
|
||||
public InstanceBind BindToInstance(InstanceSave save, bool permanent, bool load = false)
|
||||
{
|
||||
if (save == null || isBGGroup() || isBFGroup())
|
||||
if (save == null || IsBGGroup() || IsBFGroup())
|
||||
return null;
|
||||
|
||||
if (!m_boundInstances.ContainsKey(save.GetDifficultyID()))
|
||||
@@ -2306,24 +2306,24 @@ namespace Game.Groups
|
||||
|
||||
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);
|
||||
}
|
||||
public bool isRaidGroup()
|
||||
public bool IsRaidGroup()
|
||||
{
|
||||
return m_groupFlags.HasAnyFlag(GroupFlags.Raid);
|
||||
}
|
||||
|
||||
public bool isBGGroup()
|
||||
public bool IsBGGroup()
|
||||
{
|
||||
return m_bgGroup != null;
|
||||
}
|
||||
|
||||
public bool isBFGroup()
|
||||
public bool IsBFGroup()
|
||||
{
|
||||
return m_bfGroup != null;
|
||||
}
|
||||
@@ -2333,7 +2333,7 @@ namespace Game.Groups
|
||||
return GetMembersCount() > 0;
|
||||
}
|
||||
|
||||
public bool isRollLootActive() { return !RollId.Empty(); }
|
||||
public bool IsRollLootActive() { return !RollId.Empty(); }
|
||||
|
||||
public ObjectGuid GetLeaderGUID()
|
||||
{
|
||||
@@ -2446,7 +2446,7 @@ namespace Game.Groups
|
||||
public void SetGroupMemberFlag(ObjectGuid guid, bool apply, GroupMemberFlags flag)
|
||||
{
|
||||
// Assistants, main assistants and main tanks are only available in raid groups
|
||||
if (!isRaidGroup())
|
||||
if (!IsRaidGroup())
|
||||
return;
|
||||
|
||||
// Check if player is really in the raid
|
||||
@@ -2487,7 +2487,7 @@ namespace Game.Groups
|
||||
Roll GetRoll(ObjectGuid lootObjectGuid, byte lootListId)
|
||||
{
|
||||
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 null;
|
||||
}
|
||||
@@ -2499,13 +2499,13 @@ namespace Game.Groups
|
||||
|
||||
void DelinkMember(ObjectGuid guid)
|
||||
{
|
||||
GroupReference refe = m_memberMgr.getFirst();
|
||||
GroupReference refe = m_memberMgr.GetFirst();
|
||||
while (refe != null)
|
||||
{
|
||||
GroupReference nextRef = refe.next();
|
||||
GroupReference nextRef = refe.Next();
|
||||
if (refe.GetSource().GetGUID() == guid)
|
||||
{
|
||||
refe.unlink();
|
||||
refe.Unlink();
|
||||
break;
|
||||
}
|
||||
refe = nextRef;
|
||||
@@ -2579,7 +2579,7 @@ namespace Game.Groups
|
||||
|
||||
public uint GetDbStoreId() { return m_dbStoreId; }
|
||||
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 GroupFlags GetGroupFlags() { return m_groupFlags; }
|
||||
|
||||
@@ -2587,7 +2587,7 @@ namespace Game.Groups
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
@@ -2639,20 +2639,20 @@ namespace Game.Groups
|
||||
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()
|
||||
getTarget().addLootValidatorRef(this);
|
||||
GetTarget().AddLootValidatorRef(this);
|
||||
}
|
||||
|
||||
public void FillPacket(LootItemData lootItem)
|
||||
@@ -2661,7 +2661,7 @@ namespace Game.Groups
|
||||
lootItem.Quantity = itemCount;
|
||||
lootItem.LootListID = (byte)(itemSlot + 1);
|
||||
|
||||
LootItem lootItemInSlot = getTarget().GetItemInSlot(itemSlot);
|
||||
LootItem lootItemInSlot = GetTarget().GetItemInSlot(itemSlot);
|
||||
if (lootItemInSlot != null)
|
||||
{
|
||||
lootItem.CanTradeToTapList = lootItemInSlot.allowedGUIDs.Count > 1;
|
||||
@@ -2671,7 +2671,7 @@ namespace Game.Groups
|
||||
|
||||
public ItemDisenchantLootRecord GetItemDisenchantLoot(Player player)
|
||||
{
|
||||
LootItem lootItemInSlot = getTarget().GetItemInSlot(itemSlot);
|
||||
LootItem lootItemInSlot = GetTarget().GetItemInSlot(itemSlot);
|
||||
if (lootItemInSlot != null)
|
||||
{
|
||||
ItemInstance itemInstance = new ItemInstance(lootItemInSlot);
|
||||
|
||||
@@ -27,24 +27,24 @@ namespace Game.Groups
|
||||
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;
|
||||
}
|
||||
|
||||
public class GroupRefManager : RefManager<Group, Player>
|
||||
{
|
||||
public new GroupReference getFirst() { return (GroupReference)base.getFirst(); }
|
||||
public new GroupReference GetFirst() { return (GroupReference)base.GetFirst(); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ namespace Game
|
||||
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();
|
||||
if (!member)
|
||||
@@ -221,7 +221,7 @@ namespace Game
|
||||
return;
|
||||
|
||||
// Prevent players from sending BuildPvpLogDataPacket in an arena except for when sent in Battleground.EndBattleground.
|
||||
if (bg.isArena())
|
||||
if (bg.IsArena())
|
||||
return;
|
||||
|
||||
PVPLogData pvpLogData;
|
||||
@@ -544,7 +544,7 @@ namespace Game
|
||||
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();
|
||||
if (!member)
|
||||
|
||||
@@ -273,7 +273,7 @@ namespace Game
|
||||
if (!group)
|
||||
{
|
||||
group = GetPlayer().GetGroup();
|
||||
if (!group || group.isBGGroup())
|
||||
if (!group || group.IsBGGroup())
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -314,7 +314,7 @@ namespace Game
|
||||
case ChatMsg.Raid:
|
||||
{
|
||||
Group group = GetPlayer().GetGroup();
|
||||
if (!group || !group.isRaidGroup() || group.isBGGroup())
|
||||
if (!group || !group.IsRaidGroup() || group.IsBGGroup())
|
||||
return;
|
||||
|
||||
if (group.IsLeader(GetPlayer().GetGUID()))
|
||||
@@ -330,7 +330,7 @@ namespace Game
|
||||
case ChatMsg.RaidWarning:
|
||||
{
|
||||
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;
|
||||
|
||||
Global.ScriptMgr.OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
||||
|
||||
@@ -95,11 +95,11 @@ namespace Game
|
||||
}
|
||||
|
||||
Group group = GetPlayer().GetGroup();
|
||||
if (group && group.isBGGroup())
|
||||
if (group && group.IsBGGroup())
|
||||
group = GetPlayer().GetOriginalGroup();
|
||||
|
||||
Group group2 = player.GetGroup();
|
||||
if (group2 && group2.isBGGroup())
|
||||
if (group2 && group2.IsBGGroup())
|
||||
group2 = player.GetOriginalGroup();
|
||||
|
||||
PartyInvite partyInvite;
|
||||
@@ -421,7 +421,7 @@ namespace Game
|
||||
group.SendTargetIconList(this, packet.PartyIndex);
|
||||
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;
|
||||
|
||||
if (packet.Target.IsPlayer())
|
||||
@@ -645,7 +645,7 @@ namespace Game
|
||||
if (!group)
|
||||
return;
|
||||
|
||||
if (group.isRaidGroup() && !group.IsLeader(GetPlayer().GetGUID()) && !group.IsAssistant(GetPlayer().GetGUID()))
|
||||
if (group.IsRaidGroup() && !group.IsLeader(GetPlayer().GetGUID()) && !group.IsAssistant(GetPlayer().GetGUID()))
|
||||
return;
|
||||
|
||||
group.DeleteRaidMarker(packet.MarkerId);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user