-
Notifications
You must be signed in to change notification settings - Fork 0
/
.Rhistory
213 lines (213 loc) · 9.27 KB
/
.Rhistory
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
64
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
2^32
.999^10
.999^100
.999^1000
.999^10000
.999^1000
1 - .999^1000
1 - (1 - 0.001)^1000
1 - (1 - 0.01)^1000
1 - (1 - 0.001)^100
(1 - (1 - 0.001)^100) / .001
(1 - (1 - 0.001)^1000) / .001
(1 - (1 - 0.001)^10000) / .001
(1 - (1 - 0.001)^100) / .001
.001 * 95.20785
.001 * 999.9548
(1 - (1 - 0.01)^100) / .01
(1 - (1 - 0.001)^100) / .001
(1 - (1 - 0.001)^100)
Sys.time(.001^10000)
Sys.time(.001^1000)
proc.time()
proc.time()
300* 300
300* 300 * 0.1
300* 300 * 0.01
300* 300 * 0.0001
2^.5
.5/.7
.5/.7 * .9
setwd("~/files/personal/projects/hdsk_mods/Minerals")
library(xml2)
xml2::read_xml("Defs/ThingsDefs_Minerals/DynamicMinerals.xml")
raw_xml <- read_xml("Defs/ThingsDefs_Minerals/DynamicMinerals.xml")
?xml_find_all
xml2::xml_find_all(raw_xml, ".//label")
as.character(xml_find_all(raw_xml, ".//label"))
xml_contents(xml_find_all(raw_xml, ".//label"))
labels <- xml_contents(xml_find_all(raw_xml, ".//label"))
descs <- xml_contents(xml_find_all(raw_xml, ".//description"))
descs
labels <- as.character(xml_contents(xml_find_all(raw_xml, ".//label")))
descs <- as.character(xml_contents(xml_find_all(raw_xml, ".//description")))
descs
beauty <- as.character(xml_contents(xml_find_all(raw_xml, ".//statBases/Beauty")))
beauty
img_path <- as.character(xml_contents(xml_find_all(raw_xml, ".//graphicData/texPath")))
img_path
yeilds <- as.character(xml_contents(xml_find_all(raw_xml, ".//building/mineableThing")))
yeilds
yeild_amt <- as.character(xml_contents(xml_find_all(raw_xml, ".//building/mineableYield")))
for (one_xml in all_xml) {
label <- as.character(xml_contents(xml_find_all(one_xml, ".//label")))
desc <- as.character(xml_contents(xml_find_all(one_xml, ".//description")))
beauty <- as.character(xml_contents(xml_find_all(one_xml, ".//statBases/Beauty")))
img_path <- as.character(xml_contents(xml_find_all(one_xml, ".//graphicData/texPath")))
yeilds <- as.character(xml_contents(xml_find_all(one_xml, ".//building/mineableThing")))
yeild_amt <- as.character(xml_contents(xml_find_all(one_xml, ".//building/mineableYield")))
}
all_xml <- read_xml(xml_path)
xml_file_path = "Defs/ThingsDefs_Minerals/DynamicMinerals.xml"
all_xml <- read_xml(xml_file_path)
for (one_xml in all_xml) {
label <- as.character(xml_contents(xml_find_all(one_xml, ".//label")))
desc <- as.character(xml_contents(xml_find_all(one_xml, ".//description")))
beauty <- as.character(xml_contents(xml_find_all(one_xml, ".//statBases/Beauty")))
img_path <- as.character(xml_contents(xml_find_all(one_xml, ".//graphicData/texPath")))
yeilds <- as.character(xml_contents(xml_find_all(one_xml, ".//building/mineableThing")))
yeild_amt <- as.character(xml_contents(xml_find_all(one_xml, ".//building/mineableYield")))
}
all_xml <- read_xml(xml_file_path)
for (i in seq_along(all_xml)) {
label <- as.character(xml_contents(xml_find_all(all_xml[i], ".//label")))
desc <- as.character(xml_contents(xml_find_all(all_xml[i], ".//description")))
beauty <- as.character(xml_contents(xml_find_all(all_xml[i], ".//statBases/Beauty")))
img_path <- as.character(xml_contents(xml_find_all(all_xml[i], ".//graphicData/texPath")))
yeilds <- as.character(xml_contents(xml_find_all(all_xml[i], ".//building/mineableThing")))
yeild_amt <- as.character(xml_contents(xml_find_all(all_xml[i], ".//building/mineableYield")))
}
all_xml
all_xml[i]
all_xml[[i]]
all_xml <- read_xml(xml_file_path)
label <- as.character(xml_contents(xml_find_all(all_xml, ".//label")))
desc <- as.character(xml_contents(xml_find_all(all_xml, ".//description")))
beauty <- as.character(xml_contents(xml_find_all(all_xml, ".//statBases/Beauty")))
img_path <- as.character(xml_contents(xml_find_all(all_xml, ".//graphicData/texPath")))
yeilds <- as.character(xml_contents(xml_find_all(all_xml, ".//building/mineableThing")))
yeild_amt <- as.character(xml_contents(xml_find_all(all_xml, ".//building/mineableYield")))
label
def_name <- as.character(xml_contents(xml_find_all(all_xml, ".//defName")))
def_name
seq_along(all_xml)
all_xml
all_xml$node
seq_along(xml_children(all_xml))
label
list.files("readme_images/")
custom_img_path <- file.path("readme_images",
paste0(def_name. ".jpg"))
def_name
print_dynamic_minerals <- function(xml_file_path = "Defs/ThingsDefs_Minerals/DynamicMinerals.xml") {
all_xml <- read_xml(xml_file_path)
label <- as.character(xml_contents(xml_find_all(all_xml, ".//label")))
def_name <- as.character(xml_contents(xml_find_all(all_xml, ".//defName")))
desc <- as.character(xml_contents(xml_find_all(all_xml, ".//description")))
beauty <- as.character(xml_contents(xml_find_all(all_xml, ".//statBases/Beauty")))
img_path <- as.character(xml_contents(xml_find_all(all_xml, ".//graphicData/texPath")))
yeilds <- as.character(xml_contents(xml_find_all(all_xml, ".//building/mineableThing")))
yeild_amt <- as.character(xml_contents(xml_find_all(all_xml, ".//building/mineableYield")))
for (i in seq_along(xml_children(all_xml))) {
output <- paste0("### ", label[i], "\n\n",
desc[i], "\n\n",
"Beauty: ", beauty[i], "\n",
"Yields: ", yeild_amt, " ", yeilds[i], "\n\n")
if (paste0(def_name[i], ".jpg") %in% list.files("readme_images")) {
output <- paste0(output, "![](", paste0(def_name[i], ".jpg"), ")\n\n")
}
cat(output)
}
}
print_dynamic_minerals()
print_dynamic_minerals <- function(xml_file_path = "Defs/ThingsDefs_Minerals/DynamicMinerals.xml") {
all_xml <- read_xml(xml_file_path)
label <- as.character(xml_contents(xml_find_all(all_xml, ".//label")))
def_name <- as.character(xml_contents(xml_find_all(all_xml, ".//defName")))
desc <- as.character(xml_contents(xml_find_all(all_xml, ".//description")))
beauty <- as.character(xml_contents(xml_find_all(all_xml, ".//statBases/Beauty")))
img_path <- as.character(xml_contents(xml_find_all(all_xml, ".//graphicData/texPath")))
yeilds <- as.character(xml_contents(xml_find_all(all_xml, ".//building/mineableThing")))
yeild_amt <- as.character(xml_contents(xml_find_all(all_xml, ".//building/mineableYield")))
for (i in seq_along(xml_children(all_xml))) {
output <- paste0("### ", label[i], "\n\n",
desc[i], "\n\n",
"Beauty: ", beauty[i], "\n",
"Yields: ", yeild_amt[i], " ", yeilds[i], "\n\n")
if (paste0(def_name[i], ".jpg") %in% list.files("readme_images")) {
output <- paste0(output, "![](", paste0(def_name[i], ".jpg"), ")\n\n")
}
cat(output)
}
}
print_dynamic_minerals()
print_dynamic_minerals <- function(xml_file_path = "Defs/ThingsDefs_Minerals/DynamicMinerals.xml") {
all_xml <- read_xml(xml_file_path)
label <- as.character(xml_contents(xml_find_all(all_xml, ".//label")))
def_name <- as.character(xml_contents(xml_find_all(all_xml, ".//defName")))
desc <- as.character(xml_contents(xml_find_all(all_xml, ".//description")))
beauty <- as.character(xml_contents(xml_find_all(all_xml, ".//statBases/Beauty")))
img_path <- as.character(xml_contents(xml_find_all(all_xml, ".//graphicData/texPath")))
yeilds <- as.character(xml_contents(xml_find_all(all_xml, ".//building/mineableThing")))
yeild_amt <- as.character(xml_contents(xml_find_all(all_xml, ".//building/mineableYield")))
output <- ""
for (i in seq_along(xml_children(all_xml))) {
output <- paste0(output,
"### ", label[i], "\n\n",
desc[i], "\n\n",
"Beauty: ", beauty[i], "\n",
"Yields: ", yeild_amt[i], " ", yeilds[i], "\n\n")
if (paste0(def_name[i], ".jpg") %in% list.files("readme_images")) {
output <- paste0(output, "![](", paste0(def_name[i], ".jpg"), ")\n\n")
}
}
knitr::asis_output(output)
}
img_path
i = 1
i
img_path[i]
file.path(img_path[i])
list.files("Textures/Things/Mineral/ColdstoneCrystal")
list.files("Textures/Things/Mineral/ColdstoneCrystal", pattern = ".png")
list.files("Textures/Things/Mineral/ColdstoneCrystal", pattern = "\\.png$")
paste0("![](", list.files(img_path[i], pattern = "\\.png$"), ")")
text_paths <- list.files(file.path("Textures", img_path[i]), pattern = "\\.png$")
text_paths
text_paths <- list.files(file.path("Textures", img_path[i]), pattern = "\\.png$", full.names = T)
text_paths
paste0("![](", text_paths, ")")
paste0("![](", text_paths, ")", collapse = " ")
print_dynamic_minerals <- function(xml_file_path = "Defs/ThingsDefs_Minerals/DynamicMinerals.xml") {
all_xml <- read_xml(xml_file_path)
label <- as.character(xml_contents(xml_find_all(all_xml, ".//label")))
def_name <- as.character(xml_contents(xml_find_all(all_xml, ".//defName")))
desc <- as.character(xml_contents(xml_find_all(all_xml, ".//description")))
beauty <- as.character(xml_contents(xml_find_all(all_xml, ".//statBases/Beauty")))
img_path <- as.character(xml_contents(xml_find_all(all_xml, ".//graphicData/texPath")))
yeilds <- as.character(xml_contents(xml_find_all(all_xml, ".//building/mineableThing")))
yeild_amt <- as.character(xml_contents(xml_find_all(all_xml, ".//building/mineableYield")))
output <- ""
for (i in seq_along(xml_children(all_xml))) {
output <- paste0(output,
"### ", label[i], "\n\n",
desc[i], "\n\n",
"Beauty: ", beauty[i], "\n",
"Yields: ", yeild_amt[i], " ", yeilds[i], "\n\n")
text_paths <- list.files(file.path("Textures", img_path[i]), pattern = "\\.png$", full.names = T)
output <- paste0(output,
paste0("![](", text_paths, ")", collapse = " "))
if (paste0(def_name[i], ".jpg") %in% list.files("readme_images")) {
output <- paste0(output, "![](", paste0(def_name[i], ".jpg"), ")\n\n")
}
}
knitr::asis_output(output)
}
print_dynamic_minerals()
def_name
custom_img_path <- file.path(readme_images, paste0(def_name[i], ".jpg"))
custom_img_path <- file.path("readme_images", paste0(def_name[i], ".jpg"))
custom_img_path
512/4
cranlogs::cran_downloads("metacoder", "last-month")
?order