# lesson20 内核-随身(购物系统)

> lesson20 内核-随身(购物系统).zip // 使用方法 bypass -h shop 得到物品ID 得到物品数量 需要物品ID 需要物品数量 else if (_command.startsWith("shop ")) { Str…

- 原文：https://www.l2qq.com/article/34
- 发布：2015-08-29T00:34:00Z
- 更新：2020-06-12T09:51:01Z
- 作者：l2qq

---

![](/assets/img/filetype/icon_rar.gif)lesson20 内核-随身(购物系统).zip
```
// 使用方法 bypass -h shop 得到物品ID 得到物品数量 需要物品ID 需要物品数量
else if (_command.startsWith("shop "))
{
String val = _command.substring(5);
StringTokenizer st = new StringTokenizer(val);
String id = st.nextToken();
int idval = Integer.parseInt(id);
String num = st.nextToken();
long numval = Long.parseLong(num);
String needid = st.nextToken();
int needidval = Integer.parseInt(needid);
String neednum = st.nextToken();
long neednumval = Long.parseLong(neednum);
if (activeChar.getInventory().getInventoryItemCount(needidval, 0) >= neednumval)
{
if (needidval == 57)
{
activeChar.reduceAdena("金币", neednumval, activeChar, true);
}
else
{
activeChar.destroyItemByItemId("需要物品", needidval, neednumval, activeChar, true);
}
activeChar.addItem("物品", idval, numval, activeChar, true);
}
else
{
activeChar.sendMessage("道具不足!");
}
}
```
