viewing paste topic/4841- mvp_room_1.4c | Athena

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 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728
//  ~~~~~ Please use this latest int__ function that support negative numbers ~~~~~
function    script  int__   {
    .@i = getstrlen( .@str$ = getarg(0) ) -3;
    .@is_negative = charat( .@str$, 0 ) == "-";
    while ( .@i > .@is_negative ) {
        .@str$ = insertchar( .@str$, ",", .@i );
        .@i -= 3;
    }
    return .@str$;
}
 
//===== eAthena Script ======================================
//= Private MVP/Branch Room
//===== By: ===============================================
//= by ~AnnieRuru~
//===== Current Version: ======================================
//= 1.4c
//===== Compatible With: ===================================== 
//= hercules 2014-02-15
//===== Description: ========================================= 
//= Player can rent MVP room for the player him/herself, for party or for guilds
//===== Topic =================================================
//= http://www.eathena.ws/board/index.php?showtopic=187654
//= http://rathena.org/board/topic/72376-mvp-summon-script
//===== Additional Comments: ================================== 
//= 1.0 
//= ---- break the tradition which a script only for a player, or only for a party.
//=      now 1 room can be use for party and another room can use for guilds.
//= ---- timeout feature to prevent player owns the room indefinitely,
//=      by create a new account and sit/@at'ing inside overnight.
//= ---- can disable mvp/boss summon via configuration and becomes a branch room script.
//= ---- a double check to prevent players rent all the rooms for himself.
//= 1.0a
//= ---- fix a critial bug that the time count too fast -_-"
//= 1.1
//= ---- added item cost to rent or to summon
//= ---- added a config to limit summoning per session
//= ---- added flood control option
//= 1.2
//= ---- rewrite the waitingroom counter
//= ---- optimize the script in a way can add custom summon group
//= ---- add config to kill the monsters if the room just being left empty
//= ---- add GM can kick room in use
//= ---- add able to spawn in numbers
//= ---- add limitspawn can configure to negative to limit spawn in that group instead of individual one
//= 1.3
//= ---- fix chatroom countdown issue due to rev13269
//= ---- fix a bug if 2 people rent a room at same time, the later 1 will get the room
//= ---- add a feature so the GM can know how long the room has rented or abandoned
//= 1.4
//= ---- update with new mvp and mini bosses
//= ---- fix an exploit if server allow to use @mail, player can send item/Zeny away to prevent item/Zeny deletion when registering the room
//= ---- players die inside mvp room shouldn't lose exp
//= 1.4a
//= ---- fix this to use in rathena
//= 1.4b
//= ---- fix this to use in hercules
//========================================================
 
//  This is the shop for this Branch room IF you already enable it. Can sell whatever things you want.
-   shop    MVP room#branch -1,604:100000,12103:1000000
 
 
 
-   script  MVP Summoner    -1,{
    goto L_Start;
 
OnInit:
    getmapxy .@map$, .@x, .@y, 1;
    if ( .@map$ == "" ) {
 
//  Config ---------------------------------------------------------------------------------------
 
    // Time for rent a room IN MINUTES. When time out, players inside the room will kick out. Do Not set this as 0
    set .timeout, 60;
    // if the room left empty for # minutes, will be treated as give up the room. Do Not set this as 0
    set .nobodygiveup, 5;
 
    // NOTE : The script only search item OR Zeny. if you specify item amount, then it will ask for the item. If item amount is 0, then it will ask for Zeny.
 
    // the cost to rent a room
    set .rentitemid, 674; // item id use for rent a room - 674 - mithil coin
    set .rentitemamount, 0; // amount of items to rent a room
    set .rentcost, 1000000; // otherwise, Zeny cost to rent a room
 
    // limit each room can only summon 1 monster at a time. (only the Summoning option)
    // Turn it off (0) means the player can summon a lot of monsters as long as the player has enough Zeny/item. High rate server players love the room with a lot MVPs
    // Turn it on (1) means the player have to kill existing monster before can summon a new one. Low rate server player prefer to take out MVP 1 by 1
    set .floodcontrol, 0;
 
    // if .floodcontrol is turn off, your players might experience lag if they summoned too many MVPs
    // so what is the maximum input to limit your players summon too many ?
    set .inputlimit, 30;
 
    // If the room has left over monsters while nobody in the room and the room not give up yet, shall we kill monsters in empty room ?
    set .killmonster, 1; // Default is yes
 
    //  Options menu setting for MVP Summoner NPC.
    set .@menu[0], 1; // Turn Heal option On/Off
    set .@menu[1], 1; // Turn Group 1 summons On/Off -> MVP
    set .@menu[2], 1; // Turn Group 2 summons On/Off -> mini boss
    set .@menu[3], 0; // Turn Group 3 summons On/Off
    set .@menu[4], 0; // Turn Group 4 summons On/Off
    set .@menu[5], 0; // Turn Group 5 summons On/Off
    set .@menu[6], 0; // Turn Group 6 summons On/Off
    set .@menu[7], 0; // Turn Group 7 summons On/Off
    set .@menu[8], 0; // Turn Group 8 summons On/Off
    set .@menu[9], 0; // Turn Group 9 summons On/Off
    set .@menu[10], 0; // Sell shop items options On/Off ( shop npc above )
 
    //  set respawn point when they leave the room. Obviously warp to the Private MVP Room Warper npc
    set .respawnmap$, "prontera"; // Note : "SavePoint" does NOT work
    set .respawnx, 150;
    set .respawny, 174;
 
    // The minimum GM level can kick a room in use
    set .gmlvlkick, 80;
 
    // .limitspawn in previous revision changed to .grouplimit .
    // it is for limit each monster spawn per session, prevent them only killing same monster again and again
    // Now you can configure one group has limited summon, and another group has unlimited summon
    // Tips: if you server has an insane custom MVP, you can put your custom mob to Group 3~9 with insane item cost, and limit only 1 summon per session
    // .grouplimit use amount, means if group1limit set to 10, then each session can only summon up to 10 amount of that kind of monster. 0 is unlimited
 
    // ---------
    // Group 1 -> MVP 
    // ---------
    set .group1name$, "MVP"; // Group 1 name
    set .group1itemid, 674; // item id use for summon any Group 1 monster - 674 - mithil coin
    set .group1itemamount, 0; // amount of items to summon a Group 1 monster
    set .group1cost, 100000; // if no item is specify, Zeny cost to summon a Group 1 monster
    set .group1limit, 0; // limit of summon of Group 1 monster per session, prevent them only killing same monster again and again
    setarray .group1id,
        1511,// Amon Ra
        1647,// Assassin Cross Eremes
        1785,// Atroce
        1630,// Bacsojin
        1039,// Baphomet
        1874,// Beelzebub
        1272,// Dark Lord
        1719,// Datale
        1046,// Doppelgangger
        1389,// Dracula
        1112,// Drake
        1115,// Eddga
        1418,// Evil Snake Lord
        1871,// Fallen Bishop
        1252,// Garm
        1768,// Gloom Under Night
        1086,// Golden Thief Bug
        1885,// Gopinich
        1649,// High Priest Magaleta
        1651,// High Wizard Katrinn
        1832,// Ifrit
        1492,// Incantation Samurai
        1734,// Kiel D-01
        1251,// Knight of Windstorm
        1779,// Ktullanux
    //  1980,// Kubkin ( I think this mvp is still new )
        1688,// Lady Tanee
        1646,// Lord Knight Seyren
        1373,// Lord of Death
        1147,// Maya
        1059,// Mistress
        1150,// Moonlight Flower
        1087,// Orc Hero
        1190,// Orc Lord
        1038,// Osiris
        1157,// Pharaoh
        1159,// Phreeoni
        1623,// RSX 0806
        1650,// Sniper Shecil
        1583,// Tao Gunka
        1708,// Thanatos
        1312,// Turtle General
        1751,// Valkyrie Randgris
        1685,// Vesper
        1648,// Whitesmith Harword
        1917,// Wounded Morroc
        1658;// Ygnizem
 
    // ---------
    // Group 2 -> mini boss
    // ---------
    set .group2name$, "mini boss"; // Group 2 name
    set .group2itemid, 674; // item id use for summon any Group 2 monster - 674 - mithil coin
    set .group2itemamount, 0; // amount of items to summon a Group 2 monster
    set .group2cost, 10000; // if no item is specify, Zeny cost to summon a Group 2 monster
    set .group2limit, 0; // limit of summon of Group 2 monster per session, prevent them only killing same monster again and again
    setarray .group2id,
        1096,// Angeling
        1388,// Archangeling
        1795,// Bloody Knight
        1830,// Bow Guardian
        1839,// Byorgue
        1309,// Cat O' Nine Tail
        1283,// Chimera
        1302,// Dark Illusion
        1198,// Dark Priest
        1582,// Deviling
        1091,// Dragon Fly
        1093,// Eclipse
        1205,// Executioner
        1783,// Galion
        1592,// Gangster
        1120,// Ghostring
        1259,// Gryphon
        1720,// Hydro
        1090,// Mastering
        1289,// Maya Purple
        1262,// Mutant Dragon
        1203,// Mysteltainn
        1870,// Necromancer
        1295,// Owl Baron
        1829,// Sword Guardian
        1204,// Tirfing
        1089,// Toad
        1092,// Vagabond Wolf
        1765;// Valkyrie
 
    // ---------
    // Group 3
    // ---------
    set .group3name$, "Poring-Family"; // Group 3 name
    set .group3itemid, 12109; // item id use for summon any Group 3 monster - 12109 - Poring box
    set .group3itemamount, 1; // amount of items to summon a Group 3 monster
    set .group3cost, 0; // if no item is specify, Zeny cost to summon a Group 3 monster
    set .group3limit, -5; // limit of summon of Group 3 monster per session, prevent them only killing same monster again and again
    setarray .group3id,
        1002,// Poring
        1113,// Drops
        1031,// Poporing
        1242,// Marin
        1062,// Santa Poring
        1613,// Metaling
        1784,// Stapo
        1090,// Mastering
        1096,// Angeling
        1120,// Ghostring
        1582,// Deviling
        1388,// Arc Angeling
        1502;// Pori Pori
 
    // ---------
    // Group 4
    // ---------
    set .group4name$, ""; // Group 4 name
    set .group4itemid, 0; // item id use for summon any Group 4 monster
    set .group4itemamount, 0; // amount of items to summon a Group 4 monster
    set .group4cost, 0; // if no item is specify, Zeny cost to summon a Group 4 monster
    set .group4limit, 0; // limit of summon of Group 4 monster per session, prevent them only killing same monster again and again
    setarray .group4id,
        1001,
        1002;
 
    // ---------
    // Group 5
    // ---------
    set .group5name$, ""; // Group 5 name
    set .group5itemid, 0; // item id use for summon any Group 5 monster
    set .group5itemamount, 0; // amount of items to summon a Group 5 monster
    set .group5cost, 0; // if no item is specify, Zeny cost to summon a Group 5 monster
    set .group5limit, 0; // limit of summon of Group 5 monster per session, prevent them only killing same monster again and again
    setarray .group5id,
        1001,
        1002;
 
    // ---------
    // Group 6
    // ---------
    set .group6name$, ""; // Group 6 name
    set .group6itemid, 0; // item id use for summon any Group 6 monster
    set .group6itemamount, 0; // amount of items to summon a Group 6 monster
    set .group6cost, 0; // if no item is specify, Zeny cost to summon a Group 6 monster
    set .group6limit, 0; // limit of summon of Group 6 monster per session, prevent them only killing same monster again and again
    setarray .group6id,
        1001,
        1002;
 
    // ---------
    // Group 7
    // ---------
    set .group7name$, ""; // Group 7 name
    set .group7itemid, 0; // item id use for summon any Group 7 monster
    set .group7itemamount, 0; // amount of items to summon a Group 7 monster
    set .group7cost, 0; // if no item is specify, Zeny cost to summon a Group 7 monster
    set .group7limit, 0; // limit of summon of Group 7 monster per session, prevent them only killing same monster again and again
    setarray .group7id,
        1001,
        1002;
 
    // ---------
    // Group 8
    // ---------
    set .group8name$, ""; // Group 8 name
    set .group8itemid, 0; // item id use for summon any Group 8 monster
    set .group8itemamount, 0; // amount of items to summon a Group 8 monster
    set .group8cost, 0; // if no item is specify, Zeny cost to summon a Group 8 monster
    set .group8limit, 0; // limit of summon of Group 8 monster per session, prevent them only killing same monster again and again
    setarray .group8id,
        1001,
        1002;
 
    // ---------
    // Group 9
    // ---------
    set .group9name$, ""; // Group 9 name
    set .group9itemid, 0; // item id use for summon any Group 9 monster
    set .group9itemamount, 0; // amount of items to summon a Group 9 monster
    set .group9cost, 0; // if no item is specify, Zeny cost to summon a Group 9 monster
    set .group9limit, 0; // limit of summon of Group 9 monster per session, prevent them only killing same monster again and again
    setarray .group9id,
        1001,
        1002;
 
//  Config Ends ------------------------------------------------------------------------
 
        if ( .timeout == 0 ) set .timeout, 60;
        if ( .nobodygiveup == 0 ) set .nobodygiveup, 5;
        if ( .inputlimit < 1 ) set .inputlimit, 1;
 
        if ( .rentitemid && .rentitemamount ) {
            if ( getitemname(.rentitemid) == "null" ) {
                debugmes "Private MVP Room: Rent a room is using invalid item id.";
            }
        }
        set .@i, 1;
        while ( .@i <= 9 ) {
            if ( .@menu[.@i] && getd(".group"+ .@i +"itemid") && getd(".group"+ .@i +"itemamount") ) {
                if ( getitemname( getd(".group"+ .@i +"itemid") ) == "null" ) {
                    debugmes "Private MVP Room: Group no. "+ .@i +" is using invalid item id.";
                }
            }
            set .@i, .@i +1 ;
        }
        set .menu$, ( (.@menu[0])?"Heal":"" )+":"+( (.@menu[1])?"Summon "+ .group1name$:"" )+":"+( (.@menu[2])?"Summon "+ .group2name$:"" )+":"+( (.@menu[3])?"Summon "+ .group3name$:"" )+":"+( (.@menu[4])?"Summon "+ .group4name$:"" )+":"+( (.@menu[5])?"Summon "+ .group5name$:"" )+":"+( (.@menu[6])?"Summon "+ .group6name$:"" )+":"+( (.@menu[7])?"Summon "+ .group7name$:"" )+":"+( (.@menu[8])?"Summon "+ .group8name$:"" )+":"+( (.@menu[9])?"Summon "+ .group9name$:"" )+":"+( (.@menu[10])?"Buy branches":"" )+":Leave this room:Give up this room";
 
        set .@i, 1;
        while ( .@i <= 9 ) {
            setd ".group"+ .@i +"idsize", getarraysize( getd(".group"+ .@i +"id") );
            if ( .@menu[.@i] && getd(".group"+ .@i +"limit") <= 0 ) {
                set .@j, 0;
                while ( .@j < getd(".group"+ .@i +"idsize") ) {
                    setd ".group"+ .@i +"menu$", getd(".group"+ .@i +"menu$") + getmonsterinfo( getd(".group"+ .@i +"id["+ .@j +"]"), 0) +":";
                    set .@j, .@j +1 ;
                }
            }
            set .@i, .@i +1 ;
        }
    }
    else {
        setmapflag .@map$, mf_nowarpto;
        setmapflag .@map$, mf_noteleport;
        setmapflag .@map$, mf_nomemo;
        setmapflag .@map$, mf_nosave;
        setmapflag .@map$, mf_nopenalty;
    //  setmapflag .@map$, mf_nowarp;
    //  setmapflag .@map$, mf_noreturn;
    //  setmapflag .@map$, mf_nomobloot;
    //  setmapflag .@map$, mf_nomvploot;
    //  setmapflag .@map$, mf_monster_noteleport;
    //  setmapflag .@map$, mf_noicewall;
    //  setmapflag .@map$, mf_nobaseexp;
    //  setmapflag .@map$, mf_nojobexp;
    //  setmapflag .@map$, mf_novending;
        sleep 1;
        mapannounce .@map$, "Admin has refresh the server, please register the room again.", 1;
        mapwarp .@map$, .respawnmap$, .respawnx, .respawny;
    }
    end;
 
L_Start: // I hate gotos ... but ...
    set .@dif, strnpcinfo(2);
    if ( .remind[.@dif] == 0 ) {
        set .remind[.@dif], 1;
        initnpctimer;
    }
    mes "[MVP Summoner]";
    mes "Hi, what can I do for you ?";
    next;
    switch ( select(.menu$) ) {
        case 1:
            mes "[MVP Summoner]";
            if ( mobcount("this","") > 0 ) {
                mes "I cannot offer heal service when there are monsters around.";
                close;
            }
            sc_end SC_STONE;
            sc_end SC_SLOWDOWN;
            sc_end SC_FREEZE;
            sc_end SC_SLEEP;
            sc_end SC_CURSE;
            sc_end SC_SILENCE;
            sc_end SC_CONFUSION;
            sc_end SC_BLIND;
            sc_end SC_BLEEDING;
            sc_end SC_DECREASEAGI;
            sc_end SC_POISON;
            sc_end SC_HALLUCINATION;
            sc_end SC_STRIPWEAPON;
            sc_end SC_STRIPARMOR;
            sc_end SC_STRIPHELM;
            sc_end SC_STRIPSHIELD;
            sc_end SC_CHANGEUNDEAD;
            sc_end SC_ORCISH;
            sc_end SC_BERSERK;
            sc_end SC_SKE;
            sc_end SC_SWOO;
            sc_end SC_SKA;
            percentheal 100,100;
            specialeffect2 EF_HEAL;
            mes "You have completely healed.";
            close;
        default:
            set .@group, @menu -1;
            if ( .floodcontrol && mobcount("this","") > 0 ) {
                mes "[MVP Summoner]";
                mes "I cannot summon another monster when there are monsters around.";
                close;
            }
            else if ( getd(".group"+ .@group +"itemid") && getd(".group"+ .@group +"itemamount") ) {
                mes "[MVP Summoner]";
                mes "The cost to summon a "+ getd(".group"+ .@group +"name$") +" is "+ getd(".group"+ .@group +"itemamount") +" "+ getitemname( getd(".group"+ .@group +"itemid") ) +".";
                if ( getd(".group"+ .@group +"limit") < 0 )
                    mes "("+( ( ~getd(".group"+ .@group +"limit")+1 - getd(".group"+ .@group +"limit"+ .@dif) <= 0 )?0:( ~getd(".group"+ .@group +"limit")+1 - getd(".group"+ .@group +"limit"+ .@dif) ) )+") more summons for this group.";
                next;
            }
            else if ( getd(".group"+ .@group +"cost") ) {
                mes "[MVP Summoner]";
                mes "The cost to summon a "+ getd(".group"+ .@group +"name$") +" is "+ callfunc("int__", getd(".group"+ .@group +"cost") ) +" Zeny.";
                if ( getd(".group"+ .@group +"limit") < 0 )
                    mes "("+( ( ~getd(".group"+ .@group +"limit")+1 - getd(".group"+ .@group +"limit"+ .@dif) <= 0 )?0:( ~getd(".group"+ .@group +"limit")+1 - getd(".group"+ .@group +"limit"+ .@dif) ) )+") more summons for this group.";
                next;
            }
            else if ( getd(".group"+ .@group +"limit") < 0 ) {
                mes "[MVP Summoner]";
                mes "("+( ( ~getd(".group"+ .@group +"limit")+1 - getd(".group"+ .@group +"limit"+ .@dif) <= 0 )?0:( ~getd(".group"+ .@group +"limit")+1 - getd(".group"+ .@group +"limit"+ .@dif) ) )+") more summons for this group.";
                next;
            }
            if ( getd(".group"+ .@group +"limit") < 0 && getd(".group"+ .@group +"limit"+ .@dif) >= ~getd(".group"+ .@group +"limit")+1 ) {
                mes "[MVP Summoner]";
                mes "I'm sorry, but you can't summon any more monster for this group.";
                close;
            }
            else if ( getd(".group"+ .@group +"limit") > 0 ) {
                for ( set .@i, 0; .@i < getd(".group"+ .@group +"idsize"); set .@i, .@i +1 )
                    set .@menu$, .@menu$ +( ( getd(".group"+ .@group +"limit"+ .@dif +"["+ .@i +"]") >= getd(".group"+ .@group +"limit") )?"^999999":"^000000" )+ getmonsterinfo( getd(".group"+ .@group +"id["+ .@i +"]"), 0) +" ("+ ( ( getd(".group"+ .@group +"limit") - getd(".group"+ .@group +"limit"+ .@dif +"["+ .@i +"]") <= 0 )?0:( getd(".group"+ .@group +"limit") - getd(".group"+ .@group +"limit"+ .@dif +"["+ .@i +"]") ) ) +")"+":";
                set .@menu, select(.@menu$) -1;
            }
            else
                set .@menu, select( getd(".group"+ .@group +"menu$") ) -1;
            mes "[MVP Summoner]";
            if ( .floodcontrol == 0 && .inputlimit > 1 ) {
                mes "Input an amount of monsters to summon.";
                next;
                input .@amount;
                if ( .@amount == 0 ) close;
                else if ( .@amount > .inputlimit )
                    set .@amount, .inputlimit;
                mes "[MVP Summoner]";
            }
            else
                set .@amount, 1;
            if ( getd(".group"+ .@group +"itemid") && getd(".group"+ .@group +"itemamount") ) {
                if ( countitem( getd(".group"+ .@group +"itemid") ) < getd(".group"+ .@group +"itemamount") * .@amount ) {
                    mes "You don't have enough "+ getitemname( getd(".group"+ .@group +"itemid") ) +" to summon a "+ getd(".group"+ .@group +"name$") +".";
                    close;
                }
            }
            else if ( getd(".group"+ .@group +"cost") ) {
                if ( Zeny < getd(".group"+ .@group +"cost") * .@amount ) {
                    mes "You don't have enough Zeny to summon a "+ getd(".group"+ .@group +"name$") +".";
                    close;
                }
            }
            if ( .floodcontrol && mobcount("this","") > 0 ) {
                mes "I cannot summon another monster when there are monsters around.";
                close;
            }
            else if ( getd(".group"+ .@group +"limit") > 0 ) {
                if ( getd(".group"+ .@group +"limit"+ .@dif +"["+ .@menu +"]") >= getd(".group"+ .@group +"limit") ) {
                    mes "I'm sorry, but you already summoned that monster too much. Try summon another.";
                    close;
                }
                else if ( getd(".group"+ .@group +"limit"+ .@dif +"["+ .@menu +"]") + .@amount > getd(".group"+ .@group +"limit") ) {
                    mes "The amount you input is more than the limit you can summon. Try reduce the amount.";
                    close;
                }
            }
            else if ( getd(".group"+ .@group +"limit") < 0 ) {
                if ( getd(".group"+ .@group +"limit"+ .@dif) >= ~getd(".group"+ .@group +"limit")+1 ) {
                    mes "I'm sorry, but you can't summon any more monster for this group.";
                    close;
                }
                else if ( getd(".group"+ .@group +"limit"+ .@dif) + .@amount > ~getd(".group"+ .@group +"limit")+1 ) {
                    mes "The amount you input is more than the limit you can summon. Try reduce the amount.";
                    close;
                }
            }
            mes "Summoning "+ .@amount +" "+ getmonsterinfo( getd(".group"+ .@group +"id["+ .@menu +"]"), 0) +".";
            mes "Ok, get ready ?";
            close2;
            if ( .floodcontrol && mobcount("this","") > 0 ) end;
            if ( getd(".group"+ .@group +"itemid") && getd(".group"+ .@group +"itemamount") ) {
                if ( countitem( getd(".group"+ .@group +"itemid") ) < getd(".group"+ .@group +"itemamount") * .@amount ) end;
                delitem getd(".group"+ .@group +"itemid"), getd(".group"+ .@group +"itemamount") * .@amount;
            }
            else if ( getd(".group"+ .@group +"cost") ) {
                if ( Zeny < getd(".group"+ .@group +"cost") * .@amount ) end;
                set Zeny, Zeny - getd(".group"+ .@group +"cost") * .@amount;
            }
            if ( getd(".group"+ .@group +"limit") > 0 ) {
                if ( getd(".group"+ .@group +"limit"+ .@dif +"["+ .@menu +"]") + .@amount > getd(".group"+ .@group +"limit") ) end;
                setd ".group"+ .@group +"limit"+ .@dif +"["+ .@menu +"]", getd(".group"+ .@group +"limit"+ .@dif +"["+ .@menu +"]") + .@amount;
            }
            else if ( getd(".group"+ .@group +"limit") < 0 ) {
                if ( getd(".group"+ .@group +"limit"+ .@dif) + .@amount > ~getd(".group"+ .@group +"limit")+1 ) end;
                setd ".group"+ .@group +"limit"+ .@dif, getd(".group"+ .@group +"limit"+ .@dif) + .@amount;
            }
            monster "this", 0, 0, "--ja--", getd(".group"+ .@group +"id["+ .@menu +"]"), .@amount;
            end;
        case 11:
            if ( mobcount("this","") > 0 ) {
                mes "[MVP Summoner]";
                mes "I cannot offer this service when there are monsters around.";
                close;
            }
            close2;
            callshop "MVP room#branch", 0;
            end;
        case 12:
            mes "[MVP Summoner]";
            mes "Are you sure you want to leave this room ?";
            mes "If this room left empty for more than "+ .nobodygiveup +" minutes, you lost ownership for this room.";
            if ( select( "Yes:No") == 2 ) close;
            warp .respawnmap$, .respawnx, .respawny;
            end;
        case 13:
            mes "[MVP Summoner]";
            getmapxy .@map$, .@x, .@y, 0;
            if ( getmapusers(.@map$) > 1 ) {
                mes "There are still some players in this room. Make sure you are the last member in this room to use this option.";
                close;
            }
            mes "Are you sure you want to give up this room ?";
            if ( .rentcost )
                mes "You will need to pay again to enter this room.";
            next;
            if ( select( "Yes:No" ) == 2 ) close;
            warp .respawnmap$, .respawnx, .respawny;
            set .remaintime[.@dif], -1;
            end;
    }
    close;
 
OnEnterMap:
    set .@dif, strnpcinfo(2);
    set .remind[.@dif], 0;
    for ( set .@i, 1; .@i <= 9; set .@i, .@i +1 )
        deletearray getd(".group"+ .@i +"limit"+ .@dif), getd(".group"+ .@i +"idsize");
    set .nobodycounter[.@dif], 0;
    getmapxy .@map$, .@x, .@y ,1;
    set .starttime[.@dif], gettimetick(2);
    do {
        set .remaintime[.@dif], .timeout * 60 + .starttime[.@dif] - gettimetick(2);
        set .@hour[.@dif], .remaintime[.@dif] / 3600 ;
        set .@min[.@dif], .remaintime[.@dif] % 3600 / 60 ;
        set .@sec[.@dif], .remaintime[.@dif] % 3600 % 60 ;
        delwaitingroom strnpcinfo(0);
        waitingroom "Time Left = "+( ( .@hour[.@dif] )?( .@hour[.@dif] +":"):"" )+( ( .@min[.@dif] < 10 )?"0"+ .@min[.@dif]: .@min[.@dif] )+":"+( ( .@sec[.@dif] < 10 )?"0"+ .@sec[.@dif]: .@sec[.@dif] ), 0;
        if ( getmapusers(.@map$) )
            set .nobodycounter[.@dif], 0;
        else {
            set .nobodycounter[.@dif], .nobodycounter[.@dif] +1 ;
            if ( .nobodycounter[.@dif] > .nobodygiveup * 60 ) break;
        }
        sleep 995;
    } while ( .remaintime[.@dif] > 1 );
    set .remaintime[.@dif], 0;
    delwaitingroom "MVP Summoner#"+ .@dif;
    mapwarp .@map$, .respawnmap$, .respawnx, .respawny;
    end;
 
OnTimer100:
    stopnpctimer;
    npctalk "Hi ~ the bubble above my head is the countdown for using this room.";
    sleep 2000;
    npctalk "Sometimes, I can skip for about 1 second in the countdown.";
    sleep 3000;
    npctalk "That is because the server is experiencing minor lag problem.";
    sleep 3000;
    npctalk "So, don't complain about me cheated for the countdown ~ ^.^";
    sleep 3000;
    npctalk "Have a nice day ~";
    end;
}
 
prontera,148,174,5  script  Private MVP Room    100,{
    mes "[Private MVP Room]";
    mes "Please select a private MVP room.";
    if ( getvariableofnpc(.rentitemid, "MVP Summoner") && getvariableofnpc(.rentitemamount, "MVP Summoner") )
        mes "The cost to rent a room for "+ getvariableofnpc(.timeout, "MVP Summoner") +" minutes is "+ getvariableofnpc(.rentitemamount, "MVP Summoner") +" "+ getitemname( getvariableofnpc(.rentitemid, "MVP Summoner") ) +".";
    else if ( getvariableofnpc(.rentcost, "MVP Summoner") )
        mes "The cost to rent a room for "+ getvariableofnpc(.timeout, "MVP Summoner") +" minutes is "+ callfunc("int__", getvariableofnpc(.rentcost, "MVP Summoner") ) +" Zeny.";
    else
        mes "You can only use the room for only "+ getvariableofnpc(.timeout, "MVP Summoner") +" minutes.";
    mes " ";
    for ( set .@i, 1; .@i <= 8; set .@i, .@i +1 ) {
        if ( getvariableofnpc(.remaintime[.@i],"MVP Summoner") ) {
            switch ( .type[.@i] ) {
                case 1: set .@color$, "^EE8800"; break;
                case 2: set .@color$, "^70CC11"; break;
                case 3: set .@color$, "^0000FF"; break;
                default: set .@color$, "^000000";
            }
            mes "Room #"+ .@i +" = "+ .@color$ + .whoinuse$[.@i] +"^000000";
        }
    }
    next;
    set .@room, select(
        "MVP Room 1 "+( getvariableofnpc( .remaintime[1], "MVP Summoner" )? "["+ getmapusers("06guild_01") +"]" : "- ^009900Available^000000" ),
        "MVP Room 2 "+( getvariableofnpc( .remaintime[2], "MVP Summoner" )? "["+ getmapusers("06guild_02") +"]" : "- ^009900Available^000000" ),
        "MVP Room 3 "+( getvariableofnpc( .remaintime[3], "MVP Summoner" )? "["+ getmapusers("06guild_03") +"]" : "- ^009900Available^000000" ),
        "MVP Room 4 "+( getvariableofnpc( .remaintime[4], "MVP Summoner" )? "["+ getmapusers("06guild_04") +"]" : "- ^009900Available^000000" ),
        "MVP Room 5 "+( getvariableofnpc( .remaintime[5], "MVP Summoner" )? "["+ getmapusers("06guild_05") +"]" : "- ^009900Available^000000" ),
        "MVP Room 6 "+( getvariableofnpc( .remaintime[6], "MVP Summoner" )? "["+ getmapusers("06guild_06") +"]" : "- ^009900Available^000000" ),
        "MVP Room 7 "+( getvariableofnpc( .remaintime[7], "MVP Summoner" )? "["+ getmapusers("06guild_07") +"]" : "- ^009900Available^000000" ),
        "MVP Room 8 "+( getvariableofnpc( .remaintime[8], "MVP Summoner" )? "["+ getmapusers("06guild_08") +"]" : "- ^009900Available^000000" ));
    if ( getvariableofnpc(.remaintime[.@room],"MVP Summoner") ) {
        if ( .inuseid[.@room] == getcharid(.type[.@room]) ) {
            if ( getvariableofnpc(.killmonster,"MVP Summoner") && getmapusers("06guild_0"+ .@room) == 0 )
                killmonsterall "06guild_0"+ .@room;
            warp "06guild_0"+ .@room, 0,0;
            end;
        } else {
            mes "[Private MVP Room]";
            switch ( .type[.@room] ) {
                case 1: set .@color$, "^EE8800Party "; break;
                case 2: set .@color$, "^70CC11Guild "; break;
                case 3: set .@color$, "^0000FFPlayer ";
            }
            mes "This room is reserved for ";
            mes .@color$ + .whoinuse$[.@room] +"^000000 .";
            if ( getgmlevel() < getvariableofnpc(.gmlvlkick,"MVP Summoner") ) {
                mes "Please select another.";
                close;
            }
            mes " ";
            mes "Currently there are "+ getmapusers("06guild_0"+ .@room) +" players";
            mes "in that room.";
            set .@remaintime, getvariableofnpc(.remaintime[.@room],"MVP Summoner");
            mes "It still has "+( .@remaintime /60 )+"mn "+( .@remaintime %60 )+"s left.";
            set .@nobodycounter, getvariableofnpc(.nobodycounter[.@room],"MVP Summoner");
            if ( .@nobodycounter )
                mes "And have left empty for "+( .@nobodycounter /60 )+"mn "+( .@nobodycounter %60 )+"s.";
            mes "Kick them ?";
            next;
            if ( select ( "No:Yes" ) == 1 ) close;
            set getvariableofnpc(.remaintime[.@room],"MVP Summoner"), -1;
            mes "[Private MVP Room]";
            mes "Room#"+ .@room +" is empty now.";
            close;
        }
    }
    mes "[Private MVP Room]";
    if ( getvariableofnpc(.rentitemid, "MVP Summoner") && getvariableofnpc(.rentitemamount, "MVP Summoner") ) {
        if ( countitem(getvariableofnpc(.rentitemid, "MVP Summoner")) < getvariableofnpc(.rentitemamount, "MVP Summoner") ) {
            mes "You don't have enough "+ getitemname( getvariableofnpc(.rentitemid, "MVP Summoner") ) +" to rent a room.";
            close;
        }
    }
    else if ( getvariableofnpc(.rentcost, "MVP Summoner") ) {
        if ( Zeny < getvariableofnpc(.rentcost, "MVP Summoner") ) {
            mes "You don't have enough Zeny to rent a room.";
            close;
        }
    }
    mes "You reserve this room for ...";
    next;
    set .@type, select("For my party members", "For my guild members", "For personal account use" );
    if ( getcharid(.@type) == 0 ) {
        mes "[Private MVP Room]";
        mes "You do not own a "+( (.@type == 1)?"Party":"Guild" )+".";
        close;
    }
    else if ( getvariableofnpc(.rentitemid, "MVP Summoner") && getvariableofnpc(.rentitemamount, "MVP Summoner") ) {
        if ( countitem(getvariableofnpc(.rentitemid, "MVP Summoner")) < getvariableofnpc(.rentitemamount, "MVP Summoner") ) {
            mes "You don't have enough "+ getitemname( getvariableofnpc(.rentitemid, "MVP Summoner") ) +" to rent a room.";
            close;
        }
    }
    else if ( getvariableofnpc(.remaintime[.@room],"MVP Summoner") ) {
        mes "[Private MVP Room]";
        mes "I'm sorry, somebody else has already register this room faster than you.";
        close;
    }
    for ( set .@i, 1; .@i <= 8; set .@i, .@i +1 ) {
        if ( getvariableofnpc(.remaintime[.@i],"MVP Summoner") && .@type == .type[.@i] && getcharid(.@type) == .inuseid[.@i] ) {
            mes "[Private MVP Room]";
            mes "You already rented Room#"+ .@i +". Use that room instead.";
            close;
        }
    }
    set .type[.@room], .@type;
    set .inuseid[.@room], getcharid(.@type);
    set .whoinuse$[.@room], strcharinfo( (.@type == 3)?0:.@type );
    if ( getvariableofnpc(.rentitemid, "MVP Summoner") && getvariableofnpc(.rentitemamount, "MVP Summoner") ) {
        if ( countitem(getvariableofnpc(.rentitemid, "MVP Summoner")) < getvariableofnpc(.rentitemamount, "MVP Summoner") ) end;
        delitem getvariableofnpc(.rentitemid, "MVP Summoner"), getvariableofnpc(.rentitemamount, "MVP Summoner");
    }
    else if ( getvariableofnpc(.rentcost, "MVP Summoner") ) {
        if ( Zeny < getvariableofnpc(.rentcost, "MVP Summoner") ) end;
        set Zeny, Zeny - getvariableofnpc(.rentcost, "MVP Summoner");
    }
    warp "06guild_0"+ .@room, 0,0;
    killmonsterall "06guild_0"+ .@room;
    donpcevent "MVP Summoner#"+ .@room +"::OnEnterMap";
    end;
}
 
06guild_01,49,49,4  duplicate(MVP Summoner) MVP Summoner#1  116
06guild_02,49,49,4  duplicate(MVP Summoner) MVP Summoner#2  116
06guild_03,49,49,4  duplicate(MVP Summoner) MVP Summoner#3  116
06guild_04,49,49,4  duplicate(MVP Summoner) MVP Summoner#4  116
06guild_05,49,49,4  duplicate(MVP Summoner) MVP Summoner#5  116
06guild_06,49,49,4  duplicate(MVP Summoner) MVP Summoner#6  116
06guild_07,49,49,4  duplicate(MVP Summoner) MVP Summoner#7  116
06guild_08,49,49,4  duplicate(MVP Summoner) MVP Summoner#8  116
Viewed 1854 times, submitted by AnnieRuru.