mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-17 10:55:43 +00:00
New hooks OnEquip, OnPlayerJoinBG, OnPlayerJoinArena
This commit is contained in:
@@ -12657,6 +12657,7 @@ Item* Player::EquipItem(uint16 pos, Item* pItem, bool update)
|
||||
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM, pItem->GetEntry());
|
||||
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM, pItem->GetEntry(), slot);
|
||||
|
||||
sScriptMgr->OnEquip(this, pItem, bag, slot, update);
|
||||
return pItem;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "Opcodes.h"
|
||||
#include "DisableMgr.h"
|
||||
#include "Group.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket & recvData)
|
||||
{
|
||||
@@ -167,6 +168,11 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recvData)
|
||||
WorldPacket data;
|
||||
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bgt, queueSlot, STATUS_WAIT_QUEUE, avgWaitTime, 0, 0, TEAM_NEUTRAL);
|
||||
SendPacket(&data);
|
||||
|
||||
//#define sScriptMgr ACE_Singleton<ScriptMgr, ACE_Null_Mutex>::instance()
|
||||
ScriptMgr* sScriptMgr;
|
||||
sScriptMgr->OnPlayerJoinBG(_player, sBattlegroundMgr->GetBattlegroundTemplate(ginfo->BgTypeId));
|
||||
|
||||
}
|
||||
// check if group can queue:
|
||||
else
|
||||
@@ -244,6 +250,9 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recvData)
|
||||
|
||||
sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, err);
|
||||
member->GetSession()->SendPacket(&data);
|
||||
|
||||
ScriptMgr* sScriptMgr;
|
||||
sScriptMgr->OnPlayerJoinBG(member, sBattlegroundMgr->GetBattlegroundTemplate(member->GetBattlegroundTypeId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -652,6 +661,9 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recvData)
|
||||
WorldPacket data;
|
||||
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bgt, queueSlot, STATUS_WAIT_QUEUE, avgWaitTime, 0, arenatype, TEAM_NEUTRAL);
|
||||
SendPacket(&data);
|
||||
|
||||
ScriptMgr* sScriptMgr;
|
||||
sScriptMgr->OnPlayerJoinArena(_player, sBattlegroundMgr->GetBattlegroundTemplate(ginfo->BgTypeId));
|
||||
}
|
||||
// check if group can queue:
|
||||
else
|
||||
@@ -746,6 +758,9 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recvData)
|
||||
|
||||
sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, err);
|
||||
member->GetSession()->SendPacket(&data);
|
||||
|
||||
ScriptMgr* sScriptMgr;
|
||||
sScriptMgr->OnPlayerJoinArena(member, sBattlegroundMgr->GetBattlegroundTemplate(member->GetBattlegroundTypeId()));
|
||||
}
|
||||
|
||||
// pussywizard: schedule update for rated arena
|
||||
|
||||
@@ -1333,6 +1333,22 @@ void ScriptMgr::OnAfterPlayerMoveItemFromInventory(Player* player, Item* it, uin
|
||||
FOREACH_SCRIPT(PlayerScript)->OnAfterMoveItemFromInventory(player, it, bag, slot, update);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnEquip(Player* player, Item* it, uint8 bag, uint8 slot, bool update)
|
||||
{
|
||||
FOREACH_SCRIPT(PlayerScript)->OnEquip(player, it, bag, slot, update);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnPlayerJoinBG(Player* player, Battleground* bg)
|
||||
{
|
||||
FOREACH_SCRIPT(PlayerScript)->OnPlayerJoinBG(player, bg);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnPlayerJoinArena(Player* player, Battleground* bg)
|
||||
{
|
||||
FOREACH_SCRIPT(PlayerScript)->OnPlayerJoinArena(player, bg);
|
||||
}
|
||||
|
||||
|
||||
// Guild
|
||||
void ScriptMgr::OnGuildAddMember(Guild* guild, Player* player, uint8& plRank)
|
||||
{
|
||||
@@ -1421,6 +1437,12 @@ void ScriptMgr::OnGroupDisband(Group* group)
|
||||
FOREACH_SCRIPT(GroupScript)->OnDisband(group);
|
||||
}
|
||||
|
||||
/*void ScriptMgr::OnGroupJoinBG(Group* group, Battleground* bg)
|
||||
{
|
||||
ASSERT(group);
|
||||
FOREACH_SCRIPT(GroupScript)->OnGroupJoinBG(group, bg);
|
||||
}*/
|
||||
|
||||
void ScriptMgr::OnGlobalItemDelFromDB(SQLTransaction& trans, uint32 itemGuid)
|
||||
{
|
||||
ASSERT(trans);
|
||||
|
||||
@@ -790,7 +790,16 @@ class PlayerScript : public ScriptObject
|
||||
virtual void OnAfterSetVisibleItemSlot(Player* /*player*/, uint8 /*slot*/, Item* /*item*/) { }
|
||||
|
||||
// After an item has been moved from inventory
|
||||
virtual void OnAfterMoveItemFromInventory(Player* /*player*/, Item* /*it*/,uint8 /*bag*/, uint8 /*slot*/, bool /*update*/) { }
|
||||
virtual void OnAfterMoveItemFromInventory(Player* /*player*/, Item* /*it*/, uint8 /*bag*/, uint8 /*slot*/, bool /*update*/) { }
|
||||
|
||||
// After an item has been equipped
|
||||
virtual void OnEquip(Player* /*player*/, Item* /*it*/, uint8 /*bag*/, uint8 /*slot*/, bool /*update*/) { }
|
||||
|
||||
// After player enters queue for BG
|
||||
virtual void OnPlayerJoinBG(Player* player, Battleground* bg) { }
|
||||
|
||||
// After player enters queue for Arena
|
||||
virtual void OnPlayerJoinArena(Player* player, Battleground* bg) { }
|
||||
};
|
||||
|
||||
class GuildScript : public ScriptObject
|
||||
@@ -860,6 +869,9 @@ class GroupScript : public ScriptObject
|
||||
|
||||
// Called when a group is disbanded.
|
||||
virtual void OnDisband(Group* /*group*/) { }
|
||||
|
||||
// After group enters queue for BG or Arena
|
||||
//virtual void OnGroupJoinBG(Group* group, Battleground* bg) { }
|
||||
};
|
||||
|
||||
// following hooks can be used anywhere and are not db bounded
|
||||
@@ -1089,6 +1101,9 @@ class ScriptMgr
|
||||
void OnPlayerBeingCharmed(Player* player, Unit* charmer, uint32 oldFactionId, uint32 newFactionId);
|
||||
void OnAfterPlayerSetVisibleItemSlot(Player* player, uint8 slot, Item *item);
|
||||
void OnAfterPlayerMoveItemFromInventory(Player* player, Item* it, uint8 bag, uint8 slot, bool update);
|
||||
void OnEquip(Player* player, Item* it, uint8 bag, uint8 slot, bool update);
|
||||
void OnPlayerJoinBG(Player* player, Battleground* bg);
|
||||
void OnPlayerJoinArena(Player* player, Battleground* bg);
|
||||
|
||||
public: /* GuildScript */
|
||||
|
||||
@@ -1112,6 +1127,7 @@ class ScriptMgr
|
||||
void OnGroupRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, const char* reason);
|
||||
void OnGroupChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid);
|
||||
void OnGroupDisband(Group* group);
|
||||
//void OnGroupJoinBG(Group* group, Battleground* bg);
|
||||
|
||||
public: /* GlobalScript */
|
||||
void OnGlobalItemDelFromDB(SQLTransaction& trans, uint32 itemGuid);
|
||||
|
||||
Reference in New Issue
Block a user