feat(premium): zero cooldown hearthstone for premium players

This commit is contained in:
gasaichandesu
2026-08-22 19:15:00 +04:00
parent 86cb8811b1
commit 73c4349fa9
5 changed files with 317 additions and 314 deletions
+11
View File
@@ -2,11 +2,13 @@ local PLAYER_EVENT_ON_LOGIN = 3
local PLAYER_EVENT_ON_SPELL_CAST = 5
local PLAYER_EVENT_ON_LOGOUT = 4
local PLAYER_EVENT_ON_COMMAND = 42
local PLAYER_EVENT_ON_BEFORE_TELEPORT = 67
local ACCOUNT_FLAG_RECURRING_BILLING = 8192
local SUMMON_SQUIRE_SPELL_ID = 80000
local HEARTHSTONE_SPELL_ID = 8690
local SQUIRE_CREATURE_TEMPLATE_ID = 9000001
@@ -184,9 +186,18 @@ local function OnLogout(event, player)
squires_table[player:GetGUID()] = nil
end
local function OnBeforeTeleport(player, mapid, x, y, z, orientation, options, target)
if not IsPremium(player) then return end
if player:FindCurrentSpellBySpellId(HEARTHSTONE_SPELL_ID) then
player:ResetSpellCooldown(HEARTHSTONE_SPELL_ID, true)
end
end
RegisterCreatureGossipEvent(SQUIRE_CREATURE_TEMPLATE_ID, 1, OnGossipHello)
RegisterCreatureGossipEvent(SQUIRE_CREATURE_TEMPLATE_ID, 2, OnGossipSelect)
RegisterPlayerEvent(PLAYER_EVENT_ON_LOGIN, OnLogin)
RegisterPlayerEvent(PLAYER_EVENT_ON_LOGOUT, OnLogout)
RegisterPlayerEvent(PLAYER_EVENT_ON_COMMAND, OnCommand)
RegisterPlayerEvent(PLAYER_EVENT_ON_SPELL_CAST, OnSpellCast)
RegisterPlayerEvent(PLAYER_EVENT_ON_BEFORE_TELEPORT, OnBeforeTeleport)
File diff suppressed because it is too large Load Diff
+1
View File
@@ -233,6 +233,7 @@ namespace Hooks
PLAYER_EVENT_ON_AURA_APPLY = 64, // (event, player, aura)
PLAYER_EVENT_ON_HEAL = 65, // (event, player, target, gain) - Can return new heal amount
PLAYER_EVENT_ON_DAMAGE = 66, // (event, player, target, damage) - Can return new damage amount
PLAYER_EVENT_ON_BEFORE_TELEPORT = 67, // (event, player, mapid, x, y, z, orientation, options, target)
PLAYER_EVENT_COUNT
};
@@ -497,6 +497,7 @@ public:
void OnPlayerAuraApply(Player* player, Aura* aura);
void OnPlayerHeal(Player* player, Unit* target, uint32& gain);
void OnPlayerDamage(Player* player, Unit* target, uint32& gain);
void OnBeforeTeleport(Player* player, uint32 mapid, float x, float y, float z, float orientation, uint32 options, Unit* target);
/* Vehicle */
void OnInstall(Vehicle* vehicle);
@@ -825,4 +825,20 @@ void Eluna::OnPlayerDamage(Player* player, Unit* target, uint32& damage)
}
CleanUpStack(3);
}
}
void Eluna::OnPlayerBeforeTeleport(Player* player, uint32 mapid, float x, float y, float z, float orientation, uint32 options, Unit* target)
{
START_HOOK(PLAYER_EVENT_ON_BEFORE_TELEPORT);
Push(player);
Push(mapid);
Push(x);
Push(y);
Push(z);
Push(orientation);
Push(options);
Push(target);
return CallAllFunctionsBool(PlayerEventBindings, key);
}