#W# Crafting and Gathering skills don't count towards skill cap.

This commit is contained in:
WarrentyExpired 2026-08-07 18:39:32 -04:00
parent f556a5a740
commit 5f61347479
3 changed files with 51 additions and 17 deletions

View file

@ -121,16 +121,19 @@ namespace Server.Misc
{
if ( from.Skills.Cap == 0 )
return false;
double gainer = 2.0;
gainer = gainer - ValidSettings.SkillGain();
double gainer = 2.0;
gainer = gainer - ValidSettings.SkillGain();
bool success = ( chance >= Utility.RandomDouble() );
double gc = (double)(from.Skills.Cap - from.Skills.Total) / from.Skills.Cap;
gc += ( skill.Cap - skill.Base ) / skill.Cap;
gc /= gainer;
gc /= gainer;
gc /= 2;
gc += ( 1.0 - chance ) * ( success ? 0.5 : (Core.AOS ? 0.0 : 0.2) );
gc /= gainer;
gc /= gainer;
gc /= 2;
gc *= skill.Info.GainFactor;
@ -212,8 +215,9 @@ namespace Server.Misc
toGain = Utility.Random( 4 ) + 1;
Skills skills = from.Skills;
bool isSecondarySkill = skill.IsSecondarySkill();
if ( from.Player && ( skills.Total / skills.Cap ) >= Utility.RandomDouble() )//( skills.Total >= skills.Cap )
if ( !isSecondarySkill && from.Player && ( skills.Total / skills.Cap ) >= Utility.RandomDouble() )//( skills.Total >= skills.Cap )
{
for ( int i = 0; i < skills.Length; ++i )
{
@ -234,7 +238,7 @@ namespace Server.Misc
toGain *= Utility.RandomMinMax(2, 5);
#endregion
if ( !from.Player || (skills.Total + toGain) <= skills.Cap )
if ( !from.Player || isSecondarySkill || (skills.Total + toGain) <= skills.Cap )
{
skill.BaseFixedPoint += toGain;
}
@ -244,11 +248,11 @@ namespace Server.Misc
{
SkillInfo info = skill.Info;
if ( from.StrLock == StatLockType.Up && (info.StrGain / ValidSettings.StatGain()) > Utility.RandomDouble() )
if ( from.StrLock == StatLockType.Up && (info.StrGain / 33.3) > Utility.RandomDouble() )
GainStat( from, Stat.Str );
else if ( from.DexLock == StatLockType.Up && (info.DexGain / ValidSettings.StatGain()) > Utility.RandomDouble() )
else if ( from.DexLock == StatLockType.Up && (info.DexGain / 33.3) > Utility.RandomDouble() )
GainStat( from, Stat.Dex );
else if ( from.IntLock == StatLockType.Up && (info.IntGain / ValidSettings.StatGain()) > Utility.RandomDouble() )
else if ( from.IntLock == StatLockType.Up && (info.IntGain / 33.3) > Utility.RandomDouble() )
GainStat( from, Stat.Int );
}
}
@ -337,7 +341,7 @@ namespace Server.Misc
}
}
private static TimeSpan m_StatGainDelay = ValidSettings.StatGainDelay(); //TimeSpan.FromMinutes( ( Core.ML ) ? 0.05 : 15 );
private static TimeSpan m_StatGainDelay = TimeSpan.FromMinutes( ( Core.ML ) ? 0.05 : 15 );
private static TimeSpan m_PetStatGainDelay = TimeSpan.FromMinutes( 5.0 );
public static void GainStat( Mobile from, Stat stat )

View file

@ -2119,7 +2119,7 @@ namespace Server.Network
m_Stream.Write( (ushort) (s.Info.SkillID + 1) );
m_Stream.Write( (ushort) uv );
m_Stream.Write( (ushort) s.BaseFixedPoint );
m_Stream.Write( (ushort) (!s.IsSecondarySkill() ? s.BaseFixedPoint : 0) );
m_Stream.Write( (byte) s.Lock );
m_Stream.Write( (ushort) s.CapFixedPoint );
}
@ -2153,7 +2153,7 @@ namespace Server.Network
m_Stream.Write( (byte) 0xDF ); // type: delta, capped
m_Stream.Write( (ushort) skill.Info.SkillID );
m_Stream.Write( (ushort) uv );
m_Stream.Write( (ushort) skill.BaseFixedPoint );
m_Stream.Write( (ushort) (!skill.IsSecondarySkill() ? skill.BaseFixedPoint : 0 ) );
m_Stream.Write( (byte) skill.Lock );
m_Stream.Write( (ushort) skill.CapFixedPoint );
@ -3909,7 +3909,7 @@ namespace Server.Network
{
}
public CityInfo( string city, string building, int description, int x, int y, int z ) : this( city, building, description, x, y, z, Map.Trammel )
public CityInfo( string city, string building, int description, int x, int y, int z ) : this( city, building, description, x, y, z, Map.Trammel)
{
}

View file

@ -113,6 +113,31 @@ namespace Server
return String.Format( "[{0}: {1}]", Name, Base );
}
public bool IsSecondarySkill()
{
switch(SkillName)
{
// Crafting Skills
case SkillName.Alchemy:
case SkillName.Blacksmith:
case SkillName.Fletching:
case SkillName.Carpentry:
case SkillName.Cooking:
case SkillName.Inscribe:
case SkillName.Tailoring:
case SkillName.Tinkering:
return true;
// Gathering Skills
case SkillName.Forensics:
case SkillName.Lumberjacking:
case SkillName.Mining:
return true;
default:
return false;
}
}
public Skill( Skills owner, SkillInfo info, GenericReader reader )
{
m_Owner = owner;
@ -283,7 +308,10 @@ namespace Server
if ( m_Base != sv )
{
m_Owner.Total = (m_Owner.Total - m_Base) + sv;
if (!IsSecondarySkill())
m_Owner.Total = (m_Owner.Total - m_Base) + sv;
int delta = value - sv;
m_Base = sv;
@ -1016,7 +1044,8 @@ namespace Server
else
{
sk.Serialize( writer );
m_Total += sk.BaseFixedPoint;
if (!sk.IsSecondarySkill())
m_Total += sk.BaseFixedPoint;
}
}
}
@ -1072,7 +1101,8 @@ namespace Server
if ( sk.BaseFixedPoint != 0 || sk.CapFixedPoint != 1000 || sk.Lock != SkillLock.Up )
{
m_Skills[i] = sk;
m_Total += sk.BaseFixedPoint;
if (!sk.IsSecondarySkill())
m_Total += sk.BaseFixedPoint;
}
}
else
@ -1120,4 +1150,4 @@ namespace Server
return m_Skills.Where(s => s != null).GetEnumerator();
}
}
}
}