Compare commits
19 Commits
bf0d92b8cc
...
340ebaf732
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
340ebaf732 | ||
|
|
b83071388c | ||
|
|
f234f034a1 | ||
|
|
835283bf26 | ||
|
|
8f6d651471 | ||
|
|
f6c29614d5 | ||
|
|
96e7a20bd9 | ||
|
|
cd8761796f | ||
|
|
dda25dac56 | ||
|
|
03bb881bf0 | ||
|
|
9bd2b4f725 | ||
|
|
eed0670c80 | ||
|
|
d306f36882 | ||
|
|
61bd3bb922 | ||
|
|
840fd1c12e | ||
|
|
f4af2f8c02 | ||
|
|
5551408b4b | ||
|
|
afba80427a | ||
|
|
8757fa6687 |
@ -234,7 +234,7 @@ def backtick_check(file: io, file_path: str) -> None:
|
||||
# Skip SQL keywords
|
||||
if word.upper() in {"SELECT", "FROM", "JOIN", "WHERE", "GROUP", "BY", "ORDER",
|
||||
"DELETE", "UPDATE", "INSERT", "INTO", "SET", "VALUES", "AND",
|
||||
"IN", "OR", "REPLACE"}:
|
||||
"IN", "OR", "REPLACE", "NOT"}:
|
||||
continue
|
||||
|
||||
# Make sure the word is enclosed in backticks
|
||||
|
||||
3
data/sql/updates/db_world/2025_02_24_00.sql
Normal file
3
data/sql/updates/db_world/2025_02_24_00.sql
Normal file
@ -0,0 +1,3 @@
|
||||
-- DB update 2025_02_22_00 -> 2025_02_24_00
|
||||
--
|
||||
UPDATE `creature_template` SET `flags_extra` = `flags_extra`|512|2147483648 WHERE `entry` = 25038;
|
||||
@ -633,6 +633,7 @@ void BossAI::_Reset()
|
||||
me->ResetLootMode();
|
||||
events.Reset();
|
||||
scheduler.CancelAll();
|
||||
me->m_Events.KillAllEvents(false);
|
||||
summons.DespawnAll();
|
||||
ClearUniqueTimedEventsDone();
|
||||
_healthCheckEvents.clear();
|
||||
@ -787,6 +788,20 @@ void BossAI::ScheduleHealthCheckEvent(std::initializer_list<uint8> healthPct, st
|
||||
_nextHealthCheck = _healthCheckEvents.front();
|
||||
}
|
||||
|
||||
void BossAI::ScheduleEnrageTimer(uint32 spellId, Milliseconds timer, uint8 textId /*= 0*/)
|
||||
{
|
||||
me->m_Events.AddEventAtOffset([this, spellId, textId]
|
||||
{
|
||||
if (!me->IsAlive())
|
||||
return;
|
||||
|
||||
if (textId)
|
||||
Talk(textId);
|
||||
|
||||
DoCastSelf(spellId, true);
|
||||
}, timer);
|
||||
}
|
||||
|
||||
// WorldBossAI - for non-instanced bosses
|
||||
|
||||
WorldBossAI::WorldBossAI(Creature* creature) :
|
||||
|
||||
@ -485,6 +485,12 @@ public:
|
||||
void ScheduleHealthCheckEvent(uint32 healthPct, std::function<void()> exec);
|
||||
void ScheduleHealthCheckEvent(std::initializer_list<uint8> healthPct, std::function<void()> exec);
|
||||
|
||||
// @brief Casts the spell after the fixed time and says the text id if provided. Timer will run even if the creature is casting or out of combat.
|
||||
// @param spellId The spell to cast.
|
||||
// @param timer The time to wait before casting the spell.
|
||||
// @param textId The text id to say.
|
||||
void ScheduleEnrageTimer(uint32 spellId, Milliseconds timer, uint8 textId = 0);
|
||||
|
||||
// Hook used to execute events scheduled into EventMap without the need
|
||||
// to override UpdateAI
|
||||
// note: You must re-schedule the event within this method if the event
|
||||
|
||||
@ -748,7 +748,10 @@ void Battleground::RewardReputationToTeam(uint32 factionId, uint32 reputation, T
|
||||
AddPct(repGain, itr->second->GetTotalAuraModifier(SPELL_AURA_MOD_REPUTATION_GAIN));
|
||||
AddPct(repGain, itr->second->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_FACTION_REPUTATION_GAIN, realFactionId));
|
||||
if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(realFactionId))
|
||||
{
|
||||
ScriptMgr::instance()->OnPlayerBeforeReputationChange(itr->second, factionId, repGain, ReputationSource::PvP);
|
||||
itr->second->GetReputationMgr().ModifyReputation(factionEntry, repGain);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5910,7 +5910,7 @@ float Player::CalculateReputationGain(ReputationSource source, uint32 creatureOr
|
||||
float repMod = noQuestBonus ? 0.0f : float(GetTotalAuraModifier(SPELL_AURA_MOD_REPUTATION_GAIN));
|
||||
|
||||
// faction specific auras only seem to apply to kills
|
||||
if (source == REPUTATION_SOURCE_KILL)
|
||||
if (source == ReputationSource::Kill)
|
||||
repMod += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_FACTION_REPUTATION_GAIN, faction);
|
||||
|
||||
percent += rep > 0.f ? repMod : -repMod;
|
||||
@ -5918,17 +5918,17 @@ float Player::CalculateReputationGain(ReputationSource source, uint32 creatureOr
|
||||
float rate;
|
||||
switch (source)
|
||||
{
|
||||
case REPUTATION_SOURCE_KILL:
|
||||
case ReputationSource::Kill:
|
||||
rate = sWorld->getRate(RATE_REPUTATION_LOWLEVEL_KILL);
|
||||
break;
|
||||
case REPUTATION_SOURCE_QUEST:
|
||||
case REPUTATION_SOURCE_DAILY_QUEST:
|
||||
case REPUTATION_SOURCE_WEEKLY_QUEST:
|
||||
case REPUTATION_SOURCE_MONTHLY_QUEST:
|
||||
case REPUTATION_SOURCE_REPEATABLE_QUEST:
|
||||
case ReputationSource::Quest:
|
||||
case ReputationSource::DailyQuest:
|
||||
case ReputationSource::WeeklyQuest:
|
||||
case ReputationSource::MonthlyQuest:
|
||||
case ReputationSource::RepeatableQuest:
|
||||
rate = sWorld->getRate(RATE_REPUTATION_LOWLEVEL_QUEST);
|
||||
break;
|
||||
case REPUTATION_SOURCE_SPELL:
|
||||
case ReputationSource::Spell:
|
||||
default:
|
||||
rate = 1.0f;
|
||||
break;
|
||||
@ -5946,27 +5946,29 @@ float Player::CalculateReputationGain(ReputationSource source, uint32 creatureOr
|
||||
float repRate = 0.0f;
|
||||
switch (source)
|
||||
{
|
||||
case REPUTATION_SOURCE_KILL:
|
||||
case ReputationSource::Kill:
|
||||
repRate = repData->creatureRate;
|
||||
break;
|
||||
case REPUTATION_SOURCE_QUEST:
|
||||
case ReputationSource::Quest:
|
||||
repRate = repData->questRate;
|
||||
break;
|
||||
case REPUTATION_SOURCE_DAILY_QUEST:
|
||||
case ReputationSource::DailyQuest:
|
||||
repRate = repData->questDailyRate;
|
||||
break;
|
||||
case REPUTATION_SOURCE_WEEKLY_QUEST:
|
||||
case ReputationSource::WeeklyQuest:
|
||||
repRate = repData->questWeeklyRate;
|
||||
break;
|
||||
case REPUTATION_SOURCE_MONTHLY_QUEST:
|
||||
case ReputationSource::MonthlyQuest:
|
||||
repRate = repData->questMonthlyRate;
|
||||
break;
|
||||
case REPUTATION_SOURCE_REPEATABLE_QUEST:
|
||||
case ReputationSource::RepeatableQuest:
|
||||
repRate = repData->questRepeatableRate;
|
||||
break;
|
||||
case REPUTATION_SOURCE_SPELL:
|
||||
case ReputationSource::Spell:
|
||||
repRate = repData->spellRate;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// for custom, a rate of 0.0 will totally disable reputation gain for this faction/type
|
||||
@ -5976,7 +5978,7 @@ float Player::CalculateReputationGain(ReputationSource source, uint32 creatureOr
|
||||
percent *= repRate;
|
||||
}
|
||||
|
||||
if (source != REPUTATION_SOURCE_SPELL && GetsRecruitAFriendBonus(false))
|
||||
if (source != ReputationSource::Spell && GetsRecruitAFriendBonus(false))
|
||||
percent *= 1.0f + sWorld->getRate(RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS);
|
||||
|
||||
return CalculatePct(rep, percent);
|
||||
@ -6011,7 +6013,9 @@ void Player::RewardReputation(Unit* victim)
|
||||
|
||||
if (Rep->RepFaction1 && (!Rep->TeamDependent || teamId == TEAM_ALLIANCE))
|
||||
{
|
||||
float donerep1 = CalculateReputationGain(REPUTATION_SOURCE_KILL, victim->GetLevel(), static_cast<float>(Rep->RepValue1), ChampioningFaction ? ChampioningFaction : Rep->RepFaction1);
|
||||
float donerep1 = CalculateReputationGain(ReputationSource::Kill, victim->GetLevel(), static_cast<float>(Rep->RepValue1), ChampioningFaction ? ChampioningFaction : Rep->RepFaction1);
|
||||
ScriptMgr::instance()->OnPlayerBeforeReputationChange(this, static_cast<float>(Rep->RepValue1), donerep1, ReputationSource::Kill);
|
||||
ScriptMgr::instance()->OnPlayerBeforeReputationChange(this, static_cast<float>(Rep->RepValue1), donerep1, victim);
|
||||
|
||||
FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->RepFaction1);
|
||||
if (factionEntry1)
|
||||
@ -6022,7 +6026,9 @@ void Player::RewardReputation(Unit* victim)
|
||||
|
||||
if (Rep->RepFaction2 && (!Rep->TeamDependent || teamId == TEAM_HORDE))
|
||||
{
|
||||
float donerep2 = CalculateReputationGain(REPUTATION_SOURCE_KILL, victim->GetLevel(), static_cast<float>(Rep->RepValue2), ChampioningFaction ? ChampioningFaction : Rep->RepFaction2);
|
||||
float donerep2 = CalculateReputationGain(ReputationSource::Kill, victim->GetLevel(), static_cast<float>(Rep->RepValue2), ChampioningFaction ? ChampioningFaction : Rep->RepFaction2);
|
||||
ScriptMgr::instance()->OnPlayerBeforeReputationChange(this, static_cast<float>(Rep->RepValue1), donerep2, ReputationSource::Kill);
|
||||
ScriptMgr::instance()->OnPlayerBeforeReputationChange(this, static_cast<float>(Rep->RepValue1), donerep2, victim);
|
||||
|
||||
FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->RepFaction2);
|
||||
if (factionEntry2)
|
||||
@ -6061,25 +6067,31 @@ void Player::RewardReputation(Quest const* quest)
|
||||
|
||||
if (quest->IsDaily())
|
||||
{
|
||||
rep = CalculateReputationGain(REPUTATION_SOURCE_DAILY_QUEST, GetQuestLevel(quest), rep, quest->RewardFactionId[i], false);
|
||||
rep = CalculateReputationGain(ReputationSource::DailyQuest, GetQuestLevel(quest), rep, quest->RewardFactionId[i], false);
|
||||
ScriptMgr::instance()->OnPlayerBeforeReputationChange(this, quest->RewardFactionId[i], rep, ReputationSource::DailyQuest);
|
||||
}
|
||||
else if (quest->IsWeekly())
|
||||
{
|
||||
rep = CalculateReputationGain(REPUTATION_SOURCE_WEEKLY_QUEST, GetQuestLevel(quest), rep, quest->RewardFactionId[i], false);
|
||||
rep = CalculateReputationGain(ReputationSource::WeeklyQuest, GetQuestLevel(quest), rep, quest->RewardFactionId[i], false);
|
||||
ScriptMgr::instance()->OnPlayerBeforeReputationChange(this, quest->RewardFactionId[i], rep, ReputationSource::WeeklyQuest);
|
||||
}
|
||||
else if (quest->IsMonthly())
|
||||
{
|
||||
rep = CalculateReputationGain(REPUTATION_SOURCE_MONTHLY_QUEST, GetQuestLevel(quest), rep, quest->RewardFactionId[i], false);
|
||||
rep = CalculateReputationGain(ReputationSource::MonthlyQuest, GetQuestLevel(quest), rep, quest->RewardFactionId[i], false);
|
||||
ScriptMgr::instance()->OnPlayerBeforeReputationChange(this, quest->RewardFactionId[i], rep, ReputationSource::MonthlyQuest);
|
||||
}
|
||||
else if (quest->IsRepeatable())
|
||||
{
|
||||
rep = CalculateReputationGain(REPUTATION_SOURCE_REPEATABLE_QUEST, GetQuestLevel(quest), rep, quest->RewardFactionId[i], false);
|
||||
rep = CalculateReputationGain(ReputationSource::RepeatableQuest, GetQuestLevel(quest), rep, quest->RewardFactionId[i], false);
|
||||
ScriptMgr::instance()->OnPlayerBeforeReputationChange(this, quest->RewardFactionId[i], rep, ReputationSource::RepeatableQuest);
|
||||
}
|
||||
else
|
||||
{
|
||||
rep = CalculateReputationGain(REPUTATION_SOURCE_QUEST, GetQuestLevel(quest), rep, quest->RewardFactionId[i], false);
|
||||
rep = CalculateReputationGain(ReputationSource::Quest, GetQuestLevel(quest), rep, quest->RewardFactionId[i], false);
|
||||
ScriptMgr::instance()->OnPlayerBeforeReputationChange(this, quest->RewardFactionId[i], rep, ReputationSource::Quest);
|
||||
}
|
||||
|
||||
ScriptMgr::instance()->OnPlayerBeforeReputationChange(this, quest->RewardFactionId[i], rep, quest);
|
||||
if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(quest->RewardFactionId[i]))
|
||||
{
|
||||
GetReputationMgr().ModifyReputation(factionEntry, rep, quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_NO_REP_SPILLOVER));
|
||||
|
||||
@ -234,15 +234,31 @@ enum ActionButtonType
|
||||
ACTION_BUTTON_ITEM = 0x80
|
||||
};
|
||||
|
||||
enum ReputationSource
|
||||
/**
|
||||
* @brief This enum represent all known sources a character can get reputation
|
||||
*/
|
||||
enum class ReputationSource : uint8
|
||||
{
|
||||
REPUTATION_SOURCE_KILL,
|
||||
REPUTATION_SOURCE_QUEST,
|
||||
REPUTATION_SOURCE_DAILY_QUEST,
|
||||
REPUTATION_SOURCE_WEEKLY_QUEST,
|
||||
REPUTATION_SOURCE_MONTHLY_QUEST,
|
||||
REPUTATION_SOURCE_REPEATABLE_QUEST,
|
||||
REPUTATION_SOURCE_SPELL
|
||||
/// The player killed an enemy
|
||||
Kill,
|
||||
/// The player turned in a quest
|
||||
Quest,
|
||||
/// The player turned in a daily quest
|
||||
DailyQuest,
|
||||
/// The player turned in a weekly quest
|
||||
WeeklyQuest,
|
||||
/// The player turned in a montly quest
|
||||
MonthlyQuest,
|
||||
/// The player turned in a repeatable quest
|
||||
RepeatableQuest,
|
||||
/// The player used a spell
|
||||
Spell,
|
||||
// The player get reputation by doing PvP related tasks
|
||||
PvP,
|
||||
/// The player get reputation by a console command
|
||||
Console,
|
||||
/// The player get some reputation by server configuration
|
||||
Config
|
||||
};
|
||||
|
||||
enum QuestSound
|
||||
|
||||
@ -1018,11 +1018,14 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder const& holder)
|
||||
{
|
||||
ReputationMgr& repMgr = pCurrChar->GetReputationMgr();
|
||||
|
||||
auto SendFullReputation = [&repMgr](std::initializer_list<uint32> factionsList)
|
||||
auto SendFullReputation = [&repMgr, pCurrChar](std::initializer_list<uint32> factionsList)
|
||||
{
|
||||
for (auto const& itr : factionsList)
|
||||
{
|
||||
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry(itr), 42999.f, false);
|
||||
auto faction = sFactionStore.LookupEntry(itr);
|
||||
float reputation = 42999.f;
|
||||
ScriptMgr::instance()->OnPlayerBeforeReputationChange(pCurrChar, faction->ID, reputation, ReputationSource::Config);
|
||||
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry(itr), reputation, false);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -129,6 +129,26 @@ void ScriptMgr::OnPlayerGiveXP(Player* player, uint32& amount, Unit* victim, uin
|
||||
CALL_ENABLED_HOOKS(PlayerScript, PLAYERHOOK_ON_GIVE_EXP, script->OnPlayerGiveXP(player, amount, victim, xpSource));
|
||||
}
|
||||
|
||||
void ScriptMgr::OnPlayerBeforeReputationChange(Player* player, uint32 factionId, float& amount, Unit* victim)
|
||||
{
|
||||
CALL_ENABLED_HOOKS(PlayerScript, PLAYERHOOK_ON_BEFORE_REPUTATION_CHANGE_UNIT, script->OnPlayerBeforeReputationChange(player, factionId, amount, victim));
|
||||
}
|
||||
|
||||
void ScriptMgr::OnPlayerBeforeReputationChange(Player* player, uint32 factionId, float& amount, Quest const* quest)
|
||||
{
|
||||
CALL_ENABLED_HOOKS(PlayerScript, PLAYERHOOK_ON_BEFORE_REPUTATION_CHANGE_QUEST, script->OnPlayerBeforeReputationChange(player, factionId, amount, quest));
|
||||
}
|
||||
|
||||
void ScriptMgr::OnPlayerBeforeReputationChange(Player* player, uint32 factionId, float& amount, Spell* spell)
|
||||
{
|
||||
CALL_ENABLED_HOOKS(PlayerScript, PLAYERHOOK_ON_BEFORE_REPUTATION_CHANGE_SPELL, script->OnPlayerBeforeReputationChange(player, factionId, amount, spell));
|
||||
}
|
||||
|
||||
void ScriptMgr::OnPlayerBeforeReputationChange(Player* player, uint32 factionId, float& amount, ReputationSource reputationSource)
|
||||
{
|
||||
CALL_ENABLED_HOOKS(PlayerScript, PLAYERHOOK_ON_BEFORE_REPUTATION_CHANGE_SOURCE, script->OnPlayerBeforeReputationChange(player, factionId, amount, reputationSource));
|
||||
}
|
||||
|
||||
bool ScriptMgr::OnPlayerReputationChange(Player* player, uint32 factionID, int32& standing, bool incremental)
|
||||
{
|
||||
CALL_ENABLED_BOOLEAN_HOOKS(PlayerScript, PLAYERHOOK_ON_REPUTATION_CHANGE, !script->OnPlayerReputationChange(player, factionID, standing, incremental));
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
#ifndef SCRIPT_OBJECT_PLAYER_SCRIPT_H_
|
||||
#define SCRIPT_OBJECT_PLAYER_SCRIPT_H_
|
||||
|
||||
#include "Player.h"
|
||||
#include "ScriptObject.h"
|
||||
#include "SharedDefines.h"
|
||||
#include <vector>
|
||||
@ -48,6 +49,10 @@ enum PlayerHook
|
||||
PLAYERHOOK_ON_MONEY_CHANGED,
|
||||
PLAYERHOOK_ON_BEFORE_LOOT_MONEY,
|
||||
PLAYERHOOK_ON_GIVE_EXP,
|
||||
PLAYERHOOK_ON_BEFORE_REPUTATION_CHANGE_UNIT,
|
||||
PLAYERHOOK_ON_BEFORE_REPUTATION_CHANGE_QUEST,
|
||||
PLAYERHOOK_ON_BEFORE_REPUTATION_CHANGE_SPELL,
|
||||
PLAYERHOOK_ON_BEFORE_REPUTATION_CHANGE_SOURCE,
|
||||
PLAYERHOOK_ON_REPUTATION_CHANGE,
|
||||
PLAYERHOOK_ON_REPUTATION_RANK_CHANGE,
|
||||
PLAYERHOOK_ON_LEARN_SPELL,
|
||||
@ -275,6 +280,54 @@ public:
|
||||
// Called when a player gains XP (before anything is given)
|
||||
virtual void OnPlayerGiveXP(Player* /*player*/, uint32& /*amount*/, Unit* /*victim*/, uint8 /*xpSource*/) { }
|
||||
|
||||
/**
|
||||
* @brief Called before a player gains or looses Reputation
|
||||
*
|
||||
* @param [in] player instance of the current player
|
||||
* @param [in] factionId id of the faction which reputation changes
|
||||
* @param[in,out] amount the amount of reputation the player gets or loses
|
||||
* @param[in] victim the unit which was killed to gain reputation
|
||||
* @remark avoid hooking both versions of this event ReputationSource is a more generic one.<br />
|
||||
* ReputationSource is called first.
|
||||
*/
|
||||
virtual void OnPlayerBeforeReputationChange(Player* /*player*/, uint32 /*factionId*/, float& /*amount*/, Unit* /*victim*/ ) {}
|
||||
|
||||
/**
|
||||
* @brief Called before a player gains or looses Reputation
|
||||
*
|
||||
* @param [in] player instance of the current player
|
||||
* @param [in] factionId id of the faction which reputation changes
|
||||
* @param[in,out] amount the amount of reputation the player gets or loses
|
||||
* @param[in] quest the quest which was turn in to gain reputation
|
||||
* @remark avoid hooking both versions of this event ReputationSource is a more generic one.<br />
|
||||
* ReputationSource is called first.
|
||||
*/
|
||||
virtual void OnPlayerBeforeReputationChange(Player* /*player*/, uint32 /*factionId*/ , float& /*amount*/, Quest const* /*quest*/) {}
|
||||
|
||||
/**
|
||||
* @brief Called before a player gains or looses Reputation
|
||||
*
|
||||
* @param [in] player instance of the current player
|
||||
* @param [in] factionId id of the faction which reputation changes
|
||||
* @param[in,out] amount the amount of reputation the player gets or loses
|
||||
* @param[in] spell the spell which was used to gain reputation
|
||||
* @remark avoid hooking both versions of this event ReputationSource is a more generic one.<br />
|
||||
* ReputationSource is called first.
|
||||
*/
|
||||
virtual void OnPlayerBeforeReputationChange(Player* /*player*/, uint32 /*factionId*/, float& /*amount*/ , Spell* /*spell*/) {}
|
||||
|
||||
/**
|
||||
* @brief Called before a player gains or looses Reputation
|
||||
*
|
||||
* @param [in] player instance of the current player
|
||||
* @param [in] factionId id of the faction which reputation changes
|
||||
* @param[in,out] amount the amount of reputation the player gets or loses
|
||||
* @param[in] reputationSource an enum which determinate the source used to gain or loose reputation
|
||||
* @remark avoid hooking both versions of this event ReputationSource is a more generic one.<br />
|
||||
* ReputationSource is called first.
|
||||
*/
|
||||
virtual void OnPlayerBeforeReputationChange(Player* /*player*/, uint32 /*factionId*/, float& /*amount*/, ReputationSource /*reputationSource*/) {}
|
||||
|
||||
// Called when a player's reputation changes (before it is actually changed)
|
||||
virtual bool OnPlayerReputationChange(Player* /*player*/, uint32 /*factionID*/, int32& /*standing*/, bool /*incremental*/) { return true; }
|
||||
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
#include "LFGMgr.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "PetDefines.h"
|
||||
#include "Player.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "Tuples.h"
|
||||
#include "Weather.h"
|
||||
@ -311,6 +312,56 @@ public: /* PlayerScript */
|
||||
void OnPlayerMoneyChanged(Player* player, int32& amount);
|
||||
void OnPlayerBeforeLootMoney(Player* player, Loot* loot);
|
||||
void OnPlayerGiveXP(Player* player, uint32& amount, Unit* victim, uint8 xpSource);
|
||||
|
||||
/**
|
||||
* @brief Called before a player gains or looses Reputation
|
||||
*
|
||||
* @param [in] player instance of the current player
|
||||
* @param [in] factionId id of the faction which reputation changes
|
||||
* @param[in,out] amount the amount of reputation the player gets or loses
|
||||
* @param[in] victim the unit which was killed to gain reputation
|
||||
*
|
||||
* @remark avoid hooking both versions of this event ReputationSource is a more generic one.<br />
|
||||
* ReputationSource is called first.
|
||||
*/
|
||||
void OnPlayerBeforeReputationChange(Player* player, uint32 factionId, float& amount, Unit* victim);
|
||||
|
||||
/**
|
||||
* @brief Called before a player gains or looses Reputation
|
||||
*
|
||||
* @param [in] player instance of the current player
|
||||
* @param [in] factionId id of the faction which reputation changes
|
||||
* @param[in,out] amount the amount of reputation the player gets or loses
|
||||
* @param[in] quest the quest which was turn in to gain reputation
|
||||
* @remark avoid hooking both versions of this event ReputationSource is a more generic one.<br />
|
||||
* ReputationSource is called first.
|
||||
*/
|
||||
void OnPlayerBeforeReputationChange(Player* player, uint32 factionId, float& amount, Quest const* quest);
|
||||
|
||||
/**
|
||||
* @brief Called before a player gains or looses Reputation
|
||||
*
|
||||
* @param [in] player instance of the current player
|
||||
* @param [in] factionId id of the faction which reputation changes
|
||||
* @param[in,out] amount the amount of reputation the player gets or loses
|
||||
* @param[in] spell the spell which was used to gain reputation
|
||||
* @remark avoid hooking both versions of this event ReputationSource is a more generic one.<br />
|
||||
* ReputationSource is called first.
|
||||
*/
|
||||
void OnPlayerBeforeReputationChange(Player* player, uint32 factionId, float& amount, Spell* spell);
|
||||
|
||||
/**
|
||||
* @brief Called before a player gains or looses Reputation
|
||||
*
|
||||
* @param [in] player instance of the current player
|
||||
* @param [in] factionId id of the faction which reputation changes
|
||||
* @param[in,out] amount the amount of reputation the player gets or loses
|
||||
* @param[in] reputationSource an enum which determinate the source used to gain or loose reputation
|
||||
*
|
||||
* @remark avoid hooking both versions of this event ReputationSource is a more generic one.<br />
|
||||
* ReputationSource is called first.
|
||||
*/
|
||||
void OnPlayerBeforeReputationChange(Player* player, uint32 factionId, float& amount, ReputationSource reputationSource);
|
||||
bool OnPlayerReputationChange(Player* player, uint32 factionID, int32& standing, bool incremental);
|
||||
void OnPlayerReputationRankChange(Player* player, uint32 factionID, ReputationRank newRank, ReputationRank oldRank, bool increased);
|
||||
void OnPlayerLearnSpell(Player* player, uint32 spellID);
|
||||
|
||||
@ -4747,7 +4747,9 @@ void Spell::EffectReputation(SpellEffIndex effIndex)
|
||||
if (!factionEntry)
|
||||
return;
|
||||
|
||||
repChange = player->CalculateReputationGain(REPUTATION_SOURCE_SPELL, 0, repChange, factionId);
|
||||
repChange = player->CalculateReputationGain(ReputationSource::Spell, 0, repChange, factionId);
|
||||
ScriptMgr::instance()->OnPlayerBeforeReputationChange(player, factionId, repChange, ReputationSource::Spell);
|
||||
ScriptMgr::instance()->OnPlayerBeforeReputationChange(player, factionId, repChange, this);
|
||||
player->GetReputationMgr().ModifyReputation(factionEntry, repChange);
|
||||
}
|
||||
|
||||
|
||||
@ -29,6 +29,7 @@ EndScriptData */
|
||||
#include "Pet.h"
|
||||
#include "Player.h"
|
||||
#include "ReputationMgr.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "StringConvert.h"
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
@ -826,8 +827,9 @@ public:
|
||||
handler->SendErrorMessage(LANG_COMMAND_FACTION_NOREP_ERROR, factionEntry->name[handler->GetSessionDbcLocale()], factionId);
|
||||
return false;
|
||||
}
|
||||
|
||||
target->GetReputationMgr().SetOneFactionReputation(factionEntry, float(amount), false);
|
||||
float rep = target->GetReputationMgr().GetReputation(factionId) - float(amount);
|
||||
ScriptMgr::instance()->OnPlayerBeforeReputationChange(target, factionId, rep, ReputationSource::Console);
|
||||
target->GetReputationMgr().SetOneFactionReputation(factionEntry, rep, false);
|
||||
target->GetReputationMgr().SendState(target->GetReputationMgr().GetState(factionEntry));
|
||||
|
||||
handler->PSendSysMessage(LANG_COMMAND_MODIFY_REP, factionEntry->name[handler->GetSessionDbcLocale()], factionId,
|
||||
|
||||
@ -28,6 +28,7 @@ EndScriptData */
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
#include "ReputationMgr.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
@ -309,7 +310,9 @@ public:
|
||||
{
|
||||
if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(repFaction))
|
||||
{
|
||||
player->GetReputationMgr().SetReputation(factionEntry, static_cast<float>(repValue));
|
||||
auto repDiv = static_cast<float>(repValue - curRep);
|
||||
ScriptMgr::instance()->OnPlayerBeforeReputationChange(player, repFaction, repDiv, ReputationSource::Console);
|
||||
player->GetReputationMgr().SetReputation(factionEntry, repDiv + curRep);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -323,7 +326,9 @@ public:
|
||||
{
|
||||
if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(repFaction))
|
||||
{
|
||||
player->GetReputationMgr().SetReputation(factionEntry, static_cast<float>(repValue2));
|
||||
auto repDiv = static_cast<float>(repValue2 - curRep);
|
||||
ScriptMgr::instance()->OnPlayerBeforeReputationChange(player, repFaction, repDiv, ReputationSource::Console);
|
||||
player->GetReputationMgr().SetReputation(factionEntry, repDiv + curRep);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
#include "SpellInfo.h"
|
||||
#include "SpellScript.h"
|
||||
#include "SpellScriptLoader.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "sunwell_plateau.h"
|
||||
|
||||
enum Quotes
|
||||
@ -83,7 +84,10 @@ struct boss_sacrolash : public BossAI
|
||||
_isSisterDead = false;
|
||||
BossAI::Reset();
|
||||
me->SetLootMode(0);
|
||||
me->m_Events.KillAllEvents(false);
|
||||
|
||||
if (Creature* alythess = instance->GetCreature(DATA_ALYTHESS))
|
||||
if (!alythess->IsAlive())
|
||||
alythess->Respawn(true);
|
||||
}
|
||||
|
||||
void DoAction(int32 param) override
|
||||
@ -105,18 +109,6 @@ struct boss_sacrolash : public BossAI
|
||||
}
|
||||
}
|
||||
|
||||
void EnterEvadeMode(EvadeReason why) override
|
||||
{
|
||||
BossAI::EnterEvadeMode(why);
|
||||
if (Creature* alythess = instance->GetCreature(DATA_ALYTHESS))
|
||||
{
|
||||
if (!alythess->IsAlive())
|
||||
alythess->Respawn(true);
|
||||
else if (!alythess->IsInEvadeMode())
|
||||
alythess->AI()->EnterEvadeMode(why);
|
||||
}
|
||||
}
|
||||
|
||||
void JustEngagedWith(Unit* who) override
|
||||
{
|
||||
BossAI::JustEngagedWith(who);
|
||||
@ -124,10 +116,7 @@ struct boss_sacrolash : public BossAI
|
||||
if (alythess->IsAlive() && !alythess->IsInCombat())
|
||||
alythess->AI()->AttackStart(who);
|
||||
|
||||
me->m_Events.AddEventAtOffset([&] {
|
||||
Talk(YELL_BERSERK);
|
||||
DoCastSelf(SPELL_ENRAGE, true);
|
||||
}, 6min);
|
||||
ScheduleEnrageTimer(SPELL_ENRAGE, 6min, YELL_BERSERK);
|
||||
|
||||
ScheduleTimedEvent(10s, [&] {
|
||||
DoCastSelf(SPELL_SHADOW_BLADES);
|
||||
@ -195,7 +184,10 @@ struct boss_alythess : public BossAI
|
||||
_isSisterDead = false;
|
||||
BossAI::Reset();
|
||||
me->SetLootMode(0);
|
||||
me->m_Events.KillAllEvents(false);
|
||||
|
||||
if (Creature* sacrolash = instance->GetCreature(DATA_SACROLASH))
|
||||
if (!sacrolash->IsAlive())
|
||||
sacrolash->Respawn(true);
|
||||
}
|
||||
|
||||
void DoAction(int32 param) override
|
||||
@ -217,18 +209,6 @@ struct boss_alythess : public BossAI
|
||||
}
|
||||
}
|
||||
|
||||
void EnterEvadeMode(EvadeReason why) override
|
||||
{
|
||||
BossAI::EnterEvadeMode(why);
|
||||
if (Creature* sacrolash = instance->GetCreature(DATA_SACROLASH))
|
||||
{
|
||||
if (!sacrolash->IsAlive())
|
||||
sacrolash->Respawn(true);
|
||||
else if (!sacrolash->IsInEvadeMode())
|
||||
sacrolash->AI()->EnterEvadeMode(why);
|
||||
}
|
||||
}
|
||||
|
||||
void JustEngagedWith(Unit* who) override
|
||||
{
|
||||
BossAI::JustEngagedWith(who);
|
||||
@ -236,10 +216,7 @@ struct boss_alythess : public BossAI
|
||||
if (sacrolash->IsAlive() && !sacrolash->IsInCombat())
|
||||
sacrolash->AI()->AttackStart(who);
|
||||
|
||||
me->m_Events.AddEventAtOffset([&] {
|
||||
Talk(YELL_BERSERK);
|
||||
DoCastSelf(SPELL_ENRAGE, true);
|
||||
}, 6min);
|
||||
ScheduleEnrageTimer(SPELL_ENRAGE, 6min, YELL_BERSERK);
|
||||
|
||||
ScheduleTimedEvent(1s, [&] {
|
||||
DoCastVictim(SPELL_BLAZE);
|
||||
@ -389,8 +366,15 @@ public:
|
||||
return ValidateSpellInfo({ _touchSpell });
|
||||
}
|
||||
|
||||
void OnPeriodic(AuraEffect const* /*aurEff*/)
|
||||
void OnPeriodic(AuraEffect const* aurEff)
|
||||
{
|
||||
if (aurEff->GetId() == SPELL_FLAME_SEAR)
|
||||
{
|
||||
uint32 tick = aurEff->GetTickNumber();
|
||||
if (tick % 2 != 0 || tick > 10)
|
||||
return;
|
||||
}
|
||||
|
||||
if (Unit* owner = GetOwner()->ToUnit())
|
||||
owner->CastSpell(owner, _touchSpell, true);
|
||||
}
|
||||
|
||||
@ -134,7 +134,7 @@ struct boss_felmyst : public BossAI
|
||||
void JustEngagedWith(Unit* who) override
|
||||
{
|
||||
BossAI::JustEngagedWith(who);
|
||||
me->CastSpell(me, SPELL_NOXIOUS_FUMES, true);
|
||||
|
||||
me->m_Events.AddEventAtOffset([&] {
|
||||
Talk(YELL_BERSERK);
|
||||
DoCastSelf(SPELL_BERSERK, true);
|
||||
@ -144,7 +144,7 @@ struct boss_felmyst : public BossAI
|
||||
|
||||
Position landPos = who->GetPosition();
|
||||
me->m_Events.AddEventAtOffset([&, landPos] {
|
||||
me->GetMotionMaster()->MovePoint(POINT_GROUND, landPos, false, true);
|
||||
me->GetMotionMaster()->MoveLand(POINT_GROUND, landPos);
|
||||
}, 2s);
|
||||
}
|
||||
|
||||
@ -168,11 +168,14 @@ struct boss_felmyst : public BossAI
|
||||
|
||||
void MovementInform(uint32 type, uint32 point) override
|
||||
{
|
||||
if (type != POINT_MOTION_TYPE)
|
||||
if (type != EFFECT_MOTION_TYPE && type != POINT_MOTION_TYPE)
|
||||
return;
|
||||
|
||||
if (point == POINT_GROUND)
|
||||
{
|
||||
if (!me->HasAura(SPELL_NOXIOUS_FUMES))
|
||||
DoCastSelf(SPELL_NOXIOUS_FUMES, true);
|
||||
|
||||
me->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
|
||||
me->SetCanFly(false);
|
||||
me->SetDisableGravity(false);
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
#include "OutdoorPvPScript.h"
|
||||
#include "Player.h"
|
||||
#include "ReputationMgr.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "Transport.h"
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
@ -117,7 +118,9 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player* player, uint32 trigger)
|
||||
// add 19 honor
|
||||
player->RewardHonor(nullptr, 1, 19);
|
||||
// add 20 cenarion circle repu
|
||||
player->GetReputationMgr().ModifyReputation(sFactionStore.LookupEntry(609), 20.f);
|
||||
float reputation = 20.f;
|
||||
sScriptMgr->OnPlayerBeforeReputationChange(player, 609, reputation, ReputationSource::PvP);
|
||||
player->GetReputationMgr().ModifyReputation(sFactionStore.LookupEntry(609), reputation);
|
||||
// complete quest
|
||||
player->KilledMonsterCredit(SI_TURNIN_QUEST_CM_A);
|
||||
}
|
||||
@ -143,7 +146,9 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player* player, uint32 trigger)
|
||||
// add 19 honor
|
||||
player->RewardHonor(nullptr, 1, 19);
|
||||
// add 20 cenarion circle repu
|
||||
player->GetReputationMgr().ModifyReputation(sFactionStore.LookupEntry(609), 20.f);
|
||||
float reputation = 20.f;
|
||||
sScriptMgr->OnPlayerBeforeReputationChange(player, 609, reputation, ReputationSource::PvP);
|
||||
player->GetReputationMgr().ModifyReputation(sFactionStore.LookupEntry(609), reputation);
|
||||
// complete quest
|
||||
player->KilledMonsterCredit(SI_TURNIN_QUEST_CM_H);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user