public ConfirmTransactionClient(WindowClick wc, bool accept) { this.WindowID = wc.WindowID; this.ActionID = wc.ActionID; this.Accepted = accept; }
static bool BlockClick(Client player, WindowClick wc) { player.SendToClient(new ConfirmTransactionServer(wc, false)); return true; }
/// <summary> /// Return true to block /// </summary> public static bool ProtectChestsClick(VanillaSession rs, WindowClick wc) { if (wc.WindowID == 0) //player inventory, allow return false; if (rs.Player.Admin() && rs.Mode == GameMode.Creative) return false; if (rs.OpenWindows.ContainsKey(wc.WindowID) == false) { rs.TellSystem(Chat.Red, "Window not open"); return BlockClick(rs.Player, wc); } var w = rs.OpenWindows [wc.WindowID]; if (w.Region == null) return false; //not in a region, allow switch (w.Region.Type) { case Protected.Type: case Honeypot.Type: break; default: return false; } if (w.Region.IsResident(rs.Player)) return false; //residents allow //Allow some open types if (w.Window.InventoryType == "CraftingTable") return false; if (w.Window.InventoryType == "Enchant") return false; if (w.Window.InventoryType == "Anvil") return false; if (w.Window.WindowTitle == "container.enderchest") return false; if (w.Region.Type == Protected.Type) return BlockClick(rs.Player, wc); if (w.Region.Type == Honeypot.Type) { if (wc.Slot == 11 || wc.Slot == 13 || wc.Slot == 15) { if (rs.Player.Admin()) { rs.TellSystem(Chat.White, "This spot is protected"); return false; } Honeypot.Trigger(rs.Player, w.Region); return true; } } return true; }