More updates to scripts (still wont build)

This commit is contained in:
hondacrx
2023-10-13 16:11:34 -04:00
parent cda53c8e7f
commit 33091ed942
26 changed files with 4195 additions and 2894 deletions
+1 -1
View File
@@ -847,7 +847,7 @@ namespace Game.Chat
public uint GetNumPlayers() { return (uint)_playersStore.Count; } public uint GetNumPlayers() { return (uint)_playersStore.Count; }
public ChannelFlags GetFlags() { return _channelFlags; } public ChannelFlags GetFlags() { return _channelFlags; }
bool HasFlag(ChannelFlags flag) { return _channelFlags.HasAnyFlag(flag); } public bool HasFlag(ChannelFlags flag) { return _channelFlags.HasAnyFlag(flag); }
public AreaTableRecord GetZoneEntry() { return _zoneEntry; } public AreaTableRecord GetZoneEntry() { return _zoneEntry; }
@@ -3126,6 +3126,7 @@ namespace Game.Entities
public virtual uint GetFaction() { return 0; } public virtual uint GetFaction() { return 0; }
public virtual void SetFaction(uint faction) { } public virtual void SetFaction(uint faction) { }
public virtual void SetFaction(FactionTemplates faction) { }
//Position //Position
+1 -1
View File
@@ -6669,7 +6669,7 @@ namespace Game.Entities
uint level = GetLevel(); uint level = GetLevel();
ScriptMgr.OnGivePlayerXP(this, xp, victim); ScriptMgr.OnGivePlayerXP(this, ref xp, victim);
// XP to money conversion processed in Player.RewardQuest // XP to money conversion processed in Player.RewardQuest
if (IsMaxLevel()) if (IsMaxLevel())
+1
View File
@@ -2263,6 +2263,7 @@ namespace Game.Entities
public override uint GetFaction() { return m_unitData.FactionTemplate; } public override uint GetFaction() { return m_unitData.FactionTemplate; }
public override void SetFaction(uint faction) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.FactionTemplate), faction); } public override void SetFaction(uint faction) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.FactionTemplate), faction); }
public override void SetFaction(FactionTemplates faction) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.FactionTemplate), (uint)faction); }
public void RestoreFaction() public void RestoreFaction()
{ {
+1 -1
View File
@@ -1620,7 +1620,7 @@ namespace Game.Groups
return m_guid.GetCounter(); return m_guid.GetCounter();
} }
string GetLeaderName() public string GetLeaderName()
{ {
return m_leaderName; return m_leaderName;
} }
+3 -3
View File
@@ -2793,7 +2793,7 @@ namespace Game.Maps
bool _reverse; bool _reverse;
} }
public class UnitAuraCheck<T> : ICheck<T> where T : WorldObject public class UnitAuraCheck : ICheck<WorldObject>
{ {
public UnitAuraCheck(bool present, uint spellId, ObjectGuid casterGUID = default) public UnitAuraCheck(bool present, uint spellId, ObjectGuid casterGUID = default)
{ {
@@ -2802,12 +2802,12 @@ namespace Game.Maps
_casterGUID = casterGUID; _casterGUID = casterGUID;
} }
public bool Invoke(T obj) public bool Invoke(WorldObject obj)
{ {
return obj.ToUnit() != null && obj.ToUnit().HasAura(_spellId, _casterGUID) == _present; return obj.ToUnit() != null && obj.ToUnit().HasAura(_spellId, _casterGUID) == _present;
} }
public static implicit operator Predicate<T>(UnitAuraCheck<T> unit) public static implicit operator Predicate<WorldObject>(UnitAuraCheck unit)
{ {
return unit.Invoke; return unit.Invoke;
} }
+1 -1
View File
@@ -619,7 +619,7 @@ namespace Game.Scripting
public virtual void OnMoneyChanged(Player player, long amount) { } public virtual void OnMoneyChanged(Player player, long amount) { }
// Called when a player gains XP (before anything is given) // Called when a player gains XP (before anything is given)
public virtual void OnGiveXP(Player player, uint amount, Unit victim) { } public virtual uint OnGiveXP(Player player, uint amount, Unit victim) { return 0; }
// Called when a player's reputation changes (before it is actually changed) // Called when a player's reputation changes (before it is actually changed)
public virtual void OnReputationChange(Player player, uint factionId, int standing, bool incremental) { } public virtual void OnReputationChange(Player player, uint factionId, int standing, bool incremental) { }
+4 -2
View File
@@ -801,9 +801,11 @@ namespace Game.Scripting
{ {
ForEach<PlayerScript>(p => p.OnMoneyChanged(player, amount)); ForEach<PlayerScript>(p => p.OnMoneyChanged(player, amount));
} }
public void OnGivePlayerXP(Player player, uint amount, Unit victim) public void OnGivePlayerXP(Player player, ref uint amount, Unit victim)
{ {
ForEach<PlayerScript>(p => p.OnGiveXP(player, amount, victim)); uint tempAmount = amount;
ForEach<PlayerScript>(p => tempAmount = p.OnGiveXP(player, tempAmount, victim));
amount = tempAmount;
} }
public void OnPlayerReputationChange(Player player, uint factionID, int standing, bool incremental) public void OnPlayerReputationChange(Player player, uint factionID, int standing, bool incremental)
{ {
+2 -2
View File
@@ -4,9 +4,9 @@
using Framework.Constants; using Framework.Constants;
using Game; using Game;
using Game.AI; using Game.AI;
using Game.DataStorage;
using Game.Entities; using Game.Entities;
using Game.Scripting; using Game.Scripting;
using Game.DataStorage;
namespace Scripts.Smart namespace Scripts.Smart
{ {
@@ -126,7 +126,7 @@ namespace Scripts.Smart
Log.outDebug(LogFilter.ScriptsAi, $"Event {eventId} is using SmartEventTrigger script"); Log.outDebug(LogFilter.ScriptsAi, $"Event {eventId} is using SmartEventTrigger script");
SmartScript script = new(); SmartScript script = new();
// Set invoker as BaseObject if there isn't target for GameEvents::Trigger // Set invoker as BaseObject if there isn't target for GameEvents::Trigger
script.OnInitialize(obj?? invoker, null, null, null, eventId); script.OnInitialize(obj ?? invoker, null, null, null, eventId);
script.ProcessEventsFor(SmartEvents.SendEventTrigger, invoker.ToUnit(), 0, 0, false, null, invoker.ToGameObject()); script.ProcessEventsFor(SmartEvents.SendEventTrigger, invoker.ToUnit(), 0, 0, false, null, invoker.ToGameObject());
} }
} }
+1 -1
View File
@@ -1390,7 +1390,7 @@ namespace Scripts.Spells.Azerite
} }
} }
// 13790 13793 13811 13814 - Among the ChaMathF.PIons // 13790 13793 13811 13814 - Among the Chapions
[Script] // 13665 13745 13750 13756 13761 13767 13772 13777 13782 13787 - The Grand Melee [Script] // 13665 13745 13750 13756 13761 13767 13772 13777 13782 13787 - The Grand Melee
class spell_q13665_q13790_bested_trigger : SpellScript class spell_q13665_q13790_bested_trigger : SpellScript
{ {
@@ -2,47 +2,18 @@
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. // Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
using Framework.Constants; using Framework.Constants;
using Game.BattleGrounds; using Game.DataStorage;
using Game.BattleGrounds.Zones;
using Game.Entities; using Game.Entities;
using Game.Scripting; using Game.Scripting;
using Game.DataStorage;
namespace Scripts.World.Achievements namespace Scripts.World.Achievements
{ {
struct AreaIds [Script]
{
//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;
}
struct AuraIds
{
//Flirt With Disaster
public const uint AuraPerfumeForever = 70235;
public const uint AuraPerfumeEnchantress = 70234;
public const uint AuraPerfumeVictory = 70233;
}
struct VehicleIds
{
//BgSA Artillery
public const uint AntiPersonnalCannon = 27894;
}
[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 class achievement_arena_kills : AchievementCriteriaScript
{ {
ArenaTypes _arenaType; byte _arenaType;
public achievement_arena_kills(string name, ArenaTypes arenaType) : base(name) public achievement_arena_kills(string name, byte arenaType) : base(name)
{ {
_arenaType = arenaType; _arenaType = arenaType;
} }
@@ -53,26 +24,33 @@ namespace Scripts.World.Achievements
if (!source.InArena()) if (!source.InArena())
return false; return false;
return source.GetBattleground().GetArenaType() == _arenaType; return source.GetBattleground().GetArenaType() == (ArenaTypes)_arenaType;
} }
} }
[Script] [Script]
class achievement_tilted : AchievementCriteriaScript class achievement_tilted : AchievementCriteriaScript
{ {
const uint AreaArgentTournamentFields = 4658;
const uint AreaRingOfAspirants = 4670;
const uint AreaRingOfArgentValiants = 4671;
const uint AreaRingOfAllianceValiants = 4672;
const uint AreaRingOfHordeValiants = 4673;
const uint AreaRingOfChapions = 4669;
public achievement_tilted() : base("achievement_tilted") { } public achievement_tilted() : base("achievement_tilted") { }
public override bool OnCheck(Player player, Unit target) public override bool OnCheck(Player player, Unit target)
{ {
if (!player) if (player == null)
return false; return false;
bool checkArea = player.GetAreaId() == AreaIds.AreaArgentTournamentFields || bool checkArea = player.GetAreaId() == AreaArgentTournamentFields ||
player.GetAreaId() == AreaIds.AreaRingOfAspirants || player.GetAreaId() == AreaRingOfAspirants ||
player.GetAreaId() == AreaIds.AreaRingOfArgentValiants || player.GetAreaId() == AreaRingOfArgentValiants ||
player.GetAreaId() == AreaIds.AreaRingOfAllianceValiants || player.GetAreaId() == AreaRingOfAllianceValiants ||
player.GetAreaId() == AreaIds.AreaRingOfHordeValiants || player.GetAreaId() == AreaRingOfHordeValiants ||
player.GetAreaId() == AreaIds.AreaRingOfChampions; player.GetAreaId() == AreaRingOfChapions;
return checkArea && player.duel != null && player.duel.IsMounted; return checkArea && player.duel != null && player.duel.IsMounted;
} }
@@ -81,14 +59,18 @@ namespace Scripts.World.Achievements
[Script] [Script]
class achievement_flirt_with_disaster_perf_check : AchievementCriteriaScript class achievement_flirt_with_disaster_perf_check : AchievementCriteriaScript
{ {
const uint AuraPerfumeForever = 70235;
const uint AuraPerfumeEnchantress = 70234;
const uint AuraPerfumeVictory = 70233;
public achievement_flirt_with_disaster_perf_check() : base("achievement_flirt_with_disaster_perf_check") { } public achievement_flirt_with_disaster_perf_check() : base("achievement_flirt_with_disaster_perf_check") { }
public override bool OnCheck(Player player, Unit target) public override bool OnCheck(Player player, Unit target)
{ {
if (!player) if (player == null)
return false; return false;
if (player.HasAura(AuraIds.AuraPerfumeForever) || player.HasAura(AuraIds.AuraPerfumeEnchantress) || player.HasAura(AuraIds.AuraPerfumeVictory)) if (player.HasAura(AuraPerfumeForever) || player.HasAura(AuraPerfumeEnchantress) || player.HasAura(AuraPerfumeVictory))
return true; return true;
return false; return false;
@@ -102,7 +84,7 @@ namespace Scripts.World.Achievements
public override bool OnCheck(Player player, Unit target) public override bool OnCheck(Player player, Unit target)
{ {
return target && player.IsHonorOrXPTarget(target); return target != null && player.IsHonorOrXPTarget(target);
} }
} }
@@ -114,7 +96,7 @@ namespace Scripts.World.Achievements
public override void OnCompleted(Player player, AchievementRecord achievement) public override void OnCompleted(Player player, AchievementRecord achievement)
{ {
player.GetSession().GetBattlePetMgr().UnlockSlot(BattlePetSlots.Slot1); player.GetSession().GetBattlePetMgr().UnlockSlot(BattlePetSlots.Slot1);
// TODO: Unlock trap // Todo: Unlock trap
} }
} }
@@ -128,4 +110,5 @@ namespace Scripts.World.Achievements
player.GetSession().GetBattlePetMgr().UnlockSlot(BattlePetSlots.Slot2); player.GetSession().GetBattlePetMgr().UnlockSlot(BattlePetSlots.Slot2);
} }
} }
} }
+296
View File
@@ -0,0 +1,296 @@
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
using Framework.Configuration;
using Framework.Constants;
using Framework.Database;
using Framework.Networking;
using Game.Entities;
using System.Collections.Generic;
using Game.AI;
using Game.Scripting;
using Game.Spells;
namespace Scripts.World.Achievements
{
enum IPLoggingTypes
{
// AccountActionIpLogger();
AccountLogin = 0,
AccountFailLogin = 1,
AccountChangePw = 2,
AccountChangePwFail = 3, // Only two types of account changes exist...
AccountChangeEmail = 4,
AccountChangeEmailFail = 5, // ...so we log them individually
// Obsolete - AccountLogout = 6, Can not be logged. We still keep the type however
// CharacterActionIpLogger();
CharacterCreate = 7,
CharacterLogin = 8,
CharacterLogout = 9,
// CharacterDeleteActionIpLogger();
CharacterDelete = 10,
CharacterFailedDelete = 11,
// AccountActionIpLogger(), CharacterActionIpLogger(), CharacterActionIpLogger();
UnknownAction = 12
}
class AccountActionIpLogger : AccountScript
{
public AccountActionIpLogger() : base("AccountActionIpLogger") { }
// We log last_ip instead of last_attempt_ip, as login was successful
// AccountLogin = 0
void OnAccountLogin(uint accountId)
{
AccountIPLogAction(accountId, AccountLogin);
}
// We log last_attempt_ip instead of last_ip, as failed login doesn't necessarily mean approperiate user
// AccountFailLogin = 1
void OnFailedAccountLogin(uint accountId)
{
AccountIPLogAction(accountId, AccountFailLogin);
}
// AccountChangePw = 2
void OnPasswordChange(uint accountId)
{
AccountIPLogAction(accountId, AccountChangePw);
}
// AccountChangePwFail = 3
void OnFailedPasswordChange(uint accountId)
{
AccountIPLogAction(accountId, AccountChangePwFail);
}
// Registration Email can Not be changed apart from Gm level users. Thus, we do not require to log them...
// AccountChangeEmail = 4
void OnEmailChange(uint accountId)
{
AccountIPLogAction(accountId, AccountChangeEmail); // ... they get logged by gm command logger anyway
}
// AccountChangeEmailFail = 5
void OnFailedEmailChange(uint accountId)
{
AccountIPLogAction(accountId, AccountChangeEmailFail);
}
// AccountLogout = 6
void AccountIPLogAction(uint accountId, IPLoggingTypes aType)
{
// Action Ip Logger is only intialized if config is set up
// Else, this script isn't loaded in the first place: We require no config check.
// We declare all the required variables
uint playerGuid = accountId;
uint realmId = realm.Id.Realm;
std.string systemNote = "Error"; // "Error" is a placeholder here. We change it later.
// With this switch, we change systemNote so that we have a more accurate phraMath.Sing of what type it is.
// Avoids Magicnumbers in Sql table
switch (aType)
{
case AccountLogin:
systemNote = "Logged into WoW";
break;
case AccountFailLogin:
systemNote = "Login to WoW Failed";
break;
case AccountChangePw:
systemNote = "Password Reset Completed";
break;
case AccountChangePwFail:
systemNote = "Password Reset Failed";
break;
case AccountChangeEmail:
systemNote = "Email Change Completed";
break;
case AccountChangeEmailFail:
systemNote = "Email Change Failed";
break;
case AccountLogout:
systemNote = "Logged on AccountLogout"; //Can not be logged
break;
// Neither should happen. Ever. Period. If it does, call Ghostbusters and all your local software defences to investigate.
case UnknownAction:
default:
systemNote = "Error! Unknown action!";
break;
}
// Once we have done everything, we can Add the new log.
// Seeing as the time differences should be minimal, we do not get unixtime and the timestamp right now;
// Rather, we let it be added with the Sql query.
if (aType != AccountFailLogin)
{
// As we can assume most account actions are Not failed login, so this is the more accurate check.
// For those, we need last_ip...
stmt.setUint(0, playerGuid);
stmt.setUInt64(1, 0);
stmt.setUint(2, realmId);
stmt.setUInt8(3, aType);
stmt.setUint(4, playerGuid);
stmt.setString(5, systemNote);
LoginDatabase.Execute(stmt);
}
else // ... but for failed login, we query last_attempt_ip from account table. Which we do with an unique query
{
stmt.setUint(0, playerGuid);
stmt.setUInt64(1, 0);
stmt.setUint(2, realmId);
stmt.setUInt8(3, aType);
stmt.setUint(4, playerGuid);
stmt.setString(5, systemNote);
LoginDatabase.Execute(stmt);
}
return;
}
}
class CharacterActionIpLogger : PlayerScript
{
public CharacterActionIpLogger() : base("CharacterActionIpLogger") { }
// CharacterCreate = 7
void OnCreate(Player player)
{
CharacterIPLogAction(player, CharacterCreate);
}
// CharacterLogin = 8
void OnLogin(Player player, bool firstLogin)
{
CharacterIPLogAction(player, CharacterLogin);
}
// CharacterLogout = 9
void OnLogout(Player player)
{
CharacterIPLogAction(player, CharacterLogout);
}
// CharacterDelete = 10
// CharacterFailedDelete = 11
// We don't log either here - they require a guid
// UnknownAction = 12
// There is no real hook we could use for that.
// Shouldn't happen anyway, should it ? Nothing to see here.
/// Logs a number of actions done by players with an Ip
void CharacterIPLogAction(Player player, IPLoggingTypes aType)
{
// Action Ip Logger is only intialized if config is set up
// Else, this script isn't loaded in the first place: We require no config check.
// We declare all the required variables
uint playerGuid = player.GetSession().GetAccountId();
uint realmId = realm.Id.Realm;
std.string currentIp = player.GetSession().GetRemoteAddress();
std.string systemNote = "Error"; // "Error" is a placeholder here. We change it...
// ... with this switch, so that we have a more accurate phraMath.Sing of what type it is
switch (aType)
{
case CharacterCreate:
systemNote = "Character Created";
break;
case CharacterLogin:
systemNote = "Logged onto Character";
break;
case CharacterLogout:
systemNote = "Logged out of Character";
break;
case CharacterDelete:
systemNote = "Character Deleted";
break;
case CharacterFailedDelete:
systemNote = "Character Deletion Failed";
break;
// Neither should happen. Ever. Period. If it does, call Mythbusters.
case UnknownAction:
default:
systemNote = "Error! Unknown action!";
break;
}
// Once we have done everything, we can Add the new log.
stmt.setUint(0, playerGuid);
stmt.setUInt64(1, player.GetGUID().GetCounter());
stmt.setUint(2, realmId);
stmt.setUInt8(3, aType);
stmt.setString(4, currentIp); // We query the ip here.
stmt.setString(5, systemNote);
// Seeing as the time differences should be minimal, we do not get unixtime and the timestamp right now;
// Rather, we let it be added with the Sql query.
LoginDatabase.Execute(stmt);
return;
}
}
class CharacterDeleteActionIpLogger : PlayerScript
{
public CharacterDeleteActionIpLogger() : base("CharacterDeleteActionIpLogger") { }
// CharacterDelete = 10
void OnDelete(ObjectGuid guid, uint accountId)
{
DeleteIPLogAction(guid, accountId, CharacterDelete);
}
// CharacterFailedDelete = 11
void OnFailedDelete(ObjectGuid guid, uint accountId)
{
DeleteIPLogAction(guid, accountId, CharacterFailedDelete);
}
void DeleteIPLogAction(ObjectGuid guid, uint playerGuid, IPLoggingTypes aType)
{
// Action Ip Logger is only intialized if config is set up
// Else, this script isn't loaded in the first place: We require no config check.
uint realmId = realm.Id.Realm;
// Query playerGuid/accountId, as we only have characterGuid
std.string systemNote = "Error"; // "Error" is a placeholder here. We change it later.
// With this switch, we change systemNote so that we have a more accurate phraMath.Sing of what type it is.
// Avoids Magicnumbers in Sql table
switch (aType)
{
case CharacterDelete:
systemNote = "Character Deleted";
break;
case CharacterFailedDelete:
systemNote = "Character Deletion Failed";
break;
// Neither should happen. Ever. Period. If it does, call to whatever god you have for mercy and guidance.
case UnknownAction:
default:
systemNote = "Error! Unknown action!";
break;
}
// Once we have done everything, we can Add the new log.
stmt.setUint(0, playerGuid);
stmt.setUInt64(1, guid.GetCounter());
stmt.setUint(2, realmId);
stmt.setUInt8(3, aType);
stmt.setUint(4, playerGuid);
stmt.setString(5, systemNote);
// Seeing as the time differences should be minimal, we do not get unixtime and the timestamp right now;
// Rather, we let it be added with the Sql query.
LoginDatabase.Execute(stmt);
return;
}
}
}
+130 -192
View File
@@ -12,128 +12,17 @@ using System.Collections.Generic;
namespace Scripts.World.Areatriggers namespace Scripts.World.Areatriggers
{ {
struct TextIds
{
//Brewfest
public const uint SayWelcome = 4;
}
struct SpellIds
{
//Legion Teleporter
public const uint TeleATo = 37387;
public const uint TeleHTo = 37389;
//Sholazar Waygate
public const uint SholazarToUngoroTeleport = 52056;
public const uint UngoroToSholazarTeleport = 52057;
//Nats Landing
public const uint FishPaste = 42644;
//Area 52
public const uint A52Neuralyzer = 34400;
//Stormwind teleport
public const uint DustInTheStormwind = 312593;
}
struct QuestIds
{
//Legion Teleporter
public const uint GainingAccessA = 10589;
public const uint GainingAccessH = 10604;
//Scent Larkorwi
public const uint ScentOfLarkorwi = 4291;
//Last Rites
public const uint LastRites = 12019;
public const uint BreakingThrough = 11898;
//Sholazar Waygate
public const uint TheMakersOverlook = 12613;
public const uint TheMakersPerch = 12559;
public const uint MeetingAGreatOne = 13956;
//Nats Landing
public const uint NatsBargain = 11209;
//Frostgrips Hollow
public const uint TheLonesomeWatcher = 12877;
}
struct CreatureIds
{
//Scent Larkorwi
public const uint LarkorwiMate = 9683;
//Nats Landing
public const uint LurkingShark = 23928;
//Brewfest
public const uint TapperSwindlekeg = 24711;
public const uint IpfelkoferIronkeg = 24710;
//Area 52
public const uint Spotlight = 19913;
//Frostgrips Hollow
public const uint StormforgedMonitor = 29862;
public const uint StormforgedEradictor = 29861;
//Stormwind Teleport
public const uint KillCreditTeleportStormwind = 160561;
}
struct GameObjectIds
{
//Coilfang Waterfall
public const uint CoilfangWaterfall = 184212;
}
struct AreaTriggerIds
{
//Sholazar Waygate
public const uint Sholazar = 5046;
public const uint Ungoro = 5047;
//Brewfest
public const uint BrewfestDurotar = 4829;
public const uint BrewfestDunMorogh = 4820;
//Area 52
public const uint Area52South = 4472;
public const uint Area52North = 4466;
public const uint Area52West = 4471;
public const uint Area52East = 4422;
}
struct Misc
{
//Brewfest
public const uint AreatriggerTalkCooldown = 5; // In Seconds
//Area 52
public const uint SummonCooldown = 5;
//Frostgrips Hollow
public const uint TypeWaypoint = 0;
public const uint DataStart = 0;
public static Position StormforgedMonitorPosition = new(6963.95f, 45.65f, 818.71f, 4.948f);
public static Position StormforgedEradictorPosition = new(6983.18f, 7.15f, 806.33f, 2.228f);
}
[Script] [Script]
class AreaTrigger_at_coilfang_waterfall : AreaTriggerScript class AreaTrigger_at_coilfang_waterfall : AreaTriggerScript
{ {
const uint GoCoilfangWaterfall = 184212;
public AreaTrigger_at_coilfang_waterfall() : base("at_coilfang_waterfall") { } public AreaTrigger_at_coilfang_waterfall() : base("at_coilfang_waterfall") { }
public override bool OnTrigger(Player player, AreaTriggerRecord areaTrigger) public override bool OnTrigger(Player player, AreaTriggerRecord areaTrigger)
{ {
GameObject go = player.FindNearestGameObject(GameObjectIds.CoilfangWaterfall, 35.0f); GameObject go = player.FindNearestGameObject(GoCoilfangWaterfall, 35.0f);
if (go) if (go != null)
if (go.GetLootState() == LootState.Ready) if (go.GetLootState() == LootState.Ready)
go.UseDoorOrButton(); go.UseDoorOrButton();
@@ -144,21 +33,27 @@ namespace Scripts.World.Areatriggers
[Script] [Script]
class AreaTrigger_at_legion_teleporter : AreaTriggerScript class AreaTrigger_at_legion_teleporter : AreaTriggerScript
{ {
const uint SpellTeleATo = 37387;
const uint QuestGainingAccessA = 10589;
const uint SpellTeleHTo = 37389;
const uint QuestGainingAccessH = 10604;
public AreaTrigger_at_legion_teleporter() : base("at_legion_teleporter") { } public AreaTrigger_at_legion_teleporter() : base("at_legion_teleporter") { }
public override bool OnTrigger(Player player, AreaTriggerRecord areaTrigger) public override bool OnTrigger(Player player, AreaTriggerRecord areaTrigger)
{ {
if (player.IsAlive() && !player.IsInCombat()) if (player.IsAlive() && !player.IsInCombat())
{ {
if (player.GetTeam() == Team.Alliance && player.GetQuestRewardStatus(QuestIds.GainingAccessA)) if (player.GetTeam() == Team.Alliance && player.GetQuestRewardStatus(QuestGainingAccessA))
{ {
player.CastSpell(player, SpellIds.TeleATo, false); player.CastSpell(player, SpellTeleATo, false);
return true; return true;
} }
if (player.GetTeam() == Team.Horde && player.GetQuestRewardStatus(QuestIds.GainingAccessH)) if (player.GetTeam() == Team.Horde && player.GetQuestRewardStatus(QuestGainingAccessH))
{ {
player.CastSpell(player, SpellIds.TeleHTo, false); player.CastSpell(player, SpellTeleHTo, false);
return true; return true;
} }
@@ -171,14 +66,17 @@ namespace Scripts.World.Areatriggers
[Script] [Script]
class AreaTrigger_at_scent_larkorwi : AreaTriggerScript class AreaTrigger_at_scent_larkorwi : AreaTriggerScript
{ {
const uint QuestScentOfLarkorwi = 4291;
const uint NpcLarkorwiMate = 9683;
public AreaTrigger_at_scent_larkorwi() : base("at_scent_larkorwi") { } public AreaTrigger_at_scent_larkorwi() : base("at_scent_larkorwi") { }
public override bool OnTrigger(Player player, AreaTriggerRecord areaTrigger) public override bool OnTrigger(Player player, AreaTriggerRecord areaTrigger)
{ {
if (!player.IsDead() && player.GetQuestStatus(QuestIds.ScentOfLarkorwi) == QuestStatus.Incomplete) if (!player.IsDead() && player.GetQuestStatus(QuestScentOfLarkorwi) == QuestStatus.Incomplete)
{ {
if (!player.FindNearestCreature(CreatureIds.LarkorwiMate, 15)) if (player.FindNearestCreature(NpcLarkorwiMate, 15) == null)
player.SummonCreature(CreatureIds.LarkorwiMate, player.GetPositionX() + 5, player.GetPositionY(), player.GetPositionZ(), 3.3f, TempSummonType.TimedDespawnOutOfCombat, TimeSpan.FromSeconds(100)); player.SummonCreature(NpcLarkorwiMate, player.GetPositionX() + 5, player.GetPositionY(), player.GetPositionZ(), 3.3f, TempSummonType.TimedDespawnOutOfCombat, TimeSpan.FromSeconds(100));
} }
return false; return false;
@@ -188,21 +86,31 @@ namespace Scripts.World.Areatriggers
[Script] [Script]
class AreaTrigger_at_sholazar_waygate : AreaTriggerScript class AreaTrigger_at_sholazar_waygate : AreaTriggerScript
{ {
const uint SpellSholazarToUngoroTeleport = 52056;
const uint SpellUngoroToSholazarTeleport = 52057;
const uint AtSholazar = 5046;
const uint AtUngoro = 5047;
const uint QuestTheMakersOverlook = 12613;
const uint QuestTheMakersPerch = 12559;
const uint QuestMeetingAGreatOne = 13956;
public AreaTrigger_at_sholazar_waygate() : base("at_sholazar_waygate") { } public AreaTrigger_at_sholazar_waygate() : base("at_sholazar_waygate") { }
public override bool OnTrigger(Player player, AreaTriggerRecord areaTrigger) public override bool OnTrigger(Player player, AreaTriggerRecord trigger)
{ {
if (!player.IsDead() && (player.GetQuestStatus(QuestIds.MeetingAGreatOne) != QuestStatus.None || if (!player.IsDead() && (player.GetQuestStatus(QuestMeetingAGreatOne) != QuestStatus.None ||
(player.GetQuestStatus(QuestIds.TheMakersOverlook) == QuestStatus.Rewarded && player.GetQuestStatus(QuestIds.TheMakersPerch) == QuestStatus.Rewarded))) (player.GetQuestStatus(QuestTheMakersOverlook) == QuestStatus.Rewarded && player.GetQuestStatus(QuestTheMakersPerch) == QuestStatus.Rewarded)))
{ {
switch (areaTrigger.Id) switch (trigger.Id)
{ {
case AreaTriggerIds.Sholazar: case AtSholazar:
player.CastSpell(player, SpellIds.SholazarToUngoroTeleport, true); player.CastSpell(player, SpellSholazarToUngoroTeleport, true);
break; break;
case AreaTriggerIds.Ungoro: case AtUngoro:
player.CastSpell(player, SpellIds.UngoroToSholazarTeleport, true); player.CastSpell(player, SpellUngoroToSholazarTeleport, true);
break; break;
} }
} }
@@ -214,19 +122,23 @@ namespace Scripts.World.Areatriggers
[Script] [Script]
class AreaTrigger_at_nats_landing : AreaTriggerScript class AreaTrigger_at_nats_landing : AreaTriggerScript
{ {
const uint QuestNatsBargain = 11209;
const uint SpellFishPaste = 42644;
const uint NpcLurkingShark = 23928;
public AreaTrigger_at_nats_landing() : base("at_nats_landing") { } public AreaTrigger_at_nats_landing() : base("at_nats_landing") { }
public override bool OnTrigger(Player player, AreaTriggerRecord areaTrigger) public override bool OnTrigger(Player player, AreaTriggerRecord areaTrigger)
{ {
if (!player.IsAlive() || !player.HasAura(SpellIds.FishPaste)) if (!player.IsAlive() || !player.HasAura(SpellFishPaste))
return false; return false;
if (player.GetQuestStatus(QuestIds.NatsBargain) == QuestStatus.Incomplete) if (player.GetQuestStatus(QuestNatsBargain) == QuestStatus.Incomplete)
{ {
if (!player.FindNearestCreature(CreatureIds.LurkingShark, 20.0f)) if (player.FindNearestCreature(NpcLurkingShark, 20.0f) == null)
{ {
Creature shark = player.SummonCreature(CreatureIds.LurkingShark, -4246.243f, -3922.356f, -7.488f, 5.0f, TempSummonType.TimedDespawnOutOfCombat, TimeSpan.FromSeconds(100)); Creature shark = player.SummonCreature(NpcLurkingShark, -4246.243f, -3922.356f, -7.488f, 5.0f, TempSummonType.TimedDespawnOutOfCombat, TimeSpan.FromSeconds(100));
if (shark) if (shark != null)
shark.GetAI().AttackStart(player); shark.GetAI().AttackStart(player);
return false; return false;
@@ -239,36 +151,42 @@ namespace Scripts.World.Areatriggers
[Script] [Script]
class AreaTrigger_at_brewfest : AreaTriggerScript class AreaTrigger_at_brewfest : AreaTriggerScript
{ {
Dictionary<uint, long> _triggerTimes; const uint NpcTapperSwindlekeg = 24711;
const uint NpcIpfelkoferIronkeg = 24710;
const uint AtBrewfestDurotar = 4829;
const uint AtBrewfestDunMorogh = 4820;
const uint SayWelcome = 4;
const uint AreatriggerTalkCooldown = 5; // in seconds
Dictionary<uint, long> _triggerTimes = new();
public AreaTrigger_at_brewfest() : base("at_brewfest") public AreaTrigger_at_brewfest() : base("at_brewfest")
{ {
// Initialize for cooldown // Initialize for cooldown
_triggerTimes = new Dictionary<uint, long>() _triggerTimes[AtBrewfestDurotar] = _triggerTimes[AtBrewfestDunMorogh] = 0;
{
{ AreaTriggerIds.BrewfestDurotar, 0 },
{ AreaTriggerIds.BrewfestDunMorogh,0 },
};
} }
public override bool OnTrigger(Player player, AreaTriggerRecord areaTrigger) public override bool OnTrigger(Player player, AreaTriggerRecord trigger)
{ {
uint triggerId = areaTrigger.Id; uint triggerId = trigger.Id;
// Second trigger happened too early after first, skip for now // Second trigger happened too early after first, skip for now
if (GameTime.GetGameTime() - _triggerTimes[triggerId] < Misc.AreatriggerTalkCooldown) if (GameTime.GetGameTime() - _triggerTimes[triggerId] < AreatriggerTalkCooldown)
return false; return false;
switch (triggerId) switch (triggerId)
{ {
case AreaTriggerIds.BrewfestDurotar: case AtBrewfestDurotar:
Creature tapper = player.FindNearestCreature(CreatureIds.TapperSwindlekeg, 20.0f); Creature tapper = player.FindNearestCreature(NpcTapperSwindlekeg, 20.0f);
if (tapper) if (tapper != null)
tapper.GetAI().Talk(TextIds.SayWelcome, player); tapper.GetAI().Talk(SayWelcome, player);
break; break;
case AreaTriggerIds.BrewfestDunMorogh: case AtBrewfestDunMorogh:
Creature ipfelkofer = player.FindNearestCreature(CreatureIds.IpfelkoferIronkeg, 20.0f); Creature ipfelkofer = player.FindNearestCreature(NpcIpfelkoferIronkeg, 20.0f);
if (ipfelkofer) if (ipfelkofer != null)
ipfelkofer.GetAI().Talk(TextIds.SayWelcome, player); ipfelkofer.GetAI().Talk(SayWelcome, player);
break; break;
default: default:
break; break;
@@ -282,63 +200,74 @@ namespace Scripts.World.Areatriggers
[Script] [Script]
class AreaTrigger_at_area_52_entrance : AreaTriggerScript class AreaTrigger_at_area_52_entrance : AreaTriggerScript
{ {
Dictionary<uint, long> _triggerTimes; const uint SpellA52Neuralyzer = 34400;
const uint NpcSpotlight = 19913;
const uint SummonCooldown = 5;
const uint AtArea52South = 4472;
const uint AtArea52North = 4466;
const uint AtArea52West = 4471;
const uint AtArea52East = 4422;
Dictionary<uint, long> _triggerTimes = new();
public AreaTrigger_at_area_52_entrance() : base("at_area_52_entrance") public AreaTrigger_at_area_52_entrance() : base("at_area_52_entrance")
{ {
_triggerTimes = new Dictionary<uint, long>() _triggerTimes[AtArea52South] = _triggerTimes[AtArea52North] = _triggerTimes[AtArea52West] = _triggerTimes[AtArea52East] = 0;
{
{ AreaTriggerIds.Area52South, 0 },
{ AreaTriggerIds.Area52North,0 },
{ AreaTriggerIds.Area52West,0},
{ AreaTriggerIds.Area52East,0},
};
} }
public override bool OnTrigger(Player player, AreaTriggerRecord areaTrigger) public override bool OnTrigger(Player player, AreaTriggerRecord trigger)
{ {
float x = 0.0f, y = 0.0f, z = 0.0f; float x = 0.0f, y = 0.0f, z = 0.0f;
if (!player.IsAlive()) if (!player.IsAlive())
return false; return false;
if (GameTime.GetGameTime() - _triggerTimes[areaTrigger.Id] < Misc.SummonCooldown) uint triggerId = trigger.Id;
if (GameTime.GetGameTime() - _triggerTimes[triggerId] < SummonCooldown)
return false; return false;
switch (areaTrigger.Id) switch (triggerId)
{ {
case AreaTriggerIds.Area52East: case AtArea52East:
x = 3044.176f; x = 3044.176f;
y = 3610.692f; y = 3610.692f;
z = 143.61f; z = 143.61f;
break; break;
case AreaTriggerIds.Area52North: case AtArea52North:
x = 3114.87f; x = 3114.87f;
y = 3687.619f; y = 3687.619f;
z = 143.62f; z = 143.62f;
break; break;
case AreaTriggerIds.Area52West: case AtArea52West:
x = 3017.79f; x = 3017.79f;
y = 3746.806f; y = 3746.806f;
z = 144.27f; z = 144.27f;
break; break;
case AreaTriggerIds.Area52South: case AtArea52South:
x = 2950.63f; x = 2950.63f;
y = 3719.905f; y = 3719.905f;
z = 143.33f; z = 143.33f;
break; break;
} }
player.SummonCreature(CreatureIds.Spotlight, x, y, z, 0.0f, TempSummonType.TimedDespawn, TimeSpan.FromSeconds(5)); player.SummonCreature(NpcSpotlight, x, y, z, 0.0f, TempSummonType.TimedDespawn, TimeSpan.FromSeconds(5));
player.AddAura(SpellIds.A52Neuralyzer, player); player.AddAura(SpellA52Neuralyzer, player);
_triggerTimes[areaTrigger.Id] = GameTime.GetGameTime(); _triggerTimes[trigger.Id] = GameTime.GetGameTime();
return false; return false;
} }
} }
[Script]
class AreaTrigger_at_frostgrips_hollow : AreaTriggerScript class AreaTrigger_at_frostgrips_hollow : AreaTriggerScript
{ {
const uint QuestTheLonesomeWatcher = 12877;
const uint NpcStormforgedMonitor = 29862;
const uint NpcStormforgedEradictor = 29861;
Position stormforgedMonitorPosition = new(6963.95f, 45.65f, 818.71f, 4.948f);
Position stormforgedEradictorPosition = new(6983.18f, 7.15f, 806.33f, 2.228f);
ObjectGuid stormforgedMonitorGUID; ObjectGuid stormforgedMonitorGUID;
ObjectGuid stormforgedEradictorGUID; ObjectGuid stormforgedEradictorGUID;
@@ -350,41 +279,43 @@ namespace Scripts.World.Areatriggers
public override bool OnTrigger(Player player, AreaTriggerRecord areaTrigger) public override bool OnTrigger(Player player, AreaTriggerRecord areaTrigger)
{ {
if (player.GetQuestStatus(QuestIds.TheLonesomeWatcher) != QuestStatus.Incomplete) if (player.GetQuestStatus(QuestTheLonesomeWatcher) != QuestStatus.Incomplete)
return false; return false;
Creature stormforgedMonitor = ObjectAccessor.GetCreature(player, stormforgedMonitorGUID); Creature stormforgedMonitor = ObjectAccessor.GetCreature(player, stormforgedMonitorGUID);
if (stormforgedMonitor) if (stormforgedMonitor != null)
return false; return false;
Creature stormforgedEradictor = ObjectAccessor.GetCreature(player, stormforgedEradictorGUID); Creature stormforgedEradictor = ObjectAccessor.GetCreature(player, stormforgedEradictorGUID);
if (stormforgedEradictor) if (stormforgedEradictor != null)
return false; return false;
stormforgedMonitor = player.SummonCreature(CreatureIds.StormforgedMonitor, Misc.StormforgedMonitorPosition, TempSummonType.TimedDespawnOutOfCombat, TimeSpan.FromSeconds(60)); stormforgedMonitor = player.SummonCreature(NpcStormforgedMonitor, stormforgedMonitorPosition, TempSummonType.TimedDespawnOutOfCombat, TimeSpan.FromMinutes(1));
if (stormforgedMonitor) if (stormforgedMonitor != null)
{ {
stormforgedMonitorGUID = stormforgedMonitor.GetGUID(); stormforgedMonitorGUID = stormforgedMonitor.GetGUID();
stormforgedMonitor.SetWalk(false); stormforgedMonitor.SetWalk(false);
/// The npc would search an alternative way to get to the last waypoint without this unit state. /// The npc would search an alternative way to get to the last waypoint without this unit state.
stormforgedMonitor.AddUnitState(UnitState.IgnorePathfinding); stormforgedMonitor.AddUnitState(UnitState.IgnorePathfinding);
stormforgedMonitor.GetMotionMaster().MovePath((CreatureIds.StormforgedMonitor * 100) << 3, false); stormforgedMonitor.GetMotionMaster().MovePath((NpcStormforgedMonitor * 100) << 3, false);
} }
stormforgedEradictor = player.SummonCreature(CreatureIds.StormforgedEradictor, Misc.StormforgedEradictorPosition, TempSummonType.TimedDespawnOutOfCombat, TimeSpan.FromSeconds(60)); stormforgedEradictor = player.SummonCreature(NpcStormforgedEradictor, stormforgedEradictorPosition, TempSummonType.TimedDespawnOutOfCombat, TimeSpan.FromMinutes(1));
if (stormforgedEradictor) if (stormforgedEradictor != null)
{ {
stormforgedEradictorGUID = stormforgedEradictor.GetGUID(); stormforgedEradictorGUID = stormforgedEradictor.GetGUID();
stormforgedEradictor.GetMotionMaster().MovePath((CreatureIds.StormforgedEradictor * 100) << 3, false); stormforgedEradictor.GetMotionMaster().MovePath((NpcStormforgedEradictor * 100) << 3, false);
} }
return true; return true;
} }
} }
[Script]
class areatrigger_stormwind_teleport_unit : AreaTriggerAI class areatrigger_stormwind_teleport_unit : AreaTriggerAI
{ {
const uint SpellDustInTheStormwind = 312593;
const uint NpcKillCreditTeleportStormwind = 160561;
public areatrigger_stormwind_teleport_unit(AreaTrigger areatrigger) : base(areatrigger) { } public areatrigger_stormwind_teleport_unit(AreaTrigger areatrigger) : base(areatrigger) { }
public override void OnUnitEnter(Unit unit) public override void OnUnitEnter(Unit unit)
@@ -393,12 +324,11 @@ namespace Scripts.World.Areatriggers
if (player == null) if (player == null)
return; return;
player.CastSpell(unit, SpellIds.DustInTheStormwind); player.CastSpell(unit, SpellDustInTheStormwind);
player.KilledMonsterCredit(CreatureIds.KillCreditTeleportStormwind); player.KilledMonsterCredit(NpcKillCreditTeleportStormwind);
} }
} }
[Script]
class areatrigger_battleground_buffs : AreaTriggerAI class areatrigger_battleground_buffs : AreaTriggerAI
{ {
public areatrigger_battleground_buffs(AreaTrigger areatrigger) : base(areatrigger) { } public areatrigger_battleground_buffs(AreaTrigger areatrigger) : base(areatrigger) { }
@@ -408,8 +338,12 @@ namespace Scripts.World.Areatriggers
if (!unit.IsPlayer()) if (!unit.IsPlayer())
return; return;
var player = unit.ToPlayer(); HandleBuffAreaTrigger(unit.ToPlayer());
GameObject buffObject = player.FindNearestGameObjectWithOptions(4.0f, new FindGameObjectOptions() { StringId = "bg_buff_object" }); }
void HandleBuffAreaTrigger(Player player)
{
GameObject buffObject = player.FindNearestGameObjectWithOptions(4.0f, new FindGameObjectOptions() { StringId = "bg_buff_obj" });
if (buffObject != null) if (buffObject != null)
{ {
buffObject.ActivateObject(GameObjectActions.Disturb, 0, player); buffObject.ActivateObject(GameObjectActions.Disturb, 0, player);
@@ -418,24 +352,27 @@ namespace Scripts.World.Areatriggers
} }
} }
[Script]
class AreaTrigger_at_battleground_buffs : AreaTriggerScript class AreaTrigger_at_battleground_buffs : AreaTriggerScript
{ {
public AreaTrigger_at_battleground_buffs() : base("at_battleground_buffs") { } public AreaTrigger_at_battleground_buffs() : base("at_battleground_buffs") { }
public override bool OnTrigger(Player player, AreaTriggerRecord areaTrigger) public override bool OnTrigger(Player player, AreaTriggerRecord areaTrigger)
{ {
GameObject buffObject = player.FindNearestGameObjectWithOptions(4.0f, new FindGameObjectOptions() { StringId = "bg_buff_object" }); HandleBuffAreaTrigger(player);
return true;
}
void HandleBuffAreaTrigger(Player player)
{
GameObject buffObject = player.FindNearestGameObjectWithOptions(4.0f, new FindGameObjectOptions() { StringId = "bg_buff_obj" });
if (buffObject != null) if (buffObject != null)
{ {
buffObject.ActivateObject(GameObjectActions.Disturb, 0, player); buffObject.ActivateObject(GameObjectActions.Disturb, 0, player);
buffObject.DespawnOrUnsummon(); buffObject.DespawnOrUnsummon();
} }
return true;
} }
} }
[Script]
class areatrigger_action_capture_flag : AreaTriggerAI class areatrigger_action_capture_flag : AreaTriggerAI
{ {
public areatrigger_action_capture_flag(AreaTrigger areatrigger) : base(areatrigger) { } public areatrigger_action_capture_flag(AreaTrigger areatrigger) : base(areatrigger) { }
@@ -447,8 +384,9 @@ namespace Scripts.World.Areatriggers
Player player = unit.ToPlayer(); Player player = unit.ToPlayer();
ZoneScript zoneScript = at.GetZoneScript(); ZoneScript zoneScript = at.GetZoneScript();
if (zoneScript != null && zoneScript.CanCaptureFlag(at, player)) if (zoneScript != null)
zoneScript.OnCaptureFlag(at, player); if (zoneScript.CanCaptureFlag(at, player))
zoneScript.OnCaptureFlag(at, player);
} }
} }
} }
+17 -6
View File
@@ -1,31 +1,42 @@
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved. // Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. // Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
using Framework.Configuration;
using Framework.Constants; using Framework.Constants;
using Game; using Framework.Database;
using Framework.Networking;
using Game.Entities; using Game.Entities;
using System.Collections.Generic;
using Game.AI;
using Game.Scripting; using Game.Scripting;
using Game.Spells;
using Game;
using System;
namespace Scripts.World namespace Scripts.World.Achievements
{ {
[Script]
class xp_boost_PlayerScript : PlayerScript class xp_boost_PlayerScript : PlayerScript
{ {
public xp_boost_PlayerScript() : base("xp_boost_PlayerScript") { } public xp_boost_PlayerScript() : base("xp_boost_PlayerScript") { }
void OnGiveXP(Player player, ref uint amount, Unit unit) public override uint OnGiveXP(Player player, uint amount, Unit unit)
{ {
if (IsXPBoostActive()) if (IsXPBoostActive())
amount *= (uint)WorldConfig.GetFloatValue(WorldCfg.RateXpBoost); amount *= (uint)WorldConfig.GetFloatValue(WorldCfg.RateXpBoost);
return amount;
} }
bool IsXPBoostActive() bool IsXPBoostActive()
{ {
long time = GameTime.GetGameTime(); long time = GameTime.GetGameTime();
var localTm = Time.UnixTimeToDateTime(time); DateTime localTm = Time.UnixTimeToDateTime(time);
uint weekdayMaskBoosted = WorldConfig.GetUIntValue(WorldCfg.XpBoostDaymask); uint weekdayMaskBoosted = WorldConfig.GetUIntValue(WorldCfg.XpBoostDaymask);
uint weekdayMask = 1u << localTm.Day; uint weekdayMask = (1u << (int)localTm.DayOfWeek);
bool currentDayBoosted = (weekdayMask & weekdayMaskBoosted) != 0; bool currentDayBoosted = (weekdayMask & weekdayMaskBoosted) != 0;
return currentDayBoosted; return currentDayBoosted;
} }
} }
} }
+115
View File
@@ -0,0 +1,115 @@
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
using Framework.Constants;
using Game.Chat;
using Game.Entities;
using Game.Groups;
using Game.Guilds;
using Game.Scripting;
namespace Scripts.World.Achievements
{
[Script]
class ChatLogScript : PlayerScript
{
public ChatLogScript() : base("ChatLogScript") { }
public override void OnChat(Player player, ChatMsg type, Language lang, string msg)
{
switch (type)
{
case ChatMsg.Say:
LogChat($"Player {player.GetName()} says (language {lang}): {msg}");
break;
case ChatMsg.Emote:
LogChat($"Player {player.GetName()} emotes: {msg}");
break;
case ChatMsg.Yell:
LogChat($"Player {player.GetName()} yells (language {lang}): {msg}");
break;
}
}
public override void OnChat(Player player, ChatMsg type, Language lang, string msg, Player receiver)
{
LogChat($"Player {player.GetName()} tells {(receiver != null ? receiver.GetName() : "<unknown>")}: {msg}");
}
public override void OnChat(Player player, ChatMsg type, Language lang, string msg, Group group)
{
//! Note:
//! LangAddon can only be sent by client in "Party", "Raid", "Guild", "Battleground", "Whisper"
switch (type)
{
case ChatMsg.Party:
LogChat($"Player {player.GetName()} tells group with leader {(group != null ? group.GetLeaderName() : "<unknown>")}: {msg}");
break;
case ChatMsg.PartyLeader:
LogChat($"Leader {player.GetName()} tells group: {msg}");
break;
case ChatMsg.Raid:
LogChat($"Player {player.GetName()} tells raid with leader {(group != null ? group.GetLeaderName() : "<unknown>")}: {msg}");
break;
case ChatMsg.RaidLeader:
LogChat($"Leader player {player.GetName()} tells raid: {msg}");
break;
case ChatMsg.RaidWarning:
LogChat($"Leader player {player.GetName()} warns raid with: {msg}");
break;
case ChatMsg.InstanceChat:
LogChat($"Player {player.GetName()} tells instance with leader {(group != null ? group.GetLeaderName() : "<unknown>")}: {msg}");
break;
case ChatMsg.InstanceChatLeader:
LogChat($"Leader player {player.GetName()} tells instance: {msg}");
break;
}
}
public override void OnChat(Player player, ChatMsg type, Language lang, string msg, Guild guild)
{
switch (type)
{
case ChatMsg.Guild:
LogChat($"Player {player.GetName()} tells guild {(guild != null ? guild.GetName() : "<unknown>")}: {msg}");
break;
case ChatMsg.Officer:
LogChat($"Player {player.GetName()} tells guild {(guild != null ? guild.GetName() : "<unknown>")} officers: {msg}");
break;
}
}
public override void OnChat(Player player, ChatMsg type, Language lang, string msg, Channel channel)
{
bool isSystem = channel != null &&
(channel.HasFlag(ChannelFlags.Trade) ||
channel.HasFlag(ChannelFlags.General) ||
channel.HasFlag(ChannelFlags.City) ||
channel.HasFlag(ChannelFlags.Lfg));
if (isSystem)
{
LogChat($"Player {player.GetName()} tells channel {channel.GetName()}: {msg}");
}
else
{
string channelName = channel != null ? channel.GetName() : "<unknown>";
LogChat($"Player {player.GetName()} tells channel {channelName}: {msg}");
}
}
void LogChat(string msg)
{
Log.outDebug(LogFilter.ChatLog, msg);
}
}
}
+4 -5
View File
@@ -1,17 +1,16 @@
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved. // Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. // Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
using Framework.Constants;
using Game.Entities; using Game.Entities;
using Game.Scripting; using Game.Scripting;
namespace Scripts.World namespace Scripts.World.Conversations
{ {
[Script]
class conversation_allied_race_dk_defender_of_azeroth : ConversationScript class conversation_allied_race_dk_defender_of_azeroth : ConversationScript
{ {
const uint NpcTalkToYourCommanderCredit = 161709; const uint NpcTalkToYourCommanderCredit = 161709;
const uint NpcListenToYourCommanderCredit = 163027; const uint NpcListenToYourCommanderCredit = 163027;
const uint ConversationLinePlayer = 32926; const uint ConversationLinePlayer = 32926;
public conversation_allied_race_dk_defender_of_azeroth() : base("conversation_allied_race_dk_defender_of_azeroth") { } public conversation_allied_race_dk_defender_of_azeroth() : base("conversation_allied_race_dk_defender_of_azeroth") { }
@@ -31,4 +30,4 @@ namespace Scripts.World
sender.KilledMonsterCredit(NpcListenToYourCommanderCredit); sender.KilledMonsterCredit(NpcListenToYourCommanderCredit);
} }
} }
} }
+15 -21
View File
@@ -7,26 +7,20 @@ using Game.Entities;
using Game.Scripting; using Game.Scripting;
using Game.Spells; using Game.Spells;
using System; using System;
using static Global;
namespace Scripts.World.DuelReset namespace Scripts.World.DuelReset
{ {
[Script] [Script]
class DuelResetScript : PlayerScript class DuelResetScript : PlayerScript
{ {
bool _resetCooldowns; public DuelResetScript() : base("DuelResetScript") { }
bool _resetHealthMana;
public DuelResetScript() : base("DuelResetScript") // Called when a duel starts (after TimeSpan.FromSeconds(3) countdown)
{
_resetCooldowns = WorldConfig.GetBoolValue(WorldCfg.ResetDuelCooldowns);
_resetHealthMana = WorldConfig.GetBoolValue(WorldCfg.ResetDuelHealthMana);
}
// Called when a duel starts (after 3s countdown)
public override void OnDuelStart(Player player1, Player player2) public override void OnDuelStart(Player player1, Player player2)
{ {
// Cooldowns reset // Cooldowns reset
if (_resetCooldowns) if (WorldConfig.GetBoolValue(WorldCfg.ResetDuelCooldowns))
{ {
player1.GetSpellHistory().SaveCooldownStateBeforeDuel(); player1.GetSpellHistory().SaveCooldownStateBeforeDuel();
player2.GetSpellHistory().SaveCooldownStateBeforeDuel(); player2.GetSpellHistory().SaveCooldownStateBeforeDuel();
@@ -36,7 +30,7 @@ namespace Scripts.World.DuelReset
} }
// Health and mana reset // Health and mana reset
if (_resetHealthMana) if (WorldConfig.GetBoolValue(WorldCfg.ResetDuelHealthMana))
{ {
player1.SaveHealthBeforeDuel(); player1.SaveHealthBeforeDuel();
player1.SaveManaBeforeDuel(); player1.SaveManaBeforeDuel();
@@ -55,7 +49,7 @@ namespace Scripts.World.DuelReset
if (type == DuelCompleteType.Won) if (type == DuelCompleteType.Won)
{ {
// Cooldown restore // Cooldown restore
if (_resetCooldowns) if (WorldConfig.GetBoolValue(WorldCfg.ResetDuelCooldowns))
{ {
ResetSpellCooldowns(winner, false); ResetSpellCooldowns(winner, false);
ResetSpellCooldowns(loser, false); ResetSpellCooldowns(loser, false);
@@ -65,7 +59,7 @@ namespace Scripts.World.DuelReset
} }
// Health and mana restore // Health and mana restore
if (_resetHealthMana) if (WorldConfig.GetBoolValue(WorldCfg.ResetDuelHealthMana))
{ {
winner.RestoreHealthAfterDuel(); winner.RestoreHealthAfterDuel();
loser.RestoreHealthAfterDuel(); loser.RestoreHealthAfterDuel();
@@ -83,31 +77,31 @@ namespace Scripts.World.DuelReset
static void ResetSpellCooldowns(Player player, bool onStartDuel) static void ResetSpellCooldowns(Player player, bool onStartDuel)
{ {
// remove cooldowns on spells that have < 10 min Cd > 30 sec and has no onHold // Remove cooldowns on spells that have < 10 min Cd > 30 sec and has no onHold
player.GetSpellHistory().ResetCooldowns(pair => player.GetSpellHistory().ResetCooldowns(pair =>
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(pair.Key, Difficulty.None); SpellInfo spellInfo = SpellMgr.GetSpellInfo(pair.Key, Difficulty.None);
TimeSpan remainingCooldown = player.GetSpellHistory().GetRemainingCooldown(spellInfo); TimeSpan remainingCooldown = player.GetSpellHistory().GetRemainingCooldown(spellInfo);
TimeSpan totalCooldown = TimeSpan.FromMilliseconds(spellInfo.RecoveryTime); TimeSpan totalCooldown = TimeSpan.FromMilliseconds(spellInfo.RecoveryTime);
TimeSpan categoryCooldown = TimeSpan.FromMilliseconds(spellInfo.CategoryRecoveryTime); TimeSpan categoryCooldown = TimeSpan.FromMilliseconds(spellInfo.CategoryRecoveryTime);
void applySpellMod(ref TimeSpan value) var applySpellMod = (TimeSpan value) =>
{ {
int intValue = (int)value.TotalMilliseconds; int intValue = (int)value.TotalMilliseconds;
player.ApplySpellMod(spellInfo, SpellModOp.Cooldown, ref intValue, null); player.ApplySpellMod(spellInfo, SpellModOp.Cooldown, ref intValue, null);
value = TimeSpan.FromMilliseconds(intValue); value = TimeSpan.FromMilliseconds(intValue);
}; };
applySpellMod(ref totalCooldown); applySpellMod(totalCooldown);
int cooldownMod = player.GetTotalAuraModifier(AuraType.ModCooldown); int cooldownMod = player.GetTotalAuraModifier(AuraType.ModCooldown);
if (cooldownMod != 0) if (cooldownMod != 0)
totalCooldown += TimeSpan.FromMilliseconds(cooldownMod); totalCooldown += TimeSpan.FromMilliseconds(cooldownMod);
if (!spellInfo.HasAttribute(SpellAttr6.NoCategoryCooldownMods)) if (spellInfo.HasAttribute(SpellAttr6.NoCategoryCooldownMods))
applySpellMod(ref categoryCooldown); applySpellMod(categoryCooldown);
return remainingCooldown > TimeSpan.Zero return remainingCooldown > TimeSpan.FromMilliseconds(0)
&& !pair.Value.OnHold && !pair.Value.OnHold
&& totalCooldown < TimeSpan.FromMinutes(10) && totalCooldown < TimeSpan.FromMinutes(10)
&& categoryCooldown < TimeSpan.FromMinutes(10) && categoryCooldown < TimeSpan.FromMinutes(10)
@@ -118,7 +112,7 @@ namespace Scripts.World.DuelReset
// pet cooldowns // pet cooldowns
Pet pet = player.GetPet(); Pet pet = player.GetPet();
if (pet) if (pet != null)
pet.GetSpellHistory().ResetAllCooldowns(); pet.GetSpellHistory().ResetAllCooldowns();
} }
} }
+60 -65
View File
@@ -9,7 +9,7 @@ using Game.Spells;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace Scripts.World.EmeraldDragons namespace Scripts.World.Achievements
{ {
struct CreatureIds struct CreatureIds
{ {
@@ -80,9 +80,10 @@ namespace Scripts.World.EmeraldDragons
public const uint SayTaerarSummonShades = 1; public const uint SayTaerarSummonShades = 1;
} }
class emerald_dragonAI : WorldBossAI [Script]
class emerald_dragon : WorldBossAI
{ {
public emerald_dragonAI(Creature creature) : base(creature) { } public emerald_dragon(Creature creature) : base(creature) { }
public override void Reset() public override void Reset()
{ {
@@ -90,7 +91,7 @@ namespace Scripts.World.EmeraldDragons
me.RemoveUnitFlag(UnitFlags.NonAttackable); me.RemoveUnitFlag(UnitFlags.NonAttackable);
me.SetUninteractible(false); me.SetUninteractible(false);
me.SetReactState(ReactStates.Aggressive); me.SetReactState(ReactStates.Aggressive);
DoCast(me, SpellIds.MarkOfNatureAura, new CastSpellExtraArgs(true)); DoCast(me, SpellIds.MarkOfNatureAura, true);
_scheduler.Schedule(TimeSpan.FromSeconds(4), task => _scheduler.Schedule(TimeSpan.FromSeconds(4), task =>
{ {
@@ -98,20 +99,18 @@ namespace Scripts.World.EmeraldDragons
DoCast(me, SpellIds.TailSweep); DoCast(me, SpellIds.TailSweep);
task.Repeat(TimeSpan.FromSeconds(2)); task.Repeat(TimeSpan.FromSeconds(2));
}); });
_scheduler.Schedule(TimeSpan.FromSeconds(7.5), TimeSpan.FromSeconds(15), task => _scheduler.Schedule(TimeSpan.FromSeconds(7.5), TimeSpan.FromSeconds(15), task =>
{ {
// Noxious Breath is cast on random intervals, no less than 7.5 seconds between // Noxious Breath is cast on random intervals, no less than 7.5 seconds between
DoCast(me, SpellIds.NoxiousBreath); DoCast(me, SpellIds.NoxiousBreath);
task.Repeat(); task.Repeat(TimeSpan.FromSeconds(7.5), TimeSpan.FromSeconds(15));
}); });
_scheduler.Schedule(TimeSpan.FromSeconds(12.5), TimeSpan.FromSeconds(20), task => _scheduler.Schedule(TimeSpan.FromSeconds(12.5), TimeSpan.FromSeconds(20), task =>
{ {
// Seeping Fog appears only as "pairs", and only ONE pair at any given time! // 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) // Despawntime is 2 minutes, so reschedule it for new cast after 2 minutes + a minor "random time" (30 seconds at max)
DoCast(me, SpellIds.SeepingFogLeft, new CastSpellExtraArgs(true)); DoCast(me, SpellIds.SeepingFogLeft, true);
DoCast(me, SpellIds.SeepingFogRight, new CastSpellExtraArgs(true)); DoCast(me, SpellIds.SeepingFogRight, true);
task.Repeat(TimeSpan.FromMinutes(2), TimeSpan.FromMinutes(2.5)); task.Repeat(TimeSpan.FromMinutes(2), TimeSpan.FromMinutes(2.5));
}); });
} }
@@ -119,7 +118,7 @@ namespace Scripts.World.EmeraldDragons
// Target killed during encounter, mark them as suspectible for Aura Of Nature // Target killed during encounter, mark them as suspectible for Aura Of Nature
public override void KilledUnit(Unit who) public override void KilledUnit(Unit who)
{ {
if (who.IsTypeId(TypeId.Player)) if (who.IsPlayer())
who.CastSpell(who, SpellIds.MarkOfNature, true); who.CastSpell(who, SpellIds.MarkOfNature, true);
} }
@@ -128,13 +127,13 @@ namespace Scripts.World.EmeraldDragons
if (!UpdateVictim()) if (!UpdateVictim())
return; return;
_scheduler.Update(diff);
if (me.HasUnitState(UnitState.Casting)) if (me.HasUnitState(UnitState.Casting))
return; return;
_scheduler.Update(diff);
Unit target = SelectTarget(SelectTargetMethod.MaxThreat, 0, -50.0f, true); Unit target = SelectTarget(SelectTargetMethod.MaxThreat, 0, -50.0f, true);
if (target) if (target != null)
DoCast(target, SpellIds.SummonPlayer); DoCast(target, SpellIds.SummonPlayer);
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
@@ -144,8 +143,6 @@ namespace Scripts.World.EmeraldDragons
[Script] [Script]
class npc_dream_fog : ScriptedAI class npc_dream_fog : ScriptedAI
{ {
uint _roamTimer;
public npc_dream_fog(Creature creature) : base(creature) public npc_dream_fog(Creature creature) : base(creature)
{ {
Initialize(); Initialize();
@@ -153,7 +150,26 @@ namespace Scripts.World.EmeraldDragons
void Initialize() void Initialize()
{ {
_roamTimer = 0; _scheduler.Schedule(TimeSpan.FromSeconds(0), task =>
{
// Chase target, but don't attack - otherwise just roam around
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 0.0f, true);
if (target != null)
{
task.Repeat(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(30));
me.GetMotionMaster().Clear();
me.GetMotionMaster().MoveChase(target, 0.2f);
}
else
{
task.Repeat(TimeSpan.FromSeconds(2.5));
me.GetMotionMaster().Clear();
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);
});
} }
public override void Reset() public override void Reset()
@@ -166,33 +182,12 @@ namespace Scripts.World.EmeraldDragons
if (!UpdateVictim()) if (!UpdateVictim())
return; return;
if (_roamTimer == 0) _scheduler.Update(diff);
{
// Chase target, but don't attack - otherwise just roam around
Unit target = SelectTarget(SelectTargetMethod.Random, 0, 0.0f, true);
if (target)
{
_roamTimer = RandomHelper.URand(15000, 30000);
me.GetMotionMaster().Clear();
me.GetMotionMaster().MoveChase(target, 0.2f);
}
else
{
_roamTimer = 2500;
me.GetMotionMaster().Clear();
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;
} }
} }
[Script] [Script]
class boss_ysondre : emerald_dragonAI class boss_ysondre : emerald_dragon
{ {
byte _stage; byte _stage;
@@ -232,14 +227,14 @@ namespace Scripts.World.EmeraldDragons
Talk(TextIds.SayYsondreSummonDruids); Talk(TextIds.SayYsondreSummonDruids);
for (byte i = 0; i < 10; ++i) for (byte i = 0; i < 10; ++i)
DoCast(me, SpellIds.SummonDruidSpirits, new CastSpellExtraArgs(true)); DoCast(me, SpellIds.SummonDruidSpirits, true);
++_stage; ++_stage;
} }
} }
} }
[Script] [Script]
class boss_lethon : emerald_dragonAI class boss_lethon : emerald_dragon
{ {
byte _stage; byte _stage;
@@ -257,10 +252,9 @@ namespace Scripts.World.EmeraldDragons
{ {
Initialize(); Initialize();
base.Reset(); base.Reset();
_scheduler.Schedule(TimeSpan.FromSeconds(10), task => _scheduler.Schedule(TimeSpan.FromSeconds(10), task =>
{ {
me.CastSpell((Unit)null, SpellIds.ShadowBoltWhirl, false); me.CastSpell(null, SpellIds.ShadowBoltWhirl, false);
task.Repeat(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(30)); task.Repeat(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(30));
}); });
} }
@@ -298,28 +292,28 @@ namespace Scripts.World.EmeraldDragons
public npc_spirit_shade(Creature creature) : base(creature) { } public npc_spirit_shade(Creature creature) : base(creature) { }
public override void IsSummonedBy(WorldObject summoner) public override void IsSummonedBy(WorldObject summonerWO)
{ {
Unit unitSummoner = summoner.ToUnit(); Unit summoner = summonerWO.ToUnit();
if (unitSummoner == null) if (summoner == null)
return; return;
_summonerGuid = summoner.GetGUID(); _summonerGuid = summoner.GetGUID();
me.GetMotionMaster().MoveFollow(unitSummoner, 0.0f, 0.0f); me.GetMotionMaster().MoveFollow(summoner, 0.0f, 0.0f);
} }
public override void MovementInform(MovementGeneratorType moveType, uint data) public override void MovementInform(MovementGeneratorType moveType, uint data)
{ {
if (moveType == MovementGeneratorType.Follow && data == _summonerGuid.GetCounter()) if (moveType == MovementGeneratorType.Follow && data == _summonerGuid.GetCounter())
{ {
me.CastSpell((Unit)null, SpellIds.DarkOffering, false); me.CastSpell(null, SpellIds.DarkOffering, false);
me.DespawnOrUnsummon(TimeSpan.FromSeconds(1)); me.DespawnOrUnsummon(TimeSpan.FromSeconds(1));
} }
} }
} }
[Script] [Script]
class boss_emeriss : emerald_dragonAI class boss_emeriss : emerald_dragon
{ {
byte _stage; byte _stage;
@@ -347,8 +341,9 @@ namespace Scripts.World.EmeraldDragons
public override void KilledUnit(Unit who) public override void KilledUnit(Unit who)
{ {
if (who.IsTypeId(TypeId.Player)) if (who.IsPlayer())
DoCast(who, SpellIds.PutridMushroom, new CastSpellExtraArgs(true)); DoCast(who, SpellIds.PutridMushroom, true);
base.KilledUnit(who); base.KilledUnit(who);
} }
@@ -358,19 +353,19 @@ namespace Scripts.World.EmeraldDragons
base.JustEngagedWith(who); base.JustEngagedWith(who);
} }
public override void DamageTaken(Unit attacker, ref uint damage, DamageEffectType damageType, SpellInfo spellInfo = null) public override void DamageTaken(Unit attacker, ref uint damage, DamageEffectType damageType, SpellInfo spellInfo = null)
{ {
if (!HealthAbovePct(100 - 25 * _stage)) if (!HealthAbovePct(100 - 25 * _stage))
{ {
Talk(TextIds.SayEmerissCastCorruption); Talk(TextIds.SayEmerissCastCorruption);
DoCast(me, SpellIds.CorruptionOfEarth, new CastSpellExtraArgs(true)); DoCast(me, SpellIds.CorruptionOfEarth, true);
++_stage; ++_stage;
} }
} }
} }
[Script] [Script]
class boss_taerar : emerald_dragonAI class boss_taerar : emerald_dragon
{ {
bool _banished; // used for shades activation testing bool _banished; // used for shades activation testing
uint _banishedTimer; // counter for banishment timeout uint _banishedTimer; // counter for banishment timeout
@@ -395,6 +390,7 @@ namespace Scripts.World.EmeraldDragons
me.RemoveAurasDueToSpell(SpellIds.Shade); me.RemoveAurasDueToSpell(SpellIds.Shade);
Initialize(); Initialize();
base.Reset(); base.Reset();
_scheduler.Schedule(TimeSpan.FromSeconds(12), task => _scheduler.Schedule(TimeSpan.FromSeconds(12), task =>
@@ -402,7 +398,6 @@ namespace Scripts.World.EmeraldDragons
DoCast(SpellIds.ArcaneBlast); DoCast(SpellIds.ArcaneBlast);
task.Repeat(TimeSpan.FromSeconds(7), TimeSpan.FromSeconds(12)); task.Repeat(TimeSpan.FromSeconds(7), TimeSpan.FromSeconds(12));
}); });
_scheduler.Schedule(TimeSpan.FromSeconds(30), task => _scheduler.Schedule(TimeSpan.FromSeconds(30), task =>
{ {
DoCast(SpellIds.BellowingRoar); DoCast(SpellIds.BellowingRoar);
@@ -436,7 +431,8 @@ namespace Scripts.World.EmeraldDragons
Talk(TextIds.SayTaerarSummonShades); Talk(TextIds.SayTaerarSummonShades);
foreach (var spell in SpellIds.TaerarShadeSpells) foreach (var spell in SpellIds.TaerarShadeSpells)
DoCastVictim(spell, new CastSpellExtraArgs(true)); DoCastVictim(spell, true);
_shades += (byte)SpellIds.TaerarShadeSpells.Length; _shades += (byte)SpellIds.TaerarShadeSpells.Length;
DoCast(SpellIds.Shade); DoCast(SpellIds.Shade);
@@ -455,7 +451,7 @@ namespace Scripts.World.EmeraldDragons
if (_banished) 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 all three shades are dead, Or it has taken too long, end the current event and get Taerar back into buMath.Siness
if (_banishedTimer <= diff || _shades == 0) if (_banishedTimer <= diff || _shades == 0)
{ {
_banished = false; _banished = false;
@@ -469,7 +465,7 @@ namespace Scripts.World.EmeraldDragons
else else
_banishedTimer -= diff; _banishedTimer -= diff;
// Update the _scheduler before we return (handled under emerald_dragonAI.UpdateAI(diff); if we're not inside this check) // Update the events before we return (handled under emerald_dragonAI.UpdateAI(diff); if we're not inside this check)
_scheduler.Update(diff); _scheduler.Update(diff);
return; return;
@@ -487,7 +483,7 @@ namespace Scripts.World.EmeraldDragons
targets.RemoveAll(obj => targets.RemoveAll(obj =>
{ {
Unit unit = obj.ToUnit(); Unit unit = obj.ToUnit();
if (unit) if (unit != null)
return unit.HasAura(SpellIds.Sleep); return unit.HasAura(SpellIds.Sleep);
return true; return true;
}); });
@@ -495,7 +491,7 @@ namespace Scripts.World.EmeraldDragons
public override void Register() public override void Register()
{ {
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitDestAreaEnemy)); OnObjectAreaTargetSelect.Add(new(FilterTargets, 0, Targets.UnitDestAreaEnemy));
} }
} }
@@ -513,9 +509,8 @@ namespace Scripts.World.EmeraldDragons
{ {
// return those not tagged or already under the influence of Aura of Nature // return those not tagged or already under the influence of Aura of Nature
Unit unit = obj.ToUnit(); Unit unit = obj.ToUnit();
if (unit) if (unit != null)
return !(unit.HasAura(SpellIds.MarkOfNature) && !unit.HasAura(SpellIds.AuraOfNature)); return !(unit.HasAura(SpellIds.MarkOfNature) && !unit.HasAura(SpellIds.AuraOfNature));
return true; return true;
}); });
} }
@@ -528,8 +523,8 @@ namespace Scripts.World.EmeraldDragons
public override void Register() public override void Register()
{ {
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitSrcAreaEnemy)); OnObjectAreaTargetSelect.Add(new(FilterTargets, 0, Targets.UnitSrcAreaEnemy));
OnEffectHitTarget.Add(new EffectHandler(HandleEffect, 0, SpellEffectName.ApplyAura)); OnEffectHitTarget.Add(new(HandleEffect, 0, SpellEffectName.ApplyAura));
} }
} }
} }
File diff suppressed because it is too large Load Diff
@@ -5,67 +5,16 @@ using Framework.Constants;
using Game.Entities; using Game.Entities;
using Game.Scripting; using Game.Scripting;
using Game.Spells; using Game.Spells;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Numerics; using static Global;
namespace Scripts.World.ItemScripts namespace Scripts.World.Items
{ {
struct SpellIds
{
//Onlyforflight
public const uint ArcaneCharges = 45072;
//Petrovclusterbombs
public const uint PetrovBomb = 42406;
}
struct CreatureIds
{
//Pilefakefur
public const uint NesingwaryTrapper = 25835;
//Theemissary
public const uint Leviroth = 26452;
//Capturedfrog
public const uint VanirasSentryTotem = 40187;
}
struct GameObjectIds
{
//Pilefakefur
public const uint HighQualityFur = 187983;
public static uint[] CaribouTraps =
{
187982, 187995, 187996, 187997, 187998,
187999, 188000, 188001, 188002, 188003,
188004, 188005, 188006, 188007, 188008,
};
}
struct QuestIds
{
//Helpthemselves
public const uint CannotHelpThemselves = 11876;
//Theemissary
public const uint TheEmissary = 11626;
//Capturedfrog
public const uint ThePerfectSpies = 25444;
}
struct Misc
{
//Petrovclusterbombs
public const uint AreaIdShatteredStraits = 4064;
public const uint ZoneIdHowling = 495;
}
[Script] [Script]
class item_only_for_flight : ItemScript class item_only_for_flight : ItemScript
{ {
const uint SpellArcaneCharges = 45072;
public item_only_for_flight() : base("item_only_for_flight") { } public item_only_for_flight() : base("item_only_for_flight") { }
public override bool OnUse(Player player, Item item, SpellCastTargets targets, ObjectGuid castId) public override bool OnUse(Player player, Item item, SpellCastTargets targets, ObjectGuid castId)
@@ -85,7 +34,7 @@ namespace Scripts.World.ItemScripts
disabled = true; disabled = true;
break; break;
case 34475: case 34475:
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.ArcaneCharges, player.GetMap().GetDifficultyID()); SpellInfo spellInfo = SpellMgr.GetSpellInfo(SpellArcaneCharges, player.GetMap().GetDifficultyID());
if (spellInfo != null) if (spellInfo != null)
Spell.SendCastResult(player, spellInfo, default, castId, SpellCastResult.NotOnGround); Spell.SendCastResult(player, spellInfo, default, castId, SpellCastResult.NotOnGround);
break; break;
@@ -108,7 +57,7 @@ namespace Scripts.World.ItemScripts
public override bool OnUse(Player player, Item item, SpellCastTargets targets, ObjectGuid castId) public override bool OnUse(Player player, Item item, SpellCastTargets targets, ObjectGuid castId)
{ {
if (targets.GetUnitTarget() && targets.GetUnitTarget().IsTypeId(TypeId.Unit) && if (targets.GetUnitTarget() != null && targets.GetUnitTarget().GetTypeId() == TypeId.Unit &&
targets.GetUnitTarget().GetEntry() == 20748 && !targets.GetUnitTarget().HasAura(32578)) targets.GetUnitTarget().GetEntry() == 20748 && !targets.GetUnitTarget().HasAura(32578))
return false; return false;
@@ -125,7 +74,7 @@ namespace Scripts.World.ItemScripts
public override bool OnExpire(Player player, ItemTemplate pItemProto) public override bool OnExpire(Player player, ItemTemplate pItemProto)
{ {
List<ItemPosCount> dest = new(); List<ItemPosCount> dest = new();
InventoryResult msg = player.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, 39883, 1); // Cracked Egg var msg = player.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, 39883, 1); // Cracked Egg
if (msg == InventoryResult.Ok) if (msg == InventoryResult.Ok)
player.StoreNewItem(dest, 39883, true, ItemEnchantmentManager.GenerateItemRandomBonusListId(39883)); player.StoreNewItem(dest, 39883, true, ItemEnchantmentManager.GenerateItemRandomBonusListId(39883));
@@ -141,7 +90,7 @@ namespace Scripts.World.ItemScripts
public override bool OnExpire(Player player, ItemTemplate pItemProto) public override bool OnExpire(Player player, ItemTemplate pItemProto)
{ {
List<ItemPosCount> dest = new(); List<ItemPosCount> dest = new();
InventoryResult msg = player.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, 44718, 1); // Ripe Disgusting Jar var msg = player.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, 44718, 1); // Ripe Disgusting Jar
if (msg == InventoryResult.Ok) if (msg == InventoryResult.Ok)
player.StoreNewItem(dest, 44718, true, ItemEnchantmentManager.GenerateItemRandomBonusListId(44718)); player.StoreNewItem(dest, 44718, true, ItemEnchantmentManager.GenerateItemRandomBonusListId(44718));
@@ -152,16 +101,20 @@ namespace Scripts.World.ItemScripts
[Script] [Script]
class item_petrov_cluster_bombs : ItemScript class item_petrov_cluster_bombs : ItemScript
{ {
const uint SpellPetrovBomb = 42406;
const uint AreaIdShatteredStraits = 4064;
const uint ZoneIdHowling = 495;
public item_petrov_cluster_bombs() : base("item_petrov_cluster_bombs") { } public item_petrov_cluster_bombs() : base("item_petrov_cluster_bombs") { }
public override bool OnUse(Player player, Item item, SpellCastTargets targets, ObjectGuid castId) public override bool OnUse(Player player, Item item, SpellCastTargets targets, ObjectGuid castId)
{ {
if (player.GetZoneId() != Misc.ZoneIdHowling) if (player.GetZoneId() != ZoneIdHowling)
return false; return false;
if (player.GetTransport() == null || player.GetAreaId() != Misc.AreaIdShatteredStraits) if (player.GetTransport() == null || player.GetAreaId() != AreaIdShatteredStraits)
{ {
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.PetrovBomb, Difficulty.None); SpellInfo spellInfo = SpellMgr.GetSpellInfo(SpellPetrovBomb, Difficulty.None);
if (spellInfo != null) if (spellInfo != null)
Spell.SendCastResult(player, spellInfo, default, castId, SpellCastResult.NotHere); Spell.SendCastResult(player, spellInfo, default, castId, SpellCastResult.NotHere);
@@ -175,13 +128,16 @@ namespace Scripts.World.ItemScripts
[Script] [Script]
class item_captured_frog : ItemScript class item_captured_frog : ItemScript
{ {
const uint QuestThePerfectSpies = 25444;
const uint NpcVanirasSentryTotem = 40187;
public item_captured_frog() : base("item_captured_frog") { } public item_captured_frog() : base("item_captured_frog") { }
public override bool OnUse(Player player, Item item, SpellCastTargets targets, ObjectGuid castId) public override bool OnUse(Player player, Item item, SpellCastTargets targets, ObjectGuid castId)
{ {
if (player.GetQuestStatus(QuestIds.ThePerfectSpies) == QuestStatus.Incomplete) if (player.GetQuestStatus(QuestThePerfectSpies) == QuestStatus.Incomplete)
{ {
if (player.FindNearestCreature(CreatureIds.VanirasSentryTotem, 10.0f)) if (player.FindNearestCreature(NpcVanirasSentryTotem, 10.0f) != null)
return false; return false;
else else
player.SendEquipError(InventoryResult.OutOfRange, item, null); player.SendEquipError(InventoryResult.OutOfRange, item, null);
@@ -192,8 +148,8 @@ namespace Scripts.World.ItemScripts
} }
} }
[Script] // Only used currently for // Only used currently for
// 19169: Nightfall [Script] // 19169: Nightfall
class item_generic_limit_chance_above_60 : ItemScript class item_generic_limit_chance_above_60 : ItemScript
{ {
public item_generic_limit_chance_above_60() : base("item_generic_limit_chance_above_60") { } public item_generic_limit_chance_above_60() : base("item_generic_limit_chance_above_60") { }
@@ -214,5 +170,4 @@ namespace Scripts.World.ItemScripts
return true; return true;
} }
} }
} }
+40 -51
View File
@@ -8,41 +8,24 @@ using Game.Entities;
using Game.Scripting; using Game.Scripting;
using Game.Spells; using Game.Spells;
using System; using System;
using static Global;
namespace Scripts.World.NpcGuard namespace Scripts.World.NpcGuard
{ {
struct SpellIds
{
public const uint BanishedShattrathA = 36642;
public const uint BanishedShattrathS = 36671;
public const uint BanishTeleport = 36643;
public const uint Exile = 39533;
}
struct TextIds
{
public const uint SayGuardSilAggro = 0;
}
struct CreatureIds
{
public const uint CenarionHoldInfantry = 15184;
public const uint StormwindCityGuard = 68;
public const uint StormwindCityPatroller = 1976;
public const uint OrgrimmarGrunt = 3296;
public const uint AldorVindicator = 18549;
}
[Script] [Script]
class npc_guard_generic : GuardAI class npc_guard_generic : GuardAI
{ {
TaskScheduler _combatScheduler; const uint SayGuardSilAggro = 0;
const uint NpcCenarionHoldInfantry = 15184;
const uint NpcStormwindCityGuard = 68;
const uint NpcStormwindCityPatroller = 1976;
const uint NpcOrgrimmarGrunt = 3296;
TaskScheduler _combatScheduler = new();
public npc_guard_generic(Creature creature) : base(creature) public npc_guard_generic(Creature creature) : base(creature)
{ {
_scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting) && !me.IsInEvadeMode() && me.IsAlive()); _scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting) && !me.IsInEvadeMode() && me.IsAlive());
_combatScheduler = new TaskScheduler();
_combatScheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting)); _combatScheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting));
} }
@@ -50,14 +33,14 @@ namespace Scripts.World.NpcGuard
{ {
_scheduler.CancelAll(); _scheduler.CancelAll();
_combatScheduler.CancelAll(); _combatScheduler.CancelAll();
_scheduler.Schedule(TimeSpan.FromSeconds(1), task => _scheduler.Schedule(TimeSpan.FromSeconds(1), context =>
{ {
// Find a spell that targets friendly and applies an aura (these are generally buffs) // Find a spell that targets friendly and applies an aura (these are generally buffs)
SpellInfo spellInfo = SelectSpell(me, 0, 0, SelectTargetType.AnyFriend, 0, 0, SelectEffect.Aura); SpellInfo spellInfo = SelectSpell(me, 0, 0, SelectTargetType.AnyFriend, 0, 0, SelectEffect.Aura);
if (spellInfo != null) if (spellInfo != null)
DoCast(me, spellInfo.Id); DoCast(me, spellInfo.Id);
task.Repeat(TimeSpan.FromMinutes(10)); context.Repeat(TimeSpan.FromMinutes(10));
}); });
} }
@@ -90,9 +73,9 @@ namespace Scripts.World.NpcGuard
{ {
switch (me.GetEntry()) switch (me.GetEntry())
{ {
case CreatureIds.StormwindCityGuard: case NpcStormwindCityGuard:
case CreatureIds.StormwindCityPatroller: case NpcStormwindCityPatroller:
case CreatureIds.OrgrimmarGrunt: case NpcOrgrimmarGrunt:
break; break;
default: default:
return; return;
@@ -106,15 +89,15 @@ namespace Scripts.World.NpcGuard
public override void JustEngagedWith(Unit who) public override void JustEngagedWith(Unit who)
{ {
if (me.GetEntry() == CreatureIds.CenarionHoldInfantry) if (me.GetEntry() == NpcCenarionHoldInfantry)
Talk(TextIds.SayGuardSilAggro, who); Talk(SayGuardSilAggro, who);
_combatScheduler.Schedule(TimeSpan.FromSeconds(1), task => _combatScheduler.Schedule(TimeSpan.FromSeconds(1), meleeContext =>
{ {
Unit victim = me.GetVictim(); Unit victim = me.GetVictim();
if (!me.IsAttackReady() || !me.IsWithinMeleeRange(victim)) if (!me.IsAttackReady() || !me.IsWithinMeleeRange(victim))
{ {
task.Repeat(); meleeContext.Repeat();
return; return;
} }
if (RandomHelper.randChance(20)) if (RandomHelper.randChance(20))
@@ -124,16 +107,14 @@ namespace Scripts.World.NpcGuard
{ {
me.ResetAttackTimer(); me.ResetAttackTimer();
DoCastVictim(spellInfo.Id); DoCastVictim(spellInfo.Id);
task.Repeat(); meleeContext.Repeat();
return; return;
} }
} }
me.AttackerStateUpdate(victim); me.AttackerStateUpdate(victim);
me.ResetAttackTimer(); me.ResetAttackTimer();
task.Repeat(); meleeContext.Repeat();
}); }).Schedule(TimeSpan.FromSeconds(5), spellContext =>
_combatScheduler.Schedule(TimeSpan.FromSeconds(5), task =>
{ {
bool healing = false; bool healing = false;
SpellInfo spellInfo = null; SpellInfo spellInfo = null;
@@ -155,10 +136,10 @@ namespace Scripts.World.NpcGuard
DoCast(me, spellInfo.Id); DoCast(me, spellInfo.Id);
else else
DoCastVictim(spellInfo.Id); DoCastVictim(spellInfo.Id);
task.Repeat(TimeSpan.FromSeconds(5)); spellContext.Repeat(TimeSpan.FromSeconds(5));
} }
else else
task.Repeat(TimeSpan.FromSeconds(1)); spellContext.Repeat(TimeSpan.FromSeconds(1));
}); });
} }
@@ -176,6 +157,12 @@ namespace Scripts.World.NpcGuard
[Script] [Script]
class npc_guard_shattrath_faction : GuardAI class npc_guard_shattrath_faction : GuardAI
{ {
const uint NpcAldorVindicator = 18549;
const uint SpellBanishedShattrathA = 36642;
const uint SpellBanishedShattrathS = 36671;
const uint SpellBanishTeleport = 36643;
const uint SpellExile = 39533;
public npc_guard_shattrath_faction(Creature creature) : base(creature) public npc_guard_shattrath_faction(Creature creature) : base(creature)
{ {
_scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting)); _scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting));
@@ -196,31 +183,33 @@ namespace Scripts.World.NpcGuard
if (!UpdateVictim()) if (!UpdateVictim())
return; return;
_scheduler.Update(diff, base.DoMeleeAttackIfReady); _scheduler.Update(diff, DoMeleeAttackIfReady);
} }
void ScheduleVanish() void ScheduleVanish()
{ {
_scheduler.Schedule(TimeSpan.FromSeconds(5), task => _scheduler.Schedule(TimeSpan.FromSeconds(5), banishContext =>
{ {
Unit temp = me.GetVictim(); Unit temp = me.GetVictim();
if (temp && temp.IsTypeId(TypeId.Player)) if (temp != null && temp.IsPlayer())
{ {
DoCast(temp, me.GetEntry() == CreatureIds.AldorVindicator ? SpellIds.BanishedShattrathS : SpellIds.BanishedShattrathA); DoCast(temp, me.GetEntry() == NpcAldorVindicator ? SpellBanishedShattrathS : SpellBanishedShattrathA);
ObjectGuid playerGUID = temp.GetGUID(); ObjectGuid playerGUID = temp.GetGUID();
task.Schedule(TimeSpan.FromSeconds(9), task => banishContext.Schedule(TimeSpan.FromSeconds(9), exileContext =>
{ {
Unit temp = Global.ObjAccessor.GetUnit(me, playerGUID); Unit temp = ObjAccessor.GetUnit(me, playerGUID);
if (temp) if (temp != null)
{ {
temp.CastSpell(temp, SpellIds.Exile, true); temp.CastSpell(temp, SpellExile, true);
temp.CastSpell(temp, SpellIds.BanishTeleport, true); temp.CastSpell(temp, SpellBanishTeleport, true);
} }
ScheduleVanish(); ScheduleVanish();
}); });
} }
else else
task.Repeat(); banishContext.Repeat();
}); });
} }
} }
+36 -70
View File
@@ -1,44 +1,38 @@
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved. // Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. // Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
using Framework.Constants;
using Game.AI;
using Game.Entities; using Game.Entities;
using Game.Scripting; using Game.Scripting;
using Game.AI; using static Global;
using Framework.Constants;
namespace Scripts.World.NpcInnkeeper namespace Scripts.World.NpcInnkeeper
{ {
struct SpellIds
{
public const uint TrickOrTreated = 24755;
public const uint Treat = 24715;
}
struct Gossip
{
public const uint MenuId = 9733;
public const uint MenuEventId = 342;
}
[Script] [Script]
class npc_innkeeper : ScriptedAI class npc_innkeeper : ScriptedAI
{ {
const uint SpellTrickOrTreated = 24755;
const uint SpellTreat = 24715;
const uint NpcGossipMenu = 9733;
const uint NpcGossipMenuEvent = 342;
public npc_innkeeper(Creature creature) : base(creature) { } public npc_innkeeper(Creature creature) : base(creature) { }
public override bool OnGossipHello(Player player) public override bool OnGossipHello(Player player)
{ {
player.InitGossipMenu(Gossip.MenuId); player.InitGossipMenu(NpcGossipMenu);
if (Global.GameEventMgr.IsHolidayActive(HolidayIds.HallowsEnd) && !player.HasAura(SpellIds.TrickOrTreated)) if (GameEventMgr.IsHolidayActive(HolidayIds.HallowsEnd) && !player.HasAura(SpellTrickOrTreated))
player.AddGossipItem(Gossip.MenuEventId, 0, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1); player.AddGossipItem(NpcGossipMenuEvent, 0, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
if (me.IsQuestGiver()) if (me.IsQuestGiver())
player.PrepareQuestMenu(me.GetGUID());
if (me.IsVendor()) if (me.IsVendor())
player.AddGossipItem(Gossip.MenuId, 2, eTradeskill.GossipSenderMain, eTradeskill.GossipActionTrade); player.AddGossipItem(NpcGossipMenu, 2, eTradeskill.GossipSenderMain, eTradeskill.GossipActionTrade);
if (me.IsInnkeeper()) if (me.IsInnkeeper())
player.AddGossipItem(Gossip.MenuId, 1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInn); player.AddGossipItem(NpcGossipMenu, 1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInn);
player.TalkedToCreature(me.GetEntry(), me.GetGUID()); player.TalkedToCreature(me.GetEntry(), me.GetGUID());
player.SendGossipMenu(player.GetGossipTextId(me), me.GetGUID()); player.SendGossipMenu(player.GetGossipTextId(me), me.GetGUID());
@@ -49,67 +43,39 @@ namespace Scripts.World.NpcInnkeeper
{ {
uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId); uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId);
player.ClearGossipMenu(); player.ClearGossipMenu();
if (action == eTradeskill.GossipActionInfoDef + 1 && Global.GameEventMgr.IsHolidayActive(HolidayIds.HallowsEnd) && !player.HasAura(SpellIds.TrickOrTreated)) if (action == eTradeskill.GossipActionInfoDef + 1 && GameEventMgr.IsHolidayActive(HolidayIds.HallowsEnd) && !player.HasAura(SpellTrickOrTreated))
{ {
player.CastSpell(player, SpellIds.TrickOrTreated, true); player.CastSpell(player, SpellTrickOrTreated, true);
if (RandomHelper.IRand(0, 1) != 0) if (RandomHelper.URand(0, 1) != 0)
player.CastSpell(player, SpellIds.Treat, true); player.CastSpell(player, SpellTreat, true);
else else
{ {
uint trickspell = 0; uint trickspell = 0;
switch (RandomHelper.IRand(0, 13)) switch (RandomHelper.URand(0, 13))
{ {
case 0: case 0: trickspell = 24753; break; // cannot cast, random TimeSpan.FromSeconds(30)ec
trickspell = 24753; case 1: trickspell = 24713; break; // lepper gnome Costume
break; // cannot cast, random 30sec case 2: trickspell = 24735; break; // male ghost Costume
case 1: case 3: trickspell = 24736; break; // female ghostCostume
trickspell = 24713; case 4: trickspell = 24710; break; // male ninja Costume
break; // lepper gnome costume case 5: trickspell = 24711; break; // female ninja Costume
case 2: case 6: trickspell = 24708; break; // male pirate Costume
trickspell = 24735; case 7: trickspell = 24709; break; // female pirate Costume
break; // male ghost costume case 8: trickspell = 24723; break; // skeleton Costume
case 3: case 9: trickspell = 24753; break; // Trick
trickspell = 24736; case 10: trickspell = 24924; break; // Hallow's End Candy
break; // female ghostcostume case 11: trickspell = 24925; break; // Hallow's End Candy
case 4: case 12: trickspell = 24926; break; // Hallow's End Candy
trickspell = 24710; case 13: trickspell = 24927; break; // Hallow's End Candy
break; // male ninja costume
case 5:
trickspell = 24711;
break; // female ninja costume
case 6:
trickspell = 24708;
break; // male pirate costume
case 7:
trickspell = 24709;
break; // female pirate costume
case 8:
trickspell = 24723;
break; // skeleton costume
case 9:
trickspell = 24753;
break; // Trick
case 10:
trickspell = 24924;
break; // Hallow's End Candy
case 11:
trickspell = 24925;
break; // Hallow's End Candy
case 12:
trickspell = 24926;
break; // Hallow's End Candy
case 13:
trickspell = 24927;
break; // Hallow's End Candy
} }
player.CastSpell(player, trickspell, true); player.CastSpell(player, trickspell, true);
} }
player.CloseGossipMenu(); player.ClearGossipMenu();
return true; return true;
} }
player.CloseGossipMenu(); player.ClearGossipMenu();
switch (action) switch (action)
{ {
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -5,23 +5,21 @@ using Game;
using Game.Entities; using Game.Entities;
using Game.Scripting; using Game.Scripting;
namespace Scripts.World.SceneScripts namespace Scripts.World.Achievements
{ {
struct SpellIds
{
public const uint DeathwingSimulator = 201184;
}
[Script] [Script]
class scene_deathwing_simulator : SceneScript class scene_deathwing_simulator : SceneScript
{ {
const uint SpellDeathwingSimulator = 201184;
public scene_deathwing_simulator() : base("scene_deathwing_simulator") { } public scene_deathwing_simulator() : base("scene_deathwing_simulator") { }
// Called when a player receive trigger from scene // Called when a player receive trigger from scene
public override void OnSceneTriggerEvent(Player player, uint sceneInstanceID, SceneTemplate sceneTemplate, string triggerName) public override void OnSceneTriggerEvent(Player player, uint sceneInstanceID, SceneTemplate sceneTemplate, string triggerName)
{ {
if (triggerName == "Burn Player") if (triggerName == "Burn Player")
player.CastSpell(player, SpellIds.DeathwingSimulator, true); // Deathwing Simulator Burn player player.CastSpell(player, SpellDeathwingSimulator, true); // Deathwing Simulator Burn player
} }
} }
} }