Skip to content

Instantly share code, notes, and snippets.

@simplyniceweb
Created April 20, 2020 08:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simplyniceweb/6536f6a34bdae8604f9803f9357b9659 to your computer and use it in GitHub Desktop.
Save simplyniceweb/6536f6a34bdae8604f9803f9357b9659 to your computer and use it in GitHub Desktop.
prt_fild06,86,210,6 script Safe Refine 99,{
disable_items;
.@refinecharid = getcharid(0);
setarray .@rate[4],100,80,70,60,50,40,30;
setarray .@indices[1], EQI_HEAD_TOP, EQI_ARMOR, EQI_HAND_L, EQI_HAND_R, EQI_GARMENT, EQI_SHOES, EQI_ACC_L, EQI_ACC_R, EQI_HEAD_MID, EQI_HEAD_LOW;
for(set .@i,1; .@i<=10; set .@i,.@i+1) {
set .@current,.@indices[.@i];
if (getequipisequiped(.@current) && getequiprefinerycnt(.@current) < 10) { // && getequipisenableref(.@current)
set .@menu$, .@menu$ + F_getpositionname(.@current) + "-[" + getequipname(.@current) + "]" + "-[" + getequiprefinerycnt(.@current) + "]";
set .@equipped,1;
}
set .@menu$, .@menu$ + ":";
}
if (.@equipped == 0) {
mes "[Safe Refine]";
mes "I don't think I can refine any items you have...";
close;
}
set .@part, .@indices[ select(.@menu$) ];
setarray .@card[0], getequipcardid(.@part,0), getequipcardid(.@part,1), getequipcardid(.@part,2), getequipcardid(.@part,3);
if (!getequipisequiped(.@part)) {
close;
}
.@refineitemid = getequipid(.@part);
.@refinerycnt = getequiprefinerycnt(.@part);
.@passrate = .@rate[.@refinerycnt];
.@chance = rand((.@rate[.@refinerycnt]-10),100);
.@weaponleft = getequipweaponlv(EQI_HAND_L, .@refinecharid);
.@weaponright = getequipweaponlv(EQI_HAND_R, .@refinecharid);
// Default HD Elu
set .@item_req,6241;
// for weapons HD Oridecon
if (.@part == EQI_HAND_L && .@weaponleft > 0) {
set .@item_req,6240;
}
if (.@part == EQI_HAND_R) {
set .@item_req,6240;
}
switch( select("Upgrade it!","I changed my mind") )
{
case 1:
if (countitem(.@item_req) > 0) {
delitem .@item_req,1;
dispbottom (.@chance) + " chance! " + .@passrate + " passing rate";
if (.@refinerycnt <= 5) {
goto sureball_refine;
} else {
if (.@chance >= .@passrate) {
goto sureball_refine;
} else {
goto fail_refine;
}
}
close;
} else {
mes "Required item is nowhere to be found!";
close;
}
break;
case 2:
mes "[Safe Refine]";
mes "Alright, that's cool!";
close;
break;
}
sureball_refine:
successrefitem .@part;
mes "There you go! It's done.";
mes "It's been a while since I've made such a fine piece of art. You must be happy because it has become stronger!";
emotion ET_BEST;
close;
fail_refine:
downrefitem .@part;
mes "Oh f*$#%!, i am so sorry!";
emotion ET_HUK;
close;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment