summaryrefslogtreecommitdiff
path: root/npc/magic
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-08-10 22:26:02 -0300
committerJesusaves <cpntb1@ymail.com>2019-08-10 22:26:02 -0300
commitc52867f3e29d35044fad5c74e42cf5f28809b3e3 (patch)
treeeaeec32e5c2cba472b128ae04579040caa4e8384 /npc/magic
parenteb97c9821bf5bf9af11fd9a24f5dad280701cf06 (diff)
downloadserverdata-c52867f3e29d35044fad5c74e42cf5f28809b3e3.tar.gz
serverdata-c52867f3e29d35044fad5c74e42cf5f28809b3e3.tar.bz2
serverdata-c52867f3e29d35044fad5c74e42cf5f28809b3e3.tar.xz
serverdata-c52867f3e29d35044fad5c74e42cf5f28809b3e3.zip
Introduce a transcheck helper to optimize transmigration code
Diffstat (limited to 'npc/magic')
-rw-r--r--npc/magic/transmigration.txt37
1 files changed, 20 insertions, 17 deletions
diff --git a/npc/magic/transmigration.txt b/npc/magic/transmigration.txt
index ddc2dcdc8..cd04b9fcd 100644
--- a/npc/magic/transmigration.txt
+++ b/npc/magic/transmigration.txt
@@ -26,6 +26,7 @@ OnCall:
mes "";
menuint
l("Crazy Rum"), CrazyRum,
+ rif(false, l("Downgrade Snake Skin")), SnakeSkin,
l("Mouboo Figurine"), MoubooFigurine;
mes "";
@@ -33,15 +34,23 @@ OnCall:
// Requeriments listing
switch (@menuret) {
- case CrazyRum:
- mesc l("* @@/@@ @@", countitem(Plushroom), 10, getitemlink(Plushroom));
- mesc l("* @@/@@ @@", countitem(Milk), 1, getitemlink(Milk));
- break;
- case MoubooFigurine:
- mesc l("* @@/@@ @@", countitem(WoodenLog), 1, getitemlink(WoodenLog));
- break;
- default:
- Exception("ERROR, INVALID TRANSMIGRATION OPTION", RB_DEFAULT|RB_SPEECH); @menuret=0; break;
+ case CrazyRum:
+ mesc l("* @@/@@ @@", countitem(Plushroom), 10, getitemlink(Plushroom));
+ mesc l("* @@/@@ @@", countitem(Milk), 1, getitemlink(Milk));
+ break;
+ case MoubooFigurine:
+ mesc l("* @@/@@ @@", countitem(WoodenLog), 1, getitemlink(WoodenLog));
+ break;
+ case SnakeSkin:
+ //mesc l("* @@/@@ @@", countitem(WoodenLog), 1, getitemlink(WoodenLog));
+ menuint
+ rif(countitem(BlackMambaSkin), l("Black Mamba Skin -> Mountain Snake Skin")), MountainSnakeSkin,
+ rif(countitem(MountainSnakeSkin), l("Mountain Snake Skin -> Snake Skin")), SnakeSkin,
+ rif(countitem(SnakeSkin), l("Snake Skin -> Cave Snake Skin")), CaveSnakeSkin,
+ l("Cancel");
+ break;
+ default:
+ Exception("ERROR, INVALID TRANSMIGRATION OPTION", RB_DEFAULT|RB_SPEECH); @menuret=0; break;
}
// Confirmation
if (@menuret) {
@@ -58,22 +67,16 @@ OnCall:
// Check and Consume the reagents
switch (@menuret) {
case CrazyRum:
- if (countitem(Plushroom) < 10 ||
- countitem(Milk) < 1) {
+ if (!transcheck(Plushroom, 10, Milk, 1)) {
dispbottom l("Not enough items!");
end;
}
- // Consume items
- delitem Plushroom, 10;
- delitem Milk, 1;
break;
case MoubooFigurine:
- if (countitem(WoodenLog) < 1) {
+ if (!transcheck(WoodenLog, 1)) {
dispbottom l("Not enough items!");
end;
}
- // Consume items
- delitem WoodenLog, 1;
break;
default:
Exception("ERROR, INVALID TRANSMIGRATION REAGENTS", RB_DEFAULT|RB_SPEECH|RB_ISFATAL); break;