summaryrefslogblamecommitdiff
path: root/world/map/npc/052-2/chest.txt
blob: 12752e80da436fe871819e3e388ffa2cf0beb00a (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14













                                                                               
                                     
 











                                                                                                                        
                

        
       



                                                                                                                                                                                                                                                                                                                                                                                        







                                                            
                                          



                                                               
                         





                                
                 




                                                                      

                                                            
                                                                         

                                                                   
                        
                                                                 
                     







                                                                      

                                                            
                                                                         




                                                                   
                        
                                                                 
                                                     
                     





                                           
                                                                                           

























                                                                                    
                                                                                     












                                                                 
                                                        



                                      




                                          

          
       


                                                                                                 
       
                                                                                                             

        
       


                                                                      
     


                                                      
       
                                               






                                        
                                               

        


          
 
//-----------------------------------------------------------------------------
// Illia Forsaken Inn - Chest room
// $@illia_progress = 8
//
// Level progress:
//     No progress: Players pick the rewards, then leave,
//                  with the Hero forced to leave last.
// @illia_got_rewards value:
//     0: player did not pick his reward yet
//     1: player picked his common rewards
//     2: player picked his unique rewards
//     3: player choosed to leave the room
//-----------------------------------------------------------------------------

052-2,136,73,0|script|Chest#illia|111
{
    set @step, 8;
    if ($@illia_progress < @step) goto L_ShouldNotBeHere;
    if (@illia_got_rewards > 2) end;
    if (@illia_got_rewards == 2) goto L_AlreadyGotReward;
    if (@illia_current_num_rewards > 0) goto L_ResumePick;
    set @illia_current_num_rewards, 0;
    mes "You find an opened chest which seems full of equipments.";
    next;
    mes "You realize again you were not the first one to visit this place. But where the others failed, you succeeded.";
    goto L_Pick;

L_ShouldNotBeHere:
    heal -Hp, 0;
    end;

OnInit:
    setarray $@illia_common_rewards$,   "SteelShield",  "WarlordHelmet",  "KnightsHelmet",  "InfantryHelmet",  "CrusadeHelmet",  "ChainmailShirt",  "LightPlatemail",  "WarlordPlate",  "Setzer", "RockKnife",  "WarlordBoots",  "ForestArmor",  "ForestBow",  "WoodenStaff",  "WizardHat",  "WoodenShield",  "ShortSword",  "SilkRobe",  "LeatherGloves",  "BoneKnife",  "JeansChaps";
    setarray $@illia_common_rewards_n$, "Steel Shield", "Warlord Helmet", "Knights Helmet", "Infantry Helmet", "Crusade Helmet", "Chainmail Shirt", "Light Platemail", "Warlord Plate", "Setzer", "Rock Knife", "Warlord Boots", "Forest Armor", "Forest Bow", "Wooden Staff", "Wizard Hat", "Wooden Shield", "Short Sword", "Silk Robe", "Leather Gloves", "Bone Knife", "Jeans Chaps";
    setarray $@illia_unique_rewards$,   "BullHelmet",  "BansheeBow",  "HeartOfIsis",   "LazuriteRobe";
    setarray $@illia_unique_rewards_n$, "Bull Helmet", "Banshee Bow", "Heart of Isis", "Lazurite Robe";
    end;

L_ResumePick:
    mes "Ok. I should continue to dig in this chest...";
    menu
        "... and quickly.", L_GetReward,
        "... or maybe not. I am out of time.", L_AskLeaving,
        "... but I can't carry more stuff.", L_AskLeaving,
        "... no, wait a minute.", L_Close;

L_Pick:
    menu
        "Let's take what I deserve for all this.", L_GetReward,
        "Wait.", L_Close;

L_GetReward:
    if (@illia_got_rewards == 0)
        goto L_GetCommonReward;
    if (@illia_got_rewards == 1)
        goto L_GetUniqueReward;
    goto L_Close;

L_GetCommonReward:
    if (@illia_current_num_rewards == $@illia_num_common_reward_items)
        goto L_RewardDone;
    getinventorylist;
    set @index, rand(getarraysize($@illia_common_rewards$));
    set @reward$, $@illia_common_rewards$[@index];
    if ((checkweight(@reward$, 1) == 0) || (@inventorylist_count == 100))
        goto L_InventoryNoSpace;
    set @illia_current_num_rewards, @illia_current_num_rewards + 1;
    getitem @reward$, 1;
    mes "You found a " + $@illia_common_rewards_n$[@index] + "!";
    set @reward$, "";
    goto L_GetCommonReward;

L_GetUniqueReward:
    if (@illia_current_num_rewards == $@illia_num_unique_reward_items)
        goto L_RewardDone;
    if (Illia_Uniques_Count >= 2)
        goto L_GetUniqueReward2;
    getinventorylist;
    set @index, rand(getarraysize($@illia_unique_rewards$));
    set @reward$, $@illia_unique_rewards$[@index];
    if ((checkweight(@reward$, 1) == 0) || (@inventorylist_count == 100))
        goto L_InventoryNoSpace;
    next;
    mes "You notice an interesting shape hidden under a cover...";
    next;
    set @illia_current_num_rewards, @illia_current_num_rewards + 1;
    getitem @reward$, 1;
    mes "You found a " + $@illia_unique_rewards_n$[@index] + "!";
    set Illia_Uniques_Count, Illia_Uniques_Count + 1;
    set @reward$, "";
    goto L_GetUniqueReward;

L_GetUniqueReward2:
    next;
    mes "You find a bunch of gold pieces!";
    next;
    set Zeny, Zeny + 100000*($@illia_num_unique_reward_items - @illia_current_num_rewards);
    getexp 200000*($@illia_num_unique_reward_items - @illia_current_num_rewards), 0;
    set @illia_current_num_rewards, $@illia_num_unique_reward_items;
    goto L_GetUniqueReward;

L_AlreadyGotReward:
    mes "I already took my part.";
    next;
    goto L_AskLeaving;

L_RewardDone:
    set @illia_got_rewards, @illia_got_rewards + 1;
    set @illia_current_num_rewards, 0;
    next;
    if (@illia_got_rewards == 1)
        goto L_GetUniqueReward;
    goto L_AskLeaving; // @illia_got_rewards == 2

L_InventoryNoSpace:
    mes "You cannot carry more stuff. Make some room first.";
    close;

L_AskLeaving:
    mes "It's time to leave this place now.";
    next;
    // Force the hero to leave last, as this event triggers the end of the quest
    // as well as some dialogs from Valia, when the hero returns.
    if (strcharinfo(0) == $@ILLIA_HERO$ && getareausers("052-2", 19, 8, 137, 88) > 1)
        goto L_WaitHelpersLeave;
    goto L_PrepareLeaving;

L_WaitHelpersLeave:
    mes "However, I'd better wait my friends leave before I do.";
    next;
    mes "I prefer to know they left safely this place.";
    close;

L_PrepareLeaving:
    mes "Use Valia's ring to teleport now?";
    menu
        "Yes. Time to make her pay for her trick!", L_Leave,
        "No, I still need to see things here.", L_Close;

L_Leave:
    set @illia_got_rewards, 3;
    set @illia_current_num_rewards, 0;
    addtimer 1000, "Chest#illia::OnMsg1";
    addtimer 4000, "Chest#illia::OnMsg2";
    addtimer 7000, "Chest#illia::OnMsg3";
    addtimer 9000, "Chest#illia::OnFx";
    addtimer 10000, "Chest#illia::OnRing";
    close;

OnMsg1:
    message strcharinfo(0), "At the moment you are wearing the ring, you start to feel dizzy...";
    end;

OnMsg2:
    message strcharinfo(0), "Who is Luvia? Something isn't right... It looks like your memory is rewritten.";
    end;

OnMsg3:
    message strcharinfo(0), "Damn, this ring! That Valia! Someone...";
    end;

OnFx:
    misceffect FX_MAGIC_BLUE_TELEPORT, strcharinfo(0);
    end;

OnRing:
    warp "007-2",31 + rand(0,2),23 + rand(0,2);
    if (strcharinfo(0) == $@ILLIA_HERO$)
        goto L_ScheduleEnd;
    end;

L_ScheduleEnd:
    set $@ILLIA_STATUS, 253;
    startnpctimer "Valia";
    donpcevent "#IlliaDaemon::OnCommandToggle";
    end;

L_Close:
    close;

}