Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions items_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ using json = nlohmann::json;

int main()
{
json jdata;
std::ifstream file("items.dat", std::ios::binary | std::ios::ate);
int size = file.tellg();
char* data = new char[size];
Expand All @@ -44,8 +43,7 @@ int main()
memPos += 2;
memcpy(&itemCount, data + memPos, 4);
memPos += 4;
jdata["itemsdatVersion"] = itemsdatVersion;
jdata["itemCount"] = itemCount;
cout << "Itemcount: " << itemCount << "\nitemsdatVersion: " << itemsdatVersion << endl;
for (int i=0;i<itemCount;i++) {
json j;
int itemID = 0;
Expand Down Expand Up @@ -305,14 +303,26 @@ int main()
j["extraOptions2"] = extraOptions2;
j["punchOptions"] = punchOptions;
jdata["items"].push_back(j);
ofstream items;
items.open("items/" + to_string(itemID) + ".json");
items << j << endl;
items.close();
}
std::ofstream o("data.json");
o << std::setw(4) << jdata << std::endl;
cout << "Succesfully decoded" << endl;
#ifndef __linux__
_getch();
#endif
return 0;
string answ;
cout << "Do you want to delete all items from folder? (Y/N) : ";
getline(cin, answ);
if (answ == "Y")
{
for (int i = 0; i < itemCount; i++)
remove(("items/" + to_string(i) + ".json").c_str());
}
else {
return 0;
}
}