summaryrefslogtreecommitdiff
path: root/npc/functions/dailyquest.txt
diff options
context:
space:
mode:
authorChuck Miller <shadowmil@gmail.com>2010-08-21 00:13:12 -0400
committerChuck Miller <shadowmil@gmail.com>2010-08-21 00:13:12 -0400
commit7f0ae90d5d3561c93e11aaacb08ed1c631739d23 (patch)
tree6358c5d43de2f8ab0b99892b0e1c19286c1f8bbb /npc/functions/dailyquest.txt
parent48e0520681a38716d69ea1be0b831f0c71f826fc (diff)
downloadserverdata-7f0ae90d5d3561c93e11aaacb08ed1c631739d23.tar.gz
serverdata-7f0ae90d5d3561c93e11aaacb08ed1c631739d23.tar.bz2
serverdata-7f0ae90d5d3561c93e11aaacb08ed1c631739d23.tar.xz
serverdata-7f0ae90d5d3561c93e11aaacb08ed1c631739d23.zip
Add the foundation for the daily quest system
Diffstat (limited to 'npc/functions/dailyquest.txt')
-rw-r--r--npc/functions/dailyquest.txt88
1 files changed, 88 insertions, 0 deletions
diff --git a/npc/functions/dailyquest.txt b/npc/functions/dailyquest.txt
new file mode 100644
index 00000000..e62c604f
--- /dev/null
+++ b/npc/functions/dailyquest.txt
@@ -0,0 +1,88 @@
+// The daily quests
+
+// Variables returned:
+// @dq_return - Code of what happend
+// 0 = Low level
+// 1 = Ignored NPC
+// 2 = Not enough points
+// 3 = Not enough items
+// 4 = Success
+
+// Variables to set:
+// @dq_level - Minumal level needed to use the quest
+// @dq_cost - The number of points this quest uses
+// @dq_count - The number of given item needed
+// @dq_name$ - String name of the item as seen by server
+// @dq_friendly_name$ - Straing name of the item as seen by user
+// @dq_money - The money reward for doing the quest
+// @dq_exp - Experince gained by doing the quest
+
+// Optional:
+// @dq_handle_return - When set to anything other then 0 the function will not print exiting text
+
+// Variables used inside:
+// DailyQuestPoints - The number of points the player currently has
+// DailyQuestTime - Time since DailyQuestPoints was lasted renewed
+// DailyQuestBonus - Additional points that get renewed daily in addition to player BaseLevel
+
+// (DailyQuestBonus makes a good reward from non-daily quests)
+
+function script DailyQuest {
+ if (gettimetick(2) - DailyQuestTime > 86400) goto L_More_Points;
+
+L_Start:
+ if (BaseLevel < @dq_level) goto L_Low_Level;
+ if (DailyQuestPoints < @dq_cost) goto L_Not_Enough_Points;
+
+ mes "\"If you bring me " + @dq_count + " " + @dq_friendly_name$ + " I will give you a reward\"";
+ menu "I have them for you", L_Trade,
+ "Ok, Ill get them", -,
+ "I'm not going to help you", -;
+
+ set @dq_return, 1;
+ goto L_Exit;
+
+L_Trade:
+ if (countitem(@dq_name$) < @dq_count) goto L_Not_Enough;
+ 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!\"";
+ mes "";
+ mes "[" + @dq_money + " money]";
+ mes "[" + @dq_exp + " experience points]";
+
+L_Exit_Good:
+ set @dq_return, 4;
+ goto L_Exit;
+
+L_Not_Enough:
+ if (!@dq_handle_return) mes "\"I said " + @dq_count + " " + @dq_friendly_name$ + ", learn to count\"";
+ set @dq_return, 3;
+ goto L_Exit;
+
+L_Low_Level:
+ if (!@dq_handle_return) mes "\"Hey, you should go kill some things to get stronger\"";
+ set @dq_return, 0;
+ goto L_Exit;
+
+L_Not_Enough_Points:
+ if (!@dq_handle_return) mes "\"You look exhausted, maybe you should rest some.\"";
+ set @dq_return, 2;
+ goto L_Exit;
+
+L_More_Points:
+ set DailyQuestPoints, BaseLevel + DailyQuestBonus;
+ set DailyQuestTime, gettimetick(2);
+ goto L_Start;
+
+L_Exit:
+ set @dq_handle_return, 0; // Incase they forget
+ return;
+}