From d4aa4c70a7ec51781109d27c9a7041e0a37d488f Mon Sep 17 00:00:00 2001 From: Playtester Date: Sat, 28 Feb 2015 15:41:18 +0100 Subject: [PATCH 1/4] Walkpath loop fix (fixes #198) - Move requests one cell west will now be ignored if the target cell is occupied - You can now set official_cell_stack_limit to 0 to completely disable it including the limitation above --- conf/battle/misc.conf | 1 + src/map/battle.c | 2 +- src/map/clif.c | 9 +++++++-- src/map/mob.c | 3 ++- src/map/unit.c | 3 ++- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/conf/battle/misc.conf b/conf/battle/misc.conf index dab6d85c38..061de2a412 100644 --- a/conf/battle/misc.conf +++ b/conf/battle/misc.conf @@ -92,6 +92,7 @@ duel_only_on_same_map: no // Official - Only affects the walking routines of characters, including monsters. // If a unit stops walking and is on a cell with more than stack limit // characters on it, it will walk to the closest free cell. +// Set to 0 for no cell stacking checks and free movement. // Custom - This variation will make every full cell to be considered a wall. // NOTE: For the custom setting to take effect you have to use a server compiled // with Cell Stack Limit support (see src/map/map.h) diff --git a/src/map/battle.c b/src/map/battle.c index 06400f4706..2aa2c6d04e 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -7704,7 +7704,7 @@ static const struct _battle_data { { "bone_drop", &battle_config.bone_drop, 0, 0, 2, }, { "buyer_name", &battle_config.buyer_name, 1, 0, 1, }, { "skill_wall_check", &battle_config.skill_wall_check, 1, 0, 1, }, - { "official_cell_stack_limit", &battle_config.official_cell_stack_limit, 1, 1, 255, }, + { "official_cell_stack_limit", &battle_config.official_cell_stack_limit, 1, 0, 255, }, { "custom_cell_stack_limit", &battle_config.custom_cell_stack_limit, 1, 1, 255, }, { "dancing_weaponswitch_fix", &battle_config.dancing_weaponswitch_fix, 1, 0, 1, }, diff --git a/src/map/clif.c b/src/map/clif.c index 1afd7a475a..e67352dda9 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -10074,6 +10074,13 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd) if(sd->sc.data[SC_RUN] || sd->sc.data[SC_WUGDASH]) return; + RFIFOPOS(fd, packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0], &x, &y, NULL); + + //A move command one cell west is only valid if the target cell is free + if(battle_config.official_cell_stack_limit > 0 + && sd->bl.x == x+1 && sd->bl.y == y && map_count_oncell(sd->bl.m, x, y, BL_CHAR|BL_NPC, 1)) + return; + // Cloaking wall check is actually updated when you click to process next movement // not when you move each cell. This is official behaviour. if (sd->sc.data[SC_CLOAKING]) @@ -10081,8 +10088,6 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd) pc_delinvincibletimer(sd); - RFIFOPOS(fd, packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0], &x, &y, NULL); - //Set last idle time... [Skotlex] if (battle_config.idletime_option&IDLE_WALK) sd->idletime = last_tick; diff --git a/src/map/mob.c b/src/map/mob.c index c889c0f180..2dd27db1e3 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -1334,7 +1334,8 @@ int mob_unlocktarget(struct mob_data *md, unsigned int tick) md->ud.target_to = 0; unit_set_target(&md->ud, 0); } - if(map_count_oncell(md->bl.m, md->bl.x, md->bl.y, BL_CHAR|BL_NPC, 1) > battle_config.official_cell_stack_limit) { + if(battle_config.official_cell_stack_limit > 0 + && map_count_oncell(md->bl.m, md->bl.x, md->bl.y, BL_CHAR|BL_NPC, 1) > battle_config.official_cell_stack_limit) { unit_walktoxy(&md->bl, md->bl.x, md->bl.y, 8); } diff --git a/src/map/unit.c b/src/map/unit.c index 8c985a95cd..c22e40038c 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -520,7 +520,8 @@ static int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data ud->to_x = bl->x; ud->to_y = bl->y; - if(map_count_oncell(bl->m, x, y, BL_CHAR|BL_NPC, 1) > battle_config.official_cell_stack_limit) { + if(battle_config.official_cell_stack_limit > 0 + && map_count_oncell(bl->m, x, y, BL_CHAR|BL_NPC, 1) > battle_config.official_cell_stack_limit) { //Walked on occupied cell, call unit_walktoxy again if(ud->steptimer != INVALID_TIMER) { //Execute step timer on next step instead From 5c24534b51ebfa4b717189ab47c1c90f079c107e Mon Sep 17 00:00:00 2001 From: Cydh Ramdh Date: Wed, 4 Mar 2015 23:12:48 +0700 Subject: [PATCH 2/4] Expanded msg len for e_msg in pc_useitem to CHAT_SIZE_MAX Signed-off-by: Cydh Ramdh --- src/map/pc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/map/pc.c b/src/map/pc.c index d2a723c33e..ba36565e82 100755 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -4809,7 +4809,7 @@ int pc_useitem(struct map_session_data *sd,int n) if( sd->item_delay[i].nameid ) {// found if( DIFF_TICK(sd->item_delay[i].tick, tick) > 0 ) { int e_tick = DIFF_TICK(sd->item_delay[i].tick, tick)/1000; - char e_msg[100]; + char e_msg[CHAT_SIZE_MAX]; if( e_tick > 99 ) sprintf(e_msg,msg_txt(sd,379), // Item Failed. [%s] is cooling down. Wait %.1f minutes. itemdb_jname(sd->item_delay[i].nameid), (double)e_tick / 60); From 73bfa215e5e59a85fae7d45987233d5e0ba88ba1 Mon Sep 17 00:00:00 2001 From: Cydh Ramdh Date: Wed, 4 Mar 2015 23:49:56 +0700 Subject: [PATCH 3/4] Fixed #317 Signed-off-by: Cydh Ramdh --- src/map/pc.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/map/pc.c b/src/map/pc.c index ba36565e82..dc7f24f2e5 100755 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -1617,8 +1617,6 @@ void pc_calc_skilltree(struct map_session_data *sd) if (sk_id == NV_BASIC || sk_id == NV_FIRSTAID || sk_id == WE_CALLBABY) continue; sd->status.skill[sk_idx].id = 0; - sd->status.skill[sk_idx].lv = 0; - sd->status.skill[sk_idx].flag = SKILL_FLAG_PERMANENT; } } } @@ -1705,7 +1703,7 @@ void pc_calc_skilltree(struct map_session_data *sd) continue; if( (skill_get_inf2(skid)&(INF2_QUEST_SKILL|INF2_WEDDING_SKILL)) ) continue; //Do not include Quest/Wedding skills. - if( sd->status.skill[sk_idx].id == 0 ) { //do we really want skid as index ? //Lighta + if( sd->status.skill[sk_idx].id == 0 ) { sd->status.skill[sk_idx].id = skid; sd->status.skill[sk_idx].flag = SKILL_FLAG_TEMPORARY; // So it is not saved, and tagged as a "bonus" skill. } else if( skid != NV_BASIC ) @@ -6757,8 +6755,8 @@ void pc_skillup(struct map_session_data *sd,uint16 skill_id) if (!pc_has_permission(sd, PC_PERM_ALL_SKILL)) // may skill everything at any time anyways, and this would cause a huge slowdown clif_skillinfoblock(sd); } - else - ShowDebug("Skill Level up failed. ID:%d idx:%d (CID=%d. AID=%d)\n", skill_id, idx, sd->status.char_id, sd->status.account_id); + //else + // ShowDebug("Skill Level up failed. ID:%d idx:%d (CID=%d. AID=%d)\n", skill_id, idx, sd->status.char_id, sd->status.account_id); } } From 6472425c10297fc9e97323bf67fc16ce6b919fa0 Mon Sep 17 00:00:00 2001 From: Cydh Ramdh Date: Thu, 5 Mar 2015 00:14:30 +0700 Subject: [PATCH 4/4] Something left behind... Signed-off-by: Cydh Ramdh --- src/map/pc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/map/pc.c b/src/map/pc.c index dc7f24f2e5..99a034e13a 100755 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -7015,7 +7015,7 @@ int pc_resetskill(struct map_session_data* sd, int flag) if (lv == 0 || skill_id == 0) continue; - inf2 = skill_get_inf2(i); + inf2 = skill_get_inf2(skill_id); if( inf2&(INF2_WEDDING_SKILL|INF2_SPIRIT_SKILL) ) //Avoid reseting wedding/linker skills. continue;