close_btn
로그인, 회원가입후 더 많은 혜택을 누리세요 로그인 회원가입 닫기

WeaponSkillTable.java <<< 없으면 추가

 

/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 * 02111-1307, USA.
 *
 *
http://www.gnu.org/copyleft/gpl.html
 */

package l1j.server.server.datatables;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;

import l1j.server.L1DatabaseFactory;
import l1j.server.server.utils.PerformanceTimer;
import l1j.server.server.utils.SQLUtil;

public class WeaponSkillTable {
 public class WeaponSkillData {
  public int weapon_id = 0;
  public String name = null;
  public int probability = 0;
  public int fix_damage = 0;
  public int random_damage = 0;
  public int area = 0;
  public int skill_id = 0;
  public int skill_time = 0;
  public int effect_id = 0;
  public int effect_target = 0;
  public int arrow_type = 0;
  public int attr = 0;
 }

 private static Logger _log = Logger.getLogger(WeaponSkillTable.class.getName());

 private static WeaponSkillTable _instance;

 private final Map<Integer, WeaponSkillData> _weaponskill = new HashMap<Integer, WeaponSkillData>();

 public static WeaponSkillTable getInstance() {
  if (_instance == null) {
   _instance = new WeaponSkillTable();
  }
  return _instance;
 }

 private WeaponSkillTable() {
  PerformanceTimer timer = new PerformanceTimer();
  System.out.print("[WeaponSkill] loading WeaponSkill...");  
  weaponSkillList();
  System.out.println("OK! " + timer.get() + " ms"); 
 }

 public void weaponSkillList() {
  Connection con = null;
  PreparedStatement pstm = null;
  ResultSet rs = null;

  try {
   con = L1DatabaseFactory.getInstance().getConnection();
   pstm = con.prepareStatement("select * from weapon_skill");
   rs = pstm.executeQuery();

   WeaponSkillData weaponskilldata = null;
   while (rs.next()) {
    weaponskilldata = new WeaponSkillData();

    int weapon_id = rs.getInt("weapon_id");

    weaponskilldata.weapon_id = rs.getInt("weapon_id");
    weaponskilldata.name = rs.getString("note");
    weaponskilldata.probability = rs.getInt("probability");
    weaponskilldata.fix_damage = rs.getInt("fix_damage");
    weaponskilldata.random_damage = rs.getInt("random_damage");
    weaponskilldata.area = rs.getInt("area");
    weaponskilldata.skill_id = rs.getInt("skill_id");
    weaponskilldata.skill_time = rs.getInt("skill_time");
    weaponskilldata.effect_id = rs.getInt("effect_id");
    weaponskilldata.effect_target = rs.getInt("effect_target");
    weaponskilldata.arrow_type = rs.getInt("arrow_type");
    weaponskilldata.attr = rs.getInt("attr");

    _weaponskill.put(weapon_id, weaponskilldata);
   }

  } catch (SQLException e) {
   _log.log(Level.SEVERE, e.getLocalizedMessage(), e);
  } finally {
   SQLUtil.close(rs);
   SQLUtil.close(pstm);
   SQLUtil.close(con);
  }
 }

 public static void reload() {
  WeaponSkillTable oldInstance = _instance;
  _instance = new WeaponSkillTable();
  if (oldInstance != null)
   oldInstance._weaponskill.clear();
 }

 public Map<Integer, WeaponSkillData> getWeaponSkillList() {
  return _weaponskill;
 }

 public WeaponSkillData getWeaponSkillData(int itemId) {
  WeaponSkillData data = _weaponskill.get(itemId);
  if (data == null) {
   data = new WeaponSkillData();
   data.weapon_id = 0;
  }
  return data;
 }
}

L1WeaponSkill.java << 없으면 추가

 

package l1j.server.server.model;

import java.util.Random;

import l1j.server.server.ActionCodes;
import l1j.server.server.datatables.WeaponSkillTable;
import l1j.server.server.datatables.WeaponSkillTable.WeaponSkillData;
import l1j.server.server.model.Instance.L1MonsterInstance;
import l1j.server.server.model.Instance.L1NpcInstance;
import l1j.server.server.model.Instance.L1PcInstance;
import l1j.server.server.model.Instance.L1PetInstance;
import l1j.server.server.model.Instance.L1SummonInstance;
import l1j.server.server.serverpackets.S_DoActionGFX;
import l1j.server.server.serverpackets.S_SkillSound;
import l1j.server.server.serverpackets.S_UseAttackSkill;

public class L1WeaponSkill {
 private static Random _random = new Random(System.nanoTime());

 public static double getWeaponSkillDamage(L1PcInstance pc, L1Character cha, int weapon_id, int enchant) {
  double dmg = 0;
  int chance = _random.nextInt(100) + 1;
  int weapondmg = 0;
  int enchantdmg = 0;
  
  //공성지역 마법검안나가게
 //    int castle_id = L1CastleLocation.getCastleIdByArea(pc);
 //    int target_castle_id = L1CastleLocation.getCastleIdByArea(cha);
 ////       if (castle_id != 0 && target_castle_id !=0 && target_castle_id == castle_id ){
 //     return 0;
 //    }
  //공성지역 마법검 안나가게 끝

  try {
   WeaponSkillData weaponskilldata = WeaponSkillTable.getInstance().getWeaponSkillData(weapon_id);
   // System.out.println("무기 : " + weaponskilldata.weapon_id);
   // System.out.println("확률 : " + weaponskilldata.probability);
   // System.out.println("데미지 : " + weaponskilldata.fix_damage);
   // System.out.println("이펙트 : " + weaponskilldata.effect_id);
   // System.out.println("찬스 : " + chance);
   if (weaponskilldata.weapon_id != 0) {
    if (chance <= weaponskilldata.probability) {

     // System.out.println("arrow_type : " +
     // weaponskilldata.arrow_type);

     if (weaponskilldata.area == 0) {
      // System.out.println("dmg1 : " + dmg);
      weapondmg = weaponskilldata.fix_damage;
      if (enchant < 0) {
       enchantdmg = 0;
       enchantdmg = _random.nextInt(enchantdmg + 1);
      } else {
       enchantdmg = _random.nextInt(enchant + 1);
      }
      // System.out.println("enchantdmg : " + enchantdmg);
      dmg = weapondmg + enchantdmg;
      // System.out.println("dmg2 : " + dmg);

      if (weaponskilldata.arrow_type == 0) {
       pc.sendPackets(new S_SkillSound(cha.getId(), weaponskilldata.effect_id));
       Broadcaster.broadcastPacket(pc, new S_SkillSound(cha.getId(), weaponskilldata.effect_id));
      } else if (weaponskilldata.arrow_type == 1) {
       if (weaponskilldata.effect_target == 0) {
        S_UseAttackSkill packet = new S_UseAttackSkill(pc, cha.getId(), weaponskilldata.effect_id, cha.getX(), cha.getY(), ActionCodes.ACTION_Attack, false);
        pc.sendPackets(packet);
        Broadcaster.broadcastPacket(pc, packet);
       } else if (weaponskilldata.effect_target == 1) {
        S_UseAttackSkill packet = new S_UseAttackSkill(cha, cha.getId(), weaponskilldata.effect_id, cha.getX(), cha.getY(), ActionCodes.ACTION_Attack, false);
        pc.sendPackets(packet);
        Broadcaster.broadcastPacket(pc, packet);
       }
      }

      // System.out.println("skill_id : " +
      // weaponskilldata.skill_id);
      if (weaponskilldata.skill_id != 0) {
       if (!cha.getSkillEffectTimerSet().hasSkillEffect(weaponskilldata.skill_id)) {
        cha.getSkillEffectTimerSet().setSkillEffect(weaponskilldata.skill_id, weaponskilldata.skill_time * 1000);
       }
      }
     } else if (weaponskilldata.area != 0) {
      L1Magic magic = new L1Magic(pc, cha);

      dmg = magic.calcMagicDamage(weaponskilldata.skill_id);
      dmg = magic.calcMrDefense((int) dmg);
      if (dmg <= 0) {
       dmg = 0;
      }
      pc.sendPackets(new S_SkillSound(cha.getId(), weaponskilldata.effect_id));
      Broadcaster.broadcastPacket(pc, new S_SkillSound(cha.getId(), weaponskilldata.effect_id));
      L1PcInstance targetPc = null;
      L1NpcInstance targetNpc = null;
      for (L1Object object : L1World.getInstance().getVisibleObjects(cha, weaponskilldata.area)) {
       if (object == null) {
        continue;
       }
       if (!(object instanceof L1Character)) {
        continue;
       }
       if (object.getId() == pc.getId() || object.getId() == cha.getId()) {
        continue;
       }
       if (object instanceof L1PcInstance) {
        targetPc = (L1PcInstance) object;
        if (CharPosUtil.getZoneType(targetPc) == 1) {
         continue;
        }
       }
       if (cha instanceof L1MonsterInstance) {
        if (!(object instanceof L1MonsterInstance)) {
         continue;
        }
       }
       if (cha instanceof L1PcInstance || cha instanceof L1SummonInstance || cha instanceof L1PetInstance) {
        if (!(object instanceof L1PcInstance || object instanceof L1SummonInstance || object instanceof L1PetInstance || object instanceof L1MonsterInstance)) {
         continue;
        }
       }

       if (dmg <= 0) {
        continue;
       }
       if (object instanceof L1PcInstance) {
        targetPc = (L1PcInstance) object;        
        
        if (!pc.getMap().isSafetyZone(pc.getLocation())) {
         if (targetPc.getClanid() != pc.getClanid()) {
          targetPc.sendPackets(new S_DoActionGFX(targetPc.getId(), ActionCodes.ACTION_Damage));
          Broadcaster.broadcastPacket(targetPc, new S_DoActionGFX(targetPc.getId(), ActionCodes.ACTION_Damage));
          targetPc.receiveDamage(pc, (int)dmg, false);
         }
        }
       } else if (object instanceof L1SummonInstance || object instanceof L1PetInstance || object instanceof L1MonsterInstance) {
        targetNpc = (L1NpcInstance) object;
        Broadcaster.broadcastPacket(targetNpc, new S_DoActionGFX(targetNpc.getId(), ActionCodes.ACTION_Damage));
        if (!pc.getMap().isSafetyZone(pc.getLocation())) {
         targetNpc.receiveDamage(pc, (int) dmg);
        }
       }
      }
     }
    }
   }
  } catch (Exception e) {
   System.out.println("WeaponSkill Error");
  }

  return dmg;
 }
}

L1Attack.java

pctopc 부분

case 415015:
   case 415016:
    dmg += WeaponSkill.getChaserDamage(_pc, _target, 7179);
    break;
   case 413103:
    calcStaffOfMana();
    WeaponSkill.getDiseaseWeapon(_pc, _target, 413101);
    break;
   default:
    /**웨폰스킬 외부화 **/
    dmg += L1WeaponSkill.getWeaponSkillDamage(_pc, _target, _weaponId, _weaponEnchant);
    /**웨폰스킬 외부화 **/

    break; //검색
   }
  }

 

pctonpc 부분

case 415015:
  case 415016:
   dmg += WeaponSkill.getChaserDamage(_pc, _target, 7179);
   break;
  case 413103:
   calcStaffOfMana();
   WeaponSkill.getDiseaseWeapon(_pc, _target, 413101);
   break;
  default:
   /**웨폰스킬 외부화 **/
   dmg += L1WeaponSkill.getWeaponSkillDamage(_pc, _target, _weaponId, _weaponEnchant);
   /**웨폰스킬 외부화 **/

   break; //검색후 위에 추가
  }

 

L1Reload.java

 

} else if (arg.equalsIgnoreCase("무기퍼센트")) {
   WeaponPersentDamage.reload();
   gm.sendPackets(new S_SystemMessage("WeaponPersentDamage Update Complete..."));
   /** 웨폰퍼센트 데미지  **/
   /** 웨폰스킬 데미지  **/
  } else if (arg.equalsIgnoreCase("무기스킬")) {
   WeaponSkillTable.reload();
   gm.sendPackets(new S_SystemMessage("WeaponSkill Update Complete..."));
   /** 웨폰스킬 데미지  **/

  } else if (arg.equalsIgnoreCase("엔피씨")) {
   NpcTable.reload();
   gm.sendPackets(new S_SystemMessage("NpcTable Update Complete..."));

  

eva.java << 매니져창인데 하셔도 돼구 안하셔도 됩니다 ^^

 

JMenuItem bossCycleReload = new JMenuItem("BossCycle");   
    bossCycleReload.setAccelerator(KeyStroke.getKeyStroke('L', InputEvent.SHIFT_DOWN_MASK));   
    bossCycleReload.addActionListener(new ActionListener() {
     public void actionPerformed(ActionEvent e) {
      if (QMsg("BossCycle " + ReloadMSG) == 0) {
       L1BossCycle.load();
       jSystemLogWindow.append(getLogTime() + " [도구 실행] BossCycle Update Complete..." + "\n", "Red");
      }   
     }
    });

    JMenuItem weaponSkillReload = new JMenuItem("WeaponSkill");   
    weaponSkillReload.setAccelerator(KeyStroke.getKeyStroke('Z', InputEvent.SHIFT_DOWN_MASK));   
    weaponSkillReload.addActionListener(new ActionListener() {
     public void actionPerformed(ActionEvent e) {
      if (QMsg("WeaponSkill " + ReloadMSG) == 0) {
       WeaponSkillTable.reload();
       jSystemLogWindow.append(getLogTime() + " [도구 실행] WeaponSkill Update Complete..." + "\n", "Red");
      }   
     }
    });

 

    jJMenu4.add(skillsReload);
    jJMenu4.add(mobSkillReload);
    jJMenu4.add(mapFixKeyReload);
    jJMenu4.add(itemReload);
    jJMenu4.add(shopReload);
    jJMenu4.add(npcReload);
    jJMenu4.add(bossCycleReload);
    
jJMenu4.add(weaponSkillReload);

 

디비는 어느 퍡이든 다 있으니 패스 할게요 ㅎ

출처: 아시는분 댓글로 달아주시면 감사하겠습니다

[출처] 먹통 웨폰스킬테이블(디비) 작동시키기 (비공개 카페)

번호 제목 글쓴이 날짜 조회 수
공지 소스자료는 직접 올려주세요 게임존 2017.06.06 550
409 [서버방어프로젝트1] 너 스핵쓰냐? 잡아줄게 준희미니 2016.06.29 157
408 일팩유저화이팅]하딘시스템 준희미니 2016.06.29 46
407 페이트님 혈맹버프를 실시간으로... 준희미니 2016.06.29 43
406 /계급 및 혈맹 매칭.(소스아님 팁) 준희미니 2016.06.29 51
405 강제변신검 특화검 혹시나 필요하신분있을꺼같아서..ㅎ 준희미니 2016.06.29 85
404 매칭 혈맹해산후에도 깃발먹통안되게 준희미니 2016.06.29 20
403 npc 거리제한 해제; 준희미니 2016.06.29 81
402 카배 남들도보이게? 준희미니 2016.06.29 45
401 흑사버프 준희미니 2016.06.29 44
400 텔레포트시 드래곤의 진주 재부여 준희미니 2016.06.29 68
399 라이브에서는 어바시,힐,똥물,게일,데스힐,데스포션된다네용 준희미니 2016.06.29 43
398 힘,콘 스탯 초과시 칼질 안되는것 수정 준희미니 2016.06.29 76
397 세이룬 준희미니 2016.06.29 28
396 세트 착용시 화려한 임팩 준희미니 2016.06.29 89
395 환영의 체인소드 저만의 짜집기 준희미니 2016.06.29 34
394 가웨인 나비 정리 허접 준희미니 2016.06.29 26
393 어스가디언 (수정) 준희미니 2016.06.29 33
392 룸티스 붉은귀걸이 확률데미지감소부분 야매버젼 준희미니 2016.06.29 68
» 먹통 웨폰스킬테이블(디비) 작동시키기 준희미니 2016.06.29 136
390 무인 낚시 만들기 준희미니 2016.06.29 126
389 간단한 반지 정보.! 준희미니 2016.06.29 84
388 허수아비 파티시 어택불가 준희미니 2016.06.29 29
387 이미 마법을 배우면 더이상 안배워지도록 준희미니 2016.06.29 75
386 2013.10.30 메세지 파일 입니다 file 준희미니 2016.06.29 35
385 HALLOWEENEVENT2013 file 준희미니 2016.06.29 88
384 [본섭화] 공성선포시 혈맹원이 공성존 안에있다면 마을로 베르 준희미니 2016.06.29 34
383 글말 리뉴얼 짜집기 준희미니 2016.06.29 74
382 붉은사자의 투지 file 준희미니 2016.06.29 81
381 붉은기사의 하사품 준희미니 2016.06.29 57
380 마법인형 그렘린 추가하쟈 file 준희미니 2016.06.29 72
379 아이스 스파이크 오류 수정 버전 file 준희미니 2016.06.29 64
378 기르 공략소스 and 음성 수정버전 준희미니 2016.06.29 63
377 droplist 인첸템드랍 추가 준희미니 2016.06.29 91
376 대만 3.80옵코드 준희미니 2016.06.29 131
375 대만 3.80 서버버전 준희미니 2016.06.29 110
374 대만 3.80c KeyPacket 부분 준희미니 2016.06.29 51
373 마안 사용 (라이브화) 준희미니 2016.06.29 69
372 대만 3.80c 대만 S_Unknown1 쪽이요 준희미니 2016.06.29 44
371 3.80c 텔레포트 팅기는부분 준희미니 2016.06.29 35
370 상점 NPC의 세금을 어떻게 성으로 보낼까요? 준희미니 2016.06.29 72
369 디스펠 주문서 준희미니 2016.06.29 45
368 명령어 .아데나 부분 수정한거 ㅋ;;; 욕하지들마삼 준희미니 2016.06.29 79
367 3.80 경험치변경시 상점창뜨는부분 준희미니 2016.06.29 41
366 룸티스 귀걸이 완전체 (이전꺼 버그잇음요 ㅠㅠ) 준희미니 2016.06.29 128
365 변신 막대 추가? 준희미니 2016.06.29 43
364 제브레퀴 라이브화 준희미니 2016.06.29 51
363 황금장화 획득시 화면내 다른 유저에게 획득메시지 보이게 라이브화 준희미니 2016.06.29 32
362 스냅퍼 반지 중복착용 방지 [1] 준희미니 2016.06.29 57
361 이계 번개소환막대??ㅋ 준희미니 2016.06.29 62
360 요청 크로우 류 카배 미반사 준희미니 2016.06.29 24