/// <summary> /// Invoked whenever the player paints a wall. /// 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 OnPaintWall(object sender, PaintWallEventArgs 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 OnPaintWall(Int32 x, Int32 y, byte t) { if (PaintWall == null) return false; var args = new PaintWallEventArgs { X = x, Y = y, type = t }; PaintWall.Invoke(null, args); return args.Handled; }