Class: Edj::ScanItem

Inherits:
Item
  • Object
show all
Defined in:
lib/edj/scan.rb

Instance Method Summary collapse

Methods inherited from Item

from, #initialize, #timestamp

Constructor Details

This class inherits a constructor from Edj::Item

Instance Method Details

#body_valueObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/edj/scan.rb', line 21

def body_value()
  case @raw["PlanetClass"]
  when "High metal content body"
    return 412249 if terraformable?
    34310
  when "Icy body"
    1246
  when "Ammonia world"
    320203
  when "Water world"
    return 694971 if terraformable?
    301410
  when "Rocky ice body"
    928
  when "Sudarsky class I gas giant"
    7013
  when "Sudarsky class III gas giant"
    2693
  when "Rocky body"
    return 181104 if terraformable?
    928
  when "Metal rich body"
    65045
  when "Earthlike body"
    627885
  when "Gas giant with water based life"
    2314
  when "Sudarsky class II gas giant"
    53663
  when "Water giant"
    1824
  when "Gas giant with ammonia based life"
    1721
  when "Sudarsky class IV gas giant"
    2799
  when "Sudarsky class V gas giant"
    2761
  else
    STDERR.puts("#{@raw}")
    STDERR.puts("when \"#{@raw["PlanetClass"]}\"")
    raise
  end
end

#bodyNameObject



13
14
15
# File 'lib/edj/scan.rb', line 13

def bodyName()
  @raw["BodyName"]
end

#solar_valueObject



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/edj/scan.rb', line 65

def solar_value()
  case @raw["StarType"]
  when "A"
    2949
  when "B"
    3012
  when "DA"
    34294
  when "F"
    2932
  when "G"
    2919
  when "H"
    60589
  when "K"
    2916
  when "L"
    2889
  when "M"
    2903
  when "M_RedGiant"
    3122
  when "T"
    2895
  when "TTS"
    2000
  when "Y"
    2881
  else
    STDERR.puts("#{@raw}")
    STDERR.puts("when \"#{@raw["StarType"]}\"")
    raise
  end
end

#terraformable?Boolean



17
18
19
# File 'lib/edj/scan.rb', line 17

def terraformable?()
  @raw["TerraformState"] != ""
end

#valueObject



5
6
7
8
9
10
11
# File 'lib/edj/scan.rb', line 5

def value()
  return body_value if @raw["PlanetClass"]
  return solar_value if @raw["StarType"]
  return 2000 if @raw["BodyName"] =~ /Belt Cluster/
  STDERR.puts("#{@raw}")
  raise
end