summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/HPMmap.c31
-rw-r--r--src/map/battle.c26
-rw-r--r--src/map/battle.h10
-rw-r--r--src/map/map.c5
-rw-r--r--src/map/pc.c18
-rw-r--r--src/map/pc.h4
-rw-r--r--src/map/skill.c15
-rw-r--r--src/map/skill.h4
8 files changed, 59 insertions, 54 deletions
diff --git a/src/map/HPMmap.c b/src/map/HPMmap.c
index 17d72bc98..3ba9ae725 100644
--- a/src/map/HPMmap.c
+++ b/src/map/HPMmap.c
@@ -10,12 +10,29 @@
#include "pc.h"
#include "map.h"
+//
+#include "chat.h"
+#include "chrif.h"
+#include "duel.h"
+#include "elemental.h"
+#include "homunculus.h"
+#include "instance.h"
+#include "intif.h"
+#include "irc-bot.h"
+#include "mail.h"
+#include "mapreg.h"
+#include "mercenary.h"
+#include "party.h"
+#include "pet.h"
+#include "quest.h"
+#include "storage.h"
+#include "trade.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
-
void HPM_map_addToMSD(struct map_session_data *sd, void *data, unsigned int id, unsigned int type, bool autofree) {
struct HPluginData *HPData;
unsigned int i;
@@ -80,10 +97,10 @@ void HPM_map_removeFromMSD(struct map_session_data *sd, unsigned int id, unsigne
}
void HPM_map_plugin_load_sub(struct hplugin *plugin) {
- plugin->hpi->addCommand = HPM->import_symbol("addCommand");
- plugin->hpi->addScript = HPM->import_symbol("addScript");
+ plugin->hpi->addCommand = HPM->import_symbol("addCommand",plugin->idx);
+ plugin->hpi->addScript = HPM->import_symbol("addScript",plugin->idx);
/* */
- plugin->hpi->addToMSD = HPM->import_symbol("addToMSD");
- plugin->hpi->getFromMSD = HPM->import_symbol("getFromMSD");
- plugin->hpi->removeFromMSD = HPM->import_symbol("removeFromMSD");
-}
+ plugin->hpi->addToMSD = HPM->import_symbol("addToMSD",plugin->idx);
+ plugin->hpi->getFromMSD = HPM->import_symbol("getFromMSD",plugin->idx);
+ plugin->hpi->removeFromMSD = HPM->import_symbol("removeFromMSD",plugin->idx);
+} \ No newline at end of file
diff --git a/src/map/battle.c b/src/map/battle.c
index 6e6e7eab5..c79dee7ee 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -410,8 +410,8 @@ int64 battle_attr_fix(struct block_list *src, struct block_list *target, int64 d
}
return damage*ratio/100;
}
-#ifdef RENEWAL
int64 battle_calc_weapon_damage(struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, struct weapon_atk *watk, int nk, bool n_ele, short s_ele, short s_ele_, int size, int type, int flag, int flag2){ // [malufett]
+#ifdef RENEWAL
int64 damage, eatk = 0;
struct status_change *sc;
struct map_session_data *sd;
@@ -470,8 +470,10 @@ int64 battle_calc_weapon_damage(struct block_list *src, struct block_list *bl, u
damage = battle->calc_cardfix(BF_WEAPON, src, bl, nk, s_ele, s_ele_, damage, 0, flag2);
return damage;
-}
+#else
+ return 0;
#endif
+}
/*==========================================
* Calculates the standard damage of a normal attack assuming it hits,
* it calculates nothing extra fancy, is needed for magnum break's WATK_ELEMENT bonus. [Skotlex]
@@ -484,7 +486,7 @@ int64 battle_calc_weapon_damage(struct block_list *src, struct block_list *bl, u
* &8: Skip target size adjustment (Extremity Fist?)
*&16: Arrow attack but BOW, REVOLVER, RIFLE, SHOTGUN, GATLING or GRENADE type weapon not equipped (i.e. shuriken, kunai and venom knives not affected by DEX)
*/
-#ifdef RENEWAL
+/* 'battle_calc_base_damage' is used on renewal, 'battle_calc_base_damage2' otherwise. */
int64 battle_calc_base_damage(struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int nk, bool n_ele, short s_ele, short s_ele_, int type, int flag, int flag2) {
int64 damage, batk;
struct status_data *st = status->get_status_data(src);
@@ -495,8 +497,10 @@ int64 battle_calc_base_damage(struct block_list *src, struct block_list *bl, uin
damage = batk + 3 * battle->calc_weapon_damage(src, bl, skill_id, skill_lv, &st->lhw, nk, n_ele, s_ele, s_ele_, status_get_size(bl), type, flag, flag2) / 4;
else
damage = (batk << 1) + battle->calc_weapon_damage(src, bl, skill_id, skill_lv, &st->rhw, nk, n_ele, s_ele, s_ele_, status_get_size(bl), type, flag, flag2);
-#else
-static int64 battle_calc_base_damage(struct status_data *st, struct weapon_atk *wa, struct status_change *sc, unsigned short t_size, struct map_session_data *sd, int flag) {
+
+ return damage;
+}
+int64 battle_calc_base_damage2(struct status_data *st, struct weapon_atk *wa, struct status_change *sc, unsigned short t_size, struct map_session_data *sd, int flag) {
unsigned int atkmin=0, atkmax=0;
short type = 0;
int64 damage = 0;
@@ -572,7 +576,6 @@ static int64 battle_calc_base_damage(struct status_data *st, struct weapon_atk *
damage += damage * sd->weapon_atk_rate[sd->weapontype1] / 100;
}
}
-#endif
return damage;
}
@@ -856,10 +859,10 @@ int64 battle_calc_elefix(struct block_list *src, struct block_list *target, uint
sc = status->get_sc(src);
if( sc && sc->data[SC_SUB_WEAPONPROPERTY] ) { // Descriptions indicate this means adding a percent of a normal attack in another element. [Skotlex]
- int64 temp = battle->calc_base_damage(sstatus, &sstatus->rhw, sc, tstatus->size, BL_CAST(BL_PC, src), (flag?2:0)) * sc->data[SC_SUB_WEAPONPROPERTY]->val2 / 100;
+ int64 temp = battle->calc_base_damage2(sstatus, &sstatus->rhw, sc, tstatus->size, BL_CAST(BL_PC, src), (flag?2:0)) * sc->data[SC_SUB_WEAPONPROPERTY]->val2 / 100;
damage += battle->attr_fix(src, target, temp, sc->data[SC_SUB_WEAPONPROPERTY]->val1, tstatus->def_ele, tstatus->ele_lv);
if( left ) {
- temp = battle->calc_base_damage(sstatus, &sstatus->lhw, sc, tstatus->size, BL_CAST(BL_PC, src), (flag?2:0)) * sc->data[SC_SUB_WEAPONPROPERTY]->val2 / 100;
+ temp = battle->calc_base_damage2(sstatus, &sstatus->lhw, sc, tstatus->size, BL_CAST(BL_PC, src), (flag?2:0)) * sc->data[SC_SUB_WEAPONPROPERTY]->val2 / 100;
damage += battle->attr_fix(src, target, temp, sc->data[SC_SUB_WEAPONPROPERTY]->val1, tstatus->def_ele, tstatus->ele_lv);
}
}
@@ -4514,9 +4517,9 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
wd.damage2 = battle->calc_masteryfix(src, target, skill_id, skill_lv, wd.damage2, wd.div_, 1, flag.weapon);
}
#else
- wd.damage = battle->calc_base_damage(sstatus, &sstatus->rhw, sc, tstatus->size, sd, i);
+ wd.damage = battle->calc_base_damage2(sstatus, &sstatus->rhw, sc, tstatus->size, sd, i);
if (flag.lh)
- wd.damage2 = battle->calc_base_damage(sstatus, &sstatus->lhw, sc, tstatus->size, sd, i);
+ wd.damage2 = battle->calc_base_damage2(sstatus, &sstatus->lhw, sc, tstatus->size, sd, i);
#endif
if (nk&NK_SPLASHSPLIT){ // Divide ATK among targets
if(wflag>0)
@@ -6784,9 +6787,7 @@ void battle_defaults(void) {
battle->calc_masteryfix = battle_calc_masteryfix;
battle->calc_skillratio = battle_calc_skillratio;
battle->calc_sizefix = battle_calc_sizefix;
-#ifdef RENEWAL
battle->calc_weapon_damage = battle_calc_weapon_damage;
-#endif
battle->calc_defense = battle_calc_defense;
battle->get_master = battle_get_master;
battle->get_targeted = battle_gettargeted;
@@ -6804,6 +6805,7 @@ void battle_defaults(void) {
battle->blewcount_bonus = battle_blewcount_bonus;
battle->range_type = battle_range_type;
battle->calc_base_damage = battle_calc_base_damage;
+ battle->calc_base_damage2 = battle_calc_base_damage2;
battle->calc_misc_attack = battle_calc_misc_attack;
battle->calc_magic_attack = battle_calc_magic_attack;
battle->adjust_skill_damage = battle_adjust_skill_damage;
diff --git a/src/map/battle.h b/src/map/battle.h
index 8878962b8..6d5d5f186 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -523,10 +523,8 @@ struct battle_interface {
int (*calc_skillratio) (int attack_type, struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int skillratio, int flag);
/* applies size modifiers */
int64 (*calc_sizefix) (struct map_session_data *sd, int64 damage, int type, int size, bool ignore);
-#ifdef RENEWAL
/* get weapon damage */
int64 (*calc_weapon_damage) (struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, struct weapon_atk *watk, int nk, bool n_ele, short s_ele, short s_ele_, int size, int type, int flag, int flag2);
-#endif
/* applies defense reductions */
int64 (*calc_defense) (int attack_type, struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int64 damage, int flag, int pdef);
/* get master (who does this unit respond to?) */
@@ -554,12 +552,8 @@ struct battle_interface {
int (*blewcount_bonus) (struct map_session_data *sd, uint16 skill_id);
/* skill range criteria */
int (*range_type) (struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv);
- int64 (*calc_base_damage)
-#ifdef RENEWAL
- (struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int nk, bool n_ele, short s_ele, short s_ele_, int type, int flag, int flag2);
-#else
- (struct status_data *st, struct weapon_atk *wa, struct status_change *sc, unsigned short t_size, struct map_session_data *sd, int flag);
-#endif
+ int64 (*calc_base_damage) (struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int nk, bool n_ele, short s_ele, short s_ele_, int type, int flag, int flag2);
+ int64 (*calc_base_damage2) (struct status_data *st, struct weapon_atk *wa, struct status_change *sc, unsigned short t_size, struct map_session_data *sd, int flag);
struct Damage (*calc_misc_attack) (struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv,int mflag);
struct Damage (*calc_magic_attack) (struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv,int mflag);
int (*adjust_skill_damage) (int m, unsigned short skill_id);
diff --git a/src/map/map.c b/src/map/map.c
index 0457de5bb..0c684542d 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -5016,8 +5016,10 @@ void do_final(void)
struct s_mapiterator* iter;
ShowStatus("Terminating...\n");
+
hChSys.closing = true;
HPM->event(HPET_FINAL);
+
if (map->cpsd) aFree(map->cpsd);
//Ladies and babies first.
@@ -5090,6 +5092,8 @@ void do_final(void)
if( !map->enable_grf )
aFree(map->cache_buffer);
+ HPM->event(HPET_POST_FINAL);
+
ShowStatus("Finished.\n");
}
@@ -5263,6 +5267,7 @@ void map_hp_symbols(void) {
HPM->share(itemdb,"itemdb");
HPM->share(logs,"logs");
HPM->share(mail,"mail");
+ HPM->share(instance,"instance");
HPM->share(script,"script");
HPM->share(searchstore,"searchstore");
HPM->share(skill,"skill");
diff --git a/src/map/pc.c b/src/map/pc.c
index 58972a204..6b7d6c735 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -9460,13 +9460,12 @@ int pc_del_charm(struct map_session_data *sd,int count,int type)
clif->charm(sd, type);
return 0;
}
-#if defined(RENEWAL_DROP) || defined(RENEWAL_EXP)
/*==========================================
* Renewal EXP/Itemdrop rate modifier base on level penalty
* 1=exp 2=itemdrop
*------------------------------------------*/
-int pc_level_penalty_mod(int diff, unsigned char race, unsigned short mode, int type)
-{
+int pc_level_penalty_mod(int diff, unsigned char race, unsigned short mode, int type) {
+#if defined(RENEWAL_DROP) || defined(RENEWAL_EXP)
int rate = 100, i;
if( diff < 0 )
@@ -9489,8 +9488,10 @@ int pc_level_penalty_mod(int diff, unsigned char race, unsigned short mode, int
}
return rate;
-}
+#else
+ return 100;
#endif
+}
int pc_split_str(char *str,char **val,int num)
{
int i;
@@ -9810,8 +9811,8 @@ void pc_read_skill_tree(void) {
clif->skillinfoblock(sd);
mapit->free(iter);
}
-#if defined(RENEWAL_DROP) || defined(RENEWAL_EXP)
bool pc_readdb_levelpenalty(char* fields[], int columns, int current) {
+#if defined(RENEWAL_DROP) || defined(RENEWAL_EXP)
int type, race, diff;
type = atoi(fields[0]);
@@ -9834,10 +9835,9 @@ bool pc_readdb_levelpenalty(char* fields[], int columns, int current) {
diff = min(MAX_LEVEL + ( ~(diff) + 1 ), MAX_LEVEL*2);
pc->level_penalty[type][race][diff] = atoi(fields[3]);
-
+#endif
return true;
}
-#endif
/*==========================================
* pc DB reading.
@@ -10371,9 +10371,7 @@ void pc_defaults(void) {
pc->del_charm = pc_del_charm;
pc->baselevelchanged = pc_baselevelchanged;
-#if defined(RENEWAL_DROP) || defined(RENEWAL_EXP)
pc->level_penalty_mod = pc_level_penalty_mod;
-#endif
pc->calc_skillpoint = pc_calc_skillpoint;
@@ -10395,9 +10393,7 @@ void pc_defaults(void) {
pc->eventtimer = pc_eventtimer;
pc->daynight_timer_sub = pc_daynight_timer_sub;
pc->charm_timer = pc_charm_timer;
-#if defined(RENEWAL_DROP) || defined(RENEWAL_EXP)
pc->readdb_levelpenalty = pc_readdb_levelpenalty;
-#endif
pc->autosave = pc_autosave;
pc->follow_timer = pc_follow_timer;
pc->read_skill_tree = pc_read_skill_tree;
diff --git a/src/map/pc.h b/src/map/pc.h
index bf2f9d7c5..fadb922b5 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -931,9 +931,7 @@ struct pc_interface {
int (*del_charm) (struct map_session_data *sd,int count,int type);
void (*baselevelchanged) (struct map_session_data *sd);
-#if defined(RENEWAL_DROP) || defined(RENEWAL_EXP)
int (*level_penalty_mod) (int diff, unsigned char race, unsigned short mode, int type);
-#endif
int (*calc_skillpoint) (struct map_session_data* sd);
int (*invincible_timer) (int tid, unsigned int tick, int id, intptr_t data);
@@ -954,9 +952,7 @@ struct pc_interface {
int (*eventtimer) (int tid, unsigned int tick, int id, intptr_t data);
int (*daynight_timer_sub) (struct map_session_data *sd,va_list ap);
int (*charm_timer) (int tid, unsigned int tick, int id, intptr_t data);
-#if defined(RENEWAL_DROP) || defined(RENEWAL_EXP)
bool (*readdb_levelpenalty) (char* fields[], int columns, int current);
-#endif
int (*autosave) (int tid, unsigned int tick, int id, intptr_t data);
int (*follow_timer) (int tid, unsigned int tick, int id, intptr_t data);
void (*read_skill_tree) (void);
diff --git a/src/map/skill.c b/src/map/skill.c
index dd87f27d9..f359e81d4 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -185,9 +185,13 @@ int skill_get_unit_bl_target( uint16 skill_id ) { skill_get (skill->db[skill_
int skill_get_unit_flag( uint16 skill_id ) { skill_get (skill->db[skill_id].unit_flag, skill_id); }
int skill_get_unit_layout_type( uint16 skill_id ,uint16 skill_lv ){ skill_get2 (skill->db[skill_id].unit_layout_type[skill_glv(skill_lv-1)], skill_id, skill_lv); }
int skill_get_cooldown( uint16 skill_id, uint16 skill_lv ) { skill_get2 (skill->db[skill_id].cooldown[skill_glv(skill_lv-1)], skill_id, skill_lv); }
+int skill_get_fixed_cast( uint16 skill_id ,uint16 skill_lv ) {
#ifdef RENEWAL_CAST
-int skill_get_fixed_cast( uint16 skill_id ,uint16 skill_lv ){ skill_get2 (skill->db[skill_id].fixed_cast[skill_glv(skill_lv-1)], skill_id, skill_lv); }
+ skill_get2 (skill->db[skill_id].fixed_cast[skill_glv(skill_lv-1)], skill_id, skill_lv);
+#else
+ return 0;
#endif
+}
int skill_tree_get_max(uint16 skill_id, int b_class)
{
int i;
@@ -13792,8 +13796,8 @@ int skill_castfix_sc (struct block_list *bl, int time) {
//ShowInfo("Castime castfix_sc = %d\n",time);
return time;
}
-#ifdef RENEWAL_CAST
int skill_vfcastfix(struct block_list *bl, double time, uint16 skill_id, uint16 skill_lv) {
+#ifdef RENEWAL_CAST
struct status_change *sc = status->get_sc(bl);
struct map_session_data *sd = BL_CAST(BL_PC,bl);
int fixed = skill->get_fixed_cast(skill_id, skill_lv), fixcast_r = 0, varcast_r = 0, i = 0;
@@ -13907,10 +13911,9 @@ int skill_vfcastfix(struct block_list *bl, double time, uint16 skill_id, uint16
time = (1 - sqrt( ((float)(status_get_dex(bl)*2 + status_get_int(bl)) / battle_config.vcast_stat_scale) )) * time;
// underflow checking/capping
time = max(time, 0) + (1 - (float)min(fixcast_r, 100) / 100) * max(fixed,0);
-
+#endif
return (int)time;
}
-#endif
/*==========================================
* Does delay reductions based on dex/agi, sc data, item bonuses, ...
@@ -18156,9 +18159,7 @@ void skill_defaults(void) {
skill->unit_ondamaged = skill_unit_ondamaged;
skill->cast_fix = skill_castfix;
skill->cast_fix_sc = skill_castfix_sc;
-#ifdef RENEWAL_CAST
skill->vf_cast_fix = skill_vfcastfix;
-#endif
skill->delay_fix = skill_delay_fix;
skill->check_condition_castbegin = skill_check_condition_castbegin;
skill->check_condition_castend = skill_check_condition_castend;
@@ -18222,9 +18223,7 @@ void skill_defaults(void) {
skill->check_condition_mob_master_sub = skill_check_condition_mob_master_sub;
skill->brandishspear_first = skill_brandishspear_first;
skill->brandishspear_dir = skill_brandishspear_dir;
-#ifdef RENEWAL_CAST
skill->get_fixed_cast = skill_get_fixed_cast;
-#endif
skill->sit_count = skill_sit_count;
skill->sit_in = skill_sit_in;
skill->sit_out = skill_sit_out;
diff --git a/src/map/skill.h b/src/map/skill.h
index d2546c706..592721f1e 100644
--- a/src/map/skill.h
+++ b/src/map/skill.h
@@ -1893,9 +1893,7 @@ struct skill_interface {
int (*unit_ondamaged) (struct skill_unit *src,struct block_list *bl,int64 damage,unsigned int tick);
int (*cast_fix) ( struct block_list *bl, uint16 skill_id, uint16 skill_lv);
int (*cast_fix_sc) ( struct block_list *bl, int time);
-#ifdef RENEWAL_CAST
int (*vf_cast_fix) ( struct block_list *bl, double time, uint16 skill_id, uint16 skill_lv);
-#endif
int (*delay_fix) ( struct block_list *bl, uint16 skill_id, uint16 skill_lv);
int (*check_condition_castbegin) (struct map_session_data *sd, uint16 skill_id, uint16 skill_lv);
int (*check_condition_castend) (struct map_session_data *sd, uint16 skill_id, uint16 skill_lv);
@@ -1959,9 +1957,7 @@ struct skill_interface {
int (*check_condition_mob_master_sub) (struct block_list *bl, va_list ap);
void (*brandishspear_first) (struct square *tc, uint8 dir, int16 x, int16 y);
void (*brandishspear_dir) (struct square* tc, uint8 dir, int are);
-#ifdef RENEWAL_CAST
int (*get_fixed_cast) ( uint16 skill_id ,uint16 skill_lv );
-#endif
int (*sit_count) (struct block_list *bl, va_list ap);
int (*sit_in) (struct block_list *bl, va_list ap);
int (*sit_out) (struct block_list *bl, va_list ap);