summaryrefslogblamecommitdiff
path: root/world/map/npc/031-4/cindyCave.txt
blob: fc9fab08f198eda1acecb92c096742031229685e (plain) (tree)
1
2
3
4
5
6
7
8
9
                  

                                                           

                                                                              
 
                              
 
                                              
 
                         
                      
 
                                           

                                          
 


                                                                                                                                               
                 

              


                                                                                                                                               


                                                     


                                                
                                                         





                                                                     
                         

           
                              


                                                



                                                                                    

                                 
                                                 




                               

                                                                        
 

                 
 
       

                                    
                 
 
         





                                                                                            

                                    

                          

                          
                             
                    
                 
 
             
                                                           
                                                                                        
                                    
                    
                 
 
        


                                                                                      
                 
 
               

                                                                                                       
                 
 
          
                                                                              
                 

                  
                                                       
                 

           
                                                                                                   



                        



                                  
          
 
                              
            
                  

                                 
                    
 
           
                                     
                                                            
        

            
                                                          



                                       
                                                                                    
                                                   


                                                                 
                    

           

                                                 





                                  
                               
                                                                                                                            

                                                                                           
                                                                                               

                                                         
                                                                                          
 


                                                          

                                   
                   
                    

                                             
       
                      

                                                                 
 
           

                                       
 
          
                                                              

                                     
                             
                                    


                                  
                                             


                  
 
         
                      
                              

                                                                                                                          
                       
                   
                    
                                                                                         
                     
                                      
                                                                                                 

               

                  
        
 
       
                                       
                     










                                                                         
        
 
// author: Jenalya
// state0: Cindy is totally scared and does nothing helpful
// state1: you are able to open the cage
// state2: Cindy is saved, she gives you a reward (wizard hat or wooden staff)
// state3: and greater: Cindy is saved, she asks you to visit them

031-4,42,42,0|script|Cindy|198
{
    if ($@FIGHT_YETI_STATUS != 0) goto L_Yeti;

    set @KEYS_AMOUNT, 10;
    set @minlevel, 70;

    if (QL_CINDY == 4) goto L_Please_Visit;
    if (QL_CINDY == 2) goto L_Reward;
    if (QL_CINDY == 1) goto L_Please_Help;

    mes "There is a little girl in a cage. As you come near, she starts to shiver and back off from you as far as she can in that small cage.";
    next;
    mes "You don't know what to do.";
    goto L_Close;

L_Please_Help:
    mes "There is a little girl in a cage. As you come near, she starts to shiver and back off from you as far as she can in that small cage.";
    next;
    menu
        "Hello Cindy, I'm here to save you.", L_Next;

L_Next:
    mes "Cindy doesn't look so scared anymore.";
    next;
    mes "[Cindy]";
    mes "\"Hello, adventurer. Did my mother send you?\"";
    next;
    mes "\"It's so cold in here! Can you please open the cage?\"";
    next;
    mes "\"But be careful. If the Yetis hear you, they will come!\"";
    menu
        "Try to open the cage", L_Try_Cage,
        "Leave", L_Close;

L_Try_Cage:
    if (BaseLevel < @minlevel)
        goto L_To_Weak;
    if (countitem("TreasureKey") < @KEYS_AMOUNT)
        goto L_Not_Enough_Keys;
    delitem "TreasureKey", @KEYS_AMOUNT;
    mes "As you try to open the door of the cage, there is a loud squeaking noise.";
    next;
    mes "You get an uncomfortable feeling and Cindy starts to shiver.";
    if ($@FIGHT_YETI_STATUS != 0)
        goto L_Yeti;
    npctalk strnpcinfo(0), "Oh no, the Yetis...";

    // initialize fight
    set $@FIGHT_YETI_STATUS, 1;
    set $@FIGHT_YETI_WAVE, 0;
    set $@YETI_COUNT, 1;
    set $@FIGHT_YETI_PLAYER_COUNT, getmapusers("031-4");
    areamonster "031-4", 0, 0, 95, 91, "", 1072, 1, "Cindy::OnPetDeath";

    initnpctimer;
    goto L_Close;

L_Yeti:
    mes "[Cindy]";
    mes "\"Watch out, the Yetis!\"";
    goto L_Close;

L_Reward:
    mes "[Cindy]";
    mes "\"You are a hero! All these strong monsters!\"";
    next;
    mes "\"I've found this thing in the cave - it looks valuable. I want you to have it.\"";
    next;
    getinventorylist;
    if (@inventorylist_count == 100)
        goto L_Full_Inv;

    set @reward, rand(15);
    if (@reward < 10)
        goto L_Wizard_Hat;
    getitem "WoodenStaff", 1;
    set QL_CINDY, 3;
    goto L_Visit;

L_Wizard_Hat:
    // get a wizard hat in one of the ten colors - no white
    setarray @wizardhats[0], 2200, 2201, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2209;
    getitem @wizardhats[@reward], 1;
    set QL_CINDY, 3;
    goto L_Visit;

L_Visit:
    mes "\"Thank you so much; please come to my home. It's the house at the beach.\"";
    next;
    mes "\"I'm sure my mother wants to thank you as well.\"";
    goto L_Close;

L_Please_Visit:
    mes "[Cindy]";
    mes "\"Thank you, thank you! You're a hero! Please come home with me to our house at the beach!\"";
    goto L_Close;

L_To_Weak:
    mes "You try to open the cage, but it's stuck. It seems you're too weak!";
    goto L_Close;

L_Not_Enough_Keys:
    mes "You don't have enough keys to open the cage.";
    goto L_Close;

L_Full_Inv:
    mes "\"Oh, it seems you carry so much stuff - I will keep it for you until you can take it.\"";
    goto L_Close;

L_Close:
    set @KEYS_AMOUNT, 0;
    set @minlevel, 0;
    set @inventorylist_count, 0;
    cleararray @wizardhats, 0, 10;
    set @reward, 0;
    close;

// Fight logic attached to npc
OnTimer5000:
    setnpctimer 0;
    if ($@FIGHT_YETI_STATUS != 0)
        goto L_CaveLogic;
    goto L_Return_1;

L_Return_1:
    set $@FIGHT_YETI_PLAYER_COUNT, 0;
    areatimer 0, "031-4", 0, 0, 95, 91, 10, "Cindy::OnTick";
    end;

L_CaveLogic:
    set $@FIGHT_YETI_ROUND_PEN, $@FIGHT_YETI_PLAYER_COUNT;
    if ($@FIGHT_YETI_ROUND_PEN > 60)
        set $@FIGHT_YETI_ROUND_PEN, 60;
    if ($@FIGHT_YETI_PLAYER_COUNT <= 0)
        goto L_CleanUp;
    set $@FIGHT_YETI_ROUND_TIMER, $@FIGHT_YETI_ROUND_TIMER + 5; // Advance 5 seconds
    if (mobcount("031-4", "Cindy::OnPetDeath") < 0)
        goto L_NextWave;
    if ($@FIGHT_YETI_ROUND_TIMER + $@FIGHT_YETI_ROUND_PEN >= 120)
        goto L_NextWave;
    goto L_Return_1;

L_NextWave:
    set $@FIGHT_YETI_ROUND_TIMER, 0;
    set $@FIGHT_YETI_WAVE, $@FIGHT_YETI_WAVE + 1;
    if ($@FIGHT_YETI_WAVE > 10
        && $@YETI_COUNT == 0)
            goto L_CleanUp;
    if ($@FIGHT_YETI_WAVE > 10
        && $@FIGHT_YETI_WAVE < 22)
            goto L_Return_1;
    if ($@FIGHT_YETI_WAVE > 22)
        areamonster "031-4", 0, 0, 95, 91, "", 1072, $@FIGHT_YETI_WAVE*2 + $@FIGHT_YETI_PLAYER_COUNT*5, "Cindy::OnPetDeath";
    if ($@FIGHT_YETI_WAVE > 22)
        set $@YETI_COUNT, $@YETI_COUNT + $@FIGHT_YETI_WAVE*2 + $@FIGHT_YETI_PLAYER_COUNT*5;
    set $@FIGHT_YETI_NUMBER, (5 + (1 * $@FIGHT_YETI_WAVE) + (2 * $@FIGHT_YETI_PLAYER_COUNT))/4;
    set $@YETI_COUNT, $@YETI_COUNT + $@FIGHT_YETI_NUMBER;

    areamonster "031-4", 0, 0, 95, 91, "", 1072, $@FIGHT_YETI_NUMBER, "Cindy::OnPetDeath";

    set $@msg$, $@FIGHT_YETI_MESSAGES$[$@FIGHT_YETI_WAVE];
    if ($@msg$ == "")
        goto L_Return_1;
    mapannounce "031-4", $@msg$, 0;
    mapannounce "031-3", $@msg$, 0;
    set $@msg$, "";
    goto L_Return_1;

// Called on each player once every 5 seconds
OnTick:
    if (isdead()) end;
    set $@FIGHT_YETI_PLAYER_COUNT, $@FIGHT_YETI_PLAYER_COUNT + 1;
    end;

OnPetDeath:
    set $@YETI_COUNT, $@YETI_COUNT - 1;
    end;

L_CleanUp:
    areatimer 0, "031-4", 0, 0, 95, 91, 10, "Cindy::OnReward";
    set $@FIGHT_YETI_STATUS, 0;
    set $@FIGHT_YETI_PLAYER_COUNT, 0;
    set $@FIGHT_YETI_WAVE, 0;
    set $@FIGHT_YETI_ROUND_TIMER, 0;
    set $@YETI_COUNT, 0;
    set $@FIGHT_YETI_ROUND_PEN, 0;
    set $@FIGHT_YETI_NUMBER, 0;
    killmonster "031-4", "Cindy::OnPetDeath";
    stopnpctimer;
    setnpctimer 0;
    end;

OnReward:
    if (isdead()) end;
    set @bonus, (BaseLevel/2);
    set DailyQuestBonus, DailyQuestBonus + @bonus;
    message strcharinfo(0), "You feel a temporary rush of power and zest for action. " + @bonus + " daily bonus gained." ;
    if (QL_CINDY != 1 )
        goto L_End;
    set QL_CINDY, 2;
    message strcharinfo(0), "Cindy looks relieved and as if she wants to talk with you.";
    getexp 100000, 0;
    set BOSS_POINTS, BOSS_POINTS + 70;
    message strcharinfo(0), "You gain 70 Boss Points giving you a total of " + BOSS_POINTS + ".";
    goto L_End;

L_End:
    set @bonus, 0;
    end;

OnInit:
    setarray $@FIGHT_YETI_MESSAGES$[0],
        "", // unused
        // " : " is magic so that it says "global announcement from"
        "Cindy : Yetis!",
        "Cindy : Watch out!",
        "Cindy : More of them are coming!",
        "Cindy : Be careful! More of them!",
        "Cindy : Attention! There is another bunch of them!",
        "Cindy : Hang on! More of them!",
        "Cindy : More Yetis! Will this never end?",
        "Cindy : There are coming more and more!",
        "Cindy : Watch your back! There are so many of them!",
        "Cindy : This seems to be their final attack! I believe in you!";
    end;
}