/// <summary> /// Invoked whenever the player paints a tile. /// If their buildmode is on and they are low on the last used paint, they get a full stack. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private static void OnPaintTile(object sender, PaintTileEventArgs e) { if (e.Player.IsBuildModeOn()) { int count = 0; Item lastItem = null; foreach (Item i in e.Player.TPlayer.inventory) { if (i.paint == e.type) { lastItem = i; count += i.stack; } } if (count <= 5 && lastItem != null) { e.Player.GiveItemCheck(lastItem.type, lastItem.Name, lastItem.stack); } } }
private static bool OnPaintTile(Int32 x, Int32 y, byte t) { if (PaintTile == null) return false; var args = new PaintTileEventArgs { X = x, Y = y, type = t }; PaintTile.Invoke(null, args); return args.Handled; }