summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2022-05-12 10:08:38 -0300
committerJesusaves <cpntb1@ymail.com>2022-05-12 10:08:38 -0300
commitc4714d83cb5d7772da8030d575e2eabf0760a664 (patch)
tree1d2ddf55a05530ff295851357c2708ea086c4056
parent589c80cf0583f2f2106f7073ce11b872b34db70b (diff)
downloadserverdata-c4714d83cb5d7772da8030d575e2eabf0760a664.tar.gz
serverdata-c4714d83cb5d7772da8030d575e2eabf0760a664.tar.bz2
serverdata-c4714d83cb5d7772da8030d575e2eabf0760a664.tar.xz
serverdata-c4714d83cb5d7772da8030d575e2eabf0760a664.zip
Update the code behind variable rate healing items
-rw-r--r--db/re/item_db.conf235
-rw-r--r--npc/items/rand_sc_heal.txt81
2 files changed, 83 insertions, 233 deletions
diff --git a/db/re/item_db.conf b/db/re/item_db.conf
index 2339a237c..e55517c94 100644
--- a/db/re/item_db.conf
+++ b/db/re/item_db.conf
@@ -193,9 +193,7 @@ item_db: (
monster(.@map$, .@x, .@y, l("Not An Oak"), SpringSquirrel, 1);
}
} else {
- @type = 0;
- @rarity=1;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 0, 1);
}
">
},
@@ -212,9 +210,7 @@ item_db: (
UseEffect: "EFFECT_HEAL"
Script: <"
//sc_start SC_INCATKRATE, 10000, 100;
- @type = 1;
- @rarity=2;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 1, 2);
">
},
{
@@ -230,9 +226,7 @@ item_db: (
UseEffect: "EFFECT_HEAL"
Script: <"
sc_end SC_POISON;
- @type = 1;
- @rarity=3;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 1, 3);
">
},
{
@@ -247,9 +241,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 1;
- @rarity=3;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 1, 3);
">
},
{
@@ -264,9 +256,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 2;
- @rarity=1;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 2, 1);
">
},
{
@@ -281,9 +271,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 1;
- @rarity=1;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 1, 1);
">
},
{
@@ -298,9 +286,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 1;
- @rarity=3;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 1, 3);
">
},
{
@@ -316,9 +302,7 @@ item_db: (
Script: <"
if (rand(10000) < 1000)
sc_start SC_POISON, 7000, 0;
- @type = 1;
- @rarity=2;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 1, 2);
">
},
{
@@ -333,9 +317,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 1;
- @rarity=5;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 1, 5);
">
},
{
@@ -350,9 +332,7 @@ item_db: (
UseEffect: "EFFECT_HEAL"
Script: <"
sc_start2 SC_POISON, 1, 30, 3333;
- @type = 0;
- @rarity=2;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 0, 2);
">
},
{
@@ -367,9 +347,7 @@ item_db: (
UseEffect: "EFFECT_HEAL"
Script: <"
sc_start2 SC_POISON, 1, 30, 6666;
- @type = 0;
- @rarity=3;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 0, 3);
">
},
{
@@ -384,9 +362,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 1;
- @rarity=4;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 1, 4);
">
},
{
@@ -491,9 +467,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 2;
- @rarity=8;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 2, 8);
">
},
{
@@ -529,9 +503,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 4;
- @rarity=2;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 4, 2);
">
},
{
@@ -546,9 +518,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 4;
- @rarity=4;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 4, 4);
">
},
{
@@ -563,9 +533,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 4;
- @rarity=6;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 4, 6);
">
},
{
@@ -580,9 +548,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 4;
- @rarity=8;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 4, 8);
">
},
{
@@ -597,9 +563,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 4;
- @rarity=10;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 4, 10);
">
},
{
@@ -690,9 +654,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 1;
- @rarity=2;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 1, 2);
">
},
{
@@ -710,9 +672,7 @@ item_db: (
callfunc("SC_Bonus", 30, SC_INCATKRATE, 10);
//callfunc("SC_Bonus", 30, SC_ATTHASTE_POTION1, 5);
sc_end SC_POISON;
- @type = 1;
- @rarity=9;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 1, 9);
">
},
{
@@ -878,9 +838,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 2;
- @rarity=3;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 2, 3);
">
},
{
@@ -895,9 +853,7 @@ item_db: (
Delay: 400
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 1;
- @rarity=4;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 1, 4);
">
},
{
@@ -912,9 +868,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 1;
- @rarity=4;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 1, 4);
">
},
{
@@ -929,9 +883,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 1;
- @rarity=3;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 1, 3);
">
},
{
@@ -946,10 +898,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @delay= 5;
- @type = 3;
- @rarity=9;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 3, 9, 5);
">
},
{
@@ -964,11 +913,6 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- /*
- @type = 1;
- @rarity=4;
- doevent "rand_sc_heal::OnUse";
- */
@taste = 10;
@Alcohol = 7;
doevent "alcohol_sc::OnUse";
@@ -1006,9 +950,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 0;
- @rarity=2;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 0, 2);
">
},
{
@@ -1023,9 +965,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 1;
- @rarity=4;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 1, 4);
if (rand(1,8) != 4)
getitem EmptyBottle, 1;
">
@@ -1042,9 +982,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 0;
- @rarity=4;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 0, 4);
">
},
{
@@ -1059,9 +997,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 1;
- @rarity=4;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 1, 4);
">
},
{
@@ -1076,9 +1012,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 2;
- @rarity=4;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 2, 4);
">
},
{
@@ -1093,9 +1027,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 2;
- @rarity=5;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 2, 5);
">
},
{
@@ -1110,10 +1042,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @delay = rand(1,8);
- @type = 1;
- @rarity=5;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 1, 5, rand(1,8));
">
},
{
@@ -1167,9 +1096,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 1;
- @rarity=4;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 1, 4);
">
},
{
@@ -1184,9 +1111,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 0;
- @rarity=4;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 0, 4);
">
},
{
@@ -1222,9 +1147,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 0;
- @rarity=7;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 0, 7);
">
},
{
@@ -1239,9 +1162,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 1;
- @rarity=4;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 1, 4);
">
},
{
@@ -1292,9 +1213,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 1;
- @rarity=4;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 1, 4);
">
},
{
@@ -1309,9 +1228,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 1;
- @rarity=4;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 1, 4);
">
},
{
@@ -1326,9 +1243,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 1;
- @rarity=4;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 1, 4);
">
},
{
@@ -1343,9 +1258,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 1;
- @rarity=2;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 1, 2);
">
},
{
@@ -1360,9 +1273,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 1;
- @rarity=3;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 1, 3);
">
},
{
@@ -1410,9 +1321,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 1;
- @rarity=5;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 1, 5);
">
},
{
@@ -1427,9 +1336,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 2;
- @rarity=5;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 2, 5);
">
},
{
@@ -1512,9 +1419,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 2;
- @rarity=1;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 2, 1);
">
},
{
@@ -1529,9 +1434,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 1;
- @rarity=9;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 1, 9);
">
},
{
@@ -1546,9 +1449,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 0;
- @rarity=9;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 0, 9);
">
},
{
@@ -1563,9 +1464,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 2;
- @rarity=4;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 2, 4);
">
},
{
@@ -1834,9 +1733,7 @@ item_db: (
Delay: 800
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 1;
- @rarity=6;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 1, 6);
">
},
{
@@ -1851,9 +1748,7 @@ item_db: (
Delay: 100
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 4;
- @rarity=7;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 4, 7);
">
},
{
@@ -1868,9 +1763,7 @@ item_db: (
Delay: 800
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 2;
- @rarity=5;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 2, 5);
">
},
{
@@ -1885,9 +1778,7 @@ item_db: (
Delay: 800
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 2;
- @rarity=6;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 2, 6);
">
},
{
@@ -2169,17 +2060,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 2;
- @rarity=7;
- doevent "rand_sc_heal::OnUse";
- //itemheal rand(100, 250), 0;
- /*
- @min = 100;
- @max = 250;
- @delay = 1;
- @type = 1;
- doevent "rand_sc_heal::OnUse";
- */
+ callfunc("ItHeal2", 2, 7);
">
},
{
@@ -2285,9 +2166,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 1;
- @rarity=4;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 1, 4);
">
},
{
@@ -2303,9 +2182,7 @@ item_db: (
UseEffect: "EFFECT_HEAL"
Script: <"
callfunc "MPHeal", 3, 320, 992;
- @type = 4;
- @rarity=6;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 4, 6);
">
},
{
@@ -18780,9 +18657,7 @@ item_db: (
Delay: 500
UseEffect: "EFFECT_HEAL"
Script: <"
- @type = 4;
- @rarity=2;
- doevent "rand_sc_heal::OnUse";
+ callfunc("ItHeal2", 4, 2);
">
},
{
diff --git a/npc/items/rand_sc_heal.txt b/npc/items/rand_sc_heal.txt
index b8a797585..fca290644 100644
--- a/npc/items/rand_sc_heal.txt
+++ b/npc/items/rand_sc_heal.txt
@@ -31,69 +31,35 @@
//
// *getequipoption(EQI_HEAD_TOP,1,168); → Heal Bonus (should be first bonus on Chef Hat)
-
-- script rand_sc_heal -1,{
-
- // Add remaning bonus if the last one hasn't finished
- /*
- function remaining_bonus
- {
- if (getstatus(getarg(0)))
- {
- .@old_val1 = getstatus(getarg(0), 1);
- .@old_delay = getstatus(getarg(0), 4) * 1000;
-
- // Penalty to healing item stack: -20% on previous item bonus
- .@old_val1 = (.@old_val1*8/10);
-
- // change the delay to prevent fast healing
- if (.@old_delay > @delay)
- {
- @delay = .@old_delay;
- @val1 += .@old_val1;
- }
- else
- {
- @val1 += (.@old_val1 * .@old_delay) / @delay;
- }
- }
- else
- {
- @val1 = @val3;
- }
- return;
- }
- */
-
-OnUse:
- if (@rarity <= 0) {
- Exception("Invalid healing item, deleting without healing effect.");
- end;
- }
+// ItHeal(type, rarity{, delay=auto})
+function script ItHeal2 {
+ .@type=getarg(0);
+ .@rarity=getarg(1);
+ .@delay=getarg(2, 0);
// Calculate healing value in %
- @min=@rarity * ((@type*1) + 1);
- @max=@rarity * ((@type*1) + 1);
+ .@min=.@rarity * ((.@type*1) + 1);
+ .@max=.@rarity * ((.@type*1) + 1);
// Vitality raises the minimum healing value in 1%, capped at maximum vlaue
// It also raises @max up to double
- @max = min(@max*2, @min+(readparam2(bVit)/50));
- @min = min(@max, @min+(readparam2(bVit)/30));
+ .@max = min(.@max*2, .@min+(readparam2(bVit)/50));
+ .@min = min(.@max, .@min+(readparam2(bVit)/30));
// Make these abstract % in absolute values
- @min=max(1, MaxHp*@min/100);
- @max=max(3, MaxHp*@max/100);
+ .@min=max(1, MaxHp*.@min/100);
+ .@max=max(3, MaxHp*.@max/100);
// Calculate how much you'll heal
- @val1 = rand2(@min, @max);
+ @val1 = rand2(.@min, .@max);
// Calculate delay if it was not given
- if (!@delay || @delay > 60) {
- @delay=1 + ((@type*3)/2);
+ if (.@delay < 0) {
+ .@delay=1 + ((.@type*3)/2);
}
// Update val1
- @val1 = (@val1 / @delay) + 1;
+ @val1 = (@val1 / .@delay) + 1;
// Decide the healing bonus type. We have four types: S, L, G and M
// By default, we use 'S'
@@ -116,19 +82,28 @@ OnUse:
*/
// Put the delay in ms
- @delay *= 1000;
+ .@delay *= 1000;
// Apply the effect and finish
sc_end .@skill;
- sc_start2 .@skill, @delay, @val1, 1;
+ sc_start2 .@skill, .@delay, @val1, 1;
+ return @val1;
+}
+
+- script rand_sc_heal -1,{
+ end;
+OnUse:
+ if (@rarity <= 0) {
+ Exception("Invalid healing item, deleting without healing effect.");
+ end;
+ }
+ ItHeal2(@type, @rarity, @delay);
// Clear stuff
// @val1 must be preserved for cross-reading
@delay=0;
@type=0;
@rarity=0;
- @min=0;
- @max=0;
// @val1=0;
end;
}