public static string Transfer(Inventory from, Inventory to, int toSize, string slotxamount) { (int index, int amount) = Verify.IndexXAmount(slotxamount); index--; if (index < 0 || index > from.Count) { throw NeitsilliaError.ReplyError("Invalid slot"); } StackedItems si = from.Splice(index, amount); if (!to.Add(si, toSize)) { throw NeitsilliaError.ReplyError("There is not enough inventory space for this transfer."); } return(si.ToString()); }
internal string UseTool(string toolName, Player player, Areas.AreaType areaType) { (int tier, int level, string name) = CanUse(player, toolName); string[] options; if ((options = Utils.GetVar <string[], Tools>(this, $"{toolName}{areaType}", true)) == null) { options = Utils.GetVar <string[], Tools>(this, $"{toolName}Default"); } level += tier - Verify.Max(tier, options.Length - 1); StackedItems st = new StackedItems(Item.LoadItem(options[Verify.Max(tier, options.Length - 1)]), level + 1); if (player.CollectItem(st)) { AfterCollect(player, toolName, player.level); player.SaveFileMongo(); return($"{player.name} collected {st} using {name}."); } return($"{player.name}'s Inventory may not currently contain {st}."); }