cerberus

Created: 2014-05-19 13:05
Updated: 2014-07-15 11:46

README.md

Information

Cerberus is a Grepolis Analytics Tool

I'm pulling every hour the latest Data from the Grepolis "API". You cann see all the Tasks under the 'lib/task' Directory

require 'smarter_csv'
require 'open-uri'
desc "Import Players"

task :import_players => :environment do

  progress = ProgressBar.create( :format         => '%a %bᗧ%i %p%% %t',
                                 :progress_mark  => ' ',
                                 :remainder_mark => '',
                                 :total          => nil,
                                 :title          => 'Importing Players')

  url = "http://#{ENV['WORLD']}.grepolis.com/data/players.txt"
  url_data = open(url).read()
  File.open('/tmp/players.txt', 'w') { |file| file.write(url_data) }
  progress.total = open(url).readlines.size

  SmarterCSV.process('/tmp/players.txt', {
    :user_provided_headers => [
      "grepo_id", "name", "alliance_id", "points", "rank", "town_count"
    ], headers_in_file: false
  }) do |array|

    array.each do |a|
      a[:name] = a[:name].to_s
      a[:name] = CGI::unescape(a[:name]).force_encoding('UTF-8')
      Player.where(:grepo_id => a[:grepo_id]).first_or_initialize.update_attributes(a)
      progress.increment
    end

  end

end

The API consists of

:players, :towns, :islands, :conquers, :player_kills, :alliance_kills

With this Data i show the changes happening in the Game, and provide a Directory for Analytics.

Project Info

I started this Project ± 2 Weeks ago, so everyting you see here is in a very messy state. You can see what gems and plugins i use in the gem file.

Right now i'm working on the UI and 'Versioning' so i can track and display changes over time.

I work a lot with Trello, so here is a quick sneak peek of a Weeks Trello Activity

Cerberus Trello

A few Screenshots

Player Index Screenshot1

Alliance Show View Screenshot2

Player Show View Screenshot3

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more