//= Refines many items (2+) at one time.
//============================================================
- script Mass_Refiner FAKE_NPC,{
mes("Is mass refining");
mes("For real?");
mes("I'm kinda confused");
mes("they said");
mes("its impossible because it involves more zeny");
mes("but …");
mes("its fine but its on your own risk");
mes("(said by whom)");
mes("(Also this isnt just some RO)");
mes("(Fineee... kekekekke)");
next();
while (true) {
.@Menu$ = "";
if (.@j > 0) {
deletearray(.@Menu);
.@j = 0;
}
.@weight = 100 * Weight / MaxWeight;
if( 50 <= .@weight ) {
mes .n$;
mes "You are currently at "+ .@weight +" percent of your maximum weight.";
close;
}
getinventorylist();
for (.@i = 0; .@i < @inventorylist_count; .@i++) {
.@id = @inventorylist_id[.@i];
if (.@id == -1)
continue;
if (countitem(.@id) < 2)
continue;
if (getiteminfo(.@id, ITEMINFO_TYPE) == IT_WEAPON || getiteminfo(.@id, ITEMINFO_TYPE) == IT_ARMOR) {
// Ignore if accessory or costume
.@Loc = getiteminfo(.@id, ITEMINFO_LOC);
if !(.@Loc & EQP_COSTUME_HEAD_TOP) && !(.@Loc & EQP_COSTUME_HEAD_MID) && !(.@Loc & EQP_COSTUME_HEAD_LOW) && (.@Loc != EQP_ACC) {
// ignore if already in array
if (array_find(.@Menu, .@id) == -1) {
.@Menu$ += sprintf("%s [%d] x%d:", getitemname(.@id), getiteminfo(.@id, ITEMINFO_SLOTS), countitem(.@id));
.@Menu[.@j] = .@id;
.@j++;
}
}
}
}
.@Menu$ += "^008800Help.^000000:";
.@Menu$ += "^777777Cancel.^000000";
if (.@j < 1) {
mes(.@name$);
mes("I am the mass refiner,");
mes("but you need to have");
mes("more than one of a weapon");
mes("or armor to mass refine.");
close();
}
mes(.@name$);
mes("Choose an item to mass");
mes("refine. You must be able");
mes("to equip it, otherwise");
mes("I can't help you.");
next();
.@i = select(.@Menu$) - 1;
if (.@i == .@j + 1)
callsub(S_Cancel);
else if (.@i == .@j) {
mes(.@name$);
mes("My service is mass refining");
mes("equipment. In order to");
mes("do so, the following");
mes("criteria must be met:");
next();
mes(.@name$);
mes("1. You can equip the item.");
mes("2. You have at least 2");
mes("of the item.");
mes("3. The item(s) can be");
mes("further refined.");
mes("4. You have enough materials");
mes("and zeny.");
next();
mes(.@name$);
mes("Prices are as follows:");
mes("(per refine level and item)");
mes("^000088Armors:^000000 1x Elunium, 20,000z.");
mes("^000088Lv1 Weapon:^000000 1x Phracon, 10,000z.");
mes("^000088Lv2 Weapon:^000000 1x Emveretarcon, 20,000z.");
mes("^000088Lv3 Weapon:^000000 1x Oridecon, 30,000z.");
mes("^000088Lv4 Weapon:^000000 1x Oridecon, 40,000z.");
next();
continue;
}
break;
}
.@id = .@Menu[.@i];
switch (getiteminfo(.@id, ITEMINFO_LOC)) {
case EQP_HEAD_TOP:
.@Part = EQI_HEAD_TOP;
break;
case EQP_HEAD_MID:
.@Part = EQI_HEAD_MID;
break;
case EQP_HEAD_LOW:
.@Part = EQI_HEAD_LOW;
break;
case EQP_ARMOR:
.@Part = EQI_ARMOR;
break;
case EQP_WEAPON:
.@Part = EQI_HAND_R;
break;
case EQP_SHIELD:
.@Part = EQI_HAND_L;
break;
case EQP_GARMENT:
.@Part = EQI_GARMENT;
break;
case EQP_SHOES:
.@Part = EQI_SHOES;
break;
}
if (getequipid(.@Part) != .@id) {
if (equip(.@id) != 1) {
mes(.@name$);
mes("You need to be able");
mes("to equip an item to");
mes("mass refine it.");
close();
}
}
mes(.@name$);
mes("When do you want the");
mes("refine attempts to end?");
next();
while (input(.@End, 1, 10) != 0) {
mes(.@name$);
mes("Please input a number");
mes("from 1 to 10.");
next();
if (select("Retry.", "^777777Cancel.^000000") == 2)
callsub(S_Cancel);
}
switch (getequipweaponlv(.@Part)) {
case 0:
.@material = Elunium;
.@Price = 20000;
setarray(.@Chance[1], 100, 100, 100, 100, 60, 40, 40, 20, 20, 9);
break;
case 1:
.@material = Phracon;
.@Price = 10000;
setarray(.@Chance[1], 100, 100, 100, 100, 100, 100, 100, 60, 40, 19);
break;
case 2:
.@material = Emveretarcon;
.@Price = 20000;
setarray(.@Chance[1], 100, 100, 100, 100, 100, 100, 60, 40, 20, 19);
break;
case 3:
.@material = Oridecon;
.@Price = 30000;
setarray(.@Chance[1], 100, 100, 100, 100, 100, 60, 50, 20, 20, 19);
break;
case 4:
.@material = Oridecon;
.@Price = 40000;
setarray(.@Chance[1], 100, 100, 100, 100, 60, 40, 40, 20, 20, 9);
break;
}
if (getequipid(.@Part) == .@id)
unequip(.@Part);
.@count = countitem(.@id);
mes(.@name$);
mes("Please confirm you want");
mes("to attempt to refine all");
mesf("^ff0000%d^000000 of your ^ff0000%s^000000 until ^ff0000+%d^000000.", .@count, getitemname(.@id), .@End);
mes("It will cost you up to");
mesf("^ff0000%s^000000z and up to", F_PriceString(.@Price * .@End));
mesf("^ff0000%d %s^000000 per attempt.", .@End, getitemname(.@material));
next();
mes(.@name$);
mes("If you run out of zeny");
mes("or materials, the process");
mes("will stop. I recommend");
mesf("you have at least ^ff0000%d", .@count * .@End);
mesf("%s^000000 and ^ff0000%s^000000z.", getitemname(.@material), F_PriceString(.@Price * .@End * .@count));
next();
if (select("^FF8000Confirm, attempt mass refine.^000000", "^777777Cancel.^000000") == 2)
callsub(S_Cancel);
.@j = 0;
.@count = 0;
getinventorylistindex();
for (.@i = 0; .@i < @inventorylist_count; .@i++) {
if (@inventorylist_id[.@i] == .@id && @inventorylist_refine[.@i] < .@End && @inventorylist_expire[.@i] == 0) {
.@Index[.@j] = .@i;
.@j++;
.@count++;
.@Card = @inventorylist_card1[.@i];
if ((.@Card >= 4000 && .@Card < 5000) || (.@Card >= 27000 && .@Card <= 27100))
.@k++;
}
}
if (.@count == 0) {
mes(.@name$);
mes("Hmm...seems all versions");
mesf("of '%s [%d]' in your", getitemname(.@id), getiteminfo(.@id, ITEMINFO_SLOTS));
mesf("inventory are already +%d", .@End);
mes("or higher.");
close();
}
if (.@k > 0) {
mes(.@name$);
mes("Hmm...seems one of your");
mes("items has a card in it.");
mes("Continue anyway?");
next();
if (select("^FF8000Confirm, attempt mass refine.^000000", "^777777Cancel.^000000") == 2)
callsub(S_Cancel);
}
mes(.@name$);
mes("Attempting mass refine...");
mes("Press next to continue...");
next();
for (.@i = 0; .@i < .@count; .@i++) {
if (equipidx(.@Index[.@i], .@id) == 0)
continue;
if (getequipisenableref(.@Part) == 0 || getequipisidentify(.@Part) == 0 || getequiprefinerycnt(.@Part) >= .@End || getequiprefinerycnt(.@Part) >= 10)
continue;
.@refinecnt = .@End - getequiprefinerycnt(.@Part);
.@endcnt = .@refinecnt;
.@j = getequiprefinerycnt(.@Part);
.@k = 0;
while (.@refinecnt > 0 && getequiprefinerycnt(.@Part) < .@End) {
.@j++;
.@k++;
if (.@Chance[.@j] <= rand(100))
break;
else
.@refinecnt--;
}
if (Zeny < .@Price * .@k) {
mes(.@name$);
mes("You ran out of Zeny.");
next();
break;
} else if (countitem(.@material) < .@k) {
mes(.@name$);
mesf("You ran out of %s.", getitemname(.@material));
next();
break;
}
Zeny -= .@Price * .@k;
delitem(.@material, .@k);
if (.@refinecnt > 0) {
delitemidx(.@Index[.@i]);
getitem2(.@id, 1, 1, .@j - 1, 0, 0, 0, 0, 0);
delitem2(.@id, 1, 1, .@j - 1, 0, 0, 0, 0, 0);
specialeffect(EF_HIT3, AREA, playerattached());
specialeffect(EF_REFINEFAIL, AREA, playerattached());
emotion(e_omg);
.@Fail++;
} else {
successrefitem(.@Part, .@endcnt);
emotion(e_no1);
emotion(e_thx, true);
.@Success++;
}
if (getequipid(.@Part) == .@id)
unequip(.@Part);
next();
}
mes(.@name$);
mes("Mass refine process");
mes("complete. Report:");
mesf("^008800%d success%s.^000000", .@Success, (.@Success == 1) ? "" : "es");
mesf("^ff0000%d failure%s.^000000", .@Fail, F_IntToPlural(.@Fail));
close();
S_Cancel:
mes(F_NpcName(strnpcinfo(NPC_NAME_VISIBLE)));
mes("You said so...hmm...so be it...");
close();
}
//=== Duplicates
dewata,210,129,4 duplicate(Mass_Refiner) Bogart#ama 4_M_DWARF
//turbo_room,93,117,5 duplicate(Blackout_Refiner) Refiner#turbo 4_M_LGTMAN
//niflheim,186,198,5 duplicate(Blackout_Refiner) Refiner#nif 4_M_DWARF