Skip to content
Merged
Show file tree
Hide file tree
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,197 changes: 0 additions & 22,197 deletions darkspore_server/res/data/www/static/assets/js/angular.js

This file was deleted.

20 changes: 12 additions & 8 deletions darkspore_server/res/data/www/static/assets/js/eawebkit-jquery.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
// Polyfills

// Array.isArray
// Reference:
// https://github.com/inexorabletash/polyfill/blob/master/es5.js
Array.isArray = Array.isArray || function (o) { return Boolean(o && Object.prototype.toString.call(Object(o)) === '[object Array]'); };
//
// EAWebKit jQuery
//
// You may be wondering: why is there a custom jQuery for EAWebKit, instead of just using
// an old version of jQuery? Well, I will tell you. EAWebKit is so different in some ways
// that even older jQuery versions won't work properly in it.
//
// This jQuery implementation was made specifically to support EAWebKit, and nothing else.
//

var _typeOf = function(obj) {
var val = Object.prototype.toString.call(obj); // eg. '[object String]'
Expand Down Expand Up @@ -110,8 +113,9 @@ var $ = function(domId) {
if (this._dom.length == 0) return null;
return this._dom[0][attrName];
}
// TODO: It seems like this isn't working
return this.forEach(function(dom){dom[attrName] = attrValue});
// TODO: setAttribute does exist in browsers older than IE9, but with
// some inconsistent behaviors. It may need a polyfill on EAWebKit
return this.forEach(function(dom){dom.setAttribute(attrName, attrValue)});
};
obj.removeAttr = function(attrName) {
return this.forEach(function(dom){dom.removeAttribute(attrName)});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Polyfills should only be loaded for the EAWebKit
if (typeof Client !== 'undefined')
{
// Array.isArray
// Reference:
// https://github.com/inexorabletash/polyfill/blob/master/es5.js
Array.isArray = function (o) { return Boolean(o && Object.prototype.toString.call(Object(o)) === '[object Array]'); };
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<link rel="stylesheet" type="text/css" href="/assets/css/dstitlebar.css">
<script src="/assets/js/json2.js"></script>
<script src="/assets/js/eawebkit.js"></script>
<script src="/assets/js/eawebkit-polyfills.js"></script>
<script src="/assets/js/eawebkit-jquery.js"></script>
<script src="/assets/js/recapclient.js"></script>
<link rel="stylesheet" type="text/css" href="style.css">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<title>Darkspore Registration</title>
<script type="text/javascript" src="/assets/js/json2.js"></script>
<script type="text/javascript" src="/assets/js/eawebkit.js"></script>
<script type="text/javascript" src="/assets/js/eawebkit-polyfills.js"></script>
<script type="text/javascript" src="/assets/js/eawebkit-jquery.js"></script>
<script type="text/javascript" src="/assets/js/recapclient.js"></script>
<link rel="stylesheet" type="text/css" href="/assets/css/dsfonts.css">
Expand Down
17 changes: 15 additions & 2 deletions darkspore_server/source/game/luafunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1207,8 +1207,21 @@ namespace Game {
if (auto catalog = document.child("catalog")) {
for (const auto& entry : catalog.child("entry")) {
auto asset = utils::xml_get_text_node(entry, "asset");
auto sourceFile = utils::xml_get_text_node(entry, "source_file");
mAssets.insert(std::make_pair(asset, sourceFile));
auto sourceFilePath = utils::xml_get_text_node(entry, "source_file");
std::vector<std::string> sourceFilePathComps = utils::explode_string(sourceFilePath, ".");

if (sourceFilePathComps.size() == 2) {
std::string folderName = utils::string_tolower(sourceFilePathComps[1]);
std::string sourceFileFullPath = "data/serverdata/" + folderName + "/" + sourceFilePath + ".xml";
if (std::filesystem::exists(sourceFileFullPath)) {
std::string sourceFile = utils::get_file_text(sourceFileFullPath);
mAssets.insert(std::make_pair(asset, sourceFile));
}
else
{
std::cout << "Asset " << sourceFilePath << " not found inside serverdata folder" << std::endl;
}
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions darkspore_server/source/installer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void Installer::LoadDarksporeData(std::string darksporeInstallPath, std::string

// Step 3: Parse binary assets
std::cout << "Parsing binary assets from AssetData_Binary..." << std::endl;
RunCommand(recap_parser + " --game-version " + darksporeInstallVersion + " --recursive --sort-ext --xml -o data\\serverdata AssetData_Binary");
RunCommand(recap_parser + " --recursive --silent --sort-ext --xml -o data\\serverdata AssetData_Binary");
#else
std::string dbpf_unpacker = "./dbpf_unpacker";
std::string unluac = "./unluac";
Expand Down Expand Up @@ -80,7 +80,7 @@ void Installer::LoadDarksporeData(std::string darksporeInstallPath, std::string
// Step 3: Parse binary assets
label = "Parsing binary assets from AssetData_Binary...";
std::cout << "Parsing binary assets from AssetData_Binary..." << std::endl;
RunCommand(recap_parser + " --game-version " + darksporeInstallVersion + " --recursive --silent --sort-ext --xml -o ./data/serverdata ./AssetData_Binary");
RunCommand(recap_parser + " --recursive --silent --sort-ext --xml -o ./data/serverdata ./AssetData_Binary");
#endif

// Step 4: Cleanup intermediate directories
Expand Down
8 changes: 8 additions & 0 deletions darkspore_server/source/utils/functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <filesystem>
#include <fstream>
#include <array>
#include <cctype>

// utils
namespace utils {
Expand Down Expand Up @@ -62,6 +63,13 @@ namespace utils {
return string_iequals(std::string_view(lhs), std::string_view(rhs));
}

std::string string_tolower(std::string_view str) {
std::string result(str);
std::transform(result.begin(), result.end(), result.begin(),
[](unsigned char c) { return std::tolower(c); });
return result;
}

void string_replace(std::string& str, const std::string& old_str, const std::string& new_str) {
auto position = str.find(old_str);
if (position != std::string::npos) {
Expand Down
2 changes: 2 additions & 0 deletions darkspore_server/source/utils/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ namespace utils {
bool string_iequals(std::string_view lhs, std::string_view rhs);
bool string_iequals(const char* lhs, const char* rhs);

std::string string_tolower(std::string_view str);

void string_replace(std::string& str, const std::string& old_str, const std::string& new_str);

std::vector<std::string> explode_string(const std::string& str, char delim, int32_t limit = -1);
Expand Down
Loading