Core/Refactor: Part 2

This commit is contained in:
hondacrx
2018-05-07 22:07:35 -04:00
parent 216db1c23a
commit 9b40067017
93 changed files with 321 additions and 388 deletions
@@ -252,8 +252,8 @@ namespace Scripts.EasternKingdoms.Karazhan
{
OUT_SAVE_INST_DATA();
strSaveData = string.Format("{0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10} {11}", m_auiEncounter[0], m_auiEncounter[1], m_auiEncounter[2], m_auiEncounter[3],
m_auiEncounter[4], m_auiEncounter[5], m_auiEncounter[6], m_auiEncounter[7], m_auiEncounter[8], m_auiEncounter[9], m_auiEncounter[10], m_auiEncounter[11]);
strSaveData =
$"{m_auiEncounter[0]} {m_auiEncounter[1]} {m_auiEncounter[2]} {m_auiEncounter[3]} {m_auiEncounter[4]} {m_auiEncounter[5]} {m_auiEncounter[6]} {m_auiEncounter[7]} {m_auiEncounter[8]} {m_auiEncounter[9]} {m_auiEncounter[10]} {m_auiEncounter[11]}";
SaveToDB();
OUT_SAVE_INST_DATA_COMPLETE();
@@ -330,16 +330,16 @@ namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheChampion
}
}
bool GrandChampionsOutVehicle(Creature me)
bool GrandChampionsOutVehicle(Creature creature)
{
InstanceScript instance = me.GetInstanceScript();
InstanceScript instance = creature.GetInstanceScript();
if (instance == null)
return false;
Creature pGrandChampion1 = ObjectAccessor.GetCreature(me, instance.GetGuidData((uint)Data64.DATA_GRAND_CHAMPION_1));
Creature pGrandChampion2 = ObjectAccessor.GetCreature(me, instance.GetGuidData((uint)Data64.DATA_GRAND_CHAMPION_2));
Creature pGrandChampion3 = ObjectAccessor.GetCreature(me, instance.GetGuidData((uint)Data64.DATA_GRAND_CHAMPION_3));
Creature pGrandChampion1 = ObjectAccessor.GetCreature(creature, instance.GetGuidData((uint)Data64.DATA_GRAND_CHAMPION_1));
Creature pGrandChampion2 = ObjectAccessor.GetCreature(creature, instance.GetGuidData((uint)Data64.DATA_GRAND_CHAMPION_2));
Creature pGrandChampion3 = ObjectAccessor.GetCreature(creature, instance.GetGuidData((uint)Data64.DATA_GRAND_CHAMPION_3));
if (pGrandChampion1 && pGrandChampion2 && pGrandChampion3)
{
@@ -266,7 +266,8 @@ namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheChampion
{
OUT_SAVE_INST_DATA();
string str_data = string.Format("T C {0} {1} {2} {3} {4} {5}", m_auiEncounter[0], m_auiEncounter[1], m_auiEncounter[2], m_auiEncounter[3], uiGrandChampionsDeaths, uiMovementDone);
string str_data =
$"T C {m_auiEncounter[0]} {m_auiEncounter[1]} {m_auiEncounter[2]} {m_auiEncounter[3]} {uiGrandChampionsDeaths} {uiMovementDone}";
OUT_SAVE_INST_DATA_COMPLETE();
return str_data;
@@ -309,10 +309,7 @@ namespace Scripts.Northrend.FrozenHalls.ForgeOfSouls.Bronjahm
void FilterTargets(List<WorldObject> targets)
{
Unit caster = GetCaster();
targets.RemoveAll(target =>
{
return caster.GetExactDist2d(target) <= 10.0f;
});
targets.RemoveAll(target => caster.GetExactDist2d(target) <= 10.0f);
}
public override void Register()
+1 -1
View File
@@ -1741,7 +1741,7 @@ namespace Scripts.Northrend.Ulduar
{
void FilterTargets(List<WorldObject> targets)
{
targets.RemoveAll(obj => { return obj.ToUnit() && (obj.ToUnit().GetVehicleBase() || obj.HasFlag(UnitFields.Flags, UnitFlags.NonAttackable)); });
targets.RemoveAll(obj => obj.ToUnit() && (obj.ToUnit().GetVehicleBase() || obj.HasFlag(UnitFields.Flags, UnitFlags.NonAttackable)));
}
public override void Register()
+1 -1
View File
@@ -649,7 +649,7 @@ namespace Scripts.Spells.Druid
Unit caster = eventInfo.GetActor();
var costs = spell.GetPowerCost();
var m = costs.First(cost => { return cost.Power == PowerType.Mana; });
var m = costs.First(cost => cost.Power == PowerType.Mana);
if (m == null)
return;
+2 -5
View File
@@ -1462,7 +1462,7 @@ namespace Scripts.Spells.Items
if (spell != null)
{
var costs = spell.GetPowerCost();
var m = costs.FirstOrDefault(cost => { return cost.Power == PowerType.Mana && cost.Amount > 0; });
var m = costs.FirstOrDefault(cost => cost.Power == PowerType.Mana && cost.Amount > 0);
if (m != null)
return true;
}
@@ -3040,10 +3040,7 @@ namespace Scripts.Spells.Items
void FilterTargets(List<WorldObject> targets)
{
targets.RemoveAll(obj =>
{
return !obj.IsTypeId(TypeId.Player) && !obj.IsTypeId(TypeId.Corpse);
});
targets.RemoveAll(obj => !obj.IsTypeId(TypeId.Player) && !obj.IsTypeId(TypeId.Corpse));
if (targets.Empty())
{
+2 -8
View File
@@ -345,10 +345,7 @@ namespace Scripts.Spells.Shaman
{
void SelectTargets(List<WorldObject> targets)
{
targets.RemoveAll(target =>
{
return !target.ToUnit() || target.ToUnit().IsFullHealth();
});
targets.RemoveAll(target => !target.ToUnit() || target.ToUnit().IsFullHealth());
targets.RandomResize(1);
@@ -635,10 +632,7 @@ namespace Scripts.Spells.Shaman
void FilterTargets(List<WorldObject> targets)
{
targets.Remove(GetExplTargetUnit());
targets.RandomResize(target =>
{
return target.IsTypeId(TypeId.Unit) && !target.ToUnit().HasAura(SpellIds.FlameShockMaelstrom, GetCaster().GetGUID());
}, 1);
targets.RandomResize(target => target.IsTypeId(TypeId.Unit) && !target.ToUnit().HasAura(SpellIds.FlameShockMaelstrom, GetCaster().GetGUID()), 1);
}
void HandleScript(uint effIndex)
+2 -2
View File
@@ -741,7 +741,7 @@ namespace Scripts.World.NpcSpecial
{
List<Creature> targets = new List<Creature>();
me.GetCreatureListWithEntryInGrid(targets, CreatureIds.TorchTossingTargetBunny, 60.0f);
targets.RemoveAll(creature => { return creature.GetGUID() == lastTargetGUID; });
targets.RemoveAll(creature => creature.GetGUID() == lastTargetGUID);
if (!targets.Empty())
{
@@ -788,7 +788,7 @@ namespace Scripts.World.NpcSpecial
{
Initialize();
_scheduler.SetValidator(() => { return running; });
_scheduler.SetValidator(() => running);
_scheduler.Schedule(TimeSpan.FromMilliseconds(1), task =>
{