More refactoring of code.

This commit is contained in:
hondacrx
2019-09-23 21:41:13 -04:00
parent 2418715800
commit 570aebce26
176 changed files with 2261 additions and 2265 deletions
+3 -3
View File
@@ -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;
+2 -2
View File
@@ -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;
+4 -4
View File
@@ -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))
+21 -21
View File
@@ -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();
}
+1 -1
View File
@@ -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()
+7 -7
View File
@@ -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);
+26 -26
View File
@@ -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
+26 -26
View File
@@ -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
}
+9 -9
View File
@@ -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;
+8 -8
View File
@@ -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)