diff options
author | Jesusaves <cpntb1@ymail.com> | 2018-12-22 18:39:52 -0200 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2018-12-22 18:39:52 -0200 |
commit | 993cb1442abc9e8b09655d1ce7d9df62198797e0 (patch) | |
tree | 2a0077d357b27ac6df11dcd6f2fd825498aa43ab | |
parent | 901e82a4a8cbb29a4fe71de20cab303ce1dcd397 (diff) | |
download | serverdata-993cb1442abc9e8b09655d1ce7d9df62198797e0.tar.gz serverdata-993cb1442abc9e8b09655d1ce7d9df62198797e0.tar.bz2 serverdata-993cb1442abc9e8b09655d1ce7d9df62198797e0.tar.xz serverdata-993cb1442abc9e8b09655d1ce7d9df62198797e0.zip |
Fix log2() formula and fix Christmas gifts for reward count.
There was a misplaced 1, and an edge case was not handled previously (gifts=0).
-rw-r--r-- | npc/019-4-1/chief.txt | 4 | ||||
-rw-r--r-- | npc/functions/math.txt | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/npc/019-4-1/chief.txt b/npc/019-4-1/chief.txt index 149e2afa1..ed3221235 100644 --- a/npc/019-4-1/chief.txt +++ b/npc/019-4-1/chief.txt @@ -72,7 +72,7 @@ L_Reward: // #4 - #5: Extra xmas gift /* You get Christmas Gift Box, which contain rares */ - .@gifts=min(15, log2(($XMAS_GIFTS/100)+1)); + .@gifts=min(15, log2($XMAS_GIFTS/100))+1; if (.@q1 >= .@gifts) getitem XmasGift, .@gifts; .@nb = query_sql("SELECT c.name FROM `quest` AS i, `char` AS c WHERE i.quest_id="+SQuest_Christmas+" AND i.char_id=c.char_id ORDER BY i.count2 DESC LIMIT 5", .@name$); @@ -152,7 +152,7 @@ L_Main: mesq l("We only managed to recover @@ stolen @@ thus far...", $XMAS_GIFTS, getitemlink(ClosedChristmasBox)); // Same formula from 2007 event. (max: 3.276.800 boxes delivered, an ABSURD amount) // You need to give at least this many boxes yourself to be eligible for rewards, though. - .@gifts=min(15, log2(($XMAS_GIFTS/100)+1)); + .@gifts=min(15, log2($XMAS_GIFTS/100))+1; mesq l("If things keep like this, we will only manage to give @@ gifts to every player...", .@gifts); if (.@q < .@gifts) mesc l("WARNING: You must give at least @@ boxes more before event ends to be eligible for a reward!", .@gifts-.@q), 1; diff --git a/npc/functions/math.txt b/npc/functions/math.txt index 3c2c935d9..ebb9ee069 100644 --- a/npc/functions/math.txt +++ b/npc/functions/math.txt @@ -46,6 +46,8 @@ function script log2 { .@v=abs(getarg(0)); .@ok=0; .@i=0; + if (.@v < 1) + return -1; freeloop(true); while (!.@ok) { |