Class: Sc2::Data
- Inherits:
-
Object
- Object
- Sc2::Data
- Defined in:
- lib/sc2ai/api/data.rb
Overview
Holds game data from tech tree and Api::ResponseData Called once on game start
Instance Attribute Summary collapse
-
#abilities ⇒ Hash<Integer, Api::AbilityData>
AbilityId => AbilityData.
-
#buffs ⇒ Object
Not particularly useful data.
-
#effects ⇒ Object
Not particularly useful data.
-
#units ⇒ Hash<Integer, Api::UnitTypeData>
UnitId => UnitTypeData.
-
#upgrades ⇒ Hash<Integer, Api::UpgradeData>
UpgradeId => UpgradeData.
Instance Method Summary collapse
-
#initialize(data) ⇒ Data
constructor
A new instance of Data.
Constructor Details
#initialize(data) ⇒ Data
Returns a new instance of Data.
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/sc2ai/api/data.rb', line 33 def initialize(data) return unless data @abilities = abilities_from_proto(data.abilities) @units = units_from_proto(data.units) @upgrades = upgrades_from_proto(data.upgrades) @buffs = buffs_from_proto(data.buffs) @effects = effects_from_proto(data.effects) override_unit_data end |
Instance Attribute Details
#abilities ⇒ Hash<Integer, Api::AbilityData>
Returns AbilityId => AbilityData.
16 17 18 |
# File 'lib/sc2ai/api/data.rb', line 16 def abilities @abilities end |
#buffs ⇒ Object
Not particularly useful data. Just use BuffId directly
@return [Hash<Integer, Api::BuffData>] BuffId => BuffData
26 27 28 |
# File 'lib/sc2ai/api/data.rb', line 26 def buffs @buffs end |
#effects ⇒ Object
Not particularly useful data. Just use EffectId directly
@return [Hash<Integer, Api::EffectData>] EffectId => EffectData
30 31 32 |
# File 'lib/sc2ai/api/data.rb', line 30 def effects @effects end |
#units ⇒ Hash<Integer, Api::UnitTypeData>
Returns UnitId => UnitTypeData.
19 20 21 |
# File 'lib/sc2ai/api/data.rb', line 19 def units @units end |
#upgrades ⇒ Hash<Integer, Api::UpgradeData>
Returns UpgradeId => UpgradeData.
22 23 24 |
# File 'lib/sc2ai/api/data.rb', line 22 def upgrades @upgrades end |