fix(Core/PlayerScript) Align player script function names (#21020)

Co-authored-by: sudlud <sudlud@users.noreply.github.com>
This commit is contained in:
Exitare
2025-02-16 05:59:41 -08:00
committed by GitHub
parent df7c23d763
commit 98ceb1c067
45 changed files with 749 additions and 749 deletions

View File

@@ -167,7 +167,7 @@ void KillRewarder::_RewardXP(Player* player, float rate)
AddPct(xp, (*i)->GetAmount());
// 4.2.3. Give XP to player.
sScriptMgr->OnGivePlayerXP(player, xp, _victim, PlayerXPSource::XPSOURCE_KILL);
sScriptMgr->OnPlayerGiveXP(player, xp, _victim, PlayerXPSource::XPSOURCE_KILL);
player->GiveXP(xp, _victim, _groupRate);
if (Pet* pet = player->GetPet())
// 4.2.4. If player has pet, reward pet with XP (100% for single player, 50% for group case).
@@ -210,7 +210,7 @@ void KillRewarder::_RewardPlayer(Player* player, bool isDungeon)
if (!_isPvP || _isBattleGround)
{
float xpRate = _group ? _groupRate * float(player->GetLevel()) / _aliveSumLevel : /*Personal rate is 100%.*/ 1.0f; // Group rate depends on the sum of levels.
sScriptMgr->OnRewardKillRewarder(player, this, isDungeon, xpRate); // Personal rate is 100%.
sScriptMgr->OnPlayerRewardKillRewarder(player, this, isDungeon, xpRate); // Personal rate is 100%.
if (_xp)
{

View File

@@ -1430,7 +1430,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
if (duel && GetMapId() != mapid && GetMap()->GetGameObject(GetGuidValue(PLAYER_DUEL_ARBITER)))
DuelComplete(DUEL_FLED);
if (!sScriptMgr->OnBeforePlayerTeleport(this, mapid, x, y, z, orientation, options, target))
if (!sScriptMgr->OnPlayerBeforeTeleport(this, mapid, x, y, z, orientation, options, target))
return false;
if (GetMapId() == mapid && !newInstance)
@@ -2247,7 +2247,7 @@ void Player::SetGameMaster(bool on)
if (HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
{
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
sScriptMgr->OnFfaPvpStateUpdate(this, false);
sScriptMgr->OnPlayerFfaPvpStateUpdate(this, false);
}
ResetContestedPvP();
@@ -2284,7 +2284,7 @@ void Player::SetGameMaster(bool on)
if (!HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
{
SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
sScriptMgr->OnFfaPvpStateUpdate(this, true);
sScriptMgr->OnPlayerFfaPvpStateUpdate(this, true);
}
}
// restore FFA PvP area state, remove not allowed for GM mounts
@@ -2548,7 +2548,7 @@ void Player::GiveLevel(uint8 level)
pet->SynchronizeLevelWithOwner();
MailLevelReward const* mailReward = sObjectMgr->GetMailLevelReward(level, getRaceMask());
if (mailReward && sScriptMgr->CanGiveMailRewardAtGiveLevel(this, level))
if (mailReward && sScriptMgr->OnPlayerCanGiveMailRewardAtGiveLevel(this, level))
{
//- TODO: Poor design of mail system
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
@@ -2606,7 +2606,7 @@ void Player::InitStatsForLevel(bool reapplyMods)
sObjectMgr->GetPlayerLevelInfo(getRace(true), getClass(), GetLevel(), &info);
uint32 maxPlayerLevel = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL);
sScriptMgr->OnSetMaxLevel(this, maxPlayerLevel);
sScriptMgr->OnPlayerSetMaxLevel(this, maxPlayerLevel);
SetUInt32Value(PLAYER_FIELD_MAX_LEVEL, maxPlayerLevel);
SetUInt32Value(PLAYER_NEXT_LEVEL_XP, sObjectMgr->GetXPForLevel(GetLevel()));
@@ -2738,7 +2738,7 @@ void Player::InitStatsForLevel(bool reapplyMods)
if (HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
{
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP | UNIT_BYTE2_FLAG_SANCTUARY);
sScriptMgr->OnFfaPvpStateUpdate(this, false);
sScriptMgr->OnPlayerFfaPvpStateUpdate(this, false);
}
// restore if need some important flags
@@ -4302,7 +4302,7 @@ void Player::DeleteFromDB(ObjectGuid::LowType lowGuid, uint32 accountId, bool up
Corpse::DeleteFromDB(playerGuid, trans);
sScriptMgr->OnDeleteFromDB(trans, lowGuid);
sScriptMgr->OnPlayerDeleteFromDB(trans, lowGuid);
CharacterDatabase.CommitTransaction(trans);
break;
@@ -4493,7 +4493,7 @@ void Player::BuildPlayerRepop()
void Player::ResurrectPlayer(float restore_percent, bool applySickness)
{
if (!sScriptMgr->CanPlayerResurrect(this))
if (!sScriptMgr->OnPlayerCanResurrect(this))
return;
WorldPacket data(SMSG_DEATH_RELEASE_LOC, 4 * 4); // remove spirit healer position
@@ -4946,7 +4946,7 @@ void Player::RepopAtGraveyard()
AreaTableEntry const* zone = sAreaTableStore.LookupEntry(GetAreaId());
if (!sScriptMgr->CanRepopAtGraveyard(this))
if (!sScriptMgr->OnPlayerCanRepopAtGraveyard(this))
return;
// Such zones are considered unreachable as a ghost and the player must be automatically revived
@@ -5499,7 +5499,7 @@ uint16 Player::GetMaxSkillValue(uint32 skill) const
uint32 bonus = GetUInt32Value(PLAYER_SKILL_BONUS_INDEX(itr->second.pos));
int32 result = int32(SKILL_MAX(GetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos))));
sScriptMgr->OnGetMaxSkillValue(const_cast<Player*>(this), skill, result, false);
sScriptMgr->OnPlayerGetMaxSkillValue(const_cast<Player*>(this), skill, result, false);
result += SKILL_TEMP_BONUS(bonus);
result += SKILL_PERM_BONUS(bonus);
return result < 0 ? 0 : result;
@@ -5516,7 +5516,7 @@ uint16 Player::GetPureMaxSkillValue(uint32 skill) const
int32 result = int32(SKILL_MAX(GetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos))));
sScriptMgr->OnGetMaxSkillValue(const_cast<Player*>(this), skill, result, true);
sScriptMgr->OnPlayerGetMaxSkillValue(const_cast<Player*>(this), skill, result, true);
return result < 0 ? 0 : result;
}
@@ -5795,7 +5795,7 @@ void Player::CheckAreaExploreAndOutdoor()
}
}
if (!sScriptMgr->CanAreaExploreAndOutdoor(this))
if (!sScriptMgr->OnPlayerCanAreaExploreAndOutdoor(this))
return;
if (!areaId)
@@ -5854,7 +5854,7 @@ void Player::CheckAreaExploreAndOutdoor()
XP = uint32(sObjectMgr->GetBaseXP(areaEntry->area_level) * sWorld->getRate(RATE_XP_EXPLORE));
}
sScriptMgr->OnGivePlayerXP(this, XP, nullptr, PlayerXPSource::XPSOURCE_EXPLORE);
sScriptMgr->OnPlayerGiveXP(this, XP, nullptr, PlayerXPSource::XPSOURCE_EXPLORE);
GiveXP(XP, nullptr);
SendExplorationExperience(areaId, XP);
}
@@ -6165,7 +6165,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool awar
// [39+] Nothing
uint32 victim_title = victim->GetUInt32Value(PLAYER_CHOSEN_TITLE);
uint32 killer_title = 0;
sScriptMgr->OnVictimRewardBefore(this, victim, killer_title, victim_title);
sScriptMgr->OnPlayerVictimRewardBefore(this, victim, killer_title, victim_title);
// Get Killer titles, CharTitlesEntry::bit_index
// Ranks:
// title[1..14] -> rank[5..18]
@@ -6192,7 +6192,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool awar
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA, GetAreaId());
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL, 1, 0, victim);
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL, 1, 0, victim);
sScriptMgr->OnVictimRewardAfter(this, victim, killer_title, victim_rank, honor_f);
sScriptMgr->OnPlayerVictimRewardAfter(this, victim, killer_title, victim_rank, honor_f);
}
else
{
@@ -6244,7 +6244,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool awar
if (!uVictim)
{
uint32 xp = uint32(honor * (3 + GetLevel() * 0.30f));
sScriptMgr->OnGivePlayerXP(this, xp, nullptr, PlayerXPSource::XPSOURCE_BATTLEGROUND);
sScriptMgr->OnPlayerGiveXP(this, xp, nullptr, PlayerXPSource::XPSOURCE_BATTLEGROUND);
GiveXP(xp, nullptr);
}
}
@@ -6638,7 +6638,7 @@ void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply
uint32 ssd_level = GetLevel();
uint32 CustomScalingStatValue = 0;
sScriptMgr->OnCustomScalingStatValueBefore(this, proto, slot, apply, CustomScalingStatValue);
sScriptMgr->OnPlayerCustomScalingStatValueBefore(this, proto, slot, apply, CustomScalingStatValue);
uint32 ScalingStatValue = proto->ScalingStatValue > 0 ? proto->ScalingStatValue : CustomScalingStatValue;
@@ -6670,7 +6670,7 @@ void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply
continue;
// OnCustomScalingStatValue(Player* player, ItemTemplate const* proto, uint32& statType, int32& val, uint8 itemProtoStatNumber, uint32 ScalingStatValue, ScalingStatValuesEntry const* ssv)
sScriptMgr->OnCustomScalingStatValue(this, proto, statType, val, i, ScalingStatValue, ssv);
sScriptMgr->OnPlayerCustomScalingStatValue(this, proto, statType, val, i, ScalingStatValue, ssv);
}
}
else
@@ -6681,7 +6681,7 @@ void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply
statType = proto->ItemStat[i].ItemStatType;
val = proto->ItemStat[i].ItemStatValue;
sScriptMgr->OnApplyItemModsBefore(this, slot, apply, i, statType, val);
sScriptMgr->OnPlayerApplyItemModsBefore(this, slot, apply, i, statType, val);
}
if (val == 0)
@@ -6872,7 +6872,7 @@ void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply
}
// Add armor bonus from ArmorDamageModifier if > 0
if (proto->ArmorDamageModifier > 0 && sScriptMgr->CanArmorDamageModifier(this))
if (proto->ArmorDamageModifier > 0 && sScriptMgr->OnPlayerCanArmorDamageModifier(this))
HandleStatModifier(UNIT_MOD_ARMOR, TOTAL_VALUE, float(proto->ArmorDamageModifier), apply);
if (proto->Block)
@@ -6914,7 +6914,7 @@ void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply
}
feral_bonus += proto->getFeralBonus(dpsMod);
sScriptMgr->OnGetFeralApBonus(this, feral_bonus, dpsMod, proto, ssv);
sScriptMgr->OnPlayerGetFeralApBonus(this, feral_bonus, dpsMod, proto, ssv);
if (feral_bonus)
ApplyFeralAPBonus(feral_bonus, apply);
}
@@ -6924,7 +6924,7 @@ void Player::_ApplyWeaponDamage(uint8 slot, ItemTemplate const* proto, ScalingSt
{
uint32 CustomScalingStatValue = 0;
sScriptMgr->OnCustomScalingStatValueBefore(this, proto, slot, apply, CustomScalingStatValue);
sScriptMgr->OnPlayerCustomScalingStatValueBefore(this, proto, slot, apply, CustomScalingStatValue);
uint32 ScalingStatValue = proto->ScalingStatValue > 0 ? proto->ScalingStatValue : CustomScalingStatValue;
@@ -6970,7 +6970,7 @@ void Player::_ApplyWeaponDamage(uint8 slot, ItemTemplate const* proto, ScalingSt
if (apply)
{
sScriptMgr->OnApplyWeaponDamage(this, slot, proto, minDamage, maxDamage, i);
sScriptMgr->OnPlayerApplyWeaponDamage(this, slot, proto, minDamage, maxDamage, i);
if (minDamage > 0.f)
{
@@ -7052,7 +7052,7 @@ void Player::_ApplyWeaponDependentAuraCritMod(Item* item, WeaponAttackType attac
if (aura->GetSpellInfo()->EquippedItemClass == -1)
return;
if (!sScriptMgr->CanApplyWeaponDependentAuraDamageMod(this, item, attackType, aura, apply))
if (!sScriptMgr->OnPlayerCanApplyWeaponDependentAuraDamageMod(this, item, attackType, aura, apply))
return;
BaseModGroup mod = BASEMOD_END;
@@ -7186,7 +7186,7 @@ void Player::ApplyEquipSpell(SpellInfo const* spellInfo, Item* item, bool apply,
{
if (apply)
{
if (!sScriptMgr->CanApplyEquipSpell(this, spellInfo, item, apply, form_change))
if (!sScriptMgr->OnPlayerCanApplyEquipSpell(this, spellInfo, item, apply, form_change))
return;
// Cannot be used in this stance/form
@@ -7282,7 +7282,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32
void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 procVictim, uint32 procEx, Item* item, ItemTemplate const* proto)
{
if (!sScriptMgr->CanCastItemCombatSpell(this, target, attType, procVictim, procEx, item, proto))
if (!sScriptMgr->OnPlayerCanCastItemCombatSpell(this, target, attType, procVictim, procEx, item, proto))
return;
// Can do effect if any damage done to target
@@ -7414,7 +7414,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32
void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8 cast_count, uint32 glyphIndex)
{
if (!sScriptMgr->CanCastItemUseSpell(this, item, targets, cast_count, glyphIndex))
if (!sScriptMgr->OnPlayerCanCastItemUseSpell(this, item, targets, cast_count, glyphIndex))
return;
ItemTemplate const* proto = item->GetTemplate();
@@ -7679,7 +7679,7 @@ void Player::_ApplyAmmoBonuses()
else
currentAmmoDPS = (ammo_proto->Damage[0].DamageMin + ammo_proto->Damage[0].DamageMax) / 2;
sScriptMgr->OnApplyAmmoBonuses(this, ammo_proto, currentAmmoDPS);
sScriptMgr->OnPlayerApplyAmmoBonuses(this, ammo_proto, currentAmmoDPS);
if (currentAmmoDPS == GetAmmoDPS())
return;
@@ -9377,7 +9377,7 @@ void Player::StopCastingCharm(Aura* except /*= nullptr*/)
void Player::Say(std::string_view text, Language language, WorldObject const* /*= nullptr*/)
{
std::string _text(text);
if (!sScriptMgr->CanPlayerUseChat(this, CHAT_MSG_SAY, language, _text))
if (!sScriptMgr->OnPlayerCanUseChat(this, CHAT_MSG_SAY, language, _text))
{
return;
}
@@ -9398,7 +9398,7 @@ void Player::Yell(std::string_view text, Language language, WorldObject const* /
{
std::string _text(text);
if (!sScriptMgr->CanPlayerUseChat(this, CHAT_MSG_YELL, language, _text))
if (!sScriptMgr->OnPlayerCanUseChat(this, CHAT_MSG_YELL, language, _text))
{
return;
}
@@ -9419,7 +9419,7 @@ void Player::TextEmote(std::string_view text, WorldObject const* /*= nullptr*/,
{
std::string _text(text);
if (!sScriptMgr->CanPlayerUseChat(this, CHAT_MSG_EMOTE, LANG_UNIVERSAL, _text))
if (!sScriptMgr->OnPlayerCanUseChat(this, CHAT_MSG_EMOTE, LANG_UNIVERSAL, _text))
{
return;
}
@@ -9448,7 +9448,7 @@ void Player::Whisper(std::string_view text, Language language, Player* target, b
std::string _text(text);
if (!sScriptMgr->CanPlayerUseChat(this, CHAT_MSG_WHISPER, language, _text, target))
if (!sScriptMgr->OnPlayerCanUseChat(this, CHAT_MSG_WHISPER, language, _text, target))
{
return;
}
@@ -10712,7 +10712,7 @@ inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 c
}
}
sScriptMgr->OnBeforeStoreOrEquipNewItem(this, vendorslot, item, count, bag, slot, pProto, pVendor, crItem, bStore);
sScriptMgr->OnPlayerBeforeStoreOrEquipNewItem(this, vendorslot, item, count, bag, slot, pProto, pVendor, crItem, bStore);
Item* it = bStore ? StoreNewItem(vDest, item, true) : EquipNewItem(uiDest, item, true);
if (it)
@@ -10741,7 +10741,7 @@ inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 c
}
}
sScriptMgr->OnAfterStoreOrEquipNewItem(this, vendorslot, it, count, bag, slot, pProto, pVendor, crItem, bStore);
sScriptMgr->OnPlayerAfterStoreOrEquipNewItem(this, vendorslot, it, count, bag, slot, pProto, pVendor, crItem, bStore);
return true;
}
@@ -10749,7 +10749,7 @@ inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 c
// Return true is the bought item has a max count to force refresh of window by caller
bool Player::BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot)
{
sScriptMgr->OnBeforeBuyItemFromVendor(this, vendorguid, vendorslot, item, count, bag, slot);
sScriptMgr->OnPlayerBeforeBuyItemFromVendor(this, vendorguid, vendorslot, item, count, bag, slot);
// this check can be used from the hook to implement a custom vendor process
if (item == 0)
@@ -10941,7 +10941,7 @@ uint32 Player::GetMaxPersonalArenaRatingRequirement(uint32 minarenaslot) const
}
}
sScriptMgr->OnGetMaxPersonalArenaRatingRequirement(this, minarenaslot, max_personal_rating);
sScriptMgr->OnPlayerGetMaxPersonalArenaRatingRequirement(this, minarenaslot, max_personal_rating);
return max_personal_rating;
}
@@ -11375,11 +11375,11 @@ void Player::LeaveBattleground(Battleground* bg)
stmt->SetData(1, BG_DESERTION_TYPE_LEAVE_BG);
CharacterDatabase.Execute(stmt);
}
sScriptMgr->OnBattlegroundDesertion(this, BG_DESERTION_TYPE_LEAVE_BG);
sScriptMgr->OnPlayerBattlegroundDesertion(this, BG_DESERTION_TYPE_LEAVE_BG);
}
if (bg->isArena() && (bg->GetStatus() == STATUS_IN_PROGRESS || bg->GetStatus() == STATUS_WAIT_JOIN))
sScriptMgr->OnBattlegroundDesertion(this, ARENA_DESERTION_TYPE_LEAVE_BG);
sScriptMgr->OnPlayerBattlegroundDesertion(this, ARENA_DESERTION_TYPE_LEAVE_BG);
// xinef: reset corpse reclaim time
m_deathExpireTime = GameTime::GetGameTime().count();
@@ -11539,7 +11539,7 @@ bool Player::IsVisibleGloballyFor(Player const* u) const
if (!AccountMgr::IsPlayerAccount(u->GetSession()->GetSecurity()))
return GetSession()->GetSecurity() <= u->GetSession()->GetSecurity();
if (!sScriptMgr->NotVisibleGloballyFor(const_cast<Player*>(this), u))
if (!sScriptMgr->OnPlayerNotVisibleGloballyFor(const_cast<Player*>(this), u))
return true;
// non faction visibility non-breakable for non-GMs
@@ -11668,7 +11668,7 @@ void Player::SendInitialPacketsBeforeAddToMap()
SetMover(this);
sScriptMgr->OnSendInitialPacketsBeforeAddToMap(this, data);
sScriptMgr->OnPlayerSendInitialPacketsBeforeAddToMap(this, data);
}
void Player::SendInitialPacketsAfterAddToMap()
@@ -13560,7 +13560,7 @@ LootItem* Player::StoreLootItem(uint8 lootSlot, Loot* loot, InventoryResult& msg
LootItem* item = loot->LootItemInSlot(lootSlot, this, &qitem, &ffaitem, &conditem);
if (!item || item->is_looted)
{
if (!sScriptMgr->CanSendErrorAlreadyLooted(this))
if (!sScriptMgr->OnPlayerCanSendErrorAlreadyLooted(this))
{
SendEquipError(EQUIP_ERR_ALREADY_LOOTED, nullptr, nullptr);
}
@@ -13642,7 +13642,7 @@ LootItem* Player::StoreLootItem(uint8 lootSlot, Loot* loot, InventoryResult& msg
if (loot->containerGUID)
sLootItemStorage->RemoveStoredLootItem(loot->containerGUID, item->itemid, item->count, loot, item->itemIndex);
sScriptMgr->OnLootItem(this, newitem, item->count, this->GetLootGUID());
sScriptMgr->OnPlayerLootItem(this, newitem, item->count, this->GetLootGUID());
}
else
{
@@ -13673,13 +13673,13 @@ uint32 Player::CalculateTalentsPoints() const
}
talentPointsForLevel += m_extraBonusTalentCount;
sScriptMgr->OnCalculateTalentsPoints(this, talentPointsForLevel);
sScriptMgr->OnPlayerCalculateTalentsPoints(this, talentPointsForLevel);
return uint32(talentPointsForLevel * sWorld->getRate(RATE_TALENT));
}
bool Player::canFlyInZone(uint32 mapid, uint32 zone, SpellInfo const* bySpell)
{
if (!sScriptMgr->OnCanPlayerFlyInZone(this, mapid,zone,bySpell))
if (!sScriptMgr->OnPlayerCanFlyInZone(this, mapid,zone,bySpell))
{
return false;
}
@@ -15300,7 +15300,7 @@ void Player::ActivateSpec(uint8 spec)
++iter;
}
sScriptMgr->OnAfterSpecSlotChanged(this, GetActiveSpec());
sScriptMgr->OnPlayerAfterSpecSlotChanged(this, GetActiveSpec());
}
void Player::LoadActions(PreparedQueryResult result)
@@ -15397,7 +15397,7 @@ void Player::SetIsSpectator(bool on)
if (HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
{
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
sScriptMgr->OnFfaPvpStateUpdate(this, false);
sScriptMgr->OnPlayerFfaPvpStateUpdate(this, false);
}
ResetContestedPvP();
SetDisplayId(23691);
@@ -15422,7 +15422,7 @@ void Player::SetIsSpectator(bool on)
if (!HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
{
SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
sScriptMgr->OnFfaPvpStateUpdate(this, true);
sScriptMgr->OnPlayerFfaPvpStateUpdate(this, true);
}
}
@@ -16227,7 +16227,7 @@ uint32 Player::DoRandomRoll(uint32 minimum, uint32 maximum)
void Player::SetArenaTeamInfoField(uint8 slot, ArenaTeamInfoType type, uint32 value)
{
if (sScriptMgr->NotSetArenaTeamInfoField(this, slot, type, value))
if (sScriptMgr->OnPlayerNotSetArenaTeamInfoField(this, slot, type, value))
SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + type, value);
}
@@ -16235,7 +16235,7 @@ uint32 Player::GetArenaPersonalRating(uint8 slot) const
{
uint32 result = GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING);
sScriptMgr->OnGetArenaPersonalRating(const_cast<Player*>(this), slot, result);
sScriptMgr->OnPlayerGetArenaPersonalRating(const_cast<Player*>(this), slot, result);
return result;
}
@@ -16244,7 +16244,7 @@ uint32 Player::GetArenaTeamId(uint8 slot) const
{
uint32 result = GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_ID);
sScriptMgr->OnGetArenaTeamId(const_cast<Player*>(this), slot, result);
sScriptMgr->OnPlayerGetArenaTeamId(const_cast<Player*>(this), slot, result);
return result;
}
@@ -16253,7 +16253,7 @@ bool Player::IsFFAPvP()
{
bool result = Unit::IsFFAPvP();
sScriptMgr->OnIsFFAPvP(this, result);
sScriptMgr->OnPlayerIsFFAPvP(this, result);
return result;
}
@@ -16262,7 +16262,7 @@ bool Player::IsPvP()
{
bool result = Unit::IsPvP();
sScriptMgr->OnIsPvP(this, result);
sScriptMgr->OnPlayerIsPvP(this, result);
return result;
}
@@ -16271,7 +16271,7 @@ uint16 Player::GetMaxSkillValueForLevel() const
{
uint16 result = Unit::GetMaxSkillValueForLevel();
sScriptMgr->OnGetMaxSkillValueForLevel(const_cast<Player*>(this), result);
sScriptMgr->OnPlayerGetMaxSkillValueForLevel(const_cast<Player*>(this), result);
return result;
}
@@ -16280,21 +16280,21 @@ float Player::GetQuestRate(bool isDFQuest)
{
float result = isDFQuest ? sWorld->getRate(RATE_XP_QUEST_DF) : sWorld->getRate(RATE_XP_QUEST);
sScriptMgr->OnGetQuestRate(this, result);
sScriptMgr->OnPlayerGetQuestRate(this, result);
return result;
}
void Player::SetServerSideVisibility(ServerSideVisibilityType type, AccountTypes sec)
{
sScriptMgr->OnSetServerSideVisibility(this, type, sec);
sScriptMgr->OnPlayerSetServerSideVisibility(this, type, sec);
m_serverSideVisibility.SetValue(type, sec);
}
void Player::SetServerSideVisibilityDetect(ServerSideVisibilityType type, AccountTypes sec)
{
sScriptMgr->OnSetServerSideVisibilityDetect(this, type, sec);
sScriptMgr->OnPlayerSetServerSideVisibilityDetect(this, type, sec);
m_serverSideVisibilityDetect.SetValue(type, sec);
}

View File

@@ -399,7 +399,7 @@ void Player::UpdateFFAPvPFlag(time_t currTime)
if (HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
{
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
sScriptMgr->OnFfaPvpStateUpdate(this, false);
sScriptMgr->OnPlayerFfaPvpStateUpdate(this, false);
}
for (ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
(*itr)->RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);

View File

@@ -602,7 +602,7 @@ void Player::CompleteQuest(uint32 quest_id)
return;
}
if (!sScriptMgr->OnBeforePlayerQuestComplete(this, quest_id))
if (!sScriptMgr->OnPlayerBeforeQuestComplete(this, quest_id))
{
return;
}
@@ -699,7 +699,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
Item* item = StoreNewItem(dest, itemId, true);
SendNewItem(item, quest->RewardChoiceItemCount[reward], true, false, false, false);
sScriptMgr->OnQuestRewardItem(this, item, quest->RewardChoiceItemCount[reward]);
sScriptMgr->OnPlayerQuestRewardItem(this, item, quest->RewardChoiceItemCount[reward]);
}
else
{
@@ -720,7 +720,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
Item* item = StoreNewItem(dest, itemId, true);
SendNewItem(item, quest->RewardItemIdCount[i], true, false, false, false);
sScriptMgr->OnQuestRewardItem(this, item, quest->RewardItemIdCount[i]);
sScriptMgr->OnPlayerQuestRewardItem(this, item, quest->RewardItemIdCount[i]);
}
else
problematicItems.emplace_back(itemId, quest->RewardItemIdCount[i]);
@@ -745,15 +745,15 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
// Not give XP in case already completed once repeatable quest
uint32 XP = rewarded ? 0 : CalculateQuestRewardXP(quest);
sScriptMgr->OnQuestComputeXP(this, quest, XP);
sScriptMgr->OnPlayerQuestComputeXP(this, quest, XP);
int32 moneyRew = 0;
if (GetLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || sScriptMgr->ShouldBeRewardedWithMoneyInsteadOfExp(this))
if (GetLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || sScriptMgr->OnPlayerShouldBeRewardedWithMoneyInsteadOfExp(this))
{
moneyRew = quest->GetRewMoneyMaxLevel();
}
else
{
sScriptMgr->OnGivePlayerXP(this, XP, nullptr, isLFGReward ? PlayerXPSource::XPSOURCE_QUEST_DF : PlayerXPSource::XPSOURCE_QUEST);
sScriptMgr->OnPlayerGiveXP(this, XP, nullptr, isLFGReward ? PlayerXPSource::XPSOURCE_QUEST_DF : PlayerXPSource::XPSOURCE_QUEST);
GiveXP(XP, nullptr, 1.0f, isLFGReward);
}
@@ -1953,7 +1953,7 @@ void Player::KilledMonsterCredit(uint32 entry, ObjectGuid guid)
if (q_status.Status == QUEST_STATUS_INCOMPLETE && (!GetGroup() || !GetGroup()->isRaidGroup() || qInfo->IsAllowedInRaid(GetMap()->GetDifficulty()) ||
(qInfo->IsPVPQuest() && (GetGroup()->isBFGroup() || GetGroup()->isBGGroup()))))
{
if (!sScriptMgr->PassedQuestKilledMonsterCredit(this, qInfo, entry, real_entry, guid))
if (!sScriptMgr->OnPlayerPassedQuestKilledMonsterCredit(this, qInfo, entry, real_entry, guid))
continue;
if (qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_KILL) /*&& !qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_CAST)*/)

View File

@@ -1811,7 +1811,7 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16& dest, Item* pItem, bool
ItemTemplate const* pProto = pItem->GetTemplate();
if (pProto)
{
if (!sScriptMgr->CanEquipItem(const_cast<Player*>(this), slot, dest, pItem, swap, not_loading))
if (!sScriptMgr->OnPlayerCanEquipItem(const_cast<Player*>(this), slot, dest, pItem, swap, not_loading))
return EQUIP_ERR_CANT_DO_RIGHT_NOW;
// item used
@@ -1983,7 +1983,7 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16& dest, Item* pItem, bool
InventoryResult Player::CanUnequipItem(uint16 pos, bool swap) const
{
if (!sScriptMgr->CanUnequipItem(const_cast<Player*>(this), pos, swap))
if (!sScriptMgr->OnPlayerCanUnequipItem(const_cast<Player*>(this), pos, swap))
return EQUIP_ERR_CANT_DO_RIGHT_NOW;
// Applied only to equipped items and bank bags
@@ -2326,7 +2326,7 @@ InventoryResult Player::CanUseItem(ItemTemplate const* proto) const
InventoryResult result = EQUIP_ERR_OK;
if (!sScriptMgr->CanUseItem(const_cast<Player*>(this), proto, result))
if (!sScriptMgr->OnPlayerCanUseItem(const_cast<Player*>(this), proto, result))
{
return result;
}
@@ -2566,7 +2566,7 @@ Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update
CharacterDatabase.Execute(stmt);
}
sScriptMgr->OnStoreNewItem(this, pItem, count);
sScriptMgr->OnPlayerStoreNewItem(this, pItem, count);
}
return pItem;
}
@@ -2710,7 +2710,7 @@ Item* Player::EquipNewItem(uint16 pos, uint32 item, bool update)
if (!_item)
return nullptr;
if (!IsEquipmentPos(pos) || sScriptMgr->CanSaveEquipNewItem(this, _item, pos, update))
if (!IsEquipmentPos(pos) || sScriptMgr->OnPlayerCanSaveEquipNewItem(this, _item, pos, update))
{
// pussywizard: obtaining blue or better items saves to db
if (ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item))
@@ -2819,7 +2819,7 @@ Item* Player::EquipItem(uint16 pos, Item* pItem, bool update)
pItem2->SetState(ITEM_CHANGED, this);
ApplyEquipCooldown(pItem2);
sScriptMgr->OnEquip(this, pItem2, bag, slot, update);
sScriptMgr->OnPlayerEquip(this, pItem2, bag, slot, update);
return pItem2;
}
@@ -2827,7 +2827,7 @@ Item* Player::EquipItem(uint16 pos, Item* pItem, bool update)
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM, pItem->GetEntry());
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM, pItem->GetEntry(), slot);
sScriptMgr->OnEquip(this, pItem, bag, slot, update);
sScriptMgr->OnPlayerEquip(this, pItem, bag, slot, update);
UpdateForQuestWorldObjects();
return pItem;
}
@@ -2851,7 +2851,7 @@ void Player::QuickEquipItem(uint16 pos, Item* pItem)
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM, pItem->GetEntry());
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM, pItem->GetEntry(), slot);
sScriptMgr->OnEquip(this, pItem, (pos >> 8), slot, true);
sScriptMgr->OnPlayerEquip(this, pItem, (pos >> 8), slot, true);
}
}
@@ -2869,7 +2869,7 @@ void Player::SetVisibleItemSlot(uint8 slot, Item* pItem)
SetUInt32Value(PLAYER_VISIBLE_ITEM_1_ENCHANTMENT + (slot * 2), 0);
}
sScriptMgr->OnAfterPlayerSetVisibleItemSlot(this, slot, pItem);
sScriptMgr->OnPlayerAfterSetVisibleItemSlot(this, slot, pItem);
}
void Player::VisualizeItem(uint8 slot, Item* pItem)
@@ -2990,7 +2990,7 @@ void Player::MoveItemFromInventory(uint8 bag, uint8 slot, bool update)
it->DestroyForPlayer(this);
}
sScriptMgr->OnAfterPlayerMoveItemFromInventory(this, it, bag, slot, update);
sScriptMgr->OnPlayerAfterMoveItemFromInventory(this, it, bag, slot, update);
}
}
@@ -4326,7 +4326,7 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool
if (pEnchant->requiredSkill > 0 && pEnchant->requiredSkillValue > GetSkillValue(pEnchant->requiredSkill))
return;
if (!sScriptMgr->CanApplyEnchantment(this, item, slot, apply, apply_dur, ignore_condition))
if (!sScriptMgr->OnPlayerCanApplyEnchantment(this, item, slot, apply, apply_dur, ignore_condition))
return;
// If we're dealing with a gem inside a prismatic socket we need to check the prismatic socket requirements
@@ -4433,7 +4433,7 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool
}
}
sScriptMgr->OnApplyEnchantmentItemModsBefore(this, item, slot, apply, enchant_spell_id, enchant_amount);
sScriptMgr->OnPlayerApplyEnchantmentItemModsBefore(this, item, slot, apply, enchant_spell_id, enchant_amount);
LOG_DEBUG("entities.player.items", "Adding {} to stat nb {}", enchant_amount, enchant_spell_id);
switch (enchant_spell_id)
@@ -5876,7 +5876,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
else if (IsEquipmentPos(INVENTORY_SLOT_BAG_0, slot))
{
uint16 dest;
if (sScriptMgr->CheckItemInSlotAtLoadInventory(this, item, slot, err, dest))
if (sScriptMgr->OnPlayerCheckItemInSlotAtLoadInventory(this, item, slot, err, dest))
err = CanEquipItem(slot, dest, item, false, false);
if (err == EQUIP_ERR_OK)
QuickEquipItem(dest, item);
@@ -6826,7 +6826,7 @@ bool Player::Satisfy(DungeonProgressionRequirements const* ar, uint32 target_map
|| missingPlayerItems.size() || missingPlayerQuests.size() || missingPlayerAchievements.size()
|| missingLeaderItems.size() || missingLeaderQuests.size() || missingLeaderAchievements.size())
{
if (!sScriptMgr->NotAvoidSatisfy(partyLeader, ar, target_map, report))
if (!sScriptMgr->OnPlayerNotAvoidSatisfy(partyLeader, ar, target_map, report))
return true;
if (report)

View File

@@ -55,7 +55,7 @@ void Player::Update(uint32 p_time)
if (!IsInWorld())
return;
sScriptMgr->OnBeforePlayerUpdate(this, p_time);
sScriptMgr->OnPlayerBeforeUpdate(this, p_time);
// undelivered mail
if (m_nextMailDelivereTime && m_nextMailDelivereTime <= GameTime::GetGameTime().count())
@@ -708,7 +708,7 @@ void Player::UpdateAllRatings()
// skill+step, checking for max value
bool Player::UpdateSkill(uint32 skill_id, uint32 step)
{
if (!skill_id || !sScriptMgr->CanPlayerUpdateSkill(this, skill_id))
if (!skill_id || !sScriptMgr->OnPlayerCanUpdateSkill(this, skill_id))
return false;
SkillStatusMap::iterator itr = mSkillStatus.find(skill_id);
@@ -720,7 +720,7 @@ bool Player::UpdateSkill(uint32 skill_id, uint32 step)
uint32 value = SKILL_VALUE(data);
uint32 max = SKILL_MAX(data);
sScriptMgr->OnBeforePlayerUpdateSkill(this, skill_id, value, max, step);
sScriptMgr->OnPlayerBeforeUpdateSkill(this, skill_id, value, max, step);
if ((!max) || (!value) || (value >= max))
return false;
@@ -768,7 +768,7 @@ bool Player::UpdateGatherSkill(uint32 SkillId, uint32 SkillValue,
uint32 gathering_skill_gain =
sWorld->getIntConfig(CONFIG_SKILL_GAIN_GATHERING);
sScriptMgr->OnUpdateGatheringSkill(this, SkillId, SkillValue, RedLevel + 100, RedLevel + 50, RedLevel + 25, gathering_skill_gain);
sScriptMgr->OnPlayerUpdateGatheringSkill(this, SkillId, SkillValue, RedLevel + 100, RedLevel + 50, RedLevel + 25, gathering_skill_gain);
// For skinning and Mining chance decrease with level. 1-74 - no decrease,
// 75-149 - 2 times, 225-299 - 8 times
@@ -846,7 +846,7 @@ bool Player::UpdateCraftSkill(uint32 spellid)
uint32 craft_skill_gain =
sWorld->getIntConfig(CONFIG_SKILL_GAIN_CRAFTING);
sScriptMgr->OnUpdateCraftingSkill(this, _spell_idx->second, SkillValue, craft_skill_gain);
sScriptMgr->OnPlayerUpdateCraftingSkill(this, _spell_idx->second, SkillValue, craft_skill_gain);
return UpdateSkillPro(
_spell_idx->second->SkillLine,
@@ -915,7 +915,7 @@ bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step)
LOG_DEBUG("entities.player.skills",
"UpdateSkillPro(SkillId {}, Chance {:3.1f}%)", SkillId,
Chance / 10.0f);
if (!SkillId || !sScriptMgr->CanPlayerUpdateSkill(this, SkillId))
if (!SkillId || !sScriptMgr->OnPlayerCanUpdateSkill(this, SkillId))
return false;
if (Chance <= 0) // speedup in 0 chance case
@@ -936,7 +936,7 @@ bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step)
uint32 SkillValue = SKILL_VALUE(data);
uint32 MaxValue = SKILL_MAX(data);
sScriptMgr->OnBeforePlayerUpdateSkill(this, SkillId, SkillValue, MaxValue, step);
sScriptMgr->OnPlayerBeforeUpdateSkill(this, SkillId, SkillValue, MaxValue, step);
if (!MaxValue || !SkillValue || SkillValue >= MaxValue)
return false;
@@ -1383,7 +1383,7 @@ void Player::UpdateEquipSpellsAtFormChange()
ApplyEquipSpell(spellInfo, nullptr, false,
true); // remove spells that not fit to form
if (!sScriptMgr->CanApplyEquipSpellsItemSet(this, eff))
if (!sScriptMgr->OnPlayerCanApplyEquipSpellsItemSet(this, eff))
break;
ApplyEquipSpell(spellInfo, nullptr, true,
true); // add spells that fit form but not active
@@ -1461,7 +1461,7 @@ void Player::UpdateFFAPvPState(bool reset /*= true*/)
{
if (!IsFFAPvP())
{
sScriptMgr->OnFfaPvpStateUpdate(this, true);
sScriptMgr->OnPlayerFfaPvpStateUpdate(this, true);
SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
for (ControlSet::iterator itr = m_Controlled.begin();
itr != m_Controlled.end(); ++itr)
@@ -1483,7 +1483,7 @@ void Player::UpdateFFAPvPState(bool reset /*= true*/)
if (HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
{
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
sScriptMgr->OnFfaPvpStateUpdate(this, false);
sScriptMgr->OnPlayerFfaPvpStateUpdate(this, false);
}
for (ControlSet::iterator itr = m_Controlled.begin();
itr != m_Controlled.end(); ++itr)