 | 代瑪如下:
首先在SHOP表裏添加一個欄目“yuanbao”,這個是物品賣出的價錢。
1,找到SHOPTABLE.JAVA
查找private L1Shop loadShop(int npcId, ResultSet rs) throws SQLException {
改成和下面一樣
private L1Shop loadShop(int npcId, ResultSet rs) throws SQLException {
List<L1ShopItem> sellingList = new ArrayList<L1ShopItem>();
List<L1ShopItem> purchasingList = new ArrayList<L1ShopItem>();
while (rs.next()) {
int itemId = rs.getInt("item_id");
int sellingPrice = rs.getInt("selling_price");
int purchasingPrice = rs.getInt("purchasing_price");
int packCount = rs.getInt("pack_count");
packCount = packCount == 0 ? 1 : packCount;
int yuanbao = rs.getInt("yuanbao");//add liumy
&%INfl>o7.
switch(npcId){
case 70068:case 70020:
case 70024:case 70032:
case 80075:
continue;
default:
break;
}
if(0 <= sellingPrice){
if(_allItemSells.get(itemId)==null){
_allItemSells.put(itemId, sellingPrice/2);
}else if(_allItemSells.get(itemId)<sellingPrice/2){
_allItemSells.put(itemId, sellingPrice/2);
}
}else{ //-1
if(0 <= purchasingPrice){
if(_allItemSells.get(itemId)==null){
_allItemSells.put(itemId, purchasingPrice);
}else if(_allItemSells.get(itemId)<purchasingPrice){
_allItemSells.put(itemId, purchasingPrice);
}
}
}
if (0 <= sellingPrice && 0 >= yuanbao ) {
L1ShopItem item = new L1ShopItem(itemId, sellingPrice,
packCount);
sellingList.add(item);
}
if (0 <= purchasingPrice && 0 >= yuanbao ) {
L1ShopItem item = new L1ShopItem(itemId, purchasingPrice,
packCount);
purchasingList.add(item);
}
if (0 < yuanbao ) { //add liumy
L1ShopItem item = new L1ShopItem(itemId, yuanbao,
packCount);
sellingList.add(item);
}//add liumy end
}
return new L1Shop(npcId, sellingList, purchasingList);
}
2,打開SHOP.JAVA
查找 private boolean ensureSell(L1PcInstance pc, L1ShopBuyOrderList orderList) {
改成和下面一樣
private boolean ensureSell(L1PcInstance pc, L1ShopBuyOrderList orderList) {
int price = orderList.getTotalPriceTaxIncluded();
// オーバーフローチェック
if (!IntRange.includes(price, 0, 2000000000)) {
// 總販賣価格は%dアデナを超過できません。
pc.sendPackets(new S_ServerMessage(904, "2000000000"));
return false;
}
// 購入できるかチェック
//add liumy
int bb;
if (_npcId >= 990000 && _npcId <= 995000) { //元寶商城專用NPC的ID
bb =61019; //元寶
}else{
bb =L1ItemId.ADENA;
}//add liumy
if (!pc.getInventory().checkItem(bb, price)) {
//l1j.eric.gui.J_Main.getInstance().addConsolPost(""+price);
// \f1アデナが不足しています。
if (L1ItemId.ADENA == bb){ //add liumy
pc.sendPackets(new S_ServerMessage(189));
}else{
pc.sendPackets(new S_SystemMessage("元寶不足"));//add liumy
//pc.sendPackets(new S_ServerMessage(189));
}
return false;
}
// 重量チェック
int currentWeight = pc.getInventory().getWeight() * 1000;
if (currentWeight + orderList.getTotalWeight() > pc.getMaxWeight() * 1000) {
再找到 private void sellItems(L1PcInventory inv, L1ShopBuyOrderList orderList) {
改成
private void sellItems(L1PcInventory inv, L1ShopBuyOrderList orderList) {
//add liumy
int bb;
if (_npcId >= 990000 && _npcId <= 995000) {
bb =61019; //元寶 BqZLqGO Ku
}else{
bb =L1ItemId.ADENA;
}
if (!inv.consumeItem(bb, orderList
.getTotalPriceTaxIncluded())) {
throw new IllegalStateException("購入に必要なアデナを消費できませんでした。");
}
for (L1ShopBuyOrder order : orderList.getList()) {
改這二個文件,元寶商城就可以了,隻是窗口顯示是金币的數量,如果不想顯示的話。
修改二個文件,(s_scrollshopselllist.java和S_shopselllist.java)
找到,writeH(0x07); // 0x00:kaimo 0x01:pearl 0x07:adena
修改成
if (npcId >= 990000 && npcId <= 995000){
writeH(0x0C8C); // 0x00:kaimo 0x01:pearl 0x07:adena //如果誰知道官方天寶的封包是多少就好了,我隻好亂寫個0x0C8C
}else{
writeH(0x07); // 0x00:kaimo 0x01:pearl 0x07:adena
}
END
回覆是我發帖的動力~!
| |