1. Karltubing

    Karltubing Scavenger

    Can one plugin use the data from another plugins config or json file?
     
  2. D-Kay

    D-Kay Wood Hoarder Plugin Developer

    Not with config files but you can with the data files (though it's more recommendable to link to a function in the plugin, of which that data file is, and get the value back from it)
     
  3. Karltubing

    Karltubing Scavenger

    Referencing/linking a plugin...... I have been looking at that but I don't know if it would be easier or possible in this scenario with multiple plugins being used..

    So when you say "data files" you mean any of the files Reign Of Kings Dedicated Server\Saves\oxide\data folder? Will json or data extensions files both work form this folder?



    Universal Top List For Reign of Kings
    So if one wanted to do a "Top {0},Players"

    {0} = Gold - get data from GrandExchange Plugin
    XPLevel - get data from LevelSystem (already done Awesome job on your plugin!!!!!)
    Dollars - get eco balance data from UEconomics
    Playing - get Most time Played data from PlaytimeTracker - playtime.data
    Thieves - not done but GrandExchange Plugin (record money gained from killing others during PVP Gold being on)
    Kills .......etc,
    then use appropriate data files for each list generated to a popup?
    Having a config file that a player could add various plugins that would have data files that could be farmed for this plugin,
     
  4. Karltubing

    Karltubing Scavenger

    If I have referenced 2 Plugins to mu plugin Do I have to reference every call ? I have multiple times I want my plugin to check a wallet balances, Pay using that plugins currency (GrandExchange and UEconomics) multiple different functions?
     
  5. D-Kay

    D-Kay Wood Hoarder Plugin Developer

    Code (Text):
    [PluginReference("Plugin Name")]
    Plugin plugin;
    That's what you need at the very top of you plugin in the variables section.

    Every time you want to call a full crook you do
    Code (Text):
    if (plugins.Exists("Plugin Name"))
        {
            Plugin.Call("Function Name", new object[] { Any Args })
        }
     
  6. Karltubing

    Karltubing Scavenger

    like this?? I have a check that shows my referenced plugins are loaded but was wanting to know if every call has to be referenced and from your answer it looks like I do.....


    namespace Oxide.Plugins
    {
    [Info("KingsLottery", "Karltubing", "0.0.1")]
    [Description("A way for players to gamble")]

    class KingsLottery : ReignOfKingsPlugin
    {
    #region Initialization

    void Init()
    {
    lang.RegisterMessages(new Dictionary<string, string>
    {
    { "LotteryHelp", "[00FF00]/lottery[FFFFFF] - Gamble for some awesome rewards or lose it all!" },
    { "PlayerLost", "You just lost [00FF00]{0}[FFFFFF], try again!" },
    { "PlayerWonWeapon", "You just won a new [00FF00]{0}[FFFFFF] weapon" },
    { "PlayerWonGold", "You just won [00FF00]{0}[FFFFFF] gold" },
    { "PlayerWon10CarrotGold", "You just won 10 Carrots and [00FF00] 1[FFFF00] gold [00FF00]{0}[FFFFFF]" },
    { "PlayerWon10CarrotDiamond", "You won 10 Carrots amd a Diamond!! [00FF00]{0}[FFFFFF]" },
    { "PlayerWonDollars", "You just won [00FF00]{0}[FFFFFF] dollars" },
    { "PlayerLostDollars", "You just lost [00FF00]{0}[FFFFFF] dollars" },
    { "CantPlay", "Sorry you cant play right now [00FF00]{0}[FFFFFF]" },
    { "PlayKingsLottery", "Get ready to play the Kings Lottery !!! [00FF00]{0}[FFFFFF]" },
    { "PlayLottery", "Playing Kings Lottery!! [00FF00]{0}[FFFFFF]" },
    { "PayLotteryFEE", "You bought a ticket for [00FF00]{EntryFee}[FFFFFF]gold" }
    }, this);
    }

    [PluginReference("GrandExchange")]
    Plugin GrandExchange;

    [PluginReference("UEconomics")]
    Plugin UEconomics;

    #endregion
    --- Double Post Merged, Jan 17, 2017 at 8:55 AM ---
    I have seen both .....all the way at the very very to and then other times down by namespace. Is there a difference?

    The one at the very top gets a //before the info.
     
  7. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    Yes, // Requires is very different from [PluginReference], with how you call as well as requiring public vs. private methods to call.
     
  8. Karltubing

    Karltubing Scavenger

    I assume that being at the very top is the public version? Would that mean that any public methods could be called at anytime or do you still have to make a call for each? I am trying to check a players wallet from the GE check a players moneyCache from UEconomics to see if they are broke or not before allowing to play lottery. but then i aslo need to withdraw and removeGold to charge them to play then later either withdraw or deposit or removegold or givegold if they win or loseand on and on........ any suggestions?
     
  9. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    Using // Requires: PluginName would allow you to call any public method in said plugin, without .Call.
     
    Karltubing likes this.
  10. Karltubing

    Karltubing Scavenger

    Thank you , time to go try that way out and do some cleaning up.