summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-06-15 18:45:37 -0300
committerJesusaves <cpntb1@ymail.com>2019-06-15 18:45:37 -0300
commit2f45bd7aa3109731edc73316c10338d605734995 (patch)
tree87bce97ad9a4e7b108f407618175462128c76edd
parent422b7b9261527e1b288499da620a5ace6f5b2489 (diff)
downloadserverdata-2f45bd7aa3109731edc73316c10338d605734995.tar.gz
serverdata-2f45bd7aa3109731edc73316c10338d605734995.tar.bz2
serverdata-2f45bd7aa3109731edc73316c10338d605734995.tar.xz
serverdata-2f45bd7aa3109731edc73316c10338d605734995.zip
Rewrite how Mercenary Boxsets are handled (for easier maintenance)
-rw-r--r--db/re/item_db.conf78
-rw-r--r--npc/items/mercenary.txt54
-rw-r--r--npc/scripts.conf1
3 files changed, 58 insertions, 75 deletions
diff --git a/db/re/item_db.conf b/db/re/item_db.conf
index e1295d5ea..bb19dab99 100644
--- a/db/re/item_db.conf
+++ b/db/re/item_db.conf
@@ -12624,31 +12624,7 @@ item_db: (
noauction: true
}
Script: <"
- .@seed=rand(0, 10000)-BaseLevel-readparam(bLuk);
-
- // 0.5%
- if (.@seed < 50) {
- setarray .@r, MercCard_AndreiSakar, MercCard_Woody, MercCard_Lilanna, MercCard_Xanthem;
- .@n=rand(getarraysize(.@r));
- // 2.0%
- } else if (.@seed < 250) {
- setarray .@r, MercCard_Aisen, MercCard_Msawis, MercCard_Swezanne, MercCard_DragonStar;
- .@n=rand(getarraysize(.@r));
- // 10.0%
- } else if (.@seed < 1250) {
- setarray .@r, MercCard_Saulc, MercCard_Crazyfefe, MercCard_LawnCable, MercCard_Arthur;
- .@n=rand(getarraysize(.@r));
- // 25.0%
- } else if (.@seed < 3750) {
- setarray .@r, MercCard_Pookie, MercCard_Jesusalva, MercCard_Demure, MercCard_EarthWitch;
- .@n=rand(getarraysize(.@r));
- // 62.5%
- } else {
- setarray .@r, MercCard_Apane, MercCard_Soren, MercCard_GonzoDark, MercCard_Rosa;
- .@n=rand(getarraysize(.@r));
- }
-
- getitem .@r[.@n], 1;
+ callfunc "merc_boxset", 50, 250, 1250, 3750, 6250;
">
},
{
@@ -12669,31 +12645,7 @@ item_db: (
noauction: true
}
Script: <"
- .@seed=rand(0, 10000)-BaseLevel-readparam(bLuk);
-
- // 1.0%
- if (.@seed < 100) {
- setarray .@r, MercCard_AndreiSakar, MercCard_Woody, MercCard_Lilanna, MercCard_Xanthem;
- .@n=rand(getarraysize(.@r));
- // 5.0%
- } else if (.@seed < 600) {
- setarray .@r, MercCard_Aisen, MercCard_Msawis, MercCard_Swezanne, MercCard_DragonStar;
- .@n=rand(getarraysize(.@r));
- // 20.0%
- } else if (.@seed < 2100) {
- setarray .@r, MercCard_Saulc, MercCard_Crazyfefe, MercCard_LawnCable, MercCard_Arthur;
- .@n=rand(getarraysize(.@r));
- // 35.0%
- } else if (.@seed < 5600) {
- setarray .@r, MercCard_Pookie, MercCard_Jesusalva, MercCard_Demure, MercCard_EarthWitch;
- .@n=rand(getarraysize(.@r));
- // 44.0%
- } else {
- setarray .@r, MercCard_Apane, MercCard_Soren, MercCard_GonzoDark, MercCard_Rosa;
- .@n=rand(getarraysize(.@r));
- }
-
- getitem .@r[.@n], 1;
+ callfunc "merc_boxset", 100, 600, 2100, 5600, 4400;
">
},
{
@@ -12714,31 +12666,7 @@ item_db: (
noauction: true
}
Script: <"
- .@seed=rand(0, 10000)-BaseLevel-readparam(bLuk);
-
- // 2.0%
- if (.@seed < 200) {
- setarray .@r, MercCard_AndreiSakar, MercCard_Woody, MercCard_Lilanna, MercCard_Xanthem;
- .@n=rand(getarraysize(.@r));
- // 10.0%
- } else if (.@seed < 1200) {
- setarray .@r, MercCard_Aisen, MercCard_Msawis, MercCard_Swezanne, MercCard_DragonStar;
- .@n=rand(getarraysize(.@r));
- // 30.0%
- } else if (.@seed < 4200) {
- setarray .@r, MercCard_Saulc, MercCard_Crazyfefe, MercCard_LawnCable, MercCard_Arthur;
- .@n=rand(getarraysize(.@r));
- // 50.0%
- } else if (.@seed < 9200) {
- setarray .@r, MercCard_Pookie, MercCard_Jesusalva, MercCard_Demure, MercCard_EarthWitch;
- .@n=rand(getarraysize(.@r));
- // 8.0%
- } else {
- setarray .@r, MercCard_Apane, MercCard_Soren, MercCard_GonzoDark, MercCard_Rosa;
- .@n=rand(getarraysize(.@r));
- }
-
- getitem .@r[.@n], 1;
+ callfunc "merc_boxset", 200, 1200, 4200, 9200, 800;
">
},
diff --git a/npc/items/mercenary.txt b/npc/items/mercenary.txt
new file mode 100644
index 000000000..c87081760
--- /dev/null
+++ b/npc/items/mercenary.txt
@@ -0,0 +1,54 @@
+// TMW2 scripts.
+// Authors:
+// Jesusalva
+// Description:
+// Core functions for Mercenary boxset
+
+// Main loop
+// merc_boxset(5★, 4★, 3★, 2★, 1★)
+function script merc_boxset {
+ .@s5=getarg(0,0);
+ .@s4=getarg(1,0);
+ .@s3=getarg(2,0);
+ .@s2=getarg(3,0);
+ .@s1=getarg(4,0);
+
+ .@sumup=.@s5+.@s4+.@s3+.@s2+.@s1;
+
+ // Make the seed. More level and luck increases odds of higher rarity
+ .@seed=rand(0, .@sumup)-BaseLevel-readparam(bLuk);
+
+ // 5 ★
+ if (.@seed < .@s5) {
+ setarray .@r, MercCard_AndreiSakar, MercCard_Woody, MercCard_Lilanna, MercCard_Xanthem;
+ .@n=any_of(.@r);
+ // 4 ★
+ } else if (.@seed < .@s4) {
+ setarray .@r, MercCard_Aisen, MercCard_Msawis, MercCard_Swezanne, MercCard_DragonStar;
+ .@n=any_of(.@r);
+ // 3 ★
+ } else if (.@seed < .@s3) {
+ setarray .@r, MercCard_Saulc, MercCard_Crazyfefe, MercCard_LawnCable, MercCard_Arthur;
+ .@n=any_of(.@r);
+ // 2 ★
+ } else if (.@seed < .@s2) {
+ setarray .@r, MercCard_Pookie, MercCard_Jesusalva, MercCard_Demure, MercCard_EarthWitch;
+ .@n=any_of(.@r);
+ // 1 ★
+ } else {
+ setarray .@r, MercCard_Apane, MercCard_Soren, MercCard_GonzoDark, MercCard_Rosa;
+ .@n=any_of(.@r);
+ }
+
+ getitem .@r[.@n], 1;
+ return;
+}
+
+/*
+// Setup a merc_boxset based on level (TODO)
+function script cond_mercboxset {
+ return;
+}
+*/
+
+
diff --git a/npc/scripts.conf b/npc/scripts.conf
index cf4871aba..cda4ea36e 100644
--- a/npc/scripts.conf
+++ b/npc/scripts.conf
@@ -72,6 +72,7 @@
"npc/items/croconut.txt",
"npc/items/emptybox.txt",
"npc/items/lofteleporter.txt",
+"npc/items/mercenary.txt",
"npc/items/shovel.txt",
"npc/items/teleporter.txt",