summaryrefslogtreecommitdiff
path: root/src/emap/script.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-10-19 18:55:20 +0300
committerAndrei Karas <akaras@inbox.ru>2015-10-19 18:56:34 +0300
commit73defa73651a5e6f7683dc90ab465d19496b8cca (patch)
tree2b7e5ba8e7369e31812c5529aefcca8d5dfe333c /src/emap/script.c
parent6eb6d10d8e1f4fa01d6a5bdc222149cd8552eb6a (diff)
downloadplugin-73defa73651a5e6f7683dc90ab465d19496b8cca.tar.gz
plugin-73defa73651a5e6f7683dc90ab465d19496b8cca.tar.bz2
plugin-73defa73651a5e6f7683dc90ab465d19496b8cca.tar.xz
plugin-73defa73651a5e6f7683dc90ab465d19496b8cca.zip
Add extended mount support.
Diffstat (limited to 'src/emap/script.c')
-rw-r--r--src/emap/script.c94
1 files changed, 11 insertions, 83 deletions
diff --git a/src/emap/script.c b/src/emap/script.c
index f09098e..3c41723 100644
--- a/src/emap/script.c
+++ b/src/emap/script.c
@@ -85,6 +85,8 @@
if (!nd) \
return r;
+extern int mountScriptId;
+
void eset_reg_npcscope_num(struct script_state* st, struct reg_db *n, int64 *num, const char* name, int *val)
{
if (!strcmp(name, ".lang"))
@@ -1423,89 +1425,6 @@ BUILDIN(getAreaDropItem)
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;
-}
-
BUILDIN(clientCommand)
{
getSD();
@@ -1848,3 +1767,12 @@ BUILDIN(delCells)
map->iwall_remove(name);
return true;
}
+
+BUILDIN(setMount)
+{
+ getSD()
+ int mount = script_getnum(st, 2);
+ pc_setglobalreg(sd, mountScriptId, mount);
+ send_pc_info(&sd->bl, &sd->bl, AREA);
+ return true;
+}