diff options
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 49 | ||||
-rw-r--r-- | src/server/game/Entities/Player/Player.h | 3 | ||||
-rw-r--r-- | src/server/game/Movement/Spline/MoveSplineInit.cpp | 2 |
3 files changed, 20 insertions, 34 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 13c52109fcd..3ccf62abd42 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -497,9 +497,8 @@ bool Player::Create(ObjectGuid::LowType guidlow, CharacterCreateInfo* createInfo SetPvpFlag(UNIT_BYTE2_FLAG_PVP); SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED); } + SetUnitFlag2(UNIT_FLAG2_REGENERATE_POWER); - SetModCastingSpeed(1.0f); // fix cast time showed in spell tooltip on client - SetHoverHeight(1.0f); // default for players in 3.0.3 SetInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, uint32(-1)); // -1 is default value @@ -510,37 +509,9 @@ bool Player::Create(ObjectGuid::LowType guidlow, CharacterCreateInfo* createInfo SetFacialStyle(createInfo->FacialHair); SetRestState((GetSession()->IsARecruiter() || GetSession()->GetRecruiterId() != 0) ? REST_STATE_RAF_LINKED : REST_STATE_NOT_RAF_LINKED); SetNativeGender(Gender(createInfo->Gender)); - SetArenaFaction(0); - - SetUInt32Value(PLAYER_GUILDID, 0); - SetGuildRank(0); - SetUInt32Value(PLAYER_GUILD_TIMESTAMP, 0); - - for (int i = 0; i < KNOWN_TITLES_SIZE; ++i) - SetUInt64Value(PLAYER__FIELD_KNOWN_TITLES + i, 0); // 0=disabled - SetUInt32Value(PLAYER_CHOSEN_TITLE, 0); - - SetUInt32Value(PLAYER_FIELD_KILLS, 0); - SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, 0); - SetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION, 0); - SetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION, 0); // set starting level - uint32 start_level = GetClass() != CLASS_DEATH_KNIGHT - ? sWorld->getIntConfig(CONFIG_START_PLAYER_LEVEL) - : sWorld->getIntConfig(CONFIG_START_DEATH_KNIGHT_PLAYER_LEVEL); - - if (m_session->HasPermission(rbac::RBAC_PERM_USE_START_GM_LEVEL)) - { - uint32 gm_level = GetClass() != CLASS_DEATH_KNIGHT - ? sWorld->getIntConfig(CONFIG_START_GM_LEVEL) - : std::max(sWorld->getIntConfig(CONFIG_START_GM_LEVEL), sWorld->getIntConfig(CONFIG_START_DEATH_KNIGHT_PLAYER_LEVEL)); - - if (gm_level > start_level) - start_level = gm_level; - } - - SetLevel(start_level, false); + SetLevel(GetStartLevel(createInfo->Class), false); InitRunes(); @@ -2677,7 +2648,7 @@ void Player::InitStatsForLevel(bool reapplyMods) { SetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + i, 0); SetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + i, 0); - SetFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT + i, 1.00f); + SetFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT + i, 1.0f); } //reset attack power, damage and attack speed fields @@ -11296,7 +11267,6 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16 &dest, Item* pItem, bool // Do not allow polearm to be equipped in the offhand (rare case for the only 1h polearm 41750) if (type == INVTYPE_WEAPON && pProto->SubClass == ITEM_SUBCLASS_WEAPON_POLEARM) return EQUIP_ERR_WRONG_SLOT; - else if (type == INVTYPE_WEAPON || type == INVTYPE_WEAPONOFFHAND) { if (!CanDualWield()) @@ -22221,6 +22191,19 @@ void Player::ReportedAfkBy(Player* reporter) reporter->SendDirectMessage(reportAfkResult.Write()); } +uint8 Player::GetStartLevel(uint8 playerClass) const +{ + uint8 startLevel = sWorld->getIntConfig(CONFIG_START_PLAYER_LEVEL); + + if (playerClass == CLASS_DEATH_KNIGHT) + startLevel = std::max<uint8>(sWorld->getIntConfig(CONFIG_START_DEATH_KNIGHT_PLAYER_LEVEL), startLevel); + + if (m_session->HasPermission(rbac::RBAC_PERM_USE_START_GM_LEVEL)) + startLevel = std::max<uint8>(sWorld->getIntConfig(CONFIG_START_GM_LEVEL), startLevel); + + return startLevel; +} + WorldLocation Player::GetStartPosition() const { PlayerInfo const* info = sObjectMgr->GetPlayerInfo(GetRace(), GetClass()); diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 5891ecc685c..ba7bb3a16b5 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1673,6 +1673,8 @@ class TC_GAME_API Player : public Unit, public GridObject<Player> float OCTRegenMPPerSpirit() const; float GetRatingMultiplier(CombatRating cr) const; float GetRatingBonusValue(CombatRating cr) const; + + /// Returns base spellpower bonus from spellpower stat on items uint32 GetBaseSpellPowerBonus() const { return m_baseSpellPower; } int32 GetSpellPenetrationItemMod() const { return m_spellPenetrationItemMod; } @@ -2065,6 +2067,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player> float m_homebindY; float m_homebindZ; + uint8 GetStartLevel(uint8 playerClass) const; WorldLocation GetStartPosition() const; // currently visible objects at player client diff --git a/src/server/game/Movement/Spline/MoveSplineInit.cpp b/src/server/game/Movement/Spline/MoveSplineInit.cpp index d09ce2c2e4e..0b9c767123b 100644 --- a/src/server/game/Movement/Spline/MoveSplineInit.cpp +++ b/src/server/game/Movement/Spline/MoveSplineInit.cpp @@ -61,7 +61,7 @@ namespace Movement MoveSpline& move_spline = *unit->movespline; // Elevators also use MOVEMENTFLAG_ONTRANSPORT but we do not keep track of their position changes (movementInfo.transport.guid is 0 in that case) - bool transport = unit->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) && unit->GetTransGUID(); + bool transport = unit->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) && !unit->GetTransGUID().IsEmpty(); Location real_position; // there is a big chance that current position is unknown if current state is not finalized, need compute it // this also allows CalculatePath spline position and update map position in much greater intervals |