顯示具有 限制 標籤的文章。 顯示所有文章
顯示具有 限制 標籤的文章。 顯示所有文章

2014年7月18日 星期五

【Java教學】城堡專屬對話

L1MerchantInstance

可能須搭配 L1CastleLocation

舉例:

//歐比 奇岩城 內侍從長
} else if (npcid == 70623) { 
boolean hascastle = checkHasCastle(player,
L1CastleLocation.GIRAN_CASTLE_ID); //設定城堡專屬   奇岩城
if (hascastle) { // 擁有城堡的成員
if (checkClanLeader(player)) { // 血盟主
htmlid = "orville1";       //城主,請您下達命令?(這是給血盟盟主看的)
} else {
htmlid = "orville6";       //殿下您好。  (這是給血盟成員看的)
htmldata = new String[] { player.getName() };
}
} else { //非血盟成員時顯示對話
htmlid = "orville7";//你以為這是哪裡,竟敢偷偷潛入這裡!(這是給非血盟成員看的)
}

2014年2月1日 星期六

【Java教學】龍騎士 死騎 鎖鏈劍 一格攻擊

龍騎士 死騎 鎖鏈劍 一格攻擊
一格攻擊是參考(3.8TW S_SkillIconGFX)

L1PolyMorph.java

尋找

if ((pc.getTempCharGfx() == 6034) || (pc.getTempCharGfx() == 6035) || !isMatchCause(polyId, cause)) {
if (cantPolyMessage) {
  pc.sendPackets(new S_ServerMessage(181)); // \f1無法變成你指定的怪物。
} else {
  pc.sendPackets(new S_ServerMessage(79));
}
return; 
}

下面新增:

if (polyId == 6142 || polyId == 6147 || polyId == 6152 || polyId == 6157
|| polyId == 9205 || polyId == 9206 || polyId == 6775 || polyId == 6137
|| polyId == 3784 || polyId == 11232 || polyId == 11234 || polyId == 11236
|| polyId == 11375 || polyId == 11623 || polyId == 11631 || polyId == 11653
|| polyId == 11735 || polyId == 12229 || polyId == 12230 || polyId == 12231
|| polyId == 12232){
if (pc.getInventory().getTypeEquipped(1, 18) == 1) {
  pc.setCurrentWeapon(83);
                pc.sendPackets(new S_SkillIconGFX(polyId, true));
}
}

尋找並新增:

// 解除變身
public static void undoPoly(L1Character cha) {
           if (cha instanceof L1PcInstance) {
   L1PcInstance pc = (L1PcInstance) cha;
   int classId = pc.getClassId();
   
   if (pc.getInventory().getTypeEquipped(1, 18) == 1) {   // <---新增
    pc.setCurrentWeapon(24);                       // <---新增
   }                                                      // <---新增
   
   pc.setTempCharGfx(classId);
   if (!pc.isDead()) {  
    pc.sendPackets(new S_ChangeShape(pc.getId(), classId, pc.getCurrentWeapon()));
    pc.broadcastPacket(new S_ChangeShape(pc.getId(), classId, pc.getCurrentWeapon()));
   }
                        pc.sendPackets(new S_SkillIconGFX(classId, false));    // <---新增



L1EquipmentSlot.java

新增宣告:

import l1j.server.server.serverpackets.S_SkillIconGFX;

尋找
          weapon.startEquipmentTimer(_owner);

整句修改成:

         int polyId = _owner.getTempCharGfx();
  if (polyId == 6142 || polyId == 6147 || polyId == 6152 || polyId == 6157
     || polyId == 9205 || polyId == 9206 || polyId == 6775 || polyId == 6137
     || polyId == 3784 || polyId == 11232 || polyId == 11234 || polyId == 11236
     || polyId == 11375 || polyId == 11623 || polyId == 11631 || polyId == 11653
     || polyId == 11735 || polyId == 12229 || polyId == 12230 || polyId == 12231
     || polyId == 12232){
   if (weapon.getItem().getType1() == 24){
    _owner.setCurrentWeapon(83);
    _owner.sendPackets(new S_SkillIconGFX(polyId, true));
   }else {
       _owner.setCurrentWeapon(weapon.getItem().getType1());
   }
  }else {
      _owner.setCurrentWeapon(weapon.getItem().getType1());
  }
  weapon.startEquipmentTimer(_owner);     

尋找並新增:

         private void removeWeapon(L1ItemInstance weapon) {
  int itemId = weapon.getItem().getItemId();
  _owner.setWeapon(null);
  _owner.setCurrentWeapon(0);
  int polyId = _owner.getTempCharGfx();                    // <---新增
  _owner.sendPackets(new S_SkillIconGFX(polyId, false));   // <---新增


S_SkillIconGFX.java

新增:

        public S_SkillIconGFX(int i, boolean changeWeapon) {
  writeC(Opcodes.S_OPCODE_SKILLICONGFX);
  writeC(0xa0);
  if (changeWeapon == true) {
   writeC(1);
  }else{
   writeC(0);
  }
  writeH(0);
  writeC(2);
  writeH(i);
}


DB 部分:

polymorphs 

尋找

polyid == 6142 || polyid == 6147 || polyid == 6152 || polyid == 6157
|| polyid == 9205 || polyid == 9206 || polyid == 6775 || polyid == 6137
|| polyid == 3784 || polyid == 11232 || polyid == 11234 || polyid == 11236
|| polyid == 11375 || polyid == 11623 || polyid == 11631 || polyid == 11653
|| polyid == 11735 || polyid == 12229 || polyid == 12230 || polyid == 12231
|| polyid == 12232




weaponequip 

751

改成

1791




OVER
文章出處 浪漫物語網路社區

2013年6月6日 星期四

【Java教學】限制相同IP最多可以連接的個數(防止掛小號)

修改 C_AuthLogin.java


搜索 Account account = Account.load(accountName);
在上面添加代码

if(tongip != 0){ //這裡隨便到config裡面設置一個數值,同IP連接個數例如: tongip=3
                        int k=0;
                        for (ClientThread tempClient : LoginController.getInstance()
                                        .getAllAccounts()) {
                                if (ip.equalsIgnoreCase(tempClient.getIp())) {
                                        k++;
                                        if (k>tongip-1){ // 如果相同IP數量>限制數量
                                                System.out.println("相同ip連接超過限​​制:Ip "+ip+" 玩家帳號:"+ accountName); //限制
                                                System.out.println

("============================================");
                                        client.sendPacket(new S_LoginResult(
                                                        S_LoginResult.REASON_USER_OR_PASS_WRONG));
                                        return; //這裡就是限制啦....
                                        }
                                        
                                }
                        }
                }