Skip to content

Commit 7c48c95

Browse files
Add some ID Lists pages (Related to #21)
1 parent 2bb5b62 commit 7c48c95

32 files changed

+1006
-3
lines changed

assets/images/Bones/bone_ids.webp

78.8 KB
Binary file not shown.

assets/images/Weather/0.png

15.8 KB
Loading

assets/images/Weather/1.png

16.6 KB
Loading

assets/images/Weather/10.png

16.4 KB
Loading

assets/images/Weather/11.png

15.1 KB
Loading

assets/images/Weather/12.png

15.6 KB
Loading

assets/images/Weather/13.png

16.3 KB
Loading

assets/images/Weather/14.png

17.4 KB
Loading

assets/images/Weather/15.png

15.8 KB
Loading

assets/images/Weather/16.png

19.8 KB
Loading

assets/images/Weather/17.png

16.1 KB
Loading

assets/images/Weather/18.png

16.6 KB
Loading

assets/images/Weather/19.png

10.8 KB
Loading

assets/images/Weather/2.png

15 KB
Loading

assets/images/Weather/20.png

14.9 KB
Loading

assets/images/Weather/21.png

13.3 KB
Loading

assets/images/Weather/22.png

12.7 KB
Loading

assets/images/Weather/3.png

15.4 KB
Loading

assets/images/Weather/4.png

15.2 KB
Loading

assets/images/Weather/5.png

16.1 KB
Loading

assets/images/Weather/6.png

14.9 KB
Loading

assets/images/Weather/7.png

15.8 KB
Loading

assets/images/Weather/8.png

20.9 KB
Loading

assets/images/Weather/9.png

15.5 KB
Loading

migrate/oldwiki/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
output/
22
cache/
3+
images/
34
__pycache__/

migrate/oldwiki/extract_images.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import os
2+
import requests
3+
import shutil
4+
from urllib.parse import urljoin, urlparse
5+
from bs4 import BeautifulSoup
6+
7+
url = "https://wiki.multitheftauto.com/wiki/Weather"
8+
filter_str = "Weather_" # Filter for images that containing this string in src
9+
remove_prefix_str = '150px-Weather_'
10+
11+
def download_filtered_images(download_folder="images"):
12+
# Create folder if it doesn't exist or clear it if it does
13+
if not os.path.exists(download_folder):
14+
os.makedirs(download_folder)
15+
else:
16+
shutil.rmtree(download_folder)
17+
os.makedirs(download_folder)
18+
19+
20+
# Request the webpage content
21+
response = requests.get(url)
22+
response.raise_for_status() # Raise error if request failed
23+
24+
# Parse HTML
25+
soup = BeautifulSoup(response.text, "html.parser")
26+
27+
# Find all image tags
28+
images = soup.find_all("img")
29+
30+
downloaded = 0
31+
for img in images:
32+
src = img.get("src")
33+
if not src:
34+
continue
35+
36+
# Check if filter string is in the image path (src)
37+
if filter_str in src:
38+
# Construct full URL if src is relative
39+
img_url = urljoin(url, src)
40+
41+
# Extract image filename
42+
filename = os.path.basename(urlparse(img_url).path)
43+
if not filename:
44+
filename = f"image_{downloaded}.jpg"
45+
46+
if filename.startswith(remove_prefix_str):
47+
filename = filename[len(remove_prefix_str):]
48+
49+
# Download and save the image
50+
try:
51+
img_resp = requests.get(img_url)
52+
img_resp.raise_for_status()
53+
with open(os.path.join(download_folder, filename), "wb") as f:
54+
f.write(img_resp.content)
55+
print(f"Downloaded: {filename}")
56+
downloaded += 1
57+
except Exception as e:
58+
print(f"Failed to download {img_url}: {e}")
59+
60+
if downloaded == 0:
61+
print("No images found matching the filter.")
62+
63+
if __name__ == "__main__":
64+
download_filtered_images()
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
---
2+
import StarlightPage from '@astrojs/starlight/components/StarlightPage.astro';
3+
4+
import { getSeeAlsoLinksFromList } from '@src/utils/general';
5+
import SeeAlsoSection from '@src/components/SeeAlsoSection.astro';
6+
7+
import { Code } from '@astrojs/starlight/components';
8+
9+
import { Image } from 'astro:assets';
10+
import { getAssetImagePath } from '@src/utils/general';
11+
12+
---
13+
<StarlightPage frontmatter={{
14+
template: 'doc',
15+
title: 'Bone IDs',
16+
tableOfContents: false,
17+
}}>
18+
<p>List of all ped <strong>Bone IDs</strong> that can be used with functions such as <a href="/reference/getElementBonePosition">getElementBonePosition</a>.</p>
19+
20+
<div class="bonesbox">
21+
<ul>
22+
<li>0: <strong>BONE_ROOT</strong></li>
23+
<li>1: <strong>BONE_PELVIS1</strong></li>
24+
<li>2: <strong>BONE_PELVIS</strong></li>
25+
<li>3: <strong>BONE_SPINE1</strong></li>
26+
<li>4: <strong>BONE_UPPERTORSO</strong></li>
27+
<li>5: <strong>BONE_NECK</strong></li>
28+
<li>6: <strong>BONE_HEAD2</strong></li>
29+
<li>7: <strong>BONE_HEAD1</strong></li>
30+
<li>8: <strong>BONE_HEAD</strong></li>
31+
<li>21: <strong>BONE_RIGHTUPPERTORSO</strong></li>
32+
<li>22: <strong>BONE_RIGHTSHOULDER</strong></li>
33+
<li>23: <strong>BONE_RIGHTELBOW</strong></li>
34+
<li>24: <strong>BONE_RIGHTWRIST</strong></li>
35+
<li>25: <strong>BONE_RIGHTHAND</strong></li>
36+
<li>26: <strong>BONE_RIGHTTHUMB</strong></li>
37+
<li>31: <strong>BONE_LEFTUPPERTORSO</strong></li>
38+
<li>32: <strong>BONE_LEFTSHOULDER</strong></li>
39+
<li>33: <strong>BONE_LEFTELBOW</strong></li>
40+
<li>34: <strong>BONE_LEFTWRIST</strong></li>
41+
<li>35: <strong>BONE_LEFTHAND</strong></li>
42+
<li>36: <strong>BONE_LEFTTHUMB</strong></li>
43+
<li>41: <strong>BONE_LEFTHIP</strong></li>
44+
<li>42: <strong>BONE_LEFTKNEE</strong></li>
45+
<li>43: <strong>BONE_LEFTANKLE</strong></li>
46+
<li>44: <strong>BONE_LEFTFOOT</strong></li>
47+
<li>51: <strong>BONE_RIGHTHIP</strong></li>
48+
<li>52: <strong>BONE_RIGHTKNEE</strong></li>
49+
<li>53: <strong>BONE_RIGHTANKLE</strong></li>
50+
<li>54: <strong>BONE_RIGHTFOOT</strong></li>
51+
<li>201: <strong>BONE_BELLY</strong></li>
52+
<li>301: <strong>BONE_RIGHTBREAST</strong></li>
53+
<li>302: <strong>BONE_LEFTBREAST</strong></li>
54+
</ul>
55+
56+
<Image class="bonesimage" src={getAssetImagePath("Bones/bone_ids.webp")} alt="Labeled Bone IDs" width="150"/>
57+
</div>
58+
59+
<h4>Lua table of these Bone IDs:</h4>
60+
61+
<Code lang="lua" code=`
62+
local boneIDs = {
63+
0, 1, 2, 3, 4, 5, 6, 7, 8, 21,
64+
22, 23, 24, 25, 26, 31, 32, 33,
65+
34, 35, 36, 41, 42, 43, 44, 51,
66+
52, 53, 54, 201, 301, 302
67+
}
68+
`/>
69+
70+
<SeeAlsoSection seeAlsoLinks={getSeeAlsoLinksFromList([
71+
'reference:ID_Lists',
72+
])} currentId='' />
73+
</StarlightPage>
74+
75+
<style>
76+
.bonesbox {
77+
margin-top: 2rem;
78+
display: flex;
79+
align-items: flex-start;
80+
flex-direction: row;
81+
gap: 2rem;
82+
}
83+
.bonesimage {
84+
max-width: 100%;
85+
height: auto;
86+
object-fit: contain;
87+
}
88+
89+
.bonesbox ul {
90+
list-style-type: none;
91+
padding: 0;
92+
}
93+
94+
.bonesbox li {
95+
margin-bottom: 0.5rem;
96+
}
97+
</style>
Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
---
2+
import StarlightPage from '@astrojs/starlight/components/StarlightPage.astro';
3+
import { getSeeAlsoLinksFromList } from '@src/utils/general';
4+
import SeeAlsoSection from '@src/components/SeeAlsoSection.astro';
5+
6+
import NoteBox from '@src/components/NoteBox.astro';
7+
---
8+
<StarlightPage frontmatter={{
9+
template: 'doc',
10+
title: 'Vehicle Colors',
11+
tableOfContents: false,
12+
}}>
13+
<p>These are the <strong>Vehicle Color IDs</strong> that you can get with <a href="/reference/getVehicleColor">getVehicleColor</a> and set with <a href="/reference/setVehicleColor">setVehicleColor</a>.</p>
14+
<NoteBox type='tip'>Vehicles in MTA can also have RGB (red, green, blue) colors set with that same function, going beyond the 127 predefined colors listed here.</NoteBox>
15+
16+
<div class="vctable">
17+
<div style="background: #000000;">0</div>
18+
<div style="background: #F5F5F5; color:black;">1</div>
19+
<div style="background: #2A77A1;">2</div>
20+
<div style="background: #840410;">3</div>
21+
<div style="background: #263739;">4</div>
22+
<div style="background: #86446E;">5</div>
23+
<div style="background: #D78E10;">6</div>
24+
<div style="background: #4C75B7;">7</div>
25+
<div style="background: #BDBEC6;">8</div>
26+
<div style="background: #5E7072;">9</div>
27+
<div style="background: #46597A;">10</div>
28+
<div style="background: #656A79;">11</div>
29+
<div style="background: #5D7E8D;">12</div>
30+
<div style="background: #58595A;">13</div>
31+
<div style="background: #D6DAD6;">14</div>
32+
<div style="background: #9CA1A3;">15</div>
33+
<div style="background: #335F3F;">16</div>
34+
<div style="background: #730E1A;">17</div>
35+
<div style="background: #7B0A2A;">18</div>
36+
<div style="background: #9F9D94;">19</div>
37+
<div style="background: #3B4E78;">20</div>
38+
<div style="background: #732E3E;">21</div>
39+
<div style="background: #691E3B;">22</div>
40+
<div style="background: #96918C;">23</div>
41+
<div style="background: #515459;">24</div>
42+
<div style="background: #3F3E45;">25</div>
43+
<div style="background: #A5A9A7;">26</div>
44+
<div style="background: #635C5A;">27</div>
45+
<div style="background: #3D4A68;">28</div>
46+
<div style="background: #979592;">29</div>
47+
<div style="background: #421F21;">30</div>
48+
<div style="background: #5F272B;">31</div>
49+
<div style="background: #8494AB;">32</div>
50+
<div style="background: #767B7C;">33</div>
51+
<div style="background: #646464;">34</div>
52+
<div style="background: #5A5752;">35</div>
53+
<div style="background: #252527;">36</div>
54+
<div style="background: #2D3A35;">37</div>
55+
<div style="background: #93A396;">38</div>
56+
<div style="background: #6D7A88;">39</div>
57+
<div style="background: #221918;">40</div>
58+
<div style="background: #6F675F;">41</div>
59+
<div style="background: #7C1C2A;">42</div>
60+
<div style="background: #5F0A15;">43</div>
61+
<div style="background: #193826;">44</div>
62+
<div style="background: #5D1B20;">45</div>
63+
<div style="background: #9D9872;">46</div>
64+
<div style="background: #7A7560;">47</div>
65+
<div style="background: #989586;">48</div>
66+
<div style="background: #ADB0B0;">49</div>
67+
<div style="background: #848988;">50</div>
68+
<div style="background: #304F45;">51</div>
69+
<div style="background: #4D6268;">52</div>
70+
<div style="background: #162248;">53</div>
71+
<div style="background: #272F4B;">54</div>
72+
<div style="background: #7D6256;">55</div>
73+
<div style="background: #9EA4AB;">56</div>
74+
<div style="background: #9C8D71;">57</div>
75+
<div style="background: #6D1822;">58</div>
76+
<div style="background: #4E6881;">59</div>
77+
<div style="background: #9C9C98;">60</div>
78+
<div style="background: #917347;">61</div>
79+
<div style="background: #661C26;">62</div>
80+
<div style="background: #949D9F;">63</div>
81+
<div style="background: #A4A7A5;">64</div>
82+
<div style="background: #8E8C46;">65</div>
83+
<div style="background: #341A1E;">66</div>
84+
<div style="background: #6A7A8C;">67</div>
85+
<div style="background: #AAAD8E;">68</div>
86+
<div style="background: #AB988F;">69</div>
87+
<div style="background: #851F2E;">70</div>
88+
<div style="background: #6F8297;">71</div>
89+
<div style="background: #585853;">72</div>
90+
<div style="background: #9AA790;">73</div>
91+
<div style="background: #601A23;">74</div>
92+
<div style="background: #20202C;">75</div>
93+
<div style="background: #A4A096;">76</div>
94+
<div style="background: #AA9D84;">77</div>
95+
<div style="background: #78222B;">78</div>
96+
<div style="background: #0E316D;">79</div>
97+
<div style="background: #722A3F;">80</div>
98+
<div style="background: #7B715E;">81</div>
99+
<div style="background: #741D28;">82</div>
100+
<div style="background: #1E2E32;">83</div>
101+
<div style="background: #4D322F;">84</div>
102+
<div style="background: #7C1B44;">85</div>
103+
<div style="background: #2E5B20;">86</div>
104+
<div style="background: #395A83;">87</div>
105+
<div style="background: #6D2837;">88</div>
106+
<div style="background: #A7A28F;">89</div>
107+
<div style="background: #AFB1B1;">90</div>
108+
<div style="background: #364155;">91</div>
109+
<div style="background: #6D6C6E;">92</div>
110+
<div style="background: #0F6A89;">93</div>
111+
<div style="background: #204B6B;">94</div>
112+
<div style="background: #2B3E57;">95</div>
113+
<div style="background: #9B9F9D;">96</div>
114+
<div style="background: #6C8495;">97</div>
115+
<div style="background: #4D5D60;">98</div>
116+
<div style="background: #AE9B7F;">99</div>
117+
<div style="background: #406C8F;">100</div>
118+
<div style="background: #1F253B;">101</div>
119+
<div style="background: #AB9276;">102</div>
120+
<div style="background: #134573;">103</div>
121+
<div style="background: #96816C;">104</div>
122+
<div style="background: #64686A;">105</div>
123+
<div style="background: #105082;">106</div>
124+
<div style="background: #A19983;">107</div>
125+
<div style="background: #385694;">108</div>
126+
<div style="background: #525661;">109</div>
127+
<div style="background: #7F6956;">110</div>
128+
<div style="background: #8C929A;">111</div>
129+
<div style="background: #596E87;">112</div>
130+
<div style="background: #473532;">113</div>
131+
<div style="background: #44624F;">114</div>
132+
<div style="background: #730A27;">115</div>
133+
<div style="background: #223457;">116</div>
134+
<div style="background: #640D1B;">117</div>
135+
<div style="background: #A3ADC6;">118</div>
136+
<div style="background: #695853;">119</div>
137+
<div style="background: #9B8B80;">120</div>
138+
<div style="background: #620B1C;">121</div>
139+
<div style="background: #5B5D5E;">122</div>
140+
<div style="background: #624428;">123</div>
141+
<div style="background: #731827;">124</div>
142+
<div style="background: #1B376D;">125</div>
143+
<div style="background: #EC6AAE;">126</div>
144+
</div>
145+
146+
<SeeAlsoSection seeAlsoLinks={getSeeAlsoLinksFromList([
147+
'reference:ID_Lists',
148+
])} currentId='' />
149+
</StarlightPage>
150+
151+
<style>
152+
.vctable {
153+
font-family: tahoma, arial, helvetica;
154+
color: white;
155+
display: flex;
156+
flex-wrap: wrap;
157+
}
158+
.vctable > div {
159+
width: 50px;
160+
height: 50px;
161+
border: 1px solid black;
162+
padding: 0;
163+
margin: 0;
164+
text-align: center;
165+
display: flex;
166+
align-items: center;
167+
justify-content: center;
168+
}
169+
</style>

0 commit comments

Comments
 (0)