From 734f720aca5c21507155cfb24c253f58878b7a6e Mon Sep 17 00:00:00 2001 From: Salja Date: Sun, 25 Jan 2015 22:47:16 +0100 Subject: [PATCH 1/3] add player and item to auctionshouse hooks, not sure is better move back to player events ? Signed-off-by: Salja --- Hooks.h | 4 ++-- LuaEngine.h | 4 ++-- ServerHooks.cpp | 8 ++++++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Hooks.h b/Hooks.h index 24aeee8..5319f4c 100644 --- a/Hooks.h +++ b/Hooks.h @@ -136,8 +136,8 @@ namespace Hooks WEATHER_EVENT_ON_CHANGE = 25, // (event, zoneId, state, grade) // Auction house - AUCTION_EVENT_ON_ADD = 26, // (event, AHObject) - AUCTION_EVENT_ON_REMOVE = 27, // (event, AHObject) + AUCTION_EVENT_ON_ADD = 26, // (event, AHObject, player, item) + AUCTION_EVENT_ON_REMOVE = 27, // (event, AHObject, player, item) AUCTION_EVENT_ON_SUCCESSFUL = 28, // (event, AHObject) // Not Implemented AUCTION_EVENT_ON_EXPIRE = 29, // (event, AHObject) // Not Implemented diff --git a/LuaEngine.h b/LuaEngine.h index f106a70..63df6c3 100644 --- a/LuaEngine.h +++ b/LuaEngine.h @@ -442,8 +442,8 @@ public: void OnChange(Weather* weather, uint32 zone, WeatherState state, float grade); /* Auction House */ - void OnAdd(AuctionHouseObject* auctionHouse); - void OnRemove(AuctionHouseObject* auctionHouse); + void OnAdd(AuctionHouseObject* auctionHouse, Player* pPlayer, Item* pItem); + void OnRemove(AuctionHouseObject* auctionHouse, Player* pPlayer, Item* pItem); void OnSuccessful(AuctionHouseObject* auctionHouse); void OnExpire(AuctionHouseObject* auctionHouse); diff --git a/ServerHooks.cpp b/ServerHooks.cpp index 6391556..12ec26a 100644 --- a/ServerHooks.cpp +++ b/ServerHooks.cpp @@ -82,23 +82,27 @@ void Eluna::OnChange(Weather* weather, uint32 zone, WeatherState state, float gr } // Auction House -void Eluna::OnAdd(AuctionHouseObject* ah) +void Eluna::OnAdd(AuctionHouseObject* ah, Player* pPlayer, Item* pItem) { if (!ServerEventBindings->HasEvents(AUCTION_EVENT_ON_ADD)) return; LOCK_ELUNA; Push(ah); + Push(pPlayer); + Push(pItem); CallAllFunctions(ServerEventBindings, AUCTION_EVENT_ON_ADD); } -void Eluna::OnRemove(AuctionHouseObject* ah) +void Eluna::OnRemove(AuctionHouseObject* ah, Player* pPlayer, Item* pItem) { if (!ServerEventBindings->HasEvents(AUCTION_EVENT_ON_REMOVE)) return; LOCK_ELUNA; Push(ah); + Push(pPlayer); + Push(pItem); CallAllFunctions(ServerEventBindings, AUCTION_EVENT_ON_REMOVE); } From 81b049cdcdc4a24288677896989f4ff0d35b7ed9 Mon Sep 17 00:00:00 2001 From: Salja Date: Sun, 25 Jan 2015 23:22:45 +0100 Subject: [PATCH 2/3] use auctionHouseEntry for all auctions hooks add buyout, etime to AUCTION_EVENT_ON_ADD Signed-off-by: Salja --- Hooks.h | 8 ++++---- LuaEngine.h | 8 ++++---- LuaFunctions.cpp | 6 +++--- ServerHooks.cpp | 18 ++++++++++-------- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/Hooks.h b/Hooks.h index 5319f4c..40af516 100644 --- a/Hooks.h +++ b/Hooks.h @@ -136,10 +136,10 @@ namespace Hooks WEATHER_EVENT_ON_CHANGE = 25, // (event, zoneId, state, grade) // Auction house - AUCTION_EVENT_ON_ADD = 26, // (event, AHObject, player, item) - AUCTION_EVENT_ON_REMOVE = 27, // (event, AHObject, player, item) - AUCTION_EVENT_ON_SUCCESSFUL = 28, // (event, AHObject) // Not Implemented - AUCTION_EVENT_ON_EXPIRE = 29, // (event, AHObject) // Not Implemented + AUCTION_EVENT_ON_ADD = 26, // (event, auctionHouseEntry, player, item, buyout, etime) + AUCTION_EVENT_ON_REMOVE = 27, // (event, auctionHouseEntry, player, item) + AUCTION_EVENT_ON_SUCCESSFUL = 28, // (event, auctionHouseEntry) // Not Implemented + AUCTION_EVENT_ON_EXPIRE = 29, // (event, auctionHouseEntry) // Not Implemented // AddOns ADDON_EVENT_ON_MESSAGE = 30, // (event, sender, type, prefix, msg, target) - target can be nil/whisper_target/guild/group/channel. Can return false diff --git a/LuaEngine.h b/LuaEngine.h index 63df6c3..4285b9b 100644 --- a/LuaEngine.h +++ b/LuaEngine.h @@ -442,10 +442,10 @@ public: void OnChange(Weather* weather, uint32 zone, WeatherState state, float grade); /* Auction House */ - void OnAdd(AuctionHouseObject* auctionHouse, Player* pPlayer, Item* pItem); - void OnRemove(AuctionHouseObject* auctionHouse, Player* pPlayer, Item* pItem); - void OnSuccessful(AuctionHouseObject* auctionHouse); - void OnExpire(AuctionHouseObject* auctionHouse); + void OnAdd(AuctionHouseEntry const* auctionHouseEntry, Player* pPlayer, Item* pItem, uint32 buyout, uint32 etime); + void OnRemove(AuctionHouseEntry const* auctionHouseEntry, Player* pPlayer, Item* pItem); + void OnSuccessful(AuctionHouseEntry const* auctionHouseEntry); + void OnExpire(AuctionHouseEntry const* auctionHouseEntry); /* Guild */ void OnAddMember(Guild* guild, Player* player, uint32 plRank); diff --git a/LuaFunctions.cpp b/LuaFunctions.cpp index afc807f..791e013 100644 --- a/LuaFunctions.cpp +++ b/LuaFunctions.cpp @@ -1218,7 +1218,7 @@ ElunaRegister CorpseMethods[] = { NULL, NULL } }; -ElunaRegister AuctionMethods[] = +ElunaRegister AuctionMethods[] = { { NULL, NULL } }; @@ -1380,8 +1380,8 @@ void RegisterFunctions(Eluna* E) ElunaTemplate::Register(E, "Map"); ElunaTemplate::SetMethods(E, MapMethods); - ElunaTemplate::Register(E, "AuctionHouseObject"); - ElunaTemplate::SetMethods(E, AuctionMethods); + ElunaTemplate::Register(E, "AuctionHouseEntry"); + ElunaTemplate::SetMethods(E, AuctionMethods); ElunaTemplate::Register(E, "BattleGround"); ElunaTemplate::SetMethods(E, BattleGroundMethods); diff --git a/ServerHooks.cpp b/ServerHooks.cpp index 12ec26a..a693521 100644 --- a/ServerHooks.cpp +++ b/ServerHooks.cpp @@ -82,47 +82,49 @@ void Eluna::OnChange(Weather* weather, uint32 zone, WeatherState state, float gr } // Auction House -void Eluna::OnAdd(AuctionHouseObject* ah, Player* pPlayer, Item* pItem) +void Eluna::OnAdd(AuctionHouseEntry const* auctionHouseEntry, Player* pPlayer, Item* pItem, uint32 buyout, uint32 etime) { if (!ServerEventBindings->HasEvents(AUCTION_EVENT_ON_ADD)) return; LOCK_ELUNA; - Push(ah); + Push(auctionHouseEntry); Push(pPlayer); Push(pItem); + Push(buyout); + Push(etime); CallAllFunctions(ServerEventBindings, AUCTION_EVENT_ON_ADD); } -void Eluna::OnRemove(AuctionHouseObject* ah, Player* pPlayer, Item* pItem) +void Eluna::OnRemove(AuctionHouseEntry const* auctionHouseEntry, Player* pPlayer, Item* pItem) { if (!ServerEventBindings->HasEvents(AUCTION_EVENT_ON_REMOVE)) return; LOCK_ELUNA; - Push(ah); + Push(auctionHouseEntry); Push(pPlayer); Push(pItem); CallAllFunctions(ServerEventBindings, AUCTION_EVENT_ON_REMOVE); } -void Eluna::OnSuccessful(AuctionHouseObject* ah) +void Eluna::OnSuccessful(AuctionHouseEntry const* auctionHouseEntry) { if (!ServerEventBindings->HasEvents(AUCTION_EVENT_ON_SUCCESSFUL)) return; LOCK_ELUNA; - Push(ah); + Push(auctionHouseEntry); CallAllFunctions(ServerEventBindings, AUCTION_EVENT_ON_SUCCESSFUL); } -void Eluna::OnExpire(AuctionHouseObject* ah) +void Eluna::OnExpire(AuctionHouseEntry const* auctionHouseEntry) { if (!ServerEventBindings->HasEvents(AUCTION_EVENT_ON_EXPIRE)) return; LOCK_ELUNA; - Push(ah); + Push(auctionHouseEntry); CallAllFunctions(ServerEventBindings, AUCTION_EVENT_ON_EXPIRE); } From 540c351460ab229ab2a60fe0be28be2e40010062 Mon Sep 17 00:00:00 2001 From: Salja Date: Sun, 25 Jan 2015 23:44:26 +0100 Subject: [PATCH 3/3] add bid to AUCTION_EVENT_ON_ADD Signed-off-by: Salja --- Hooks.h | 2 +- LuaEngine.h | 2 +- ServerHooks.cpp | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Hooks.h b/Hooks.h index 40af516..279ddd2 100644 --- a/Hooks.h +++ b/Hooks.h @@ -136,7 +136,7 @@ namespace Hooks WEATHER_EVENT_ON_CHANGE = 25, // (event, zoneId, state, grade) // Auction house - AUCTION_EVENT_ON_ADD = 26, // (event, auctionHouseEntry, player, item, buyout, etime) + AUCTION_EVENT_ON_ADD = 26, // (event, auctionHouseEntry, player, item, bid, buyout, etime) AUCTION_EVENT_ON_REMOVE = 27, // (event, auctionHouseEntry, player, item) AUCTION_EVENT_ON_SUCCESSFUL = 28, // (event, auctionHouseEntry) // Not Implemented AUCTION_EVENT_ON_EXPIRE = 29, // (event, auctionHouseEntry) // Not Implemented diff --git a/LuaEngine.h b/LuaEngine.h index 4285b9b..83a6cb2 100644 --- a/LuaEngine.h +++ b/LuaEngine.h @@ -442,7 +442,7 @@ public: void OnChange(Weather* weather, uint32 zone, WeatherState state, float grade); /* Auction House */ - void OnAdd(AuctionHouseEntry const* auctionHouseEntry, Player* pPlayer, Item* pItem, uint32 buyout, uint32 etime); + void OnAdd(AuctionHouseEntry const* auctionHouseEntry, Player* pPlayer, Item* pItem, uint32 bid, uint32 buyout, uint32 etime); void OnRemove(AuctionHouseEntry const* auctionHouseEntry, Player* pPlayer, Item* pItem); void OnSuccessful(AuctionHouseEntry const* auctionHouseEntry); void OnExpire(AuctionHouseEntry const* auctionHouseEntry); diff --git a/ServerHooks.cpp b/ServerHooks.cpp index a693521..0de14b8 100644 --- a/ServerHooks.cpp +++ b/ServerHooks.cpp @@ -82,7 +82,7 @@ void Eluna::OnChange(Weather* weather, uint32 zone, WeatherState state, float gr } // Auction House -void Eluna::OnAdd(AuctionHouseEntry const* auctionHouseEntry, Player* pPlayer, Item* pItem, uint32 buyout, uint32 etime) +void Eluna::OnAdd(AuctionHouseEntry const* auctionHouseEntry, Player* pPlayer, Item* pItem, uint32 bid, uint32 buyout, uint32 etime) { if (!ServerEventBindings->HasEvents(AUCTION_EVENT_ON_ADD)) return; @@ -91,6 +91,7 @@ void Eluna::OnAdd(AuctionHouseEntry const* auctionHouseEntry, Player* pPlayer, I Push(auctionHouseEntry); Push(pPlayer); Push(pItem); + Push(bid); Push(buyout); Push(etime); CallAllFunctions(ServerEventBindings, AUCTION_EVENT_ON_ADD);