Method: Api::SinglePanel#as_json

Defined in:
lib/sc2ai/protocol/ui_pb.rb

#as_json(options = {}) ⇒ Object



5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
# File 'lib/sc2ai/protocol/ui_pb.rb', line 5175

def as_json(options = {})
  result = {}

  result["unit"] = @unit.nil? ? {} : @unit.as_json(options) if !options[
    :compact
  ] || has_unit?
  result["attackUpgradeLevel"] = @attack_upgrade_level if !options[
    :compact
  ] || has_attack_upgrade_level?
  result["armorUpgradeLevel"] = @armor_upgrade_level if !options[
    :compact
  ] || has_armor_upgrade_level?
  result["shieldUpgradeLevel"] = @shield_upgrade_level if !options[
    :compact
  ] || has_shield_upgrade_level?
  tmp_buffs = @buffs

  result["buffs"] = tmp_buffs if !options[:compact] || tmp_buffs.any?

  result
end