Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/server/game/Achievements/AchievementMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ void AchievementMgr::SaveToDB(CharacterDatabaseTransaction trans)

iter->second.changed = false;

sScriptMgr->OnAchievementSave(trans, GetPlayer(), iter->first, iter->second);
sScriptMgr->OnPlayerAchievementSave(trans, GetPlayer(), iter->first, iter->second);
}
}

Expand Down Expand Up @@ -609,7 +609,7 @@ void AchievementMgr::SaveToDB(CharacterDatabaseTransaction trans)

iter->second.changed = false;

sScriptMgr->OnCriteriaSave(trans, GetPlayer(), iter->first, iter->second);
sScriptMgr->OnPlayerCriteriaSave(trans, GetPlayer(), iter->first, iter->second);
}
}
}
Expand Down Expand Up @@ -2103,7 +2103,7 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry,
if (entry->timeLimit && timedIter == _timedAchievements.end())
return;

if (!sScriptMgr->OnBeforeCriteriaProgress(GetPlayer(), entry))
if (!sScriptMgr->OnPlayerBeforeCriteriaProgress(GetPlayer(), entry))
{
return;
}
Expand Down Expand Up @@ -2169,7 +2169,7 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry,

SendCriteriaUpdate(entry, progress, timeElapsed, true);

sScriptMgr->OnCriteriaProgress(GetPlayer(), entry);
sScriptMgr->OnPlayerCriteriaProgress(GetPlayer(), entry);
}

void AchievementMgr::RemoveCriteriaProgress(const AchievementCriteriaEntry* entry)
Expand Down Expand Up @@ -2277,7 +2277,7 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement)
return;
}

if (!sScriptMgr->OnBeforeAchievementComplete(GetPlayer(), achievement))
if (!sScriptMgr->OnPlayerBeforeAchievementComplete(GetPlayer(), achievement))
{
return;
}
Expand All @@ -2292,7 +2292,7 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement)
ca.date = GameTime::GetGameTime().count();
ca.changed = true;

sScriptMgr->OnAchievementComplete(GetPlayer(), achievement);
sScriptMgr->OnPlayerAchievementComplete(GetPlayer(), achievement);

// pussywizard: set all progress counters to 0, so progress will be deleted from db during save
{
Expand Down
4 changes: 2 additions & 2 deletions src/server/game/Battlegrounds/BattlegroundQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1355,11 +1355,11 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
CharacterDatabase.Execute(stmt);
}

sScriptMgr->OnBattlegroundDesertion(player, BG_DESERTION_TYPE_NO_ENTER_BUTTON);
sScriptMgr->OnPlayerBattlegroundDesertion(player, BG_DESERTION_TYPE_NO_ENTER_BUTTON);
}

if (bg && bg->isArena() && (bg->GetStatus() == STATUS_IN_PROGRESS || bg->GetStatus() == STATUS_WAIT_JOIN))
sScriptMgr->OnBattlegroundDesertion(player, ARENA_DESERTION_TYPE_NO_ENTER_BUTTON);
sScriptMgr->OnPlayerBattlegroundDesertion(player, ARENA_DESERTION_TYPE_NO_ENTER_BUTTON);

LOG_DEBUG("bg.battleground", "Battleground: removing player {} from bg queue for instance {} because of not pressing enter battle in time.", player->GetGUID().ToString(), m_BgInstanceGUID);

Expand Down
2 changes: 1 addition & 1 deletion src/server/game/DungeonFinding/LFGMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ namespace lfg
if (grp && (grp->isBGGroup() || grp->isBFGroup()))
return;

if (!sScriptMgr->CanJoinLfg(player, roles, dungeons, comment))
if (!sScriptMgr->OnPlayerCanJoinLfg(player, roles, dungeons, comment))
return;

// pussywizard: can't join LFG/LFR while using LFR
Expand Down
10 changes: 5 additions & 5 deletions src/server/game/DungeonFinding/LFGScripts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ namespace lfg
{
}

void LFGPlayerScript::OnLevelChanged(Player* player, uint8 /*oldLevel*/)
void LFGPlayerScript::OnPlayerLevelChanged(Player* player, uint8 /*oldLevel*/)
{
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER | LFG_OPTION_ENABLE_SEASONAL_BOSSES))
return;

sLFGMgr->InitializeLockedDungeons(player, player->GetGroup());
}

void LFGPlayerScript::OnLogout(Player* player)
void LFGPlayerScript::OnPlayerLogout(Player* player)
{
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER | LFG_OPTION_ENABLE_SEASONAL_BOSSES))
return;
Expand All @@ -69,7 +69,7 @@ namespace lfg
sLFGMgr->LfrSearchRemove(player);
}

void LFGPlayerScript::OnLogin(Player* player)
void LFGPlayerScript::OnPlayerLogin(Player* player)
{
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER | LFG_OPTION_ENABLE_SEASONAL_BOSSES))
return;
Expand All @@ -93,14 +93,14 @@ namespace lfg
/// @todo - Restore LfgPlayerData and send proper status to player if it was in a group
}

void LFGPlayerScript::OnBindToInstance(Player* player, Difficulty difficulty, uint32 mapId, bool /*permanent*/)
void LFGPlayerScript::OnPlayerBindToInstance(Player* player, Difficulty difficulty, uint32 mapId, bool /*permanent*/)
{
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
if (mapEntry->IsDungeon() && difficulty > DUNGEON_DIFFICULTY_NORMAL)
sLFGMgr->InitializeLockedDungeons(player, player->GetGroup());
}

void LFGPlayerScript::OnMapChanged(Player* player)
void LFGPlayerScript::OnPlayerMapChanged(Player* player)
{
Map const* map = player->GetMap();

Expand Down
10 changes: 5 additions & 5 deletions src/server/game/DungeonFinding/LFGScripts.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ namespace lfg
LFGPlayerScript();

// Player Hooks
void OnLevelChanged(Player* player, uint8 oldLevel) override;
void OnLogout(Player* player) override;
void OnLogin(Player* player) override;
void OnBindToInstance(Player* player, Difficulty difficulty, uint32 mapId, bool permanent) override;
void OnMapChanged(Player* player) override;
void OnPlayerLevelChanged(Player* player, uint8 oldLevel) override;
void OnPlayerLogout(Player* player) override;
void OnPlayerLogin(Player* player) override;
void OnPlayerBindToInstance(Player* player, Difficulty difficulty, uint32 mapId, bool permanent) override;
void OnPlayerMapChanged(Player* player) override;
};

class LFGGroupScript : public GroupScript
Expand Down
14 changes: 7 additions & 7 deletions src/server/game/Entities/Creature/GossipDef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,22 +455,22 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, ObjectGuid npcGU

uint32 moneyRew = 0;
Player* player = _session->GetPlayer();
if (player && (player->GetLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || sScriptMgr->ShouldBeRewardedWithMoneyInsteadOfExp(player)))
if (player && (player->GetLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || sScriptMgr->OnPlayerShouldBeRewardedWithMoneyInsteadOfExp(player)))
{
moneyRew = quest->GetRewMoneyMaxLevel();
}
moneyRew += quest->GetRewOrReqMoney(player ? player->GetLevel() : 0); // reward money (below max lvl)
data << moneyRew;
uint32 questXp;
if (player && !sScriptMgr->ShouldBeRewardedWithMoneyInsteadOfExp(player))
if (player && !sScriptMgr->OnPlayerShouldBeRewardedWithMoneyInsteadOfExp(player))
{
questXp = player->CalculateQuestRewardXP(quest);
}
else
{
questXp = 0;
}
sScriptMgr->OnQuestComputeXP(player, quest, questXp);
sScriptMgr->OnPlayerQuestComputeXP(player, quest, questXp);
data << questXp;
}

Expand Down Expand Up @@ -555,7 +555,7 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
{
uint32 moneyRew = 0;
Player* player = _session->GetPlayer();
if (player && (player->GetLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || sScriptMgr->ShouldBeRewardedWithMoneyInsteadOfExp(player)))
if (player && (player->GetLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || sScriptMgr->OnPlayerShouldBeRewardedWithMoneyInsteadOfExp(player)))
{
moneyRew = quest->GetRewMoneyMaxLevel();
}
Expand Down Expand Up @@ -707,22 +707,22 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, ObjectGuid npcGUI

uint32 moneyRew = 0;
Player* player = _session->GetPlayer();
if (player && (player->GetLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || sScriptMgr->ShouldBeRewardedWithMoneyInsteadOfExp(player)))
if (player && (player->GetLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) || sScriptMgr->OnPlayerShouldBeRewardedWithMoneyInsteadOfExp(player)))
{
moneyRew = quest->GetRewMoneyMaxLevel();
}
moneyRew += quest->GetRewOrReqMoney(player ? player->GetLevel() : 0); // reward money (below max lvl)
data << moneyRew;
uint32 questXp;
if (player && !sScriptMgr->ShouldBeRewardedWithMoneyInsteadOfExp(player))
if (player && !sScriptMgr->OnPlayerShouldBeRewardedWithMoneyInsteadOfExp(player))
{
questXp = player->CalculateQuestRewardXP(quest);
}
else
{
questXp = 0;
}
sScriptMgr->OnQuestComputeXP(player, quest, questXp);
sScriptMgr->OnPlayerQuestComputeXP(player, quest, questXp);
data << questXp;

// rewarded honor points. Multiply with 10 to satisfy client
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Entities/Creature/TemporarySummon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ void TempSummon::InitStats(uint32 duration)
Unit* owner = GetSummonerUnit();
if (owner)
if (Player* player = owner->ToPlayer())
sScriptMgr->OnBeforeTempSummonInitStats(player, this, duration);
sScriptMgr->OnPlayerBeforeTempSummonInitStats(player, this, duration);

m_timer = duration;
m_lifetime = duration;
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Entities/GameObject/GameObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1776,7 +1776,7 @@ void GameObject::Use(Unit* user)

LOG_DEBUG("entities.gameobject", "Fishing check (skill: {} zone min skill: {} chance {} roll: {}", skill, zone_skill, chance, roll);

if (sScriptMgr->OnUpdateFishingSkill(player, skill, zone_skill, chance, roll))
if (sScriptMgr->OnPlayerUpdateFishingSkill(player, skill, zone_skill, chance, roll))
{
player->UpdateFishingSkill();
}
Expand Down
6 changes: 3 additions & 3 deletions src/server/game/Entities/Pet/Pet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c
return false;

bool forceLoadFromDB = false;
sScriptMgr->OnBeforeLoadPetFromDB(owner, petEntry, petnumber, current, forceLoadFromDB);
sScriptMgr->OnPlayerBeforeLoadPetFromDB(owner, petEntry, petnumber, current, forceLoadFromDB);

if (!forceLoadFromDB && (owner->IsClass(CLASS_DEATH_KNIGHT, CLASS_CONTEXT_PET) && !owner->CanSeeDKPet())) // DK Pet exception
return false;
Expand Down Expand Up @@ -1031,7 +1031,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
PetType petType = MAX_PET_TYPE;
if (owner->IsPlayer())
{
sScriptMgr->OnBeforeGuardianInitStatsForLevel(owner->ToPlayer(), this, cinfo, petType);
sScriptMgr->OnPlayerBeforeGuardianInitStatsForLevel(owner->ToPlayer(), this, cinfo, petType);

if (IsPet())
{
Expand Down Expand Up @@ -1425,7 +1425,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
SetPower(POWER_MANA, GetMaxPower(POWER_MANA));

if (owner->IsPlayer())
sScriptMgr->OnAfterGuardianInitStatsForLevel(owner->ToPlayer(), this);
sScriptMgr->OnPlayerAfterGuardianInitStatsForLevel(owner->ToPlayer(), this);

return true;
}
Expand Down
4 changes: 2 additions & 2 deletions src/server/game/Entities/Player/KillRewarder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -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)
{
Expand Down
Loading
Loading