Module: Hlockey

Defined in:
lib/hlockey.rb,
lib/hlockey/mod.rb,
lib/hlockey/data.rb,
lib/hlockey/game.rb,
lib/hlockey/team.rb,
lib/hlockey/utils.rb,
lib/hlockey/league.rb,
lib/hlockey/actions.rb,
lib/hlockey/message.rb,
lib/hlockey/version.rb,
lib/hlockey/constants.rb,
lib/hlockey/game/fight.rb,
lib/hlockey/mod/locked.rb,
lib/hlockey/mod/punchy.rb,
lib/hlockey/team/player.rb,
lib/hlockey/game/weather.rb,
lib/hlockey/mod/moddable.rb,
lib/hlockey/team/stadium.rb,
lib/hlockey/mod/immaterial.rb,
lib/hlockey/mod/handholding.rb,
lib/hlockey/mod/powernapper.rb,
lib/hlockey/selfdescribable.rb,
lib/hlockey/mod/fencebuilder.rb,
lib/hlockey/game/weather/stars.rb,
lib/hlockey/game/weather/waves.rb,
lib/hlockey/mod/fencedestroyer.rb,
lib/hlockey/game/weather/sunset.rb,
lib/hlockey/game/weather/chicken.rb,
lib/hlockey/game/weather/incline.rb,
lib/hlockey/game/weather/audacity.rb,
lib/hlockey/mod/nonconfrontational.rb,
lib/hlockey/game/weather/weatherable.rb

Overview

All Hlockey library code lives here.

Defined Under Namespace

Modules: Actions, Data, Mod, SelfDescribable, Utils Classes: Game, League, Message, Team

Constant Summary collapse

VERSION =
"7".freeze
UPDATE_FREQUENCY_SECONDS =
5
UPDATES_PER_HOUR =
3600 / UPDATE_FREQUENCY_SECONDS
ACTIONS_PER_PERIOD =
60
NON_OT_PERIODS =
3
NON_OT_ACTIONS =
ACTIONS_PER_PERIOD * NON_OT_PERIODS
TOTAL_ACTIONS =
UPDATES_PER_HOUR - ACTIONS_PER_PERIOD
TOTAL_PERIODS =
TOTAL_ACTIONS / ACTIONS_PER_PERIOD

Class Method Summary collapse

Class Method Details

.new_current_leagueLeague

Returns:



7
8
9
10
11
12
13
14
15
# File 'lib/hlockey.rb', line 7

def self.new_current_league
  league_hash = Data.league
  league_start_time = Time.utc(*league_hash[:start_time])
  one_week = 604_800 # In seconds, to add/subtract with Time objects

  return League.new(**Data.infinileague) if Time.now < league_start_time - one_week

  League.new(**league_hash)
end