urbanterror 0.3 → 0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/urbanterror.rb +34 -26
  2. metadata +4 -4
data/lib/urbanterror.rb CHANGED
@@ -75,34 +75,42 @@ class UrbanTerror
75
75
  return initial - selected_i
76
76
  end
77
77
 
78
+ def self.reverseGearCalc(number)
79
+ weapons = []
80
+ gearMaster = {
81
+ 1 => 'grenades',
82
+ 2 => 'snipers',
83
+ 4 => 'spas',
84
+ 8 => 'pistols',
85
+ 16 => 'autos',
86
+ 32 => 'negev'
87
+ }
88
+
89
+ gearMaster.each do |num, weapon|
90
+ if number & num == 0
91
+ weapons << weapon
92
+ end
93
+ end
94
+ return weapons
95
+ end
96
+
78
97
  def self.matchType(number, abbreviate=false)
79
98
  # 0=FreeForAll, 3=TeamDeathMatch, 4=Team Survivor, 5=Follow the Leader, 6=Capture and Hold, 7=Capture The Flag, 8=Bombmode
99
+ match = {
100
+ 0 => ['Free For All', 'FFA'],
101
+ 3 => ['Team Death Match', 'TDM'],
102
+ 4 => ['Team Survivor', 'TS'],
103
+ 5 => ['Follow the Leader', 'FTL'],
104
+ 6 => ['Capture and Hold', 'CAH'],
105
+ 7 => ['Capture the Flag', 'CTF'],
106
+ 8 => ['Bomb mode', 'BOMB']
107
+ }
108
+
109
+ throw "#{number} is not a valid gametype." if not match.has_key? number
80
110
  if abbreviate
81
- match = {
82
- 0 => 'FFA',
83
- 3 => 'TDM',
84
- 4 => 'TS',
85
- 5 => 'FTL',
86
- 6 => 'CAH',
87
- 7 => 'CTF',
88
- 8 => 'BOMB'
89
- }
111
+ match[number][1]
90
112
  else
91
- match = {
92
- 0 => 'Free For All',
93
- 3 => 'Team Death Match',
94
- 4 => 'Team Survivor',
95
- 5 => 'Follow the Leader',
96
- 6 => 'Capture and Hold',
97
- 7 => 'Capture the Flag',
98
- 8 => 'Bomb Mode'
99
- }
113
+ match[number][0]
100
114
  end
101
-
102
- throw "#{number} is not a valid gametype." if not match.has_key? number
103
- match[number]
104
- end
105
-
106
- end
107
-
108
- # puts UrbanTerror.matchType 3
115
+ end
116
+ end
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: urbanterror
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 3
9
- version: "0.3"
8
+ - 4
9
+ version: "0.4"
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ricky Elrod
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-08-23 00:00:00 -04:00
17
+ date: 2010-08-28 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies: []
20
20