aboutsummaryrefslogtreecommitdiff
path: root/src/game/Player.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Player.cpp')
-rw-r--r--src/game/Player.cpp59
1 files changed, 37 insertions, 22 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index b1dfb911c2b..783172a89d4 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -593,18 +593,14 @@ bool Player::Create( uint32 guidlow, std::string name, uint8 race, uint8 class_,
SetUInt32Value( PLAYER_FIELD_YESTERDAY_CONTRIBUTION, 0 );
// set starting level
- if(GetSession()->GetSecurity() >= SEC_MODERATOR)
- SetUInt32Value( UNIT_FIELD_LEVEL, sWorld.getConfig(CONFIG_GM_START_LEVEL) );
+ if (GetSession()->GetSecurity() >= SEC_MODERATOR)
+ SetUInt32Value (UNIT_FIELD_LEVEL, sWorld.getConfig(CONFIG_START_GM_LEVEL));
else
- SetUInt32Value( UNIT_FIELD_LEVEL, sWorld.getConfig(CONFIG_START_PLAYER_LEVEL) );
- // set starting gold
- SetUInt32Value( PLAYER_FIELD_COINAGE, sWorld.getConfig(CONFIG_PLAYER_START_GOLD) );
+ SetUInt32Value (UNIT_FIELD_LEVEL, sWorld.getConfig(CONFIG_START_PLAYER_LEVEL));
- // set starting honor
- SetUInt32Value( PLAYER_FIELD_HONOR_CURRENCY, sWorld.getConfig(CONFIG_PLAYER_START_HONOR) );
-
- // set starting arena pts
- SetUInt32Value( PLAYER_FIELD_ARENA_CURRENCY, sWorld.getConfig(CONFIG_PLAYER_START_ARENAPTS) );
+ SetUInt32Value (PLAYER_FIELD_COINAGE, sWorld.getConfig(CONFIG_START_PLAYER_MONEY));
+ SetUInt32Value (PLAYER_FIELD_HONOR_CURRENCY, sWorld.getConfig(CONFIG_START_HONOR_POINTS));
+ SetUInt32Value (PLAYER_FIELD_ARENA_CURRENCY, sWorld.getConfig(CONFIG_START_ARENA_POINTS));
// start with every map explored
if(sWorld.getConfig(CONFIG_START_ALL_EXPLORED))
@@ -883,8 +879,8 @@ void Player::HandleDrowning()
if(!m_isunderwater)
return;
- //if players is GM, have waterbreath, dead or breathing is disabled
- if(sWorld.getConfig(CONFIG_DISABLE_BREATHING) || waterbreath || isGameMaster() || !isAlive())
+ //if player is GM, have waterbreath, is dead or if breathing is disabled then return
+ if(waterbreath || isGameMaster() || !isAlive() || GetSession()->GetSecurity() >= sWorld.getConfig(CONFIG_DISABLE_BREATHING))
{
StopMirrorTimer(BREATH_TIMER);
m_isunderwater = 0;
@@ -1415,7 +1411,7 @@ void Player::BuildEnumData( QueryResult * result, WorldPacket * p_data )
*p_data << GetPositionY();
*p_data << GetPositionZ();
- *p_data << GetUInt32Value(PLAYER_GUILDID); // guild id
+ *p_data << (result ? result->Fetch()[13].GetUInt32() : 0);
uint32 char_flags = 0;
if(HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_HELM))
@@ -1428,7 +1424,7 @@ void Player::BuildEnumData( QueryResult * result, WorldPacket * p_data )
char_flags |= CHARACTER_FLAG_RENAME;
// always send the flag if declined names aren't used
// to let the client select a default method of declining the name
- if(!sWorld.getConfig(CONFIG_DECLINED_NAMES_USED) || (result && result->Fetch()[13].GetCppString() != ""))
+ if(!sWorld.getConfig(CONFIG_DECLINED_NAMES_USED) || (result && result->Fetch()[14].GetCppString() != ""))
char_flags |= CHARACTER_FLAG_DECLINED;
*p_data << (uint32)char_flags; // character flags
@@ -2245,7 +2241,7 @@ void Player::GiveLevel(uint32 level)
if(getLevel()!= level)
m_Played_time[1] = 0; // Level Played Time reset
SetLevel(level);
- UpdateMaxSkills();
+ UpdateSkillsForLevel ();
// save base values (bonuses already included in stored stats
for(int i = STAT_STRENGTH; i < MAX_STATS; ++i)
@@ -2321,7 +2317,7 @@ void Player::InitStatsForLevel(bool reapplyMods)
SetUInt32Value(PLAYER_FIELD_MAX_LEVEL, sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL) );
SetUInt32Value(PLAYER_NEXT_LEVEL_XP, Trinity::XP::xp_to_level(getLevel()));
- UpdateMaxSkills ();
+ UpdateSkillsForLevel ();
// set default cast time multiplier
SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f);
@@ -3851,7 +3847,7 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness)
// some items limited to specific map
DestroyZoneLimitedItem( true, GetZoneId());
- if(!applySickness || getLevel() <= 10)
+ if(!applySickness)
return;
//Characters from level 1-10 are not affected by resurrection sickness.
@@ -4972,9 +4968,12 @@ void Player::ModifySkillBonus(uint32 skillid,int32 val, bool talent)
}
}
-void Player::UpdateMaxSkills()
+void Player::UpdateSkillsForLevel()
{
uint16 maxconfskill = sWorld.GetConfigMaxSkillValue();
+ uint32 maxSkill = GetMaxSkillValueForLevel();
+
+ bool alwaysMaxSkill = sWorld.getConfig(CONFIG_ALWAYS_MAX_SKILL_FOR_LEVEL);
for (uint16 i=0; i < PLAYER_MAX_SKILLS; i++)
if (GetUInt32Value(PLAYER_SKILL_INDEX(i)))
@@ -4992,11 +4991,15 @@ void Player::UpdateMaxSkills()
uint32 max = SKILL_MAX(data);
uint32 val = SKILL_VALUE(data);
- // update only level dependent max skill values
- if(max!=1 && max != maxconfskill)
+ /// update only level dependent max skill values
+ if(max!=1)
{
- uint32 max_Skill = GetMaxSkillValueForLevel();
- SetUInt32Value(PLAYER_SKILL_VALUE_INDEX(i),MAKE_SKILL_VALUE(val,max_Skill));
+ /// miximize skill always
+ if(alwaysMaxSkill)
+ SetUInt32Value(PLAYER_SKILL_VALUE_INDEX(i),MAKE_SKILL_VALUE(maxSkill,maxSkill));
+ /// update max skill value if current max skill not maximized
+ else if(max != maxconfskill)
+ SetUInt32Value(PLAYER_SKILL_VALUE_INDEX(i),MAKE_SKILL_VALUE(val,maxSkill));
}
}
}
@@ -6019,6 +6022,18 @@ void Player::UpdateHonorFields()
///An exact honor value can also be given (overriding the calcs)
bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, float honor, bool pvptoken)
{
+ // do not reward honor in arenas, but enable onkill spellproc
+ if(InArena())
+ {
+ if(!uVictim || uVictim == this || uVictim->GetTypeId() != TYPEID_PLAYER)
+ return false;
+
+ if( GetBGTeam() == ((Player*)uVictim)->GetBGTeam() )
+ return false;
+
+ return true;
+ }
+
// 'Inactive' this aura prevents the player from gaining honor points and battleground tokens
if(GetDummyAura(SPELL_AURA_PLAYER_INACTIVE))
return false;