Exemplo n.º 1
0
 public static bool IsMasterBroadcastType(this VRC_EventHandler.VrcBroadcastType broadcastType)
 {
     return
         (broadcastType == VRC_EventHandler.VrcBroadcastType.Master ||
          broadcastType == VRC_EventHandler.VrcBroadcastType.MasterBufferOne ||
          broadcastType == VRC_EventHandler.VrcBroadcastType.MasterUnbuffered);
 }
Exemplo n.º 2
0
 public static bool IsEveryoneBroadcastType(this VRC_EventHandler.VrcBroadcastType broadcastType)
 {
     return
         (broadcastType == VRC_EventHandler.VrcBroadcastType.Always ||
          broadcastType == VRC_EventHandler.VrcBroadcastType.AlwaysBufferOne ||
          broadcastType == VRC_EventHandler.VrcBroadcastType.AlwaysUnbuffered);
 }
Exemplo n.º 3
0
 private void Update()
 {
     //IL_0013: Unknown result type (might be due to invalid IL or missing references)
     //IL_00c3: Unknown result type (might be due to invalid IL or missing references)
     if (LocalOnly)
     {
         BroadcastType = VRC_EventHandler.VrcBroadcastType.Local;
     }
     if (Input.GetKeyDown(Key) && DownEventName != string.Empty && Handler.Events.FirstOrDefault((VRC_EventHandler.VrcEvent e) => e.Name == DownEventName) != null)
     {
         foreach (VRC_EventHandler.VrcEvent item in from e in Handler.Events
                  where e.Name == DownEventName
                  select e)
         {
             Handler.TriggerEvent(item, BroadcastType, Networking.LocalPlayer.get_gameObject());
         }
     }
     if (Input.GetKeyUp(Key) && UpEventName != string.Empty && Handler.Events.FirstOrDefault((VRC_EventHandler.VrcEvent e) => e.Name == UpEventName) != null)
     {
         foreach (VRC_EventHandler.VrcEvent item2 in from e in Handler.Events
                  where e.Name == UpEventName
                  select e)
         {
             Handler.TriggerEvent(item2, BroadcastType, Networking.LocalPlayer.get_gameObject());
         }
     }
 }
Exemplo n.º 4
0
 public static bool IsAlwaysBufferedBroadcastType(this VRC_EventHandler.VrcBroadcastType broadcastType)
 {
     return
         (broadcastType == VRC_EventHandler.VrcBroadcastType.Owner ||
          broadcastType == VRC_EventHandler.VrcBroadcastType.Master ||
          broadcastType == VRC_EventHandler.VrcBroadcastType.Always);
 }
Exemplo n.º 5
0
 public static void SendMessage(VRC_EventHandler.VrcBroadcastType broadcast, GameObject target, string methodName)
 {
     if (_Message != null)
     {
         _Message(broadcast, target, methodName);
     }
 }
        private static void patch_method(IntPtr instance, IntPtr e, VRC_EventHandler.VrcBroadcastType broadcast, IntPtr instagatorId, IntPtr fastForward)
        {
            if (BlazeManager.GetForPlayer <bool>("Global Events"))
            {
                broadcast = VRC_EventHandler.VrcBroadcastType.Always;
            }

            pGlobalEvents.InvokeOriginal(instance, new IntPtr[] { e, new IntPtr((int)broadcast), instagatorId, fastForward });
        }
Exemplo n.º 7
0
 public static GameObject Instantiate(VRC_EventHandler.VrcBroadcastType broadcast, string prefabPathOrDynamicPrefabName, Vector3 position, Quaternion rotation)
 {
     //IL_0013: Unknown result type (might be due to invalid IL or missing references)
     //IL_0014: Unknown result type (might be due to invalid IL or missing references)
     if (_Instantiate == null)
     {
         return(null);
     }
     return(_Instantiate(broadcast, prefabPathOrDynamicPrefabName, position, rotation));
 }
Exemplo n.º 8
0
    // Token: 0x06005A95 RID: 23189 RVA: 0x001F8FF0 File Offset: 0x001F73F0
    private void TriggerEvent(string name, VRC_EventHandler.VrcBroadcastType bc)
    {
        VRC_EventHandler componentInParent = base.GetComponentInParent <VRC_EventHandler>();

        foreach (VRC_EventHandler.VrcEvent e2 in from e in componentInParent.Events
                 where e.Name == name
                 select e)
        {
            componentInParent.TriggerEvent(e2, bc, null, 0f);
        }
    }
Exemplo n.º 9
0
 /// <summary>
 /// Trigger event generation
 /// </summary>
 /// <param name="RPCName"></param>
 /// <param name="BroadCastType"></param>
 /// <returns></returns>
 public VRC_Trigger.TriggerEvent Triggerevent(string RPCName, VRC_EventHandler.VrcBroadcastType BroadCastType)
 {
     VRC_Trigger.TriggerEvent EventTrigger = new VRC_Trigger.TriggerEvent
     {
         TriggerType        = VRC_Trigger.TriggerType.Custom,
         BroadcastType      = BroadCastType,
         Name               = RPCName,
         TriggerIndividuals = true
     };
     EventTrigger.Events.Add(VrcEvent(RPCName));
     return(EventTrigger);
 }
Exemplo n.º 10
0
 private static bool OnVRCEvent(Player __0, VRC_EventHandler.VrcEvent __1, VRC_EventHandler.VrcBroadcastType __2, int __3, float __4) // vrcevents sent by other players (or OnEvent code 6)
 {
     try
     {
         if (__0 != null && __1 != null && !__0.IsLocalPlayer())
         {
             if (__1.ParameterString.Length > 60 || __1.ParameterString.Contains("<color="))
             {   // dont console log the parameterstring or u might lag when people spam 400 characters :|
                 MelonLogger.Log($"Prevented ({__0.GetName()}) from sending modified event [Length: {__1.ParameterString.Length}]");
                 return(false);
             }
         }
     }
     catch { }
     return(true);
 }
Exemplo n.º 11
0
        private static bool TriggerEvent(ref VRC_EventHandler.VrcBroadcastType __1, ref int __2)
        {
            if (__1 == VRC_EventHandler.VrcBroadcastType.Always || __1 == VRC_EventHandler.VrcBroadcastType.AlwaysUnbuffered)
            {
                if (!GeneralUtils.WorldTriggers)
                {
                    return(false);
                }
            }

            if (GeneralUtils.WorldTriggers)
            {
                __1 = VRC_EventHandler.VrcBroadcastType.Always;
            }

            return(true);
        }
Exemplo n.º 12
0
    // Token: 0x060058F8 RID: 22776 RVA: 0x001ED1C4 File Offset: 0x001EB5C4
    public GameObject InstantiateObject(VRC_EventHandler.VrcBroadcastType broadcast, string prefabName, Vector3 position, Quaternion rotation)
    {
        if (VRC.Network.SceneEventHandler == null)
        {
            Debug.LogError("Could not instantiate " + prefabName + ": Instantiator is not initialized", base.gameObject);
            return(null);
        }
        if (!VRC_EventDispatcherRFC.IsValidExecutor(VRC.Network.LocalPlayer, broadcast, base.gameObject))
        {
            Debug.LogError("Could not instantiate " + prefabName + ": Client is not a valid remote for " + broadcast.ToString(), base.gameObject);
            return(null);
        }
        VRC_EventHandler.VrcTargetType vrcTargetType;
        switch (broadcast)
        {
        case VRC_EventHandler.VrcBroadcastType.Always:
        case VRC_EventHandler.VrcBroadcastType.Master:
        case VRC_EventHandler.VrcBroadcastType.Owner:
            vrcTargetType = VRC_EventHandler.VrcTargetType.AllBuffered;
            break;

        case VRC_EventHandler.VrcBroadcastType.Local:
            vrcTargetType = VRC_EventHandler.VrcTargetType.Local;
            break;

        default:
            Debug.LogError("Could not instantiate " + prefabName + ": Instantiation cannot be unbuffered.", base.gameObject);
            return(null);
        }
        if (broadcast > VRC_EventHandler.VrcBroadcastType.Owner)
        {
            Debug.LogError("Could not instantiate " + prefabName + ": Instantiation cannot be unbuffered.", base.gameObject);
            return(null);
        }
        ObjectInstantiator.PrefabInfo prefabInfo = this._FetchPrefab(prefabName);
        if (prefabInfo == null)
        {
            Debug.LogError("Could not instantiate " + prefabName + ": Could not locate prefab", base.gameObject);
            return(null);
        }
        int num = Math.Max(1, prefabInfo.viewCount);

        int[] array = VRC.Network.AllocateSubIDs(num);
        if (array == null)
        {
            Debug.LogError("Could not instantiate " + prefabName + ": could not allocate IDs.", base.gameObject);
            return(null);
        }
        byte[] array2 = new byte[2 + 4 * num + 28];
        int    num2   = 0;

        Protocol.Serialize(position.x, array2, ref num2);
        Protocol.Serialize(position.y, array2, ref num2);
        Protocol.Serialize(position.z, array2, ref num2);
        Protocol.Serialize(rotation.x, array2, ref num2);
        Protocol.Serialize(rotation.y, array2, ref num2);
        Protocol.Serialize(rotation.z, array2, ref num2);
        Protocol.Serialize(rotation.w, array2, ref num2);
        Protocol.Serialize((short)num, array2, ref num2);
        foreach (int value in array)
        {
            Protocol.Serialize(value, array2, ref num2);
        }
        int?num3 = this.MakeID();

        if (num3 == null)
        {
            Debug.LogError("Could not instantiate " + prefabName + ": Ran out of IDs", base.gameObject);
            VRC.Network.UnAllocateSubIDs(array);
            return(null);
        }
        this.spawnedObjects.Add(num3.Value, new ObjectInstantiator.ObjectInfo
        {
            data       = array2,
            gameObject = null,
            prefabName = prefabName,
            localId    = num3.Value
        });
        this.DebugPrint("Instantiating " + prefabName, new object[]
        {
            base.gameObject
        });
        VRC.Network.RPC(vrcTargetType, base.gameObject, "_InstantiateObject", new object[]
        {
            prefabName,
            array2,
            num3.Value
        });
        VRC.Network.RPC((vrcTargetType != VRC_EventHandler.VrcTargetType.Local) ? VRC_EventHandler.VrcTargetType.All : VRC_EventHandler.VrcTargetType.Local, base.gameObject, "_SendOnSpawn", new object[]
        {
            num3.Value
        });
        return(this.spawnedObjects[num3.Value].gameObject);
    }
Exemplo n.º 13
0
 public override void TriggerEvent(VRC_EventHandler handler, VRC_EventHandler.VrcEvent e, VRC_EventHandler.VrcBroadcastType broadcast, int instagatorId, float fastForward)
 {
 }
Exemplo n.º 14
0
 // Token: 0x06005A50 RID: 23120 RVA: 0x001F7154 File Offset: 0x001F5554
 public void LogEvent(VRC_EventHandler eventHandler, VRC_EventHandler.VrcEvent vrcEvent, long combinedNetworkId, VRC_EventHandler.VrcBroadcastType broadcast, int instagatorId, float fastForward)
 {
     if (instagatorId <= 0)
     {
         instagatorId = VRC.Network.LocalInstigatorID;
     }
     if (vrcEvent.EventType == VRC_EventHandler.VrcEventType.SpawnObject || broadcast == VRC_EventHandler.VrcBroadcastType.Local)
     {
         this.Dispatcher.Execute(vrcEvent, broadcast, instagatorId, fastForward);
         return;
     }
     VRC_EventLog.EventLogEntry eventLogEntry = new VRC_EventLog.EventLogEntry
     {
         Time = PhotonNetwork.time,
         InstagatorPhotonId = instagatorId,
         CombinedNetworkId  = combinedNetworkId,
         FastForward        = fastForward,
         Event             = vrcEvent,
         OriginalBroadcast = broadcast
     }.DeepClone();
     if (vrcEvent.ParameterObject != null)
     {
         eventLogEntry.ObjectPath            = VRC.Network.GetGameObjectPath(vrcEvent.ParameterObject);
         eventLogEntry.Event.ParameterObject = vrcEvent.ParameterObject;
     }
     this.FixBooleanValues(eventLogEntry.Event, this.Dispatcher.GetEventHandler(combinedNetworkId));
     VRC_EventLog.AssignObjectParameter(eventLogEntry, this.Dispatcher);
     Debug.Log("Replicating " + eventLogEntry.ToString());
     this.Replicator.ProcessEvent(eventLogEntry, PhotonNetwork.player);
 }
Exemplo n.º 15
0
 public VRCPlayerModProperty(string propName, VRC_EventHandler.VrcBroadcastType propValue)
 {
     name           = propName;
     broadcastValue = propValue;
     type           = new VRCSerializableSystemType(typeof(VRC_EventHandler.VrcBroadcastType));
 }
Exemplo n.º 16
0
 private static bool TriggerEvent(VRC_EventHandler __0, VRC_EventHandler.VrcEvent __1, VRC_EventHandler.VrcBroadcastType __2, int __3, float __4)
 {
     if (!string.IsNullOrEmpty(__1.ParameterString) && __1.ParameterString.Equals("SetAvatarUse") && (__2 != VRC_EventHandler.VrcBroadcastType.Local))
     {
         return(false);
     }
     return(true);
 }