summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-08-31 15:41:18 -0300
committerJesusaves <cpntb1@ymail.com>2019-08-31 15:41:18 -0300
commit955ac518aa3892f846b59bf3cd89138f8a962bd4 (patch)
tree5ceadf141a5483c91601975338c4ceff1d9c896b
parenta75647e56b078b585db7eb7ff95bc848d3abac0d (diff)
downloadserverdata-955ac518aa3892f846b59bf3cd89138f8a962bd4.tar.gz
serverdata-955ac518aa3892f846b59bf3cd89138f8a962bd4.tar.bz2
serverdata-955ac518aa3892f846b59bf3cd89138f8a962bd4.tar.xz
serverdata-955ac518aa3892f846b59bf3cd89138f8a962bd4.zip
Make it an util function. Three copies requires c/p to be removed.
-rw-r--r--npc/002-3/elmo.txt9
-rw-r--r--npc/002-3/nard.txt7
-rw-r--r--npc/003-3/malindou.txt9
-rw-r--r--npc/functions/util.txt14
4 files changed, 17 insertions, 22 deletions
diff --git a/npc/002-3/elmo.txt b/npc/002-3/elmo.txt
index 729c09fa7..785eabfe4 100644
--- a/npc/002-3/elmo.txt
+++ b/npc/002-3/elmo.txt
@@ -149,14 +149,7 @@ function ExpBoost {
// Current (2019-04-27) top is 80/80/75, meaning a 19% EXP Boost.
// New rules which give 2x exp boost
// Current (2019-08-31) top is 85/84/83, meaning a 42% EXP/DROP Boost.
- .@AVG_LEVEL=($@hoblvl_value[0]+$@hoblvl_value[1]+$@hoblvl_value[2])/3;
- .@BONUS=min(50, .@AVG_LEVEL/2);
- .@BONUS-=BaseLevel;
- .@BONUS=max(1, .@BONUS);
- sc_end SC_CASH_PLUSEXP;
- sc_end SC_CASH_RECEIVEITEM;
- sc_start SC_CASH_PLUSEXP, 7200000, .@BONUS;
- sc_start SC_CASH_RECEIVEITEM, 7200000, .@BONUS;
+ .@BONUS=NewcomerEXPDROPUP();
specialeffect FX_SPECIAL, SELF, getcharid(3);
mesc l("EXP Gain raised in @@% for one hour!", .@BONUS), 2;
return;
diff --git a/npc/002-3/nard.txt b/npc/002-3/nard.txt
index 736fe7c99..0be2810d4 100644
--- a/npc/002-3/nard.txt
+++ b/npc/002-3/nard.txt
@@ -63,12 +63,7 @@ L_Checker:
mesc l("Elmo has given you an EXP UP and DROP UP Boost until level 20!"), 2;
mesc l("It also expires after two hours. In such case, talk to him again!"), 2;
// Actually, why don't we apply it right now...?
- .@AVG_LEVEL=($@hoblvl_value[0]+$@hoblvl_value[1]+$@hoblvl_value[2])/3;
- .@BONUS=min(50, .@AVG_LEVEL/2);
- sc_end SC_CASH_PLUSEXP;
- sc_end SC_CASH_RECEIVEITEM;
- sc_start SC_CASH_PLUSEXP, 7200000, .@BONUS;
- sc_start SC_CASH_RECEIVEITEM, 7200000, .@BONUS;
+ .@BONUS=NewcomerEXPDROPUP();
specialeffect FX_SPECIAL, SELF, getcharid(3);
mesc l("EXP Gain raised in @@% for one hour!", .@BONUS), 2;
next;
diff --git a/npc/003-3/malindou.txt b/npc/003-3/malindou.txt
index 9c22355a0..72b748b6c 100644
--- a/npc/003-3/malindou.txt
+++ b/npc/003-3/malindou.txt
@@ -519,14 +519,7 @@ OnPCBaseLvUpEvent:
case 10:
case 15:
// Recalculate the bonus
- .@AVG_LEVEL=($@hoblvl_value[0]+$@hoblvl_value[1]+$@hoblvl_value[2])/3;
- .@BONUS=min(50, .@AVG_LEVEL/2);
- .@BONUS-=BaseLevel;
- .@BONUS=max(1, .@BONUS);
- sc_end SC_CASH_PLUSEXP;
- sc_end SC_CASH_RECEIVEITEM;
- sc_start SC_CASH_PLUSEXP, 7200000, .@BONUS;
- sc_start SC_CASH_RECEIVEITEM, 7200000, .@BONUS;
+ NewcomerEXPDROPUP();
break;
case 20:
sc_end SC_CASH_PLUSEXP;
diff --git a/npc/functions/util.txt b/npc/functions/util.txt
index c32a831e1..3b05c799b 100644
--- a/npc/functions/util.txt
+++ b/npc/functions/util.txt
@@ -841,3 +841,17 @@ function script MapToLoc {
return .@locs$[.@lx];
}
+// Grants newcomers exp boost. Returns bonus %
+// NewcomerEXPDROPUP( - )
+function script NewcomerEXPDROPUP {
+ .@AVG_LEVEL=($@hoblvl_value[0]+$@hoblvl_value[1]+$@hoblvl_value[2])/3;
+ .@BONUS=min(50, .@AVG_LEVEL/2);
+ .@BONUS-=BaseLevel;
+ .@BONUS=max(1, .@BONUS);
+ sc_end SC_CASH_PLUSEXP;
+ sc_end SC_CASH_RECEIVEITEM;
+ sc_start SC_CASH_PLUSEXP, 7200000, .@BONUS;
+ sc_start SC_CASH_RECEIVEITEM, 7200000, .@BONUS;
+ return .@BONUS;
+}
+