📄 c_itemuse.java
字号:
pc.addWind(1);
pc.addAc(1);
}
} else {
FailureEnchant(pc, l1iteminstance1, client);
pc.getInventory().removeItem(l1iteminstance, 1);
return;
}
break;
default:
pc.sendPackets(new S_ServerMessage(79));
return;
}
SuccessEnchant(pc, l1iteminstance1, client,1);
pc.sendPackets(new S_ItemStatus(l1iteminstance1));//線上更新
CharactersItemStorage storage = CharactersItemStorage.create();//儲存道具
storage.updateFireMr(l1iteminstance1);
storage.updateWaterMr(l1iteminstance1);
storage.updateEarthMr(l1iteminstance1);
storage.updateWindMr(l1iteminstance1);
storage.updateaddSp(l1iteminstance1);
storage.updateaddHp(l1iteminstance1);
storage.updateaddMp(l1iteminstance1);
storage.updateHpr(l1iteminstance1);
storage.updateMpr(l1iteminstance1);
pc.getInventory().removeItem(l1iteminstance, 1);//刪除道具
}
//飾品強化卷軸
//裝備保護卷軸 by missu0524
} else if (itemId == 300039) {
if (l1iteminstance1 != null){
if (l1iteminstance1.getItem().get_safeenchant() <= -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_ServerMessage(1308, l1iteminstance1.getLogName())); pc.getInventory().removeItem(l1iteminstance, 1);
}
}
//~裝備保護卷軸 by missu0524
} else if (itemId == 40078
|| itemId == L1ItemId.SCROLL_OF_ENCHANT_ARMOR
|| itemId == 40129 || itemId == 140129
|| itemId == L1ItemId.B_SCROLL_OF_ENCHANT_ARMOR
|| itemId == L1ItemId.C_SCROLL_OF_ENCHANT_ARMOR
|| itemId == 40127) { // 防具強化スクロール
if (l1iteminstance1 == null
|| l1iteminstance1.getItem().getType2() != 2) {
pc.sendPackets(new S_ServerMessage(79)); // \f1何も起きませんでした。
return;
}
int safe_enchant = ((L1Armor) l1iteminstance1.getItem())
.get_safeenchant();
if (safe_enchant < 0) { // 強化不可
pc.sendPackets(new S_ServerMessage(79)); // \f1何も起きませんでした。
return;
}
int armorId = l1iteminstance1.getItem().getItemId();
if (armorId == 20161 || armorId >= 21035 && armorId <= 21038) { // イリュージョン防具
if (itemId == 40127) { // イリュージョン防具強化スクロール
} else {
pc.sendPackets(new S_ServerMessage(79)); // \f1何も起きませんでした。
return;
}
}
if (itemId == 40127) { // イリュージョン防具強化スクロール
if (armorId == 20161 || armorId >= 21035
&& armorId <= 21038) { // イリュージョン防具
} else {
pc.sendPackets(new S_ServerMessage(79)); // \f1何も起きませんでした。
return;
}
}
int enchant_level = l1iteminstance1.getEnchantLevel();
if (itemId == L1ItemId.C_SCROLL_OF_ENCHANT_ARMOR) { // c-zel
pc.getInventory().removeItem(l1iteminstance, 1);
if (enchant_level < -6) {
// -7以上はできない。
FailureEnchant(pc, l1iteminstance1, client);
} else {
SuccessEnchant(pc, l1iteminstance1, client, -1);
}
} else if (enchant_level < safe_enchant) {
pc.getInventory().removeItem(l1iteminstance, 1);
SuccessEnchant(pc, l1iteminstance1, client, RandomELevel(
l1iteminstance1, itemId));
} else {
pc.getInventory().removeItem(l1iteminstance, 1);
int rnd = _random.nextInt(100) + 1;
int enchant_chance_armor;
int enchant_level_tmp;
if (safe_enchant == 0) { // 骨、ブラックミスリル用補正
enchant_level_tmp = enchant_level + 2;
} else {
enchant_level_tmp = enchant_level;
}
if (enchant_level >= 9) {
enchant_chance_armor = (100 + enchant_level_tmp
* Config.ENCHANT_CHANCE_ARMOR)
/ (enchant_level_tmp * 2);
} else {
enchant_chance_armor = (100 + enchant_level_tmp
* Config.ENCHANT_CHANCE_ARMOR)
/ enchant_level_tmp;
}
if (rnd < enchant_chance_armor) {
int randomEnchantLevel = RandomELevel(l1iteminstance1,
itemId);
SuccessEnchant(pc, l1iteminstance1, client,
randomEnchantLevel);
} else if (enchant_level >= 9
&& rnd < (enchant_chance_armor * 2)) {
String item_name_id = l1iteminstance1.getName();
String pm = "";
String msg = "";
if (enchant_level > 0) {
pm = "+";
}
msg = (new StringBuilder()).append(pm + enchant_level)
.append(" ").append(item_name_id).toString();
// \f1%0が%2と強烈に%1光りましたが、幸い無事にすみました。
pc.sendPackets(new S_ServerMessage(160, msg, "$252",
"$248"));
} else {
FailureEnchant(pc, l1iteminstance1, client);
}
}
} else if (l1iteminstance.getItem().getType2() == 0) { // 種別:その他のアイテム
int item_minlvl = ((L1EtcItem) l1iteminstance.getItem())
.getMinLevel();
int item_maxlvl = ((L1EtcItem) l1iteminstance.getItem())
.getMaxLevel();
if (item_minlvl != 0 && item_minlvl > pc.getLevel()
&& !pc.isGm()) {
pc.sendPackets(new S_ServerMessage(318, String
.valueOf(item_minlvl))); // このアイテムは%0レベル以上にならなければ使用できません。
return;
} else if (item_maxlvl != 0 && item_maxlvl < pc.getLevel()
&& !pc.isGm()) {
pc.sendPackets(new S_ServerMessage(673, String
.valueOf(item_maxlvl))); // このアイテムは%dレベル以上のみ使用できます。
return;
}
if ((itemId == 40576 && !pc.isElf()) // 魂の結晶の破片(白)
|| (itemId == 40577 && !pc.isWizard()) // 魂の結晶の破片(黒)
|| (itemId == 40578 && !pc.isKnight())) { // 魂の結晶の破片(赤)
pc.sendPackets(new S_ServerMessage(264)); // \f1あなたのクラスではこのアイテムは使用できません。
return;
}
if (l1iteminstance.getItem().getType() == 0) { // アロー
pc.getInventory().setArrow(
l1iteminstance.getItem().getItemId());
pc.sendPackets(new S_ServerMessage(452, l1iteminstance
.getLogName())); // %0が選択されました。
} else if (l1iteminstance.getItem().getType() == 15) { // スティング
pc.getInventory().setSting(
l1iteminstance.getItem().getItemId());
pc.sendPackets(new S_ServerMessage(452, // %0が選択されました。
l1iteminstance.getLogName()));
} else if (l1iteminstance.getItem().getType() == 16) { // treasure_box
L1TreasureBox box = L1TreasureBox.get(itemId);
if (box != null) {
if (box.open(pc)) {
L1EtcItem temp = (L1EtcItem) l1iteminstance
.getItem();
if (temp.get_delayEffect() > 0) {
isDelayEffect = true;
} else {
pc.getInventory().removeItem(
l1iteminstance.getId(), 1);
}
}
}
} else if (l1iteminstance.getItem().getType() == 2) { // light系アイテム
if (l1iteminstance.getRemainingTime() <= 0
&& itemId != 40004) {
return;
}
if (l1iteminstance.isNowLighting()) {
l1iteminstance.setNowLighting(false);
pc.turnOnOffLight();
} else {
l1iteminstance.setNowLighting(true);
pc.turnOnOffLight();
}
pc.sendPackets(new S_ItemName(l1iteminstance));
} else if (itemId == 40003) { // ランタン オイル
for (L1ItemInstance lightItem : pc.getInventory()
.getItems()) {
if (lightItem.getItem().getItemId() == 40002) {
lightItem.setRemainingTime(l1iteminstance.getItem()
.getLightFuel());
pc.sendPackets(new S_ItemName(lightItem));
pc.sendPackets(new S_ServerMessage(230)); // ランタンにオイルを注ぎました。
break;
}
}
pc.getInventory().removeItem(l1iteminstance, 1);
} else if (itemId == 43000) { // 復活のポーション(Lv99キャラのみが使用可能/Lv1に戻る效果)
pc.setExp(1);
pc.resetLevel();
pc.setBonusStats(0);
pc.sendPackets(new S_SkillSound(pcObjid, 191));
pc.broadcastPacket(new S_SkillSound(pcObjid, 191));
pc.sendPackets(new S_OwnCharStatus(pc));
pc.getInventory().removeItem(l1iteminstance, 1);
pc.sendPackets(new S_ServerMessage(822)); // 独自アイテムですので、メッセージは適当です。
pc.save(); // DBにキャラクター情報を書き込む
} else if (itemId == 40033) { // エリクサー:腕力
//TODO 可設定能力值上限 by srwh
if (pc.getBaseStr() < Config.MAX_ABILITY3 && pc.getElixirStats() < Config.MAX_ABILITY2) {
//end
pc.addBaseStr((byte) 1); // 素のSTR値に+1
pc.setElixirStats(pc.getElixirStats() + 1);
pc.getInventory().removeItem(l1iteminstance, 1);
pc.sendPackets(new S_OwnCharStatus2(pc));
pc.save();
// DBにキャラクター情報を書き込む
} else {
if(pc.getBaseStr() >= Config.MAX_ABILITY3)
pc.sendPackets(new S_SystemMessage("能力值Str"+Config.MAX_ABILITY3+"以後不能喝萬能藥! "));
if(pc.getElixirStats() >= Config.MAX_ABILITY2)
pc.sendPackets(new S_SystemMessage("萬能藥只能喝"+Config.MAX_ABILITY2+"瓶"));
//pc.sendPackets(new S_ServerMessage(481)); // \f1一つの能力値の最大値は25です。他の能力値を選択してください。
}
} else if (itemId == 40034) { // エリクサー:体力
if (pc.getBaseCon() < Config.MAX_ABILITY3 && pc.getElixirStats() < Config.MAX_ABILITY2) {
pc.addBaseCon((byte) 1); // 素のCON値に+1
pc.setElixirStats(pc.getElixirStats() + 1);
pc.getInventory().removeItem(l1iteminstance, 1);
pc.sendPackets(new S_OwnCharStatus2(pc));
pc.save();
; // DBにキャラクター情報を書き込む
} else {
if(pc.getBaseCon() >= Config.MAX_ABILITY3)
pc.sendPackets(new S_SystemMessage("Con能力值"+Config.MAX_ABILITY3+"以後不能喝萬能藥! "));
if(pc.getElixirStats() >= Config.MAX_ABILITY2)
pc.sendPackets(new S_SystemMessage("萬能藥只能喝"+Config.MAX_ABILITY2+"瓶"));
//pc.sendPackets(new S_ServerMessage(481)); // \f1一つの能力値の最大値は25です。他の能力値を選択してください。
}
} else if (itemId == 40035) { // エリクサー:機敏
if (pc.getBaseDex() < Config.MAX_ABILITY3 && pc.getElixirStats() < Config.MAX_ABILITY2) {
pc.addBaseDex((byte) 1); // 素のDEX値に+1
pc.resetBaseAc();
pc.setElixirStats(pc.getElixirStats() + 1);
pc.getInventory().removeItem(l1iteminstance, 1);
pc.sendPackets(new S_OwnCharStatus2(pc));
pc.save();
// DBにキャラクター情報を書き込む
} else {
if(pc.getBaseDex() >= Config.MAX_ABILITY3)
pc.sendPackets(new S_SystemMessage("Dex能力值"+Config.MAX_ABILITY3+"以後不能喝萬能藥! "));
if(pc.getElixirStats() >= Config.MAX_ABILITY2)
pc.sendPackets(new S_SystemMessage("萬能藥只能喝"+Config.MAX_ABILITY2+"瓶"));
//pc.sendPackets(new S_ServerMessage(481)); // \f1一つの能力値の最大値は25です。他の能力値を選択してください。
}
} else if (itemId == 40036) { // エリクサー:知力
if (pc.getBaseInt() < Config.MAX_ABILITY3 && pc.getElixirStats() < Config.MAX_ABILITY2) {
pc.addBaseInt((byte) 1); // 素のINT値に+1
pc.setElixirStats(pc.getElixirStats() + 1);
pc.getInventory().removeItem(l1iteminstance, 1);
pc.sendPackets(new S_OwnCharStatus2(pc));
pc.save();
// DBにキャラクター情報を書き込む
} else {
if(pc.getBaseInt() >= Config.MAX_ABILITY3)
pc.sendPackets(new S_SystemMessage("Int能力值"+Config.MAX_ABILITY3+"以後不能喝萬能藥! "));
if(pc.getElixirStats() >= Config.MAX_ABILITY2)
pc.sendPackets(new S_SystemMessage("萬能藥只能喝"+Config.MAX_ABILITY2+"瓶"));
//pc.sendPackets(new S_ServerMessage(481)); // \f1一つの能力値の最大値は25です。他の能力値を選択してください。
}
} else if (itemId == 40037) { // エリクサー:精神
if (pc.getBaseWis() < Config.MAX_ABILITY3 && pc.getElixirStats() < Config.MAX_ABILITY2) {
pc.addBaseWis((byte) 1); // 素のWIS値に+1
pc.resetBaseMr();
pc.setElixirStats(pc.getElixirStats() + 1);
pc.getInventory().removeItem(l1iteminstance, 1);
pc.sendPackets(new S_OwnCharStatus2(pc));
pc.save();
// DBにキャラクター情報を書き込む
} else {
if(pc.getBaseWis() >= Config.MAX_ABILITY3)
pc.sendPackets(new S_SystemMessage("Wis能力值"+Config.MAX_ABILITY3+"以後不能喝萬能藥! "));
if(pc.getElixirStats() >= Config.MAX_ABILITY2)
pc.sendPackets(new S_SystemMessage("萬能藥只能喝"+Config.MAX_ABILITY2+"瓶"));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -