Merge pull request #144 from ElunaLuaEngine/auctionshouse

Auctionshouse Hooks Updates
This commit is contained in:
Salja
2015-01-28 10:46:36 +01:00
4 changed files with 26 additions and 19 deletions

View File

@@ -136,10 +136,10 @@ namespace Hooks
WEATHER_EVENT_ON_CHANGE = 25, // (event, zoneId, state, grade) WEATHER_EVENT_ON_CHANGE = 25, // (event, zoneId, state, grade)
// Auction house // Auction house
AUCTION_EVENT_ON_ADD = 26, // (event, AHObject) AUCTION_EVENT_ON_ADD = 26, // (event, auctionHouseEntry, player, item, bid, buyout, etime)
AUCTION_EVENT_ON_REMOVE = 27, // (event, AHObject) AUCTION_EVENT_ON_REMOVE = 27, // (event, auctionHouseEntry, player, item)
AUCTION_EVENT_ON_SUCCESSFUL = 28, // (event, AHObject) // Not Implemented AUCTION_EVENT_ON_SUCCESSFUL = 28, // (event, auctionHouseEntry) // Not Implemented
AUCTION_EVENT_ON_EXPIRE = 29, // (event, AHObject) // Not Implemented AUCTION_EVENT_ON_EXPIRE = 29, // (event, auctionHouseEntry) // Not Implemented
// AddOns // AddOns
ADDON_EVENT_ON_MESSAGE = 30, // (event, sender, type, prefix, msg, target) - target can be nil/whisper_target/guild/group/channel. Can return false ADDON_EVENT_ON_MESSAGE = 30, // (event, sender, type, prefix, msg, target) - target can be nil/whisper_target/guild/group/channel. Can return false

View File

@@ -442,10 +442,10 @@ public:
void OnChange(Weather* weather, uint32 zone, WeatherState state, float grade); void OnChange(Weather* weather, uint32 zone, WeatherState state, float grade);
/* Auction House */ /* Auction House */
void OnAdd(AuctionHouseObject* auctionHouse); void OnAdd(AuctionHouseEntry const* auctionHouseEntry, Player* pPlayer, Item* pItem, uint32 bid, uint32 buyout, uint32 etime);
void OnRemove(AuctionHouseObject* auctionHouse); void OnRemove(AuctionHouseEntry const* auctionHouseEntry, Player* pPlayer, Item* pItem);
void OnSuccessful(AuctionHouseObject* auctionHouse); void OnSuccessful(AuctionHouseEntry const* auctionHouseEntry);
void OnExpire(AuctionHouseObject* auctionHouse); void OnExpire(AuctionHouseEntry const* auctionHouseEntry);
/* Guild */ /* Guild */
void OnAddMember(Guild* guild, Player* player, uint32 plRank); void OnAddMember(Guild* guild, Player* player, uint32 plRank);

View File

@@ -1218,7 +1218,7 @@ ElunaRegister<Corpse> CorpseMethods[] =
{ NULL, NULL } { NULL, NULL }
}; };
ElunaRegister<AuctionHouseObject> AuctionMethods[] = ElunaRegister<AuctionHouseEntry> AuctionMethods[] =
{ {
{ NULL, NULL } { NULL, NULL }
}; };
@@ -1380,8 +1380,8 @@ void RegisterFunctions(Eluna* E)
ElunaTemplate<Map>::Register(E, "Map"); ElunaTemplate<Map>::Register(E, "Map");
ElunaTemplate<Map>::SetMethods(E, MapMethods); ElunaTemplate<Map>::SetMethods(E, MapMethods);
ElunaTemplate<AuctionHouseObject>::Register(E, "AuctionHouseObject"); ElunaTemplate<AuctionHouseEntry>::Register(E, "AuctionHouseEntry");
ElunaTemplate<AuctionHouseObject>::SetMethods(E, AuctionMethods); ElunaTemplate<AuctionHouseEntry>::SetMethods(E, AuctionMethods);
ElunaTemplate<BattleGround>::Register(E, "BattleGround"); ElunaTemplate<BattleGround>::Register(E, "BattleGround");
ElunaTemplate<BattleGround>::SetMethods(E, BattleGroundMethods); ElunaTemplate<BattleGround>::SetMethods(E, BattleGroundMethods);

View File

@@ -82,43 +82,50 @@ void Eluna::OnChange(Weather* weather, uint32 zone, WeatherState state, float gr
} }
// Auction House // Auction House
void Eluna::OnAdd(AuctionHouseObject* ah) void Eluna::OnAdd(AuctionHouseEntry const* auctionHouseEntry, Player* pPlayer, Item* pItem, uint32 bid, uint32 buyout, uint32 etime)
{ {
if (!ServerEventBindings->HasEvents(AUCTION_EVENT_ON_ADD)) if (!ServerEventBindings->HasEvents(AUCTION_EVENT_ON_ADD))
return; return;
LOCK_ELUNA; LOCK_ELUNA;
Push(ah); Push(auctionHouseEntry);
Push(pPlayer);
Push(pItem);
Push(bid);
Push(buyout);
Push(etime);
CallAllFunctions(ServerEventBindings, AUCTION_EVENT_ON_ADD); CallAllFunctions(ServerEventBindings, AUCTION_EVENT_ON_ADD);
} }
void Eluna::OnRemove(AuctionHouseObject* ah) void Eluna::OnRemove(AuctionHouseEntry const* auctionHouseEntry, Player* pPlayer, Item* pItem)
{ {
if (!ServerEventBindings->HasEvents(AUCTION_EVENT_ON_REMOVE)) if (!ServerEventBindings->HasEvents(AUCTION_EVENT_ON_REMOVE))
return; return;
LOCK_ELUNA; LOCK_ELUNA;
Push(ah); Push(auctionHouseEntry);
Push(pPlayer);
Push(pItem);
CallAllFunctions(ServerEventBindings, AUCTION_EVENT_ON_REMOVE); CallAllFunctions(ServerEventBindings, AUCTION_EVENT_ON_REMOVE);
} }
void Eluna::OnSuccessful(AuctionHouseObject* ah) void Eluna::OnSuccessful(AuctionHouseEntry const* auctionHouseEntry)
{ {
if (!ServerEventBindings->HasEvents(AUCTION_EVENT_ON_SUCCESSFUL)) if (!ServerEventBindings->HasEvents(AUCTION_EVENT_ON_SUCCESSFUL))
return; return;
LOCK_ELUNA; LOCK_ELUNA;
Push(ah); Push(auctionHouseEntry);
CallAllFunctions(ServerEventBindings, AUCTION_EVENT_ON_SUCCESSFUL); CallAllFunctions(ServerEventBindings, AUCTION_EVENT_ON_SUCCESSFUL);
} }
void Eluna::OnExpire(AuctionHouseObject* ah) void Eluna::OnExpire(AuctionHouseEntry const* auctionHouseEntry)
{ {
if (!ServerEventBindings->HasEvents(AUCTION_EVENT_ON_EXPIRE)) if (!ServerEventBindings->HasEvents(AUCTION_EVENT_ON_EXPIRE))
return; return;
LOCK_ELUNA; LOCK_ELUNA;
Push(ah); Push(auctionHouseEntry);
CallAllFunctions(ServerEventBindings, AUCTION_EVENT_ON_EXPIRE); CallAllFunctions(ServerEventBindings, AUCTION_EVENT_ON_EXPIRE);
} }