summaryrefslogblamecommitdiff
path: root/world/map/npc/009-6/brodomir.txt
blob: d78e515a51d4b79ddfa7028892921ed4ddf5cbe9 (plain) (tree)
1
2
3
4
5
6
                                     
                           



                                                                         








                                                                 

                                                         
                                       
                           
                                   
                              
                                   






                                                                                    
                                             













                                                                                                                                                                                                                                                                                                                                                                             
                                                                                                                                                                                                                                                                                   


                
                                                                                                                                                                                                                               




                      
                      



                                               
                 

      


                                                              
                                   


                                                         



                                     

     
                                          

                                                                                                                                                     

                                                                                                                            
                     

                                                                                                                                                             
                 
                 

       
                                                                     
                     




                                                                                                           


                  
                                  
                     
                                                





                                                         

                                                                         





                                           
                                                                                











                                                                    

                                                                   
                              








                                                         
                 



                                                         
                 



                                           
                 

          


                                  


                 
        
                           
          
 
// Last Man Standing PvP Event NPC
// Authors: tux9th, Jenalya
// many thanks to Jenalaya, o11c, Ablu :)
//  CAVE: this script requires a patch by o11c that makes it possible for
//  getareausers to check if players are alive or dead.

// Global Variables:
// $@BRODOMIR_PVP_STATUS:
//      1 if players are waiting to be warped into the fight cave
//      2 if fight is in progress
// $@BRODOMIR_START_TIME:
//      time when the players will be warped into the fight cave
// $@BRODOMIR_PLAYERS: number of players taking part in the event


// $@BRODOMIR_MONEY: Amount of money given by the sponsor

009-6.gat,36,40,0|script|Brodomir|116,{
    set @brodomir_money, 0;
    if ($@BRODOMIR_PVP_STATUS == 2)
        goto L_Alreadystarted;
    if ($@BRODOMIR_PVP_STATUS == 1)
        goto L_Wait;
    mes "[Brodomir]";
    mes "\"Hi Warrior.\"";
    mes "\"Do you know me? I'm pretty old and I have never been good with faces?\"";
    menu
        "Yes of course! Don't you remember me?", L_Shorttalk,
        "No, who are you?", L_Longtalk,
        "I don't want to know you!", L_Close;

L_Longtalk:
    mes "[Brodomir]";
    mes "\"I'm Brodomir\"";
    mes "Brodomir sighs.";
    mes "\"Once I as well was a powerful warrior. It's been quite a while. But before that I was a miner in Tonori. I can still remember it very good. The Earth was shaking for hours and everything was torn apart. Many many of my friends and beloved ones were devoured by the crevasses which opened up. It was horrific and I am very lucky to have survived that.\"";
    next;
    mes "\"Then everything was pure chaos and I had to fight to survive. We had hardly anything to eat, therefore the strongest survived. I turned out to be a very good warrior. I fought hard. When I felt strong enough to defend others I created a school of martial arts. I took in the weak and tended to them and made them stronger.\"";
    next;
    mes "\"I trained them to fight with all weapons and how to fight bare handed. Taught them how to make their own weapons and what could be used as a weapon. Those were dark times. I'm happy that those times are over and you do not have to live through it.\"";
    next;
    mes "\"When my shelter was no longer required I started to wander around. Now I ended up here old and wrinkly. I'm only able to drive away those weak creatures who try to enter my home all the time. Slowly they learn to leave me alone or I'll squish them.\"";
    next;
    mes "\"I am sorry but I cannot teach you anything anymore. I am too old. But I am still quite good with my pickaxe and I made a cave where you can fight against your friends.\"";
    mes "\"The only things you need is to sponsor some price money and at least two of your friends. If you pay me I will give you about five minutes and after that I will bring you to the cave where you can fight. I will reward the winner. Do you want to give it a shot?\"";
    goto L_Menu;

L_Shorttalk:
    mes "Well... I'm sorry I cannot remember. I'm old. I hope you can forgive me. Well then. Do you want to fight with your friends in my cave? All you need is to sponsor some price money and at least two of your friends.";
    goto L_Menu;

L_Menu:
    menu
        "No.", L_Exit,
        "Yes.", L_Pay;

L_Exit:
    mes "[Brodomir]";
    mes "\"Okay, you can come back anytime.\"";
    goto L_Close;

L_Pay:
    mes "[Brodomir]";
    mes "\"How much money do you want to sponsor as price?\"";
    input @brodomir_money;
    if ($@BRODOMIR_PVP_STATUS == 1)
        goto L_Wait;
    if (getareausers("009-6.gat", 20, 20, 80, 80, 1) < 3)
        goto L_NotEnoughPlayers;
    if (Zeny < @brodomir_money)
        goto L_NotEnoughMoney;
    set Zeny, Zeny - @brodomir_money;
    goto L_Go;

L_Go:
    set $@BRODOMIR_MONEY, @brodomir_money;
    set $@BRODOMIR_PVP_STATUS, 1;
    mapannounce "009-6.gat", "In 5 minutes I will bring you all to the PvP cave. If there are less than 3 players here the event will not start.", 0;
    if ($@BRODOMIR_MONEY > 0)
        mapannounce "009-6.gat", "The winner will receive " + $@BRODOMIR_MONEY + "GP and additionally 150GP per player.", 0;
    mes "[Brodomir]";
    mes "\"In 5 minutes I will bring you all to the PvP cave. If there are less than 3 players here the event will not start and your money will be lost.\"";
    set $@BRODOMIR_START_TIME, gettimetick(2) + 300;
    initnpctimer;
    goto L_Close;

L_Wait:
    set $@brodomir_seconds, ($@BRODOMIR_START_TIME - gettimetick(2));
    mes "[Brodomir]";
    if ($@brodomir_seconds/60 == 0)
        mes "\"Just a little longer. I will bring you there in " + $@brodomir_seconds + " seconds.\"";
    if ($@brodomir_seconds/60 > 0)
        mes "\"Just a little longer. I will bring you there in " + $@brodomir_seconds/60 + " minute(s).\"";
    goto L_Close;

OnTimer5000:
    setnpctimer 0;
    if ($@BRODOMIR_PVP_STATUS > 1)
        goto L_Check;
    if (gettimetick(2) >= $@BRODOMIR_START_TIME)
        goto L_Warp;
    end;

L_Warp:
    if (getareausers("009-6.gat", 20, 20, 80, 80, 1) < 3)
        goto L_Warpfail;
    set $@BRODOMIR_PVP_STATUS, $@BRODOMIR_PVP_STATUS + 1;
    set $@BRODOMIR_PLAYERS, getareausers("009-6.gat", 20, 20, 80, 80, 1);
    mapwarp "009-6.gat", "009-5.gat", 0, 0;
    mapannounce "009-5.gat", "PvP On!", 0;
    pvpon "009-5.gat";
    end;

L_Warpfail:
    mapannounce "009-6.gat", "There are not enough players around to start!", 0;
    goto L_Cleanup;

L_Check:
    if (getareausers("009-5.gat", 20, 20, 80, 80, 1) > 1)
        end;
    areatimer "009-5.gat", 20, 20, 80, 80, 10, "Brodomir::onReward";
    goto L_End;

onReward:
    if (isdead())
        end;
    message strcharinfo(0), "Congratulations you won!";
    set Zeny, Zeny + ($@BRODOMIR_MONEY + 150 * $@BRODOMIR_PLAYERS);
    set $@BRODOMIR_MONEY, 0;
    set $@BRODOMIR_PLAYERS, 0;
    end;

L_End:
    mapwarp "009-5.gat", "009-6.gat", 162, 81;
    goto L_Cleanup;

L_NotEnoughPlayers:
    mes "[Brodomir]";
    mes "\"There aren't enough players here to start.\"";
    goto L_Close;

L_Alreadystarted:
    mes "[Brodomir]";
    mes "\"Please wait until the cave is clear again.\"";
    goto L_Close;

L_NotEnoughMoney:
    mes "[Brodomir]";
    mes "\"You don't have enough money.\"";
    goto L_Close;

L_Cleanup:
    pvpoff "009-5.gat";
    set $@BRODOMIR_PVP_STATUS , 0;
    set $@BRODOMIR_START_TIME, 0;
    stopnpctimer;
    end;

L_Close:
    set @brodomir_money, 0;
    close;
}