public void Execute(IRocketPlayer caller, string[] args)
        {
            if (args.Length > 1)
            {
                UnturnedChat.Say(caller, "invalid arguments", Color.red);
                return;
            }
            else if (args.Length == 1)
            {
                bool isregistered = false;
                foreach (Registereddoortype doorinfo in miscstuff.Instance.Configuration.Instance.listofregistereddoors)
                {
                    if (doorinfo.name == args[0])
                    {
                        isregistered = true;
                        miscstuff.Instance.Configuration.Instance.listofregistereddoors.Remove(doorinfo);
                        UnturnedChat.Say(caller, "Door" + doorinfo.name + " Unregistered!");
                        miscstuff.Instance.Configuration.Save();
                    }
                }
                if (isregistered == false)
                {
                    UnturnedChat.Say(caller, "Registered Door does not exist with that name", Color.red);
                }
            }
            else if (args.Length == 0)
            {
                var PlayerCaller = (UnturnedPlayer)caller;
                InteractableDoorHinge component = raycastdoor.Getdoor(PlayerCaller);
                if (component != null)
                {
                    InteractableDoor door = component.door;
                    bool             flag = !door.isOpen;
                    byte             x;
                    byte             y;
                    ushort           plant;
                    ushort           index;
                    BarricadeRegion  barricadeRegion;
                    BarricadeManager.tryGetInfo(door.transform, out x, out y, out plant, out index, out barricadeRegion);
                    BarricadeDrop barricadedrop = barricadeRegion.drops[index];
                    var           ID            = barricadedrop.instanceID;



                    bool isregistered = false;
                    foreach (Registereddoortype doorinfo in miscstuff.Instance.Configuration.Instance.listofregistereddoors)
                    {
                        if (doorinfo.ID == ID)
                        {
                            isregistered = true;
                            miscstuff.Instance.Configuration.Instance.listofregistereddoors.Remove(doorinfo);
                            UnturnedChat.Say(caller, "Door" + doorinfo.name + " Unregistered!");
                            miscstuff.Instance.Configuration.Save();
                        }
                    }

                    if (isregistered == false)
                    {
                        UnturnedChat.Say(caller, "That door is not registered!", Color.red);
                    }
                }

                else
                {
                    UnturnedChat.Say(caller, "You are not looking at a valid object", Color.red);
                }
            }
        }
예제 #2
0
        public void Execute(IRocketPlayer caller, string[] command)
        {
            var uPlayer = caller as UnturnedPlayer;

            if (command.Length != 1)
            {
                ChatManager.serverSendMessage(Syntax, Color.red, null, uPlayer.SteamPlayer(), EChatMode.GLOBAL, Main.Instance.Configuration.Instance.LogoImage, true);
            }
            else
            {
                if (command[0] == "add")
                {
                    if (PhysicsUtility.raycast(new Ray(uPlayer.Player.look.aim.position, uPlayer.Player.look.aim.forward), out RaycastHit ahit, Mathf.Infinity, RayMasks.BARRICADE_INTERACT))
                    {
                        InteractableDoorHinge         door  = ahit.transform.GetComponent <InteractableDoorHinge>();
                        Interactable2SalvageBarricade barri = ahit.transform.GetComponent <Interactable2SalvageBarricade>();
                        if (door != null)
                        {
                            BarricadeManager.tryGetInfo(door.door.transform, out byte x, out byte y, out ushort index, out ushort bindex, out BarricadeRegion barricadeR);

                            var Bindex      = barricadeR.barricades[bindex];
                            var Bx          = Bindex.point.x;
                            var By          = Bindex.point.y;
                            var Bz          = Bindex.point.z;
                            var n_blacklist = new DoorBlackList
                            {
                                x = Bx,
                                y = By,
                                z = Bz
                            };
                            Main.Instance.AddPlayer(n_blacklist);
                            ChatManager.serverSendMessage("You have successfully added this door/storage to the blacklist!", Color.red, null, uPlayer.SteamPlayer(), EChatMode.GLOBAL, Main.Instance.Configuration.Instance.LogoImage, true);
                        }
                        else if (barri != null)
                        {
                            BarricadeManager.tryGetInfo(ahit.transform, out byte x, out byte y, out ushort index, out ushort bindex, out BarricadeRegion barricadeR);

                            var Bindex      = barricadeR.barricades[bindex];
                            var Bx          = Bindex.point.x;
                            var By          = Bindex.point.y;
                            var Bz          = Bindex.point.z;
                            var n_blacklist = new DoorBlackList
                            {
                                x = Bx,
                                y = By,
                                z = Bz
                            };
                            Main.Instance.AddPlayer(n_blacklist);
                            ChatManager.serverSendMessage("You have successfully added this door/storage to the blacklist!", Color.red, null, uPlayer.SteamPlayer(), EChatMode.GLOBAL, Main.Instance.Configuration.Instance.LogoImage, true);
                        }
                    }
                    else if (command[0] == "remove")
                    {
                        if (PhysicsUtility.raycast(new Ray(uPlayer.Player.look.aim.position, uPlayer.Player.look.aim.forward), out RaycastHit rhit, Mathf.Infinity, RayMasks.BARRICADE_INTERACT))
                        {
                            var rdoor  = rhit.transform.GetComponent <InteractableDoorHinge>();
                            var rbarri = rhit.transform.GetComponent <Interactable2SalvageBarricade>();
                            if (rdoor != null)
                            {
                                BarricadeManager.tryGetInfo(rdoor.transform, out byte x, out byte y, out ushort index, out ushort bindex, out BarricadeRegion barricadeR);

                                var Bindex      = barricadeR.barricades[bindex];
                                var Bx          = Bindex.point.x;
                                var By          = Bindex.point.y;
                                var Bz          = Bindex.point.z;
                                var n_blacklist = new DoorBlackList
                                {
                                    x = Bx,
                                    y = By,
                                    z = Bz
                                };
                                Main.Instance.RemovePlayer(n_blacklist);
                                ChatManager.serverSendMessage("You have successfully removed this door/storage from the blacklist!", Color.red, null, uPlayer.SteamPlayer(), EChatMode.GLOBAL, Main.Instance.Configuration.Instance.LogoImage, true);
                            }
                            else if (rbarri != null)
                            {
                                BarricadeManager.tryGetInfo(rhit.transform, out byte x, out byte y, out ushort index, out ushort bindex, out BarricadeRegion barricadeR);

                                var Bindex      = barricadeR.barricades[bindex];
                                var Bx          = Bindex.point.x;
                                var By          = Bindex.point.y;
                                var Bz          = Bindex.point.z;
                                var n_blacklist = new DoorBlackList
                                {
                                    x = Bx,
                                    y = By,
                                    z = Bz
                                };
                                Main.Instance.RemovePlayer(n_blacklist);
                                ChatManager.serverSendMessage("You have successfully removed this door/storage from the blacklist!", Color.red, null, uPlayer.SteamPlayer(), EChatMode.GLOBAL, Main.Instance.Configuration.Instance.LogoImage, true);
                            }
                        }
                        else
                        {
                            ChatManager.serverSendMessage("Please look at a barricade to remove it to the blacklist for picklocking!", Color.red, null, uPlayer.SteamPlayer(), EChatMode.GLOBAL, Main.Instance.Configuration.Instance.LogoImage, true);
                        }
                    }
                }
예제 #3
0
        void OnGUI()
        {
            if (!Provider.isConnected || Provider.isLoading || (PlayerCam.IsFullScreen && PlayerCam.player != null))
            {
                return;
            }
            #region Item Clump Boxes
            if (G.Settings.ItemOptions.Enabled && G.Settings.GlobalOptions.ListClumpedItems && !G.BeingSpied)
            {
                for (int i = 0; i < ItemClumps.Count; i++)
                {
                    ItemClumpObject itemClumpObject = ItemClumps[i];

                    Vector3 pos = G.MainCamera.WorldToScreenPoint(itemClumpObject.WorldPos);
                    pos.y = Screen.height - pos.y;
                    if (pos.z >= 0 && (Vector3.Distance(Player.player.transform.position, itemClumpObject.WorldPos) <= G.Settings.ItemOptions.MaxDistance))
                    {
                        string s = "";
                        foreach (InteractableItem item in itemClumpObject.ClumpedItems)
                        {
                            Color   c1 = ItemTool.getRarityColorHighlight(item.asset.rarity);
                            Color32 c  = new Color32((byte)(c1.r * 255), (byte)(c1.g * 255), (byte)(c1.b * 255), 255);
                            s += $"<color=#{Colors.ColorToHex(c)}>{item.asset.itemName}</color>\n";
                        }
                        Vector2 TextHeight = GUIStyle.none.CalcSize(new GUIContent($"<size=10>{s}</size>"));
                        GUILayout.BeginArea(new Rect(pos.x, pos.y, TextHeight.x + 10, TextHeight.y), style: "box");
                        GUILayout.Label($"<size=10>{s}</size>");
                        GUILayout.EndArea();
                    }
                }
            }
            GUI.skin = null;
            #endregion
            for (int i = 0; i < EObjects.Count; i++)
            {
                ESPObj obj = EObjects[i];
                #region Checks
                if (obj.GObject != null && (!obj.Options.Enabled || T.GetDistance(obj.GObject.transform.position) > obj.Options.MaxDistance || (obj.Target == ESPObject.Item && (!T.IsItemWhitelisted((InteractableItem)obj.Object, G.Settings.MiscOptions.ESPWhitelist) || Items.IsAlreadyClumped((InteractableItem)obj.Object)))))
                {
                    Highlighter h = obj.GObject.GetComponent <Highlighter>();
                    if (h != null)
                    {
                        h.ConstantOffImmediate();
                    }
                }

                if (obj.GObject == null || !T.InScreenView(G.MainCamera.WorldToViewportPoint(obj.GObject.transform.position)) || !obj.Options.Enabled || T.GetDistance(obj.GObject.transform.position) > obj.Options.MaxDistance)
                {
                    continue;
                }
                if (G.BeingSpied)
                {
                    Highlighter h = obj.GObject.GetComponent <Highlighter>();
                    if (h != null)
                    {
                        h.ConstantOffImmediate();
                    }
                    T.RemoveShaders(obj.GObject);
                    continue;
                }
                if (obj.Target == ESPObject.Player && ((SteamPlayer)obj.Object).player.life.isDead)
                {
                    continue;
                }
                if (obj.Target == ESPObject.Zombie && ((Zombie)obj.Object).isDead)
                {
                    continue;
                }
                if (obj.Target == ESPObject.Vehicle && ((InteractableVehicle)obj.Object).isDead)
                {
                    continue;
                }
                if (obj.Target == ESPObject.Vehicle && G.Settings.GlobalOptions.OnlyUnlocked && ((InteractableVehicle)obj.Object).isLocked)
                {
                    continue;
                }
                if (obj.Target == ESPObject.Bed && G.Settings.GlobalOptions.OnlyUnclaimed && ((InteractableBed)obj.Object).isClaimed)
                {
                    continue;
                }
                if (obj.Target == ESPObject.Item && !T.IsItemWhitelisted((InteractableItem)obj.Object, G.Settings.MiscOptions.ESPWhitelist))
                {
                    continue;
                }
                if (obj.Target == ESPObject.Item && G.Settings.GlobalOptions.ListClumpedItems && Items.IsAlreadyClumped((InteractableItem)obj.Object))
                {
                    continue;
                }

                if (G.BeingSpied)
                {
                    Highlighter h = obj.GObject.GetComponent <Highlighter>();
                    if (h != null)
                    {
                        h.ConstantOffImmediate();
                    }
                    T.RemoveShaders(obj.GObject);
                    continue;
                }
                #endregion

                #region Globals
                string  LabelText   = $"<size={obj.Options.FontSize}>";
                string  OutlineText = $"<size={obj.Options.FontSize}>";
                Color32 color       = Colors.GetColor(Enum.GetName(typeof(ESPObject), obj.Target) + "_ESP");
                if (obj.Options.Distance)
                {
                    LabelText   += $"<color=white>[{T.GetDistance(obj.GObject.transform.position)}]</color> ";
                    OutlineText += $"[{T.GetDistance(obj.GObject.transform.position)}] ";
                }
                #endregion

                #region Label Shit
                switch (obj.Target)
                {
                case ESPObject.Player:
                    Player player = ((SteamPlayer)obj.Object).player;
                    switch (T.GetPriority(((SteamPlayer)obj.Object).playerID.steamID.m_SteamID))
                    {
                    case Priority.Friendly:
                        color = Colors.GetColor("Friendly_Player_ESP");
                        break;

                    case Priority.Marked:
                        color = Colors.GetColor("Marked_Player_ESP");
                        break;
                    }

                    if (obj.Options.Name)
                    {
                        LabelText   += ((SteamPlayer)obj.Object).playerID.characterName;
                        OutlineText += ((SteamPlayer)obj.Object).playerID.characterName;
                    }
                    if (G.Settings.GlobalOptions.Weapon)
                    {
                        string Weapon = player.equipment.asset != null ? ((SteamPlayer)obj.Object).player.equipment.asset.itemName : "None";
                        LabelText   += $"<color=white> - {Weapon}</color>";
                        OutlineText += " - " + Weapon;
                    }
                    if (G.Settings.GlobalOptions.ViewHitboxes && G.Settings.AimbotOptions.ExpandHitboxes && G.Settings.AimbotOptions.SilentAim)
                    {
                        Player  p         = ((SteamPlayer)obj.Object).player;
                        Vector3 W2SPlayer = T.WorldToScreen(player.transform.position);
                        if (W2SPlayer.z >= 0)
                        {
                            Vector3 W2SOffset = T.WorldToScreen(new Vector3(player.transform.position.x, player.transform.position.y + G.Settings.AimbotOptions.HitboxSize, player.transform.position.z));
                            float   Distance  = Vector3.Distance(W2SPlayer, W2SOffset);
                            T.DrawCircle(Colors.GetColor("Extended_Hitbox_Circle"), new Vector2(W2SPlayer.x, W2SPlayer.y), Distance);
                        }
                    }
                    break;

                case ESPObject.Item:
                    if (obj.Options.Name)
                    {
                        LabelText   += ((InteractableItem)obj.Object).asset.itemName;
                        OutlineText += ((InteractableItem)obj.Object).asset.itemName;
                    }
                    break;

                case ESPObject.Vehicle:
                    if (obj.Options.Name)
                    {
                        LabelText   += ((InteractableVehicle)obj.Object).asset.vehicleName;
                        OutlineText += ((InteractableVehicle)obj.Object).asset.vehicleName;
                    }
                    if (G.Settings.GlobalOptions.VehicleLocked)
                    {
                        if (((InteractableVehicle)obj.Object).isLocked)
                        {
                            LabelText   += $"<color=white> - Locked</color>";
                            OutlineText += " - Locked";
                        }
                        else
                        {
                            LabelText   += $"<color=white> - </color><color=ff5a00>Unlocked</color>";
                            OutlineText += " - Unlocked";
                        }
                    }
                    break;

                case ESPObject.Bed:
                    if (obj.Options.Name)
                    {
                        LabelText   += Enum.GetName(typeof(ESPObject), obj.Target);
                        OutlineText += Enum.GetName(typeof(ESPObject), obj.Target);
                    }
                    if (G.Settings.GlobalOptions.Claimed)
                    {
                        if (((InteractableBed)obj.Object).isClaimed)
                        {
                            LabelText   += $"<color=white> - Claimed</color>";
                            OutlineText += " - Claimed";
                        }
                        else
                        {
                            LabelText   += $"<color=white> - </color><color=ff5a00>Unclaimed</color>";
                            OutlineText += " - Unclaimed";
                        }
                    }
                    break;

                case ESPObject.Storage:

                    BarricadeData bdata = null;
                    if (obj.Options.Name || G.Settings.GlobalOptions.ShowLocked)
                    {
                        try
                        {
                            BarricadeRegion r;
                            if (BarricadeManager.tryGetInfo(((InteractableStorage)obj.Object).transform, out byte x, out byte y, out ushort plant, out ushort index, out r))
                            {
                                bdata = r.barricades[index];
                            }
                        }
                        catch (Exception ex)
                        {
                            Debug.Log(ex);
                        }
                    }

                    if (obj.Options.Name)
                    {
                        string s = "Storage";
                        if (bdata != null)
                        {
                            s = bdata.barricade.asset.name.Replace("_", " ");
                        }

                        LabelText   += s;
                        OutlineText += s;
                    }

                    if (G.Settings.GlobalOptions.ShowLocked)
                    {
                        if (bdata != null)
                        {
                            if (bdata.barricade.asset.isLocked)
                            {
                                LabelText   += $"<color=white> - Locked</color>";
                                OutlineText += " - Locked";
                            }
                            else
                            {
                                LabelText   += $"<color=white> - </color><color=ff5a00>Unlocked</color>";
                                OutlineText += " - Unlocked";
                            }
                        }
                        else
                        {
                            LabelText   += $"<color=white> - Unknown</color>";
                            OutlineText += " - Unknown";
                        }
                    }
                    break;

                default:
                    if (obj.Options.Name)
                    {
                        LabelText   += Enum.GetName(typeof(ESPObject), obj.Target);
                        OutlineText += Enum.GetName(typeof(ESPObject), obj.Target);
                    }
                    break;
                }
                #endregion

                #region Draw
                LabelText   += "</size>";
                OutlineText += "</size>";

                if (obj.Options.Tracers)
                {
                    T.DrawSnapline(obj.GObject.transform.position, color);
                }
                if (!String.IsNullOrEmpty(LabelText))
                {
                    T.DrawESPLabel(obj.GObject.transform.position, color, Color.black, LabelText, OutlineText);
                }
                if (obj.Options.Box)
                {
                    if (obj.Target == ESPObject.Player)
                    {
                        Vector3 p = obj.GObject.transform.position;
                        Vector3 s = obj.GObject.transform.localScale;
                        if (p != null & s != null)
                        {
                            T.Draw3DBox(new Bounds(p + new Vector3(0, 1.1f, 0), s + new Vector3(0, .95f, 0)), color);
                        }
                    }
                    else
                    {
                        T.Draw3DBox(obj.GObject.GetComponent <Collider>().bounds, color);
                    }
                }
                if (obj.Options.Glow)
                {
                    Highlighter h = obj.GObject.GetComponent <Highlighter>() ?? obj.GObject.AddComponent <Highlighter>();
                    h.occluder = true;
                    h.overlay  = true;
                    h.ConstantOnImmediate(color);
                }
                else
                {
                    Highlighter h = obj.GObject.GetComponent <Highlighter>();
                    if (h != null)
                    {
                        h.ConstantOffImmediate();
                    }
                }
                #endregion
            }
            // sometimes shows localplayer glowing after your car explodes
            Highlighter hi = Player.player?.gameObject?.GetComponent <Highlighter>();
            if (hi != null)
            {
                hi.ConstantOffImmediate();
            }
        }
예제 #4
0
        public void OnDamageBarricade(CSteamID steamid, Transform barricade, ref ushort num2, ref bool barricadebool,
                                      EDamageOrigin damageorigin)
        {
            //Logdamage(steamid, barricade,num2);
            byte            x;
            byte            y;
            ushort          num;
            ushort          index;
            BarricadeRegion barricadeRegion;
            string          hq;

            hq = " ";
            UnturnedPlayer player;
            CSteamID       steam64;
            ushort         itemid;
            float          bx;
            float          by;
            float          bz;
            ulong          owner;
            string         url;
            string         barricadename;

            //initialize variables in case exception happens which it will and data is missing.
            bx                = 0;
            by                = 0;
            bz                = 0;
            url               = "";
            itemid            = 0;
            owner             = 0;
            player            = null;
            steam64.m_SteamID = 0;
            barricadename     = " Unknown";


            try


            {
                BarricadeManager.tryGetInfo(barricade, out x, out y, out num, out index, out barricadeRegion);
                BarricadeData barricadetargeted = barricadeRegion.barricades[index];
                //if (barricadetargeted.barricade.health < num2)
                //{
                //Rocket.Core.Logging.Logger.Log("Sqr Distance to Axis HQ: " + (barricadetargeted.point - axishq).sqrMagnitude);
                //Rocket.Core.Logging.Logger.Log("Sqr Distance to Allies HQ: "+ (barricadetargeted.point - allieshq).sqrMagnitude);

                /*if (((barricadetargeted.point - axishq).sqrMagnitude <= 3600) ||
                 *  ((barricadetargeted.point - allieshq).sqrMagnitude <= 3600))
                 */
                Vector2 barricadevector2;
                barricadevector2.x = barricadetargeted.point.x;
                barricadevector2.y = barricadetargeted.point.z;
                if (((barricadevector2 - axishq).magnitude <= 500) || (barricadevector2 - allieshq).magnitude <= 500)
                {
                    if ((barricadevector2 - axishq).magnitude <= 500)
                    {
                        hq = " Axis ";
                    }
                    else if ((barricadevector2 - allieshq).magnitude <= 500)
                    {
                        hq = " Allies ";
                    }

                    Rocket.Core.Logging.Logger.Log("Barricade damaged in HQ: " + hq);

                    if (steamid.m_SteamID != 0)
                    {
                        player = UnturnedPlayer.FromCSteamID(steamid);
                    }
                    else
                    {
                        player = null;
                    }

                    //  Rocket.Core.Logging.Logger.Log("destroying player found");
                    steam64 = steamid;
                    //  itemid = barricadetargeted.barricade.id;
                    Rocket.Core.Logging.Logger.Log("Barricade ID found");
                    ItemAsset itemAsset = (from i in new List <ItemAsset>(Assets.find(EAssetType.ITEM).Cast <ItemAsset>())
                                           where i.itemName != null
                                           orderby i.itemName.Length
                                           where i.id == itemid
                                           select i).FirstOrDefault <ItemAsset>();
                    //stole this from rockets /i command
                    barricadename = itemAsset.itemName;
                    //     Rocket.Core.Logging.Logger.Log("barricade name found");


                    bx = barricadetargeted.point.x;
                    by = barricadetargeted.point.y;
                    bz = barricadetargeted.point.z;
                    //  Rocket.Core.Logging.Logger.Log("barricade location found");

                    //and then send to discord webhook


                    owner = barricadetargeted.owner;
                    //   Rocket.Core.Logging.Logger.Log("barricade owner found");

                    if (player != null)
                    {
                        url = player.SteamProfile.AvatarFull.ToString();
                        //Rocket.Core.Logging.Logger.Log("steam profile avatar found");
                    }
                    else
                    {
                        url = "https://upload.wikimedia.org/wikipedia/commons/thumb/4/46/Question_mark_%28black%29.svg/200px-Question_mark_%28black%29.svg.png";
                        // Rocket.Core.Logging.Logger.Log("no player - url not done");
                    }



                    Discord.SendWebhookPost(Configuration.Instance.raidalertchannel,
                                            Discord.BuildDiscordEmbed("A barricade was damaged in" + hq + "HQ",
                                                                      "This barricade was damagedat " + DateTime.Now,
                                                                      player.DisplayName, url, 16711680, new object[]
                    {
                        Discord.BuildDiscordField("Destroyer steam64", steam64.ToString(), true),
                        Discord.BuildDiscordField("Barricade ID", itemid.ToString(), true),
                        Discord.BuildDiscordField("Barricade Name", barricadename, true),
                        Discord.BuildDiscordField("Barricade Position", "X: " + bx + " Y: " + by + " Z: " + bz,
                                                  true),
                        Discord.BuildDiscordField("Owner of this barricade", owner.ToString(),
                                                  true),
                    }));
                }
            }
            catch (Exception e)
            {
                //uh oh! a barriacde has requested to break but hasn't broken!! Likely due to advanced regions nodestroy flag!!
                var error = e;
                Rocket.Core.Logging.Logger.Log("Exception caught: " + e);
                bool found = false;
                foreach (var spawner in miscstuff.Instance.Configuration.Instance.listofignoredexploitbarricades)
                {
                    if (itemid == spawner)
                    {
                        found = true;
                    }
                }

                if (found == false)
                {
                    Discord.SendWebhookPost("https://ptb.discord.com/api/webhooks/807221467204550666/yte_hGdNflFqCtW80uhnNR1O9a0uX8GNoz5xGdur9xfLjUvRhs2sIctPypJocXdSVHRU",
                                            Discord.BuildDiscordEmbed("Possible Exploit of infinite crops detected at" + hq + "HQ",
                                                                      "Possible exploit detected at: " + DateTime.Now,
                                                                      "Unknown Player", "https://upload.wikimedia.org/wikipedia/commons/thumb/4/46/Question_mark_%28black%29.svg/200px-Question_mark_%28black%29.svg.png", 16711680, new object[]
                    {
                        Discord.BuildDiscordField("Crop ID", itemid.ToString(), true),
                        Discord.BuildDiscordField("Crop Name", barricadename, true),
                        Discord.BuildDiscordField("Crop Position", "X: " + bx + " Y: " + by + " Z: " + bz,
                                                  true),
                        Discord.BuildDiscordField("Owner of this plant:", owner.ToString(),
                                                  true),
                    }));
                }
            }
        }
예제 #5
0
 public virtual void write(SteamChannel channel)
 {
     channel.write(this.sequence);
     channel.write(this.recov);
     channel.write(this.keys);
     if (this.clientsideInputs == null)
     {
         channel.write(0);
     }
     else
     {
         channel.write((byte)this.clientsideInputs.Count);
         foreach (RaycastInfo raycastInfo in this.clientsideInputs)
         {
             if (raycastInfo.player != null)
             {
                 channel.write(3);
                 channel.write(raycastInfo.point);
                 channel.write(raycastInfo.direction);
                 channel.write(raycastInfo.normal);
                 channel.write((byte)raycastInfo.limb);
                 channel.write(raycastInfo.player.channel.owner.playerID.steamID);
             }
             else if (raycastInfo.zombie != null)
             {
                 channel.write(4);
                 channel.write(raycastInfo.point);
                 channel.write(raycastInfo.direction);
                 channel.write(raycastInfo.normal);
                 channel.write((byte)raycastInfo.limb);
                 channel.write(raycastInfo.zombie.id);
             }
             else if (raycastInfo.animal != null)
             {
                 channel.write(5);
                 channel.write(raycastInfo.point);
                 channel.write(raycastInfo.direction);
                 channel.write(raycastInfo.normal);
                 channel.write((byte)raycastInfo.limb);
                 channel.write(raycastInfo.animal.index);
             }
             else if (raycastInfo.vehicle != null)
             {
                 channel.write(6);
                 channel.write(raycastInfo.point);
                 channel.write(raycastInfo.normal);
                 channel.write((byte)raycastInfo.material);
                 channel.write(raycastInfo.vehicle.instanceID);
             }
             else if (raycastInfo.transform != null)
             {
                 if (raycastInfo.transform.CompareTag("Barricade"))
                 {
                     channel.write(7);
                     InteractableDoorHinge component = raycastInfo.transform.GetComponent <InteractableDoorHinge>();
                     if (component != null)
                     {
                         raycastInfo.transform = component.transform.parent.parent;
                     }
                     byte            b;
                     byte            b2;
                     ushort          num;
                     ushort          num2;
                     BarricadeRegion barricadeRegion;
                     if (BarricadeManager.tryGetInfo(raycastInfo.transform, out b, out b2, out num, out num2, out barricadeRegion))
                     {
                         channel.write(raycastInfo.point);
                         channel.write(raycastInfo.normal);
                         channel.write((byte)raycastInfo.material);
                         channel.write(b);
                         channel.write(b2);
                         channel.write(num);
                         channel.write(num2);
                     }
                     else
                     {
                         channel.write(Vector3.zero);
                         channel.write(Vector3.up);
                         channel.write(0);
                         channel.write(0);
                         channel.write(0);
                         channel.write(ushort.MaxValue);
                         channel.write(ushort.MaxValue);
                     }
                 }
                 else if (raycastInfo.transform.CompareTag("Structure"))
                 {
                     channel.write(8);
                     byte            b3;
                     byte            b4;
                     ushort          num3;
                     StructureRegion structureRegion;
                     if (StructureManager.tryGetInfo(raycastInfo.transform, out b3, out b4, out num3, out structureRegion))
                     {
                         channel.write(raycastInfo.point);
                         channel.write(raycastInfo.direction);
                         channel.write(raycastInfo.normal);
                         channel.write((byte)raycastInfo.material);
                         channel.write(b3);
                         channel.write(b4);
                         channel.write(num3);
                     }
                     else
                     {
                         channel.write(Vector3.zero);
                         channel.write(Vector3.up);
                         channel.write(Vector3.up);
                         channel.write(0);
                         channel.write(0);
                         channel.write(0);
                         channel.write(ushort.MaxValue);
                     }
                 }
                 else if (raycastInfo.transform.CompareTag("Resource"))
                 {
                     channel.write(9);
                     byte   b5;
                     byte   b6;
                     ushort num4;
                     if (ResourceManager.tryGetRegion(raycastInfo.transform, out b5, out b6, out num4))
                     {
                         channel.write(raycastInfo.point);
                         channel.write(raycastInfo.direction);
                         channel.write(raycastInfo.normal);
                         channel.write((byte)raycastInfo.material);
                         channel.write(b5);
                         channel.write(b6);
                         channel.write(num4);
                     }
                     else
                     {
                         channel.write(Vector3.zero);
                         channel.write(Vector3.up);
                         channel.write(Vector3.up);
                         channel.write(0);
                         channel.write(0);
                         channel.write(0);
                         channel.write(ushort.MaxValue);
                     }
                 }
                 else if (raycastInfo.transform.CompareTag("Small") || raycastInfo.transform.CompareTag("Medium") || raycastInfo.transform.CompareTag("Large"))
                 {
                     channel.write(2);
                     byte   b7;
                     byte   b8;
                     ushort num5;
                     if (ObjectManager.tryGetRegion(raycastInfo.transform, out b7, out b8, out num5))
                     {
                         channel.write(raycastInfo.point);
                         channel.write(raycastInfo.direction);
                         channel.write(raycastInfo.normal);
                         channel.write((byte)raycastInfo.material);
                         channel.write(raycastInfo.section);
                         channel.write(b7);
                         channel.write(b8);
                         channel.write(num5);
                     }
                     else
                     {
                         channel.write(Vector3.zero);
                         channel.write(Vector3.up);
                         channel.write(Vector3.up);
                         channel.write(0);
                         channel.write(byte.MaxValue);
                         channel.write(0);
                         channel.write(0);
                         channel.write(ushort.MaxValue);
                     }
                 }
                 else if (raycastInfo.transform.CompareTag("Ground") || raycastInfo.transform.CompareTag("Environment"))
                 {
                     channel.write(0);
                     channel.write(raycastInfo.point);
                     channel.write(raycastInfo.normal);
                     channel.write((byte)raycastInfo.material);
                 }
                 else
                 {
                     channel.write(1);
                 }
             }
             else
             {
                 channel.write(1);
             }
         }
     }
 }
예제 #6
0
        public void Execute(IRocketPlayer caller, string[] args)
        {
            if (args.Length > 2 || args.Length < 1)
            {
                UnturnedChat.Say(caller, "invalid arguments", Color.red);
                return;
            }
            else if (args.Length == 2)
            {
                var  doorname     = args[0];
                var  newperm      = args[1];
                bool isregistered = false;
                foreach (Registereddoortype doorinfo in miscstuff.Instance.Configuration.Instance.listofregistereddoors)
                {
                    if (doorinfo.name == doorname)
                    {
                        isregistered        = true;
                        doorinfo.permission = "Registereddoor." + newperm;
                        miscstuff.Instance.Configuration.Save();
                        UnturnedChat.Say(caller, "Door perm changed successfully to " + newperm);
                        return;
                    }
                }
                if (isregistered == false)
                {
                    UnturnedChat.Say(caller, "door does not exist with that name", Color.red);
                    return;
                }
            }
            else if (args.Length == 1)
            {
                var  newperm      = args[0];
                bool isregistered = false;
                var  PlayerCaller = (UnturnedPlayer)caller;

                InteractableDoorHinge component = raycastdoor.Getdoor(PlayerCaller);

                if (component != null)
                {
                    InteractableDoor door = component.door;
                    bool             flag = !door.isOpen;
                    byte             x;
                    byte             y;
                    ushort           plant;
                    ushort           index;
                    BarricadeRegion  barricadeRegion;
                    BarricadeManager.tryGetInfo(door.transform, out x, out y, out plant, out index,
                                                out barricadeRegion);
                    BarricadeDrop barricadedrop = barricadeRegion.drops[index];
                    var           ID            = barricadedrop.instanceID;
                    foreach (Registereddoortype doorinfo in miscstuff.Instance.Configuration.Instance.listofregistereddoors)
                    {
                        if (doorinfo.ID == ID)
                        {
                            isregistered        = true;
                            doorinfo.permission = "Registereddoor." + newperm;
                            UnturnedChat.Say(caller, "Door perm changed successfully to " + newperm);
                            miscstuff.Instance.Configuration.Save();
                        }
                    }

                    if (isregistered == false)
                    {
                        UnturnedChat.Say(caller, "door is not registered", Color.red);
                    }
                }
                else
                {
                    UnturnedChat.Say(caller, "Not looking at a valid door!", Color.red);
                }
            }
        }