Пример #1
0
        public static void PlayerGatherWood(IMeleeWeaponItem rec, ResourceTarget rt, ref ItemDataBlock db, ref int amount, ref string name)
        {
            Player      player      = Player.FindByNetworkPlayer(rec.inventory.networkView.owner);
            GatherEvent gatherEvent = new GatherEvent(rt, db, amount)
            {
                Item = "Wood"
            };

            if (Hooks.OnPlayerGathering != null)
            {
                Hooks.OnPlayerGathering(player, gatherEvent);
            }
            db     = Server.GetServer().Items.Find(gatherEvent.Item);
            amount = gatherEvent.Quantity;
            name   = gatherEvent.Item;
        }
Пример #2
0
        public static void PlayerGather(Inventory rec, ResourceTarget rt, ResourceGivePair rg, ref int amount)
        {
            Player      player      = Player.FindByNetworkPlayer(rec.networkView.owner);
            GatherEvent gatherEvent = new GatherEvent(rt, rg, amount);

            if (Hooks.OnPlayerGathering != null)
            {
                Hooks.OnPlayerGathering(player, gatherEvent);
            }
            amount = gatherEvent.Quantity;
            if (!gatherEvent.Override)
            {
                amount = Mathf.Min(amount, rg.AmountLeft());
            }
            rg._resourceItemDatablock = gatherEvent.Item;
            rg.ResourceItemName       = gatherEvent.Item;
        }