Finaltwist

Member
So apparently my version of runuo doesn't allow an admin account to recall to any destination. I'd like my admin account (accesslevel.owner) to be able to recall and gate anywhere, so in recall.cs i added some code to the section i think determines if the caster can recall or not:

C#:
        public void Effect( Point3D loc, Map map, bool checkMulti )
        {
            if ( Caster is PlayerMobile && ((PlayerMobile)Caster).Owner)
            {
                Caster.PlaySound( 0x1FC );
                Effects.SendLocationParticles( EffectItem.Create( Caster.Location, Caster.Map, EffectItem.DefaultDuration ), 0x376A, 9, 32, Server.Items.CharacterDatabase.GetMySpellHue( Caster, 0 ), 0, 5024, 0 );
                Caster.MoveToWorld( loc, map );
                Caster.PlaySound( 0x1FC );
                Effects.SendLocationParticles( EffectItem.Create( Caster.Location, Caster.Map, EffectItem.DefaultDuration ), 0x376A, 9, 32, Server.Items.CharacterDatabase.GetMySpellHue( Caster, 0 ), 0, 5024, 0 );
            }
        ...

It doesn't like my way of checking if the account is a gamemaster or owner if ( Caster is PlayerMobile && ((PlayerMobile)Caster).Owner)
. I tried multiple variations, if (Caster.Owner), if (Mobile.Owner), and tried using GameMaster instead... but the fact is i don't know how to do this. Could someone help?

getting variations of this error message
C#:
Errors:
+ Magic/Magery 4th/Recall.cs:
    CS1061: Line 70: 'Server.Mobiles.PlayerMobile' does not contain a definition for 'Owner' and no extension method 'Owner' accepting a first argument of type 'Server.Mobiles.PlayerMobile' could be found (are you missing a using directive or an assembly reference?)

When i [props my admin account, it says his access level is owner, which is why i used that at first... Anyways, it's a runuo server if that makes a difference.
 
Don't edit the recall script; make your change in SpellHelper.cs where it does the checking for validity.

There are two places to make changes. Yours may not be identical (this is 2.0 RC1) but the added "if" referencing staff access is the important one. It checks to see if your access level is higher than Player and if so returns an immediate yes, skipping other validation. Add that part to your file.

Code:
        public static bool CheckTravel( Mobile caster, TravelCheckType type )
        {

            if ( caster.AccessLevel > AccessLevel.Player )  // Staff can always mark and recall
                return true;


            if ( CheckTravel( caster, caster.Map, caster.Location, type ) )
                return true;

            SendInvalidMessage( caster, type );
            return false;
        }

A little further down you'll find this section. Again, the important part is the one that has the staff notation. If your code here isn't identical, try to add that check in about the same location relative to other checks.

Code:
        public static bool CheckTravel( Mobile caster, Map map, Point3D loc, TravelCheckType type )
        {
            if ( IsInvalid( map, loc ) ) // null, internal, out of bounds
            {
                if ( caster != null )
                    SendInvalidMessage( caster, type );

                return false;
            }

            m_TravelCaster = caster;
            m_TravelType = type;

            int v = (int) type;
            bool isValid = true;

            for ( int i = 0; isValid && i < m_Validators.Length; ++i )
                isValid = ( m_Rules[v, i] || !m_Validators[i]( map, loc ) );

            if (caster != null && caster.AccessLevel > AccessLevel.Player)  // Staff can always recall to a marked rune
                isValid = true;

            if ( !isValid && caster != null )
                SendInvalidMessage( caster, type );

            return isValid;
        }

For some reason RunUO and ServUO have never given staff more leeway in these situations. I made the changes years ago and luckily made comments in the files so I could find them again today!
Post automatically merged:

Well, look at me fibbing! Turns out there are helpful edits to Recall.cs that you can also do. One lets you recall even if another mobile is at that location and the other lets you recall directly into houses / buildings. Insert the whole "if" and bracketed code below it involving the staff notation below in both the !map.CanSpawnMobile section and the elseif section right after it.

You're basically adding the recall code to both checks so that staff recall where they want to go right away. This was the most direct way I could think of instead of trying to manipulate the logic within other checks. I never claimed to be a programmer!

Code:
            else if ( !map.CanSpawnMobile( loc.X, loc.Y, loc.Z ) )
            {
                if ( Caster.AccessLevel > AccessLevel.Player )  // Staff recall is never blocked
                {            
                BaseCreature.TeleportPets( Caster, loc, map, true );

                if ( m_Book != null )
                    --m_Book.CurCharges;

                Caster.PlaySound( 0x1FC );
                Caster.MoveToWorld( loc, map );
                Caster.PlaySound( 0x1FC );
                }
            

                Caster.SendLocalizedMessage( 501942 ); // That location is blocked.
            }
            else if ( (checkMulti && SpellHelper.CheckMulti( loc, map )) )
            {
                if ( Caster.AccessLevel > AccessLevel.Player )  // Staff recall is never blocked
                {            
                BaseCreature.TeleportPets( Caster, loc, map, true );

                if ( m_Book != null )
                    --m_Book.CurCharges;

                Caster.PlaySound( 0x1FC );
                Caster.MoveToWorld( loc, map );
                Caster.PlaySound( 0x1FC );
                }

                Caster.SendLocalizedMessage( 501942 ); // That location is blocked.
            }

Again, this is 2.0 RC1 so yours may not be identical but you should be able to see where the changes go.
 
Last edited:
thanks! all edits worked perfectly. I marked a rune in the black area of the map without any tiles and recalled to it and it worked perfectly. still says " that location is blocked" but that's a good thing since the GM will know regular players can't recall there.
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back