feat(Scripting/Hooks): Implement OnQuestComputeXP() hook
This commit is contained in:
@@ -737,6 +737,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
|
|||||||
for (Unit::AuraEffectList::const_iterator i = ModXPPctAuras.begin(); i != ModXPPctAuras.end(); ++i)
|
for (Unit::AuraEffectList::const_iterator i = ModXPPctAuras.begin(); i != ModXPPctAuras.end(); ++i)
|
||||||
AddPct(XP, (*i)->GetAmount());
|
AddPct(XP, (*i)->GetAmount());
|
||||||
|
|
||||||
|
sScriptMgr->OnQuestComputeXP(this, quest, XP);
|
||||||
int32 moneyRew = 0;
|
int32 moneyRew = 0;
|
||||||
if (getLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || sScriptMgr->ShouldBeRewardedWithMoneyInsteadOfExp(this))
|
if (getLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || sScriptMgr->ShouldBeRewardedWithMoneyInsteadOfExp(this))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -729,6 +729,13 @@ bool ScriptMgr::OnBeforePlayerQuestComplete(Player* player, uint32 quest_id)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
void ScriptMgr::OnQuestComputeXP(Player* player, Quest const* quest, uint32& xpValue)
|
||||||
|
{
|
||||||
|
ExecuteScript<PlayerScript>([&](PlayerScript* script)
|
||||||
|
{
|
||||||
|
script->OnQuestComputeXP(player, quest, xpValue);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void ScriptMgr::OnBeforeStoreOrEquipNewItem(Player* player, uint32 vendorslot, uint32& item, uint8 count, uint8 bag, uint8 slot, ItemTemplate const* pProto, Creature* pVendor, VendorItem const* crItem, bool bStore)
|
void ScriptMgr::OnBeforeStoreOrEquipNewItem(Player* player, uint32 vendorslot, uint32& item, uint8 count, uint8 bag, uint8 slot, ItemTemplate const* pProto, Creature* pVendor, VendorItem const* crItem, bool bStore)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1157,6 +1157,9 @@ public:
|
|||||||
// After completed a quest
|
// After completed a quest
|
||||||
[[nodiscard]] virtual bool OnBeforeQuestComplete(Player* /*player*/, uint32 /*quest_id*/) { return true; }
|
[[nodiscard]] virtual bool OnBeforeQuestComplete(Player* /*player*/, uint32 /*quest_id*/) { return true; }
|
||||||
|
|
||||||
|
// Called after computing the XP reward value for a quest
|
||||||
|
virtual void OnQuestComputeXP(Player* /*player*/, Quest const* /*quest*/, uint32& /*xpValue*/) { }
|
||||||
|
|
||||||
// Before durability repair action, you can even modify the discount value
|
// Before durability repair action, you can even modify the discount value
|
||||||
virtual void OnBeforeDurabilityRepair(Player* /*player*/, ObjectGuid /*npcGUID*/, ObjectGuid /*itemGUID*/, float&/*discountMod*/, uint8 /*guildBank*/) { }
|
virtual void OnBeforeDurabilityRepair(Player* /*player*/, ObjectGuid /*npcGUID*/, ObjectGuid /*itemGUID*/, float&/*discountMod*/, uint8 /*guildBank*/) { }
|
||||||
|
|
||||||
@@ -2223,6 +2226,7 @@ public: /* PlayerScript */
|
|||||||
void OnCreateItem(Player* player, Item* item, uint32 count);
|
void OnCreateItem(Player* player, Item* item, uint32 count);
|
||||||
void OnQuestRewardItem(Player* player, Item* item, uint32 count);
|
void OnQuestRewardItem(Player* player, Item* item, uint32 count);
|
||||||
bool OnBeforePlayerQuestComplete(Player* player, uint32 quest_id);
|
bool OnBeforePlayerQuestComplete(Player* player, uint32 quest_id);
|
||||||
|
void OnQuestComputeXP(Player* player, Quest const* quest, uint32& xpValue);
|
||||||
void OnBeforePlayerDurabilityRepair(Player* player, ObjectGuid npcGUID, ObjectGuid itemGUID, float& discountMod, uint8 guildBank);
|
void OnBeforePlayerDurabilityRepair(Player* player, ObjectGuid npcGUID, ObjectGuid itemGUID, float& discountMod, uint8 guildBank);
|
||||||
void OnBeforeBuyItemFromVendor(Player* player, ObjectGuid vendorguid, uint32 vendorslot, uint32& item, uint8 count, uint8 bag, uint8 slot);
|
void OnBeforeBuyItemFromVendor(Player* player, ObjectGuid vendorguid, uint32 vendorslot, uint32& item, uint8 count, uint8 bag, uint8 slot);
|
||||||
void OnBeforeStoreOrEquipNewItem(Player* player, uint32 vendorslot, uint32& item, uint8 count, uint8 bag, uint8 slot, ItemTemplate const* pProto, Creature* pVendor, VendorItem const* crItem, bool bStore);
|
void OnBeforeStoreOrEquipNewItem(Player* player, uint32 vendorslot, uint32& item, uint8 count, uint8 bag, uint8 slot, ItemTemplate const* pProto, Creature* pVendor, VendorItem const* crItem, bool bStore);
|
||||||
|
|||||||
Reference in New Issue
Block a user