void TestReplenishableContainer(BasePlayer player, StorageContainer container) { if (GetReplenishableContainer(container.inventory) == null) { ReplyPlayer(player, "NotReplenishing"); return; } ReplenishableContainer repl = GetReplenishableContainer(container.inventory); ReplyFormatted(player, String.Format(Lang("BoxTested"), repl.type, repl.uid, repl.timer)); }
void OnItemRemovedFromContainer(ItemContainer container, Item item) { if (GetReplenishableContainer(container) == null) { return; } ReplenishableContainer repl = GetReplenishableContainer(container); if (RequireAllSlotsEmpty && container.itemList.Count > 0) { return; } timer.Once((float)repl.timer, () => { repl.Replenish(container); }); }
void CreateReplenishableContainer(BasePlayer player, ReplenishPlayer rPlayer, StorageContainer container, HitInfo info, string type) { if (GetReplenishableContainer(container.inventory) != null) { containers.Remove(GetReplenishableContainer(container.inventory)); ReplyPlayer(player, "AlreadyReplenishing"); } ReplenishableContainer repl = new ReplenishableContainer(container.inventory.uid, rPlayer.timer); repl.type = Lang(type); repl.SaveItems(container.inventory); var worldPos = info.HitEntity.GetEstimatedWorldPosition(); repl.pos = new Pos(worldPos.x, worldPos.y, worldPos.z); containers.Add(repl); ReplyFormatted(player, String.Format(Lang("BoxAdded"), repl.type, repl.uid, repl.timer)); }