mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-29 20:30:54 +00:00
Add sheets packer tool for shard MS and IOS
This commit is contained in:
parent
a6a72fd622
commit
accafc4192
6 changed files with 214 additions and 55 deletions
|
@ -246,60 +246,6 @@ void CStringManager::clearCache(NLMISC::CLog *log)
|
|||
|
||||
|
||||
|
||||
// load the values using the george sheet
|
||||
void CStringManager::TSheetInfo::readGeorges (const NLMISC::CSmartPtr<NLGEORGES::UForm> &form, const NLMISC::CSheetId &sheetId)
|
||||
{
|
||||
if (form)
|
||||
{
|
||||
SheetName = sheetId.toString();
|
||||
|
||||
std::string ext = NLMISC::CSheetId::fileExtensionFromType(sheetId.getSheetType());
|
||||
|
||||
SheetName = SheetName.substr(0, SheetName.find(ext));
|
||||
// remove ending '.'
|
||||
if (!SheetName.empty() && *SheetName.rbegin() == '.')
|
||||
SheetName.resize(SheetName.size()-1);
|
||||
|
||||
std::string gender;
|
||||
|
||||
if (sheetId.getSheetType() == NLMISC::CSheetId::typeFromFileExtension("creature"))
|
||||
{
|
||||
form->getRootNode ().getValueByName (gender, "Basics.Gender");
|
||||
sint genderId;
|
||||
NLMISC::fromString(gender, genderId);
|
||||
Gender = GSGENDER::EGender(genderId);
|
||||
|
||||
form->getRootNode ().getValueByName (Race, "Basics.Race");
|
||||
|
||||
// form->getRootNode ().getValueByName (DisplayName, "Basics.First Name");
|
||||
// std::string s;
|
||||
// form->getRootNode ().getValueByName (s, "Basics.CharacterName");
|
||||
// if (!DisplayName.empty())
|
||||
// DisplayName+=' ';
|
||||
// DisplayName+=s;
|
||||
|
||||
form->getRootNode ().getValueByName (Profile, "Basics.Profile");
|
||||
form->getRootNode ().getValueByName (ChatProfile, "Basics.ChatProfile");
|
||||
}
|
||||
else if (sheetId.getSheetType() == NLMISC::CSheetId::typeFromFileExtension("race_stats"))
|
||||
{
|
||||
form->getRootNode ().getValueByName (Race, "Race");
|
||||
}
|
||||
/* else if (sheetId.getType() == NLMISC::CSheetId::typeFromFileExtension("sitem"))
|
||||
{
|
||||
// read any item specific data
|
||||
}
|
||||
*/ else
|
||||
{
|
||||
nlwarning("CStringManager::TEntityInfo : Do not know the type of the sheet '%s'.", sheetId.toString().c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const CStringManager::CEntityWords &CStringManager::getEntityWords(TLanguages lang, STRING_MANAGER::TParamType type) const
|
||||
{
|
||||
nlassert(lang < NB_LANGUAGES);
|
||||
|
|
|
@ -1864,7 +1864,7 @@ void CStringManager::init(NLMISC::CLog *log)
|
|||
|
||||
if (_SheetInfo.empty())
|
||||
{
|
||||
std::map<std::string, TSheetInfo> container;
|
||||
// std::map<std::string, TSheetInfo> container;
|
||||
// Load the sheet
|
||||
std::vector<std::string> exts;
|
||||
exts.push_back("creature");
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "stdpch.h"
|
||||
#include "string_manager.h"
|
||||
#include "nel/misc/i18n.h"
|
||||
#include "nel/misc/path.h"
|
||||
#include "nel/misc/file.h"
|
||||
#include "nel/georges/u_form_elm.h"
|
||||
#include "nel/georges/load_form.h"
|
||||
#include <time.h>
|
||||
|
||||
// load the values using the george sheet
|
||||
void CStringManager::TSheetInfo::readGeorges (const NLMISC::CSmartPtr<NLGEORGES::UForm> &form, const NLMISC::CSheetId &sheetId)
|
||||
{
|
||||
if (form)
|
||||
{
|
||||
SheetName = sheetId.toString();
|
||||
|
||||
std::string ext = NLMISC::CSheetId::fileExtensionFromType(sheetId.getSheetType());
|
||||
|
||||
SheetName = SheetName.substr(0, SheetName.find(ext));
|
||||
// remove ending '.'
|
||||
if (!SheetName.empty() && *SheetName.rbegin() == '.')
|
||||
SheetName.resize(SheetName.size()-1);
|
||||
|
||||
std::string gender;
|
||||
|
||||
if (sheetId.getSheetType() == NLMISC::CSheetId::typeFromFileExtension("creature"))
|
||||
{
|
||||
form->getRootNode ().getValueByName (gender, "Basics.Gender");
|
||||
sint genderId;
|
||||
NLMISC::fromString(gender, genderId);
|
||||
Gender = GSGENDER::EGender(genderId);
|
||||
|
||||
form->getRootNode ().getValueByName (Race, "Basics.Race");
|
||||
|
||||
// form->getRootNode ().getValueByName (DisplayName, "Basics.First Name");
|
||||
// std::string s;
|
||||
// form->getRootNode ().getValueByName (s, "Basics.CharacterName");
|
||||
// if (!DisplayName.empty())
|
||||
// DisplayName+=' ';
|
||||
// DisplayName+=s;
|
||||
|
||||
form->getRootNode ().getValueByName (Profile, "Basics.Profile");
|
||||
form->getRootNode ().getValueByName (ChatProfile, "Basics.ChatProfile");
|
||||
}
|
||||
else if (sheetId.getSheetType() == NLMISC::CSheetId::typeFromFileExtension("race_stats"))
|
||||
{
|
||||
form->getRootNode ().getValueByName (Race, "Race");
|
||||
}
|
||||
/* else if (sheetId.getType() == NLMISC::CSheetId::typeFromFileExtension("sitem"))
|
||||
{
|
||||
// read any item specific data
|
||||
}
|
||||
*/ else
|
||||
{
|
||||
nlwarning("CStringManager::TEntityInfo : Do not know the type of the sheet '%s'.", sheetId.toString().c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,6 +14,7 @@ IF(WITH_NET)
|
|||
ADD_SUBDIRECTORY(stats_scan)
|
||||
ADD_SUBDIRECTORY(pdr_util)
|
||||
ADD_SUBDIRECTORY(patch_gen)
|
||||
ADD_SUBDIRECTORY(sheets_packer_shard)
|
||||
ENDIF(WITH_NET)
|
||||
|
||||
IF(WITH_LIGO AND WITH_NET)
|
||||
|
|
21
code/ryzom/tools/sheets_packer_shard/CMakeLists.txt
Normal file
21
code/ryzom/tools/sheets_packer_shard/CMakeLists.txt
Normal file
|
@ -0,0 +1,21 @@
|
|||
FILE(GLOB SRC *.cpp *.h)
|
||||
|
||||
ADD_EXECUTABLE(sheets_packer_shard ${SRC}
|
||||
${CMAKE_SOURCE_DIR}/ryzom/server/src/input_output_service/string_manager_sheet.cpp
|
||||
${CMAKE_SOURCE_DIR}/ryzom/server/src/input_output_service/string_manager.h)
|
||||
|
||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/ryzom/common/src ${CMAKE_SOURCE_DIR}/ryzom/server/src)
|
||||
TARGET_LINK_LIBRARIES(sheets_packer_shard
|
||||
ryzom_gameshare
|
||||
nelmisc
|
||||
nelgeorges
|
||||
nelnet
|
||||
nelligo
|
||||
${LIBXML2_LIBRARIES})
|
||||
|
||||
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS})
|
||||
|
||||
NL_DEFAULT_PROPS(sheets_packer_shard "Ryzom, Tools: Sheets Packer Shard")
|
||||
NL_ADD_RUNTIME_FLAGS(sheets_packer_shard)
|
||||
|
||||
INSTALL(TARGETS sheets_packer_shard RUNTIME DESTINATION ${RYZOM_BIN_PREFIX} COMPONENT tools)
|
116
code/ryzom/tools/sheets_packer_shard/sheets_packer_shard.cpp
Normal file
116
code/ryzom/tools/sheets_packer_shard/sheets_packer_shard.cpp
Normal file
|
@ -0,0 +1,116 @@
|
|||
// NeL - MMORPG Framework <http://www.ryzomcore.org/>
|
||||
// Copyright (C) 2014 by authors
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// Author: Jan Boon
|
||||
|
||||
#include <nel/misc/types_nl.h>
|
||||
|
||||
// STL includes
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
// NeL includes
|
||||
#include <nel/misc/common.h>
|
||||
#include <nel/misc/file.h>
|
||||
#include <nel/misc/log.h>
|
||||
#include <nel/misc/path.h>
|
||||
#include <nel/georges/load_form.h>
|
||||
#include <game_share/data_set_base.h>
|
||||
#include <input_output_service/string_manager.h>
|
||||
|
||||
// Project includes
|
||||
// ...
|
||||
|
||||
namespace {
|
||||
|
||||
} /* anonymous namespace */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// note: *.packed_sheets files are placed in <build_packed_sheets> //
|
||||
// and will need to be moved to the right location by //
|
||||
// your build script system. //
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int main(int nNbArg, char **ppArgs)
|
||||
{
|
||||
// create debug stuff
|
||||
NLMISC::createDebug();
|
||||
|
||||
// verify all params
|
||||
if (nNbArg < 5)
|
||||
{
|
||||
nlinfo("ERROR : Wrong number of arguments\n");
|
||||
nlinfo("USAGE : sheets_packer_shard <leveldesign> <dfn> <datasets> <build_packed_sheets>\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
std::string leveldesignDir = std::string(ppArgs[1]);
|
||||
if (!NLMISC::CFile::isDirectory(leveldesignDir))
|
||||
{
|
||||
nlerrornoex("Directory leveldesign '%s' does not exist", leveldesignDir.c_str());
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
std::string dfnDir = std::string(ppArgs[2]);
|
||||
if (!NLMISC::CFile::isDirectory(dfnDir))
|
||||
{
|
||||
nlerrornoex("Directory dfn '%s' does not exist", dfnDir.c_str());
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
std::string datasetsDir = std::string(ppArgs[3]);
|
||||
if (!NLMISC::CFile::isDirectory(datasetsDir))
|
||||
{
|
||||
nlerrornoex("Directory datasets '%s' does not exist", datasetsDir.c_str());
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
std::string exportDir = std::string(ppArgs[4]);
|
||||
if (!NLMISC::CFile::isDirectory(exportDir))
|
||||
{
|
||||
nlerrornoex("Directory build_packed_sheets '%s' does not exist", exportDir.c_str());
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// add search paths
|
||||
NLMISC::CPath::addSearchPath(leveldesignDir, true, false);
|
||||
NLMISC::CPath::addSearchPath(dfnDir, true, false);
|
||||
NLMISC::CPath::addSearchPath(datasetsDir, true, false);
|
||||
|
||||
// this here does the magic
|
||||
// MS
|
||||
{
|
||||
// Used by mirror_service.cpp
|
||||
// Used by range_mirror_manager.cpp
|
||||
// Used by mirror.cpp
|
||||
TSDataSetSheets sDataSetSheets;
|
||||
loadForm("dataset", exportDir + "/datasets.packed_sheets", sDataSetSheets);
|
||||
}
|
||||
|
||||
// IOS
|
||||
{
|
||||
// Used by string_manager_parcer.cpp
|
||||
std::map<NLMISC::CSheetId, CStringManager::TSheetInfo> container;
|
||||
std::vector<std::string> exts;
|
||||
exts.push_back("creature");
|
||||
exts.push_back("race_stats");
|
||||
loadForm(exts, exportDir + "/ios_sheets.packed_sheets", container);
|
||||
}
|
||||
|
||||
// and that's all folks
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/* end of file */
|
Loading…
Reference in a new issue