Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2023-06-18 20:48:30 +08:00
23 changed files with 238 additions and 137 deletions

View File

@@ -718,6 +718,27 @@ void WorldSession::SendAreaTriggerMessage(const char* Text, ...)
SendPacket(&data);
}
void WorldSession::SendAreaTriggerMessage(uint32 entry, ...)
{
char const* format = GetAcoreString(entry);
if (format)
{
va_list ap;
char szStr[1024];
szStr[0] = '\0';
va_start(ap, entry);
vsnprintf(szStr, 1024, format, ap);
va_end(ap);
uint32 length = strlen(szStr) + 1;
WorldPacket data(SMSG_AREA_TRIGGER_MESSAGE, 4 + length);
data << length;
data << szStr;
SendPacket(&data);
}
}
void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
{
uint32 triggerId;

View File

@@ -679,6 +679,8 @@ QuestItemList* Loot::FillQuestLoot(Player* player)
{
LootItem& item = quest_items[i];
sScriptMgr->OnBeforeFillQuestLootItem(player, item);
// Quest item is not free for all and is already assigned to another player
// or player doesn't need it
if (item.is_blocked || !item.AllowedForPlayer(player, sourceWorldObjectGUID))

View File

@@ -590,6 +590,14 @@ void ScriptMgr::OnLootItem(Player* player, Item* item, uint32 count, ObjectGuid
});
}
void ScriptMgr::OnBeforeFillQuestLootItem(Player* player, LootItem& item)
{
ExecuteScript<PlayerScript>([&](PlayerScript* script)
{
script->OnBeforeFillQuestLootItem(player, item);
});
}
void ScriptMgr::OnStoreNewItem(Player* player, Item* item, uint32 count)
{
ExecuteScript<PlayerScript>([&](PlayerScript* script)

View File

@@ -1183,6 +1183,9 @@ public:
//After looting item
virtual void OnLootItem(Player* /*player*/, Item* /*item*/, uint32 /*count*/, ObjectGuid /*lootguid*/) { }
//Before looting item
virtual void OnBeforeFillQuestLootItem(Player* /*player*/, LootItem& /*item*/) { }
//After looting item (includes master loot).
virtual void OnStoreNewItem(Player* /*player*/, Item* /*item*/, uint32 /*count*/) { }
@@ -2331,6 +2334,7 @@ public: /* PlayerScript */
void GetCustomArenaPersonalRating(Player const* player, uint8 slot, uint32& rating) const;
void OnGetMaxPersonalArenaRatingRequirement(Player const* player, uint32 minSlot, uint32& maxArenaRating) const;
void OnLootItem(Player* player, Item* item, uint32 count, ObjectGuid lootguid);
void OnBeforeFillQuestLootItem(Player* player, LootItem& item);
void OnStoreNewItem(Player* player, Item* item, uint32 count);
void OnCreateItem(Player* player, Item* item, uint32 count);
void OnQuestRewardItem(Player* player, Item* item, uint32 count);

View File

@@ -369,6 +369,7 @@ public:
void SendPetNameInvalid(uint32 error, std::string const& name, DeclinedName* declinedName);
void SendPartyResult(PartyOperation operation, std::string const& member, PartyResult res, uint32 val = 0);
void SendAreaTriggerMessage(const char* Text, ...) ATTR_PRINTF(2, 3);
void SendAreaTriggerMessage(uint32 entry, ...);
void SendSetPhaseShift(uint32 phaseShift);
void SendQueryTimeResponse();