ffxiv 0.9.12 → 0.9.13
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.
- checksums.yaml +4 -4
- data/lib/ffxiv.rb +1 -0
- data/lib/ffxiv/lodestone/character.rb +32 -5
- data/lib/ffxiv/utils.rb +64 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 233de5859743433046d6d329b336e1f0991dd983
|
4
|
+
data.tar.gz: dcd130cc2145edbbf948de79a0ed08232203c90a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30942c5aad24492c4ddc631ffe928f47fabd37ac1b1315d26bbdeda61e2e0e99a1198a62a5c56c1d318d92a57c4a8bd67ef979551701c9580bcec24babbe1f74
|
7
|
+
data.tar.gz: af0cf0ffc57444520a70554f59e2df2cb382f3ed235a630a7a15af5ffc64635256987c1ef97143c10fe0ee80176c8aece2e91ff45be8a4f055e64ec2929130e6
|
data/lib/ffxiv.rb
CHANGED
@@ -2,8 +2,8 @@ module FFXIV
|
|
2
2
|
module Lodestone
|
3
3
|
class Character < Model
|
4
4
|
|
5
|
-
attr_accessor :id, :name, :server, :thumbnail_uri, :image_uri, :race, :subrace, :gender,
|
6
|
-
:
|
5
|
+
attr_accessor :id, :name, :server, :thumbnail_uri, :image_uri, :race, :subrace, :gender, :nameday,
|
6
|
+
:birthday, :guardian, :city_state, :grand_company, :grand_company_rank, :free_company,
|
7
7
|
:minions, :mounts, :end_contents, :eternal_bonding, :self_introduction, :classes,
|
8
8
|
:num_blogs, :first_blogged, :latest_blogged, :bpd, :free_company_rank, :linkshell_rank
|
9
9
|
alias :end_contents? :end_contents
|
@@ -72,6 +72,21 @@ module FFXIV
|
|
72
72
|
else raise "Unrecognized gender symbol: #{gender}"
|
73
73
|
end
|
74
74
|
|
75
|
+
months = {
|
76
|
+
"1st Astral Moon" => 1,
|
77
|
+
"1st Umbral Moon" => 2,
|
78
|
+
"2nd Astral Moon" => 3,
|
79
|
+
"2nd Umbral Moon" => 4,
|
80
|
+
"3rd Astral Moon" => 5,
|
81
|
+
"3rd Umbral Moon" => 6,
|
82
|
+
"4th Astral Moon" => 7,
|
83
|
+
"4th Umbral Moon" => 8,
|
84
|
+
"5th Astral Moon" => 9,
|
85
|
+
"5th Umbral Moon" => 10,
|
86
|
+
"6th Astral Moon" => 11,
|
87
|
+
"6th Umbral Moon" => 12
|
88
|
+
}
|
89
|
+
|
75
90
|
dom.search("dl.chara_profile_box_info").each do |n|
|
76
91
|
n.search("dd.txt").each do |dd|
|
77
92
|
dd_txt_name = dd.next_element
|
@@ -79,6 +94,9 @@ module FFXIV
|
|
79
94
|
case dd.content
|
80
95
|
when "Nameday"
|
81
96
|
props[:nameday] = t
|
97
|
+
match = t.match /^(\d+).+?the\s(.*)$/
|
98
|
+
pp match
|
99
|
+
props[:birthday] = Date.new(2013, months[match[2]], match[1].to_i)
|
82
100
|
when "Guardian"
|
83
101
|
props[:guardian] = t
|
84
102
|
when "City-state"
|
@@ -107,12 +125,13 @@ module FFXIV
|
|
107
125
|
props[:self_introduction] = self_introduction == "" ? nil : self_introduction
|
108
126
|
|
109
127
|
props[:classes] = {}
|
110
|
-
%w{
|
111
|
-
|
128
|
+
%w{Fighter Sorcerer Crafter Gatherer}.each do |discipline|
|
129
|
+
props[:classes][discipline] = {}
|
130
|
+
dom.search("h4.class_#{discipline.downcase} + div.table_black_w626 td.ic_class_wh24_box").each do |td|
|
112
131
|
txt = td.content
|
113
132
|
unless txt.empty?
|
114
133
|
lvl = td.next_sibling().next_sibling().content.to_i
|
115
|
-
props[:classes][txt] = lvl == 0 ? nil : lvl
|
134
|
+
props[:classes][discipline][txt] = lvl == 0 ? nil : lvl
|
116
135
|
end
|
117
136
|
end
|
118
137
|
end
|
@@ -133,6 +152,14 @@ module FFXIV
|
|
133
152
|
@free_company
|
134
153
|
end
|
135
154
|
|
155
|
+
def birthday
|
156
|
+
Utils.ed2gd(@nameday)
|
157
|
+
end
|
158
|
+
|
159
|
+
def data_center
|
160
|
+
Utils.data_center(@server)
|
161
|
+
end
|
162
|
+
|
136
163
|
def num_blogs
|
137
164
|
init_blog; @num_blogs
|
138
165
|
end
|
data/lib/ffxiv/utils.rb
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
$:.unshift File.dirname(__FILE__)
|
2
|
+
|
3
|
+
module FFXIV
|
4
|
+
module Utils
|
5
|
+
|
6
|
+
@@eorzean_months = {
|
7
|
+
"1st Astral Moon" => 1,
|
8
|
+
"1st Umbral Moon" => 2,
|
9
|
+
"2nd Astral Moon" => 3,
|
10
|
+
"2nd Umbral Moon" => 4,
|
11
|
+
"3rd Astral Moon" => 5,
|
12
|
+
"3rd Umbral Moon" => 6,
|
13
|
+
"4th Astral Moon" => 7,
|
14
|
+
"4th Umbral Moon" => 8,
|
15
|
+
"5th Astral Moon" => 9,
|
16
|
+
"5th Umbral Moon" => 10,
|
17
|
+
"6th Astral Moon" => 11,
|
18
|
+
"6th Umbral Moon" => 12
|
19
|
+
}
|
20
|
+
|
21
|
+
@@eorzean_days = {
|
22
|
+
"1st Astral Moon" => {1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12, 13 => 13, 14 => 14, 15 => 15, 16 => 16, 17 => 17, 18 => 18, 19 => 19, 20 => 20, 21 => 21, 22 => 22, 23 => 23, 24 => 24, 25 => 25, 26 => 26, 27 => 27, 28 => 28, 29 => 28, 30 => 29, 31 => 30, 32 => 31},
|
23
|
+
"1st Umbral Moon" => {1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 7, 9 => 8, 10 => 9, 11 => 10, 12 => 11, 13 => 12, 14 => 13, 15 => 14, 16 => 14, 17 => 15, 18 => 16, 19 => 17, 20 => 18, 21 => 19, 22 => 20, 23 => 21, 24 => 21, 25 => 22, 26 => 23, 27 => 24, 28 => 25, 29 => 26, 30 => 27, 31 => 28, 32 => 29},
|
24
|
+
"2nd Astral Moon" => {1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12, 13 => 13, 14 => 14, 15 => 15, 16 => 16, 17 => 17, 18 => 18, 19 => 19, 20 => 20, 21 => 21, 22 => 22, 23 => 23, 24 => 24, 25 => 25, 26 => 26, 27 => 27, 28 => 28, 29 => 28, 30 => 29, 31 => 30, 32 => 31},
|
25
|
+
"2nd Umbral Moon" => {1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 7, 9 => 8, 10 => 9, 11 => 10, 12 => 11, 13 => 12, 14 => 13, 15 => 14, 16 => 15, 17 => 16, 18 => 17, 19 => 18, 20 => 19, 21 => 20, 22 => 21, 23 => 22, 24 => 23, 25 => 24, 26 => 25, 27 => 26, 28 => 27, 29 => 28, 30 => 28, 31 => 29, 32 => 30},
|
26
|
+
"3rd Astral Moon" => {1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12, 13 => 13, 14 => 14, 15 => 15, 16 => 16, 17 => 17, 18 => 18, 19 => 19, 20 => 20, 21 => 21, 22 => 22, 23 => 23, 24 => 24, 25 => 25, 26 => 26, 27 => 27, 28 => 28, 29 => 29, 30 => 29, 31 => 30, 32 => 31},
|
27
|
+
"3rd Umbral Moon" => {1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 7, 9 => 8, 10 => 9, 11 => 10, 12 => 11, 13 => 12, 14 => 13, 15 => 14, 16 => 15, 17 => 16, 18 => 17, 19 => 18, 20 => 19, 21 => 20, 22 => 21, 23 => 22, 24 => 23, 25 => 24, 26 => 25, 27 => 26, 28 => 27, 29 => 28, 30 => 28, 31 => 29, 32 => 30},
|
28
|
+
"4th Astral Moon" => {1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12, 13 => 13, 14 => 14, 15 => 15, 16 => 16, 17 => 17, 18 => 18, 19 => 19, 20 => 20, 21 => 21, 22 => 22, 23 => 23, 24 => 24, 25 => 25, 26 => 26, 27 => 27, 28 => 28, 29 => 28, 30 => 29, 31 => 30, 32 => 31},
|
29
|
+
"4th Umbral Moon" => {1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12, 13 => 13, 14 => 14, 15 => 15, 16 => 16, 17 => 17, 18 => 18, 19 => 19, 20 => 20, 21 => 21, 22 => 22, 23 => 23, 24 => 24, 25 => 25, 26 => 26, 27 => 27, 28 => 28, 29 => 28, 30 => 29, 31 => 30, 32 => 31},
|
30
|
+
"5th Astral Moon" => {1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 7, 9 => 8, 10 => 9, 11 => 10, 12 => 11, 13 => 12, 14 => 13, 15 => 14, 16 => 15, 17 => 16, 18 => 17, 19 => 18, 20 => 19, 21 => 20, 22 => 21, 23 => 22, 24 => 23, 25 => 24, 26 => 25, 27 => 26, 28 => 27, 29 => 28, 30 => 28, 31 => 29, 32 => 30},
|
31
|
+
"5th Umbral Moon" => {1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12, 13 => 13, 14 => 14, 15 => 15, 16 => 16, 17 => 17, 18 => 18, 19 => 19, 20 => 20, 21 => 21, 22 => 22, 23 => 23, 24 => 24, 25 => 25, 26 => 26, 27 => 27, 28 => 28, 29 => 28, 30 => 29, 31 => 30, 32 => 31},
|
32
|
+
"6th Astral Moon" => {1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 7, 9 => 8, 10 => 9, 11 => 10, 12 => 11, 13 => 12, 14 => 13, 15 => 14, 16 => 15, 17 => 16, 18 => 17, 19 => 18, 20 => 19, 21 => 20, 22 => 21, 23 => 22, 24 => 23, 25 => 24, 26 => 25, 27 => 26, 28 => 27, 29 => 28, 30 => 28, 31 => 29, 32 => 30},
|
33
|
+
"6th Umbral Moon" => {1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12, 13 => 13, 14 => 14, 15 => 15, 16 => 16, 17 => 17, 18 => 18, 19 => 19, 20 => 20, 21 => 21, 22 => 22, 23 => 23, 24 => 24, 25 => 25, 26 => 26, 27 => 27, 28 => 28, 29 => 28, 30 => 29, 31 => 30, 32 => 31}
|
34
|
+
}
|
35
|
+
|
36
|
+
@@servers = {
|
37
|
+
"Elemental" => %w{Aegis Atomos Carbuncle Garuda Gungnir Kujata Ramuh Tonberry Typhon Unicorn},
|
38
|
+
"Gaia" => %w{Alexander Bahamut Durandal Fenrir Ifrit Ridill Tiamat Ultima Valefor Yojimbo Zeromus},
|
39
|
+
"Mana" => %w{Anima Asura Belias Chocobo Hades Ixion Mandragora Masamune Pandaemonium Shinryu Titan},
|
40
|
+
"Aether" => %w{Adamantoise Balmung Cactuar Coeurl Faerie Gilgamesh Goblin Jenova Mateus Midgardsormr Sargatanas Siren Zalera},
|
41
|
+
"Primal" => %w{Behemoth Brynhildr Diabolos Excalibur Exodus Famfrit Hyperion Lamia Leviathan Malboro Ultros},
|
42
|
+
"Chaos" => %w{Cerberus Lich Moogle Odin Phoenix Ragnarok Shiva Zodiark}
|
43
|
+
}
|
44
|
+
|
45
|
+
class << self
|
46
|
+
|
47
|
+
def ed2gd(ed)
|
48
|
+
partials = ed.match(/^(\d+).+([1-6].*)$/)
|
49
|
+
Date.new(2013, @@eorzean_months[partials[2]], @@eorzean_days[partials[2]][partials[1].to_i])
|
50
|
+
end
|
51
|
+
|
52
|
+
def servers
|
53
|
+
@@servers
|
54
|
+
end
|
55
|
+
|
56
|
+
def data_center(server)
|
57
|
+
self.servers.each do |dc, srvs|
|
58
|
+
return dc if srvs.include? server
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffxiv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Syro Bonkus
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -44,6 +44,7 @@ files:
|
|
44
44
|
- lib/ffxiv/lodestone/free-company.rb
|
45
45
|
- lib/ffxiv/lodestone/linkshell.rb
|
46
46
|
- lib/ffxiv/lodestone/model.rb
|
47
|
+
- lib/ffxiv/utils.rb
|
47
48
|
homepage: https://github.com/ffxiv/ffxiv
|
48
49
|
licenses:
|
49
50
|
- MIT
|