skyalcon 發表於 2026-2-2 20:26

元神系統能力值一鍵存檔

/**
       * 【優化】元神系統能力值一鍵存檔
       * 維護者: E.L. (2026-02-02)
       */
        @Override
        public void updateItemIntensifyAttributes(final L1ItemInstance item) throws Exception {
                Connection con = null;
                PreparedStatement pstm = null;
                try {
                        con = DatabaseFactory.get().getConnection();
                        // 注意:請確認資料庫 character_items 表格中有對應的欄位名稱
                        // 若欄位名稱不同(例如資料庫內叫 str 而非 item_str),請根據實際表格調整
                        pstm = con.prepareStatement(
                                        "UPDATE `character_items` SET " +
                                        "`item_attack`=?, `item_bow_attack`=?, `item_reduction_dmg`=?, " +
                                        "`item_sp`=?, `item_probability`=?, `item_str`=?, `item_dex`=?, " +
                                        "`item_int`=?, `item_hp`=?, `item_mp`=?, `item_con`=?, " +
                                        "`item_wis`=?, `item_cha`=? WHERE `id`=?");
                       
                        int i = 0;
                        pstm.setInt(++i, item.getItemAttack());
                        pstm.setInt(++i, item.getItemBowAttack());
                        pstm.setInt(++i, item.getItemReductionDmg());
                        pstm.setInt(++i, item.getItemSp());
                        pstm.setInt(++i, item.getItemprobability());
                        pstm.setInt(++i, item.getItemStr());
                        pstm.setInt(++i, item.getItemDex());
                        pstm.setInt(++i, item.getItemInt());
                        pstm.setInt(++i, item.getItemHp());
                        pstm.setInt(++i, item.getItemMp());
                        pstm.setInt(++i, item.getItemCon());
                        pstm.setInt(++i, item.getItemWis());
                        pstm.setInt(++i, item.getItemCha());
                        pstm.setInt(++i, item.getId());
                       
                        pstm.execute();

                } catch (final SQLException e) {
                        _log.error("元神系統整合更新發生異常: " + item.getId(), e);
                        throw e;
                } finally {
                        SQLUtil.close(pstm);
                        SQLUtil.close(con);
                }
        }

頁: [1]
查看完整版本: 元神系統能力值一鍵存檔