summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Makefile.am2
-rw-r--r--src/emap/horse.c46
-rw-r--r--src/emap/horse.h10
-rw-r--r--src/emap/init.c1
-rw-r--r--src/emap/script.c1
-rw-r--r--src/emap/status.c12
-rw-r--r--src/emap/status.h1
7 files changed, 73 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index fda9647..56a2b35 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -36,6 +36,8 @@ MAP_SRC = emap/atcommand.c \
emap/battleground.h \
emap/clif.c \
emap/clif.h \
+ emap/horse.c \
+ emap/horse.h \
emap/init.c \
emap/itemdb.c \
emap/itemdb.h \
diff --git a/src/emap/horse.c b/src/emap/horse.c
new file mode 100644
index 0000000..f56926f
--- /dev/null
+++ b/src/emap/horse.c
@@ -0,0 +1,46 @@
+// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// Copyright (c) 2014 - 2015 Evol developers
+
+#include "common/hercules.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "common/HPMi.h"
+#include "common/memmgr.h"
+#include "common/mmo.h"
+#include "common/socket.h"
+#include "common/strlib.h"
+#include "map/map.h"
+#include "map/pc.h"
+
+#include "emap/data/session.h"
+#include "emap/struct/sessionext.h"
+
+void horse_add_bonus(TBL_PC *sd)
+{
+ struct SessionExt *data = session_get_bysd(sd);
+ if (!data || data->mount == 0)
+ return;
+
+ struct status_data *bstatus = &sd->base_status;
+
+ bstatus->aspd_rate += 50 - 10 * pc->checkskill(sd, KN_CAVALIERMASTERY);
+
+ if (pc->checkskill(sd, KN_RIDING) > 0)
+ sd->max_weight += 10000;
+}
+
+unsigned short horse_add_speed_bonus(TBL_PC *sd, unsigned short val)
+{
+ if (sd)
+ {
+ struct SessionExt *data = session_get_bysd(sd);
+ if (!data || data->mount == 0)
+ return val;
+
+ val -= 25;
+ }
+ return val;
+}
diff --git a/src/emap/horse.h b/src/emap/horse.h
new file mode 100644
index 0000000..cdd5251
--- /dev/null
+++ b/src/emap/horse.h
@@ -0,0 +1,10 @@
+// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// Copyright (c) 2014 - 2015 Evol developers
+
+#ifndef EVOL_MAP_HORSE
+#define EVOL_MAP_HORSE
+
+void horse_add_bonus(TBL_PC *sd);
+unsigned short horse_add_speed_bonus(TBL_PC *sd, unsigned short val);
+
+#endif // EVOL_MAP_HORSE
diff --git a/src/emap/init.c b/src/emap/init.c
index 4d55b42..fbf41d4 100644
--- a/src/emap/init.c
+++ b/src/emap/init.c
@@ -210,6 +210,7 @@ HPExport void plugin_init (void)
addHookPost("status->set_viewdata", estatus_set_viewdata_post);
addHookPost("status->read_job_db_sub", estatus_read_job_db_sub);
addHookPost("status->calc_pc_", estatus_calc_pc__post);
+ addHookPost("status->calc_speed", estatus_calc_speed_post);
addHookPost("clif->set_unit_walking", eclif_set_unit_walking);
addHookPost("clif->move", eclif_move);
addHookPost("map->addflooritem", emap_addflooritem_post);
diff --git a/src/emap/script.c b/src/emap/script.c
index 3c41723..1874564 100644
--- a/src/emap/script.c
+++ b/src/emap/script.c
@@ -1773,6 +1773,7 @@ BUILDIN(setMount)
getSD()
int mount = script_getnum(st, 2);
pc_setglobalreg(sd, mountScriptId, mount);
+ status_calc_pc(sd, SCO_NONE);
send_pc_info(&sd->bl, &sd->bl, AREA);
return true;
}
diff --git a/src/emap/status.c b/src/emap/status.c
index bbbd34c..9575e1f 100644
--- a/src/emap/status.c
+++ b/src/emap/status.c
@@ -19,6 +19,7 @@
#include "map/script.h"
#include "map/status.h"
+#include "emap/horse.h"
#include "emap/data/itemd.h"
#include "emap/data/npcd.h"
#include "emap/struct/itemdext.h"
@@ -123,5 +124,16 @@ int estatus_calc_pc_additional(struct map_session_data* sd,
// here can be refine bonuses
}
+
+ horse_add_bonus(sd);
+
return 0;
}
+
+unsigned short estatus_calc_speed_post(unsigned short retVal,
+ struct block_list *bl,
+ struct status_change *sc,
+ int *speed)
+{
+ return horse_add_speed_bonus(BL_CAST(BL_PC, bl), retVal);
+}
diff --git a/src/emap/status.h b/src/emap/status.h
index e18a3da..bf40713 100644
--- a/src/emap/status.h
+++ b/src/emap/status.h
@@ -9,5 +9,6 @@ void estatus_set_viewdata_post(struct block_list *bl, int *class_);
void estatus_read_job_db_sub(int *idxPtr, const char *name, config_setting_t *jdb);
int estatus_calc_pc__post(int retVal, struct map_session_data* sd, enum e_status_calc_opt *opt);
int estatus_calc_pc_additional(struct map_session_data* sd, enum e_status_calc_opt *opt);
+unsigned short estatus_calc_speed_post(unsigned short retVal, struct block_list *bl, struct status_change *sc, int *speed);
#endif // EVOL_MAP_STATUS