|
||
|
|||||||
| Script Support Get support for modifying RunUO Scripts, or writing your own! |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Join Date: Nov 2003
Location: Holland
Posts: 138
|
Hi all,
I tried fixing the skillcheck.cs but cant get it right. My players start with 65 in the base skills. I made a mage with 65 in all his 4 base skills. Bought the base taming and lore skills in the stable and started to tame to check the gaining. I want fast skillgain on th shard, even some times when you fail in taming. Stats gained good but taming and lore every 3 minutes and that way to slow ! :-) What do i need to change plz? Can and will any body hlep me in this plz I put what i changed sofar below ------------------------------------- using System; using Server; using Server.Mobiles; namespace Server.Misc { public class SkillCheck { private const bool AntiMacroCode = false; //Change this to false to disable anti-macro code public static TimeSpan AntiMacroExpire = TimeSpan.FromMinutes( 0.5 ); //How long do we remember targets/locations? public const int Allowance = 10; //How many times may we use the same location/target for gain private const int LocationSize = 1; //The size of eeach location, make this smaller so players dont have to move as far private static bool[] UseAntiMacro = new bool[] { // true if this skill uses the anti-macro code, false if it does not false,// Alchemy = 0, false,// Anatomy = 1, false,// AnimalLore = 2, false,// ItemID = 3, false,// ArmsLore = 4, false,// Parry = 5, false,// Begging = 6, false,// Blacksmith = 7, false,// Fletching = 8, false,// Peacemaking = 9, false,// Camping = 10, false,// Carpentry = 11, false,// Cartography = 12, false,// Cooking = 13, false,// DetectHidden = 14, false,// Discordance = 15, false,// EvalInt = 16, false,// Healing = 17, false,// Fishing = 18, false,// Forensics = 19, false,// Herding = 20, false,// Hiding = 21, false,// Provocation = 22, false,// Inscribe = 23, false,// Lockpicking = 24, false,// Magery = 25, false,// MagicResist = 26, false,// Tactics = 27, false,// Snooping = 28, false,// Musicianship = 29, false,// Poisoning = 30, false,// Archery = 31, false,// SpiritSpeak = 32, false,// Stealing = 33, false,// Tailoring = 34, false,// AnimalTaming = 35, false,// TasteID = 36, false,// Tinkering = 37, false,// Tracking = 38, false,// Veterinary = 39, false,// Swords = 40, false,// Macing = 41, false,// Fencing = 42, false,// Wrestling = 43, false,// Lumberjacking = 44, false,// Mining = 45, false,// Meditation = 46, false,// Stealth = 47, false,// RemoveTrap = 48, false,// Necromancy = 49, false,// Focus = 50, false,// Chivalry = 51 }; public static void Initialize() { Mobile.SkillCheckLocationHandler = new SkillCheckLocationHandler( Mobile_SkillCheckLocation ); Mobile.SkillCheckDirectLocationHandler = new SkillCheckDirectLocationHandler( Mobile_SkillCheckDirectLocation ); Mobile.SkillCheckTargetHandler = new SkillCheckTargetHandler( Mobile_SkillCheckTarget ); Mobile.SkillCheckDirectTargetHandler = new SkillCheckDirectTargetHandler( Mobile_SkillCheckDirectTarget ); //*********EDIT THESE LINES TO SET THE BASE PERCENT CHANCE TO GAIN FOR EACH INDIVIDUAL SKILL***********************// //This Table used to set the base chance to gain skill between 40 and 70 //for instance .15 would be a 15% chance to gain in the particular skill SkillInfo.Table[0].GainFactor = .80;// Alchemy = 0, SkillInfo.Table[1].GainFactor = .80;// Anatomy = 1, SkillInfo.Table[2].GainFactor = .80;// AnimalLore = 2, SkillInfo.Table[3].GainFactor = .80;// ItemID = 3, SkillInfo.Table[4].GainFactor = .80;// ArmsLore = 4, SkillInfo.Table[5].GainFactor = .80;// Parry = 5, SkillInfo.Table[6].GainFactor = .80;// Begging = 6, SkillInfo.Table[7].GainFactor = .80;// Blacksmith = 7, SkillInfo.Table[8].GainFactor = .80;// Fletching = 8, SkillInfo.Table[9].GainFactor = .80;// Peacemaking = 9, SkillInfo.Table[10].GainFactor = .80;// Camping = 10, SkillInfo.Table[11].GainFactor = .80;// Carpentry = 11, SkillInfo.Table[12].GainFactor = .80;// Cartography = 12, SkillInfo.Table[13].GainFactor = .80;// Cooking = 13, SkillInfo.Table[14].GainFactor = .80;// DetectHidden = 14, SkillInfo.Table[15].GainFactor = .80;// Discordance = 15, SkillInfo.Table[16].GainFactor = .80;// EvalInt = 16, SkillInfo.Table[17].GainFactor = .80;// Healing = 17, SkillInfo.Table[18].GainFactor = .80;// Fishing = 18, SkillInfo.Table[19].GainFactor = .80;// Forensics = 19, SkillInfo.Table[20].GainFactor = .80;// Herding = 20, SkillInfo.Table[21].GainFactor = .80;// Hiding = 21, SkillInfo.Table[22].GainFactor = .80;// Provocation = 22, SkillInfo.Table[23].GainFactor = .80;// Inscribe = 23, SkillInfo.Table[24].GainFactor = .80;// Lockpicking = 24, SkillInfo.Table[25].GainFactor = .80;// Magery = 25, SkillInfo.Table[26].GainFactor = .80;// MagicResist = 26, SkillInfo.Table[27].GainFactor = .80;// Tactics = 27, SkillInfo.Table[28].GainFactor = .80;// Snooping = 28, SkillInfo.Table[29].GainFactor = .80;// Musicianship = 29, SkillInfo.Table[30].GainFactor = .80;// Poisoning = 30 SkillInfo.Table[31].GainFactor = .80;// Archery = 31 SkillInfo.Table[32].GainFactor = .80;// SpiritSpeak = 32 SkillInfo.Table[33].GainFactor = .80;// Stealing = 33 SkillInfo.Table[34].GainFactor = .80;// Tailoring = 34 SkillInfo.Table[35].GainFactor = .80;// AnimalTaming = 35 SkillInfo.Table[36].GainFactor = .80;// TasteID = 36 SkillInfo.Table[37].GainFactor = .80;// Tinkering = 37 SkillInfo.Table[38].GainFactor = .80;// Tracking = 38 SkillInfo.Table[39].GainFactor = .80;// Veterinary = 39 SkillInfo.Table[40].GainFactor = .80;// Swords = 40 SkillInfo.Table[41].GainFactor = .80;// Macing = 41 SkillInfo.Table[42].GainFactor = .80;// Fencing = 42 SkillInfo.Table[43].GainFactor = .80;// Wrestling = 43 SkillInfo.Table[44].GainFactor = .80;// Lumberjacking = 44 SkillInfo.Table[45].GainFactor = .80;// Mining = 45 SkillInfo.Table[46].GainFactor = .80;// Meditation = 46 SkillInfo.Table[47].GainFactor = .80;// Stealth = 47 SkillInfo.Table[48].GainFactor = .80;// RemoveTrap = 48 SkillInfo.Table[49].GainFactor = .80;// Necromancy = 49 SkillInfo.Table[50].GainFactor = .80;// Focus = 50 SkillInfo.Table[51].GainFactor = .80;// Chivalry = 51 } public static bool Mobile_SkillCheckLocation( Mobile from, SkillName skillName, double minSkill, double maxSkill ) { Skill skill = from.Skills[skillName]; if ( skill == null ) return false; double value = skill.Value; if ( value < minSkill ) return false; // Too difficult else if ( value >= maxSkill ) return true; // No challenge double chance = (value - minSkill) / (maxSkill - minSkill); Point2D loc = new Point2D( from.Location.X / LocationSize, from.Location.Y / LocationSize ); return CheckSkill( from, skill, loc, chance ); } public static bool Mobile_SkillCheckDirectLocation( Mobile from, SkillName skillName, double chance ) { Skill skill = from.Skills[skillName]; if ( skill == null ) return false; if ( chance < 0.0 ) return false; // Too difficult else if ( chance >= 1.0 ) return true; // No challenge Point2D loc = new Point2D( from.Location.X / LocationSize, from.Location.Y / LocationSize ); return CheckSkill( from, skill, loc, chance ); } public static bool CheckSkill( Mobile from, Skill skill, object amObj, double chance ) { if ( from.Skills.Cap == 0 ) return false; bool success = ( chance >= Utility.RandomDouble() ); //**********EDIT THESE LINES FOR MODIFICATIONS TO BASE PERCENTAGE AT DIFFERENT SKILL LEVELS************************// double LowSkillMod = .80; // percent added to skill gain for skill between 0 - 40 double BaseSkillGain = skill.Info.GainFactor; // base percent to gain at skill between 40 - 70 set in table above. double HighSkillMod = .01; // percent subtracted from base gain for skill between 70 - 100 double AboveGmSkillMod = .01; // percent subtracted from base gain for skill over 100 //Example: Player Skill is 85.3 - We would take the 15% base chance and subtract 8% - Player now has a 7% chance to gain. //************************************************** ************************************************** *************// double ComputedSkillMod = 0.99; // holds the percent chance to gain after checking players skill if ( skill.Base < 40.1 ) ComputedSkillMod = BaseSkillGain + LowSkillMod; else if ( skill.Base < 70.1 ) ComputedSkillMod = BaseSkillGain; else if ( skill.Base < 100.1 ) ComputedSkillMod = BaseSkillGain - HighSkillMod; else if ( skill.Base > 100.0 ) ComputedSkillMod = BaseSkillGain - AboveGmSkillMod; if ( ComputedSkillMod < 0.01 ) ComputedSkillMod = 0.01; //following line used to see chance to gain ingame //from.SendMessage( "Your chance to gain {0} is {1}",skill.Name, ComputedSkillMod ); if ( from is BaseCreature && ((BaseCreature)from).Controled ) ComputedSkillMod *= 2; if ( from.Alive && ( ( ComputedSkillMod >= Utility.RandomDouble() && AllowGain( from, skill, amObj ) ) || skill.Base < 1.0 ) ) Gain( from, skill ); return success; } public static bool Mobile_SkillCheckTarget( Mobile from, SkillName skillName, object target, double minSkill, double maxSkill ) { Skill skill = from.Skills[skillName]; if ( skill == null ) return false; double value = skill.Value; if ( value < minSkill ) return false; // Too difficult else if ( value >= maxSkill ) return true; // No challenge double chance = (value - minSkill) / (maxSkill - minSkill); return CheckSkill( from, skill, target, chance ); } public static bool Mobile_SkillCheckDirectTarget( Mobile from, SkillName skillName, object target, double chance ) { Skill skill = from.Skills[skillName]; if ( skill == null ) return false; if ( chance < 0.0 ) return false; // Too difficult else if ( chance >= 1.0 ) return true; // No challenge return CheckSkill( from, skill, target, chance ); } private static bool AllowGain( Mobile from, Skill skill, object obj ) { if ( from is PlayerMobile && AntiMacroCode && UseAntiMacro[skill.Info.SkillID] ) return ((PlayerMobile)from).AntiMacroCheck( skill, obj ); else return true; } public enum Stat { Str, Dex, Int } public static void Gain( Mobile from, Skill skill ) { if ( from.Region is Regions.Jail ) return; if ( from is BaseCreature && ((BaseCreature)from).IsDeadPet ) return; if ( skill.SkillName == SkillName.Focus && from is BaseCreature ) return; if ( skill.Base < skill.Cap && skill.Lock == SkillLock.Up ) { int toGain = 1; if ( skill.Base <= 10.0 ) toGain = Utility.Random( 4 ) + 1; Skills skills = from.Skills; if ( ( skills.Total / skills.Cap ) >= Utility.RandomDouble() )//( skills.Total >= skills.Cap ) { for ( int i = 0; i < skills.Length; ++i ) { Skill toLower = skills[i]; if ( toLower != skill && toLower.Lock == SkillLock.Down && toLower.BaseFixedPoint >= toGain ) { toLower.BaseFixedPoint -= toGain; break; } } } if ( (skills.Total + toGain) <= skills.Cap ) { skill.BaseFixedPoint += toGain; } } if ( skill.Lock == SkillLock.Up ) { SkillInfo info = skill.Info; //*****EDIT THIS LINE TO MAKE STATS GAIN FASTER, NUMBER MUST BE BETWEEN 0.00 and 1.00, THIS IS ADDED TO THE CHANCE TO GAIN IN A STAT********// double StatGainBonus = .80; //Extra chance to gain in stats. Left at 0 would be default runuo gains. //************************************************** ************************************************** **************************************// if ( from.StrLock == StatLockType.Up && ((info.StrGain / 33.3) + StatGainBonus) > Utility.RandomDouble() ) { if( info.StrGain != 0 ) GainStat( from, Stat.Str ); } else if ( from.DexLock == StatLockType.Up && ((info.DexGain / 33.3) + StatGainBonus) > Utility.RandomDouble() ) { if( info.DexGain != 0 ) GainStat( from, Stat.Dex ); } else if ( from.IntLock == StatLockType.Up && ((info.IntGain / 33.3) + StatGainBonus) > Utility.RandomDouble() ) { if( info.IntGain != 0 ) GainStat( from, Stat.Int ); } //following line used to show chance to gain stats ingame //from.SendMessage( "Str: {0} Dex: {1} Int: {2}",((info.StrGain / 33.3) + StatGainBonus),((info.DexGain / 33.3) + StatGainBonus),((info.IntGain / 33.3) + StatGainBonus) ); } } public static bool CanLower( Mobile from, Stat stat ) { switch ( stat ) { case Stat.Str: return ( from.StrLock == StatLockType.Down && from.RawStr > 10 ); case Stat.Dex: return ( from.DexLock == StatLockType.Down && from.RawDex > 10 ); case Stat.Int: return ( from.IntLock == StatLockType.Down && from.RawInt > 10 ); } return false; } public static bool CanRaise( Mobile from, Stat stat ) { if ( !(from is BaseCreature && ((BaseCreature)from).Controled) ) { if ( from.RawStatTotal >= from.StatCap ) return false; } switch ( stat ) { case Stat.Str: return ( from.StrLock == StatLockType.Up && from.RawStr < 125 ); case Stat.Dex: return ( from.DexLock == StatLockType.Up && from.RawDex < 125 ); case Stat.Int: return ( from.IntLock == StatLockType.Up && from.RawInt < 125 ); } return false; } public static void IncreaseStat( Mobile from, Stat stat, bool atrophy ) { atrophy = atrophy || (from.RawStatTotal >= from.StatCap); switch ( stat ) { case Stat.Str: { if ( atrophy ) { if ( CanLower( from, Stat.Dex ) && (from.RawDex < from.RawInt || !CanLower( from, Stat.Int )) ) --from.RawDex; else if ( CanLower( from, Stat.Int ) ) --from.RawInt; } if ( CanRaise( from, Stat.Str ) ) ++from.RawStr; break; } case Stat.Dex: { if ( atrophy ) { if ( CanLower( from, Stat.Str ) && (from.RawStr < from.RawInt || !CanLower( from, Stat.Int )) ) --from.RawStr; else if ( CanLower( from, Stat.Int ) ) --from.RawInt; } if ( CanRaise( from, Stat.Dex ) ) ++from.RawDex; break; } case Stat.Int: { if ( atrophy ) { if ( CanLower( from, Stat.Str ) && (from.RawStr < from.RawDex || !CanLower( from, Stat.Dex )) ) --from.RawStr; else if ( CanLower( from, Stat.Dex ) ) --from.RawDex; } if ( CanRaise( from, Stat.Int ) ) ++from.RawInt; break; } } } private static TimeSpan m_StatGainDelay = TimeSpan.FromMinutes( 2.0 ); public static void GainStat( Mobile from, Stat stat ) { if ( (from.LastStatGain + m_StatGainDelay) >= DateTime.Now ) return; from.LastStatGain = DateTime.Now; bool atrophy = ( (from.RawStatTotal / (double)from.StatCap) >= Utility.RandomDouble() ); IncreaseStat( from, stat, atrophy ); } } } |
|
|
|
|
|
#2 (permalink) |
|
Forum Novice
|
look at this
[code:1] using System; using Server; using Server.Mobiles; namespace Server.Misc { public class SkillCheck { private const bool AntiMacroCode = false; //Change this to false to disable anti-macro code public static TimeSpan AntiMacroExpire = TimeSpan.FromMinutes( 5.0 ); //How long do we remember targets/locations? public const int Allowance = 3; //How many times may we use the same location/target for gain private const int LocationSize = 5; //The size of eeach location, make this smaller so players dont have to move as far private static bool[] UseAntiMacro = new bool[] { // true if this skill uses the anti-macro code, false if it does not false,// Alchemy = 0, true,// Anatomy = 1, true,// AnimalLore = 2, true,// ItemID = 3, true,// ArmsLore = 4, false,// Parry = 5, true,// Begging = 6, false,// Blacksmith = 7, false,// Fletching = 8, true,// Peacemaking = 9, true,// Camping = 10, false,// Carpentry = 11, false,// Cartography = 12, false,// Cooking = 13, true,// DetectHidden = 14, true,// Discordance = 15, true,// EvalInt = 16, true,// Healing = 17, true,// Fishing = 18, true,// Forensics = 19, true,// Herding = 20, true,// Hiding = 21, true,// Provocation = 22, false,// Inscribe = 23, true,// Lockpicking = 24, true,// Magery = 25, true,// MagicResist = 26, false,// Tactics = 27, true,// Snooping = 28, true,// Musicianship = 29, true,// Poisoning = 30, false,// Archery = 31, true,// SpiritSpeak = 32, true,// Stealing = 33, false,// Tailoring = 34, true,// AnimalTaming = 35, true,// TasteID = 36, false,// Tinkering = 37, true,// Tracking = 38, true,// Veterinary = 39, false,// Swords = 40, false,// Macing = 41, false,// Fencing = 42, false,// Wrestling = 43, true,// Lumberjacking = 44, true,// Mining = 45, true,// Meditation = 46, true,// Stealth = 47, true,// RemoveTrap = 48, true,// Necromancy = 49, false,// Focus = 50, true,// Chivalry = 51 }; public static void Initialize() { Mobile.SkillCheckLocationHandler = new SkillCheckLocationHandler( Mobile_SkillCheckLocation ); Mobile.SkillCheckDirectLocationHandler = new SkillCheckDirectLocationHandler( Mobile_SkillCheckDirectLocation ); Mobile.SkillCheckTargetHandler = new SkillCheckTargetHandler( Mobile_SkillCheckTarget ); Mobile.SkillCheckDirectTargetHandler = new SkillCheckDirectTargetHandler( Mobile_SkillCheckDirectTarget ); //*********EDIT THESE LINES TO SET THE BASE PERCENT CHANCE TO GAIN FOR EACH INDIVIDUAL SKILL***********************// //This Table used to set the base chance to gain skill between 40 and 70 //for instance .15 would be a 15% chance to gain in the particular skill SkillInfo.Table[0].GainFactor = .15;// Alchemy = 0, SkillInfo.Table[1].GainFactor = .15;// Anatomy = 1, SkillInfo.Table[2].GainFactor = .15;// AnimalLore = 2, SkillInfo.Table[3].GainFactor = .15;// ItemID = 3, SkillInfo.Table[4].GainFactor = .15;// ArmsLore = 4, SkillInfo.Table[5].GainFactor = .15;// Parry = 5, SkillInfo.Table[6].GainFactor = .15;// Begging = 6, SkillInfo.Table[7].GainFactor = .15;// Blacksmith = 7, SkillInfo.Table[8].GainFactor = .15;// Fletching = 8, SkillInfo.Table[9].GainFactor = .15;// Peacemaking = 9, SkillInfo.Table[10].GainFactor = .15;// Camping = 10, SkillInfo.Table[11].GainFactor = .15;// Carpentry = 11, SkillInfo.Table[12].GainFactor = .15;// Cartography = 12, SkillInfo.Table[13].GainFactor = .15;// Cooking = 13, SkillInfo.Table[14].GainFactor = .15;// DetectHidden = 14, SkillInfo.Table[15].GainFactor = .15;// Discordance = 15, SkillInfo.Table[16].GainFactor = .15;// EvalInt = 16, SkillInfo.Table[17].GainFactor = .15;// Healing = 17, SkillInfo.Table[18].GainFactor = .15;// Fishing = 18, SkillInfo.Table[19].GainFactor = .15;// Forensics = 19, SkillInfo.Table[20].GainFactor = .15;// Herding = 20, SkillInfo.Table[21].GainFactor = .15;// Hiding = 21, SkillInfo.Table[22].GainFactor = .15;// Provocation = 22, SkillInfo.Table[23].GainFactor = .15;// Inscribe = 23, SkillInfo.Table[24].GainFactor = .15;// Lockpicking = 24, SkillInfo.Table[25].GainFactor = .15;// Magery = 25, SkillInfo.Table[26].GainFactor = .15;// MagicResist = 26, SkillInfo.Table[27].GainFactor = .15;// Tactics = 27, SkillInfo.Table[28].GainFactor = .15;// Snooping = 28, SkillInfo.Table[29].GainFactor = .15;// Musicianship = 29, SkillInfo.Table[30].GainFactor = .15;// Poisoning = 30 SkillInfo.Table[31].GainFactor = .15;// Archery = 31 SkillInfo.Table[32].GainFactor = .15;// SpiritSpeak = 32 SkillInfo.Table[33].GainFactor = .15;// Stealing = 33 SkillInfo.Table[34].GainFactor = .15;// Tailoring = 34 SkillInfo.Table[35].GainFactor = .15;// AnimalTaming = 35 SkillInfo.Table[36].GainFactor = .15;// TasteID = 36 SkillInfo.Table[37].GainFactor = .15;// Tinkering = 37 SkillInfo.Table[38].GainFactor = .15;// Tracking = 38 SkillInfo.Table[39].GainFactor = .15;// Veterinary = 39 SkillInfo.Table[40].GainFactor = .15;// Swords = 40 SkillInfo.Table[41].GainFactor = .15;// Macing = 41 SkillInfo.Table[42].GainFactor = .15;// Fencing = 42 SkillInfo.Table[43].GainFactor = .15;// Wrestling = 43 SkillInfo.Table[44].GainFactor = .15;// Lumberjacking = 44 SkillInfo.Table[45].GainFactor = .15;// Mining = 45 SkillInfo.Table[46].GainFactor = .15;// Meditation = 46 SkillInfo.Table[47].GainFactor = .15;// Stealth = 47 SkillInfo.Table[48].GainFactor = .15;// RemoveTrap = 48 SkillInfo.Table[49].GainFactor = .15;// Necromancy = 49 SkillInfo.Table[50].GainFactor = .15;// Focus = 50 SkillInfo.Table[51].GainFactor = .15;// Chivalry = 51 } public static bool Mobile_SkillCheckLocation( Mobile from, SkillName skillName, double minSkill, double maxSkill ) { Skill skill = from.Skills[skillName]; if ( skill == null ) return false; double value = skill.Value; if ( value < minSkill ) return false; // Too difficult else if ( value >= maxSkill ) return true; // No challenge double chance = (value - minSkill) / (maxSkill - minSkill); Point2D loc = new Point2D( from.Location.X / LocationSize, from.Location.Y / LocationSize ); return CheckSkill( from, skill, loc, chance ); } public static bool Mobile_SkillCheckDirectLocation( Mobile from, SkillName skillName, double chance ) { Skill skill = from.Skills[skillName]; if ( skill == null ) return false; if ( chance < 0.0 ) return false; // Too difficult else if ( chance >= 1.0 ) return true; // No challenge Point2D loc = new Point2D( from.Location.X / LocationSize, from.Location.Y / LocationSize ); return CheckSkill( from, skill, loc, chance ); } public static bool CheckSkill( Mobile from, Skill skill, object amObj, double chance ) { if ( from.Skills.Cap == 0 ) return false; bool success = ( chance >= Utility.RandomDouble() ); //**********EDIT THESE LINES FOR MODIFICATIONS TO BASE PERCENTAGE AT DIFFERENT SKILL LEVELS************************// double LowSkillMod = .10; // percent added to skill gain for skill between 0 - 40 double BaseSkillGain = skill.Info.GainFactor; // base percent to gain at skill between 40 - 70 set in table above. double HighSkillMod = .08; // percent subtracted from base gain for skill between 70 - 100 double AboveGmSkillMod = .13; // percent subtracted from base gain for skill over 100 //Example: Player Skill is 85.3 - We would take the 15% base chance and subtract 8% - Player now has a 7% chance to gain. //************************************************** ************************************************** *************// double ComputedSkillMod = 0; // holds the percent chance to gain after checking players skill if ( skill.Base < 40.1 ) ComputedSkillMod = BaseSkillGain + LowSkillMod; else if ( skill.Base < 70.1 ) ComputedSkillMod = BaseSkillGain; else if ( skill.Base < 100.1 ) ComputedSkillMod = BaseSkillGain - HighSkillMod; else if ( skill.Base > 100.0 ) ComputedSkillMod = BaseSkillGain - AboveGmSkillMod; if ( ComputedSkillMod < 0.01 ) ComputedSkillMod = 0.01; //following line used to see chance to gain ingame //from.SendMessage( "Your chance to gain {0} is {1}",skill.Name, ComputedSkillMod ); if ( from is BaseCreature && ((BaseCreature)from).Controled ) ComputedSkillMod *= 2; if ( from.Alive && ( ( ComputedSkillMod >= Utility.RandomDouble() && AllowGain( from, skill, amObj ) ) || skill.Base < 10.0 ) ) Gain( from, skill ); return success; } public static bool Mobile_SkillCheckTarget( Mobile from, SkillName skillName, object target, double minSkill, double maxSkill ) { Skill skill = from.Skills[skillName]; if ( skill == null ) return false; double value = skill.Value; if ( value < minSkill ) return false; // Too difficult else if ( value >= maxSkill ) return true; // No challenge double chance = (value - minSkill) / (maxSkill - minSkill); return CheckSkill( from, skill, target, chance ); } public static bool Mobile_SkillCheckDirectTarget( Mobile from, SkillName skillName, object target, double chance ) { Skill skill = from.Skills[skillName]; if ( skill == null ) return false; if ( chance < 0.0 ) return false; // Too difficult else if ( chance >= 1.0 ) return true; // No challenge return CheckSkill( from, skill, target, chance ); } private static bool AllowGain( Mobile from, Skill skill, object obj ) { if ( from is PlayerMobile && AntiMacroCode && UseAntiMacro[skill.Info.SkillID] ) return ((PlayerMobile)from).AntiMacroCheck( skill, obj ); else return true; } public enum Stat { Str, Dex, Int } public static void Gain( Mobile from, Skill skill ) { if ( from.Region is Regions.Jail ) return; if ( from is BaseCreature && ((BaseCreature)from).IsDeadPet ) return; if ( skill.SkillName == SkillName.Focus && from is BaseCreature ) return; if ( skill.Base < skill.Cap && skill.Lock == SkillLock.Up ) { int toGain = 1; if ( skill.Base <= 10.0 ) toGain = Utility.Random( 4 ) + 1; Skills skills = from.Skills; if ( ( skills.Total / skills.Cap ) >= Utility.RandomDouble() )//( skills.Total >= skills.Cap ) { for ( int i = 0; i < skills.Length; ++i ) { Skill toLower = skills[i]; if ( toLower != skill && toLower.Lock == SkillLock.Down && toLower.BaseFixedPoint >= toGain ) { toLower.BaseFixedPoint -= toGain; break; } } } if ( (skills.Total + toGain) <= skills.Cap ) { skill.BaseFixedPoint += toGain; } } if ( skill.Lock == SkillLock.Up ) { SkillInfo info = skill.Info; //*****EDIT THIS LINE TO MAKE STATS GAIN FASTER, NUMBER MUST BE BETWEEN 0.00 and 1.00, THIS IS ADDED TO THE CHANCE TO GAIN IN A STAT********// double StatGainBonus = .10; //Extra chance to gain in stats. Left at 0 would be default runuo gains. //************************************************** ************************************************** **************************************// if ( from.StrLock == StatLockType.Up && ((info.StrGain / 33.3) + StatGainBonus) > Utility.RandomDouble() ) { if( info.StrGain != 0 ) GainStat( from, Stat.Str ); } else if ( from.DexLock == StatLockType.Up && ((info.DexGain / 33.3) + StatGainBonus) > Utility.RandomDouble() ) { if( info.DexGain != 0 ) GainStat( from, Stat.Dex ); } else if ( from.IntLock == StatLockType.Up && ((info.IntGain / 33.3) + StatGainBonus) > Utility.RandomDouble() ) { if( info.IntGain != 0 ) GainStat( from, Stat.Int ); } //following line used to show chance to gain stats ingame //from.SendMessage( "Str: {0} Dex: {1} Int: {2}",((info.StrGain / 33.3) + StatGainBonus),((info.DexGain / 33.3) + StatGainBonus),((info.IntGain / 33.3) + StatGainBonus) ); } } public static bool CanLower( Mobile from, Stat stat ) { switch ( stat ) { case Stat.Str: return ( from.StrLock == StatLockType.Down && from.RawStr > 10 ); case Stat.Dex: return ( from.DexLock == StatLockType.Down && from.RawDex > 10 ); case Stat.Int: return ( from.IntLock == StatLockType.Down && from.RawInt > 10 ); } return false; } public static bool CanRaise( Mobile from, Stat stat ) { if ( !(from is BaseCreature && ((BaseCreature)from).Controled) ) { if ( from.RawStatTotal >= from.StatCap ) return false; } switch ( stat ) { case Stat.Str: return ( from.StrLock == StatLockType.Up && from.RawStr < 125 ); case Stat.Dex: return ( from.DexLock == StatLockType.Up && from.RawDex < 125 ); case Stat.Int: return ( from.IntLock == StatLockType.Up && from.RawInt < 125 ); } return false; } public static void IncreaseStat( Mobile from, Stat stat, bool atrophy ) { atrophy = atrophy || (from.RawStatTotal >= from.StatCap); switch ( stat ) { case Stat.Str: { if ( atrophy ) { if ( CanLower( from, Stat.Dex ) && (from.RawDex < from.RawInt || !CanLower( from, Stat.Int )) ) --from.RawDex; else if ( CanLower( from, Stat.Int ) ) --from.RawInt; } if ( CanRaise( from, Stat.Str ) ) ++from.RawStr; break; } case Stat.Dex: { if ( atrophy ) { if ( CanLower( from, Stat.Str ) && (from.RawStr < from.RawInt || !CanLower( from, Stat.Int )) ) --from.RawStr; else if ( CanLower( from, Stat.Int ) ) --from.RawInt; } if ( CanRaise( from, Stat.Dex ) ) ++from.RawDex; break; } case Stat.Int: { if ( atrophy ) { if ( CanLower( from, Stat.Str ) && (from.RawStr < from.RawDex || !CanLower( from, Stat.Dex )) ) --from.RawStr; else if ( CanLower( from, Stat.Dex ) ) --from.RawDex; } if ( CanRaise( from, Stat.Int ) ) ++from.RawInt; break; } } } private static TimeSpan m_StatGainDelay = TimeSpan.FromMinutes( 10.0 ); public static void GainStat( Mobile from, Stat stat ) { if ( (from.LastStatGain + m_StatGainDelay) >= DateTime.Now ) return; from.LastStatGain = DateTime.Now; bool atrophy = ( (from.RawStatTotal / (double)from.StatCap) >= Utility.RandomDouble() ); IncreaseStat( from, stat, atrophy ); } } } [/code:1]
__________________
Founder of... www.Abyss-Centurian.tk Finaly opened, www.NordicMyth.dk |
|
|
|
|
|
#3 (permalink) |
|
Hi, I don't know if you will see this considering it looks like a somewhat old post, but I noticed something about it. The numbers are all in numerical order (duh). Is there a way to find out the current gain speed of the skill in mind (Blacksmithing) and edit it faster or slower from there? Because I don't know the average speed in percentiles of the blacksmithing gain...
|
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|