summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-03-04 00:42:14 +0300
committerAndrei Karas <akaras@inbox.ru>2015-03-04 00:42:14 +0300
commitdb82d35cb549aa305df53c4f0cbe5149062161e3 (patch)
treeb84d5e84283a3a4377d77a9e360fe4e9836227ff /src/map/script.c
parent11d79efc68426eb1642ee41a2c576e6e5c5782f2 (diff)
downloadevol-hercules-db82d35cb549aa305df53c4f0cbe5149062161e3.tar.gz
evol-hercules-db82d35cb549aa305df53c4f0cbe5149062161e3.tar.bz2
evol-hercules-db82d35cb549aa305df53c4f0cbe5149062161e3.tar.xz
evol-hercules-db82d35cb549aa305df53c4f0cbe5149062161e3.zip
Copy setmount script command from hercules and remove limits for class job.
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c83
1 files changed, 83 insertions, 0 deletions
diff --git a/src/map/script.c b/src/map/script.c
index c582fd5..efd117a 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -1014,3 +1014,86 @@ BUILDIN(getAreaDropItem)
script_pushint(st, amount);
return true;
}
+
+enum setmount_type
+{
+ SETMOUNT_TYPE_NONE = 0,
+ SETMOUNT_TYPE_PECO = 1,
+ SETMOUNT_TYPE_WUG = 2,
+ SETMOUNT_TYPE_MADO = 3,
+ SETMOUNT_TYPE_DRAGON_GREEN = 4,
+ SETMOUNT_TYPE_DRAGON_BROWN = 5,
+ SETMOUNT_TYPE_DRAGON_GRAY = 6,
+ SETMOUNT_TYPE_DRAGON_BLUE = 7,
+ SETMOUNT_TYPE_DRAGON_RED = 8,
+ SETMOUNT_TYPE_MAX,
+ SETMOUNT_TYPE_DRAGON = SETMOUNT_TYPE_DRAGON_GREEN,
+};
+
+BUILDIN(setMount)
+{
+ int flag = SETMOUNT_TYPE_NONE;
+ TBL_PC* sd = script->rid2sd(st);
+
+ if (sd == NULL)
+ return true; // no player attached, report source
+
+ if (script_hasdata(st, 2))
+ flag = script_getnum(st, 2);
+
+ // Sanity checks and auto-detection
+ if (flag >= SETMOUNT_TYPE_DRAGON_GREEN && flag <= SETMOUNT_TYPE_DRAGON_RED)
+ {
+ if (pc->checkskill(sd, RK_DRAGONTRAINING))
+ {
+ // Rune Knight (Dragon)
+ unsigned int option;
+ option = ( flag == SETMOUNT_TYPE_DRAGON_GREEN ? OPTION_DRAGON1 :
+ flag == SETMOUNT_TYPE_DRAGON_BROWN ? OPTION_DRAGON2 :
+ flag == SETMOUNT_TYPE_DRAGON_GRAY ? OPTION_DRAGON3 :
+ flag == SETMOUNT_TYPE_DRAGON_BLUE ? OPTION_DRAGON4 :
+ flag == SETMOUNT_TYPE_DRAGON_RED ? OPTION_DRAGON5 :
+ OPTION_DRAGON1); // default value
+ pc->setridingdragon(sd, option);
+ }
+ }
+ else if (flag == SETMOUNT_TYPE_WUG)
+ {
+ // Ranger (Warg)
+ if (pc->checkskill(sd, RA_WUGRIDER))
+ pc->setridingwug(sd, true);
+ }
+ else if (flag == SETMOUNT_TYPE_MADO)
+ {
+ // Mechanic (Mado Gear)
+ if (pc->checkskill(sd, NC_MADOLICENCE))
+ pc->setmadogear(sd, true);
+ }
+ else if (flag == SETMOUNT_TYPE_PECO)
+ {
+ // Knight / Crusader (Peco Peco)
+ if (pc->checkskill(sd, KN_RIDING))
+ pc->setridingpeco(sd, true);
+ }
+ else if (flag == SETMOUNT_TYPE_NONE && pc_hasmount(sd))
+ {
+ if (pc_isridingdragon(sd))
+ {
+ pc->setridingdragon(sd, 0);
+ }
+ if (pc_isridingwug(sd))
+ {
+ pc->setridingwug(sd, false);
+ }
+ if (pc_ismadogear(sd))
+ {
+ pc->setmadogear(sd, false);
+ }
+ if (pc_isridingpeco(sd))
+ {
+ pc->setridingpeco(sd, false);
+ }
+ }
+
+ return true;
+}