chowking Posted May 29, 2013 Group: Members Topic Count: 32 Topics Per Day: 0.01 Content Count: 178 Reputation: 17 Joined: 06/25/12 Last Seen: September 22, 2022 Share Posted May 29, 2013 (edited) Hello, i have this @pk mod, the problem is when Pally and a char, are both in pk off state, pally wont be able to devo the char,basicallypally->devo->party member (both pk off) = successpally->devo->party member (both pk on) = success pally->devo->party member (not in same pk state) = failcurrently happening, pally->devo->party member (both pk on) = success pally->devo->party member (both pk off) = fail pally->devo->party member (not in same pkstate) = fail conf\atcommand_athena.conf pk: 0,80 // pk map\atcommand.c, find --------------------- /*========================================== * atcommand_info[] structure definition *------------------------------------------*/ AtCommandInfo atcommand_info[] = { it becomes ---------- // @pk int atcommand_pk( const int fd, struct map_session_data *sd, const char *command, const char *message ) { unsigned int tick = gettick(); nullpo_retr(-1, sd); if(!map[sd->bl.m].flag.town){ //Only can be used at town clif_displaymessage(sd->fd, "You can only use this command inside towns."); return -1; } if(DIFF_TICK(sd->pk_mode_tick,tick) > 0){ //check the delay before use this command again clif_displaymessage(sd->fd, "You must wait 60 seconds to use this command again."); return -1; } else{ if (!sd->state.pk_mode) { sd->state.pk_mode = 1; clif_displaymessage(sd->fd, "You are can no longer be attacked by players."); sd->pk_mode_tick = tick + 60000; //set the delay here } else { sd->state.pk_mode = 0; clif_displaymessage(sd->fd, "You can now attack players"); sd->pk_mode_tick = tick + 60000; //set the delay here } return 0; } /*========================================== * atcommand_info[] structure definition *------------------------------------------*/ AtCommandInfo atcommand_info[] = { ============================================================================================================================== ============================================================================================================================== map\atcommand.c, find --------------------- { "delitem", 60,60, atcommand_delitem }, { "charcommands", 1,1, atcommand_commands }, { "font", 1,1, atcommand_font }, it becomes ---------- { "delitem", 60,60, atcommand_delitem }, { "charcommands", 1,1, atcommand_commands }, { "font", 1,1, atcommand_font }, { "pkmode", 0,80, atcommand_pkmode }, ============================================================================================================================== ============================================================================================================================== map\battle.c, find (line 3407 svn15191) --------------------------------------- if( sd->state.monster_ignore && flag&BCT_ENEMY ) return 0; // Global inminuty only to Attacks if( sd->status.karma && s_bl->type == BL_PC && ((TBL_PC*)s_bl)->status.karma ) state |= BCT_ENEMY; // Characters with bad karma may fight amongst them it becomes ---------- if( sd->state.monster_ignore && flag&BCT_ENEMY ) return 0; // Global inminuty only to Attacks if( map[m].flag.pvp && sd->state.pk_mode && flag&BCT_ENEMY && s_bl->type != BL_MOB ) return 0; if( sd->status.karma && s_bl->type == BL_PC && ((TBL_PC*)s_bl)->status.karma ) state |= BCT_ENEMY; // Characters with bad karma may fight amongst them still in map\battle.c, near above, find (line 3471 svn15191) ------------------------------------------------------------ else return 0; // You can't target anything out of your duel } } if( map_flag_gvg(m) && !sd->status.guild_id && t_bl->type == BL_MOB && ((TBL_MOB*)t_bl)->guardian_data ) it becomes ---------- else return 0; // You can't target anything out of your duel } else if( map[m].flag.pvp && sd->state.pk_mode && t_bl->type != BL_MOB ) //pkmode return 0; //pkmode } if( map_flag_gvg(m) && !sd->status.guild_id && t_bl->type == BL_MOB && ((TBL_MOB*)t_bl)->guardian_data ) the last, in map\pc.h, find (line 141 svn15191) ----------------------------------------------- unsigned int warping : 1;//states whether you're in the middle of a warp processing } state; struct { it becomes ---------- unsigned int warping : 1;//states whether you're in the middle of a warp processing unsigned int pk_mode : 1; //[malufett] //pkmode } state; struct { ============================================================================================================================== ============================================================================================================================== map\pc.h, find (line 210 svn15191) ---------------------------------- unsigned int ks_floodprotect_tick; // [Kill Steal Protection] struct { become ------ unsigned int ks_floodprotect_tick; // [Kill Steal Protection] unsigned int pk_mode_tick; //@pkmode struct { map\pc.h, find (line 579 svn15191) ---------------------------------- sd->canlog_tick = gettick(); //Required to prevent homunculus copuing a base speed of 0. become ------ sd->canlog_tick = gettick(); sd->pk_mode_tick = gettick(); //@pk //Required to prevent homunculus copuing a base speed of 0. Edited June 20, 2013 by chowking 1 Quote Link to comment Share on other sites More sharing options...
chowking Posted June 1, 2013 Group: Members Topic Count: 32 Topics Per Day: 0.01 Content Count: 178 Reputation: 17 Joined: 06/25/12 Last Seen: September 22, 2022 Author Share Posted June 1, 2013 bump Quote Link to comment Share on other sites More sharing options...
chowking Posted June 5, 2013 Group: Members Topic Count: 32 Topics Per Day: 0.01 Content Count: 178 Reputation: 17 Joined: 06/25/12 Last Seen: September 22, 2022 Author Share Posted June 5, 2013 bump Quote Link to comment Share on other sites More sharing options...
chowking Posted June 17, 2013 Group: Members Topic Count: 32 Topics Per Day: 0.01 Content Count: 178 Reputation: 17 Joined: 06/25/12 Last Seen: September 22, 2022 Author Share Posted June 17, 2013 bump Quote Link to comment Share on other sites More sharing options...
chowking Posted June 20, 2013 Group: Members Topic Count: 32 Topics Per Day: 0.01 Content Count: 178 Reputation: 17 Joined: 06/25/12 Last Seen: September 22, 2022 Author Share Posted June 20, 2013 bump? Quote Link to comment Share on other sites More sharing options...
chowking Posted June 29, 2013 Group: Members Topic Count: 32 Topics Per Day: 0.01 Content Count: 178 Reputation: 17 Joined: 06/25/12 Last Seen: September 22, 2022 Author Share Posted June 29, 2013 bump Quote Link to comment Share on other sites More sharing options...
chowking Posted July 31, 2013 Group: Members Topic Count: 32 Topics Per Day: 0.01 Content Count: 178 Reputation: 17 Joined: 06/25/12 Last Seen: September 22, 2022 Author Share Posted July 31, 2013 Problem resolved. What happens now is: pally->devo->partymember(both pk on)=success pally->devo->partymember(both pk off)=success pally->devo->partymember(different pk state)=fail I have to do some reworking on battle_check_target in battle.c, as well as some slight modifications in skill_castend_nodamage_id in skill.c Did test runs in my test server and everything works. However, by editing battle_check_target which is used by almost ALL functions, I fear there are bugs that might be present. Please check my code below. =========================================================================== battle.c/battle_check_target(block list *src, block list *target, int flag) line no. 5351-5371 =========================================================================== switch( t_bl->type ) { //Checks on target master case BL_PC: { struct map_session_data *ssd=BL_CAST(BL_PC,s_bl);//custom; added ssd for enabling use of support skills on party members in pvp maps, stores map_session_data for source of attack/skill struct map_session_data *sd; if( t_bl == s_bl ) break; sd = BL_CAST(BL_PC, t_bl); if( sd->state.monster_ignore && flag&BCT_ENEMY ) return 0; // Global inminuty only to Attacks /*custom;added for pk mode, modified implementation of anti-pk protection and allows use of support skills on party members with identical pk status: Original code provided was:[for reference] if( map[m].flag.pvp && sd->state.pk_mode&& flag&BCT_ENEMY && s_bl->type != BL_MOB ) return 0; */ if( map[m].flag.pvp && sd->state.pk_mode==1 && flag&BCT_ENEMY && s_bl->type != BL_MOB ){ if(sd->status.party_id==ssd->status.party_id) state|=BCT_PARTY; else return 0;}//end custom =========================================================================== battle.c/battle_check_target(block list *src, block list *target, int flag) line no. 5418-5449 =========================================================================== switch( s_bl->type ) { //Checks on source master case BL_PC: { struct map_session_data *sd = BL_CAST(BL_PC, s_bl); struct map_session_data *tsd = BL_CAST(BL_PC,t_bl);//custom; added tsd to allow use of support skills on party members in pvp maps, stores the target of attack/skill if( s_bl != t_bl ) { if( sd->state.killer ) { state |= BCT_ENEMY; // Can kill anything strip_enemy = 0; } else if( sd->duel_group && !((!battle_config.duel_allow_pvp && map[m].flag.pvp) || (!battle_config.duel_allow_gvg && map_flag_gvg(m))) ) { if( t_bl->type == BL_PC && (sd->duel_group == ((TBL_PC*)t_bl)->duel_group) ) return (BCT_ENEMY&flag)?1:-1; // Duel targets can ONLY be your enemy, nothing else. else return 0; // You can't target anything out of your duel } /*custom;added for pk mode, modified implementation of anti-pk protection and allows use of support skills on party members with identical pk status: Original code provided was:[for reference] else if( map[m].flag.pvp && sd->state.pk_mode&& flag&BCT_ENEMY && s_bl->type != BL_MOB ) return 0; */ else if( map[m].flag.pvp && sd->state.pk_mode==1 && t_bl->type != BL_MOB){ if(sd->status.party_id==tsd->status.party_id) state|=BCT_PARTY; else return 0; } }//end custom here is the code from the modified skill.c ================================================================================================================= skill.c/skill_castend_nodamage_id(block_list* src, block_list* bl, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag) line no. 5617- 5686 ================================================================================================================= case ML_DEVOTION: case CR_DEVOTION: { int count, lv; if( !dstsd || (!sd && !mer) ) { // Only players can be devoted if( sd ) clif_skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); break; } if( (lv = status_get_lv(src) - dstsd->status.base_level) < 0 ) lv = -lv; if( lv > battle_config.devotion_level_difference || // Level difference requeriments (dstsd->sc.data[type] && dstsd->sc.data[type]->val1 != src->id) || // Cannot Devote a player devoted from another source (skill_id == ML_DEVOTION && (!mer || mer != dstsd->md)) || // Mercenary only can devote owner (dstsd->class_&MAPID_UPPERMASK) == MAPID_CRUSADER || // Crusader Cannot be devoted (dstsd->sc.data[SC_HELLPOWER])) // Players affected by SC_HELLPOWERR cannot be devoted. { if( sd ) clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); map_freeblock_unlock(); return 1; } i = 0; count = (sd)? min(skill_lv,5) : 1; // Mercenary only can Devote owner if( sd ) { // Player Devoting Player int devo=battle_check_target(src,bl,BCT_PARTY);//custom; added devo for allowing devotion on party members with identical pk states, stores the result of battle_check_target to see if the target with relation to the caster are party members struct map_session_data *devsd=BL_CAST(BL_PC,bl);//custom; added devsd for allowing devotion on party members with identical pk states, stores map_session_data of target ARR_FIND(0, count, i, sd->devotion[i] == bl->id ); if( i == count ) { ARR_FIND(0, count, i, sd->devotion[i] == 0 ); if( i == count ) { // No free slots, skill Fail clif_skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); map_freeblock_unlock(); return 1; } //custom; allows use of Devotion (CR_DEVOTION) on party members with identical pk states if(devo == -1){//Not in party of the caster clif_displaymessage(sd->fd,"Can't cast devotion on non-party members"); clif_skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); map_freeblock_unlock(); return 1; } } if(devo == 1 && sd->state.pk_mode==devsd->state.pk_mode){//is a party member and has the same pk state sd->devotion[i] = bl->id; } else if(devo == 1 && sd->state.pk_mode!=devsd->state.pk_mode){//is a party member but has a different pk state clif_displaymessage(sd->fd,"Can't use Devotion on party members with a different pk mode; ensure ALL of your party members have the same pk mode"); clif_skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); map_freeblock_unlock(); return 1; } else//added just in case of unknown errors clif_displaymessage(sd->fd,"Unknown logic error; please report the error to a GM"); //end custom 1 Quote Link to comment Share on other sites More sharing options...
Hiryu Imajin Posted July 31, 2013 Group: Members Topic Count: 5 Topics Per Day: 0.00 Content Count: 58 Reputation: 4 Joined: 07/10/13 Last Seen: December 15, 2018 Share Posted July 31, 2013 I think the reason why it is not working because of the configuration when both are pk off. Usually from the servers that I had played its not possible for that kind of skill to be casted on someone when pk off other than buffs though when you use shift+f#. But I guess you found out the solution already hehe. Quote Link to comment Share on other sites More sharing options...
chowking Posted September 5, 2013 Group: Members Topic Count: 32 Topics Per Day: 0.01 Content Count: 178 Reputation: 17 Joined: 06/25/12 Last Seen: September 22, 2022 Author Share Posted September 5, 2013 But I guess you found out the solution already hehe. still need help, there is a instance where map server crashes after implementing this, can anyone try the code reproduce the error Quote Link to comment Share on other sites More sharing options...
Question
chowking
Hello,
i have this @pk mod, the problem is when Pally and a char, are both in pk off state, pally wont be able to devo the char,
basically
pally->devo->party member (both pk off) = success
pally->devo->party member (both pk on) = success
pally->devo->party member (not in same pk state) = fail
currently happening,
pally->devo->party member (both pk on) = success
pally->devo->party member (both pk off) = fail
pally->devo->party member (not in same pkstate) = fail
Link to comment
Share on other sites
8 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.