顯示具有 C_ItemUSe 標籤的文章。 顯示所有文章
顯示具有 C_ItemUSe 標籤的文章。 顯示所有文章

2014年7月5日 星期六

【Java教學】自救解卡點卷軸的寫法

C_ItemUSe.java


首先要在最頂的import加上下面

import l1j.server.server.serverpackets.S_SystemMessage;
import java.sql.Connection;
import java.sql.PreparedStatement;
import l1j.server.L1DatabaseFactory;

再來就是加在

pc.sendPackets(new S_ServerMessage(481, ""));

下面

在加入下面這段語法

//                                解卡點卷軸 2/2
                            } else if(itemId == 70000){
                                Connection connection = null;
                                connection = L1DatabaseFactory.getInstance().getConnection();
                                PreparedStatement preparedstatement =
connection.prepareStatement("UPDATE characters SET
LocX=33085,LocY=33399,MapID=4 WHERE account_name=?");
                                preparedstatement.setString(1, client.getAccountName());
                                preparedstatement.execute();
                                preparedstatement.close();
                                connection.close();
                                pc.getInventory().removeItem(l1iteminstance, 1);
                                pc.sendPackets(newS_SystemMessage("\u5E33\u865F\u5167\u7684
\u5176\u4ED6\u89D2\u8272 \u5DF2\u50B3\u9001\u81F3\u6F58\u6735\u62C9\u3002"));

在去DB新增:

50001        卡點自救卷軸     
scroll        630        normal        paper        0        0        1        1687        22             
    0        0        0        0        0        0        0        0        0      0        0        0



完成

2014年5月20日 星期二

【Java教學】新增加全職業魂體轉換

新增加個全職業的魂體轉換,當然多少血補多少魔可以自訂
 
C_ItemUSe.java 

找個位置加入


if(itemId == 90000) { //
全職業魂體轉換
                if(pc.getCurrentHp() < 41){
                            pc.sendPackets(new S_SystemMessage("血量
低於40無法使用該技能!"));                
                     return;
                 }
                        pc.sendPackets(new S_SkillSound(pcObjid, 2178));
                        pc.broadcastPacket(new S_SkillSound(pcObjid, 2178));
                        pc.sendPackets(new S_SkillSound(pcObjid, 1765));
                        pc.broadcastPacket(new S_SkillSound(pcObjid, 1765));
                        pc.setCurrentMp(pc.getCurrentMp() + 12);
                        pc.setCurrentHp(pc.getCurrentHp() + -40);
                } else
 




資料庫etcitem新增

90000    
全職業魂體轉換    全職業魂體轉換    event    vcard_w    paper    0    2432    3963    0    1    0    0    0    0    0    0    0    0    1    1    0    2    1000    0    0    0    0 


2014年4月1日 星期二

【Java教學】屠龍副本[惡搞版]

1.隨機開啟什麼龍門,就出什麼龍!!


功能說明
1.點擊 龍之鑰匙 兩下

2.10秒後,出現 龍之門扉,將於50秒之後開啟 的對話

3.50秒後,隨機開啟 四龍門 (地門、水門、火門、風門)

4.龍門出現的地點為 隨機在指定的四座村莊之一開啟 (古魯丁、奇岩、歐瑞、風木)
4-0.地圖採用1005地龍圖,並且是一圖玩四龍。建議複製一份1005,更改左下名稱..比較逼真些。ex:神秘龍穴..
4-1.進入龍門的方式,採用裂痕的方式,直接衝撞...進入龍門會記憶人數,當設定副本參予人數達到上限,就撞不進去了
4-2.副本參予人數上限控制為 maxPlayer 自行設定
4-3.若是進入後又離開,副本人數記憶不會減少,也不能再進入了
4-4.例如有5個人撞入龍門,上限值也為5。當玩家QAZ離場,又要在撞龍門,則會顯示副本人數已達上限
    也就是在副本的人數,隻剩4人,不過上限值依舊為5

5.龍門開啟的1分鐘又50秒,出現 神秘龍王出場了,戰吧 的對話 (隻有進入副本的人才看得到)

6.出龍廣播後10秒(也就是龍門開啟的兩分鐘後),出龍

7.出龍後10分鐘,開始做持續性檢查龍是否死亡的動作

8.檢查的動作,是預設5分鐘檢查一次(要修改這個時間,收尋 "檢查動作間隔")

9.檢查到龍死亡,啟動 副本關閉(關閉同時,也啟動副本維護時間)

10.副本維護時間內,無法開啟副本運作

11.檢查到龍未死亡,則出現 屠龍尚未成功,同志仍須努力 的對話,以及繼續檢查動作

12.龍門關閉時間,目前是預設為2小時 case 7200*2:// 兩小時後, 龍之門扉關閉

13.當副本運行多久小時,強制關閉。時間控制為 Config.CloseDragonTime 自行設定

PS: _startDragonGateTime 單位是秒,不過是一分鐘是120、一小時是7200
      假設你要設定 5分鐘 就是 case 60*2*5

開始加入語法嚕!!

打開C_itemUse插入

        //屠龍副本系統

        }else if (itemId == 300190){//龍之門扉鑰匙                                    

        l1j.kinlinlo.DragonGate.getStart().startDragonGate(pc);


複制代碼打開config,有三段..自行比照增加

插入-1      
public static short GateWaitTime;//龍之門扉維護時間(單位小時)
public static short CloseDragonTime; //龍門副本打開多久,強制關閉時間(單位小時)
public static int GateMaxPc;//龍之門扉進入的玩家上限




複制代碼插入-2

                        //龍之門扉冷卻時間(單位小時)

                        GateWaitTime = Short.parseShort(altSettings.getProperty(

                                        "GateWaitTime", "1"));

                        //龍門副本打開多久,強制關閉時間(單位小時)

                        CloseDragonTime = Short.parseShort(altSettings.getProperty(

                                        "CloseDragonTime", "4"));

                        //龍之門扉進入的玩家上限

                        GateMaxPc = Integer.parseInt(altSettings.getProperty(

                                        "GateMaxPc", "32"));



複制代碼插入-3

                }//龍之門扉冷卻時間(單位小時)    

                else if (pName.equalsIgnoreCase("GateWaitTime")) {

                        GateWaitTime = Short.valueOf(pValue);

                }//龍門副本打開多久,強制關閉時間(單位小時)    

                else if (pName.equalsIgnoreCase("CloseDragonTime")) {

                        CloseDragonTime = Short.valueOf(pValue);

                }//龍之門扉進入的玩家上限)    

                else if (pName.equalsIgnoreCase("GateMaxPc")) {

          屠龍副本惡搞版                  GateMaxPc = Short.valueOf(pValue);





2013年5月17日 星期五

【Java教學】【★★★★★】核心製作一些小玩意


C_ItemUSe.java

                ------------------------------------贖罪之書------------------------------------
                     } else if (itemId == 65002) { //贖罪之書 對應DB編號
               pc.setLawful(32767);
      pc.getInventory().removeItem(l1iteminstance, 1);
       pc.sendPackets(new S_SystemMessage("你的正義增加32767!"));
               }


             ------------------------------------加HP藥水------------------------------------
          } else if (itemId == 63000) { //對應DB編號
               if (!pc.getInventory().checkItem(itemId,1)){
                   return;
               }                        
               pc.addBaseMaxHp((byte) 1); //這裡的1代表加多少血
               pc.getInventory().removeItem(l1iteminstance, 1);
               pc.sendPackets(new S_SystemMessage("你的HP值永久+1")); //對應上面


             ------------------------------------加MP藥水------------------------------------
           else if (itemId == 63020) { // 對應DB編號
               if(!pc.getInventory().checkItem(itemId,1)){
                   return;
               }            
               pc.addBaseMaxMp((byte) 1); // 這裡的1代表加多少魔
               pc.getInventory().removeItem(l1iteminstance, 1);
               pc.sendPackets(new S_SystemMessage("你的MP值永久+1")); //對應上面


                  ------------------------------------變性藥水------------------------------------
                  } else if (itemId == 60213) {
                    pc.getInventory().takeoffEquip(945);//用來脫掉全身裝備
                    pc.sendPackets(new S_SystemMessage("好像有什麼力量改變了你的身體。"));
                    if (pc.get_sex() == 0)
                    pc.set_sex(1);
                    else
                    pc.set_sex(0);
                    if (pc.getClassId() == 61)
                    pc.setClassId(48);
                    else if (pc.getClassId() == 48)
                    pc.setClassId(61);
                    if (pc.getClassId() == 138)
                    pc.setClassId(37);
                    else if (pc.getClassId() == 37)
                    pc.setClassId(138);
                    if (pc.getClassId() == 734)
                    pc.setClassId(1186);
                    else if (pc.getClassId() == 1186)
                    pc.setClassId(734);
                    if (pc.getClassId() == 2786)
                    pc.setClassId(2796);
                    else if (pc.getClassId() == 2796)
                    pc.setClassId(2786);
                    if (pc.getClassId() == 0)
                    pc.setClassId(1);
                    else if (pc.getClassId() == 1)
                    pc.setClassId(0);  
                    if (pc.getClassId() == 6671)
                    pc.setClassId(6650);
                    else if (pc.getClassId() == 6650)
                    pc.setClassId(6671);
                    if (pc.getClassId() == 6658)
                    pc.setClassId(6661);
                    else if (pc.getClassId() == 6661)
                    pc.setClassId(6658);
                    pc.sendPackets(new S_OwnCharStatus(pc));
                    pc.sendPackets(new S_SkillSound(pcObjid, 1183));
                    pc.broadcastPacket(new S_SkillSound(pcObjid, 1183));
                    pc.getInventory().removeItem(l1iteminstance, 1);
                    pc.save();


                  ------------------------------------洗血藥水------------------------------------
              } else if (itemId == 70007) { //TODO 洗血藥水
                   if (pc.getLevel() <= 1) {
                       pc.sendPackets(new S_ServerMessage(79));
                       return;
                   }
                   pc.sendPackets(new S_SkillSound(pcObjid, 6505));
                   pc.broadcastPacket(new S_SkillSound(pcObjid, 6505));
                   pc.getInventory().takeoffEquip(945);//用來脫掉全身裝備
                   pc.setExp(0);
                   pc.resetLevel();
                   pc.addBaseMaxHp((short)(-1 * (int)((double) pc.getBaseMaxHp() - 100)));//喝了之後剩多少HP
              pc.addBaseMaxMp((short)(-1 * (int)((double) pc.getBaseMaxMp() - 100)));//喝了之後還剩多少MP
                   pc.resetBaseAc();
                   pc.resetBaseMr();
                   pc.resetBaseHitup();
                   pc.resetBaseDmgup();
                   pc.sendPackets(new S_OwnCharStatus(pc));
                   pc.sendPackets(new S_ServerMessage(822));
                   pc.getInventory().removeItem(l1iteminstance, 1);
                   }


                 ------------------------------------解卡點卷軸------------------------------------
               else if (itemId == 70000) { //TODO 解卡點卷軸 by xpatax
                       Connection connection = null;
                       connection = L1DatabaseFactory.getInstance().getConnection();
                       PreparedStatement preparedstatement = connection.prepareStatement("UPDATE characters SET LocX=33442,LocY=32797,MapID=4 WHERE account_name=?");
                       preparedstatement.setString(1, client.getAccountName());
                       preparedstatement.execute();
                       preparedstatement.close();
                       connection.close();
                       pc.sendPackets(new S_SystemMessage("除了你,其他角色已回到奇岩村。"));
                       pc.getInventory().removeItem(l1iteminstance, 1);
                   }

                  ------------------------------------能力值藥水------------------------------------
                   else if (itemId == 65003) {
               if ( pc.hasSkillEffect(8020) == false){
               pc.addStr(2);
               int time1 = 900 * 1000; // 設置時間為1小時          
               pc.setSkillEffect(8020, time1);
               pc.getInventory().removeItem(l1iteminstance, 1); // 移除物品  
               pc.sendPackets(new S_OwnCharStatus2(pc));
               pc.sendPackets(new S_SystemMessage("獲得了神的祝福 你的力量+2 時效900秒 "));
               pc.save();
                                            else{          
                pc.sendPackets(new S_SystemMessage("屬性強化失敗"));}



                ------------------------------------抗魔藥水------------------------------------

           }                else if (itemId == 43300) {
               if ( pc.hasSkillEffect(8032) == false){              
                   pc.addWind(30);
                   int time2 = 900 * 1000; // 設置時間為1小時
                   pc.setSkillEffect(8032,time2);
                   pc.getInventory().removeItem(l1iteminstance, 1); // 移除物品  
                   pc.sendPackets(new S_OwnCharStatus(pc));
                   pc.sendPackets(new S_SystemMessage("獲得了神的祝福你的風系抗磨+30 時效900秒 "));
                   pc.save();
                }    else{          
                    pc.sendPackets(new S_SystemMessage("屬性強化失敗"));}
               }  


                ------------------------------------魔法卷軸------------------------------------

               else if (itemId == 65026) { //魔法卷軸(屬性之火)
                    pc.getInventory().removeItem(l1iteminstance, 1); // 移除物件                               cancelAbsoluteBarrier(pc);
                    L1SkillUse l1skilluse = new L1SkillUse();
                    l1skilluse.handleCommands(client.getActiveChar(),
                    171, spellsc_objid, spellsc_x, spellsc_y,
                    null, 0, L1SkillUse.TYPE_SPELLSC);


                ------------------------------------變身藥水------------------------------------
                              搜索if (itemId == 41154) {
                                      下面加入
       } else if (itemId == 60510) { // 對應DB編號
           polyId = 6142; //這裡是顯示的圖檔