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

l2qq · 2015-08-29 08:34
字数 5519 评论 0 收藏 0 点赞 0


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("道具不足!");  
                                }  
   }


最新评论 0