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!

[1.0 and 2.0] Razor Feature Negotiation

i am looking for doing the same filters as you, and maybe the block dismounting - at least until i test it to make sure that if i "hit a person" and dismount them they stay down - because i thought i say a couple auto mount again, and they sort of blows using the dismount special ability on weapons
(but if test show differently - then just the 1st 2)

*edited - just checked - it still does allow dismounting via weapon use even when checked - so can keep that one in :)
 
Lord_Greywolf;703865 said:
i am looking for doing the same filters as you, and maybe the block dismounting - at least until i test it to make sure that if i "hit a person" and dismount them they stay down - because i thought i say a couple auto mount again, and they sort of blows using the dismount special ability on weapons
(but if test show differently - then just the 1st 2)

*edited - just checked - it still does allow dismounting via weapon use even when checked - so can keep that one in :)

also there is a remount delay of 10 seconds for bola and dismount ability
 

qwerty84

Sorceror
Consol Log said:
RunUO - [www.runuo.com] Version 2.0, Build 2824.24868
Core: Running on .NET Framework Version 2.0.50727
Core: Running with arguments: -debug -haltonwarning
Core: Optimizing for 2 processors
Scripts: Compiling C# scripts...failed (0 errors, 1 warnings)
Warnings:
+ Custom/RazorNegotiator.cs:
CS0162: Line 141: Rilevato codice non eseguibile.
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.

Reveling the warning from SVN 264 :)
 

qwerty84

Sorceror
Warning Fix:

Change this code:
Code:
[SIZE=2][COLOR=#0000ff]public [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]const [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]bool[/COLOR][/SIZE][SIZE=2][COLOR=#000000] KickOnFailure = [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][SIZE=2][COLOR=#000000];[/COLOR][/SIZE]

In:
Code:
[SIZE=2][COLOR=#0000ff]public [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]static [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]readonly [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]bool[/COLOR][/SIZE][SIZE=2][COLOR=#000000] KickOnFailure = [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][SIZE=2][COLOR=#000000];[/COLOR][/SIZE]
 

Djeryv

Sorceror
I am trying to run this with RunUO 2.0 Final and client 7.0.3. I already have this running on an RC2 server and it works great. On my other server (2.0 Final), everytime I log into the shard...it freezes the client after a few seconds. The console reports no errors and does not report the client getting booted. I have Razor 1.0.12 with the negotiation check box checked. I am just trying to block the weather/lighting like I do on my other server. Any help would be appreciated.

-Djeryv
 

Djeryv

Sorceror
I notice when I comment out this section...

Code:
		private sealed class BeginRazorHandshake : ProtocolExtension
		{
			public BeginRazorHandshake() : base( 0xFE, 8 )
			{
				m_Stream.Write( (uint)((ulong)RazorFeatureControl.DisallowedFeatures >> 32) );
				m_Stream.Write( (uint)((ulong)RazorFeatureControl.DisallowedFeatures & 0xFFFFFFFF) );
			}
		}

...that it does not freeze. Is there a different packet used for 7.0.3 clients maybe?

-Djeryv
 

Djeryv

Sorceror
If I comment the line below...

Code:
		private static void EventSink_Login( LoginEventArgs e )
		{
			Mobile m = e.Mobile;
			if ( m != null && m.NetState != null && m.NetState.Running )
			{
				Timer t;

				[COLOR="Red"]//m.Send( new BeginRazorHandshake() );[/COLOR]
				
				if ( m_Table.ContainsKey( m ) )
				{
					t = m_Table[m] as Timer;
					if ( t != null && t.Running )
						t.Stop();
				}

				m_Table[m] = t = Timer.DelayCall( RazorFeatureControl.HandshakeTimeout, OnHandshakeTimeout_Callback, m );
				t.Start();
			}
		}

...then the rest of the script runs fine. It pops up the gump about not having razor properly configured...so it must be something with that packet sent.

-Djeryv
 

Djeryv

Sorceror
Does "anyone" run a RunUO 2.0 Final server with a 7.0.3.0 client...and has RazorNegotiator working? I would like to know if it is just my server having issues or if it is something else.

Like I posted earlier...I have Razor Negotiator working on my other RC2 server with version 6 client just fine...just can't get it to work on this newer server I am running.

-Djeryv
 

Djeryv

Sorceror
Does anyone know how I find out what the packet here...

Code:
		private sealed class BeginRazorHandshake : ProtocolExtension
		{
			public BeginRazorHandshake() : base( [COLOR="Red"]0xFE, 8[/COLOR] )
			{
				m_Stream.Write( (uint)((ulong)RazorFeatureControl.DisallowedFeatures >> 32) );
				m_Stream.Write( (uint)((ulong)RazorFeatureControl.DisallowedFeatures & 0xFFFFFFFF) );
			}
		}

Is it being sent from Razor to the Server?
Is the Server sending it?

I keep looking at Packets.cs (in the source) trying to find an answer. The 0xFE (in Packets.cs) says its an idle packet...I don't know if I am even looking in the right place. I don't even know how to find the "length" of the packet here. Any insight would be appreciated.

-Djeryv
 

Djeryv

Sorceror
I upgraded my client to 7.0.5.0 and the Negotiator works fine now. Just an FYI to anyone else that may have an issue.

-Djeryv
 

zaldeskull

Sorceror
Zippy;698314 said:
Summary
This script allows your server to negotiate with Razor to determine which features are allowed on your server. This script will work with both 1.0 and 2.0 RunUO versions.

Installation
Simply place this script anywhere in your Scripts sub-folder.

Configuration
The following entries appear at the top of the script file:
Code:
		public const bool Enabled = true; // Is the "Feature Enforced" turned on?
		public const bool KickOnFailure = true; // When true, this will cause anyone who does not negotiate (include those not running Razor at all) to be disconnected from the server.
		public static readonly TimeSpan HandshakeTimeout = TimeSpan.FromSeconds( 30.0 ); // How long to wait for a handshake response before showing warning and disconnecting
		public static readonly TimeSpan DisconnectDelay = TimeSpan.FromSeconds( 15.0 ); // How long to show warning message before they are disconnected
		public const string WarningMessage = "The server was unable to negotiate features with Razor on your system.<BR>You must be running the <A HREF=\"http://razor.runuo.com/download.php\">latest version of Razor</A> to play on this server.<BR>Once you have Razor installed and running, go to the <B>Options</B> tab and check the box in the lower right-hand corner marked <B>Negotiate features with server</B>.  Once you have this box checked, you may log in and play normally.<BR>You will be disconnected shortly.";
These are fairly self explanitory, I think. Below them is the following section:
Code:
		public static void Configure()
		{
			// TODO: Add your server's feature allowances here
			// For example, the following line will disallow all looping macros on your server
			//DisallowFeature( RazorFeatures.LoopedMacros );
		}
You can add a list of features to be blocked by editing this area. The list of features appears directly below it. So, to disallow The light filter and the weather filter, you would change this section to the following:
Code:
		public static void Configure()
		{
			DisallowFeature( RazorFeatures.FilterWeather );
			DisallowFeature( RazorFeatures.FilterLight );
		}

How it works (This section describes the default configuration. If you change the configuration, it will work differently.)
This script negotiates features with Razor by sending a packet to the client and listening for a response sent by Razor.
Razor sends the response if and only if the "Negotiate features with server" option is checked on the "Options" tab. If players do not check this box, then Razor will not respond to the negotiation packet.
After starting negotiation, the server waits for 30 seconds for Razor to respond. If no response is received, a message is displayed to the user and 15 seconds later they are disconnected from the server. This means that both users who have not checked the "Negotiate features with server" box and users who do not have Razor running at all will be disconnected from your server. If you use this script with the default configuration, your users must be running Razor version 1.0.8 or higher in order to play on your server. The reason for this is that the users must voluntarily allow the server to detect Razor. If they chose not to allow it, then the server will be unable to detect them.
If the user has their Razor properly configured, they will see no messages and can play as normal. Features which have be disallowed by the server will show up as "locked" on the Razor window and players will not be able to use them.

Note: This script also requires Razor version 1.0.8 to work. This Razor version is being released today, and all users will be automatically updated over the next 24 hours. Users who prevent razor from updating properly or who use an other version of Razor will be treated as though they are not using Razor at all. In the default configuration, this means they will be shown a message and then disconnected from the server.

NOTICE: This feature and this script have only undergone a small amount of testing. There may be unexpected problems related to this script, and you are using it AT YOUR OWN RISK. Please test it before placing it on your live shard. Also, please DO NOT post bugs in this thread. Please post bugs relating to this feature and this script in the Razor Support Forum here on RunUO.com. Please post all general support questions (How do I do ____? Why is my ____ not working?) in this thread. Please do not ask questions about this script in the Razor Support Forum. The Razor Forum is for Razor questions and bugs related to this script (not support questions)!

Thank you, and enjoy.

awesome script!!!
 

JerrodWofford

Sorceror
So for some reason when i put it in my server, no errors or anything. It loads up fine but i am able to log in with light levels filter still on in razor. Something im trying to block actually. here is the script.. Maybe you guys can tell me why its not kicking me?

Code:
using System;
using System.Collections;
using Server;
using Server.Network;
using Server.Gumps;

namespace Server.Misc
{
    public class RazorFeatureControl
    {
        public const bool Enabled = true; // Is the "Feature Enforced" turned on?
        public const bool KickOnFailure = true; // When true, this will cause anyone who does not negotiate (include

those not running Razor at all) to be disconnected from the server.
        public static readonly TimeSpan HandshakeTimeout = TimeSpan.FromSeconds( 30.0 ); // How long to wait for a

handshake response before showing warning and disconnecting
        public static readonly TimeSpan DisconnectDelay = TimeSpan.FromSeconds( 15.0 ); // How long to show warning

message before they are disconnected
        public const string WarningMessage = "The server was unable to negotiate features with Razor on your

system.<BR>You must be running the <A HREF=\"http://razor.runuo.com/download.php\">latest version of Razor</A> to play on

this server.<BR>Once you have Razor installed and running, go to the <B>Options</B> tab and check the box in the lower

right-hand corner marked <B>Negotiate features with server</B>.  Once you have this box checked, you may log in and play

normally.<BR>You will be disconnected shortly.";

        public static void Configure()
        {
            // TODO: Add your server's feature allowances here
            // For example, the following line will disallow all looping macros on your server
            //DisallowFeature( RazorFeatures.LoopedMacros );

            DisallowFeature( RazorFeatures.FilterLight );
        }

        [Flags]
        public enum RazorFeatures : ulong
        {
            None = 0,

            FilterWeather    = 1 << 0, // Weather Filter
            FilterLight    = 1 << 1, // Light Filter
            SmartTarget    = 1 << 2, // Smart Last Target
            RangedTarget    = 1 << 3, // Range Check Last Target
            AutoOpenDoors    = 1 << 4, // Automatically Open Doors
            DequipOnCast    = 1 << 5, // Unequip Weapon on spell cast
            AutoPotionEquip    = 1 << 6, // Un/Re-equip weapon on potion use
            PoisonedChecks    = 1 << 7, // Block heal If poisoned/Macro IIf Poisoned condition/Heal or Cure self
            LoopedMacros    = 1 << 8, // Disallow Looping macros, For loops, and macros that call other macros
            UseOnceAgent    = 1 << 9, // The use once agent
            RestockAgent    = 1 << 10,// The restock agent
            SellAgent    = 1 << 11,// The sell agent
            BuyAgent    = 1 << 12,// The buy agent
            PotionHotkeys    = 1 << 13,// All potion hotkeys
            RandomTargets    = 1 << 14,// All random target hotkeys (Not target next, last target, target self)
            ClosestTargets    = 1 << 15,// All closest target hotkeys
            OverheadHealth    = 1 << 16,// Health and Mana/Stam messages shown over player's heads

            All = 0xFFFFFFFFFFFFFFFF  // Every feature possible
        }

        private static RazorFeatures m_DisallowedFeatures = RazorFeatures.None;

        public static void DisallowFeature( RazorFeatures feature )
        {
            SetDisallowed( feature, true );
        }

        public static void AllowFeature( RazorFeatures feature )
        {
            SetDisallowed( feature, false );
        }

        public static void SetDisallowed( RazorFeatures feature, bool value )
        {
            if ( value )
                m_DisallowedFeatures |= feature;
            else
                m_DisallowedFeatures &= ~feature;
        }

        public static RazorFeatures DisallowedFeatures { get { return m_DisallowedFeatures; } }
    }

    public class RazorFeatureEnforcer
    {
        private static Hashtable m_Table = new Hashtable();
        private static TimerStateCallback OnHandshakeTimeout_Callback = new TimerStateCallback( OnHandshakeTimeout

);
        private static TimerStateCallback OnForceDisconnect_Callback = new TimerStateCallback( OnForceDisconnect );

        public static void Initialize()
        {
            if ( RazorFeatureControl.Enabled )
            {
                EventSink.Login += new LoginEventHandler( EventSink_Login );

                ProtocolExtensions.Register( 0xFF, true, new OnPacketReceive( OnHandshakeResponse ) );
            }
        }

        private static void EventSink_Login( LoginEventArgs e )
        {
            Mobile m = e.Mobile;
            if ( m != null && m.NetState != null && m.NetState.Running )
            {
                Timer t;

                m.Send( new BeginRazorHandshake() );

                if ( m_Table.ContainsKey( m ) )
                {
                    t = m_Table[m] as Timer;
                    if ( t != null && t.Running )
                        t.Stop();
                }

                m_Table[m] = t = Timer.DelayCall( RazorFeatureControl.HandshakeTimeout,

OnHandshakeTimeout_Callback, m );
                t.Start();
            }
        }

        private static void OnHandshakeResponse( NetState state, PacketReader pvSrc )
        {
            pvSrc.Trace( state );

            if ( state == null || state.Mobile == null || !state.Running )
                return;

            Mobile m = state.Mobile;
            Timer t = null;
            if ( m_Table.Contains( m ) )
            {
                t = m_Table[m] as Timer;

                if ( t != null )
                    t.Stop();

                m_Table.Remove( m );
            }
        }

        private static void OnHandshakeTimeout( object state )
        {
            Timer t = null;
            Mobile m = state as Mobile;
            if ( m == null )
                return;

            m_Table.Remove( m );

            if ( !RazorFeatureControl.KickOnFailure )
            {
                Console.WriteLine( "Player '{0}' failed to negotiate Razor features.", m );
            }
            else if ( m.NetState != null && m.NetState.Running )
            {
                m.SendGump( new Gumps.WarningGump( 1060635, 30720, RazorFeatureControl.WarningMessage,

0xFFC000, 420, 250, null, null ) );

                if ( m.AccessLevel <= AccessLevel.Player )
                {
                    m_Table[m] = t = Timer.DelayCall( RazorFeatureControl.DisconnectDelay,

OnForceDisconnect_Callback, m );
                    t.Start();
                }
            }
        }

        private static void OnForceDisconnect( object state )
        {
            if ( state is Mobile )
            {
                Mobile m = (Mobile)state;

                if ( m.NetState != null && m.NetState.Running )
                    m.NetState.Dispose();
                m_Table.Remove( m );

                Console.WriteLine( "Player {0} kicked (Failed Razor handshake)", m );
            }
        }

        private sealed class BeginRazorHandshake : ProtocolExtension
        {
            public BeginRazorHandshake() : base( 0xFE, 8 )
            {
                m_Stream.Write( (uint)((ulong)RazorFeatureControl.DisallowedFeatures >> 32) );
                m_Stream.Write( (uint)((ulong)RazorFeatureControl.DisallowedFeatures & 0xFFFFFFFF) );
            }
        }
    }
}
 
Top