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;
}


沒有留言:

張貼留言