리니지 분류
SP팩기반sp7final 1.63 서버창의 나비켓 테이블 리로드를 위한 리로드 소스들[옆동네 펌]
컨텐츠 정보
- 29 조회
- 0 추천
- 0 비추천
-
목록
본문
우선 이건 서버창의 나비켓 테이블 수정후 서버 재오픈없이 갱신하는 소스입니다.
사용법은 Guimain.java에서 설정하시면 될거에요.
나비켓의 테이블 항목이랑 일치하는지 보세요.
기본적으로 각 소스의
static public void init () { <---기본로딩이고 이 항목을 바탕으로 만든게 리로드임
static public void reload() { <-- 리로드 기본로딩과 똑같은데 몇가지 함수 추가된거에요. init 이랑 set 항목이 같음.
여기에 없어도 단순한 테이블 리로드는 init 을 복사해서 한두가지만 수정해서 리로드로 사용할수 있을거에요.
리로드하면 모든게 바로 적용되는게 아니고 아이템 옵션의 경우는 새로만들어지는 아이템만 적용되고
인벤에 있는 아이템은 이전속성 그대로 입니다. 리스하면 적용되지만요.
마법같은건 바로 적용되고요. 이펙트같은것들도 바로 적용되요.
이소스는 다른팩에 있는거 가져왔습니다.
================================server_notice 테이블=======================================
lineage.database.ServerNoticeDatabase.java
public static void init(Connection con) {
.
.
.
static public void reload() {
TimeLine.start("server_notice 테이블 리로드 완료 - ");
list.clear();
list_static.clear();
Connection con = null;
PreparedStatement st = null;
ResultSet rs = null;
try {
// 무조건 표현할 공지 먼저 추출.
con = DatabaseConnection.getLineage();
st = con.prepareStatement("SELECT * FROM server_notice ORDER BY uid");
rs = st.executeQuery();
while (rs.next()) {
Notice n = new Notice();
n.setUid(rs.getInt("uid"));
n.setType(rs.getString("type"));
n.setSubject(rs.getString("subject"));
n.setContent(rs.getString("content"));
if (n.getType().equalsIgnoreCase("static"))
list_static.add(n);
else
list.add(n);
}
} catch (Exception e) {
lineage.share.System.printf("%s : reload()\r\n", ServerNoticeDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(con, st, rs);
}
TimeLine.end();
}
================================summon_list 테이블=======================================
lineage.database.SummonListDatabase.java
TimeLine.end();
}
static public void reload() {
TimeLine.start("summon_list 테이블 리로드 완료 - ");
list.clear();
PreparedStatement st = null;
ResultSet rs = null;
Connection con = null;
try {
con = DatabaseConnection.getLineage();
st = con.prepareStatement("SELECT * FROM summon_list");
rs = st.executeQuery();
while (rs.next()) {
Monster monster = MonsterDatabase.find(rs.getString("name"));
if (monster == null)
continue;
SummonList s = new SummonList();
s.setUid(rs.getInt("uid"));
s.setClassType(rs.getString("class_type"));
s.setName(monster.getName());
s.setMinLv(rs.getInt("minLv"));
s.setMaxLv(rs.getInt("maxLv"));
s.setNeedCha(rs.getInt("needCha"));
//s.setMaxCount(rs.getInt("max_count"));
s.setSummonLv(rs.getInt("summon_lv"));
s.setSummonHp(rs.getInt("summon_hp"));
s.setSummonMp(rs.getInt("summon_mp"));
s.setSummonStr(rs.getInt("summon_str"));
s.setSummonDex(rs.getInt("summon_dex"));
s.setSummonCon(rs.getInt("summon_con"));
s.setSummonWis(rs.getInt("summon_wis"));
s.setSummonInt(rs.getInt("summon_int"));
s.setSummonCha(rs.getInt("summon_cha"));
s.setSummonAction(rs.getInt("summon_action"));
s.setMonster(monster);
list.add(s);
}
} catch (Exception e) {
lineage.share.System.printf("%s : init(Connection con)\r\n", SummonListDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(st, rs);
}
TimeLine.end();
}
================================sprite_frame 테이블=======================================
lineage.database.SpriteFrameDatabase.java
TimeLine.end();
}
/**
*
* @param
* @return 2017-09-03 by all_night.
*/
static public void reload() {
TimeLine.start("sprite_frame 테이블 리로드 완료 - ");
list.clear();
PreparedStatement st = null;
ResultSet rs = null;
Connection con = null;
try {
con = DatabaseConnection.getLineage();
st = con.prepareStatement("SELECT * FROM sprite_frame");
rs = st.executeQuery();
while (rs.next()) {
int gfx = rs.getInt("gfx");
SpriteFrame spriteFrame = list.get(gfx);
if (spriteFrame == null) {
spriteFrame = new SpriteFrame();
spriteFrame.setGfx(gfx);
list.put(gfx, spriteFrame);
}
spriteFrame.getList().put(rs.getInt("action"), (rs.getInt("frame")));
}
} catch (Exception e) {
lineage.share.System.printf("%s : init(Connection con)\r\n", SpriteFrameDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(con, st, rs);
}
TimeLine.end();
}
================================poly 테이블=======================================
lineage.database.PolyDatabase.java
TimeLine.end();
}
/**
*
* @param
* @return 2017-09-03 by all_night.
*/
static public void reload() {
TimeLine.start("poly 테이블 리로드 완료 - ");
list.clear();
PreparedStatement st = null;
ResultSet rs = null;
Connection con = null;
try {
con = DatabaseConnection.getLineage();
st = con.prepareStatement("SELECT * FROM poly");
rs = st.executeQuery();
while (rs.next()) {
Poly p = new Poly();
p.setUid(rs.getInt("id"));
p.setName(rs.getString("name"));
p.setPolyName(rs.getString("db"));
p.setGfxId(rs.getInt("polyid"));
p.setGfxMode(rs.getInt("polymode"));
p.setMinLevel(rs.getInt("minlevel"));
p.setWeapon(rs.getInt("isWeapon"));
p.setHelm(rs.getInt("isHelm") == 1);
p.setEarring(rs.getInt("isEarring") == 1);
p.setNecklace(rs.getInt("isNecklace") == 1);
p.setT(rs.getInt("isT") == 1);
p.setArmor(rs.getInt("isArmor") == 1);
p.setCloak(rs.getInt("isCloak") == 1);
p.setRing(rs.getInt("isRing") == 1);
p.setBelt(rs.getInt("isBelt") == 1);
p.setGlove(rs.getInt("isGlove") == 1);
p.setShield(rs.getInt("isShield") == 1);
p.setBoots(rs.getInt("isBoots") == 1);
p.setGuarder(rs.getInt("isGuarder") == 1);
p.setSkill(rs.getInt("isSkill") == 1);
list.add(p);
}
} catch (Exception e) {
lineage.share.System.printf("%s : init(Connection con)\r\n", PolyDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(con, st, rs);
}
TimeLine.end();
}
================================npc_shop 테이블=======================================
lineage.database.NpcShopDatabase.java
TimeLine.end();
}
static public void reload() {
TimeLine.start("npc_shop 테이블 리로드 완료 - ");
PreparedStatement st = null;
ResultSet rs = null;
Connection con = null;
try {
for (Npc n : NpcDatabase.getList())
n.getShop_list().clear();
con = DatabaseConnection.getLineage();
st = con.prepareStatement("SELECT * FROM npc_shop ORDER BY uid");
rs = st.executeQuery();
while (rs.next()) {
Npc n = NpcDatabase.find(rs.getString("name"));
Item i = ItemDatabase.find(rs.getString("itemname"));
if (n != null && i != null) {
Shop s = new Shop();
s.setUid(rs.getInt("uid"));
s.setNpcName(rs.getString("name"));
s.setItemName(rs.getString("itemname"));
s.setItemCount(rs.getInt("itemcount"));
s.setItemBress(rs.getInt("itembress"));
s.setItemEnLevel(rs.getInt("itemenlevel"));
s.setItemTime(rs.getInt("itemtime"));
s.setItemSell(rs.getString("sell").equalsIgnoreCase("true"));
s.setItemBuy(rs.getString("buy").equalsIgnoreCase("true"));
s.setGamble(rs.getString("gamble").equalsIgnoreCase("true"));
s.setPrice(rs.getInt("price"));
s.setAdenType(rs.getString("aden_type"));
// 버그 방지. 기본값 아데나로 설정.
if (s.getAdenType() == null || s.getAdenType().length() <= 0)
s.setAdenType("아데나");
n.getShop_list().add(s);
}
}
} catch (Exception e) {
lineage.share.System.printf("%s : init(Connection con)\r\n", NpcShopDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(con, st, rs);
}
TimeLine.end();
}
================================monster_skill 테이블=======================================
이부분은 많아서 빨간 추가인데 검은색으로 표시한것도 있을수 있습니다.
lineage.bean.database.Monster.java
//private List<MonsterSkill> list_skill = new ArrayList<MonsterSkill>(); //검색후 아래처럼 변경 아니면 주석달고 추가
public List<MonsterSkill> list_skill = new ArrayList<MonsterSkill>();
lineage.world.World.java
import lineage.world.object.instance.MonsterInstance;
import lineage.world.object.instance.PcInstance;
public final class World {
static private Map<Integer, lineage.bean.lineage.Map> list;
static private List<PcInstance> pc_list;
static private List<MonsterInstance> monster_list;
static private Integer timer_time_idx;
static private Integer timer_item_idx;
static public void init(){
TimeLine.start("World..");
timer_time_idx = timer_item_idx = 0;
list = new HashMap<Integer, lineage.bean.lineage.Map>();
pc_list = new ArrayList<PcInstance>();
monster_list = new ArrayList<MonsterInstance>();
static public void appendPc(PcInstance pc){ //검색
if(pc == null)
return;
synchronized (pc_list) {
if(!pc_list.contains(pc))
pc_list.add(pc);
}
}
static public void appendMonster(MonsterInstance monster) {
if (monster == null)
return;
synchronized (monster_list) {
if (!monster_list.contains(monster))
monster_list.add(monster);
}
}
static public void removePc(PcInstance pc){
if(pc == null)
return;
synchronized (pc_list) {
pc_list.remove(pc);
}
}
static public void removeMonster(MonsterInstance monster) {
if (monster == null)
return;
synchronized (monster_list) {
monster_list.remove(monster);
}
}
static public List<PcInstance> getPcList() {
synchronized (pc_list) {
return new ArrayList<PcInstance>(pc_list);
}
}
static public List<MonsterInstance> getMonsterList() {
synchronized (monster_list) {
return monster_list;
}
}
/**
* 타이머가 주기적으로 호출함.
*/
static public void toTimer(long time) {
ServerDatabase.nextTime();
boolean is_item = ++timer_item_idx % 60 == 0;
// boolean is_time = ++timer_time_idx % 60 == 0;
boolean is_time = ServerDatabase.getLineageTimeMinute() != timer_time_idx;
// 월드에 드랍된 아이템을 모두 순회하면서 제거될 시간이 됫는지 확인후 제거 처리.
if (is_item && Lineage.world_item_delay != 0) {
timer_item_idx = 0;
for (lineage.bean.lineage.Map m : list.values())
m.clearWorldItem(time);
}
// 리니지 월드 시간 전송
if (is_time) {
timer_time_idx = ServerDatabase.getLineageTimeMinute();
toSender(S_WorldTime.clone(BasePacketPooling.getPool(S_WorldTime.class)));
}
}
lineage.bean.database.Boss.java
public int[] getLastTime() {
return last_time;
}
public void setLastTime(int[] last_time) {
this.last_time = last_time;
}
lineage.database.MonsterSkillDatabase.java
import lineage.world.World;
import lineage.world.object.instance.MonsterInstance;
TimeLine.end();
}
static public void reload() {
TimeLine.start("monster_skill 테이블 리로드 완료 - ");
for (Monster mon : MonsterDatabase.getList())
mon.list_skill.clear();
PreparedStatement st = null;
ResultSet rs = null;
Connection con = null;
try {
con = DatabaseConnection.getLineage();
st = con.prepareStatement("SELECT * FROM monster_skill ORDER BY uid");
rs = st.executeQuery();
while (rs.next()) {
Monster m = MonsterDatabase.find(rs.getString("monster"));
if (m != null) {
MonsterSkill ms = new MonsterSkill();
ms.setUid(rs.getInt("uid"));
ms.setName(rs.getString("name"));
ms.setMonster(rs.getString("monster"));
ms.setActionName(rs.getString("action_name"));
ms.setCastGfx(rs.getInt("effect"));
ms.setRange(rs.getInt("ranged"));
ms.setType(rs.getString("type"));
ms.setChance(rs.getInt("chance"));
ms.setMsg(rs.getString("msg"));
ms.setSkill(SkillDatabase.find(rs.getInt("skill_uid")));
ms.setHpConsume(rs.getInt("hpConsume"));
ms.setMpConsume(rs.getInt("mpConsume"));
ms.setMindmg(rs.getInt("dmgMin"));
ms.setMaxdmg(rs.getInt("dmgMax"));
ms.setBuffDuration(rs.getInt("duration"));
if (rs.getString("element").equalsIgnoreCase("none"))
ms.setElement(Lineage.ELEMENT_NONE);
else if (rs.getString("element").equalsIgnoreCase("wind"))
ms.setElement(Lineage.ELEMENT_WIND);
else if (rs.getString("element").equalsIgnoreCase("water"))
ms.setElement(Lineage.ELEMENT_WATER);
else if (rs.getString("element").equalsIgnoreCase("earth"))
ms.setElement(Lineage.ELEMENT_EARTH);
else if (rs.getString("element").equalsIgnoreCase("fire"))
ms.setElement(Lineage.ELEMENT_FIRE);
else if (rs.getString("element").equalsIgnoreCase("laser"))
ms.setElement(Lineage.ELEMENT_LASER);
ms.setOption(rs.getString("option"));
m.getSkillList().add(ms);
for (MonsterInstance mon : World.getMonsterList()) {
if (mon.getMonster().getName().equalsIgnoreCase(m.getName()))
mon.setMonster(m);
}
}
}
} catch (Exception e) {
lineage.share.System.printf("%s : reload()\r\n", MonsterSkillDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(con, st, rs);
}
TimeLine.end();
}
================================monster_spawnlist_boss 테이블=======================================
lineage.database.MonsterBossSpawnlistDatabase.java
TimeLine.end();
}
static public void reload() {
TimeLine.start("monster_spawnlist_boss 테이블 리로드 완료 - ");
List<Boss> tempList = new ArrayList<Boss>();
for (Boss b : list)
tempList.add(b);
list.clear();
PreparedStatement st = null;
ResultSet rs = null;
Connection con = null;
try {
con = DatabaseConnection.getLineage();
st = con.prepareStatement("SELECT * FROM monster_spawnlist_boss");
rs = st.executeQuery();
while (rs.next()) {
String name = rs.getString("name");
String monster = rs.getString("monster");
int spawn_x = rs.getInt("spawn_x");
int spawn_y = rs.getInt("spawn_y");
String spawn_map = rs.getString("spawn_map");
String spawn_time = rs.getString("spawn_time");
Monster mon = MonsterDatabase.find(monster);
if (mon != null) {
Boss b = new Boss();
b.setName(name);
b.setMon(mon);
b.setX(spawn_x);
b.setY(spawn_y);
// 맵 구분 추출.
StringTokenizer stt = new StringTokenizer(spawn_map, "|");
while(stt.hasMoreTokens()){
String map = stt.nextToken();
if(map.length() > 0)
b.getMap().add(Integer.valueOf(map));
}
// 스폰시간 구분 추출.
stt = new StringTokenizer(spawn_time, ",");
int[][] time = new int[stt.countTokens()][2];
int idx = 0;
while (stt.hasMoreTokens()) {
String boss_time = stt.nextToken();
String boss_h = boss_time.substring(0, boss_time.indexOf(":"));
String boss_m = boss_time.substring(boss_h.length() + 1, boss_time.length());
time[idx][0] = Integer.valueOf(boss_h);
time[idx][1] = Integer.valueOf(boss_m);
idx += 1;
}
b.setTime(time);
for (Boss tempBoss : tempList) {
if (tempBoss.getMon().getName().equalsIgnoreCase(b.getMon().getName()))
b.setLastTime(tempBoss.getLastTime());
}
list.add(b);
}
}
tempList.clear();
} catch (Exception e) {
lineage.share.System.printf("%s : reload()\r\n", MonsterBossSpawnlistDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(con, st, rs);
}
TimeLine.end();
}
================================monster_drop 테이블=======================================
lineage.share.Lineage.java
import lineage.bean.database.Drop;
import lineage.bean.database.FirstInventory;
// 고인첸 갯수 제한 설정.
static public int[] item_enchant_weapon_top = new int[255];
static public int[] item_enchant_armor_top = new int[255];
// 전체 드랍리스트
static public final List<Drop> drop_list = new ArrayList<Drop>();
lineage.database.MonsterDropDatabase.java
import lineage.bean.database.Monster;
import lineage.share.Lineage;
static public void init(Connection con){
TimeLine.start("MonsterDropDatabase..");
PreparedStatement st = null;
ResultSet rs = null;
try {
st = con.prepareStatement("SELECT * FROM monster_drop");
rs = st.executeQuery();
while(rs.next()){
Monster m = MonsterDatabase.find(rs.getString("monster_name"));
if(m != null){
Drop d = new Drop();
d.setName( rs.getString("name") );
d.setMonName( rs.getString("monster_name") );
d.setItemName( rs.getString("item_name") );
d.setItemBress( rs.getInt("item_bress") );
d.setItemEn( rs.getInt("item_en") );
d.setCountMin( rs.getInt("count_min") );
d.setCountMax( rs.getInt("count_max") );
d.setChance( rs.getInt("chance") );
m.getDropList().add(d);
Lineage.drop_list.add(d);
}
}
} catch (Exception e) {
lineage.share.System.printf("%s : init(Connection con)\r\n", MonsterDropDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(st, rs);
}
TimeLine.end();
}
static public void reload() {
TimeLine.start("monster_drop 테이블 리로드 완료 - ");
PreparedStatement st = null;
ResultSet rs = null;
Connection con = null;
Lineage.drop_list.clear();
try {
con = DatabaseConnection.getLineage();
st = con.prepareStatement("SELECT * FROM monster");
rs = st.executeQuery();
while (rs.next()) {
Monster m = MonsterDatabase.find(rs.getString("name"));
if (m != null)
m.getDropList().clear();
}
st.close();
rs.close();
st = con.prepareStatement("SELECT * FROM monster_drop");
rs = st.executeQuery();
while (rs.next()) {
Monster m = MonsterDatabase.find(rs.getString("monster_name"));
if (m != null) {
Drop d = new Drop();
d.setName(rs.getString("name"));
d.setMonName(rs.getString("monster_name"));
d.setItemName(rs.getString("item_name"));
d.setItemBress(rs.getInt("item_bress"));
d.setItemEn(rs.getInt("item_en"));
d.setCountMin(rs.getInt("count_min"));
d.setCountMax(rs.getInt("count_max"));
d.setChance( rs.getInt("chance") );
m.getDropList().add(d);
Lineage.drop_list.add(d);
}
}
} catch (Exception e) {
lineage.share.System.printf("%s : reload()\r\n", MonsterDropDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(con, st, rs);
}
TimeLine.end();
}
================================item_skill 테이블=======================================
lineage.database.ItemSkillDatabase.java
TimeLine.end();
}
static public void reload() {
TimeLine.start("item_skill 테이블 리로드 완료 - ");
list.clear();
PreparedStatement st = null;
ResultSet rs = null;
Connection con = null;
try {
con = DatabaseConnection.getLineage();
st = con.prepareStatement("SELECT * FROM item_skill");
rs = st.executeQuery();
while (rs.next()) {
ItemSkill i = new ItemSkill();
i.setName(rs.getString("name"));
i.setItem(rs.getString("item"));
i.setMinDmg(rs.getInt("min_dmg"));
i.setMaxDmg(rs.getInt("max_dmg"));
i.setRanged(rs.getInt("ranged"));
i.setSkill(rs.getInt("skill_uid"));
i.setDuration(rs.getInt("duration"));
i.setEffect(rs.getInt("effect"));
i.setEffectTarget(rs.getString("effect_target").equalsIgnoreCase("me"));
i.setChance(rs.getInt("chance"));
i.setOption(rs.getString("option"));
if(rs.getString("element").equalsIgnoreCase("water"))
i.setElement(Lineage.ELEMENT_WATER);
else if(rs.getString("element").equalsIgnoreCase("wind"))
i.setElement(Lineage.ELEMENT_WIND);
else if(rs.getString("element").equalsIgnoreCase("earth"))
i.setElement(Lineage.ELEMENT_EARTH);
else if(rs.getString("element").equalsIgnoreCase("fire"))
i.setElement(Lineage.ELEMENT_FIRE);
else if(rs.getString("element").equalsIgnoreCase("laser"))
i.setElement(Lineage.ELEMENT_LASER);
else if(rs.getString("element").equalsIgnoreCase("poison"))
i.setElement(Lineage.ELEMENT_POISON);
else
i.setElement(Lineage.ELEMENT_NONE);
list.add(i);
}
} catch (Exception e) {
lineage.share.System.printf("%s : init(Connection con)\r\n", ItemSkillDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(con, st, rs);
}
TimeLine.end();
}
================================item_bundle 테이블=======================================
lineage.database.ItemBundleDatabase.java
TimeLine.end();
}
static public void reload() {
TimeLine.start("item_bundle 테이블 리로드 완료 - ");
list.clear();
PreparedStatement st = null;
ResultSet rs = null;
Connection con = null;
try {
con = DatabaseConnection.getLineage();
st = con.prepareStatement("SELECT * FROM item_bundle");
rs = st.executeQuery();
while (rs.next()) {
ItemBundle ib = new ItemBundle();
ib.setName(rs.getString("name"));
ib.setItem(rs.getString("item"));
ib.setItemBless(rs.getInt("item_bless"));
ib.setItemEnchant(rs.getInt("item_enchant"));
ib.setItemCountMin(rs.getInt("item_count_min"));
ib.setItemCountMax(rs.getInt("item_count_max"));
ib.setItemChance(rs.getInt("item_chance"));
if(ib.getItemCountMin() <= 0)
ib.setItemCountMin(1);
if(ib.getItemCountMax() <= 0)
ib.setItemCountMax(1);
list.add(ib);
}
} catch (Exception e) {
lineage.share.System.printf("%s : reload()\r\n", ItemBundleDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(con, st, rs);
}
TimeLine.end();
}
================================item 테이블=======================================
lineage.database.ItemDatabase.java
TimeLine.end();
}
static public void reload() {
TimeLine.start("item 테이블 리로드 완료 - ");
list.clear();
PreparedStatement st = null;
ResultSet rs = null;
Connection con = null;
try {
con = DatabaseConnection.getLineage();
st = con.prepareStatement("SELECT * FROM item");
rs = st.executeQuery();
while (rs.next()) {
Item i = new Item();
i.setName( rs.getString("아이템이름") );
i.setType1( rs.getString("구분1") );
i.setType2( rs.getString("구분2") );
i.setNameId( rs.getString("NAMEID") );
i.setMaterial( getMaterial(rs.getString("재질")) );
i.setMaterialName( rs.getString("재질") );
i.setDmgMin( rs.getInt("최소데미지") );
i.setDmgMax( rs.getInt("최대데미지") );
i.setWeight( rs.getFloat("무게") );
i.setInvGfx( rs.getInt("인벤ID") );
i.setGroundGfx( rs.getInt("GFXID") );
i.setAction1( rs.getInt("ACTION1") );
i.setAction2( rs.getInt("ACTION2") );
i.setSell( rs.getString("판매").equalsIgnoreCase("true") );
i.setPiles( rs.getString("겹침").equalsIgnoreCase("true") );
i.setTrade( rs.getString("거래").equalsIgnoreCase("true") );
i.setDrop( rs.getString("드랍").equalsIgnoreCase("true") );
i.setWarehouse( rs.getString("창고").equalsIgnoreCase("true") );
i.setEnchant( rs.getString("인첸트").equalsIgnoreCase("true") );
i.setSafeEnchant( rs.getInt("안전인첸트") );
i.setRoyal( rs.getInt("군주") );
i.setKnight( rs.getInt("기사") );
i.setElf( rs.getInt("요정") );
i.setWizard( rs.getInt("마법사") );
i.setDarkElf( rs.getInt("다크엘프") );
i.setDragonKnight( rs.getInt("용기사") );
i.setBlackWizard( rs.getInt("환술사") );
i.setAddHit( rs.getInt("공격성공율") );
i.setAddMhit( rs.getInt("마법명중율") ); // 마법명중율 추가 이부분은 있는분만 추가하세요
i.setAddDmg( rs.getInt("추가타격치") );
i.setAc( rs.getInt("ac") );
i.setAddStr( rs.getInt("add_str") );
i.setAddDex( rs.getInt("add_dex") );
i.setAddCon( rs.getInt("add_con") );
i.setAddInt( rs.getInt("add_int") );
i.setAddWis( rs.getInt("add_wis") );
i.setAddCha( rs.getInt("add_cha") );
i.setAddHp( rs.getInt("HP증가") );
i.setAddMp( rs.getInt("MP증가") );
i.setAddSp( rs.getInt("SP증가") );
i.setAddMr( rs.getInt("MR증가") );
i.setCanbedmg( rs.getString("손상").equalsIgnoreCase("true") );
i.setLevelMin( rs.getInt("level_min") );
i.setLevelMax( rs.getInt("level_max") );
i.setEffect( rs.getInt("이펙트ID") );
i.setSetId( rs.getInt("셋트아이템ID") );
i.setContinuous( rs.getInt("continuous") );
i.setWaterress( rs.getInt("waterress") );
i.setWindress( rs.getInt("windress") );
i.setEarthress( rs.getInt("earthress") );
i.setFireress( rs.getInt("fireress") );
i.setAddWeight( rs.getFloat("add_weight") );
i.setTicHp( rs.getInt("tic_hp") );
i.setTicMp( rs.getInt("tic_mp") );
i.setShopPrice( rs.getInt("shop_price") );
i.setDropChance( rs.getInt("drop_chance") );
i.setGfxMode( getWeaponGfx(i.getType2()) );
i.setSlot( getSlot(i.getType2()) );
i.setEquippedSlot( getEquippedSlot(i.getType2()) );
i.setSolvent( rs.getInt("solvent") );
i.setBookChaoticZone( rs.getString("book_chaotic_zone").equalsIgnoreCase("true") );
i.setBookLawfulZone( rs.getString("book_lawful_zone").equalsIgnoreCase("true") );
i.setBookMomtreeZone( rs.getString("book_momtree_zone").equalsIgnoreCase("true") );
i.setBookNeutralZone( rs.getString("book_neutral_zone").equalsIgnoreCase("true") );
i.setBookTowerZone( rs.getString("book_tower_zone").equalsIgnoreCase("true") );
if(rs.getString("attribute_crystal").equalsIgnoreCase("earth"))
i.setAttributeCrystal(Lineage.ELEMENT_EARTH);
else if(rs.getString("attribute_crystal").equalsIgnoreCase("fire"))
i.setAttributeCrystal(Lineage.ELEMENT_FIRE);
else if(rs.getString("attribute_crystal").equalsIgnoreCase("wind"))
i.setAttributeCrystal(Lineage.ELEMENT_WIND);
else if(rs.getString("attribute_crystal").equalsIgnoreCase("water"))
i.setAttributeCrystal(Lineage.ELEMENT_WATER);
i.setPolyName( rs.getString("poly_name") );
i.setInventorySave( rs.getString("is_inventory_save").equalsIgnoreCase("true") );
i.setAqua( rs.getString("is_aqua").equalsIgnoreCase("true") );
i.setStealHp( rs.getInt("steal_hp") );
i.setStealMp( rs.getInt("steal_mp") );
i.setTohand( rs.getString("is_tohand").equalsIgnoreCase("true") );
i.setReduction( rs.getInt("reduction") );
i.setEnchantMr( rs.getInt("enchant_mr") );
i.setCriticalEffect( rs.getInt("critical_effect") );
try {
StringBuffer sb = new StringBuffer();
StringTokenizer stt = new StringTokenizer(i.getNameId(), " $ ");
while (stt.hasMoreTokens())
sb.append(stt.nextToken());
i.setNameIdNumber(Integer.valueOf(sb.toString().trim()));
} catch (Exception e) {
}
list.add(i);
}
} catch (Exception e) {
lineage.share.System.printf("%s : reload()\r\n", ItemDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(con, st, rs);
}
TimeLine.end();
}
================================notice.txt=======================================
lineage.world.controller.NoticeController.java
TimeLine.end();
}
static public void reload() {
TimeLine.start("notice.txt 파일 리로드 완료 - ");
real_notice.clear();
try {
BufferedReader lnrr = new BufferedReader(new FileReader("notice.txt"));
String line;
while ((line = lnrr.readLine()) != null) {
line = line.trim();
if (line.startsWith("#") || line.length() <= 0)
continue;
real_notice.add(line);
}
lnrr.close();
} catch (Exception e) {
lineage.share.System.printf("%s : init()\r\n", NoticeController.class.toString());
lineage.share.System.println(e);
}
TimeLine.end();
}
================================skill 테이블=======================================
lineage.database.CharactersDatabase.java
/**
* 스킬 정보 저장 함수.
* @param con
* @param pc
*/
static public void saveSkill(Connection con, PcInstance pc){
PreparedStatement st = null;
try {
List<Skill> list = SkillController.find(pc);
if(list!=null) {
//
st = con.prepareStatement( "DELETE FROM characters_skill WHERE cha_objId=?" );
st.setLong(1, pc.getObjectId());
st.executeUpdate();
st.close();
//
for(Skill s : list) {
st = con.prepareStatement( "INSERT INTO characters_skill SET cha_objId=?, cha_name=?, skill=?, skill_name=?" );
st.setLong(1, pc.getObjectId());
st.setString(2, pc.getName());
st.setInt(3, s.getUid());
st.setString(4, s.getName());
st.executeUpdate();
st.close();
}
}
} catch (Exception e) {
lineage.share.System.printf("%s : saveSkill(Connection con, PcInstance pc)\r\n", CharactersDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(st);
}
}
/**
* 스킬 정보 저장 리로드 함수
* @param con
* @param pc
*/
static public void reLoadSaveSkill(PcInstance pc) {
PreparedStatement st = null;
Connection con = null;
try {
con = DatabaseConnection.getLineage();
List<Skill> list = SkillController.find(pc);
if (list != null) {
//
st = con.prepareStatement("DELETE FROM characters_skill WHERE cha_objId=?");
st.setLong(1, pc.getObjectId());
st.executeUpdate();
st.close();
//
for (Skill s : list) {
st = con.prepareStatement( "INSERT INTO characters_skill SET cha_objId=?, cha_name=?, skill=?, skill_name=?");
st.setLong(1, pc.getObjectId());
st.setString(2, pc.getName());
st.setInt(3, s.getUid());
st.setString(4, s.getName());
st.executeUpdate();
st.close();
}
}
} catch (Exception e) {
lineage.share.System.printf("%s : saveSkill(Connection con, PcInstance pc)\r\n", CharactersDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(con, st);
}
}
lineage.database.SkillDatabase.java
TimeLine.end();
}
static public void reLoadSkill() {
TimeLine.start("skill 테이블 리로드 완료 - ");
synchronized (list) {
list.clear();
}
PreparedStatement st = null;
ResultSet rs = null;
Connection con = null;
try {
con = DatabaseConnection.getLineage();
st = con.prepareStatement("SELECT * FROM skill");
rs = st.executeQuery();
while (rs.next()) {
Skill s = new Skill();
s.setUid(rs.getInt(1));
s.setName(rs.getString(2));
s.setSkillLevel(rs.getInt(3));
s.setSkillNumber(rs.getInt(4));
s.setMpConsume(rs.getInt(5));
s.setHpConsume(rs.getInt(6));
s.setItemConsume(rs.getInt(7));
s.setItemConsumeCount(rs.getInt(8));
s.setBuffDuration(rs.getInt(9));
s.setMindmg(rs.getInt(10));
s.setMaxdmg(rs.getInt(11));
s.setId(rs.getInt(12));
s.setCastGfx(rs.getInt(13));
s.setRange(rs.getInt(14));
s.setLawfulConsume(rs.getInt(15));
s.setDelay(rs.getInt("delay"));
s.setLock(rs.getString("if_lock"));
if (s.getSkillLevel() == 1)
s.setPrice(100);
else if (s.getSkillLevel() == 2)
s.setPrice(400);
else
s.setPrice(900);
if (rs.getString("element").equalsIgnoreCase("none"))
s.setElement(Lineage.ELEMENT_NONE);
else if (rs.getString("element").equalsIgnoreCase("wind"))
s.setElement(Lineage.ELEMENT_WIND);
else if (rs.getString("element").equalsIgnoreCase("water"))
s.setElement(Lineage.ELEMENT_WATER);
else if (rs.getString("element").equalsIgnoreCase("earth"))
s.setElement(Lineage.ELEMENT_EARTH);
else if (rs.getString("element").equalsIgnoreCase("fire"))
s.setElement(Lineage.ELEMENT_FIRE);
else if (rs.getString("element").equalsIgnoreCase("laser"))
s.setElement(Lineage.ELEMENT_LASER);
else if (rs.getString("element").equalsIgnoreCase("poison"))
s.setElement(Lineage.ELEMENT_POISON);
synchronized (list) {
list.put(s.getUid(), s);
}
}
} catch (Exception e) {
lineage.share.System.printf("%s : init(Connection con)\r\n", SkillDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(con, st, rs);
}
list.put(1000, new Skill(1000, "구울 독"));
list.put(1001, new Skill(1001, "괴물눈 석화"));
list.put(1002, new Skill(1002, "채팅 금지"));
// 스킬 디비 로딩 알리기.
PluginController.init(SkillDatabase.class, "init", con, list);
TimeLine.end();
}
lineage.world.controller.CommandController.java
/**
* 속도
* @param o
*/
static public void toBuffspeed(object o){ //검색후 아래부분 추가
Bravery.init((Character)o, 9999);
Haste.init((Character)o, 9999);
}
/**
*
* @param
* @return 2017-08-29 by all_night.
*/
static public void serverMagicReload() {
for (PcInstance pc : World.getPcList()) {
CharactersDatabase.reLoadSaveSkill(pc);
SkillController.toWorldOut(pc);
}
SkillDatabase.reLoadSkill();
for (PcInstance pc : World.getPcList()) {
SkillController.toWorldJoin(pc);
CharactersDatabase.readSkill(pc);
}
}
}
================================monster 테이블=======================================
lineage.database.MonsterDatabase.java
static public void init(Connection con){
.
.
.
TimeLine.end();
}
static public void reload() {
TimeLine.start("monster 테이블 리로드 완료 - ");
list.clear();
PreparedStatement st = null;
ResultSet rs = null;
Connection con = null;
try {
con = DatabaseConnection.getLineage();
st = con.prepareStatement("SELECT * FROM monster");
rs = st.executeQuery();
while (rs.next()) {
Monster m = new Monster();
m.setName(rs.getString("name"));
m.setNameId(rs.getString("name_id"));
m.setGfx(rs.getInt("gfx"));
m.setGfxMode(rs.getInt("gfx_mode"));
m.setLevel(rs.getInt("level"));
m.setHp(rs.getInt("hp"));
m.setMp(rs.getInt("mp"));
m.setStealHp(rs.getInt("steal_hp"));
m.setStealMp(rs.getInt("steal_mp"));
m.setTicHp(rs.getInt("tic_hp"));
m.setTicMp(rs.getInt("tic_mp"));
m.setStr(rs.getInt("str"));
m.setDex(rs.getInt("dex"));
m.setCon(rs.getInt("con"));
m.setInt(rs.getInt("int"));
m.setWis(rs.getInt("wis"));
m.setCha(rs.getInt("cha"));
m.setMr(rs.getInt("mr"));
m.setAc(rs.getInt("ac"));
m.setExp(rs.getInt("exp"));
m.setLawful(rs.getInt("lawful"));
m.setSize(rs.getString("size"));
m.setFamily(rs.getString("family"));
m.setAtkType(rs.getInt("atk_type"));
m.setAtkRange(rs.getInt("atk_range"));
m.setAtkInvis(rs.getString("atk_invis").equalsIgnoreCase("true"));
m.setAtkPoly(rs.getString("atk_poly").equalsIgnoreCase("true"));
m.setDie(rs.getString("is_die").equalsIgnoreCase("true"));
m.setPickup(rs.getString("is_pickup").equalsIgnoreCase("true"));
m.setTame(rs.getString("is_tame").equalsIgnoreCase("true"));
m.setRevival(rs.getString("is_revival").equalsIgnoreCase("true"));
m.setToughskin(rs.getString("is_toughskin").equalsIgnoreCase("true"));
m.setAdenDrop(rs.getString("is_adendrop").equalsIgnoreCase("true"));
m.setBuff(rs.getString("is_buff").equalsIgnoreCase("true"));
m.setResistanceEarth(rs.getInt("resistance_earth"));
m.setResistanceFire(rs.getInt("resistance_fire"));
m.setResistanceWind(rs.getInt("resistance_wind"));
m.setResistanceWater(rs.getInt("resistance_water"));
m.setResistanceUndead(rs.getInt("resistance_undead"));
m.setArrowGfx( rs.getInt("arrowGfx") );
m.setMsgAtkTime( init(rs.getString("msg_atk"), m.getMsgAtk()) * 1000 );
m.setMsgDieTime( init(rs.getString("msg_die"), m.getMsgDie()) * 1000 );
m.setMsgSpawnTime( init(rs.getString("msg_spawn"), m.getMsgSpawn()) * 1000 );
m.setMsgEscapeTime( init(rs.getString("msg_escape"), m.getMsgEscape()) * 1000 );
m.setMsgWalkTime( init(rs.getString("msg_walk"), m.getMsgWalk()) * 1000 );
// exp 테이블값 의존한 경험치지급 값 설정.
if (Lineage.monster_level_exp) {
Exp exp = ExpDatabase.find(m.getLevel());
if (exp != null) {
int i = 1;
if (exp.getLevel() < 48)
i = 1;
else if (exp.getLevel() < 65)
i = 2;
else if (exp.getLevel() < 70)
i = 3;
else if (exp.getLevel() < 75)
i = 4;
else if (exp.getLevel() < 79)
i = 5;
else
i = 6 + (exp.getLevel() - 79);
// 레벨에따라 해당경험치에 반을 계속 나누고
// 그값에 2%에 해당하는 값만 지급하기.
double gab = exp.getExp();
for (; i > 1; --i)
gab /= 2;
gab /= 98;
m.setExp(m.getExp() + (int) (Math.round(gab)));
}
}
// 라우풀 값 확인.
if (m.getLawful() >= 0 && m.getLawful() < Lineage.CHAOTIC)
m.setLawful(m.getLawful() + Lineage.NEUTRAL);
try {
StringBuffer sb = new StringBuffer();
StringTokenizer stt = new StringTokenizer(rs.getString("name_id"), " $ ");
while (stt.hasMoreTokens())
sb.append(stt.nextToken());
m.setNameIdNumber(Integer.valueOf(sb.toString().trim()));
} catch (Exception e) {
}
list.add(m);
}
} catch (Exception e) {
lineage.share.System.printf("%s : reload()\r\n", MonsterDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(con, st, rs);
}
TimeLine.end();
}
================================npc 테이블=======================================
lineage.database.NpcDatabase.java
static public void init(Connection con){
.
.
.
TimeLine.end();
}
static public void reload() {
TimeLine.start("npc 테이블 리로드 - ");
synchronized (list) {
list.clear();
PreparedStatement st = null;
ResultSet rs = null;
Connection con = null;
try {
con = DatabaseConnection.getLineage();
st = con.prepareStatement("SELECT * FROM npc");
rs = st.executeQuery();
while (rs.next()) {
Npc n = new Npc();
n.setName( rs.getString("name") );
n.setType( rs.getString("type") );
n.setNameId( rs.getString("nameid") );
n.setGfx( rs.getInt("gfxid") );
n.setGfxMode( rs.getInt("gfxMode") );
n.setHp( rs.getInt("hp") );
n.setLawful( rs.getInt("lawful") );
n.setLight( rs.getInt("light") );
n.setAi( rs.getString("ai").equalsIgnoreCase("true") );
n.setAreaAtk( rs.getInt("areaatk") );
n.setArrowGfx( rs.getInt("arrowGfx") );
if(n.getLawful()<Lineage.CHAOTIC)
n.setLawful( n.getLawful() + Lineage.NEUTRAL );
try {
StringBuffer sb = new StringBuffer();
StringTokenizer stt = new StringTokenizer(rs.getString("nameid"), " $ ");
while (stt.hasMoreTokens())
sb.append(stt.nextToken());
n.setNameIdNumber( Integer.valueOf(sb.toString().trim()) );
} catch (Exception e) { }
list.add( n );
}
} catch (Exception e) {
lineage.share.System.printf("%s : reload()\r\n", NpcDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(con, st, rs);
}
}
TimeLine.end();
NpcShopDatabase.reload();
NpcSpawnlistDatabase.reload();
}
=======================================================================
lineage.database.NpcSpawnlistDatabase.java
import lineage.world.World;
import lineage.world.controller.CharacterController;
import lineage.world.object.instance.NpcInstance;
import lineage.world.object.instance.ShopInstance;
public final class NpcSpawnlistDatabase {
static private List<object> pool;
static private List<object> list;
static private List<ShopInstance> list_shop;
static public void init(Connection con){
.
.
.
TimeLine.end();
}
static public void reload() {
synchronized (list_shop) {
for (object o : list) {
o.clearList(true);
World.remove(o);
o.close();
CharacterController.toWorldOut(o);
}
list_shop.clear();
list.clear();
PreparedStatement st = null;
ResultSet rs = null;
Connection con = null;
try {
con = DatabaseConnection.getLineage();
st = con.prepareStatement("SELECT * FROM npc_spawnlist");
rs = st.executeQuery();
while (rs.next()) {
toSpawnNpc(rs.getString("name"), rs.getString("npcName"), rs.getString("title"), rs.getInt("locX"), rs.getInt("locY"), rs.getInt("locMap"), rs.getInt("heading"), rs.getInt("respawn"));
}
} catch (Exception e) {
lineage.share.System.printf("%s : reload()\r\n", NpcSpawnlistDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(con, st, rs);
}
}
}
사용법은 Guimain.java에서 설정하시면 될거에요.
나비켓의 테이블 항목이랑 일치하는지 보세요.
기본적으로 각 소스의
static public void init () { <---기본로딩이고 이 항목을 바탕으로 만든게 리로드임
static public void reload() { <-- 리로드 기본로딩과 똑같은데 몇가지 함수 추가된거에요. init 이랑 set 항목이 같음.
여기에 없어도 단순한 테이블 리로드는 init 을 복사해서 한두가지만 수정해서 리로드로 사용할수 있을거에요.
리로드하면 모든게 바로 적용되는게 아니고 아이템 옵션의 경우는 새로만들어지는 아이템만 적용되고
인벤에 있는 아이템은 이전속성 그대로 입니다. 리스하면 적용되지만요.
마법같은건 바로 적용되고요. 이펙트같은것들도 바로 적용되요.
이소스는 다른팩에 있는거 가져왔습니다.
================================server_notice 테이블=======================================
lineage.database.ServerNoticeDatabase.java
public static void init(Connection con) {
.
.
.
static public void reload() {
TimeLine.start("server_notice 테이블 리로드 완료 - ");
list.clear();
list_static.clear();
Connection con = null;
PreparedStatement st = null;
ResultSet rs = null;
try {
// 무조건 표현할 공지 먼저 추출.
con = DatabaseConnection.getLineage();
st = con.prepareStatement("SELECT * FROM server_notice ORDER BY uid");
rs = st.executeQuery();
while (rs.next()) {
Notice n = new Notice();
n.setUid(rs.getInt("uid"));
n.setType(rs.getString("type"));
n.setSubject(rs.getString("subject"));
n.setContent(rs.getString("content"));
if (n.getType().equalsIgnoreCase("static"))
list_static.add(n);
else
list.add(n);
}
} catch (Exception e) {
lineage.share.System.printf("%s : reload()\r\n", ServerNoticeDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(con, st, rs);
}
TimeLine.end();
}
================================summon_list 테이블=======================================
lineage.database.SummonListDatabase.java
TimeLine.end();
}
static public void reload() {
TimeLine.start("summon_list 테이블 리로드 완료 - ");
list.clear();
PreparedStatement st = null;
ResultSet rs = null;
Connection con = null;
try {
con = DatabaseConnection.getLineage();
st = con.prepareStatement("SELECT * FROM summon_list");
rs = st.executeQuery();
while (rs.next()) {
Monster monster = MonsterDatabase.find(rs.getString("name"));
if (monster == null)
continue;
SummonList s = new SummonList();
s.setUid(rs.getInt("uid"));
s.setClassType(rs.getString("class_type"));
s.setName(monster.getName());
s.setMinLv(rs.getInt("minLv"));
s.setMaxLv(rs.getInt("maxLv"));
s.setNeedCha(rs.getInt("needCha"));
//s.setMaxCount(rs.getInt("max_count"));
s.setSummonLv(rs.getInt("summon_lv"));
s.setSummonHp(rs.getInt("summon_hp"));
s.setSummonMp(rs.getInt("summon_mp"));
s.setSummonStr(rs.getInt("summon_str"));
s.setSummonDex(rs.getInt("summon_dex"));
s.setSummonCon(rs.getInt("summon_con"));
s.setSummonWis(rs.getInt("summon_wis"));
s.setSummonInt(rs.getInt("summon_int"));
s.setSummonCha(rs.getInt("summon_cha"));
s.setSummonAction(rs.getInt("summon_action"));
s.setMonster(monster);
list.add(s);
}
} catch (Exception e) {
lineage.share.System.printf("%s : init(Connection con)\r\n", SummonListDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(st, rs);
}
TimeLine.end();
}
================================sprite_frame 테이블=======================================
lineage.database.SpriteFrameDatabase.java
TimeLine.end();
}
/**
*
* @param
* @return 2017-09-03 by all_night.
*/
static public void reload() {
TimeLine.start("sprite_frame 테이블 리로드 완료 - ");
list.clear();
PreparedStatement st = null;
ResultSet rs = null;
Connection con = null;
try {
con = DatabaseConnection.getLineage();
st = con.prepareStatement("SELECT * FROM sprite_frame");
rs = st.executeQuery();
while (rs.next()) {
int gfx = rs.getInt("gfx");
SpriteFrame spriteFrame = list.get(gfx);
if (spriteFrame == null) {
spriteFrame = new SpriteFrame();
spriteFrame.setGfx(gfx);
list.put(gfx, spriteFrame);
}
spriteFrame.getList().put(rs.getInt("action"), (rs.getInt("frame")));
}
} catch (Exception e) {
lineage.share.System.printf("%s : init(Connection con)\r\n", SpriteFrameDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(con, st, rs);
}
TimeLine.end();
}
================================poly 테이블=======================================
lineage.database.PolyDatabase.java
TimeLine.end();
}
/**
*
* @param
* @return 2017-09-03 by all_night.
*/
static public void reload() {
TimeLine.start("poly 테이블 리로드 완료 - ");
list.clear();
PreparedStatement st = null;
ResultSet rs = null;
Connection con = null;
try {
con = DatabaseConnection.getLineage();
st = con.prepareStatement("SELECT * FROM poly");
rs = st.executeQuery();
while (rs.next()) {
Poly p = new Poly();
p.setUid(rs.getInt("id"));
p.setName(rs.getString("name"));
p.setPolyName(rs.getString("db"));
p.setGfxId(rs.getInt("polyid"));
p.setGfxMode(rs.getInt("polymode"));
p.setMinLevel(rs.getInt("minlevel"));
p.setWeapon(rs.getInt("isWeapon"));
p.setHelm(rs.getInt("isHelm") == 1);
p.setEarring(rs.getInt("isEarring") == 1);
p.setNecklace(rs.getInt("isNecklace") == 1);
p.setT(rs.getInt("isT") == 1);
p.setArmor(rs.getInt("isArmor") == 1);
p.setCloak(rs.getInt("isCloak") == 1);
p.setRing(rs.getInt("isRing") == 1);
p.setBelt(rs.getInt("isBelt") == 1);
p.setGlove(rs.getInt("isGlove") == 1);
p.setShield(rs.getInt("isShield") == 1);
p.setBoots(rs.getInt("isBoots") == 1);
p.setGuarder(rs.getInt("isGuarder") == 1);
p.setSkill(rs.getInt("isSkill") == 1);
list.add(p);
}
} catch (Exception e) {
lineage.share.System.printf("%s : init(Connection con)\r\n", PolyDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(con, st, rs);
}
TimeLine.end();
}
================================npc_shop 테이블=======================================
lineage.database.NpcShopDatabase.java
TimeLine.end();
}
static public void reload() {
TimeLine.start("npc_shop 테이블 리로드 완료 - ");
PreparedStatement st = null;
ResultSet rs = null;
Connection con = null;
try {
for (Npc n : NpcDatabase.getList())
n.getShop_list().clear();
con = DatabaseConnection.getLineage();
st = con.prepareStatement("SELECT * FROM npc_shop ORDER BY uid");
rs = st.executeQuery();
while (rs.next()) {
Npc n = NpcDatabase.find(rs.getString("name"));
Item i = ItemDatabase.find(rs.getString("itemname"));
if (n != null && i != null) {
Shop s = new Shop();
s.setUid(rs.getInt("uid"));
s.setNpcName(rs.getString("name"));
s.setItemName(rs.getString("itemname"));
s.setItemCount(rs.getInt("itemcount"));
s.setItemBress(rs.getInt("itembress"));
s.setItemEnLevel(rs.getInt("itemenlevel"));
s.setItemTime(rs.getInt("itemtime"));
s.setItemSell(rs.getString("sell").equalsIgnoreCase("true"));
s.setItemBuy(rs.getString("buy").equalsIgnoreCase("true"));
s.setGamble(rs.getString("gamble").equalsIgnoreCase("true"));
s.setPrice(rs.getInt("price"));
s.setAdenType(rs.getString("aden_type"));
// 버그 방지. 기본값 아데나로 설정.
if (s.getAdenType() == null || s.getAdenType().length() <= 0)
s.setAdenType("아데나");
n.getShop_list().add(s);
}
}
} catch (Exception e) {
lineage.share.System.printf("%s : init(Connection con)\r\n", NpcShopDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(con, st, rs);
}
TimeLine.end();
}
================================monster_skill 테이블=======================================
이부분은 많아서 빨간 추가인데 검은색으로 표시한것도 있을수 있습니다.
lineage.bean.database.Monster.java
//private List<MonsterSkill> list_skill = new ArrayList<MonsterSkill>(); //검색후 아래처럼 변경 아니면 주석달고 추가
public List<MonsterSkill> list_skill = new ArrayList<MonsterSkill>();
lineage.world.World.java
import lineage.world.object.instance.MonsterInstance;
import lineage.world.object.instance.PcInstance;
public final class World {
static private Map<Integer, lineage.bean.lineage.Map> list;
static private List<PcInstance> pc_list;
static private List<MonsterInstance> monster_list;
static private Integer timer_time_idx;
static private Integer timer_item_idx;
static public void init(){
TimeLine.start("World..");
timer_time_idx = timer_item_idx = 0;
list = new HashMap<Integer, lineage.bean.lineage.Map>();
pc_list = new ArrayList<PcInstance>();
monster_list = new ArrayList<MonsterInstance>();
static public void appendPc(PcInstance pc){ //검색
if(pc == null)
return;
synchronized (pc_list) {
if(!pc_list.contains(pc))
pc_list.add(pc);
}
}
static public void appendMonster(MonsterInstance monster) {
if (monster == null)
return;
synchronized (monster_list) {
if (!monster_list.contains(monster))
monster_list.add(monster);
}
}
static public void removePc(PcInstance pc){
if(pc == null)
return;
synchronized (pc_list) {
pc_list.remove(pc);
}
}
static public void removeMonster(MonsterInstance monster) {
if (monster == null)
return;
synchronized (monster_list) {
monster_list.remove(monster);
}
}
static public List<PcInstance> getPcList() {
synchronized (pc_list) {
return new ArrayList<PcInstance>(pc_list);
}
}
static public List<MonsterInstance> getMonsterList() {
synchronized (monster_list) {
return monster_list;
}
}
/**
* 타이머가 주기적으로 호출함.
*/
static public void toTimer(long time) {
ServerDatabase.nextTime();
boolean is_item = ++timer_item_idx % 60 == 0;
// boolean is_time = ++timer_time_idx % 60 == 0;
boolean is_time = ServerDatabase.getLineageTimeMinute() != timer_time_idx;
// 월드에 드랍된 아이템을 모두 순회하면서 제거될 시간이 됫는지 확인후 제거 처리.
if (is_item && Lineage.world_item_delay != 0) {
timer_item_idx = 0;
for (lineage.bean.lineage.Map m : list.values())
m.clearWorldItem(time);
}
// 리니지 월드 시간 전송
if (is_time) {
timer_time_idx = ServerDatabase.getLineageTimeMinute();
toSender(S_WorldTime.clone(BasePacketPooling.getPool(S_WorldTime.class)));
}
}
lineage.bean.database.Boss.java
public int[] getLastTime() {
return last_time;
}
public void setLastTime(int[] last_time) {
this.last_time = last_time;
}
lineage.database.MonsterSkillDatabase.java
import lineage.world.World;
import lineage.world.object.instance.MonsterInstance;
TimeLine.end();
}
static public void reload() {
TimeLine.start("monster_skill 테이블 리로드 완료 - ");
for (Monster mon : MonsterDatabase.getList())
mon.list_skill.clear();
PreparedStatement st = null;
ResultSet rs = null;
Connection con = null;
try {
con = DatabaseConnection.getLineage();
st = con.prepareStatement("SELECT * FROM monster_skill ORDER BY uid");
rs = st.executeQuery();
while (rs.next()) {
Monster m = MonsterDatabase.find(rs.getString("monster"));
if (m != null) {
MonsterSkill ms = new MonsterSkill();
ms.setUid(rs.getInt("uid"));
ms.setName(rs.getString("name"));
ms.setMonster(rs.getString("monster"));
ms.setActionName(rs.getString("action_name"));
ms.setCastGfx(rs.getInt("effect"));
ms.setRange(rs.getInt("ranged"));
ms.setType(rs.getString("type"));
ms.setChance(rs.getInt("chance"));
ms.setMsg(rs.getString("msg"));
ms.setSkill(SkillDatabase.find(rs.getInt("skill_uid")));
ms.setHpConsume(rs.getInt("hpConsume"));
ms.setMpConsume(rs.getInt("mpConsume"));
ms.setMindmg(rs.getInt("dmgMin"));
ms.setMaxdmg(rs.getInt("dmgMax"));
ms.setBuffDuration(rs.getInt("duration"));
if (rs.getString("element").equalsIgnoreCase("none"))
ms.setElement(Lineage.ELEMENT_NONE);
else if (rs.getString("element").equalsIgnoreCase("wind"))
ms.setElement(Lineage.ELEMENT_WIND);
else if (rs.getString("element").equalsIgnoreCase("water"))
ms.setElement(Lineage.ELEMENT_WATER);
else if (rs.getString("element").equalsIgnoreCase("earth"))
ms.setElement(Lineage.ELEMENT_EARTH);
else if (rs.getString("element").equalsIgnoreCase("fire"))
ms.setElement(Lineage.ELEMENT_FIRE);
else if (rs.getString("element").equalsIgnoreCase("laser"))
ms.setElement(Lineage.ELEMENT_LASER);
ms.setOption(rs.getString("option"));
m.getSkillList().add(ms);
for (MonsterInstance mon : World.getMonsterList()) {
if (mon.getMonster().getName().equalsIgnoreCase(m.getName()))
mon.setMonster(m);
}
}
}
} catch (Exception e) {
lineage.share.System.printf("%s : reload()\r\n", MonsterSkillDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(con, st, rs);
}
TimeLine.end();
}
================================monster_spawnlist_boss 테이블=======================================
lineage.database.MonsterBossSpawnlistDatabase.java
TimeLine.end();
}
static public void reload() {
TimeLine.start("monster_spawnlist_boss 테이블 리로드 완료 - ");
List<Boss> tempList = new ArrayList<Boss>();
for (Boss b : list)
tempList.add(b);
list.clear();
PreparedStatement st = null;
ResultSet rs = null;
Connection con = null;
try {
con = DatabaseConnection.getLineage();
st = con.prepareStatement("SELECT * FROM monster_spawnlist_boss");
rs = st.executeQuery();
while (rs.next()) {
String name = rs.getString("name");
String monster = rs.getString("monster");
int spawn_x = rs.getInt("spawn_x");
int spawn_y = rs.getInt("spawn_y");
String spawn_map = rs.getString("spawn_map");
String spawn_time = rs.getString("spawn_time");
Monster mon = MonsterDatabase.find(monster);
if (mon != null) {
Boss b = new Boss();
b.setName(name);
b.setMon(mon);
b.setX(spawn_x);
b.setY(spawn_y);
// 맵 구분 추출.
StringTokenizer stt = new StringTokenizer(spawn_map, "|");
while(stt.hasMoreTokens()){
String map = stt.nextToken();
if(map.length() > 0)
b.getMap().add(Integer.valueOf(map));
}
// 스폰시간 구분 추출.
stt = new StringTokenizer(spawn_time, ",");
int[][] time = new int[stt.countTokens()][2];
int idx = 0;
while (stt.hasMoreTokens()) {
String boss_time = stt.nextToken();
String boss_h = boss_time.substring(0, boss_time.indexOf(":"));
String boss_m = boss_time.substring(boss_h.length() + 1, boss_time.length());
time[idx][0] = Integer.valueOf(boss_h);
time[idx][1] = Integer.valueOf(boss_m);
idx += 1;
}
b.setTime(time);
for (Boss tempBoss : tempList) {
if (tempBoss.getMon().getName().equalsIgnoreCase(b.getMon().getName()))
b.setLastTime(tempBoss.getLastTime());
}
list.add(b);
}
}
tempList.clear();
} catch (Exception e) {
lineage.share.System.printf("%s : reload()\r\n", MonsterBossSpawnlistDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(con, st, rs);
}
TimeLine.end();
}
================================monster_drop 테이블=======================================
lineage.share.Lineage.java
import lineage.bean.database.Drop;
import lineage.bean.database.FirstInventory;
// 고인첸 갯수 제한 설정.
static public int[] item_enchant_weapon_top = new int[255];
static public int[] item_enchant_armor_top = new int[255];
// 전체 드랍리스트
static public final List<Drop> drop_list = new ArrayList<Drop>();
lineage.database.MonsterDropDatabase.java
import lineage.bean.database.Monster;
import lineage.share.Lineage;
static public void init(Connection con){
TimeLine.start("MonsterDropDatabase..");
PreparedStatement st = null;
ResultSet rs = null;
try {
st = con.prepareStatement("SELECT * FROM monster_drop");
rs = st.executeQuery();
while(rs.next()){
Monster m = MonsterDatabase.find(rs.getString("monster_name"));
if(m != null){
Drop d = new Drop();
d.setName( rs.getString("name") );
d.setMonName( rs.getString("monster_name") );
d.setItemName( rs.getString("item_name") );
d.setItemBress( rs.getInt("item_bress") );
d.setItemEn( rs.getInt("item_en") );
d.setCountMin( rs.getInt("count_min") );
d.setCountMax( rs.getInt("count_max") );
d.setChance( rs.getInt("chance") );
m.getDropList().add(d);
Lineage.drop_list.add(d);
}
}
} catch (Exception e) {
lineage.share.System.printf("%s : init(Connection con)\r\n", MonsterDropDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(st, rs);
}
TimeLine.end();
}
static public void reload() {
TimeLine.start("monster_drop 테이블 리로드 완료 - ");
PreparedStatement st = null;
ResultSet rs = null;
Connection con = null;
Lineage.drop_list.clear();
try {
con = DatabaseConnection.getLineage();
st = con.prepareStatement("SELECT * FROM monster");
rs = st.executeQuery();
while (rs.next()) {
Monster m = MonsterDatabase.find(rs.getString("name"));
if (m != null)
m.getDropList().clear();
}
st.close();
rs.close();
st = con.prepareStatement("SELECT * FROM monster_drop");
rs = st.executeQuery();
while (rs.next()) {
Monster m = MonsterDatabase.find(rs.getString("monster_name"));
if (m != null) {
Drop d = new Drop();
d.setName(rs.getString("name"));
d.setMonName(rs.getString("monster_name"));
d.setItemName(rs.getString("item_name"));
d.setItemBress(rs.getInt("item_bress"));
d.setItemEn(rs.getInt("item_en"));
d.setCountMin(rs.getInt("count_min"));
d.setCountMax(rs.getInt("count_max"));
d.setChance( rs.getInt("chance") );
m.getDropList().add(d);
Lineage.drop_list.add(d);
}
}
} catch (Exception e) {
lineage.share.System.printf("%s : reload()\r\n", MonsterDropDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(con, st, rs);
}
TimeLine.end();
}
================================item_skill 테이블=======================================
lineage.database.ItemSkillDatabase.java
TimeLine.end();
}
static public void reload() {
TimeLine.start("item_skill 테이블 리로드 완료 - ");
list.clear();
PreparedStatement st = null;
ResultSet rs = null;
Connection con = null;
try {
con = DatabaseConnection.getLineage();
st = con.prepareStatement("SELECT * FROM item_skill");
rs = st.executeQuery();
while (rs.next()) {
ItemSkill i = new ItemSkill();
i.setName(rs.getString("name"));
i.setItem(rs.getString("item"));
i.setMinDmg(rs.getInt("min_dmg"));
i.setMaxDmg(rs.getInt("max_dmg"));
i.setRanged(rs.getInt("ranged"));
i.setSkill(rs.getInt("skill_uid"));
i.setDuration(rs.getInt("duration"));
i.setEffect(rs.getInt("effect"));
i.setEffectTarget(rs.getString("effect_target").equalsIgnoreCase("me"));
i.setChance(rs.getInt("chance"));
i.setOption(rs.getString("option"));
if(rs.getString("element").equalsIgnoreCase("water"))
i.setElement(Lineage.ELEMENT_WATER);
else if(rs.getString("element").equalsIgnoreCase("wind"))
i.setElement(Lineage.ELEMENT_WIND);
else if(rs.getString("element").equalsIgnoreCase("earth"))
i.setElement(Lineage.ELEMENT_EARTH);
else if(rs.getString("element").equalsIgnoreCase("fire"))
i.setElement(Lineage.ELEMENT_FIRE);
else if(rs.getString("element").equalsIgnoreCase("laser"))
i.setElement(Lineage.ELEMENT_LASER);
else if(rs.getString("element").equalsIgnoreCase("poison"))
i.setElement(Lineage.ELEMENT_POISON);
else
i.setElement(Lineage.ELEMENT_NONE);
list.add(i);
}
} catch (Exception e) {
lineage.share.System.printf("%s : init(Connection con)\r\n", ItemSkillDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(con, st, rs);
}
TimeLine.end();
}
================================item_bundle 테이블=======================================
lineage.database.ItemBundleDatabase.java
TimeLine.end();
}
static public void reload() {
TimeLine.start("item_bundle 테이블 리로드 완료 - ");
list.clear();
PreparedStatement st = null;
ResultSet rs = null;
Connection con = null;
try {
con = DatabaseConnection.getLineage();
st = con.prepareStatement("SELECT * FROM item_bundle");
rs = st.executeQuery();
while (rs.next()) {
ItemBundle ib = new ItemBundle();
ib.setName(rs.getString("name"));
ib.setItem(rs.getString("item"));
ib.setItemBless(rs.getInt("item_bless"));
ib.setItemEnchant(rs.getInt("item_enchant"));
ib.setItemCountMin(rs.getInt("item_count_min"));
ib.setItemCountMax(rs.getInt("item_count_max"));
ib.setItemChance(rs.getInt("item_chance"));
if(ib.getItemCountMin() <= 0)
ib.setItemCountMin(1);
if(ib.getItemCountMax() <= 0)
ib.setItemCountMax(1);
list.add(ib);
}
} catch (Exception e) {
lineage.share.System.printf("%s : reload()\r\n", ItemBundleDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(con, st, rs);
}
TimeLine.end();
}
================================item 테이블=======================================
lineage.database.ItemDatabase.java
TimeLine.end();
}
static public void reload() {
TimeLine.start("item 테이블 리로드 완료 - ");
list.clear();
PreparedStatement st = null;
ResultSet rs = null;
Connection con = null;
try {
con = DatabaseConnection.getLineage();
st = con.prepareStatement("SELECT * FROM item");
rs = st.executeQuery();
while (rs.next()) {
Item i = new Item();
i.setName( rs.getString("아이템이름") );
i.setType1( rs.getString("구분1") );
i.setType2( rs.getString("구분2") );
i.setNameId( rs.getString("NAMEID") );
i.setMaterial( getMaterial(rs.getString("재질")) );
i.setMaterialName( rs.getString("재질") );
i.setDmgMin( rs.getInt("최소데미지") );
i.setDmgMax( rs.getInt("최대데미지") );
i.setWeight( rs.getFloat("무게") );
i.setInvGfx( rs.getInt("인벤ID") );
i.setGroundGfx( rs.getInt("GFXID") );
i.setAction1( rs.getInt("ACTION1") );
i.setAction2( rs.getInt("ACTION2") );
i.setSell( rs.getString("판매").equalsIgnoreCase("true") );
i.setPiles( rs.getString("겹침").equalsIgnoreCase("true") );
i.setTrade( rs.getString("거래").equalsIgnoreCase("true") );
i.setDrop( rs.getString("드랍").equalsIgnoreCase("true") );
i.setWarehouse( rs.getString("창고").equalsIgnoreCase("true") );
i.setEnchant( rs.getString("인첸트").equalsIgnoreCase("true") );
i.setSafeEnchant( rs.getInt("안전인첸트") );
i.setRoyal( rs.getInt("군주") );
i.setKnight( rs.getInt("기사") );
i.setElf( rs.getInt("요정") );
i.setWizard( rs.getInt("마법사") );
i.setDarkElf( rs.getInt("다크엘프") );
i.setDragonKnight( rs.getInt("용기사") );
i.setBlackWizard( rs.getInt("환술사") );
i.setAddHit( rs.getInt("공격성공율") );
i.setAddMhit( rs.getInt("마법명중율") ); // 마법명중율 추가 이부분은 있는분만 추가하세요
i.setAddDmg( rs.getInt("추가타격치") );
i.setAc( rs.getInt("ac") );
i.setAddStr( rs.getInt("add_str") );
i.setAddDex( rs.getInt("add_dex") );
i.setAddCon( rs.getInt("add_con") );
i.setAddInt( rs.getInt("add_int") );
i.setAddWis( rs.getInt("add_wis") );
i.setAddCha( rs.getInt("add_cha") );
i.setAddHp( rs.getInt("HP증가") );
i.setAddMp( rs.getInt("MP증가") );
i.setAddSp( rs.getInt("SP증가") );
i.setAddMr( rs.getInt("MR증가") );
i.setCanbedmg( rs.getString("손상").equalsIgnoreCase("true") );
i.setLevelMin( rs.getInt("level_min") );
i.setLevelMax( rs.getInt("level_max") );
i.setEffect( rs.getInt("이펙트ID") );
i.setSetId( rs.getInt("셋트아이템ID") );
i.setContinuous( rs.getInt("continuous") );
i.setWaterress( rs.getInt("waterress") );
i.setWindress( rs.getInt("windress") );
i.setEarthress( rs.getInt("earthress") );
i.setFireress( rs.getInt("fireress") );
i.setAddWeight( rs.getFloat("add_weight") );
i.setTicHp( rs.getInt("tic_hp") );
i.setTicMp( rs.getInt("tic_mp") );
i.setShopPrice( rs.getInt("shop_price") );
i.setDropChance( rs.getInt("drop_chance") );
i.setGfxMode( getWeaponGfx(i.getType2()) );
i.setSlot( getSlot(i.getType2()) );
i.setEquippedSlot( getEquippedSlot(i.getType2()) );
i.setSolvent( rs.getInt("solvent") );
i.setBookChaoticZone( rs.getString("book_chaotic_zone").equalsIgnoreCase("true") );
i.setBookLawfulZone( rs.getString("book_lawful_zone").equalsIgnoreCase("true") );
i.setBookMomtreeZone( rs.getString("book_momtree_zone").equalsIgnoreCase("true") );
i.setBookNeutralZone( rs.getString("book_neutral_zone").equalsIgnoreCase("true") );
i.setBookTowerZone( rs.getString("book_tower_zone").equalsIgnoreCase("true") );
if(rs.getString("attribute_crystal").equalsIgnoreCase("earth"))
i.setAttributeCrystal(Lineage.ELEMENT_EARTH);
else if(rs.getString("attribute_crystal").equalsIgnoreCase("fire"))
i.setAttributeCrystal(Lineage.ELEMENT_FIRE);
else if(rs.getString("attribute_crystal").equalsIgnoreCase("wind"))
i.setAttributeCrystal(Lineage.ELEMENT_WIND);
else if(rs.getString("attribute_crystal").equalsIgnoreCase("water"))
i.setAttributeCrystal(Lineage.ELEMENT_WATER);
i.setPolyName( rs.getString("poly_name") );
i.setInventorySave( rs.getString("is_inventory_save").equalsIgnoreCase("true") );
i.setAqua( rs.getString("is_aqua").equalsIgnoreCase("true") );
i.setStealHp( rs.getInt("steal_hp") );
i.setStealMp( rs.getInt("steal_mp") );
i.setTohand( rs.getString("is_tohand").equalsIgnoreCase("true") );
i.setReduction( rs.getInt("reduction") );
i.setEnchantMr( rs.getInt("enchant_mr") );
i.setCriticalEffect( rs.getInt("critical_effect") );
try {
StringBuffer sb = new StringBuffer();
StringTokenizer stt = new StringTokenizer(i.getNameId(), " $ ");
while (stt.hasMoreTokens())
sb.append(stt.nextToken());
i.setNameIdNumber(Integer.valueOf(sb.toString().trim()));
} catch (Exception e) {
}
list.add(i);
}
} catch (Exception e) {
lineage.share.System.printf("%s : reload()\r\n", ItemDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(con, st, rs);
}
TimeLine.end();
}
================================notice.txt=======================================
lineage.world.controller.NoticeController.java
TimeLine.end();
}
static public void reload() {
TimeLine.start("notice.txt 파일 리로드 완료 - ");
real_notice.clear();
try {
BufferedReader lnrr = new BufferedReader(new FileReader("notice.txt"));
String line;
while ((line = lnrr.readLine()) != null) {
line = line.trim();
if (line.startsWith("#") || line.length() <= 0)
continue;
real_notice.add(line);
}
lnrr.close();
} catch (Exception e) {
lineage.share.System.printf("%s : init()\r\n", NoticeController.class.toString());
lineage.share.System.println(e);
}
TimeLine.end();
}
================================skill 테이블=======================================
lineage.database.CharactersDatabase.java
/**
* 스킬 정보 저장 함수.
* @param con
* @param pc
*/
static public void saveSkill(Connection con, PcInstance pc){
PreparedStatement st = null;
try {
List<Skill> list = SkillController.find(pc);
if(list!=null) {
//
st = con.prepareStatement( "DELETE FROM characters_skill WHERE cha_objId=?" );
st.setLong(1, pc.getObjectId());
st.executeUpdate();
st.close();
//
for(Skill s : list) {
st = con.prepareStatement( "INSERT INTO characters_skill SET cha_objId=?, cha_name=?, skill=?, skill_name=?" );
st.setLong(1, pc.getObjectId());
st.setString(2, pc.getName());
st.setInt(3, s.getUid());
st.setString(4, s.getName());
st.executeUpdate();
st.close();
}
}
} catch (Exception e) {
lineage.share.System.printf("%s : saveSkill(Connection con, PcInstance pc)\r\n", CharactersDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(st);
}
}
/**
* 스킬 정보 저장 리로드 함수
* @param con
* @param pc
*/
static public void reLoadSaveSkill(PcInstance pc) {
PreparedStatement st = null;
Connection con = null;
try {
con = DatabaseConnection.getLineage();
List<Skill> list = SkillController.find(pc);
if (list != null) {
//
st = con.prepareStatement("DELETE FROM characters_skill WHERE cha_objId=?");
st.setLong(1, pc.getObjectId());
st.executeUpdate();
st.close();
//
for (Skill s : list) {
st = con.prepareStatement( "INSERT INTO characters_skill SET cha_objId=?, cha_name=?, skill=?, skill_name=?");
st.setLong(1, pc.getObjectId());
st.setString(2, pc.getName());
st.setInt(3, s.getUid());
st.setString(4, s.getName());
st.executeUpdate();
st.close();
}
}
} catch (Exception e) {
lineage.share.System.printf("%s : saveSkill(Connection con, PcInstance pc)\r\n", CharactersDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(con, st);
}
}
lineage.database.SkillDatabase.java
TimeLine.end();
}
static public void reLoadSkill() {
TimeLine.start("skill 테이블 리로드 완료 - ");
synchronized (list) {
list.clear();
}
PreparedStatement st = null;
ResultSet rs = null;
Connection con = null;
try {
con = DatabaseConnection.getLineage();
st = con.prepareStatement("SELECT * FROM skill");
rs = st.executeQuery();
while (rs.next()) {
Skill s = new Skill();
s.setUid(rs.getInt(1));
s.setName(rs.getString(2));
s.setSkillLevel(rs.getInt(3));
s.setSkillNumber(rs.getInt(4));
s.setMpConsume(rs.getInt(5));
s.setHpConsume(rs.getInt(6));
s.setItemConsume(rs.getInt(7));
s.setItemConsumeCount(rs.getInt(8));
s.setBuffDuration(rs.getInt(9));
s.setMindmg(rs.getInt(10));
s.setMaxdmg(rs.getInt(11));
s.setId(rs.getInt(12));
s.setCastGfx(rs.getInt(13));
s.setRange(rs.getInt(14));
s.setLawfulConsume(rs.getInt(15));
s.setDelay(rs.getInt("delay"));
s.setLock(rs.getString("if_lock"));
if (s.getSkillLevel() == 1)
s.setPrice(100);
else if (s.getSkillLevel() == 2)
s.setPrice(400);
else
s.setPrice(900);
if (rs.getString("element").equalsIgnoreCase("none"))
s.setElement(Lineage.ELEMENT_NONE);
else if (rs.getString("element").equalsIgnoreCase("wind"))
s.setElement(Lineage.ELEMENT_WIND);
else if (rs.getString("element").equalsIgnoreCase("water"))
s.setElement(Lineage.ELEMENT_WATER);
else if (rs.getString("element").equalsIgnoreCase("earth"))
s.setElement(Lineage.ELEMENT_EARTH);
else if (rs.getString("element").equalsIgnoreCase("fire"))
s.setElement(Lineage.ELEMENT_FIRE);
else if (rs.getString("element").equalsIgnoreCase("laser"))
s.setElement(Lineage.ELEMENT_LASER);
else if (rs.getString("element").equalsIgnoreCase("poison"))
s.setElement(Lineage.ELEMENT_POISON);
synchronized (list) {
list.put(s.getUid(), s);
}
}
} catch (Exception e) {
lineage.share.System.printf("%s : init(Connection con)\r\n", SkillDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(con, st, rs);
}
list.put(1000, new Skill(1000, "구울 독"));
list.put(1001, new Skill(1001, "괴물눈 석화"));
list.put(1002, new Skill(1002, "채팅 금지"));
// 스킬 디비 로딩 알리기.
PluginController.init(SkillDatabase.class, "init", con, list);
TimeLine.end();
}
lineage.world.controller.CommandController.java
/**
* 속도
* @param o
*/
static public void toBuffspeed(object o){ //검색후 아래부분 추가
Bravery.init((Character)o, 9999);
Haste.init((Character)o, 9999);
}
/**
*
* @param
* @return 2017-08-29 by all_night.
*/
static public void serverMagicReload() {
for (PcInstance pc : World.getPcList()) {
CharactersDatabase.reLoadSaveSkill(pc);
SkillController.toWorldOut(pc);
}
SkillDatabase.reLoadSkill();
for (PcInstance pc : World.getPcList()) {
SkillController.toWorldJoin(pc);
CharactersDatabase.readSkill(pc);
}
}
}
================================monster 테이블=======================================
lineage.database.MonsterDatabase.java
static public void init(Connection con){
.
.
.
TimeLine.end();
}
static public void reload() {
TimeLine.start("monster 테이블 리로드 완료 - ");
list.clear();
PreparedStatement st = null;
ResultSet rs = null;
Connection con = null;
try {
con = DatabaseConnection.getLineage();
st = con.prepareStatement("SELECT * FROM monster");
rs = st.executeQuery();
while (rs.next()) {
Monster m = new Monster();
m.setName(rs.getString("name"));
m.setNameId(rs.getString("name_id"));
m.setGfx(rs.getInt("gfx"));
m.setGfxMode(rs.getInt("gfx_mode"));
m.setLevel(rs.getInt("level"));
m.setHp(rs.getInt("hp"));
m.setMp(rs.getInt("mp"));
m.setStealHp(rs.getInt("steal_hp"));
m.setStealMp(rs.getInt("steal_mp"));
m.setTicHp(rs.getInt("tic_hp"));
m.setTicMp(rs.getInt("tic_mp"));
m.setStr(rs.getInt("str"));
m.setDex(rs.getInt("dex"));
m.setCon(rs.getInt("con"));
m.setInt(rs.getInt("int"));
m.setWis(rs.getInt("wis"));
m.setCha(rs.getInt("cha"));
m.setMr(rs.getInt("mr"));
m.setAc(rs.getInt("ac"));
m.setExp(rs.getInt("exp"));
m.setLawful(rs.getInt("lawful"));
m.setSize(rs.getString("size"));
m.setFamily(rs.getString("family"));
m.setAtkType(rs.getInt("atk_type"));
m.setAtkRange(rs.getInt("atk_range"));
m.setAtkInvis(rs.getString("atk_invis").equalsIgnoreCase("true"));
m.setAtkPoly(rs.getString("atk_poly").equalsIgnoreCase("true"));
m.setDie(rs.getString("is_die").equalsIgnoreCase("true"));
m.setPickup(rs.getString("is_pickup").equalsIgnoreCase("true"));
m.setTame(rs.getString("is_tame").equalsIgnoreCase("true"));
m.setRevival(rs.getString("is_revival").equalsIgnoreCase("true"));
m.setToughskin(rs.getString("is_toughskin").equalsIgnoreCase("true"));
m.setAdenDrop(rs.getString("is_adendrop").equalsIgnoreCase("true"));
m.setBuff(rs.getString("is_buff").equalsIgnoreCase("true"));
m.setResistanceEarth(rs.getInt("resistance_earth"));
m.setResistanceFire(rs.getInt("resistance_fire"));
m.setResistanceWind(rs.getInt("resistance_wind"));
m.setResistanceWater(rs.getInt("resistance_water"));
m.setResistanceUndead(rs.getInt("resistance_undead"));
m.setArrowGfx( rs.getInt("arrowGfx") );
m.setMsgAtkTime( init(rs.getString("msg_atk"), m.getMsgAtk()) * 1000 );
m.setMsgDieTime( init(rs.getString("msg_die"), m.getMsgDie()) * 1000 );
m.setMsgSpawnTime( init(rs.getString("msg_spawn"), m.getMsgSpawn()) * 1000 );
m.setMsgEscapeTime( init(rs.getString("msg_escape"), m.getMsgEscape()) * 1000 );
m.setMsgWalkTime( init(rs.getString("msg_walk"), m.getMsgWalk()) * 1000 );
// exp 테이블값 의존한 경험치지급 값 설정.
if (Lineage.monster_level_exp) {
Exp exp = ExpDatabase.find(m.getLevel());
if (exp != null) {
int i = 1;
if (exp.getLevel() < 48)
i = 1;
else if (exp.getLevel() < 65)
i = 2;
else if (exp.getLevel() < 70)
i = 3;
else if (exp.getLevel() < 75)
i = 4;
else if (exp.getLevel() < 79)
i = 5;
else
i = 6 + (exp.getLevel() - 79);
// 레벨에따라 해당경험치에 반을 계속 나누고
// 그값에 2%에 해당하는 값만 지급하기.
double gab = exp.getExp();
for (; i > 1; --i)
gab /= 2;
gab /= 98;
m.setExp(m.getExp() + (int) (Math.round(gab)));
}
}
// 라우풀 값 확인.
if (m.getLawful() >= 0 && m.getLawful() < Lineage.CHAOTIC)
m.setLawful(m.getLawful() + Lineage.NEUTRAL);
try {
StringBuffer sb = new StringBuffer();
StringTokenizer stt = new StringTokenizer(rs.getString("name_id"), " $ ");
while (stt.hasMoreTokens())
sb.append(stt.nextToken());
m.setNameIdNumber(Integer.valueOf(sb.toString().trim()));
} catch (Exception e) {
}
list.add(m);
}
} catch (Exception e) {
lineage.share.System.printf("%s : reload()\r\n", MonsterDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(con, st, rs);
}
TimeLine.end();
}
================================npc 테이블=======================================
lineage.database.NpcDatabase.java
static public void init(Connection con){
.
.
.
TimeLine.end();
}
static public void reload() {
TimeLine.start("npc 테이블 리로드 - ");
synchronized (list) {
list.clear();
PreparedStatement st = null;
ResultSet rs = null;
Connection con = null;
try {
con = DatabaseConnection.getLineage();
st = con.prepareStatement("SELECT * FROM npc");
rs = st.executeQuery();
while (rs.next()) {
Npc n = new Npc();
n.setName( rs.getString("name") );
n.setType( rs.getString("type") );
n.setNameId( rs.getString("nameid") );
n.setGfx( rs.getInt("gfxid") );
n.setGfxMode( rs.getInt("gfxMode") );
n.setHp( rs.getInt("hp") );
n.setLawful( rs.getInt("lawful") );
n.setLight( rs.getInt("light") );
n.setAi( rs.getString("ai").equalsIgnoreCase("true") );
n.setAreaAtk( rs.getInt("areaatk") );
n.setArrowGfx( rs.getInt("arrowGfx") );
if(n.getLawful()<Lineage.CHAOTIC)
n.setLawful( n.getLawful() + Lineage.NEUTRAL );
try {
StringBuffer sb = new StringBuffer();
StringTokenizer stt = new StringTokenizer(rs.getString("nameid"), " $ ");
while (stt.hasMoreTokens())
sb.append(stt.nextToken());
n.setNameIdNumber( Integer.valueOf(sb.toString().trim()) );
} catch (Exception e) { }
list.add( n );
}
} catch (Exception e) {
lineage.share.System.printf("%s : reload()\r\n", NpcDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(con, st, rs);
}
}
TimeLine.end();
NpcShopDatabase.reload();
NpcSpawnlistDatabase.reload();
}
=======================================================================
lineage.database.NpcSpawnlistDatabase.java
import lineage.world.World;
import lineage.world.controller.CharacterController;
import lineage.world.object.instance.NpcInstance;
import lineage.world.object.instance.ShopInstance;
public final class NpcSpawnlistDatabase {
static private List<object> pool;
static private List<object> list;
static private List<ShopInstance> list_shop;
static public void init(Connection con){
.
.
.
TimeLine.end();
}
static public void reload() {
synchronized (list_shop) {
for (object o : list) {
o.clearList(true);
World.remove(o);
o.close();
CharacterController.toWorldOut(o);
}
list_shop.clear();
list.clear();
PreparedStatement st = null;
ResultSet rs = null;
Connection con = null;
try {
con = DatabaseConnection.getLineage();
st = con.prepareStatement("SELECT * FROM npc_spawnlist");
rs = st.executeQuery();
while (rs.next()) {
toSpawnNpc(rs.getString("name"), rs.getString("npcName"), rs.getString("title"), rs.getInt("locX"), rs.getInt("locY"), rs.getInt("locMap"), rs.getInt("heading"), rs.getInt("respawn"));
}
} catch (Exception e) {
lineage.share.System.printf("%s : reload()\r\n", NpcSpawnlistDatabase.class.toString());
lineage.share.System.println(e);
} finally {
DatabaseConnection.close(con, st, rs);
}
}
}
관련자료
댓글 0
등록된 댓글이 없습니다.