viewing paste alexxdls - Poring War | 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 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300
//===== eAthena Script =======================================
//= Poring War (War of Porings)
//===== By: ==================================================
//= alexx
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
//= eAthena SVN
//===== Description: =========================================
//= Custom version of official iRO Poring War.
//= ^_^ Enjoy!!
//===== Additional Comments: =================================
//= 1.0   First public release. [alexx]
//= 1.0.1 Several bugfixes and typo edits. [alexx]
//= 1.1   Added saving of items marcked as WoP Trophy. [alexx]
//= 1.2   Added experemental saving at waiting stairs during
//=       the battle. [alexx]
//===== Todo List: ===========================================
//= * Add more official dialogues and announces
//= * Add official skills and items restrictions
//= * Make gameplay closer to official
//= * Test, optimize and bugfix
//============================================================
 
//- General Script Cofiguration
//============================================================
 
-   script  WoP_Config  -1,{
    end;
 
OnInit:
    set $WoP_Level,50;          // Min Base Lv required to enter Poring realm
                        // Officialy unset
 
    set $WoP_Donation,500;          // Zeny ammount required to enter Poring realm
                        // Officialy '500'z
 
    set $WoP_Players,1;         // Amount of players required for each side,
                        // Officialy '5'
 
    set $WoP_Reward,7539;           // Reward item ID
                        // Officialy '7539' Poring Coin
 
    set $WoP_Winner_Reward_Ammount,6;   // Prise ammount for team-winner
                        // Officialy '3'
 
    set $WoP_Looser_Reward_Ammount,1;   // Prise ammount for team-looser
                        // Officialy '0'
 
    set $WoP_Draw_Reward_Ammount,3;     // Prise ammount if result is draw
                        // Officialy '1'
 
    set $WoP_AngDev_Amount,2;       // How many Angelings/Develings has each team
                        // Officialy '2'
 
    set $WoP_Trophy,7773;           // Item geting from killed player
                        // Officialy '7773' War Badge
 
    set $WoP_Angeling_MobID,1766;       // Mob ID of Angeling to spawn
                        // Officialy ??? (unknown)
 
    set $WoP_Deviling_MobID,1767;       // Mob ID of Deviling to spawn
                        // Officialy ??? (unknown)
 
    set $WoP_Rounded,1;         // Play (1) or don't play (0) with rounds
                        // Officialy ??? (unknown)
 
    end;
}
 
//- Poring War Recrutier
//============================================================
 
prt_fild08,159,371,5    script  Poring War Recruitier   909,{
    if ($WoP_Level && BaseLevel < $WoP_Level) {
        mes "[Poring]";
        mes "Go level up first. You can't help me at this time.";
        emotion e_sob;
        close;
    }
    if (!WoP_Recruted) {
        mes "[Poring]";
        mes "There's big trouble in the world of the little Porings... Can you help us?";
        next;
        if (select("What is going on?:It doesn't matter.") == 2) {
            mes "[Poring]";
            mes "If you change your mind please come and help us...";
            emotion e_sob;
            close;
        }
        mes "[Poring]";
        mes "The war between ^F06EAAAngeling^000000 and ^42B4FFDeveling^000000 come to a new level. I am here to recruit more people. Would you agree to help us?";
        next;
        if (select("Yes, I agree to help you.:I don't care!") == 2) {
            mes "[Poring]";
            mes "Nobody care about as. What we shall do now?.. *crying*";
            emotion e_sob;
            close;
        }
        mes "[Poring]";
        mes "I leed you to our realm, where you need to team up with other players in a party of five and then choose which side you will fight for.";
        set WoP_Recruted,1;
        next;
    }
    mes "[Poring]";
    mes "But... life as a Poring is quite hard these days. Before I leed you please make a little donation of ^8DC63F"+$WoP_Donation+"z^000000. It is small amount but I need it very much.";
    next;
    if (select("Please take theese money.:Foget about it!") == 2) {
        mes "[Poring]";
        mes "Oh poore poore little porings. What we shall do now?.. *crying*";
        emotion e_sob;
        close;
    }
    if (Zeny < $WoP_Donation) {
        mes "[Poring]";
        mes "You don't have ^8DC63F"+$WoP_Donation+"z^000000.";
        emotion e_sob;
        close;
    }
    mes "[Poring]";
    mes "Thank you. Now you will be taken to the recruiting room. Are you ready to go?";
    emotion e_thx;
    next;
    if (select("Yes, I am ready!:No, I need more time.") == 2) {
        mes "[Poring]";
        mes "Please come back as soon as posible. We need help such brave warrior as you!";
        close;
    }
    mes "[Poring]";
    mes "Good luck. I belive you will win!";
    set Zeny,Zeny-$WoP_Donation;
    close2;
    warp "poring_w01",98,103;
    end;
}
 
//- Waiting Room Portal
//============================================================
 
poring_w01,111,135,0    script  WoP_warp_out    45,1,1,{
    end;
 
OnTouch:
    warp getsavepoint(0), getsavepoint(1), getsavepoint(2);
    end;
}
 
//- Waiting Devi - Battle Guide
//============================================================
 
poring_w01,96,99,3  script  Devi#WoP_waiting    738,{
    mes "[Devi]";
    mes "Greetings human!~";
    mes "Did you come to get envolved in the greate battle between";
    mes "^F06EAAAngeling^000000 and ^42B4FFDeveling^000000?";
    mes "...Good~ very good!~";
    next;
    mes "[Devi]";
    mes "If you wish mortal, I will explain you some Poring War issues. Would you like to learn about them?";
    next;
    switch (select("Please, tell about registration.:Explane common battle rules.:I want to know about rewards.:I don't care anything...")) {
        case 1:
            mes "[Devi]";
            mes "Listen carefuly human... I don't like to repeate twice!";
            next;
            mes "[Devi]";
            mes "At fist you need to enter the waiting room not far from me and wait it will be fulled with ^DD3636"+($WoP_Players*2)+"^000000 to pass first registration step.";
            mes "Next you should join with your friends on of two waiting rooms... Left room is for ^F06EAAAngeling team^000000 recruiting, right ~ for ^42B4FFDeveling^000000 one.";
            next;
            mes "[Devi]";
            mes "When all the rooms will be full each team will be warped to the separated preparing spots.";
            mes "Here you have only 1 munute to register your party with ^007CCCMr.Doppel^000000. Then all the members should confirm their party with ^007CCCMr.Doppel^000000. If you late you will be warped out there!";
            next;
            mes "[Devi]";
            mes "I advise to orginize party before entering recruiting room.";
            mes "After all the players confermed their parties ^DD3636PvP mode^000000 will be enabled and both teams will be warped to their start spots.";
            close;
        case 2:
            mes "[Devi]";
            mes "Listen carefuly human... I don't like to repeate twice!";
            next;
            mes "[Devi]";
            mes "From the moment both teams are warped to their start spots your only one goal is fighting against opposite team and kill their "+$WoP_AngDev_Amount+" ^F06EAAAngelings^000000 or ^42B4FFDevelings^000000.";
            next;
            mes "[Devi]";
            mes "Kiling an enemies you will obtain War Badges signed with names of opposite team characters.";
            mes "Insert gained Bages into free slots of opposite team ^A1A1A1Gate Keeper^000000 to unlock way to location of ^F06EAAAngeling^000000 or ^42B4FFDeveling^000000.";
            next;
            mes "[Devi]";
            mes "If you die during the battle you will be taken to the waiting stairs (right for ^42B4FFDeveling^000000 team, left for ^F06EAAAngeling^000000 team).";
            mes "You are able to restore ^8DC63FHP^000000 and ^007CCCSP^000000 cliking the ^00C000Fontane of Life^000000 locating right behind the stairs.";
            next;
            if ($WoP_Rounded) {
                mes "[Devi]";
                mes "The battle lasts "+$WoP_AngDev_Amount+" rounds. Your team has to terminate 1 ^F06EAAAngeling^000000/^42B4FFDeveling^000000 per round.";
                mes "Once it will be killed both teams will be sent to the stairs for preparing for the next round. 30 seconds is given to continue the battle.";
                next;
            }
            mes "[Devi]";
            mes "Team killed more ^F06EAAAngelings^000000/^42B4FFDevelings^000000 than an opposite team will win the battle as soon as 20 minutes passed.";
            mes "Team killed all the "+$WoP_AngDev_Amount+" ^F06EAAAngelings^000000/^42B4FFDevelings^000000 will instantly win the battle.";
            mes "If time ran over and both teams have the same score the battle will have a draw result.";
            next;
            mes "[Devi]";
            mes "When the battle will over all the players will be warped to Devi for rewarding. 1 minute will be given to recive a reward.";
            mes "All the playes who did not get in time will be warped out of Poring Realm with out any reward. So don't waste you time!";
            close;
        case 3:
            mes "[Devi]";
            mes "Listen carefuly human... I don't like to repeate twice!";
            next;
            mes "[Devi]";
            mes "The main reward is "+getitemname($WoP_Reward)+".";
            mes "Winners get";
            mes $WoP_Winner_Reward_Ammount+" "+getitemname($WoP_Reward)+".";
            if ($WoP_Looser_Reward_Ammount) {
                mes "Loosers get";
                mes $WoP_Looser_Reward_Ammount+" "+getitemname($WoP_Reward)+".";
            }
            mes "If teams scored tied everybody get";
            mes $WoP_Draw_Reward_Ammount+" "+getitemname($WoP_Reward)+".";
            mes "You should talk to me at the central room to recive ones when the battle will be over.";
            next;
            mes "[Devi]";
            mes "All the receved "+getitemname($WoP_Reward)+"s can be traded at ^8DC63FPoring Vending Machine^000000.";
            mes "Selling items are very-very intresting!";
            close;
        default:
            mes "[Devi]";
            mes "Human! Don't play with me or you will die!!";
            mes "";
            mes "Ha-ha-ha!~ I'm just joking... Don't be sacare.";
            close;
    }
}
 
//- Waiting Porings
//============================================================
 
poring_w01,79,102,5 script  #Poring_WoP_waiting_1   1002,{
    end;
}
 
poring_w01,79,102,0 script  Poring#WoP_waiting_1    111,3,3,{
    end;
}
 
poring_w01,80,107,5 duplicate(#Poring_WoP_waiting_1)    #Poring_WoP_waiting_2   1002
poring_w01,84,108,5 duplicate(#Poring_WoP_waiting_1)    #Poring_WoP_waiting_3   1002
poring_w01,84,112,5 duplicate(#Poring_WoP_waiting_1)    #Poring_WoP_waiting_4   1002
poring_w01,88,112,5 duplicate(#Poring_WoP_waiting_1)    #Poring_WoP_waiting_5   1002
poring_w01,80,107,0 duplicate(Poring#WoP_waiting_1) Poring#WoP_waiting_2    111,3,3
poring_w01,84,108,0 duplicate(Poring#WoP_waiting_1) Poring#WoP_waiting_3    111,3,3
poring_w01,84,112,0 duplicate(Poring#WoP_waiting_1) Poring#WoP_waiting_4    111,3,3
poring_w01,88,112,0 duplicate(Poring#WoP_waiting_1) Poring#WoP_waiting_5    111,3,3
 
//- Waiting Marins
//============================================================
 
poring_w01,114,112,3    script  #Marin_WoP_waiting_1    1242,{
    end;
}
 
poring_w01,114,112,0    script  Marin#WoP_waiting_1 111,3,3,{
    end;
}
 
poring_w01,117,111,3    duplicate(#Marin_WoP_waiting_1) #Marin_WoP_waiting_2    1242
poring_w01,117,108,3    duplicate(#Marin_WoP_waiting_1) #Marin_WoP_waiting_3    1242
poring_w01,122,108,3    duplicate(#Marin_WoP_waiting_1) #Marin_WoP_waiting_4    1242
poring_w01,121,105,3    duplicate(#Marin_WoP_waiting_1) #Marin_WoP_waiting_5    1242
poring_w01,117,111,0    duplicate(Marin#WoP_waiting_1)  Marin#WoP_waiting_2 111,3,3
poring_w01,117,108,0    duplicate(Marin#WoP_waiting_1)  Marin#WoP_waiting_3 111,3,3
poring_w01,122,108,0    duplicate(Marin#WoP_waiting_1)  Marin#WoP_waiting_4 111,3,3
poring_w01,121,105,0    duplicate(Marin#WoP_waiting_1)  Marin#WoP_waiting_5 111,3,3
 
//- Player Logout Control
//============================================================
 
-   script  WoP_Logout  -1,{
    end;
 
OnPCLogoutEvent:
    if (OnWoP) {
        if (!$WoP_Rewarding) {
            if (WoP_Team == 1) {
                set $Angeling_Team_Players,$Angeling_Team_Players-1;
            }
            if (WoP_Team == 2) {
                set $Deviling_Team_Players,$Deviling_Team_Players-1;
            }
            donpcevent "WoP_Logout::OnWarning";
        }
        set WoP_Team,0;
        set OnWoP,0;
        set WoP_Party_Confirmed,0;
        if (countitem($WoP_Trophy)) {
            delitem $WoP_Trophy,countitem($WoP_Trophy);
        }
        if (WoP_Deleted_Trophy) {
            getitem $WoP_Trophy,WoP_Deleted_Trophy;
            set WoP_Deleted_Trophy,0;
        }
        savepoint WoP_Savepoint_Memo$,WoP_Savepoint_Memo_X,WoP_Savepoint_Memo_Y;
        if (!getmapusers("poring_w02")) {
            donpcevent "WoP_Common::OnReset";
        }
    }
    end;
 
OnWarning:
    if ($Angeling_Team_Players < $WoP_Players-1 || $Deviling_Team_Players < $WoP_Players-1) {
        for (set .i,0; .i<$WoP_Players; set .i,.i+1) {
            if (!isloggedin($wop_ang[.i],$wop_ang2[.i])) {
                deletearray $wop_ang[.i],1;
                set $WoP_AngelingPlayersAway,$WoP_AngelingPlayersAway+1;
            }
            if (!isloggedin($wop_dev[.i],$wop_dev2[.i])) {
                deletearray $wop_dev[.i],1;
                set $WoP_DevilingPlayersAway,$WoP_DevilingPlayersAway+1;
            }
        }
        if ($WoP_Players-$WoP_AngelingPlayersAway) {
            for (set .i,0; .i<$WoP_Players-$WoP_AngelingPlayersAway; set .i,.i+1) {
                attachrid($wop_ang[.i]);
                set OnWoP,0;
                set WoP_Team,0;
                set WoP_Party_Confirmed,0;
                if (countitem($WoP_Trophy)) {
                    delitem $WoP_Trophy,countitem($WoP_Trophy);
                }
                if (WoP_Deleted_Trophy) {
                    getitem $WoP_Trophy,WoP_Deleted_Trophy;
                    set WoP_Deleted_Trophy,0;
                }
                savepoint WoP_Savepoint_Memo$,WoP_Savepoint_Memo_X,WoP_Savepoint_Memo_Y;
            }
        }
        if ($WoP_Players-$WoP_DevilingPlayersAway) {
            for (set .i,0; .i<$WoP_Players-$WoP_DevilingPlayersAway; set .i,.i+1) {
                attachrid($wop_dev[.i]);
                set OnWoP,0;
                set WoP_Team,0;
                set WoP_Party_Confirmed,0;
                if (countitem($WoP_Trophy)) {
                    delitem $WoP_Trophy,countitem($WoP_Trophy);
                }
                if (WoP_Deleted_Trophy) {
                    getitem $WoP_Trophy,WoP_Deleted_Trophy;
                    set WoP_Deleted_Trophy,0;
                }
                savepoint WoP_Savepoint_Memo$,WoP_Savepoint_Memo_X,WoP_Savepoint_Memo_Y;
            }
        }
        donpcevent "WoP_Common::OnReset";
        mapwarp "poring_w02","pay_fild04",255,193;
        end;
    }
    else {
        if (WoP_Team == 1) {
            mapannounce "poring_w02","Mr.Doppel : One of Angeling teammates has been disconnected. If it be repeated again this battle will be over.",bc_map,0xFF0000;
        }
        if (WoP_Team == 2) {
            mapannounce "poring_w02","Mr.Doppel : One of Deviling teammates has been disconnected. If it be repeated again this battle will be over.",bc_map,0xFF0000;
        }
    }
    end;
 
OnPCLoginEvent:
    if (OnWoP) {
        set WoP_Team,0;
        set OnWoP,0;
        set WoP_Party_Confirmed,0;
        if (countitem($WoP_Trophy)) {
            delitem $WoP_Trophy,countitem($WoP_Trophy);
        }
        if (WoP_Deleted_Trophy) {
            getitem $WoP_Trophy,WoP_Deleted_Trophy;
            set WoP_Deleted_Trophy,0;
        }
        savepoint WoP_Savepoint_Memo$,WoP_Savepoint_Memo_X,WoP_Savepoint_Memo_Y;
    }
    end;
 
}
 
//- Common Reset
//============================================================
 
-   script  WoP_Common  -1,{
    end;
 
OnReset:
    set $WoP_Started,0;
    set $WoP_Rewarding,0;
    set $WoP_Team_Winner,0;
    set $Angeling_Team_Ready,0;
    set $Deviling_Team_Ready,0;
    set $Angeling_Team_Players,0;
    set $Deviling_Team_Players,0;
    set $Ang_Party,0;
    set $Dev_Party,0;
    set $Ang_Party_Confirmed,0;
    set $Dev_Party_Confirmed,0;
    set $Angelings_Amount,0;
    set $Devilings_Amount,0;
    donpcevent "WoP_RegClear::OnInit";
    donpcevent "WoP_Battle::OnGate1Close";
    donpcevent "WoP_Battle::OnGate2Close";
    donpcevent "Poring#WoP_Reg::OnSart";
    end;
}
 
//- Registration - Init
//============================================================
 
-   script  WoP_RegClear    -1,{
    end;
 
OnInit:
    deletearray $wop_ang[0];
    deletearray $wop_dev[0];
    deletearray $wop_ang2[0];
    deletearray $wop_dev2[0];
    end;
}
 
//- Registration - 1st Stage NPC
//============================================================
 
poring_w01,91,99,3  script  Poring#WoP_Reg  909,{
    end;
 
OnStart:
    sleep 2000;
    waitingroom "Recruiting "+($WoP_Players*2)+" Members of Battle Participants",($WoP_Players*2),"Poring#WoP_Reg::OnReady";
    end;
 
OnReady:
    sleep 5000;
    warpwaitingpc "poring_w01",101,68;
    donpcevent "Poring#WoP_Reg::OnClose";
    sleep 1000;
    donpcevent "Poring#WoP_Reg_Ang::OnPrepare";
    donpcevent "Marin#WoP_Reg_Dev::OnPrepare";
    sleep 300000;
    areawarp "poring_w01",91,74,112,63,"poring_w01",100,100;
    end;
 
OnClose:
    delwaitingroom;
    end;
 
}
 
//- Registration - 2nd Stage NPC's
//============================================================
 
poring_w01,91,68,5  script  Poring#WoP_Reg_Ang  909,{
    end;
 
OnPrepare:
    sleep 2000;
    waitingroom "Angeling Team Recruiter",$WoP_Players,"WoP_Join::OnAngTeamJoin";
    end;
 
OnWarp:
    warpwaitingpc "poring_w02",25,175;
    copyarray $wop_ang[0],$@warpwaitingpc[0],$WoP_Players;
    for(set .i,0; .i<$WoP_Players; set .i,.i+1) {
        set $wop_ang2[.i],getcharid(0,rid2name($wop_ang[.i]));
        attachrid($wop_ang[.i]);
        set OnWoP,1;
        set WoP_Team,1;
        if (countitem($WoP_Trophy)) {
            delitem $WoP_Trophy,countitem($WoP_Trophy);
            set WoP_Deleted_Trophy,countitem($WoP_Trophy);
        }
        set WoP_Savepoint_Memo$,getsavepoint(0);
        set WoP_Savepoint_Memo_X,getsavepoint(1);
        set WoP_Savepoint_Memo_Y,getsavepoint(2);
        set $Angeling_Team_Players,$Angeling_Team_Players+1;
        detachrid;
    }
    delwaitingroom;
    donpcevent "Marin#WoP_Reg_Dev::OnWarp";
    end;
}
 
poring_w01,112,68,3 script  Marin#WoP_Reg_Dev   1242,{
    end;
 
OnPrepare:
    sleep 2000;
    waitingroom "Deviling Team Recruiter",$WoP_Players,"WoP_Join::OnDevTeamJoin";
    end;
 
OnWarp:
    warpwaitingpc "poring_w02",170,175;
    copyarray $wop_dev[0],$@warpwaitingpc[0],$WoP_Players;
    for(set .i,0; .i<$WoP_Players; set .i,.i+1) {
        set $wop_dev2[.i],getcharid(0,rid2name($wop_dev[.i]));
        attachrid($wop_dev[.i]);
        set OnWoP,1;
        set WoP_Team,2;
        set $Develing_Team_Players,$Develing_Team_Players+1;
        detachrid;
    }
    delwaitingroom;
    areawarp "poring_w01",91,74,112,63,"poring_w01",100,100;
    donpcevent "WoP_PartyReg::OnPrepare";
    end;
}
 
//- Registration - 3rd Stage NPC's
//============================================================
 
poring_w02,26,181,3 script  Mr.Doppel#Ang   739,{
    set @Ang_team_word$,"F06EAAAngeling";
    set @Dev_team_word$,"42B4FFDeviling";
    if (!getd("$"+strnpcinfo(2)+"_Party")) {
        if (!getcharid(1)) {
            mes "[Mr.Doppel]";
            mes "Sorry, human. But you must be in a party if you want to register.";
            mes "Orginize one and try again.";
            close;
        }
        if (getcharid(0) != getpartyleader(getcharid(1),2)) {
            mes "[Mr.Doppel]";
            mes "I can't do anything for you, human... Only the party leader can register.";
            close;
        }
//      if ($WoP_Players != getpartymember(getcharid(1))) {
//          mes "[Mr.Doppel]";
//          mes "Your party is too small or too large. You should organize Party of "+$WoP_Players+" members.";
//          close;
//      }
        mes "[Mr.Doppel]";
        mes "Hello, human... I can see you are the leader of";
        mes "^0072BC"+getpartyname(getcharid(1))+"^000000 party.";
        mes "Do you want to register your party for ^"+getd("@"+strnpcinfo(2)+"_team_word$")+" Team^000000?";
        next;
        if (select("Yes, I do.:No, I don't") == 2) {
            mes "[Mr.Doppel]";
            mes "You should hurry with registration if you don't wanna be warped out here.";
            close;
        }
        if (!getd("$"+strnpcinfo(2)+"_Party")) {
            mes "[Mr.Doppel]";
            mes "^0072BC"+getpartyname(getcharid(1))+"^000000 party";
            mes "was registred as party of "+strnpcinfo(2)+" Team.";
            mes "Now all your friends should confirm their party with me.";
            set WoP_Party_Confirmed,1;
            setd "$"+strnpcinfo(2)+"_Party",getcharid(1);
            if (strnpcinfo(2) == "Ang") {
                dispbottom "Party Name registration of Angeling Team is complete. All Members should confirm your party with Mr.Doppel.";
//              mapannounce "poring_w02","Party Name registration of Angeling Team is complete. All Members should confirm your party with Mr.Doppel.",bc_map,0x00FF00; // not shure what to use here
            }
            else {
                dispbottom "Party Name registration of Angeling Team is complete. All Members should confirm your party with Mr.Doppel.";
//              mapannounce "poring_w02","Party Name registration of Angeling Team is complete. All Members should confirm your party with Mr.Doppel.",bc_map,0x00FF00; // not shure what to use here
            }
            donpcevent "WoP_PartyReg::On"+strnpcinfo(2)+"PartyConfirm";
            close;
        }
        else {
            mes "[Mr.Doppel]";
            mes "Sorry, but some of your friends has just registred ^0072BC"+getpartyname(getd("$"+strnpcinfo(2)+"_Party"))+"^000000 party for ^"+getd("@"+strnpcinfo(2)+"_team_word$")+" Team^000000. Now you do to join his party.";
            close;
        }
    }
    else {
        if (!WoP_Party_Confirmed) {
            mes "[Mr.Doppel]";
            mes "Hello, human. Do you want to confirm your party for ^"+getd("@"+strnpcinfo(2)+"_team_word$")+" Team^000000?";
            next;
            if (select("Yes, I do.:No, I don't") == 2) {
                mes "[Mr.Doppel]";
                mes "You should hurry with confirmation if you don't wanna the battle be over ever be not started.";
                close;
            }
            if (!getcharid(1)) {
                mes "[Mr.Doppel]";
                mes "Sorry, you must in a party for confirmation. Join ^0072BC"+getpartyname(getd("$"+strnpcinfo(2)+"_Party"))+"^000000 party as soon as posible!";
                close;
            }
            else if (getcharid(1) != getd("$"+strnpcinfo(2)+"_Party")) {
                mes "[Mr.Doppel]";
                mes "Hey human, don't try to cheat me. Your Party Name is not like registred one. Join registered Party as soon as posible!";
                close;
            }
            mes "[Mr.Doppel]";
            mes "You just have confirmed your party membership.";
            if (getd("$"+strnpcinfo(2)+"_Party_Confirmed") < $WoP_Players-1) {
                mes "Please wait others do the same...";
            }
            set WoP_Party_Confirmed,1;
            donpcevent "WoP_PartyReg::On"+strnpcinfo(2)+"PartyConfirm";
            close;
        }
        else {
            mes "[Mr.Doppel]";
            mes "You have just confirmed your Party. Please wait for teammates...";
            close;
        }
    }
}
 
poring_w02,170,181,3    duplicate(Mr.Doppel#Ang)    Mr.Doppel#Dev   739
 
//- Registration - Events
//============================================================
 
-   script  WoP_Join    -1,{
    end;
 
OnAngTeamJoin:
    set $Angeling_Team_Ready,1;
    if ($Deviling_Team_Ready == 1) {
        initnpctimer;
    }
    end;
 
OnDevTeamJoin:
    set $Deviling_Team_Ready,1;
    if ($Angeling_Team_Ready == 1) {
        initnpctimer;
    }
    end;
 
OnTimer10000:
    if($Angeling_Team_Ready == 1 && $Deviling_Team_Ready == 1){
        set $Angeling_Team_Ready,0;
        set $Angeling_Team_Ready,0;
        stopnpctimer;
        set $wop,1;
        donpcevent "Poring#WoP_Reg_Ang::OnWarp";
        sleep 3000;
        set $wop,0;
        end;
    }
    end;
}
 
-   script  WoP_PartyReg    -1,{
    end;
 
OnPrepare:
    sleep 1000;
    mapannounce "poring_w02","You have 1 minute for registration. Party Leaders should register their Parties with Mr.Doppel.",bc_map,0x00FF00;
    initnpctimer;
    end;
 
OnTimer30000:
    mapannounce "poring_w02","Mr.Doppel : 30 seconds left to prepare for battle.",bc_map,0xF49AC1;
    end;
 
OnTimer60000:
    stopnpctimer;
    if ($Ang_Party_Confirmed == $WoP_Players && $Dev_Party_Confirmed == $WoP_Players) {
        sleep 1000;
        mapannounce "poring_w02","Mr.Doppel : Both teams are ready. Battle will begin in 10 seconds.",bc_map,0xF49AC1;
        sleep 5000;
        for (set .i,1; .i<6; set .i,.i+1) {
            mapannounce "poring_w02","Mr.Doppel : "+(6-.i)+".",bc_map,0xF49AC1;
            sleep 1000;
        }
        mapannounce "poring_w02","Mr.Doppel : Let the battle begin!!",bc_map,0xF49AC1;
        sleep 2000;
        pvpon "poring_w02";
        donpcevent "WoP_Battle::OnStart";
    }
    else {
        mapwarp "poring_w02","pay_fild04",255,193;
        sleep 2000;
        mapannounce "pay_fild04","Mr.Doppel : Unfortunetly you have failed to prepare your Parties for battle. You should to start from the first point to try again.",bc_map,0xF49AC1;
        donpcevent "WoP_Common::OnReset";
    }
    end;
 
OnAngPartyConfirm:
    set $Ang_Party_Confirmed,$Ang_Party_Confirmed+1;
    if ($Ang_Party_Confirmed == $WoP_Players) {
        mapannounce "poring_w02","Mr.Doppel : Angeling Team is ready for battle.",bc_map,0x00FF00;
    }
    if ($Dev_Party_Confirmed == $WoP_Players) {
        donpcevent "WoP_PartyReg::OnTimer60000";
    }
    end;
 
OnDevPartyConfirm:
    set $Dev_Party_Confirmed,$Dev_Party_Confirmed+1;
    if ($Dev_Party_Confirmed == $WoP_Players) {
        mapannounce "poring_w02","Mr.Doppel : Deviling Team is ready for battle.",bc_map,0x00FF00;
    }
    if ($Ang_Party_Confirmed == $WoP_Players) {
        donpcevent "WoP_PartyReg::OnTimer60000";
    }
    end;
}
 
//- Battle Timer
//============================================================
 
-   script  WoP_BattleTimer -1,{
    end;
 
OnStart:
    initnpctimer;
    end;
 
OnTimer600000:
    donpcevent "WoP_Battle::OnBattleEnd";
    end;
 
OnStop:
    stopnpctimer;
    end;
}
 
//- General Battle Events
//============================================================
 
-   script  WoP_Battle  -1,{
    end;
 
OnInit:
    donpcevent "WoP_Common::OnReset";
    end;
 
OnStart:
    if ($Angelings_Amount > 0 || $Devilings_Amount > 0) {
        donpcevent "WoP_Battle::OnTeamsRelease";
        donpcevent "WoP_Battle::OnGate1Close";
        donpcevent "WoP_Battle::OnGate2Close";
    }
    else {
        set $WoP_Started,1;
        donpcevent "WoP_BattleTimer::OnStart";
        set $Angelings_Amount,$WoP_AngDev_Amount;
        set $Devilings_Amount,$WoP_AngDev_Amount;
        areawarp "poring_w02",15,186,36,165,"poring_w02",80,82;
        areawarp "poring_w02",159,186,180,165,"poring_w02",116,82;
    }
    donpcevent "WoP_Battle::OnAngelingsSpawn";
    donpcevent "WoP_Battle::OnDevilingsSpawn";
    end;
 
OnBattleEnd:
    donpcevent "WoP_BattleTimer::OnStop";
    if ($Angelings_Amount > $Devilings_Amount) {
        set $WoP_Team_Winner,1;
    }
    if ($Angelings_Amount < $Devilings_Amount) {
        set $WoP_Team_Winner,2;
    }
    pvpoff "poring_w02";
    set $WoP_Rewarding,1;
    donpcevent "WoP_RewardTimer::OnStart";
    sleep 3000;
    if ($WoP_Team_Winner == 1) {
        mapannounce "poring_w02","Mr.Doppel : The Battle is over. Angeling Team has won the battle. Congradulations to the Team of Winners!",bc_map,0x00FF00;
    }
    else if ($WoP_Team_Winner == 2) {
        mapannounce "poring_w02","Mr.Doppel : The Battle is over. Deviling Team has won the battle. Congratulations to the Team of Winners!",bc_map,0x00FF00;
    }
    else {
        mapannounce "poring_w02","Mr.Doppel : The Battle is over. There is no Winner or Looser for this time.",bc_map,0x00FF00;
    }
    sleep 2000;
    mapwarp "poring_w02","poring_w02",100,197;
    sleep 1000;
    mapannounce "poring_w02","Mr.Doppel : Allow me to offer a Souvenir for the humans who bravely fought for Porings. Please Talk to Devi.",bc_map,0x00FF00;
    sleep 5000;
    mapannounce "poring_w02","Devi : You have 1 minute to get your reward. If time ends you will be warped out from here with nothing.",bc_map,0x00FF00;
    end;
 
OnRoundEnd:
    sleep 3000;
    for (set .i,0; .i<$WoP_Players; set .i,.i+1) {
        attachrid($WoP_ang[.i]);
        if (OnWoP) {
            warp "poring_w02",rand(44,51),rand(76,87);
        }
        attachrid($WoP_dev[.i]);
        if (OnWoP) {
            warp "poring_w02",rand(146,153),rand(76,87);
        }
    }
    sleep 2000;
    mapannounce "poring_w02","Mr.Doppel : Next round in 30 seconds.",bc_map,0xF49AC1;
    sleep 20000;
    mapannounce "poring_w02","Mr.Doppel : Battle will continue in 10 seconds.",bc_map,0xF49AC1;
    sleep 5000;
    for (set .i,1; .i<6; set .i,.i+1) {
        mapannounce "poring_w02","Mr.Doppel : "+(6-.i)+".",bc_map,0xF49AC1;
        sleep 1000;
    }
    mapannounce "poring_w02","Mr.Doppel : Let's fight!",bc_map,0xF49AC1;
    sleep 1000;
    donpcevent "WoP_Battle::OnStart";
    end;
 
OnTeamsRelease:
    areawarp "poring_w02",42,76,51,87,"poring_w02",59,82;
    areawarp "poring_w02",146,76,155,87,"poring_w02",138,82;
    end;
 
OnAngelingsSpawn:
    monster "poring_w02",98,41,"Angeling",$WoP_Angeling_MobID,($WoP_AngDev_Amount-$WoP_Rounded*($WoP_AngDev_Amount-1)),"WoP_Battle::OnAngelingFall";
    end;
 
OnDevilingsSpawn:
    monster "poring_w02",98,124,"Deviling",$WoP_Deviling_MobID,($WoP_AngDev_Amount-$WoP_Rounded*($WoP_AngDev_Amount-1)),"WoP_Battle::OnDevilingFall";
    end;
 
OnPCDieEvent:
    getmapxy @map$,@x,@y,0;
    if (@map$ == "poring_w02" && OnWoP) {
        if (WoP_Team == 1) {
//          warp "poring_w02",rand(44,51),rand(76,87);
            savepoint "poring_w02",rand(44,51),rand(76,87);
        }
        if (WoP_Team == 2) {
//          warp "poring_w02",rand(146,153),rand(76,87);
            savepoint "poring_w02",rand(146,153),rand(76,87);
        }
//      sleep2 500;
//      atcommand "@alive";
    }
    end;
 
OnPCKillEvent:
    getmapxy @map$,@x,@y,0;
    if (@map$ == "poring_w02" && OnWoP) {
        getitem2 $WoP_Trophy,1,1,0,0,254,0,getcharid(0,rid2name(killedrid)),0;
    }
    end;
 
OnGate1Close:
    disablenpc "Angeling_Warp_To";
    disablenpc "Angeling_Warp_Out";
    set $bages_equipped_1,0;
    end;
 
OnGate1Open:
    enablenpc "Angeling_Warp_To";
    enablenpc "Angeling_Warp_Out";
    sleep 1000;
    mapannounce "poring_w02","Mr.Doppel : Angeling Gates are now open. Angeling is avalble to attack!",bc_map,0x00FF00;
    end;
 
OnGate2Close:
    disablenpc "Deviling_Warp_To";
    disablenpc "Deviling_Warp_Out";
    set $bages_equipped_2,0;
    end;
 
OnGate2Open:
    enablenpc "Deviling_Warp_To";
    enablenpc "Deviling_Warp_Out";
    sleep 1000;
    mapannounce "poring_w02","Mr.Doppel : Deviling Gates are now open. Deviling is avalble to attack!",bc_map,0x00FF00;
    end;
 
OnAngelingFall:
    set $Angelings_Amount,$Angelings_Amount-1;
    mapannounce "poring_w02","Mr.Doppel : Angeling has fallen!!",8;
    if ($Angelings_Amount == 0) {
        donpcevent "WoP_Battle::OnBattleEnd";
    }
    else if ($WoP_Rounded) {
        donpcevent "WoP_Battle::OnRoundEnd";
    }
    end;
 
OnDevilingFall:
    set $Devilings_Amount,$Devilings_Amount-1;
    mapannounce "poring_w02","Mr.Doppel : Deviling has fallen!!",8;
    if ($Devilings_Amount == 0) {
        donpcevent "WoP_Battle::OnBattleEnd";
    }
    else if ($WoP_Rounded) {
        donpcevent "WoP_Battle::OnRoundEnd";
    }
    end;
}
 
//- Stairs Warps Controllers
//============================================================
 
-   script  WoP_LeftStairsWarp  -1,{
    end;
 
OnInit:
    disablenpc "Left_Stairs_Warp";
    end;
 
OnPCDieEvent:
    if (OnWoP) {
        sleep 1000;
        if ($Left_Stairs_Warp_Opened) {
            disablenpc "Left_Stairs_Warp";
            set $Left_Stairs_Warp_Opened,0;
            stopnpctimer;
        }
        initnpctimer;
    }
    end;
 
OnTimer10000:
    stopnpctimer;
    if (getareausers("poring_w02",42,76,51,87) > 0) {
        if (!$Left_Stairs_Warp_Opened) {
            enablenpc "Left_Stairs_Warp";
            set $Left_Stairs_Warp_Opened,1;
        }
        initnpctimer;
    }
    if (getareausers("poring_w02",42,76,51,87) == 0 && $Left_Stairs_Warp_Opened) {
        disablenpc "Left_Stairs_Warp";
        set $Left_Stairs_Warp_Opened,0;
        stopnpctimer;
    }
    end;
}
 
-   script  WoP_RightStairsWarp -1,{
    end;
 
OnInit:
    disablenpc "Right_Stairs_Warp";
    end;
 
OnPCDieEvent:
    if (OnWoP) {
        sleep 1000;
        if ($Right_Stairs_Warp_Opened) {
            disablenpc "Left_Stairs_Warp";
            set $Right_Stairs_Warp_Opened,0;
            stopnpctimer;
        }
        initnpctimer;
    }
    end;
 
OnTimer10000:
    stopnpctimer;
    if (getareausers("poring_w02",146,76,155,87) > 0) {
        if (!$Right_Stairs_Warp_Opened) {
            enablenpc "Right_Stairs_Warp";
            set $Right_Stairs_Warp_Opened,1;
        }
        initnpctimer;
    }
    if (getareausers("poring_w02",146,76,155,87) == 0 && $Right_Stairs_Warp_Opened) {
        disablenpc "Right_Stairs_Warp";
        set $Right_Stairs_Warp_Opened,0;
        stopnpctimer;
    }
    end;
}
 
//- Gate Keepers
//============================================================
 
poring_w02,99,52,0  script  Angeling Gate Keeper#1  111,{
    if (OnWoP) {
        cutin "wop_emb0"+getd("$bages_equipped_"+strnpcinfo(2)),2;
        if (WoP_Team == atoi(strnpcinfo(2))) {
            mes "- It's your team Gate Keeper. -";
        }
        else {
            if (getd("$bages_equipped_"+strnpcinfo(2)) == 4) {
                mes "- Badges are all equipped. -";
            }
            else if (countitem($WoP_Trophy)) {
                while (1) {
                    if (countitem($WoP_Trophy)) {
                        mes "- Choose your action. -";
                        next;
                        if (select("Equip badge on the free slot.:Cancel.") == 2) {
                            mes "- Exiting -";
                            close2;
                            cutin "",255;
                            end;
                        }
                        mes "- You have successfuly equipped the badge. -";
                        delitem $WoP_Trophy,1;
                        setd "$bages_equipped_"+strnpcinfo(2),getd("$bages_equipped_"+strnpcinfo(2))+1;
                        cutin "wop_emb0"+getd("$bages_equipped_"+strnpcinfo(2)),2;
                        next;
                        if (getd("$bages_equipped_"+strnpcinfo(2)) == 4) {
                            mes "- Badges are all equipped. -";
                            donpcevent "WoP_Battle::OnGate"+strnpcinfo(2)+"Open";
                            close2;
                            cutin "",255;
                            end;
                        }
                    }
                    else {
                        mes "- You don't have bages to equip. -";
                        break;
                    }
                }
            }
            else {
                mes "- You don't have bages to equip. -";
            }
        }
        close2;
        cutin "",255;
        end;
    }
}
 
poring_w02,98,113,0 duplicate(Angeling Gate Keeper#1)   Deviling Gate Keeper#2  111
 
//- Gate Warps
//============================================================
 
poring_w02,103,53,0 warp    Angeling_Warp_To    2,2,poring_w02,94,47
poring_w02,94,50,0  warp    Angeling_Warp_Out   2,2,poring_w02,103,56
poring_w02,94,112,0 warp    Deviling_Warp_To    2,2,poring_w02,103,118
poring_w02,103,115,0    warp    Deviling_Warp_Out   2,2,poring_w02,94,109
 
//- Stairs Warps
//============================================================
 
poring_w02,50,82,0  warp    Left_Stairs_Warp    1,1,poring_w02,59,82
poring_w02,147,82,0 warp    Right_Stairs_Warp   1,1,poring_w02,138,82
 
//- Heal Fontanes
//============================================================
 
poring_w02,36,82,0  script  Fontane of Life#1   111,{
    if (OnWoP && WoP_Team == atoi(strnpcinfo(2))) {
        specialeffect2 312;
        percentheal 100,100;
    }
    end;
}
 
poring_w02,161,82,0 duplicate(Fontane of Life#1)    Fontane of Life#2   111
 
//- Reward - NPC
//============================================================
 
poring_w02,99,201,3 script  Devi#wop_reward 738,{
    mes "[Devi]";
    mes "Oh, human!~ Did you came for reward?";
    mes "Let me see what your reward is...";
    next;
    mes "[Devi]";
    if (!$WoP_Team_Winner) {
        mes "Nobody won the battle at this time.";
        mes "Your reward is "+$WoP_Draw_Reward_Ammount+" "+getitemname($WoP_Reward)+".";
    }
    else if (WoP_Team == $WoP_Team_Winner) {
        mes "Good! I know you have won the battle.";
        mes "Your reward is "+$WoP_Winner_Reward_Ammount+" "+getitemname($WoP_Reward)+".";
    }
    else if ($WoP_Looser_Reward_Ammount) {
        mes "Don't be sad. You will win next time.";
        mes "Your compensation is "+$WoP_Looser_Reward_Ammount+" "+getitemname($WoP_Reward)+".";
    }
    else {
        mes "Don't be sad. You will win next time.";
    }
    if (countitem($WoP_Trophy)) {
        next;
        mes "[Devi]";
        mes "Wait a second please...";
        mes "As I see you have "+countitem($WoP_Trophy)+" "+getitemname($WoP_Trophy)+" at the inventory.";
        mes "Sorry, human, but you can't leave them. I have to take them before you leave this place.";
        delitem $WoP_Trophy,countitem($WoP_Trophy);
    }
    if (WoP_Deleted_Trophy) {
        next;
        mes "[Devi]";
        mes "I have to return your "+WoP_Deleted_Trophy+" "+getitemname($WoP_Trophy)+".";
        getitem $WoP_Trophy,WoP_Deleted_Trophy;
        set WoP_Deleted_Trophy,0;
    }
    next;
    mes "[Devi]";
    mes "See you later, human!~ Bye!";
    close2;
    switch ($WoP_Team_Winner) {
        case 1:
        case 2:
            if (WoP_Team == $WoP_Team_Winner) {
                getitem $WoP_Reward,$WoP_Winner_Reward_Ammount;
            }
            else if ($WoP_Looser_Reward_Ammount) {
                getitem $WoP_Reward,$WoP_Looser_Reward_Ammount;
 
            }
            break;
        default:
            getitem $WoP_Reward,$WoP_Draw_Reward_Ammount;
    }
    set OnWoP,0;
    set WoP_Team,0;
    set WoP_Party_Confirmed,0;
    savepoint WoP_Savepoint_Memo$,WoP_Savepoint_Memo_X,WoP_Savepoint_Memo_Y;
    warp "pay_fild04",255,193;
    if (!getmapusers("poring_w02")) {
        donpcevent "WoP_RewardTimer::OnStop";
    }
    end;
 
}
 
//- Reward - Timer
//============================================================
 
-   script  WoP_RewardTimer -1,{
    end;
 
OnStart:
    initnpctimer;
    end;
 
OnTimer54000:
    mapannounce "poring_w02","Devi : Hurry up!! Time is running low...",bc_map,0x00FF00;
    end;
 
OnTimer64000:
    for (set .i,0; .i<$WoP_Players; set .i,.i+1) {
        attachrid($wop_ang[.i]);
        if (OnWoP) {
            set OnWoP,0;
            set WoP_Team,0;
            set WoP_Party_Confirmed,0;
            if (countitem($WoP_Trophy)) {
                delitem $WoP_Trophy,countitem($WoP_Trophy);
            }
        }
        attachrid($wop_dev[.i]);
        if (OnWoP) {
            set OnWoP,0;
            set WoP_Team,0;
            set WoP_Party_Confirmed,0;
            if (countitem($WoP_Trophy)) {
                delitem $WoP_Trophy,countitem($WoP_Trophy);
            }
        }
    }
    mapwarp "poring_w02","pay_fild04",255,193;
    donpcevent "WoP_RewardTimer::OnStop";
    end;
 
OnStop:
    donpcevent "WoP_Common::OnReset";
    stopnpctimer;
    end;
}
 
//- Poring Vending Machine - NPC
//============================================================
 
pay_fild04,265,194,3    script  Poring Vending Machine  909,{
    mes "[Poring Vending Machine]";
    mes "Do you have ^DD3636"+getitemname($WoP_Reward)+"s^000000?";
    mes "Using these you can buy various interesting and exclusive items.";
    next;
    if (select("Buy items.:Leave.") == 2) {
        callfunc "PoringVend",0,0;
    }
    mes "[Poring Vending Machine]";
    mes "What type of items would you like to buy?";
    next;
    switch (select("Prize Medals:Usable Items:Mercenary Scrolls:Accesories:Nothing")) {
        case 1:
            callfunc "PoringVend",7515,4;
        case 2:
            mes "[Poring Vending Machine]";
            mes "What Usable Item would you like to buy?";
            next;
            switch (select("Tribal Solidarity:Poring Box:Nothing")) {
                case 1:
                    callfunc "PoringVend",658,20;
                case 2:
                    callfunc "PoringVend",12109,30;
                default:
                    callfunc "PoringVend",0,0;
            }
            break;
        case 3:
            mes "[Poring Vending Machine]";
            mes "What Mercenary Scroll would you like to buy?";
            next;
            switch (select("Wild Rose Mercenary Scroll:Doppelganger Mercenary Scroll:Egnigem Cenia Mercenary Scroll:Nothing")) {
                case 1:
                    callfunc "PoringVend",12300,15;
                case 2:
                    callfunc "PoringVend",12301,20;
                case 3:
                    callfunc "PoringVend",12302,20;
                default:
                    callfunc "PoringVend",0,0;
            }
            break;
        case 4:
            mes "[Poring Vending Machine]";
            mes "What Accesory would you like to buy?";
            next;
            switch (select("Novice Figure:Swordman Figure:Acolyte Figure:Mage Figure:Archer Figure:Thief Figure:Merchant Figure:Nothing")) {
                case 1:
                    callfunc "PoringVend",2765,50;
                case 2:
                    callfunc "PoringVend",2766,100;
                case 3:
                    callfunc "PoringVend",2767,100;
                case 4:
                    callfunc "PoringVend",2768,100;
                case 5:
                    callfunc "PoringVend",2769,100;
                case 6:
                    callfunc "PoringVend",2770,100;
                case 7:
                    callfunc "PoringVend",2771,100;
                default:
                    callfunc "PoringVend",0,0;
            }
            break;
        default:
            callfunc "PoringVend",0,0;
    }
}
 
//- Poring Vending Machine - Function
//============================================================
 
function    script  PoringVend  {
    if (getarg(0) == 0) {
        mes "[Poring Vending Machine]";
        mes "Come back later.";
        close;
    }
    else {
        mes "[Poring Vending Machine]";
        mes "How many ^007CCC"+getitemname(getarg(0))+"s^000000 do you wish to buy?";
        next;
        set .@vend_amount,1;
        if (select("I will input the ammount.:1 ea.") == 1) {
            input .@vend_amount;
        }
        if (!.@vend_amount) {
            mes "[Poring Vending Machine]";
            mes "Zero? What does it mean?";
            close;
        }
        mes "[Poring Vending Machine]";
        mes "Would you like to buy ^007CCC"+.@vend_amount+" "+getitemname(getarg(0))+"^000000 for ^DD3636"+(getarg(1)*.@vend_amount)+" ^DD3636"+getitemname($WoP_Reward)+"s^000000^000000?";
        next;
        switch (select("Yes:No")) {
            case 1:
                if(countitem($WoP_Reward) < (getarg(1)*.@vend_amount)){
                    mes "[Poring Vending Machine]";
                    mes "Sorry, but you don't have enough ^DD3636"+getitemname($WoP_Reward)+"s^000000 to comlete this deal.";
                    close;
                }
                else {
                    mes "[Poring Vending Machine]";
                    mes "Thank you. Come back later.";
                    getitem getarg(0),.@vend_amount;
                    delitem $WoP_Reward,(getarg(1)*.@vend_amount);
                    close;
                }
            case 2:
                mes "[Poring Vending Machine]";
                mes "Come back later.";
                close;
        }
    }
    return;
}
 
//- Mapflags
//============================================================
 
poring_w01  mapflag nowarpto
poring_w01  mapflag nowarp
poring_w01  mapflag noteleport
poring_w01  mapflag nomemo
poring_w01  mapflag nosave  SavePoint
poring_w01  mapflag nobranch
poring_w01  mapflag noicewall
 
poring_w02  mapflag nowarpto
poring_w02  mapflag nowarp
poring_w02  mapflag noteleport
poring_w02  mapflag nomemo
poring_w02  mapflag nosave  SavePoint
poring_w02  mapflag nobranch
poring_w02  mapflag noicewall
poring_w02  mapflag monster_noteleport
poring_w02  mapflag nopenalty
Viewed 1096 times, submitted by Guest.