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 eObjectMgr (sObjectMgr)
#define eAccountMgr (sAccountMgr)
#define eAuctionMgr (sAuctionMgr)
#define eObjectAccessor (sObjectAccessor)
#define REGEN_TIME_FULL
typedef ThreatContainer::StorageType ThreatList;
@@ -103,6 +104,7 @@ typedef ThreatContainer::StorageType ThreatList;
#define eGuildMgr (&sGuildMgr)
#define eObjectMgr (&sObjectMgr)
#define eAccountMgr (&sAccountMgr)
#define eAuctionMgr (&sAuctionMgr)
#define eObjectAccessor (&sObjectAccessor)
#define SERVER_MSG_STRING SERVER_MSG_CUSTOM
#define TOTAL_LOCALES MAX_LOCALE

View File

@@ -136,10 +136,10 @@ namespace Hooks
WEATHER_EVENT_ON_CHANGE = 25, // (event, zoneId, state, grade)
// Auction house
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
AUCTION_EVENT_ON_ADD = 26, // (event, auctionId, owner, item, expireTime, buyout, startBid, currentBid, bidderGUIDLow)
AUCTION_EVENT_ON_REMOVE = 27, // (event, auctionId, owner, item, expireTime, buyout, startBid, currentBid, bidderGUIDLow)
AUCTION_EVENT_ON_SUCCESSFUL = 28, // (event, auctionId, owner, item, expireTime, buyout, startBid, currentBid, bidderGUIDLow)
AUCTION_EVENT_ON_EXPIRE = 29, // (event, auctionId, owner, item, expireTime, buyout, startBid, currentBid, bidderGUIDLow)
// AddOns
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;
class AuctionHouseObject;
struct AuctionEntry;
#ifdef TRINITY
class Battleground;
typedef Battleground BattleGround;
@@ -442,10 +443,10 @@ public:
void OnChange(Weather* weather, uint32 zone, WeatherState state, float grade);
/* Auction House */
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);
void OnAdd(AuctionHouseObject* ah, AuctionEntry* entry);
void OnRemove(AuctionHouseObject* ah, AuctionEntry* entry);
void OnSuccessful(AuctionHouseObject* ah, AuctionEntry* entry);
void OnExpire(AuctionHouseObject* ah, AuctionEntry* entry);
/* Guild */
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
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))
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;
Push(auctionHouseEntry);
Push(pPlayer);
Push(pItem);
Push(bid);
Push(buyout);
Push(etime);
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_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))
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;
Push(auctionHouseEntry);
Push(pPlayer);
Push(pItem);
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_REMOVE);
}
void Eluna::OnSuccessful(AuctionHouseEntry const* auctionHouseEntry)
void Eluna::OnSuccessful(AuctionHouseObject* /*ah*/, AuctionEntry* entry)
{
if (!ServerEventBindings->HasEvents(AUCTION_EVENT_ON_SUCCESSFUL))
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;
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);
}
void Eluna::OnExpire(AuctionHouseEntry const* auctionHouseEntry)
void Eluna::OnExpire(AuctionHouseObject* /*ah*/, AuctionEntry* entry)
{
if (!ServerEventBindings->HasEvents(AUCTION_EVENT_ON_EXPIRE))
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;
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);
}