微信扫一扫 分享朋友圈

已有 428 人浏览分享

[服務器教學] 修復飛鏢子彈類販售回購價格異常

[複製鏈接]

初窺門道

Rank: 2

332

威望

423

金錢

216

A幣
主題
13
帖子
66
精華
5
綜合社群主題發文量
0
電玩社群主題發文量
0
娛樂社群主題發文量
0
技術社群主題發文量
13
閱讀權限
20
註冊時間
2019-8-9

精華作者勳章

  • TA的每日心情

    2021-6-8 20:12
  • 簽到天數: 14 天

    連續簽到: 0 天

    [LV.3]偶爾看看II

    a894985459 發表於  2023-5-8 18:13:33 | 顯示全部樓層 | 閱讀模式
    嗨 又是我目前已知 GMSv111 GMSv117
    兩個版本都會有這問題
    問題點:
    將儲值滿的飛鏢或是子彈賣到商店後 可以用極低的價格回購
    也就是花費1個的價錢 即可回購一整組


    一樣懶的廢話 直接上教學

    首先打開你的IDE

    找到MapleShop.java

    搜尋
    1. if (GameConstants.isThrowingStar(item.getItemId()) || GameConstants.isBullet(item.getItemId())) {
    複製代碼
    之後會得到大概這樣的內容
    1.             double price;
    2.             if (GameConstants.isThrowingStar(item.getItemId()) || GameConstants.isBullet(item.getItemId())) {
    3.                 price = ii.getWholePrice(item.getItemId()) / (double) ii.getSlotMax(item.getItemId());
    4.             } else {
    5.                 price = ii.getPrice(item.getItemId());
    6.             }
    7.             final int recvMesos = (int) Math.max(Math.ceil(price * quantity), 0);
    8.             if (price != -1.0 && recvMesos > 0) {
    9.                 c.getPlayer().gainMeso(recvMesos, false);
    10.             }
    11.             c.getSession().write(NPCPacket.confirmShopTransaction((byte) 0x4, this, c, -1));
    12.         }
    13.     }
    複製代碼
    將這整段直接替換成
    1.             double price;
    2.             if (GameConstants.isThrowingStar(item.getItemId()) || GameConstants.isBullet(item.getItemId())) {
    3.                 price = ii.getPrice(item.getItemId()) * (double) quantity;//飛鏢 子彈計算方式
    4.             } else {
    5.                 price = ii.getPrice(item.getItemId());
    6.             }
    7.             final int recvMesos = (int) Math.max(Math.ceil(price * quantity), 0);
    8.             final int recvMesos2 = (int) Math.max(Math.ceil(price + ii.getWholePrice(item.getItemId())), 0);//對應飛鏢 子彈售出價格
    9.             if (price != -1.0 && recvMesos > 0 && GameConstants.isThrowingStar(item.getItemId()) || price != -1.0 && recvMesos > 0 && GameConstants.isBullet(item.getItemId())) {
    10.                 c.getPlayer().gainMeso(recvMesos2, false);
    11.             } else {
    12.                c.getPlayer().gainMeso(recvMesos, false);
    13.             }
    14.             c.getSession().write(NPCPacket.confirmShopTransaction((byte) 0x4, this, c, -1));
    15.         }
    16.     }
    複製代碼
    往下搜尋
    1. final Item i = c.getPlayer().getRebuy().get(index);
    複製代碼
    會得到大概這樣
    1.         if (index >= 0) {
    2.             final Item i = c.getPlayer().getRebuy().get(index);
    3.             final int price = (int) Math.max(Math.ceil(ii.getPrice(itemId) * (GameConstants.isRechargable(itemId) ? 1 : i.getQuantity())), 0);
    4.             if (price >= 0 && c.getPlayer().getMeso() >= price) {
    5.                 if (MapleInventoryManipulator.checkSpace(c, itemId, i.getQuantity(), i.getOwner())) {
    6.                     c.getPlayer().gainMeso(-price, false);
    7.                     MapleInventoryManipulator.addbyItem(c, i);
    8.                     c.getPlayer().getRebuy().remove(index);
    9.                     c.getSession().write(NPCPacket.confirmShopTransaction((byte) 0, this, c, x));
    10.                 } else {
    11.                     c.getPlayer().dropMessage(1, "Your inventory is full.");
    12.                     c.getSession().write(NPCPacket.confirmShopTransaction((byte) 0, this, c, -1));
    13.                 }
    14.             } else {
    15.                 c.getSession().write(NPCPacket.confirmShopTransaction((byte) 0, this, c, -1));
    16.             }
    17.             return;
    18.         }
    複製代碼


    一樣將這整段替換為
    1.         if (index >= 0) {
    2.             final Item i = c.getPlayer().getRebuy().get(index);
    3.             final int price = (int) Math.max(Math.ceil(ii.getPrice(itemId) * (GameConstants.isRechargable(itemId) ? 1 : i.getQuantity())), 0);
    4.             final int price2 = (int) Math.max(Math.ceil(ii.getPrice(itemId) * i.getQuantity() + ii.getWholePrice(itemId)) ,0);
    5.             if (price >= 0 && c.getPlayer().getMeso() >= price) {
    6.                 if (MapleInventoryManipulator.checkSpace(c, itemId, i.getQuantity(), i.getOwner()) && GameConstants.isRechargable(itemId) || MapleInventoryManipulator.checkSpace(c, itemId, i.getQuantity(), i.getOwner()) && GameConstants.isBullet(itemId) ) {
    7.                     c.getPlayer().gainMeso(-price2, false);
    8.                     MapleInventoryManipulator.addbyItem(c, i);
    9.                     c.getPlayer().getRebuy().remove(index);
    10.                     c.getSession().write(NPCPacket.confirmShopTransaction((byte) 0, this, c, x));
    11.                 } else if (MapleInventoryManipulator.checkSpace(c, itemId, i.getQuantity(), i.getOwner())) {
    12.                     c.getPlayer().gainMeso(-price, false);
    13.                     MapleInventoryManipulator.addbyItem(c, i);
    14.                     c.getPlayer().getRebuy().remove(index);
    15.                     c.getSession().write(NPCPacket.confirmShopTransaction((byte) 0, this, c, x));
    16.                 } else {
    17.                     c.getPlayer().dropMessage(1, "你的背包已滿");
    18.                     c.getSession().write(NPCPacket.confirmShopTransaction((byte) 0, this, c, -1));
    19.                 }
    20.             } else {
    21.                 c.getSession().write(NPCPacket.confirmShopTransaction((byte) 0, this, c, -1));
    22.             }
    23.             return;
    24.         }
    複製代碼
    編譯後 飛鏢跟子彈的販賣及回購價格就會正常了
    共收到 10 A幣
    打賞榜
    共打賞 10 A幣
    暫無
    暫無
    暫無
    ----
    暫無
    ----
    暫無
    ----
    暫無
    ----
    您需要登錄後才可以回帖 登錄 | 註冊會員

    本版積分規則

    66

    發文

    423

    金錢

    216

    A幣

    ----------榮譽勳章----------

    精華作者勳章

    熱門推薦
    圖文推薦
    • 聯繫我們

    小黑屋|AICL社群娛樂集團

    GMT+8, 2024-4-24 10:34 , 網路刷新 0.097010 秒 .

    歡迎來到 AICL網路社群

    版權AICL社群所有 2011-2021.

    Total:123 Today:213 Online:322