From 36c2ff5b866a511a203bb9ceaa351184ed5d1e6f Mon Sep 17 00:00:00 2001 From: Nuno Date: Wed, 20 Oct 2021 13:31:14 +0200 Subject: [PATCH] Remove files in code --- code/nel/tools/build_gamedata/0_setup.py | 594 ---- .../nel/tools/build_gamedata/b1_client_dev.py | 108 - .../tools/build_gamedata/c1_shard_patch.py | 123 - .../build_gamedata/configuration/scripts.py | 610 ---- .../build_gamedata/configuration/tools.py | 102 - .../tools/build_gamedata/d1_client_patch.py | 181 - .../processes/ai_wmap/2_build.py | 97 - .../processes/cartographer/0_setup.py | 120 - .../build_gamedata/processes/font/1_export.py | 63 - .../processes/font/3_install.py | 62 - .../build_gamedata/processes/ig/2_build.py | 275 -- .../build_gamedata/processes/ligo/0_setup.py | 121 - .../build_gamedata/processes/rbank/2_build.py | 339 -- .../build_gamedata/processes/shape/2_build.py | 198 -- .../build_gamedata/processes/zone/2_build.py | 175 - .../processes/zone_light/2_build.py | 105 - .../translation/make_merge_all.py | 70 - .../translation/make_merge_wk.py | 115 - .../src/interface_v3/bot_chat_page_trade.cpp | 3072 ----------------- 19 files changed, 6530 deletions(-) delete mode 100644 code/nel/tools/build_gamedata/0_setup.py delete mode 100644 code/nel/tools/build_gamedata/b1_client_dev.py delete mode 100644 code/nel/tools/build_gamedata/c1_shard_patch.py delete mode 100644 code/nel/tools/build_gamedata/configuration/scripts.py delete mode 100644 code/nel/tools/build_gamedata/configuration/tools.py delete mode 100644 code/nel/tools/build_gamedata/d1_client_patch.py delete mode 100644 code/nel/tools/build_gamedata/processes/ai_wmap/2_build.py delete mode 100644 code/nel/tools/build_gamedata/processes/cartographer/0_setup.py delete mode 100644 code/nel/tools/build_gamedata/processes/font/1_export.py delete mode 100644 code/nel/tools/build_gamedata/processes/font/3_install.py delete mode 100644 code/nel/tools/build_gamedata/processes/ig/2_build.py delete mode 100644 code/nel/tools/build_gamedata/processes/ligo/0_setup.py delete mode 100644 code/nel/tools/build_gamedata/processes/rbank/2_build.py delete mode 100644 code/nel/tools/build_gamedata/processes/shape/2_build.py delete mode 100644 code/nel/tools/build_gamedata/processes/zone/2_build.py delete mode 100644 code/nel/tools/build_gamedata/processes/zone_light/2_build.py delete mode 100644 code/nel/tools/build_gamedata/translation/make_merge_all.py delete mode 100644 code/nel/tools/build_gamedata/translation/make_merge_wk.py delete mode 100644 code/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp diff --git a/code/nel/tools/build_gamedata/0_setup.py b/code/nel/tools/build_gamedata/0_setup.py deleted file mode 100644 index 12441fb05..000000000 --- a/code/nel/tools/build_gamedata/0_setup.py +++ /dev/null @@ -1,594 +0,0 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief Run all setup processes -# \date 2009-02-18 15:28GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Run all setup processes -# -# NeL - MMORPG Framework -# Copyright (C) 2009-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 . -# - -import time, sys, os, shutil, subprocess, distutils.dir_util, argparse -sys.path.append("configuration") - -parser = argparse.ArgumentParser(description='Ryzom Core - Build Gamedata - Setup') -parser.add_argument('--noconf', '-nc', action='store_true') -parser.add_argument('--noverify', '-nv', action='store_true') -parser.add_argument('--preset', '-p', action='store_true') -# parser.add_argument('--haltonerror', '-eh', action='store_true') -parser.add_argument('--includeproject', '-ipj', nargs='+') -parser.add_argument('--excludeproject', '-epj', nargs='+') -parser.add_argument('--includeprocess', '-ipc', nargs='+') -parser.add_argument('--excludeprocess', '-epc', nargs='+') -args = parser.parse_args() - -if not args.includeproject == None and not args.excludeproject == None: - print "ERROR --includeproject cannot be combined with --excludeproject, exit." - exit() - -if not args.includeprocess == None and not args.excludeprocess == None: - print "ERROR --includeprocess cannot be combined with --excludeprocess, exit." - exit() - -if os.path.isfile("log.log"): - os.remove("log.log") -log = open("log.log", "w") -from scripts import * -try: - from buildsite import * -except ImportError: - printLog(log, "*** FIRST RUN ***") - if args.noconf: - printLog(log, "ERROR --noconf is invalid on first run, exit.") - exit() -from tools import * - -if not args.noconf: - try: - BuildQuality - except NameError: - BuildQuality = 1 - try: - if args.preset: - DummyUnknownName - RemapLocalFrom - except NameError: - RemapLocalFrom = 'R:' - try: - if args.preset: - DummyUnknownName - RemapLocalTo - except NameError: - RemapLocalTo = os.getenv('RC_ROOT').replace('\\', '/') - if (not RemapLocalTo) or (not ':' in RemapLocalTo): - RemapLocalTo = 'R:' - try: - if args.preset: - DummyUnknownName - ToolDirectories - except NameError: - ToolDirectories = [ 'R:/distribution/nel_tools_win_x64', 'R:/distribution/ryzom_tools_win_x64' ] - try: - ToolSuffix - except NameError: - ToolSuffix = ".exe" - try: - if args.preset: - DummyUnknownName - ScriptDirectory - except NameError: - ScriptDirectory = "R:/code/nel/tools/build_gamedata" - try: - if args.preset: - DummyUnknownName - WorkspaceDirectory - except NameError: - WorkspaceDirectory = "R:/leveldesign/workspace" - try: - if args.preset: - DummyUnknownName - DatabaseDirectory - except NameError: - DatabaseDirectory = "R:/graphics" - try: - if args.preset: - DummyUnknownName - SoundDirectory - except NameError: - SoundDirectory = "R:/sound" - try: - if args.preset: - DummyUnknownName - SoundDfnDirectory - except NameError: - SoundDfnDirectory = "R:/sound/DFN" - try: - if args.preset: - DummyUnknownName - ExportBuildDirectory - except NameError: - ExportBuildDirectory = "R:/pipeline/export" - try: - if args.preset: - DummyUnknownName - InstallDirectory - except NameError: - InstallDirectory = "R:/pipeline/install" - try: - if args.preset: - DummyUnknownName - ClientDevDirectory - except NameError: - ClientDevDirectory = "R:/pipeline/client_dev" - try: - if args.preset: - DummyUnknownName - ClientDevLiveDirectory - except NameError: - ClientDevLiveDirectory = "R:/pipeline/client_dev_live" - try: - if args.preset: - DummyUnknownName - ClientPatchDirectory - except NameError: - ClientPatchDirectory = "R:/pipeline/client_patch" - try: - if args.preset: - DummyUnknownName - ClientInstallDirectory - except NameError: - ClientInstallDirectory = "R:/pipeline/client_install" - try: - if args.preset: - DummyUnknownName - ShardInstallDirectory - except NameError: - ShardInstallDirectory = "R:/pipeline/shard" - try: - if args.preset: - DummyUnknownName - ShardDevDirectory - except NameError: - ShardDevDirectory = "R:/pipeline/shard_dev" - try: - if args.preset: - DummyUnknownName - WorldEditInstallDirectory - except NameError: - WorldEditInstallDirectory = "R:/pipeline/worldedit" - try: - if args.preset: - DummyUnknownName - WorldEditorFilesDirectory - except NameError: - WorldEditorFilesDirectory = "R:/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files" - try: - if args.preset: - DummyUnknownName - LeveldesignDirectory - except NameError: - LeveldesignDirectory = "R:/leveldesign" - try: - if args.preset: - DummyUnknownName - LeveldesignDfnDirectory - except NameError: - LeveldesignDfnDirectory = "R:/leveldesign/DFN" - try: - if args.preset: - DummyUnknownName - LeveldesignWorldDirectory - except NameError: - LeveldesignWorldDirectory = "R:/leveldesign/world" - try: - if args.preset: - DummyUnknownName - PrimitivesDirectory - except NameError: - PrimitivesDirectory = "R:/leveldesign/primitives" - try: - if args.preset: - DummyUnknownName - LeveldesignDataCommonDirectory - except NameError: - LeveldesignDataCommonDirectory = "R:/leveldesign/common" - try: - if args.preset: - DummyUnknownName - LeveldesignDataShardDirectory - except NameError: - LeveldesignDataShardDirectory = "R:/leveldesign/shard" - try: - if args.preset: - DummyUnknownName - TranslationDirectory - except NameError: - TranslationDirectory = "R:/leveldesign/translation" - try: - if args.preset: - DummyUnknownName - GamedevDirectory - except NameError: - GamedevDirectory = "R:/code/ryzom/client/data/gamedev" - try: - if args.preset: - DummyUnknownName - DataCommonDirectory - except NameError: - DataCommonDirectory = "R:/code/ryzom/common/data_common" - try: - if args.preset: - DummyUnknownName - DataShardDirectory - except NameError: - DataShardDirectory = "R:/code/ryzom/server/data_shard" - try: - if args.preset: - DummyUnknownName - WindowsExeDllCfgDirectories - except NameError: - # TODO: Separate 64bit and 32bit - WindowsExeDllCfgDirectories = [ '', 'R:/build/fv_x64/bin/Release', 'R:/distribution/external_x64', 'R:/code/ryzom/client', '', '', '' ] - try: - if args.preset: - DummyUnknownName - LinuxServiceExecutableDirectory - except NameError: - LinuxServiceExecutableDirectory = "R:/build/server_gcc/bin" - try: - if args.preset: - DummyUnknownName - LinuxClientExecutableDirectory - except NameError: - LinuxClientExecutableDirectory = "R:/build/client_gcc/bin" - try: - if args.preset: - DummyUnknownName - PatchmanDevDirectory - except NameError: - PatchmanDevDirectory = "R:/patchman/terminal_dev" - try: - if args.preset: - DummyUnknownName - PatchmanCfgAdminDirectory - except NameError: - PatchmanCfgAdminDirectory = "R:/patchman/admin_install" - try: - if args.preset: - DummyUnknownName - PatchmanCfgDefaultDirectory - except NameError: - PatchmanCfgDefaultDirectory = "R:/patchman/default" - try: - if args.preset: - DummyUnknownName - PatchmanBridgeServerDirectory - except NameError: - PatchmanBridgeServerDirectory = "R:/pipeline/bridge_server" - try: - SignToolExecutable - except NameError: - SignToolExecutable = "C:/Program Files/Microsoft SDKs/Windows/v6.0A/Bin/signtool.exe" - try: - SignToolSha1 - except NameError: - SignToolSha1 = "" - try: - SignToolTimestamp - except NameError: - SignToolTimestamp = "http://timestamp.comodoca.com/authenticode" - try: - MaxAvailable - except NameError: - MaxAvailable = 1 - try: - MaxDirectory - except NameError: - MaxDirectory = "C:/Program Files (x86)/Autodesk/3ds Max 2010" - try: - MaxUserDirectory - except NameError: - import os - try: - MaxUserDirectory = os.path.normpath(os.environ["LOCALAPPDATA"] + "/Autodesk/3dsMax/2010 - 32bit/enu") - except KeyError: - MaxAvailable = 0 - MaxUserDirectory = "C:/Users/Kaetemi/AppData/Local/Autodesk/3dsMax/2010 - 32bit/enu" - try: - MaxExecutable - except NameError: - MaxExecutable = "3dsmax.exe" - - printLog(log, "") - printLog(log, "-------") - printLog(log, "--- Setup build site") - printLog(log, "-------") - printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) - printLog(log, "") - printLog(log, "This script will set up the buildsite configuration, and create needed directories.") - printLog(log, "To use the defaults, simply hit ENTER, else type in the new value.") - printLog(log, "Use -- if you need to insert an empty value.") - printLog(log, "") - BuildQuality = int(askVar(log, "Build Quality", str(BuildQuality))) - if not args.preset: - ToolDirectories[0] = askVar(log, "[IN] Primary Tool Directory", ToolDirectories[0]).replace("\\", "/") - ToolDirectories[1] = askVar(log, "[IN] Secondary Tool Directory", ToolDirectories[1]).replace("\\", "/") - ToolSuffix = askVar(log, "Tool Suffix", ToolSuffix) - ScriptDirectory = askVar(log, "[IN] Script Directory", os.getcwd().replace("\\", "/")).replace("\\", "/") - WorkspaceDirectory = askVar(log, "[IN] Workspace Directory", WorkspaceDirectory).replace("\\", "/") - DatabaseDirectory = askVar(log, "[IN] Database Directory", DatabaseDirectory).replace("\\", "/") - SoundDirectory = askVar(log, "[IN] Sound Directory", SoundDirectory).replace("\\", "/") - SoundDfnDirectory = askVar(log, "[IN] Sound DFN Directory", SoundDfnDirectory).replace("\\", "/") - ExportBuildDirectory = askVar(log, "[OUT] Export Build Directory", ExportBuildDirectory).replace("\\", "/") - InstallDirectory = askVar(log, "[OUT] Install Directory", InstallDirectory).replace("\\", "/") - ClientDevDirectory = askVar(log, "[OUT] Client Dev Directory", ClientDevDirectory).replace("\\", "/") - ClientDevLiveDirectory = askVar(log, "[OUT] Client Dev Live Directory", ClientDevLiveDirectory).replace("\\", "/") - ClientPatchDirectory = askVar(log, "[OUT] Client Patch Directory", ClientPatchDirectory).replace("\\", "/") - ClientInstallDirectory = askVar(log, "[OUT] Client Install Directory", ClientInstallDirectory).replace("\\", "/") - ShardInstallDirectory = askVar(log, "[OUT] Shard Data Install Directory", ShardInstallDirectory).replace("\\", "/") - ShardDevDirectory = askVar(log, "[OUT] Shard Dev Directory", ShardDevDirectory).replace("\\", "/") - WorldEditInstallDirectory = askVar(log, "[OUT] World Edit Data Install Directory", WorldEditInstallDirectory).replace("\\", "/") - LeveldesignDirectory = askVar(log, "[IN] Leveldesign Directory", LeveldesignDirectory).replace("\\", "/") - LeveldesignDfnDirectory = askVar(log, "[IN] Leveldesign DFN Directory", LeveldesignDfnDirectory).replace("\\", "/") - LeveldesignWorldDirectory = askVar(log, "[IN] Leveldesign World Directory", LeveldesignWorldDirectory).replace("\\", "/") - PrimitivesDirectory = askVar(log, "[IN] Primitives Directory", PrimitivesDirectory).replace("\\", "/") - GamedevDirectory = askVar(log, "[IN] Gamedev Directory", GamedevDirectory).replace("\\", "/") - DataShardDirectory = askVar(log, "[IN] Data Shard Directory", DataShardDirectory).replace("\\", "/") - DataCommonDirectory = askVar(log, "[IN] Data Common Directory", DataCommonDirectory).replace("\\", "/") - TranslationDirectory = askVar(log, "[IN] Translation Directory", TranslationDirectory).replace("\\", "/") - LeveldesignDataShardDirectory = askVar(log, "[IN] Leveldesign Data Shard Directory", LeveldesignDataShardDirectory).replace("\\", "/") - LeveldesignDataCommonDirectory = askVar(log, "[IN] Leveldesign Data Common Directory", LeveldesignDataCommonDirectory).replace("\\", "/") - WorldEditorFilesDirectory = askVar(log, "[IN] World Editor Files Directory", WorldEditorFilesDirectory).replace("\\", "/") - WindowsExeDllCfgDirectories[0] = askVar(log, "[IN] Primary Windows exe/dll/cfg Directory", WindowsExeDllCfgDirectories[0]).replace("\\", "/") - WindowsExeDllCfgDirectories[1] = askVar(log, "[IN] Secondary Windows exe/dll/cfg Directory", WindowsExeDllCfgDirectories[1]).replace("\\", "/") - WindowsExeDllCfgDirectories[2] = askVar(log, "[IN] Tertiary Windows exe/dll/cfg Directory", WindowsExeDllCfgDirectories[2]).replace("\\", "/") - WindowsExeDllCfgDirectories[3] = askVar(log, "[IN] Quaternary Windows exe/dll/cfg Directory", WindowsExeDllCfgDirectories[3]).replace("\\", "/") - WindowsExeDllCfgDirectories[4] = askVar(log, "[IN] Quinary Windows exe/dll/cfg Directory", WindowsExeDllCfgDirectories[4]).replace("\\", "/") - WindowsExeDllCfgDirectories[5] = askVar(log, "[IN] Senary Windows exe/dll/cfg Directory", WindowsExeDllCfgDirectories[5]).replace("\\", "/") - WindowsExeDllCfgDirectories[6] = askVar(log, "[IN] Septenary Windows exe/dll/cfg Directory", WindowsExeDllCfgDirectories[6]).replace("\\", "/") - LinuxServiceExecutableDirectory = askVar(log, "[IN] Linux Service Executable Directory", LinuxServiceExecutableDirectory).replace("\\", "/") - LinuxClientExecutableDirectory = askVar(log, "[IN] Linux Client Executable Directory", LinuxClientExecutableDirectory).replace("\\", "/") - PatchmanDevDirectory = askVar(log, "[IN] Patchman Directory", PatchmanDevDirectory).replace("\\", "/") - PatchmanCfgAdminDirectory = askVar(log, "[IN] Patchman Cfg Admin Directory", PatchmanCfgAdminDirectory).replace("\\", "/") - PatchmanCfgDefaultDirectory = askVar(log, "[IN] Patchman Cfg Default Directory", PatchmanCfgDefaultDirectory).replace("\\", "/") - PatchmanBridgeServerDirectory = askVar(log, "[OUT] Patchman Bridge Server Patch Directory", PatchmanBridgeServerDirectory).replace("\\", "/") - SignToolExecutable = askVar(log, "Sign Tool Executable", SignToolExecutable).replace("\\", "/") - SignToolSha1 = askVar(log, "Sign Tool Signature SHA1", SignToolSha1) - SignToolTimestamp = askVar(log, "Sign Tool Timestamp Authority", SignToolTimestamp) - MaxAvailable = int(askVar(log, "3dsMax Available", str(MaxAvailable))) - if MaxAvailable: - MaxDirectory = askVar(log, "3dsMax Directory", MaxDirectory).replace("\\", "/") - MaxUserDirectory = askVar(log, "3dsMax User Directory", MaxUserDirectory).replace("\\", "/") - MaxExecutable = askVar(log, "3dsMax Executable", MaxExecutable) - if os.path.isfile("configuration/buildsite.py"): - os.remove("configuration/buildsite.py") - sf = open("configuration/buildsite.py", "w") - sf.write("#!/usr/bin/python\n") - sf.write("# \n") - sf.write("# \\file site.py\n") - sf.write("# \\brief Site configuration\n") - sf.write("# \\date " + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + "\n") - sf.write("# \\author Jan Boon (Kaetemi)\n") - sf.write("# Python port of game data build pipeline.\n") - sf.write("# Site configuration.\n") - sf.write("# \n") - sf.write("# NeL - MMORPG Framework \n") - sf.write("# Copyright (C) 2009-2014 by authors\n") - sf.write("# \n") - sf.write("# This program is free software: you can redistribute it and/or modify\n") - sf.write("# it under the terms of the GNU Affero General Public License as\n") - sf.write("# published by the Free Software Foundation, either version 3 of the\n") - sf.write("# License, or (at your option) any later version.\n") - sf.write("# \n") - sf.write("# This program is distributed in the hope that it will be useful,\n") - sf.write("# but WITHOUT ANY WARRANTY; without even the implied warranty of\n") - sf.write("# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n") - sf.write("# GNU Affero General Public License for more details.\n") - sf.write("# \n") - sf.write("# You should have received a copy of the GNU Affero General Public License\n") - sf.write("# along with this program. If not, see .\n") - sf.write("# \n") - sf.write("\n") - sf.write("\n") - sf.write("# *** SITE INSTALLATION ***\n") - sf.write("\n") - sf.write("# Use '/' in path name, not '\'\n") - sf.write("# Don't put '/' at the end of a directory name\n") - sf.write("\n") - sf.write("\n") - sf.write("# Quality option for this site (1 for BEST, 0 for DRAFT)\n") - sf.write("BuildQuality = " + str(BuildQuality) + "\n") - sf.write("\n") - sf.write("RemapLocalFrom = \"" + str(RemapLocalFrom) + "\"\n") - sf.write("RemapLocalTo = \"" + str(RemapLocalTo) + "\"\n") - sf.write("\n") - sf.write("ToolDirectories = " + str(ToolDirectories) + "\n") - sf.write("ToolSuffix = \"" + str(ToolSuffix) + "\"\n") - sf.write("\n") - sf.write("# Build script directory\n") - sf.write("ScriptDirectory = \"" + str(ScriptDirectory) + "\"\n") - sf.write("WorkspaceDirectory = \"" + str(WorkspaceDirectory) + "\"\n") - sf.write("\n") - sf.write("# Data build directories\n") - sf.write("DatabaseDirectory = \"" + str(DatabaseDirectory) + "\"\n") - sf.write("SoundDirectory = \"" + str(SoundDirectory) + "\"\n") - sf.write("SoundDfnDirectory = \"" + str(SoundDfnDirectory) + "\"\n") - sf.write("ExportBuildDirectory = \"" + str(ExportBuildDirectory) + "\"\n") - sf.write("\n") - sf.write("# Install directories\n") - sf.write("InstallDirectory = \"" + str(InstallDirectory) + "\"\n") - sf.write("ClientDevDirectory = \"" + str(ClientDevDirectory) + "\"\n") - sf.write("ClientDevLiveDirectory = \"" + str(ClientDevLiveDirectory) + "\"\n") - sf.write("ClientPatchDirectory = \"" + str(ClientPatchDirectory) + "\"\n") - sf.write("ClientInstallDirectory = \"" + str(ClientInstallDirectory) + "\"\n") - sf.write("ShardInstallDirectory = \"" + str(ShardInstallDirectory) + "\"\n") - sf.write("ShardDevDirectory = \"" + str(ShardDevDirectory) + "\"\n") - sf.write("WorldEditInstallDirectory = \"" + str(WorldEditInstallDirectory) + "\"\n") - sf.write("\n") - sf.write("# Utility directories\n") - sf.write("WorldEditorFilesDirectory = \"" + str(WorldEditorFilesDirectory) + "\"\n") - sf.write("\n") - sf.write("# Leveldesign directories\n") - sf.write("LeveldesignDirectory = \"" + str(LeveldesignDirectory) + "\"\n") - sf.write("LeveldesignDfnDirectory = \"" + str(LeveldesignDfnDirectory) + "\"\n") - sf.write("LeveldesignWorldDirectory = \"" + str(LeveldesignWorldDirectory) + "\"\n") - sf.write("PrimitivesDirectory = \"" + str(PrimitivesDirectory) + "\"\n") - sf.write("LeveldesignDataCommonDirectory = \"" + str(LeveldesignDataCommonDirectory) + "\"\n") - sf.write("LeveldesignDataShardDirectory = \"" + str(LeveldesignDataShardDirectory) + "\"\n") - sf.write("TranslationDirectory = \"" + str(TranslationDirectory) + "\"\n") - sf.write("\n") - sf.write("# Misc data directories\n") - sf.write("GamedevDirectory = \"" + str(GamedevDirectory) + "\"\n") - sf.write("DataCommonDirectory = \"" + str(DataCommonDirectory) + "\"\n") - sf.write("DataShardDirectory = \"" + str(DataShardDirectory) + "\"\n") - sf.write("WindowsExeDllCfgDirectories = " + str(WindowsExeDllCfgDirectories) + "\n") - sf.write("LinuxServiceExecutableDirectory = \"" + str(LinuxServiceExecutableDirectory) + "\"\n") - sf.write("LinuxClientExecutableDirectory = \"" + str(LinuxClientExecutableDirectory) + "\"\n") - sf.write("PatchmanDevDirectory = \"" + str(PatchmanDevDirectory) + "\"\n") - sf.write("PatchmanCfgAdminDirectory = \"" + str(PatchmanCfgAdminDirectory) + "\"\n") - sf.write("PatchmanCfgDefaultDirectory = \"" + str(PatchmanCfgDefaultDirectory) + "\"\n") - sf.write("PatchmanBridgeServerDirectory = \"" + str(PatchmanBridgeServerDirectory) + "\"\n") - sf.write("\n") - sf.write("# Sign tool\n") - sf.write("SignToolExecutable = \"" + str(SignToolExecutable) + "\"\n") - sf.write("SignToolSha1 = \"" + str(SignToolSha1) + "\"\n") - sf.write("SignToolTimestamp = \"" + str(SignToolTimestamp) + "\"\n") - sf.write("\n") - sf.write("# 3dsMax directives\n") - sf.write("MaxAvailable = " + str(MaxAvailable) + "\n") - sf.write("MaxDirectory = \"" + str(MaxDirectory) + "\"\n") - sf.write("MaxUserDirectory = \"" + str(MaxUserDirectory) + "\"\n") - sf.write("MaxExecutable = \"" + str(MaxExecutable) + "\"\n") - sf.write("\n") - sf.write("\n") - sf.write("# end of file\n") - sf.flush() - sf.close() - sf = open("configuration/buildsite_local.py", "w") - sfr = open("configuration/buildsite.py", "r") - for l in sfr: - sf.write(l.replace(RemapLocalFrom + '/', RemapLocalTo + '/')) - sf.flush() - sfr.close() - sf.close() - -from buildsite_local import * - -sys.path.append(WorkspaceDirectory) -from projects import * - -printLog(log, "") -printLog(log, "-------") -printLog(log, "--- Run the setup projects") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") -# For each project -for projectName in ProjectsToProcess: - if ((args.includeproject == None or projectName in args.includeproject) and (args.excludeproject == None or not projectName in args.excludeproject)): - printLog(log, "PROJECT " + projectName) - os.putenv("NELBUILDACTIVEPROJECT", os.path.abspath(WorkspaceDirectory + "/" + projectName)) - os.chdir("processes") - try: - if not args.includeprocess == None: - subprocess.call([ "python", "0_setup.py", "--includeprocess" ] + args.includeprocess) - elif not args.excludeprocess == None: - subprocess.call([ "python", "0_setup.py", "--excludeprocess" ] + args.excludeprocess) - else: - subprocess.call([ "python", "0_setup.py" ]) - except Exception, e: - printLog(log, "<" + projectName + "> " + str(e)) - os.chdir("..") - try: - projectLog = open("processes/log.log", "r") - projectLogData = projectLog.read() - projectLog.close() - log.write(projectLogData) - except Exception, e: - printLog(log, "<" + projectName + "> " + str(e)) - else: - printLog(log, "IGNORE PROJECT " + projectName) -printLog(log, "") - -# Additional directories -printLog(log, ">>> Setup additional directories <<<") -mkPath(log, ClientDevDirectory) -mkPath(log, ClientDevLiveDirectory) -mkPath(log, ClientPatchDirectory) -mkPath(log, ClientInstallDirectory) - -if not args.noverify: - printLog(log, "") - printLog(log, "-------") - printLog(log, "--- Verify tool paths") - printLog(log, "-------") - printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) - printLog(log, "") - if MaxAvailable: - findMax(log, MaxDirectory, MaxExecutable) - findTool(log, ToolDirectories, TgaToDdsTool, ToolSuffix) - findTool(log, ToolDirectories, BuildInterfaceTool, ToolSuffix) - findTool(log, ToolDirectories, ExecTimeoutTool, ToolSuffix) - findTool(log, ToolDirectories, BuildSmallbankTool, ToolSuffix) - findTool(log, ToolDirectories, BuildFarbankTool, ToolSuffix) - findTool(log, ToolDirectories, ZoneDependenciesTool, ToolSuffix) - findTool(log, ToolDirectories, ZoneWelderTool, ToolSuffix) - findTool(log, ToolDirectories, ZoneElevationTool, ToolSuffix) - findTool(log, ToolDirectories, BuildRbankTool, ToolSuffix) - findTool(log, ToolDirectories, BuildIndoorRbankTool, ToolSuffix) - findTool(log, ToolDirectories, BuildIgBoxesTool, ToolSuffix) - findTool(log, ToolDirectories, GetNeighborsTool, ToolSuffix) - findTool(log, ToolDirectories, ZoneLighterTool, ToolSuffix) - findTool(log, ToolDirectories, ZoneIgLighterTool, ToolSuffix) - findTool(log, ToolDirectories, IgLighterTool, ToolSuffix) - findTool(log, ToolDirectories, AnimBuilderTool, ToolSuffix) - findTool(log, ToolDirectories, TileEditTool, ToolSuffix) - # findTool(log, ToolDirectories, BuildImagesetTool, ToolSuffix) # kaetemi stuff, ignore this - findTool(log, ToolDirectories, MakeSheetIdTool, ToolSuffix) - # findTool(log, ToolDirectories, BuildSheetsTool, ToolSuffix) # kaetemi stuff, ignore this - # findTool(log, ToolDirectories, BuildSoundTool, ToolSuffix) # kaetemi stuff, ignore this - # findTool(log, ToolDirectories, BuildSoundTool, ToolSuffix) - findTool(log, ToolDirectories, BuildSoundbankTool, ToolSuffix) - findTool(log, ToolDirectories, BuildSamplebankTool, ToolSuffix) - findTool(log, ToolDirectories, BuildCoarseMeshTool, ToolSuffix) - findTool(log, ToolDirectories, LightmapOptimizerTool, ToolSuffix) - findTool(log, ToolDirectories, BuildClodtexTool, ToolSuffix) - findTool(log, ToolDirectories, BuildShadowSkinTool, ToolSuffix) - findTool(log, ToolDirectories, PanoplyMakerTool, ToolSuffix) - findTool(log, ToolDirectories, HlsBankMakerTool, ToolSuffix) - findTool(log, ToolDirectories, LandExportTool, ToolSuffix) - findTool(log, ToolDirectories, PrimExportTool, ToolSuffix) - findTool(log, ToolDirectories, IgElevationTool, ToolSuffix) - findTool(log, ToolDirectories, IgAddTool, ToolSuffix) - findTool(log, ToolDirectories, BuildClodBankTool, ToolSuffix) - findTool(log, ToolDirectories, SheetsPackerTool, ToolSuffix) - findTool(log, ToolDirectories, BnpMakeTool, ToolSuffix) - findTool(log, ToolDirectories, AiBuildWmapTool, ToolSuffix) - findTool(log, ToolDirectories, TgaCutTool, ToolSuffix) - findTool(log, ToolDirectories, PatchGenTool, ToolSuffix) - findTool(log, ToolDirectories, TranslationToolsTool, ToolSuffix) - findTool(log, ToolDirectories, BuildWorldPackedColTool, ToolSuffix) - findTool(log, ToolDirectories, R2IslandsTexturesTool, ToolSuffix) - findTool(log, ToolDirectories, PatchmanServiceTool, ToolSuffix) - -log.close() -if os.path.isfile("0_setup.log"): - os.remove("0_setup.log") -shutil.copy("log.log", time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + "_setup.log") -shutil.move("log.log", "0_setup.log") diff --git a/code/nel/tools/build_gamedata/b1_client_dev.py b/code/nel/tools/build_gamedata/b1_client_dev.py deleted file mode 100644 index 87ce0f998..000000000 --- a/code/nel/tools/build_gamedata/b1_client_dev.py +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/python -# -# \file b1_client_dev.py -# \brief Install to client dev -# \date 2009-02-18 16:19GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install to client dev -# -# NeL - MMORPG Framework -# Copyright (C) 2009-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 . -# - -import time, sys, os, shutil, subprocess, distutils.dir_util, socket -sys.path.append("configuration") - -if os.path.isfile("log.log"): - os.remove("log.log") -log = open("log.log", "w") -from scripts import * -from buildsite_local import * -from tools import * - -sys.path.append(WorkspaceDirectory) -from projects import * - -# Log error -printLog(log, "") -printLog(log, "-------") -printLog(log, "--- Install to client dev") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -mkPath(log, ClientDevLiveDirectory) -if not os.path.isfile(ClientDevLiveDirectory + "/client.cfg"): - printLog(log, ">>> Generate live dev client.cfg <<<") - cfg = open(ClientDevLiveDirectory + "/client.cfg", "w") - cfg.write("RootConfigFilename = \"client_default.cfg\";\n") - cfg.write("PreDataPath = {\n") - cfg.write("\t\"user\", \"patch\", \"" + DataCommonDirectory + "\", \"" + GamedevDirectory + "\", \"" + LeveldesignDirectory + "/translation/translated\", \"" + InstallDirectory + "\", \"data\", \"examples\" \n") - cfg.write("};\n") - cfg.write("PreLoadPath = \"" + InstallDirectory + "\";\n") - cfg.write("PatchWanted = 0;\n") - cfg.write("DisplayLuaDebugInfo = 1;\n") - cfg.write("AllowDebugLua = 1;\n") - cfg.write("FullScreen = 0;\n") - cfg.flush() - cfg.close() - printLog(log, "") - -mkPath(log, ClientDevDirectory) -if not os.path.isfile(ClientDevDirectory + "/client.cfg"): - printLog(log, ">>> Generate local dev client.cfg <<<") - cfg = open(ClientDevDirectory + "/client.cfg", "w") - cfgr = open(ClientDevLiveDirectory + "/client.cfg", "r") - for l in cfgr: - cfg.write(l) - cfgr.close() - cfg.write("StartupHost = \"http://" + socket.gethostname() + ":9042\";\n") - cfg.write("Application = {\n") - cfg.write(" \"dev\", \"./client_ryzom_r.exe\", \"./\" \n") - cfg.write("};\n") - cfg.flush() - cfg.close() - printLog(log, "") - -printLog(log, ">>> Install data <<<") -for category in InstallClientData: - if (category["UnpackTo"] != None): - printLog(log, "CATEGORY " + category["Name"]) - targetPath = ClientDevDirectory - targetPathLive = ClientDevLiveDirectory - if (category["UnpackTo"] != ""): - targetPath += "/" + category["UnpackTo"] - targetPathLive += "/" + category["UnpackTo"] - mkPath(log, targetPath) - mkPath(log, targetPathLive) - for package in category["Packages"]: - printLog(log, "PACKAGE " + package[0]) - mkPath(log, InstallDirectory + "/" + package[0]) - if "exedll" in package[0]: - if package[0] == "exedll": # or package[0] == platformExeDll # TODO: 64-bit and Linux separation of exedll, only include one - copyFileIfNeeded(log, InstallDirectory + "/" + package[0] + "/client_default.cfg", targetPath) - copyFileIfNeeded(log, InstallDirectory + "/" + package[0] + "/client_default.cfg", targetPathLive) - else: - copyFilesNoTreeIfNeeded(log, InstallDirectory + "/" + package[0], targetPath) - copyFilesNoTreeIfNeeded(log, InstallDirectory + "/" + package[0], targetPathLive) -printLog(log, "") - -log.close() -if os.path.isfile("b1_client_dev.log"): - os.remove("b1_client_dev.log") -shutil.copy("log.log", time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + "_client_dev.log") -shutil.move("log.log", "b1_client_dev.log") diff --git a/code/nel/tools/build_gamedata/c1_shard_patch.py b/code/nel/tools/build_gamedata/c1_shard_patch.py deleted file mode 100644 index 30cb88bb8..000000000 --- a/code/nel/tools/build_gamedata/c1_shard_patch.py +++ /dev/null @@ -1,123 +0,0 @@ -#!/usr/bin/python -# -# \file c1_shard_patch.py -# \brief Create a new patch for the patchman bridge -# \date 2014-02-20 00:27GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Create a new patch for the patchman bridge -# -# NeL - MMORPG Framework -# 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 . -# - -import time, sys, os, shutil, subprocess, distutils.dir_util, tarfile, argparse -sys.path.append("configuration") - -parser = argparse.ArgumentParser(description='Ryzom Core - Build Gamedata - Shard Patch') -parser.add_argument('--admininstall', '-ai', action='store_true') -args = parser.parse_args() - -if os.path.isfile("log.log"): - os.remove("log.log") -log = open("log.log", "w") -from scripts import * -from buildsite_local import * -from tools import * - -sys.path.append(WorkspaceDirectory) -from projects import * - -# Log error -printLog(log, "") -printLog(log, "-------") -printLog(log, "--- Create a new patch for the patchman bridge") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# Find tools -SevenZip = findTool(log, ToolDirectories, SevenZipTool, ToolSuffix) - -# List the directories that will be used -archiveDirectories = [ ] -for dir in InstallShardDataDirectories: - if not dir in archiveDirectories: - archiveDirectories += [ dir ] -for package in InstallShardDataFiles: - dstDir = package[0] - if not dstDir in archiveDirectories: - archiveDirectories += [ dstDir ] -for multiDir in InstallShardDataMultiDirectories: - dstDir = multiDir[0] - if not dstDir in archiveDirectories: - archiveDirectories += [ dstDir ] -for multiDir in InstallShardDataPrimitivesDirectories: - dstDir = multiDir[0] - if not dstDir in archiveDirectories: - archiveDirectories += [ dstDir ] -for execDir in InstallShardDataExecutables: - dstDir = execDir[0] - if not dstDir in archiveDirectories: - archiveDirectories += [ dstDir ] - -printLog(log, ">>> Archive new admin_install.tgz <<<") -mkPath(log, PatchmanBridgeServerDirectory) -adminInstallTgz = PatchmanBridgeServerDirectory + "/admin_install.tgz" -patchmanExecutable = LinuxServiceExecutableDirectory + "/ryzom_patchman_service" -if needUpdateDirNoSubdirFile(log, PatchmanCfgAdminDirectory + "/bin", adminInstallTgz) or needUpdateDirNoSubdirFile(log, PatchmanCfgAdminDirectory + "/patchman", adminInstallTgz) or needUpdate(log, patchmanExecutable, adminInstallTgz): - printLog(log, "WRITE " + adminInstallTgz) - if os.path.isfile(adminInstallTgz): - os.remove(adminInstallTgz) - tar = tarfile.open(adminInstallTgz, "w:gz") - tar.add(PatchmanCfgAdminDirectory + "/bin", arcname = "bin") - tar.add(PatchmanCfgAdminDirectory + "/patchman", arcname = "patchman") - tar.add(patchmanExecutable, arcname = "patchman/ryzom_patchman_service") - tar.close() -else: - printLog(log, "SKIP " + adminInstallTgz) -printLog(log, "") - -if not args.admininstall: - if SevenZip == "": - toolLogFail(log, SevenZipTool, ToolSuffix) - else: - printLog(log, ">>> Create new version <<<") - newVersion = 1 - vstr = str(newVersion).zfill(6) - vpath = PatchmanBridgeServerDirectory + "/" + vstr - while os.path.exists(vpath): - newVersion = newVersion + 1 - vstr = str(newVersion).zfill(6) - vpath = PatchmanBridgeServerDirectory + "/" + vstr - mkPath(log, vpath) - for dir in archiveDirectories: - mkPath(log, ShardInstallDirectory + "/" + dir) - # tgzPath = vpath + "/" + dir + ".tgz" - # printLog(log, "WRITE " + tgzPath) - # tar = tarfile.open(tgzPath, "w:gz") - # tar.add(ShardInstallDirectory + "/" + dir, arcname = dir) - # tar.close() - sevenZipPath = vpath + "/" + dir + ".7z" - printLog(log, "WRITE " + sevenZipPath) - subprocess.call([ SevenZip, "a", sevenZipPath, ShardInstallDirectory + "/" + dir ]) - printLog(log, "") - -log.close() -if os.path.isfile("c1_shard_patch.log"): - os.remove("c1_shard_patch.log") -shutil.copy("log.log", time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + "_shard_patch.log") -shutil.move("log.log", "c1_shard_patch.log") diff --git a/code/nel/tools/build_gamedata/configuration/scripts.py b/code/nel/tools/build_gamedata/configuration/scripts.py deleted file mode 100644 index 4dcfaaac5..000000000 --- a/code/nel/tools/build_gamedata/configuration/scripts.py +++ /dev/null @@ -1,610 +0,0 @@ -#!/usr/bin/python -# -# \file export.py -# \brief Useful scripts -# \date 2009-02-18 09:22GMT -# \author Jan Boon (Kaetemi) -# Useful scripts -# -# NeL - MMORPG Framework -# Copyright (C) 2009-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 . -# - -import time, sys, os, shutil, subprocess, distutils.dir_util, multiprocessing, math - -ActiveProjectDirectory = os.getenv("NELBUILDACTIVEPROJECT", "configuration/project") -sys.path.append(ActiveProjectDirectory) - -def printLog(log, text): - log.write(text + "\n") - print text - -pendingProcesses = [] -processLimit = math.ceil(multiprocessing.cpu_count() * 0.75) - -def callParallelProcess(command): - res = 0 - if len(pendingProcesses) >= processLimit: - waitingProc = pendingProcesses.pop(0) - res = waitingProc.wait() - proc = subprocess.Popen(command) - pendingProcesses.append(proc) - return res - -def flushParallelProcesses(): - res = 0 - while (len(pendingProcesses) > 0): - waitingProc = pendingProcesses.pop(0) - procRes = waitingProc.wait() - if procRes != 0: - res = procRes - return res - -def mkPath(log, path): - printLog(log, "DIR " + path) - distutils.dir_util.mkpath(path) - -def needUpdate(log, source, dest): - if (os.path.isfile(source)): - if (os.path.isfile(dest)): - if (os.stat(source).st_mtime > os.stat(dest).st_mtime): - return 1 - else: - return 0 - return 1 - printLog(log, "MISSING " + source) - return 0 - -def needUpdateRemoveDest(log, source, dest): - if (os.path.isfile(source)): - if (os.path.isfile(dest)): - if (os.stat(source).st_mtime > os.stat(dest).st_mtime): - os.remove(dest) - return 1 - else: - return 0 - return 1 - printLog(log, "MISSING " + source) - return 0 - -def needUpdateLogRemoveDest(log, source, dest): - if (os.path.isfile(source)): - if (os.path.isfile(dest)): - if (os.stat(source).st_mtime > os.stat(dest).st_mtime): - os.remove(dest) - printLog(log, source + " -> " + dest) - return 1 - else: - printLog(log, "SKIP " + dest) - return 0 - printLog(log, source + " -> " + dest) - return 1 - printLog(log, "MISSING " + source) - printLog(log, "SKIP " + dest) - return 0 - -def copyFileList(log, dir_source, dir_target, files): - for fileName in files: - if fileName != ".svn" and fileName != ".." and fileName != "." and fileName != "*.*": - if (os.path.isfile(dir_source + "/" + fileName)): - if needUpdateLogRemoveDest(log, dir_source + "/" + fileName, dir_target + "/" + fileName): - shutil.copy(dir_source + "/" + fileName, dir_target + "/" + fileName) - -def copyFileListLogless(log, dir_source, dir_target, files): - for fileName in files: - if fileName != ".svn" and fileName != ".." and fileName != "." and fileName != "*.*": - if (os.path.isfile(dir_source + "/" + fileName)): - if needUpdateRemoveDest(log, dir_source + "/" + fileName, dir_target + "/" + fileName): - shutil.copy(dir_source + "/" + fileName, dir_target + "/" + fileName) - -def copyFileListNoTree(log, dir_source, dir_target, files): - for fileName in files: - if fileName != ".svn" and fileName != ".." and fileName != "." and fileName != "*.*": - if (os.path.isfile(dir_source + "/" + fileName)): - printLog(log, dir_source + "/" + fileName + " -> " + dir_target + "/" + os.path.basename(fileName)) - shutil.copy(dir_source + "/" + fileName, dir_target + "/" + os.path.basename(fileName)) - -def copyFileListNoTreeIfNeeded(log, dir_source, dir_target, files): - for fileName in files: - if fileName != ".svn" and fileName != ".." and fileName != "." and fileName != "*.*": - if (os.path.isfile(dir_source + "/" + fileName)): - srcFile = dir_source + "/" + fileName - destFile = dir_target + "/" + os.path.basename(fileName) - if needUpdateLogRemoveDest(log, srcFile, destFile): - shutil.copy(srcFile, destFile) - -def removeFilesRecursive(log, dir_files): - files = os.listdir(dir_files) - for fileName in files: - if (fileName != ".svn" and fileName != ".." and fileName != "." and fileName != "*.*"): - if os.path.isdir(dir_files + "/" + fileName): - removeFilesRecursive(log, dir_files + "/" + fileName) - else: - printLog(log, "RM " + dir_files + "/" + fileName) - os.remove(dir_files + "/" + fileName) - -def removeFilesDirsRecursive(log, dir_files): - files = os.listdir(dir_files) - for fileName in files: - if (fileName != ".svn" and fileName != ".." and fileName != "." and fileName != "*.*"): - if os.path.isdir(dir_files + "/" + fileName): - removeFilesRecursive(log, dir_files + "/" + fileName) - else: - printLog(log, "RM " + dir_files + "/" + fileName) - os.remove(dir_files + "/" + fileName) - printLog(log, "RMDIR " + dir_files) - os.rmdir(dir_files) - -def removeFilesRecursiveExt(log, dir_files, file_ext): - files = os.listdir(dir_files) - len_file_ext = len(file_ext) - for fileName in files: - if (fileName != ".svn" and fileName != ".." and fileName != "." and fileName != "*.*"): - if os.path.isdir(dir_files + "/" + fileName): - removeFilesRecursiveExt(log, dir_files + "/" + fileName, file_ext) - elif (fileName[-len_file_ext:].lower() == file_ext.lower()): - printLog(log, "RM " + dir_files + "/" + fileName) - os.remove(dir_files + "/" + fileName) - -def copyFilesRecursive(log, dir_source, dir_target): - files = os.listdir(dir_source) - mkPath(log, dir_target) - for fileName in files: - if (fileName != ".svn" and fileName != ".." and fileName != "." and fileName != "*.*"): - if os.path.isdir(dir_source + "/" + fileName): - copyFilesRecursive(log, dir_source + "/" + fileName, dir_target + "/" + fileName) - else: - printLog(log, dir_source + "/" + fileName + " -> " + dir_target + "/" + fileName) - shutil.copy(dir_source + "/" + fileName, dir_target + "/" + fileName) - -def copyFiles(log, dir_source, dir_target): - copyFileList(log, dir_source, dir_target, os.listdir(dir_source)) - -def copyFilesLogless(log, dir_source, dir_target): - copyFileListLogless(log, dir_source, dir_target, os.listdir(dir_source)) - -def copyFilesExt(log, dir_source, dir_target, file_ext): - files = os.listdir(dir_source) - len_file_ext = len(file_ext) - for fileName in files: - if (fileName != ".svn" and fileName != ".." and fileName != "." and fileName != "*.*") and (fileName[-len_file_ext:].lower() == file_ext.lower()): - if (os.path.isfile(dir_source + "/" + fileName)): - printLog(log, dir_source + "/" + fileName + " -> " + dir_target + "/" + fileName) - shutil.copy(dir_source + "/" + fileName, dir_target + "/" + fileName) - -def copyFilesRenamePrefixExt(log, dir_source, dir_target, old_prefix, new_prefix, file_ext): - files = os.listdir(dir_source) - len_file_ext = len(file_ext) - len_prefix = len(old_prefix) - for fileName in files: - if (fileName != ".svn" and fileName != ".." and fileName != "." and fileName != "*.*") and (fileName[-len_file_ext:].lower() == file_ext.lower()) and ((fileName[:len_prefix].lower() == old_prefix.lower())): - if (os.path.isfile(dir_source + "/" + fileName)): - printLog(log, dir_source + "/" + fileName + " -> " + dir_target + "/" + new_prefix + fileName[-(len(fileName) - len_prefix):]) - shutil.copy(dir_source + "/" + fileName, dir_target + "/" + new_prefix + fileName[-(len(fileName) - len_prefix):]) - -def copyFilesExtNoSubdir(log, dir_source, dir_target, file_ext): - files = findFilesNoSubdir(log, dir_source, file_ext) - copyFileListNoTree(log, dir_source, dir_target, files) - -def copyFilesExtNoTree(log, dir_source, dir_target, file_ext): - files = findFiles(log, dir_source, "", file_ext) - copyFileListNoTree(log, dir_source, dir_target, files) - -def copyFilesExtNoTreeIfNeeded(log, dir_source, dir_target, file_ext): - files = findFiles(log, dir_source, "", file_ext) - copyFileListNoTreeIfNeeded(log, dir_source, dir_target, files) - -def copyFilesExtNoSubdirIfNeeded(log, dir_source, dir_target, file_ext): - files = findFilesNoSubdir(log, dir_source, file_ext) - copyFileListNoTreeIfNeeded(log, dir_source, dir_target, files) - -def copyFilesNoTreeIfNeeded(log, dir_source, dir_target): - copyFileListNoTreeIfNeeded(log, dir_source, dir_target, os.listdir(dir_source)) - -def copyFilesRecursiveNoTreeIfNeeded(log, dir_source, dir_target): - files = findFilesRecursive(log, dir_source, "") - copyFileListNoTreeIfNeeded(log, dir_source, dir_target, files) - -def copyFileListExtReplaceNoTreeIfNeeded(log, dir_source, dir_target, files, file_ext, target_ext): - for fileName in files: - if fileName != ".svn" and fileName != ".." and fileName != "." and fileName != "*.*": - if (os.path.isfile(dir_source + "/" + fileName)): - srcFile = dir_source + "/" + fileName - destFile = dir_target + "/" + os.path.basename(fileName)[0:-len(file_ext)] + target_ext - if needUpdateLogRemoveDest(log, srcFile, destFile): - shutil.copy(srcFile, destFile) - -def copyFilesExtReplaceNoTreeIfNeeded(log, dir_source, dir_target, file_ext, target_ext): - files = findFiles(log, dir_source, "", file_ext) - copyFileListExtReplaceNoTreeIfNeeded(log, dir_source, dir_target, files, file_ext, target_ext) - -def copyFileIfNeeded(log, srcFile, destFile): - if needUpdateLogRemoveDest(log, srcFile, destFile): - shutil.copy(srcFile, destFile) - -def moveFileListNoTree(log, dir_source, dir_target, files): - for fileName in files: - if fileName != ".svn" and fileName != ".." and fileName != "." and fileName != "*.*": - if (os.path.isfile(dir_source + "/" + fileName)): - printLog(log, "MOVE " + dir_source + "/" + fileName + " -> " + dir_target + "/" + os.path.basename(fileName)) - shutil.move(dir_source + "/" + fileName, dir_target + "/" + os.path.basename(fileName)) - -def moveFilesExtNoTree(log, dir_source, dir_target, file_ext): - files = findFiles(log, dir_source, "", file_ext) - moveFileListNoTree(log, dir_source, dir_target, files) - -def moveFilesNoSubdir(log, dir_source, dir_target): - files = os.listdir(dir_source) - moveFileListNoTree(log, dir_source, dir_target, files) - -def moveDir(log, dir_source, dir_target): - printLog(log, "MOVE " + dir_source + " -> " + dir_target) - shutil.move(dir_source, dir_target) - -def findFilesRecursive(log, dir_where, dir_sub): - result = [ ] - files = os.listdir(dir_where + "/" + dir_sub) - for fileName in files: - if fileName != ".svn" and fileName != ".." and fileName != "." and fileName != "*.*": - filePath = dir_sub + fileName - fileFull = dir_where + "/" + dir_sub + fileName - if os.path.isfile(fileFull): - result += [ filePath ] - elif os.path.isdir(fileFull): - result += findFilesRecursive(log, dir_where, filePath + "/") - else: - printLog(log, "findFilesRecursive: file not dir or file?!" + filePath) - return result - -def findFiles(log, dir_where, dir_sub, file_ext): - result = [ ] - files = os.listdir(dir_where + "/" + dir_sub) - len_file_ext = len(file_ext) - for fileName in files: - if fileName != ".svn" and fileName != ".." and fileName != "." and fileName != "*.*": - filePath = dir_sub + fileName - fileFull = dir_where + "/" + dir_sub + fileName - if os.path.isfile(fileFull): - if fileName[-len_file_ext:].lower() == file_ext.lower(): - result += [ filePath ] - elif os.path.isdir(fileFull): - result += findFiles(log, dir_where, filePath + "/", file_ext) - else: - printLog(log, "findFiles: file not dir or file?!" + filePath) - return result - -def isLegalFileName(fileName): - return fileName != ".svn" and fileName != ".." and fileName != "." and fileName != "*.*" - -def findFilesNoSubdir(log, dir_where, file_ext): - result = [ ] - files = os.listdir(dir_where) - len_file_ext = len(file_ext) - for fileName in files: - if fileName != ".svn" and fileName != ".." and fileName != "." and fileName != "*.*": - fileFull = dir_where + "/" + fileName - if os.path.isfile(fileFull): - if fileName[-len_file_ext:].lower() == file_ext.lower(): - result += [ fileName ] - elif not os.path.isdir(fileFull): - printLog(log, "findFilesNoSubdir: file not dir or file?!" + fileFull) - return result - -def findFilesNoSubdirFiltered(log, dir_where, file_ext, filter): - if len(filter) == 0: - return findFilesNoSubdir(log, dir_where, file_ext) - result = [ ] - files = os.listdir(dir_where) - len_file_ext = len(file_ext) - for fileName in files: - if fileName != ".svn" and fileName != ".." and fileName != "." and fileName != "*.*": - fileFull = dir_where + "/" + fileName - if os.path.isfile(fileFull): - if fileName[-len_file_ext:].lower() == file_ext.lower(): - fileNameLower = fileName.lower() - for filterWord in filter: - if filterWord in fileNameLower: - result += [ fileName ] - break - elif not os.path.isdir(fileFull): - printLog(log, "findFilesNoSubdir: file not dir or file?!" + fileFull) - return result - -def findFile(log, dir_where, file_name): - files = os.listdir(dir_where) - for fileName in files: - if fileName != ".svn" and fileName != ".." and fileName != "." and fileName != "*.*": - filePath = dir_where + "/" + fileName - if os.path.isfile(filePath): - if fileName == file_name: - return filePath - elif os.path.isdir(filePath): - result = findFile(log, filePath, file_name) - if result != "": - return result - else: - printLog(log, "findFile: file not dir or file?! " + filePath) - return "" - -def needUpdateDirByLowercaseTagLog(log, dir_source, ext_source, dir_dest, ext_dest): - updateCount = 0 - skipCount = 0 - lenSrcExt = len(ext_source) - sourceFiles = findFilesNoSubdir(log, dir_source, ext_source) - destFiles = findFilesNoSubdir(log, dir_dest, ext_dest) - for file in sourceFiles: - sourceFile = dir_source + "/" + file - tagFile = dir_dest + "/" + file[0:-lenSrcExt].lower() + ext_dest - if os.path.isfile(tagFile): - sourceTime = os.stat(sourceFile).st_mtime - tagTime = os.stat(tagFile).st_mtime - if (sourceTime > tagTime): - updateCount = updateCount + 1 - else: - skipCount = skipCount + 1 - else: - updateCount = updateCount + 1 - if updateCount > 0: - printLog(log, "UPDATE " + str(updateCount) + " / " + str(len(sourceFiles)) + "; SKIP " + str(skipCount) + " / " + str(len(sourceFiles)) + "; DEST " + str(len(destFiles))) - return 1 - else: - printLog(log, "SKIP " + str(skipCount) + " / " + str(len(sourceFiles)) + "; DEST " + str(len(destFiles))) - return 0 - -def needUpdateDirByTagLogFiltered(log, dir_source, ext_source, dir_dest, ext_dest, filter): - updateCount = 0 - skipCount = 0 - lenSrcExt = len(ext_source) - sourceFiles = findFilesNoSubdirFiltered(log, dir_source, ext_source, filter) - destFiles = findFilesNoSubdir(log, dir_dest, ext_dest) - for file in sourceFiles: - sourceFile = dir_source + "/" + file - tagFile = dir_dest + "/" + file[0:-lenSrcExt] + ext_dest - if os.path.isfile(tagFile): - sourceTime = os.stat(sourceFile).st_mtime - tagTime = os.stat(tagFile).st_mtime - if (sourceTime > tagTime): - updateCount = updateCount + 1 - else: - skipCount = skipCount + 1 - else: - updateCount = updateCount + 1 - if updateCount > 0: - printLog(log, "UPDATE " + str(updateCount) + " / " + str(len(sourceFiles)) + "; SKIP " + str(skipCount) + " / " + str(len(sourceFiles)) + "; DEST " + str(len(destFiles))) - return 1 - else: - printLog(log, "SKIP " + str(skipCount) + " / " + str(len(sourceFiles)) + "; DEST " + str(len(destFiles))) - return 0 - -def needUpdateDirByTagLog(log, dir_source, ext_source, dir_dest, ext_dest): - updateCount = 0 - skipCount = 0 - lenSrcExt = len(ext_source) - sourceFiles = findFilesNoSubdir(log, dir_source, ext_source) - destFiles = findFilesNoSubdir(log, dir_dest, ext_dest) - for file in sourceFiles: - sourceFile = dir_source + "/" + file - tagFile = dir_dest + "/" + file[0:-lenSrcExt] + ext_dest - if os.path.isfile(tagFile): - sourceTime = os.stat(sourceFile).st_mtime - tagTime = os.stat(tagFile).st_mtime - if (sourceTime > tagTime): - updateCount = updateCount + 1 - else: - skipCount = skipCount + 1 - else: - updateCount = updateCount + 1 - if updateCount > 0: - printLog(log, "UPDATE " + str(updateCount) + " / " + str(len(sourceFiles)) + "; SKIP " + str(skipCount) + " / " + str(len(sourceFiles)) + "; DEST " + str(len(destFiles))) - return 1 - else: - printLog(log, "SKIP " + str(skipCount) + " / " + str(len(sourceFiles)) + "; DEST " + str(len(destFiles))) - return 0 - -def needUpdateDirNoSubdirFile(log, dir_source, file_dest): - if not os.path.isfile(file_dest): - return 1 - destTime = os.stat(file_dest).st_mtime - sourceFiles = os.listdir(dir_source) - for file in sourceFiles: - filePath = dir_source + "/" + file - if os.path.isfile(filePath): - fileTime = os.stat(filePath).st_mtime - if fileTime > destTime: - return 1 - else: - return 0 - -def needUpdateFileDirNoSubdir(log, file_source, dir_dest): - if not os.path.isfile(file_source): - printLog(log, "WARNING MISSING " + file_source) - return 0 - sourceTime = os.stat(file_source).st_mtime - destFiles = os.listdir(dir_dest) - for file in destFiles: - filePath = dir_dest + "/" + file - if os.path.isfile(filePath): - fileTime = os.stat(filePath).st_mtime - if sourceTime > fileTime: - return 1 - else: - return 0 - -def needUpdateDirNoSubdirMultiFile(log, dir_source, root_file, files_dest): - for file_dest in files_dest: - if needUpdateDirNoSubdirFile(log, dir_source, root_file + "/" + file_dest): - return 1 - return 0 - -def needUpdateDirNoSubdirMultiFileExt(log, dir_source, root_file, files_dest, file_ext): - for file_dest in files_dest: - if needUpdateDirNoSubdirFile(log, dir_source, root_file + "/" + file_dest + file_ext): - return 1 - return 0 - -def needUpdateMultiDirNoSubdirFile(log, root_dir, dirs_source, file_dest): - for dir_source in dirs_source: - if needUpdateDirNoSubdirFile(log, root_dir + "/" + dir_source, file_dest): - return 1 - return 0 - -def needUpdateMultiDirNoSubdirMultiFileExt(log, root_dir, dirs_source, root_file, files_dest, file_ext): - for file_dest in files_dest: - if needUpdateMultiDirNoSubdirFile(log, root_dir, dirs_source, root_file + "/" + file_dest + file_ext): - return 1 - return 0 - -def needUpdateMultiDirNoSubdir(log, root_dir, dirs_source, dir_dest): - for dir_source in dirs_source: - if needUpdateDirNoSubdir(log, root_dir + "/" + dir_source, dir_dest): - return 1 - return 0 - -def needUpdateDirNoSubdirExtFile(log, dir_source, dir_ext, file_dest): - if not os.path.isfile(file_dest): - return 1 - destTime = os.stat(file_dest).st_mtime - sourceFiles = os.listdir(dir_source) - for file in sourceFiles: - if file.endswith(dir_ext): - filePath = dir_source + "/" + file - if os.path.isfile(filePath): - fileTime = os.stat(filePath).st_mtime - if fileTime > destTime: - return 1 - else: - return 0 - -def needUpdateDirNoSubdirExtMultiFileExt(log, dir_source, dir_ext, root_file, files_dest, file_ext): - for file_dest in files_dest: - if needUpdateDirNoSubdirExtFile(log, dir_source, dir_ext, root_file + "/" + file_dest + file_ext): - return 1 - return 0 - -def needUpdateDirNoSubdir(log, dir_source, dir_dest): - latestSourceFile = 0 - oldestDestFile = 0 - sourceFiles = os.listdir(dir_source) - destFiles = os.listdir(dir_dest) - for file in sourceFiles: - filePath = dir_source + "/" + file - if os.path.isfile(filePath): - fileTime = os.stat(filePath).st_mtime - if fileTime > latestSourceFile: - latestSourceFile = fileTime - for file in destFiles: - filePath = dir_dest + "/" + file - if os.path.isfile(filePath): - fileTime = os.stat(filePath).st_mtime - if oldestDestFile == 0 or fileTime < oldestDestFile: - oldestDestFile = fileTime - if latestSourceFile > oldestDestFile: - return 1 - else: - return 0 - -def needUpdateDirNoSubdirLogExt(log, dir_source, ext_source, dir_dest, ext_dest): - latestSourceFile = 0 - latestDestFile = 0 - sourceFiles = findFilesNoSubdir(log, dir_source, ext_source) - destFiles = findFilesNoSubdir(log, dir_dest, ext_dest) - for file in sourceFiles: - fileTime = os.stat(dir_source + "/" + file).st_mtime - if (fileTime > latestSourceFile): - latestSourceFile = fileTime - for file in destFiles: - fileTime = os.stat(dir_dest + "/" + file).st_mtime - if (fileTime > latestDestFile): - latestDestFile = fileTime - if latestSourceFile > latestDestFile or len(sourceFiles) > len(destFiles): - printLog(log, "UPDATE; Source: " + str(latestSourceFile) + ", " + str(len(sourceFiles)) + " files; Dest: " + str(latestDestFile) + ", " + str(len(destFiles)) + " files") - return 1 - else: - printLog(log, "SKIP *") - return 0 - -def needUpdateDirNoSubdirLogExtMultidir(log, all_dir_base, all_dir_source, dir_source, ext_source, dir_dest, ext_dest): - latestSourceFile = 0 - latestDestFile = 0 - sourceFilesAll = [ ] - for dir in all_dir_source: - sourceFilesAll += findFilesNoSubdir(log, all_dir_base + "/" + dir, ext_source) - sourceFiles = findFilesNoSubdir(log, dir_source, ext_source) - destFiles = findFilesNoSubdir(log, dir_dest, ext_dest) - for file in sourceFiles: - fileTime = os.stat(dir_source + "/" + file).st_mtime - if (fileTime > latestSourceFile): - latestSourceFile = fileTime - for file in destFiles: - fileTime = os.stat(dir_dest + "/" + file).st_mtime - if (fileTime > latestDestFile): - latestDestFile = fileTime - if latestSourceFile > latestDestFile or len(sourceFilesAll) > len(destFiles): - printLog(log, "UPDATE; Source: " + str(latestSourceFile) + ", " + str(len(sourceFilesAll)) + " files; Dest: " + str(latestDestFile) + ", " + str(len(destFiles)) + " files") - return 1 - else: - printLog(log, "SKIP *") - return 0 - -def findFileMultiDir(log, dirs_where, file_name): - try: - for dir in dirs_where: - if dir != "": - file = findFile(log, dir, file_name) - if file != "": - return file - except Exception, e: - printLog(log, "EXCEPTION " + str(e)) - printLog(log, "FILE NOT FOUND " + file_name) - return "" - -def findTool(log, dirs_where, file_name, suffix): - try: - for dir in dirs_where: - if dir != "": - tool = findFile(log, dir, file_name + suffix) - if tool != "": - printLog(log, "TOOL " + tool) - return tool - except Exception, e: - printLog(log, "EXCEPTION " + str(e)) - printLog(log, "TOOL NOT FOUND " + file_name + suffix) - return "" - -def findMax(log, dir, file): - tool = dir + "/" + file - if os.path.isfile(tool): - printLog(log, "3DSMAX " + tool) - return tool - printLog(log, "3DSMAX NOT FOUND " + file) - return "" - -def toolLogFail(log, tool, suffix): - printLog(log, "FAIL " + tool + suffix + " is not found") - -def askVar(log, name, default): - sys.stdout.write(name + " (" + default + "): ") - line = sys.stdin.readline() - linestrip = line.strip() - if linestrip == "--": - log.write(name + " (" + default + "): ''\n") - return "" - elif linestrip == "": - log.write(name + " (" + default + "): '" + default + "'\n") - return default - else: - log.write(name + " (" + default + "): '" + linestrip + "'\n") - return linestrip diff --git a/code/nel/tools/build_gamedata/configuration/tools.py b/code/nel/tools/build_gamedata/configuration/tools.py deleted file mode 100644 index cbf1e63f5..000000000 --- a/code/nel/tools/build_gamedata/configuration/tools.py +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/python -# -# \file process.py -# \brief Tools configuration -# \date 2009-03-10 11:33GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Tools configuration. -# -# NeL - MMORPG Framework -# Copyright (C) 2009-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 . -# - -# *** PROCESS TIMEOUT *** -SkelExportTimeout = 600000 -SwtExportTimeout = 600000 -ShapeExportTimeout = 3600000 -ZoneExportTimeout = 1800000 -ZoneBuildDependTimeout = 1800000 -ZoneBuildWeldTimeout = 60000 -ZoneLightBuildTimeout = 600000 -ZoneIgLightBuildTimeout = 600000 -SmallbankBuildTimeout = 60000 -FarbankBuildTimeout = 180000 -AnimExportTimeout = 1800000 -IgExportTimeout = 600000 -CmbExportTimeout = 60000 -RbankBuildTesselTimeout = 6000000 -RbankBuildSmoothTimeout = 6000000 -RbankBuildProclocalTimeout = 6000000 -RbankBuildProcglobalTimeout = 18000000 -RbankBuildIndoorTimeout = 18000000 -# WmapBuildTimeout = 60000 -LigoExportTimeout = 3600000 -LigoBuildTimeout = 1800000 -PacsPrimExportTimeout = 600000 - -MapsBuildTimeout = 60000 # 1min -MaxShapeExportTimeout = 600000 # 10min - -# *** TOOLS CONFIGURATION *** - -TgaToDdsTool = "tga2dds" -BuildInterfaceTool = "build_interface" -ExecTimeoutTool = "exec_timeout" -BuildSmallbankTool = "build_smallbank" -BuildFarbankTool = "build_far_bank" -ZoneDependenciesTool = "zone_dependencies" -ZoneWelderTool = "zone_welder" -ZoneElevationTool = "zone_elevation" -BuildRbankTool = "build_rbank" -BuildIndoorRbankTool = "build_indoor_rbank" -BuildIgBoxesTool = "build_ig_boxes" -GetNeighborsTool = "get_neighbors" -ZoneLighterTool = "zone_lighter" -ZoneIgLighterTool = "zone_ig_lighter" -IgLighterTool = "ig_lighter" -AnimBuilderTool = "anim_builder" -TileEditTool = "tile_edit" -# BuildImagesetTool = "th_build_imageset" # kaetemi stuff, ignore this -MakeSheetIdTool = "make_sheet_id" -# BuildSheetsTool = "th_build_sheets" # kaetemi stuff, ignore this -# BuildSoundTool = "th_build_sound" # kaetemi stuff, ignore this -# BuildSoundTool = "build_sound" -BuildSoundbankTool = "build_soundbank" -BuildSamplebankTool = "build_samplebank" -BuildCoarseMeshTool = "build_coarse_mesh" -LightmapOptimizerTool = "lightmap_optimizer" -BuildClodtexTool = "build_clodtex" -BuildShadowSkinTool = "build_shadow_skin" -PanoplyMakerTool = "panoply_maker" -HlsBankMakerTool = "hls_bank_maker" -LandExportTool = "land_export" -PrimExportTool = "prim_export" -IgElevationTool = "ig_elevation" -IgAddTool = "ig_add" -BuildClodBankTool = "build_clod_bank" -SheetsPackerTool = "sheets_packer" -SheetsPackerShardTool = "sheets_packer_shard" -BnpMakeTool = "bnp_make" -SnpMakeTool = "snp_make" -AiBuildWmapTool = "ai_build_wmap" -TgaCutTool = "tga_cut" -PatchGenTool = "patch_gen" -TranslationToolsTool = "translation_tools" -BuildWorldPackedColTool = "build_world_packed_col" -R2IslandsTexturesTool = "r2_islands_textures" -PatchmanServiceTool = "ryzom_patchman_service" -SevenZipTool = "7za" diff --git a/code/nel/tools/build_gamedata/d1_client_patch.py b/code/nel/tools/build_gamedata/d1_client_patch.py deleted file mode 100644 index 608f24766..000000000 --- a/code/nel/tools/build_gamedata/d1_client_patch.py +++ /dev/null @@ -1,181 +0,0 @@ -#!/usr/bin/python -# -# \file d1_client_patch.py -# \brief Install to client patch -# \date 2009-02-18 16:19GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install to client patch -# -# NeL - MMORPG Framework -# Copyright (C) 2009-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 . -# - -import time, sys, os, shutil, subprocess, distutils.dir_util, argparse -sys.path.append("configuration") - -parser = argparse.ArgumentParser(description='Ryzom Core - Build Gamedata - Client Patch') -parser.add_argument('--bnponly', '-bo', action='store_true') -args = parser.parse_args() - -if os.path.isfile("log.log"): - os.remove("log.log") -log = open("log.log", "w") -from scripts import * -from buildsite_local import * -from tools import * - -sys.path.append(WorkspaceDirectory) -from projects import * - -# Log error -printLog(log, "") -printLog(log, "-------") -printLog(log, "--- Install to client patch") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# Find tools -BnpMake = findTool(log, ToolDirectories, BnpMakeTool, ToolSuffix) -SnpMake = findTool(log, ToolDirectories, SnpMakeTool, ToolSuffix); -PatchGen = findTool(log, ToolDirectories, PatchGenTool, ToolSuffix) -printLog(log, "") - -# Find **** HARDCODED **** WINDOWS **** tools ... TODO: fix patch_gen tool !!! -Lzma = findFileMultiDir(log, ToolDirectories + WindowsExeDllCfgDirectories, "lzma.exe") -printLog(log, "LZMA " + Lzma) -XDelta = findFileMultiDir(log, ToolDirectories + WindowsExeDllCfgDirectories, "xdelta.exe") -printLog(log, "XDELTA " + XDelta) -printLog(log, "") - -if BnpMake == "": - toolLogFail(log, BnpMakeTool, ToolSuffix) -elif PatchGen == "" and not args.bnponly: - toolLogFail(log, PatchGenTool, ToolSuffix) -elif Lzma == "" and not args.bnponly: - toolLogFail(log, "LZMA", ToolSuffix) -elif XDelta == "" and not args.bnponly: - toolLogFail(log, "XDELTA", ToolSuffix) -elif os.path.dirname(Lzma) != os.path.dirname(XDelta): - printLog(log, "FAIL lzma.exe and xdelta.exe must be in the same directory") -else: - mkPath(log, ClientPatchDirectory) - if not args.bnponly: - productXml = ClientPatchDirectory + "/" + ProductName + ".xml" - if not os.path.isfile(productXml): - printLog(log, ">>> Create new product <<<") - subprocess.call([ PatchGen, "createNewProduct", productXml ]) - printLog(log, "") - printLog(log, ">>> Rewrite " + ProductName + ".xml <<<") # because we know better. - shutil.move(productXml, productXml + ".old") - oldCfg = open(productXml + ".old", "r") - cfg = open(productXml, "w") - inCategories = 0 - for line in oldCfg: - if not inCategories: - if line.strip() == "<_Categories>": - inCategories = 1 - cfg.write("\t<_Categories>\n") - for category in InstallClientData: - packExt = ".bnp" - if (category["StreamedPackages"]): - packExt = ".snp" - cfg.write("\t\t<_Category>\n") - cfg.write("\t\t\t<_Name type=\"STRING\" value=\"" + category["Name"] + "\"/>\n") - if category["UnpackTo"] != None: - if category["UnpackTo"] != "": - cfg.write("\t\t\t<_UnpackTo type=\"STRING\" value=\"./" + category["UnpackTo"] + "/\"/>\n") - else: - cfg.write("\t\t\t<_UnpackTo type=\"STRING\" value=\"./\"/>\n") - cfg.write("\t\t\t<_IsOptional type=\"SINT32\" value=\"" + str(category["IsOptional"]) + "\"/>\n") - cfg.write("\t\t\t<_IsIncremental type=\"SINT32\" value=\"" + str(category["IsIncremental"]) + "\"/>\n") - for package in category["Packages"]: - if (len(package[1]) > 0): - cfg.write("\t\t\t<_Files type=\"STRING\" value=\"" + package[1][0] + "\"/>\n") - else: - cfg.write("\t\t\t<_Files type=\"STRING\" value=\"" + package[0] + packExt + "\"/>\n") - for ref in category["Refs"]: - cfg.write("\t\t\t<_Files type=\"STRING\" value=\"" + ref + "_.ref\"/>\n") - cfg.write("\t\t\n") - cfg.write("\t\n") - else: - cfg.write(line) - else: - if line.strip() == "": - inCategories = 0 - oldCfg.close() - cfg.close() - os.remove(productXml + ".old") - printLog(log, "") - printLog(log, ">>> Make bnp <<<") - targetPath = ClientPatchDirectory + "/bnp" - tagPath = ClientPatchDirectory + "/bnp_tag" - mkPath(log, targetPath) - mkPath(log, tagPath) - for category in InstallClientData: - packExt = ".bnp" - if (category["StreamedPackages"]): - packExt = ".snp" - for package in category["Packages"]: - printLog(log, "PACKAGE " + package[0]) - sourcePath = InstallDirectory + "/" + package[0] - mkPath(log, sourcePath) - targetBnp = targetPath + "/" + package[0] + packExt - tagBnp = tagPath + "/" + package[0] + packExt + ".tag" - if (len(package[1]) > 0): - targetBnp = targetPath + "/" + package[1][0] - tagBnp = tagPath + "/" + package[1][0] + ".tag" - printLog(log, "TARGET " + package[1][0]) - needUpdateBnp = 1 - if (len(package) > 2): - needUpdateBnp = needUpdate(log, sourcePath + "/" + package[2], tagBnp) - else: - needUpdateBnp = needUpdateDirNoSubdirFile(log, sourcePath, tagBnp) - if (needUpdateBnp): - subRet = 0 - open(tagBnp, 'a').close() - os.utime(tagBnp, None) - if (category["StreamedPackages"]): - printLog(log, "SNP " + targetBnp) - # cwDir = os.getcwd().replace("\\", "/") - # toolDir = os.path.dirname(Lzma).replace("\\", "/") - # os.chdir(toolDir) - subRet = subprocess.call([ SnpMake, "-p", sourcePath, targetBnp, ClientPatchDirectory + "/stream" ] + package[1][1:]) - # os.chdir(cwDir) - else: - printLog(log, "BNP " + targetBnp) - subRet = subprocess.call([ BnpMake, "-p", sourcePath, "-o", targetBnp ] + package[1][1:]) - if (subRet != 0): - os.remove(tagBnp) - else: - printLog(log, "SKIP " + targetBnp) - printLog(log, "") - if not args.bnponly: - printLog(log, ">>> Update product <<<") - cwDir = os.getcwd().replace("\\", "/") - toolDir = os.path.dirname(Lzma).replace("\\", "/") - os.chdir(toolDir) - subprocess.call([ PatchGen, "updateProduct", productXml ]) - os.chdir(cwDir) - printLog(log, "") - - -log.close() -if os.path.isfile("d1_client_patch.log"): - os.remove("d1_client_patch.log") -shutil.copy("log.log", time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + "_client_patch.log") -shutil.move("log.log", "d1_client_patch.log") diff --git a/code/nel/tools/build_gamedata/processes/ai_wmap/2_build.py b/code/nel/tools/build_gamedata/processes/ai_wmap/2_build.py deleted file mode 100644 index a59c7e09e..000000000 --- a/code/nel/tools/build_gamedata/processes/ai_wmap/2_build.py +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build ai_wmap -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build ai_wmap -# -# NeL - MMORPG Framework -# Copyright (C) 2009-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 . -# - -import time, sys, os, shutil, subprocess, distutils.dir_util -sys.path.append("../../configuration") - -if os.path.isfile("log.log"): - os.remove("log.log") -log = open("log.log", "w") -from scripts import * -from buildsite import * -from process import * -from tools import * -from directories import * - -printLog(log, "") -printLog(log, "-------") -printLog(log, "--- Build ai_wmap") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# Find tools -AiBuildWmap = findTool(log, ToolDirectories, AiBuildWmapTool, ToolSuffix) -TgaCut = findTool(log, ToolDirectories, TgaCutTool, ToolSuffix) - -if AiBuildWmap == "": - toolLogFail(log, AiBuildWmapTool, ToolSuffix) -if TgaCut == "": - toolLogFail(log, TgaCutTool, ToolSuffix) -else: - printLog(log, ">>> Copy ai_build_wmap.cfg <<<") - cfgPath = ActiveProjectDirectory + "/generated/ai_build_wmap.cfg" - tagPath = ExportBuildDirectory + "/" + AiWmapBuildTagDirectory + "/ai_wmap_build.tag" - shutil.copy(cfgPath, "ai_build_wmap.cfg") - printLog(log, ">>> Check up packed sheets <<<") - subprocess.call([ AiBuildWmap, "checkPackedSheets" ]) - printLog(log, ">>> Build ai_wmap <<<") - mkPath(log, ExportBuildDirectory + "/" + RbankOutputBuildDirectory) - mkPath(log, ExportBuildDirectory + "/" + AiWmapBuildDirectory) - mkPath(log, ExportBuildDirectory + "/" + AiWmapBuildTagDirectory) - if (needUpdate(log, "continents.packed_sheets", tagPath) or needUpdateMultiDirNoSubdirFile(log, ExportBuildDirectory, [ RbankOutputBuildDirectory ] + IgLookupDirectories + PacsPrimLookupDirectories, tagPath)): - printLog(log, ">>> Generate wmap <<<") - subprocess.call([ AiBuildWmap, "pacsCrunch " + AiWmapContinentName ]) - printLog(log, ">>> Generate sized wmap <<<") - subprocess.call([ AiBuildWmap, "pacsBuildGabarit " + AiWmapContinentName ]) - printLog(log, ">>> Generate cwmaps for each size <<<") - callParallelProcess([ AiBuildWmap, "pacsBuildWmap " + AiWmapContinentName + "_0" ]) - callParallelProcess([ AiBuildWmap, "pacsBuildWmap " + AiWmapContinentName + "_1" ]) - callParallelProcess([ AiBuildWmap, "pacsBuildWmap " + AiWmapContinentName + "_2" ]) - flushParallelProcesses() - printLog(log, ">>> Generate bitmap for each size <<<") - callParallelProcess([ AiBuildWmap, "pacsBuildBitmap " + AiWmapContinentName + "_0" ]) - callParallelProcess([ AiBuildWmap, "pacsBuildBitmap " + AiWmapContinentName + "_1" ]) - callParallelProcess([ AiBuildWmap, "pacsBuildBitmap " + AiWmapContinentName + "_2" ]) - flushParallelProcesses() - printLog(log, ">>> Clear height maps for size 1 and 2 <<<") - subprocess.call([ AiBuildWmap, "pacsClearHeightmap " + AiWmapContinentName ]) - printLog(log, ">>> Cut tga for world editor <<<") - subprocess.call([ TgaCut, ExportBuildDirectory + "/" + AiWmapBuildDirectory + "/" + AiWmapContinentName + "_0.tga" ]) - moveFilesExtNoTree(log, ".", ExportBuildDirectory + "/" + AiWmapBuildDirectory, ".tga") - printLog(log, ">>> Remove wmap <<<") - removeFilesRecursiveExt(log, ExportBuildDirectory + "/" + AiWmapBuildDirectory, ".wmap") - tagFile = open(tagPath, "w") - tagFile.write(time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())) + "\n") - tagFile.close() - else: - printLog(log, "SKIP *") -printLog(log, "") - -log.close() - - -# end of file diff --git a/code/nel/tools/build_gamedata/processes/cartographer/0_setup.py b/code/nel/tools/build_gamedata/processes/cartographer/0_setup.py deleted file mode 100644 index eda395771..000000000 --- a/code/nel/tools/build_gamedata/processes/cartographer/0_setup.py +++ /dev/null @@ -1,120 +0,0 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief setup cartographer -# \date 2014-09-13 13:32GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup cartographer -# -# NeL - MMORPG Framework -# Copyright (C) 2014 Jan BOON -# -# 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 . -# - -import time, sys, os, shutil, subprocess, distutils.dir_util -sys.path.append("../../configuration") - -if os.path.isfile("log.log"): - os.remove("log.log") -log = open("log.log", "w") -from scripts import * -from buildsite import * -from process import * -from tools import * -from directories import * - -printLog(log, "") -printLog(log, "-------") -printLog(log, "--- Setup cartographer") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") -mkPath(log, ExportBuildDirectory + "/" + CartographerBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + CartographerMapBuildDirectory) - -# Setup lookup directories -printLog(log, ">>> Setup lookup directories <<<") -mkPath(log, ExportBuildDirectory + "/" + AiWmapBuildDirectory) # IN -mkPath(log, ExportBuildDirectory + "/" + ZoneLightBuildDirectory) # IN (.zonel) -mkPath(log, ExportBuildDirectory + "/" + ZoneLightIgLandBuildDirectory) # IN (.ig) -mkPath(log, ExportBuildDirectory + "/" + SmallbankExportDirectory) # IN -mkPath(log, ExportBuildDirectory + "/" + FarbankBuildDirectory) # IN -mkPath(log, ExportBuildDirectory + "/" + DisplaceExportDirectory) # IN -mkPath(log, ExportBuildDirectory + "/" + TilesExportDirectory) # IN -mkPath(log, LeveldesignDataCommonDirectory) # IN -mkPath(log, LeveldesignDfnDirectory) # IN -mkPath(log, LeveldesignDirectory) # IN -for dir in PropertiesExportBuildSearchPaths: - mkPath(log, ExportBuildDirectory + "/" + dir) - -# Setup client directories -printLog(log, ">>> Setup install directories <<<") -mkPath(log, InstallDirectory + "/" + CartographerInstallDirectory) -mkPath(log, InstallDirectory + "/" + IslandsInstallDirectory) - -# Setup client directories -printLog(log, ">>> Setup configuration <<<") -mkPath(log, ActiveProjectDirectory + "/generated") -cfg = open(ActiveProjectDirectory + "/generated/island_screenshots.cfg", "w") -cfg.write("\n") -cfg.write("// BUILD CARTOGRAPHER CONFIGURATION\n") -cfg.write("\n") -cfg.write("SearchPaths = {\n") -cfg.write("\t\"" + ExportBuildDirectory + "/" + AiWmapBuildDirectory + "\", \n") -cfg.write("\t\"" + ExportBuildDirectory + "/" + ZoneLightBuildDirectory + "\", \n") -cfg.write("\t\"" + ExportBuildDirectory + "/" + ZoneLightIgLandBuildDirectory + "\", \n") -cfg.write("\t\"" + ExportBuildDirectory + "/" + SmallbankExportDirectory + "\", \n") -cfg.write("\t\"" + ExportBuildDirectory + "/" + FarbankBuildDirectory + "\", \n") -cfg.write("\t\"" + ExportBuildDirectory + "/" + DisplaceExportDirectory + "\", \n") -cfg.write("\t\"" + ExportBuildDirectory + "/" + TilesExportDirectory + "\", \n") -cfg.write("\t\"" + LeveldesignDataCommonDirectory + "\", \n") -cfg.write("\t\"" + LeveldesignDfnDirectory + "\", \n") -cfg.write("\t\"" + LeveldesignDirectory + "\", \n") -for dir in PropertiesExportBuildSearchPaths: - cfg.write("\t\"" + ExportBuildDirectory + "/" + dir + "\", \n") -cfg.write("};\n") -cfg.write("\n") -cfg.write("OutDir = \"" + ExportBuildDirectory + "/" + CartographerBuildDirectory + "\";\n") -cfg.write("\n") -cfg.write("Continents = {\n") -cfg.write("\t\"" + CartographerContinent + "\", \n") -cfg.write("};\n") -cfg.write("\n") -cfg.write("SeasonSuffixes = {\n") -if CartographerSeasonSuffixes: - for suffix in CartographerSeasonSuffixes: - cfg.write("\t\"" + suffix + "\", \n") -else: - for suffix in MultipleTilesPostfix: - cfg.write("\t\"" + suffix + "\", \n") -cfg.write("};\n") -cfg.write("\n") -cfg.write("InverseZTest = true;\n") -cfg.write("Vegetation = true;\n") -cfg.write("MeterPixelSize = 2;\n") -cfg.write("\n") -cfg.write("CompleteIslandsFile = \"" + ExportBuildDirectory + "/" + CartographerBuildDirectory + "/" + IslandsXmlFile + "\";\n") -cfg.write("EntryPointsFile = \"r2_entry_points.txt\";\n") -cfg.write("\n") -cfg.close() - -log.close() - - -# end of file diff --git a/code/nel/tools/build_gamedata/processes/font/1_export.py b/code/nel/tools/build_gamedata/processes/font/1_export.py deleted file mode 100644 index 0bad904f6..000000000 --- a/code/nel/tools/build_gamedata/processes/font/1_export.py +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/python -# -# \file 1_export.py -# \brief Export font -# \date 2009-03-10-19-43-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export font -# -# NeL - MMORPG Framework -# Copyright (C) 2009-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 . -# - -import time, sys, os, shutil, subprocess, distutils.dir_util -sys.path.append("../../configuration") - -if os.path.isfile("log.log"): - os.remove("log.log") -log = open("log.log", "w") -from scripts import * -from buildsite import * -from process import * -from tools import * -from directories import * - -printLog(log, "") -printLog(log, "-------") -printLog(log, "--- Export font") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -printLog(log, ">>> Export font <<<") -fontExportDir = ExportBuildDirectory + "/" + FontExportDirectory -mkPath(log, fontExportDir) -for dir in FontSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - copyFilesExtNoTreeIfNeeded(log, DatabaseDirectory + "/" + dir, fontExportDir, ".ttf") - copyFilesExtNoTreeIfNeeded(log, DatabaseDirectory + "/" + dir, fontExportDir, ".otf") - copyFilesExtNoTreeIfNeeded(log, DatabaseDirectory + "/" + dir, fontExportDir, ".afm") - copyFilesExtNoTreeIfNeeded(log, DatabaseDirectory + "/" + dir, fontExportDir, ".pfb") - copyFilesExtNoTreeIfNeeded(log, DatabaseDirectory + "/" + dir, fontExportDir, ".pfm") - - -printLog(log, "") - -log.close() - - -# end of file diff --git a/code/nel/tools/build_gamedata/processes/font/3_install.py b/code/nel/tools/build_gamedata/processes/font/3_install.py deleted file mode 100644 index 3d244989a..000000000 --- a/code/nel/tools/build_gamedata/processes/font/3_install.py +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install font -# \date 2009-03-10-19-43-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install font -# -# NeL - MMORPG Framework -# Copyright (C) 2009-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 . -# - -import time, sys, os, shutil, subprocess, distutils.dir_util -sys.path.append("../../configuration") - -if os.path.isfile("log.log"): - os.remove("log.log") -log = open("log.log", "w") -from scripts import * -from buildsite_local import * -from process import * -from tools import * -from directories import * - -printLog(log, "") -printLog(log, "-------") -printLog(log, "--- Install font") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -installPath = InstallDirectory + "/" + FontInstallDirectory -mkPath(log, installPath) -fontExportDir = ExportBuildDirectory + "/" + FontExportDirectory -mkPath(log, fontExportDir) - -printLog(log, ">>> Install font <<<") -copyFilesExtNoTreeIfNeeded(log, fontExportDir, installPath, ".ttf") -copyFilesExtNoTreeIfNeeded(log, fontExportDir, installPath, ".otf") -copyFilesExtNoTreeIfNeeded(log, fontExportDir, installPath, ".afm") -copyFilesExtNoTreeIfNeeded(log, fontExportDir, installPath, ".pfb") -copyFilesExtNoTreeIfNeeded(log, fontExportDir, installPath, ".pfm") - -printLog(log, "") -log.close() - - -# end of file diff --git a/code/nel/tools/build_gamedata/processes/ig/2_build.py b/code/nel/tools/build_gamedata/processes/ig/2_build.py deleted file mode 100644 index 159be465c..000000000 --- a/code/nel/tools/build_gamedata/processes/ig/2_build.py +++ /dev/null @@ -1,275 +0,0 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build ig -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build ig -# -# NeL - MMORPG Framework -# Copyright (C) 2009-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 . -# - -import time, sys, os, shutil, subprocess, distutils.dir_util -sys.path.append("../../configuration") - -if os.path.isfile("log.log"): - os.remove("log.log") -log = open("log.log", "w") -from scripts import * -from buildsite import * -from process import * -from tools import * -from directories import * - -printLog(log, "") -printLog(log, "-------") -printLog(log, "--- Build ig") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# Find tools -ExecTimeout = findTool(log, ToolDirectories, ExecTimeoutTool, ToolSuffix) -PrimExport = findTool(log, ToolDirectories, PrimExportTool , ToolSuffix) -IgElevation = findTool(log, ToolDirectories, IgElevationTool, ToolSuffix) -IgAdd = findTool(log, ToolDirectories, IgAddTool, ToolSuffix) - -configDir = ActiveProjectDirectory + "/generated" -mkPath(log, configDir) - -def igElevation(inputIgDir, outputIgDir): - printLog(log, ">>> IG Elevation <<<") - mkPath(log, inputIgDir) - mkPath(log, outputIgDir) - needUpdateIg = needUpdateDirByTagLog(log, inputIgDir, ".ig", outputIgDir, ".ig") - if needUpdateIg: - printLog(log, "DETECT UPDATE IG->Elevated") - else: - printLog(log, "DETECT SKIP IG->Elevated") - needUpdateHeightMap = needUpdateFileDirNoSubdir(log, DatabaseDirectory + "/" + LigoBaseSourceDirectory + "/" + LigoExportHeightmap1, outputIgDir) or needUpdateFileDirNoSubdir(log, DatabaseDirectory + "/" + LigoBaseSourceDirectory + "/" + LigoExportHeightmap2, outputIgDir) - if needUpdateHeightMap: - printLog(log, "DETECT UPDATE HeightMap->Elevated") - else: - printLog(log, "DETECT SKIP HeightMap->Elevated") - needUpdateLand = needUpdateFileDirNoSubdir(log, DatabaseDirectory + "/" + LigoBaseSourceDirectory + "/" + LigoExportLand, outputIgDir) - if needUpdateLand: - printLog(log, "DETECT UPDATE Land->Elevated") - else: - printLog(log, "DETECT SKIP Land->Elevated") - if needUpdateIg or needUpdateHeightMap or needUpdateLand: - printLog(log, "DETECT DECIDE UPDATE") - mkPath(log, inputIgDir) - mkPath(log, outputIgDir) - mkPath(log, DatabaseDirectory + "/" + LigoBaseSourceDirectory) - - configFile = configDir + "/ig_elevation.cfg" - if os.path.isfile(configFile): - os.remove(configFile) - - printLog(log, "CONFIG " + configFile) - cf = open(configFile, "w") - cf.write("// ig_elevation.cfg\n") - cf.write("\n") - cf.write("InputIGDir = \"" + inputIgDir + "\";\n") - cf.write("OutputIGDir = \"" + outputIgDir + "\";\n") - cf.write("\n") - cf.write("CellSize = 160.0;") - cf.write("\n") - cf.write("HeightMapFile1 = \"" + DatabaseDirectory + "/" + LigoBaseSourceDirectory + "/" + LigoExportHeightmap1 + "\";\n") - cf.write("ZFactor1 = " + LigoExportZFactor1 + ";\n") - cf.write("HeightMapFile2 = \"" + DatabaseDirectory + "/" + LigoBaseSourceDirectory + "/" + LigoExportHeightmap2 + "\";\n") - cf.write("ZFactor2 = " + LigoExportZFactor2 + ";\n") - cf.write("ExtendCoords = " + str(LigoExportExtendCoords) + ";\n") - cf.write("\n") - cf.write("LandFile = \"" + DatabaseDirectory + "/" + LigoBaseSourceDirectory + "/" + LigoExportLand + "\";\n") - cf.write("\n") - cf.close() - subprocess.call([ IgElevation, configFile ]) - os.remove(configFile) - - # Copy remaining IG files - #BUG:copyFilesLogless(log, inputIgDir, outputIgDir) - else: - printLog(log, "DETECT DECIDE SKIP") - printLog(log, "SKIP *") - -# Build process -if (ContinentLeveldesignWorldDirectory != "") or (len(IgOtherSourceDirectories) > 0): - printLog(log, ">>> Prim IG: ON <<<") - configFile = configDir + "/prim_export.cfg" - if os.path.isfile(configFile): - os.remove(configFile) - - outIgDir = ExportBuildDirectory + "/" + IgElevLandPrimBuildDirectory - mkPath(log, outIgDir) - zoneWDir = ExportBuildDirectory + "/" + ZoneWeldBuildDirectory - mkPath(log, zoneWDir) - smallBank = DatabaseDirectory + "/" + TileRootSourceDirectory + "/" + BankTileBankName + ".bank" - farBank = ExportBuildDirectory + "/" + FarbankBuildDirectory + "/" + BankTileBankName + MultipleTilesPostfix[0] + ".farbank" - displaceDir = DatabaseDirectory + "/" + DisplaceSourceDirectory - continentDir = LeveldesignWorldDirectory + "/" + ContinentLeveldesignWorldDirectory - mkPath(log, continentDir) - formDir = LeveldesignDirectory - mkPath(log, LeveldesignDirectory) - worldEditorFiles = WorldEditorFilesDirectory - mkPath(log, WorldEditorFilesDirectory) - - printLog(log, "CONFIG " + configFile) - cf = open(configFile, "w") - cf.write("// prim_export.cfg\n") - cf.write("\n") - cf.write("OutIGDir = \"" + outIgDir + "\";\n") - cf.write("ZoneWDir = \"" + zoneWDir + "\";\n") - cf.write("\n") - cf.write("SmallBank = \"" + smallBank + "\";\n") - cf.write("FarBank = \"" + farBank + "\";\n") - cf.write("DisplaceDir = \"" + displaceDir + "\";\n") - cf.write("\n") - cf.write("CellSize = 160.0;") - cf.write("\n") - cf.write("PrimDirs = {\n") - cf.write("\t\"" + continentDir + "\", \n") - for dir in IgPrimitiveSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - cf.write("\t\"" + DatabaseDirectory + "/" + dir + "\", \n") - cf.write("};\n") - cf.write("\n") - cf.write("FormDir = \"" + formDir + "\";\n") - cf.write("WorldEditorFiles = \"" + worldEditorFiles + "\";\n") - cf.write("\n") - cf.close() - subprocess.call([ PrimExport, configFile ]) - os.remove(configFile) - - igElevation(ExportBuildDirectory + "/" + LigoIgLandBuildDirectory, ExportBuildDirectory + "/" + IgElevLandLigoBuildDirectory) - - igElevation(ExportBuildDirectory + "/" + IgStaticLandExportDirectory, ExportBuildDirectory + "/" + IgElevLandStaticBuildDirectory) - -printLog(log, ">>> Merge land IGs <<<") -mkPath(log, ExportBuildDirectory + "/" + IgTempLandMergeBuildDirectory) -removeFilesRecursive(log, ExportBuildDirectory + "/" + IgTempLandMergeBuildDirectory) - -mkPath(log, ExportBuildDirectory + "/" + IgLandBuildDirectory) - -mkPath(log, ExportBuildDirectory + "/" + IgElevLandPrimBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + IgElevLandLigoBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + IgElevLandStaticBuildDirectory) -igFilesPrim = findFiles(log, ExportBuildDirectory + "/" + IgElevLandPrimBuildDirectory, "", ".ig") -igFilesLigo = findFiles(log, ExportBuildDirectory + "/" + IgElevLandLigoBuildDirectory, "", ".ig") -igFilesStatic = findFiles(log, ExportBuildDirectory + "/" + IgElevLandStaticBuildDirectory, "", ".ig") -igFilesAll = [ ] -for igFile in igFilesPrim: - if not igFile in igFilesAll: - igFilesAll += [ igFile ] -for igFile in igFilesLigo: - if not igFile in igFilesAll: - igFilesAll += [ igFile ] -for igFile in igFilesStatic: - if not igFile in igFilesAll: - igFilesAll += [ igFile ] -igFilesAll.sort() -for igFile in igFilesAll: - primIgFile = ExportBuildDirectory + "/" + IgElevLandPrimBuildDirectory + "/" + igFile - ligoIgFile = ExportBuildDirectory + "/" + IgElevLandLigoBuildDirectory + "/" + igFile - staticIgFile = ExportBuildDirectory + "/" + IgElevLandStaticBuildDirectory + "/" + igFile - tempIgFile = ExportBuildDirectory + "/" + IgTempLandMergeBuildDirectory + "/" + igFile - outIgFile = ExportBuildDirectory + "/" + IgLandBuildDirectory + "/" + igFile - activeFile = "" - needsUpdate = 0 - sourceTools = "" - if igFile in igFilesPrim: - if needUpdate(log, primIgFile, outIgFile): - needsUpdate = 1 - if not needsUpdate == 1 and igFile in igFilesLigo: - if needUpdate(log, ligoIgFile, outIgFile): - needsUpdate = 1 - if not needsUpdate == 1 and igFile in igFilesStatic: - if needUpdate(log, staticIgFile, outIgFile): - needsUpdate = 1 - if needsUpdate == 1: - if os.path.isfile(outIgFile): - os.remove(outIgFile) - if igFile in igFilesPrim: - sourceTools += " [Prim]" - activeFile = primIgFile - if igFile in igFilesLigo: - if activeFile == "": - activeFile = ligoIgFile - else: - sourceTools += " [Ligo]" - subprocess.call([ IgAdd, tempIgFile, ligoIgFile, activeFile ]) - activeFile = tempIgFile - if igFile in igFilesStatic: - if activeFile == "": - activeFile = staticIgFile - else: - sourceTools += " [Static]" - subprocess.call([ IgAdd, outIgFile, staticIgFile, activeFile ]) - activeFile = outIgFile - else: - shutil.copy(activeFile, outIgFile) - printLog(log, "MERGE " + igFile + sourceTools) - else: - printLog(log, "SKIP " + igFile) - -# Remove temporary land IGs -printLog(log, ">>> Remove temporary land IGs <<<") -mkPath(log, ExportBuildDirectory + "/" + IgTempLandMergeBuildDirectory) -removeFilesRecursive(log, ExportBuildDirectory + "/" + IgTempLandMergeBuildDirectory) - -# Remove outdated land IGs -printLog(log, ">>> Remove outdated land IGs <<<") -igFilesOut = findFiles(log, ExportBuildDirectory + "/" + IgLandBuildDirectory, "", ".ig") -for igFile in igFilesOut: - if not igFile in igFilesAll: - printLog(log, "RM " + ExportBuildDirectory + "/" + IgLandBuildDirectory + "/" + igFile) - os.remove(ExportBuildDirectory + "/" + IgLandBuildDirectory + "/" + igFile) - -# Verify land IGs -printLog(log, ">>> Verify land IGs <<<") -for igFile in igFilesAll: - if not igFile in igFilesOut: - printLog(log, "MISSING " + igFile) - -# Write land IGs TXT -printLog(log, ">>> Write land IGs TXT <<<") -igTxtFile = ExportBuildDirectory + "/" + IgLandBuildDirectory + "/" + LandscapeName + "_ig.txt" -if needUpdateDirNoSubdirFile(log, ExportBuildDirectory + "/" + IgLandBuildDirectory, igTxtFile): - printLog(log, "WRITE " + ExportBuildDirectory + "/" + IgLandBuildDirectory + "/" + LandscapeName + "_ig.txt") - if os.path.isfile(igTxtFile): - os.remove(igTxtFile) - igTxt = open(igTxtFile, "w") - for igFile in igFilesAll: - igTxt.write(igFile + "\n") - igTxt.close() -else: - printLog(log, "SKIP *") - -# Merge other IGs -printLog(log, ">>> Merge other IGs <<<") # (not true merge, since not necesserary) -mkPath(log, ExportBuildDirectory + "/" + IgStaticOtherExportDirectory) -mkPath(log, ExportBuildDirectory + "/" + LigoIgOtherBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + IgOtherBuildDirectory) -# copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + IgStaticOtherExportDirectory, ExportBuildDirectory + "/" + IgOtherBuildDirectory, ".ig") -igElevation(ExportBuildDirectory + "/" + IgStaticOtherExportDirectory, ExportBuildDirectory + "/" + IgOtherBuildDirectory) -copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + LigoIgOtherBuildDirectory, ExportBuildDirectory + "/" + IgOtherBuildDirectory, ".ig") - -log.close() - - -# end of file diff --git a/code/nel/tools/build_gamedata/processes/ligo/0_setup.py b/code/nel/tools/build_gamedata/processes/ligo/0_setup.py deleted file mode 100644 index 18d5ea6f7..000000000 --- a/code/nel/tools/build_gamedata/processes/ligo/0_setup.py +++ /dev/null @@ -1,121 +0,0 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief setup ligo -# \date 2010-05-24 08:13GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup ligo -# -# NeL - MMORPG Framework -# Copyright (C) 2009-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 . -# - -import time, sys, os, shutil, subprocess, distutils.dir_util -sys.path.append("../../configuration") - -if os.path.isfile("log.log"): - os.remove("log.log") -log = open("log.log", "w") -from scripts import * -from buildsite import * -from process import * -from tools import * -from directories import * - -printLog(log, "") -printLog(log, "-------") -printLog(log, "--- Setup ligo") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# Setup source directories -printLog(log, ">>> Setup source directories <<<") -mkPath(log, DatabaseDirectory + "/" + LigoBaseSourceDirectory) -mkPath(log, DatabaseDirectory + "/" + LigoMaxSourceDirectory) -mkPath(log, DatabaseDirectory + "/" + ZoneSourceDirectory[0]) - -# Setup export directories -printLog(log, ">>> Setup export directories <<<") -mkPath(log, ExportBuildDirectory + "/" + SmallbankExportDirectory) -mkPath(log, ExportBuildDirectory + "/" + LigoEcosystemExportDirectory) -mkPath(log, ExportBuildDirectory + "/" + LigoEcosystemIgExportDirectory) -mkPath(log, ExportBuildDirectory + "/" + LigoEcosystemZoneExportDirectory) -mkPath(log, ExportBuildDirectory + "/" + LigoEcosystemZoneLigoExportDirectory) -mkPath(log, ExportBuildDirectory + "/" + LigoEcosystemCmbExportDirectory) -mkPath(log, ExportBuildDirectory + "/" + LigoEcosystemTagExportDirectory) -mkPath(log, ExportBuildDirectory + "/" + ZoneExportDirectory) - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") -if LigoExportLand != "": - mkPath(log, ExportBuildDirectory + "/" + LigoZoneBuildDirectory) - mkPath(log, ExportBuildDirectory + "/" + LigoIgLandBuildDirectory) - mkPath(log, ExportBuildDirectory + "/" + LigoIgOtherBuildDirectory) - mkPath(log, ExportBuildDirectory + "/" + RBankCmbExportDirectory) - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") - -# Setup land exporter cfg -if LigoExportLand != "": - printLog(log, ">>> Setup land exporter cfg <<<") - mkPath(log, ActiveProjectDirectory + "/generated") - cf = open(ActiveProjectDirectory + "/generated/land_exporter.cfg", "w") - cf.write("\n") - cf.write("// Ligo settings\n") - cf.write("\n") - cf.write("OutZoneDir = \"" + ExportBuildDirectory + "/" + LigoZoneBuildDirectory + "\";\n") - cf.write("OutIGDir = \"" + ExportBuildDirectory + "/" + LigoIgLandBuildDirectory + "\";\n") - cf.write("AdditionnalIGOutDir = \"" + ExportBuildDirectory + "/" + LigoIgOtherBuildDirectory + "\";\n") - cf.write("\n") - cf.write("RefZoneDir = \"" + ExportBuildDirectory + "/" + LigoEcosystemZoneExportDirectory+ "\";\n") # FIXME - cf.write("RefIGDir = \"" + ExportBuildDirectory + "/" + LigoEcosystemIgExportDirectory + "\";\n") - cf.write("AdditionnalIGInDir = \"" + ExportBuildDirectory + "/" + LigoEcosystemIgExportDirectory + "\";\n") # FIXME - cf.write("ContinentsDir = \"" + LeveldesignWorldDirectory + "\";\n") - cf.write("LigoBankDir = \"" + ExportBuildDirectory + "/" + LigoEcosystemZoneLigoExportDirectory + "\";\n") # FIXME - cf.write("\n") - cf.write("TileBankFile = \"" + DatabaseDirectory + "/" + LigoTileBankFile + "\";\n") - cf.write("\n") - cf.write("ColorMapFile = \"" + DatabaseDirectory + "/" + LigoBaseSourceDirectory + "/" + LigoExportColormap + "\";\n") - cf.write("HeightMapFile1 = \"" + DatabaseDirectory + "/" + LigoBaseSourceDirectory + "/" + LigoExportHeightmap1 + "\";\n") - cf.write("ZFactor1 = " + LigoExportZFactor1 + ";\n") - cf.write("HeightMapFile2 = \"" + DatabaseDirectory + "/" + LigoBaseSourceDirectory + "/" + LigoExportHeightmap2 + "\";\n") - cf.write("ZFactor2 = " + LigoExportZFactor2 + ";\n") - cf.write("ExtendCoords = " + str(LigoExportExtendCoords) + ";\n") - cf.write("\n") - cf.write("ZoneLight = 0;\n") - cf.write("CellSize = 160;\n") - cf.write("Threshold = 1;\n") - cf.write("\n") - cf.write("DFNDir = \"" + LeveldesignDfnDirectory + "\";\n") - cf.write("RefCMBDir = \"" + ExportBuildDirectory + "/" + LigoEcosystemCmbExportDirectory + "\";\n") # FIXME - cf.write("OutCMBDir = \"" + ExportBuildDirectory + "/" + RBankCmbExportDirectory + "\";\n") - cf.write("\n") - cf.write("ContinentFile = \"" + LeveldesignWorldDirectory + "/" + ContinentFile + "\";\n") - cf.write("\n") - cf.write("ExportCollisions = 1;\n") - cf.write("ExportAdditionnalIGs = 1;\n") - cf.write("\n") - cf.write("ZoneRegionFile = \"" + DatabaseDirectory + "/" + LigoBaseSourceDirectory + "/" + LigoExportLand + "\";\n") - cf.write("\n") - cf.close() - -log.close() - - -# end of file diff --git a/code/nel/tools/build_gamedata/processes/rbank/2_build.py b/code/nel/tools/build_gamedata/processes/rbank/2_build.py deleted file mode 100644 index 1f872b968..000000000 --- a/code/nel/tools/build_gamedata/processes/rbank/2_build.py +++ /dev/null @@ -1,339 +0,0 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build rbank -# \date 2009-03-10-22-43-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build rbank -# -# NeL - MMORPG Framework -# Copyright (C) 2009-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 . -# - -import time, sys, os, shutil, subprocess, distutils.dir_util -sys.path.append("../../configuration") - -if os.path.isfile("log.log"): - os.remove("log.log") -log = open("log.log", "w") -from scripts import * -from buildsite import * -from process import * -from tools import * -from directories import * - -printLog(log, "") -printLog(log, "-------") -printLog(log, "--- Build rbank") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# Find tools -BuildIgBoxes = findTool(log, ToolDirectories, BuildIgBoxesTool, ToolSuffix) -ExecTimeout = findTool(log, ToolDirectories, ExecTimeoutTool, ToolSuffix) -BuildRbank = findTool(log, ToolDirectories, BuildRbankTool, ToolSuffix) -GetNeighbors = findTool(log, ToolDirectories, GetNeighborsTool, ToolSuffix) -BuildIndoorRbank = findTool(log, ToolDirectories, BuildIndoorRbankTool, ToolSuffix) -# AiBuildWmap = findTool(log, ToolDirectories, AiBuildWmapTool, ToolSuffix) -printLog(log, "") - -# Build rbank bbox -printLog(log, ">>> Build rbank bbox <<<") -tempBbox = ExportBuildDirectory + "/" + RbankBboxBuildDirectory + "/temp.bbox" -rebuiltBbox = False -if BuildIgBoxes == "": - toolLogFail(log, BuildIgBoxesTool, ToolSuffix) -else: - mkPath(log, ExportBuildDirectory + "/" + RbankBboxBuildDirectory) - needUpdateIg = needUpdateMultiDirNoSubdirFile(log, ExportBuildDirectory, IgLookupDirectories, tempBbox) - if needUpdateIg: - printLog(log, "DETECT UPDATE IG->Bbox") - else: - printLog(log, "DETECT SKIP IG->Bbox") - needUpdateShape = needUpdateMultiDirNoSubdirFile(log, ExportBuildDirectory, ShapeLookupDirectories, tempBbox) - if needUpdateShape: - printLog(log, "DETECT UPDATE Shape->Bbox") - else: - printLog(log, "DETECT SKIP Shape->Bbox") - if needUpdateIg or needUpdateShape: - rebuiltBbox = True - printLog(log, "DETECT DECIDE UPDATE") - cf = open("build_ig_boxes.cfg", "w") - cf.write("\n") - cf.write("Pathes = {\n") - for dir in IgLookupDirectories: - mkPath(log, ExportBuildDirectory + "/" + dir) - cf.write("\t\"" + ExportBuildDirectory + "/" + dir + "\", \n") - for dir in ShapeLookupDirectories: - mkPath(log, ExportBuildDirectory + "/" + dir) - cf.write("\t\"" + ExportBuildDirectory + "/" + dir + "\", \n") - cf.write("};\n") - cf.write("\n") - cf.write("IGs = {\n") - for dir in IgLookupDirectories: - files = findFiles(log, ExportBuildDirectory + "/" + dir, "", ".ig") - for file in files: - cf.write("\t\"" + os.path.basename(file)[0:-len(".ig")] + "\", \n") - cf.write("};\n") - cf.write("\n") - cf.write("Output = \"" + tempBbox + "\";\n") - cf.write("\n") - cf.close() - subprocess.call([ BuildIgBoxes ]) - os.remove("build_ig_boxes.cfg") - else: - printLog(log, "DETECT DECIDE SKIP") - printLog(log, "SKIP *") -printLog(log, "") - -printLog(log, ">>> Build rbank build config <<<") -cf = open("build_rbank.cfg", "w") -cf.write("\n") -cf.write("// Rbank settings\n") -cf.write("\n") -cf.write("Verbose = " + str(RBankVerbose) + ";\n") -cf.write("CheckConsistency = " + str(RBankConsistencyCheck) + ";\n") -mkPath(log, ExportBuildDirectory + "/" + ZoneWeldBuildDirectory) -cf.write("ZonePath = \"" + ExportBuildDirectory + "/" + ZoneWeldBuildDirectory + "/\";\n") -mkPath(log, ExportBuildDirectory + "/" + SmallbankExportDirectory) -cf.write("BanksPath = \"" + ExportBuildDirectory + "/" + SmallbankExportDirectory + "/\";\n") -cf.write("Bank = \"" + ExportBuildDirectory + "/" + SmallbankExportDirectory + "/" + BankTileBankName + ".smallbank\";\n") -cf.write("ZoneExt = \".zonew\";\n") -cf.write("ZoneNHExt = \".zonenhw\";\n") -cf.write("IGBoxes = \"" + tempBbox + "\";\n") -mkPath(log, LeveldesignWorldDirectory) -cf.write("LevelDesignWorldPath = \"" + LeveldesignWorldDirectory + "\";\n") -mkPath(log, ExportBuildDirectory + "/" + IgLandBuildDirectory) -cf.write("IgLandPath = \"" + ExportBuildDirectory + "/" + IgLandBuildDirectory + "\";\n") -mkPath(log, ExportBuildDirectory + "/" + IgOtherBuildDirectory) -cf.write("IgVillagePath = \"" + ExportBuildDirectory + "/" + IgOtherBuildDirectory + "\";\n") -cf.write("\n") -mkPath(log, ExportBuildDirectory + "/" + RbankTessellationBuildDirectory) -cf.write("TessellationPath = \"" + ExportBuildDirectory + "/" + RbankTessellationBuildDirectory + "/\";\n") -cf.write("TessellateLevel = " + str(BuildQuality) + ";\n") # BuildQuality -cf.write("\n") -cf.write("WaterThreshold = 1.0;\n") -cf.write("\n") -cf.write("OutputRootPath = \"" + ExportBuildDirectory + "/\";\n") -mkPath(log, ExportBuildDirectory + "/" + RbankSmoothBuildDirectory) -cf.write("SmoothDirectory = \"" + RbankSmoothBuildDirectory + "/\";\n") -mkPath(log, ExportBuildDirectory + "/" + RbankRawBuildDirectory) -cf.write("RawDirectory = \"" + RbankRawBuildDirectory + "/\";\n") -cf.write("\n") -cf.write("ReduceSurfaces = " + str(RbankReduceSurfaces) + ";\n") -cf.write("SmoothBorders = " + str(RbankSmoothBorders) + ";\n") -cf.write("\n") -cf.write("ComputeElevation = " + str(RbankComputeElevation) + ";\n") -cf.write("ComputeLevels = " + str(RbankComputeLevels) + ";\n") -cf.write("\n") -cf.write("LinkElements = " + str(RbankLinkElements) + ";\n") -cf.write("\n") -cf.write("CutEdges = " + str(RbankCutEdges) + ";\n") -cf.write("\n") -cf.write("UseZoneSquare = " + str(RbankUseZoneSquare) + ";\n") -cf.write("\n") -cf.write("// The whole landscape\n") -cf.write("ZoneUL = \"" + RbankZoneUl + "\";\n") -cf.write("ZoneDR = \"" + RbankZoneDr + "\";\n") -cf.write("\n") -mkPath(log, ExportBuildDirectory + "/" + RbankPreprocBuildDirectory) -cf.write("PreprocessDirectory = \"" + ExportBuildDirectory + "/" + RbankPreprocBuildDirectory + "/\";\n") -cf.write("\n") -cf.write("// The global retriever processing settings\n") -cf.write("GlobalRetriever = \"temp.gr\";\n") -cf.write("RetrieverBank = \"temp.rbank\";\n") -cf.write("\n") -cf.write("GlobalUL = \"" + RbankZoneUl + "\";\n") -cf.write("GlobalDR = \"" + RbankZoneDr + "\";\n") -cf.write("\n") -cf.write("// Which kind of stuff to do\n") -cf.write("TessellateZones = 0;\n") -cf.write("MoulineZones = 0;\n") -cf.write("ProcessRetrievers = 0;\n") -cf.write("ProcessGlobal = 0;\n") -cf.write("\n") -cf.write("Zones = {\n") -mkPath(log, ExportBuildDirectory + "/" + ZoneWeldBuildDirectory) -files = findFiles(log, ExportBuildDirectory + "/" + ZoneWeldBuildDirectory, "", ".zonew") -for file in files: - cf.write("\t\"" + os.path.basename(file) + "\", \n") -cf.write("};\n") -cf.write("\n") -cf.write("Pathes = {\n") -mkPath(log, WorldEditorFilesDirectory); -cf.write("\t\"" + WorldEditorFilesDirectory + "\", \n"); -for dir in IgLookupDirectories: - mkPath(log, ExportBuildDirectory + "/" + dir) - cf.write("\t\"" + ExportBuildDirectory + "/" + dir + "\", \n") -for dir in ShapeLookupDirectories: - mkPath(log, ExportBuildDirectory + "/" + dir) - cf.write("\t\"" + ExportBuildDirectory + "/" + dir + "\", \n") -cf.write("};\n") -cf.write("\n") -cf.close() -printLog(log, "") - -printLog(log, ">>> Build rbank check prims <<<") -if BuildRbank == "": - toolLogFail(log, BuildRbankTool, ToolSuffix) -elif ExecTimeout == "": - toolLogFail(log, ExecTimeoutTool, ToolSuffix) -else: - subprocess.call([ ExecTimeout, str(RbankBuildTesselTimeout), BuildRbank, "-C", "-p", "-g" ]) -printLog(log, "") - -printLog(log, ">>> Build rbank process all passes <<<") -if BuildRbank == "": - toolLogFail(log, BuildRbankTool, ToolSuffix) -if GetNeighbors == "": - toolLogFail(log, GetNeighborsTool, ToolSuffix) -elif ExecTimeout == "": - toolLogFail(log, ExecTimeoutTool, ToolSuffix) -else: - zonefiles = findFiles(log, ExportBuildDirectory + "/" + ZoneWeldBuildDirectory, "", ".zonew") - zonesToBuild = [] - for zonefile in zonefiles: - zone = os.path.basename(zonefile)[0:-len(".zonew")] - lr1 = ExportBuildDirectory + "/" + RbankSmoothBuildDirectory + "/" + zone + ".lr" - nearzones = subprocess.Popen([ GetNeighbors, zone ], stdout = subprocess.PIPE).communicate()[0].strip().split(" ") - printLog(log, "ZONE " + zone + ": " + str(nearzones)) - zoneToBuild = 0 - for nearzone in nearzones: - sourcePath = ExportBuildDirectory + "/" + ZoneWeldBuildDirectory + "/" + nearzone + ".zonew" - if (os.path.isfile(sourcePath)): - if (rebuiltBbox or needUpdate(log, sourcePath, lr1)): - zoneToBuild = 1 - zonesToBuild.append(os.path.basename(zonefile)) - sourcePath = ExportBuildDirectory + "/" + ZoneWeldBuildDirectory + "/" + zone + ".zonew" - if zoneToBuild: - printLog(log, sourcePath + " -> " + lr1) - # subprocess.call([ ExecTimeout, str(RbankBuildTesselTimeout), BuildRbank, "-c", "-P", "-g", os.path.basename(zonefile) ]) - else: - printLog(log, "SKIP " + lr1) - while len(zonesToBuild) > 0: - processCommand = [ ExecTimeout, str(RbankBuildTesselTimeout), BuildRbank, "-c", "-P", "-g" ] - processCommand.extend(zonesToBuild[:min(len(zonesToBuild), 64)]) - if len(zonesToBuild) > 64: - zonesToBuild = zonesToBuild[64:] - else: - zonesToBuild = [] - print processCommand - callParallelProcess(processCommand) - flushParallelProcesses() -printLog(log, "") - -printLog(log, ">>> Detect modifications to rebuild lr <<<") -needUpdateCmbLr = needUpdateDirByTagLog(log, ExportBuildDirectory + "/" + RBankCmbExportDirectory, ".cmb", ExportBuildDirectory + "/" + RbankRetrieversBuildDirectory, ".lr") -if needUpdateCmbLr: - printLog(log, "DETECT UPDATE Cmb->Lr") -else: - printLog(log, "DETECT SKIP Cmb->Lr") -needUpdateCmbRbank = needUpdateDirNoSubdirFile(log, ExportBuildDirectory + "/" + RBankCmbExportDirectory, ExportBuildDirectory + "/" + RbankOutputBuildDirectory + "/" + RbankRbankName + ".rbank") -if needUpdateCmbRbank: - printLog(log, "DETECT UPDATE Cmb->Rbank") -else: - printLog(log, "DETECT SKIP Cmb->Rbank") -needUpdateLrRbank = needUpdateDirNoSubdirFile(log, ExportBuildDirectory + "/" + RbankSmoothBuildDirectory, ExportBuildDirectory + "/" + RbankOutputBuildDirectory + "/" + RbankRbankName + ".rbank") -if needUpdateLrRbank: - printLog(log, "DETECT UPDATE Lr->Rbank") -else: - printLog(log, "DETECT SKIP Lr->Rbank") -needUpdateBboxRbank = needUpdate(log, tempBbox, ExportBuildDirectory + "/" + RbankOutputBuildDirectory + "/" + RbankRbankName + ".rbank") -if needUpdateBboxRbank: - printLog(log, "DETECT UPDATE Lr->Rbank") -else: - printLog(log, "DETECT SKIP Lr->Rbank") - -if rebuiltBbox or needUpdateCmbLr or needUpdateCmbRbank or needUpdateLrRbank or needUpdateBboxRbank: - printLog(log, "DETECT DECIDE UPDATE") - printLog(log, ">>> Build rbank process global <<<") # This generates temp lr files. TODO: Check if the LR changed? - if BuildRbank == "": - toolLogFail(log, BuildRbankTool, ToolSuffix) - elif ExecTimeout == "": - toolLogFail(log, ExecTimeoutTool, ToolSuffix) - else: - subprocess.call([ ExecTimeout, str(RbankBuildProcglobalTimeout), BuildRbank, "-c", "-P", "-G" ]) - printLog(log, "") - os.remove("build_rbank.cfg") - - printLog(log, ">>> Build rbank indoor <<<") # This generates the retrievers for the ig that have the cmb export - if BuildIndoorRbank == "": - toolLogFail(log, BuildIndoorRbankTool, ToolSuffix) - elif ExecTimeout == "": - toolLogFail(log, ExecTimeoutTool, ToolSuffix) - else: - retrieversDir = ExportBuildDirectory + "/" + RbankRetrieversBuildDirectory - mkPath(log, retrieversDir) - removeFilesRecursiveExt(log, retrieversDir, ".rbank") - removeFilesRecursiveExt(log, retrieversDir, ".gr") - removeFilesRecursiveExt(log, retrieversDir, ".lr") - cf = open("build_indoor_rbank.cfg", "w") - cf.write("\n") - mkPath(log, ExportBuildDirectory + "/" + RBankCmbExportDirectory) - cf.write("MeshPath = \"" + ExportBuildDirectory + "/" + RBankCmbExportDirectory + "/\";\n") - # cf.write("Meshes = { };\n") - cf.write("Meshes = \n") - cf.write("{\n") - meshFiles = findFilesNoSubdir(log, ExportBuildDirectory + "/" + RBankCmbExportDirectory, ".cmb") - lenCmbExt = len(".cmb") - for file in meshFiles: - cf.write("\t\"" + file[0:-lenCmbExt] + "\", \n") - cf.write("};\n") - cf.write("OutputPath = \"" + retrieversDir + "/\";\n") - # mkPath(log, ExportBuildDirectory + "/" + RbankOutputBuildDirectory) - # cf.write("OutputPath = \"" + ExportBuildDirectory + "/" + RbankOutputBuildDirectory + "/\";\n") - cf.write("OutputPrefix = \"unused\";\n") - cf.write("Merge = 1;\n") - mkPath(log, ExportBuildDirectory + "/" + RbankSmoothBuildDirectory) - cf.write("MergePath = \"" + ExportBuildDirectory + "/" + RbankSmoothBuildDirectory + "/\";\n") - cf.write("MergeInputPrefix = \"temp\";\n") - cf.write("MergeOutputPrefix = \"tempMerged\";\n") - # cf.write("MergeOutputPrefix = \"" + RbankRbankName + "\";\n") - cf.write("AddToRetriever = 1;\n") - cf.write("\n") - cf.close() - subprocess.call([ ExecTimeout, str(RbankBuildIndoorTimeout), BuildIndoorRbank ]) - os.remove("build_indoor_rbank.cfg") - printLog(log, "") - - retrieversDir = ExportBuildDirectory + "/" + RbankRetrieversBuildDirectory - mkPath(log, retrieversDir) - outputDir = ExportBuildDirectory + "/" + RbankOutputBuildDirectory - mkPath(log, outputDir) - printLog(log, ">>> Move gr, rbank and lr <<<") # This simply renames everything - if needUpdateDirNoSubdir(log, retrieversDir, outputDir): - removeFilesRecursiveExt(log, outputDir, ".rbank") - removeFilesRecursiveExt(log, outputDir, ".gr") - removeFilesRecursiveExt(log, outputDir, ".lr") - copyFilesRenamePrefixExt(log, retrieversDir, outputDir, "tempMerged", RbankRbankName, ".rbank") - copyFilesRenamePrefixExt(log, retrieversDir, outputDir, "tempMerged", RbankRbankName, ".gr") - copyFilesRenamePrefixExt(log, retrieversDir, outputDir, "tempMerged_", RbankRbankName + "_", ".lr") - else: - printLog(log, "SKIP *") -else: - printLog(log, "DETECT DECIDE SKIP") - printLog(log, "SKIP *") - -# Remove pacs.packed_prims when done -if os.path.isfile("pacs.packed_prims"): - os.remove("pacs.packed_prims") - -log.close() - - -# end of file diff --git a/code/nel/tools/build_gamedata/processes/shape/2_build.py b/code/nel/tools/build_gamedata/processes/shape/2_build.py deleted file mode 100644 index 3881a35ec..000000000 --- a/code/nel/tools/build_gamedata/processes/shape/2_build.py +++ /dev/null @@ -1,198 +0,0 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build shape -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build shape -# -# NeL - MMORPG Framework -# Copyright (C) 2009-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 . -# - -import time, sys, os, shutil, subprocess, distutils.dir_util -sys.path.append("../../configuration") - -if os.path.isfile("log.log"): - os.remove("log.log") -log = open("log.log", "w") -from scripts import * -from buildsite import * -from process import * -from tools import * -from directories import * - -printLog(log, "") -printLog(log, "-------") -printLog(log, "--- Build shape") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# Find tools -ExecTimeout = findTool(log, ToolDirectories, ExecTimeoutTool, ToolSuffix) -BuildShadowSkin = findTool(log, ToolDirectories, BuildShadowSkinTool, ToolSuffix) -BuildClodtex = findTool(log, ToolDirectories, BuildClodtexTool, ToolSuffix) -LightmapOptimizer = findTool(log, ToolDirectories, LightmapOptimizerTool, ToolSuffix) -TgaToDds = findTool(log, ToolDirectories, TgaToDdsTool, ToolSuffix) -BuildCoarseMesh = findTool(log, ToolDirectories, BuildCoarseMeshTool, ToolSuffix) - -shapeDirectory = ExportBuildDirectory + "/" + ShapeNotOptimizedExportDirectory -if BuildShadowSkinEnabled: - mkPath(log, shapeDirectory) - shadowSkinBuildDirectory = ExportBuildDirectory + "/" + ShapeShadowSkinBuildDirectory - printLog(log, ">>> BuildShadowSkin <<<") - shadowSkinShapes = findFilesNoSubdir(log, shapeDirectory, ".shape") - for shadowSkinShape in shadowSkinShapes: - srcShape = shapeDirectory + "/" + shadowSkinShape - dstShape = shadowSkinBuildDirectory + "/" + shadowSkinShape - if needUpdateLogRemoveDest(log, srcShape, dstShape): - subprocess.call([ BuildShadowSkin, srcShape, dstShape, str(BuildShadowSkinRatio), str(BuildShadowSkinMaxface) ]) - shapeDirectory = shadowSkinBuildDirectory - -mkPath(log, shapeDirectory) -mkPath(log, ExportBuildDirectory + "/" + ShapeClodtexBuildDirectory) -if ClodConfigFile != "": - mkPath(log, ExportBuildDirectory + "/" + ClodExportDirectory) - printLog(log, ">>> Build CLodTex <<<") - subprocess.call([ BuildClodtex, "-d", DatabaseDirectory + "/" + ClodConfigFile, ExportBuildDirectory + "/" + ClodExportDirectory, shapeDirectory, ExportBuildDirectory + "/" + ShapeClodtexBuildDirectory ]) -else: - printLog(log, ">>> Copy Shape <<<") - copyFilesExtNoTreeIfNeeded(log, shapeDirectory, ExportBuildDirectory + "/" + ShapeClodtexBuildDirectory, ".shape") - -printLog(log, ">>> Copy non-ShadowSkin non-CLodTex Shape <<<") -shapeDirectory = ExportBuildDirectory + "/" + ShapeNotOptimizedExportDirectory -mkPath(log, shapeDirectory) -mkPath(log, ExportBuildDirectory + "/" + ShapeClodtexBuildDirectory) -copyFilesExtNoTreeIfNeeded(log, shapeDirectory, ExportBuildDirectory + "/" + ShapeClodtexBuildDirectory, ".shape") -shapeDirectory = ExportBuildDirectory + "/" + ShapeClodtexBuildDirectory - -# copy lightmap_not_optimized to lightmap -printLog(log, ">>> Optimize lightmaps <<<") -loPathLightmapsOriginal = ExportBuildDirectory + "/" + ShapeLightmapNotOptimizedExportDirectory -loPathShapesOriginal = ExportBuildDirectory + "/" + ShapeClodtexBuildDirectory -mkPath(log, loPathLightmapsOriginal) -loPathLightmaps = ExportBuildDirectory + "/" + ShapeLightmapBuildDirectory -loPathShapes = ExportBuildDirectory + "/" + ShapeOptimizedBuildDirectory -loPathTags = ExportBuildDirectory + "/" + ShapeTagExportDirectory -mkPath(log, loPathLightmaps) -mkPath(log, loPathShapes) -mkPath(log, loPathTags) -if needUpdateDirByTagLog(log, loPathLightmapsOriginal, ".txt", loPathLightmaps, ".txt") or needUpdateDirNoSubdir(log, loPathLightmapsOriginal, loPathLightmaps) or needUpdateDirNoSubdir(log, loPathShapesOriginal, loPathShapes) or needUpdateDirNoSubdir(log, loPathShapes, loPathLightmaps) or needUpdateDirNoSubdir(log, loPathTags, loPathLightmaps): - removeFilesRecursive(log, loPathLightmaps) - copyFiles(log, loPathLightmapsOriginal, loPathLightmaps) - removeFilesRecursive(log, loPathShapes) - copyFiles(log, loPathShapesOriginal, loPathShapes) - # Optimize lightmaps if any. Additionnaly, output a file indicating which lightmaps are 8 bits - # lightmap_optimizer [path_tags] [path_flag8bit] - subprocess.call([ LightmapOptimizer, loPathLightmaps, loPathShapes, loPathTags, ExportBuildDirectory + "/" + ShapeLightmapBuildDirectory + "/list_lm_8bit.txt" ]) -else: - printLog(log, "SKIP *") - -# Convert lightmap in 16 bits mode if they are not 8 bits lightmap -printLog(log, ">>> Convert lightmaps in 16 or 8 bits <<<") -mkPath(log, ExportBuildDirectory + "/" + ShapeLightmapBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + ShapeLightmap16BitsBuildDirectory) -lightMapTgas = findFilesNoSubdir(log, ExportBuildDirectory + "/" + ShapeLightmapBuildDirectory, ".tga") -listLm8Bit = [ ] -listLm8BitFile = open(ExportBuildDirectory + "/" + ShapeLightmapBuildDirectory + "/list_lm_8bit.txt", "r") -for line in listLm8BitFile: - lineStrip = line.strip() - if (len(lineStrip) > 0): - listLm8Bit += [ lineStrip ] -for lightMapTga in lightMapTgas: - srcTga = ExportBuildDirectory + "/" + ShapeLightmapBuildDirectory + "/" + lightMapTga - dstTga = ExportBuildDirectory + "/" + ShapeLightmap16BitsBuildDirectory + "/" + lightMapTga - if needUpdateLogRemoveDest(log, srcTga, dstTga): - if lightMapTga in listLm8Bit: # THIS MAY NOT WORK, PLEASE VERIFY CONTENTS OF list_lm_8bit.txt!!! - subprocess.call([ TgaToDds, srcTga, "-o", dstTga, "-a", "tga8" ]) - else: - subprocess.call([ TgaToDds, srcTga, "-o", dstTga, "-a", "tga16" ]) - -# Corse meshes for this process ? -if len(CoarseMeshTextureNames) > 0: - printLog(log, ">>> Build coarse meshes <<<") - shapeWithCoarseMesh = ExportBuildDirectory + "/" + ShapeWithCoarseMeshExportDirectory - mkPath(log, shapeWithCoarseMesh) - shapeWithCoarseMeshBuilded = ExportBuildDirectory + "/" + ShapeWithCoarseMeshBuildDirectory - mkPath(log, shapeWithCoarseMeshBuilded) - # This builds from shapeWithCoarseMesh .shape to shapeWithCoarseMesh .tga - # And from shapeWithCoarseMesh .shape to shapeWithCoarseMeshBuilded .shape - # Then builds from shapeWithCoarseMesh .tga to shapeWithCoarseMeshBuilded .tga - # Depends on MapLookupDirectories - needUpdateMaps = needUpdateMultiDirNoSubdirMultiFileExt(log, ExportBuildDirectory, MapLookupDirectories, shapeWithCoarseMesh, CoarseMeshTextureNames, ".tga") or needUpdateMultiDirNoSubdir(log, ExportBuildDirectory, MapLookupDirectories, shapeWithCoarseMeshBuilded) - if needUpdateMaps: - printLog(log, "DETECT UPDATE Maps->*") - else: - printLog(log, "DETECT SKIP Maps->*") - needUpdateShapeShape = needUpdateDirByTagLog(log, shapeWithCoarseMesh, ".shape", shapeWithCoarseMeshBuilded, ".shape") - if needUpdateShapeShape: - printLog(log, "DETECT UPDATE Shape->Shape") - else: - printLog(log, "DETECT SKIP Shape->Shape") - needUpdateShapeCoarse = needUpdateDirNoSubdirExtMultiFileExt(log, shapeWithCoarseMesh, ".shape", shapeWithCoarseMesh, CoarseMeshTextureNames, ".tga") - if needUpdateShapeCoarse: - printLog(log, "DETECT UPDATE Shape->Coarse") - else: - printLog(log, "DETECT SKIP Shape->Coarse") - if needUpdateMaps or needUpdateShapeShape or needUpdateShapeCoarse: - cf = open("config_generated.cfg", "w") - cf.write("texture_mul_size = " + TextureMulSizeValue + ";\n") - cf.write("\n") - cf.write("search_path = \n") - cf.write("{\n") - cf.write("\t\"" + shapeWithCoarseMesh + "\", \n") - for dir in MapLookupDirectories: - cf.write("\t\"" + ExportBuildDirectory + "/" + dir + "\", \n") - cf.write("};\n") - cf.write("\n") - cf.write("list_mesh = \n") - cf.write("{\n") - # For each shape with coarse mesh - files = findFiles(log, shapeWithCoarseMesh, "", ".shape") - for file in files: - sourceFile = shapeWithCoarseMesh + "/" + file - if os.path.isfile(sourceFile): - destFile = shapeWithCoarseMeshBuilded + "/" + file - cf.write("\t\"" + file + "\", \"" + destFile + "\", \n") - cf.write("};\n") - cf.write("\n") - cf.write("output_textures = \n") - cf.write("{\n") - # For each shape with coarse mesh - for tn in CoarseMeshTextureNames: - cf.write("\t\"" + shapeWithCoarseMesh + "/" + tn + ".tga\", \n") - cf.write("};\n") - cf.close() - subprocess.call([ BuildCoarseMesh, "config_generated.cfg" ]) - os.remove("config_generated.cfg") - needUpdateCoarse = needUpdateDirNoSubdirExtMultiFileExt(log, shapeWithCoarseMesh, ".tga", shapeWithCoarseMeshBuilded, CoarseMeshTextureNames, ".dds") - if needUpdateCoarse: - printLog(log, "DETECT UPDATE Coarse->DDS") - else: - printLog(log, "DETECT SKIP Coarse->DDS") - # Convert the coarse texture to dds - if needUpdateCoarse: - for tn in CoarseMeshTextureNames: - subprocess.call([ TgaToDds, shapeWithCoarseMesh + "/" + tn + ".tga", "-o", shapeWithCoarseMeshBuilded + "/" + tn + ".dds", "-a", "5" ]) -else: - printLog(log, ">>> No coarse meshes <<<") - -log.close() - - -# end of file diff --git a/code/nel/tools/build_gamedata/processes/zone/2_build.py b/code/nel/tools/build_gamedata/processes/zone/2_build.py deleted file mode 100644 index 4d19f5abc..000000000 --- a/code/nel/tools/build_gamedata/processes/zone/2_build.py +++ /dev/null @@ -1,175 +0,0 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build zone -# \date 2009-03-10-22-23-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build zone -# -# NeL - MMORPG Framework -# Copyright (C) 2009-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 . -# - -import time, sys, os, shutil, subprocess, distutils.dir_util -sys.path.append("../../configuration") - -if os.path.isfile("log.log"): - os.remove("log.log") -log = open("log.log", "w") -from scripts import * -from buildsite import * -from process import * -from tools import * -from directories import * - -printLog(log, "") -printLog(log, "-------") -printLog(log, "--- Build zone") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# Find tools -ZoneDependencies = findTool(log, ToolDirectories, ZoneDependenciesTool, ToolSuffix) -ZoneWelder = findTool(log, ToolDirectories, ZoneWelderTool, ToolSuffix) -ZoneElevation = findTool(log, ToolDirectories, ZoneElevationTool, ToolSuffix) -ExecTimeout = findTool(log, ToolDirectories, ExecTimeoutTool, ToolSuffix) -printLog(log, "") - -# We are in BEST mode -if BuildQuality == 1: - printLog(log, ">>> Build zone dependencies <<<") - if ZoneDependencies == "": - toolLogFail(log, ZoneDependenciesTool, ToolSuffix) - elif ExecTimeout == "": - toolLogFail(log, ExecTimeoutTool, ToolSuffix) - else: - mkPath(log, ExportBuildDirectory + "/" + ZoneExportDirectory) - mkPath(log, ExportBuildDirectory + "/" + ZoneDependBuildDirectory) - needUpdateZoneDepend = needUpdateDirByLowercaseTagLog(log, ExportBuildDirectory + "/" + ZoneExportDirectory, ".zone", ExportBuildDirectory + "/" + ZoneDependBuildDirectory, ".depend") - if needUpdateZoneDepend: - printLog(log, "DETECT UPDATE Zone->Depend") - else: - printLog(log, "DETECT SKIP Zone->Depend") - needUpdateContinentDepend = needUpdateFileDirNoSubdir(log, LeveldesignWorldDirectory + "/" + ContinentFile, ExportBuildDirectory + "/" + ZoneDependBuildDirectory) - if needUpdateContinentDepend: - printLog(log, "DETECT UPDATE Continent->Depend") - else: - printLog(log, "DETECT SKIP Continent->Depend") - needUpdateSearchPaths = needUpdateMultiDirNoSubdir(log, ExportBuildDirectory, PropertiesExportBuildSearchPaths, ExportBuildDirectory + "/" + ZoneDependBuildDirectory) - if needUpdateSearchPaths: - printLog(log, "DETECT UPDATE SearchPaths->Depend") - else: - printLog(log, "DETECT SKIP SearchPaths->Depend") - if needUpdateZoneDepend or needUpdateContinentDepend or needUpdateSearchPaths: - printLog(log, "DETECT DECIDE UPDATE") - mkPath(log, ActiveProjectDirectory + "/generated") - configFile = ActiveProjectDirectory + "/generated/zone_dependencies.cfg" - templateCf = open(ActiveProjectDirectory + "/generated/properties.cfg", "r") - cf = open(configFile, "w") - for line in templateCf: - cf.write(line) - cf.write("\n"); - cf.write("level_design_directory = \"" + LeveldesignDirectory + "\";\n"); - cf.write("level_design_world_directory = \"" + LeveldesignWorldDirectory + "\";\n"); - cf.write("level_design_dfn_directory = \"" + LeveldesignDfnDirectory + "\";\n"); - cf.write("continent_name = \"" + ContinentName + "\";\n"); - cf.write("\n"); - cf.close() - - for zoneRegion in ZoneRegions: - # zone_dependencies [properties.cfg] [firstZone.zone] [lastzone.zone] [output_dependencies.cfg] - subprocess.call([ ExecTimeout, str(ZoneBuildDependTimeout), ZoneDependencies, configFile, ExportBuildDirectory + "/" + ZoneExportDirectory + "/" + zoneRegion[0] + ".zone", ExportBuildDirectory + "/" + ZoneExportDirectory + "/" + zoneRegion[1] + ".zone", ExportBuildDirectory + "/" + ZoneDependBuildDirectory + "/doomy.depend" ]) - else: - printLog(log, "DETECT DECIDE SKIP") - printLog(log, "SKIP *") - printLog(log, "") - -# For each zone directory -#printLog(log, ">>> Build zone weld <<<") -#if ZoneWelder == "": -# toolLogFail(log, ZoneWelderTool, ToolSuffix) -#elif ExecTimeout == "": -# toolLogFail(log, ExecTimeoutTool, ToolSuffix) -#else: -# mkPath(log, ExportBuildDirectory + "/" + ZoneExportDirectory) -# mkPath(log, ExportBuildDirectory + "/" + ZoneWeldBuildDirectory) -# files = findFiles(log, ExportBuildDirectory + "/" + ZoneExportDirectory, "", ".zone") -# for file in files: -# sourceFile = ExportBuildDirectory + "/" + ZoneExportDirectory + "/" + file -# destFile = ExportBuildDirectory + "/" + ZoneWeldBuildDirectory + "/" + os.path.basename(file)[0:-len(".zone")] + ".zonew" -# if needUpdateLogRemoveDest(log, sourceFile, destFile): -# subprocess.call([ ExecTimeout, str(ZoneBuildWeldTimeout), ZoneWelder, sourceFile, destFile ]) -#printLog(log, "") - -# For each zone directory -printLog(log, ">>> Weld zone without heightmap <<<") -if ZoneWelder == "": - toolLogFail(log, ZoneWelderTool, ToolSuffix) -elif ExecTimeout == "": - toolLogFail(log, ExecTimeoutTool, ToolSuffix) -else: - mkPath(log, ExportBuildDirectory + "/" + ZoneExportDirectory) - mkPath(log, ExportBuildDirectory + "/" + ZoneWeldBuildDirectory) - files = findFiles(log, ExportBuildDirectory + "/" + ZoneExportDirectory, "", ".zonenh") - for file in files: - sourceFile = ExportBuildDirectory + "/" + ZoneExportDirectory + "/" + file - destFile = ExportBuildDirectory + "/" + ZoneWeldBuildDirectory + "/" + os.path.basename(file)[0:-len(".zonenh")] + ".zonenhw" - if needUpdateLogRemoveDest(log, sourceFile, destFile): - subprocess.call([ ExecTimeout, str(ZoneBuildWeldTimeout), ZoneWelder, sourceFile, destFile ]) -printLog(log, "") - -printLog(log, ">>> Apply zone heightmap to welded zone <<<") -if ZoneElevation == "": - toolLogFail(log, ZoneElevationTool, ToolSuffix) -else: - mkPath(log, ExportBuildDirectory + "/" + ZoneWeldBuildDirectory) - mkPath(log, DatabaseDirectory + "/" + LigoBaseSourceDirectory); - land = DatabaseDirectory + "/" + LigoBaseSourceDirectory + "/" + LigoExportLand - heightMap1 = DatabaseDirectory + "/" + LigoBaseSourceDirectory + "/" + LigoExportHeightmap1 - heightMap2 = DatabaseDirectory + "/" + LigoBaseSourceDirectory + "/" + LigoExportHeightmap2 - files = findFiles(log, ExportBuildDirectory + "/" + ZoneWeldBuildDirectory, "", ".zonenhw") - for file in files: - sourceFile = ExportBuildDirectory + "/" + ZoneWeldBuildDirectory + "/" + file - destFile = ExportBuildDirectory + "/" + ZoneWeldBuildDirectory + "/" + os.path.basename(file)[0:-len(".zonenhw")] + ".zone" - if needUpdateLogRemoveDest(log, sourceFile, destFile): - command = [ ZoneElevation, sourceFile, destFile, "--land", land, "--heightmap", heightMap1, "--zfactor", LigoExportZFactor1, "--heightmap2", heightMap2, "--zfactor2", LigoExportZFactor2 ] - if LigoExportExtendCoords != 0: - command.append("--extendcoords") - callParallelProcess(command) - flushParallelProcesses() -printLog(log, "") - -printLog(log, ">>> Re-weld zone with heightmap <<<") -if ZoneWelder == "": - toolLogFail(log, ZoneWelderTool, ToolSuffix) -elif ExecTimeout == "": - toolLogFail(log, ExecTimeoutTool, ToolSuffix) -else: - mkPath(log, ExportBuildDirectory + "/" + ZoneWeldBuildDirectory) - files = findFiles(log, ExportBuildDirectory + "/" + ZoneWeldBuildDirectory, "", ".zone") - for file in files: - sourceFile = ExportBuildDirectory + "/" + ZoneWeldBuildDirectory + "/" + file - destFile = ExportBuildDirectory + "/" + ZoneWeldBuildDirectory + "/" + os.path.basename(file)[0:-len(".zone")] + ".zonew" - if needUpdateLogRemoveDest(log, sourceFile, destFile): - subprocess.call([ ExecTimeout, str(ZoneBuildWeldTimeout), ZoneWelder, sourceFile, destFile ]) -printLog(log, "") - -log.close() - - -# end of file diff --git a/code/nel/tools/build_gamedata/processes/zone_light/2_build.py b/code/nel/tools/build_gamedata/processes/zone_light/2_build.py deleted file mode 100644 index 6d08f81d4..000000000 --- a/code/nel/tools/build_gamedata/processes/zone_light/2_build.py +++ /dev/null @@ -1,105 +0,0 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build zone_light -# \date 2009-03-11-13-45-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build zone_light -# -# NeL - MMORPG Framework -# Copyright (C) 2009-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 . -# - -import time, sys, os, shutil, subprocess, distutils.dir_util -sys.path.append("../../configuration") - -if os.path.isfile("log.log"): - os.remove("log.log") -log = open("log.log", "w") -from scripts import * -from buildsite import * -from process import * -from tools import * -from directories import * - -printLog(log, "") -printLog(log, "-------") -printLog(log, "--- Build zone_light") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# Find tools -ExecTimeout = findTool(log, ToolDirectories, ExecTimeoutTool, ToolSuffix) -ZoneLighter = findTool(log, ToolDirectories, ZoneLighterTool, ToolSuffix) -ZoneIgLighter = findTool(log, ToolDirectories, ZoneIgLighterTool, ToolSuffix) -printLog(log, "") - -# For each zone_light directory -printLog(log, ">>> Build zone_light <<<") -if ZoneLighter == "": - toolLogFail(log, ZoneLighterTool, ToolSuffix) -elif ExecTimeout == "": - toolLogfail(log, ExecTimeoutTool, ToolSuffix) -else: - srcDir = ExportBuildDirectory + "/" + ZoneWeldBuildDirectory - mkPath(log, srcDir) - destDir = ExportBuildDirectory + "/" + ZoneLightBuildDirectory - mkPath(log, destDir) - dependDir = ExportBuildDirectory + "/" + ZoneDependBuildDirectory - mkPath(log, dependDir) - files = findFiles(log, srcDir, "", ".zonew") - for file in files: - srcFile = srcDir + "/" + file - destFile = destDir + "/" + file[0:-len(".zonew")] + ".zonel" - if (needUpdateLogRemoveDest(log, srcFile, destFile)): - dependFile = dependDir + "/" + file[0:-len(".zonew")] + ".depend" - callParallelProcess([ ExecTimeout, str(ZoneLightBuildTimeout), ZoneLighter, srcFile, destFile, ActiveProjectDirectory + "/generated/properties.cfg", dependFile ]) - flushParallelProcesses() -printLog(log, "") - -# For each zone_light ig -printLog(log, ">>> Build zone_light ig <<<") -if ZoneIgLighter == "": - toolLogFail(log, ZoneIgLighterTool, ToolSuffix) -elif ExecTimeout == "": - toolLogfail(log, ExecTimeoutTool, ToolSuffix) -else: - srcDir = ExportBuildDirectory + "/" + ZoneLightBuildDirectory - mkPath(log, srcDir) - igsrcDir = ExportBuildDirectory + "/" + IgLandBuildDirectory - mkPath(log, igsrcDir) - destDir = ExportBuildDirectory + "/" + ZoneLightIgLandBuildDirectory - mkPath(log, destDir) - dependDir = ExportBuildDirectory + "/" + ZoneDependBuildDirectory - mkPath(log, dependDir) - files = findFiles(log, srcDir, "", ".zonel") - for file in files: - igsrcFile = igsrcDir + "/" + os.path.basename(file)[0:-len(".zonel")] + ".ig" - destFile = destDir + "/" + os.path.basename(file)[0:-len(".zonel")] + ".ig" - if (os.path.isfile(igsrcFile)): - if (needUpdateLogRemoveDest(log, igsrcFile, destFile)): - srcFile = srcDir + "/" + file - dependFile = dependDir + "/" + file[0:-len(".zonel")] + ".depend" - callParallelProcess([ ExecTimeout, str(ZoneIgLightBuildTimeout), ZoneIgLighter, srcFile, destFile, ActiveProjectDirectory + "/generated/properties.cfg", dependFile ]) - flushParallelProcesses() -printLog(log, "") - -log.close() - - -# end of file diff --git a/code/nel/tools/build_gamedata/translation/make_merge_all.py b/code/nel/tools/build_gamedata/translation/make_merge_all.py deleted file mode 100644 index 91fc4712b..000000000 --- a/code/nel/tools/build_gamedata/translation/make_merge_all.py +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/python -# -# \author Jan Boon (Kaetemi) -# -# NeL - MMORPG Framework -# 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 . -# - -import time, sys, os, shutil, subprocess, distutils.dir_util -sys.path.append("../configuration") -from scripts import * -from buildsite import * -from tools import * -os.chdir(TranslationDirectory) -if os.path.isfile("log.log"): - os.remove("log.log") -log = open("log.log", "w") - -printLog(log, "") -printLog(log, "-------") -printLog(log, "--- Make and merge all translations") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - - -TranslationTools = findTool(log, ToolDirectories, TranslationToolsTool, ToolSuffix) -try: - subprocess.call([ TranslationTools, "make_phrase_diff" ]) - subprocess.call([ TranslationTools, "merge_phrase_diff" ]) - subprocess.call([ TranslationTools, "make_clause_diff" ]) - subprocess.call([ TranslationTools, "merge_clause_diff" ]) - subprocess.call([ TranslationTools, "make_words_diff" ]) - subprocess.call([ TranslationTools, "merge_words_diff" ]) - subprocess.call([ TranslationTools, "make_string_diff" ]) - subprocess.call([ TranslationTools, "merge_string_diff" ]) - subprocess.call([ TranslationTools, "clean_string_diff" ]) - subprocess.call([ TranslationTools, "make_r2_string_diff" ]) - subprocess.call([ TranslationTools, "merge_r2_string_diff" ]) - subprocess.call([ TranslationTools, "clean_r2_string_diff" ]) - subprocess.call([ TranslationTools, "clean_words_diff" ]) - subprocess.call([ TranslationTools, "clean_clause_diff" ]) - subprocess.call([ TranslationTools, "clean_phrase_diff" ]) - subprocess.call([ TranslationTools, "make_worksheet_diff", "bot_names.txt" ]) - subprocess.call([ TranslationTools, "merge_worksheet_diff", "bot_names.txt" ]) -except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) -printLog(log, "") - - -log.close() -if os.path.isfile("make_merge_all.log"): - os.remove("make_merge_all.log") -shutil.copy("log.log", "make_merge_all_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log") -shutil.move("log.log", "make_merge_all.log") - -raw_input("PRESS ANY KEY TO EXIT") diff --git a/code/nel/tools/build_gamedata/translation/make_merge_wk.py b/code/nel/tools/build_gamedata/translation/make_merge_wk.py deleted file mode 100644 index 43c1ac325..000000000 --- a/code/nel/tools/build_gamedata/translation/make_merge_wk.py +++ /dev/null @@ -1,115 +0,0 @@ -#!/usr/bin/python -# -# \author Jan Boon (Kaetemi) -# -# NeL - MMORPG Framework -# 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 . -# - -import time, sys, os, shutil, subprocess, distutils.dir_util -sys.path.append("../configuration") -from scripts import * -from buildsite import * -from tools import * -os.chdir(TranslationDirectory) -if os.path.isfile("log.log"): - os.remove("log.log") -log = open("log.log", "w") - -printLog(log, "") -printLog(log, "-------") -printLog(log, "--- Make, merge and clean work") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - - -TranslationTools = findTool(log, ToolDirectories, TranslationToolsTool, ToolSuffix) -printLog(log, ">>> Override languages.txt <<<") -if not os.path.isfile("make_merge_wk_languages.txt"): - shutil.move("languages.txt", "make_merge_wk_languages.txt") -languagesTxt = open("languages.txt", "w") -languagesTxt.write("wk\n") -languagesTxt.close() - - -printLog(log, ">>> Merge diff <<<") # This is necessary, because when we crop lines, we should only do this from untranslated files -try: - subprocess.call([ TranslationTools, "merge_phrase_diff" ]) - subprocess.call([ TranslationTools, "merge_clause_diff" ]) - subprocess.call([ TranslationTools, "merge_words_diff" ]) - subprocess.call([ TranslationTools, "merge_string_diff" ]) - subprocess.call([ TranslationTools, "merge_r2_string_diff" ]) - subprocess.call([ TranslationTools, "merge_worksheet_diff", "bot_names.txt" ]) -except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) -printLog(log, "") - - -printLog(log, ">>> Make diff <<<") -try: - subprocess.call([ TranslationTools, "make_phrase_diff" ]) - subprocess.call([ TranslationTools, "make_clause_diff" ]) - subprocess.call([ TranslationTools, "make_words_diff" ]) - subprocess.call([ TranslationTools, "make_string_diff" ]) - subprocess.call([ TranslationTools, "make_r2_string_diff" ]) - subprocess.call([ TranslationTools, "make_worksheet_diff", "bot_names.txt" ]) -except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) - - -printLog(log, ">>> Mark diffs as translated <<<") -diffFiles = os.listdir("diff") -for diffFile in diffFiles: - if "wk_diff_" in diffFile: - printLog(log, "DIFF " + "diff/" + diffFile) - subprocess.call([ TranslationTools, "crop_lines", "diff/" + diffFile, "3" ]) - -#printLog(log, ">>> Clean diff <<<") -#try: -# subprocess.call([ TranslationTools, "clean_string_diff" ]) -# subprocess.call([ TranslationTools, "clean_phrase_diff" ]) -# subprocess.call([ TranslationTools, "clean_clause_diff" ]) -# subprocess.call([ TranslationTools, "clean_words_diff" ]) -#except Exception, e: -# printLog(log, "<" + processName + "> " + str(e)) -#printLog(log, "") - -printLog(log, ">>> Merge diff <<<") -try: - subprocess.call([ TranslationTools, "merge_phrase_diff" ]) - subprocess.call([ TranslationTools, "merge_clause_diff" ]) - subprocess.call([ TranslationTools, "merge_words_diff" ]) - subprocess.call([ TranslationTools, "merge_string_diff" ]) - subprocess.call([ TranslationTools, "merge_r2_string_diff" ]) - subprocess.call([ TranslationTools, "merge_worksheet_diff", "bot_names.txt" ]) -except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) -printLog(log, "") - - -printLog(log, ">>> Restore languages.txt <<<") -os.remove("languages.txt") -shutil.move("make_merge_wk_languages.txt", "languages.txt") - - -log.close() -if os.path.isfile("make_merge_wk.log"): - os.remove("make_merge_wk.log") -shutil.copy("log.log", "make_merge_wk_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log") -shutil.move("log.log", "make_merge_wk.log") - -raw_input("PRESS ANY KEY TO EXIT") diff --git a/code/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp b/code/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp deleted file mode 100644 index 045aba4e4..000000000 --- a/code/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp +++ /dev/null @@ -1,3072 +0,0 @@ -// Ryzom - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This source file has been modified by the following contributors: -// Copyright (C) 2012 Matt RAYKOWSKI (sfb) -// Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// -// 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 . - - - -#include "stdpch.h" - -#include "game_share/trade_slot_type.h" -#include "game_share/skills.h" -#include "game_share/bot_chat_types.h" -#include "game_share/msg_ais_egs_gen.h" -#include "../client_sheets/item_sheet.h" -#include "../client_sheets/outpost_building_sheet.h" -// -#include "bot_chat_page_trade.h" -#include "interface_manager.h" -#include "nel/gui/interface_group.h" -#include "inventory_manager.h" -#include "../net_manager.h" -#include "nel/gui/action_handler.h" -#include "bot_chat_page_all.h" -#include "bot_chat_manager.h" -#include "dbctrl_sheet.h" -#include "nel/gui/group_editbox.h" -#include "nel/gui/group_tab.h" -#include "nel/gui/group_container.h" -#include "action_handler_help.h" -#include "../string_manager_client.h" -#include "nel/gui/group_container.h" -#include "dbgroup_list_sheet_text.h" -#include "nel/gui/ctrl_text_button.h" -#include "../client_cfg.h" -#include "../init_main_loop.h" -#include "guild_manager.h" -#include "../sheet_manager.h" -#include "../user_entity.h" -#include "nel/gui/view_bitmap.h" -#include "nel/misc/common.h" - -using namespace std::rel_ops; - - -using namespace std; -using namespace NLMISC; - -static const char *WIN_BOT_CHAT_PAGE_TRADE = "ui:interface:bot_chat_trade"; -static const char *WIN_BOT_CHAT_PAGE_BUY = "ui:interface:bot_chat_buy"; -static const char *WIN_BOT_CHAT_SELL_BUY_ITEM = "ui:interface:bot_chat_buy_sell_item"; -static const char *WIN_BOT_CHAT_CHANGE_BUY_FILTER = "ui:interface:bot_chat_change_buy_filter"; -static const char *WIN_BOT_CHAT_CHANGE_BUY_FILTER_MP = "ui:interface:bot_chat_change_buy_filter_mp"; -static const char *WIN_BOT_CHAT_CHANGE_BUY_FILTER_CLASS = "ui:interface:bot_chat_change_buy_filter_class"; -static const char *WIN_BOT_CHAT_CHANGE_BUY_FILTER_ITEM_TYPE = "ui:interface:bot_chat_change_buy_filter_item_type"; -static const char *WIN_BOT_CHAT_DESTROY_ITEM = "ui:interface:bot_chat_destroy_confirm_modal"; - - -#define DB_BOT_CHAT_BASE_BUY_FILTER "UI:SAVE:BOTCHAT_FILTER" - - -// fill the help setup infos for the trade modal -static void fillHelpSetupInfosForTrade(CSheetHelpSetup &dest, CDBCtrlSheet *sheet, CInterfaceGroup *helpGroup) -{ - dest.HelpWindow = helpGroup; - dest.SrcSheet = sheet; - dest.DestSheet = dynamic_cast(helpGroup->getCtrl("buy_sell_slot")); - dest.ViewText = "help_text"; - dest.ScrollTextGroup = "scroll_text"; - dest.PrefixForExtra= ":header_opened:scroll_text:text_list:"; - dest.FromBotChat= true; - - // hide some interface elements by default - resetSheetHelp(dest); -} - - -/** Listener to update items infos in the buy / sell dlg - */ -class CInfoWindow : public IItemInfoWaiter -{ -public: - // the sheet for which help must be updated - CDBCtrlSheet *Sheet; -public: - virtual void infoReceived() - { - CSheetHelpSetup helpSetup; - CInterfaceManager *im = CInterfaceManager::getInstance(); - CGroupContainer *ig = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WIN_BOT_CHAT_SELL_BUY_ITEM)); - fillHelpSetupInfosForTrade(helpSetup, Sheet, ig); - refreshItemHelp(helpSetup); - } -}; -static CInfoWindow InfoWindowUpdater; - - -// *************************************************************************** -void CBotChatPageTrade::CItemCheck::reset() -{ - _SheetId= 0; - _Quality= 0; - _Quantity= 0; - _Price= 0; - _ResaleFlag= 0; -} -void CBotChatPageTrade::CItemCheck::init(CDBCtrlSheet *ctrl) -{ - nlassert(ctrl); - _SheetId= ctrl->getSheetId(); - _Quality= ctrl->getQuality(); - _Quantity= ctrl->getQuantity(); - _Price= ctrl->getItemPrice(); - _ResaleFlag= ctrl->getItemResaleFlag(); -} -bool CBotChatPageTrade::CItemCheck::test(CDBCtrlSheet *ctrl) const -{ - nlassert(ctrl); - return - _SheetId== ctrl->getSheetId() && - _Quality== ctrl->getQuality() && - _Quantity== ctrl->getQuantity() && - _Price== ctrl->getItemPrice() && - _ResaleFlag== ctrl->getItemResaleFlag(); -} - - -// ******************************************************************************************* -CBotChatPageTrade::CBotChatPageTrade() -{ - _TradePagesObs.setListType(CHugeListObs::Trading); - _BuyDlgOn = false; - _SellDlgOn = false; - _ResaleEdit = false; - _QuantityEdit = false; - _UsePriceRetire = false; - _CannotValidateBecauseRetireNotAvailable = false; - _QuantityCheck = 0; - _CurrItemIndex = 0; - _BuyOnly = false; - _CurrItemSheet = NULL; - _BuyMean = Money; - _FamePriceFactorLeaf = NULL; - _FilterBuyDlgMaxValue= 0; - _DownloadComplete = false; -} - -// ******************************************************************************************* -void CBotChatPageTrade::init() -{ - CInterfaceManager *im = CInterfaceManager::getInstance(); - if (NLGUI::CDBManager::getInstance()->getDbBranch("SERVER:TRADING")) - { - NLGUI::CDBManager::getInstance()->addBranchObserver( "SERVER:TRADING", &_TradePagesObs); - } - - _FamePriceFactorLeaf = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:FAME_PRICE_FACTOR"); -} - -// ******************************************************************************************* -void CBotChatPageTrade::invalidateCoords() -{ - CInterfaceManager *im = CInterfaceManager::getInstance(); - CGroupContainer *gc = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(_BuyOnly ? WIN_BOT_CHAT_PAGE_BUY : WIN_BOT_CHAT_PAGE_TRADE)); - if (!gc) return; - // invalidate buy group - gc->invalidateCoords(); -} - -// ******************************************************************************************* -void CBotChatPageTrade::begin() -{ - CBotChatPage::begin(); - if (!_BuyOnly) - { - activateWindow(WIN_BOT_CHAT_PAGE_TRADE, true); - } - else - { - activateWindow(WIN_BOT_CHAT_PAGE_BUY, true); - } - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - NLGUI::CDBManager::getInstance()->getDbProp(BOT_CHAT_BASE_DB_PATH ":TRADE")->setValue32(0); - - // at each new bot chat trade, we must reset filter for ItemPart and ItemType (NB: server should do the same) - resetItemPartAndTypeFilters(); - - // reset also the filters at each open if user wants to - CCDBNodeLeaf *dbResetFilterOnOpen= NLGUI::CDBManager::getInstance()->getDbProp(DB_BOT_CHAT_BASE_BUY_FILTER":RESET_ON_OPEN" , false); - if(dbResetFilterOnOpen && dbResetFilterOnOpen->getValueBool() && (_BuyMean == Money) ) - { - // temporary value for conversions - sint32 value; - - // Reset Price - CCDBNodeLeaf *dbPriceMin= NLGUI::CDBManager::getInstance()->getDbProp(string(DB_BOT_CHAT_BASE_BUY_FILTER":MIN_PRICE") , false); - CCDBNodeLeaf *dbPriceMax= NLGUI::CDBManager::getInstance()->getDbProp(string(DB_BOT_CHAT_BASE_BUY_FILTER":MAX_PRICE") , false); - if(dbPriceMin) dbPriceMin->setValue32(0); - if(dbPriceMax) - { - fromString(CWidgetManager::getInstance()->getParser()->getDefine("bot_chat_filter_max_price"), value); - dbPriceMax->setValue32(value); - } - - // Reset Quality - CCDBNodeLeaf *dbQualityMin= NLGUI::CDBManager::getInstance()->getDbProp(string(DB_BOT_CHAT_BASE_BUY_FILTER":MIN_QUALITY") , false); - CCDBNodeLeaf *dbQualityMax= NLGUI::CDBManager::getInstance()->getDbProp(string(DB_BOT_CHAT_BASE_BUY_FILTER":MAX_QUALITY") , false); - if(dbQualityMin) dbQualityMin->setValue32(0); - if(dbQualityMax) - { - fromString(CWidgetManager::getInstance()->getParser()->getDefine("bot_chat_filter_max_quality"), value); - dbQualityMax->setValue32(value); - } - - // Reset Class - CCDBNodeLeaf *dbClassMin= NLGUI::CDBManager::getInstance()->getDbProp(DB_BOT_CHAT_BASE_BUY_FILTER":MIN_CLASS" , false); - CCDBNodeLeaf *dbClassMax= NLGUI::CDBManager::getInstance()->getDbProp(DB_BOT_CHAT_BASE_BUY_FILTER":MAX_CLASS" , false); - if(dbClassMin) dbClassMin->setValue32(0); - if(dbClassMax) dbClassMax->setValue32(RM_CLASS_TYPE::NumTRMClassType-1); - - // send the filter, but don't reset the list, since will do just after :) - sendCurrentBuyFilterToServer(false); - } - - - // Start the HugeList - _TradePagesObs.start(); - // If BuyMean is skillpoints, means its phrase selling => allow phrase price update (and possible client fill) - _TradePagesObs.allowPhrasePriceUpdateAndClientFill(_BuyMean == SkillPoints); - notifyDownloadComplete(false); - _DownloadComplete = false; - - // update interface - CGroupContainer *gc = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(_BuyOnly ? WIN_BOT_CHAT_PAGE_BUY : WIN_BOT_CHAT_PAGE_TRADE)); - if (gc) - { - // set the title - gc->setUCTitle(_Title); - // show the buy mean - CInterfaceGroup *money = dynamic_cast(gc->getGroup("money")); - if (money) money->setActive((_BuyMean == Money) || (_BuyMean == MoneyFactionPoints)); - CInterfaceGroup *factionPoints = dynamic_cast(gc->getGroup("fp")); - if (factionPoints) factionPoints->setActive(_BuyMean == MoneyFactionPoints); - CInterfaceGroup *skillPoints = dynamic_cast(gc->getGroup("sp")); - if (skillPoints) skillPoints->setActive(_BuyMean == SkillPoints); - CInterfaceGroup *pMoneyGuildXP = dynamic_cast(gc->getGroup("money_guild_xp")); - if (pMoneyGuildXP) pMoneyGuildXP->setActive((_BuyMean == MoneyGuildXP)||(_BuyMean == GuildXP)); - CInterfaceGroup *pMoney = dynamic_cast(gc->getGroup("money_guild_xp:money")); - if (pMoney) pMoney->setActive(_BuyMean == MoneyGuildXP); - - CInterfaceGroup *pGuildMoneyGuildXP = dynamic_cast(gc->getGroup("guild_money_guild_xp")); - if (pGuildMoneyGuildXP) pGuildMoneyGuildXP->setActive((_BuyMean == GuildMoneyGuildXP) || (_BuyMean == GuildMoney)); - CViewText *pGuildXPText = dynamic_cast(gc->getView("guild_money_guild_xp:xp_text")); - if (pGuildXPText) pGuildXPText->setActive(_BuyMean == GuildMoneyGuildXP); - CViewText *pGuildXPValue = dynamic_cast(gc->getView("guild_money_guild_xp:xp_value")); - if (pGuildXPValue) pGuildXPValue->setActive(_BuyMean == GuildMoneyGuildXP); - - CViewText *pBuyTitle = dynamic_cast(gc->getView("buy_title")); - if (pBuyTitle) - { - if(_BuyMean == Money) - pBuyTitle->setHardText("uiBuyFrom"); - else if(_BuyMean == SkillPoints) - pBuyTitle->setHardText("uiLearnFrom"); - // MoneyAndFactionPoints, MoneyGuildXP or GuildXP - else - pBuyTitle->setHardText("uiBuyFrom"); - } - - // show/hide skill Tabs - CGroupTab *pTab = dynamic_cast(gc->getGroup("buy_filter:tab")); - if ( pTab ) - { - bool activeSkillTabs = (_BuyMean == SkillPoints); - pTab->setActive(activeSkillTabs); - } - - // unselect any list - unselectBuyList(gc); - if (!_BuyOnly) - unselectSellList(gc); - } - -} - -// ***************************************************************************************** -void CBotChatPageTrade::end() -{ - activateWindow(WIN_BOT_CHAT_PAGE_TRADE, false); - activateWindow(WIN_BOT_CHAT_PAGE_BUY, false); - endTradeModal(); - - // Important to avoid update of the remaining phrase in the DB. - _TradePagesObs.allowPhrasePriceUpdateAndClientFill(false); -} - -// ***************************************************************************************** -void CBotChatPageTrade::update() -{ - updateTradeModal(); -} - - -// *************************************************************************************** -uint32 CBotChatPageTrade::getCurrItemQuantity() const -{ - if (!_CurrItemSheet) return std::numeric_limits::max(); - if(!_QuantityEdit) return 1; - if (_CurrItemSheet->getType() == CCtrlSheetInfo::SheetType_Item) - { - const CItemSheet *itemSheet = _CurrItemSheet->asItemSheet(); - if (itemSheet && itemSheet->Family != ITEMFAMILY::TELEPORT && - itemSheet->Family != ITEMFAMILY::GUILD_OPTION) - { - CInterfaceManager *im = CInterfaceManager::getInstance(); - CInterfaceGroup *ig = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WIN_BOT_CHAT_SELL_BUY_ITEM)); - if (!ig) return std::numeric_limits::max(); - // TODO: edit box in faction points? - CGroupEditBox *ed = dynamic_cast(ig->getGroup("header_opened:standard_price:quantity:edit:eb")); - if (!ed) return std::numeric_limits::max(); - uint32 intQuantity; - if (fromString(ed->getInputString().toString(), intQuantity)) - { - return intQuantity; - } - else - { - return std::numeric_limits::max(); - } - } - else - { - return 1; - } - return std::numeric_limits::max(); - } - return 1; -} - -// *************************************************************************************** -uint32 CBotChatPageTrade::getCurrItemPriceResale() const -{ - if (!_CurrItemSheet) return 0; - if (!_ResaleEdit) return 0; - if (_CurrItemSheet->getType() == CCtrlSheetInfo::SheetType_Item) - { -// const CItemSheet *itemSheet = _CurrItemSheet->asItemSheet(); - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - // get the edited resale price - CInterfaceGroup *ig = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WIN_BOT_CHAT_SELL_BUY_ITEM)); - if (!ig) return 0; - CGroupEditBox *resaleMarginBox = dynamic_cast(ig->getGroup("header_opened:resell_group:can_resell:choose_resell:edit:eb")); - if (!resaleMarginBox) return 0; - - // Calculate the resale price from the resale margin - uint32 margin = (uint32)resaleMarginBox->getInputStringAsInt(); - // temp uint64 because we add case where basePrice= 50000, and margin= 99999% => 50000*99999 > 4gig - uint64 basePrice = getCurrItemPrice(false); // base Price without fame margin - return uint32(basePrice + basePrice * margin / 100); - } - - return 0; -} - - -// *************************************************************************************** -uint64 CBotChatPageTrade::getCurrItemPrice(bool mulByFame) const -{ - if (!_CurrItemSheet) return std::numeric_limits::max(); - if (_BuyDlgOn && (_BuyMean == MoneyGuildXP || _BuyMean == GuildMoneyGuildXP || _BuyMean == GuildMoney) ) - { - if (_BuyMean == MoneyGuildXP) - { - // get the price from the sheet - const CItemSheet *pIS = _CurrItemSheet->asItemSheet(); - if (pIS != NULL) - { - if (pIS->Family == ITEMFAMILY::GUILD_OPTION) - return pIS->GuildOption.MoneyCost; - } - } - if ((_BuyMean == GuildMoneyGuildXP) || (_BuyMean == GuildMoney)) - { - // This is perhaps an outpost building - const COutpostBuildingSheet *pOB = _CurrItemSheet->asOutpostBuildingSheet(); - if (pOB != NULL) - return pOB->CostDapper; - } - } - else - { - // for item to buy/sell, price has been received in the db - if (_CurrItemSheet->getRootBranch()) - { - // for item to buy/sell, price has already been stored in the database - ICDBNode *node; - // take the PRICE_RETIRE if buying an item which actually belongs to the user - if(_UsePriceRetire) - node= _CurrItemSheet->getRootBranch()->getNode(ICDBNode::CTextId("PRICE_RETIRE"), false); - else - node= _CurrItemSheet->getRootBranch()->getNode(ICDBNode::CTextId("PRICE"), false); - CCDBNodeLeaf *priceLeaf = dynamic_cast(node); - if (priceLeaf) - { - uint64 price = (uint64) priceLeaf->getValue32(); - if (_BuyDlgOn || !mulByFame) - return price; - else - return (uint64)(price * _FamePriceFactorLeaf->getValue16()/10000.0f); - } - } - } - return std::numeric_limits::max(); -} - -// *************************************************************************************** -uint64 CBotChatPageTrade::getCurrItemXP() const -{ - if (_BuyMean == MoneyGuildXP) - { - // get the cp from the sheet - const CItemSheet *pIS = _CurrItemSheet->asItemSheet(); - if (pIS != NULL) - { - if (pIS->Family == ITEMFAMILY::GUILD_OPTION) - return pIS->GuildOption.XPCost; - } - } - if ((_BuyMean == GuildMoneyGuildXP) || (_BuyMean == GuildMoney)) - { - return 0; // By now no need for XP even if xp guild required - } - - return std::numeric_limits::max(); -} - - -// *************************************************************************** -void CBotChatPageTrade::getItemFactionTypePoints(CDBCtrlSheet *sheet, PVP_CLAN::TPVPClan &pvpClan, uint32 &points) const -{ - pvpClan= PVP_CLAN::None; - points= 0; - - // Bad setup => abort - if ((_BuyMean != MoneyFactionPoints) || (sheet == NULL)) - return; - - //CCDBNodeLeaf *currencyLeaf = dynamic_cast(sheet->getRootBranch()->getNode(ICDBNode::CTextId("CURRENCY"), false)); - //if (currencyLeaf == NULL) - // return; - - //RYMSG::TTradeCurrency currency((RYMSG::TTradeCurrency::TValues) currencyLeaf->getValue32()); - //if (currency != RYMSG::TTradeCurrency::tc_faction_points) - // return; - - // bad DB => abort - CCDBNodeLeaf *ftLeaf = dynamic_cast(sheet->getRootBranch()->getNode(ICDBNode::CTextId("FACTION_TYPE"), false)); - CCDBNodeLeaf *fppLeaf = dynamic_cast(sheet->getRootBranch()->getNode(ICDBNode::CTextId("PRICE"), false)); - if (ftLeaf == NULL || fppLeaf == NULL) - return; - - // else copy - pvpClan= (PVP_CLAN::TPVPClan)ftLeaf->getValue32(); - points= fppLeaf->getValue32(); - - // if only one is disabled, consider full disabled - if(pvpClan==PVP_CLAN::None || points==0) - { - pvpClan= PVP_CLAN::None; - points= 0; - } -} - -// *************************************************************************** -void CBotChatPageTrade::getCurrItemFactionTypePoints(PVP_CLAN::TPVPClan &pvpClan, uint32 &points) const -{ - getItemFactionTypePoints(_CurrItemSheet, pvpClan, points); -} - -// *************************************************************************** -uint32 CBotChatPageTrade::getUserFactionPoints(PVP_CLAN::TPVPClan clan) const -{ - if ((clan < PVP_CLAN::BeginClans) || (clan > PVP_CLAN::EndClans)) - return 0; - - uint32 nClan = clan - PVP_CLAN::BeginClans; - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CCDBNodeLeaf *pLeaf = NLGUI::CDBManager::getInstance()->getDbProp(toString("LOCAL:USER:FACTION_POINTS_%d:VALUE", nClan), false); - if (pLeaf == NULL) - return 0; - - return pLeaf->getValue32(); -} - -// *************************************************************************************** -void CBotChatPageTrade::notifyDownloadComplete(bool completed) -{ - CInterfaceManager *im = CInterfaceManager::getInstance(); - CGroupContainer *gc = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(_BuyOnly ? WIN_BOT_CHAT_PAGE_BUY : WIN_BOT_CHAT_PAGE_TRADE)); - if (!gc) return; - class CDBListVisitor : public CInterfaceElementVisitor - { - public: - bool DownloadComplete; - virtual void visitGroup(CInterfaceGroup *group) - { - CDBGroupListSheetText *dbGroup = dynamic_cast(group); - if (dbGroup) - { - dbGroup->notifyDownloadComplete(DownloadComplete); - } - } - }; - CDBListVisitor visitor; - visitor.DownloadComplete = completed; - gc->visit(&visitor); -} - -// *************************************************************************************** -void CBotChatPageTrade::updateTradeModal() -{ - // if loading is finished, then signal it to all sheet list, so they can display an help message if they - // are empty - if (_DownloadComplete != _TradePagesObs.isDownloadComplete()) - { - notifyDownloadComplete(true); - _DownloadComplete = _TradePagesObs.isDownloadComplete(); - } - - if(_CurrItemSheet) - { - // update buy dialog if it is currently shown - if (_BuyDlgOn || _SellDlgOn) - { - // check that curr item hasn't been modified (so that the index remains valid) - // this could happen if there was a db correction from the server - // in this case, the dialog is closed - if ( !_CurrItemCheck.test(_CurrItemSheet) ) - { - endTradeModal(); - return; - } - // get pointers on interface elements - CInterfaceManager *im = CInterfaceManager::getInstance(); - CGroupContainer *ig = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WIN_BOT_CHAT_SELL_BUY_ITEM)); - CInterfaceGroup *confirmTradeGroup = ig->getGroup("confirm_trade"); - CCtrlBase *confirmResellGroup = ig->getCtrl("confirm_trade_resell"); - CInterfaceGroup *cantTradeGroup = ig->getGroup("cant_trade"); - CInterfaceGroup *destroyTradeGroup = ig->getGroup("destroy_trade"); - - CCtrlTextButton *cantTradeButton = dynamic_cast(ig->getCtrl("cant_trade_button")); - - // **** update destroy options - // if the item belongs to the user, can always destroy it from the resale - destroyTradeGroup->setActive(_UsePriceRetire); - - // **** update confirmation - // update price from quantity is the object is an item and not a teleport - uint32 quantity = getCurrItemQuantity(); - // get price (without fame) - uint64 priceWithoutFame = getCurrItemPrice(false); - // get price (with fame) - uint64 priceWithFame = getCurrItemPrice(true); - // update resale price from quantity - uint32 resalePrice = getCurrItemPriceResale(); - - // get faction points and type from current item - PVP_CLAN::TPVPClan fpType; - uint32 fpCost; - getCurrItemFactionTypePoints(fpType, fpCost); - uint32 userFactionPoints = getUserFactionPoints(fpType); - - // Special case for guild options - if ((_BuyMean == MoneyGuildXP) || (_BuyMean == GuildMoney) || (_BuyMean == GuildMoneyGuildXP)) - { - uint64 totalPrice = (uint64) priceWithoutFame * (uint64) quantity; - NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:TRADE_ITEM:UNIT_PRICE")->setValue64(totalPrice); - NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:TRADE_ITEM:UNIT_PRICE_WITH_FAME")->setValue64(totalPrice); - uint64 totalXP = (uint64) getCurrItemXP() * (uint64) quantity; - CGuildManager *pGM = CGuildManager::getInstance(); - - uint64 moneyOwned = (_BuyMean == MoneyGuildXP)?getInventory().getMoney():pGM->getMoney(); - if (totalPrice > moneyOwned) - { - if (confirmTradeGroup) confirmTradeGroup->setActive(false); - if (cantTradeGroup) cantTradeGroup->setActive(true); - if (_BuyMean == MoneyGuildXP) - { - if (cantTradeButton) cantTradeButton->setText(CI18N::get("uiNotEnoughMoney")); - if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughMoney")); - } - else - { - if (cantTradeButton) cantTradeButton->setText(CI18N::get("uiNotEnoughGuildMoney")); - if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughGuildMoney")); - } - return; - } - if ((_BuyMean == MoneyGuildXP) || (_BuyMean == GuildMoneyGuildXP)) - { - if (totalXP > pGM->getXP()) - { - if (confirmTradeGroup) confirmTradeGroup->setActive(false); - if (cantTradeGroup) cantTradeGroup->setActive(true); - if (cantTradeButton) cantTradeButton->setText(CI18N::get("uiNotEnoughGuildXP")); - if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughGuildXP")); - return; - } - } - - if (confirmTradeGroup) confirmTradeGroup->setActive(true); - if (cantTradeGroup) cantTradeGroup->setActive(false); - - return; - } - - - // if price/quantity is valid - bool validSetup= priceWithoutFame != std::numeric_limits::max() && quantity != std::numeric_limits::max() && quantity != 0; - if(validSetup && _BuyMean==MoneyFactionPoints) - { - // valid if at least one price type is not 0 - validSetup= priceWithoutFame!=0 || fpCost!=0; - } - else if(validSetup && _BuyMean==SkillPoints) - { - // (nb: skillpoint==0 is a valid buy) - validSetup= true; - } - else if(validSetup) - { - // valid if price is not 0 - validSetup= priceWithoutFame != 0; - } - - // if the setup is finaly valid - if( validSetup ) - { - // basic price - uint64 totalPriceWithoutFame = (uint64) priceWithoutFame * (uint64) quantity; - NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:TRADE_ITEM:UNIT_PRICE")->setValue64(priceWithoutFame); - NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:TRADE_ITEM:PRICE")->setValue64(totalPriceWithoutFame); - // price with fame - uint64 totalPriceWithFame = (uint64) priceWithFame * (uint64) quantity; - NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:TRADE_ITEM:UNIT_PRICE_WITH_FAME")->setValue64(priceWithFame); - NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:TRADE_ITEM:PRICE_WITH_FAME")->setValue64(totalPriceWithFame); - // resale price - uint64 totalResalePrice = (uint64) resalePrice * (uint64) quantity; - NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:TRADE_ITEM:UNIT_PRICE_RESALE")->setValue64(resalePrice); - NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:TRADE_ITEM:PRICE_RESALE")->setValue64(totalResalePrice); - // quantity edit box - NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:TRADE_ITEM:EDIT_QUANTITY")->setValue64(quantity); - // Faction Points - NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:TRADE_ITEM:UNIT_PRICE_FACTION")->setValue64(fpCost); - NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:TRADE_ITEM:PRICE_FACTION")->setValue64(fpCost*quantity); - - - // Special retire Check - bool ok= true; - if(_CannotValidateBecauseRetireNotAvailable) - { - if (confirmTradeGroup) confirmTradeGroup->setActive(false); - if (confirmResellGroup) confirmResellGroup->setActive(false); - if (cantTradeGroup) cantTradeGroup->setActive(true); - // can't sell more than what is in inventory - if (cantTradeButton) cantTradeButton->setText(CI18N::get("uiBCNotAvailable")); - if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittBCNotAvailable")); - ok= false; - } - - // Quantity Check (only if previous check passed) - if(ok && _QuantityCheck) - { - // check if not bad quantity edited - if ((sint32)quantity > _QuantityCheck) - { - if (confirmTradeGroup) confirmTradeGroup->setActive(false); - if (confirmResellGroup) confirmResellGroup->setActive(false); - if (cantTradeGroup) cantTradeGroup->setActive(true); - // can't sell more than what is in inventory - if (cantTradeButton) cantTradeButton->setText(CI18N::get("uiBadQuantity")); - if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittBadQuantity")); - ok= false; - } - } - - // test only if quantity check passed - if(ok) - { - // see if player has enough money - if (_BuyDlgOn) - { - if ((_BuyMean == Money) || (_BuyMean == MoneyFactionPoints)) - { - if (totalPriceWithoutFame > getInventory().getMoney()) - { - if (confirmTradeGroup) confirmTradeGroup->setActive(false); - if (cantTradeGroup) cantTradeGroup->setActive(true); - if (cantTradeButton) cantTradeButton->setText(CI18N::get("uiNotEnoughMoney")); - if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughMoney")); - } - else if (_BuyMean == MoneyFactionPoints) - { - // Check if the player has enough faction point for the object selected - if ((confirmTradeGroup != NULL) && (cantTradeButton != NULL) && (cantTradeGroup != NULL)) - { - if ((fpCost*quantity) > userFactionPoints) - { - confirmTradeGroup->setActive(false); - cantTradeGroup->setActive(true); - cantTradeButton->setText(CI18N::get("uiNotEnoughFP_"+PVP_CLAN::toString(fpType))); - cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughFP_"+PVP_CLAN::toString(fpType))); - } - else - { - confirmTradeGroup->setActive(true); - cantTradeGroup->setActive(false); - } - } - } - else - { - if (confirmTradeGroup) confirmTradeGroup->setActive(true); - if (cantTradeGroup) cantTradeGroup->setActive(false); - } - } - else if (_BuyMean == SkillPoints) - { - uint32 numSkillPoints = getSkillPointUsedForCurrentRoleMaster(); - if (totalPriceWithoutFame > numSkillPoints) - { - if (confirmTradeGroup) confirmTradeGroup->setActive(false); - if (cantTradeGroup) cantTradeGroup->setActive(true); - if (cantTradeButton) cantTradeButton->setText(CI18N::get("uiNotEnoughSkillPoints")); - if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughSkillPoints")); - } - else - { - if (confirmTradeGroup) confirmTradeGroup->setActive(true); - if (cantTradeGroup) cantTradeGroup->setActive(false); - } - } - else if (_BuyMean == GuildXP) - { - CGuildManager *pGM = CGuildManager::getInstance(); - if (totalPriceWithoutFame > pGM->getXP()) - { - if (confirmTradeGroup) confirmTradeGroup->setActive(false); - if (cantTradeGroup) cantTradeGroup->setActive(true); - if (cantTradeButton) cantTradeButton->setText(CI18N::get("uiNotEnoughGuildXP")); - if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittNotEnoughGuildXP")); - } - else - { - if (confirmTradeGroup) confirmTradeGroup->setActive(true); - if (cantTradeGroup) cantTradeGroup->setActive(false); - } - } - } - else - { - // check ResalePrice - if(_ResaleEdit && resalePricesetActive(false); - if (confirmResellGroup) confirmResellGroup->setActive(false); - if (cantTradeGroup) cantTradeGroup->setActive(true); - // can't sell less than the basic price - if (cantTradeButton) cantTradeButton->setText(CI18N::get("uiBadResalePrice")); - if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittBadResalePrice")); - } - // else ok, can resell - else - { - if (confirmTradeGroup) confirmTradeGroup->setActive(true); - if (_ResaleEdit && confirmResellGroup) confirmResellGroup->setActive(true); - if (cantTradeGroup) cantTradeGroup->setActive(false); - } - } - } - } - // else price is not valid - else - { - // set value in database - NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:TRADE_ITEM:UNIT_PRICE")->setValue64(-1); - NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:TRADE_ITEM:UNIT_PRICE_WITH_FAME")->setValue64(-1); - NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:TRADE_ITEM:PRICE")->setValue64(-1); - NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:TRADE_ITEM:PRICE_WITH_FAME")->setValue64(-1); - NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:TRADE_ITEM:UNIT_PRICE_RESALE")->setValue64(-1); - NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:TRADE_ITEM:PRICE_RESALE")->setValue64(-1); - NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:TRADE_ITEM:EDIT_QUANTITY")->setValue64(0); - NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:TRADE_ITEM:UNIT_PRICE_FACTION")->setValue64(-1); - NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:TRADE_ITEM:PRICE_FACTION")->setValue64(-1); - // and update ok/cancel groups - if (confirmTradeGroup) confirmTradeGroup->setActive(false); - if (confirmResellGroup) confirmResellGroup->setActive(false); - if (cantTradeGroup) cantTradeGroup->setActive(true); - if (_SellDlgOn && priceWithoutFame == 0) - { - if (cantTradeButton) cantTradeButton->setText(CI18N::get("uiWontBuyThis")); - if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittWontBuyThis")); - } - else if (_SellDlgOn && priceWithoutFame == std::numeric_limits::max()) - { - if (cantTradeButton) cantTradeButton->setText(CI18N::get("uiPriceNotReceived")); - } - else if (quantity == 0 || quantity == std::numeric_limits::max()) - { - if (cantTradeButton) cantTradeButton->setText(CI18N::get("uiBadQuantity")); - if (cantTradeButton) cantTradeButton->setDefaultContextHelp(CI18N::get("uittBadQuantity")); - } - } - } - } -} - -// *************************************************************************************** -void CBotChatPageTrade::setupBuyMeanInModal(CInterfaceGroup *modal) -{ - if (!modal) return; - CViewBase *equal = modal->getView("standard_price:total_price:equal"); - CInterfaceGroup *money = modal->getGroup("standard_price:total_price:item_price"); - CInterfaceGroup *skillPoints = modal->getGroup("standard_price:total_price:sp"); - if (equal) equal->setActive(_BuyMean == Money); - if (money) money->setActive(_BuyMean == Money); - if (skillPoints) skillPoints->setActive(_BuyMean == SkillPoints); -} - -// *************************************************************************************** -void CBotChatPageTrade::startBuyDialog(CDBCtrlSheet *sheet, CCtrlBase * /* pCaller */) -{ - if (!sheet) return; - CInterfaceManager *im = CInterfaceManager::getInstance(); - CGroupContainer *ig = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WIN_BOT_CHAT_SELL_BUY_ITEM)); - if (!ig) return; - - // don't know why but in some case, the sheetId is 0 - if(sheet->getSheetId()==0) - return; - - bool isSPhrase = sheet->isSPhrase(); - bool isItem = !isSPhrase; - - // If this item is a User Item already sold (-1), cancel the RETIRE (in list only for information) - if( sheet->getType()==CCtrlSheetInfo::SheetType_Item && - (sheet->getItemSellerType()==BOTCHATTYPE::User || sheet->getItemSellerType()==BOTCHATTYPE::UserRetirable ) && - sheet->getItemPrice()==-1 ) - return; - - // Set price label - CViewText *priceLabel = dynamic_cast(ig->getView( "standard_price:total_price_header" )); - if ( _BuyMean == Money && priceLabel ) - { - priceLabel->setText( CI18N::get( "uiPrice" ) ); - priceLabel->setActive(true); - } - else - priceLabel->setActive( false ); - - // show quantity dialog if a correct item (only stackable items etc....) - uint defaultQuantity= initQuantityMode(false, sheet); - setupPriceGroupQuantity(ig->getGroup("standard_price"), defaultQuantity); - - // hide resell group, (cause its a buy) - setupResellGroup(false, defaultQuantity, ig, sheet); - - // setup edit focus - setupEditFocus(ig); - - // setup which price to use - setupPriceOrPriceRetire(false, sheet); - - // setup faction point price group - setupFactionPointPrice(false, defaultQuantity, ig, sheet); - - // set confirm button text - CCtrlTextButton *confirmButton = dynamic_cast(ig->getCtrl("ok")); - if (confirmButton) - { - confirmButton->setActive( true ); - // no need any context help because too simple - confirmButton->setDefaultContextHelp(ucstring()); - if(isItem) - { - CItemSheet * itemSheet = dynamic_cast ( SheetMngr.get( CSheetId( sheet->getSheetId() ) ) ); - if ( itemSheet && itemSheet->Family == ITEMFAMILY::COSMETIC ) - { - EGSPD::CPeople::TPeople people = ITEM_ORIGIN::itemOriginStringToPeopleEnum( ITEM_ORIGIN::enumToString( itemSheet->ItemOrigin ) ); - if ( UserEntity->getGender() != itemSheet->Cosmetic.Gender || UserEntity->people() != people ) - confirmButton->setActive( false ); - else - confirmButton->setText(CI18N::get(_UsePriceRetire?"uiRetire":"uiBuy")); - } - else - confirmButton->setText(CI18N::get(_UsePriceRetire?"uiRetire":"uiBuy")); - } - else - confirmButton->setText(CI18N::get("uiLearn")); - } - - // Hide direct sell button - CCtrlBase *resellButton = ig->getCtrl("confirm_trade_resell"); - if ( resellButton ) - resellButton->setActive(false); - - // set help for item - CSheetHelpSetup helpSetup; - fillHelpSetupInfosForTrade(helpSetup, sheet, ig); - setupSheetHelp(helpSetup); - // - ig->setActive(true); - ig->updateCoords(); - ig->center(); - ig->setModalParentList(_BuyOnly ? WIN_BOT_CHAT_PAGE_BUY : WIN_BOT_CHAT_PAGE_TRADE); - CWidgetManager::getInstance()->setTopWindow(ig); - // - _CurrItemSheet = sheet; - _CurrItemIndex = sheet->getIndexInDB(); - _CurrItemCheck.init(_CurrItemSheet); - _BuyDlgOn = true; - NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:TRADE_ITEM:IS_SELL_DLG")->setValueBool( false ); - // setup trade mean - setupBuyMeanInModal(ig); - // Add waiter to refresh items infos - InfoWindowUpdater.ItemSheet= _CurrItemSheet->getSheetId(); - InfoWindowUpdater.ItemSlotId= getInventory().getItemSlotId(_CurrItemSheet); - InfoWindowUpdater.Sheet = _CurrItemSheet; - // Add the waiter only if really needed (not for raw materials) - const CItemSheet *itemSheet= _CurrItemSheet->asItemSheet(); - if(itemSheet && itemSheet->Family != ITEMFAMILY::RAW_MATERIAL ) - getInventory().addItemInfoWaiter(&InfoWindowUpdater); -} - -// *************************************************************************** -void CBotChatPageTrade::updateSPhraseBuyDialog() -{ - if(!_CurrItemSheet) - return; - - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - - CGroupContainer *ig = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WIN_BOT_CHAT_SELL_BUY_ITEM)); - if (!ig) return; - - CSheetHelpSetup helpSetup; - fillHelpSetupInfosForTrade(helpSetup, _CurrItemSheet, ig); - setupSheetHelp(helpSetup); -} - -// *************************************************************************************** -void CBotChatPageTrade::startSellDialog(CDBCtrlSheet *sheet, CCtrlBase * /* pCaller */) -{ - nlassert(!_BuyOnly); - if (!sheet) return; - CInterfaceManager *im = CInterfaceManager::getInstance(); - CGroupContainer *ig = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WIN_BOT_CHAT_SELL_BUY_ITEM)); - if (!ig) return; - - // If this sheet is grayed cause of an "Animal Inventory unavailable" flag, quit - if (sheet->getItemBeastGrayed()) return; - - // Set price label - CViewText *priceLabel = dynamic_cast(ig->getView( "standard_price:total_price_header" )); - if ( priceLabel ) - { - priceLabel->setText( CI18N::get( "uiImmediatePrice" ) ); - priceLabel->setActive(true); - } - - // show quantity dialog if a correct item (only stackable items etc....) - uint defaultQuantity= initQuantityMode(true, sheet); - setupPriceGroupQuantity(ig->getGroup("standard_price"), defaultQuantity); - - // Setup resell group, only if item (cause its a sell) - setupResellGroup(true, defaultQuantity, ig, sheet); - - // setup edit focus - setupEditFocus(ig); - - // setup which price to use - setupPriceOrPriceRetire(true, sheet); - - // setup faction point price - setupFactionPointPrice(true, defaultQuantity, ig, sheet); - - // set confirm button text - CCtrlTextButton *confirmButton = dynamic_cast(ig->getCtrl("ok")); - if (confirmButton) - { - confirmButton->setActive( !sheet->getLockedByOwner() ); - confirmButton->setText(CI18N::get("uiSellImmediately")); - confirmButton->setDefaultContextHelp(CI18N::get("uittDirectSellButton")); - } - - // set item or skill name - CViewText *itemNameView = dynamic_cast(ig->getView("object_name")); - if (itemNameView) - { - ucstring itemName; - itemName = sheet->getItemActualName(); - itemNameView->setText(itemName); - } - - // set help for item - CSheetHelpSetup helpSetup; - fillHelpSetupInfosForTrade(helpSetup, sheet, ig); - setupSheetHelp(helpSetup); - // - ig->setActive(true); - ig->updateCoords(); - ig->center(); - ig->setModalParentList(WIN_BOT_CHAT_PAGE_TRADE); - CWidgetManager::getInstance()->setTopWindow(ig); - // - _CurrItemSheet = sheet; - _CurrItemIndex = sheet->getIndexInDB(); - _CurrItemInventory = sheet->getInventoryIndex(); - _CurrItemCheck.init(_CurrItemSheet); - _SellDlgOn = true; - NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:TRADE_ITEM:IS_SELL_DLG")->setValueBool( true ); - updateTradeModal(); - setupBuyMeanInModal(ig); - // Add waiter to refresh items infos - InfoWindowUpdater.ItemSheet= _CurrItemSheet->getSheetId(); - InfoWindowUpdater.ItemSlotId= getInventory().getItemSlotId(_CurrItemSheet); - InfoWindowUpdater.Sheet = _CurrItemSheet; - // Add the waiter only if really needed (not for raw materials) - const CItemSheet *itemSheet= _CurrItemSheet->asItemSheet(); - if(itemSheet && itemSheet->Family != ITEMFAMILY::RAW_MATERIAL ) - getInventory().addItemInfoWaiter(&InfoWindowUpdater); -} - -// *************************************************************************************** -void CBotChatPageTrade::endTradeModal() -{ - // do the cancel now (NB: will be recalled at close of the window....) - cancelTrade(); - - // hide the dialog - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CGroupContainer *ig = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WIN_BOT_CHAT_SELL_BUY_ITEM)); - if (ig) ig->setActive(false); - - // Hide any confirmation dialog related to trade (important for building MessageBox confirmation) - std::string vmbOnOk; - if(pIM->getCurrentValidMessageBoxOnOk(vmbOnOk)) - { - if(vmbOnOk=="confirm_trade") - CWidgetManager::getInstance()->disableModalWindow(); - } -} - -// *************************************************************************************** -void CBotChatPageTrade::setFocusOnEditBox(CInterfaceGroup *ebi) -{ - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - CGroupEditBox *eb = dynamic_cast(ebi); - if (eb) - { - CWidgetManager::getInstance()->setCaptureKeyboard(eb); - eb->setSelectionAll(); - } -} - -// *************************************************************************************** -bool CBotChatPageTrade::isTradeValid( bool enableResale ) const -{ - // If the Current Item has been canceled (eg: move out), then not valid! - if(!_CurrItemSheet) - return false; - - uint32 quantity= getCurrItemQuantity(); - uint64 priceWithoutFame = getCurrItemPrice(false); - sint32 resalePrice = getCurrItemPriceResale(); - - // Special case for guild options - if ((_BuyMean == MoneyGuildXP) || (_BuyMean == GuildMoney) || (_BuyMean == GuildMoneyGuildXP)) - { - uint64 totalPrice = (uint64) priceWithoutFame * (uint64) quantity; - uint64 totalXP = (uint64) getCurrItemXP() * (uint64) quantity; - CGuildManager *pGM = CGuildManager::getInstance(); - uint64 moneyOwned = (_BuyMean == MoneyGuildXP)?getInventory().getMoney():pGM->getMoney(); - if ((_BuyMean == MoneyGuildXP) || (_BuyMean == GuildMoneyGuildXP)) - return (totalPrice <= moneyOwned) && (totalXP <= pGM->getXP()); - return (totalPrice <= moneyOwned); - } - - // retrieve faction points - PVP_CLAN::TPVPClan fpType; - uint32 fpCost; - getCurrItemFactionTypePoints(fpType, fpCost); - - // if price/quantity is valid - bool validSetup= priceWithoutFame != std::numeric_limits::max() && quantity != std::numeric_limits::max() && quantity != 0; - if(validSetup && _BuyMean==MoneyFactionPoints) - { - // valid if at least one price type is not 0 - validSetup= priceWithoutFame!=0 || fpCost!=0; - } - else if(validSetup && _BuyMean==SkillPoints) - { - // (nb: skillpoint==0 is a valid buy) - validSetup= true; - } - else if(validSetup) - { - // valid if price is not 0 - validSetup= priceWithoutFame != 0; - } - - // if the setup is finaly valid - if( validSetup ) - { - // special retire check - if(_CannotValidateBecauseRetireNotAvailable) - return false; - - // quantity check - if(_QuantityCheck) - { - if( (sint32)quantity > _QuantityCheck ) - return false; - } - - // Buy dlg - if (_BuyDlgOn) - { - uint64 totalPrice = (uint64) priceWithoutFame * (uint64) quantity; - if (_BuyMean == Money) - { - return totalPrice <= getInventory().getMoney(); - } - if (_BuyMean == MoneyFactionPoints) - { - return ((totalPrice <= getInventory().getMoney()) && - (quantity*fpCost <= getUserFactionPoints(fpType))); - } - else if (_BuyMean == SkillPoints) - { - uint32 numSkillPoints = getSkillPointUsedForCurrentRoleMaster(); - return totalPrice <= numSkillPoints; - } - else if (_BuyMean == GuildXP) - { - CGuildManager *pGM = CGuildManager::getInstance(); - return totalPrice <= pGM->getXP(); - } - } - // Sell dlg - else - { - return (!_ResaleEdit || !enableResale || (sint32)priceWithoutFame <= resalePrice); - } - } - return false; -} - - -// *************************************************************************************** -void CBotChatPageTrade::confirmTrade( bool enableResale ) -{ - bool resaleEnabled = _SellDlgOn && enableResale; - - if (!_CurrItemSheet) - { - endTradeModal(); - return; - } - if (_BuyDlgOn || _SellDlgOn) - { - uint32 quantity = getCurrItemQuantity(); - sint32 resalePrice = resaleEnabled ? getCurrItemPriceResale() : 0; // getCurrItemPriceResale() returns 0 is !_ResaleEdit - if (quantity != std::numeric_limits::max()) - { - uint16 u16Quantity = (uint16) quantity; - // The Item bought is a SPhrase ? - if(_CurrItemSheet->isSPhrase()) - { - // cant sell phrase - if ( _SellDlgOn ) - return; - - // code in action_handler_phrase.cpp - extern void phraseBuyBotChat(CDBCtrlSheet *ctrl, uint8 index, bool useBuySheetMsg); - // client Side fill Mode? => use PHRASE:BUY_SHEET - phraseBuyBotChat(_CurrItemSheet, (uint8) _CurrItemIndex, _TradePagesObs.isPhraseClientFill()); - - // lower the SkillPoints available. - sint32 price = (sint32)getCurrItemPrice(false); - sint32 totalPrice= quantity * price; - addSkillPointForCurrentRoleMaster(-totalPrice); - - // hide the phrase - _CurrItemSheet->setSheetId(0); - } - // Else standard buy. - else - { - if (_BuyDlgOn) - { - NLMISC::CBitMemStream out; - - if ((_BuyMean == MoneyGuildXP) || (_BuyMean == GuildMoney) || ((_BuyMean == GuildMoneyGuildXP))) - { - const char *msg="BOTCHAT:BUY_GUILD_OPTION"; - if(GenericMsgHeaderMngr.pushNameToStream(msg, out)) - { - uint8 u8Index = (uint) _CurrItemIndex; - out.serial(u8Index); - NetMngr.push(out); - //nlinfo("impulseCallBack sent: %s %d", msg, u8Index); - } - else - nlwarning(" unknown message name '%s'", msg); - } - else - { - // bug #212: Server should check if player has enough room in his inventory - // before removing items in trade window - // Temp fix on client side : check room in player's bag before removing items - - // Get inventory manager instance - CInventoryManager *pInv = CInventoryManager::getInstance(); - - // Check if player has enough space in his bag - bool isSpaceInBag = pInv->isSpaceInBagForItem(_CurrItemSheet, quantity, 0); - - const char *msg="BOTCHAT:BUY"; - if(GenericMsgHeaderMngr.pushNameToStream(msg, out)) - { - uint16 u16Index = (uint16) _CurrItemIndex; - out.serial(u16Index); - out.serial(u16Quantity); - NetMngr.push(out); - //nlinfo("impulseCallBack sent: %s %d %d", msg, u16Index, u16Quantity); - } - else - nlwarning(" unknown message name '%s'", msg); - - // If player has enough space in his bag... - if (isSpaceInBag) - { - // If the Buy is from a Player item or User item (retire) localy delete it - if (_BuyMean == Money && _CurrItemSheet->getItemSellerType()!=BOTCHATTYPE::NPC) - { - // if item stackable, the player was allowed to buy only a subset - if(_QuantityEdit) - { - sint32 curQuantity= _CurrItemSheet->getQuantity(); - if(u16QuantitysetQuantity(curQuantity-u16Quantity); - else - // hide the item - _CurrItemSheet->setSheetId(0); - } - else - { - // hide the item - _CurrItemSheet->setSheetId(0); - } - } - } - } - } - else - { - const char *msg="BOTCHAT:SELL"; - NLMISC::CBitMemStream out; - if(GenericMsgHeaderMngr.pushNameToStream(msg, out)) - { - uint8 u8Inv = (uint8) _CurrItemInventory; - uint16 u16Index = (uint16) _CurrItemIndex; - uint32 u32resalePrice = (uint32)max((sint32)0, resalePrice); - out.serial(u8Inv); - out.serial(u16Index); - out.serial(u16Quantity); - out.serial(u32resalePrice); - NetMngr.push(out); - //nlinfo("impulseCallBack sent: %s %d %d %d %d", msg, u8Inv, u16Index, u16Quantity, u32resalePrice); - } - else - nlwarning(" unknown message name '%s'", msg); - - // Write the value of the resale margin to the persistant database - if ( _ResaleEdit ) - { - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CInterfaceGroup *ig = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WIN_BOT_CHAT_SELL_BUY_ITEM)); - if (ig) - { - CGroupEditBox *eb = dynamic_cast(ig->getGroup("header_opened:resell_group:can_resell:choose_resell:edit:eb")); - if (eb) - { - NLGUI::CDBManager::getInstance()->getDbProp( "UI:SAVE:TRADE_ITEM:RESALE_MARGIN" )->setValue32( eb->getInputStringAsInt() ); - } - } - } - } - } - } - } - - // get itemSheet before _CurrItemSheet set to NULL in endTradeModal() - const CItemSheet *itemSheet = _CurrItemSheet->asItemSheet(); - - // close modal dialog - endTradeModal(); - - // Close all if its a guild option - if (itemSheet && itemSheet->Family == ITEMFAMILY::GUILD_OPTION) - CBotChatManager::getInstance()->endDialog(); - -} - -// *************************************************************************************** -void CBotChatPageTrade::cancelTrade() -{ - // remove infos waiter (if not already canceled) - if (_CurrItemSheet) - { - // Add the waiter only if really needed (not for raw materials) - const CItemSheet *itemSheet= _CurrItemSheet->asItemSheet(); - if(itemSheet && itemSheet->Family != ITEMFAMILY::RAW_MATERIAL ) - getInventory().removeItemInfoWaiter(&InfoWindowUpdater); - } - // - _BuyDlgOn = false; - _SellDlgOn = false; - _ResaleEdit = false; - _QuantityEdit = false; - _UsePriceRetire = false; - _CannotValidateBecauseRetireNotAvailable = false; - _QuantityCheck = 0; - _CurrItemSheet = NULL; - _CurrItemCheck.reset(); -} - -// *************************************************************************** -sint32 CBotChatPageTrade::getSkillPointUsedForCurrentRoleMaster() const -{ - // get the current phrase rolemaster type - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - uint rmt= NLGUI::CDBManager::getInstance()->getDbProp("SERVER:BOTCHAT:ROLEMASTER_TYPE")->getValue32(); - // get the prop (use local for less lag) - CCDBNodeLeaf *node= NLGUI::CDBManager::getInstance()->getDbProp(toString("LOCAL:USER:SKILL_POINTS_%d:VALUE", rmt), false); - if(node) - return node->getValue32(); - else - return 0; -} - - -// *************************************************************************** -void CBotChatPageTrade::addSkillPointForCurrentRoleMaster(sint32 addValue) const -{ - // get the current phrase rolemaster type - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - uint rmt= NLGUI::CDBManager::getInstance()->getDbProp("SERVER:BOTCHAT:ROLEMASTER_TYPE")->getValue32(); - // add the local prop !! - CCDBNodeLeaf *node= NLGUI::CDBManager::getInstance()->getDbProp(toString("LOCAL:USER:SKILL_POINTS_%d:VALUE", rmt), false); - if(node) - { - node->setValue32(node->getValue32() + addValue); - } -} - - - -// *************************************************************************** -uint CBotChatPageTrade::initQuantityMode(bool sellMode, CDBCtrlSheet *sheet) -{ - nlassert(sheet); - - // default - _QuantityEdit= false; - _QuantityCheck = 0; - uint defaultQuantity= 0; - - // Quantity only for some items - const CItemSheet *pIS= sheet->asItemSheet(); - if( pIS && (pIS->Stackable>1 || pIS->Family == ITEMFAMILY::ITEM_SAP_RECHARGE) && pIS->Family!=ITEMFAMILY::TELEPORT ) - { - // if sell, init quantity with the whole inventory stack - if(sellMode) - { - defaultQuantity= std::max((sint32) 1, sheet->getQuantity()); - _QuantityCheck= defaultQuantity; - } - // else - else - { - // Depends on SellerType: If NPC, set 1 by default - if(sheet->getItemSellerType() == BOTCHATTYPE::NPC) - { - defaultQuantity= 1; - // no quantity check cause infinite - _QuantityCheck= 0; - } - // else set the whole stack (player or user resale) - else - { - defaultQuantity= std::max((sint32) 1, sheet->getQuantity()); - _QuantityCheck= defaultQuantity; - } - } - - // edit ok! - _QuantityEdit= true; - } - - return defaultQuantity; -} - -// *************************************************************************** -void CBotChatPageTrade::setupPriceGroupQuantity(CInterfaceGroup *priceGroup, sint32 defaultQuantity) -{ - // if window not found, quit - if(!priceGroup) - return; - - // If don't want to enable quantity - if(!_QuantityEdit) - { - // hide elements and headers - CInterfaceGroup *quantityGroup = priceGroup->getGroup("quantity"); - if (quantityGroup) quantityGroup->setActive(false); - CViewBase *elt = priceGroup->getView("quantity_header"); - if ( elt ) elt->setActive(false); - elt = priceGroup->getGroup("unit_price"); - if ( elt ) elt->setActive(false); - elt = priceGroup->getView("unit_price_header"); - if ( elt ) elt->setActive(false); - } - else - { - // show elements and header - CInterfaceGroup *quantityGroup = priceGroup->getGroup("quantity"); - if (quantityGroup) quantityGroup->setActive(true); - CViewBase *elt = priceGroup->getView("quantity_header"); - if ( elt ) elt->setActive(true); - elt = priceGroup->getGroup("unit_price"); - if ( elt ) elt->setActive(true); - elt = priceGroup->getView("unit_price_header"); - if ( elt ) elt->setActive(true); - - // setup the quantity in the edit box - if(quantityGroup) - { - // NB: some group don't have an edit box (just a replication of quantity) - CGroupEditBox *eb = dynamic_cast(quantityGroup->getGroup("edit:eb")); - if (eb) - { - eb->setInputString(toString(defaultQuantity)); - } - } - } - - -} - - -// *************************************************************************** -void CBotChatPageTrade::setupResellGroup(bool sellMode, uint defaultQuantity, CInterfaceGroup *parentGroup, CDBCtrlSheet *sheet) -{ - nlassert(sheet); - - // default - _ResaleEdit= false; - - // if window not found, quit - if(!parentGroup) - return; - - // must be a sell, must be an item, and must be in a standard BuyMean, also must be a ressellable item - CInterfaceGroup *resellGroup = parentGroup->getGroup("resell_group"); - if ( ! resellGroup ) - return; - - // Yoyo: can resell only on a "money only" reseler - const CItemSheet *pIS= sheet->asItemSheet(); - bool resellable= sellMode && pIS && _BuyMean == Money && ITEMFAMILY::isResellable(pIS->Family) ; - // also cannot resell Raw Material that don't have any item part (formula materials, because cannot filter them) - if(pIS && pIS->Family==ITEMFAMILY::RAW_MATERIAL && !pIS->canBuildSomeItemPart()) - resellable= false; - - // cannot resell? - if( !resellable ) - { - // hide - if ( resellGroup ) resellGroup->setActive(false); - CCtrlBase *confirmResellGroup = parentGroup->getCtrl("confirm_trade_resell"); - if ( confirmResellGroup ) confirmResellGroup->setActive(false); - _ResaleEdit = false; - } - else - { - // show - if ( resellGroup ) resellGroup->setActive(true); - - // get sub elements - CInterfaceGroup *canResellGroup= resellGroup->getGroup("can_resell"); - CInterfaceGroup *cantResellGroup= resellGroup->getGroup("cant_resell"); - CInterfaceGroup *chooseResellGroup= resellGroup->getGroup("can_resell:choose_resell"); - CCtrlBase *confirmResellGroup = parentGroup->getCtrl("confirm_trade_resell"); - if(!canResellGroup || !cantResellGroup || !chooseResellGroup || !confirmResellGroup) - { - nlwarning("XML error, cannot setup resale"); - resellGroup->setActive(false); - _ResaleEdit = false; - return; - } - - // Get item state - string baseDB= sheet->getSheet(); - BOTCHATTYPE::TBotChatResaleFlag resaleFlag= (BOTCHATTYPE::TBotChatResaleFlag)sheet->getItemResaleFlag(); -// sint basePrice = sint(sheet->getItemPrice() * _FamePriceFactorLeaf->getValue16()/10000.0f); - - // if cannot resell this item, setup "cant_resell group" - if(resaleFlag!=BOTCHATTYPE::ResaleOk) - { - canResellGroup->setActive(false); - confirmResellGroup->setActive(false); - cantResellGroup->setActive(true); - // resale is not possible! - _ResaleEdit = false; - - // setup the reason - CViewText *vt= dynamic_cast(cantResellGroup->getView("reason")); - if(vt) - { - if(resaleFlag == BOTCHATTYPE::ResaleKOBroken) - vt->setHardText("uiCantResaleCauseDamaged"); - else if (resaleFlag == BOTCHATTYPE::ResaleKONoTimeLeft) - vt->setHardText("uiCantResaleCauseTooLate"); - else - vt->setHardText("uiCantResaleLockedByOwner"); - } - } - // else setup "can_resell:choose_resell group" - else - { - canResellGroup->setActive(true); - confirmResellGroup->setActive(true); - cantResellGroup->setActive(false); - // resale is possible! - _ResaleEdit = true; - - // setup the quantity of the "choose resell" group - setupPriceGroupQuantity(chooseResellGroup, defaultQuantity); - - // setup resale margin using value stored in database - CGroupEditBox *eb = dynamic_cast(chooseResellGroup->getGroup("edit:eb")); - if (eb) - { - sint32 resaleMargin= NLGUI::CDBManager::getInstance()->getDbProp( "UI:SAVE:TRADE_ITEM:RESALE_MARGIN" )->getValue32(); - clamp(resaleMargin, 0, (sint32)MaxResaleMargin); - eb->setInputString( toString( resaleMargin ) ); - eb->setPositiveIntegerMaxValue(MaxResaleMargin); - } - } - } -} - - -// *************************************************************************** -void CBotChatPageTrade::setupEditFocus(CInterfaceGroup *parentGroup) -{ - // TODODO: edit box in faction points? - // if Quantity edited, always start focus in quantity edit box - if(_QuantityEdit) - { - nlassert(parentGroup); - - CGroupEditBox *eb= dynamic_cast(parentGroup->getGroup("standard_price:quantity:edit:eb")); - if(eb) - { - // set focus - setFocusOnEditBox(eb); - } - } -} - - -// *************************************************************************** -void CBotChatPageTrade::setupPriceOrPriceRetire(bool sellMode, CDBCtrlSheet *sheet) -{ - nlassert(sheet); - - // default - _UsePriceRetire= false; - _CannotValidateBecauseRetireNotAvailable= false; - - // must be a buy, must be an item, and must be in a standard BuyMean - const CItemSheet *pIS= sheet->asItemSheet(); - if( !sellMode && pIS && _BuyMean == Money ) - { - // test SELLER_TYPE. if User or ResaleAndUser, then this item belongs to us - // => just pay the PRICE_RETIRE, not the Full Price - sint32 st= sheet->getItemSellerType(); - if( st==BOTCHATTYPE::UserRetirable || st==BOTCHATTYPE::ResaleAndUserRetirable || - st==BOTCHATTYPE::User || st==BOTCHATTYPE::ResaleAndUser ) - { - _UsePriceRetire= true; - // if not retirable, can't validate - if(st==BOTCHATTYPE::User || st==BOTCHATTYPE::ResaleAndUser) - _CannotValidateBecauseRetireNotAvailable= true; - } - - // Check that we can take cosmetic that cannot be applied to the player - if (pIS->Family == ITEMFAMILY::COSMETIC) - { - EGSPD::CPeople::TPeople people = ITEM_ORIGIN::itemOriginStringToPeopleEnum( ITEM_ORIGIN::enumToString( pIS->ItemOrigin ) ); - if (UserEntity->getGender() != pIS->Cosmetic.Gender || UserEntity->people() != people ) - _CannotValidateBecauseRetireNotAvailable= true; - } - } -} - -// *************************************************************************** -void CBotChatPageTrade::setupFactionPointPrice(bool /* sellMode */, uint defaultQuantity, CInterfaceGroup *parentGroup, CDBCtrlSheet *sheet) -{ - nlassert(sheet); - - // if window not found, quit - if(!parentGroup) - return; - - // get the faction point cost and type - CInterfaceGroup *fpGroup= parentGroup->getGroup("faction_price"); - CViewBase *upView= parentGroup->getView("standard_price:unit_price_header"); - CInterfaceGroup *upGroup= parentGroup->getGroup("standard_price:unit_price"); - - if(!fpGroup || !upView || !upGroup) - return; - - // get the current faction point cost and type - PVP_CLAN::TPVPClan fpType; - uint32 fpCost; - getItemFactionTypePoints(sheet, fpType, fpCost); - if(fpCost==0 || fpType==PVP_CLAN::None) - { - // disable faction price group - fpGroup->setActive(false); - upView->setActive(true); - upGroup->setActive(true); - } - else - { - - //Disable Price - upView->setActive(false); - upGroup->setActive(false); - - // enable faction price gropu - fpGroup->setActive(true); - - // Setup quantity view in this group - setupPriceGroupQuantity(fpGroup, defaultQuantity); - - // setup faction name according to pvp clan - string factionName= PVP_CLAN::toString(fpType); - CViewText *vt= dynamic_cast(fpGroup->getView("unit_price_header")); - if(vt) - { - ucstring fmt= CI18N::get("uiUnitFPPrice"); - strFindReplace(fmt, "%fac", factionName); - vt->setText(fmt); - } - vt= dynamic_cast(fpGroup->getView("total_price_header")); - if(vt) - { - ucstring fmt= CI18N::get("uiTotalFPPrice"); - strFindReplace(fmt, "%fac", factionName); - vt->setText(fmt); - } - - // setup icon according to pvp clan - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - factionName = NLMISC::toLower(factionName); - string factionIcon= CWidgetManager::getInstance()->getParser()->getDefine(toString("faction_icon_%s", factionName.c_str())); - CViewBitmap *vBmp= dynamic_cast(fpGroup->getView("unit_price:item_price:icone")); - if(vBmp) vBmp->setTexture(factionIcon); - vBmp= dynamic_cast(fpGroup->getView("total_price:item_price:icone")); - if(vBmp) vBmp->setTexture(factionIcon); - } - -} - -// *************************************************************************** -void CBotChatPageTrade::startChangeBuyFilterDialog(const std::string &dbext, const std::string &title, uint32 maxValue) -{ - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - - _FilterBuyDlgDBExt= dbext; - _FilterBuyDlgMaxValue= maxValue; - - // change the title - CInterfaceGroup *ig= dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WIN_BOT_CHAT_CHANGE_BUY_FILTER)); - if(!ig) return; - CViewText *vtitle= dynamic_cast(ig->getView("title")); - if(vtitle) - vtitle->setHardText(title); - - // init min and max edit box - CGroupEditBox *edMin = dynamic_cast(ig->getGroup("edit_min:eb")); - CGroupEditBox *edMax = dynamic_cast(ig->getGroup("edit_max:eb")); - CCDBNodeLeaf *dbRangeMin= NLGUI::CDBManager::getInstance()->getDbProp(string(DB_BOT_CHAT_BASE_BUY_FILTER":MIN_") + _FilterBuyDlgDBExt, false); - CCDBNodeLeaf *dbRangeMax= NLGUI::CDBManager::getInstance()->getDbProp(string(DB_BOT_CHAT_BASE_BUY_FILTER":MAX_") + _FilterBuyDlgDBExt, false); - sint rangeMin= 0; - sint rangeMax= 0; - if(dbRangeMin) rangeMin= dbRangeMin->getValue32(); - if(dbRangeMax) rangeMax= dbRangeMax->getValue32(); - if(edMin) edMin->setInputString(toString(rangeMin)); - if(edMax) edMax->setInputString(toString(rangeMax)); - if(edMin) edMin->setPositiveIntegerMaxValue(maxValue); - if(edMax) edMax->setPositiveIntegerMaxValue(maxValue); - - // set focus on MIN edit box - setFocusOnEditBox(ig->getGroup("edit_min:eb")); - - // go - CWidgetManager::getInstance()->enableModalWindow(NULL, ig); -} - -// *************************************************************************** -void CBotChatPageTrade::resetBuyFilterDialog() -{ - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - - // get the modal window - CInterfaceGroup *ig= dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WIN_BOT_CHAT_CHANGE_BUY_FILTER)); - if(!ig) return; - - // reset the edited values - CGroupEditBox *edMin = dynamic_cast(ig->getGroup("edit_min:eb")); - CGroupEditBox *edMax = dynamic_cast(ig->getGroup("edit_max:eb")); - CCDBNodeLeaf *dbRangeMin= NLGUI::CDBManager::getInstance()->getDbProp(string(DB_BOT_CHAT_BASE_BUY_FILTER":MIN_") + _FilterBuyDlgDBExt, false); - CCDBNodeLeaf *dbRangeMax= NLGUI::CDBManager::getInstance()->getDbProp(string(DB_BOT_CHAT_BASE_BUY_FILTER":MAX_") + _FilterBuyDlgDBExt, false); - sint rangeMin= 0; - sint rangeMax= _FilterBuyDlgMaxValue; - // write result in EditBox, and in db - if(edMin) edMin->setInputString(toString(rangeMin)); - if(edMax) edMax->setInputString(toString(rangeMax)); - if(dbRangeMin) dbRangeMin->setValue32(rangeMin); - if(dbRangeMax) dbRangeMax->setValue32(rangeMax); - - // reset validate also the filter (as in confirm) - sendCurrentBuyFilterToServer(true); - - // and leave modal - CWidgetManager::getInstance()->disableModalWindow(); -} - -// *************************************************************************** -void CBotChatPageTrade::confirmChangeBuyFilterDialog() -{ - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - - // get the modal window - CInterfaceGroup *ig= dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WIN_BOT_CHAT_CHANGE_BUY_FILTER)); - if(!ig) return; - - // retrieve the edited values - CGroupEditBox *edMin = dynamic_cast(ig->getGroup("edit_min:eb")); - CGroupEditBox *edMax = dynamic_cast(ig->getGroup("edit_max:eb")); - CCDBNodeLeaf *dbRangeMin= NLGUI::CDBManager::getInstance()->getDbProp(string(DB_BOT_CHAT_BASE_BUY_FILTER":MIN_") + _FilterBuyDlgDBExt, false); - CCDBNodeLeaf *dbRangeMax= NLGUI::CDBManager::getInstance()->getDbProp(string(DB_BOT_CHAT_BASE_BUY_FILTER":MAX_") + _FilterBuyDlgDBExt, false); - sint rangeMin= 0; - sint rangeMax= 0; - if(edMin) rangeMin= edMin->getInputStringAsInt(); - if(edMax) rangeMax= edMax->getInputStringAsInt(); - // only positive values are posssible here - rangeMin= max(0, rangeMin); - rangeMax= max(rangeMin, rangeMax); - - // write result in DB - if(dbRangeMin) dbRangeMin->setValue32(rangeMin); - if(dbRangeMax) dbRangeMax->setValue32(rangeMax); - - // Then send new filter to Server, and reset item list - sendCurrentBuyFilterToServer(true); - - // and leave modal - CWidgetManager::getInstance()->disableModalWindow(); -} - -// *************************************************************************** -void CBotChatPageTrade::giveFocusToMaxEBChangeBuyFilterDialog() -{ - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - - // get the modal window - CInterfaceGroup *ig= dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WIN_BOT_CHAT_CHANGE_BUY_FILTER)); - if(!ig) return; - - // set focus on max - setFocusOnEditBox(ig->getGroup("edit_max:eb")); -} - -// *************************************************************************** -void CBotChatPageTrade::startChangeBuyFilterMPDialog() -{ - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - - // show the modal - CInterfaceGroup *ig= dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WIN_BOT_CHAT_CHANGE_BUY_FILTER_MP)); - if(!ig) return; - - // go - CWidgetManager::getInstance()->enableModalWindow(NULL, ig); -} - -// *************************************************************************** -void CBotChatPageTrade::confirmChangeBuyFilterMPDialog(uint ft) -{ - ft= min(ft, (uint)RM_FABER_TYPE::Unknown); - - // set ItemPart DB - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - CCDBNodeLeaf *dbItemPart= NLGUI::CDBManager::getInstance()->getDbProp(string(DB_BOT_CHAT_BASE_BUY_FILTER":MP_ITEM_PART"), false); - if(dbItemPart) dbItemPart->setValue32(ft); - - // Then send new filter to Server, and reset item list - sendCurrentBuyFilterToServer(true); - - // and leave modal - CWidgetManager::getInstance()->disableModalWindow(); -} - -// *************************************************************************** -void CBotChatPageTrade::resetItemPartAndTypeFilters() -{ - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - - CCDBNodeLeaf *dbItemPart= NLGUI::CDBManager::getInstance()->getDbProp(DB_BOT_CHAT_BASE_BUY_FILTER":MP_ITEM_PART" , false); - CCDBNodeLeaf *dbItemType= NLGUI::CDBManager::getInstance()->getDbProp(DB_BOT_CHAT_BASE_BUY_FILTER":ITEM_TYPE" , false); - - if(dbItemPart) dbItemPart->setValue32(RM_FABER_TYPE::Unknown); - if(dbItemType) dbItemType->setValue32(ITEM_TYPE::UNDEFINED); -} - -// *************************************************************************** -void CBotChatPageTrade::sendCurrentBuyFilterToServer(bool resetBuyList) -{ - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - - // **** retrieve current DB values - CCDBNodeLeaf *dbQualityMin= NLGUI::CDBManager::getInstance()->getDbProp(DB_BOT_CHAT_BASE_BUY_FILTER":MIN_QUALITY" , false); - CCDBNodeLeaf *dbQualityMax= NLGUI::CDBManager::getInstance()->getDbProp(DB_BOT_CHAT_BASE_BUY_FILTER":MAX_QUALITY" , false); - CCDBNodeLeaf *dbPriceMin= NLGUI::CDBManager::getInstance()->getDbProp(DB_BOT_CHAT_BASE_BUY_FILTER":MIN_PRICE" , false); - CCDBNodeLeaf *dbPriceMax= NLGUI::CDBManager::getInstance()->getDbProp(DB_BOT_CHAT_BASE_BUY_FILTER":MAX_PRICE" , false); - CCDBNodeLeaf *dbClassMin= NLGUI::CDBManager::getInstance()->getDbProp(DB_BOT_CHAT_BASE_BUY_FILTER":MIN_CLASS" , false); - CCDBNodeLeaf *dbClassMax= NLGUI::CDBManager::getInstance()->getDbProp(DB_BOT_CHAT_BASE_BUY_FILTER":MAX_CLASS" , false); - CCDBNodeLeaf *dbItemPart= NLGUI::CDBManager::getInstance()->getDbProp(DB_BOT_CHAT_BASE_BUY_FILTER":MP_ITEM_PART" , false); - CCDBNodeLeaf *dbItemType= NLGUI::CDBManager::getInstance()->getDbProp(DB_BOT_CHAT_BASE_BUY_FILTER":ITEM_TYPE" , false); - - uint32 qualityMin=0, qualityMax=0; - uint32 priceMin=0, priceMax=0; - uint8 classMin= 0, classMax= RM_CLASS_TYPE::NumTRMClassType-1; // max class is 4 - // Yoyo: XML is hardcoded for max_class==4. (config.xml and bot_chat_v4.xml) - nlctassert(RM_CLASS_TYPE::NumTRMClassType-1==4); - uint8 itemPart= RM_FABER_TYPE::Unknown; - uint8 itemType= ITEM_TYPE::UNDEFINED; - if(dbQualityMin) qualityMin= dbQualityMin->getValue32(); - if(dbQualityMax) qualityMax= dbQualityMax->getValue32(); - if(dbPriceMin) priceMin= dbPriceMin->getValue32(); - if(dbPriceMax) priceMax= dbPriceMax->getValue32(); - if(dbClassMin) classMin= (uint8)dbClassMin->getValue32(); - if(dbClassMax) classMax= (uint8)dbClassMax->getValue32(); - if(dbItemPart) itemPart= (uint8)dbItemPart->getValue32(); - if(dbItemType) itemType= (uint8)dbItemType->getValue32(); - - // **** send msg - const char *msg="BOTCHAT:SET_FILTERS"; - NLMISC::CBitMemStream out; - if(GenericMsgHeaderMngr.pushNameToStream(msg, out)) - { - out.serial(qualityMin); - out.serial(qualityMax); - out.serial(priceMin); - out.serial(priceMax); - out.serial(classMin); - out.serial(classMax); - out.serial(itemPart); - out.serial(itemType); - NetMngr.push(out); - //nlinfo("impulseCallBack sent: %s %d %d %d %d %d %d %d %d", msg, qualityMin, qualityMax, priceMin, priceMax, classMin, classMax, itemPart, itemType); - } - else - nlwarning(" unknown message name '%s'", msg); - - - // **** Server has incremented SessionId, do it on our side - // increment session id on our side - CBotChatManager::getInstance()->incrementSessionID(); - - // and reset hugeListObs - if(resetBuyList) - { - // Start the HugeList - _TradePagesObs.start(); - - // update interface - CGroupContainer *gc = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(_BuyOnly ? WIN_BOT_CHAT_PAGE_BUY : WIN_BOT_CHAT_PAGE_TRADE)); - if (gc) - { - // unselect just buy list (don't need for sell) - unselectBuyList(gc); - } - } - -} - -// *************************************************************************** -void CBotChatPageTrade::unselectBuyList(CGroupContainer *gc) -{ - CInterfaceGroup *buyGroup = gc->getGroup("buy"); - if (buyGroup) - { - // unselect NPC/Player group - CDBGroupListSheetText *buyListSheet = dynamic_cast(buyGroup->getGroup("general_buy")); - if (buyListSheet) - buyListSheet->unselect(); - // unselect Player group - buyListSheet = dynamic_cast(buyGroup->getGroup("player_buy")); - if (buyListSheet) - buyListSheet->unselect(); - } -} - -// *************************************************************************** -void CBotChatPageTrade::unselectSellList(CGroupContainer *gc) -{ - CInterfaceGroup *sellGroup = gc->getGroup("sell"); - if (sellGroup) - { - // unselect the bag - CDBGroupListSheetText *sellListSheet = dynamic_cast(sellGroup->getGroup("bag_sell")); - if (sellListSheet) - sellListSheet->unselect(); - // unselect all pack animals - for(uint i=0;i(sellGroup->getGroup(toString("beast%d_sell", i))); - if (sellListSheet) - sellListSheet->unselect(); - } - } -} - -// *************************************************************************** -void CBotChatPageTrade::refreshResale() -{ - // **** send msg - const char *msg="BOTCHAT:REFRESH_TRADE_LIST"; - NLMISC::CBitMemStream out; - if(GenericMsgHeaderMngr.pushNameToStream(msg, out)) - { - NetMngr.push(out); - //nlinfo("impulseCallBack sent: %s", msg); - } - else - nlwarning(" unknown message name '%s'", msg); - - - // **** Server has incremented SessionId, do it on our side - // increment session id on our side - CBotChatManager::getInstance()->incrementSessionID(); - - // and reset hugeListObs - { - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - - // Start the HugeList - _TradePagesObs.start(); - - // update interface - CGroupContainer *gc = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(_BuyOnly ? WIN_BOT_CHAT_PAGE_BUY : WIN_BOT_CHAT_PAGE_TRADE)); - if (gc) - { - // unselect just buy list (don't need for sell) - unselectBuyList(gc); - } - } -} - - -// *************************************************************************** -void CBotChatPageTrade::startChangeBuyFilterClassDialog() -{ - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - - // Copy from save to Temp edition - CCDBNodeLeaf *dbClassMin= NLGUI::CDBManager::getInstance()->getDbProp(DB_BOT_CHAT_BASE_BUY_FILTER":MIN_CLASS" , false); - CCDBNodeLeaf *dbClassMax= NLGUI::CDBManager::getInstance()->getDbProp(DB_BOT_CHAT_BASE_BUY_FILTER":MAX_CLASS" , false); - CCDBNodeLeaf *tempClassMin= NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:BOTCHAT:TEMP_FILTER_MIN_CLASS"); - CCDBNodeLeaf *tempClassMax= NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:BOTCHAT:TEMP_FILTER_MAX_CLASS"); - if(dbClassMin) tempClassMin->setValue32(dbClassMin->getValue32()); - if(dbClassMax) tempClassMax->setValue32(dbClassMax->getValue32()); - - // show the modal - CInterfaceGroup *ig= dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WIN_BOT_CHAT_CHANGE_BUY_FILTER_CLASS)); - if(!ig) return; - - // go - CWidgetManager::getInstance()->enableModalWindow(NULL, ig); -} - - -// *************************************************************************** -void CBotChatPageTrade::resetBuyFilterClassDialog() -{ - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - - // Copy from save to Temp edition - CCDBNodeLeaf *dbClassMin= NLGUI::CDBManager::getInstance()->getDbProp(DB_BOT_CHAT_BASE_BUY_FILTER":MIN_CLASS" , false); - CCDBNodeLeaf *dbClassMax= NLGUI::CDBManager::getInstance()->getDbProp(DB_BOT_CHAT_BASE_BUY_FILTER":MAX_CLASS" , false); - CCDBNodeLeaf *tempClassMin= NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:BOTCHAT:TEMP_FILTER_MIN_CLASS"); - CCDBNodeLeaf *tempClassMax= NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:BOTCHAT:TEMP_FILTER_MAX_CLASS"); - // write in both DB - tempClassMin->setValue32(0); - tempClassMax->setValue32(RM_CLASS_TYPE::NumTRMClassType-1); - if(dbClassMin) dbClassMin->setValue32(0); - if(dbClassMax) dbClassMax->setValue32(RM_CLASS_TYPE::NumTRMClassType-1); - - // Reset also validate the filter, commit - sendCurrentBuyFilterToServer(true); - - // and leave modal - CWidgetManager::getInstance()->disableModalWindow(); -} - -// *************************************************************************** -void CBotChatPageTrade::confirmChangeBuyFilterClassDialog() -{ - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - - // Copy from temp edit to final - CCDBNodeLeaf *dbClassMin= NLGUI::CDBManager::getInstance()->getDbProp(DB_BOT_CHAT_BASE_BUY_FILTER":MIN_CLASS" , false); - CCDBNodeLeaf *dbClassMax= NLGUI::CDBManager::getInstance()->getDbProp(DB_BOT_CHAT_BASE_BUY_FILTER":MAX_CLASS" , false); - CCDBNodeLeaf *tempClassMin= NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:BOTCHAT:TEMP_FILTER_MIN_CLASS"); - CCDBNodeLeaf *tempClassMax= NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:BOTCHAT:TEMP_FILTER_MAX_CLASS"); - sint minClass= tempClassMin->getValue32(); - sint maxClass= tempClassMax->getValue32(); - // min must be => 0 and max must be >= min - minClass= max(minClass, 0); - maxClass= max(minClass, maxClass); - if(dbClassMin) dbClassMin->setValue32(minClass); - if(dbClassMax) dbClassMax->setValue32(maxClass); - - // Then send new filter to Server, and reset item list - sendCurrentBuyFilterToServer(true); - - // and leave modal - CWidgetManager::getInstance()->disableModalWindow(); -} - - -// *************************************************************************** -std::string CBotChatPageTrade::getItemSheetNameForItemType(ITEM_TYPE::TItemType it) -{ - // The definition is in .xml - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - string itemTypeDef= "item_type_to_item_sheet_"; - itemTypeDef+= ITEM_TYPE::toString(it); - - // return empty string if not found - return CWidgetManager::getInstance()->getParser()->getDefine(itemTypeDef); -} - - -// *************************************************************************** -void CBotChatPageTrade::startChangeBuyFilterItemTypeDialog() -{ - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - - // the list of possible item type to select is filled when the DB of bitfield change - - // show the modal - CInterfaceGroup *ig= dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WIN_BOT_CHAT_CHANGE_BUY_FILTER_ITEM_TYPE)); - if(!ig) return; - - // go - CWidgetManager::getInstance()->enableModalWindow(NULL, ig); -} - -// *************************************************************************** -void CBotChatPageTrade::confirmChangeBuyFilterItemTypeDialog(ITEM_TYPE::TItemType itemType) -{ - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - - // Copy result to final DB - CCDBNodeLeaf *dbItemType= NLGUI::CDBManager::getInstance()->getDbProp(DB_BOT_CHAT_BASE_BUY_FILTER":ITEM_TYPE" , false); - if(dbItemType) dbItemType->setValue32(itemType); - - // Then send new filter to Server, and reset item list - sendCurrentBuyFilterToServer(true); - - // and leave modal - CWidgetManager::getInstance()->disableModalWindow(); -} - -// *************************************************************************** -void CBotChatPageTrade::startDestroyItemDialog() -{ - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - if(!_CurrItemSheet) - return; - - // setup the quantity to destroy (if edited correctly) - uint32 quantity= getCurrItemQuantity(); - if(quantity==0 || quantity==std::numeric_limits::max()) - return; - // if quantity check, maximize with it (if user entered to big value...) - if(_QuantityCheck) - quantity= min(quantity, (uint32)_QuantityCheck); - // set view - NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:TRADE_ITEM:DESTROY_QUANTITY")->setValue32(quantity); - - // show the modal - CInterfaceGroup *ig= dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WIN_BOT_CHAT_DESTROY_ITEM)); - if(!ig) return; - CWidgetManager::getInstance()->enableModalWindow(NULL, ig); -} - -// *************************************************************************** -void CBotChatPageTrade::confirmDestroyItemDialog() -{ - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - if(!_CurrItemSheet) - return; - - // get the quantity destroyed - uint32 quantity= getCurrItemQuantity(); - // if correct quantity - if(quantity!=0 && quantity!=std::numeric_limits::max()) - { - // if quantity check, maximize with it (if user entered too big value...) - if(_QuantityCheck) - quantity= min(quantity, (uint32)_QuantityCheck); - - // **** then send msg to server - uint16 u16Index = (uint16) _CurrItemIndex; - uint16 u16Quantity = (uint16) quantity; - - const char *msg="BOTCHAT:DESTROY_ITEM"; - NLMISC::CBitMemStream out; - if(GenericMsgHeaderMngr.pushNameToStream(msg, out)) - { - out.serial(u16Index); - out.serial(u16Quantity); - NetMngr.push(out); - //nlinfo("impulseCallBack sent: %s %d %d", msg, u16Index, u16Quantity); - } - else - nlwarning(" unknown message name '%s'", msg); - - - // **** destroy localy - // if item stackable, the player was allowed to destroy only a subset - if(_QuantityEdit) - { - sint32 curQuantity= _CurrItemSheet->getQuantity(); - if(u16QuantitysetQuantity(curQuantity-u16Quantity); - else - // hide the item - _CurrItemSheet->setSheetId(0); - } - else - { - // hide the item - _CurrItemSheet->setSheetId(0); - } - } - - // in all cases, close the modal - CWidgetManager::getInstance()->disableModalWindow(); - - // if the quantity entered was correct - if(quantity!=0 && quantity!=std::numeric_limits::max()) - { - // close also the container modal - endTradeModal(); - } - -} - - -///////////////////// -// ACTION HANDLERS // -///////////////////// - -// *************************************************************************************** -// the player has clicked on an item to buy it -class CAHBuyItem : public IActionHandler -{ - virtual void execute (CCtrlBase *pCaller, const string &/* params */) - { - CDBCtrlSheet *sheet = dynamic_cast(pCaller); - BotChatPageAll->Trade->startBuyDialog(sheet, pCaller); - } -}; -REGISTER_ACTION_HANDLER(CAHBuyItem, "buy_item"); - -// *************************************************************************************** -// the player has clicked on an item to sell it -class CAHSellItem : public IActionHandler -{ - virtual void execute (CCtrlBase *pCaller, const string &/* params */) - { - CDBCtrlSheet *sheet = dynamic_cast(pCaller); - BotChatPageAll->Trade->startSellDialog(sheet, pCaller); - } -}; -REGISTER_ACTION_HANDLER(CAHSellItem, "sell_item"); - - -// *************************************************************************************** -// confirm sell or buy item -class CAHConfirmTrade : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string ¶ms) - { - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - - // parse resale param - bool enableResale; - uint resaleParam; - fromString(getParam(params, "resale"), resaleParam); - switch ( resaleParam ) - { - case 0: enableResale = false; break; - case 1: enableResale = true; break; - default: // 2: comes only from Enter of Shift+Enter key from an edit box or in the modal window - { - const NLGUI::CEventDescriptorKey& keyEvent = CWidgetManager::getInstance()->getLastKeyEvent(); - enableResale = ! keyEvent.getKeyShift(); - } - } - - // test if we need to confirm the buy? - bool canTestConfirmation; - fromString(getParam(params, "noconfirm"), canTestConfirmation); - canTestConfirmation = !canTestConfirmation; - bool mustConfirm= false; - if(canTestConfirmation) - { - // Building: - if(NLGUI::CDBManager::getInstance()->getDbValue32("SERVER:TRADING:BUILDING_LOSS_WARNING") == 1) - mustConfirm= true; - } - - // don't confirm? - if(!mustConfirm) - { - if (BotChatPageAll->Trade->isTradeValid( enableResale )) - BotChatPageAll->Trade->confirmTrade( enableResale ); - } - else - { - // need to ask user first. Important unexecpected consequence, so use a warning icon - pIM->validMessageBox(CInterfaceManager::WarningIconMsg, CI18N::get("uiQReplaceAppartment"), - "confirm_trade", toString("resale=%d|noconfirm=1", (uint)enableResale)); - } - } -}; -REGISTER_ACTION_HANDLER(CAHConfirmTrade, "confirm_trade"); - - -// *************************************************************************************** -// Trade has been canceled -class CAHCancelTrade : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* params */) - { - BotChatPageAll->Trade->cancelTrade(); - } -}; -REGISTER_ACTION_HANDLER(CAHCancelTrade, "cancel_trade"); - - -// *************************************************************************** -// Request to Change the Min/Max of Price or quantity -class CAHEnterChangeBotChatBuyFilter : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string ¶ms) - { - string dbext= getParam(params, "dbext"); - string title= getParam(params, "title"); - uint32 maxvalue; - fromString(getParam(params, "maxvalue"), maxvalue); - BotChatPageAll->Trade->startChangeBuyFilterDialog(dbext, title, maxvalue); - } -}; -REGISTER_ACTION_HANDLER(CAHEnterChangeBotChatBuyFilter, "enter_change_botchat_buy_filter"); - - -// *************************************************************************** -// Validate Change the Min/Max of Price or quantity -class CAHConfirmChangeBotChatBuyFilter : public IActionHandler -{ - virtual void execute(CCtrlBase * /* pCaller */, const string &/* params */) - { - BotChatPageAll->Trade->confirmChangeBuyFilterDialog(); - } -}; -REGISTER_ACTION_HANDLER(CAHConfirmChangeBotChatBuyFilter ,"confirm_change_botchat_buy_filter"); - - -// *************************************************************************** -// Reset the Min/Max of Price or quantity -class CAHResetBotChatBuyFilter : public IActionHandler -{ - virtual void execute(CCtrlBase * /* pCaller */, const string &/* params */) - { - BotChatPageAll->Trade->resetBuyFilterDialog(); - } -}; -REGISTER_ACTION_HANDLER(CAHResetBotChatBuyFilter, "reset_botchat_buy_filter"); - - -// *************************************************************************** -// Min EditBox validated, give focus to max EditBox. -class CAHChangeBotChatBuyFilterGiveFocusToMax : public IActionHandler -{ - virtual void execute(CCtrlBase * /* pCaller */, const string &/* params */) - { - BotChatPageAll->Trade->giveFocusToMaxEBChangeBuyFilterDialog(); - } -}; -REGISTER_ACTION_HANDLER(CAHChangeBotChatBuyFilterGiveFocusToMax ,"change_botchat_buy_filter_give_focus_to_max"); - - - -// *************************************************************************** -// Request to Change the Min/Max of Price or quantity -class CAHEnterChangeBotChatBuyFilterMP : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* params */) - { - BotChatPageAll->Trade->startChangeBuyFilterMPDialog(); - } -}; -REGISTER_ACTION_HANDLER(CAHEnterChangeBotChatBuyFilterMP, "enter_change_botchat_buy_filter_mp"); - - -// *************************************************************************** -// Validate Change the Min/Max of Price or quantity -class CAHConfirmChangeBotChatBuyFilterMP : public IActionHandler -{ - virtual void execute(CCtrlBase * /* pCaller */, const string ¶ms) - { - BotChatPageAll->Trade->confirmChangeBuyFilterMPDialog(RM_FABER_TYPE::toFaberType(params)); - } -}; -REGISTER_ACTION_HANDLER(CAHConfirmChangeBotChatBuyFilterMP, "confirm_change_botchat_buy_filter_mp"); - - -// *************************************************************************** -// Ask for Refresh of the User list -class CAHBotChatRefreshResale : public IActionHandler -{ - virtual void execute(CCtrlBase * /* pCaller */, const string &/* params */) - { - BotChatPageAll->Trade->refreshResale(); - } -}; -REGISTER_ACTION_HANDLER(CAHBotChatRefreshResale, "botchat_refresh_resale"); - - -// *************************************************************************** -// client requires change of Item Class bounds -class CAHEnterChangeBotChatBuyFilterClass : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* params */) - { - BotChatPageAll->Trade->startChangeBuyFilterClassDialog(); - } -}; -REGISTER_ACTION_HANDLER(CAHEnterChangeBotChatBuyFilterClass, "enter_change_botchat_buy_filter_class"); - - -// *************************************************************************** -// client confirms change of Item Class bounds -class CAHConfirmChangeBotChatBuyFilterClass : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* params */) - { - BotChatPageAll->Trade->confirmChangeBuyFilterClassDialog(); - } -}; -REGISTER_ACTION_HANDLER(CAHConfirmChangeBotChatBuyFilterClass, "confirm_change_botchat_buy_filter_class"); - - -// *************************************************************************** -// client confirms change of Item Class bounds -class CAHResetBotChatBuyFilterClass : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* params */) - { - BotChatPageAll->Trade->resetBuyFilterClassDialog(); - } -}; -REGISTER_ACTION_HANDLER(CAHResetBotChatBuyFilterClass, "reset_botchat_buy_filter_class"); - - -// *************************************************************************** -class CHandlerBotChatTTItemType : public IActionHandler -{ -public: - void execute (CCtrlBase * /* pCaller */, const std::string &/* sParams */) - { - // \todo yoyo: for now disable tooltip - CWidgetManager::getInstance()->setContextHelpText(ucstring()); - } -}; -REGISTER_ACTION_HANDLER(CHandlerBotChatTTItemType, "botchat_tt_item_type"); - - -// *************************************************************************** -class CAHEnterChangeBotchatBuyFilterItemType : public IActionHandler -{ - void execute (CCtrlBase * /* pCaller */, const std::string &/* sParams */) - { - BotChatPageAll->Trade->startChangeBuyFilterItemTypeDialog(); - } -}; -REGISTER_ACTION_HANDLER(CAHEnterChangeBotchatBuyFilterItemType, "enter_change_botchat_buy_filter_item_type"); - - -// *************************************************************************** -class CAHConfirmChangeBotchatBuyFilterItemType : public IActionHandler -{ - void execute (CCtrlBase *pCaller, const std::string &/* sParams */) - { - ITEM_TYPE::TItemType itemType= ITEM_TYPE::UNDEFINED; - - // From the index of the ctrl sheet in DB, we can now the item type setuped - CDBCtrlSheet *ctrlSheet= dynamic_cast(pCaller); - if(ctrlSheet) - { - // if it is not the empty sheet (detect empty sheetId) - if(ctrlSheet->getSheetId()) - { - sint index= ctrlSheet->getIndexInDB(); - if(index>=0 && indexTrade->confirmChangeBuyFilterItemTypeDialog(itemType); - } -}; -REGISTER_ACTION_HANDLER(CAHConfirmChangeBotchatBuyFilterItemType, "confirm_change_botchat_buy_filter_item_type"); - -// *************************************************************************** -class CAHBotChatRefilItemTypeChoiceList : public IActionHandler -{ - void execute (CCtrlBase * /* pCaller */, const std::string &sParams) - { - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - - string destDB= getParam(sParams, "dest"); - string srcDB= getParam(sParams, "src"); - uint offset; - fromString(getParam(sParams, "offset"), offset); - - /* If ItemType grows too big, must change SERVER and CLIENT!!! because of ItemType bitfield system: - use SERVER:TRADING:ITEM_TYPE_SELLER_BITFILED_0_63 which is a 64 bits - SERVER:TRADING:ITEM_TYPE_SELLER_BITFILED_64_127 which is a 64 bits - (param offset gives which part of enum to use) - */ - nlctassert(ITEM_TYPE::UNDEFINED<=128); - - // get the src bitfield - CCDBNodeLeaf *nodeSrc= NLGUI::CDBManager::getInstance()->getDbProp(srcDB, false); - if(!nodeSrc) - return; - uint64 bfItemType= nodeSrc->getValue64(); - - // For all item type possible - for(uint i=0;i<64;i++) - { - bool present= ((bfItemType>>i)&1)!=0; - // get the dest node - CCDBNodeLeaf *nodeDst= NLGUI::CDBManager::getInstance()->getDbProp(destDB+toString(":%d:SHEET", i+offset), false); - if(nodeDst) - { - if(present) - { - // get the item sheet id associated to this item type - CSheetId sheetId; - sheetId.buildSheetId(CBotChatPageTrade::getItemSheetNameForItemType((ITEM_TYPE::TItemType)(i+offset))); - // and set it - nodeDst->setValue32(sheetId.asInt()); - } - else - { - // reset (cannot select this item type) - nodeDst->setValue32(0); - } - } - } - } -}; -REGISTER_ACTION_HANDLER(CAHBotChatRefilItemTypeChoiceList, "botchat_refill_item_type_choice_list"); - - -// *************************************************************************** -class CAHBotChatEnterDestroy : public IActionHandler -{ - virtual void execute(CCtrlBase * /* pCaller */, const std::string &/* sParams */) - { - BotChatPageAll->Trade->startDestroyItemDialog(); - } -}; -REGISTER_ACTION_HANDLER(CAHBotChatEnterDestroy, "botchat_enter_destroy"); - -// *************************************************************************** -class CAHBotChatConfirmDestroy : public IActionHandler -{ - virtual void execute(CCtrlBase * /* pCaller */, const std::string &/* sParams */) - { - BotChatPageAll->Trade->confirmDestroyItemDialog(); - } -}; -REGISTER_ACTION_HANDLER(CAHBotChatConfirmDestroy, "botchat_confirm_destroy"); - -// *************************************************************************** -class CAHBotChatChangeResaleMargin : public IActionHandler -{ - virtual void execute(CCtrlBase * /* pCaller */, const std::string &sParams) - { - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CInterfaceGroup *ig = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WIN_BOT_CHAT_SELL_BUY_ITEM)); - if (!ig) return; - CGroupEditBox *resaleMarginBox = dynamic_cast(ig->getGroup("header_opened:resell_group:can_resell:choose_resell:edit:eb")); - if (resaleMarginBox) - { - sint32 delta; - fromString(sParams, delta); - sint32 newValue = resaleMarginBox->getInputStringAsInt() + delta; - clamp(newValue, 0, (sint32)CBotChatPageTrade::MaxResaleMargin); - resaleMarginBox->setInputStringAsInt( newValue ); - } - } -}; -REGISTER_ACTION_HANDLER(CAHBotChatChangeResaleMargin, "change_resale_margin"); - -// *************************************************************************** -static DECLARE_INTERFACE_USER_FCT(getPriceWithFame) -{ - if (args.size() != 2) return false; - if (!args[0].toInteger()) return false; - if (!args[1].toInteger()) return false; - - sint value= (sint)args[0].getInteger(); - sint valueFame= (sint)args[1].getInteger(); - if(value==-1) - result.setUCString(CI18N::get("uiBadPrice")); - else if(value==valueFame) - result.setUCString(NLMISC::formatThousands(toString(value))); - else - result.setUCString(NLMISC::formatThousands(toString(valueFame)) + " (" + NLMISC::formatThousands(toString(value)) + ")"); - - return true; -} -REGISTER_INTERFACE_USER_FCT("getPriceWithFame", getPriceWithFame) - -// *************************************************************************** -static DECLARE_INTERFACE_USER_FCT(getBonusOnResale) -{ - if (args.size() != 2) return false; - if (!args[0].toInteger()) return false; - if (!args[1].toInteger()) return false; - - sint valueHigh= (sint)args[0].getInteger(); - sint valueLow= (sint)args[1].getInteger(); - sint diff = valueHigh - valueLow; - result.setUCString("+" + NLMISC::formatThousands(toString(diff))); - - return true; -} -REGISTER_INTERFACE_USER_FCT("getBonusOnResale", getBonusOnResale) - -////////////// -// COMMANDS // -////////////// - -#if !FINAL_VERSION -// TEMP TEMP TEMP - -NLMISC_COMMAND( testColorItems, "Temp : test some items to trade", "" ) -{ - if (args.size() < 1) return false; - if (args.size() > 2) return false; - CInterfaceManager *im = CInterfaceManager::getInstance(); - std::string itemName = "icfahv.sitem"; - if (args.size() > 1) - { - itemName = args[1]; - } - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:0:SHEET")->setValue32(CSheetId(itemName).asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:0:PRICE")->setValue32(100); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:0:QUALITY")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:0:SLOT_TYPE")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:0:USER_COLOR")->setValue32(0); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:1:SHEET")->setValue32(CSheetId(itemName).asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:1:PRICE")->setValue32(200); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:1:QUALITY")->setValue32(25); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:1:SLOT_TYPE")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:1:USER_COLOR")->setValue32(1); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:2:SHEET")->setValue32(CSheetId(itemName).asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:2:PRICE")->setValue32(10); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:2:QUALITY")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:2:SLOT_TYPE")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:2:USER_COLOR")->setValue32(2); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:3:SHEET")->setValue32(CSheetId(itemName).asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:3:PRICE")->setValue32(10); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:3:QUALITY")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:3:SLOT_TYPE")->setValue32(0);// - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:3:USER_COLOR")->setValue32(3); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:4:SHEET")->setValue32(CSheetId(itemName).asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:4:PRICE")->setValue32(100); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:4:QUALITY")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:4:SLOT_TYPE")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:4:USER_COLOR")->setValue32(4); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:5:SHEET")->setValue32(CSheetId(itemName).asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:5:PRICE")->setValue32(200); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:5:QUALITY")->setValue32(25); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:5:SLOT_TYPE")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:5:USER_COLOR")->setValue32(5); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:6:SHEET")->setValue32(CSheetId(itemName).asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:6:PRICE")->setValue32(10); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:6:QUALITY")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:6:SLOT_TYPE")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:6:USER_COLOR")->setValue32(6); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:7:SHEET")->setValue32(CSheetId(itemName).asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:7:PRICE")->setValue32(10); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:7:QUALITY")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:7:SLOT_TYPE")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:7:USER_COLOR")->setValue32(7); - // - sint32 value; - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:SESSION")->setValue32(CBotChatManager::getInstance()->getSessionID()); - fromString(args[0], value); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:PAGE_ID")->setValue32(value); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:HAS_NEXT")->setValue32(1); - // - return true; -} - - -NLMISC_COMMAND( testTradeItems, "Temp : test some items to trade", "" ) -{ - if (args.size() != 1) return false; - CInterfaceManager *im = CInterfaceManager::getInstance(); - // - //NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:0:SHEET")->setValue32(CSheetId("icfm1bm.sitem").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:0:SHEET")->setValue32(CSheetId("guild_main_building.sitem").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:0:PRICE")->setValue32(100); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:0:QUALITY")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:0:SLOT_TYPE")->setValue32(0); - // - //NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:1:SHEET")->setValue32(CSheetId("icfm1bs.sitem").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:1:SHEET")->setValue32(CSheetId("guild_rm_craft.sitem").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:1:PRICE")->setValue32(200); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:1:QUALITY")->setValue32(25); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:1:SLOT_TYPE")->setValue32(0); - // - //NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:2:SHEET")->setValue32(CSheetId("icfm1pd.sitem").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:2:SHEET")->setValue32(CSheetId("guild_rm_fight.sitem").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:2:PRICE")->setValue32(10); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:2:QUALITY")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:2:SLOT_TYPE")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:2:NAMEID")->setValue32(8); - // - //NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:3:SHEET")->setValue32(CSheetId("icfr2l.sitem").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:3:SHEET")->setValue32(CSheetId("guild_rm_harvest.sitem").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:3:PRICE")->setValue32(10); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:3:QUALITY")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:3:SLOT_TYPE")->setValue32(0);// - // - //NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:4:SHEET")->setValue32(CSheetId("ictr2b.sitem").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:4:SHEET")->setValue32(CSheetId("guild_rm_magic.sitem").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:4:PRICE")->setValue32(100); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:4:QUALITY")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:4:SLOT_TYPE")->setValue32(0); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:5:SHEET")->setValue32(CSheetId("icfp1pb.sitem").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:5:PRICE")->setValue32(200); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:5:QUALITY")->setValue32(25); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:5:SLOT_TYPE")->setValue32(0); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:6:SHEET")->setValue32(CSheetId("icragt.sitem").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:6:PRICE")->setValue32(10); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:6:QUALITY")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:6:SLOT_TYPE")->setValue32(0); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:7:SHEET")->setValue32(CSheetId("icmss.sitem").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:7:PRICE")->setValue32(10); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:7:QUALITY")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:7:SLOT_TYPE")->setValue32(0); - // - sint32 value; - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:SESSION")->setValue32(CBotChatManager::getInstance()->getSessionID()); - fromString(args[0], value); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:PAGE_ID")->setValue32(value); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:HAS_NEXT")->setValue32(1); - // - return true; -} - - -NLMISC_COMMAND( testTradeItems2, "Temp : test some items to trade (2)", "" ) -{ - // item with faction points - if (args.size() != 1) return false; - CInterfaceManager *im = CInterfaceManager::getInstance(); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:0:SHEET")->setValue32(CSheetId("icfm1bm.sitem").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:0:PRICE")->setValue32(100); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:0:QUALITY")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:0:SLOT_TYPE")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:0:FACTION_TYPE")->setValue32(0); -// NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:0:PRICE")->setValue32(130); // should result to none - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:1:SHEET")->setValue32(CSheetId("icfm1bs.sitem").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:1:PRICE")->setValue32(200); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:1:QUALITY")->setValue32(25); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:1:SLOT_TYPE")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:1:FACTION_TYPE")->setValue32(PVP_CLAN::Kami); -// NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:1:FACTION_POINT_PRICE")->setValue32(0); // should result to none - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:2:SHEET")->setValue32(CSheetId("icfm1pd.sitem").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:2:PRICE")->setValue32(10); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:2:QUALITY")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:2:SLOT_TYPE")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:2:NAMEID")->setValue32(8); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:2:FACTION_TYPE")->setValue32(PVP_CLAN::Kami); -// NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:2:FACTION_POINT_PRICE")->setValue32(13); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:3:SHEET")->setValue32(CSheetId("icfr2l.sitem").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:3:PRICE")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:3:QUALITY")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:3:SLOT_TYPE")->setValue32(0);// - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:3:FACTION_TYPE")->setValue32(PVP_CLAN::Tryker); -// NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:3:FACTION_POINT_PRICE")->setValue32(10); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:4:SHEET")->setValue32(CSheetId("ictr2b.sitem").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:4:PRICE")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:4:QUALITY")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:4:SLOT_TYPE")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:4:FACTION_TYPE")->setValue32(PVP_CLAN::Fyros); -// NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:4:FACTION_POINT_PRICE")->setValue32(8); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:5:SHEET")->setValue32(CSheetId("icfp1pb.sitem").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:5:PRICE")->setValue32(200); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:5:QUALITY")->setValue32(25); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:5:SLOT_TYPE")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:5:FACTION_TYPE")->setValue32(PVP_CLAN::Tryker); -// NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:5:FACTION_POINT_PRICE")->setValue32(7); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:6:SHEET")->setValue32(CSheetId("icragt.sitem").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:6:PRICE")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:6:QUALITY")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:6:SLOT_TYPE")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:6:FACTION_TYPE")->setValue32(PVP_CLAN::Karavan); -// NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:6:FACTION_POINT_PRICE")->setValue32(1); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:7:SHEET")->setValue32(CSheetId("icmss.sitem").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:7:PRICE")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:7:QUALITY")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:7:SLOT_TYPE")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:7:FACTION_TYPE")->setValue32(PVP_CLAN::Kami); -// NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:7:FACTION_POINT_PRICE")->setValue32(1350); - // - sint32 value; - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:SESSION")->setValue32(CBotChatManager::getInstance()->getSessionID()); - fromString(args[0], value); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:PAGE_ID")->setValue32(value); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:HAS_NEXT")->setValue32(1); - // - return true; -} - -NLMISC_COMMAND( testTradeItems3, "Temp : test some items to trade (3)", "" ) -{ - // items - CInterfaceManager *im = CInterfaceManager::getInstance(); - NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:TRADING:0:SHEET")->setValue32(CSheetId("fyros_buckler_lvl_01_05.item").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:TRADING:0:PRICE")->setValue32(200); - NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:TRADING:0:QUALITY")->setValue32(25); - NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:TRADING:0:SLOT_TYPE")->setValue32(0); - // - NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:TRADING:1:SHEET")->setValue32(CSheetId("fyros_buckler_lvl_01_05.item").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:TRADING:1:PRICE")->setValue32(200); - NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:TRADING:1:QUALITY")->setValue32(25); - NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:TRADING:1:SLOT_TYPE")->setValue32(0); - // - NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:TRADING:2:SHEET")->setValue32(CSheetId("fyros_buckler_lvl_01_05.item").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:TRADING:2:PRICE")->setValue32(200); - NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:TRADING:2:QUALITY")->setValue32(25); - NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:TRADING:2:SLOT_TYPE")->setValue32(0); - // - NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:TRADING:3:SHEET")->setValue32(CSheetId("fyros_buckler_lvl_01_05.item").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:TRADING:3:PRICE")->setValue32(200); - NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:TRADING:3:QUALITY")->setValue32(25); - NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:TRADING:3:SLOT_TYPE")->setValue32(0); - - return true; -} - -NLMISC_COMMAND( testTradeItems4, "Temp : test some items to trade (4)", "" ) -{ - // pacts - CInterfaceManager *im = CInterfaceManager::getInstance(); - // - NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:TRADING:0:SHEET")->setValue32(CSheetId("pacts.death_impact").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:TRADING:0:QUALITY")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:TRADING:0:SLOT_TYPE")->setValue32(0); - // - NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:TRADING:1:SHEET")->setValue32(CSheetId("kami_pactes.death_impact").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:TRADING:1:QUALITY")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:TRADING:1:SLOT_TYPE")->setValue32(0); - // - NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:TRADING:2:SHEET")->setValue32(CSheetId("karavan_pactes.death_impact").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:TRADING:2:QUALITY")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:TRADING:2:SLOT_TYPE")->setValue32(0); - // - NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:TRADING:3:SHEET")->setValue32(CSheetId("kami_pactes.death_impact").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:TRADING:3:QUALITY")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:TRADING:3:SLOT_TYPE")->setValue32(0); - // - return true; -} - - -NLMISC_COMMAND( testPhrases, "Temp : test some items to trade", "" ) -{ - if (args.size() != 1) return false; - CInterfaceManager *im = CInterfaceManager::getInstance(); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:0:SHEET")->setValue32(CSheetId("abfaimhame09.sphrase").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:0:PRICE")->setValue32(11); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:0:SLOT_TYPE")->setValue32(0); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:1:SHEET")->setValue32(CSheetId("abfaimhcme07.sphrase").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:1:PRICE")->setValue32(22); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:1:SLOT_TYPE")->setValue32(0); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:2:SHEET")->setValue32(CSheetId("abfaimhfme04.sphrase").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:2:PRICE")->setValue32(33); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:2:SLOT_TYPE")->setValue32(0); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:3:SHEET")->setValue32(CSheetId("abfaimhfme08.sphrase").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:3:PRICE")->setValue32(44); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:3:SLOT_TYPE")->setValue32(0); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:4:SHEET")->setValue32(CSheetId("abfma05.sphrase").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:4:PRICE")->setValue32(55); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:4:SLOT_TYPE")->setValue32(0); - - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:5:SHEET")->setValue32(CSheetId("abm_mt_ae_acid_00055.sphrase").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:5:PRICE")->setValue32(66); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:5:SLOT_TYPE")->setValue32(0); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:6:SHEET")->setValue32(CSheetId("abm_mt_heal_00140.sphrase").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:6:PRICE")->setValue32(77); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:6:SLOT_TYPE")->setValue32(0); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:7:SHEET")->setValue32(CSheetId("abm_mt_cannibalism_00020.sphrase").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:7:PRICE")->setValue32(88); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:7:SLOT_TYPE")->setValue32(0); - // - - sint32 value; - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:SESSION")->setValue32(CBotChatManager::getInstance()->getSessionID()); - fromString(args[0], value); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:PAGE_ID")->setValue32(value); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:HAS_NEXT")->setValue32(1); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:ROLEMASTER_FLAGS")->setValue32(0); - - return true; -} - - -NLMISC_COMMAND( testResaleItems, "Temp : test resale", "" ) -{ - if (args.size() < 1) return false; - uint pageId; - fromString(args[0], pageId); - uint pf= pageId+1; - CInterfaceManager *im = CInterfaceManager::getInstance(); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:0:SHEET")->setValue32(CSheetId("m0006dxajf01.sitem").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:0:PRICE")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:0:QUALITY")->setValue32(1); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:0:SELLER_TYPE")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:0:PRICE_RETIRE")->setValue32(111); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:0:QUANTITY")->setValue32(62); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:1:SHEET")->setValue32(CSheetId("icfm1bs.sitem").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:1:PRICE")->setValue32(1*pf); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:1:QUALITY")->setValue32(11); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:1:SELLER_TYPE")->setValue32(1); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:1:PRICE_RETIRE")->setValue32(222); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:1:QUANTITY")->setValue32(1); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:2:SHEET")->setValue32(CSheetId("icfm1pd.sitem").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:2:PRICE")->setValue32(-1); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:2:QUALITY")->setValue32(22); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:2:NAMEID")->setValue32(8); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:2:SELLER_TYPE")->setValue32(2); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:2:PRICE_RETIRE")->setValue32(333); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:2:QUANTITY")->setValue32(1); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:2:RESALE_TIME_LEFT")->setValue32(10); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:3:SHEET")->setValue32(CSheetId("icfr2l.sitem").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:3:PRICE")->setValue32(3*pf); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:3:QUALITY")->setValue32(33); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:3:SELLER_TYPE")->setValue32(3); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:3:PRICE_RETIRE")->setValue32(444); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:3:QUANTITY")->setValue32(1); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:3:RESALE_TIME_LEFT")->setValue32(100); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:4:SHEET")->setValue32(CSheetId("m0006dxajf01.sitem").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:4:PRICE")->setValue32(4*pf); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:4:QUALITY")->setValue32(44); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:4:SELLER_TYPE")->setValue32(4); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:4:PRICE_RETIRE")->setValue32(555); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:4:QUANTITY")->setValue32(1); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:5:SHEET")->setValue32(CSheetId("icfp1pb.sitem").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:5:PRICE")->setValue32(5*pf); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:5:QUALITY")->setValue32(55); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:5:SELLER_TYPE")->setValue32(5); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:5:PRICE_RETIRE")->setValue32(666); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:5:QUANTITY")->setValue32(23); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:6:SHEET")->setValue32(CSheetId("m0119dxajd01.sitem").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:6:PRICE")->setValue32(6*pf); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:6:QUALITY")->setValue32(66); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:6:SELLER_TYPE")->setValue32(2); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:6:PRICE_RETIRE")->setValue32(777); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:6:QUANTITY")->setValue32(19); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:6:RESALE_TIME_LEFT")->setValue32(48); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:7:SHEET")->setValue32(CSheetId("icmss.sitem").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:7:PRICE")->setValue32(7*pf); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:7:QUALITY")->setValue32(77); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:7:SELLER_TYPE")->setValue32(5); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:7:PRICE_RETIRE")->setValue32(888); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:7:QUANTITY")->setValue32(1); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:7:RESALE_TIME_LEFT")->setValue32(10); - - - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:SESSION")->setValue32(CBotChatManager::getInstance()->getSessionID()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:PAGE_ID")->setValue32(pageId); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:HAS_NEXT")->setValue32(1); - // - - // Force for next page - IngameDbMngr.flushObserverCalls(); - NLGUI::CDBManager::getInstance()->flushObserverCalls(); - - return true; -} - - -NLMISC_COMMAND( testClientPhrases, "", "" ) -{ - if (args.size() != 3) return false; - CInterfaceManager *im = CInterfaceManager::getInstance(); - - sint32 value; - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:SESSION")->setValue32(CBotChatManager::getInstance()->getSessionID()); - fromString(args[0], value); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:PAGE_ID")->setValue32(value); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:HAS_NEXT")->setValue32(1); - fromString(args[1], value); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:ROLEMASTER_FLAGS")->setValue32(value); - fromString(args[2], value); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:ROLEMASTER_RACE")->setValue32(value); - - return true; -} - - -NLMISC_COMMAND( testOutpostBuildings, "Temp : test some items to trade", "" ) -{ - if (args.size() != 1) return false; - CInterfaceManager *im = CInterfaceManager::getInstance(); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:0:SHEET")->setValue32(CSheetId("driller_bountybeaches_kami_u1_100a.outpost_building").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:0:PRICE")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:0:SLOT_TYPE")->setValue32(0); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:1:SHEET")->setValue32(CSheetId("driller_citiesofintuition_kami_u2_50a.outpost_building").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:1:PRICE")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:1:SLOT_TYPE")->setValue32(0); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:2:SHEET")->setValue32(CSheetId("driller_couloirbrule_kami_u2_150b.outpost_building").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:2:PRICE")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:2:SLOT_TYPE")->setValue32(0); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:3:SHEET")->setValue32(CSheetId("driller_bountybeaches_karavan_u1_100a.outpost_building").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:3:PRICE")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:3:SLOT_TYPE")->setValue32(0); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:4:SHEET")->setValue32(CSheetId("driller_bountybeaches_karavan_u1_150a.outpost_building").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:4:PRICE")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:4:SLOT_TYPE")->setValue32(0); - - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:5:SHEET")->setValue32(CSheetId("driller_bountybeaches_karavan_u1_200a.outpost_building").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:5:PRICE")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:5:SLOT_TYPE")->setValue32(0); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:6:SHEET")->setValue32(CSheetId("driller_bountybeaches_karavan_u2_100a.outpost_building").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:6:PRICE")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:6:SLOT_TYPE")->setValue32(0); - // - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:7:SHEET")->setValue32(CSheetId("driller_bountybeaches_karavan_u2_150a.outpost_building").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:7:PRICE")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:7:SLOT_TYPE")->setValue32(0); - // - - sint32 value; - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:SESSION")->setValue32(CBotChatManager::getInstance()->getSessionID()); - fromString(args[0], value); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:PAGE_ID")->setValue32(value); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:HAS_NEXT")->setValue32(1); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:ROLEMASTER_FLAGS")->setValue32(0); - - return true; -} - - - - -#endif -