Core/Spells: fixed Mobile Banking guild perk

*Misc: moved guild faction define to the other faction enums
This commit is contained in:
Ovahlord committed 2020-04-23 03:45:43 +02:00
1 parent bc178168cd
commit a850243e89
6 files changed
+55 -9

No files matched your search

@@ -0,0 +1,5 @@
DELETE FROM `spell_script_names` WHERE `ScriptName` IN
('spell_gen_mobile_banking');
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(83958, 'spell_gen_mobile_banking');
@@ -3013,7 +3013,7 @@ bool AchievementMgr<T>::AdditionalRequirementsSatisfied(AchievementCriteriaEntry
break;
}
case ACHIEVEMENT_CRITERIA_ADDITIONAL_CONDITION_GUILD_REPUTATION: // 62
if (referencePlayer->GetReputation(PLAYER_GUILD_REPUTATION) < reqValue)
if (referencePlayer->GetReputation(FACTION_GUILD) < reqValue)
return false;
break;
case ACHIEVEMENT_CRITERIA_ADDITIONAL_CONDITION_PROJECT_RARITY: // 65
-1
View File
@@ -90,7 +90,6 @@ typedef std::deque<Mail*> PlayerMails;
#define PLAYER_MAX_SKILLS 128
#define PLAYER_MAX_DAILY_QUESTS 25
#define PLAYER_EXPLORED_ZONES_SIZE 156
#define PLAYER_GUILD_REPUTATION 1168
// Note: SPELLMOD_* values is aura types in fact
enum SpellModType : uint8
+7 -7
View File
@@ -693,7 +693,7 @@ void Guild::Member::SetStats(Player* player)
_gender = player->GetByteValue(PLAYER_BYTES_3, PLAYER_BYTES_3_OFFSET_GENDER);
m_accountId = player->GetSession()->GetAccountId();
m_achievementPoints = player->GetAchievementPoints();
m_totalReputation = player->GetReputation(PLAYER_GUILD_REPUTATION);
m_totalReputation = player->GetReputation(FACTION_GUILD);
}
void Guild::Member::SetStats(std::string const& name, uint8 level, uint8 _class, uint32 zoneId, uint32 accountId, uint32 achievementPoints, uint32 reputation)
@@ -941,10 +941,10 @@ void Guild::Member::AddReputation(uint32 rep, Player *player)
{
rep = std::min(rep, sWorld->getIntConfig(CONFIG_GUILD_WEEKLY_REP_CAP) - m_weekReputation);
player->GetReputationMgr().ModifyReputation(sFactionStore.LookupEntry(PLAYER_GUILD_REPUTATION), rep);
player->GetReputationMgr().ModifyReputation(sFactionStore.LookupEntry(FACTION_GUILD), rep);
m_weekReputation += rep;
m_totalReputation = player->GetReputation(PLAYER_GUILD_REPUTATION);
m_totalReputation = player->GetReputation(FACTION_GUILD);
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GUILD_MEMBER_WEEK_REPUTATION);
stmt->setUInt32(0, m_weekReputation);
@@ -2979,8 +2979,8 @@ bool Guild::AddMember(CharacterDatabaseTransaction& trans, ObjectGuid guid, uint
if (player)
{
if (!keepGuildReputation || !player->GetReputation(PLAYER_GUILD_REPUTATION))
player->SetReputation(PLAYER_GUILD_REPUTATION, 0);
if (!keepGuildReputation || !player->GetReputation(FACTION_GUILD))
player->SetReputation(FACTION_GUILD, 0);
m_members[lowguid] = member;
player->SetInGuild(m_id);
@@ -3025,9 +3025,9 @@ bool Guild::AddMember(CharacterDatabaseTransaction& trans, ObjectGuid guid, uint
if (!keepGuildReputation)
{
stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_REP_FACTION_CHANGE);
stmt2->setUInt16(0, uint16(PLAYER_GUILD_REPUTATION));
stmt2->setUInt16(0, uint16(FACTION_GUILD));
stmt2->setInt32(1, 0);
stmt2->setUInt16(2, uint16(PLAYER_GUILD_REPUTATION));
stmt2->setUInt16(2, uint16(FACTION_GUILD));
stmt2->setUInt32(3, lowguid);
CharacterDatabase.Execute(stmt2);
}
@@ -189,6 +189,7 @@ enum FactionTemplates
FACTION_ESCORTEE_A_PASSIVE = 774,
FACTION_ESCORTEE_H_PASSIVE = 775,
FACTION_UNDEAD_SCOURGE = 974,
FACTION_GUILD = 1168,
FACTION_EARTHEN_RING = 1726,
FACTION_ALLIANCE_GENERIC_WG = 1732,
FACTION_HORDE_GENERIC_WG = 1735,
@@ -5261,6 +5261,46 @@ class spell_gen_guild_battle_standard_buff : public SpellScript
}
};
enum MobileBanking
{
SPELL_GUILD_CHEST = 88306
};
class spell_gen_mobile_banking : public SpellScript
{
PrepareSpellScript(spell_gen_mobile_banking);
bool Load() override
{
return GetCaster()->IsPlayer();
}
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_GUILD_CHEST });
}
SpellCastResult CheckRequirement()
{
// The player must have a guild reputation rank of friendly or higher to use the mobile banking ability
if (GetCaster()->ToPlayer()->GetReputationRank(FACTION_GUILD) < REP_FRIENDLY)
return SPELL_FAILED_REPUTATION;
return SPELL_CAST_OK;
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
GetHitUnit()->CastSpell(GetHitUnit(), SPELL_GUILD_CHEST);
}
void Register() override
{
OnCheckCast += SpellCheckCastFn(spell_gen_mobile_banking::CheckRequirement);
OnEffectHitTarget += SpellEffectFn(spell_gen_mobile_banking::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
void AddSC_generic_spell_scripts()
{
new spell_gen_absorb0_hitlimit1();
@@ -5386,4 +5426,5 @@ void AddSC_generic_spell_scripts()
RegisterAuraScript(spell_gen_sunflower_dnd);
RegisterAuraScript(spell_gen_guild_battle_standard);
RegisterSpellScript(spell_gen_guild_battle_standard_buff);
RegisterSpellScript(spell_gen_mobile_banking);
}