Esempio n. 1
0
        static object PerformMemberwiseClone(ref object o)
        {
            var ins = new UnityEngine.NetworkPlayer();

            ins = (UnityEngine.NetworkPlayer)o;
            return(ins);
        }
Esempio n. 2
0
        static StackObject *Ctor_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Int32 @port = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.String @ip = (System.String) typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);


            var result_of_this_method = new UnityEngine.NetworkPlayer(@ip, @port);

            if (!isNewObj)
            {
                __ret--;
                WriteBackInstance(__domain, __ret, __mStack, ref result_of_this_method);
                return(__ret);
            }

            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
Esempio n. 3
0
        /// <summary>
        /// Gets the ClientInfo of a NetworkPlayer.
        /// </summary>
        /// <returns>The NetworkPlayer's ClientInfo or null if it doesn't exist.</returns>
        /// <param name="networkPlayer">The NetworkPlayer.</param>
        /// <param name="gmgr">The GameManager to use for searching the ClientInfo (default : <see cref="SurvivalKit.SKMain.currentGameManager"/>).</param>
        public static ClientInfo getClientInfo(UnityEngine.NetworkPlayer networkPlayer, GameManager gmgr = null)
        {
            if (SKMain.SkMain.gameIsClient())
            {
                return(null);
            }
            if (gmgr == null)
            {
                gmgr = SkMain.currentGameManager();
                if (gmgr == null)
                {
                    throw new Exception("null GameManager");
                }
            }
            ConnectionManager cm = gmgr.connectionManager;

            if (cm == null)
            {
                throw new Exception("null ConnectionManager");
            }
            foreach (ClientInfo cinfo in cm.connectedClients.Values)
            {
                if (cinfo.networkPlayer.Equals(networkPlayer))
                {
                    return(cinfo);
                }
            }
            return(null);
        }
Esempio n. 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SurvivalKit.Events.Network.ReadPacketFromBufEvent"/> class.
        /// </summary>
        /// <param name="args">
        /// An object array of data to pass to the event.
        /// args[0] (bool) indicates whether the event is cancelled
        /// args[1] (string) the name of the fired RPC.
        /// args[2] (object) the first argument of the fired RPC. (following args contain following RPC arguments)
        /// </param>
        public RPCEvent(Object[] args)
        {
            if (args == null || args.Length < 3)
            {
                throw new ArgumentNullException();
            }
            this.cancelled = (bool)args[0];
            this.name      = (string)args[1];
            this.args      = new object[args.Length - 2];
            for (int i = 2; i < args.Length; i++)
            {
                this.args[i - 2] = args[i];
            }

            if (this.name.Equals("RPC_ChatMessage") && this.args[0] != null)               //string _msg, int _teamNo, string _playerName, bool _bOpenWdw
            {
                string message = (string)this.args[0];
                if (message.Length <= 0)
                {
                    this.cancelled = true;
                }
                else if (message.Length > 1 && message[0] == '/')
                {
                    string[] splitCmd = message.Split(new char[] { ' ' });
                    string[] cmdArgs  = new string[splitCmd.Length - 1];
                    for (int i = 1; i < splitCmd.Length; i++)
                    {
                        cmdArgs[i - 1] = splitCmd[i];
                    }
                    splitCmd[0] = splitCmd[0].Substring(1);
                    UnityEngine.NetworkPlayer networkPlayer = ((UnityEngine.NetworkMessageInfo) this.args[this.args.Length - 1]).sender;
                    foreach (GameManager curGmgr in SKMain.SkMain.activeGameManagers())
                    {
                        EntityPlayer playerEntity = SKMain.getPlayerEntity(networkPlayer, curGmgr);
                        if (playerEntity == null)
                        {
                            continue;
                        }

                        string alias = splitCmd[0], command = splitCmd[0];
                        var    commandSender = new SurvivalKit.Permissions.PlayerCommandSender(playerEntity, networkPlayer);

                        var isCancelled = EventAggregator.GetInstance().DispatchCommand(command, commandSender, alias, cmdArgs);
                        if (isCancelled)
                        {
                            cancelled = true;

                            // Why do we set these arguments to null? Shouldn't we set the properties 'name' and 'rpcclass' to null?
                            this.args[0] = null;
                            this.args[1] = null;
                            break;
                        }
                    }
                }
            }
        }
Esempio n. 5
0
 public void RPC(System.String name, UnityEngine.NetworkPlayer target, System.Object[] args)
 {
     //Mock Data:
     if (m_functionCallCounts == null)
     {
         m_functionCallCounts = new Dictionary <string, int>();
     }
     if (!m_functionCallCounts.ContainsKey("Void RPC(System.String, NetworkPlayer, System.Object[])"))
     {
         m_functionCallCounts.Add("Void RPC(System.String, NetworkPlayer, System.Object[])", 0);
     }
     m_functionCallCounts["Void RPC(System.String, NetworkPlayer, System.Object[])"]++;
 }
Esempio n. 6
0
 public void Serialize(ref UnityEngine.NetworkPlayer value)
 {
     //Mock Data:
     if (m_functionCallCounts == null)
     {
         m_functionCallCounts = new Dictionary <string, int>();
     }
     if (!m_functionCallCounts.ContainsKey("Void Serialize(NetworkPlayer ByRef)"))
     {
         m_functionCallCounts.Add("Void Serialize(NetworkPlayer ByRef)", 0);
     }
     m_functionCallCounts["Void Serialize(NetworkPlayer ByRef)"]++;
 }
Esempio n. 7
0
        public System.Boolean SetScope(UnityEngine.NetworkPlayer player, System.Boolean relevancy)
        {
            //Mock Data:
            if (m_functionCallCounts == null)
            {
                m_functionCallCounts = new Dictionary <string, int>();
            }
            if (!m_functionCallCounts.ContainsKey("Boolean SetScope(NetworkPlayer, Boolean)"))
            {
                m_functionCallCounts.Add("Boolean SetScope(NetworkPlayer, Boolean)", 0);
            }
            m_functionCallCounts["Boolean SetScope(NetworkPlayer, Boolean)"]++;

            throw new NotImplementedException("This function was automatically generated by Mockery and has no real implementation yet.");
        }
        static void WriteBackInstance(CSHotFix.Runtime.Enviorment.AppDomain __domain, StackObject *ptr_of_this_method, IList <object> __mStack, ref UnityEngine.NetworkPlayer instance_of_this_method)
        {
            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
            switch (ptr_of_this_method->ObjectType)
            {
            case ObjectTypes.Object:
            {
                __mStack[ptr_of_this_method->Value] = instance_of_this_method;
            }
            break;

            case ObjectTypes.FieldReference:
            {
                var ___obj = __mStack[ptr_of_this_method->Value];
                if (___obj is ILTypeInstance)
                {
                    ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = instance_of_this_method;
                }
                else
                {
                    var t = __domain.GetType(___obj.GetType()) as CLRType;
                    t.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, instance_of_this_method);
                }
            }
            break;

            case ObjectTypes.StaticFieldReference:
            {
                var t = __domain.GetType(ptr_of_this_method->Value);
                if (t is ILType)
                {
                    ((ILType)t).StaticInstance[ptr_of_this_method->ValueLow] = instance_of_this_method;
                }
                else
                {
                    ((CLRType)t).SetStaticFieldValue(ptr_of_this_method->ValueLow, instance_of_this_method);
                }
            }
            break;

            case ObjectTypes.ArrayReference:
            {
                var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as UnityEngine.NetworkPlayer[];
                instance_of_arrayReference[ptr_of_this_method->ValueLow] = instance_of_this_method;
            }
            break;
            }
        }
        static StackObject *op_Inequality_1(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.NetworkPlayer rhs = (UnityEngine.NetworkPlayer) typeof(UnityEngine.NetworkPlayer).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);
            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.NetworkPlayer lhs = (UnityEngine.NetworkPlayer) typeof(UnityEngine.NetworkPlayer).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = lhs != rhs;

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value      = result_of_this_method ? 1 : 0;
            return(__ret + 1);
        }
Esempio n. 10
0
        /// <summary>
        /// Determines whether a player entityId has the given UnityEngine.NetworkPlayer.
        /// </summary>
        /// <returns><c>true</c>, if the 7dtd instance is a server and if entityId has networkPlayer, <c>false</c> otherwise.</returns>
        /// <param name="player">The player entity to compare networkPlayer with.</param>
        /// <param name="networkPlayer">The NetworkPlayer.</param>
        public static bool playerEquals(EntityPlayer player, UnityEngine.NetworkPlayer networkPlayer)
        {
            if (SKMain.SkMain.gameIsClient())
            {
                return(false);
            }
            ConnectionManager cm = SingletonMonoBehaviour <ConnectionManager> .Instance;

            if (cm == null)
            {
                throw new Exception("null ConnectionManager");
            }
            foreach (ClientInfo cinfo in cm.connectedClients.Values)
            {
                if (cinfo.entityId == player.entityId)
                {
                    return(cinfo.networkPlayer.Equals(networkPlayer));
                }
            }
            return(false);
        }
        static StackObject *SetScope_10(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 3);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Boolean relevancy = ptr_of_this_method->Value == 1;
            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.NetworkPlayer player = (UnityEngine.NetworkPlayer) typeof(UnityEngine.NetworkPlayer).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);
            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            UnityEngine.NetworkView instance_of_this_method;
            instance_of_this_method = (UnityEngine.NetworkView) typeof(UnityEngine.NetworkView).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.SetScope(player, relevancy);

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value      = result_of_this_method ? 1 : 0;
            return(__ret + 1);
        }
Esempio n. 12
0
        /// <summary>
        /// Gets the player entity of a NetworkPlayer.
        /// </summary>
        /// <returns>The player entity or null if it doesn't exist.</returns>
        /// <param name="networkPlayer">The NetworkPlayer.</param>
        /// <param name="gmgr">The GameManager to use for searching the EntityPlayer (default : <see cref="SurvivalKit.SKMain.currentGameManager"/>).</param>
        public static EntityPlayer getPlayerEntity(UnityEngine.NetworkPlayer networkPlayer, GameManager gmgr = null)
        {
            if (SKMain.SkMain.gameIsClient())
            {
                return(null);
            }
            if (gmgr == null)
            {
                gmgr = SkMain.currentGameManager();
                if (gmgr == null)
                {
                    throw new Exception("null GameManager");
                }
            }
            ConnectionManager cm = gmgr.connectionManager;

            if (cm == null)
            {
                throw new Exception("null ConnectionManager");
            }
            foreach (ClientInfo cinfo in cm.connectedClients.Values)
            {
                if (cinfo.networkPlayer.Equals(networkPlayer))
                {
                    foreach (EntityPlayer player in gmgr.World.playerEntities.list)
                    {
                        if (player.entityId == cinfo.entityId)
                        {
                            return(player);
                        }
                    }
                    return(null);
                }
            }
            return(null);
        }
Esempio n. 13
0
 public static System.Int32 GetAveragePing(UnityEngine.NetworkPlayer player)
 {
     throw new NotImplementedException("This function was automatically generated by Mockery and has no real implementation yet.");
 }
Esempio n. 14
0
        static StackObject *Serialize_10(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
            UnityEngine.NetworkPlayer value = (UnityEngine.NetworkPlayer) typeof(UnityEngine.NetworkPlayer).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.BitStream instance_of_this_method;
            instance_of_this_method = (UnityEngine.BitStream) typeof(UnityEngine.BitStream).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.Serialize(ref value);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            switch (ptr_of_this_method->ObjectType)
            {
            case ObjectTypes.StackObjectReference:
            {
                var ___dst = *(StackObject **)&ptr_of_this_method->Value;
                __mStack[___dst->Value] = value;
            }
            break;

            case ObjectTypes.FieldReference:
            {
                var ___obj = __mStack[ptr_of_this_method->Value];
                if (___obj is ILTypeInstance)
                {
                    ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = value;
                }
                else
                {
                    var t = __domain.GetType(___obj.GetType()) as CLRType;
                    t.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, value);
                }
            }
            break;

            case ObjectTypes.StaticFieldReference:
            {
                var t = __domain.GetType(ptr_of_this_method->Value);
                if (t is ILType)
                {
                    ((ILType)t).StaticInstance[ptr_of_this_method->ValueLow] = value;
                }
                else
                {
                    ((CLRType)t).SetStaticFieldValue(ptr_of_this_method->ValueLow, value);
                }
            }
            break;

            case ObjectTypes.ArrayReference:
            {
                var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as UnityEngine.NetworkPlayer[];
                instance_of_arrayReference[ptr_of_this_method->ValueLow] = value;
            }
            break;
            }

            return(__ret);
        }
Esempio n. 15
0
 public static void CloseConnection(UnityEngine.NetworkPlayer target, System.Boolean sendDisconnectionNotification)
 {
 }
Esempio n. 16
0
 public static void DestroyPlayerObjects(UnityEngine.NetworkPlayer playerID)
 {
 }
Esempio n. 17
0
 public static void RemoveRPCs(UnityEngine.NetworkPlayer playerID)
 {
 }
Esempio n. 18
0
 public static void RemoveRPCs(UnityEngine.NetworkPlayer playerID, System.Int32 group)
 {
 }
Esempio n. 19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SurvivalKit.Permissions.PlayerCommandSender"/> class able to be used as a <see cref="SurvivalKit.Permissions.CommandSender"/>.
 /// </summary>
 /// <param name="sender">The player this CommandSender instance should represent.</param>
 /// <param name="networkPlayer">The NetworkPlayer used to send messages back.</param>
 public PlayerCommandSender(EntityPlayer sender, UnityEngine.NetworkPlayer networkPlayer)
 {
     this.sender        = sender;
     this.networkPlayer = networkPlayer;
     fullName           = ("player;steam=" + SKMain.getClientInfo(networkPlayer).playerId + ";");
 }
Esempio n. 20
0
 public static void SetSendingEnabled(UnityEngine.NetworkPlayer player, System.Int32 group, System.Boolean enabled)
 {
 }