summaryrefslogblamecommitdiff
path: root/npc/003-2/lua.txt
blob: 3513fcb5ecebd975f8c5781e7c976f5e9440378f (plain) (tree)
1
2
3
4
5
6
7
8


                


                                                                                                                        

                                                    


                                              
                           

                                                  
                           

                                                          
                           

                                       
                           

                                                     
                           
                                              
                                          

                                 

                                                     
                                                                                                                             

       
           

                                        
                                                                                                                                  


                                                                                

                                                                                                                   
                                                                                                                      
                                                                             
                                                                                                                           
                                                         
                                                                              





                                                           

















                                                                                 
          

                              
                                                  
                                                                    
                                                          



                                                              

                
          




                                                                                                                
                                         
                            

                                                                                





                                                              
              
              

                                                                                
                                      
                 




                               
                                                                                          
           




                                                                 
           
                                           
           

                                  



                                                
                                                  
                                                     



                       
                                        






                                         
                

                                        
                                          
                 









                                                       


                                                                                      
                       
 




                                                            
                                                                                                        
                                                              

                          
 












                                                                                                              



                



















                                                                                 
       





                                                                                                 

                                                                                                          





                                                               








                                                                                       
                                                                                                                







                                                                                                                 
                                                                                                                           
         



                                                                                                                                                 
         
                                                                 
                                
         

                                                                                                                                                                                                               


                





















                                     
 
                                                        

                    




                                      

                           




                                      

                           




                                      

                           




                                      
                           




                               



                                       
     


                                                                              
          
 
 
 



                         





















                                                                                                                                                                                                               

                   
 
                   
                                                                                                                                   

                                                              


           




                                       

 

 
                         
         
                                                                                          
                                                                                                                                                                                                                                       















                                                                                                                                                                                                         
                                                       

                                                                                                                                                         
         














                                                                                                                                                                                                                                  
              
                   




                                                                                                           

                                                                         


           
                        
                         


                               

 

 
                         
                                                                                                   
 





                                                                                                             
                                                   








                                                                                                                                                              
 
                                  
         



                                   

                           
                   





                                                                         
                                                                    
 
                                                           


           

                              
                        
                      

 

 

 
                         











                                                                                                                                                                        
 
                                  
         

                            



                   
                                                             


           
                        
                                 

 

 

 
                         










                                                                                                                                  

         

















                                                                                                                                                                                                  
                    
                                                                                              
         
 

                                                                                                                                                                        
                                                                                                                                                                                  





                                                                                                                                                                        
                                                                                             


                         
                                     



                          
                                                                                                

           
                                                                          
           
                                                                                          




                                                                                                                                                      


           
                        
                                          

 

 

 

                                          
         
                                  
                                                                  
                                
                           
                    
         
                                                                                                                         
         
         
                                                                                                                                                                                

         
                                                                                                                     
         



                                                                                                    
                          











                                                                                                                                            

                                                                                                                                   
         












                                                                                                                                                                                  

                                                                                                             

          









































                                                                                 

         


                                                                                                                                 

         


                                                                                                                                                 


                                                                                                                                                                                                                 



































                                                                                                                                                                                                                                                 

          






















                                                                                                                                                  
                  
                                                                                                                                                
                       
                                                                                                                                                                                  
                       




                                                                                                                                             














                                                                                 














                                                                                                              
                                                           
                                                                                     




                                                                
                                                       
                                          

                         
           

                    
                                                      
               
                                                                          
               
                                          
               
                                                   
               
                                                    
               
                                                     
               
                                                 
               
                                                        
               






                                                                        
                                                        


                               


          







                           
                                   







                                                                         



          
                               


                                                         
                                                

                                            
                                                                    
                                                                    




                    
// TMW2 Scripts.
// Author:
//  Jesusalva
// Description:
//  Lua is an Alliance Officer. She takes care of miscelanneous administrative tasks, including Strange Coin generation.
//  She can also change the world's hero, give Sponsor their necklace, and is part of main storyline.

003-2,38,34,0	script	Lua#003-2	NPC_FEMALE,{
    // Main Quest 2-1 until Main Quest 2-5 (?)
    function luaAssignTask1; // Dausen & Aidan
    function luaTask1;
    function luaCheckTask1;
    function luaAssignTask2; // Fishing & Crafting
    function luaTask2;
    function luaCheckTask2;
    function luaAssignTask3; // Minimum level/job to begin
    function luaTask3;
    function luaCheckTask3;
    function luaAssignTask4; // Inn Arc
    function luaTask4;
    function luaCheckTask4;
    function luaAssignTask5; // Your Report, the plan
    function luaTask5;
    function luaCheckTask5;
    function luaCReward; // Contributor Reward
    // Then we jump to L_Finish/L_Complete
    .@n = getq(General_Narrator);

    mesn;
    mesq l("Hello, I act on the Alliance's behalf.");
    mesc l("If you want to know what the Alliance is up to, you might have better luck talking to Jerican, from the Press.");

L_Menu:
    mes "";
    menu
        l("Ok, see you later."),L_Close,
        rif(.@n == 1, l("I was found near Candor Island, on a raft, and can't remember anything. Do you know who I am?")), L_Info,
        rif(.@n == 2, l("What you asked me for, again?")), L_Task,
        rif(.@n == 3, l("Where I needed to go, again?")), L_Complete,
        rif(.@n >= 4, l("Do you think I'm ready to go to Halinarzo?")), L_Check,
        rif(is_gm(), l("I need a GM set, please!")), L_GMItems,
        rif(is_gm() && #GMEVENT_T <= gettimetick(2), l("I plan in doing an event! Give me the coins!")), L_GMEvent,
        rif(is_gm() && #GMEVENT_T > gettimetick(2), l("Trade my coins in Gift Boxes, pretty please!")), L_GMEventShop,
        rif(is_staff(), l("Tell people the name of a new hero.")), L_NewHero,
        rif((getgmlevel() == 1 || is_admin()) && #T_SPONSOR <= gettimetick(2), l("I want a Sponsor Necklace.")), L_Sponsor,
        l("Do you have any tips for beginners?"), L_Tips,
        l("I am a contributor, and I want contributor stuff."), L_Contributor,
        l("What alliance?"),-;
    mes "";
    mesn;
    mesq l("The Alliance which was formed after the war!");
    close;

















/////////////////////////////////////////////////////////////////////////////////
// GM Functions
L_GMItems:
    getitembound GMRobe, 1, 1;
    getitembound GMCap, 1, 1;
    logmes(strcharinfo(0)+" just took a GM set.");
    logmes(strcharinfo(0)+" just took a GM set.", LOGMES_ATCOMMAND);
    consoleinfo("%s retrieved a GM set.", strcharinfo(0));
    mes "";
    mesn;
    mesq lg("Here they are, miss.", "Here they are, mister.");
    mes "";
    goto L_Menu;

L_GMEvent:
OnGMCoinClaim:
    if (!is_gm() || #GMEVENT_T > gettimetick(2)) {
        dispbottom l("ERROR: You already took the coins today. Please wait @@ more.", FuzzyTime(#GMEVENT_T)), 1;
        end;
    }
    #GMEVENT_T=gettimetick(2)+(60*60*24);
    getitem StrangeCoin, 30;
    //logmes(strcharinfo(0)+" just took thirty event coins.");
    //logmes(strcharinfo(0)+" just took thirty event coins.", LOGMES_ATCOMMAND);
    mes "";
    mesn;
    mesq lg("Here they are, miss.", "Here they are, mister.");
    mes "";
    goto L_Menu;

OnGMEventShop:
L_GMEventShop:
    // Inflaction: Non-admins pay more out of main events (for whatever reasons)
    .@inf=1;
    if (!is_master() && $EVENT$ == "")
        .@inf+=1;

    // Main Code
    .@s=countitem(StrangeCoin);
    mes "";
    mesn;
    mesq l("You currently have @@ @@.", countitem(StrangeCoin), getitemlink(StrangeCoin));
    mes "";
    mesc l("@@ - @@ coins", getitemlink(BronzeGift), 10*.@inf);
    mesc l("@@ - @@ coins", getitemlink(SilverGift), 20*.@inf);
    mesc l("@@ - @@ coins", getitemlink(GoldenGift), 40*.@inf);
    mesc l("@@ - @@ coins", getitemlink(PrismGift), 80*.@inf);
    mesc l("@@ - @@ coins", getitemlink(SupremeGift), 160*.@inf);
    mes "";
    mesc l("Fruits - @@ coins", 100*.@inf);
    mes "";
    menuint
        "Return to main menu", -1,
        rif(.@s > 10*.@inf, "Bronze Gift"),  10,
        rif(.@s > 20*.@inf, "Silver Gift"),  20,
        rif(.@s > 40*.@inf, "Golden Gift"),  40,
        rif(.@s > 80*.@inf, "Prism Gift"),   80,
        rif(.@s > 160*.@inf, "Supreme Gift"), 160,
        rif(.@s > 100*.@inf, "Statusup Fruits"), 100;

    if (@menuret == -1)
        goto L_Menu;

    delitem StrangeCoin, @menuret*.@inf;
    switch (@menuret) {
        case 10:
            getitem BronzeGift, 1; break;
        case 20:
            getitem SilverGift, 1; break;
        case 40:
            getitem GoldenGift, 1; break;
        case 80:
            getitem PrismGift, 1; break;
        case 160:
            getitem SupremeGift, 1; break;
        case 100:
            menuint
                "Strength Fruit",StrengthFruit,
                "Agility Fruit",AgilityFruit,
                "Vitality Fruit",VitalityFruit,
                "Intelligence Fruit",IntelligenceFruit,
                "Dexterity Fruit",DexterityFruit,
                "Luck Fruit",LuckFruit,
                "Mysterious Fruit",MysteriousFruit;
            mes "";
            getitem @menuret, 1; break;
        default:
            mesc(l("A script error happened, please report: @@", @menuret), 1); break;
    }
    goto L_GMEventShop;

L_NewHero:
    mes "";
    mes l("Current hero: @@", $MOST_HEROIC$);
    input .@MH$;
    logmes "Changing hero from "+$MOST_HEROIC$+" to "+.@MH$;
    logmes(strcharinfo(0)+" changed the world's hero ("+$MOST_HEROIC$+"->"+.@MH$+")", LOGMES_ATCOMMAND);
    consoleinfo("%s changed the world hero.", strcharinfo(0));
    $MOST_HEROIC$ = .@MH$;
    goto L_Menu;

L_Sponsor:
    #T_SPONSOR=gettimetick(2)+(60*60*24*30);
    rentitem "SponsorNecklace", (60*60*24*30);
    logmes(strcharinfo(0)+" just took a Sponsor Necklace.");
    logmes(strcharinfo(0)+" just took a Sponsor Necklace.", LOGMES_ATCOMMAND);
    mes "";
    mesn;
    mesq lg("Here it is, miss.", "Here it is, mister.");
    mes col("This item will be returned in 30 days counting from now, and you will need to take another.", 9);
    mes col("It cannot be dropped, traded, sold, but you can store it and use with same account.", 9);
    mes "";
    goto L_Menu;

OnLuaInfo:
    @lua_isok=1;
    end;



















/////////////////////////////////////////////////////////////////////////////////
// Main Story Functions
L_Info:
    if (!@lua_isok) {
        mes "";
        mesn;
        mesq l("Of course, give me just a minute to look up for your data, @@.", strcharinfo(0));
        next;
        mesn;
        mesq l("Please wait here on the meanwhile. Try asking Estard about parties, or talk to Eistein.");
        //mesq l("You can explore the city on the meanwhile, I need to inspect the data.");
        if (!@lua_init) {
            @lua_init=1;
            addtimer(rand(55000,65000),"Lua#003-2::OnLuaInfo");
        }
        close;
    }
    mes "...";
    next;
    mes "... ...";
    next;
    mes "... ... ...";
    next;
    mesn;
    mesq l("No criminal record, no bank account, not even a tax payment declaration.");
    next;
    mesq l("I found your birth record, but it is not complete. Here says you were born on @@.", b("Halinarzo"));
    next;
    mesq l("The problem is that Halinarzo was destroyed in the never-ending war and was just recently rebuilt.");
    next;
    mesq l("Almost all documents were lost, destroyed or damaged. I cannot even find your parents name.");
    next;
    mesq l("All I can say is that you were born there, and moved by the age of 4, but to where? I don't know.");
    next;
    mesn;
    mesq l("Sorry. At best, you can try your luck in Halinarzo, but the odds of someone recognizing you are pretty slim.");
    next;
    mesn;
    mesq l("However...");
    mesq l("You will be killed on the road if you try to go like this. The Canyon route is dangerous, and the Swamps route claimed many souls.");
    mesq l("Not to say about bandits and robbers you'll find.");
    next;
    getexp BaseLevel*30, JobLevel*5; // Reference Levels: (10, 3)
    setq General_Narrator, 2, 0;
    mesn;
    mesq l("Lucky for you, the Alliance have means to assist you. You'll be a grown up, full fledged adventurer in no time at all, and will be able to visit a friend of mine, who will then send you there.");
    next;
    goto L_Task;

L_Task:
    .@q2=getq2(General_Narrator);
    if (.@q2 == 0) {
        luaAssignTask1();
        setq2 General_Narrator, 1;
        .@q2=getq2(General_Narrator);
    } else if (.@q2 == 2) {
        luaAssignTask2();
        setq2 General_Narrator, 3;
        .@q2=getq2(General_Narrator);
    } else if (.@q2 == 4) {
        luaAssignTask3();
        setq2 General_Narrator, 5;
        .@q2=getq2(General_Narrator);
    } else if (.@q2 == 6) {
        luaAssignTask4();
        setq2 General_Narrator, 7;
        .@q2=getq2(General_Narrator);
    } else if (.@q2 == 8) {
        luaAssignTask5();
        setq2 General_Narrator, 9;
        .@q2=getq2(General_Narrator);
    }

    mesc b(l(".:: Main Quest 2-%d ::.", (.@q2+1)/2)), 3;
    if (.@q2 == 1) {
        luaTask1();
        next;
        if (luaCheckTask1()) {
            setq2 General_Narrator, 2;
            goto L_Task;
        }
    } else if (.@q2 == 3) {
        luaTask2();
        next;
        if (luaCheckTask2()) {
            setq2 General_Narrator, 4;
            goto L_Task;
        }
    } else if (.@q2 == 5) {
        luaTask3();
        next;
        if (luaCheckTask3()) {
            setq2 General_Narrator, 6;
            goto L_Task;
        }
    } else if (.@q2 == 7) {
        luaTask4();
        next;
        if (luaCheckTask4()) {
            setq2 General_Narrator, 8;
            goto L_Task;
        }
    } else if (.@q2 == 9) {
        // Task 5 is special
        if (!luaCheckTask5()) {
            luaTask5();
            next;
        }
        if (luaCheckTask5()) {
            setq2 General_Narrator, 10;
            goto L_Finish;
        }
    }
    //Exception("Something went wrong, this is not a valid MQ2 state: "+.@q2);
    mesn;
    mesq l("Safe travels!");
    close;





// Declare functions
function luaAssignTask1 {
    mesn;
    mesq l("First and foremost, you should get yourself some reputation. I mean, right now, you are a complete nobody who was found on the sea.");
    next;
    mesn;
    mesq l("As far as we are concerned, you could have been an exiled prisoner who managed to escape! But there are ways to prove to the Alliance that your intentions are good.");
    next;
    mesn;
    mes l("%s is by becoming a %s.", b(l("The first way,")), b(l("Monster Hunter")));
    // If you skipped Tutorial: You already know all this
    tutmes l("Monster Hunters receive small bounties on a special currency, of Monster Points, for each monster they kill. The amount gained is based on the monster level."), l("Monster Hunter");
    tutmes l("You can become a Monster Hunter by signing up with %s, near the Market.", b("Aidan")), l("Monster Hunter");
    next;
    mesn;
    mes l("%s is by impressing the town guard.", b(l("The second way,")));
    // If you skipped Tutorial: You already know all this
    tutmes l("Also near the market, look for %s. He is the chief of the City Guard. Ask if he need help, and help him!", b(l("Lieutenant Dausen"))), l("Monster Hunter");
    tutmes l("If he gives you a guard card, that'll allow access to the Guard House, where you can pick Daily Bounties for monsters. These will pay you in GP."), l("The Guard House");
    tutmes l("Tulimshar is the strongest city because Dausen teaches every newcomer about the monsters around and how to defeat them. Take his special training if you get the chance!"), l("The Guard House");
    next;
    mesn;
    mesq l("You don't need to do both right now, even if you probably will want to. Once any (or both) of them tell me you're an OK person, I'll start helping you.");
    next;
    return;
} // Dausen & Aidan

function luaTask1 {
    msObjective(countitem(TulimsharGuardCard), l("* @@/@@ @@", countitem(TulimsharGuardCard), 1, getitemlink(TulimsharGuardCard)));
    mes l("--- OR ---");
    msObjective(MPQUEST, l("* Register as a Monster Hunter"));
    return;
}

function luaCheckTask1 {
    return (MPQUEST ||
        countitem(TulimsharGuardCard));
}





function luaAssignTask2 {
    mesn;
    mesq l("Great! Here, I'll give you %d GP so you can start here with more ease.", 700);
    tutmes l("You can get money in several ways, including by selling monster parts, doing daily quests, gambling, and even becoming the mayor of a town. Read the [@@help://faq|FAQ@@] (opens ingame) for help."), l("Getting Money");
    next;
    mesn;
    mesq l("Well, I have a small problem. Sorry, but my superior officer did not like you. This happens, not everyone will like us, right? A lot of adventurers actually hate me %%R");
    next;
    mesn;
    mes l("Anyway, he had a point. What will you do once the Monster War is over?");
    if (MPQUEST)
        mes l("The monster hunting program will end, and what will you do?");
    if (countitem(TulimsharGuardCard))
        mes l("The city guard won't need help from strangers anymore.");
    next;
    mesn;
    mesq l("So, you need an alternative way to earn a living. So I looked at what is at highest demand right now, and which will remain once the war ends, and I've found you... %s!", b(l("two jobs")));
    next;
    mesn;
    mes l("%s is by becoming a %s.", b(l("The first job,")), b(l("Fisherman/Fisherwoman")));
    mes l("Food is, and should always be, in demand.");
    // If you skipped Tutorial: You already know all this
    tutmes l("Fishing is a boring task. Throw the bait, wait for fish to bite. Pull before it is too late. Then sell the fish for money."), l("Fishing");
    next;
    mes l("However, you need a %s or a Fishing Net. There's one fisherman in Tulimshar Center, called Eugene. He should have one, but he lives isolated on a small island... Good luck getting to him.", getitemlink(FishingRod));
    tutmes l("The path to reach Eugene is hidden. However, if you pay attention to the map, you should figure out how to reach that island without swimming."), l("Secret Passages");
    next;
    mesn;
    mes l("%s is by becoming a %s.", b(l("The second job,")), b(l("Craftsman/Craftswoman")));
    tutmes l("One of the most important jobs on Moubootaur Legends, crafted equipment is much stronger than regular ones. Specially weapons."), l("Crafting");
    tutmes l("To craft an item, you'll need to learn its blueprint. Blueprints can be very hard to obtain! Being a crafter will take a lot of your time."), l("Crafting");
    next;
    mesn;
    mesq l("I think Intense Beard, on Tulimshar's Forge, was taking new apprentices. Try talking to him!");
    next;
    mesn;
    mesq l("Again, you don't need to do both right now, but you probably will want to. Once you have a stable alternative income, I'll have... This paperwork sorted.");
    // Rewards from previous quest
    next;
    Zeny+=700;
    getexp 200, 20;
    return;
} // Fishing & Crafting

function luaTask2 {
    msObjective(countitem(FishingRod), l("* @@/@@ @@", countitem(FishingRod), 1, getitemlink(FishingRod)));
    mes l("--- OR ---");
    msObjective(CRAFTQUEST, l("* Register as a Craftsman/Craftswoman."));
    return;
}

function luaCheckTask2 {
    return (CRAFTQUEST ||
        countitem(FishingRod));
}





function luaAssignTask3 {
    inventoryplace Bread, 10, BottleOfTonoriWater, 1, SmokeGrenade, 3, CrazyRum, 1, EarthPowder, 1;

    mesn;
    mesq l("Congratulations! I've managed to process your paperwork. Here, you'll receive the starter kit!");
    mesc l("* %d %s", 10, getitemlink(Bread));
    mesc l("* %d %s", 3, getitemlink(SmokeGrenade));
    mesc l("* %d %s", 1, getitemlink(BottleOfTonoriWater));
    mesc l("* %d %s", 1, getitemlink(CrazyRum));
    mesc l("* %d %s", 1, getitemlink(EarthPowder));
    next;
    mesn;
    mesq l("I've also got in contact the other alliance representatives, and I've found out there's a way to bring you to Halinarzo, using Hurnscald route!");
    next;
    mesn;
    mesq l("...Well, but even if Hurnscald is nearby, you are too weak. You know sometimes, ships get attacked by pirates, right?");
    next;
    mesn;
    mesq l("So, I'll have to ask you to get strong and some money for the trip. So, go train now! I wish you the best of the luck!");

    // Rewards from previous quest
    next;
    getitem Bread, 10;
    getitem BottleOfTonoriWater, 1;
    getitem SmokeGrenade, 3;
    getitem CrazyRum, 1;
    getitem EarthPowder, 1;
    Zeny+=350;
    getexp 250, 25;
    return;
} // Minimum level/job to begin

function luaTask3 {
    msObjective(BaseLevel >= 20, l("* @@/@@ Base Level", BaseLevel, 20));

    msObjective(JobLevel >= 7, l("* @@/@@ Job Level", JobLevel, 7));

    msObjective(Zeny >= 1500, l("* @@/@@ GP", Zeny, 1500));
    return;
}

function luaCheckTask3 {
    return (BaseLevel >= 20 &&
        JobLevel >= 7 &&
        Zeny >= 1500);
}





function luaAssignTask4 {
    mesn;
    mesc l("*cheerful*");
    mesq l("Congratulations on reaching level 20!");
    next;
    mesn;
    mesq l("I bet you are dead tired, and the ship travel takes a long time.");
    next;
    mesn;
    mesq l("But don't worry! South of here we have an Inn.");
    next;
    mesn;
    mesq l("It's the least I could do for having you to go through all this struggle. I've already paid everything, so just talk to the receptionist for your room :>");

    // Rewards from previous quest
    next;
    LUA_ASKED_TO_SLEEP=true;
    getexp 200, 20;
    return;
} // Inn Arc

function luaTask4 {
    msObjective(!LUA_ASKED_TO_SLEEP, l("* Rest at the Inn"));
    return;
}

function luaCheckTask4 {
    return (!LUA_ASKED_TO_SLEEP);
}





function luaAssignTask5 {
    inventoryplace MercBoxAA, 1;

    mesn;
    mesc l("You tell Lua everything you've heard at the Inn.");
    next;

    mesn;
    mesq l("The Professor? Wait, THE Professor? As in, the wisest person on Tulimshar?");
    next;
    mesn;
    mesq l("The Professor is so wise that even if you fall asleep while listening to his invisible speech, you'll still learn!!");
    next;

    select
        l("Who is this professor?"),
        l("What can I do?");
    mes "";
    if (@menu == 1) {
        mesn;
        mesq l("Who is the Professor? I've heard he was the father of a certain Arthur... No idea.");
        tutmes l("The professor is always on the Magic Council, the northmost building. If you sit on the area in front of him (marked with a red rug), you'll gain Experience, even while AFK.");
        next;
        mesn;
        mesq l("But who cares? We need to save the Professor! During night, monsters are stronger, so they'll probably attack at night time!");
    } else {
        mesn;
        mesq l("You need to save the Professor! During night, monsters are stronger, so they'll probably attack at night time!");
    }
    next;
    mesn;
    mesq l("During night the professor also goes to the Magic Academy, using the hidden north port, on the building to left of the Magic Council...");
    if (!is_night())
        mesc l("However, it's also possible they're there already. Be careful for ambushes!");
    next;

    mesn;
    mesq l("Here, I'll give you a Mercenary Box. Open it, get the mercenary card, and summon it when needed. You absolutely CANNOT let the Professor be assassinated!");
    tutmes l("Explain briefly about mercenaries... I mean, we have a Mercenaries section on @tutorial right? I don't know much myself!"); // <-- TODO and add on the wiki as well!
    tutmes l("You can only have one mercenary active at a time, they die and will leave after 10 minutes - logged in or not.");
    tutmes l("Still, they can be useful when you're trying to solo a boss and need help. The number of stars on the card is the strength and rarity. Use them wisely.");

    next;
    mesn;
    mesq l("Now go! Lives are at stack!");
    mesc l("NOTE: The Energy Ball explosion may instantly kill you. Make it a priority!"), 1;

    next;
    getitem MercBoxAA, 1;
    LUA_ASKED_TO_SAVE_PROFESSOR=true;
    return;
} // Your Report, the plan

function luaTask5 {
    //mesc l("NOTE: This quest is still a work in progress. \"Bugs\" will show up on purpose.");
    mes "";

    msObjective(!LUA_ASKED_TO_SAVE_PROFESSOR, l("* Defeat the Assassin"));
    mes "";
    mesc l("NOTE: The Energy Ball explosion may instantly kill you. Make it a priority!");
    next;
    mesn;
    mesq l("During night the professor also goes to the Magic Academy, using the hidden north port, on the building to left of the Magic Council...");
    if (!is_night())
        mesc l("However, it's also possible they're there already. Be careful for ambushes!");
    return;
}

function luaCheckTask5 {
    return (!LUA_ASKED_TO_SAVE_PROFESSOR);
}





// Then we jump to L_Complete
// When you finish the last quest from Lua
L_Finish:
    inventoryplace TreasureKey, 1;
    getexp BaseLevel*60, JobLevel*10; // Reference Levels: (20, 6)
    setq General_Narrator, 3, 0;
    getitem TreasureKey, 1;
    getvaultexp(10);
    mesn;
    mesq l("Well done! I hope no more of those assassins show up. I'm afraid I cannot give you a proper reward, but...");
    next;
    mesn;
    mesq l("Ah, you might have seen a treasure chest on the mines. There are several of these chests to loot, and loot again! Here is a @@. Try it!", getitemlink(TreasureKey));
    next;
    mesn;
    mesq l("Hopefully, you'll find something interesting on it to serve as a payment. It's up to luck, I guess....");
    next;
L_Complete:
    mesn;
    mesq l("You see the docks on the other side of the town? There should be a ship docked there.");
    next;
    if (!$HURNS_LIBDATE) {
        mesn;
        mesq l("The ship can bring you to the town of Hurnscald, but we have a problem: It is currently being occupied by a Monster Army.");
        next;
        mesn;
        mesq l("That would be your next destination, but first, the monster army must be driven out!");
        next;
        mesn;
        mesq l("The Game Masters are assembling a party to storm Hurnscald and liberate it. You should try joining it!");
        next;
        mesc l(">> Hurnscald must be Liberated first, to continue this story <<"), 1;
        close;
    }
    mesn;
    mesq l("You already got the money. Go there and pay ##B Hurnscald ##b a visit. The ##B mayor ##b should be able to help you.");
    next;
    mesn;
    mesq l("Ship travels are quite expensive, so perhaps you may think it is worth to complete the other quests here?");
    next;
    .@r=reputation("Tulim");
    mesn;
    if (.@r <= 35)
        mesq l("Try helping the city guard. Talk to NPCs around the city. Outside the city walls too. And there are some people on the mines.");
    else if (.@r <= 60)
        mesq l("You are doing some progress. There are about 4 quests on the mines, 1 outside walls, and 10 on the town. Some require level, so talk to people again sometimes.");
    else if (.@r <= 85)
        mesq l("You'll soon run out of stuff to do around here, so yeah, you should extend your horizons or you may get bored soon enough.");
    else
        mesq l("Tulimshar doesn't have a lot more of quests to offer you, so you should definitely explore new places.");
    if (BaseLevel < 30)
        mesq l("I'm sure there are a lot of sidequests here until you reach level 30, but that's optional.");
    close;









































/////////////////////////////////////////////////////////////////////////////////
// Beginner Guide Functions
L_Tips:
    mesn;
    mes l("Hmm... First of, I would really add some agility. Agility helps you to don't be hit, and not being hit is awesome.");
    mes l("Hm, I would also do some quests if I needed money... On other hand, maybe I could go fishing? Do I know any fisher?");
    mes l("Ah, getting experience is hard, too... I would stay within the city. Hit and Run tactics works the best.");
    next;
    mesn;
    mes l("Hit'n'run is not so hard... One hit, one step back... One hit, another step back... One miss, two steps back...");
    mes l("That works with most of monsters. Well, but we all know from @@ that it is better to stay put and let mobs kill us, right?", "Apane");
    mes l("Heh, there is death penalty outside the town. You better watch out. The mobs are on a foul mood today, very easy to get killed.");
    next;
    mes l("Failing all else, you can stay at the Magic Council getting experience for sitting. Hopefully you'll gain a level and this will help you a bit.");
    mes l("Of course, if your problem is only experience, then you should look for %s and other EXP-boosting drinks. Some are sold, some are made, some are dropped, some are... magical...", getitemlink(Beer));
    next;
    mesn;
    mesc l("%s thinks if she knows any major, good quest to do.", .name$);
    if (!countitem(TulimsharGuardCard)) {
        mes l("Tulimshar Guard Card will prove good intentions. Talk to the Lieutenant in front of the Guard House.");
        mesc l("Completing this quest will allow access to the Guard House, where you can pick Daily Bounties for monsters.");
        mes "";
    }
    if (!countitem(FishingRod)) {
        mes l("The fishing rod allows a quick income by selling fishes. However, reaching the fisherman might require some exploration... The whole world is full of secrets.");
        mes "";
    }
    if (!countitem(LifestonePendant)) {
        mes l("The lifestone pendant allows you a quicker HP recovery. Life is more important than defense.");
        mes l("I have no idea about who would make a pendant, but lifestone can be done just outside the town walls.");
        mes "";
    }
    if (!getq(TulimsharQuest_Sailors) < 2) {
        mes l("There are some sailors near the forge. Think outside the box - or rather, inside it, unless you have a fortune to buy the items.");
        mes "";
    }
    if (!(CRAFTQUEST || MPQUEST)) {
        mes lg("To register as a craftswoman, you need to talk to Intense Beard in Terranite Forge. The forge is in the Bazar.", "To register as a craftsman, you need to talk to Intense Beard in Terranite Forge. The forge is in the Bazar.");
        mes l("To register as a hunter, talk to Aidan, also in the marketplace - the Bazar.");
        mesc l("You can, and @@, register on both programs.", b(l("SHOULD")));
        mes "";
    }
    if (BaseLevel < 20) {
        mes l("If you are in need to get lots of experience quickly, you should try to engage the bigger and stronger monsters in the town. However, if they hit you, it's Soul Menhir for you.");
        next;
        mes l("Another way to quickly get experience at lower levels, is visiting %s and talking to Professor. I heard those whom sit at the rug gain exp just by listening.", b(l("Magic Council")));
        next;
        mes l("But the most useful thing might be drinking %s and the like. They also boost drop rates, but weak drinks effects are low and short.", getitemlink(Beer));
        mes "";
    }
    mesc l("She can't remember if anything else right now.");
    close;

L_Check:
    mesn;
    mesq l("Hmm... That's a though question!");
    next;
    mesn;
    if (BaseLevel < 20)
        mesq l("Currently, you stand no chance against the Snakes on the Desert Canyon.");
    else if (BaseLevel < 25)
        mesq l("Currently, you should not attempt the Desert Canyon because low level.");
    else if (BaseLevel < 30)
        mesq l("Currently, you stand no chance against the Snakes on the Desert Canyon, but you probably can cross it.");
    else if (BaseLevel < 40)
        mesq l("I'm pretty confident you can attempt the Desert Canyon, but expect to die a few times.");
    else if (BaseLevel < 50)
        mesq l("You have a high level. Go to Halinarzo already! You could even, I don't know, search for magic?!");
    else
        mesq l("Your level is so high, I'm surprised you haven't went there already. But then, most quests around there are for your level...");
    next;
    mesn;
    mesq l("Bows are good, but if you're going to the Desert Canyon, I would instead invest on a light shield. Heavy ones make you walk slower.");
    next;
    .@r=reputation("Tulim");
    mesn;
    if (.@r <= 35)
        mesq l("Try helping the city guard. Talk to NPCs around the city. Outside the city walls too. And there are some people on the mines.");
    else if (.@r <= 60)
        mesq l("You are doing some progress. There are about 4 quests on the mines, 1 outside walls, and 10 on the town. Some require level, so talk to people again sometimes.");
    else if (.@r <= 85)
        mesq l("You'll soon run out of stuff to do around here, so yeah, you should extend your horizons or you may get bored soon enough.");
    else
        mesq l("Tulimshar doesn't have a lot more of quests to offer you, so you should definitely explore new places.");
    close;














/////////////////////////////////////////////////////////////////////////////////
// Contributor Functions
L_Contributor:
    mes "";
    .@m = htget($@CONTRIBUTORS, strtolower(strcharinfo(0)), 0);
    if (!.@m) {
        mesn;
        mesq l("Ah... Sorry, your name is not on the contributor list.");
        next;
        mesn;
        mesq l("You can colaborate with our project though! Just ask on #tmw2-dev, be it on Discord or IRC!");
        close;
    }
    mesn;
    mesq l("Ah, welcome @@. You have @@ Contributor Points.", strcharinfo(0), .@m);
    mesq l("Let's see if you can pick a reward!");
    select
        rif(!(#CRW & 128) && .@m >= 250, l("30x Bug Leg")),
        rif(!(#CRW & 64) && .@m >= 100 && Zeny > 10000, l("(10,000 GP) Epic Mount")),
        rif(!(#CRW & 32) && .@m >= 50, l("Developer Cap")),
        rif(!(#CRW & 16) && .@m >= 40, l("Delicious Cookie")),
        rif(!(#CRW & 8) && .@m >= 30, l("20x Bug Leg")),
        rif(!(#CRW & 4) && .@m >= 20, l("Contributor Sweater")),
        rif(!(#CRW & 2) && .@m >= 10, l("Community Shirt")),
        rif(!(#CRW & 1) && .@m, l("5x Strange Coins")),
        l("Which rewards are available?"),
        l("Ok, thanks.");

    mes "";
    switch (@menu) {
        case 1:
            luaCReward(BugLeg, 128, false, 30); break;
        case 2:
            Zeny=Zeny-10000; luaCReward(LegendaryMouboo, 64, true); break;
        case 3:
            luaCReward(DEVCap, 32); break;
        case 4:
            luaCReward(DeliciousCookie, 16); break;
        case 5:
            luaCReward(BugLeg, 8, false, 20); break;
        case 6:
            luaCReward(ContributorSweater, 4); break;
        case 7:
            luaCReward(CommunityShirt, 2); break;
        case 8:
            luaCReward(StrangeCoin, 1, false, 5); break;
        case 9:
            mesf("250 - 30x %s", getitemlink(BugLeg));
            mesf("100 (+10,000 GP) - %s", getitemlink(LegendaryMouboo));
            mesf("50 - %s", getitemlink(DEVCap));
            mesf("40 - %s", getitemlink(DeliciousCookie));
            mesf("30 - 20x %s", getitemlink(BugLeg));
            mesf("20 - %s", getitemlink(ContributorSweater));
            mesf("10 - %s", getitemlink(CommunityShirt));
            mesf("1 - 5x %s", getitemlink(StrangeCoin));
            next;
            goto L_Contributor;
            break;
    }
    close;

function luaCReward {
    .@it=getarg(0);
    .@cr=getarg(1);
    .@bd=getarg(2, false);
    .@am=getarg(3, 1);
    if (!.@bd)
        getitem .@it, .@am;
    else
        getitembound .@it, .@am, 1;
    #CRW=#CRW|.@cr;
    logmes(sprintf("%s has claimed a(n) %s with Contributor Points.",
                   strcharinfo(0), getitemname(.@it)));
    logmes(sprintf("%s has claimed a(n) %s with Contributor Points.",
                   strcharinfo(0), getitemname(.@it)), LOGMES_ATCOMMAND);
    return;
}

L_Close:
    close;

OnInit:
    .@npcId = getnpcid(.name$);
    setunitdata(.@npcId, UDT_HEADTOP, NPCEyes);
    setunitdata(.@npcId, UDT_HEADMIDDLE, GMRobe);
    setunitdata(.@npcId, UDT_HEADBOTTOM, LousyMoccasins);
    setunitdata(.@npcId, UDT_WEAPON, BugSlayer);
    setunitdata(.@npcId, UDT_HAIRSTYLE, 12);
    setunitdata(.@npcId, UDT_HAIRCOLOR, 5);
    bindatcmd "strangecoin", "Lua#003-2::OnGMCoinClaim", 60, 100, 1;
    bindatcmd "strangeshop", "Lua#003-2::OnGMEventShop", 60, 100, 1;

    .sex = G_FEMALE;
    .distance = 4;
    end;
}