Quest & Command tweak + MapleCashDropFetcher + Cash drop tidyup

Solved a possible exploit on starting/completing non-scripted quests.
Added missing drop data for Aran's puppeteer questline.
Moved GM tier level of some commands.
Applied proper synchronization for BuddyList modules.
Issued commands now requires "@" heading for normal players and donators (GM level < 2) and "!" for Jr. GM and above (GM level >= 2).
Added custom feature: a message will be sent to acquaintances of a player (friends, family, guild, spouse) when they change/upgrade jobs.
Removed cash drop entries from the DB.
New tool: MapleCashDropFetcher. Reports on a text file all cash-type drop data on DB.
This commit is contained in:
ronancpl
2018-04-14 13:38:14 -03:00
parent 6d91c79f28
commit 6a63f9d95e
38 changed files with 3472 additions and 1057 deletions

View File

@@ -351,7 +351,7 @@ public class Commands {
case "playercommands":
c.getAbstractPlayerInteraction().openNpc(9201143, "commands");
break;
case "droplimit":
int dropCount = c.getPlayer().getMap().getDroppedItemCount();
if(((float) dropCount) / ServerConstants.ITEM_LIMIT_ON_MAP < 0.75f) {
@@ -402,90 +402,14 @@ public class Commands {
}
break;
}
String output = "The #b" + gachaName + "#k Gachapon contains the following items.\r\n\r\n";
String talkStr = "The #b" + gachaName + "#k Gachapon contains the following items.\r\n\r\n";
for (int i = 0; i < 2; i++){
for (int id : gacha.getItems(i)){
output += "-" + MapleItemInformationProvider.getInstance().getName(id) + "\r\n";
talkStr += "-" + MapleItemInformationProvider.getInstance().getName(id) + "\r\n";
}
}
output += "\r\nPlease keep in mind that there are items that are in all gachapons and are not listed here.";
c.announce(MaplePacketCreator.getNPCTalk(9010000, (byte) 0, output, "00 00", (byte) 0));
break;
case "whatdropsfrom":
if (sub.length < 2) {
player.dropMessage(5, "Please do @whatdropsfrom <monster name>");
break;
}
String monsterName = joinStringFrom(sub, 1);
output = "";
int limit = 3;
Iterator<Pair<Integer, String>> listIterator = MapleMonsterInformationProvider.getMobsIDsFromName(monsterName).iterator();
for (int i = 0; i < limit; i++) {
if(listIterator.hasNext()) {
Pair<Integer, String> data = listIterator.next();
int mobId = data.getLeft();
String mobName = data.getRight();
output += mobName + " drops the following items:\r\n\r\n";
for (MonsterDropEntry drop : MapleMonsterInformationProvider.getInstance().retrieveDrop(mobId)){
try {
String name = MapleItemInformationProvider.getInstance().getName(drop.itemId);
if (name.equals("null") || drop.chance == 0){
continue;
}
float chance = 1000000 / drop.chance / player.getDropRate();
output += "- " + name + " (1/" + (int) chance + ")\r\n";
} catch (Exception ex){
ex.printStackTrace();
continue;
}
}
output += "\r\n";
}
}
c.announce(MaplePacketCreator.getNPCTalk(9010000, (byte) 0, output, "00 00", (byte) 0));
break;
case "whodrops":
if (sub.length < 2) {
player.dropMessage(5, "Please do @whodrops <item name>");
break;
}
String searchString = joinStringFrom(sub, 1);
output = "";
listIterator = MapleItemInformationProvider.getInstance().getItemDataByName(searchString).iterator();
if(listIterator.hasNext()) {
int count = 1;
while(listIterator.hasNext() && count <= 3) {
Pair<Integer, String> data = listIterator.next();
output += "#b" + data.getRight() + "#k is dropped by:\r\n";
try {
Connection con = DatabaseConnection.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT dropperid FROM drop_data WHERE itemid = ? LIMIT 50");
ps.setInt(1, data.getLeft());
ResultSet rs = ps.executeQuery();
while(rs.next()) {
String resultName = MapleMonsterInformationProvider.getMobNameFromID(rs.getInt("dropperid"));
if (resultName != null) {
output += resultName + ", ";
}
}
rs.close();
ps.close();
con.close();
} catch (Exception e) {
player.dropMessage(6, "There was a problem retrieving the required data. Please try again.");
e.printStackTrace();
break;
}
output += "\r\n\r\n";
count++;
}
} else {
player.dropMessage(5, "The item you searched for doesn't exist.");
break;
}
c.announce(MaplePacketCreator.getNPCTalk(9010000, (byte) 0, output, "00 00", (byte) 0));
talkStr += "\r\nPlease keep in mind that there are items that are in all gachapons and are not listed here.";
c.announce(MaplePacketCreator.getNPCTalk(9010000, (byte) 0, talkStr, "00 00", (byte) 0));
break;
case "dispose":
@@ -560,7 +484,7 @@ public class Commands {
player.dropMessage(5, tips[Randomizer.nextInt(tips.length)]);
break;
case "bug":
case "reportbug":
if (sub.length < 2) {
player.dropMessage(5, "Message too short and not sent. Please do @bug <bug>");
@@ -636,30 +560,6 @@ public class Commands {
}
break;
case "bosshp":
for(MapleMonster monster : player.getMap().getMonsters()) {
if(monster != null && monster.isBoss() && monster.getHp() > 0) {
long percent = monster.getHp() * 100L / monster.getMaxHp();
String bar = "[";
for (int i = 0; i < 100; i++){
bar += i < percent ? "|" : ".";
}
bar += "]";
player.yellowMessage(monster.getName() + " (" + monster.getId() + ") has " + percent + "% HP left.");
player.yellowMessage("HP: " + bar);
}
}
break;
case "mobhp":
for(MapleMonster monster : player.getMap().getMonsters()) {
if(monster != null && monster.getHp() > 0) {
player.yellowMessage(monster.getName() + " (" + monster.getId() + ") has " + monster.getHp() + " / " + monster.getMaxHp() + " HP.");
}
}
break;
case "ranks":
PreparedStatement ps = null;
ResultSet rs = null;
@@ -691,6 +591,47 @@ public class Commands {
}
}
break;
// stat autoassigning command credited to HeliosMS dev team
case "str":
case "int":
case "luk":
case "dex":
int amount = (sub.length > 1) ? Integer.parseInt(sub[1]) : player.getRemainingAp();
boolean str = sub[0].equalsIgnoreCase("str");
boolean Int = sub[0].equalsIgnoreCase("int");
boolean luk = sub[0].equalsIgnoreCase("luk");
boolean dex = sub[0].equalsIgnoreCase("dex");
if (amount > 0 && amount <= player.getRemainingAp() && amount <= 32763 || amount < 0 && amount >= -32763 && Math.abs(amount) + player.getRemainingAp() <= 32767) {
if (str && amount + player.getStr() <= 32767 && amount + player.getStr() >= 4) {
player.setStr(player.getStr() + amount);
player.updateSingleStat(MapleStat.STR, player.getStr());
player.setRemainingAp(player.getRemainingAp() - amount);
player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
} else if (Int && amount + player.getInt() <= 32767 && amount + player.getInt() >= 4) {
player.setInt(player.getInt() + amount);
player.updateSingleStat(MapleStat.INT, player.getInt());
player.setRemainingAp(player.getRemainingAp() - amount);
player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
} else if (luk && amount + player.getLuk() <= 32767 && amount + player.getLuk() >= 4) {
player.setLuk(player.getLuk() + amount);
player.updateSingleStat(MapleStat.LUK, player.getLuk());
player.setRemainingAp(player.getRemainingAp() - amount);
player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
} else if (dex && amount + player.getDex() <= 32767 && amount + player.getDex() >= 4) {
player.setDex(player.getDex() + amount);
player.updateSingleStat(MapleStat.DEX, player.getDex());
player.setRemainingAp(player.getRemainingAp() - amount);
player.updateSingleStat(MapleStat.AVAILABLEAP, player.getRemainingAp());
} else {
player.dropMessage("Please make sure the stat you are trying to raise is not over 32,767 or under 4.");
}
} else {
player.dropMessage("Please make sure your AP is not over 32,767 and you have enough to distribute.");
}
break;
default:
return false;
@@ -702,8 +643,113 @@ public class Commands {
public static boolean executeHeavenMsCommandLv1(Channel cserv, Server srv, MapleClient c, String[] sub) { //Donator
MapleCharacter player = c.getPlayer();
switch(sub[0]) {
switch(sub[0]) {
case "bosshp":
for(MapleMonster monster : player.getMap().getMonsters()) {
if(monster != null && monster.isBoss() && monster.getHp() > 0) {
long percent = monster.getHp() * 100L / monster.getMaxHp();
String bar = "[";
for (int i = 0; i < 100; i++){
bar += i < percent ? "|" : ".";
}
bar += "]";
player.yellowMessage(monster.getName() + " (" + monster.getId() + ") has " + percent + "% HP left.");
player.yellowMessage("HP: " + bar);
}
}
break;
case "mobhp":
for(MapleMonster monster : player.getMap().getMonsters()) {
if(monster != null && monster.getHp() > 0) {
player.yellowMessage(monster.getName() + " (" + monster.getId() + ") has " + monster.getHp() + " / " + monster.getMaxHp() + " HP.");
}
}
break;
case "whatdropsfrom":
if (sub.length < 2) {
player.dropMessage(5, "Please do @whatdropsfrom <monster name>");
break;
}
String monsterName = joinStringFrom(sub, 1);
String output = "";
int limit = 3;
Iterator<Pair<Integer, String>> listIterator = MapleMonsterInformationProvider.getMobsIDsFromName(monsterName).iterator();
for (int i = 0; i < limit; i++) {
if(listIterator.hasNext()) {
Pair<Integer, String> data = listIterator.next();
int mobId = data.getLeft();
String mobName = data.getRight();
output += mobName + " drops the following items:\r\n\r\n";
for (MonsterDropEntry drop : MapleMonsterInformationProvider.getInstance().retrieveDrop(mobId)){
try {
String name = MapleItemInformationProvider.getInstance().getName(drop.itemId);
if (name.equals("null") || drop.chance == 0){
continue;
}
float chance = 1000000 / drop.chance / player.getDropRate();
output += "- " + name + " (1/" + (int) chance + ")\r\n";
} catch (Exception ex){
ex.printStackTrace();
continue;
}
}
output += "\r\n";
}
}
c.announce(MaplePacketCreator.getNPCTalk(9010000, (byte) 0, output, "00 00", (byte) 0));
break;
case "whodrops":
if (sub.length < 2) {
player.dropMessage(5, "Please do @whodrops <item name>");
break;
}
String searchString = joinStringFrom(sub, 1);
output = "";
listIterator = MapleItemInformationProvider.getInstance().getItemDataByName(searchString).iterator();
if(listIterator.hasNext()) {
int count = 1;
while(listIterator.hasNext() && count <= 3) {
Pair<Integer, String> data = listIterator.next();
output += "#b" + data.getRight() + "#k is dropped by:\r\n";
try {
Connection con = DatabaseConnection.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT dropperid FROM drop_data WHERE itemid = ? LIMIT 50");
ps.setInt(1, data.getLeft());
ResultSet rs = ps.executeQuery();
while(rs.next()) {
String resultName = MapleMonsterInformationProvider.getMobNameFromID(rs.getInt("dropperid"));
if (resultName != null) {
output += resultName + ", ";
}
}
rs.close();
ps.close();
con.close();
} catch (Exception e) {
player.dropMessage(6, "There was a problem retrieving the required data. Please try again.");
e.printStackTrace();
break;
}
output += "\r\n\r\n";
count++;
}
} else {
player.dropMessage(5, "The item you searched for doesn't exist.");
break;
}
c.announce(MaplePacketCreator.getNPCTalk(9010000, (byte) 0, output, "00 00", (byte) 0));
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);
@@ -753,7 +799,20 @@ public class Commands {
}
player.dropMessage(5, "USE Recharged.");
break;
default:
return false;
}
return true;
}
public static boolean executeHeavenMsCommandLv2(Channel cserv, Server srv, MapleClient c, String[] sub) { //JrGM
MapleCharacter player = c.getPlayer();
MapleCharacter victim;
Skill skill;
switch(sub[0]) {
case "whereami":
player.yellowMessage("Map ID: " + player.getMap().getId());
player.yellowMessage("Players on this map:");
@@ -777,21 +836,8 @@ public class Commands {
}
}
}
break;
default:
return false;
}
return true;
}
public static boolean executeHeavenMsCommandLv2(Channel cserv, Server srv, MapleClient c, String[] sub) { //JrGM
MapleCharacter player = c.getPlayer();
MapleCharacter victim;
Skill skill;
switch(sub[0]) {
break;
case "hide":
SkillFactory.getSkill(9101004).getEffect(SkillFactory.getSkill(9101004).getMaxLevel()).applyTo(player);
break;