RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

[RunUO 2.0, 2.1, 2.2, SVN] Skill Ball (fixed)

Lokai

Knight
I released this a while back. Since then, I discovered that it had some holes in it which allowed players to exploit it for unlimited gains. I have fixed that problem.

This Skill Ball allows you to use up points in increments of 1 or 5. You don't have to use up the ball all at once. GM's are able to raise or lower freely.

When created in a script, you can specify the number of points: "new SkillBall(100)" would give you a Skill Ball with 100 points on it, or you can give a random number: "new SkillBall(50, 75)" would give a random number of points between 50 and 75. If you create it in game, you can either use the default constructor, which will generate a ball with a random number of points between 15 and 50, or you can use a number: "[add SkillBall 60" to give a specific number of points.

This is also made to work on Servers with different numbers of Skills available. If you have set the Core.SA, Core.ML, Core.SE, or Core.AOS variables, it will take that into account, and only display the number of skills available on your Server. Note: This includes support for the 3 new SA skills (Imbuing, Throwing, Mysticism.)

New File Uploaded with a check to see if the SkillsTotal reaches the SkillsCap.
 

Attachments

  • SkillBall.cs
    8.8 KB · Views: 674

graverobbing

Sorceror
*BOWS* Yesterday i was testing the old SkillBall on my server to add it to the players, but i found that there where severals exploits, so today i come here and i find that you made a fix! YOU-ARE-THE-MAN Lokai.

I'll test it out and tell you how much i like it :D

Thanks alot mate.
 

mhantra

Sorceror
i have a class system, and classes have skill limits. 4 ex. archer has 30 cap for magery... giving the skillball, will the points available ignore the cap?

ex. i give 50 points skillball.. if i put all 50 point in magery it will not stop probably at 30 but will set it @ 50. how can i do to stop the points assignament at skillcap?
 

graverobbing

Sorceror
Works fine for players, they can't pass from 100% 1 single skill (tested on AOS)

Is it me or theres no skillcap (700) check? Like you can have all the skills you want aslong is it 100% each one.

Maybe its too much asking but is there anyway to control that? Cause even adding it to a new character bag with 700 points (m_Points = 700), the player is going to be able to have more than 700 skillcap points.

Overall I'm very happy with this script :)
 

Lokai

Knight
i have a class system, and classes have skill limits. 4 ex. archer has 30 cap for magery... giving the skillball, will the points available ignore the cap?

ex. i give 50 points skillball.. if i put all 50 point in magery it will not stop probably at 30 but will set it @ 50. how can i do to stop the points assignament at skillcap?

The ball honors the individual Cap for each skill, so that part should work fine. Not sure if it looks at the 700 (or whatever number) Total Skill cap.
 

graverobbing

Sorceror
The ball honors the individual Cap for each skill, so that part should work fine. Not sure if it looks at the 700 (or whatever number) Total Skill cap.

So theres no way to control that? cause im 100% sure it doesn't respect the "global" skillcap wich is very silly :(
 

graverobbing

Sorceror
It should be an easy fix. Sorry, I can't remember the last time I played on a shard that actually had a skill cap. :p
No need to say sorry :), you already did a boog job into this, since i have basic knowledge in C i'll try to do that by myself, i'll probably fail, but if i achieve to do it i'll send it to you so you can upload the 2 versions, maybe someone would like the skillcap version too :)
 

Lokai

Knight
Here is the way I will fix it. Just change the "CanRaiseSkill" method like this:

Code:
        public bool CanRaiseSkill(Skill skill, int pos, int amount)
        {
            if ((m_Points >= amount) && ((skill.Base + amount) <= m_Mobile.Skills[pos].Cap)
                && m_Mobile.SkillsTotal + (amount * 10) <= m_Mobile.SkillsCap)
                return true;
            else if (m_Mobile.AccessLevel >= AccessLevel.GameMaster) // Why should we limit a GM? hehe
                return true;
            else return false;
        }

New File Uploaded with this check to see if the SkillsTotal reaches the SkillsCap.
 

graverobbing

Sorceror
I've tested it and it makes some restriction but it doesn't work at all, cause if you create, for example, a mage with 287.6 (warrior,custom or whatever class you chose in the character create menu) and you have setted a skillball with 700 points like this* (see quote below) it will let you have 812.2 as skillcap and you will have 160 points left in your skillball, but when you click on "show real" skillcap it shows 700 :/

Wich it doesn't make much sense to me cause its even passing 700 but why it become restricted with 812.2, maybe im messing up something...

I'm pretty sure its not working since im putting the 700 number in a bad place inside your scrip:
* [Constructable]
public SkillBall( int points ) : base( 0xE73 )
{
LootType = LootType.Blessed;
Movable = false;
m_Points = 700; // instead of m_Points = points;
Name = "a skill ball";
Hue = 2222;
}
Happens the same if instead of changing m_Points = points; you change this (trying this gave me a max of 820 out of 700):
[Constructable]
public SkillBall() : this( 700 )
{
}


And sorry for beeing suck a lurker bug of your time...
 

graverobbing

Sorceror
Ok! Now i know whats the problem, it caps the "show real" skill to 700 but still the skills can go a bit more further than that, so the thing that must be restricted is the normal skill not the real skill. :p
 

Lokai

Knight
I don't know what you are talking about. What is your Skills Cap?

*EDIT*

OK. So, just to clarify. The "Real" number is the one that counts, because that is your Base skill level, without any modifiers. The modifiers allow it to exceed the Skill Cap normally, which is why that number will be higher than 700. The number you see when you do not click the "Real" button is the modified value, which includes buffs for things like wearing Jewelry that give skill bonuses, etc.
 

graverobbing

Sorceror
I don't know what you are talking about. What is your Skills Cap?

*EDIT*

OK. So, just to clarify. The "Real" number is the one that counts, because that is your Base skill level, without any modifiers. The modifiers allow it to exceed the Skill Cap normally, which is why that number will be higher than 700. The number you see when you do not click the "Real" button is the modified value, which includes buffs for things like wearing Jewelry that give skill bonuses, etc.

Yeah... works good, i can't belive i'm that stupid :/

Thanks again for your time and script
 

xksimon

Sorceror
Is there anyway that I can allow people to point their skill up to 120 but not 100. it is suck for just 100 only
 

HellyMae

Traveler
I have used your skill balls previously. And they were great, but I no longer use skill balls on my shard. But I am interested in re introducing them in the future. What were the exploits?....If you cant post them pubclicly can you please pm me? Not being rude, but isnt that what you should be doing with a re-release? Explaining the exploit and the fix?

But thank you for the balls, another script that most shards would use!
 

Lokai

Knight
I have used your skill balls previously. And they were great, but I no longer use skill balls on my shard. But I am interested in re introducing them in the future. What were the exploits?....If you cant post them pubclicly can you please pm me? Not being rude, but isnt that what you should be doing with a re-release? Explaining the exploit and the fix?

But thank you for the balls, another script that most shards would use!

The exploits/bugs were as follows:

1. Skills would all seem to start at 20, due to the "Value" of skills being used rather than the "Base".
2. Skills raised from 20, then lowered would stay at 20, but keep giving you endless points. (Only seemed to work sometimes, now fixed.)
3. If someone used Razor, they could force the gump to trigger the "plus" button for a skill, even if it was not there. This was fixed by adding an additional check in the "OnResponse" method which verifies they have access to that option.
 

Wis Weed

Sorceror
The exploits/bugs were as follows:
3. If someone used Razor, they could force the gump to trigger the "plus" button for a skill, even if it was not there. This was fixed by adding an additional check in the "OnResponse" method which verifies they have access to that option.

I seem to still have a problem with this part of the code. I made a razor macro of myself pushing +5 button then I raised my skill to 116 ( skill cap is 120 ). The +5 option disappeared. Then I hit my razor macro ( button 4023 ). This crashed the shard.

I'm going to start working on a solution.

It may be in this part:
Code:
 info.ButtonID - 4000, 5) || from.AccessLevel >= AccessLevel.GameMaster)) // Increase by 5
                    {
                from.Skills[info.ButtonID - 4000].Base += 5.0;
                m_Ball.Points -= 5;
                if (m_Ball.Points <= 0) m_Ball.Consume();
                else from.SendGump( new IncreaseSkillsGump( from, m_Ball, m_StartValue, m_Page ) );
            }
I love this script.

Here is the actual crash:
Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at Server.Items.IncreaseSkillsGump.OnResponse(NetState state, RelayInfo info)
at Server.Network.PacketHandlers.DisplayGumpResponse(NetState state, PacketReader pvSrc)
at Server.Network.MessagePump.HandleReceive(NetState ns)
at Server.Network.MessagePump.Slice()
at Server.Core.Main(String[] args)
 

Wis Weed

Sorceror
My problem was here:
Code:
else if (info.ButtonID >= 1000 && (CanLowerSkill(from.Skills[info.ButtonID - 1000],
info.ButtonID - 1000, 1)

Seems like this fixed it:
Code:
else if (info.ButtonID >= 1000 && info.ButtonID <= 1999 && (CanLowerSkill(from.Skills[info.ButtonID - 1000],  info.ButtonID - 1000, 1)

I did this for ButtonID 2000 to 2999; Also for 3000 to 3999 as you can see below. I made a few other edits that better suited a shard that has 720 skills cap. You can always lower your skills, but skill points will not be added back onto the skill ball. This is mainly because a player that reaches his skill cap will not be able to raise a skill using the skill ball even if a different skill has points into it and the arrow next to it pointing down (allowing the skill to decrease). This edit allows players to control which skill will go down and which skill will go up.

Code:
public bool CanLowerSkill( Skill skill, int pos, int amount )
        {
        /*if ( skill.Base - amount >= m_StartValue[pos] )
          return true;
          else if ( m_Mobile.AccessLevel >= AccessLevel.GameMaster ) // Why should we limit a GM? hehe
          return true;
          else return false;*/
       
          return true;
        }
 
        public bool CanRaiseSkill( Skill skill, int pos, int amount )
        {
            if ((m_Points >= amount) && ((skill.Base + amount) <= m_Mobile.Skills[pos].Cap)
                  && m_Mobile.SkillsTotal + (amount * 10) <= m_Mobile.SkillsCap)
                return true;
            else if ( m_Mobile.AccessLevel >= AccessLevel.GameMaster ) // Why should we limit             a GM? hehe
                return true;
            else return false;
        }
 
        public override void OnResponse( NetState state, RelayInfo info )
        {
            PlayerMobile from = state.Mobile as PlayerMobile;
 
            if ( info.ButtonID == 1 ) // "Ok"
            {
                from.CloseGump( typeof( IncreaseSkillsGump ) );
            }
            else if (info.ButtonID >= 4000 && (CanRaiseSkill(from.Skills[info.ButtonID - 4000],
                  info.ButtonID - 4000, 5) || from.AccessLevel >= AccessLevel.GameMaster)) //            Increase by 5
                    {
                from.Skills[info.ButtonID - 4000].Base += 5.0;
                m_Ball.Points -= 5;
                if (m_Ball.Points <= 0) m_Ball.Consume();
                else from.SendGump( new IncreaseSkillsGump( from, m_Ball, m_StartValue, m_Page ) );
            }
            else if (info.ButtonID >= 3000 && info.ButtonID <= 3999 && (CanLowerSkill(from.Skills[info.ButtonID - 3000],
                        info.ButtonID - 3000, 5) || from.AccessLevel >= AccessLevel.GameMaster)) // Decrease by 5
                    {
                from.Skills[info.ButtonID - 3000].Base -= 5.0;
                //m_Ball.Points += 5;
                from.SendGump( new IncreaseSkillsGump( from, m_Ball, m_StartValue, m_Page ) );
            }
            else if (info.ButtonID >= 2000 && info.ButtonID <= 2999 && (CanRaiseSkill(from.Skills[info.ButtonID - 2000],
                        info.ButtonID - 2000, 1) || from.AccessLevel >= AccessLevel.GameMaster)) // Increase
                    {
                from.Skills[info.ButtonID - 2000].Base += 1.0;
                m_Ball.Points -= 1;
                if (m_Ball.Points <= 0) m_Ball.Consume();
                else from.SendGump( new IncreaseSkillsGump( from, m_Ball, m_StartValue, m_Page ) );
            }
            else if (info.ButtonID >= 1000 && info.ButtonID <= 1999 && (CanLowerSkill(from.Skills[info.ButtonID - 1000],
                        info.ButtonID - 1000, 1) || from.AccessLevel >= AccessLevel.GameMaster)) // Decrease
                  {
                from.Skills[info.ButtonID - 1000].Base -= 1.0;
                //m_Ball.Points += 1;
                from.SendGump( new IncreaseSkillsGump( from, m_Ball, m_StartValue, m_Page ) );
            }
            else if ( info.ButtonID == 2 ) // Previous Page
            {
                --m_Page;
                from.SendGump( new IncreaseSkillsGump( from, m_Ball, m_StartValue, m_Page ) );
            }
            else if ( info.ButtonID == 3 ) // Next Page
            {
                ++m_Page;
                from.SendGump( new IncreaseSkillsGump( from, m_Ball, m_StartValue, m_Page ) );
            }
            else
                from.CloseGump( typeof( IncreaseSkillsGump ) );
        }

Thanks for the script. These are very popular with players.
 
Top