summaryrefslogblamecommitdiff
path: root/npc/003-3/malindou.txt
blob: 447219d85f9b6fdf0563cbd209dd2095ab014e40 (plain) (tree)
1
2
3
4
5
6
7
8
9
                

           
               
         

                                                                                 

                                                   




                                                  
                                       


          

                  



                                                         
                           






                                                             


                                                         

                                                   
                                                                                           
                    
                                                   
     



                                                         
                                                      

                                    
     



                                                         



                                                                                      
                                                            
                    
     
                                                         








                                                                                                                      
                                                         






                                              









                                                         







                                                         
                                    
                                   
     







                                                                                  





                                                          
                                                                                                             

                                                                                                                             
                                                                                                                                     
                                                                                                                               

                                                                                                                                  
     







                                                         


                                                                                          
                                                                                                                                                                                                                                                                          
                           
                                    
                    
                                                                  
                                                          

                    











                                                                                        

                                                         
                               
                                                                                                                    


                                                                                                                              




                                                            


                                                                                                              
                                                                                                                                                                                                                                 
















                                                                                                                                         




                                                                           
                                                                           
                                                                      



                                                                             
                                    
 
                           

                                               
                                              
                                             
                                             
                                             
                                                                                                          

                                             
                                             







                                                         
                                            
                                            
                                            
                                            
                                           
                                           
                                           
                                   


               
                       
                        



                                           

                  

                                               






                                                                          

 
// TMW-2 Script.
// Author:
//    Saulc
//    Jesusalva
// Notes:
//    Tulim banker, and also handles PCLogin events: CheckClientVersion, and bank
//    Take care of server updates, but instances are defined on their ships.

003-3,36,34,0	script	Malindou	NPC_LLOYD,{
    function	UpdateBF {
        .@o=getbattleflag(getarg(0));
        setbattleflag(getarg(0), .@o+getarg(1,0));
    }

    Banker(.name$, "Tulimshar", 14000);
    close;

OnInit:
    .sex = G_MALE;
    .distance = 4;

    // Update handler (use `date +%s` for this)
    // Current UPDATE value: Qui Jun  7 08:10:55 -03 2018
    if ($UPDATE  < 1528369855) {
        $UPDATE=1528369855;
        debugmes "Warning.";
        debugmes "Warning.";
        debugmes "Warning: This introduces a server update:";
        debugmes "";
        debugmes "* Please create the imported guild";
        debugmes "";
    }
    // Current UPDATE value: Dom Jun 17 21:32:45 -03 2018
    if ($UPDATE < 1529281965) {
        $UPDATE=1529281965;
        debugmes "";
        debugmes "* Please set #BankP for bankers";
        debugmes "* Automatically creatining minimal GP reserves for Hasan Autumn's Quest";
        debugmes "";
        $HASAN_GP=rand(3,12)+rand(3,12)+rand(3,12);
    }
    // Current UPDATE value: Dom Jun 30 22:44:46 -03 2018
    if ($UPDATE < 1530409486) {
        $UPDATE=1530409486;
        debugmes "";
        debugmes "* Clearing invalid (deleted) items";
        debugmes "";
        DelItemFromEveryPlayer(729);
    }
    // Current UPDATE value: Qui Jul 12 02:40:02 -03 2018
    if ($UPDATE < 1531374002) {
        $UPDATE=1531374002;
        debugmes "";
        debugmes "* WARNING! WARNING! WARNING!";
        debugmes "* ITEM ID VIOLATION DETECTED!";
        debugmes "";
        debugmes "* ALL POLISHED EMERALDS BECOME POLISHED AMETHYSTS, AND VICE-VERSA!";
        debugmes "* This should not have an effect ingame.";
        debugmes "";
    }
    // Current UPDATE value: Qui Ago  2 13:58:17 -03 2018
    if ($UPDATE < 1533229097) {
        $UPDATE=1533229097;
        debugmes "";
        debugmes "* ERASING all victories with Fafi Dragon";
        debugmes "";
        query_sql("UPDATE `quest` SET `count1` = '1' WHERE `quest`.`quest_id`="+LoFQuest_Fairy+" AND `count1` = '2'");
        query_sql("UPDATE `quest` SET `count1` = '2' WHERE `quest`.`quest_id`="+LoFQuest_Fairy+" AND `count1` = '3'");
        DelItemFromEveryPlayer(SkullMask);
    }
    // Current UPDATE value: Qua Ago  8 11:04:10 -03 2018
    if ($UPDATE < 1533737050) {
        $UPDATE=1533737050;
        debugmes "";
        debugmes "* REMOVING now rare items.";
        debugmes "";
        DelItemFromEveryPlayer(SilverMirror);
    }
    // Current UPDATE value: Seg Ago 27 20:20:21 -03 2018
    if ($UPDATE < 1535412021) {
        $UPDATE=1535412021;
        debugmes "";
        debugmes "* SETUP mana stone default values.";
        debugmes "";
        $MANA_BINT=30;
        $MANA_BLVL=40;
        $MANA_JLVL=10;
    }
    // Current UPDATE value: Qui Set 06 13:50:37 -03 2018
    if ($UPDATE < 1536252637) {
        $UPDATE=1536252637;
        debugmes "";
        debugmes "* Clearing invalid (deleted) items";
        debugmes "* Initial Vault Values";
        debugmes "";
        DelItemFromEveryPlayer(802);
        DelItemFromEveryPlayer(557);
        $VAULT_01738039=rand(5,25);
    }
    // Current UPDATE value: Qui Set 13 14:17:50 -03 2018
    if ($UPDATE < 1536859070) {
        $UPDATE=1536859070;
        debugmes "";
        debugmes "* Aisen already have a completed node at PETMEMO.";
        debugmes "* This was handled automatically, no special care is required.";
        debugmes "";
    }
    // Current UPDATE value: Dom Set 16 22:21:05 -03 2018
    if ($UPDATE < 1537147265) {
        $UPDATE=1537147265;
        debugmes "";
        debugmes "* My Money quest state modified";
        debugmes "* Foxhound Famine quest state modified";
        debugmes "* Life Delight quest state modified"; // “A True Chef” is the LoF version of this quest
        debugmes "";
        query_sql("UPDATE `quest` SET `count1` = '1' WHERE `quest`.`quest_id`="+ShipQuests_ArpanMoney+" AND `count1` = '2'");
        query_sql("UPDATE `quest` SET `count2` = `count1` WHERE `quest`.`quest_id`="+HalinarzoQuest_Foxhound+" AND `count1` >= '6'");
        query_sql("UPDATE `quest` SET `count1` = '6' WHERE `quest`.`quest_id`="+HalinarzoQuest_Foxhound+" AND `count1` > '6'");
        query_sql("UPDATE `quest` SET `count2` = `count1` WHERE `quest`.`quest_id`="+HalinarzoQuest_LifeDelight);
        query_sql("UPDATE `quest` SET `count1` = '1' WHERE `quest`.`quest_id`="+HalinarzoQuest_LifeDelight+" AND `count1` > '1'");
    }
    // Current UPDATE value: Seg Set 17 16:02:27 -03 2018
    if ($UPDATE < 1537210947) {
        $UPDATE=1537210947;
        debugmes "";
        debugmes "* Referral Hack System";
        debugmes "";
        setarray $REFERRAL_IDS, 0;
    }
    // Current UPDATE value: Ter Out 16 17:17:20 -03 2018
    // This is a hack because I'm too lazy to be bothered with standard SQL Upgrade system
    if ($UPDATE < 1539721040) {
        query_sql("CREATE TABLE IF NOT EXISTS `discord` (`account_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',`discord_id` VARCHAR(255) NOT NULL DEFAULT '',`discord_name` VARCHAR(255) NOT NULL DEFAULT '',`verified` ENUM('0', '1') NOT NULL DEFAULT '0') ENGINE=MyISAM");
        $UPDATE=1539721040;
        $NIVALIS_LIBDATE=1539721040;
        debugmes "";
        debugmes "* SQL Upgrade (no effect on new installations)";
        debugmes "* Nivalis Liberation Day event skipped";
        debugmes "";
    }
    // Current UPDATE value: Dom Nov 18 17:40:30 -02 2018
    // Update players position
    if ($UPDATE < 1542570030) {
        query_sql("UPDATE `char` SET `last_x` = '35' WHERE `char`.`last_map`='005-1'");
        query_sql("UPDATE `char` SET `last_y` = '102' WHERE `char`.`last_map`='005-1'");
        query_sql("UPDATE `char` SET `save_x` = '35' WHERE `char`.`save_map`='005-1'");
        query_sql("UPDATE `char` SET `save_y` = '102' WHERE `char`.`save_map`='005-1'");
        $UPDATE=1542570030;
        debugmes "";
        debugmes "* Update Candor players position";
        debugmes "";
    }
    // Current UPDATE value: Sab Dez 15 21:45:15 -02 2018
    // Upgrade every Wooden Sword in a Bug Slayer
    if ($UPDATE < 1544917515) {
        query_sql("UPDATE `inventory` SET `nameid` = '"+BugSlayer+"' WHERE `inventory`.`nameid`='"+WoodenSword+"'");
        query_sql("UPDATE `storage` SET `nameid` = '"+BugSlayer+"' WHERE `storage`.`nameid`='"+WoodenSword+"'");
        query_sql("UPDATE `cart_inventory` SET `nameid` = '"+BugSlayer+"' WHERE `cart_inventory`.`nameid`='"+WoodenSword+"'");
        query_sql("UPDATE `guild_storage` SET `nameid` = '"+BugSlayer+"' WHERE `guild_storage`.`nameid`='"+WoodenSword+"'");
        $UPDATE=1544917515;
        debugmes "";
        debugmes "* Replaced Wooden Swords with Bug Slayer";
        debugmes "";
    }
    // Current UPDATE value: Sab Dez 17 13:52:54 -02 2018
    // Fix a critical bug because Nard's ship doors logic was changed. Upgrade premium weapons in rare weapons
    if ($UPDATE < 1545061974) {
        //query_sql("UPDATE `quest` SET `count1` = '3' WHERE `quest`.`quest_id`='0' AND `quest`.`count1` = '2' AND `quest`.`char_id` IN (SELECT `quest`.`char_id` WHERE  `quest`.`quest_id` = '12' AND  `quest`.`count1`>='1')");

        query_sql("UPDATE `inventory` SET `nameid` = '"+LEGACY_MiereCleaver+"' WHERE `inventory`.`nameid`='"+MiereCleaver+"'");
        query_sql("UPDATE `storage` SET `nameid` = '"+LEGACY_MiereCleaver+"' WHERE `storage`.`nameid`='"+MiereCleaver+"'");
        query_sql("UPDATE `cart_inventory` SET `nameid` = '"+LEGACY_MiereCleaver+"' WHERE `cart_inventory`.`nameid`='"+MiereCleaver+"'");
        query_sql("UPDATE `guild_storage` SET `nameid` = '"+LEGACY_MiereCleaver+"' WHERE `guild_storage`.`nameid`='"+MiereCleaver+"'");

        query_sql("UPDATE `inventory` SET `nameid` = '"+LEGACY_Broadsword+"' WHERE `inventory`.`nameid`='"+Broadsword+"'");
        query_sql("UPDATE `storage` SET `nameid` = '"+LEGACY_Broadsword+"' WHERE `storage`.`nameid`='"+Broadsword+"'");
        query_sql("UPDATE `cart_inventory` SET `nameid` = '"+LEGACY_Broadsword+"' WHERE `cart_inventory`.`nameid`='"+Broadsword+"'");
        query_sql("UPDATE `guild_storage` SET `nameid` = '"+LEGACY_Broadsword+"' WHERE `guild_storage`.`nameid`='"+Broadsword+"'");

        $UPDATE=1545061974;
        debugmes "";
        debugmes "* Replaced Miere Cleaver and Broad Sword with a special version specific for old players";
        debugmes "* Fix critical bug with Nard (not needed on Main Server)";
        debugmes "";
    }




    // This mensures Contributors Credits, and changes only during updates.
    // All names in lower case. standard: 100 points. Non-TMW2 contributors
    // should be disregarded if they're not involved with the project.

    // You may get more points for complexity, difficulty, usability, etc.
    // You may get less points if you don't do it yourself, eg. a bug report.

    // See 003-2/lua.txt for rewards

    $@CONTRIBUTORS = htnew;
    htput($@CONTRIBUTORS, "jesusalva",  15000);
    htput($@CONTRIBUTORS, "saulc",      12500);
    htput($@CONTRIBUTORS, "lawncable",  1600);
    htput($@CONTRIBUTORS, "polaczka",   700);
    htput($@CONTRIBUTORS, "crazyfefe",  641);
    htput($@CONTRIBUTORS, "4144",       550);
    htput($@CONTRIBUTORS, "mishana",    500); // Rather magic number based on precedents, tweak if needed.
    htput($@CONTRIBUTORS, "soren",      450);
    htput($@CONTRIBUTORS, "rakinorf",   400);
    htput($@CONTRIBUTORS, "pookie",     360);
    htput($@CONTRIBUTORS, "ayruss",     210);
    htput($@CONTRIBUTORS, "dustman",    175);
    htput($@CONTRIBUTORS, "acsvln",     150);
    htput($@CONTRIBUTORS, "ichigoblack",100);
    htput($@CONTRIBUTORS, "acsvln",     100);
    htput($@CONTRIBUTORS, "gnulinux",   80);
    htput($@CONTRIBUTORS, "skydragon",  75);
    htput($@CONTRIBUTORS, "guy of lieutnant dausen", 70);
    htput($@CONTRIBUTORS, "dustman",    50);
    htput($@CONTRIBUTORS, "msawis",     30);
    htput($@CONTRIBUTORS, "dragonstar", 26);
    htput($@CONTRIBUTORS, "demure",     12);
    htput($@CONTRIBUTORS, "aisen",      8);
    htput($@CONTRIBUTORS, "xtreem",     6);
    htput($@CONTRIBUTORS, "john h",     2);
    //htput($@CONTRIBUTORS, "", 1);
    end;

OnPCLoginEvent:
    checkclientversion;
    if (#MerchantBank) {
        BankVault += max(0, #MerchantBank);
        #MerchantBank = 0;
    }
    end;

OnInterIfInitOnce:
    if (getbattleflag("monster_hp_rate") > 100)
        end;
    // We must also apply penalty for losing Mana Fragments
    // Forest Mana Fragment is lost: (+1% HP, +5% pop, 20s faster removal)
    UpdateBF("monster_hp_rate",1);
    UpdateBF("mob_count_rate",5);
    UpdateBF("mob_remove_delay",-20000);
    // Just copy these lines as fragments are lost
    end;
}