forked from MagicBane/Server
MagicBot
8 months ago
13 changed files with 86 additions and 1576 deletions
@ -1,71 +0,0 @@
@@ -1,71 +0,0 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.objects; |
||||
|
||||
import engine.server.MBServerStatics; |
||||
import org.pmw.tinylog.Logger; |
||||
|
||||
import java.sql.ResultSet; |
||||
import java.sql.SQLException; |
||||
import java.util.concurrent.ConcurrentHashMap; |
||||
|
||||
public class LevelDefault { |
||||
|
||||
public static ConcurrentHashMap<Byte, LevelDefault> defaults = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); |
||||
public final int level; |
||||
public final float health; |
||||
public final float mana; |
||||
public final float stamina; |
||||
public final float atr; |
||||
public final float def; |
||||
public final float minDamage; |
||||
public final float maxDamage; |
||||
public final int goldMin; |
||||
public final int goldMax; |
||||
|
||||
/** |
||||
* ResultSet Constructor |
||||
*/ |
||||
public LevelDefault(ResultSet rs) throws SQLException { |
||||
super(); |
||||
this.level = rs.getInt("level"); |
||||
this.health = rs.getFloat("health"); |
||||
this.mana = (float) rs.getInt("mana"); |
||||
this.stamina = (float) rs.getInt("stamina"); |
||||
this.atr = (float) rs.getInt("atr"); |
||||
this.def = (float) rs.getInt("def"); |
||||
this.minDamage = (float) rs.getInt("minDamage"); |
||||
this.maxDamage = (float) rs.getInt("maxDamage"); |
||||
this.goldMin = rs.getInt("goldMin"); |
||||
this.goldMax = rs.getInt("goldMax"); |
||||
} |
||||
|
||||
public static LevelDefault getLevelDefault(byte level) { |
||||
LevelDefault ret = null; |
||||
if (LevelDefault.defaults.containsKey(level)) |
||||
return LevelDefault.defaults.get(level); |
||||
|
||||
PreparedStatementShared ps = null; |
||||
try { |
||||
ps = new PreparedStatementShared("SELECT * FROM `static_npc_level_defaults` WHERE level = ?;"); |
||||
ps.setInt(1, (int) level); |
||||
ResultSet rs = ps.executeQuery(); |
||||
if (rs.next()) { |
||||
ret = new LevelDefault(rs); |
||||
LevelDefault.defaults.put(level, ret); |
||||
} |
||||
} catch (SQLException e) { |
||||
Logger.error("SQL Error number: " + e.getErrorCode() + ' ' + e.getMessage()); |
||||
} finally { |
||||
ps.release(); |
||||
} |
||||
return ret; |
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -1,118 +0,0 @@
@@ -1,118 +0,0 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.powers; |
||||
|
||||
import engine.objects.PreparedStatementShared; |
||||
import org.pmw.tinylog.Logger; |
||||
|
||||
import java.sql.ResultSet; |
||||
import java.sql.SQLException; |
||||
import java.util.ArrayList; |
||||
|
||||
|
||||
public class FailCondition { |
||||
|
||||
private String IDString; |
||||
private Boolean forPower; |
||||
private String type; |
||||
private float amount; |
||||
private float ramp; |
||||
private boolean rampAdd; |
||||
|
||||
// private String damageType1;
|
||||
// private String damageType2;
|
||||
// private String damageType3;
|
||||
|
||||
/** |
||||
* No Table ID Constructor |
||||
*/ |
||||
public FailCondition() { |
||||
|
||||
} |
||||
|
||||
/** |
||||
* ResultSet Constructor |
||||
*/ |
||||
public FailCondition(ResultSet rs) throws SQLException { |
||||
|
||||
this.IDString = rs.getString("IDString"); |
||||
this.forPower = (rs.getString("powerOrEffect").equals("Power")) ? true : false; |
||||
this.type = rs.getString("type"); |
||||
this.amount = rs.getFloat("amount"); |
||||
this.ramp = rs.getFloat("ramp"); |
||||
this.rampAdd = (rs.getInt("useAddFormula") == 1) ? true : false; |
||||
// this.damageType1 = rs.getString("damageType1");
|
||||
// this.damageType2 = rs.getString("damageType2");
|
||||
// this.damageType3 = rs.getString("damageType3");
|
||||
} |
||||
|
||||
public static ArrayList<FailCondition> getAllFailConditions() { |
||||
PreparedStatementShared ps = null; |
||||
ArrayList<FailCondition> out = new ArrayList<>(); |
||||
try { |
||||
ps = new PreparedStatementShared("SELECT * FROM failconditions"); |
||||
ResultSet rs = ps.executeQuery(); |
||||
while (rs.next()) { |
||||
FailCondition toAdd = new FailCondition(rs); |
||||
out.add(toAdd); |
||||
} |
||||
rs.close(); |
||||
} catch (Exception e) { |
||||
Logger.error(e); |
||||
|
||||
} finally { |
||||
ps.release(); |
||||
} |
||||
return out; |
||||
} |
||||
|
||||
public String getIDString() { |
||||
return this.IDString; |
||||
} |
||||
|
||||
public String getType() { |
||||
return this.type; |
||||
} |
||||
|
||||
public boolean forPower() { |
||||
return this.forPower; |
||||
} |
||||
|
||||
public float getAmount() { |
||||
return this.amount; |
||||
} |
||||
|
||||
public float getRamp() { |
||||
return this.ramp; |
||||
} |
||||
|
||||
public float getAmountForTrains(float trains) { |
||||
if (this.rampAdd) |
||||
return this.amount + (this.ramp * trains); |
||||
else |
||||
return this.amount * (1 + (this.ramp * trains)); |
||||
} |
||||
|
||||
public boolean useRampAdd() { |
||||
return this.rampAdd; |
||||
} |
||||
|
||||
// public String getDamageType1() {
|
||||
// return this.damageType1;
|
||||
// }
|
||||
|
||||
// public String getDamageType2() {
|
||||
// return this.damageType2;
|
||||
// }
|
||||
|
||||
// public String getDamageType3() {
|
||||
// return this.damageType3;
|
||||
// }
|
||||
} |
Loading…
Reference in new issue