Added: a brand-new default dashboard template.
You can now add multiple game/login server builds.
Full support for running both PTS & L2J servers simultaneously, with switching between them.
Payment systems: added OmegaPay and Pally (new PayPal-style API).
Account history now stores everything: donations, items delivered to characters, referrals, transfers between game accounts, and coin transfers to another master account.
Personal Promo Code System: you can create a promo code and assign it to a user or promoter. When donating, a player can enter this promo code to receive bonus coins, and the promo code owner also receives a bonus — all fully configurable in the admin panel.
Look demo site: demo
MoMoProxy has updated more static residential proxies for USA location, anyone interested in can view: https://momoproxy.com/static-residential-proxies
To manually override it you got to use command //field_cycle set_step 1 11
1 is the field cycle id for hellbound island from db (fiy 2 & 3 are the seeds in gracia sod and soi) and 11 is the level you want to change it to. Anywhere from 1 to 11 will work for different stages.
Question
janiko
hi everyone i need help to call this script onLogout
but i dont know how to call this script on log out, can someone help me?
public void save(L2PcInstance owner) { if (isModified) { saveToDatabase(owner); } }this is my scheme buffer table
package com.l2jserver.gameserver.communitybbs.BB; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import javolution.util.FastList; import javolution.util.FastMap; import com.l2jserver.L2DatabaseFactory; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import gnu.trove.map.hash.TIntIntHashMap; /** * @author BiggBoss Buffer database tables: - scheme_buffs: contains buffname, buffid and bufflevel to handle - scheme_buffer_profiles: contains each char id with his scheme profile - scheme_char_buffs: contains the player objectid, his profile and buff name, buff id and buff level for each profile */ public class SchemeBufferManager { /* FastMap to hold the avaliable buffs, FastList to properly iterate showing the buffs */ public static FastMap<String, Integer[]> _buffs = new FastMap<>(); public static TIntIntHashMap _skillLevels = new TIntIntHashMap(); /* Pages to show the buffs. Each page should have 15 buffs */ public static int _pages; public SchemeBufferManager() { loadData(); } /* * Load all buffs into a FastMap at server start up */ private void loadData() { try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement statement = con.prepareStatement("SELECT * FROM scheme_buffs"); ResultSet rset = statement.executeQuery(); while (rset.next()) { Integer[] buffs = new Integer[2]; String name = rset.getString("buff_name"); buffs[0] = rset.getInt("buff_id"); buffs[1] = rset.getInt("buff_lvl"); _buffs.put(name, buffs); } statement.close(); } catch (SQLException e) { e.printStackTrace(); } _pages = Math.round(_buffs.size() /* / (CustomConfig.IS_X50_SERVER ? 22 : 15) */); for (Integer[] i : _buffs.values()) { _skillLevels.put(i[0], i[1]); } // All was correct, print out a message System.out.println("Loaded " + _buffs.size() + " buffs for the Scheme Buffer. " + _pages + " pages available."); } /* * Load all player profiles into a FastList */ public FastList<PlayerBuffProfile> loadPlayerProfiles(L2PcInstance player) { FastList<PlayerBuffProfile> profiles = new FastList<>(); try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement statement = con.prepareStatement("SELECT profile, buffs FROM scheme_buffer_profiles WHERE charId = ?"); statement.setInt(1, player.getObjectId()); ResultSet rset = statement.executeQuery(); if (rset == null) { return null; } while (rset.next()) { PlayerBuffProfile profile = SchemeBufferManager.getInstance().new PlayerBuffProfile(rset.getString("profile")); String[] buffs = rset.getString("buffs").split(";"); for (String buff : buffs) { profile.buffs.add(buff); } profiles.add(profile); } statement.close(); } catch (SQLException e) { e.printStackTrace(); } return profiles; } public void saveProfile(L2PcInstance player, String profile) { try(Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement statement = con.prepareStatement("INSERT INTO scheme_buffer_profiles VALUES ( ? , ? )"); statement.setInt(1, player.getObjectId()); statement.setString(2, profile); statement.execute(); con.close(); statement.close(); } catch(SQLException e) { e.printStackTrace(); } } public void deleteFromDatabase(L2PcInstance owner, String profile) { try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement statement = con.prepareStatement("DELETE FROM scheme_buffer_profiles WHERE charId = ? AND profile = ?"); statement.setInt(1, owner.getObjectId()); statement.setString(2, profile); statement.execute(); statement.close(); } catch (SQLException e) { e.printStackTrace(); } finally { owner.removeProfile(profile); } } public class PlayerBuffProfile { public final String profileName; public final FastList<String> buffs; private boolean isModified = false; public PlayerBuffProfile(String $profileName) { profileName = $profileName; buffs = new FastList<>(); } public void addBuff(String buffName) { isModified = true; buffs.add(buffName); } public void removeBuff(String buffName) { isModified = true; buffs.remove(buffName); } public void save(L2PcInstance owner) { if (isModified) { saveToDatabase(owner); } } private void saveToDatabase(L2PcInstance owner) { try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { PreparedStatement statement = con.prepareStatement("REPLACE INTO scheme_buffer_profiles VALUES ( ? , ? , ? )"); statement.setInt(1, owner.getObjectId()); statement.setString(2, profileName); statement.setString(3, getBuffsAsString()); statement.execute(); statement.close(); } catch (SQLException e) { e.printStackTrace(); } finally { isModified = false; } } private String getBuffsAsString() { StringBuilder sb = new StringBuilder(); for (String buff : buffs) { sb.append(buff); sb.append(";"); } return sb.toString(); } } public static final SchemeBufferManager getInstance() { return SingletonHolder._instance; } private static class SingletonHolder { protected static final SchemeBufferManager _instance = new SchemeBufferManager(); } }1 answer 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