Advertisement
ICF-Soft

ICF-Soft Time Utility 1.04 RPG Maker MV

May 8th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // ICF-Soft Plugins - Time Utility
  3. // ICFSoft_TimeUtil.js
  4. //=============================================================================
  5.  
  6. var Imported = Imported || {};
  7. Imported.ICFSoft_TimeUtil = true;
  8.  
  9. var ICF = ICF || {};
  10. ICF.TimeUtil = ICF.TimeUtil || {};
  11.  
  12. ICF.TimeUtil.Version = 104; // 1.04
  13.  
  14. //=============================================================================
  15.  /*:
  16.  * @plugindesc v1.04 This plugin stores date and time in game variables
  17.  * for diverse pourposes.
  18.  * @author ICF-Soft [http://icfsoft.blogspot.com.es/]
  19.  *
  20.  * @param Year Var
  21.  * @desc A variable where store year.
  22.  * @default 0
  23.  *
  24.  * @param Month Var
  25.  * @desc A variable where store month from 1 to 12.
  26.  * @default 0
  27.  *
  28.  * @param Day Var
  29.  * @desc A variable where store day from 1 to 31.
  30.  * @default 0
  31.  *
  32.  * @param Hour Var
  33.  * @desc A variable where store hour.
  34.  * @default 0
  35.  *
  36.  * @param Minute Var
  37.  * @desc A variable where store minute.
  38.  * @default 0
  39.  *
  40.  * @param Week Var
  41.  * @desc A variable where store the day of the week.
  42.  * Week starts with Sunday as 0.
  43.  * @default 0
  44.  *
  45.  * @param Month and day
  46.  * @desc A variable where store a month and day combination.
  47.  * @default 0
  48.  *
  49.  * @param Hour and minutes
  50.  * @desc A variable where store a hour and minutes combination.
  51.  * @default 0
  52.  *
  53.  * @param Time travel
  54.  * @desc A variable where store a time offset.
  55.  * @default 0
  56.  *
  57.  * @param Fixed Month and day
  58.  * @desc All days you want to check separated with spaces.
  59.  * Must be month and day combination (see help).
  60.  * @default 101 102
  61.  *
  62.  * @param Fixed Integer checks
  63.  * @desc Respective integers to store if there is dates are.
  64.  * @default 0 0
  65.  *
  66.  * @param Variable Month and day
  67.  * @desc All variables where days you want to check are stored separated
  68.  * with spaces. Must be stored as month and day combination (see help).
  69.  * @default
  70.  *
  71.  * @param Variable Integer checks
  72.  * @desc Respective integers to store if there is dates are.
  73.  * @default 0
  74.  *
  75.  * @help
  76.  * ============================================================================
  77.  * Introduction
  78.  * ============================================================================
  79.  *
  80.  * There are games where special things happen on specific day of the week,
  81.  * specific hour, specific day, and so on.
  82.  * There are games where time continues even when off.
  83.  *
  84.  * With this plugin you can do both.
  85.  *
  86.  * Time is stored in game variables and can be used inside events. Also uses
  87.  * switches to check specified days. Automatically updates on map changes, but
  88.  * can also be updated manually.
  89.  * A gameplay time has been added for those who want an alternative to
  90.  * real time.
  91.  *
  92.  * Also you can store time and check how many real time has passed.
  93.  * Time is stored as minutes.
  94.  *
  95.  * ============================================================================
  96.  * Parameters
  97.  * ============================================================================
  98.  *
  99.  * There are six basic params to store current year, day, hour, etc.
  100.  * These params indicate what variables will be used to store that info.
  101.  * To skip a param put 0.
  102.  *
  103.  * Month and day comes in a special format because events can use only one
  104.  * variable per page. So it needs a combined one. Is Month*100 + Day.
  105.  * Some Month-Day Examples:
  106.  *   -  101: January 1st
  107.  *   -  102: January 2nd
  108.  *   -  201: February 1st
  109.  *   -  211: February 11th
  110.  *   - 1001: October 1st
  111.  *   - 1010: October 10th
  112.  *
  113.  * Hours and minutes works as month and day does. Is Hour*100 + minute.
  114.  *
  115.  * Fixed Month and day: To check specified days sepparated by spaces.
  116.  * It's combined with next parameter.
  117.  *
  118.  * Fixed Integer checks: Switchs sepparated by spaces. There is a switch
  119.  * for every fixed date. When day is met it's switch becomes on, when not
  120.  * it's switch becomes off.
  121.  *
  122.  * Variable Month and day: To check inside specified variable a day.
  123.  * It can be used to store a day ingame and check when is met. Example: B-Day
  124.  * Variables are sepparated by spaces.
  125.  *
  126.  * Variable Integer checks: Switchs sepparated by spaces. There is a switch
  127.  * for every variable. When stored day is met it's switch becomes on, when
  128.  * not it's switch becomes off.
  129.  *
  130.  * ============================================================================
  131.  * Plugin commands
  132.  * ============================================================================
  133.  *
  134.  * GetTime x
  135.  *
  136.  *  - To store a time into variable number 'x'.
  137.  *
  138.  * GetTimeSince x y
  139.  * GetHoursSince x y
  140.  * GetDaysSince x y
  141.  *
  142.  *  - To compare how much time passed since 'x' in minutes, hours or days
  143.  *    and store result in variable 'y'.
  144.  *
  145.  * GetPlayTime x
  146.  *
  147.  *  - To store gameplay time into variable number 'x'.
  148.  *
  149.  * GetPlayTimeSince x y
  150.  * GetPlayHoursSince x y
  151.  * GetPlayDaysSince x y
  152.  *
  153.  *  - To compare how much gameplay time passed since 'x' in minutes, hours
  154.  *    or days and store result in variable 'y'.
  155.  *
  156.  * UpdateTime
  157.  *
  158.  *  - To update time variables manually.
  159.  *
  160.  * GoPresent [true]
  161.  *
  162.  *  - To reset time. Returning to present.
  163.  *  - Optional: placing 'true' will update map automatically.
  164.  *    
  165.  * AdvanceTime x [true]
  166.  * AdvanceDays x [true]
  167.  * AdvanceYears x [true]
  168.  *
  169.  *  - To advance x minutes, days or years in time (can be negative).
  170.  *  - Optional: placing 'true' will update map automatically.
  171.  *
  172.  * ============================================================================
  173.  * Scripting functions
  174.  * ============================================================================
  175.  *
  176.  * For those who prefer scripting over plugin commands there are the
  177.  * alternate versions.
  178.  *
  179.  * ICF.TimeUtil.GetTime(x)
  180.  * ICF.TimeUtil.GetTimeSince(x, y)
  181.  * ICF.TimeUtil.GetHoursSince(x, y)
  182.  * ICF.TimeUtil.GetDaysSince(x, y)
  183.  * ICF.TimeUtil.GetPlayTime(x)
  184.  * ICF.TimeUtil.GetPlayTimeSince(x, y)
  185.  * ICF.TimeUtil.GetPlayHoursSince(x, y)
  186.  * ICF.TimeUtil.GetPlayDaysSince(x, y)
  187.  * ICF.TimeUtil.GetDate()
  188.  * ICF.TimeUtil.GoPresent(x)
  189.  * ICF.TimeUtil.AdvanceTime(x, true)
  190.  * ICF.TimeUtil.AdvanceDays(x, true)
  191.  * ICF.TimeUtil.AdvanceYears(x, true)
  192.  *
  193.  * ============================================================================
  194.  * Incompatibilities
  195.  * ============================================================================
  196.  *
  197.  * There's no known incompatible plugins yet.
  198.  *
  199.  * ============================================================================
  200.  * Known isues
  201.  * ============================================================================
  202.  *
  203.  * There's no known isues yet.
  204.  *
  205.  * ============================================================================
  206.  * Changelog
  207.  * ============================================================================
  208.  *
  209.  * Version 1.04:
  210.  * - Added functions for gameplay time.
  211.  *
  212.  * Version 1.03:
  213.  * - Use of ICF-Soft Main Utility.
  214.  * - Added hour and minutes combination.
  215.  *
  216.  * Version 1.02:
  217.  * - Added day check with switchs.
  218.  *
  219.  * Version 1.01:
  220.  * - Added time travel utility.
  221.  *
  222.  * Version 1.00:
  223.  * - Finished plugin!
  224.  *
  225.  * ============================================================================
  226.  *
  227.  * For commercial and non-commercial games.
  228.  * Credit to ICF-Soft.
  229.  * This entire header must be included with plugin.
  230.  *
  231.  * ============================================================================
  232. */
  233. //=============================================================================
  234.  /*:es
  235.  * @plugindesc v1.04 Este complemento almacena la fecha y hora en las variables
  236.  * del juego para diversos propósitos.
  237.  * @author ICF-Soft [http://icfsoft.blogspot.com.es/]
  238.  *
  239.  * @param Year Var
  240.  * @desc La variable donde almacenas el año.
  241.  * @default 0
  242.  *
  243.  * @param Month Var
  244.  * @desc La variable donde almacenas el mes (de 1 a 12).
  245.  * @default 0
  246.  *
  247.  * @param Day Var
  248.  * @desc La variable donde almacenas el día (de 1 a 31).
  249.  * @default 0
  250.  *
  251.  * @param Hour Var
  252.  * @desc La variable donde almacenas la hora.
  253.  * @default 0
  254.  *
  255.  * @param Minute Var
  256.  * @desc La variable donde almacenas los minutos.
  257.  * @default 0
  258.  *
  259.  * @param Week Var
  260.  * @desc La variable donde almacenas el día de la semana.
  261.  * La semana empieza con el domingo como 0.
  262.  * @default 0
  263.  *
  264.  * @param Month and day
  265.  * @desc Una variable especial donde se almacena una combinación de mes y día.
  266.  * @default 0
  267.  *
  268.  * @param Hour and minutes
  269.  * @desc Una variable especial donde se almacena una combinación de horas
  270.  * y minutos.
  271.  * @default 0
  272.  *
  273.  * @param Time travel
  274.  * @desc Una variable en donde almacenar el salto en el tiempo.
  275.  * @default 0
  276.  *
  277.  * @param Fixed Month and day
  278.  * @desc Los días que quieres comprobar separados por espacios.
  279.  * Debe ser combinación mes-día (ver ayuda).
  280.  * @default 101 102
  281.  *
  282.  * @param Fixed Integer checks
  283.  * @desc Interruptores respectivos para ver si se cumple la fecha.
  284.  * @default 0 0
  285.  *
  286.  * @param Variable Month and day
  287.  * @desc Las variables en donde se almacenan los días que quieres comprobar
  288.  * separados por espacios. Se almacenan en combinación mes-día (ver ayuda).
  289.  * @default
  290.  *
  291.  * @param Variable Integer checks
  292.  * @desc Interruptores respectivos para ver si se cumple la fecha.
  293.  * @default 0
  294.  *
  295.  * @help
  296.  * ============================================================================
  297.  * Introducción
  298.  * ============================================================================
  299.  *
  300.  * Hay juegos en donde ciertos eventos solo pasan en un día, día de la semana,
  301.  * hora o incluso minuto específico.
  302.  * También los hay en los que el tiempo pasa aunque no estés jugando.
  303.  *
  304.  * Con este complemento puedes hacer ambas cosas.
  305.  *
  306.  * El tiempo se almacena en variables a las que se puede acceder en los eventos.
  307.  * También se puede usar interruptores para comprobar fechas.
  308.  * Se actualiza en cada cambio de mapa, pero también con comando.
  309.  * Se ha añadido la posibilidad de usar tiempo de juego como alternativa al
  310.  * tiempo real.
  311.  *
  312.  * Además puedes guardar una fecha y comparar cuanto tiempo real ha pasado.
  313.  * El tiempo se almacena en minutos.
  314.  *
  315.  * ============================================================================
  316.  * Parámetros
  317.  * ============================================================================
  318.  *
  319.  * Hay seis parámetros básicos donde almacenar el año, mes, día, hora, etc.
  320.  * Indican qué variables se van a utilizar para almacenar esa info.
  321.  * Para saltar un parámetro dejar en 0.
  322.  *
  323.  * Month and day comes usa un formato especial porque los eventos solo pueden
  324.  * usar una variable por página. Así que necesita una combinada.
  325.  * Viene en Mes*100 + Día.
  326.  * Algunos ejemplos:
  327.  *   -  101: 1  de Enero
  328.  *   -  102: 2  de Enero
  329.  *   -  201: 1  de Febrero
  330.  *   -  211: 11 de Febrero
  331.  *   - 1001: 1  de Octubre
  332.  *   - 1010: 10 de Octubre
  333.  *
  334.  * Hours and minutes funciona como el anterior. Is Hora*100 + minutos.
  335.  *
  336.  * Fixed Month and day: Para comprobar días separados por espacios.
  337.  * Está en combinación con el siguiente parámetro.
  338.  *
  339.  * Fixed Integer checks: Interruptores separados por espacios. Un interruptor
  340.  * para cada fecha. En ese día su interruptor está activado, cuando no,
  341.  * está desactivado.
  342.  *
  343.  * Variable Month and day: Para comprobar la fecha almacenada en variables.
  344.  * Se utiliza para guardar un día y comprobar si es ese día. Se puede usar
  345.  * por ejemplo para guardar una fecha de cumpleaños. Las variables se
  346.  * separan por espacios.
  347.  *
  348.  * Variable Integer checks: Interruptores separados por espacios. Un
  349.  * interruptor para cada variable. Si el día almacenado se cumple su
  350.  * interruptor estará activado, cuando no, estará desactivado.
  351.  *
  352.  * ============================================================================
  353.  * Comandos de complemento
  354.  * ============================================================================
  355.  *
  356.  * GetTime x
  357.  *
  358.  *  - Para almacenar el tiempo en la variable número 'x'.
  359.  *
  360.  * GetTimeSince x y
  361.  * GetHoursSince x y
  362.  * GetDaysSince x y
  363.  *
  364.  *  - Para comparar cuanto tiempo ha pasado desde 'x' en minutos, horas o
  365.  *    días y almacenar el resultado en la variable 'y'.
  366.  *
  367.  * GetPlayTime x
  368.  *
  369.  *  - Para almacenar el tiempo de juego en la variable número 'x'.
  370.  *
  371.  * GetPlayTimeSince x y
  372.  * GetPlayHoursSince x y
  373.  * GetPlayDaysSince x y
  374.  *
  375.  *  - Para comparar cuanto tiempo de juego ha pasado desde 'x' en minutos,
  376.  *    horas o días y almacenar el resultado en la variable 'y'.
  377.  *
  378.  * UpdateTime
  379.  *
  380.  *  - Para actualizar manualmente las variables.
  381.  *
  382.  * GoPresent [true]
  383.  *
  384.  *  - Para reiniciar el tiempo. Volver al presente.
  385.  *    Opcional: poniendo 'true' las variables se actualizarán.
  386.  *    
  387.  * AdvanceTime x [true]
  388.  * AdvanceDays x [true]
  389.  * AdvanceYears x [true]
  390.  *
  391.  *  - Para avanzar x minutos, días o años en el tiempo (puede ser negativo).
  392.  *    Opcional: poniendo 'true' las variables se actualizarán.
  393.  *
  394.  * ============================================================================
  395.  * Funciones de script
  396.  * ============================================================================
  397.  *
  398.  * Para aquellos que usar javascript en lugar de usar los comandos de
  399.  * complementos éstas son las versiones alternativas.
  400.  *
  401.  * ICF.TimeUtil.GetTime(x)
  402.  * ICF.TimeUtil.GetTimeSince(x, y)
  403.  * ICF.TimeUtil.GetHoursSince(x, y)
  404.  * ICF.TimeUtil.GetDaysSince(x, y)
  405.  * ICF.TimeUtil.GetPlayTime(x)
  406.  * ICF.TimeUtil.GetPlayTimeSince(x, y)
  407.  * ICF.TimeUtil.GetPlayHoursSince(x, y)
  408.  * ICF.TimeUtil.GetPlayDaysSince(x, y)
  409.  * ICF.TimeUtil.GetDate()
  410.  * ICF.TimeUtil.GoPresent(x)
  411.  * ICF.TimeUtil.AdvanceTime(x, true)
  412.  * ICF.TimeUtil.AdvanceDays(x, true)
  413.  * ICF.TimeUtil.AdvanceYears(x, true)
  414.  *
  415.  * ============================================================================
  416.  * Incompatibilidades
  417.  * ============================================================================
  418.  *
  419.  * No se conocen complementos que sean incompatibles hasta la fecha.
  420.  *
  421.  * ============================================================================
  422.  * Problemas conocidos
  423.  * ============================================================================
  424.  *
  425.  * No hay problemas hasta la fecha.
  426.  *
  427.  * ============================================================================
  428.  * Historial de versiones
  429.  * ============================================================================
  430.  *
  431.  * Versión 1.04:
  432.  * - Se han añadido funciones para comprobar el tiempo de juego.
  433.  *
  434.  * Versión 1.03:
  435.  * - Se epieza a utilizar el ICF-Soft Main Utility.
  436.  * - Se ha añadido una combinación de hora y minutos.
  437.  *
  438.  * Versión 1.02:
  439.  * - Se ha añadido una función de fechas con interruptores.
  440.  *
  441.  * Versión 1.01:
  442.  * - Se ha añadido la utilidad de viaje en el tiempo.
  443.  *
  444.  * Versión 1.00:
  445.  * - Complemento terminado.
  446.  *
  447.  * ============================================================================
  448.  *
  449.  * Para juegos comerciales y no comerciales.
  450.  * Se debe incluir a ICF-Soft en los créditos.
  451.  * Esta cabecera debe incluirse íntegramente con el plugin.
  452.  *
  453.  * ============================================================================
  454. */
  455. //=============================================================================
  456.  
  457. //=============================================================================
  458. // Parameter Variables
  459. //=============================================================================
  460.  
  461. ICF.Parameters = PluginManager.parameters('ICFSoft_TimeUtil');
  462. ICF.Param = ICF.Param || {};
  463.  
  464. ICF.Param.TimeVars = [];
  465. ICF.Param.TimeVars[0] = Number(ICF.Parameters['Year Var']);
  466. ICF.Param.TimeVars[1] = Number(ICF.Parameters['Month Var']);
  467. ICF.Param.TimeVars[2] = Number(ICF.Parameters['Day Var']);
  468. ICF.Param.TimeVars[3] = Number(ICF.Parameters['Hour Var']);
  469. ICF.Param.TimeVars[4] = Number(ICF.Parameters['Minute Var']);
  470. ICF.Param.TimeVars[5] = Number(ICF.Parameters['Week Var']);
  471. ICF.Param.TimeVars[6] = Number(ICF.Parameters['Month and day']);
  472. ICF.Param.TimeVars[7] = Number(ICF.Parameters['Hour and minutes']);
  473.  
  474. ICF.Param.TimeTravel = Number(ICF.Parameters['Time travel']);
  475.  
  476. ICF.Param.TimeFixedData = ICF.Parameters['Fixed Month and day'].split(/\s+/).leaveNumbers();
  477. ICF.Param.TimeFixedInt = ICF.Parameters['Fixed Integer checks'].split(/\s+/).leaveNumbers().reduceToFit(ICF.Param.TimeFixedData);
  478. ICF.Param.TimeVarsData = ICF.Parameters['Variable Month and day'].split(/\s+/).leaveNumbers();
  479. ICF.Param.TimeVarsInt = ICF.Parameters['Variable Integer checks'].split(/\s+/).leaveNumbers().reduceToFit(ICF.Param.TimeVarsData);
  480.  
  481. if (!Imported.ICFSoft_MainUtility) {throw new Error('This plugin requires ICF-Soft Main Utility plugin to work.\nYou can download it at icfsoft.blogspot.com inside plugins section.');}
  482.  
  483. //=============================================================================
  484. // Time Utilities
  485. //=============================================================================
  486.  
  487. ICF.TimeUtil.GetTime = function(varid) {
  488.     var Today = new Date();
  489.     Today.increaseMinutes($gameVariables.value(ICF.Param.TimeTravel));
  490.     $gameVariables.setValue(varid, parseInt(Today.getTime()/60000));
  491. }
  492.  
  493. ICF.TimeUtil.GetTimeSince = function(varid, resid) {
  494.     var Today = new Date();
  495.     Today.increaseMinutes($gameVariables.value(ICF.Param.TimeTravel));
  496.     if (resid == undefined) {return (parseInt(Today.getTime()/60000) - $gameVariables.value(varid));}
  497.     $gameVariables.setValue(resid, parseInt(Today.getTime()/60000) - $gameVariables.value(varid));
  498. }
  499.  
  500. ICF.TimeUtil.GetHoursSince = function(varid, resid) {
  501.     if (resid == undefined) {return parseInt(ICF.TimeUtil.GetTimeSince(varid)/60)};
  502.     var Today = new Date();
  503.     Today.increaseMinutes($gameVariables.value(ICF.Param.TimeTravel));
  504.     $gameVariables.setValue(resid, parseInt(((Today.getTime()/60000) - $gameVariables.value(varid))/60));
  505. }
  506.  
  507. ICF.TimeUtil.GetDaysSince = function(varid, resid) {
  508.     if (resid == undefined) {return parseInt(ICF.TimeUtil.GetTimeSince(varid)/1440)};
  509.     var Today = new Date();
  510.     Today.increaseMinutes($gameVariables.value(ICF.Param.TimeTravel));
  511.     $gameVariables.setValue(resid, parseInt(((Today.getTime()/60000) - $gameVariables.value(varid))/1440));
  512. }
  513.  
  514. ICF.TimeUtil.GetPlayTime = function(varid) {
  515.     var Today = $gameSystem.playtime();
  516.     $gameVariables.setValue(varid, parseInt(Today));
  517. }
  518.  
  519. ICF.TimeUtil.GetPlayTimeSince = function(varid, resid) {
  520.     var Today = $gameSystem.playtime();
  521.     if (resid == undefined) {return parseInt(Today - $gameVariables.value(varid));}
  522.     $gameVariables.setValue(resid, parseInt(Today - $gameVariables.value(varid)));
  523. }
  524.  
  525. ICF.TimeUtil.GetPlayHoursSince = function(varid, resid) {
  526.     if (resid == undefined) {return parseInt(ICF.TimeUtil.GetPlayTimeSince(varid)/60)};
  527.     var Today = $gameSystem.playtime();
  528.     $gameVariables.setValue(resid, parseInt((Today - $gameVariables.value(varid))/60));
  529. }
  530.  
  531. ICF.TimeUtil.GetPlayDaysSince = function(varid, resid) {
  532.     if (resid == undefined) {return parseInt(ICF.TimeUtil.GetPlayTimeSince(varid)/1440)};
  533.     var Today = $gameSystem.playtime();
  534.     $gameVariables.setValue(resid, parseInt((Today - $gameVariables.value(varid))/1440));
  535. }
  536.  
  537. ICF.TimeUtil.GetDate = function() {
  538.     var Today = new Date();
  539.     ICF.TimeUtil.Today = Today.getMonthAndDay();
  540.     Today.increaseMinutes($gameVariables.value(ICF.Param.TimeTravel));
  541.     ICF.TimeUtil.Day = Today.getMonthAndDay();
  542.     if (ICF.Param.TimeVars[0] > 0) {$gameVariables.setValue(ICF.Param.TimeVars[0], Today.getFullYear());}
  543.     if (ICF.Param.TimeVars[1] > 0) {$gameVariables.setValue(ICF.Param.TimeVars[1], Today.getMonth() + 1);}
  544.     if (ICF.Param.TimeVars[2] > 0) {$gameVariables.setValue(ICF.Param.TimeVars[2], Today.getDate());}
  545.     if (ICF.Param.TimeVars[3] > 0) {$gameVariables.setValue(ICF.Param.TimeVars[3], Today.getHours());}
  546.     if (ICF.Param.TimeVars[4] > 0) {$gameVariables.setValue(ICF.Param.TimeVars[4], Today.getMinutes());}
  547.     if (ICF.Param.TimeVars[5] > 0) {$gameVariables.setValue(ICF.Param.TimeVars[5], Today.getDay());}
  548.     if (ICF.Param.TimeVars[6] > 0) {$gameVariables.setValue(ICF.Param.TimeVars[6], ICF.TimeUtil.Day);}
  549.     if (ICF.Param.TimeVars[7] > 0) {$gameVariables.setValue(ICF.Param.TimeVars[7], Today.getHourAndMinute());}
  550.  
  551. }
  552.  
  553. ICF.TimeUtil.GoPresent = function(updating) {
  554.     $gameVariables.setValue(ICF.Param.TimeTravel, 0);
  555.     if (updating) {ICF.TimeUtil.GetDate();}
  556. }
  557.  
  558. ICF.TimeUtil.AdvanceTime = function(minutes, updating) {
  559.     if (minutes == undefined) {minutes = 1}
  560.     $gameVariables.setValue(ICF.Param.TimeTravel, $gameVariables.value(ICF.Param.TimeTravel) + minutes);
  561.     if (updating) {ICF.TimeUtil.GetDate();}
  562. }
  563.  
  564. ICF.TimeUtil.AdvanceDays = function(days, updating) {
  565.     if (days == undefined) {days = 1}
  566.     $gameVariables.setValue(ICF.Param.TimeTravel, $gameVariables.value(ICF.Param.TimeTravel) + days * 1440);
  567.     if (updating) {ICF.TimeUtil.GetDate();}
  568. }
  569.  
  570. ICF.TimeUtil.AdvanceYears = function(years, updating) {
  571.     if (years == undefined) {years = 1}
  572.     $gameVariables.setValue(ICF.Param.TimeTravel, $gameVariables.value(ICF.Param.TimeTravel) + years * 525960);
  573.     if (updating) {ICF.TimeUtil.GetDate();}
  574. }
  575.  
  576. //=============================================================================
  577. // Game_Interpreter
  578. //=============================================================================
  579.  
  580. ICF.TimeUtil.pluginCommand = Game_Interpreter.prototype.pluginCommand;
  581. Game_Interpreter.prototype.pluginCommand = function(command, args) {
  582.         ICF.TimeUtil.pluginCommand.call(this, command, args);
  583.     if (command.toLowerCase() === 'gettime') {
  584.         ICF.TimeUtil.GetTime(args[0]);
  585.     } else if (command.toLowerCase() == 'gettimesince') {
  586.         ICF.TimeUtil.GetTimeSince(args[0], args[1]);
  587.     } else if (command.toLowerCase() == 'gethourssince') {
  588.         ICF.TimeUtil.GetHoursSince(args[0], args[1]);
  589.     } else if (command.toLowerCase() == 'getdayssince') {
  590.         ICF.TimeUtil.GetDaysSince(args[0], args[1]);
  591.     } else if (command.toLowerCase() === 'getplaytime') {
  592.         ICF.TimeUtil.GetPlayTime(args[0]);
  593.     } else if (command.toLowerCase() == 'getplaytimesince') {
  594.         ICF.TimeUtil.GetPlayTimeSince(args[0], args[1]);
  595.     } else if (command.toLowerCase() == 'getplayhourssince') {
  596.         ICF.TimeUtil.GetPlayHoursSince(args[0], args[1]);
  597.     } else if (command.toLowerCase() == 'getplaydayssince') {
  598.         ICF.TimeUtil.GetPlayDaysSince(args[0], args[1]);
  599.         } else if (command.toLowerCase() == 'updatetime') {
  600.         ICF.TimeUtil.GetDate();
  601.         } else if (command.toLowerCase() == 'gopresent') {
  602.         ICF.TimeUtil.GoPresent(args[0]);
  603.     } else if (command.toLowerCase() == 'advancetime') {
  604.         ICF.TimeUtil.AdvanceTime(args[0], args[1]);
  605.     } else if (command.toLowerCase() == 'advancedays') {
  606.         ICF.TimeUtil.AdvanceDays(args[0], args[1]);
  607.         } else if (command.toLowerCase() == 'advanceyears') {
  608.         ICF.TimeUtil.AdvanceYears(args[0], args[1]);
  609.         }
  610. };
  611.  
  612. //=============================================================================
  613. // Game_Map
  614. //=============================================================================
  615.  
  616. ICF.TimeUtil.mapsetup = Game_Map.prototype.setup;
  617. Game_Map.prototype.setup = function(mapId) {
  618.     ICF.TimeUtil.GetDate();
  619.     ICF.TimeUtil.mapsetup.call(this, mapId);
  620. };
  621.  
  622. //=============================================================================
  623. // Game_System
  624. //=============================================================================
  625.  
  626. Game_System.prototype.playtime = function() {
  627.     return Math.floor(Graphics.frameCount / 60);
  628. };
  629.  
  630. //=============================================================================
  631. // Game_Switches
  632. //=============================================================================
  633.  
  634. ICF.TimeUtil.Game_Switches_value = Game_Switches.prototype.value;
  635. Game_Switches.prototype.value = function(switchId) {
  636.   if (ICF.Param.TimeFixedInt.indexOf(switchId) > -1) {
  637.     return (ICF.TimeUtil.Day == ICF.Param.TimeFixedData[ICF.Param.TimeFixedInt.indexOf(switchId)]);
  638.   } else if (ICF.Param.TimeVarsInt.indexOf(switchId) > -1) {
  639.     return (ICF.TimeUtil.Day == $gameVariables.value(ICF.Param.TimeVarsData[ICF.Param.TimeVarsInt.indexOf(switchId)]));
  640.   } else {
  641.     return ICF.TimeUtil.Game_Switches_value.call(this, switchId);
  642.   }
  643. };
  644.  
  645. //=============================================================================
  646. // End of File
  647. //=============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement