summaryrefslogtreecommitdiff
path: root/npc/functions/dailyquest.txt
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2011-01-28 15:40:31 -0800
committerStefan Beller <stefanbeller@googlemail.com>2011-01-29 10:57:18 +0100
commitbcadebe2268deb92e7392efc9e29790b3c1d5a9f (patch)
treea537cd0ef824f120d01ec6aa3f56b14603725b5a /npc/functions/dailyquest.txt
parent8fafc1ed7b2511c400b880873a56f4ae1d8377cd (diff)
downloadserverdata-bcadebe2268deb92e7392efc9e29790b3c1d5a9f.tar.gz
serverdata-bcadebe2268deb92e7392efc9e29790b3c1d5a9f.tar.bz2
serverdata-bcadebe2268deb92e7392efc9e29790b3c1d5a9f.tar.xz
serverdata-bcadebe2268deb92e7392efc9e29790b3c1d5a9f.zip
make daily quest points recharge gradually instead of all at once
Diffstat (limited to 'npc/functions/dailyquest.txt')
-rw-r--r--npc/functions/dailyquest.txt34
1 files changed, 22 insertions, 12 deletions
diff --git a/npc/functions/dailyquest.txt b/npc/functions/dailyquest.txt
index 0c99afd4..dc56895b 100644
--- a/npc/functions/dailyquest.txt
+++ b/npc/functions/dailyquest.txt
@@ -9,11 +9,11 @@
// 4 = Success
// Variables to set:
-// @dq_level - Minumal level needed to use the quest
+// @dq_level - Minimal 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_friendly_name$ - String 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
@@ -23,21 +23,37 @@
// 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 - Additional points added once 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;
+ set @dq_earliest, gettimetick(2) - 86400;
+ if (DailyQuestTime < @dq_earliest) set DailyQuestTime, @dq_earliest;
+
+ //how many whole daily quest points the player has earned
+ //we increment DailyQuestTime by the number of seconds in that many increments
+ set @dq_increments, (gettimetick(2) - DailyQuestTime)*BaseLevel / 86400;
+ set DailyQuestTime, DailyQuestTime+@dq_increments*86400/BaseLevel;
+
+ //player can't regenerate any quest points, but might have a bonus
+ if (DailyQuestPoints >= BaseLevel) goto L_Bonus;
+
+ //normal recharging case - increment, but don't let it recharge more than a day's worth
+ set DailyQuestPoints, DailyQuestPoints + @dq_increments;
+ if (DailyQuestPoints > BaseLevel) set DailyQuestPoints, BaseLevel;
+ //fallthrough to bonus, which *is* allowed to push DailyQuestPoints above BaseLevel
+L_Bonus:
+ if (DailyQuestBonus != 0) set DailyQuestPoints, DailyQuestPoints + DailyQuestBonus;
+ set DailyQuestBonus, 0;
-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 what you want.", L_Trade,
"Ok, I'll get to work.", -,
- "Nah, I'm not going to help you.", -;
+ "Nah, I'm not going to help you.", -;
set @dq_return, 1;
goto L_Exit;
@@ -77,12 +93,6 @@ L_Not_Enough_Points:
set @dq_return, 2;
goto L_Exit;
-L_More_Points:
- set DailyQuestPoints, BaseLevel + DailyQuestBonus;
- set DailyQuestBonus, 0;
- set DailyQuestTime, gettimetick(2);
- goto L_Start;
-
L_Exit:
set @dq_handle_return, 0; // Incase they forget
return;