本文整理汇总了C#中SMP.Player.SendItem方法的典型用法代码示例。如果您正苦于以下问题:C# Player.SendItem方法的具体用法?C# Player.SendItem怎么用?C# Player.SendItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMP.Player
的用法示例。
在下文中一共展示了Player.SendItem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Use
public override void Use(Player p, params string[] args)
{
if (args.Length > 0 && args[0] == "help")
{
Help(p);
return;
}
string devlist = "";
string temp;
foreach (string dev in devs)
{
temp = dev.Substring(0, 1);
temp = temp.ToUpper() + dev.Remove(0, 1);
devlist += temp + ", ";
}
devlist = devlist.Remove(devlist.Length - 2);
p.SendMessage(Color.DarkBlue + "ForgeCraft Development Team: " + Color.DarkRed + devlist, WrapMethod.Chat); //lol it was ForgetCraft
short slot = (short)p.inventory.FindEmptySlot();
if (slot == -1) return;
p.SendItem(slot, 278, 1, 3);
}
示例2: HandleClick
//.........这里部分代码省略.........
break;
}
else
{
item.count = stack;
clickItem.count -= avail;
}
}
if (i == InventorySize - 1 && !useEmptySlot) { useEmptySlot = true; i = -1; }
}
}
}
}
else
{
if (slot >= InventorySize)
{
p.inventory.HandleClick((short)((slot - InventorySize) + 9), click, ActionID, Shift);
return;
}
Item clickItem = items[slot];
if (p.OnMouse.id == -1)
{
if (clickItem.id != -1)
{
if (click == ClickType.RightClick && clickItem.count > 1)
{
p.OnMouse = new Item(clickItem);
p.OnMouse.count = (byte)Math.Ceiling((float)p.OnMouse.count / 2F);
clickItem.count /= 2;
}
else
{
items[slot] = Item.Nothing;
p.OnMouse = clickItem;
}
}
}
else
{
if (clickItem.id != -1)
{
if (p.OnMouse.id == clickItem.id && p.OnMouse.meta == clickItem.meta)
{
byte stack = Inventory.isStackable(clickItem.id);
if (click == ClickType.RightClick && p.OnMouse.count > 1)
{
if (clickItem.count < stack)
{
p.OnMouse.count--;
clickItem.count++;
}
}
else
{
if (clickItem.count < stack)
{
byte avail = (byte)(stack - clickItem.count);
if (p.OnMouse.count <= avail)
{
clickItem.count += p.OnMouse.count;
p.OnMouse = Item.Nothing;
}
else
{
clickItem.count = stack;
p.OnMouse.count -= avail;
}
}
}
}
else
{
items[slot] = p.OnMouse;
p.OnMouse = clickItem;
}
}
else
{
if (click == ClickType.RightClick && p.OnMouse.count > 1)
{
items[slot] = new Item(p.OnMouse);
items[slot].count = 1;
p.OnMouse.count--;
}
else
{
items[slot] = p.OnMouse;
p.OnMouse = Item.Nothing;
}
}
}
}
if (container != null) container.UpdateContents(p);
List<Item> items2 = new List<Item>(items); items2.AddRange((Item[])p.inventory.items.TruncateStart(9));
p.SendWindowItems(id, items2.ToArray());
p.SendItem(255, -1, p.OnMouse);
}