Switch to Maven file structure

This commit is contained in:
P0nk
2021-03-30 21:07:35 +02:00
parent 4acc5675d6
commit 813643036b
817 changed files with 16 additions and 0 deletions

View File

@@ -0,0 +1,101 @@
/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2016 - 2019 RonanLana
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 client.creator;
import client.MapleClient;
import client.MapleCharacter;
import client.MapleSkinColor;
import client.inventory.Item;
import client.inventory.MapleInventory;
import client.inventory.MapleInventoryType;
import config.YamlConfig;
import net.server.Server;
import server.MapleItemInformationProvider;
import tools.FilePrinter;
import tools.MaplePacketCreator;
/**
*
* @author RonanLana
*/
public abstract class CharacterFactory {
protected synchronized static int createNewCharacter(MapleClient c, String name, int face, int hair, int skin, int gender, CharacterFactoryRecipe recipe) {
if (YamlConfig.config.server.COLLECTIVE_CHARSLOT ? c.getAvailableCharacterSlots() <= 0 : c.getAvailableCharacterWorldSlots() <= 0) {
return -3;
}
if (!MapleCharacter.canCreateChar(name)) {
return -1;
}
MapleCharacter newchar = MapleCharacter.getDefault(c);
newchar.setWorld(c.getWorld());
newchar.setSkinColor(MapleSkinColor.getById(skin));
newchar.setGender(gender);
newchar.setName(name);
newchar.setHair(hair);
newchar.setFace(face);
newchar.setLevel(recipe.getLevel());
newchar.setJob(recipe.getJob());
newchar.setMapId(recipe.getMap());
MapleInventory equipped = newchar.getInventory(MapleInventoryType.EQUIPPED);
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
int top = recipe.getTop(), bottom = recipe.getBottom(), shoes = recipe.getShoes(), weapon = recipe.getWeapon();
if(top > 0) {
Item eq_top = ii.getEquipById(top);
eq_top.setPosition((byte) -5);
equipped.addItemFromDB(eq_top);
}
if(bottom > 0) {
Item eq_bottom = ii.getEquipById(bottom);
eq_bottom.setPosition((byte) -6);
equipped.addItemFromDB(eq_bottom);
}
if(shoes > 0) {
Item eq_shoes = ii.getEquipById(shoes);
eq_shoes.setPosition((byte) -7);
equipped.addItemFromDB(eq_shoes);
}
if(weapon > 0) {
Item eq_weapon = ii.getEquipById(weapon);
eq_weapon.setPosition((byte) -11);
equipped.addItemFromDB(eq_weapon.copy());
}
if (!newchar.insertNewChar(recipe)) {
return -2;
}
c.announce(MaplePacketCreator.addNewCharEntry(newchar));
Server.getInstance().createCharacterEntry(newchar);
Server.getInstance().broadcastGMMessage(c.getWorld(), MaplePacketCreator.sendYellowTip("[New Char]: " + c.getAccountName() + " has created a new character with IGN " + name));
FilePrinter.print(FilePrinter.CREATED_CHAR + c.getAccountName() + ".txt", c.getAccountName() + " created character with IGN " + name);
return 0;
}
}

View File

@@ -0,0 +1,194 @@
/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2016 - 2019 RonanLana
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 client.creator;
import client.MapleJob;
import client.Skill;
import client.inventory.Item;
import client.inventory.MapleInventoryType;
import config.YamlConfig;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import tools.Pair;
/**
*
* @author RonanLana
*/
public class CharacterFactoryRecipe {
private MapleJob job;
private int level, map, top, bottom, shoes, weapon;
private int str = 4, dex = 4, int_ = 4, luk = 4;
private int maxHp = 50, maxMp = 5;
private int ap = 0, sp = 0;
private int meso = 0;
private List<Pair<Skill, Integer>> skills = new LinkedList<>();
private List<Pair<Item, MapleInventoryType>> itemsWithType = new LinkedList<>();
private Map<MapleInventoryType, AtomicInteger> runningTypePosition = new LinkedHashMap<>();
public CharacterFactoryRecipe(MapleJob job, int level, int map, int top, int bottom, int shoes, int weapon) {
this.job = job;
this.level = level;
this.map = map;
this.top = top;
this.bottom = bottom;
this.shoes = shoes;
this.weapon = weapon;
if (!YamlConfig.config.server.USE_STARTING_AP_4) {
if (YamlConfig.config.server.USE_AUTOASSIGN_STARTERS_AP) {
str = 12;
dex = 5;
} else {
ap = 9;
}
}
}
public void setStr(int v) {
str = v;
}
public void setDex(int v) {
dex = v;
}
public void setInt(int v) {
int_ = v;
}
public void setLuk(int v) {
luk = v;
}
public void setMaxHp(int v) {
maxHp = v;
}
public void setMaxMp(int v) {
maxMp = v;
}
public void setRemainingAp(int v) {
ap = v;
}
public void setRemainingSp(int v) {
sp = v;
}
public void setMeso(int v) {
meso = v;
}
public void addStartingSkillLevel(Skill skill, int level) {
skills.add(new Pair<>(skill, level));
}
public void addStartingEquipment(Item eqpItem) {
itemsWithType.add(new Pair<>(eqpItem, MapleInventoryType.EQUIP));
}
public void addStartingItem(int itemid, int quantity, MapleInventoryType itemType) {
AtomicInteger p = runningTypePosition.get(itemType);
if(p == null) {
p = new AtomicInteger(0);
runningTypePosition.put(itemType, p);
}
itemsWithType.add(new Pair<>(new Item(itemid, (short) p.getAndIncrement(), (short) quantity), itemType));
}
public MapleJob getJob() {
return job;
}
public int getLevel() {
return level;
}
public int getMap() {
return map;
}
public int getTop() {
return top;
}
public int getBottom() {
return bottom;
}
public int getShoes() {
return shoes;
}
public int getWeapon() {
return weapon;
}
public int getStr() {
return str;
}
public int getDex() {
return dex;
}
public int getInt() {
return int_;
}
public int getLuk() {
return luk;
}
public int getMaxHp() {
return maxHp;
}
public int getMaxMp() {
return maxMp;
}
public int getRemainingAp() {
return ap;
}
public int getRemainingSp() {
return sp;
}
public int getMeso() {
return meso;
}
public List<Pair<Skill, Integer>> getStartingSkillLevel() {
return skills;
}
public List<Pair<Item, MapleInventoryType>> getStartingItems() {
return itemsWithType;
}
}

View File

@@ -0,0 +1,48 @@
/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2016 - 2019 RonanLana
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 client.creator.novice;
import client.MapleClient;
import client.MapleJob;
import client.creator.CharacterFactory;
import client.creator.CharacterFactoryRecipe;
import client.inventory.MapleInventoryType;
/**
*
* @author RonanLana
*/
public class BeginnerCreator extends CharacterFactory {
private static CharacterFactoryRecipe createRecipe(MapleJob job, int level, int map, int top, int bottom, int shoes, int weapon) {
CharacterFactoryRecipe recipe = new CharacterFactoryRecipe(job, level, map, top, bottom, shoes, weapon);
giveItem(recipe, 4161001, 1, MapleInventoryType.ETC);
return recipe;
}
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, MapleInventoryType itemType) {
recipe.addStartingItem(itemid, quantity, itemType);
}
public static int createCharacter(MapleClient c, String name, int face, int hair, int skin, int top, int bottom, int shoes, int weapon, int gender) {
int status = createNewCharacter(c, name, face, hair, skin, gender, createRecipe(MapleJob.BEGINNER, 1, 10000, top, bottom, shoes, weapon));
return status;
}
}

View File

@@ -0,0 +1,48 @@
/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2016 - 2019 RonanLana
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 client.creator.novice;
import client.MapleClient;
import client.MapleJob;
import client.creator.CharacterFactory;
import client.creator.CharacterFactoryRecipe;
import client.inventory.MapleInventoryType;
/**
*
* @author RonanLana
*/
public class LegendCreator extends CharacterFactory {
private static CharacterFactoryRecipe createRecipe(MapleJob job, int level, int map, int top, int bottom, int shoes, int weapon) {
CharacterFactoryRecipe recipe = new CharacterFactoryRecipe(job, level, map, top, bottom, shoes, weapon);
giveItem(recipe, 4161048, 1, MapleInventoryType.ETC);
return recipe;
}
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, MapleInventoryType itemType) {
recipe.addStartingItem(itemid, quantity, itemType);
}
public static int createCharacter(MapleClient c, String name, int face, int hair, int skin, int top, int bottom, int shoes, int weapon, int gender) {
int status = createNewCharacter(c, name, face, hair, skin, gender, createRecipe(MapleJob.LEGEND, 1, 914000000, top, bottom, shoes, weapon));
return status;
}
}

View File

@@ -0,0 +1,48 @@
/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2016 - 2019 RonanLana
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 client.creator.novice;
import client.MapleClient;
import client.MapleJob;
import client.creator.CharacterFactory;
import client.creator.CharacterFactoryRecipe;
import client.inventory.MapleInventoryType;
/**
*
* @author RonanLana
*/
public class NoblesseCreator extends CharacterFactory {
private static CharacterFactoryRecipe createRecipe(MapleJob job, int level, int map, int top, int bottom, int shoes, int weapon) {
CharacterFactoryRecipe recipe = new CharacterFactoryRecipe(job, level, map, top, bottom, shoes, weapon);
giveItem(recipe, 4161047, 1, MapleInventoryType.ETC);
return recipe;
}
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, MapleInventoryType itemType) {
recipe.addStartingItem(itemid, quantity, itemType);
}
public static int createCharacter(MapleClient c, String name, int face, int hair, int skin, int top, int bottom, int shoes, int weapon, int gender) {
int status = createNewCharacter(c, name, face, hair, skin, gender, createRecipe(MapleJob.NOBLESSE, 1, 130030000, top, bottom, shoes, weapon));
return status;
}
}

View File

@@ -0,0 +1,75 @@
/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2016 - 2019 RonanLana
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 client.creator.veteran;
import client.MapleClient;
import client.MapleJob;
import client.creator.CharacterFactory;
import client.creator.CharacterFactoryRecipe;
import client.inventory.Item;
import client.inventory.MapleInventoryType;
import server.MapleItemInformationProvider;
/**
*
* @author RonanLana
*/
public class BowmanCreator extends CharacterFactory {
private static int[] equips = {1040067, 1041054, 1060056, 1061050, 1072081};
private static int[] weapons = {1452005, 1462000};
private static int[] startingHpMp = {797, 404};
private static CharacterFactoryRecipe createRecipe(MapleJob job, int level, int map, int top, int bottom, int shoes, int weapon) {
CharacterFactoryRecipe recipe = new CharacterFactoryRecipe(job, level, map, top, bottom, shoes, weapon);
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
recipe.setDex(25);
recipe.setRemainingAp(133);
recipe.setRemainingSp(61);
recipe.setMaxHp(startingHpMp[0]);
recipe.setMaxMp(startingHpMp[1]);
recipe.setMeso(100000);
for(int i = 1; i < weapons.length; i++) {
giveEquipment(recipe, ii, weapons[i]);
}
giveItem(recipe, 2000002, 100, MapleInventoryType.USE);
giveItem(recipe, 2000003, 100, MapleInventoryType.USE);
giveItem(recipe, 3010000, 1, MapleInventoryType.SETUP);
return recipe;
}
private static void giveEquipment(CharacterFactoryRecipe recipe, MapleItemInformationProvider ii, int equipid) {
Item nEquip = ii.getEquipById(equipid);
recipe.addStartingEquipment(nEquip);
}
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, MapleInventoryType itemType) {
recipe.addStartingItem(itemid, quantity, itemType);
}
public static int createCharacter(MapleClient c, String name, int face, int hair, int skin, int gender, int improveSp) {
return createNewCharacter(c, name, face, hair, skin, gender, createRecipe(MapleJob.BOWMAN, 30, 100000000, equips[gender], equips[2 + gender], equips[4], weapons[0]));
}
}

View File

@@ -0,0 +1,98 @@
/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2016 - 2019 RonanLana
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 client.creator.veteran;
import client.MapleClient;
import client.MapleJob;
import client.Skill;
import client.SkillFactory;
import client.creator.CharacterFactory;
import client.creator.CharacterFactoryRecipe;
import client.inventory.Item;
import client.inventory.MapleInventoryType;
import constants.skills.Magician;
import server.MapleItemInformationProvider;
/**
*
* @author RonanLana
*/
public class MagicianCreator extends CharacterFactory {
private static int[] equips = {0, 1041041, 0, 1061034, 1072075};
private static int[] weapons = {1372003, 1382017};
private static int[] startingHpMp = {405, 729};
private static int[] mpGain = {0, 40, 80, 118, 156, 194, 230, 266, 302, 336, 370};
private static CharacterFactoryRecipe createRecipe(MapleJob job, int level, int map, int top, int bottom, int shoes, int weapon, int gender, int improveSp) {
CharacterFactoryRecipe recipe = new CharacterFactoryRecipe(job, level, map, top, bottom, shoes, weapon);
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
recipe.setInt(20);
recipe.setRemainingAp(138);
recipe.setRemainingSp(67);
recipe.setMaxHp(startingHpMp[0]);
recipe.setMaxMp(startingHpMp[1] + mpGain[improveSp]);
recipe.setMeso(100000);
if(gender == 0) {
giveEquipment(recipe, ii, 1050003);
}
for(int i = 1; i < weapons.length; i++) {
giveEquipment(recipe, ii, weapons[i]);
}
giveItem(recipe, 2000001, 100, MapleInventoryType.USE);
giveItem(recipe, 2000006, 100, MapleInventoryType.USE);
giveItem(recipe, 3010000, 1, MapleInventoryType.SETUP);
if(improveSp > 0) {
improveSp += 5;
recipe.setRemainingSp(recipe.getRemainingSp() - improveSp);
int toUseSp = 5;
Skill improveMpRec = SkillFactory.getSkill(Magician.IMPROVED_MP_RECOVERY);
recipe.addStartingSkillLevel(improveMpRec, toUseSp);
improveSp -= toUseSp;
if(improveSp > 0) {
Skill improveMaxMp = SkillFactory.getSkill(Magician.IMPROVED_MAX_MP_INCREASE);
recipe.addStartingSkillLevel(improveMaxMp, improveSp);
}
}
return recipe;
}
private static void giveEquipment(CharacterFactoryRecipe recipe, MapleItemInformationProvider ii, int equipid) {
Item nEquip = ii.getEquipById(equipid);
recipe.addStartingEquipment(nEquip);
}
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, MapleInventoryType itemType) {
recipe.addStartingItem(itemid, quantity, itemType);
}
public static int createCharacter(MapleClient c, String name, int face, int hair, int skin, int gender, int improveSp) {
return createNewCharacter(c, name, face, hair, skin, gender, createRecipe(MapleJob.MAGICIAN, 30, 101000000, equips[gender], equips[2 + gender], equips[4], weapons[0], gender, improveSp));
}
}

View File

@@ -0,0 +1,79 @@
/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2016 - 2019 RonanLana
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 client.creator.veteran;
import client.MapleClient;
import client.MapleJob;
import client.creator.CharacterFactory;
import client.creator.CharacterFactoryRecipe;
import client.inventory.Item;
import client.inventory.MapleInventoryType;
import server.MapleItemInformationProvider;
/**
*
* @author RonanLana
*/
public class PirateCreator extends CharacterFactory {
private static int[] equips = {0, 0, 0, 0, 1072294};
private static int[] weapons = {1482004, 1492004};
private static int[] startingHpMp = {846, 503};
private static CharacterFactoryRecipe createRecipe(MapleJob job, int level, int map, int top, int bottom, int shoes, int weapon) {
CharacterFactoryRecipe recipe = new CharacterFactoryRecipe(job, level, map, top, bottom, shoes, weapon);
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
recipe.setDex(20);
recipe.setRemainingAp(138);
recipe.setRemainingSp(61);
recipe.setMaxHp(startingHpMp[0]);
recipe.setMaxMp(startingHpMp[1]);
recipe.setMeso(100000);
giveEquipment(recipe, ii, 1052107);
for(int i = 1; i < weapons.length; i++) {
giveEquipment(recipe, ii, weapons[i]);
}
giveItem(recipe, 2330000, 800, MapleInventoryType.USE);
giveItem(recipe, 2000002, 100, MapleInventoryType.USE);
giveItem(recipe, 2000003, 100, MapleInventoryType.USE);
giveItem(recipe, 3010000, 1, MapleInventoryType.SETUP);
return recipe;
}
private static void giveEquipment(CharacterFactoryRecipe recipe, MapleItemInformationProvider ii, int equipid) {
Item nEquip = ii.getEquipById(equipid);
recipe.addStartingEquipment(nEquip);
}
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, MapleInventoryType itemType) {
recipe.addStartingItem(itemid, quantity, itemType);
}
public static int createCharacter(MapleClient c, String name, int face, int hair, int skin, int gender, int improveSp) {
return createNewCharacter(c, name, face, hair, skin, gender, createRecipe(MapleJob.PIRATE, 30, 120000000, equips[gender], equips[2 + gender], equips[4], weapons[0]));
}
}

View File

@@ -0,0 +1,77 @@
/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2016 - 2019 RonanLana
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 client.creator.veteran;
import client.MapleClient;
import client.MapleJob;
import client.creator.CharacterFactory;
import client.creator.CharacterFactoryRecipe;
import client.inventory.Item;
import client.inventory.MapleInventoryType;
import server.MapleItemInformationProvider;
/**
*
* @author RonanLana
*/
public class ThiefCreator extends CharacterFactory {
private static int[] equips = {1040057, 1041047, 1060043, 1061043, 1072032};
private static int[] weapons = {1472008, 1332012};
private static int[] startingHpMp = {794, 407};
private static CharacterFactoryRecipe createRecipe(MapleJob job, int level, int map, int top, int bottom, int shoes, int weapon) {
CharacterFactoryRecipe recipe = new CharacterFactoryRecipe(job, level, map, top, bottom, shoes, weapon);
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
recipe.setDex(25);
recipe.setRemainingAp(133);
recipe.setRemainingSp(61);
recipe.setMaxHp(startingHpMp[0]);
recipe.setMaxMp(startingHpMp[1]);
recipe.setMeso(100000);
for(int i = 1; i < weapons.length; i++) {
giveEquipment(recipe, ii, weapons[i]);
}
giveItem(recipe, 2070000, 500, MapleInventoryType.USE);
giveItem(recipe, 2000002, 100, MapleInventoryType.USE);
giveItem(recipe, 2000003, 100, MapleInventoryType.USE);
giveItem(recipe, 3010000, 1, MapleInventoryType.SETUP);
return recipe;
}
private static void giveEquipment(CharacterFactoryRecipe recipe, MapleItemInformationProvider ii, int equipid) {
Item nEquip = ii.getEquipById(equipid);
recipe.addStartingEquipment(nEquip);
}
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, MapleInventoryType itemType) {
recipe.addStartingItem(itemid, quantity, itemType);
}
public static int createCharacter(MapleClient c, String name, int face, int hair, int skin, int gender, int improveSp) {
return createNewCharacter(c, name, face, hair, skin, gender, createRecipe(MapleJob.THIEF, 30, 103000000, equips[gender], equips[2 + gender], equips[4], weapons[0]));
}
}

View File

@@ -0,0 +1,98 @@
/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2016 - 2019 RonanLana
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 client.creator.veteran;
import client.MapleClient;
import client.MapleJob;
import client.Skill;
import client.SkillFactory;
import client.creator.CharacterFactory;
import client.creator.CharacterFactoryRecipe;
import client.inventory.Item;
import client.inventory.MapleInventoryType;
import constants.skills.Warrior;
import server.MapleItemInformationProvider;
/**
*
* @author RonanLana
*/
public class WarriorCreator extends CharacterFactory {
private static int[] equips = {1040021, 0, 1060016, 0, 1072039};
private static int[] weapons = {1302008, 1442001, 1422001, 1312005};
private static int[] startingHpMp = {905, 208};
private static int[] hpGain = {0, 72, 144, 212, 280, 348, 412, 476, 540, 600, 660};
private static CharacterFactoryRecipe createRecipe(MapleJob job, int level, int map, int top, int bottom, int shoes, int weapon, int gender, int improveSp) {
CharacterFactoryRecipe recipe = new CharacterFactoryRecipe(job, level, map, top, bottom, shoes, weapon);
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
recipe.setStr(35);
recipe.setRemainingAp(123);
recipe.setRemainingSp(61);
recipe.setMaxHp(startingHpMp[0] + hpGain[improveSp]);
recipe.setMaxMp(startingHpMp[1]);
recipe.setMeso(100000);
if(gender == 1) {
giveEquipment(recipe, ii, 1051010);
}
for(int i = 1; i < weapons.length; i++) {
giveEquipment(recipe, ii, weapons[i]);
}
if(improveSp > 0) {
improveSp += 5;
recipe.setRemainingSp(recipe.getRemainingSp() - improveSp);
int toUseSp = 5;
Skill improveHpRec = SkillFactory.getSkill(Warrior.IMPROVED_HPREC);
recipe.addStartingSkillLevel(improveHpRec, toUseSp);
improveSp -= toUseSp;
if(improveSp > 0) {
Skill improveMaxHp = SkillFactory.getSkill(Warrior.IMPROVED_MAXHP);
recipe.addStartingSkillLevel(improveMaxHp, improveSp);
}
}
giveItem(recipe, 2000002, 100, MapleInventoryType.USE);
giveItem(recipe, 2000003, 100, MapleInventoryType.USE);
giveItem(recipe, 3010000, 1, MapleInventoryType.SETUP);
return recipe;
}
private static void giveEquipment(CharacterFactoryRecipe recipe, MapleItemInformationProvider ii, int equipid) {
Item nEquip = ii.getEquipById(equipid);
recipe.addStartingEquipment(nEquip);
}
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, MapleInventoryType itemType) {
recipe.addStartingItem(itemid, quantity, itemType);
}
public static int createCharacter(MapleClient c, String name, int face, int hair, int skin, int gender, int improveSp) {
return createNewCharacter(c, name, face, hair, skin, gender, createRecipe(MapleJob.WARRIOR, 30, 102000000, equips[gender], equips[2 + gender], equips[4], weapons[0], gender, improveSp));
}
}