Skip to content

Commit

Permalink
update for latest patch
Browse files Browse the repository at this point in the history
  • Loading branch information
antihax committed Dec 20, 2021
1 parent a7f5b1f commit 13eb0dd
Show file tree
Hide file tree
Showing 10 changed files with 85 additions and 27 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@
*.userosscache
*.sln.docstates

assets
atlasicons
server
steamcmd
json
steamcmd.zip
imgmgk
imgmgk.zip

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
Expand Down Expand Up @@ -69,7 +73,6 @@ StyleCopReport.xml
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
Expand Down
41 changes: 18 additions & 23 deletions DumpResources/DumpResources/DumpResources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,10 @@ std::string getIconName(UTexture2D* tex) {
return name.ToString();
}

void dumpCraftables() {
void dumpItems() {
nlohmann::json json;
json["Craftables"] = nullptr;
json["Foods"] = nullptr;
Log::GetLog()->info("Dump Craftables");
json = nullptr;
Log::GetLog()->info("Dump Items");

// Get all blueprint crafting requirements
TArray<UObject*> types;
Expand All @@ -137,21 +136,21 @@ void dumpCraftables() {
n->NameField().ToString(&className);
className = fixName(className);

json["Craftables"][name.ToString()]["ClassName"] = className.ToString();
json[name.ToString()]["ClassName"] = className.ToString();
if (n->ItemIconField())
json["Craftables"][name.ToString()]["Icon"] = getIconName(n->ItemIconField());
json[name.ToString()]["Icon"] = getIconName(n->ItemIconField());

if (n->UseItemAddCharacterStatusValuesField().Num()) {
json["Foods"][name.ToString()] = nullptr;
json[name.ToString()] = nullptr;
for (auto stat : n->UseItemAddCharacterStatusValuesField()) {
json["Foods"][name.ToString()]["stats"][statNames[stat.StatusValueType.GetValue()]] = {
json[name.ToString()]["stats"][statNames[stat.StatusValueType.GetValue()]] = {
{"add", stat.BaseAmountToAdd},
{"addOverTime", stat.bAddOverTime == 1 ? true : false},
{"addOverTimeSpeed", stat.AddOverTimeSpeed},
};
json["Foods"][name.ToString()]["SpoilTime"] = n->SpoilingTimeField();
json["Foods"][name.ToString()]["Weight"] = n->BaseItemWeightField() * n->BaseItemWeightMultiplierField();
json["Foods"][name.ToString()]["Type"] = n->ItemTypeCategoryStringField().ToString();
json[name.ToString()]["SpoilTime"] = n->SpoilingTimeField();
json[name.ToString()]["Weight"] = n->BaseItemWeightField() * n->BaseItemWeightMultiplierField();
json[name.ToString()]["Type"] = n->ItemTypeCategoryStringField().ToString();
}
}

Expand All @@ -162,14 +161,14 @@ void dumpCraftables() {
FString type;
pi->GetItemName(&type, false, true, NULL);
type = fixName(type);
json["Craftables"][name.ToString()]["Ingredients"][type.ToString()] = res.BaseResourceRequirement;
json[name.ToString()]["Ingredients"][type.ToString()] = res.BaseResourceRequirement;

}
}
}
}
std::filesystem::create_directory("resources");
std::ofstream file("resources/craftables.json");
std::ofstream file("resources/items.json");
file << std::setw(4) << json;
file.flush();
file.close();
Expand Down Expand Up @@ -364,8 +363,8 @@ void extract(float a2) {
nlohmann::json json;

Log::GetLog()->info("Server Grid {} ", ServerGrid());
// Save craftables.
dumpCraftables();
// Save Items.
dumpItems();
dumpStructures();
dumpLootTables();
dumpAnimals();
Expand Down Expand Up @@ -507,7 +506,7 @@ void extract(float a2) {
};
}

if (name.Contains("SunkenTreasureShip")) {
if (name.Contains("SunkenTreasure")) {
auto fsc = static_cast<ASupplyCrateSpawningVolume*> (actor);
fsc->BeginPlay(a2);
Log::GetLog()->info("Found Sunken Treasure Manager {}", name.ToString());
Expand Down Expand Up @@ -548,27 +547,24 @@ void extract(float a2) {
json["Boss"]["MeanWhale"] = nlohmann::json::array();
json["Boss"]["MeanWhale"].push_back({ gps.X, gps.Y });
}
else if (name.Contains("GentleWhale_SeaMonster")) {
if (name.Contains("GentleWhale_SeaMonster")) {
if (json["Boss"]["GentleWhale"].is_null())
json["Boss"]["GentleWhale"] = nlohmann::json::array();
json["Boss"]["GentleWhale"].push_back({ gps.X, gps.Y });
}
else if (name.Contains("Squid_Character")) {
if (name.Contains("Squid_Character")) {
if (json["Boss"]["GiantSquid"].is_null())
json["Boss"]["GiantSquid"] = nlohmann::json::array();
json["Boss"]["GiantSquid"].push_back({ gps.X, gps.Y });
}

count++;
}
}
continue;
}
else if (name.Contains("SnowCaveBossManager")) {
if (name.Contains("SnowCaveBossManager")) {
auto gps = ActorGPS(actor);
json["Boss"]["Yeti"] = nlohmann::json::array();
json["Boss"]["Yeti"].push_back({ gps.X, gps.Y });
continue;
}

// POWERSTONE AND ESSENCE
Expand All @@ -584,7 +580,6 @@ void extract(float a2) {
else {
json["Stones"]["Stone " + s.ToString()] = { gps.X, gps.Y };
}
continue;
}

// RESOURCE OVERRIDES
Expand Down
Binary file modified DumpResources/x64/Release/DumpResources.dll
Binary file not shown.
Binary file modified DumpResources/x64/Release/DumpResources.pdb
Binary file not shown.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ This must be ran on windows due to the inability to run plugins on Linux.
Run `prereq.bat` to install the server, plugins, and configuration.
Install your servergrid.json file to `DumpResources\server\ShooterGame`.

Run `build_json.js` and once all grids are processed the output will be in `./json`.
Run `node build_json.js` and once all grids are processed the output will be in `./json`.
22 changes: 22 additions & 0 deletions atlastools/include/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,33 @@ module.exports = {
return String.fromCharCode(65 + x) + (1 + y);
},

constraint: function (value, minVal, maxVal, minRange, maxRange) {
return (((value - minVal) / (maxVal - minVal)) * (maxRange - minRange));
},

parseJSONFile: function (file) {
const rawdata = fs.readFileSync(file);
return JSON.parse(rawdata);
},

/*
function GPStoLeaflet(x, y) {
var long = ((y - 100) * 0.3636363636363636) * 1.28 ,
lat = ((100 + x) * 0.3636363636363636) * 1.28 ;
return [long, lat];
}*/

translateGPS: function (c) {
let y = this.constraint(c[1], -450, -350, 0, 200) - 100,
x = this.constraint(c[0], -100, 150, 0, 200) - 100;


// console.log(x, y)

return [x, y];
},

sortObjByKey: function (value) {
return (typeof value === 'object') ?
(Array.isArray(value) ?
Expand Down
34 changes: 34 additions & 0 deletions build_assets.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const fs = require('fs');
const execSync = require('child_process').execSync;
const helpers = require('./atlastools/include/helpers.js')

const baseDir = "DumpResources/server/ShooterGame/"
const resourceDir = baseDir + "Binaries/Win64/resources/"
const imgmgk = "DumpResources/imgmgk/"
const workDir = process.cwd();

let items = helpers.parseJSONFile(resourceDir + "items.json");

for (item in items) {
let i = items[item];
if (i.Icon) {
console.log(i.Icon)
execSync(`start /min ${imgmgk}convert "assets/${i.Icon}.TGA" -thumbnail 128 -format png -define png:compression-filter=5 -auto-orient -define png:compression-level=9 -quality 82 -define png:compression-strategy=1 "atlasicons/${i.Icon}_128.png"`)
execSync(`start /min ${imgmgk}convert "assets/${i.Icon}.TGA" -thumbnail 64 -format png -define png:compression-filter=5 -auto-orient -define png:compression-level=9 -quality 82 -define png:compression-strategy=1 "atlasicons/${i.Icon}_64.png"`)
execSync(`start /min ${imgmgk}convert "assets/${i.Icon}.TGA" -thumbnail 32 -format png -define png:compression-filter=5 -auto-orient -define png:compression-level=9 -quality 82 -define png:compression-strategy=1 "atlasicons/${i.Icon}_32.png"`)
}
}

function sortObjByKey(value) {
return (typeof value === 'object') ?
(Array.isArray(value) ?
value.map(sortObjByKey) :
Object.keys(value).sort().reduce(
(o, key) => {
const v = value[key];
o[key] = sortObjByKey(v);
return o;
}, {})
) :
value;
}
2 changes: 1 addition & 1 deletion build_json.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ fs.writeFileSync('./json/config.js', "const config = " + JSON.stringify(sortObjB
}), null, "\t"));

fs.copyFileSync(resourceDir + "animals.json", './json/animals.json');
fs.copyFileSync(resourceDir + "craftables.json", './json/craftables.json');
fs.copyFileSync(resourceDir + "items.json", './json/items.json');
fs.copyFileSync(resourceDir + "structures.json", './json/structures.json');


Expand Down
4 changes: 4 additions & 0 deletions extraprereq.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
mkdir DumpResources\imgmgk
mkdir atlasicons
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://download.imagemagick.org/ImageMagick/download/binaries/ImageMagick-7.1.0-portable-Q16-x64.zip', 'DumpResources/imgmgk/imgmgk.zip')"
tar -xf DumpResources/imgmgk/imgmgk.zip -C DumpResources/imgmgk
2 changes: 1 addition & 1 deletion prereq.bat
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ copy DumpResources\DumpResources\configs\PdbConfig.json DumpResources\server\Sho
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://steamcdn-a.akamaihd.net/client/installer/steamcmd.zip', 'DumpResources\steamcmd/steamcmd.zip')"
tar -xf DumpResources\steamcmd/steamcmd.zip -C DumpResources\steamcmd

DumpResources\steamcmd\steamcmd.exe +login anonymous +force_install_dir ..\server +app_update 1006030 +quit
DumpResources\steamcmd\steamcmd.exe +force_install_dir ..\server +login anonymous +app_update 1006030 +quit

0 comments on commit 13eb0dd

Please sign in to comment.