diff options
author | Fedja Beader <fedja@protonmail.ch> | 2024-04-17 18:33:04 +0200 |
---|---|---|
committer | Fedja Beader <fedja@protonmail.ch> | 2024-04-17 19:04:04 +0200 |
commit | f091b0e42822238ddf45589913b1692b0a99b0f7 (patch) | |
tree | 0d9b63cabb7eb3aa29715bb3c581910e75540ebe | |
parent | 235d7e20df0dfafe2d435210eb4eeb4390dd1a6a (diff) | |
download | classic-serverdata-f091b0e42822238ddf45589913b1692b0a99b0f7.tar.gz classic-serverdata-f091b0e42822238ddf45589913b1692b0a99b0f7.tar.bz2 classic-serverdata-f091b0e42822238ddf45589913b1692b0a99b0f7.tar.xz classic-serverdata-f091b0e42822238ddf45589913b1692b0a99b0f7.zip |
Fix daily quest point gain for characters with bonus points
When a character checks in with a daily point NPC, the bonus daily
points (from boss fights) gets moved into the regular bonus variable. By
my understanding, when this regular bonus variable exceeds the
character's level, the character stops gaining regular daily points.
As you can see, when DailyQuestPoints exceeeds character lvl (97), the
player no longer gets any (DailyQuestTime marks the last time the base
points were added):
Initial state:
[16:53:57] variable DailyQuestBonus[0] == `0` for player AnotherOne.
[16:54:03] variable DailyQuestPoints[0] == `2` for player AnotherOne.
Character receives bonus:
[16:55:15] variable DailyQuestBonus[0] = `150` for player AnotherOne.
Character talks to DPQuest NPC without items, bonus is moved:
[16:55:38] variable DailyQuestBonus[0] == `0` for player AnotherOne.
[16:55:47] variable DailyQuestPoints[0] == `152` for player AnotherOne.
Reset login time in order to get new daily points:
[16:56:06] variable DailyQuestTime[0] = `0` for player AnotherOne.
talk to NPC again:
[16:56:16] variable DailyQuestBonus[0] == `0` for player AnotherOne.
[16:56:21] variable DailyQuestPoints[0] == `152` for player AnotherOne.
-rw-r--r-- | world/map/npc/functions/dailyquest.txt | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/world/map/npc/functions/dailyquest.txt b/world/map/npc/functions/dailyquest.txt index 8933a73e..07d4d90e 100644 --- a/world/map/npc/functions/dailyquest.txt +++ b/world/map/npc/functions/dailyquest.txt @@ -38,20 +38,10 @@ function|script|DailyQuestPoints 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 - goto L_Bonus; - -L_Bonus: - set DailyQuestPoints, DailyQuestPoints + DailyQuestBonus; - set DailyQuestBonus, 0; return; } @@ -64,7 +54,9 @@ function|script|DailyQuest if (BaseLevel < @dq_level) goto L_Low_Level; - if (DailyQuestPoints < @dq_cost) + + set .@total_points, (DailyQuestPoints + DailyQuestBonus); + if (.@total_points < @dq_cost) goto L_Not_Enough_Points; mes "\"If you bring me " + @dq_count + " " + @dq_friendly_name$ + ", I will give you a reward.\""; @@ -83,13 +75,14 @@ L_Trade: goto L_Trade_Combined; L_Trade_All: - set @item_multiple, (countitem(@dq_name$) / @dq_count); - set @dp_multiple, (DailyQuestPoints / @dq_cost); + set .@total_points, (DailyQuestPoints + DailyQuestBonus); + set .@item_multiple, (countitem(@dq_name$) / @dq_count); + set .@dp_multiple, (.@total_points / @dq_cost); - if (@dp_multiple > @item_multiple) - set @dq_multiplier, @item_multiple; + if (.@dp_multiple > .@item_multiple) + set @dq_multiplier, .@item_multiple; else - set @dq_multiplier, @dp_multiple; + set @dq_multiplier, .@dp_multiple; goto L_Trade_Combined; @@ -98,7 +91,12 @@ L_Trade_Combined: if (countitem(@dq_name$) < @dq_count) goto L_Not_Enough; - set DailyQuestPoints, DailyQuestPoints - (@dq_cost * @dq_multiplier); + set .@dq_cost_total, @dq_cost * @dq_multiplier; + set .@dq_cost_bonus, .@dq_cost_total - DailyQuestPoints; + + set DailyQuestPoints, max(0, -.@dq_cost_bonus); + if (.@dq_cost_bonus > 0) + set DailyQuestBonus, DailyQuestBonus - .@dq_cost_bonus; delitem @dq_name$, (@dq_count * @dq_multiplier); @@ -143,15 +141,17 @@ L_Exit: S_SayPhrase: if (@dq_handle_return) goto L_Return; - if (DailyQuestPoints < @dq_cost) + + set .@total_points, (DailyQuestPoints + DailyQuestBonus); + if (.@total_points < @dq_cost) goto L_Exhausted; - if (DailyQuestPoints > BaseLevel) + if (.@total_points > BaseLevel) goto L_Over; - if (DailyQuestPoints > (BaseLevel*9)/10) + if (.@total_points > (BaseLevel*9)/10) goto L_P90; - if (DailyQuestPoints > (BaseLevel*7)/10) + if (.@total_points > (BaseLevel*7)/10) goto L_P70; - if (DailyQuestPoints > (BaseLevel*5)/10) + if (.@total_points > (BaseLevel*5)/10) goto L_P50; goto L_Low; |