Change AH hooks to work with TC

This commit is contained in:
Rochet2
2015-02-15 00:16:22 +02:00
parent cd217f9490
commit 6a731d24ea
4 changed files with 71 additions and 23 deletions

View File

@@ -87,6 +87,7 @@ typedef Opcodes OpcodesList;
#define eGuildMgr (sGuildMgr) #define eGuildMgr (sGuildMgr)
#define eObjectMgr (sObjectMgr) #define eObjectMgr (sObjectMgr)
#define eAccountMgr (sAccountMgr) #define eAccountMgr (sAccountMgr)
#define eAuctionMgr (sAuctionMgr)
#define eObjectAccessor (sObjectAccessor) #define eObjectAccessor (sObjectAccessor)
#define REGEN_TIME_FULL #define REGEN_TIME_FULL
typedef ThreatContainer::StorageType ThreatList; typedef ThreatContainer::StorageType ThreatList;
@@ -103,6 +104,7 @@ typedef ThreatContainer::StorageType ThreatList;
#define eGuildMgr (&sGuildMgr) #define eGuildMgr (&sGuildMgr)
#define eObjectMgr (&sObjectMgr) #define eObjectMgr (&sObjectMgr)
#define eAccountMgr (&sAccountMgr) #define eAccountMgr (&sAccountMgr)
#define eAuctionMgr (&sAuctionMgr)
#define eObjectAccessor (&sObjectAccessor) #define eObjectAccessor (&sObjectAccessor)
#define SERVER_MSG_STRING SERVER_MSG_CUSTOM #define SERVER_MSG_STRING SERVER_MSG_CUSTOM
#define TOTAL_LOCALES MAX_LOCALE #define TOTAL_LOCALES MAX_LOCALE

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, auctionHouseEntry, player, item, bid, buyout, etime) AUCTION_EVENT_ON_ADD = 26, // (event, auctionId, owner, item, expireTime, buyout, startBid, currentBid, bidderGUIDLow)
AUCTION_EVENT_ON_REMOVE = 27, // (event, auctionHouseEntry, player, item) AUCTION_EVENT_ON_REMOVE = 27, // (event, auctionId, owner, item, expireTime, buyout, startBid, currentBid, bidderGUIDLow)
AUCTION_EVENT_ON_SUCCESSFUL = 28, // (event, auctionHouseEntry) // Not Implemented AUCTION_EVENT_ON_SUCCESSFUL = 28, // (event, auctionId, owner, item, expireTime, buyout, startBid, currentBid, bidderGUIDLow)
AUCTION_EVENT_ON_EXPIRE = 29, // (event, auctionHouseEntry) // Not Implemented AUCTION_EVENT_ON_EXPIRE = 29, // (event, auctionId, owner, item, expireTime, buyout, startBid, currentBid, bidderGUIDLow)
// 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

@@ -41,6 +41,7 @@ typedef int Difficulty;
struct AreaTriggerEntry; struct AreaTriggerEntry;
class AuctionHouseObject; class AuctionHouseObject;
struct AuctionEntry;
#ifdef TRINITY #ifdef TRINITY
class Battleground; class Battleground;
typedef Battleground BattleGround; typedef Battleground BattleGround;
@@ -442,10 +443,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(AuctionHouseEntry const* auctionHouseEntry, Player* pPlayer, Item* pItem, uint32 bid, uint32 buyout, uint32 etime); void OnAdd(AuctionHouseObject* ah, AuctionEntry* entry);
void OnRemove(AuctionHouseEntry const* auctionHouseEntry, Player* pPlayer, Item* pItem); void OnRemove(AuctionHouseObject* ah, AuctionEntry* entry);
void OnSuccessful(AuctionHouseEntry const* auctionHouseEntry); void OnSuccessful(AuctionHouseObject* ah, AuctionEntry* entry);
void OnExpire(AuctionHouseEntry const* auctionHouseEntry); void OnExpire(AuctionHouseObject* ah, AuctionEntry* entry);
/* Guild */ /* Guild */
void OnAddMember(Guild* guild, Player* player, uint32 plRank); void OnAddMember(Guild* guild, Player* player, uint32 plRank);

View File

@@ -82,50 +82,95 @@ void Eluna::OnChange(Weather* weather, uint32 zone, WeatherState state, float gr
} }
// Auction House // Auction House
void Eluna::OnAdd(AuctionHouseEntry const* auctionHouseEntry, Player* pPlayer, Item* pItem, uint32 bid, uint32 buyout, uint32 etime) void Eluna::OnAdd(AuctionHouseObject* /*ah*/, AuctionEntry* entry)
{ {
if (!ServerEventBindings->HasEvents(AUCTION_EVENT_ON_ADD)) if (!ServerEventBindings->HasEvents(AUCTION_EVENT_ON_ADD))
return; return;
Player* owner = eObjectAccessor->FindPlayer(MAKE_NEW_GUID(entry->owner, 0, HIGHGUID_PLAYER));
Item* item = eAuctionMgr->GetAItem(entry->itemGUIDLow);
if (!owner || !item)
return;
LOCK_ELUNA; LOCK_ELUNA;
Push(auctionHouseEntry); Push(entry->Id);
Push(pPlayer); Push(owner);
Push(pItem); Push(item);
Push(bid); Push(entry->expire_time);
Push(buyout); Push(entry->buyout);
Push(etime); Push(entry->startbid);
Push(entry->bid);
Push(entry->bidder);
CallAllFunctions(ServerEventBindings, AUCTION_EVENT_ON_ADD); CallAllFunctions(ServerEventBindings, AUCTION_EVENT_ON_ADD);
} }
void Eluna::OnRemove(AuctionHouseEntry const* auctionHouseEntry, Player* pPlayer, Item* pItem) void Eluna::OnRemove(AuctionHouseObject* /*ah*/, AuctionEntry* entry)
{ {
if (!ServerEventBindings->HasEvents(AUCTION_EVENT_ON_REMOVE)) if (!ServerEventBindings->HasEvents(AUCTION_EVENT_ON_REMOVE))
return; return;
Player* owner = eObjectAccessor->FindPlayer(MAKE_NEW_GUID(entry->owner, 0, HIGHGUID_PLAYER));
Item* item = eAuctionMgr->GetAItem(entry->itemGUIDLow);
if (!owner || !item)
return;
LOCK_ELUNA; LOCK_ELUNA;
Push(auctionHouseEntry); Push(entry->Id);
Push(pPlayer); Push(owner);
Push(pItem); Push(item);
Push(entry->expire_time);
Push(entry->buyout);
Push(entry->startbid);
Push(entry->bid);
Push(entry->bidder);
CallAllFunctions(ServerEventBindings, AUCTION_EVENT_ON_REMOVE); CallAllFunctions(ServerEventBindings, AUCTION_EVENT_ON_REMOVE);
} }
void Eluna::OnSuccessful(AuctionHouseEntry const* auctionHouseEntry) void Eluna::OnSuccessful(AuctionHouseObject* /*ah*/, AuctionEntry* entry)
{ {
if (!ServerEventBindings->HasEvents(AUCTION_EVENT_ON_SUCCESSFUL)) if (!ServerEventBindings->HasEvents(AUCTION_EVENT_ON_SUCCESSFUL))
return; return;
Player* owner = eObjectAccessor->FindPlayer(MAKE_NEW_GUID(entry->owner, 0, HIGHGUID_PLAYER));
Item* item = eAuctionMgr->GetAItem(entry->itemGUIDLow);
if (!owner || !item)
return;
LOCK_ELUNA; LOCK_ELUNA;
Push(auctionHouseEntry); Push(entry->Id);
Push(owner);
Push(item);
Push(entry->expire_time);
Push(entry->buyout);
Push(entry->startbid);
Push(entry->bid);
Push(entry->bidder);
CallAllFunctions(ServerEventBindings, AUCTION_EVENT_ON_SUCCESSFUL); CallAllFunctions(ServerEventBindings, AUCTION_EVENT_ON_SUCCESSFUL);
} }
void Eluna::OnExpire(AuctionHouseEntry const* auctionHouseEntry) void Eluna::OnExpire(AuctionHouseObject* /*ah*/, AuctionEntry* entry)
{ {
if (!ServerEventBindings->HasEvents(AUCTION_EVENT_ON_EXPIRE)) if (!ServerEventBindings->HasEvents(AUCTION_EVENT_ON_EXPIRE))
return; return;
Player* owner = eObjectAccessor->FindPlayer(MAKE_NEW_GUID(entry->owner, 0, HIGHGUID_PLAYER));
Item* item = eAuctionMgr->GetAItem(entry->itemGUIDLow);
if (!owner || !item)
return;
LOCK_ELUNA; LOCK_ELUNA;
Push(auctionHouseEntry); Push(entry->Id);
Push(owner);
Push(item);
Push(entry->expire_time);
Push(entry->buyout);
Push(entry->startbid);
Push(entry->bid);
Push(entry->bidder);
CallAllFunctions(ServerEventBindings, AUCTION_EVENT_ON_EXPIRE); CallAllFunctions(ServerEventBindings, AUCTION_EVENT_ON_EXPIRE);
} }