Go Back   RunUO - Ultima Online Emulation > RunUO > RunUO Post Archive

RunUO Post Archive The Archvie

Reply
 
Thread Tools Display Modes
Old 08-13-2004, 03:37 PM   #1 (permalink)
Forum Newbie
 
Join Date: Aug 2004
Location: Laredo, Texas, USA
Age: 19
Posts: 61
Send a message via AIM to L33T-Script3R Send a message via MSN to L33T-Script3R
Default UOGamers Skill Gain Script.

I like the way UOGamers has there skill gain so I decided to try to script a replica of how there skill gain is... The way you gain in skill is perfectly cloned and the way you gain in stats is just about right.

How the skill gain works:

You always gain 0.1-0.4 all the way to 80.0 and then you will always gain 0.1 after that.

How the stat gain works:

You will always gain 1 every 45 seconds.

Goto Scripts/Misc/ open up your SkillCheck.cs and replace it with this.

PHP Code:
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.FromMinutes5.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 SkillCheckLocationHandlerMobile_SkillCheckLocation );
            
Mobile.SkillCheckDirectLocationHandler = new SkillCheckDirectLocationHandlerMobile_SkillCheckDirectLocation );

            
Mobile.SkillCheckTargetHandler = new SkillCheckTargetHandlerMobile_SkillCheckTarget );
            
Mobile.SkillCheckDirectTargetHandler = new SkillCheckDirectTargetHandlerMobile_SkillCheckDirectTarget );
        }

        public static 
bool Mobile_SkillCheckLocationMobile fromSkillName skillNamedouble minSkilldouble 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 Point2Dfrom.Location.LocationSizefrom.Location.LocationSize );
            return 
CheckSkillfromskilllocchance );
        }

        public static 
bool Mobile_SkillCheckDirectLocationMobile fromSkillName skillNamedouble 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 Point2Dfrom.Location.LocationSizefrom.Location.LocationSize );
            return 
CheckSkillfromskilllocchance );
        }

        public static 
bool CheckSkillMobile fromSkill skillobject amObjdouble chance )
        {
            if ( 
from.Skills.Cap == )
                return 
false;

            
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 /= 0.01;

            
gc += ( 1.0 chance ) * ( success 0.5 0.2 );
            
gc /= 0.01;

            
gc *= skill.Info.GainFactor;

            if ( 
gc 0.01 )
                
gc 0.01;

            if ( 
from is BaseCreature && ((BaseCreature)from).Controled )
                
gc *= 0.01;

            if ( 
from.Alive && ( ( gc >= Utility.RandomDouble() && AllowGainfromskillamObj ) ) || skill.Base 10.0 ) )
                
Gainfromskill );

            return 
success;
        }

        public static 
bool Mobile_SkillCheckTargetMobile fromSkillName skillNameobject targetdouble minSkilldouble 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 
CheckSkillfromskilltargetchance );
        }

        public static 
bool Mobile_SkillCheckDirectTargetMobile fromSkillName skillNameobject targetdouble 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 CheckSkillfromskilltargetchance );
        }

        private static 
bool AllowGainMobile fromSkill skillobject obj )
        {
            if ( 
from is PlayerMobile && AntiMacroCode && UseAntiMacro[skill.Info.SkillID] )
                return ((
PlayerMobile)from).AntiMacroCheckskillobj );
            else
                return 
true;
        }

        public 
enum Stat StrDexInt }

        public static 
void GainMobile fromSkill 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 <= 80.0 )
                    
toGain Utility.Random) + 1;

                
Skills skills from.Skills;

                if ( ( 
skills.Total skills.Cap ) >= Utility.RandomDouble() )//( skills.Total >= skills.Cap )
                
{
                    for ( 
int i 0skills.Length; ++)
                    {
                        
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;

                if ( 
from.StrLock == StatLockType.Up && (info.StrGain 0.01) > Utility.RandomDouble() )
                    
GainStatfromStat.Str );
                else if ( 
from.DexLock == StatLockType.Up && (info.DexGain 0.01) > Utility.RandomDouble() )
                    
GainStatfromStat.Dex );
                else if ( 
from.IntLock == StatLockType.Up && (info.IntGain 0.01) > Utility.RandomDouble() )
                    
GainStatfromStat.Int );
            }
        }

        public static 
bool CanLowerMobile fromStat 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 CanRaiseMobile fromStat 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 IncreaseStatMobile fromStat statbool atrophy )
        {
            
atrophy atrophy || (from.RawStatTotal >= from.StatCap);

            switch ( 
stat )
            {
                case 
Stat.Str:
                {
                    if ( 
atrophy )
                    {
                        if ( 
CanLowerfromStat.Dex ) && (from.RawDex from.RawInt || !CanLowerfromStat.Int )) )
                            --
from.RawDex;
                        else if ( 
CanLowerfromStat.Int ) )
                            --
from.RawInt;
                    }

                    if ( 
CanRaisefromStat.Str ) )
                        ++
from.RawStr;

                    break;
                }
                case 
Stat.Dex:
                {
                    if ( 
atrophy )
                    {
                        if ( 
CanLowerfromStat.Str ) && (from.RawStr from.RawInt || !CanLowerfromStat.Int )) )
                            --
from.RawStr;
                        else if ( 
CanLowerfromStat.Int ) )
                            --
from.RawInt;
                    }

                    if ( 
CanRaisefromStat.Dex ) )
                        ++
from.RawDex;

                    break;
                }
                case 
Stat.Int:
                {
                    if ( 
atrophy )
                    {
                        if ( 
CanLowerfromStat.Str ) && (from.RawStr from.RawDex || !CanLowerfromStat.Dex )) )
                            --
from.RawStr;
                        else if ( 
CanLowerfromStat.Dex ) )
                            --
from.RawDex;
                    }

                    if ( 
CanRaisefromStat.Int ) )
                        ++
from.RawInt;

                    break;
                }
            }
        }

        private static 
TimeSpan m_StatGainDelay TimeSpan.FromSeconds45 );

        public static 
void GainStatMobile fromStat stat )
        {
            if ( (
from.LastStatGain m_StatGainDelay) >= DateTime.Now )
                return;

            
from.LastStatGain DateTime.Now;

            
bool atrophy = ( (from.RawStatTotal / (double)from.StatCap) >= Utility.RandomDouble() );

            
IncreaseStatfromstatatrophy );
        }
    }

Attached Files
File Type: cs SkillCheck.cs (9.4 KB, 535 views)
L33T-Script3R is offline   Reply With Quote
Old 08-20-2004, 02:03 PM   #2 (permalink)
Eddie Vandetti
Guest
 
Posts: n/a
Default

Lots of support here, I'll say it, "Thanks and good job!"
  Reply With Quote
Old 08-29-2004, 04:16 AM   #3 (permalink)
 
Join Date: Aug 2004
Location: Fayetteville, TN
Posts: 52
Send a message via AIM to Mystic_One123 Send a message via Yahoo to Mystic_One123
Default

Okay, this might be newbish of me to ask but.... Do we hit the link or just change our current SkillCheck? I'm confused. I would greatly appreciate an axplanation. I really would like to use this for betetr skill gain.
Mystic_One123 is offline   Reply With Quote
Old 08-29-2004, 03:20 PM   #4 (permalink)
Forum Novice
 
Join Date: Jan 2004
Posts: 147
Send a message via MSN to Knight Wolf 748
Default

Download "L33T-Script3R's" SkillCheck.cs file and replace it with the one in your RunUo directory..

quick note backup the original
Knight Wolf 748 is offline   Reply With Quote
Old 08-29-2004, 05:19 PM   #5 (permalink)
 
Join Date: Aug 2004
Location: Fayetteville, TN
Posts: 52
Send a message via AIM to Mystic_One123 Send a message via Yahoo to Mystic_One123
Default

Quote:
Originally Posted by Knight Wolf 748
Download "L33T-Script3R's" SkillCheck.cs file and replace it with the one in your RunUo directory..

quick note backup the original
Ahh. Tankies very much for the clarification. I just tested it. I LOVE it.

::Two thumbs up and tosses some Kudos::
Mystic_One123 is offline   Reply With Quote
Old 09-01-2004, 11:11 PM   #6 (permalink)
Forum Newbie
 
Join Date: Aug 2004
Location: Laredo, Texas, USA
Age: 19
Posts: 61
Send a message via AIM to L33T-Script3R Send a message via MSN to L33T-Script3R
Default

L33T-Script3R is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes
Linear Mode Linear Mode
Threaded Mode