summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2018-12-15 18:00:20 -0200
committerJesusaves <cpntb1@ymail.com>2018-12-15 18:00:20 -0200
commitc447528402f903a5ca3e8eec0ad36b52815b992c (patch)
tree05c9a03f4c0a09cdba12b8d70c74eb42d37d5e79
parent8ccbaf6d7bb767ecc83b9b7941655fe7d7aa1de4 (diff)
downloadserverdata-c447528402f903a5ca3e8eec0ad36b52815b992c.tar.gz
serverdata-c447528402f903a5ca3e8eec0ad36b52815b992c.tar.bz2
serverdata-c447528402f903a5ca3e8eec0ad36b52815b992c.tar.xz
serverdata-c447528402f903a5ca3e8eec0ad36b52815b992c.zip
log2 function, golbarez rewards, main quest restriction, gift count
-rw-r--r--npc/019-4-1/bedder.txt2
-rw-r--r--npc/019-4-1/chief.txt8
-rw-r--r--npc/functions/math.txt28
3 files changed, 37 insertions, 1 deletions
diff --git a/npc/019-4-1/bedder.txt b/npc/019-4-1/bedder.txt
index e069ac4e7..e4ea2a612 100644
--- a/npc/019-4-1/bedder.txt
+++ b/npc/019-4-1/bedder.txt
@@ -12,7 +12,7 @@
019-4-1,48,39,0 script Christmas Storage Master NPC_GNOME_C,{
mesn;
- mesq l("The white fur...");
+ mesq l("I was informed that our bedding material for fragile presents is nearly depleted...");
close;
OnInit:
diff --git a/npc/019-4-1/chief.txt b/npc/019-4-1/chief.txt
index 059d67461..43fc53fbe 100644
--- a/npc/019-4-1/chief.txt
+++ b/npc/019-4-1/chief.txt
@@ -48,6 +48,8 @@ L_Reward:
// TODO
/* Handle Golbarez Quest Rewards */
+ /* Mostly Coins, some Merc Boxes, EXP/JExp */
+ /* Gift the best people at this quest, too */
getexp .@q3/4, .@q3/1000;
.@coins=.@q3/10000;
if (.@coins)
@@ -97,9 +99,15 @@ L_Main:
.@q=getq2(SQuest_Christmas);
mesn;
mesq l("The stolen empty boxes!! Christmas is RUINED!!!");
+ // How did you even reach here in first place?
+ if (BaseLevel < 20) {
+ close;
+ }
next;
mesn;
mesq l("We only managed to recover @@ thus far...", $XMAS_GIFTS);
+ // Same formula from 2007 event
+ .@gifts=max(15, log2(gifts/100));
close;
OnInit:
diff --git a/npc/functions/math.txt b/npc/functions/math.txt
index 004125c7b..a7be729a3 100644
--- a/npc/functions/math.txt
+++ b/npc/functions/math.txt
@@ -38,3 +38,31 @@ function script lognbaselvl {
return .@ret;
}
+
+// log2(<int>)
+// returns the log base 2 of the passed integer, up to 20 (2**20=1.048.576) (round down always)
+
+function script log2 {
+ .@v=abs(getarg(0));
+ .@ok=0;
+ .@i=0;
+
+ freeloop(true);
+ while (!.@ok) {
+ // exact match
+ if (2**.@i == .@v) {
+ .@ok=1;
+ // inexact match, or limit exceeded
+ } if (2**.@i >= .@v || .@i > 20) {
+ .@ok=1;
+ .@i-=1; // round down
+ // not yet
+ } else {
+ .@i+=1;
+ }
+ }
+ freeloop(false);
+
+ return .@i;
+}
+