viewing paste Unknown #42498 | Text

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670
/*.-----------------------------------------------------------------------------.
  .          ____                          __                                   .
  .         /\  _`\                       /\ \__  __                            .
  .         \ \ \/\_\  _ __    __     __  \ \ ,_\/\_\  __  __     __            .
  .          \ \ \/_/_/\`'__\/'__`\ /'__`\ \ \ \/\/\ \/\ \/\ \  /'__`\          .
  .           \ \ \s\ \ \ \//\  __//\ \d\.\_\ \ \_\ \ \ \ \_/ |/\  __/          .
  .            \ \____/\ \_\\ \____\ \__/.\_\\ \__\\ \_\ \___/ \ \____\         .
  .             \/___/  \/_/ \/____/\/__/\/_/ \/__/ \/_/\/__/   \/____/         .
  .                                                                             .
  .                  2014~2017 © Creative Services and Developent               .
  .                            www.creativesd.com.br                            .
  .-----------------------------------------------------------------------------.
  . Script:                                                                     .
  .    Arena PvP                                                                .
  .-----------------------------------------------------------------------------.
  . Autor: Romulo SM (sbk_)                                        Versão: 1.0  .
  .                                                                             .
  . Compatível:    Hercules.                                                       .
  *------------------------------------------------------------------------------*/
-   script  Arena PvP#main  FAKE_NPC,{
OnInit:
    setarray $@PvP_Maps$[0],
            "pvp_y_1-1", 156, 191,  // Coordenadas para Arena PvP não ranqueada.
            "pvp_y_2-1", 156, 191,  // Coordenadas para Arena PvP Ranqueada.
            "pvp_y_3-1", 156, 191,  // Coordenadas para Arena GvG não ranqueada.
            "pvp_y_4-1", 156, 191,  // Coordenadas para Arena GvG Ranqueada.
            "pvp_y_5-1", 156, 191,  // Coordenadas para Arena Grupo vs Grupo 2x2
            "pvp_y_6-1", 156, 191,  // Coordenadas para Arena Grupo vs Grupo 3x3
            "pvp_y_7-1", 156, 191,  // Coordenadas para Arena Grupo vs Grupo 4x4
            "pvp_y_8-1", 156, 191   // Coordenadas para Arena Grupo vs Grupo 5x5
    ;
    
    // Recompensa para o 1º colocado.
    //
    // <item_id1>, <quantidade1>, <item_id2>, <quantidade2>...;
    setarray $pvp_reward_1[0], 501, 10, 502, 20, 503, 30;
    
    // Recompensa para o 2º colocado.
    //
    // <item_id1>, <quantidade1>, <item_id2>, <quantidade2>...;
    setarray $pvp_reward_2[0], 501, 5, 502, 10, 503, 15;
    
    // Recompensa para o 3º colocado.
    //
    // <item_id1>, <quantidade1>, <item_id2>, <quantidade2>...;
    setarray $pvp_reward_3[0], 501, 2, 502, 4, 503, 3;
    
    bindatcmd "pvpexit", "Arena PvP#main::OnExit", 0, 0;
    end;
 
OnExit:
    if( strcharinfo(3) && $@PvP_Maps$[0] && strcharinfo(3) != $@PvP_Maps$[3] && strcharinfo(3) != $@PvP_Maps$[6] && strcharinfo(3) != $@PvP_Maps$[12] && strcharinfo(3) != $@PvP_Maps$[15] && strcharinfo(3) != $@PvP_Maps$[18] && strcharinfo(3) != $@PvP_Maps$[21] && strcharinfo(3) != $@PvP_Maps$[24] && strcharinfo(3) != $@PvP_Maps$[27] )
        end;
        
    warp "SavePoint", 0, 0;
    end;
    
OnPCKillEvent:
    set .@killer_id, getcharid(0);
    set .@killer_name$, strcharinfo(0);
    set .@map$, strcharinfo(3);
    
    set .@killed_id, getcharid(0, rid2name(killedrid));
    set .@killed_name$, rid2name(.@killed_id);
    
    if( .@map$ == $@PvP_Maps$[0] || .@map$ == $@PvP_Maps$[6] )
        end;
        
    set PVP_D_Con, 0;
    set PVP_V_Con, PVP_V_Con + 1;
    
    if( PVP_V_Con == 2 )
        set .@points, 1;
    else if( PVP_V_Con == 5 )
        set .@points, 10;
    else if( PVP_V_Con == 10 )
        set .@points, 25;
    else if( PVP_V_Con == 20 ) {
        set .@points, 50;
        set PVP_V_Con, 0;
    }
    else
        set .@points, 0;
        
    if( .@points )
        dispbottom "Você recebeu " + .@points + " por derrotar " + PVP_V_Con + " jogadores na Arena.";
        
    set #PVP_Points, #PVP_Points + .@points;
    
    if( .@map$ == $@PvP_Maps$[3] || .@map$ == $@PvP_Maps$[9] )
    {
        // Ranking individual do jogador.
        callfunc "PVP_Update_Rank", getcharid(0), 0, 0, .@points, 1;
        
        // Ranking individual do jogador na Sala PvP Ranqueada.
        if( .@map$ == $@PvP_Maps$[3] )
            callfunc "PVP_Update_Rank", getcharid(0), 0, 1, .@points, 1;
            
        // Ranking individual do jogador e do Clã na Sala de GvG Ranqueada.
        if( .@map$ == $@PvP_Maps$[9] )
        {
            callfunc "PVP_Update_Rank", getcharid(0), 0, 2, .@points, 1;
            if( getcharid(3) ) {
                callfunc "PVP_Update_Rank", getcharid(3), 1, 0, .@points, 1;
                callfunc "PVP_Update_Rank", getcharid(3), 1, 2, .@points, 1;
            }
        }
    }
    end;
        
OnPCDieEvent:
    set .@map$, strcharinfo(3);
    if( .@map$ == $@PvP_Maps$[0] || .@map$ == $@PvP_Maps$[6] )
        end;
        
    recovery;
    set PVP_D_Con, PVP_D_Con+1;
    set PVP_V_Con, 0;
    
    if( PVP_D_Con == 2 )
        set .@points, 1;
    else if( PVP_D_Con == 5 )
        set .@points, 3;
    else if( PVP_D_Con == 10 )
        set .@points, 5;
    else if( PVP_D_Con == 20 )
    {
        set .@points, 10;
        set PVP_D_Con, 0;
    }
    else
        set .@points, 0;
        
    if( .@points )
        dispbottom "Você perdeu " + .@points + " por ser derrotado " + PVP_D_Con + " consecutivamente na Arena.";
        
    set #PVP_Points, #PVP_Points - .@points;
    
    if( #PVP_Points < 0 )
        set #PVP_Points, 0;
    
    if( .@map$ == $@PvP_Maps$[3] || .@map$ == $@PvP_Maps$[9] )
    {
        // Ranking individual do jogador.
        callfunc "PVP_Update_Rank", getcharid(0), 0, 0, .@points, 0;
        
        // Ranking individual do jogador na Sala PvP Ranqueada.
        if( .@map$ == $@PvP_Maps$[3] )
            callfunc "PVP_Update_Rank", getcharid(0), 0, 1, .@points, 0;
            
        // Ranking individual do jogador e do Clã na Sala de GvG Ranqueada.
        if( .@map$ == $@PvP_Maps$[9] )
        {
            callfunc "PVP_Update_Rank", getcharid(0), 0, 2, .@points, 0;
            if( getcharid(3) ) {
                callfunc "PVP_Update_Rank", getcharid(3), 1, 0, .@points, 0;
                callfunc "PVP_Update_Rank", getcharid(3), 1, 2, .@points, 0;
            }
        }
    }
    end;
OnMinute01:
    if( gettime(2) == 1 && gettime(3) == 0 && gettime(5) == 1 ) {
        setarray $pvp_winner[0], 0, 0, 0;
        setarray $pvp_winner_flag[0], 0, 0, 0;
        
        query_sql "SELECT `a`.`object_id` FROM `pvp_ranking` AS a WHERE `a`.`room`='0' AND `a`.`type`='0' AND (SELECT COUNT(*) FROM `char` WHERE `char_id`=`a`.`object_id`) ORDER BY `ration` DESC LIMIT 3", .@object_id;
        
        for( set .@i, 0; .@i < getarraysize(.@object_id) && .@i <= 2; set .@i, .@i + 1 ) {
            set $pvp_winner[.@i], .@object_id[.@i];
            set .@name$, callfunc("PVP_GetCharInfo", "name", .@object_id[.@i]);
            announce "[Arena PvP]: O Jogador " + .@name$ + " ficou em " + (.@i+1) + "º Lugar na Arena PvP. Parabéns!!!", bc_all, 0x00FF00;
        }
        
        // Empty PvP Ranking.
        query_sql "DELETE FROM `pvp_ranking`";
    }
    end;
}
 
prontera,152,152,5  trader  Loja PvP#pvp_ranking    4_F_KAFRA7,{
OnInit:
    tradertype(NST_CUSTOM);
    sellitem 501,30;
    sellitem 502,40;
    sellitem 503,50;
    end;
 
OnCountFunds:
    setcurrency(#PVP_Points);
    end;
    
OnPayFunds:
    if( #PVP_Points < @price )
        end;
    
    set #PVP_Points, #PVP_Points - @price;
    purchaseok();
    end;
}
 
prontera,150,150,5  script  Arena PvP#custom    4_M_EIN_SOLDIER,{
    mes "^800000[Arena PvP]^000000";
    if( $pvp_winner[0] || $pvp_winner[1] || $pvp_winner[2] )
    {
        mes "Bem-vindo a ^0000FFArena PvP^000000, os ^006400Capeões^000000 desse mês são:";
        if( $pvp_winner[0] )
        {
            set .@name$, callfunc("PVP_GetCharInfo", "name", $pvp_winner[0]);
            mes "^FFD7001º Lugar:^000000 " + .@name$;
        }
        
        if( $pvp_winner[1] )
        {
            set .@name$, callfunc("PVP_GetCharInfo", "name", $pvp_winner[1]);
            mes "^7080902º Lugar:^000000 " + .@name$;
        }
        
        if( $pvp_winner[2] )
        {
            set .@name$, callfunc("PVP_GetCharInfo", "name", $pvp_winner[2]);
            mes "^FFA5003º Lugar:^000000 " + .@name$;
        }
        mes " ";
        mes "^FF0000Pontos atuais:^000000 " + #PVP_Points;
        mes "Em que posso ajudar?";
    }
    else {
        mes "Bem-vindo a ^0000FFArena PvP^000000 em que posso ajudar?";
        mes "^FF0000Pontos atuais:^000000 " + #PVP_Points;
    }
    next;
    set .@build$, "- Arena PvP ^0000FF[" + getmapusers($@PvP_Maps$[0]) + " jogadores]^000000.:";
    
    if( gettime(3) > 17 && gettime(3) < 20 )
        set .@build$, .@build$ + "- Arena PvP ^FF0000Ranqueada^000000 ^0000FF[" + getmapusers($@PvP_Maps$[3]) + " jogadores]^000000.";
    
    set .@build$, .@build$ + ":- Arena GvG ^0000FF[" + getmapusers($@PvP_Maps$[6]) + " jogadores]^000000.:";
    
    if( gettime(3) > 17 && gettime(3) < 20 )
        set .@build$, .@build$ + "- Arena GvG ^FF0000Ranqueada^000000 ^0000FF[" + getmapusers($@PvP_Maps$[9]) + " jogadores]^000000.";
    
    set .@build$, .@build$ + ":- Grupo vs Grupo.:^0000FF- Ranking.^000000:";
    
    if( $pvp_winner[0] || $pvp_winner[1] || $pvp_winner[2] )
        set .@build$, .@build$ + "^8A2BE2- Pegar premiação.^000000";
    
    set .@build$, .@build$ + ":^FF0000- Cancelar.^000000";
    
    switch( select(.@build$) )
    {
        case 1:
            // Arena PvP (Não ranqueada).
            mes "^800000[Arena PvP]^000000";
            mes "Deseja ir a Arena PvP ^FF0000não ranqueada^000000?";
            next;
            if( select("- Sim, por favor.", "^FF0000- Não obrigado.^000000") == 1 )
            {
                mes "^800000[Arena PvP]^000000";
                mes "Muito bem irei te mandar para lá!";
                close2;
                warp $@PvP_Maps$[0], atoi($@PvP_Maps$[1]), atoi($@PvP_Maps$[2]);
                end;
            }
            break;
        case 2:
            // Arena PvP (ranqueada).
            mes "^800000[Arena PvP]^000000";
            mes "Deseja ir a Arena PvP ^FF0000Ranqueada^000000?";
            next;
            if( select("- Sim, por favor.", "^FF0000- Não obrigado.^000000") == 1 )
            {
                mes "^800000[Arena PvP]^000000";
                mes "Muito bem irei te mandar para lá!";
                close2;
                warp $@PvP_Maps$[3], atoi($@PvP_Maps$[4]), atoi($@PvP_Maps$[5]);
                end;
            }
            break;
        case 3:
            // Arena GvG (Não ranqueada).
            mes "^800000[Arena PvP]^000000";
            if( getcharid(2) <= 0 )
            {
                mes "É necessário estar em um Clã para entrar em ^FF0000Arenas GvG^000000.";
                close;
            }
            mes "Deseja ir a Arena GvG ^FF0000não ranqueada^000000?";
            next;
            if( select("- Sim, por favor.", "^FF0000- Não obrigado.^000000") == 1 )
            {
                mes "^800000[Arena PvP]^000000";
                mes "Muito bem irei te mandar para lá!";
                close2;
                warp $@PvP_Maps$[6], atoi($@PvP_Maps$[7]), atoi($@PvP_Maps$[8]);
                end;
            }
            break;
        case 4:
            // Arena GvG (Não ranqueada).
            mes "^800000[Arena PvP]^000000";
            if( getcharid(2) <= 0 )
            {
                mes "É necessário estar em um Clã para entrar em ^FF0000Arenas GvG^000000.";
                close;
            }
            mes "Deseja ir a Arena GvG ^FF0000Ranqueada^000000?";
            next;
            if( select("- Sim, por favor.", "^FF0000- Não obrigado.^000000") == 1 )
            {
                mes "^800000[Arena PvP]^000000";
                mes "Muito bem irei te mandar para lá!";
                close2;
                warp $@PvP_Maps$[9], atoi($@PvP_Maps$[10]), atoi($@PvP_Maps$[11]);
                end;
            }
            break;
        case 5:
            // Arena Grupo vs Grupos
            mes "^800000[Arena PvP]^000000";
            mes "Escolha a Arena:";
            next;
            set .@choose, select("- Arena 2x2 ^0000FF[" + getmapusers($@PvP_Maps$[12]) + " jogadores]^000000.", "- Arena 3x3 ^0000FF[" + getmapusers($@PvP_Maps$[15]) + " jogadores]^000000.", "- Arena 4x4 ^0000FF[" + getmapusers($@PvP_Maps$[18]) + " jogadores]^000000.", "- Arena 5x5 ^0000FF[" + getmapusers($@PvP_Maps$[21]) + " jogadores]^000000.", "^FF0000- Cancelar.^000000");
            
            if( .@choose >= 5 )
                break;
                
            mes "^800000[Arena PvP]^000000";
            if( getcharid(1) <= 0 )
            {
                mes "É necessário estar em um Grupo para entrar em ^FF0000Arenas de Grupo vs Grupo^000000.";
                close;
            }
 
            switch( .@choose )
            {
                default:
                case 1:
                    set .@an, 2;
                    set .@idx, 12;
                    break;
                case 2:
                    set .@an, 3;
                    set .@idx, 15;
                    break;
                case 3:
                    set .@an, 4;
                    set .@idx, 18;
                    break;
                case 4:
                    set .@an, 5;
                    set .@idx, 21;
                    break;
            }
            
            getpartymember(getcharid(1));
            if( $@partymembercount < .@an )
            {
                mes "Você não pode entrar na Arena de ^FF0000Grupos " + .@an + "x" + .@an + "^000000 pois seu Grupo não tem jogadores suficientes.";
                close;
            }
            
            if( $@partymembercount > .@an )
            {
                mes "Você não pode entrar na Arena de ^FF0000Grupos " + .@an + "x" + .@an + "^000000 pois seu Grupo ultrapassa a quantidade de jogadores.";
                close;
            }
            
            mes "Deseja ir a Arena de ^FF0000Grupos " + .@an + "x" + .@an + "^000000?";
            next;
            if( select("- Sim, por favor.", "^FF0000- Não obrigado.^000000") == 1 )
            {
                mes "^800000[Arena PvP]^000000";
                mes "Muito bem irei te mandar para lá!";
                close2;
                warp $@PvP_Maps$[.@idx], atoi($@PvP_Maps$[.@idx+1]), atoi($@PvP_Maps$[.@idx+2]);
                end;
            }
            break;
        case 6:
            mes "^800000[Arena PvP]^000000";
            mes "Selecione o ^0000FFRanking^000000 que deseja visualizar:";
            next;
            switch( select("- Ranking de Jogadores.", "- Ranking de Clãs.", "^FF0000- Cancelar.^000000") )
            {
                case 1:
                    //mes "^800000[Arena PvP]^000000";
                    //mes "Como deseja filtrar o ^0000FFRanking^000000?";
                    //next;
                    //set .@filter, select("- Vitórias.", "- Derrotas.", "- Vitórias por Derrotas.", "- Pontos Ganhos.", "- Pontos Perdidos.", "- Pontos Ganhos por Perdidos.", "^FF0000- Cancelar.^000000");
                    set .@filter, 3;
                    if( .@filter == 7 )
                        break;
                        
                    mes "^800000[Arena PvP]^000000";
                    mes "Deseja visualizar o ^0000FFRanking de uma Sala especifica^000000?";
                    next;
                    set .@room, select("- Ranking Geral.", "- PvP Ranqueada.", "- GvG Ranqueada.", "^FF0000- Cancelar.^000000")-1;
                    if( .@room == 3 )
                        break;
                        
                    setarray .@order$[1], "wins", "loss", "ration", "points_gained", "points_lost", "points_ration";
                    
                    set .@row_init, 0;
                    set .@row_end, 10;
                    set .@prev, 0;
                    set .@loop_1, 1;
                    set .@pos,0;
                    while(.@loop_1)
                    {
                        deletearray .@object_id;
                        deletearray .@wins;
                        deletearray .@loss;
                        deletearray .@ration;
                        deletearray .@p_gained;
                        deletearray .@p_lost;
                        deletearray .@p_ration;
                        query_sql "SELECT `a`.`object_id`, `a`.`wins`, `a`.`loss`, `a`.`ration`, `a`.`points_gained`, `a`.`points_lost`, `a`.`points_ration` FROM `pvp_ranking` AS a WHERE `a`.`room`='" + .@room + "' AND `a`.`type`='0' AND (SELECT COUNT(*) FROM `char` WHERE `char_id`=`a`.`object_id`) ORDER BY " + .@order$[.@filter] + " DESC LIMIT " + .@row_init + ", " + .@row_end + "", .@object_id, .@wins, .@loss, .@ration, .@p_gained, .@p_lost, .@p_gained;
                    
                        if( !getarraysize(.@object_id) )
                        {
                            mes "^800000[Arena PvP]^000000";
                            mes "Não há mais resultados no Ranking.";
                            close;
                        }
                        
                        dispbottom "[ Ranking de Jogadores ]";
                        dispbottom "Posição <~> Jogador <~> Nome do Clã <~> Vitórias <~> Derrotas <~> Proporção";
                        for( set .@i,0; .@i < getarraysize(.@object_id); set .@i, .@i + 1 )
                        {
                            set .@name$, callfunc("PVP_GetCharInfo", "name", .@object_id[.@i]);
                            set .@guild_id, callfunc("PVP_GetCharInfo", "guild_id", .@object_id[.@i]);
                            set .@message$, (.@pos+1);
                            set .@message$, .@message$ + " <~> " + .@name$ + " <~> ";
                            if( .@guild_id )
                            {
                                set .@guild_name$, callfunc("PVP_GetGuildInfo", "name", .@guild_id);
                                set .@message$, .@message$ + .@guild_name$;
                            }
                            else {
                                set .@message$, .@message$ + "N/a";
                            }
                            set .@message$, .@message$ + " <~> " + .@wins[.@i] + " <~> ";
                            set .@message$, .@message$ + .@loss[.@i] + " <~> ";
                            set .@message$, .@message$ + .@ration[.@i];
                            
                            //dispbottom "^0000FFProporção:^000000 " + .@ration[.@i];
                            //dispbottom "^0000FFPontos Ganhos:^000000 " + .@p_gained[.@i];
                            //dispbottom "^0000FFPontos Perdidos:^000000 " + .@p_lost[.@i];
                            //dispbottom "^0000FFProporção:^000000 " + .@p_ration[.@i];
                            //dispbottom " ";
                            dispbottom .@message$;
                            set .@pos, .@pos+1;
                        }
                        query_sql "SELECT COUNT(*) FROM `pvp_ranking` AS a WHERE `a`.`room`='" + .@room + "' AND `a`.`type`='0' AND (SELECT COUNT(*) FROM `char` WHERE `char_id`=`a`.`object_id`) ORDER BY " + .@order$[.@filter] + " DESC LIMIT " + (.@row_init+10) + ", " + (.@row_end+10) + "", .@check_next;
                        mes "^800000[Arena PvP]^000000";
                        if( .@check_next )
                            mes "Selecione ^FF0000Próximo^000000 para exibir mais resultados.";
                        else
                            mes "Não há mais resultados a ser exibidos.";
                        next;
                        switch( select((.@check_next>0?"^FF0000- Próximo.^000000":""), (.@prev?"^FF8C00- Anterior.^000000":""), "^FF0000- Cancelar.^000000") )
                        {
                            case 1:
                                set .@row_init, .@row_init + 10;
                                set .@row_end, .@row_init + 10;
                                set .@pos, .@row_init;
                                set .@prev, 1;
                                break;
                            case 2:
                                set .@row_init, .@row_init - 10;
                                set .@row_end, .@row_init + 10;
                                set .@pos, .@row_init;
                                
                                if( .@row_init <= 0 )
                                    set .@prev, 0;
                                break;
                            case 3:
                                set .@loop_1,0;
                                break;
                        }
                    }
                    break;
                case 2:
                    //mes "^800000[Arena PvP]^000000";
                    //mes "Como deseja filtrar o ^0000FFRanking^000000?";
                    //next;
                    //set .@filter, select("- Vitórias.", "- Derrotas.", "- Vitórias por Derrotas.", "- Pontos Ganhos.", "- Pontos Perdidos.", "- Pontos Ganhos por Perdidos.", "^FF0000- Cancelar.^000000");
                    //if( .@filter == 7 )
                    //  break;
                    
                    set .@filter, 3;
                    mes "^800000[Arena PvP]^000000";
                    mes "Deseja visualizar o ^0000FFRanking de uma Sala especifica^000000?";
                    next;
                    set .@room, select("- Ranking Geral.", "", "- GvG Ranqueada.", "^FF0000- Cancelar.^000000")-1;
                    if( .@room == 3 )
                        break;
                        
                    setarray .@order$[1], "wins", "loss", "ration", "points_gained", "points_lost", "points_ration";
                    
                    set .@row_init, 0;
                    set .@row_end, 10;
                    set .@prev, 0;
                    set .@loop_1, 1;
                    set .@pos,0;
                    while(.@loop_1)
                    {
                        deletearray .@object_id;
                        deletearray .@wins;
                        deletearray .@loss;
                        deletearray .@ration;
                        deletearray .@p_gained;
                        deletearray .@p_lost;
                        deletearray .@p_ration;
                        query_sql "SELECT `a`.`object_id`, `a`.`wins`, `a`.`loss`, `a`.`ration`, `a`.`points_gained`, `a`.`points_lost`, `a`.`points_ration` FROM `pvp_ranking` AS a WHERE `a`.`room`='" + .@room + "' AND `a`.`type`='1' AND (SELECT COUNT(*) FROM `guild` WHERE `guild_id`=`a`.`object_id`) ORDER BY " + .@order$[.@filter] + " DESC LIMIT " + .@row_init + ", " + .@row_end + "", .@object_id, .@wins, .@loss, .@ration, .@p_gained, .@p_lost, .@p_gained;
                    
                        if( !getarraysize(.@object_id) )
                        {
                            mes "^800000[Arena PvP]^000000";
                            mes "Não há mais resultados no Ranking.";
                            close;
                        }
                        
                        dispbottom "[ Ranking de Clãs ]";
                        dispbottom "Posição <~> Clã <~> Vitórias <~> Derrotas <~> Proporção";
                        
                        for( set .@i,0; .@i < getarraysize(.@object_id); set .@i, .@i + 1 )
                        {
                            set .@guild_name$, callfunc("PVP_GetGuildInfo", "name", .@object_id[.@i]);
                            set .@message$, (.@pos+1);
                            set .@message$, .@message$ + " <~> " + .@guild_name$ + " <~> ";
                            set .@message$, .@message$ + .@wins[.@i];
                            set .@message$, .@message$ + " <~> " + .@loss[.@i] + " <~> ";
                            set .@message$, .@message$ + .@ration[.@i];
                            //dispbottom "^0000FFPontos Ganhos:^000000 " + .@p_gained[.@i];
                            //dispbottom "^0000FFPontos Perdidos:^000000 " + .@p_lost[.@i];
                            //dispbottom "^0000FFProporção:^000000 " + .@p_ration[.@i];
                            //mes " ";
                            set .@pos, .@pos+1;
                            dispbottom .@message$;
                        }
                        query_sql "SELECT COUNT(*) FROM `pvp_ranking` AS a WHERE `a`.`room`='" + .@room + "' AND `a`.`type`='1' AND (SELECT COUNT(*) FROM `char` WHERE `char_id`=`a`.`object_id`) ORDER BY " + .@order$[.@filter] + " DESC LIMIT " + (.@row_init+10) + ", " + (.@row_end+10) + "", .@check_next;
                        
                        mes "^800000[Arena PvP]^000000";
                        if( .@check_next )
                            mes "Selecione ^FF0000Próximo^000000 para exibir mais resultados.";
                        else
                            mes "Não há mais resultados a ser exibidos.";
                        next;
                        switch( select((.@check_next>0?"^FF0000- Próximo.^000000":""), (.@prev?"^FF8C00- Anterior.^000000":""), "^FF0000- Cancelar.^000000") )
                        {
                            case 1:
                                set .@row_init, .@row_init + 10;
                                set .@row_end, .@row_init + 10;
                                set .@pos, .@row_init;
                                set .@prev, 1;
                                break;
                            case 2:
                                set .@row_init, .@row_init - 10;
                                set .@row_end, .@row_init + 10;
                                set .@pos, .@row_init;
                                
                                if( .@row_init <= 0 )
                                    set .@prev, 0;
                                break;
                            case 3:
                                set .@loop_1,0;
                                break;
                        }
                    }
                    break;
                default:
                    break;
            }
            break;
        case 7:
            mes "^800000[Arena PvP]^000000";
            if( getcharid(0) != $pvp_winner[0] && getcharid(0) != $pvp_winner[1] && getcharid(0) != $pvp_winner[2] )
                mes "Você não venceu o ^FF0000Top 3^000000 na Arena PvP portanto não pode pegar um premio.";
            else if( getcharid(0) == $pvp_winner[0] && $pvp_winner_flag[0] || getcharid(0) == $pvp_winner[1] && $pvp_winner_flag[1] || getcharid(0) == $pvp_winner[2] && $pvp_winner_flag[2] )
                mes "Você já pegou sua recompensa!";
            else {
                if( getcharid(0) == $pvp_winner[0] ) {
                    set .@idx, 0;
                    copyarray .@item_reward, $pvp_reward_1, getarraysize($pvp_reward_1);
                }
                else if( getcharid(0) == $pvp_winner[1] ) {
                    set .@idx, 1;
                    copyarray .@item_reward, $pvp_reward_2, getarraysize($pvp_reward_2);
                }
                else if( getcharid(0) == $pvp_winner[2] ) {
                    set .@idx, 2;
                    copyarray .@item_reward, $pvp_reward_3, getarraysize($pvp_reward_3);
                }
                else {
                    mes "Você não está autorizado a pegar recompensas.";
                    close;
                }
                    
                if( !getarraysize(.@item_reward) )
                {
                    mes "Não há recompensas neste momento, retorne mais tarde.";
                    close;
                }
                
                for( set .@i, 0; .@i < getarraysize(.@item_reward); set .@i, .@i + 2 )
                {
                    if( !checkweight(.@item_reward[.@i],.@item_reward[(.@i+1)]) )
                    {
                        mes "Você não pode carregar ^FF0000" + .@item_reward[(.@i+1)] + "x " + getitemname(.@item_reward[.@i]) + "^000000.";
                        mes "Por favor, coloque alguns itens no seu ^0000FFArmazém Pessoal^000000 e fale comigo novamente para pegar sua recompensa.";
                        close;
                    }
                }
                
                set $pvp_winner_flag[.@idx], 1;
                mes "Você recebeu como recompensa de ^0000FF" + (.@idx+1) + "º lugar^000000:";
                for( set .@i, 0; .@i < getarraysize(.@item_reward); set .@i, .@i + 2 ) {
                    getitem .@item_reward[.@i], .@item_reward[(.@i+1)];
                    mes "^FF0000- " + .@item_reward[(.@i+1)] + "x " + getitemname(.@item_reward[.@i]) + "^000000";
                }
                close;
            }
            close;
        default:
            break;
    }
    
    mes "^800000[Arena PvP]^000000";
    mes "Muito bem, volte quando deseja entrar em uma ^0000FFArena PvP ou visualizar o Ranking^000000.";
    close;
}
 
// * callfunc "PVP_Update_Rank", <object_id>, <type>, <room>, <points>, <flag>;
//
function    script  PVP_Update_Rank {
    deletearray .@check_update;
    query_sql "SELECT `auto_id` FROM `pvp_ranking` WHERE `object_id`='" + getarg(0) + "' AND `type`='" + getarg(1) + "' AND `room`='" + getarg(2) + "'", .@check_update;
    
    if( !getarraysize(.@check_update) )
        query_sql "INSERT INTO `pvp_ranking` (object_id, type, room) VALUES (" + getarg(0) + ", " + getarg(1) + ", " + getarg(2) + ")";
        
    if( getarg(4) )
        query_sql "UPDATE `pvp_ranking` SET `wins`=`wins`+'1', `ration`=`ration`+'1', `points_gained`=`points_gained`+'" + getarg(3) + "', `points_ration`=`points_ration`+'" + getarg(3) + "' WHERE `object_id`='" + getarg(0) + "' AND `type`='" + getarg(1) + "' AND `room`='" + getarg(2) + "'";
    else
        query_sql "UPDATE `pvp_ranking` SET `loss`=`loss`+'1', `ration`=`ration`-'1', `points_lost`=`points_lost`-'" + getarg(3) + "', `points_ration`=`points_ration`-'" + getarg(3) + "' WHERE `object_id`='" + getarg(0) + "' AND `type`='" + getarg(1) + "' AND `room`='" + getarg(2) + "'";
 
    return 1;
}
 
function    script  PVP_GetCharInfo {
    deletearray .@result$;
    query_sql "SELECT `" + getarg(0) + "` FROM `char` WHERE `char_id`='" + getarg(1) + "'", .@result$;
    
    if( !getarraysize(.@result$) )
        return 0;
 
    return .@result$;
}
 
function    script  PVP_GetGuildInfo    {
    deletearray .@result$;
    query_sql "SELECT `" + getarg(0) + "` FROM `guild` WHERE `guild_id`='" + getarg(1) + "'", .@result$;
    
    if( !getarraysize(.@result$) )
        return 0;
 
    return .@result$;
}
Viewed 899 times, submitted by Guest.