Ported .Net Core commits:
hondacrx: - Initial commit: Switch to .Net Core 2.0 - Fix build and removed not needed files Fabi: - Updated solution platforms. - Changed folder structure. - Change library target framework to netstandard2.0. - Updated solution platforms again... - Removed windows specific kernel32 function usage (Ctrl-C handler).
This commit is contained in:
@@ -0,0 +1,307 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2017 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.BattleGrounds;
|
||||
using Game.BattleGrounds.Zones;
|
||||
using Game.Entities;
|
||||
using Game.Scripting;
|
||||
|
||||
namespace Scripts.World
|
||||
{
|
||||
struct AchievementConst
|
||||
{
|
||||
//Tilted
|
||||
public const uint AreaArgentTournamentFields = 4658;
|
||||
public const uint AreaRingOfAspirants = 4670;
|
||||
public const uint AreaRingOfArgentValiants = 4671;
|
||||
public const uint AreaRingOfAllianceValiants = 4672;
|
||||
public const uint AreaRingOfHordeValiants = 4673;
|
||||
public const uint AreaRingOfChampions = 4669;
|
||||
|
||||
//Flirt With Disaster
|
||||
public const uint AuraPerfumeForever = 70235;
|
||||
public const uint AuraPerfumeEnchantress = 70234;
|
||||
public const uint AuraPerfumeVictory = 70233;
|
||||
|
||||
//BgSA Artillery
|
||||
public const uint AntiPersonnalCannon = 27894;
|
||||
}
|
||||
|
||||
[Script]
|
||||
class achievement_resilient_victory : AchievementCriteriaScript
|
||||
{
|
||||
public achievement_resilient_victory() : base("achievement_resilient_victory") { }
|
||||
|
||||
public override bool OnCheck(Player source, Unit target)
|
||||
{
|
||||
Battleground bg = source.GetBattleground();
|
||||
if (bg)
|
||||
return bg.CheckAchievementCriteriaMeet((uint)BattlegroundCriteriaId.ResilientVictory, source, target);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class achievement_bg_control_all_nodes : AchievementCriteriaScript
|
||||
{
|
||||
public achievement_bg_control_all_nodes() : base("achievement_bg_control_all_nodes") { }
|
||||
|
||||
public override bool OnCheck(Player source, Unit target)
|
||||
{
|
||||
Battleground bg = source.GetBattleground();
|
||||
if (bg)
|
||||
return bg.IsAllNodesControlledByTeam(source.GetTeam());
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class achievement_save_the_day : AchievementCriteriaScript
|
||||
{
|
||||
public achievement_save_the_day() : base("achievement_save_the_day") { }
|
||||
|
||||
public override bool OnCheck(Player source, Unit target)
|
||||
{
|
||||
Battleground bg = source.GetBattleground();
|
||||
if (bg)
|
||||
return bg.CheckAchievementCriteriaMeet((uint)BattlegroundCriteriaId.SaveTheDay, source, target);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class achievement_bg_ic_resource_glut : AchievementCriteriaScript
|
||||
{
|
||||
public achievement_bg_ic_resource_glut() : base("achievement_bg_ic_resource_glut") { }
|
||||
|
||||
public override bool OnCheck(Player source, Unit target)
|
||||
{
|
||||
if (source.HasAura(ICSpells.OilRefinery) && source.HasAura(ICSpells.Quarry))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class achievement_bg_ic_glaive_grave : AchievementCriteriaScript
|
||||
{
|
||||
public achievement_bg_ic_glaive_grave() : base("achievement_bg_ic_glaive_grave") { }
|
||||
|
||||
public override bool OnCheck(Player source, Unit target)
|
||||
{
|
||||
Creature vehicle = source.GetVehicleCreatureBase();
|
||||
if (vehicle)
|
||||
{
|
||||
if (vehicle.GetEntry() == ICCreatures.GlaiveThrowerH || vehicle.GetEntry() == ICCreatures.GlaiveThrowerA)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class achievement_bg_ic_mowed_down : AchievementCriteriaScript
|
||||
{
|
||||
public achievement_bg_ic_mowed_down() : base("achievement_bg_ic_mowed_down") { }
|
||||
|
||||
public override bool OnCheck(Player source, Unit target)
|
||||
{
|
||||
Creature vehicle = source.GetVehicleCreatureBase();
|
||||
if (vehicle)
|
||||
{
|
||||
if (vehicle.GetEntry() == ICCreatures.KeepCannon)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class achievement_bg_sa_artillery : AchievementCriteriaScript
|
||||
{
|
||||
public achievement_bg_sa_artillery() : base("achievement_bg_sa_artillery") { }
|
||||
|
||||
public override bool OnCheck(Player source, Unit target)
|
||||
{
|
||||
Creature vehicle = source.GetVehicleCreatureBase();
|
||||
if (vehicle)
|
||||
{
|
||||
if (vehicle.GetEntry() == AchievementConst.AntiPersonnalCannon)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[Script("achievement_arena_2v2_kills", ArenaTypes.Team2v2)]
|
||||
[Script("achievement_arena_3v3_kills", ArenaTypes.Team3v3)]
|
||||
[Script("achievement_arena_5v5_kills", ArenaTypes.Team5v5)]
|
||||
class achievement_arena_kills : AchievementCriteriaScript
|
||||
{
|
||||
public achievement_arena_kills(string name, ArenaTypes arenaType) : base(name)
|
||||
{
|
||||
_arenaType = arenaType;
|
||||
}
|
||||
|
||||
public override bool OnCheck(Player source, Unit target)
|
||||
{
|
||||
// this checks GetBattleground() for NULL already
|
||||
if (!source.InArena())
|
||||
return false;
|
||||
|
||||
return source.GetBattleground().GetArenaType() == _arenaType;
|
||||
}
|
||||
|
||||
ArenaTypes _arenaType;
|
||||
}
|
||||
|
||||
[Script]
|
||||
class achievement_sickly_gazelle : AchievementCriteriaScript
|
||||
{
|
||||
public achievement_sickly_gazelle() : base("achievement_sickly_gazelle") { }
|
||||
|
||||
public override bool OnCheck(Player source, Unit target)
|
||||
{
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
Player victim = target.ToPlayer();
|
||||
if (victim)
|
||||
if (victim.IsMounted())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class achievement_everything_counts : AchievementCriteriaScript
|
||||
{
|
||||
public achievement_everything_counts() : base("achievement_everything_counts") { }
|
||||
|
||||
public override bool OnCheck(Player source, Unit target)
|
||||
{
|
||||
Battleground bg = source.GetBattleground();
|
||||
if (bg)
|
||||
return bg.CheckAchievementCriteriaMeet((uint)BattlegroundCriteriaId.EverythingCounts, source, target);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class achievement_bg_av_perfection : AchievementCriteriaScript
|
||||
{
|
||||
public achievement_bg_av_perfection() : base("achievement_bg_av_perfection") { }
|
||||
|
||||
public override bool OnCheck(Player source, Unit target)
|
||||
{
|
||||
Battleground bg = source.GetBattleground();
|
||||
if (bg)
|
||||
return bg.CheckAchievementCriteriaMeet((uint)BattlegroundCriteriaId.AvPerfection, source, target);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class achievement_bg_sa_defense_of_ancients : AchievementCriteriaScript
|
||||
{
|
||||
public achievement_bg_sa_defense_of_ancients() : base("achievement_bg_sa_defense_of_ancients") { }
|
||||
|
||||
public override bool OnCheck(Player source, Unit target)
|
||||
{
|
||||
Battleground bg = source.GetBattleground();
|
||||
if (bg)
|
||||
return bg.CheckAchievementCriteriaMeet((uint)BattlegroundCriteriaId.DefenseOfTheAncients, source, target);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class achievement_tilted : AchievementCriteriaScript
|
||||
{
|
||||
public achievement_tilted() : base("achievement_tilted") { }
|
||||
|
||||
public override bool OnCheck(Player player, Unit target)
|
||||
{
|
||||
if (!player)
|
||||
return false;
|
||||
|
||||
bool checkArea = player.GetAreaId() == AchievementConst.AreaArgentTournamentFields ||
|
||||
player.GetAreaId() == AchievementConst.AreaRingOfAspirants ||
|
||||
player.GetAreaId() == AchievementConst.AreaRingOfArgentValiants ||
|
||||
player.GetAreaId() == AchievementConst.AreaRingOfAllianceValiants ||
|
||||
player.GetAreaId() == AchievementConst.AreaRingOfHordeValiants ||
|
||||
player.GetAreaId() == AchievementConst.AreaRingOfChampions;
|
||||
|
||||
return checkArea && player.duel != null && player.duel.isMounted;
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class achievement_not_even_a_scratch : AchievementCriteriaScript
|
||||
{
|
||||
public achievement_not_even_a_scratch() : base("achievement_not_even_a_scratch") { }
|
||||
|
||||
public override bool OnCheck(Player source, Unit target)
|
||||
{
|
||||
Battleground bg = source.GetBattleground();
|
||||
if (bg)
|
||||
return bg.CheckAchievementCriteriaMeet((uint)BattlegroundCriteriaId.NotEvenAScratch, source, target);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class achievement_flirt_with_disaster_perf_check : AchievementCriteriaScript
|
||||
{
|
||||
public achievement_flirt_with_disaster_perf_check() : base("achievement_flirt_with_disaster_perf_check") { }
|
||||
|
||||
public override bool OnCheck(Player player, Unit target)
|
||||
{
|
||||
if (!player)
|
||||
return false;
|
||||
|
||||
if (player.HasAura(AchievementConst.AuraPerfumeForever) || player.HasAura(AchievementConst.AuraPerfumeEnchantress) || player.HasAura(AchievementConst.AuraPerfumeVictory))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class achievement_killed_exp_or_honor_target : AchievementCriteriaScript
|
||||
{
|
||||
public achievement_killed_exp_or_honor_target() : base("achievement_killed_exp_or_honor_target") { }
|
||||
|
||||
public override bool OnCheck(Player player, Unit target)
|
||||
{
|
||||
return target && player.isHonorOrXPTarget(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,398 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2017 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.DataStorage;
|
||||
using Game.Entities;
|
||||
using Game.Scripting;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Scripts.World
|
||||
{
|
||||
struct AreaTriggerConst
|
||||
{
|
||||
//Coilfang Waterfall
|
||||
public const uint GoCoilfangWaterfall = 184212;
|
||||
|
||||
//Legion Teleporter
|
||||
public const uint SpellTeleATo = 37387;
|
||||
public const uint QuestGainingAccessA = 10589;
|
||||
|
||||
public const uint SpellTeleHTo = 37389;
|
||||
public const uint QuestGainingAccessH = 10604;
|
||||
|
||||
//Stormwright Shelf
|
||||
public const uint QuestStrengthOfTheTempest = 12741;
|
||||
public const uint SpellCreateTruePowerOfTheTempest = 53067;
|
||||
|
||||
//Scent Larkorwi
|
||||
public const uint QuestScentOfLarkorwi = 4291;
|
||||
public const uint NpcLarkorwiMate = 9683;
|
||||
|
||||
//Last Rites
|
||||
public const uint QuestLastRites = 12019;
|
||||
public const uint QuestBreakingThrough = 11898;
|
||||
|
||||
//Sholazar Waygate
|
||||
public const uint SpellSholazarToUngoroTeleport = 52056;
|
||||
public const uint SpellUngoroToSholazarTeleport = 52057;
|
||||
|
||||
public const uint AtSholazar = 5046;
|
||||
public const uint AtUngoro = 5047;
|
||||
|
||||
public const uint QuestTheMakersOverlook = 12613;
|
||||
public const uint QuestTheMakersPerch = 12559;
|
||||
public const uint QuestMeetingAGreatOne = 13956;
|
||||
|
||||
//Nats Landing
|
||||
public const uint QuestNatsBargain = 11209;
|
||||
public const uint SpellFishPaste = 42644;
|
||||
public const uint NpcLurkingShark = 23928;
|
||||
|
||||
//Brewfest
|
||||
public const uint NpcTapperSwindlekeg = 24711;
|
||||
public const uint NpcIpfelkoferIronkeg = 24710;
|
||||
|
||||
public const uint AtBrewfestDurotar = 4829;
|
||||
public const uint AtBrewfestDunMorogh = 4820;
|
||||
|
||||
public const uint SayWelcome = 4;
|
||||
|
||||
public const uint AreatriggerTalkCooldown = 5; // In Seconds
|
||||
|
||||
//Area 52
|
||||
public const uint SpellA52Neuralyzer = 34400;
|
||||
public const uint NpcSpotlight = 19913;
|
||||
public const uint SummonCooldown = 5;
|
||||
|
||||
public const uint AtArea52South = 4472;
|
||||
public const uint AtArea52North = 4466;
|
||||
public const uint AtArea52West = 4471;
|
||||
public const uint AtArea52East = 4422;
|
||||
|
||||
//Frostgrips Hollow
|
||||
public const uint QuestTheLonesomeWatcher = 12877;
|
||||
|
||||
public const uint NpcStormforgedMonitor = 29862;
|
||||
public const uint NpcStormforgedEradictor = 29861;
|
||||
|
||||
public const uint TypeWaypoint = 0;
|
||||
public const uint DataStart = 0;
|
||||
|
||||
public static Position StormforgedMonitorPosition = new Position(6963.95f, 45.65f, 818.71f, 4.948f);
|
||||
public static Position StormforgedEradictorPosition = new Position(6983.18f, 7.15f, 806.33f, 2.228f);
|
||||
}
|
||||
|
||||
[Script]
|
||||
class AreaTrigger_at_coilfang_waterfall : AreaTriggerScript
|
||||
{
|
||||
public AreaTrigger_at_coilfang_waterfall() : base("at_coilfang_waterfall") { }
|
||||
|
||||
public override bool OnTrigger(Player player, AreaTriggerRecord trigger, bool entered)
|
||||
{
|
||||
GameObject go = player.FindNearestGameObject(AreaTriggerConst.GoCoilfangWaterfall, 35.0f);
|
||||
if (go)
|
||||
if (go.getLootState() == LootState.Ready)
|
||||
go.UseDoorOrButton();
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class AreaTrigger_at_legion_teleporter : AreaTriggerScript
|
||||
{
|
||||
public AreaTrigger_at_legion_teleporter() : base("at_legion_teleporter") { }
|
||||
|
||||
public override bool OnTrigger(Player player, AreaTriggerRecord trigger, bool entered)
|
||||
{
|
||||
if (player.IsAlive() && !player.IsInCombat())
|
||||
{
|
||||
if (player.GetTeam() == Team.Alliance && player.GetQuestRewardStatus(AreaTriggerConst.QuestGainingAccessA))
|
||||
{
|
||||
player.CastSpell(player, AreaTriggerConst.SpellTeleATo, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (player.GetTeam() == Team.Horde && player.GetQuestRewardStatus(AreaTriggerConst.QuestGainingAccessH))
|
||||
{
|
||||
player.CastSpell(player, AreaTriggerConst.SpellTeleHTo, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class AreaTrigger_at_stormwright_shelf : AreaTriggerScript
|
||||
{
|
||||
public AreaTrigger_at_stormwright_shelf() : base("at_stormwright_shelf") { }
|
||||
|
||||
public override bool OnTrigger(Player player, AreaTriggerRecord trigger, bool entered)
|
||||
{
|
||||
if (!player.IsDead() && player.GetQuestStatus(AreaTriggerConst.QuestStrengthOfTheTempest) == QuestStatus.Incomplete)
|
||||
player.CastSpell(player, AreaTriggerConst.SpellCreateTruePowerOfTheTempest, false);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class AreaTrigger_at_scent_larkorwi : AreaTriggerScript
|
||||
{
|
||||
public AreaTrigger_at_scent_larkorwi() : base("at_scent_larkorwi") { }
|
||||
|
||||
public override bool OnTrigger(Player player, AreaTriggerRecord trigger, bool entered)
|
||||
{
|
||||
if (!player.IsDead() && player.GetQuestStatus(AreaTriggerConst.QuestScentOfLarkorwi) == QuestStatus.Incomplete)
|
||||
{
|
||||
if (!player.FindNearestCreature(AreaTriggerConst.NpcLarkorwiMate, 15))
|
||||
player.SummonCreature(AreaTriggerConst.NpcLarkorwiMate, player.GetPositionX() + 5, player.GetPositionY(), player.GetPositionZ(), 3.3f, TempSummonType.TimedDespawnOOC, 100000);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class AreaTrigger_at_last_rites : AreaTriggerScript
|
||||
{
|
||||
public AreaTrigger_at_last_rites() : base("at_last_rites") { }
|
||||
|
||||
public override bool OnTrigger(Player player, AreaTriggerRecord trigger, bool entered)
|
||||
{
|
||||
if (!(player.GetQuestStatus(AreaTriggerConst.QuestLastRites) == QuestStatus.Incomplete ||
|
||||
player.GetQuestStatus(AreaTriggerConst.QuestLastRites) == QuestStatus.Complete ||
|
||||
player.GetQuestStatus(AreaTriggerConst.QuestBreakingThrough) == QuestStatus.Incomplete ||
|
||||
player.GetQuestStatus(AreaTriggerConst.QuestBreakingThrough) == QuestStatus.Complete))
|
||||
return false;
|
||||
|
||||
WorldLocation pPosition;
|
||||
|
||||
switch (trigger.Id)
|
||||
{
|
||||
case 5332:
|
||||
case 5338:
|
||||
pPosition = new WorldLocation(571, 3733.68f, 3563.25f, 290.812f, 3.665192f);
|
||||
break;
|
||||
case 5334:
|
||||
pPosition = new WorldLocation(571, 3802.38f, 3585.95f, 49.5765f, 0.0f);
|
||||
break;
|
||||
case 5340:
|
||||
if (player.GetQuestStatus(AreaTriggerConst.QuestLastRites) == QuestStatus.Incomplete ||
|
||||
player.GetQuestStatus(AreaTriggerConst.QuestLastRites) == QuestStatus.Complete)
|
||||
pPosition = new WorldLocation(571, 3687.91f, 3577.28f, 473.342f);
|
||||
else
|
||||
pPosition = new WorldLocation(571, 3739.38f, 3567.09f, 341.58f);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
player.TeleportTo(pPosition);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class AreaTrigger_at_sholazar_waygate : AreaTriggerScript
|
||||
{
|
||||
public AreaTrigger_at_sholazar_waygate() : base("at_sholazar_waygate") { }
|
||||
|
||||
public override bool OnTrigger(Player player, AreaTriggerRecord trigger, bool entered)
|
||||
{
|
||||
if (!player.IsDead() && (player.GetQuestStatus(AreaTriggerConst.QuestMeetingAGreatOne) != QuestStatus.None ||
|
||||
(player.GetQuestStatus(AreaTriggerConst.QuestTheMakersOverlook) == QuestStatus.Rewarded && player.GetQuestStatus(AreaTriggerConst.QuestTheMakersPerch) == QuestStatus.Rewarded)))
|
||||
{
|
||||
switch (trigger.Id)
|
||||
{
|
||||
case AreaTriggerConst.AtSholazar:
|
||||
player.CastSpell(player, AreaTriggerConst.SpellSholazarToUngoroTeleport, true);
|
||||
break;
|
||||
|
||||
case AreaTriggerConst.AtUngoro:
|
||||
player.CastSpell(player, AreaTriggerConst.SpellUngoroToSholazarTeleport, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class AreaTrigger_at_nats_landing : AreaTriggerScript
|
||||
{
|
||||
public AreaTrigger_at_nats_landing() : base("at_nats_landing") { }
|
||||
|
||||
public override bool OnTrigger(Player player, AreaTriggerRecord trigger, bool entered)
|
||||
{
|
||||
if (!player.IsAlive() || !player.HasAura(AreaTriggerConst.SpellFishPaste))
|
||||
return false;
|
||||
|
||||
if (player.GetQuestStatus(AreaTriggerConst.QuestNatsBargain) == QuestStatus.Incomplete)
|
||||
{
|
||||
if (!player.FindNearestCreature(AreaTriggerConst.NpcLurkingShark, 20.0f))
|
||||
{
|
||||
Creature shark = player.SummonCreature(AreaTriggerConst.NpcLurkingShark, -4246.243f, -3922.356f, -7.488f, 5.0f, TempSummonType.TimedDespawnOOC, 100000);
|
||||
if (shark)
|
||||
shark.GetAI().AttackStart(player);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class AreaTrigger_at_brewfest : AreaTriggerScript
|
||||
{
|
||||
public AreaTrigger_at_brewfest() : base("at_brewfest")
|
||||
{
|
||||
// Initialize for cooldown
|
||||
_triggerTimes[AreaTriggerConst.AtBrewfestDurotar] = _triggerTimes[AreaTriggerConst.AtBrewfestDunMorogh] = 0;
|
||||
}
|
||||
|
||||
public override bool OnTrigger(Player player, AreaTriggerRecord trigger, bool entered)
|
||||
{
|
||||
uint triggerId = trigger.Id;
|
||||
// Second trigger happened too early after first, skip for now
|
||||
if (Global.WorldMgr.GetGameTime() - _triggerTimes[triggerId] < AreaTriggerConst.AreatriggerTalkCooldown)
|
||||
return false;
|
||||
|
||||
switch (triggerId)
|
||||
{
|
||||
case AreaTriggerConst.AtBrewfestDurotar:
|
||||
Creature tapper = player.FindNearestCreature(AreaTriggerConst.NpcTapperSwindlekeg, 20.0f);
|
||||
if (tapper)
|
||||
tapper.GetAI().Talk(AreaTriggerConst.SayWelcome, player);
|
||||
break;
|
||||
case AreaTriggerConst.AtBrewfestDunMorogh:
|
||||
Creature ipfelkofer = player.FindNearestCreature(AreaTriggerConst.NpcIpfelkoferIronkeg, 20.0f);
|
||||
if (ipfelkofer)
|
||||
ipfelkofer.GetAI().Talk(AreaTriggerConst.SayWelcome, player);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_triggerTimes[triggerId] = Global.WorldMgr.GetGameTime();
|
||||
return false;
|
||||
}
|
||||
|
||||
Dictionary<uint, long> _triggerTimes = new Dictionary<uint, long>();
|
||||
}
|
||||
|
||||
[Script]
|
||||
class AreaTrigger_at_area_52_entrance : AreaTriggerScript
|
||||
{
|
||||
public AreaTrigger_at_area_52_entrance() : base("at_area_52_entrance")
|
||||
{
|
||||
_triggerTimes[AreaTriggerConst.AtArea52South] = _triggerTimes[AreaTriggerConst.AtArea52North] = _triggerTimes[AreaTriggerConst.AtArea52West] = _triggerTimes[AreaTriggerConst.AtArea52East] = 0;
|
||||
}
|
||||
|
||||
public override bool OnTrigger(Player player, AreaTriggerRecord trigger, bool entered)
|
||||
{
|
||||
float x = 0.0f, y = 0.0f, z = 0.0f;
|
||||
|
||||
if (!player.IsAlive())
|
||||
return false;
|
||||
|
||||
uint triggerId = trigger.Id;
|
||||
if (Global.WorldMgr.GetGameTime() - _triggerTimes[trigger.Id] < AreaTriggerConst.SummonCooldown)
|
||||
return false;
|
||||
|
||||
switch (triggerId)
|
||||
{
|
||||
case AreaTriggerConst.AtArea52East:
|
||||
x = 3044.176f;
|
||||
y = 3610.692f;
|
||||
z = 143.61f;
|
||||
break;
|
||||
case AreaTriggerConst.AtArea52North:
|
||||
x = 3114.87f;
|
||||
y = 3687.619f;
|
||||
z = 143.62f;
|
||||
break;
|
||||
case AreaTriggerConst.AtArea52West:
|
||||
x = 3017.79f;
|
||||
y = 3746.806f;
|
||||
z = 144.27f;
|
||||
break;
|
||||
case AreaTriggerConst.AtArea52South:
|
||||
x = 2950.63f;
|
||||
y = 3719.905f;
|
||||
z = 143.33f;
|
||||
break;
|
||||
}
|
||||
|
||||
player.SummonCreature(AreaTriggerConst.NpcSpotlight, x, y, z, 0.0f, TempSummonType.TimedDespawn, 5000);
|
||||
player.AddAura(AreaTriggerConst.SpellA52Neuralyzer, player);
|
||||
_triggerTimes[trigger.Id] = Global.WorldMgr.GetGameTime();
|
||||
return false;
|
||||
}
|
||||
|
||||
Dictionary<uint, long> _triggerTimes = new Dictionary<uint, long>();
|
||||
}
|
||||
|
||||
[Script]
|
||||
class AreaTrigger_at_frostgrips_hollow : AreaTriggerScript
|
||||
{
|
||||
public AreaTrigger_at_frostgrips_hollow() : base("at_frostgrips_hollow") { }
|
||||
|
||||
public override bool OnTrigger(Player player, AreaTriggerRecord trigger, bool entered)
|
||||
{
|
||||
if (player.GetQuestStatus(AreaTriggerConst.QuestTheLonesomeWatcher) != QuestStatus.Incomplete)
|
||||
return false;
|
||||
|
||||
Creature stormforgedMonitor = ObjectAccessor.GetCreature(player, stormforgedMonitorGUID);
|
||||
if (stormforgedMonitor)
|
||||
return false;
|
||||
|
||||
Creature stormforgedEradictor = ObjectAccessor.GetCreature(player, stormforgedEradictorGUID);
|
||||
if (stormforgedEradictor)
|
||||
return false;
|
||||
|
||||
stormforgedMonitor = player.SummonCreature(AreaTriggerConst.NpcStormforgedMonitor, AreaTriggerConst.StormforgedMonitorPosition, TempSummonType.TimedDespawnOOC, 60000);
|
||||
if (stormforgedMonitor)
|
||||
{
|
||||
stormforgedMonitorGUID = stormforgedMonitor.GetGUID();
|
||||
stormforgedMonitor.SetWalk(false);
|
||||
// The npc would search an alternative way to get to the last waypoint without this unit state.
|
||||
stormforgedMonitor.AddUnitState(UnitState.IgnorePathfinding);
|
||||
stormforgedMonitor.GetMotionMaster().MovePath(AreaTriggerConst.NpcStormforgedMonitor * 100, false);
|
||||
}
|
||||
|
||||
stormforgedEradictor = player.SummonCreature(AreaTriggerConst.NpcStormforgedEradictor, AreaTriggerConst.StormforgedEradictorPosition, TempSummonType.TimedDespawnOOC, 60000);
|
||||
if (stormforgedEradictor)
|
||||
{
|
||||
stormforgedEradictorGUID = stormforgedEradictor.GetGUID();
|
||||
stormforgedEradictor.GetMotionMaster().MovePath(AreaTriggerConst.NpcStormforgedEradictor * 100, false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
ObjectGuid stormforgedMonitorGUID;
|
||||
ObjectGuid stormforgedEradictorGUID;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,581 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2017 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.AI;
|
||||
using Game.Entities;
|
||||
using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Scripts.World.BossEmeraldDragons
|
||||
{
|
||||
struct CreatureIds
|
||||
{
|
||||
public const uint DragonYsondre = 14887;
|
||||
public const uint DragonLethon = 14888;
|
||||
public const uint DragonEmeriss = 14889;
|
||||
public const uint DragonTaerar = 14890;
|
||||
public const uint DreamFog = 15224;
|
||||
|
||||
//Ysondre
|
||||
public const uint DementedDruid = 15260;
|
||||
|
||||
//Lethon
|
||||
public const uint SpiritShade = 15261;
|
||||
}
|
||||
|
||||
struct Spells
|
||||
{
|
||||
public const uint TailSweep = 15847; // Tail Sweep - Slap Everything Behind Dragon (2 Seconds Interval)
|
||||
public const uint SummonPlayer = 24776; // Teleport Highest Threat Player In Front Of Dragon If Wandering Off
|
||||
public const uint DreamFog = 24777; // Auraspell For Dream Fog Npc (15224)
|
||||
public const uint Sleep = 24778; // Sleep Triggerspell (Used For Dream Fog)
|
||||
public const uint SeepingFogLeft = 24813; // Dream Fog - Summon Left
|
||||
public const uint SeepingFogRight = 24814; // Dream Fog - Summon Right
|
||||
public const uint NoxiousBreath = 24818;
|
||||
public const uint MarkOfNature = 25040; // Mark Of Nature Trigger (Applied On Target Death - 15 Minutes Of Being Suspectible To Aura Of Nature)
|
||||
public const uint MarkOfNatureAura = 25041; // Mark Of Nature (Passive Marker-Test; Ticks Every 10 Seconds From Boss; Triggers Spellid 25042 (Scripted)
|
||||
public const uint AuraOfNature = 25043; // Stun For 2 Minutes (Used When public const uint MarkOfNature Exists On The Target)
|
||||
|
||||
//Ysondre
|
||||
public const uint LightningWave = 24819;
|
||||
public const uint SummonDruidSpirits = 24795;
|
||||
|
||||
//Lethon
|
||||
public const uint DrawSpirit = 24811;
|
||||
public const uint ShadowBoltWhirl = 24834;
|
||||
public const uint DarkOffering = 24804;
|
||||
|
||||
//Emeriss
|
||||
public const uint PutridMushroom = 24904;
|
||||
public const uint CorruptionOfEarth = 24910;
|
||||
public const uint VolatileInfection = 24928;
|
||||
|
||||
//Taerar
|
||||
public const uint BellowingRoar = 22686;
|
||||
public const uint Shade = 24313;
|
||||
public const uint ArcaneBlast = 24857;
|
||||
|
||||
public static uint[] TaerarShadeSpells = { 24841, 24842, 24843 };
|
||||
}
|
||||
|
||||
struct Texts
|
||||
{
|
||||
//Ysondre
|
||||
public const uint YsondreAggro = 0;
|
||||
public const uint YsondreSummonDruids = 1;
|
||||
|
||||
//Lethon
|
||||
public const uint LethonAggro = 0;
|
||||
public const uint LethonDrawSpirit = 1;
|
||||
|
||||
//Emeriss
|
||||
public const uint EmerissAggro = 0;
|
||||
public const uint EmerissCastCorruption = 1;
|
||||
|
||||
//Taerar
|
||||
public const uint TaerarAggro = 0;
|
||||
public const uint TaerarSummonShades = 1;
|
||||
}
|
||||
|
||||
class emerald_dragonAI : WorldBossAI
|
||||
{
|
||||
public emerald_dragonAI(Creature creature) : base(creature) { }
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
me.RemoveFlag(UnitFields.Flags, UnitFlags.NotSelectable | UnitFlags.NonAttackable);
|
||||
me.SetReactState(ReactStates.Aggressive);
|
||||
DoCast(me, Spells.MarkOfNatureAura, true);
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(4), task =>
|
||||
{
|
||||
// Tail Sweep is cast every two seconds, no matter what goes on in front of the dragon
|
||||
DoCast(me, Spells.TailSweep);
|
||||
task.Repeat(TimeSpan.FromSeconds(2));
|
||||
});
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(7.5), TimeSpan.FromSeconds(15), task =>
|
||||
{
|
||||
// Noxious Breath is cast on random intervals, no less than 7.5 seconds between
|
||||
DoCast(me, Spells.NoxiousBreath);
|
||||
task.Repeat();
|
||||
});
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(12.5), TimeSpan.FromSeconds(20), task =>
|
||||
{
|
||||
// Seeping Fog appears only as "pairs", and only ONE pair at any given time!
|
||||
// Despawntime is 2 minutes, so reschedule it for new cast after 2 minutes + a minor "random time" (30 seconds at max)
|
||||
DoCast(me, Spells.SeepingFogLeft, true);
|
||||
DoCast(me, Spells.SeepingFogRight, true);
|
||||
task.Repeat(TimeSpan.FromMinutes(2), TimeSpan.FromMinutes(2.5));
|
||||
});
|
||||
}
|
||||
|
||||
// Target killed during encounter, mark them as suspectible for Aura Of Nature
|
||||
public override void KilledUnit(Unit who)
|
||||
{
|
||||
if (who.IsTypeId(TypeId.Player))
|
||||
who.CastSpell(who, Spells.MarkOfNature, true);
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
if (me.HasUnitState(UnitState.Casting))
|
||||
return;
|
||||
|
||||
_scheduler.Update(diff);
|
||||
|
||||
Unit target = SelectTarget(SelectAggroTarget.TopAggro, 0, -50.0f, true);
|
||||
if (target)
|
||||
DoCast(target, Spells.SummonPlayer);
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class npc_dream_fog : ScriptedAI
|
||||
{
|
||||
public npc_dream_fog(Creature creature) : base(creature)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
_roamTimer = 0;
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
if (_roamTimer == 0)
|
||||
{
|
||||
// Chase target, but don't attack - otherwise just roam around
|
||||
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 0.0f, true);
|
||||
if (target)
|
||||
{
|
||||
_roamTimer = RandomHelper.URand(15000, 30000);
|
||||
me.GetMotionMaster().Clear(false);
|
||||
me.GetMotionMaster().MoveChase(target, 0.2f);
|
||||
}
|
||||
else
|
||||
{
|
||||
_roamTimer = 2500;
|
||||
me.GetMotionMaster().Clear(false);
|
||||
me.GetMotionMaster().MoveRandom(25.0f);
|
||||
}
|
||||
// Seeping fog movement is slow enough for a player to be able to walk backwards and still outpace it
|
||||
me.SetWalk(true);
|
||||
me.SetSpeedRate(UnitMoveType.Walk, 0.75f);
|
||||
}
|
||||
else
|
||||
_roamTimer -= diff;
|
||||
}
|
||||
|
||||
uint _roamTimer;
|
||||
}
|
||||
|
||||
[Script]
|
||||
class boss_ysondre : CreatureScript
|
||||
{
|
||||
public boss_ysondre() : base("boss_ysondre") { }
|
||||
|
||||
class boss_ysondreAI : emerald_dragonAI
|
||||
{
|
||||
public boss_ysondreAI(Creature creature) : base(creature)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
_stage = 1;
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
Initialize();
|
||||
base.Reset();
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(12), task =>
|
||||
{
|
||||
DoCastVictim(Spells.LightningWave);
|
||||
task.Repeat(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(20));
|
||||
});
|
||||
}
|
||||
|
||||
public override void EnterCombat(Unit who)
|
||||
{
|
||||
Talk(Texts.YsondreAggro);
|
||||
base.EnterCombat(who);
|
||||
}
|
||||
|
||||
// Summon druid spirits on 75%, 50% and 25% health
|
||||
public override void DamageTaken(Unit attacker, ref uint damage)
|
||||
{
|
||||
if (!HealthAbovePct(100 - 25 * _stage))
|
||||
{
|
||||
Talk(Texts.YsondreSummonDruids);
|
||||
|
||||
for (byte i = 0; i < 10; ++i)
|
||||
DoCast(me, Spells.SummonDruidSpirits, true);
|
||||
++_stage;
|
||||
}
|
||||
}
|
||||
|
||||
byte _stage;
|
||||
}
|
||||
|
||||
public override CreatureAI GetAI(Creature creature)
|
||||
{
|
||||
return new boss_ysondreAI(creature);
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class boss_lethon : CreatureScript
|
||||
{
|
||||
public boss_lethon() : base("boss_lethon") { }
|
||||
|
||||
class boss_lethonAI : emerald_dragonAI
|
||||
{
|
||||
public boss_lethonAI(Creature creature) : base(creature)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
_stage = 1;
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
Initialize();
|
||||
base.Reset();
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(10), task =>
|
||||
{
|
||||
me.CastSpell((Unit)null, Spells.ShadowBoltWhirl, false);
|
||||
task.Repeat(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(30));
|
||||
});
|
||||
}
|
||||
|
||||
public override void EnterCombat(Unit who)
|
||||
{
|
||||
Talk(Texts.LethonAggro);
|
||||
base.EnterCombat(who);
|
||||
}
|
||||
|
||||
public override void DamageTaken(Unit attacker, ref uint damage)
|
||||
{
|
||||
if (!HealthAbovePct(100 - 25 * _stage))
|
||||
{
|
||||
Talk(Texts.LethonDrawSpirit);
|
||||
DoCast(me, Spells.DrawSpirit);
|
||||
++_stage;
|
||||
}
|
||||
}
|
||||
|
||||
public override void SpellHitTarget(Unit target, SpellInfo spell)
|
||||
{
|
||||
if (spell.Id == Spells.DrawSpirit && target.IsTypeId(TypeId.Player))
|
||||
{
|
||||
Position targetPos = target.GetPosition();
|
||||
me.SummonCreature(CreatureIds.SpiritShade, targetPos, TempSummonType.TimedDespawnOOC, 50000);
|
||||
}
|
||||
}
|
||||
|
||||
byte _stage;
|
||||
}
|
||||
|
||||
public override CreatureAI GetAI(Creature creature)
|
||||
{
|
||||
return new boss_lethonAI(creature);
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class npc_spirit_shade : PassiveAI
|
||||
{
|
||||
public npc_spirit_shade(Creature creature) : base(creature) { }
|
||||
|
||||
public override void IsSummonedBy(Unit summoner)
|
||||
{
|
||||
_summonerGuid = summoner.GetGUID();
|
||||
me.GetMotionMaster().MoveFollow(summoner, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
public override void MovementInform(MovementGeneratorType moveType, uint data)
|
||||
{
|
||||
if (moveType == MovementGeneratorType.Follow && data == _summonerGuid.GetCounter())
|
||||
{
|
||||
me.CastSpell((Unit)null, Spells.DarkOffering, false);
|
||||
me.DespawnOrUnsummon(1000);
|
||||
}
|
||||
}
|
||||
|
||||
ObjectGuid _summonerGuid;
|
||||
}
|
||||
|
||||
[Script]
|
||||
class boss_emeriss : CreatureScript
|
||||
{
|
||||
public boss_emeriss() : base("boss_emeriss") { }
|
||||
|
||||
class boss_emerissAI : emerald_dragonAI
|
||||
{
|
||||
public boss_emerissAI(Creature creature) : base(creature)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
_stage = 1;
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
Initialize();
|
||||
base.Reset();
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(12), task =>
|
||||
{
|
||||
DoCastVictim(Spells.VolatileInfection);
|
||||
task.Repeat(TimeSpan.FromSeconds(120));
|
||||
});
|
||||
}
|
||||
|
||||
public override void KilledUnit(Unit who)
|
||||
{
|
||||
if (who.IsTypeId(TypeId.Player))
|
||||
DoCast(who, Spells.PutridMushroom, true);
|
||||
base.KilledUnit(who);
|
||||
}
|
||||
|
||||
public override void EnterCombat(Unit who)
|
||||
{
|
||||
Talk(Texts.EmerissAggro);
|
||||
base.EnterCombat(who);
|
||||
}
|
||||
|
||||
public override void DamageTaken(Unit attacker, ref uint damage)
|
||||
{
|
||||
if (!HealthAbovePct(100 - 25 * _stage))
|
||||
{
|
||||
Talk(Texts.EmerissCastCorruption);
|
||||
DoCast(me, Spells.CorruptionOfEarth, true);
|
||||
++_stage;
|
||||
}
|
||||
}
|
||||
|
||||
byte _stage;
|
||||
}
|
||||
|
||||
public override CreatureAI GetAI(Creature creature)
|
||||
{
|
||||
return new boss_emerissAI(creature);
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class boss_taerar : CreatureScript
|
||||
{
|
||||
public boss_taerar() : base("boss_taerar") { }
|
||||
|
||||
class boss_taerarAI : emerald_dragonAI
|
||||
{
|
||||
public boss_taerarAI(Creature creature) : base(creature)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
_stage = 1;
|
||||
_shades = 0;
|
||||
_banished = false;
|
||||
_banishedTimer = 0;
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
me.RemoveAurasDueToSpell(Spells.Shade);
|
||||
|
||||
Initialize();
|
||||
|
||||
base.Reset();
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(12), task =>
|
||||
{
|
||||
DoCast(Spells.ArcaneBlast);
|
||||
task.Repeat(TimeSpan.FromSeconds(7), TimeSpan.FromSeconds(12));
|
||||
});
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(30), task =>
|
||||
{
|
||||
DoCast(Spells.BellowingRoar);
|
||||
task.Repeat(TimeSpan.FromSeconds(20), TimeSpan.FromSeconds(30));
|
||||
});
|
||||
}
|
||||
|
||||
public override void EnterCombat(Unit who)
|
||||
{
|
||||
Talk(Texts.TaerarAggro);
|
||||
base.EnterCombat(who);
|
||||
}
|
||||
|
||||
public override void SummonedCreatureDies(Creature summon, Unit killer)
|
||||
{
|
||||
--_shades;
|
||||
}
|
||||
|
||||
public override void DamageTaken(Unit attacker, ref uint damage)
|
||||
{
|
||||
// At 75, 50 or 25 percent health, we need to activate the shades and go "banished"
|
||||
// Note: _stage holds the amount of times they have been summoned
|
||||
if (!_banished && !HealthAbovePct(100 - 25 * _stage))
|
||||
{
|
||||
_banished = true;
|
||||
_banishedTimer = 60000;
|
||||
|
||||
me.InterruptNonMeleeSpells(false);
|
||||
DoStopAttack();
|
||||
|
||||
Talk(Texts.TaerarSummonShades);
|
||||
|
||||
foreach (var spell in Spells.TaerarShadeSpells)
|
||||
DoCastVictim(spell, true);
|
||||
_shades += (byte)Spells.TaerarShadeSpells.Length;
|
||||
|
||||
DoCast(Spells.Shade);
|
||||
me.SetFlag(UnitFields.Flags, UnitFlags.NotSelectable | UnitFlags.NonAttackable);
|
||||
me.SetReactState(ReactStates.Passive);
|
||||
|
||||
++_stage;
|
||||
}
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
if (!me.IsInCombat())
|
||||
return;
|
||||
|
||||
if (_banished)
|
||||
{
|
||||
// If all three shades are dead, OR it has taken too long, end the current event and get Taerar back into business
|
||||
if (_banishedTimer <= diff || _shades == 0)
|
||||
{
|
||||
_banished = false;
|
||||
|
||||
me.RemoveFlag(UnitFields.Flags, UnitFlags.NotSelectable | UnitFlags.NonAttackable);
|
||||
me.RemoveAurasDueToSpell(Spells.Shade);
|
||||
me.SetReactState(ReactStates.Aggressive);
|
||||
}
|
||||
// _banishtimer has not expired, and we still have active shades:
|
||||
else
|
||||
_banishedTimer -= diff;
|
||||
|
||||
// Update the scheduler before we return (handled under emerald_dragonAI.UpdateAI(diff); if we're not inside this check)
|
||||
_scheduler.Update(diff);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
base.UpdateAI(diff);
|
||||
}
|
||||
|
||||
bool _banished; // used for shades activation testing
|
||||
uint _banishedTimer; // counter for banishment timeout
|
||||
byte _shades; // keep track of how many shades are dead
|
||||
byte _stage; // check which "shade phase" we're at (75-50-25 percentage counters)
|
||||
}
|
||||
|
||||
public override CreatureAI GetAI(Creature creature)
|
||||
{
|
||||
return new boss_taerarAI(creature);
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class spell_dream_fog_sleep : SpellScript
|
||||
{
|
||||
void FilterTargets(List<WorldObject> targets)
|
||||
{
|
||||
targets.RemoveAll(obj =>
|
||||
{
|
||||
Unit unit = obj.ToUnit();
|
||||
if (unit)
|
||||
return unit.HasAura(Spells.Sleep);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitDestAreaEnemy));
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class spell_mark_of_nature : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(Spells.MarkOfNature, Spells.AuraOfNature);
|
||||
}
|
||||
|
||||
void FilterTargets(List<WorldObject> targets)
|
||||
{
|
||||
targets.RemoveAll(obj =>
|
||||
{
|
||||
// return those not tagged or already under the influence of Aura of Nature
|
||||
Unit unit = obj.ToUnit();
|
||||
if (unit)
|
||||
return !(unit.HasAura(Spells.MarkOfNature) && !unit.HasAura(Spells.AuraOfNature));
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
void HandleEffect(uint effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
GetHitUnit().CastSpell(GetHitUnit(), Spells.AuraOfNature, true);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitSrcAreaEnemy));
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleEffect, 0, SpellEffectName.ApplyAura));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2017 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Game;
|
||||
using Game.Entities;
|
||||
using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
|
||||
namespace Scripts.World
|
||||
{
|
||||
[Script]
|
||||
class DuelResetScript : PlayerScript
|
||||
{
|
||||
public DuelResetScript() : base("DuelResetScript")
|
||||
{
|
||||
_resetCooldowns = WorldConfig.GetBoolValue(WorldCfg.ResetDuelCooldowns);
|
||||
_resetHealthMana = WorldConfig.GetBoolValue(WorldCfg.ResetDuelHealthMana);
|
||||
}
|
||||
|
||||
public override void OnDuelStart(Player player1, Player player2)
|
||||
{
|
||||
// Cooldowns reset
|
||||
if (_resetCooldowns)
|
||||
{
|
||||
player1.GetSpellHistory().SaveCooldownStateBeforeDuel();
|
||||
player2.GetSpellHistory().SaveCooldownStateBeforeDuel();
|
||||
|
||||
ResetSpellCooldowns(player1, true);
|
||||
ResetSpellCooldowns(player2, true);
|
||||
}
|
||||
|
||||
// Health and mana reset
|
||||
if (_resetHealthMana)
|
||||
{
|
||||
player1.SaveHealthBeforeDuel();
|
||||
player1.SetHealth(player1.GetMaxHealth());
|
||||
|
||||
player2.SaveHealthBeforeDuel();
|
||||
player2.SetHealth(player2.GetMaxHealth());
|
||||
|
||||
// check if player1 class uses mana
|
||||
if (player1.getPowerType() == PowerType.Mana || player1.GetClass() == Class.Druid)
|
||||
{
|
||||
player1.SaveManaBeforeDuel();
|
||||
player1.SetPower(PowerType.Mana, player1.GetMaxPower(PowerType.Mana));
|
||||
}
|
||||
|
||||
// check if player2 class uses mana
|
||||
if (player2.getPowerType() == PowerType.Mana || player2.GetClass() == Class.Druid)
|
||||
{
|
||||
player2.SaveManaBeforeDuel();
|
||||
player2.SetPower(PowerType.Mana, player2.GetMaxPower(PowerType.Mana));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDuelEnd(Player winner, Player loser, DuelCompleteType type)
|
||||
{
|
||||
// do not reset anything if DUEL_INTERRUPTED or DUEL_FLED
|
||||
if (type == DuelCompleteType.Won)
|
||||
{
|
||||
// Cooldown restore
|
||||
if (_resetCooldowns)
|
||||
{
|
||||
ResetSpellCooldowns(winner, false);
|
||||
ResetSpellCooldowns(loser, false);
|
||||
|
||||
winner.GetSpellHistory().RestoreCooldownStateAfterDuel();
|
||||
loser.GetSpellHistory().RestoreCooldownStateAfterDuel();
|
||||
}
|
||||
|
||||
// Health and mana restore
|
||||
if (_resetHealthMana)
|
||||
{
|
||||
winner.RestoreHealthAfterDuel();
|
||||
loser.RestoreHealthAfterDuel();
|
||||
|
||||
// check if player1 class uses mana
|
||||
if (winner.getPowerType() == PowerType.Mana || winner.GetClass() == Class.Druid)
|
||||
winner.RestoreManaAfterDuel();
|
||||
|
||||
// check if player2 class uses mana
|
||||
if (loser.getPowerType() == PowerType.Mana || loser.GetClass() == Class.Druid)
|
||||
loser.RestoreManaAfterDuel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ResetSpellCooldowns(Player player, bool onStartDuel)
|
||||
{
|
||||
if (onStartDuel)
|
||||
{
|
||||
// remove cooldowns on spells that have < 10 min CD > 30 sec and has no onHold
|
||||
player.GetSpellHistory().ResetCooldowns(pair =>
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
uint cooldownDuration = pair.Value.CooldownEnd > now ? (uint)(pair.Value.CooldownEnd - now).TotalMilliseconds : 0;
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(pair.Key);
|
||||
return spellInfo.RecoveryTime < 10 * Time.Minute * Time.InMilliseconds
|
||||
&& spellInfo.CategoryRecoveryTime < 10 * Time.Minute * Time.InMilliseconds
|
||||
&& !pair.Value.OnHold
|
||||
&& cooldownDuration > 0
|
||||
&& (spellInfo.RecoveryTime - cooldownDuration) > (Time.Minute / 2) * Time.InMilliseconds
|
||||
&& (spellInfo.CategoryRecoveryTime - cooldownDuration) > (Time.Minute / 2) * Time.InMilliseconds;
|
||||
}, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// remove cooldowns on spells that have < 10 min CD and has no onHold
|
||||
player.GetSpellHistory().ResetCooldowns(pair =>
|
||||
{
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(pair.Key);
|
||||
return spellInfo.RecoveryTime < 10 * Time.Minute * Time.InMilliseconds
|
||||
&& spellInfo.CategoryRecoveryTime < 10 * Time.Minute * Time.InMilliseconds
|
||||
&& !pair.Value.OnHold;
|
||||
}, true);
|
||||
}
|
||||
|
||||
// pet cooldowns
|
||||
Pet pet = player.GetPet();
|
||||
if (pet)
|
||||
pet.GetSpellHistory().ResetAllCooldowns();
|
||||
}
|
||||
|
||||
bool _resetCooldowns;
|
||||
bool _resetHealthMana;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,352 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2017 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.AI;
|
||||
using Game.Entities;
|
||||
using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
|
||||
namespace Scripts.World
|
||||
{
|
||||
public struct GuardsConst
|
||||
{
|
||||
public const int CreatureCooldown = 5000;
|
||||
public const int SaySilAggro = 0;
|
||||
}
|
||||
|
||||
struct CreatureIds
|
||||
{
|
||||
public const int CenarionHoldIndantry = 15184;
|
||||
public const int StormwindCityGuard = 68;
|
||||
public const int StormwindCityPatroller = 1976;
|
||||
public const int OrgimmarGrunt = 3296;
|
||||
}
|
||||
|
||||
struct Spells
|
||||
{
|
||||
public const uint BanishedA = 36642;
|
||||
public const uint BanishedS = 36671;
|
||||
public const uint BanishTeleport = 36643;
|
||||
public const uint Exile = 39533;
|
||||
}
|
||||
|
||||
[Script]
|
||||
class guard_generic : GuardAI
|
||||
{
|
||||
public guard_generic(Creature creature) : base(creature) { }
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
globalCooldown = 0;
|
||||
buffTimer = 0;
|
||||
}
|
||||
|
||||
public override void EnterCombat(Unit who)
|
||||
{
|
||||
if (me.GetEntry() == CreatureIds.CenarionHoldIndantry)
|
||||
Talk(GuardsConst.SaySilAggro, who);
|
||||
SpellInfo spell = me.reachWithSpellAttack(who);
|
||||
if (spell != null)
|
||||
DoCast(who, spell.Id);
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
//Always decrease our global cooldown first
|
||||
if (globalCooldown > diff)
|
||||
globalCooldown -= diff;
|
||||
else
|
||||
globalCooldown = 0;
|
||||
|
||||
//Buff timer (only buff when we are alive and not in combat
|
||||
if (me.IsAlive() && !me.IsInCombat())
|
||||
{
|
||||
if (buffTimer <= diff)
|
||||
{
|
||||
//Find a spell that targets friendly and applies an aura (these are generally buffs)
|
||||
SpellInfo info = SelectSpell(me, 0, 0, SelectTargetType.AnyFriend, 0, 0, SelectEffect.Aura);
|
||||
|
||||
if (info != null && globalCooldown == 0)
|
||||
{
|
||||
//Cast the buff spell
|
||||
DoCast(me, info.Id);
|
||||
|
||||
//Set our global cooldown
|
||||
globalCooldown = GuardsConst.CreatureCooldown;
|
||||
|
||||
//Set our timer to 10 minutes before rebuff
|
||||
buffTimer = 600000;
|
||||
} //Try again in 30 seconds
|
||||
else buffTimer = 30000;
|
||||
}
|
||||
else buffTimer -= diff;
|
||||
}
|
||||
|
||||
//Return since we have no target
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
// Make sure our attack is ready and we arn't currently casting
|
||||
if (me.isAttackReady() && !me.IsNonMeleeSpellCast(false))
|
||||
{
|
||||
//If we are within range melee the target
|
||||
if (me.IsWithinMeleeRange(me.GetVictim()))
|
||||
{
|
||||
bool healing = false;
|
||||
SpellInfo info = null;
|
||||
|
||||
//Select a healing spell if less than 30% hp
|
||||
if (me.HealthBelowPct(30))
|
||||
info = SelectSpell(me, 0, 0, SelectTargetType.AnyFriend, 0, 0, SelectEffect.Healing);
|
||||
|
||||
//No healing spell available, select a hostile spell
|
||||
if (info != null)
|
||||
healing = true;
|
||||
else
|
||||
info = SelectSpell(me.GetVictim(), 0, 0, SelectTargetType.AnyEnemy, 0, 0, SelectEffect.DontCare);
|
||||
|
||||
//20% chance to replace our white hit with a spell
|
||||
if (info != null && RandomHelper.IRand(0, 99) < 20 && globalCooldown == 0)
|
||||
{
|
||||
//Cast the spell
|
||||
if (healing)
|
||||
DoCast(me, info.Id);
|
||||
else
|
||||
DoCastVictim(info.Id);
|
||||
|
||||
//Set our global cooldown
|
||||
globalCooldown = GuardsConst.CreatureCooldown;
|
||||
}
|
||||
else
|
||||
me.AttackerStateUpdate(me.GetVictim());
|
||||
|
||||
me.resetAttackTimer();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Only run this code if we arn't already casting
|
||||
if (!me.IsNonMeleeSpellCast(false))
|
||||
{
|
||||
bool healing = false;
|
||||
SpellInfo info = null;
|
||||
|
||||
//Select a healing spell if less than 30% hp ONLY 33% of the time
|
||||
if (me.HealthBelowPct(30) && 33 > RandomHelper.IRand(0, 99))
|
||||
info = SelectSpell(me, 0, 0, SelectTargetType.AnyFriend, 0, 0, SelectEffect.Healing);
|
||||
|
||||
//No healing spell available, See if we can cast a ranged spell (Range must be greater than ATTACK_DISTANCE)
|
||||
if (info != null)
|
||||
healing = true;
|
||||
else
|
||||
info = SelectSpell(me.GetVictim(), 0, 0, SelectTargetType.AnyEnemy, SharedConst.NominalMeleeRange, 0, SelectEffect.DontCare);
|
||||
|
||||
//Found a spell, check if we arn't on cooldown
|
||||
if (info != null && globalCooldown == 0)
|
||||
{
|
||||
//If we are currently moving stop us and set the movement generator
|
||||
if (me.GetMotionMaster().GetCurrentMovementGeneratorType() != MovementGeneratorType.Idle)
|
||||
{
|
||||
me.GetMotionMaster().Clear(false);
|
||||
me.GetMotionMaster().MoveIdle();
|
||||
}
|
||||
|
||||
//Cast spell
|
||||
if (healing)
|
||||
DoCast(me, info.Id);
|
||||
else
|
||||
DoCastVictim(info.Id);
|
||||
|
||||
//Set our global cooldown
|
||||
globalCooldown = GuardsConst.CreatureCooldown;
|
||||
} //If no spells available and we arn't moving run to target
|
||||
else if (me.GetMotionMaster().GetCurrentMovementGeneratorType() != MovementGeneratorType.Chase)
|
||||
{
|
||||
//Cancel our current spell and then mutate new movement generator
|
||||
me.InterruptNonMeleeSpells(false);
|
||||
me.GetMotionMaster().Clear(false);
|
||||
me.GetMotionMaster().MoveChase(me.GetVictim());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
public void DoReplyToTextEmote(TextEmotes emote)
|
||||
{
|
||||
switch (emote)
|
||||
{
|
||||
case TextEmotes.Kiss:
|
||||
me.HandleEmoteCommand(Emote.OneshotBow);
|
||||
break;
|
||||
|
||||
case TextEmotes.Wave:
|
||||
me.HandleEmoteCommand(Emote.OneshotWave);
|
||||
break;
|
||||
|
||||
case TextEmotes.Salute:
|
||||
me.HandleEmoteCommand(Emote.OneshotSalute);
|
||||
break;
|
||||
|
||||
case TextEmotes.Shy:
|
||||
me.HandleEmoteCommand(Emote.OneshotFlex);
|
||||
break;
|
||||
|
||||
case TextEmotes.Rude:
|
||||
case TextEmotes.Chicken:
|
||||
me.HandleEmoteCommand(Emote.OneshotPoint);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void ReceiveEmote(Player player, TextEmotes textEmote)
|
||||
{
|
||||
switch (me.GetEntry())
|
||||
{
|
||||
case CreatureIds.StormwindCityGuard:
|
||||
case CreatureIds.StormwindCityPatroller:
|
||||
case CreatureIds.OrgimmarGrunt:
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
if (!me.IsFriendlyTo(player))
|
||||
return;
|
||||
|
||||
DoReplyToTextEmote(textEmote);
|
||||
}
|
||||
|
||||
uint globalCooldown;
|
||||
uint buffTimer;
|
||||
}
|
||||
|
||||
[Script]
|
||||
class guard_shattrath_scryer : GuardAI
|
||||
{
|
||||
public guard_shattrath_scryer(Creature creature) : base(creature) { }
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
playerGUID.Clear();
|
||||
canTeleport = false;
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(5), task =>
|
||||
{
|
||||
Unit temp = me.GetVictim();
|
||||
if (temp && temp.IsTypeId(TypeId.Player))
|
||||
{
|
||||
DoCast(temp, Spells.BanishedA);
|
||||
playerGUID = temp.GetGUID();
|
||||
if (!playerGUID.IsEmpty())
|
||||
canTeleport = true;
|
||||
|
||||
task.Repeat(TimeSpan.FromSeconds(9));
|
||||
}
|
||||
});
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(8.5), task =>
|
||||
{
|
||||
if (canTeleport)
|
||||
{
|
||||
Unit temp = Global.ObjAccessor.GetUnit(me, playerGUID);
|
||||
if (temp)
|
||||
{
|
||||
temp.CastSpell(temp, Spells.Exile, true);
|
||||
temp.CastSpell(temp, Spells.BanishTeleport, true);
|
||||
}
|
||||
playerGUID.Clear();
|
||||
canTeleport = false;
|
||||
|
||||
task.Repeat();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
_scheduler.Update(diff);
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
ObjectGuid playerGUID;
|
||||
bool canTeleport;
|
||||
}
|
||||
|
||||
[Script]
|
||||
class guard_shattrath_aldor : GuardAI
|
||||
{
|
||||
public guard_shattrath_aldor(Creature creature) : base(creature) { }
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
playerGUID.Clear();
|
||||
canTeleport = false;
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(5), task =>
|
||||
{
|
||||
Unit temp = me.GetVictim();
|
||||
if (temp && temp.IsTypeId(TypeId.Player))
|
||||
{
|
||||
DoCast(temp, Spells.BanishedA);
|
||||
playerGUID = temp.GetGUID();
|
||||
if (!playerGUID.IsEmpty())
|
||||
canTeleport = true;
|
||||
|
||||
task.Repeat(TimeSpan.FromSeconds(9));
|
||||
}
|
||||
});
|
||||
|
||||
_scheduler.Schedule(TimeSpan.FromSeconds(8.5), task =>
|
||||
{
|
||||
if (canTeleport)
|
||||
{
|
||||
Unit temp = Global.ObjAccessor.GetUnit(me, playerGUID);
|
||||
if (temp)
|
||||
{
|
||||
temp.CastSpell(temp, Spells.Exile, true);
|
||||
temp.CastSpell(temp, Spells.BanishTeleport, true);
|
||||
}
|
||||
playerGUID.Clear();
|
||||
canTeleport = false;
|
||||
|
||||
task.Repeat();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
_scheduler.Update(diff);
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
ObjectGuid playerGUID;
|
||||
bool canTeleport;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,363 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2017 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using Game.Entities;
|
||||
using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Scripts.World
|
||||
{
|
||||
struct ItemScriptConst
|
||||
{
|
||||
//Onlyforflight
|
||||
public const uint SpellArcaneCharges = 45072;
|
||||
|
||||
//Pilefakefur
|
||||
public const uint GoCaribouTrap1 = 187982;
|
||||
public const uint GoCaribouTrap2 = 187995;
|
||||
public const uint GoCaribouTrap3 = 187996;
|
||||
public const uint GoCaribouTrap4 = 187997;
|
||||
public const uint GoCaribouTrap5 = 187998;
|
||||
public const uint GoCaribouTrap6 = 187999;
|
||||
public const uint GoCaribouTrap7 = 188000;
|
||||
public const uint GoCaribouTrap8 = 188001;
|
||||
public const uint GoCaribouTrap9 = 188002;
|
||||
public const uint GoCaribouTrap10 = 188003;
|
||||
public const uint GoCaribouTrap11 = 188004;
|
||||
public const uint GoCaribouTrap12 = 188005;
|
||||
public const uint GoCaribouTrap13 = 188006;
|
||||
public const uint GoCaribouTrap14 = 188007;
|
||||
public const uint GoCaribouTrap15 = 188008;
|
||||
public const uint GoHighQualityFur = 187983;
|
||||
public const uint NpcNesingwaryTrapper = 25835;
|
||||
|
||||
public static uint[] CaribouTraps =
|
||||
{
|
||||
GoCaribouTrap1, GoCaribouTrap2, GoCaribouTrap3, GoCaribouTrap4, GoCaribouTrap5,
|
||||
GoCaribouTrap6, GoCaribouTrap7, GoCaribouTrap8, GoCaribouTrap9, GoCaribouTrap10,
|
||||
GoCaribouTrap11, GoCaribouTrap12, GoCaribouTrap13, GoCaribouTrap14, GoCaribouTrap15,
|
||||
};
|
||||
|
||||
//Petrovclusterbombs
|
||||
public const uint SpellPetrovBomb = 42406;
|
||||
public const uint AreaIdShatteredStraits = 4064;
|
||||
public const uint ZoneIdHowling = 495;
|
||||
|
||||
//Helpthemselves
|
||||
public const uint QuestCannotHelpThemselves = 11876;
|
||||
public const uint NpcTrappedMammothCalf = 25850;
|
||||
public const uint GoMammothTrap1 = 188022;
|
||||
public const uint GoMammothTrap2 = 188024;
|
||||
public const uint GoMammothTrap3 = 188025;
|
||||
public const uint GoMammothTrap4 = 188026;
|
||||
public const uint GoMammothTrap5 = 188027;
|
||||
public const uint GoMammothTrap6 = 188028;
|
||||
public const uint GoMammothTrap7 = 188029;
|
||||
public const uint GoMammothTrap8 = 188030;
|
||||
public const uint GoMammothTrap9 = 188031;
|
||||
public const uint GoMammothTrap10 = 188032;
|
||||
public const uint GoMammothTrap11 = 188033;
|
||||
public const uint GoMammothTrap12 = 188034;
|
||||
public const uint GoMammothTrap13 = 188035;
|
||||
public const uint GoMammothTrap14 = 188036;
|
||||
public const uint GoMammothTrap15 = 188037;
|
||||
public const uint GoMammothTrap16 = 188038;
|
||||
public const uint GoMammothTrap17 = 188039;
|
||||
public const uint GoMammothTrap18 = 188040;
|
||||
public const uint GoMammothTrap19 = 188041;
|
||||
public const uint GoMammothTrap20 = 188042;
|
||||
public const uint GoMammothTrap21 = 188043;
|
||||
public const uint GoMammothTrap22 = 188044;
|
||||
|
||||
public static uint[] MammothTraps =
|
||||
{
|
||||
GoMammothTrap1, GoMammothTrap2, GoMammothTrap3, GoMammothTrap4, GoMammothTrap5,
|
||||
GoMammothTrap6, GoMammothTrap7, GoMammothTrap8, GoMammothTrap9, GoMammothTrap10,
|
||||
GoMammothTrap11, GoMammothTrap12, GoMammothTrap13, GoMammothTrap14, GoMammothTrap15,
|
||||
GoMammothTrap16, GoMammothTrap17, GoMammothTrap18, GoMammothTrap19, GoMammothTrap20,
|
||||
GoMammothTrap21, GoMammothTrap22
|
||||
};
|
||||
|
||||
//Theemissary
|
||||
public const uint QuestTheEmissary = 11626;
|
||||
public const uint NpcLeviroth = 26452;
|
||||
|
||||
//Capturedfrog
|
||||
public const uint QuestThePerfectSpies = 25444;
|
||||
public const uint NpcVanirasSentryTotem = 40187;
|
||||
}
|
||||
|
||||
[Script]
|
||||
class item_only_for_flight : ItemScript
|
||||
{
|
||||
public item_only_for_flight() : base("item_only_for_flight") { }
|
||||
|
||||
public override bool OnUse(Player player, Item item, SpellCastTargets targets, ObjectGuid castId)
|
||||
{
|
||||
uint itemId = item.GetEntry();
|
||||
bool disabled = false;
|
||||
|
||||
//for special scripts
|
||||
switch (itemId)
|
||||
{
|
||||
case 24538:
|
||||
if (player.GetAreaId() != 3628)
|
||||
disabled = true;
|
||||
break;
|
||||
case 34489:
|
||||
if (player.GetZoneId() != 4080)
|
||||
disabled = true;
|
||||
break;
|
||||
case 34475:
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(ItemScriptConst.SpellArcaneCharges);
|
||||
if (spellInfo != null)
|
||||
Spell.SendCastResult(player, spellInfo, 0, castId, SpellCastResult.NotOnGround);
|
||||
break;
|
||||
}
|
||||
|
||||
// allow use in flight only
|
||||
if (player.IsInFlight() && !disabled)
|
||||
return false;
|
||||
|
||||
// error
|
||||
player.SendEquipError(InventoryResult.ClientLockedOut, item, null);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
[Script] //item_nether_wraith_beacon
|
||||
class item_nether_wraith_beacon : ItemScript
|
||||
{
|
||||
public item_nether_wraith_beacon() : base("item_nether_wraith_beacon") { }
|
||||
|
||||
public override bool OnUse(Player player, Item item, SpellCastTargets targets, ObjectGuid castId)
|
||||
{
|
||||
if (player.GetQuestStatus(10832) == QuestStatus.Incomplete)
|
||||
{
|
||||
Creature nether = player.SummonCreature(22408, player.GetPositionX(), player.GetPositionY() + 20, player.GetPositionZ(), 0, TempSummonType.TimedDespawn, 180000);
|
||||
if (nether)
|
||||
nether.GetAI().AttackStart(player);
|
||||
|
||||
Creature nether1 = player.SummonCreature(22408, player.GetPositionX(), player.GetPositionY() - 20, player.GetPositionZ(), 0, TempSummonType.TimedDespawn, 180000);
|
||||
if (nether1)
|
||||
nether1.GetAI().AttackStart(player);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[Script] //item_gor_dreks_ointment
|
||||
class item_gor_dreks_ointment : ItemScript
|
||||
{
|
||||
public item_gor_dreks_ointment() : base("item_gor_dreks_ointment") { }
|
||||
|
||||
public override bool OnUse(Player player, Item item, SpellCastTargets targets, ObjectGuid castId)
|
||||
{
|
||||
if (targets.GetUnitTarget() && targets.GetUnitTarget().IsTypeId(TypeId.Unit) &&
|
||||
targets.GetUnitTarget().GetEntry() == 20748 && !targets.GetUnitTarget().HasAura(32578))
|
||||
return false;
|
||||
|
||||
player.SendEquipError(InventoryResult.ClientLockedOut, item, null);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
[Script] //item_incendiary_explosives
|
||||
class item_incendiary_explosives : ItemScript
|
||||
{
|
||||
public item_incendiary_explosives() : base("item_incendiary_explosives") { }
|
||||
|
||||
public override bool OnUse(Player player, Item item, SpellCastTargets targets, ObjectGuid castId)
|
||||
{
|
||||
if (player.FindNearestCreature(26248, 15) || player.FindNearestCreature(26249, 15))
|
||||
return false;
|
||||
else
|
||||
{
|
||||
player.SendEquipError(InventoryResult.OutOfRange, item, null);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Script] //item_mysterious_egg
|
||||
class item_mysterious_egg : ItemScript
|
||||
{
|
||||
public item_mysterious_egg() : base("item_mysterious_egg") { }
|
||||
|
||||
public override bool OnExpire(Player player, ItemTemplate pItemProto)
|
||||
{
|
||||
List<ItemPosCount> dest = new List<ItemPosCount>();
|
||||
InventoryResult msg = player.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, 39883, 1); // Cracked Egg
|
||||
if (msg == InventoryResult.Ok)
|
||||
player.StoreNewItem(dest, 39883, true, ItemEnchantment.GenerateItemRandomPropertyId(39883));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
[Script] //item_disgusting_jar
|
||||
class item_disgusting_jar : ItemScript
|
||||
{
|
||||
public item_disgusting_jar() : base("item_disgusting_jar") { }
|
||||
|
||||
public override bool OnExpire(Player player, ItemTemplate pItemProto)
|
||||
{
|
||||
List<ItemPosCount> dest = new List<ItemPosCount>();
|
||||
InventoryResult msg = player.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, 44718, 1); // Ripe Disgusting Jar
|
||||
if (msg == InventoryResult.Ok)
|
||||
player.StoreNewItem(dest, 44718, true, ItemEnchantment.GenerateItemRandomPropertyId(44718));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
[Script] //item_pile_fake_furs
|
||||
class item_pile_fake_furs : ItemScript
|
||||
{
|
||||
public item_pile_fake_furs() : base("item_pile_fake_furs") { }
|
||||
|
||||
public override bool OnUse(Player player, Item item, SpellCastTargets targets, ObjectGuid castId)
|
||||
{
|
||||
GameObject go = null;
|
||||
for (byte i = 0; i < ItemScriptConst.CaribouTraps.Length; ++i)
|
||||
{
|
||||
go = player.FindNearestGameObject(ItemScriptConst.CaribouTraps[i], 5.0f);
|
||||
if (go)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!go)
|
||||
return false;
|
||||
|
||||
if (go.FindNearestCreature(ItemScriptConst.NpcNesingwaryTrapper, 10.0f, true) || go.FindNearestCreature(ItemScriptConst.NpcNesingwaryTrapper, 10.0f, false) || go.FindNearestGameObject(ItemScriptConst.GoHighQualityFur, 2.0f))
|
||||
return true;
|
||||
|
||||
float x, y, z;
|
||||
go.GetClosePoint(out x, out y, out z, go.GetObjectSize() / 3, 7.0f);
|
||||
go.SummonGameObject(ItemScriptConst.GoHighQualityFur, go, Quaternion.WAxis, 1);
|
||||
TempSummon summon = player.SummonCreature(ItemScriptConst.NpcNesingwaryTrapper, x, y, z, go.GetOrientation(), TempSummonType.DeadDespawn, 1000);
|
||||
if (summon)
|
||||
{
|
||||
summon.SetVisible(false);
|
||||
summon.SetReactState(ReactStates.Passive);
|
||||
summon.SetFlag(UnitFields.Flags, UnitFlags.ImmuneToPc);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[Script] //item_petrov_cluster_bombs
|
||||
class item_petrov_cluster_bombs : ItemScript
|
||||
{
|
||||
public item_petrov_cluster_bombs() : base("item_petrov_cluster_bombs") { }
|
||||
|
||||
public override bool OnUse(Player player, Item item, SpellCastTargets targets, ObjectGuid castId)
|
||||
{
|
||||
if (player.GetZoneId() != ItemScriptConst.ZoneIdHowling)
|
||||
return false;
|
||||
|
||||
if (!player.GetTransport() || player.GetAreaId() != ItemScriptConst.AreaIdShatteredStraits)
|
||||
{
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(ItemScriptConst.SpellPetrovBomb);
|
||||
if (spellInfo != null)
|
||||
Spell.SendCastResult(player, spellInfo, 0, castId, SpellCastResult.NotHere);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//item_dehta_trap_smasher
|
||||
[Script] //For quest 11876, Help Those That Cannot Help Themselves
|
||||
class item_dehta_trap_smasher : ItemScript
|
||||
{
|
||||
public item_dehta_trap_smasher() : base("item_dehta_trap_smasher") { }
|
||||
|
||||
public override bool OnUse(Player player, Item item, SpellCastTargets targets, ObjectGuid castId)
|
||||
{
|
||||
if (player.GetQuestStatus(ItemScriptConst.QuestCannotHelpThemselves) != QuestStatus.Incomplete)
|
||||
return false;
|
||||
|
||||
Creature pMammoth = player.FindNearestCreature(ItemScriptConst.NpcTrappedMammothCalf, 5.0f);
|
||||
if (!pMammoth)
|
||||
return false;
|
||||
|
||||
GameObject pTrap = null;
|
||||
for (byte i = 0; i < ItemScriptConst.MammothTraps.Length; ++i)
|
||||
{
|
||||
pTrap = player.FindNearestGameObject(ItemScriptConst.MammothTraps[i], 11.0f);
|
||||
if (pTrap)
|
||||
{
|
||||
pMammoth.GetAI().DoAction(1);
|
||||
pTrap.SetGoState(GameObjectState.Ready);
|
||||
player.KilledMonsterCredit(ItemScriptConst.NpcTrappedMammothCalf);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class item_trident_of_nazjan : ItemScript
|
||||
{
|
||||
public item_trident_of_nazjan() : base("item_Trident_of_Nazjan") { }
|
||||
|
||||
public override bool OnUse(Player player, Item item, SpellCastTargets targets, ObjectGuid castId)
|
||||
{
|
||||
if (player.GetQuestStatus(ItemScriptConst.QuestTheEmissary) == QuestStatus.Incomplete)
|
||||
{
|
||||
Creature pLeviroth = player.FindNearestCreature(ItemScriptConst.NpcLeviroth, 10.0f);
|
||||
if (pLeviroth) // spell range
|
||||
{
|
||||
pLeviroth.GetAI().AttackStart(player);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
player.SendEquipError(InventoryResult.OutOfRange, item, null);
|
||||
}
|
||||
else
|
||||
player.SendEquipError(InventoryResult.ClientLockedOut, item, null);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
class item_captured_frog : ItemScript
|
||||
{
|
||||
public item_captured_frog() : base("item_captured_frog") { }
|
||||
|
||||
public override bool OnUse(Player player, Item item, SpellCastTargets targets, ObjectGuid castId)
|
||||
{
|
||||
if (player.GetQuestStatus(ItemScriptConst.QuestThePerfectSpies) == QuestStatus.Incomplete)
|
||||
{
|
||||
if (player.FindNearestCreature(ItemScriptConst.NpcVanirasSentryTotem, 10.0f))
|
||||
return false;
|
||||
else
|
||||
player.SendEquipError(InventoryResult.OutOfRange, item, null);
|
||||
}
|
||||
else
|
||||
player.SendEquipError(InventoryResult.ClientLockedOut, item, null);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2017 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Game.AI;
|
||||
using Game.Entities;
|
||||
using Game.Scripting;
|
||||
using System;
|
||||
|
||||
namespace Scripts.World
|
||||
{
|
||||
[Script]
|
||||
class trigger_periodic : NullCreatureAI
|
||||
{
|
||||
public trigger_periodic(Creature creature) : base(creature)
|
||||
{
|
||||
var interval = me.GetBaseAttackTime(Framework.Constants.WeaponAttackType.BaseAttack);
|
||||
_scheduler.Schedule(TimeSpan.FromMilliseconds(interval), task =>
|
||||
{
|
||||
me.CastSpell(me, me.m_spells[0], true);
|
||||
task.Repeat(TimeSpan.FromMilliseconds(interval));
|
||||
});
|
||||
}
|
||||
|
||||
public override void UpdateAI(uint diff)
|
||||
{
|
||||
_scheduler.Update();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2017 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
namespace Scripts.World
|
||||
{
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2017 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Game;
|
||||
using Game.Entities;
|
||||
using Game.Scripting;
|
||||
|
||||
namespace Scripts.World
|
||||
{
|
||||
struct SceneSpells
|
||||
{
|
||||
public const uint DeathwingSimulator = 201184;
|
||||
}
|
||||
|
||||
[Script]
|
||||
class scene_deathwing_simulator : SceneScript
|
||||
{
|
||||
public scene_deathwing_simulator() : base("scene_deathwing_simulator") { }
|
||||
|
||||
// Called when a player receive trigger from scene
|
||||
public override void OnSceneTriggerEvent(Player player, uint sceneInstanceID, SceneTemplate sceneTemplate, string triggerName)
|
||||
{
|
||||
if (triggerName == "BURN PLAYER")
|
||||
player.CastSpell(player, SceneSpells.DeathwingSimulator, true); // Deathwing Simulator Burn player
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user