Advertisement
CrowMakerVX

Steps Calender

Sep 1st, 2012
454
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 70.34 KB | None | 0 0
  1. ################################################################################
  2. #                      IXFURU'S STEPS CALENDER
  3. ################################################################################
  4. #                This script controls time through player steps.  Tracks day,
  5. # night effects, tracking of dates based on a custom calender.  This script also
  6. # adds unique features like birthdays, holidays and lifespans.  Greatly
  7. # customizable with 200 lines of options.  This script also adds up to four
  8. # new scenes to a project, Scene_Clock, Scene_Calender and Scene_Lifespan,
  9. # Scene_Birthday.
  10. # This script enables you to set variables to be altered based on time elapse,
  11. # with fully customizable months, seasons and more.  Just place the script
  12. # in the script editor above main and below materials.  Then, read through the
  13. # module and change things to better suit your own project.   Pay close attention
  14. # to the scripts you assign here and make sure you set their ids up accordingly
  15. # in the game editor.  You can set the current time at any point in the game
  16. # with script call:  $game_calender.set_time(year, month, day, hour)
  17. ################################################################################
  18. #                     CREDIT:
  19. #First of all, if you use this script AND you use the default images for
  20. #backgrounds and windowskins in your scenes, you should credit WORATANA who
  21. # made the utility from which the windowskins were generated, and Enterbrain,
  22. # EvilEagle, MatsuoKaito, FirstSeed, wallpapersexpress.com and
  23. # ultimate-nature-wallpapers.com.
  24. #  !!! DO NOT REDISTRIBUTE THE IMAGES HEREIN FOR COMMERCIAL PROJECTS!!!
  25. # You can use this script in any project you want.  In non-commercial, please just
  26. # give me(Ixfuru) credit.  For commercial, contact me on the forums of RPGMakerVX.net,
  27. # or RMRK.net.  You can also visit my personal forum on RPGMakerVX.net in the
  28. # FINISH LINE user forum.  Thanks and I hope you enjoy it.
  29. ################################################################################
  30.  
  31. module Steps_Calender
  32.      
  33.   CALENDER_SWITCH = 18 # This is the main switch which controls time.  It should
  34.   # be noted that you CAN still use the Scenes and time alterations with this
  35.   # switch OFF; However, all time will have to be adjusted manually, as if off,
  36.   # it won't track time through steps.
  37.  
  38.   # How many steps in an hour
  39.   TIME_STEPCHECK = 60  
  40.   # Alternately, you can use an in-game variable to track the Steps Calender steps which
  41.   # the party has taken with the following script call in a common
  42.   # event parallel process:
  43.   #                    $game_variables[x] = $game_calender.hoursteps
  44.   # However, this is not recommnded, as they are already tracked for you and can
  45.   # be viewed in Scene_Clock.  If you choose to do this, I can't assure you that
  46.   # there will be no lag.
  47.  
  48.  
  49.   #Hour Altered variables are variables you wish to altered each time the
  50.   #hour is passed.  This is good for say a specific status which only has
  51.   #effect for a given amount of time.  Like say, drunk!   You're drunk, but when
  52.   #some time passes, you get less and less intoxicated.  The set up is like
  53.   #follows:
  54.   #           variable_id => [minimum, maximum, amount]
  55.   #    wherein, the variable_id is the id of variable in the database, the
  56.   # minimum is the least value this variable can reach.  Maximum is the max
  57.   # value, and amount is the amount by which the variable is altered each
  58.   # time the player has taken TIME_STEPCHECK steps.
  59.   HOUR_ALTERED_VARIABLES = {#<<<<Don't touch this!!
  60.  
  61.   30 => [0, 10, -1]
  62.  
  63.   } #<<<Don't touch this!!!
  64.  
  65.   DAY_HOURS = 24  #The amount of hours in a day.
  66.  
  67.   # Day Altered Variables are variables you wish to alter each time a day passes.
  68.   # setup is like this:
  69.   #          variable_id => [minimum, maximum, amount]
  70.   DAY_ALTERED_VARIABLES = { #<<<<Don't touch this!!!
  71.  
  72.   31 => [0, 10000, 1]
  73.  
  74.   } #<<<<Don't touch this!!!
  75.  
  76.   MONTH_DAYS = 30  #The amount of days in a month
  77.   # Month Altered Variables are variables which you wish to alter each time a
  78.   # month passes.  Setup:
  79.   #            variable_id = [minimum, maximum, amount]
  80.  
  81.   MONTH_ALTERED_VARIABLES = { #<<<Don't touch this!!!
  82.  
  83.   32 => [0, 3, 1]
  84.  
  85.   }
  86.  
  87.   YEAR_MONTHS = 12  #The amount of months in a year
  88.   #Below, set up the names of the months.  Make sure you edit a month's data
  89.   #for every month you placed in the YEAR_MONTHS constant.  Setup:
  90.   #                        month_id => month_name
  91.   MONTHS = {
  92.  
  93.   1 => "January",
  94.   2 => "February",
  95.   3 => "March",
  96.   4 => "April",
  97.   5 => "May",
  98.   6 => "June",
  99.   7 => "July",
  100.   8 => "August",
  101.   9 => "September",
  102.   10 => "October",
  103.   11 => "November",
  104.   12 => "December"
  105.  
  106.   }
  107.  
  108.   #Year Altered Variables are variables which you wish to alter each time a year
  109.   # passes.  (There is setup for birthdays, if you wish to use it, so you can
  110.   # use this for any thing else you wish to use.) Setup:
  111.   #                              variable_id = [minimum, maximum, amount]
  112.   YEAR_ALTERED_VARIABLES = {
  113.  
  114.   33 => [0, 20, -1]
  115.  
  116.   }
  117.  
  118.   #Seasons are setup to adjust switches, which you can then use to alter graphics,
  119.   # alter some kind of gardening system, etc.  You set them up like this:
  120.   #Season_id => [month_start, day_start, , month_end, day_end, switch_id, season_name]
  121.   #For best results, make sure one season ends and another season starts the day
  122.   # after.   LIMITATION:   You can't have two seasons in one month.  You HAVE to
  123.   # have a month start and month end storing different values!
  124.   USE_SEASONS = true  # should script check for season changes
  125.   SEASONS = { #<<<Don't delete this!!!
  126.   1 => [11, 16, 2, 15, 38, "Winter"],
  127.   2 => [2, 16, 5, 15, 39, "Spring"],
  128.   3 => [5, 16, 8, 15, 40, "Summer"],
  129.   4 => [8, 16, 11, 15, 41, "Fall"]
  130.  
  131.   }#<<<Don't delete this!!!
  132.   #If you are using the seasons system, you can put images into the system folder
  133.   # with the same name as the season in the above array.  This will be used as the
  134.   # calender back, instead of the default one when the calender scene is viewed,
  135.   # dependent upon the current season.  If none are listed for specific day,
  136.   # then the default CALENDER_BACK will be displayed instead.
  137.  
  138.   #Birthdays are set up with switches, which activate on the actor's birthday and
  139.   # then deactivate when the day is over. You can use this switch then to set up
  140.   # events in the editor to occur only when it's the actor's birthday.
  141.   # Setting this up requires use of the following guide:
  142.   #               actor_id => switch_id
  143.   # Actor birthdays will be set up through the Scene_Birthday, which you can
  144.   # call with this.  There is a variable which you MUST set prior to
  145.   # calling the scene.  If you don't set it, and it's at zero, it'll set itself
  146.   # to 1 by default before calling the scenes. The variable can be set up at
  147.   # line 277, and is used to tell who's birthday is currently being editted.
  148.   #         $scene = Scene_Birthday.new
  149.   # You can also bypass the scene if you wish, and just set the birthdays
  150.   # manually via script calls:
  151.   #          $game_actors[x].birthday_month
  152.   #                   and
  153.   #          $game_actors[x].birthday_day
  154.   #    This will do little good, if you are not using the birthday system, but
  155.   # it's little good unless you're using the birthday system included, as nothing
  156.   # special on the given day unless you work it in somehow yourself.  Nonetheless,
  157.   # the option's there.
  158.   USE_BIRTHDAYS = true  #should the script check for birthdays
  159.   BIRTHDAY_SWITCHES = {#<<<<Don't delete this!!!
  160.  
  161.   1 => 30,
  162.   2 => 31,
  163.   3 => 32,
  164.   4 => 33,
  165.   5 => 48
  166.  
  167.   }#<<<Don't delete this!!!
  168.   BIRTHDAY_ME = "Fanfare1"  # Sound Effect which will alert there is a birthday.
  169.   BIRTHDAY_STATUS_STRING = "BIRTHDAY!"  # String shown in status window when actor birthday.
  170.   BIRTHDAY_STATUS_COLOR = 6 # text color of birthday string
  171.   BIRTHDAY_STATUS_ICON = 152  #Icon signifying birthday
  172.   BIRTHDAY_GOLD_GIFT = 1000 #Amount of gold given on birthday
  173.   BIRTHDAY_STATE = 20 #State given on birthday
  174.   BIRTHDAY_COMMON_EVENT = 2
  175.  
  176.   #Holidays are much the same, in that they are run off switches, giving you ample
  177.   # ability to use the switch to correspond with the given day.  Setup:
  178.   #                    month_id => day => [switch_id, holiday_name, music_effect, common_event]
  179.   #Replace the month_id with the key value of the month's name in MONTHS constant.
  180.   #Then, replace the day with the given month's day you wish to have the holiday
  181.   # fall on.  For instance in the first two, '6 => 2 =>' Would say 6th month, 2nd
  182.   # day.  The first position in the inner array is the switch id of the switch you
  183.   # want to activate on the given day.  Next the first string is the holiday's
  184.   # name.  The second string is the Music Effect from AUDIO/ME file that you want
  185.   # to play.  The last variable is the number of common event you wish to call.
  186.   # You MUST place a variable there, but if you don't want anything to happen,
  187.   # just leave the common event in the database blank.
  188.   USE_HOLIDAYS = true   #should the script check for holidays
  189.   HOLIDAYS = { #<<<<Don't delete this!!!
  190.  
  191.   1 => {1 => [34, "New Years", "FanFare2", 3],
  192.         23 => [35, "Gamers Day", "FanFare2", 4]},
  193.   7 => {4 => [36, "Independence Day", "FanFare2", 5]},
  194.   12 => {25 => [37, "Christmas", "FanFare2", 6]}
  195.  
  196.   } #<<<<<<<<<<Don't delete this!!!
  197.  
  198.   # Lifespan is a way to give an actor a set number of years he/she can live.
  199.   # You can access the lifespan of an actor by calling this script call:
  200.   #                                $scene = Scene_Lifespan.new
  201.   #   to add time place:
  202.   #      $game_actors[x].add_lifespan_time(years, months, days, hours, end_game?)
  203.   # to subtract time place:
  204.   #      $game_actors[x].subtract_lifespan_time(years, months, days, hours, end_game?)
  205.   # replace the x with the actor's id.  The year, month, day and hour specifies
  206.   # the exact moment the actor will cease to exist.  It should be clarified,
  207.   # that upon reaching this date, the actor will be removed from party and any
  208.   # atttempt to add them, will fail.  Also, if there are no actors left after the
  209.   # actor's removal, the game will end.  The 'end_game?' element array, tells
  210.   # whether or not the game should end regardless of whether or not there are
  211.   # other actors in the party.  Set to true, it will end, set to false, it will
  212.   # continue without the actor.  Below is the default value for lifespan.  This
  213.   # value will be added to the value of the start date, producing a default
  214.   # lifespan for all actors who's lifespan has not been stated with script calls.
  215.   # To check the lifespan of an actor, call $scene =  Scene_Lifespan.new(actor_id)
  216.   # This will call up a window in which the actor's lifespan will be visible.
  217.   USE_LIFESPAN = true #should the script check for lifespan
  218.   DLS_YRS = 50
  219.   DLS_MTHS = 6
  220.   DLS_DAYS = 10
  221.   LIFESPAN_BACK = 'EBCorridor' #spcifies which picture in graphic/system folder to place
  222.   #                      as background for lifespan scene.
  223.   #The following will specify a common event to run when an actor dies due to
  224.   # LIFESPAN.
  225.   LIFESPAN_DEATH_EVENT = 1
  226.   LIFESPAN_RUNOUT = " has died of old age."
  227.   # You can bypass the lifespan and make an actor 'deceased' by calling this
  228.   # script call:
  229.   #          $game_actors[x].make_deceased
  230.   # Further, you can revive a deceased actor with:
  231.   #          $game_actors[x].erase_deceased
  232.   # Replace the x in these two calls with the id of the actor you wish to affect.
  233.   # In addition, you can check if an actor is deceased by using a script in a
  234.   # conditional branch:
  235.   #             $game_actors[x].is_deceased?
  236.  
  237.   #The following four values specify the start up value for the year, month,
  238.   # day and hour in which the game will commense when "new game" is selected.
  239.   START_YEAR = 2000
  240.   START_MONTH = 4
  241.   START_DAY = 1
  242.   START_HOUR = 8
  243.  
  244.   #The following will specify the 'segments' of a day.  The setup:
  245.   #  segment_id => [segment_name, begin, end, red, green, blue, gray, switch_id]
  246.   # Segment_id will be the hash key for the given day segment.  Set segment_name
  247.   # to whatever you want to the part of day.  Set begin and end to the values of
  248.   # hours between which the segment will be active.  Set the colors, R, G, B, GRAY
  249.   # to values between 0-255 which will account for TINT of the screen during
  250.   # those hours.   Set switch_id to the switch which you want to turn on during
  251.   # this part of the day.  Much like seasons, adjust the segments, so that one
  252.   # starts one hour after the other ends.  It is also very important that whatever
  253.   # you choose, all start times must be lower than end times, as the script uses
  254.   # >= start and <= end.  Therefor, if you placed a segment beginning at 22 and
  255.   # ending at 5, the script will set this for >= 22 and <= 5 which is impossible
  256.   # and therefor won't work.
  257.   USE_DAY_SEGMENTS = true
  258.   DAY_SEGMENTS = { #<<< Don't delete this!!!
  259.   1 => ["Morning", 6, 11, 0, 0, 0, 0, 42],
  260.   2 => ["Afternoon", 12, 17, 0, 0, 0, 43],
  261.   3 => ["Evening", 17, 23, -68, -68, -68, 0, 44],
  262.   4 => ["Night", 0, 5, -170, -170, -170, 0, 45]
  263.  
  264.   }
  265.  
  266.   #The following is an array of switches which will alter the script to disregard
  267.   # the day_segment tinting, this is crucial to games where you will have well-lit
  268.   # interiors.  You would then set the no tint switch when entering the interior
  269.   # and the tint would return to 0, 0, 0, 0 for the duration of your time there.
  270.   NO_TINT_SWITCHES = [46, 47]
  271.  
  272.   #The following group of constants will be used within the Calender Scene for
  273.   # a more custom appearance.  You can call the calender scene at any time,
  274.   # using $scene = Scene_Calender.new
  275.   CALENDER_BACK = "FSCalender"  # Finds a file in your system folder to be displayed as
  276.                       # the background.
  277.   CALENDER_HEADING = "CALENDER"
  278.   CALENDER_HEADING_SIZE = 55
  279.   CALENDER_HEADING_COLOR = 20
  280.   YEAR_STRING = "Year:  "  #displays next to the value for year
  281.   MONTH_STRING = "Month:  " #displays next to month value
  282.   DAY_STRING = "Day:  " #displays next to value of day
  283.   HOUR_STRING = "Time:  " #displays next to the hour value
  284.   CALENDER_TEXT_SIZE = 30  #font size of calender information
  285.   CALENDER_STRING_COLOR = 27  #color of parameter strings in calender scene
  286.   CALENDER_VALUES_COLOR = 21  #color of values in calender parameters
  287.   CALENDER_WINDOWSKIN = "CalenderWindow"
  288.   CALENDER_OPACITY = 0 # set this from 0 (transparent) to 255.  This will be used
  289.   #                      to determine how dark you want the Windowskin in the
  290.   #                       Scene_Calender drawn.  It also applies to the Optional
  291.   #                         Windows of Scene_Calender.
  292.   #
  293.   # The next few are of course optional, dependent upon if you chose to use the
  294.   # birthdays, holidays, seasons and segments part of the script.
  295.   #For this first array, the script will display the different information for
  296.   # the given optional parts in all four corners.  
  297.   #                     [upper_left, bottom_left, upper_right, bottom_right]
  298.   # Use the following ids for each birthdays = 1, holidays = 2, seasons = 3,
  299.   # segments = 4.   So this:
  300.   #        [3, 2, 4, 1]
  301.   #      Would say to show the seasons in the upperleft, the holidays in the
  302.   # lowerleft, the segments in the upper right and the holidays in the lower
  303.   # right of the window.  
  304.   OPTIONAL_ALIGNMENT = [1, 4, 2, 3]
  305.   SEASON_STRING = "Season:  "
  306.   BIRTHDAY_STRING = "Birthdays:  "
  307.   HOLIDAY_STRING = "Holidays:  "
  308.   SEGMENT_STRING = "T.O.D.:  "
  309.   OPTIONAL_COLOR = 10
  310.  
  311.  
  312.   # A final scene can be called from a script call:
  313.   #          $scene = Scene_Clock.new
  314.   # This will be good for a quick look at what time it is if the player happens
  315.   # upon a wall clock or something.
  316.   CLOCK_IMAGE = "MatsuoKaito"  # an image from the system folder
  317.   CLOCK_HEADING = "CLOCK"  # the title heading of the clock scene
  318.   CLOCK_COLOR = 14
  319.   CLOCK_SIZE = 44
  320.   CLOCK_WINDOWSKIN = "ClockWindow"
  321.   CLOCK_OPACITY = 0 # from 0-255, used to determine how dark you want the Window
  322.   #                      Skin drawn during Scene_Clock
  323.  
  324.  
  325.   # These constant is used during multiple scenes.
  326.   ACTOR_FACE_VARIABLE = 34  #Variable set to identify which actor's time stats are being veiwed
  327.   ACTOR_NAME_COLOR = 11  #text color for actor's name
  328.  
  329.   #These constants are used during the LIFESPAN scene:
  330.   LS_BANNERTEXT_COLOR = 25
  331.   LS_BANNERTEXT_SIZE = 45
  332.   LS_SYSTEMTEXT_COLOR = 16
  333.   LS_HEADING = "LIFESPAN"
  334.   LS_YEARS_STRING = "Years to Live:"
  335.   LS_MONTHS_STRING = "Months to Live:"
  336.   LS_DAYS_STRING = "Days to Live:"
  337.   LS_WINDOWSKIN = "LifeSpanWindow"
  338.   LS_OPACITY = 0 # from 0-255 (see OPACITY settings for CLOCK)
  339.  
  340.   #Next, you can set the time during which a sleep at the inn runs its course.
  341.   # With the editor, you can use this script call to advance time to the
  342.   # INN_TIME:
  343.   #            $game_calender.inn_call
  344.   # Set up the constant below with what hour you wish a sleep at the inn to
  345.   # advance to.
  346.   INN_TIME = 7
  347.  
  348.   # Here, you will set the PopUp Window Sound Effect.  This window will display
  349.   # information if say an actor has died from old age, or you try to add an
  350.   # actor who has deceased...Must be in the SE folder of the Audio Directory.
  351.   POPUP_SE = "Flash1"
  352.   POPUP_WAIT = 180 # how many frames the popup will be visible before disposing
  353.  
  354.   #The last value to be set is this boolean.  This will allow access to the
  355.   # calender from the menu, if true.  And if not, it will only allow access by
  356.   # using script call.
  357.   MENU_CALENDER = true
  358.  
  359.  
  360.  
  361.   ##############################################################################
  362.   #      END OF EDITTABLE REGION:
  363.   # Any further editting is done so at your own risk!!
  364.   ##############################################################################
  365. end
  366.  
  367. ################################################################################
  368. #                 GAME CALENDER (Custom Class)
  369. ################################################################################
  370.  
  371. class Game_Calender
  372.   include Steps_Calender  # include the module
  373.  
  374.   attr_accessor :hour
  375.   attr_accessor :day
  376.   attr_accessor :month
  377.   attr_accessor :year
  378.   attr_accessor :season
  379.   attr_accessor :holiday
  380.   attr_accessor :birthday
  381.   attr_accessor :segment
  382.   attr_accessor :tinting
  383.   attr_accessor :hoursteps
  384.   attr_accessor :stepchecker
  385.  
  386.   #=============================================================================
  387.   #                         Initialize
  388.   #=============================================================================
  389.   def initialize
  390.    
  391.     @stepchecker = TIME_STEPCHECK
  392.     @hoursteps = 0
  393.     @tinting = []
  394.     @bd_music_played = false
  395.     @hd_music_played = false
  396.     @big_days = []
  397.     @bd_gold_given = false
  398.     @bd_event_run = false
  399.     @hd_event_run = false
  400.     @bd_state_applied = false
  401.     @tint_set = false
  402.     @hour = START_HOUR
  403.     @day = START_DAY
  404.     @month = START_MONTH
  405.     @year = START_YEAR
  406.     if USE_SEASONS == true
  407.       get_seasons
  408.       determine_current_season(@month, @day)
  409.     end
  410.     if USE_BIRTHDAYS == true
  411.       get_birthdays
  412.       determine_current_birthday(@month, @day)
  413.     end
  414.     if USE_HOLIDAYS == true
  415.       get_holidays
  416.       determine_current_holiday(@month, @day)
  417.     end
  418.     if USE_DAY_SEGMENTS == true
  419.       get_segments
  420.       determine_current_segment(@hour)
  421.     end
  422.    
  423.   end
  424.  
  425.   #=============================================================================
  426.   #            Get Seasons
  427.   #=============================================================================
  428.  
  429.   def get_seasons
  430.     @seasons = SEASONS.keys
  431.   end
  432.  
  433.   #=============================================================================
  434.   #          Get Holidays
  435.   #=============================================================================
  436.   def get_holidays
  437.     @holidays = HOLIDAYS.keys
  438.   end
  439.  
  440.   #=============================================================================
  441.   #         Get Birthdays
  442.   #=============================================================================
  443.   def get_birthdays
  444.     @birthdays = []
  445.     for member in $game_party.members
  446.       @birthdays.push(member.id)
  447.     end
  448.   end
  449.  
  450.   #=============================================================================
  451.   #          Get Segments
  452.   #=============================================================================
  453.   def get_segments
  454.     @segments = DAY_SEGMENTS.keys
  455.   end
  456.  
  457.   #=============================================================================
  458.   #            Determine Current Season
  459.   #=============================================================================
  460.   def determine_current_season(month, day)
  461.     unless @seasons.empty?
  462.       for i in @seasons  #once for every season in keys
  463.         if SEASONS[i][0] < SEASONS[i][2] #does the season have a start
  464.                                       # month less than the end date?
  465.           if month >= SEASONS[i][0] and month <= SEASONS[i][2]
  466.             if month == SEASONS[i][0] and day >= SEASONS[i][1]
  467.               @season = SEASONS[i][5]
  468.               turn_off_season_switches
  469.               $game_switches[SEASONS[i][4]] = true
  470.             elsif month == SEASONS[i][2] and day <= SEASONS[i][3]
  471.               @season = SEASONS[i][5]   # set season string
  472.               turn_off_season_switches  # call deactivation of all season switches
  473.               $game_swithces[SEASONS[i][4]] = true  #turn on appropriate switch
  474.             else
  475.               @season = SEASONS[i][5]
  476.               turn_off_season_switches
  477.               $game_switches[SEASONS[i][4]] = true
  478.             end
  479.           end
  480.         elsif SEASONS[i][0] > SEASONS[i][2]
  481.           if month >= SEASONS[i][0] and month <= MONTHS.size or month > 0 and month <= SEASONS[i][2]
  482.             if month == SEASONS[i][0] and day >= SEASONS[i][1]
  483.               @season = SEASONS[i][5]
  484.               turn_off_season_switches
  485.               $game_switches[SEASONS[i][4]] = true
  486.             elsif month == SEASONS[i][2]
  487.               @season = SEASONS[i][5]
  488.               turn_off_season_switches
  489.               $game_switches[SEASONS[i][4]] = true
  490.             else
  491.               @season = SEASONS[i][5]
  492.               turn_off_season_switches
  493.               $game_switches[SEASONS[i][4]] = true
  494.             end
  495.           end
  496.         end
  497.       end
  498.     end
  499.   end
  500.  
  501.   #=============================================================================
  502.   #             Control Season Switch
  503.   #=============================================================================
  504.   def turn_off_season_switches
  505.     unless @seasons.empty?
  506.       for i in @seasons                 # once for every key of the hash
  507.         $game_switches[SEASONS[i][4]] = false   # turn off all switches
  508.       end
  509.     end
  510.   end
  511.  
  512.  
  513.   #=============================================================================
  514.   #                 Determine Current Holiday
  515.   #=============================================================================
  516.   def determine_current_holiday(month, day)
  517.     for holiday in @holidays
  518.       if month == holiday
  519.         checkdays = HOLIDAYS[holiday].keys
  520.         for check in checkdays
  521.           if day == check
  522.             @holiday = HOLIDAYS[holiday][check][1]
  523.             turn_off_holiday_switches
  524.             if HOLIDAYS[holiday][chkeck][0] != nil
  525.               $game_switches[HOLIDAYS[holiday][check][0]] = true
  526.               if hd_music_played == false
  527.                 Audio.me_play('Audio/ME/' + HOLIDAY[holiday][check][2], 80, 100)
  528.                 @hd_music_played = true
  529.               end
  530.             end
  531.             if hd_event_run == false
  532.               $game_temp.common_event_id = HOLIDAY[holiday][check][3]
  533.               hd_event_run = true
  534.             end
  535.           end
  536.         end
  537.       end
  538.     end
  539.   end
  540.  
  541.   #=============================================================================
  542.   #                  Turn Off Holiday Switches
  543.   #=============================================================================
  544.   def turn_off_holiday_switches
  545.     unless @holidays.empty?
  546.       for i in @holidays
  547.         x = HOLIDAYS[i].keys
  548.         for a in x
  549.           if HOLIDAYS[i][a][0] != nil
  550.             $game_switches[HOLIDAYS[i][a][0]] = false
  551.           end
  552.         end
  553.       end
  554.     end
  555.   end
  556.  
  557.   #=============================================================================
  558.   #                       Determine Current Birthday
  559.   #=============================================================================
  560.   def determine_current_birthday(month, day)
  561.     for i in $game_party.members
  562.       if i.birthday_month == month
  563.         if i.birthday_day == day
  564.           bdid = i.id
  565.           @big_days.push(bdid)
  566.           if BIRTHDAY_SWITCHES[bdid] != nil
  567.             $game_switches[BIRTHDAY_SWITCHES[bdid]] = true
  568.             if BIRTHDAY_GOLD_GIFT != nil
  569.               if @bd_gold_given == false
  570.                 $game_party.gold += BIRTHDAY_GOLD_GIFT
  571.               end
  572.             end
  573.           end
  574.           if @bd_music_played == false
  575.             Audio.me_play('Audio/ME/' + BIRTHDAY_ME, 80, 100)
  576.             @bd_music_played = true
  577.           end
  578.           if BIRTHDAY_COMMON_EVENT != nil
  579.             if @bd_event_run == false
  580.               $game_temp.common_event_id = BIRTHDAY_COMMON_EVENT
  581.             end
  582.           end
  583.           if BIRTHDAY_STATE != nil
  584.             if @bd_state_applied == false
  585.               i.add_state(BIRTHDAY_STATE)
  586.               @bd_state_applied = true
  587.             end
  588.           end
  589.         end
  590.       end
  591.     end
  592.     adjust_birthday_switches
  593.   end
  594.  
  595.   #=============================================================================
  596.   #               Determine Current Segment
  597.   #=============================================================================
  598.   def determine_current_segment(hour)
  599.     for segment in @segments
  600.       if hour >= DAY_SEGMENTS[segment][1]
  601.         if hour <= DAY_SEGMENTS[segment][2]
  602.           @segment = DAY_SEGMENTS[segment][0]
  603.           turn_off_segment_switches
  604.           if DAY_SEGMENTS[segment][7] != nil
  605.             $game_switches[DAY_SEGMENTS[segment][7]] = true
  606.           end
  607.           change_segment_tone(segment)
  608.         end
  609.       end
  610.     end
  611.   end
  612.  
  613.   #=============================================================================
  614.   #           Turn Off Segment Switches
  615.   #=============================================================================
  616.   def turn_off_segment_switches
  617.     unless @segments.empty?
  618.       for i in @segments
  619.         if DAY_SEGMENTS[i][7] != nil
  620.           $game_switches[DAY_SEGMENTS[i][7]] = false
  621.         end
  622.       end
  623.     end
  624.   end
  625.  
  626.   #=============================================================================
  627.   #             Change Segment Tone
  628.   #=============================================================================
  629.   def change_segment_tone(segment)
  630.     for i in NO_TINT_SWITCHES
  631.       if $game_switches[i] == true
  632.         @tone = Tone.new(0, 0, 0, 0)
  633.         $game_map.screen.start_tone_change(tone, 12)
  634.       else
  635.         @tinting[0] = DAY_SEGMENTS[segment][3]
  636.         @tinting[1] = DAY_SEGMENTS[segment][4]
  637.         @tinting[2] = DAY_SEGMENTS[segment][5]
  638.         @tinting[3] = DAY_SEGMENTS[segment][6]
  639.         tone = Tone.new(@tinting[0], @tinting[1], @tinting[2], @tinting[3])
  640.         $game_map.screen.start_tone_change(tone, 12)
  641.         @tone_set = true
  642.       end
  643.     end
  644.   end
  645.  
  646.   #=============================================================================
  647.   #              Each Step Adjust
  648.   #=============================================================================
  649.   def each_step_adjust
  650.     if @hoursteps >= TIME_STEPCHECK
  651.       @hour += 1
  652.       adjust_hour_altered_variables(1)
  653.       if USE_DAY_SEGMENTS == true
  654.         determine_current_segment(@hour)
  655.       end
  656.       @stepchecker += TIME_STEPCHECK
  657.       @hoursteps = 0
  658.     end
  659.     if @hour > DAY_HOURS - 1
  660.       @day += 1
  661.       @hour = 0
  662.       adjust_day_altered_variables(1)
  663.       make_daily_changes
  664.     end
  665.     if @day > MONTH_DAYS
  666.       @month += 1
  667.       @day = 1
  668.       adjust_month_altered_variables(1)
  669.       if USE_SEASONS == true
  670.         determine_current_season(@month, @day)
  671.       end
  672.     end
  673.     if @month > YEAR_MONTHS
  674.       @year += 1
  675.       @month = 1
  676.       adjust_year_altered_variables(1)
  677.     end
  678.   end
  679.  
  680.   #=============================================================================
  681.   #              Adjust Hour Altered Variables
  682.   #=============================================================================
  683.   def adjust_hour_altered_variables(amount)
  684.     unless HOUR_ALTERED_VARIABLES.empty?
  685.       hav = HOUR_ALTERED_VARIABLES.keys
  686.       for v in hav
  687.         $game_variables[v] += HOUR_ALTERED_VARIABLES[v][2] * amount #adjust the variable
  688.       end
  689.       if $game_variables[v] > HOUR_ALTERED_VARIABLES[v][1] #is variable more than max
  690.         $game_variables[v] = HOUR_ALTERED_VARIALBES[v][1] #set variable to max
  691.       end
  692.       if $game_variables[v] < HOUR_ALTERED_VARIABLES[v][0] #is variable less than minimum
  693.         $game_variables[v] = HOUR_ALTERED_VARIABLES[v][0] #set variable to minimum
  694.       end
  695.     end
  696.   end
  697.  
  698.   #=============================================================================
  699.   #                Adjust Day Altered Variables
  700.   #=============================================================================
  701.   def adjust_day_altered_variables(amount)
  702.     unless DAY_ALTERED_VARIABLES.empty?
  703.       dav = DAY_ALTERED_VARIABLES.keys
  704.       for d in dav
  705.         $game_variables[d] += DAY_ALTERED_VARIABLES[d][2] * amount
  706.       end
  707.       if $game_variables[d] > DAY_ALTERED_VARIABLES[d][1]
  708.         $game_variables[d] = DAY_ALTERED_VARIABLES[d][1]
  709.       end
  710.       if $game_variables[d] < DAY_ALTERED_VARIABLES[d][0]
  711.         $game_variables[d] = DAY_ALTERED_VARIABLES[d][0]
  712.       end
  713.     end
  714.   end
  715.  
  716.   #=============================================================================
  717.   #                   Adjust Month Altered Variables
  718.   #=============================================================================
  719.   def adjust_month_altered_variables(amount)
  720.     unless MONTH_ALTERED_VARIABLES.empty?
  721.       mav = MONTH_ALTERED_VARIABLES.keys
  722.       for m in mav
  723.         $game_variables[m] += MONTH_ALTERED_VARIABLES[m][2] * amount
  724.       end
  725.       if $game_variables[m] > MONTH_ALTERED_VARIABLES[m][1]
  726.         $game_variables[m] = MONTH_ALTERED_VARIABLES[m][1]
  727.       end
  728.       if $game_variables[m] < MONTH_ALTERED_VARIABLES[m][0]
  729.         $game_variables[m] = MONTH_ALTERED_VARIABLES[m][0]
  730.       end
  731.     end
  732.   end
  733.  
  734.   #=============================================================================
  735.   #                    Adjust Year Altered Variables
  736.   #=============================================================================
  737.   def adjust_year_altered_variables(amount)
  738.     unless YEAR_ALTERED_VARIABLES.empty?
  739.       yav = YEAR_ALTERED_VARIABLES.keys
  740.       for y in yav
  741.         $game_variables[y] += YEAR_ALTERED_VARIABLES[y][2] * amount
  742.       end
  743.       if $game_variables[y] > YEAR_ALTERED_VARIABLES[y][1]
  744.         $game_variables[y] = YEAR_ALTERED_VARIABLES[y][1]
  745.       end
  746.       if $game_variables[y] < YEAR_ALTERED_VARIABLES[y][0]
  747.         $game_variables[y] = YEAR_ALTERED_VARIABLES[y][0]
  748.       end
  749.     end
  750.   end
  751.  
  752.   #=============================================================================
  753.   #                      Adjust Birthday Switches
  754.   #=============================================================================
  755.   def adjust_birthday_switches
  756.     unless @birthdays.empty?
  757.       for bd in @birthdays
  758.         $game_switches[bd] = false
  759.       end
  760.     end
  761.     unless @big_days.empty?
  762.       for bds in @big_days
  763.         $game_switches[bds] = true
  764.       end
  765.     end
  766.   end
  767.  
  768.   #=============================================================================
  769.   #                         Make Daily Changes
  770.   #=============================================================================
  771.   def make_daily_changes
  772.     if USE_BIRTHDAYS == true
  773.       @big_days.clear
  774.       @bd_gold_given = false
  775.       @bd_music_played = false
  776.       @bd_event_run = false
  777.       adjust_birthday_switches
  778.       @hd_music_played = false
  779.       @hd_event_run = false
  780.       for member in $game_party.members
  781.         member.remove_state(BIRTHDAY_STATE)
  782.       end
  783.     end
  784.     if USE_LIFESPAN == true
  785.       for actor in $game_party.members
  786.         actor.gradual_decrement_lifespan
  787.       end
  788.     end
  789.     if USE_BIRTHDAYS == true
  790.       determine_current_birthday(@month, @day)
  791.     end
  792.     if USE_HOLIDAYS == true
  793.       determine_current_holiday(@month, @day)
  794.     end
  795.   end
  796.  
  797.   #=============================================================================
  798.   #                           Set Time
  799.   #=============================================================================
  800.   def set_time(hour, day, month, year)
  801.     mta = 0
  802.     dta = 0
  803.     hta = 0
  804.     if year > @year
  805.       adjust_year_altered_variables(year - @year)
  806.       mta = ((year * YEAR_MONTHS) + month) - @month
  807.       adjust_month_altered_variables(mta)
  808.       dta = ((mta * MONTH_DAYS) + day) - @day
  809.       adjust_day_altered_variables(dta)
  810.       hta = ((dta * DAY_HOURS) + hour) - @hour
  811.       adjust_hour_altered_variables(hta)
  812.     elsif month > @month
  813.       adjust_month_altered_variables(month - @month)
  814.       dta = ((month * MONTH_DAYS) + day) - @day
  815.       adjust_day_altered_variables(dta)
  816.       hta = ((dta * DAY_HOURS) + hour) - @hour
  817.       adjust_hour_altered_variables(hta)
  818.     elsif day > @day
  819.       adjust_day_altered_variables(day - @day)
  820.       hta = ((dta * DAY_HOURS) + hour) - @hour
  821.       adjust_hour_altered_variables(hta)
  822.     elsif hour > @hour
  823.       adjust_hour_altered_variables(hour - @hour)
  824.     end
  825.     span = 0
  826.     if USE_LIFESPAN == true
  827.       if year = @year
  828.         if month < @month
  829.           span = 1
  830.         elsif month > @month
  831.           span = 0
  832.         elsif month == @month
  833.           if day < @day
  834.             span = 1
  835.           elsif day > @day
  836.             span = 0
  837.           end
  838.         end
  839.       elsif year > @year
  840.         span = 0
  841.       elsif year < @year
  842.         span = 1
  843.       end
  844.     end
  845.     @hour = hour
  846.     @day = day
  847.     @month = month
  848.     @year = year
  849.     set_time_adjustment
  850.     if USE_LIFESPAN == true
  851.       for actor in $game_party.members
  852.         if span == 0
  853.           actor.modify_lifespan_add
  854.         elsif span == 1
  855.           actor.modify_lifespan_subtract
  856.         end
  857.       end
  858.     end
  859.   end
  860.  
  861.   #-----------------------------------------------------------------------------
  862.   #                          Set Time Adjustment
  863.   #-----------------------------------------------------------------------------
  864.    def set_time_adjustment
  865.     sth = @hour
  866.     std = @day
  867.     stm = @month
  868.     sty = @year
  869.     if sth >= DAY_HOURS
  870.       std = std + (sth / DAY_HOURS)
  871.       sth = sth % DAY_HOURS
  872.     end
  873.     if std >= MONTH_DAYS    
  874.       stm = stm + (std / MONTH_DAYS)
  875.       std = std % MONTH_DAYS    
  876.     end
  877.     if stm >= YEAR_MONTHS  
  878.       sty = sty + (stm / YEAR_MONTHS)
  879.       stm = stm % YEAR_MONTHS
  880.     end
  881.     @hour = sth  
  882.     @day = std
  883.     @month = stm
  884.     @year = sty
  885.     if USE_SEASONS == true
  886.       determine_current_season(@month, @day)
  887.     end
  888.     if USE_DAY_SEGMENTS == true
  889.       determine_current_segment(@hour)
  890.     end
  891.     if USE_HOLIDAYS == true
  892.       determine_current_holiday(@month, @day)
  893.     end
  894.     if USE_BIRTHDAYS == true
  895.       determine_current_birthday(@month, @day)
  896.     end
  897.   end
  898.    
  899.   #-----------------------------------------------------------------------------
  900.   #                           Increment Steps
  901.   #-----------------------------------------------------------------------------
  902.   def increment_steps
  903.     if $game_switches[CALENDER_SWITCH] == true
  904.       @hoursteps += 1
  905.       each_step_adjust
  906.     end
  907.   end
  908.  
  909.   #-----------------------------------------------------------------------------
  910.   #                          Inn Call
  911.   #-----------------------------------------------------------------------------
  912.   def inn_call
  913.     if @hour >= INN_TIME
  914.       @day += 1
  915.       @hour = INN_TIME
  916.     else
  917.       @hour = INN_TIME
  918.     end
  919.     set_time_adjustment
  920.   end
  921.  
  922.  
  923. end  # End of Class!
  924.  
  925.  
  926.  
  927. ################################################################################
  928. #                      GAME TEMP
  929. ################################################################################
  930. class Game_Temp
  931.   attr_accessor :birthday_month
  932.   attr_accessor :birthday_day
  933.   attr_accessor :birthday_actor_id
  934.  
  935.   alias sc_gt_initialize initialize unless $@
  936.   def initialize
  937.     sc_gt_initialize
  938.     @birthday_month = 1
  939.     @birthday_day = 1
  940.     @birthday_actor_id = 1
  941.   end
  942.  
  943.  
  944. end
  945.  
  946. ################################################################################
  947. #                   GAME ACTOR
  948. ################################################################################
  949. class Game_Actor < Game_Battler
  950.   include Steps_Calender
  951.  
  952.   attr_accessor :birthday_day
  953.   attr_accessor :birthday_month
  954.   attr_accessor :birthday_switch
  955.   attr_accessor :lifespan_years
  956.   attr_accessor :lifespan_months
  957.   attr_accessor :lifespan_days
  958.   attr_accessor :deceased
  959.   attr_accessor :end_game
  960.  
  961.   alias sc_ga_setup setup unless $@
  962.   def setup(actor_id)
  963.     sc_ga_setup(actor_id)
  964.     if USE_BIRTHDAYS
  965.       get_birthday_switch
  966.     end
  967.     if USE_LIFESPAN
  968.       get_actor_lifespan
  969.       check_for_deceased
  970.       @end_game = false
  971.     end
  972.   end
  973.  
  974.  
  975.   #-----------------------------------------------------------------------------
  976.   #                      Get Birthday Switch
  977.   #-----------------------------------------------------------------------------
  978.   def get_birthday_switch
  979.     unless BIRTHDAY_SWITCHES.empty?
  980.       if BIRTHDAY_SWITCHES.has_key?(@actor_id)
  981.         @birthday_switch = BIRTHDAY_SWITCHES[@actor_id]
  982.       end
  983.     end
  984.   end
  985.  
  986.   #-----------------------------------------------------------------------------
  987.   #                      Get Actor Lifespan
  988.   #-----------------------------------------------------------------------------
  989.   def get_actor_lifespan
  990.     @lifespan_years = DLS_YRS
  991.     @lifespan_months = DLS_MTHS
  992.     @lifespan_days = DLS_DAYS
  993.   end
  994.  
  995.   #-----------------------------------------------------------------------------
  996.   #                 Gradual Decrement Lifespan
  997.   #-----------------------------------------------------------------------------
  998.   def gradual_decrement_lifespan
  999.     @lifespan_days -= 1
  1000.     modify_lifespan_subtract
  1001.     check_for_deceased
  1002.   end
  1003.  
  1004.   #-----------------------------------------------------------------------------
  1005.   #                     Check for Deceased
  1006.   #-----------------------------------------------------------------------------
  1007.   def check_for_deceased
  1008.     if @lifespan_days <= 0
  1009.       if @lifespan_months <= 0
  1010.         if @lifepsan_years <= 0
  1011.           Audio.se_play("Audio/SE/" + POPUP_SE, 100, 80)
  1012.           @info_window = Window_Quickfo.new(@name + LIFESPAN_RUNOUT)
  1013.           Graphics.wait(240)
  1014.           make_deceased
  1015.           @info_window.dispose
  1016.         end
  1017.       end
  1018.     end
  1019.   end
  1020.  
  1021.  
  1022.   #-----------------------------------------------------------------------------
  1023.   #                   Set Birthday
  1024.   #-----------------------------------------------------------------------------
  1025.   def set_birthday(month, day)
  1026.     @birthday_month = month
  1027.     @birthday_day = day
  1028.   end
  1029.  
  1030.  
  1031.   #-----------------------------------------------------------------------------
  1032.   #          Add Lifespan Time
  1033.   #-----------------------------------------------------------------------------
  1034.   def add_lifespan_time(years, months, days, end_game = false)
  1035.     if @deceased == true
  1036.       string = "But this actor has deceased!"
  1037.       Audio.se_play("Audio/SE/" + POPUP_SE, 100, 80)
  1038.       @info_window = Window_Quickfo.new(string)
  1039.       Graphics.wait(POPUP_WAIT)
  1040.       @info_window.dispose
  1041.     else
  1042.       @lifespan_days += days
  1043.       @lifespan_months += months
  1044.       @lifespan_years += years
  1045.       @end_game = end_game
  1046.       modify_lifespan_add
  1047.     end
  1048.   end
  1049.  
  1050.   #-----------------------------------------------------------------------------
  1051.   #            Subtract Lifespan Time
  1052.   #-----------------------------------------------------------------------------
  1053.   def subtract_lifespan_time(years, months, days, end_game)
  1054.     if @deceased == true
  1055.       string = "But this actor has deceased!"
  1056.       Audio.se_play("Audio/SE/" + POPUP_SE, 100, 80)
  1057.       @info_window = Window_Quickfo.new(string)
  1058.       Graphics.wait(POPUP_WAIT)
  1059.       @info_window.dispose
  1060.     else
  1061.       @lifespan_days -= days
  1062.       @lifespan_months -= months
  1063.       @lifespan_years -= years
  1064.       @end_game = end_game
  1065.       modify_lifespan_subtract
  1066.     end
  1067.   end
  1068.  
  1069.  
  1070.   #-----------------------------------------------------------------------------
  1071.   #          Modify Lifespan Add
  1072.   #-----------------------------------------------------------------------------
  1073.   def modify_lifespan_add
  1074.     lsd = @lifespan_days
  1075.     lsm = @lifespan_months
  1076.     lsy = @lifespan_years
  1077.     if lsd >= MONTH_DAYS          # is lifespan days more or equal to days in a month
  1078.       lsm = lsm + (lsd / MONTH_DAYS)
  1079.       lsd = lsd % MONTH_DAYS    
  1080.     end
  1081.     if lsm >= YEAR_MONTHS   # is lifespan months more eual to months in a year
  1082.       lsy = lsy + (lsy / YEAR_MONTHS)
  1083.       lsm = lsy % YEAR_MONTHS
  1084.     end
  1085.     @lifespan_days = lsd   # reset the lifespan values
  1086.     @lifespan_months = lsm
  1087.     @lifespan_years = lsy
  1088.   end
  1089.  
  1090.   #-----------------------------------------------------------------------------
  1091.   #            Modify Lifespan Subtract
  1092.   #-----------------------------------------------------------------------------
  1093.   def modify_lifespan_subtract
  1094.     lsd = @lifespan_days
  1095.     lsm = @lifespan_months
  1096.     lsy = @lifespan_years
  1097.     if lsy < 0    # is lifespan years less than 0
  1098.       until lsy == 0
  1099.         lsy += 1
  1100.         lsm -= YEAR_MONTHS
  1101.       end
  1102.     end
  1103.     if lsm < 0    # is lifespan months less than 0
  1104.       until lsm == 0
  1105.         lsm += 1
  1106.         lsd -= MONTH_DAYS
  1107.       end
  1108.     end
  1109.     if lsd < 0   # is lifepsan days less than 0
  1110.       lsd = 0
  1111.     end
  1112.     @lifespan_days = lsd  # reset lifespan values
  1113.     @lifespan_months = lsm
  1114.     @lifespan_years = lsy
  1115.   end
  1116.  
  1117.   #-----------------------------------------------------------------------------
  1118.   #                  Make Deceased
  1119.   #-----------------------------------------------------------------------------
  1120.   def make_deceased
  1121.     if LIFESPAN_DEATH_EVENT != nil
  1122.       $game_temp.common_event_id = LIFESPAN_DEATH_EVENT
  1123.     end
  1124.     @lifespan_years = 0
  1125.     @lifespan_months = 0
  1126.     @lifespan_days = 0
  1127.     @deceased = true
  1128.     $game_party.check_for_deceased_actor
  1129.   end
  1130.  
  1131.   #-----------------------------------------------------------------------------
  1132.   #                 Erase Deceased
  1133.   #-----------------------------------------------------------------------------
  1134.   def erase_deceased
  1135.     @deceased = false
  1136.   end
  1137.  
  1138.   #-----------------------------------------------------------------------------
  1139.   #                   Is Deceased?
  1140.   #-----------------------------------------------------------------------------
  1141.   def is_deceased?
  1142.     if @deceased == true
  1143.       return true
  1144.     else
  1145.       return false
  1146.     end
  1147.   end
  1148.  
  1149.  
  1150.    
  1151. end
  1152.  
  1153. ################################################################################
  1154. #                  GAME_PARTY
  1155. ################################################################################
  1156. class Game_Party < Game_Unit
  1157.   include Steps_Calender
  1158.  
  1159.   attr_accessor :gold
  1160.  
  1161.   #--------------------------------------------------------------------------
  1162.   #                Add an Actor  (Overwritten Method!!!)
  1163.   #--------------------------------------------------------------------------
  1164.   def add_actor(actor_id)
  1165.     if USE_LIFESPAN == true
  1166.       if $game_actors[actor_id].deceased == true
  1167.         Audio.se_play("Audio/SE/" + POPUP_SE, 100, 80)
  1168.         @info_window = Window_Quickfo.new("But this actor is deceased!")
  1169.         Graphics.wait(POPUP_WAIT)
  1170.         @info_window.dispose
  1171.       elsif @actors.size < MAX_MEMBERS and not @actors.include?(actor_id)
  1172.         @actors.push(actor_id)
  1173.         $game_player.refresh
  1174.       end
  1175.     end
  1176.   end
  1177.  
  1178.   #-----------------------------------------------------------------------------
  1179.   #               Check for deceased Actor
  1180.   #-----------------------------------------------------------------------------
  1181.   def check_for_deceased_actor
  1182.     for actor in $game_party.members
  1183.       if actor.deceased == true
  1184.         remove_actor(actor)
  1185.         $game_player.refresh
  1186.       end
  1187.     end
  1188.   end
  1189.  
  1190. end
  1191.  
  1192. ################################################################################
  1193. #                       GAME PLAYER
  1194. ################################################################################
  1195. class Game_Player < Game_Character
  1196.   include Steps_Calender
  1197.  
  1198.   alias sc_gpl_increase_steps increase_steps unless $@
  1199.   def increase_steps
  1200.     sc_gpl_increase_steps
  1201.     $game_calender.increment_steps
  1202.     $game_party.check_for_deceased_actor
  1203.   end
  1204.  
  1205. end
  1206.  
  1207. ################################################################################
  1208. #                          WINDOW BASE
  1209. ################################################################################
  1210. class Window_Base < Window
  1211.   include Steps_Calender
  1212.  
  1213.   def draw_birthday_string(x, y)
  1214.     self.contents.font.color = text_color(BIRTHDAY_STATUS_COLOR)
  1215.     self.contents.draw_text(x, y, self.width, WLH, BIRTHDAY_STATUS_STRING)
  1216.     self.contents.font.color = normal_color
  1217.   end
  1218.  
  1219. end
  1220.  
  1221. ################################################################################
  1222. #                      WINDOW STATUS
  1223. ################################################################################
  1224. class Window_Status < Window_Base
  1225.   include Steps_Calender
  1226.  
  1227.   alias sc_ws_refresh refresh unless $@
  1228.   def refresh
  1229.     sc_ws_refresh
  1230.     if USE_BIRTHDAYS == true
  1231.       if $game_switches[BIRTHDAY_SWITCHES[@actor.id]] == true
  1232.         draw_icon(BIRTHDAY_STATUS_ICON, 32, 130, enabled = true)
  1233.         draw_birthday_string(80, 130)
  1234.       end
  1235.     end
  1236.   end
  1237.  
  1238. end
  1239.  
  1240. ################################################################################
  1241. #                       SCENE BASE
  1242. ################################################################################
  1243. class Scene_Base
  1244.   include Steps_Calender
  1245.  
  1246.   alias sc_sb_create_menu_background create_menu_background unless $@
  1247.   def create_menu_background
  1248.     if $scene.is_a?(Scene_Clock)
  1249.       @menuback_sprite = Sprite.new
  1250.       @menuback_sprite.bitmap = Cache.system(CLOCK_IMAGE)
  1251.     elsif $scene.is_a?(Scene_LifeSpan)
  1252.       @menuback_sprite = Sprite.new
  1253.       @menuback_sprite.bitmap = Cache.system(LIFESPAN_BACK)
  1254.     elsif $scene.is_a?(Scene_Calender)
  1255.       @menuback_sprite = Sprite.new
  1256.       if USE_SEASONS == true
  1257.         unless SEASONS.empty?
  1258.           seasons = SEASONS.keys
  1259.           for i in seasons
  1260.             if $game_switches[SEASONS[i][4]] == true
  1261.               @menuback_sprite.bitmap = Cache.system(SEASONS[i][5])
  1262.             end
  1263.           end
  1264.         end
  1265.       else
  1266.         @menuback_sprite.bitmap = Cache.system(CALENDER_BACK)
  1267.       end
  1268.     else
  1269.       sc_sb_create_menu_background
  1270.     end
  1271.   end
  1272.  
  1273.  
  1274. end
  1275.  
  1276. ################################################################################
  1277. #                      SCENE TITLE
  1278. ################################################################################
  1279. class Scene_Title < Scene_Base
  1280.  
  1281.   alias sc_st_create_game_objects create_game_objects
  1282.   def create_game_objects
  1283.     sc_st_create_game_objects
  1284.     $game_calender = Game_Calender.new
  1285.   end
  1286.  
  1287. end
  1288.  
  1289. ################################################################################
  1290. #                         SCENE MENU
  1291. ################################################################################
  1292. class Scene_Menu < Scene_Base
  1293.   include Steps_Calender
  1294.  
  1295.   #-----------------------------------------------------------------------------
  1296.   #                      Create_Command_Window (Aliased)
  1297.   #-----------------------------------------------------------------------------
  1298.  
  1299.   alias sc_sm_create_command_window create_command_window unless $@
  1300.   def create_command_window
  1301.     if MENU_CALENDER == true
  1302.       s1 = Vocab::item
  1303.       s2 = Vocab::skill
  1304.       s3 = Vocab::equip
  1305.       s4 = Vocab::status
  1306.       s5 = "Calender"
  1307.       s6 = Vocab::save
  1308.       s7 = Vocab::game_end
  1309.       @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
  1310.       @command_window.index = @menu_index
  1311.       if $game_party.members == 0
  1312.         @command_window.draw_item(0, false)
  1313.         @command_window.draw_item(1, false)
  1314.         @command_window.draw_item(2, false)
  1315.         @command_window.draw_item(3, false)
  1316.       end
  1317.       if $game_system.save_disabled
  1318.         @command_window.draw_item(4, false)
  1319.       end
  1320.     else
  1321.       sc_sm_create_command_window
  1322.     end
  1323.   end
  1324.  
  1325.   #-----------------------------------------------------------------------------
  1326.   #                           Update Command Selection (Aliased)
  1327.   #-----------------------------------------------------------------------------
  1328.   alias sc_sm_update_command_selection update_command_selection unless $@
  1329.   def update_command_selection
  1330.     if MENU_CALENDER == true
  1331.       if Input.trigger?(Input::B)
  1332.         Sound.play_cancel
  1333.         $scene = Scene_Map.new
  1334.       elsif Input.trigger?(Input::C)
  1335.         if $game_party.members.size == 0 and @command_window.index < 4
  1336.           Sound.play_buzzer
  1337.           return
  1338.         elsif $game_system.save_disabled and @command_window.index == 5
  1339.           Sound.play_buzzer
  1340.           return
  1341.         end
  1342.         Sound.play_decision
  1343.         case @command_window.index
  1344.         when 0      # Item
  1345.           $scene = Scene_Item.new
  1346.         when 1,2,3  # Skill, equipment, status
  1347.           start_actor_selection
  1348.         when 4 #Calender
  1349.           $scene = Scene_Calender.new(true)
  1350.         when 5      # Save
  1351.           $scene = Scene_File.new(true, false, false)
  1352.         when 6      # End Game
  1353.           $scene = Scene_End.new
  1354.         end
  1355.       end
  1356.     else
  1357.       sc_sm_update_command_selection
  1358.     end
  1359.   end
  1360.  
  1361. end
  1362.  
  1363. ################################################################################
  1364. #                     SCENE FILE
  1365. ################################################################################
  1366. class Scene_File < Scene_Base
  1367.  
  1368.   alias sc_sf_write_save_data write_save_data
  1369.   def write_save_data(file)
  1370.     sc_sf_write_save_data(file)
  1371.     Marshal.dump($game_calender, file)
  1372.   end
  1373.  
  1374.   alias sc_sf_read_save_data read_save_data
  1375.   def read_save_data(file)
  1376.     $game_calender = Marshal.load(file)
  1377.     sc_sf_read_save_data(file)
  1378.   end
  1379.  
  1380. end
  1381.  
  1382.  
  1383. ################################################################################
  1384. #                    WINDOW QUICK INFO
  1385. ################################################################################
  1386. class Window_Quickfo < Window_Base
  1387.  
  1388.   def initialize(string)
  1389.     super(150, 160, 260, 90)
  1390.     @string = string
  1391.     refresh
  1392.   end
  1393.  
  1394.   def refresh
  1395.     self.contents.font.color = system_color
  1396.     self.contents.draw_text(4, 10, self.width, WLH, @string)
  1397.   end
  1398. end
  1399.  
  1400.  
  1401. ################################################################################
  1402. #                    WINDOW BIRTHDAY BANNER
  1403. ################################################################################
  1404. class Window_Birthday_Banner < Window_Base
  1405.  
  1406.   def initialize
  1407.     super(141, 0, 400, 80)
  1408.     refresh
  1409.   end
  1410.  
  1411.   def refresh
  1412.     self.contents.font.color = system_color
  1413.     self.contents.draw_text((544 - 400) / 2, 10, self.width, WLH, "Choose your birthday")
  1414.   end
  1415.  
  1416. end
  1417.  
  1418. ################################################################################
  1419. #                    WINDOW ACTOR INFO
  1420. ################################################################################
  1421. class Window_Actor_Info < Window_Base
  1422.   include Steps_Calender
  1423.  
  1424.   def initialize
  1425.     super(0, 0, 120, 160)
  1426.     @actor = $game_actors[$game_variables[ACTOR_FACE_VARIABLE]]
  1427.     refresh
  1428.   end
  1429.  
  1430.   def refresh
  1431.     draw_actor_face(@actor, 0, 0)
  1432.     self.contents.font.color = text_color(ACTOR_NAME_COLOR)
  1433.     self.contents.draw_text(0, 96, self.width, WLH, @actor.name)
  1434.   end
  1435.  
  1436. end
  1437.  
  1438.  
  1439. ################################################################################
  1440. #                    WINDOW BIRTHDAY CONFIRM
  1441. ################################################################################
  1442. class Window_Confirm < Window_Selectable
  1443.  
  1444.   def initialize
  1445.     super(200, 180, 140, 90)
  1446.     @item_max = 2
  1447.     @column_max = 1
  1448.     @items_number = []
  1449.     @items_number[0] = "Confirm"
  1450.     @items_number[1] = "Cancel"
  1451.     self.index = 0
  1452.     refresh
  1453.   end
  1454.  
  1455.  
  1456.   def refresh
  1457.     create_contents
  1458.     rect = item_rect(index)
  1459.     self.contents.clear_rect(rect)
  1460.     self.contents.font.color = normal_color
  1461.     self.contents.draw_text(0, 0, self.width, WLH, @items_number[0])
  1462.     self.contents.draw_text(0, WLH, self.width, WLH, @items_number[1])
  1463.   end
  1464.  
  1465. end
  1466.  
  1467. ################################################################################
  1468. #                     WINDOW BIRTHDAY STATUS
  1469. ################################################################################
  1470. class Window_BD_Status < Window_Selectable
  1471.   include Steps_Calender
  1472.  
  1473.   attr_accessor :month
  1474.   attr_accessor :day
  1475.  
  1476.   def initialize
  1477.     super(141, 81, 400, 80)
  1478.     @month = 1
  1479.     @day = 1
  1480.     @item_max = 2
  1481.     @column_max = 1
  1482.     @items_number = []
  1483.     @items_number[0] = "Change " + MONTH_STRING + "     "
  1484.     @items_number[1] = "Change   " + DAY_STRING  + "     "
  1485.     self.index = 0
  1486.     refresh
  1487.   end
  1488.  
  1489. #-------------------------------------------------------------------------------
  1490. #                             Refresh
  1491. #-------------------------------------------------------------------------------
  1492.  
  1493.   def refresh
  1494.     create_contents
  1495.     rect = item_rect(index)
  1496.     self.contents.clear_rect(rect)
  1497.     self.contents.font.color = normal_color
  1498.     self.contents.draw_text(0, 0, self.width, WLH, @items_number[0] + MONTHS[@month])
  1499.     self.contents.draw_text(0, WLH, self.width, WLH, @items_number[1] + @day.to_s)
  1500.   end
  1501.   #-----------------------------------------------------------------------------
  1502.   #                  Add Month
  1503.   #-----------------------------------------------------------------------------
  1504.   def add_month(max)
  1505.     if @month == max
  1506.       @month = 1
  1507.     else
  1508.       @month += 1
  1509.     end
  1510.   end
  1511.  
  1512.   #-----------------------------------------------------------------------------
  1513.   #              Subtract Month
  1514.   #-----------------------------------------------------------------------------
  1515.   def subtract_month(max)
  1516.     if @month == 1
  1517.       @month = max
  1518.     else
  1519.       @month -= 1
  1520.     end
  1521.   end
  1522.  
  1523.   #-----------------------------------------------------------------------------
  1524.   #                  Add Day
  1525.   #-----------------------------------------------------------------------------
  1526.   def add_day(max)
  1527.     if @day == max
  1528.       @day = 1
  1529.     else
  1530.       @day += 1
  1531.     end
  1532.   end
  1533.  
  1534.   #-----------------------------------------------------------------------------
  1535.   #                      Subtract Day
  1536.   #-----------------------------------------------------------------------------
  1537.   def subtract_day(max)
  1538.     if @day == 1
  1539.       @day = max
  1540.     else
  1541.       @day -= 1
  1542.     end
  1543.   end
  1544.  
  1545.    
  1546.  
  1547. end
  1548.  
  1549. ################################################################################
  1550. #                       SCENE BIRTHDAY
  1551. ################################################################################
  1552. class Scene_Birthday < Scene_Base
  1553.   include Steps_Calender
  1554.  
  1555.   def start
  1556.     super
  1557.     if $game_variables[ACTOR_FACE_VARIABLE] == 0
  1558.       $game_variables[ACTOR_FACE_VARIABLE] = 1
  1559.     end
  1560.     @actor = $game_actors[$game_variables[ACTOR_FACE_VARIABLE]]
  1561.     @banner_window = Window_Birthday_Banner.new
  1562.     @actor_window = Window_Actor_Info.new
  1563.     @birthday_window = Window_BD_Status.new
  1564.     @birthday_window.active = true
  1565.     @month_max = YEAR_MONTHS
  1566.     @day_max = MONTH_DAYS
  1567.   end
  1568.  
  1569.   #-----------------------------------------------------------------------------
  1570.   #                         Update
  1571.   #-----------------------------------------------------------------------------
  1572.  
  1573.   def update
  1574.     super
  1575.     @actor_window.refresh
  1576.     if @birthday_window.active == true
  1577.       @birthday_window.update
  1578.       if Input.trigger?(Input::RIGHT)
  1579.         if @birthday_window.index == 0
  1580.           Sound.play_cursor
  1581.           @birthday_window.add_month(@month_max)
  1582.           @birthday_window.refresh
  1583.         elsif @birthday_window.index == 1
  1584.           Sound.play_cursor
  1585.           @birthday_window.add_day(@day_max)
  1586.           @birthday_window.refresh
  1587.         end
  1588.       elsif Input.trigger?(Input::LEFT)
  1589.         if @birthday_window.index == 0
  1590.           Sound.play_cursor
  1591.           @birthday_window.subtract_month(@month_max)
  1592.           @birthday_window.refresh
  1593.         elsif @birthday_window.index == 1
  1594.           Sound.play_cursor
  1595.           @birthday_window.subtract_day(@day_max)
  1596.           @birthday_window.refresh
  1597.         end
  1598.       elsif Input.trigger?(Input::B)
  1599.         Sound.play_buzzer
  1600.       elsif Input.trigger?(Input::C)
  1601.         Sound.play_decision
  1602.         $game_temp.birthday_month = @birthday_window.month
  1603.         $game_temp.birthday_day = @birthday_window.day
  1604.         $game_temp.birthday_actor_id = @actor.id
  1605.         @confirm_window = Window_Confirm.new
  1606.         @confirm_window.active = true
  1607.         @birthday_window.active = false
  1608.       end
  1609.     elsif @confirm_window.active == true
  1610.       @confirm_window.update
  1611.       @confirm_window.refresh
  1612.       if Input.trigger?(Input::B)
  1613.         Sound.play_cancel
  1614.         @birthday_window.active = true
  1615.         @confirm_window.active = false
  1616.         @confirm_window.dispose
  1617.       elsif Input.trigger?(Input::C)
  1618.         Sound.play_decision
  1619.         if @confirm_window.index == 0
  1620.           Sound.play_decision
  1621.           $game_actors[@actor.id].set_birthday($game_temp.birthday_month, $game_temp.birthday_day)
  1622.           $scene = Scene_Map.new
  1623.         elsif @confirm_window.index == 1
  1624.           Sound.play_cancel
  1625.           @birthday_window.active = true
  1626.           @confirm_window.active = false
  1627.           @confirm_window.dispose
  1628.         end
  1629.       end
  1630.     end
  1631.   end
  1632.  
  1633.   #-----------------------------------------------------------------------------
  1634.   #                         Terminate
  1635.   #-----------------------------------------------------------------------------
  1636.    
  1637.   def terminate
  1638.     @banner_window.dispose
  1639.     @actor_window.dispose
  1640.     @birthday_window.dispose
  1641.     @confirm_window.dispose
  1642.   end
  1643.  
  1644. end
  1645.  
  1646. ################################################################################
  1647. #                           WINDOW_LIFESPAN
  1648. ################################################################################
  1649. class Window_LifeSpan < Window_Base
  1650.   include Steps_Calender
  1651.  
  1652.   def initialize(actor_id)
  1653.     super(0, 0, 544, 416)
  1654.     @actor = $game_actors[actor_id]
  1655.     @lsy = @actor.lifespan_years
  1656.     @lsm = @actor.lifespan_months
  1657.     @lsd = @actor.lifespan_days
  1658.     self.opacity = LS_OPACITY
  1659.     self.windowskin = Cache.system(LS_WINDOWSKIN)
  1660.     refresh
  1661.   end
  1662.  
  1663.   def refresh
  1664.     draw_actor_face(@actor, 12, 12)
  1665.     self.contents.font.color = text_color(ACTOR_NAME_COLOR)
  1666.     draw_actor_name(@actor, 12, 108)
  1667.     self.contents.font.color = text_color(LS_BANNERTEXT_COLOR)
  1668.     self.contents.font.size = LS_BANNERTEXT_SIZE
  1669.     self.contents.draw_text(218, 112, self.width, LS_BANNERTEXT_SIZE, LS_HEADING)
  1670.     self.contents.font.color = text_color(LS_SYSTEMTEXT_COLOR)
  1671.     self.contents.font.size = WLH
  1672.     self.contents.draw_text(218, (112 + LS_BANNERTEXT_SIZE) + 6, self.width, WLH, LS_YEARS_STRING)
  1673.     self.contents.draw_text(218, WLH + 112 + LS_BANNERTEXT_SIZE + 6, self.width, WLH, LS_MONTHS_STRING)
  1674.     self.contents.draw_text(218, ((WLH * 2) + 112) + LS_BANNERTEXT_SIZE + 6, self.width, WLH, LS_DAYS_STRING)
  1675.     self.contents.font.color = normal_color
  1676.     self.contents.draw_text(218 + (LS_YEARS_STRING.length * 12), 112 + LS_BANNERTEXT_SIZE + 6, self.width, WLH, @lsy.to_s)
  1677.     self.contents.draw_text(218 + (LS_MONTHS_STRING.length * 12), WLH + 112 + LS_BANNERTEXT_SIZE + 6, self.width, WLH, @lsm.to_s)
  1678.     self.contents.draw_text(218 + (LS_DAYS_STRING.length * 12), (WLH * 2) + 112 + LS_BANNERTEXT_SIZE + 6, self.width, WLH, @lsd.to_s)
  1679.   end
  1680.  
  1681. end
  1682.  
  1683. ################################################################################
  1684. #                       SCENE_LIFESPAN
  1685. ################################################################################
  1686. class Scene_LifeSpan < Scene_Base
  1687.   include Steps_Calender
  1688.  
  1689.   def initialize(actor_id)
  1690.     @id = actor_id
  1691.   end
  1692.  
  1693.   def start
  1694.     super
  1695.     create_menu_background
  1696.     @ls_window = Window_LifeSpan.new(@id)
  1697.   end
  1698.  
  1699.   def update
  1700.     super
  1701.     if Input.trigger?(Input::C)
  1702.       Sound.play_cancel
  1703.       $scene = Scene_Map.new
  1704.     elsif Input.trigger?(Input::B)
  1705.       Sound.play_cancel
  1706.       $scene = Scene_Map.new
  1707.     end
  1708.   end
  1709.  
  1710.   def terminate
  1711.     dispose_menu_background
  1712.     @ls_window.dispose
  1713.   end
  1714.  
  1715. end
  1716.  
  1717. ################################################################################
  1718. #                      WINDOW_CLOCK
  1719. ################################################################################
  1720. class Window_Clock < Window_Base
  1721.   include Steps_Calender
  1722.  
  1723.   def initialize
  1724.     super(0, 0, 544, 416)
  1725.     self.windowskin = Cache.system(CLOCK_WINDOWSKIN)
  1726.     self.opacity = CLOCK_OPACITY
  1727.     refresh
  1728.   end
  1729.  
  1730.   def refresh
  1731.     self.contents.font.size = CLOCK_SIZE
  1732.     self.contents.font.color = text_color(CLOCK_COLOR)
  1733.     pointx = (544 / 3) + 20
  1734.     pointy = 112
  1735.     self.contents.draw_text(pointx, pointy, self.width, CLOCK_SIZE, CLOCK_HEADING)
  1736.     self.contents.font.size = WLH
  1737.     self.contents.font.color = system_color
  1738.     self.contents.draw_text(pointx, pointy + CLOCK_SIZE, self.width, WLH, HOUR_STRING + "     ")
  1739.     self.contents.font.color = normal_color
  1740.     if $game_calender.hoursteps < 10
  1741.       self.contents.draw_text(pointx + (HOUR_STRING.length * 12), pointy + CLOCK_SIZE, self.width, WLH, $game_calender.hour.to_s + ":0" + $game_calender.hoursteps.to_s)
  1742.     else
  1743.       self.contents.draw_text(pointx + (HOUR_STRING.length * 12), pointy + CLOCK_SIZE, self.width, WLH, $game_calender.hour.to_s + ":" + $game_calender.hoursteps.to_s)
  1744.     end
  1745.   end
  1746.  
  1747. end
  1748.  
  1749. ################################################################################
  1750. #                         SCENE_CLOCK
  1751. ################################################################################
  1752. class Scene_Clock < Scene_Base
  1753.   include Steps_Calender
  1754.  
  1755.   def start
  1756.     super
  1757.     create_menu_background
  1758.     @clock_window = Window_Clock.new
  1759.   end
  1760.  
  1761.   def update
  1762.     super
  1763.     if Input.trigger?(Input::C)
  1764.       Sound.play_cancel
  1765.       $scene = Scene_Map.new
  1766.     elsif Input.trigger?(Input::B)
  1767.       Sound.play_cancel
  1768.       $scene = Scene_Map.new
  1769.     end
  1770.   end
  1771.  
  1772.   def terminate
  1773.     dispose_menu_background
  1774.     @clock_window.dispose
  1775.   end
  1776.  
  1777. end
  1778.  
  1779. ################################################################################
  1780. #                        WINDOW_CALENDER
  1781. ################################################################################
  1782. class Window_Calender < Window_Base
  1783.   include Steps_Calender
  1784.  
  1785.   def initialize
  1786.     super(0, 0, 544, 416)
  1787.     self.windowskin = Cache.system(CALENDER_WINDOWSKIN)
  1788.     self.opacity = CALENDER_OPACITY
  1789.     refresh
  1790.   end
  1791.  
  1792.   def refresh
  1793.     pointx = 544 / 4
  1794.     pointy = 416 / 4
  1795.     chs = CALENDER_HEADING_SIZE
  1796.     cts = CALENDER_TEXT_SIZE
  1797.     self.contents.clear
  1798.     self.contents.font.size = chs
  1799.     self.contents.font.color = text_color(CALENDER_HEADING_COLOR)
  1800.     self.contents.draw_text(pointx, pointy, self.width, chs, CALENDER_HEADING)
  1801.     self.contents.font.size = cts
  1802.     self.contents.font.color = text_color(CALENDER_STRING_COLOR)
  1803.     self.contents.draw_text(pointx, pointy + chs, self.width, cts, YEAR_STRING)
  1804.     self.contents.draw_text(pointx, pointy + chs + cts, self.width, cts, MONTH_STRING)
  1805.     self.contents.draw_text(pointx, pointy + chs + (cts * 2), self.width, cts, DAY_STRING)
  1806.     self.contents.draw_text(pointx, pointy + chs + (cts * 3), self.width, cts, HOUR_STRING)
  1807.     self.contents.font.color = text_color(CALENDER_VALUES_COLOR)
  1808.     yst = YEAR_STRING.length * 12
  1809.     mst = MONTH_STRING.length * 12
  1810.     dst = DAY_STRING.length * 12
  1811.     hst = HOUR_STRING.length * 12
  1812.     self.contents.draw_text(pointx + yst + mst, pointy + chs, self.width, cts, $game_calender.year.to_s)
  1813.     self.contents.draw_text(pointx + yst + mst, pointy + chs + cts, self.width, cts, MONTHS[$game_calender.month])
  1814.     self.contents.draw_text(pointx + yst + mst, pointy + chs + (cts * 2), self.width, cts, $game_calender.day.to_s)
  1815.     if $game_calender.hoursteps < 10
  1816.       self.contents.draw_text(pointx + yst + mst, pointy + chs + (cts * 3), self.width, cts, $game_calender.hour.to_s + ":0" + $game_calender.hoursteps.to_s)
  1817.     else
  1818.       self.contents.draw_text(pointx + yst + mst, pointy + chs + (cts * 3), self.width, cts, $game_calender.hour.to_s + ":" + $game_calender.hoursteps.to_s)
  1819.     end
  1820.   end
  1821.  
  1822. end
  1823.  
  1824. ################################################################################
  1825. #                       Window_Optional
  1826. ################################################################################
  1827. class Window_Optional < Window_Base
  1828.   include Steps_Calender
  1829.  
  1830.   def initialize(placement, identity)
  1831.     @identity = identity
  1832.     case placement
  1833.     when 0
  1834.       super(0, 0, 140, 120)
  1835.     when 1
  1836.       super(400, 0, 140, 120)
  1837.     when 2
  1838.       super(0, 296, 140, 120)
  1839.     when 3
  1840.       super(400, 296, 140, 120)
  1841.     end
  1842.     self.opacity = CALENDER_OPACITY
  1843.     refresh
  1844.   end
  1845.  
  1846.   def refresh
  1847.     self.contents.font.size = 24
  1848.     self.contents.font.color = text_color(OPTIONAL_COLOR)
  1849.     case @identity
  1850.     when 1
  1851.       self.contents.draw_text(0, 0, self.width, 24, BIRTHDAY_STRING)
  1852.       self.contents.font.color = normal_color
  1853.       strings = []
  1854.       bswitches = BIRTHDAY_SWITCHES.keys
  1855.       for i in bswitches
  1856.         if $game_switches[i] == true
  1857.           strings.push($game_actors[i].name)
  1858.         end
  1859.       end
  1860.       unless strings.empty?
  1861.         for string in strings
  1862.           x = 0
  1863.           y = 24
  1864.           self.contents.draw_text(x, y, self.width, WLH, string)
  1865.           y += WLH
  1866.         end
  1867.       end
  1868.     when 2
  1869.       self.contents.draw_text(0, 0, self.width, 24, HOLIDAY_STRING)
  1870.       self.contents.font.color = normal_color
  1871.       if $game_calender.holiday != nil
  1872.         x = 0
  1873.         y = 24
  1874.         self.contents.draw_text(x, y, self.width, WLH, $game_calender.holiday.to_s)
  1875.       end
  1876.     when 3
  1877.       self.contents.draw_text(0, 0, self.width, 24, SEASON_STRING)
  1878.       self.contents.font.color = normal_color
  1879.       if $game_calender.season != nil
  1880.         x = 0
  1881.         y = 24
  1882.         self.contents.draw_text(x, y, self.width, WLH, $game_calender.season.to_s)
  1883.       end
  1884.     when 4
  1885.       self.contents.draw_text(0, 0, self.width, 24, SEGMENT_STRING)
  1886.       self.contents.font.color = normal_color
  1887.       if $game_calender.segment != nil
  1888.         x = 0
  1889.         y = 24
  1890.         self.contents.draw_text(x, y, self.width, WLH, $game_calender.segment.to_s)
  1891.       end
  1892.     end
  1893.    
  1894.   end
  1895.  
  1896. end
  1897.  
  1898. ################################################################################
  1899. #                     SCENE CALENDER
  1900. ################################################################################
  1901. class Scene_Calender < Scene_Base
  1902.   include Steps_Calender
  1903.  
  1904.   def initialize(from_menu = false)
  1905.     @from_menu = from_menu
  1906.   end
  1907.  
  1908.  
  1909.   def start
  1910.     super
  1911.     create_menu_background
  1912.     @calender_window = Window_Calender.new
  1913.     determine_optional_alignment
  1914.   end
  1915.  
  1916.  
  1917.   #-----------------------------------------------------------------------------
  1918.   #                        Determnine Optional Alignment
  1919.   #-----------------------------------------------------------------------------
  1920.   def determine_optional_alignment
  1921.     unless OPTIONAL_ALIGNMENT.empty?
  1922.       if USE_BIRTHDAYS == true
  1923.         if OPTIONAL_ALIGNMENT.include?(1)
  1924.           @placement = OPTIONAL_ALIGNMENT.index(1)
  1925.           @bd_window = Window_Optional.new(@placement, 1)
  1926.         end
  1927.       end
  1928.       if USE_HOLIDAYS == true
  1929.         if OPTIONAL_ALIGNMENT.include?(2)
  1930.           @placement = OPTIONAL_ALIGNMENT.index(2)
  1931.           @hd_window = Window_Optional.new(@placement, 2)
  1932.         end
  1933.       end
  1934.       if USE_SEASONS == true
  1935.         if OPTIONAL_ALIGNMENT.include?(3)
  1936.           @placement = OPTIONAL_ALIGNMENT.index(3)
  1937.           @ss_window = Window_Optional.new(@placement, 3)
  1938.         end
  1939.       end
  1940.       if USE_DAY_SEGMENTS == true
  1941.         if OPTIONAL_ALIGNMENT.include?(4)
  1942.           @placement = OPTIONAL_ALIGNMENT.index(4)
  1943.           @seg_window = Window_Optional.new(@placement, 4)
  1944.         end
  1945.       end
  1946.     end
  1947.   end
  1948.  
  1949.   #-----------------------------------------------------------------------------
  1950.   #                          Update
  1951.   #-----------------------------------------------------------------------------
  1952.   def update
  1953.     super
  1954.     if Input.trigger?(Input::C)
  1955.       Sound.play_cancel
  1956.       if @from_menu == true
  1957.         $scene = Scene_Menu.new(4)
  1958.       else
  1959.         $scene = Scene_Map.new
  1960.       end
  1961.     elsif Input.trigger?(Input::B)
  1962.       Sound.play_cancel
  1963.       if @from_menu == true
  1964.         $scene = Scene_Menu.new(4)
  1965.       else
  1966.         $scene = Scene_Map.new
  1967.       end
  1968.     end
  1969.   end
  1970.  
  1971.   #-----------------------------------------------------------------------------
  1972.   #                           Terminate
  1973.   #-----------------------------------------------------------------------------
  1974.   def terminate
  1975.     dispose_menu_background
  1976.     @calender_window.dispose
  1977.     unless OPTIONAL_ALIGNMENT.empty?
  1978.       if USE_BIRTHDAYS == true
  1979.         if OPTIONAL_ALIGNMENT.include?(1)
  1980.           @bd_window.dispose
  1981.         end
  1982.       end
  1983.       if USE_HOLIDAYS == true
  1984.         if OPTIONAL_ALIGNMENT.include?(2)
  1985.           @hd_window.dispose
  1986.         end
  1987.       end
  1988.       if USE_SEASONS == true
  1989.         if OPTIONAL_ALIGNMENT.include?(3)
  1990.           @ss_window.dispose
  1991.         end
  1992.       end
  1993.       if USE_DAY_SEGMENTS == true
  1994.         if OPTIONAL_ALIGNMENT.include?(4)
  1995.           @seg_window.dispose
  1996.         end
  1997.       end
  1998.     end
  1999.   end
  2000.  
  2001. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement