summaryrefslogblamecommitdiff
path: root/npc/functions/clientversion.txt
blob: 6882e2e363ab4b1e5af7cf5f32c855bf18ec1a14 (plain) (tree)
1
2
3
4
5
6
7
8
9
               


                  
               

                                                                        
                                                               
 
                                         
                                    
                               
                              
     
 
           
                   
                                                       

                                   
                           

                                                                                                                  

                                                         
                                          
                          

                           

                                                                                                    
                                  
     
                                                   



                                                                                             
                            




                                    



                                                                                      
                                               
                         









                                         









                                                   



                                                 

                                              
 
                                                                
     



                                                      



                                                                                                                                             


                                                              
                                             
                                              



                                        
                                                                                                                           



                                                                                                                         
         
 

                                                  
                                             



                                        
                                                                                                                                      













                                                                                                                         
         
     




                                   
                   







                                                                                                                                         
                                
                 

         
                   





                                              
                                                               
               
                                                
     







                                         
                                                                                                                                     

                                                                                                                                                                 
                                                                          
                                                                                                      

                                                                                           
                                   
                                



                                                                    
                             

                                      

                 




                                         
                                
         

















                                                                                               
     


                                   
                          


                                         








                                              
                                                                     






                                              




                                                                                    








                                                                                          
                                                                                             
                                         
                                                                                           

                          



                                   

                                                                                    
     







                                   

                                        




                                                   




                                                                                                                                               
     

                                   

                              
                  

                                                             


                                  



                                                                                     
                                                                                              
         




                                                                  

                                         
                                          
                                                                                                                      
         



                                                                            
         


                                 
                               
                        
                       
                                                                                                            


                                                     
                                     
                                                                    
         
                           

                                                               
                                       
                             
                                                                          

                                                                           





                                                                        


                                    
                             




                                  


                                       





                                      









                                        





                                      
                                                                                                   



                                                        
                                                   
                                                          
                          

                                                                           
                             
                                       

                                                    

                                  

                                                                                                                                            
                                                   




                                                  




                                                                                    




                                                                              





                                                                                                     

                                     






                                                                                                                                                 
                                                                    






































                                                                                                                              
                                                                                                                                               



                                                                                                                                                                             













                                                                      


                                               
                                         




                                                   
                                         




                                                   
                                         





                                                   
                                         





                                                   
                                         



                                            
                                         


                                            
                                         

                                
 
                                  
                                                                            
                                                                          

                                                   


                                                                                  



                                                               
                       
     



                                                                  
                     
                
                                                                


                                                                                 
                                                        


                                                   


                                                             


                                        
 
                                      

                                                                      
                                                                                                                                                                                                                       


                                                                      
                                                                                                                                                                                                                          


                                                                      
                                                                                                                                                                                                                      
         






                                                                 




                                                                        

                                                  


                                               
 
































                                                                                             
         
 


                                               
         
 
     

 

                                                                                                             
               
          
                           
                                                               

                           
                                                                                                                             

                           
                                                                                                                                                

                           
                                                                                                                                                    

                           
                                                                                                                 
                                      
                               
                                 
          






                                                                           
                           
                   
                                                                                                                
                                                                                                                                                                                                                                            
     

 

               
                          
     
           
 
 
 


                                                 
               

                    


                                                       
         
                                                                                                   
                                                                                                                                 
         

                                                                                                                      
                                               
                                    
                                                                                       
         

                                      

           
// TMW2 Scripts
// Evol functions.
// Author:
//    4144
//    Jesusalva
// Description:
//    Function checking the client version and reports if it is too old.
//    This also handles all updates, and usually have priority.

function	script	clientupdater	{
    // Skip any update for newcomers
    if (getmap() ~= "000-0*") {
        UPDATE=gettimetick(2);
    }

    .@dg=0;
    // ERROR fixing
    if (UPDATE == 1565039378 && #UPDATE < 1565039378) {
        getitem MysteriousFruit, 1;
        UPDATE+=1;
        #UPDATE=1565039378;
        dispbottom l("Received one @@ as August daily login bug Token of Apology!", getitemlink(MysteriousFruit));
    }
    // Update handler (use `date +%s` for this)
    // Current UPDATE value: Qui Jun  7 08:10:55 -03 2018
    if (Lang > 5 && UPDATE < 1528369855) {
        UPDATE=1528369855;
        Lang=0;
        mesn "Jesus Saves";
        mesc l("Oh, noes! Due lack of translators, some languages were removed from this project.");
        mesc l("You might have been affected. Please, select your desired language.");
        asklanguage(LANG_IN_SHIP);
    }
    // Report client version for debugging purposes
    if (is_admin() && UPDATE < 1528369855) {
        UPDATE=1528369855;
        dispbottom l("Client Version: @@", ClientVersion); // This is to debug UPDATE system.
    }
    // New skills introduced
    if (UPDATE < 1531786864) {
        UPDATE=1531786864;
        skill TMW2_FAKESKILL, 1, 0;
        skill TMW2_FAKESKILL2, 1, 0;
    }
    // Update new quest exp, and make sure you have the extended basic skills with you
    if (UPDATE < 1545228412) {
        UPDATE=1545228412;
        adddefaultskills;
        if (getq(TulimsharQuests_Fishman) >= 2)
            getexp 12, 0;
        if (getq(MineQuest_Tycoon) >= 3)
            getexp 250, 0;
        if (getq(MineQuest_Tycoon) >= 6)
            getexp 642, 0;
        if (getq(MineQuest_Tycoon) >= 9)
            getexp 100, 0;
        if (getq(MineQuest_Tycoon) >= 12)
            getexp 2435, 0;
        if (getq(MineQuest_Tycoon) >= 15)
            Zeny=Zeny+1000;
        if (getq(TulimsharQuests_Sailors) >= 2)
            getexp 200, 0;
        if (getq(TulimsharQuests_Devoir) >= 1)
            getexp 500, 0;
        if (getq(TulimsharQuests_AnwarField) >= 11)
            getexp 650, 0;
        if (getq(TulimsharQuests_WoodenSword) >= 2)
            getexp 1100, 0; // Off value on purpose
        if (getq(MineQuest_Caelum) >= 2)
            getexp 2000, 40;
        if (getq(HalinarzoQuest_Foxhound) >= 6)
            getexp 1500, 0;
        if (getq(HalinarzoQuest_TraderKing) >= 2)
            getexp 5000, 0;
        if (getq(HurnscaldQuest_Bandits) >= 8)
            getexp 1000, 0; //getexp 5000, 0;

        dispbottom l("Your experience level has been updated.");
    }
    // Gallery Contest and 2019-12-29 no-drop incident
    // ter jan  8 03:52:20 -02 2019
    if (UPDATE < 1546926740) {
        UPDATE=1546926740;
        .@u$=strtolower(strcharinfo(0));
        setarray .@apology$, "jesusalva", "mrhedx", "ziah", "soren xd", "warblade", "yuxin", "xtreem", "monking", "demure gm", "se francisc";
        setarray .@gallery$, "jesusalva", "mishana", "bobr", "demure", "lawncable";

        // Users connected during nodrop incident (2018-12-29)
        // Jesusalva Mrhedx Ziah "Soren xd" WarBlade
        // yuxin Xtreem monking "demure GM" "Se Francisc"
        if (array_exists(.@apology$, .@u$)) {
                getitembound GoldenGift, 1, 1;
                Zeny=Zeny+570;
                .@dg=1;
                showavatar NPC_LOF_RICH;
                mesn ("TMW2 Staff");
                mesc l("Hello, @@! We just looked up and found out you were active during 2018-12-29!", strcharinfo(0)), 3;
                mesc l("And during that time, item dropped was bugged! We wanted to deliver you a token of apology!"), 3;
                mesc l("Sorry, and enjoy the game! Your TMW2 Staff Team."), 3;
                mesc l("Token Of Apology: 1x @@, 570 GP", getitemlink(GoldenGift));
                next;
        }

        // 1st Gallery Contest Participants
        // Mishana LawnCable bObr Jesusalva demure
        if (array_exists(.@gallery$, .@u$)) {
                getitem StrangeCoin, 30;
                .@dg=1;
                showavatar NPC_LOF_RICH;
                mesn ("TMW2 Staff");
                mesc l("Hello, @@! We are proud to announce the @@ RESULTS!", strcharinfo(0) , b(l("1° Screenshooting Contest"))), 3;
                mesc l("Participants: Jesusalva * mishana * bObr * demure * LawnCable"), 3;
                next;
                mesc ("Mishana Entries: Happy"), 3;
                mesc ("LawnCable Entries: Login Screen, TMW2 Field"), 3;
                mesc ("Demure Entries: Buggy Map"), 3;
                mesc ("Jesusalva Entries: LoF Secret Island, GM Plotting Evil Scheme For Next Event, Crazyfefe Cave"), 3;
                mesc ("bObr Entries: My Very Own Tiny Orchard"), 3;
                next;
                mesc l("1st Place - Mishana, LawnCable, Jesusalva, bObr");
                mesc l("5th Place - Demure");
                mes "";
                mesc l("Hey, look, a tie happened!");
                mesc l("How's that even possible? Well, 30 @@ for all contestants!", getitemlink(StrangeCoin));
                next;
        }
    }
    // Valentine Day Event Bug
    // sex fev 15 18:04:00 -02 2019
    if (UPDATE < 1550261040) {
        UPDATE=1550261040;
        if (#VALENTINE_POINTS) {
            .@dg=1;
            showavatar NPC_LOF_RICH;
            mesn ("TMW2 Staff");
            mesc l("Hello, @@! We just looked up and found out you that you were affected on a Valentine Event bug!", strcharinfo(0)), 3;
            mesc l("Due this bug, you didn't got a proper amount of points per sent. We wanted to deliver you a token of apology!"), 3;
            mesc l("Sorry, and enjoy the game! Your TMW2 Staff Team."), 3;
            mesc l("Token Of Apology: 1x @@, 1x @@", getitemlink(SilverGift), getitemlink(MercBoxB));
            getitem SilverGift, 1;
            getitem MercBoxB, 1;
            #VALENTINE_POINTS=0;
            next;
        }
    }
    // Limited bots
    // sex fev 15 23:22:21 -02 2019
    if (UPDATE < 1550280141) {
        UPDATE=1550280141;

        .@dg=1;
        mesc l("Game Rules were updated!"), 1;
        mesc l("Use @@ to read the new version.", "@rules"), 1;
        mes "";
        //GameRules S_NO_NPC_NAME | S_LAST_NEXT;
    }
    // Msawis bug
    // ter fev 19 12:15:00 -03 2019
    if (UPDATE < 1550589300) {
        UPDATE=1550589300;
        if (strcharinfo(0) == "msawis") {
            .@dg=1;
            showavatar NPC_LOF_RICH;
            mesn ("TMW2 Staff");
            mesc l("Hello, @@! We just looked up and found out that you were affected by BotCheck Logout rules!", strcharinfo(0)), 3;
            mesc l("First of, you didn't logged in. Without you online, WE CANNOT UNJAIL YOU! We tried with SQL but it didn't budge."), 3;
            mesc l("Due this bug, when you logged off on the BotCheck Area, @@. We wanted to deliver you a token of apology!", b(l("the server jailed you"))), 3;
            mesc l("Sorry, and enjoy the game! Your TMW2 Staff Team."), 3;
            mesc l("Token Of Apology: 1x @@, 1x @@", getitemlink(SupremeGift), getitemlink(MercBoxC));
            mes "";
            mesc l("Please contact @@ to clear this misunderstanding.", b("Jesusalva")), 1;
            getitem SupremeGift, 1;
            getitem MercBoxC, 1;

            // Better safe than sorry
            atcommand "@unjail msawis";
            // I dunno if my SQL query broke something so...........
            sc_end SC_JAILED;
            if (getmap() ~= "sec_pri")
                warp "Save", 0, 0;
            next;
        }
        if (strcharinfo(0) == "vilbou") {
            atcommand "@unjail vilbou";
            sc_end SC_JAILED;
            if (getmap() ~= "sec_pri")
                warp "Save", 0, 0;
            getitem MercBoxC, 1;
        }
        // Unclaimed Rewards
        // 2000283 Msawis 10 points
        // 2000552 Mrhedx 4 points
        // 2000299 vilbou 1 point
        setarray .@apology, 2000552, 2000283, 2000299;
        if (array_exists(.@apology, getcharid(3)) && (#VALENTINE_SENT+#VALENTINE_OPENED) > 0) {
            if (getcharid(3) == 2000552) {
                getitem BronzeGift, 1;
            } else if (getcharid(3) == 2000283) {
                getitem GoldenGift, 1;
            } else if (getcharid(3) == 2000299) {
                getitem StrangeCoin, 1;
            }
            dispbottom l("Valentine Day Event Reward automatically claimed");
            #VALENTINE_SENT=0;
            #VALENTINE_OPENED=0;
            #VALENTINE_RECEIVED=0;
        }
    }
    // Update Tycoon quest exp
    // dom mar  3 12:22:04 -03 2019
    if (UPDATE < 1551626524) {
        UPDATE=1551626524;
        if (getq(MineQuest_Tycoon) >= 15)
            getexp 43000, 0;
    }
    // Update Karma for the flexibility I need
    // sex mar 15 18:10:00 -03 2019
    if (UPDATE < 1552684200) {
        UPDATE=1552684200;
        if (Karma >= 250)
            Karma=98;
        else
            Karma=100+Karma;
    }
    // Update Tycoon quest Miner Knife + Hinnak & Oscar Scythe + @ucp
    // ter mar 26 10:00:22 -03 2019
    if (UPDATE < 1553605222) {
        if (UPDATE <= 1551626524) {
            if (getq(MineQuest_Tycoon) >= 6) {
                getitem MinerKnife, 1;
            }
        }
        if (getq(HurnscaldQuest_Farmers) >= 2 && getq(HurnscaldQuest_Farmers) < 5) {
            getitem Scythe, 1;
        } else if (getq(HurnscaldQuest_Farmers) >= 5) {
            getitem CottonBoots, 1;
        }
        .@dg=1;
        mesc l("WARNING: Use @ucp to change @@.", b(l("GAME SETTINGS"))), 1;
        mesc l("New default game settings:");
        mesc l(" - Soul Menhir auto-saving");
        mesc l(" - Daily Login Screen");
        mes "";
        mesc b(l("These can be reverted to previous behavior on User Control Panel!")), 3;
        mes "";
        if (countitem(LEGACY_MiereCleaver))
            mesc l("Your @@ Knockback effect expired.", getitemlink(LEGACY_MiereCleaver)), 1;
        if (countitem(LEGACY_Broadsword))
            mesc l("Your @@ Knockback effect expired.", getitemlink(LEGACY_Broadsword)), 1;
        UPDATE=1553605222;
    }
    // Shovel Auto-dig option
    // seg mai 27 21:22:55 -03 2019
    if (UPDATE < 1559002975) {
        UPDATE=1559002975;
        if (countitem(IronShovel) + countitem(SteelShovel))
            dispbottom l("Shovel have been changed, right-click it to bury items.");
    }
    // General Updates
    // sex jun 21 13:20:21 -03 2019
    if (UPDATE < 1561134021) {
        UPDATE=1561134021;
        if (Karma >= 200)
            Karma=98;
        else if (Karma < 80)
            Karma=100+Karma;
        if (getq(General_Narrator) >= 3)
            getitem MercBoxAA, 1;
        // Well, you don't need this crap I hope...
        if (BaseLevel < 40)
            getitem TulimMap, 1;
        if (getq(TulimsharQuest_Sailors) == 4)
            getexp 1508, 15;
        .@cr=countitem(CroconutBox);
        if (.@cr) {
            getitem CroconutBox, .@cr;
            dispbottom l("Croconut Box magically became two in inventory. Storage unaffected."); // Too much hassle affecting storage/cart/etc.
        }
    }
    // General Updates
    // seg jul 15 16:41:35 -03 2019
    if (UPDATE < 1565039378) {
        UPDATE=1565039378;
        .@dg=true;
        mesc l(".:: This is Release 9.5 Academy ::."), 0;
        //mesc l(".:: This is Release 10.0 Infinity ::."), 0;
        // Fix mounts
        unequip(EQI_SHADOW_SHOES);
		setmount 0;
        // You got recipe book by BSS Quest - mark as complete and get Blueprint
        if (getq(NivalisQuest_BlueSageSlimes) == 2) {
            getitem any(AncientBlueprint, AlchemyBlueprintA, EquipmentBlueprintA), 1;
            CRAFTQUEST=1;
            mesc l("You got a blueprint as reward for Blue Sage Slimes Quest completion."), 3;
        }
        // If you have TMW2_CRAFT skill, you need the bonus recipe
        if (getskilllv(TMW2_CRAFT)) {
            RECIPES_EQUIPMENT[CraftDagger]=true;
            mesc l("Dagger Crafting recipe learnt."), 2;
        }
        // Bounty Hunter Helmet
        if (MERCENARY_DAILYQUEST > 100) {
            getitem BountyHunterHelmet, 1;
            mesc l("You got a @@ for completing 100+ daily bountyhunter quests!", getitemlink(BountyHunterHelmet)), 2;
        }
        // Cindy quest new rewards
        if (getq(NivalisQuest_Cindy) >= 3) {
            getexp 120000, 0;
            mesc l("You got 120,000 XP for completing Mercury's quest."), 2;
        }
        // Mercenary Rank removed
        if (MERC_RANK) {
            THIEF_RANK=MERC_RANK;
            THIEF_EXP=MERC_EXP;
            MERC_RANK=0;
            MERC_EXP=0;
            mesc l("Your class has been changed from %s to %s.", b(l("Merchant Police")), b(l("Thief"))), 1;
        }
        if (getskilllv(ALL_INCCARRY)) {
            skill TF_STEAL, getskilllv(ALL_INCCARRY);
            skill ALL_INCCARRY, 0, 0;
            mesc l("Increase Weight skill replaced with Stealing.");
        }
        // NEW MAGIC SYSTEM
        if (getskilllv(SN_SHARPSHOOTING)) {
            skill AC_CHARGEARROW, getskilllv(SN_SHARPSHOOTING);
            skill AC_CHARGEARROW, 0, 0;
            getexp 2000, 150;
            mesc l("Sharpshooting skill replaced with Charged Arrow."), 1;
            mesc l("You've got 2000 xp and 150 job xp in apology tokens.");
        }
        getskilllist();
        for (.@i=0; .@i < @skilllist_count; .@i++) {
            // skip temporary skills
            if (@skilllist_flag[.@i] != 0)
                continue;
            // Only “paid” skills will result in a Scholarship Badge
            .@id=@skilllist_id[.@i];
            .@am=0;
            switch (.@id) {
                case SM_BASH:
                case TMW2_DEMURE:
                case MG_FIREBALL:
                case MG_SRECOVERY:
                case AL_DP:
                    .@am=1;
                case SM_ENDURE:
                case KN_AUTOCOUNTER:
                case KN_TWOHANDQUICKEN:
                case AL_ANGELUS:
                case CR_TRUST:
                case CR_DEFENDER:
                case AL_HOLYLIGHT:
                case TF_DETOXIFY:
                case ALL_RESURRECTION:
                case SM_RECOVERY:
                case PR_ASPERSIO:
                case AB_HIGHNESSHEAL:
                case SA_FREECAST:
                case SA_DRAGONOLOGY:
                case TMW2_SAGE:
                case SA_FLAMELAUNCHER:
                case SA_FROSTWEAPON:
                case SA_LIGHTNINGLOADER:
                case SA_SEISMICWEAPON:
                case MG_ENERGYCOAT:
                case MG_NAPALMBEAT:
                case MG_FIREBOLT:
                case MG_COLDBOLT:
                case MG_LIGHTNINGBOLT:
                case WZ_EARTHSPIKE:
                    mesc l("A skill has been replaced with an @@.", getitemlink(ScholarshipBadge));
                    if (!.@am)
                        .@am=min(5, @skilllist_lv[.@i]);

                    getitem ScholarshipBadge, .@am;
                    skill @skilllist_id[.@i], 0, 0;
                    getexp 5, (@skilllist_lv[.@i]-1)*1000;
                    break;
                // Free skills (AL_HEAL and mass provoke) will result in XP
                // Only Jakod's skills with level 3+ will result in a badge
                case AL_HEAL:
                case EVOL_MASS_PROVOKE:
                    if (@skilllist_lv[.@i] >= 3)
                        getitem ScholarshipBadge, 1;
                case SM_PROVOKE:
                case NV_TRICKDEAD:
                    .@delval=@skilllist_lv[.@i];
                    mesc l("A skill has been removed, you got @@ job exp and @@ Strange Coin as an apology token.", .@delval*100, .@delval);
                    skill @skilllist_id[.@i], 0, 0;
                    getexp .@delval, .@delval*100;
                    getitem StrangeCoin, .@delval;
                    break;
            }
        }
        // Grant you AL_DP based on magic level
        if (MAGIC_LVL) {
            skill AL_DP, MAGIC_LVL, 0;
            mesc l("You have learnt \"Divine Protection\" level @@.", MAGIC_LVL), 3;
        }
        // Grant you Thief Skill Tier 3
        if (THIEF_RANK >= 3) {
            skill(ALL_INCCARRY,1,0);
            mesc l("You have learnt \"Increase Weight\" in Thief Skills."), 2;
        }
        // If you got a Scholarship Badge, you need to travel to Tulimshar.
        // Give you a Warp Crystal to do so.
        if (countitem(ScholarshipBadge)) {
            getitem TulimWarpCrystal, 1;
            mesc l("You've obtained a @@ to visit Magic Academy.", getitemlink(TulimWarpCrystal)), 1;
        }
        // Cleanup
        deletearray RNGTREASURE_DATE;

        // Open Beta 2019 Main Event Rewards
        .@u$=strtolower(strcharinfo(0));
        setarray .@officialnick$, "jesusalva", "kolchak", "xanthem", "seeds", "dangerduck", "test123", "sertrop", "lawncable", "pookie", "saulc",
        "apane", "omatt";
        setarray .@expval, 211625, 1955041, 938439, 59663, 73899, 10338, 7494, 7857, 1992, 360, 443, 193, 5180;
        setarray .@gpval,   150321, 863215,   3263, 973137,   5650,  18343,  45227,  42002, 37381, 50000, 50450, 50275, 49988;
        setarray .@summer, 19, 30, 55, 0, 4, 2, 3, 4, 0, 0, 0, 0, 2;
        /* Data for python
        # import exp from exptable
        i=0
        THEARRAY=[]
        while i < len(names):
            raw=overflow[i]
            c=0
            while c < level[i]:
                raw+=exp[c]
                c+=1
            print("%s: %d exp" % (names[i], raw))
            THEARRAY.append(int(raw*0.3))
            i+=1

        setarray .@levelval,    48,     66,     60,     39,     40,     28,     25,     26,    17,    10,    10,     8,    23;
        setarray .@overflow, 25762, 338713,  55746,   1275,  14516,    504,   2855,    640,   360,     0,   277,    18,   598;
        */

        // Open Beta 2019
        .@ranking=array_find(.@officialnick$, .@u$);
        // Mishana LawnCable bObr Jesusalva demure
        showavatar NPC_LOF_RICH;
        mes "";
        mes "*************************************";
        mes "";
        mesn ("TMW2 Staff");
        mesc l("Hello, @@! We are proud to announce the @@ RESULTS!", strcharinfo(0) , b(l("Open Beta 2019"))), 3;
        mes "";
        mesc l("1st Place - Jesusalva (65)");
        mesc l("2nd Place - Kolchak (63)");
        mesc l("3rd Place - Xanthem (56)");
        mesc l("4th Place - seeds (43)");
        mesc l("5th Place - dangerDuck (23)");
        mesc l("6th Place - test123 (20)");
        mesc l("7th Place - Sertrop (17)");
        mesc l("8th Place - Pookie (13)");
        mesc l("9th Place - LawnCable (13)");
        mesc l("10th Place - Saulc (8)");
        mes "";
        mesc l("It was a reeeeeealy close dispute for the podium, but Jesusalva crafted an item at the last minute and took the first place!");
        mesc l("Although KOLCHAK managed to rank first in almost every ranking, Jesusalva was too close, and the Crafting gave him the edge he needed to take first place.");
        mesc l("Congratulations to everyone who participated on the event, even those who didn't made to the top 10!");
        if (.@ranking >= 0) {
            #ADD_LVL=.@expval[.@ranking];

            // Force Ched quest start if you haven't done so already
            .@year=getq(SQuest_Ched);
            if (.@year != (gettime(GETTIME_YEAR)-2000))
                setq SQuest_Ched, (gettime(GETTIME_YEAR)-2000), 0, 0;


            @ched=getq2(SQuest_Ched);
            .@pts=.@summer[.@ranking];
            if (.@pts) {
                getexp rand2(.@pts-1, .@pts*11/10), rand2(0,.@pts/25);
                setq2 SQuest_Ched, @ched+.@pts;
            }

            switch (.@ranking+1) {
                case 1:
                    getitembound Tyranny, 1, 1;
                    getitem MercBoxEE, 1;
                    getitem EquipmentBlueprintE, 1;
                    getitem HousingLetterI, 1;
                    getitem StrangeCoin, 150;
                    break;
                case 2:
                    getitem MercBoxEE, 1;
                    getitem EquipmentBlueprintE, 1;
                    getitem HousingLetterI, 1;
                    getitem StrangeCoin, 100;
                    break;
                case 3:
                    getitem MercBoxDD, 1;
                    getitem EquipmentBlueprintD, 1;
                    getitem HousingLetterI, 1;
                    getitem StrangeCoin, 100;
                    break;
                case 4:
                case 5:
                    getitem MercBoxCC, 1;
                    getitem EquipmentBlueprintC, 1;
                    getitem HousingLetterI, 1;
                    getitem StrangeCoin, 50;
                    break;
                case 6:
                case 7:
                    getitem MercBoxBB, 1;
                    getitem StrangeCoin, 30;
                    break;
                case 8:
                case 9:
                    getitem MercBoxAA, 1;
                    getitem StrangeCoin, 10;
                    break;
                case 10:
                    getitem MercBoxAA, 1;
                    break;
            } // switch(ranking)

            // GP conversion rules
            // if you have less than 50k, we'll return you to initial amount
            // Because it is a thankyou for participating on the event ;-)
            .@trugp=max(50000, .@gpval[.@ranking]);

            // You get to carry over 1 GP for each 1000 GP too (max 1000 GP bonus)
            Zeny+=min(1000, .@trugp/1000);

            // You'll get 1 Rare Point for every 1k GP obtained
            // Top was 1,000,000 → 1000 rare points
            #RARE_POINTS+=.@trugp/1000;

        } // if ranking
    }
    // Negative Karma = good. And positive karma allows PvP. So...
    // sex ago  9 18:10:20 -03 201
    if (UPDATE < 1565385020) {
        UPDATE=1565385020;
        // PVP bugfix
        Karma=0;
        // Allow to skip quest if you already have the Grimorium
        if (countitem(JesusalvaGrimorium) && getskilllv(TMW2_SKILLPERMIT) == 2) {
            skill TMW2_SKILLPERMIT, 3, 0;
        }
        // This can't happen but anyway, just in case...
        if (getskilllv(TMW2_TRANSMIGRATION) > 10) {
            skill TMW2_TRANSMIGRATION, 10, 0;
        }
        // Magic Skill Points for this skill went from 3 to 2
        if (getskilllv(ASC_METEORASSAULT))
            MAGIC_PTS-=1;
        // Treasure Key from Lua
        if (getq(General_Narrator) >= 3)
            getitem TreasureKey, 1;

        // Post-poned Referral Rewards
        if (#REFERRAL_PROG && BaseLevel >= 25 && #REFERRAL_CTRL < 1) {
            #REFERRAL_CTRL=1;
        	rodex_sendmail(gf_charid(#REFERRAL_PROG), "TMW2 Team", "Recruited Player got Lv 25!", strcharinfo(0)+" just got level 25!\nAs they get stronger, more rewards will be sent to you!", 0, SilverGift, 1);
        }
        if (#REFERRAL_PROG && BaseLevel >= 50 && #REFERRAL_CTRL < 2) {
            #REFERRAL_CTRL=2;
        	rodex_sendmail(gf_charid(#REFERRAL_PROG), "TMW2 Team", "Recruited Player got Lv 50!", strcharinfo(0)+" just got level 50!\nAs they get stronger, more rewards will be sent to you!", 0, ArcmageBoxset, 1);
        }
            #REFERRAL_CTRL=3;
        if (#REFERRAL_PROG && BaseLevel >= 75 && #REFERRAL_CTRL < 3) {
        	rodex_sendmail(gf_charid(#REFERRAL_PROG), "TMW2 Team", "Recruited Player got Lv 75!", strcharinfo(0)+" just got level 75!\nAs they get stronger, more rewards will be sent to you!", 0, PrismGift, 1);
        }
        // Eisten Rewards
        if (BaseLevel >= 50 && getq(TulimsharQuest_Eistein) == 2)
            getitem SilverGift, 1;
        if (BaseLevel >= 75 && getq(TulimsharQuest_Eistein) == 3)
            getitem GoldenGift, 1;
        if (BaseLevel >= 75 && getq(TulimsharQuest_Eistein) >= 3)
            getitem GraduationRobe, 1;
        // Grant you Thief Skill Tier 4
        if (THIEF_RANK >= 4) {
            skill(MC_OVERCHARGE,1,0);
            dispbottom l("You have learnt \"Barter\" in Thief Skills.");
        }
        // Update Crafting Score
        CRAFTING_SCORE_COMPLETE=CRAFTING_SCORE*39;
        // Water bug
        if (strcharinfo(0) == "JulieWarhawk") {
            #LOAN=34980;

            // Take any money in pockets
            if (Zeny>=#LOAN) {
                Zeny-=#LOAN;
                #LOAN=0;
            } else {
                #LOAN-=Zeny;
                Zeny=0;
            }
            // Sell Bottles
            if (countitem(BottleOfWoodlandWater)) {
                #LOAN-=countitem(BottleOfWoodlandWater)*80;
                delitem BottleOfWoodlandWater, countitem(BottleOfWoodlandWater);
            }
            if (countitem(EmptyBottle)) {
                #LOAN-=countitem(EmptyBottle)*80;
                delitem EmptyBottle, countitem(EmptyBottle);
            }
            if (countitem(IcedBottle)) {
                #LOAN-=countitem(IcedBottle)*500;
                delitem IcedBottle, countitem(IcedBottle);
            }
            // Bank money (will also handle overflows)
            if (BankVault > #LOAN) {
                BankVault-=#LOAN;
                #LOAN=0;
            } else {
                #LOAN-=BankVault;
                BankVault=0;
            }

            // Unjail player
            atcommand "@unjail "+strcharinfo(0);
            dispbottom l("You have been freed, and you still own @@ GP to the Bank.", #LOAN);
        }

        // Bug reward (FF)
        if (strcharinfo(0) == "seeds") {
            getitembound LegendaryMouboo, 1, 1;
        }

    }


    // #ADD_LVL means the user have to right to get some levels. This is a sketch. The code might be deleted.
    if (#ADD_LVL) {
        .@dg=1;
        /*
        mesn "Jesus Saves";
        mesc l("Oh - Welcome to TMW2: Moubootaur Legends!"), 3;
        next;
        mesn "Jesus Saves";
        mesc l("Please, fell at home. You can use ##B#world##b channel to speak to everyone on Discord, IRC and ingame."), 3;
        next;
        mesn "Jesus Saves";
        mesc l("Our mission statement is to bring fun to all players. You'll get some levels automatically. We advise you to join a guild."), 3;
        next;
        mesn "Jesus Saves";
        mesc l("If you have any trouble or doubt, don't hesit to call us. There are some cooperative quests, and more of them are being added."), 3;
        next;
        mesn "Jesus Saves";
        mesc l("Anyway, ##Bwelcome##b, and have fun! If you need anything, we are a keypress from distance!"), 3;
        //atcommand "@blvl "+#ADD_LVL;
        //getitem TimeFlask, 1;
        #ADD_LVL=(#ADD_LVL*9)/10;
        */
        if ((readparam(BaseExp)+#ADD_LVL > readparam(NextBaseExp))) {
            do {
                .@v=readparam(NextBaseExp)-readparam(BaseExp);
                getexp .@v, 0;
                #ADD_LVL-=.@v;
            } while (readparam(BaseExp)+#ADD_LVL > readparam(NextBaseExp));
        }
        getexp #ADD_LVL, 0;
        #ADD_LVL=0;
        // TODO: Use @super debug functions and force player to join a guild. We will need the guild ID, though.
        rodex_sendmail(getcharid(0), "TMW2 Team", "Welcome to Moubootaur Legends", "Hey, thanks for believing on us! We hope to have a great time togheter. Any problem, ask for help in #world - the Discord bridge! Enjoy our game!", 20);
    }


    if (.@dg) {
        next;
        closeclientdialog;
    }
    return;

}

// Just be sure your client version is OK
function	script	checkclientversion	{
    if (ClientVersion >= 25)
        return;

    mesn "Narrator";
    mesc l("Warning."), 1;
    mesc l("Warning."), 1;
    mesc l("Warning: You are using an old client."), 1;
    next;
    mesc l("Please install the new client from [@@https://manaplus.org/|https://manaplus.org/@@]");
    mesc l("Or use our awesome [@@https://tmw2.org/manalauncher/InstallManaLauncher.exe|Mana Launcher@@] if you're on Windows.");
    next;
    if (ClientVersion >= 22) mesc l("Compatibility Support mode enabled. Client may crash AT RANDOM, beware.");
    if (ClientVersion >= 22) mesc l("Crazy stuff can happen in overall. YOU HAVE BEEN WARNED TO UPDATE YOUR CLIENT.");
    if (ClientVersion >= 22) closeclientdialog;
    if (ClientVersion >= 22) return;
    mesc l("You won't be allowed to play this game until you have an updated client.");
    next;
    // Force user to disconnect
    atcommand "@kick "+strcharinfo(0);
    return;
}