Using HikariCP + Pet issues + Dojo skills
As Suggested by Alex-0000, migrated from DBCP to HikariCP (uses less external JARs and got a cleaner code overall). Fixed some issues regarding pets, such as evolving or hatching from egg. Added dojo skills and fixed energy bar. Added missing upgrade books on drop data.
This commit is contained in:
@@ -153,16 +153,6 @@ import server.maps.MapleMapItem;
|
||||
public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
private static final String LEVEL_200 = "[Congrats] %s has reached Level 200! Congratulate %s on such an amazing achievement!";
|
||||
|
||||
// MapleStory default keyset
|
||||
private static final int[] DEFAULT_KEY = {18, 65, 2, 23, 3, 4, 5, 6, 16, 17, 19, 25, 26, 27, 31, 34, 35, 37, 38, 40, 43, 44, 45, 46, 50, 56, 59, 60, 61, 62, 63, 64, 57, 48, 29, 7, 24, 33, 41, 39};
|
||||
private static final int[] DEFAULT_TYPE = {4, 6, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 4, 4, 5, 6, 6, 6, 6, 6, 6, 5, 4, 5, 4, 4, 4, 4, 4};
|
||||
private static final int[] DEFAULT_ACTION = {0, 106, 10, 1, 12, 13, 18, 24, 8, 5, 4, 19, 14, 15, 2, 17, 11, 3, 20, 16, 9, 50, 51, 6, 7, 53, 100, 101, 102, 103, 104, 105, 54, 22, 52, 21, 25, 26, 23, 27};
|
||||
|
||||
// MapleSolaxiaV2 custom keyset
|
||||
private static final int[] CUSTOM_KEY = {2, 3, 4, 5, 31, 56, 59, 32, 42, 6, 17, 29, 30, 41, 50, 60, 61, 62, 63, 64, 65, 16, 7, 8};
|
||||
private static final int[] CUSTOM_TYPE = {4, 4, 4, 4, 5, 5, 6, 5, 5, 4, 4, 4, 5, 4, 4, 6, 6, 6, 6, 6, 6, 4, 4, 4};
|
||||
private static final int[] CUSTOM_ACTION = {1, 0, 3, 2, 53, 54, 100, 52, 51, 19, 5, 9, 50, 7, 22, 101, 102, 103, 104, 105, 106, 8, 17, 26};
|
||||
|
||||
private static final String[] BLOCKED_NAMES = {"admin", "owner", "moderator", "intern", "donor", "administrator", "help", "helper", "alert", "notice", "maplestory", "Solaxia", "fuck", "wizet", "fucking", "negro", "fuk", "fuc", "penis", "pussy", "asshole", "gay",
|
||||
"nigger", "homo", "suck", "cum", "shit", "shitty", "condom", "security", "official", "rape", "nigga", "sex", "tit", "boner", "orgy", "clit", "asshole", "fatass", "bitch", "support", "gamemaster", "cock", "gaay", "gm",
|
||||
"operate", "master", "sysop", "party", "GameMaster", "community", "message", "event", "test", "meso", "Scania", "renewal", "yata", "AsiaSoft", "henesys"};
|
||||
@@ -380,14 +370,14 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
int[] selectedAction;
|
||||
|
||||
if(ServerConstants.USE_CUSTOM_KEYSET) {
|
||||
selectedKey = CUSTOM_KEY;
|
||||
selectedType = CUSTOM_TYPE;
|
||||
selectedAction = CUSTOM_ACTION;
|
||||
selectedKey = GameConstants.getCustomKey(true);
|
||||
selectedType = GameConstants.getCustomType(true);
|
||||
selectedAction = GameConstants.getCustomAction(true);
|
||||
}
|
||||
else {
|
||||
selectedKey = DEFAULT_KEY;
|
||||
selectedType = DEFAULT_TYPE;
|
||||
selectedAction = DEFAULT_ACTION;
|
||||
selectedKey = GameConstants.getCustomKey(false);
|
||||
selectedType = GameConstants.getCustomType(false);
|
||||
selectedAction = GameConstants.getCustomAction(false);
|
||||
}
|
||||
|
||||
for (int i = 0; i < selectedKey.length; i++) {
|
||||
@@ -5297,14 +5287,14 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
int[] selectedAction;
|
||||
|
||||
if(ServerConstants.USE_CUSTOM_KEYSET) {
|
||||
selectedKey = CUSTOM_KEY;
|
||||
selectedType = CUSTOM_TYPE;
|
||||
selectedAction = CUSTOM_ACTION;
|
||||
selectedKey = GameConstants.getCustomKey(true);
|
||||
selectedType = GameConstants.getCustomType(true);
|
||||
selectedAction = GameConstants.getCustomAction(true);
|
||||
}
|
||||
else {
|
||||
selectedKey = DEFAULT_KEY;
|
||||
selectedType = DEFAULT_TYPE;
|
||||
selectedAction = DEFAULT_ACTION;
|
||||
selectedKey = GameConstants.getCustomKey(false);
|
||||
selectedType = GameConstants.getCustomType(false);
|
||||
selectedAction = GameConstants.getCustomAction(false);
|
||||
}
|
||||
|
||||
ps = con.prepareStatement("INSERT INTO keymap (characterid, `key`, `type`, `action`) VALUES (?, ?, ?, ?)");
|
||||
@@ -5736,7 +5726,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
}
|
||||
|
||||
public void setDojoEnergy(int x) {
|
||||
this.dojoEnergy = x;
|
||||
this.dojoEnergy = Math.min(x, 10000);
|
||||
}
|
||||
|
||||
public void setDojoPoints(int x) {
|
||||
|
||||
@@ -1655,6 +1655,12 @@ public class Commands {
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "maxenergy":
|
||||
c.getPlayer().setDojoEnergy(10000);
|
||||
c.announce(MaplePacketCreator.getEnergy("energy", 10000));
|
||||
System.out.println("gauge " + player.getDojoEnergy());
|
||||
break;
|
||||
|
||||
case "killall":
|
||||
List<MapleMapObject> monsters = player.getMap().getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER));
|
||||
@@ -1976,7 +1982,6 @@ public class Commands {
|
||||
|
||||
public static boolean executeSolaxiaCommandLv4(Channel cserv, Server srv, MapleClient c, String[] sub) { //SuperGM
|
||||
MapleCharacter player = c.getPlayer();
|
||||
MapleCharacter victim;
|
||||
|
||||
switch(sub[0]) {
|
||||
case "servermessage":
|
||||
|
||||
@@ -81,6 +81,19 @@ public class MaplePet extends Item {
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteFromDb() {
|
||||
try {
|
||||
Connection con = DatabaseConnection.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM pets WHERE `petid` = ?");
|
||||
ps.setInt(1, this.getUniqueId());
|
||||
ps.executeUpdate();
|
||||
ps.close();
|
||||
con.close();
|
||||
} catch (SQLException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void saveToDb() {
|
||||
try {
|
||||
Connection con = DatabaseConnection.getConnection();
|
||||
@@ -210,6 +223,7 @@ public class MaplePet extends Item {
|
||||
}
|
||||
|
||||
owner.getMap().broadcastMessage(MaplePacketCreator.commandResponse(owner.getId(), slot, type, enjoyed));
|
||||
if(owner.getMount() != null) owner.getMap().broadcastMessage(MaplePacketCreator.updateMount(owner.getId(), owner.getMount(), false));
|
||||
saveToDb();
|
||||
|
||||
Item petz = owner.getInventory(MapleInventoryType.CASH).getItem(getPosition());
|
||||
|
||||
@@ -12,18 +12,40 @@ public class GameConstants {
|
||||
private static final int[] MESO_RATE_GAIN = {1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105};
|
||||
private static final int[] EXP_RATE_GAIN = {1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610}; //fibonacci :3
|
||||
|
||||
public static int getPlayerBonusMesoRate(int slot) {
|
||||
return(MESO_RATE_GAIN[slot]);
|
||||
}
|
||||
|
||||
public static int getPlayerBonusDropRate(int slot) {
|
||||
return(DROP_RATE_GAIN[slot]);
|
||||
}
|
||||
|
||||
public static int getPlayerBonusMesoRate(int slot) {
|
||||
return(MESO_RATE_GAIN[slot]);
|
||||
}
|
||||
|
||||
public static int getPlayerBonusExpRate(int slot) {
|
||||
return(EXP_RATE_GAIN[slot]);
|
||||
}
|
||||
|
||||
// MapleStory default keyset
|
||||
private static final int[] DEFAULT_KEY = {18, 65, 2, 23, 3, 4, 5, 6, 16, 17, 19, 25, 26, 27, 31, 34, 35, 37, 38, 40, 43, 44, 45, 46, 50, 56, 59, 60, 61, 62, 63, 64, 57, 48, 29, 7, 24, 33, 41, 39};
|
||||
private static final int[] DEFAULT_TYPE = {4, 6, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 4, 4, 5, 6, 6, 6, 6, 6, 6, 5, 4, 5, 4, 4, 4, 4, 4};
|
||||
private static final int[] DEFAULT_ACTION = {0, 106, 10, 1, 12, 13, 18, 24, 8, 5, 4, 19, 14, 15, 2, 17, 11, 3, 20, 16, 9, 50, 51, 6, 7, 53, 100, 101, 102, 103, 104, 105, 54, 22, 52, 21, 25, 26, 23, 27};
|
||||
|
||||
// MapleSolaxiaV2 custom keyset
|
||||
private static final int[] CUSTOM_KEY = {2, 3, 4, 5, 31, 56, 59, 32, 42, 6, 17, 29, 30, 41, 50, 60, 61, 62, 63, 64, 65, 16, 7, 9, 13, 8};
|
||||
private static final int[] CUSTOM_TYPE = {4, 4, 4, 4, 5, 5, 6, 5, 5, 4, 4, 4, 5, 4, 4, 6, 6, 6, 6, 6, 6, 4, 4, 4, 4, 4};
|
||||
private static final int[] CUSTOM_ACTION = {1, 0, 3, 2, 53, 54, 100, 52, 51, 19, 5, 9, 50, 7, 22, 101, 102, 103, 104, 105, 106, 8, 17, 26, 20, 4};
|
||||
|
||||
public static int[] getCustomKey(boolean customKeyset) {
|
||||
return(customKeyset ? CUSTOM_KEY : DEFAULT_KEY);
|
||||
}
|
||||
|
||||
public static int[] getCustomType(boolean customKeyset) {
|
||||
return(customKeyset ? CUSTOM_TYPE : DEFAULT_TYPE);
|
||||
}
|
||||
|
||||
public static int[] getCustomAction(boolean customKeyset) {
|
||||
return(customKeyset ? CUSTOM_ACTION : DEFAULT_ACTION);
|
||||
}
|
||||
|
||||
private static final int[] mobHpVal = {0, 15, 20, 25, 35, 50, 65, 80, 95, 110, 125, 150, 175, 200, 225, 250, 275, 300, 325, 350,
|
||||
375, 405, 435, 465, 495, 525, 580, 650, 720, 790, 900, 990, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800,
|
||||
1900, 2000, 2100, 2200, 2300, 2400, 2520, 2640, 2760, 2880, 3000, 3200, 3400, 3600, 3800, 4000, 4300, 4600, 4900, 5200,
|
||||
@@ -115,6 +137,10 @@ public class GameConstants {
|
||||
return skill >= 9001000 && skill <= 9101008 || skill >= 8001000 && skill <= 8001001;
|
||||
}
|
||||
|
||||
public static boolean isBossRush(int mapid) {
|
||||
return mapid >= 970030100 && mapid <= 970042711;
|
||||
}
|
||||
|
||||
public static boolean isDojo(int mapid) {
|
||||
return mapid >= 925020100 && mapid <= 925023814;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ public class ServerConstants {
|
||||
public static String DB_URL = "";
|
||||
public static String DB_USER = "";
|
||||
public static String DB_PASS = "";
|
||||
public static final short DB_EXPERIMENTAL_POOLS = 4; //[EXPERIMENTAL] Installs a set number of database drivers/pools to hub connections. Set 0 to default.
|
||||
public static final boolean DB_EXPERIMENTAL_POOL = true; //[EXPERIMENTAL] Installs a connection pool to hub DB connections. Set false to default.
|
||||
|
||||
//World And Version
|
||||
public static short VERSION = 83;
|
||||
@@ -30,7 +30,7 @@ public class ServerConstants {
|
||||
public static boolean JAVA_8;
|
||||
public static boolean SHUTDOWNHOOK;
|
||||
|
||||
//Gameplay Configuration
|
||||
//Server Flags
|
||||
public static final boolean USE_CUSTOM_KEYSET = true; //Enables auto-setup of the MapleSolaxiaV2's custom keybindings when creating characters.
|
||||
public static final boolean USE_MAXRANGE_ECHO_OF_HERO = true;
|
||||
public static final boolean USE_MAXRANGE = true; //Will send and receive packets from all events of a map, rather than those of only view range.
|
||||
@@ -46,11 +46,19 @@ public class ServerConstants {
|
||||
public static final boolean USE_AUTOBAN = false; //Commands the server to detect infractors automatically.
|
||||
public static final boolean USE_ANOTHER_AUTOASSIGN = true; //Based on distributing AP accordingly to required secondary stat on equipments.
|
||||
public static final boolean USE_REFRESH_RANK_MOVE = true;
|
||||
public static final boolean USE_PERFECT_PITCH = true; //For lvl 30 or above, each lvlup player gains 1 perfect pitch.
|
||||
public static final boolean USE_PERMISSIVE_BUFFS = false; //WARNING: Allows players that does not have increased certain buff-type skills to use it's effect. Used mainly on buff-cast commands, however making this active may generate a source for possible client-edited exploits.
|
||||
public static final boolean USE_ENFORCE_MDOOR_POSITION = true; //Forces mystic door to be spawned near spawnpoints. (since things bugs out other way, and this helps players locate the door faster)
|
||||
public static final boolean USE_ERASE_UNTRADEABLE_DROP = true; //Forces flagged untradeable items to disappear when dropped.
|
||||
|
||||
//Server Rates And Experience
|
||||
public static final int EXP_RATE = 10;
|
||||
public static final int MESO_RATE = 10;
|
||||
public static final int DROP_RATE = 10;
|
||||
public static final int BOSS_DROP_RATE = 20;
|
||||
public static final int PARTY_EXPERIENCE_MOD = 1; //Change for event stuff.
|
||||
public static final double EQUIP_EXPERIENCE_MOD = 10.0; //Rate for equipment exp needed, grows linearly. Set 1.0 for default (about 100~200 same-level range mobs killed to pass equip from level 1 to 2).
|
||||
public static final double PQ_BONUS_EXP_MOD = 0.5;
|
||||
|
||||
public static final int MAX_AP = 20000; //Max AP allotted on the auto-assigner.
|
||||
public static final int MAX_EVENT_LEVELS = 8; //Event has different levels of rewarding system.
|
||||
public static final long BLOCK_NPC_RACE_CONDT = (long)(0.5 * 1000); //Time the player client must wait before reopening a conversation with an NPC.
|
||||
@@ -61,16 +69,26 @@ public class ServerConstants {
|
||||
public static final int ITEM_MONITOR_TIME = 5 * 60 * 1000; //Interval between item monitoring task on maps, which checks for dangling item objects on the map item history.
|
||||
public static final int ITEM_LIMIT_ON_MAP = 250; //Max number of items allowed on a map.
|
||||
|
||||
//Some Gameplay Enhancing Configuration
|
||||
//Some Gameplay Enhancing Configurations
|
||||
//Scroll Configuration
|
||||
public static final boolean USE_PERFECT_SCROLLING = true; //Scrolls doesn't use slots upon failure.
|
||||
public static final boolean USE_ENHANCED_CHSCROLL = true; //Equips even more powerful with chaos upgrade.
|
||||
public static final boolean USE_ENHANCED_CRAFTING = true; //Applys chaos scroll on every equip crafted.
|
||||
|
||||
//Beginner Skills Configuration
|
||||
public static final boolean USE_ULTRA_NIMBLE_FEET = true; //Haste-like speed & jump upgrade.
|
||||
public static final boolean USE_ULTRA_RECOVERY = true; //Massive recovery amounts overtime.
|
||||
public static final boolean USE_ULTRA_THREE_SNAILS = true; //Massive damage on shell toss.
|
||||
|
||||
//Character Configuration
|
||||
public static final boolean USE_ADD_SLOTS_BY_LEVEL = true; //Slots are added each 20 levels.
|
||||
public static final boolean USE_ADD_RATES_BY_LEVEL = true; //Rates are added each 20 levels.
|
||||
public static final boolean USE_STACK_COUPON_RATES = true; //Multiple coupons effects builds up together.
|
||||
public static final boolean USE_PERFECT_PITCH = true; //For lvl 30 or above, each lvlup grants player 1 perfect pitch.
|
||||
public static final int FAME_GAIN_BY_QUEST = 4; //Fame gain each N quest completes, set 0 to disable.
|
||||
public static final int SCROLL_CHANCE_RATE = 10; //Number of rolls for success on a scroll, set 0 for default.
|
||||
|
||||
//Equipment Configuration
|
||||
public static final boolean USE_EQUIPMNT_LVLUP_SLOTS = true;//Equips can upgrade slots at level up.
|
||||
public static final boolean USE_EQUIPMNT_LVLUP_POWER = true;//Enable more powerful stats upgrades at equip level up.
|
||||
public static final boolean USE_SPIKES_AVOID_BANISH = true; //Shoes equipped with spikes blocks mobs from banishing wearer.
|
||||
@@ -80,8 +98,6 @@ public class ServerConstants {
|
||||
public static final int USE_EQUIPMNT_LVLUP = 7; //All equips lvlup at max level of N, set 1 to disable.
|
||||
public static final byte CHAIR_EXTRA_HEAL_HP = 70; //Each chair extra heal proc increasing HP.
|
||||
public static final byte CHAIR_EXTRA_HEAL_MP = 42; //Each chair extra heal proc increasing MP.
|
||||
public static final int FAME_GAIN_BY_QUEST = 4; //Fame gain each N quest completes, set 0 to disable.
|
||||
public static final int SCROLL_CHANCE_RATE = 10; //Number of rolls for success on a scroll, set 0 for default.
|
||||
|
||||
//Pet Auto-Pot Recovery Rates
|
||||
public static final double PET_AUTOHP_RATIO = 0.99; //Will automatically consume potions until given ratio of the MaxHP/MaxMP is reached.
|
||||
@@ -89,20 +105,13 @@ public class ServerConstants {
|
||||
|
||||
//Dojo Configuration
|
||||
public static final boolean USE_DEADLY_DOJO = false; //Should bosses really use 1HP,1MP attacks in dojo?
|
||||
public static final int DOJO_ENERGY_ATK = 100; //Dojo energy gain when deal attack
|
||||
public static final int DOJO_ENERGY_DMG = 20; //Dojo energy gain when recv attack
|
||||
|
||||
//Pet Hungry Configuration
|
||||
//Pet Hunger Configuration
|
||||
public static final boolean PETS_NEVER_HUNGRY = false; //If true, pets and mounts will never grow hungry.
|
||||
public static final boolean GM_PETS_NEVER_HUNGRY = true; //If true, pets and mounts owned by GMs will never grow hungry.
|
||||
|
||||
//Rates And Experience
|
||||
public static final int EXP_RATE = 10;
|
||||
public static final int MESO_RATE = 10;
|
||||
public static final int DROP_RATE = 10;
|
||||
public static final int BOSS_DROP_RATE = 20;
|
||||
public static final int PARTY_EXPERIENCE_MOD = 1; //Change for event stuff.
|
||||
public static final double EQUIP_EXPERIENCE_MOD = 10.0; //Rate for equipment exp needed, grows linearly. Set 1.0 for default (about 100~200 same-level range mobs killed to pass equip from level 1 to 2).
|
||||
public static final double PQ_BONUS_EXP_MOD = 0.5;
|
||||
|
||||
//Event End Timestamp
|
||||
public static final long EVENT_END_TIMESTAMP = 1428897600000L;
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public class Beginner {
|
||||
public static final int ECHO_OF_HERO = 1005;
|
||||
public static final int BAMBOO_RAIN = 1009;
|
||||
public static final int INVINCIBLE_BARRIER = 1010;
|
||||
public static final int BERSERK_FURY = 1011;
|
||||
public static final int POWER_EXPLOSION = 1011;
|
||||
public static final int SPACESHIP = 1013;
|
||||
public static final int SPACE_DASH = 1014;
|
||||
public static final int YETI_MOUNT1 = 1017;
|
||||
|
||||
@@ -13,7 +13,7 @@ public class Evan {
|
||||
public static final int MAKER = 20011007;
|
||||
public static final int BAMBOO_THRUST = 20011009;
|
||||
public static final int INVINCIBLE_BARRIER = 20011010;
|
||||
public static final int BERSERK_FURY = 20011011;
|
||||
public static final int POWER_EXPLOSION = 20011011;
|
||||
// EVAN2
|
||||
public static final int DRAGON_SOUL = 22000000;
|
||||
public static final int MAGIC_MISSILE = 22001001;
|
||||
|
||||
@@ -35,7 +35,8 @@ public class Legend {
|
||||
public static final int JUMP_DOWN = 20001006;
|
||||
public static final int MAKER = 20001007;
|
||||
public static final int BAMBOO_THRUST = 20001009;
|
||||
public static final int INVICIBLE_BARRIER = 20001010;
|
||||
public static final int INVICIBLE_BARRIER = 20001010;
|
||||
public static final int POWER_EXPLOSION = 20011011;
|
||||
public static final int METEO_SHOWER = 20001011;
|
||||
public static final int BLESSING_OF_THE_FAIRY = 20000012;
|
||||
public static final int TUTORIAL_SKILL1 = 20000014;
|
||||
|
||||
@@ -35,7 +35,7 @@ public class Noblesse {
|
||||
public static final int MAKER = 10001007;
|
||||
public static final int BAMBOO_RAIN = 10001009;
|
||||
public static final int INVINCIBLE_BARRIER = 10001010;
|
||||
public static final int BERSERK_FURY = 10001011;
|
||||
public static final int POWER_EXPLOSION = 10001011;
|
||||
public static final int SPACESHIP = 1001014;
|
||||
public static final int SPACE_DASH = 1001015;
|
||||
public static final int YETI_MOUNT1 = 10001019;
|
||||
|
||||
@@ -68,6 +68,14 @@ public final class CloseRangeDamageHandler extends AbstractDealDamageHandler {
|
||||
}
|
||||
}
|
||||
|
||||
if (c.getPlayer().getDojoEnergy() < 10000 && (attack.skill == 1009 || attack.skill == 10001009 || attack.skill == 20001009)) // PE hacking or maybe just lagging
|
||||
return;
|
||||
if (player.getMap().isDojoMap() && attack.numAttacked > 0) {
|
||||
player.setDojoEnergy(player.getDojoEnergy() + ServerConstants.DOJO_ENERGY_ATK);
|
||||
c.announce(MaplePacketCreator.getEnergy("energy", player.getDojoEnergy()));
|
||||
System.out.println("gauge " + player.getDojoEnergy());
|
||||
}
|
||||
|
||||
player.getMap().broadcastMessage(player, MaplePacketCreator.closeRangeAttack(player, attack.skill, attack.skilllevel, attack.stance, attack.numAttackedAndDamage, attack.allDamage, attack.speed, attack.direction, attack.display), false, true);
|
||||
int numFinisherOrbs = 0;
|
||||
Integer comboBuff = player.getBuffedValue(MapleBuffStat.COMBO);
|
||||
@@ -152,7 +160,16 @@ public final class CloseRangeDamageHandler extends AbstractDealDamageHandler {
|
||||
if (numFinisherOrbs == 0 && GameConstants.isFinisherSkill(attack.skill)) {
|
||||
return;
|
||||
}
|
||||
if (attack.skill > 0) {
|
||||
if (attack.skill % 10000000 == 1009) { // bamboo
|
||||
if (c.getPlayer().getDojoEnergy() < 10000) { // PE hacking or maybe just lagging
|
||||
return;
|
||||
}
|
||||
|
||||
player.setDojoEnergy(0);
|
||||
c.announce(MaplePacketCreator.getEnergy("energy", player.getDojoEnergy()));
|
||||
c.announce(MaplePacketCreator.serverNotice(5, "As you used the secret skill, your energy bar has been reset."));
|
||||
System.out.println("gauge " + player.getDojoEnergy());
|
||||
} else if (attack.skill > 0) {
|
||||
Skill skill = SkillFactory.getSkill(attack.skill);
|
||||
MapleStatEffect effect_ = skill.getEffect(player.getSkillLevel(skill));
|
||||
if (effect_.getCooldown() > 0) {
|
||||
|
||||
@@ -31,6 +31,7 @@ import client.MapleCharacter.CancelCooldownAction;
|
||||
import client.MapleClient;
|
||||
import client.Skill;
|
||||
import client.SkillFactory;
|
||||
import constants.ServerConstants;
|
||||
import constants.skills.Bishop;
|
||||
import constants.skills.Evan;
|
||||
import constants.skills.FPArchMage;
|
||||
@@ -49,7 +50,7 @@ public final class MagicDamageHandler extends AbstractDealDamageHandler {
|
||||
player.getAutobanManager().spam(8);*/
|
||||
|
||||
AttackInfo attack = parseDamage(slea, player, false, true);
|
||||
|
||||
|
||||
if (player.getBuffEffect(MapleBuffStat.MORPH) != null) {
|
||||
if(player.getBuffEffect(MapleBuffStat.MORPH).isMorphWithoutAttack()) {
|
||||
// How are they attacking when the client won't let them?
|
||||
@@ -57,6 +58,12 @@ public final class MagicDamageHandler extends AbstractDealDamageHandler {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (player.getMap().isDojoMap() && attack.numAttacked > 0) {
|
||||
player.setDojoEnergy(player.getDojoEnergy() + + ServerConstants.DOJO_ENERGY_ATK);
|
||||
c.announce(MaplePacketCreator.getEnergy("energy", player.getDojoEnergy()));
|
||||
System.out.println("gauge " + player.getDojoEnergy());
|
||||
}
|
||||
|
||||
int charge = (attack.skill == Evan.FIRE_BREATH || attack.skill == Evan.ICE_BREATH || attack.skill == FPArchMage.BIG_BANG || attack.skill == ILArchMage.BIG_BANG || attack.skill == Bishop.BIG_BANG) ? attack.charge : -1;
|
||||
byte[] packet = MaplePacketCreator.magicAttack(player, attack.skill, attack.skilllevel, attack.stance, attack.numAttackedAndDamage, attack.allDamage, charge, attack.speed, attack.direction, attack.display);
|
||||
|
||||
@@ -60,6 +60,7 @@ public final class PetCommandHandler extends AbstractMaplePacketHandler {
|
||||
}
|
||||
else {
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.commandResponse(chr.getId(), petIndex, command, false));
|
||||
if(chr.getMount() != null) chr.getMap().broadcastMessage(MaplePacketCreator.updateMount(chr.getId(), chr.getMount(), false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ import client.inventory.MapleInventory;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.MapleWeaponType;
|
||||
import constants.ItemConstants;
|
||||
import constants.ServerConstants;
|
||||
import constants.skills.Aran;
|
||||
import constants.skills.Buccaneer;
|
||||
import constants.skills.NightLord;
|
||||
@@ -70,6 +71,12 @@ public final class RangedAttackHandler extends AbstractDealDamageHandler {
|
||||
}
|
||||
}
|
||||
|
||||
if (player.getMap().isDojoMap() && attack.numAttacked > 0) {
|
||||
player.setDojoEnergy(player.getDojoEnergy() + ServerConstants.DOJO_ENERGY_ATK);
|
||||
c.announce(MaplePacketCreator.getEnergy("energy", player.getDojoEnergy()));
|
||||
System.out.println("gauge " + player.getDojoEnergy());
|
||||
}
|
||||
|
||||
if (attack.skill == Buccaneer.ENERGY_ORB || attack.skill == ThunderBreaker.SPARK || attack.skill == Shadower.TAUNT || attack.skill == NightLord.TAUNT) {
|
||||
player.getMap().broadcastMessage(player, MaplePacketCreator.rangedAttack(player, attack.skill, attack.skilllevel, attack.stance, attack.numAttackedAndDamage, 0, attack.allDamage, attack.speed, attack.direction, attack.display), false);
|
||||
applyAttack(attack, player, 1);
|
||||
|
||||
@@ -66,19 +66,11 @@ public final class SpawnPetHandler extends AbstractMaplePacketHandler {
|
||||
if (petId == -1) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Connection con = DatabaseConnection.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM pets WHERE `petid` = ?");
|
||||
ps.setInt(1, pet.getUniqueId());
|
||||
ps.executeUpdate();
|
||||
ps.close();
|
||||
con.close();
|
||||
} catch (SQLException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
long expiration = chr.getInventory(MapleInventoryType.CASH).getItem(slot).getExpiration();
|
||||
MapleInventoryManipulator.removeById(c, MapleInventoryType.CASH, petid, (short) 1, false, false);
|
||||
MapleInventoryManipulator.addById(c, evolveid, (short) 1, null, petId, expiration);
|
||||
pet.deleteFromDb();
|
||||
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -69,9 +69,13 @@ public final class SpecialMoveHandler extends AbstractMaplePacketHandler {
|
||||
Skill skill = SkillFactory.getSkill(skillid);
|
||||
int skillLevel = chr.getSkillLevel(skill);
|
||||
if (skillid % 10000000 == 1010 || skillid % 10000000 == 1011) {
|
||||
if (c.getPlayer().getDojoEnergy() < 10000) { // PE hacking or maybe just lagging
|
||||
return;
|
||||
}
|
||||
skillLevel = 1;
|
||||
chr.setDojoEnergy(0);
|
||||
c.announce(MaplePacketCreator.getEnergy("energy", 0));
|
||||
c.getPlayer().setDojoEnergy(0);
|
||||
c.announce(MaplePacketCreator.getEnergy("energy", c.getPlayer().getDojoEnergy()));
|
||||
c.announce(MaplePacketCreator.serverNotice(5, "As you used the secret skill, your energy bar has been reset."));
|
||||
}
|
||||
if (skillLevel == 0 || skillLevel != __skillLevel) return;
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import client.inventory.Item;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.status.MonsterStatus;
|
||||
import client.status.MonsterStatusEffect;
|
||||
import constants.GameConstants;
|
||||
import constants.ServerConstants;
|
||||
import constants.skills.Aran;
|
||||
import constants.skills.Corsair;
|
||||
@@ -232,9 +233,10 @@ public final class TakeDamageHandler extends AbstractMaplePacketHandler {
|
||||
map.broadcastGMMessage(player, MaplePacketCreator.damagePlayer(damagefrom, monsteridfrom, player.getId(), damage, fake, direction, is_pgmr, pgmr, is_pg, oid, pos_x, pos_y), false);
|
||||
player.checkBerserk(false);
|
||||
}
|
||||
if (map.getId() >= 925020000 && map.getId() < 925030000) {
|
||||
player.setDojoEnergy(player.isGM() ? 300 : player.getDojoEnergy() < 300 ? player.getDojoEnergy() + 1 : 0); //Fking gm's
|
||||
player.getClient().announce(MaplePacketCreator.getEnergy("energy", player.getDojoEnergy()));
|
||||
if (GameConstants.isDojo(map.getId())) {
|
||||
player.setDojoEnergy(player.getDojoEnergy() + ServerConstants.DOJO_ENERGY_DMG);
|
||||
c.announce(MaplePacketCreator.getEnergy("energy", player.getDojoEnergy()));
|
||||
System.out.println("gauge " + player.getDojoEnergy());
|
||||
}
|
||||
|
||||
for (MapleCharacter chr : banishPlayers) { // chill, if this list ever gets non-empty an attacker does exist, trust me :)
|
||||
|
||||
@@ -431,7 +431,7 @@ public class AbstractPlayerInteraction {
|
||||
evolved.setStance(0);
|
||||
evolved.setSummoned(true);
|
||||
|
||||
evolved.setName(from.getName());
|
||||
evolved.setName(from.getName().compareTo(MapleItemInformationProvider.getInstance().getName(from.getItemId())) != 0 ? from.getName() : MapleItemInformationProvider.getInstance().getName(id));
|
||||
evolved.setCloseness(from.getCloseness());
|
||||
evolved.setFullness(from.getFullness());
|
||||
evolved.setLevel(from.getLevel());
|
||||
|
||||
@@ -336,11 +336,6 @@ public class MapleStatEffect {
|
||||
case Legend.BALROG_MOUNT:
|
||||
statups.add(new Pair<>(MapleBuffStat.MONSTER_RIDING, Integer.valueOf(sourceid)));
|
||||
break;
|
||||
case Beginner.BERSERK_FURY:
|
||||
case Noblesse.BERSERK_FURY:
|
||||
case Evan.BERSERK_FURY:
|
||||
statups.add(new Pair<>(MapleBuffStat.BERSERK_FURY, Integer.valueOf(1)));
|
||||
break;
|
||||
case Beginner.INVINCIBLE_BARRIER:
|
||||
case Noblesse.INVINCIBLE_BARRIER:
|
||||
case Legend.INVICIBLE_BARRIER:
|
||||
@@ -520,6 +515,9 @@ public class MapleStatEffect {
|
||||
case NightWalker.CLAW_BOOSTER:
|
||||
case ThunderBreaker.KNUCKLER_BOOSTER:
|
||||
case Evan.MAGIC_BOOSTER:
|
||||
case Beginner.POWER_EXPLOSION:
|
||||
case Noblesse.POWER_EXPLOSION:
|
||||
case Legend.POWER_EXPLOSION:
|
||||
statups.add(new Pair<>(MapleBuffStat.BOOSTER, Integer.valueOf(x)));
|
||||
break;
|
||||
case Hero.MAPLE_WARRIOR:
|
||||
|
||||
@@ -29,6 +29,7 @@ import java.util.List;
|
||||
import client.MapleCharacter;
|
||||
import client.MapleDisease;
|
||||
import client.status.MonsterStatus;
|
||||
import constants.GameConstants;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
import tools.Randomizer;
|
||||
@@ -224,53 +225,56 @@ public class MobSkill {
|
||||
if (monster.getMap().getSpawnedMonstersOnMap() < 80) {
|
||||
for (Integer mobId : getSummons()) {
|
||||
MapleMonster toSpawn = MapleLifeFactory.getMonster(mobId);
|
||||
toSpawn.setPosition(monster.getPosition());
|
||||
int ypos, xpos;
|
||||
xpos = (int) monster.getPosition().getX();
|
||||
ypos = (int) monster.getPosition().getY();
|
||||
switch (mobId) {
|
||||
case 8500003: // Pap bomb high
|
||||
toSpawn.setFh((int) Math.ceil(Math.random() * 19.0));
|
||||
ypos = -590;
|
||||
break;
|
||||
case 8500004: // Pap bomb
|
||||
xpos = (int) (monster.getPosition().getX() + Randomizer.nextInt(1000) - 500);
|
||||
if (ypos != -590) {
|
||||
ypos = (int) monster.getPosition().getY();
|
||||
}
|
||||
break;
|
||||
case 8510100: //Pianus bomb
|
||||
if (Math.ceil(Math.random() * 5) == 1) {
|
||||
ypos = 78;
|
||||
xpos = (int) Randomizer.nextInt(5) + (Randomizer.nextInt(2) == 1 ? 180 : 0);
|
||||
} else {
|
||||
if(toSpawn != null) {
|
||||
if(GameConstants.isBossRush(monster.getMap().getId())) toSpawn.disableDrops(); // no littering on BRPQ pls
|
||||
|
||||
toSpawn.setPosition(monster.getPosition());
|
||||
int ypos, xpos;
|
||||
xpos = (int) monster.getPosition().getX();
|
||||
ypos = (int) monster.getPosition().getY();
|
||||
switch (mobId) {
|
||||
case 8500003: // Pap bomb high
|
||||
toSpawn.setFh((int) Math.ceil(Math.random() * 19.0));
|
||||
ypos = -590;
|
||||
break;
|
||||
case 8500004: // Pap bomb
|
||||
xpos = (int) (monster.getPosition().getX() + Randomizer.nextInt(1000) - 500);
|
||||
}
|
||||
break;
|
||||
if (ypos != -590) {
|
||||
ypos = (int) monster.getPosition().getY();
|
||||
}
|
||||
break;
|
||||
case 8510100: //Pianus bomb
|
||||
if (Math.ceil(Math.random() * 5) == 1) {
|
||||
ypos = 78;
|
||||
xpos = (int) Randomizer.nextInt(5) + (Randomizer.nextInt(2) == 1 ? 180 : 0);
|
||||
} else {
|
||||
xpos = (int) (monster.getPosition().getX() + Randomizer.nextInt(1000) - 500);
|
||||
}
|
||||
break;
|
||||
}
|
||||
switch (monster.getMap().getId()) {
|
||||
case 220080001: //Pap map
|
||||
if (xpos < -890) {
|
||||
xpos = (int) (Math.ceil(Math.random() * 150) - 890);
|
||||
} else if (xpos > 230) {
|
||||
xpos = (int) (230 - Math.ceil(Math.random() * 150));
|
||||
}
|
||||
break;
|
||||
case 230040420: // Pianus map
|
||||
if (xpos < -239) {
|
||||
xpos = (int) (Math.ceil(Math.random() * 150) - 239);
|
||||
} else if (xpos > 371) {
|
||||
xpos = (int) (371 - Math.ceil(Math.random() * 150));
|
||||
}
|
||||
break;
|
||||
}
|
||||
toSpawn.setPosition(new Point(xpos, ypos));
|
||||
if (toSpawn.getId() == 8500004) {
|
||||
monster.getMap().spawnFakeMonster(toSpawn);
|
||||
} else {
|
||||
monster.getMap().spawnMonsterWithEffect(toSpawn, getSpawnEffect(), toSpawn.getPosition());
|
||||
}
|
||||
}
|
||||
switch (monster.getMap().getId()) {
|
||||
case 220080001: //Pap map
|
||||
if (xpos < -890) {
|
||||
xpos = (int) (Math.ceil(Math.random() * 150) - 890);
|
||||
} else if (xpos > 230) {
|
||||
xpos = (int) (230 - Math.ceil(Math.random() * 150));
|
||||
}
|
||||
break;
|
||||
case 230040420: // Pianus map
|
||||
if (xpos < -239) {
|
||||
xpos = (int) (Math.ceil(Math.random() * 150) - 239);
|
||||
} else if (xpos > 371) {
|
||||
xpos = (int) (371 - Math.ceil(Math.random() * 150));
|
||||
}
|
||||
break;
|
||||
}
|
||||
toSpawn.setPosition(new Point(xpos, ypos));
|
||||
if (toSpawn.getId() == 8500004) {
|
||||
monster.getMap().spawnFakeMonster(toSpawn);
|
||||
} else {
|
||||
monster.getMap().spawnMonsterWithEffect(toSpawn, getSpawnEffect(), toSpawn.getPosition());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -3,12 +3,8 @@ package tools;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Properties;
|
||||
import org.apache.commons.dbcp2.ConnectionFactory;
|
||||
import org.apache.commons.dbcp2.DriverManagerConnectionFactory;
|
||||
import org.apache.commons.dbcp2.PoolableConnectionFactory;
|
||||
import org.apache.commons.dbcp2.PoolingDriver;
|
||||
import org.apache.commons.pool2.impl.GenericObjectPool;
|
||||
import com.zaxxer.hikari.HikariConfig;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
|
||||
import constants.ServerConstants;
|
||||
|
||||
@@ -18,74 +14,43 @@ import constants.ServerConstants;
|
||||
* @author Ronan (some connection pool to this beautiful code)
|
||||
*/
|
||||
public class DatabaseConnection {
|
||||
private static Properties prop;
|
||||
private static HikariDataSource ds;
|
||||
|
||||
public static Connection getConnection() throws SQLException {
|
||||
if(prop != null) {
|
||||
Connection con = null;
|
||||
while(con == null) { //oh yes, this will loop until success!
|
||||
try {
|
||||
con = DriverManager.getConnection(ServerConstants.DB_URL, prop);
|
||||
} catch (SQLException sqle) {}
|
||||
}
|
||||
|
||||
return con;
|
||||
if(ds != null) {
|
||||
return ds.getConnection();
|
||||
} else {
|
||||
return DriverManager.getConnection(ServerConstants.DB_URL, ServerConstants.DB_USER, ServerConstants.DB_PASS);
|
||||
}
|
||||
}
|
||||
|
||||
private static Properties getProperties() {
|
||||
Properties connectionProperties = new Properties();
|
||||
connectionProperties.put("user", ServerConstants.DB_USER);
|
||||
connectionProperties.put("password", ServerConstants.DB_PASS);
|
||||
|
||||
connectionProperties.put("minIdle", "-1");
|
||||
connectionProperties.put("maxIdle", "-1");
|
||||
|
||||
connectionProperties.put("testOnBorrow", "true");
|
||||
connectionProperties.put("lifo", "false");
|
||||
|
||||
connectionProperties.put("maxTotal", "42"); //max allotted connections
|
||||
connectionProperties.put("maxConnLifetimeMillis", "60000"); //connection remains valid for 1 min
|
||||
connectionProperties.put("maxWaitMillis", "777"); //there are more pools, if this one is unavailable then pass to another already
|
||||
connectionProperties.put("poolPreparedStatements", "true");
|
||||
connectionProperties.put("maxOpenPreparedStatements", "100"); //max allotted PS
|
||||
|
||||
return connectionProperties;
|
||||
}
|
||||
|
||||
private PoolingDriver installDriver(short id) {
|
||||
GenericObjectPool connectionPool = new GenericObjectPool(null);
|
||||
ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(ServerConstants.DB_URL, prop);
|
||||
PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory,connectionPool.getJmxName());
|
||||
PoolingDriver driver = new PoolingDriver();
|
||||
driver.registerPool("maplesolaxiapool" + id, connectionPool);
|
||||
|
||||
return driver;
|
||||
}
|
||||
|
||||
public DatabaseConnection() {
|
||||
prop = null;
|
||||
ds = null;
|
||||
|
||||
try {
|
||||
Class.forName("com.mysql.jdbc.Driver"); // touch the mysql driver
|
||||
} catch (ClassNotFoundException e) {
|
||||
System.out.println("[SEVERE] SQL Driver Not Found. Consider death by clams.");
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
if(ServerConstants.DB_EXPERIMENTAL_POOLS > 0) {
|
||||
if(ServerConstants.DB_EXPERIMENTAL_POOL) {
|
||||
// Connection Pool on database ftw!
|
||||
|
||||
prop = getProperties();
|
||||
HikariConfig config = new HikariConfig();
|
||||
config.setJdbcUrl(ServerConstants.DB_URL);
|
||||
|
||||
config.setUsername(ServerConstants.DB_USER);
|
||||
config.setPassword(ServerConstants.DB_PASS);
|
||||
|
||||
config.addDataSourceProperty("connectionTimeout", "30000");
|
||||
config.addDataSourceProperty("maximumPoolSize", "100");
|
||||
|
||||
config.addDataSourceProperty("cachePrepStmts", "true");
|
||||
config.addDataSourceProperty("prepStmtCacheSize", "250");
|
||||
config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
|
||||
|
||||
ds = new HikariDataSource(config);
|
||||
} else {
|
||||
try {
|
||||
for(short i = 0; i < ServerConstants.DB_EXPERIMENTAL_POOLS; i++) {
|
||||
DriverManager.registerDriver(installDriver(i));
|
||||
}
|
||||
} catch(SQLException sqle) {
|
||||
sqle.printStackTrace();
|
||||
Class.forName("com.mysql.jdbc.Driver"); // touch the mysql driver
|
||||
} catch (ClassNotFoundException e) {
|
||||
System.out.println("[SEVERE] SQL Driver Not Found. Consider death by clams.");
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user