mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-07 04:47:45 +00:00
Updated ScriptMgr with new function to favorite transmog module
This commit is contained in:
@@ -41,6 +41,7 @@ enum DebugLogFilters
|
||||
LOG_FILTER_TRANSPORTS = 0x00400000, // Transport related
|
||||
LOG_FILTER_WARDEN = 0x00800000, // Warden related
|
||||
LOG_FILTER_BATTLEFIELD = 0x01000000, // Battlefield related
|
||||
LOG_FILTER_MODULES = 0x02000000, // Modules debug
|
||||
};
|
||||
|
||||
enum LogTypes
|
||||
|
||||
@@ -465,6 +465,7 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entr
|
||||
/*static*/
|
||||
void Item::DeleteFromDB(SQLTransaction& trans, uint32 itemGuid)
|
||||
{
|
||||
sScriptMgr->OnGlobalItemDelFromDB(trans,itemGuid);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
|
||||
stmt->setUInt32(0, itemGuid);
|
||||
trans->Append(stmt);
|
||||
|
||||
@@ -12682,7 +12682,7 @@ void Player::QuickEquipItem(uint16 pos, Item* pItem)
|
||||
}
|
||||
|
||||
void Player::SetVisibleItemSlot(uint8 slot, Item* pItem)
|
||||
{
|
||||
{
|
||||
if (pItem)
|
||||
{
|
||||
SetUInt32Value(PLAYER_VISIBLE_ITEM_1_ENTRYID + (slot * 2), pItem->GetEntry());
|
||||
@@ -12694,6 +12694,8 @@ void Player::SetVisibleItemSlot(uint8 slot, Item* pItem)
|
||||
SetUInt32Value(PLAYER_VISIBLE_ITEM_1_ENTRYID + (slot * 2), 0);
|
||||
SetUInt32Value(PLAYER_VISIBLE_ITEM_1_ENCHANTMENT + (slot * 2), 0);
|
||||
}
|
||||
|
||||
sScriptMgr->OnAfterPlayerSetVisibleItemSlot(this, slot, pItem);
|
||||
}
|
||||
|
||||
void Player::VisualizeItem(uint8 slot, Item* pItem)
|
||||
|
||||
@@ -251,7 +251,7 @@ void WorldSession::HandleOpenWrappedItemCallback(PreparedQueryResult result, uin
|
||||
if (item->GetGUIDLow() != itemLowGUID || !item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED)) // during getting result, gift was swapped with another item
|
||||
return;
|
||||
|
||||
|
||||
|
||||
if (!result)
|
||||
{
|
||||
sLog->outError("Wrapped item %u don't have record in character_gifts table and will deleted", item->GetGUIDLow());
|
||||
@@ -655,7 +655,13 @@ void WorldSession::HandleMirrorImageDataRequest(WorldPacket & recvData)
|
||||
else if (*itr == EQUIPMENT_SLOT_BACK && player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK))
|
||||
data << uint32(0);
|
||||
else if (Item const* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, *itr))
|
||||
data << uint32(item->GetTemplate()->DisplayInfoID);
|
||||
{
|
||||
uint32 displayInfoId=item->GetTemplate()->DisplayInfoID;
|
||||
|
||||
sScriptMgr->OnGlobalMirrorImageDisplayItem(item,displayInfoId);
|
||||
|
||||
data << uint32(displayInfoId);
|
||||
}
|
||||
else
|
||||
data << uint32(0);
|
||||
}
|
||||
|
||||
@@ -1323,6 +1323,11 @@ void ScriptMgr::OnPlayerBeingCharmed(Player* player, Unit* charmer, uint32 oldFa
|
||||
FOREACH_SCRIPT(PlayerScript)->OnBeingCharmed(player, charmer, oldFactionId, newFactionId);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnAfterPlayerSetVisibleItemSlot(Player* player, uint8 slot, Item *item)
|
||||
{
|
||||
FOREACH_SCRIPT(PlayerScript)->OnAfterSetVisibleItemSlot(player, slot,item);
|
||||
}
|
||||
|
||||
// Guild
|
||||
void ScriptMgr::OnGuildAddMember(Guild* guild, Player* player, uint8& plRank)
|
||||
{
|
||||
@@ -1411,6 +1416,19 @@ void ScriptMgr::OnGroupDisband(Group* group)
|
||||
FOREACH_SCRIPT(GroupScript)->OnDisband(group);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnGlobalItemDelFromDB(SQLTransaction& trans, uint32 itemGuid)
|
||||
{
|
||||
ASSERT(trans);
|
||||
ASSERT(itemGuid);
|
||||
|
||||
FOREACH_SCRIPT(GlobalScript)->OnItemDelFromDB(trans,itemGuid);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnGlobalMirrorImageDisplayItem(const Item *item, uint32 &display)
|
||||
{
|
||||
FOREACH_SCRIPT(GlobalScript)->OnMirrorImageDisplayItem(item,display);
|
||||
}
|
||||
|
||||
SpellScriptLoader::SpellScriptLoader(const char* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
@@ -1555,6 +1573,12 @@ GroupScript::GroupScript(const char* name)
|
||||
ScriptRegistry<GroupScript>::AddScript(this);
|
||||
}
|
||||
|
||||
GlobalScript::GlobalScript(const char* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<GlobalScript>::AddScript(this);
|
||||
}
|
||||
|
||||
// Instantiate static members of ScriptRegistry.
|
||||
template<class TScript> std::map<uint32, TScript*> ScriptRegistry<TScript>::ScriptPointerList;
|
||||
template<class TScript> std::vector<TScript*> ScriptRegistry<TScript>::ALScripts;
|
||||
@@ -1585,6 +1609,7 @@ template class ScriptRegistry<AchievementCriteriaScript>;
|
||||
template class ScriptRegistry<PlayerScript>;
|
||||
template class ScriptRegistry<GuildScript>;
|
||||
template class ScriptRegistry<GroupScript>;
|
||||
template class ScriptRegistry<GlobalScript>;
|
||||
|
||||
// Undefine utility macros.
|
||||
#undef GET_SCRIPT_RET
|
||||
|
||||
@@ -235,7 +235,7 @@ class WorldScript : public ScriptObject
|
||||
|
||||
// Called after the world configuration is (re)loaded.
|
||||
virtual void OnAfterConfigLoad(bool /*reload*/) { }
|
||||
|
||||
|
||||
// Called before the world configuration is (re)loaded.
|
||||
virtual void OnBeforeConfigLoad(bool /*reload*/) { }
|
||||
|
||||
@@ -303,7 +303,7 @@ template<class TMap> class MapScript : public UpdatableScript<TMap>
|
||||
public:
|
||||
void checkMap() {
|
||||
_mapEntry = sMapStore.LookupEntry(_mapId);
|
||||
|
||||
|
||||
if (!_mapEntry)
|
||||
sLog->outError("Invalid MapScript for %u; no such map ID.", _mapId);
|
||||
}
|
||||
@@ -783,8 +783,11 @@ class PlayerScript : public ScriptObject
|
||||
// Called when a player selects an option in a player gossip window
|
||||
virtual void OnGossipSelectCode(Player* /*player*/, uint32 /*menu_id*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/) { }
|
||||
|
||||
// On player getting charmed
|
||||
// On player getting charmed
|
||||
virtual void OnBeingCharmed(Player* /*player*/, Unit* /*charmer*/, uint32 /*oldFactionId*/, uint32 /*newFactionId*/) { }
|
||||
|
||||
// To change behaviour of set visible item slot
|
||||
virtual void OnAfterSetVisibleItemSlot(Player* /*player*/, uint8 /*slot*/, Item* /*item*/) { }
|
||||
};
|
||||
|
||||
class GuildScript : public ScriptObject
|
||||
@@ -856,6 +859,20 @@ class GroupScript : public ScriptObject
|
||||
virtual void OnDisband(Group* /*group*/) { }
|
||||
};
|
||||
|
||||
// following hooks can be used anywhere and are not db bounded
|
||||
class GlobalScript : public ScriptObject
|
||||
{
|
||||
protected:
|
||||
|
||||
GlobalScript(const char* name);
|
||||
|
||||
public:
|
||||
|
||||
// items
|
||||
virtual void OnItemDelFromDB(SQLTransaction& /*trans*/, uint32 /*itemGuid*/) { }
|
||||
virtual void OnMirrorImageDisplayItem(const Item* /*item*/, uint32& /*display*/) { }
|
||||
};
|
||||
|
||||
// Placed here due to ScriptRegistry::AddScript dependency.
|
||||
#define sScriptMgr ACE_Singleton<ScriptMgr, ACE_Null_Mutex>::instance()
|
||||
|
||||
@@ -1067,6 +1084,7 @@ class ScriptMgr
|
||||
void OnGossipSelect(Player* player, uint32 menu_id, uint32 sender, uint32 action);
|
||||
void OnGossipSelectCode(Player* player, uint32 menu_id, uint32 sender, uint32 action, const char* code);
|
||||
void OnPlayerBeingCharmed(Player* player, Unit* charmer, uint32 oldFactionId, uint32 newFactionId);
|
||||
void OnAfterPlayerSetVisibleItemSlot(Player* player, uint8 /*slot*/, Item *item);
|
||||
|
||||
public: /* GuildScript */
|
||||
|
||||
@@ -1091,6 +1109,10 @@ class ScriptMgr
|
||||
void OnGroupChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid);
|
||||
void OnGroupDisband(Group* group);
|
||||
|
||||
public: /* GlobalScript */
|
||||
void OnGlobalItemDelFromDB(SQLTransaction& trans, uint32 itemGuid);
|
||||
void OnGlobalMirrorImageDisplayItem(const Item *item, uint32 &display);
|
||||
|
||||
public: /* Scheduled scripts */
|
||||
|
||||
uint32 IncreaseScheduledScriptsCount() { return ++_scheduledScripts; }
|
||||
@@ -1147,7 +1169,7 @@ class ScriptRegistry
|
||||
static void AddALScripts() {
|
||||
for(ScriptVectorIterator it = ALScripts.begin(); it != ALScripts.end(); ++it) {
|
||||
TScript* const script = *it;
|
||||
|
||||
|
||||
script->checkValidity();
|
||||
|
||||
if (script->IsDatabaseBound()) {
|
||||
|
||||
Reference in New Issue
Block a user