summaryrefslogblamecommitdiff
path: root/npc/commands/event.txt
blob: 2ed3368c9be2501d0e097175bf4ed37c5433a8e4 (plain) (tree)
1
2
3
4
5
6
7
8
9






                                                                            
 
                                                                           
                                         
                                                                           
                                                 
                                                  

                       
                      
                
                  
         



















                                                                        










                                                                 
                                                                 
 











                                                          
 
                                                                

                                           
                                           
                                           


                                             
                                           


                                 
                                                              



                    




                                          
                                   

                                      
                                                    

                                          
                                                                                                                                        



               


                                          
                                 

                                       
                                                     

                                          
                                                                                                                                         



               
                      






                                                         

                                   
                                                       

                                                

                                                   
 
                                     


                                      









                                                         
         



                                        
     
 


















 




                                            
                                  
                                        
                                     
                                                     
 
                        
                                                                                           
                      
                                     







                                                                      
                   


                                                                                               
                                                                 




               








                                                                                                

                                            
                                     



                                                                                      
                        
                                          
                                          
                                            











                               
                   





                    
 
 











                                                                        
                                     
                                                                        
                                                                                                                                                  
                                                                  











                                              

        
       
                                                   
                                                      
 
// TMW2 Script
// Author:
//    Evol Team
//    Saulc
//    Jesusalva
// Description:
//    Handles all major events on TMW2 (Christmas, Easter, Worker Day, etc.)

// Christmas cannot be on GlobalEventMenu because it affects seasons system
function	script	sChristmas	{
        // Determine the drop rates based on month, and Christmas proximity
        if (gettime(GETTIME_MONTH) == DECEMBER) {
            if (gettime(GETTIME_DAYOFMONTH) <= 26)
                .@m=10;
            else
                .@m=8;
        } else {
            .@m=5;
        }

        // Add Christmas drops
        addmonsterdrop(Moggun,      XmasCake,  80*.@m);
        addmonsterdrop(AlphaMouboo, XmasCake,  92*.@m);
        addmonsterdrop(BlueSlime,   XmasCake, 100*.@m);
        addmonsterdrop(SantaSlime,  XmasCake, 120*.@m);
        addmonsterdrop(IcedFluffy,  XmasCake, 150*.@m);
        addmonsterdrop(Yeti,        XmasCake, 500*.@m);

        addmonsterdrop(Bandit,      XmasCandyCane,  30*.@m);
        addmonsterdrop(Mouboo,      XmasCandyCane,  48*.@m);
        addmonsterdrop(WhiteSlime,  XmasCandyCane,  50*.@m);
        addmonsterdrop(RudolphSlime,XmasCandyCane, 100*.@m);
        addmonsterdrop(Fluffy,      XmasCandyCane, 200*.@m);
        addmonsterdrop(AzulSlime,   XmasCandyCane, 200*.@m);

        addmonsterdrop(Duck,        GingerBreadMan,  36*.@m);
        addmonsterdrop(WaterFairy,  GingerBreadMan, 100*.@m);

        // Event drop rates, multiplied by 10 during Christmas (see .@m)
        addmonsterdrop(Yeti,        ClosedChristmasBox, 350*.@m);
        addmonsterdrop(WaterFairy,  ClosedChristmasBox, 108*.@m);
        addmonsterdrop(AlphaMouboo, ClosedChristmasBox,  83*.@m);
        addmonsterdrop(IcedFluffy,  ClosedChristmasBox,  67*.@m);
        addmonsterdrop(BlueSlime,   ClosedChristmasBox,  42*.@m);
        addmonsterdrop(Moggun,      ClosedChristmasBox,  40*.@m);
        addmonsterdrop(SantaSlime,  ClosedChristmasBox,  36*.@m);
        addmonsterdrop(AzulSlime,   ClosedChristmasBox,  20*.@m);
        addmonsterdrop(Fluffy,      ClosedChristmasBox,  20*.@m);
        addmonsterdrop(RudolphSlime,ClosedChristmasBox,   8*.@m);
        addmonsterdrop(WhiteSlime,  ClosedChristmasBox,   3*.@m);
        addmonsterdrop(GiantMaggot, ClosedChristmasBox,   2*.@m);

        // This is not dropped outside December
        if (gettime(GETTIME_MONTH) == DECEMBER) {
            // Bugfix
            if (gettime(GETTIME_YEAR) == 2018)
                .@m+=10;
            addmonsterdrop(WaterFairy,  XmasGift,  6*.@m);
            addmonsterdrop(AlphaMouboo, XmasGift,  5*.@m);
            addmonsterdrop(IcedFluffy,  XmasGift,  4*.@m);
            addmonsterdrop(SantaSlime,  XmasGift,  3*.@m);
            addmonsterdrop(Fluffy,      XmasGift,  2*.@m);
            addmonsterdrop(AzulSlime,   XmasGift,  2*.@m);
        }

        // Change maps for Christmas Season (Specially LoF maps)
        addmapmask "003-1", MASK_CHRISTMAS;
        addmapmask "005-1", MASK_CHRISTMAS;
        addmapmask "009-1", MASK_CHRISTMAS;
        addmapmask "012-1", MASK_CHRISTMAS;
        addmapmask "017-2", MASK_CHRISTMAS;
        addmapmask "017-2-1", MASK_CHRISTMAS;
        addmapmask "017-3", MASK_CHRISTMAS;
        addmapmask "020-2", MASK_CHRISTMAS;

        // Enable event
        set $EVENT$, "Christmas";
        //logmes "Enabled CHRISTMAS event.", LOGMES_ATCOMMAND;
        return;
    }
    //MASK_CHRISTMAS

function	script	GlobalEventMenu	{

    function rateManagement {
        clear;
        mes l("To get the current rate:");
        mes col("    @exprate", 7);
        next;
        mes l("To set the exp rate:");
        mes col("    @exprate ##Brate##b hours", 7);
        next;
        mes l("To reset back to normal:");
        mes col("    @exprate default", 7); // note to translators: any non-numerical value will reset so "default" is safe to translate
        next;
        return;
    }

    function dropManagement {
        clear;
        mes l("To get the current rate:");
        mes col("    @rates", 7);
        next;
        mes l("To set the drop rate:");
        mes col("    @droprate ##Brate##b hours", 7);
        next;
        mes l("To reset back to normal:");
        mes col("    @droprate default", 7); // note to translators: any non-numerical value will reset so "default" is safe to translate
        next;
        return;
    }

    function sEaster {

        // Enable event
        set $EVENT$, "Easter";
        logmes "Enabled EASTER event.", LOGMES_ATCOMMAND;
        return;
    }

    // WARNING, possibly dangerous.
    function sClear {
        // Delete all event-only item from every player
        DelItemFromEveryPlayer(GoldenEasteregg);
        DelItemFromEveryPlayer(GoldenEasteregg);
        DelItemFromEveryPlayer(ClosedChristmasBox);
        DelItemFromEveryPlayer(OpenedChristmasBox);

        // Delete all Christmas stuff
        if ($EVENT$ != "Christmas") {
            $XMAS_MONEY=0; // Golbarez
            $XMAS_GIFTS=0; // Chief
        } else if ($EVENT$ == "Christmas") {
            DelAccRegFromEveryPlayer("#XMAS_LOGINBONUS");
            removemapmask "003-1", MASK_CHRISTMAS;
            removemapmask "005-1", MASK_CHRISTMAS;
            removemapmask "009-1", MASK_CHRISTMAS;
            removemapmask "012-1", MASK_CHRISTMAS;
            removemapmask "017-2", MASK_CHRISTMAS;
            removemapmask "017-2-1", MASK_CHRISTMAS;
            removemapmask "017-3", MASK_CHRISTMAS;
            removemapmask "020-2", MASK_CHRISTMAS;
        }

        // We must remove any event drop
        charcommand("@reloadmobdb");
        SeasonReload(1);
    }




















    function seasonManagement {
        clear;
        mes l("Current event: @@", $EVENT$);
        menu
            l("Disable event"), -,
            l("Enable Easter"), -,
            l("Enable Worker's Day"), -,
            l("Enable Christmas"), -,
            l("Reset Kill Saulc Event (Monthly)"), -;

        switch (@menu) {
            case 1: sClear(); set $EVENT$, ""; logmes "Disabled events.", LOGMES_ATCOMMAND;
                break;
            case 2: sEaster(); break;
            case 3:
                set $EVENT$, "Worker Day";
                logmes "Enabled WORKERS DAY event.", LOGMES_ATCOMMAND;
                /*
                addmonsterdrop(Snake, Pearl, 10);
                debugmes "Snakes are now dropping Pearls.";
               */
                break;
            case 4:
                    logmes "Enabled CHRISTMAS event.", LOGMES_ATCOMMAND;
                    query_sql("DELETE FROM `quest` WHERE `quest_id` = '"+SQuest_Christmas+"'");
                    sChristmas(); break;
            case 5: DelItemFromEveryPlayer(MurdererCrown); break;
        }

        return;
    }

    do
    {
        clear;
        setnpcdialogtitle l("Event Management");
        mes l("This menu allows you to manage events and gives access to event-related tools.");
        mes "";
        mes l("What do you want to access?");

        select
            l("Experience Rate management"),
            l("Drop Rate management"),
            l("Change Season Event"),
            rif(getarg(0,0), menuimage("actions/home", l("Return to Super Menu")));

        //.@c = getarg(0,0) ? 2 : 1; // 1 = back to event menu, 2 = back to super menu

        switch (@menu) {
            case 1: rateManagement; break;
            case 2: dropManagement; break;
            case 3: seasonManagement; break;
            default: return;
        }

    } while (true);
}



-	script	@event	32767,{
    end;

OnCall:
    if (!is_gm()) {
        end;
    }

    GlobalEventMenu;
    closedialog;
    end;
}

-	script	@toevent	32767,{
    end;

OnCall:
    if (!$@GM_EVENT)
        dispbottom l("The mana bridge is closed at the moment.");
    else if (BaseLevel < 10)
        dispbottom l("You are not strong enough to survive this trip.");
    else if (readparam(Sp) != readparam(MaxSp))
        dispbottom l("You need all your mana to do this trip.");
    else if (readparam(Hp) != readparam(MaxHp))
        dispbottom l("You cannot be hurt to do this trip.");
    else if (getmapname() ~= "001-*")
        dispbottom l("You are already at the Mana Plane of Existence.");
    else if (getmapname() == "boss" || getmapname() == "sec_pri" || getmapname() ~= "000-*" || getmapname() ~= "008-*" || getmapname() ~= "sore*")
        dispbottom l("The Mana Plane is currently out of reach.");
    else {
        .@gt=$@AEROS_SPWN;
        if (.@gt == 2)
            .@gt=rand(0,1);
        switch (.@gt) {
        case 0:
            warp "001-1", 235, 26; break;
        case 1:
            warp "001-1", 23, 108; break;
        }
        specialeffect(63, AREA, getcharid(3));
    }
    end;

OnInit:
    bindatcmd "event", "@event::OnCall", 99, 99, 0;
    bindatcmd "toevent", "@toevent::OnCall", 0, 99, 0;
}