Skip to content

Commit

Permalink
* Cleanup redundant usage of getarg() in scripts
Browse files Browse the repository at this point in the history
  * `npc:enchan_mal.txt`

Signed-off-by: Cydh Ramdh <cydh@pservero.com>
  • Loading branch information
cydh committed Dec 6, 2015
1 parent 8b3b32e commit 36d8527
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions npc/re/merchants/enchan_mal.txt
Expand Up @@ -327,13 +327,15 @@ L_Socket:
mes "^0000ff"+.@equip_name$+"^000000! Do you want to enchant this equipment? How will you pay for this?";
next;

.@enclimit = getarg(1);
.@enccost = getarg(1);
setarray .@coin[0],6422,6421,6420,6419,6418,6423; // Payment ID
setarray .@cost[0], 15, 10, 6, 3, 2, 1; // Payment multiplier

set .@menu$, "Stop:";
for(set .@i,0; .@i<getarraysize(.@coin); set .@i,.@i+1) {
set .@count[.@i], countitem(.@coin[.@i]);
set .@total[.@i], getarg(0)*.@cost[.@i];
set .@total[.@i], .@enccost*.@cost[.@i];
if (.@count[.@i] < .@total[.@i])
set .@menu$, .@menu$+"^999999"+getitemname(.@coin[.@i])+" (missing "+(.@total[.@i]-.@count[.@i])+")^000000:";
else
Expand Down Expand Up @@ -384,10 +386,10 @@ L_Socket:
}
break;
}
if (.@equip_card[3] == 0 && getarg(1) < 4) {
if (.@equip_card[3] == 0 && .@enclimit < 4) {
set .@socket,4;
set .@str$,"1st";
} else if (.@equip_card[2] == 0 && getarg(1) < 3) {
} else if (.@equip_card[2] == 0 && .@enclimit < 3) {
set .@socket,3;
set .@str$,"2nd";
} else {
Expand Down Expand Up @@ -575,10 +577,10 @@ L_Socket:
callfunc("F_IsEquipCardHack", EQI_HAND_R, .@equip_card[0], .@equip_card[1], .@equip_card[2], .@equip_card[3]))
close;

if (.@equip_card[3] == 0 && getarg(1) < 4) set .@equip_card[3],.@enchant;
else if (.@equip_card[2] == 0 && getarg(1) < 3) set .@equip_card[2],.@enchant;
else if (.@equip_card[1] == 0 && getarg(1) < 2) set .@equip_card[1],.@enchant;
else if (.@equip_card[0] == 0 && getarg(1) < 1) set .@equip_card[0],.@enchant;
if (.@equip_card[3] == 0 && .@enclimit < 4) set .@equip_card[3],.@enchant;
else if (.@equip_card[2] == 0 && .@enclimit < 3) set .@equip_card[2],.@enchant;
else if (.@equip_card[1] == 0 && .@enclimit < 2) set .@equip_card[1],.@enchant;
else if (.@equip_card[0] == 0 && .@enclimit < 1) set .@equip_card[0],.@enchant;
else {
mes "[Mayomayo]";
mes "This equipment is at the end of enchant. I provide enchant for two times maximum.";
Expand Down

2 comments on commit 36d8527

@cydh
Copy link
Contributor Author

@cydh cydh commented on 36d8527 Dec 6, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Atemo, can u 'continue' the rest? xD I meant, try find on other files and do similarly like this? :D

@Lemongrass3110
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we wait with merging this until you find some others or do you want it to be merged right now?

Please sign in to comment.