diff options
author | shennetsind <ind@henn.et> | 2013-04-27 16:04:07 -0300 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2013-04-27 16:04:07 -0300 |
commit | f2942453592621f5d3e4553fa96cd1b417fa74fb (patch) | |
tree | fb111919b69270be57b4a19a4f925dfb23fec86f /src | |
parent | ad51ea46af4590c7ca51fd55cf63f75de9dc67dc (diff) | |
download | hercules-f2942453592621f5d3e4553fa96cd1b417fa74fb.tar.gz hercules-f2942453592621f5d3e4553fa96cd1b417fa74fb.tar.bz2 hercules-f2942453592621f5d3e4553fa96cd1b417fa74fb.tar.xz hercules-f2942453592621f5d3e4553fa96cd1b417fa74fb.zip |
Fixed Bug #7193 and ...
http://hercules.ws/board/tracker/issue-7193-monsterhp/
--
Follow up 0f4a50d13538c3e5d3ca4d3822f92217c8da0479 re-introduced mob_max_skilllvl
--
Updated some packet intro dates (special thanks to yommy! <33)
Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src')
-rw-r--r-- | src/map/battle.c | 1 | ||||
-rw-r--r-- | src/map/battle.h | 2 | ||||
-rw-r--r-- | src/map/clif.c | 34 | ||||
-rw-r--r-- | src/map/clif.h | 2 | ||||
-rw-r--r-- | src/map/mob.c | 13 | ||||
-rw-r--r-- | src/map/packets.h | 8 | ||||
-rw-r--r-- | src/map/packets_struct.h | 16 |
7 files changed, 44 insertions, 32 deletions
diff --git a/src/map/battle.c b/src/map/battle.c index 7bfb54fdd..ed0b87e6f 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -5858,6 +5858,7 @@ static const struct _battle_data { { "duel_time_interval", &battle_config.duel_time_interval, 60, 0, INT_MAX, }, { "duel_only_on_same_map", &battle_config.duel_only_on_same_map, 0, 0, 1, }, { "skip_teleport_lv1_menu", &battle_config.skip_teleport_lv1_menu, 0, 0, 1, }, + { "mob_max_skilllvl", &battle_config.mob_max_skilllvl, 100, 1, INT_MAX, }, { "allow_skill_without_day", &battle_config.allow_skill_without_day, 0, 0, 1, }, { "allow_es_magic_player", &battle_config.allow_es_magic_pc, 0, 0, 1, }, { "skill_caster_check", &battle_config.skill_caster_check, 1, 0, 1, }, diff --git a/src/map/battle.h b/src/map/battle.h index fd6a6d7bd..62e301f4c 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -372,7 +372,7 @@ struct Battle_Config { int duel_only_on_same_map; // [Toms] int skip_teleport_lv1_menu; // possibility to disable (skip) Teleport Lv1 menu, that have only two lines `Random` and `Cancel` [LuzZza] - + int mob_max_skilllvl; int allow_skill_without_day; // [Komurka] int allow_es_magic_pc; // [Skotlex] int skill_wall_check; // [Skotlex] diff --git a/src/map/clif.c b/src/map/clif.c index 55bc895f0..10c1a0d47 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -265,7 +265,7 @@ int clif_send_sub(struct block_list *bl, va_list ap) { nullpo_ret(sd = (struct map_session_data *)bl); fd = sd->fd; - if (!fd) //Don't send to disconnected clients. + if (!fd || session[fd] == NULL) //Don't send to disconnected clients. return 0; buf = va_arg(ap,void*); @@ -297,9 +297,6 @@ int clif_send_sub(struct block_list *bl, va_list ap) { break; } - if (session[fd] == NULL) - return 0; - WFIFOHEAD(fd, len); if (WFIFOP(fd,0) == buf) { ShowError("WARNING: Invalid use of clif->send function\n"); @@ -887,7 +884,7 @@ void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enu #if PACKETVER >= 20080102 p.font = (sd) ? sd->user_font : 0; #endif -#if PACKETVER >= 20120712 +#if PACKETVER >= 20140000 //actual 20120221 if( bl->type == BL_MOB ) { p.maxHP = status_get_max_hp(bl); p.HP = status_get_hp(bl); @@ -1128,7 +1125,7 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) { #if PACKETVER >= 20080102 p.font = (sd) ? sd->user_font : 0; #endif -#if PACKETVER >= 20120712 +#if PACKETVER >= 20140000 //actual 20120221 if( bl->type == BL_MOB ) { p.maxHP = status_get_max_hp(bl); p.HP = status_get_hp(bl); @@ -1203,7 +1200,7 @@ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, #if PACKETVER >= 20080102 p.font = (sd) ? sd->user_font : 0; #endif -#if PACKETVER >= 20120712 +#if PACKETVER >= 20140000 //actual 20120221 if( bl->type == BL_MOB ) { p.maxHP = status_get_max_hp(bl); p.HP = status_get_hp(bl); @@ -4394,12 +4391,17 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) { clif->specialeffect_single(bl,423,sd->fd); else if(md->special_state.size==SZ_MEDIUM) clif->specialeffect_single(bl,421,sd->fd); - /* only between 04-04 and 07-12 (afterwards its bundled on the other packet) */ - #if PACKETVER >= 20120404 - #if PACKETVER <= 20120712 - clif->monster_hp_bar(md); - #endif - #endif +#if PACKETVER >= 20120404 + if( !(md->status.mode&MD_BOSS) ){ + int i; + for(i = 0; i < DAMAGELOG_SIZE; i++) {// must show hp bar to all char who already hit the mob. + if( md->dmglog[i].id == sd->status.char_id ) { + clif->monster_hp_bar(md, sd); + break; + } + } + } +#endif } break; case BL_PET: @@ -16660,7 +16662,7 @@ void clif_snap( struct block_list *bl, short x, short y ) { clif->send(buf,packet_len(0x8d2),bl,AREA); } -void clif_monster_hp_bar( struct mob_data* md ) { +void clif_monster_hp_bar( struct mob_data* md, struct map_session_data *sd ) { struct packet_monster_hp p; p.PacketType = monsterhpType; @@ -16668,7 +16670,7 @@ void clif_monster_hp_bar( struct mob_data* md ) { p.HP = md->status.hp; p.MaxHP = md->status.max_hp; - clif->send(&p,sizeof(p),&md->bl,AREA_WOS); + clif->send(&p,sizeof(p),&sd->bl,SELF); } /* [Ind/Hercules] placeholder for unsupported incoming packets (avoids server disconnecting client) */ void __attribute__ ((unused)) clif_parse_dull(int fd,struct map_session_data *sd) { @@ -16789,7 +16791,7 @@ void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) { /* [Ind/Hercules] */ void clif_maptypeproperty2(struct block_list *bl,enum send_target t) { -#if PACKETVER >= 20130000 /* not entirely sure when this started */ +#if PACKETVER >= 20121010 struct packet_maptypeproperty2 p; p.PacketType = maptypeproperty2Type; diff --git a/src/map/clif.h b/src/map/clif.h index 8c6a0628b..ae3fb9cd4 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -566,7 +566,7 @@ struct clif_interface { void (*mvp_noitem) (struct map_session_data* sd); void (*changed_dir) (struct block_list *bl, enum send_target target); void (*charnameack) (int fd, struct block_list *bl); - void (*monster_hp_bar) ( struct mob_data* md ); + void (*monster_hp_bar) ( struct mob_data* md, struct map_session_data *sd ); int (*hpmeter) (struct map_session_data *sd); void (*hpmeter_single) (int fd, int id, unsigned int hp, unsigned int maxhp); int (*hpmeter_sub) (struct block_list *bl, va_list ap); diff --git a/src/map/mob.c b/src/map/mob.c index 885897e62..e5520b622 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -2067,7 +2067,16 @@ void mob_damage(struct mob_data *md, struct block_list *src, int damage) { return; #if PACKETVER >= 20120404 - clif->monster_hp_bar(md); + if( !(md->status.mode&MD_BOSS) ){ + int i; + for(i = 0; i < DAMAGELOG_SIZE; i++){ // must show hp bar to all char who already hit the mob. + if( md->dmglog[i].id ) { + struct map_session_data *sd = map_charid2sd(md->dmglog[i].id); + if( sd && check_distance_bl(&md->bl, &sd->bl, AREA_SIZE) ) // check if in range + clif->monster_hp_bar(md,sd); + } + } + } #endif if( md->special_state.ai == 2 ) {//LOne WOlf explained that ANYONE can trigger the marine countdown skill. [Skotlex] @@ -4315,7 +4324,7 @@ static bool mob_parse_row_mobskilldb(char** str, int columns, int current) //Skill lvl j= atoi(str[4])<=0 ? 1 : atoi(str[4]); - ms->skill_lv= j; + ms->skill_lv= j>battle_config.mob_max_skilllvl ? battle_config.mob_max_skilllvl : j; //we strip max skill level //Apply battle_config modifiers to rate (permillage) and delay [Skotlex] tmp = atoi(str[5]); diff --git a/src/map/packets.h b/src/map/packets.h index 3c204c978..0b8cbf5a3 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -2055,10 +2055,10 @@ packet(0x020d,-1); packet(0x094E,-1,clif->pSearchStoreInfo,2,4,5,9,13,14,15); //packet(0x0835,2,clif->pSearchStoreInfoNextPage,0); //packet(0x0838,12,clif->pSearchStoreInfoListItemClick,2,6,10); - packet(0x0844,2,clif->pCashShopOpen,0);/* tell server cashshop window is being open */ - packet(0x084a,2,clif->pCashShopClose,0);/* tell server cashshop window is being closed */ - packet(0x08c9,4,clif->pCashShopSchedule,0); - packet(0x0848,-1,clif->pCashShopBuy,0); + packet(0x0844,2,clif->pCashShopOpen,2);/* tell server cashshop window is being open */ + packet(0x084a,2,clif->pCashShopClose,2);/* tell server cashshop window is being closed */ + packet(0x08c9,4,clif->pCashShopSchedule,2); + packet(0x0848,-1,clif->pCashShopBuy,2); packet(0x0447,2); #endif diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 253ea6bdc..94450facb 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -23,7 +23,7 @@ enum packet_headers { additemType = 0xa0, #elif PACKETVER < 20071002 additemType = 0x29a, -#elif PACKETVER < 20130000 /* not sure date */ +#elif PACKETVER < 20120925 additemType = 0x2d4, #else additemType = 0x990, @@ -38,7 +38,7 @@ enum packet_headers { idle_unitType = 0x2ee, #elif PACKETVER < 20101124 idle_unitType = 0x7f9, -#elif PACKETVER < 20130000 +#elif PACKETVER < 20140000 //actual 20120221 idle_unitType = 0x857, #else idle_unitType = 0x915, @@ -60,7 +60,7 @@ enum packet_headers { spawn_unitType = 0x2ed, #elif PACKETVER < 20101124 spawn_unitType = 0x7f8, -#elif PACKETVER < 20130000 +#elif PACKETVER < 20140000 //actual 20120221 spawn_unitType = 0x858, #else spawn_unitType = 0x90f, @@ -80,7 +80,7 @@ enum packet_headers { unit_walkingType = 0x2ec, #elif PACKETVER < 20101124 unit_walkingType = 0x7f7, -#elif PACKETVER < 20130000 +#elif PACKETVER < 20140000 //actual 20120221 unit_walkingType = 0x856, #else unit_walkingType = 0x914, @@ -130,7 +130,7 @@ struct packet_additem { bool IsDamaged; unsigned char refiningLevel; struct EQUIPSLOTINFO slot; -#if PACKETVER >= 20130000 /* not sure */ +#if PACKETVER >= 20120925 unsigned int location; #else unsigned short location; @@ -211,7 +211,7 @@ struct packet_spawn_unit { #if PACKETVER >= 20080102 short font; #endif -#if PACKETVER >= 20120712 +#if PACKETVER >= 20140000 //actual 20120221 int maxHP; int HP; unsigned char isBoss; @@ -270,7 +270,7 @@ struct packet_unit_walking { #if PACKETVER >= 20080102 short font; #endif -#if PACKETVER >= 20120712 +#if PACKETVER >= 20140000 //actual 20120221 int maxHP; int HP; unsigned char isBoss; @@ -329,7 +329,7 @@ struct packet_idle_unit { #if PACKETVER >= 20080102 short font; #endif -#if PACKETVER >= 20120712 +#if PACKETVER >= 20140000 //actual 20120221 int maxHP; int HP; unsigned char isBoss; |