-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmodlist.php
59 lines (55 loc) · 2.09 KB
/
modlist.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
<html>
<head>
<link rel="stylesheet" type="text/css" href="main.css">
</head>
<body>
<div>
<?php
$input = $_POST["link"];
$option = $_POST["option"];
$file = file_get_contents($input);
$muster = '<a href="https:\/\/steamcommunity.com\/sharedfiles\/filedetails\/\?id=([0-9]+)">';
preg_match_all($muster, $file, $match);
$arr = array_unique(array_values($match[1]));
sort($arr);
if ($option == "list") {
echo "<h1>Below are your mod IDs in " . $option . " format</h1>";
echo '<button onclick="copyToClipboard()">Copy to Clipboard</button></br>';
echo '<textarea style="width:100%" id="mods" name="mods" rows=50>';
foreach($arr as $val) {
echo $val . " ";
}
echo "</textarea>";
}
else
{
echo "<h1>Below are the mods in " . $option . " format.</h1>";
echo '<h2>Modifying Your Sandbox_config.sbc</h2>';
echo "<p>Once you've verified your server is stopped, it's now safe to open the Sandbox_config.sbc file with a text editor. There will be a lot of text here, so just hit Ctrl+F to open up the search function of your editor. Search for 'mods'. It should bring you to a line of code that looks like this:</p>";
echo "<p><code><Mods /></code></p>";
echo "<p>The first step is to open up this element so you can add a list of mods to it. To do that, replace <Mods /> with:</p>";
echo "<p><code><Mods></code><br><code></Mods></code></p>";
echo "<p>Between these two elements, you can now add information you copy below.</p>";
echo '<button onclick="copyToClipboard()">Copy to Clipboard</button></br>';
echo '<textarea style="width:100%" id="mods" name="mods" rows=50>';
foreach($arr as $val) {
echo "<ModItem> ";
echo "<Name>" . $val . ".sbm</Name> ";
echo "<PublishedFileId>" . $val . "</PublishedFileId> ";
echo "</ModItem> ";
}
echo "</textarea>";
}
?>
</div>
<script>
function copyToClipboard() {
var copyText = document.getElementById("mods");
copyText.select();
copyText.setSelectionRange(0, 99999)
document.execCommand("copy");
alert("Copied the text to the clipboard.");
}
</script>
</body>
</html>