Maker-oriented commit

Implemented the multiple features of the Maker skill (equip disassembly, leftover merging into monster crystal and item crafting).
Updated the DB with the Maker data featured on the WZ.
Added a new table for the strenghtening reagents gain data (compiled with the MapleSkillMakerReagentIndexer).
Fixed quests that improves the Maker skill level and some other Maker-related quests.
This commit is contained in:
ronancpl
2017-11-24 14:00:48 -02:00
parent 4dd2764776
commit 3b30244239
87 changed files with 8424 additions and 18509 deletions

View File

@@ -0,0 +1,201 @@
/*
This file is part of the OdinMS Maple Story Server
Copyright (C) 2008 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 as
published by the Free Software Foundation 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 mapleskillmakerfetcher;
import java.io.File;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import provider.MapleData;
import provider.MapleDataDirectoryEntry;
import provider.MapleDataFileEntry;
import provider.MapleDataProvider;
import provider.MapleDataProviderFactory;
import provider.MapleDataTool;
/**
*
* @author Ronan
*
*/
public class MapleItemInformationProvider {
private final static String wzPath = "../../wz";
private static MapleItemInformationProvider instance = null;
protected MapleDataProvider itemData;
protected MapleDataProvider equipData;
protected MapleDataProvider stringData;
protected MapleData eqpStringData;
protected Map<Integer, Map<String, Integer>> equipStatsCache = new HashMap<>();
protected Map<Integer, String> nameCache = new HashMap<>();
private MapleItemInformationProvider() {
itemData = MapleDataProviderFactory.getDataProvider(new File(wzPath + "/Item.wz"));
equipData = MapleDataProviderFactory.getDataProvider(new File(wzPath + "/Character.wz"));
stringData = MapleDataProviderFactory.getDataProvider(new File(wzPath + "/String.wz"));
eqpStringData = stringData.getData("Eqp.img");
}
public static MapleItemInformationProvider getInstance() {
if (instance == null) {
instance = new MapleItemInformationProvider();
}
return instance;
}
private MapleData getItemData(int itemId) {
MapleData ret = null;
String idStr = "0" + String.valueOf(itemId);
MapleDataDirectoryEntry root = itemData.getRoot();
for (MapleDataDirectoryEntry topDir : root.getSubdirectories()) {
for (MapleDataFileEntry iFile : topDir.getFiles()) {
if (iFile.getName().equals(idStr.substring(0, 4) + ".img")) {
ret = itemData.getData(topDir.getName() + "/" + iFile.getName());
if (ret == null) {
return null;
}
ret = ret.getChildByPath(idStr);
return ret;
} else if (iFile.getName().equals(idStr.substring(1) + ".img")) {
return itemData.getData(topDir.getName() + "/" + iFile.getName());
}
}
}
root = equipData.getRoot();
for (MapleDataDirectoryEntry topDir : root.getSubdirectories()) {
for (MapleDataFileEntry iFile : topDir.getFiles()) {
if (iFile.getName().equals(idStr + ".img")) {
return equipData.getData(topDir.getName() + "/" + iFile.getName());
}
}
}
return ret;
}
public Map<String, Integer> getEquipStats(int itemId) {
if (equipStatsCache.containsKey(itemId)) {
return equipStatsCache.get(itemId);
}
Map<String, Integer> ret = new LinkedHashMap<>();
MapleData item = getItemData(itemId);
if (item == null) {
return null;
}
MapleData info = item.getChildByPath("info");
if (info == null) {
return null;
}
for (MapleData data : info.getChildren()) {
if (data.getName().startsWith("inc")) {
ret.put(data.getName().substring(3), MapleDataTool.getIntConvert(data));
}
/*else if (data.getName().startsWith("req"))
ret.put(data.getName(), MapleDataTool.getInt(data.getName(), info, 0));*/
}
ret.put("reqJob", MapleDataTool.getInt("reqJob", info, 0));
ret.put("reqLevel", MapleDataTool.getInt("reqLevel", info, 0));
ret.put("reqDEX", MapleDataTool.getInt("reqDEX", info, 0));
ret.put("reqSTR", MapleDataTool.getInt("reqSTR", info, 0));
ret.put("reqINT", MapleDataTool.getInt("reqINT", info, 0));
ret.put("reqLUK", MapleDataTool.getInt("reqLUK", info, 0));
ret.put("reqPOP", MapleDataTool.getInt("reqPOP", info, 0));
ret.put("cash", MapleDataTool.getInt("cash", info, 0));
ret.put("tuc", MapleDataTool.getInt("tuc", info, 0));
ret.put("cursed", MapleDataTool.getInt("cursed", info, 0));
ret.put("success", MapleDataTool.getInt("success", info, 0));
ret.put("fs", MapleDataTool.getInt("fs", info, 0));
equipStatsCache.put(itemId, ret);
return ret;
}
private MapleData getStringData(int itemId) {
String cat = "null";
MapleData theData;
if ((itemId >= 1010000 && itemId < 1040000) || (itemId >= 1122000 && itemId < 1123000) || (itemId >= 1132000 && itemId < 1133000) || (itemId >= 1142000 && itemId < 1143000)) {
theData = eqpStringData;
cat = "Eqp/Accessory";
} else if (itemId >= 1000000 && itemId < 1010000) {
theData = eqpStringData;
cat = "Eqp/Cap";
} else if (itemId >= 1102000 && itemId < 1103000) {
theData = eqpStringData;
cat = "Eqp/Cape";
} else if (itemId >= 1040000 && itemId < 1050000) {
theData = eqpStringData;
cat = "Eqp/Coat";
} else if (itemId >= 20000 && itemId < 22000) {
theData = eqpStringData;
cat = "Eqp/Face";
} else if (itemId >= 1080000 && itemId < 1090000) {
theData = eqpStringData;
cat = "Eqp/Glove";
} else if (itemId >= 30000 && itemId < 35000) {
theData = eqpStringData;
cat = "Eqp/Hair";
} else if (itemId >= 1050000 && itemId < 1060000) {
theData = eqpStringData;
cat = "Eqp/Longcoat";
} else if (itemId >= 1060000 && itemId < 1070000) {
theData = eqpStringData;
cat = "Eqp/Pants";
} else if (itemId >= 1802000 && itemId < 1842000) {
theData = eqpStringData;
cat = "Eqp/PetEquip";
} else if (itemId >= 1112000 && itemId < 1120000) {
theData = eqpStringData;
cat = "Eqp/Ring";
} else if (itemId >= 1092000 && itemId < 1100000) {
theData = eqpStringData;
cat = "Eqp/Shield";
} else if (itemId >= 1070000 && itemId < 1080000) {
theData = eqpStringData;
cat = "Eqp/Shoes";
} else if (itemId >= 1900000 && itemId < 2000000) {
theData = eqpStringData;
cat = "Eqp/Taming";
} else if (itemId >= 1300000 && itemId < 1800000) {
theData = eqpStringData;
cat = "Eqp/Weapon";
} else {
return null;
}
if (cat.equalsIgnoreCase("null")) {
return theData.getChildByPath(String.valueOf(itemId));
} else {
return theData.getChildByPath(cat + "/" + itemId);
}
}
public String getName(int itemId) {
if (nameCache.containsKey(itemId)) {
return nameCache.get(itemId);
}
MapleData strings = getStringData(itemId);
if (strings == null) {
return null;
}
String ret = MapleDataTool.getString("name", strings, null);
nameCache.put(itemId, ret);
return ret;
}
}

View File

@@ -46,7 +46,6 @@ public class MapleMakerItemEntry {
this.id = id;
this.itemid = itemid;
this.reqLevel = reqLevel;
//System.out.println("id " + id + "rq" + reqLevel);
this.reqMakerLevel = reqMakerLevel;
this.reqItem = reqItem;
this.reqMeso = reqMeso;

View File

@@ -21,10 +21,9 @@ package mapleskillmakerfetcher;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.io.*;
import static mapleskillmakerfetcher.MapleSkillMakerFetcher.id;
/**
* @author RonanLana
@@ -41,7 +40,7 @@ public class MapleSkillMakerFetcher {
static String username = "root";
static String password = "";
static String fileName = "lib/ItemMake.img.xml";
static String fileName = "../../wz/Etc.wz/ItemMake.img.xml";
static String newFile = "lib/MakerData.sql";
static PrintWriter printWriter = null;
@@ -176,6 +175,7 @@ public class MapleSkillMakerFetcher {
status -= 1;
if(status == 2) { //close item maker data
generateUpdatedItemFee(); // for equipments, this will try to update reqMeso to be conformant with the client.
makerList.add(new MapleMakerItemEntry(id, itemid, reqLevel, reqMakerLevel, reqItem, reqMeso, reqEquip, catalyst, quantity, tuc, recipeCount, recipeItem, recipeList, randomList));
resetMakerDataFields();
} else if(status == 4) { //close recipe/random item
@@ -280,6 +280,40 @@ public class MapleSkillMakerFetcher {
}
}
private static void generateUpdatedItemFee() {
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
float adjPrice = reqMeso;
if(itemid < 2000000) {
Map<String, Integer> stats = ii.getEquipStats(itemid);
if(stats != null) {
int val = itemid / 100000;
if(val == 13 || val == 14) { // is weapon-type
adjPrice /= 10;
adjPrice += reqMeso;
adjPrice /= 1000;
reqMeso = 1000 * (int) Math.floor(adjPrice);
} else {
adjPrice /= ((stats.get("reqLevel") >= 108) ? 10 : 11);
adjPrice += reqMeso;
adjPrice /= 1000;
reqMeso = 1000 * (int) Math.ceil(adjPrice);
}
} else {
System.out.println("null stats for itemid " + itemid);
}
} else {
adjPrice /= 10;
adjPrice += reqMeso;
adjPrice /= 1000;
reqMeso = 1000 * (int) Math.ceil(adjPrice);
}
}
private static void WriteMakerTableFile() {
printWriter.println(" # SQL File autogenerated from the MapleSkillMakerFetcher feature by Ronan Lana.");
printWriter.println(" # Generated data is conformant with the ItemMake.img.xml file used to compile this.");
@@ -312,7 +346,7 @@ public class MapleSkillMakerFetcher {
sb_recipe.append(";\r\n");
sb_reward.setLength(sb_reward.length() - 3);
sb_reward.append(";\r\n");
sb_reward.append(";");
printWriter.println(sb_create);
printWriter.println(sb_recipe);