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!

Stable Post Fix!

ThatDudeJBob

Sorceror
There was a bug with the stable post that would allow the player to control pets over there max followers. I was able to give a fix to this and i am now sharing it with everyone here.

[RunUO 2.0 RC2] Stable Post - Last Page

Code:
/////*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/////
//                  Fixxed by JBob                   //
//        Fixxed the post so it will check the       //
//        Players Followers Before it Unstables      //
//                    Lines 410-416                  //
/////*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/////

PHP:
/*-----------------------JBob Addition-----------------------*/
BaseCreature bc = (BaseCreature)target;
if ((( from.Followers + bc.ControlSlots ) > from.FollowersMax ) && (bc.MinTameSkill == 240.0) ) //If the pet is already stabled
m_Post.Say("You cannot control more Followers.");
else if (( from.Followers + bc.ControlSlots ) > from.FollowersMax ) //If the pet is not stabled
m_Post.Say("You already have a pet stabled on this post.");
/*-----------------------------------------------------------*/

The above code is shown below in the spot it must go
PHP:
                else if ((target is BaseCreature) && m_Post.Controlled != null)
                {
                    BaseCreature c = null;
                    /*-----------------------JBob Addition-----------------------*/   
                    BaseCreature bc = (BaseCreature)target;
                    if ((( from.Followers + bc.ControlSlots ) > from.FollowersMax ) && (bc.MinTameSkill == 240.0) ) //If the pet is already stabled
                        m_Post.Say("You cannot control more Followers.");
                    else if (( from.Followers + bc.ControlSlots ) > from.FollowersMax ) //If the pet is not stabled
                        m_Post.Say("You already have a pet stabled on this post.");
                    /*-----------------------------------------------------------*/
                    else if (m_Post.Controlled == (BaseCreature)target && m_Post.Owner == from)//Changed from 'if' to 'else if'
                    {
                        c = (BaseCreature)target;
                        c.ControlMaster = m_Post.Owner;
                        c.Home = m_Post.Owner.Location;
                        c.RangeHome = 0;
                        c.Loyalty = m_Post.Loyal;
                        m_Post.Loyal = 100;
                        c.IsBonded = m_Post.IsBonded;
                        m_Post.IsBonded = false;
                        c.FightMode = m_Post.Mode;
                        m_Post.Mode = FightMode.None;
                        c.ControlOrder = m_Post.Order;
                        m_Post.Order = OrderType.None;
                        c.Controlled = m_Post.Command;
                        m_Post.Command = false;
                        c.Blessed = false;
                        c.BondingBegin = m_Post.BondingBegin;
                        m_Post.BondingBegin = DateTime.MaxValue;
                        c.OwnerAbandonTime = m_Post.OwnerAbandonTime;
                        m_Post.OwnerAbandonTime = DateTime.MaxValue;
                        c.MinTameSkill = m_Post.MinTameSkill;
                        m_Post.MinTameSkill = 0.0;
                        m_Post.Controlled = null;
                        m_Post.Owner = null;
                    }
                    else
                        from.SendMessage("This post already has a creature stabled. (Unstable the other first)");
                }
            }

(bc.MinTameSkill == 240.0) refers to line 403 which is part of the stabled pet code
 

Attachments

  • StablePost.cs
    19.6 KB · Views: 1
Top