Skip to content

Commit

Permalink
added pjoin/pleave
Browse files Browse the repository at this point in the history
fixed up gameutil to cache content not fd
  • Loading branch information
marcbowes committed Dec 26, 2008
1 parent a26a882 commit a7b9e05
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
7 changes: 6 additions & 1 deletion lib/score_bot/game.rb
Expand Up @@ -13,7 +13,12 @@ def ability_used_no_target(player, flag, id)
# "Equinox", "66", "1093684036" # "Equinox", "66", "1093684036"
# ["%x" % "1093678644"].pack("H*") => "A064" # ["%x" % "1093678644"].pack("H*") => "A064"
ability = ["%x" % id].pack("H*") ability = ["%x" % id].pack("H*")
players[player][:hero] = ScoreBot::GameUtil.ability_to_hero(ability)
hero = ScoreBot::GameUtil.ability_to_hero_name(ability)
return if hero.nil?

players[player][:hero] = hero
puts "set #{player} to #{players[player][:hero]}"
end end


def sync_stored_integer(key1, key2, value) def sync_stored_integer(key1, key2, value)
Expand Down
4 changes: 2 additions & 2 deletions lib/score_bot/game_util.rb
Expand Up @@ -3,9 +3,9 @@ class GameUtil
def self.ability_to_hero_name(ability) def self.ability_to_hero_name(ability)
# a version of this is saved for safety sake # a version of this is saved for safety sake
begin begin
@@hero_list ||= open("http://dev.agasa.co.za/HEROLIST.txt") @@hero_list ||= open("http://dev.agasa.co.za/HEROLIST.txt").read
rescue Exception => e rescue Exception => e
@@hero_list = open("lib/score_bot/HEROLIST.txt") @@hero_list = open("lib/score_bot/HEROLIST.txt").read
end end
@@hero_list.each_line do |line| @@hero_list.each_line do |line|
if line.match ability if line.match ability
Expand Down
12 changes: 11 additions & 1 deletion lib/score_bot/incoming_message_handler.rb
Expand Up @@ -57,6 +57,16 @@ def handle_pause(game, incoming)
game.pause! game.pause!
end end


def handle_pjoin(game, incoming)
# players joins game in lobby
# PJOIN Equinox
end

def handle_pleft(game, incoming)
# player leaves game in lobby
# PLEFT Equinox
end

def handle_plist(game, incoming) def handle_plist(game, incoming)
# incoming list of players # incoming list of players
# PLIST 1.Equinox # PLIST 1.Equinox
Expand All @@ -76,7 +86,7 @@ def handle_start(game, incoming)
game.start! game.start!
end end


def syncs(game, incoming) def handle_syncs(game, incoming)
# SyncStoreInteger # SyncStoreInteger
# SYNCS Data CK0D0N0 7 # SYNCS Data CK0D0N0 7
syncs, key1, key2, value = incoming.split syncs, key1, key2, value = incoming.split
Expand Down

0 comments on commit a7b9e05

Please sign in to comment.