Permalink
Browse files

added pjoin/pleave

fixed up gameutil to cache content not fd
  • Loading branch information...
1 parent a26a882 commit a7b9e051802fadfdcbb22d6a419d212d9630cdca @marcbowes committed Dec 26, 2008
Showing with 19 additions and 4 deletions.
  1. +6 −1 lib/score_bot/game.rb
  2. +2 −2 lib/score_bot/game_util.rb
  3. +11 −1 lib/score_bot/incoming_message_handler.rb
View
@@ -13,7 +13,12 @@ def ability_used_no_target(player, flag, id)
# "Equinox", "66", "1093684036"
# ["%x" % "1093678644"].pack("H*") => "A064"
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
def sync_stored_integer(key1, key2, value)
@@ -3,9 +3,9 @@ class GameUtil
def self.ability_to_hero_name(ability)
# a version of this is saved for safety sake
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
- @@hero_list = open("lib/score_bot/HEROLIST.txt")
+ @@hero_list = open("lib/score_bot/HEROLIST.txt").read
end
@@hero_list.each_line do |line|
if line.match ability
@@ -57,6 +57,16 @@ def handle_pause(game, incoming)
game.pause!
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)
# incoming list of players
# PLIST 1.Equinox
@@ -76,7 +86,7 @@ def handle_start(game, incoming)
game.start!
end
- def syncs(game, incoming)
+ def handle_syncs(game, incoming)
# SyncStoreInteger
# SYNCS Data CK0D0N0 7
syncs, key1, key2, value = incoming.split

0 comments on commit a7b9e05

Please sign in to comment.