[6862] Some additional mangosd.conf options for player startup and gameplay customizing.

Signed-off-by: dythzer <micke223@gmail.com>

Some implementations rewrited. And suggested option names changed.
Also now gm not allowed logout instant in case fight/duel to prevent unexpected death.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
dythzer 2008-11-30 10:08:18 +03:00 committed by VladimirMangos
parent 8dfbcf7ee6
commit 7ea5f922ea
8 changed files with 166 additions and 30 deletions

View file

@ -580,7 +580,14 @@ bool Player::Create( uint32 guidlow, std::string name, uint8 race, uint8 class_,
SetUInt32Value( PLAYER_FIELD_YESTERDAY_CONTRIBUTION, 0 );
// set starting level
SetUInt32Value( UNIT_FIELD_LEVEL, sWorld.getConfig(CONFIG_START_PLAYER_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));
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);
@ -809,8 +816,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;
@ -2149,7 +2156,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)
@ -2222,7 +2229,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);
@ -3729,7 +3736,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.
@ -4849,9 +4856,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)))
@ -4869,11 +4879,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));
}
}
}