diff --git a/Source/Framework/Collections/IndexMinPriorityQueue.cs b/Source/Framework/Collections/IndexMinPriorityQueue.cs index 50c85e851..d05d4a635 100644 --- a/Source/Framework/Collections/IndexMinPriorityQueue.cs +++ b/Source/Framework/Collections/IndexMinPriorityQueue.cs @@ -89,7 +89,7 @@ namespace Framework.Collections Exchange(1, Size--); Sink(1); _qp[min] = -1; - _keys[_pq[Size + 1]] = default(T); + _keys[_pq[Size + 1]] = default; _pq[Size + 1] = -1; return min; } @@ -143,7 +143,7 @@ namespace Framework.Collections Exchange(i, Size--); Swim(i); Sink(i); - _keys[index] = default(T); + _keys[index] = default; _qp[index] = -1; } private bool Greater(int i, int j) diff --git a/Source/Framework/Collections/MultiMap.cs b/Source/Framework/Collections/MultiMap.cs index 1f49ee4cd..7b8d092f6 100644 --- a/Source/Framework/Collections/MultiMap.cs +++ b/Source/Framework/Collections/MultiMap.cs @@ -137,7 +137,7 @@ namespace System.Collections.Generic { if (!_interalStorage.ContainsKey(key)) { - value = default(TValue); + value = default; return false; } value = _interalStorage[key].Last(); @@ -381,7 +381,7 @@ namespace System.Collections.Generic { if (!_interalStorage.ContainsKey(key)) { - value = default(TValue); + value = default; return false; } value = _interalStorage[key].Last(); diff --git a/Source/Framework/Database/SQLResult.cs b/Source/Framework/Database/SQLResult.cs index f2903c0b2..d6af16e10 100644 --- a/Source/Framework/Database/SQLResult.cs +++ b/Source/Framework/Database/SQLResult.cs @@ -42,7 +42,7 @@ namespace Framework.Database var value = _reader[column]; if (value == DBNull.Value) - return default(T); + return default; if (value.GetType() != typeof(T)) return (T)Convert.ChangeType(value, typeof(T));//todo remove me when all fields are the right type this is super slow @@ -105,7 +105,7 @@ namespace Framework.Database var value = _currentRow[column]; if (value == DBNull.Value) - return default(T); + return default; if (value.GetType() != typeof(T)) return (T)Convert.ChangeType(value, typeof(T));//todo remove me when all fields are the right type this is super slow diff --git a/Source/Framework/Dynamic/EventMap.cs b/Source/Framework/Dynamic/EventMap.cs index 8a70f5021..1ed188efa 100644 --- a/Source/Framework/Dynamic/EventMap.cs +++ b/Source/Framework/Dynamic/EventMap.cs @@ -317,7 +317,7 @@ namespace Framework.Dynamic /// Cancel events belonging to specified group. /// /// Group to cancel. - void CancelEventGroup(uint group) + public void CancelEventGroup(uint group) { if (group == 0 || group > 8 || Empty()) return; @@ -334,7 +334,7 @@ namespace Framework.Dynamic /// /// Wanted event id. /// Time of found event. - uint GetNextEventTime(uint eventId) + public uint GetNextEventTime(uint eventId) { if (Empty()) return 0; diff --git a/Source/Framework/IO/StringArguments.cs b/Source/Framework/IO/StringArguments.cs index ddc83fd98..86e756b78 100644 --- a/Source/Framework/IO/StringArguments.cs +++ b/Source/Framework/IO/StringArguments.cs @@ -64,145 +64,145 @@ namespace Framework.IO public char NextChar(string delimiters = " ") { if (!MoveNext(delimiters)) - return default(char); + return default; char value; if (char.TryParse(Current, out value)) return value; - return default(char); + return default; } public byte NextByte(string delimiters = " ") { if (!MoveNext(delimiters)) - return default(byte); + return default; byte value; if (byte.TryParse(Current, out value)) return value; - return default(byte); + return default; } public sbyte NextSByte(string delimiters = " ") { if (!MoveNext(delimiters)) - return default(sbyte); + return default; sbyte value; if (sbyte.TryParse(Current, out value)) return value; - return default(sbyte); + return default; } public ushort NextUInt16(string delimiters = " ") { if (!MoveNext(delimiters)) - return default(ushort); + return default; ushort value; if (ushort.TryParse(Current, out value)) return value; - return default(ushort); + return default; } public short NextInt16(string delimiters = " ") { if (!MoveNext(delimiters)) - return default(short); + return default; short value; if (short.TryParse(Current, out value)) return value; - return default(short); + return default; } public uint NextUInt32(string delimiters = " ") { if (!MoveNext(delimiters)) - return default(uint); + return default; uint value; if (uint.TryParse(Current, out value)) return value; - return default(uint); + return default; } public int NextInt32(string delimiters = " ") { if (!MoveNext(delimiters)) - return default(int); + return default; int value; if (int.TryParse(Current, out value)) return value; - return default(int); + return default; } public ulong NextUInt64(string delimiters = " ") { if (!MoveNext(delimiters)) - return default(ulong); + return default; ulong value; if (ulong.TryParse(Current, out value)) return value; - return default(ulong); + return default; } public long NextInt64(string delimiters = " ") { if (!MoveNext(delimiters)) - return default(long); + return default; long value; if (long.TryParse(Current, out value)) return value; - return default(long); + return default; } public float NextSingle(string delimiters = " ") { if (!MoveNext(delimiters)) - return default(float); + return default; float value; if (float.TryParse(Current, out value)) return value; - return default(float); + return default; } public double NextDouble(string delimiters = " ") { if (!MoveNext(delimiters)) - return default(double); + return default; double value; if (double.TryParse(Current, out value)) return value; - return default(double); + return default; } public decimal NextDecimal(string delimiters = " ") { if (!MoveNext(delimiters)) - return default(decimal); + return default; decimal value; if (decimal.TryParse(Current, out value)) return value; - return default(decimal); + return default; } public void AlignToNextChar() diff --git a/Source/Framework/Threading/ProducerConsumerQueue.cs b/Source/Framework/Threading/ProducerConsumerQueue.cs index 078d3a448..f7468fea2 100644 --- a/Source/Framework/Threading/ProducerConsumerQueue.cs +++ b/Source/Framework/Threading/ProducerConsumerQueue.cs @@ -48,7 +48,7 @@ namespace Framework.Threading public bool Pop(out T value) { - value = default(T); + value = default; lock (_queueLock) { if (_queue.Count == 0 || _shutdown) @@ -61,7 +61,7 @@ namespace Framework.Threading public void WaitAndPop(out T value) { - value = default(T); + value = default; lock (_queueLock) { while (_queue.Count == 0 && !_shutdown) diff --git a/Source/Framework/Util/CollectionExtensions.cs b/Source/Framework/Util/CollectionExtensions.cs index 07b464ad0..224332773 100644 --- a/Source/Framework/Util/CollectionExtensions.cs +++ b/Source/Framework/Util/CollectionExtensions.cs @@ -41,7 +41,7 @@ namespace System.Collections.Generic /// The value, or the default value of the element type. public static T LookupByIndex(this IList list, int index) { - return index >= list.Count ? default(T) : list[index]; + return index >= list.Count ? default : list[index]; } /// @@ -57,17 +57,17 @@ namespace System.Collections.Generic { TValue val; TKey newkey = (TKey)Convert.ChangeType(key, typeof(TKey)); - return dict.TryGetValue(newkey, out val) ? val : default(TValue); + return dict.TryGetValue(newkey, out val) ? val : default; } public static TValue LookupByKey(this IDictionary dict, TKey key) { TValue val; - return dict.TryGetValue(key, out val) ? val : default(TValue); + return dict.TryGetValue(key, out val) ? val : default; } public static KeyValuePair Find(this IDictionary dict, TKey key) { if (!dict.ContainsKey(key)) - return default(KeyValuePair); + return default; return new KeyValuePair(key, dict[key]); } @@ -106,7 +106,7 @@ namespace System.Collections.Generic else { for (var i = list.Count; i < size; ++i) - list.Add(default(T)); + list.Add(default); } } @@ -161,7 +161,7 @@ namespace System.Collections.Generic } - return default(T); + return default; } public static IEnumerable Intersect(this IEnumerable first, IEnumerable second, Func comparer) diff --git a/Source/Framework/Util/Extensions.cs b/Source/Framework/Util/Extensions.cs index 0752cd57d..c3c4a1367 100644 --- a/Source/Framework/Util/Extensions.cs +++ b/Source/Framework/Util/Extensions.cs @@ -216,7 +216,7 @@ namespace System { T value; if (!Enum.TryParse(str, out value)) - return default(T); + return default; return value; } diff --git a/Source/Game/AI/CoreAI/CreatureAI.cs b/Source/Game/AI/CoreAI/CreatureAI.cs index ed2ce3d0a..c077ae737 100644 --- a/Source/Game/AI/CoreAI/CreatureAI.cs +++ b/Source/Game/AI/CoreAI/CreatureAI.cs @@ -492,6 +492,7 @@ namespace Game.AI protected EventMap _events = new EventMap(); protected TaskScheduler _scheduler = new TaskScheduler(); + protected InstanceScript _instance; } public struct AISpellInfoType diff --git a/Source/Game/AI/CoreAI/PassiveAI.cs b/Source/Game/AI/CoreAI/PassiveAI.cs index cbe3ffde7..c3862360b 100644 --- a/Source/Game/AI/CoreAI/PassiveAI.cs +++ b/Source/Game/AI/CoreAI/PassiveAI.cs @@ -88,7 +88,7 @@ namespace Game.AI public class NullCreatureAI : CreatureAI { - public NullCreatureAI(Creature c) : base(c) + public NullCreatureAI(Creature creature) : base(creature) { me.SetReactState(ReactStates.Passive); } diff --git a/Source/Game/AI/CoreAI/UnitAI.cs b/Source/Game/AI/CoreAI/UnitAI.cs index 235d9dc65..3407aef6e 100644 --- a/Source/Game/AI/CoreAI/UnitAI.cs +++ b/Source/Game/AI/CoreAI/UnitAI.cs @@ -132,7 +132,7 @@ namespace Game.AI /// Select the best target (in order) satisfying from the threat list. /// If is nonzero, the first entries in order (or MAXTHREAT order, if is RANDOM) are skipped. /// - public Unit SelectTarget(SelectAggroTarget targetType, uint offset, ISelector selector) + public Unit SelectTarget(SelectAggroTarget targetType, uint offset, ICheck selector) { ThreatManager mgr = GetThreatManager(); // shortcut: if we ignore the first elements, and there are at most elements, then we ignore ALL elements @@ -170,7 +170,7 @@ namespace Game.AI /// - Does not have aura with ID - (if aura < 0) /// The resulting targets are stored in (which is cleared first). /// - public List SelectTargetList(uint num, SelectAggroTarget targetType, uint offset, float dist, bool playerOnly, bool withTank, int aura = 0) + public List SelectTargetList(uint num, SelectAggroTarget targetType, uint offset = 0, float dist = 0f, bool playerOnly = false, bool withTank = true, int aura = 0) { return SelectTargetList(num, targetType, offset, new DefaultTargetSelector(me, dist, playerOnly, withTank, aura)); } @@ -179,7 +179,7 @@ namespace Game.AI /// Select the best (up to) targets (in order) satisfying from the threat list and stores them in (which is cleared first). /// If is nonzero, the first entries in order (or MAXTHREAT order, if is RANDOM) are skipped. /// - public List SelectTargetList(uint num, SelectAggroTarget targetType, uint offset, ISelector selector) + public List SelectTargetList(uint num, SelectAggroTarget targetType, uint offset, ICheck selector) { var targetList = new List(); @@ -238,7 +238,7 @@ namespace Game.AI } // then finally filter by predicate - targetList.RemoveAll(target => { return !selector.Check(target); }); + targetList.RemoveAll(unit => !selector.Invoke(unit)); if (targetList.Count <= num) return targetList; @@ -289,7 +289,7 @@ namespace Game.AI DefaultTargetSelector targetSelector = new DefaultTargetSelector(me, range, playerOnly, true, -(int)spellId); if (!spellInfo.HasAuraInterruptFlag(SpellAuraInterruptFlags.NotVictim) - && targetSelector.Check(me.GetVictim())) + && targetSelector.Invoke(me.GetVictim())) target = me.GetVictim(); else target = SelectTarget(SelectAggroTarget.Random, 0, targetSelector); @@ -549,13 +549,8 @@ namespace Game.AI MinDistance // prefer targets closer to us } - public interface ISelector - { - bool Check(Unit target); - } - // default predicate function to select target based on distance, player and/or aura criteria - public class DefaultTargetSelector : ISelector + public class DefaultTargetSelector : ICheck { Unit me; float m_dist; @@ -577,7 +572,7 @@ namespace Game.AI m_aura = aura; } - public bool Check(Unit target) + public bool Invoke(Unit target) { if (me == null) return false; @@ -611,13 +606,13 @@ namespace Game.AI } } - return true; + return false; } } // Target selector for spell casts checking range, auras and attributes // todo Add more checks from Spell.CheckCast - public class SpellTargetSelector : ISelector + public class SpellTargetSelector : ICheck { public SpellTargetSelector(Unit caster, uint spellId) { @@ -627,7 +622,7 @@ namespace Game.AI Cypher.Assert(_spellInfo != null); } - public bool Check(Unit target) + public bool Invoke(Unit target) { if (target == null) return false; @@ -698,7 +693,7 @@ namespace Game.AI // Very simple target selector, will just skip main target // NOTE: When passing to UnitAI.SelectTarget remember to use 0 as position for random selection // because tank will not be in the temporary list - public class NonTankTargetSelector : ISelector + public class NonTankTargetSelector : ICheck { public NonTankTargetSelector(Unit source, bool playerOnly = true) { @@ -706,7 +701,7 @@ namespace Game.AI _playerOnly = playerOnly; } - public bool Check(Unit target) + public bool Invoke(Unit target) { if (target == null) return false; @@ -726,7 +721,7 @@ namespace Game.AI } // Simple selector for units using mana - class PowerUsersSelector : ISelector + class PowerUsersSelector : ICheck { public PowerUsersSelector(Unit unit, PowerType power, float dist, bool playerOnly) { @@ -736,7 +731,7 @@ namespace Game.AI _playerOnly = playerOnly; } - public bool Check(Unit target) + public bool Invoke(Unit target) { if (_me == null || target == null) return false; @@ -762,7 +757,7 @@ namespace Game.AI bool _playerOnly; } - class FarthestTargetSelector : ISelector + class FarthestTargetSelector : ICheck { public FarthestTargetSelector(Unit unit, float dist, bool playerOnly, bool inLos) { @@ -772,7 +767,7 @@ namespace Game.AI _inLos = inLos; } - public bool Check(Unit target) + public bool Invoke(Unit target) { if (_me == null || target == null) return false; diff --git a/Source/Game/AI/PlayerAI/PlayerAI.cs b/Source/Game/AI/PlayerAI/PlayerAI.cs index fa49a3572..c14627005 100644 --- a/Source/Game/AI/PlayerAI/PlayerAI.cs +++ b/Source/Game/AI/PlayerAI/PlayerAI.cs @@ -1366,7 +1366,7 @@ namespace Game.AI bool _isFollowing; } - struct ValidTargetSelectPredicate : ISelector + struct ValidTargetSelectPredicate : ICheck { UnitAI _ai; @@ -1375,7 +1375,7 @@ namespace Game.AI _ai = ai; } - public bool Check(Unit target) + public bool Invoke(Unit target) { return _ai.CanAIAttack(target); } diff --git a/Source/Game/AI/ScriptedAI/ScriptedAI.cs b/Source/Game/AI/ScriptedAI/ScriptedAI.cs index a3a8bc46e..255186e74 100644 --- a/Source/Game/AI/ScriptedAI/ScriptedAI.cs +++ b/Source/Game/AI/ScriptedAI/ScriptedAI.cs @@ -35,7 +35,7 @@ namespace Game.AI _difficulty = me.GetMap().GetDifficultyID(); } - void AttackStartNoMove(Unit target) + public void AttackStartNoMove(Unit target) { if (target == null) return; @@ -150,7 +150,7 @@ namespace Game.AI /// /// /// - void ResetThreat(Unit victim, Unit who) + public void ResetThreat(Unit victim, Unit who) { if (!victim) return; @@ -189,7 +189,7 @@ namespace Game.AI return who.GetThreatManager().GetThreat(victim); } - + //Spawns a creature relative to me public Creature DoSpawnCreature(uint entry, float offsetX, float offsetY, float offsetZ, float angle, TempSummonType type, uint despawntime) { @@ -261,7 +261,7 @@ namespace Game.AI return apSpell[RandomHelper.IRand(0, (int)(spellCount - 1))]; } - void DoTeleportTo(float x, float y, float z, uint time = 0) + public void DoTeleportTo(float x, float y, float z, uint time = 0) { me.Relocate(x, y, z); float speed = me.GetDistance(x, y, z) / (time * 0.001f); @@ -274,7 +274,7 @@ namespace Game.AI } //Teleports a player without dropping threat (only teleports to same map) - void DoTeleportPlayer(Unit unit, float x, float y, float z, float o) + public void DoTeleportPlayer(Unit unit, float x, float y, float z, float o) { if (unit == null) return; @@ -527,7 +527,7 @@ namespace Game.AI ScheduleTasks(); } - void TeleportCheaters() + public void TeleportCheaters() { float x, y, z; me.GetPosition(out x, out y, out z); @@ -748,6 +748,11 @@ namespace Game.AI public void Despawn(Creature summon) { Remove(summon.GetGUID()); } + public void DespawnIf(ICheck predicate) + { + this.RemoveAll(predicate); + } + public void DespawnIf(Predicate predicate) { RemoveAll(predicate); @@ -762,6 +767,14 @@ namespace Game.AI } } + public void DoAction(int info, ICheck predicate, ushort max = 0) + { + // We need to use a copy of SummonList here, otherwise original SummonList would be modified + List listCopy = new List(this); + listCopy.RandomResize(predicate.Invoke, max); + DoActionImpl(info, listCopy); + } + public void DoAction(int info, Predicate predicate, ushort max = 0) { // We need to use a copy of SummonList here, otherwise original SummonList would be modified @@ -794,4 +807,16 @@ namespace Game.AI Creature me; } + + public class EntryCheckPredicate : ICheck + { + public EntryCheckPredicate(uint entry) + { + _entry = entry; + } + + public bool Invoke(ObjectGuid guid) { return guid.GetEntry() == _entry; } + + uint _entry; + } } diff --git a/Source/Game/AI/ScriptedAI/ScriptedEscortAI.cs b/Source/Game/AI/ScriptedAI/ScriptedEscortAI.cs index c99ff18c4..58196585e 100644 --- a/Source/Game/AI/ScriptedAI/ScriptedEscortAI.cs +++ b/Source/Game/AI/ScriptedAI/ScriptedEscortAI.cs @@ -35,6 +35,8 @@ namespace Game.AI _activeAttacker = true; _despawnAtEnd = true; _despawnAtFar = true; + + _path = new WaypointPath(); } public Player GetPlayerForEscort() diff --git a/Source/Game/AI/SmartScripts/SmartAI.cs b/Source/Game/AI/SmartScripts/SmartAI.cs index 65a3f837e..9dcf3c9f7 100644 --- a/Source/Game/AI/SmartScripts/SmartAI.cs +++ b/Source/Game/AI/SmartScripts/SmartAI.cs @@ -117,6 +117,7 @@ namespace Game.AI return false; } + _path = new WaypointPath(); _path.id = path.id; _path.nodes = path.nodes; foreach (WaypointNode waypoint in _path.nodes) diff --git a/Source/Game/Combat/HostileRegManager.cs b/Source/Game/Combat/HostileRegManager.cs index 9f4b858fb..8f3393543 100644 --- a/Source/Game/Combat/HostileRegManager.cs +++ b/Source/Game/Combat/HostileRegManager.cs @@ -385,6 +385,8 @@ namespace Game.Combat return iUnitGuid; } + public Unit GetVictim() { return GetTarget(); } + public new HostileReference Next() { return (HostileReference)base.Next(); } float iThreat; diff --git a/Source/Game/Entities/GameObject/GameObject.cs b/Source/Game/Entities/GameObject/GameObject.cs index 468024e3f..cbb025197 100644 --- a/Source/Game/Entities/GameObject/GameObject.cs +++ b/Source/Game/Entities/GameObject/GameObject.cs @@ -474,8 +474,8 @@ namespace Game.Entities uint visualStateAfter = (m_goValue.Transport.StateUpdateTimer / 20000) & 1; if (visualStateBefore != visualStateAfter) { - m_gameObjectData.ModifyValue(m_gameObjectData.Level); - m_gameObjectData.ModifyValue(m_gameObjectData.State); + m_values.ModifyValue(m_gameObjectData).ModifyValue(m_gameObjectData.Level); + m_values.ModifyValue(m_gameObjectData).ModifyValue(m_gameObjectData.State); ForceUpdateFieldChange(); } } diff --git a/Source/Game/Entities/Object/Position.cs b/Source/Game/Entities/Object/Position.cs index 05dad5de2..4b2a130b5 100644 --- a/Source/Game/Entities/Object/Position.cs +++ b/Source/Game/Entities/Object/Position.cs @@ -285,7 +285,7 @@ namespace Game.Entities float verticalDelta = GetPositionZ() - center.GetPositionZ(); return IsInDist2d(center, radius) && Math.Abs(verticalDelta) <= height; } - + public bool HasInArc(float arc, Position obj, float border = 2.0f) { // always have self in arc diff --git a/Source/Game/Entities/Object/WorldObject.cs b/Source/Game/Entities/Object/WorldObject.cs index 86efd0b15..24b926353 100644 --- a/Source/Game/Entities/Object/WorldObject.cs +++ b/Source/Game/Entities/Object/WorldObject.cs @@ -1504,6 +1504,11 @@ namespace Game.Entities return summon; } + public void SummonCreatureGroup(byte group) + { + SummonCreatureGroup(group, out _); + } + public void SummonCreatureGroup(byte group, out List list) { Cypher.Assert((IsTypeId(TypeId.GameObject) || IsTypeId(TypeId.Unit)), "Only GOs and creatures can summon npc groups!"); @@ -2028,12 +2033,11 @@ namespace Game.Entities UpdateGroundPositionZ(rand_x, rand_y, ref rand_z); // update to LOS height if available } - public void GetRandomPoint(Position srcPos, float distance, out Position pos) + public Position GetRandomPoint(Position srcPos, float distance) { - pos = new Position(); float x, y, z; GetRandomPoint(srcPos, distance, out x, out y, out z); - pos.Relocate(x, y, z, GetOrientation()); + return new Position(x, y, z, GetOrientation()); } public void UpdateGroundPositionZ(float x, float y, ref float z) diff --git a/Source/Game/Entities/Player/Player.cs b/Source/Game/Entities/Player/Player.cs index ac088d8b3..b8fc97a81 100644 --- a/Source/Game/Entities/Player/Player.cs +++ b/Source/Game/Entities/Player/Player.cs @@ -7692,14 +7692,17 @@ namespace Game.Entities } //Helpers - public void ADD_GOSSIP_ITEM(GossipOptionIcon icon, string message, uint sender, uint action) { PlayerTalkClass.GetGossipMenu().AddMenuItem(-1, icon, message, sender, action, "", 0); } + public void AddGossipItem(GossipOptionIcon icon, string message, uint sender, uint action) { PlayerTalkClass.GetGossipMenu().AddMenuItem(-1, icon, message, sender, action, "", 0); } public void ADD_GOSSIP_ITEM_DB(uint menuId, uint menuItemId, uint sender, uint action) { PlayerTalkClass.GetGossipMenu().AddMenuItem(menuId, menuItemId, sender, action); } public void ADD_GOSSIP_ITEM_EXTENDED(GossipOptionIcon icon, string message, uint sender, uint action, string boxmessage, uint boxmoney, bool coded) { PlayerTalkClass.GetGossipMenu().AddMenuItem(-1, icon, message, sender, action, boxmessage, boxmoney, coded); } // This fuction Sends the current menu to show to client, a - NPCTEXTID(uint32), b - npc guid(uint64) - public void SEND_GOSSIP_MENU(uint titleId, ObjectGuid objGUID) { PlayerTalkClass.SendGossipMenu(titleId, objGUID); } + public void SendGossipMenu(uint titleId, ObjectGuid objGUID) { PlayerTalkClass.SendGossipMenu(titleId, objGUID); } // Closes the Menu - public void CLOSE_GOSSIP_MENU() { PlayerTalkClass.SendCloseGossip(); } + public void CloseGossipMenu() { PlayerTalkClass.SendCloseGossip(); } + + //Clears the Menu + public void ClearGossipMenu() { PlayerTalkClass.ClearMenus(); } } } diff --git a/Source/Game/Entities/StatSystem.cs b/Source/Game/Entities/StatSystem.cs index d80e13299..ef95b4a80 100644 --- a/Source/Game/Entities/StatSystem.cs +++ b/Source/Game/Entities/StatSystem.cs @@ -514,9 +514,9 @@ namespace Game.Entities public bool HealthBelowPct(int pct) { return GetHealth() < CountPctFromMaxHealth(pct); } public bool HealthBelowPctDamaged(int pct, uint damage) { return GetHealth() - damage < CountPctFromMaxHealth(pct); } public bool HealthAbovePct(int pct) { return GetHealth() > CountPctFromMaxHealth(pct); } - bool HealthAbovePctHealed(int pct, uint heal) { return GetHealth() + heal > CountPctFromMaxHealth(pct); } + public bool HealthAbovePctHealed(int pct, uint heal) { return GetHealth() + heal > CountPctFromMaxHealth(pct); } public ulong CountPctFromMaxHealth(int pct) { return MathFunctions.CalculatePct(GetMaxHealth(), pct); } - ulong CountPctFromCurHealth(int pct) { return MathFunctions.CalculatePct(GetHealth(), pct); } + public ulong CountPctFromCurHealth(int pct) { return MathFunctions.CalculatePct(GetHealth(), pct); } public virtual float GetHealthMultiplierForTarget(WorldObject target) { return 1.0f; } public virtual float GetDamageMultiplierForTarget(WorldObject target) { return 1.0f; } diff --git a/Source/Game/Entities/Unit/Unit.Fields.cs b/Source/Game/Entities/Unit/Unit.Fields.cs index c9978bb88..9c1145f2c 100644 --- a/Source/Game/Entities/Unit/Unit.Fields.cs +++ b/Source/Game/Entities/Unit/Unit.Fields.cs @@ -509,7 +509,7 @@ namespace Game.Entities public Unit GetDispeller() { return _dispellerUnit; } uint GetDispellerSpellId() { return _dispellerSpell; } public byte GetRemovedCharges() { return _chargesRemoved; } - void SetRemovedCharges(byte amount) + public void SetRemovedCharges(byte amount) { _chargesRemoved = amount; } diff --git a/Source/Game/Entities/Unit/Unit.Movement.cs b/Source/Game/Entities/Unit/Unit.Movement.cs index b2182c595..98e3048bf 100644 --- a/Source/Game/Entities/Unit/Unit.Movement.cs +++ b/Source/Game/Entities/Unit/Unit.Movement.cs @@ -39,7 +39,7 @@ namespace Game.Entities { return m_movementInfo.HasMovementFlag(MovementFlag.Walking); } - bool IsHovering() { return m_movementInfo.HasMovementFlag(MovementFlag.Hover); } + public bool IsHovering() { return m_movementInfo.HasMovementFlag(MovementFlag.Hover); } public bool IsStopped() { return !HasUnitState(UnitState.Moving); } public bool IsMoving() { return m_movementInfo.HasMovementFlag(MovementFlag.MaskMoving); } public bool IsTurning() { return m_movementInfo.HasMovementFlag(MovementFlag.MaskTurning); } diff --git a/Source/Game/Entities/Unit/Unit.cs b/Source/Game/Entities/Unit/Unit.cs index 2f1e04611..05b0d697d 100644 --- a/Source/Game/Entities/Unit/Unit.cs +++ b/Source/Game/Entities/Unit/Unit.cs @@ -1113,7 +1113,7 @@ namespace Game.Entities } public UnitAI GetAI() { return i_AI; } - void SetAI(UnitAI newAI) { i_AI = newAI; } + public void SetAI(UnitAI newAI) { i_AI = newAI; } public bool IsPossessing() { @@ -2351,7 +2351,7 @@ namespace Game.Entities else return ToCreature().GetCreatureTemplate().CreatureType; } - Player GetAffectingPlayer() + public Player GetAffectingPlayer() { if (GetCharmerOrOwnerGUID().IsEmpty()) return IsTypeId(TypeId.Player) ? ToPlayer() : null; diff --git a/Source/Game/Events/GameEventManager.cs b/Source/Game/Events/GameEventManager.cs index 7e14105df..a65cd0db9 100644 --- a/Source/Game/Events/GameEventManager.cs +++ b/Source/Game/Events/GameEventManager.cs @@ -24,6 +24,7 @@ using Game.Networking.Packets; using System; using System.Collections.Generic; using Framework.Collections; +using System.Linq; namespace Game { @@ -1559,7 +1560,7 @@ namespace Game { GameEventAIHookWorker worker = new GameEventAIHookWorker(event_id, activate); var visitor = new Visitor(worker, GridMapTypeMask.None); - visitor.Visit(map.GetObjectsStore()); + visitor.Visit(map.GetObjectsStore().Values.ToList()); }); } diff --git a/Source/Game/Garrisons/GarrisonMap.cs b/Source/Game/Garrisons/GarrisonMap.cs index 47d2fed67..da1345ea5 100644 --- a/Source/Game/Garrisons/GarrisonMap.cs +++ b/Source/Game/Garrisons/GarrisonMap.cs @@ -107,7 +107,7 @@ namespace Game.Garrisons Log.outDebug(LogFilter.Maps, "{0} GameObjects and {1} Creatures loaded for grid {2} on map {3}", i_gameObjects, i_creatures, i_grid.GetGridId(), i_map.GetId()); } - public override void Visit(IList objs) + public override void Visit(IList objs) { ICollection plots = i_garrison.GetPlots(); if (!plots.Empty()) @@ -131,6 +131,8 @@ namespace Game.Garrisons } } + public override void Visit(IList objs) { } + Cell i_cell; Grid i_grid; GarrisonMap i_map; diff --git a/Source/Game/Maps/Grid.cs b/Source/Game/Maps/Grid.cs index 1c608d1df..9994543ea 100644 --- a/Source/Game/Maps/Grid.cs +++ b/Source/Game/Maps/Grid.cs @@ -293,7 +293,7 @@ namespace Game.Maps visitor.Visit(_container.corpses); visitor.Visit(_container.areaTriggers); visitor.Visit(_container.conversations); - visitor.Visit(_container.worldObjects); + visitor.Visit(_container.worldObjects.ToArray()); break; case GridMapTypeMask.AllWorld: visitor.Visit(_objects.players); diff --git a/Source/Game/Maps/GridNotifiers.cs b/Source/Game/Maps/GridNotifiers.cs index f7ba5d339..ff640045e 100644 --- a/Source/Game/Maps/GridNotifiers.cs +++ b/Source/Game/Maps/GridNotifiers.cs @@ -73,8 +73,6 @@ namespace Game.Maps public void Visit(IList corpses) { _notifier.Visit(corpses); } public void Visit(IList players) { _notifier.Visit(players); } - public void Visit(Dictionary dict) { Visit(dict.Values.ToList()); } - Notifier _notifier; internal GridMapTypeMask _mask; } @@ -563,11 +561,10 @@ namespace Game.Maps public override void Visit(IList objs) { - for (var i = 0; i < objs.Count; ++i) + foreach (var obj in objs) { - var obj = objs[i]; if (obj.IsTypeId(TypeId.Player) || obj.IsTypeId(TypeId.Corpse)) - continue; + return; if (obj.IsInWorld) obj.Update(i_timeDiff); @@ -645,42 +642,85 @@ namespace Game.Maps i_do = _do; } - public override void Visit(IList objs) + public override void Visit(IList objs) { + if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.GameObject)) + return; + foreach (var obj in objs) { - switch (obj.GetTypeId()) - { - case TypeId.GameObject: - if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.GameObject)) - return; - break; - case TypeId.Player: - if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.Player)) - return; - break; - case TypeId.Unit: - if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.Creature)) - return; - break; - case TypeId.Corpse: - if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.Corpse)) - return; - break; - case TypeId.DynamicObject: - if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.DynamicObject)) - return; - break; - case TypeId.AreaTrigger: - if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.AreaTrigger)) - return; - break; - case TypeId.Conversation: - if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.Conversation)) - return; - break; - } + if (obj.IsInPhase(_searcher)) + i_do.Invoke(obj); + } + } + public override void Visit(IList objs) + { + if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.Player)) + return; + + foreach (var obj in objs) + { + if (obj.IsInPhase(_searcher)) + i_do.Invoke(obj); + } + } + + public override void Visit(IList objs) + { + if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.Creature)) + return; + + foreach (var obj in objs) + { + if (obj.IsInPhase(_searcher)) + i_do.Invoke(obj); + } + } + + public override void Visit(IList objs) + { + if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.Corpse)) + return; + + foreach (var obj in objs) + { + if (obj.IsInPhase(_searcher)) + i_do.Invoke(obj); + } + } + + public override void Visit(IList objs) + { + if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.DynamicObject)) + return; + + foreach (var obj in objs) + { + if (obj.IsInPhase(_searcher)) + i_do.Invoke(obj); + } + } + + public override void Visit(IList objs) + { + if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.AreaTrigger)) + return; + + foreach (var obj in objs) + { + if (obj.IsInPhase(_searcher)) + i_do.Invoke(obj); + } + } + + public override void Visit(IList objs) + { + if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.Conversation)) + return; + + foreach (var obj in objs) + { if (obj.IsInPhase(_searcher)) i_do.Invoke(obj); } @@ -918,46 +958,17 @@ namespace Game.Maps i_check = check; } - public override void Visit(IList objs) + public override void Visit(IList objs) { + if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.GameObject)) + return; + // already found if (i_object) return; foreach (var obj in objs) { - switch (obj.GetTypeId()) - { - case TypeId.Player: - if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.Player)) - continue; - break; - case TypeId.GameObject: - if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.GameObject)) - continue; - break; - case TypeId.Corpse: - if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.Corpse)) - continue; - break; - case TypeId.Unit: - if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.Creature)) - continue; - break; - case TypeId.DynamicObject: - if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.DynamicObject)) - continue; - break; - case TypeId.AreaTrigger: - if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.AreaTrigger)) - continue; - break; - case TypeId.Conversation: - if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.Conversation)) - continue; - break; - } - if (!obj.IsInPhase(_searcher)) continue; @@ -966,7 +977,138 @@ namespace Game.Maps i_object = obj; return; } + } + } + public override void Visit(IList objs) + { + if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.Player)) + return; + + // already found + if (i_object) + return; + + foreach (var obj in objs) + { + if (!obj.IsInPhase(_searcher)) + continue; + + if (i_check.Invoke(obj)) + { + i_object = obj; + return; + } + } + } + + public override void Visit(IList objs) + { + if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.Creature)) + return; + + // already found + if (i_object) + return; + + foreach (var obj in objs) + { + if (!obj.IsInPhase(_searcher)) + continue; + + if (i_check.Invoke(obj)) + { + i_object = obj; + return; + } + } + } + + public override void Visit(IList objs) + { + if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.Corpse)) + return; + + // already found + if (i_object) + return; + + foreach (var obj in objs) + { + if (!obj.IsInPhase(_searcher)) + continue; + + if (i_check.Invoke(obj)) + { + i_object = obj; + return; + } + } + } + + public override void Visit(IList objs) + { + if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.DynamicObject)) + return; + + // already found + if (i_object) + return; + + foreach (var obj in objs) + { + if (!obj.IsInPhase(_searcher)) + continue; + + if (i_check.Invoke(obj)) + { + i_object = obj; + return; + } + } + } + + public override void Visit(IList objs) + { + if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.AreaTrigger)) + return; + + // already found + if (i_object) + return; + + foreach (var obj in objs) + { + if (!obj.IsInPhase(_searcher)) + continue; + + if (i_check.Invoke(obj)) + { + i_object = obj; + return; + } + } + } + + public override void Visit(IList objs) + { + if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.Conversation)) + return; + + // already found + if (i_object) + return; + + foreach (var obj in objs) + { + if (!obj.IsInPhase(_searcher)) + continue; + + if (i_check.Invoke(obj)) + { + i_object = obj; + return; + } } } @@ -986,42 +1128,103 @@ namespace Game.Maps i_check = check; } - public override void Visit(IList objs) + public override void Visit(IList objs) { + if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.GameObject)) + return; + foreach (var obj in objs) { - switch (obj.GetTypeId()) - { - case TypeId.Player: - if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.Player)) - continue; - break; - case TypeId.GameObject: - if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.GameObject)) - continue; - break; - case TypeId.Corpse: - if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.Corpse)) - continue; - break; - case TypeId.Unit: - if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.Creature)) - continue; - break; - case TypeId.DynamicObject: - if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.DynamicObject)) - continue; - break; - case TypeId.AreaTrigger: - if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.AreaTrigger)) - continue; - break; - case TypeId.Conversation: - if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.Conversation)) - continue; - break; - } + if (!obj.IsInPhase(_searcher)) + continue; + if (i_check.Invoke(obj)) + i_object = obj; + } + } + + public override void Visit(IList objs) + { + if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.Player)) + return; + + foreach (var obj in objs) + { + if (!obj.IsInPhase(_searcher)) + continue; + + if (i_check.Invoke(obj)) + i_object = obj; + } + } + + public override void Visit(IList objs) + { + if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.Creature)) + return; + + foreach (var obj in objs) + { + if (!obj.IsInPhase(_searcher)) + continue; + + if (i_check.Invoke(obj)) + i_object = obj; + } + } + + public override void Visit(IList objs) + { + if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.Corpse)) + return; + + foreach (var obj in objs) + { + if (!obj.IsInPhase(_searcher)) + continue; + + if (i_check.Invoke(obj)) + i_object = obj; + } + } + + public override void Visit(IList objs) + { + if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.DynamicObject)) + return; + + foreach (var obj in objs) + { + if (!obj.IsInPhase(_searcher)) + continue; + + if (i_check.Invoke(obj)) + i_object = obj; + } + } + + public override void Visit(IList objs) + { + if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.AreaTrigger)) + return; + + foreach (var obj in objs) + { + if (!obj.IsInPhase(_searcher)) + continue; + + if (i_check.Invoke(obj)) + i_object = obj; + } + } + + public override void Visit(IList objs) + { + if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.Conversation)) + return; + + foreach (var obj in objs) + { if (!obj.IsInPhase(_searcher)) continue; @@ -1047,45 +1250,74 @@ namespace Game.Maps i_check = check; } - public override void Visit(IList objs) + public override void Visit(IList objs) { - foreach (var obj in objs) - { - switch (obj.GetTypeId()) - { - case TypeId.Player: - if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.Player)) - continue; - break; - case TypeId.GameObject: - if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.GameObject)) - continue; - break; - case TypeId.Corpse: - if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.Corpse)) - continue; - break; - case TypeId.Unit: - if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.Creature)) - continue; - break; - case TypeId.DynamicObject: - if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.DynamicObject)) - continue; - break; - case TypeId.AreaTrigger: - if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.AreaTrigger)) - continue; - break; - case TypeId.Conversation: - if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.Conversation)) - continue; - break; - } + if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.Player)) + return; + foreach (var obj in objs) + if (i_check.Invoke(obj)) + i_objects.Add(obj); + } + + public override void Visit(IList objs) + { + if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.Creature)) + return; + + foreach (var obj in objs) + if (i_check.Invoke(obj)) + i_objects.Add(obj); + } + + public override void Visit(IList objs) + { + if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.Corpse)) + return; + + foreach (var obj in objs) + if (i_check.Invoke(obj)) + i_objects.Add(obj); + } + + public override void Visit(IList objs) + { + if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.GameObject)) + return; + + foreach (var obj in objs) + if (i_check.Invoke(obj)) + i_objects.Add(obj); + } + + public override void Visit(IList objs) + { + if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.DynamicObject)) + return; + + foreach (var obj in objs) + if (i_check.Invoke(obj)) + i_objects.Add(obj); + } + + public override void Visit(IList objs) + { + if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.AreaTrigger)) + return; + + foreach (var obj in objs) + if (i_check.Invoke(obj)) + i_objects.Add(obj); + } + + public override void Visit(IList objs) + { + if (!i_mapTypeMask.HasAnyFlag(GridMapTypeMask.Conversation)) + return; + + foreach (var obj in objs) if (i_check.Invoke(obj)) i_objects.Add(obj); - } } GridMapTypeMask i_mapTypeMask; @@ -2099,7 +2331,7 @@ namespace Game.Maps float m_fRange; } - class AllCreaturesOfEntryInRange : ICheck + public class AllCreaturesOfEntryInRange : ICheck { public AllCreaturesOfEntryInRange(WorldObject obj, uint entry, float maxRange) { @@ -2181,7 +2413,7 @@ namespace Game.Maps float m_fRange; } - class ObjectTypeIdCheck : ICheck + public class ObjectTypeIdCheck : ICheck { public ObjectTypeIdCheck(TypeId typeId, bool equals) { @@ -2218,7 +2450,7 @@ namespace Game.Maps ObjectGuid _GUID; } - class HeightDifferenceCheck : ICheck + public class HeightDifferenceCheck : ICheck { public HeightDifferenceCheck(WorldObject go, float diff, bool reverse) { diff --git a/Source/Game/Maps/Instances/InstanceScript.cs b/Source/Game/Maps/Instances/InstanceScript.cs index dcc4b1516..ffad22020 100644 --- a/Source/Game/Maps/Instances/InstanceScript.cs +++ b/Source/Game/Maps/Instances/InstanceScript.cs @@ -725,7 +725,7 @@ namespace Game.Maps instance.SendToPlayers(new InstanceEncounterEnd()); } - void SendBossKillCredit(uint encounterId) + public void SendBossKillCredit(uint encounterId) { BossKill bossKillCreditMessage = new BossKill(); bossKillCreditMessage.DungeonEncounterID = encounterId; diff --git a/Source/Game/Maps/Map.cs b/Source/Game/Maps/Map.cs index f73d88727..c1215c7db 100644 --- a/Source/Game/Maps/Map.cs +++ b/Source/Game/Maps/Map.cs @@ -3558,7 +3558,7 @@ namespace Game.Maps return info.DefaultWeather; } - void SetZoneWeather(uint zoneId, WeatherState weatherId, float weatherGrade) + public void SetZoneWeather(uint zoneId, WeatherState weatherId, float weatherGrade) { if (!_zoneDynamicInfo.ContainsKey(zoneId)) _zoneDynamicInfo[zoneId] = new ZoneDynamicInfo(); @@ -3580,7 +3580,7 @@ namespace Game.Maps } } - void SetZoneOverrideLight(uint zoneId, uint lightId, uint fadeInTime) + public void SetZoneOverrideLight(uint zoneId, uint lightId, uint fadeInTime) { if (!_zoneDynamicInfo.ContainsKey(zoneId)) _zoneDynamicInfo[zoneId] = new ZoneDynamicInfo(); diff --git a/Source/Game/Maps/ObjectGridLoader.cs b/Source/Game/Maps/ObjectGridLoader.cs index 87202b5c0..e75dd6c46 100644 --- a/Source/Game/Maps/ObjectGridLoader.cs +++ b/Source/Game/Maps/ObjectGridLoader.cs @@ -271,7 +271,7 @@ namespace Game.Maps { foreach (var obj in objs) { - if (obj.IsTypeId(TypeId.Player) || obj.IsTypeId(TypeId.Corpse)) + if (obj.IsTypeId(TypeId.Corpse)) continue; // if option set then object already saved at this moment diff --git a/Source/Game/Movement/Generators/PointMovement.cs b/Source/Game/Movement/Generators/PointMovement.cs index fa762cf13..f3f19d15c 100644 --- a/Source/Game/Movement/Generators/PointMovement.cs +++ b/Source/Game/Movement/Generators/PointMovement.cs @@ -196,7 +196,7 @@ namespace Game.Movement if (_arrivalSpellId != 0) owner.CastSpell(Global.ObjAccessor.GetUnit(owner, _arrivalSpellTargetGuid), _arrivalSpellId, true); - if (owner.ToCreature().GetAI() != null) + if (owner.ToCreature() && owner.ToCreature().GetAI() != null) owner.ToCreature().GetAI().MovementInform(MovementGeneratorType.Effect, _pointId); } diff --git a/Source/Game/Movement/MotionMaster.cs b/Source/Game/Movement/MotionMaster.cs index 724bcee28..72d3a3f5e 100644 --- a/Source/Game/Movement/MotionMaster.cs +++ b/Source/Game/Movement/MotionMaster.cs @@ -270,7 +270,7 @@ namespace Game.Movement StartMovement(new PointMovementGenerator(id, x, y, z, generatePath), MovementSlot.Active); } - void MoveCloserAndStop(uint id, Unit target, float distance) + public void MoveCloserAndStop(uint id, Unit target, float distance) { float distanceToTravel = _owner.GetExactDist2d(target) - distance; if (distanceToTravel > 0.0f) @@ -303,7 +303,7 @@ namespace Game.Movement StartMovement(new EffectMovementGenerator(id), MovementSlot.Active); } - void MoveTakeoff(uint id, Position pos) + public void MoveTakeoff(uint id, Position pos) { float x, y, z; pos.GetPosition(out x, out y, out z); @@ -421,7 +421,7 @@ namespace Game.Movement StartMovement(new EffectMovementGenerator(id, arrivalSpellId, arrivalSpellTargetGuid), MovementSlot.Controlled); } - void MoveCirclePath(float x, float y, float z, float radius, bool clockwise, byte stepCount) + public void MoveCirclePath(float x, float y, float z, float radius, bool clockwise, byte stepCount) { float step = 2 * MathFunctions.PI / stepCount * (clockwise ? -1.0f : 1.0f); Position pos = new Position(x, y, z, 0.0f); @@ -480,7 +480,7 @@ namespace Game.Movement //MovePoint(EVENT_CHARGE_PREPATH, pos, false); } - void MoveAlongSplineChain(uint pointId, uint dbChainId, bool walk) + public void MoveAlongSplineChain(uint pointId, uint dbChainId, bool walk) { Creature owner = _owner.ToCreature(); if (!owner) @@ -606,7 +606,7 @@ namespace Game.Movement StartMovement(new WaypointMovementGenerator(path, repeatable), MovementSlot.Idle); } - void MoveRotate(uint time, RotateDirection direction) + public void MoveRotate(uint time, RotateDirection direction) { if (time == 0) return; diff --git a/Source/Game/Scripting/CoreScripts.cs b/Source/Game/Scripting/CoreScripts.cs index 7e8dd705d..5c8577c8b 100644 --- a/Source/Game/Scripting/CoreScripts.cs +++ b/Source/Game/Scripting/CoreScripts.cs @@ -540,7 +540,7 @@ namespace Game.Scripting Global.ScriptMgr.AddScript(this); } - public override bool IsDatabaseBound() { return true; } + public override bool IsDatabaseBound() { return false; } // Called when an additional criteria is checked. public virtual bool OnCheck(Player source, Unit target) { return false; } diff --git a/Source/Game/Scripting/ScriptManager.cs b/Source/Game/Scripting/ScriptManager.cs index bbca2ea1d..a41f0eec6 100644 --- a/Source/Game/Scripting/ScriptManager.cs +++ b/Source/Game/Scripting/ScriptManager.cs @@ -168,6 +168,7 @@ namespace Game.Scripting case "GuildScript": case "GroupScript": case "AreaTriggerEntityScript": + case "OnlyOnceAreaTriggerScript": case "SceneScript": if (!attribute.Name.IsEmpty()) name = attribute.Name; diff --git a/Source/Game/Spells/Auras/AuraEffect.cs b/Source/Game/Spells/Auras/AuraEffect.cs index 579e83773..9c8a0b687 100644 --- a/Source/Game/Spells/Auras/AuraEffect.cs +++ b/Source/Game/Spells/Auras/AuraEffect.cs @@ -1676,7 +1676,7 @@ namespace Game.Spells [AuraEffectHandler(AuraType.ModScale)] [AuraEffectHandler(AuraType.ModScale2)] - void HandleAuraModScale(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply) + public void HandleAuraModScale(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply) { if (!mode.HasAnyFlag(AuraEffectHandleModes.ChangeAmountSendForClientMask)) return; diff --git a/Source/Game/Spells/SpellEffects.cs b/Source/Game/Spells/SpellEffects.cs index 95eff8e66..05112c16a 100644 --- a/Source/Game/Spells/SpellEffects.cs +++ b/Source/Game/Spells/SpellEffects.cs @@ -1720,7 +1720,7 @@ namespace Game.Spells pos = destTarget; else // randomize position for multiple summons - m_caster.GetRandomPoint(destTarget, radius, out pos); + pos = m_caster.GetRandomPoint(destTarget, radius); summon = m_originalCaster.SummonCreature(entry, pos, summonType, (uint)duration, 0, personalSpawn); if (summon == null) @@ -4972,7 +4972,7 @@ namespace Game.Spells pos = destTarget; else // randomize position for multiple summons - m_caster.GetRandomPoint(destTarget, radius, out pos); + pos = m_caster.GetRandomPoint(destTarget, radius); TempSummon summon = map.SummonCreature(entry, pos, properties, (uint)duration, caster, m_spellInfo.Id); if (summon == null) diff --git a/Source/Game/Spells/SpellInfo.cs b/Source/Game/Spells/SpellInfo.cs index ccfdf83e0..2968def86 100644 --- a/Source/Game/Spells/SpellInfo.cs +++ b/Source/Game/Spells/SpellInfo.cs @@ -3611,7 +3611,6 @@ namespace Game.Spells Dictionary _effects = new Dictionary(); List _visuals = new List(); - bool _hasPowerDifficultyData; SpellSpecificType _spellSpecific; AuraStateType _auraState; diff --git a/Source/Game/Text/CreatureTextManager.cs b/Source/Game/Text/CreatureTextManager.cs index a7818e07a..1203dc356 100644 --- a/Source/Game/Text/CreatureTextManager.cs +++ b/Source/Game/Text/CreatureTextManager.cs @@ -256,7 +256,7 @@ namespace Game return dist; } - void SendSound(Creature source, uint sound, ChatMsg msgType, WorldObject whisperTarget = null, CreatureTextRange range = CreatureTextRange.Normal, Team team = Team.Other, bool gmOnly = false) + public void SendSound(Creature source, uint sound, ChatMsg msgType, WorldObject whisperTarget = null, CreatureTextRange range = CreatureTextRange.Normal, Team team = Team.Other, bool gmOnly = false) { if (sound == 0 || !source) return;