summaryrefslogblamecommitdiff
path: root/npc/functions/seasons.txt
blob: f4eee082b5fe0ca786405d29b1df4ba0dd8b5ffa (plain) (tree)


































                                                                       















                                                                    


                                                        
                                         



                           







                                                   



                                                   



                      
 

                                                    
 




























































                                                      







                                                                                                                                                          

         
                               
                       
     

        
// TMW2 Script.
// Authors:
//    Jesusalva
// Description:
//    Season functions

// Function authored by Reid and edited by Jesusalva
// season({day, month})
// SQuest_Summer
//    returns the current season (approximation)
//      WINTER:      Winter, 21/12
//      SPRING:      Spring, 20/03
//      SUMMER:      Summer, 21/06
//      AUTUMN:      Autumn, 22/09

function	script	season	{
    .@current_month = getarg(0, gettime(GETTIME_MONTH));

    if (.@current_month % 3 == 0) {
        .@current_day = getarg(1, gettime(GETTIME_DAYOFMONTH));

        switch (.@current_month) {
            case MARCH:     .@season_day = 20; break;
            case JUNE:      .@season_day = 21; break;
            case SEPTEMBER: .@season_day = 22; break;
            case DECEMBER:  .@season_day = 21; break;
            default: break;
        }

        .@is_after_season_day = .@current_day >= .@season_day ? 0 : -1;
    }

    return (.@current_month / 3 + .@is_after_season_day) % 4;
}


function	script	SeasonControl	{
    do
    {
        select
            "Summer Start",
            "Summer End",
            "Abort";

        switch (@menu) {
            case 1: donpcevent("#SeasonCore::OnSummerStart"); break;
            case 2: donpcevent("#SeasonCore::OnSummerEnd"); break;
        }
    } while (@menu != 3);
    return;
}

// If skip_checks is set, it'll ignore $@SEASON control.
// SeasonReload( {skip_checks} )
function	script	SeasonReload	{
    // Proccess skip_checks
    if (getarg(0,0))
        $@SEASON=99;

    // Summer extra drops
    if (season() == SUMMER && $@SEASON != SUMMER) {
        donpcevent("#SeasonCore::OnSummerStart");
    }
    // Summer end delete drops
    if (season() == AUTUMN && $@SEASON == SUMMER) {
        donpcevent("#SeasonCore::OnSummerEnd");
    }
    // Autumn extra drops
    if (season() == AUTUMN && $@SEASON != AUTUMN) {
        donpcevent("#SeasonCore::OnAutumnStart");
    }

    $@SEASON=season();
    return;
}

000-0,0,0,0	script	#SeasonCore	NPC_HIDDEN,{
    end;

OnSummerStart:
    addmonsterdrop(Duck, CherryCocktail, 360);
    addmonsterdrop(Croc, CherryCocktail, 180);
    addmonsterdrop(SaxsoGhost, CherryCocktail, 450);
    addmonsterdrop(RedButterfly, CherryCocktail, 100);

    addmonsterdrop(Maggot, CactusCocktail, 140);
    addmonsterdrop(DesertMaggot, CactusCocktail, 190);
    addmonsterdrop(Scorpion, CactusCocktail, 165);
    addmonsterdrop(GiantMaggot, CactusCocktail, 290);
    addmonsterdrop(Centaur, CactusCocktail, 1000);

    addmonsterdrop(AlphaMouboo, AppleCocktail, 850);
    addmonsterdrop(OceanCroc, AppleCocktail, 480);
    addmonsterdrop(Mouboo, AppleCocktail, 280);
    addmonsterdrop(Pinkie, AppleCocktail, 70);

    addmonsterdrop(Duck, Sunglasses, 1);
    addmonsterdrop(Croc, Sunglasses, 1);
    addmonsterdrop(SaxsoGhost, Sunglasses, 1);
    addmonsterdrop(DesertMaggot, Sunglasses, 1);
    addmonsterdrop(Scorpion, Sunglasses, 1);
    addmonsterdrop(GiantMaggot, Sunglasses, 1);
    addmonsterdrop(Centaur, Sunglasses, 3);
    addmonsterdrop(AlphaMouboo, Sunglasses, 1);
    addmonsterdrop(OceanCroc, Sunglasses, 1);
    addmonsterdrop(Mouboo, Sunglasses, 1);
    addmonsterdrop(Pinkie, Sunglasses, 1);
    addmonsterdrop(Moonshroom, Sunglasses, 2);
    addmonsterdrop(RedButterfly, Sunglasses, 1);
    end;

OnSummerEnd:
    delmonsterdrop(Duck, CherryCocktail);
    delmonsterdrop(Croc, CherryCocktail);
    delmonsterdrop(SaxsoGhost, CherryCocktail);
    delmonsterdrop(RedButterfly, CherryCocktail);
    delmonsterdrop(Maggot, CactusCocktail);
    delmonsterdrop(DesertMaggot, CactusCocktail);
    delmonsterdrop(Scorpion, CactusCocktail);
    delmonsterdrop(GiantMaggot, CactusCocktail);
    delmonsterdrop(Centaur, CactusCocktail);
    delmonsterdrop(AlphaMouboo, AppleCocktail);
    delmonsterdrop(OceanCroc, AppleCocktail);
    delmonsterdrop(Mouboo, AppleCocktail);
    delmonsterdrop(Pinkie, AppleCocktail);
    delmonsterdrop(Duck, Sunglasses);
    delmonsterdrop(Croc, Sunglasses);
    delmonsterdrop(SaxsoGhost, Sunglasses);
    delmonsterdrop(DesertMaggot, Sunglasses);
    delmonsterdrop(Scorpion, Sunglasses);
    delmonsterdrop(GiantMaggot, Sunglasses);
    delmonsterdrop(Centaur, Sunglasses);
    delmonsterdrop(AlphaMouboo, Sunglasses);
    delmonsterdrop(OceanCroc, Sunglasses);
    delmonsterdrop(Mouboo, Sunglasses);
    delmonsterdrop(Pinkie, Sunglasses);
    delmonsterdrop(Moonshroom, Sunglasses);
    delmonsterdrop(RedButterfly, Sunglasses);
    end;

OnAutumnStart:
    // Ched's Quest Winner
    .@nb = query_sql("SELECT c.name FROM `quest` AS i, `char` AS c WHERE i.quest_id=305 AND i.char_id=c.char_id ORDER BY i.count2 DESC LIMIT 1", .@name$);
    $@AUTUMN_VICTOR=.@name$[0];


    end;

OnInit:
OnHour00:
    if ($@SEASON != season()) {
        SeasonReload();
    }
    end;
}