summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2024-05-08 23:53:24 -0300
committerJesusaves <cpntb1@ymail.com>2024-05-08 23:53:24 -0300
commitce242a334015745f1c32029ef15473f778e38742 (patch)
tree41c62d1d6d05ee95f33cdf0e4b3978f34f178dff
parentbc0a3f0204e0460548679421c511e517866d0371 (diff)
downloadevol-hercules-ce242a334015745f1c32029ef15473f778e38742.tar.gz
evol-hercules-ce242a334015745f1c32029ef15473f778e38742.tar.bz2
evol-hercules-ce242a334015745f1c32029ef15473f778e38742.tar.xz
evol-hercules-ce242a334015745f1c32029ef15473f778e38742.zip
Botter Syndrome
-rw-r--r--src/emap/enum/esctype.h1
-rw-r--r--src/emap/enum/esitype.h1
-rw-r--r--src/emap/init.c2
-rw-r--r--src/emap/mob.c19
-rw-r--r--src/emap/npc.c18
-rw-r--r--src/emap/npc.h4
-rw-r--r--src/emap/pc.c29
-rw-r--r--src/emap/pc.h5
-rw-r--r--src/emap/skill_const.c1
-rw-r--r--src/emap/status.c1
10 files changed, 79 insertions, 2 deletions
diff --git a/src/emap/enum/esctype.h b/src/emap/enum/esctype.h
index 13a868a..b6d4334 100644
--- a/src/emap/enum/esctype.h
+++ b/src/emap/enum/esctype.h
@@ -8,6 +8,7 @@ typedef enum esc_type
{
SC_PHYSICAL_SHIELD = 654,
SC_HALT_REGENERATION,
+ SC_BOTTER_SYNDROME,
} esc_type;
#endif // EVOL_MAP_ENUM_ESCTYPE
diff --git a/src/emap/enum/esitype.h b/src/emap/enum/esitype.h
index 313f50a..701eec4 100644
--- a/src/emap/enum/esitype.h
+++ b/src/emap/enum/esitype.h
@@ -8,6 +8,7 @@ enum esi_type
{
SI_PHYSICAL_SHIELD = 966,
SI_HALT_REGEN = 967,
+ SI_BOTTER_SYNDROME = 968,
//SI_TMW2_INCSTR = 970,
SI_TMW2_INCAGI = 971,
SI_TMW2_INCVIT = 972,
diff --git a/src/emap/init.c b/src/emap/init.c
index c1c6dd8..aa66d25 100644
--- a/src/emap/init.c
+++ b/src/emap/init.c
@@ -422,6 +422,7 @@ HPExport void plugin_init (void)
addHookPost(map, addflooritem, emap_addflooritem_post);
addHookPost(mob, read_db_mode_sub, emob_read_db_mode_sub_post);
addHookPost(mob, spawn_dataset, emob_spawn_dataset_post);
+ addHookPost(npc, click, enpc_click_post);
addHookPost(skill, check_condition_castend, eskill_check_condition_castend_post);
addHookPost(skill, get_index, eskill_get_index_post);
addHookPost(skill, calc_heal, eskill_calc_heal_post);
@@ -440,6 +441,7 @@ HPExport void plugin_init (void)
addHookPost(pc, can_insert_card_into, epc_can_insert_card_into_post);
addHookPost(pc, insert_card, epc_insert_card_post);
addHookPost(pc, resetstate, epc_resetstate_post);
+ addHookPost(pc, calcexp, epc_calcexp_post);
skill->castend_nodamage_id_unknown = eskill_castend_nodamage_id_unknown;
skill->additional_effect_unknown = eskill_additional_effect_unknown;
diff --git a/src/emap/mob.c b/src/emap/mob.c
index 0da1a1a..0460aa5 100644
--- a/src/emap/mob.c
+++ b/src/emap/mob.c
@@ -12,12 +12,14 @@
#include "common/HPMi.h"
#include "common/memmgr.h"
#include "common/mmo.h"
+#include "common/random.h"
#include "common/socket.h"
#include "common/strlib.h"
#include "common/timer.h"
#include "map/battle.h"
#include "map/itemdb.h"
#include "map/mob.h"
+#include "map/pc.h"
#include "map/script.h"
#include "plugins/HPMHooking.h"
@@ -26,6 +28,7 @@
#include "emap/mob.h"
#include "emap/data/mobd.h"
+#include "emap/enum/esctype.h"
#include "emap/struct/mobdext.h"
int emob_deleteslave_sub_pre(struct block_list **blPtr,
@@ -326,8 +329,8 @@ struct mob_data *emob_spawn_dataset_post(struct mob_data *retVal,
}
int emob_dead_pre(struct mob_data **mdPtr,
- struct block_list **srcPtr __attribute__ ((unused)),
- int *typePtr __attribute__ ((unused)))
+ struct block_list **srcPtr,
+ int *typePtr)
{
struct mob_data *md = *mdPtr;
if (md)
@@ -340,6 +343,18 @@ int emob_dead_pre(struct mob_data **mdPtr,
sprintf(name, "mob_spawn_%d_%d", m, md->bl.id);
map->iwall_remove(name);
}
+ // FIXME: Check if srcPtr is not null, THEN try this code
+ /*
+ if (srcPtr) {
+ // If Botter Syndrome is active, mob may randomly get NODROP
+ // Aka *typePtr |= 1
+ struct map_session_data *sd = BL_CAST(BL_PC, *srcPtr);
+ if (sd->sc.data[SC_BOTTER_SYNDROME]) {
+ if (rnd()%100 < sd->sc.data[SC_BOTTER_SYNDROME]->val1)
+ *typePtr = *typePtr | 1;
+ }
+ }
+ */
}
return 3;
}
diff --git a/src/emap/npc.c b/src/emap/npc.c
index 5b6d66a..e5cd6e6 100644
--- a/src/emap/npc.c
+++ b/src/emap/npc.c
@@ -6,6 +6,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
+#include <time.h>
+#ifndef WIN32
+ #include <sys/time.h>
+#endif
#include "common/HPMi.h"
#include "common/memmgr.h"
@@ -305,3 +309,17 @@ int enpc_unload_pre(struct npc_data** ndPtr,
}
return 0;
}
+
+// TODO: Talking to a NPC should reset Botter Syndrome tracker
+// enpc_click_post
+// pc->setreg(sd, script->add_variable("@skillTarget"), bl->id);
+int enpc_click_post(int retVal,
+ struct map_session_data *sd,
+ struct npc_data *nd __attribute__ ((unused))) {
+ nullpo_retr(1, sd);
+ // If you talked to a NPC, set this variable to gettimetick(2)
+ if (!retVal)
+ pc->setreg(sd, script->add_variable("@npctalk"), (int)time(NULL));
+ return retVal;
+}
+
diff --git a/src/emap/npc.h b/src/emap/npc.h
index ea6c77f..898f886 100644
--- a/src/emap/npc.h
+++ b/src/emap/npc.h
@@ -34,4 +34,8 @@ int enpc_get_var_num(const TBL_NPC *const npc,
int enpc_unload_pre(struct npc_data** ndPtr,
bool *singlePtr);
+int enpc_click_post(int retVal,
+ struct map_session_data *sd,
+ struct npc_data *nd __attribute__ ((unused)));
+
#endif // EVOL_MAP_NPC
diff --git a/src/emap/pc.c b/src/emap/pc.c
index fd78bcb..5903d3a 100644
--- a/src/emap/pc.c
+++ b/src/emap/pc.c
@@ -14,6 +14,7 @@
#include "common/socket.h"
#include "common/strlib.h"
#include "common/timer.h"
+#include "common/utils.h"
#include "map/achievement.h"
#include "map/clif.h"
#include "map/chrif.h"
@@ -34,6 +35,7 @@
#include "emap/data/itemd.h"
#include "emap/data/mapd.h"
#include "emap/data/session.h"
+#include "emap/enum/esctype.h"
#include "emap/struct/itemdext.h"
#include "emap/struct/mapdext.h"
#include "emap/struct/sessionext.h"
@@ -1132,6 +1134,33 @@ int epc_resetstate_post(int retVal,
return retVal;
}
+// Plugin intercept exprate in a post hook, so botter syndrome applies last
+void epc_calcexp_post(struct map_session_data *sd,
+ uint64 *base_exp,
+ uint64 *job_exp,
+ struct block_list *src __attribute__ ((unused)))
+{
+ int buff_bratio = 100, buff_jratio = 100;
+ int64 jexp, bexp;
+ nullpo_retv(sd);
+ nullpo_retv(base_exp);
+ nullpo_retv(job_exp);
+ jexp = *job_exp;
+ bexp = *base_exp;
+
+ // SC_BOTTER_SYNDROME(exp_malus)
+ if (sd->sc.data[SC_BOTTER_SYNDROME]) {
+ buff_jratio -= sd->sc.data[SC_BOTTER_SYNDROME]->val1;
+ buff_bratio -= sd->sc.data[SC_BOTTER_SYNDROME]->val1;
+ }
+
+ // Apply final modifications to the experience rate
+ bexp = bexp * buff_bratio / 100;
+ jexp = jexp * buff_jratio / 100;
+ *job_exp = cap_value(jexp, 1, UINT64_MAX);
+ *base_exp = cap_value(bexp, 1, UINT64_MAX);
+}
+
// disable job based bonuses
void epc_calc_skilltree_bonus_pre(struct map_session_data **sdPtr __attribute__ ((unused)),
int *classidxPtr __attribute__ ((unused)))
diff --git a/src/emap/pc.h b/src/emap/pc.h
index a204917..335bdfb 100644
--- a/src/emap/pc.h
+++ b/src/emap/pc.h
@@ -151,4 +151,9 @@ int epc_equipitem_pre(struct map_session_data **sdPtr,
int epc_resetstate_post(int retVal,
struct map_session_data *sd);
+void epc_calcexp_post(struct map_session_data *sd,
+ uint64 *base_exp,
+ uint64 *job_exp,
+ struct block_list *src __attribute__ ((unused)));
+
#endif // EVOL_MAP_PC
diff --git a/src/emap/skill_const.c b/src/emap/skill_const.c
index 1aadf4d..e4f7aa2 100644
--- a/src/emap/skill_const.c
+++ b/src/emap/skill_const.c
@@ -24,5 +24,6 @@ void eskill_addskill_conststants(void)
// sc
script->set_constant("SC_PHYSICAL_SHIELD", SC_PHYSICAL_SHIELD, false, false);
script->set_constant("SC_HALT_REGENERATION", SC_HALT_REGENERATION, false, false);
+ script->set_constant("SC_BOTTER_SYNDROME", SC_BOTTER_SYNDROME, false, false);
script->constdb_comment(NULL);
}
diff --git a/src/emap/status.c b/src/emap/status.c
index 825d194..85362ab 100644
--- a/src/emap/status.c
+++ b/src/emap/status.c
@@ -62,6 +62,7 @@ void eInitChangeTables(void)
status->dbs->IconChangeTable[SC_INCMSPRATE] = SI_TMW2_INCMSPRATE;
status->dbs->IconChangeTable[SC_HALT_REGENERATION] = SI_HALT_REGEN;
+ status->dbs->IconChangeTable[SC_BOTTER_SYNDROME] = SI_BOTTER_SYNDROME;
// status->dbs->DisplayType[SC_PHYSICAL_SHIELD] = true;
}