-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathASA_Note_Marker_Maker.py
161 lines (117 loc) · 5.6 KB
/
ASA_Note_Marker_Maker.py
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
# Used to brute parse data from the following ark.wiki.gg pages
# https://ark.wiki.gg/wiki/Explorer_Map/The_Island
# https://ark.wiki.gg/wiki/Explorer_Map/Scorched_Earth
# https://ark.wiki.gg/wiki/Explorer_Map/Aberration
import json
import os
#marker deffinitions to cater for differing color and icon (lazzy).
unEditedStringD = """SavedMinimapMarks=(Name="{1}",CustomTag="{2}",Location=(X={3},Y={4},Z={5}),Color=(R=0.134600,G=0.123100,B=0.379481,A=1.000000),ID=232,MarkIcon=/Script/Engine.Texture2D'"/Game/PrimalEarth/UI/Textures/T_UI_HUDPointOfInterest_Tame.T_UI_HUDPointOfInterest_Tame"',MapName="{6}",bIsShowing=False,IconColor=(R=1.000000,G=1.000000,B=1.000000,A=1.000000),bIsShowingText=True,CharacterID=-1,CharacterIsPlayer=False)"""
unEditedStringN = """SavedMinimapMarks=(Name="{1}",CustomTag="{2}",Location=(X={3},Y={4},Z={5}),Color=(R=0.000000,G=0.123100,B=0.379481,A=1.000000),ID=232,MarkIcon=/Script/Engine.Texture2D'"/Game/PrimalEarth/UI/Textures/T_UI_HUDPointOfInterest_Special.T_UI_HUDPointOfInterest_Special"',MapName="{6}",bIsShowing=False,IconColor=(R=1.000000,G=1.000000,B=1.000000,A=1.000000),bIsShowingText=True,CharacterID=-1,CharacterIsPlayer=False)"""
unEditedStringB = """SavedMinimapMarks=(Name="{1}",CustomTag="{2}",Location=(X={3},Y={4},Z={5}),Color=(R=1.000000,G=0.123100,B=0.379481,A=1.000000),ID=232,MarkIcon=/Script/Engine.Texture2D'"/Game/PrimalEarth/UI/Textures/T_UI_HUDPointOfInterest_Special.T_UI_HUDPointOfInterest_Special"',MapName="{6}",bIsShowing=False,IconColor=(R=1.000000,G=1.000000,B=1.000000,A=1.000000),bIsShowingText=True,CharacterID=-1,CharacterIsPlayer=False)"""
#Change as required; the name of the map which you wish to create markers for
#mapName = "TheIsland_WP"
#mapName = "ScorchedEarth_WP"
mapName = "Aberration_WP"
#These are the names of the files I created using the json data from the aforementioned ark.wiki.gg pages. Files must be saved next to the script!
#mapData = "theIsland.json"
#mapData = "scorchedEarth.json"
mapData = "aberration.json"
#The names of the files that you wish to create. These are then cut and pasted into GameUserSettings.ini. Change name as required
#noteFileName = "islandNotes.txt"
#cmdsFileName = "islandCmds.txt"
#noteFileName = "scorchedNotes.txt"
#cmdsFileName = "scorchedCmds.txt"
noteFileName = "aberrationNotes.txt"
cmdsFileName = "aberrationCmds.txt"
#Lists to temp save the extracted data
TeleportCmds = list()
ExtractedData = list()
#Perform the data extraction
def beginDataExtraction():
with open('json/' + mapData) as f:
data = json.load(f)
#print(data)
markers = data["markers"]
#Find the dossiers
dossiers = markers["dossier"]
#Find the explorer-note(s)
expNotes = markers["explorer-note"]
#Extract data
extractNoteData(dossiers)
extractNoteData(expNotes)
def extractNoteData(notes):
for note in notes:
#Get lat and lon
lat = note["lat"]
lon = note["lon"]
#Strip unused html and text
n = note["name"]
n = n.replace('<span class="datamap-explorer-note-id">','')
n = n.replace(' (ID: ',',')
n = n.replace(')</span>','')
#Split remaning data [name, id]
x = n.split(',')
name = x[0]
nid = x[1]
#print(name, lat, lon)
#Strip unused html and text
d = note["description"]
d = d.replace('Teleport command: <code>','')
d = d.replace('</code>','')
#Store teleport command
TeleportCmds.append(name + ": " + d)
#Strip unused html and text
ch = d.replace('cheat spi ','')
#Get the x, y, z
chords = ch.split(' ')
dx = chords[0]
dy = chords[1]
dz = chords[2]
#print(ch)
#Swap marker deffinition to cater for differing color and icon (lazzy).
#Get default marker deffinition
editedString = unEditedStringN
#Is it a dossier if so swap default
if("Dossier" in name):
editedString = unEditedStringD
#Is it a tall tale if so swap default
if("Tall Tale" in name):
editedString = unEditedStringB
#Input json data into marker deffinition
editedString = editedString.replace('{1}', name)
editedString = editedString.replace('{2}', nid)
editedString = editedString.replace('{3}', dx)
editedString = editedString.replace('{4}', dy)
editedString = editedString.replace('{5}', dz)
editedString = editedString.replace('{6}', mapName)
#Store marker deffinition
ExtractedData.append(editedString)
#Write the Marker definitions to text file named via <noteFileName>
def writeDataToFile():
if not os.path.exists('bin'):
os.makedirs('bin')
for data in ExtractedData:
# print(data + "\r")
f = open('bin/' + noteFileName, "a")
f.write(data + "\r")
f.close()
#Write the Marker definitions to text file named via <cmdsFileName>
def writeCmdsToFile():
if not os.path.exists('bin'):
os.makedirs('bin')
for data in TeleportCmds :
# print(data + "\r")
f = open('bin/' + cmdsFileName, "a")
f.write(data + "\r")
f.close()
#Perform extraction
print("Extracting Information")
beginDataExtraction()
#Write data
print("Writing Information")
writeDataToFile()
writeCmdsToFile()
#Coffee time!
print("Done")
while True:
break