Reformat and clean up "client" package

This commit is contained in:
P0nk
2021-09-09 23:21:39 +02:00
parent 07f55fa53c
commit 9bf1b68924
108 changed files with 1770 additions and 1543 deletions

View File

@@ -32,70 +32,69 @@ import tools.FilePrinter;
import tools.PacketCreator;
/**
*
* @author RonanLana
*/
public abstract class CharacterFactory {
protected synchronized static int createNewCharacter(Client 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 (!Character.canCreateChar(name)) {
return -1;
}
Character newchar = Character.getDefault(c);
newchar.setWorld(c.getWorld());
newchar.setSkinColor(SkinColor.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());
Inventory equipped = newchar.getInventory(InventoryType.EQUIPPED);
ItemInformationProvider ii = ItemInformationProvider.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.sendPacket(PacketCreator.addNewCharEntry(newchar));
Server.getInstance().createCharacterEntry(newchar);
Server.getInstance().broadcastGMMessage(c.getWorld(), PacketCreator.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;
}
protected synchronized static int createNewCharacter(Client 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 (!Character.canCreateChar(name)) {
return -1;
}
Character newchar = Character.getDefault(c);
newchar.setWorld(c.getWorld());
newchar.setSkinColor(SkinColor.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());
Inventory equipped = newchar.getInventory(InventoryType.EQUIPPED);
ItemInformationProvider ii = ItemInformationProvider.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.sendPacket(PacketCreator.addNewCharEntry(newchar));
Server.getInstance().createCharacterEntry(newchar);
Server.getInstance().broadcastGMMessage(c.getWorld(), PacketCreator.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

@@ -33,21 +33,25 @@ import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
/**
*
* @author RonanLana
*/
public class CharacterFactoryRecipe {
private Job job;
private int level, map, top, bottom, shoes, weapon;
private final Job job;
private final int level;
private final int map;
private final int top;
private final int bottom;
private final int shoes;
private final int 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, InventoryType>> itemsWithType = new LinkedList<>();
private Map<InventoryType, AtomicInteger> runningTypePosition = new LinkedHashMap<>();
private final List<Pair<Skill, Integer>> skills = new LinkedList<>();
private final List<Pair<Item, InventoryType>> itemsWithType = new LinkedList<>();
private final Map<InventoryType, AtomicInteger> runningTypePosition = new LinkedHashMap<>();
public CharacterFactoryRecipe(Job job, int level, int map, int top, int bottom, int shoes, int weapon) {
this.job = job;
this.level = level;
@@ -56,7 +60,7 @@ public class CharacterFactoryRecipe {
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;
@@ -66,129 +70,129 @@ public class CharacterFactoryRecipe {
}
}
}
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, InventoryType.EQUIP));
}
public void addStartingItem(int itemid, int quantity, InventoryType itemType) {
AtomicInteger p = runningTypePosition.get(itemType);
if(p == null) {
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 Job 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, InventoryType>> getStartingItems() {
return itemsWithType;
}

View File

@@ -26,23 +26,22 @@ import client.creator.CharacterFactoryRecipe;
import client.inventory.InventoryType;
/**
*
* @author RonanLana
*/
public class BeginnerCreator extends CharacterFactory {
private static CharacterFactoryRecipe createRecipe(Job 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, InventoryType.ETC);
return recipe;
}
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, InventoryType itemType) {
recipe.addStartingItem(itemid, quantity, itemType);
}
public static int createCharacter(Client 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(Job.BEGINNER, 1, 10000, top, bottom, shoes, weapon));
return status;
}
private static CharacterFactoryRecipe createRecipe(Job 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, InventoryType.ETC);
return recipe;
}
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, InventoryType itemType) {
recipe.addStartingItem(itemid, quantity, itemType);
}
public static int createCharacter(Client 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(Job.BEGINNER, 1, 10000, top, bottom, shoes, weapon));
return status;
}
}

View File

@@ -26,23 +26,22 @@ import client.creator.CharacterFactoryRecipe;
import client.inventory.InventoryType;
/**
*
* @author RonanLana
*/
public class LegendCreator extends CharacterFactory {
private static CharacterFactoryRecipe createRecipe(Job 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, InventoryType.ETC);
return recipe;
}
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, InventoryType itemType) {
recipe.addStartingItem(itemid, quantity, itemType);
}
public static int createCharacter(Client 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(Job.LEGEND, 1, 914000000, top, bottom, shoes, weapon));
return status;
}
private static CharacterFactoryRecipe createRecipe(Job 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, InventoryType.ETC);
return recipe;
}
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, InventoryType itemType) {
recipe.addStartingItem(itemid, quantity, itemType);
}
public static int createCharacter(Client 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(Job.LEGEND, 1, 914000000, top, bottom, shoes, weapon));
return status;
}
}

View File

@@ -26,23 +26,22 @@ import client.creator.CharacterFactoryRecipe;
import client.inventory.InventoryType;
/**
*
* @author RonanLana
*/
public class NoblesseCreator extends CharacterFactory {
private static CharacterFactoryRecipe createRecipe(Job 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, InventoryType.ETC);
return recipe;
}
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, InventoryType itemType) {
recipe.addStartingItem(itemid, quantity, itemType);
}
public static int createCharacter(Client 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(Job.NOBLESSE, 1, 130030000, top, bottom, shoes, weapon));
return status;
}
private static CharacterFactoryRecipe createRecipe(Job 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, InventoryType.ETC);
return recipe;
}
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, InventoryType itemType) {
recipe.addStartingItem(itemid, quantity, itemType);
}
public static int createCharacter(Client 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(Job.NOBLESSE, 1, 130030000, top, bottom, shoes, weapon));
return status;
}
}

View File

@@ -28,48 +28,47 @@ import client.inventory.Item;
import server.ItemInformationProvider;
/**
*
* @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(Job job, int level, int map, int top, int bottom, int shoes, int weapon) {
CharacterFactoryRecipe recipe = new CharacterFactoryRecipe(job, level, map, top, bottom, shoes, weapon);
ItemInformationProvider ii = ItemInformationProvider.getInstance();
recipe.setDex(25);
recipe.setRemainingAp(133);
recipe.setRemainingSp(61);
private static final int[] equips = {1040067, 1041054, 1060056, 1061050, 1072081};
private static final int[] weapons = {1452005, 1462000};
private static final int[] startingHpMp = {797, 404};
recipe.setMaxHp(startingHpMp[0]);
recipe.setMaxMp(startingHpMp[1]);
recipe.setMeso(100000);
private static CharacterFactoryRecipe createRecipe(Job job, int level, int map, int top, int bottom, int shoes, int weapon) {
CharacterFactoryRecipe recipe = new CharacterFactoryRecipe(job, level, map, top, bottom, shoes, weapon);
ItemInformationProvider ii = ItemInformationProvider.getInstance();
for(int i = 1; i < weapons.length; i++) {
giveEquipment(recipe, ii, weapons[i]);
}
recipe.setDex(25);
recipe.setRemainingAp(133);
recipe.setRemainingSp(61);
giveItem(recipe, 2000002, 100, InventoryType.USE);
giveItem(recipe, 2000003, 100, InventoryType.USE);
giveItem(recipe, 3010000, 1, InventoryType.SETUP);
return recipe;
}
private static void giveEquipment(CharacterFactoryRecipe recipe, ItemInformationProvider ii, int equipid) {
Item nEquip = ii.getEquipById(equipid);
recipe.addStartingEquipment(nEquip);
}
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, InventoryType itemType) {
recipe.addStartingItem(itemid, quantity, itemType);
}
public static int createCharacter(Client c, String name, int face, int hair, int skin, int gender, int improveSp) {
return createNewCharacter(c, name, face, hair, skin, gender, createRecipe(Job.BOWMAN, 30, 100000000, equips[gender], equips[2 + gender], equips[4], weapons[0]));
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, InventoryType.USE);
giveItem(recipe, 2000003, 100, InventoryType.USE);
giveItem(recipe, 3010000, 1, InventoryType.SETUP);
return recipe;
}
private static void giveEquipment(CharacterFactoryRecipe recipe, ItemInformationProvider ii, int equipid) {
Item nEquip = ii.getEquipById(equipid);
recipe.addStartingEquipment(nEquip);
}
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, InventoryType itemType) {
recipe.addStartingItem(itemid, quantity, itemType);
}
public static int createCharacter(Client c, String name, int face, int hair, int skin, int gender, int improveSp) {
return createNewCharacter(c, name, face, hair, skin, gender, createRecipe(Job.BOWMAN, 30, 100000000, equips[gender], equips[2 + gender], equips[4], weapons[0]));
}
}

View File

@@ -31,68 +31,67 @@ import constants.skills.Magician;
import server.ItemInformationProvider;
/**
*
* @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(Job 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);
ItemInformationProvider ii = ItemInformationProvider.getInstance();
recipe.setInt(20);
recipe.setRemainingAp(138);
recipe.setRemainingSp(67);
private static final int[] equips = {0, 1041041, 0, 1061034, 1072075};
private static final int[] weapons = {1372003, 1382017};
private static final int[] startingHpMp = {405, 729};
private static final int[] mpGain = {0, 40, 80, 118, 156, 194, 230, 266, 302, 336, 370};
recipe.setMaxHp(startingHpMp[0]);
recipe.setMaxMp(startingHpMp[1] + mpGain[improveSp]);
recipe.setMeso(100000);
if(gender == 0) {
giveEquipment(recipe, ii, 1050003);
}
private static CharacterFactoryRecipe createRecipe(Job 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);
ItemInformationProvider ii = ItemInformationProvider.getInstance();
for(int i = 1; i < weapons.length; i++) {
giveEquipment(recipe, ii, weapons[i]);
}
recipe.setInt(20);
recipe.setRemainingAp(138);
recipe.setRemainingSp(67);
giveItem(recipe, 2000001, 100, InventoryType.USE);
giveItem(recipe, 2000006, 100, InventoryType.USE);
giveItem(recipe, 3010000, 1, InventoryType.SETUP);
if(improveSp > 0) {
improveSp += 5;
recipe.setRemainingSp(recipe.getRemainingSp() - improveSp);
recipe.setMaxHp(startingHpMp[0]);
recipe.setMaxMp(startingHpMp[1] + mpGain[improveSp]);
int toUseSp = 5;
Skill improveMpRec = SkillFactory.getSkill(Magician.IMPROVED_MP_RECOVERY);
recipe.addStartingSkillLevel(improveMpRec, toUseSp);
improveSp -= toUseSp;
recipe.setMeso(100000);
if(improveSp > 0) {
Skill improveMaxMp = SkillFactory.getSkill(Magician.IMPROVED_MAX_MP_INCREASE);
recipe.addStartingSkillLevel(improveMaxMp, improveSp);
}
}
return recipe;
if (gender == 0) {
giveEquipment(recipe, ii, 1050003);
}
private static void giveEquipment(CharacterFactoryRecipe recipe, ItemInformationProvider ii, int equipid) {
Item nEquip = ii.getEquipById(equipid);
recipe.addStartingEquipment(nEquip);
for (int i = 1; i < weapons.length; i++) {
giveEquipment(recipe, ii, weapons[i]);
}
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, InventoryType itemType) {
recipe.addStartingItem(itemid, quantity, itemType);
}
public static int createCharacter(Client c, String name, int face, int hair, int skin, int gender, int improveSp) {
return createNewCharacter(c, name, face, hair, skin, gender, createRecipe(Job.MAGICIAN, 30, 101000000, equips[gender], equips[2 + gender], equips[4], weapons[0], gender, improveSp));
giveItem(recipe, 2000001, 100, InventoryType.USE);
giveItem(recipe, 2000006, 100, InventoryType.USE);
giveItem(recipe, 3010000, 1, InventoryType.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, ItemInformationProvider ii, int equipid) {
Item nEquip = ii.getEquipById(equipid);
recipe.addStartingEquipment(nEquip);
}
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, InventoryType itemType) {
recipe.addStartingItem(itemid, quantity, itemType);
}
public static int createCharacter(Client c, String name, int face, int hair, int skin, int gender, int improveSp) {
return createNewCharacter(c, name, face, hair, skin, gender, createRecipe(Job.MAGICIAN, 30, 101000000, equips[gender], equips[2 + gender], equips[4], weapons[0], gender, improveSp));
}
}

View File

@@ -28,52 +28,51 @@ import client.inventory.Item;
import server.ItemInformationProvider;
/**
*
* @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(Job job, int level, int map, int top, int bottom, int shoes, int weapon) {
CharacterFactoryRecipe recipe = new CharacterFactoryRecipe(job, level, map, top, bottom, shoes, weapon);
ItemInformationProvider ii = ItemInformationProvider.getInstance();
recipe.setDex(20);
recipe.setRemainingAp(138);
recipe.setRemainingSp(61);
private static final int[] equips = {0, 0, 0, 0, 1072294};
private static final int[] weapons = {1482004, 1492004};
private static final int[] startingHpMp = {846, 503};
recipe.setMaxHp(startingHpMp[0]);
recipe.setMaxMp(startingHpMp[1]);
recipe.setMeso(100000);
giveEquipment(recipe, ii, 1052107);
private static CharacterFactoryRecipe createRecipe(Job job, int level, int map, int top, int bottom, int shoes, int weapon) {
CharacterFactoryRecipe recipe = new CharacterFactoryRecipe(job, level, map, top, bottom, shoes, weapon);
ItemInformationProvider ii = ItemInformationProvider.getInstance();
for(int i = 1; i < weapons.length; i++) {
giveEquipment(recipe, ii, weapons[i]);
}
giveItem(recipe, 2330000, 800, InventoryType.USE);
recipe.setDex(20);
recipe.setRemainingAp(138);
recipe.setRemainingSp(61);
giveItem(recipe, 2000002, 100, InventoryType.USE);
giveItem(recipe, 2000003, 100, InventoryType.USE);
giveItem(recipe, 3010000, 1, InventoryType.SETUP);
return recipe;
}
private static void giveEquipment(CharacterFactoryRecipe recipe, ItemInformationProvider ii, int equipid) {
Item nEquip = ii.getEquipById(equipid);
recipe.addStartingEquipment(nEquip);
}
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, InventoryType itemType) {
recipe.addStartingItem(itemid, quantity, itemType);
}
public static int createCharacter(Client c, String name, int face, int hair, int skin, int gender, int improveSp) {
return createNewCharacter(c, name, face, hair, skin, gender, createRecipe(Job.PIRATE, 30, 120000000, equips[gender], equips[2 + gender], equips[4], weapons[0]));
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, InventoryType.USE);
giveItem(recipe, 2000002, 100, InventoryType.USE);
giveItem(recipe, 2000003, 100, InventoryType.USE);
giveItem(recipe, 3010000, 1, InventoryType.SETUP);
return recipe;
}
private static void giveEquipment(CharacterFactoryRecipe recipe, ItemInformationProvider ii, int equipid) {
Item nEquip = ii.getEquipById(equipid);
recipe.addStartingEquipment(nEquip);
}
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, InventoryType itemType) {
recipe.addStartingItem(itemid, quantity, itemType);
}
public static int createCharacter(Client c, String name, int face, int hair, int skin, int gender, int improveSp) {
return createNewCharacter(c, name, face, hair, skin, gender, createRecipe(Job.PIRATE, 30, 120000000, equips[gender], equips[2 + gender], equips[4], weapons[0]));
}
}

View File

@@ -28,50 +28,49 @@ import client.inventory.Item;
import server.ItemInformationProvider;
/**
*
* @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(Job job, int level, int map, int top, int bottom, int shoes, int weapon) {
CharacterFactoryRecipe recipe = new CharacterFactoryRecipe(job, level, map, top, bottom, shoes, weapon);
ItemInformationProvider ii = ItemInformationProvider.getInstance();
recipe.setDex(25);
recipe.setRemainingAp(133);
recipe.setRemainingSp(61);
private static final int[] equips = {1040057, 1041047, 1060043, 1061043, 1072032};
private static final int[] weapons = {1472008, 1332012};
private static final int[] startingHpMp = {794, 407};
recipe.setMaxHp(startingHpMp[0]);
recipe.setMaxMp(startingHpMp[1]);
recipe.setMeso(100000);
private static CharacterFactoryRecipe createRecipe(Job job, int level, int map, int top, int bottom, int shoes, int weapon) {
CharacterFactoryRecipe recipe = new CharacterFactoryRecipe(job, level, map, top, bottom, shoes, weapon);
ItemInformationProvider ii = ItemInformationProvider.getInstance();
for(int i = 1; i < weapons.length; i++) {
giveEquipment(recipe, ii, weapons[i]);
}
giveItem(recipe, 2070000, 500, InventoryType.USE);
recipe.setDex(25);
recipe.setRemainingAp(133);
recipe.setRemainingSp(61);
giveItem(recipe, 2000002, 100, InventoryType.USE);
giveItem(recipe, 2000003, 100, InventoryType.USE);
giveItem(recipe, 3010000, 1, InventoryType.SETUP);
return recipe;
}
private static void giveEquipment(CharacterFactoryRecipe recipe, ItemInformationProvider ii, int equipid) {
Item nEquip = ii.getEquipById(equipid);
recipe.addStartingEquipment(nEquip);
}
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, InventoryType itemType) {
recipe.addStartingItem(itemid, quantity, itemType);
}
public static int createCharacter(Client c, String name, int face, int hair, int skin, int gender, int improveSp) {
return createNewCharacter(c, name, face, hair, skin, gender, createRecipe(Job.THIEF, 30, 103000000, equips[gender], equips[2 + gender], equips[4], weapons[0]));
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, InventoryType.USE);
giveItem(recipe, 2000002, 100, InventoryType.USE);
giveItem(recipe, 2000003, 100, InventoryType.USE);
giveItem(recipe, 3010000, 1, InventoryType.SETUP);
return recipe;
}
private static void giveEquipment(CharacterFactoryRecipe recipe, ItemInformationProvider ii, int equipid) {
Item nEquip = ii.getEquipById(equipid);
recipe.addStartingEquipment(nEquip);
}
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, InventoryType itemType) {
recipe.addStartingItem(itemid, quantity, itemType);
}
public static int createCharacter(Client c, String name, int face, int hair, int skin, int gender, int improveSp) {
return createNewCharacter(c, name, face, hair, skin, gender, createRecipe(Job.THIEF, 30, 103000000, equips[gender], equips[2 + gender], equips[4], weapons[0]));
}
}

View File

@@ -31,68 +31,67 @@ import constants.skills.Warrior;
import server.ItemInformationProvider;
/**
*
* @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(Job 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);
ItemInformationProvider ii = ItemInformationProvider.getInstance();
recipe.setStr(35);
recipe.setRemainingAp(123);
recipe.setRemainingSp(61);
private static final int[] equips = {1040021, 0, 1060016, 0, 1072039};
private static final int[] weapons = {1302008, 1442001, 1422001, 1312005};
private static final int[] startingHpMp = {905, 208};
private static final int[] hpGain = {0, 72, 144, 212, 280, 348, 412, 476, 540, 600, 660};
recipe.setMaxHp(startingHpMp[0] + hpGain[improveSp]);
recipe.setMaxMp(startingHpMp[1]);
recipe.setMeso(100000);
if(gender == 1) {
giveEquipment(recipe, ii, 1051010);
}
private static CharacterFactoryRecipe createRecipe(Job 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);
ItemInformationProvider ii = ItemInformationProvider.getInstance();
for(int i = 1; i < weapons.length; i++) {
giveEquipment(recipe, ii, weapons[i]);
}
if(improveSp > 0) {
improveSp += 5;
recipe.setRemainingSp(recipe.getRemainingSp() - improveSp);
recipe.setStr(35);
recipe.setRemainingAp(123);
recipe.setRemainingSp(61);
int toUseSp = 5;
Skill improveHpRec = SkillFactory.getSkill(Warrior.IMPROVED_HPREC);
recipe.addStartingSkillLevel(improveHpRec, toUseSp);
improveSp -= toUseSp;
recipe.setMaxHp(startingHpMp[0] + hpGain[improveSp]);
recipe.setMaxMp(startingHpMp[1]);
if(improveSp > 0) {
Skill improveMaxHp = SkillFactory.getSkill(Warrior.IMPROVED_MAXHP);
recipe.addStartingSkillLevel(improveMaxHp, improveSp);
}
}
recipe.setMeso(100000);
giveItem(recipe, 2000002, 100, InventoryType.USE);
giveItem(recipe, 2000003, 100, InventoryType.USE);
giveItem(recipe, 3010000, 1, InventoryType.SETUP);
return recipe;
if (gender == 1) {
giveEquipment(recipe, ii, 1051010);
}
private static void giveEquipment(CharacterFactoryRecipe recipe, ItemInformationProvider ii, int equipid) {
Item nEquip = ii.getEquipById(equipid);
recipe.addStartingEquipment(nEquip);
for (int i = 1; i < weapons.length; i++) {
giveEquipment(recipe, ii, weapons[i]);
}
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, InventoryType itemType) {
recipe.addStartingItem(itemid, quantity, itemType);
}
public static int createCharacter(Client c, String name, int face, int hair, int skin, int gender, int improveSp) {
return createNewCharacter(c, name, face, hair, skin, gender, createRecipe(Job.WARRIOR, 30, 102000000, equips[gender], equips[2 + gender], equips[4], weapons[0], gender, improveSp));
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, InventoryType.USE);
giveItem(recipe, 2000003, 100, InventoryType.USE);
giveItem(recipe, 3010000, 1, InventoryType.SETUP);
return recipe;
}
private static void giveEquipment(CharacterFactoryRecipe recipe, ItemInformationProvider ii, int equipid) {
Item nEquip = ii.getEquipById(equipid);
recipe.addStartingEquipment(nEquip);
}
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, InventoryType itemType) {
recipe.addStartingItem(itemid, quantity, itemType);
}
public static int createCharacter(Client c, String name, int face, int hair, int skin, int gender, int improveSp) {
return createNewCharacter(c, name, face, hair, skin, gender, createRecipe(Job.WARRIOR, 30, 102000000, equips[gender], equips[2 + gender], equips[4], weapons[0], gender, improveSp));
}
}