This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..
AdBlock Extension Detected!
Our website is made possible by displaying online advertisements to our members.
Please disable AdBlock browser extension first, to be able to use our community.
Question
janiko
Hi all i decided to write my custom community buffer.
first i wrote only to save buffs and get it and then i decided to add Scheme Function in it so i stucked here.
can anyone help me how to add String Name in the code to save also in sql?
private void saveBuff() { Map<Integer, Integer> ceffects = new FastMap<Integer, Integer>(); L2Character character; if (character == null) { return; } if (ceffects.isEmpty()) { return; } if(character.getAllEffects() == null) { return; } for (L2Effect cureffect : character.getAllEffects()) { int idSklll = cureffect.getSkill().getId(); int lvlSklll = cureffect.getLevel(); if(character.getAllEffects() != null) { ceffects.put(idSklll, lvlSklll);// TODO support for Scheme String Name } } this._bbsBuff.clear(); this._bbsBuff.putAll(ceffects); saveBuffSQL(); } private void saveBuffSQL() { try(Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement statement = con.prepareStatement("DELETE FROM character_bbs_buff_save WHERE charId=?"); statement.setInt(1, getObjectId()); statement.execute(); statement.close(); for (Map.Entry<Integer, Integer> entry : ceffects.entrySet()) { statement = con.prepareStatement("INSERT INTO character_bbs_buff_save (charId,skill_id,skill_level) VALUES (?,?,?)"); statement.setInt(1, getObjectId()); statement.setInt(2, entry.getKey().intValue()); statement.setInt(3, entry.getValue().intValue()); statement.execute(); statement.close(); } } catch (Exception e) { _log.log(Level.WARNING, "Could not store char effect data: ", e); } }6 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now