Medal quest system tweak + Proximity check on quests + DB leak fix
Rebalanced the EXTREMELY low level section of the equipment level up system. Added support code for quests on Kerning Square and Mushroom Castle. Added quest scripts for many missing scripted quests. Refactored medal quests, now using a default script system for uncoded medal questid's. Fixed a DB leak regarding quest status and medal maps tables. Added proximity check for NPCs to start/complete quests that doesn't use the lightbulb system. Added "debuff" command, that debuffs people nearby.
This commit is contained in:
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
This file is part of the OdinMS Maple Story Server
|
||||
Copyright (C) 2008 ~ 2010 Patrick Huy <patrick.huy@frz.cc>
|
||||
Matthias Butz <matze@odinms.de>
|
||||
Jan Christian Meyer <vimes@odinms.de>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License version 3
|
||||
as published by the Free Software Foundation. You may not use, modify
|
||||
or distribute this program under any other version of the
|
||||
GNU Affero General Public License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package client;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author anybody can do this
|
||||
*/
|
||||
public class DiseaseValueHolder {
|
||||
public long startTime, length;
|
||||
|
||||
public DiseaseValueHolder(long start, long length) {
|
||||
this.startTime = start;
|
||||
this.length = length;
|
||||
}
|
||||
}
|
||||
@@ -1850,25 +1850,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
}
|
||||
}
|
||||
|
||||
try (PreparedStatement ps = con.prepareStatement("SELECT queststatusid FROM queststatus WHERE characterid = ?")) {
|
||||
ps.setInt(1, cid);
|
||||
|
||||
try (ResultSet rs = ps.executeQuery()) {
|
||||
while (rs.next()) {
|
||||
int queststatusid = rs.getInt("queststatusid");
|
||||
|
||||
try (PreparedStatement ps2 = con.prepareStatement("DELETE FROM medalmaps WHERE queststatusid = ?")) {
|
||||
ps2.setInt(1, queststatusid);
|
||||
ps2.executeUpdate();
|
||||
}
|
||||
|
||||
try (PreparedStatement ps2 = con.prepareStatement("DELETE FROM questprogress WHERE queststatusid = ?")) {
|
||||
ps2.setInt(1, queststatusid);
|
||||
ps2.executeUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
deleteQuestProgressWhereCharacterId(con, cid);
|
||||
|
||||
try (PreparedStatement ps = con.prepareStatement("SELECT id FROM mts_cart WHERE cid = ?")) {
|
||||
ps.setInt(1, cid);
|
||||
@@ -1902,6 +1884,28 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static void deleteQuestProgressWhereCharacterId(Connection con, int cid) throws SQLException {
|
||||
try (PreparedStatement ps = con.prepareStatement("SELECT queststatusid FROM queststatus WHERE characterid = ?")) {
|
||||
ps.setInt(1, cid);
|
||||
|
||||
try (ResultSet rs = ps.executeQuery()) {
|
||||
while (rs.next()) {
|
||||
int queststatusid = rs.getInt("queststatusid");
|
||||
|
||||
try (PreparedStatement ps2 = con.prepareStatement("DELETE FROM medalmaps WHERE queststatusid = ?")) {
|
||||
ps2.setInt(1, queststatusid);
|
||||
ps2.executeUpdate();
|
||||
}
|
||||
|
||||
try (PreparedStatement ps2 = con.prepareStatement("DELETE FROM questprogress WHERE queststatusid = ?")) {
|
||||
ps2.setInt(1, queststatusid);
|
||||
ps2.executeUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteWhereCharacterId(Connection con, String sql) throws SQLException {
|
||||
try (PreparedStatement ps = con.prepareStatement(sql)) {
|
||||
@@ -2744,6 +2748,17 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasBuffFromSourceid(int sourceid) {
|
||||
effLock.lock();
|
||||
chrLock.lock();
|
||||
try {
|
||||
return buffEffects.containsKey(sourceid);
|
||||
} finally {
|
||||
chrLock.unlock();
|
||||
effLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
private List<Pair<MapleBuffStat, Integer>> getActiveStatupsFromSourceid(int sourceid) { // already under effLock & chrLock
|
||||
List<Pair<MapleBuffStat, Integer>> ret = new ArrayList<>();
|
||||
|
||||
@@ -5084,7 +5099,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
} else if (level == 25) {
|
||||
yellowMessage("You seem to be improving, but you are still not ready to move on to the next step.");
|
||||
} else if (level == 30) {
|
||||
yellowMessage("You have finally reached level 30! Try job advancing, after that try the Mushroom Kingdom!");
|
||||
yellowMessage("You have finally reached level 30! Try job advancing, after that try the Mushroom Castle!");
|
||||
} else if (level == 35) {
|
||||
yellowMessage("Hey did you hear about this mall that opened in Kerning? Try visiting the Kerning Mall.");
|
||||
} else if (level == 40) {
|
||||
@@ -6644,7 +6659,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
}
|
||||
ps.executeBatch();
|
||||
deleteWhereCharacterId(con, "DELETE FROM eventstats WHERE characterid = ?");
|
||||
deleteWhereCharacterId(con, "DELETE FROM queststatus WHERE characterid = ?");
|
||||
|
||||
deleteQuestProgressWhereCharacterId(con, id);
|
||||
ps = con.prepareStatement("INSERT INTO queststatus (`queststatusid`, `characterid`, `quest`, `status`, `time`, `expires`, `forfeited`) VALUES (DEFAULT, ?, ?, ?, ?, ?, ?)", Statement.RETURN_GENERATED_KEYS);
|
||||
PreparedStatement psf;
|
||||
try (PreparedStatement pse = con.prepareStatement("INSERT INTO questprogress VALUES (DEFAULT, ?, ?, ?)")) {
|
||||
@@ -7556,7 +7572,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
announce(MaplePacketCreator.updateQuestInfo((short) quest.getQuest().getId(), quest.getNpc()));
|
||||
} else if (quest.getStatus().equals(MapleQuestStatus.Status.COMPLETED)) {
|
||||
short questid = quest.getQuest().getId();
|
||||
if(questid != 3637) {
|
||||
if(!MapleQuest.isExploitableQuest(questid)) {
|
||||
quest_fame += 1;
|
||||
if(ServerConstants.FAME_GAIN_BY_QUEST > 0)
|
||||
fameGainByQuest();
|
||||
|
||||
@@ -68,6 +68,8 @@ import server.life.MapleLifeFactory;
|
||||
import server.life.MapleMonster;
|
||||
import server.life.MapleMonsterInformationProvider;
|
||||
import server.life.MapleNPC;
|
||||
import server.life.MobSkill;
|
||||
import server.life.MobSkillFactory;
|
||||
import server.life.MonsterDropEntry;
|
||||
import server.maps.MapleMap;
|
||||
import server.maps.MapleMapItem;
|
||||
@@ -89,6 +91,7 @@ import tools.data.output.MaplePacketLittleEndianWriter;
|
||||
import client.MapleBuffStat;
|
||||
import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.MapleDisease;
|
||||
import client.MapleJob;
|
||||
import client.MapleStat;
|
||||
import client.Skill;
|
||||
@@ -743,14 +746,9 @@ public class Commands {
|
||||
break;
|
||||
}
|
||||
c.announce(MaplePacketCreator.getNPCTalk(9010000, (byte) 0, output, "00 00", (byte) 0));
|
||||
break;
|
||||
break;
|
||||
|
||||
case "buffme":
|
||||
if(!player.isGM()) {
|
||||
player.dropMessage(5, "You are already dead.");
|
||||
break;
|
||||
}
|
||||
|
||||
//GM Skills : Haste(Super) - Holy Symbol - Bless - Hyper Body - Echo of Hero
|
||||
SkillFactory.getSkill(4101004).getEffect(SkillFactory.getSkill(4101004).getMaxLevel()).applyTo(player);
|
||||
SkillFactory.getSkill(2311003).getEffect(SkillFactory.getSkill(2311003).getMaxLevel()).applyTo(player);
|
||||
@@ -1572,6 +1570,81 @@ public class Commands {
|
||||
MapleCharacter victim;
|
||||
|
||||
switch(sub[0]) {
|
||||
case "debuff":
|
||||
if (sub.length < 2) {
|
||||
player.yellowMessage("Syntax: !debuff SLOW|SEDUCE|ZOMBIFY|CONFUSE|STUN|POISON|SEAL|DARKNESS|WEAKEN|CURSE");
|
||||
break;
|
||||
}
|
||||
|
||||
MapleDisease disease = null;
|
||||
MobSkill skill = null;
|
||||
|
||||
switch(sub[1].toUpperCase()) {
|
||||
case "SLOW":
|
||||
disease = MapleDisease.SLOW;
|
||||
skill = MobSkillFactory.getMobSkill(126, 7);
|
||||
break;
|
||||
|
||||
case "SEDUCE":
|
||||
disease = MapleDisease.SEDUCE;
|
||||
skill = MobSkillFactory.getMobSkill(128, 7);
|
||||
break;
|
||||
|
||||
case "ZOMBIFY":
|
||||
disease = MapleDisease.ZOMBIFY;
|
||||
skill = MobSkillFactory.getMobSkill(133, 1);
|
||||
break;
|
||||
|
||||
case "CONFUSE":
|
||||
disease = MapleDisease.CONFUSE;
|
||||
skill = MobSkillFactory.getMobSkill(132, 2);
|
||||
break;
|
||||
|
||||
case "STUN":
|
||||
disease = MapleDisease.STUN;
|
||||
skill = MobSkillFactory.getMobSkill(123, 7);
|
||||
break;
|
||||
|
||||
case "POISON":
|
||||
disease = MapleDisease.POISON;
|
||||
skill = MobSkillFactory.getMobSkill(125, 5);
|
||||
break;
|
||||
|
||||
case "SEAL":
|
||||
disease = MapleDisease.SEAL;
|
||||
skill = MobSkillFactory.getMobSkill(120, 1);
|
||||
break;
|
||||
|
||||
case "DARKNESS":
|
||||
disease = MapleDisease.DARKNESS;
|
||||
skill = MobSkillFactory.getMobSkill(121, 1);
|
||||
break;
|
||||
|
||||
case "WEAKEN":
|
||||
disease = MapleDisease.WEAKEN;
|
||||
skill = MobSkillFactory.getMobSkill(122, 1);
|
||||
break;
|
||||
|
||||
case "CURSE":
|
||||
disease = MapleDisease.CURSE;
|
||||
skill = MobSkillFactory.getMobSkill(124, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
if(disease == null) {
|
||||
player.yellowMessage("Syntax: !debuff SLOW|SEDUCE|ZOMBIFY|CONFUSE|STUN|POISON|SEAL|DARKNESS|WEAKEN|CURSE");
|
||||
break;
|
||||
}
|
||||
|
||||
for (MapleMapObject mmo : player.getMap().getMapObjectsInRange(player.getPosition(), 1000.0, Arrays.asList(MapleMapObjectType.PLAYER))) {
|
||||
MapleCharacter chr = (MapleCharacter) mmo;
|
||||
|
||||
if(chr.getId() != player.getId()) {
|
||||
chr.giveDebuff(disease, skill);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "fly":
|
||||
if (sub.length < 2) {
|
||||
player.yellowMessage("Syntax: !fly <on/off>");
|
||||
|
||||
@@ -486,7 +486,9 @@ public class Equip extends Item {
|
||||
// Conversion factor between mob exp and equip exp gain. Through many calculations, the expected for equipment levelup
|
||||
// from level 1 to 2 is killing about 100~200 mobs of the same level range, on a 1x EXP rate scenario.
|
||||
|
||||
if(reqLevel >= 78) {
|
||||
if(reqLevel < 5) {
|
||||
return 42;
|
||||
} else if(reqLevel >= 78) {
|
||||
return Math.max((10413.648 * Math.exp(reqLevel * 0.03275)), 15);
|
||||
} else if(reqLevel >= 38) {
|
||||
return Math.max(( 4985.818 * Math.exp(reqLevel * 0.02007)), 15);
|
||||
|
||||
Reference in New Issue
Block a user