Merge branch 'master' into Playerbot
This commit is contained in:
@@ -1000,11 +1000,11 @@ void ScriptMgr::PetitionShowList(Player* player, Creature* creature, uint32& Cha
|
||||
});
|
||||
}
|
||||
|
||||
void ScriptMgr::OnRewardKillRewarder(Player* player, bool isDungeon, float& rate)
|
||||
void ScriptMgr::OnRewardKillRewarder(Player* player, KillRewarder* rewarder, bool isDungeon, float& rate)
|
||||
{
|
||||
ExecuteScript<PlayerScript>([&](PlayerScript* script)
|
||||
{
|
||||
script->OnRewardKillRewarder(player, isDungeon, rate);
|
||||
script->OnRewardKillRewarder(player, rewarder, isDungeon, rate);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1046,6 +1046,19 @@ bool ScriptMgr::CanRepopAtGraveyard(Player* player)
|
||||
return true;
|
||||
}
|
||||
|
||||
Optional<bool> ScriptMgr::OnPlayerIsClass(Player const* player, Classes unitClass, ClassContext context)
|
||||
{
|
||||
if (ScriptRegistry<PlayerScript>::ScriptPointerList.empty())
|
||||
return {};
|
||||
for (auto const& [scriptID, script] : ScriptRegistry<PlayerScript>::ScriptPointerList)
|
||||
{
|
||||
Optional<bool> scriptResult = script->OnPlayerIsClass(player, unitClass, context);
|
||||
if (scriptResult)
|
||||
return scriptResult;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
void ScriptMgr::OnGetMaxSkillValue(Player* player, uint32 skill, int32& result, bool IsPure)
|
||||
{
|
||||
ExecuteScript<PlayerScript>([&](PlayerScript* script)
|
||||
@@ -1054,6 +1067,21 @@ void ScriptMgr::OnGetMaxSkillValue(Player* player, uint32 skill, int32& result,
|
||||
});
|
||||
}
|
||||
|
||||
bool ScriptMgr::OnPlayerHasActivePowerType(Player const* player, Powers power)
|
||||
{
|
||||
auto ret = IsValidBoolScript<PlayerScript>([&](PlayerScript* script)
|
||||
{
|
||||
return script->OnPlayerHasActivePowerType(player, power);
|
||||
});
|
||||
|
||||
if (ret && *ret)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void ScriptMgr::OnUpdateGatheringSkill(Player *player, uint32 skillId, uint32 currentLevel, uint32 gray, uint32 green, uint32 yellow, uint32 &gain) {
|
||||
ExecuteScript<PlayerScript>([&](PlayerScript* script)
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
// TODO to remove
|
||||
#include "AchievementMgr.h"
|
||||
#include "KillRewarder.h"
|
||||
|
||||
class PlayerScript : public ScriptObject
|
||||
{
|
||||
@@ -315,7 +316,7 @@ public:
|
||||
|
||||
virtual void PetitionShowList(Player* /*player*/, Creature* /*creature*/, uint32& /*CharterEntry*/, uint32& /*CharterDispayID*/, uint32& /*CharterCost*/) { }
|
||||
|
||||
virtual void OnRewardKillRewarder(Player* /*player*/, bool /*isDungeon*/, float& /*rate*/) { }
|
||||
virtual void OnRewardKillRewarder(Player* /*player*/, KillRewarder* /*rewarder*/, bool /*isDungeon*/, float& /*rate*/) { }
|
||||
|
||||
[[nodiscard]] virtual bool CanGiveMailRewardAtGiveLevel(Player* /*player*/, uint8 /*level*/) { return true; }
|
||||
|
||||
@@ -323,8 +324,12 @@ public:
|
||||
|
||||
[[nodiscard]] virtual bool CanRepopAtGraveyard(Player* /*player*/) { return true; }
|
||||
|
||||
[[nodiscard]] virtual Optional<bool> OnPlayerIsClass(Player const* /*player*/, Classes /*playerClass*/, ClassContext /*context*/) { return std::nullopt; }
|
||||
|
||||
virtual void OnGetMaxSkillValue(Player* /*player*/, uint32 /*skill*/, int32& /*result*/, bool /*IsPure*/) { }
|
||||
|
||||
[[nodiscard]] virtual bool OnPlayerHasActivePowerType(Player const* /*player*/, Powers /*power*/) { return false; }
|
||||
|
||||
/**
|
||||
* @brief This hook called before gathering skill gain is applied to the character.
|
||||
*
|
||||
|
||||
@@ -430,11 +430,13 @@ public: /* PlayerScript */
|
||||
bool CanSendMail(Player* player, ObjectGuid receiverGuid, ObjectGuid mailbox, std::string& subject, std::string& body, uint32 money, uint32 COD, Item* item);
|
||||
void PetitionBuy(Player* player, Creature* creature, uint32& charterid, uint32& cost, uint32& type);
|
||||
void PetitionShowList(Player* player, Creature* creature, uint32& CharterEntry, uint32& CharterDispayID, uint32& CharterCost);
|
||||
void OnRewardKillRewarder(Player* player, bool isDungeon, float& rate);
|
||||
void OnRewardKillRewarder(Player* player, KillRewarder* rewarder, bool isDungeon, float& rate);
|
||||
bool CanGiveMailRewardAtGiveLevel(Player* player, uint8 level);
|
||||
void OnDeleteFromDB(CharacterDatabaseTransaction trans, uint32 guid);
|
||||
bool CanRepopAtGraveyard(Player* player);
|
||||
std::optional<bool> OnPlayerIsClass(Player const* player, Classes playerClass, ClassContext context);
|
||||
void OnGetMaxSkillValue(Player* player, uint32 skill, int32& result, bool IsPure);
|
||||
bool OnPlayerHasActivePowerType(Player const* player, Powers power);
|
||||
void OnUpdateGatheringSkill(Player* player, uint32 skillId, uint32 currentLevel, uint32 gray, uint32 green, uint32 yellow, uint32& gain);
|
||||
void OnUpdateCraftingSkill(Player* player, SkillLineAbilityEntry const* skill, uint32 currentLevel, uint32& gain);
|
||||
bool OnUpdateFishingSkill(Player* player, int32 skill, int32 zone_skill, int32 chance, int32 roll);
|
||||
|
||||
@@ -79,6 +79,7 @@ class WorldSocket;
|
||||
enum ArenaTeamInfoType : uint8;
|
||||
enum AuraRemoveMode : uint8;
|
||||
enum BattlegroundDesertionType : uint8;
|
||||
enum ClassContext : uint8;
|
||||
enum ContentLevels : uint8;
|
||||
enum DamageEffectType : uint8;
|
||||
enum EnchantmentSlot : uint8;
|
||||
|
||||
Reference in New Issue
Block a user