楓之谷私服v120 點裝附魔系統
SRC
- 打開
scripting\NPCConversationManager.java
在最下方}前加上:
仔細看,裡頭可以修改附魔的能力,按照個人喜好設定。
//點裝附魔
public String EnchantCashEqip(byte slot) {
Equip item = (Equip) c.getPlayer().getInventory(MapleInventoryType.EQUIP).getItem(slot);
Equip sel = (Equip) item;
int itemid = c.getPlayer().getInventory(MapleInventoryType.EQUIP).getItem(slot).getItemId();
boolean isCash = MapleItemInformationProvider.getInstance().isCash(itemid);
String msg = "";
if (isCash) {
msg += "您此次所附魔的點裝為#b#z" + itemid + "##k\r\n";
msg += "您此次的附魔為:\r\n";
msg += "-----------------------\r\n";
short Str = (short) Randomizer.rand(5, 10);
sel.setStr((short) (sel.getStr() + Str));
msg += "力量 +" + " " + Str + "\r\n";
short Dex = (short) Randomizer.rand(5, 10);
sel.setDex((short) (sel.getDex() + Dex));
msg += "敏捷: " + " " + Dex + "\r\n";
short Int = (short) Randomizer.rand(5, 10);
sel.setInt((short) (sel.getInt() + Int));
msg += "智力: " + " " + Int + "\r\n";
short Luk = (short) Randomizer.rand(5, 10);
sel.setLuk((short) (sel.getLuk() + Luk));
msg += "幸運: " + " " + Luk + "\r\n";
short Watk = (short) Randomizer.rand(5, 10);
sel.setWatk((short) (sel.getWatk() + Watk));
msg += "物理攻擊: " + " " + Watk + "\r\n";
short Matk = (short) Randomizer.rand(5, 10);
sel.setMatk((short) (sel.getMatk() + Matk));
msg += "魔法攻擊: " + " " + Matk + "\r\n";
msg += "-----------------------\r\n";
msg += "請問您是否要繼續附魔?\r\n#d[點選#r是#d,繼續附魔] [點選#r否#d,存取目前附魔]\r\n#d若裝備素質未改變,請重新登入或換頻即可生效!";
int used = StringTool.getIntFromString(sel.getOwner());
used++;
sel.setOwner("已附魔" + used + "次");
item = (Equip) sel.copy();
MapleInventoryManipulator.removeFromSlot(getClient(), MapleInventoryType.EQUIP, (short) slot, item.getQuantity(), false);
MapleInventoryManipulator.addFromDrop(getClient(), item, false);
c.getPlayer().equipChanged();
return msg;
} else {
return "此裝備並非點裝唷!僅有點裝才可以附魔~";
}
}
NPC腳本
隨便找一個NPC塞下方的腳本:
load('nashorn:mozilla_compat.js');
importPackage(java.lang);
var status = -1;
var slot = Array();
var sel;
var item = 4001126; //
function start() {
//status = -1;
action(1, 0, 0);
}
var icon01 = "#fUI/UIWindow.img/CashTradingRoom/BtCoin/normal/0#";
var icon02 = "#fUI/UIWindow.img/UserInfo/bossPetCrown#";
var icon03 = "#fUI/UIWindow.img/AriantMatch/characterIcon/0#";
var icon04 = "#fUI/UIWindow.img/AriantMatch/characterIcon/1#";
var icon05 = "#fUI/UIWindow.img/AriantMatch/characterIcon/2#";
var icon06 = "#fUI/UIWindow.img/AriantMatch/characterIcon/3#";
var icon07 = "#fUI/UIWindow.img/AriantMatch/characterIcon/4#";
var icon08 = "#fUI/UIWindow.img/AriantMatch/characterIcon/5#";
var icon09 = "#fUI/UIWindow.img/Megaphone/0#";
var icon10 = "#fUI/UIWindow.img/CashTradingRoom/icon1#";
var status = -1;
function action(mode, type, selection) {
if (mode == 0 && status == 0) {
cm.dispose();
return;
}
if (mode == 1) {
status++;
} else {
status--;
}
if (status == 0) {
cm.sendSimple(
"#b請問您是否要使用點裝附魔功能呢?#d"+
"\r\n\r\n#L1#附魔一次需要使用#r#z"+item+"##k#d350個!#l"
);
} else if (status == 1) {
sel = selection;
var avail = "";
for (var i = 0; i < 96; i++) {
if (cm.getInventory(1).getItem(i) != null) {
if (Packages.server.MapleItemInformationProvider.getInstance().isCash(cm.getInventory(1).getItem(i).getItemId())) {
avail += "#L" + Math.abs(i) + "##z" + cm.getInventory(1).getItem(i).getItemId() + "##l\r\n";
}
}
}
if(avail == ""){
avail += "很抱歉,您的裝備欄沒有任何的點裝哦!!~";
}
cm.sendSimple("想要附魔哪一件點數裝備呢??\r\n#b" + avail);
} else if (status == 2) {
selected = selection;
cm.sendYesNo("你想要附魔的點裝是 #b#t" + cm.getInventory(1).getItem(selected).getItemId() + "##k.\r\n您確定要對此點裝賦魔??\r\n");
} else if (status == 3) {
var type ;
if (cm.haveItem(item, 350)) {
status = 5;
cm.sendYesNo(cm.EnchantCashEqip(selected));
cm.gainItem(item,-350);
} else {
status = 3;
cm.sendOk("您的#b#z" + item + "##k不足哦!!");
}
} else if (status == 4) {
//cm.getPlayer().fakeRelog();
cm.dispose();
} else if (status == 6) {
status = 2;
cm.sendOk("即將花費#b#z"+item+"##k350個重新附魔此點裝...");
}
}