From 9c4e88cfd0687a2e01522c58f932d3f40d468d6b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 19 Oct 2015 19:56:32 +0300 Subject: Add fixed bonuses for new mounts. --- src/Makefile.am | 2 ++ src/emap/horse.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ src/emap/horse.h | 10 ++++++++++ src/emap/init.c | 1 + src/emap/script.c | 1 + src/emap/status.c | 12 ++++++++++++ src/emap/status.h | 1 + 7 files changed, 73 insertions(+) create mode 100644 src/emap/horse.c create mode 100644 src/emap/horse.h (limited to 'src') 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 +#include +#include + +#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 -- cgit v1.2.3-60-g2f50