-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconverters.go
203 lines (185 loc) · 6.38 KB
/
converters.go
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
package main
import (
"fmt"
"os"
"strings"
)
func CheckCompatibleGame(converter Converter) bool {
var is16 = checkGameVersion(getGameInstallDirectory()) == "1.6"
if converter.Needs16 && is16 {
return true
} else if converter.Needs16 && !is16 {
return false
}
return true
}
type Converter struct {
Name string
Needs16 bool
Repo string
GitFile string
InputDirectory string
OutputDirectory string
MainFile string
RequirementsFile string
SupportedUniqueID string
ExtraArgs string
IsPython bool
}
func (c Converter) ModifyConfig(configPath string) {
if c.Name == "TMXL2CP" {
var bytes = []byte(fmt.Sprintf(`{"game_folder": "%s","ran_before": false}`, strings.ReplaceAll(
getGameInstallDirectory(), "\\", "\\\\")))
os.WriteFile(configPath, bytes, 0644)
} else if c.Name == "CP2AT" {
var bytes = []byte(`{"mod_folder_path": "input","keywords": [""], "output_folder_path": "output"}`)
os.WriteFile(configPath, bytes, 0644)
}
}
func (c Converter) SupportsManifest(manifest map[string]interface{}) bool {
var contentPackFor = manifest["ContentPackFor"].(map[string]interface{})["UniqueID"].(string)
debugLog(fmt.Sprintf("checking if CPF %s is compatible with UID %s", contentPackFor, c.SupportedUniqueID))
return strings.ToLower(contentPackFor) == strings.ToLower(c.SupportedUniqueID)
}
var TMXL2CP = Converter{
Name: "TMXL2CP",
Needs16: true,
Repo: "https://github.com/AnotherPillow/TMXL2CP",
GitFile: "https://github.com/AnotherPillow/TMXL2CP.git",
InputDirectory: "TMXL",
OutputDirectory: "CP",
MainFile: "main.py",
RequirementsFile: "requirements.txt",
SupportedUniqueID: "platonymous.tmxloader",
ExtraArgs: "",
IsPython: true,
}
var BFAV2CP = Converter{
Name: "BFAV2CP",
Needs16: false,
Repo: "https://github.com/AnotherPillow/BFAV2CP",
GitFile: "https://github.com/AnotherPillow/BFAV2CP.git",
InputDirectory: "input",
OutputDirectory: "output",
MainFile: "main.py",
RequirementsFile: "requirements.txt",
SupportedUniqueID: "paritee.betterfarmanimalvariety",
ExtraArgs: "",
IsPython: true,
}
var CM2CP = Converter{
Name: "CM2CP",
Needs16: false,
Repo: "https://github.com/AnotherPillow/CM2CP",
GitFile: "https://github.com/AnotherPillow/CM2CP.git",
InputDirectory: "input",
OutputDirectory: "output",
MainFile: "main.py",
RequirementsFile: "requirements.txt",
SupportedUniqueID: "platonymous.custommusic",
ExtraArgs: "",
IsPython: true,
}
var STF2CP = Converter{
Name: "STF2CP",
Needs16: false,
Repo: "https://github.com/AnotherPillow/STF2CP",
GitFile: "https://github.com/AnotherPillow/STF2CP.git",
InputDirectory: "input",
OutputDirectory: "output",
MainFile: "main.py",
RequirementsFile: "requirements.txt",
SupportedUniqueID: "cherry.shoptileframework",
ExtraArgs: "",
IsPython: true,
}
var FurnitureConverter = Converter{
Name: "FurnitureConverter",
Needs16: false,
Repo: "https://github.com/elizabethcd/FurnitureConverter",
GitFile: "https://github.com/elizabethcd/FurnitureConverter.git",
InputDirectory: "input",
OutputDirectory: "output-1.6",
MainFile: "furniture_converter.py",
RequirementsFile: "requirements.txt",
SupportedUniqueID: "platonymous.customfurniture",
ExtraArgs: "--inputDir input --outputDir output",
IsPython: true,
}
var CP2AT = Converter{
Name: "CP2AT",
Needs16: false,
Repo: "https://github.com/holy-the-sea/CP2AT",
GitFile: "https://github.com/holy-the-sea/CP2AT.git",
InputDirectory: "input",
OutputDirectory: "output",
MainFile: "main.py",
RequirementsFile: "requirements.txt",
SupportedUniqueID: "pathoschild.contentpatcher",
ExtraArgs: "",
IsPython: true,
}
var CPA2SC = Converter{
Name: "CPA2SC",
Needs16: false,
Repo: "https://github.com/AnotherPillow/CPA2SC",
GitFile: "https://github.com/AnotherPillow/CPA2SC.git",
InputDirectory: "input",
OutputDirectory: "output",
MainFile: "main.py",
RequirementsFile: "requirements.txt",
SupportedUniqueID: "pathoschild.contentpatcher",
ExtraArgs: "",
IsPython: true,
}
var SAAT2CP = Converter{
Name: "SAAT2CP",
Needs16: false,
Repo: "https://github.com/AnotherPillow/SAAT2CP",
GitFile: "https://github.com/AnotherPillow/SAAT2CP.git",
InputDirectory: "input",
OutputDirectory: "output",
MainFile: "main.py",
RequirementsFile: "requirements.txt",
SupportedUniqueID: "zerometers.saat.mod",
ExtraArgs: "",
IsPython: true,
}
var MTN2CP = Converter{
Name: "SAAT2CP",
Needs16: false,
Repo: "https://github.com/AnotherPillow/MTN2CP",
GitFile: "https://github.com/AnotherPillow/MTN2CP.git",
InputDirectory: "input",
OutputDirectory: "output",
MainFile: "main.py",
RequirementsFile: "requirements.txt",
SupportedUniqueID: "sgtpickles.mtn",
ExtraArgs: "",
IsPython: true,
}
var ConvertToFashionSenseJsonAssets = Converter{
Name: "Convert To Fashion Sense JA ONLY",
Needs16: false,
Repo: "https://github.com/anotherpillow/stardew-convert-to-fashion-sense",
GitFile: "https://github.com/anotherpillow/stardew-convert-to-fashion-sense.git",
InputDirectory: "input",
OutputDirectory: "output",
MainFile: "index.js",
RequirementsFile: "",
SupportedUniqueID: "spacechase0.jsonassets",
ExtraArgs: "",
IsPython: false,
}
var ConvertersMap = map[string]Converter{
"TMXL2CP": TMXL2CP,
"BFAV2CP": BFAV2CP,
"CM2CP": CM2CP,
"STF2CP": STF2CP,
"FurnitureConverter": FurnitureConverter,
"CP2AT": CP2AT,
"CPA2SC": CPA2SC,
"SAAT2CP": SAAT2CP,
"MTN2CP": MTN2CP,
"Convert To Fashion Sense JA ONLY": ConvertToFashionSenseJsonAssets,
}