Skip to content

Standing Model

GabeStah edited this page Nov 10, 2014 · 14 revisions
  • active:boolean - Is record active within the VCP database?
  • character:integer - Associated Character model
  • points:decimal - Current points

Events

Gain Events

  • attendance_gain - Player sits but available for raid, so Player earns attendance credit. :attendance_gain = 1.0
  • delinquent_gain - Player B is tardy, so Player A earns a percentage of Player B's lost tardiness penalty. points_earned = penalty_points * -1 / (num_active_players - 1) If Player B is absent, Player A earns a percentage of Player B's lost tardiness penalty, but doubled. points_earned = penalty_points * -1 / (num_active_players - 1) * 2
  • infraction_gain - Player B is penalized for some action, so Player A earns Player B's penalty. points_earned = penalty_points * -1 / (num_active_players - 1)
  • initial_gain - Player can earn random points based on starting seed when all players are initially introduced into the system. Random seed is starting ranking number from 1 to # of players. player_seed = random(1, num_new_players)
  def self.calculate_starting_points(args = {})
    seed = args[:seed] || 1
    players = args[:players] || 23
    increment = args[:increment] || 10
    if (players % 2) == 0 # even
      (increment * players / 2 - increment / 2 - (seed - 1) * increment).round(4)
    else # odd
      (increment * (players - 1) / 2 - (seed - 1) * increment).round(4)
    end
  end

Loss Events

  • attendance_loss - Player attends a raid, so Player spends raid cost in points to do so.
:attendance_loss = (Standing.all.size  - Raid.attendees) * :delinquent_loss / Raid.attendees
  • delinquent_loss - Player is absent or tardy. For an absence delinquent_loss is -1 point for an Excused Absence and -1.5 points for an Unexcused Absence. For tardiness, the Player loses the percentage of tardiness_cutoff_time (typically 60 minutes) the Player missed, up to a maximum of -1 point. For a Player 15 minutes late (and thus missing 25% of the tardiness_cutoff_period), he or she suffers a delinquent_loss of 25% of -1 or -0.25 points.
  • infraction_loss - Player commits an infraction (such as unexcused absence), and thus incurs a point penalty.
  • initial_loss - Player can lose random points based on starting seed when all players are initially introduced into the system. Random seed is starting ranking number from 1 to # of players. (See above.)

Neutral Events

  • adjustment - Manual adjustment for Player B. Player A receives distributed inverse of adjusted points for Player B. player_a_point_change = player_b.points * -1 / (num_active_players - 1)
  • retirement - Player B quits and is applied a retirement event. Player A subsumes a percentage of Player B's current points when distributed among the remaining VCP roster. player_a_point_change = player_b.points / (num_active_players - 1)
  • resume - Player B rejoins after a previous retirement and is thus already in the system. Player A gains/losses the inverse percentage of points distributed among active players. player_a_point_change = player_b.points * -1 / (num_active_players - 1)

Typical Event Chain

  • Raid is created.
  • Participations are added to raid indicating timestamps of basic actions.
  • Upon UNKNOWN_EVENT (Participation create/update/destroy?), aggregate all Participation for single raid for processing.
  • Destroy all existing StandingEvents tied to parent (Raid in this case).
  • Destruction of StandingEvent should revert the :change to existing Standing values such as Points.
  • Next, Participations are scanned to determine which Participations should generate a StandingEvent.
  • Appropriate StandingEvents are created, calculating applicable :change as needed.
  • after_create of StandingEvent, :change value should be applied to Standing points.
  • before_update of StandingEvent, :change value should be reverted on Standing points.
  • after_update of StandingEvent, :change value should be applied to Standing points.
  • after_destroy of StandingEvent, :change value should be reverted on Standing points.
You can’t perform that action at this time.