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_TRANSPORTS = 0x00400000, // Transport related
|
||||||
LOG_FILTER_WARDEN = 0x00800000, // Warden related
|
LOG_FILTER_WARDEN = 0x00800000, // Warden related
|
||||||
LOG_FILTER_BATTLEFIELD = 0x01000000, // Battlefield related
|
LOG_FILTER_BATTLEFIELD = 0x01000000, // Battlefield related
|
||||||
|
LOG_FILTER_MODULES = 0x02000000, // Modules debug
|
||||||
};
|
};
|
||||||
|
|
||||||
enum LogTypes
|
enum LogTypes
|
||||||
|
|||||||
@@ -465,6 +465,7 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entr
|
|||||||
/*static*/
|
/*static*/
|
||||||
void Item::DeleteFromDB(SQLTransaction& trans, uint32 itemGuid)
|
void Item::DeleteFromDB(SQLTransaction& trans, uint32 itemGuid)
|
||||||
{
|
{
|
||||||
|
sScriptMgr->OnGlobalItemDelFromDB(trans,itemGuid);
|
||||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
|
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
|
||||||
stmt->setUInt32(0, itemGuid);
|
stmt->setUInt32(0, itemGuid);
|
||||||
trans->Append(stmt);
|
trans->Append(stmt);
|
||||||
|
|||||||
@@ -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_ENTRYID + (slot * 2), 0);
|
||||||
SetUInt32Value(PLAYER_VISIBLE_ITEM_1_ENCHANTMENT + (slot * 2), 0);
|
SetUInt32Value(PLAYER_VISIBLE_ITEM_1_ENCHANTMENT + (slot * 2), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sScriptMgr->OnAfterPlayerSetVisibleItemSlot(this, slot, pItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::VisualizeItem(uint8 slot, Item* pItem)
|
void Player::VisualizeItem(uint8 slot, Item* pItem)
|
||||||
|
|||||||
@@ -655,7 +655,13 @@ void WorldSession::HandleMirrorImageDataRequest(WorldPacket & recvData)
|
|||||||
else if (*itr == EQUIPMENT_SLOT_BACK && player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK))
|
else if (*itr == EQUIPMENT_SLOT_BACK && player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK))
|
||||||
data << uint32(0);
|
data << uint32(0);
|
||||||
else if (Item const* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, *itr))
|
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
|
else
|
||||||
data << uint32(0);
|
data << uint32(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1323,6 +1323,11 @@ void ScriptMgr::OnPlayerBeingCharmed(Player* player, Unit* charmer, uint32 oldFa
|
|||||||
FOREACH_SCRIPT(PlayerScript)->OnBeingCharmed(player, charmer, oldFactionId, newFactionId);
|
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
|
// Guild
|
||||||
void ScriptMgr::OnGuildAddMember(Guild* guild, Player* player, uint8& plRank)
|
void ScriptMgr::OnGuildAddMember(Guild* guild, Player* player, uint8& plRank)
|
||||||
{
|
{
|
||||||
@@ -1411,6 +1416,19 @@ void ScriptMgr::OnGroupDisband(Group* group)
|
|||||||
FOREACH_SCRIPT(GroupScript)->OnDisband(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)
|
SpellScriptLoader::SpellScriptLoader(const char* name)
|
||||||
: ScriptObject(name)
|
: ScriptObject(name)
|
||||||
{
|
{
|
||||||
@@ -1555,6 +1573,12 @@ GroupScript::GroupScript(const char* name)
|
|||||||
ScriptRegistry<GroupScript>::AddScript(this);
|
ScriptRegistry<GroupScript>::AddScript(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GlobalScript::GlobalScript(const char* name)
|
||||||
|
: ScriptObject(name)
|
||||||
|
{
|
||||||
|
ScriptRegistry<GlobalScript>::AddScript(this);
|
||||||
|
}
|
||||||
|
|
||||||
// Instantiate static members of ScriptRegistry.
|
// Instantiate static members of ScriptRegistry.
|
||||||
template<class TScript> std::map<uint32, TScript*> ScriptRegistry<TScript>::ScriptPointerList;
|
template<class TScript> std::map<uint32, TScript*> ScriptRegistry<TScript>::ScriptPointerList;
|
||||||
template<class TScript> std::vector<TScript*> ScriptRegistry<TScript>::ALScripts;
|
template<class TScript> std::vector<TScript*> ScriptRegistry<TScript>::ALScripts;
|
||||||
@@ -1585,6 +1609,7 @@ template class ScriptRegistry<AchievementCriteriaScript>;
|
|||||||
template class ScriptRegistry<PlayerScript>;
|
template class ScriptRegistry<PlayerScript>;
|
||||||
template class ScriptRegistry<GuildScript>;
|
template class ScriptRegistry<GuildScript>;
|
||||||
template class ScriptRegistry<GroupScript>;
|
template class ScriptRegistry<GroupScript>;
|
||||||
|
template class ScriptRegistry<GlobalScript>;
|
||||||
|
|
||||||
// Undefine utility macros.
|
// Undefine utility macros.
|
||||||
#undef GET_SCRIPT_RET
|
#undef GET_SCRIPT_RET
|
||||||
|
|||||||
@@ -785,6 +785,9 @@ class PlayerScript : public ScriptObject
|
|||||||
|
|
||||||
// On player getting charmed
|
// On player getting charmed
|
||||||
virtual void OnBeingCharmed(Player* /*player*/, Unit* /*charmer*/, uint32 /*oldFactionId*/, uint32 /*newFactionId*/) { }
|
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
|
class GuildScript : public ScriptObject
|
||||||
@@ -856,6 +859,20 @@ class GroupScript : public ScriptObject
|
|||||||
virtual void OnDisband(Group* /*group*/) { }
|
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.
|
// Placed here due to ScriptRegistry::AddScript dependency.
|
||||||
#define sScriptMgr ACE_Singleton<ScriptMgr, ACE_Null_Mutex>::instance()
|
#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 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 OnGossipSelectCode(Player* player, uint32 menu_id, uint32 sender, uint32 action, const char* code);
|
||||||
void OnPlayerBeingCharmed(Player* player, Unit* charmer, uint32 oldFactionId, uint32 newFactionId);
|
void OnPlayerBeingCharmed(Player* player, Unit* charmer, uint32 oldFactionId, uint32 newFactionId);
|
||||||
|
void OnAfterPlayerSetVisibleItemSlot(Player* player, uint8 /*slot*/, Item *item);
|
||||||
|
|
||||||
public: /* GuildScript */
|
public: /* GuildScript */
|
||||||
|
|
||||||
@@ -1091,6 +1109,10 @@ class ScriptMgr
|
|||||||
void OnGroupChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid);
|
void OnGroupChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid);
|
||||||
void OnGroupDisband(Group* group);
|
void OnGroupDisband(Group* group);
|
||||||
|
|
||||||
|
public: /* GlobalScript */
|
||||||
|
void OnGlobalItemDelFromDB(SQLTransaction& trans, uint32 itemGuid);
|
||||||
|
void OnGlobalMirrorImageDisplayItem(const Item *item, uint32 &display);
|
||||||
|
|
||||||
public: /* Scheduled scripts */
|
public: /* Scheduled scripts */
|
||||||
|
|
||||||
uint32 IncreaseScheduledScriptsCount() { return ++_scheduledScripts; }
|
uint32 IncreaseScheduledScriptsCount() { return ++_scheduledScripts; }
|
||||||
|
|||||||
Reference in New Issue
Block a user