mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
eluna OnLearnTalents hook and player:LearnTalent function
Signed-off-by: Salja <salja8840@gmail.com>
This commit is contained in:
@@ -9,10 +9,9 @@
|
|||||||
|
|
||||||
#include "Hooks.h"
|
#include "Hooks.h"
|
||||||
#include "HookHelpers.h"
|
#include "HookHelpers.h"
|
||||||
#include "ElunaTemplate.h"
|
|
||||||
#include "LuaEngine.h"
|
#include "LuaEngine.h"
|
||||||
#include "ElunaTemplate.h" // Needed to be able to push BattleGround objects.
|
|
||||||
#include "ElunaBinding.h"
|
#include "ElunaBinding.h"
|
||||||
|
#include "ElunaTemplate.h"
|
||||||
|
|
||||||
using namespace Hooks;
|
using namespace Hooks;
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,10 @@
|
|||||||
|
|
||||||
#include "Hooks.h"
|
#include "Hooks.h"
|
||||||
#include "HookHelpers.h"
|
#include "HookHelpers.h"
|
||||||
#include "ElunaTemplate.h"
|
|
||||||
#include "LuaEngine.h"
|
#include "LuaEngine.h"
|
||||||
#include "ElunaBinding.h"
|
#include "ElunaBinding.h"
|
||||||
#include "ElunaIncludes.h"
|
#include "ElunaIncludes.h"
|
||||||
|
#include "ElunaTemplate.h"
|
||||||
|
|
||||||
using namespace Hooks;
|
using namespace Hooks;
|
||||||
|
|
||||||
|
|||||||
@@ -9,11 +9,11 @@
|
|||||||
|
|
||||||
#include "Hooks.h"
|
#include "Hooks.h"
|
||||||
#include "HookHelpers.h"
|
#include "HookHelpers.h"
|
||||||
#include "ElunaTemplate.h"
|
|
||||||
#include "LuaEngine.h"
|
#include "LuaEngine.h"
|
||||||
#include "ElunaBinding.h"
|
#include "ElunaBinding.h"
|
||||||
#include "ElunaIncludes.h"
|
#include "ElunaIncludes.h"
|
||||||
#include "ElunaEventMgr.h"
|
#include "ElunaEventMgr.h"
|
||||||
|
#include "ElunaTemplate.h"
|
||||||
|
|
||||||
using namespace Hooks;
|
using namespace Hooks;
|
||||||
|
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
|
|
||||||
#include "Hooks.h"
|
#include "Hooks.h"
|
||||||
#include "HookHelpers.h"
|
#include "HookHelpers.h"
|
||||||
#include "ElunaTemplate.h"
|
|
||||||
#include "LuaEngine.h"
|
#include "LuaEngine.h"
|
||||||
#include "ElunaBinding.h"
|
#include "ElunaBinding.h"
|
||||||
|
#include "ElunaTemplate.h"
|
||||||
|
|
||||||
using namespace Hooks;
|
using namespace Hooks;
|
||||||
|
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
|
|
||||||
#include "Hooks.h"
|
#include "Hooks.h"
|
||||||
#include "HookHelpers.h"
|
#include "HookHelpers.h"
|
||||||
#include "ElunaTemplate.h"
|
|
||||||
#include "LuaEngine.h"
|
#include "LuaEngine.h"
|
||||||
#include "ElunaBinding.h"
|
#include "ElunaBinding.h"
|
||||||
|
#include "ElunaTemplate.h"
|
||||||
|
|
||||||
using namespace Hooks;
|
using namespace Hooks;
|
||||||
|
|
||||||
|
|||||||
2
Hooks.h
2
Hooks.h
@@ -195,7 +195,7 @@ namespace Hooks
|
|||||||
PLAYER_EVENT_ON_RESURRECT = 36, // (event, player)
|
PLAYER_EVENT_ON_RESURRECT = 36, // (event, player)
|
||||||
PLAYER_EVENT_ON_LOOT_MONEY = 37, // (event, player, amount)
|
PLAYER_EVENT_ON_LOOT_MONEY = 37, // (event, player, amount)
|
||||||
PLAYER_EVENT_ON_QUEST_ABANDON = 38, // (event, player, questId)
|
PLAYER_EVENT_ON_QUEST_ABANDON = 38, // (event, player, questId)
|
||||||
// UNUSED = 39, // (event, player)
|
PLAYER_EVENT_ON_LEARN_TALENTS = 39, // (event, player, talentId, talentRank, spellid)
|
||||||
// UNUSED = 40, // (event, player)
|
// UNUSED = 40, // (event, player)
|
||||||
// UNUSED = 41, // (event, player)
|
// UNUSED = 41, // (event, player)
|
||||||
PLAYER_EVENT_ON_COMMAND = 42, // (event, player, command) - player is nil if command used from console. Can return false
|
PLAYER_EVENT_ON_COMMAND = 42, // (event, player, command) - player is nil if command used from console. Can return false
|
||||||
|
|||||||
@@ -9,10 +9,10 @@
|
|||||||
|
|
||||||
#include "Hooks.h"
|
#include "Hooks.h"
|
||||||
#include "HookHelpers.h"
|
#include "HookHelpers.h"
|
||||||
#include "ElunaTemplate.h"
|
|
||||||
#include "LuaEngine.h"
|
#include "LuaEngine.h"
|
||||||
#include "ElunaBinding.h"
|
#include "ElunaBinding.h"
|
||||||
#include "ElunaIncludes.h"
|
#include "ElunaIncludes.h"
|
||||||
|
#include "ElunaTemplate.h"
|
||||||
|
|
||||||
using namespace Hooks;
|
using namespace Hooks;
|
||||||
|
|
||||||
|
|||||||
@@ -314,6 +314,7 @@ public:
|
|||||||
void OnRepop(Player* pPlayer);
|
void OnRepop(Player* pPlayer);
|
||||||
void OnResurrect(Player* pPlayer);
|
void OnResurrect(Player* pPlayer);
|
||||||
void OnQuestAbandon(Player* pPlayer, uint32 questId);
|
void OnQuestAbandon(Player* pPlayer, uint32 questId);
|
||||||
|
void OnLearnTalents(Player* pPlayer, uint32 talentId, uint32 talentRank, uint32 spellid);
|
||||||
InventoryResult OnCanUseItem(const Player* pPlayer, uint32 itemEntry);
|
InventoryResult OnCanUseItem(const Player* pPlayer, uint32 itemEntry);
|
||||||
void OnLuaStateClose();
|
void OnLuaStateClose();
|
||||||
void OnLuaStateOpen();
|
void OnLuaStateOpen();
|
||||||
|
|||||||
@@ -649,6 +649,7 @@ ElunaRegister<Player> PlayerMethods[] =
|
|||||||
{ "SendVendorWindow", &LuaPlayer::SendVendorWindow }, // :SendVendorWindow(unit) - Sends the unit's vendor window to the player
|
{ "SendVendorWindow", &LuaPlayer::SendVendorWindow }, // :SendVendorWindow(unit) - Sends the unit's vendor window to the player
|
||||||
{ "ModifyMoney", &LuaPlayer::ModifyMoney }, // :ModifyMoney(amount[, sendError]) - Modifies (does not set) money (copper count) of the player. Amount can be negative to remove copper
|
{ "ModifyMoney", &LuaPlayer::ModifyMoney }, // :ModifyMoney(amount[, sendError]) - Modifies (does not set) money (copper count) of the player. Amount can be negative to remove copper
|
||||||
{ "LearnSpell", &LuaPlayer::LearnSpell }, // :LearnSpell(id) - learns the given spell
|
{ "LearnSpell", &LuaPlayer::LearnSpell }, // :LearnSpell(id) - learns the given spell
|
||||||
|
{ "LearnTalent", &LuaPlayer::LearnTalent },
|
||||||
{ "RemoveItem", &LuaPlayer::RemoveItem }, // :RemoveItem(item/entry, amount) - Removes amount of item from player
|
{ "RemoveItem", &LuaPlayer::RemoveItem }, // :RemoveItem(item/entry, amount) - Removes amount of item from player
|
||||||
{ "RemoveLifetimeKills", &LuaPlayer::RemoveLifetimeKills }, // :RemoveLifetimeKills(val) - Removes a specified amount(val) of the player's lifetime (honorable) kills
|
{ "RemoveLifetimeKills", &LuaPlayer::RemoveLifetimeKills }, // :RemoveLifetimeKills(val) - Removes a specified amount(val) of the player's lifetime (honorable) kills
|
||||||
{ "ResurrectPlayer", &LuaPlayer::ResurrectPlayer }, // :ResurrectPlayer([percent[, sickness(bool)]]) - Resurrects the player at percentage, player gets resurrection sickness if sickness set to true
|
{ "ResurrectPlayer", &LuaPlayer::ResurrectPlayer }, // :ResurrectPlayer([percent[, sickness(bool)]]) - Resurrects the player at percentage, player gets resurrection sickness if sickness set to true
|
||||||
|
|||||||
@@ -9,13 +9,26 @@
|
|||||||
|
|
||||||
#include "Hooks.h"
|
#include "Hooks.h"
|
||||||
#include "HookHelpers.h"
|
#include "HookHelpers.h"
|
||||||
#include "ElunaTemplate.h"
|
|
||||||
#include "LuaEngine.h"
|
#include "LuaEngine.h"
|
||||||
#include "ElunaBinding.h"
|
#include "ElunaBinding.h"
|
||||||
#include "ElunaIncludes.h"
|
#include "ElunaIncludes.h"
|
||||||
|
#include "ElunaTemplate.h"
|
||||||
|
|
||||||
using namespace Hooks;
|
using namespace Hooks;
|
||||||
|
|
||||||
|
void Eluna::OnLearnTalents(Player* pPlayer, uint32 talentId, uint32 talentRank, uint32 spellid)
|
||||||
|
{
|
||||||
|
if (!PlayerEventBindings->HasEvents(PLAYER_EVENT_ON_LEARN_TALENTS))
|
||||||
|
return;
|
||||||
|
|
||||||
|
LOCK_ELUNA;
|
||||||
|
Push(pPlayer);
|
||||||
|
Push(talentId);
|
||||||
|
Push(talentRank);
|
||||||
|
Push(spellid);
|
||||||
|
CallAllFunctions(PlayerEventBindings, PLAYER_EVENT_ON_LEARN_TALENTS);
|
||||||
|
}
|
||||||
|
|
||||||
void Eluna::HandleGossipSelectOption(Player* pPlayer, Item* item, uint32 sender, uint32 action, const std::string& code)
|
void Eluna::HandleGossipSelectOption(Player* pPlayer, Item* item, uint32 sender, uint32 action, const std::string& code)
|
||||||
{
|
{
|
||||||
if (!ItemGossipBindings->HasEvents(GOSSIP_EVENT_ON_SELECT, item->GetEntry()))
|
if (!ItemGossipBindings->HasEvents(GOSSIP_EVENT_ON_SELECT, item->GetEntry()))
|
||||||
|
|||||||
@@ -2924,6 +2924,21 @@ namespace LuaPlayer
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Learn the [Player] the [Talent] specified by talent_id and talentRank
|
||||||
|
*
|
||||||
|
* @param uint32 talent_id
|
||||||
|
* @param uint32 talentRank
|
||||||
|
*/
|
||||||
|
int LearnTalent(Eluna* /*E*/, lua_State* L, Player* player)
|
||||||
|
{
|
||||||
|
uint32 id = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
|
uint32 rank = Eluna::CHECKVAL<uint32>(L, 3);
|
||||||
|
|
||||||
|
player->LearnTalent(id, rank);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resurrects the [Player]
|
* Resurrects the [Player]
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -11,9 +11,9 @@
|
|||||||
#include "HookHelpers.h"
|
#include "HookHelpers.h"
|
||||||
#include "LuaEngine.h"
|
#include "LuaEngine.h"
|
||||||
#include "ElunaBinding.h"
|
#include "ElunaBinding.h"
|
||||||
#include "ElunaTemplate.h"
|
|
||||||
#include "ElunaEventMgr.h"
|
#include "ElunaEventMgr.h"
|
||||||
#include "ElunaIncludes.h"
|
#include "ElunaIncludes.h"
|
||||||
|
#include "ElunaTemplate.h"
|
||||||
|
|
||||||
using namespace Hooks;
|
using namespace Hooks;
|
||||||
|
|
||||||
|
|||||||
@@ -12,9 +12,9 @@
|
|||||||
|
|
||||||
#include "Hooks.h"
|
#include "Hooks.h"
|
||||||
#include "HookHelpers.h"
|
#include "HookHelpers.h"
|
||||||
#include "ElunaTemplate.h"
|
|
||||||
#include "LuaEngine.h"
|
#include "LuaEngine.h"
|
||||||
#include "ElunaBinding.h"
|
#include "ElunaBinding.h"
|
||||||
|
#include "ElunaTemplate.h"
|
||||||
|
|
||||||
using namespace Hooks;
|
using namespace Hooks;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user