Merge branch 'master' into 303

Conflicts:
	src/game/Player.cpp
	src/mangosd/mangosd.conf.dist.in
This commit is contained in:
tomrus88 2008-11-30 14:05:56 +03:00
commit ee7f7a0a08
25 changed files with 419 additions and 199 deletions

View file

@ -596,13 +596,22 @@ bool Player::Create( uint32 guidlow, std::string name, uint8 race, uint8 class_,
}
// set starting level
if(getClass() == CLASS_DEATH_KNIGHT)
SetUInt32Value(UNIT_FIELD_LEVEL, 55);
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) );
{
if(getClass() == CLASS_DEATH_KNIGHT)
SetUInt32Value(UNIT_FIELD_LEVEL, 55);
else
SetUInt32Value(UNIT_FIELD_LEVEL, sWorld.getConfig(CONFIG_START_PLAYER_LEVEL));
}
InitRunes();
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));
// Played time
m_Last_tick = time(NULL);
m_Played_time[0] = 0;
@ -838,8 +847,8 @@ void Player::HandleDrowning()
if(!m_isunderwater)
return;
//if have water breath , then remove bar
if(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;
@ -2197,7 +2206,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)
@ -2272,7 +2281,7 @@ void Player::InitStatsForLevel(bool reapplyMods)
SetUInt32Value(PLAYER_FIELD_MAX_LEVEL, sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL) );
SetUInt32Value(PLAYER_NEXT_LEVEL_XP, MaNGOS::XP::xp_to_level(getLevel()));
UpdateMaxSkills ();
UpdateSkillsForLevel ();
// set default cast time multiplier
SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f);
@ -3783,7 +3792,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.
@ -4906,9 +4915,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)))
@ -4926,11 +4938,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));
}
}
}
@ -5963,6 +5979,18 @@ void Player::UpdateHonorFields()
///An exact honor value can also be given (overriding the calcs)
bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, float honor)
{
// 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;