make a new table in l2jdb called BonusIP
make 1 row called ipnumber that is a string
in server.properties
===============================
RateQuestsReward = 1.
RateDropEquipment = 1
+BonusRate = 1.5
in L2PcInstance.java add this
===============================
+private boolean _bonusrate = false;
+
+public final boolean getCharBonus()
+{
+ boolean result = false;
+ java.sql.Connection con = null;
+ try
+ {
+ con = L2DatabaseFactory.getInstance().getConnection();
+ PreparedStatement statement = con.prepareStatement("SELECT COUNT(*) FROM accounts WHERE lastIP IN (SELECT ipnumber FROM BonusIP) AND login =?");
+ statement.setString(1, _accountName);
+ ResultSet rset = statement.executeQuery();
+ result = rset.next();
+ if (rset.getInt(1) > 0)
+ result = true;
+ rset.close();
+ statement.close();
+ }
+ catch (SQLException e)
+ {
+ _log.warning("could not check existing charname:"+e.getMessage());
+ }
+ finally
+ {
+ try { con.close(); } catch (Exception e) {}
+ }
+ return result;
+}
private L2PcInstance(int objectId, L2PcTemplate template, String accountName)
{
super(objectId, template);
_accountName = accountName;
_level = 1;
_blockList = new ArrayList<L2PcInstance>();
_nameColor = 0xFFFFFF;
baseLoad = template.baseLoad;
+ // team Olympus custom addition. Customer bonus, by ip.
+ _bonusrate = getCharBonus();
}
private L2PcInstance(int objectId, L2PcTemplate template)
{
this(objectId, template, null);
// Create an AI
_ai = new L2PlayerAI(new L2PcInstance.AIAccessor());
// Create a L2Radar object
radar = new L2Radar(this);
// Retrieve from the database all skills of this L2PcInstance and add them to _skills
restoreSkills();
// Retrieve from the database all items of this L2PcInstance and add them to _inventory
getInventory().restore();
// Retrieve from the database all macroses of this L2PcInstance and add them to _macroses
_macroses.restore();
// Retrieve from the database all shortCuts of this L2PcInstance and add them to _shortCuts
_shortCuts.restore();
+ // Retrieve from the database wether bonus rates should be applied
+ _bonusrate = getCharBonus();
restoreHenna();
}
public void addExpAndSp(int addToExp, int addToSp)
{
+ if (_bonusrate)
+ {
+ addToExp *= Config.BONUSRATE;
+ addToSp *= Config.BONUSRATE;
+ }
in config.java
===============================
/** Rate control */
public static final float RATE_XP;
public static final float RATE_SP;
public static final float RATE_QUESTS_REWARD;
public static final float RATE_DROP_ADENA;
public static final float RATE_DROP_ITEMS;
public static final float RATE_DROP_SPOIL;
public static final float RATE_DROP_EQUIPMENT;
public static final float ALT_GAME_EXPONENT_XP;
public static final float ALT_GAME_EXPONENT_SP;
+ public static final float BONUSRATE;
RATE_XP = Float.parseFloat(serverSettings.getProperty("RateXp", "1."));
RATE_SP = Float.parseFloat(serverSettings.getProperty("RateSp", "1."));
RATE_QUESTS_REWARD = Float.parseFloat(serverSettings.getProperty("RateQuestsReward", "1."));
RATE_DROP_ADENA = Float.parseFloat(serverSettings.getProperty("RateDropAdena", "1."));
RATE_DROP_ITEMS = Float.parseFloat(serverSettings.getProperty("RateDropItems", "1."));
RATE_DROP_SPOIL = Float.parseFloat(serverSettings.getProperty("RateDropSpoil", "1."));
RATE_DROP_EQUIPMENT = Float.parseFloat(serverSettings.getProperty("RateDropEquipment", "1."));
+ BONUSRATE = Float.parseFloat(serverSettings.getProperty("BonusRate", "1."));