diff --git a/src/game/BattleGround/BattleGround.h b/src/game/BattleGround/BattleGround.h index 669b8f61a..c8f0e7124 100644 --- a/src/game/BattleGround/BattleGround.h +++ b/src/game/BattleGround/BattleGround.h @@ -531,6 +531,7 @@ class BattleGround // since arenas can be AvA or Hvh, we have to get the "temporary" team of a player Team GetPlayerTeam(ObjectGuid guid); + uint32 GetRemainingTime() const { return m_EndTime; } static Team GetOtherTeam(Team team) { return team ? ((team == ALLIANCE) ? HORDE : ALLIANCE) : TEAM_NONE; } static BattleGroundTeamIndex GetOtherTeamIndex(BattleGroundTeamIndex teamIdx) { return teamIdx == BG_TEAM_ALLIANCE ? BG_TEAM_HORDE : BG_TEAM_ALLIANCE; } bool IsPlayerInBattleGround(ObjectGuid guid); diff --git a/src/game/Object/Player.cpp b/src/game/Object/Player.cpp index bb188f154..5810cc295 100644 --- a/src/game/Object/Player.cpp +++ b/src/game/Object/Player.cpp @@ -4182,6 +4182,12 @@ bool Player::HasSpell(uint32 spell) const !itr->second.disabled); } +bool Player::HasTalent(uint32 spell, uint8 spec) const +{ + PlayerTalentMap::const_iterator itr = m_talents[spec].find(spell); + return (itr != m_talents[spec].end() && itr->second.state != PLAYERSPELL_REMOVED); +} + bool Player::HasActiveSpell(uint32 spell) const { PlayerSpellMap::const_iterator itr = m_spells.find(spell); @@ -6736,6 +6742,16 @@ std::string Player::GetGuildName() const return ""; } +time_t Player::GetTalentResetTime() const +{ + return m_resetTalentsTime; +} + +uint32 Player::GetTalentResetCost() const +{ + return resetTalentsCost(); // this function added in dev21 - remove this comment if this line works +} + uint32 Player::GetGuildIdFromDB(ObjectGuid guid) { uint32 lowguid = guid.GetCounter(); @@ -21716,6 +21732,39 @@ void Player::SendCorpseReclaimDelay(bool load) GetSession()->SendPacket(&data); } +uint32 Player::GetNextResetTalentsCost() const +{ + // The first time reset costs 1 gold + if (GetTalentResetCost() < 1 * GOLD) + return 1 * GOLD; + // then 5 gold + else if (GetTalentResetCost() < 5 * GOLD) + return 5 * GOLD; + // After that it increases in increments of 5 gold + else if (GetTalentResetCost() < 10 * GOLD) + return 10 * GOLD; + else + { + uint64 months = (sWorld.GetGameTime() - GetTalentResetTime()) / MONTH; + if (months > 0) + { + // This cost will be reduced by a rate of 5 gold per month + int32 new_cost = int32(GetTalentResetCost() - 5 * GOLD*months); + // to a minimum of 10 gold. + return (new_cost < 10 * GOLD ? 10 * GOLD : new_cost); + } + else + { + // After that it increases in increments of 5 gold + int32 new_cost = GetTalentResetCost() + 5 * GOLD; + // until it hits a cap of 50 gold. + if (new_cost > 50 * GOLD) + new_cost = 50 * GOLD; + return new_cost; + } + } +} + Player* Player::GetNextRandomRaidMember(float radius) { Group* pGroup = GetGroup(); diff --git a/src/game/Object/Player.h b/src/game/Object/Player.h index 41226233a..724f44b39 100644 --- a/src/game/Object/Player.h +++ b/src/game/Object/Player.h @@ -1590,6 +1590,7 @@ class Player : public Unit void RemovePetActionBar(); bool HasSpell(uint32 spell) const override; + bool HasTalent(uint32 spell, uint8 spec) const; bool HasActiveSpell(uint32 spell) const; // show in spellbook TrainerSpellState GetTrainerSpellState(TrainerSpell const* trainer_spell, uint32 reqLevel) const; bool IsSpellFitByClassAndRace(uint32 spell_id, uint32* pReqlevel = NULL) const; @@ -1760,6 +1761,8 @@ class Player : public Unit uint32 GetGuildId() const { return GetGuildGuid().GetCounter(); } ObjectGuid GetGuildGuid() const { return GetGuidValue(OBJECT_FIELD_DATA); } std::string GetGuildName() const; + uint32 GetTalentResetCost() const; + time_t Player::GetTalentResetTime() const; static uint32 GetGuildIdFromDB(ObjectGuid guid); static ObjectGuid GetGuildGuidFromDB(ObjectGuid guid); void SendGuildDeclined(std::string name, bool autodecline); @@ -2341,6 +2344,7 @@ class Player : public Unit void SetGroupUpdateFlag(uint32 flag) { m_groupUpdateMask |= flag; } const uint64& GetAuraUpdateMask() const { return m_auraUpdateMask; } void SetAuraUpdateMask(uint8 slot) { m_auraUpdateMask |= (uint64(1) << slot); } + uint32 GetNextResetTalentsCost() const; Player* GetNextRandomRaidMember(float radius); PartyResult CanUninviteFromGroup() const; // BattleGround Group System diff --git a/src/modules/Eluna/UnitMethods.h b/src/modules/Eluna/UnitMethods.h index e17274788..e1b0ac6e2 100644 --- a/src/modules/Eluna/UnitMethods.h +++ b/src/modules/Eluna/UnitMethods.h @@ -2211,7 +2211,7 @@ namespace LuaUnit for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i) { uint8 eff = (uint8)spellInfo->GetSpellEffect(SpellEffectIndex(i)); - // uint8 eff = spellInfo->Effect[i]; // Effect is a member of SpellEffectIndex, nit SpellEvent + // uint8 eff = spellInfo->Effect[i]; // Effect is a member of SpellEffectIndex, not SpellEvent if (eff >= TOTAL_SPELL_EFFECTS) continue; if (IsAreaAuraEffect(eff) ||