GatherManager

Moved

Total Downloads: 59,075 - First Release: Oct 23, 2014 - Last Update: Aug 27, 2017

4.93893/5, 131 likes
  1. I dont agree with this hillbilly solution.
     
  2. this is great however the nodes now infinite lol
     
  3. @Mughisi could u please make that new hqm bonus to be dependent on gather rate multiplier?
     
  4. Code:
    private void OnDispenserGather(ResourceDispenser dispenser, BaseEntity entity, Item item)
    {
        if (!entity.ToPlayer()) return;    var gatherType = dispenser.gatherType.ToString("G");
        var amount = item.amount;    if (GatherResourceModifiers.ContainsKey(item.info.displayName.english))
            item.amount = (int)(item.amount * GatherResourceModifiers[item.info.displayName.english]);
        else if (GatherResourceModifiers.ContainsKey("*"))
            item.amount = (int)(item.amount * GatherResourceModifiers["*"]);
        if(item.info.displayName.english.Contains("Metal"))
        {
             var rands = rand.Next(1, 10);
             int HQ = item.amount;
             HQ *= rands;
             HQ /= 100;
             player.inventory.GiveItem(ItemManager.CreateByItemID(374890416, HQ), player.inventory.containerMain);
        }      
        if (!GatherDispenserModifiers.ContainsKey(gatherType)) return;    var dispenserModifier = GatherDispenserModifiers[gatherType];
        dispenser.containedItems.Single(x => x.itemid == item.info.itemid).amount += amount - item.amount / dispenserModifier;    if (dispenser.containedItems.Single(x => x.itemid == item.info.itemid).amount < 0)
           item.amount += (int)dispenser.containedItems.Single(x => x.itemid == item.info.itemid).amount;
    }
    
    It's really better like that, because it give random amount.
     
  5. The lines dont work: "(387,10): error CS0103: The name `player' does not exist in the current context"
    Could you upload your .CS ?
     
  6. I Have the same error with the last build too after the change.
     
  7. I updated my Oxide and added that codes into GatherManager.cs file , changed 3 as 1 and all is fine for me.
     
  8. Code:
    private void OnDispenserGather(ResourceDispenser dispenser, BaseEntity entity, Item item)
    {
        if (!entity.ToPlayer()) return;
        BasePlayer player = entity.ToPlayer();
        var gatherType = dispenser.gatherType.ToString("G");
        var amount = item.amount;    if (GatherResourceModifiers.ContainsKey(item.info.displayName.english))
            item.amount = (int)(item.amount * GatherResourceModifiers[item.info.displayName.english]);
        else if (GatherResourceModifiers.ContainsKey("*"))
            item.amount = (int)(item.amount * GatherResourceModifiers["*"]);
        if(item.info.displayName.english.Contains("Metal"))
        {
             var rands = rand.Next(1, 10);
             int HQ = item.amount;
             HQ *= rands;
             HQ /= 100;
             player.inventory.GiveItem(ItemManager.CreateByItemID(374890416, HQ), player.inventory.containerMain);
        }  
        if (!GatherDispenserModifiers.ContainsKey(gatherType)) return;    var dispenserModifier = GatherDispenserModifiers[gatherType];
        dispenser.containedItems.Single(x => x.itemid == item.info.itemid).amount += amount - item.amount / dispenserModifier;    if (dispenser.containedItems.Single(x => x.itemid == item.info.itemid).amount < 0)
           item.amount += (int)dispenser.containedItems.Single(x => x.itemid == item.info.itemid).amount;
    }
    Here you go, i just miss the player var declaration^^
     
  9. Problem is with the second code. First one is OK
     
  10. Hm.. (383,22): error CS0103: The name `rand' does not exist in the current context
     
  11. Same.

    Thanks
     
  12. Code:
    private void OnDispenserGather(ResourceDispenser dispenser, BaseEntity entity, Item item)
    {
        System.Random rand = new System.Random();
        if (!entity.ToPlayer()) return;
        BasePlayer player = entity.ToPlayer();
        var gatherType = dispenser.gatherType.ToString("G");
        var amount = item.amount;    if (GatherResourceModifiers.ContainsKey(item.info.displayName.english))
            item.amount = (int)(item.amount * GatherResourceModifiers[item.info.displayName.english]);
        else if (GatherResourceModifiers.ContainsKey("*"))
            item.amount = (int)(item.amount * GatherResourceModifiers["*"]);
        if(item.info.displayName.english.Contains("Metal"))
        {
             var rands = rand.Next(1, 10);
             int HQ = item.amount;
             HQ *= rands;
             HQ /= 100;
             player.inventory.GiveItem(ItemManager.CreateByItemID(374890416, HQ), player.inventory.containerMain);
        }
        if (!GatherDispenserModifiers.ContainsKey(gatherType)) return;    var dispenserModifier = GatherDispenserModifiers[gatherType];
        dispenser.containedItems.Single(x => x.itemid == item.info.itemid).amount += amount - item.amount / dispenserModifier;    if (dispenser.containedItems.Single(x => x.itemid == item.info.itemid).amount < 0)
           item.amount += (int)dispenser.containedItems.Single(x => x.itemid == item.info.itemid).amount;
    }
     
  13. You are a Star :D
    Any easy way to change the the amount on Sulfur and Rock Stones too?
     
  14. There you got, thanks for the fast reply!
     
  15. Well you can do it using config and command by looking to overview
     
  16. OK. Thanks. I wasn't sure if it would still work that way. Players complain about the Stone and Sulfur rock doesn't give any HQ. I'll check later ingame. Thanks for the fast answer and solution.
     
  17. Oh you are speaking about getting HQ from all nodes ?
     
  18. Yes. It worked that way in the past.
    [DOUBLEPOST=1498829244][/DOUBLEPOST]
    Also the HQ is already melted from the node :p
     
  19. Code:
    private void OnDispenserGather(ResourceDispenser dispenser, BaseEntity entity, Item item)
    {
        System.Random rand = new System.Random();
        if (!entity.ToPlayer()) return;
        BasePlayer player = entity.ToPlayer();
        var gatherType = dispenser.gatherType.ToString("G");
        var amount = item.amount;    if (GatherResourceModifiers.ContainsKey(item.info.displayName.english))
            item.amount = (int)(item.amount * GatherResourceModifiers[item.info.displayName.english]);
        else if (GatherResourceModifiers.ContainsKey("*"))
            item.amount = (int)(item.amount * GatherResourceModifiers["*"]);
             var rands = rand.Next(1, 10);
             int HQ = item.amount;
             HQ *= rands;
             HQ /= 100;
             player.inventory.GiveItem(ItemManager.CreateByItemID(374890416, HQ), player.inventory.containerMain);
     
        if (!GatherDispenserModifiers.ContainsKey(gatherType)) return;    var dispenserModifier = GatherDispenserModifiers[gatherType];
        dispenser.containedItems.Single(x => x.itemid == item.info.itemid).amount += amount - item.amount / dispenserModifier;    if (dispenser.containedItems.Single(x => x.itemid == item.info.itemid).amount < 0)
           item.amount += (int)dispenser.containedItems.Single(x => x.itemid == item.info.itemid).amount;
    }
    Should do what you are looking for
     
  20. Ok that didn't work for me I'm still getting 1 from the metal nodes. Do I have to restart the server?