diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/login/login.c | 2 | ||||
-rw-r--r-- | src/map/elemental.c | 62 | ||||
-rw-r--r-- | src/map/map.c | 58 | ||||
-rw-r--r-- | src/map/map.h | 5 | ||||
-rw-r--r-- | src/map/skill.c | 6 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc | 12 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking.HookingPoints.inc | 3 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking.Hooks.inc | 50 |
8 files changed, 91 insertions, 107 deletions
diff --git a/src/login/login.c b/src/login/login.c index 18c9d90cf..0488ae4ed 100644 --- a/src/login/login.c +++ b/src/login/login.c @@ -1041,7 +1041,7 @@ int mmo_auth(struct login_session_data* sd, bool isServer) { int i; if( !sd->has_client_hash ) { - ShowNotice("Client didn't send client hash (account: %s, pass: %s, ip: %s)\n", sd->userid, sd->passwd, acc.state, ip); + ShowNotice("Client didn't send client hash (account: %s, pass: %s, ip: %s)\n", sd->userid, sd->passwd, ip); return 5; } diff --git a/src/map/elemental.c b/src/map/elemental.c index 7ffeea410..caba02692 100644 --- a/src/map/elemental.c +++ b/src/map/elemental.c @@ -64,7 +64,7 @@ struct view_data * elemental_get_viewdata(int class_) { int elemental_create(struct map_session_data *sd, int class_, unsigned int lifetime) { struct s_elemental ele; struct s_elemental_db *db; - int i; + int i, summon_level, skill_level; nullpo_retr(1,sd); @@ -77,63 +77,67 @@ int elemental_create(struct map_session_data *sd, int class_, unsigned int lifet ele.char_id = sd->status.char_id; ele.class_ = class_; ele.mode = EL_MODE_PASSIVE; // Initial mode - i = db->status.size+1; // summon level + summon_level = db->status.size+1; // summon level //[(Caster's Max HP/ 3 ) + (Caster's INT x 10 )+ (Caster's Job Level x 20 )] x [(Elemental Summon Level + 2) / 3] - ele.hp = ele.max_hp = (sd->battle_status.max_hp/3 + sd->battle_status.int_*10 + sd->status.job_level) * ((i + 2) / 3); + ele.hp = ele.max_hp = (sd->battle_status.max_hp/3 + sd->battle_status.int_*10 + sd->status.job_level) * ((summon_level + 2) / 3); //Caster's Max SP /4 ele.sp = ele.max_sp = sd->battle_status.max_sp/4; //Caster's [ Max SP / (18 / Elemental Summon Skill Level) 1- 100 ] - ele.atk = (sd->battle_status.max_sp / (18 / i) * 1 - 100); + ele.atk = (sd->battle_status.max_sp / (18 / summon_level) * 1 - 100); //Caster's [ Max SP / (18 / Elemental Summon Skill Level) ] ele.atk2 = sd->battle_status.max_sp / 18; //Caster's HIT + (Caster's Base Level) ele.hit = sd->battle_status.hit + sd->status.base_level; //[Elemental Summon Skill Level x (Caster's INT / 2 + Caster's DEX / 4)] - ele.matk = i * (sd->battle_status.int_ / 2 + sd->battle_status.dex / 4); + ele.matk = summon_level * (sd->battle_status.int_ / 2 + sd->battle_status.dex / 4); //150 + [Caster's DEX / 10] + [Elemental Summon Skill Level x 3 ] - ele.amotion = 150 + sd->battle_status.dex / 10 + i * 3; + ele.amotion = 150 + sd->battle_status.dex / 10 + summon_level * 3; //Caster's DEF + (Caster's Base Level / (5 - Elemental Summon Skill Level) - ele.def = sd->battle_status.def + sd->status.base_level / (5-i); + ele.def = sd->battle_status.def + sd->status.base_level / (5-summon_level); //Caster's MDEF + (Caster's INT / (5 - Elemental Summon Skill Level) - ele.mdef = sd->battle_status.mdef + sd->battle_status.int_ / (5-i); + ele.mdef = sd->battle_status.mdef + sd->battle_status.int_ / (5-summon_level); //Caster's FLEE + (Caster's Base Level / (5 - Elemental Summon Skill Level) - ele.flee = sd->status.base_level / (5-i); + ele.flee = sd->status.base_level / (5-summon_level); //Caster's HIT + (Caster's Base Level) ele.hit = sd->battle_status.hit + sd->status.base_level; //per individual bonuses switch(db->class_){ - case 2114: case 2115: + case 2114: + case 2115: case 2116: //ATK + (Summon Agni Skill Level x 20) / HIT + (Summon Agni Skill Level x 10) - ele.atk += i * 20; - ele.atk2 += i * 20; - ele.hit += i * 10; + ele.atk += summon_level * 20; + ele.atk2 += summon_level * 20; + ele.hit += summon_level * 10; break; - case 2117: case 2118: + case 2117: + case 2118: case 2119: //MDEF + (Summon Aqua Skill Level x 10) / MATK + (Summon Aqua Skill Level x 20) - ele.mdef += i * 10; - ele.matk += i * 20; + ele.mdef += summon_level * 10; + ele.matk += summon_level * 20; break; - case 2120: case 2121: + case 2120: + case 2121: case 2122: //FLEE + (Summon Ventus Skill Level x 20) / MATK + (Summon Ventus Skill Level x 10) - ele.flee += i * 20; - ele.matk += i * 10; + ele.flee += summon_level * 20; + ele.matk += summon_level * 10; break; - case 2123: case 2124: + case 2123: + case 2124: case 2125: //DEF + (Summon Tera Skill Level x 25) / ATK + (Summon Tera Skill Level x 5) - ele.def += i * 25; - ele.atk += i * 5; - ele.atk2 += i * 5; + ele.def += summon_level * 25; + ele.atk += summon_level * 5; + ele.atk2 += summon_level * 5; break; } - if( (i=pc->checkskill(sd,SO_EL_SYMPATHY)) > 0 ){ - ele.hp = ele.max_hp = ele.max_hp * 5 * i / 100; - ele.sp = ele.max_sp = ele.max_sp * 5 * i / 100; - ele.atk += 25 * i; - ele.atk2 += 25 * i; - ele.matk += 25 * i; + if ((skill_level=pc->checkskill(sd,SO_EL_SYMPATHY)) > 0) { + ele.hp = ele.max_hp += ele.max_hp * 5 * skill_level / 100; + ele.sp = ele.max_sp += ele.max_sp * 5 * skill_level / 100; + ele.atk += 25 * skill_level; + ele.atk2 += 25 * skill_level; + ele.matk += 25 * skill_level; } ele.life_time = lifetime; diff --git a/src/map/map.c b/src/map/map.c index a89478cb1..b254b6792 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -167,31 +167,32 @@ int map_freeblock_timer(int tid, int64 tick, int id, intptr_t data) { return 0; } -/*========================================== - * These pair of functions update the counter of how many objects - * lie on a tile. - *------------------------------------------*/ -void map_addblcell(struct block_list *bl) { +/** + * Updates the counter (cell.cell_bl) of how many objects are on a tile. + * @param add Whether the counter should be increased or decreased + **/ +void map_update_cell_bl( struct block_list *bl, bool increase ) { #ifdef CELL_NOSTACK + int pos; + if( bl->m < 0 || bl->x < 0 || bl->x >= map->list[bl->m].xs || bl->y < 0 || bl->y >= map->list[bl->m].ys || !(bl->type&BL_CHAR) ) return; - map->list[bl->m].cell[bl->x+bl->y*map->list[bl->m].xs].cell_bl++; -#else - return; -#endif -} -void map_delblcell(struct block_list *bl) { -#ifdef CELL_NOSTACK - if( bl->m < 0 || bl->x < 0 || bl->x >= map->list[bl->m].xs - || bl->y < 0 || bl->y >= map->list[bl->m].ys - || !(bl->type&BL_CHAR) ) - map->list[bl->m].cell[bl->x+bl->y*map->list[bl->m].xs].cell_bl--; -#else - return; + // When reading from mapcache the cell isn't initialized + // TODO: Maybe start initializing cells when they're loaded instead of + // having to get them here? [Panikon] + if( map->list[bl->m].cell == (struct mapcell *)0xdeadbeaf ) + map->cellfromcache(&map->list[bl->m]); + + pos = bl->x + bl->y*map->list[bl->m].xs; + if( increase ) + map->list[bl->m].cell[pos].cell_bl++; + else + map->list[bl->m].cell[pos].cell_bl--; #endif + return; } /*========================================== @@ -237,7 +238,7 @@ int map_addblock(struct block_list* bl) } #ifdef CELL_NOSTACK - map->addblcell(bl); + map->update_cell_bl(bl, true); #endif return 0; @@ -261,7 +262,7 @@ int map_delblock(struct block_list* bl) } #ifdef CELL_NOSTACK - map->delblcell(bl); + map->update_cell_bl(bl, false); #endif pos = bl->x/BLOCK_SIZE+(bl->y/BLOCK_SIZE)*map->list[bl->m].bxs; @@ -319,13 +320,13 @@ int map_moveblock(struct block_list *bl, int x1, int y1, int64 tick) { if (moveblock) map->delblock(bl); #ifdef CELL_NOSTACK - else map->delblcell(bl); + else map->update_cell_bl(bl, false); #endif bl->x = x1; bl->y = y1; if (moveblock) map->addblock(bl); #ifdef CELL_NOSTACK - else map->addblcell(bl); + else map->update_cell_bl(bl, true); #endif if (bl->type&BL_CHAR) { @@ -2521,8 +2522,13 @@ void map_cellfromcache(struct map_data *m) { decode_zip(decode_buffer, &size, m->cellPos+sizeof(struct map_cache_map_info), info->len); CREATE(m->cell, struct mapcell, size); - for( xy = 0; xy < size; ++xy ) + // Set cell properties + for( xy = 0; xy < size; ++xy ) { m->cell[xy] = map->gat2cell(decode_buffer[xy]); +#ifdef CELL_NOSTACK + m->cell[xy].cell_bl = 0; +#endif + } m->getcellp = map->getcellp; m->setcell = map->setcell; @@ -3293,6 +3299,9 @@ int map_readgat (struct map_data* m) type = 3; // Cell is 0 (walkable) but under water level, set to 3 (walkable water) m->cell[xy] = map->gat2cell(type); +#ifdef CELL_NOSTACK + m->cell[xy].cell_bl = 0; +#endif } aFree(gat); @@ -6126,8 +6135,7 @@ void map_defaults(void) { map->versionscreen = map_versionscreen; map->arg_next_value = map_arg_next_value; - map->addblcell = map_addblcell; - map->delblcell = map_delblcell; + map->update_cell_bl = map_update_cell_bl; map->get_new_bonus_id = map_get_new_bonus_id; diff --git a/src/map/map.h b/src/map/map.h index 35fe0d7e1..4f7f09131 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -486,7 +486,7 @@ struct mapcell { icewall : 1; #ifdef CELL_NOSTACK - unsigned char cell_bl; //Holds amount of bls in this cell. + int cell_bl; //Holds amount of bls in this cell. #endif }; @@ -1059,8 +1059,7 @@ struct map_interface { void (*helpscreen) (bool do_exit); void (*versionscreen) (bool do_exit); bool (*arg_next_value) (const char *option, int i, int argc, bool must); - void (*addblcell) (struct block_list *bl); - void (*delblcell) (struct block_list *bl); + void (*update_cell_bl) (struct block_list *bl, bool increase); int (*get_new_bonus_id) (void); void (*add_questinfo) (int m, struct questinfo *qi); bool (*remove_questinfo) (int m, struct npc_data *nd); diff --git a/src/map/skill.c b/src/map/skill.c index c744dbde4..e16cb0cc7 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -14043,7 +14043,11 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16 case SO_SUMMON_AQUA: case SO_SUMMON_VENTUS: case SO_SUMMON_TERA: - req.sp -= req.sp * (5 + 5 * pc->checkskill(sd,SO_EL_SYMPATHY)) / 100; + { + int spirit_sympathy = pc->checkskill(sd,SO_EL_SYMPATHY); + if (spirit_sympathy) + req.sp -= req.sp * (5 + 5 * spirit_sympathy) / 100; + } break; case SO_PSYCHIC_WAVE: if( sc && (sc->data[SC_HEATER_OPTION] || sc->data[SC_COOLER_OPTION] || sc->data[SC_BLAST_OPTION] || sc->data[SC_CURSED_SOIL_OPTION] )) diff --git a/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc index 1a1ffcc3c..d73525b70 100644 --- a/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc @@ -2879,10 +2879,8 @@ struct { struct HPMHookPoint *HP_map_versionscreen_post; struct HPMHookPoint *HP_map_arg_next_value_pre; struct HPMHookPoint *HP_map_arg_next_value_post; - struct HPMHookPoint *HP_map_addblcell_pre; - struct HPMHookPoint *HP_map_addblcell_post; - struct HPMHookPoint *HP_map_delblcell_pre; - struct HPMHookPoint *HP_map_delblcell_post; + struct HPMHookPoint *HP_map_update_cell_bl_pre; + struct HPMHookPoint *HP_map_update_cell_bl_post; struct HPMHookPoint *HP_map_get_new_bonus_id_pre; struct HPMHookPoint *HP_map_get_new_bonus_id_post; struct HPMHookPoint *HP_map_add_questinfo_pre; @@ -7918,10 +7916,8 @@ struct { int HP_map_versionscreen_post; int HP_map_arg_next_value_pre; int HP_map_arg_next_value_post; - int HP_map_addblcell_pre; - int HP_map_addblcell_post; - int HP_map_delblcell_pre; - int HP_map_delblcell_post; + int HP_map_update_cell_bl_pre; + int HP_map_update_cell_bl_post; int HP_map_get_new_bonus_id_pre; int HP_map_get_new_bonus_id_post; int HP_map_add_questinfo_pre; diff --git a/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc index 552d49b4f..05d484d20 100644 --- a/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc @@ -1461,8 +1461,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(map->helpscreen, HP_map_helpscreen) }, { HP_POP(map->versionscreen, HP_map_versionscreen) }, { HP_POP(map->arg_next_value, HP_map_arg_next_value) }, - { HP_POP(map->addblcell, HP_map_addblcell) }, - { HP_POP(map->delblcell, HP_map_delblcell) }, + { HP_POP(map->update_cell_bl, HP_map_update_cell_bl) }, { HP_POP(map->get_new_bonus_id, HP_map_get_new_bonus_id) }, { HP_POP(map->add_questinfo, HP_map_add_questinfo) }, { HP_POP(map->remove_questinfo, HP_map_remove_questinfo) }, diff --git a/src/plugins/HPMHooking/HPMHooking.Hooks.inc b/src/plugins/HPMHooking/HPMHooking.Hooks.inc index 8fc718f20..8f209fe5c 100644 --- a/src/plugins/HPMHooking/HPMHooking.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking.Hooks.inc @@ -38310,40 +38310,14 @@ bool HP_map_arg_next_value(const char *option, int i, int argc, bool must) { } return retVal___; } -void HP_map_addblcell(struct block_list *bl) { +void HP_map_update_cell_bl(struct block_list *bl, bool increase) { int hIndex = 0; - if( HPMHooks.count.HP_map_addblcell_pre ) { - void (*preHookFunc) (struct block_list *bl); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_map_addblcell_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_map_addblcell_pre[hIndex].func; - preHookFunc(bl); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.map.addblcell(bl); - } - if( HPMHooks.count.HP_map_addblcell_post ) { - void (*postHookFunc) (struct block_list *bl); - for(hIndex = 0; hIndex < HPMHooks.count.HP_map_addblcell_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_map_addblcell_post[hIndex].func; - postHookFunc(bl); - } - } - return; -} -void HP_map_delblcell(struct block_list *bl) { - int hIndex = 0; - if( HPMHooks.count.HP_map_delblcell_pre ) { - void (*preHookFunc) (struct block_list *bl); + if( HPMHooks.count.HP_map_update_cell_bl_pre ) { + void (*preHookFunc) (struct block_list *bl, bool *increase); *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_map_delblcell_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_map_delblcell_pre[hIndex].func; - preHookFunc(bl); + for(hIndex = 0; hIndex < HPMHooks.count.HP_map_update_cell_bl_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_map_update_cell_bl_pre[hIndex].func; + preHookFunc(bl, &increase); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -38351,13 +38325,13 @@ void HP_map_delblcell(struct block_list *bl) { } } { - HPMHooks.source.map.delblcell(bl); + HPMHooks.source.map.update_cell_bl(bl, increase); } - if( HPMHooks.count.HP_map_delblcell_post ) { - void (*postHookFunc) (struct block_list *bl); - for(hIndex = 0; hIndex < HPMHooks.count.HP_map_delblcell_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_map_delblcell_post[hIndex].func; - postHookFunc(bl); + if( HPMHooks.count.HP_map_update_cell_bl_post ) { + void (*postHookFunc) (struct block_list *bl, bool *increase); + for(hIndex = 0; hIndex < HPMHooks.count.HP_map_update_cell_bl_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_map_update_cell_bl_post[hIndex].func; + postHookFunc(bl, &increase); } } return; |