Loading data cleanup.
This commit is contained in:
parent
3c6964d12d
commit
1ff2b89dba
@ -54,7 +54,7 @@ public class AccountManager
|
||||
{
|
||||
if (_mode.equals("1") || _mode.equals("2") || _mode.equals("3"))
|
||||
{
|
||||
while (_uname.length() == 0)
|
||||
while (_uname.isEmpty())
|
||||
{
|
||||
System.out.print("username: ");
|
||||
_uname = _in.readLine();
|
||||
@ -62,7 +62,7 @@ public class AccountManager
|
||||
}
|
||||
if (_mode.equals("1"))
|
||||
{
|
||||
while (_pass.length() == 0)
|
||||
while (_pass.isEmpty())
|
||||
{
|
||||
System.out.print("password: ");
|
||||
_pass = _in.readLine();
|
||||
@ -70,7 +70,7 @@ public class AccountManager
|
||||
}
|
||||
if (_mode.equals("1") || _mode.equals("2"))
|
||||
{
|
||||
while (_level.length() == 0)
|
||||
while (_level.isEmpty())
|
||||
{
|
||||
System.out.print("access level: ");
|
||||
_level = _in.readLine();
|
||||
|
@ -17,10 +17,9 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.data;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.LineNumberReader;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -46,58 +45,42 @@ public class CharStatsTable
|
||||
|
||||
private CharStatsTable()
|
||||
{
|
||||
BufferedReader lnr = null;
|
||||
try
|
||||
{
|
||||
File ModifierData = new File("data/char_stats.csv");
|
||||
lnr = new LineNumberReader(new BufferedReader(new FileReader(ModifierData)));
|
||||
String line = null;
|
||||
while ((line = ((LineNumberReader) lnr).readLine()) != null)
|
||||
File modifierData = new File("data/char_stats.csv");
|
||||
if (modifierData.isFile() && modifierData.exists())
|
||||
{
|
||||
if ((line.trim().length() == 0) || line.startsWith("#"))
|
||||
LineNumberReader lnr = new LineNumberReader(new InputStreamReader(new FileInputStream(modifierData)));
|
||||
String line = null;
|
||||
while ((line = lnr.readLine()) != null)
|
||||
{
|
||||
continue;
|
||||
if (line.trim().isEmpty() || line.startsWith("#"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
StringTokenizer st = new StringTokenizer(line, ";");
|
||||
StatModifiers modifier = new StatModifiers();
|
||||
modifier.setClassid(Integer.parseInt(st.nextToken()));
|
||||
modifier.setModstr(Integer.parseInt(st.nextToken()));
|
||||
modifier.setModcon(Integer.parseInt(st.nextToken()));
|
||||
modifier.setModdex(Integer.parseInt(st.nextToken()));
|
||||
modifier.setModint(Integer.parseInt(st.nextToken()));
|
||||
modifier.setModmen(Integer.parseInt(st.nextToken()));
|
||||
modifier.setModwit(Integer.parseInt(st.nextToken()));
|
||||
_modifiers.put(modifier.getClassid(), modifier);
|
||||
}
|
||||
StatModifiers modif = parseList(line);
|
||||
_modifiers.put(modif.getClassid(), modif);
|
||||
lnr.close();
|
||||
_log.config("Loaded " + _modifiers.size() + " character stat modifiers.");
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.warning("char_stats.csv is missing in data folder.");
|
||||
}
|
||||
_log.config("Loaded " + _modifiers.size() + " character stat modifiers.");
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
_log.warning("char_stats.csv is missing in data folder.");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.warning("Error while creating character modifier table " + e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if (lnr != null)
|
||||
{
|
||||
lnr.close();
|
||||
}
|
||||
}
|
||||
catch (Exception e1)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private StatModifiers parseList(String line)
|
||||
{
|
||||
StringTokenizer st = new StringTokenizer(line, ";");
|
||||
StatModifiers modifier = new StatModifiers();
|
||||
modifier.setClassid(Integer.parseInt(st.nextToken()));
|
||||
modifier.setModstr(Integer.parseInt(st.nextToken()));
|
||||
modifier.setModcon(Integer.parseInt(st.nextToken()));
|
||||
modifier.setModdex(Integer.parseInt(st.nextToken()));
|
||||
modifier.setModint(Integer.parseInt(st.nextToken()));
|
||||
modifier.setModmen(Integer.parseInt(st.nextToken()));
|
||||
modifier.setModwit(Integer.parseInt(st.nextToken()));
|
||||
return modifier;
|
||||
}
|
||||
|
||||
public StatModifiers getTemplate(int id)
|
||||
|
@ -17,10 +17,9 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.data;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.LineNumberReader;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -46,83 +45,72 @@ public class CharTemplateTable
|
||||
|
||||
private CharTemplateTable()
|
||||
{
|
||||
BufferedReader lnr = null;
|
||||
try
|
||||
{
|
||||
File skillData = new File("data/char_templates.csv");
|
||||
lnr = new LineNumberReader(new BufferedReader(new FileReader(skillData)));
|
||||
String line = null;
|
||||
while ((line = ((LineNumberReader) lnr).readLine()) != null)
|
||||
File charTemplateData = new File("data/char_templates.csv");
|
||||
if (charTemplateData.isFile() && charTemplateData.exists())
|
||||
{
|
||||
if ((line.trim().length() == 0) || line.startsWith("#"))
|
||||
LineNumberReader lnr = new LineNumberReader(new InputStreamReader(new FileInputStream(charTemplateData)));
|
||||
String line = null;
|
||||
while ((line = lnr.readLine()) != null)
|
||||
{
|
||||
continue;
|
||||
if (line.trim().isEmpty() || line.startsWith("#"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
L2CharTemplate ct = new L2CharTemplate();
|
||||
StringTokenizer st = new StringTokenizer(line, ";");
|
||||
ct.setClassId(Integer.parseInt(st.nextToken()));
|
||||
ct.setClassName(st.nextToken());
|
||||
ct.setRaceId(Integer.parseInt(st.nextToken()));
|
||||
ct.setStr(Integer.parseInt(st.nextToken()));
|
||||
ct.setCon(Integer.parseInt(st.nextToken()));
|
||||
ct.setDex(Integer.parseInt(st.nextToken()));
|
||||
ct.setInt(Integer.parseInt(st.nextToken()));
|
||||
ct.setWit(Integer.parseInt(st.nextToken()));
|
||||
ct.setMen(Integer.parseInt(st.nextToken()));
|
||||
ct.setHp(Integer.parseInt(st.nextToken()));
|
||||
ct.setMp(Integer.parseInt(st.nextToken()));
|
||||
ct.setPatk(Integer.parseInt(st.nextToken()));
|
||||
ct.setPdef(Integer.parseInt(st.nextToken()));
|
||||
ct.setMatk(Integer.parseInt(st.nextToken()));
|
||||
ct.setMdef(Integer.parseInt(st.nextToken()));
|
||||
ct.setPspd(Integer.parseInt(st.nextToken()));
|
||||
ct.setMspd(Integer.parseInt(st.nextToken()));
|
||||
ct.setAcc(Integer.parseInt(st.nextToken()));
|
||||
ct.setCrit(Integer.parseInt(st.nextToken()));
|
||||
ct.setEvas(Integer.parseInt(st.nextToken()));
|
||||
ct.setMoveSpd(Integer.parseInt(st.nextToken()));
|
||||
ct.setLoad(Integer.parseInt(st.nextToken()));
|
||||
ct.setX(Integer.parseInt(st.nextToken()));
|
||||
ct.setY(Integer.parseInt(st.nextToken()));
|
||||
ct.setZ(Integer.parseInt(st.nextToken()));
|
||||
ct.setCanCraft(Integer.parseInt(st.nextToken()));
|
||||
ct.setMUnk1(Double.parseDouble(st.nextToken()));
|
||||
ct.setMUnk2(Double.parseDouble(st.nextToken()));
|
||||
ct.setMColR(Double.parseDouble(st.nextToken()));
|
||||
ct.setMColH(Double.parseDouble(st.nextToken()));
|
||||
ct.setFUnk1(Double.parseDouble(st.nextToken()));
|
||||
ct.setFUnk2(Double.parseDouble(st.nextToken()));
|
||||
ct.setFColR(Double.parseDouble(st.nextToken()));
|
||||
ct.setFColH(Double.parseDouble(st.nextToken()));
|
||||
while (st.hasMoreTokens())
|
||||
{
|
||||
ct.addItem(Integer.parseInt(st.nextToken()));
|
||||
}
|
||||
_templates.put(ct.getClassId(), ct);
|
||||
}
|
||||
L2CharTemplate ct = new L2CharTemplate();
|
||||
StringTokenizer st = new StringTokenizer(line, ";");
|
||||
ct.setClassId(Integer.parseInt(st.nextToken()));
|
||||
ct.setClassName(st.nextToken());
|
||||
ct.setRaceId(Integer.parseInt(st.nextToken()));
|
||||
ct.setStr(Integer.parseInt(st.nextToken()));
|
||||
ct.setCon(Integer.parseInt(st.nextToken()));
|
||||
ct.setDex(Integer.parseInt(st.nextToken()));
|
||||
ct.setInt(Integer.parseInt(st.nextToken()));
|
||||
ct.setWit(Integer.parseInt(st.nextToken()));
|
||||
ct.setMen(Integer.parseInt(st.nextToken()));
|
||||
ct.setHp(Integer.parseInt(st.nextToken()));
|
||||
ct.setMp(Integer.parseInt(st.nextToken()));
|
||||
ct.setPatk(Integer.parseInt(st.nextToken()));
|
||||
ct.setPdef(Integer.parseInt(st.nextToken()));
|
||||
ct.setMatk(Integer.parseInt(st.nextToken()));
|
||||
ct.setMdef(Integer.parseInt(st.nextToken()));
|
||||
ct.setPspd(Integer.parseInt(st.nextToken()));
|
||||
ct.setMspd(Integer.parseInt(st.nextToken()));
|
||||
ct.setAcc(Integer.parseInt(st.nextToken()));
|
||||
ct.setCrit(Integer.parseInt(st.nextToken()));
|
||||
ct.setEvas(Integer.parseInt(st.nextToken()));
|
||||
ct.setMoveSpd(Integer.parseInt(st.nextToken()));
|
||||
ct.setLoad(Integer.parseInt(st.nextToken()));
|
||||
ct.setX(Integer.parseInt(st.nextToken()));
|
||||
ct.setY(Integer.parseInt(st.nextToken()));
|
||||
ct.setZ(Integer.parseInt(st.nextToken()));
|
||||
ct.setCanCraft(Integer.parseInt(st.nextToken()));
|
||||
ct.setMUnk1(Double.parseDouble(st.nextToken()));
|
||||
ct.setMUnk2(Double.parseDouble(st.nextToken()));
|
||||
ct.setMColR(Double.parseDouble(st.nextToken()));
|
||||
ct.setMColH(Double.parseDouble(st.nextToken()));
|
||||
ct.setFUnk1(Double.parseDouble(st.nextToken()));
|
||||
ct.setFUnk2(Double.parseDouble(st.nextToken()));
|
||||
ct.setFColR(Double.parseDouble(st.nextToken()));
|
||||
ct.setFColH(Double.parseDouble(st.nextToken()));
|
||||
while (st.hasMoreTokens())
|
||||
{
|
||||
ct.addItem(Integer.parseInt(st.nextToken()));
|
||||
}
|
||||
_templates.put(ct.getClassId(), ct);
|
||||
lnr.close();
|
||||
_log.config("Loaded " + _templates.size() + " char templates.");
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.warning("char_templates.csv is missing in data folder, char creation will fail.");
|
||||
}
|
||||
_log.config("Loaded " + _templates.size() + " char templates.");
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
_log.warning("char_templates.csv is missing in data folder, char creation will fail.");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.warning("Error while loading char templates " + e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if (lnr != null)
|
||||
{
|
||||
lnr.close();
|
||||
}
|
||||
}
|
||||
catch (Exception e1)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,11 +17,10 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.data;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.LineNumberReader;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
@ -71,17 +70,16 @@ public class ClanTable
|
||||
|
||||
private Clan restoreClan(File file)
|
||||
{
|
||||
BufferedReader lnr = null;
|
||||
Clan clan = null;
|
||||
try
|
||||
{
|
||||
lnr = new LineNumberReader(new BufferedReader(new FileReader(file)));
|
||||
((LineNumberReader) lnr).readLine();
|
||||
clan = parseClanData(((LineNumberReader) lnr).readLine());
|
||||
((LineNumberReader) lnr).readLine();
|
||||
LineNumberReader lnr = new LineNumberReader(new InputStreamReader(new FileInputStream(file)));
|
||||
lnr.readLine();
|
||||
clan = parseClanData(lnr.readLine());
|
||||
lnr.readLine();
|
||||
String line = null;
|
||||
boolean first = true;
|
||||
while ((line = ((LineNumberReader) lnr).readLine()) != null)
|
||||
while ((line = lnr.readLine()) != null)
|
||||
{
|
||||
ClanMember member = parseMembers(line);
|
||||
if (first)
|
||||
@ -92,24 +90,12 @@ public class ClanTable
|
||||
}
|
||||
clan.addClanMember(member);
|
||||
}
|
||||
lnr.close();
|
||||
}
|
||||
catch (IOException e)
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.warning("Could not read clan file:" + e.getMessage());
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if (lnr != null)
|
||||
{
|
||||
lnr.close();
|
||||
}
|
||||
}
|
||||
catch (Exception e1)
|
||||
{
|
||||
}
|
||||
}
|
||||
return clan;
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ public class ExperienceTable
|
||||
String line = null;
|
||||
while ((line = lnr.readLine()) != null)
|
||||
{
|
||||
if ((line.trim().length() == 0) || line.startsWith("#"))
|
||||
if (line.trim().isEmpty() || line.startsWith("#"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ public class ItemTable
|
||||
{
|
||||
try
|
||||
{
|
||||
if ((line.trim().length() == 0) || line.startsWith("#"))
|
||||
if (line.trim().isEmpty() || line.startsWith("#"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -334,7 +334,8 @@ public class ItemTable
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.warning("Data error on etc item:" + result + " " + e);
|
||||
_log.warning("Data error on etc item:" + result + " line: " + line);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -17,10 +17,10 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.data;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.LineNumberReader;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -47,21 +47,29 @@ public class LevelUpData
|
||||
|
||||
private LevelUpData()
|
||||
{
|
||||
BufferedReader lnr = null;
|
||||
try
|
||||
{
|
||||
File spawnDataFile = new File("data/lvlupgain.csv");
|
||||
lnr = new LineNumberReader(new BufferedReader(new FileReader(spawnDataFile)));
|
||||
LineNumberReader lnr = new LineNumberReader(new InputStreamReader(new FileInputStream(spawnDataFile)));
|
||||
String line = null;
|
||||
while ((line = ((LineNumberReader) lnr).readLine()) != null)
|
||||
while ((line = lnr.readLine()) != null)
|
||||
{
|
||||
if ((line.trim().length() == 0) || line.startsWith("#"))
|
||||
if (line.trim().isEmpty() || line.startsWith("#"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
LvlupData lvlupData = parseList(line);
|
||||
StringTokenizer st = new StringTokenizer(line, ";");
|
||||
LvlupData lvlupData = new LvlupData();
|
||||
lvlupData.setClassid(Integer.parseInt(st.nextToken()));
|
||||
lvlupData.setDefaulthp(Double.parseDouble(st.nextToken()));
|
||||
lvlupData.setDefaulthpadd(Double.parseDouble(st.nextToken()));
|
||||
lvlupData.setDefaulthpbonus(Double.parseDouble(st.nextToken()));
|
||||
lvlupData.setDefaultmp(Double.parseDouble(st.nextToken()));
|
||||
lvlupData.setDefaultmpadd(Double.parseDouble(st.nextToken()));
|
||||
lvlupData.setDefaultmpbonus(Double.parseDouble(st.nextToken()));
|
||||
_lvltable.put(lvlupData.getClassid(), lvlupData);
|
||||
}
|
||||
lnr.close();
|
||||
_log.config("Loaded " + _lvltable.size() + " Lvl up data templates.");
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
@ -72,33 +80,6 @@ public class LevelUpData
|
||||
{
|
||||
_log.warning("Error while creating npc data table " + e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if (lnr != null)
|
||||
{
|
||||
lnr.close();
|
||||
}
|
||||
}
|
||||
catch (Exception e1)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private LvlupData parseList(String line)
|
||||
{
|
||||
StringTokenizer st = new StringTokenizer(line, ";");
|
||||
LvlupData lvlDat = new LvlupData();
|
||||
lvlDat.setClassid(Integer.parseInt(st.nextToken()));
|
||||
lvlDat.setDefaulthp(Double.parseDouble(st.nextToken()));
|
||||
lvlDat.setDefaulthpadd(Double.parseDouble(st.nextToken()));
|
||||
lvlDat.setDefaulthpbonus(Double.parseDouble(st.nextToken()));
|
||||
lvlDat.setDefaultmp(Double.parseDouble(st.nextToken()));
|
||||
lvlDat.setDefaultmpadd(Double.parseDouble(st.nextToken()));
|
||||
lvlDat.setDefaultmpbonus(Double.parseDouble(st.nextToken()));
|
||||
return lvlDat;
|
||||
}
|
||||
|
||||
public LvlupData getTemplate(int classId)
|
||||
|
@ -17,11 +17,9 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.data;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.LineNumberReader;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.logging.Logger;
|
||||
@ -49,15 +47,14 @@ public class MapRegionTable
|
||||
super();
|
||||
int count = 0;
|
||||
int count2 = 0;
|
||||
LineNumberReader lnr = null;
|
||||
try
|
||||
{
|
||||
File regionDataFile = new File("data/mapregion.csv");
|
||||
lnr = new LineNumberReader(new BufferedReader(new FileReader(regionDataFile)));
|
||||
LineNumberReader lnr = new LineNumberReader(new InputStreamReader(new FileInputStream(regionDataFile)));
|
||||
String line = null;
|
||||
while ((line = lnr.readLine()) != null)
|
||||
{
|
||||
if ((line.trim().length() == 0) || line.startsWith("#"))
|
||||
if (line.trim().isEmpty() || line.startsWith("#"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -68,55 +65,12 @@ public class MapRegionTable
|
||||
}
|
||||
++count;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_log.fine("Loaded " + count2 + " map regions.");
|
||||
lnr.close();
|
||||
return;
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
_log.warning("mapregion.csv is missing in data folder.");
|
||||
try
|
||||
{
|
||||
}
|
||||
catch (Exception e1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_log.fine("Loaded " + count2 + " map regions.");
|
||||
lnr.close();
|
||||
return;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.warning("Rrror while creating map region data: " + e);
|
||||
try
|
||||
{
|
||||
}
|
||||
catch (Exception e1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_log.fine("Loaded " + count2 + " map regions.");
|
||||
lnr.close();
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (Throwable throwable)
|
||||
{
|
||||
_log.fine("Loaded " + count2 + " map regions.");
|
||||
try
|
||||
{
|
||||
if (lnr != null)
|
||||
{
|
||||
lnr.close();
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
}
|
||||
lnr.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.fine("Error loading map regions. " + e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,7 +81,7 @@ public class MapRegionTable
|
||||
return _regions[tileX][tileY];
|
||||
}
|
||||
|
||||
public String getClosestTownCords(Creature activeChar)
|
||||
public int[] getClosestTownCords(Creature activeChar)
|
||||
{
|
||||
int[][] pos = new int[13][3];
|
||||
pos[0][0] = -84176;
|
||||
@ -170,7 +124,12 @@ public class MapRegionTable
|
||||
pos[12][1] = 148497;
|
||||
pos[12][2] = -3404;
|
||||
int closest = getMapRegion(activeChar.getX(), activeChar.getY());
|
||||
String ClosestTownCords = pos[closest][0] + "!" + pos[closest][1] + "!" + pos[closest][2];
|
||||
int[] ClosestTownCords =
|
||||
{
|
||||
pos[closest][0],
|
||||
pos[closest][1],
|
||||
pos[closest][2]
|
||||
};
|
||||
return ClosestTownCords;
|
||||
}
|
||||
}
|
||||
|
@ -17,10 +17,10 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.data;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.LineNumberReader;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -60,21 +60,21 @@ public class NpcTable
|
||||
|
||||
private void parseData()
|
||||
{
|
||||
BufferedReader lnr = null;
|
||||
try
|
||||
{
|
||||
File skillData = new File("data/npc.csv");
|
||||
lnr = new LineNumberReader(new BufferedReader(new FileReader(skillData)));
|
||||
File npcData = new File("data/npc.csv");
|
||||
LineNumberReader lnr = new LineNumberReader(new InputStreamReader(new FileInputStream(npcData)));
|
||||
String line = null;
|
||||
while ((line = ((LineNumberReader) lnr).readLine()) != null)
|
||||
while ((line = lnr.readLine()) != null)
|
||||
{
|
||||
if ((line.trim().length() == 0) || line.startsWith("#"))
|
||||
if (line.trim().isEmpty() || line.startsWith("#"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
L2Npc npc = parseList(line);
|
||||
_npcs.put(npc.getNpcId(), npc);
|
||||
}
|
||||
lnr.close();
|
||||
_log.config("Loaded " + _npcs.size() + " NPC templates.");
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
@ -87,19 +87,6 @@ public class NpcTable
|
||||
_initialized = false;
|
||||
_log.warning("Error while creating npc table " + e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if (lnr != null)
|
||||
{
|
||||
lnr.close();
|
||||
}
|
||||
}
|
||||
catch (Exception e1)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private L2Npc parseList(String line)
|
||||
@ -121,15 +108,14 @@ public class NpcTable
|
||||
|
||||
private void parseAdditionalData()
|
||||
{
|
||||
BufferedReader lnr = null;
|
||||
try
|
||||
{
|
||||
File npcDataFile = new File("data/npc2.csv");
|
||||
lnr = new LineNumberReader(new BufferedReader(new FileReader(npcDataFile)));
|
||||
File npcData2 = new File("data/npc2.csv");
|
||||
LineNumberReader lnr = new LineNumberReader(new InputStreamReader(new FileInputStream(npcData2)));
|
||||
String line = null;
|
||||
while ((line = ((LineNumberReader) lnr).readLine()) != null)
|
||||
while ((line = lnr.readLine()) != null)
|
||||
{
|
||||
if ((line.trim().length() == 0) || line.startsWith("#"))
|
||||
if (line.trim().isEmpty() || line.startsWith("#"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -139,9 +125,10 @@ public class NpcTable
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.warning("Parsing error in npc2.csv, line " + ((LineNumberReader) lnr).getLineNumber() + " / " + e.toString());
|
||||
_log.warning("Parsing error in npc2.csv, line " + lnr.getLineNumber() + " / " + e.toString());
|
||||
}
|
||||
}
|
||||
lnr.close();
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
@ -151,19 +138,6 @@ public class NpcTable
|
||||
{
|
||||
_log.warning("Error while creating npc data table " + e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if (lnr != null)
|
||||
{
|
||||
lnr.close();
|
||||
}
|
||||
}
|
||||
catch (Exception e1)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void parseAdditionalDataLine(String line)
|
||||
@ -201,16 +175,15 @@ public class NpcTable
|
||||
|
||||
private void parseDropData()
|
||||
{
|
||||
BufferedReader lnr = null;
|
||||
try
|
||||
{
|
||||
File dropDataFile = new File("data/droplist.csv");
|
||||
lnr = new LineNumberReader(new BufferedReader(new FileReader(dropDataFile)));
|
||||
File dropData = new File("data/droplist.csv");
|
||||
LineNumberReader lnr = new LineNumberReader(new InputStreamReader(new FileInputStream(dropData)));
|
||||
String line = null;
|
||||
int n = 0;
|
||||
while ((line = ((LineNumberReader) lnr).readLine()) != null)
|
||||
while ((line = lnr.readLine()) != null)
|
||||
{
|
||||
if ((line.trim().length() == 0) || line.startsWith("#"))
|
||||
if (line.trim().isEmpty() || line.startsWith("#"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -221,10 +194,11 @@ public class NpcTable
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.warning("Parsing error in droplist.csv, line " + ((LineNumberReader) lnr).getLineNumber() + " / " + e.toString());
|
||||
_log.warning("Parsing error in droplist.csv, line " + lnr.getLineNumber() + " / " + e.toString());
|
||||
}
|
||||
}
|
||||
_log.config("Loaded " + n + " drop data templates.");
|
||||
lnr.close();
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
@ -234,19 +208,6 @@ public class NpcTable
|
||||
{
|
||||
_log.warning("Error while creating drop data table " + e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if (lnr != null)
|
||||
{
|
||||
lnr.close();
|
||||
}
|
||||
}
|
||||
catch (Exception e1)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void parseDropLine(String line)
|
||||
|
@ -17,11 +17,9 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.data;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.LineNumberReader;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.logging.Logger;
|
||||
@ -49,85 +47,39 @@ public class PriceListTable
|
||||
|
||||
public void loadPriceList()
|
||||
{
|
||||
File file = new File("data/pricelist.csv");
|
||||
if (file.exists())
|
||||
{
|
||||
try
|
||||
{
|
||||
readFromDisk(file);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.config("data/pricelist.csv is missing!");
|
||||
}
|
||||
}
|
||||
|
||||
private void readFromDisk(File file) throws IOException
|
||||
{
|
||||
BufferedReader lnr = null;
|
||||
int i = 0;
|
||||
String line = null;
|
||||
lnr = new LineNumberReader(new FileReader(file));
|
||||
while ((line = ((LineNumberReader) lnr).readLine()) != null)
|
||||
{
|
||||
if (line.startsWith("#"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
StringTokenizer st = new StringTokenizer(line, ";");
|
||||
int itemId = Integer.parseInt(st.nextToken().toString());
|
||||
int price = Integer.parseInt(st.nextToken().toString());
|
||||
L2Item temp = ItemTable.getInstance().getTemplate(itemId);
|
||||
temp.setItemId(itemId);
|
||||
temp.setReferencePrice(price);
|
||||
++i;
|
||||
}
|
||||
_log.config("Loaded " + i + " prices.");
|
||||
try
|
||||
{
|
||||
lnr.close();
|
||||
return;
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
try
|
||||
File file = new File("data/pricelist.csv");
|
||||
if (file.isFile() && file.exists())
|
||||
{
|
||||
int i = 0;
|
||||
String line = null;
|
||||
LineNumberReader lnr = new LineNumberReader(new InputStreamReader(new FileInputStream(file)));
|
||||
while ((line = lnr.readLine()) != null)
|
||||
{
|
||||
if (line.startsWith("#"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
StringTokenizer st = new StringTokenizer(line, ";");
|
||||
int itemId = Integer.parseInt(st.nextToken().toString());
|
||||
int price = Integer.parseInt(st.nextToken().toString());
|
||||
L2Item temp = ItemTable.getInstance().getTemplate(itemId);
|
||||
temp.setItemId(itemId);
|
||||
temp.setReferencePrice(price);
|
||||
++i;
|
||||
}
|
||||
_log.config("Loaded " + i + " prices.");
|
||||
lnr.close();
|
||||
return;
|
||||
}
|
||||
catch (IOException e1)
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
e1.printStackTrace();
|
||||
}
|
||||
catch (Throwable throwable)
|
||||
{
|
||||
try
|
||||
{
|
||||
lnr.close();
|
||||
throw throwable;
|
||||
}
|
||||
catch (Exception e2)
|
||||
{
|
||||
// empty catch block
|
||||
}
|
||||
throw throwable;
|
||||
}
|
||||
try
|
||||
{
|
||||
lnr.close();
|
||||
return;
|
||||
}
|
||||
catch (Exception e2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_log.config("data/pricelist.csv is missing!");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.warning("Error while loading price lists: " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,8 +19,10 @@ package org.l2jmobius.gameserver.data;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.LineNumberReader;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -47,15 +49,14 @@ public class SkillTable
|
||||
|
||||
private SkillTable()
|
||||
{
|
||||
BufferedReader lnr = null;
|
||||
try
|
||||
{
|
||||
File skillData = new File("data/skills.csv");
|
||||
lnr = new LineNumberReader(new BufferedReader(new FileReader(skillData)));
|
||||
LineNumberReader lnr = new LineNumberReader(new InputStreamReader(new FileInputStream(skillData)));
|
||||
String line = null;
|
||||
while ((line = ((LineNumberReader) lnr).readLine()) != null)
|
||||
while ((line = lnr.readLine()) != null)
|
||||
{
|
||||
if ((line.trim().length() == 0) || line.startsWith("#"))
|
||||
if (line.trim().isEmpty() || line.startsWith("#"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -65,14 +66,15 @@ public class SkillTable
|
||||
skillData = new File("data/skills2.csv");
|
||||
lnr.close();
|
||||
lnr = new LineNumberReader(new BufferedReader(new FileReader(skillData)));
|
||||
while ((line = ((LineNumberReader) lnr).readLine()) != null)
|
||||
while ((line = lnr.readLine()) != null)
|
||||
{
|
||||
if ((line.trim().length() == 0) || line.startsWith("#"))
|
||||
if (line.trim().isEmpty() || line.startsWith("#"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
parseList2(line);
|
||||
}
|
||||
lnr.close();
|
||||
_log.config("Loaded " + _skills.size() + " skills.");
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
@ -85,19 +87,6 @@ public class SkillTable
|
||||
_initialized = false;
|
||||
_log.warning("Error while creating skill table: " + e.toString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if (lnr != null)
|
||||
{
|
||||
lnr.close();
|
||||
}
|
||||
}
|
||||
catch (Exception e1)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isInitialized()
|
||||
|
@ -17,10 +17,10 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.data;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.LineNumberReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@ -170,20 +170,19 @@ public class SkillTreeTable
|
||||
|
||||
private void readFile(File skillData, int classId, int parentClassId)
|
||||
{
|
||||
BufferedReader lnr = null;
|
||||
String line = null;
|
||||
try
|
||||
{
|
||||
lnr = new LineNumberReader(new BufferedReader(new FileReader(skillData)));
|
||||
LineNumberReader lnr = new LineNumberReader(new InputStreamReader(new FileInputStream(skillData)));
|
||||
List<SkillLearn> list = new ArrayList<>();
|
||||
if (parentClassId != -1)
|
||||
{
|
||||
List<SkillLearn> parentList = _skillTrees.get(parentClassId);
|
||||
list.addAll(parentList);
|
||||
}
|
||||
while ((line = ((LineNumberReader) lnr).readLine()) != null)
|
||||
while ((line = lnr.readLine()) != null)
|
||||
{
|
||||
if ((line.trim().length() == 0) || line.startsWith("#"))
|
||||
if (line.trim().isEmpty() || line.startsWith("#"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -191,6 +190,7 @@ public class SkillTreeTable
|
||||
list.add(skill);
|
||||
}
|
||||
_skillTrees.put(classId, list);
|
||||
lnr.close();
|
||||
_log.config("Skill tree for class " + classId + " has " + list.size() + " skills.");
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
@ -200,20 +200,6 @@ public class SkillTreeTable
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.warning("Error while creating skill tree for classId " + classId + " " + line + " " + e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if (lnr != null)
|
||||
{
|
||||
lnr.close();
|
||||
}
|
||||
}
|
||||
catch (Exception e1)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,10 +17,10 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.data;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.LineNumberReader;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -49,17 +49,16 @@ public class SpawnTable
|
||||
|
||||
private SpawnTable()
|
||||
{
|
||||
BufferedReader lnr = null;
|
||||
try
|
||||
{
|
||||
File spawnDataFile = new File("data/spawnlist.csv");
|
||||
lnr = new LineNumberReader(new BufferedReader(new FileReader(spawnDataFile)));
|
||||
LineNumberReader lnr = new LineNumberReader(new InputStreamReader(new FileInputStream(spawnDataFile)));
|
||||
String line = null;
|
||||
while ((line = ((LineNumberReader) lnr).readLine()) != null)
|
||||
while ((line = lnr.readLine()) != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
if ((line.trim().length() == 0) || line.startsWith("#"))
|
||||
if (line.trim().isEmpty() || line.startsWith("#"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -76,6 +75,7 @@ public class SpawnTable
|
||||
_log.warning("Spawn could not be initialized: " + e1);
|
||||
}
|
||||
}
|
||||
lnr.close();
|
||||
_log.config("Created " + _spawntable.size() + " spawn handlers.");
|
||||
_log.fine("Spawning completed, total number of NPCs in the world: " + _npcSpawnCount);
|
||||
}
|
||||
@ -87,19 +87,6 @@ public class SpawnTable
|
||||
{
|
||||
_log.warning("error while creating spawn list " + e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if (lnr != null)
|
||||
{
|
||||
lnr.close();
|
||||
}
|
||||
}
|
||||
catch (Exception e1)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Spawn parseList(String line) throws SecurityException, ClassNotFoundException
|
||||
|
@ -17,10 +17,9 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.data;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.LineNumberReader;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -46,56 +45,40 @@ public class TeleportLocationTable
|
||||
|
||||
private TeleportLocationTable()
|
||||
{
|
||||
BufferedReader lnr = null;
|
||||
try
|
||||
{
|
||||
File teleData = new File("data/teleport.csv");
|
||||
lnr = new LineNumberReader(new BufferedReader(new FileReader(teleData)));
|
||||
String line = null;
|
||||
while ((line = ((LineNumberReader) lnr).readLine()) != null)
|
||||
if (teleData.isFile() && teleData.exists())
|
||||
{
|
||||
if ((line.trim().length() == 0) || line.startsWith("#"))
|
||||
LineNumberReader lnr = new LineNumberReader(new InputStreamReader(new FileInputStream(teleData)));
|
||||
String line = null;
|
||||
while ((line = lnr.readLine()) != null)
|
||||
{
|
||||
continue;
|
||||
if (line.trim().isEmpty() || line.startsWith("#"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
StringTokenizer st = new StringTokenizer(line, ";");
|
||||
TeleportLocation teleport = new TeleportLocation();
|
||||
teleport.setTeleId(Integer.parseInt(st.nextToken()));
|
||||
teleport.setLocX(Integer.parseInt(st.nextToken()));
|
||||
teleport.setLocY(Integer.parseInt(st.nextToken()));
|
||||
teleport.setLocZ(Integer.parseInt(st.nextToken()));
|
||||
teleport.setPrice(Integer.parseInt(st.nextToken()));
|
||||
_teleports.put(teleport.getTeleId(), teleport);
|
||||
}
|
||||
TeleportLocation tele = parseList(line);
|
||||
_teleports.put(tele.getTeleId(), tele);
|
||||
lnr.close();
|
||||
_log.config("Loaded " + _teleports.size() + " Teleport templates.");
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.warning("teleport.csv is missing in data folder.");
|
||||
}
|
||||
_log.config("Loaded " + _teleports.size() + " Teleport templates.");
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
_log.warning("teleport.csv is missing in data folder.");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.warning("Error while creating teleport table " + e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if (lnr != null)
|
||||
{
|
||||
lnr.close();
|
||||
}
|
||||
}
|
||||
catch (Exception e1)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private TeleportLocation parseList(String line)
|
||||
{
|
||||
StringTokenizer st = new StringTokenizer(line, ";");
|
||||
TeleportLocation teleport = new TeleportLocation();
|
||||
teleport.setTeleId(Integer.parseInt(st.nextToken()));
|
||||
teleport.setLocX(Integer.parseInt(st.nextToken()));
|
||||
teleport.setLocY(Integer.parseInt(st.nextToken()));
|
||||
teleport.setLocZ(Integer.parseInt(st.nextToken()));
|
||||
teleport.setPrice(Integer.parseInt(st.nextToken()));
|
||||
return teleport;
|
||||
}
|
||||
|
||||
public TeleportLocation getTemplate(int id)
|
||||
|
@ -17,9 +17,10 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.data;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.LineNumberReader;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -47,31 +48,30 @@ public class TradeController
|
||||
private TradeController()
|
||||
{
|
||||
String line = null;
|
||||
LineNumberReader lnr = null;
|
||||
int dummyItemCount = 0;
|
||||
try
|
||||
{
|
||||
File buylistData = new File("data/buylists.csv");
|
||||
lnr = new LineNumberReader(new BufferedReader(new FileReader(buylistData)));
|
||||
LineNumberReader lnr = new LineNumberReader(new InputStreamReader(new FileInputStream(buylistData)));
|
||||
while ((line = lnr.readLine()) != null)
|
||||
{
|
||||
if ((line.trim().length() == 0) || line.startsWith("#"))
|
||||
if (line.trim().isEmpty() || line.startsWith("#"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
dummyItemCount += parseList(line);
|
||||
}
|
||||
lnr.close();
|
||||
_log.fine("Created " + dummyItemCount + " Dummy-Items for buylists.");
|
||||
_log.config("Loaded " + _lists.size() + " buylists.");
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
_log.warning("No buylists were found in data folder.");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (lnr != null)
|
||||
{
|
||||
_log.warning("Error while creating trade controller in linenr: " + lnr.getLineNumber());
|
||||
e.printStackTrace();
|
||||
}
|
||||
_log.warning("No buylists were found in data folder.");
|
||||
_log.warning("Error while creating buylists: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,12 +40,7 @@ public class ScrollOfEscape implements IItemHandler
|
||||
@Override
|
||||
public int useItem(PlayerInstance activeChar, ItemInstance item)
|
||||
{
|
||||
String townCordsString = MapRegionTable.getInstance().getClosestTownCords(activeChar);
|
||||
String[] temp = null;
|
||||
temp = townCordsString.split("!");
|
||||
int townX = Integer.parseInt(temp[0]);
|
||||
int townY = Integer.parseInt(temp[1]);
|
||||
int townZ = Integer.parseInt(temp[2]);
|
||||
int[] townCords = MapRegionTable.getInstance().getClosestTownCords(activeChar);
|
||||
activeChar.setTarget(activeChar);
|
||||
Skill skill = SkillTable.getInstance().getInfo(1050, 1);
|
||||
MagicSkillUser msk = new MagicSkillUser(activeChar, 1050, 1, 20000, 0);
|
||||
@ -71,12 +66,12 @@ public class ScrollOfEscape implements IItemHandler
|
||||
activeChar.sendPacket(af);
|
||||
World.getInstance().removeVisibleObject(activeChar);
|
||||
activeChar.removeAllKnownObjects();
|
||||
TeleportToLocation teleport = new TeleportToLocation(activeChar, townX, townY, townZ);
|
||||
TeleportToLocation teleport = new TeleportToLocation(activeChar, townCords[0], townCords[1], townCords[2]);
|
||||
activeChar.sendPacket(teleport);
|
||||
activeChar.broadcastPacket(teleport);
|
||||
activeChar.setX(townX);
|
||||
activeChar.setY(townY);
|
||||
activeChar.setZ(townZ);
|
||||
activeChar.setX(townCords[0]);
|
||||
activeChar.setY(townCords[1]);
|
||||
activeChar.setZ(townCords[2]);
|
||||
try
|
||||
{
|
||||
Thread.sleep(2000L);
|
||||
|
@ -39,24 +39,19 @@ public class RequestRestartPoint extends ClientBasePacket
|
||||
super(decrypt);
|
||||
Connection con = client.getConnection();
|
||||
PlayerInstance activeChar = client.getActiveChar();
|
||||
String townCordsString = MapRegionTable.getInstance().getClosestTownCords(activeChar);
|
||||
String[] temp = null;
|
||||
temp = townCordsString.split("!");
|
||||
int townX = Integer.parseInt(temp[0]);
|
||||
int townY = Integer.parseInt(temp[1]);
|
||||
int townZ = Integer.parseInt(temp[2]);
|
||||
int[] townCords = MapRegionTable.getInstance().getClosestTownCords(activeChar);
|
||||
StopMove stopMove = new StopMove(activeChar);
|
||||
con.sendPacket(stopMove);
|
||||
ActionFailed actionFailed = new ActionFailed();
|
||||
con.sendPacket(actionFailed);
|
||||
activeChar.broadcastPacket(stopMove);
|
||||
TeleportToLocation teleport = new TeleportToLocation(activeChar, townX, townY, townZ);
|
||||
TeleportToLocation teleport = new TeleportToLocation(activeChar, townCords[0], townCords[1], townCords[2]);
|
||||
activeChar.sendPacket(teleport);
|
||||
World.getInstance().removeVisibleObject(activeChar);
|
||||
activeChar.removeAllKnownObjects();
|
||||
activeChar.setX(townX);
|
||||
activeChar.setY(townY);
|
||||
activeChar.setZ(townZ);
|
||||
activeChar.setX(townCords[0]);
|
||||
activeChar.setY(townCords[1]);
|
||||
activeChar.setZ(townCords[2]);
|
||||
activeChar.setCurrentHp(0.6 * activeChar.getMaxHp());
|
||||
activeChar.setCurrentMp(0.6 * activeChar.getMaxMp());
|
||||
Revive revive = new Revive(activeChar);
|
||||
|
Loading…
Reference in New Issue
Block a user