VanaTime 2.1.0 README

This document was last updated on Mon Sep 17 23:09:51 EDT 2007.

Introduction to VanaTime

VanaTime is a group of classes that deal with times, days, and moon phases in the MMORPG Final Fantasy Online (aka FFXI). Besides translating earth time to game time, you can also convert game time to real time, step forward a day, get a time estimate about how long you have left until the next optimal moon phase, and a few other useful features.

VanaTime is a work in progress and the API may change from time to time… you may want to use explicit versioning in any code depending on it.

FFXI::TimeManager

This will probably be the only class you end up using directly. It wraps everything else up in a convenient cascading update system that keeps things in sync, only does updates when necessary, and provides callbacks for firing off your code on events. Huzzah! Callbacks have access to the instance of TimeManager that fired the callback (in case you need access to values other than the property you’re installing the callback for), the old value for the property, and the new value for the property. Cascading updates are enabled by enable_cascading_updates and disabled by disable_cascading_updates.

Here’s a quick example text clock:

tm = FFXI::TimeManager.new
tm.callback(:time_string) {|m,old,new| puts "Time: #{new}"}
tm.callback(:next_phase_countdown_string) do |manager, old, new|
  puts "Countdown until #{manager.moon.next_phase}: #{new}"
end
tm.enable_cascading_updates
loop {tm.update_earth_time(Time.now) ; sleep 0.5}

If you want to manage existing VanaTime, VanaDay, and etc you can pass these as options on init, and any objects not passed in will be created for you. The name for the option will be similar to the class name:

tm = FFXI::TimeManager.new(:vana_time => FFXI::VanaTime.now)

Note that you can have as many TimeManager objects as you want or need for the same set of vanatime objects, as long as only one of them has cascading updates enabled.

The following are the supported properties for adding callbacks, along with the classes that define them (with the more interesting properties first):

> VanaTime
:time_string
:date_string
:earth_time
:vana_time
:tomorrow
:year
:month
:date
:hour
:minute
:second
:year_start
:month_start
:date_start
:hour_start
:minute_start
:second_start
> VanaDay
:day_html
:day_string
:day
:day_element
:day_weakness
:day_strength
> VanaMoon
:moon_string
:moon_percent_string
:moon_phase_name
:moon_phase_short_name
:next_phase_name
:next_phase_short_name
:optimal_phase_name
:optimal_phase_short_name
:next_phase_target
:optimal_phase_target
:moon_phase
:moon_percent
:moon_days
> VanaMoonCountdown
:next_phase_countdown_string
:optimal_phase_countdown_string
:next_phase_countdown
:optimal_phase_countdown
> SkillupCalculator
:skillup_difficulty
:base_difficulty
:moon_phase_factor
:day_crystal_factor

FFXI::ElementFactory::Element

* name
* direction
* strength
* weakness
* color
* enfeeble
* attribute
* ninjutsu
* avatar

FFXI::SkillupCalculator API

* crystal_element=(element)
* recipe_cap=(cap)
* skill=(skill)

All other details are handled by cascading updates via TimeManager.