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

2019年9月15日 星期日

耀武神兵

找  
src/l1j/server/server/model/item/action/Enchant.java



// 對武器施法的卷軸
public static void scrollOfEnchantWeapon(L1PcInstance pc, L1ItemInstance l1iteminstance
, L1ItemInstance l1iteminstance1, ClientThread client) {
int itemId = l1iteminstance.getItem().getItemId();
int safe_enchant = l1iteminstance1.getItem().get_safeenchant();
int weaponId = l1iteminstance1.getItem().getItemId();
if ((l1iteminstance1 == null) || (l1iteminstance1.getItem().getType2() != 1)
|| (safe_enchant < 0) || (l1iteminstance1.getBless() >= 128)) {
pc.sendPackets(new S_ServerMessage(79));
return;
}


這段的最下方加入....



//TODO 耀武 BY 80363000
if ((weaponId >= 289) && (weaponId <= 303)) { // 當耀武
if (itemId != L1ItemId.Yaowu) { // 使用非耀武卷軸時
pc.sendPackets(new S_ServerMessage(79));//將顯示沒有效果
return;
}
}
if (itemId == L1ItemId.Yaowu) { // 當使用耀武卷軸
if ((weaponId < 289) || (weaponId > 303)) { // 點非耀武時
pc.sendPackets(new S_ServerMessage(79));
return;
}
}//耀武 END



/src/l1j/server/server/model/identity/L1ItemId.java


加入


/** 耀武神兵強化卷軸*/
public static final int Yaowu = 161036;


/src/l1j/server/server/clientpackets/C_ItemUSe.java



case 40077:

上方加入


case L1ItemId.Yaowu://TODO 耀武神兵強化卷軸


L1ItemInstance l1iteminstance1 = pc.getInventory().getItem(l);
_log.finest("request item use (obj) = " + itemObjid + " action = "
+ l + " value = " + s);
if ((itemId == 40077)
|| (itemId == L1ItemId.SCROLL_OF_ENCHANT_WEAPON)
|| (itemId == L1ItemId.SCROLL_OF_ENCHANT_QUEST_WEAPON)
|| (itemId == 40130) || (itemId == 140130)
|| (itemId == L1ItemId.B_SCROLL_OF_ENCHANT_WEAPON)
|| (itemId == L1ItemId.C_SCROLL_OF_ENCHANT_WEAPON)
|| (itemId == 40128)) { // 對武器施法的卷軸
Enchant.scrollOfEnchantWeapon(pc, l1iteminstance,
l1iteminstance1, client);


中間加入


|| (itemId == L1ItemId.Yaowu)//耀武卷軸




完成!!


此設定為非官方設定
(正服活動期間使用特定卷軸強化,活動結束後使用一般武卷就可以強化)
單純爽度製作


2014年12月10日 星期三

永恆戒指

Config
找  /** OtherSettings control */

找個位置加入

// 武器屬性卷軸
public static int WeaponCount;
public static int WeaponStrRnd;
public static int WeaponDexRnd;
public static int WeaponIntRnd;
public static int TenWeaponAttack;
public static int SixWeaponAttack;
public static int OneHundredWeaponAttack;

// 防具屬性卷軸
public static int ArmorCount;
public static int ArmorConRnd;
public static int ArmorChaRnd;
public static int ArmorWisRnd;
public static int ArmorHpRnd;
public static int ArmorMpRnd;

之後一樣找

/** OtherSettings control */

下面加入

     // 武器屬性卷軸
    WeaponCount = Integer.parseInt(otherSettings.getProperty("WeaponCount", "7"));
    WeaponStrRnd = Integer.parseInt(otherSettings.getProperty("WeaponStrRnd", "20"));
    WeaponDexRnd = Integer.parseInt(otherSettings.getProperty("WeaponDexRnd", "20"));
    WeaponIntRnd = Integer.parseInt(otherSettings.getProperty("WeaponIntRnd", "20"));
    TenWeaponAttack = Integer.parseInt(otherSettings.getProperty("TenWeaponAttack", "20"));
    SixWeaponAttack = Integer.parseInt(otherSettings.getProperty("SixWeaponAttack", "60"));
    OneHundredWeaponAttack = Integer.parseInt(otherSettings.getProperty("OneHundredWeaponAttack", "100"));
    // 防具屬性卷軸
    ArmorCount = Integer.parseInt(otherSettings.getProperty("ArmorCount", "7"));
    ArmorConRnd = Integer.parseInt(otherSettings.getProperty("ArmorConRnd", "20"));
    ArmorChaRnd = Integer.parseInt(otherSettings.getProperty("ArmorChaRnd", "20"));
    ArmorWisRnd = Integer.parseInt(otherSettings.getProperty("ArmorWisRnd", "20"));
    ArmorHpRnd = Integer.parseInt(otherSettings.getProperty("ArmorHpRnd", "20"));
    ArmorMpRnd = Integer.parseInt(otherSettings.getProperty("ArmorMpRnd", "20"));



C_ItemUSe

( 很長一排..)

case 47045:
case 47046:
case 47048:
case 47049:
case 47050:
case 47051:
case 47052:
case 49198:
case 49199:

找個位置加入

// 永恆飾品強化卷軸
case 89999:
// 永恆戒指強化卷軸
case 59962:



} else if (itemId == 49311) { // 象牙塔對盔甲施法的卷軸
Enchant.scrollOfEnchantArmorIvoryTower(pc, l1iteminstance,
l1iteminstance1, client);

下面找位置加入

} else if (itemId == 59962) { // 永恆戒指強化卷軸
Enchant.ScrollforEnchantingEternalRing(pc, l1iteminstance,
l1iteminstance1, client);
} else if (itemId == 89999) { // 永恆飾品強化卷軸
Enchant.ScrollforEnchantingEternalAmulet(pc, l1iteminstance,
l1iteminstance1, client);



l1j.server.server.model.item.action.Enchant

下面加入

// 永恆戒指強化卷軸
public static void ScrollforEnchantingEternalRing(L1PcInstance pc, L1ItemInstance l1iteminstance, L1ItemInstance l1iteminstance1, ClientThread client) throws Exception {

int enchant_level = l1iteminstance1.getEnchantLevel();
int armorId = l1iteminstance1.getItem().getItemId();
int safe_enchant = l1iteminstance1.getItem().get_safeenchant();

if (l1iteminstance1 == null
|| l1iteminstance1.getBless() >= 128
|| safe_enchant < 0
|| l1iteminstance1.getItem().getType2() != 2
|| l1iteminstance1.getItem().getType() != 9 ) {
pc.sendPackets(new S_ServerMessage(79));
return;
}

if (armorId < 30072 && armorId > 30076) { // 永恆戒指系列
pc.sendPackets(new S_ServerMessage(79)); // \f1沒有任何事情發生。
return;
}

if (enchant_level < 0 || enchant_level >= 9) { // 強化上限 + 9
pc.sendPackets(new S_ServerMessage(79));
return;
}

int rnd = Random.nextInt(100) + 1;
int enchant_chance_accessory;
int enchant_level_tmp = enchant_level;

// 成功率: +0-85% ~ +9-40%
enchant_chance_accessory = (50 + enchant_level_tmp) / (enchant_level_tmp + 1) + 35;

if (rnd < enchant_chance_accessory) { // 成功
switch (l1iteminstance1.getEnchantLevel()) { // 強化等級
case 0: // 1階段成功
l1iteminstance1.setHp(l1iteminstance1.getHp() + 15);
// 裝備中
if (l1iteminstance1.isEquipped()) {
pc.addMaxHp(15);
}
break;
case 1: // 2階段成功
case 2: // 3階段成功
case 3: // 4階段成功
l1iteminstance1.setHp(l1iteminstance1.getHp() + 5);
l1iteminstance1.setAc(l1iteminstance1.getAc() + 1);
// 裝備中
if (l1iteminstance1.isEquipped()) {
pc.addMaxHp(5);
pc.addAc(-1);
}
break;
case 4: // 5階段成功
case 5: // 6階段成功
case 6: // 7階段成功
case 7: // 8階段成功
case 8: // 9階段成功
l1iteminstance1.setHp(l1iteminstance1.getHp() + 5);
l1iteminstance1.setDamageReduction(l1iteminstance1.getDamageReduction() + 1);
// 裝備中
if (l1iteminstance1.isEquipped()) {
pc.addMaxHp(5);
pc.addDamageReductionByArmor(1);
}
break;
default:
pc.sendPackets(new S_ServerMessage(79));
return;
}
} else { // 飾品強化失敗
pc.getInventory().removeItem(l1iteminstance, 1);
return;
}
SuccessEnchant(pc, l1iteminstance1, client, 1);
// 更新
pc.sendPackets(new S_ItemStatus(l1iteminstance1));
pc.getInventory().removeItem(l1iteminstance, 1);
pc.saveInventory(); // 強制儲存一次身上道具
}

// 永恆飾品強化卷軸
public static void ScrollforEnchantingEternalAmulet(L1PcInstance pc, L1ItemInstance l1iteminstance, L1ItemInstance l1iteminstance1, ClientThread client) throws Exception {

int enchant_level = l1iteminstance1.getEnchantLevel();
int armorId = l1iteminstance1.getItem().getItemId();
int safe_enchant = l1iteminstance1.getItem().get_safeenchant();

if (l1iteminstance1 == null
|| l1iteminstance1.getBless() >= 128
|| safe_enchant < 0
|| l1iteminstance1.getItem().getType2() != 2
|| l1iteminstance1.getItem().getType() != 8 ) {
pc.sendPackets(new S_ServerMessage(79));
return;
}

if (armorId < 30318 && armorId > 30322) { // 非永恆系列
pc.sendPackets(new S_ServerMessage(79)); // \f1沒有任何事情發生。
return;
}

if (enchant_level < 0 || enchant_level >= 9) { // 強化上限 + 9
pc.sendPackets(new S_ServerMessage(79));
return;
}

int rnd = Random.nextInt(100) + 1;
int enchant_chance_accessory;
int enchant_level_tmp = enchant_level;

// 成功率: +0-85% ~ +9-40%
enchant_chance_accessory = (50 + enchant_level_tmp) / (enchant_level_tmp + 1) + 35;

if (rnd < enchant_chance_accessory) { // 成功
switch (l1iteminstance1.getEnchantLevel()) { // 強化等級
case 0: // 1階段成功
l1iteminstance1.setMp(l1iteminstance1.getMp() + 10);
l1iteminstance1.setM_Def(l1iteminstance1.getM_Def() + 2);
// 裝備中
if (l1iteminstance1.isEquipped()) {
pc.addMaxMp(10);
pc.addMr(2);
pc.sendPackets(new S_SPMR(pc));
}
break;
case 1: // 2階段成功
case 2: // 3階段成功
case 3: // 4階段成功
l1iteminstance1.setMp(l1iteminstance1.getMp() + 5);
l1iteminstance1.setM_Def(l1iteminstance1.getM_Def() + 1);
// 裝備中
if (l1iteminstance1.isEquipped()) {
pc.addMaxMp(5);
pc.addMr(1);
pc.sendPackets(new S_SPMR(pc));
}
break;
case 4: // 5階段成功
l1iteminstance1.setMp(l1iteminstance1.getMp() + 5);
l1iteminstance1.setM_Def(l1iteminstance1.getM_Def() + 1);
l1iteminstance1.setHitModifier(l1iteminstance1.getHitModifier() + 1);
l1iteminstance1.setBow_Hit_Modifier(l1iteminstance1.getBow_Hit_Modifier() + 1);
// 裝備中
if (l1iteminstance1.isEquipped()) {
pc.addMaxMp(5);
pc.addMr(1);
pc.addHitup(1);
pc.addBowHitup(1);
pc.sendPackets(new S_SPMR(pc));
}
break;
case 5: // 6階段成功
l1iteminstance1.setDmgModifier(l1iteminstance1.getDmgModifier() + 1);
l1iteminstance1.setBow_Dmg_Modifier(l1iteminstance1.getBow_Dmg_Modifier() + 1);
if (l1iteminstance1.isEquipped()) {
pc.addDmgup(1);
pc.addBowDmgup(1);
}
break;
case 6: // 7階段成功
l1iteminstance1.setMp(l1iteminstance1.getMp() + 5);
l1iteminstance1.setHitModifier(l1iteminstance1.getHitModifier() + 1);
l1iteminstance1.setBow_Hit_Modifier(l1iteminstance1.getBow_Hit_Modifier() + 1);
// 裝備中
if (l1iteminstance1.isEquipped()) {
pc.addMaxMp(5);
pc.addHitup(1);
pc.addBowHitup(1);
}
break;
case 7: // 8階段成功
l1iteminstance1.setMp(l1iteminstance1.getMp() + 5);
l1iteminstance1.setDmgModifier(l1iteminstance1.getDmgModifier() + 1);
l1iteminstance1.setBow_Dmg_Modifier(l1iteminstance1.getBow_Dmg_Modifier() + 1);
l1iteminstance1.setMpr(l1iteminstance1.getMpr() + 1);
// 裝備中
if (l1iteminstance1.isEquipped()) {
pc.addMaxMp(5);
pc.addDmgup(1);
pc.addBowDmgup(1);
pc.addMpr(1);
}
break;
case 8: // 9階段成功
l1iteminstance1.setMp(l1iteminstance1.getMp() + 5);
l1iteminstance1.setMpr(l1iteminstance1.getMpr() + 1);
// 裝備中
if (l1iteminstance1.isEquipped()) {
pc.addMaxMp(5);
pc.addMpr(1);
}
break;
default:
pc.sendPackets(new S_ServerMessage(79));
return;
}
} else { // 飾品強化失敗
pc.getInventory().removeItem(l1iteminstance, 1);
return;
}
SuccessEnchant(pc, l1iteminstance1, client, 1);
pc.sendPackets(new S_ItemStatus(l1iteminstance1)); // 更新顯示資訊
pc.getInventory().removeItem(l1iteminstance, 1);
pc.saveInventory(); // 強制儲存一次身上道具
}


l1j.server.server.model.Instance.L1ItemInstance



/**
* 前回DBへ保存した際のアイテムのステータスを格納するクラス
*/

下面找位置加入

// 武器屬性卷軸、防具屬性卷軸、武器吸血吸魔魔法卷軸、永恆飾品強化卷軸、永恆戒指強化卷軸
public int Weapon_Count;

public int Armor_Count;

public int Dmg;

public int Dmg_Modifier;

public int Hit_Modifier;

public int Bow_Dmg_Modifier;

public int Bow_Hit_Modifier;

public int GetHp;

public int GetMp;

public int Str;

public int Dex;

public int Int;

public int Con;

public int Cha;

public int Wis;

public int Hp;

public int Mp;

public int Hpr;

public int Mpr;

public int Sp;

public int M_Def;

public int FireMr;

public int WaterMr;

public int EarthMr;

public int WindMr;

public int DamageReduction;

public int Ac;



public void updateAll() {

下面找位置加入

// 武器屬性卷軸、防具屬性卷軸、武器吸血吸魔魔法卷軸、永恆飾品強化卷軸、永恆戒指強化卷軸
Weapon_Count = getWeaponCount();
Armor_Count = getArmorCount();
Dmg = getDmg();
Dmg_Modifier = getDmgModifier();
Hit_Modifier = getHitModifier();
Bow_Dmg_Modifier = getBow_Dmg_Modifier();
Bow_Hit_Modifier = getBow_Hit_Modifier();
GetHp = getGetHp();
GetMp = getGetMp();
Str = getStr();
Dex = getDex();
Int = getInt();
Con = getCon();
Cha = getCha();
Wis = getWis();
Hp = getHp();
Mp = getMp();
Hpr = getHpr();
Mpr = getMpr();
Sp = getSp();
M_Def = getM_Def();
FireMr = getFireMr();
WaterMr = getWaterMr();
EarthMr = getEarthMr();
WindMr = getWindMr();
DamageReduction = getDamageReduction();
Ac = getAc();



public void updateAttrEnchantLevel() {
attrEnchantLevel = getAttrEnchantLevel();
}

下面加入

// 武器屬性卷軸、防具屬性卷軸、武器吸血吸魔魔法卷軸、永恆飾品強化卷軸、永恆戒指強化卷軸
public void updateWeapon_Count() {
Weapon_Count = getWeaponCount();
}

public void updateArmor_Count() {
Armor_Count = getArmorCount();
}

public void updateDmg() {
Dmg = getDmg();
}

public void updateDmg_Modifier() {
Dmg_Modifier = getDmgModifier();
}

public void updateHit_Modifier() {
Hit_Modifier = getHitModifier();
}

public void updateBowDmg_Modifier() {
Bow_Dmg_Modifier = getBow_Dmg_Modifier();
}

public void updateBowHit_Modifier() {
Bow_Hit_Modifier = getBow_Hit_Modifier();
}

public void updateGetHp() {
GetHp = getGetHp();
}

public void updateGetMp() {
GetMp = getGetMp();
}

public void updateStr() {
Str = getStr();
}

public void updateDex() {
Dex = getDex();
}

public void updateInt() {
Int = getInt();
}

public void updateCon() {
Con = getCon();
}

public void updateCha() {
Cha = getCha();
}

public void updateWis() {
Wis = getWis();
}

public void updateHp() {
Hp = getHp();
}

public void updateMp() {
Mp = getMp();
}

public void updateHpr() {
Hpr = getHpr();
}

public void updateMpr() {
Mpr = getMpr();
}

public void updateSp() {
Sp = getSp();
}

public void updateM_Def() {
M_Def = getM_Def();
}

public void updateFireMr() {
FireMr = getFireMr();
}

public void updateWaterMr() {
WaterMr = getWaterMr();
}

public void updateEarthMr() {
EarthMr = getEarthMr();
}

public void updateWindMr() {
WindMr = getWindMr();
}

public void updateDamageReduction() {
DamageReduction = getDamageReduction();
}

public void updateAc() {
Ac = getAc();
}



public void setHitByMagic(int i) {
_hitByMagic = i;
}

下面加入

// 武器屬性卷軸、防具屬性卷軸、武器吸血吸魔魔法卷軸、永恆飾品強化卷軸、永恆戒指強化卷軸

private int _WeaponCount = Config.WeaponCount;

public int getWeaponCount() {
return _WeaponCount;
}

public void setWeaponCount(int i) {
_WeaponCount = i;
}

private int _ArmorCount = Config.ArmorCount;

public int getArmorCount() {
return _ArmorCount;
}

public void setArmorCount(int i) {
_ArmorCount = i;
}

private int _Dmg = 0;

public int getDmg() {
return _Dmg;
}

public void setDmg(int i) {
_Dmg = i;
}

private int _DmgModifier = 0;

public int getDmgModifier() {
return _DmgModifier;
}

public void setDmgModifier(int i) {
_DmgModifier = i;
}

private int _HitModifier = 0;

public int getHitModifier() {
return _HitModifier;
}

public void setHitModifier(int i) {
_HitModifier = i;
}

private int _Bow_Dmg_Modifier = 0;

public int getBow_Dmg_Modifier() {
return _Bow_Dmg_Modifier;
}

public void setBow_Dmg_Modifier(int i) {
_Bow_Dmg_Modifier = i;
}

private int _Bow_Hit_Modifier = 0;

public int getBow_Hit_Modifier() {
return _Bow_Hit_Modifier;
}

public void setBow_Hit_Modifier(int i) {
_Bow_Hit_Modifier = i;
}

private int _GetHp = 0;

public int getGetHp() {
return _GetHp;
}

public void setGetHp(int hp) {
_GetHp = hp;
}

private int _GetMp = 0;

public int getGetMp() {
return _GetMp;
}

public void setGetMp(int mp) {
_GetMp = mp;
}

private int _Str = 0;

public int getStr() {
return _Str;
}

public void setStr(int i) {
_Str = i;
}

private int _Dex = 0;

public int getDex() {
return _Dex;
}

public void setDex(int i) {
_Dex = i;
}

private int _Int = 0;

public int getInt() {
return _Int;
}

public void setInt(int i) {
_Int = i;
}

private int _Con = 0;

public int getCon() {
return _Con;
}

public void setCon(int i) {
_Con = i;
}

private int _Cha = 0;

public int getCha() {
return _Cha;
}

public void setCha(int i) {
_Cha = i;
}

private int _Wis = 0;

public int getWis() {
return _Wis;
}

public void setWis(int i) {
_Wis = i;
}

private int _Hp = 0;

public int getHp() {
return _Hp;
}

public void setHp(int i) {
_Hp = i;
}

private int _Mp = 0;

public int getMp() {
return _Mp;
}

public void setMp(int i) {
_Mp = i;
}

private int _Hpr = 0;

public int getHpr() {
return _Hpr;
}

public void setHpr(int i) {
_Hpr = i;
}

private int _Mpr = 0;

public int getMpr() {
return _Mpr;
}

public void setMpr(int i) {
_Mpr = i;
}

private int _Sp = 0;

public int getSp() {
return _Sp;
}

public void setSp(int i) {
_Sp = i;
}

private int _M_Def = 0;

public int getM_Def() {
return _M_Def;
}

public void setM_Def(int i) {
_M_Def = i;
}

private int _FireMr = 0;

public int getFireMr() {
return _FireMr;
}

public void setFireMr(int i) {
_FireMr = i;
}

private int _WaterMr = 0;

public int getWaterMr() {
return _WaterMr;
}

public void setWaterMr(int i) {
_WaterMr = i;
}

private int _EarthMr = 0;

public int getEarthMr() {
return _EarthMr;
}

public void setEarthMr(int i) {
_EarthMr = i;
}

private int _WindMr = 0;

public int getWindMr() {
return _WindMr;
}

public void setWindMr(int i) {
_WindMr = i;
}

private int _DamageReduction = 0;

public int getDamageReduction() {
return _DamageReduction;
}

public void setDamageReduction(int i) {
_DamageReduction = i;
}

private int _Ac = 0;

public int getAc() {
return _Ac;
}

public void setAc(int i) {
_Ac = i;
}


2014年9月25日 星期四

【Java教學】倉庫提物捲製作

倉庫提物捲製作..

檔案位址

\src\l1j\server\server\clientpackets\C_NPCAction

找到以下這裡

    } else if (s.equalsIgnoreCase("retrieve")) { // 「個人倉庫:アイテムを受け取る」
      if (pc.getLevel() >= 5) {

..............................................................................

        if(pc.getInventory().checkItem(49303)){
        pc.getInventory().removeItem(pc.getInventory().findItemId(49303), 1);

.......................................................................  

            pc.sendPackets(new S_RetrieveList(objid, pc));                }
      }
    } else if (s.equalsIgnoreCase("retrieve-elven")) { // 「エルフ倉庫:荷物を受け取る」
      if (pc.getLevel() >= 5 && pc.isElf()) {
          pc.sendPackets(new S_RetrieveElfList(objid, pc));
      }
    } else if (s.equalsIgnoreCase("retrieve-pledge")) { // 「血盟倉庫:荷物を受け取る」
      if (pc.getLevel() >= 5) {
          if (pc.getClanid() == 0) {
          // \f1血盟倉庫を使用するには血盟に加入していなくてはなりません。
          pc.sendPackets(new S_ServerMessage(208));
          return;



新增分隔線內的程式碼..
妖精倉庫.血盟倉庫請自己新增.

編號49303是我資料庫新增測試的編號.
可隨自己喜歡去新增編號跟名稱.

2014年8月22日 星期五

【Java教學】身上道具無法重複領取

// 多魯嘉貝爾
else if (((L1NpcInstance) obj).getNpcTemplate().get_npcId() == 81278) { // 設定NPC為多魯嘉貝爾
if (s.equalsIgnoreCase("0")) { //某參數為0時的設定


if (pc.getInventory().checkItem(46000, 1)) { // 檢查身上是否有多魯嘉之袋
htmlid = "veil3"; // 重複道具並顯示對話檔 ( 已經有袋子了 )


} else if (pc.getInventory().checkItem(L1ItemId.ADENA, 1000000)) { // 檢查身上金幣是否足夠
pc.getInventory().consumeItem(L1ItemId.ADENA, 1000000); //給與NPC指定物品
pc.getInventory().storeItem(46000, 1); //NPC給與指定物品
htmlid = "veil7"; // 購買成功顯示並顯示對話檔


} else if (!pc.getInventory().checkItem(L1ItemId.ADENA, 1000000)) { // 檢查身上金幣是否足夠
htmlid = "veil4"; // 購買失敗並顯示對話檔 ( 錢不夠顯示 我們還是不要約定了 )
}

} else if (s.equalsIgnoreCase("1")) { //某參數為1時的設定 ( 也就是已經兌換多魯嘉之袋 ) 
htmlid = "veil9"; //顯示對話檔
}

2014年8月2日 星期六

【Java教學】集體加速卷軸

C_ItemUSe 

}else if(itemId == 60041){//集體魔法卷軸:集體加速卷軸(測試)
useMassSkillEffect(pc,300,755,1,true,true);
pc.getInventory().removeItem(l1iteminstance, 1);

複製代碼

//集體魔法卷軸:集體加速卷軸 by13630020
private void useMassSkillEffect(L1PcInstance player, int time, int castgfx, int moveSet, boolean isPc, boolean isNpc) {
List<L1PcInstance> targetPc = L1World.getInstance().getVisiblePlayer(player);
List<L1Object> targetNpc = L1World.getInstance().getVisibleObjects(player);
boolean isAgree = false;
for (L1Object tgobj : targetNpc) {//對寵物或召喚
if (tgobj instanceof L1SummonInstance
|| tgobj instanceof L1PetInstance) {
isAgree=true;
}
if(isAgree){
if(isNpc){//是否給寵物或召喚
L1NpcInstance npc = (L1NpcInstance) tgobj;
if((npc instanceof L1SummonInstance || npc instanceof L1PetInstance)
&& npc.getMaster() == player){
npc.broadcastPacket(new S_SkillSound(npc.getId(), castgfx));
npc.setMoveSpeed(moveSet);
npc.setSkillEffect(STATUS_HASTE, time * 1000);
}
}
}
}
for (L1PcInstance pc : targetPc) {
if (pc.getClanid() == player.getClanid()
|| pc.getPartyID() == player.getPartyID()) {//對同盟或組隊成員
isAgree=true;
}
if(isAgree){
if(isPc){
if (pc.getClanid() == player.getClanid()
|| pc.getPartyID() == player.getPartyID()) {//是否給同盟或組隊成員
pc.sendPackets(new S_SkillSound(pc.getId(), castgfx));
pc.broadcastPacket(new S_SkillSound(pc.getId(), castgfx));
pc.sendPackets(new S_SkillHaste(pc.getId(), 1, time));
pc.broadcastPacket(new S_SkillHaste(pc.getId(), 1, 0));
pc.setMoveSpeed(moveSet);
pc.setSkillEffect(STATUS_HASTE, time * 1000);
pc.sendPackets(new S_ServerMessage(183));//\f1你的腿得到新的能量。
}
}
}
}
//最後也必須給自己效果
player.broadcastPacket(new S_SkillSound(player.getId(), castgfx));
player.sendPackets(new S_SkillSound(player.getId(), castgfx));
player.sendPackets(new S_SkillHaste(player.getId(), 1, time));
player.broadcastPacket(new S_SkillHaste(player.getId(), 1, 0));
player.setMoveSpeed(moveSet);
player.setSkillEffect(STATUS_HASTE, time * 1000);
player.sendPackets(new S_ServerMessage(183));//\f1你的腿得到新的能量。
//使用者施法動作(19)
player.sendPackets(new S_DoActionGFX(player.getId(),ActionCodes.ACTION_SkillBuff));
player.broadcastPacket(new S_DoActionGFX(player.getId(),ActionCodes.ACTION_SkillBuff));
}
// end 

複製代碼


簡介一下

useMassSkillEffect{player<使用者>

,time<時間(t)>

,castgfx<圖檔>

,moveSet<速度值:1(加速)2(緩速XD)>

,isPc<是否給同伴true/false>

,isNpc<是否給召寵true/false>}

這樣就完成囉^^!!

2014年7月25日 星期五

【Java教學】裝備保護卷軸

裝備保護卷軸


功能解說:使用此道具點選裝備時,強化失敗時不會消失,但是強化值回歸至零

L1ItemInstance.Java  直接在最下面加入

//裝備保護卷軸  
private boolean proctect = false; 
  
public boolean getproctect() { 
  return proctect; 
public void setproctect(boolean i) { 
  proctect = i; 
//裝備保護卷軸

C_ItemUSe.Java 
搜尋

|| itemId == L1ItemId.C_SCROLL_OF_ENCHANT_WEAPON

在後面加入

|| itemId == 300039

接著找個地方加入

    //裝備保護卷軸 
    } else if (itemId == 300039) { 
    if (l1iteminstance1 != null){ 
      if (l1iteminstance1.getEnchantLevel() <= -1){ 
      pc.sendPackets(new S_ServerMessage(1309)); 
      return; 
      } 
      if (l1iteminstance1.getproctect() == true){ 
      pc.sendPackets(new S_ServerMessage(1300)); 
      return; 
      } 
      if (l1iteminstance1.getItem().getType2() == 0){ 
      pc.sendPackets(new S_ServerMessage(79)); 
      return; 
      } else { 
      l1iteminstance1.setproctect(true); 
      pc.sendPackets(new S_SystemMessage(l1iteminstance1.getEnchantLevel()+l1iteminstance1.getName()+"受到魔法力量的保護。")); 
      pc.getInventory().removeItem(l1iteminstance, 1); 
    } 
    } 
    //裝備保護卷軸 



Enchant
搜尋 
//強化成功
private void SuccessEnchant(L1PcInstance pc, L1ItemInstance item, ClientThread client, int i) {

在下面加入
  
  //裝備保護卷軸 
  item.setproctect(false); 
  //裝備保護卷軸

搜尋
//強化失敗
private void FailureEnchant(L1PcInstance pc, L1ItemInstance item, 
  ClientThread client) {

在下面加入

  //裝備保護卷軸 
  if (item.getproctect() == true){ 
  item.setEnchantLevel(0); 
  pc.sendPackets(new S_ItemStatus(item)); 
  pc.getInventory().saveItem(item, L1PcInventory.COL_ENCHANTLVL); 
  item.setproctect(false); 
  pc.sendPackets(new S_ServerMessage(1310)); 
  return; 
  } 
  //裝備保護卷軸