Gidz Cross Posted May 14, 2023 Group: Members Topic Count: 133 Topics Per Day: 0.03 Content Count: 686 Reputation: 89 Joined: 04/07/14 Last Seen: 9 hours ago Share Posted May 14, 2023 (edited) Is this possible? I have managed to make it work but the ranking system is not properly working. I am requesting to have PK Mode set to 1 with PVP Aura, Timer and Ranking that is properly working. In clif.c if(!pc_isinvisible(sd) && mapdata->flag[MF_PVP]) { //if(!battle_config.pk_mode) { // remove pvp stuff for pk_mode [Valaris] if (!mapdata->flag[MF_PVP_NOCALCRANK]) sd->pvp_timer = add_timer(gettick()+200, pc_calc_pvprank_timer, sd->bl.id, 0); sd->pvp_rank = 0; sd->pvp_lastusers = 0; sd->pvp_point = 5; sd->pvp_won = 0; sd->pvp_lost = 0; //} Edited May 14, 2023 by Gidz Cross Quote Link to comment Share on other sites More sharing options...
0 Gidz Cross Posted May 14, 2023 Group: Members Topic Count: 133 Topics Per Day: 0.03 Content Count: 686 Reputation: 89 Joined: 04/07/14 Last Seen: 9 hours ago Author Share Posted May 14, 2023 (edited) I have managed to solved the ranking issue but i think its quite yet missing something. But it works (partially). Scenario: Me kills Player 2. The Player 2 Rank will become 2/2. Warp out then goes back then the same ranking shown 2/2. But when player 2 killed me. The player 2 rank will becomes 1/2. That means the player 2 is in Rank 1 for pvp in that specific map. But when i go back to savepoint then re warp to the same map the player 2 ranking will become 2/2 when my account becomes 1/2. Here's what i did to make the ranking works in pk_mode: 1 (conf/misc) in pc.c // disable certain pvp functions on pk_mode [Valaris] //if( !battle_config.pk_mode && mapdata->flag[MF_PVP] && !mapdata->flag[MF_PVP_NOCALCRANK] ) { sd->pvp_point -= 5; sd->pvp_lost++; if( src && src->type == BL_PC ) { struct map_session_data *ssd = (struct map_session_data *)src; ssd->pvp_point++; ssd->pvp_won++; } //if( sd->pvp_point < 0 ) { //sd->respawn_tid = add_timer(tick+1000, pc_respawn_timer,sd->bl.id,0); //return 1|8; //} //} This is paired with the initical post in clif.c. Tagging @joecalis XD Is there a proper way to activate or port PVP Ranking, Timer with PK Mode: 1 enabled? Edited May 14, 2023 by Gidz Cross Call a friend Quote Link to comment Share on other sites More sharing options...
0 Litro Endemic Posted May 14, 2023 Group: Members Topic Count: 25 Topics Per Day: 0.01 Content Count: 283 Reputation: 79 Joined: 06/13/13 Last Seen: June 7, 2023 Share Posted May 14, 2023 (edited) 1 hour ago, Gidz Cross said: But when i go back to savepoint then re warp to the same map the player 2 ranking will become 2/2 when my account becomes 1/2. that because current pvp ranking system has it own point rank logic. suppose there is 2 player A & B currently in pvp map so the flow should go like.. - player A 5 point, rank 2/2 - player B 5 point, rank 2/2 - player A kill player B - player A 6 (5 + 1) point, rank 1/2 - player B 4 (5 - 1) point, rank 2/2 - player B warp out then goes back - player A 6 point, rank 1/2 - player B 5 point, rank 2/2 - player B kill player A - player B 6 (5 + 1) point, rank 1/2 - player A 4 (5 - 1) point, rank 2/2 - player A warp out then goes back - player B 6 point, rank 1/2 - player A 5 point, rank 2/2 anyway you can debug the code, to see the point acquired by player on map. /*========================================== * Update PVP rank for sd1 in cmp to sd2 *------------------------------------------*/ static int pc_calc_pvprank_sub(struct block_list *bl,va_list ap) { map_session_data *sd1,*sd2; sd1=(map_session_data *)bl; sd2=va_arg(ap,map_session_data *); if( pc_isinvisible(sd1) || pc_isinvisible(sd2) ) {// cannot register pvp rank for hidden GMs return 0; } + ShowDebug("pc_calc_pvprank_sub: player %s (%d:%d) %d pvp point.\n", sd1->status.name, sd1->status.account_id, sd1->status.char_id, sd1->pvp_point); + if( sd1->pvp_point > sd2->pvp_point ) sd2->pvp_rank++; return 0; } /*========================================== * Calculate new rank beetween all present players (map_foreachinallarea) * and display result *------------------------------------------*/ int pc_calc_pvprank(map_session_data *sd) { int old = sd->pvp_rank; struct map_data *mapdata = map_getmapdata(sd->bl.m); + ShowDebug("pc_calc_pvprank: player %s (%d:%d) %d pvp point.\n", sd->status.name, sd->status.account_id, sd->status.char_id, sd->pvp_point); + sd->pvp_rank=1; map_foreachinmap(pc_calc_pvprank_sub,sd->bl.m,BL_PC,sd); if(old!=sd->pvp_rank || sd->pvp_lastusers!=mapdata->users_pvp) clif_pvpset(sd,sd->pvp_rank,sd->pvp_lastusers=mapdata->users_pvp,0); return sd->pvp_rank; } though its bit weird pvp rank timer is allocated to each player in map instead run like dynamic mob, i mean the timer attached to map will run when there is player come to map (clif_parse_LoadEndAck ?) and stop when there is no one in map. albeit it will send 2 times the rank packet (clif_pvpset) when player come to map and timer executed at same time, but it should be no biggie. Oh or try use client command "/pvpinfo" in each player client to see current point, since rank is based point. Edited May 14, 2023 by Litro Endemic adding more info. 1 Quote Link to comment Share on other sites More sharing options...
0 Gidz Cross Posted May 15, 2023 Group: Members Topic Count: 133 Topics Per Day: 0.03 Content Count: 686 Reputation: 89 Joined: 04/07/14 Last Seen: 9 hours ago Author Share Posted May 15, 2023 10 hours ago, Litro Endemic said: that because current pvp ranking system has it own point rank logic. suppose there is 2 player A & B currently in pvp map so the flow should go like.. - player A 5 point, rank 2/2 - player B 5 point, rank 2/2 - player A kill player B - player A 6 (5 + 1) point, rank 1/2 - player B 4 (5 - 1) point, rank 2/2 - player B warp out then goes back - player A 6 point, rank 1/2 - player B 5 point, rank 2/2 - player B kill player A - player B 6 (5 + 1) point, rank 1/2 - player A 4 (5 - 1) point, rank 2/2 - player A warp out then goes back - player B 6 point, rank 1/2 - player A 5 point, rank 2/2 anyway you can debug the code, to see the point acquired by player on map. /*========================================== * Update PVP rank for sd1 in cmp to sd2 *------------------------------------------*/ static int pc_calc_pvprank_sub(struct block_list *bl,va_list ap) { map_session_data *sd1,*sd2; sd1=(map_session_data *)bl; sd2=va_arg(ap,map_session_data *); if( pc_isinvisible(sd1) || pc_isinvisible(sd2) ) {// cannot register pvp rank for hidden GMs return 0; } + ShowDebug("pc_calc_pvprank_sub: player %s (%d:%d) %d pvp point.\n", sd1->status.name, sd1->status.account_id, sd1->status.char_id, sd1->pvp_point); + if( sd1->pvp_point > sd2->pvp_point ) sd2->pvp_rank++; return 0; } /*========================================== * Calculate new rank beetween all present players (map_foreachinallarea) * and display result *------------------------------------------*/ int pc_calc_pvprank(map_session_data *sd) { int old = sd->pvp_rank; struct map_data *mapdata = map_getmapdata(sd->bl.m); + ShowDebug("pc_calc_pvprank: player %s (%d:%d) %d pvp point.\n", sd->status.name, sd->status.account_id, sd->status.char_id, sd->pvp_point); + sd->pvp_rank=1; map_foreachinmap(pc_calc_pvprank_sub,sd->bl.m,BL_PC,sd); if(old!=sd->pvp_rank || sd->pvp_lastusers!=mapdata->users_pvp) clif_pvpset(sd,sd->pvp_rank,sd->pvp_lastusers=mapdata->users_pvp,0); return sd->pvp_rank; } though its bit weird pvp rank timer is allocated to each player in map instead run like dynamic mob, i mean the timer attached to map will run when there is player come to map (clif_parse_LoadEndAck ?) and stop when there is no one in map. albeit it will send 2 times the rank packet (clif_pvpset) when player come to map and timer executed at same time, but it should be no biggie. Oh or try use client command "/pvpinfo" in each player client to see current point, since rank is based point. Wow. Thank you so much for these new information. Quote Link to comment Share on other sites More sharing options...
0 Dev j Posted January 19, 2024 Group: Members Topic Count: 17 Topics Per Day: 0.03 Content Count: 80 Reputation: 1 Joined: 06/22/23 Last Seen: July 16, 2024 Share Posted January 19, 2024 Hello @Gidz Cross can you share diff patch of that? Quote Link to comment Share on other sites More sharing options...
0 Gidz Cross Posted January 20, 2024 Group: Members Topic Count: 133 Topics Per Day: 0.03 Content Count: 686 Reputation: 89 Joined: 04/07/14 Last Seen: 9 hours ago Author Share Posted January 20, 2024 On 1/19/2024 at 7:18 PM, Dev j said: Hello @Gidz Cross can you share diff patch of that? I did already on the previous thread. In clif.c if(!pc_isinvisible(sd) && mapdata->flag[MF_PVP]) { //if(!battle_config.pk_mode) { // remove pvp stuff for pk_mode [Valaris] if (!mapdata->flag[MF_PVP_NOCALCRANK]) sd->pvp_timer = add_timer(gettick()+200, pc_calc_pvprank_timer, sd->bl.id, 0); sd->pvp_rank = 0; sd->pvp_lastusers = 0; sd->pvp_point = 5; sd->pvp_won = 0; sd->pvp_lost = 0; //} in pc.c // disable certain pvp functions on pk_mode [Valaris] //if( !battle_config.pk_mode && mapdata->flag[MF_PVP] && !mapdata->flag[MF_PVP_NOCALCRANK] ) { sd->pvp_point -= 5; sd->pvp_lost++; if( src && src->type == BL_PC ) { struct map_session_data *ssd = (struct map_session_data *)src; ssd->pvp_point++; ssd->pvp_won++; } //if( sd->pvp_point < 0 ) { //sd->respawn_tid = add_timer(tick+1000, pc_respawn_timer,sd->bl.id,0); //return 1|8; //} //} This will enable the timers, ranking when server is set to pk mode: 1 and doesn't warp out players when died twice. Quote Link to comment Share on other sites More sharing options...
Question
Gidz Cross
Is this possible? I have managed to make it work but the ranking system is not properly working. I am requesting to have PK Mode set to 1 with PVP Aura, Timer and Ranking that is properly working.
In clif.c
if(!pc_isinvisible(sd) && mapdata->flag[MF_PVP]) { //if(!battle_config.pk_mode) { // remove pvp stuff for pk_mode [Valaris] if (!mapdata->flag[MF_PVP_NOCALCRANK]) sd->pvp_timer = add_timer(gettick()+200, pc_calc_pvprank_timer, sd->bl.id, 0); sd->pvp_rank = 0; sd->pvp_lastusers = 0; sd->pvp_point = 5; sd->pvp_won = 0; sd->pvp_lost = 0; //}
Link to comment
Share on other sites
5 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.