-
Notifications
You must be signed in to change notification settings - Fork 0
/
atlas.php
172 lines (147 loc) · 5.89 KB
/
atlas.php
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
<?php
/**
* Created by PhpStorm.
* User: Alerinos
* Date: 24.05.2019
* Time: 14:25
*/
$maps = [
'metin2_map_m1' => [6,6],
'metin2_map_m2' => [5,5],
'metin2_map_orcs' => [6,6],
'metin2_map_hwang' => [4,4],
'metin2_map_spider1' => [3,3],
'metin2_map_spider2' => [4,4],
'metin2_map_trent' => [2,2],
'metin2_map_trent2' => [4,4],
'metin2_map_skipia1' => [6,6],
'metin2_map_skipia2' => [6,6],
'metin2_map_desert' => [6,6],
'metin2_map_snow' => [6,6],
'metin2_map_flame' => [6,6],
'metin2_map_snake' => [4,4],
'metin2_map_fishing' => [4,4],
'metin2_map_admin' => [3,3],
'metin2_map_ox' => [2,2],
'metin2_map_guildwar' => [2,2],
'metin2_map_wedding' => [1,1],
'metin2_map_kingdonwar' => [2,2],
'metin2_map_monkey' => [3,3],
'metin2_map_giant' => [2,2],
];
$id = 1;
$atlas = [];
$base = [
'x' => [ 1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 6 => 0, 7 => 0, 8 => 0, 9 => 0, 10 => 0 ]
];
foreach ($maps as $r => $v) {
$x = $v[0];
$y = $v[1];
$map = $r;
$sy = 0;
for($i= $y; $i >1; $i--) $sy += $i - 1;
$sx = $base['x'][$y];
$base['x'][$y] += $x;
$atlas[] = [
'sx' => $x,
'sy' => $y,
'x' => $sx * 256 * 100,
'y' => $sy * 256 * 100,
'px' => $sx *256,
'py' => $sy *256,
'id' => $v[2],
'map' => $map,
'name' => str_replace('metin2_map_', '', $map),
];
$id ++;
}
if($_GET['type'] == 'preview'){
$canvas = imagecreatetruecolor(14080, 5376);
imagefill($canvas, 0, 0, imagecolorallocate($canvas, 30,30,30)); // Green);
$color = [
imagecolorallocate($canvas, 255, 105, 180), // Pink
imagecolorallocate($canvas, 255, 255, 255), // White
imagecolorallocate($canvas, 132, 135, 28), // Green
imagecolorallocate($canvas, 255, 0, 0), // Green
imagecolorallocate($canvas, 0, 255, 0), // Green
imagecolorallocate($canvas, 220,220,220), // Green
];
foreach ($atlas as $item){
$x = ($item['x'] / 100);
$y = ($item['y'] / 100);
$sx = ($x + ($item['sx'] * 256) -1);
$sy = ($y + ($item['sy'] * 256) -1);
imagerectangle($canvas, $x, $y, $sx, $sy, $color[rand(0,5)]);
}
header('Content-Type: image/jpeg');
imagejpeg($canvas);
imagedestroy($canvas);
exit; // remove
}
?>
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<title>Atlasinfo</title>
</head>
<body>
<div class="container">
<div class="row">
<div class="row">
<div class="col-md-4 col-xs-12">
<div class="d-flex">
<h3><i class="fas fa-atlas"></i> Atlas info</h3>
<a href="#" class="ml-auto"> <button onclick="location.href = '?type=preview';" class="btn btn-outline-dark"><i class="far fa-eye"></i> Podgląd</button></a>
</div>
<div class="form-group">
<label for="list">Położenie każdej mapy</label>
<textarea class="form-control" id="list" rows="10" readonly><?PHP foreach($atlas as $r){ echo $r['map'].' '.$r['x'].' '.$r['y'].' '.$r['sx'].' '.$r['sy'].' '; } ?></textarea>
</div>
</div>
<div class="col-md-4 col-xs-12">
<h3><i class="fas fa-book"></i> Index maps</h3>
<div class="form-group">
<label for="index">Lista wszystkch map</label>
<textarea class="form-control" id="index" rows="10" readonly><?PHP $i=1; foreach($atlas as $r){ echo $i.' '.$r['map'].' '; $i++;} ?></textarea>
</div>
</div>
<div class="col-md-4 col-xs-12">
<h3><i class="fas fa-book"></i> Index client</h3>
<div class="form-group">
<label for="index">Lista wszystkch map</label>
<textarea class="form-control" id="index" rows="10" readonly><?PHP foreach($atlas as $r){ echo 'pack/ '.$r['map'].' ';} ?></textarea>
</div>
</div>
<div class="col-12">
<div class="row">
<?PHP foreach($atlas as $r){ echo '
<div class="col-4">
<div class="form-group">
<label for="map-'.$r['name'].'">'.$r['map'].'</label>
<textarea class="form-control" id="map-'.$r['name'].'" rows="8" readonly>ScriptType MapSetting
CellScale 200
HeightScale 0.500000
ViewRadius 128
MapSize '.$r['sx'].' '.$r['sy'].'
BasePosition '.$r['x'].' '.$r['y'].'
TextureSet textureset\metin2_'.$r['name'].'.txt
Environment '.$r['name'].'.msenv</textarea>
</div>
</div>';} ?>
</div>
</div>
</div>
</div>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
</body>
</html>