InfoPanel

Moved

Total Downloads: 55,749 - First Release: Sep 25, 2015 - Last Update: Mar 13, 2018

5/5, 160 likes
  1. Note: I have compass panel turned off cause I'm using the Plugin Compass for Rust
    but anyone is more than welcome to use
     

    Attached Files:

  2. How do we get it to show RP instead of Economics?
     
  3. Dood, this is just want I was looking for. Your Awesome, Thank you so much!
     
  4. hee can you give the config from the infopanel i love it :D
     
  5. Open InfoPanel.cs

    Find:
    Code:
                        { "Balance", new PanelConfig
                            {
                                Available = true,
                                Dock = "BottomLeftDock",
                                Order = 7,
                                AnchorX = "Left",
                                AnchorY = "Bottom",
                                Margin = "0 0 0 0.01",
                                Width = 0.8f,
                                Height = 0.95f,
                                BackgroundColor = "0 0 0 0.4" ,
                                Image = new PanelImageConfig
                                {
                                    Order =  1,
                                    Width = 0.1f,
                                    Height = 0.8f,
                                    Margin = "0 0.01 0.1 0.01",
                                    Url = "http://i.imgur.com/HhL5TvU.png",
                                },
                                Text = new PanelTextConfig
                                {
                                    Order =  2,
                                    Width = 0.848f,
                                    Height = 1f,
                                    Align = TextAnchor.MiddleCenter,
                                    FontColor = DefaultFontColor,
                                    FontSize = 12,
                                    Margin = "0 0.02 0 0",
                                },
                                PanelSettings = new Dictionary<string,object>
                                {
                                    { "RefreshRate(s)", "5" },
                                }
                            }
                        },
    ADD AFTER:
    Code:
                        { "BalanceRP", new PanelConfig
                            {
                                Available = true,
                                Dock = "BottomLeftDock",
                                Order = 7,
                                AnchorX = "Left",
                                AnchorY = "Bottom",
                                Margin = "0 0 0 0.01",
                                Width = 0.8f,
                                Height = 0.95f,
                                BackgroundColor = "0 0 0 0.4" ,
                                Image = new PanelImageConfig
                                {
                                    Order =  1,
                                    Width = 0.1f,
                                    Height = 0.8f,
                                    Margin = "0 0.01 0.1 0.01",
                                    Url = "http://i.imgur.com/HhL5TvU.png",
                                },
                                Text = new PanelTextConfig
                                {
                                    Order =  2,
                                    Width = 0.848f,
                                    Height = 1f,
                                    Align = TextAnchor.MiddleCenter,
                                    FontColor = DefaultFontColor,
                                    FontSize = 12,
                                    Margin = "0 0.02 0 0",
                                },
                                PanelSettings = new Dictionary<string,object>
                                {
                                    { "RefreshRate(s)", "5" },
                                }
                            }
                        },
    FIND:
    Code:
            void Init()
            {
                LoadConfigValues();
                LoadData();
            }
    ADD AFTER:
    Code:
            [PluginReference] Plugin ServerRewards;
            static InfoPanel instance;
    FIND:
    Code:
            void OnServerInitialized()
            {
                Clock = new Watch
    CHANGE TO:
    Code:
            void OnServerInitialized()
            {
                instance = this;
                Clock = new Watch
    FIND:
    Code:
                Bala = new Balance
                (
                    Settings.GetPanelSettingsValue("Balance", "RefreshRate(s)", 3)
                );
    ADD AFTER:
    Code:
                Balarp = new BalanceRP
                (
                    Settings.GetPanelSettingsValue("BalanceRP", "RefreshRate(s)", 3)
                );
    FIND:
    Code:
                if (Settings.CheckPanelAvailability("Balance"))
                {
                    BalanceUpdater = timer.Repeat(Bala.RefreshRate, 0, () => Bala.Refresh(storedData, PlayerPanels));
                }
    ADD AFTER:
    Code:
                if (Settings.CheckPanelAvailability("BalanceRP"))
                {
                    BalanceUpdater = timer.Repeat(Balarp.RefreshRate, 0, () => Balarp.Refresh(storedData, PlayerPanels));
                }
    FIND:
    Code:
                public double GetBalance(string PlayerID)
                {
                    var player = RustCore.FindPlayerByIdString(PlayerID);
                    if (player == null) return 0;
                    return (double)(Interface.Oxide.CallHook("Balance", player.UserIDString) ?? 0.0);
                }
    CHANGE TO:
    Code:
                public int GetBalance(string id)
                {
                    var player = RustCore.FindPlayerByIdString(id);                if (player == null) return 0;
                    return (int)instance.ServerRewards?.Call("CheckPoints", Convert.ToUInt64(id));
                }
    FIND:
    Code:
                            panelText.Content = balance;
                            panelText.Refresh();
    CHANGE TO:
    Code:
                            panelText.Content = balance;
                            panelText.Refresh();
                        }
                    }
                }
            }
            private BalanceRP Balarp;        public class BalanceRP
            {
                public int RefreshRate = 3;            public BalanceRP(int RefreshRate)
                {
                    this.RefreshRate = RefreshRate;
                }            public double GetBalanceRP(string PlayerID)
                {
                    var player = RustCore.FindPlayerByIdString(PlayerID);                if (player == null) return 0;
                    return (double)(Interface.Oxide.CallHook("GetPlayerMoney", player.userID) ?? 0.0);
                }            public void Refresh(StoredData storedData, Dictionary<string, Dictionary<string, IPanel>> panels)
                {
                    if (!Settings.CheckPanelAvailability("BalanceRP"))
                        return;                foreach (var panel in panels)
                    {
                        IPanel iPanel;
                        if (!panel.Value.TryGetValue("BalanceRPText", out iPanel)) continue;
                        var balancerp = $"{GetBalanceRP(panel.Key):N}";
                        var panelText = (IPanelText)iPanel;
                        if (!balancerp.Equals(panelText.Content))
                        {
                            panelText.Content = balancerp;
                            panelText.Refresh();
    FIND:
    Code:
                        case "BalanceText":
                            ((IPanelText) Panel.Value).Content = $"{Bala.GetBalance(player.UserIDString):N}";
                            break;
    ADD AFTER:
    Code:
                        case "BalanceRPText":
                            ((IPanelText)Panel.Value).Content = $"{Balarp.GetBalanceRP(player.UserIDString):N}";
                            break;
    InfoPanel.json:
    (Change as required)
    In "Docks":{

    Code:
        "DockRP": {
          "AnchorX": "Left",
          "AnchorY": "Bottom",
          "Available": true,
          "BackgroundColor": "0 0 0 0",
          "Height": 0.028,
          "Margin": "0.005 0.1458 0.015 0.005",
          "Width": 0.15
        }
    In "Panels": {
    Code:
        "BalanceRP": {
          "AnchorX": "Left",
          "AnchorY": "Bottom",
          "Autoload": true,
          "Available": true,
          "BackgroundColor": "0.32 0.32 0.31 0.4",
          "Dock": "DockRP",
          "FadeOut": 0.0,
          "Height": 1,
          "Image": {
            "AnchorX": "Left",
            "AnchorY": "Bottom",
            "Available": true,
            "BackgroundColor": "0 0 0 0.4",
            "Height": 0.8,
            "Margin": "0 0.01 0.1 0.01",
            "Order": 1,
            "Url": "http://i.imgur.com/Ve8H6tD.png",
            "Width": 0.1
          },
          "Margin": "0 0 0 0.01",
          "Order": 7,
          "PanelSettings": {
            "RefreshRate(s)": "5"
          },
          "Text": {
            "Align": "MiddleCenter",
            "AnchorX": "Left",
            "AnchorY": "Bottom",
            "Available": true,
            "BackgroundColor": "0 0 0 0.4",
            "Content": "No Content",
            "FadeIn": 0.0,
            "FadeOut": 0.0,
            "FontColor": "1 1 1 1",
            "FontSize": 12,
            "Height": 1.0,
            "Margin": "0 0.02 0 0",
            "Order": 2,
            "Width": 0.9
          },
          "Width": 1
        }
    Note: thanks to @Pattrik for coding this.

    I have only got ServerRewards and have to have "BalanceRP": { as "Balance": {

    I think BalanceRP only works if you have both ;)
    [DOUBLEPOST=1511376062][/DOUBLEPOST]If you can't be bothered to do the above here is the .cs file (removed by forum admin, don't have a go at me. Thanks) and my .json (attached) enjoy!

    Panel Preview:
    20171112195032_1.jpg
     

    Attached Files:

    Last edited by a moderator: Nov 22, 2017
  6. can you add the redation on your config :D it wil be so nice :D
     

  7. can you pleas upload the good infopanel.cs for the RP i dont everythink but it not working !
     
  8. Wulf

    Wulf Community Admin

    I'd recommend requesting via PM as we don't allow random versions to be posted in the threads.
     
  9. The following error occurred:
    Participants:
    You may not start a conversation with the following recipients: PryMary
     
  10. @Wulf could you add the RP changes to infopanel as so many people have asked for it i tried to put a working copy on but forgot it's not allowed.
     
  11. Wulf

    Wulf Community Admin

    I'll take a look when I get some time.
     
  12. Thank you :) I'm sure others will appreciate it ;)
     
  13. we wil do wulf and prymary :)
     
  14. It changes the display to RP, but other plugins like ServerRewards still reads it as Eco. For example, I can have 1,000RP showing in the infopanel, but when I try to purchase something that costs 100RP, it says I do not have enough to purchase. Am I missing something?
     
  15. Originally I had both economics and Server Rewards and it took me some time to get the right Balance/BalanceRP to show the information correctly. As I originally put in the post:
    Code:
    I have only got ServerRewards and have to have "BalanceRP": { as "Balance": {I think BalanceRP only works if you have both
    I am no way a c# coder I am copy / pasting the additions made by someone else that did the coding for me. It works for me as you can see in the SS
     
  16. That´s great. How can i activate the compass again on the JSON file?
     
  17. I checked my config and there is only "Balance", no "BalanceRP", so that must have been removed. Not sure why I can't figure it out.
     
  18. I went back through my back ups to august and found the infopanel.json that i had for both economics and RP (attached)
    [DOUBLEPOST=1511709185][/DOUBLEPOST]In Docks:
    Code:
        "BottomLeftDockEconomics": {
          "AnchorX": "Left",
          "AnchorY": "Bottom",
          "Available": true,
          "BackgroundColor": "0 0 0 0",
          "Height": 0.028,
          "Margin": "0.005 0.1458 0.05 0.005",
          "Width": 0.15
        },
        "BottomLeftDockRP": {
          "AnchorX": "Left",
          "AnchorY": "Bottom",
          "Available": true,
          "BackgroundColor": "0 0 0 0",
          "Height": 0.028,
          "Margin": "0.005 0.1458 0.015 0.005",
          "Width": 0.15
        }
    In Panels:
    Code:
        "Balance": {
          "AnchorX": "Left",
          "AnchorY": "Bottom",
          "Autoload": true,
          "Available": true,
          "BackgroundColor": "0.32 0.32 0.31 0.4",
          "Dock": "BottomLeftDockEconomics",
          "FadeOut": 0.0,
          "Height": 1,
          "Image": {
            "AnchorX": "Left",
            "AnchorY": "Bottom",
            "Available": true,
            "BackgroundColor": "0 0 0 0.4",
            "Height": 0.8,
            "Margin": "0 0.01 0.1 0.01",
            "Order": 1,
            "Url": "http://i.imgur.com/Ve8H6tD.png",
            "Width": 0.1
          },
          "Margin": "0 0 0 0.01",
          "Order": 7,
          "PanelSettings": {
            "RefreshRate(s)": "5"
          },
          "Text": {
            "Align": "MiddleCenter",
            "AnchorX": "Left",
            "AnchorY": "Bottom",
            "Available": true,
            "BackgroundColor": "0 0 0 0.4",
            "Content": "No Content",
            "FadeIn": 0.0,
            "FadeOut": 0.0,
            "FontColor": "1 1 1 1",
            "FontSize": 12,
            "Height": 1.0,
            "Margin": "0 0.02 0 0",
            "Order": 2,
            "Width": 0.9
          },
          "Width": 1
        },
        "BalanceRP": {
          "AnchorX": "Left",
          "AnchorY": "Bottom",
          "Autoload": true,
          "Available": true,
          "BackgroundColor": "0.32 0.32 0.31 0.4",
          "Dock": "BottomLeftDockRP",
          "FadeOut": 0.0,
          "Height": 1,
          "Image": {
            "AnchorX": "Left",
            "AnchorY": "Bottom",
            "Available": true,
            "BackgroundColor": "0 0 0 0.4",
            "Height": 0.8,
            "Margin": "0 0.01 0.1 0.01",
            "Order": 1,
            "Url": "http://i.imgur.com/HhL5TvU.png",
            "Width": 0.1
          },
          "Margin": "0 0 0 0.01",
          "Order": 7,
          "PanelSettings": {
            "RefreshRate(s)": "5"
          },
          "Text": {
            "Align": "MiddleCenter",
            "AnchorX": "Left",
            "AnchorY": "Bottom",
            "Available": true,
            "BackgroundColor": "0 0 0 0.4",
            "Content": "No Content",
            "FadeIn": 0.0,
            "FadeOut": 0.0,
            "FontColor": "1 1 1 1",
            "FontSize": 12,
            "Height": 1.0,
            "Margin": "0 0.02 0 0",
            "Order": 2,
            "Width": 0.9
          },
          "Width": 1
        }
    With this version the icons are not the same as I am currently using. Feel free to change the URL's from the original posted infopanel.json to keep those or if you like these keep these (will be fuzzy)
     

    Attached Files:

  19. Perfect. I'll give this a shot. I appreciate it!