summaryrefslogtreecommitdiff
path: root/world/map/npc/functions
diff options
context:
space:
mode:
authorFedja Beader <fedja@protonmail.ch>2024-04-16 22:52:07 +0200
committerFedja Beader <fedja@protonmail.ch>2024-04-16 22:52:39 +0200
commit70ea2cb05b4a70ecce7e71cfe9b9e94a086409ec (patch)
tree8c1ae12dc63773022face572283c359eabec533c /world/map/npc/functions
parent4ac11d1a7216c06a0455c6efda18d308903e6e27 (diff)
downloadclassic-serverdata-70ea2cb05b4a70ecce7e71cfe9b9e94a086409ec.tar.gz
classic-serverdata-70ea2cb05b4a70ecce7e71cfe9b9e94a086409ec.tar.bz2
classic-serverdata-70ea2cb05b4a70ecce7e71cfe9b9e94a086409ec.tar.xz
classic-serverdata-70ea2cb05b4a70ecce7e71cfe9b9e94a086409ec.zip
Deduplicate both branches of daily point trade-in
Diffstat (limited to 'world/map/npc/functions')
-rw-r--r--world/map/npc/functions/dailyquest.txt37
1 files changed, 11 insertions, 26 deletions
diff --git a/world/map/npc/functions/dailyquest.txt b/world/map/npc/functions/dailyquest.txt
index 2770e2e7..8933a73e 100644
--- a/world/map/npc/functions/dailyquest.txt
+++ b/world/map/npc/functions/dailyquest.txt
@@ -70,7 +70,7 @@ function|script|DailyQuest
mes "\"If you bring me " + @dq_count + " " + @dq_friendly_name$ + ", I will give you a reward.\"";
menu
"I have what you want.", L_Trade,
- "Take all you need.", L_All,
+ "Take all you need.", L_Trade_All,
"Ok, I'll get to work.", L_Next,
"Nah, I'm not going to help you.", L_Next;
@@ -79,40 +79,25 @@ L_Next:
goto L_Exit;
L_Trade:
- if (countitem(@dq_name$) < @dq_count)
- goto L_Not_Enough;
-
set @dq_multiplier, 1;
+ goto L_Trade_Combined;
- delitem @dq_name$, @dq_count;
-
- set Zeny, Zeny + @dq_money;
- getexp @dq_exp, 0;
-
- set DailyQuestPoints, DailyQuestPoints - @dq_cost;
-
- if (@dq_handle_return)
- goto L_Exit_Good;
-
- mes "\"Thank you!\"";
- callsub S_SayPhrase;
- mes "";
- mes "[" + @dq_money + " money]";
- mes "[" + @dq_exp + " experience points]";
- goto L_Exit_Good;
-
-L_All:
- if (countitem(@dq_name$) < @dq_count)
- goto L_Not_Enough;
-
+L_Trade_All:
set @item_multiple, (countitem(@dq_name$) / @dq_count);
set @dp_multiple, (DailyQuestPoints / @dq_cost);
if (@dp_multiple > @item_multiple)
set @dq_multiplier, @item_multiple;
- if (@item_multiple >= @dp_multiple)
+ else
set @dq_multiplier, @dp_multiple;
+ goto L_Trade_Combined;
+
+L_Trade_Combined:
+ // the check for points already happens before the menu.
+ if (countitem(@dq_name$) < @dq_count)
+ goto L_Not_Enough;
+
set DailyQuestPoints, DailyQuestPoints - (@dq_cost * @dq_multiplier);
delitem @dq_name$, (@dq_count * @dq_multiplier);