Core/Refactor: Part 3
This commit is contained in:
@@ -740,7 +740,7 @@ namespace Game.Entities
|
||||
|
||||
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
|
||||
public uint GetElapsedTimeForMovement() { return GetTimeSinceCreated(); } // @todo: research the right value, in sniffs both timers are nearly identical
|
||||
|
||||
ObjectGuid _targetGuid;
|
||||
|
||||
|
||||
@@ -121,41 +121,39 @@ namespace Game.Entities
|
||||
switch (TriggerType)
|
||||
{
|
||||
case AreaTriggerTypes.Sphere:
|
||||
{
|
||||
MaxSearchRadius = Math.Max(SphereDatas.Radius, SphereDatas.RadiusTarget);
|
||||
break;
|
||||
}
|
||||
{
|
||||
MaxSearchRadius = Math.Max(SphereDatas.Radius, SphereDatas.RadiusTarget);
|
||||
break;
|
||||
}
|
||||
case AreaTriggerTypes.Box:
|
||||
{
|
||||
fixed (float* ptr = BoxDatas.Extents)
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
fixed (float* ptr = BoxDatas.Extents)
|
||||
{
|
||||
MaxSearchRadius = (float)Math.Sqrt(ptr[0] * ptr[0] / 4 + ptr[1] * ptr[1] / 4);
|
||||
}
|
||||
}
|
||||
break;
|
||||
MaxSearchRadius = (float) Math.Sqrt(ptr[0] * ptr[0] / 4 + ptr[1] * ptr[1] / 4);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case AreaTriggerTypes.Polygon:
|
||||
{
|
||||
if (PolygonDatas.Height <= 0.0f)
|
||||
PolygonDatas.Height = 1.0f;
|
||||
|
||||
foreach (Vector2 vertice in PolygonVertices)
|
||||
{
|
||||
if (PolygonDatas.Height <= 0.0f)
|
||||
PolygonDatas.Height = 1.0f;
|
||||
float pointDist = vertice.GetLength();
|
||||
|
||||
foreach (Vector2 vertice in PolygonVertices)
|
||||
{
|
||||
float pointDist = vertice.GetLength();
|
||||
|
||||
if (pointDist > MaxSearchRadius)
|
||||
MaxSearchRadius = pointDist;
|
||||
}
|
||||
|
||||
break;
|
||||
if (pointDist > MaxSearchRadius)
|
||||
MaxSearchRadius = pointDist;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case AreaTriggerTypes.Cylinder:
|
||||
{
|
||||
MaxSearchRadius = CylinderDatas.Radius;
|
||||
break;
|
||||
}
|
||||
{
|
||||
MaxSearchRadius = CylinderDatas.Radius;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Game.Entities
|
||||
|
||||
public override void AddToWorld()
|
||||
{
|
||||
///- Register the Conversation for guid lookup and for caster
|
||||
//- Register the Conversation for guid lookup and for caster
|
||||
if (!IsInWorld)
|
||||
{
|
||||
GetMap().GetObjectsStore().Add(GetGUID(), this);
|
||||
@@ -50,7 +50,7 @@ namespace Game.Entities
|
||||
|
||||
public override void RemoveFromWorld()
|
||||
{
|
||||
///- Remove the Conversation from the accessor and from all lists of objects in world
|
||||
//- Remove the Conversation from the accessor and from all lists of objects in world
|
||||
if (IsInWorld)
|
||||
{
|
||||
base.RemoveFromWorld();
|
||||
@@ -110,7 +110,7 @@ namespace Game.Entities
|
||||
SetMap(map);
|
||||
Relocate(pos);
|
||||
|
||||
base._Create(ObjectGuid.Create(HighGuid.Conversation, GetMapId(), conversationEntry, lowGuid));
|
||||
_Create(ObjectGuid.Create(HighGuid.Conversation, GetMapId(), conversationEntry, lowGuid));
|
||||
PhasingHandler.InheritPhaseShift(this, creator);
|
||||
|
||||
SetEntry(conversationEntry);
|
||||
|
||||
@@ -1177,7 +1177,7 @@ namespace Game.Entities
|
||||
SetModifierValue(UnitMods.AttackPower, UnitModifierType.BaseValue, stats.AttackPower);
|
||||
SetModifierValue(UnitMods.AttackPowerRanged, UnitModifierType.BaseValue, stats.RangedAttackPower);
|
||||
|
||||
float armor = stats.GenerateArmor(cInfo); /// @todo Why is this treated as uint32 when it's a float?
|
||||
float armor = stats.GenerateArmor(cInfo); // @todo Why is this treated as uint32 when it's a float?
|
||||
SetModifierValue(UnitMods.Armor, UnitModifierType.BaseValue, armor);
|
||||
}
|
||||
|
||||
|
||||
@@ -73,20 +73,20 @@ namespace Game.Misc
|
||||
/// <param name="action">action Custom action given to OnGossipHello.</param>
|
||||
public void AddMenuItem(uint menuId, uint optionIndex, uint sender, uint action)
|
||||
{
|
||||
/// Find items for given menu id.
|
||||
// Find items for given menu id.
|
||||
var bounds = Global.ObjectMgr.GetGossipMenuItemsMapBounds(menuId);
|
||||
/// Return if there are none.
|
||||
// Return if there are none.
|
||||
if (bounds.Empty())
|
||||
return;
|
||||
|
||||
/// Iterate over each of them.
|
||||
// Iterate over each of them.
|
||||
foreach (var item in bounds)
|
||||
{
|
||||
// Find the one with the given menu item id.
|
||||
if (item.OptionIndex != optionIndex)
|
||||
continue;
|
||||
|
||||
/// Store texts for localization.
|
||||
// Store texts for localization.
|
||||
string strOptionText = "", strBoxText = "";
|
||||
BroadcastTextRecord optionBroadcastText = CliDB.BroadcastTextStorage.LookupByKey(item.OptionBroadcastTextId);
|
||||
BroadcastTextRecord boxBroadcastText = CliDB.BroadcastTextStorage.LookupByKey(item.BoxBroadcastTextId);
|
||||
|
||||
@@ -396,16 +396,16 @@ namespace Game.Entities
|
||||
case GameObjectTypes.Trap:
|
||||
{
|
||||
// Arming Time for GAMEOBJECT_TYPE_TRAP (6)
|
||||
GameObjectTemplate m_goInfo = GetGoInfo();
|
||||
GameObjectTemplate goInfo = GetGoInfo();
|
||||
|
||||
// Bombs
|
||||
Unit owner = GetOwner();
|
||||
if (m_goInfo.Trap.charges == 2)
|
||||
if (goInfo.Trap.charges == 2)
|
||||
m_cooldownTime = (uint)Time.UnixTime + 10; // Hardcoded tooltip value
|
||||
else if (owner)
|
||||
{
|
||||
if (owner.IsInCombat())
|
||||
m_cooldownTime = (uint)Time.UnixTime + m_goInfo.Trap.startDelay;
|
||||
m_cooldownTime = (uint)Time.UnixTime + goInfo.Trap.startDelay;
|
||||
}
|
||||
m_lootState = LootState.Ready;
|
||||
break;
|
||||
@@ -1552,7 +1552,7 @@ namespace Game.Entities
|
||||
|
||||
player.UpdateFishingSkill();
|
||||
|
||||
/// @todo find reasonable value for fishing hole search
|
||||
// @todo find reasonable value for fishing hole search
|
||||
GameObject fishingPool = LookupFishingHoleAround(20.0f + SharedConst.ContactDistance);
|
||||
|
||||
// If fishing skill is high enough, or if fishing on a pool, send correct loot.
|
||||
|
||||
@@ -2563,13 +2563,13 @@ namespace Game.Entities
|
||||
{
|
||||
Log.outDebug(LogFilter.Spells, "Player.AddSpellMod {0}", mod.spellId);
|
||||
|
||||
/// First, manipulate our spellmodifier container
|
||||
// First, manipulate our spellmodifier container
|
||||
if (apply)
|
||||
m_spellMods[(int)mod.op][(int)mod.type].Add(mod);
|
||||
else
|
||||
m_spellMods[(int)mod.op][(int)mod.type].Remove(mod);
|
||||
|
||||
/// Now, send spellmodifier packet
|
||||
// Now, send spellmodifier packet
|
||||
if (!IsLoading())
|
||||
{
|
||||
ServerOpcodes opcode = (mod.type == SpellModType.Flat ? ServerOpcodes.SetFlatSpellModifier : ServerOpcodes.SetPctSpellModifier);
|
||||
|
||||
@@ -1952,7 +1952,7 @@ namespace Game.Entities
|
||||
//move player's guid into HateOfflineList of those mobs
|
||||
//which can't swim and move guid back into ThreatList when
|
||||
//on surface.
|
||||
/// @todo exist also swimming mobs, and function must be symmetric to enter/leave water
|
||||
// @todo exist also swimming mobs, and function must be symmetric to enter/leave water
|
||||
m_isInWater = apply;
|
||||
|
||||
// remove auras that need water/land
|
||||
@@ -5283,7 +5283,7 @@ namespace Game.Entities
|
||||
packet.Level = level;
|
||||
packet.HealthDelta = 0;
|
||||
|
||||
/// @todo find some better solution
|
||||
// @todo find some better solution
|
||||
packet.PowerDelta[0] = (int)basemana - (int)GetCreateMana();
|
||||
packet.PowerDelta[1] = 0;
|
||||
packet.PowerDelta[2] = 0;
|
||||
@@ -5584,18 +5584,18 @@ namespace Game.Entities
|
||||
loginSetTimeSpeed.NewSpeed = TimeSpeed;
|
||||
loginSetTimeSpeed.GameTime = (uint)Global.WorldMgr.GetGameTime();
|
||||
loginSetTimeSpeed.ServerTime = (uint)Global.WorldMgr.GetGameTime();
|
||||
loginSetTimeSpeed.GameTimeHolidayOffset = 0; /// @todo
|
||||
loginSetTimeSpeed.ServerTimeHolidayOffset = 0; /// @todo
|
||||
loginSetTimeSpeed.GameTimeHolidayOffset = 0; // @todo
|
||||
loginSetTimeSpeed.ServerTimeHolidayOffset = 0; // @todo
|
||||
SendPacket(loginSetTimeSpeed);
|
||||
|
||||
// SMSG_WORLD_SERVER_INFO
|
||||
WorldServerInfo worldServerInfo = new WorldServerInfo();
|
||||
worldServerInfo.InstanceGroupSize.Set(GetMap().GetMapDifficulty().MaxPlayers); /// @todo
|
||||
worldServerInfo.IsTournamentRealm = 0; /// @todo
|
||||
worldServerInfo.RestrictedAccountMaxLevel.Clear(); /// @todo
|
||||
worldServerInfo.RestrictedAccountMaxMoney.Clear(); /// @todo
|
||||
worldServerInfo.InstanceGroupSize.Set(GetMap().GetMapDifficulty().MaxPlayers); // @todo
|
||||
worldServerInfo.IsTournamentRealm = 0; // @todo
|
||||
worldServerInfo.RestrictedAccountMaxLevel.Clear(); // @todo
|
||||
worldServerInfo.RestrictedAccountMaxMoney.Clear(); // @todo
|
||||
worldServerInfo.DifficultyID = (uint)GetMap().GetDifficultyID();
|
||||
// worldServerInfo.XRealmPvpAlert; /// @todo
|
||||
// worldServerInfo.XRealmPvpAlert; // @todo
|
||||
SendPacket(worldServerInfo);
|
||||
|
||||
// Spell modifiers
|
||||
|
||||
@@ -232,7 +232,7 @@ namespace Game.Entities
|
||||
|
||||
public override void UpdateObjectVisibilityOnCreate()
|
||||
{
|
||||
base.UpdateObjectVisibility(true);
|
||||
UpdateObjectVisibility(true);
|
||||
}
|
||||
|
||||
public void SetTempSummonType(TempSummonType type)
|
||||
|
||||
@@ -2411,7 +2411,7 @@ namespace Game.Entities
|
||||
|
||||
bool defaultPrevented = false;
|
||||
|
||||
absorbAurEff.GetBase().CallScriptEffectManaShieldHandlers(absorbAurEff, aurApp, damageInfo, ref tempAbsorb, defaultPrevented);
|
||||
absorbAurEff.GetBase().CallScriptEffectManaShieldHandlers(absorbAurEff, aurApp, damageInfo, ref tempAbsorb, ref defaultPrevented);
|
||||
currentAbsorb = (int)tempAbsorb;
|
||||
|
||||
if (defaultPrevented)
|
||||
|
||||
@@ -476,11 +476,11 @@ namespace Game.Entities
|
||||
hitOutCome = _hitOutCome;
|
||||
}
|
||||
|
||||
public uint absorbed_damage { get; set; }
|
||||
public uint absorbed_damage { get; }
|
||||
public uint mitigated_damage { get; set; }
|
||||
|
||||
public WeaponAttackType attackType { get; set; }
|
||||
public MeleeHitOutcome hitOutCome { get; set; }
|
||||
public WeaponAttackType attackType { get; }
|
||||
public MeleeHitOutcome hitOutCome { get; }
|
||||
}
|
||||
|
||||
public class DispelInfo
|
||||
|
||||
@@ -2243,7 +2243,7 @@ namespace Game.Entities
|
||||
|
||||
spellHealLog.Crit = critical;
|
||||
|
||||
/// @todo: 6.x Has to be implemented
|
||||
// @todo: 6.x Has to be implemented
|
||||
/*
|
||||
var hasCritRollMade = spellHealLog.WriteBit("HasCritRollMade");
|
||||
var hasCritRollNeeded = spellHealLog.WriteBit("HasCritRollNeeded");
|
||||
@@ -2494,7 +2494,7 @@ namespace Game.Entities
|
||||
spellLogEffect.AbsorbedOrAmplitude = info.absorb;
|
||||
spellLogEffect.Resisted = info.resist;
|
||||
spellLogEffect.Crit = info.critical;
|
||||
/// @todo: implement debug info
|
||||
// @todo: implement debug info
|
||||
|
||||
SandboxScalingData sandboxScalingData = new SandboxScalingData();
|
||||
Unit caster = Global.ObjAccessor.GetUnit(this, aura.GetCasterGUID());
|
||||
@@ -4181,10 +4181,9 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
bool remove = false;
|
||||
var appliedAuraList = GetAppliedAuras();
|
||||
for (var i = 0; i < appliedAuraList.Count; i++)
|
||||
for (var i = 0; i < m_appliedAuras.KeyValueList.Count; i++)
|
||||
{
|
||||
var app = appliedAuraList[i];
|
||||
var app = m_appliedAuras.KeyValueList[i];
|
||||
if (remove)
|
||||
{
|
||||
remove = false;
|
||||
@@ -4195,7 +4194,7 @@ namespace Game.Entities
|
||||
continue;
|
||||
|
||||
RemoveAura(app, AuraRemoveMode.Default);
|
||||
if (i == appliedAuraList.Count - 1)
|
||||
if (i == m_appliedAuras.KeyValueList.Count - 1)
|
||||
break;
|
||||
|
||||
remove = true;
|
||||
|
||||
@@ -227,7 +227,7 @@ namespace Game.Entities
|
||||
{
|
||||
var seat = Seats.LookupByKey(seatId);
|
||||
if (seat == null)
|
||||
return seat;
|
||||
return null;
|
||||
|
||||
foreach (var sea in Seats)
|
||||
{
|
||||
@@ -633,7 +633,7 @@ namespace Game.Entities
|
||||
Log.outDebug(LogFilter.Vehicle, "Passenger GuidLow: {0}, Entry: {1}, board on vehicle GuidLow: {2}, Entry: {3} SeatId: {4} cancelled",
|
||||
Passenger.GetGUID().ToString(), Passenger.GetEntry(), Target.GetBase().GetGUID().ToString(), Target.GetBase().GetEntry(), Seat.Key);
|
||||
|
||||
/// Remove the pending event when Abort was called on the event directly
|
||||
// Remove the pending event when Abort was called on the event directly
|
||||
Target.RemovePendingEvent(this);
|
||||
|
||||
// @SPELL_AURA_CONTROL_VEHICLE auras can be applied even when the passenger is not (yet) on the vehicle.
|
||||
|
||||
Reference in New Issue
Block a user