開啟伺服器偵測販賣價錢是否正確(防買賣洗錢)
最近發現好像滿多人喜歡販賣所有道具另外用了個資料表shop_sell_price之類的
但是卻因為價錢沒設定好
被玩家買了便宜 賣商店又高於買的價錢 達到洗錢的效果:'(
對於這個小問題我寫了個小方法偵測
物件:ShopTable
搜尋loadShopAllSell
在int price = rs.getInt(\"sell_price\");以下if(price >= 1) {以上貼上下面的程式碼
//修正販賣價錢錯誤問題
if (price >= 1) {
Connection conI = null;
PreparedStatement pstmI = null;
ResultSet rsI = null;
try {
conI = L1DatabaseFactory.getInstance().getConnection();
pstmI = conI.prepareStatement(\"SELECT * FROM shop WHERE item_id='\"+ itemId+\"'\");
rsI = pstmI.executeQuery();
while (rsI.next()) {
if (rsI.getInt(\"selling_price\") >= 1 && price > rsI.getInt(\"selling_price\")) {
System.out.println(\"NpcId=\"+rsI.getInt(\"npc_id\")+\", ItemID=\"+itemId+\", PriceError!!!\");
price = -1;
}
}
rsI.close();
} catch (SQLException e) {
_log.log(Level.SEVERE, e.getLocalizedMessage(), e);
} finally {
SQLUtil.close(rsI, pstmI, conI);
}
}
教學不錯!!! 感謝分享 感謝教學 感謝教學 谢谢大佬分享技术~~~~~ 謝謝您 教學不錯!!! 感謝你的分享~教學 可以解釋一下程式碼的意思嗎
感謝教學 感謝分享 不錯的東西~~感謝分享~ 感謝無私的分享 感謝分享 感謝大大無私地分享 感謝教學分享 感謝你的分享 這個 好像都核心的好深澳 感謝分享
頁:
[1]
2