From 72ccfc9a0238a7aa114750840371928ae035abe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20Gon=C3=A7alves=20=28Ulukyn=29?= Date: Tue, 14 Sep 2021 00:06:46 +0100 Subject: [PATCH 01/13] Update from core4 branch --- code/nel/tools/build_gamedata/0_setup.py | 1072 ++++++++------- code/nel/tools/build_gamedata/1_export.py | 188 +-- code/nel/tools/build_gamedata/2_build.py | 188 +-- code/nel/tools/build_gamedata/3_install.py | 188 +-- code/nel/tools/build_gamedata/9_upload.py | 362 ++--- .../tools/build_gamedata/a1_worldedit_data.py | 148 +- .../nel/tools/build_gamedata/b1_client_dev.py | 187 +-- .../nel/tools/build_gamedata/b2_shard_data.py | 186 +-- .../tools/build_gamedata/c1_shard_patch.py | 237 ++-- .../build_gamedata/configuration/scripts.py | 1199 +++++++++-------- .../build_gamedata/configuration/tools.py | 202 +-- .../tools/build_gamedata/d1_client_patch.py | 353 ++--- .../tools/build_gamedata/d2_client_install.py | 172 +-- .../build_gamedata/export_build_install.py | 64 +- .../ecosystem_project_template/directories.py | 440 +++--- .../ecosystem_project_template/process.py | 244 ++-- .../build_gamedata/generators/generate_all.py | 130 +- .../generators/generate_ecosystem_projects.py | 556 ++++---- .../generate_simple_max_exporters.py | 200 +-- .../generate_tagged_max_exporters.py | 240 ++-- .../generators/max_exporter_scripts/anim.ms | 0 .../generators/max_exporter_scripts/anim.py | 0 .../generators/max_exporter_scripts/clod.ms | 0 .../generators/max_exporter_scripts/clod.py | 0 .../generators/max_exporter_scripts/cmb.ms | 0 .../generators/max_exporter_scripts/cmb.py | 0 .../generators/max_exporter_scripts/ig.ms | 0 .../max_exporter_scripts/pacs_prim.ms | 0 .../max_exporter_scripts/pacs_prim.py | 14 +- .../generators/max_exporter_scripts/shape.ms | 0 .../generators/max_exporter_scripts/skel.ms | 0 .../generators/max_exporter_scripts/skel.py | 16 +- .../generators/max_exporter_scripts/swt.ms | 0 .../generators/max_exporter_scripts/swt.py | 0 .../generators/max_exporter_scripts/veget.ms | 0 .../generators/max_exporter_scripts/veget.py | 0 .../generators/max_exporter_scripts/zone.ms | 0 .../generators/max_exporter_scripts/zone.py | 16 +- .../simple_max_exporter_template/0_setup.py | 130 +- .../1_export_footer.py | 14 +- .../1_export_header.py | 184 +-- .../simple_max_exporter_template/2_build.py | 98 +- .../simple_max_exporter_template/3_install.py | 114 +- .../export_footer.ms | 0 .../export_header.ms | 0 .../tagged_max_exporter_template/0_setup.py | 132 +- .../1_export_footer.py | 18 +- .../1_export_header.py | 260 ++-- .../tagged_max_exporter_template/2_build.py | 98 +- .../tagged_max_exporter_template/3_install.py | 114 +- .../export_footer.ms | 0 .../export_header.ms | 0 .../tools/build_gamedata/processes/0_setup.py | 178 +-- .../build_gamedata/processes/1_export.py | 146 +- .../tools/build_gamedata/processes/2_build.py | 146 +- .../build_gamedata/processes/3_install.py | 144 +- .../processes/_dummy/0_setup.py | 132 +- .../processes/_dummy/1_export.py | 234 ++-- .../processes/_dummy/2_build.py | 192 +-- .../processes/_dummy/3_install.py | 126 +- .../processes/ai_wmap/0_setup.py | 196 +-- .../processes/ai_wmap/1_export.py | 98 +- .../processes/ai_wmap/2_build.py | 192 +-- .../processes/ai_wmap/3_install.py | 114 +- .../build_gamedata/processes/anim/0_setup.py | 132 +- .../build_gamedata/processes/anim/1_export.py | 278 ++-- .../build_gamedata/processes/anim/2_build.py | 140 +- .../processes/anim/3_install.py | 114 +- .../processes/anim/maxscript/anim_export.ms | 0 .../processes/cartographer/0_setup.py | 234 ++-- .../processes/cartographer/1_export.py | 98 +- .../processes/cartographer/2_build.py | 149 +- .../processes/cartographer/3_install.py | 123 +- .../build_gamedata/processes/cegui/0_setup.py | 130 +- .../processes/cegui/1_export.py | 134 +- .../build_gamedata/processes/cegui/2_build.py | 134 +- .../processes/cegui/3_install.py | 112 +- .../processes/clodbank/0_setup.py | 174 +-- .../processes/clodbank/1_export.py | 278 ++-- .../processes/clodbank/2_build.py | 136 +- .../processes/clodbank/3_install.py | 114 +- .../clodbank/maxscript/clod_export.ms | 0 .../build_gamedata/processes/copy/0_setup.py | 152 +-- .../build_gamedata/processes/copy/1_export.py | 98 +- .../build_gamedata/processes/copy/2_build.py | 98 +- .../processes/copy/3_install.py | 170 +-- .../processes/displace/0_setup.py | 130 +- .../processes/displace/1_export.py | 110 +- .../processes/displace/2_build.py | 98 +- .../processes/displace/3_install.py | 114 +- .../processes/farbank/0_setup.py | 132 +- .../processes/farbank/1_export.py | 98 +- .../processes/farbank/2_build.py | 148 +- .../processes/farbank/3_install.py | 110 +- .../build_gamedata/processes/font/0_setup.py | 130 +- .../build_gamedata/processes/font/1_export.py | 125 +- .../build_gamedata/processes/font/2_build.py | 102 +- .../processes/font/3_install.py | 123 +- .../build_gamedata/processes/ig/0_setup.py | 156 +-- .../build_gamedata/processes/ig/1_export.py | 296 ++-- .../build_gamedata/processes/ig/2_build.py | 548 ++++---- .../build_gamedata/processes/ig/3_install.py | 120 +- .../processes/ig/maxscript/ig_export.ms | 0 .../processes/ig_light/0_setup.py | 128 +- .../processes/ig_light/1_export.py | 98 +- .../processes/ig_light/2_build.py | 130 +- .../processes/ig_light/3_install.py | 114 +- .../processes/interface/0_setup.py | 154 +-- .../processes/interface/1_export.py | 210 +-- .../processes/interface/2_build.py | 166 +-- .../processes/interface/3_install.py | 138 +- .../build_gamedata/processes/ligo/0_setup.py | 241 ++-- .../build_gamedata/processes/ligo/1_export.py | 300 ++--- .../build_gamedata/processes/ligo/2_build.py | 138 +- .../processes/ligo/3_install.py | 100 +- .../ligo/maxscript/nel_ligo_export.ms | 0 .../build_gamedata/processes/map/0_setup.py | 158 +-- .../build_gamedata/processes/map/1_export.py | 142 +- .../build_gamedata/processes/map/2_build.py | 336 ++--- .../build_gamedata/processes/map/3_install.py | 182 +-- .../processes/pacs_prim/0_setup.py | 130 +- .../processes/pacs_prim/1_export.py | 292 ++-- .../processes/pacs_prim/2_build.py | 98 +- .../processes/pacs_prim/3_install.py | 114 +- .../pacs_prim/maxscript/pacs_prim_export.ms | 0 .../processes/pacs_prim_list/0_setup.py | 124 +- .../processes/pacs_prim_list/1_export.py | 106 +- .../processes/pacs_prim_list/2_build.py | 126 +- .../processes/pacs_prim_list/3_install.py | 110 +- .../processes/properties/0_setup.py | 282 ++-- .../processes/properties/1_export.py | 88 +- .../processes/properties/2_build.py | 84 +- .../processes/properties/3_install.py | 86 +- .../build_gamedata/processes/ps/0_setup.py | 130 +- .../build_gamedata/processes/ps/1_export.py | 120 +- .../build_gamedata/processes/ps/2_build.py | 98 +- .../build_gamedata/processes/ps/3_install.py | 114 +- .../build_gamedata/processes/pz/0_setup.py | 197 +-- .../build_gamedata/processes/pz/1_export.py | 98 +- .../build_gamedata/processes/pz/2_build.py | 124 +- .../build_gamedata/processes/pz/3_install.py | 116 +- .../build_gamedata/processes/rbank/0_setup.py | 166 +-- .../processes/rbank/1_export.py | 278 ++-- .../build_gamedata/processes/rbank/2_build.py | 664 ++++----- .../processes/rbank/3_install.py | 136 +- .../processes/rbank/maxscript/cmb_export.ms | 0 .../processes/samplebank/0_setup.py | 128 +- .../processes/samplebank/1_export.py | 98 +- .../processes/samplebank/2_build.py | 144 +- .../processes/samplebank/3_install.py | 110 +- .../build_gamedata/processes/shape/0_setup.py | 168 +-- .../processes/shape/1_export.py | 312 ++--- .../build_gamedata/processes/shape/2_build.py | 389 +++--- .../processes/shape/3_install.py | 140 +- .../processes/shape/maxscript/shape_export.ms | 0 .../processes/sheet_id/0_setup.py | 126 +- .../processes/sheet_id/1_export.py | 98 +- .../processes/sheet_id/2_build.py | 126 +- .../processes/sheet_id/3_install.py | 100 +- .../processes/sheets/0_setup.py | 138 +- .../processes/sheets/1_export.py | 98 +- .../processes/sheets/2_build.py | 176 +-- .../processes/sheets/3_install.py | 116 +- .../processes/sheets_shard/0_setup.py | 134 +- .../processes/sheets_shard/1_export.py | 98 +- .../processes/sheets_shard/2_build.py | 134 +- .../processes/sheets_shard/3_install.py | 114 +- .../build_gamedata/processes/sign/0_setup.py | 128 +- .../build_gamedata/processes/sign/1_export.py | 114 +- .../build_gamedata/processes/sign/2_build.py | 122 +- .../processes/sign/3_install.py | 116 +- .../build_gamedata/processes/skel/0_setup.py | 130 +- .../build_gamedata/processes/skel/1_export.py | 214 +-- .../build_gamedata/processes/skel/2_build.py | 98 +- .../processes/skel/3_install.py | 114 +- .../processes/skel/maxscript/skel_export.ms | 0 .../processes/smallbank/0_setup.py | 128 +- .../processes/smallbank/1_export.py | 144 +- .../processes/smallbank/2_build.py | 98 +- .../processes/smallbank/3_install.py | 114 +- .../build_gamedata/processes/sound/0_setup.py | 130 +- .../processes/sound/1_export.py | 130 +- .../build_gamedata/processes/sound/2_build.py | 98 +- .../processes/sound/3_install.py | 114 +- .../processes/soundbank/0_setup.py | 130 +- .../processes/soundbank/1_export.py | 98 +- .../processes/soundbank/2_build.py | 128 +- .../processes/soundbank/3_install.py | 110 +- .../build_gamedata/processes/swt/0_setup.py | 130 +- .../build_gamedata/processes/swt/1_export.py | 198 +-- .../build_gamedata/processes/swt/2_build.py | 98 +- .../build_gamedata/processes/swt/3_install.py | 114 +- .../processes/swt/maxscript/swt_export.ms | 0 .../build_gamedata/processes/tiles/0_setup.py | 130 +- .../processes/tiles/1_export.py | 168 +-- .../build_gamedata/processes/tiles/2_build.py | 98 +- .../processes/tiles/3_install.py | 110 +- .../build_gamedata/processes/veget/0_setup.py | 132 +- .../processes/veget/1_export.py | 278 ++-- .../build_gamedata/processes/veget/2_build.py | 98 +- .../processes/veget/3_install.py | 114 +- .../processes/veget/maxscript/veget_export.ms | 0 .../processes/vegetset/0_setup.py | 130 +- .../processes/vegetset/1_export.py | 114 +- .../processes/vegetset/2_build.py | 98 +- .../processes/vegetset/3_install.py | 114 +- .../build_gamedata/processes/zone/0_setup.py | 132 +- .../build_gamedata/processes/zone/1_export.py | 214 +-- .../build_gamedata/processes/zone/2_build.py | 331 ++--- .../processes/zone/3_install.py | 100 +- .../processes/zone/maxscript/zone_export.ms | 0 .../processes/zone_light/0_setup.py | 146 +- .../processes/zone_light/1_export.py | 128 +- .../processes/zone_light/2_build.py | 208 +-- .../processes/zone_light/3_install.py | 142 +- .../translation/a1_make_phrase_diff.py | 108 +- .../translation/a2_merge_phrase_diff.py | 108 +- .../translation/a3_make_clause_diff.py | 108 +- .../translation/a4_merge_clause_diff.py | 108 +- .../translation/b1_make_words_diff.py | 108 +- .../translation/b2_merge_words_diff.py | 108 +- .../translation/c1_make_string_diff.py | 108 +- .../translation/c2_merge_string_diff.py | 108 +- .../translation/d1_make_botnames_diff.py | 108 +- .../translation/d2_merge_botnames_diff.py | 108 +- .../translation/e1_clean_string_diff.py | 108 +- .../translation/e2_clean_words_diff.py | 108 +- .../translation/e3_clean_clause_diff.py | 108 +- .../translation/e4_clean_phrase_diff.py | 108 +- .../translation/make_merge_all.py | 137 +- .../translation/make_merge_wk.py | 227 ++-- 231 files changed, 16453 insertions(+), 16169 deletions(-) mode change 100755 => 100644 code/nel/tools/build_gamedata/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/1_export.py mode change 100755 => 100644 code/nel/tools/build_gamedata/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/9_upload.py mode change 100755 => 100644 code/nel/tools/build_gamedata/a1_worldedit_data.py mode change 100755 => 100644 code/nel/tools/build_gamedata/b1_client_dev.py mode change 100755 => 100644 code/nel/tools/build_gamedata/b2_shard_data.py mode change 100755 => 100644 code/nel/tools/build_gamedata/c1_shard_patch.py mode change 100755 => 100644 code/nel/tools/build_gamedata/configuration/scripts.py mode change 100755 => 100644 code/nel/tools/build_gamedata/configuration/tools.py mode change 100755 => 100644 code/nel/tools/build_gamedata/d1_client_patch.py mode change 100755 => 100644 code/nel/tools/build_gamedata/d2_client_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/export_build_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/ecosystem_project_template/directories.py mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/ecosystem_project_template/process.py mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/generate_all.py mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/generate_ecosystem_projects.py mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/generate_simple_max_exporters.py mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/generate_tagged_max_exporters.py mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/max_exporter_scripts/anim.ms mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/max_exporter_scripts/anim.py mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/max_exporter_scripts/clod.ms mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/max_exporter_scripts/clod.py mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/max_exporter_scripts/cmb.ms mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/max_exporter_scripts/cmb.py mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/max_exporter_scripts/ig.ms mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/max_exporter_scripts/pacs_prim.ms mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/max_exporter_scripts/pacs_prim.py mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/max_exporter_scripts/shape.ms mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/max_exporter_scripts/skel.ms mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/max_exporter_scripts/skel.py mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/max_exporter_scripts/swt.ms mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/max_exporter_scripts/swt.py mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/max_exporter_scripts/veget.ms mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/max_exporter_scripts/veget.py mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/max_exporter_scripts/zone.ms mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/max_exporter_scripts/zone.py mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/simple_max_exporter_template/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/simple_max_exporter_template/1_export_footer.py mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/simple_max_exporter_template/1_export_header.py mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/simple_max_exporter_template/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/simple_max_exporter_template/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/simple_max_exporter_template/export_footer.ms mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/simple_max_exporter_template/export_header.ms mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/1_export_footer.py mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/1_export_header.py mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/export_footer.ms mode change 100755 => 100644 code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/export_header.ms mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/1_export.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/_dummy/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/_dummy/1_export.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/_dummy/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/_dummy/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/ai_wmap/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/ai_wmap/1_export.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/ai_wmap/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/ai_wmap/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/anim/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/anim/1_export.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/anim/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/anim/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/anim/maxscript/anim_export.ms mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/cegui/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/cegui/1_export.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/cegui/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/cegui/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/clodbank/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/clodbank/1_export.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/clodbank/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/clodbank/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/clodbank/maxscript/clod_export.ms mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/copy/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/copy/1_export.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/copy/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/copy/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/displace/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/displace/1_export.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/displace/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/displace/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/farbank/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/farbank/1_export.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/farbank/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/farbank/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/font/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/font/1_export.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/font/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/font/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/ig/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/ig/1_export.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/ig/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/ig/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/ig/maxscript/ig_export.ms mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/ig_light/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/ig_light/1_export.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/ig_light/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/ig_light/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/interface/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/interface/1_export.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/interface/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/interface/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/ligo/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/ligo/1_export.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/ligo/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/ligo/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/ligo/maxscript/nel_ligo_export.ms mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/map/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/map/1_export.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/map/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/map/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/pacs_prim/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/pacs_prim/1_export.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/pacs_prim/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/pacs_prim/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/pacs_prim/maxscript/pacs_prim_export.ms mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/pacs_prim_list/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/pacs_prim_list/1_export.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/pacs_prim_list/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/pacs_prim_list/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/properties/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/properties/1_export.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/properties/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/properties/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/ps/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/ps/1_export.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/ps/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/ps/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/rbank/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/rbank/1_export.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/rbank/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/rbank/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/rbank/maxscript/cmb_export.ms mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/shape/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/shape/1_export.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/shape/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/shape/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/shape/maxscript/shape_export.ms mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/sheet_id/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/sheet_id/1_export.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/sheet_id/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/sheet_id/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/sheets/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/sheets/1_export.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/sheets/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/sheets/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/sheets_shard/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/sheets_shard/1_export.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/sheets_shard/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/sheets_shard/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/skel/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/skel/1_export.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/skel/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/skel/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/skel/maxscript/skel_export.ms mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/smallbank/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/smallbank/1_export.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/smallbank/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/smallbank/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/swt/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/swt/1_export.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/swt/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/swt/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/swt/maxscript/swt_export.ms mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/tiles/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/tiles/1_export.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/tiles/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/tiles/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/veget/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/veget/1_export.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/veget/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/veget/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/veget/maxscript/veget_export.ms mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/vegetset/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/vegetset/1_export.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/vegetset/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/vegetset/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/zone/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/zone/1_export.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/zone/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/zone/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/zone/maxscript/zone_export.ms mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/zone_light/0_setup.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/zone_light/1_export.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/zone_light/2_build.py mode change 100755 => 100644 code/nel/tools/build_gamedata/processes/zone_light/3_install.py mode change 100755 => 100644 code/nel/tools/build_gamedata/translation/a1_make_phrase_diff.py mode change 100755 => 100644 code/nel/tools/build_gamedata/translation/a2_merge_phrase_diff.py mode change 100755 => 100644 code/nel/tools/build_gamedata/translation/a3_make_clause_diff.py mode change 100755 => 100644 code/nel/tools/build_gamedata/translation/a4_merge_clause_diff.py mode change 100755 => 100644 code/nel/tools/build_gamedata/translation/b1_make_words_diff.py mode change 100755 => 100644 code/nel/tools/build_gamedata/translation/b2_merge_words_diff.py mode change 100755 => 100644 code/nel/tools/build_gamedata/translation/c1_make_string_diff.py mode change 100755 => 100644 code/nel/tools/build_gamedata/translation/c2_merge_string_diff.py mode change 100755 => 100644 code/nel/tools/build_gamedata/translation/d1_make_botnames_diff.py mode change 100755 => 100644 code/nel/tools/build_gamedata/translation/d2_merge_botnames_diff.py mode change 100755 => 100644 code/nel/tools/build_gamedata/translation/e1_clean_string_diff.py mode change 100755 => 100644 code/nel/tools/build_gamedata/translation/e2_clean_words_diff.py mode change 100755 => 100644 code/nel/tools/build_gamedata/translation/e3_clean_clause_diff.py mode change 100755 => 100644 code/nel/tools/build_gamedata/translation/e4_clean_phrase_diff.py mode change 100755 => 100644 code/nel/tools/build_gamedata/translation/make_merge_all.py mode change 100755 => 100644 code/nel/tools/build_gamedata/translation/make_merge_wk.py diff --git a/code/nel/tools/build_gamedata/0_setup.py b/code/nel/tools/build_gamedata/0_setup.py old mode 100755 new mode 100644 index 00d19cbe6..12441fb05 --- a/code/nel/tools/build_gamedata/0_setup.py +++ b/code/nel/tools/build_gamedata/0_setup.py @@ -1,478 +1,594 @@ -#!/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('--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: - ToolDirectories - except NameError: - ToolDirectories = [ 'R:/build/dev/bin/Release', 'D:/libraries/external/bin' ] - try: - ToolSuffix - except NameError: - ToolSuffix = ".exe" - try: - ScriptDirectory - except NameError: - ScriptDirectory = "R:/code/nel/tools/build_gamedata" - try: - WorkspaceDirectory - except NameError: - WorkspaceDirectory = "L:/workspace" - try: - DatabaseDirectory - except NameError: - DatabaseDirectory = "W:/database" - try: - SoundDirectory - except NameError: - SoundDirectory = "V:" - try: - SoundDfnDirectory - except NameError: - SoundDfnDirectory = "V:/DFN" - try: - ExportBuildDirectory - except NameError: - ExportBuildDirectory = "T:/export" - try: - InstallDirectory - except NameError: - InstallDirectory = "T:/install" - try: - ClientDevDirectory - except NameError: - ClientDevDirectory = "T:/client_dev" - try: - ClientPatchDirectory - except NameError: - ClientPatchDirectory = "T:/client_patch" - try: - ClientInstallDirectory - except NameError: - ClientInstallDirectory = "T:/client_install" - try: - ShardInstallDirectory - except NameError: - ShardInstallDirectory = "T:/shard" - try: - WorldEditInstallDirectory - except NameError: - WorldEditInstallDirectory = "T:/worldedit" - try: - LeveldesignDirectory - except NameError: - LeveldesignDirectory = "L:/leveldesign" - try: - LeveldesignDfnDirectory - except NameError: - LeveldesignDfnDirectory = "L:/leveldesign/DFN" - try: - LeveldesignWorldDirectory - except NameError: - LeveldesignWorldDirectory = "L:/leveldesign/world" - try: - PrimitivesDirectory - except NameError: - PrimitivesDirectory = "L:/primitives" - try: - GamedevDirectory - except NameError: - GamedevDirectory = "R:/code/ryzom/client/data/gamedev" - try: - DataShardDirectory - except NameError: - DataShardDirectory = "R:/code/ryzom/server/data_shard" - try: - DataCommonDirectory - except NameError: - DataCommonDirectory = "R:/code/ryzom/common/data_common" - try: - LeveldesignDataShardDirectory - except NameError: - LeveldesignDataShardDirectory = "L:/shard" - try: - LeveldesignDataCommonDirectory - except NameError: - LeveldesignDataCommonDirectory = "L:/common" - try: - TranslationDirectory - except NameError: - TranslationDirectory = "L:/translation" - try: - WorldEditorFilesDirectory - except NameError: - WorldEditorFilesDirectory = "R:/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files" - try: - WindowsExeDllCfgDirectories - except NameError: - WindowsExeDllCfgDirectories = [ 'C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/redist/x86', 'D:/libraries/external/bin', 'R:/build/dev/bin/Release', 'R:/code/ryzom/client', 'R:/code/nel/lib', 'R:/code/ryzom/bin', 'R:/code/ryzom/tools/client/client_config/bin' ] - try: - LinuxServiceExecutableDirectory - except NameError: - LinuxServiceExecutableDirectory = "S:/devls_x64/bin" - try: - LinuxClientExecutableDirectory - except NameError: - LinuxClientExecutableDirectory = "S:/devl_x64/bin" - try: - PatchmanCfgAdminDirectory - except NameError: - PatchmanCfgAdminDirectory = "R:/code/ryzom/server/patchman_cfg/admin_install" - try: - PatchmanCfgDefaultDirectory - except NameError: - PatchmanCfgDefaultDirectory = "R:/code/ryzom/server/patchman_cfg/default" - try: - PatchmanBridgeServerDirectory - except NameError: - PatchmanBridgeServerDirectory = "T:/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))) - 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("\\", "/") - 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("\\", "/") - 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("\\", "/") - 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("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("ClientPatchDirectory = \"" + str(ClientPatchDirectory) + "\"\n") - sf.write("ClientInstallDirectory = \"" + str(ClientInstallDirectory) + "\"\n") - sf.write("ShardInstallDirectory = \"" + str(ShardInstallDirectory) + "\"\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("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.close() - -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, 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) - -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") +#!/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/1_export.py b/code/nel/tools/build_gamedata/1_export.py old mode 100755 new mode 100644 index d9e4670f7..b010d98aa --- a/code/nel/tools/build_gamedata/1_export.py +++ b/code/nel/tools/build_gamedata/1_export.py @@ -1,94 +1,94 @@ -#!/usr/bin/python -# -# \file 1_export.py -# \brief Run all export processes -# \date 2009-02-18 09:22GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Run all export 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 - Export') -# 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 * -from buildsite import * -from tools import * - -sys.path.append(WorkspaceDirectory) -from projects import * - -# Log error -printLog(log, "") -printLog(log, "-------") -printLog(log, "--- Run the export processes") -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", "1_export.py", "--includeprocess" ] + args.includeprocess) - elif not args.excludeprocess == None: - subprocess.call([ "python", "1_export.py", "--excludeprocess" ] + args.excludeprocess) - else: - subprocess.call([ "python", "1_export.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, "") - -log.close() -if os.path.isfile("1_export.log"): - os.remove("1_export.log") -shutil.copy("log.log", time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + "_export.log") -shutil.move("log.log", "1_export.log") +#!/usr/bin/python +# +# \file 1_export.py +# \brief Run all export processes +# \date 2009-02-18 09:22GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Run all export 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 - Export') +# 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 * +from buildsite_local import * +from tools import * + +sys.path.append(WorkspaceDirectory) +from projects import * + +# Log error +printLog(log, "") +printLog(log, "-------") +printLog(log, "--- Run the export processes") +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", "1_export.py", "--includeprocess" ] + args.includeprocess) + elif not args.excludeprocess == None: + subprocess.call([ "python", "1_export.py", "--excludeprocess" ] + args.excludeprocess) + else: + subprocess.call([ "python", "1_export.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, "") + +log.close() +if os.path.isfile("1_export.log"): + os.remove("1_export.log") +shutil.copy("log.log", time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + "_export.log") +shutil.move("log.log", "1_export.log") diff --git a/code/nel/tools/build_gamedata/2_build.py b/code/nel/tools/build_gamedata/2_build.py old mode 100755 new mode 100644 index 4777ad2d1..18cc4ad16 --- a/code/nel/tools/build_gamedata/2_build.py +++ b/code/nel/tools/build_gamedata/2_build.py @@ -1,94 +1,94 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Run all build processes -# \date 2009-02-18 09:22GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Run all build 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 - Build') -# 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 * -from buildsite import * -from tools import * - -sys.path.append(WorkspaceDirectory) -from projects import * - -# Log error -printLog(log, "") -printLog(log, "-------") -printLog(log, "--- Run the build processes") -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", "2_build.py", "--includeprocess" ] + args.includeprocess) - elif not args.excludeprocess == None: - subprocess.call([ "python", "2_build.py", "--excludeprocess" ] + args.excludeprocess) - else: - subprocess.call([ "python", "2_build.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, "") - -log.close() -if os.path.isfile("2_build.log"): - os.remove("2_build.log") -shutil.copy("log.log", time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + "_build.log") -shutil.move("log.log", "2_build.log") +#!/usr/bin/python +# +# \file 2_build.py +# \brief Run all build processes +# \date 2009-02-18 09:22GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Run all build 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 - Build') +# 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 * +from buildsite_local import * +from tools import * + +sys.path.append(WorkspaceDirectory) +from projects import * + +# Log error +printLog(log, "") +printLog(log, "-------") +printLog(log, "--- Run the build processes") +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", "2_build.py", "--includeprocess" ] + args.includeprocess) + elif not args.excludeprocess == None: + subprocess.call([ "python", "2_build.py", "--excludeprocess" ] + args.excludeprocess) + else: + subprocess.call([ "python", "2_build.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, "") + +log.close() +if os.path.isfile("2_build.log"): + os.remove("2_build.log") +shutil.copy("log.log", time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + "_build.log") +shutil.move("log.log", "2_build.log") diff --git a/code/nel/tools/build_gamedata/3_install.py b/code/nel/tools/build_gamedata/3_install.py old mode 100755 new mode 100644 index b2584274c..807ee4430 --- a/code/nel/tools/build_gamedata/3_install.py +++ b/code/nel/tools/build_gamedata/3_install.py @@ -1,94 +1,94 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Run all install processes -# \date 2009-02-18 16:19GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Run all install 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 - Install') -# 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 * -from buildsite import * -from tools import * - -sys.path.append(WorkspaceDirectory) -from projects import * - -# Log error -printLog(log, "") -printLog(log, "-------") -printLog(log, "--- Run the install processes") -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", "3_install.py", "--includeprocess" ] + args.includeprocess) - elif not args.excludeprocess == None: - subprocess.call([ "python", "3_install.py", "--excludeprocess" ] + args.excludeprocess) - else: - subprocess.call([ "python", "3_install.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, "") - -log.close() -if os.path.isfile("3_install.log"): - os.remove("3_install.log") -shutil.copy("log.log", time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + "_install.log") -shutil.move("log.log", "3_install.log") +#!/usr/bin/python +# +# \file 3_install.py +# \brief Run all install processes +# \date 2009-02-18 16:19GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Run all install 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 - Install') +# 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 * +from buildsite_local import * +from tools import * + +sys.path.append(WorkspaceDirectory) +from projects import * + +# Log error +printLog(log, "") +printLog(log, "-------") +printLog(log, "--- Run the install processes") +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", "3_install.py", "--includeprocess" ] + args.includeprocess) + elif not args.excludeprocess == None: + subprocess.call([ "python", "3_install.py", "--excludeprocess" ] + args.excludeprocess) + else: + subprocess.call([ "python", "3_install.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, "") + +log.close() +if os.path.isfile("3_install.log"): + os.remove("3_install.log") +shutil.copy("log.log", time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + "_install.log") +shutil.move("log.log", "3_install.log") diff --git a/code/nel/tools/build_gamedata/9_upload.py b/code/nel/tools/build_gamedata/9_upload.py old mode 100755 new mode 100644 index 31f6852b5..33d563c7b --- a/code/nel/tools/build_gamedata/9_upload.py +++ b/code/nel/tools/build_gamedata/9_upload.py @@ -1,181 +1,181 @@ -#!/usr/bin/python -# -# \file 9_upload.py -# \brief Upload data to servers -# \date 2009-02-18 16:19GMT -# \author Jan Boon (Kaetemi) -# Game data build pipeline. -# Upload data to servers -# -# NeL - MMORPG Framework -# Copyright (C) 2011 Kaetemi -# -# 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 tools import * - -try: - from upload import * -except ImportError: - # Not documenting this. Because we can. - printLog(log, "ERROR Upload not configured, bye.") - exit() - -sys.path.append(WorkspaceDirectory) -from projects import * - -# Log error -printLog(log, "") -printLog(log, "-------") -printLog(log, "--- Upload data to servers") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# Find tools -# Not documenting this. Because we can. -Psftp = findFileMultiDir(log, ToolDirectories + WindowsExeDllCfgDirectories, UploadPsftpTool) -printLog(log, "PSFTP " + Psftp) - -def downloadVersionTag(server, user, sshkey, dir): - if os.path.isfile("upload.tag"): - os.remove("upload.tag") - if os.path.isfile("upload.batch"): - os.remove("upload.batch") - ub = open("upload.batch", "w") - ub.write("cd " + dir + "\n") - ub.write("get upload.tag upload.tag\n") - ub.write("quit\n") - ub.close() - subprocess.call([ Psftp, "-b", "upload.batch", "-i", sshkey, user + "@" + server ]) - os.remove("upload.batch") - if os.path.isfile("upload.tag"): - ft = open("upload.tag") - result = float(ft.read()) # float, really - ft.close() - os.remove("upload.tag") - printLog(log, "INFO Upload tag is " + str(result)) - return result - else: - printLog(log, "WARNING Upload tag not found, uploading everything") - return 0 - -def isDirectoryNeeded(ft, dir): - files = os.listdir(dir) - for fileName in files: - if isLegalFileName(fileName): - fileFull = dir + "/" + fileName - if os.path.isfile(fileFull): - nftf = os.stat(fileFull).st_mtime - if nftf > ft: - return True - elif os.path.isdir(fileFull): - if isDirectoryNeeded(ft, fileFull): - return True - elif not os.path.isdir(fileFull): - printLog(log, "isDirectoryNeeded: file not dir or file?!" + fileFull) - return False - -def listDirectoryUpload(ft, ub, udb, dir): - nft = 0 - files = os.listdir(dir) - for fileName in files: - if isLegalFileName(fileName): - fileFull = dir + "/" + fileName - if os.path.isfile(fileFull): - nftf = os.stat(fileFull).st_mtime - if nftf > ft: - ub.write("put " + fileFull + " " + fileName + "\n") - if nftf > nft: - nft = nftf - elif os.path.isdir(fileFull): - if isDirectoryNeeded(ft, fileFull): - udb.write("mkdir " + fileName + "\n") - ub.write("cd " + fileName + "\n") - udb.write("cd " + fileName + "\n") - nft2 = listDirectoryUpload(ft, ub, udb, fileFull) - if (nft2 > nft): - nft = nft2 - ub.write("cd ..\n") - udb.write("cd ..\n") - elif not os.path.isdir(fileFull): - printLog(log, "listDirectoryUpload: file not dir or file?!" + fileFull) - return nft - -def uploadSftp(server, user, sshkey, dir_to, dir_from, addcmd): - ft = downloadVersionTag(server, user, sshkey, dir_to) - if isDirectoryNeeded(ft, dir_from): - if os.path.isfile("upload_dir.batch"): - os.remove("upload_dir.batch") - if os.path.isfile("upload.batch"): - os.remove("upload.batch") - udb = open("upload_dir.batch", "w") - udb.write("cd " + dir_to + "\n") - ub = open("upload.batch", "w") - ub.write("cd " + dir_to + "\n") - for ac in addcmd: - ub.write(ac + "\n") - ftn = listDirectoryUpload(ft, ub, udb, dir_from) - if (ft > ftn): - ftn = ft - nft = open("upload.tag", "w") - nft.write(str(ftn)) - nft.close() - ub.write("put upload.tag upload.tag\n") - ub.write("quit\n") - ub.close() - udb.write("quit\n") - udb.close() - subprocess.call([ Psftp, "-be", "-b", "upload_dir.batch", "-i", sshkey, user + "@" + server ]) - subprocess.call([ Psftp, "-b", "upload.batch", "-i", sshkey, user + "@" + server ]) - os.remove("upload_dir.batch") - os.remove("upload.batch") - os.remove("upload.tag") - else: - printLog(log, "SKIP " + dir_to) - -printLog(log, ">>> Upload patch <<<") -for target in UploadPatch: - uploadSftp(target[0], target[1], target[2], target[3], ClientPatchDirectory + "/patch", [ ]) - -printLog(log, ">>> Upload data_shard <<<") -for target in UploadShard: - uploadSftp(target[0], target[1], target[2], target[3], DataShardDirectory, [ "rm *.packed_sheets", "rm primitive_cache/*.binprim" ]) - -printLog(log, ">>> Upload data_common <<<") -for target in UploadCommon: - uploadSftp(target[0], target[1], target[2], target[3], DataCommonDirectory, [ ]) - -printLog(log, ">>> Upload data_leveldesign/leveldesign <<<") -for target in UploadLeveldesign: - uploadSftp(target[0], target[1], target[2], target[3], LeveldesignDirectory, [ ]) - -printLog(log, ">>> Upload data_leveldesign/primitives <<<") -for target in UploadPrimitives: - uploadSftp(target[0], target[1], target[2], target[3], PrimitivesDirectory, [ ]) - -log.close() -if os.path.isfile("9_upload.log"): - os.remove("9_upload.log") -shutil.copy("log.log", time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + "_upload.log") -shutil.move("log.log", "9_upload.log") +#!/usr/bin/python +# +# \file 9_upload.py +# \brief Upload data to servers +# \date 2009-02-18 16:19GMT +# \author Jan Boon (Kaetemi) +# Game data build pipeline. +# Upload data to servers +# +# NeL - MMORPG Framework +# Copyright (C) 2011 Kaetemi +# +# 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 tools import * + +try: + from upload import * +except ImportError: + # Not documenting this. Because we can. + printLog(log, "ERROR Upload not configured, bye.") + exit() + +sys.path.append(WorkspaceDirectory) +from projects import * + +# Log error +printLog(log, "") +printLog(log, "-------") +printLog(log, "--- Upload data to servers") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +# Find tools +# Not documenting this. Because we can. +Psftp = findFileMultiDir(log, ToolDirectories + WindowsExeDllCfgDirectories, UploadPsftpTool) +printLog(log, "PSFTP " + Psftp) + +def downloadVersionTag(server, user, sshkey, dir): + if os.path.isfile("upload.tag"): + os.remove("upload.tag") + if os.path.isfile("upload.batch"): + os.remove("upload.batch") + ub = open("upload.batch", "w") + ub.write("cd " + dir + "\n") + ub.write("get upload.tag upload.tag\n") + ub.write("quit\n") + ub.close() + subprocess.call([ Psftp, "-b", "upload.batch", "-i", sshkey, user + "@" + server ]) + os.remove("upload.batch") + if os.path.isfile("upload.tag"): + ft = open("upload.tag") + result = float(ft.read()) # float, really + ft.close() + os.remove("upload.tag") + printLog(log, "INFO Upload tag is " + str(result)) + return result + else: + printLog(log, "WARNING Upload tag not found, uploading everything") + return 0 + +def isDirectoryNeeded(ft, dir): + files = os.listdir(dir) + for fileName in files: + if isLegalFileName(fileName): + fileFull = dir + "/" + fileName + if os.path.isfile(fileFull): + nftf = os.stat(fileFull).st_mtime + if nftf > ft: + return True + elif os.path.isdir(fileFull): + if isDirectoryNeeded(ft, fileFull): + return True + elif not os.path.isdir(fileFull): + printLog(log, "isDirectoryNeeded: file not dir or file?!" + fileFull) + return False + +def listDirectoryUpload(ft, ub, udb, dir): + nft = 0 + files = os.listdir(dir) + for fileName in files: + if isLegalFileName(fileName): + fileFull = dir + "/" + fileName + if os.path.isfile(fileFull): + nftf = os.stat(fileFull).st_mtime + if nftf > ft: + ub.write("put " + fileFull + " " + fileName + "\n") + if nftf > nft: + nft = nftf + elif os.path.isdir(fileFull): + if isDirectoryNeeded(ft, fileFull): + udb.write("mkdir " + fileName + "\n") + ub.write("cd " + fileName + "\n") + udb.write("cd " + fileName + "\n") + nft2 = listDirectoryUpload(ft, ub, udb, fileFull) + if (nft2 > nft): + nft = nft2 + ub.write("cd ..\n") + udb.write("cd ..\n") + elif not os.path.isdir(fileFull): + printLog(log, "listDirectoryUpload: file not dir or file?!" + fileFull) + return nft + +def uploadSftp(server, user, sshkey, dir_to, dir_from, addcmd): + ft = downloadVersionTag(server, user, sshkey, dir_to) + if isDirectoryNeeded(ft, dir_from): + if os.path.isfile("upload_dir.batch"): + os.remove("upload_dir.batch") + if os.path.isfile("upload.batch"): + os.remove("upload.batch") + udb = open("upload_dir.batch", "w") + udb.write("cd " + dir_to + "\n") + ub = open("upload.batch", "w") + ub.write("cd " + dir_to + "\n") + for ac in addcmd: + ub.write(ac + "\n") + ftn = listDirectoryUpload(ft, ub, udb, dir_from) + if (ft > ftn): + ftn = ft + nft = open("upload.tag", "w") + nft.write(str(ftn)) + nft.close() + ub.write("put upload.tag upload.tag\n") + ub.write("quit\n") + ub.close() + udb.write("quit\n") + udb.close() + subprocess.call([ Psftp, "-be", "-b", "upload_dir.batch", "-i", sshkey, user + "@" + server ]) + subprocess.call([ Psftp, "-b", "upload.batch", "-i", sshkey, user + "@" + server ]) + os.remove("upload_dir.batch") + os.remove("upload.batch") + os.remove("upload.tag") + else: + printLog(log, "SKIP " + dir_to) + +printLog(log, ">>> Upload patch <<<") +for target in UploadPatch: + uploadSftp(target[0], target[1], target[2], target[3], ClientPatchDirectory + "/patch", [ ]) + +printLog(log, ">>> Upload data_shard <<<") +for target in UploadShard: + uploadSftp(target[0], target[1], target[2], target[3], DataShardDirectory, [ "rm *.packed_sheets", "rm primitive_cache/*.binprim" ]) + +printLog(log, ">>> Upload data_common <<<") +for target in UploadCommon: + uploadSftp(target[0], target[1], target[2], target[3], DataCommonDirectory, [ ]) + +printLog(log, ">>> Upload data_leveldesign/leveldesign <<<") +for target in UploadLeveldesign: + uploadSftp(target[0], target[1], target[2], target[3], LeveldesignDirectory, [ ]) + +printLog(log, ">>> Upload data_leveldesign/primitives <<<") +for target in UploadPrimitives: + uploadSftp(target[0], target[1], target[2], target[3], PrimitivesDirectory, [ ]) + +log.close() +if os.path.isfile("9_upload.log"): + os.remove("9_upload.log") +shutil.copy("log.log", time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + "_upload.log") +shutil.move("log.log", "9_upload.log") diff --git a/code/nel/tools/build_gamedata/a1_worldedit_data.py b/code/nel/tools/build_gamedata/a1_worldedit_data.py old mode 100755 new mode 100644 index f7aae7a04..d87fe08b6 --- a/code/nel/tools/build_gamedata/a1_worldedit_data.py +++ b/code/nel/tools/build_gamedata/a1_worldedit_data.py @@ -1,74 +1,74 @@ -#!/usr/bin/python -# -# \file a1_worldedit_data.py -# \brief Install worldedit data -# \date 2014-09-10 14:01GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install worldedit data -# -# 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") - -if os.path.isfile("log.log"): - os.remove("log.log") -log = open("log.log", "w") -from scripts import * -from buildsite import * -from tools import * - -sys.path.append(WorkspaceDirectory) -from projects import * - -# Log error -printLog(log, "") -printLog(log, "-------") -printLog(log, "--- Install worldedit data") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -for ecosystem in WorldEditEcosystems: - ecosystemName = ecosystem[0] - srcZoneLigos = ExportBuildDirectory + "/ecosystems/" + ecosystemName + "/ligo_es/zoneligos/" - dstZoneLigos = WorldEditInstallDirectory + "/" + ecosystemName + "/zoneligos/" - mkPath(log, srcZoneLigos) - mkPath(log, dstZoneLigos) - copyFilesNoTreeIfNeeded(log, srcZoneLigos, dstZoneLigos) - srcZoneBitmaps = DatabaseDirectory + "/landscape/ligo/" + ecosystemName + "/zonebitmaps/" - dstZoneBitmaps = WorldEditInstallDirectory + "/" + ecosystemName + "/zonebitmaps/" - mkPath(log, srcZoneBitmaps) - mkPath(log, dstZoneBitmaps) - copyFilesExtNoTreeIfNeeded(log, srcZoneBitmaps, dstZoneBitmaps, ".tga") - copyFilesExtNoTreeIfNeeded(log, srcZoneBitmaps, dstZoneBitmaps, ".png") - dstCollisionMap = WorldEditInstallDirectory + "/" + ecosystemName + "/collisionmap/" - mkPath(log, dstCollisionMap) - for continentName in ecosystem[1]: - srcCollisionMap = ExportBuildDirectory + "/continents/" + continentName + "/ai_wmap/" - mkPath(log, srcCollisionMap) - copyFilesExtNoTreeIfNeeded(log, srcCollisionMap, dstCollisionMap, ".tga") - copyFilesExtNoTreeIfNeeded(log, srcCollisionMap, dstCollisionMap, ".png") -printLog(log, "") - -log.close() -if os.path.isfile("a1_worldedit_data.log"): - os.remove("a1_worldedit_data.log") -shutil.copy("log.log", time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + "_worldedit_data.log") -shutil.move("log.log", "a1_worldedit_data.log") +#!/usr/bin/python +# +# \file a1_worldedit_data.py +# \brief Install worldedit data +# \date 2014-09-10 14:01GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install worldedit data +# +# 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") + +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 worldedit data") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +for ecosystem in WorldEditEcosystems: + ecosystemName = ecosystem[0] + srcZoneLigos = ExportBuildDirectory + "/ecosystems/" + ecosystemName + "/ligo_es/zoneligos/" + dstZoneLigos = WorldEditInstallDirectory + "/" + ecosystemName + "/zoneligos/" + mkPath(log, srcZoneLigos) + mkPath(log, dstZoneLigos) + copyFilesNoTreeIfNeeded(log, srcZoneLigos, dstZoneLigos) + srcZoneBitmaps = DatabaseDirectory + "/landscape/ligo/" + ecosystemName + "/zonebitmaps/" + dstZoneBitmaps = WorldEditInstallDirectory + "/" + ecosystemName + "/zonebitmaps/" + mkPath(log, srcZoneBitmaps) + mkPath(log, dstZoneBitmaps) + copyFilesExtNoTreeIfNeeded(log, srcZoneBitmaps, dstZoneBitmaps, ".tga") + copyFilesExtNoTreeIfNeeded(log, srcZoneBitmaps, dstZoneBitmaps, ".png") + dstCollisionMap = WorldEditInstallDirectory + "/" + ecosystemName + "/collisionmap/" + mkPath(log, dstCollisionMap) + for continentName in ecosystem[1]: + srcCollisionMap = ExportBuildDirectory + "/continents/" + continentName + "/ai_wmap/" + mkPath(log, srcCollisionMap) + copyFilesExtNoTreeIfNeeded(log, srcCollisionMap, dstCollisionMap, ".tga") + copyFilesExtNoTreeIfNeeded(log, srcCollisionMap, dstCollisionMap, ".png") +printLog(log, "") + +log.close() +if os.path.isfile("a1_worldedit_data.log"): + os.remove("a1_worldedit_data.log") +shutil.copy("log.log", time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + "_worldedit_data.log") +shutil.move("log.log", "a1_worldedit_data.log") diff --git a/code/nel/tools/build_gamedata/b1_client_dev.py b/code/nel/tools/build_gamedata/b1_client_dev.py old mode 100755 new mode 100644 index a23ee693c..87ce0f998 --- a/code/nel/tools/build_gamedata/b1_client_dev.py +++ b/code/nel/tools/build_gamedata/b1_client_dev.py @@ -1,79 +1,108 @@ -#!/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 -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 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, "") - -if not os.path.isfile(ClientDevDirectory + "/client.cfg"): - printLog(log, ">>> Generate client.cfg <<<") - cfg = open(ClientDevDirectory + "/client.cfg", "w") - cfg.write("RootConfigFilename = \"client_default.cfg\";\n") - cfg.write("PreDataPath = {\n") - cfg.write("\t\"" + InstallDirectory + "\", \"user\", \"patch\", \"data\", \"examples\" \n") - cfg.write("};\n") - cfg.write("PatchWanted = 0;\n") - cfg.write("DisplayLuaDebugInfo = 1;\n") - cfg.write("AllowDebugLua = 1;\n") - cfg.write("FullScreen = 0;\n") - printLog(log, "") - -printLog(log, ">>> Install data <<<") -for category in InstallClientData: - if (category["UnpackTo"] != None): - printLog(log, "CATEGORY " + category["Name"]) - targetPath = ClientDevDirectory - if (category["UnpackTo"] != ""): - targetPath += "/" + category["UnpackTo"] - mkPath(log, targetPath) - for package in category["Packages"]: - printLog(log, "PACKAGE " + package[0]) - mkPath(log, InstallDirectory + "/" + package[0]) - copyFilesNoTreeIfNeeded(log, InstallDirectory + "/" + package[0], targetPath) -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") +#!/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/b2_shard_data.py b/code/nel/tools/build_gamedata/b2_shard_data.py old mode 100755 new mode 100644 index f0a50cfdf..5416e06c3 --- a/code/nel/tools/build_gamedata/b2_shard_data.py +++ b/code/nel/tools/build_gamedata/b2_shard_data.py @@ -1,93 +1,93 @@ -#!/usr/bin/python -# -# \file b2_shard_data.py -# \brief Install shard data -# \date 2009-02-18 16:19GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install shard data -# -# 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 tools import * - -sys.path.append(WorkspaceDirectory) -from projects import * - -# Log error -printLog(log, "") -printLog(log, "-------") -printLog(log, "--- Install shard data") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -for dir in InstallShardDataDirectories: - printLog(log, "SHARD PACKAGE " + dir) - mkPath(log, ShardInstallDirectory + "/" + dir) - printLog(log, "FROM " + dir) - mkPath(log, InstallDirectory + "/" + dir) - copyFilesNoTreeIfNeeded(log, InstallDirectory + "/" + dir, ShardInstallDirectory + "/" + dir) -for package in InstallShardDataFiles: - dstDir = package[0] - mkPath(log, ShardInstallDirectory + "/" + dstDir) - printLog(log, "SHARD PACKAGE " + dstDir) - copyFileListNoTreeIfNeeded(log, InstallDirectory, ShardInstallDirectory + "/" + dstDir, package[1]) -for multiDir in InstallShardDataMultiDirectories: - dstDir = multiDir[0] - mkPath(log, ShardInstallDirectory + "/" + dstDir) - printLog(log, "SHARD PACKAGE " + dstDir) - for srcDir in multiDir[1]: - printLog(log, "FROM " + srcDir) - mkPath(log, InstallDirectory + "/" + srcDir) - mkPath(log, ShardInstallDirectory + "/" + dstDir + "/" + srcDir) - copyFilesNoTreeIfNeeded(log, InstallDirectory + "/" + srcDir, ShardInstallDirectory + "/" + dstDir + "/" + srcDir) -for multiDir in InstallShardDataPrimitivesDirectories: - dstDir = multiDir[0] - mkPath(log, ShardInstallDirectory + "/" + dstDir) - printLog(log, "SHARD PACKAGE " + dstDir) - for srcDir in multiDir[1]: - printLog(log, "FROM PRIMITIVES " + srcDir) - mkPath(log, PrimitivesDirectory + "/" + srcDir) - mkPath(log, ShardInstallDirectory + "/" + dstDir + "/" + srcDir) - copyFilesNoTreeIfNeeded(log, PrimitivesDirectory + "/" + srcDir, ShardInstallDirectory + "/" + dstDir + "/" + srcDir) -for execDir in InstallShardDataExecutables: - dstDir = execDir[0] - mkPath(log, LinuxServiceExecutableDirectory) - mkPath(log, PatchmanCfgDefaultDirectory) - mkPath(log, InstallDirectory) - mkPath(log, ShardInstallDirectory + "/" + dstDir) - printLog(log, "SHARD PACKAGE " + dstDir) - copyFileIfNeeded(log, LinuxServiceExecutableDirectory + "/" + execDir[1][1], ShardInstallDirectory + "/" + dstDir + "/" + execDir[1][0]) - copyFileListNoTreeIfNeeded(log, PatchmanCfgDefaultDirectory, ShardInstallDirectory + "/" + dstDir, execDir[2]) - copyFileListNoTreeIfNeeded(log, InstallDirectory, ShardInstallDirectory + "/" + dstDir, execDir[3]) -printLog(log, "") - -log.close() -if os.path.isfile("b2_shard_data.log"): - os.remove("b2_shard_data.log") -shutil.copy("log.log", time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + "_shard_data.log") -shutil.move("log.log", "b2_shard_data.log") +#!/usr/bin/python +# +# \file b2_shard_data.py +# \brief Install shard data +# \date 2009-02-18 16:19GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install shard data +# +# 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 tools import * + +sys.path.append(WorkspaceDirectory) +from projects import * + +# Log error +printLog(log, "") +printLog(log, "-------") +printLog(log, "--- Install shard data") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +for dir in InstallShardDataDirectories: + printLog(log, "SHARD PACKAGE " + dir) + mkPath(log, ShardInstallDirectory + "/" + dir) + printLog(log, "FROM " + dir) + mkPath(log, InstallDirectory + "/" + dir) + copyFilesNoTreeIfNeeded(log, InstallDirectory + "/" + dir, ShardInstallDirectory + "/" + dir) +for package in InstallShardDataFiles: + dstDir = package[0] + mkPath(log, ShardInstallDirectory + "/" + dstDir) + printLog(log, "SHARD PACKAGE " + dstDir) + copyFileListNoTreeIfNeeded(log, InstallDirectory, ShardInstallDirectory + "/" + dstDir, package[1]) +for multiDir in InstallShardDataMultiDirectories: + dstDir = multiDir[0] + mkPath(log, ShardInstallDirectory + "/" + dstDir) + printLog(log, "SHARD PACKAGE " + dstDir) + for srcDir in multiDir[1]: + printLog(log, "FROM " + srcDir) + mkPath(log, InstallDirectory + "/" + srcDir) + mkPath(log, ShardInstallDirectory + "/" + dstDir + "/" + srcDir) + copyFilesNoTreeIfNeeded(log, InstallDirectory + "/" + srcDir, ShardInstallDirectory + "/" + dstDir + "/" + srcDir) +for multiDir in InstallShardDataPrimitivesDirectories: + dstDir = multiDir[0] + mkPath(log, ShardInstallDirectory + "/" + dstDir) + printLog(log, "SHARD PACKAGE " + dstDir) + for srcDir in multiDir[1]: + printLog(log, "FROM PRIMITIVES " + srcDir) + mkPath(log, PrimitivesDirectory + "/" + srcDir) + mkPath(log, ShardInstallDirectory + "/" + dstDir + "/" + srcDir) + copyFilesNoTreeIfNeeded(log, PrimitivesDirectory + "/" + srcDir, ShardInstallDirectory + "/" + dstDir + "/" + srcDir) +for execDir in InstallShardDataExecutables: + dstDir = execDir[0] + mkPath(log, LinuxServiceExecutableDirectory) + mkPath(log, PatchmanCfgDefaultDirectory) + mkPath(log, InstallDirectory) + mkPath(log, ShardInstallDirectory + "/" + dstDir) + printLog(log, "SHARD PACKAGE " + dstDir) + copyFileIfNeeded(log, LinuxServiceExecutableDirectory + "/" + execDir[1][1], ShardInstallDirectory + "/" + dstDir + "/" + execDir[1][0]) + copyFileListNoTreeIfNeeded(log, PatchmanCfgDefaultDirectory, ShardInstallDirectory + "/" + dstDir, execDir[2]) + copyFileListNoTreeIfNeeded(log, InstallDirectory, ShardInstallDirectory + "/" + dstDir, execDir[3]) +printLog(log, "") + +log.close() +if os.path.isfile("b2_shard_data.log"): + os.remove("b2_shard_data.log") +shutil.copy("log.log", time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + "_shard_data.log") +shutil.move("log.log", "b2_shard_data.log") diff --git a/code/nel/tools/build_gamedata/c1_shard_patch.py b/code/nel/tools/build_gamedata/c1_shard_patch.py old mode 100755 new mode 100644 index b67b053a8..30cb88bb8 --- a/code/nel/tools/build_gamedata/c1_shard_patch.py +++ b/code/nel/tools/build_gamedata/c1_shard_patch.py @@ -1,114 +1,123 @@ -#!/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 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, "") - -# 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: - 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() - 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") +#!/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 old mode 100755 new mode 100644 index 5bbed497f..4dcfaaac5 --- a/code/nel/tools/build_gamedata/configuration/scripts.py +++ b/code/nel/tools/build_gamedata/configuration/scripts.py @@ -1,589 +1,610 @@ -#!/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 - -ActiveProjectDirectory = os.getenv("NELBUILDACTIVEPROJECT", "configuration/project") -sys.path.append(ActiveProjectDirectory) - -def printLog(log, text): - log.write(text + "\n") - print text - -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 +#!/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 old mode 100755 new mode 100644 index ebb1d07da..cbf1e63f5 --- a/code/nel/tools/build_gamedata/configuration/tools.py +++ b/code/nel/tools/build_gamedata/configuration/tools.py @@ -1,100 +1,102 @@ -#!/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" +#!/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 old mode 100755 new mode 100644 index ea4cc742c..608f24766 --- a/code/nel/tools/build_gamedata/d1_client_patch.py +++ b/code/nel/tools/build_gamedata/d1_client_patch.py @@ -1,172 +1,181 @@ -#!/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 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" - mkPath(log, targetPath) - 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 - if (len(package[1]) > 0): - targetBnp = targetPath + "/" + package[1][0] - printLog(log, "TARGET " + package[1][0]) - needUpdateBnp = 1 - if (len(package) > 2): - needUpdateBnp = needUpdate(log, sourcePath + "/" + package[2], targetBnp) - else: - needUpdateBnp = needUpdateDirNoSubdirFile(log, sourcePath, targetBnp) - if (needUpdateBnp): - if (category["StreamedPackages"]): - printLog(log, "SNP " + targetBnp) - # cwDir = os.getcwd().replace("\\", "/") - # toolDir = os.path.dirname(Lzma).replace("\\", "/") - # os.chdir(toolDir) - subprocess.call([ SnpMake, "-p", sourcePath, targetBnp, ClientPatchDirectory + "/stream" ] + package[1][1:]) - # os.chdir(cwDir) - else: - printLog(log, "BNP " + targetBnp) - subprocess.call([ BnpMake, "-p", sourcePath, "-o", targetBnp ] + package[1][1:]) - 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") +#!/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/d2_client_install.py b/code/nel/tools/build_gamedata/d2_client_install.py old mode 100755 new mode 100644 index bb399447f..4041d79c2 --- a/code/nel/tools/build_gamedata/d2_client_install.py +++ b/code/nel/tools/build_gamedata/d2_client_install.py @@ -1,86 +1,86 @@ -#!/usr/bin/python -# -# \file d2_client_install.py -# \brief Install to client install -# \date 2009-02-18 16:19GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install to client install -# -# 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 tools import * - -sys.path.append(WorkspaceDirectory) -from projects import * - -# Log error -printLog(log, "") -printLog(log, "-------") -printLog(log, "--- Install to client install") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -for category in InstallClientData: - printLog(log, "CATEGORY " + category["Name"]) - packExt = ".bnp" - if (category["StreamedPackages"]): - packExt = ".snp" - if (category["UnpackTo"] != None): - targetPath = ClientInstallDirectory - if (category["UnpackTo"] != ""): - targetPath += "/" + category["UnpackTo"] - mkPath(log, targetPath) - for package in category["Packages"]: - printLog(log, "PACKAGE " + package[0]) - mkPath(log, InstallDirectory + "/" + package[0]) - copyFilesNoTreeIfNeeded(log, InstallDirectory + "/" + package[0], targetPath) - else: - sourcePath = ClientPatchDirectory + "/bnp" - targetPath = ClientInstallDirectory + "/data" - mkPath(log, targetPath) - for package in category["Packages"]: - printLog(log, "PACKAGE " + package[0]) - sourceBnp = sourcePath + "/" + package[0] + packExt - targetBnp = targetPath + "/" + package[0] + packExt - if (len(package[1]) > 0): - sourceBnp = sourcePath + "/" + package[1][0] - targetBnp = targetPath + "/" + package[1][0] - printLog(log, "TARGET " + package[1][0]) - copyFileIfNeeded(log, sourceBnp, targetBnp) - for ref in category["Refs"]: - printLog(log, "REFERENCE " + ref) - sourceRef = sourcePath + "/" + ref + "_.ref" - targetRef = targetPath + "/" + ref + "_.ref" - copyFileIfNeeded(log, sourceRef, targetRef) -printLog(log, "") - -log.close() -if os.path.isfile("d2_client_install.log"): - os.remove("d2_client_install.log") -shutil.copy("log.log", time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + "_client_install.log") -shutil.move("log.log", "d2_client_install.log") +#!/usr/bin/python +# +# \file d2_client_install.py +# \brief Install to client install +# \date 2009-02-18 16:19GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install to client install +# +# 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 tools import * + +sys.path.append(WorkspaceDirectory) +from projects import * + +# Log error +printLog(log, "") +printLog(log, "-------") +printLog(log, "--- Install to client install") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +for category in InstallClientData: + printLog(log, "CATEGORY " + category["Name"]) + packExt = ".bnp" + if (category["StreamedPackages"]): + packExt = ".snp" + if (category["UnpackTo"] != None): + targetPath = ClientInstallDirectory + if (category["UnpackTo"] != ""): + targetPath += "/" + category["UnpackTo"] + mkPath(log, targetPath) + for package in category["Packages"]: + printLog(log, "PACKAGE " + package[0]) + mkPath(log, InstallDirectory + "/" + package[0]) + copyFilesNoTreeIfNeeded(log, InstallDirectory + "/" + package[0], targetPath) + else: + sourcePath = ClientPatchDirectory + "/bnp" + targetPath = ClientInstallDirectory + "/data" + mkPath(log, targetPath) + for package in category["Packages"]: + printLog(log, "PACKAGE " + package[0]) + sourceBnp = sourcePath + "/" + package[0] + packExt + targetBnp = targetPath + "/" + package[0] + packExt + if (len(package[1]) > 0): + sourceBnp = sourcePath + "/" + package[1][0] + targetBnp = targetPath + "/" + package[1][0] + printLog(log, "TARGET " + package[1][0]) + copyFileIfNeeded(log, sourceBnp, targetBnp) + for ref in category["Refs"]: + printLog(log, "REFERENCE " + ref) + sourceRef = sourcePath + "/" + ref + "_.ref" + targetRef = targetPath + "/" + ref + "_.ref" + copyFileIfNeeded(log, sourceRef, targetRef) +printLog(log, "") + +log.close() +if os.path.isfile("d2_client_install.log"): + os.remove("d2_client_install.log") +shutil.copy("log.log", time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + "_client_install.log") +shutil.move("log.log", "d2_client_install.log") diff --git a/code/nel/tools/build_gamedata/export_build_install.py b/code/nel/tools/build_gamedata/export_build_install.py old mode 100755 new mode 100644 index b5e46ba06..cf6da81d7 --- a/code/nel/tools/build_gamedata/export_build_install.py +++ b/code/nel/tools/build_gamedata/export_build_install.py @@ -1,32 +1,32 @@ -#!/usr/bin/python -# -# \file export_build_install.py -# \brief Run all processes -# \date 2009-02-18 15:28GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Run all 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 shutil, subprocess - -subprocess.call([ "python", "1_export.py" ]) -subprocess.call([ "python", "2_build.py" ]) -subprocess.call([ "python", "3_install.py" ]) - +#!/usr/bin/python +# +# \file export_build_install.py +# \brief Run all processes +# \date 2009-02-18 15:28GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Run all 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 shutil, subprocess + +subprocess.call([ "python", "1_export.py" ]) +subprocess.call([ "python", "2_build.py" ]) +subprocess.call([ "python", "3_install.py" ]) + diff --git a/code/nel/tools/build_gamedata/generators/ecosystem_project_template/directories.py b/code/nel/tools/build_gamedata/generators/ecosystem_project_template/directories.py old mode 100755 new mode 100644 index 34886120e..6e614ffb3 --- a/code/nel/tools/build_gamedata/generators/ecosystem_project_template/directories.py +++ b/code/nel/tools/build_gamedata/generators/ecosystem_project_template/directories.py @@ -1,220 +1,220 @@ -#!/usr/bin/python -# -# ################################################################# -# ## %PreGenWarning% -# ################################################################# -# -# \file directories.py -# \brief Directories configuration -# \date %PreGenDateTimeStamp% -# \author Jan Boon (Kaetemi) -# \date 2001-2005 -# \author Nevrax -# Python port of game data build pipeline. -# Directories configuration for '%PreGenEcosystemName%' ecosystem. -# -# 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 . -# - - -# *** ECOSYSTEM AND CONTINENT NAMES *** - -EcosystemName = "%PreGenEcosystemName%" -EcosystemPath = "ecosystems/" + EcosystemName -CommonName = EcosystemName -CommonPath = EcosystemPath - -DatabaseRootName = "%PreGenDatabaseRootName%" -DatabaseRootPath = "stuff/" + DatabaseRootName - - -# *** SOURCE DIRECTORIES IN THE DATABASE *** - -# Shape directories -ShapeSourceDirectories = [ ] -ShapeSourceDirectories += [ DatabaseRootPath + "/decors/vegetations" ] -ShapeSourceDirectories += [ "landscape/ligo/" + EcosystemName + "/max" ] - -# Maps directories -MapSourceDirectories = [ ] -MapSourceDirectories += [ DatabaseRootPath + "/decors/_textures" ] -%PreGenMapSubdirectories%MapSourceDirectories += [ "landscape/microveget/" + EcosystemName + "" ] -MapSourceDirectories += [ "landscape/water/meshes/" + EcosystemName + "" ] - -MapUncompressedSourceDirectories = [ ] - -# Tiles directories -TilesSourceDirectories = [ ] -%PreGenTileSourceDirectories% -# Tiles root directory -TileRootSourceDirectory = "landscape/_texture_tiles/" + EcosystemName - -# Displace directory -DisplaceSourceDirectory = "landscape/_texture_tiles/" + EcosystemName + "/displace" - -# Do not use, needs to be removed and fixed in processes -DisplaceSourceDirectories = [ ] -DisplaceSourceDirectories += [ DisplaceSourceDirectory ] - -# Bank directory -BankSourceDirectory = "landscape/_texture_tiles/" + EcosystemName - -# Vegetable set directories -VegetSetSourceDirectories = [ ] -VegetSetSourceDirectories += [ "landscape/microveget/" + EcosystemName ] - -# Veget directories -VegetSourceDirectories = [ ] -VegetSourceDirectories += [ "landscape/microveget/" + EcosystemName ] - -# Ligo directories -LigoBaseSourceDirectory = "landscape/ligo/" + EcosystemName -LigoMaxSourceDirectory = LigoBaseSourceDirectory + "/max" - -# Zone directories -ZoneSourceDirectory = [ "landscape/zones/" + EcosystemName ] # For old snowballs style landscape when not using ligo - -# Ig landscape directories -IgLandSourceDirectory = "_invalid" - -# Ig other directories -IgOtherSourceDirectory = "_invalid" - -# PACS primitives directories -PacsPrimSourceDirectories = [ ] -PacsPrimSourceDirectories += [ DatabaseRootPath + "/decors/vegetations" ] - - -# *** LOOKUP DIRECTORIES WITHIN THE BUILD PIPELINE *** (TODO: use these instead of search_pathes in properties(_base).cfg) - -# Ig lookup directories used by rbank -IgLookupDirectories = [ ] - -# Shape lookup directories used by rbank -ShapeLookupDirectories = [ ] -ShapeLookupDirectories += [ EcosystemPath + "/shape_clodtex_build" ] -ShapeLookupDirectories += [ EcosystemPath + "/shape_with_coarse_mesh" ] - -# Map lookup directories not yet used -MapLookupDirectories = [ ] -MapLookupDirectories += [ EcosystemPath + "/map_export" ] -MapLookupDirectories += [ EcosystemPath + "/map_uncompressed" ] - - -# *** EXPORT DIRECTORIES FOR THE BUILD PIPELINE *** - -# Map directories -MapExportDirectory = CommonPath + "/map_export" -MapUncompressedExportDirectory = CommonPath + "/map_uncompressed" - -# Shape directories -ShapeTagExportDirectory = CommonPath + "/shape_tag" -ShapeNotOptimizedExportDirectory = CommonPath + "/shape_not_optimized" -ShapeWithCoarseMeshExportDirectory = CommonPath + "/shape_with_coarse_mesh" -ShapeLightmapNotOptimizedExportDirectory = CommonPath + "/shape_lightmap_not_optimized" -ShapeAnimExportDirectory = CommonPath + "/shape_anim" - -# Smallbank directories -SmallbankExportDirectory = CommonPath + "/smallbank" - -# Tiles directories -TilesExportDirectory = CommonPath + "/tiles" - -# Tiles directories -DisplaceExportDirectory = CommonPath + "/diplace" - -# Veget directories -VegetExportDirectory = CommonPath + "/veget" -VegetTagExportDirectory = CommonPath + "/veget_tag" - -# Veget Set directories -VegetSetExportDirectory = CommonPath + "/veget_set" - -# Ligo directories -LigoEcosystemExportDirectory = CommonPath + "/ligo_es" -LigoEcosystemIgExportDirectory = LigoEcosystemExportDirectory + "/igs" -LigoEcosystemZoneExportDirectory = LigoEcosystemExportDirectory + "/zones" -LigoEcosystemZoneLigoExportDirectory = LigoEcosystemExportDirectory + "/zoneligos" -LigoEcosystemCmbExportDirectory = LigoEcosystemExportDirectory + "/cmb" -LigoEcosystemTagExportDirectory = CommonPath + "/ligo_es_tag" - -# Zone directories -ZoneExportDirectory = CommonPath + "/zone" - -# PACS primitives directories -PacsPrimExportDirectory = CommonPath + "/pacs_prim" -PacsPrimTagExportDirectory = CommonPath + "/pacs_prim_tag" - - -# *** BUILD DIRECTORIES FOR THE BUILD PIPELINE *** - -# Map directories -MapBuildDirectory = CommonPath + "/map" -MapPanoplyBuildDirectory = CommonPath + "/map_panoply" -MapPanoplyHlsInfoBuildDirectory = CommonPath + "/map_panoply_hls_info" -MapPanoplyHlsBankBuildDirectory = CommonPath + "/map_panoply_hls_bank" -MapPanoplyCacheBuildDirectory = CommonPath + "/map_panoply_cache" -MapTagBuildDirectory = CommonPath + "/map_tag" - -# Shape directories -ShapeClodtexBuildDirectory = CommonPath + "/shape_clodtex_build" -ShapeWithCoarseMeshBuildDirectory = CommonPath + "/shape_with_coarse_mesh_builded" -ShapeLightmapBuildDirectory = CommonPath + "/shape_lightmap" -ShapeLightmap16BitsBuildDirectory = CommonPath + "/shape_lightmap_16_bits" - -# Farbank directories -FarbankBuildDirectory = CommonPath + "/farbank" - -# Ig directories ************** TODO CONFIRM IN IG BUILD PROCESS ************ FIX RBANK IF NEEDED *********** -IgLandBuildDirectory = "_invalid" -IgOtherBuildDirectory = "_invalid" - -# Rbank directories -RbankOutputBuildDirectory = "_invalid" - -# Ligo directories - - -# *** INSTALL DIRECTORIES IN THE CLIENT DATA *** - -# Map directory -MapInstallDirectory = CommonName + "_maps" -BitmapInstallDirectory = MapInstallDirectory - -# Shape directory -ShapeInstallDirectory = CommonName + "_shapes" - -# Lightmap directory -LightmapInstallDirectory = CommonName + "_lightmaps" - -# Tile directory -TilesInstallDirectory = CommonName + "_tiles" - -# Displace directory -DisplaceInstallDirectory = CommonName + "_displaces" - -# Bank directory -BankInstallDirectory = CommonName + "_bank" - -# Vegetable set directory -VegetSetInstallDirectory = CommonName + "_vegetable_sets" - -# Vegetable shape directory -VegetInstallDirectory = CommonName + "_vegetables" - -# PACS primitives directories -PacsPrimInstallDirectory = CommonName + "_pacs_prim" +#!/usr/bin/python +# +# ################################################################# +# ## %PreGenWarning% +# ################################################################# +# +# \file directories.py +# \brief Directories configuration +# \date %PreGenDateTimeStamp% +# \author Jan Boon (Kaetemi) +# \date 2001-2005 +# \author Nevrax +# Python port of game data build pipeline. +# Directories configuration for '%PreGenEcosystemName%' ecosystem. +# +# 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 . +# + + +# *** ECOSYSTEM AND CONTINENT NAMES *** + +EcosystemName = "%PreGenEcosystemName%" +EcosystemPath = "ecosystems/" + EcosystemName +CommonName = EcosystemName +CommonPath = EcosystemPath + +DatabaseRootName = "%PreGenDatabaseRootName%" +DatabaseRootPath = "stuff/" + DatabaseRootName + + +# *** SOURCE DIRECTORIES IN THE DATABASE *** + +# Shape directories +ShapeSourceDirectories = [ ] +ShapeSourceDirectories += [ DatabaseRootPath + "/decors/vegetations" ] +ShapeSourceDirectories += [ "landscape/ligo/" + EcosystemName + "/max" ] + +# Maps directories +MapSourceDirectories = [ ] +MapSourceDirectories += [ DatabaseRootPath + "/decors/_textures" ] +%PreGenMapSubdirectories%MapSourceDirectories += [ "landscape/microveget/" + EcosystemName + "" ] +MapSourceDirectories += [ "landscape/water/meshes/" + EcosystemName + "" ] + +MapUncompressedSourceDirectories = [ ] + +# Tiles directories +TilesSourceDirectories = [ ] +%PreGenTileSourceDirectories% +# Tiles root directory +TileRootSourceDirectory = "landscape/_texture_tiles/" + EcosystemName + +# Displace directory +DisplaceSourceDirectory = "landscape/_texture_tiles/" + EcosystemName + "/displace" + +# Do not use, needs to be removed and fixed in processes +DisplaceSourceDirectories = [ ] +DisplaceSourceDirectories += [ DisplaceSourceDirectory ] + +# Bank directory +BankSourceDirectory = "landscape/_texture_tiles/" + EcosystemName + +# Vegetable set directories +VegetSetSourceDirectories = [ ] +VegetSetSourceDirectories += [ "landscape/microveget/" + EcosystemName ] + +# Veget directories +VegetSourceDirectories = [ ] +VegetSourceDirectories += [ "landscape/microveget/" + EcosystemName ] + +# Ligo directories +LigoBaseSourceDirectory = "landscape/ligo/" + EcosystemName +LigoMaxSourceDirectory = LigoBaseSourceDirectory + "/max" + +# Zone directories +ZoneSourceDirectory = [ "landscape/zones/" + EcosystemName ] # For old snowballs style landscape when not using ligo + +# Ig landscape directories +IgLandSourceDirectory = "_invalid" + +# Ig other directories +IgOtherSourceDirectory = "_invalid" + +# PACS primitives directories +PacsPrimSourceDirectories = [ ] +PacsPrimSourceDirectories += [ DatabaseRootPath + "/decors/vegetations" ] + + +# *** LOOKUP DIRECTORIES WITHIN THE BUILD PIPELINE *** (TODO: use these instead of search_pathes in properties(_base).cfg) + +# Ig lookup directories used by rbank +IgLookupDirectories = [ ] + +# Shape lookup directories used by rbank +ShapeLookupDirectories = [ ] +ShapeLookupDirectories += [ EcosystemPath + "/shape_clodtex_build" ] +ShapeLookupDirectories += [ EcosystemPath + "/shape_with_coarse_mesh" ] + +# Map lookup directories not yet used +MapLookupDirectories = [ ] +MapLookupDirectories += [ EcosystemPath + "/map_export" ] +MapLookupDirectories += [ EcosystemPath + "/map_uncompressed" ] + + +# *** EXPORT DIRECTORIES FOR THE BUILD PIPELINE *** + +# Map directories +MapExportDirectory = CommonPath + "/map_export" +MapUncompressedExportDirectory = CommonPath + "/map_uncompressed" + +# Shape directories +ShapeTagExportDirectory = CommonPath + "/shape_tag" +ShapeNotOptimizedExportDirectory = CommonPath + "/shape_not_optimized" +ShapeWithCoarseMeshExportDirectory = CommonPath + "/shape_with_coarse_mesh" +ShapeLightmapNotOptimizedExportDirectory = CommonPath + "/shape_lightmap_not_optimized" +ShapeAnimExportDirectory = CommonPath + "/shape_anim" + +# Smallbank directories +SmallbankExportDirectory = CommonPath + "/smallbank" + +# Tiles directories +TilesExportDirectory = CommonPath + "/tiles" + +# Tiles directories +DisplaceExportDirectory = CommonPath + "/diplace" + +# Veget directories +VegetExportDirectory = CommonPath + "/veget" +VegetTagExportDirectory = CommonPath + "/veget_tag" + +# Veget Set directories +VegetSetExportDirectory = CommonPath + "/veget_set" + +# Ligo directories +LigoEcosystemExportDirectory = CommonPath + "/ligo_es" +LigoEcosystemIgExportDirectory = LigoEcosystemExportDirectory + "/igs" +LigoEcosystemZoneExportDirectory = LigoEcosystemExportDirectory + "/zones" +LigoEcosystemZoneLigoExportDirectory = LigoEcosystemExportDirectory + "/zoneligos" +LigoEcosystemCmbExportDirectory = LigoEcosystemExportDirectory + "/cmb" +LigoEcosystemTagExportDirectory = CommonPath + "/ligo_es_tag" + +# Zone directories +ZoneExportDirectory = CommonPath + "/zone" + +# PACS primitives directories +PacsPrimExportDirectory = CommonPath + "/pacs_prim" +PacsPrimTagExportDirectory = CommonPath + "/pacs_prim_tag" + + +# *** BUILD DIRECTORIES FOR THE BUILD PIPELINE *** + +# Map directories +MapBuildDirectory = CommonPath + "/map" +MapPanoplyBuildDirectory = CommonPath + "/map_panoply" +MapPanoplyHlsInfoBuildDirectory = CommonPath + "/map_panoply_hls_info" +MapPanoplyHlsBankBuildDirectory = CommonPath + "/map_panoply_hls_bank" +MapPanoplyCacheBuildDirectory = CommonPath + "/map_panoply_cache" +MapTagBuildDirectory = CommonPath + "/map_tag" + +# Shape directories +ShapeClodtexBuildDirectory = CommonPath + "/shape_clodtex_build" +ShapeWithCoarseMeshBuildDirectory = CommonPath + "/shape_with_coarse_mesh_builded" +ShapeLightmapBuildDirectory = CommonPath + "/shape_lightmap" +ShapeLightmap16BitsBuildDirectory = CommonPath + "/shape_lightmap_16_bits" + +# Farbank directories +FarbankBuildDirectory = CommonPath + "/farbank" + +# Ig directories ************** TODO CONFIRM IN IG BUILD PROCESS ************ FIX RBANK IF NEEDED *********** +IgLandBuildDirectory = "_invalid" +IgOtherBuildDirectory = "_invalid" + +# Rbank directories +RbankOutputBuildDirectory = "_invalid" + +# Ligo directories + + +# *** INSTALL DIRECTORIES IN THE CLIENT DATA *** + +# Map directory +MapInstallDirectory = CommonName + "_maps" +BitmapInstallDirectory = MapInstallDirectory + +# Shape directory +ShapeInstallDirectory = CommonName + "_shapes" + +# Lightmap directory +LightmapInstallDirectory = CommonName + "_lightmaps" + +# Tile directory +TilesInstallDirectory = CommonName + "_tiles" + +# Displace directory +DisplaceInstallDirectory = CommonName + "_displaces" + +# Bank directory +BankInstallDirectory = CommonName + "_bank" + +# Vegetable set directory +VegetSetInstallDirectory = CommonName + "_vegetable_sets" + +# Vegetable shape directory +VegetInstallDirectory = CommonName + "_vegetables" + +# PACS primitives directories +PacsPrimInstallDirectory = CommonName + "_pacs_prim" diff --git a/code/nel/tools/build_gamedata/generators/ecosystem_project_template/process.py b/code/nel/tools/build_gamedata/generators/ecosystem_project_template/process.py old mode 100755 new mode 100644 index 367ff8feb..cd38a8143 --- a/code/nel/tools/build_gamedata/generators/ecosystem_project_template/process.py +++ b/code/nel/tools/build_gamedata/generators/ecosystem_project_template/process.py @@ -1,122 +1,122 @@ -#!/usr/bin/python -# -# ################################################################# -# ## %PreGenWarning% -# ################################################################# -# -# \file config.py -# \brief Process configuration -# \date %PreGenDateTimeStamp% -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Process configuration for '%PreGenEcosystemName%' ecosystem. -# -# 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 CONFIGURATION *** - -# *** PROCESS CONFIG *** -ProcessToComplete = [ ] -ProcessToComplete += [ "shape" ] -ProcessToComplete += [ "map" ] -ProcessToComplete += [ "smallbank" ] -ProcessToComplete += [ "farbank" ] -ProcessToComplete += [ "tiles" ] -ProcessToComplete += [ "displace" ] -ProcessToComplete += [ "veget" ] -ProcessToComplete += [ "vegetset" ] -ProcessToComplete += [ "ligo" ] -ProcessToComplete += [ "pacs_prim" ] - - -# *** ECOSYSTEM AND CONTINENT NAMES *** - -EcosystemName = "%PreGenEcosystemName%" -EcosystemPath = "ecosystems/" + EcosystemName -CommonName = EcosystemName -CommonPath = EcosystemPath - - -# *** MAP EXPORT OPTIONS *** -PanoplyFileList = [ ] -HlsBankFileName = "" - -# *** SHAPE EXPORT OPTIONS *** - -# Compute lightmaps ? -ShapeExportOptExportLighting = "%PreGenShapeExportOptExportLighting%" - -# Cast shadow in lightmap ? -ShapeExportOptShadow = "%PreGenShapeExportOptShadow%" - -# Lighting limits. 0 : normal, 1 : soft shadows -ShapeExportOptLightingLimit = %PreGenShapeExportOptLightingLimit% - -# Lightmap lumel size -ShapeExportOptLumelSize = "%PreGenShapeExportOptLumelSize%" - -# Oversampling value. Can be 1, 2, 4 or 8 -ShapeExportOptOversampling = %PreGenShapeExportOptOversampling% - -# Does the lightmap must be generated in 8 bits format ? -ShapeExportOpt8BitsLightmap = "%PreGenShapeExportOpt8BitsLightmap%" - -# Does the lightmaps export must generate logs ? -ShapeExportOptLightmapLog = "%PreGenShapeExportOptLightmapLog%" - -# Coarse mesh texture mul size -TextureMulSizeValue = "%PreGenTextureMulSizeValue%" - -ClodConfigFile = "" - -# *** COARSE MESH TEXTURE NAME *** -CoarseMeshTextureNames = [ ] -%PreGenCoarseMeshTextureNames% -# *** POSTFIX USED BY THE MULTIPLE TILES SYSTEM *** -MultipleTilesPostfix = [ ] -%PreGenMultipleTilesPostfix% -# *** BANK EXPORT OPTIONS *** - -# Name of the tilebank to use -BankTileBankName = EcosystemName - -# *** RBANK EXPORT OPTIONS *** - -# Output names -RbankRbankName = "_invalid" - -# *** LIGO OPTIONS *** - -LigoExportLand = "" -LigoExportOnePass = 0 - -# *** MAPS OPTIONS *** - -ReduceBitmapFactor = 0 -# list all panoply files -MapPanoplyFileList = None -# name of the .hlsbank to build. -MapHlsBankFileName = None - -# *** SHAPE BUILD OPTIONS * - -BuildShadowSkinEnabled = False -ClodConfigFile = "" - -# *** PACS_PRIM OPTIONS *** -WantLandscapeColPrimPacsList = True +#!/usr/bin/python +# +# ################################################################# +# ## %PreGenWarning% +# ################################################################# +# +# \file config.py +# \brief Process configuration +# \date %PreGenDateTimeStamp% +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Process configuration for '%PreGenEcosystemName%' ecosystem. +# +# 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 CONFIGURATION *** + +# *** PROCESS CONFIG *** +ProcessToComplete = [ ] +ProcessToComplete += [ "shape" ] +ProcessToComplete += [ "map" ] +ProcessToComplete += [ "smallbank" ] +ProcessToComplete += [ "farbank" ] +ProcessToComplete += [ "tiles" ] +ProcessToComplete += [ "displace" ] +ProcessToComplete += [ "veget" ] +ProcessToComplete += [ "vegetset" ] +ProcessToComplete += [ "ligo" ] +ProcessToComplete += [ "pacs_prim" ] + + +# *** ECOSYSTEM AND CONTINENT NAMES *** + +EcosystemName = "%PreGenEcosystemName%" +EcosystemPath = "ecosystems/" + EcosystemName +CommonName = EcosystemName +CommonPath = EcosystemPath + + +# *** MAP EXPORT OPTIONS *** +PanoplyFileList = [ ] +HlsBankFileName = "" + +# *** SHAPE EXPORT OPTIONS *** + +# Compute lightmaps ? +ShapeExportOptExportLighting = "%PreGenShapeExportOptExportLighting%" + +# Cast shadow in lightmap ? +ShapeExportOptShadow = "%PreGenShapeExportOptShadow%" + +# Lighting limits. 0 : normal, 1 : soft shadows +ShapeExportOptLightingLimit = %PreGenShapeExportOptLightingLimit% + +# Lightmap lumel size +ShapeExportOptLumelSize = "%PreGenShapeExportOptLumelSize%" + +# Oversampling value. Can be 1, 2, 4 or 8 +ShapeExportOptOversampling = %PreGenShapeExportOptOversampling% + +# Does the lightmap must be generated in 8 bits format ? +ShapeExportOpt8BitsLightmap = "%PreGenShapeExportOpt8BitsLightmap%" + +# Does the lightmaps export must generate logs ? +ShapeExportOptLightmapLog = "%PreGenShapeExportOptLightmapLog%" + +# Coarse mesh texture mul size +TextureMulSizeValue = "%PreGenTextureMulSizeValue%" + +ClodConfigFile = "" + +# *** COARSE MESH TEXTURE NAME *** +CoarseMeshTextureNames = [ ] +%PreGenCoarseMeshTextureNames% +# *** POSTFIX USED BY THE MULTIPLE TILES SYSTEM *** +MultipleTilesPostfix = [ ] +%PreGenMultipleTilesPostfix% +# *** BANK EXPORT OPTIONS *** + +# Name of the tilebank to use +BankTileBankName = EcosystemName + +# *** RBANK EXPORT OPTIONS *** + +# Output names +RbankRbankName = "_invalid" + +# *** LIGO OPTIONS *** + +LigoExportLand = "" +LigoExportOnePass = 0 + +# *** MAPS OPTIONS *** + +ReduceBitmapFactor = 0 +# list all panoply files +MapPanoplyFileList = None +# name of the .hlsbank to build. +MapHlsBankFileName = None + +# *** SHAPE BUILD OPTIONS * + +BuildShadowSkinEnabled = False +ClodConfigFile = "" + +# *** PACS_PRIM OPTIONS *** +WantLandscapeColPrimPacsList = True diff --git a/code/nel/tools/build_gamedata/generators/generate_all.py b/code/nel/tools/build_gamedata/generators/generate_all.py old mode 100755 new mode 100644 index 29060647d..79f22955c --- a/code/nel/tools/build_gamedata/generators/generate_all.py +++ b/code/nel/tools/build_gamedata/generators/generate_all.py @@ -1,65 +1,65 @@ -#!/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 -sys.path.append("../configuration") -if os.path.isfile("generate_all.log"): - os.remove("generate_all.log") -log = open("generate_all.log", "w") -from scripts import * -from buildsite import * -from tools import * - -printLog(log, "") -printLog(log, "-------") -printLog(log, "--- Generate all") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - - -try: - subprocess.call([ "python", "generate_simple_max_exporters.py" ]) -except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) -printLog(log, "") - - -try: - subprocess.call([ "python", "generate_tagged_max_exporters.py" ]) -except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) -printLog(log, "") - - -try: - subprocess.call([ "python", "generate_ecosystem_projects.py" ]) -except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) -printLog(log, "") - - -log.close() +#!/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 +sys.path.append("../configuration") +if os.path.isfile("generate_all.log"): + os.remove("generate_all.log") +log = open("generate_all.log", "w") +from scripts import * +from buildsite import * +from tools import * + +printLog(log, "") +printLog(log, "-------") +printLog(log, "--- Generate all") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + + +try: + subprocess.call([ "python", "generate_simple_max_exporters.py" ]) +except Exception, e: + printLog(log, "<" + processName + "> " + str(e)) +printLog(log, "") + + +try: + subprocess.call([ "python", "generate_tagged_max_exporters.py" ]) +except Exception, e: + printLog(log, "<" + processName + "> " + str(e)) +printLog(log, "") + + +try: + subprocess.call([ "python", "generate_ecosystem_projects.py" ]) +except Exception, e: + printLog(log, "<" + processName + "> " + str(e)) +printLog(log, "") + + +log.close() diff --git a/code/nel/tools/build_gamedata/generators/generate_ecosystem_projects.py b/code/nel/tools/build_gamedata/generators/generate_ecosystem_projects.py old mode 100755 new mode 100644 index 0f71f615b..3ad5f741b --- a/code/nel/tools/build_gamedata/generators/generate_ecosystem_projects.py +++ b/code/nel/tools/build_gamedata/generators/generate_ecosystem_projects.py @@ -1,278 +1,278 @@ -#!/usr/bin/python -# -# \file generate_ecosystem_projects.py -# \brief Run all setup processes -# \date 2010-09-02 10:36GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Generate ecosystem projects -# -# 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("generate_ecosystem_projects.log"): - os.remove("generate_ecosystem_projects.log") -log = open("generate_ecosystem_projects.log", "w") -from scripts import * -from buildsite import * -from tools import * - -printLog(log, "") -printLog(log, "-------") -printLog(log, "--- Generate ecosystem projects") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -templateDir = os.getcwd().replace("\\", "/") + "/ecosystem_project_template" -mkPath(log, templateDir) - -os.chdir("..") - - -# Scroll down to add an ecosystem. - - - -DefaultShapeExportOptExportLighting = "true" -DefaultShapeExportOptShadow = "true" -DefaultShapeExportOptLightingLimit = "1" -DefaultShapeExportOptLumelSize = "0.25" -DefaultShapeExportOptOversampling = "1" -DefaultShapeExportOpt8BitsLightmap = "true" -DefaultShapeExportOptLightmapLog = "true" -DefaultTextureMulSizeValue = "1.5" -DefaultSeasonSuffixes = [ "sp" ] + [ "su" ] + [ "au" ] + [ "wi" ] -DefaultMapSubdirectories = [ ] -DefaultTileDirectories = [ ] - - -ShapeExportOptExportLighting = DefaultShapeExportOptExportLighting -ShapeExportOptShadow = DefaultShapeExportOptShadow -ShapeExportOptLightingLimit = DefaultShapeExportOptLightingLimit -ShapeExportOptLumelSize = DefaultShapeExportOptLumelSize -ShapeExportOptOversampling = DefaultShapeExportOptOversampling -ShapeExportOpt8BitsLightmap = DefaultShapeExportOpt8BitsLightmap -ShapeExportOptLightmapLog = DefaultShapeExportOptLightmapLog -TextureMulSizeValue = DefaultTextureMulSizeValue -SeasonSuffixes = DefaultSeasonSuffixes -MapSubdirectories = DefaultMapSubdirectories -TileDirectories = DefaultTileDirectories - - -PreGenDateTimeStamp = None -PreGenEcosystemName = None -PreGenDatabaseRootName = None -PreGenCoarseMeshTextureNames = None -PreGenMultipleTilesPostfix = None -PreGenMapSubdirectories = None -PreGenTileSourceDirectories = None - - -def transformLine(line): - newline = line.replace("%PreGenWarning%", "WARNING : this is a generated file, don't change it !") - newline = newline.replace("%PreGenDateTimeStamp%", PreGenDateTimeStamp) - - newline = newline.replace("%PreGenEcosystemName%", PreGenEcosystemName) - newline = newline.replace("%PreGenDatabaseRootName%", PreGenDatabaseRootName) - - newline = newline.replace("%PreGenCoarseMeshTextureNames%", PreGenCoarseMeshTextureNames) - newline = newline.replace("%PreGenMultipleTilesPostfix%", PreGenMultipleTilesPostfix) - newline = newline.replace("%PreGenMapSubdirectories%", PreGenMapSubdirectories) - newline = newline.replace("%PreGenTileSourceDirectories%", PreGenTileSourceDirectories) - - newline = newline.replace("%PreGenShapeExportOptExportLighting%", ShapeExportOptExportLighting) - newline = newline.replace("%PreGenShapeExportOptShadow%", ShapeExportOptShadow) - newline = newline.replace("%PreGenShapeExportOptLightingLimit%", ShapeExportOptLightingLimit) - newline = newline.replace("%PreGenShapeExportOptLumelSize%", ShapeExportOptLumelSize) - newline = newline.replace("%PreGenShapeExportOptOversampling%", ShapeExportOptOversampling) - newline = newline.replace("%PreGenShapeExportOpt8BitsLightmap%", ShapeExportOpt8BitsLightmap) - newline = newline.replace("%PreGenShapeExportOptLightmapLog%", ShapeExportOptLightmapLog) - newline = newline.replace("%PreGenTextureMulSizeValue%", TextureMulSizeValue) - newline = newline.replace("%PreGenTileSourceDirectories%", PreGenTileSourceDirectories) - - return newline - -def generateFile(sourceFile, destFile): - srcf = open(sourceFile, "r") - dstf = open(destFile, "w") - printLog(log, "WRITE " + destFile) - for line in srcf: - dstf.write(transformLine(line)) - dstf.close() - srcf.close() - -def generateEcosystem(ecosystemName, databaseRootName): - global PreGenEcosystemName - PreGenEcosystemName = ecosystemName - global PreGenDatabaseRootName - PreGenDatabaseRootName = databaseRootName - global PreGenDateTimeStamp - PreGenDateTimeStamp = time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) - - global PreGenMultipleTilesPostfix - PreGenMultipleTilesPostfix = "" - global PreGenCoarseMeshTextureNames - PreGenCoarseMeshTextureNames = "" - global PreGenTileSourceDirectories - PreGenTileSourceDirectories = "" - for suffix in SeasonSuffixes: - PreGenMultipleTilesPostfix += "MultipleTilesPostfix += [ \"_" + suffix + "\" ]\n" - PreGenCoarseMeshTextureNames += "CoarseMeshTextureNames += [ \"nel_coarse_mesh_\" + EcosystemName + \"_" + suffix + "\" ]\n" - for tiledir in TileDirectories: - PreGenTileSourceDirectories += "TilesSourceDirectories += [ \"landscape/_texture_tiles/\" + EcosystemName + \"_" + suffix + "/" + tiledir + "\" ]\n" - global PreGenMapSubdirectories - PreGenMapSubdirectories = "" - for subdir in MapSubdirectories: - PreGenMapSubdirectories += "MapSourceDirectories += [ DatabaseRootPath + \"/decors/_textures/" + subdir + "\" ]\n" - - destDir = WorkspaceDirectory + "/ecosystems/" + ecosystemName - mkPath(log, destDir) - - generateFile(templateDir + "/process.py", destDir + "/process.py") - generateFile(templateDir + "/directories.py", destDir + "/directories.py") - - return - - - -# Add new ecosystems below this line. - - - -# DESERT -ShapeExportOptExportLighting = DefaultShapeExportOptExportLighting -ShapeExportOptShadow = DefaultShapeExportOptShadow -ShapeExportOptLightingLimit = DefaultShapeExportOptLightingLimit -ShapeExportOptLumelSize = DefaultShapeExportOptLumelSize -ShapeExportOptOversampling = DefaultShapeExportOptOversampling -ShapeExportOpt8BitsLightmap = DefaultShapeExportOpt8BitsLightmap -ShapeExportOptLightmapLog = DefaultShapeExportOptLightmapLog -TextureMulSizeValue = DefaultTextureMulSizeValue -SeasonSuffixes = DefaultSeasonSuffixes -MapSubdirectories = [ ] -MapSubdirectories += [ "vegetations" ] -TileDirectories = [ ] -TileDirectories += [ "1.5-marecage_profond" ] -TileDirectories += [ "1-marecages" ] -TileDirectories += [ "2-citees" ] -TileDirectories += [ "3-fond_canyon" ] -TileDirectories += [ "4.2-boisbandeclair" ] -TileDirectories += [ "4.5-desert2boisbande" ] -TileDirectories += [ "4-falaise_bois_bande" ] -TileDirectories += [ "5-falaise_normales" ] -TileDirectories += [ "6.5-desertalternatif" ] -TileDirectories += [ "6-desert" ] -TileDirectories += [ "7-routes" ] -TileDirectories += [ "8-foretbrule" ] -generateEcosystem("desert", "fyros") - - -# JUNGLE -ShapeExportOptExportLighting = DefaultShapeExportOptExportLighting -ShapeExportOptShadow = DefaultShapeExportOptShadow -ShapeExportOptLightingLimit = DefaultShapeExportOptLightingLimit -ShapeExportOptLumelSize = DefaultShapeExportOptLumelSize -ShapeExportOptOversampling = DefaultShapeExportOptOversampling -ShapeExportOpt8BitsLightmap = "false" -ShapeExportOptLightmapLog = DefaultShapeExportOptLightmapLog -TextureMulSizeValue = DefaultTextureMulSizeValue -SeasonSuffixes = DefaultSeasonSuffixes -MapSubdirectories = [ ] -MapSubdirectories += [ "vegetations" ] -TileDirectories = [ ] -TileDirectories += [ "10-crevassejungle" ] -TileDirectories += [ "11-paroisjungle" ] -TileDirectories += [ "12-vasejungle" ] -TileDirectories += [ "1-junglemousse" ] -TileDirectories += [ "2-junglefeuilles" ] -TileDirectories += [ "3-jungleherbesseche" ] -TileDirectories += [ "4-jungleherbevieille" ] -TileDirectories += [ "5-jungleterreaux" ] -TileDirectories += [ "6-junglegoo" ] -TileDirectories += [ "7-sciurejungle" ] -TileDirectories += [ "8-terrejungle" ] -TileDirectories += [ "9-falaisejungle" ] -TileDirectories += [ "Transitions" ] -generateEcosystem("jungle", "jungle") - - -# PRIMES RACINES -ShapeExportOptExportLighting = DefaultShapeExportOptExportLighting -ShapeExportOptShadow = DefaultShapeExportOptShadow -ShapeExportOptLightingLimit = DefaultShapeExportOptLightingLimit -ShapeExportOptLumelSize = DefaultShapeExportOptLumelSize -ShapeExportOptOversampling = DefaultShapeExportOptOversampling -ShapeExportOpt8BitsLightmap = "false" -ShapeExportOptLightmapLog = DefaultShapeExportOptLightmapLog -TextureMulSizeValue = DefaultTextureMulSizeValue -SeasonSuffixes = DefaultSeasonSuffixes -MapSubdirectories = [ ] -MapSubdirectories += [ "vegetations" ] -MapSubdirectories += [ "batiments" ] -TileDirectories = [ ] -TileDirectories += [ "PR-creux" ] -TileDirectories += [ "PR-dome-moussu" ] -TileDirectories += [ "PR-kitiniere" ] -TileDirectories += [ "PR-mousse-licken" ] -TileDirectories += [ "PR-mousse-spongieus" ] -TileDirectories += [ "PR-parois" ] -TileDirectories += [ "PR-sol-mousse" ] -TileDirectories += [ "PR-souche" ] -TileDirectories += [ "PR-stalagmite" ] -TileDirectories += [ "PR-terre" ] -TileDirectories += [ "aditif" ] -generateEcosystem("primes_racines", "primes_racines") - - -# LACUSTRE -ShapeExportOptExportLighting = DefaultShapeExportOptExportLighting -ShapeExportOptShadow = DefaultShapeExportOptShadow -ShapeExportOptLightingLimit = "0" -ShapeExportOptLumelSize = DefaultShapeExportOptLumelSize -ShapeExportOptOversampling = "8" -ShapeExportOpt8BitsLightmap = "false" -ShapeExportOptLightmapLog = DefaultShapeExportOptLightmapLog -TextureMulSizeValue = DefaultTextureMulSizeValue -SeasonSuffixes = DefaultSeasonSuffixes -MapSubdirectories = [ ] -MapSubdirectories += [ "vegetations" ] -TileDirectories = [ ] -TileDirectories += [ "1a-sable-marin" ] -TileDirectories += [ "1-plages" ] -TileDirectories += [ "2-iles" ] -TileDirectories += [ "2-ilesa" ] -TileDirectories += [ "2-iles-marines" ] -TileDirectories += [ "3-fondmarin2plage" ] -TileDirectories += [ "4-marecages" ] -TileDirectories += [ "5-marecages" ] -TileDirectories += [ "5-parois-marine" ] -TileDirectories += [ "6-fond_marin" ] -TileDirectories += [ "7-bassesiles" ] -TileDirectories += [ "7-mousseter" ] -TileDirectories += [ "7-racines" ] -TileDirectories += [ "8-mousse_marine" ] -TileDirectories += [ "constructible" ] -generateEcosystem("lacustre", "tryker") - - - - -printLog(log, "") -log.close() +#!/usr/bin/python +# +# \file generate_ecosystem_projects.py +# \brief Run all setup processes +# \date 2010-09-02 10:36GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Generate ecosystem projects +# +# 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("generate_ecosystem_projects.log"): + os.remove("generate_ecosystem_projects.log") +log = open("generate_ecosystem_projects.log", "w") +from scripts import * +from buildsite import * +from tools import * + +printLog(log, "") +printLog(log, "-------") +printLog(log, "--- Generate ecosystem projects") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +templateDir = os.getcwd().replace("\\", "/") + "/ecosystem_project_template" +mkPath(log, templateDir) + +os.chdir("..") + + +# Scroll down to add an ecosystem. + + + +DefaultShapeExportOptExportLighting = "true" +DefaultShapeExportOptShadow = "true" +DefaultShapeExportOptLightingLimit = "1" +DefaultShapeExportOptLumelSize = "0.25" +DefaultShapeExportOptOversampling = "1" +DefaultShapeExportOpt8BitsLightmap = "true" +DefaultShapeExportOptLightmapLog = "true" +DefaultTextureMulSizeValue = "1.5" +DefaultSeasonSuffixes = [ "sp" ] + [ "su" ] + [ "au" ] + [ "wi" ] +DefaultMapSubdirectories = [ ] +DefaultTileDirectories = [ ] + + +ShapeExportOptExportLighting = DefaultShapeExportOptExportLighting +ShapeExportOptShadow = DefaultShapeExportOptShadow +ShapeExportOptLightingLimit = DefaultShapeExportOptLightingLimit +ShapeExportOptLumelSize = DefaultShapeExportOptLumelSize +ShapeExportOptOversampling = DefaultShapeExportOptOversampling +ShapeExportOpt8BitsLightmap = DefaultShapeExportOpt8BitsLightmap +ShapeExportOptLightmapLog = DefaultShapeExportOptLightmapLog +TextureMulSizeValue = DefaultTextureMulSizeValue +SeasonSuffixes = DefaultSeasonSuffixes +MapSubdirectories = DefaultMapSubdirectories +TileDirectories = DefaultTileDirectories + + +PreGenDateTimeStamp = None +PreGenEcosystemName = None +PreGenDatabaseRootName = None +PreGenCoarseMeshTextureNames = None +PreGenMultipleTilesPostfix = None +PreGenMapSubdirectories = None +PreGenTileSourceDirectories = None + + +def transformLine(line): + newline = line.replace("%PreGenWarning%", "WARNING : this is a generated file, don't change it !") + newline = newline.replace("%PreGenDateTimeStamp%", PreGenDateTimeStamp) + + newline = newline.replace("%PreGenEcosystemName%", PreGenEcosystemName) + newline = newline.replace("%PreGenDatabaseRootName%", PreGenDatabaseRootName) + + newline = newline.replace("%PreGenCoarseMeshTextureNames%", PreGenCoarseMeshTextureNames) + newline = newline.replace("%PreGenMultipleTilesPostfix%", PreGenMultipleTilesPostfix) + newline = newline.replace("%PreGenMapSubdirectories%", PreGenMapSubdirectories) + newline = newline.replace("%PreGenTileSourceDirectories%", PreGenTileSourceDirectories) + + newline = newline.replace("%PreGenShapeExportOptExportLighting%", ShapeExportOptExportLighting) + newline = newline.replace("%PreGenShapeExportOptShadow%", ShapeExportOptShadow) + newline = newline.replace("%PreGenShapeExportOptLightingLimit%", ShapeExportOptLightingLimit) + newline = newline.replace("%PreGenShapeExportOptLumelSize%", ShapeExportOptLumelSize) + newline = newline.replace("%PreGenShapeExportOptOversampling%", ShapeExportOptOversampling) + newline = newline.replace("%PreGenShapeExportOpt8BitsLightmap%", ShapeExportOpt8BitsLightmap) + newline = newline.replace("%PreGenShapeExportOptLightmapLog%", ShapeExportOptLightmapLog) + newline = newline.replace("%PreGenTextureMulSizeValue%", TextureMulSizeValue) + newline = newline.replace("%PreGenTileSourceDirectories%", PreGenTileSourceDirectories) + + return newline + +def generateFile(sourceFile, destFile): + srcf = open(sourceFile, "r") + dstf = open(destFile, "w") + printLog(log, "WRITE " + destFile) + for line in srcf: + dstf.write(transformLine(line)) + dstf.close() + srcf.close() + +def generateEcosystem(ecosystemName, databaseRootName): + global PreGenEcosystemName + PreGenEcosystemName = ecosystemName + global PreGenDatabaseRootName + PreGenDatabaseRootName = databaseRootName + global PreGenDateTimeStamp + PreGenDateTimeStamp = time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + + global PreGenMultipleTilesPostfix + PreGenMultipleTilesPostfix = "" + global PreGenCoarseMeshTextureNames + PreGenCoarseMeshTextureNames = "" + global PreGenTileSourceDirectories + PreGenTileSourceDirectories = "" + for suffix in SeasonSuffixes: + PreGenMultipleTilesPostfix += "MultipleTilesPostfix += [ \"_" + suffix + "\" ]\n" + PreGenCoarseMeshTextureNames += "CoarseMeshTextureNames += [ \"nel_coarse_mesh_\" + EcosystemName + \"_" + suffix + "\" ]\n" + for tiledir in TileDirectories: + PreGenTileSourceDirectories += "TilesSourceDirectories += [ \"landscape/_texture_tiles/\" + EcosystemName + \"_" + suffix + "/" + tiledir + "\" ]\n" + global PreGenMapSubdirectories + PreGenMapSubdirectories = "" + for subdir in MapSubdirectories: + PreGenMapSubdirectories += "MapSourceDirectories += [ DatabaseRootPath + \"/decors/_textures/" + subdir + "\" ]\n" + + destDir = WorkspaceDirectory + "/ecosystems/" + ecosystemName + mkPath(log, destDir) + + generateFile(templateDir + "/process.py", destDir + "/process.py") + generateFile(templateDir + "/directories.py", destDir + "/directories.py") + + return + + + +# Add new ecosystems below this line. + + + +# DESERT +ShapeExportOptExportLighting = DefaultShapeExportOptExportLighting +ShapeExportOptShadow = DefaultShapeExportOptShadow +ShapeExportOptLightingLimit = DefaultShapeExportOptLightingLimit +ShapeExportOptLumelSize = DefaultShapeExportOptLumelSize +ShapeExportOptOversampling = DefaultShapeExportOptOversampling +ShapeExportOpt8BitsLightmap = DefaultShapeExportOpt8BitsLightmap +ShapeExportOptLightmapLog = DefaultShapeExportOptLightmapLog +TextureMulSizeValue = DefaultTextureMulSizeValue +SeasonSuffixes = DefaultSeasonSuffixes +MapSubdirectories = [ ] +MapSubdirectories += [ "vegetations" ] +TileDirectories = [ ] +TileDirectories += [ "1.5-marecage_profond" ] +TileDirectories += [ "1-marecages" ] +TileDirectories += [ "2-citees" ] +TileDirectories += [ "3-fond_canyon" ] +TileDirectories += [ "4.2-boisbandeclair" ] +TileDirectories += [ "4.5-desert2boisbande" ] +TileDirectories += [ "4-falaise_bois_bande" ] +TileDirectories += [ "5-falaise_normales" ] +TileDirectories += [ "6.5-desertalternatif" ] +TileDirectories += [ "6-desert" ] +TileDirectories += [ "7-routes" ] +TileDirectories += [ "8-foretbrule" ] +generateEcosystem("desert", "fyros") + + +# JUNGLE +ShapeExportOptExportLighting = DefaultShapeExportOptExportLighting +ShapeExportOptShadow = DefaultShapeExportOptShadow +ShapeExportOptLightingLimit = DefaultShapeExportOptLightingLimit +ShapeExportOptLumelSize = DefaultShapeExportOptLumelSize +ShapeExportOptOversampling = DefaultShapeExportOptOversampling +ShapeExportOpt8BitsLightmap = "false" +ShapeExportOptLightmapLog = DefaultShapeExportOptLightmapLog +TextureMulSizeValue = DefaultTextureMulSizeValue +SeasonSuffixes = DefaultSeasonSuffixes +MapSubdirectories = [ ] +MapSubdirectories += [ "vegetations" ] +TileDirectories = [ ] +TileDirectories += [ "10-crevassejungle" ] +TileDirectories += [ "11-paroisjungle" ] +TileDirectories += [ "12-vasejungle" ] +TileDirectories += [ "1-junglemousse" ] +TileDirectories += [ "2-junglefeuilles" ] +TileDirectories += [ "3-jungleherbesseche" ] +TileDirectories += [ "4-jungleherbevieille" ] +TileDirectories += [ "5-jungleterreaux" ] +TileDirectories += [ "6-junglegoo" ] +TileDirectories += [ "7-sciurejungle" ] +TileDirectories += [ "8-terrejungle" ] +TileDirectories += [ "9-falaisejungle" ] +TileDirectories += [ "Transitions" ] +generateEcosystem("jungle", "jungle") + + +# PRIMES RACINES +ShapeExportOptExportLighting = DefaultShapeExportOptExportLighting +ShapeExportOptShadow = DefaultShapeExportOptShadow +ShapeExportOptLightingLimit = DefaultShapeExportOptLightingLimit +ShapeExportOptLumelSize = DefaultShapeExportOptLumelSize +ShapeExportOptOversampling = DefaultShapeExportOptOversampling +ShapeExportOpt8BitsLightmap = "false" +ShapeExportOptLightmapLog = DefaultShapeExportOptLightmapLog +TextureMulSizeValue = DefaultTextureMulSizeValue +SeasonSuffixes = DefaultSeasonSuffixes +MapSubdirectories = [ ] +MapSubdirectories += [ "vegetations" ] +MapSubdirectories += [ "batiments" ] +TileDirectories = [ ] +TileDirectories += [ "PR-creux" ] +TileDirectories += [ "PR-dome-moussu" ] +TileDirectories += [ "PR-kitiniere" ] +TileDirectories += [ "PR-mousse-licken" ] +TileDirectories += [ "PR-mousse-spongieus" ] +TileDirectories += [ "PR-parois" ] +TileDirectories += [ "PR-sol-mousse" ] +TileDirectories += [ "PR-souche" ] +TileDirectories += [ "PR-stalagmite" ] +TileDirectories += [ "PR-terre" ] +TileDirectories += [ "aditif" ] +generateEcosystem("primes_racines", "primes_racines") + + +# LACUSTRE +ShapeExportOptExportLighting = DefaultShapeExportOptExportLighting +ShapeExportOptShadow = DefaultShapeExportOptShadow +ShapeExportOptLightingLimit = "0" +ShapeExportOptLumelSize = DefaultShapeExportOptLumelSize +ShapeExportOptOversampling = "8" +ShapeExportOpt8BitsLightmap = "false" +ShapeExportOptLightmapLog = DefaultShapeExportOptLightmapLog +TextureMulSizeValue = DefaultTextureMulSizeValue +SeasonSuffixes = DefaultSeasonSuffixes +MapSubdirectories = [ ] +MapSubdirectories += [ "vegetations" ] +TileDirectories = [ ] +TileDirectories += [ "1a-sable-marin" ] +TileDirectories += [ "1-plages" ] +TileDirectories += [ "2-iles" ] +TileDirectories += [ "2-ilesa" ] +TileDirectories += [ "2-iles-marines" ] +TileDirectories += [ "3-fondmarin2plage" ] +TileDirectories += [ "4-marecages" ] +TileDirectories += [ "5-marecages" ] +TileDirectories += [ "5-parois-marine" ] +TileDirectories += [ "6-fond_marin" ] +TileDirectories += [ "7-bassesiles" ] +TileDirectories += [ "7-mousseter" ] +TileDirectories += [ "7-racines" ] +TileDirectories += [ "8-mousse_marine" ] +TileDirectories += [ "constructible" ] +generateEcosystem("lacustre", "tryker") + + + + +printLog(log, "") +log.close() diff --git a/code/nel/tools/build_gamedata/generators/generate_simple_max_exporters.py b/code/nel/tools/build_gamedata/generators/generate_simple_max_exporters.py old mode 100755 new mode 100644 index be4867840..4706dcdfd --- a/code/nel/tools/build_gamedata/generators/generate_simple_max_exporters.py +++ b/code/nel/tools/build_gamedata/generators/generate_simple_max_exporters.py @@ -1,100 +1,100 @@ -#!/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 -sys.path.append("../configuration") -if os.path.isfile("generate_simple_max_exporters.log"): - os.remove("generate_simple_max_exporters.log") -log = open("generate_simple_max_exporters.log", "w") -from scripts import * -from buildsite import * -from tools import * - -printLog(log, "") -printLog(log, "-------") -printLog(log, "--- Generate simple max exporters") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -def processLine(line, processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, clientDirectoryVariable, dateTimeStamp): - newline = line.replace("%PreGenWarning%", "WARNING : this is a generated file, don't change it !") - newline = newline.replace("%PreGenDateTimeStamp%", dateTimeStamp) - newline = newline.replace("%PreGenProcessName%", processName) - newline = newline.replace("%PreGenFileExtension%", fileExtension) - newline = newline.replace("%PreGenSourceDirectoriesVariable%", sourceDirectoriesVariable) - newline = newline.replace("%PreGenExportDirectoryVariable%", exportDirectoryVariable) - newline = newline.replace("%PreGenInstallDirectoryVariable%", clientDirectoryVariable) - return newline - -def generateSimpleMaxExporterFile(sourceFile, destFile, writeMode, processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, clientDirectoryVariable, dateTimeStamp): - srcf = open(sourceFile, "r") - dstf = open(destFile, writeMode) - printLog(log, "WRITE " + destFile + " " + writeMode) - for line in srcf: - dstf.write(processLine(line, processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, clientDirectoryVariable, dateTimeStamp)) - dstf.close() - srcf.close() - -def generateSimpleMaxExporter(processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, clientDirectoryVariable): - dateTimeStamp = time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) - processDir = ScriptDirectory + "/processes/" + processName - mkPath(log, processDir) - maxscriptDir = processDir + "/maxscript" - mkPath(log, maxscriptDir) - templateDir = os.getcwd().replace("\\", "/") + "/simple_max_exporter_template" - mkPath(log, templateDir) - scriptDir = os.getcwd().replace("\\", "/") + "/max_exporter_scripts" - mkPath(log, scriptDir) - - if not os.path.isfile(processDir + "/0_setup.py"): - generateSimpleMaxExporterFile(templateDir + "/0_setup.py", processDir + "/0_setup.py", "w", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) - - generateSimpleMaxExporterFile(templateDir + "/1_export_header.py", processDir + "/1_export.py", "w", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) - generateSimpleMaxExporterFile(scriptDir + "/" + fileExtension + ".py", processDir + "/1_export.py", "a", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) - generateSimpleMaxExporterFile(templateDir + "/1_export_footer.py", processDir + "/1_export.py", "a", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) - - if not os.path.isfile(processDir + "/2_build.py"): - generateSimpleMaxExporterFile(templateDir + "/2_build.py", processDir + "/2_build.py", "w", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) - if not os.path.isfile(processDir + "/3_install.py"): - generateSimpleMaxExporterFile(templateDir + "/3_install.py", processDir + "/3_install.py", "w", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) - - generateSimpleMaxExporterFile(templateDir + "/export_header.ms", maxscriptDir + "/" + fileExtension + "_export.ms", "w", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) - generateSimpleMaxExporterFile(scriptDir + "/" + fileExtension + ".ms", maxscriptDir + "/" + fileExtension + "_export.ms", "a", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) - generateSimpleMaxExporterFile(templateDir + "/export_footer.ms", maxscriptDir + "/" + fileExtension + "_export.ms", "a", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) - - - -generateSimpleMaxExporter("skel", "skel", "SkelSourceDirectories", "SkelExportDirectory", "SkelInstallDirectory") - -generateSimpleMaxExporter("swt", "swt", "SwtSourceDirectories", "SwtExportDirectory", "SwtInstallDirectory") - -generateSimpleMaxExporter("zone", "zone", "ZoneSourceDirectory", "ZoneExportDirectory", "ZoneInstallDirectory") - - - -printLog(log, "") -log.close() +#!/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 +sys.path.append("../configuration") +if os.path.isfile("generate_simple_max_exporters.log"): + os.remove("generate_simple_max_exporters.log") +log = open("generate_simple_max_exporters.log", "w") +from scripts import * +from buildsite import * +from tools import * + +printLog(log, "") +printLog(log, "-------") +printLog(log, "--- Generate simple max exporters") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +def processLine(line, processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, clientDirectoryVariable, dateTimeStamp): + newline = line.replace("%PreGenWarning%", "WARNING : this is a generated file, don't change it !") + newline = newline.replace("%PreGenDateTimeStamp%", dateTimeStamp) + newline = newline.replace("%PreGenProcessName%", processName) + newline = newline.replace("%PreGenFileExtension%", fileExtension) + newline = newline.replace("%PreGenSourceDirectoriesVariable%", sourceDirectoriesVariable) + newline = newline.replace("%PreGenExportDirectoryVariable%", exportDirectoryVariable) + newline = newline.replace("%PreGenInstallDirectoryVariable%", clientDirectoryVariable) + return newline + +def generateSimpleMaxExporterFile(sourceFile, destFile, writeMode, processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, clientDirectoryVariable, dateTimeStamp): + srcf = open(sourceFile, "r") + dstf = open(destFile, writeMode) + printLog(log, "WRITE " + destFile + " " + writeMode) + for line in srcf: + dstf.write(processLine(line, processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, clientDirectoryVariable, dateTimeStamp)) + dstf.close() + srcf.close() + +def generateSimpleMaxExporter(processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, clientDirectoryVariable): + dateTimeStamp = time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + processDir = ScriptDirectory + "/processes/" + processName + mkPath(log, processDir) + maxscriptDir = processDir + "/maxscript" + mkPath(log, maxscriptDir) + templateDir = os.getcwd().replace("\\", "/") + "/simple_max_exporter_template" + mkPath(log, templateDir) + scriptDir = os.getcwd().replace("\\", "/") + "/max_exporter_scripts" + mkPath(log, scriptDir) + + if not os.path.isfile(processDir + "/0_setup.py"): + generateSimpleMaxExporterFile(templateDir + "/0_setup.py", processDir + "/0_setup.py", "w", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) + + generateSimpleMaxExporterFile(templateDir + "/1_export_header.py", processDir + "/1_export.py", "w", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) + generateSimpleMaxExporterFile(scriptDir + "/" + fileExtension + ".py", processDir + "/1_export.py", "a", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) + generateSimpleMaxExporterFile(templateDir + "/1_export_footer.py", processDir + "/1_export.py", "a", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) + + if not os.path.isfile(processDir + "/2_build.py"): + generateSimpleMaxExporterFile(templateDir + "/2_build.py", processDir + "/2_build.py", "w", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) + if not os.path.isfile(processDir + "/3_install.py"): + generateSimpleMaxExporterFile(templateDir + "/3_install.py", processDir + "/3_install.py", "w", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) + + generateSimpleMaxExporterFile(templateDir + "/export_header.ms", maxscriptDir + "/" + fileExtension + "_export.ms", "w", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) + generateSimpleMaxExporterFile(scriptDir + "/" + fileExtension + ".ms", maxscriptDir + "/" + fileExtension + "_export.ms", "a", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) + generateSimpleMaxExporterFile(templateDir + "/export_footer.ms", maxscriptDir + "/" + fileExtension + "_export.ms", "a", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) + + + +generateSimpleMaxExporter("skel", "skel", "SkelSourceDirectories", "SkelExportDirectory", "SkelInstallDirectory") + +generateSimpleMaxExporter("swt", "swt", "SwtSourceDirectories", "SwtExportDirectory", "SwtInstallDirectory") + +generateSimpleMaxExporter("zone", "zone", "ZoneSourceDirectory", "ZoneExportDirectory", "ZoneInstallDirectory") + + + +printLog(log, "") +log.close() diff --git a/code/nel/tools/build_gamedata/generators/generate_tagged_max_exporters.py b/code/nel/tools/build_gamedata/generators/generate_tagged_max_exporters.py old mode 100755 new mode 100644 index 99f8cba83..6244984d2 --- a/code/nel/tools/build_gamedata/generators/generate_tagged_max_exporters.py +++ b/code/nel/tools/build_gamedata/generators/generate_tagged_max_exporters.py @@ -1,120 +1,120 @@ -#!/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 -sys.path.append("../configuration") -if os.path.isfile("generate_tagged_max_exporters.log"): - os.remove("generate_tagged_max_exporters.log") -log = open("generate_tagged_max_exporters.log", "w") -from scripts import * -from buildsite import * -from tools import * - -printLog(log, "") -printLog(log, "-------") -printLog(log, "--- Generate tagged max exporters") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -templateDir = os.getcwd().replace("\\", "/") + "/tagged_max_exporter_template" -mkPath(log, templateDir) -scriptDir = os.getcwd().replace("\\", "/") + "/max_exporter_scripts" -mkPath(log, scriptDir) - -def processLine(line, processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, tagExportDirectoryVariable, clientDirectoryVariable, dateTimeStamp): - newline = line.replace("%PreGenWarning%", "WARNING : this is a generated file, don't change it !") - newline = newline.replace("%PreGenDateTimeStamp%", dateTimeStamp) - newline = newline.replace("%PreGenProcessName%", processName) - newline = newline.replace("%PreGenFileExtension%", fileExtension) - newline = newline.replace("%PreGenSourceDirectoriesVariable%", sourceDirectoriesVariable) - newline = newline.replace("%PreGenExportDirectoryVariable%", exportDirectoryVariable) - newline = newline.replace("%PreGenTagExportDirectoryVariable%", tagExportDirectoryVariable) - newline = newline.replace("%PreGenInstallDirectoryVariable%", clientDirectoryVariable) - return newline - -def generateTaggedMaxExporterFile(sourceFile, destFile, writeMode, processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, tagExportDirectoryVariable, clientDirectoryVariable, dateTimeStamp): - srcf = open(sourceFile, "r") - dstf = open(destFile, writeMode) - printLog(log, "WRITE " + destFile + " " + writeMode) - for line in srcf: - dstf.write(processLine(line, processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, tagExportDirectoryVariable, clientDirectoryVariable, dateTimeStamp)) - dstf.close() - srcf.close() - -def generateTaggedMaxScriptFile(processDir, processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, tagExportDirectoryVariable, clientDirectoryVariable, dateTimeStamp): - maxscriptDir = processDir + "/maxscript" - mkPath(log, maxscriptDir) - generateTaggedMaxExporterFile(templateDir + "/export_header.ms", maxscriptDir + "/" + fileExtension + "_export.ms", "w", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, tagExportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) - generateTaggedMaxExporterFile(scriptDir + "/" + fileExtension + ".ms", maxscriptDir + "/" + fileExtension + "_export.ms", "a", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, tagExportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) - generateTaggedMaxExporterFile(templateDir + "/export_footer.ms", maxscriptDir + "/" + fileExtension + "_export.ms", "a", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, tagExportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) - -def generateTaggedMaxScript(processName, fileExtension): - dateTimeStamp = time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) - processDir = ScriptDirectory + "/processes/" + processName - mkPath(log, processDir) - - generateTaggedMaxScriptFile(processDir, processName, fileExtension, "_invalid", "_invalid", "_invalid", "_invalid", dateTimeStamp) - -def generateTaggedMaxExporter(processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, tagExportDirectoryVariable, clientDirectoryVariable): - dateTimeStamp = time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) - processDir = ScriptDirectory + "/processes/" + processName - mkPath(log, processDir) - - if not os.path.isfile(processDir + "/0_setup.py"): - generateTaggedMaxExporterFile(templateDir + "/0_setup.py", processDir + "/0_setup.py", "w", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, tagExportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) - - generateTaggedMaxExporterFile(templateDir + "/1_export_header.py", processDir + "/1_export.py", "w", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, tagExportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) - generateTaggedMaxExporterFile(scriptDir + "/" + fileExtension + ".py", processDir + "/1_export.py", "a", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, tagExportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) - generateTaggedMaxExporterFile(templateDir + "/1_export_footer.py", processDir + "/1_export.py", "a", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, tagExportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) - - if not os.path.isfile(processDir + "/2_build.py"): - generateTaggedMaxExporterFile(templateDir + "/2_build.py", processDir + "/2_build.py", "w", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, tagExportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) - if not os.path.isfile(processDir + "/3_install.py"): - generateTaggedMaxExporterFile(templateDir + "/3_install.py", processDir + "/3_install.py", "w", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, tagExportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) - - generateTaggedMaxScriptFile(processDir, processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, tagExportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) - - - -generateTaggedMaxExporter("pacs_prim", "pacs_prim", "PacsPrimSourceDirectories", "PacsPrimExportDirectory", "PacsPrimTagExportDirectory", "PacsPrimInstallDirectory") - -generateTaggedMaxExporter("clodbank", "clod", "ClodSourceDirectories", "ClodExportDirectory", "ClodTagExportDirectory", "ClodInstallDirectory") - -generateTaggedMaxScript("ig", "ig") - -generateTaggedMaxExporter("rbank", "cmb", "RBankCmbSourceDirectories", "RBankCmbExportDirectory", "RBankCmbTagExportDirectory", "PacsInstallDirectory") - -generateTaggedMaxExporter("veget", "veget", "VegetSourceDirectories", "VegetExportDirectory", "VegetTagExportDirectory", "VegetInstallDirectory") - -generateTaggedMaxScript("shape", "shape") - -generateTaggedMaxExporter("anim", "anim", "AnimSourceDirectories", "AnimExportDirectory", "AnimTagExportDirectory", "AnimInstallDirectory") - - - -printLog(log, "") -log.close() +#!/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 +sys.path.append("../configuration") +if os.path.isfile("generate_tagged_max_exporters.log"): + os.remove("generate_tagged_max_exporters.log") +log = open("generate_tagged_max_exporters.log", "w") +from scripts import * +from buildsite import * +from tools import * + +printLog(log, "") +printLog(log, "-------") +printLog(log, "--- Generate tagged max exporters") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +templateDir = os.getcwd().replace("\\", "/") + "/tagged_max_exporter_template" +mkPath(log, templateDir) +scriptDir = os.getcwd().replace("\\", "/") + "/max_exporter_scripts" +mkPath(log, scriptDir) + +def processLine(line, processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, tagExportDirectoryVariable, clientDirectoryVariable, dateTimeStamp): + newline = line.replace("%PreGenWarning%", "WARNING : this is a generated file, don't change it !") + newline = newline.replace("%PreGenDateTimeStamp%", dateTimeStamp) + newline = newline.replace("%PreGenProcessName%", processName) + newline = newline.replace("%PreGenFileExtension%", fileExtension) + newline = newline.replace("%PreGenSourceDirectoriesVariable%", sourceDirectoriesVariable) + newline = newline.replace("%PreGenExportDirectoryVariable%", exportDirectoryVariable) + newline = newline.replace("%PreGenTagExportDirectoryVariable%", tagExportDirectoryVariable) + newline = newline.replace("%PreGenInstallDirectoryVariable%", clientDirectoryVariable) + return newline + +def generateTaggedMaxExporterFile(sourceFile, destFile, writeMode, processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, tagExportDirectoryVariable, clientDirectoryVariable, dateTimeStamp): + srcf = open(sourceFile, "r") + dstf = open(destFile, writeMode) + printLog(log, "WRITE " + destFile + " " + writeMode) + for line in srcf: + dstf.write(processLine(line, processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, tagExportDirectoryVariable, clientDirectoryVariable, dateTimeStamp)) + dstf.close() + srcf.close() + +def generateTaggedMaxScriptFile(processDir, processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, tagExportDirectoryVariable, clientDirectoryVariable, dateTimeStamp): + maxscriptDir = processDir + "/maxscript" + mkPath(log, maxscriptDir) + generateTaggedMaxExporterFile(templateDir + "/export_header.ms", maxscriptDir + "/" + fileExtension + "_export.ms", "w", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, tagExportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) + generateTaggedMaxExporterFile(scriptDir + "/" + fileExtension + ".ms", maxscriptDir + "/" + fileExtension + "_export.ms", "a", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, tagExportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) + generateTaggedMaxExporterFile(templateDir + "/export_footer.ms", maxscriptDir + "/" + fileExtension + "_export.ms", "a", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, tagExportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) + +def generateTaggedMaxScript(processName, fileExtension): + dateTimeStamp = time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + processDir = ScriptDirectory + "/processes/" + processName + mkPath(log, processDir) + + generateTaggedMaxScriptFile(processDir, processName, fileExtension, "_invalid", "_invalid", "_invalid", "_invalid", dateTimeStamp) + +def generateTaggedMaxExporter(processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, tagExportDirectoryVariable, clientDirectoryVariable): + dateTimeStamp = time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + processDir = ScriptDirectory + "/processes/" + processName + mkPath(log, processDir) + + if not os.path.isfile(processDir + "/0_setup.py"): + generateTaggedMaxExporterFile(templateDir + "/0_setup.py", processDir + "/0_setup.py", "w", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, tagExportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) + + generateTaggedMaxExporterFile(templateDir + "/1_export_header.py", processDir + "/1_export.py", "w", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, tagExportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) + generateTaggedMaxExporterFile(scriptDir + "/" + fileExtension + ".py", processDir + "/1_export.py", "a", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, tagExportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) + generateTaggedMaxExporterFile(templateDir + "/1_export_footer.py", processDir + "/1_export.py", "a", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, tagExportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) + + if not os.path.isfile(processDir + "/2_build.py"): + generateTaggedMaxExporterFile(templateDir + "/2_build.py", processDir + "/2_build.py", "w", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, tagExportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) + if not os.path.isfile(processDir + "/3_install.py"): + generateTaggedMaxExporterFile(templateDir + "/3_install.py", processDir + "/3_install.py", "w", processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, tagExportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) + + generateTaggedMaxScriptFile(processDir, processName, fileExtension, sourceDirectoriesVariable, exportDirectoryVariable, tagExportDirectoryVariable, clientDirectoryVariable, dateTimeStamp) + + + +generateTaggedMaxExporter("pacs_prim", "pacs_prim", "PacsPrimSourceDirectories", "PacsPrimExportDirectory", "PacsPrimTagExportDirectory", "PacsPrimInstallDirectory") + +generateTaggedMaxExporter("clodbank", "clod", "ClodSourceDirectories", "ClodExportDirectory", "ClodTagExportDirectory", "ClodInstallDirectory") + +generateTaggedMaxScript("ig", "ig") + +generateTaggedMaxExporter("rbank", "cmb", "RBankCmbSourceDirectories", "RBankCmbExportDirectory", "RBankCmbTagExportDirectory", "PacsInstallDirectory") + +generateTaggedMaxExporter("veget", "veget", "VegetSourceDirectories", "VegetExportDirectory", "VegetTagExportDirectory", "VegetInstallDirectory") + +generateTaggedMaxScript("shape", "shape") + +generateTaggedMaxExporter("anim", "anim", "AnimSourceDirectories", "AnimExportDirectory", "AnimTagExportDirectory", "AnimInstallDirectory") + + + +printLog(log, "") +log.close() diff --git a/code/nel/tools/build_gamedata/generators/max_exporter_scripts/anim.ms b/code/nel/tools/build_gamedata/generators/max_exporter_scripts/anim.ms old mode 100755 new mode 100644 diff --git a/code/nel/tools/build_gamedata/generators/max_exporter_scripts/anim.py b/code/nel/tools/build_gamedata/generators/max_exporter_scripts/anim.py old mode 100755 new mode 100644 diff --git a/code/nel/tools/build_gamedata/generators/max_exporter_scripts/clod.ms b/code/nel/tools/build_gamedata/generators/max_exporter_scripts/clod.ms old mode 100755 new mode 100644 diff --git a/code/nel/tools/build_gamedata/generators/max_exporter_scripts/clod.py b/code/nel/tools/build_gamedata/generators/max_exporter_scripts/clod.py old mode 100755 new mode 100644 diff --git a/code/nel/tools/build_gamedata/generators/max_exporter_scripts/cmb.ms b/code/nel/tools/build_gamedata/generators/max_exporter_scripts/cmb.ms old mode 100755 new mode 100644 diff --git a/code/nel/tools/build_gamedata/generators/max_exporter_scripts/cmb.py b/code/nel/tools/build_gamedata/generators/max_exporter_scripts/cmb.py old mode 100755 new mode 100644 diff --git a/code/nel/tools/build_gamedata/generators/max_exporter_scripts/ig.ms b/code/nel/tools/build_gamedata/generators/max_exporter_scripts/ig.ms old mode 100755 new mode 100644 diff --git a/code/nel/tools/build_gamedata/generators/max_exporter_scripts/pacs_prim.ms b/code/nel/tools/build_gamedata/generators/max_exporter_scripts/pacs_prim.ms old mode 100755 new mode 100644 diff --git a/code/nel/tools/build_gamedata/generators/max_exporter_scripts/pacs_prim.py b/code/nel/tools/build_gamedata/generators/max_exporter_scripts/pacs_prim.py old mode 100755 new mode 100644 index 3edfcb66b..2e3f07ec9 --- a/code/nel/tools/build_gamedata/generators/max_exporter_scripts/pacs_prim.py +++ b/code/nel/tools/build_gamedata/generators/max_exporter_scripts/pacs_prim.py @@ -1,7 +1,7 @@ - - -# Remove bad file from previous script version -listPath = ExportBuildDirectory + "/" + %PreGenExportDirectoryVariable% + "/landscape_col_prim_pacs_list.txt" -if os.path.isfile(listPath): - os.remove(listPath) - + + +# Remove bad file from previous script version +listPath = ExportBuildDirectory + "/" + %PreGenExportDirectoryVariable% + "/landscape_col_prim_pacs_list.txt" +if os.path.isfile(listPath): + os.remove(listPath) + diff --git a/code/nel/tools/build_gamedata/generators/max_exporter_scripts/shape.ms b/code/nel/tools/build_gamedata/generators/max_exporter_scripts/shape.ms old mode 100755 new mode 100644 diff --git a/code/nel/tools/build_gamedata/generators/max_exporter_scripts/skel.ms b/code/nel/tools/build_gamedata/generators/max_exporter_scripts/skel.ms old mode 100755 new mode 100644 diff --git a/code/nel/tools/build_gamedata/generators/max_exporter_scripts/skel.py b/code/nel/tools/build_gamedata/generators/max_exporter_scripts/skel.py old mode 100755 new mode 100644 index 9ef54684e..884e11db3 --- a/code/nel/tools/build_gamedata/generators/max_exporter_scripts/skel.py +++ b/code/nel/tools/build_gamedata/generators/max_exporter_scripts/skel.py @@ -1,8 +1,8 @@ - - -printLog(log, ">>> Export skel directly <<<") -mkPath(log, ExportBuildDirectory + "/" + SkelExportDirectory) -for dir in SkelSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - copyFilesExtNoSubdirIfNeeded(log, DatabaseDirectory + "/" + dir, ExportBuildDirectory + "/" + SkelExportDirectory, ".skel") - + + +printLog(log, ">>> Export skel directly <<<") +mkPath(log, ExportBuildDirectory + "/" + SkelExportDirectory) +for dir in SkelSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) + copyFilesExtNoSubdirIfNeeded(log, DatabaseDirectory + "/" + dir, ExportBuildDirectory + "/" + SkelExportDirectory, ".skel") + diff --git a/code/nel/tools/build_gamedata/generators/max_exporter_scripts/swt.ms b/code/nel/tools/build_gamedata/generators/max_exporter_scripts/swt.ms old mode 100755 new mode 100644 diff --git a/code/nel/tools/build_gamedata/generators/max_exporter_scripts/swt.py b/code/nel/tools/build_gamedata/generators/max_exporter_scripts/swt.py old mode 100755 new mode 100644 diff --git a/code/nel/tools/build_gamedata/generators/max_exporter_scripts/veget.ms b/code/nel/tools/build_gamedata/generators/max_exporter_scripts/veget.ms old mode 100755 new mode 100644 diff --git a/code/nel/tools/build_gamedata/generators/max_exporter_scripts/veget.py b/code/nel/tools/build_gamedata/generators/max_exporter_scripts/veget.py old mode 100755 new mode 100644 diff --git a/code/nel/tools/build_gamedata/generators/max_exporter_scripts/zone.ms b/code/nel/tools/build_gamedata/generators/max_exporter_scripts/zone.ms old mode 100755 new mode 100644 diff --git a/code/nel/tools/build_gamedata/generators/max_exporter_scripts/zone.py b/code/nel/tools/build_gamedata/generators/max_exporter_scripts/zone.py old mode 100755 new mode 100644 index 45b3b3e04..d6e821879 --- a/code/nel/tools/build_gamedata/generators/max_exporter_scripts/zone.py +++ b/code/nel/tools/build_gamedata/generators/max_exporter_scripts/zone.py @@ -1,8 +1,8 @@ - - -printLog(log, ">>> Try to copy ligo zone if any <<<") -printLog(log, "********************************") -printLog(log, "******** TODO ********") -printLog(log, "********************************") -printLog(log, "") - + + +printLog(log, ">>> Try to copy ligo zone if any <<<") +printLog(log, "********************************") +printLog(log, "******** TODO ********") +printLog(log, "********************************") +printLog(log, "") + diff --git a/code/nel/tools/build_gamedata/generators/simple_max_exporter_template/0_setup.py b/code/nel/tools/build_gamedata/generators/simple_max_exporter_template/0_setup.py old mode 100755 new mode 100644 index 520eedb03..060d00e15 --- a/code/nel/tools/build_gamedata/generators/simple_max_exporter_template/0_setup.py +++ b/code/nel/tools/build_gamedata/generators/simple_max_exporter_template/0_setup.py @@ -1,65 +1,65 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief setup %PreGenProcessName% -# \date %PreGenDateTimeStamp% -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup %PreGenProcessName% -# -# 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 %PreGenProcessName%") -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 <<<") -for dir in %PreGenSourceDirectoriesVariable%: - mkPath(log, DatabaseDirectory + "/" + dir) - -# Setup export directories -printLog(log, ">>> Setup export directories <<<") -mkPath(log, ExportBuildDirectory + "/" + %PreGenExportDirectoryVariable%) - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") -mkPath(log, InstallDirectory + "/" + %PreGenInstallDirectoryVariable%) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief setup %PreGenProcessName% +# \date %PreGenDateTimeStamp% +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup %PreGenProcessName% +# +# 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 %PreGenProcessName%") +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 <<<") +for dir in %PreGenSourceDirectoriesVariable%: + mkPath(log, DatabaseDirectory + "/" + dir) + +# Setup export directories +printLog(log, ">>> Setup export directories <<<") +mkPath(log, ExportBuildDirectory + "/" + %PreGenExportDirectoryVariable%) + +# Setup build directories +printLog(log, ">>> Setup build directories <<<") + +# Setup client directories +printLog(log, ">>> Setup client directories <<<") +mkPath(log, InstallDirectory + "/" + %PreGenInstallDirectoryVariable%) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/generators/simple_max_exporter_template/1_export_footer.py b/code/nel/tools/build_gamedata/generators/simple_max_exporter_template/1_export_footer.py old mode 100755 new mode 100644 index 75bc99082..f4d6f4950 --- a/code/nel/tools/build_gamedata/generators/simple_max_exporter_template/1_export_footer.py +++ b/code/nel/tools/build_gamedata/generators/simple_max_exporter_template/1_export_footer.py @@ -1,7 +1,7 @@ - - -printLog(log, "") -log.close() - - -# end of file + + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/generators/simple_max_exporter_template/1_export_header.py b/code/nel/tools/build_gamedata/generators/simple_max_exporter_template/1_export_header.py old mode 100755 new mode 100644 index 6e857af0d..dd5baa402 --- a/code/nel/tools/build_gamedata/generators/simple_max_exporter_template/1_export_header.py +++ b/code/nel/tools/build_gamedata/generators/simple_max_exporter_template/1_export_header.py @@ -1,92 +1,92 @@ -#!/usr/bin/python -# -# ################################################################# -# ## %PreGenWarning% -# ################################################################# -# -# \file 1_export.py -# \brief Export %PreGenProcessName% -# \date %PreGenDateTimeStamp% -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export %PreGenProcessName% -# -# 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 %PreGenProcessName%") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# Find tools -# ... - -# Export %PreGenProcessName% 3dsmax -if MaxAvailable: - # Find tools - Max = findMax(log, MaxDirectory, MaxExecutable) - printLog(log, "") - - printLog(log, ">>> Export %PreGenProcessName% 3dsmax <<<") - mkPath(log, ExportBuildDirectory + "/" + %PreGenExportDirectoryVariable%) - for dir in %PreGenSourceDirectoriesVariable%: - mkPath(log, DatabaseDirectory + "/" + dir) - if (needUpdateDirByTagLog(log, DatabaseDirectory + "/" + dir, ".max", ExportBuildDirectory + "/" + %PreGenExportDirectoryVariable%, ".%PreGenFileExtension%")): - scriptSrc = "maxscript/%PreGenFileExtension%_export.ms" - scriptDst = MaxUserDirectory + "/scripts/%PreGenFileExtension%_export.ms" - outputLogfile = ScriptDirectory + "/processes/%PreGenProcessName%/log.log" - outputDirectory = ExportBuildDirectory + "/" + %PreGenExportDirectoryVariable% - maxSourceDir = DatabaseDirectory + "/" + dir - tagList = findFiles(log, outputDirectory, "", ".%PreGenFileExtension%") - tagLen = len(tagList) - if os.path.isfile(scriptDst): - os.remove(scriptDst) - tagDiff = 1 - sSrc = open(scriptSrc, "r") - sDst = open(scriptDst, "w") - for line in sSrc: - newline = line.replace("%OutputLogfile%", outputLogfile) - newline = newline.replace("%MaxSourceDirectory%", maxSourceDir) - newline = newline.replace("%OutputDirectory%", outputDirectory) - sDst.write(newline) - sSrc.close() - sDst.close() - while tagDiff > 0: - printLog(log, "MAXSCRIPT " + scriptDst) - subprocess.call([ Max, "-U", "MAXScript", "%PreGenFileExtension%_export.ms", "-q", "-mi", "-mip" ]) - tagList = findFiles(log, outputDirectory, "", ".%PreGenFileExtension%") - newTagLen = len(tagList) - tagDiff = newTagLen - tagLen - tagLen = newTagLen - printLog(log, "Exported " + str(tagDiff) + " .%PreGenFileExtension% files!") - os.remove(scriptDst) - +#!/usr/bin/python +# +# ################################################################# +# ## %PreGenWarning% +# ################################################################# +# +# \file 1_export.py +# \brief Export %PreGenProcessName% +# \date %PreGenDateTimeStamp% +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export %PreGenProcessName% +# +# 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 %PreGenProcessName%") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +# Find tools +# ... + +# Export %PreGenProcessName% 3dsmax +if MaxAvailable: + # Find tools + Max = findMax(log, MaxDirectory, MaxExecutable) + printLog(log, "") + + printLog(log, ">>> Export %PreGenProcessName% 3dsmax <<<") + mkPath(log, ExportBuildDirectory + "/" + %PreGenExportDirectoryVariable%) + for dir in %PreGenSourceDirectoriesVariable%: + mkPath(log, DatabaseDirectory + "/" + dir) + if (needUpdateDirByTagLog(log, DatabaseDirectory + "/" + dir, ".max", ExportBuildDirectory + "/" + %PreGenExportDirectoryVariable%, ".%PreGenFileExtension%")): + scriptSrc = "maxscript/%PreGenFileExtension%_export.ms" + scriptDst = MaxUserDirectory + "/scripts/%PreGenFileExtension%_export.ms" + outputLogfile = ScriptDirectory + "/processes/%PreGenProcessName%/log.log" + outputDirectory = ExportBuildDirectory + "/" + %PreGenExportDirectoryVariable% + maxSourceDir = DatabaseDirectory + "/" + dir + tagList = findFiles(log, outputDirectory, "", ".%PreGenFileExtension%") + tagLen = len(tagList) + if os.path.isfile(scriptDst): + os.remove(scriptDst) + tagDiff = 1 + sSrc = open(scriptSrc, "r") + sDst = open(scriptDst, "w") + for line in sSrc: + newline = line.replace("%OutputLogfile%", outputLogfile) + newline = newline.replace("%MaxSourceDirectory%", maxSourceDir) + newline = newline.replace("%OutputDirectory%", outputDirectory) + sDst.write(newline) + sSrc.close() + sDst.close() + while tagDiff > 0: + printLog(log, "MAXSCRIPT " + scriptDst) + subprocess.call([ Max, "-U", "MAXScript", "%PreGenFileExtension%_export.ms", "-q", "-mi", "-mip" ]) + tagList = findFiles(log, outputDirectory, "", ".%PreGenFileExtension%") + newTagLen = len(tagList) + tagDiff = newTagLen - tagLen + tagLen = newTagLen + printLog(log, "Exported " + str(tagDiff) + " .%PreGenFileExtension% files!") + os.remove(scriptDst) + diff --git a/code/nel/tools/build_gamedata/generators/simple_max_exporter_template/2_build.py b/code/nel/tools/build_gamedata/generators/simple_max_exporter_template/2_build.py old mode 100755 new mode 100644 index 9583c04eb..5eb9866b6 --- a/code/nel/tools/build_gamedata/generators/simple_max_exporter_template/2_build.py +++ b/code/nel/tools/build_gamedata/generators/simple_max_exporter_template/2_build.py @@ -1,49 +1,49 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build %PreGenProcessName% -# \date %PreGenDateTimeStamp% -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build %PreGenProcessName% -# -# 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 %PreGenProcessName%") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 2_build.py +# \brief Build %PreGenProcessName% +# \date %PreGenDateTimeStamp% +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Build %PreGenProcessName% +# +# 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 %PreGenProcessName%") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/generators/simple_max_exporter_template/3_install.py b/code/nel/tools/build_gamedata/generators/simple_max_exporter_template/3_install.py old mode 100755 new mode 100644 index f2d296d55..c245af1c3 --- a/code/nel/tools/build_gamedata/generators/simple_max_exporter_template/3_install.py +++ b/code/nel/tools/build_gamedata/generators/simple_max_exporter_template/3_install.py @@ -1,57 +1,57 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install %PreGenProcessName% -# \date %PreGenDateTimeStamp% -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install %PreGenProcessName% -# -# 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, "--- Install %PreGenProcessName%") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -printLog(log, ">>> Install %PreGenProcessName% <<<") -exportPath = ExportBuildDirectory + "/" + %PreGenExportDirectoryVariable% -mkPath(log, exportPath) -installPath = InstallDirectory + "/" + %PreGenInstallDirectoryVariable% -mkPath(log, installPath) -copyFilesExtNoSubdirIfNeeded(log, exportPath, installPath, ".%PreGenFileExtension%") - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install %PreGenProcessName% +# \date %PreGenDateTimeStamp% +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install %PreGenProcessName% +# +# 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, "--- Install %PreGenProcessName%") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +printLog(log, ">>> Install %PreGenProcessName% <<<") +exportPath = ExportBuildDirectory + "/" + %PreGenExportDirectoryVariable% +mkPath(log, exportPath) +installPath = InstallDirectory + "/" + %PreGenInstallDirectoryVariable% +mkPath(log, installPath) +copyFilesExtNoSubdirIfNeeded(log, exportPath, installPath, ".%PreGenFileExtension%") + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/generators/simple_max_exporter_template/export_footer.ms b/code/nel/tools/build_gamedata/generators/simple_max_exporter_template/export_footer.ms old mode 100755 new mode 100644 diff --git a/code/nel/tools/build_gamedata/generators/simple_max_exporter_template/export_header.ms b/code/nel/tools/build_gamedata/generators/simple_max_exporter_template/export_header.ms old mode 100755 new mode 100644 diff --git a/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/0_setup.py b/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/0_setup.py old mode 100755 new mode 100644 index 6bd49c40f..b72650db1 --- a/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/0_setup.py +++ b/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/0_setup.py @@ -1,66 +1,66 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief setup %PreGenProcessName% -# \date %PreGenDateTimeStamp% -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup %PreGenProcessName% -# -# 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 %PreGenProcessName%") -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 <<<") -for dir in %PreGenSourceDirectoriesVariable%: - mkPath(log, DatabaseDirectory + "/" + dir) - -# Setup export directories -printLog(log, ">>> Setup export directories <<<") -mkPath(log, ExportBuildDirectory + "/" + %PreGenExportDirectoryVariable%) -mkPath(log, ExportBuildDirectory + "/" + %PreGenTagExportDirectoryVariable%) - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") -mkPath(log, InstallDirectory + "/" + %PreGenInstallDirectoryVariable%) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief setup %PreGenProcessName% +# \date %PreGenDateTimeStamp% +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup %PreGenProcessName% +# +# 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 %PreGenProcessName%") +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 <<<") +for dir in %PreGenSourceDirectoriesVariable%: + mkPath(log, DatabaseDirectory + "/" + dir) + +# Setup export directories +printLog(log, ">>> Setup export directories <<<") +mkPath(log, ExportBuildDirectory + "/" + %PreGenExportDirectoryVariable%) +mkPath(log, ExportBuildDirectory + "/" + %PreGenTagExportDirectoryVariable%) + +# Setup build directories +printLog(log, ">>> Setup build directories <<<") + +# Setup client directories +printLog(log, ">>> Setup client directories <<<") +mkPath(log, InstallDirectory + "/" + %PreGenInstallDirectoryVariable%) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/1_export_footer.py b/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/1_export_footer.py old mode 100755 new mode 100644 index de627d6c7..1c5d530f1 --- a/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/1_export_footer.py +++ b/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/1_export_footer.py @@ -1,9 +1,9 @@ - - -log.close() -if os.path.isfile("log.log"): - os.remove("log.log") -shutil.move("temp_log.log", "log.log") - - -# end of file + + +log.close() +if os.path.isfile("log.log"): + os.remove("log.log") +shutil.move("temp_log.log", "log.log") + + +# end of file diff --git a/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/1_export_header.py b/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/1_export_header.py old mode 100755 new mode 100644 index 523001d22..cd0e974e0 --- a/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/1_export_header.py +++ b/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/1_export_header.py @@ -1,130 +1,130 @@ -#!/usr/bin/python -# -# ################################################################# -# ## %PreGenWarning% -# ################################################################# -# -# \file 1_export.py -# \brief Export %PreGenProcessName% -# \date %PreGenDateTimeStamp% -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export %PreGenProcessName% -# -# 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") -if os.path.isfile("temp_log.log"): - os.remove("temp_log.log") -log = open("temp_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 %PreGenProcessName%") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - - -# Find tools -# ... - -# Export %PreGenProcessName% 3dsmax -if MaxAvailable: - # Find tools - Max = findMax(log, MaxDirectory, MaxExecutable) - printLog(log, "") - - printLog(log, ">>> Export %PreGenProcessName% 3dsmax <<<") - mkPath(log, ExportBuildDirectory + "/" + %PreGenExportDirectoryVariable%) - mkPath(log, ExportBuildDirectory + "/" + %PreGenTagExportDirectoryVariable%) - for dir in %PreGenSourceDirectoriesVariable%: - mkPath(log, DatabaseDirectory + "/" + dir) - if (needUpdateDirByTagLog(log, DatabaseDirectory + "/" + dir, ".max", ExportBuildDirectory + "/" + %PreGenTagExportDirectoryVariable%, ".max.tag")): - scriptSrc = "maxscript/%PreGenFileExtension%_export.ms" - scriptDst = MaxUserDirectory + "/scripts/%PreGenFileExtension%_export.ms" - outputLogfile = ScriptDirectory + "/processes/%PreGenProcessName%/log.log" - outputDirectory = ExportBuildDirectory + "/" + %PreGenExportDirectoryVariable% - tagDirectory = ExportBuildDirectory + "/" + %PreGenTagExportDirectoryVariable% - maxSourceDir = DatabaseDirectory + "/" + dir - maxRunningTagFile = tagDirectory + "/max_running.tag" - tagList = findFiles(log, tagDirectory, "", ".max.tag") - tagLen = len(tagList) - if os.path.isfile(scriptDst): - os.remove(scriptDst) - tagDiff = 1 - sSrc = open(scriptSrc, "r") - sDst = open(scriptDst, "w") - for line in sSrc: - newline = line.replace("%OutputLogfile%", outputLogfile) - newline = newline.replace("%MaxSourceDirectory%", maxSourceDir) - newline = newline.replace("%OutputDirectory%", outputDirectory) - newline = newline.replace("%TagDirectory%", tagDirectory) - sDst.write(newline) - sSrc.close() - sDst.close() - zeroRetryLimit = 3 - while tagDiff > 0: - mrt = open(maxRunningTagFile, "w") - mrt.write("moe-moe-kyun") - mrt.close() - printLog(log, "MAXSCRIPT " + scriptDst) - subprocess.call([ Max, "-U", "MAXScript", "%PreGenFileExtension%_export.ms", "-q", "-mi", "-mip" ]) - if os.path.exists(outputLogfile): - try: - lSrc = open(outputLogfile, "r") - for line in lSrc: - lineStrip = line.strip() - if (len(lineStrip) > 0): - printLog(log, lineStrip) - lSrc.close() - os.remove(outputLogfile) - except Exception: - printLog(log, "ERROR Failed to read 3dsmax log") - else: - printLog(log, "WARNING No 3dsmax log") - tagList = findFiles(log, tagDirectory, "", ".max.tag") - newTagLen = len(tagList) - tagDiff = newTagLen - tagLen - tagLen = newTagLen - addTagDiff = 0 - if os.path.exists(maxRunningTagFile): - printLog(log, "FAIL 3ds Max crashed and/or file export failed!") - if tagDiff == 0: - if zeroRetryLimit > 0: - zeroRetryLimit = zeroRetryLimit - 1 - addTagDiff = 1 - else: - printLog(log, "FAIL Retry limit reached!") - else: - addTagDiff = 1 - os.remove(maxRunningTagFile) - printLog(log, "Exported " + str(tagDiff) + " .max files!") - tagDiff += addTagDiff - os.remove(scriptDst) - printLog(log, "") - +#!/usr/bin/python +# +# ################################################################# +# ## %PreGenWarning% +# ################################################################# +# +# \file 1_export.py +# \brief Export %PreGenProcessName% +# \date %PreGenDateTimeStamp% +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export %PreGenProcessName% +# +# 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") +if os.path.isfile("temp_log.log"): + os.remove("temp_log.log") +log = open("temp_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 %PreGenProcessName%") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + + +# Find tools +# ... + +# Export %PreGenProcessName% 3dsmax +if MaxAvailable: + # Find tools + Max = findMax(log, MaxDirectory, MaxExecutable) + printLog(log, "") + + printLog(log, ">>> Export %PreGenProcessName% 3dsmax <<<") + mkPath(log, ExportBuildDirectory + "/" + %PreGenExportDirectoryVariable%) + mkPath(log, ExportBuildDirectory + "/" + %PreGenTagExportDirectoryVariable%) + for dir in %PreGenSourceDirectoriesVariable%: + mkPath(log, DatabaseDirectory + "/" + dir) + if (needUpdateDirByTagLog(log, DatabaseDirectory + "/" + dir, ".max", ExportBuildDirectory + "/" + %PreGenTagExportDirectoryVariable%, ".max.tag")): + scriptSrc = "maxscript/%PreGenFileExtension%_export.ms" + scriptDst = MaxUserDirectory + "/scripts/%PreGenFileExtension%_export.ms" + outputLogfile = ScriptDirectory + "/processes/%PreGenProcessName%/log.log" + outputDirectory = ExportBuildDirectory + "/" + %PreGenExportDirectoryVariable% + tagDirectory = ExportBuildDirectory + "/" + %PreGenTagExportDirectoryVariable% + maxSourceDir = DatabaseDirectory + "/" + dir + maxRunningTagFile = tagDirectory + "/max_running.tag" + tagList = findFiles(log, tagDirectory, "", ".max.tag") + tagLen = len(tagList) + if os.path.isfile(scriptDst): + os.remove(scriptDst) + tagDiff = 1 + sSrc = open(scriptSrc, "r") + sDst = open(scriptDst, "w") + for line in sSrc: + newline = line.replace("%OutputLogfile%", outputLogfile) + newline = newline.replace("%MaxSourceDirectory%", maxSourceDir) + newline = newline.replace("%OutputDirectory%", outputDirectory) + newline = newline.replace("%TagDirectory%", tagDirectory) + sDst.write(newline) + sSrc.close() + sDst.close() + zeroRetryLimit = 3 + while tagDiff > 0: + mrt = open(maxRunningTagFile, "w") + mrt.write("moe-moe-kyun") + mrt.close() + printLog(log, "MAXSCRIPT " + scriptDst) + subprocess.call([ Max, "-U", "MAXScript", "%PreGenFileExtension%_export.ms", "-q", "-mi", "-mip" ]) + if os.path.exists(outputLogfile): + try: + lSrc = open(outputLogfile, "r") + for line in lSrc: + lineStrip = line.strip() + if (len(lineStrip) > 0): + printLog(log, lineStrip) + lSrc.close() + os.remove(outputLogfile) + except Exception: + printLog(log, "ERROR Failed to read 3dsmax log") + else: + printLog(log, "WARNING No 3dsmax log") + tagList = findFiles(log, tagDirectory, "", ".max.tag") + newTagLen = len(tagList) + tagDiff = newTagLen - tagLen + tagLen = newTagLen + addTagDiff = 0 + if os.path.exists(maxRunningTagFile): + printLog(log, "FAIL 3ds Max crashed and/or file export failed!") + if tagDiff == 0: + if zeroRetryLimit > 0: + zeroRetryLimit = zeroRetryLimit - 1 + addTagDiff = 1 + else: + printLog(log, "FAIL Retry limit reached!") + else: + addTagDiff = 1 + os.remove(maxRunningTagFile) + printLog(log, "Exported " + str(tagDiff) + " .max files!") + tagDiff += addTagDiff + os.remove(scriptDst) + printLog(log, "") + diff --git a/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/2_build.py b/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/2_build.py old mode 100755 new mode 100644 index 9583c04eb..5eb9866b6 --- a/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/2_build.py +++ b/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/2_build.py @@ -1,49 +1,49 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build %PreGenProcessName% -# \date %PreGenDateTimeStamp% -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build %PreGenProcessName% -# -# 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 %PreGenProcessName%") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 2_build.py +# \brief Build %PreGenProcessName% +# \date %PreGenDateTimeStamp% +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Build %PreGenProcessName% +# +# 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 %PreGenProcessName%") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/3_install.py b/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/3_install.py old mode 100755 new mode 100644 index 65122f3f8..97bb5983a --- a/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/3_install.py +++ b/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/3_install.py @@ -1,57 +1,57 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install %PreGenProcessName% -# \date %PreGenDateTimeStamp% -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install %PreGenProcessName% -# -# 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, "--- Install %PreGenProcessName%") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -printLog(log, ">>> Install %PreGenProcessName% <<<") -exportPath = ExportBuildDirectory + "/" + %PreGenExportDirectoryVariable% -mkPath(log, exportPath) -installPath = InstallDirectory + "/" + %PreGenInstallDirectoryVariable% -mkPath(log, installPath) -copyFilesNoTreeIfNeeded(log, exportPath, installPath) - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install %PreGenProcessName% +# \date %PreGenDateTimeStamp% +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install %PreGenProcessName% +# +# 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, "--- Install %PreGenProcessName%") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +printLog(log, ">>> Install %PreGenProcessName% <<<") +exportPath = ExportBuildDirectory + "/" + %PreGenExportDirectoryVariable% +mkPath(log, exportPath) +installPath = InstallDirectory + "/" + %PreGenInstallDirectoryVariable% +mkPath(log, installPath) +copyFilesNoTreeIfNeeded(log, exportPath, installPath) + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/export_footer.ms b/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/export_footer.ms old mode 100755 new mode 100644 diff --git a/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/export_header.ms b/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/export_header.ms old mode 100755 new mode 100644 diff --git a/code/nel/tools/build_gamedata/processes/0_setup.py b/code/nel/tools/build_gamedata/processes/0_setup.py old mode 100755 new mode 100644 index 6fb354781..01eab6102 --- a/code/nel/tools/build_gamedata/processes/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/0_setup.py @@ -1,89 +1,89 @@ -#!/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() -parser.add_argument('--includeprocess', '-ipc', nargs='+') -parser.add_argument('--excludeprocess', '-epc', nargs='+') -args = parser.parse_args() - -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 project") -#printLog(log, "-------") -#printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -#printLog(log, "") - -#printLog(log, "") -#printLog(log, "-------") -#printLog(log, "--- Setup client directories") -#printLog(log, "-------") -#printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -#printLog(log, "") -#for dir in ClientSetupDirectories: -# mkPath(log, InstallDirectory + "/" + dir) -#printLog(log, "") - -printLog(log, "") -printLog(log, "-------") -printLog(log, "--- Run the setup processes") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") -# For each process -for processName in ProcessToComplete: - if ((args.includeprocess == None or processName in args.includeprocess) and (args.excludeprocess == None or not processName in args.excludeprocess)): - printLog(log, "PROCESS " + processName) - os.chdir(processName) - try: - subprocess.call([ "python", "0_setup.py" ]) - except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) - os.chdir("..") - try: - processLog = open(processName + "/log.log", "r") - processLogData = processLog.read() - processLog.close() - log.write(processLogData) - except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) - # subprocess.call("idle.bat") - else: - printLog(log, "IGNORE PROCESS " + processName) -printLog(log, "") - -log.close() +#!/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() +parser.add_argument('--includeprocess', '-ipc', nargs='+') +parser.add_argument('--excludeprocess', '-epc', nargs='+') +args = parser.parse_args() + +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 project") +#printLog(log, "-------") +#printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +#printLog(log, "") + +#printLog(log, "") +#printLog(log, "-------") +#printLog(log, "--- Setup client directories") +#printLog(log, "-------") +#printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +#printLog(log, "") +#for dir in ClientSetupDirectories: +# mkPath(log, InstallDirectory + "/" + dir) +#printLog(log, "") + +printLog(log, "") +printLog(log, "-------") +printLog(log, "--- Run the setup processes") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") +# For each process +for processName in ProcessToComplete: + if ((args.includeprocess == None or processName in args.includeprocess) and (args.excludeprocess == None or not processName in args.excludeprocess)): + printLog(log, "PROCESS " + processName) + os.chdir(processName) + try: + subprocess.call([ "python", "0_setup.py" ]) + except Exception, e: + printLog(log, "<" + processName + "> " + str(e)) + os.chdir("..") + try: + processLog = open(processName + "/log.log", "r") + processLogData = processLog.read() + processLog.close() + log.write(processLogData) + except Exception, e: + printLog(log, "<" + processName + "> " + str(e)) + # subprocess.call("idle.bat") + else: + printLog(log, "IGNORE PROCESS " + processName) +printLog(log, "") + +log.close() diff --git a/code/nel/tools/build_gamedata/processes/1_export.py b/code/nel/tools/build_gamedata/processes/1_export.py old mode 100755 new mode 100644 index f3ea98ed7..21b10b058 --- a/code/nel/tools/build_gamedata/processes/1_export.py +++ b/code/nel/tools/build_gamedata/processes/1_export.py @@ -1,73 +1,73 @@ -#!/usr/bin/python -# -# \file 1_export.py -# \brief Run all export processes -# \date 2009-02-18 09:22GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Run all export 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() -parser.add_argument('--includeprocess', '-ipc', nargs='+') -parser.add_argument('--excludeprocess', '-epc', nargs='+') -args = parser.parse_args() - -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 * - -# Log error -printLog(log, "") -printLog(log, "-------") -printLog(log, "--- Run the export processes") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") -# For each process -for processName in ProcessToComplete: - if ((args.includeprocess == None or processName in args.includeprocess) and (args.excludeprocess == None or not processName in args.excludeprocess)): - printLog(log, "PROCESS " + processName) - os.chdir(processName) - try: - subprocess.call([ "python", "1_export.py" ]) - except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) - os.chdir("..") - try: - processLog = open(processName + "/log.log", "r") - processLogData = processLog.read() - processLog.close() - log.write(processLogData) - except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) - # subprocess.call("idle.bat") - else: - printLog(log, "IGNORE PROCESS " + processName) -printLog(log, "") - -log.close() +#!/usr/bin/python +# +# \file 1_export.py +# \brief Run all export processes +# \date 2009-02-18 09:22GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Run all export 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() +parser.add_argument('--includeprocess', '-ipc', nargs='+') +parser.add_argument('--excludeprocess', '-epc', nargs='+') +args = parser.parse_args() + +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 * + +# Log error +printLog(log, "") +printLog(log, "-------") +printLog(log, "--- Run the export processes") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") +# For each process +for processName in ProcessToComplete: + if ((args.includeprocess == None or processName in args.includeprocess) and (args.excludeprocess == None or not processName in args.excludeprocess)): + printLog(log, "PROCESS " + processName) + os.chdir(processName) + try: + subprocess.call([ "python", "1_export.py" ]) + except Exception, e: + printLog(log, "<" + processName + "> " + str(e)) + os.chdir("..") + try: + processLog = open(processName + "/log.log", "r") + processLogData = processLog.read() + processLog.close() + log.write(processLogData) + except Exception, e: + printLog(log, "<" + processName + "> " + str(e)) + # subprocess.call("idle.bat") + else: + printLog(log, "IGNORE PROCESS " + processName) +printLog(log, "") + +log.close() diff --git a/code/nel/tools/build_gamedata/processes/2_build.py b/code/nel/tools/build_gamedata/processes/2_build.py old mode 100755 new mode 100644 index eea528708..706db4b45 --- a/code/nel/tools/build_gamedata/processes/2_build.py +++ b/code/nel/tools/build_gamedata/processes/2_build.py @@ -1,73 +1,73 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Run all build processes -# \date 2009-02-18 09:22GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Run all build 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() -parser.add_argument('--includeprocess', '-ipc', nargs='+') -parser.add_argument('--excludeprocess', '-epc', nargs='+') -args = parser.parse_args() - -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 * - -# Log error -printLog(log, "") -printLog(log, "-------") -printLog(log, "--- Run the build processes") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") -# For each process -for processName in ProcessToComplete: - if ((args.includeprocess == None or processName in args.includeprocess) and (args.excludeprocess == None or not processName in args.excludeprocess)): - printLog(log, "PROCESS " + processName) - os.chdir(processName) - try: - subprocess.call([ "python", "2_build.py" ]) - except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) - os.chdir("..") - try: - processLog = open(processName + "/log.log", "r") - processLogData = processLog.read() - processLog.close() - log.write(processLogData) - except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) - # subprocess.call("idle.bat") - else: - printLog(log, "IGNORE PROCESS " + processName) -printLog(log, "") - -log.close() +#!/usr/bin/python +# +# \file 2_build.py +# \brief Run all build processes +# \date 2009-02-18 09:22GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Run all build 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() +parser.add_argument('--includeprocess', '-ipc', nargs='+') +parser.add_argument('--excludeprocess', '-epc', nargs='+') +args = parser.parse_args() + +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 * + +# Log error +printLog(log, "") +printLog(log, "-------") +printLog(log, "--- Run the build processes") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") +# For each process +for processName in ProcessToComplete: + if ((args.includeprocess == None or processName in args.includeprocess) and (args.excludeprocess == None or not processName in args.excludeprocess)): + printLog(log, "PROCESS " + processName) + os.chdir(processName) + try: + subprocess.call([ "python", "2_build.py" ]) + except Exception, e: + printLog(log, "<" + processName + "> " + str(e)) + os.chdir("..") + try: + processLog = open(processName + "/log.log", "r") + processLogData = processLog.read() + processLog.close() + log.write(processLogData) + except Exception, e: + printLog(log, "<" + processName + "> " + str(e)) + # subprocess.call("idle.bat") + else: + printLog(log, "IGNORE PROCESS " + processName) +printLog(log, "") + +log.close() diff --git a/code/nel/tools/build_gamedata/processes/3_install.py b/code/nel/tools/build_gamedata/processes/3_install.py old mode 100755 new mode 100644 index a34fdbce6..9f7147d09 --- a/code/nel/tools/build_gamedata/processes/3_install.py +++ b/code/nel/tools/build_gamedata/processes/3_install.py @@ -1,72 +1,72 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Run all install processes -# \date 2009-02-18 16:19GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Run all install 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() -parser.add_argument('--includeprocess', '-ipc', nargs='+') -parser.add_argument('--excludeprocess', '-epc', nargs='+') -args = parser.parse_args() - -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, "--- Run the install processes") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") -# For each process -for processName in ProcessToComplete: - if ((args.includeprocess == None or processName in args.includeprocess) and (args.excludeprocess == None or not processName in args.excludeprocess)): - printLog(log, "PROCESS " + processName) - os.chdir(processName) - try: - subprocess.call([ "python", "3_install.py" ]) - except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) - os.chdir("..") - try: - processLog = open(processName + "/log.log", "r") - processLogData = processLog.read() - processLog.close() - log.write(processLogData) - except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) - # subprocess.call("idle.bat") - else: - printLog(log, "IGNORE PROCESS " + processName) -printLog(log, "") - -log.close() +#!/usr/bin/python +# +# \file 3_install.py +# \brief Run all install processes +# \date 2009-02-18 16:19GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Run all install 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() +parser.add_argument('--includeprocess', '-ipc', nargs='+') +parser.add_argument('--excludeprocess', '-epc', nargs='+') +args = parser.parse_args() + +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, "--- Run the install processes") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") +# For each process +for processName in ProcessToComplete: + if ((args.includeprocess == None or processName in args.includeprocess) and (args.excludeprocess == None or not processName in args.excludeprocess)): + printLog(log, "PROCESS " + processName) + os.chdir(processName) + try: + subprocess.call([ "python", "3_install.py" ]) + except Exception, e: + printLog(log, "<" + processName + "> " + str(e)) + os.chdir("..") + try: + processLog = open(processName + "/log.log", "r") + processLogData = processLog.read() + processLog.close() + log.write(processLogData) + except Exception, e: + printLog(log, "<" + processName + "> " + str(e)) + # subprocess.call("idle.bat") + else: + printLog(log, "IGNORE PROCESS " + processName) +printLog(log, "") + +log.close() diff --git a/code/nel/tools/build_gamedata/processes/_dummy/0_setup.py b/code/nel/tools/build_gamedata/processes/_dummy/0_setup.py old mode 100755 new mode 100644 index e3104979d..4880523d1 --- a/code/nel/tools/build_gamedata/processes/_dummy/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/_dummy/0_setup.py @@ -1,66 +1,66 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief setup dummy -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup dummy -# -# 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 dummy") -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 <<<") -#for dir in MapSourceDirectories: -# mkPath(log, DatabaseDirectory + "/" + dir) - -# Setup export directories -printLog(log, ">>> Setup export directories <<<") -#mkPath(log, ExportBuildDirectory + "/" + DummyTagExportDirectory) - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") -#mkPath(log, ExportBuildDirectory + "/" + DummyWithCoarseMeshBuildDirectory) - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") -#mkPath(log, InstallDirectory + "/" + DummyInstallDirectory) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief setup dummy +# \date 2010-05-24 13:42GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup dummy +# +# 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 dummy") +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 <<<") +#for dir in MapSourceDirectories: +# mkPath(log, DatabaseDirectory + "/" + dir) + +# Setup export directories +printLog(log, ">>> Setup export directories <<<") +#mkPath(log, ExportBuildDirectory + "/" + DummyTagExportDirectory) + +# Setup build directories +printLog(log, ">>> Setup build directories <<<") +#mkPath(log, ExportBuildDirectory + "/" + DummyWithCoarseMeshBuildDirectory) + +# Setup client directories +printLog(log, ">>> Setup client directories <<<") +#mkPath(log, InstallDirectory + "/" + DummyInstallDirectory) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/_dummy/1_export.py b/code/nel/tools/build_gamedata/processes/_dummy/1_export.py old mode 100755 new mode 100644 index 373f984ae..6f0aab13f --- a/code/nel/tools/build_gamedata/processes/_dummy/1_export.py +++ b/code/nel/tools/build_gamedata/processes/_dummy/1_export.py @@ -1,117 +1,117 @@ -#!/usr/bin/python -# -# \file 1_export.py -# \brief Export dummy -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export dummy -# -# 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 dummy") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -if MaxAvailable: - # Find tools - Max = findMax(log, MaxDirectory, MaxExecutable) - # ExecTimeout = findTool(log, ToolDirectories, ExecTimeoutTool, ToolSuffix) - printLog(log, "") - - # Export dummy 3dsmax - printLog(log, ">>> Export dummy 3dsmax <<<") - - # Build paths - #scriptSrc = "maxscript/dummy_export.ms" - # scriptDst = MaxDirectory + "/scripts/dummy_export.ms" - #scriptDst = MaxUserDirectory + "/scripts/dummy_export.ms" - #logFile = ScriptDirectory + "/processes/dummy/log.log" - #outDirTag = ExportBuildDirectory + "/" + DummyTagExportDirectory - #mkPath(log, outDirTag) - #outDirWithoutCoarse = ExportBuildDirectory + "/" + DummyExportDirectory - #mkPath(log, outDirWithoutCoarse) - #outDirWithCoarse = ExportBuildDirectory + "/" + DummyWithCoarseMeshExportDirectory - #mkPath(log, outDirWithCoarse) - #outDirLightmap = ExportBuildDirectory + "/" + DummyLightmapNotOptimizedExportDirectory - #mkPath(log, outDirLightmap) - #outDirAnim = ExportBuildDirectory + "/" + DummyAnimExportDirectory - #mkPath(log, outDirAnim) - - #tagList = findFiles(log, outDirTag, "", ".tag") - #tagLen = len(tagList) - - # For each directoy - #if os.path.isfile(scriptDst): - # os.remove(scriptDst) - #for dir in DummySourceDirectories: - # tagDiff = 1 - # dummySourceDir = DatabaseDirectory + "/" + dir - # mkPath(log, dummySourceDir) - # sSrc = open(scriptSrc, "r") - # sDst = open(scriptDst, "w") - # for line in sSrc: - # newline = line.replace("output_logfile", logFile) - # newline = newline.replace("dummy_source_directory", dummySourceDir) - # newline = newline.replace("output_directory_tag", outDirTag) - # newline = newline.replace("output_directory_without_coarse_mesh", outDirWithoutCoarse) - # newline = newline.replace("output_directory_with_coarse_mesh", outDirWithCoarse) - # newline = newline.replace("dummy_export_opt_export_lighting", DummyExportOptExportLighting) - # newline = newline.replace("dummy_export_opt_shadow", DummyExportOptShadow) - # newline = newline.replace("dummy_export_opt_lighting_limit", str(DummyExportOptLightingLimit)) - # newline = newline.replace("dummy_export_opt_lumel_size", DummyExportOptLumelSize) - # newline = newline.replace("dummy_export_opt_oversampling", str(DummyExportOptOversampling)) - # newline = newline.replace("dummy_export_opt_lightmap_log", DummyExportOptLightmapLog) - # newline = newline.replace("dummy_lightmap_path", outDirLightmap) - # newline = newline.replace("output_directory_anim", outDirAnim) - # sDst.write(newline) - # sSrc.close() - # sDst.close() - # while tagDiff > 0: - # printLog(log, "MAXSCRIPT " + scriptDst) - # subprocess.call([ Max, "-U", "MAXScript", "dummy_export.ms", "-q", "-mi", "-mip" ]) - # tagList = findFiles(log, outDirTag, "", ".tag") - # newTagLen = len(tagList) - # tagDiff = newTagLen - tagLen - # tagLen = newTagLen - # printLog(log, "Exported " + str(tagDiff) + " .max files!") - # tagDiff += hackBdummyTree() # force rerun also when bdummy tree deleted - # os.remove(scriptDst) - - -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 1_export.py +# \brief Export dummy +# \date 2010-05-24 13:42GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export dummy +# +# 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 dummy") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +if MaxAvailable: + # Find tools + Max = findMax(log, MaxDirectory, MaxExecutable) + # ExecTimeout = findTool(log, ToolDirectories, ExecTimeoutTool, ToolSuffix) + printLog(log, "") + + # Export dummy 3dsmax + printLog(log, ">>> Export dummy 3dsmax <<<") + + # Build paths + #scriptSrc = "maxscript/dummy_export.ms" + # scriptDst = MaxDirectory + "/scripts/dummy_export.ms" + #scriptDst = MaxUserDirectory + "/scripts/dummy_export.ms" + #logFile = ScriptDirectory + "/processes/dummy/log.log" + #outDirTag = ExportBuildDirectory + "/" + DummyTagExportDirectory + #mkPath(log, outDirTag) + #outDirWithoutCoarse = ExportBuildDirectory + "/" + DummyExportDirectory + #mkPath(log, outDirWithoutCoarse) + #outDirWithCoarse = ExportBuildDirectory + "/" + DummyWithCoarseMeshExportDirectory + #mkPath(log, outDirWithCoarse) + #outDirLightmap = ExportBuildDirectory + "/" + DummyLightmapNotOptimizedExportDirectory + #mkPath(log, outDirLightmap) + #outDirAnim = ExportBuildDirectory + "/" + DummyAnimExportDirectory + #mkPath(log, outDirAnim) + + #tagList = findFiles(log, outDirTag, "", ".tag") + #tagLen = len(tagList) + + # For each directoy + #if os.path.isfile(scriptDst): + # os.remove(scriptDst) + #for dir in DummySourceDirectories: + # tagDiff = 1 + # dummySourceDir = DatabaseDirectory + "/" + dir + # mkPath(log, dummySourceDir) + # sSrc = open(scriptSrc, "r") + # sDst = open(scriptDst, "w") + # for line in sSrc: + # newline = line.replace("output_logfile", logFile) + # newline = newline.replace("dummy_source_directory", dummySourceDir) + # newline = newline.replace("output_directory_tag", outDirTag) + # newline = newline.replace("output_directory_without_coarse_mesh", outDirWithoutCoarse) + # newline = newline.replace("output_directory_with_coarse_mesh", outDirWithCoarse) + # newline = newline.replace("dummy_export_opt_export_lighting", DummyExportOptExportLighting) + # newline = newline.replace("dummy_export_opt_shadow", DummyExportOptShadow) + # newline = newline.replace("dummy_export_opt_lighting_limit", str(DummyExportOptLightingLimit)) + # newline = newline.replace("dummy_export_opt_lumel_size", DummyExportOptLumelSize) + # newline = newline.replace("dummy_export_opt_oversampling", str(DummyExportOptOversampling)) + # newline = newline.replace("dummy_export_opt_lightmap_log", DummyExportOptLightmapLog) + # newline = newline.replace("dummy_lightmap_path", outDirLightmap) + # newline = newline.replace("output_directory_anim", outDirAnim) + # sDst.write(newline) + # sSrc.close() + # sDst.close() + # while tagDiff > 0: + # printLog(log, "MAXSCRIPT " + scriptDst) + # subprocess.call([ Max, "-U", "MAXScript", "dummy_export.ms", "-q", "-mi", "-mip" ]) + # tagList = findFiles(log, outDirTag, "", ".tag") + # newTagLen = len(tagList) + # tagDiff = newTagLen - tagLen + # tagLen = newTagLen + # printLog(log, "Exported " + str(tagDiff) + " .max files!") + # tagDiff += hackBdummyTree() # force rerun also when bdummy tree deleted + # os.remove(scriptDst) + + +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/_dummy/2_build.py b/code/nel/tools/build_gamedata/processes/_dummy/2_build.py old mode 100755 new mode 100644 index 6dd48b9e2..dfcd68e23 --- a/code/nel/tools/build_gamedata/processes/_dummy/2_build.py +++ b/code/nel/tools/build_gamedata/processes/_dummy/2_build.py @@ -1,96 +1,96 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build dummy -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build dummy -# -# 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 dummy") -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) - -#if 1: # todo: CoarseMeshTextureNames length > 0 ... -# printLog(log, ">>> Build coarse meshes <<<") -# dummyWithCoarseMesh = ExportBuildDirectory + "/" + DummyWithCoarseMeshExportDirectory -# mkPath(log, dummyWithCoarseMesh) -# dummyWithCoarseMeshBuilded = ExportBuildDirectory + "/" + DummyWithCoarseMeshBuildDirectory -# mkPath(log, dummyWithCoarseMeshBuilded) -# cf = open("confdummy_generated.cfg", "w") -# cf.write("texture_mul_size = " + TextureMulSizeValue + ";\n") -# cf.write("\n") -# cf.write("search_path = \n") -# cf.write("{\n") -# cf.write("\t\"" + dummyWithCoarseMesh + "\", \n") -# for dir in MapSourceDirectories: -# cf.write("\t\"" + DatabaseDirectory + "/" + dir + "\", \n") -# cf.write("};\n") -# cf.write("\n") -# cf.write("list_mesh = \n") -# cf.write("{\n") -# # For each dummy with coarse mesh -# files = findFiles(log, dummyWithCoarseMesh, "", ".dummy") -# for file in files: -# sourceFile = dummyWithCoarseMesh + "/" + file -# if os.path.isfile(sourceFile): -# destFile = dummyWithCoarseMeshBuilded + "/" + file -# cf.write("\t\"" + file + "\", \"" + destFile + "\", \n") -# cf.write("};\n") -# cf.write("\n") -# cf.write("output_textures = \n") -# cf.write("{\n") -# # For each dummy with coarse mesh -# for tn in CoarseMeshTextureNames: -# cf.write("\t\"" + dummyWithCoarseMesh + "/" + tn + ".tga\", \n") -# cf.write("};\n") -# cf.close() -# subprocess.call([ BuildCoarseMesh, "confdummy_generated.cfg" ]) -# os.remove("confdummy_generated.cfg") -# for tn in CoarseMeshTextureNames: -# subprocess.call([ TgaToDds, dummyWithCoarseMesh + "/" + tn + ".tga", "-o", dummyWithCoarseMeshBuilded + "/" + tn + ".dds", "-a", "5" ]) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 2_build.py +# \brief Build dummy +# \date 2010-05-24 13:42GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Build dummy +# +# 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 dummy") +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) + +#if 1: # todo: CoarseMeshTextureNames length > 0 ... +# printLog(log, ">>> Build coarse meshes <<<") +# dummyWithCoarseMesh = ExportBuildDirectory + "/" + DummyWithCoarseMeshExportDirectory +# mkPath(log, dummyWithCoarseMesh) +# dummyWithCoarseMeshBuilded = ExportBuildDirectory + "/" + DummyWithCoarseMeshBuildDirectory +# mkPath(log, dummyWithCoarseMeshBuilded) +# cf = open("confdummy_generated.cfg", "w") +# cf.write("texture_mul_size = " + TextureMulSizeValue + ";\n") +# cf.write("\n") +# cf.write("search_path = \n") +# cf.write("{\n") +# cf.write("\t\"" + dummyWithCoarseMesh + "\", \n") +# for dir in MapSourceDirectories: +# cf.write("\t\"" + DatabaseDirectory + "/" + dir + "\", \n") +# cf.write("};\n") +# cf.write("\n") +# cf.write("list_mesh = \n") +# cf.write("{\n") +# # For each dummy with coarse mesh +# files = findFiles(log, dummyWithCoarseMesh, "", ".dummy") +# for file in files: +# sourceFile = dummyWithCoarseMesh + "/" + file +# if os.path.isfile(sourceFile): +# destFile = dummyWithCoarseMeshBuilded + "/" + file +# cf.write("\t\"" + file + "\", \"" + destFile + "\", \n") +# cf.write("};\n") +# cf.write("\n") +# cf.write("output_textures = \n") +# cf.write("{\n") +# # For each dummy with coarse mesh +# for tn in CoarseMeshTextureNames: +# cf.write("\t\"" + dummyWithCoarseMesh + "/" + tn + ".tga\", \n") +# cf.write("};\n") +# cf.close() +# subprocess.call([ BuildCoarseMesh, "confdummy_generated.cfg" ]) +# os.remove("confdummy_generated.cfg") +# for tn in CoarseMeshTextureNames: +# subprocess.call([ TgaToDds, dummyWithCoarseMesh + "/" + tn + ".tga", "-o", dummyWithCoarseMeshBuilded + "/" + tn + ".dds", "-a", "5" ]) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/_dummy/3_install.py b/code/nel/tools/build_gamedata/processes/_dummy/3_install.py old mode 100755 new mode 100644 index d809646b8..520dc0c49 --- a/code/nel/tools/build_gamedata/processes/_dummy/3_install.py +++ b/code/nel/tools/build_gamedata/processes/_dummy/3_install.py @@ -1,63 +1,63 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install dummy -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install dummy -# -# 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, "--- Install dummy") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -#installPath = InstallDirectory + "/" + DummyInstallDirectory -#mkPath(log, installPath) - -printLog(log, ">>> Install dummy <<<") -#mkPath(log, ExportBuildDirectory + "/" + DummyExportDirectory) -#copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + DummyExportDirectory, installPath, ".dummy") -#mkPath(log, ExportBuildDirectory + "/" + DummyWithCoarseMeshBuildDirectory) -#copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + DummyWithCoarseMeshBuildDirectory, installPath, ".dummy") -#copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + DummyWithCoarseMeshBuildDirectory, installPath, ".dds") - -#mkPath(log, ExportBuildDirectory + "/" + DummyAnimExportDirectory) -#copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + DummyAnimExportDirectory, installPath, ".anim") - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install dummy +# \date 2010-05-24 13:42GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install dummy +# +# 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 dummy") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +#installPath = InstallDirectory + "/" + DummyInstallDirectory +#mkPath(log, installPath) + +printLog(log, ">>> Install dummy <<<") +#mkPath(log, ExportBuildDirectory + "/" + DummyExportDirectory) +#copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + DummyExportDirectory, installPath, ".dummy") +#mkPath(log, ExportBuildDirectory + "/" + DummyWithCoarseMeshBuildDirectory) +#copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + DummyWithCoarseMeshBuildDirectory, installPath, ".dummy") +#copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + DummyWithCoarseMeshBuildDirectory, installPath, ".dds") + +#mkPath(log, ExportBuildDirectory + "/" + DummyAnimExportDirectory) +#copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + DummyAnimExportDirectory, installPath, ".anim") + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/ai_wmap/0_setup.py b/code/nel/tools/build_gamedata/processes/ai_wmap/0_setup.py old mode 100755 new mode 100644 index 418bb8de3..590a863e8 --- a/code/nel/tools/build_gamedata/processes/ai_wmap/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/ai_wmap/0_setup.py @@ -1,98 +1,98 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief setup ai_wmap -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup 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, "--- Setup ai_wmap") -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 + "/" + RbankOutputBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + AiWmapBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + AiWmapBuildTagDirectory) - -# Setup lookup directories -printLog(log, ">>> Setup lookup directories <<<") -for dir in IgLookupDirectories: - mkPath(log, ExportBuildDirectory + "/" + dir) -for dir in PacsPrimLookupDirectories: - mkPath(log, ExportBuildDirectory + "/" + dir) - -# Setup client directories -printLog(log, ">>> Setup install directories <<<") -mkPath(log, InstallDirectory + "/" + AiWmapInstallDirectory) - -# Setup client directories -printLog(log, ">>> Setup configuration <<<") -mkPath(log, InstallDirectory + "/" + AiWmapInstallDirectory) -mkPath(log, ActiveProjectDirectory + "/generated") -cfg = open(ActiveProjectDirectory + "/generated/ai_build_wmap.cfg", "w") -cfg.write("\n") -cfg.write("// AI BUILD WMAP CONFIGURATION\n") -cfg.write("\n") -cfg.write("Paths = {\n") -for dir in IgLookupDirectories: - cfg.write("\t\"" + ExportBuildDirectory + "/" + dir + "\", \n") -cfg.write("\t\"" + ExportBuildDirectory + "/" + RbankOutputBuildDirectory + "\", \n") -cfg.write("\t\"" + LeveldesignDirectory + "\", \n") -cfg.write("};\n") -cfg.write("\n") -cfg.write("NoRecursePaths = { };\n") -cfg.write("\n") -cfg.write("PacsPrimPaths = {\n") -for dir in PacsPrimLookupDirectories: - cfg.write("\t\"" + ExportBuildDirectory + "/" + dir + "\", \n") -cfg.write("};\n") -cfg.write("\n") -cfg.write("OutputPath = \"" + ExportBuildDirectory + "/" + AiWmapBuildDirectory + "\";\n") -cfg.write("\n") -cfg.write("Commands = {\n") -cfg.write("\t\"Verbose " + str(AiWmapVerbose) + "\", \n") -for startPoint in AiWmapStartPoints: - cfg.write("\t\"setStartPoint " + startPoint + "\", \n") -cfg.write("};\n") -cfg.write("\n") -cfg.close() - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief setup ai_wmap +# \date 2010-05-24 13:42GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup 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, "--- Setup ai_wmap") +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 + "/" + RbankOutputBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + AiWmapBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + AiWmapBuildTagDirectory) + +# Setup lookup directories +printLog(log, ">>> Setup lookup directories <<<") +for dir in IgLookupDirectories: + mkPath(log, ExportBuildDirectory + "/" + dir) +for dir in PacsPrimLookupDirectories: + mkPath(log, ExportBuildDirectory + "/" + dir) + +# Setup client directories +printLog(log, ">>> Setup install directories <<<") +mkPath(log, InstallDirectory + "/" + AiWmapInstallDirectory) + +# Setup client directories +printLog(log, ">>> Setup configuration <<<") +mkPath(log, InstallDirectory + "/" + AiWmapInstallDirectory) +mkPath(log, ActiveProjectDirectory + "/generated") +cfg = open(ActiveProjectDirectory + "/generated/ai_build_wmap.cfg", "w") +cfg.write("\n") +cfg.write("// AI BUILD WMAP CONFIGURATION\n") +cfg.write("\n") +cfg.write("Paths = {\n") +for dir in IgLookupDirectories: + cfg.write("\t\"" + ExportBuildDirectory + "/" + dir + "\", \n") +cfg.write("\t\"" + ExportBuildDirectory + "/" + RbankOutputBuildDirectory + "\", \n") +cfg.write("\t\"" + LeveldesignDirectory + "\", \n") +cfg.write("};\n") +cfg.write("\n") +cfg.write("NoRecursePaths = { };\n") +cfg.write("\n") +cfg.write("PacsPrimPaths = {\n") +for dir in PacsPrimLookupDirectories: + cfg.write("\t\"" + ExportBuildDirectory + "/" + dir + "\", \n") +cfg.write("};\n") +cfg.write("\n") +cfg.write("OutputPath = \"" + ExportBuildDirectory + "/" + AiWmapBuildDirectory + "\";\n") +cfg.write("\n") +cfg.write("Commands = {\n") +cfg.write("\t\"Verbose " + str(AiWmapVerbose) + "\", \n") +for startPoint in AiWmapStartPoints: + cfg.write("\t\"setStartPoint " + startPoint + "\", \n") +cfg.write("};\n") +cfg.write("\n") +cfg.close() + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/ai_wmap/1_export.py b/code/nel/tools/build_gamedata/processes/ai_wmap/1_export.py old mode 100755 new mode 100644 index de3d108c4..e90f9e0cd --- a/code/nel/tools/build_gamedata/processes/ai_wmap/1_export.py +++ b/code/nel/tools/build_gamedata/processes/ai_wmap/1_export.py @@ -1,49 +1,49 @@ -#!/usr/bin/python -# -# \file 1_export.py -# \brief Export ai_wmap -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export 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, "--- Export ai_wmap") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 1_export.py +# \brief Export ai_wmap +# \date 2010-05-24 13:42GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export 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, "--- Export ai_wmap") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +log.close() + + +# end of file 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 old mode 100755 new mode 100644 index 8aa63f62f..a59c7e09e --- a/code/nel/tools/build_gamedata/processes/ai_wmap/2_build.py +++ b/code/nel/tools/build_gamedata/processes/ai_wmap/2_build.py @@ -1,95 +1,97 @@ -#!/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 <<<") - subprocess.call([ AiBuildWmap, "pacsBuildWmap " + AiWmapContinentName + "_0" ]) - subprocess.call([ AiBuildWmap, "pacsBuildWmap " + AiWmapContinentName + "_1" ]) - subprocess.call([ AiBuildWmap, "pacsBuildWmap " + AiWmapContinentName + "_2" ]) - printLog(log, ">>> Generate bitmap for each size <<<") - subprocess.call([ AiBuildWmap, "pacsBuildBitmap " + AiWmapContinentName + "_0" ]) - subprocess.call([ AiBuildWmap, "pacsBuildBitmap " + AiWmapContinentName + "_1" ]) - subprocess.call([ AiBuildWmap, "pacsBuildBitmap " + AiWmapContinentName + "_2" ]) - 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 +#!/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/ai_wmap/3_install.py b/code/nel/tools/build_gamedata/processes/ai_wmap/3_install.py old mode 100755 new mode 100644 index fb81b991d..40a47754e --- a/code/nel/tools/build_gamedata/processes/ai_wmap/3_install.py +++ b/code/nel/tools/build_gamedata/processes/ai_wmap/3_install.py @@ -1,57 +1,57 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install ai_wmap -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install 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, "--- Install ai_wmap") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -installPath = InstallDirectory + "/" + AiWmapInstallDirectory -mkPath(log, installPath) - -printLog(log, ">>> Install ai_wmap <<<") -mkPath(log, ExportBuildDirectory + "/" + AiWmapBuildDirectory) -copyFilesNoTreeIfNeeded(log, ExportBuildDirectory + "/" + AiWmapBuildDirectory, installPath) - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install ai_wmap +# \date 2010-05-24 13:42GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install 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_local import * +from process import * +from tools import * +from directories import * + +printLog(log, "") +printLog(log, "-------") +printLog(log, "--- Install ai_wmap") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +installPath = InstallDirectory + "/" + AiWmapInstallDirectory +mkPath(log, installPath) + +printLog(log, ">>> Install ai_wmap <<<") +mkPath(log, ExportBuildDirectory + "/" + AiWmapBuildDirectory) +copyFilesNoTreeIfNeeded(log, ExportBuildDirectory + "/" + AiWmapBuildDirectory, installPath) + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/anim/0_setup.py b/code/nel/tools/build_gamedata/processes/anim/0_setup.py old mode 100755 new mode 100644 index 1f9cf10d7..90cd4bfb9 --- a/code/nel/tools/build_gamedata/processes/anim/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/anim/0_setup.py @@ -1,66 +1,66 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief Setup anim -# \date 2009-03-10 14:56GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup anim -# -# 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 anim") -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 <<<") -for dir in AnimSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - -# Setup export directories -printLog(log, ">>> Setup export directories <<<") -mkPath(log, ExportBuildDirectory + "/" + AnimExportDirectory) - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") -mkPath(log, ExportBuildDirectory + "/" + AnimBuildDirectory) - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") -mkPath(log, InstallDirectory + "/" + AnimInstallDirectory) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief Setup anim +# \date 2009-03-10 14:56GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup anim +# +# 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 anim") +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 <<<") +for dir in AnimSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) + +# Setup export directories +printLog(log, ">>> Setup export directories <<<") +mkPath(log, ExportBuildDirectory + "/" + AnimExportDirectory) + +# Setup build directories +printLog(log, ">>> Setup build directories <<<") +mkPath(log, ExportBuildDirectory + "/" + AnimBuildDirectory) + +# Setup client directories +printLog(log, ">>> Setup client directories <<<") +mkPath(log, InstallDirectory + "/" + AnimInstallDirectory) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/anim/1_export.py b/code/nel/tools/build_gamedata/processes/anim/1_export.py old mode 100755 new mode 100644 index 1745c45a9..d3424b663 --- a/code/nel/tools/build_gamedata/processes/anim/1_export.py +++ b/code/nel/tools/build_gamedata/processes/anim/1_export.py @@ -1,139 +1,139 @@ -#!/usr/bin/python -# -# ################################################################# -# ## WARNING : this is a generated file, don't change it ! -# ################################################################# -# -# \file 1_export.py -# \brief Export anim -# \date 2015-01-06-16-31-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export anim -# -# 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") -if os.path.isfile("temp_log.log"): - os.remove("temp_log.log") -log = open("temp_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 anim") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - - -# Find tools -# ... - -# Export anim 3dsmax -if MaxAvailable: - # Find tools - Max = findMax(log, MaxDirectory, MaxExecutable) - printLog(log, "") - - printLog(log, ">>> Export anim 3dsmax <<<") - mkPath(log, ExportBuildDirectory + "/" + AnimExportDirectory) - mkPath(log, ExportBuildDirectory + "/" + AnimTagExportDirectory) - for dir in AnimSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - if (needUpdateDirByTagLog(log, DatabaseDirectory + "/" + dir, ".max", ExportBuildDirectory + "/" + AnimTagExportDirectory, ".max.tag")): - scriptSrc = "maxscript/anim_export.ms" - scriptDst = MaxUserDirectory + "/scripts/anim_export.ms" - outputLogfile = ScriptDirectory + "/processes/anim/log.log" - outputDirectory = ExportBuildDirectory + "/" + AnimExportDirectory - tagDirectory = ExportBuildDirectory + "/" + AnimTagExportDirectory - maxSourceDir = DatabaseDirectory + "/" + dir - maxRunningTagFile = tagDirectory + "/max_running.tag" - tagList = findFiles(log, tagDirectory, "", ".max.tag") - tagLen = len(tagList) - if os.path.isfile(scriptDst): - os.remove(scriptDst) - tagDiff = 1 - sSrc = open(scriptSrc, "r") - sDst = open(scriptDst, "w") - for line in sSrc: - newline = line.replace("%OutputLogfile%", outputLogfile) - newline = newline.replace("%MaxSourceDirectory%", maxSourceDir) - newline = newline.replace("%OutputDirectory%", outputDirectory) - newline = newline.replace("%TagDirectory%", tagDirectory) - sDst.write(newline) - sSrc.close() - sDst.close() - zeroRetryLimit = 3 - while tagDiff > 0: - mrt = open(maxRunningTagFile, "w") - mrt.write("moe-moe-kyun") - mrt.close() - printLog(log, "MAXSCRIPT " + scriptDst) - subprocess.call([ Max, "-U", "MAXScript", "anim_export.ms", "-q", "-mi", "-mip" ]) - if os.path.exists(outputLogfile): - try: - lSrc = open(outputLogfile, "r") - for line in lSrc: - lineStrip = line.strip() - if (len(lineStrip) > 0): - printLog(log, lineStrip) - lSrc.close() - os.remove(outputLogfile) - except Exception: - printLog(log, "ERROR Failed to read 3dsmax log") - else: - printLog(log, "WARNING No 3dsmax log") - tagList = findFiles(log, tagDirectory, "", ".max.tag") - newTagLen = len(tagList) - tagDiff = newTagLen - tagLen - tagLen = newTagLen - addTagDiff = 0 - if os.path.exists(maxRunningTagFile): - printLog(log, "FAIL 3ds Max crashed and/or file export failed!") - if tagDiff == 0: - if zeroRetryLimit > 0: - zeroRetryLimit = zeroRetryLimit - 1 - addTagDiff = 1 - else: - printLog(log, "FAIL Retry limit reached!") - else: - addTagDiff = 1 - os.remove(maxRunningTagFile) - printLog(log, "Exported " + str(tagDiff) + " .max files!") - tagDiff += addTagDiff - os.remove(scriptDst) - printLog(log, "") - - - -log.close() -if os.path.isfile("log.log"): - os.remove("log.log") -shutil.move("temp_log.log", "log.log") - - -# end of file +#!/usr/bin/python +# +# ################################################################# +# ## WARNING : this is a generated file, don't change it ! +# ################################################################# +# +# \file 1_export.py +# \brief Export anim +# \date 2015-01-06-16-31-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export anim +# +# 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") +if os.path.isfile("temp_log.log"): + os.remove("temp_log.log") +log = open("temp_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 anim") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + + +# Find tools +# ... + +# Export anim 3dsmax +if MaxAvailable: + # Find tools + Max = findMax(log, MaxDirectory, MaxExecutable) + printLog(log, "") + + printLog(log, ">>> Export anim 3dsmax <<<") + mkPath(log, ExportBuildDirectory + "/" + AnimExportDirectory) + mkPath(log, ExportBuildDirectory + "/" + AnimTagExportDirectory) + for dir in AnimSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) + if (needUpdateDirByTagLog(log, DatabaseDirectory + "/" + dir, ".max", ExportBuildDirectory + "/" + AnimTagExportDirectory, ".max.tag")): + scriptSrc = "maxscript/anim_export.ms" + scriptDst = MaxUserDirectory + "/scripts/anim_export.ms" + outputLogfile = ScriptDirectory + "/processes/anim/log.log" + outputDirectory = ExportBuildDirectory + "/" + AnimExportDirectory + tagDirectory = ExportBuildDirectory + "/" + AnimTagExportDirectory + maxSourceDir = DatabaseDirectory + "/" + dir + maxRunningTagFile = tagDirectory + "/max_running.tag" + tagList = findFiles(log, tagDirectory, "", ".max.tag") + tagLen = len(tagList) + if os.path.isfile(scriptDst): + os.remove(scriptDst) + tagDiff = 1 + sSrc = open(scriptSrc, "r") + sDst = open(scriptDst, "w") + for line in sSrc: + newline = line.replace("%OutputLogfile%", outputLogfile) + newline = newline.replace("%MaxSourceDirectory%", maxSourceDir) + newline = newline.replace("%OutputDirectory%", outputDirectory) + newline = newline.replace("%TagDirectory%", tagDirectory) + sDst.write(newline) + sSrc.close() + sDst.close() + zeroRetryLimit = 3 + while tagDiff > 0: + mrt = open(maxRunningTagFile, "w") + mrt.write("moe-moe-kyun") + mrt.close() + printLog(log, "MAXSCRIPT " + scriptDst) + subprocess.call([ Max, "-U", "MAXScript", "anim_export.ms", "-q", "-mi", "-mip" ]) + if os.path.exists(outputLogfile): + try: + lSrc = open(outputLogfile, "r") + for line in lSrc: + lineStrip = line.strip() + if (len(lineStrip) > 0): + printLog(log, lineStrip) + lSrc.close() + os.remove(outputLogfile) + except Exception: + printLog(log, "ERROR Failed to read 3dsmax log") + else: + printLog(log, "WARNING No 3dsmax log") + tagList = findFiles(log, tagDirectory, "", ".max.tag") + newTagLen = len(tagList) + tagDiff = newTagLen - tagLen + tagLen = newTagLen + addTagDiff = 0 + if os.path.exists(maxRunningTagFile): + printLog(log, "FAIL 3ds Max crashed and/or file export failed!") + if tagDiff == 0: + if zeroRetryLimit > 0: + zeroRetryLimit = zeroRetryLimit - 1 + addTagDiff = 1 + else: + printLog(log, "FAIL Retry limit reached!") + else: + addTagDiff = 1 + os.remove(maxRunningTagFile) + printLog(log, "Exported " + str(tagDiff) + " .max files!") + tagDiff += addTagDiff + os.remove(scriptDst) + printLog(log, "") + + + +log.close() +if os.path.isfile("log.log"): + os.remove("log.log") +shutil.move("temp_log.log", "log.log") + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/anim/2_build.py b/code/nel/tools/build_gamedata/processes/anim/2_build.py old mode 100755 new mode 100644 index 81d968b06..1dbd2abae --- a/code/nel/tools/build_gamedata/processes/anim/2_build.py +++ b/code/nel/tools/build_gamedata/processes/anim/2_build.py @@ -1,70 +1,70 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build anim -# \date 2009-03-10 13:13GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build anim -# -# 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 anim") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# Find tools -AnimBuilder = findTool(log, ToolDirectories, AnimBuilderTool, ToolSuffix) -printLog(log, "") - -# For each anim directory -printLog(log, ">>> Build anim <<<") -if AnimBuilder == "": - toolLogFail(log, AnimBuilderTool, ToolSuffix) -else: - srcDir = ExportBuildDirectory + "/" + AnimExportDirectory - mkPath(log, srcDir) - destDir = ExportBuildDirectory + "/" + AnimBuildDirectory - mkPath(log, destDir) - if DoOptimizeAnimations: - printLog(log, ">>> Optimizing animations <<<") - subprocess.call([ AnimBuilder, srcDir, destDir, ActiveProjectDirectory + "/anim_builder.cfg" ]) - else: - printLog(log, ">>> Not optimizing animations <<<") - copyFilesNoTreeIfNeeded(log, srcDir, destDir) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 2_build.py +# \brief Build anim +# \date 2009-03-10 13:13GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Build anim +# +# 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 anim") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +# Find tools +AnimBuilder = findTool(log, ToolDirectories, AnimBuilderTool, ToolSuffix) +printLog(log, "") + +# For each anim directory +printLog(log, ">>> Build anim <<<") +if AnimBuilder == "": + toolLogFail(log, AnimBuilderTool, ToolSuffix) +else: + srcDir = ExportBuildDirectory + "/" + AnimExportDirectory + mkPath(log, srcDir) + destDir = ExportBuildDirectory + "/" + AnimBuildDirectory + mkPath(log, destDir) + if DoOptimizeAnimations: + printLog(log, ">>> Optimizing animations <<<") + subprocess.call([ AnimBuilder, srcDir, destDir, ActiveProjectDirectory + "/anim_builder.cfg" ]) + else: + printLog(log, ">>> Not optimizing animations <<<") + copyFilesNoTreeIfNeeded(log, srcDir, destDir) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/anim/3_install.py b/code/nel/tools/build_gamedata/processes/anim/3_install.py old mode 100755 new mode 100644 index 896f43db0..6fea6e9e7 --- a/code/nel/tools/build_gamedata/processes/anim/3_install.py +++ b/code/nel/tools/build_gamedata/processes/anim/3_install.py @@ -1,57 +1,57 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install anim -# \date 2009-03-10 13:13GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install anim -# -# 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, "--- Install anim") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -printLog(log, ">>> Install anim <<<") -srcDir = ExportBuildDirectory + "/" + AnimBuildDirectory -mkPath(log, srcDir) -destDir = InstallDirectory + "/" + AnimInstallDirectory -mkPath(log, destDir) -copyFilesNoTreeIfNeeded(log, srcDir, destDir) - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install anim +# \date 2009-03-10 13:13GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install anim +# +# 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 anim") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +printLog(log, ">>> Install anim <<<") +srcDir = ExportBuildDirectory + "/" + AnimBuildDirectory +mkPath(log, srcDir) +destDir = InstallDirectory + "/" + AnimInstallDirectory +mkPath(log, destDir) +copyFilesNoTreeIfNeeded(log, srcDir, destDir) + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/anim/maxscript/anim_export.ms b/code/nel/tools/build_gamedata/processes/anim/maxscript/anim_export.ms old mode 100755 new mode 100644 diff --git a/code/nel/tools/build_gamedata/processes/cartographer/0_setup.py b/code/nel/tools/build_gamedata/processes/cartographer/0_setup.py index 6f8b9a754..eda395771 100644 --- a/code/nel/tools/build_gamedata/processes/cartographer/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/cartographer/0_setup.py @@ -1,114 +1,120 @@ -#!/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) - -# 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) - -# 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") -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 = \"r2_islands.xml\";\n") -cfg.write("EntryPointsFile = \"r2_entry_points.txt\";\n") -cfg.write("\n") -cfg.close() - -log.close() - - -# end of file +#!/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/cartographer/1_export.py b/code/nel/tools/build_gamedata/processes/cartographer/1_export.py index 319316728..ea1627d61 100644 --- a/code/nel/tools/build_gamedata/processes/cartographer/1_export.py +++ b/code/nel/tools/build_gamedata/processes/cartographer/1_export.py @@ -1,49 +1,49 @@ -#!/usr/bin/python -# -# \file 1_export.py -# \brief Export cartographer -# \date 2014-09-13 13:32GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export 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, "--- Export cartographer") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 1_export.py +# \brief Export cartographer +# \date 2014-09-13 13:32GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export 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, "--- Export cartographer") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/cartographer/2_build.py b/code/nel/tools/build_gamedata/processes/cartographer/2_build.py index c3c14e9aa..fdc78dd43 100644 --- a/code/nel/tools/build_gamedata/processes/cartographer/2_build.py +++ b/code/nel/tools/build_gamedata/processes/cartographer/2_build.py @@ -1,62 +1,87 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build cartographer -# \date 2014-09-13 13:32GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build 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, "--- Build cartographer") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# Find tools -R2IslandsTextures = findTool(log, ToolDirectories, R2IslandsTexturesTool, ToolSuffix) - -if R2IslandsTextures == "": - toolLogFail(log, R2IslandsTexturesTool, ToolSuffix) -else: - printLog(log, ">>> Copy island_screenshots.cfg <<<") - cfgPath = ActiveProjectDirectory + "/generated/island_screenshots.cfg" - shutil.copy(cfgPath, "island_screenshots.cfg") - printLog(log, ">>> Build cartographer <<<") - subprocess.call([ R2IslandsTextures ]) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 2_build.py +# \brief Build cartographer +# \date 2014-09-13 13:32GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Build 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, "--- Build cartographer") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +# Find tools +R2IslandsTextures = findTool(log, ToolDirectories, R2IslandsTexturesTool, ToolSuffix) +TgaToDds = findTool(log, ToolDirectories, TgaToDdsTool, ToolSuffix) + +if R2IslandsTextures == "": + toolLogFail(log, R2IslandsTexturesTool, ToolSuffix) +else: + printLog(log, ">>> Copy island_screenshots.cfg <<<") + cfgPath = ActiveProjectDirectory + "/generated/island_screenshots.cfg" + shutil.copy(cfgPath, "island_screenshots.cfg") + printLog(log, ">>> Build cartographer <<<") + mkPath(log, ExportBuildDirectory + "/" + CartographerBuildDirectory) + subprocess.call([ R2IslandsTextures ]) +printLog(log, "") + +printLog(log, ">>> Compress cartographer maps to DDS <<<") +if TgaToDds == "": + toolLogFail(log, TgaToDdsTool, ToolSuffix) +else: + destPath = ExportBuildDirectory + "/" + CartographerMapBuildDirectory + mkPath(log, destPath) + sourcePath = ExportBuildDirectory + "/" + CartographerBuildDirectory + mkPath(log, sourcePath) + files = os.listdir(sourcePath) + len_tga_png = len(".tga") + len_dds = len(".dds") + for fileName in files: + if isLegalFileName(fileName): + sourceFile = sourcePath + "/" + fileName + if os.path.isfile(sourceFile): + if (fileName[-len_tga_png:].lower() == ".tga") or (fileName[-len_tga_png:].lower() == ".png"): + destFile = destPath + "/" + os.path.basename(fileName)[0:-len_tga_png] + ".dds" + if needUpdateLogRemoveDest(log, sourceFile, destFile): + subprocess.call([ TgaToDds, sourceFile, "-o", destFile, "-m" ]) + elif not os.path.isdir(sourceFile): + printLog(log, "FAIL ?! file not dir or file ?! " + sourceFile) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/cartographer/3_install.py b/code/nel/tools/build_gamedata/processes/cartographer/3_install.py index f241318c4..8ee8e6e0e 100644 --- a/code/nel/tools/build_gamedata/processes/cartographer/3_install.py +++ b/code/nel/tools/build_gamedata/processes/cartographer/3_install.py @@ -1,57 +1,66 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install cartographer -# \date 2014-09-13 13:32GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install 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, "--- Install cartographer") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -installPath = InstallDirectory + "/" + CartographerInstallDirectory -mkPath(log, installPath) - -printLog(log, ">>> Install cartographer <<<") -mkPath(log, ExportBuildDirectory + "/" + CartographerBuildDirectory) -copyFilesNoTreeIfNeeded(log, ExportBuildDirectory + "/" + CartographerBuildDirectory, installPath) - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install cartographer +# \date 2014-09-13 13:32GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install 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_local import * +from process import * +from tools import * +from directories import * + +printLog(log, "") +printLog(log, "-------") +printLog(log, "--- Install cartographer") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + + +installPath = InstallDirectory + "/" + CartographerInstallDirectory +islandsInstallPath = InstallDirectory + "/" + IslandsInstallDirectory + + +printLog(log, ">>> Install cartographer <<<") + +mkPath(log, ExportBuildDirectory + "/" + CartographerMapBuildDirectory) +mkPath(log, installPath) +copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + CartographerMapBuildDirectory, installPath, ".dds") + +mkPath(log, ExportBuildDirectory + "/" + CartographerBuildDirectory) +mkPath(log, islandsInstallPath) +copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + CartographerBuildDirectory, islandsInstallPath, ".xml") + + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/cegui/0_setup.py b/code/nel/tools/build_gamedata/processes/cegui/0_setup.py old mode 100755 new mode 100644 index b3f61468c..b2856b720 --- a/code/nel/tools/build_gamedata/processes/cegui/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/cegui/0_setup.py @@ -1,65 +1,65 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief Setup cegui -# \date 2009-03-14-17-46-GMT -# \author Jan Boon (Kaetemi) -# Setup cegui -# -# 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 cegui") -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 <<<") -for dir in CeguiImagesetSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - -# Setup export directories -printLog(log, ">>> Setup export directories <<<") -mkPath(log, ExportBuildDirectory + "/" + CeguiImagesetExportDirectory) - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") -mkPath(log, ExportBuildDirectory + "/" + CeguiImagesetBuildDirectory) - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") -mkPath(log, InstallDirectory + "/" + CeguiImagesetInstallDirectory) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief Setup cegui +# \date 2009-03-14-17-46-GMT +# \author Jan Boon (Kaetemi) +# Setup cegui +# +# 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 cegui") +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 <<<") +for dir in CeguiImagesetSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) + +# Setup export directories +printLog(log, ">>> Setup export directories <<<") +mkPath(log, ExportBuildDirectory + "/" + CeguiImagesetExportDirectory) + +# Setup build directories +printLog(log, ">>> Setup build directories <<<") +mkPath(log, ExportBuildDirectory + "/" + CeguiImagesetBuildDirectory) + +# Setup client directories +printLog(log, ">>> Setup client directories <<<") +mkPath(log, InstallDirectory + "/" + CeguiImagesetInstallDirectory) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/cegui/1_export.py b/code/nel/tools/build_gamedata/processes/cegui/1_export.py old mode 100755 new mode 100644 index 018562c46..897247498 --- a/code/nel/tools/build_gamedata/processes/cegui/1_export.py +++ b/code/nel/tools/build_gamedata/processes/cegui/1_export.py @@ -1,67 +1,67 @@ -#!/usr/bin/python -# -# \file 1_export.py -# \brief Export cegui -# \date 2009-03-14-17-46-GMT -# \author Jan Boon (Kaetemi) -# Export cegui -# -# 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 cegui") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# For each cegui imageset directory -printLog(log, ">>> Export cegui imagesets <<<") -destDir = ExportBuildDirectory + "/" + CeguiImagesetExportDirectory -mkPath(log, destDir) -for dir in CeguiImagesetSourceDirectories: - srcDir = DatabaseDirectory + "/" + dir - mkPath(log, srcDir) - imagesets = findFiles(log, srcDir, "", ".imageset") - if (len(imagesets) != 1): - printLog(log, "FAIL Cannot find *.imageset, folder must contain at least one and only one imageset xml file") - else: - niouname = dir.replace("/", "_") - newpath = destDir + "/" + niouname - mkPath(log, newpath) - copyFileIfNeeded(log, srcDir + "/" + imagesets[0], newpath + ".imageset") - copyFilesExtNoTreeIfNeeded(log, srcDir, newpath, ".tga") - copyFilesExtNoTreeIfNeeded(log, srcDir, newpath, ".png") -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 1_export.py +# \brief Export cegui +# \date 2009-03-14-17-46-GMT +# \author Jan Boon (Kaetemi) +# Export cegui +# +# 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 cegui") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +# For each cegui imageset directory +printLog(log, ">>> Export cegui imagesets <<<") +destDir = ExportBuildDirectory + "/" + CeguiImagesetExportDirectory +mkPath(log, destDir) +for dir in CeguiImagesetSourceDirectories: + srcDir = DatabaseDirectory + "/" + dir + mkPath(log, srcDir) + imagesets = findFiles(log, srcDir, "", ".imageset") + if (len(imagesets) != 1): + printLog(log, "FAIL Cannot find *.imageset, folder must contain at least one and only one imageset xml file") + else: + niouname = dir.replace("/", "_") + newpath = destDir + "/" + niouname + mkPath(log, newpath) + copyFileIfNeeded(log, srcDir + "/" + imagesets[0], newpath + ".imageset") + copyFilesExtNoTreeIfNeeded(log, srcDir, newpath, ".tga") + copyFilesExtNoTreeIfNeeded(log, srcDir, newpath, ".png") +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/cegui/2_build.py b/code/nel/tools/build_gamedata/processes/cegui/2_build.py old mode 100755 new mode 100644 index 134830547..5bef5ec90 --- a/code/nel/tools/build_gamedata/processes/cegui/2_build.py +++ b/code/nel/tools/build_gamedata/processes/cegui/2_build.py @@ -1,67 +1,67 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build cegui -# \date 2009-03-14-17-46-GMT -# \author Jan Boon (Kaetemi) -# Build cegui -# -# 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 cegui") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# Find tools -BuildImageset = findTool(log, ToolDirectories, BuildImagesetTool, ToolSuffix) -printLog(log, "") - -# For each cegui imageset directory -printLog(log, ">>> Build cegui imagesets <<<") -if BuildImageset == "": - toolLogFail(log, BuildImagesetTool, ToolSuffix) -else: - srcDir = ExportBuildDirectory + "/" + CeguiImagesetExportDirectory - mkPath(log, srcDir) - destDir = ExportBuildDirectory + "/" + CeguiImagesetBuildDirectory - mkPath(log, destDir) - for dir in os.listdir(srcDir): - if (os.path.isdir(srcDir + "/" + dir)) and dir != ".svn" and dir != "*.*": - mkPath(log, srcDir + "/" + dir) - subprocess.call([ BuildImageset, destDir + "/" + dir + ".tga", srcDir + "/" + dir ]) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 2_build.py +# \brief Build cegui +# \date 2009-03-14-17-46-GMT +# \author Jan Boon (Kaetemi) +# Build cegui +# +# 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 cegui") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +# Find tools +BuildImageset = findTool(log, ToolDirectories, BuildImagesetTool, ToolSuffix) +printLog(log, "") + +# For each cegui imageset directory +printLog(log, ">>> Build cegui imagesets <<<") +if BuildImageset == "": + toolLogFail(log, BuildImagesetTool, ToolSuffix) +else: + srcDir = ExportBuildDirectory + "/" + CeguiImagesetExportDirectory + mkPath(log, srcDir) + destDir = ExportBuildDirectory + "/" + CeguiImagesetBuildDirectory + mkPath(log, destDir) + for dir in os.listdir(srcDir): + if (os.path.isdir(srcDir + "/" + dir)) and dir != ".svn" and dir != "*.*": + mkPath(log, srcDir + "/" + dir) + subprocess.call([ BuildImageset, destDir + "/" + dir + ".tga", srcDir + "/" + dir ]) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/cegui/3_install.py b/code/nel/tools/build_gamedata/processes/cegui/3_install.py old mode 100755 new mode 100644 index d1d6547ad..136f4e60b --- a/code/nel/tools/build_gamedata/processes/cegui/3_install.py +++ b/code/nel/tools/build_gamedata/processes/cegui/3_install.py @@ -1,56 +1,56 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install cegui -# \date 2009-03-14-17-46-GMT -# \author Jan Boon (Kaetemi) -# Install cegui -# -# 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, "--- Install cegui") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -printLog(log, ">>> Install cegui imagesets <<<") -srcDir = ExportBuildDirectory + "/" + CeguiImagesetBuildDirectory -mkPath(log, srcDir) -destDir = InstallDirectory + "/" + CeguiImagesetInstallDirectory -mkPath(log, destDir) -copyFilesNoTreeIfNeeded(log, srcDir, destDir) - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install cegui +# \date 2009-03-14-17-46-GMT +# \author Jan Boon (Kaetemi) +# Install cegui +# +# 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 cegui") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +printLog(log, ">>> Install cegui imagesets <<<") +srcDir = ExportBuildDirectory + "/" + CeguiImagesetBuildDirectory +mkPath(log, srcDir) +destDir = InstallDirectory + "/" + CeguiImagesetInstallDirectory +mkPath(log, destDir) +copyFilesNoTreeIfNeeded(log, srcDir, destDir) + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/clodbank/0_setup.py b/code/nel/tools/build_gamedata/processes/clodbank/0_setup.py old mode 100755 new mode 100644 index a4ab0f4df..cd350d0c8 --- a/code/nel/tools/build_gamedata/processes/clodbank/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/clodbank/0_setup.py @@ -1,87 +1,87 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief Setup clodbank -# \date 2009-03-10 14:56GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup clodbank -# -# 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 clodbank") -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 <<<") -for dir in ClodSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - -# Setup export directories -printLog(log, ">>> Setup export directories <<<") -mkPath(log, ExportBuildDirectory + "/" + ClodTagExportDirectory) -mkPath(log, ExportBuildDirectory + "/" + ClodExportDirectory) -mkPath(log, ExportBuildDirectory + "/" + SkelExportDirectory) - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") -mkPath(log, ExportBuildDirectory + "/" + ClodBankBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + AnimBuildDirectory) - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") -mkPath(log, InstallDirectory + "/" + ShapeInstallDirectory) - -# Setup configuration files -printLog(log, ">>> Setup configuration files <<<") -mkPath(log, ActiveProjectDirectory + "/generated") -cfgOut = open(ActiveProjectDirectory + "/generated/clod_paths.cfg", "w") -cfgOut.write("\n") -cfgOut.write("// The search pathes, look in the current process\n") -cfgOut.write("search_pathes = \n") -cfgOut.write("{\n") -cfgOut.write("\t\"" + ExportBuildDirectory + "/" + ClodExportDirectory + "\", \n") -cfgOut.write("\t\"" + ExportBuildDirectory + "/" + SkelExportDirectory + "\", \n") -cfgOut.write("\t\"" + ExportBuildDirectory + "/" + AnimBuildDirectory + "\", \n") -cfgOut.write("\t\"" + ExportBuildDirectory + "/" + ShapeOptimizedBuildDirectory + "\", \n") -cfgOut.write("\t\"" + ExportBuildDirectory + "/" + ShapeWithCoarseMeshBuildDirectory + "\", \n") -cfgOut.write("};\n") -cfgOut.write("\n") -cfgOut.close() - - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief Setup clodbank +# \date 2009-03-10 14:56GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup clodbank +# +# 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 clodbank") +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 <<<") +for dir in ClodSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) + +# Setup export directories +printLog(log, ">>> Setup export directories <<<") +mkPath(log, ExportBuildDirectory + "/" + ClodTagExportDirectory) +mkPath(log, ExportBuildDirectory + "/" + ClodExportDirectory) +mkPath(log, ExportBuildDirectory + "/" + SkelExportDirectory) + +# Setup build directories +printLog(log, ">>> Setup build directories <<<") +mkPath(log, ExportBuildDirectory + "/" + ClodBankBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + AnimBuildDirectory) + +# Setup client directories +printLog(log, ">>> Setup client directories <<<") +mkPath(log, InstallDirectory + "/" + ShapeInstallDirectory) + +# Setup configuration files +printLog(log, ">>> Setup configuration files <<<") +mkPath(log, ActiveProjectDirectory + "/generated") +cfgOut = open(ActiveProjectDirectory + "/generated/clod_paths.cfg", "w") +cfgOut.write("\n") +cfgOut.write("// The search pathes, look in the current process\n") +cfgOut.write("search_pathes = \n") +cfgOut.write("{\n") +cfgOut.write("\t\"" + ExportBuildDirectory + "/" + ClodExportDirectory + "\", \n") +cfgOut.write("\t\"" + ExportBuildDirectory + "/" + SkelExportDirectory + "\", \n") +cfgOut.write("\t\"" + ExportBuildDirectory + "/" + AnimBuildDirectory + "\", \n") +cfgOut.write("\t\"" + ExportBuildDirectory + "/" + ShapeOptimizedBuildDirectory + "\", \n") +cfgOut.write("\t\"" + ExportBuildDirectory + "/" + ShapeWithCoarseMeshBuildDirectory + "\", \n") +cfgOut.write("};\n") +cfgOut.write("\n") +cfgOut.close() + + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/clodbank/1_export.py b/code/nel/tools/build_gamedata/processes/clodbank/1_export.py old mode 100755 new mode 100644 index c73a86ac7..118773463 --- a/code/nel/tools/build_gamedata/processes/clodbank/1_export.py +++ b/code/nel/tools/build_gamedata/processes/clodbank/1_export.py @@ -1,139 +1,139 @@ -#!/usr/bin/python -# -# ################################################################# -# ## WARNING : this is a generated file, don't change it ! -# ################################################################# -# -# \file 1_export.py -# \brief Export clodbank -# \date 2015-01-06-16-31-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export clodbank -# -# 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") -if os.path.isfile("temp_log.log"): - os.remove("temp_log.log") -log = open("temp_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 clodbank") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - - -# Find tools -# ... - -# Export clodbank 3dsmax -if MaxAvailable: - # Find tools - Max = findMax(log, MaxDirectory, MaxExecutable) - printLog(log, "") - - printLog(log, ">>> Export clodbank 3dsmax <<<") - mkPath(log, ExportBuildDirectory + "/" + ClodExportDirectory) - mkPath(log, ExportBuildDirectory + "/" + ClodTagExportDirectory) - for dir in ClodSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - if (needUpdateDirByTagLog(log, DatabaseDirectory + "/" + dir, ".max", ExportBuildDirectory + "/" + ClodTagExportDirectory, ".max.tag")): - scriptSrc = "maxscript/clod_export.ms" - scriptDst = MaxUserDirectory + "/scripts/clod_export.ms" - outputLogfile = ScriptDirectory + "/processes/clodbank/log.log" - outputDirectory = ExportBuildDirectory + "/" + ClodExportDirectory - tagDirectory = ExportBuildDirectory + "/" + ClodTagExportDirectory - maxSourceDir = DatabaseDirectory + "/" + dir - maxRunningTagFile = tagDirectory + "/max_running.tag" - tagList = findFiles(log, tagDirectory, "", ".max.tag") - tagLen = len(tagList) - if os.path.isfile(scriptDst): - os.remove(scriptDst) - tagDiff = 1 - sSrc = open(scriptSrc, "r") - sDst = open(scriptDst, "w") - for line in sSrc: - newline = line.replace("%OutputLogfile%", outputLogfile) - newline = newline.replace("%MaxSourceDirectory%", maxSourceDir) - newline = newline.replace("%OutputDirectory%", outputDirectory) - newline = newline.replace("%TagDirectory%", tagDirectory) - sDst.write(newline) - sSrc.close() - sDst.close() - zeroRetryLimit = 3 - while tagDiff > 0: - mrt = open(maxRunningTagFile, "w") - mrt.write("moe-moe-kyun") - mrt.close() - printLog(log, "MAXSCRIPT " + scriptDst) - subprocess.call([ Max, "-U", "MAXScript", "clod_export.ms", "-q", "-mi", "-mip" ]) - if os.path.exists(outputLogfile): - try: - lSrc = open(outputLogfile, "r") - for line in lSrc: - lineStrip = line.strip() - if (len(lineStrip) > 0): - printLog(log, lineStrip) - lSrc.close() - os.remove(outputLogfile) - except Exception: - printLog(log, "ERROR Failed to read 3dsmax log") - else: - printLog(log, "WARNING No 3dsmax log") - tagList = findFiles(log, tagDirectory, "", ".max.tag") - newTagLen = len(tagList) - tagDiff = newTagLen - tagLen - tagLen = newTagLen - addTagDiff = 0 - if os.path.exists(maxRunningTagFile): - printLog(log, "FAIL 3ds Max crashed and/or file export failed!") - if tagDiff == 0: - if zeroRetryLimit > 0: - zeroRetryLimit = zeroRetryLimit - 1 - addTagDiff = 1 - else: - printLog(log, "FAIL Retry limit reached!") - else: - addTagDiff = 1 - os.remove(maxRunningTagFile) - printLog(log, "Exported " + str(tagDiff) + " .max files!") - tagDiff += addTagDiff - os.remove(scriptDst) - printLog(log, "") - - - -log.close() -if os.path.isfile("log.log"): - os.remove("log.log") -shutil.move("temp_log.log", "log.log") - - -# end of file +#!/usr/bin/python +# +# ################################################################# +# ## WARNING : this is a generated file, don't change it ! +# ################################################################# +# +# \file 1_export.py +# \brief Export clodbank +# \date 2015-01-06-16-31-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export clodbank +# +# 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") +if os.path.isfile("temp_log.log"): + os.remove("temp_log.log") +log = open("temp_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 clodbank") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + + +# Find tools +# ... + +# Export clodbank 3dsmax +if MaxAvailable: + # Find tools + Max = findMax(log, MaxDirectory, MaxExecutable) + printLog(log, "") + + printLog(log, ">>> Export clodbank 3dsmax <<<") + mkPath(log, ExportBuildDirectory + "/" + ClodExportDirectory) + mkPath(log, ExportBuildDirectory + "/" + ClodTagExportDirectory) + for dir in ClodSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) + if (needUpdateDirByTagLog(log, DatabaseDirectory + "/" + dir, ".max", ExportBuildDirectory + "/" + ClodTagExportDirectory, ".max.tag")): + scriptSrc = "maxscript/clod_export.ms" + scriptDst = MaxUserDirectory + "/scripts/clod_export.ms" + outputLogfile = ScriptDirectory + "/processes/clodbank/log.log" + outputDirectory = ExportBuildDirectory + "/" + ClodExportDirectory + tagDirectory = ExportBuildDirectory + "/" + ClodTagExportDirectory + maxSourceDir = DatabaseDirectory + "/" + dir + maxRunningTagFile = tagDirectory + "/max_running.tag" + tagList = findFiles(log, tagDirectory, "", ".max.tag") + tagLen = len(tagList) + if os.path.isfile(scriptDst): + os.remove(scriptDst) + tagDiff = 1 + sSrc = open(scriptSrc, "r") + sDst = open(scriptDst, "w") + for line in sSrc: + newline = line.replace("%OutputLogfile%", outputLogfile) + newline = newline.replace("%MaxSourceDirectory%", maxSourceDir) + newline = newline.replace("%OutputDirectory%", outputDirectory) + newline = newline.replace("%TagDirectory%", tagDirectory) + sDst.write(newline) + sSrc.close() + sDst.close() + zeroRetryLimit = 3 + while tagDiff > 0: + mrt = open(maxRunningTagFile, "w") + mrt.write("moe-moe-kyun") + mrt.close() + printLog(log, "MAXSCRIPT " + scriptDst) + subprocess.call([ Max, "-U", "MAXScript", "clod_export.ms", "-q", "-mi", "-mip" ]) + if os.path.exists(outputLogfile): + try: + lSrc = open(outputLogfile, "r") + for line in lSrc: + lineStrip = line.strip() + if (len(lineStrip) > 0): + printLog(log, lineStrip) + lSrc.close() + os.remove(outputLogfile) + except Exception: + printLog(log, "ERROR Failed to read 3dsmax log") + else: + printLog(log, "WARNING No 3dsmax log") + tagList = findFiles(log, tagDirectory, "", ".max.tag") + newTagLen = len(tagList) + tagDiff = newTagLen - tagLen + tagLen = newTagLen + addTagDiff = 0 + if os.path.exists(maxRunningTagFile): + printLog(log, "FAIL 3ds Max crashed and/or file export failed!") + if tagDiff == 0: + if zeroRetryLimit > 0: + zeroRetryLimit = zeroRetryLimit - 1 + addTagDiff = 1 + else: + printLog(log, "FAIL Retry limit reached!") + else: + addTagDiff = 1 + os.remove(maxRunningTagFile) + printLog(log, "Exported " + str(tagDiff) + " .max files!") + tagDiff += addTagDiff + os.remove(scriptDst) + printLog(log, "") + + + +log.close() +if os.path.isfile("log.log"): + os.remove("log.log") +shutil.move("temp_log.log", "log.log") + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/clodbank/2_build.py b/code/nel/tools/build_gamedata/processes/clodbank/2_build.py old mode 100755 new mode 100644 index 9146f8c8e..07c896bc6 --- a/code/nel/tools/build_gamedata/processes/clodbank/2_build.py +++ b/code/nel/tools/build_gamedata/processes/clodbank/2_build.py @@ -1,68 +1,68 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build clodbank -# \date 2009-03-10 13:13GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build clodbank -# -# 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 clodbank") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# Find tools -BuildClodBank = findTool(log, ToolDirectories, BuildClodBankTool, ToolSuffix) -printLog(log, "") - -# Build clodbank -printLog(log, ">>> Build clodbank <<<") -if BuildClodBank == "": - toolLogFail(log, BuildClodBankTool, ToolSuffix) -else: - srcDir = ExportBuildDirectory + "/" + ClodExportDirectory - mkPath(log, srcDir) - destDir = ExportBuildDirectory + "/" + ClodBankBuildDirectory - mkPath(log, destDir) - mkPath(log, ActiveProjectDirectory + "/generated") - destFile = destDir + "/" + ClodBankFileName - configFile = DatabaseDirectory + "/" + ClodConfigFile - subprocess.call([ BuildClodBank, ActiveProjectDirectory + "/generated/clod_paths.cfg", configFile, destFile ]) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 2_build.py +# \brief Build clodbank +# \date 2009-03-10 13:13GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Build clodbank +# +# 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 clodbank") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +# Find tools +BuildClodBank = findTool(log, ToolDirectories, BuildClodBankTool, ToolSuffix) +printLog(log, "") + +# Build clodbank +printLog(log, ">>> Build clodbank <<<") +if BuildClodBank == "": + toolLogFail(log, BuildClodBankTool, ToolSuffix) +else: + srcDir = ExportBuildDirectory + "/" + ClodExportDirectory + mkPath(log, srcDir) + destDir = ExportBuildDirectory + "/" + ClodBankBuildDirectory + mkPath(log, destDir) + mkPath(log, ActiveProjectDirectory + "/generated") + destFile = destDir + "/" + ClodBankFileName + configFile = DatabaseDirectory + "/" + ClodConfigFile + subprocess.call([ BuildClodBank, ActiveProjectDirectory + "/generated/clod_paths.cfg", configFile, destFile ]) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/clodbank/3_install.py b/code/nel/tools/build_gamedata/processes/clodbank/3_install.py old mode 100755 new mode 100644 index b8da3d280..17ce9c0b9 --- a/code/nel/tools/build_gamedata/processes/clodbank/3_install.py +++ b/code/nel/tools/build_gamedata/processes/clodbank/3_install.py @@ -1,57 +1,57 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install clodbank -# \date 2009-03-10 13:13GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install clodbank -# -# 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, "--- Install clodbank") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -printLog(log, ">>> Install clodbank <<<") -srcDir = ExportBuildDirectory + "/" + ClodBankBuildDirectory -mkPath(log, srcDir) -destDir = InstallDirectory + "/" + ShapeInstallDirectory -mkPath(log, destDir) -copyFilesNoTreeIfNeeded(log, srcDir, destDir) - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install clodbank +# \date 2009-03-10 13:13GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install clodbank +# +# 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 clodbank") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +printLog(log, ">>> Install clodbank <<<") +srcDir = ExportBuildDirectory + "/" + ClodBankBuildDirectory +mkPath(log, srcDir) +destDir = InstallDirectory + "/" + ShapeInstallDirectory +mkPath(log, destDir) +copyFilesNoTreeIfNeeded(log, srcDir, destDir) + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/clodbank/maxscript/clod_export.ms b/code/nel/tools/build_gamedata/processes/clodbank/maxscript/clod_export.ms old mode 100755 new mode 100644 diff --git a/code/nel/tools/build_gamedata/processes/copy/0_setup.py b/code/nel/tools/build_gamedata/processes/copy/0_setup.py old mode 100755 new mode 100644 index f87f94bc9..17d08f6ba --- a/code/nel/tools/build_gamedata/processes/copy/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/copy/0_setup.py @@ -1,76 +1,76 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief setup copy -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup copy -# -# 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 copy") -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 <<<") -for dir in CopyDirectSourceDirectories: - mkPath(log, dir) -for file in CopyDirectSourceFiles: - mkPath(log, os.path.dirname(file)) -for dir in CopyLeveldesignSourceDirectories: - mkPath(log, LeveldesignDirectory + "/" + dir) -for file in CopyLeveldesignSourceFiles: - mkPath(log, os.path.dirname(LeveldesignDirectory + "/" + file)) -for dir in CopyLeveldesignWorldSourceDirectories: - mkPath(log, LeveldesignWorldDirectory + "/" + dir) -for file in CopyLeveldesignWorldSourceFiles: - mkPath(log, os.path.dirname(LeveldesignWorldDirectory + "/" + file)) -for dir in CopyLeveldesignDfnSourceDirectories: - mkPath(log, LeveldesignDfnDirectory + "/" + dir) -for file in CopyLeveldesignDfnSourceFiles: - mkPath(log, os.path.dirname(LeveldesignDfnDirectory + "/" + file)) -for dir in CopyDatabaseSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) -for file in CopyDatabaseSourceFiles: - mkPath(log, os.path.dirname(DatabaseDirectory + "/" + file)) - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") -mkPath(log, InstallDirectory + "/" + CopyInstallDirectory) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief setup copy +# \date 2010-05-24 13:42GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup copy +# +# 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 copy") +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 <<<") +for dir in CopyDirectSourceDirectories: + mkPath(log, dir) +for file in CopyDirectSourceFiles: + mkPath(log, os.path.dirname(file)) +for dir in CopyLeveldesignSourceDirectories: + mkPath(log, LeveldesignDirectory + "/" + dir) +for file in CopyLeveldesignSourceFiles: + mkPath(log, os.path.dirname(LeveldesignDirectory + "/" + file)) +for dir in CopyLeveldesignWorldSourceDirectories: + mkPath(log, LeveldesignWorldDirectory + "/" + dir) +for file in CopyLeveldesignWorldSourceFiles: + mkPath(log, os.path.dirname(LeveldesignWorldDirectory + "/" + file)) +for dir in CopyLeveldesignDfnSourceDirectories: + mkPath(log, LeveldesignDfnDirectory + "/" + dir) +for file in CopyLeveldesignDfnSourceFiles: + mkPath(log, os.path.dirname(LeveldesignDfnDirectory + "/" + file)) +for dir in CopyDatabaseSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) +for file in CopyDatabaseSourceFiles: + mkPath(log, os.path.dirname(DatabaseDirectory + "/" + file)) + +# Setup client directories +printLog(log, ">>> Setup client directories <<<") +mkPath(log, InstallDirectory + "/" + CopyInstallDirectory) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/copy/1_export.py b/code/nel/tools/build_gamedata/processes/copy/1_export.py old mode 100755 new mode 100644 index 39fa7fa4e..a001d7a95 --- a/code/nel/tools/build_gamedata/processes/copy/1_export.py +++ b/code/nel/tools/build_gamedata/processes/copy/1_export.py @@ -1,49 +1,49 @@ -#!/usr/bin/python -# -# \file 1_export.py -# \brief Export copy -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export copy -# -# 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 copy") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 1_export.py +# \brief Export copy +# \date 2010-05-24 13:42GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export copy +# +# 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 copy") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/copy/2_build.py b/code/nel/tools/build_gamedata/processes/copy/2_build.py old mode 100755 new mode 100644 index 796ce3451..7333235b0 --- a/code/nel/tools/build_gamedata/processes/copy/2_build.py +++ b/code/nel/tools/build_gamedata/processes/copy/2_build.py @@ -1,49 +1,49 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build copy -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build copy -# -# 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 copy") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 2_build.py +# \brief Build copy +# \date 2010-05-24 13:42GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Build copy +# +# 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 copy") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/copy/3_install.py b/code/nel/tools/build_gamedata/processes/copy/3_install.py old mode 100755 new mode 100644 index 7bcacc473..89e149e63 --- a/code/nel/tools/build_gamedata/processes/copy/3_install.py +++ b/code/nel/tools/build_gamedata/processes/copy/3_install.py @@ -1,85 +1,85 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install copy -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install copy -# -# 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, "--- Install copy") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -installPath = InstallDirectory + "/" + CopyInstallDirectory -mkPath(log, installPath) - -printLog(log, ">>> Install copy <<<") -for dir in CopyDirectSourceDirectories: - copyFilesRecursiveNoTreeIfNeeded(log, dir, installPath) -for file in CopyDirectSourceFiles: - copyFileIfNeeded(log, file, installPath + "/" + os.path.basename(file)) -for dir in CopyLeveldesignSourceDirectories: - copyFilesRecursiveNoTreeIfNeeded(log, LeveldesignDirectory + "/" + dir, installPath) -for file in CopyLeveldesignSourceFiles: - copyFileIfNeeded(log, LeveldesignDirectory + "/" + file, installPath + "/" + os.path.basename(file)) -for dir in CopyLeveldesignWorldSourceDirectories: - copyFilesRecursiveNoTreeIfNeeded(log, LeveldesignWorldDirectory + "/" + dir, installPath) -for file in CopyLeveldesignWorldSourceFiles: - copyFileIfNeeded(log, LeveldesignWorldDirectory + "/" + file, installPath + "/" + os.path.basename(file)) -for dir in CopyLeveldesignDfnSourceDirectories: - copyFilesRecursiveNoTreeIfNeeded(log, LeveldesignDfnDirectory + "/" + dir, installPath) -for file in CopyLeveldesignDfnSourceFiles: - copyFileIfNeeded(log, LeveldesignDfnDirectory + "/" + file, installPath + "/" + os.path.basename(file)) -for dir in CopyDatabaseSourceDirectories: - copyFilesRecursiveNoTreeIfNeeded(log, DatabaseDirectory + "/" + dir, installPath) -for file in CopyDatabaseSourceFiles: - copyFileIfNeeded(log, DatabaseDirectory + "/" + file, installPath + "/" + os.path.basename(file)) - -try: - CopyWindowsExeDllCfgSourceFiles -except NameError: - CopyWindowsExeDllCfgSourceFiles = [ ] -for file in CopyWindowsExeDllCfgSourceFiles: - filePath = findFileMultiDir(log, WindowsExeDllCfgDirectories, file) - if (filePath != ""): - copyFileIfNeeded(log, filePath, installPath + "/" + os.path.basename(file)) - -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install copy +# \date 2010-05-24 13:42GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install copy +# +# 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 copy") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +installPath = InstallDirectory + "/" + CopyInstallDirectory +mkPath(log, installPath) + +printLog(log, ">>> Install copy <<<") +for dir in CopyDirectSourceDirectories: + copyFilesRecursiveNoTreeIfNeeded(log, dir, installPath) +for file in CopyDirectSourceFiles: + copyFileIfNeeded(log, file, installPath + "/" + os.path.basename(file)) +for dir in CopyLeveldesignSourceDirectories: + copyFilesRecursiveNoTreeIfNeeded(log, LeveldesignDirectory + "/" + dir, installPath) +for file in CopyLeveldesignSourceFiles: + copyFileIfNeeded(log, LeveldesignDirectory + "/" + file, installPath + "/" + os.path.basename(file)) +for dir in CopyLeveldesignWorldSourceDirectories: + copyFilesRecursiveNoTreeIfNeeded(log, LeveldesignWorldDirectory + "/" + dir, installPath) +for file in CopyLeveldesignWorldSourceFiles: + copyFileIfNeeded(log, LeveldesignWorldDirectory + "/" + file, installPath + "/" + os.path.basename(file)) +for dir in CopyLeveldesignDfnSourceDirectories: + copyFilesRecursiveNoTreeIfNeeded(log, LeveldesignDfnDirectory + "/" + dir, installPath) +for file in CopyLeveldesignDfnSourceFiles: + copyFileIfNeeded(log, LeveldesignDfnDirectory + "/" + file, installPath + "/" + os.path.basename(file)) +for dir in CopyDatabaseSourceDirectories: + copyFilesRecursiveNoTreeIfNeeded(log, DatabaseDirectory + "/" + dir, installPath) +for file in CopyDatabaseSourceFiles: + copyFileIfNeeded(log, DatabaseDirectory + "/" + file, installPath + "/" + os.path.basename(file)) + +try: + CopyWindowsExeDllCfgSourceFiles +except NameError: + CopyWindowsExeDllCfgSourceFiles = [ ] +for file in CopyWindowsExeDllCfgSourceFiles: + filePath = findFileMultiDir(log, WindowsExeDllCfgDirectories, file) + if (filePath != ""): + copyFileIfNeeded(log, filePath, installPath + "/" + os.path.basename(file)) + +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/displace/0_setup.py b/code/nel/tools/build_gamedata/processes/displace/0_setup.py old mode 100755 new mode 100644 index 6a5e3170e..024311e25 --- a/code/nel/tools/build_gamedata/processes/displace/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/displace/0_setup.py @@ -1,65 +1,65 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief Setup displace -# \date 2009-03-10-21-45-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup displace -# -# 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 displace") -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 <<<") -for dir in DisplaceSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - -# Setup export directories -printLog(log, ">>> Setup export directories <<<") -mkPath(log, ExportBuildDirectory + "/" + DisplaceExportDirectory) - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") -mkPath(log, InstallDirectory + "/" + DisplaceInstallDirectory) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief Setup displace +# \date 2009-03-10-21-45-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup displace +# +# 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 displace") +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 <<<") +for dir in DisplaceSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) + +# Setup export directories +printLog(log, ">>> Setup export directories <<<") +mkPath(log, ExportBuildDirectory + "/" + DisplaceExportDirectory) + +# Setup build directories +printLog(log, ">>> Setup build directories <<<") + +# Setup client directories +printLog(log, ">>> Setup client directories <<<") +mkPath(log, InstallDirectory + "/" + DisplaceInstallDirectory) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/displace/1_export.py b/code/nel/tools/build_gamedata/processes/displace/1_export.py old mode 100755 new mode 100644 index 52ce5e24d..46314a123 --- a/code/nel/tools/build_gamedata/processes/displace/1_export.py +++ b/code/nel/tools/build_gamedata/processes/displace/1_export.py @@ -1,55 +1,55 @@ -#!/usr/bin/python -# -# \file 1_export.py -# \brief Export displace -# \date 2009-03-10-21-45-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export displace -# -# 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 displace") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -mkPath(log, ExportBuildDirectory + "/" + DisplaceExportDirectory) -for dir in DisplaceSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - copyFilesExtNoTreeIfNeeded(log, DatabaseDirectory + "/" + dir, ExportBuildDirectory + "/" + DisplaceExportDirectory, ".tga") - copyFilesExtNoTreeIfNeeded(log, DatabaseDirectory + "/" + dir, ExportBuildDirectory + "/" + DisplaceExportDirectory, ".png") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 1_export.py +# \brief Export displace +# \date 2009-03-10-21-45-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export displace +# +# 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 displace") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +mkPath(log, ExportBuildDirectory + "/" + DisplaceExportDirectory) +for dir in DisplaceSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) + copyFilesExtNoTreeIfNeeded(log, DatabaseDirectory + "/" + dir, ExportBuildDirectory + "/" + DisplaceExportDirectory, ".tga") + copyFilesExtNoTreeIfNeeded(log, DatabaseDirectory + "/" + dir, ExportBuildDirectory + "/" + DisplaceExportDirectory, ".png") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/displace/2_build.py b/code/nel/tools/build_gamedata/processes/displace/2_build.py old mode 100755 new mode 100644 index bc7f91aac..6cb8bc7a9 --- a/code/nel/tools/build_gamedata/processes/displace/2_build.py +++ b/code/nel/tools/build_gamedata/processes/displace/2_build.py @@ -1,49 +1,49 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build displace -# \date 2009-03-10-21-45-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build displace -# -# 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 displace") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 2_build.py +# \brief Build displace +# \date 2009-03-10-21-45-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Build displace +# +# 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 displace") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/displace/3_install.py b/code/nel/tools/build_gamedata/processes/displace/3_install.py old mode 100755 new mode 100644 index 76c0c03e4..f067939a9 --- a/code/nel/tools/build_gamedata/processes/displace/3_install.py +++ b/code/nel/tools/build_gamedata/processes/displace/3_install.py @@ -1,57 +1,57 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install displace -# \date 2009-03-10-21-45-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install displace -# -# 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, "--- Install displace") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -printLog(log, ">>> Install displace <<<") -installPath = InstallDirectory + "/" + DisplaceInstallDirectory -mkPath(log, installPath) -mkPath(log, ExportBuildDirectory + "/" + DisplaceExportDirectory) -copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + DisplaceExportDirectory, installPath, ".tga") -copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + DisplaceExportDirectory, installPath, ".png") - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install displace +# \date 2009-03-10-21-45-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install displace +# +# 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 displace") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +printLog(log, ">>> Install displace <<<") +installPath = InstallDirectory + "/" + DisplaceInstallDirectory +mkPath(log, installPath) +mkPath(log, ExportBuildDirectory + "/" + DisplaceExportDirectory) +copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + DisplaceExportDirectory, installPath, ".tga") +copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + DisplaceExportDirectory, installPath, ".png") + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/farbank/0_setup.py b/code/nel/tools/build_gamedata/processes/farbank/0_setup.py old mode 100755 new mode 100644 index 9761fa8b1..28b50daa7 --- a/code/nel/tools/build_gamedata/processes/farbank/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/farbank/0_setup.py @@ -1,66 +1,66 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief setup farbank -# \date 2009-03-10-21-12-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup farbank -# -# 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 farbank") -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 <<<") -for postfix in MultipleTilesPostfix: - mkPath(log, DatabaseDirectory + "/" + TileRootSourceDirectory + postfix) - -# Setup export directories -printLog(log, ">>> Setup export directories <<<") -mkPath(log, ExportBuildDirectory + "/" + SmallbankExportDirectory) - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") -mkPath(log, ExportBuildDirectory + "/" + FarbankBuildDirectory) - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") -mkPath(log, InstallDirectory + "/" + BankInstallDirectory) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief setup farbank +# \date 2009-03-10-21-12-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup farbank +# +# 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 farbank") +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 <<<") +for postfix in MultipleTilesPostfix: + mkPath(log, DatabaseDirectory + "/" + TileRootSourceDirectory + postfix) + +# Setup export directories +printLog(log, ">>> Setup export directories <<<") +mkPath(log, ExportBuildDirectory + "/" + SmallbankExportDirectory) + +# Setup build directories +printLog(log, ">>> Setup build directories <<<") +mkPath(log, ExportBuildDirectory + "/" + FarbankBuildDirectory) + +# Setup client directories +printLog(log, ">>> Setup client directories <<<") +mkPath(log, InstallDirectory + "/" + BankInstallDirectory) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/farbank/1_export.py b/code/nel/tools/build_gamedata/processes/farbank/1_export.py old mode 100755 new mode 100644 index 380a3444e..f3a88038b --- a/code/nel/tools/build_gamedata/processes/farbank/1_export.py +++ b/code/nel/tools/build_gamedata/processes/farbank/1_export.py @@ -1,49 +1,49 @@ -#!/usr/bin/python -# -# \file 1_export.py -# \brief Export farbank -# \date 2009-03-10-21-12-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export farbank -# -# 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 farbank") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 1_export.py +# \brief Export farbank +# \date 2009-03-10-21-12-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export farbank +# +# 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 farbank") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/farbank/2_build.py b/code/nel/tools/build_gamedata/processes/farbank/2_build.py old mode 100755 new mode 100644 index 85008bdde..58f89d37b --- a/code/nel/tools/build_gamedata/processes/farbank/2_build.py +++ b/code/nel/tools/build_gamedata/processes/farbank/2_build.py @@ -1,74 +1,74 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build farbank -# \date 2009-03-10-21-12-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build farbank -# -# 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 farbank") -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) -BuildFarbank = findTool(log, ToolDirectories, BuildFarbankTool, ToolSuffix) -printLog(log, "") - -# For each bank export farbank -printLog(log, ">>> Build farbank <<<") -if ExecTimeout == "": - toolLogFail(log, ExecTimeoutTool, ToolSuffix) -elif BuildFarbank == "": - toolLogFail(log, BuildFarbankTool, ToolSuffix) -else: - mkPath(log, ExportBuildDirectory + "/" + SmallbankExportDirectory) - mkPath(log, ExportBuildDirectory + "/" + FarbankBuildDirectory) - files = findFiles(log, ExportBuildDirectory + "/" + SmallbankExportDirectory, "", ".smallbank") - for file in files: - sourceFile = ExportBuildDirectory + "/" + SmallbankExportDirectory + "/" + file - if os.path.isfile(sourceFile): - for postfix in MultipleTilesPostfix: - destFile = ExportBuildDirectory + "/" + FarbankBuildDirectory + "/" + file[0:-len(".smallbank")] + postfix + ".farbank" - if (needUpdateLogRemoveDest(log, sourceFile, destFile)): - mkPath(log, DatabaseDirectory + "/" + TileRootSourceDirectory + postfix) - subprocess.call([ ExecTimeout, str(FarbankBuildTimeout), BuildFarbank, sourceFile, destFile, "-d" + DatabaseDirectory + "/" + TileRootSourceDirectory + postfix + "/", "-p" + postfix ]) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 2_build.py +# \brief Build farbank +# \date 2009-03-10-21-12-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Build farbank +# +# 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 farbank") +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) +BuildFarbank = findTool(log, ToolDirectories, BuildFarbankTool, ToolSuffix) +printLog(log, "") + +# For each bank export farbank +printLog(log, ">>> Build farbank <<<") +if ExecTimeout == "": + toolLogFail(log, ExecTimeoutTool, ToolSuffix) +elif BuildFarbank == "": + toolLogFail(log, BuildFarbankTool, ToolSuffix) +else: + mkPath(log, ExportBuildDirectory + "/" + SmallbankExportDirectory) + mkPath(log, ExportBuildDirectory + "/" + FarbankBuildDirectory) + files = findFiles(log, ExportBuildDirectory + "/" + SmallbankExportDirectory, "", ".smallbank") + for file in files: + sourceFile = ExportBuildDirectory + "/" + SmallbankExportDirectory + "/" + file + if os.path.isfile(sourceFile): + for postfix in MultipleTilesPostfix: + destFile = ExportBuildDirectory + "/" + FarbankBuildDirectory + "/" + file[0:-len(".smallbank")] + postfix + ".farbank" + if (needUpdateLogRemoveDest(log, sourceFile, destFile)): + mkPath(log, DatabaseDirectory + "/" + TileRootSourceDirectory + postfix) + subprocess.call([ ExecTimeout, str(FarbankBuildTimeout), BuildFarbank, sourceFile, destFile, "-d" + DatabaseDirectory + "/" + TileRootSourceDirectory + postfix + "/", "-p" + postfix ]) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/farbank/3_install.py b/code/nel/tools/build_gamedata/processes/farbank/3_install.py old mode 100755 new mode 100644 index d9164f84a..6fdbab993 --- a/code/nel/tools/build_gamedata/processes/farbank/3_install.py +++ b/code/nel/tools/build_gamedata/processes/farbank/3_install.py @@ -1,55 +1,55 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install farbank -# \date 2009-03-10-21-12-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install farbank -# -# 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, "--- Install farbank") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -printLog(log, ">>> Install farbank <<<") -mkPath(log, ExportBuildDirectory + "/" + FarbankBuildDirectory) -mkPath(log, InstallDirectory + "/" + BankInstallDirectory) -copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + FarbankBuildDirectory, InstallDirectory + "/" + BankInstallDirectory, ".farbank") - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install farbank +# \date 2009-03-10-21-12-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install farbank +# +# 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 farbank") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +printLog(log, ">>> Install farbank <<<") +mkPath(log, ExportBuildDirectory + "/" + FarbankBuildDirectory) +mkPath(log, InstallDirectory + "/" + BankInstallDirectory) +copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + FarbankBuildDirectory, InstallDirectory + "/" + BankInstallDirectory, ".farbank") + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/font/0_setup.py b/code/nel/tools/build_gamedata/processes/font/0_setup.py old mode 100755 new mode 100644 index 4b2a149da..9f15c1e00 --- a/code/nel/tools/build_gamedata/processes/font/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/font/0_setup.py @@ -1,65 +1,65 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief setup font -# \date 2009-03-10-19-43-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# setup 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, "--- Setup font") -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 <<<") -for dir in FontSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - -# Setup export directories -printLog(log, ">>> Setup export directories <<<") -mkPath(log, ExportBuildDirectory + "/" + FontExportDirectory) - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") -mkPath(log, InstallDirectory + "/" + FontInstallDirectory) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief setup font +# \date 2009-03-10-19-43-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# setup 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, "--- Setup font") +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 <<<") +for dir in FontSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) + +# Setup export directories +printLog(log, ">>> Setup export directories <<<") +mkPath(log, ExportBuildDirectory + "/" + FontExportDirectory) + +# Setup build directories +printLog(log, ">>> Setup build directories <<<") + +# Setup client directories +printLog(log, ">>> Setup client directories <<<") +mkPath(log, InstallDirectory + "/" + FontInstallDirectory) + +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 old mode 100755 new mode 100644 index f97d3375e..0bad904f6 --- a/code/nel/tools/build_gamedata/processes/font/1_export.py +++ b/code/nel/tools/build_gamedata/processes/font/1_export.py @@ -1,62 +1,63 @@ -#!/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, ".afm") - copyFilesExtNoTreeIfNeeded(log, DatabaseDirectory + "/" + dir, fontExportDir, ".pfb") - copyFilesExtNoTreeIfNeeded(log, DatabaseDirectory + "/" + dir, fontExportDir, ".pfm") - - -printLog(log, "") - -log.close() - - -# end of file +#!/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/2_build.py b/code/nel/tools/build_gamedata/processes/font/2_build.py old mode 100755 new mode 100644 index bc8794996..559d98327 --- a/code/nel/tools/build_gamedata/processes/font/2_build.py +++ b/code/nel/tools/build_gamedata/processes/font/2_build.py @@ -1,51 +1,51 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build font -# \date 2009-03-10-19-43-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build 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, "--- Build font") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 2_build.py +# \brief Build font +# \date 2009-03-10-19-43-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Build 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, "--- Build font") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +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 old mode 100755 new mode 100644 index c18ae12e3..3d244989a --- a/code/nel/tools/build_gamedata/processes/font/3_install.py +++ b/code/nel/tools/build_gamedata/processes/font/3_install.py @@ -1,61 +1,62 @@ -#!/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 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, ".afm") -copyFilesExtNoTreeIfNeeded(log, fontExportDir, installPath, ".pfb") -copyFilesExtNoTreeIfNeeded(log, fontExportDir, installPath, ".pfm") - -printLog(log, "") -log.close() - - -# end of file +#!/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/0_setup.py b/code/nel/tools/build_gamedata/processes/ig/0_setup.py old mode 100755 new mode 100644 index 830a32e26..aaeae8c29 --- a/code/nel/tools/build_gamedata/processes/ig/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/ig/0_setup.py @@ -1,78 +1,78 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief setup ig -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup 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, "--- Setup ig") -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 <<<") -for dir in IgLandSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) -for dir in IgOtherSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) -mkPath(log, DatabaseDirectory + "/" + LigoBaseSourceDirectory) - -# Setup export directories -printLog(log, ">>> Setup export directories <<<") -mkPath(log, ExportBuildDirectory + "/" + IgStaticLandExportDirectory) -mkPath(log, ExportBuildDirectory + "/" + IgStaticOtherExportDirectory) -mkPath(log, ExportBuildDirectory + "/" + IgStaticTagExportDirectory) - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") -mkPath(log, ExportBuildDirectory + "/" + LigoIgLandBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + LigoIgOtherBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + IgElevLandPrimBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + IgElevLandLigoBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + IgElevLandStaticBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + IgTempLandMergeBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + IgLandBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + IgOtherBuildDirectory) - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") -#mkPath(log, InstallDirectory + "/" + IgInstallDirectory) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief setup ig +# \date 2010-05-24 13:42GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup 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, "--- Setup ig") +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 <<<") +for dir in IgLandSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) +for dir in IgOtherSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) +mkPath(log, DatabaseDirectory + "/" + LigoBaseSourceDirectory) + +# Setup export directories +printLog(log, ">>> Setup export directories <<<") +mkPath(log, ExportBuildDirectory + "/" + IgStaticLandExportDirectory) +mkPath(log, ExportBuildDirectory + "/" + IgStaticOtherExportDirectory) +mkPath(log, ExportBuildDirectory + "/" + IgStaticTagExportDirectory) + +# Setup build directories +printLog(log, ">>> Setup build directories <<<") +mkPath(log, ExportBuildDirectory + "/" + LigoIgLandBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + LigoIgOtherBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + IgElevLandPrimBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + IgElevLandLigoBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + IgElevLandStaticBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + IgTempLandMergeBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + IgLandBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + IgOtherBuildDirectory) + +# Setup client directories +printLog(log, ">>> Setup client directories <<<") +#mkPath(log, InstallDirectory + "/" + IgInstallDirectory) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/ig/1_export.py b/code/nel/tools/build_gamedata/processes/ig/1_export.py old mode 100755 new mode 100644 index e22e7ec82..11def37fe --- a/code/nel/tools/build_gamedata/processes/ig/1_export.py +++ b/code/nel/tools/build_gamedata/processes/ig/1_export.py @@ -1,148 +1,148 @@ -#!/usr/bin/python -# -# \file 1_export.py -# \brief Export ig -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export 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") -if os.path.isfile("temp_log.log"): - os.remove("temp_log.log") -log = open("temp_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 ig") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -Max = "" #find later - - -def igExport(sourceDir, targetDir): - scriptSrc = "maxscript/ig_export.ms" - scriptDst = MaxUserDirectory + "/scripts/ig_export.ms" - outputLogfile = ScriptDirectory + "/processes/ig/log.log" - tagDirectory = ExportBuildDirectory + "/" + IgStaticTagExportDirectory - outputDirectory = ExportBuildDirectory + "/" + targetDir - maxSourceDir = DatabaseDirectory + "/" + sourceDir - maxRunningTagFile = tagDirectory + "/max_running.tag" - if (needUpdateDirByTagLog(log, maxSourceDir, ".max", tagDirectory, ".max.tag")): - tagList = findFiles(log, tagDirectory, "", ".tag") - tagLen = len(tagList) - if os.path.isfile(scriptDst): - os.remove(scriptDst) - tagDiff = 1 - sSrc = open(scriptSrc, "r") - sDst = open(scriptDst, "w") - for line in sSrc: - newline = line.replace("%OutputLogfile%", outputLogfile) - newline = newline.replace("%MaxSourceDirectory%", maxSourceDir) - newline = newline.replace("%OutputDirectory%", outputDirectory) - newline = newline.replace("%TagDirectory%", tagDirectory) - sDst.write(newline) - sSrc.close() - sDst.close() - zeroRetryLimit = 3 - while tagDiff > 0: - mrt = open(maxRunningTagFile, "w") - mrt.write("moe-moe-kyun") - mrt.close() - printLog(log, "MAXSCRIPT " + scriptDst) - subprocess.call([ Max, "-U", "MAXScript", "ig_export.ms", "-q", "-mi", "-mip" ]) - if os.path.exists(outputLogfile): - try: - lSrc = open(outputLogfile, "r") - for line in lSrc: - lineStrip = line.strip() - if (len(lineStrip) > 0): - printLog(log, lineStrip) - lSrc.close() - os.remove(outputLogfile) - except Exception: - printLog(log, "ERROR Failed to read 3dsmax log") - else: - printLog(log, "WARNING No 3dsmax log") - tagList = findFiles(log, tagDirectory, "", ".tag") - newTagLen = len(tagList) - tagDiff = newTagLen - tagLen - tagLen = newTagLen - addTagDiff = 0 - if os.path.exists(maxRunningTagFile): - printLog(log, "FAIL 3ds Max crashed and/or file export failed!") - if tagDiff == 0: - if zeroRetryLimit > 0: - zeroRetryLimit = zeroRetryLimit - 1 - addTagDiff = 1 - else: - printLog(log, "FAIL Retry limit reached!") - else: - addTagDiff = 1 - os.remove(maxRunningTagFile) - printLog(log, "Exported " + str(tagDiff) + " .max files!") - tagDiff += addTagDiff - os.remove(scriptDst) - return - - -if MaxAvailable: - # Find tools - Max = findMax(log, MaxDirectory, MaxExecutable) - # ExecTimeout = findTool(log, ToolDirectories, ExecTimeoutTool, ToolSuffix) - printLog(log, "") - - mkPath(log, ExportBuildDirectory + "/" + IgStaticTagExportDirectory) - - # Export ig land 3dsmax - printLog(log, ">>> Export ig land 3dsmax <<<") - mkPath(log, ExportBuildDirectory + "/" + IgStaticLandExportDirectory) - for dir in IgLandSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - igExport(dir, IgStaticLandExportDirectory) - printLog(log, "") - - # Export ig other 3dsmax - printLog(log, ">>> Export ig other 3dsmax <<<") - mkPath(log, ExportBuildDirectory + "/" + IgStaticOtherExportDirectory) - for dir in IgOtherSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - igExport(dir, IgStaticOtherExportDirectory) - printLog(log, "") - - -log.close() -if os.path.isfile("log.log"): - os.remove("log.log") -shutil.move("temp_log.log", "log.log") - - -# end of file +#!/usr/bin/python +# +# \file 1_export.py +# \brief Export ig +# \date 2010-05-24 13:42GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export 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") +if os.path.isfile("temp_log.log"): + os.remove("temp_log.log") +log = open("temp_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 ig") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +Max = "" #find later + + +def igExport(sourceDir, targetDir): + scriptSrc = "maxscript/ig_export.ms" + scriptDst = MaxUserDirectory + "/scripts/ig_export.ms" + outputLogfile = ScriptDirectory + "/processes/ig/log.log" + tagDirectory = ExportBuildDirectory + "/" + IgStaticTagExportDirectory + outputDirectory = ExportBuildDirectory + "/" + targetDir + maxSourceDir = DatabaseDirectory + "/" + sourceDir + maxRunningTagFile = tagDirectory + "/max_running.tag" + if (needUpdateDirByTagLog(log, maxSourceDir, ".max", tagDirectory, ".max.tag")): + tagList = findFiles(log, tagDirectory, "", ".tag") + tagLen = len(tagList) + if os.path.isfile(scriptDst): + os.remove(scriptDst) + tagDiff = 1 + sSrc = open(scriptSrc, "r") + sDst = open(scriptDst, "w") + for line in sSrc: + newline = line.replace("%OutputLogfile%", outputLogfile) + newline = newline.replace("%MaxSourceDirectory%", maxSourceDir) + newline = newline.replace("%OutputDirectory%", outputDirectory) + newline = newline.replace("%TagDirectory%", tagDirectory) + sDst.write(newline) + sSrc.close() + sDst.close() + zeroRetryLimit = 3 + while tagDiff > 0: + mrt = open(maxRunningTagFile, "w") + mrt.write("moe-moe-kyun") + mrt.close() + printLog(log, "MAXSCRIPT " + scriptDst) + subprocess.call([ Max, "-U", "MAXScript", "ig_export.ms", "-q", "-mi", "-mip" ]) + if os.path.exists(outputLogfile): + try: + lSrc = open(outputLogfile, "r") + for line in lSrc: + lineStrip = line.strip() + if (len(lineStrip) > 0): + printLog(log, lineStrip) + lSrc.close() + os.remove(outputLogfile) + except Exception: + printLog(log, "ERROR Failed to read 3dsmax log") + else: + printLog(log, "WARNING No 3dsmax log") + tagList = findFiles(log, tagDirectory, "", ".tag") + newTagLen = len(tagList) + tagDiff = newTagLen - tagLen + tagLen = newTagLen + addTagDiff = 0 + if os.path.exists(maxRunningTagFile): + printLog(log, "FAIL 3ds Max crashed and/or file export failed!") + if tagDiff == 0: + if zeroRetryLimit > 0: + zeroRetryLimit = zeroRetryLimit - 1 + addTagDiff = 1 + else: + printLog(log, "FAIL Retry limit reached!") + else: + addTagDiff = 1 + os.remove(maxRunningTagFile) + printLog(log, "Exported " + str(tagDiff) + " .max files!") + tagDiff += addTagDiff + os.remove(scriptDst) + return + + +if MaxAvailable: + # Find tools + Max = findMax(log, MaxDirectory, MaxExecutable) + # ExecTimeout = findTool(log, ToolDirectories, ExecTimeoutTool, ToolSuffix) + printLog(log, "") + + mkPath(log, ExportBuildDirectory + "/" + IgStaticTagExportDirectory) + + # Export ig land 3dsmax + printLog(log, ">>> Export ig land 3dsmax <<<") + mkPath(log, ExportBuildDirectory + "/" + IgStaticLandExportDirectory) + for dir in IgLandSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) + igExport(dir, IgStaticLandExportDirectory) + printLog(log, "") + + # Export ig other 3dsmax + printLog(log, ">>> Export ig other 3dsmax <<<") + mkPath(log, ExportBuildDirectory + "/" + IgStaticOtherExportDirectory) + for dir in IgOtherSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) + igExport(dir, IgStaticOtherExportDirectory) + printLog(log, "") + + +log.close() +if os.path.isfile("log.log"): + os.remove("log.log") +shutil.move("temp_log.log", "log.log") + + +# 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 old mode 100755 new mode 100644 index c2ab57059..159be465c --- a/code/nel/tools/build_gamedata/processes/ig/2_build.py +++ b/code/nel/tools/build_gamedata/processes/ig/2_build.py @@ -1,273 +1,275 @@ -#!/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("\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") -copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + LigoIgOtherBuildDirectory, ExportBuildDirectory + "/" + IgOtherBuildDirectory, ".ig") - -log.close() - - -# end of file +#!/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/ig/3_install.py b/code/nel/tools/build_gamedata/processes/ig/3_install.py old mode 100755 new mode 100644 index 7ab5f182d..aebfc4d5a --- a/code/nel/tools/build_gamedata/processes/ig/3_install.py +++ b/code/nel/tools/build_gamedata/processes/ig/3_install.py @@ -1,60 +1,60 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install ig -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install 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, "--- Install ig") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -clientPathIg = InstallDirectory + "/" + IgInstallDirectory -mkPath(log, clientPathIg) - -printLog(log, ">>> Install ig <<<") -landBuildDir = ExportBuildDirectory + "/" + IgLandBuildDirectory -mkPath(log, landBuildDir) -copyFilesExtNoTreeIfNeeded(log, landBuildDir, clientPathIg, "_ig.txt") # Copy the *_ig.txt file -# Do not copy *.ig in ig_land, because zone process will copy zone ig lighted versions into client directory. -# Do not copy *.ig ig_other, because ig_light process will copy ig lighted versions into client directory. - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install ig +# \date 2010-05-24 13:42GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install 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_local import * +from process import * +from tools import * +from directories import * + +printLog(log, "") +printLog(log, "-------") +printLog(log, "--- Install ig") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +clientPathIg = InstallDirectory + "/" + IgInstallDirectory +mkPath(log, clientPathIg) + +printLog(log, ">>> Install ig <<<") +landBuildDir = ExportBuildDirectory + "/" + IgLandBuildDirectory +mkPath(log, landBuildDir) +copyFilesExtNoTreeIfNeeded(log, landBuildDir, clientPathIg, "_ig.txt") # Copy the *_ig.txt file +# Do not copy *.ig in ig_land, because zone process will copy zone ig lighted versions into client directory. +# Do not copy *.ig ig_other, because ig_light process will copy ig lighted versions into client directory. + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/ig/maxscript/ig_export.ms b/code/nel/tools/build_gamedata/processes/ig/maxscript/ig_export.ms old mode 100755 new mode 100644 diff --git a/code/nel/tools/build_gamedata/processes/ig_light/0_setup.py b/code/nel/tools/build_gamedata/processes/ig_light/0_setup.py old mode 100755 new mode 100644 index 82bda3129..3c624c5a2 --- a/code/nel/tools/build_gamedata/processes/ig_light/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/ig_light/0_setup.py @@ -1,64 +1,64 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief Setup ig_light -# \date 2009-03-11-15-16-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup ig_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, "--- Setup ig_light") -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 <<<") - -# Setup export directories -printLog(log, ">>> Setup export directories <<<") - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") -mkPath(log, ExportBuildDirectory + "/" + IgOtherBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + IgOtherLightedBuildDirectory) - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") -mkPath(log, InstallDirectory + "/" + IgInstallDirectory) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief Setup ig_light +# \date 2009-03-11-15-16-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup ig_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, "--- Setup ig_light") +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 <<<") + +# Setup export directories +printLog(log, ">>> Setup export directories <<<") + +# Setup build directories +printLog(log, ">>> Setup build directories <<<") +mkPath(log, ExportBuildDirectory + "/" + IgOtherBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + IgOtherLightedBuildDirectory) + +# Setup client directories +printLog(log, ">>> Setup client directories <<<") +mkPath(log, InstallDirectory + "/" + IgInstallDirectory) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/ig_light/1_export.py b/code/nel/tools/build_gamedata/processes/ig_light/1_export.py old mode 100755 new mode 100644 index 4880b9d57..571c2457d --- a/code/nel/tools/build_gamedata/processes/ig_light/1_export.py +++ b/code/nel/tools/build_gamedata/processes/ig_light/1_export.py @@ -1,49 +1,49 @@ -#!/usr/bin/python -# -# \file 1_export.py -# \brief Export ig_light -# \date 2009-03-11-15-16-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export ig_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, "--- Export ig_light") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 1_export.py +# \brief Export ig_light +# \date 2009-03-11-15-16-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export ig_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, "--- Export ig_light") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/ig_light/2_build.py b/code/nel/tools/build_gamedata/processes/ig_light/2_build.py old mode 100755 new mode 100644 index 41ae92ff8..938b51d88 --- a/code/nel/tools/build_gamedata/processes/ig_light/2_build.py +++ b/code/nel/tools/build_gamedata/processes/ig_light/2_build.py @@ -1,65 +1,65 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build ig_light -# \date 2009-03-11-15-16-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build ig_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 ig_light") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# Find tools -IgLighter = findTool(log, ToolDirectories, IgLighterTool, ToolSuffix) -printLog(log, "") - -# For each ig_light directory -printLog(log, ">>> Build ig_light <<<") -if IgLighter == "": - toolLogFail(log, IgLighterTool, ToolSuffix) -else: - srcDir = ExportBuildDirectory + "/" + IgOtherBuildDirectory - mkPath(log, srcDir) - destDir = ExportBuildDirectory + "/" + IgOtherLightedBuildDirectory - mkPath(log, destDir) - subprocess.call([ IgLighter, srcDir, destDir, ActiveProjectDirectory + "/generated/properties.cfg" ]) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 2_build.py +# \brief Build ig_light +# \date 2009-03-11-15-16-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Build ig_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 ig_light") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +# Find tools +IgLighter = findTool(log, ToolDirectories, IgLighterTool, ToolSuffix) +printLog(log, "") + +# For each ig_light directory +printLog(log, ">>> Build ig_light <<<") +if IgLighter == "": + toolLogFail(log, IgLighterTool, ToolSuffix) +else: + srcDir = ExportBuildDirectory + "/" + IgOtherBuildDirectory + mkPath(log, srcDir) + destDir = ExportBuildDirectory + "/" + IgOtherLightedBuildDirectory + mkPath(log, destDir) + subprocess.call([ IgLighter, srcDir, destDir, ActiveProjectDirectory + "/generated/properties.cfg" ]) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/ig_light/3_install.py b/code/nel/tools/build_gamedata/processes/ig_light/3_install.py old mode 100755 new mode 100644 index 332d02184..a1e4d52a0 --- a/code/nel/tools/build_gamedata/processes/ig_light/3_install.py +++ b/code/nel/tools/build_gamedata/processes/ig_light/3_install.py @@ -1,57 +1,57 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install ig_light -# \date 2009-03-11-15-16-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install ig_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, "--- Install ig_light") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -printLog(log, ">>> Install ig_light <<<") -srcDir = ExportBuildDirectory + "/" + IgOtherLightedBuildDirectory -mkPath(log, srcDir) -destDir = InstallDirectory + "/" + IgInstallDirectory -mkPath(log, destDir) -copyFilesNoTreeIfNeeded(log, srcDir, destDir) - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install ig_light +# \date 2009-03-11-15-16-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install ig_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_local import * +from process import * +from tools import * +from directories import * + +printLog(log, "") +printLog(log, "-------") +printLog(log, "--- Install ig_light") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +printLog(log, ">>> Install ig_light <<<") +srcDir = ExportBuildDirectory + "/" + IgOtherLightedBuildDirectory +mkPath(log, srcDir) +destDir = InstallDirectory + "/" + IgInstallDirectory +mkPath(log, destDir) +copyFilesNoTreeIfNeeded(log, srcDir, destDir) + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/interface/0_setup.py b/code/nel/tools/build_gamedata/processes/interface/0_setup.py old mode 100755 new mode 100644 index 4a227d364..7f4203413 --- a/code/nel/tools/build_gamedata/processes/interface/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/interface/0_setup.py @@ -1,77 +1,77 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief Setup interface -# \date 2009-03-10 14:56GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup interface -# -# 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 interface") -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 <<<") -for dirs in InterfaceSourceDirectories: - for dir in dirs: - mkPath(log, DatabaseDirectory + "/" + dir) -for dir in InterfaceDxtcSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) -for dir in InterfaceFullscreenSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) -for dir in Interface3DSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - -# Setup export directories -printLog(log, ">>> Setup export directories <<<") -mkPath(log, ExportBuildDirectory + "/" + InterfaceExportDirectory) -mkPath(log, ExportBuildDirectory + "/" + InterfaceDxtcExportDirectory) -mkPath(log, ExportBuildDirectory + "/" + InterfaceFullscreenExportDirectory) -mkPath(log, ExportBuildDirectory + "/" + Interface3DExportDirectory) - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") -mkPath(log, ExportBuildDirectory + "/" + InterfaceBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + InterfaceDxtcBuildDirectory) - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") -mkPath(log, InstallDirectory + "/" + InterfaceInstallDirectory) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief Setup interface +# \date 2009-03-10 14:56GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup interface +# +# 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 interface") +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 <<<") +for dirs in InterfaceSourceDirectories: + for dir in dirs: + mkPath(log, DatabaseDirectory + "/" + dir) +for dir in InterfaceDxtcSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) +for dir in InterfaceFullscreenSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) +for dir in Interface3DSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) + +# Setup export directories +printLog(log, ">>> Setup export directories <<<") +mkPath(log, ExportBuildDirectory + "/" + InterfaceExportDirectory) +mkPath(log, ExportBuildDirectory + "/" + InterfaceDxtcExportDirectory) +mkPath(log, ExportBuildDirectory + "/" + InterfaceFullscreenExportDirectory) +mkPath(log, ExportBuildDirectory + "/" + Interface3DExportDirectory) + +# Setup build directories +printLog(log, ">>> Setup build directories <<<") +mkPath(log, ExportBuildDirectory + "/" + InterfaceBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + InterfaceDxtcBuildDirectory) + +# Setup client directories +printLog(log, ">>> Setup client directories <<<") +mkPath(log, InstallDirectory + "/" + InterfaceInstallDirectory) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/interface/1_export.py b/code/nel/tools/build_gamedata/processes/interface/1_export.py old mode 100755 new mode 100644 index b6c0f394c..eaf2f0f41 --- a/code/nel/tools/build_gamedata/processes/interface/1_export.py +++ b/code/nel/tools/build_gamedata/processes/interface/1_export.py @@ -1,105 +1,105 @@ -#!/usr/bin/python -# -# \file 1_export.py -# \brief Export interface -# \date 2009-03-10 13:13GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export interface -# -# 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 interface") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# Find tools -TgaToDds = findTool(log, ToolDirectories, TgaToDdsTool, ToolSuffix) -printLog(log, "") - -# For each interface directory -printLog(log, ">>> Export interface <<<") -mkPath(log, ExportBuildDirectory + "/" + InterfaceExportDirectory) -for dirs in InterfaceSourceDirectories: - niouname = dirs[0].replace("/", "_") - newpath = ExportBuildDirectory + "/" + InterfaceExportDirectory + "/" + niouname - mkPath(log, newpath) - for dir in dirs: - mkPath(log, DatabaseDirectory + "/" + dir) - copyFilesExtNoSubdirIfNeeded(log, DatabaseDirectory + "/" + dir, newpath, ".tga") - copyFilesExtNoSubdirIfNeeded(log, DatabaseDirectory + "/" + dir, newpath, ".png") -printLog(log, "") - -# For each interface directory to compress in one DXTC -printLog(log, ">>> Export interface dxtc <<<") -mkPath(log, ExportBuildDirectory + "/" + InterfaceDxtcExportDirectory) -for dir in InterfaceDxtcSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - copyFilesExtNoSubdirIfNeeded(log, DatabaseDirectory + "/" + dir, ExportBuildDirectory + "/" + InterfaceDxtcExportDirectory, ".tga") - copyFilesExtNoSubdirIfNeeded(log, DatabaseDirectory + "/" + dir, ExportBuildDirectory + "/" + InterfaceDxtcExportDirectory, ".png") -printLog(log, "") - -# For each interface fullscreen directory compress independently all in dds -printLog(log, ">>> Export interface fullscreen <<<") -if TgaToDds == "": - toolLogFail(log, TgaToDdsTool, ToolSuffix) -else: - mkPath(log, ExportBuildDirectory + "/" + InterfaceFullscreenExportDirectory) - for dir in InterfaceFullscreenSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - files = findFiles(log, DatabaseDirectory + "/" + dir, "", ".tga") - for file in files: - sourceFile = DatabaseDirectory + "/" + dir + "/" + file - destFile = ExportBuildDirectory + "/" + InterfaceFullscreenExportDirectory + "/" + os.path.basename(file)[0:-len(".tga")] + ".dds" - if needUpdateLogRemoveDest(log, sourceFile, destFile): - subprocess.call([ TgaToDds, sourceFile, "-o", destFile, "-a", "5" ]) - files = findFiles(log, DatabaseDirectory + "/" + dir, "", ".png") - for file in files: - sourceFile = DatabaseDirectory + "/" + dir + "/" + file - destFile = ExportBuildDirectory + "/" + InterfaceFullscreenExportDirectory + "/" + os.path.basename(file)[0:-len(".png")] + ".dds" - if needUpdateLogRemoveDest(log, sourceFile, destFile): - subprocess.call([ TgaToDds, sourceFile, "-o", destFile, "-a", "5" ]) -printLog(log, "") - -# For each interface 3d directory -printLog(log, ">>> Export interface 3d <<<") -mkPath(log, ExportBuildDirectory + "/" + Interface3DExportDirectory) -for dir in Interface3DSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - copyFiles(log, DatabaseDirectory + "/" + dir, ExportBuildDirectory + "/" + Interface3DExportDirectory) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 1_export.py +# \brief Export interface +# \date 2009-03-10 13:13GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export interface +# +# 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 interface") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +# Find tools +TgaToDds = findTool(log, ToolDirectories, TgaToDdsTool, ToolSuffix) +printLog(log, "") + +# For each interface directory +printLog(log, ">>> Export interface <<<") +mkPath(log, ExportBuildDirectory + "/" + InterfaceExportDirectory) +for dirs in InterfaceSourceDirectories: + niouname = dirs[0].replace("/", "_") + newpath = ExportBuildDirectory + "/" + InterfaceExportDirectory + "/" + niouname + mkPath(log, newpath) + for dir in dirs: + mkPath(log, DatabaseDirectory + "/" + dir) + copyFilesExtNoSubdirIfNeeded(log, DatabaseDirectory + "/" + dir, newpath, ".tga") + copyFilesExtNoSubdirIfNeeded(log, DatabaseDirectory + "/" + dir, newpath, ".png") +printLog(log, "") + +# For each interface directory to compress in one DXTC +printLog(log, ">>> Export interface dxtc <<<") +mkPath(log, ExportBuildDirectory + "/" + InterfaceDxtcExportDirectory) +for dir in InterfaceDxtcSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) + copyFilesExtNoSubdirIfNeeded(log, DatabaseDirectory + "/" + dir, ExportBuildDirectory + "/" + InterfaceDxtcExportDirectory, ".tga") + copyFilesExtNoSubdirIfNeeded(log, DatabaseDirectory + "/" + dir, ExportBuildDirectory + "/" + InterfaceDxtcExportDirectory, ".png") +printLog(log, "") + +# For each interface fullscreen directory compress independently all in dds +printLog(log, ">>> Export interface fullscreen <<<") +if TgaToDds == "": + toolLogFail(log, TgaToDdsTool, ToolSuffix) +else: + mkPath(log, ExportBuildDirectory + "/" + InterfaceFullscreenExportDirectory) + for dir in InterfaceFullscreenSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) + files = findFiles(log, DatabaseDirectory + "/" + dir, "", ".tga") + for file in files: + sourceFile = DatabaseDirectory + "/" + dir + "/" + file + destFile = ExportBuildDirectory + "/" + InterfaceFullscreenExportDirectory + "/" + os.path.basename(file)[0:-len(".tga")] + ".dds" + if needUpdateLogRemoveDest(log, sourceFile, destFile): + subprocess.call([ TgaToDds, sourceFile, "-o", destFile, "-a", "5" ]) + files = findFiles(log, DatabaseDirectory + "/" + dir, "", ".png") + for file in files: + sourceFile = DatabaseDirectory + "/" + dir + "/" + file + destFile = ExportBuildDirectory + "/" + InterfaceFullscreenExportDirectory + "/" + os.path.basename(file)[0:-len(".png")] + ".dds" + if needUpdateLogRemoveDest(log, sourceFile, destFile): + subprocess.call([ TgaToDds, sourceFile, "-o", destFile, "-a", "5" ]) +printLog(log, "") + +# For each interface 3d directory +printLog(log, ">>> Export interface 3d <<<") +mkPath(log, ExportBuildDirectory + "/" + Interface3DExportDirectory) +for dir in Interface3DSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) + copyFiles(log, DatabaseDirectory + "/" + dir, ExportBuildDirectory + "/" + Interface3DExportDirectory) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/interface/2_build.py b/code/nel/tools/build_gamedata/processes/interface/2_build.py old mode 100755 new mode 100644 index 4dfead25b..af25b919e --- a/code/nel/tools/build_gamedata/processes/interface/2_build.py +++ b/code/nel/tools/build_gamedata/processes/interface/2_build.py @@ -1,83 +1,83 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build interface -# \date 2009-03-10 13:13GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build interface -# -# 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 interface") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# Find tools -BuildInterface = findTool(log, ToolDirectories, BuildInterfaceTool, ToolSuffix) -printLog(log, "") - -# For each interface directory -printLog(log, ">>> Build interface <<<") -if BuildInterface == "": - toolLogFail(log, BuildInterfaceTool, ToolSuffix) -else: - mkPath(log, ExportBuildDirectory + "/" + InterfaceBuildDirectory) - for dir in os.listdir(ExportBuildDirectory + "/" + InterfaceExportDirectory): - dirPath = ExportBuildDirectory + "/" + InterfaceExportDirectory + "/" + dir - if (os.path.isdir(dirPath)) and dir != ".svn" and dir != "*.*": - texturePath = ExportBuildDirectory + "/" + InterfaceBuildDirectory + "/texture_" + dir + ".tga" - if needUpdateDirNoSubdirFile(log, dirPath, texturePath): - subprocess.call([ BuildInterface, texturePath, dirPath ]) - else: - printLog(log, "SKIP " + texturePath) -printLog(log, "") - -# For each interface directory to compress in one DXTC -printLog(log, ">>> Build interface dxtc <<<") -if BuildInterface == "": - toolLogFail(log, BuildInterfaceTool, ToolSuffix) -else: - mkPath(log, ExportBuildDirectory + "/" + InterfaceDxtcBuildDirectory) - dirPath = ExportBuildDirectory + "/" + InterfaceDxtcExportDirectory - texturePath = ExportBuildDirectory + "/" + InterfaceDxtcBuildDirectory + "/texture_interfaces_dxtc.tga" - if needUpdateDirNoSubdirFile(log, dirPath, texturePath): - subprocess.call([ BuildInterface, texturePath, dirPath ]) - else: - printLog(log, "SKIP " + texturePath) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 2_build.py +# \brief Build interface +# \date 2009-03-10 13:13GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Build interface +# +# 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 interface") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +# Find tools +BuildInterface = findTool(log, ToolDirectories, BuildInterfaceTool, ToolSuffix) +printLog(log, "") + +# For each interface directory +printLog(log, ">>> Build interface <<<") +if BuildInterface == "": + toolLogFail(log, BuildInterfaceTool, ToolSuffix) +else: + mkPath(log, ExportBuildDirectory + "/" + InterfaceBuildDirectory) + for dir in os.listdir(ExportBuildDirectory + "/" + InterfaceExportDirectory): + dirPath = ExportBuildDirectory + "/" + InterfaceExportDirectory + "/" + dir + if (os.path.isdir(dirPath)) and dir != ".svn" and dir != "*.*": + texturePath = ExportBuildDirectory + "/" + InterfaceBuildDirectory + "/texture_" + dir + ".tga" + if needUpdateDirNoSubdirFile(log, dirPath, texturePath): + subprocess.call([ BuildInterface, texturePath, dirPath ]) + else: + printLog(log, "SKIP " + texturePath) +printLog(log, "") + +# For each interface directory to compress in one DXTC +printLog(log, ">>> Build interface dxtc <<<") +if BuildInterface == "": + toolLogFail(log, BuildInterfaceTool, ToolSuffix) +else: + mkPath(log, ExportBuildDirectory + "/" + InterfaceDxtcBuildDirectory) + dirPath = ExportBuildDirectory + "/" + InterfaceDxtcExportDirectory + texturePath = ExportBuildDirectory + "/" + InterfaceDxtcBuildDirectory + "/texture_interfaces_dxtc.tga" + if needUpdateDirNoSubdirFile(log, dirPath, texturePath): + subprocess.call([ BuildInterface, texturePath, dirPath ]) + else: + printLog(log, "SKIP " + texturePath) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/interface/3_install.py b/code/nel/tools/build_gamedata/processes/interface/3_install.py old mode 100755 new mode 100644 index d7f052561..7a771b420 --- a/code/nel/tools/build_gamedata/processes/interface/3_install.py +++ b/code/nel/tools/build_gamedata/processes/interface/3_install.py @@ -1,69 +1,69 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install interface -# \date 2009-03-10 13:13GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install interface -# -# 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, "--- Install interface") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -installPath = InstallDirectory + "/" + InterfaceInstallDirectory -mkPath(log, installPath) - -printLog(log, ">>> Install interface <<<") -mkPath(log, ExportBuildDirectory + "/" + InterfaceBuildDirectory) -copyFilesNoTreeIfNeeded(log, ExportBuildDirectory + "/" + InterfaceBuildDirectory, installPath) - -printLog(log, ">>> Install interface dxtc <<<") -mkPath(log, ExportBuildDirectory + "/" + InterfaceDxtcBuildDirectory) -copyFilesNoTreeIfNeeded(log, ExportBuildDirectory + "/" + InterfaceDxtcBuildDirectory, installPath) - -printLog(log, ">>> Install interface fullscreen <<<") -mkPath(log, ExportBuildDirectory + "/" + InterfaceFullscreenExportDirectory) -copyFilesNoTreeIfNeeded(log, ExportBuildDirectory + "/" + InterfaceFullscreenExportDirectory, installPath) - -printLog(log, ">>> Install interface 3d <<<") -mkPath(log, ExportBuildDirectory + "/" + Interface3DExportDirectory) -copyFilesNoTreeIfNeeded(log, ExportBuildDirectory + "/" + Interface3DExportDirectory, installPath) - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install interface +# \date 2009-03-10 13:13GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install interface +# +# 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 interface") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +installPath = InstallDirectory + "/" + InterfaceInstallDirectory +mkPath(log, installPath) + +printLog(log, ">>> Install interface <<<") +mkPath(log, ExportBuildDirectory + "/" + InterfaceBuildDirectory) +copyFilesNoTreeIfNeeded(log, ExportBuildDirectory + "/" + InterfaceBuildDirectory, installPath) + +printLog(log, ">>> Install interface dxtc <<<") +mkPath(log, ExportBuildDirectory + "/" + InterfaceDxtcBuildDirectory) +copyFilesNoTreeIfNeeded(log, ExportBuildDirectory + "/" + InterfaceDxtcBuildDirectory, installPath) + +printLog(log, ">>> Install interface fullscreen <<<") +mkPath(log, ExportBuildDirectory + "/" + InterfaceFullscreenExportDirectory) +copyFilesNoTreeIfNeeded(log, ExportBuildDirectory + "/" + InterfaceFullscreenExportDirectory, installPath) + +printLog(log, ">>> Install interface 3d <<<") +mkPath(log, ExportBuildDirectory + "/" + Interface3DExportDirectory) +copyFilesNoTreeIfNeeded(log, ExportBuildDirectory + "/" + Interface3DExportDirectory, installPath) + +printLog(log, "") +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 old mode 100755 new mode 100644 index 32a74bf63..18d5ea6f7 --- a/code/nel/tools/build_gamedata/processes/ligo/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/ligo/0_setup.py @@ -1,120 +1,121 @@ -#!/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("\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 +#!/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/ligo/1_export.py b/code/nel/tools/build_gamedata/processes/ligo/1_export.py old mode 100755 new mode 100644 index e0f9bab77..4d78b0baf --- a/code/nel/tools/build_gamedata/processes/ligo/1_export.py +++ b/code/nel/tools/build_gamedata/processes/ligo/1_export.py @@ -1,150 +1,150 @@ -#!/usr/bin/python -# -# \file 1_export.py -# \brief Export ligo -# \date 2010-05-24 08:13GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export 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") -if os.path.isfile("temp_log.log"): - os.remove("temp_log.log") -log = open("temp_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 ligo") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -if LigoExportLand == "" or LigoExportOnePass == 1: - # Find tools - Max = findMax(log, MaxDirectory, MaxExecutable) - ExecTimeout = findTool(log, ToolDirectories, ExecTimeoutTool, ToolSuffix) - printLog(log, "") - - # For each directory - printLog(log, ">>> Export ligo 3dsmax <<<") - - ligoIniPath = MaxUserDirectory + "/plugcfg/nelligo.ini" - mkPath(log, ExportBuildDirectory + "/" + SmallbankExportDirectory) - mkPath(log, DatabaseDirectory + "/" + LigoMaxSourceDirectory) - mkPath(log, ExportBuildDirectory + "/" + LigoEcosystemExportDirectory) - mkPath(log, ExportBuildDirectory + "/" + LigoEcosystemIgExportDirectory) - mkPath(log, ExportBuildDirectory + "/" + LigoEcosystemZoneExportDirectory) - mkPath(log, ExportBuildDirectory + "/" + LigoEcosystemZoneLigoExportDirectory) - mkPath(log, ExportBuildDirectory + "/" + LigoEcosystemCmbExportDirectory) - mkPath(log, DatabaseDirectory + "/" + ZoneSourceDirectory[0]) - tagDirectory = ExportBuildDirectory + "/" + LigoEcosystemTagExportDirectory - mkPath(log, tagDirectory) - if (needUpdateDirByTagLogFiltered(log, DatabaseDirectory + "/" + LigoMaxSourceDirectory, ".max", tagDirectory, ".max.tag", [ "zonematerial", "zonetransition", "zonespecial" ])): - printLog(log, "WRITE " + ligoIniPath) - ligoIni = open(ligoIniPath, "w") - ligoIni.write("[LigoConfig]\n") - ligoIni.write("LigoPath=" + DatabaseDirectory + "/" + LigoMaxSourceDirectory + "/\n") - ligoIni.write("LigoExportPath=" + ExportBuildDirectory + "/" + LigoEcosystemExportDirectory + "/\n") - ligoIni.write("LigoOldZonePath=" + DatabaseDirectory + "/" + ZoneSourceDirectory[0] + "/\n") - ligoIni.close() - - outputLogfile = ScriptDirectory + "/processes/ligo/log.log" - smallBank = ExportBuildDirectory + "/" + SmallbankExportDirectory + "/" + BankTileBankName + ".smallbank" - maxRunningTagFile = tagDirectory + "/max_running.tag" - - scriptSrc = "maxscript/nel_ligo_export.ms" - scriptDst = MaxUserDirectory + "/scripts/nel_ligo_export.ms" - - tagList = findFiles(log, tagDirectory, "", ".max.tag") - tagLen = len(tagList) - - if os.path.isfile(scriptDst): - os.remove(scriptDst) - - tagDiff = 1 - printLog(log, "WRITE " + scriptDst) - sSrc = open(scriptSrc, "r") - sDst = open(scriptDst, "w") - for line in sSrc: - newline = line.replace("%OutputLogfile%", outputLogfile) - newline = newline.replace("%TagDirectory%", tagDirectory) - newline = newline.replace("%SmallBankFilename%", smallBank) - sDst.write(newline) - sSrc.close() - sDst.close() - - zeroRetryLimit = 3 - while tagDiff > 0: - mrt = open(maxRunningTagFile, "w") - mrt.write("moe-moe-kyun") - mrt.close() - printLog(log, "MAXSCRIPT " + scriptDst) - subprocess.call([ Max, "-U", "MAXScript", "nel_ligo_export.ms", "-q", "-mi", "-mip" ]) - if os.path.exists(outputLogfile): - try: - lSrc = open(outputLogfile, "r") - for line in lSrc: - lineStrip = line.strip() - if (len(lineStrip) > 0): - printLog(log, lineStrip) - lSrc.close() - os.remove(outputLogfile) - except Exception: - printLog(log, "ERROR Failed to read 3dsmax log") - else: - printLog(log, "WARNING No 3dsmax log") - tagList = findFiles(log, tagDirectory, "", ".max.tag") - newTagLen = len(tagList) - tagDiff = newTagLen - tagLen - tagLen = newTagLen - addTagDiff = 0 - if os.path.exists(maxRunningTagFile): - printLog(log, "FAIL 3ds Max crashed and/or file export failed!") - if tagDiff == 0: - if zeroRetryLimit > 0: - zeroRetryLimit = zeroRetryLimit - 1 - addTagDiff = 1 - else: - printLog(log, "FAIL Retry limit reached!") - else: - addTagDiff = 1 - os.remove(maxRunningTagFile) - printLog(log, "Exported " + str(tagDiff) + " .max files!") - tagDiff += addTagDiff - - os.remove(scriptDst) - printLog(log, "") - -log.close() -if os.path.isfile("log.log"): - os.remove("log.log") -shutil.move("temp_log.log", "log.log") - - -# end of file +#!/usr/bin/python +# +# \file 1_export.py +# \brief Export ligo +# \date 2010-05-24 08:13GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export 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") +if os.path.isfile("temp_log.log"): + os.remove("temp_log.log") +log = open("temp_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 ligo") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +if LigoExportLand == "" or LigoExportOnePass == 1: + # Find tools + Max = findMax(log, MaxDirectory, MaxExecutable) + ExecTimeout = findTool(log, ToolDirectories, ExecTimeoutTool, ToolSuffix) + printLog(log, "") + + # For each directory + printLog(log, ">>> Export ligo 3dsmax <<<") + + ligoIniPath = MaxUserDirectory + "/plugcfg/nelligo.ini" + mkPath(log, ExportBuildDirectory + "/" + SmallbankExportDirectory) + mkPath(log, DatabaseDirectory + "/" + LigoMaxSourceDirectory) + mkPath(log, ExportBuildDirectory + "/" + LigoEcosystemExportDirectory) + mkPath(log, ExportBuildDirectory + "/" + LigoEcosystemIgExportDirectory) + mkPath(log, ExportBuildDirectory + "/" + LigoEcosystemZoneExportDirectory) + mkPath(log, ExportBuildDirectory + "/" + LigoEcosystemZoneLigoExportDirectory) + mkPath(log, ExportBuildDirectory + "/" + LigoEcosystemCmbExportDirectory) + mkPath(log, DatabaseDirectory + "/" + ZoneSourceDirectory[0]) + tagDirectory = ExportBuildDirectory + "/" + LigoEcosystemTagExportDirectory + mkPath(log, tagDirectory) + if (needUpdateDirByTagLogFiltered(log, DatabaseDirectory + "/" + LigoMaxSourceDirectory, ".max", tagDirectory, ".max.tag", [ "zonematerial", "zonetransition", "zonespecial" ])): + printLog(log, "WRITE " + ligoIniPath) + ligoIni = open(ligoIniPath, "w") + ligoIni.write("[LigoConfig]\n") + ligoIni.write("LigoPath=" + DatabaseDirectory + "/" + LigoMaxSourceDirectory + "/\n") + ligoIni.write("LigoExportPath=" + ExportBuildDirectory + "/" + LigoEcosystemExportDirectory + "/\n") + ligoIni.write("LigoOldZonePath=" + DatabaseDirectory + "/" + ZoneSourceDirectory[0] + "/\n") + ligoIni.close() + + outputLogfile = ScriptDirectory + "/processes/ligo/log.log" + smallBank = ExportBuildDirectory + "/" + SmallbankExportDirectory + "/" + BankTileBankName + ".smallbank" + maxRunningTagFile = tagDirectory + "/max_running.tag" + + scriptSrc = "maxscript/nel_ligo_export.ms" + scriptDst = MaxUserDirectory + "/scripts/nel_ligo_export.ms" + + tagList = findFiles(log, tagDirectory, "", ".max.tag") + tagLen = len(tagList) + + if os.path.isfile(scriptDst): + os.remove(scriptDst) + + tagDiff = 1 + printLog(log, "WRITE " + scriptDst) + sSrc = open(scriptSrc, "r") + sDst = open(scriptDst, "w") + for line in sSrc: + newline = line.replace("%OutputLogfile%", outputLogfile) + newline = newline.replace("%TagDirectory%", tagDirectory) + newline = newline.replace("%SmallBankFilename%", smallBank) + sDst.write(newline) + sSrc.close() + sDst.close() + + zeroRetryLimit = 3 + while tagDiff > 0: + mrt = open(maxRunningTagFile, "w") + mrt.write("moe-moe-kyun") + mrt.close() + printLog(log, "MAXSCRIPT " + scriptDst) + subprocess.call([ Max, "-U", "MAXScript", "nel_ligo_export.ms", "-q", "-mi", "-mip" ]) + if os.path.exists(outputLogfile): + try: + lSrc = open(outputLogfile, "r") + for line in lSrc: + lineStrip = line.strip() + if (len(lineStrip) > 0): + printLog(log, lineStrip) + lSrc.close() + os.remove(outputLogfile) + except Exception: + printLog(log, "ERROR Failed to read 3dsmax log") + else: + printLog(log, "WARNING No 3dsmax log") + tagList = findFiles(log, tagDirectory, "", ".max.tag") + newTagLen = len(tagList) + tagDiff = newTagLen - tagLen + tagLen = newTagLen + addTagDiff = 0 + if os.path.exists(maxRunningTagFile): + printLog(log, "FAIL 3ds Max crashed and/or file export failed!") + if tagDiff == 0: + if zeroRetryLimit > 0: + zeroRetryLimit = zeroRetryLimit - 1 + addTagDiff = 1 + else: + printLog(log, "FAIL Retry limit reached!") + else: + addTagDiff = 1 + os.remove(maxRunningTagFile) + printLog(log, "Exported " + str(tagDiff) + " .max files!") + tagDiff += addTagDiff + + os.remove(scriptDst) + printLog(log, "") + +log.close() +if os.path.isfile("log.log"): + os.remove("log.log") +shutil.move("temp_log.log", "log.log") + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/ligo/2_build.py b/code/nel/tools/build_gamedata/processes/ligo/2_build.py old mode 100755 new mode 100644 index 54f5d75e8..c7b9593cc --- a/code/nel/tools/build_gamedata/processes/ligo/2_build.py +++ b/code/nel/tools/build_gamedata/processes/ligo/2_build.py @@ -1,69 +1,69 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build ligo -# \date 2010-05-24 08:13GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build 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, "--- Build ligo") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -if LigoExportLand != "": - ExecTimeout = findTool(log, ToolDirectories, ExecTimeoutTool, ToolSuffix) - LandExport = findTool(log, ToolDirectories, LandExportTool, ToolSuffix) - - printLog(log, ">>> Generate ligo zone <<<") - if LandExport == "": - toolLogFail(log, LandExportTool, ToolSuffix) - elif ExecTimeout == "": - toolLogfail(log, ExecTimeoutTool, ToolSuffix) - else: - subprocess.call([ ExecTimeout, str(LigoExportTimeout), LandExport, ActiveProjectDirectory + "/generated/land_exporter.cfg" ]) - - printLog(log, ">>> Copy to zone builder <<<") - dirSource = ExportBuildDirectory + "/" + LigoZoneBuildDirectory - dirTarget = ExportBuildDirectory + "/" + ZoneExportDirectory - mkPath(log, dirSource) - mkPath(log, dirTarget) - copyFilesExtReplaceNoTreeIfNeeded(log, dirSource, dirTarget, ".zonel", ".zone") - copyFilesExtNoTreeIfNeeded(log, dirSource, dirTarget, ".zonenh") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 2_build.py +# \brief Build ligo +# \date 2010-05-24 08:13GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Build 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, "--- Build ligo") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +if LigoExportLand != "": + ExecTimeout = findTool(log, ToolDirectories, ExecTimeoutTool, ToolSuffix) + LandExport = findTool(log, ToolDirectories, LandExportTool, ToolSuffix) + + printLog(log, ">>> Generate ligo zone <<<") + if LandExport == "": + toolLogFail(log, LandExportTool, ToolSuffix) + elif ExecTimeout == "": + toolLogfail(log, ExecTimeoutTool, ToolSuffix) + else: + subprocess.call([ ExecTimeout, str(LigoExportTimeout), LandExport, ActiveProjectDirectory + "/generated/land_exporter.cfg" ]) + + printLog(log, ">>> Copy to zone builder <<<") + dirSource = ExportBuildDirectory + "/" + LigoZoneBuildDirectory + dirTarget = ExportBuildDirectory + "/" + ZoneExportDirectory + mkPath(log, dirSource) + mkPath(log, dirTarget) + copyFilesExtReplaceNoTreeIfNeeded(log, dirSource, dirTarget, ".zonel", ".zone") + copyFilesExtNoTreeIfNeeded(log, dirSource, dirTarget, ".zonenh") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/ligo/3_install.py b/code/nel/tools/build_gamedata/processes/ligo/3_install.py old mode 100755 new mode 100644 index 9d9e59b54..a65f6348b --- a/code/nel/tools/build_gamedata/processes/ligo/3_install.py +++ b/code/nel/tools/build_gamedata/processes/ligo/3_install.py @@ -1,50 +1,50 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install ligo -# \date 2010-05-24 08:13GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install 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, "--- Install ligo") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install ligo +# \date 2010-05-24 08:13GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install 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_local import * +from process import * +from tools import * +from directories import * + +printLog(log, "") +printLog(log, "-------") +printLog(log, "--- Install ligo") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/ligo/maxscript/nel_ligo_export.ms b/code/nel/tools/build_gamedata/processes/ligo/maxscript/nel_ligo_export.ms old mode 100755 new mode 100644 diff --git a/code/nel/tools/build_gamedata/processes/map/0_setup.py b/code/nel/tools/build_gamedata/processes/map/0_setup.py old mode 100755 new mode 100644 index 5cfc189d5..25d54d24d --- a/code/nel/tools/build_gamedata/processes/map/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/map/0_setup.py @@ -1,79 +1,79 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief Setup map -# \date 2009-03-10 14:56GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup map -# -# 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 map") -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 <<<") -for dir in MapSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) -for dir in MapUncompressedSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) -if MapHlsBankFileName != None or MapPanoplyFileList != None: - for panoplyCfg in MapPanoplySourceDirectories: - mkPath(log, DatabaseDirectory + "/" + panoplyCfg[2]) - mkPath(log, DatabaseDirectory + "/" + panoplyCfg[3]) - -# Setup export directories -printLog(log, ">>> Setup export directories <<<") -mkPath(log, ExportBuildDirectory + "/" + MapExportDirectory) -mkPath(log, ExportBuildDirectory + "/" + MapUncompressedExportDirectory) - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") -mkPath(log, ExportBuildDirectory + "/" + MapBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + MapTagBuildDirectory) -if MapHlsBankFileName != None or MapPanoplyFileList != None: - mkPath(log, ExportBuildDirectory + "/" + MapPanoplyBuildDirectory) - mkPath(log, ExportBuildDirectory + "/" + MapPanoplyHlsInfoBuildDirectory) - mkPath(log, ExportBuildDirectory + "/" + MapPanoplyHlsBankBuildDirectory) - mkPath(log, ExportBuildDirectory + "/" + MapPanoplyCacheBuildDirectory) - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") -mkPath(log, InstallDirectory + "/" + MapInstallDirectory) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief Setup map +# \date 2009-03-10 14:56GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup map +# +# 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 map") +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 <<<") +for dir in MapSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) +for dir in MapUncompressedSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) +if MapHlsBankFileName != None or MapPanoplyFileList != None: + for panoplyCfg in MapPanoplySourceDirectories: + mkPath(log, DatabaseDirectory + "/" + panoplyCfg[2]) + mkPath(log, DatabaseDirectory + "/" + panoplyCfg[3]) + +# Setup export directories +printLog(log, ">>> Setup export directories <<<") +mkPath(log, ExportBuildDirectory + "/" + MapExportDirectory) +mkPath(log, ExportBuildDirectory + "/" + MapUncompressedExportDirectory) + +# Setup build directories +printLog(log, ">>> Setup build directories <<<") +mkPath(log, ExportBuildDirectory + "/" + MapBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + MapTagBuildDirectory) +if MapHlsBankFileName != None or MapPanoplyFileList != None: + mkPath(log, ExportBuildDirectory + "/" + MapPanoplyBuildDirectory) + mkPath(log, ExportBuildDirectory + "/" + MapPanoplyHlsInfoBuildDirectory) + mkPath(log, ExportBuildDirectory + "/" + MapPanoplyHlsBankBuildDirectory) + mkPath(log, ExportBuildDirectory + "/" + MapPanoplyCacheBuildDirectory) + +# Setup client directories +printLog(log, ">>> Setup client directories <<<") +mkPath(log, InstallDirectory + "/" + MapInstallDirectory) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/map/1_export.py b/code/nel/tools/build_gamedata/processes/map/1_export.py old mode 100755 new mode 100644 index a77d32082..9be2e45c6 --- a/code/nel/tools/build_gamedata/processes/map/1_export.py +++ b/code/nel/tools/build_gamedata/processes/map/1_export.py @@ -1,71 +1,71 @@ -#!/usr/bin/python -# -# \file 1_export.py -# \brief Export map -# \date 2009-03-10 13:13GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export map -# -# 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 map") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -printLog(log, ">>> Export maps that will be compressed to DDS <<<") -for dir in MapSourceDirectories: - sourcePath = DatabaseDirectory + "/" + dir - mkPath(log, sourcePath) - destPath = ExportBuildDirectory + "/" + MapExportDirectory - mkPath(log, destPath) - copyFilesExtNoSubdirIfNeeded(log, sourcePath, destPath, ".dds") - copyFilesExtNoSubdirIfNeeded(log, sourcePath, destPath, ".png") - copyFilesExtNoSubdirIfNeeded(log, sourcePath, destPath, ".tga") -printLog(log, "") - -printLog(log, ">>> Export maps that will not be compressed <<<") -for dir in MapUncompressedSourceDirectories: - sourcePath = DatabaseDirectory + "/" + dir - mkPath(log, sourcePath) - destPath = ExportBuildDirectory + "/" + MapUncompressedExportDirectory - mkPath(log, destPath) - copyFilesExtNoSubdirIfNeeded(log, sourcePath, destPath, ".dds") - copyFilesExtNoSubdirIfNeeded(log, sourcePath, destPath, ".png") - copyFilesExtNoSubdirIfNeeded(log, sourcePath, destPath, ".tga") -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 1_export.py +# \brief Export map +# \date 2009-03-10 13:13GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export map +# +# 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 map") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +printLog(log, ">>> Export maps that will be compressed to DDS <<<") +for dir in MapSourceDirectories: + sourcePath = DatabaseDirectory + "/" + dir + mkPath(log, sourcePath) + destPath = ExportBuildDirectory + "/" + MapExportDirectory + mkPath(log, destPath) + copyFilesExtNoSubdirIfNeeded(log, sourcePath, destPath, ".dds") + copyFilesExtNoSubdirIfNeeded(log, sourcePath, destPath, ".png") + copyFilesExtNoSubdirIfNeeded(log, sourcePath, destPath, ".tga") +printLog(log, "") + +printLog(log, ">>> Export maps that will not be compressed <<<") +for dir in MapUncompressedSourceDirectories: + sourcePath = DatabaseDirectory + "/" + dir + mkPath(log, sourcePath) + destPath = ExportBuildDirectory + "/" + MapUncompressedExportDirectory + mkPath(log, destPath) + copyFilesExtNoSubdirIfNeeded(log, sourcePath, destPath, ".dds") + copyFilesExtNoSubdirIfNeeded(log, sourcePath, destPath, ".png") + copyFilesExtNoSubdirIfNeeded(log, sourcePath, destPath, ".tga") +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/map/2_build.py b/code/nel/tools/build_gamedata/processes/map/2_build.py old mode 100755 new mode 100644 index 82a777410..4a9477b8a --- a/code/nel/tools/build_gamedata/processes/map/2_build.py +++ b/code/nel/tools/build_gamedata/processes/map/2_build.py @@ -1,168 +1,168 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build map -# \date 2009-03-10 13:13GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build map -# -# 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 map") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# Find tools -TgaToDds = findTool(log, ToolDirectories, TgaToDdsTool, ToolSuffix) -ExecTimeout = findTool(log, ToolDirectories, ExecTimeoutTool, ToolSuffix) -PanoplyMaker = findTool(log, ToolDirectories, PanoplyMakerTool, ToolSuffix) -HlsBankMaker = findTool(log, ToolDirectories, HlsBankMakerTool, ToolSuffix) -printLog(log, "") - -buildPanoplyTagPath = ExportBuildDirectory + "/" + MapTagBuildDirectory + "/build_panoply.tag" -buildCompressTagPath = ExportBuildDirectory + "/" + MapTagBuildDirectory + "/build_compress.tag" - -if MapPanoplyFileList != None: - printLog(log, ">>> Panoply build <<<") - mkPath(log, ExportBuildDirectory + "/" + MapTagBuildDirectory) - directoriesCheck = [ ] - for panoplyCfg in MapPanoplySourceDirectories: - directoriesCheck += [ panoplyCfg[2] ] - directoriesCheck += [ panoplyCfg[3] ] - if (needUpdateMultiDirNoSubdirFile(log, DatabaseDirectory, directoriesCheck, buildPanoplyTagPath)): - mkPath(log, ActiveProjectDirectory + "/generated") - mkPath(log, ExportBuildDirectory + "/" + MapPanoplyBuildDirectory) - mkPath(log, ExportBuildDirectory + "/" + MapPanoplyHlsInfoBuildDirectory) - mkPath(log, ExportBuildDirectory + "/" + MapPanoplyCacheBuildDirectory) - printLog(log, "") - printLog(log, ">>> Move panoply and hls to cache <<<") - removeFilesDirsRecursive(log, ExportBuildDirectory + "/" + MapPanoplyCacheBuildDirectory) - moveDir(log, ExportBuildDirectory + "/" + MapPanoplyBuildDirectory, ExportBuildDirectory + "/" + MapPanoplyCacheBuildDirectory) - mkPath(log, ExportBuildDirectory + "/" + MapPanoplyBuildDirectory) - moveFilesNoSubdir(log, ExportBuildDirectory + "/" + MapPanoplyHlsInfoBuildDirectory, ExportBuildDirectory + "/" + MapPanoplyCacheBuildDirectory) - printLog(log, "") - for panoplyCfg in MapPanoplySourceDirectories: - printLog(log, ">>> Panoply " + panoplyCfg[1] + " <<<") - mkPath(log, DatabaseDirectory + "/" + panoplyCfg[2]) - mkPath(log, DatabaseDirectory + "/" + panoplyCfg[3]) - cfg = open(ActiveProjectDirectory + "/generated/current_panoply.cfg", "w") - cfgCommon = open(ActiveProjectDirectory + "/" + panoplyCfg[0], "r") - cfgRace = open(ActiveProjectDirectory + "/" + panoplyCfg[1], "r") - cfg.write("\n") - cfg.write("// CURRENT PANOPLY CONFIGURATION\n") - cfg.write("\n") - cfg.write("input_path = \"" + DatabaseDirectory + "/" + panoplyCfg[2] + "\";\n") - cfg.write("additionnal_paths = \"" + DatabaseDirectory + "/" + panoplyCfg[3] + "\";\n") - cfg.write("output_path = \"" + ExportBuildDirectory + "/" + MapPanoplyBuildDirectory + "\";\n") - cfg.write("hls_info_path = \"" + ExportBuildDirectory + "/" + MapPanoplyHlsInfoBuildDirectory + "\";\n") - cfg.write("cache_path = \"" + ExportBuildDirectory + "/" + MapPanoplyCacheBuildDirectory + "\";\n") - cfg.write("\n") - cfg.write("/////////////////////////////////////////////\n") - cfg.write("\n") - for line in cfgCommon: - cfg.write(line) - for line in cfgRace: - cfg.write(line) - cfg.close() - cfgCommon.close() - cfgRace.close() - subprocess.call([ PanoplyMaker, ActiveProjectDirectory + "/generated/current_panoply.cfg" ]) - printLog(log, "") - tagFile = open(buildPanoplyTagPath, "w") - tagFile.write(time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())) + "\n") - tagFile.close() - else: - printLog(log, "SKIP *.*") - printLog(log, "") - -printLog(log, ">>> Compress TGA and PNG maps to DDS <<<") -if TgaToDds == "": - toolLogFail(log, TgaToDdsTool, ToolSuffix) -elif ExecTimeout == "": - toolLogFail(log, ExecTimeoutTool, ToolSuffix) -else: - destPath = ExportBuildDirectory + "/" + MapBuildDirectory - mkPath(log, destPath) - sourcePaths = [ ExportBuildDirectory + "/" + MapExportDirectory ] - writeTag = 0 - if MapPanoplyFileList != None: - if needUpdate(log, buildPanoplyTagPath, buildCompressTagPath): - sourcePaths += [ ExportBuildDirectory + "/" + MapPanoplyBuildDirectory ] - else: - printLog(log, "SKIP " + ExportBuildDirectory + "/" + MapPanoplyBuildDirectory + "/*.*") - for sourcePath in sourcePaths: - mkPath(log, sourcePath) - files = os.listdir(sourcePath) - len_tga_png = len(".tga") - len_dds = len(".dds") - for fileName in files: - if isLegalFileName(fileName): - sourceFile = sourcePath + "/" + fileName - if os.path.isfile(sourceFile): - if (fileName[-len_tga_png:].lower() == ".tga") or (fileName[-len_tga_png:].lower() == ".png"): - destFile = destPath + "/" + os.path.basename(fileName)[0:-len_tga_png] + ".dds" - if needUpdateLogRemoveDest(log, sourceFile, destFile): - subprocess.call([ ExecTimeout, str(MapsBuildTimeout), TgaToDds, sourceFile, "-o", destFile, "-m", "-r" + str(ReduceBitmapFactor) ]) - writeTag = 1 - elif fileName[-len_dds:].lower() == ".dds": - copyFileIfNeeded(log, sourceFile, destPath + "/" + os.path.basename(fileName)) - writeTag = 1 - elif not os.path.isdir(sourceFile): - printLog(log, "FAIL ?! file not dir or file ?! " + sourceFile) - if writeTag: - tagFile = open(buildCompressTagPath, "w") - tagFile.write(time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())) + "\n") - tagFile.close() -printLog(log, "") - -if MapHlsBankFileName != None: - printLog(log, ">>> Build the HLSBank <<<") - if HlsBankMaker == "": - toolLogFail(log, HlsBankMakerTool, ToolSuffix) - else: - mkPath(log, ExportBuildDirectory + "/" + MapPanoplyHlsInfoBuildDirectory) - mkPath(log, ExportBuildDirectory + "/" + MapPanoplyHlsBankBuildDirectory) - hlsBankPath = ExportBuildDirectory + "/" + MapPanoplyHlsBankBuildDirectory + "/" + MapHlsBankFileName - if (needUpdate(log, buildPanoplyTagPath, hlsBankPath) or needUpdate(log, buildCompressTagPath, hlsBankPath)): - if os.path.isfile(hlsBankPath): - os.remove(hlsBankPath) - subprocess.call([ HlsBankMaker, ExportBuildDirectory + "/" + MapPanoplyHlsInfoBuildDirectory, hlsBankPath ]) - else: - printLog(log,"SKIP " + hlsBankPath) - printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 2_build.py +# \brief Build map +# \date 2009-03-10 13:13GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Build map +# +# 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 map") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +# Find tools +TgaToDds = findTool(log, ToolDirectories, TgaToDdsTool, ToolSuffix) +ExecTimeout = findTool(log, ToolDirectories, ExecTimeoutTool, ToolSuffix) +PanoplyMaker = findTool(log, ToolDirectories, PanoplyMakerTool, ToolSuffix) +HlsBankMaker = findTool(log, ToolDirectories, HlsBankMakerTool, ToolSuffix) +printLog(log, "") + +buildPanoplyTagPath = ExportBuildDirectory + "/" + MapTagBuildDirectory + "/build_panoply.tag" +buildCompressTagPath = ExportBuildDirectory + "/" + MapTagBuildDirectory + "/build_compress.tag" + +if MapPanoplyFileList != None: + printLog(log, ">>> Panoply build <<<") + mkPath(log, ExportBuildDirectory + "/" + MapTagBuildDirectory) + directoriesCheck = [ ] + for panoplyCfg in MapPanoplySourceDirectories: + directoriesCheck += [ panoplyCfg[2] ] + directoriesCheck += [ panoplyCfg[3] ] + if (needUpdateMultiDirNoSubdirFile(log, DatabaseDirectory, directoriesCheck, buildPanoplyTagPath)): + mkPath(log, ActiveProjectDirectory + "/generated") + mkPath(log, ExportBuildDirectory + "/" + MapPanoplyBuildDirectory) + mkPath(log, ExportBuildDirectory + "/" + MapPanoplyHlsInfoBuildDirectory) + mkPath(log, ExportBuildDirectory + "/" + MapPanoplyCacheBuildDirectory) + printLog(log, "") + printLog(log, ">>> Move panoply and hls to cache <<<") + removeFilesDirsRecursive(log, ExportBuildDirectory + "/" + MapPanoplyCacheBuildDirectory) + moveDir(log, ExportBuildDirectory + "/" + MapPanoplyBuildDirectory, ExportBuildDirectory + "/" + MapPanoplyCacheBuildDirectory) + mkPath(log, ExportBuildDirectory + "/" + MapPanoplyBuildDirectory) + moveFilesNoSubdir(log, ExportBuildDirectory + "/" + MapPanoplyHlsInfoBuildDirectory, ExportBuildDirectory + "/" + MapPanoplyCacheBuildDirectory) + printLog(log, "") + for panoplyCfg in MapPanoplySourceDirectories: + printLog(log, ">>> Panoply " + panoplyCfg[1] + " <<<") + mkPath(log, DatabaseDirectory + "/" + panoplyCfg[2]) + mkPath(log, DatabaseDirectory + "/" + panoplyCfg[3]) + cfg = open(ActiveProjectDirectory + "/generated/current_panoply.cfg", "w") + cfgCommon = open(ActiveProjectDirectory + "/" + panoplyCfg[0], "r") + cfgRace = open(ActiveProjectDirectory + "/" + panoplyCfg[1], "r") + cfg.write("\n") + cfg.write("// CURRENT PANOPLY CONFIGURATION\n") + cfg.write("\n") + cfg.write("input_path = \"" + DatabaseDirectory + "/" + panoplyCfg[2] + "\";\n") + cfg.write("additionnal_paths = \"" + DatabaseDirectory + "/" + panoplyCfg[3] + "\";\n") + cfg.write("output_path = \"" + ExportBuildDirectory + "/" + MapPanoplyBuildDirectory + "\";\n") + cfg.write("hls_info_path = \"" + ExportBuildDirectory + "/" + MapPanoplyHlsInfoBuildDirectory + "\";\n") + cfg.write("cache_path = \"" + ExportBuildDirectory + "/" + MapPanoplyCacheBuildDirectory + "\";\n") + cfg.write("\n") + cfg.write("/////////////////////////////////////////////\n") + cfg.write("\n") + for line in cfgCommon: + cfg.write(line) + for line in cfgRace: + cfg.write(line) + cfg.close() + cfgCommon.close() + cfgRace.close() + subprocess.call([ PanoplyMaker, ActiveProjectDirectory + "/generated/current_panoply.cfg" ]) + printLog(log, "") + tagFile = open(buildPanoplyTagPath, "w") + tagFile.write(time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())) + "\n") + tagFile.close() + else: + printLog(log, "SKIP *.*") + printLog(log, "") + +printLog(log, ">>> Compress TGA and PNG maps to DDS <<<") +if TgaToDds == "": + toolLogFail(log, TgaToDdsTool, ToolSuffix) +elif ExecTimeout == "": + toolLogFail(log, ExecTimeoutTool, ToolSuffix) +else: + destPath = ExportBuildDirectory + "/" + MapBuildDirectory + mkPath(log, destPath) + sourcePaths = [ ExportBuildDirectory + "/" + MapExportDirectory ] + writeTag = 0 + if MapPanoplyFileList != None: + if needUpdate(log, buildPanoplyTagPath, buildCompressTagPath): + sourcePaths += [ ExportBuildDirectory + "/" + MapPanoplyBuildDirectory ] + else: + printLog(log, "SKIP " + ExportBuildDirectory + "/" + MapPanoplyBuildDirectory + "/*.*") + for sourcePath in sourcePaths: + mkPath(log, sourcePath) + files = os.listdir(sourcePath) + len_tga_png = len(".tga") + len_dds = len(".dds") + for fileName in files: + if isLegalFileName(fileName): + sourceFile = sourcePath + "/" + fileName + if os.path.isfile(sourceFile): + if (fileName[-len_tga_png:].lower() == ".tga") or (fileName[-len_tga_png:].lower() == ".png"): + destFile = destPath + "/" + os.path.basename(fileName)[0:-len_tga_png] + ".dds" + if needUpdateLogRemoveDest(log, sourceFile, destFile): + subprocess.call([ ExecTimeout, str(MapsBuildTimeout), TgaToDds, sourceFile, "-o", destFile, "-m", "-r" + str(ReduceBitmapFactor) ]) + writeTag = 1 + elif fileName[-len_dds:].lower() == ".dds": + copyFileIfNeeded(log, sourceFile, destPath + "/" + os.path.basename(fileName)) + writeTag = 1 + elif not os.path.isdir(sourceFile): + printLog(log, "FAIL ?! file not dir or file ?! " + sourceFile) + if writeTag: + tagFile = open(buildCompressTagPath, "w") + tagFile.write(time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())) + "\n") + tagFile.close() +printLog(log, "") + +if MapHlsBankFileName != None: + printLog(log, ">>> Build the HLSBank <<<") + if HlsBankMaker == "": + toolLogFail(log, HlsBankMakerTool, ToolSuffix) + else: + mkPath(log, ExportBuildDirectory + "/" + MapPanoplyHlsInfoBuildDirectory) + mkPath(log, ExportBuildDirectory + "/" + MapPanoplyHlsBankBuildDirectory) + hlsBankPath = ExportBuildDirectory + "/" + MapPanoplyHlsBankBuildDirectory + "/" + MapHlsBankFileName + if (needUpdate(log, buildPanoplyTagPath, hlsBankPath) or needUpdate(log, buildCompressTagPath, hlsBankPath)): + if os.path.isfile(hlsBankPath): + os.remove(hlsBankPath) + subprocess.call([ HlsBankMaker, ExportBuildDirectory + "/" + MapPanoplyHlsInfoBuildDirectory, hlsBankPath ]) + else: + printLog(log,"SKIP " + hlsBankPath) + printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/map/3_install.py b/code/nel/tools/build_gamedata/processes/map/3_install.py old mode 100755 new mode 100644 index a5a56bb94..fc4c52596 --- a/code/nel/tools/build_gamedata/processes/map/3_install.py +++ b/code/nel/tools/build_gamedata/processes/map/3_install.py @@ -1,91 +1,91 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install map -# \date 2009-03-10 13:13GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install map -# -# 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, "--- Install map") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -installPath = InstallDirectory + "/" + MapInstallDirectory -mkPath(log, installPath) - -printLog(log, ">>> Install map <<<") -sourcePaths = [ ExportBuildDirectory + "/" + MapBuildDirectory ] + [ ExportBuildDirectory + "/" + MapUncompressedExportDirectory ] -for sourcePath in sourcePaths: - mkPath(log, sourcePath) - files = os.listdir(sourcePath) - len_ext = 4 - for fileName in files: - if isLegalFileName(fileName): - sourceFile = sourcePath + "/" + fileName - if os.path.isfile(sourceFile): - if (fileName[-len_ext:].lower() == ".tga") or (fileName[-len_ext:].lower() == ".png") or (fileName[-len_ext:].lower() == ".dds"): - copyFileIfNeeded(log, sourceFile, installPath + "/" + os.path.basename(fileName)) - elif not os.path.isdir(sourceFile): - printLog(log, "FAIL ?! file not dir or file ?! " + sourceFile) - -if MapPanoplyFileList != None: - printLog(log, ">>> Install panoply file list <<<") - buildPanoplyTagPath = ExportBuildDirectory + "/" + MapTagBuildDirectory + "/build_panoply.tag" - mkPath(log, ExportBuildDirectory + "/" + MapTagBuildDirectory) - if needUpdate(log, buildPanoplyTagPath, installPath + "/" + MapPanoplyFileList): - sourcePath = ExportBuildDirectory + "/" + MapPanoplyBuildDirectory - mkPath(log, sourcePath) - printLog(log, "WRITE " + installPath + "/" + MapPanoplyFileList) - lf = open(installPath + "/" + MapPanoplyFileList, "w") - files = os.listdir(sourcePath) - for file in files: - if isLegalFileName(file): - lf.write(file + "\n") - lf.close() - else: - printLog(log, "SKIP " + installPath + "/" + MapPanoplyBuildDirectory) - -if MapHlsBankFileName != None: - printLog(log, ">>> Install map hlsbank <<<") - sourcePath = ExportBuildDirectory + "/" + MapPanoplyHlsBankBuildDirectory - mkPath(log, sourcePath) - copyFilesExtNoSubdirIfNeeded(log, sourcePath, installPath, ".hlsbank") - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install map +# \date 2009-03-10 13:13GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install map +# +# 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 map") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +installPath = InstallDirectory + "/" + MapInstallDirectory +mkPath(log, installPath) + +printLog(log, ">>> Install map <<<") +sourcePaths = [ ExportBuildDirectory + "/" + MapBuildDirectory ] + [ ExportBuildDirectory + "/" + MapUncompressedExportDirectory ] +for sourcePath in sourcePaths: + mkPath(log, sourcePath) + files = os.listdir(sourcePath) + len_ext = 4 + for fileName in files: + if isLegalFileName(fileName): + sourceFile = sourcePath + "/" + fileName + if os.path.isfile(sourceFile): + if (fileName[-len_ext:].lower() == ".tga") or (fileName[-len_ext:].lower() == ".png") or (fileName[-len_ext:].lower() == ".dds"): + copyFileIfNeeded(log, sourceFile, installPath + "/" + os.path.basename(fileName)) + elif not os.path.isdir(sourceFile): + printLog(log, "FAIL ?! file not dir or file ?! " + sourceFile) + +if MapPanoplyFileList != None: + printLog(log, ">>> Install panoply file list <<<") + buildPanoplyTagPath = ExportBuildDirectory + "/" + MapTagBuildDirectory + "/build_panoply.tag" + mkPath(log, ExportBuildDirectory + "/" + MapTagBuildDirectory) + if needUpdate(log, buildPanoplyTagPath, installPath + "/" + MapPanoplyFileList): + sourcePath = ExportBuildDirectory + "/" + MapPanoplyBuildDirectory + mkPath(log, sourcePath) + printLog(log, "WRITE " + installPath + "/" + MapPanoplyFileList) + lf = open(installPath + "/" + MapPanoplyFileList, "w") + files = os.listdir(sourcePath) + for file in files: + if isLegalFileName(file): + lf.write(file + "\n") + lf.close() + else: + printLog(log, "SKIP " + installPath + "/" + MapPanoplyBuildDirectory) + +if MapHlsBankFileName != None: + printLog(log, ">>> Install map hlsbank <<<") + sourcePath = ExportBuildDirectory + "/" + MapPanoplyHlsBankBuildDirectory + mkPath(log, sourcePath) + copyFilesExtNoSubdirIfNeeded(log, sourcePath, installPath, ".hlsbank") + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/pacs_prim/0_setup.py b/code/nel/tools/build_gamedata/processes/pacs_prim/0_setup.py old mode 100755 new mode 100644 index e9bdb5918..56e26a000 --- a/code/nel/tools/build_gamedata/processes/pacs_prim/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/pacs_prim/0_setup.py @@ -1,65 +1,65 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief setup pacs_prim -# \date 2010-08-31 16:50GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup pacs_prim -# -# 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 pacs_prim") -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 <<<") -for dir in PacsPrimSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - -# Setup export directories -printLog(log, ">>> Setup export directories <<<") -mkPath(log, ExportBuildDirectory + "/" + PacsPrimExportDirectory) - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") -mkPath(log, InstallDirectory + "/" + PacsPrimInstallDirectory) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief setup pacs_prim +# \date 2010-08-31 16:50GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup pacs_prim +# +# 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 pacs_prim") +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 <<<") +for dir in PacsPrimSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) + +# Setup export directories +printLog(log, ">>> Setup export directories <<<") +mkPath(log, ExportBuildDirectory + "/" + PacsPrimExportDirectory) + +# Setup build directories +printLog(log, ">>> Setup build directories <<<") + +# Setup client directories +printLog(log, ">>> Setup client directories <<<") +mkPath(log, InstallDirectory + "/" + PacsPrimInstallDirectory) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/pacs_prim/1_export.py b/code/nel/tools/build_gamedata/processes/pacs_prim/1_export.py old mode 100755 new mode 100644 index cfb46635f..32a537787 --- a/code/nel/tools/build_gamedata/processes/pacs_prim/1_export.py +++ b/code/nel/tools/build_gamedata/processes/pacs_prim/1_export.py @@ -1,146 +1,146 @@ -#!/usr/bin/python -# -# ################################################################# -# ## WARNING : this is a generated file, don't change it ! -# ################################################################# -# -# \file 1_export.py -# \brief Export pacs_prim -# \date 2015-01-06-16-31-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export pacs_prim -# -# 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") -if os.path.isfile("temp_log.log"): - os.remove("temp_log.log") -log = open("temp_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 pacs_prim") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - - -# Find tools -# ... - -# Export pacs_prim 3dsmax -if MaxAvailable: - # Find tools - Max = findMax(log, MaxDirectory, MaxExecutable) - printLog(log, "") - - printLog(log, ">>> Export pacs_prim 3dsmax <<<") - mkPath(log, ExportBuildDirectory + "/" + PacsPrimExportDirectory) - mkPath(log, ExportBuildDirectory + "/" + PacsPrimTagExportDirectory) - for dir in PacsPrimSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - if (needUpdateDirByTagLog(log, DatabaseDirectory + "/" + dir, ".max", ExportBuildDirectory + "/" + PacsPrimTagExportDirectory, ".max.tag")): - scriptSrc = "maxscript/pacs_prim_export.ms" - scriptDst = MaxUserDirectory + "/scripts/pacs_prim_export.ms" - outputLogfile = ScriptDirectory + "/processes/pacs_prim/log.log" - outputDirectory = ExportBuildDirectory + "/" + PacsPrimExportDirectory - tagDirectory = ExportBuildDirectory + "/" + PacsPrimTagExportDirectory - maxSourceDir = DatabaseDirectory + "/" + dir - maxRunningTagFile = tagDirectory + "/max_running.tag" - tagList = findFiles(log, tagDirectory, "", ".max.tag") - tagLen = len(tagList) - if os.path.isfile(scriptDst): - os.remove(scriptDst) - tagDiff = 1 - sSrc = open(scriptSrc, "r") - sDst = open(scriptDst, "w") - for line in sSrc: - newline = line.replace("%OutputLogfile%", outputLogfile) - newline = newline.replace("%MaxSourceDirectory%", maxSourceDir) - newline = newline.replace("%OutputDirectory%", outputDirectory) - newline = newline.replace("%TagDirectory%", tagDirectory) - sDst.write(newline) - sSrc.close() - sDst.close() - zeroRetryLimit = 3 - while tagDiff > 0: - mrt = open(maxRunningTagFile, "w") - mrt.write("moe-moe-kyun") - mrt.close() - printLog(log, "MAXSCRIPT " + scriptDst) - subprocess.call([ Max, "-U", "MAXScript", "pacs_prim_export.ms", "-q", "-mi", "-mip" ]) - if os.path.exists(outputLogfile): - try: - lSrc = open(outputLogfile, "r") - for line in lSrc: - lineStrip = line.strip() - if (len(lineStrip) > 0): - printLog(log, lineStrip) - lSrc.close() - os.remove(outputLogfile) - except Exception: - printLog(log, "ERROR Failed to read 3dsmax log") - else: - printLog(log, "WARNING No 3dsmax log") - tagList = findFiles(log, tagDirectory, "", ".max.tag") - newTagLen = len(tagList) - tagDiff = newTagLen - tagLen - tagLen = newTagLen - addTagDiff = 0 - if os.path.exists(maxRunningTagFile): - printLog(log, "FAIL 3ds Max crashed and/or file export failed!") - if tagDiff == 0: - if zeroRetryLimit > 0: - zeroRetryLimit = zeroRetryLimit - 1 - addTagDiff = 1 - else: - printLog(log, "FAIL Retry limit reached!") - else: - addTagDiff = 1 - os.remove(maxRunningTagFile) - printLog(log, "Exported " + str(tagDiff) + " .max files!") - tagDiff += addTagDiff - os.remove(scriptDst) - printLog(log, "") - - - -# Remove bad file from previous script version -listPath = ExportBuildDirectory + "/" + PacsPrimExportDirectory + "/landscape_col_prim_pacs_list.txt" -if os.path.isfile(listPath): - os.remove(listPath) - - - -log.close() -if os.path.isfile("log.log"): - os.remove("log.log") -shutil.move("temp_log.log", "log.log") - - -# end of file +#!/usr/bin/python +# +# ################################################################# +# ## WARNING : this is a generated file, don't change it ! +# ################################################################# +# +# \file 1_export.py +# \brief Export pacs_prim +# \date 2015-01-06-16-31-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export pacs_prim +# +# 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") +if os.path.isfile("temp_log.log"): + os.remove("temp_log.log") +log = open("temp_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 pacs_prim") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + + +# Find tools +# ... + +# Export pacs_prim 3dsmax +if MaxAvailable: + # Find tools + Max = findMax(log, MaxDirectory, MaxExecutable) + printLog(log, "") + + printLog(log, ">>> Export pacs_prim 3dsmax <<<") + mkPath(log, ExportBuildDirectory + "/" + PacsPrimExportDirectory) + mkPath(log, ExportBuildDirectory + "/" + PacsPrimTagExportDirectory) + for dir in PacsPrimSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) + if (needUpdateDirByTagLog(log, DatabaseDirectory + "/" + dir, ".max", ExportBuildDirectory + "/" + PacsPrimTagExportDirectory, ".max.tag")): + scriptSrc = "maxscript/pacs_prim_export.ms" + scriptDst = MaxUserDirectory + "/scripts/pacs_prim_export.ms" + outputLogfile = ScriptDirectory + "/processes/pacs_prim/log.log" + outputDirectory = ExportBuildDirectory + "/" + PacsPrimExportDirectory + tagDirectory = ExportBuildDirectory + "/" + PacsPrimTagExportDirectory + maxSourceDir = DatabaseDirectory + "/" + dir + maxRunningTagFile = tagDirectory + "/max_running.tag" + tagList = findFiles(log, tagDirectory, "", ".max.tag") + tagLen = len(tagList) + if os.path.isfile(scriptDst): + os.remove(scriptDst) + tagDiff = 1 + sSrc = open(scriptSrc, "r") + sDst = open(scriptDst, "w") + for line in sSrc: + newline = line.replace("%OutputLogfile%", outputLogfile) + newline = newline.replace("%MaxSourceDirectory%", maxSourceDir) + newline = newline.replace("%OutputDirectory%", outputDirectory) + newline = newline.replace("%TagDirectory%", tagDirectory) + sDst.write(newline) + sSrc.close() + sDst.close() + zeroRetryLimit = 3 + while tagDiff > 0: + mrt = open(maxRunningTagFile, "w") + mrt.write("moe-moe-kyun") + mrt.close() + printLog(log, "MAXSCRIPT " + scriptDst) + subprocess.call([ Max, "-U", "MAXScript", "pacs_prim_export.ms", "-q", "-mi", "-mip" ]) + if os.path.exists(outputLogfile): + try: + lSrc = open(outputLogfile, "r") + for line in lSrc: + lineStrip = line.strip() + if (len(lineStrip) > 0): + printLog(log, lineStrip) + lSrc.close() + os.remove(outputLogfile) + except Exception: + printLog(log, "ERROR Failed to read 3dsmax log") + else: + printLog(log, "WARNING No 3dsmax log") + tagList = findFiles(log, tagDirectory, "", ".max.tag") + newTagLen = len(tagList) + tagDiff = newTagLen - tagLen + tagLen = newTagLen + addTagDiff = 0 + if os.path.exists(maxRunningTagFile): + printLog(log, "FAIL 3ds Max crashed and/or file export failed!") + if tagDiff == 0: + if zeroRetryLimit > 0: + zeroRetryLimit = zeroRetryLimit - 1 + addTagDiff = 1 + else: + printLog(log, "FAIL Retry limit reached!") + else: + addTagDiff = 1 + os.remove(maxRunningTagFile) + printLog(log, "Exported " + str(tagDiff) + " .max files!") + tagDiff += addTagDiff + os.remove(scriptDst) + printLog(log, "") + + + +# Remove bad file from previous script version +listPath = ExportBuildDirectory + "/" + PacsPrimExportDirectory + "/landscape_col_prim_pacs_list.txt" +if os.path.isfile(listPath): + os.remove(listPath) + + + +log.close() +if os.path.isfile("log.log"): + os.remove("log.log") +shutil.move("temp_log.log", "log.log") + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/pacs_prim/2_build.py b/code/nel/tools/build_gamedata/processes/pacs_prim/2_build.py old mode 100755 new mode 100644 index d50aa6b8c..f863e6df2 --- a/code/nel/tools/build_gamedata/processes/pacs_prim/2_build.py +++ b/code/nel/tools/build_gamedata/processes/pacs_prim/2_build.py @@ -1,49 +1,49 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build pacs_prim -# \date 2010-08-31 16:50GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build pacs_prim -# -# 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 pacs_prim") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 2_build.py +# \brief Build pacs_prim +# \date 2010-08-31 16:50GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Build pacs_prim +# +# 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 pacs_prim") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/pacs_prim/3_install.py b/code/nel/tools/build_gamedata/processes/pacs_prim/3_install.py old mode 100755 new mode 100644 index da932c469..ef3b34978 --- a/code/nel/tools/build_gamedata/processes/pacs_prim/3_install.py +++ b/code/nel/tools/build_gamedata/processes/pacs_prim/3_install.py @@ -1,57 +1,57 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install pacs_prim -# \date 2010-08-31 16:50GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install pacs_prim -# -# 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, "--- Install pacs_prim") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -installPath = InstallDirectory + "/" + PacsPrimInstallDirectory -mkPath(log, installPath) - -printLog(log, ">>> Install pacs_prim <<<") -mkPath(log, ExportBuildDirectory + "/" + PacsPrimExportDirectory) -copyFilesExtNoSubdirIfNeeded(log, ExportBuildDirectory + "/" + PacsPrimExportDirectory, installPath, ".pacs_prim") - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install pacs_prim +# \date 2010-08-31 16:50GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install pacs_prim +# +# 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 pacs_prim") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +installPath = InstallDirectory + "/" + PacsPrimInstallDirectory +mkPath(log, installPath) + +printLog(log, ">>> Install pacs_prim <<<") +mkPath(log, ExportBuildDirectory + "/" + PacsPrimExportDirectory) +copyFilesExtNoSubdirIfNeeded(log, ExportBuildDirectory + "/" + PacsPrimExportDirectory, installPath, ".pacs_prim") + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/pacs_prim/maxscript/pacs_prim_export.ms b/code/nel/tools/build_gamedata/processes/pacs_prim/maxscript/pacs_prim_export.ms old mode 100755 new mode 100644 diff --git a/code/nel/tools/build_gamedata/processes/pacs_prim_list/0_setup.py b/code/nel/tools/build_gamedata/processes/pacs_prim_list/0_setup.py old mode 100755 new mode 100644 index 6be8fbea3..7bed34207 --- a/code/nel/tools/build_gamedata/processes/pacs_prim_list/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/pacs_prim_list/0_setup.py @@ -1,62 +1,62 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief setup pacs_prim_list -# \date 2011-09-28 7:22GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup pacs_prim_list -# -# 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 pacs_prim_list") -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 <<<") -for dir in PacsPrimExportSourceDirectories: - mkPath(log, ExportBuildDirectory + "/" + dir) - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") -mkPath(log, ExportBuildDirectory + "/" + PacsPrimListBuildDirectory) - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") -mkPath(log, InstallDirectory + "/" + PacsPrimListInstallDirectory) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief setup pacs_prim_list +# \date 2011-09-28 7:22GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup pacs_prim_list +# +# 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 pacs_prim_list") +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 <<<") +for dir in PacsPrimExportSourceDirectories: + mkPath(log, ExportBuildDirectory + "/" + dir) + +# Setup build directories +printLog(log, ">>> Setup build directories <<<") +mkPath(log, ExportBuildDirectory + "/" + PacsPrimListBuildDirectory) + +# Setup client directories +printLog(log, ">>> Setup client directories <<<") +mkPath(log, InstallDirectory + "/" + PacsPrimListInstallDirectory) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/pacs_prim_list/1_export.py b/code/nel/tools/build_gamedata/processes/pacs_prim_list/1_export.py old mode 100755 new mode 100644 index 3f250406b..ac3a7aeaf --- a/code/nel/tools/build_gamedata/processes/pacs_prim_list/1_export.py +++ b/code/nel/tools/build_gamedata/processes/pacs_prim_list/1_export.py @@ -1,53 +1,53 @@ -#!/usr/bin/python -# -# \file 1_export.py -# \brief Export pacs_prim_list -# \date 2011-09-28 7:22GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export pacs_prim_list -# -# 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 pacs_prim_list") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -printLog(log, ">>> Nothing to do! <<<") - -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 1_export.py +# \brief Export pacs_prim_list +# \date 2011-09-28 7:22GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export pacs_prim_list +# +# 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 pacs_prim_list") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +printLog(log, ">>> Nothing to do! <<<") + +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/pacs_prim_list/2_build.py b/code/nel/tools/build_gamedata/processes/pacs_prim_list/2_build.py old mode 100755 new mode 100644 index 3c1f3cdbb..a7d5599ce --- a/code/nel/tools/build_gamedata/processes/pacs_prim_list/2_build.py +++ b/code/nel/tools/build_gamedata/processes/pacs_prim_list/2_build.py @@ -1,63 +1,63 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build pacs_prim_list -# \date 2011-09-28 7:22GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build pacs_prim_list -# -# 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 pacs_prim_list") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -printLog(log, ">>> List pacs_prim <<<") -listPath = ExportBuildDirectory + "/" + PacsPrimListBuildDirectory + "/landscape_col_prim_pacs_list.txt" -if os.path.isfile(listPath): - os.remove(listPath) -listFile = open(listPath, "w") -printLog(log, "WRITE " + listPath) -for dir in PacsPrimExportSourceDirectories: - outDirPacsPrim = ExportBuildDirectory + "/" + dir - mkPath(log, outDirPacsPrim) - exportedPacsPrims = findFiles(log, outDirPacsPrim, "", ".pacs_prim") - for exported in exportedPacsPrims: - listFile.write(exported + "\n") -listFile.close() - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 2_build.py +# \brief Build pacs_prim_list +# \date 2011-09-28 7:22GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Build pacs_prim_list +# +# 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 pacs_prim_list") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +printLog(log, ">>> List pacs_prim <<<") +listPath = ExportBuildDirectory + "/" + PacsPrimListBuildDirectory + "/landscape_col_prim_pacs_list.txt" +if os.path.isfile(listPath): + os.remove(listPath) +listFile = open(listPath, "w") +printLog(log, "WRITE " + listPath) +for dir in PacsPrimExportSourceDirectories: + outDirPacsPrim = ExportBuildDirectory + "/" + dir + mkPath(log, outDirPacsPrim) + exportedPacsPrims = findFiles(log, outDirPacsPrim, "", ".pacs_prim") + for exported in exportedPacsPrims: + listFile.write(exported + "\n") +listFile.close() + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/pacs_prim_list/3_install.py b/code/nel/tools/build_gamedata/processes/pacs_prim_list/3_install.py old mode 100755 new mode 100644 index 73656122c..df218c9f7 --- a/code/nel/tools/build_gamedata/processes/pacs_prim_list/3_install.py +++ b/code/nel/tools/build_gamedata/processes/pacs_prim_list/3_install.py @@ -1,55 +1,55 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install pacs_prim_list -# \date 2011-09-28 7:22GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install pacs_prim_list -# -# 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, "--- Install pacs_prim_list") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -printLog(log, ">>> Install pacs_prim_list <<<") -installPath = InstallDirectory + "/" + PacsPrimListInstallDirectory -mkPath(log, installPath) -copyFileIfNeeded(log, ExportBuildDirectory + "/" + PacsPrimListBuildDirectory + "/landscape_col_prim_pacs_list.txt", installPath + "/landscape_col_prim_pacs_list.txt") - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install pacs_prim_list +# \date 2011-09-28 7:22GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install pacs_prim_list +# +# 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 pacs_prim_list") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +printLog(log, ">>> Install pacs_prim_list <<<") +installPath = InstallDirectory + "/" + PacsPrimListInstallDirectory +mkPath(log, installPath) +copyFileIfNeeded(log, ExportBuildDirectory + "/" + PacsPrimListBuildDirectory + "/landscape_col_prim_pacs_list.txt", installPath + "/landscape_col_prim_pacs_list.txt") + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/properties/0_setup.py b/code/nel/tools/build_gamedata/processes/properties/0_setup.py old mode 100755 new mode 100644 index b6114d5b2..538cdffd5 --- a/code/nel/tools/build_gamedata/processes/properties/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/properties/0_setup.py @@ -1,141 +1,141 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief setup properties -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup properties -# -# 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 properties") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - - - -mkPath(log, ActiveProjectDirectory + "/generated") -zlp = open(ActiveProjectDirectory + "/generated/properties.cfg", "w") -zlp.write("\n") -zlp.write("// Search pathes\n") -zlp.write("search_pathes = \n") -zlp.write("{\n") -for searchPath in PropertiesExportBuildSearchPaths: - zlp.write("\t\"" + ExportBuildDirectory + "/" + searchPath + "\",\n") -zlp.write("};\n") -zlp.write("\n") -ps = open(ActiveProjectDirectory + "/properties_base.cfg", "r") -for line in ps: - try: - SmallbankExportDirectory - except NameError: - SmallbankExportDirectory = "_invalid" - try: - FarbankBuildDirectory - except NameError: - FarbankBuildDirectory = "_invalid" - try: - EcosystemName - except NameError: - EcosystemName = "_invalid" - try: - EcosystemPath - except NameError: - EcosystemPath = "_invalid" - try: - ContinentName - except NameError: - ContinentName = "_invalid" - try: - ContinentPath - except NameError: - ContinentPath = "_invalid" - try: - ContinentSheet - except NameError: - ContinentSheet = ContinentName - try: - BankTileBankName - except NameError: - BankTileBankName = "_invalid" - try: - IgLandBuildDirectory - except NameError: - IgLandBuildDirectory = "_invalid" - try: - IgOtherBuildDirectory - except NameError: - IgOtherBuildDirectory = "_invalid" - try: - RbankOutputBuildDirectory - except NameError: - RbankOutputBuildDirectory = "_invalid" - try: - RbankRbankName - except NameError: - RbankRbankName = "_invalid" - newline = line.replace("%ExportBuildDirectory%", ExportBuildDirectory) - newline = newline.replace("%LeveldesignDirectory%", LeveldesignDirectory) - newline = newline.replace("%LeveldesignWorldDirectory%", LeveldesignWorldDirectory) - newline = newline.replace("%LeveldesignDfnDirectory%", LeveldesignDfnDirectory) - newline = newline.replace("%SmallbankExportDirectory%", SmallbankExportDirectory) - newline = newline.replace("%FarbankBuildDirectory%", FarbankBuildDirectory) - newline = newline.replace("%EcosystemName%", EcosystemName) - newline = newline.replace("%EcosystemPath%", EcosystemPath) - newline = newline.replace("%ContinentName%", ContinentName) - newline = newline.replace("%ContinentPath%", ContinentPath) - newline = newline.replace("%CommonName%", CommonName) - newline = newline.replace("%CommonPath%", CommonPath) - newline = newline.replace("%ContinentSheet%", ContinentSheet) - newline = newline.replace("%BankTileBankName%", BankTileBankName) - newline = newline.replace("%IgLandBuildDirectory%", IgLandBuildDirectory) - newline = newline.replace("%IgOtherBuildDirectory%", IgOtherBuildDirectory) - newline = newline.replace("%RbankOutputBuildDirectory%", RbankOutputBuildDirectory) - newline = newline.replace("%RbankRbankName%", RbankRbankName) - newline = newline.replace("%BuildQuality%", str(BuildQuality)) - zlp.write(newline) -ps.close() -if (BuildQuality == 1): - ps = open(ActiveProjectDirectory + "/properties_final.cfg", "r") -else: - ps = open(ActiveProjectDirectory + "/properties_draft.cfg", "r") -for line in ps: - zlp.write(line) -zlp.close() -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief setup properties +# \date 2010-05-24 13:42GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup properties +# +# 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 properties") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + + + +mkPath(log, ActiveProjectDirectory + "/generated") +zlp = open(ActiveProjectDirectory + "/generated/properties.cfg", "w") +zlp.write("\n") +zlp.write("// Search pathes\n") +zlp.write("search_pathes = \n") +zlp.write("{\n") +for searchPath in PropertiesExportBuildSearchPaths: + zlp.write("\t\"" + ExportBuildDirectory + "/" + searchPath + "\",\n") +zlp.write("};\n") +zlp.write("\n") +ps = open(ActiveProjectDirectory + "/properties_base.cfg", "r") +for line in ps: + try: + SmallbankExportDirectory + except NameError: + SmallbankExportDirectory = "_invalid" + try: + FarbankBuildDirectory + except NameError: + FarbankBuildDirectory = "_invalid" + try: + EcosystemName + except NameError: + EcosystemName = "_invalid" + try: + EcosystemPath + except NameError: + EcosystemPath = "_invalid" + try: + ContinentName + except NameError: + ContinentName = "_invalid" + try: + ContinentPath + except NameError: + ContinentPath = "_invalid" + try: + ContinentSheet + except NameError: + ContinentSheet = ContinentName + try: + BankTileBankName + except NameError: + BankTileBankName = "_invalid" + try: + IgLandBuildDirectory + except NameError: + IgLandBuildDirectory = "_invalid" + try: + IgOtherBuildDirectory + except NameError: + IgOtherBuildDirectory = "_invalid" + try: + RbankOutputBuildDirectory + except NameError: + RbankOutputBuildDirectory = "_invalid" + try: + RbankRbankName + except NameError: + RbankRbankName = "_invalid" + newline = line.replace("%ExportBuildDirectory%", ExportBuildDirectory) + newline = newline.replace("%LeveldesignDirectory%", LeveldesignDirectory) + newline = newline.replace("%LeveldesignWorldDirectory%", LeveldesignWorldDirectory) + newline = newline.replace("%LeveldesignDfnDirectory%", LeveldesignDfnDirectory) + newline = newline.replace("%SmallbankExportDirectory%", SmallbankExportDirectory) + newline = newline.replace("%FarbankBuildDirectory%", FarbankBuildDirectory) + newline = newline.replace("%EcosystemName%", EcosystemName) + newline = newline.replace("%EcosystemPath%", EcosystemPath) + newline = newline.replace("%ContinentName%", ContinentName) + newline = newline.replace("%ContinentPath%", ContinentPath) + newline = newline.replace("%CommonName%", CommonName) + newline = newline.replace("%CommonPath%", CommonPath) + newline = newline.replace("%ContinentSheet%", ContinentSheet) + newline = newline.replace("%BankTileBankName%", BankTileBankName) + newline = newline.replace("%IgLandBuildDirectory%", IgLandBuildDirectory) + newline = newline.replace("%IgOtherBuildDirectory%", IgOtherBuildDirectory) + newline = newline.replace("%RbankOutputBuildDirectory%", RbankOutputBuildDirectory) + newline = newline.replace("%RbankRbankName%", RbankRbankName) + newline = newline.replace("%BuildQuality%", str(BuildQuality)) + zlp.write(newline) +ps.close() +if (BuildQuality == 1): + ps = open(ActiveProjectDirectory + "/properties_final.cfg", "r") +else: + ps = open(ActiveProjectDirectory + "/properties_draft.cfg", "r") +for line in ps: + zlp.write(line) +zlp.close() +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/properties/1_export.py b/code/nel/tools/build_gamedata/processes/properties/1_export.py old mode 100755 new mode 100644 index 809dc440c..13c27b260 --- a/code/nel/tools/build_gamedata/processes/properties/1_export.py +++ b/code/nel/tools/build_gamedata/processes/properties/1_export.py @@ -1,44 +1,44 @@ -#!/usr/bin/python -# -# \file 1_export.py -# \brief Export properties -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export properties -# -# 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, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 1_export.py +# \brief Export properties +# \date 2010-05-24 13:42GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export properties +# +# 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, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/properties/2_build.py b/code/nel/tools/build_gamedata/processes/properties/2_build.py old mode 100755 new mode 100644 index 721d58174..53ef2c331 --- a/code/nel/tools/build_gamedata/processes/properties/2_build.py +++ b/code/nel/tools/build_gamedata/processes/properties/2_build.py @@ -1,42 +1,42 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build properties -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build properties -# -# 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 * - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 2_build.py +# \brief Build properties +# \date 2010-05-24 13:42GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Build properties +# +# 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 * + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/properties/3_install.py b/code/nel/tools/build_gamedata/processes/properties/3_install.py old mode 100755 new mode 100644 index 79da071c0..b18ecadf5 --- a/code/nel/tools/build_gamedata/processes/properties/3_install.py +++ b/code/nel/tools/build_gamedata/processes/properties/3_install.py @@ -1,43 +1,43 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install properties -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install properties -# -# 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, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install properties +# \date 2010-05-24 13:42GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install properties +# +# 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, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/ps/0_setup.py b/code/nel/tools/build_gamedata/processes/ps/0_setup.py old mode 100755 new mode 100644 index c602cb8fe..34dffa5fe --- a/code/nel/tools/build_gamedata/processes/ps/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/ps/0_setup.py @@ -1,65 +1,65 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief setup ps -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup ps -# -# 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 ps") -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 <<<") -for dir in PsSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - -# Setup export directories -printLog(log, ">>> Setup export directories <<<") -mkPath(log, ExportBuildDirectory + "/" + PsExportDirectory) - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") -mkPath(log, InstallDirectory + "/" + PsInstallDirectory) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief setup ps +# \date 2010-05-24 13:42GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup ps +# +# 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 ps") +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 <<<") +for dir in PsSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) + +# Setup export directories +printLog(log, ">>> Setup export directories <<<") +mkPath(log, ExportBuildDirectory + "/" + PsExportDirectory) + +# Setup build directories +printLog(log, ">>> Setup build directories <<<") + +# Setup client directories +printLog(log, ">>> Setup client directories <<<") +mkPath(log, InstallDirectory + "/" + PsInstallDirectory) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/ps/1_export.py b/code/nel/tools/build_gamedata/processes/ps/1_export.py old mode 100755 new mode 100644 index e30385335..a73f82bef --- a/code/nel/tools/build_gamedata/processes/ps/1_export.py +++ b/code/nel/tools/build_gamedata/processes/ps/1_export.py @@ -1,60 +1,60 @@ -#!/usr/bin/python -# -# \file 1_export.py -# \brief Export ps -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export ps -# -# 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 ps") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# For each ps directory -printLog(log, ">>> Export ps 3dsmax <<<") -mkPath(log, ExportBuildDirectory + "/" + PsExportDirectory) -for dir in PsSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - copyFilesExtNoSubdirIfNeeded(log, DatabaseDirectory + "/" + dir, ExportBuildDirectory + "/" + PsExportDirectory, ".ps") - copyFilesExtNoSubdirIfNeeded(log, DatabaseDirectory + "/" + dir, ExportBuildDirectory + "/" + PsExportDirectory, ".shape") - copyFilesExtNoSubdirIfNeeded(log, DatabaseDirectory + "/" + dir, ExportBuildDirectory + "/" + PsExportDirectory, ".primitive") - -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 1_export.py +# \brief Export ps +# \date 2010-05-24 13:42GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export ps +# +# 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 ps") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +# For each ps directory +printLog(log, ">>> Export ps 3dsmax <<<") +mkPath(log, ExportBuildDirectory + "/" + PsExportDirectory) +for dir in PsSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) + copyFilesExtNoSubdirIfNeeded(log, DatabaseDirectory + "/" + dir, ExportBuildDirectory + "/" + PsExportDirectory, ".ps") + copyFilesExtNoSubdirIfNeeded(log, DatabaseDirectory + "/" + dir, ExportBuildDirectory + "/" + PsExportDirectory, ".shape") + copyFilesExtNoSubdirIfNeeded(log, DatabaseDirectory + "/" + dir, ExportBuildDirectory + "/" + PsExportDirectory, ".primitive") + +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/ps/2_build.py b/code/nel/tools/build_gamedata/processes/ps/2_build.py old mode 100755 new mode 100644 index 71c45e42b..f7bee7b53 --- a/code/nel/tools/build_gamedata/processes/ps/2_build.py +++ b/code/nel/tools/build_gamedata/processes/ps/2_build.py @@ -1,49 +1,49 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build ps -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build ps -# -# 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 ps") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 2_build.py +# \brief Build ps +# \date 2010-05-24 13:42GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Build ps +# +# 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 ps") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/ps/3_install.py b/code/nel/tools/build_gamedata/processes/ps/3_install.py old mode 100755 new mode 100644 index 56713d999..8190c83bc --- a/code/nel/tools/build_gamedata/processes/ps/3_install.py +++ b/code/nel/tools/build_gamedata/processes/ps/3_install.py @@ -1,57 +1,57 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install ps -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install ps -# -# 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, "--- Install ps") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -printLog(log, ">>> Install ps <<<") -srcDir = ExportBuildDirectory + "/" + PsExportDirectory -mkPath(log, srcDir) -destDir = InstallDirectory + "/" + PsInstallDirectory -mkPath(log, destDir) -copyFilesNoTreeIfNeeded(log, srcDir, destDir) - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install ps +# \date 2010-05-24 13:42GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install ps +# +# 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 ps") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +printLog(log, ">>> Install ps <<<") +srcDir = ExportBuildDirectory + "/" + PsExportDirectory +mkPath(log, srcDir) +destDir = InstallDirectory + "/" + PsInstallDirectory +mkPath(log, destDir) +copyFilesNoTreeIfNeeded(log, srcDir, destDir) + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/pz/0_setup.py b/code/nel/tools/build_gamedata/processes/pz/0_setup.py index e9f22be11..528c5ee84 100644 --- a/code/nel/tools/build_gamedata/processes/pz/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/pz/0_setup.py @@ -1,97 +1,100 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief setup pz -# \date 2014-09-13 13:32GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup pz -# -# 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 pz") -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 + "/" + PackedZoneCacheBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + PackedZoneCWMapCacheBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + PackedZoneBuildDirectory) - -# Setup lookup directories -printLog(log, ">>> Setup lookup directories <<<") -mkPath(log, ExportBuildDirectory + "/" + AiWmapBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + ZoneLightBuildDirectory) -mkPath(log, LeveldesignDataCommonDirectory) - -# Setup client directories -printLog(log, ">>> Setup install directories <<<") -mkPath(log, InstallDirectory + "/" + PackedZoneInstallDirectory) - -# Setup client directories -printLog(log, ">>> Setup configuration <<<") -mkPath(log, ActiveProjectDirectory + "/generated") -cfg = open(ActiveProjectDirectory + "/generated/build_world_packed_col.cfg", "w") -cfg.write("\n") -cfg.write("// BUILD WORLD PACKED COL CONFIGURATION\n") -cfg.write("\n") -cfg.write("SearchPaths = {\n") -cfg.write("\t\"" + ExportBuildDirectory + "/" + AiWmapBuildDirectory + "\", \n") -cfg.write("\t\"" + ExportBuildDirectory + "/" + ZoneLightBuildDirectory + "\", \n") -cfg.write("\t\"" + LeveldesignDataCommonDirectory + "\", \n") -cfg.write("};\n") -cfg.write("\n") -cfg.write("CachePath = \"" + ExportBuildDirectory + "/" + PackedZoneCacheBuildDirectory + "\";\n") -cfg.write("CWMapCachePath = \"" + ExportBuildDirectory + "/" + PackedZoneCWMapCacheBuildDirectory + "\";\n") -cfg.write("OutputPath = \"" + ExportBuildDirectory + "/" + PackedZoneBuildDirectory + "\";\n") -cfg.write("\n") -cfg.write("EntryPointsFile = \"r2_islands.xml\";\n") -cfg.write("\n") -cfg.write("CWMapList = {\n") -cfg.write("\t\"" + PackedZoneCWMap + "\", \n") -cfg.write("};\n") -cfg.write("\n") -cfg.write("Fly = 0;\n") -cfg.write("\n") -cfg.write("HeightMapsAsTga = 1;\n") -cfg.write("PixelPerMeter = 1;\n") -cfg.write("\n") -cfg.write("RefineThreshold = 32;\n") -cfg.write("\n") -cfg.close() - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief setup pz +# \date 2014-09-13 13:32GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup pz +# +# 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 pz") +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 + "/" + PackedZoneCacheBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + PackedZoneCWMapCacheBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + PackedZoneBuildDirectory) + +# Setup lookup directories +printLog(log, ">>> Setup lookup directories <<<") +mkPath(log, ExportBuildDirectory + "/" + AiWmapBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + ZoneLightBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + CartographerBuildDirectory) +mkPath(log, LeveldesignDataCommonDirectory) + +# Setup client directories +printLog(log, ">>> Setup install directories <<<") +mkPath(log, InstallDirectory + "/" + PackedZoneInstallDirectory) + +# Setup client directories +printLog(log, ">>> Setup configuration <<<") +mkPath(log, ActiveProjectDirectory + "/generated") +cfg = open(ActiveProjectDirectory + "/generated/build_world_packed_col.cfg", "w") +cfg.write("\n") +cfg.write("// BUILD WORLD PACKED COL 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 + "/" + CartographerBuildDirectory + "\", \n") +cfg.write("\t\"" + LeveldesignDataCommonDirectory + "\", \n") +cfg.write("};\n") +cfg.write("\n") +cfg.write("CachePath = \"" + ExportBuildDirectory + "/" + PackedZoneCacheBuildDirectory + "\";\n") +cfg.write("CWMapCachePath = \"" + ExportBuildDirectory + "/" + PackedZoneCWMapCacheBuildDirectory + "\";\n") +cfg.write("OutputPath = \"" + ExportBuildDirectory + "/" + PackedZoneBuildDirectory + "\";\n") +cfg.write("\n") +cfg.write("CompleteIslandsFile = \"" + IslandsXmlFile + "\";\n") +cfg.write("EntryPointsFile = \"r2_entry_points.txt\";\n") +cfg.write("\n") +cfg.write("CWMapList = {\n") +cfg.write("\t\"" + PackedZoneCWMap + "\", \n") +cfg.write("};\n") +cfg.write("\n") +cfg.write("Fly = 0;\n") +cfg.write("\n") +cfg.write("HeightMapsAsTga = 1;\n") +cfg.write("PixelPerMeter = 1;\n") +cfg.write("\n") +cfg.write("RefineThreshold = 32;\n") +cfg.write("\n") +cfg.close() + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/pz/1_export.py b/code/nel/tools/build_gamedata/processes/pz/1_export.py index ff8daf747..bca2b0d43 100644 --- a/code/nel/tools/build_gamedata/processes/pz/1_export.py +++ b/code/nel/tools/build_gamedata/processes/pz/1_export.py @@ -1,49 +1,49 @@ -#!/usr/bin/python -# -# \file 1_export.py -# \brief Export pz -# \date 2014-09-13 13:32GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export pz -# -# 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, "--- Export pz") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 1_export.py +# \brief Export pz +# \date 2014-09-13 13:32GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export pz +# +# 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, "--- Export pz") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/pz/2_build.py b/code/nel/tools/build_gamedata/processes/pz/2_build.py index b632412b0..be824ef67 100644 --- a/code/nel/tools/build_gamedata/processes/pz/2_build.py +++ b/code/nel/tools/build_gamedata/processes/pz/2_build.py @@ -1,62 +1,62 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build pz -# \date 2014-09-13 13:32GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build pz -# -# 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, "--- Build pz") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# Find tools -BuildWorldPackedCol = findTool(log, ToolDirectories, BuildWorldPackedColTool, ToolSuffix) - -if BuildWorldPackedCol == "": - toolLogFail(log, BuildWorldPackedColTool, ToolSuffix) -else: - printLog(log, ">>> Copy ai_build_wmap.cfg <<<") - cfgPath = ActiveProjectDirectory + "/generated/build_world_packed_col.cfg" - shutil.copy(cfgPath, "build_world_packed_col.cfg") - printLog(log, ">>> Build pz <<<") - subprocess.call([ BuildWorldPackedCol, "build_world_packed_col.cfg" ]) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 2_build.py +# \brief Build pz +# \date 2014-09-13 13:32GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Build pz +# +# 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, "--- Build pz") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +# Find tools +BuildWorldPackedCol = findTool(log, ToolDirectories, BuildWorldPackedColTool, ToolSuffix) + +if BuildWorldPackedCol == "": + toolLogFail(log, BuildWorldPackedColTool, ToolSuffix) +else: + printLog(log, ">>> Copy ai_build_wmap.cfg <<<") + cfgPath = ActiveProjectDirectory + "/generated/build_world_packed_col.cfg" + shutil.copy(cfgPath, "build_world_packed_col.cfg") + printLog(log, ">>> Build pz <<<") + subprocess.call([ BuildWorldPackedCol, "build_world_packed_col.cfg" ]) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/pz/3_install.py b/code/nel/tools/build_gamedata/processes/pz/3_install.py index c4feedef1..f11f0dd3e 100644 --- a/code/nel/tools/build_gamedata/processes/pz/3_install.py +++ b/code/nel/tools/build_gamedata/processes/pz/3_install.py @@ -1,58 +1,58 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install pz -# \date 2014-09-13 13:32GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install pz -# -# 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, "--- Install pz") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -installPath = InstallDirectory + "/" + PackedZoneInstallDirectory -mkPath(log, installPath) - -printLog(log, ">>> Install pz <<<") -mkPath(log, ExportBuildDirectory + "/" + PackedZoneBuildDirectory) -copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + PackedZoneBuildDirectory, installPath, ".island_hm") -copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + PackedZoneBuildDirectory, installPath, ".packed_island") - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install pz +# \date 2014-09-13 13:32GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install pz +# +# 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_local import * +from process import * +from tools import * +from directories import * + +printLog(log, "") +printLog(log, "-------") +printLog(log, "--- Install pz") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +installPath = InstallDirectory + "/" + PackedZoneInstallDirectory +mkPath(log, installPath) + +printLog(log, ">>> Install pz <<<") +mkPath(log, ExportBuildDirectory + "/" + PackedZoneBuildDirectory) +copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + PackedZoneBuildDirectory, installPath, ".island_hm") +copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + PackedZoneBuildDirectory, installPath, ".packed_island") + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/rbank/0_setup.py b/code/nel/tools/build_gamedata/processes/rbank/0_setup.py old mode 100755 new mode 100644 index 94bdb1151..56a46f910 --- a/code/nel/tools/build_gamedata/processes/rbank/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/rbank/0_setup.py @@ -1,83 +1,83 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief Setup rbank -# \date 2009-03-10-22-43-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup 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, "--- Setup rbank") -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 <<<") -for dir in RBankCmbSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) -mkPath(log, LeveldesignWorldDirectory) -mkPath(log, WorldEditorFilesDirectory) - -# Setup export directories -printLog(log, ">>> Setup export directories <<<") -mkPath(log, ExportBuildDirectory + "/" + RBankCmbExportDirectory) -mkPath(log, ExportBuildDirectory + "/" + RBankCmbTagExportDirectory) -mkPath(log, ExportBuildDirectory + "/" + SmallbankExportDirectory) - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") -mkPath(log, ExportBuildDirectory + "/" + ZoneWeldBuildDirectory) -for dir in IgLookupDirectories: - mkPath(log, ExportBuildDirectory + "/" + dir) -for dir in ShapeLookupDirectories: - mkPath(log, ExportBuildDirectory + "/" + dir) -mkPath(log, ExportBuildDirectory + "/" + RbankBboxBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + IgLandBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + IgOtherBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + RbankTessellationBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + RbankSmoothBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + RbankRawBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + RbankPreprocBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + RbankRetrieversBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + RbankOutputBuildDirectory) - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") -mkPath(log, InstallDirectory + "/" + PacsInstallDirectory) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief Setup rbank +# \date 2009-03-10-22-43-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup 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, "--- Setup rbank") +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 <<<") +for dir in RBankCmbSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) +mkPath(log, LeveldesignWorldDirectory) +mkPath(log, WorldEditorFilesDirectory) + +# Setup export directories +printLog(log, ">>> Setup export directories <<<") +mkPath(log, ExportBuildDirectory + "/" + RBankCmbExportDirectory) +mkPath(log, ExportBuildDirectory + "/" + RBankCmbTagExportDirectory) +mkPath(log, ExportBuildDirectory + "/" + SmallbankExportDirectory) + +# Setup build directories +printLog(log, ">>> Setup build directories <<<") +mkPath(log, ExportBuildDirectory + "/" + ZoneWeldBuildDirectory) +for dir in IgLookupDirectories: + mkPath(log, ExportBuildDirectory + "/" + dir) +for dir in ShapeLookupDirectories: + mkPath(log, ExportBuildDirectory + "/" + dir) +mkPath(log, ExportBuildDirectory + "/" + RbankBboxBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + IgLandBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + IgOtherBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + RbankTessellationBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + RbankSmoothBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + RbankRawBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + RbankPreprocBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + RbankRetrieversBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + RbankOutputBuildDirectory) + +# Setup client directories +printLog(log, ">>> Setup client directories <<<") +mkPath(log, InstallDirectory + "/" + PacsInstallDirectory) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/rbank/1_export.py b/code/nel/tools/build_gamedata/processes/rbank/1_export.py old mode 100755 new mode 100644 index 65c14c907..e77a917b7 --- a/code/nel/tools/build_gamedata/processes/rbank/1_export.py +++ b/code/nel/tools/build_gamedata/processes/rbank/1_export.py @@ -1,139 +1,139 @@ -#!/usr/bin/python -# -# ################################################################# -# ## WARNING : this is a generated file, don't change it ! -# ################################################################# -# -# \file 1_export.py -# \brief Export rbank -# \date 2015-01-06-16-31-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export 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") -if os.path.isfile("temp_log.log"): - os.remove("temp_log.log") -log = open("temp_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 rbank") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - - -# Find tools -# ... - -# Export rbank 3dsmax -if MaxAvailable: - # Find tools - Max = findMax(log, MaxDirectory, MaxExecutable) - printLog(log, "") - - printLog(log, ">>> Export rbank 3dsmax <<<") - mkPath(log, ExportBuildDirectory + "/" + RBankCmbExportDirectory) - mkPath(log, ExportBuildDirectory + "/" + RBankCmbTagExportDirectory) - for dir in RBankCmbSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - if (needUpdateDirByTagLog(log, DatabaseDirectory + "/" + dir, ".max", ExportBuildDirectory + "/" + RBankCmbTagExportDirectory, ".max.tag")): - scriptSrc = "maxscript/cmb_export.ms" - scriptDst = MaxUserDirectory + "/scripts/cmb_export.ms" - outputLogfile = ScriptDirectory + "/processes/rbank/log.log" - outputDirectory = ExportBuildDirectory + "/" + RBankCmbExportDirectory - tagDirectory = ExportBuildDirectory + "/" + RBankCmbTagExportDirectory - maxSourceDir = DatabaseDirectory + "/" + dir - maxRunningTagFile = tagDirectory + "/max_running.tag" - tagList = findFiles(log, tagDirectory, "", ".max.tag") - tagLen = len(tagList) - if os.path.isfile(scriptDst): - os.remove(scriptDst) - tagDiff = 1 - sSrc = open(scriptSrc, "r") - sDst = open(scriptDst, "w") - for line in sSrc: - newline = line.replace("%OutputLogfile%", outputLogfile) - newline = newline.replace("%MaxSourceDirectory%", maxSourceDir) - newline = newline.replace("%OutputDirectory%", outputDirectory) - newline = newline.replace("%TagDirectory%", tagDirectory) - sDst.write(newline) - sSrc.close() - sDst.close() - zeroRetryLimit = 3 - while tagDiff > 0: - mrt = open(maxRunningTagFile, "w") - mrt.write("moe-moe-kyun") - mrt.close() - printLog(log, "MAXSCRIPT " + scriptDst) - subprocess.call([ Max, "-U", "MAXScript", "cmb_export.ms", "-q", "-mi", "-mip" ]) - if os.path.exists(outputLogfile): - try: - lSrc = open(outputLogfile, "r") - for line in lSrc: - lineStrip = line.strip() - if (len(lineStrip) > 0): - printLog(log, lineStrip) - lSrc.close() - os.remove(outputLogfile) - except Exception: - printLog(log, "ERROR Failed to read 3dsmax log") - else: - printLog(log, "WARNING No 3dsmax log") - tagList = findFiles(log, tagDirectory, "", ".max.tag") - newTagLen = len(tagList) - tagDiff = newTagLen - tagLen - tagLen = newTagLen - addTagDiff = 0 - if os.path.exists(maxRunningTagFile): - printLog(log, "FAIL 3ds Max crashed and/or file export failed!") - if tagDiff == 0: - if zeroRetryLimit > 0: - zeroRetryLimit = zeroRetryLimit - 1 - addTagDiff = 1 - else: - printLog(log, "FAIL Retry limit reached!") - else: - addTagDiff = 1 - os.remove(maxRunningTagFile) - printLog(log, "Exported " + str(tagDiff) + " .max files!") - tagDiff += addTagDiff - os.remove(scriptDst) - printLog(log, "") - - - -log.close() -if os.path.isfile("log.log"): - os.remove("log.log") -shutil.move("temp_log.log", "log.log") - - -# end of file +#!/usr/bin/python +# +# ################################################################# +# ## WARNING : this is a generated file, don't change it ! +# ################################################################# +# +# \file 1_export.py +# \brief Export rbank +# \date 2015-01-06-16-31-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export 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") +if os.path.isfile("temp_log.log"): + os.remove("temp_log.log") +log = open("temp_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 rbank") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + + +# Find tools +# ... + +# Export rbank 3dsmax +if MaxAvailable: + # Find tools + Max = findMax(log, MaxDirectory, MaxExecutable) + printLog(log, "") + + printLog(log, ">>> Export rbank 3dsmax <<<") + mkPath(log, ExportBuildDirectory + "/" + RBankCmbExportDirectory) + mkPath(log, ExportBuildDirectory + "/" + RBankCmbTagExportDirectory) + for dir in RBankCmbSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) + if (needUpdateDirByTagLog(log, DatabaseDirectory + "/" + dir, ".max", ExportBuildDirectory + "/" + RBankCmbTagExportDirectory, ".max.tag")): + scriptSrc = "maxscript/cmb_export.ms" + scriptDst = MaxUserDirectory + "/scripts/cmb_export.ms" + outputLogfile = ScriptDirectory + "/processes/rbank/log.log" + outputDirectory = ExportBuildDirectory + "/" + RBankCmbExportDirectory + tagDirectory = ExportBuildDirectory + "/" + RBankCmbTagExportDirectory + maxSourceDir = DatabaseDirectory + "/" + dir + maxRunningTagFile = tagDirectory + "/max_running.tag" + tagList = findFiles(log, tagDirectory, "", ".max.tag") + tagLen = len(tagList) + if os.path.isfile(scriptDst): + os.remove(scriptDst) + tagDiff = 1 + sSrc = open(scriptSrc, "r") + sDst = open(scriptDst, "w") + for line in sSrc: + newline = line.replace("%OutputLogfile%", outputLogfile) + newline = newline.replace("%MaxSourceDirectory%", maxSourceDir) + newline = newline.replace("%OutputDirectory%", outputDirectory) + newline = newline.replace("%TagDirectory%", tagDirectory) + sDst.write(newline) + sSrc.close() + sDst.close() + zeroRetryLimit = 3 + while tagDiff > 0: + mrt = open(maxRunningTagFile, "w") + mrt.write("moe-moe-kyun") + mrt.close() + printLog(log, "MAXSCRIPT " + scriptDst) + subprocess.call([ Max, "-U", "MAXScript", "cmb_export.ms", "-q", "-mi", "-mip" ]) + if os.path.exists(outputLogfile): + try: + lSrc = open(outputLogfile, "r") + for line in lSrc: + lineStrip = line.strip() + if (len(lineStrip) > 0): + printLog(log, lineStrip) + lSrc.close() + os.remove(outputLogfile) + except Exception: + printLog(log, "ERROR Failed to read 3dsmax log") + else: + printLog(log, "WARNING No 3dsmax log") + tagList = findFiles(log, tagDirectory, "", ".max.tag") + newTagLen = len(tagList) + tagDiff = newTagLen - tagLen + tagLen = newTagLen + addTagDiff = 0 + if os.path.exists(maxRunningTagFile): + printLog(log, "FAIL 3ds Max crashed and/or file export failed!") + if tagDiff == 0: + if zeroRetryLimit > 0: + zeroRetryLimit = zeroRetryLimit - 1 + addTagDiff = 1 + else: + printLog(log, "FAIL Retry limit reached!") + else: + addTagDiff = 1 + os.remove(maxRunningTagFile) + printLog(log, "Exported " + str(tagDiff) + " .max files!") + tagDiff += addTagDiff + os.remove(scriptDst) + printLog(log, "") + + + +log.close() +if os.path.isfile("log.log"): + os.remove("log.log") +shutil.move("temp_log.log", "log.log") + + +# 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 old mode 100755 new mode 100644 index b38aea94b..1f872b968 --- a/code/nel/tools/build_gamedata/processes/rbank/2_build.py +++ b/code/nel/tools/build_gamedata/processes/rbank/2_build.py @@ -1,325 +1,339 @@ -#!/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" -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: - 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") - 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)) - zone_to_build = 0 - for nearzone in nearzones: - sourcePath = ExportBuildDirectory + "/" + ZoneWeldBuildDirectory + "/" + nearzone + ".zonew" - if (os.path.isfile(sourcePath)): - if (needUpdate(log, sourcePath, lr1)): - zone_to_build = 1 - sourcePath = ExportBuildDirectory + "/" + ZoneWeldBuildDirectory + "/" + zone + ".zonew" - if zone_to_build: - printLog(log, sourcePath + " -> " + lr1) - subprocess.call([ ExecTimeout, str(RbankBuildTesselTimeout), BuildRbank, "-c", "-P", "-g", os.path.basename(zonefile) ]) - else: - printLog(log, "SKIP " + lr1) -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 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 +#!/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/rbank/3_install.py b/code/nel/tools/build_gamedata/processes/rbank/3_install.py old mode 100755 new mode 100644 index c806c79f9..e8f0a8561 --- a/code/nel/tools/build_gamedata/processes/rbank/3_install.py +++ b/code/nel/tools/build_gamedata/processes/rbank/3_install.py @@ -1,68 +1,68 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install rbank -# \date 2009-03-10-22-43-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install 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, "--- Install rbank") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -printLog(log, ">>> Install rbank <<<") -installPath = InstallDirectory + "/" + PacsInstallDirectory -mkPath(log, installPath) -srcPath = ExportBuildDirectory + "/" + RbankOutputBuildDirectory -mkPath(log, srcPath) -copyFilesNoTreeIfNeeded(log, srcPath, installPath) -#installPath = InstallDirectory + "/" + PacsInstallDirectory -#mkPath(log, installPath) -#srcPath = ExportBuildDirectory + "/" + RbankRetrieversBuildDirectory -#mkPath(log, srcPath) -#copyFileIfNeeded(log, srcPath + "/tempMerged.rbank", installPath + "/" + RbankRbankName + ".rbank") -#copyFileIfNeeded(log, srcPath + "/tempMerged.gr", installPath + "/" + RbankRbankName + ".gr") -#for file in findFiles(log, srcPath, "", ".lr"): -# copyFileIfNeeded(log, srcPath + "/" + file, installPath + "/" + file.replace("tempMerged", RbankRbankName)) -# mkPath(log, ExportBuildDirectory + "/" + rbankBuildDirectory) -# copyFilesNoTreeIfNeeded(log, ExportBuildDirectory + "/" + rbankBuildDirectory, installPath) -#copyFileIfNeeded -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install rbank +# \date 2009-03-10-22-43-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install 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_local import * +from process import * +from tools import * +from directories import * + +printLog(log, "") +printLog(log, "-------") +printLog(log, "--- Install rbank") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +printLog(log, ">>> Install rbank <<<") +installPath = InstallDirectory + "/" + PacsInstallDirectory +mkPath(log, installPath) +srcPath = ExportBuildDirectory + "/" + RbankOutputBuildDirectory +mkPath(log, srcPath) +copyFilesNoTreeIfNeeded(log, srcPath, installPath) +#installPath = InstallDirectory + "/" + PacsInstallDirectory +#mkPath(log, installPath) +#srcPath = ExportBuildDirectory + "/" + RbankRetrieversBuildDirectory +#mkPath(log, srcPath) +#copyFileIfNeeded(log, srcPath + "/tempMerged.rbank", installPath + "/" + RbankRbankName + ".rbank") +#copyFileIfNeeded(log, srcPath + "/tempMerged.gr", installPath + "/" + RbankRbankName + ".gr") +#for file in findFiles(log, srcPath, "", ".lr"): +# copyFileIfNeeded(log, srcPath + "/" + file, installPath + "/" + file.replace("tempMerged", RbankRbankName)) +# mkPath(log, ExportBuildDirectory + "/" + rbankBuildDirectory) +# copyFilesNoTreeIfNeeded(log, ExportBuildDirectory + "/" + rbankBuildDirectory, installPath) +#copyFileIfNeeded +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/rbank/maxscript/cmb_export.ms b/code/nel/tools/build_gamedata/processes/rbank/maxscript/cmb_export.ms old mode 100755 new mode 100644 diff --git a/code/nel/tools/build_gamedata/processes/samplebank/0_setup.py b/code/nel/tools/build_gamedata/processes/samplebank/0_setup.py index 0c9c6c856..9f64d22fd 100644 --- a/code/nel/tools/build_gamedata/processes/samplebank/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/samplebank/0_setup.py @@ -1,64 +1,64 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief Setup samplebank -# \date 2009-06-03 10:47GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup samplebank -# -# 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 samplebank") -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, SoundDirectory + "/" + SoundSamplebanksSourceDirectory) - -# Setup export directories -printLog(log, ">>> Setup export directories <<<") - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") -mkPath(log, ExportBuildDirectory + "/" + SoundSamplebanksBuildDirectory) - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") -mkPath(log, InstallDirectory + "/" + SoundInstallDirectory) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief Setup samplebank +# \date 2009-06-03 10:47GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup samplebank +# +# 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 samplebank") +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, SoundDirectory + "/" + SoundSamplebanksSourceDirectory) + +# Setup export directories +printLog(log, ">>> Setup export directories <<<") + +# Setup build directories +printLog(log, ">>> Setup build directories <<<") +mkPath(log, ExportBuildDirectory + "/" + SoundSamplebanksBuildDirectory) + +# Setup client directories +printLog(log, ">>> Setup client directories <<<") +mkPath(log, InstallDirectory + "/" + SoundInstallDirectory) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/samplebank/1_export.py b/code/nel/tools/build_gamedata/processes/samplebank/1_export.py index 9760458b9..640f23282 100644 --- a/code/nel/tools/build_gamedata/processes/samplebank/1_export.py +++ b/code/nel/tools/build_gamedata/processes/samplebank/1_export.py @@ -1,49 +1,49 @@ -#!/usr/bin/python -# -# \file 1_export.py -# \brief Export samplebank -# \date 2009-06-03 10:47GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export samplebank -# -# 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 samplebank") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 1_export.py +# \brief Export samplebank +# \date 2009-06-03 10:47GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export samplebank +# +# 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 samplebank") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/samplebank/2_build.py b/code/nel/tools/build_gamedata/processes/samplebank/2_build.py index 447edd468..0e3095bb6 100644 --- a/code/nel/tools/build_gamedata/processes/samplebank/2_build.py +++ b/code/nel/tools/build_gamedata/processes/samplebank/2_build.py @@ -1,72 +1,72 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build samplebank -# \date 2009-06-03 10:47GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build samplebank -# -# 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 samplebank") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# Find tools -BuildSamplebank = findTool(log, ToolDirectories, BuildSamplebankTool, ToolSuffix) -printLog(log, "") - -# For each samplebank directory -printLog(log, ">>> Build samplebank <<<") -if BuildSamplebank == "": - toolLogFail(log, BuildSamplebankTool, ToolSuffix) -else: - sourcePath = SoundDirectory + "/" + SoundSamplebanksSourceDirectory - buildPath = ExportBuildDirectory + "/" + SoundSamplebanksBuildDirectory - mkPath(log, sourcePath) - mkPath(log, buildPath) - for dir in os.listdir(sourcePath): - dirPath = sourcePath + "/" + dir - if (os.path.isdir(dirPath)) and dir != ".svn" and dir != "*.*": - samplebankPath = buildPath + "/" + dir + ".sample_bank" - if needUpdateDirNoSubdirFile(log, dirPath, samplebankPath): - # build_samplebank - subprocess.call([ BuildSamplebank, dirPath, buildPath, dir ]) - else: - printLog(log, "SKIP " + samplebankPath) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 2_build.py +# \brief Build samplebank +# \date 2009-06-03 10:47GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Build samplebank +# +# 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 samplebank") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +# Find tools +BuildSamplebank = findTool(log, ToolDirectories, BuildSamplebankTool, ToolSuffix) +printLog(log, "") + +# For each samplebank directory +printLog(log, ">>> Build samplebank <<<") +if BuildSamplebank == "": + toolLogFail(log, BuildSamplebankTool, ToolSuffix) +else: + sourcePath = SoundDirectory + "/" + SoundSamplebanksSourceDirectory + buildPath = ExportBuildDirectory + "/" + SoundSamplebanksBuildDirectory + mkPath(log, sourcePath) + mkPath(log, buildPath) + for dir in os.listdir(sourcePath): + dirPath = sourcePath + "/" + dir + if (os.path.isdir(dirPath)) and dir != ".svn" and dir != "*.*": + samplebankPath = buildPath + "/" + dir + ".sample_bank" + if needUpdateDirNoSubdirFile(log, dirPath, samplebankPath): + # build_samplebank + subprocess.call([ BuildSamplebank, dirPath, buildPath, dir ]) + else: + printLog(log, "SKIP " + samplebankPath) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/samplebank/3_install.py b/code/nel/tools/build_gamedata/processes/samplebank/3_install.py index 104f76681..5ac6962d7 100644 --- a/code/nel/tools/build_gamedata/processes/samplebank/3_install.py +++ b/code/nel/tools/build_gamedata/processes/samplebank/3_install.py @@ -1,55 +1,55 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install samplebank -# \date 2009-06-03 10:47GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install samplebank -# -# 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, "--- Install samplebank") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -printLog(log, ">>> Install samplebank <<<") -mkPath(log, ExportBuildDirectory + "/" + SoundSamplebanksBuildDirectory) -mkPath(log, InstallDirectory + "/" + SoundInstallDirectory) -copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + SoundSamplebanksBuildDirectory, InstallDirectory + "/" + SoundInstallDirectory, ".sample_bank") - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install samplebank +# \date 2009-06-03 10:47GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install samplebank +# +# 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 samplebank") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +printLog(log, ">>> Install samplebank <<<") +mkPath(log, ExportBuildDirectory + "/" + SoundSamplebanksBuildDirectory) +mkPath(log, InstallDirectory + "/" + SoundInstallDirectory) +copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + SoundSamplebanksBuildDirectory, InstallDirectory + "/" + SoundInstallDirectory, ".sample_bank") + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/shape/0_setup.py b/code/nel/tools/build_gamedata/processes/shape/0_setup.py old mode 100755 new mode 100644 index 25eabed9e..34fc571a6 --- a/code/nel/tools/build_gamedata/processes/shape/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/shape/0_setup.py @@ -1,84 +1,84 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief setup shape -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup 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, "--- Setup shape") -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 <<<") -for dir in ShapeSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - -# Setup pipeline lookup directories -printLog(log, ">>> Setup pipeline lookup directories <<<") -for dir in MapLookupDirectories: - mkPath(log, ExportBuildDirectory + "/" + dir) - -# Setup export directories -printLog(log, ">>> Setup export directories <<<") -mkPath(log, ExportBuildDirectory + "/" + ShapeTagExportDirectory) -mkPath(log, ExportBuildDirectory + "/" + ShapeNotOptimizedExportDirectory) -mkPath(log, ExportBuildDirectory + "/" + ShapeWithCoarseMeshExportDirectory) -mkPath(log, ExportBuildDirectory + "/" + ShapeLightmapNotOptimizedExportDirectory) -mkPath(log, ExportBuildDirectory + "/" + ShapeAnimExportDirectory) -if ClodConfigFile != "": - mkPath(log, ExportBuildDirectory + "/" + ClodExportDirectory) -if BuildShadowSkinEnabled: - mkPath(log, ExportBuildDirectory + "/" + ShapeShadowSkinBuildDirectory) - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") -mkPath(log, ExportBuildDirectory + "/" + ShapeClodtexBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + ShapeWithCoarseMeshBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + ShapeOptimizedBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + ShapeLightmapBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + ShapeLightmap16BitsBuildDirectory) - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") -mkPath(log, InstallDirectory + "/" + ShapeInstallDirectory) -mkPath(log, InstallDirectory + "/" + LightmapInstallDirectory) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief setup shape +# \date 2010-05-24 13:42GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup 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, "--- Setup shape") +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 <<<") +for dir in ShapeSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) + +# Setup pipeline lookup directories +printLog(log, ">>> Setup pipeline lookup directories <<<") +for dir in MapLookupDirectories: + mkPath(log, ExportBuildDirectory + "/" + dir) + +# Setup export directories +printLog(log, ">>> Setup export directories <<<") +mkPath(log, ExportBuildDirectory + "/" + ShapeTagExportDirectory) +mkPath(log, ExportBuildDirectory + "/" + ShapeNotOptimizedExportDirectory) +mkPath(log, ExportBuildDirectory + "/" + ShapeWithCoarseMeshExportDirectory) +mkPath(log, ExportBuildDirectory + "/" + ShapeLightmapNotOptimizedExportDirectory) +mkPath(log, ExportBuildDirectory + "/" + ShapeAnimExportDirectory) +if ClodConfigFile != "": + mkPath(log, ExportBuildDirectory + "/" + ClodExportDirectory) +if BuildShadowSkinEnabled: + mkPath(log, ExportBuildDirectory + "/" + ShapeShadowSkinBuildDirectory) + +# Setup build directories +printLog(log, ">>> Setup build directories <<<") +mkPath(log, ExportBuildDirectory + "/" + ShapeClodtexBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + ShapeWithCoarseMeshBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + ShapeOptimizedBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + ShapeLightmapBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + ShapeLightmap16BitsBuildDirectory) + +# Setup client directories +printLog(log, ">>> Setup client directories <<<") +mkPath(log, InstallDirectory + "/" + ShapeInstallDirectory) +mkPath(log, InstallDirectory + "/" + LightmapInstallDirectory) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/shape/1_export.py b/code/nel/tools/build_gamedata/processes/shape/1_export.py old mode 100755 new mode 100644 index f30338264..b230fdc7c --- a/code/nel/tools/build_gamedata/processes/shape/1_export.py +++ b/code/nel/tools/build_gamedata/processes/shape/1_export.py @@ -1,156 +1,156 @@ -#!/usr/bin/python -# -# \file 1_export.py -# \brief Export shape -# \date 2010-09-20-18-35-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export 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") -if os.path.isfile("temp_log.log"): - os.remove("temp_log.log") -log = open("temp_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 shape") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# Override config values for draft mode -if BuildQuality == 0: - ShapeExportOptExportLighting = "false" - ShapeExportOptShadow = "false" - ShapeExportOptLightingLimit = 0 - ShapeExportOptLumelSize = "0.25" - ShapeExportOptOversampling = 1 - - -# Find tools -# ... - -# Export shape 3dsmax -if MaxAvailable: - # Find tools - Max = findMax(log, MaxDirectory, MaxExecutable) - printLog(log, "") - - printLog(log, ">>> Export shape 3dsmax <<<") - tagDirectory = ExportBuildDirectory + "/" + ShapeTagExportDirectory - mkPath(log, tagDirectory) - outDirWithoutCoarse = ExportBuildDirectory + "/" + ShapeNotOptimizedExportDirectory - mkPath(log, outDirWithoutCoarse) - outDirWithCoarse = ExportBuildDirectory + "/" + ShapeWithCoarseMeshExportDirectory - mkPath(log, outDirWithCoarse) - outDirLightmap = ExportBuildDirectory + "/" + ShapeLightmapNotOptimizedExportDirectory - mkPath(log, outDirLightmap) - outDirAnim = ExportBuildDirectory + "/" + ShapeAnimExportDirectory - mkPath(log, outDirAnim) - for dir in ShapeSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - if (needUpdateDirByTagLog(log, DatabaseDirectory + "/" + dir, ".max", ExportBuildDirectory + "/" + ShapeTagExportDirectory, ".max.tag")): - scriptSrc = "maxscript/shape_export.ms" - scriptDst = MaxUserDirectory + "/scripts/shape_export.ms" - outputLogfile = ScriptDirectory + "/processes/shape/log.log" - maxRunningTagFile = tagDirectory + "/max_running.tag" - maxSourceDir = DatabaseDirectory + "/" + dir - tagList = findFiles(log, tagDirectory, "", ".max.tag") - tagLen = len(tagList) - if os.path.isfile(scriptDst): - os.remove(scriptDst) - tagDiff = 1 - sSrc = open(scriptSrc, "r") - sDst = open(scriptDst, "w") - for line in sSrc: - newline = line.replace("%OutputLogfile%", outputLogfile) - newline = newline.replace("%MaxSourceDirectory%", maxSourceDir) - newline = newline.replace("%TagDirectory%", tagDirectory) - newline = newline.replace("%OutputDirectoryWithoutCoarseMesh%", outDirWithoutCoarse) - newline = newline.replace("%OutputDirectoryWithCoarseMesh%", outDirWithCoarse) - newline = newline.replace("%OutputDirectoryLightmap%", outDirLightmap) - newline = newline.replace("%OutputDirectoryAnim%", outDirAnim) - newline = newline.replace("%ShapeExportOptExportLighting%", ShapeExportOptExportLighting) - newline = newline.replace("%ShapeExportOptShadow%", ShapeExportOptShadow) - newline = newline.replace("%ShapeExportOptLightingLimit%", str(ShapeExportOptLightingLimit)) - newline = newline.replace("%ShapeExportOptLumelSize%", ShapeExportOptLumelSize) - newline = newline.replace("%ShapeExportOptOversampling%", str(ShapeExportOptOversampling)) - newline = newline.replace("%ShapeExportOptLightmapLog%", ShapeExportOptLightmapLog) - sDst.write(newline) - sSrc.close() - sDst.close() - zeroRetryLimit = 3 - while tagDiff > 0: - mrt = open(maxRunningTagFile, "w") - mrt.write("moe-moe-kyun") - mrt.close() - printLog(log, "MAXSCRIPT " + scriptDst) - subprocess.call([ Max, "-U", "MAXScript", "shape_export.ms", "-q", "-mi", "-mip" ]) - if os.path.exists(outputLogfile): - try: - lSrc = open(outputLogfile, "r") - for line in lSrc: - lineStrip = line.strip() - if (len(lineStrip) > 0): - printLog(log, lineStrip) - lSrc.close() - os.remove(outputLogfile) - except Exception: - printLog(log, "ERROR Failed to read 3dsmax log") - else: - printLog(log, "WARNING No 3dsmax log") - tagList = findFiles(log, tagDirectory, "", ".max.tag") - newTagLen = len(tagList) - tagDiff = newTagLen - tagLen - tagLen = newTagLen - addTagDiff = 0 - if os.path.exists(maxRunningTagFile): - printLog(log, "FAIL 3ds Max crashed and/or file export failed!") - if tagDiff == 0: - if zeroRetryLimit > 0: - zeroRetryLimit = zeroRetryLimit - 1 - addTagDiff = 1 - else: - printLog(log, "FAIL Retry limit reached!") - else: - addTagDiff = 1 - os.remove(maxRunningTagFile) - printLog(log, "Exported " + str(tagDiff) + " .max files!") - tagDiff += addTagDiff - os.remove(scriptDst) - printLog(log, "") - -log.close() -if os.path.isfile("log.log"): - os.remove("log.log") -shutil.move("temp_log.log", "log.log") - - -# end of file +#!/usr/bin/python +# +# \file 1_export.py +# \brief Export shape +# \date 2010-09-20-18-35-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export 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") +if os.path.isfile("temp_log.log"): + os.remove("temp_log.log") +log = open("temp_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 shape") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +# Override config values for draft mode +if BuildQuality == 0: + ShapeExportOptExportLighting = "false" + ShapeExportOptShadow = "false" + ShapeExportOptLightingLimit = 0 + ShapeExportOptLumelSize = "0.25" + ShapeExportOptOversampling = 1 + + +# Find tools +# ... + +# Export shape 3dsmax +if MaxAvailable: + # Find tools + Max = findMax(log, MaxDirectory, MaxExecutable) + printLog(log, "") + + printLog(log, ">>> Export shape 3dsmax <<<") + tagDirectory = ExportBuildDirectory + "/" + ShapeTagExportDirectory + mkPath(log, tagDirectory) + outDirWithoutCoarse = ExportBuildDirectory + "/" + ShapeNotOptimizedExportDirectory + mkPath(log, outDirWithoutCoarse) + outDirWithCoarse = ExportBuildDirectory + "/" + ShapeWithCoarseMeshExportDirectory + mkPath(log, outDirWithCoarse) + outDirLightmap = ExportBuildDirectory + "/" + ShapeLightmapNotOptimizedExportDirectory + mkPath(log, outDirLightmap) + outDirAnim = ExportBuildDirectory + "/" + ShapeAnimExportDirectory + mkPath(log, outDirAnim) + for dir in ShapeSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) + if (needUpdateDirByTagLog(log, DatabaseDirectory + "/" + dir, ".max", ExportBuildDirectory + "/" + ShapeTagExportDirectory, ".max.tag")): + scriptSrc = "maxscript/shape_export.ms" + scriptDst = MaxUserDirectory + "/scripts/shape_export.ms" + outputLogfile = ScriptDirectory + "/processes/shape/log.log" + maxRunningTagFile = tagDirectory + "/max_running.tag" + maxSourceDir = DatabaseDirectory + "/" + dir + tagList = findFiles(log, tagDirectory, "", ".max.tag") + tagLen = len(tagList) + if os.path.isfile(scriptDst): + os.remove(scriptDst) + tagDiff = 1 + sSrc = open(scriptSrc, "r") + sDst = open(scriptDst, "w") + for line in sSrc: + newline = line.replace("%OutputLogfile%", outputLogfile) + newline = newline.replace("%MaxSourceDirectory%", maxSourceDir) + newline = newline.replace("%TagDirectory%", tagDirectory) + newline = newline.replace("%OutputDirectoryWithoutCoarseMesh%", outDirWithoutCoarse) + newline = newline.replace("%OutputDirectoryWithCoarseMesh%", outDirWithCoarse) + newline = newline.replace("%OutputDirectoryLightmap%", outDirLightmap) + newline = newline.replace("%OutputDirectoryAnim%", outDirAnim) + newline = newline.replace("%ShapeExportOptExportLighting%", ShapeExportOptExportLighting) + newline = newline.replace("%ShapeExportOptShadow%", ShapeExportOptShadow) + newline = newline.replace("%ShapeExportOptLightingLimit%", str(ShapeExportOptLightingLimit)) + newline = newline.replace("%ShapeExportOptLumelSize%", ShapeExportOptLumelSize) + newline = newline.replace("%ShapeExportOptOversampling%", str(ShapeExportOptOversampling)) + newline = newline.replace("%ShapeExportOptLightmapLog%", ShapeExportOptLightmapLog) + sDst.write(newline) + sSrc.close() + sDst.close() + zeroRetryLimit = 3 + while tagDiff > 0: + mrt = open(maxRunningTagFile, "w") + mrt.write("moe-moe-kyun") + mrt.close() + printLog(log, "MAXSCRIPT " + scriptDst) + subprocess.call([ Max, "-U", "MAXScript", "shape_export.ms", "-q", "-mi", "-mip" ]) + if os.path.exists(outputLogfile): + try: + lSrc = open(outputLogfile, "r") + for line in lSrc: + lineStrip = line.strip() + if (len(lineStrip) > 0): + printLog(log, lineStrip) + lSrc.close() + os.remove(outputLogfile) + except Exception: + printLog(log, "ERROR Failed to read 3dsmax log") + else: + printLog(log, "WARNING No 3dsmax log") + tagList = findFiles(log, tagDirectory, "", ".max.tag") + newTagLen = len(tagList) + tagDiff = newTagLen - tagLen + tagLen = newTagLen + addTagDiff = 0 + if os.path.exists(maxRunningTagFile): + printLog(log, "FAIL 3ds Max crashed and/or file export failed!") + if tagDiff == 0: + if zeroRetryLimit > 0: + zeroRetryLimit = zeroRetryLimit - 1 + addTagDiff = 1 + else: + printLog(log, "FAIL Retry limit reached!") + else: + addTagDiff = 1 + os.remove(maxRunningTagFile) + printLog(log, "Exported " + str(tagDiff) + " .max files!") + tagDiff += addTagDiff + os.remove(scriptDst) + printLog(log, "") + +log.close() +if os.path.isfile("log.log"): + os.remove("log.log") +shutil.move("temp_log.log", "log.log") + + +# 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 old mode 100755 new mode 100644 index f261473fe..3881a35ec --- a/code/nel/tools/build_gamedata/processes/shape/2_build.py +++ b/code/nel/tools/build_gamedata/processes/shape/2_build.py @@ -1,191 +1,198 @@ -#!/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") - -# 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 +#!/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/shape/3_install.py b/code/nel/tools/build_gamedata/processes/shape/3_install.py old mode 100755 new mode 100644 index d96770c28..f461ee4f7 --- a/code/nel/tools/build_gamedata/processes/shape/3_install.py +++ b/code/nel/tools/build_gamedata/processes/shape/3_install.py @@ -1,70 +1,70 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install shape -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install 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, "--- Install shape") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -printLog(log, ">>> Install shape <<<") -installPath = InstallDirectory + "/" + ShapeInstallDirectory -mkPath(log, installPath) -mkPath(log, ExportBuildDirectory + "/" + ShapeOptimizedBuildDirectory) -copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + ShapeOptimizedBuildDirectory, installPath, ".shape") -mkPath(log, ExportBuildDirectory + "/" + ShapeWithCoarseMeshBuildDirectory) -copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + ShapeWithCoarseMeshBuildDirectory, installPath, ".shape") -copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + ShapeWithCoarseMeshBuildDirectory, installPath, ".dds") - -mkPath(log, ExportBuildDirectory + "/" + ShapeAnimExportDirectory) -copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + ShapeAnimExportDirectory, installPath, ".anim") - -# ls anim | grep ".anim" >> $client_directory/auto_animations_list.txt - -printLog(log, ">>> Install shape lightmaps <<<") -installPath = InstallDirectory + "/" + LightmapInstallDirectory -mkPath(log, installPath) -mkPath(log, ExportBuildDirectory + "/" + ShapeLightmap16BitsBuildDirectory) -copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + ShapeLightmap16BitsBuildDirectory, installPath, ".tga") - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install shape +# \date 2010-05-24 13:42GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install 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_local import * +from process import * +from tools import * +from directories import * + +printLog(log, "") +printLog(log, "-------") +printLog(log, "--- Install shape") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +printLog(log, ">>> Install shape <<<") +installPath = InstallDirectory + "/" + ShapeInstallDirectory +mkPath(log, installPath) +mkPath(log, ExportBuildDirectory + "/" + ShapeOptimizedBuildDirectory) +copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + ShapeOptimizedBuildDirectory, installPath, ".shape") +mkPath(log, ExportBuildDirectory + "/" + ShapeWithCoarseMeshBuildDirectory) +copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + ShapeWithCoarseMeshBuildDirectory, installPath, ".shape") +copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + ShapeWithCoarseMeshBuildDirectory, installPath, ".dds") + +mkPath(log, ExportBuildDirectory + "/" + ShapeAnimExportDirectory) +copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + ShapeAnimExportDirectory, installPath, ".anim") + +# ls anim | grep ".anim" >> $client_directory/auto_animations_list.txt + +printLog(log, ">>> Install shape lightmaps <<<") +installPath = InstallDirectory + "/" + LightmapInstallDirectory +mkPath(log, installPath) +mkPath(log, ExportBuildDirectory + "/" + ShapeLightmap16BitsBuildDirectory) +copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + ShapeLightmap16BitsBuildDirectory, installPath, ".tga") + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/shape/maxscript/shape_export.ms b/code/nel/tools/build_gamedata/processes/shape/maxscript/shape_export.ms old mode 100755 new mode 100644 diff --git a/code/nel/tools/build_gamedata/processes/sheet_id/0_setup.py b/code/nel/tools/build_gamedata/processes/sheet_id/0_setup.py old mode 100755 new mode 100644 index 94fd8210f..d7f1f9fae --- a/code/nel/tools/build_gamedata/processes/sheet_id/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/sheet_id/0_setup.py @@ -1,63 +1,63 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief Setup sheet_id -# \date 2009-06-03 10:47GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup sheet_id -# -# 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 sheet_id") -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, LeveldesignDirectory) -mkPath(log, LeveldesignWorldDirectory) - -# Setup export directories -printLog(log, ">>> Setup export directories <<<") - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief Setup sheet_id +# \date 2009-06-03 10:47GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup sheet_id +# +# 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 sheet_id") +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, LeveldesignDirectory) +mkPath(log, LeveldesignWorldDirectory) + +# Setup export directories +printLog(log, ">>> Setup export directories <<<") + +# Setup build directories +printLog(log, ">>> Setup build directories <<<") + +# Setup client directories +printLog(log, ">>> Setup client directories <<<") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/sheet_id/1_export.py b/code/nel/tools/build_gamedata/processes/sheet_id/1_export.py old mode 100755 new mode 100644 index 29387c55f..4de39e71b --- a/code/nel/tools/build_gamedata/processes/sheet_id/1_export.py +++ b/code/nel/tools/build_gamedata/processes/sheet_id/1_export.py @@ -1,49 +1,49 @@ -#!/usr/bin/python -# -# \file 1_export.py -# \brief Export sheet_id -# \date 2009-06-03 10:47GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export sheet_id -# -# 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 sheet_id") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 1_export.py +# \brief Export sheet_id +# \date 2009-06-03 10:47GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export sheet_id +# +# 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 sheet_id") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/sheet_id/2_build.py b/code/nel/tools/build_gamedata/processes/sheet_id/2_build.py old mode 100755 new mode 100644 index 51fdefc0f..7bc6b1f9c --- a/code/nel/tools/build_gamedata/processes/sheet_id/2_build.py +++ b/code/nel/tools/build_gamedata/processes/sheet_id/2_build.py @@ -1,63 +1,63 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build sheet_id -# \date 2009-06-03 10:47GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build sheet_id -# -# 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 sheet_id") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# Find tools -MakeSheetId = findTool(log, ToolDirectories, MakeSheetIdTool, ToolSuffix) -printLog(log, "") - -# For each sheet_id directory -printLog(log, ">>> Build sheet_id <<<") -if MakeSheetId == "": - toolLogFail(log, MakeSheetIdTool, ToolSuffix) -else: - mkPath(log, LeveldesignDirectory) - mkPath(log, LeveldesignWorldDirectory) - subprocess.call([ MakeSheetId, "-o" + LeveldesignDirectory + "/game_elem/sheet_id.bin", LeveldesignDirectory + "/game_elem", LeveldesignDirectory + "/game_element", LeveldesignWorldDirectory, DataShardDirectory + "/mirror_sheets" ]) # FIXME: Hardcoded path mirror_sheets -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 2_build.py +# \brief Build sheet_id +# \date 2009-06-03 10:47GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Build sheet_id +# +# 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 sheet_id") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +# Find tools +MakeSheetId = findTool(log, ToolDirectories, MakeSheetIdTool, ToolSuffix) +printLog(log, "") + +# For each sheet_id directory +printLog(log, ">>> Build sheet_id <<<") +if MakeSheetId == "": + toolLogFail(log, MakeSheetIdTool, ToolSuffix) +else: + mkPath(log, LeveldesignDirectory) + mkPath(log, LeveldesignWorldDirectory) + subprocess.call([ MakeSheetId, "-o" + LeveldesignDirectory + "/game_elem/sheet_id.bin", LeveldesignDirectory + "/game_elem", LeveldesignDirectory + "/game_element", LeveldesignWorldDirectory, DataShardDirectory + "/mirror_sheets" ]) # FIXME: Hardcoded path mirror_sheets +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/sheet_id/3_install.py b/code/nel/tools/build_gamedata/processes/sheet_id/3_install.py old mode 100755 new mode 100644 index 9f27b0dae..1c3806950 --- a/code/nel/tools/build_gamedata/processes/sheet_id/3_install.py +++ b/code/nel/tools/build_gamedata/processes/sheet_id/3_install.py @@ -1,50 +1,50 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install sheet_id -# \date 2009-06-03 10:47GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install sheet_id -# -# 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, "--- Install sheet_id") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install sheet_id +# \date 2009-06-03 10:47GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install sheet_id +# +# 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 sheet_id") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/sheets/0_setup.py b/code/nel/tools/build_gamedata/processes/sheets/0_setup.py old mode 100755 new mode 100644 index 0ad1a3655..deb723745 --- a/code/nel/tools/build_gamedata/processes/sheets/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/sheets/0_setup.py @@ -1,69 +1,69 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief Setup sheets -# \date 2009-06-03 10:47GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup sheets -# -# 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 sheets") -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, LeveldesignDirectory) -mkPath(log, LeveldesignDfnDirectory) -mkPath(log, DataCommonDirectory) -mkPath(log, GamedevDirectory) -mkPath(log, PrimitivesDirectory) - -# Setup export directories -printLog(log, ">>> Setup export directories <<<") - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") -mkPath(log, ExportBuildDirectory + "/" + SheetsBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + VisualSlotTabBuildDirectory) - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") -mkPath(log, InstallDirectory + "/" + SheetsInstallDirectory) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief Setup sheets +# \date 2009-06-03 10:47GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup sheets +# +# 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 sheets") +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, LeveldesignDirectory) +mkPath(log, LeveldesignDfnDirectory) +mkPath(log, DataCommonDirectory) +mkPath(log, GamedevDirectory) +mkPath(log, PrimitivesDirectory) + +# Setup export directories +printLog(log, ">>> Setup export directories <<<") + +# Setup build directories +printLog(log, ">>> Setup build directories <<<") +mkPath(log, ExportBuildDirectory + "/" + SheetsBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + VisualSlotTabBuildDirectory) + +# Setup client directories +printLog(log, ">>> Setup client directories <<<") +mkPath(log, InstallDirectory + "/" + SheetsInstallDirectory) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/sheets/1_export.py b/code/nel/tools/build_gamedata/processes/sheets/1_export.py old mode 100755 new mode 100644 index 1a8cc51af..f75252742 --- a/code/nel/tools/build_gamedata/processes/sheets/1_export.py +++ b/code/nel/tools/build_gamedata/processes/sheets/1_export.py @@ -1,49 +1,49 @@ -#!/usr/bin/python -# -# \file 1_export.py -# \brief Export sheets -# \date 2009-06-03 10:47GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export sheets -# -# 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 sheets") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 1_export.py +# \brief Export sheets +# \date 2009-06-03 10:47GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export sheets +# +# 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 sheets") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/sheets/2_build.py b/code/nel/tools/build_gamedata/processes/sheets/2_build.py old mode 100755 new mode 100644 index ea8f899d2..c04113c52 --- a/code/nel/tools/build_gamedata/processes/sheets/2_build.py +++ b/code/nel/tools/build_gamedata/processes/sheets/2_build.py @@ -1,88 +1,88 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build sheets -# \date 2009-06-03 10:47GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build sheets -# -# 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 sheets") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# Find tools -SheetsPacker = findTool(log, ToolDirectories, SheetsPackerTool, ToolSuffix) -printLog(log, "") - -# For each sheets directory -printLog(log, ">>> Build sheets <<<") -if SheetsPacker == "": - toolLogFail(log, SheetsPackerTool, ToolSuffix) -else: - mkPath(log, LeveldesignDirectory) - mkPath(log, LeveldesignDfnDirectory) - mkPath(log, DataCommonDirectory) - mkPath(log, GamedevDirectory) - mkPath(log, PrimitivesDirectory) - mkPath(log, ExportBuildDirectory + "/" + SheetsBuildDirectory) - cf = open("sheets_packer.cfg", "w") - cf.write("\n") - cf.write("// SHEETS PACKER CONFIG FILE\n") - cf.write("\n") - cf.write("DataPath = \n") - cf.write("{\n") - cf.write("\t\"" + LeveldesignDirectory + "\", \n") - cf.write("\t\"" + LeveldesignDfnDirectory + "\", \n") - cf.write("\t\"" + DataCommonDirectory + "\", \n") - cf.write("\t\"" + GamedevDirectory + "\", \n") - cf.write("\t\"" + PrimitivesDirectory + "\", \n") - cf.write("};\n") - cf.write("WorldSheet = \"" + WorldSheet + "\";\n") - cf.write("PrimitivesPath = \"" + PrimitivesDirectory + "\";\n") - cf.write("OutputDataPath = \"" + ExportBuildDirectory + "/" + SheetsBuildDirectory + "\";\n") - cf.write("LigoPrimitiveClass = \"" + LigoPrimitiveClass + "\";\n") - cf.write("\n") - cf.close() - subprocess.call([ SheetsPacker ]) - mkPath(log, ExportBuildDirectory + "/" + VisualSlotTabBuildDirectory) - copyFileIfNeeded(log, "visual_slot.tab", ExportBuildDirectory + "/" + VisualSlotTabBuildDirectory + "/visual_slot.tab") - os.remove("visual_slot.tab") -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 2_build.py +# \brief Build sheets +# \date 2009-06-03 10:47GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Build sheets +# +# 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 sheets") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +# Find tools +SheetsPacker = findTool(log, ToolDirectories, SheetsPackerTool, ToolSuffix) +printLog(log, "") + +# For each sheets directory +printLog(log, ">>> Build sheets <<<") +if SheetsPacker == "": + toolLogFail(log, SheetsPackerTool, ToolSuffix) +else: + mkPath(log, LeveldesignDirectory) + mkPath(log, LeveldesignDfnDirectory) + mkPath(log, DataCommonDirectory) + mkPath(log, GamedevDirectory) + mkPath(log, PrimitivesDirectory) + mkPath(log, ExportBuildDirectory + "/" + SheetsBuildDirectory) + cf = open("sheets_packer.cfg", "w") + cf.write("\n") + cf.write("// SHEETS PACKER CONFIG FILE\n") + cf.write("\n") + cf.write("DataPath = \n") + cf.write("{\n") + cf.write("\t\"" + LeveldesignDirectory + "\", \n") + cf.write("\t\"" + LeveldesignDfnDirectory + "\", \n") + cf.write("\t\"" + DataCommonDirectory + "\", \n") + cf.write("\t\"" + GamedevDirectory + "\", \n") + cf.write("\t\"" + PrimitivesDirectory + "\", \n") + cf.write("};\n") + cf.write("WorldSheet = \"" + WorldSheet + "\";\n") + cf.write("PrimitivesPath = \"" + PrimitivesDirectory + "\";\n") + cf.write("OutputDataPath = \"" + ExportBuildDirectory + "/" + SheetsBuildDirectory + "\";\n") + cf.write("LigoPrimitiveClass = \"" + LigoPrimitiveClass + "\";\n") + cf.write("\n") + cf.close() + subprocess.call([ SheetsPacker ]) + mkPath(log, ExportBuildDirectory + "/" + VisualSlotTabBuildDirectory) + copyFileIfNeeded(log, "visual_slot.tab", ExportBuildDirectory + "/" + VisualSlotTabBuildDirectory + "/visual_slot.tab") + os.remove("visual_slot.tab") +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/sheets/3_install.py b/code/nel/tools/build_gamedata/processes/sheets/3_install.py old mode 100755 new mode 100644 index ed6efaffd..0ef233783 --- a/code/nel/tools/build_gamedata/processes/sheets/3_install.py +++ b/code/nel/tools/build_gamedata/processes/sheets/3_install.py @@ -1,58 +1,58 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install sheets -# \date 2009-06-03 10:47GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install sheets -# -# 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, "--- Install sheets") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -installPath = InstallDirectory + "/" + SheetsInstallDirectory -mkPath(log, installPath) - -printLog(log, ">>> Install sheets <<<") -mkPath(log, ExportBuildDirectory + "/" + SheetsBuildDirectory) -copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + SheetsBuildDirectory, installPath, ".packed_sheets") -copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + SheetsBuildDirectory, installPath, ".packed") - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install sheets +# \date 2009-06-03 10:47GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install sheets +# +# 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 sheets") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +installPath = InstallDirectory + "/" + SheetsInstallDirectory +mkPath(log, installPath) + +printLog(log, ">>> Install sheets <<<") +mkPath(log, ExportBuildDirectory + "/" + SheetsBuildDirectory) +copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + SheetsBuildDirectory, installPath, ".packed_sheets") +copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + SheetsBuildDirectory, installPath, ".packed") + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/sheets_shard/0_setup.py b/code/nel/tools/build_gamedata/processes/sheets_shard/0_setup.py old mode 100755 new mode 100644 index bc3024f3b..5c333d93f --- a/code/nel/tools/build_gamedata/processes/sheets_shard/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/sheets_shard/0_setup.py @@ -1,67 +1,67 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief Setup sheets -# \date 2014-02-19 22:39GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup shard sheets -# -# NeL - MMORPG Framework -# Copyright (C) 2010-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 shard sheets") -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, LeveldesignDirectory) -mkPath(log, LeveldesignDfnDirectory) -mkPath(log, ExportBuildDirectory + "/" + VisualSlotTabBuildDirectory) -mkPath(log, DataShardDirectory + "/mirror_sheets") # FIXME: Hardcoded path mirror_sheets - -# Setup export directories -printLog(log, ">>> Setup export directories <<<") - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") -mkPath(log, ExportBuildDirectory + "/" + SheetsShardBuildDirectory) - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") -mkPath(log, InstallDirectory + "/" + SheetsShardInstallDirectory) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief Setup sheets +# \date 2014-02-19 22:39GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup shard sheets +# +# NeL - MMORPG Framework +# Copyright (C) 2010-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 shard sheets") +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, LeveldesignDirectory) +mkPath(log, LeveldesignDfnDirectory) +mkPath(log, ExportBuildDirectory + "/" + VisualSlotTabBuildDirectory) +mkPath(log, DataShardDirectory + "/mirror_sheets") # FIXME: Hardcoded path mirror_sheets + +# Setup export directories +printLog(log, ">>> Setup export directories <<<") + +# Setup build directories +printLog(log, ">>> Setup build directories <<<") +mkPath(log, ExportBuildDirectory + "/" + SheetsShardBuildDirectory) + +# Setup client directories +printLog(log, ">>> Setup client directories <<<") +mkPath(log, InstallDirectory + "/" + SheetsShardInstallDirectory) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/sheets_shard/1_export.py b/code/nel/tools/build_gamedata/processes/sheets_shard/1_export.py old mode 100755 new mode 100644 index 650e0307d..70b00334a --- a/code/nel/tools/build_gamedata/processes/sheets_shard/1_export.py +++ b/code/nel/tools/build_gamedata/processes/sheets_shard/1_export.py @@ -1,49 +1,49 @@ -#!/usr/bin/python -# -# \file 1_export.py -# \brief Export sheets -# \date 2014-02-19 22:39GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export shard sheets -# -# NeL - MMORPG Framework -# Copyright (C) 2010-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 shard sheets") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 1_export.py +# \brief Export sheets +# \date 2014-02-19 22:39GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export shard sheets +# +# NeL - MMORPG Framework +# Copyright (C) 2010-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 shard sheets") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/sheets_shard/2_build.py b/code/nel/tools/build_gamedata/processes/sheets_shard/2_build.py old mode 100755 new mode 100644 index c66de2b28..acf21c8fd --- a/code/nel/tools/build_gamedata/processes/sheets_shard/2_build.py +++ b/code/nel/tools/build_gamedata/processes/sheets_shard/2_build.py @@ -1,67 +1,67 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build sheets -# \date 2014-02-19 22:39GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build shard sheets -# -# NeL - MMORPG Framework -# Copyright (C) 2010-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 sheets") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# Find tools -SheetsPackerShard = findTool(log, ToolDirectories, SheetsPackerShardTool, ToolSuffix) -printLog(log, "") - -# For each sheets directory -printLog(log, ">>> Build shard sheets <<<") -if SheetsPackerShard == "": - toolLogFail(log, SheetsPackerShardTool, ToolSuffix) -else: - mkPath(log, LeveldesignDirectory) - mkPath(log, LeveldesignDfnDirectory) - mkPath(log, ExportBuildDirectory + "/" + VisualSlotTabBuildDirectory) - mkPath(log, DataShardDirectory + "/mirror_sheets") # FIXME: Hardcoded path mirror_sheets - mkPath(log, ExportBuildDirectory + "/" + SheetsShardBuildDirectory) - # sheets_packer_shard - subprocess.call([ SheetsPackerShard, LeveldesignDirectory, LeveldesignDfnDirectory, DataShardDirectory + "/mirror_sheets", ExportBuildDirectory + "/" + VisualSlotTabBuildDirectory, ExportBuildDirectory + "/" + SheetsShardBuildDirectory ]) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 2_build.py +# \brief Build sheets +# \date 2014-02-19 22:39GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Build shard sheets +# +# NeL - MMORPG Framework +# Copyright (C) 2010-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 sheets") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +# Find tools +SheetsPackerShard = findTool(log, ToolDirectories, SheetsPackerShardTool, ToolSuffix) +printLog(log, "") + +# For each sheets directory +printLog(log, ">>> Build shard sheets <<<") +if SheetsPackerShard == "": + toolLogFail(log, SheetsPackerShardTool, ToolSuffix) +else: + mkPath(log, LeveldesignDirectory) + mkPath(log, LeveldesignDfnDirectory) + mkPath(log, ExportBuildDirectory + "/" + VisualSlotTabBuildDirectory) + mkPath(log, DataShardDirectory + "/mirror_sheets") # FIXME: Hardcoded path mirror_sheets + mkPath(log, ExportBuildDirectory + "/" + SheetsShardBuildDirectory) + # sheets_packer_shard + subprocess.call([ SheetsPackerShard, LeveldesignDirectory, LeveldesignDfnDirectory, DataShardDirectory + "/mirror_sheets", ExportBuildDirectory + "/" + VisualSlotTabBuildDirectory, ExportBuildDirectory + "/" + SheetsShardBuildDirectory ]) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/sheets_shard/3_install.py b/code/nel/tools/build_gamedata/processes/sheets_shard/3_install.py old mode 100755 new mode 100644 index ba7e1a8a8..cd2516dcc --- a/code/nel/tools/build_gamedata/processes/sheets_shard/3_install.py +++ b/code/nel/tools/build_gamedata/processes/sheets_shard/3_install.py @@ -1,57 +1,57 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install sheets -# \date 2014-02-19 22:39GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install shard sheets -# -# NeL - MMORPG Framework -# Copyright (C) 2010-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, "--- Install shard sheets") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -installPath = InstallDirectory + "/" + SheetsShardInstallDirectory -mkPath(log, installPath) - -printLog(log, ">>> Install sheets <<<") -mkPath(log, ExportBuildDirectory + "/" + SheetsShardBuildDirectory) -copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + SheetsShardBuildDirectory, installPath, ".packed_sheets") - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install sheets +# \date 2014-02-19 22:39GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install shard sheets +# +# NeL - MMORPG Framework +# Copyright (C) 2010-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 shard sheets") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +installPath = InstallDirectory + "/" + SheetsShardInstallDirectory +mkPath(log, installPath) + +printLog(log, ">>> Install sheets <<<") +mkPath(log, ExportBuildDirectory + "/" + SheetsShardBuildDirectory) +copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + SheetsShardBuildDirectory, installPath, ".packed_sheets") + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/sign/0_setup.py b/code/nel/tools/build_gamedata/processes/sign/0_setup.py index 418fcb15e..a0e47abc6 100644 --- a/code/nel/tools/build_gamedata/processes/sign/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/sign/0_setup.py @@ -1,64 +1,64 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief setup sign -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup sign -# -# 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 sign") -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 <<<") - -# Setup build directories -printLog(log, ">>> Setup export directories <<<") -mkPath(log, ExportBuildDirectory + "/" + UnsignedExeDllDirectory) - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") -mkPath(log, ExportBuildDirectory + "/" + SignedExeDllDirectory) - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") -mkPath(log, InstallDirectory + "/" + SignInstallDirectory) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief setup sign +# \date 2010-05-24 13:42GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup sign +# +# 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 sign") +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 <<<") + +# Setup build directories +printLog(log, ">>> Setup export directories <<<") +mkPath(log, ExportBuildDirectory + "/" + UnsignedExeDllDirectory) + +# Setup build directories +printLog(log, ">>> Setup build directories <<<") +mkPath(log, ExportBuildDirectory + "/" + SignedExeDllDirectory) + +# Setup client directories +printLog(log, ">>> Setup client directories <<<") +mkPath(log, InstallDirectory + "/" + SignInstallDirectory) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/sign/1_export.py b/code/nel/tools/build_gamedata/processes/sign/1_export.py index 352860bda..e0a47008e 100644 --- a/code/nel/tools/build_gamedata/processes/sign/1_export.py +++ b/code/nel/tools/build_gamedata/processes/sign/1_export.py @@ -1,57 +1,57 @@ -#!/usr/bin/python -# -# \file 1_export.py -# \brief Export sign -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export sign -# -# 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 sign") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -mkPath(log, ExportBuildDirectory + "/" + UnsignedExeDllDirectory) -for file in SignExeDllFiles: - printLog(log, str(WindowsExeDllCfgDirectories)) - printLog(log, file) - filePath = findFileMultiDir(log, WindowsExeDllCfgDirectories, file) - if (filePath != ""): - copyFileIfNeeded(log, filePath, ExportBuildDirectory + "/" + UnsignedExeDllDirectory + "/" + os.path.basename(file)) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 1_export.py +# \brief Export sign +# \date 2010-05-24 13:42GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export sign +# +# 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 sign") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +mkPath(log, ExportBuildDirectory + "/" + UnsignedExeDllDirectory) +for file in SignExeDllFiles: + printLog(log, str(WindowsExeDllCfgDirectories)) + printLog(log, file) + filePath = findFileMultiDir(log, WindowsExeDllCfgDirectories, file) + if (filePath != ""): + copyFileIfNeeded(log, filePath, ExportBuildDirectory + "/" + UnsignedExeDllDirectory + "/" + os.path.basename(file)) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/sign/2_build.py b/code/nel/tools/build_gamedata/processes/sign/2_build.py index c08049538..d3b1c79df 100644 --- a/code/nel/tools/build_gamedata/processes/sign/2_build.py +++ b/code/nel/tools/build_gamedata/processes/sign/2_build.py @@ -1,61 +1,61 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build sign -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build sign -# -# 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 sign") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -if SignToolSha1 != "": - unsignedDirectory = ExportBuildDirectory + "/" + UnsignedExeDllDirectory - signedDirectory = ExportBuildDirectory + "/" + SignedExeDllDirectory - mkPath(log, unsignedDirectory) - mkPath(log, signedDirectory) - unsignedFiles = os.listdir(unsignedDirectory) - for fileName in unsignedFiles: - if (fileName != ".svn" and fileName != ".." and fileName != "." and fileName != "*.*"): - if needUpdateLogRemoveDest(log, unsignedDirectory + "/" + fileName, signedDirectory + "/" + fileName): - shutil.copy(unsignedDirectory + "/" + fileName, signedDirectory + "/" + fileName) - subprocess.call([ SignToolExecutable, "sign", "/sha1", SignToolSha1, "/t", SignToolTimestamp, signedDirectory + "/" + fileName ]) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 2_build.py +# \brief Build sign +# \date 2010-05-24 13:42GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Build sign +# +# 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 sign") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +if SignToolSha1 != "": + unsignedDirectory = ExportBuildDirectory + "/" + UnsignedExeDllDirectory + signedDirectory = ExportBuildDirectory + "/" + SignedExeDllDirectory + mkPath(log, unsignedDirectory) + mkPath(log, signedDirectory) + unsignedFiles = os.listdir(unsignedDirectory) + for fileName in unsignedFiles: + if (fileName != ".svn" and fileName != ".." and fileName != "." and fileName != "*.*"): + if needUpdateLogRemoveDest(log, unsignedDirectory + "/" + fileName, signedDirectory + "/" + fileName): + shutil.copy(unsignedDirectory + "/" + fileName, signedDirectory + "/" + fileName) + subprocess.call([ SignToolExecutable, "sign", "/sha1", SignToolSha1, "/t", SignToolTimestamp, signedDirectory + "/" + fileName ]) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/sign/3_install.py b/code/nel/tools/build_gamedata/processes/sign/3_install.py index b537da92d..2e28a7b59 100644 --- a/code/nel/tools/build_gamedata/processes/sign/3_install.py +++ b/code/nel/tools/build_gamedata/processes/sign/3_install.py @@ -1,58 +1,58 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install sign -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install sign -# -# 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, "--- Install sign") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -srcDir = ExportBuildDirectory + "/" + SignedExeDllDirectory -if SignToolSha1 == "": - srcDir = ExportBuildDirectory + "/" + UnsignedExeDllDirectory -mkPath(log, srcDir) -destDir = InstallDirectory + "/" + SignInstallDirectory -mkPath(log, destDir) -copyFilesNoTreeIfNeeded(log, srcDir, destDir) - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install sign +# \date 2010-05-24 13:42GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install sign +# +# 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 sign") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +srcDir = ExportBuildDirectory + "/" + SignedExeDllDirectory +if SignToolSha1 == "": + srcDir = ExportBuildDirectory + "/" + UnsignedExeDllDirectory +mkPath(log, srcDir) +destDir = InstallDirectory + "/" + SignInstallDirectory +mkPath(log, destDir) +copyFilesNoTreeIfNeeded(log, srcDir, destDir) + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/skel/0_setup.py b/code/nel/tools/build_gamedata/processes/skel/0_setup.py old mode 100755 new mode 100644 index 7394babdd..2bb47a5d7 --- a/code/nel/tools/build_gamedata/processes/skel/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/skel/0_setup.py @@ -1,65 +1,65 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief setup skel -# \date 2009-03-10-20-23-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup skel -# -# 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 skel") -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 <<<") -for dir in SkelSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - -# Setup export directories -printLog(log, ">>> Setup export directories <<<") -mkPath(log, ExportBuildDirectory + "/" + SkelExportDirectory) - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") -mkPath(log, InstallDirectory + "/" + SkelInstallDirectory) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief setup skel +# \date 2009-03-10-20-23-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup skel +# +# 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 skel") +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 <<<") +for dir in SkelSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) + +# Setup export directories +printLog(log, ">>> Setup export directories <<<") +mkPath(log, ExportBuildDirectory + "/" + SkelExportDirectory) + +# Setup build directories +printLog(log, ">>> Setup build directories <<<") + +# Setup client directories +printLog(log, ">>> Setup client directories <<<") +mkPath(log, InstallDirectory + "/" + SkelInstallDirectory) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/skel/1_export.py b/code/nel/tools/build_gamedata/processes/skel/1_export.py old mode 100755 new mode 100644 index dcf336dbd..fe0c4577a --- a/code/nel/tools/build_gamedata/processes/skel/1_export.py +++ b/code/nel/tools/build_gamedata/processes/skel/1_export.py @@ -1,107 +1,107 @@ -#!/usr/bin/python -# -# ################################################################# -# ## WARNING : this is a generated file, don't change it ! -# ################################################################# -# -# \file 1_export.py -# \brief Export skel -# \date 2015-01-06-16-31-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export skel -# -# 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 skel") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# Find tools -# ... - -# Export skel 3dsmax -if MaxAvailable: - # Find tools - Max = findMax(log, MaxDirectory, MaxExecutable) - printLog(log, "") - - printLog(log, ">>> Export skel 3dsmax <<<") - mkPath(log, ExportBuildDirectory + "/" + SkelExportDirectory) - for dir in SkelSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - if (needUpdateDirByTagLog(log, DatabaseDirectory + "/" + dir, ".max", ExportBuildDirectory + "/" + SkelExportDirectory, ".skel")): - scriptSrc = "maxscript/skel_export.ms" - scriptDst = MaxUserDirectory + "/scripts/skel_export.ms" - outputLogfile = ScriptDirectory + "/processes/skel/log.log" - outputDirectory = ExportBuildDirectory + "/" + SkelExportDirectory - maxSourceDir = DatabaseDirectory + "/" + dir - tagList = findFiles(log, outputDirectory, "", ".skel") - tagLen = len(tagList) - if os.path.isfile(scriptDst): - os.remove(scriptDst) - tagDiff = 1 - sSrc = open(scriptSrc, "r") - sDst = open(scriptDst, "w") - for line in sSrc: - newline = line.replace("%OutputLogfile%", outputLogfile) - newline = newline.replace("%MaxSourceDirectory%", maxSourceDir) - newline = newline.replace("%OutputDirectory%", outputDirectory) - sDst.write(newline) - sSrc.close() - sDst.close() - while tagDiff > 0: - printLog(log, "MAXSCRIPT " + scriptDst) - subprocess.call([ Max, "-U", "MAXScript", "skel_export.ms", "-q", "-mi", "-mip" ]) - tagList = findFiles(log, outputDirectory, "", ".skel") - newTagLen = len(tagList) - tagDiff = newTagLen - tagLen - tagLen = newTagLen - printLog(log, "Exported " + str(tagDiff) + " .skel files!") - os.remove(scriptDst) - - - -printLog(log, ">>> Export skel directly <<<") -mkPath(log, ExportBuildDirectory + "/" + SkelExportDirectory) -for dir in SkelSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - copyFilesExtNoSubdirIfNeeded(log, DatabaseDirectory + "/" + dir, ExportBuildDirectory + "/" + SkelExportDirectory, ".skel") - - - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# ################################################################# +# ## WARNING : this is a generated file, don't change it ! +# ################################################################# +# +# \file 1_export.py +# \brief Export skel +# \date 2015-01-06-16-31-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export skel +# +# 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 skel") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +# Find tools +# ... + +# Export skel 3dsmax +if MaxAvailable: + # Find tools + Max = findMax(log, MaxDirectory, MaxExecutable) + printLog(log, "") + + printLog(log, ">>> Export skel 3dsmax <<<") + mkPath(log, ExportBuildDirectory + "/" + SkelExportDirectory) + for dir in SkelSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) + if (needUpdateDirByTagLog(log, DatabaseDirectory + "/" + dir, ".max", ExportBuildDirectory + "/" + SkelExportDirectory, ".skel")): + scriptSrc = "maxscript/skel_export.ms" + scriptDst = MaxUserDirectory + "/scripts/skel_export.ms" + outputLogfile = ScriptDirectory + "/processes/skel/log.log" + outputDirectory = ExportBuildDirectory + "/" + SkelExportDirectory + maxSourceDir = DatabaseDirectory + "/" + dir + tagList = findFiles(log, outputDirectory, "", ".skel") + tagLen = len(tagList) + if os.path.isfile(scriptDst): + os.remove(scriptDst) + tagDiff = 1 + sSrc = open(scriptSrc, "r") + sDst = open(scriptDst, "w") + for line in sSrc: + newline = line.replace("%OutputLogfile%", outputLogfile) + newline = newline.replace("%MaxSourceDirectory%", maxSourceDir) + newline = newline.replace("%OutputDirectory%", outputDirectory) + sDst.write(newline) + sSrc.close() + sDst.close() + while tagDiff > 0: + printLog(log, "MAXSCRIPT " + scriptDst) + subprocess.call([ Max, "-U", "MAXScript", "skel_export.ms", "-q", "-mi", "-mip" ]) + tagList = findFiles(log, outputDirectory, "", ".skel") + newTagLen = len(tagList) + tagDiff = newTagLen - tagLen + tagLen = newTagLen + printLog(log, "Exported " + str(tagDiff) + " .skel files!") + os.remove(scriptDst) + + + +printLog(log, ">>> Export skel directly <<<") +mkPath(log, ExportBuildDirectory + "/" + SkelExportDirectory) +for dir in SkelSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) + copyFilesExtNoSubdirIfNeeded(log, DatabaseDirectory + "/" + dir, ExportBuildDirectory + "/" + SkelExportDirectory, ".skel") + + + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/skel/2_build.py b/code/nel/tools/build_gamedata/processes/skel/2_build.py old mode 100755 new mode 100644 index 86bfce1c8..1a3935eb7 --- a/code/nel/tools/build_gamedata/processes/skel/2_build.py +++ b/code/nel/tools/build_gamedata/processes/skel/2_build.py @@ -1,49 +1,49 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build skel -# \date 2009-03-10-20-23-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build skel -# -# 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 skel") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 2_build.py +# \brief Build skel +# \date 2009-03-10-20-23-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Build skel +# +# 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 skel") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/skel/3_install.py b/code/nel/tools/build_gamedata/processes/skel/3_install.py old mode 100755 new mode 100644 index f70a0258f..5e87f7d2a --- a/code/nel/tools/build_gamedata/processes/skel/3_install.py +++ b/code/nel/tools/build_gamedata/processes/skel/3_install.py @@ -1,57 +1,57 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install skel -# \date 2009-03-10-20-23-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install skel -# -# 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, "--- Install skel") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -installPath = InstallDirectory + "/" + SkelInstallDirectory -mkPath(log, installPath) - -printLog(log, ">>> Install skel <<<") -mkPath(log, ExportBuildDirectory + "/" + SkelExportDirectory) -copyFilesNoTreeIfNeeded(log, ExportBuildDirectory + "/" + SkelExportDirectory, installPath) - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install skel +# \date 2009-03-10-20-23-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install skel +# +# 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 skel") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +installPath = InstallDirectory + "/" + SkelInstallDirectory +mkPath(log, installPath) + +printLog(log, ">>> Install skel <<<") +mkPath(log, ExportBuildDirectory + "/" + SkelExportDirectory) +copyFilesNoTreeIfNeeded(log, ExportBuildDirectory + "/" + SkelExportDirectory, installPath) + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/skel/maxscript/skel_export.ms b/code/nel/tools/build_gamedata/processes/skel/maxscript/skel_export.ms old mode 100755 new mode 100644 diff --git a/code/nel/tools/build_gamedata/processes/smallbank/0_setup.py b/code/nel/tools/build_gamedata/processes/smallbank/0_setup.py old mode 100755 new mode 100644 index 751077ba3..c07138161 --- a/code/nel/tools/build_gamedata/processes/smallbank/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/smallbank/0_setup.py @@ -1,64 +1,64 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief setup smallbank -# \date 2009-03-10-20-54-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup smallbank -# -# 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 smallbank") -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 + "/" + BankSourceDirectory) - -# Setup export directories -printLog(log, ">>> Setup export directories <<<") -mkPath(log, ExportBuildDirectory + "/" + SmallbankExportDirectory) - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") -mkPath(log, InstallDirectory + "/" + BankInstallDirectory) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief setup smallbank +# \date 2009-03-10-20-54-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup smallbank +# +# 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 smallbank") +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 + "/" + BankSourceDirectory) + +# Setup export directories +printLog(log, ">>> Setup export directories <<<") +mkPath(log, ExportBuildDirectory + "/" + SmallbankExportDirectory) + +# Setup build directories +printLog(log, ">>> Setup build directories <<<") + +# Setup client directories +printLog(log, ">>> Setup client directories <<<") +mkPath(log, InstallDirectory + "/" + BankInstallDirectory) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/smallbank/1_export.py b/code/nel/tools/build_gamedata/processes/smallbank/1_export.py old mode 100755 new mode 100644 index b7d3c6c24..2066c8bbc --- a/code/nel/tools/build_gamedata/processes/smallbank/1_export.py +++ b/code/nel/tools/build_gamedata/processes/smallbank/1_export.py @@ -1,72 +1,72 @@ -#!/usr/bin/python -# -# \file 1_export.py -# \brief Export smallbank -# \date 2009-03-10-20-54-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export smallbank -# -# 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 smallbank") -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) -BuildSmallbank = findTool(log, ToolDirectories, BuildSmallbankTool, ToolSuffix) -printLog(log, "") - -# For each bank export smallbank -printLog(log, ">>> Export smallbank <<<") -if ExecTimeout == "": - toolLogFail(log, ExecTimeoutTool, ToolSuffix) -elif BuildSmallbank == "": - toolLogFail(log, BuildSmallbankTool, ToolSuffix) -else: - mkPath(log, DatabaseDirectory + "/" + BankSourceDirectory) - mkPath(log, ExportBuildDirectory + "/" + SmallbankExportDirectory) - files = findFiles(log, DatabaseDirectory + "/" + BankSourceDirectory, "", ".bank") - for file in files: - sourceFile = DatabaseDirectory + "/" + BankSourceDirectory + "/" + file - if os.path.isfile(sourceFile): - destFile = ExportBuildDirectory + "/" + SmallbankExportDirectory + "/" + file[0:-len(".bank")] + ".smallbank" - if (needUpdateLogRemoveDest(log, sourceFile, destFile)): - subprocess.call([ ExecTimeout, str(SmallbankBuildTimeout), BuildSmallbank, sourceFile, destFile, DatabaseDirectory + "/" + TileRootSourceDirectory + "/" ]) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 1_export.py +# \brief Export smallbank +# \date 2009-03-10-20-54-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export smallbank +# +# 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 smallbank") +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) +BuildSmallbank = findTool(log, ToolDirectories, BuildSmallbankTool, ToolSuffix) +printLog(log, "") + +# For each bank export smallbank +printLog(log, ">>> Export smallbank <<<") +if ExecTimeout == "": + toolLogFail(log, ExecTimeoutTool, ToolSuffix) +elif BuildSmallbank == "": + toolLogFail(log, BuildSmallbankTool, ToolSuffix) +else: + mkPath(log, DatabaseDirectory + "/" + BankSourceDirectory) + mkPath(log, ExportBuildDirectory + "/" + SmallbankExportDirectory) + files = findFiles(log, DatabaseDirectory + "/" + BankSourceDirectory, "", ".bank") + for file in files: + sourceFile = DatabaseDirectory + "/" + BankSourceDirectory + "/" + file + if os.path.isfile(sourceFile): + destFile = ExportBuildDirectory + "/" + SmallbankExportDirectory + "/" + file[0:-len(".bank")] + ".smallbank" + if (needUpdateLogRemoveDest(log, sourceFile, destFile)): + subprocess.call([ ExecTimeout, str(SmallbankBuildTimeout), BuildSmallbank, sourceFile, destFile, DatabaseDirectory + "/" + TileRootSourceDirectory + "/" ]) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/smallbank/2_build.py b/code/nel/tools/build_gamedata/processes/smallbank/2_build.py old mode 100755 new mode 100644 index a13d1e843..5a6a5f9a1 --- a/code/nel/tools/build_gamedata/processes/smallbank/2_build.py +++ b/code/nel/tools/build_gamedata/processes/smallbank/2_build.py @@ -1,49 +1,49 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build smallbank -# \date 2009-03-10-20-54-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build smallbank -# -# 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 smallbank") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 2_build.py +# \brief Build smallbank +# \date 2009-03-10-20-54-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Build smallbank +# +# 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 smallbank") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/smallbank/3_install.py b/code/nel/tools/build_gamedata/processes/smallbank/3_install.py old mode 100755 new mode 100644 index 310cdaa52..c108f15c9 --- a/code/nel/tools/build_gamedata/processes/smallbank/3_install.py +++ b/code/nel/tools/build_gamedata/processes/smallbank/3_install.py @@ -1,57 +1,57 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install smallbank -# \date 2009-03-10-20-54-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install smallbank -# -# 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, "--- Install smallbank") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -installPath = InstallDirectory + "/" + BankInstallDirectory -mkPath(log, installPath) - -printLog(log, ">>> Install smallbank <<<") -mkPath(log, ExportBuildDirectory + "/" + SmallbankExportDirectory) -copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + SmallbankExportDirectory, installPath, ".smallbank") - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install smallbank +# \date 2009-03-10-20-54-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install smallbank +# +# 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 smallbank") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +installPath = InstallDirectory + "/" + BankInstallDirectory +mkPath(log, installPath) + +printLog(log, ">>> Install smallbank <<<") +mkPath(log, ExportBuildDirectory + "/" + SmallbankExportDirectory) +copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + SmallbankExportDirectory, installPath, ".smallbank") + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/sound/0_setup.py b/code/nel/tools/build_gamedata/processes/sound/0_setup.py index 7ce690d5d..4f19f96c2 100644 --- a/code/nel/tools/build_gamedata/processes/sound/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/sound/0_setup.py @@ -1,65 +1,65 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief setup sound -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup sound -# -# 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 sound") -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, SoundDirectory) -mkPath(log, SoundDfnDirectory) - -# Setup export directories -printLog(log, ">>> Setup export directories <<<") -mkPath(log, ExportBuildDirectory + "/" + SoundExportDirectory) - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") -mkPath(log, InstallDirectory + "/" + SoundInstallDirectory) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief setup sound +# \date 2010-05-24 13:42GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup sound +# +# 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 sound") +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, SoundDirectory) +mkPath(log, SoundDfnDirectory) + +# Setup export directories +printLog(log, ">>> Setup export directories <<<") +mkPath(log, ExportBuildDirectory + "/" + SoundExportDirectory) + +# Setup build directories +printLog(log, ">>> Setup build directories <<<") + +# Setup client directories +printLog(log, ">>> Setup client directories <<<") +mkPath(log, InstallDirectory + "/" + SoundInstallDirectory) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/sound/1_export.py b/code/nel/tools/build_gamedata/processes/sound/1_export.py index 066b2c256..7369972bb 100644 --- a/code/nel/tools/build_gamedata/processes/sound/1_export.py +++ b/code/nel/tools/build_gamedata/processes/sound/1_export.py @@ -1,65 +1,65 @@ -#!/usr/bin/python -# -# \file 1_export.py -# \brief Export sound -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export sound -# -# 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 sound") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# For each sound directory -printLog(log, ">>> Export sound <<<") -mkPath(log, ExportBuildDirectory + "/" + SoundExportDirectory) -mkPath(log, SoundDirectory) -mkPath(log, SoundDfnDirectory) -copyFilesExtNoTreeIfNeeded(log, SoundDfnDirectory, ExportBuildDirectory + "/" + SoundExportDirectory, ".dfn") -copyFilesExtNoTreeIfNeeded(log, SoundDfnDirectory, ExportBuildDirectory + "/" + SoundExportDirectory, ".typ") -copyFilesExtNoTreeIfNeeded(log, SoundDirectory, ExportBuildDirectory + "/" + SoundExportDirectory, ".mixer_config") -copyFilesExtNoTreeIfNeeded(log, SoundDirectory, ExportBuildDirectory + "/" + SoundExportDirectory, ".mp3") -copyFilesExtNoTreeIfNeeded(log, SoundDirectory, ExportBuildDirectory + "/" + SoundExportDirectory, ".ogg") -copyFilesExtNoTreeIfNeeded(log, SoundDirectory, ExportBuildDirectory + "/" + SoundExportDirectory, ".flac") -copyFilesExtNoTreeIfNeeded(log, SoundDirectory, ExportBuildDirectory + "/" + SoundExportDirectory, ".primitive") -copyFilesExtNoTreeIfNeeded(log, SoundDirectory, ExportBuildDirectory + "/" + SoundExportDirectory, ".sound_anim") - -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 1_export.py +# \brief Export sound +# \date 2010-05-24 13:42GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export sound +# +# 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 sound") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +# For each sound directory +printLog(log, ">>> Export sound <<<") +mkPath(log, ExportBuildDirectory + "/" + SoundExportDirectory) +mkPath(log, SoundDirectory) +mkPath(log, SoundDfnDirectory) +copyFilesExtNoTreeIfNeeded(log, SoundDfnDirectory, ExportBuildDirectory + "/" + SoundExportDirectory, ".dfn") +copyFilesExtNoTreeIfNeeded(log, SoundDfnDirectory, ExportBuildDirectory + "/" + SoundExportDirectory, ".typ") +copyFilesExtNoTreeIfNeeded(log, SoundDirectory, ExportBuildDirectory + "/" + SoundExportDirectory, ".mixer_config") +copyFilesExtNoTreeIfNeeded(log, SoundDirectory, ExportBuildDirectory + "/" + SoundExportDirectory, ".mp3") +copyFilesExtNoTreeIfNeeded(log, SoundDirectory, ExportBuildDirectory + "/" + SoundExportDirectory, ".ogg") +copyFilesExtNoTreeIfNeeded(log, SoundDirectory, ExportBuildDirectory + "/" + SoundExportDirectory, ".flac") +copyFilesExtNoTreeIfNeeded(log, SoundDirectory, ExportBuildDirectory + "/" + SoundExportDirectory, ".primitive") +copyFilesExtNoTreeIfNeeded(log, SoundDirectory, ExportBuildDirectory + "/" + SoundExportDirectory, ".sound_anim") + +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/sound/2_build.py b/code/nel/tools/build_gamedata/processes/sound/2_build.py index 048f8f456..77637bdb8 100644 --- a/code/nel/tools/build_gamedata/processes/sound/2_build.py +++ b/code/nel/tools/build_gamedata/processes/sound/2_build.py @@ -1,49 +1,49 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build sound -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build sound -# -# 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 sound") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 2_build.py +# \brief Build sound +# \date 2010-05-24 13:42GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Build sound +# +# 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 sound") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/sound/3_install.py b/code/nel/tools/build_gamedata/processes/sound/3_install.py index b8078609f..f687bac1e 100644 --- a/code/nel/tools/build_gamedata/processes/sound/3_install.py +++ b/code/nel/tools/build_gamedata/processes/sound/3_install.py @@ -1,57 +1,57 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install sound -# \date 2010-05-24 13:42GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install sound -# -# 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, "--- Install sound") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -printLog(log, ">>> Install sound <<<") -srcDir = ExportBuildDirectory + "/" + SoundExportDirectory -mkPath(log, srcDir) -destDir = InstallDirectory + "/" + SoundInstallDirectory -mkPath(log, destDir) -copyFilesNoTreeIfNeeded(log, srcDir, destDir) - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install sound +# \date 2010-05-24 13:42GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install sound +# +# 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 sound") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +printLog(log, ">>> Install sound <<<") +srcDir = ExportBuildDirectory + "/" + SoundExportDirectory +mkPath(log, srcDir) +destDir = InstallDirectory + "/" + SoundInstallDirectory +mkPath(log, destDir) +copyFilesNoTreeIfNeeded(log, srcDir, destDir) + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/soundbank/0_setup.py b/code/nel/tools/build_gamedata/processes/soundbank/0_setup.py index 368011d1a..cd5308fdb 100644 --- a/code/nel/tools/build_gamedata/processes/soundbank/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/soundbank/0_setup.py @@ -1,65 +1,65 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief Setup soundbank -# \date 2009-06-03 10:47GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup soundbank -# -# 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 soundbank") -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, SoundDirectory) -mkPath(log, SoundDfnDirectory) - -# Setup export directories -printLog(log, ">>> Setup export directories <<<") - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") -mkPath(log, ExportBuildDirectory + "/" + SoundSheetsBuildDirectory) - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") -mkPath(log, InstallDirectory + "/" + SoundInstallDirectory) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief Setup soundbank +# \date 2009-06-03 10:47GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup soundbank +# +# 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 soundbank") +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, SoundDirectory) +mkPath(log, SoundDfnDirectory) + +# Setup export directories +printLog(log, ">>> Setup export directories <<<") + +# Setup build directories +printLog(log, ">>> Setup build directories <<<") +mkPath(log, ExportBuildDirectory + "/" + SoundSheetsBuildDirectory) + +# Setup client directories +printLog(log, ">>> Setup client directories <<<") +mkPath(log, InstallDirectory + "/" + SoundInstallDirectory) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/soundbank/1_export.py b/code/nel/tools/build_gamedata/processes/soundbank/1_export.py index ffecbb4d3..5185d0970 100644 --- a/code/nel/tools/build_gamedata/processes/soundbank/1_export.py +++ b/code/nel/tools/build_gamedata/processes/soundbank/1_export.py @@ -1,49 +1,49 @@ -#!/usr/bin/python -# -# \file 1_export.py -# \brief Export soundbank -# \date 2009-06-03 10:47GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export soundbank -# -# 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 soundbank") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 1_export.py +# \brief Export soundbank +# \date 2009-06-03 10:47GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export soundbank +# +# 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 soundbank") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/soundbank/2_build.py b/code/nel/tools/build_gamedata/processes/soundbank/2_build.py index 03d2f6b07..5971c804f 100644 --- a/code/nel/tools/build_gamedata/processes/soundbank/2_build.py +++ b/code/nel/tools/build_gamedata/processes/soundbank/2_build.py @@ -1,64 +1,64 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build soundbank -# \date 2009-06-03 10:47GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build soundbank -# -# 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 soundbank") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# Find tools -BuildSoundbank = findTool(log, ToolDirectories, BuildSoundbankTool, ToolSuffix) -printLog(log, "") - -# build_soundbank -printLog(log, ">>> Build soundbank <<<") -if BuildSoundbank == "": - toolLogFail(log, BuildSoundbankTool, ToolSuffix) -else: - mkPath(log, SoundDirectory) - mkPath(log, SoundDfnDirectory) - mkPath(log, ExportBuildDirectory + "/" + SoundSheetsBuildDirectory) - subprocess.call([ BuildSoundbank, SoundDirectory, SoundDfnDirectory, ExportBuildDirectory + "/" + SoundSheetsBuildDirectory ]) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 2_build.py +# \brief Build soundbank +# \date 2009-06-03 10:47GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Build soundbank +# +# 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 soundbank") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +# Find tools +BuildSoundbank = findTool(log, ToolDirectories, BuildSoundbankTool, ToolSuffix) +printLog(log, "") + +# build_soundbank +printLog(log, ">>> Build soundbank <<<") +if BuildSoundbank == "": + toolLogFail(log, BuildSoundbankTool, ToolSuffix) +else: + mkPath(log, SoundDirectory) + mkPath(log, SoundDfnDirectory) + mkPath(log, ExportBuildDirectory + "/" + SoundSheetsBuildDirectory) + subprocess.call([ BuildSoundbank, SoundDirectory, SoundDfnDirectory, ExportBuildDirectory + "/" + SoundSheetsBuildDirectory ]) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/soundbank/3_install.py b/code/nel/tools/build_gamedata/processes/soundbank/3_install.py index e8a2a6242..f9b323c8d 100644 --- a/code/nel/tools/build_gamedata/processes/soundbank/3_install.py +++ b/code/nel/tools/build_gamedata/processes/soundbank/3_install.py @@ -1,55 +1,55 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install soundbank -# \date 2009-06-03 10:47GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install soundbank -# -# 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, "--- Install soundbank") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -printLog(log, ">>> Install soundbank packed_sheets <<<") -mkPath(log, ExportBuildDirectory + "/" + SoundSheetsBuildDirectory) -mkPath(log, InstallDirectory + "/" + SoundInstallDirectory) -copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + SoundSheetsBuildDirectory, InstallDirectory + "/" + SoundInstallDirectory, ".packed_sheets") - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install soundbank +# \date 2009-06-03 10:47GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install soundbank +# +# 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 soundbank") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +printLog(log, ">>> Install soundbank packed_sheets <<<") +mkPath(log, ExportBuildDirectory + "/" + SoundSheetsBuildDirectory) +mkPath(log, InstallDirectory + "/" + SoundInstallDirectory) +copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + SoundSheetsBuildDirectory, InstallDirectory + "/" + SoundInstallDirectory, ".packed_sheets") + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/swt/0_setup.py b/code/nel/tools/build_gamedata/processes/swt/0_setup.py old mode 100755 new mode 100644 index 4b947f496..f378354e5 --- a/code/nel/tools/build_gamedata/processes/swt/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/swt/0_setup.py @@ -1,65 +1,65 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief setup swt -# \date 2009-03-10-20-23-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup swt -# -# 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 skeleton weigths") -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 <<<") -for dir in SwtSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - -# Setup export directories -printLog(log, ">>> Setup export directories <<<") -mkPath(log, ExportBuildDirectory + "/" + SwtExportDirectory) - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") -mkPath(log, InstallDirectory + "/" + SwtInstallDirectory) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief setup swt +# \date 2009-03-10-20-23-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup swt +# +# 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 skeleton weigths") +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 <<<") +for dir in SwtSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) + +# Setup export directories +printLog(log, ">>> Setup export directories <<<") +mkPath(log, ExportBuildDirectory + "/" + SwtExportDirectory) + +# Setup build directories +printLog(log, ">>> Setup build directories <<<") + +# Setup client directories +printLog(log, ">>> Setup client directories <<<") +mkPath(log, InstallDirectory + "/" + SwtInstallDirectory) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/swt/1_export.py b/code/nel/tools/build_gamedata/processes/swt/1_export.py old mode 100755 new mode 100644 index 820950fe5..d2b1813a4 --- a/code/nel/tools/build_gamedata/processes/swt/1_export.py +++ b/code/nel/tools/build_gamedata/processes/swt/1_export.py @@ -1,99 +1,99 @@ -#!/usr/bin/python -# -# ################################################################# -# ## WARNING : this is a generated file, don't change it ! -# ################################################################# -# -# \file 1_export.py -# \brief Export swt -# \date 2015-01-06-16-31-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export swt -# -# 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 swt") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# Find tools -# ... - -# Export swt 3dsmax -if MaxAvailable: - # Find tools - Max = findMax(log, MaxDirectory, MaxExecutable) - printLog(log, "") - - printLog(log, ">>> Export swt 3dsmax <<<") - mkPath(log, ExportBuildDirectory + "/" + SwtExportDirectory) - for dir in SwtSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - if (needUpdateDirByTagLog(log, DatabaseDirectory + "/" + dir, ".max", ExportBuildDirectory + "/" + SwtExportDirectory, ".swt")): - scriptSrc = "maxscript/swt_export.ms" - scriptDst = MaxUserDirectory + "/scripts/swt_export.ms" - outputLogfile = ScriptDirectory + "/processes/swt/log.log" - outputDirectory = ExportBuildDirectory + "/" + SwtExportDirectory - maxSourceDir = DatabaseDirectory + "/" + dir - tagList = findFiles(log, outputDirectory, "", ".swt") - tagLen = len(tagList) - if os.path.isfile(scriptDst): - os.remove(scriptDst) - tagDiff = 1 - sSrc = open(scriptSrc, "r") - sDst = open(scriptDst, "w") - for line in sSrc: - newline = line.replace("%OutputLogfile%", outputLogfile) - newline = newline.replace("%MaxSourceDirectory%", maxSourceDir) - newline = newline.replace("%OutputDirectory%", outputDirectory) - sDst.write(newline) - sSrc.close() - sDst.close() - while tagDiff > 0: - printLog(log, "MAXSCRIPT " + scriptDst) - subprocess.call([ Max, "-U", "MAXScript", "swt_export.ms", "-q", "-mi", "-mip" ]) - tagList = findFiles(log, outputDirectory, "", ".swt") - newTagLen = len(tagList) - tagDiff = newTagLen - tagLen - tagLen = newTagLen - printLog(log, "Exported " + str(tagDiff) + " .swt files!") - os.remove(scriptDst) - - - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# ################################################################# +# ## WARNING : this is a generated file, don't change it ! +# ################################################################# +# +# \file 1_export.py +# \brief Export swt +# \date 2015-01-06-16-31-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export swt +# +# 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 swt") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +# Find tools +# ... + +# Export swt 3dsmax +if MaxAvailable: + # Find tools + Max = findMax(log, MaxDirectory, MaxExecutable) + printLog(log, "") + + printLog(log, ">>> Export swt 3dsmax <<<") + mkPath(log, ExportBuildDirectory + "/" + SwtExportDirectory) + for dir in SwtSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) + if (needUpdateDirByTagLog(log, DatabaseDirectory + "/" + dir, ".max", ExportBuildDirectory + "/" + SwtExportDirectory, ".swt")): + scriptSrc = "maxscript/swt_export.ms" + scriptDst = MaxUserDirectory + "/scripts/swt_export.ms" + outputLogfile = ScriptDirectory + "/processes/swt/log.log" + outputDirectory = ExportBuildDirectory + "/" + SwtExportDirectory + maxSourceDir = DatabaseDirectory + "/" + dir + tagList = findFiles(log, outputDirectory, "", ".swt") + tagLen = len(tagList) + if os.path.isfile(scriptDst): + os.remove(scriptDst) + tagDiff = 1 + sSrc = open(scriptSrc, "r") + sDst = open(scriptDst, "w") + for line in sSrc: + newline = line.replace("%OutputLogfile%", outputLogfile) + newline = newline.replace("%MaxSourceDirectory%", maxSourceDir) + newline = newline.replace("%OutputDirectory%", outputDirectory) + sDst.write(newline) + sSrc.close() + sDst.close() + while tagDiff > 0: + printLog(log, "MAXSCRIPT " + scriptDst) + subprocess.call([ Max, "-U", "MAXScript", "swt_export.ms", "-q", "-mi", "-mip" ]) + tagList = findFiles(log, outputDirectory, "", ".swt") + newTagLen = len(tagList) + tagDiff = newTagLen - tagLen + tagLen = newTagLen + printLog(log, "Exported " + str(tagDiff) + " .swt files!") + os.remove(scriptDst) + + + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/swt/2_build.py b/code/nel/tools/build_gamedata/processes/swt/2_build.py old mode 100755 new mode 100644 index 7ae606a0a..a03fbf94c --- a/code/nel/tools/build_gamedata/processes/swt/2_build.py +++ b/code/nel/tools/build_gamedata/processes/swt/2_build.py @@ -1,49 +1,49 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build swt -# \date 2009-03-10-20-23-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build swt -# -# 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 skeleton weigths") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 2_build.py +# \brief Build swt +# \date 2009-03-10-20-23-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Build swt +# +# 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 skeleton weigths") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/swt/3_install.py b/code/nel/tools/build_gamedata/processes/swt/3_install.py old mode 100755 new mode 100644 index b70e623f5..67acb0340 --- a/code/nel/tools/build_gamedata/processes/swt/3_install.py +++ b/code/nel/tools/build_gamedata/processes/swt/3_install.py @@ -1,57 +1,57 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install swt -# \date 2009-03-10-20-23-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install swt -# -# 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, "--- Install skeleton weigths") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -installPath = InstallDirectory + "/" + SwtInstallDirectory -mkPath(log, installPath) - -printLog(log, ">>> Install skeleton weigths <<<") -mkPath(log, ExportBuildDirectory + "/" + SwtExportDirectory) -copyFilesNoTreeIfNeeded(log, ExportBuildDirectory + "/" + SwtExportDirectory, installPath) - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install swt +# \date 2009-03-10-20-23-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install swt +# +# 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 skeleton weigths") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +installPath = InstallDirectory + "/" + SwtInstallDirectory +mkPath(log, installPath) + +printLog(log, ">>> Install skeleton weigths <<<") +mkPath(log, ExportBuildDirectory + "/" + SwtExportDirectory) +copyFilesNoTreeIfNeeded(log, ExportBuildDirectory + "/" + SwtExportDirectory, installPath) + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/swt/maxscript/swt_export.ms b/code/nel/tools/build_gamedata/processes/swt/maxscript/swt_export.ms old mode 100755 new mode 100644 diff --git a/code/nel/tools/build_gamedata/processes/tiles/0_setup.py b/code/nel/tools/build_gamedata/processes/tiles/0_setup.py old mode 100755 new mode 100644 index e7a093723..2ffea0058 --- a/code/nel/tools/build_gamedata/processes/tiles/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/tiles/0_setup.py @@ -1,65 +1,65 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief Setup tiles -# \date 2009-03-10-21-31-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup tiles -# -# 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 tiles") -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 <<<") -for dir in TilesSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - -# Setup export directories -printLog(log, ">>> Setup export directories <<<") -mkPath(log, ExportBuildDirectory + "/" + TilesExportDirectory) - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") -mkPath(log, InstallDirectory + "/" + TilesInstallDirectory) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief Setup tiles +# \date 2009-03-10-21-31-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup tiles +# +# 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 tiles") +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 <<<") +for dir in TilesSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) + +# Setup export directories +printLog(log, ">>> Setup export directories <<<") +mkPath(log, ExportBuildDirectory + "/" + TilesExportDirectory) + +# Setup build directories +printLog(log, ">>> Setup build directories <<<") + +# Setup client directories +printLog(log, ">>> Setup client directories <<<") +mkPath(log, InstallDirectory + "/" + TilesInstallDirectory) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/tiles/1_export.py b/code/nel/tools/build_gamedata/processes/tiles/1_export.py old mode 100755 new mode 100644 index 9459b81b2..97206e330 --- a/code/nel/tools/build_gamedata/processes/tiles/1_export.py +++ b/code/nel/tools/build_gamedata/processes/tiles/1_export.py @@ -1,84 +1,84 @@ -#!/usr/bin/python -# -# \file 1_export.py -# \brief Export tiles -# \date 2009-03-10-21-31-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export tiles -# -# 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 tiles") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# Find tools -TgaToDds = findTool(log, ToolDirectories, TgaToDdsTool, ToolSuffix) -ExecTimeout = findTool(log, ToolDirectories, ExecTimeoutTool, ToolSuffix) -printLog(log, "") - -# For each tiles directory -printLog(log, ">>> Export tiles as DDS <<<") -if TgaToDds == "": - toolLogFail(log, TgaToDdsTool, ToolSuffix) -elif ExecTimeout == "": - toolLogFail(log, ExecTimeoutTool, ToolSuffix) -else: - mkPath(log, ExportBuildDirectory + "/" + TilesExportDirectory) - for dir in TilesSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - files = findFiles(log, DatabaseDirectory + "/" + dir, "", ".tga") - for file in files: - sourceFile = DatabaseDirectory + "/" + dir + "/" + file - destFile = ExportBuildDirectory + "/" + TilesExportDirectory + "/" + os.path.basename(file)[0:-len(".tga")] + ".dds" - if needUpdateLogRemoveDest(log, sourceFile, destFile): - subprocess.call([ ExecTimeout, str(MapsBuildTimeout), TgaToDds, sourceFile, "-o", destFile, "-a", "5", "-m" ]) - files = findFiles(log, DatabaseDirectory + "/" + dir, "", ".png") - for file in files: - sourceFile = DatabaseDirectory + "/" + dir + "/" + file - destFile = ExportBuildDirectory + "/" + TilesExportDirectory + "/" + os.path.basename(file)[0:-len(".png")] + ".dds" - if needUpdateLogRemoveDest(log, sourceFile, destFile): - subprocess.call([ ExecTimeout, str(MapsBuildTimeout), TgaToDds, sourceFile, "-o", destFile, "-a", "5", "-m" ]) - -#printLog(log, ">>> Copy PNG tiles <<<") -#mkPath(log, ExportBuildDirectory + "/" + TilesExportDirectory) -#for dir in TilesSourceDirectories: -# mkPath(log, DatabaseDirectory + "/" + dir) -# copyFilesExtNoTreeIfNeeded(log, DatabaseDirectory + "/" + dir, ExportBuildDirectory + "/" + TilesExportDirectory, ".png") -#printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 1_export.py +# \brief Export tiles +# \date 2009-03-10-21-31-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export tiles +# +# 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 tiles") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +# Find tools +TgaToDds = findTool(log, ToolDirectories, TgaToDdsTool, ToolSuffix) +ExecTimeout = findTool(log, ToolDirectories, ExecTimeoutTool, ToolSuffix) +printLog(log, "") + +# For each tiles directory +printLog(log, ">>> Export tiles as DDS <<<") +if TgaToDds == "": + toolLogFail(log, TgaToDdsTool, ToolSuffix) +elif ExecTimeout == "": + toolLogFail(log, ExecTimeoutTool, ToolSuffix) +else: + mkPath(log, ExportBuildDirectory + "/" + TilesExportDirectory) + for dir in TilesSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) + files = findFiles(log, DatabaseDirectory + "/" + dir, "", ".tga") + for file in files: + sourceFile = DatabaseDirectory + "/" + dir + "/" + file + destFile = ExportBuildDirectory + "/" + TilesExportDirectory + "/" + os.path.basename(file)[0:-len(".tga")] + ".dds" + if needUpdateLogRemoveDest(log, sourceFile, destFile): + subprocess.call([ ExecTimeout, str(MapsBuildTimeout), TgaToDds, sourceFile, "-o", destFile, "-a", "5", "-m" ]) + files = findFiles(log, DatabaseDirectory + "/" + dir, "", ".png") + for file in files: + sourceFile = DatabaseDirectory + "/" + dir + "/" + file + destFile = ExportBuildDirectory + "/" + TilesExportDirectory + "/" + os.path.basename(file)[0:-len(".png")] + ".dds" + if needUpdateLogRemoveDest(log, sourceFile, destFile): + subprocess.call([ ExecTimeout, str(MapsBuildTimeout), TgaToDds, sourceFile, "-o", destFile, "-a", "5", "-m" ]) + +#printLog(log, ">>> Copy PNG tiles <<<") +#mkPath(log, ExportBuildDirectory + "/" + TilesExportDirectory) +#for dir in TilesSourceDirectories: +# mkPath(log, DatabaseDirectory + "/" + dir) +# copyFilesExtNoTreeIfNeeded(log, DatabaseDirectory + "/" + dir, ExportBuildDirectory + "/" + TilesExportDirectory, ".png") +#printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/tiles/2_build.py b/code/nel/tools/build_gamedata/processes/tiles/2_build.py old mode 100755 new mode 100644 index af1349ccf..6262393a8 --- a/code/nel/tools/build_gamedata/processes/tiles/2_build.py +++ b/code/nel/tools/build_gamedata/processes/tiles/2_build.py @@ -1,49 +1,49 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build tiles -# \date 2009-03-10-21-31-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build tiles -# -# 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 tiles") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 2_build.py +# \brief Build tiles +# \date 2009-03-10-21-31-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Build tiles +# +# 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 tiles") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/tiles/3_install.py b/code/nel/tools/build_gamedata/processes/tiles/3_install.py old mode 100755 new mode 100644 index a9a31187e..1332475e9 --- a/code/nel/tools/build_gamedata/processes/tiles/3_install.py +++ b/code/nel/tools/build_gamedata/processes/tiles/3_install.py @@ -1,55 +1,55 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install tiles -# \date 2009-03-10-21-31-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install tiles -# -# 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, "--- Install tiles") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -printLog(log, ">>> Install tiles <<<") -mkPath(log, InstallDirectory + "/" + TilesInstallDirectory) -mkPath(log, ExportBuildDirectory + "/" + TilesExportDirectory) -copyFilesNoTreeIfNeeded(log, ExportBuildDirectory + "/" + TilesExportDirectory, InstallDirectory + "/" + TilesInstallDirectory) - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install tiles +# \date 2009-03-10-21-31-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install tiles +# +# 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 tiles") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +printLog(log, ">>> Install tiles <<<") +mkPath(log, InstallDirectory + "/" + TilesInstallDirectory) +mkPath(log, ExportBuildDirectory + "/" + TilesExportDirectory) +copyFilesNoTreeIfNeeded(log, ExportBuildDirectory + "/" + TilesExportDirectory, InstallDirectory + "/" + TilesInstallDirectory) + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/veget/0_setup.py b/code/nel/tools/build_gamedata/processes/veget/0_setup.py old mode 100755 new mode 100644 index 222bc39bb..65c2f4353 --- a/code/nel/tools/build_gamedata/processes/veget/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/veget/0_setup.py @@ -1,66 +1,66 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief setup veget -# \date 2010-09-02-08-40-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup veget -# -# 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 veget") -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 <<<") -for dir in VegetSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - -# Setup export directories -printLog(log, ">>> Setup export directories <<<") -mkPath(log, ExportBuildDirectory + "/" + VegetExportDirectory) -mkPath(log, ExportBuildDirectory + "/" + VegetTagExportDirectory) - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") -mkPath(log, InstallDirectory + "/" + VegetInstallDirectory) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief setup veget +# \date 2010-09-02-08-40-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup veget +# +# 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 veget") +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 <<<") +for dir in VegetSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) + +# Setup export directories +printLog(log, ">>> Setup export directories <<<") +mkPath(log, ExportBuildDirectory + "/" + VegetExportDirectory) +mkPath(log, ExportBuildDirectory + "/" + VegetTagExportDirectory) + +# Setup build directories +printLog(log, ">>> Setup build directories <<<") + +# Setup client directories +printLog(log, ">>> Setup client directories <<<") +mkPath(log, InstallDirectory + "/" + VegetInstallDirectory) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/veget/1_export.py b/code/nel/tools/build_gamedata/processes/veget/1_export.py old mode 100755 new mode 100644 index ae8b835a3..0bb5dcbcd --- a/code/nel/tools/build_gamedata/processes/veget/1_export.py +++ b/code/nel/tools/build_gamedata/processes/veget/1_export.py @@ -1,139 +1,139 @@ -#!/usr/bin/python -# -# ################################################################# -# ## WARNING : this is a generated file, don't change it ! -# ################################################################# -# -# \file 1_export.py -# \brief Export veget -# \date 2015-01-06-16-31-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export veget -# -# 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") -if os.path.isfile("temp_log.log"): - os.remove("temp_log.log") -log = open("temp_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 veget") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - - -# Find tools -# ... - -# Export veget 3dsmax -if MaxAvailable: - # Find tools - Max = findMax(log, MaxDirectory, MaxExecutable) - printLog(log, "") - - printLog(log, ">>> Export veget 3dsmax <<<") - mkPath(log, ExportBuildDirectory + "/" + VegetExportDirectory) - mkPath(log, ExportBuildDirectory + "/" + VegetTagExportDirectory) - for dir in VegetSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - if (needUpdateDirByTagLog(log, DatabaseDirectory + "/" + dir, ".max", ExportBuildDirectory + "/" + VegetTagExportDirectory, ".max.tag")): - scriptSrc = "maxscript/veget_export.ms" - scriptDst = MaxUserDirectory + "/scripts/veget_export.ms" - outputLogfile = ScriptDirectory + "/processes/veget/log.log" - outputDirectory = ExportBuildDirectory + "/" + VegetExportDirectory - tagDirectory = ExportBuildDirectory + "/" + VegetTagExportDirectory - maxSourceDir = DatabaseDirectory + "/" + dir - maxRunningTagFile = tagDirectory + "/max_running.tag" - tagList = findFiles(log, tagDirectory, "", ".max.tag") - tagLen = len(tagList) - if os.path.isfile(scriptDst): - os.remove(scriptDst) - tagDiff = 1 - sSrc = open(scriptSrc, "r") - sDst = open(scriptDst, "w") - for line in sSrc: - newline = line.replace("%OutputLogfile%", outputLogfile) - newline = newline.replace("%MaxSourceDirectory%", maxSourceDir) - newline = newline.replace("%OutputDirectory%", outputDirectory) - newline = newline.replace("%TagDirectory%", tagDirectory) - sDst.write(newline) - sSrc.close() - sDst.close() - zeroRetryLimit = 3 - while tagDiff > 0: - mrt = open(maxRunningTagFile, "w") - mrt.write("moe-moe-kyun") - mrt.close() - printLog(log, "MAXSCRIPT " + scriptDst) - subprocess.call([ Max, "-U", "MAXScript", "veget_export.ms", "-q", "-mi", "-mip" ]) - if os.path.exists(outputLogfile): - try: - lSrc = open(outputLogfile, "r") - for line in lSrc: - lineStrip = line.strip() - if (len(lineStrip) > 0): - printLog(log, lineStrip) - lSrc.close() - os.remove(outputLogfile) - except Exception: - printLog(log, "ERROR Failed to read 3dsmax log") - else: - printLog(log, "WARNING No 3dsmax log") - tagList = findFiles(log, tagDirectory, "", ".max.tag") - newTagLen = len(tagList) - tagDiff = newTagLen - tagLen - tagLen = newTagLen - addTagDiff = 0 - if os.path.exists(maxRunningTagFile): - printLog(log, "FAIL 3ds Max crashed and/or file export failed!") - if tagDiff == 0: - if zeroRetryLimit > 0: - zeroRetryLimit = zeroRetryLimit - 1 - addTagDiff = 1 - else: - printLog(log, "FAIL Retry limit reached!") - else: - addTagDiff = 1 - os.remove(maxRunningTagFile) - printLog(log, "Exported " + str(tagDiff) + " .max files!") - tagDiff += addTagDiff - os.remove(scriptDst) - printLog(log, "") - - - -log.close() -if os.path.isfile("log.log"): - os.remove("log.log") -shutil.move("temp_log.log", "log.log") - - -# end of file +#!/usr/bin/python +# +# ################################################################# +# ## WARNING : this is a generated file, don't change it ! +# ################################################################# +# +# \file 1_export.py +# \brief Export veget +# \date 2015-01-06-16-31-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export veget +# +# 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") +if os.path.isfile("temp_log.log"): + os.remove("temp_log.log") +log = open("temp_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 veget") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + + +# Find tools +# ... + +# Export veget 3dsmax +if MaxAvailable: + # Find tools + Max = findMax(log, MaxDirectory, MaxExecutable) + printLog(log, "") + + printLog(log, ">>> Export veget 3dsmax <<<") + mkPath(log, ExportBuildDirectory + "/" + VegetExportDirectory) + mkPath(log, ExportBuildDirectory + "/" + VegetTagExportDirectory) + for dir in VegetSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) + if (needUpdateDirByTagLog(log, DatabaseDirectory + "/" + dir, ".max", ExportBuildDirectory + "/" + VegetTagExportDirectory, ".max.tag")): + scriptSrc = "maxscript/veget_export.ms" + scriptDst = MaxUserDirectory + "/scripts/veget_export.ms" + outputLogfile = ScriptDirectory + "/processes/veget/log.log" + outputDirectory = ExportBuildDirectory + "/" + VegetExportDirectory + tagDirectory = ExportBuildDirectory + "/" + VegetTagExportDirectory + maxSourceDir = DatabaseDirectory + "/" + dir + maxRunningTagFile = tagDirectory + "/max_running.tag" + tagList = findFiles(log, tagDirectory, "", ".max.tag") + tagLen = len(tagList) + if os.path.isfile(scriptDst): + os.remove(scriptDst) + tagDiff = 1 + sSrc = open(scriptSrc, "r") + sDst = open(scriptDst, "w") + for line in sSrc: + newline = line.replace("%OutputLogfile%", outputLogfile) + newline = newline.replace("%MaxSourceDirectory%", maxSourceDir) + newline = newline.replace("%OutputDirectory%", outputDirectory) + newline = newline.replace("%TagDirectory%", tagDirectory) + sDst.write(newline) + sSrc.close() + sDst.close() + zeroRetryLimit = 3 + while tagDiff > 0: + mrt = open(maxRunningTagFile, "w") + mrt.write("moe-moe-kyun") + mrt.close() + printLog(log, "MAXSCRIPT " + scriptDst) + subprocess.call([ Max, "-U", "MAXScript", "veget_export.ms", "-q", "-mi", "-mip" ]) + if os.path.exists(outputLogfile): + try: + lSrc = open(outputLogfile, "r") + for line in lSrc: + lineStrip = line.strip() + if (len(lineStrip) > 0): + printLog(log, lineStrip) + lSrc.close() + os.remove(outputLogfile) + except Exception: + printLog(log, "ERROR Failed to read 3dsmax log") + else: + printLog(log, "WARNING No 3dsmax log") + tagList = findFiles(log, tagDirectory, "", ".max.tag") + newTagLen = len(tagList) + tagDiff = newTagLen - tagLen + tagLen = newTagLen + addTagDiff = 0 + if os.path.exists(maxRunningTagFile): + printLog(log, "FAIL 3ds Max crashed and/or file export failed!") + if tagDiff == 0: + if zeroRetryLimit > 0: + zeroRetryLimit = zeroRetryLimit - 1 + addTagDiff = 1 + else: + printLog(log, "FAIL Retry limit reached!") + else: + addTagDiff = 1 + os.remove(maxRunningTagFile) + printLog(log, "Exported " + str(tagDiff) + " .max files!") + tagDiff += addTagDiff + os.remove(scriptDst) + printLog(log, "") + + + +log.close() +if os.path.isfile("log.log"): + os.remove("log.log") +shutil.move("temp_log.log", "log.log") + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/veget/2_build.py b/code/nel/tools/build_gamedata/processes/veget/2_build.py old mode 100755 new mode 100644 index e3358fd39..9a0702e86 --- a/code/nel/tools/build_gamedata/processes/veget/2_build.py +++ b/code/nel/tools/build_gamedata/processes/veget/2_build.py @@ -1,49 +1,49 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build veget -# \date 2010-09-02-08-40-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build veget -# -# 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 veget") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 2_build.py +# \brief Build veget +# \date 2010-09-02-08-40-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Build veget +# +# 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 veget") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/veget/3_install.py b/code/nel/tools/build_gamedata/processes/veget/3_install.py old mode 100755 new mode 100644 index 5801e6392..b576f238d --- a/code/nel/tools/build_gamedata/processes/veget/3_install.py +++ b/code/nel/tools/build_gamedata/processes/veget/3_install.py @@ -1,57 +1,57 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install veget -# \date 2010-09-02-08-40-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install veget -# -# 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, "--- Install veget") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -printLog(log, ">>> Install veget <<<") -exportPath = ExportBuildDirectory + "/" + VegetExportDirectory -mkPath(log, exportPath) -installPath = InstallDirectory + "/" + VegetInstallDirectory -mkPath(log, installPath) -copyFilesNoTreeIfNeeded(log, exportPath, installPath) - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install veget +# \date 2010-09-02-08-40-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install veget +# +# 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 veget") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +printLog(log, ">>> Install veget <<<") +exportPath = ExportBuildDirectory + "/" + VegetExportDirectory +mkPath(log, exportPath) +installPath = InstallDirectory + "/" + VegetInstallDirectory +mkPath(log, installPath) +copyFilesNoTreeIfNeeded(log, exportPath, installPath) + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/veget/maxscript/veget_export.ms b/code/nel/tools/build_gamedata/processes/veget/maxscript/veget_export.ms old mode 100755 new mode 100644 diff --git a/code/nel/tools/build_gamedata/processes/vegetset/0_setup.py b/code/nel/tools/build_gamedata/processes/vegetset/0_setup.py old mode 100755 new mode 100644 index c46c11b66..b80eb5c40 --- a/code/nel/tools/build_gamedata/processes/vegetset/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/vegetset/0_setup.py @@ -1,65 +1,65 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief setup vegetset -# \date 2010-05-24 08:13GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup vegetset -# -# 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 vegetset") -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 <<<") -for dir in VegetSetSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - -# Setup export directories -printLog(log, ">>> Setup export directories <<<") -mkPath(log, ExportBuildDirectory + "/" + VegetSetExportDirectory) - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") -mkPath(log, InstallDirectory + "/" + VegetSetInstallDirectory) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief setup vegetset +# \date 2010-05-24 08:13GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup vegetset +# +# 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 vegetset") +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 <<<") +for dir in VegetSetSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) + +# Setup export directories +printLog(log, ">>> Setup export directories <<<") +mkPath(log, ExportBuildDirectory + "/" + VegetSetExportDirectory) + +# Setup build directories +printLog(log, ">>> Setup build directories <<<") + +# Setup client directories +printLog(log, ">>> Setup client directories <<<") +mkPath(log, InstallDirectory + "/" + VegetSetInstallDirectory) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/vegetset/1_export.py b/code/nel/tools/build_gamedata/processes/vegetset/1_export.py old mode 100755 new mode 100644 index 03d70f59d..73ac832e4 --- a/code/nel/tools/build_gamedata/processes/vegetset/1_export.py +++ b/code/nel/tools/build_gamedata/processes/vegetset/1_export.py @@ -1,57 +1,57 @@ -#!/usr/bin/python -# -# \file 1_export.py -# \brief Export vegetset -# \date 2010-05-24 08:13GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export vegetset -# -# 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 vegetset") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# For each vegetset directoy -printLog(log, ">>> Export vegetset <<<") -mkPath(log, ExportBuildDirectory + "/" + VegetSetExportDirectory) -for dir in VegetSetSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - copyFilesExtNoTreeIfNeeded(log, DatabaseDirectory + "/" + dir, ExportBuildDirectory + "/" + VegetSetExportDirectory, ".vegetset") -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 1_export.py +# \brief Export vegetset +# \date 2010-05-24 08:13GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export vegetset +# +# 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 vegetset") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +# For each vegetset directoy +printLog(log, ">>> Export vegetset <<<") +mkPath(log, ExportBuildDirectory + "/" + VegetSetExportDirectory) +for dir in VegetSetSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) + copyFilesExtNoTreeIfNeeded(log, DatabaseDirectory + "/" + dir, ExportBuildDirectory + "/" + VegetSetExportDirectory, ".vegetset") +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/vegetset/2_build.py b/code/nel/tools/build_gamedata/processes/vegetset/2_build.py old mode 100755 new mode 100644 index 0aab2ecee..41c235493 --- a/code/nel/tools/build_gamedata/processes/vegetset/2_build.py +++ b/code/nel/tools/build_gamedata/processes/vegetset/2_build.py @@ -1,49 +1,49 @@ -#!/usr/bin/python -# -# \file 2_build.py -# \brief Build vegetset -# \date 2010-05-24 08:13GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Build vegetset -# -# 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 vegetset") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 2_build.py +# \brief Build vegetset +# \date 2010-05-24 08:13GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Build vegetset +# +# 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 vegetset") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/vegetset/3_install.py b/code/nel/tools/build_gamedata/processes/vegetset/3_install.py old mode 100755 new mode 100644 index 25ebd7677..b900542d4 --- a/code/nel/tools/build_gamedata/processes/vegetset/3_install.py +++ b/code/nel/tools/build_gamedata/processes/vegetset/3_install.py @@ -1,57 +1,57 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install vegetset -# \date 2010-05-24 08:13GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install vegetset -# -# 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, "--- Install vegetset") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -installPath = InstallDirectory + "/" + VegetSetInstallDirectory -mkPath(log, installPath) - -printLog(log, ">>> Install vegetset <<<") -mkPath(log, ExportBuildDirectory + "/" + VegetSetExportDirectory) -copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + VegetSetExportDirectory, installPath, ".vegetset") - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install vegetset +# \date 2010-05-24 08:13GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install vegetset +# +# 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 vegetset") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +installPath = InstallDirectory + "/" + VegetSetInstallDirectory +mkPath(log, installPath) + +printLog(log, ">>> Install vegetset <<<") +mkPath(log, ExportBuildDirectory + "/" + VegetSetExportDirectory) +copyFilesExtNoTreeIfNeeded(log, ExportBuildDirectory + "/" + VegetSetExportDirectory, installPath, ".vegetset") + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/zone/0_setup.py b/code/nel/tools/build_gamedata/processes/zone/0_setup.py old mode 100755 new mode 100644 index ab85cb515..b8528d9c9 --- a/code/nel/tools/build_gamedata/processes/zone/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/zone/0_setup.py @@ -1,66 +1,66 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief Setup zone -# \date 2009-03-10-22-23-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup 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, "--- Setup zone") -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 + "/" + ZoneSourceDirectory[0]) - -# Setup export directories -printLog(log, ">>> Setup export directories <<<") -mkPath(log, ExportBuildDirectory + "/" + ZoneExportDirectory) - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") -mkPath(log, ExportBuildDirectory + "/" + ZoneDependBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + ZoneWeldBuildDirectory) - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") -mkPath(log, InstallDirectory + "/" + ZoneInstallDirectory) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief Setup zone +# \date 2009-03-10-22-23-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup 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, "--- Setup zone") +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 + "/" + ZoneSourceDirectory[0]) + +# Setup export directories +printLog(log, ">>> Setup export directories <<<") +mkPath(log, ExportBuildDirectory + "/" + ZoneExportDirectory) + +# Setup build directories +printLog(log, ">>> Setup build directories <<<") +mkPath(log, ExportBuildDirectory + "/" + ZoneDependBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + ZoneWeldBuildDirectory) + +# Setup client directories +printLog(log, ">>> Setup client directories <<<") +mkPath(log, InstallDirectory + "/" + ZoneInstallDirectory) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/zone/1_export.py b/code/nel/tools/build_gamedata/processes/zone/1_export.py old mode 100755 new mode 100644 index acffe9abb..58c018cc7 --- a/code/nel/tools/build_gamedata/processes/zone/1_export.py +++ b/code/nel/tools/build_gamedata/processes/zone/1_export.py @@ -1,107 +1,107 @@ -#!/usr/bin/python -# -# ################################################################# -# ## WARNING : this is a generated file, don't change it ! -# ################################################################# -# -# \file 1_export.py -# \brief Export zone -# \date 2015-01-06-16-31-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export 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, "--- Export zone") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# Find tools -# ... - -# Export zone 3dsmax -if MaxAvailable: - # Find tools - Max = findMax(log, MaxDirectory, MaxExecutable) - printLog(log, "") - - printLog(log, ">>> Export zone 3dsmax <<<") - mkPath(log, ExportBuildDirectory + "/" + ZoneExportDirectory) - for dir in ZoneSourceDirectory: - mkPath(log, DatabaseDirectory + "/" + dir) - if (needUpdateDirByTagLog(log, DatabaseDirectory + "/" + dir, ".max", ExportBuildDirectory + "/" + ZoneExportDirectory, ".zone")): - scriptSrc = "maxscript/zone_export.ms" - scriptDst = MaxUserDirectory + "/scripts/zone_export.ms" - outputLogfile = ScriptDirectory + "/processes/zone/log.log" - outputDirectory = ExportBuildDirectory + "/" + ZoneExportDirectory - maxSourceDir = DatabaseDirectory + "/" + dir - tagList = findFiles(log, outputDirectory, "", ".zone") - tagLen = len(tagList) - if os.path.isfile(scriptDst): - os.remove(scriptDst) - tagDiff = 1 - sSrc = open(scriptSrc, "r") - sDst = open(scriptDst, "w") - for line in sSrc: - newline = line.replace("%OutputLogfile%", outputLogfile) - newline = newline.replace("%MaxSourceDirectory%", maxSourceDir) - newline = newline.replace("%OutputDirectory%", outputDirectory) - sDst.write(newline) - sSrc.close() - sDst.close() - while tagDiff > 0: - printLog(log, "MAXSCRIPT " + scriptDst) - subprocess.call([ Max, "-U", "MAXScript", "zone_export.ms", "-q", "-mi", "-mip" ]) - tagList = findFiles(log, outputDirectory, "", ".zone") - newTagLen = len(tagList) - tagDiff = newTagLen - tagLen - tagLen = newTagLen - printLog(log, "Exported " + str(tagDiff) + " .zone files!") - os.remove(scriptDst) - - - -printLog(log, ">>> Try to copy ligo zone if any <<<") -printLog(log, "********************************") -printLog(log, "******** TODO ********") -printLog(log, "********************************") -printLog(log, "") - - - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# ################################################################# +# ## WARNING : this is a generated file, don't change it ! +# ################################################################# +# +# \file 1_export.py +# \brief Export zone +# \date 2015-01-06-16-31-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export 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, "--- Export zone") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +# Find tools +# ... + +# Export zone 3dsmax +if MaxAvailable: + # Find tools + Max = findMax(log, MaxDirectory, MaxExecutable) + printLog(log, "") + + printLog(log, ">>> Export zone 3dsmax <<<") + mkPath(log, ExportBuildDirectory + "/" + ZoneExportDirectory) + for dir in ZoneSourceDirectory: + mkPath(log, DatabaseDirectory + "/" + dir) + if (needUpdateDirByTagLog(log, DatabaseDirectory + "/" + dir, ".max", ExportBuildDirectory + "/" + ZoneExportDirectory, ".zone")): + scriptSrc = "maxscript/zone_export.ms" + scriptDst = MaxUserDirectory + "/scripts/zone_export.ms" + outputLogfile = ScriptDirectory + "/processes/zone/log.log" + outputDirectory = ExportBuildDirectory + "/" + ZoneExportDirectory + maxSourceDir = DatabaseDirectory + "/" + dir + tagList = findFiles(log, outputDirectory, "", ".zone") + tagLen = len(tagList) + if os.path.isfile(scriptDst): + os.remove(scriptDst) + tagDiff = 1 + sSrc = open(scriptSrc, "r") + sDst = open(scriptDst, "w") + for line in sSrc: + newline = line.replace("%OutputLogfile%", outputLogfile) + newline = newline.replace("%MaxSourceDirectory%", maxSourceDir) + newline = newline.replace("%OutputDirectory%", outputDirectory) + sDst.write(newline) + sSrc.close() + sDst.close() + while tagDiff > 0: + printLog(log, "MAXSCRIPT " + scriptDst) + subprocess.call([ Max, "-U", "MAXScript", "zone_export.ms", "-q", "-mi", "-mip" ]) + tagList = findFiles(log, outputDirectory, "", ".zone") + newTagLen = len(tagList) + tagDiff = newTagLen - tagLen + tagLen = newTagLen + printLog(log, "Exported " + str(tagDiff) + " .zone files!") + os.remove(scriptDst) + + + +printLog(log, ">>> Try to copy ligo zone if any <<<") +printLog(log, "********************************") +printLog(log, "******** TODO ********") +printLog(log, "********************************") +printLog(log, "") + + + +printLog(log, "") +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 old mode 100755 new mode 100644 index f9a31e3c4..4d19f5abc --- a/code/nel/tools/build_gamedata/processes/zone/2_build.py +++ b/code/nel/tools/build_gamedata/processes/zone/2_build.py @@ -1,156 +1,175 @@ -#!/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")] + ".zonew" - if needUpdateLogRemoveDest(log, sourceFile, destFile): - subprocess.call([ ZoneElevation, sourceFile, destFile, "--land", land, "--heightmap", heightMap1, "--zfactor", LigoExportZFactor1, "--heightmap2", heightMap2, "--zfactor2", LigoExportZFactor2 ]) -printLog(log, "") - -log.close() - - -# end of file +#!/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/3_install.py b/code/nel/tools/build_gamedata/processes/zone/3_install.py old mode 100755 new mode 100644 index 0326abf75..c8567a2bd --- a/code/nel/tools/build_gamedata/processes/zone/3_install.py +++ b/code/nel/tools/build_gamedata/processes/zone/3_install.py @@ -1,50 +1,50 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install zone -# \date 2009-03-10-22-23-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install 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, "--- Install zone") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install zone +# \date 2009-03-10-22-23-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install 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_local import * +from process import * +from tools import * +from directories import * + +printLog(log, "") +printLog(log, "-------") +printLog(log, "--- Install zone") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/zone/maxscript/zone_export.ms b/code/nel/tools/build_gamedata/processes/zone/maxscript/zone_export.ms old mode 100755 new mode 100644 diff --git a/code/nel/tools/build_gamedata/processes/zone_light/0_setup.py b/code/nel/tools/build_gamedata/processes/zone_light/0_setup.py old mode 100755 new mode 100644 index 44c67935d..d5a751131 --- a/code/nel/tools/build_gamedata/processes/zone_light/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/zone_light/0_setup.py @@ -1,73 +1,73 @@ -#!/usr/bin/python -# -# \file 0_setup.py -# \brief Setup zone_light -# \date 2009-03-11-13-45-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Setup 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, "--- Setup zone_light") -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 <<<") -for dir in WaterMapSourceDirectories: - mkPath(log, DatabaseDirectory + "/" + dir) - -# Setup export directories -printLog(log, ">>> Setup export directories <<<") -mkPath(log, ExportBuildDirectory + "/" + ZoneLightWaterShapesLightedExportDirectory) - -# Setup build directories -printLog(log, ">>> Setup build directories <<<") -mkPath(log, ExportBuildDirectory + "/" + ZoneWeldBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + ZoneDependBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + ZoneLightBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + ZoneLightDependBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + ZoneLightIgLandBuildDirectory) -mkPath(log, ExportBuildDirectory + "/" + IgLandBuildDirectory) - -# Setup client directories -printLog(log, ">>> Setup client directories <<<") -mkPath(log, InstallDirectory + "/" + ZoneInstallDirectory) -mkPath(log, InstallDirectory + "/" + IgInstallDirectory) -mkPath(log, InstallDirectory + "/" + WaterMapsInstallDirectory) - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 0_setup.py +# \brief Setup zone_light +# \date 2009-03-11-13-45-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Setup 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, "--- Setup zone_light") +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 <<<") +for dir in WaterMapSourceDirectories: + mkPath(log, DatabaseDirectory + "/" + dir) + +# Setup export directories +printLog(log, ">>> Setup export directories <<<") +mkPath(log, ExportBuildDirectory + "/" + ZoneLightWaterShapesLightedExportDirectory) + +# Setup build directories +printLog(log, ">>> Setup build directories <<<") +mkPath(log, ExportBuildDirectory + "/" + ZoneWeldBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + ZoneDependBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + ZoneLightBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + ZoneLightDependBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + ZoneLightIgLandBuildDirectory) +mkPath(log, ExportBuildDirectory + "/" + IgLandBuildDirectory) + +# Setup client directories +printLog(log, ">>> Setup client directories <<<") +mkPath(log, InstallDirectory + "/" + ZoneInstallDirectory) +mkPath(log, InstallDirectory + "/" + IgInstallDirectory) +mkPath(log, InstallDirectory + "/" + WaterMapsInstallDirectory) + +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/processes/zone_light/1_export.py b/code/nel/tools/build_gamedata/processes/zone_light/1_export.py old mode 100755 new mode 100644 index 016fe826b..59167b01e --- a/code/nel/tools/build_gamedata/processes/zone_light/1_export.py +++ b/code/nel/tools/build_gamedata/processes/zone_light/1_export.py @@ -1,64 +1,64 @@ -#!/usr/bin/python -# -# \file 1_export.py -# \brief Export zone_light -# \date 2009-03-11-13-45-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Export 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, "--- Export zone_light") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -# Find tools -#TgaToDds = findTool(log, ToolDirectories, TgaToDdsTool, ToolSuffix) -printLog(log, "") - -# Export zone_light water maps -printLog(log, ">>> Export zone_light water maps <<<") -srcDir = ExportBuildDirectory + "/" + ZoneLightWaterShapesLightedExportDirectory -mkPath(log, srcDir) -for dir in WaterMapSourceDirectories: - destDir = DatabaseDirectory + "/" + dir - mkPath(log, destDir) - copyFilesExtNoTreeIfNeeded(log, srcDir, destDir, ".tga") - copyFilesExtNoTreeIfNeeded(log, srcDir, destDir, ".png") -printLog(log, "") - -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 1_export.py +# \brief Export zone_light +# \date 2009-03-11-13-45-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Export 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, "--- Export zone_light") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +# Find tools +#TgaToDds = findTool(log, ToolDirectories, TgaToDdsTool, ToolSuffix) +printLog(log, "") + +# Export zone_light water maps +printLog(log, ">>> Export zone_light water maps <<<") +srcDir = ExportBuildDirectory + "/" + ZoneLightWaterShapesLightedExportDirectory +mkPath(log, srcDir) +for dir in WaterMapSourceDirectories: + destDir = DatabaseDirectory + "/" + dir + mkPath(log, destDir) + copyFilesExtNoTreeIfNeeded(log, srcDir, destDir, ".tga") + copyFilesExtNoTreeIfNeeded(log, srcDir, destDir, ".png") +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 old mode 100755 new mode 100644 index 84d2b26a4..6d08f81d4 --- a/code/nel/tools/build_gamedata/processes/zone_light/2_build.py +++ b/code/nel/tools/build_gamedata/processes/zone_light/2_build.py @@ -1,103 +1,105 @@ -#!/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" - subprocess.call([ ExecTimeout, str(ZoneLightBuildTimeout), ZoneLighter, srcFile, destFile, ActiveProjectDirectory + "/generated/properties.cfg", dependFile ]) -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" - subprocess.call([ ExecTimeout, str(ZoneIgLightBuildTimeout), ZoneIgLighter, srcFile, destFile, ActiveProjectDirectory + "/generated/properties.cfg", dependFile ]) -printLog(log, "") - -log.close() - - -# end of file +#!/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/processes/zone_light/3_install.py b/code/nel/tools/build_gamedata/processes/zone_light/3_install.py old mode 100755 new mode 100644 index 4e4d231a4..16ae2dd72 --- a/code/nel/tools/build_gamedata/processes/zone_light/3_install.py +++ b/code/nel/tools/build_gamedata/processes/zone_light/3_install.py @@ -1,71 +1,71 @@ -#!/usr/bin/python -# -# \file 3_install.py -# \brief Install zone_light -# \date 2009-03-11-13-45-GMT -# \author Jan Boon (Kaetemi) -# Python port of game data build pipeline. -# Install 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, "--- Install zone_light") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") - -printLog(log, ">>> Install zone_light zones <<<") -srcDir = ExportBuildDirectory + "/" + ZoneLightBuildDirectory -mkPath(log, srcDir) -destDir = InstallDirectory + "/" + ZoneInstallDirectory -mkPath(log, destDir) -copyFilesNoTreeIfNeeded(log, srcDir, destDir) - -printLog(log, ">>> Install zone_light water maps <<<") -srcDir = ExportBuildDirectory + "/" + ZoneLightWaterShapesLightedExportDirectory -mkPath(log, srcDir) -destDir = InstallDirectory + "/" + WaterMapsInstallDirectory -mkPath(log, destDir) -copyFilesNoTreeIfNeeded(log, srcDir, destDir) - -printLog(log, ">>> Install zone_light igs <<<") -srcDir = ExportBuildDirectory + "/" + ZoneLightIgLandBuildDirectory -mkPath(log, srcDir) -destDir = InstallDirectory + "/" + IgInstallDirectory -mkPath(log, destDir) -copyFilesNoTreeIfNeeded(log, srcDir, destDir) - -printLog(log, "") -log.close() - - -# end of file +#!/usr/bin/python +# +# \file 3_install.py +# \brief Install zone_light +# \date 2009-03-11-13-45-GMT +# \author Jan Boon (Kaetemi) +# Python port of game data build pipeline. +# Install 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_local import * +from process import * +from tools import * +from directories import * + +printLog(log, "") +printLog(log, "-------") +printLog(log, "--- Install zone_light") +printLog(log, "-------") +printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) +printLog(log, "") + +printLog(log, ">>> Install zone_light zones <<<") +srcDir = ExportBuildDirectory + "/" + ZoneLightBuildDirectory +mkPath(log, srcDir) +destDir = InstallDirectory + "/" + ZoneInstallDirectory +mkPath(log, destDir) +copyFilesNoTreeIfNeeded(log, srcDir, destDir) + +printLog(log, ">>> Install zone_light water maps <<<") +srcDir = ExportBuildDirectory + "/" + ZoneLightWaterShapesLightedExportDirectory +mkPath(log, srcDir) +destDir = InstallDirectory + "/" + WaterMapsInstallDirectory +mkPath(log, destDir) +copyFilesNoTreeIfNeeded(log, srcDir, destDir) + +printLog(log, ">>> Install zone_light igs <<<") +srcDir = ExportBuildDirectory + "/" + ZoneLightIgLandBuildDirectory +mkPath(log, srcDir) +destDir = InstallDirectory + "/" + IgInstallDirectory +mkPath(log, destDir) +copyFilesNoTreeIfNeeded(log, srcDir, destDir) + +printLog(log, "") +log.close() + + +# end of file diff --git a/code/nel/tools/build_gamedata/translation/a1_make_phrase_diff.py b/code/nel/tools/build_gamedata/translation/a1_make_phrase_diff.py old mode 100755 new mode 100644 index ba9293aae..9cfa6e908 --- a/code/nel/tools/build_gamedata/translation/a1_make_phrase_diff.py +++ b/code/nel/tools/build_gamedata/translation/a1_make_phrase_diff.py @@ -1,54 +1,54 @@ -#!/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 phrase diff") -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" ]) -except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) -printLog(log, "") - - -log.close() -if os.path.isfile("a1_make_phrase_diff.log"): - os.remove("a1_make_phrase_diff.log") -shutil.copy("log.log", "a1_make_phrase_diff_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log") -shutil.move("log.log", "a1_make_phrase_diff.log") - -raw_input("PRESS ANY KEY TO EXIT") +#!/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 phrase diff") +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" ]) +except Exception, e: + printLog(log, "<" + processName + "> " + str(e)) +printLog(log, "") + + +log.close() +if os.path.isfile("a1_make_phrase_diff.log"): + os.remove("a1_make_phrase_diff.log") +shutil.copy("log.log", "a1_make_phrase_diff_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log") +shutil.move("log.log", "a1_make_phrase_diff.log") + +raw_input("PRESS ANY KEY TO EXIT") diff --git a/code/nel/tools/build_gamedata/translation/a2_merge_phrase_diff.py b/code/nel/tools/build_gamedata/translation/a2_merge_phrase_diff.py old mode 100755 new mode 100644 index 89be176c3..7eef06293 --- a/code/nel/tools/build_gamedata/translation/a2_merge_phrase_diff.py +++ b/code/nel/tools/build_gamedata/translation/a2_merge_phrase_diff.py @@ -1,54 +1,54 @@ -#!/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, "--- Merge phrase diff") -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, "merge_phrase_diff" ]) -except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) -printLog(log, "") - - -log.close() -if os.path.isfile("a2_merge_phrase_diff.log"): - os.remove("a2_merge_phrase_diff.log") -shutil.copy("log.log", "a2_merge_phrase_diff_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log") -shutil.move("log.log", "a2_merge_phrase_diff.log") - -raw_input("PRESS ANY KEY TO EXIT") +#!/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, "--- Merge phrase diff") +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, "merge_phrase_diff" ]) +except Exception, e: + printLog(log, "<" + processName + "> " + str(e)) +printLog(log, "") + + +log.close() +if os.path.isfile("a2_merge_phrase_diff.log"): + os.remove("a2_merge_phrase_diff.log") +shutil.copy("log.log", "a2_merge_phrase_diff_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log") +shutil.move("log.log", "a2_merge_phrase_diff.log") + +raw_input("PRESS ANY KEY TO EXIT") diff --git a/code/nel/tools/build_gamedata/translation/a3_make_clause_diff.py b/code/nel/tools/build_gamedata/translation/a3_make_clause_diff.py old mode 100755 new mode 100644 index 3c92af90c..d907ce474 --- a/code/nel/tools/build_gamedata/translation/a3_make_clause_diff.py +++ b/code/nel/tools/build_gamedata/translation/a3_make_clause_diff.py @@ -1,54 +1,54 @@ -#!/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 clause diff") -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_clause_diff" ]) -except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) -printLog(log, "") - - -log.close() -if os.path.isfile("a3_make_clause_diff.log"): - os.remove("a3_make_clause_diff.log") -shutil.copy("log.log", "a3_make_clause_diff_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log") -shutil.move("log.log", "a3_make_clause_diff.log") - -raw_input("PRESS ANY KEY TO EXIT") +#!/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 clause diff") +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_clause_diff" ]) +except Exception, e: + printLog(log, "<" + processName + "> " + str(e)) +printLog(log, "") + + +log.close() +if os.path.isfile("a3_make_clause_diff.log"): + os.remove("a3_make_clause_diff.log") +shutil.copy("log.log", "a3_make_clause_diff_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log") +shutil.move("log.log", "a3_make_clause_diff.log") + +raw_input("PRESS ANY KEY TO EXIT") diff --git a/code/nel/tools/build_gamedata/translation/a4_merge_clause_diff.py b/code/nel/tools/build_gamedata/translation/a4_merge_clause_diff.py old mode 100755 new mode 100644 index 5fc2efabe..67e308c98 --- a/code/nel/tools/build_gamedata/translation/a4_merge_clause_diff.py +++ b/code/nel/tools/build_gamedata/translation/a4_merge_clause_diff.py @@ -1,54 +1,54 @@ -#!/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, "--- merge clause diff") -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, "merge_clause_diff" ]) -except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) -printLog(log, "") - - -log.close() -if os.path.isfile("a4_merge_clause_diff.log"): - os.remove("a4_merge_clause_diff.log") -shutil.copy("log.log", "a4_merge_clause_diff_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log") -shutil.move("log.log", "a4_merge_clause_diff.log") - -raw_input("PRESS ANY KEY TO EXIT") +#!/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, "--- merge clause diff") +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, "merge_clause_diff" ]) +except Exception, e: + printLog(log, "<" + processName + "> " + str(e)) +printLog(log, "") + + +log.close() +if os.path.isfile("a4_merge_clause_diff.log"): + os.remove("a4_merge_clause_diff.log") +shutil.copy("log.log", "a4_merge_clause_diff_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log") +shutil.move("log.log", "a4_merge_clause_diff.log") + +raw_input("PRESS ANY KEY TO EXIT") diff --git a/code/nel/tools/build_gamedata/translation/b1_make_words_diff.py b/code/nel/tools/build_gamedata/translation/b1_make_words_diff.py old mode 100755 new mode 100644 index 845a60831..6350a1695 --- a/code/nel/tools/build_gamedata/translation/b1_make_words_diff.py +++ b/code/nel/tools/build_gamedata/translation/b1_make_words_diff.py @@ -1,54 +1,54 @@ -#!/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 words diff") -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_words_diff" ]) -except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) -printLog(log, "") - - -log.close() -if os.path.isfile("b1_make_words_diff.log"): - os.remove("b1_make_words_diff.log") -shutil.copy("log.log", "b1_make_words_diff_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log") -shutil.move("log.log", "b1_make_words_diff.log") - -raw_input("PRESS ANY KEY TO EXIT") +#!/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 words diff") +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_words_diff" ]) +except Exception, e: + printLog(log, "<" + processName + "> " + str(e)) +printLog(log, "") + + +log.close() +if os.path.isfile("b1_make_words_diff.log"): + os.remove("b1_make_words_diff.log") +shutil.copy("log.log", "b1_make_words_diff_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log") +shutil.move("log.log", "b1_make_words_diff.log") + +raw_input("PRESS ANY KEY TO EXIT") diff --git a/code/nel/tools/build_gamedata/translation/b2_merge_words_diff.py b/code/nel/tools/build_gamedata/translation/b2_merge_words_diff.py old mode 100755 new mode 100644 index b6048bf05..a7c7113fc --- a/code/nel/tools/build_gamedata/translation/b2_merge_words_diff.py +++ b/code/nel/tools/build_gamedata/translation/b2_merge_words_diff.py @@ -1,54 +1,54 @@ -#!/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, "--- Merge words diff") -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, "merge_words_diff" ]) -except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) -printLog(log, "") - - -log.close() -if os.path.isfile("b2_merge_words_diff.log"): - os.remove("b2_merge_words_diff.log") -shutil.copy("log.log", "b2_merge_words_diff_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log") -shutil.move("log.log", "b2_merge_words_diff.log") - -raw_input("PRESS ANY KEY TO EXIT") +#!/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, "--- Merge words diff") +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, "merge_words_diff" ]) +except Exception, e: + printLog(log, "<" + processName + "> " + str(e)) +printLog(log, "") + + +log.close() +if os.path.isfile("b2_merge_words_diff.log"): + os.remove("b2_merge_words_diff.log") +shutil.copy("log.log", "b2_merge_words_diff_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log") +shutil.move("log.log", "b2_merge_words_diff.log") + +raw_input("PRESS ANY KEY TO EXIT") diff --git a/code/nel/tools/build_gamedata/translation/c1_make_string_diff.py b/code/nel/tools/build_gamedata/translation/c1_make_string_diff.py old mode 100755 new mode 100644 index 915909051..b3ed6948f --- a/code/nel/tools/build_gamedata/translation/c1_make_string_diff.py +++ b/code/nel/tools/build_gamedata/translation/c1_make_string_diff.py @@ -1,54 +1,54 @@ -#!/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 string diff") -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_string_diff" ]) -except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) -printLog(log, "") - - -log.close() -if os.path.isfile("c1_make_string_diff.log"): - os.remove("c1_make_string_diff.log") -shutil.copy("log.log", "c1_make_string_diff_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log") -shutil.move("log.log", "c1_make_string_diff.log") - -raw_input("PRESS ANY KEY TO EXIT") +#!/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 string diff") +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_string_diff" ]) +except Exception, e: + printLog(log, "<" + processName + "> " + str(e)) +printLog(log, "") + + +log.close() +if os.path.isfile("c1_make_string_diff.log"): + os.remove("c1_make_string_diff.log") +shutil.copy("log.log", "c1_make_string_diff_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log") +shutil.move("log.log", "c1_make_string_diff.log") + +raw_input("PRESS ANY KEY TO EXIT") diff --git a/code/nel/tools/build_gamedata/translation/c2_merge_string_diff.py b/code/nel/tools/build_gamedata/translation/c2_merge_string_diff.py old mode 100755 new mode 100644 index 44f27a6ed..294cdd7d8 --- a/code/nel/tools/build_gamedata/translation/c2_merge_string_diff.py +++ b/code/nel/tools/build_gamedata/translation/c2_merge_string_diff.py @@ -1,54 +1,54 @@ -#!/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, "--- Merge string diff") -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, "merge_string_diff" ]) -except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) -printLog(log, "") - - -log.close() -if os.path.isfile("c2_merge_string_diff.log"): - os.remove("c2_merge_string_diff.log") -shutil.copy("log.log", "c2_merge_string_diff_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log") -shutil.move("log.log", "c2_merge_string_diff.log") - -raw_input("PRESS ANY KEY TO EXIT") +#!/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, "--- Merge string diff") +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, "merge_string_diff" ]) +except Exception, e: + printLog(log, "<" + processName + "> " + str(e)) +printLog(log, "") + + +log.close() +if os.path.isfile("c2_merge_string_diff.log"): + os.remove("c2_merge_string_diff.log") +shutil.copy("log.log", "c2_merge_string_diff_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log") +shutil.move("log.log", "c2_merge_string_diff.log") + +raw_input("PRESS ANY KEY TO EXIT") diff --git a/code/nel/tools/build_gamedata/translation/d1_make_botnames_diff.py b/code/nel/tools/build_gamedata/translation/d1_make_botnames_diff.py old mode 100755 new mode 100644 index 330e9e670..473349471 --- a/code/nel/tools/build_gamedata/translation/d1_make_botnames_diff.py +++ b/code/nel/tools/build_gamedata/translation/d1_make_botnames_diff.py @@ -1,54 +1,54 @@ -#!/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 botnames diff") -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_worksheet_diff", "bot_names.txt" ]) -except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) -printLog(log, "") - - -log.close() -if os.path.isfile("d1_make_botnames_diff.log"): - os.remove("d1_make_botnames_diff.log") -shutil.copy("log.log", "d1_make_botnames_diff_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log") -shutil.move("log.log", "d1_make_botnames_diff.log") - -raw_input("PRESS ANY KEY TO EXIT") +#!/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 botnames diff") +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_worksheet_diff", "bot_names.txt" ]) +except Exception, e: + printLog(log, "<" + processName + "> " + str(e)) +printLog(log, "") + + +log.close() +if os.path.isfile("d1_make_botnames_diff.log"): + os.remove("d1_make_botnames_diff.log") +shutil.copy("log.log", "d1_make_botnames_diff_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log") +shutil.move("log.log", "d1_make_botnames_diff.log") + +raw_input("PRESS ANY KEY TO EXIT") diff --git a/code/nel/tools/build_gamedata/translation/d2_merge_botnames_diff.py b/code/nel/tools/build_gamedata/translation/d2_merge_botnames_diff.py old mode 100755 new mode 100644 index e2b0dd2ec..acedda712 --- a/code/nel/tools/build_gamedata/translation/d2_merge_botnames_diff.py +++ b/code/nel/tools/build_gamedata/translation/d2_merge_botnames_diff.py @@ -1,54 +1,54 @@ -#!/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, "--- Merge botnames diff") -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, "merge_worksheet_diff", "bot_names.txt" ]) -except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) -printLog(log, "") - - -log.close() -if os.path.isfile("d2_merge_botnames_diff.log"): - os.remove("d2_merge_botnames_diff.log") -shutil.copy("log.log", "d2_merge_botnames_diff_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log") -shutil.move("log.log", "d2_merge_botnames_diff.log") - -raw_input("PRESS ANY KEY TO EXIT") +#!/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, "--- Merge botnames diff") +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, "merge_worksheet_diff", "bot_names.txt" ]) +except Exception, e: + printLog(log, "<" + processName + "> " + str(e)) +printLog(log, "") + + +log.close() +if os.path.isfile("d2_merge_botnames_diff.log"): + os.remove("d2_merge_botnames_diff.log") +shutil.copy("log.log", "d2_merge_botnames_diff_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log") +shutil.move("log.log", "d2_merge_botnames_diff.log") + +raw_input("PRESS ANY KEY TO EXIT") diff --git a/code/nel/tools/build_gamedata/translation/e1_clean_string_diff.py b/code/nel/tools/build_gamedata/translation/e1_clean_string_diff.py old mode 100755 new mode 100644 index 9eafba1a6..9098e82e2 --- a/code/nel/tools/build_gamedata/translation/e1_clean_string_diff.py +++ b/code/nel/tools/build_gamedata/translation/e1_clean_string_diff.py @@ -1,54 +1,54 @@ -#!/usr/bin/python -# -# \author Lukasz Kolasa (Maczuga) -# -# 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, "--- Clean string diff") -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, "clean_string_diff" ]) -except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) -printLog(log, "") - - -log.close() -if os.path.isfile("e1_clean_string_diff.log"): - os.remove("e1_clean_string_diff.log") -shutil.copy("log.log", "e1_clean_string_diff_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log") -shutil.move("log.log", "e1_clean_string_diff.log") - -raw_input("PRESS ANY KEY TO EXIT") +#!/usr/bin/python +# +# \author Lukasz Kolasa (Maczuga) +# +# 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, "--- Clean string diff") +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, "clean_string_diff" ]) +except Exception, e: + printLog(log, "<" + processName + "> " + str(e)) +printLog(log, "") + + +log.close() +if os.path.isfile("e1_clean_string_diff.log"): + os.remove("e1_clean_string_diff.log") +shutil.copy("log.log", "e1_clean_string_diff_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log") +shutil.move("log.log", "e1_clean_string_diff.log") + +raw_input("PRESS ANY KEY TO EXIT") diff --git a/code/nel/tools/build_gamedata/translation/e2_clean_words_diff.py b/code/nel/tools/build_gamedata/translation/e2_clean_words_diff.py old mode 100755 new mode 100644 index a98c7b27c..d205e5c8c --- a/code/nel/tools/build_gamedata/translation/e2_clean_words_diff.py +++ b/code/nel/tools/build_gamedata/translation/e2_clean_words_diff.py @@ -1,54 +1,54 @@ -#!/usr/bin/python -# -# \author Lukasz Kolasa (Maczuga) -# -# 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, "--- Clean words diff") -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, "clean_words_diff" ]) -except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) -printLog(log, "") - - -log.close() -if os.path.isfile("e2_clean_words_diff.log"): - os.remove("e2_clean_words_diff.log") -shutil.copy("log.log", "e2_clean_words_diff_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log") -shutil.move("log.log", "e2_clean_words_diff.log") - -raw_input("PRESS ANY KEY TO EXIT") +#!/usr/bin/python +# +# \author Lukasz Kolasa (Maczuga) +# +# 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, "--- Clean words diff") +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, "clean_words_diff" ]) +except Exception, e: + printLog(log, "<" + processName + "> " + str(e)) +printLog(log, "") + + +log.close() +if os.path.isfile("e2_clean_words_diff.log"): + os.remove("e2_clean_words_diff.log") +shutil.copy("log.log", "e2_clean_words_diff_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log") +shutil.move("log.log", "e2_clean_words_diff.log") + +raw_input("PRESS ANY KEY TO EXIT") diff --git a/code/nel/tools/build_gamedata/translation/e3_clean_clause_diff.py b/code/nel/tools/build_gamedata/translation/e3_clean_clause_diff.py old mode 100755 new mode 100644 index 337ac6e99..6d2416fa7 --- a/code/nel/tools/build_gamedata/translation/e3_clean_clause_diff.py +++ b/code/nel/tools/build_gamedata/translation/e3_clean_clause_diff.py @@ -1,54 +1,54 @@ -#!/usr/bin/python -# -# \author Lukasz Kolasa (Maczuga) -# -# 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, "--- Clean clause diff") -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, "clean_clause_diff" ]) -except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) -printLog(log, "") - - -log.close() -if os.path.isfile("e3_clean_clause_diff.log"): - os.remove("e3_clean_clause_diff.log") -shutil.copy("log.log", "e3_clean_clause_diff_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log") -shutil.move("log.log", "e3_clean_clause_diff.log") - -raw_input("PRESS ANY KEY TO EXIT") +#!/usr/bin/python +# +# \author Lukasz Kolasa (Maczuga) +# +# 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, "--- Clean clause diff") +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, "clean_clause_diff" ]) +except Exception, e: + printLog(log, "<" + processName + "> " + str(e)) +printLog(log, "") + + +log.close() +if os.path.isfile("e3_clean_clause_diff.log"): + os.remove("e3_clean_clause_diff.log") +shutil.copy("log.log", "e3_clean_clause_diff_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log") +shutil.move("log.log", "e3_clean_clause_diff.log") + +raw_input("PRESS ANY KEY TO EXIT") diff --git a/code/nel/tools/build_gamedata/translation/e4_clean_phrase_diff.py b/code/nel/tools/build_gamedata/translation/e4_clean_phrase_diff.py old mode 100755 new mode 100644 index 8f08d73ea..531f4218f --- a/code/nel/tools/build_gamedata/translation/e4_clean_phrase_diff.py +++ b/code/nel/tools/build_gamedata/translation/e4_clean_phrase_diff.py @@ -1,54 +1,54 @@ -#!/usr/bin/python -# -# \author Lukasz Kolasa (Maczuga) -# -# 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, "--- Clean phrase diff") -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, "clean_phrase_diff" ]) -except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) -printLog(log, "") - - -log.close() -if os.path.isfile("e4_clean_phrase_diff.log"): - os.remove("e4_clean_phrase_diff.log") -shutil.copy("log.log", "e4_clean_phrase_diff_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log") -shutil.move("log.log", "e4_clean_phrase_diff.log") - -raw_input("PRESS ANY KEY TO EXIT") +#!/usr/bin/python +# +# \author Lukasz Kolasa (Maczuga) +# +# 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, "--- Clean phrase diff") +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, "clean_phrase_diff" ]) +except Exception, e: + printLog(log, "<" + processName + "> " + str(e)) +printLog(log, "") + + +log.close() +if os.path.isfile("e4_clean_phrase_diff.log"): + os.remove("e4_clean_phrase_diff.log") +shutil.copy("log.log", "e4_clean_phrase_diff_" + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + ".log") +shutil.move("log.log", "e4_clean_phrase_diff.log") + +raw_input("PRESS ANY KEY TO EXIT") diff --git a/code/nel/tools/build_gamedata/translation/make_merge_all.py b/code/nel/tools/build_gamedata/translation/make_merge_all.py old mode 100755 new mode 100644 index f4dbd95fb..91fc4712b --- a/code/nel/tools/build_gamedata/translation/make_merge_all.py +++ b/code/nel/tools/build_gamedata/translation/make_merge_all.py @@ -1,67 +1,70 @@ -#!/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, "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") +#!/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 old mode 100755 new mode 100644 index 4442232ab..43c1ac325 --- a/code/nel/tools/build_gamedata/translation/make_merge_wk.py +++ b/code/nel/tools/build_gamedata/translation/make_merge_wk.py @@ -1,112 +1,115 @@ -#!/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_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_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_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") +#!/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") From 90161cd1216448f871b31aef950eeabaa28a82bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20Gon=C3=A7alves=20=28Ulukyn=29?= Date: Sat, 25 Sep 2021 16:22:34 +0100 Subject: [PATCH 02/13] Fix resell issue (use uint16 instead of uint8 for Index) --- .../src/interface_v3/bot_chat_page_trade.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp b/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp index cbc1a30c1..39a4a7e0c 100644 --- a/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp +++ b/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp @@ -509,15 +509,15 @@ uint32 CBotChatPageTrade::getUserFactionPoints(PVP_CLAN::TPVPClan clan) const // *************************************************************************************** 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: + public: bool DownloadComplete; - virtual void visitGroup(CInterfaceGroup *group) + virtual void visitGroup(CInterfaceGroup *group) { CDBGroupListSheetText *dbGroup = dynamic_cast(group); if (dbGroup) @@ -1285,15 +1285,15 @@ void CBotChatPageTrade::confirmTrade( bool enableResale ) NLMISC::CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(msg, out)) { - uint8 u8Inv = (uint8) _CurrItemInventory; - uint8 u8Index = (uint8) _CurrItemIndex; - uint32 u32resalePrice = (uint32)max((sint32)0, resalePrice); + uint8 u8Inv = (uint8) _CurrItemInventory; + uint16 u16Index = (uint16) _CurrItemIndex; + uint32 u32resalePrice = (uint32)max((sint32)0, resalePrice); out.serial(u8Inv); out.serial(u8Index); out.serial(u16Quantity); out.serial(u32resalePrice); NetMngr.push(out); - //nlinfo("impulseCallBack sent: %s %d %d %d %d", msg, u8Inv, u8Index, u16Quantity, u32resalePrice); + //nlinfo("impulseCallBack sent: %s %d %d %d %d", msg, u8Inv, u16Index, u16Quantity, u32resalePrice); } else nlwarning(" unknown message name '%s'", msg); From bdea7d24d274b4d4ce975472b7089ef2b93c696e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20Gon=C3=A7alves=20=28Ulukyn=29?= Date: Sat, 25 Sep 2021 16:24:29 +0100 Subject: [PATCH 03/13] Fix resell issue (use uint16 instead of uint8 for Index) --- ryzom/client/src/interface_v3/bot_chat_page_trade.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp b/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp index 39a4a7e0c..2ca15c4fa 100644 --- a/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp +++ b/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp @@ -1289,7 +1289,7 @@ void CBotChatPageTrade::confirmTrade( bool enableResale ) uint16 u16Index = (uint16) _CurrItemIndex; uint32 u32resalePrice = (uint32)max((sint32)0, resalePrice); out.serial(u8Inv); - out.serial(u8Index); + out.serial(u16Index); out.serial(u16Quantity); out.serial(u32resalePrice); NetMngr.push(out); From 8ef89b80b0e8c9f4debc22fa32b1d3bb99f01c2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20Gon=C3=A7alves=20=28Ulukyn=29?= Date: Sat, 25 Sep 2021 16:28:41 +0100 Subject: [PATCH 04/13] Fix resell issue (use uint16 instead of uint8 for Index) --- .../src/interface_v3/bot_chat_page_trade.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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 index d05ba9d7a..045aba4e4 100644 --- a/code/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp +++ b/code/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp @@ -508,15 +508,15 @@ uint32 CBotChatPageTrade::getUserFactionPoints(PVP_CLAN::TPVPClan clan) const // *************************************************************************************** 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: + public: bool DownloadComplete; - virtual void visitGroup(CInterfaceGroup *group) + virtual void visitGroup(CInterfaceGroup *group) { CDBGroupListSheetText *dbGroup = dynamic_cast(group); if (dbGroup) @@ -1284,15 +1284,15 @@ void CBotChatPageTrade::confirmTrade( bool enableResale ) NLMISC::CBitMemStream out; if(GenericMsgHeaderMngr.pushNameToStream(msg, out)) { - uint8 u8Inv = (uint8) _CurrItemInventory; - uint8 u8Index = (uint8) _CurrItemIndex; - uint32 u32resalePrice = (uint32)max((sint32)0, resalePrice); + uint8 u8Inv = (uint8) _CurrItemInventory; + uint16 u16Index = (uint16) _CurrItemIndex; + uint32 u32resalePrice = (uint32)max((sint32)0, resalePrice); out.serial(u8Inv); - out.serial(u8Index); + out.serial(u16Index); out.serial(u16Quantity); out.serial(u32resalePrice); NetMngr.push(out); - //nlinfo("impulseCallBack sent: %s %d %d %d %d", msg, u8Inv, u8Index, u16Quantity, u32resalePrice); + //nlinfo("impulseCallBack sent: %s %d %d %d %d", msg, u8Inv, u16Index, u16Quantity, u32resalePrice); } else nlwarning(" unknown message name '%s'", msg); From f76ad7a3eb3557be0f091999277d3fa85c767d1f Mon Sep 17 00:00:00 2001 From: Nimetu Date: Thu, 14 Oct 2021 15:14:51 +0300 Subject: [PATCH 05/13] Remove loading certs from native Windows cert store. --- nel/src/web/curl_certificates.cpp | 41 ------------------------------- 1 file changed, 41 deletions(-) diff --git a/nel/src/web/curl_certificates.cpp b/nel/src/web/curl_certificates.cpp index fdf69604f..52f04fe25 100644 --- a/nel/src/web/curl_certificates.cpp +++ b/nel/src/web/curl_certificates.cpp @@ -131,13 +131,6 @@ namespace NLWEB // only use OpenSSL callback if not using Windows SSPI and using OpenSSL backend if (useOpenSSLBackend && !(data && data->features & CURL_VERSION_SSPI)) { -#ifdef NL_OS_WINDOWS - // load native Windows CA Certs - addCertificatesFrom("CA"); - addCertificatesFrom("AuthRoot"); - addCertificatesFrom("ROOT"); -#endif - isUsingOpenSSLBackend = true; } else @@ -179,40 +172,6 @@ namespace NLWEB return name; } -#ifdef NL_OS_WINDOWS - void addCertificatesFrom(LPCSTR root) - { - HCERTSTORE hStore; - PCCERT_CONTEXT pContext = NULL; - X509 *x509; - hStore = CertOpenSystemStore(NULL, root); - if (hStore) - { - while (pContext = CertEnumCertificatesInStore(hStore, pContext)) - { - x509 = NULL; - x509 = d2i_X509(NULL, (const unsigned char **)&pContext->pbCertEncoded, pContext->cbCertEncoded); - - if (x509) - { - CertEntry entry; - entry.cert = x509; - entry.file = root; - entry.name = getCertName(x509); - - CertList.push_back(entry); - } - } - - CertFreeCertificateContext(pContext); - CertCloseStore(hStore, 0); - } - - // this is called before debug context is set and log ends up in log.log - //nlinfo("Loaded %d certificates from '%s' certificate store", (int)CertList.size(), root); - } -#endif - void addCertificatesFromFile(const std::string &cert) { if (!isInitialized) From 6cfc9585f5d929116bc81bf1db6a89844691ae93 Mon Sep 17 00:00:00 2001 From: bensaine Date: Thu, 14 Oct 2021 20:31:10 -0400 Subject: [PATCH 06/13] Update .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 22089c19f..07be83e98 100644 --- a/.gitignore +++ b/.gitignore @@ -90,6 +90,7 @@ ylwrap *.mk # Visual Studio garbage +.vscode/ *.opensdf UpgradeLog*.XML _UpgradeReport_Files @@ -159,6 +160,7 @@ code/build/* code/build-2010/* build/* install/* +win-build/ build_* code/nel/tools/build_gamedata/configuration/buildsite.py From 36c2ff5b866a511a203bb9ceaa351184ed5d1e6f Mon Sep 17 00:00:00 2001 From: Nuno Date: Wed, 20 Oct 2021 13:31:14 +0200 Subject: [PATCH 07/13] 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 - From 70286d36a9ec88d2e68020da2a552ae11ffa3db2 Mon Sep 17 00:00:00 2001 From: Nuno Date: Wed, 20 Oct 2021 14:33:00 +0200 Subject: [PATCH 09/13] Remove unwanted files --- code/nel/include/nel/misc/string_common.h | 396 -- code/nel/tools/build_gamedata/0_setup.py | 594 --- .../translation/make_merge_all.py | 70 - .../translation/make_merge_wk.py | 115 - code/ryzom/client/src/client_cfg.cpp | 2362 --------- code/ryzom/client/src/connection.cpp | 3693 -------------- code/ryzom/client/src/far_tp.cpp | 1522 ------ .../src/interface_v3/inventory_manager.cpp | 4049 --------------- code/ryzom/client/src/login.cpp | 3331 ------------ code/ryzom/client/src/net_manager.cpp | 4414 ---------------- code/ryzom/client/src/user_entity.cpp | 4542 ----------------- 11 files changed, 25088 deletions(-) delete mode 100644 code/nel/include/nel/misc/string_common.h delete mode 100644 code/nel/tools/build_gamedata/0_setup.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/client_cfg.cpp delete mode 100644 code/ryzom/client/src/connection.cpp delete mode 100644 code/ryzom/client/src/far_tp.cpp delete mode 100644 code/ryzom/client/src/interface_v3/inventory_manager.cpp delete mode 100644 code/ryzom/client/src/login.cpp delete mode 100644 code/ryzom/client/src/net_manager.cpp delete mode 100644 code/ryzom/client/src/user_entity.cpp diff --git a/code/nel/include/nel/misc/string_common.h b/code/nel/include/nel/misc/string_common.h deleted file mode 100644 index 372ee4be5..000000000 --- a/code/nel/include/nel/misc/string_common.h +++ /dev/null @@ -1,396 +0,0 @@ -// NeL - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This source file has been modified by the following contributors: -// Copyright (C) 2012 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2016-2019 Jan BOON (Kaetemi) -// -// 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 . - -#ifndef NL_STRING_COMMON_H -#define NL_STRING_COMMON_H - -#include "types_nl.h" - -#include -#include -#include -#include - -namespace NLMISC -{ - -// get a string and add \r before \n if necessary -std::string addSlashR (const std::string &str); -std::string removeSlashR (const std::string &str); - -/** - * \def MaxCStringSize - * - * The maximum size allowed for C string (zero terminated string) buffer. - * This value is used when we have to create a standard C string buffer and we don't know exactly the final size of the string. - */ -const int MaxCStringSize = 2048; - - -/** - * \def NLMISC_CONVERT_VARGS(dest,format) - * - * This macro converts variable arguments into C string (zero terminated string). - * This function takes care to avoid buffer overflow. - * - * Example: - *\code - void MyFunction(const char *format, ...) - { - string str; - NLMISC_CONVERT_VARGS (str, format, NLMISC::MaxCStringSize); - // str contains the result of the conversion - } - *\endcode - * - * \param _dest \c string or \c char* that contains the result of the convertion - * \param _format format of the string, it must be the last argument before the \c '...' - * \param _size size of the buffer that will contain the C string - */ -#define NLMISC_CONVERT_VARGS(_dest,_format,_size) \ -char _cstring[_size]; \ -va_list _args; \ -va_start (_args, _format); \ -int _res = vsnprintf (_cstring, _size-1, _format, _args); \ -if (_res == -1 || _res == _size-1) \ -{ \ - _cstring[_size-1] = '\0'; \ -} \ -va_end (_args); \ -_dest = _cstring - - - -/** sMart sprintf function. This function do a sprintf and add a zero at the end of the buffer - * if there no enough room in the buffer. - * - * \param buffer a C string - * \param count Size of the buffer - * \param format of the string, it must be the last argument before the \c '...' - */ -sint smprintf( char *buffer, size_t count, const char *format, ... ); - - -#ifdef NL_OS_WINDOWS - -// -// These functions are needed by template system to failed the compilation if you pass bad type on nlinfo... -// - -inline void _check(int /* a */) { } -inline void _check(unsigned int /* a */) { } -inline void _check(char /* a */) { } -inline void _check(unsigned char /* a */) { } -inline void _check(long /* a */) { } -inline void _check(unsigned long /* a */) { } - -#ifdef NL_COMP_VC6 - inline void _check(uint8 /* a */) { } -#endif // NL_COMP_VC6 - -inline void _check(sint8 /* a */) { } -inline void _check(uint16 /* a */) { } -inline void _check(sint16 /* a */) { } - -#ifdef NL_COMP_VC6 - inline void _check(uint32 /* a */) { } - inline void _check(sint32 /* a */) { } -#endif // NL_COMP_VC6 - -inline void _check(uint64 /* a */) { } -inline void _check(sint64 /* a */) { } -inline void _check(float /* a */) { } -inline void _check(double /* a */) { } -inline void _check(const char * /* a */) { } -inline void _check(const void * /* a */) { } - -#define CHECK_TYPES(__a,__b) \ -inline __a(const char *fmt) { __b(fmt); } \ -template __a(const char *fmt, A a) { _check(a); __b(fmt, a); } \ -template __a(const char *fmt, A a, B b) { _check(a); _check(b); __b(fmt, a, b); } \ -template __a(const char *fmt, A a, B b, C c) { _check(a); _check(b); _check(c); __b(fmt, a, b, c); } \ -template __a(const char *fmt, A a, B b, C c, D d) { _check(a); _check(b); _check(c); _check(d); __b(fmt, a, b, c, d); } \ -template __a(const char *fmt, A a, B b, C c, D d, E e) { _check(a); _check(b); _check(c); _check(d); _check(e); __b(fmt, a, b, c, d, e); } \ -template __a(const char *fmt, A a, B b, C c, D d, E e, F f) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); __b(fmt, a, b, c, d, e, f); } \ -template __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); __b(fmt, a, b, c, d, e, f, g); } \ -template __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); __b(fmt, a, b, c, d, e, f, g, h); } \ -template __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); __b(fmt, a, b, c, d, e, f, g, h, i); } \ -template __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); _check(j); __b(fmt, a, b, c, d, e, f, g, h, i, j); } \ -template __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); _check(j); _check(k); __b(fmt, a, b, c, d, e, f, g, h, i, j, k); } \ -template __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); _check(j); _check(k); _check(l); __b(fmt, a, b, c, d, e, f, g, h, i, j, k, l); } \ -template __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); _check(j); _check(k); _check(l); _check(m); __b(fmt, a, b, c, d, e, f, g, h, i, j, k, l, m); } \ -template __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); _check(j); _check(k); _check(l); _check(m); _check(n); __b(fmt, a, b, c, d, e, f, g, h, i, j, k, l, m, n); } \ -template __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); _check(j); _check(k); _check(l); _check(m); _check(n); _check(o); __b(fmt, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o); } \ -template __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); _check(j); _check(k); _check(l); _check(m); _check(n); _check(o); _check(p); __b(fmt, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p); } \ -template __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p, Q q) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); _check(j); _check(k); _check(l); _check(m); _check(n); _check(o); _check(p); _check(q); __b(fmt, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q); } \ -template __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p, Q q, R r) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); _check(j); _check(k); _check(l); _check(m); _check(n); _check(o); _check(p); _check(q); _check(r); __b(fmt, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r); } \ -template __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p, Q q, R r, S s) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); _check(j); _check(k); _check(l); _check(m); _check(n); _check(o); _check(p); _check(q); _check(r); _check(s); __b(fmt, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s); } \ -template __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p, Q q, R r, S s, T t) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); _check(j); _check(k); _check(l); _check(m); _check(n); _check(o); _check(p); _check(q); _check(r); _check(s); _check(t); __b(fmt, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t); } \ -template __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p, Q q, R r, S s, T t, U u) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); _check(j); _check(k); _check(l); _check(m); _check(n); _check(o); _check(p); _check(q); _check(r); _check(s); _check(t); _check(u); __b(fmt, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u); } \ -template __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p, Q q, R r, S s, T t, U u, V v) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); _check(j); _check(k); _check(l); _check(m); _check(n); _check(o); _check(p); _check(q); _check(r); _check(s); _check(t); _check(u); _check(v); __b(fmt, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v); } \ -template __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p, Q q, R r, S s, T t, U u, V v, W w) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); _check(j); _check(k); _check(l); _check(m); _check(n); _check(o); _check(p); _check(q); _check(r); _check(s); _check(t); _check(u); _check(v); _check(w); __b(fmt, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w); } \ -template __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p, Q q, R r, S s, T t, U u, V v, W w, X x) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); _check(j); _check(k); _check(l); _check(m); _check(n); _check(o); _check(p); _check(q); _check(r); _check(s); _check(t); _check(u); _check(v); _check(w); _check(x); __b(fmt, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x); } \ -template __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p, Q q, R r, S s, T t, U u, V v, W w, X x, Y y) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); _check(j); _check(k); _check(l); _check(m); _check(n); _check(o); _check(p); _check(q); _check(r); _check(s); _check(t); _check(u); _check(v); _check(w); _check(x); _check(y); __b(fmt, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y); } \ -template __a(const char *fmt, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p, Q q, R r, S s, T t, U u, V v, W w, X x, Y y, Z z) { _check(a); _check(b); _check(c); _check(d); _check(e); _check(f); _check(g); _check(h); _check(i); _check(j); _check(k); _check(l); _check(m); _check(n); _check(o); _check(p); _check(q); _check(r); _check(s); _check(t); _check(u); _check(v); _check(w); _check(x); _check(y); _check(z); __b(fmt, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z); } - -#endif - -#ifdef NL_OS_WINDOWS - inline std::string _toString(const char *format, ...) -#else - inline std::string toString(const char *format, ...) -#endif -{ - std::string Result; - NLMISC_CONVERT_VARGS(Result, format, NLMISC::MaxCStringSize); - return Result; -} - -#ifdef NL_OS_WINDOWS - CHECK_TYPES(std::string toString, return _toString) -#endif // NL_OS_WINDOWS - -template std::string toStringPtr(const T *val) { return toString("%p", val); } - -template std::string toStringEnum(const T &val) { return toString("%u", (uint32)val); } - -/** - * Template Object toString. - * \param obj any object providing a "std::string toString()" method. The object doesn't have to derive from anything. - * - * the VC++ error "error C2228: left of '.toString' must have class/struct/union type" means you don't provide - * a toString() method to your object. - */ -template std::string toString(const T &obj) -{ - return obj.toString(); -} - -//inline std::string toString(const char *val) { return toString("%s", val); } -inline std::string toString(const uint8 &val) { return toString("%hu", (uint16)val); } -inline std::string toString(const sint8 &val) { return toString("%hd", (sint16)val); } -inline std::string toString(const uint16 &val) { return toString("%hu", val); } -inline std::string toString(const sint16 &val) { return toString("%hd", val); } -inline std::string toString(const uint32 &val) { return toString("%u", val); } -inline std::string toString(const sint32 &val) { return toString("%d", val); } -inline std::string toString(const uint64 &val) { return toString("%" NL_I64 "u", val); } -inline std::string toString(const sint64 &val) { return toString("%" NL_I64 "d", val); } - -#ifdef NL_COMP_GCC -# if GCC_VERSION == 40102 - -// error fix for size_t? gcc 4.1.2 requested this type instead of size_t ... -inline std::string toString(const long unsigned int &val) -{ -#ifdef _LP64 - return toString((uint64)val); -#else - return toString((uint32)val); -#endif -} - -# endif -#endif - -#if (SIZEOF_SIZE_T) == 8 -inline std::string toString(const size_t &val) { return toString("%" NL_I64 "u", val); } -#else -#ifdef NL_OS_MAC -inline std::string toString(const size_t &val) { return toString("%u", val); } -#endif -#endif - -inline std::string toString(const float &val) { return toString("%f", val); } -inline std::string toString(const double &val) { return toString("%lf", val); } -inline std::string toString(const bool &val) { return val ? "1":"0"; } -inline std::string toString(const std::string &val) { return val; } - -// stl vectors of bool use bit reference and not real bools, so define the operator for bit reference - -#ifdef NL_COMP_VC6 -inline std::string toString(const uint &val) { return toString("%u", val); } -inline std::string toString(const sint &val) { return toString("%d", val); } -#endif // NL_COMP_VC6 - -template -bool fromString(const std::string &str, T &obj) -{ - return obj.fromString(str); -} - -inline bool fromString(const std::string &str, uint32 &val) { if (str.find('-') != std::string::npos) { val = 0; return false; } char *end; unsigned long v; errno = 0; v = strtoul(str.c_str(), &end, 10); if (errno || v > UINT_MAX || end == str.c_str()) { val = 0; return false; } else { val = (uint32)v; return true; } } -inline bool fromString(const std::string &str, sint32 &val) { char *end; long v; errno = 0; v = strtol(str.c_str(), &end, 10); if (errno || v > INT_MAX || v < INT_MIN || end == str.c_str()) { val = 0; return false; } else { val = (sint32)v; return true; } } -inline bool fromString(const std::string &str, uint8 &val) { char *end; long v; errno = 0; v = strtol(str.c_str(), &end, 10); if (errno || v > UCHAR_MAX || v < 0 || end == str.c_str()) { val = 0; return false; } else { val = (uint8)v; return true; } } -inline bool fromString(const std::string &str, sint8 &val) { char *end; long v; errno = 0; v = strtol(str.c_str(), &end, 10); if (errno || v > SCHAR_MAX || v < SCHAR_MIN || end == str.c_str()) { val = 0; return false; } else { val = (sint8)v; return true; } } -inline bool fromString(const std::string &str, uint16 &val) { char *end; long v; errno = 0; v = strtol(str.c_str(), &end, 10); if (errno || v > USHRT_MAX || v < 0 || end == str.c_str()) { val = 0; return false; } else { val = (uint16)v; return true; } } -inline bool fromString(const std::string &str, sint16 &val) { char *end; long v; errno = 0; v = strtol(str.c_str(), &end, 10); if (errno || v > SHRT_MAX || v < SHRT_MIN || end == str.c_str()) { val = 0; return false; } else { val = (sint16)v; return true; } } -inline bool fromString(const std::string &str, uint64 &val) { bool ret = sscanf(str.c_str(), "%" NL_I64 "u", &val) == 1; if (!ret) val = 0; return ret; } -inline bool fromString(const std::string &str, sint64 &val) { bool ret = sscanf(str.c_str(), "%" NL_I64 "d", &val) == 1; if (!ret) val = 0; return ret; } -inline bool fromString(const std::string &str, float &val) { bool ret = sscanf(str.c_str(), "%f", &val) == 1; if (!ret) val = 0.0f; return ret; } -inline bool fromString(const std::string &str, double &val) { bool ret = sscanf(str.c_str(), "%lf", &val) == 1; if (!ret) val = 0.0; return ret; } - -/// Fast string to bool, reliably defined for strings starting with 0, 1, t, T, f, F, y, Y, n, N, and empty strings, anything else is undefined. -/// - Kaetemi -inline bool toBool(const char *str) { return str[0] == '1' || (str[0] & 0xD2) == 0x50; } -inline bool toBool(const std::string &str) { return toBool(str.c_str()); } // Safe because first byte may be null - -bool fromString(const std::string &str, bool &val); - -inline bool fromString(const std::string &str, std::string &val) { val = str; return true; } - -// stl vectors of bool use bit reference and not real bools, so define the operator for bit reference - -#ifdef NL_COMP_VC6 -inline bool fromString(const std::string &str, uint &val) { return sscanf(str.c_str(), "%u", &val) == 1; } -inline bool fromString(const std::string &str, sint &val) { return sscanf(str.c_str(), "%d", &val) == 1; } -#endif // NL_COMP_VC6 - -inline bool startsWith(const char *str, const char *prefix) -{ - for (int i = 0;; ++i) - { - if (str[i] != prefix[i] || str[i] == '\0') - { - return prefix[i] == '\0'; - } - } -} - -inline bool startsWith(const std::string &str, const char *prefix) { return startsWith(str.c_str(), prefix); } -inline bool startsWith(const std::string &str, const std::string &prefix) { return startsWith(str.c_str(), prefix.c_str()); } - -inline bool endsWith(const char *str, size_t strLen, const char *suffix, size_t suffixLen) -{ - if (strLen < suffixLen) - return false; - int minLen = strLen < suffixLen ? strLen : suffixLen; - for (int i = 1; i <= minLen; ++i) - if (str[strLen - i] != suffix[suffixLen - i]) - return false; - return true; -} - -inline bool endsWith(const char *str, const char *suffix) { return endsWith(str, strlen(str), suffix, strlen(suffix)); } -inline bool endsWith(const std::string &str, const char *suffix) { return endsWith(str.c_str(), str.size(), suffix, strlen(suffix)); } -inline bool endsWith(const std::string &str, const std::string &suffix) { return endsWith(str.c_str(), str.size(), suffix.c_str(), suffix.size()); } - -// Convert local codepage to UTF-8 -// On Windows, the local codepage is undetermined -// On Linux, the local codepage is always UTF-8 (no-op) -std::string mbcsToUtf8(const char *str, size_t len = 0); -std::string mbcsToUtf8(const std::string &str); - -// Convert wide codepage to UTF-8 -// On Windows, the wide codepage is UTF-16 -// On Linux, the wide codepage is UTF-32 -std::string wideToUtf8(const wchar_t *str, size_t len = 0); -std::string wideToUtf8(const std::wstring &str); - -// Convert UTF-8 to wide character set -std::wstring utf8ToWide(const char *str, size_t len = 0); -std::wstring utf8ToWide(const std::string &str); - -// Convert UTF-8 to local multibyte character set -std::string utf8ToMbcs(const char *str, size_t len = 0); -std::string utf8ToMbcs(const std::string &str); - -// Convert wide to local multibyte character set -std::string wideToMbcs(const wchar_t *str, size_t len = 0); -std::string wideToMbcs(const std::wstring &str); - -// Convert local multibyte to wide character set -std::wstring mbcsToWide(const char *str, size_t len = 0); -std::wstring mbcsToWide(const std::string &str); - -inline const char *asCStr(const char *str) { return str; } -inline const char *asCStr(const std::string &str) { return str.c_str(); } -inline const wchar_t *asCStr(const wchar_t *str) { return str; } -inline const wchar_t *asCStr(const std::wstring &str) { return str.c_str(); } - -#if defined(NL_OS_WINDOWS) -#define nlUtf8ToMbcs(str) (NLMISC::utf8ToMbcs(str).c_str()) -#define nlMbcsToUtf8(str) (NLMISC::mbcsToUtf8(str).c_str()) -#else -#define nlUtf8ToMbcs(str) (NLMISC::asCStr(str)) -#define nlMbcsToUtf8(str) (NLMISC::asCStr(str)) -#endif -#define nlWideToUtf8(str) (NLMISC::wideToUtf8(str).c_str()) -#define nlUtf8ToWide(str) (NLMISC::utf8ToWide(str).c_str()) -#define nlWideToMbcs(str) (NLMISC::wideToMbcs(str).c_str()) -#define nlMbcsToWide(str) (NLMISC::mbcsToWide(str).c_str()) - -// On Windows, tstring is either local multibyte or utf-16 wide -// On Linux, tstring is always utf-8 - -#if defined(NL_OS_WINDOWS) && (defined(UNICODE) || defined(_UNICODE)) -typedef std::wstring tstring; -typedef wchar_t tchar; -inline std::string tStrToUtf8(const tchar *str) { return wideToUtf8((const wchar_t *)str); } -inline std::string tStrToUtf8(const tstring &str) { return wideToUtf8((const std::wstring &)str); } -inline std::wstring tStrToWide(const tchar *str) { return (const wchar_t *)str; } -inline std::wstring tStrToWide(const tstring &str) { return (const std::wstring &)str; } -inline std::string tStrToMbcs(const tchar *str) { return wideToMbcs((const wchar_t *)str); } -inline std::string tStrToMbcs(const tstring &str) { return wideToMbcs((const std::wstring &)str); } -#define nlTStrToUtf8(str) (NLMISC::tStrToUtf8(str).c_str()) -#define nlTStrToWide(str) ((const wchar_t *)NLMISC::asCStr(str)) -#define nlTStrToMbcs(str) (NLMISC::tStrToMbcs(str).c_str()) -inline tstring utf8ToTStr(const char *str) {return (const tstring &)utf8ToWide(str); } -inline tstring utf8ToTStr(const std::string &str) { return (const tstring &)utf8ToWide(str); } -inline tstring wideToTStr(const wchar_t *str) { return (const tchar *)str; } -inline tstring wideToTStr(const std::wstring &str) { return (const tstring &)str; } -inline tstring mbcsToTStr(const char *str) { return (const tstring &)mbcsToWide(str); } -inline tstring mbcsToTStr(const std::string &str) { return (const tstring &)mbcsToWide(str); } -#define nlUtf8ToTStr(str) (NLMISC::utf8ToTStr(str).c_str()) -#define nlWideToTStr(str) ((const tchar *)NLMISC::asCStr(str)) -#define nlMbcsToTStr(str) (NLMISC::mbcsToTStr(str).c_str()) -#else -typedef std::string tstring; -typedef char tchar; -inline std::string tStrToUtf8(const tchar *str) { return mbcsToUtf8((const char *)str); } -inline std::string tStrToUtf8(const tstring &str) { return mbcsToUtf8((const std::string &)str); } -inline std::wstring tStrToWide(const tchar *str) { return mbcsToWide((const char *)str); } -inline std::wstring tStrToWide(const tstring &str) { return mbcsToWide((const std::string &)str); } -inline std::string tStrToMbcs(const tchar *str) { return (const char *)str; } -inline std::string tStrToMbcs(const tstring &str) { return (const std::string &)str; } -#if defined(NL_OS_WINDOWS) -#define nlTStrToUtf8(str) (NLMISC::tStrToUtf8(str).c_str()) -#else -#define nlTStrToUtf8(str) ((const char *)NLMISC::asCStr(str)) -#endif -#define nlTStrToWide(str) (NLMISC::tStrToWide(str).c_str()) -#define nlTStrToMbcs(str) ((const char *)NLMISC::asCStr(str)) -inline tstring utf8ToTStr(const char *str) { return (const tstring &)utf8ToMbcs(str); } -inline tstring utf8ToTStr(const std::string &str) { return (const tstring &)utf8ToMbcs(str); } -inline tstring wideToTStr(const wchar_t *str) { return (const tstring &)wideToMbcs(str); } -inline tstring wideToTStr(const std::wstring &str) { return (const tstring &)wideToMbcs(str); } -inline tstring mbcsToTStr(const char *str) { return (const tchar *)str; } -inline tstring mbcsToTStr(const std::string &str) { return (const tstring &)str; } -#if defined(NL_OS_WINDOWS) -#define nlUtf8ToTStr(str) (NLMISC::utf8ToTStr(str).c_str()) -#else -#define nlUtf8ToTStr(str) ((const tchar *)NLMISC::asCStr(str)) -#endif -#define nlWideToTStr(str) (NLMISC::wideToTStr(str).c_str()) -#define nlMbcsToTStr(str) ((const tchar *)NLMISC::asCStr(str)) -#endif - -} // NLMISC - -#endif // NL_STRING_COMMON_H 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/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/client_cfg.cpp b/code/ryzom/client/src/client_cfg.cpp deleted file mode 100644 index 055260673..000000000 --- a/code/ryzom/client/src/client_cfg.cpp +++ /dev/null @@ -1,2362 +0,0 @@ -// Ryzom - MMORPG Framework -// Copyright (C) 2010-2019 Winch Gate Property Limited -// -// This source file has been modified by the following contributors: -// Copyright (C) 2010 Robert TIMM (rti) -// Copyright (C) 2010-2019 Jan BOON (Kaetemi) -// Copyright (C) 2011-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 // -///////////// -#include "stdpch.h" -// Misc. -#include "nel/misc/config_file.h" -#include "nel/misc/bit_mem_stream.h" -#include "nel/misc/i18n.h" -#include "nel/misc/cmd_args.h" -// Client. -#include "client_cfg.h" -#include "entities.h" -#include "cursor_functions.h" -#include "debug_client.h" -#include "view.h" // For the cameraDistance funtion -#include "user_entity.h" -#include "misc.h" -#include "user_agent.h" - -// 3D Interface. -#include "nel/3d/u_driver.h" -#include "nel/3d/u_scene.h" -// Game Share. -#include "game_share/time_weather_season/time_and_season.h" - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#ifdef NL_OS_MAC -#include "app_bundle_utils.h" -#endif // NL_OS_MAC - -/////////// -// MACRO // -/////////// -//----------------------------------------------- -/// Macro to read a Bool from the CFG. -/// variableName : Variable Name to Read and Set. -//----------------------------------------------- -#define _READ_BOOL(variableName) \ - /* Read the Variable Value From Script */ \ - varPtr = ClientCfg.ConfigFile.getVarPtr(#variableName); \ - /* Value found, set the Variable */ \ - if(varPtr) \ - ClientCfg.variableName = varPtr->asInt() ? true : false; \ - /* Use the Default Value */ \ - else \ - cfgWarning("CFG: Default value used for '"#variableName"' !!!"); \ - -//----------------------------------------------- -/// Macro to read an Int from the CFG. -/// variableName : Variable Name to Read and Set. -//----------------------------------------------- -#define _READ_INT(variableName) \ - /* Read the Variable Value From Script */ \ - varPtr = ClientCfg.ConfigFile.getVarPtr(#variableName); \ - /* Value found, set the Variable */ \ - if(varPtr) \ - ClientCfg.variableName = varPtr->asInt(); \ - /* Use the Default Value */ \ - else \ - cfgWarning("CFG: Default value used for '"#variableName"' !!!"); \ - -//----------------------------------------------- -/// Macro to read a Float from the CFG. -/// variableName : Variable Name to Read and Set. -//----------------------------------------------- -#define _READ_FLOAT(variableName) \ - /* Read the Variable Value From Script */ \ - varPtr = ClientCfg.ConfigFile.getVarPtr(#variableName); \ - /* Value found, set the Variable */ \ - if(varPtr) \ - ClientCfg.variableName = varPtr->asFloat(); \ - /* Use the Default Value */ \ - else \ - cfgWarning("CFG: Default value used for '"#variableName"' !!!"); \ - -//----------------------------------------------- -/// Macro to read a Float from the CFG. -/// cfgVariableName : Variable Name to Read. -/// variableName : Variable Name to Set. -//----------------------------------------------- -#define _READ_FLOAT2(cfgVariableName,variableName) \ - /* Read the Variable Value From Script */ \ - varPtr = ClientCfg.ConfigFile.getVarPtr(#cfgVariableName); \ - /* Value found, set the Variable */ \ - if(varPtr) \ - ClientCfg.variableName = varPtr->asFloat(); \ - /* Use the Default Value */ \ - else \ - cfgWarning("CFG: Default value used for '"#cfgVariableName"' !!!"); \ - -//----------------------------------------------- -/// Macro to read a Double from the CFG. -/// variableName : Variable Name to Read and Set. -//----------------------------------------------- -#define _READ_DOUBLE(variableName) \ - /* Read the Variable Value From Script */ \ - varPtr = ClientCfg.ConfigFile.getVarPtr(#variableName); \ - /* Value found, set the Variable */ \ - if(varPtr) \ - ClientCfg.variableName = varPtr->asDouble(); \ - /* Use the Default Value */ \ - else \ - cfgWarning("CFG: Default value used for '"#variableName"' !!!"); \ - -//----------------------------------------------- -/// Macro to read a String from the CFG. -/// variableName : Variable Name to Read and Set. -//----------------------------------------------- -#define _READ_STRING(variableName) \ - /* Read the Variable Value From Script */ \ - varPtr = ClientCfg.ConfigFile.getVarPtr(#variableName); \ - /* Value found, set the Variable */ \ - if(varPtr) \ - ClientCfg.variableName = varPtr->asString(); \ - /* Use the Default Value */ \ - else \ - cfgWarning("CFG: Default value used for '"#variableName"' !!!"); \ - -//----------------------------------------------- -/// Macro to read a CVector from the CFG. -/// variableName : Variable Name to Read and Set. -//----------------------------------------------- -#define _READ_CVECTOR(variableName) \ - /* Read the Variable Value From Script */ \ - varPtr = ClientCfg.ConfigFile.getVarPtr(#variableName); \ - if(varPtr) \ - { \ - /* Check params */ \ - if(varPtr->size()==3) \ - { \ - ClientCfg.variableName.x = varPtr->asFloat(0); \ - ClientCfg.variableName.y = varPtr->asFloat(1); \ - ClientCfg.variableName.z = varPtr->asFloat(2); \ - } \ - else \ - cfgWarning("CFG: Bad params for '"#variableName"' !!!"); \ - } \ - else \ - cfgWarning("CFG: Default value used for '"#variableName"' !!!"); \ - - -//----------------------------------------------- -/// Macro to read an Enum, as int from the CFG. -/// variableName : Variable Name to Read and Set. -//----------------------------------------------- -#define _READ_ENUM_ASINT(type, variableName) \ - /* Read the Variable Value From Script */ \ - varPtr = ClientCfg.ConfigFile.getVarPtr(#variableName); \ - /* Value found, set the Variable */ \ - if(varPtr) \ - ClientCfg.variableName = (type)varPtr->asInt(); \ - /* Use the Default Value */ \ - else \ - cfgWarning("CFG: Default value used for '"#variableName"' !!!"); \ - -//----------------------------------------------- -/// Macro to read a String Vector from the CFG. -/// variableName : Variable Name to Read and Set. -//----------------------------------------------- -#define _READ_STRINGVECTOR(variableName) \ - /* Read the Variable Value From Script */ \ - varPtr = ClientCfg.ConfigFile.getVarPtr(#variableName); \ - /* Value found, set the Variable */ \ - if(varPtr) \ - { \ - ClientCfg.variableName.clear (); \ - int iSz = varPtr->size(); \ - ClientCfg.variableName.reserve(iSz); \ - for (int i = 0; i < iSz; i++) \ - ClientCfg.variableName.push_back(varPtr->asString(i)); \ - } \ - /* Use the Default Value */ \ - else \ - cfgWarning("CFG: Default value used for '"#variableName"' !!!"); \ - -//----------------------------------------------- -// Macro for the dev version -//----------------------------------------------- - -#if !FINAL_VERSION -#define READ_BOOL_DEV(variableName) _READ_BOOL(variableName) -#define READ_INT_DEV(variableName) _READ_INT(variableName) -#define READ_FLOAT_DEV(variableName) _READ_FLOAT(variableName) -#define READ_FLOAT2_DEV(cfgVariableName,variableName) _READ_FLOAT2(cfgVariableName,variableName) -#define READ_DOUBLE_DEV(variableName) _READ_DOUBLE(variableName) -#define READ_STRING_DEV(variableName) _READ_STRING(variableName) -#define READ_CVECTOR_DEV(variableName) _READ_CVECTOR(variableName) -#define READ_ENUM_ASINT_DEV(type, variableName) _READ_ENUM_ASINT(type, variableName) -#define READ_STRINGVECTOR_DEV(variableName) _READ_STRINGVECTOR(variableName) -#else // !FINAL_VERSION -#define READ_BOOL_DEV(variableName) -#define READ_INT_DEV(variableName) -#define READ_FLOAT_DEV(variableName) -#define READ_FLOAT2_DEV(cfgVariableName,variableName) -#define READ_DOUBLE_DEV(variableName) -#define READ_STRING_DEV(variableName) -#define READ_CVECTOR_DEV(variableName) -#define READ_ENUM_ASINT_DEV(type, variableName) -#define READ_STRINGVECTOR_DEV(variableName) -#endif // !FINAL_VERSION - -//----------------------------------------------- -// Macro for the dev & final version -//----------------------------------------------- - -#define READ_BOOL_FV(variableName) _READ_BOOL(variableName) -#define READ_INT_FV(variableName) _READ_INT(variableName) -#define READ_FLOAT_FV(variableName) _READ_FLOAT(variableName) -#define READ_FLOAT2_FV(cfgVariableName,variableName) _READ_FLOAT2(cfgVariableName,variableName) -#define READ_DOUBLE_FV(variableName) _READ_DOUBLE(variableName) -#define READ_STRING_FV(variableName) _READ_STRING(variableName) -#define READ_CVECTOR_FV(variableName) _READ_CVECTOR(variableName) -#define READ_ENUM_ASINT_FV(type, variableName) _READ_ENUM_ASINT(type, variableName) -#define READ_STRINGVECTOR_FV(variableName) _READ_STRINGVECTOR(variableName) - -/////////// -// USING // -/////////// -using namespace NLMISC; -using namespace NL3D; - - -//////////// -// GLOBAL // -//////////// -CClientConfig LastClientCfg; -CClientConfig ClientCfg; -const string ConfigFileName = "client.cfg"; - - -//////////// -// EXTERN // -//////////// -#ifndef RZ_NO_CLIENT -extern NL3D::UScene *Scene; -extern NL3D::UDriver *Driver; -extern CRyzomTime RT; -extern string Cookie; -extern string FSAddr; -#endif - -extern NLMISC::CCmdArgs Args; - -///////////// -// METHODS // -///////////// - -// diplay only one time warning "Default values...." -static bool DisplayCFGWarning= false; -static void cfgWarning(const char *s) -{ - if(DisplayCFGWarning) - nlwarning(s); -} - -//--------------------------------------------------- -// CClientConfig : -// Constructor. -//--------------------------------------------------- -CClientConfig::CClientConfig() -{ - IsInvalidated = false; - - TestBrowser = false; - Light = false; // Default is no client light version - SaveConfig = false; - - PositionX = 0; - PositionY = 0; - Frequency = 60; - - SkipIntro = false; - SelectCharacter = -1; // Default is no auto select - SelectedSlot = 0; // Default is slot 0 - - Windowed = false; // Default is windowed mode. - Width = 0; // Default Width for the window (0 = current screen resolution). - Height = 0; // Default Height for the window (0 = current screen resolution). - Depth = 32; // Default Bit per Pixel. - Driver3D = DrvAuto; // Select best driver depending on hardware. - Contrast = 0.f; // Default Monitor Contrast. - Luminosity = 0.f; // Default Monitor Luminosity. - Gamma = 0.f; // Default Monitor Gamma. - - InterfaceScale = 1.0f; // Resize UI - InterfaceScale_min = 0.8f; - InterfaceScale_max = 2.0f; - InterfaceScale_step = 0.05; - BilinearUI = true; - - WindowSnapInvert = false; - WindowSnapDistance = 10; - - VREnable = false; - VRDisplayDevice = "Auto"; - VRDisplayDeviceId = ""; - - Local = false; // Default is Net Mode. - FSHost = ""; // Default Host. - - TexturesInterface.push_back("texture_interfaces_v3_2x"); - TexturesInterfaceDXTC.push_back("texture_interfaces_dxtc_2x"); - - TexturesOutGameInterface.push_back("texture_interfaces_v3_outgame_ui"); - - TexturesLoginInterface.push_back("texture_interfaces_v3_login"); - - DisplayAccountButtons = true; - CreateAccountURL = RYZOM_CLIENT_CREATE_ACCOUNT_URL; // "https://open.ryzom.dev/ams/"; - EditAccountURL = RYZOM_CLIENT_EDIT_ACCOUNT_URL; // "https://open.ryzom.dev/ams/"; - ForgetPwdURL = RYZOM_CLIENT_FORGET_PASSWORD_URL; // "https://open.ryzom.dev/ams/"; - Position = CVector(0.f, 0.f, 0.f); // Default Position. - Heading = CVector(0.f, 1.f, 0.f); // Default Heading. - EyesHeight = 1.5f; // Default User Eyes Height. - Walk = 1.66f; // Default Velocity for the Walk. - Run = 6.0f; // Default Velocity for the Run. - Fly = 25.0f; // Default Velocity for the Fly. - DmWalk = 6.0f; // Default Velocity for the Walk in Ring/DM or Ring/Editor. - DmRun = 20.0f; // Default Velocity for the Run in Ring/DM or Ring/Editor. - - FlyAccel = 1000.f; // Default Acceleration for the fly, in m.s-2 - - AllowDebugCommands = false; // Add debug commands at startup - - ForceDeltaTime = 0; // Default ForceDeltaTime, disabled by default - - HardwareCursor = true; // Default HardwareCursor - HardwareCursorScale = 0.85f; - CursorSpeed = 1.f; // Default CursorSpeed - CursorAcceleration = 0; // Default CursorAcceleration - FreeLookSpeed = 0.001f; // Default FreeLookSpeed - FreeLookAcceleration = 0; // Default FreeLookAcceleration - FreeLookSmoothingPeriod = 0.f; // when in absolute mode, free look factor is used instead of speed, the mouse gives the absolute angle - FreeLookInverted = false; - FreeLookTablet = false; // Mouse reports absolute coordinates, so avoid mouse recentering - AutomaticCamera = true; - DblClickMode = true; // when in dbl click mode, a double click is needed to execute default contextual action - AutoEquipTool = true; // when true player will auto-equip last used weapon or forage tool when doing an action - - BGColor = CRGBA(100,100,255); // Default Background Color. - LandscapeTileNear = 50.0f; // Default Landscape Tile Near. - LandscapeThreshold = 1000.0f; // Default Landscape Threshold. - Vision = 500.f; // Player vision. - Vision_min = 200.f; // Player vision min. - Vision_max = 800.f; // Player vision max. - SkinNbMaxPoly = 40000; - FxNbMaxPoly = 10000; - Cloud = true; - CloudQuality = 160.0f; - CloudUpdate = 1; - NbMaxSkeletonNotCLod= 20; - CharacterFarClip = 200.f; - ScreenAspectRatio = 0.f; // Default commmon Screen Aspect Ratio (no relation with the resolution) - 0.f = auto - FoV = 75.f; // Default value for the FoV. - ForceDXTC = false; // Default is no DXTC Compression. - AnisotropicFilter = 0; // Default is disabled (-1 = maximum value, 0 = disabled, 1+ = enabled) - DivideTextureSizeBy2= false; // Divide texture by 2 - DisableVtxProgram = false; // Disable Hardware Vertex Program. - DisableVtxAGP = false; // Disable Hardware Vertex AGP. - DisableTextureShdr = false; // Disable Hardware Texture Shader. - MicroVeget = true; // Default is with MicroVeget. - MicroVegetDensity = 100.0f; - HDEntityTexture = false; - HDTextureInstalled = false; - Fog = true; // Fog is on by default - WaitVBL = false; - VideoMemory = 0; - - FXAA = true; - - Bloom = true; - SquareBloom = true; - DensityBloom = 255.f; - - GlobalWindPower = 0.10f; // Default is 0.25 - GlobalWindDirection = CVector(1,0,0); // Default direction is X>0 - - MovieShooterMemory = 0; // MovieShooter disabled - MovieShooterFramePeriod = 0.040f; // default is 25 fps - MovieShooterBlend = false; - MovieShooterFrameSkip = 0; // default not skip frame - MovieShooterPrefix = "shot_"; - - CameraRecorderPrefix = "cam_rec"; - CameraRecorderBlend = true; - - ScreenShotWidth = 0; - ScreenShotHeight = 0; - ScreenShotFullDetail = true; - ScreenShotZBuffer = false; - - MaxNumberOfTimedFXInstances = 20; - SelectionFX = "sfx_selection_mouseover.ps"; - MouseOverFX = "sfx_selection_mouseover.ps"; - SelectionFXSize = 0.8f; - -#if RZ_USE_PATCH - PatchWanted = true; -#else - PatchWanted = false; -#endif - - PatchUrl.clear(); - PatchletUrl.clear(); - PatchVersion.clear(); - - WebIgMainDomain = RYZOM_WEBIG_MAIN_URL; // https://open.ryzom.dev/" - WebIgTrustedDomains.push_back(RYZOM_WEBIG_TRUSTED_DOMAIN); // open.ryzom.dev - WebIgNotifInterval = 10; // time in minutes - - CurlMaxConnections = 5; - CurlCABundle.clear(); - - RingReleaseNotePath = WebIgMainDomain + "/app_releasenotes/index.php"; - ReleaseNotePath = WebIgMainDomain + "/app_releasenotes/index.php"; - - - /////////////// - // ANIMATION // - // With a bigger angle, rotation is animated. - AnimatedAngleThreshold = 25.0; // - BlendFrameNumber = 5; // - DestThreshold = 0.01; // Destination Threshold - PositionLimiterRadius = 0.1; - SignificantDist = 0.0001; // Significant Distance - /////////// - // SOUND // - SoundOn = true; // Default is with sound. - DriverSound = SoundDrvAuto; - SoundForceSoftwareBuffer = true; - SoundOutGameMusic = "main menu loop.ogg"; - SoundSFXVolume = 1.f; - SoundGameMusicVolume = 1.f; - SoundTPFade = 500; - EnableBackgroundMusicTimeConstraint = true; - - SoundPackedSheetPath= "data/sound/"; // Default path for sound packed sheets - SampleBankDir = "data/sound/samplebanks"; // Default path for samples - UserEntitySoundLevel = 0.5f; // Default volume for sound in 1st person - UseEax = true; // Default to use EAX; - UseADPCM = false; // Defualt to PCM sample, NO ADPCM - MaxTrack = 32; // DEfault to 32 track - - ColorShout = CRGBA(150,0,0,255); // Default Shout color. - ColorTalk = CRGBA(255,255,255,255); // Default Talk color. - - StreamedPackagePath = "stream"; - - // MP3 player - MediaPlayerDirectory = "music"; - MediaPlayerAutoPlay = false; - -// PreDataPath.push_back("data/gamedev/language/"); // Default Path for the language data - -// DataPath.push_back("data/"); // Default Path for the Data. -// DataPath.push_back("data_leveldesign/"); // Default Path for the Level Design Directory. -// DataPath.push_back("data_common/"); // Default Path for the Level Design Directory. - - DataPathNoRecurse.push_back("data_leveldesign/leveldesign/Game_Elem"); - - UpdatePackedSheetPath.push_back("data_leveldesign"); - - UpdatePackedSheet = false; // Update packed sheet if needed - - EndScreenTimeOut = 0.f; // Default time out for the screen at the end of the application. - Loading_BG = "loading_bg.tga"; // Default name for the loading background file. - LoadingFreeTrial_BG = "loading_free_trial_bg.tga"; // Default name for the loading background file in FreeTrial mode. - Launch_BG = "launcher_bg.tga"; // Default name for the launch background file. - TeleportKami_BG = "teleport_kami_bg.tga"; - TeleportKaravan_BG = "teleport_caravan_bg.tga"; - Elevator_BG = "elevator_bg.tga"; // Default name for the loading background file. - ResurectKami_BG = "resurect_kami_bg.tga"; - ResurectKaravan_BG = "resurect_caravane_bg.tga"; - End_BG = "end_bg.tga"; // Default name for the last background file. - IntroNevrax_BG = "launcher_nevrax.tga"; - IntroNVidia_BG = "launcher_nvidia.tga"; - - TipsY = 0.07f; - TeleportInfoY = 0.23f; - - SceneName = ""; - IdFilePath = "sheet_id.bin"; - PacsPrimDir.push_back("data/3d/"); - - Shadows = true; // Draw Shadows by default. - ShadowsClipFar = 10.f; // Shadows are disabled after this distance. - ShadowsLodDist = 3.f; // Shadows draw with just 1 part after this distance. - ShadowZDirClampLandscape = -0.5f; // On landscape, allow a minimum Phi angle of -30 degrees - ShadowZDirClampInterior = -0.86f; // On Interior, allow a minimum Phi angle of -60 degrees - ShadowZDirClampSmoothSpeed = 0.5f; - ShadowMaxDepthLandscape = 8.f; - ShadowMaxDepthInterior = 2.f; - ShadowMaxDepthSmoothSpeed = 6.f; - - - Names = false; // Don't draw Names by default. - - Sleep = -1; // Default : client does not sleep. - ProcessPriority = 0; // Default : NORMAL - CPUMask = 0; // Default : auto detection - ShowPath = false; // Default : do not display the path. - DrawBoxes = false; // Default : Do not draw the selection. - - UserSheet = "fyros.race_stats"; // Default sheet used. - Sex = GSGENDER::male; // Default : male. - - PrimitiveHeightAddition = 2.f; // Default : 2.f - - AttackDist = 0.5f; - RyzomDay = 0; - RyzomTime = 0.0f; - - ManualWeatherSetup = false; - - ChaseReactionTime = 0.4f; // Reaction time before chasing someone. - - TimeToAdjustCamera = 1000.0; - ChangeDirAngle = 1.70f; // Default Angle. - - GuildSymbolSize = 0.3f; // Default Guild Symbol Size. - SelectionDist = 150.f; // Default dist in meter. - SelectionOutBBoxWeight = 16.f; // Default factor - LootDist = 4.f; // Default loot/harvest distance (in meter). - SpaceSelectionDist = 50.f; - SpaceSelectionMaxCycle = 1; - - ForceLanguage = false; - LanguageCode = "en"; // Default to english - DebugStringManager = false; // Default to no debug - - // TUNING - WaterOffset = -1.085f; - FyrosWaterOffset = -1.0f; - MatisWaterOffset = -1.08f; - TrykerWaterOffset = -0.88f; - ZoraiWaterOffset = -1.25f; - WaterOffsetCreature = -1.6f; - TimeToRemoveCol = 1000; - MoveToTimeToStopStall = 500; - TPVMinPitch = -1.5f; - TPVMaxPitch = 1.5f; - MaxHeadTargetDist = 30.0f; - DeadFXName = "misc_dead.ps"; - ImpactFXName = "impact.ps"; - SkillUpFXName = "misc_levelup.ps"; - MinDistFactor = 0.5; - NameScale = 1.0f; // Default Scale to display Names. - NamePos = 0.02f; - NameFontSize = 20; - MaxNameDist = 50.0f; - ConstNameSizeDist = 20.0f; - StaticNameHeight = true; - BarsHeight = 0.002f; - BarsWidth = 0.05f; - FightAreaSize = 1.5; - BubbleZBias = -3.f; - ForageInterfaceZBias= -10.f; - FyrosScale = 1.0f; - MatisScale = 1.08f; - TrykerScale = 0.88f; - ZoraiScale = 1.25f; - EnableRacialAnimation = true; - - // OPTIONS - RunAtTheBeginning = true; - SelectWithRClick = false; // Default right click cannot select. - RotKeySpeedMax = 3.0f; - RotKeySpeedMin = 1.0f; - RotAccel = 0.001f; - PutBackItems = false; - ShowNameUnderCursor = true; - ShowNameSelected = true; - ShowNameBelowDistanceSqr = 20.f * 20.f; - ForceIndoorFPV = false; - FollowOnAtk = true; - AtkOnSelect = false; - TransparentUnderCursor = false; - ItemGroupAllowGuild = false; - // PREFERENCES - FPV = false; - CameraHeight = 2.5f; - CameraDistance = 3.0f; - CameraDistStep = 1.0f; - CameraDistMin = 1.0f; - CameraDistMax = 100.0f; - DmCameraDistMax = 25.0f; - CameraAccel = 0.2f; - CameraSpeedMin = 0.2f; - CameraSpeedMax = 1.0f; - CameraResetSpeed = 2.0f; - - MaxMapScale = 2.0f; - R2EDMaxMapScale = 8.0f; - - TargetChangeCompass = true; - - // VERBOSES - VerboseVP = false; - VerboseAnimUser = false; - VerboseAnimSelection = false; - VerboseAllTraffic = false; - - // DEBUG - DisplayMissingAnimFile = false; - DefaultEntity = "ccafb1.creature"; - RestrainPI = true; - DumpVSIndex = false; - HelpFontSize = 12; - HelpFontColor = CRGBA(255,255,255); - HelpLineStep = 0.025f; - DebugFontSize = 16; - DebugFontColor = CRGBA(250, 250, 250); - DebugLineStep = 0.02f; - HeadOffset = CVector(0.f, 0.f, 0.f); - Check = false; - BlendForward = true; - // - FPExceptions = false; // Disable Floating Point Exceptions. - DisplayWeapons = false; // Do not dusplay weapons in first person. - NeedComputeVS = false; // Do not need to compute Visual Slots. - // - GroundFXMaxDist = 40.f; - GroundFXMaxNB = 10; - GroundFXCacheSize = 10; - // - AutoReloadFiles = false; - BlendShapePatched = true; - ExtendedCommands = false; - - WaterEnvMapUpdateTime = 1.f; - - NumFrameForProfile = 0; - SimulateServerTick = false; - TimerMode= 0; - - KlientChatPort= ""; - - PreCacheShapes = true; - ResetShapeBankOnRetCharSelect = false; - LandscapeEnabled = true; - VillagesEnabled = true; - EAMEnabled = true; - CacheUIParsing = false; - MicroLifeEnabled = true; - - SkipEULA = false; - - StageLCTUsage= StageUsePosOnlyLCT; - - SimulatePacketLossRatio= 0; - - CheckMemoryEveryNFrame= -1; - LogMemoryAllocation=false; - LogMemoryAllocationSize=8; - - DamageShieldEnabled = false; - - LevelDesignEnabled = false; - - R2Mode = true; - R2EDEnabled = false; - R2EDExtendedDebug = false; - R2EDVerboseParseTime = false; - R2EDDontReparseUnchangedUIFiles = false; - R2EDLightPalette = false; - R2EDAutoSaveWait = 60*5; - R2EDAutoSaveSlot = 9; - R2EDMustVerifyRingAccessWhileLoadingAnimation = false; - R2EDUseVerboseRingAccess = false; - R2EDDssNetwork = 3; - - DamageShieldEnabled = false; - - AllowDebugLua = false; - DisplayLuaDebugInfo = false; - BeepWhenLaunched = false; - - - - LoadingStringCount = 0; - - LuaDebugInfoGotoButtonEnabled = false; - - FogDistAndDepthLookupBias = 0.f; - - R2EDLoadDynamicFeatures = 0; - - CheckR2ScenarioMD5 = true; - - DisplayTPReason = false; - - //TPCancelButtonX = 988; - //TPCancelButtonY = 138; - //TPQuitButtonX = 8; - //TPQuitButtonY = 138; - TPButtonW = 32; - TPButtonH = 32; - - //SAVE - ScenarioSavePath = "./my_scenarios/"; - - R2EDClippedEntityBlendTime = 0.18f; - - BackgroundDownloader = false; - -}// CClientConfig // - - -//--------------------------------------------------- -// load : -// Load the client config file. -//--------------------------------------------------- -void CClientConfig::setValuesOnFileChange() -{ - // ClientCfg.ConfigFile.print (InfoLog); - - // display an info only when the file change - nlinfo ("reloading the config file!"); - - setValues(); -} - -//--------------------------------------------------- -// load : -// Load the client config file. -//--------------------------------------------------- -void CClientConfig::setValues() -{ - CConfigFile::CVar *varPtr = 0; - static bool firstTimeSetValues= true; - - ////////////////////// - // INTERFACE CONFIG // - // input files - READ_STRING_FV(XMLInputFile) - - - READ_BOOL_FV(SkipIntro); - READ_BOOL_DEV(SkipEULA); - READ_INT_DEV(SelectCharacter); - - READ_INT_FV(SelectedSlot); - if( ClientCfg.SelectedSlot>4 ) - { - ClientCfg.SelectedSlot = 0; - } - - // interface textures login menus - READ_STRINGVECTOR_FV(TexturesLoginInterface); - READ_STRINGVECTOR_FV(TexturesLoginInterfaceDXTC); - - // interface textures outgame menus - READ_STRINGVECTOR_FV(TexturesOutGameInterface); - READ_STRINGVECTOR_FV(TexturesOutGameInterfaceDXTC); - - // interface textures ingame and r2 - //READ_STRINGVECTOR_FV(TexturesInterface); - //READ_STRINGVECTOR_FV(TexturesInterfaceDXTC); - - // interface files login menus - READ_STRINGVECTOR_FV(XMLLoginInterfaceFiles); - - // interface files outgame menus - READ_STRINGVECTOR_FV(XMLOutGameInterfaceFiles); - - // interface files - READ_STRINGVECTOR_FV(XMLInterfaceFiles); - - // r2ed interfaces - READ_STRINGVECTOR_FV(XMLR2EDInterfaceFiles); - - // logos - READ_STRINGVECTOR_FV(Logos); - - // browser test mode - READ_BOOL_DEV(TestBrowser); - READ_STRING_DEV(TestBrowserUrl); - - // ClientLight -#if !FINAL_VERSION - varPtr = ClientCfg.ConfigFile.getVarPtr ("ClientLight"); - if (varPtr) - ClientCfg.Light = varPtr->asInt() ? true : false; -#endif // !FINAL_VERSION - - - READ_BOOL_DEV(LandscapeEnabled) - READ_BOOL_DEV(VillagesEnabled) - READ_BOOL_DEV(EAMEnabled) - READ_BOOL_DEV(CacheUIParsing) - READ_BOOL_DEV(MicroLifeEnabled) - - READ_BOOL_DEV(LevelDesignEnabled) - - /////////////////// - // WINDOW CONFIG // - // Mode. - - // SaveConfig - READ_BOOL_FV(SaveConfig) - - // Window Positon - READ_INT_FV(PositionX) - READ_INT_FV(PositionY) - - // Window frequency - READ_INT_FV(Frequency) - - CConfigFile::CVar *pcvFullScreen = ClientCfg.ConfigFile.getVarPtr("FullScreen"); - if( pcvFullScreen ) - { - ClientCfg.Windowed = pcvFullScreen->asInt() ? false : true; - } - else - cfgWarning("Default value used for 'Fullscreen'"); - // Width - READ_INT_FV(Width) - // Height - READ_INT_FV(Height) - // Depth : Bit Per Pixel - READ_INT_FV(Depth) - // Contrast - READ_FLOAT_FV(Contrast) - // Luminosity - READ_FLOAT_FV(Luminosity) - // Gamma - READ_FLOAT_FV(Gamma) - // UI scaling - READ_FLOAT_FV(InterfaceScale); - READ_FLOAT_FV(InterfaceScale_min); - READ_FLOAT_FV(InterfaceScale_max); - READ_FLOAT_FV(InterfaceScale_step); - clamp(ClientCfg.InterfaceScale, ClientCfg.InterfaceScale_min, ClientCfg.InterfaceScale_max); - READ_BOOL_FV(BilinearUI); - READ_BOOL_FV(WindowSnapInvert); - READ_INT_FV(WindowSnapDistance); - // 3D Driver - varPtr = ClientCfg.ConfigFile.getVarPtr ("Driver3D"); - if (varPtr) - { - if (nlstricmp(varPtr->asString(), "Auto") == 0 || nlstricmp(varPtr->asString(), "0") == 0) ClientCfg.Driver3D = CClientConfig::DrvAuto; - else if (nlstricmp(varPtr->asString(), "OpenGL") == 0 || nlstricmp(varPtr->asString(), "1") == 0) ClientCfg.Driver3D = CClientConfig::OpenGL; - else if (nlstricmp(varPtr->asString(), "Direct3D") == 0 || nlstricmp(varPtr->asString(), "2") == 0) ClientCfg.Driver3D = CClientConfig::Direct3D; - else if (nlstricmp(varPtr->asString(), "OpenGLES") == 0 || nlstricmp(varPtr->asString(), "3") == 0) ClientCfg.Driver3D = CClientConfig::OpenGLES; - } - else - cfgWarning ("Default value used for 'Driver3D' !!!"); - - READ_BOOL_FV(VREnable) - READ_STRING_FV(VRDisplayDevice) - READ_STRING_FV(VRDisplayDeviceId) - - //////////// - // INPUTS // - READ_BOOL_FV(HardwareCursor) - READ_FLOAT_FV(HardwareCursorScale) - READ_FLOAT_FV(CursorSpeed) - READ_INT_FV(CursorAcceleration) - READ_FLOAT_FV(FreeLookSpeed) - READ_INT_FV(FreeLookAcceleration) - READ_FLOAT_FV(FreeLookSmoothingPeriod) - READ_BOOL_FV(FreeLookInverted) - READ_BOOL_FV(FreeLookTablet) - READ_BOOL_FV(AutomaticCamera) - READ_BOOL_FV(DblClickMode) - READ_BOOL_FV(AutoEquipTool) - - ///////// - // NET // -#if !FINAL_VERSION - // Local : local mode or network mode - READ_BOOL_DEV(Local) -#endif // FINAL_VERSION - // FSHost - READ_STRING_FV(FSHost) - - READ_BOOL_DEV(DisplayAccountButtons) - - - READ_STRING_FV(CreateAccountURL) - READ_STRING_FV(EditAccountURL) - READ_STRING_FV(ForgetPwdURL) - - READ_STRING_DEV(BetaAccountURL) - READ_STRING_DEV(FreeTrialURL) - - // defined in client_default.cfg - READ_STRING_FV(LoginSupportURL) - - // read NamingPolicyURL from client_default.cfg - //READ_STRING_FV(NamingPolicyURL) - - std::string languageCo = "wk"; - CConfigFile::CVar *languageCodeVarPtr = ClientCfg.ConfigFile.getVarPtr("LanguageCode"); - - if (languageCodeVarPtr) - { - languageCo = languageCodeVarPtr->asString(); - } - - CConfigFile::CVar *policyurl = ClientCfg.ConfigFile.getVarPtr("NamingPolicyURL"); - - if (policyurl) - { - for (uint i = 0; i < policyurl->size(); ++i) - { - std::string entry = policyurl->asString(i); - if (entry.size() >= languageCo.size()) - { - if (nlstricmp(entry.substr(0, languageCo.size()), languageCo) == 0) - { - std::string::size_type pos = entry.find("="); - - if (pos != std::string::npos) - { - ClientCfg.NamingPolicyURL = entry.substr(pos + 1); - } - } - } - } - } - - // read NamingPolicyURL from client_default.cfg - //READ_STRING_FV(ConditionsTermsURL) - CConfigFile::CVar *coturl = ClientCfg.ConfigFile.getVarPtr("ConditionsTermsURL"); - - if (coturl) - { - for (uint i = 0; i < coturl->size(); ++i) - { - std::string entry = coturl->asString(i); - - if (entry.size() >= languageCo.size()) - { - if (nlstricmp(entry.substr(0, languageCo.size()), languageCo) == 0) - { - std::string::size_type pos = entry.find("="); - - if (pos != std::string::npos) - { - ClientCfg.ConditionsTermsURL = entry.substr(pos + 1); - } - } - } - } - } - - -#ifndef RZ_NO_CLIENT - // if cookie is not empty, it means that the client was launch - // by the nel_launcher, so it can't be local - if(!Cookie.empty()) - { - nlassert (!FSAddr.empty()); - ClientCfg.Local = false; - } - else - { - nlassert (FSAddr.empty()); - } -#endif - - ///////////////// - // USER ENTITY // - READ_CVECTOR_DEV(Position) - READ_CVECTOR_DEV(Heading) - // EyesHeight - READ_FLOAT_DEV(EyesHeight) - - // Walk - READ_FLOAT_DEV(Walk) - // Run - READ_FLOAT_DEV(Run) - - //When editing or Dm ing a session in ring mode the player move quicker - // DM Walk - READ_FLOAT_DEV(DmWalk) - // DM Run - READ_FLOAT_DEV(DmRun) - - - - // Fly - READ_FLOAT_DEV(Fly) - READ_FLOAT_DEV(FlyAccel) - - READ_BOOL_FV(AllowDebugCommands) - - // ForceDeltaTime - READ_INT_DEV(ForceDeltaTime) - - //////////// - // RENDER // - // Background Color -#if !FINAL_VERSION - CConfigFile::CVar *pcvBackColor = ClientCfg.ConfigFile.getVarPtr("Background"); - if( pcvBackColor && (pcvBackColor->size()==3) ) - { - ClientCfg.BGColor.R = pcvBackColor->asInt(0); - ClientCfg.BGColor.G = pcvBackColor->asInt(1); - ClientCfg.BGColor.B = pcvBackColor->asInt(2); - ClientCfg.BGColor.A = 255; - } - else - cfgWarning("Default value used for 'Background'"); -#endif // !FINAL_VERSION - // LandscapeTileNear - READ_FLOAT_FV(LandscapeTileNear) - // LandscapeThreshold - READ_FLOAT_FV(LandscapeThreshold) - // to be backward compatible, suppose a value<1 is for the old System!!! => invert it! - if( ClientCfg.LandscapeThreshold<1) - { - ClientCfg.LandscapeThreshold= 1.f/ ClientCfg.LandscapeThreshold; - // must re-write in the CFG database, to be ok with the in-game configurator - varPtr = ClientCfg.ConfigFile.getVarPtr("LandscapeThreshold"); - if(varPtr) - varPtr->forceAsDouble(ClientCfg.LandscapeThreshold); - } - // Vision - READ_FLOAT_FV(Vision) - READ_FLOAT_FV(Vision_min) - READ_FLOAT_FV(Vision_max) - // SkinNbMaxPoly - READ_INT_FV(SkinNbMaxPoly) - // FxNbMaxPoly - READ_INT_FV(FxNbMaxPoly) - READ_BOOL_FV(Cloud) - READ_FLOAT_FV(CloudQuality) - READ_INT_FV(CloudUpdate) - // NbMaxSkeletonNotCLod - READ_INT_FV(NbMaxSkeletonNotCLod) - // CharacterFarClip - READ_FLOAT_FV(CharacterFarClip) - - // Bloom - READ_BOOL_FV(Bloom) - READ_BOOL_FV(SquareBloom) - READ_FLOAT_FV(DensityBloom) - - // FXAA - READ_BOOL_FV(FXAA) - - // ScreenAspectRatio. - READ_FLOAT_FV(ScreenAspectRatio) - // FoV. - READ_FLOAT_FV(FoV) - // ForceDXTC - READ_BOOL_FV(ForceDXTC) - // AnisotropicFilter - READ_INT_FV(AnisotropicFilter) - // DivideTextureSizeBy2 - READ_BOOL_FV(DivideTextureSizeBy2) - // DisableVtxProgram - READ_BOOL_FV(DisableVtxProgram) - // DisableVtxAGP - READ_BOOL_FV(DisableVtxAGP) - // DisableTextureShdr - READ_BOOL_FV(DisableTextureShdr) - // MicroVeget - READ_BOOL_FV(MicroVeget) - // MicroVeget Density - READ_FLOAT_FV(MicroVegetDensity) - // GlobalWindPower: Global Wind Power - READ_FLOAT_DEV(GlobalWindPower) - // Global Wind Direction - READ_CVECTOR_DEV(GlobalWindDirection) - // HDEntityTexture - READ_BOOL_FV(HDEntityTexture) - // HDTextureInstalled - READ_BOOL_FV(HDTextureInstalled) - - // Fog - READ_BOOL_DEV(Fog) - - // WaitVBL - READ_BOOL_FV(WaitVBL) - // VideoMemory - READ_INT_FV(VideoMemory); - - READ_INT_DEV(TimerMode) - - // MovieShooterMemory - CConfigFile::CVar *pcv = ClientCfg.ConfigFile.getVarPtr("MovieShooterMemory"); - if( pcv ) - { - ClientCfg.MovieShooterMemory = pcv->asInt(); - // Transform to octet - ClientCfg.MovieShooterMemory *= 1024*1024; - } - else - cfgWarning("'MovieShooterMemory' not found => MovieShooter Disabled"); - // MovieShooterPath - READ_STRING_FV(MovieShooterPath) - // MovieShooterFramePeriod - READ_FLOAT_FV(MovieShooterFramePeriod) - // MovieShooterBlend - READ_BOOL_FV(MovieShooterBlend) - // MovieShooterFrameSkip - READ_INT_FV(MovieShooterFrameSkip) - - // Camera Recorder - READ_STRING_FV(CameraRecorderPath) - READ_STRING_FV(CameraRecorderPrefix) - READ_BOOL_FV(CameraRecorderBlend) - - // Screenshot - READ_INT_FV(ScreenShotWidth) - READ_INT_FV(ScreenShotHeight) - READ_BOOL_FV(ScreenShotFullDetail) - READ_BOOL_FV(ScreenShotZBuffer) - - ///////////////////////// - // NEW PATCHING SYSTEM // - READ_BOOL_FV(PatchWanted) - -#ifdef RZ_USE_CUSTOM_PATCH_SERVER - READ_STRING_FV(PatchUrl) - READ_STRING_FV(PatchVersion) - READ_STRING_FV(RingReleaseNotePath) - READ_STRING_FV(ReleaseNotePath) -#else - READ_STRING_DEV(PatchUrl) - READ_STRING_DEV(PatchVersion) - READ_STRING_DEV(RingReleaseNotePath) - READ_STRING_DEV(ReleaseNotePath) -#endif - - ///////////////////////// - // NEW PATCHLET SYSTEM // - READ_STRING_FV(PatchletUrl) - - /////////// - // WEBIG // - READ_STRING_FV(WebIgMainDomain); - if (ClientCfg.WebIgMainDomain.find("http://") == std::string::npos - || ClientCfg.WebIgMainDomain.find("https://") == std::string::npos) - ClientCfg.WebIgMainDomain = "http://" + ClientCfg.WebIgMainDomain; - READ_STRINGVECTOR_FV(WebIgTrustedDomains); - READ_INT_FV(WebIgNotifInterval); - READ_INT_FV(CurlMaxConnections); - if (ClientCfg.CurlMaxConnections < 0) - ClientCfg.CurlMaxConnections = 2; - - READ_STRING_FV(CurlCABundle); - if (!ClientCfg.CurlCABundle.empty() && ClientCfg.CurlCABundle[0] == '%') // Path is relative to client_default.cfg path (used by ryzom patch) - { - string defaultConfigFileName; - if (ClientCfg.getDefaultConfigLocation(defaultConfigFileName)) - ClientCfg.CurlCABundle = CFile::getPath(defaultConfigFileName)+ClientCfg.CurlCABundle.substr(1); - } - - /////////////// - // ANIMATION // - // AnimatedAngleThreshold - READ_DOUBLE_DEV(AnimatedAngleThreshold) - // BlendFrameNumber - READ_INT_DEV(BlendFrameNumber) - // DestThreshold - READ_DOUBLE_DEV(DestThreshold) - // PositionLimiterRadius - READ_DOUBLE_DEV(PositionLimiterRadius) - // SignificantDist - READ_DOUBLE_DEV(SignificantDist) - // Stage LCT usage - READ_ENUM_ASINT_DEV(TStageLCTUsage, StageLCTUsage) - - //////////// - // TUNING // - // Water Offset - READ_FLOAT_DEV(WaterOffset) - -#if !FINAL_VERSION - READ_FLOAT_DEV(FyrosWaterOffset) - READ_FLOAT_DEV(MatisWaterOffset) - READ_FLOAT_DEV(TrykerWaterOffset) - READ_FLOAT_DEV(ZoraiWaterOffset) -#endif // FINAL_VERSION - - // Water Offset for creature - READ_FLOAT_DEV(WaterOffsetCreature) - // TimeToRemoveCol - READ_INT_DEV(TimeToRemoveCol) - // MoveToTimeToStopStall - READ_INT_DEV(MoveToTimeToStopStall) - // TimeToAdjustCamera - READ_DOUBLE_DEV(TimeToAdjustCamera) - // ChangeDirAngle - READ_DOUBLE_DEV(ChangeDirAngle) - // GuildSymbolSize - READ_FLOAT_DEV(GuildSymbolSize) - // SelectionDist - READ_FLOAT_DEV(SelectionDist) - // SelectionOutBBoxWeight - READ_FLOAT_DEV(SelectionOutBBoxWeight) - // LootDist - READ_FLOAT_DEV(LootDist) - // SpaceSelectionDist - READ_FLOAT_DEV(SpaceSelectionDist) - // SpaceSelectionMaxCycle - READ_INT_DEV(SpaceSelectionMaxCycle) - // Third Person View Min Pitch. - READ_FLOAT_DEV(TPVMinPitch) - // Third Person View Max Pitch. - READ_FLOAT_DEV(TPVMaxPitch) - // The character look at the target before this distance. - READ_FLOAT_DEV(MaxHeadTargetDist) - // FX played when dead - READ_STRING_DEV(DeadFXName) - // FX played for each impact - READ_STRING_DEV(ImpactFXName) - // FX Played at skill up - READ_STRING_DEV(SkillUpFXName) - // MinDistFactor - READ_DOUBLE_DEV(MinDistFactor) - // NameScale - READ_FLOAT_DEV(NameScale) - // NamePos - READ_FLOAT_DEV(NamePos) - // NameFontSize - READ_INT_DEV(NameFontSize) - // MaxNameDist - READ_FLOAT_DEV(MaxNameDist) - // ConstNameSizeDist - READ_FLOAT_DEV(ConstNameSizeDist) - // StaticNameHeight - READ_BOOL_FV(StaticNameHeight) - // BarsHeight - READ_FLOAT_DEV(BarsHeight) - // BarsWidth - READ_FLOAT_DEV(BarsWidth) - // DisplayWeapons - READ_BOOL_FV(DisplayWeapons) - // FightAreaSize - READ_DOUBLE_DEV(FightAreaSize) - // AttackDist - READ_FLOAT_DEV(AttackDist) - // BubbleZBias - READ_FLOAT_DEV(BubbleZBias); - // ForageInterfaceZBias - READ_FLOAT_DEV(ForageInterfaceZBias); - - // EnableRacialAnimation - READ_BOOL_FV(EnableRacialAnimation); - -#if !FINAL_VERSION - READ_FLOAT_DEV(FyrosScale); - READ_FLOAT_DEV(MatisScale); - READ_FLOAT_DEV(TrykerScale); - READ_FLOAT_DEV(ZoraiScale); - -#endif // FINAL_VERSION - - ////////////////// - // SOUND CONFIG // - // SoundOn - READ_BOOL_FV(SoundOn) - // Sound Driver - varPtr = ClientCfg.ConfigFile.getVarPtr ("DriverSound"); - if (varPtr) - { - if (nlstricmp(varPtr->asString(), "Auto") == 0) ClientCfg.DriverSound = CClientConfig::SoundDrvAuto; - else if (nlstricmp(varPtr->asString(), "FMod") == 0) ClientCfg.DriverSound = CClientConfig::SoundDrvFMod; - else if (nlstricmp(varPtr->asString(), "OpenAL") == 0) ClientCfg.DriverSound = CClientConfig::SoundDrvOpenAL; - else if (nlstricmp(varPtr->asString(), "DirectSound") == 0) ClientCfg.DriverSound = CClientConfig::SoundDrvDirectSound; - else if (nlstricmp(varPtr->asString(), "XAudio2") == 0) ClientCfg.DriverSound = CClientConfig::SoundDrvXAudio2; - } - else - cfgWarning ("Default value used for 'DriverSound' !!!"); - // SoundForceSoftwareBuffer - READ_BOOL_FV(SoundForceSoftwareBuffer); - // SoundOutGameMusic - READ_STRING_DEV(SoundOutGameMusic) - // SoundSFXVolume - READ_FLOAT_FV(SoundSFXVolume); - // SoundGameMusicVolume - READ_FLOAT_FV(SoundGameMusicVolume); - // SoundTPFade - READ_INT_DEV(SoundTPFade); - // EnableBackgroundMusicTimeConstraint - READ_BOOL_DEV(EnableBackgroundMusicTimeConstraint); - // SoundPackedSheetPath - READ_STRING_DEV(SoundPackedSheetPath) - // SampleBankDir - READ_STRING_DEV(SampleBankDir) - // UserEntitySoundLevel : UserEntity sound level - READ_FLOAT_FV(UserEntitySoundLevel) - // Use EAX - READ_BOOL_FV(UseEax) - // UseADPCM - READ_BOOL_DEV(UseADPCM) - // Max track - READ_INT_FV(MaxTrack) - - // MP3 Player - READ_STRING_FV(MediaPlayerDirectory); - READ_BOOL_FV(MediaPlayerAutoPlay); - - ///////////////// - // USER COLORS // - // Shout Color - CConfigFile::CVar *pcvColorShout = ClientCfg.ConfigFile.getVarPtr("ColorShout"); - if( pcvColorShout && (pcvColorShout->size() == 3) ) - { - ClientCfg.ColorShout.R = pcvColorShout->asInt(0); - ClientCfg.ColorShout.G = pcvColorShout->asInt(1); - ClientCfg.ColorShout.B = pcvColorShout->asInt(2); - ClientCfg.ColorShout.A = 255; - } - else - cfgWarning("Default value used for 'ColorShout'"); - - // Talk Color - CConfigFile::CVar *pcvColorTalk = ClientCfg.ConfigFile.getVarPtr("ColorTalk"); - if( pcvColorTalk && (pcvColorTalk->size() == 3) ) - { - ClientCfg.ColorTalk.R = pcvColorTalk->asInt(0); - ClientCfg.ColorTalk.G = pcvColorTalk->asInt(1); - ClientCfg.ColorTalk.B = pcvColorTalk->asInt(2); - ClientCfg.ColorTalk.A = 255; - } - else - cfgWarning("Default value used for 'ColorTalk'"); - - ////////// - // MISC // - - // Pre Data Path. - READ_STRINGVECTOR_FV(PreDataPath); - - // Data Path. - READ_STRINGVECTOR_FV(DataPath); - - // Data Path no recurse. - READ_STRINGVECTOR_FV(DataPathNoRecurse); - - // Streamed package path - READ_STRING_FV(StreamedPackagePath); - - // Streamed package hosts - READ_STRINGVECTOR_FV(StreamedPackageHosts); - - // List of files that trigger R2ED reload when touched - READ_STRINGVECTOR_FV(R2EDReloadFiles); - - // Update packed sheet Path - READ_STRINGVECTOR_FV(UpdatePackedSheetPath); - - // UpdatePackedSheet - READ_BOOL_DEV(UpdatePackedSheet) - - // EndScreenTimeOut - READ_FLOAT_DEV(EndScreenTimeOut) - // Backgrounds - READ_STRING_FV(Loading_BG) - READ_STRING_FV(LoadingFreeTrial_BG) - READ_STRING_FV(Launch_BG) - READ_STRING_FV(TeleportKami_BG) - READ_STRING_FV(TeleportKaravan_BG) - READ_STRING_FV(Elevator_BG) - READ_STRING_FV(ResurectKami_BG) - READ_STRING_FV(ResurectKaravan_BG) - READ_STRING_FV(End_BG) - READ_STRING_FV(IntroNevrax_BG) - READ_STRING_FV(IntroNVidia_BG) - - READ_FLOAT_DEV(TipsY) - READ_FLOAT_DEV(TeleportInfoY) - // SceneName - READ_STRING_DEV(SceneName) - // IdFile Path - READ_STRING_DEV(IdFilePath) - - // PacsPrimDir - READ_STRINGVECTOR_DEV(PacsPrimDir); - - ///////////// - // FILTERS // - createDebug (); - CConfigFile::CVar *pcvTmp = ClientCfg.ConfigFile.getVarPtr("NegFiltersDebug"); - if( pcvTmp ) - { - int iSz = pcvTmp->size(); - for(int k = 0; k < iSz; ++k) - { - DebugLog->addNegativeFilter (pcvTmp->asString(k).c_str()); - } - } - else - cfgWarning("Default value used for 'NegFiltersDebug'"); - - pcvTmp = ClientCfg.ConfigFile.getVarPtr("NegFiltersInfo"); - if( pcvTmp ) - { - int iSz = pcvTmp->size(); - for(int k = 0; k < iSz; ++k) - { - InfoLog->addNegativeFilter (pcvTmp->asString(k).c_str()); - } - } - else - cfgWarning("Default value used for 'NegFiltersInfo'"); - - pcvTmp = ClientCfg.ConfigFile.getVarPtr("NegFiltersWarning"); - if( pcvTmp ) - { - int iSz = pcvTmp->size(); - for(int k = 0; k < iSz; ++k) - { - WarningLog->addNegativeFilter (pcvTmp->asString(k).c_str()); - } - } - else - cfgWarning("Default value used for 'NegFiltersWarning'"); - - // Script Files - READ_STRINGVECTOR_FV(StartCommands); - - ///////////// - // OPTIONS // - // Colors for system infos - ClientCfg.SystemInfoParams.clear(); - CConfigFile::CVar *sic = ClientCfg.ConfigFile.getVarPtr("SystemInfoColors"); - if (!sic) - { - cfgWarning("Can't read SystemInfoColors, all colors defaulting to white"); - } - else - { - if (sic->size() & 1) - { - cfgWarning("Expecting odd size for SystemInfoColors. Last entry ignored."); - } - uint numCol = sic->size() >> 1; - for(uint k = 0; k < numCol; ++k) - { - uint r, g, b, a; - char mode[64]; - char fx[64]; - fx[0]='\0'; - if (sscanf(sic->asString((2 * k) + 1).c_str(), "%d %d %d %d %s %s", &r, &g, &b, &a, mode, fx) < 5) - { - if(DisplayCFGWarning) - nlwarning("Can't parse color for entry %s", sic->asString(2 * k).c_str()); - } - else - { - SSysInfoParam p; - - p.Color = CRGBA(r, g, b, a); - p.Mode = SSysInfoParam::Normal; - p.SysInfoFxName = string(fx); - if (stricmp(mode, "over") == 0) p.Mode = SSysInfoParam::Over; - else if (stricmp(mode, "overonly") == 0) p.Mode = SSysInfoParam::OverOnly; - else if (stricmp(mode, "center") == 0) p.Mode = SSysInfoParam::Center; - else if (stricmp(mode, "centeraround") == 0) p.Mode = SSysInfoParam::CenterAround; - else if (stricmp(mode, "around") == 0) p.Mode = SSysInfoParam::Around; - - ClientCfg.SystemInfoParams[toLower(sic->asString(2 * k))] = p; - } - } - } - -#ifndef RZ_NO_CLIENT - // printf commands in loading screens - ClientCfg.loadingTexts.clear(); - CConfigFile::CVar *pc = ClientCfg.ConfigFile.getVarPtr("loadingTexts"); - if (pc) - { - if( pc->size()%5 == 0 && pc->size() >= 5) - { - for (uint i = 0; i < pc->size(); i+=5) - { - SPrintfCommand pcom; - pcom.X = pc->asInt(i); - pcom.Y = pc->asInt(i+1); - pcom.Color = CRGBA::stringToRGBA( pc->asString(i+2).c_str() ); - pcom.FontSize = pc->asInt(i+3); - pcom.Text = pc->asString(i+4); - - ClientCfg.loadingTexts.push_back( pcom ); - } - } - else - { - cfgWarning("Missing or too many parameters in loadingTexts"); - } - } -#endif - - READ_INT_FV(LoadingStringCount) - - // DEBUG MEMORY - READ_INT_DEV(CheckMemoryEveryNFrame) - READ_BOOL_DEV(LogMemoryAllocation) - READ_INT_DEV(LogMemoryAllocationSize) - - // SelectWithRClick - READ_BOOL_FV(SelectWithRClick) - READ_BOOL_DEV(RunAtTheBeginning) - READ_FLOAT_FV(RotKeySpeedMax) - READ_FLOAT_FV(RotKeySpeedMin) - READ_FLOAT_FV(RotAccel) - READ_BOOL_DEV(PutBackItems) - READ_BOOL_DEV(ShowNameUnderCursor) - READ_BOOL_DEV(ShowNameSelected) - READ_FLOAT_DEV(ShowNameBelowDistanceSqr) - READ_BOOL_DEV(ForceIndoorFPV) - READ_BOOL_FV(FollowOnAtk); - READ_BOOL_FV(AtkOnSelect); - READ_BOOL_DEV(TransparentUnderCursor); - // - READ_BOOL_FV(ItemGroupAllowGuild); - - - ///////////////// - // PREFERENCES // - // Read the view mode at load time only, cause prefer keep ingame player setup - if(firstTimeSetValues) - { - READ_BOOL_FV(FPV) - } - READ_FLOAT_FV(CameraDistStep) - READ_FLOAT_FV(CameraDistMin) - READ_FLOAT_FV(CameraDistMax) - READ_FLOAT_FV(DmCameraDistMax) - READ_FLOAT_FV(CameraAccel) - READ_FLOAT_FV(CameraSpeedMin) - READ_FLOAT_FV(CameraSpeedMax) - READ_FLOAT_FV(CameraResetSpeed) - // Read the camera height and distance at load time only, cause prefer keep ingame player setup - if(firstTimeSetValues) - { - READ_FLOAT_FV(CameraHeight) - READ_FLOAT_FV(CameraDistance) - } - - // Default values for CGroupMap - READ_FLOAT_FV(MaxMapScale); - READ_FLOAT_FV(R2EDMaxMapScale); - - // /tar to update compass or not - READ_BOOL_FV(TargetChangeCompass); - - ///////////// - // SHADOWS // - // Shadows : Get Shadows state - READ_BOOL_FV(Shadows) - // ShadowsClipFar : Get Shadows Clip Far. - READ_FLOAT_DEV(ShadowsClipFar) - // ShadowsLodDist : Get Shadows Lod Distance. - READ_FLOAT_DEV(ShadowsLodDist) - // ZClamp - READ_FLOAT_DEV(ShadowZDirClampLandscape); - READ_FLOAT_DEV(ShadowZDirClampInterior); - READ_FLOAT_DEV(ShadowZDirClampSmoothSpeed); - // MaxDepth - READ_FLOAT_DEV(ShadowMaxDepthLandscape); - READ_FLOAT_DEV(ShadowMaxDepthInterior); - READ_FLOAT_DEV(ShadowMaxDepthSmoothSpeed); - - - //////////////// - // GROUND FXS // - //////////////// - READ_FLOAT_DEV(GroundFXMaxDist) - READ_INT_DEV(GroundFXMaxNB) - READ_INT_DEV(GroundFXCacheSize) - - // Names : Get Names state - READ_BOOL_FV(Names) - // Sleep - READ_INT_FV(Sleep) - // ProcessPriority - READ_INT_FV(ProcessPriority) - // CPUMask - READ_INT_FV(CPUMask) - // ShowPath : Get the ShowPath value. - READ_BOOL_DEV(ShowPath) - // UserSheet : Get the sheet to used for the use rin Local mode. - READ_STRING_DEV(UserSheet) -#if !FINAL_VERSION - // Sex - varPtr = ClientCfg.ConfigFile.getVarPtr("Sex"); - if(varPtr) - ClientCfg.Sex = (GSGENDER::EGender)varPtr->asInt(); - else - cfgWarning("Default value used for 'Sex' !!!"); -#endif // FINAL_VERSION - // PrimitiveHeightAddition - READ_BOOL_DEV(PrimitiveHeightAddition) - // DrawBoxes - READ_BOOL_DEV(DrawBoxes) - - - // ChaseReactionTime - READ_FLOAT_DEV(ChaseReactionTime) - // RyzomTime - READ_FLOAT_DEV(RyzomTime) - // RyzomDay - READ_INT_DEV(RyzomDay) - // ManualWeatherSetup - READ_BOOL_DEV(ManualWeatherSetup) - // LanguageCode - READ_BOOL_DEV(ForceLanguage) - if (!ClientCfg.ForceLanguage) - { - READ_STRING_FV(LanguageCode) - } - // DebugStringManager - READ_BOOL_DEV(DebugStringManager) - - // LastLogin - READ_STRING_FV(LastLogin) - - ////////////// - // VERBOSES // - READ_BOOL_DEV(VerboseVP) - READ_BOOL_DEV(VerboseAnimUser) - READ_BOOL_DEV(VerboseAnimSelection) - READ_BOOL_DEV(VerboseAllTraffic) - - READ_STRING_DEV(LigoPrimitiveClass); - - /////////// - // DEBUG // - READ_INT_DEV(SimulatePacketLossRatio) - READ_BOOL_DEV(PreCacheShapes) - READ_BOOL_FV(ResetShapeBankOnRetCharSelect) - READ_BOOL_DEV(DisplayMissingAnimFile) - READ_STRING_DEV(DefaultEntity) - READ_BOOL_DEV(RestrainPI) - READ_BOOL_DEV(DumpVSIndex) - READ_INT_DEV(HelpFontSize) -#if !FINAL_VERSION - // HelpFontColor - { - CConfigFile::CVar *cvHelpFontColor = ClientCfg.ConfigFile.getVarPtr("HelpFontColor"); - if(cvHelpFontColor && cvHelpFontColor->size() == 3) - { - ClientCfg.HelpFontColor.R = cvHelpFontColor->asInt(0); - ClientCfg.HelpFontColor.G = cvHelpFontColor->asInt(1); - ClientCfg.HelpFontColor.B = cvHelpFontColor->asInt(2); - ClientCfg.HelpFontColor.A = 255; - } - else - cfgWarning("Default value used for 'HelpFontColor' !!!"); - } -#endif // !FINAL_VERSION - // HelpLineStep - READ_FLOAT_DEV(HelpLineStep) - - READ_INT_DEV(DebugFontSize) -#if !FINAL_VERSION - // DebugFontColor - CConfigFile::CVar *pcvDebugFontColor = ClientCfg.ConfigFile.getVarPtr("DebugFontColor"); - if( pcvDebugFontColor && (pcvDebugFontColor->size() == 3) ) - { - ClientCfg.DebugFontColor.R = pcvDebugFontColor->asInt(0); - ClientCfg.DebugFontColor.G = pcvDebugFontColor->asInt(1); - ClientCfg.DebugFontColor.B = pcvDebugFontColor->asInt(2); - ClientCfg.DebugFontColor.A = 255; - } - else - cfgWarning("Default value used for 'DebugFontColor'"); -#endif // !FINAL_VERSION - READ_FLOAT_DEV(DebugLineStep) - - // HeadOffset - READ_CVECTOR_DEV(HeadOffset) - READ_BOOL_DEV(FPExceptions) - READ_BOOL_DEV(NeedComputeVS) - READ_BOOL_DEV(Check) - READ_BOOL_DEV(UsePACSForAll) - READ_FLOAT_DEV(WaterEnvMapUpdateTime) - READ_BOOL_DEV(BlendForward) - - ClientCfg.ZCPacsPrim = "gen_bt_col_ext.pacs_prim"; - READ_STRING_DEV(ZCPacsPrim) - - READ_BOOL_FV(AutoReloadFiles) - READ_BOOL_DEV(BlendShapePatched) - - READ_INT_DEV(MaxNumberOfTimedFXInstances); - - READ_STRING_DEV(SelectionFX); - READ_STRING_DEV(MouseOverFX); - READ_FLOAT_DEV(SelectionFXSize); - - if(ClientCfg.ConfigFile.exists("ExtendedCommands") && ClientCfg.ConfigFile.getVar("ExtendedCommands").asString() == "Enable") - ClientCfg.ExtendedCommands = true; - - - READ_BOOL_DEV(R2Mode); - if (ClientCfg.Local) // R2EDEnabled is now set by the server - { - READ_BOOL_DEV(R2EDEnabled) - } - READ_INT_FV(R2EDDssNetwork) - - - if (ClientCfg.Local) - { - ClientCfg.R2EDDssNetwork = 1; - } - - READ_BOOL_DEV(R2EDExtendedDebug) - #if FINAL_VERSION - { - CConfigFile::CVar *var = ClientCfg.ConfigFile.getVarPtr("R2EDExtendedDebug"); - if (var) - { - var->setAsInt(0); - } - // else no-op -> will resolve to 'nil' into lua - } - #endif - - - READ_BOOL_DEV(R2EDVerboseParseTime) - READ_BOOL_DEV(R2EDDontReparseUnchangedUIFiles) - READ_BOOL_DEV(R2EDLightPalette) - READ_INT_FV(R2EDAutoSaveWait) - READ_INT_FV(R2EDAutoSaveSlot) - READ_BOOL_DEV(R2EDMustVerifyRingAccessWhileLoadingAnimation) - READ_BOOL_FV(R2EDUseVerboseRingAccess) - - - - ////////// - // TEMP // - // Array with the name of all offensive impact FXs. - READ_STRINGVECTOR_DEV(OffImpactFX); - -#ifndef RZ_NO_CLIENT - - ////////// - // INIT // - // FPU -#ifdef NL_OS_WINDOWS - if(ClientCfg.FPExceptions) - _control87(_EM_DENORMAL/*|_EM_INVALID|_EM_ZERODIVIDE|_EM_OVERFLOW*/|_EM_UNDERFLOW|_EM_INEXACT, _MCW_EM); - else - _control87(_EM_INVALID|_EM_DENORMAL|_EM_ZERODIVIDE|_EM_OVERFLOW|_EM_UNDERFLOW|_EM_INEXACT, _MCW_EM); - - // Set the process priority - static DWORD priority[6]= - { - 0x40, // IDLE_PRIORITY_CLASS - 0x4000, // BELOW_NORMAL_PRIORITY_CLASS - 0x20, // NORMAL_PRIORITY_CLASS - 0x8000, // ABOVE_NORMAL_PRIORITY_CLASS - 0x80, // HIGH_PRIORITY_CLASS - 0x100, // REALTIME_PRIORITY_CLASS - }; - - int index = ClientCfg.ProcessPriority+2; - clamp(index, 0, 6); - SetPriorityClass (GetCurrentProcess(), priority[index]); -#endif // NL_OS_WINDOWS - - // Init Verbose Modes (at the beginning to be able to display them as soon as possible). - ::VerboseVP = ClientCfg.VerboseVP; - ::VerboseAnimUser = ClientCfg.VerboseAnimUser; - ::VerboseAnimSelection = ClientCfg.VerboseAnimSelection; -#ifdef LOG_ALL_TRAFFIC - NLMISC::VerboseAllTraffic = ClientCfg.VerboseAllTraffic; -#endif - - // (re-)Initialize contextual cursors. - if (!ClientCfg.R2EDEnabled) - { - initContextualCursor(); - } - - // Prim files - READ_STRINGVECTOR_DEV(PrimFiles); - - // Reset GlobalWind Setup - if(Scene) - { - Scene->setGlobalWindPower(ClientCfg.GlobalWindPower); - Scene->setGlobalWindDirection(ClientCfg.GlobalWindDirection); - } - - if (Driver) - { - // Set the monitor color properties - CMonitorColorProperties monitorColor; - for(uint i=0; i<3; i++) - { - monitorColor.Contrast[i] = ClientCfg.Contrast; - monitorColor.Luminosity[i] = ClientCfg.Luminosity; - monitorColor.Gamma[i] = ClientCfg.Gamma; - } - if(!Driver->setMonitorColorProperties(monitorColor)) - cfgWarning("reloadCFG: setMonitorColorProperties fails"); - } - - - // Show/hide all or parts of the user body. - if (UserEntity) - { - UserEntity->eyesHeight(ClientCfg.EyesHeight); - UserEntity->updateVisualDisplay(); - - // Run speed and camera dist max are set according to R2 char mode - UserEntity->flushR2CharMode(); - } - - // Initialize the camera distance (after camera dist max) - View.setCameraDistanceMaxForPlayer(); - - // draw in client light? - if(ClientCfg.Light) - { - ClientCfg.DrawBoxes = true; - ClientCfg.Names = true; - } - - // Set Day / Time - if (ClientCfg.Local) - { - uint32 tickOffset = (uint32)(ClientCfg.RyzomDay * RYZOM_HOURS_IN_TICKS * 24 + ClientCfg.RyzomTime * RYZOM_HOURS_IN_TICKS); - RT.resetTickOffset(); - RT.increaseTickOffset( tickOffset ); - } -#endif - - // for reset effect of variable in mainLoop(), set true - ClientCfg.IsInvalidated= true; - - // Allow warning display only first time. - DisplayCFGWarning= false; - - // If it is the load time, backup the ClientCfg into LastClientCfg - if(firstTimeSetValues) - LastClientCfg = ClientCfg; - - // no more true. - firstTimeSetValues= false; - - READ_INT_DEV(NumFrameForProfile); - READ_STRING_FV(KlientChatPort); - READ_BOOL_DEV(SimulateServerTick); - - READ_BOOL_DEV(DamageShieldEnabled) - - READ_BOOL_FV(AllowDebugLua) - READ_BOOL_FV(DisplayLuaDebugInfo) - - READ_BOOL_DEV(LuaDebugInfoGotoButtonEnabled) - READ_STRING_DEV(LuaDebugInfoGotoButtonTemplate) - READ_STRING_DEV(LuaDebugInfoGotoButtonCaption) - READ_STRING_DEV(LuaDebugInfoGotoButtonFunction) - - - READ_BOOL_DEV(BeepWhenLaunched) - - READ_STRING_DEV(R2ClientGw) - - READ_FLOAT_FV(FogDistAndDepthLookupBias) - - READ_INT_DEV(R2EDLoadDynamicFeatures) - - READ_BOOL_DEV(CheckR2ScenarioMD5); - - CConfigFile::CVar *pcvHardwareCursors = ClientCfg.ConfigFile.getVarPtr("HardwareCursors"); - if(pcvHardwareCursors) - { - ClientCfg.HardwareCursors.clear (); - int iSz = pcvHardwareCursors->size(); - for (int i = 0; i < iSz; i++) - ClientCfg.HardwareCursors.insert(toLower(pcvHardwareCursors->asString(i))); - } - else - { - cfgWarning("Default value used for 'HardwareCursors'"); - // default list of harware cursors - ClientCfg.HardwareCursors.insert("curs_can_pan.tga"); - ClientCfg.HardwareCursors.insert("curs_can_pan_dup.tga"); - ClientCfg.HardwareCursors.insert("curs_create.tga"); - ClientCfg.HardwareCursors.insert("curs_create_multi.tga"); - ClientCfg.HardwareCursors.insert("curs_create_vertex_invalid.tga"); - ClientCfg.HardwareCursors.insert("curs_default.tga"); - ClientCfg.HardwareCursors.insert("curs_dup.tga"); - ClientCfg.HardwareCursors.insert("curs_L.tga"); - ClientCfg.HardwareCursors.insert("curs_M.tga"); - ClientCfg.HardwareCursors.insert("curs_pan.tga"); - ClientCfg.HardwareCursors.insert("curs_pan_dup.tga"); - ClientCfg.HardwareCursors.insert("curs_pick.tga"); - ClientCfg.HardwareCursors.insert("curs_pick_dup.tga"); - ClientCfg.HardwareCursors.insert("curs_R.tga"); - ClientCfg.HardwareCursors.insert("curs_resize_BL_TR.tga"); - ClientCfg.HardwareCursors.insert("curs_resize_BR_TL.tga"); - ClientCfg.HardwareCursors.insert("curs_resize_LR.tga"); - ClientCfg.HardwareCursors.insert("curs_resize_TB.tga"); - ClientCfg.HardwareCursors.insert("curs_rotate.tga"); - ClientCfg.HardwareCursors.insert("curs_scale.tga"); - ClientCfg.HardwareCursors.insert("curs_stop.tga"); - ClientCfg.HardwareCursors.insert("text_cursor.tga"); - ClientCfg.HardwareCursors.insert("r2_hand_can_pan.tga"); - ClientCfg.HardwareCursors.insert("r2_hand_pan.tga"); - ClientCfg.HardwareCursors.insert("r2ed_tool_can_pick.tga"); - ClientCfg.HardwareCursors.insert("r2ed_tool_can_rotate.tga"); - ClientCfg.HardwareCursors.insert("r2ed_tool_pick.tga"); - ClientCfg.HardwareCursors.insert("r2ed_tool_rotate.tga"); - ClientCfg.HardwareCursors.insert("r2ed_tool_rotating.tga"); - } - - // languages and types of Ring Scenarii - READ_STRINGVECTOR_FV(ScenarioLanguages); - READ_STRINGVECTOR_FV(ScenarioTypes); - - // build name - READ_STRING_FV(BuildName) - - READ_BOOL_DEV(DisplayTPReason) - - //READ_INT_FV(TPQuitButtonX) - //READ_INT_FV(TPQuitButtonY) - //READ_INT_FV(TPCancelButtonX) - //READ_INT_FV(TPCancelButtonY) - READ_INT_FV(TPButtonW) - READ_INT_FV(TPButtonH) - - READ_STRING_FV(ScenarioSavePath) - - - ClientCfg.R2EDClippedEntityBlendTime = 0.18f; - READ_FLOAT_FV(R2EDClippedEntityBlendTime) - - // vl: BackgroundDownloader is hardcoded to false and we don't want to run it, even if the cfg wants it - //READ_BOOL_FV(BackgroundDownloader) - -}// load // - - -//----------------------------------------------- -// serial : -// Serialize CFG. -//----------------------------------------------- -void CClientConfig::serial(NLMISC::IStream &f) -{ - // Start the opening of a new node named ClientCFG. - f.xmlPush("ClientCFG"); - - f.xmlPushBegin("Light"); - f.xmlPushEnd(); - f.serial(Light); - f.xmlPop(); - - f.xmlPushBegin("Windowed"); - f.xmlPushEnd(); - f.serial(Windowed); - f.xmlPop(); - - f.xmlPushBegin("Width"); - f.xmlPushEnd(); - f.serial(Width); - f.xmlPop(); - - f.xmlPushBegin("Height"); - f.xmlPushEnd(); - f.serial(Height); - f.xmlPop(); - - f.xmlPushBegin("Depth"); - f.xmlPushEnd(); - f.serial(Depth); - f.xmlPop(); - - f.xmlPushBegin("Contrast"); - f.xmlPushEnd(); - f.serial(Contrast); - f.xmlPop(); - - f.xmlPushBegin("Luminosity"); - f.xmlPushEnd(); - f.serial(Luminosity); - f.xmlPop(); - - f.xmlPushBegin("Gamma"); - f.xmlPushEnd(); - f.serial(Gamma); - f.xmlPop(); - - - f.xmlPushBegin("AttackDist"); - f.xmlPushEnd(); - f.serial(AttackDist); - f.xmlPop(); - - // SelectWithRClick - f.xmlPushBegin("SelectWithRClick"); - f.xmlPushEnd(); - f.serial(SelectWithRClick); - f.xmlPop(); - - // Close the serial for the Client CFG. - f.xmlPop(); -}// serial // - - -//----------------------------------------------- -// init : -//----------------------------------------------- -void CClientConfig::init(const string &configFileName) -{ - // if the users client config does not exist - if(!CFile::fileExists(configFileName)) - { - // create the basic .cfg - FILE *fp = nlfopen(configFileName, "w"); - - if (fp == NULL) - nlerror("CFG::init: Can't create config file '%s'", configFileName.c_str()); - else - nlwarning("CFG::init: creating '%s' with default values", configFileName.c_str ()); - - // get current locale - std::string lang = CI18N::getSystemLanguageCode(); - - const std::vector &languages = CI18N::getLanguageCodes(); - - // search if current locale is defined in language codes - for(uint i = 0; i < languages.size(); ++i) - { - if (lang == languages[i]) - { - // store the language code in the config file - fprintf(fp, "LanguageCode = \"%s\";\n", lang.c_str()); - break; - } - } - - fclose(fp); - } - - // read the exising config file (don't parse it yet!) - ucstring content; - NLMISC::CI18N::readTextFile(configFileName, content); - std::string contentUtf8 = content.toUtf8(); - - // while there are "RootConfigFilename" values, remove them - size_t pos = 0; - while((pos = contentUtf8.find("RootConfigFilename")) != configFileName.npos) - { - size_t endOfLine = contentUtf8.find("\n", pos); - contentUtf8.erase(pos, (endOfLine - pos) + 1); - } - - // get current location of the root config file (client_default.cfg) - std::string defaultConfigLocation; - if(!getDefaultConfigLocation(defaultConfigLocation)) - nlerror("cannot find client_default.cfg"); - - // and store it in the RootConfigFilename value in the very first line - contentUtf8.insert(0, std::string("RootConfigFilename = \"") + - defaultConfigLocation + "\";\n"); - - // save the updated config file - NLMISC::COFile configFile(configFileName, false, true, false); - configFile.serialBuffer((uint8*)contentUtf8.c_str(), (uint)contentUtf8.size()); - configFile.close(); - - // now we can continue loading and parsing the config file - - // if the config file will be modified, it calls automatically the function setValuesOnFileChange() - ClientCfg.ConfigFile.setCallback (CClientConfig::setValuesOnFileChange); - - // load the config files - ClientCfg.ConfigFile.load (configFileName); - - CConfigFile::CVar *pCV; - // check language code is supported - pCV = ClientCfg.ConfigFile.getVarPtr("LanguageCode"); - if (pCV) - { - std::string lang = pCV->asString(); - if (!CI18N::isLanguageCodeSupported(lang)) - { - nlinfo("Unsupported language code \"%s\" fallback on default", lang.c_str()); - // fallback to default language - ClientCfg.LanguageCode = CI18N::getSystemLanguageCode(); - // update ConfigFile variable - pCV->setAsString(ClientCfg.LanguageCode); - ClientCfg.ConfigFile.save(); - } - } - - // update the ConfigFile variable in the config file - pCV = ClientCfg.ConfigFile.getVarPtr("ClientVersion"); - if (pCV) - { - std::string str = pCV->asString (); - if (str != getVersion() && ClientCfg.SaveConfig) - { - nlinfo ("Update and save the ClientVersion variable in config file %s -> %s", str.c_str(), getVersion().c_str()); - pCV->setAsString(getVersion()); - ClientCfg.ConfigFile.save(); - } - } - else - nlwarning ("There's no ClientVersion variable in the config file!"); - -}// init // - - -//----------------------------------------------- -// init : -//----------------------------------------------- -void CClientConfig::release () -{ -#ifndef RZ_NO_CLIENT - // Do we have to save the cfg file ? - if (ClientCfg.SaveConfig) - { - // Save values - try - { - CConfigFile::CVar *varPtr = NULL; - - // Driver still alive ? - if (Driver && Driver->isActive ()) - { - sint32 x, y; - uint32 width, height; - - Driver->getWindowPos(x, y); - Driver->getWindowSize(width, height); - - // Are we in window mode ? - if (ClientCfg.Windowed /* && !isWindowMaximized() */) - { - // Save windows position. width/height are saved when leaving ingame. - writeInt("PositionX", x); - writeInt("PositionY", y); - } - } - - // Save if in FPV or TPV. - writeBool("FPV", ClientCfg.FPV); - - // Save the camera distance - writeDouble("CameraDistance", ClientCfg.CameraDistance); - } - catch (const Exception &e) - { - nlwarning ("Error while set config file variables : %s", e.what ()); - } - - // Save it - ClientCfg.ConfigFile.save (); - } -#endif -} - -bool CClientConfig::readBool (const std::string &varName) -{ - bool bVal = false; - CConfigFile::CVar *varPtr = ConfigFile.getVarPtr(varName); - if(varPtr) - bVal = varPtr->asInt() ? true : false; - else - nlwarning("CFG: Default value used for '%s' !!!",varName.c_str()); - return bVal; -} - -void CClientConfig::writeBool (const std::string &varName, bool bVal, bool bForce) -{ - CConfigFile::CVar *varPtr = bForce ? ConfigFile.insertVar(varName, CConfigFile::CVar()):ConfigFile.getVarPtr(varName); - if(varPtr) - varPtr->forceAsInt(bVal ? 1:0); - else - nlwarning("CFG: Default value used for '%s' !!!",varName.c_str()); -} - -sint32 CClientConfig::readInt (const std::string &varName) -{ - sint32 bVal = 0; - CConfigFile::CVar *varPtr = ConfigFile.getVarPtr(varName); - if(varPtr) - bVal = varPtr->asInt(); - else - nlwarning("CFG: Default value used for '%s' !!!",varName.c_str()); - return bVal; -} - -void CClientConfig::writeInt (const std::string &varName, sint32 bVal, bool bForce) -{ - CConfigFile::CVar *varPtr = bForce ? ConfigFile.insertVar(varName, CConfigFile::CVar()):ConfigFile.getVarPtr(varName); - if(varPtr) - varPtr->forceAsInt(bVal); - else - nlwarning("CFG: Default value used for '%s' !!!",varName.c_str()); -} - -double CClientConfig::readDouble (const std::string &varName) -{ - double bVal = 0; - CConfigFile::CVar *varPtr = ConfigFile.getVarPtr(varName); - if(varPtr) - bVal = varPtr->asDouble(); - else - nlwarning("CFG: Default value used for '%s' !!!",varName.c_str()); - return bVal; -} - -void CClientConfig::writeDouble (const std::string &varName, double dVal, bool bForce) -{ - CConfigFile::CVar *varPtr = bForce ? ConfigFile.insertVar(varName, CConfigFile::CVar()):ConfigFile.getVarPtr(varName); - if(varPtr) - varPtr->forceAsDouble(dVal); - else - nlwarning("CFG: Default value used for '%s' !!!",varName.c_str()); -} - -string CClientConfig::readString (const std::string &varName) -{ - string sVal; - CConfigFile::CVar *varPtr = ConfigFile.getVarPtr(varName); - if(varPtr) - sVal = varPtr->asString(); - else - nlwarning("CFG: Default value used for '%s' !!!",varName.c_str()); - return sVal; -} - -void CClientConfig::writeString (const std::string &varName, const std::string &strVal, bool bForce) -{ - CConfigFile::CVar *varPtr = bForce ? ConfigFile.insertVar(varName, CConfigFile::CVar()):ConfigFile.getVarPtr(varName); - if(varPtr) - varPtr->forceAsString(strVal); - else - nlwarning("CFG: Default value used for '%s' !!!",varName.c_str()); -} - -// *************************************************************************** -bool CClientConfig::readBoolNoWarning(const std::string &varName) -{ - bool bVal = false; - CConfigFile::CVar *varPtr = ConfigFile.getVarPtr(varName); - if(varPtr) - bVal = varPtr->asInt() ? true : false; - return bVal; -} - -sint32 CClientConfig::readIntNoWarning(const std::string &varName) -{ - sint32 bVal = 0; - CConfigFile::CVar *varPtr = ConfigFile.getVarPtr(varName); - if(varPtr) - bVal = varPtr->asInt(); - return bVal; -} - -double CClientConfig::readDoubleNoWarning(const std::string &varName) -{ - double bVal = 0; - CConfigFile::CVar *varPtr = ConfigFile.getVarPtr(varName); - if(varPtr) - bVal = varPtr->asDouble(); - return bVal; -} - -// *************************************************************************** -float CClientConfig::getActualLandscapeThreshold() const -{ - // The threshold to set in landscape is the inverse of the CFG one - return 1.0f/LandscapeThreshold; -} - -// *************************************************************************** -string CClientConfig::getHtmlLanguageCode() const -{ - if(LanguageCode=="wk") - return "en"; - else - return LanguageCode; -} - -// *************************************************************************** -ucstring CClientConfig::buildLoadingString( const ucstring& ucstr ) const -{ - if( LoadingStringCount > 0 ) - { - uint index = rand()%LoadingStringCount; - string tipId = "uiLoadingString"+toString(index); - ucstring randomUCStr = CI18N::get(tipId); - return randomUCStr; - } - else - return ucstr; -} - -// *************************************************************************** -bool CClientConfig::getDefaultConfigLocation(std::string& p_name) const -{ - std::string defaultConfigFileName = "client_default.cfg"; - std::string defaultConfigPath; - - p_name.clear(); - -#ifdef NL_OS_MAC - // on mac, client_default.cfg should be searched in .app/Contents/Resources/ - defaultConfigPath = getAppBundlePath() + "/Contents/Resources/"; -#else - // unders Windows or Linux, search client_default.cfg is same directory as executable - defaultConfigPath = Args.getProgramPath(); -#endif - - std::string currentPath = CPath::standardizePath(CPath::getCurrentPath()); - std::string etcPath = CPath::standardizePath(getRyzomEtcPrefix()); - - // look in the current working directory first - if (CFile::isExists(currentPath + defaultConfigFileName)) - p_name = currentPath + defaultConfigFileName; - - // look in startup directory - else if (CFile::isExists(Args.getStartupPath() + defaultConfigFileName)) - p_name = Args.getStartupPath() + defaultConfigFileName; - - // look in application directory - else if (CFile::isExists(defaultConfigPath + defaultConfigFileName)) - p_name = defaultConfigPath + defaultConfigFileName; - - // look in etc prefix path - else if (!etcPath.empty() && CFile::isExists(etcPath + defaultConfigFileName)) - p_name = etcPath + defaultConfigFileName; - - // if some client_default.cfg was found return true - return !p_name.empty(); -} diff --git a/code/ryzom/client/src/connection.cpp b/code/ryzom/client/src/connection.cpp deleted file mode 100644 index f57238991..000000000 --- a/code/ryzom/client/src/connection.cpp +++ /dev/null @@ -1,3693 +0,0 @@ -// Ryzom - MMORPG Framework -// Copyright (C) 2010-2019 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) -// Copyright (C) 2014-2019 Jan BOON (Kaetemi) -// -// 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 . - - - - -////////////// -// Includes // -////////////// -#include "stdpch.h" - -// Misc. -#include "nel/misc/i18n.h" -#include "nel/misc/path.h" -#include "nel/misc/time_nl.h" -#include "nel/misc/algo.h" -#include "nel/misc/system_utils.h" -#include "nel/misc/stream.h" -// 3D Interface. -#include "nel/3d/u_driver.h" -#include "nel/3d/u_text_context.h" -#include "nel/3d/stereo_display.h" -// Game Share -//#include "game_share/gd_time.h" // \todo GUIGUI : TO DELETE/CHANGE -#include "game_share/gender.h" -#include "game_share/character_summary.h" -#include "game_share/roles.h" -#include "game_share/character_title.h" -#include "game_share/shard_names.h" -#include "game_share/utils.h" -#include "game_share/bg_downloader_msg.h" - -// Std. -#include -// Client -#include "connection.h" -#include "nel/gui/action_handler.h" -#include "sound_manager.h" -#include "input.h" -#include "login.h" -#include "login_progress_post_thread.h" - -#include "client_cfg.h" -#include "actions_client.h" -#include "user_entity.h" -#include "time_client.h" -#include "net_manager.h" -#include "string_manager_client.h" -#include "far_tp.h" -#include "movie_shooter.h" - -// Interface part -#include "interface_v3/interface_manager.h" -#include "interface_v3/character_3d.h" -#include "nel/gui/ctrl_button.h" -#include "interface_v3/input_handler_manager.h" -#include "nel/gui/group_editbox.h" -#include "nel/gui/interface_expr.h" -#include "init_main_loop.h" -#include "continent_manager.h" -#include "interface_v3/group_quick_help.h" -#include "nel/gui/dbgroup_combo_box.h" - -#include "r2/dmc/client_edition_module.h" -#include "r2/editor.h" -#include "game_share/scenario.h" -#include "session_browser_impl.h" - -#include "bg_downloader_access.h" -#include "main_loop.h" - -#include "misc.h" - - -//////////////// -// Namespaces // -//////////////// -using namespace NLMISC; -using namespace NL3D; -using namespace NLNET; -using namespace std; -using namespace RSMGR; -using namespace R2; - - - -///////////// -// Externs // -///////////// -extern uint32 Version; // Client Version. -extern UDriver *Driver; -extern UTextContext *TextContext; -extern bool game_exit; - -extern CSoundManager *SoundMngr; - -extern bool serverReceivedReady; -extern CContinentManager ContinentMngr; - -extern bool MovieShooterSaving; -extern void endMovieShooting(); -extern void replayMovieShooting(); -extern void saveMovieShooting(); -extern void displaySpecialTextProgress(const char *text); -extern bool InitMouseWithCursor(bool hardware); - -extern bool SetMousePosFirstTime; - -///////////// -// Globals // initialization occurs in the function : connection -///////////// -bool userChar; -bool noUserChar; -bool ConnectInterf; -bool CreateInterf; -bool CharacterInterf; -TTime UniversalTime; -std::vector CharacterSummaries; -std::string UsedFSAddr; -std::string UserPrivileges; -uint8 ServerPeopleActive = 255; -uint8 ServerCareerActive = 255; - -bool WaitServerAnswer; -bool CharNameValidArrived; -bool CharNameValid; -string CharNameValidDBLink; -uint8 PlayerSelectedSlot = 0; -string PlayerSelectedFileName; -TSessionId PlayerSelectedMainland= (TSessionId)0; // This is the mainland selected at the SELECT perso!! -ucstring PlayerSelectedHomeShardName; -ucstring PlayerSelectedHomeShardNameWithParenthesis; -extern std::string CurrentCookie; - - -ucstring NewKeysCharNameWanted; // name of the character for which a new keyset must be created -ucstring NewKeysCharNameValidated; -std::string GameKeySet = "keys.xml"; -std::string RingEditorKeySet = "keys_r2ed.xml"; - -string ScenarioFileName; -sint LoginCharsel = -1; - -std::string ImportCharacter; - -static const char *KeySetVarName = "BuiltInKeySets"; - -#define GROUP_LIST_CHARACTER "ui:outgame:charsel_import:import_list" -#define GROUP_LIST_MAINLAND "ui:outgame:appear_mainland:mainland_list" -#define GROUP_LIST_KEYSET "ui:outgame:appear_keyset:keyset_list" -vector Mainlands; -TSessionId MainlandSelected = (TSessionId)0; // This is the mainland selected at the CREATE perso!! - -// This is the home session (mainland) of the selected character -TSessionId CharacterHomeSessionId = (TSessionId)0; - - -bool PatchBegun = false; - -// \todo GUIGUI : USE TRANSPORT CLASS. -// SVersionAnswer versionAnswer; - - -// Finite State Machine : all the states before entering the game -// ------------------------------------------------------------------------------------------------ -TInterfaceState globalMenu(); - - -bool hasPrivilegeDEV() { return (UserPrivileges.find(":DEV:") != std::string::npos); } -bool hasPrivilegeSGM() { return (UserPrivileges.find(":SGM:") != std::string::npos); } -bool hasPrivilegeGM() { return (UserPrivileges.find(":GM:") != std::string::npos); } -bool hasPrivilegeVG() { return (UserPrivileges.find(":VG:") != std::string::npos); } -bool hasPrivilegeSG() { return (UserPrivileges.find(":SG:") != std::string::npos); } -bool hasPrivilegeG() { return (UserPrivileges.find(":G:") != std::string::npos); } -bool hasPrivilegeEM() { return (UserPrivileges.find(":EM:") != std::string::npos); } -bool hasPrivilegeEG() { return (UserPrivileges.find(":EG:") != std::string::npos); } -bool hasPrivilegeOBSERVER() { return (UserPrivileges.find(":OBSERVER:") != std::string::npos); } -bool hasPrivilegeTESTER() { return (UserPrivileges.find(":TESTER:") != std::string::npos); } - - -// Restore the video mode (fullscreen for example) after the connection (done in a window) -void connectionRestoreVideoMode () -{ - // Setup full screen if we have to - UDriver::CMode mode; - Driver->getCurrentScreenMode(mode); - - if (mode.Windowed) - { - uint32 width, height; - Driver->getWindowSize(width, height); - mode.Width = width; - mode.Height = height; - } - - // don't allow sizes smaller than 1024x768 - if (ClientCfg.Width < 1024) ClientCfg.Width = 1024; - if (ClientCfg.Height < 768) ClientCfg.Height = 768; - - if (StereoDisplay) - StereoDisplayAttached = StereoDisplay->attachToDisplay(); - - if (!StereoDisplayAttached && ( - (ClientCfg.Windowed != mode.Windowed) || - (ClientCfg.Width != mode.Width) || - (ClientCfg.Height != mode.Height))) - { - mode.Windowed = ClientCfg.Windowed; - mode.Depth = uint8(ClientCfg.Depth); - mode.Width = ClientCfg.Width; - mode.Height = ClientCfg.Height; - mode.Frequency = ClientCfg.Frequency; - setVideoMode(mode); - } - - // And setup hardware mouse if we have to - InitMouseWithCursor (ClientCfg.HardwareCursor && !StereoDisplayAttached); - SetMouseFreeLook (); - SetMouseCursor (); - SetMouseSpeed (ClientCfg.CursorSpeed); - SetMouseAcceleration (ClientCfg.CursorAcceleration); - - // Restore user UI scaling - CViewRenderer::getInstance()->setInterfaceScale(ClientCfg.InterfaceScale); -} - - -#define UI_VARIABLES_SCREEN_WEBSTART 8 - - -// *************************************************************************** -// Called to reload the start test page in test browser mode -class CAHOnReloadTestPage: public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) - { - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - // need to reset password and current screen - CGroupHTML *pGH = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_BROWSER)); - - pGH->browse(ClientCfg.TestBrowserUrl.c_str()); - - } -}; -REGISTER_ACTION_HANDLER (CAHOnReloadTestPage, "on_reload_test_page"); - - -// ------------------------------------------------------------------------------------------------ -void setOutGameFullScreen() -{ - if (!ClientCfg.Local && ClientCfg.SelectCharacter == -1) - { - if (StereoDisplayAttached) - StereoDisplay->detachFromDisplay(); - StereoDisplayAttached = false; - - InitMouseWithCursor(ClientCfg.HardwareCursor && !StereoDisplayAttached); - } - - // Enable auto scaling in login window - CViewRenderer::getInstance()->setInterfaceScale(1.0f, 1024, 768); -} - - -// New version of the menu after the server connection -// -// If you add something in this function, check CFarTP, -// some kind of reinitialization might be useful over there. -// ------------------------------------------------------------------------------------------------ -bool connection (const string &cookie, const string &fsaddr) -{ - - NLMISC::TTime connStart = ryzomGetLocalTime(); - NLMISC::TTime connLast = connStart; - NLMISC::TTime connCurrent = connLast; - - game_exit = false; - - // set resolution from cfg after login - connectionRestoreVideoMode (); - - // Preload continents - { - const ucstring nmsg("Loading continents..."); - ProgressBar.newMessage (ClientCfg.buildLoadingString(nmsg) ); - ContinentMngr.preloadSheets(); - - connLast = connCurrent; - connCurrent = ryzomGetLocalTime(); - nlinfo ("PROFILE: %d seconds (%d total) for Loading continents", (uint32)(connCurrent-connLast)/1000, (uint32)(connCurrent-connStart)/1000); - } - - if (!fsaddr.empty () && !cookie.empty ()) - { - // it means that we have a nel_launcher values, so we are online - ClientCfg.Local = 0; - nlinfo ("Using the nel launcher parameters '%s' '%s'", cookie.c_str (), fsaddr.c_str ()); - } - - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - - // If the Client is in in Local Mode -> init the Time and return. - if (ClientCfg.Local) - { -#ifdef ENABLE_INCOMING_MSG_RECORDER - NetMngr.init("", ""); - // Set the impulse callback. - NetMngr.setImpulseCallback (impulseCallBack); - // Set the database. - NetMngr.setDataBase (IngameDbMngr.getNodePtr()); - // init the string manager cache. - STRING_MANAGER::CStringManagerClient::instance()->initCache("", ClientCfg.LanguageCode); // VOIR BORIS -#endif - return true; - } - - ProgressBar.setFontFactor(1.0f); - - // Init out game - setOutGameFullScreen(); - - ucstring nmsg("Initializing outgame..."); - ProgressBar.newMessage (ClientCfg.buildLoadingString(nmsg) ); - pIM->initOutGame(); - - connLast = connCurrent; - connCurrent = ryzomGetLocalTime(); - nlinfo ("PROFILE: %d seconds (%d total) for Initializing outgame", (uint32)(connCurrent-connLast)/1000, (uint32)(connCurrent-connStart)/1000); - - // Init user interface - nmsg = "Initializing user interface..."; - ProgressBar.newMessage (ClientCfg.buildLoadingString(nmsg) ); - - // Hide cursor for interface - //Driver->showCursor (false); - - // Init global variables - userChar = false; - noUserChar = false; - ConnectInterf = true; - CreateInterf = true; - CharacterInterf = true; - WaitServerAnswer= false; - - FarTP.setOutgame(); - - // Start the finite state machine - static bool firstConnection = true; - TInterfaceState InterfaceState = AUTO_LOGIN; - // TInterfaceState InterfaceState = firstConnection ? AUTO_LOGIN : GLOBAL_MENU; - /*if (!firstConnection) - { - noUserChar = userChar = false; - WaitServerAnswer = true; - }*/ - - NLGUI::CDBManager::getInstance()->getDbProp ("UI:CURRENT_SCREEN")->setValue32(ClientCfg.Local ? 6 : -1); // TMP TMP - IngameDbMngr.flushObserverCalls(); - NLGUI::CDBManager::getInstance()->flushObserverCalls(); - - // Active inputs - Actions.enable(true); - EditActions.enable(true); - - if (ClientCfg.SelectCharacter == -1) - { - // not initialized at login and remain hardware until here ... - - // Re-initialise the mouse (will be now in hardware mode, if required) - //InitMouseWithCursor (ClientCfg.HardwareCursor && !StereoDisplayAttached); // the return value of enableLowLevelMouse() has already been tested at startup - - // no ui init if character selection is automatic - //SetMouseFreeLook (); - //SetMouseCursor (); - SetMouseSpeed (ClientCfg.CursorSpeed); - SetMouseAcceleration (ClientCfg.CursorAcceleration); - - NLGUI::CDBManager::getInstance()->getDbProp("UI:SELECTED_SLOT")->setValue32(ClientCfg.SelectedSlot); - PlayerSelectedSlot = ClientCfg.SelectedSlot; - } - - connLast = connCurrent; - connCurrent = ryzomGetLocalTime(); - nlinfo ("PROFILE: %d seconds (%d total) for Initializing user interface", (uint32)(connCurrent-connLast)/1000, (uint32)(connCurrent-connStart)/1000); - - nlinfo ("PROFILE: %d seconds for connection", (uint32)(ryzomGetLocalTime ()-connStart)/1000); - - // Init web box - - // TMP TMP - if (ClientCfg.Local) - { - InterfaceState = GLOBAL_MENU; - } - - // Create the loading texture. We can't do that before because we need to add search path first. - beginLoading (LoadBackground); - UseEscapeDuringLoading = USE_ESCAPE_DURING_LOADING; - - while ((InterfaceState != GOGOGO_IN_THE_GAME) && (InterfaceState != QUIT_THE_GAME)) - { - switch (InterfaceState) - { - case AUTO_LOGIN: - InterfaceState = autoLogin (cookie, fsaddr, firstConnection); - break; - - case GLOBAL_MENU: - if (!ClientCfg.Local) - { - if (ClientCfg.SelectCharacter == -1) - { - NLGUI::CDBManager::getInstance()->getDbProp ("UI:CURRENT_SCREEN")->setValue32(0); // 0 == select - } - } - InterfaceState = globalMenu(); - break; - case GOGOGO_IN_THE_GAME: - break; - case QUIT_THE_GAME: - break; - } - } - - firstConnection = false; - - // Restore user UI scaling - CViewRenderer::getInstance()->setInterfaceScale(ClientCfg.InterfaceScale); - - // Disable inputs - Actions.enable(false); - EditActions.enable(false); - -// resetTextContext ("ingame.ttf", true); - resetTextContext ("ryzom.ttf", true); - - if (InterfaceState == GOGOGO_IN_THE_GAME) - { - // set background downloader to 'paused' to ease loading of client - pauseBGDownloader(); - return true; - } - - if (InterfaceState == QUIT_THE_GAME) - return false; - nlassert ((InterfaceState == GOGOGO_IN_THE_GAME) || (InterfaceState == QUIT_THE_GAME)); - return true; -} - - -// - -// Allow user to reselect character after the server reconnection -// ------------------------------------------------------------------------------------------------ -bool reconnection() -{ - - game_exit = false; - - setOutGameFullScreen(); - - // Preload continents - { - const ucstring nmsg ("Loading continents..."); - ProgressBar.newMessage (ClientCfg.buildLoadingString(nmsg) ); - ContinentMngr.preloadSheets(); - } -/* - if (!fsaddr.empty () && !cookie.empty ()) - { - // it means that we have a nel_launcher values, so we are online - ClientCfg.Local = 0; - nlinfo ("Using the nel launcher parameters '%s' '%s'", cookie.c_str (), fsaddr.c_str ()); - } - - // If the Client is in in Local Mode -> init the Time and return. - if (ClientCfg.Local) - { -#ifdef ENABLE_INCOMING_MSG_RECORDER - NetMngr.init("", ""); - // Set the impulse callback. - NetMngr.setImpulseCallback (impulseCallBack); - // Set the database. - NetMngr.setDataBase (IngameDbMngr.getNodePtr()); - // init the string manager cache. - STRING_MANAGER::CStringManagerClient::instance()->initCache("", ClientCfg.LanguageCode); // VOIR BORIS -#endif - connectionRestoreVideoMode (); - return true; - } -*/ - - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - - ProgressBar.setFontFactor(1.0f); - - // Init out game - pIM->initOutGame(); - - // Hide cursor for interface - Driver->showCursor (false); - - // Init global variables - userChar = false; - noUserChar = false; - ConnectInterf = true; - CreateInterf = true; - CharacterInterf = true; - WaitServerAnswer= false; - - FarTP.setOutgame(); - - // these two globals sequence GlobalMenu to display the character select dialog - WaitServerAnswer = true; - userChar = true; - - // Start the finite state machine - TInterfaceState InterfaceState = GLOBAL_MENU; - - NLGUI::CDBManager::getInstance()->getDbProp ("UI:CURRENT_SCREEN")->setValue32(-1); - IngameDbMngr.flushObserverCalls(); - NLGUI::CDBManager::getInstance()->flushObserverCalls(); - - // Active inputs - Actions.enable(true); - EditActions.enable(true); - - if (ClientCfg.SelectCharacter == -1) - { - // Re-initialise the mouse (will be now in hardware mode, if required) - SetMousePosFirstTime = true; - InitMouseWithCursor (ClientCfg.HardwareCursor && !StereoDisplayAttached); // the return value of enableLowLevelMouse() has already been tested at startup - - // no ui init if character selection is automatic - SetMouseFreeLook (); - SetMouseCursor (); - SetMouseSpeed (ClientCfg.CursorSpeed); - SetMouseAcceleration (ClientCfg.CursorAcceleration); - NLGUI::CDBManager::getInstance()->getDbProp("UI:SELECTED_SLOT")->setValue32(ClientCfg.SelectedSlot); - PlayerSelectedSlot = ClientCfg.SelectedSlot; - } - - // we want the teleport graphics to display (not like in Server Hop mode) - // this also kicks the state machine to sendReady() so we stop spinning in farTPmainLoop - FarTP.setIngame(); - - // Create the loading texture. We can't do that before because we need to add search path first. - beginLoading (LoadBackground); - UseEscapeDuringLoading = USE_ESCAPE_DURING_LOADING; - - // character selection menu - while( InterfaceState == GLOBAL_MENU ) // != GOGOGO_IN_THE_GAME) && (InterfaceState != QUIT_THE_GAME)) - { - if (ClientCfg.SelectCharacter == -1) - { - NLGUI::CDBManager::getInstance()->getDbProp ("UI:CURRENT_SCREEN")->setValue32(0); // 0 == select - } - InterfaceState = globalMenu(); - } - - // Restore user UI scaling - CViewRenderer::getInstance()->setInterfaceScale(ClientCfg.InterfaceScale); - - // Disable inputs - Actions.enable(false); - EditActions.enable(false); - -// resetTextContext ("ingame.ttf", true); - resetTextContext ("ryzom.ttf", true); - - if (InterfaceState == GOGOGO_IN_THE_GAME) - { - pauseBGDownloader(); - return true; - } - if (InterfaceState == QUIT_THE_GAME) - return false; - nlassert ((InterfaceState == GOGOGO_IN_THE_GAME) || (InterfaceState == QUIT_THE_GAME)); - return true; -} - -// Automatic connection to the server, the user can't do anything -// ------------------------------------------------------------------------------------------------ -TInterfaceState autoLogin (const string &cookie, const string &fsaddr, bool firstConnection) -{ - noUserChar = userChar = false; - string defaultPort = string(":47851"); - if(!fsaddr.empty()) - { - // If we have a front end address from command line, use this one - UsedFSAddr = fsaddr; - if (UsedFSAddr.find(":") == string::npos) - { - UsedFSAddr += defaultPort; - } - } - else - { - // Otherwise, use the front end address from configfile - UsedFSAddr = ClientCfg.FSHost; - FSAddr = UsedFSAddr; // to be able to do /reconnect - LoginSM.pushEvent( CLoginStateMachine::ev_skip_all_login ); - if (UsedFSAddr.find(":") == string::npos) - { - UsedFSAddr += defaultPort; - FSAddr += defaultPort; // to be able to do /reconnect - } - } - - if (firstConnection) - NetMngr.init (cookie, UsedFSAddr); - - // Connection - if (!ClientCfg.Local/*ace!ClientCfg.Light*/) - { - string result; - - if (firstConnection) - { - NetMngr.connect (result); - - if (!result.empty()) - { - nlerror ("connection : %s.", result.c_str()); - return QUIT_THE_GAME; - } - - // Ok the client is connected - - // Set the impulse callback. - NetMngr.setImpulseCallback (impulseCallBack); - // Set the database. - NetMngr.setDataBase (IngameDbMngr.getNodePtr()); - - // init the string manager cache. - STRING_MANAGER::CStringManagerClient::instance()->initCache(UsedFSAddr, ClientCfg.LanguageCode); - } - } - else - { - CCharacterSummary cs; - cs.Name = "babar"; - //cs.Surname = "l'elephant"; - cs.People = EGSPD::CPeople::Zorai; - cs.VisualPropA.PropertySubData.Sex = 0; // Male -//Deprecated -// cs.Role = ROLES::range_warrior; -// cs.Job = JOBS::CasterBuffer; -// cs.JobLevel = 16; - CharacterSummaries.push_back(cs); - - cs.Name = "yeah"; - //cs.Surname = "zeelot"; - cs.People = EGSPD::CPeople::Matis; - cs.VisualPropA.PropertySubData.Sex = 1; // Female -//Deprecated -// cs.Role = ROLES::buffer_magician; -// cs.Job = JOBS::CasterHealer; -// cs.JobLevel = 8; - CharacterSummaries.push_back(cs); - - userChar = true; - } - - WaitServerAnswer = true; - - return GLOBAL_MENU; -} - -// ------------------------------------------------------------------------------------------------ -void globalMenuMovieShooter() -{ - - if(MovieShooterSaving) - { - // Add the buffer frame to the movie. - if(!MovieShooter.addFrame(TimeInSec, Driver)) - { - // Fail to add the frame => abort. - endMovieShooting(); - } - else - { - // Ok, just add a display. - displaySpecialTextProgress("MovieShooting"); - } - } - -} - -// ------------------------------------------------------------------------------------------------ -// Build a valid PlayerName for file Save selection. -std::string buildPlayerNameForSaveFile(const ucstring &playerNameIn) -{ - // remove any shard name appended - ucstring playerName = playerNameIn; - ucstring::size_type pos = playerNameIn.find('('); - if(pos!=ucstring::npos && pos>0) - { - playerName.resize(pos); - } - - // replace any special ucchar with '_' - string ret; - ret.resize(playerName.size()); - for(uint i=0;i='A' && c<='Z') || - (c>='a' && c<='z') || - (c>='0' && c<='9') || - (c=='_') ) - { - ret[i]= tolower(c); - } - else - ret[i]= '_'; - } - return ret; -} - -// ------------------------------------------------------------------------------------------------ -class CSoundGlobalMenu -{ -public: - CSoundGlobalMenu() - { - _MusicWantedAsync= false; - _NbFrameBeforeChange= NbFrameBeforeChangeMax; - } - void setMusic(const string &music, bool async); - void updateSound(); -private: - string _MusicPlayed; - string _MusicWanted; - bool _MusicWantedAsync; - sint _NbFrameBeforeChange; - enum {NbFrameBeforeChangeMax= 10}; -}; - -void CSoundGlobalMenu::updateSound() -{ - // **** update the music played - // The first music played is the music played at loading, before select char - if(_MusicPlayed.empty()) - _MusicPlayed= toLower(ClientCfg.SoundOutGameMusic); - if(_MusicWanted.empty()) - _MusicWanted= toLower(ClientCfg.SoundOutGameMusic); - - // because music is changed when the player select other race for instance, - // wait the 3D to load (stall some secs) - - // if the wanted music is the same as the one currently playing, just continue playing - if(_MusicPlayed!=_MusicWanted) - { - // wait nbFrameBeforeChangeMax before actually changing the music - _NbFrameBeforeChange--; - if(_NbFrameBeforeChange<=0) - { - _MusicPlayed= _MusicWanted; - // play the music - if (SoundMngr != NULL) - SoundMngr->playMusic(_MusicPlayed, 500, _MusicWantedAsync, true, true); - } - } - - - // **** update mngr - if (SoundMngr != NULL) - SoundMngr->update(); -} - -void CSoundGlobalMenu::setMusic(const string &music, bool async) -{ - _MusicWanted= toLower(music); - _MusicWantedAsync= async; - // reset the counter - _NbFrameBeforeChange= NbFrameBeforeChangeMax; -} -static CSoundGlobalMenu SoundGlobalMenu; - - -static bool LuaBGDSuccessFlag = true; // tmp, for debug - - -void updateBGDownloaderUI() -{ - CInterfaceManager *im = CInterfaceManager::getInstance(); - CBGDownloaderAccess &bgDownloader = CBGDownloaderAccess::getInstance(); - bool bgWindowVisible = true; - if (im->isInGame()) - { - static NLMISC::CRefPtr bgDownloaderWindow; - if (!bgDownloaderWindow) - { - bgDownloaderWindow = CWidgetManager::getInstance()->getElementFromId("ui:interface:bg_downloader"); - } - bgWindowVisible = bgDownloaderWindow && bgDownloaderWindow->getActive(); - } - bool prevSuccess = LuaBGDSuccessFlag; - if (isBGDownloadEnabled() && PatchBegun) - { - if (AvailablePatchs == 0) - { - if (LuaBGDSuccessFlag) - { - LuaBGDSuccessFlag = CLuaManager::getInstance().executeLuaScript("bgdownloader:setPatchSuccess()"); - } - } - else - { - switch(bgDownloader.getLastTaskResult()) - { - case BGDownloader::TaskResult_Unknown: - { - float progress = 0.f; - /*if (bgDownloader.getTotalSize() != 0) - { - progress = (float) bgDownloader.getPatchingSize() / bgDownloader.getTotalSize(); - }*/ - if (bgDownloader.getTotalFilesToGet() != 0) - { - progress = (bgDownloader.getCurrentFilesToGet() + bgDownloader.getCurrentFileProgress()) / bgDownloader.getTotalFilesToGet(); - } - if (LuaBGDSuccessFlag && bgWindowVisible) - { - LuaBGDSuccessFlag = CLuaManager::getInstance().executeLuaScript(toString("bgdownloader:setPatchProgress(%f)", progress)); - } - // display current priority of the downloader - if (LuaBGDSuccessFlag && bgWindowVisible) - { - LuaBGDSuccessFlag = CLuaManager::getInstance().executeLuaScript("bgdownloader:displayPriority()"); - } - } - break; - case BGDownloader::TaskResult_Success: - if (LuaBGDSuccessFlag && bgWindowVisible) - { - LuaBGDSuccessFlag = CLuaManager::getInstance().executeLuaScript("bgdownloader:setPatchSuccess()"); - } - // task finished - AvailablePatchs = 0; - if (bgDownloader.getPatchCompletionFlag(true /* clear flag */)) - { - // when in-game, display a message to signal the end of the patch - if (im->isInGame()) - { - im->displaySystemInfo(CI18N::get("uiBGD_InGamePatchCompletion"), "BC"); - } - } - break; - default: - // error case - if (LuaBGDSuccessFlag && bgWindowVisible) - { - LuaBGDSuccessFlag = CLuaManager::getInstance().executeLuaScript("bgdownloader:setPatchError()"); - } - break; - } - } - } - else - { - if (LuaBGDSuccessFlag && bgWindowVisible) - { - if (isBGDownloadEnabled()) - { - // no necessary patch for now - LuaBGDSuccessFlag = CLuaManager::getInstance().executeLuaScript("bgdownloader:setNoNecessaryPatch()"); - } - else - { - // no download ui - LuaBGDSuccessFlag = CLuaManager::getInstance().executeLuaScript("bgdownloader:setNoDownloader()"); - } - } - } - if (prevSuccess != LuaBGDSuccessFlag) - { - nlwarning("Some scipt error occurred"); - } -} - - -// compute patcher priority, depending on the presence of one or more mainland characters : in this case, give the patch a boost -void updatePatcherPriorityBasedOnCharacters() -{ - if (isBGDownloadEnabled()) - { - if (CBGDownloaderAccess::getInstance().getDownloadThreadPriority() != BGDownloader::ThreadPriority_Paused) - { - // choose priority based on available characters : - bool hasMainlandChar = false; - for(std::vector::iterator it = CharacterSummaries.begin(); it != CharacterSummaries.end(); ++it) - { - if (it->Name.empty()) continue; - if (!it->InNewbieland) - { - hasMainlandChar = true; - break; - } - } - CBGDownloaderAccess::getInstance().requestDownloadThreadPriority(hasMainlandChar ? BGDownloader::ThreadPriority_Normal : BGDownloader::ThreadPriority_Low, false); - } - } -} - -// Launch the interface to choose a character -// ------------------------------------------------------------------------------------------------ -TInterfaceState globalMenu() -{ - CLoginProgressPostThread::getInstance().step(CLoginStep(LoginStep_CharacterSelection, "login_step_character_selection")); - - CBGDownloaderAccess &bgDownloader = CBGDownloaderAccess::getInstance(); - - if (isBGDownloadEnabled()) - { - // If there's a need for mainland download, then proceed - if (AvailablePatchs & (1 << BGDownloader::DownloadID_MainLand)) - { - // if a task is already started, then this was a situation where player went back from game to the character selection, - // so just unpause - BGDownloader::TTaskResult dummyResult; - ucstring dummyMessage; - if (!bgDownloader.isTaskEnded(dummyResult, dummyMessage)) - { - unpauseBGDownloader(); - } - } - } - - - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - - sint32 nScreenConnecting, nScreenIntro, nScreenServerCrashed; - fromString(CWidgetManager::getInstance()->getParser()->getDefine("screen_connecting"), nScreenConnecting); - fromString(CWidgetManager::getInstance()->getParser()->getDefine("screen_intro"), nScreenIntro); - fromString(CWidgetManager::getInstance()->getParser()->getDefine("screen_crashing"), nScreenServerCrashed); - - // SKIP INTRO : Write to the database if we have to skip the intro and write we want to skip further intro to client cfg - if (ClientCfg.SkipIntro) - { - CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:SKIP_INTRO", false); - if (pNL != NULL) - pNL->setValue64(1); - } - - TGameCycle serverTick = NetMngr.getCurrentServerTick(); - bool PlayerWantToGoInGame = false; - bool firewallTimeout = false; - - ProgressBar.finish(); // no progress while selecting character - - while (PlayerWantToGoInGame == false) - { - - #if defined(NL_OS_WINDOWS) && defined(NL_DEBUG) - // tmp for debug - if (::GetAsyncKeyState(VK_SPACE)) - { - pIM->uninitOutGame(); - pIM->initOutGame(); - CWidgetManager::getInstance()->activateMasterGroup ("ui:outgame", true); - NLGUI::CDBManager::getInstance()->getDbProp ("UI:CURRENT_SCREEN")->setValue32(2); // TMP TMP - IngameDbMngr.flushObserverCalls(); - NLGUI::CDBManager::getInstance()->flushObserverCalls(); - CWidgetManager::getInstance()->getElementFromId("ui:outgame:charsel")->setActive(false); - CWidgetManager::getInstance()->getElementFromId("ui:outgame:charsel")->setActive(true); - // Active inputs - Actions.enable(true); - EditActions.enable(true); - LuaBGDSuccessFlag = true; - CWidgetManager::getInstance()->getParser()->reloadAllLuaFileScripts(); - } - #endif - - updateBGDownloaderUI(); - - - // Update network. - try - { - if ( ! firewallTimeout ) - NetMngr.update(); - } - catch (const EBlockedByFirewall&) - { - if ( NetMngr.getConnectionState() == CNetManager::Disconnect ) - { - firewallTimeout = true; - } - else - { - // Display the firewall alert string - CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:outgame:connecting:title")); - if (pVT != NULL) - pVT->setText(CI18N::get("uiFirewallAlert")+ucstring("...")); - - // The mouse and fullscreen mode should be unlocked for the user to set the firewall permission - nlSleep( 30 ); // 'nice' the client, and prevent to make too many send attempts - } - - } - IngameDbMngr.flushObserverCalls(); - NLGUI::CDBManager::getInstance()->flushObserverCalls(); - - // check if we can send another dated block - if (NetMngr.getCurrentServerTick() != serverTick) - { - // - serverTick = NetMngr.getCurrentServerTick(); - NetMngr.send(serverTick); - } - else - { - // Send dummy info - NetMngr.send(); - } - // Update the DT T0 and T1 global variables - updateClientTime(); - CInputHandlerManager::getInstance()->pumpEvents(); - Driver->clearBuffers(CRGBA::Black); - Driver->setMatrixMode2D11(); - - // Update sound - SoundGlobalMenu.updateSound(); - - // Interface handling & displaying (processes clicks...) - pIM->updateFrameEvents(); - pIM->updateFrameViews(NULL); - IngameDbMngr.flushObserverCalls(); - NLGUI::CDBManager::getInstance()->flushObserverCalls(); - - // Movie shooter - globalMenuMovieShooter(); - - // Force the client to sleep a bit. - if(ClientCfg.Sleep >= 0) - { - nlSleep(ClientCfg.Sleep); - } - - #if defined(NL_OS_WINDOWS) && defined(NL_DEBUG) - if (::GetAsyncKeyState(VK_CONTROL)) - { - pIM->displayUIViewBBoxs(""); - pIM->displayUICtrlBBoxs(""); - pIM->displayUIGroupBBoxs(""); - displayDebugUIUnderMouse(); - } - #endif - - // Display - Driver->swapBuffers(); - - // SERVER INTERACTIONS WITH INTERFACE - if (WaitServerAnswer) - { - if (noUserChar || userChar) - { - - if (isBGDownloadEnabled()) - { - // If there's a need for mainland download, then proceed - if (AvailablePatchs & (1 << BGDownloader::DownloadID_MainLand)) - { - // if a task is already started, then this was a situation where player went back from game to the character selection, - // so just unpause - BGDownloader::TTaskResult dummyResult; - ucstring dummyMessage; - if (bgDownloader.isTaskEnded(dummyResult, dummyMessage)) - { - // launch mainland patch as a background task - BGDownloader::CTaskDesc task(BGDownloader::DLState_GetAndApplyPatch, - (1 << BGDownloader::DownloadID_MainLand)); - bgDownloader.startTask(task, getBGDownloaderCommandLine(), false /* showDownloader */); - - // choose priority based on available characters : - updatePatcherPriorityBasedOnCharacters(); - - PatchBegun = true; - } - } - } - - //nlinfo("impulseCallBack : received userChars list"); - noUserChar = userChar = false; - if( FarTP.isReselectingChar() || !FarTP.isServerHopInProgress() ) // if doing a Server Hop, expect serverReceivedReady without action from the user - { - sint charSelect = -1; - if (ClientCfg.SelectCharacter != -1) - charSelect = ClientCfg.SelectCharacter; - - if (LoginCharsel != -1) - charSelect = LoginCharsel; - - WaitServerAnswer = false; - if (charSelect == -1 || FarTP.isReselectingChar()) - { - CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp("UI:SERVER_RECEIVED_CHARS", false); - if (pNL != NULL) - { - pNL->setValue64 (1); // Send impulse to interface observers - IngameDbMngr.flushObserverCalls(); - NLGUI::CDBManager::getInstance()->flushObserverCalls(); - pNL->setValue64 (0); - IngameDbMngr.flushObserverCalls(); - NLGUI::CDBManager::getInstance()->flushObserverCalls(); - } - } - else - { - // check that the pre selected character is available - if (CharacterSummaries[charSelect].People == EGSPD::CPeople::Unknown || charSelect > 4) - { - // BAD ! preselected char does not exist, use the first available or fail - uint i; - for (i=0; isystemMessageBox("You have no character for the current user.\nClient will exit.", "Char loading error", UDriver::okType, UDriver::exclamationIcon); - exit(-1); - } - else - { - UDriver::TMessageBoxId ret = Driver->systemMessageBox("The pre-selected character doesn't exist.\nDo you want to use the first available character instead ?", "Char loading error", UDriver::yesNoType, UDriver::warningIcon); - if (ret == UDriver::noId) - exit(-1); - else - charSelect = i; - } - } - // Auto-selection for fast launching (dev only) - CAHManager::getInstance()->runActionHandler("launch_game", NULL, toString("slot=%d|edit_mode=0", charSelect)); - - if (LoginCharsel == -1) - ClientCfg.SelectCharacter = charSelect; - } - - } - - // Clear sending buffer that may contain prevous QUIT_GAME when getting back to the char selection screen - NetMngr.flushSendBuffer(); - } - - if (CharNameValidArrived) - { - //nlinfo("impulseCallBack : received CharNameValidArrived"); - CharNameValidArrived = false; - WaitServerAnswer = false; - if (ClientCfg.SelectCharacter == -1) - { - CCDBNodeLeaf *pNL; - pNL = NLGUI::CDBManager::getInstance()->getDbProp(CharNameValidDBLink,false); - if (pNL != NULL) - { - if (CharNameValid) - pNL->setValue64(1); - else - pNL->setValue64(0); - } - - pNL = NLGUI::CDBManager::getInstance()->getDbProp("UI:SERVER_RECEIVED_VALID", false); - if (pNL != NULL) - { - pNL->setValue64 (1); // Send impulse to interface observers - IngameDbMngr.flushObserverCalls(); - NLGUI::CDBManager::getInstance()->flushObserverCalls(); - pNL->setValue64 (0); - IngameDbMngr.flushObserverCalls(); - NLGUI::CDBManager::getInstance()->flushObserverCalls(); - } - } - } - - if (serverReceivedReady) - { - //nlinfo("impulseCallBack : received serverReceivedReady"); - serverReceivedReady = false; - WaitServerAnswer = false; - PlayerWantToGoInGame = true; - } - } - else - { - noUserChar = false; - userChar = false; - CharNameValidArrived = false; - serverReceivedReady = false; - } - - // Check if server disconnect the client - if (!ClientCfg.Local) - { - if (NetMngr.getConnectionState() == CNetManager::Disconnect) - { - // Display the connection failure screen - CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp("UI:CURRENT_SCREEN", false); - if (pNL != NULL) - pNL->setValue64 (nScreenServerCrashed); - - if ( firewallTimeout ) - { - // Display the firewall error string instead of the normal failure string - CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:outgame:crashing:title")); - if (pVT != NULL) - { - pVT->setMultiLine( true ); - pVT->setText(CI18N::get("uiFirewallFail")+ucstring(".\n")+ - CI18N::get("uiFirewallAlert")+ucstring(".")); - } - } - } - } - - - - // We want to quit the game without playing - if (game_exit) - return QUIT_THE_GAME; - } - - if (ClientCfg.SelectCharacter != -1) - PlayerSelectedSlot = ClientCfg.SelectCharacter; - - // Notify the state machine that we're exiting from global menu - LoginSM.pushEvent(CLoginStateMachine::ev_global_menu_exited); - - // Init the current Player Name (for interface.cfg and sentence.name save). Make a good File Name. - ucstring &playerName= CharacterSummaries[PlayerSelectedSlot].Name; - PlayerSelectedFileName= buildPlayerNameForSaveFile(playerName); - - // Init the current Player Home shard Id and name - CharacterHomeSessionId = CharacterSummaries[PlayerSelectedSlot].Mainland; - PlayerSelectedMainland= CharacterSummaries[PlayerSelectedSlot].Mainland; - PlayerSelectedHomeShardName.clear(); - PlayerSelectedHomeShardNameWithParenthesis.clear(); - for(uint i=0;igetWindowSize(width, height); - ClientCfg.Width = width; - ClientCfg.Height = height; - } - - connectionRestoreVideoMode (); - } - - // Skip intro next time - ClientCfg.writeBool("SkipIntro", true); - - // return SELECT_CHARACTER; - return GOGOGO_IN_THE_GAME; -} - - -// Init the character selection slot texts from the character summaries -// ------------------------------------------------------------------------------------------------ -class CAHNetInitCharSel : public IActionHandler -{ -public: - virtual void execute (CCtrlBase * /* pCaller */, const string &Params) - { - string sPath = getParam(Params, "slottexts"); - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - uint i; - for (i = 0; i < CharacterSummaries.size(); ++i) - { - CCharacterSummary &rCS = CharacterSummaries[i]; - CInterfaceElement *pIE = CWidgetManager::getInstance()->getElementFromId(sPath+":text"+NLMISC::toString(i)); - CViewText *pVT = dynamic_cast(pIE); - if (pVT == NULL) return; - - if (rCS.Name.empty()) - pVT->setText(CI18N::get("uiEmptySlot")); - else - pVT->setText(rCS.Name); - } - // 5 slots - for (; i < 5; ++i) - { - CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(sPath+":text"+NLMISC::toString(i))); - if (pVT == NULL) return; - pVT->setText(CI18N::get("uiEmptySlot")); - } - } -}; -REGISTER_ACTION_HANDLER (CAHNetInitCharSel, "net_init_char_sel"); - -// ------------------------------------------------------------------------------------------------ -void setTarget(CCtrlBase *ctrl, const string &targetName, ucstring &value) -{ - std::vector targets; - // find first enclosing group - CCtrlBase *currCtrl = ctrl; - CInterfaceGroup *ig = NULL; - while (currCtrl) - { - ig = dynamic_cast(currCtrl); - if (ig != NULL) break; - currCtrl = currCtrl->getParent(); - } - if (ig) - { - CInterfaceExprValue exprValue; - exprValue.setUCString(value); - - CInterfaceLink::splitLinkTargets(targetName, ig, targets); - for(uint k = 0; k < targets.size(); ++k) - { - if (targets[k].Elem) targets[k].affect(exprValue); - } - } -} - -// ------------------------------------------------------------------------------------------------ -void setTarget(CCtrlBase *ctrl, const string &targetName, uint32 value) -{ - std::vector targets; - // find first enclosing group - CCtrlBase *currCtrl = ctrl; - CInterfaceGroup *ig = NULL; - while (currCtrl) - { - ig = dynamic_cast(currCtrl); - if (ig != NULL) break; - currCtrl = currCtrl->getParent(); - } - if (ig) - { - CInterfaceExprValue exprValue; - exprValue.setInteger(value); - - CInterfaceLink::splitLinkTargets(targetName, ig, targets); - for(uint k = 0; k < targets.size(); ++k) - { - if (targets[k].Elem) targets[k].affect(exprValue); - } - } -} - -// ------------------------------------------------------------------------------------------------ -class CAHGetSlot: public IActionHandler -{ -public: - virtual void execute (CCtrlBase *pCaller, const string &Params) - { - string sProp = getParam(Params, "prop"); - string sTarget = getParam(Params, "target"); - string sSlot = getParam(Params, "slot"); - - CInterfaceExprValue result; - if (!CInterfaceExpr::eval(sSlot, result)) - return; - uint8 selectedSlot = (uint8)result.getInteger(); - if (selectedSlot >= CharacterSummaries.size()) - return; - - PlayerSelectedSlot = selectedSlot; - - if (CharacterSummaries[PlayerSelectedSlot].Name.empty()) - return; - - ucstring sValue(""); - uint32 nValue = 0; - - if (sProp == "name") - { - sValue = CharacterSummaries[PlayerSelectedSlot].Name; - setTarget (pCaller, sTarget, sValue); - } -/* else if (sProp == "surname") -Deprecated { - sValue = CharacterSummaries[PlayerSelectedSlot].Surname; - setTarget (pCaller, sTarget, sValue); - } -*/ else if (sProp == "title") - { - bool womanTitle; - if( CharacterSummaries[PlayerSelectedSlot].VisualPropA.PropertySubData.Sex == 1 ) - { - UserEntity->setGender( GSGENDER::female ); - womanTitle = true; - } - else - { - UserEntity->setGender( GSGENDER::male ); - womanTitle = false; - } - string titleStr = CHARACTER_TITLE::toString(CharacterSummaries[PlayerSelectedSlot].Title); - sValue = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(titleStr, womanTitle); - { - // Sometimes translation contains another title - ucstring::size_type pos = sValue.find('$'); - if (pos != ucstring::npos) - { - sValue = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sValue), womanTitle); - } - } - setTarget (pCaller, sTarget, sValue); - } -/* else if (sProp == "orient") -Deprecated { - sValue = ROLES::roleToUCString(CharacterSummaries[PlayerSelectedSlot].Role); - setTarget (pCaller, sTarget, sValue); - } - else if (sProp == "job") - { -//Deprecated -// sValue = JOBS::jobToUCString(CharacterSummaries[PlayerSelectedSlot].Job); - sValue = JOBS::jobToUCString(JOBS::BladeBearer); - setTarget (pCaller, sTarget, sValue); - } -*/ else if (sProp == "level") - { -//Deprecated -// sValue = toString(CharacterSummaries[PlayerSelectedSlot].JobLevel); - sValue = toString(1); - setTarget (pCaller, sTarget, sValue); - } - else if (sProp == "pos") - { - nValue = CharacterSummaries[PlayerSelectedSlot].Location; - setTarget (pCaller, sTarget, nValue); - } - } -}; -REGISTER_ACTION_HANDLER (CAHGetSlot, "get_slot"); - - -// Setup the database from a database entry which represents a slot -// ------------------------------------------------------------------------------------------------ -class CAHSetDBFromSlot : public IActionHandler -{ -public: - virtual void execute (CCtrlBase * /* pCaller */, const string &Params) - { - string sDBLink = getParam(Params, "dblink"); - string sSlot = getParam(Params, "slot"); - - CInterfaceExprValue result; - if (!CInterfaceExpr::eval(sSlot, result)) - return; - - PlayerSelectedSlot = (uint8)result.getInteger(); - - if (PlayerSelectedSlot >= CharacterSummaries.size()) - return; - - // Setup the database from the character summary - CCharacterSummary &rCS = CharacterSummaries[PlayerSelectedSlot]; - if (rCS.Name.empty()) - return; - - SCharacter3DSetup::setupDBFromCharacterSummary(sDBLink, rCS); - } -}; -REGISTER_ACTION_HANDLER (CAHSetDBFromSlot, "set_db_from_slot"); - - -// Reset all the pushed radio button of a group -// ------------------------------------------------------------------------------------------------ -class CAHResetPushed: public IActionHandler -{ -public: - virtual void execute (CCtrlBase *pCaller, const string &Params) - { - string sDBLink = getParam(Params, "dblink"); - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CInterfaceElement *pIE = CWidgetManager::getInstance()->getElementFromId(pCaller->getId(), sDBLink); - CInterfaceGroup *pIG = dynamic_cast(pIE); - if (pIG == NULL) return; - - const vector vCB = pIG->getControls(); - for (uint i = 0; i < vCB.size(); ++i) - { - CCtrlBaseButton *pBut = dynamic_cast(vCB[i]); - if (pBut && pBut->getType() == CCtrlBaseButton::RadioButton) - { - pBut->setPushed (false); - } - } - } -}; -REGISTER_ACTION_HANDLER (CAHResetPushed, "reset_pushed"); - - - - - -// Launch the game given a slot (slot is reference to the character summaries -// ------------------------------------------------------------------------------------------------ -class CAHLaunchGame : public IActionHandler -{ -public: - virtual void execute (CCtrlBase * /* pCaller */, const string &Params) - { - // Get the edit/play mode - string sEditMode = getParam(Params, "edit_mode"); - bool wantsEditMode = false; - CInterfaceExprValue result; - bool wantsNewScenario = false; - - if (CInterfaceExpr::eval(sEditMode, result)) - { - wantsEditMode = (result.getInteger() == 1) || (result.getInteger() == 2); - wantsNewScenario = (result.getInteger() == 2); - } - - CInterfaceManager *im = CInterfaceManager::getInstance(); - if (wantsEditMode) - { - // full patch needed for edition, warn the client - if (AvailablePatchs != 0) - { - if (im->isInGame()) - { - inGamePatchUncompleteWarning(); - } - else - { - im->messageBoxWithHelp(CI18N::get("uiBGD_FullPatchNeeded"), "ui:outgame"); - } - return; - } - } - - // Get the player selected slot - string sSlot = getParam(Params, "slot"); - if (sSlot != "ingame_auto") - { - CInterfaceExprValue result; - if (!CInterfaceExpr::eval(sSlot, result)) - return; - PlayerSelectedSlot = (uint8)result.getInteger(); - if (PlayerSelectedSlot >= CharacterSummaries.size()) - return; - - ClientCfg.writeInt("SelectedSlot",PlayerSelectedSlot); - if (ClientCfg.SaveConfig) - ClientCfg.ConfigFile.save(); - } - - - /* - static volatile bool isMainlandCharacter = false; // TMP until we can get this info - if (isMainlandCharacter) - { - nlassert(0); // use id="message_box" !!! - if (AvailablePatchs != 0) - { - im->messageBoxWithHelp(CI18N::get("uiBGD_MainlandCharFullPatchNeeded"), "ui:outgame"); - } - return; - } - */ - - - // Select the right sheet to create the user character. - ClientCfg.UserSheet = CharacterSummaries[PlayerSelectedSlot].SheetId.toString(); - - // If the user wants to enter its editing session, get the ring server to Far TP to. - if (wantsEditMode) - { - - if (wantsNewScenario) - { - CSessionBrowserImpl &sb = CSessionBrowserImpl::getInstance(); - sb.init(NULL); - sb.closeEditSession(sb.getCharId()); - sb.waitOneMessage(CSessionBrowserImpl::getMessageName("on_invokeResult")); - } - if (FarTP.requestFarTPToSession( (TSessionId)0, PlayerSelectedSlot, CFarTP::LaunchEditor, false )) - { - WaitServerAnswer = true; // prepare to receive the character messages - } - -// // If the player clicked 'Launch Editor', there was no CONNECTION:SELECT_CHAR sent yet, -// // so don't wait for the EGS to acknowledge our quit message as he does not know our character -// LoginSM.pushEvent(CLoginStateMachine::ev_ingame_return); - - return; - } - - // Send CONNECTION:SELECT_CHAR - CBitMemStream out; - nlverify( GenericMsgHeaderMngr.pushNameToStream ("CONNECTION:SELECT_CHAR", out) ); - //nlinfo("impulseCallBack : CONNECTION:SELECT_CHAR '%d' sent.", PlayerSelectedSlot); - - - CSelectCharMsg SelectCharMsg; - SelectCharMsg.c = (uint8)PlayerSelectedSlot; - out.serial (SelectCharMsg); - if (!ClientCfg.Local/*ace!ClientCfg.Light*/) - { - NetMngr.push(out); - NetMngr.send(NetMngr.getCurrentServerTick()); - } - - //PlayerWantToGoInGame = true; - -// CBitMemStream out2; -// if(GenericMsgHeaderMngr.pushNameToStream("CONNECTION:ENTER", out2)) -// { -// NetMngr.push(out2); -// nlinfo("impulseCallBack : CONNECTION:ENTER sent"); -// } -// else -// nlwarning("unknown message name : 'CONNECTION:ENTER'."); - - WaitServerAnswer = true; - if (ClientCfg.Local) - serverReceivedReady = true; - } -}; -REGISTER_ACTION_HANDLER (CAHLaunchGame, "launch_game"); - - -// Ask the server to create a character -// ------------------------------------------------------------------------------------------------ -class CAHAskCreateChar : public IActionHandler -{ -public: - virtual void execute (CCtrlBase * /* pCaller */, const string &Params) - { - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - - // Create the message for the server to create the character. - CBitMemStream out; - if (!GenericMsgHeaderMngr.pushNameToStream("CONNECTION:CREATE_CHAR", out)) - { - nlwarning ("don't know message name CONNECTION:CREATE_CHAR"); - return; - } - - // Setup the name - string sEditBoxPath = getParam (Params, "name"); - ucstring sFirstName = ucstring("NotSet"); - ucstring sSurName = ucstring("NotSet"); - CGroupEditBox *pGEB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(sEditBoxPath)); - if (pGEB != NULL) - sFirstName = pGEB->getInputString(); - else - nlwarning ("can't get edit box name : %s",sEditBoxPath.c_str()); - - // Build the character summary from the database branch ui:temp:char3d - CCharacterSummary CS; - string sCharSumPath = getParam(Params, "charsum"); - SCharacter3DSetup::setupCharacterSummaryFromDB(CS, sCharSumPath); - CS.Mainland = MainlandSelected; - CS.Name = sFirstName; - //CS.Surname = sSurName; - - // Create the message to send to the server from the character summary - CCreateCharMsg CreateCharMsg; - - CreateCharMsg.setupFromCharacterSummary(CS); - - // Slot - { - string sSlot = getParam(Params, "slot"); - - CInterfaceExprValue result; - if (!CInterfaceExpr::eval(sSlot, result)) - return; - - CreateCharMsg.Slot = (uint8)result.getInteger(); - - NLGUI::CDBManager::getInstance()->getDbProp("UI:SELECTED_SLOT")->setValue32(PlayerSelectedSlot); - } - - // Setup the new career - string sCaracBasePath = getParam (Params, "caracs"); - CreateCharMsg.NbPointFighter = (uint8)NLGUI::CDBManager::getInstance()->getDbProp(sCaracBasePath+"FIGHT")->getValue32(); - CreateCharMsg.NbPointCaster = (uint8)NLGUI::CDBManager::getInstance()->getDbProp(sCaracBasePath+"MAGIC")->getValue32(); - CreateCharMsg.NbPointCrafter = (uint8)NLGUI::CDBManager::getInstance()->getDbProp(sCaracBasePath+"CRAFT")->getValue32(); - CreateCharMsg.NbPointHarvester = (uint8)NLGUI::CDBManager::getInstance()->getDbProp(sCaracBasePath+"FORAGE")->getValue32(); - - // Setup starting point - string sLocationPath = getParam(Params, "loc"); - { - CreateCharMsg.StartPoint = RYZOM_STARTING_POINT::borea; - - CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp (sLocationPath, false); - if (pNL != NULL) - CreateCharMsg.StartPoint = (RYZOM_STARTING_POINT::TStartPoint)(pNL->getValue64()); - else - nlwarning(("Can't read starting point from the database : " + sLocationPath).c_str()); - - if (CS.People == EGSPD::CPeople::Fyros) - CreateCharMsg.StartPoint= (RYZOM_STARTING_POINT::TStartPoint)(((uint8)CreateCharMsg.StartPoint) + ((uint8)RYZOM_STARTING_POINT::fyros_start)); - else if (CS.People == EGSPD::CPeople::Matis) - CreateCharMsg.StartPoint= (RYZOM_STARTING_POINT::TStartPoint)(((uint8)CreateCharMsg.StartPoint) + ((uint8)RYZOM_STARTING_POINT::matis_start)); - else if (CS.People == EGSPD::CPeople::Tryker) - CreateCharMsg.StartPoint= (RYZOM_STARTING_POINT::TStartPoint)(((uint8)CreateCharMsg.StartPoint) + ((uint8)RYZOM_STARTING_POINT::tryker_start)); - else // if (CS.People == EGSPD::CPeople::Zorai) - CreateCharMsg.StartPoint= (RYZOM_STARTING_POINT::TStartPoint)(((uint8)CreateCharMsg.StartPoint) + ((uint8)RYZOM_STARTING_POINT::zorai_start)); - - } - - // Send the message to the server - CreateCharMsg.serialBitMemStream (out); - if (!ClientCfg.Local/*!ClientCfg.Light*/) - { - noUserChar = userChar = false; - - NetMngr.push(out); - NetMngr.send(NetMngr.getCurrentServerTick()); - - //nlinfo("impulseCallBack : CONNECTION:CREATE_CHAR sent"); - CreateCharMsg.dump(); - } - else - { - userChar = true; - if (CharacterSummaries.size() < 5) - CharacterSummaries.push_back(CS); - } - WaitServerAnswer = true; - } -}; -REGISTER_ACTION_HANDLER (CAHAskCreateChar, "ask_create_char"); - - - -// Ask the server to delete a character -// ------------------------------------------------------------------------------------------------ -class CAHAskDeleteChar : public IActionHandler -{ -public: - virtual void execute (CCtrlBase * /* pCaller */, const string &Params) - { - // Create the message for the server to create the character. - CBitMemStream out; - if (!GenericMsgHeaderMngr.pushNameToStream("CONNECTION:DELETE_CHAR", out)) - { - nlwarning ("don't know message name CONNECTION:DELETE_CHAR"); - return; - } - - // Get the selected slot - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - - string sSlot = getParam(Params, "slot"); - - CInterfaceExprValue result; - if (!CInterfaceExpr::eval(sSlot, result)) - return; - - uint8 nSelectedSlot = (uint8)result.getInteger(); - if (nSelectedSlot >= CharacterSummaries.size()) - return; - - out.serial (nSelectedSlot); - - // Yoyo: delete the Local files. To avoid problem if recreate a character with same name. - ucstring &playerName= CharacterSummaries[nSelectedSlot].Name; - string playerDeletedFileName= buildPlayerNameForSaveFile(playerName); - // Delete the 2 Local files - pIM->deletePlayerConfig(playerDeletedFileName); - pIM->deletePlayerKeys(playerDeletedFileName); - - // Send the message to the server - if (!ClientCfg.Local/*ace!ClientCfg.Light*/) - { - noUserChar = userChar = false; - NetMngr.push(out); - NetMngr.send(NetMngr.getCurrentServerTick()); - - //nlinfo("impulseCallBack : CONNECTION:DELETE_CHAR %d sent", nSelectedSlot); - } - else - { - if (nSelectedSlot < CharacterSummaries.size()) - CharacterSummaries.erase (CharacterSummaries.begin()+nSelectedSlot); - if (CharacterSummaries.size() != 0) - userChar = true; - else - noUserChar = true; - } - WaitServerAnswer = true; - } -}; -REGISTER_ACTION_HANDLER (CAHAskDeleteChar, "ask_delete_char"); - -// ------------------------------------------------------------------------------------------------ -string getTarget(CCtrlBase * /* ctrl */, const string &targetName) -{ - string sTmp = targetName; - std::vector targetsVector; - CInterfaceLink::splitLinkTargets(sTmp, NULL, targetsVector); - - CInterfaceLink::CTargetInfo &rTI = targetsVector[0]; - - CInterfaceElement *elem = rTI.Elem; - if (!elem) - { - nlwarning(" : Element is NULL"); - return ""; - } - const CReflectedProperty *pRP = CReflectSystem ::getProperty(elem->getReflectedClassName(), rTI.PropertyName); - - if (pRP->Type == CReflectedProperty::String) - return ((elem->*(pRP->GetMethod.GetString))()); - return ""; -} - -// ------------------------------------------------------------------------------------------------ -ucstring getUCTarget(CCtrlBase * /* ctrl */, const string &targetName) -{ - string sTmp = targetName; - std::vector targetsVector; - CInterfaceLink::splitLinkTargets(sTmp, NULL, targetsVector); - - CInterfaceLink::CTargetInfo &rTI = targetsVector[0]; - - CInterfaceElement *elem = rTI.Elem; - if (!elem) - { - nlwarning(" : Element is NULL"); - return ucstring(""); - } - const CReflectedProperty *pRP = elem->getReflectedProperty(rTI.PropertyName); - - if (pRP->Type == CReflectedProperty::UCString) - return ((elem->*(pRP->GetMethod.GetUCString))()); - return ucstring(""); -} - -/*// Ask the server to rename a character -// ------------------------------------------------------------------------------------------------ -class CAHAskRenameChar : public IActionHandler -{ -public: - virtual void execute (CCtrlBase *pCaller, const string &Params) - { - string sName = getTarget(NULL,getParam(Params, "name")); - string sSurname = getTarget(NULL,getParam(Params, "surname")); - - string sDBSlot = getParam(Params, "dbslot"); - - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - uint8 nSelectedSlot = (uint8)NLGUI::CDBManager::getInstance()->getDbProp(sDBSlot,false)->getValue32(); - - if (nSelectedSlot > CharacterSummaries.size()) - return; - - // Create the message for the server to create the character. - CBitMemStream out; - if (!GenericMsgHeaderMngr.pushNameToStream("CONNECTION:RENAME_CHAR", out)) - { - nlwarning ("don't know message name CONNECTION:RENAME_CHAR"); - return; - } - - // Get the selected slot - out.serial (nSelectedSlot); - out.serial (sName); - out.serial (sSurname); - - // Send the message to the server - if (!ClientCfg.Light) - { - noUserChar = userChar = false; - NetMngr.push (out); - NetMngr.send (NetMngr.getCurrentServerTick()); - - nldebug("impulseCallBack : CONNECTION:RENAME_CHAR sent"); - - // Wait for the character message which describe all the characters on a server - while (!noUserChar && !userChar) - { - //NetMngr.waitForServer(); - NetMngr.update(); - NetMngr.send(); - nlSleep(100); - } - } - else - { - CharacterSummaries[nSelectedSlot].FirstName = sName; - CharacterSummaries[nSelectedSlot].Surname = sSurname; - } - } -}; -REGISTER_ACTION_HANDLER (CAHAskRenameChar, "ask_rename_char"); -*/ - -// Ask the server if the name is not already used -// ------------------------------------------------------------------------------------------------ -class CAHAskValidName : public IActionHandler -{ -public: - virtual void execute (CCtrlBase * /* pCaller */, const string &Params) - { - string sTarget = getParam(Params, "target"); - string sDBLink = getParam(Params, "dblink"); - CharNameValidDBLink = sDBLink; - - ucstring sName = getUCTarget(NULL,sTarget); - - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - if (sName.empty()) - { - NLGUI::CDBManager::getInstance()->getDbProp(sDBLink,false)->setValue32(0); - return; - } - - // Ask the server - CharNameValid = true; - - // PATCH DU BUG DE L'ESPACE !!! - if (sName.find(' ') != ucstring::npos) - CharNameValid = false; - // PATCH DU BUG DE L'ESPACE !!! - - - if (CharNameValid) - { - if (!ClientCfg.Local/*ace!ClientCfg.Light*/) - { - - CBitMemStream out; - if (!GenericMsgHeaderMngr.pushNameToStream("CONNECTION:ASK_NAME", out)) - { - nlwarning ("don't know message name CONNECTION:ASK_NAME"); - return; - } - - CCheckNameMsg checkNameMsg; - checkNameMsg.Name = sName; - checkNameMsg.HomeSessionId = MainlandSelected; - checkNameMsg.serialBitMemStream(out); - - NewKeysCharNameWanted = sName; - // append shard name - for(uint k = 0; k < Mainlands.size(); ++k) - { - if (Mainlands[k].Id == MainlandSelected) - { - // extract name from mainland - /*ucstring::size_type first = Mainlands[k].Name.find('('); - ucstring::size_type last = Mainlands[k].Name.find(')'); - if (first != ucstring::npos && last != ucstring::npos && first < last) - { - NewKeysCharNameWanted += Mainlands[k].Name.substr(first, last - first + 1); - }*/ - NewKeysCharNameWanted += ('(' + Mainlands[k].Name + ')'); - break; - } - } - - NewKeysCharNameValidated.clear(); - - NetMngr.push(out); - NetMngr.send(NetMngr.getCurrentServerTick()); - - //nlinfo("impulseCallBack : CONNECTION:ASK_NAME sent"); - - // Wait for the valid character name message - CharNameValidArrived = false; - } - else - { - - CharNameValid = true; - CharNameValidArrived = true; - - for (uint i = 0; i < CharacterSummaries.size(); ++i) - { - ucstring ls = CharacterSummaries[i].Name.toString(); - if (ls == sName) - CharNameValid = false; - } - } - } - else - { - CharNameValidArrived = true; - } - WaitServerAnswer = true; - } -}; -REGISTER_ACTION_HANDLER (CAHAskValidName, "ask_valid_name"); - -// ------------------------------------------------------------------------------------------------ -class CAHPlaySound : public IActionHandler -{ -public: - virtual void execute (CCtrlBase * /* pCaller */, const string &Params) - { - string sName = getParam(Params, "name"); - TStringId id = CStringMapper::map(sName); - if (SoundMngr != NULL) - SoundMngr->spawnSource(id,CVector(0,0,0)); - } -}; -REGISTER_ACTION_HANDLER (CAHPlaySound, "play_sound"); - -// ------------------------------------------------------------------------------------------------ -class CAHPlayMusicOutgame : public IActionHandler -{ -public: - virtual void execute (CCtrlBase * /* pCaller */, const string &Params) - { - // get the name of the wanted music - string sName = getParam(Params, "name"); - bool async; - fromString(getParam(Params, "async"), async); - - // if empty name, return to default mode - if(sName.empty()) - sName= ClientCfg.SoundOutGameMusic; - - // change the music - SoundGlobalMenu.setMusic(sName, async); - } -}; -REGISTER_ACTION_HANDLER (CAHPlayMusicOutgame, "play_music_outgame"); - -// ------------------------------------------------------------------------------------------------ -class CAHRepeatUntil : public IActionHandler -{ -public: - virtual void execute (CCtrlBase *pCaller, const string &Params) - { - string sProc = getParam(Params, "proc"); - string sCond = getParam(Params, "cond"); - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - - for(;;) - { - vector p; - p.push_back(sProc); - CWidgetManager::getInstance()->runProcedure(sProc, pCaller, p); - - CInterfaceExprValue result; - if (CInterfaceExpr::eval(sCond, result)) - { - if (result.getBool()) - break; - } - else - { - break; - } - } - - } -}; -REGISTER_ACTION_HANDLER (CAHRepeatUntil, "repeatuntil"); - - -// ------------------------------------------------------------------------------------------------ -class CAHDispInfo : public IActionHandler -{ -public: - virtual void execute (CCtrlBase * /* pCaller */, const string &Params) - { - string sStr = getParam(Params, "str"); - string sVal = getParam(Params, "val"); - - string res; - - CInterfaceExprValue result; - if (CInterfaceExpr::eval(sStr, result)) - { - if (result.toString()) - { - res += result.getString(); - } - } - if (CInterfaceExpr::eval(sVal, result)) - { - if (result.toString()) - { - res += result.getString(); - } - } - - nlinfo(res.c_str()); - } -}; -REGISTER_ACTION_HANDLER (CAHDispInfo, "disp_info"); - - -// *************************************************************************** -class CAHInitMainlandList : public IActionHandler -{ -public: - - virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) - { - //CInterfaceManager *pIM = CInterfaceManager::getInstance(); - - CInterfaceGroup *pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_MAINLAND)); - if (pList == NULL) - { - nlwarning("element " GROUP_LIST_MAINLAND " not found probably bad outgame.xml"); - return; - } - - CInterfaceGroup *pPrevLine = NULL; - for(uint i = 0; i < Mainlands.size(); i++) - { - vector< pair < string, string > > params; - params.clear(); - params.push_back(pair("id", toString(Mainlands[i].Id))); - if (i>0) - params.push_back(pair("posref", "BL TL")); - - CInterfaceGroup *pNewLine = CWidgetManager::getInstance()->getParser()->createGroupInstance("t_mainland", GROUP_LIST_MAINLAND, params); - if (pNewLine != NULL) - { - CViewBase *pVBon = pNewLine->getView("online"); - CViewBase *pVBoff = pNewLine->getView("offline"); - if ((pVBon != NULL) && (pVBoff != NULL)) - { - pVBon->setActive(Mainlands[i].Online); - pVBoff->setActive(!Mainlands[i].Online); - } - - CViewText *pVT = dynamic_cast(pNewLine->getView("name")); - if (pVT != NULL) - { - ucstring ucstr = Mainlands[i].Name + ucstring(" ") + Mainlands[i].Description; - pVT->setText(ucstr); - } - - // Add to the list - pNewLine->setParent(pList); - pNewLine->setParentSize(pList); - pNewLine->setParentPos(pPrevLine); - pList->addGroup(pNewLine); - - pPrevLine = pNewLine; - } - } - // UI Patch - if (!Mainlands.empty()) - { - //choose default mainland from language code - uint32 defaultMainland = 0; - for(uint i = 0; i < Mainlands.size(); i++) - { - if( Mainlands[i].LanguageCode == ClientCfg.LanguageCode ) - { - defaultMainland = i; - break; - } - } - - CCtrlButton *pCB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_MAINLAND ":"+toString(Mainlands[defaultMainland].Id)+":but")); - if (pCB != NULL) - { - pCB->setPushed(true); - CAHManager::getInstance()->runActionHandler (pCB->getActionOnLeftClick(), pCB, pCB->getParamsOnLeftClick()); - } - } - pList->invalidateCoords(); - } -}; -REGISTER_ACTION_HANDLER (CAHInitMainlandList, "init_mainland_list"); - - -// *************************************************************************** -class CAHResetMainlandList : public IActionHandler -{ -public: - - virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) - { - //CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CInterfaceGroup *pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_MAINLAND)); - pList->clearGroups(); - } -}; -REGISTER_ACTION_HANDLER (CAHResetMainlandList, "reset_mainland_list"); - - -// *************************************************************************** -class CAHMainlandSelect : public IActionHandler -{ - virtual void execute (CCtrlBase *pCaller, const std::string &Params) - { - //nlinfo("CAHMainlandSelect called"); - struct CUnpush : public CInterfaceElementVisitor - { - CCtrlBase *Ref; - virtual void visitCtrl(CCtrlBase *ctrl) - { - if (ctrl == Ref) return; - CCtrlBaseButton *but = dynamic_cast(ctrl); - if (but) - { - but->setPushed(false); - } - } - }; - CInterfaceGroup *list = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_MAINLAND)); - if (!list) - return; - - // unselect - if (Params.empty()) - { - CUnpush unpusher; - unpusher.Ref = pCaller; - list->visit(&unpusher); - } - - // now select - uint32 mainland; - if (Params.empty()) - { - CCtrlButton *pCB = dynamic_cast(pCaller); - if (!pCB) - return; - - std::string name = pCB->getId(); - name = name.substr(0, name.rfind(':')); - - if (!fromString(name.substr(name.rfind(':')+1, name.size()), mainland)) - return; - - pCB->setPushed(true); - } - else - if (!fromString(Params, mainland)) - return; - - // and store - MainlandSelected = (TSessionId)mainland; - } -}; -REGISTER_ACTION_HANDLER (CAHMainlandSelect, "mainland_select"); - - -// *************************************************************************** -class CAHInitKeysetList : public IActionHandler -{ -public: - - - - CInterfaceGroup *PrevLine; - CInterfaceGroup *List; - bool First; - - CInterfaceGroup *buildTemplate(const std::string &templateName, const std::string &id) - { - vector< pair < string, string > > params; - params.clear(); - params.push_back(pair("id", id)); - if (!First) - { - params.push_back(pair("posref", "BL TL")); - } - First = false; - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - return CWidgetManager::getInstance()->getParser()->createGroupInstance(templateName, GROUP_LIST_KEYSET, params); - } - - void addGroupInList(CInterfaceGroup *pNewLine) - { - if (!pNewLine) return; - // Add to the list - pNewLine->setParent(List); - pNewLine->setParentSize(List); - pNewLine->setParentPos(PrevLine); - List->addGroup(pNewLine); - - PrevLine = pNewLine; - } - - void addSeparator() - { - addGroupInList(buildTemplate("t_keyseparator", "")); - } - - // add a new keyset in the list - void addKeySet(const std::string &filename, const ucstring &name, const ucstring tooltip) - { - nlassert(List); - CInterfaceGroup *pNewLine = buildTemplate("t_keyset", toString(filename)); - if (pNewLine != NULL) - { - CViewText *pVT = dynamic_cast(pNewLine->getView("name")); - if (pVT != NULL) - { - pVT->setText(name); - } - - CCtrlBase *pBut = pNewLine->getCtrl("but"); - if (pBut != NULL) - { - pBut->setDefaultContextHelp(tooltip); - } - addGroupInList(pNewLine); - } - } - - virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) - { - NewKeysCharNameWanted.clear(); - NewKeysCharNameValidated.clear(); - GameKeySet = "keys.xml"; - RingEditorKeySet = "keys_r2ed.xml"; - First = true; - PrevLine = NULL; - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - - List = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_KEYSET)); - if (List == NULL) - { - nlwarning("element " GROUP_LIST_KEYSET " not found probably bad outgame.xml"); - return; - } - - // built-in keysets - CConfigFile::CVar *keySetVar = ClientCfg.ConfigFile.getVarPtr(KeySetVarName); - sint wasdIndex = -1; - sint zqsdIndex = -1; - if (keySetVar && keySetVar->size() != 0) - { - for (uint k = 0; k < keySetVar->size(); ++k) - { - if (keySetVar->asString(k) == "zqsd") zqsdIndex = (sint) k; - if (keySetVar->asString(k) == "wasd") wasdIndex = (sint) k; - - std::string strId = "uiCP_KeysetName_" + keySetVar->asString(k); - strFindReplace(strId, ".", "_"); - ucstring keySetName = CI18N::get(strId); - strId = "uiCP_KeysetTooltip_" + keySetVar->asString(k); - strFindReplace(strId, ".", "_"); - if (CI18N::hasTranslation(strId)) - { - ucstring keySetTooltip = CI18N::get(strId); - addKeySet(keySetVar->asString(k), keySetName, keySetTooltip); - } - } - } - else - { - nlwarning("'%s' var not found in config file, or list is empty, proposing default keyset only", KeySetVarName); - std::string defaultKeySet = "keys"; - ucstring keySetName = CI18N::get("uiCP_KeysetName_" + defaultKeySet); - ucstring keySetTooltip = CI18N::get("uiCP_KeysetTooltip_" + defaultKeySet); - addKeySet(defaultKeySet, keySetName, keySetTooltip); - } - - // keyset from previous chars - std::vector savedFiles; - CPath::getPathContent("save/", false, false, true, savedFiles); - enum { GameKeys = 0x1, EditorKeys = 0x2 }; - typedef std::map TKeySetFileMap; - TKeySetFileMap keySetFiles; // combination of 'GameKeys' & 'EditorKeys' flag for each character - for (uint k = 0; k < savedFiles.size(); ++k) - { - if (testWildCard(CFile::getFilename(savedFiles[k]), "keys_*.xml")) - { - bool editorKeys = testWildCard(CFile::getFilename(savedFiles[k]), "keys_r2ed_*.xml"); - std::string baseName = CFile::getFilenameWithoutExtension(savedFiles[k]).substr(strlen(editorKeys ? "keys_r2ed_" : "keys_")); - if(!keySetFiles.count(baseName)) keySetFiles[baseName] = 0; - keySetFiles[baseName] |= editorKeys ? EditorKeys : GameKeys; - } - } - // - bool separatorAdded = false; - if (!keySetFiles.empty()) - { - for(TKeySetFileMap::iterator it = keySetFiles.begin(); it != keySetFiles.end(); ++it) - { - ucstring name; - if (ClientCfg.Local) - { - name = ucstring(it->first); - } - else - { - // search matching ucstring name from character summaries - for (uint k = 0; k < CharacterSummaries.size(); ++k) - { - if (it->first == buildPlayerNameForSaveFile(CharacterSummaries[k].Name)) - { - name = CharacterSummaries[k].Name; - } - } - } - if (!name.empty()) - { - if (!separatorAdded) - { - addSeparator(); - separatorAdded = true; - } - addKeySet(it->first, ucstring(it->first), CI18N::get(std::string("uiCP_KeysetImport") + (it->second & GameKeys ? "_Game" : "") - + (it->second & EditorKeys ? "_Editor" : ""))); - } - } - } - - // default to 'ZQSD' for French and Belgian keyboard, 'WASD' else - bool wasd = !CSystemUtils::isAzertyKeyboard(); - - /*sint startIndex = wasd ? wasdIndex : zqsdIndex; - if (startIndex == -1) startIndex = 0; - */ - // TMP TMP : no way to have 2 keys for the same action for now -> default to 'arrows' setting. - sint startIndex = 0; - nlassert(startIndex >= 0); - if (startIndex < (sint) List->getNumGroup()) - { - CInterfaceGroup *gr = dynamic_cast(List->getGroup(startIndex)); - if (gr) - { - CCtrlButton *pCB = dynamic_cast(gr->getCtrl("but")); - if (pCB != NULL) - { - pCB->setPushed(true); - CAHManager::getInstance()->runActionHandler (pCB->getActionOnLeftClick(), pCB, pCB->getParamsOnLeftClick()); - } - } - } - List->invalidateCoords(); - } -}; -REGISTER_ACTION_HANDLER (CAHInitKeysetList, "init_keyset_list"); - - -// *************************************************************************** -class CAHResetKeysetList : public IActionHandler -{ -public: - - virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) - { - //CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CInterfaceGroup *pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_KEYSET)); - pList->clearGroups(); - } -}; -REGISTER_ACTION_HANDLER (CAHResetKeysetList, "reset_keyset_list"); - - -// *************************************************************************** -class CAHResetKeysetSelect : public IActionHandler -{ - std::string getIdPostFix(const std::string fullId) - { - std::string::size_type pos = fullId.find_last_of(":"); - if (pos != std::string::npos) - return fullId.substr(pos + 1); - - return ""; - } - - virtual void execute(CCtrlBase *pCaller, const std::string &Params) - { - // 'unpush' all groups but the caller - struct CUnpush : public CInterfaceElementVisitor - { - CCtrlBase *Ref; - virtual void visitCtrl(CCtrlBase *ctrl) - { - if (ctrl == Ref) return; - CCtrlBaseButton *but = dynamic_cast(ctrl); - if (but) - { - but->setPushed(false); - } - } - }; - CInterfaceGroup *list = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_KEYSET)); - if (!list) - return; - - // unselect - CUnpush unpusher; - unpusher.Ref = pCaller; - list->visit(&unpusher); - - // now select - CCtrlBaseButton *but = dynamic_cast(pCaller); - if (but) - but->setPushed(true); - - std::string id; - if (Params.empty()) - { - if (!pCaller) return; - if (!pCaller->getParent()) return; - - id = getIdPostFix(pCaller->getParent()->getId()); - } - else - id = getIdPostFix(Params); - - GameKeySet = "keys.xml"; - RingEditorKeySet = "keys_r2ed.xml"; - - // compute the two filenames from the id - // if id is in the built-in keysets - CConfigFile::CVar *keySetVar = ClientCfg.ConfigFile.getVarPtr(KeySetVarName); - if (keySetVar && keySetVar->size() > 0) - { - for (uint k = 0; k < keySetVar->size(); ++k) - { - if (keySetVar->asString(k) == id) - { - GameKeySet = "keys" + string(id.empty() ? "" : "_") + id + ".xml"; - RingEditorKeySet = "keys_r2ed" + string(id.empty() ? "" : "_") + id + ".xml"; - return; - } - } - } - - // else maybe from a previous character? - if (CFile::isExists("save/keys_" + id + ".xml")) - GameKeySet = "keys_" + id + ".xml"; - - if (CFile::isExists("save/keys_r2ed_" + id + ".xml")) - RingEditorKeySet = "keys_r2ed_" + id + ".xml"; - - // NB: key file will be copied for real when the new character summary is - } -}; -REGISTER_ACTION_HANDLER (CAHResetKeysetSelect, "keyset_select"); - - - - - -// *************************** SCENARIO CONTROL WINDOW *********************** -// *************************************************************************** -// helper function for "setScenarioInformation" -static void setTextField(CInterfaceGroup* scenarioWnd, const std::string &uiName, const ucstring &text) -{ - CInterfaceElement *result = scenarioWnd->findFromShortId(uiName); - if(result) - { - CViewText* viewText = dynamic_cast(result); - if(viewText) - viewText->setText(text); - CGroupEditBox* editBox = dynamic_cast(result); - if(editBox) - editBox->setInputString(text); - - } -} -// helper function for "setScenarioInformation" -static void setTextField(CInterfaceGroup* scenarioWnd, const std::string &uiName, const std::string &utf8Text) -{ - ucstring ucText; - ucText.fromUtf8(utf8Text); - setTextField(scenarioWnd, uiName, ucText); -} -// helper function for "setScenarioInformation" -static std::string fieldLookup(const vector< pair< string, string > > &values, const std::string &id) -{ - for(uint i=0; i > values; - if(R2::getEditor().isInitialized()) - { - values = R2::getEditor().getDMC().getEditionModule().getScenarioHeader(); - } - else - { - R2::CScenarioValidator sv; - std::string md5, signature; - sv.setScenarioToLoad(scenarioName, values, md5, signature, false); - } - // - setTextField(scenarioWnd, "rules_value_text", fieldLookup(values, "Rules")); - uint levelRange = 0; - uint32 nLevel; - fromString(fieldLookup(values, "Level"), nLevel); - switch(nLevel) - { - case 20: levelRange = 0; break; - case 50: levelRange = 1; break; - case 100: levelRange = 2; break; - case 150: levelRange = 3; break; - case 200: levelRange = 4; break; - case 250: levelRange = 5; break; - } - setTextField(scenarioWnd, "level_value_text", CI18N::get("uiRAP_Level" + toString(levelRange))); - setTextField(scenarioWnd, "language_value_text", CI18N::get("uiR2ED" + fieldLookup(values, "Language"))); - setTextField(scenarioWnd, "type_value_text", CI18N::get("uiR2ED" + fieldLookup(values, "Type"))); - setTextField(scenarioWnd, "edit_small_description", fieldLookup(values, "ShortDescription")); - if(R2::getEditor().isInitialized()) - { - setTextField(scenarioWnd, "scenario_value_text", "'" + fieldLookup(values, "Title") + "'"); - } -} - - -void getChildrenControls(CInterfaceGroup* group, std::vector & controls) -{ - for(uint i=0; igetGroups().size(); i++) - getChildrenControls(group->getGroups()[i], controls); - - for(uint i=0; igetControls().size(); i++) - controls.push_back(group->getControls()[i]); -} - -inline void setToggleButton(CInterfaceGroup* scenarioWnd, const string & buttonName, bool pushed) -{ - CInterfaceElement * result = scenarioWnd->findFromShortId(buttonName); - if(result) - { - CInterfaceGroup * group = dynamic_cast(result); - if(group) - { - result = group->findFromShortId(string("toggle_butt")); - if(result) - { - CCtrlBaseButton * baseButton = dynamic_cast(result); - if(baseButton) - baseButton->setPushed(!pushed); - } - } - } -} - - -class CAHScenarioControl : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) - { - nlinfo("CAHScenarioControl called"); - - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CInterfaceGroup* scenarioWnd = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:r2ed_scenario_control")); - if(!scenarioWnd) return; - - // -------- active some groups in function of Ryzom mode or Edition/Animation mode ---- - // active team toggle button? - CInterfaceElement *result = scenarioWnd->findFromShortId(string("invite_team")); - if(result) - { - CInterfaceGroup* groupTeam = dynamic_cast(result); - if(groupTeam) - { - bool team = !(R2::getEditor().isInitialized()); - if(team) - team = (NLGUI::CDBManager::getInstance()->getDbProp("SERVER:USER:TEAM_MEMBER")->getValue8())!=0; - groupTeam->setActive(team); - } - } - - // set scenario name label - result = scenarioWnd->findFromShortId(string("current_scenario_label_text")); - if(result) - { - CViewText* viewText = dynamic_cast(result); - if(viewText) - { - viewText->setText(R2::getEditor().isInitialized()?CI18N::get("uiR2EDScenarioName"):CI18N::get("uiR2EDScenarioFileName")); - } - } - - // ok button tranlation - result = scenarioWnd->findFromShortId(string("ok_button")); - if(result) - { - CCtrlTextButton* okButton = dynamic_cast(result); - if(okButton) - { - if(R2::getEditor().getAccessMode()!=R2::CEditor::AccessDM) - okButton->setHardText(CI18N::get("uiR2EDLaunchScenario").toString()); - else - okButton->setHardText(CI18N::get("uiR2EDApplyScenarioFilters").toString()); - } - } - - // init current scenario name and parameters - if(!R2::getEditor().isInitialized()) - { - ScenarioFileName.clear(); - - // empty scenario - CInterfaceElement *result = scenarioWnd->findFromShortId(string("scenario_value_text")); - if(result) - { - CViewText* viewText= dynamic_cast(result); - - if(viewText) - viewText->setText(ucstring("")); - } - } - setScenarioInformation(scenarioWnd, ""); - - // hide description and information? - result = scenarioWnd->findFromShortId(string("scenario_info_prop")); - if(result) - result->setActive(R2::getEditor().isInitialized()); - - result = scenarioWnd->findFromShortId(string("description_gr")); - if(result) - result->setActive(R2::getEditor().isInitialized()); - - // mainlands list - result = scenarioWnd->findFromShortId(string("shards")); - if(result) - { - CGroupList * shardList = dynamic_cast(result); - if(shardList) - { - shardList->deleteAllChildren(); - - for(uint i = 0; i < Mainlands.size(); i++) - { - vector< pair < string, string > > params; - params.clear(); - params.push_back(pair("id", toString(Mainlands[i].Id))); - params.push_back(pair("w", "1024")); - params.push_back(pair("tooltip", "uiRingFilterShard")); - CInterfaceGroup *toggleGr = CWidgetManager::getInstance()->getParser()->createGroupInstance("label_toggle_button", shardList->getId(), params); - shardList->addChild(toggleGr); - // set unicode name - CViewText *shardName = dynamic_cast(toggleGr->getView("button_text")); - if (shardName) - { - shardName->setText(Mainlands[i].Name); - } - } - } - } - - // show/display "back" button - result = scenarioWnd->findFromShortId(string("load_button")); - if(result) - { - CCtrlBaseButton * loadB = dynamic_cast(result); - if(loadB) - { - loadB->setActive(!R2::getEditor().isInitialized()); - } - } - - // fill toggle buttons - if(R2::getEditor().getAccessMode()==R2::CEditor::AccessDM) - { - CSessionBrowserImpl & sessionBrowser = CSessionBrowserImpl::getInstance(); - sessionBrowser.getSessionInfo(sessionBrowser.getCharId(), R2::getEditor().getDMC().getEditionModule().getCurrentAdventureId()); - - if(sessionBrowser.waitOneMessage(sessionBrowser.getMessageName("on_sessionInfoResult"))) - { - TRaceFilter & raceFilter = sessionBrowser._LastRaceFilter; - setToggleButton(scenarioWnd, "fyros", raceFilter.checkEnumValue(TRaceFilterEnum::rf_fyros)); - setToggleButton(scenarioWnd, "matis", raceFilter.checkEnumValue(TRaceFilterEnum::rf_matis)); - setToggleButton(scenarioWnd, "tryker", raceFilter.checkEnumValue(TRaceFilterEnum::rf_tryker)); - setToggleButton(scenarioWnd, "zorai", raceFilter.checkEnumValue(TRaceFilterEnum::rf_zorai)); - - TReligionFilter & religionFilter = sessionBrowser._LastReligionFilter; - setToggleButton(scenarioWnd, "kami", religionFilter.checkEnumValue(TReligionFilterEnum::rf_kami)); - setToggleButton(scenarioWnd, "karavan", religionFilter.checkEnumValue(TReligionFilterEnum::rf_karavan)); - setToggleButton(scenarioWnd, "neutral", religionFilter.checkEnumValue(TReligionFilterEnum::rf_neutral)); - - TGuildFilter & guildFilter = sessionBrowser._LastGuildFilter; - setToggleButton(scenarioWnd, "guild_gr", (guildFilter==TGuildFilter::gf_any_player)); - - TShardFilter & shardFilter = sessionBrowser._LastShardFilter; - for(uint i=0; ifindFromShortId(string("global_access_toggle_butt")); - if(result) - { - CCtrlBaseButton * baseButton = dynamic_cast(result); - if(baseButton) - baseButton->setPushed(subscriptionClosed); - } - - bool autoInvite = sessionBrowser._LastAutoInvite; - result = scenarioWnd->findFromShortId(string("auto_invite_toggle_butt")); - if(result) - { - CCtrlBaseButton * baseButton = dynamic_cast(result); - if(baseButton) - baseButton->setPushed(!autoInvite); - } - - // description - string description = sessionBrowser._LastDescription; - if(!description.empty()) - { - result = scenarioWnd->findFromShortId(string("edit_small_description")); - if(result) - { - CGroupEditBox* editBox = dynamic_cast(result); - if(editBox) - editBox->setInputString(description); - } - } - } - else - { - nlwarning("getSessionInfo callback return false"); - } - } - else - { - result = scenarioWnd->findFromShortId(string("access_players_filter")); - if(result) - { - CInterfaceGroup* filtersGroup = dynamic_cast(result); - if(filtersGroup) - { - std::vector controls; - getChildrenControls(filtersGroup, controls); - for(uint i=0; i(control); - if(baseButton && (baseButton->getType()==CCtrlBaseButton::ToggleButton)) - baseButton->setPushed(false); - } - } - } - } - } -}; -REGISTER_ACTION_HANDLER (CAHScenarioControl, "init_scenario_control"); - - -// *************************************************************************** -class CAHScenarioInformation : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &Params) - { - nlinfo("CAHScenarioDescription called"); - - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CInterfaceGroup* scenarioWnd = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:r2ed_scenario_control")); - if(!scenarioWnd) return; - - CInterfaceElement *result = scenarioWnd->findFromShortId(string("scenario_value_text")); - if(result) - { - CViewText* viewText= dynamic_cast(result); - - if(viewText) - { - ScenarioFileName = getParam(Params, "ScenarioName"); - setScenarioInformation(scenarioWnd, ScenarioFileName); - - string scenarioName = ScenarioFileName; - string::size_type posScenarioName = 0; - while(posScenarioName!=string::npos) - { - scenarioName = scenarioName.substr(posScenarioName==0?posScenarioName:posScenarioName+1); - posScenarioName = scenarioName.find('/'); - } - viewText->setText(scenarioName); - } - } - - // active description and information - result = scenarioWnd->findFromShortId(string("scenario_info_prop")); - if(result) - result->setActive(true); - - result = scenarioWnd->findFromShortId(string("description_gr")); - if(result) - result->setActive(true); - } -}; -REGISTER_ACTION_HANDLER (CAHScenarioInformation, "scenario_information"); - -// *************************************************************************** -class CAHHideCharsFilters : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) - { - nlinfo("CAHHideCharsFilters called"); - - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CInterfaceGroup* scenarioWnd = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:r2ed_scenario_control")); - if(!scenarioWnd) return; - - bool lookingForPlayers = true; - CInterfaceElement *result = scenarioWnd->findFromShortId(string("global_access_toggle_butt")); - if(result) - { - CCtrlBaseButton * baseButton = dynamic_cast(result); - if(baseButton) - lookingForPlayers = !baseButton->getPushed(); // warning : on / off textures are inverted !!! - } - - result = scenarioWnd->findFromShortId(string("access_body_gr")); - if(result) - result->setActive(lookingForPlayers); - - result = scenarioWnd->findFromShortId(string("sep_global_access")); - if(result) - result->setActive(lookingForPlayers); - - result = scenarioWnd->findFromShortId(string("auto_invite_label")); - if(result) - result->setActive(lookingForPlayers); - - result = scenarioWnd->findFromShortId(string("auto_invite_toggle_butt")); - if(result) - result->setActive(lookingForPlayers); - - result = scenarioWnd->findFromShortId(string("invite_team")); - if(result) - { - bool team = (NLGUI::CDBManager::getInstance()->getDbProp("SERVER:USER:TEAM_MEMBER")->getValue8())!=0; - team = (team && !(R2::getEditor().isInitialized()) && lookingForPlayers); - result->setActive(team); - } - } -}; -REGISTER_ACTION_HANDLER (CAHHideCharsFilters, "hide_chars_filters"); - -// *************************************************************************** -class CAHLoadScenario : public IActionHandler -{ - virtual void execute (CCtrlBase *pCaller, const string &/* Params */) - { - nlinfo("CAHLoadScenario called"); - - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CInterfaceGroup* scenarioWnd = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:r2ed_scenario_control")); - if(!scenarioWnd) return; - - CInterfaceElement *result = NULL; - - // load scenario - if(!R2::getEditor().isInitialized()) - { - R2::CEditor::setStartingAnimationFilename(ScenarioFileName); - } - - // description - string description; - result = scenarioWnd->findFromShortId(string("edit_small_description")); - if(result) - { - CGroupEditBox* editBox = dynamic_cast(result); - if(editBox) - description = editBox->getInputString().toString(); - } - - // races - map races; - races["fyros"] = false; - races["matis"] = false; - races["tryker"] = false; - races["zorai"] = false; - for(map::iterator itRace=races.begin(); itRace!=races.end(); itRace++) - { - result = scenarioWnd->findFromShortId(itRace->first); - if(result) - { - CInterfaceGroup * group = dynamic_cast(result); - if(group) - { - result = group->findFromShortId(string("toggle_butt")); - if(result) - { - CCtrlBaseButton * baseButton = dynamic_cast(result); - if(baseButton) - itRace->second = !baseButton->getPushed(); - } - } - } - } - - // religion - map religions; - religions["kami"] = false; - religions["karavan"] = false; - religions["neutral"] = false; - for(map::iterator itReligion=religions.begin(); itReligion!=religions.end(); itReligion++) - { - result = scenarioWnd->findFromShortId(itReligion->first); - if(result) - { - CInterfaceGroup * group = dynamic_cast(result); - if(group) - { - result = group->findFromShortId(string("toggle_butt")); - if(result) - { - CCtrlBaseButton * baseButton = dynamic_cast(result); - if(baseButton) - itReligion->second = !baseButton->getPushed(); - } - } - } - } - - // guild - bool anyPlayer = false; - result = scenarioWnd->findFromShortId(string("guild_gr")); - if(result) - { - CInterfaceGroup * group = dynamic_cast(result); - if(group) - { - result = group->findFromShortId(string("toggle_butt")); - if(result) - { - CCtrlBaseButton * baseButton = dynamic_cast(result); - if(baseButton) - anyPlayer = !baseButton->getPushed(); - } - } - } - - // shards - std::vector shards(Mainlands.size(), false); - for(uint i=0; ifindFromShortId(toString(Mainlands[i].Id)); - if(result) - { - CInterfaceGroup * group = dynamic_cast(result); - if(group) - { - result = group->findFromShortId(string("toggle_butt")); - if(result) - { - CCtrlBaseButton * baseButton = dynamic_cast(result); - if(baseButton) - shards[i] = !baseButton->getPushed(); - } - } - } - } - - // levels - map levels; - levels["20"] = false; - levels["50"] = false; - levels["100"] = false; - levels["150"] = false; - levels["200"] = false; - levels["250"] = false; - for(map::iterator itLevel=levels.begin(); itLevel!=levels.end(); itLevel++) - { - result = scenarioWnd->findFromShortId(itLevel->first); - if(result) - { - CInterfaceGroup * group = dynamic_cast(result); - if(group) - { - result = group->findFromShortId(string("toggle_butt")); - if(result) - { - CCtrlBaseButton * baseButton = dynamic_cast(result); - if(baseButton) - itLevel->second = !baseButton->getPushed(); - } - } - } - } - - // global access - bool globalAccess = false; - result = scenarioWnd->findFromShortId(string("global_access_toggle_butt")); - if(result) - { - CCtrlBaseButton * baseButton = dynamic_cast(result); - if(baseButton) - globalAccess = !baseButton->getPushed(); - } - - // auto invite - bool autoInvite = false; - result = scenarioWnd->findFromShortId(string("auto_invite_toggle_butt")); - if(result) - { - CCtrlBaseButton * baseButton = dynamic_cast(result); - if(baseButton) - autoInvite = !baseButton->getPushed(); - } - - // invite your team - bool inviteTeam = false; - result = scenarioWnd->findFromShortId(string("team_toggle_butt")); - if(result) - { - CCtrlBaseButton * baseButton = dynamic_cast(result); - if(baseButton) - inviteTeam = !baseButton->getPushed(); - } - - bool launchScenarioFromRingAccessPoint = false; - - vector< pair< string, string > > values; - if(R2::getEditor().isInitialized()) - { - values = R2::getEditor().getDMC().getEditionModule().getScenarioHeader(); - } - else - { - R2::CScenarioValidator sv; - std::string md5, signature; - sv.setScenarioToLoad(ScenarioFileName, values, md5, signature, false); - launchScenarioFromRingAccessPoint = true; - } - - string rules, level, title; - string initialIsland, initialEntryPoint, initialSeason; - std::string lang, scenarioType; - std::string otherCharAccess; - std::string nevraxScenario = "0"; - std::string trialAllowed = "0"; - for(uint i=0; i pair = values[i]; - - if(pair.first == "Rules") rules = pair.second; - else if(pair.first == "Level") level = pair.second; - else if(pair.first == "Title") title = pair.second; - else if(pair.first == "InitialIsland") initialIsland = pair.second; - else if(pair.first == "InitialEntryPoint") initialEntryPoint = pair.second; - else if(pair.first == "InitialSeason") initialSeason = pair.second; - else if(pair.first == "Language") lang = pair.second; - else if(pair.first == "Type") scenarioType = pair.second; - else if(pair.first == "OtherCharAccess") otherCharAccess = pair.second; - else if(pair.first == "NevraxScenario") nevraxScenario = pair.second; - else if(pair.first == "TrialAllowed") trialAllowed = pair.second; - } - - uint nLevel; - fromString(level, nLevel); - R2::TSessionLevel sessionLevel = R2::TSessionLevel::TValues(nLevel/50 + 1); - - // ---- fix for old scenarii - if (lang == "French") - lang = "fr"; - else if (lang == "German" || lang == "Deutsch") - lang = "de"; - else //if (lang == "English") - lang = "en"; - - if (nlstricmp(scenarioType, "Roleplay") == 0 || nlstricmp(scenarioType, "Role play") == 0) - scenarioType = "so_story_telling"; - else if (nlstricmp(scenarioType, "Combat") == 0) - scenarioType = "so_hack_slash"; - // -------------------------- - - TRuleType ruleType(TRuleType::rt_strict); - if(rules==CI18N::get("uiR2EDliberal").toString()) - ruleType = TRuleType(TRuleType::rt_liberal); - else if(rules == CI18N::get("uiR2EDstrict").toString()) - ruleType = TRuleType(TRuleType::rt_strict); - volatile static bool override = false; - if (override) - { - if(rules== "Masterless") - ruleType = TRuleType(TRuleType::rt_liberal); - else if(rules == "Mastered") - ruleType = TRuleType(TRuleType::rt_strict); - } - - TRaceFilter raceFilter; - if(races["fyros"]) - raceFilter.setEnumValue(TRaceFilterEnum::rf_fyros); - if(races["matis"]) - raceFilter.setEnumValue(TRaceFilterEnum::rf_matis); - if(races["tryker"]) - raceFilter.setEnumValue(TRaceFilterEnum::rf_tryker); - if(races["zorai"]) - raceFilter.setEnumValue(TRaceFilterEnum::rf_zorai); - - TReligionFilter religionFilter; - if(religions["kami"]) - religionFilter.setEnumValue(TReligionFilterEnum::rf_kami); - if(religions["karavan"]) - religionFilter.setEnumValue(TReligionFilterEnum::rf_karavan); - if(religions["neutral"]) - religionFilter.setEnumValue(TReligionFilterEnum::rf_neutral); - - TGuildFilter guildFilter(anyPlayer?TGuildFilter::gf_any_player:TGuildFilter::gf_only_my_guild); - - TShardFilter shardFilter; - for (uint i = 0; i < shards.size(); ++i) - { - if (shards[i]) shardFilter.setEnumValue((RSMGR::TShardFilterEnum::TValues) (1<getDbProp("SERVER:USER:IS_NEWBIE")->getValueBool(); - if (FreeTrial && noob && (nevraxScenario != "1" || trialAllowed != "1")) - { - CViewText* pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:warning_free_trial:text")); - if (pVT != NULL) - pVT->setText(CI18N::get("uiRingWarningFreeTrial")); - CAHManager::getInstance()->runActionHandler("enter_modal", pCaller, "group=ui:interface:warning_free_trial"); - - return; - } - } - - - if(R2::getEditor().getAccessMode()!=R2::CEditor::AccessDM) - { - if (launchScenarioFromRingAccessPoint) - { - // hibernate Edit Session if active - sessionBrowser.hibernateEditSession(charId); - if(!sessionBrowser.waitOneMessage(sessionBrowser.getMessageName("on_invokeResult"))) - { - nlwarning("hibernateEditSession callback return false"); - } - - } - - // schedule session - bool launchSuccess = true; - sessionBrowser.scheduleSession(charId, TSessionType::st_anim, - title, description, sessionLevel, - /*TAccessType::at_public,*/ ruleType, TEstimatedDuration::et_medium, 0, TAnimMode::am_dm, - raceFilter, religionFilter, guildFilter, shardFilter, levelFilter, lang, RSMGR::TSessionOrientation(scenarioType), - !globalAccess, autoInvite); - - if(sessionBrowser.waitOneMessage(sessionBrowser.getMessageName("on_scheduleSessionResult"))) - { - if(sessionBrowser._LastScheduleSessionResult==0) - { - // start session - sessionBrowser.startSession(sessionBrowser._LastScheduleSessionCharId, - sessionBrowser._LastScheduleSessionId); - - if(sessionBrowser.waitOneMessage(sessionBrowser.getMessageName("on_invokeResult"))) - { - - if (launchScenarioFromRingAccessPoint) - { - if (!initialIsland.empty() && !initialEntryPoint.empty() && !initialSeason.empty()) - { - sessionBrowser.setSessionStartParams(charId, sessionBrowser._LastScheduleSessionId, initialIsland, initialEntryPoint, initialSeason); - } - } - - TSessionPartStatus sessionStatus; - if(ruleType==TRuleType::rt_liberal) - sessionStatus = TSessionPartStatus(TSessionPartStatus::sps_play_invited); - else - sessionStatus = TSessionPartStatus(TSessionPartStatus::sps_anim_invited); - - // invite player - sessionBrowser.inviteCharacter( - sessionBrowser._LastScheduleSessionCharId, - sessionBrowser._LastScheduleSessionId, - sessionBrowser._LastScheduleSessionCharId, - sessionStatus.toString()); - - if(sessionBrowser.waitOneMessage(sessionBrowser.getMessageName("on_invokeResult"))) - { - // request session - FarTP.requestFarTPToSession(sessionBrowser._LastScheduleSessionId, PlayerSelectedSlot, CFarTP::JoinSession, - !R2::getEditor().isInitialized()); - } - else - { - nlwarning("inviteCharacter callback return false"); - } - - if (sessionBrowser._LastInvokeResult != 0) - { - nlwarning("inviteCharacter callback use error values %d", sessionBrowser._LastInvokeResult); - } - - if(sessionBrowser._LastInvokeResult == 14) - { - CViewText* pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:warning_free_trial:text")); - if (pVT != NULL) - pVT->setText(CI18N::get("uiRingWarningFreeTrial")); - CAHManager::getInstance()->runActionHandler("enter_modal", pCaller, "group=ui:interface:warning_free_trial"); - } - - - // invite team - if(inviteTeam) - { - for (uint i = 0 ; i < 8 ; ++i) - { - uint32 val = NLGUI::CDBManager::getInstance()->getDbProp(NLMISC::toString("SERVER:GROUP:%d:NAME",i))->getValue32(); - if(val!=0) - { - STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); - ucstring res; - if (pSMC->getString(val,res)) - { - string charName = CEntityCL::removeTitleAndShardFromName(res).toString(); - sessionBrowser.inviteCharacterByName(sessionBrowser._LastScheduleSessionCharId, charName); - - if(!sessionBrowser.waitOneMessage(sessionBrowser.getMessageName("on_invokeResult"))) - { - nlwarning("inviteCharacterByName callback return false"); - } - - if(sessionBrowser._LastInvokeResult == 14) - { - CViewText* pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:warning_free_trial:text")); - if (pVT != NULL) - pVT->setText(CI18N::get("uiRingWarningInviteFreeTrial")); - CAHManager::getInstance()->runActionHandler("enter_modal", pCaller, "group=ui:interface:warning_free_trial"); - } - } - } - } - } - } - else - { - nlwarning("startSession callback return false"); - launchSuccess = false; - } - } - else if(sessionBrowser._LastScheduleSessionResult==10) - { - pIM->messageBoxWithHelp(CI18N::get("uiRingWarningBanishedPlayer")); - } - else - { - launchSuccess=false; - } - } - else - { - nlwarning("scheduleSession callback return false"); - launchSuccess = false; - } - - if(!launchSuccess) - { - pIM->messageBoxWithHelp(CI18N::get("uiRingLaunchScenarioError")); - } - else - { - scenarioWnd->setActive(false); - } - } - else - { - // update session - sessionBrowser.updateSessionInfo(charId, sessionBrowser._LastScheduleSessionId, title, 0, description, sessionLevel, - /*TAccessType::at_public, */TEstimatedDuration::et_medium, 0, raceFilter, religionFilter, - guildFilter, shardFilter, levelFilter, !globalAccess, autoInvite, lang, RSMGR::TSessionOrientation(scenarioType)); - - if(!sessionBrowser.waitOneMessage(sessionBrowser.getMessageName("on_invokeResult"))) - { - nlwarning("updateSessionInfo callback return false"); - pIM->messageBoxWithHelp(CI18N::get("uiRingUpdateScenarioFiltersError")); - } - else - { - scenarioWnd->setActive(false); - } - } - } -}; -REGISTER_ACTION_HANDLER (CAHLoadScenario, "load_scenario"); - - -// *************************************************************************** -class CAHOpenRingSessions : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) - { - if(!R2::getEditor().isInitialized()) - { - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CInterfaceGroup* ringSessionsWnd = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:ring_sessions")); - if(!ringSessionsWnd) return; - ringSessionsWnd->setActive(true); - } - } -}; -REGISTER_ACTION_HANDLER (CAHOpenRingSessions, "open_ring_sessions"); - -// *************************************************************************** -class CAHInitImportCharacter : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) - { - CInterfaceGroup *list = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_CHARACTER)); - if (!list) - { - nlwarning("element " GROUP_LIST_CHARACTER " not found probably bad outgame.xml"); - return; - } - - // retrieve saved files - std::vector savedCharacters; - CPath::getPathContent("save/", false, false, true, savedCharacters); - - CInterfaceGroup *newLine; - CInterfaceGroup *prevLine; - - for (uint i = 0; i < savedCharacters.size(); ++i) - { - // search saved characters only - if (testWildCard(CFile::getFilename(savedCharacters[i]), "character_*.save")) - { - const std::string id = CFile::getFilenameWithoutExtension(savedCharacters[i]).substr(strlen("character_")); - if (id.empty()) - continue; - - std::vector> params; - params.clear(); - params.push_back(std::pair("id", id)); - // adjust ref - if (list->getNumGroup() > 0) - params.push_back(std::pair("posref", "BL TL")); - - newLine = CWidgetManager::getInstance()->getParser()->createGroupInstance("t_import", GROUP_LIST_CHARACTER, params); - if (newLine) - { - CViewText *text = dynamic_cast(newLine->getView("name")); - if (text) - text->setText(ucstring(savedCharacters[i])); - - // first button is pushed - CCtrlButton *button = dynamic_cast(newLine->getCtrl("but")); - if (button && list->getNumGroup() == 0) - button->setPushed(true); - - // add to the list now - newLine->setParent(list); - newLine->setParentSize(list); - newLine->setParentPos(prevLine); - - list->addGroup(newLine); - - prevLine = newLine; - } - } - } - // none case - if (list->getNumGroup() == 0) - CLuaManager::getInstance().executeLuaScript("outgame:procCharselNotifaction(3)"); - - list->invalidateCoords(); - } -}; -REGISTER_ACTION_HANDLER( CAHInitImportCharacter, "import_char_init" ); - -// *************************************************************************** -class CAHResetImportCharacter : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) - { - CInterfaceGroup *list = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_CHARACTER)); - if (list) - list->clearGroups(); - - if (!ImportCharacter.empty()) - ImportCharacter = ""; - } -}; -REGISTER_ACTION_HANDLER( CAHResetImportCharacter, "import_char_reset" ); - -// *************************************************************************** -class CAHSelectImportCharacter : public IActionHandler -{ - virtual void execute (CCtrlBase *pCaller, const std::string &Params) - { - struct CUnpush : public CInterfaceElementVisitor - { - CCtrlBase *Ref; - virtual void visitCtrl(CCtrlBase *ctrl) - { - if (ctrl == Ref) return; - CCtrlBaseButton *but = dynamic_cast(ctrl); - if (but) - { - but->setPushed(false); - } - } - }; - CInterfaceGroup *list = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_CHARACTER)); - if (!list) - return; - - // unselect - if (Params.empty()) - { - CUnpush unpusher; - unpusher.Ref = pCaller; - list->visit(&unpusher); - } - - // now select - std::string name; - if (Params.empty()) - { - CCtrlButton *pCB = dynamic_cast(pCaller); - if (!pCB) - return; - - std::string id = pCB->getId(); - id = id.substr(0, id.rfind(':')); - - if (!fromString(id.substr(id.rfind(':')+1, id.size()), name)) - return; - - pCB->setPushed(true); - } - else - if (!fromString(Params, name)) - return; - - ImportCharacter = ""; - // check filename and store - if (CFile::fileExists(toString("save/character_%s.save", name.c_str()))) - ImportCharacter = name; - } -}; -REGISTER_ACTION_HANDLER( CAHSelectImportCharacter, "import_char_select" ); - -// *************************************************************************** -class CAHImportCharacter : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) - { - if (ImportCharacter.empty()) - return; - - if (!CFile::fileExists(toString("save/character_%s.save", ImportCharacter.c_str()))) - return; - - bool success = false; - - CIFile fd; - CCharacterSummary CS; - // use temporary file until close() - if (fd.open(toString("save/character_%s.save", ImportCharacter.c_str()))) - { - try - { - CS.serial(fd); - SCharacter3DSetup::setupDBFromCharacterSummary("UI:TEMP:CHAR3D", CS); - - // validate import - CDBManager::getInstance()->getDbProp("UI:TEMP:IMPORT")->setValue32(1); - success = true; - } - catch (const EStream &e) - { - nlwarning(e.what()); - } - fd.close(); - } - else - nlwarning("Failed to open file: save/character_%s.save", ImportCharacter.c_str()); - - // user notification - if (!success) - CLuaManager::getInstance().executeLuaScript("outgame:procCharselNotifaction(2)"); - else - CAHManager::getInstance()->runActionHandler("proc", NULL, "proc_charsel_create_new"); - } -}; -REGISTER_ACTION_HANDLER( CAHImportCharacter, "import_char" ); - -// *************************************************************************** -class CAHExportCharacter : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const std::string &Params) - { - if (Params.empty()) - return; - - sint32 slot = -1; - if (!fromString(getParam(Params, "slot"), slot)) - return; - - if (slot >= CharacterSummaries.size() || slot < 0) - return; - - // retrieve infos - CCharacterSummary &CS = CharacterSummaries[slot]; - if (CS.Name.empty()) - return; - - // extract name - const std::string name = buildPlayerNameForSaveFile(CS.Name.toString()); - - COFile fd; - bool success = false; - // use temporary file until close() - if (fd.open(toString("save/character_%s.save", name.c_str()), false, false, true)) - { - try - { - fd.serial(CS); - fd.flush(); - // validate - success = true; - } - catch (const EStream &e) - { - nlwarning(e.what()); - } - fd.close(); - } - else - nlwarning("Failed to open file: save/character_%s.save", name.c_str()); - - const uint8 val = (success == true) ? 0 : 1; - // user notification - CLuaManager::getInstance().executeLuaScript(toString("outgame:procCharselNotifaction(%i)", val)); - } -}; -REGISTER_ACTION_HANDLER( CAHExportCharacter, "export_char" ); diff --git a/code/ryzom/client/src/far_tp.cpp b/code/ryzom/client/src/far_tp.cpp deleted file mode 100644 index 1c2a6e612..000000000 --- a/code/ryzom/client/src/far_tp.cpp +++ /dev/null @@ -1,1522 +0,0 @@ -// Ryzom - MMORPG Framework -// Copyright (C) 2010-2011 Winch Gate Property Limited -// -// This source file has been modified by the following contributors: -// Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2014-2016 Jan BOON (Kaetemi) -// -// 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 "nel/3d/u_driver.h" -#include "far_tp.h" -#include "net_manager.h" -#include "connection.h" -#include "interface_v3/interface_manager.h" -#include "login_patch.h" -#include "init_main_loop.h" -#include "weather.h" -#include "time_client.h" -#include "timed_fx_manager.h" -#include "world_database_manager.h" -#include "continent_manager.h" -#include "user_entity.h" -#include "entities.h" -#include "interface_v3/input_handler_manager.h" -#include "interface_v3/bot_chat_page_all.h" -#include "sound_manager.h" -#include "actions_client.h" -#include "r2/editor.h" -#include "global.h" -#include "release.h" -#include "nel/misc/string_conversion.h" -#include "debug_client.h" -#include "session_browser_impl.h" -#include "game_share/security_check.h" -#include "client_chat_manager.h" -#include "bg_downloader_access.h" -#include "login_progress_post_thread.h" -#include "interface_v3/action_handler_base.h" -#include "item_group_manager.h" -#include "nel/misc/cmd_args.h" - -#ifdef DEBUG_NEW -#define new DEBUG_NEW -#endif - -using namespace NLMISC; -using namespace NLNET; -using namespace NL3D; -using namespace RSMGR; -using namespace R2; - -extern CClientChatManager ChatMngr; -extern CVariable SBSPortOffset; - -// *************************************************************************** -// Login state machine -// *************************************************************************** - -// Adapted from "nel/misc/string_conversion.h" -#define NL_BEGIN_CLASS_STRING_CONVERSION_TABLE(__class, __type) \ -static const NLMISC::CStringConversion<__class::__type>::CPair __type##_nl_string_conversion_table[] = \ -{ -#define NL_END_CLASS_STRING_CONVERSION_TABLE(__class, __type, __tableName, __defaultValue) \ -}; \ -NLMISC::CStringConversion<__class::__type> \ -__tableName(__type##_nl_string_conversion_table, sizeof(__type##_nl_string_conversion_table) \ - / sizeof(__type##_nl_string_conversion_table[0]), __class::__defaultValue); -#define NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(__class, val) { #val, __class::val}, - - -NL_BEGIN_CLASS_STRING_CONVERSION_TABLE (CLoginStateMachine, TState) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, st_start) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, st_login) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, st_auto_login) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, st_shard_list) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, st_start_config) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, st_scan_data) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, st_display_eula) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, st_check_patch) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, st_display_cat) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, st_patch) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, st_close_client) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, st_reboot_screen) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, st_restart_client) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, st_connect) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, st_browser_screen) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, st_ingame) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, st_leave_shard) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, st_enter_far_tp_main_loop) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, st_disconnect) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, st_reconnect_fs) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, st_reconnect_select_char) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, st_reconnect_ready) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, st_exit_global_menu) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, st_reconnect_error) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, st_create_account) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, st_end) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, st_unknown) -NL_END_CLASS_STRING_CONVERSION_TABLE(CLoginStateMachine, TState, StateConversion, st_unknown) - -NL_BEGIN_CLASS_STRING_CONVERSION_TABLE (CLoginStateMachine, TEvent) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, ev_quit) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, ev_skip_all_login) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, ev_init_done) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, ev_game_conf) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, ev_data_scan) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, ev_close_data_scan) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, ev_login_ok) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, ev_bad_login) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, ev_shard_selected) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, ev_patch_needed) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, ev_no_patch) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, ev_run_patch) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, ev_close_patch) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, ev_accept_eula) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, ev_decline_eula) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, ev_reboot) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, ev_ingame_return) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, ev_far_tp_main_loop_entered) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, ev_connect) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, ev_conn_failed) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, ev_conn_dropped) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, ev_enter_game) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, ev_self_reconnected) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, ev_chars_received) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, ev_no_user_char) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, ev_ready_received) -// NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, ev_reselect_char) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, ev_reconnect_ok_received) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, ev_global_menu_exited) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, ev_relog) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, ev_create_account) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, ev_close_create_account) - NL_CLASS_STRING_CONVERSION_TABLE_ENTRY(CLoginStateMachine, ev_unknown) -NL_END_CLASS_STRING_CONVERSION_TABLE(CLoginStateMachine, TEvent, EventConversion, ev_unknown) - -//----------------------------------------------- -// toString : -//----------------------------------------------- -const std::string& CLoginStateMachine::toString(CLoginStateMachine::TState state) -{ - return StateConversion.toString(state); -} - -//----------------------------------------------- -// toString : -//----------------------------------------------- -const std::string& CLoginStateMachine::toString(CLoginStateMachine::TEvent event) -{ - return EventConversion.toString(event); -} - - -#define SM_BEGIN_EVENT_TABLE \ - for(;!isTerminationRequested();) \ - { \ - TEvent ev = waitEvent(); \ - -#define SM_END_EVENT_TABLE \ - } \ - -/* -#define SM_EVENT(eventId, stateId) \ - if (ev == eventId) \ - { \ - try \ - { \ - COFile outputF; \ - string sLog = NLMISC::toString("[%s] %s -> %s\n", CLoginStateMachine::toString(ev).c_str(), CLoginStateMachine::toString(_CurrentState).c_str(), CLoginStateMachine::toString(stateId).c_str()); \ - if ( outputF.open( getLogDirectory() + "error_join.log", true, true ) ) \ - { \ - outputF.serialBuffer( (uint8*)(&sLog[0]), (uint)sLog.size() ); \ - outputF.close(); \ - } \ - } \ - catch (const Exception &) \ - {} \ - _CurrentState = stateId; \ - break; \ - } \ -*/ - -#define SM_EVENT(eventId, stateId) \ - if (ev == eventId) \ - { \ - _CurrentState = stateId; \ - break; \ - } \ - -extern std::string LoginLogin, LoginPassword, LoginCustomParameters; -extern bool noUserChar; -extern bool userChar; -extern bool serverReceivedReady; -extern bool CharNameValidArrived; -extern bool FirstFrame; -extern bool IsInRingSession; - -extern void selectTipsOfTheDay (uint tips); -#define BAR_STEP_TP 2 - -extern NLMISC::CCmdArgs Args; - -CLoginStateMachine::TEvent CLoginStateMachine::waitEvent() -{ - nlassert(CCoTask::getCurrentTask() == this); - - while (_NextEvents.empty() && !isTerminationRequested()) - { - // wait until someone push an event on the state machine - yield(); - - if (isTerminationRequested()) - return ev_quit; - } - - TEvent ev = _NextEvents.front(); - _NextEvents.pop_front(); - - return ev; -} - -void CLoginStateMachine::pushEvent(TEvent eventId) -{ - // set the next event - _NextEvents.push_back(eventId); - - if (CCoTask::getCurrentTask() != this) - { - /// resume the state machine to advance state - resume(); - } -} - - -void CLoginStateMachine::run() -{ - // state machine coroutine - - while (_CurrentState != st_end && !isTerminationRequested()) - { - switch(_CurrentState) - { - case st_start: - /// initial state - - if (!ClientCfg.TestBrowser) - { - if (LoginPassword.empty()) - { - if (!LoginCustomParameters.empty() && LoginLogin.empty()) - { - // alternate login procedure - SM_BEGIN_EVENT_TABLE - SM_EVENT(ev_init_done, st_alt_login); - SM_EVENT(ev_skip_all_login, st_ingame); - SM_EVENT(ev_quit, st_end); - SM_END_EVENT_TABLE - } - else - { - // standard procedure - SM_BEGIN_EVENT_TABLE - SM_EVENT(ev_init_done, st_login); - SM_EVENT(ev_skip_all_login, st_ingame); - SM_EVENT(ev_quit, st_end); - SM_END_EVENT_TABLE - } - } - else - { - // login 2, bypass the login screen - SM_BEGIN_EVENT_TABLE - SM_EVENT(ev_init_done, st_auto_login); - SM_EVENT(ev_skip_all_login, st_ingame); - SM_EVENT(ev_quit, st_end); - SM_END_EVENT_TABLE - - } - } -// else -// { -// // browser test mode -// SM_BEGIN_EVENT_TABLE -// SM_EVENT(ev_init_done, st_browser_screen); -// SM_EVENT(ev_quit, st_end); -// SM_END_EVENT_TABLE -// } - - break; - case st_login: - /// display login screen and options - { - initLoginScreen(); - - if (ClientCfg.R2Mode) - { - // r2 mode - SM_BEGIN_EVENT_TABLE - SM_EVENT(ev_login_ok, st_check_patch); - SM_EVENT(ev_game_conf, st_start_config); - SM_EVENT(ev_data_scan, st_scan_data); - SM_EVENT(ev_create_account, st_create_account); - SM_EVENT(ev_bad_login, st_login); - SM_EVENT(ev_quit, st_end); - SM_END_EVENT_TABLE - } - else - { - // legacy mode - SM_BEGIN_EVENT_TABLE - SM_EVENT(ev_login_ok, st_shard_list); - SM_EVENT(ev_game_conf, st_start_config); - SM_EVENT(ev_data_scan, st_scan_data); - SM_EVENT(ev_create_account, st_create_account); - SM_EVENT(ev_bad_login, st_login); - SM_EVENT(ev_quit, st_end); - SM_END_EVENT_TABLE - } - } - break; - case st_auto_login: - initAutoLogin(); - -// if (ClientCfg.R2Mode) - { - // r2 mode - SM_BEGIN_EVENT_TABLE - SM_EVENT(ev_login_ok, st_check_patch); - SM_EVENT(ev_quit, st_end); - SM_END_EVENT_TABLE - } -// else -// { -// // legacy mode -// SM_BEGIN_EVENT_TABLE -// SM_EVENT(ev_login_ok, st_check_patch); -// SM_EVENT(ev_quit, st_end); -// SM_END_EVENT_TABLE -// } - break; - case st_alt_login: - initAltLogin(); - -// if (ClientCfg.R2Mode) - { - // r2 mode - SM_BEGIN_EVENT_TABLE - SM_EVENT(ev_login_not_alt, st_login); - SM_EVENT(ev_login_ok, st_check_patch); - SM_EVENT(ev_quit, st_end); - SM_END_EVENT_TABLE - } -// else -// { -// // legacy mode -// SM_BEGIN_EVENT_TABLE -// SM_EVENT(ev_login_ok, st_check_patch); -// SM_EVENT(ev_quit, st_end); -// SM_END_EVENT_TABLE -// } - break; - case st_shard_list: - /// display the shard list - initShardDisplay(); - - SM_BEGIN_EVENT_TABLE - SM_EVENT(ev_shard_selected, st_check_patch); - SM_EVENT(ev_quit, st_end); - SM_END_EVENT_TABLE - - break; - case st_start_config: - /// launch the configurator and close ryzom - break; - case st_scan_data: - /// run the check data thread - initDataScan(); - - SM_BEGIN_EVENT_TABLE - SM_EVENT(ev_close_data_scan, st_login); - SM_EVENT(ev_quit, st_end); - SM_END_EVENT_TABLE - - break; - case st_create_account: - - if (initCreateAccount()) - { - SM_BEGIN_EVENT_TABLE - SM_EVENT(ev_login_ok, st_check_patch); - SM_EVENT(ev_close_create_account, st_login); - SM_EVENT(ev_quit, st_end); - SM_END_EVENT_TABLE - } - else - { - // return to login menu if an error occurred - _CurrentState = st_login; - } - - break; - case st_display_eula: - { - /// display the eula and wait for validation - - if (ClientCfg.SkipEULA) - { - // we don't want to see eula, auto accept - pushEvent(ev_accept_eula); - } - - bool mustReboot = false; - - if (isBGDownloadEnabled()) - { - mustReboot = CBGDownloaderAccess::getInstance().mustLaunchBatFile(); - } - else - { - mustReboot = CPatchManager::getInstance()->mustLaunchBatFile(); - } - - if (mustReboot) - { - // skip eula and show reboot screen - _CurrentState = st_reboot_screen; - break; - } - - initEula(); - -// Login sequence was reordered -// if (ClientCfg.R2Mode) -// { -// // ring mode -// SM_BEGIN_EVENT_TABLE -// SM_EVENT(ev_accept_eula, st_browser_screen); -// SM_EVENT(ev_quit, st_end); -// SM_END_EVENT_TABLE -// } -// else -// { -// // legacy mode - SM_BEGIN_EVENT_TABLE - SM_EVENT(ev_accept_eula, st_connect); - SM_EVENT(ev_quit, st_end); - SM_END_EVENT_TABLE -// } - } - break; - case st_check_patch: - /// check the data to check if patch needed - CLoginProgressPostThread::getInstance().step(CLoginStep(LoginStep_PostLogin, "login_step_post_login")); - - if (!ClientCfg.PatchWanted || (Args.haveArg("n") && Args.getLongArg("nopatch").front() == "1")) - { - // client don't want to be patched ! - _CurrentState = st_display_eula; - break; - } - - initPatchCheck(); - SM_BEGIN_EVENT_TABLE - if (isBGDownloadEnabled()) - { - SM_EVENT(ev_patch_needed, st_patch); // no choice for patch content when background downloader is used - } - else - { - SM_EVENT(ev_patch_needed, st_display_cat); - } - SM_EVENT(ev_no_patch, st_display_eula); - SM_EVENT(ev_quit, st_end); - SM_END_EVENT_TABLE - - break; - case st_display_cat: - initCatDisplay(); - - SM_BEGIN_EVENT_TABLE - SM_EVENT(ev_run_patch, st_patch); - SM_EVENT(ev_quit, st_end); - SM_END_EVENT_TABLE - - break; - case st_patch: - /// run the patch process and display progress - initPatch(); - - SM_BEGIN_EVENT_TABLE - SM_EVENT(ev_close_patch, st_display_eula); - SM_EVENT(ev_quit, st_end); - SM_END_EVENT_TABLE - break; - case st_close_client: - /// terminate the client and quit - break; - case st_reboot_screen: - /// display the reboot screen and wait validation - initReboot(); - - SM_BEGIN_EVENT_TABLE - SM_EVENT(ev_reboot, st_end); - SM_EVENT(ev_quit, st_end); - SM_END_EVENT_TABLE - - break; - case st_restart_client: - /// restart the client with login bypass params - break; - case st_connect: - /// connect to the FS (start the 'in game' mode) - ConnectToShard(); - - if (ClientCfg.R2Mode) - { - SM_BEGIN_EVENT_TABLE - SM_EVENT(ev_enter_game, st_ingame); - SM_END_EVENT_TABLE - } - else - { - SM_BEGIN_EVENT_TABLE - SM_EVENT(ev_enter_game, st_end); - SM_EVENT(ev_conn_failed, st_shard_list); - SM_END_EVENT_TABLE - } - break; -// case st_browser_screen: -// /// show the outgame browser -// -// if (!ClientCfg.TestBrowser) -// { -// // in test browser mode, the browser is already init -// initWebBrowser(); -// } -// -// SM_BEGIN_EVENT_TABLE -// SM_EVENT(ev_connect, st_connect); -// SM_EVENT(ev_relog, st_login); -// SM_EVENT(ev_quit, st_end); -// SM_END_EVENT_TABLE -// -// break; - case st_ingame: - SM_BEGIN_EVENT_TABLE - //SM_EVENT(ev_chars_received, st_ingame); // ignored for normal login procedure - //SM_EVENT(ev_no_user_char, st_ingame); // " - //SM_EVENT(ev_ready_received, st_ingame); // " - //SM_EVENT(ev_global_menu_exited, st_ingame); " - SM_EVENT(ev_connect, st_leave_shard); // connect to another shard - SM_END_EVENT_TABLE - break; - case st_leave_shard: - /* - * Far TP / Server Hop / Reselect character entry point - */ - - // Server Hop part 1: We are not in main loop but still at character selection - // => make a hop to the specified server without doing anything with interface - // Far TP part 1.1: From the ingame main loop, the admin html box gives us an event ev_connect for the destination shard. - // Note: the admin html box is run by CInputHandlerManager::getInstance()->pumpEvents() in the main loop. - // Tip: to see where a co-task is resumed from, just add a breakpoint on the end of CCoTask::resume(). - CAHManager::getInstance()->runActionHandler("quit_ryzom", NULL, ""); - - if (!FarTP.isIngame()) // assumes there is no Far TP starting between char selection and main loop, see below - { - crashLogAddServerHopEvent(); - - FarTP.onServerQuitOk(); // don't wait for onServerQuitOK() because the EGS will no longer send it if it requests a Far TP during "select char" (not sending USER_CHAR) - - SM_BEGIN_EVENT_TABLE - SM_EVENT(ev_ingame_return, st_disconnect); - SM_END_EVENT_TABLE - } - else - { - if(FarTP.isReselectingChar()) - crashLogAddReselectPersoEvent(); - else - crashLogAddFarTpEvent(); - - if (NetMngr.getConnectionState() == CNetworkConnection::Disconnect) - FarTP.onServerQuitOk(); // don't wait for onServerQuitOK() because the EGS is down - - SM_BEGIN_EVENT_TABLE - SM_EVENT(ev_ingame_return, st_enter_far_tp_main_loop); - SM_EVENT(ev_enter_game, st_ingame); - SM_END_EVENT_TABLE - } - break; - case st_enter_far_tp_main_loop: - // if bgdownloader is used, then pause it - pauseBGDownloader(); - - - // Far TP part 1.2: let the main loop finish the current frame. - // This is called when CONNECTION:SERVER_QUIT_OK is received (from NetMngr.update() in main loop). - - SM_BEGIN_EVENT_TABLE - SM_EVENT(ev_far_tp_main_loop_entered, st_disconnect); - SM_END_EVENT_TABLE - break; - case st_disconnect: - // Far TP part 2: disconnect from the FS and unload shard-specific data (called from farTPmainLoop()) - // FarTP.disconnectFromPreviousShard(); - - SM_BEGIN_EVENT_TABLE - SM_EVENT(ev_connect, st_reconnect_fs); - SM_END_EVENT_TABLE - break; - case st_reconnect_fs: - // Server Hop part 3.1: connect to the new shard (called from globalMenu()) - // Far TP part 3.1: connect to the new shard (called from farTPmainLoop()) - FarTP.connectToNewShard(); - - SM_BEGIN_EVENT_TABLE - SM_EVENT(ev_self_reconnected, st_ingame); - SM_EVENT(ev_chars_received, st_reconnect_select_char); - SM_EVENT(ev_no_user_char, st_reconnect_error); - SM_EVENT(ev_conn_failed, st_reconnect_error); - SM_EVENT(ev_conn_dropped, st_reconnect_error); - SM_END_EVENT_TABLE - break; - case st_reconnect_select_char: - // Server Hop part 3.2: bypass character selection ui & select the same character. - // Far TP part 3.2: bypass character selection ui & select the same character. - // This is called from farTPmainloop(), when CONNECTION:USER_CHARS is received. - if( !FarTP.isReselectingChar() ) - { - FarTP.selectCharAndEnter(); - } - // Far TP part 3.2bis: see in farTPmainLoop() - - if (!FarTP.isIngame()) - { - SM_BEGIN_EVENT_TABLE - SM_EVENT(ev_ready_received, st_exit_global_menu); - SM_EVENT(ev_conn_dropped, st_reconnect_error); - SM_END_EVENT_TABLE - } - else - { - SM_BEGIN_EVENT_TABLE - SM_EVENT(ev_ready_received, st_reconnect_ready); - SM_EVENT(ev_conn_dropped, st_reconnect_error); - if ( FarTP.isReselectingChar() && (ev == ev_connect) ) - { - // Inside this Character Reselect we embed a new Server Hop - FarTP.beginEmbeddedServerHop(); - _CurrentState = st_leave_shard; - break; - } - SM_END_EVENT_TABLE - } - break; - case st_exit_global_menu: - // Server Hop part 3.3 - // Stay in Server Hop state until the global menu has been exited - SM_BEGIN_EVENT_TABLE - SM_EVENT(ev_global_menu_exited, FarTP.isServerHopEmbedded() ? st_reconnect_ready : st_ingame); - SM_END_EVENT_TABLE - break; - case st_reconnect_ready: - // Far TP part 3.3: send ready. - // This is called from farTPmainloop(), when CONNECTION:READY is received. - - if ( FarTP.isServerHopEmbedded() ) - FarTP.endEmbeddedServerHop(); - - SM_BEGIN_EVENT_TABLE - SM_EVENT(ev_enter_game, st_ingame); - SM_EVENT(ev_conn_dropped, st_reconnect_error); - SM_END_EVENT_TABLE - break; - case st_reconnect_error: - // Far TP failed - FarTP.onFailure(); - - SM_BEGIN_EVENT_TABLE - SM_EVENT(ev_quit, st_end); - SM_END_EVENT_TABLE - break; - default: - nlwarning("Unhandeled state"); - break; - } - } -} - - -// *************************************************************************** -// Far TP -// *************************************************************************** - -CFarTP FarTP; - -extern std::string CurrentCookie; -extern string ClientApp; - - -namespace R2 -{ - extern bool ReloadUIFlag; -} - - -/* - * requestFarTPToSession - */ -bool CFarTP::requestFarTPToSession(TSessionId sessionId, uint8 charSlot, CFarTP::TJoinMode joinMode, bool bailOutIfSessionVanished) -{ - if (_HookedForEditor) - { - // Redirect Far TP to editor instead of following instructions - _HookedForEditor = false; - return FarTP.requestFarTPToSession((TSessionId)0, charSlot, CFarTP::LaunchEditor, true); // allow bailing out in case of edition session not reachable - } - - // call the join session using the session browser interface - uint32 charId = (NetMngr.getLoginCookie().getUserId()<<4)+(0xf&charSlot); - - // Clean out for next Far TP - _SessionIdToJoinFast = 0; - - CSessionBrowserImpl &sb = CSessionBrowserImpl::getInstance(); - sb.init(NULL); -// sb.setAuthInfo(NetMngr.getLoginCookie()); -// sb.connectItf(CInetAddress("borisb", 80)); - - sb.CurrentJoinMode = joinMode; - // send the join session -// _JoinSessionResultReceived = false; - try - { - switch (joinMode) - { - case LaunchEditor: - { -retryJoinEdit: - TSessionId sessionId(0); - sb.joinEditSession(charId, ClientApp); - - bool ret = sb.waitOneMessage(CSessionBrowserImpl::getMessageName("on_joinSessionResult")); - - if (!ret) - throw "Protocol error"; - if (sb._LastJoinSessionResult == 2) - { - // the edit session did not exist, create a new one - sb.scheduleSession(charId, TSessionType::st_edit, "", "", TSessionLevel::sl_a, /*TAccessType::at_private, */TRuleType::rt_strict, TEstimatedDuration::et_long, 0, TAnimMode(), TRaceFilter(), TReligionFilter(), TGuildFilter(), TShardFilter(), TLevelFilter(), std::string(), TSessionOrientation(), true, true); - ret = sb.waitOneMessage(CSessionBrowserImpl::getMessageName("on_scheduleSessionResult")); - if (!ret || sb._LastScheduleSessionResult!= 0) throw "schedule error"; - sessionId = sb._LastScheduleSessionId; - - // invite the char in the session - sb.inviteCharacter(charId, sessionId, charId, TSessionPartStatus::sps_edit_invited); - ret = sb.waitOneMessage(CSessionBrowserImpl::getMessageName("on_invokeResult")); - if (!ret || sb._LastInvokeResult != 0) throw "Invitation Error"; - - // now, start the edit session - sb.startSession(charId, sessionId); - ret = sb.waitOneMessage(CSessionBrowserImpl::getMessageName("on_invokeResult")); - if (!ret || sb._LastInvokeResult != 0) throw "start session error"; - - // retry to join - goto retryJoinEdit; - } - else if (sb._LastJoinSessionResult == 15) - { - sessionId = sb._LastJoinSessionId; - // the session was closed, the SU has put it in planned state, start it - sb.startSession(charId, sessionId); - ret = sb.waitOneMessage(CSessionBrowserImpl::getMessageName("on_invokeResult")); - if (!ret || sb._LastInvokeResult != 0) throw "start session error (2), no DSS available"; - // retry to join - goto retryJoinEdit; - } - else if (sb._LastJoinSessionResult != 0) - { - // any other error are not recoverable from here - throw "join session error"; - } - - // ok, the join is accepted !, the other far TP work is done in the callback - } - break; - case JoinSession: - { - sb.joinSession(charId, sessionId, ClientApp); - - bool ret = sb.waitOneMessage(CSessionBrowserImpl::getMessageName("on_joinSessionResult")); - - if (!ret) - throw "Protocol error"; - if (sb._LastJoinSessionResult == 16) - { -// #pragma message (NL_LOC_WRN "inform the player that he is banned from the ring") - throw "User ban from the ring"; - } - if (sb._LastJoinSessionResult != 0) - { - throw "Join session error"; - } - // ok, the join is accepted !, the other far TP work is done in the callback - } - break; - case JoinMainland: -//retryJoinMainland: - { - TSessionId sessionId(0); - sb.joinMainland(charId, ClientApp); - - bool ret = sb.waitOneMessage(CSessionBrowserImpl::getMessageName("on_joinSessionResult")); - - if (!ret) - throw "Protocol error"; - if (sb._LastJoinSessionResult != 0) - { - // some error during the join - throw "Error joining session"; - } - // ok, the join is accepted !, the other far TP work is done in the callback - } - break; - default: - nlstop; - } - - return true; - } - -// -// const string url = _URLBase + string(_URLTable[joinMode]); -// string res; -// try -// { -// // Get the address of a front-end service via http -// if (!HttpClient.connect(url)) -// throw 1; -// switch (joinMode) -// { -// case CFarTP::LaunchEditor: -// if (!HttpClient.sendGetWithCookie(url, "ryzomId", CurrentCookie, toString("charSlot=%u", charSlot))) -// throw 2; -// break; -// case CFarTP::JoinSession: -// if (!HttpClient.sendPostWithCookie(url, "ryzomId", CurrentCookie, toString("sessionId=%u&charSlot=%u", sessionId, charSlot))) -// throw 2; -// break; -// case CFarTP::JoinMainland: -// if (!HttpClient.sendPostWithCookie(url, "ryzomId", CurrentCookie, "ml=")) -// throw 2; -// break; -// } -// if (!HttpClient.receive(res)) -// throw 3; -// HttpClient.disconnect(); -// string::size_type luaPos = res.find(""); -// if (luaPos == string::npos) -// throw 4; -// res = res.substr(luaPos + 5); -// res = res.substr(0, res.find("")); -// nlinfo("Found server for %ssession %u", joinMode==CFarTP::LaunchEditor ? "editing " : "", sessionId); -// -// // Begin Far TP -// CInterfaceManager *pIM = CInterfaceManager::getInstance(); -// pIM->executeLuaScript(res, true); -// return true; -// } - catch ( char *errorMsg ) - { -// // Get more details on the error -// string httpErrorStr; -// if (errorNum < 4) // we didn't receive an answer -// httpErrorStr = toString(" (HTTP error %u)", errorNum); -// if ( errorNum == 4 ) -// { -// string::size_type posEndOfFirstLine = res.find( "\n" ); -// if ( posEndOfFirstLine == string::npos ) -// { -// // Invalid http answer -// httpErrorStr = toString(" (HTTP invalid)"); -// } -// else -// { -// // Http status not OK (e.g. "404 Not Found") -// httpErrorStr = res.substr( 0, posEndOfFirstLine ); -// if ( httpErrorStr.find( "200 OK" ) == string::npos ) -// httpErrorStr = " (" + httpErrorStr + ")"; -// else -// httpErrorStr.clear(); -// } -// } - bool requestRetToMainland = /*httpErrorStr.empty() &&*/ bailOutIfSessionVanished; - bool isAttemptingEmbeddedServerHop = isReselectingChar() && (joinMode != CFarTP::JoinSession); - bool letReturnToCharSelect = (!isIngame()) || isAttemptingEmbeddedServerHop; - - // User-friendly message - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - if ( letReturnToCharSelect ) - { -// // Hide all buttons except Quit. If !requestRetToMainland, we will show them back at the end of connectToNewShard(). -// CAHManager::getInstance()->runActionHandler( "proc", NULL, "charsel_disable_buttons" ); -// CAHManager::getInstance()->runActionHandler( "set", NULL, "target_property=ui:outgame:charsel:quit_but:active|value=1" ); - - CInterfaceElement *btnOk = CWidgetManager::getInstance()->getElementFromId("ui:outgame:charsel:message_box:ok"); - if (btnOk) - btnOk->setActive( ! requestRetToMainland ); - - // Hide the black screen i.e. force showing the interface - CInterfaceElement *charSelBlackScreen = CWidgetManager::getInstance()->getElementFromId("ui:outgame:charsel:black_screen"); - if (charSelBlackScreen) - { - CViewBase *charSelBlackScreenBitmap = dynamic_cast(charSelBlackScreen); - if (charSelBlackScreenBitmap) - charSelBlackScreenBitmap->setAlpha(0); - } - } - pIM->messageBoxWithHelp( - CI18N::get(requestRetToMainland ? "uiSessionVanishedFarTP" : "uiSessionUnreachable") + ucstring(errorMsg), - letReturnToCharSelect ? "ui:outgame:charsel" : "ui:interface"); - - // Info in the log - string outErrorMsg = toString("Could not join %ssession %u: '%s' error\n", joinMode==CFarTP::LaunchEditor ? "editing " : "", sessionId.asInt(), errorMsg ); - nlwarning( outErrorMsg.c_str() ); -// if ( httpErrorStr.empty() ) -// { -// string delimiter = "Content-Type: text/html"; -// string::size_type delimPos = res.find( delimiter ); -// if ( delimPos != string::npos ) -// res = res.substr( delimPos + delimiter.size() ); -// } -// uint pos = 0; -// do -// { -// WarningLog->displayRaw( res.substr( pos, 200 ).c_str() ); // truncates long strings -// pos += 200; -// } -// while ( pos < res.size() ); - WarningLog->displayRawNL( "" ); - - // Save this error (regular log file is deleted at every startup) -// res = res + "\n\n"; - /*try - { - COFile outputF; - if ( outputF.open( getLogDirectory() + "error_join.log", true, true ) ) - { - time_t currentTime; - time( ¤tTime ); - string headerS = NLMISC::toString( "\n\n%s%s\n\n", asctime(localtime(¤tTime)), outErrorMsg.c_str() ); - outputF.serialBuffer( (uint8*)(&headerS[0]), (uint)headerS.size() ); -// outputF.serialBuffer( (uint8*)(&res[0]), res.size() ); - outputF.close(); - } - } - catch (const Exception &) - {} - */ - - // If the session is not a permanent session and has vanished, pop the position - if ( requestRetToMainland ) - { - requestReturnToPreviousSession( sessionId ); - LastGameCycle = NetMngr.getCurrentServerTick(); - NetMngr.send(NetMngr.getCurrentServerTick()); - } - else if ( letReturnToCharSelect ) - { - // Show all buttons except 'New character' so that the character can retry entering game or choose another character. - CAHManager::getInstance()->runActionHandler( "proc", NULL, "charsel_enable_buttons" ); - CAHManager::getInstance()->runActionHandler( "set", NULL, "target_property=ui:outgame:charsel:create_new_but:active|value=0" ); - - CInterfaceGroup* charselGroup = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:outgame:charsel")); - if(charselGroup) - CAHManager::getInstance()->runActionHandler( "proc", charselGroup, "charsel_init_buttons" ); - } - - return false; - } -} - - -/* - * hookNextFarTPForEditor - */ -void CFarTP::hookNextFarTPForEditor() -{ - _HookedForEditor = true; -} - -/* - * requestReturnToPreviousSession - */ -void CFarTP::requestReturnToPreviousSession(TSessionId rejectedSessionId) -{ - const string msgName = "CONNECTION:RET_MAINLAND"; - CBitMemStream out; - nlverify(GenericMsgHeaderMngr.pushNameToStream(msgName, out)); - out.serial(PlayerSelectedSlot); - out.serial(rejectedSessionId); - NetMngr.push(out); - nlinfo("%s sent", msgName.c_str()); -} - -/* - * requestReconnection - */ -void CFarTP::requestReconnection() -{ - _ReselectingChar = true; - if (!requestFarTPToSession(TSessionId(std::numeric_limits::max()), std::numeric_limits::max(), CFarTP::JoinMainland, false)) - _ReselectingChar = false; -} - - -const char * CFarTP::_URLTable[CFarTP::NbJoinModes] = -{ - "edit_session.php", - "join_session.php", - "join_shard.php" -}; - - -/* - * States - */ - -bool CFarTP::isFarTPInProgress() const -{ - CLoginStateMachine::TState state = LoginSM.getCurrentState(); - return (state == CLoginStateMachine::st_leave_shard || - state == CLoginStateMachine::st_enter_far_tp_main_loop || - state == CLoginStateMachine::st_disconnect || - state == CLoginStateMachine::st_reconnect_fs || - state == CLoginStateMachine::st_reconnect_select_char || - state == CLoginStateMachine::st_reconnect_ready || - state == CLoginStateMachine::st_reconnect_error); -} - -bool CFarTP::isServerHopInProgress() const -{ - CLoginStateMachine::TState state = LoginSM.getCurrentState(); - return (state == CLoginStateMachine::st_leave_shard || - state == CLoginStateMachine::st_reconnect_fs || - state == CLoginStateMachine::st_reconnect_select_char || - state == CLoginStateMachine::st_exit_global_menu || - state == CLoginStateMachine::st_reconnect_error); // TODO: error handling -} - - -// from begin of Far TP to disconnection -bool CFarTP::isLeavingShard() const -{ - CLoginStateMachine::TState state = LoginSM.getCurrentState(); - return (state == CLoginStateMachine::st_leave_shard || - state == CLoginStateMachine::st_enter_far_tp_main_loop || - state == CLoginStateMachine::st_disconnect); -} - -// from reconnection to game entering -bool CFarTP::isJoiningShard() const -{ - CLoginStateMachine::TState state = LoginSM.getCurrentState(); - return (state == CLoginStateMachine::st_reconnect_fs || - state == CLoginStateMachine::st_reconnect_select_char || - state == CLoginStateMachine::st_reconnect_ready || - state == CLoginStateMachine::st_reconnect_error); -} - - -/* - * Events - */ - -void CFarTP::onServerQuitOk() -{ - game_exit_request = false; - ryzom_exit_request = false; - - if (LoginSM.getCurrentState() == CLoginStateMachine::st_leave_shard) - LoginSM.pushEvent(CLoginStateMachine::ev_ingame_return); -} - -void CFarTP::onServerQuitAbort() -{ - game_exit_request = false; - ryzom_exit_request = false; - - if (LoginSM.getCurrentState() == CLoginStateMachine::st_leave_shard) - LoginSM.pushEvent(CLoginStateMachine::ev_enter_game); - _ReselectingChar = false; -} - -void CFarTP::disconnectFromPreviousShard() -{ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - - if (isIngame()) - { - // Display background (TODO: not Kami) - beginLoading (StartBackground); - UseEscapeDuringLoading = false; - - // Play music and fade out the Game Sound - if (SoundMngr) - { - // Loading Music Loop.ogg - LoadingMusic = ClientCfg.SoundOutGameMusic; - SoundMngr->playEventMusic(LoadingMusic, CSoundManager::LoadingMusicXFade, true); - SoundMngr->fadeOutGameSound(ClientCfg.SoundTPFade); - } - - // Change the tips - selectTipsOfTheDay (rand()); - - // Start progress bar and display background - ProgressBar.reset (BAR_STEP_TP); - ucstring nmsg("Loading..."); - ProgressBar.newMessage ( ClientCfg.buildLoadingString(nmsg) ); - ProgressBar.progress(0); - } - - // Disconnect from the FS - NetMngr.disconnect(); - - if (isIngame()) - { - // Save the R2EDEnabled flag to know if we are switching it when we reconnect - _PreviousR2EdEnabled = ClientCfg.R2EDEnabled; - - // Release R2 editor if applicable - R2::getEditor().autoConfigRelease(IsInRingSession); - } - - if( isReselectingChar() ) - { - releaseMainLoopReselect(); - } - else - { - // String manager: remove all waiting callbacks and removers - // (if some interface stuff has not received its string yet, its remover will get useless) - STRING_MANAGER::CStringManagerClient::release( false ); - - // Ugly globals - userChar = false; - noUserChar = false; - serverReceivedReady = false; - CharNameValidArrived = false; - UserCharPosReceived = false; - SabrinaPhraseBookLoaded = false; - } - - // Restart the network manager, the interface sync counter and the entities - pIM->resetShardSpecificData(); - - /* - ServerToLocal autocopy stuff: - When reinit will reset server counters to 0 in the server database, onServerChange() - will be called and data will be copied since CInterfaceManager::_LocalSyncActionCounter==0 - (done in resetShardSpecificData() above) - If we do the resetShardSpecificData() after, scenari could arise where Local database could not be reseted - */ - NetMngr.reinit(); - - if (isIngame() && !isReselectingChar()) - { - nlinfo("FarTP: calling EntitiesMngr.reinit()"); - EntitiesMngr.reinit(); - } - LoginSM.pushEvent(CLoginStateMachine::ev_connect); -} - -void CFarTP::connectToNewShard() -{ - // TODO: start commands? - - // Connect to the next FS - NetMngr.initCookie(Cookie, FSAddr); - - // connect the session browser to the new shard - NLNET::CInetAddress sbsAddress(CSessionBrowserImpl::getInstance().getFrontEndAddress()); - sbsAddress.setPort(sbsAddress.port()+SBSPortOffset); - CSessionBrowserImpl::getInstance().connectItf(sbsAddress); - - string result; - NetMngr.connect(result); - if (!result.empty()) - { - _Reason = new string(result); - LoginSM.pushEvent(CLoginStateMachine::ev_conn_failed); - return; - } - - // Reinit the string manager cache. - STRING_MANAGER::CStringManagerClient::instance()->initCache(FSAddr, ClientCfg.LanguageCode); - - // reset the chat mode - ChatMngr.resetChatMode(); - - // The next step will be triggered by the CONNECTION:USER_CHARS msg from the server -} - -// return to character selection screen -bool CFarTP::reselectCharacter() -{ - if ( ! reconnection() ) - { - // The user clicked the Quit button - releaseOutGame(); - return false; - } - return true; -} - -void CFarTP::selectCharAndEnter() -{ - CBitMemStream out; - nlverify (GenericMsgHeaderMngr.pushNameToStream("CONNECTION:SELECT_CHAR", out)); - CSelectCharMsg SelectCharMsg; - SelectCharMsg.c = (uint8)PlayerSelectedSlot; // PlayerSelectedSlot has not been reset - out.serial(SelectCharMsg); - NetMngr.push(out); - /*//Obsolete - CBitMemStream out2; - nlverify(GenericMsgHeaderMngr.pushNameToStream("CONNECTION:ENTER", out2)); - NetMngr.push(out2); - */ - LastGameCycle = NetMngr.getCurrentServerTick(); - NetMngr.send(NetMngr.getCurrentServerTick()); - - // if (!isIngame()) - // globalMenu will exit when WaitServerAnswer and serverReceivedReady (triggered by the CONNECTION:READY msg) are true - // else - // Next step will be triggered by the CONNECTION:READY msg from the server -} - -void CFarTP::sendReady() -{ - if ( isReselectingChar() ) - { - initMainLoop(); - } - else - { - // Set season - RT.updateRyzomClock(NetMngr.getCurrentServerTick()); - DayNightCycleHour = (float)RT.getRyzomTime(); - CurrSeason = RT.getRyzomSeason(); - RT.updateRyzomClock(NetMngr.getCurrentServerTick()); - DayNightCycleHour = (float)RT.getRyzomTime(); - ManualSeasonValue = RT.getRyzomSeason(); - - // Reset all fx (no need to CTimedFXManager::getInstance().reset() and EntitiesMngr.getGroundFXManager().reset() because the entities have been removed) - CProjectileManager::getInstance().reset(); - FXMngr.reset(); // (must be done after EntitiesMngr.release()) - EntitiesMngr.getGroundFXManager().init(Scene, ClientCfg.GroundFXMaxDist, ClientCfg.GroundFXMaxNB, ClientCfg.GroundFXCacheSize); - - // Get the sheet for the user from the CFG. - // Initialize the user and add him into the entity manager. - // DO IT AFTER: Database, Collision Manager, PACS, scene, animations loaded. - CSheetId userSheet(ClientCfg.UserSheet); - nlinfo("FarTP: calling EntitiesMngr.create(0, userSheet.asInt())"); - TNewEntityInfo emptyEntityInfo; - emptyEntityInfo.reset(); - EntitiesMngr.create(0, userSheet.asInt(), emptyEntityInfo); - - // Wait for the start position (USER_CHAR) and set the continent - waitForUserCharReceived(); - - - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - if ( ClientCfg.R2EDEnabled != _PreviousR2EdEnabled ) - { - // Reload textures, keys and interface config if we are switch between playing and r2 mode - // Must be done after receiving the current R2EDEnabled flag (USER_CHAR) - pIM->loadIngameInterfaceTextures(); - - // Unload (and save if leaving normal playing mode) keys and interface config - // Instead of doing it in disconnectFromPreviousShard(), we do it here, only when it's needed - ClientCfg.R2EDEnabled = ! ClientCfg.R2EDEnabled; - pIM->uninitInGame0(); - CItemGroupManager::getInstance()->uninit(); - - ClientCfg.R2EDEnabled = ! ClientCfg.R2EDEnabled; - ActionsContext.removeAllCombos(); - - if ( ! ClientCfg.R2EDEnabled ) - { - // Remove all existing keys and load them back, and load new interface config - pIM->loadKeys(); - CWidgetManager::getInstance()->hideAllWindows(); - pIM->loadInterfaceConfig(); - pIM->loadLandmarks(); - } - else - { - R2::ReloadUIFlag = true; // in R2ED mode the CEditor class deals with it - } - } - pIM->configureQuitDialogBox(); // must be called after waitForUserCharReceived() to know the ring config - - ContinentMngr.select(UserEntity->pos(), ProgressBar); // IMPORTANT : must select continent after ui init, because ui init also load landmarks (located in the icfg file) - // landmarks would be invisible else (RT 12239) - - - - // Update Network until current tick increase. - LastGameCycle = NetMngr.getCurrentServerTick(); - while (LastGameCycle == NetMngr.getCurrentServerTick()) - { - // Event server get events - CInputHandlerManager::getInstance()->pumpEventsNoIM(); - // Update Network. - NetMngr.update(); - IngameDbMngr.flushObserverCalls(); - NLGUI::CDBManager::getInstance()->flushObserverCalls(); - // Be nice to the system - nlSleep(100); - } - LastGameCycle = NetMngr.getCurrentServerTick(); - ProgressBar.progress(1); - - // Create the message for the server to create the character. - CBitMemStream out; - if(GenericMsgHeaderMngr.pushNameToStream("CONNECTION:READY", out)) - { - out.serial(ClientCfg.LanguageCode); - NetMngr.push(out); - NetMngr.send(NetMngr.getCurrentServerTick()); - } - - // To be sure server crash is not fault of client - ConnectionReadySent = true; // must be called before BotChatPageAll->initAfterConnectionReady() - - // To reset the inputs. - CInputHandlerManager::getInstance()->pumpEventsNoIM(); - - if(BotChatPageAll && (! ClientCfg.R2EDEnabled)) - BotChatPageAll->initAfterConnectionReady(); - - // Transition from background to game - FirstFrame = true; - } - - ProgressBar.finish(); - - LoginSM.pushEvent(CLoginStateMachine::ev_enter_game); - - if (_DSSDown) - { - _DSSDown = false; - onDssDown(true); - } -} - -void CFarTP::onFailure() -{ - // Display message - string reason; - if (_Reason) - { - reason += ": " + (*_Reason); - delete _Reason; - _Reason = NULL; - } - else if (noUserChar) - { - reason += ": no characters found!"; - } - Driver->systemMessageBox(("Unable to join shard"+reason).c_str(), "Error", UDriver::okType, UDriver::exclamationIcon); - - // TODO: recover from error - - LoginSM.pushEvent(CLoginStateMachine::ev_quit); -} - -void CFarTP::onDssDown(bool forceReturn) -{ - if (!forceReturn) - { - // If leaving shard, don't bother with DSS "downitude" - if (isLeavingShard()) - return; - // If joining shard, store event and launch it at the end of reconnection - if (isJoiningShard()) - { - _DSSDown = true; // note: still, some cases will make the client hang or abort, e.g. DSS down before the client receives the start pos (in ring shard) - return; - } - } - - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - pIM->messageBoxWithHelp(CI18N::get("uiDisconnected")); - requestReturnToPreviousSession(); -} - -extern bool loginFinished; -void setLoginFinished( bool f ); -extern bool loginOK; - -void CFarTP::joinSessionResult(uint32 /* userId */, TSessionId /* sessionId */, uint32 /* result */, const std::string &/* shardAddr */, const std::string &/* participantStatus */) -{ -// _LastJoinSessionResultMsg = result; -// -// _JoinSessionResultReceived = true; -// -// if (result == 0) -// { -// // ok, the join is successful -// -// FSAddr = shardAddr; -// -// setLoginFinished( true ); -// loginOK = true; -// -// LoginSM.pushEvent(CLoginStateMachine::ev_connect); -// -// } -// else -// { -// // TODO : display the error message on client screen and log -// nlstop; -// } -} - - -void CFarTP::setJoinSessionResult(TSessionId sessionId, const CSecurityCode& securityCode) -{ - _SessionIdToJoinFast = sessionId; - _SecurityCodeForDisconnection = securityCode; -} - -void CFarTP::writeSecurityCodeForDisconnection(NLMISC::IStream& msgout) -{ - CSecurityCheckForFastDisconnection::forwardSecurityCode(msgout, _SessionIdToJoinFast, _SecurityCodeForDisconnection); -} - -// Not run by the cotask but within the main loop -void CFarTP::farTPmainLoop() -{ - ConnectionReadySent = false; - LoginSM.pushEvent(CLoginStateMachine::ev_far_tp_main_loop_entered); - - disconnectFromPreviousShard(); - - uint nbRecoSelectCharReceived = 0; - - bool welcomeWindow = true; - - // Update network until the end of the FarTP process, before resuming the main loop - while (!ConnectionReadySent) - { - // Event server get events - CInputHandlerManager::getInstance()->pumpEventsNoIM(); - - // Update Network. - NetMngr.update(); - IngameDbMngr.flushObserverCalls(); - NLGUI::CDBManager::getInstance()->flushObserverCalls(); - - // TODO: resend in case the last datagram sent was lost? -// // check if we can send another dated block -// if (NetMngr.getCurrentServerTick() != serverTick) -// { -// // -// serverTick = NetMngr.getCurrentServerTick(); -// NetMngr.send(serverTick); -// } -// else -// { -// // Send dummy info -// NetMngr.send(); -// } - - if (LoginSM.getCurrentState() == CLoginStateMachine::st_reconnect_select_char) - { - // Far TP part 3.2bis: go to character selection dialog - // This is done outside the co-routine because it may need to co-routine to do an embedded server hop - if ( FarTP.isReselectingChar() ) - { - ++nbRecoSelectCharReceived; - if ( nbRecoSelectCharReceived <= 1 ) - { - ClientCfg.SelectCharacter = -1; // turn off character autoselection - if ( ! FarTP.reselectCharacter() ) // it should not return here in farTPmainLoop() in the same state otherwise this would be called twice - return; - } - else - nlwarning( "Received more than one st_reconnect_select_char event" ); - } - } - else if (LoginSM.getCurrentState() == CLoginStateMachine::st_reconnect_ready) - { - // Don't call sendReady() within the cotask but within the main loop, as it contains - // event/network loops that could trigger a global exit(). - sendReady(); - welcomeWindow = !isReselectingChar(); - } - - // Be nice to the system - nlSleep(100); - } - - // active/desactive welcome window - if(welcomeWindow) - initWelcomeWindow(); -} diff --git a/code/ryzom/client/src/interface_v3/inventory_manager.cpp b/code/ryzom/client/src/interface_v3/inventory_manager.cpp deleted file mode 100644 index 20480dc38..000000000 --- a/code/ryzom/client/src/interface_v3/inventory_manager.cpp +++ /dev/null @@ -1,4049 +0,0 @@ -// Ryzom - MMORPG Framework -// Copyright (C) 2010-2019 Winch Gate Property Limited -// -// This source file has been modified by the following contributors: -// Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2015-2019 Jan BOON (Kaetemi) -// -// 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 "nel/misc/cdb_leaf.h" -#include "nel/misc/cdb_branch.h" -#include "inventory_manager.h" -#include "interface_manager.h" -#include "bot_chat_page_trade.h" -#include "bot_chat_page_all.h" -#include "nel/gui/group_container.h" -#include "nel/gui/group_menu.h" -#include "nel/misc/cdb_leaf.h" -#include "nel/misc/cdb_branch.h" -#include "list_sheet_base.h" -#include "../net_manager.h" -#include "../user_entity.h" -#include "../global.h" - -#include "nel/misc/algo.h" - -// TODO: remove this ugly dependence -#include "sphrase_manager.h" - -// For handlers -#include "nel/gui/action_handler.h" -#include "nel/gui/group_editbox.h" -#include "dbctrl_sheet.h" - -#include "../sheet_manager.h" -#include "game_share/slot_equipment.h" -#include "game_share/animal_status.h" -#include "game_share/bot_chat_types.h" - -#include "../client_cfg.h" - -#include "../misc.h" - -#ifdef DEBUG_NEW -#define new DEBUG_NEW -#endif - -using namespace std; -using namespace NLMISC; - -extern TSessionId CharacterHomeSessionId; - -extern NLMISC::CLog g_log; -// Context help -extern void contextHelp (const std::string &help); - -CTempInvManager *CTempInvManager::_Instance = NULL; -CInventoryManager *CInventoryManager::_Instance = NULL; - -NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupListSheetBag, std::string, "list_sheet_bag"); -NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupIconListBag, std::string, "list_icon_bag"); -NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupListSheetFilterCLMSlot, std::string, "list_sheet_filter_clm_slot"); -NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupListSheetFilterExchangeable, std::string, "list_sheet_filter_exchangeable"); - -// *************************************************************************** -// db path for all the inventories (without the SERVER: prefix) -const std::string CInventoryManager::InventoryDBs[]= -{ - "INVENTORY:BAG", - // MAX_INVENTORY_ANIMAL - "INVENTORY:PACK_ANIMAL0", - "INVENTORY:PACK_ANIMAL1", - "INVENTORY:PACK_ANIMAL2", - "INVENTORY:PACK_ANIMAL3", - "INVENTORY:PACK_ANIMAL4", - "INVENTORY:PACK_ANIMAL5", - "INVENTORY:PACK_ANIMAL6", - "INVENTORY:TEMP", - "EXCHANGE:GIVE", - "EXCHANGE:RECEIVE", - "TRADING", - "INVENTORY:SHARE", - "GUILD:INVENTORY", - "INVENTORY:ROOM", -}; - -static void dummyCheck() -{ - // if this raise, correct the 2 tables above and below - nlctassert(MAX_INVENTORY_ANIMAL==7); -} - -const uint CInventoryManager::InventoryIndexes[]= -{ - INVENTORIES::bag, - // MAX_INVENTORY_ANIMAL - INVENTORIES::pet_animal1, - INVENTORIES::pet_animal2, - INVENTORIES::pet_animal3, - INVENTORIES::pet_animal4, - INVENTORIES::pet_animal5, - INVENTORIES::pet_animal6, - INVENTORIES::pet_animal7, - INVENTORIES::temporary, - INVENTORIES::exchange, - INVENTORIES::exchange_proposition, - INVENTORIES::trading, - INVENTORIES::reward_sharing, - INVENTORIES::guild, - INVENTORIES::player_room, -}; - -const uint CInventoryManager::NumInventories= sizeof(CInventoryManager::InventoryDBs)/sizeof(CInventoryManager::InventoryDBs[0]); - - -// ************************************************************************************************* -CItemImage::CItemImage() -{ - Sheet = NULL; - Quality = NULL; - Quantity = NULL; - CreateTime = NULL; - Serial = NULL; - UserColor = NULL; - Price = NULL; - Weight= NULL; - NameId= NULL; - InfoVersion= NULL; -} - -// ************************************************************************************************* -void CItemImage::build(CCDBNodeBranch *branch) -{ - if (!branch) return; - Sheet = dynamic_cast(branch->getNode(ICDBNode::CTextId("SHEET"), false)); - Quality = dynamic_cast(branch->getNode(ICDBNode::CTextId("QUALITY"), false)); - Quantity = dynamic_cast(branch->getNode(ICDBNode::CTextId("QUANTITY"), false)); - CreateTime = dynamic_cast(branch->getNode(ICDBNode::CTextId("CREATE_TIME"), false)); - Serial = dynamic_cast(branch->getNode(ICDBNode::CTextId("SERIAL"), false)); - UserColor = dynamic_cast(branch->getNode(ICDBNode::CTextId("USER_COLOR"), false)); - Price = dynamic_cast(branch->getNode(ICDBNode::CTextId("PRICE"), false)); - Weight = dynamic_cast(branch->getNode(ICDBNode::CTextId("WEIGHT"), false)); - NameId = dynamic_cast(branch->getNode(ICDBNode::CTextId("NAMEID"), false)); - InfoVersion= dynamic_cast(branch->getNode(ICDBNode::CTextId("INFO_VERSION"), false)); - ResaleFlag = dynamic_cast(branch->getNode(ICDBNode::CTextId("RESALE_FLAG"), false)); - - // Should always have at least those one:(ie all but Price) - nlassert(Sheet && Quality && Quantity && CreateTime && Serial && UserColor && Weight && NameId && InfoVersion); -} - -uint64 CItemImage::getItemId() const -{ - return ((uint64)getSerial() << 32) | getCreateTime(); -} - -// ************************************************************************************************* -void CItemInfoCache::load(const std::string &filename) -{ - try - { - CIFile f; - if (f.open(filename)) - { - serial(f); - } - } catch(...) - { } -} - -void CItemInfoCache::save(const std::string &filename) -{ - try - { - COFile f; - if (f.open(filename)) - { - serial(f); - } - }catch(...) - { } -} - -void CItemInfoCache::serial(NLMISC::IStream &s) -{ - s.serialCheck(NELID("METI")); - uint ver = 1; - s.serialVersion(ver); - - uint8 byte = 1; - if (s.isReading()) - { - _ItemInfoCacheMap.clear(); - while(true) - { - uint64 key; - - s.serial(byte); - if (byte == 0) - { - break; - } - s.serial(key); - s.serial(_ItemInfoCacheMap[key].CacheCycle); - _ItemInfoCacheMap[key].serial(s); - - // these are not used in item info cache - _ItemInfoCacheMap[key].InfoVersionFromMsg = 0; - _ItemInfoCacheMap[key].InfoVersionFromSlot = 0; - _ItemInfoCacheMap[key].InfoVersionSlotServerWaiting = 0; - } - } - else - { - byte = 1; - TItemInfoCacheMap::iterator it = _ItemInfoCacheMap.begin(); - while (it != _ItemInfoCacheMap.end()) - { - // purge item from cache if not encountered in X save - if (it->second.CacheCycle < 10000) - { - // 'record exists' byte - s.serial(byte); - - // item id (serial << 32 | createTime) - uint64 key = it->first; - s.serial(key); - - uint32 cycle = it->second.CacheCycle+1; - s.serial(cycle); - - // item info - it->second.serial(s); - } - - ++it; - } - // eof of records byte - byte = 0; - s.serial(byte); - } -} - -const CClientItemInfo *CItemInfoCache::getItemInfo(uint32 serial, uint32 createTime) const -{ - if (serial > 0 && createTime > 0) - { - uint64 itemId = ((uint64)serial << 32) | createTime; - return getItemInfo(itemId); - } - - return NULL; -} - -const CClientItemInfo *CItemInfoCache::getItemInfo(uint64 itemId) const -{ - if (itemId > 0) - { - TItemInfoCacheMap::const_iterator it = _ItemInfoCacheMap.find(itemId); - if (it != _ItemInfoCacheMap.end()) - return &(it->second); - } - - return NULL; -} - -void CItemInfoCache::readFromImpulse(uint64 itemId, CItemInfos itemInfo) -{ - if (itemId > 0) - { - _ItemInfoCacheMap[itemId].readFromImpulse(itemInfo); - _ItemInfoCacheMap[itemId].CacheCycle = 0; - } -} - -void CItemInfoCache::debugItemInfoCache() const -{ - nlinfo("ItemInfoCache: %d entries", _ItemInfoCacheMap.size()); - uint count = 0; - for (TItemInfoCacheMap::const_iterator it = _ItemInfoCacheMap.begin(); it != _ItemInfoCacheMap.end(); ++it) - { - uint32 serial = (it->first >> 32) & 0xFFFFFFFF; - uint32 created = it->first & 0xFFFFFFFF; - nlinfo("[%-4d] cacheCycle:%d, serial:%d, createTime:%d", count++, it->second.CacheCycle, serial, created); - } - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - pIM->displaySystemInfo(toString("ItemInfoCache: %d entries written to client.log", _ItemInfoCacheMap.size())); -} - -// ************************************************************************************************* -// CInventoryManager -// ************************************************************************************************* - -// ************************************************************************************************* -CInventoryManager::CInventoryManager() -{ - Money = NULL; - ServerMoney = NULL; - uint i; - for (i = 0; i < MAX_HANDINV_ENTRIES; ++i) - { - Hands[i] = ServerHands[i] = 0; - UIHands[i] = NULL; - } - - for (i = 0; i < MAX_EQUIPINV_ENTRIES; ++i) - { - Equip[i] = ServerEquip[i] = 0; - UIEquip[i] = NULL; - UIEquip2[i] = NULL; - } - - for (i = 0; i < MAX_BAGINV_ENTRIES; i++) - { - BagItemEquipped[i]= false; - } - - _ItemInfoCacheFilename = toString("save/item_infos_%d.cache", CharacterHomeSessionId.asInt()); - _ItemInfoCache.load(_ItemInfoCacheFilename); - - nlctassert(NumInventories== sizeof(InventoryIndexes)/sizeof(InventoryIndexes[0])); -} - -// *************************************************************************** -CInventoryManager::~CInventoryManager() -{ - _ItemInfoCache.save(_ItemInfoCacheFilename); -} - -// ************************************************************************************************* -CInventoryManager *CInventoryManager::getInstance() -{ - if( !_Instance ) - _Instance = new CInventoryManager(); - return _Instance; -} - -// *************************************************************************** -void CInventoryManager::releaseInstance() -{ - if( _Instance ) - delete _Instance; - _Instance = NULL; -} - -// ************************************************************************************************* -CItemImage &CInventoryManager::getBagItem(uint index) -{ - nlassert(index < MAX_BAGINV_ENTRIES); - return Bag[index]; -} - -// ************************************************************************************************* -CItemImage &CInventoryManager::getTempItem(uint index) -{ - nlassert(index < MAX_TEMPINV_ENTRIES); - return TempInv[index]; -} - -// ************************************************************************************************* -CItemImage *CInventoryManager::getHandItem(uint index) -{ - nlassert(index < MAX_HANDINV_ENTRIES); - if (Hands[index] != 0) - return &Bag[Hands[index]-1]; - else - return NULL; -} - -// ************************************************************************************************* -CItemImage *CInventoryManager::getEquipItem(uint index) -{ - nlassert(index < MAX_EQUIPINV_ENTRIES); - if (Equip[index] != 0) - return &Bag[Equip[index]]; - else - return NULL; -} - -// ************************************************************************************************* -CDBCtrlSheet *CInventoryManager::getHandSheet(uint index) -{ - return UIHands[index]; -} - -// ************************************************************************************************* -CDBCtrlSheet *CInventoryManager::getEquipSheet(uint index) -{ - return UIEquip[index]; -} - - -// ************************************************************************************************* -CItemImage &CInventoryManager::getServerBagItem(uint index) -{ - nlassert(index < MAX_BAGINV_ENTRIES); - return ServerBag[index]; -} -const CItemImage &CInventoryManager::getServerBagItem(uint index) const -{ - nlassert(index < MAX_BAGINV_ENTRIES); - return ServerBag[index]; -} - -// ************************************************************************************************* -CItemImage &CInventoryManager::getServerTempItem(uint index) -{ - nlassert(index < MAX_TEMPINV_ENTRIES); - return ServerTempInv[index]; -} -const CItemImage &CInventoryManager::getServerTempItem(uint index) const -{ - nlassert(index < MAX_TEMPINV_ENTRIES); - return ServerTempInv[index]; -} - -// ************************************************************************************************* -CItemImage *CInventoryManager::getServerHandItem(uint index) -{ - nlassert(index < MAX_HANDINV_ENTRIES); - if (ServerHands[index] != 0) - return &ServerBag[ServerHands[index]]; - else - return NULL; -} - -// ************************************************************************************************* -CItemImage *CInventoryManager::getServerEquipItem(uint index) -{ - nlassert(index < MAX_EQUIPINV_ENTRIES); - if (ServerEquip[index] != 0) - return &ServerBag[ServerEquip[index]]; - else - return NULL; -} - -// ************************************************************************************************* -uint64 CInventoryManager::getMoney() const -{ - return Money ? Money->getValue64() : 0; -} - -// ************************************************************************************************* -void CInventoryManager::setMoney(uint64 value) -{ - if (Money) Money->setValue64(value); -} - -// ************************************************************************************************* -uint64 CInventoryManager::getServerMoney() const -{ - return ServerMoney ? ServerMoney->getValue64() : 0; -} - -// ************************************************************************************************* -void CInventoryManager::setServerMoney(uint64 value) -{ - if (ServerMoney) ServerMoney->setValue64(value); -} -// ************************************************************************************************* -void CInventoryManager::init() -{ - CInterfaceManager *im = CInterfaceManager::getInstance(); - // LOCAL DB - initItemArray(LOCAL_INVENTORY ":BAG", Bag, MAX_BAGINV_ENTRIES); - initItemArray(LOCAL_INVENTORY ":TEMP", TempInv, MAX_TEMPINV_ENTRIES); - Money = NLGUI::CDBManager::getInstance()->getDbProp(LOCAL_INVENTORY ":MONEY"); - initIndirection (LOCAL_INVENTORY ":HAND:", Hands, MAX_HANDINV_ENTRIES, true); - initIndirection (LOCAL_INVENTORY ":EQUIP:", Equip, MAX_EQUIPINV_ENTRIES, true); - // Init observers for auto equipment - { - for (uint i = 0; i < MAX_BAGINV_ENTRIES; ++i) - { - CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp(LOCAL_INVENTORY ":BAG:" + toString(i) + ":SHEET"); - ICDBNode::CTextId textId; - pNL->addObserver(&_DBBagObs, textId); - } - } - // Init Animals - for(uint i=0;igetDbProp(SERVER_INVENTORY ":MONEY"); - // Init Animals - for(uint i=0;i(CWidgetManager::getInstance()->getElementFromId(CTRL_HAND_RIGHT)); - UIHands[1] = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_HAND_LEFT)); - - UIEquip[SLOT_EQUIPMENT::HEADDRESS] = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_JEWEL_HEADDRESS)); - UIEquip[SLOT_EQUIPMENT::EARL] = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_JEWEL_EARING_LEFT)); - UIEquip[SLOT_EQUIPMENT::EARR] = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_JEWEL_EARING_RIGHT)); - UIEquip[SLOT_EQUIPMENT::NECKLACE] = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_JEWEL_NECK)); - UIEquip[SLOT_EQUIPMENT::WRISTL] = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_JEWEL_BRACELET_LEFT)); - UIEquip[SLOT_EQUIPMENT::WRISTR] = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_JEWEL_BRACELET_RIGHT)); - UIEquip[SLOT_EQUIPMENT::FINGERL] = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_JEWEL_RING_LEFT)); - UIEquip[SLOT_EQUIPMENT::FINGERR] = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_JEWEL_RING_RIGHT)); - UIEquip[SLOT_EQUIPMENT::ANKLEL] = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_JEWEL_ANKLET_LEFT)); - UIEquip[SLOT_EQUIPMENT::ANKLER] = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_JEWEL_ANKLET_RIGHT)); - - UIEquip[SLOT_EQUIPMENT::HEAD] = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_ARMOR_HEAD)); - UIEquip[SLOT_EQUIPMENT::CHEST] = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_ARMOR_CHEST)); - UIEquip[SLOT_EQUIPMENT::ARMS] = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_ARMOR_ARMS)); - UIEquip[SLOT_EQUIPMENT::FEET] = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_ARMOR_FEET)); - UIEquip[SLOT_EQUIPMENT::LEGS] = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_ARMOR_LEGS)); - UIEquip[SLOT_EQUIPMENT::HANDS] = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_ARMOR_HANDS)); - - UIEquip2[SLOT_EQUIPMENT::HEADDRESS] = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_JEWL2_HEADDRESS)); - UIEquip2[SLOT_EQUIPMENT::EARL] = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_JEWL2_EARING_LEFT)); - UIEquip2[SLOT_EQUIPMENT::EARR] = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_JEWL2_EARING_RIGHT)); - UIEquip2[SLOT_EQUIPMENT::NECKLACE] = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_JEWL2_NECK)); - UIEquip2[SLOT_EQUIPMENT::WRISTL] = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_JEWL2_BRACELET_LEFT)); - UIEquip2[SLOT_EQUIPMENT::WRISTR] = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_JEWL2_BRACELET_RIGHT)); - UIEquip2[SLOT_EQUIPMENT::FINGERL] = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_JEWL2_RING_LEFT)); - UIEquip2[SLOT_EQUIPMENT::FINGERR] = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_JEWL2_RING_RIGHT)); - UIEquip2[SLOT_EQUIPMENT::ANKLEL] = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_JEWL2_ANKLET_LEFT)); - UIEquip2[SLOT_EQUIPMENT::ANKLER] = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_JEWL2_ANKLET_RIGHT)); - - UIEquip2[SLOT_EQUIPMENT::HEAD] = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_ARMR2_HEAD)); - UIEquip2[SLOT_EQUIPMENT::CHEST] = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_ARMR2_CHEST)); - UIEquip2[SLOT_EQUIPMENT::ARMS] = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_ARMR2_ARMS)); - UIEquip2[SLOT_EQUIPMENT::FEET] = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_ARMR2_FEET)); - UIEquip2[SLOT_EQUIPMENT::LEGS] = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_ARMR2_LEGS)); - UIEquip2[SLOT_EQUIPMENT::HANDS] = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_ARMR2_HANDS)); - - - // Init ItemInfoObservers - { - CCDBNodeLeaf *nodeTS; - - nodeTS= NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TRADING:SESSION", false); - if( nodeTS ) - { - ICDBNode::CTextId textId; - nodeTS->addObserver(&_DBTradeInfoObs, textId); - } - - // Init All Version obs - for(uint i=0;igetDbProp("SERVER:" + InventoryDBs[i] + ":" + toString(j) + ":INFO_VERSION", false); - CCDBNodeLeaf *nodeSH= NLGUI::CDBManager::getInstance()->getDbProp("SERVER:" + InventoryDBs[i] + ":" + toString(j) + ":SHEET", false); - if( nodeIV && nodeSH ) - { - ICDBNode::CTextId textIdIV, textIdSH; - nodeIV->addObserver(&_DBInfoSlotVersionObs, textIdIV); - nodeSH->addObserver(&_DBItemSheetObs, textIdSH); - // if current value!=0, simulate a receive item info obs - if(nodeIV->getValue32()) - { - onReceiveItemInfoSlotVersion(nodeIV); - } - } - else - // stop here for this inventory - break; - } - } - } - } -} - -// ************************************************************************************************* -void CInventoryManager::initItemArray(const std::string &dbBranchName, CItemImage *dest, uint numItems) -{ - nlassert(dest); - CInterfaceManager *im = CInterfaceManager::getInstance(); - CCDBNodeBranch *branch = NLGUI::CDBManager::getInstance()->getDbBranch(dbBranchName); - if (!branch) - { - nlwarning("Can't init inventory image from branch %s.", dbBranchName.c_str()); - return; - } - for(uint k = 0; k < numItems; ++k) - { - CCDBNodeBranch *itemBranch = dynamic_cast(branch->getNode((uint16) k)); - if (!itemBranch) - { - nlwarning("Can't retrieve item %d of branch %s", (int) k, dbBranchName.c_str()); - } - else - { - dest[k].build(itemBranch); - } - } -} - -// *************************************************************************** -void CInventoryManager::initIndirection(const std::string &dbbranch, sint32 *indices, sint32 nbIndex, bool putObs) -{ - CInterfaceManager *im = CInterfaceManager::getInstance(); - for (uint i = 0 ; i < (uint)nbIndex; ++i) - { - CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp(dbbranch + toString(i) + ":INDEX_IN_BAG"); - if (putObs) - { - ICDBNode::CTextId textId; - pNL->addObserver(&_DBEquipObs, textId); - } - if (pNL != NULL) - indices[i] = pNL->getValue32(); - } -} - -// *************************************************************************** -void CInventoryManager::beginDrag(CDBCtrlSheet *pCS, TFrom From) -{ - DNDCurrentItem = pCS; - if (pCS) - CDBCtrlSheet::setCurrSelSheet(pCS); - DNDFrom = From; -} - -// *************************************************************************** -void CInventoryManager::endDrag() -{ - DNDCurrentItem = NULL; - DNDFrom = Nowhere; -} - -// *************************************************************************** -// Used for interface objects which are reference in bag (the getSheet() returns INDEX_IN_BAG) -std::string CInventoryManager::getDBIndexPath(CDBCtrlSheet *pCS) -{ - string sTmp; - uint i; - for (i = 0; i < MAX_HANDINV_ENTRIES; ++i) - { - if (UIHands[i] == pCS) - { - return string(LOCAL_INVENTORY) + ":HAND:" + toString(i); - } - } - - for (i = 0; i < MAX_EQUIPINV_ENTRIES; ++i) - { - if (UIEquip[i] == pCS) - { - return string(LOCAL_INVENTORY) + ":EQUIP:" + toString(i); - } - if (UIEquip2[i] == pCS) - { - return string(LOCAL_INVENTORY) + ":EQUIP:" + toString(i); - } - } - return ""; -} - -// *************************************************************************** -bool CInventoryManager::is2HandItem(uint32 sheetID) -{ - bool result = false; - CEntitySheet *sheet= SheetMngr.get(CSheetId(sheetID)); - if(sheet && sheet->type()== CEntitySheet::ITEM) - { - CItemSheet *item= (CItemSheet*)sheet; - if( item->hasSlot(SLOTTYPE::TWO_HANDS) || item->hasSlot(SLOTTYPE::RIGHT_HAND_EXCLUSIVE) ) - result = true; - } - return result; -} - -// *************************************************************************** -bool CInventoryManager::isMeleeWeaponItem(uint32 sheetID) -{ - bool result = false; - CEntitySheet *sheet= SheetMngr.get(CSheetId(sheetID)); - if(sheet && sheet->type()== CEntitySheet::ITEM) - { - CItemSheet *item= (CItemSheet*)sheet; - if( item->Family == ITEMFAMILY::MELEE_WEAPON ) - result = true; - } - return result; -} - -// *************************************************************************** -bool CInventoryManager::isRangeWeaponItem(uint32 sheetID) -{ - bool result = false; - CEntitySheet *sheet= SheetMngr.get(CSheetId(sheetID)); - if(sheet && sheet->type()== CEntitySheet::ITEM) - { - CItemSheet *item= (CItemSheet*)sheet; - if( item->Family == ITEMFAMILY::RANGE_WEAPON ) - result = true; - } - return result; -} - -// *************************************************************************** -bool CInventoryManager::isDagger(uint32 sheetID) -{ - bool result = false; - CEntitySheet *sheet= SheetMngr.get(CSheetId(sheetID)); - if(sheet && sheet->type()== CEntitySheet::ITEM) - { - CItemSheet *item= (CItemSheet*)sheet; - if( item->ItemType == ITEM_TYPE::DAGGER) - result = true; - } - return result; -} - -// *************************************************************************** -bool CInventoryManager::isSword(uint32 sheetID) -{ - bool result = false; - CEntitySheet *sheet= SheetMngr.get(CSheetId(sheetID)); - if(sheet && sheet->type()== CEntitySheet::ITEM) - { - CItemSheet *item= (CItemSheet*)sheet; - if( item->ItemType == ITEM_TYPE::SWORD) - result = true; - } - return result; -} - -// *************************************************************************** -bool CInventoryManager::isForageToolItem(uint32 sheetID) -{ - bool result = false; - CEntitySheet *sheet= SheetMngr.get(CSheetId(sheetID)); - if(sheet && sheet->type()== CEntitySheet::ITEM) - { - CItemSheet *item= (CItemSheet*)sheet; - if( item->Family == ITEMFAMILY::HARVEST_TOOL ) - result = true; - } - return result; -} - -// *************************************************************************** -uint32 CInventoryManager::getHandItemSheet( bool rightHand ) const -{ - CSheetId item; - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - string dbPropPath = toString("LOCAL:INVENTORY:HAND:%d:INDEX_IN_BAG",rightHand?0:1); - // get the RightHand bag index - sint32 itemSlot= NLGUI::CDBManager::getInstance()->getDbProp(dbPropPath)->getValue32(); - // if something in hand - if(itemSlot>0) - { - CCDBNodeLeaf *node= NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:INVENTORY:BAG:"+toString(itemSlot-1) +":SHEET", false); - if(node) - item= node->getValue32(); - } - return item.asInt(); -} - - -// *************************************************************************** -bool CInventoryManager::isLeftHandItemCompatibleWithRightHandItem(uint32 leftHandSheet, uint32 rightHandSheet, uint32 lastRightHandSheet) -{ - CEntitySheet *pLastRight = SheetMngr.get (CSheetId(lastRightHandSheet)); - if (pLastRight != NULL) - { - if (pLastRight->type() != CEntitySheet::ITEM) return false; - CItemSheet *pIsLastRight = (CItemSheet *)pLastRight; - - // Last item in right hand is a 2 hand item and the new item is nothing (unequip) - if (pIsLastRight->hasSlot(SLOTTYPE::TWO_HANDS) || pIsLastRight->hasSlot(SLOTTYPE::RIGHT_HAND_EXCLUSIVE)) - return false; - } - - if (leftHandSheet == 0) return true; - - CEntitySheet *pLeft = SheetMngr.get (CSheetId(leftHandSheet)); - if (pLeft == NULL) return false; - if (pLeft->type() != CEntitySheet::ITEM) return false; - CItemSheet *pIsLeft = (CItemSheet *)pLeft; - - if ((pIsLeft->Family == ITEMFAMILY::AMMO) && (rightHandSheet == 0)) - return false; - - if ((pIsLeft->ItemType == ITEM_TYPE::DAGGER) && (rightHandSheet == 0)) - return false; - - CEntitySheet *pRight = SheetMngr.get (CSheetId(rightHandSheet)); - if (pRight == NULL) return true; - if (pRight->type() != CEntitySheet::ITEM) return true; - CItemSheet *pIsRight = (CItemSheet *)pRight; - - if (pIsRight->Family == ITEMFAMILY::RANGE_WEAPON) - { - if (pIsLeft->Family == ITEMFAMILY::AMMO) - if (pIsRight->RangeWeapon.Skill == pIsLeft->Ammo.Skill) - return true; - } - - if (pIsLeft->ItemType == ITEM_TYPE::DAGGER) - { - if ((pIsRight->ItemType == ITEM_TYPE::SWORD) || (pIsRight->ItemType == ITEM_TYPE::DAGGER)) - return true; - else - return false; - } - - if (!pIsRight->hasSlot(SLOTTYPE::TWO_HANDS) && !pIsRight->hasSlot(SLOTTYPE::RIGHT_HAND_EXCLUSIVE)) - { - return true; - } - - return false; -} - -// *************************************************************************** -static void grayItem (const std::string &listname, sint32 bagEntryIndex, bool gray) -{ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - - IListSheetBase *pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(listname)); - - if (pList != NULL) - { - pList->invalidateCoords(); - - for(uint i = 0; i < MAX_BAGINV_ENTRIES; ++i) - { - CDBCtrlSheet *pCS = pList->getSheet(i); - string sTmp = pCS->getSheet(); - sTmp = sTmp.substr(sTmp.rfind(':')+1,sTmp.size()); - sint32 nTmp; - fromString(sTmp, nTmp); - if (nTmp == bagEntryIndex) - pCS->setItemWeared(gray); - } - } -} - -// *************************************************************************** -void CInventoryManager::wearBagItem(sint32 bagEntryIndex) -{ - if(bagEntryIndex>=0 && bagEntryIndex<(sint32)MAX_BAGINV_ENTRIES) - { - BagItemEquipped[bagEntryIndex]= true; - grayItem (LIST_BAG_TEXT, bagEntryIndex, true); - grayItem (LIST_BAG_ICONS, bagEntryIndex, true); - sortBag(); - } -} - -// *************************************************************************** -void CInventoryManager::unwearBagItem(sint32 bagEntryIndex) -{ - if(bagEntryIndex>=0 && bagEntryIndex<(sint32)MAX_BAGINV_ENTRIES) - { - BagItemEquipped[bagEntryIndex]= false; - grayItem (LIST_BAG_TEXT, bagEntryIndex, false); - grayItem (LIST_BAG_ICONS, bagEntryIndex, false); - sortBag(); - } -} - -// *************************************************************************** -bool CInventoryManager::isBagItemWeared(sint32 bagEntryIndex) -{ - if(bagEntryIndex>=0 && bagEntryIndex<(sint32)MAX_BAGINV_ENTRIES) - { - return BagItemEquipped[bagEntryIndex]; - } - - return false; -} - -// ---------------------------------------------------------------------------- -static bool isSwimming() -{ - if (UserEntity != NULL) - return (UserEntity->mode() == MBEHAV::SWIM || UserEntity->mode() == MBEHAV::MOUNT_SWIM); - else - return false; -} - -static bool isRiding() -{ - if (UserEntity) - return UserEntity->isRiding(); - else - return false; -} - -static bool isStunned() -{ - if (UserEntity != NULL) - return (UserEntity->behaviour() == MBEHAV::STUNNED); - else - return false; -} - -static bool isDead() -{ - if (UserEntity != NULL) - return (UserEntity->mode() == MBEHAV::DEATH); - else - return false; -} - -// ---------------------------------------------- -// equip -// -// ---------------------------------------------- -void CInventoryManager::equip(const std::string &bagPath, const std::string &invPath) -{ - if (isSwimming() || isStunned() || isDead() || isRiding()) return; - - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - - if (bagPath.empty() || invPath.empty()) - { - return; - } - - // Get inventory and slot - string sIndexInBag = bagPath.substr(bagPath.rfind(':')+1,bagPath.size()); - uint16 indexInBag; - fromString(sIndexInBag, indexInBag); - - uint16 inventory = INVENTORIES::UNDEFINED; - uint16 invSlot = 0xffff; - - if (strnicmp(invPath.c_str(),"LOCAL:INVENTORY:HAND",20) == 0) - { - inventory = INVENTORIES::handling; - fromString(invPath.substr(21,invPath.size()), invSlot); - } - else if (strnicmp(invPath.c_str(),"LOCAL:INVENTORY:EQUIP",21) == 0) - { - inventory = INVENTORIES::equipment; - fromString(invPath.substr(22,invPath.size()), invSlot); - } - - // Hands management : check if we have to unequip left hand because of incompatibility with right hand item - sint16 oldRightIndexInBag = NLGUI::CDBManager::getInstance()->getDbProp(invPath + ":INDEX_IN_BAG")->getValue16(); - if (inventory == INVENTORIES::handling && invSlot == 0) - { - CDBCtrlSheet *pCSLeftHand = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_HAND_LEFT)); - if (pCSLeftHand == NULL) - { - return; - } - - // get sheet of left item - uint32 leftSheet = 0; - CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp(LOCAL_INVENTORY ":HAND:1:INDEX_IN_BAG", false); - if (pNL == NULL) - { - return; - } - if (pNL->getValue32() > 0) - { - CCDBNodeLeaf *pNL2 = NLGUI::CDBManager::getInstance()->getDbProp(LOCAL_INVENTORY ":BAG:" + toString(pNL->getValue32()-1) + ":SHEET", false); - if (pNL2 == NULL) - { - return; - } - leftSheet = pNL2->getValue32(); - } - - // get sheet of previous right hand item - uint32 lastRightSheet = 0; - if (oldRightIndexInBag > 0) - { - pNL = NLGUI::CDBManager::getInstance()->getDbProp(LOCAL_INVENTORY ":BAG:" + toString(oldRightIndexInBag-1) + ":SHEET", false); - if (pNL == NULL) - { - return; - } - lastRightSheet = pNL->getValue32(); - } - - // get sheet of new right hand item - uint32 rightSheet = 0; - if (indexInBag+1 > 0) - { - pNL = NLGUI::CDBManager::getInstance()->getDbProp(LOCAL_INVENTORY ":BAG:" + toString(indexInBag) + ":SHEET", false); - if (pNL == NULL) - { - return; - } - rightSheet = pNL->getValue32(); - } - - // If incompatible -> remove - if (!getInventory().isLeftHandItemCompatibleWithRightHandItem(leftSheet, rightSheet, lastRightSheet)) - { - getInventory().unequip(LOCAL_INVENTORY ":HAND:1"); - } - } - - // update the equip DB pointer - NLGUI::CDBManager::getInstance()->getDbProp(invPath + ":INDEX_IN_BAG")->setValue16(indexInBag+1); - - // Yoyo add: when the user equip an item, the action are invalid during some time - if(indexInBag < MAX_BAGINV_ENTRIES) - { - CItemSheet *pIS= dynamic_cast(SheetMngr.get(CSheetId(getBagItem(indexInBag).getSheetID()))); - if(pIS) - { - CSPhraseManager *pPM= CSPhraseManager::getInstance(); - pPM->setEquipInvalidation(NetMngr.getCurrentServerTick(), pIS->EquipTime); - } - } - - // Update trade window if any - if ((BotChatPageAll != NULL) && (BotChatPageAll->Trade != NULL)) - BotChatPageAll->Trade->invalidateCoords(); - - // Send message to the server - if (inventory != INVENTORIES::UNDEFINED) - { - CBitMemStream out; - const string sMsg = "ITEM:EQUIP"; - if (GenericMsgHeaderMngr.pushNameToStream(sMsg, out)) - { - // Fill the message (equipped inventory, equipped inventory slot, bag slot) - out.serial(inventory); - out.serial(invSlot); - out.serial(indexInBag); - NetMngr.push (out); - - pIM->incLocalSyncActionCounter(); - - //nlinfo("impulseCallBack : %s %d %d %d sent", sMsg.c_str(), inventory, invSlot, indexInBag); - } - else - { - nlwarning ("don't know message name %s", sMsg.c_str()); - } - } -} - - - -// ---------------------------------------------- -// unequip -// -// ---------------------------------------------- -void CInventoryManager::unequip(const std::string &invPath) -{ - if (isSwimming() || isStunned() || isDead() ) return; - - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - - sint16 oldIndexInBag = NLGUI::CDBManager::getInstance()->getDbProp(invPath + ":INDEX_IN_BAG")->getValue16(); - if( oldIndexInBag == 0 ) - { - return; - } - - // Get inventory and slot - uint16 inventory = INVENTORIES::UNDEFINED; - uint16 invSlot = 0xffff; - - if (strnicmp(invPath.c_str(),"LOCAL:INVENTORY:HAND",20) == 0) - { - inventory = INVENTORIES::handling; - fromString(invPath.substr(21,invPath.size()), invSlot); - } - else if (strnicmp(invPath.c_str(),"LOCAL:INVENTORY:EQUIP",21) == 0) - { - inventory = INVENTORIES::equipment; - fromString(invPath.substr(22,invPath.size()), invSlot); - } - - // Hands management : check if we have to unequip left hand because of incompatibility with right hand item - if (inventory == INVENTORIES::handling && invSlot == 0) - { - CDBCtrlSheet *pCSLeftHand = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_HAND_LEFT)); - if (pCSLeftHand == NULL) - { - return; - } - - // get sheet of left item - uint32 leftSheet = 0; - CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp(LOCAL_INVENTORY ":HAND:1:INDEX_IN_BAG", false); - if (pNL == NULL) - { - return; - } - if (pNL->getValue32() > 0) - { - CCDBNodeLeaf *pNL2 = NLGUI::CDBManager::getInstance()->getDbProp(LOCAL_INVENTORY ":BAG:" + toString(pNL->getValue32()-1) + ":SHEET", false); - if (pNL2 == NULL) - { - return; - } - leftSheet = pNL2->getValue32(); - } - - // get sheet of previous right hand item - uint32 lastRightSheet = 0; - if (oldIndexInBag > 0) - { - pNL = NLGUI::CDBManager::getInstance()->getDbProp(LOCAL_INVENTORY ":BAG:" + toString(oldIndexInBag-1) + ":SHEET", false); - if (pNL == NULL) - { - return; - } - lastRightSheet = pNL->getValue32(); - } - - // sheet of new right hand item - uint32 rightSheet = 0; - - // If incompatible -> remove - if (!getInventory().isLeftHandItemCompatibleWithRightHandItem(leftSheet, rightSheet, lastRightSheet)) - { - getInventory().unequip(LOCAL_INVENTORY ":HAND:1"); - } - } - - NLGUI::CDBManager::getInstance()->getDbProp(invPath + ":INDEX_IN_BAG")->setValue16(0); - - // Update trade window if any - if ((BotChatPageAll != NULL) && (BotChatPageAll->Trade != NULL)) - BotChatPageAll->Trade->invalidateCoords(); - - // Send message to the server - if (inventory != INVENTORIES::UNDEFINED) - { - CBitMemStream out; - const string sMsg = "ITEM:UNEQUIP"; - if (GenericMsgHeaderMngr.pushNameToStream(sMsg, out)) - { - // Fill the message (equipped inventory, equipped inventory slot) - out.serial(inventory); - out.serial(invSlot); - NetMngr.push (out); - - pIM->incLocalSyncActionCounter(); - - //nlinfo("impulseCallBack : %s %d %d sent", sMsg.c_str(), inventory, invSlot); - } - else - { - nlwarning ("don't know message name %s", sMsg.c_str()); - } - } -} - - -// *************************************************************************** -// Observer on DB equipment branch -// *************************************************************************** -void CInventoryManager::CDBEquipObs::update(ICDBNode* node) -{ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - string sTmp = node->getFullName(); - string sIE, sIE2; // Interface Element - CCDBNodeLeaf *pNL = dynamic_cast(node); - if (pNL == NULL) return; - if (strnicmp(sTmp.c_str(),"LOCAL:INVENTORY:HAND",20) == 0) - { - // Coming from hand - sTmp = sTmp.substr(21,sTmp.size()); - sTmp = sTmp.substr(0,sTmp.rfind(':')); - sint index; - fromString(sTmp, index); - if (index == 0) - sIE = CTRL_HAND_RIGHT; - else - sIE = CTRL_HAND_LEFT; - // update Hands. - getInventory().Hands[index]= pNL->getValue16(); - } - else if (strnicmp(sTmp.c_str(),"LOCAL:INVENTORY:EQUIP",21) == 0) - { - // Coming from equipement - sTmp = sTmp.substr(22,sTmp.size()); - sTmp = sTmp.substr(0,sTmp.rfind(':')); - sint32 nTmp; - fromString(sTmp, nTmp); - SLOT_EQUIPMENT::TSlotEquipment index = (SLOT_EQUIPMENT::TSlotEquipment)nTmp; - switch(index) - { - case SLOT_EQUIPMENT::HEADDRESS: sIE = CTRL_JEWEL_HEADDRESS; - sIE2= CTRL_JEWL2_HEADDRESS; break; - case SLOT_EQUIPMENT::EARL: sIE = CTRL_JEWEL_EARING_LEFT; - sIE2= CTRL_JEWL2_EARING_LEFT; break; - case SLOT_EQUIPMENT::EARR: sIE = CTRL_JEWEL_EARING_RIGHT; - sIE2= CTRL_JEWL2_EARING_RIGHT; break; - case SLOT_EQUIPMENT::NECKLACE: sIE = CTRL_JEWEL_NECK; - sIE2= CTRL_JEWL2_NECK; break; - case SLOT_EQUIPMENT::WRISTL: sIE = CTRL_JEWEL_BRACELET_LEFT; - sIE2= CTRL_JEWL2_BRACELET_LEFT; break; - case SLOT_EQUIPMENT::WRISTR: sIE = CTRL_JEWEL_BRACELET_RIGHT; - sIE2= CTRL_JEWL2_BRACELET_RIGHT; break; - case SLOT_EQUIPMENT::FINGERL: sIE = CTRL_JEWEL_RING_LEFT; - sIE2= CTRL_JEWL2_RING_LEFT; break; - case SLOT_EQUIPMENT::FINGERR: sIE = CTRL_JEWEL_RING_RIGHT; - sIE2= CTRL_JEWL2_RING_RIGHT; break; - case SLOT_EQUIPMENT::ANKLEL: sIE = CTRL_JEWEL_ANKLET_LEFT; - sIE2= CTRL_JEWL2_ANKLET_LEFT; break; - case SLOT_EQUIPMENT::ANKLER: sIE = CTRL_JEWEL_ANKLET_RIGHT; - sIE2= CTRL_JEWL2_ANKLET_RIGHT; break; - - case SLOT_EQUIPMENT::HEAD: sIE = CTRL_ARMOR_HEAD; - sIE2= CTRL_ARMR2_HEAD; break; - case SLOT_EQUIPMENT::CHEST: sIE = CTRL_ARMOR_CHEST; - sIE2= CTRL_ARMR2_CHEST; break; - case SLOT_EQUIPMENT::ARMS: sIE = CTRL_ARMOR_ARMS; - sIE2= CTRL_ARMR2_ARMS; break; - case SLOT_EQUIPMENT::FEET: sIE = CTRL_ARMOR_FEET; - sIE2= CTRL_ARMR2_FEET; break; - case SLOT_EQUIPMENT::LEGS: sIE = CTRL_ARMOR_LEGS; - sIE2= CTRL_ARMR2_LEGS; break; - case SLOT_EQUIPMENT::HANDS: sIE = CTRL_ARMOR_HANDS; - sIE2= CTRL_ARMR2_HANDS; break; - - default: - nlwarning("entry not handled"); - return; - break; - } - // update Equips. - getInventory().Equip[index]= pNL->getValue16(); - } - else return; - - // Set database for wearing the right item - CDBCtrlSheet *pCS = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(sIE)); - CDBCtrlSheet *pCS2 = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(sIE2)); - - // Remove Last reference and update database - sint16 oldVal = pNL->getOldValue16(); - sint16 newVal = pNL->getValue16(); - if (oldVal != 0) - getInventory().unwearBagItem (oldVal-1); - - if (newVal != 0) - getInventory().wearBagItem (newVal-1); - - // Update Display - if (newVal == 0) - { - // in some case left sheet is same than right sheet so don't clear it now (ex: 2 hands item, right hand exclusive) - if (sIE != CTRL_HAND_LEFT) - { - if (pCS != NULL) pCS->setSheet(""); - if (pCS2 != NULL) pCS2->setSheet(""); - } - } - else - { - if (pCS != NULL) pCS->setSheet(LOCAL_INVENTORY ":BAG:"+ toString(newVal-1)); - if (pCS2 != NULL) pCS2->setSheet(LOCAL_INVENTORY ":BAG:"+ toString(newVal-1)); - } - - // Hands management - if (sIE == CTRL_HAND_RIGHT) - { - // if nothing in left hand -> return - CDBCtrlSheet *pCSLeftHand = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_HAND_LEFT)); - if (pCSLeftHand == NULL) - { - return; - } - - // reset display of left hand - CViewRenderer &rVR = *CViewRenderer::getInstance(); - pCSLeftHand->setTextureNoItem(rVR.getTextureIdFromName("hand_left.tga")); - pCSLeftHand->setGrayed(false); - pCSLeftHand->setItemSlot(SLOTTYPE::stringToSlotType("LEFT_HAND")); - pCSLeftHand->setActionOnLeftClick("proc"); - - // If something in left hand check if we have to remove - { - uint32 leftSheet = 0; - CCDBNodeLeaf *pNL3 = NLGUI::CDBManager::getInstance()->getDbProp(LOCAL_INVENTORY ":HAND:1:INDEX_IN_BAG", false); - if (pNL3 == NULL) return; - if (pNL3->getValue32() > 0) - { - CCDBNodeLeaf *pNL4 = NLGUI::CDBManager::getInstance()->getDbProp(LOCAL_INVENTORY ":BAG:" + toString(pNL3->getValue32()-1) + ":SHEET", false); - if (pNL4 == NULL) return; - leftSheet = pNL4->getValue32(); - } - - uint32 rightSheet = 0; - if (newVal > 0) - { - pNL3 = NLGUI::CDBManager::getInstance()->getDbProp(LOCAL_INVENTORY ":BAG:" + toString(newVal-1) + ":SHEET", false); - if (pNL3 == NULL) return; - rightSheet = pNL3->getValue32(); - } - - uint32 lastRightSheet = 0; - if (oldVal > 0) - { - pNL3 = NLGUI::CDBManager::getInstance()->getDbProp(LOCAL_INVENTORY ":BAG:" + toString(oldVal-1) + ":SHEET", false); - if (pNL3 == NULL) return; - lastRightSheet = pNL3->getValue32(); - } - - // If incompatible -> remove - if (!getInventory().isLeftHandItemCompatibleWithRightHandItem(leftSheet, rightSheet, lastRightSheet)) - { - pCSLeftHand->setSheet(""); - } - // WORKAROUND: useful when an item is destroyed before it is unequipped (clean the left hand) - if ((leftSheet == 0) && (rightSheet == 0)) - { - pCSLeftHand->setSheet(""); - } - } - - // update display of left hand according to new right hand item - if (newVal > 0) - { - CCDBNodeLeaf *pNL2 = NLGUI::CDBManager::getInstance()->getDbProp(LOCAL_INVENTORY ":BAG:" + toString(newVal-1) + ":SHEET", false); - if (pNL2 == NULL) return; - - if (getInventory().is2HandItem(pNL2->getValue32())) - { - if (getInventory().isRangeWeaponItem(pNL2->getValue32())) - { - pCSLeftHand->setItemSlot(SLOTTYPE::stringToSlotType("AMMO")); - pCSLeftHand->setTextureNoItem(rVR.getTextureIdFromName("W_AM_logo.tga")); - } - else - { - pCSLeftHand->setSheet(LOCAL_INVENTORY ":BAG:"+ toString(newVal-1)); - pCSLeftHand->setGrayed(true); - pCSLeftHand->setActionOnLeftClick(""); - } - } - } - } - - // left hand item is changing - if (sIE == CTRL_HAND_LEFT) - { - CDBCtrlSheet *pCSLeftHand = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_HAND_LEFT)); - if ( pCSLeftHand ) - { - CViewRenderer &rVR = *CViewRenderer::getInstance(); - pCSLeftHand->setActionOnLeftClick("proc"); - pCSLeftHand->setGrayed(false); - - // if now there is nothing in left hand - if (newVal == 0) - { - // check if we clear display (have to manage 2 hands weapons for instance) - bool clearLeftHandDisplay = true; - CDBCtrlSheet * pCSRightHand = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_HAND_RIGHT)); - if ( pCSRightHand && pCSRightHand->getSheetId() ) - { - CCDBNodeLeaf *pNL3 = NLGUI::CDBManager::getInstance()->getDbProp(LOCAL_INVENTORY ":HAND:0:INDEX_IN_BAG", false); - if (pNL3) - { - if (pNL3->getValue32() > 0) - { - CCDBNodeLeaf *pNL4 = NLGUI::CDBManager::getInstance()->getDbProp(LOCAL_INVENTORY ":BAG:" + toString(pNL3->getValue32()-1) + ":SHEET", false); - if (pNL4) - { - uint32 rightSheet = pNL4->getValue32(); - if (getInventory().is2HandItem(rightSheet)) - { - if (getInventory().isRangeWeaponItem(rightSheet)) - { - pCSLeftHand->setItemSlot(SLOTTYPE::stringToSlotType("AMMO")); - pCSLeftHand->setTextureNoItem(rVR.getTextureIdFromName("W_AM_logo.tga")); - } - else - { - pCSLeftHand->setItemSlot(SLOTTYPE::stringToSlotType("LEFT_HAND")); - pCSLeftHand->setTextureNoItem(rVR.getTextureIdFromName("hand_left.tga")); - clearLeftHandDisplay = false; - } - } - } - } - } - } - if(clearLeftHandDisplay) - { - if (pCS != NULL) pCS->setSheet(""); - if (pCS2 != NULL) pCS2->setSheet(""); - } - } - } - } -} - -// *************************************************************************** -void CInventoryManager::CDBBagObs::update(ICDBNode* /* node */) -{ - if (IngameDbMngr.initInProgress()) return; - - getInventory().checkIndexInBagIntegrity(); - - // AUTO EQUIP the player with incoming item if we can put this item in an equipment slot - - // if we are not initializing the DB -/* - CCDBNodeLeaf *pNL = dynamic_cast(node); - if (pNL != NULL) - if (pNL->getValue32() == 0) - return; - - if (IngameDbMngr.initInProgress()) return; - - sint bagEntryIndex; - - string path = node->getFullName(); - path = path.substr(0,path.rfind(':')); - path = path.substr(path.rfind(':')+1,path.size()); - - fromString(path, bagEntryIndex); - // equip only if slot empty - getInventory().autoEquip(bagEntryIndex, false); -*/ -} - -// *************************************************************************** -bool CInventoryManager::autoEquip(sint bagEntryIndex, bool allowReplace) -{ - uint i; - - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - IListSheetBase *pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(LIST_BAG_TEXT)); - CDBCtrlSheet *pCSSrc = NULL; - - if (pList == NULL) return false; - - for (i = 0; i < MAX_BAGINV_ENTRIES; ++i) - { - pCSSrc = pList->getSheet(i); - string sTmp = pCSSrc->getSheet(); - sTmp = sTmp.substr(sTmp.rfind(':')+1,sTmp.size()); - sint nTmp; - fromString(sTmp, nTmp); - if (nTmp == bagEntryIndex) - break; - } - - if (i == MAX_BAGINV_ENTRIES) return false; - if (pCSSrc == NULL) return false; - - for (i = 0; i < MAX_HANDINV_ENTRIES; ++i) - { - CDBCtrlSheet *pCSDst = getInventory().getHandSheet(i); - if (pCSDst == NULL) continue; - string dstPath = getInventory().getDBIndexPath(pCSDst); - - sint32 indexDstPath = NLGUI::CDBManager::getInstance()->getDbProp(dstPath+":INDEX_IN_BAG")->getValue16(); - - // Already something in that slot? - if (!allowReplace && indexDstPath > 0) - continue; - - // Does the source and destination are items ? - if (pCSSrc->getType() == CCtrlSheetInfo::SheetType_Item) - if (pCSDst->getType() == CCtrlSheetInfo::SheetType_Item) - { - // Right Slot ? - if (pCSDst->canDropItem(pCSSrc)) - { - // Ok let us equip with this item - string srcPath = pCSSrc->getSheet(); - getInventory().equip (srcPath, dstPath); - return true; - } - } - } - - for (i = 0; i < MAX_EQUIPINV_ENTRIES; ++i) - { - CDBCtrlSheet *pCSDst = getInventory().getEquipSheet(i); - if (pCSDst == NULL) continue; - string dstPath = getInventory().getDBIndexPath(pCSDst); - sint32 indexDstPath = NLGUI::CDBManager::getInstance()->getDbProp(dstPath+":INDEX_IN_BAG")->getValue16(); - - // Already something in that slot? - if (!allowReplace && indexDstPath > 0) - continue; - - // Does the source and destination are items ? - if (pCSSrc->getType() == CCtrlSheetInfo::SheetType_Item) - if (pCSDst->getType() == CCtrlSheetInfo::SheetType_Item) - { - // Right Slot ? - if (pCSDst->canDropItem(pCSSrc)) - { - // Ok let us equip with this item - string srcPath = pCSSrc->getSheet(); - getInventory().equip (srcPath, dstPath); - return true; - } - } - } - return false; -} - -// *************************************************************************** -void CInventoryManager::dropOrDestroyItem(CDBCtrlSheet *item, CBitMemStream &out, uint16 quantity) -{ - if (!item) return; - uint16 inventory = (uint16) item->getInventoryIndex(); - // retrieve inventory & slot - uint16 slot = (uint16) item->getIndexInDB(); - out.serial(inventory); - out.serial(slot); - out.serial(quantity); - NetMngr.push(out); -} - -// *************************************************************************** -static void checkEquipmentIntegrity(const string &equipVal) -{ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp(equipVal+":INDEX_IN_BAG",false); - if (pNL != NULL) - { - uint32 indexInBag = pNL->getValue16(); - if (indexInBag != 0) - { - string sTmp = string(LOCAL_INVENTORY) + ":BAG:" + toString(indexInBag-1) + ":SHEET"; - CCDBNodeLeaf *pNLBag = NLGUI::CDBManager::getInstance()->getDbProp(sTmp,false); - if (pNLBag != NULL) - { - if (pNLBag->getValue32() == 0) // If no more item in this slot bag - { -// if (! IngameDbMngr.initInProgress()) // Commented because init is end when we received equipment -// pNL->setValue16(0); // Reset INDEX_IN_BAG - } - else - { - // If the slot was previously empty check that there is no reference on it - // else update the reference - if (pNLBag->getOldValue32() == 0) - { - for (uint32 i = 0; i < MAX_EQUIPINV_ENTRIES; ++i) - { - CDBCtrlSheet *pCSDst = getInventory().getEquipSheet(i); - if (pCSDst == NULL) continue; - string dstPath = getInventory().getDBIndexPath(pCSDst); - sint32 indexDstPath = NLGUI::CDBManager::getInstance()->getDbProp(dstPath+":INDEX_IN_BAG")->getValue16(); - - // Update the sheet id of the control sheet - if (indexDstPath == (sint32)indexInBag) - { - pCSDst->setSheetId(pNLBag->getValue32()); - } - } - } - } - } - } - } -} - -// *************************************************************************** -void CInventoryManager::checkIndexInBagIntegrity() -{ - string sTmp; - uint32 i; - - for (i = 0; i < MAX_HANDINV_ENTRIES; ++i) - { - sTmp = string(LOCAL_INVENTORY) + ":HAND:" + toString(i); - checkEquipmentIntegrity(sTmp); - } - - for (i = 0; i < MAX_EQUIPINV_ENTRIES; ++i) - { - sTmp = string(LOCAL_INVENTORY) + ":EQUIP:" + toString(i); - checkEquipmentIntegrity(sTmp); - } -} - -// *************************************************************************** -double CInventoryManager::getBranchBulk(const string &basePath, uint16 startItemIndex, uint16 numItems) -{ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CCDBNodeBranch *branch = NLGUI::CDBManager::getInstance()->getDbBranch(basePath); - if (!branch) - { - nlwarning(" Branch is NULL"); - return 0; - } - - double totalBulk = 0; - // - uint16 lastIndexItem = std::min((uint16) (startItemIndex + numItems), (uint16) branch->getNbNodes()); - for (uint16 currItem = startItemIndex; currItem < lastIndexItem; ++ currItem) - { - ICDBNode *node = branch->getNode(currItem); - if (node) - { - CCDBNodeLeaf *sheetNode = dynamic_cast(node->getNode(ICDBNode::CTextId("SHEET"))); - CCDBNodeLeaf *quantityNode = dynamic_cast(node->getNode(ICDBNode::CTextId("QUANTITY"))); - if (sheetNode && quantityNode) - { - // get the Sheet - CSheetId sheetId = CSheetId(sheetNode->getValue32()); - if (sheetId != CSheetId::Unknown) - { - CItemSheet *itemSheet= dynamic_cast(SheetMngr.get(sheetId)); - if(itemSheet) - { - totalBulk += std::max((sint32)1, quantityNode->getValue32()) * itemSheet->Bulk; - } - } - } - } - } - - return totalBulk; -} - -/* - *Get the number of used and max slots - */ -void CInventoryManager::getBranchSlotCounts(const std::string &basePath, uint& nbUsedSlots, uint& nbMaxSlots ) -{ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CCDBNodeBranch *branch = NLGUI::CDBManager::getInstance()->getDbBranch(basePath); - if (!branch) - { - nlwarning(" Branch is NULL"); - return; - } - - nbMaxSlots = 0; // different from nbNodes, because there can be non-slots leaves (e.g. guild money...) - nbUsedSlots = 0; - uint nbNodes = branch->getNbNodes(); - for ( uint i=0; i!=nbNodes; ++i ) - { - ICDBNode *node = branch->getNode(i); - if (node) - { - CCDBNodeLeaf *sheetNode = dynamic_cast(node->getNode(ICDBNode::CTextId("SHEET"))); - if (sheetNode) - { - // Get the Sheet - CSheetId sheetId = CSheetId(sheetNode->getValue32()); - if (sheetId != CSheetId::Unknown) - { - ++nbUsedSlots; - } - - ++nbMaxSlots; - } - } - } -} - - -// *************************************************************************** -double CInventoryManager::getBagBulk(uint32 inventoryIndex) -{ - nlctassert(MAX_INVENTORY_ANIMAL==7); - if (inventoryIndex == 0) - return getBranchBulk(LOCAL_INVENTORY ":BAG", 0, MAX_BAGINV_ENTRIES); - else if (inventoryIndex == 1) - return getBranchBulk(LOCAL_INVENTORY ":PACK_ANIMAL0", 0, MAX_ANIMALINV_ENTRIES); - else if (inventoryIndex == 2) - return getBranchBulk(LOCAL_INVENTORY ":PACK_ANIMAL1", 0, MAX_ANIMALINV_ENTRIES); - else if (inventoryIndex == 3) - return getBranchBulk(LOCAL_INVENTORY ":PACK_ANIMAL2", 0, MAX_ANIMALINV_ENTRIES); - else if (inventoryIndex == 4) - return getBranchBulk(LOCAL_INVENTORY ":PACK_ANIMAL3", 0, MAX_ANIMALINV_ENTRIES); - else if (inventoryIndex == 5) - return getBranchBulk(LOCAL_INVENTORY ":PACK_ANIMAL4", 0, MAX_ANIMALINV_ENTRIES); - else if (inventoryIndex == 6) - return getBranchBulk(LOCAL_INVENTORY ":PACK_ANIMAL5", 0, MAX_ANIMALINV_ENTRIES); - else if (inventoryIndex == 7) - return getBranchBulk(LOCAL_INVENTORY ":PACK_ANIMAL6", 0, MAX_ANIMALINV_ENTRIES); - else if (inventoryIndex == 8) - return 0; - else if (inventoryIndex == 9) - return 0; - else if (inventoryIndex == 10) - return getBranchBulk(LOCAL_INVENTORY ":TEMP", 0, MAX_TEMPINV_ENTRIES); - return 0; -} - -// *************************************************************************** -double CInventoryManager::getItemBulk(uint32 sheetID) -{ - CItemSheet *itemSheet= dynamic_cast(SheetMngr.get(CSheetId(sheetID))); - if(itemSheet) - return itemSheet->Bulk; - return 0; -} - -// *************************************************************************** -double CInventoryManager::getMaxBagBulk(uint32 inventoryIndex) -{ - nlctassert(MAX_INVENTORY_ANIMAL==7); - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CCDBNodeLeaf *pNL=NULL; - if (inventoryIndex == 0) - pNL = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:STATIC_DATA:BAG_BULK_MAX"); - else if (inventoryIndex == 1) - pNL = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:PACK_ANIMAL:BEAST0:BULK_MAX"); - else if (inventoryIndex == 2) - pNL = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:PACK_ANIMAL:BEAST1:BULK_MAX"); - else if (inventoryIndex == 3) - pNL = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:PACK_ANIMAL:BEAST2:BULK_MAX"); - else if (inventoryIndex == 4) - pNL = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:PACK_ANIMAL:BEAST3:BULK_MAX"); - else if (inventoryIndex == 5) - pNL = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:PACK_ANIMAL:BEAST4:BULK_MAX"); - else if (inventoryIndex == 6) - pNL = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:PACK_ANIMAL:BEAST5:BULK_MAX"); - else if (inventoryIndex == 7) - pNL = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:PACK_ANIMAL:BEAST6:BULK_MAX"); - if (pNL != NULL) - return pNL->getValue32(); - return 0; -} - -// *************************************************************************** -bool CInventoryManager::isSpaceInAllBagsForItem(CDBCtrlSheet *item) -{ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CDBCtrlSheet *pCSDst = item; - if (!pCSDst->isSheetValid()) return false; - string sTmp = pCSDst->getSheet(); - CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp(sTmp+":SHEET",false); - CCDBNodeLeaf *pNLquantity = NLGUI::CDBManager::getInstance()->getDbProp(sTmp+":QUANTITY",false); - if (pNL == NULL) return false; - if (pNLquantity == NULL) return false; - - // Check if we can find empty space for this item (or stack of item) - // in all of the bags that the player owe. - - CInventoryManager *pInv = CInventoryManager::getInstance(); - uint32 quantity = pNLquantity->getValue32(); - double totalBulk = quantity * pInv->getItemBulk(pNL->getValue32()); -// bool bPlaceFound = false; - for (uint32 i = 0; i < 7; ++i) - { - if (pInv->isInventoryAvailable((INVENTORIES::TInventory)CInventoryManager::InventoryIndexes[i])) - if ((pInv->getBagBulk(i) + totalBulk) <= pInv->getMaxBagBulk(i)) - return true; - } - return false; -} - -// *************************************************************************** -bool CInventoryManager::isSpaceInBagForItem(CDBCtrlSheet *item, uint32 quantity, uint32 bagId) -{ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CDBCtrlSheet *pCSDst = item; - if (!pCSDst->isSheetValid()) return false; - string sTmp = pCSDst->getSheet(); - CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp(sTmp+":SHEET",false); - if (pNL == NULL) return false; - - // Check if we can find empty space for this item (or stack of item) - // in a given bag that the player owe. - - CInventoryManager *pInv = CInventoryManager::getInstance(); - double totalBulk = quantity * pInv->getItemBulk(pNL->getValue32()); - if (pInv->isInventoryAvailable((INVENTORIES::TInventory)CInventoryManager::InventoryIndexes[bagId])) - if ((pInv->getBagBulk(bagId) + totalBulk) <= pInv->getMaxBagBulk(bagId)) - return true; - return false; -} - - -// *************************************************************************** -// CTempInvManager -// *************************************************************************** - -// Observers on DB -// *************************************************************************** -void CTempInvManager::CDBObs::update(ICDBNode* /* node */) -{ - CTempInvManager::getInstance()->update(); -} - -void CTempInvManager::CDBObsType::update(ICDBNode* /* node */) -{ - CTempInvManager::getInstance()->updateType(); -} - -void CTempInvManager::CDBForageQQObs::update(ICDBNode* /* node */) -{ - CTempInvManager::getInstance()->updateForageQQ( WhichOne ); -} - -// *************************************************************************** -CTempInvManager::CTempInvManager() -{ - _Mode = TEMP_INV_MODE::Unknown; - - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - - string sPath = string("LOCAL:INVENTORY:TEMP"); - for (uint i = 0; i < MAX_TEMPINV_ENTRIES; ++i) - { - CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp(sPath+":"+toString(i)+":SHEET", false); - if (pNL != NULL) - { - ICDBNode::CTextId textId; - pNL->addObserver(&_DBObs, textId); - } - } - // Add Also the Mode to observe - CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp(sPath+":TYPE", false); - if(pNL) - { - ICDBNode::CTextId textId; - pNL->addObserver(&_DBObsType, textId); - } - - // Forage - pNL = NLGUI::CDBManager::getInstance()->getDbProp(sPath+":ENABLE_TAKE"); - if (pNL != NULL) - { - ICDBNode::CTextId textId; - pNL->addObserver(&_DBObs, textId); - } - pNL = NLGUI::CDBManager::getInstance()->getDbProp(sPath+":0:QUANTITY"); - _DBForageQQObs[0].WhichOne = 0; - if (pNL != NULL) - { - ICDBNode::CTextId textId; - pNL->addObserver(&_DBForageQQObs[0], textId); - } - pNL = NLGUI::CDBManager::getInstance()->getDbProp(sPath+":0:QUALITY"); - _DBForageQQObs[1].WhichOne = 1; - if (pNL != NULL) - { - ICDBNode::CTextId textId; - pNL->addObserver(&_DBForageQQObs[1], textId); - } -} - -// *************************************************************************** -CTempInvManager::~CTempInvManager() -{ -} - -// *************************************************************************** -void CTempInvManager::releaseInstance() -{ - if( _Instance ) - delete _Instance; - _Instance = NULL; -} - -// *************************************************************************** -void CTempInvManager::update() -{ - bool bAllEmpty = true; - // Check the database state - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - string sPath = string("LOCAL:INVENTORY:TEMP"); - for (uint i = 0; i < MAX_TEMPINV_ENTRIES; i++) - { - string sTmp = sPath + ":" + toString(i) + ":SHEET"; - CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp(sTmp); -// uint32 nOldSheet = pNL->getOldValue32(); - uint32 nSheet = pNL->getValue32(); - if (nSheet != 0) - bAllEmpty = false; - } - - _Mode = (TEMP_INV_MODE::TInventoryMode)NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:INVENTORY:TEMP:TYPE")->getValue8(); - - CGroupContainer *pGC = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WIN_TEMPINV)); - if (pGC == NULL) - return; - - // show/hide weight info depending on temp inventory mode - bool displayWeight = (_Mode == TEMP_INV_MODE::Craft); - CViewBase *weightText = dynamic_cast(pGC->getView("weight_txt")); - if (weightText != NULL) - weightText->setActive(displayWeight); - CViewBase *weightImg = dynamic_cast(pGC->getView("weight")); - if (weightImg != NULL) - weightImg->setActive(displayWeight); - - if (_Mode == TEMP_INV_MODE::Forage) - { - // Disable/enable "Take all" button - bool disableTake = (NLGUI::CDBManager::getInstance()->getDbProp(sPath+":ENABLE_TAKE")->getValue32() == 0); - NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP_INV:ALL_EMPTY")->setValue32(disableTake); - if ( disableTake ) - { - // Display begin of forage - pGC->setTitle( WIN_TEMPINV_TITLE_WAIT_FORAGING ); - _DBForageQQObs[0].FullValue = 0.0f; - _DBForageQQObs[1].FullValue = 0.0f; - } - else - { - // Display forage result - pGC->setTitle( WIN_TEMPINV_TITLE_FORAGE_RESULT ); - } - } - else - { - // Write to the UI db the empty state - NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP_INV:ALL_EMPTY")->setValue32(bAllEmpty); - } - - if (bAllEmpty) - { - // If all slots are empty, close the interface - pGC->setActive(false); - CAHManager::getInstance()->runActionHandler("phrase_update_all_memory_ctrl_regen_tick_range", NULL); - } - else - { - pGC->setActive(true); - CAHManager::getInstance()->runActionHandler("phrase_update_all_memory_ctrl_regen_tick_range", NULL); - // Something arrived, change text - switch(_Mode) - { - case TEMP_INV_MODE::Loot: pGC->setTitle(WIN_TEMPINV_TITLE_LOOT); break; - case TEMP_INV_MODE::Quarter: pGC->setTitle(WIN_TEMPINV_TITLE_QUARTERING); break; - case TEMP_INV_MODE::Forage: /* see above */ break; - case TEMP_INV_MODE::BagFull: pGC->setTitle(WIN_TEMPINV_TITLE_BAGFULL); break; - case TEMP_INV_MODE::Craft: pGC->setTitle(WIN_TEMPINV_TITLE_CRAFT); break; - case TEMP_INV_MODE::MissionReward: pGC->setTitle(WIN_TEMPINV_TITLE_MISSIONREWARD); break; - case TEMP_INV_MODE::Crystallize: pGC->setTitle(WIN_TEMPINV_TITLE_CRYSTALLIZE); break; - - case TEMP_INV_MODE::Unknown: - default: pGC->setTitle(WIN_TEMPINV_TITLE_ERROR); break; - } - } -} - -// *************************************************************************** -void CTempInvManager::updateType() -{ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - _Mode = (TEMP_INV_MODE::TInventoryMode)NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:INVENTORY:TEMP:TYPE")->getValue8(); - CGroupContainer *pGC = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WIN_TEMPINV)); - // Something arrived, change text - switch(_Mode) - { - case TEMP_INV_MODE::Loot: pGC->setTitle(WIN_TEMPINV_TITLE_LOOT); break; - case TEMP_INV_MODE::Quarter: pGC->setTitle(WIN_TEMPINV_TITLE_QUARTERING); break; - case TEMP_INV_MODE::Forage: /* see above */ break; - case TEMP_INV_MODE::BagFull: pGC->setTitle(WIN_TEMPINV_TITLE_BAGFULL); break; - case TEMP_INV_MODE::Craft: pGC->setTitle(WIN_TEMPINV_TITLE_CRAFT); break; - case TEMP_INV_MODE::MissionReward: pGC->setTitle(WIN_TEMPINV_TITLE_MISSIONREWARD); break; - case TEMP_INV_MODE::Crystallize: pGC->setTitle(WIN_TEMPINV_TITLE_CRYSTALLIZE); break; - - case TEMP_INV_MODE::Unknown: - default: /*pGC->setTitle(WIN_TEMPINV_TITLE_ERROR);*/ // do not overwrite a locally-set title with the default one when ServerAutoCopy syncs the local db during 'make item' (craft) - break; - } -} - -// *************************************************************************** -// Called when INVENTORY:TEMP:0:QUANTITY or INVENTORY:TEMP:0:QUALITY is modified -// Reacts only if mode is Forage -void CTempInvManager::updateForageQQ( uint whichOne ) -{ - if ( _Mode != TEMP_INV_MODE::Forage ) - return; - - // Avoid recursion, because we can't call CCDBNodeLeaf::setValue16() without calling observers! - static bool isInUpdateForageQQ = false; - if ( isInUpdateForageQQ ) - return; - isInUpdateForageQQ = true; - - // Display forage progress with counters - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - bool disableTake = (NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:INVENTORY:TEMP:ENABLE_TAKE")->getValue32() == 0); - if ( disableTake ) - { - float qt = 0.f, ql = 0.f; - switch ( whichOne ) - { - case 0: - { - CCDBNodeLeaf *leafQt = NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:INVENTORY:TEMP:0:QUANTITY"); - uint16 qtX10 = (uint16)(leafQt->getValue16()); - qt = _DBForageQQObs[whichOne].FullValue = (((float)(uint)qtX10) / 10.0f); - leafQt->setValue16( (sint16)(sint)qt ); - ql = _DBForageQQObs[1-whichOne].FullValue; - } - break; - case 1: - { - CCDBNodeLeaf *leafQl = NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:INVENTORY:TEMP:0:QUALITY"); - uint16 qlX10 = (uint16)(leafQl->getValue16()); - ql = _DBForageQQObs[whichOne].FullValue = (((float)(uint)qlX10) / 10.0f); - leafQl->setValue16( (sint16)(sint)ql ); - qt = _DBForageQQObs[1-whichOne].FullValue; - } - break; - default:; - } - ucstring title = CI18N::get( WIN_TEMPINV_TITLE_FORAGING ); - strFindReplace( title, "%qt", toString( "%.1f", qt ) ); - strFindReplace( title, "%ql", toString( "%.1f", ql ) ); - CGroupContainer *pGC = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WIN_TEMPINV)); - pGC->setUCTitle( title ); - } - - isInUpdateForageQQ = false; -} - -// *************************************************************************** -void CTempInvManager::open(TEMP_INV_MODE::TInventoryMode m) -{ - _Mode = m; - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CGroupContainer *pGC = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WIN_TEMPINV)); - - // In Foraging mode, we can call open() on the inventory with the same contents (e.g. when changing Forage action) - if ( _Mode != TEMP_INV_MODE::Forage ) - { - string sPath = string("LOCAL:INVENTORY:TEMP"); - for (uint i = 0; i < MAX_TEMPINV_ENTRIES; i++) - { - string sTmp = sPath + ":" + toString(i) + ":SHEET"; - CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp(sTmp); - pNL->setValue32(0); - } - } - NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:INVENTORY:TEMP:TYPE")->setValue8((uint8)_Mode); - - IngameDbMngr.flushObserverCalls(); - NLGUI::CDBManager::getInstance()->flushObserverCalls(); - - if (pGC != NULL) - { - switch(_Mode) - { - case TEMP_INV_MODE::Loot: pGC->setTitle(WIN_TEMPINV_TITLE_WAIT_LOOT); break; - case TEMP_INV_MODE::Quarter: pGC->setTitle(WIN_TEMPINV_TITLE_WAIT_QUARTERING); break; - case TEMP_INV_MODE::Forage: pGC->setTitle(WIN_TEMPINV_TITLE_WAIT_FORAGING); break; - case TEMP_INV_MODE::BagFull: pGC->setTitle(WIN_TEMPINV_TITLE_WAIT_BAGFULL); break; - case TEMP_INV_MODE::Craft: pGC->setTitle(WIN_TEMPINV_TITLE_WAIT_CRAFT); break; - case TEMP_INV_MODE::MissionReward: pGC->setTitle(WIN_TEMPINV_TITLE_WAIT_MISSIONREWARD); break; - case TEMP_INV_MODE::Crystallize: pGC->setTitle(WIN_TEMPINV_TITLE_WAIT_CRYSTALLIZE); break; - - case TEMP_INV_MODE::Unknown: - default: pGC->setTitle(WIN_TEMPINV_TITLE_WAIT_ERROR); break; - }; - - pGC->setActive(true); - CAHManager::getInstance()->runActionHandler("phrase_update_all_memory_ctrl_regen_tick_range", NULL); - } -} - -// *************************************************************************** -void CTempInvManager::close() -{ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - string sPath = string("LOCAL:INVENTORY:TEMP"); - - // Clear temp inventory if needed - for (uint i = 0; i < MAX_TEMPINV_ENTRIES; i++) - { - string sTmp = sPath + ":" + toString(i) + ":SHEET"; - CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp(sTmp); - pNL->setValue32(0); - } - - CInterfaceGroup *pIG = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WIN_TEMPINV)); - if (pIG != NULL) - { - pIG->setActive(false); - CAHManager::getInstance()->runActionHandler("phrase_update_all_memory_ctrl_regen_tick_range", NULL); - } -} - -// *************************************************************************** -bool CTempInvManager::isOpened() -{ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CGroupContainer *pGC = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WIN_TEMPINV)); - if (pGC != NULL) - return pGC->getActive(); - return false; -} - -// *************************************************************************** -// BAG LISTS COMMON STUFF (sort, options ...) -// *************************************************************************** - -// *************************************************************************** -#define BAG_ITEM_NOT_SORTED 1000000 -// Used for sorting -void initStructForItemSort(vector&vTemp, sint32 sheetId, sint32 quality, sint32 indexInList, sint32 indexInDB) -{ - // Default value is the linear pos in the db (in case its not an item) - vTemp[indexInList].Pos = toString("%08d", indexInDB); - - // if not empty - if (sheetId != 0) - { - CEntitySheet *pItem = SheetMngr.get(CSheetId(sheetId)); - if ((pItem != NULL) && (pItem->Type == CEntitySheet::ITEM)) - { - CItemSheet *pIS = safe_cast(pItem); - vTemp[indexInList].Pos = toString("%02d", pIS->Family); - vTemp[indexInList].Pos += toString("%03d", pIS->ItemType); - - // add some specific sort for raw material - if (pIS->Family == ITEMFAMILY::RAW_MATERIAL) - vTemp[indexInList].Pos += toString("%010d", pIS->Mp.ItemPartBF); - else - vTemp[indexInList].Pos += toString("%010d", 0); - - // add some specific sort for teleport - if (pIS->Family == ITEMFAMILY::TELEPORT) - vTemp[indexInList].Pos += toString("%02d%02d", pIS->ItemOrigin, pIS->Teleport.Type); - else - vTemp[indexInList].Pos += toString("%02d%02d", 0, 0); - - - vTemp[indexInList].Pos += toString("%03d", quality); - - // add sort by name - vTemp[indexInList].Pos += CSheetId(sheetId).toString(); - - - // add at last the index in DB. to avoid resort for items that are exaclty the same - vTemp[indexInList].Pos += toString("%03d", indexInDB); - } - } -} - -// *************************************************************************** -// Used for common options -bool SBagOptions::parse(xmlNodePtr cur, CInterfaceGroup * /* parentGroup */) -{ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - // read params - CXMLAutoPtr prop; - - // value - prop = xmlGetProp (cur, (xmlChar*)"inv_type"); - if (prop) - { - InvType = CInventoryManager::invTypeFromString(prop.str()); - } - else - { - InvType = CInventoryManager::InvUnknown; - nlwarning("cannot find inventory type"); - } - - prop = xmlGetProp (cur, (xmlChar*)"filter_armor"); - if (prop) DbFilterArmor = NLGUI::CDBManager::getInstance()->getDbProp(prop.str()); - - prop = xmlGetProp (cur, (xmlChar*)"filter_weapon"); - if (prop) DbFilterWeapon = NLGUI::CDBManager::getInstance()->getDbProp(prop.str()); - - prop = xmlGetProp (cur, (xmlChar*)"filter_tool"); - if (prop) DbFilterTool = NLGUI::CDBManager::getInstance()->getDbProp(prop.str()); - - prop = xmlGetProp (cur, (xmlChar*)"filter_pet"); - if (prop) DbFilterPet = NLGUI::CDBManager::getInstance()->getDbProp(prop.str()); - - prop = xmlGetProp (cur, (xmlChar*)"filter_mp"); - if (prop) DbFilterMP = NLGUI::CDBManager::getInstance()->getDbProp(prop.str()); - - prop = xmlGetProp (cur, (xmlChar*)"filter_missmp"); - if (prop) DbFilterMissMP = NLGUI::CDBManager::getInstance()->getDbProp(prop.str()); - - prop = xmlGetProp (cur, (xmlChar*)"filter_tp"); - if (prop) DbFilterTP = NLGUI::CDBManager::getInstance()->getDbProp(prop.str()); - - return true; -} - -// *************************************************************************** -void SBagOptions::setSearchFilter(const ucstring &s) -{ - SearchQualityMin = 0; - SearchQualityMax = 999; - SearchFilter.clear(); - SearchFilterChanged = true; - - if (!s.empty()) - { - std::vector words; - splitUCString(toLower(s), ucstring(" "), words); - - size_t pos; - for(int i = 0; igetValue8() != 0) != LastDbFilterArmor) - { - bRet = true; - LastDbFilterArmor = (DbFilterArmor->getValue8() != 0); - } - - if (DbFilterWeapon != NULL) - if ((DbFilterWeapon->getValue8() != 0) != LastDbFilterWeapon) - { - bRet = true; - LastDbFilterWeapon = (DbFilterWeapon->getValue8() != 0); - } - - if (DbFilterTool != NULL) - if ((DbFilterTool->getValue8() != 0) != LastDbFilterTool) - { - bRet = true; - LastDbFilterTool = (DbFilterTool->getValue8() != 0); - } - - if (DbFilterPet != NULL) - if ((DbFilterPet->getValue8() != 0) != LastDbFilterPet) - { - bRet = true; - LastDbFilterPet = (DbFilterPet->getValue8() != 0); - } - - if (DbFilterMP != NULL) - if ((DbFilterMP->getValue8() != 0) != LastDbFilterMP) - { - bRet = true; - LastDbFilterMP = (DbFilterMP->getValue8() != 0); - } - - if (DbFilterMissMP != NULL) - if ((DbFilterMissMP->getValue8() != 0) != LastDbFilterMissMP) - { - bRet = true; - LastDbFilterMissMP = (DbFilterMissMP->getValue8() != 0); - } - - if (DbFilterTP != NULL) - if ((DbFilterTP->getValue8() != 0) != LastDbFilterTP) - { - bRet = true; - LastDbFilterTP = (DbFilterTP->getValue8() != 0); - } - - if (SearchFilterChanged) - { - bRet = true; - SearchFilterChanged = false; - } - - return bRet; -} - -// *************************************************************************** -bool SBagOptions::canDisplay(CDBCtrlSheet *pCS) const -{ - bool bDisplay = true; - - bool bFilterArmor = getFilterArmor(); - bool bFilterWeapon = getFilterWeapon(); - bool bFilterTool = getFilterTool(); - bool bFilterPet = getFilterPet(); - bool bFilterMP = getFilterMP(); - bool bFilterMissMP = getFilterMissMP(); - bool bFilterTP = getFilterTP(); - - const CItemSheet *pIS = pCS->asItemSheet(); - if (pIS != NULL) - { - if (SearchFilter.size() > 0) - { - bool match = true; - ucstring lcName = toLower(pCS->getItemActualName()); - - // add item quality as a keyword to match - if (pCS->getQuality() > 1) - { - lcName += ucstring(" " + toString(pCS->getQuality())); - } - - for (uint i = 0; i< SearchFilter.size(); ++i) - { - if (lcName.find(SearchFilter[i]) == ucstring::npos) - { - return false; - } - } - } - - // Quality range - if (SearchQualityMin > pCS->getQuality() || SearchQualityMax < pCS->getQuality()) - return false; - - // Armor - if ((pIS->Family == ITEMFAMILY::ARMOR) || - (pIS->Family == ITEMFAMILY::JEWELRY)) - if (!bFilterArmor) bDisplay = false; - - // Weapon - if ((pIS->Family == ITEMFAMILY::SHIELD) || - (pIS->Family == ITEMFAMILY::MELEE_WEAPON) || - (pIS->Family == ITEMFAMILY::RANGE_WEAPON) || - (pIS->Family == ITEMFAMILY::AMMO) || - (pIS->Family == ITEMFAMILY::CRYSTALLIZED_SPELL) || - (pIS->Family == ITEMFAMILY::ITEM_SAP_RECHARGE) || - (pIS->Family == ITEMFAMILY::BRICK) ) - if (!bFilterWeapon) bDisplay = false; - - // Tool - if ((pIS->Family == ITEMFAMILY::CRAFTING_TOOL) || - (pIS->Family == ITEMFAMILY::HARVEST_TOOL) || - (pIS->Family == ITEMFAMILY::TAMING_TOOL) || - (pIS->Family == ITEMFAMILY::TRAINING_TOOL) || - (pIS->Family == ITEMFAMILY::BAG)) - if (!bFilterTool) bDisplay = false; - - // Pet - if (pIS->Family == ITEMFAMILY::PET_ANIMAL_TICKET) - if (!bFilterPet) bDisplay = false; - - // MP - if ((pIS->Family == ITEMFAMILY::RAW_MATERIAL) && pIS->canBuildSomeItemPart()) - if (!bFilterMP) bDisplay = false; - - // Mission MP - if ((pIS->Family == ITEMFAMILY::MISSION_ITEM) || - (pIS->Family == ITEMFAMILY::XP_CATALYSER) || - (pIS->Family == ITEMFAMILY::CONSUMABLE) || - ((pIS->Family == ITEMFAMILY::RAW_MATERIAL) && !pIS->canBuildSomeItemPart())) - if (!bFilterMissMP) bDisplay = false; - - // Teleporter Pacts - if ((pIS->Family == ITEMFAMILY::TELEPORT)) - if (!bFilterTP) bDisplay = false; - - // Jobs Items - if (pIS->Id.toString().substr(0, 6) == "rpjob_") - bDisplay = false; - } - - return bDisplay; -} - -// *************************************************************************** -// CDBGroupListSheetBag -// *************************************************************************** - - -// *************************************************************************** -bool CDBGroupListSheetBag::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) -{ - if(!CDBGroupListSheetText::parse(cur, parentGroup)) - return false; - - // Parse options (type, filters ...) - if (!_BO.parse(cur,parentGroup)) - return false; - - return true; -} - -// *************************************************************************** -void CDBGroupListSheetBag::checkCoords () -{ - CDBGroupListSheetText::checkCoords(); - if (_BO.isSomethingChanged()) - invalidateCoords(); -} - -// *************************************************************************** -void CDBGroupListSheetBag::CSheetChildBag::updateViewText(CDBGroupListSheetText * /* pFather */) -{ - // common method to update text as item - updateViewTextAsItem(); -} - -// *************************************************************************** -bool CDBGroupListSheetBag::CSheetChildBag::isSheetValid(CDBGroupListSheetText *pFather) -{ - if (CSheetChild::isSheetValid(pFather)) - { - // Check if the control match the filters ! - CDBGroupListSheetBag *pList = dynamic_cast(pFather); - if (pList) - return pList->canDisplay(Ctrl); - } - return false; -} - -// *************************************************************************** -void CDBGroupListSheetBag::CSheetChildBag::init(CDBGroupListSheetText *pFather, uint index) -{ - // init my parent - CSheetChild::init(pFather, index); - - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - - // **** Bind the quality - { - // Basic quality - string db= Ctrl->getSheet()+":QUALITY"; - if( NLGUI::CDBManager::getInstance()->getDbProp(db, false) ) - CurrentQuality.link ( db.c_str() ); - else - { - // dummy link to ui:..... - CurrentQuality.link("UI:DUMMY:QUALITY"); - CurrentQuality.setSInt32(0); - } - } -} - -// *************************************************************************** -bool CDBGroupListSheetBag::CSheetChildBag::isInvalidated(CDBGroupListSheetText * /* pFather */) -{ - // quality change - if( CurrentQuality.getSInt32() != LastQuality ) - return true; - - return false; -} - -// *************************************************************************** -void CDBGroupListSheetBag::CSheetChildBag::update(CDBGroupListSheetText * /* pFather */) -{ - LastQuality= CurrentQuality.getSInt32(); -} - -// *************************************************************************** -void CDBGroupListSheetBag::onSwap (sint /* nDraggedSheet */, sint /* nDroppedSheet */) -{ - // No more used because automatic sort -} - -// *************************************************************************** -void CDBGroupListSheetBag::sort() -{ - vector vTemp; - - vTemp.resize (_MaxItems); - - uint i; - for (i = 0; i < _MaxItems; ++i) - { - vTemp[i].SheetText = _SheetChildren[i]; - - CDBCtrlSheet *ctrl= _SheetChildren[i]->Ctrl; - initStructForItemSort (vTemp, ctrl->getSheetId(), ctrl->getQuality(), i, ctrl->getIndexInDB()); - } - - std::sort(vTemp.begin(), vTemp.end()); - - for (i = 0; i < _MaxItems; ++i) - { - _SheetChildren[i] = vTemp[i].SheetText; - } -} - -// *************************************************************************** -// CDBGroupIconListBag -// *************************************************************************** - -// *************************************************************************** -bool CDBGroupIconListBag::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) -{ - if(!CDBGroupListSheet::parse(cur, parentGroup)) - return false; - - // Parse options (type, filters ...) - if (!_BO.parse(cur,parentGroup)) - return false; - - return true; -} - -// *************************************************************************** -void CDBGroupIconListBag::sort() -{ - vector vTemp; - - vTemp.resize (_MaxItems); - - uint i; - for (i = 0; i < _MaxItems; ++i) - { - vTemp[i].SheetIcon = _SheetChildren[i]; - - CDBCtrlSheet *ctrl= _SheetChildren[i]->Ctrl; - initStructForItemSort (vTemp, ctrl->getSheetId(), ctrl->getQuality(), i, ctrl->getIndexInDB()); - } - - std::sort(vTemp.begin(), vTemp.end()); - - for (i = 0; i < _MaxItems; ++i) - { - _SheetChildren[i] = vTemp[i].SheetIcon; - } -} - -// *************************************************************************** -void CDBGroupIconListBag::checkCoords () -{ - CDBGroupListSheet::checkCoords(); - if (_BO.isSomethingChanged()) - invalidateCoords(); -} - -// *************************************************************************** -bool CDBGroupIconListBag::CSheetChildBag::isSheetValid(CDBGroupListSheet *pFather) -{ - if (CSheetChild::isSheetValid(pFather)) - { - // Check if the control match the filters ! - CDBGroupIconListBag *pList = dynamic_cast(pFather); - if (pList) - return pList->canDisplay(Ctrl); - } - return false; -} - - - -// *************************************************************************** -// CDBGroupListSheetFilterCLMSlot -// *************************************************************************** - -// *************************************************************************** -bool CDBGroupListSheetFilterCLMSlot::CSheetChildFilter::isSheetValid(CDBGroupListSheet *pFather) -{ - if (CSheetChild::isSheetValid(pFather)) - { - /* This filter look the ctrl who launch the modal where this list is displayed. - If we can drop this ChildCtrl, on the CLM control, then ok, filtered - Plus the ChildControl must not be locked - */ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CDBCtrlSheet *clmCtrl = dynamic_cast(CWidgetManager::getInstance()->getCtrlLaunchingModal()); - if (!clmCtrl || !Ctrl) return false; - if (clmCtrl->getInventoryIndex() == INVENTORIES::exchange && - Ctrl->getInventoryIndex() == INVENTORIES::exchange) - { - return false; - } - if ((clmCtrl->getType() == CCtrlSheetInfo::SheetType_Item) && - (Ctrl->getType() == CCtrlSheetInfo::SheetType_Item) ) - { - // Ok if we can put in the slot Ctrl in clmCtrl - if ( clmCtrl->canDropItem(Ctrl)) - { - string sTmp = Ctrl->getSheet(); - // Look if the source is locked - sTmp = sTmp.substr(sTmp.rfind(':')+1,sTmp.size()); - sint32 nTmp; - fromString(sTmp, nTmp); - if (!getInventory().isBagItemWeared(nTmp)) - return true; - } - } - } - return false; -} - -// *************************************************************************** -// CDBGroupListSheetFilterExchangeable -// *************************************************************************** - -// *************************************************************************** -bool CDBGroupListSheetFilterExchangeable::CSheetChildFilter::isSheetValid(CDBGroupListSheet *pFather) -{ - if (CSheetChild::isSheetValid(pFather)) - { - if(!Ctrl) - return false; - extern bool checkCanExchangeItem(CDBCtrlSheet *); - return checkCanExchangeItem(Ctrl); - } - return false; -} - -// *************************************************************************** -void CDBGroupListSheetFilterExchangeable::sort() -{ - vector vTemp; - - vTemp.resize (_MaxItems); - - uint i; - for (i = 0; i < _MaxItems; ++i) - { - vTemp[i].SheetIcon = _SheetChildren[i]; - - CDBCtrlSheet *ctrl= _SheetChildren[i]->Ctrl; - initStructForItemSort (vTemp, ctrl->getSheetId(), ctrl->getQuality(), i, ctrl->getIndexInDB()); - } - - std::sort(vTemp.begin(), vTemp.end()); - - for (i = 0; i < _MaxItems; ++i) - { - _SheetChildren[i] = vTemp[i].SheetIcon; - } -} - -// *************************************************************************** -bool CDBGroupListSheetFilterExchangeable::parse(xmlNodePtr cur, CInterfaceGroup *parentGroup) -{ - if(!CDBGroupListSheet::parse(cur, parentGroup)) - return false; - - // Parse options (type, filters ...) - if (!_BO.parse(cur,parentGroup)) - return false; - - return true; -} - -// *************************************************************************** -// *************************************************************************** -// *************************************************************************** -// ACTION HANDLERS -// *************************************************************************** -// *************************************************************************** -// *************************************************************************** - -// *************************************************************************** -// COMMON INVENTORIES DRAG'N'DROP -// *************************************************************************** - -// *************************************************************************** -class CHandlerInvCanDrag : public IActionHandler -{ - virtual void execute (CCtrlBase *pCaller, const string &/* Params */) - { - CDBCtrlSheet *pCSSrc = dynamic_cast(pCaller); - if (pCSSrc == NULL) return; - - // Cannot drag an item if it is completely locked - if (pCSSrc->getNonLockedQuantity() == 0) - { - pCSSrc->setTempCanDrag(false); - return; - } - - // If the item comes from an animal list which is not available -> cannot move - if (strnicmp(pCSSrc->getSheet().c_str(), "LOCAL:INVENTORY:PACK_ANIMAL", 27) == 0) - { - string sTmp = pCSSrc->getSheet().substr(0, pCSSrc->getSheet().rfind(':')); - sTmp = sTmp.substr(27,sTmp.size()); - uint32 nAni; - fromString(sTmp, nAni); - INVENTORIES::TInventory inv = (INVENTORIES::TInventory)(INVENTORIES::pet_animal+nAni); - pCSSrc->setTempCanDrag(getInventory().isInventoryAvailable(inv)); - } - } -}; -REGISTER_ACTION_HANDLER( CHandlerInvCanDrag, "inv_can_drag" ); - -// *************************************************************************** -class CHandlerInvDrag : public IActionHandler -{ - virtual void execute (CCtrlBase *pCaller, const string &Params) - { - CDBCtrlSheet *pCS = dynamic_cast(pCaller); - if (pCS == NULL) return; - if (Params == "from_text_list") - getInventory().beginDrag(pCS, CInventoryManager::TextList); - else if (Params == "from_slot") - getInventory().beginDrag(pCS, CInventoryManager::Slot); - else if (Params == "from_icon_list") - getInventory().beginDrag(pCS, CInventoryManager::IconList); - else - nlwarning("DND not binded"); - } -}; -REGISTER_ACTION_HANDLER( CHandlerInvDrag, "inv_drag" ); - -// *************************************************************************** -// show/hide edit box, set keyboard focus if 'show' -class CHandlerInvSearchButton : public IActionHandler -{ - virtual void execute (CCtrlBase *pCaller, const string &sParams) - { - if (sParams.empty()) - { - nlwarning("inv_search_button: missing edit box shortid"); - return; - } - - CCtrlBaseButton* btn = dynamic_cast(pCaller); - if (!btn) - { - nlwarning("inv_search_button pCaller == NULL, caller must be CCtrlBaseButton with 'toggle_button' type"); - return; - } - - ucstring filter; - std::string id = btn->getParent()->getId() + ":" + sParams + ":eb"; - CGroupEditBox *eb = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(id)); - if (!eb) - { - nlwarning("inv_search_button: editbox (%s) not found\n", id.c_str()); - return; - } - - eb->getParent()->setActive(btn->getPushed()); - if (eb->getParent()->getActive()) - { - CWidgetManager::getInstance()->setCaptureKeyboard(eb); - eb->setSelectionAll(); - filter = eb->getInputString(); - } - - CDBGroupListSheetBag *pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(btn->getParent()->getId() + ":bag_list")); - if (pList != NULL) pList->setSearchFilter(filter); - - CDBGroupIconListBag *pIcons = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(btn->getParent()->getId() + ":bag_icons")); - if (pIcons != NULL) pIcons->setSearchFilter(filter); - } -}; -REGISTER_ACTION_HANDLER( CHandlerInvSearchButton, "inv_search_button" ); - -// *************************************************************************** -// if :eb is empty then hide edit box, unpush search button -class CHandlerInvSearchUnfocus : public IActionHandler -{ - virtual void execute (CCtrlBase *pCaller, const string &sParams) - { - if (!pCaller) return; - - CGroupEditBox *eb = dynamic_cast(pCaller); - if (!eb || !eb->getInputString().empty()) return; - - // ui:interface:inventory:content:bag:iil:inv_query_eb:eb - std::string id = pCaller->getParent()->getParent()->getId() + ":" + sParams; - CCtrlBaseButton *btn = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(id)); - if (btn) btn->setPushed(false); - - // hide :inv_query_eb - pCaller->getParent()->setActive(false); - - // clear filter - CAHManager::getInstance()->runActionHandler("inv_set_search", pCaller, ""); - } -}; -REGISTER_ACTION_HANDLER( CHandlerInvSearchUnfocus, "inv_search_unfocus" ); - -// ********************************************************************************************************** -// set inventory search string -class CHandlerInvSetSearch : public IActionHandler -{ - void execute (CCtrlBase *pCaller, const std::string &sParams) - { - CGroupEditBox *eb = dynamic_cast(pCaller); - if (!eb) return; - - // ui:interface:inventory:content:bag:iil:inv_query_eb:eb - std::string id = pCaller->getParent()->getParent()->getId(); - - CDBGroupListSheetBag *pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(id + ":bag_list")); - if (pList != NULL) pList->setSearchFilter(eb->getInputString()); - - CDBGroupIconListBag *pIcons = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(id + ":bag_icons")); - if (pIcons != NULL) pIcons->setSearchFilter(eb->getInputString()); - } -}; -REGISTER_ACTION_HANDLER( CHandlerInvSetSearch, "inv_set_search" ); - -// *************************************************************************** -// COMMON INVENTORIES Test if we can drop an item to a slot or a list -class CHandlerInvCanDropTo : public IActionHandler -{ - virtual void execute (CCtrlBase *pCaller, const string &Params) - { - // pCSSrc is the current dragged item - // pCSDst is a slot or a list - - CInventoryManager *pInv = CInventoryManager::getInstance(); - if (!pInv->isDragging()) return; // To prevent other things to happens - - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - string src = getParam(Params, "src"); - CInterfaceElement *pElt = CWidgetManager::getInstance()->getElementFromId(src); - CDBCtrlSheet *pCSSrc = dynamic_cast(pElt); - if (pCSSrc == NULL) return; // Cannot do anything if the incoming sheet is not a sheet - - // Special case if we want to DND an animal representation - // ------------------------------------------------------- - { - const CItemSheet *pIS = pCSSrc->asItemSheet(); - if ((pIS != NULL) && (pIS->Family == ITEMFAMILY::PET_ANIMAL_TICKET)) - { - CDBCtrlSheet *pCSDst = dynamic_cast(pCaller); - if (pCSDst != NULL) - { - // The destination must be exchange or gift - if (strnicmp(pCSDst->getSheet().c_str(),"LOCAL:EXCHANGE:GIVE", 19) == 0) - { - // The animal bag must be empty before giving it - if (pIS->Pet.Slot > 0) - if (pInv->isInventoryEmpty((INVENTORIES::TInventory)(INVENTORIES::pet_animal+(pIS->Pet.Slot-1)))) - pCSDst->setCanDrop (true); - } - // Or moving in the bag (user sort) - if (strnicmp(pCSDst->getSheet().c_str(),"LOCAL:INVENTORY:BAG", 19) == 0) - pCSDst->setCanDrop (true); - } - return; - } - } - - // The destination is a slot or something like that ? - // -------------------------------------------------- - CDBCtrlSheet *pCSDst = dynamic_cast(pCaller); - if (pCSDst != NULL) - { - // If we want to drop something on a reference slot (hand or equip) - if (!pInv->getDBIndexPath(pCSDst).empty()) - { - // We must drag'n'drop an item - if (pCSSrc && pCSSrc->getType() == CCtrlSheetInfo::SheetType_Item) - if (pCSDst && pCSDst->getType() == CCtrlSheetInfo::SheetType_Item) - { - if (!pInv->getDBIndexPath(pCSSrc).empty()) - { - // The item dragged comes from a slot check if this is the good type - if (pCSDst->canDropItem(pCSSrc)) - pCSDst->setCanDrop ( true ); - } - else - { - // The source must be from the bag - if (strnicmp(pCSSrc->getSheet().c_str(),"LOCAL:INVENTORY:BAG", 19) == 0) - pCSDst->setCanDrop ( true ); - } - } - } - else - { - // Does the source and destination are items ? - if (pCSSrc && pCSSrc->getType() == CCtrlSheetInfo::SheetType_Item) - if (pCSDst && pCSDst->getType() == CCtrlSheetInfo::SheetType_Item) - { - // Right Slot ? - if (pCSDst->canDropItem(pCSSrc)) - pCSDst->setCanDrop ( true ); - } - } - return; - } - - // The destination is a list of items ? - // ------------------------------------ - CDBGroupListSheetBag *pListDstText = dynamic_cast(pCaller); - CDBGroupIconListBag *pListDstIcon = dynamic_cast(pCaller); - if ((pListDstText != NULL) || (pListDstIcon != NULL)) - { - bool bCanDrop = true; - // WE CANT DND if we want to dnd from other bag than BAG to guild bag - if (pListDstIcon != NULL) - { - if (pListDstIcon->getInvType() == CInventoryManager::InvGuild) - if (strnicmp(pCSSrc->getSheet().c_str(),"LOCAL:INVENTORY:BAG", 19) != 0) - bCanDrop = false; - } - if (pListDstText != NULL) - { - if (pListDstText->getInvType() == CInventoryManager::InvGuild) - if (strnicmp(pCSSrc->getSheet().c_str(),"LOCAL:INVENTORY:BAG", 19) != 0) - bCanDrop = false; - } - // WE CANT DND if we want to dnd from guild bag to other bag than BAG - if (pListDstIcon != NULL) - { - if (pListDstIcon->getInvType() != CInventoryManager::InvBag) - if (strnicmp(pCSSrc->getSheet().c_str(),"SERVER:GUILD:INVENTORY", 19) == 0) - bCanDrop = false; - } - if (pListDstText != NULL) - { - if (pListDstText->getInvType() != CInventoryManager::InvBag) - if (strnicmp(pCSSrc->getSheet().c_str(),"SERVER:GUILD:INVENTORY", 19) == 0) - bCanDrop = false; - } - - // WE CANT DND when packer/mount is too far - if (pListDstIcon != NULL) - { - if ((pListDstIcon->getInvType() == CInventoryManager::InvPA0) || - (pListDstIcon->getInvType() == CInventoryManager::InvPA1) || - (pListDstIcon->getInvType() == CInventoryManager::InvPA2) || - (pListDstIcon->getInvType() == CInventoryManager::InvPA3) || - (pListDstIcon->getInvType() == CInventoryManager::InvPA4) || - (pListDstIcon->getInvType() == CInventoryManager::InvPA5) || - (pListDstIcon->getInvType() == CInventoryManager::InvPA6)) - { - INVENTORIES::TInventory e = (INVENTORIES::TInventory)(INVENTORIES::pet_animal1 + (pListDstIcon->getInvType()-CInventoryManager::InvPA0)); - if (!pInv->isInventoryAvailable(e)) - bCanDrop = false; - } - } - if (pListDstText != NULL) - { - if ((pListDstText->getInvType() == CInventoryManager::InvPA0) || - (pListDstText->getInvType() == CInventoryManager::InvPA1) || - (pListDstText->getInvType() == CInventoryManager::InvPA2) || - (pListDstText->getInvType() == CInventoryManager::InvPA3) || - (pListDstText->getInvType() == CInventoryManager::InvPA4) || - (pListDstText->getInvType() == CInventoryManager::InvPA5) || - (pListDstText->getInvType() == CInventoryManager::InvPA6)) - { - INVENTORIES::TInventory e = (INVENTORIES::TInventory)(INVENTORIES::pet_animal1 + (pListDstText->getInvType()-CInventoryManager::InvPA0)); - if (!pInv->isInventoryAvailable(e)) - bCanDrop = false; - } - } - - // If the source is the equipment - - if (pListDstText != NULL) pListDstText->setCanDrop(bCanDrop); - if (pListDstIcon != NULL) pListDstIcon->setCanDrop(bCanDrop); - } - - } -}; -REGISTER_ACTION_HANDLER( CHandlerInvCanDropTo, "inv_can_drop" ); - -// *************************************************************************** -class CHandlerInvDropTo : public IActionHandler -{ - virtual void execute (CCtrlBase *pCaller, const string &Params) - { - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - - // Check that we have drag'n'drop from inventory (list or slot) - // Or if we have launched the choose_bag modal - // To prevent other things to happens - if (!getInventory().isDragging()) - { - CInterfaceGroup *pIG = CWidgetManager::getInstance()->getModalWindow(); - if (pIG == NULL) return; - if (pIG->getId() != "ui:interface:bag_choose") return; - getInventory().beginDrag(NULL, CInventoryManager::TextList); - - // Special case for choose in bag dialog - string src = getParam(Params, "src"); - CInterfaceElement *pElt = CWidgetManager::getInstance()->getElementFromId(src); - CDBCtrlSheet *pCSSrc = dynamic_cast(pElt); - CDBCtrlSheet *pCSDst = dynamic_cast(pCaller); - - string invPath = getInventory().getDBIndexPath(pCSSrc); - string bagPath = pCSDst->getSheet(); - - if (bagPath == "UI:EMPTY") - getInventory().unequip (invPath); - else - getInventory().equip (bagPath, invPath); - - getInventory().endDrag(); - return; - } - - string src = getParam(Params, "src"); - CInterfaceElement *pElt = CWidgetManager::getInstance()->getElementFromId(src); - CDBCtrlSheet *pCSSrc = dynamic_cast(pElt); - CDBCtrlSheet *pCSDst = dynamic_cast(pCaller); - if (pCSSrc == NULL) return; - - // Is the dragged sheet comes from an inventory list - if (getInventory().isDraggingFromTextList() || getInventory().isDraggingFromIconList()) - { - // If the destination is an equipment slot ? - if (pCSDst != NULL) - { - string invPath = getInventory().getDBIndexPath(pCSDst); // Get the index in the equipment - if (!invPath.empty()) - { - // Drop to the slot ie write the database with the index of the slot - string bagPath = pCSSrc->getSheet(); // Get the database branch of the dragged sheet - - if (pCSSrc && pCSSrc->getType() == CCtrlSheetInfo::SheetType_Item) - if (pCSDst && pCSDst->getType() == CCtrlSheetInfo::SheetType_Item) - { - // If the destination slot match with the type of incoming item - if (pCSDst->canDropItem(pCSSrc)) - { - // So directly equip - getInventory().equip(bagPath, invPath); - } - else - { - // Else try to auto equip the player with the incoming item - const string sTmp = bagPath.substr(bagPath.rfind(':')+1,bagPath.size()); - sint index; - fromString(sTmp, index); - if (!getInventory().autoEquip(index, false)) - getInventory().autoEquip(index, true); - } - } - getInventory().endDrag(); - return; - } - } - - // If the destination is a list sheet - IListSheetBase *pListDst = dynamic_cast(pCaller); - if ((pListDst == NULL) && (pCSDst != NULL)) - pListDst = IListSheetBase::getListContaining(pCSDst); - IListSheetBase *pListSrc = IListSheetBase::getListContaining(pCSSrc); - if ((pListDst != NULL) && (pListSrc != NULL)) - { - // If the source list and destination list are the same - if (pListDst == pListSrc) - { - // no op - getInventory().endDrag(); - return; - } - else // Source list and destination list are not the same - { - // Move the item to the destination list using the procedure move_to_xxx - CDBGroupListSheetBag *pListDstText = dynamic_cast(pListDst); - CDBGroupIconListBag *pListDstIcon = dynamic_cast(pListDst); - - if (((pListDstText != NULL) && (pListDstText->getInvType() == CInventoryManager::InvBag)) || - ((pListDstIcon != NULL) && (pListDstIcon->getInvType() == CInventoryManager::InvBag))) - { - CAHManager::getInstance()->runActionHandler("proc", pCSSrc, "move_to_bag"); - } - else if (((pListDstText != NULL) && ((pListDstText->getInvType() == CInventoryManager::InvPA0) || - (pListDstText->getInvType() == CInventoryManager::InvPA1) || - (pListDstText->getInvType() == CInventoryManager::InvPA2) || - (pListDstText->getInvType() == CInventoryManager::InvPA3) || - (pListDstText->getInvType() == CInventoryManager::InvPA4) || - (pListDstText->getInvType() == CInventoryManager::InvPA5) || - (pListDstText->getInvType() == CInventoryManager::InvPA6) - )) || - ((pListDstIcon != NULL) && ((pListDstIcon->getInvType() == CInventoryManager::InvPA0) || - (pListDstIcon->getInvType() == CInventoryManager::InvPA1) || - (pListDstIcon->getInvType() == CInventoryManager::InvPA2) || - (pListDstIcon->getInvType() == CInventoryManager::InvPA3) || - (pListDstIcon->getInvType() == CInventoryManager::InvPA4) || - (pListDstIcon->getInvType() == CInventoryManager::InvPA5) || - (pListDstIcon->getInvType() == CInventoryManager::InvPA6) - ))) - { - string sTmp; - if (pListDstText != NULL) sTmp = toString("%d",pListDstText->getInvType()-CInventoryManager::InvPA0); - if (pListDstIcon != NULL) sTmp = toString("%d",pListDstIcon->getInvType()-CInventoryManager::InvPA0); - nlinfo("ici :%s", sTmp.c_str()); - CAHManager::getInstance()->runActionHandler("proc", pCSSrc, "move_to_pa|"+sTmp); - } - else if (((pListDstText != NULL) && (pListDstText->getInvType() == CInventoryManager::InvGuild)) || - ((pListDstIcon != NULL) && (pListDstIcon->getInvType() == CInventoryManager::InvGuild))) - { - if (strnicmp(pCSSrc->getSheet().c_str(), "LOCAL:INVENTORY:BAG", 19) == 0) - CAHManager::getInstance()->runActionHandler("proc", pCSSrc, "move_to_guild"); - } - else if (((pListDstText != NULL) && (pListDstText->getInvType() == CInventoryManager::InvRoom)) || - ((pListDstIcon != NULL) && (pListDstIcon->getInvType() == CInventoryManager::InvRoom))) - { - CAHManager::getInstance()->runActionHandler("proc", pCSSrc, "move_to_room"); - } - } - } - } - - // Is the dragged sheet comes from another slot - if (pCSDst != NULL) - if (getInventory().isDraggingFromSlot()) - { - // Yes swap the 2 indices - // Get the database branch of the dragged sheet - string invPath1 = getInventory().getDBIndexPath(pCSSrc); - // Get the index in the equipment - string invPath2 = getInventory().getDBIndexPath(pCSDst); - - sint32 i1 = NLGUI::CDBManager::getInstance()->getDbProp(invPath1+":INDEX_IN_BAG")->getValue16(); - sint32 i2 = NLGUI::CDBManager::getInstance()->getDbProp(invPath2+":INDEX_IN_BAG")->getValue16(); - - getInventory().unequip(invPath1); - getInventory().unequip(invPath2); - - string sBag = LOCAL_INVENTORY ":BAG:"; - if (i2 != 0) getInventory().equip(sBag + toString(i2-1), invPath1); - if (i1 != 0) getInventory().equip(sBag + toString(i1-1), invPath2); - } - - CAHManager::getInstance()->runActionHandler("inv_cannot_drop", pCSSrc); - } -}; -REGISTER_ACTION_HANDLER( CHandlerInvDropTo, "inv_drop" ); - - -// *************************************************************************** -// EQUIPMENT -class CHandlerInvCannotDrop : public IActionHandler -{ - virtual void execute (CCtrlBase *pCaller, const string &/* Params */) - { - // Is the dragged sheet comes from a slot - if (!getInventory().isDraggingFromTextList()) - { - // Unequip - CDBCtrlSheet *pCSDst = dynamic_cast(pCaller); - string invPath = getInventory().getDBIndexPath(pCSDst); - getInventory().unequip(invPath); - } - getInventory().endDrag(); - } -}; -REGISTER_ACTION_HANDLER( CHandlerInvCannotDrop, "inv_cannot_drop" ); - - -// *************************************************************************** -class CHandlerInvAutoEquip : public IActionHandler -{ -public: - virtual void execute (CCtrlBase *pCaller, const string &/* Params */) - { - CDBCtrlSheet *cs = dynamic_cast(pCaller); - if(cs) - { - uint index= cs->getIndexInDB(); - if (!getInventory().autoEquip(index, false)) - getInventory().autoEquip(index, true); - } - } -}; -REGISTER_ACTION_HANDLER( CHandlerInvAutoEquip, "inv_auto_equip" ); - - -// ********************************************************************************************************** -class CHandlerLockInvItem : public IActionHandler -{ - void execute (CCtrlBase *pCaller, const std::string &sParams) - { - // get the calling item - CDBCtrlSheet *item = CDBCtrlSheet::getCurrSelSheet(); - if ( ! item) - { - nlwarning(" no caller sheet found"); - return; - } - - string lock = "1"; - if (item->getLockedByOwner()) - { - lock = "0"; - } - - uint32 slot = item->getIndexInDB(); - uint32 inv = item->getInventoryIndex(); - INVENTORIES::TInventory inventory = INVENTORIES::UNDEFINED; - inventory = (INVENTORIES::TInventory)(inv); - if (inventory == INVENTORIES::UNDEFINED) - { - return; - } - NLMISC::ICommand::execute("a lockItem " + INVENTORIES::toString(inventory) + " " + toString(slot) + " " + lock, g_log); - } -}; -REGISTER_ACTION_HANDLER( CHandlerLockInvItem, "lock_inv_item" ); - -// *************************************************************************** -// Inventory Temporary -// *************************************************************************** - -// *************************************************************************** -class CHandlerInvTempToBag : public IActionHandler -{ - virtual void execute (CCtrlBase *pCaller, const string &/* Params */) - { - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - - // Disable the direct click on item in Forage mode and Can't take all - if ( (CTempInvManager::getInstance()->getMode() == TEMP_INV_MODE::Forage) && - (NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:INVENTORY:TEMP:ENABLE_TAKE")->getValue32() == 0) ) - return; - - CDBCtrlSheet *pCSDst = dynamic_cast(pCaller); - if (!pCSDst->isSheetValid()) return; - string sTmp = pCSDst->getSheet(); - - sTmp = sTmp.substr(sTmp.rfind(':')+1, sTmp.size()); - uint16 index; - fromString(sTmp, index); - - // If we cant find place display a message and dont send the request to the server - if (!getInventory().isSpaceInAllBagsForItem(pCSDst)) - { - ucstring msg = CI18N::get("msgCantPutItemInBag"); - string cat = getStringCategory(msg, msg); - pIM->displaySystemInfo(msg, cat); - return; - } - - sTmp = pCSDst->getSheet(); - CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp(sTmp+":SHEET",false); - pNL->setValue32(0); - - CBitMemStream out; - if (!GenericMsgHeaderMngr.pushNameToStream("ITEM:TEMP_TO_BAG", out)) - { - nlwarning ("don't know message name ITEM:TEMP_TO_BAG"); - } - else - { - // Fill the message (temporary inventory slot) - out.serial(index); - NetMngr.push (out); - //nlinfo("impulseCallBack : ITEM:TEMP_TO_BAG %d sent", index); - } - } -}; -REGISTER_ACTION_HANDLER( CHandlerInvTempToBag, "inv_temp_to_bag" ); - -// *************************************************************************** -class CHandlerInvTempAll : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) - { - if (!CTempInvManager::getInstance()->isOpened()) return; - if (NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP_INV:ALL_EMPTY")->getValue32() != 0) return; - - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CInventoryManager *pInv = CInventoryManager::getInstance(); - - // Try to put all items in the DB order in all the bags of the player : (bag, pa0-3, steed) - vector > BagsBulk; - BagsBulk.push_back(pair (pInv->getBagBulk(0), pInv->getMaxBagBulk(0))); - - nlctassert(MAX_INVENTORY_ANIMAL==7); - if (pInv->isInventoryAvailable(INVENTORIES::pet_animal1)) - BagsBulk.push_back(pair (pInv->getBagBulk(1), pInv->getMaxBagBulk(1))); - if (pInv->isInventoryAvailable(INVENTORIES::pet_animal2)) - BagsBulk.push_back(pair (pInv->getBagBulk(2), pInv->getMaxBagBulk(2))); - if (pInv->isInventoryAvailable(INVENTORIES::pet_animal3)) - BagsBulk.push_back(pair (pInv->getBagBulk(3), pInv->getMaxBagBulk(3))); - if (pInv->isInventoryAvailable(INVENTORIES::pet_animal4)) - BagsBulk.push_back(pair (pInv->getBagBulk(4), pInv->getMaxBagBulk(4))); - if (pInv->isInventoryAvailable(INVENTORIES::pet_animal5)) - BagsBulk.push_back(pair (pInv->getBagBulk(5), pInv->getMaxBagBulk(4))); - if (pInv->isInventoryAvailable(INVENTORIES::pet_animal6)) - BagsBulk.push_back(pair (pInv->getBagBulk(6), pInv->getMaxBagBulk(4))); - if (pInv->isInventoryAvailable(INVENTORIES::pet_animal7)) - BagsBulk.push_back(pair (pInv->getBagBulk(7), pInv->getMaxBagBulk(4))); - - bool bPlaceFound = true; - - for (uint32 itemNb = 0; itemNb < MAX_TEMPINV_ENTRIES; ++itemNb) - { - CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp(LOCAL_INVENTORY ":TEMP:" + toString(itemNb) + ":SHEET"); - CCDBNodeLeaf *pNLquantity = NLGUI::CDBManager::getInstance()->getDbProp(LOCAL_INVENTORY ":TEMP:" + toString(itemNb) + ":QUANTITY"); - if (pNL == NULL || pNLquantity == NULL) continue; - if (pNL->getValue32() == 0 || pNLquantity->getValue32() == 0) continue; - double itemBulk = pNLquantity->getValue32() * pInv->getItemBulk(pNL->getValue32()); - - bool bLocalPlaceFound = false; - for (uint32 i = 0; i < BagsBulk.size(); ++i) - { - if ((BagsBulk[i].first + itemBulk) <= BagsBulk[i].second) - { - BagsBulk[i].first += itemBulk; - bLocalPlaceFound = true; - break; - } - } - if (!bLocalPlaceFound) - { - bPlaceFound = false; - break; - } - } - - if (!bPlaceFound) - { - ucstring msg = CI18N::get("msgCantPutItemInBag"); - string cat = getStringCategory(msg, msg); - CInterfaceManager::getInstance()->displaySystemInfo(msg, cat); - return; - } - - CBitMemStream out; - if (!GenericMsgHeaderMngr.pushNameToStream("ITEM:ALL_TEMP", out)) - { - nlwarning ("don't know message name ITEM:ALL_TEMP"); - } - else - { - NetMngr.push (out); - //nlinfo("impulseCallBack : ITEM:ALL_TEMP sent"); - } - CTempInvManager::getInstance()->close(); - } -}; -REGISTER_ACTION_HANDLER( CHandlerInvTempAll, "inv_temp_all" ); - -// *************************************************************************** -class CHandlerInvTempNone : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) - { - CBitMemStream out; - if (!GenericMsgHeaderMngr.pushNameToStream("ITEM:NO_TEMP", out)) - { - nlwarning ("don't know message name ITEM:NO_TEMP"); - } - else - { - NetMngr.push (out); - //nlinfo("impulseCallBack : ITEM:NO_TEMP sent"); - } - CTempInvManager::getInstance()->close(); - } -}; -REGISTER_ACTION_HANDLER( CHandlerInvTempNone, "inv_temp_none" ); - - -// *************************************************************************** -// *************************************************************************** -// ItemInfo System -// *************************************************************************** -// *************************************************************************** - -// *************************************************************************** -void CClientItemInfo::readFromImpulse(const CItemInfos &itemInfo) -{ - *(CItemInfos*)this= itemInfo; - - // Read now the version in the impulse - InfoVersionFromMsg= itemInfo.versionInfo; -} - -// *************************************************************************** -uint16 CInventoryManager::getItemSlotId(CDBCtrlSheet *ctrl) -{ - return getItemSlotId(ctrl->getSheet(), ctrl->getIndexInDB()); -} - -// *************************************************************************** -uint16 CInventoryManager::getItemSlotId(const std::string &itemDb, uint slotIndex) -{ - // then compare to all possible inventories (ugly) - uint inventoryIndex= 0; - for(uint i=0;i>CItemInfos::SlotIdIndexBitSize) ) - { - CCDBNodeLeaf *node= NLGUI::CDBManager::getInstance()->getDbProp( toString( "SERVER:%s:%d:SHEET", InventoryDBs[i].c_str(), (slotId&CItemInfos::SlotIdIndexBitMask)), false); - if(node) - return node->getValue32(); - else - return 0; - } - } - - return 0; -} - -// *************************************************************************** -const CClientItemInfo *CInventoryManager::getItemInfoCache(uint32 serial, uint32 createTime) const -{ - return _ItemInfoCache.getItemInfo(serial, createTime); -} - -// *************************************************************************** -const CClientItemInfo &CInventoryManager::getItemInfo(uint slotId) const -{ - TItemInfoMap::const_iterator it= _ItemInfoMap.find(slotId); - static CClientItemInfo empty; - if (it == _ItemInfoMap.end() || !isItemInfoUpToDate(slotId)) - { - // if slot has not been populated yet or out of date, then return info from cache if possible - const CItemImage *item = getServerItem(slotId); - if (item && item->getItemId() > 0) { - const CClientItemInfo *ret = _ItemInfoCache.getItemInfo(item->getItemId()); - if (ret != NULL) - { - return *ret; - } - } - } - - if (it == _ItemInfoMap.end()) - { - return empty; - } - - return it->second; -} - -// *************************************************************************** -bool CInventoryManager::isItemInfoAvailable(uint slotId) const -{ - TItemInfoMap::const_iterator it= _ItemInfoMap.find(slotId); - return it != _ItemInfoMap.end(); -} -// *************************************************************************** -bool CInventoryManager::isItemInfoUpToDate(uint slotId) const -{ - TItemInfoMap::const_iterator it= _ItemInfoMap.find(slotId); - if (it == _ItemInfoMap.end()) - return true; - - // true if the version already matches - return it->second.InfoVersionFromMsg == it->second.InfoVersionFromSlot; -} - -// *************************************************************************** -void CInventoryManager::addItemInfoWaiter(IItemInfoWaiter *waiter) -{ - if(!waiter) - return; - - // first remove the waiter if already here - removeItemInfoWaiter(waiter); - - // Then push_front (stack) - _ItemInfoWaiters.push_front(waiter); - - // update server msg - updateItemInfoQueue(); -} - -// *************************************************************************** -void CInventoryManager::removeItemInfoWaiter(IItemInfoWaiter *waiter) -{ - TItemInfoWaiters::iterator it; - for(it= _ItemInfoWaiters.begin();it!=_ItemInfoWaiters.end();it++) - { - if(waiter==*it) - { - _ItemInfoWaiters.erase(it); - break; - } - } -} - -// *************************************************************************** -void CInventoryManager::updateItemInfoWaiters(uint itemSlotId) -{ - // First verify if the versions matches. If differ, no need to update waiters since not good. - if (!isItemInfoUpToDate(itemSlotId)) - { - return; - } - - bool isItemFromTrading= (itemSlotId>>CItemInfos::SlotIdIndexBitSize)==INVENTORIES::trading; - - // For all waiters that wait for this item slot - TItemInfoWaiters::iterator it; - for(it= _ItemInfoWaiters.begin();it!=_ItemInfoWaiters.end();) - { - TItemInfoWaiters::iterator itNext=it; - itNext++; - IItemInfoWaiter *waiter=*it; - // callback. NB: only ig the waiter agree the Sheet in the current slot id - if(waiter->ItemSlotId == itemSlotId && - (isItemFromTrading || waiter->ItemSheet == getItemSheetForSlotId(itemSlotId)) ) - { - waiter->infoReceived(); - } - - // in case it is erased in infoReceived() - it= itNext; - } -} - -// *************************************************************************** -void CInventoryManager::CItemInfoSlotVersionObs::update(ICDBNode* node) -{ - getInventory().onReceiveItemInfoSlotVersion(node); -} - -// *************************************************************************** -void CInventoryManager::CItemSheetObs::update(ICDBNode* node) -{ - getInventory().onReceiveItemSheet(node); -} - -// *************************************************************************** -void CInventoryManager::CItemInfoTradeObs::update(ICDBNode* /* node */) -{ - getInventory().onTradeChangeSession(); -} - -// *************************************************************************** -void CInventoryManager::onReceiveItemInfoSlotVersion(ICDBNode* node) -{ - uint itemSlotId; - - // valid only if of form 0:INFO_VERSION - if( !dynamic_cast(node) || !node->getParent() || !node->getParent()->getName()) - return; - - // get the slot in inventory of the item - uint slot; - fromString(*node->getParent()->getName(), slot); - - // get the slotId for this DB - itemSlotId= getItemSlotId(node->getFullName(), slot); - - // update the InfoVersionFromSlot - _ItemInfoMap[itemSlotId].InfoVersionFromSlot= ((CCDBNodeLeaf*)node)->getValue8(); - - // Look for Waiters that match this item slot => update - updateItemInfoWaiters(itemSlotId); - - // new msg to send, because version updated? - updateItemInfoQueue(); -} - -// *************************************************************************** -void CInventoryManager::onReceiveItemSheet(ICDBNode* node) -{ - // When a SHEET change, it may unblock some ITEM_INFO:GET calls or some info waiters update. - uint itemSlotId; - - // valid only if of form 0:INFO_VERSION - if( !dynamic_cast(node) || !node->getParent() || !node->getParent()->getName()) - return; - - // get the slot in inventory of the item - uint slot; - fromString(*node->getParent()->getName(), slot); - - // get the slotId for this DB - itemSlotId= getItemSlotId(node->getFullName(), slot); - - // Look for Waiters that match this item slot => update - updateItemInfoWaiters(itemSlotId); - - // new msg to send, because sheet ok? - updateItemInfoQueue(); -} - -// *************************************************************************** -void CInventoryManager::onReceiveItemInfo(const CItemInfos &itemInfo) -{ - // update the Info - uint itemSlotId = itemInfo.slotId; - - const CItemImage *item = getServerItem(itemSlotId); - if (item && item->getItemId() > 0) - { - _ItemInfoCache.readFromImpulse(item->getItemId(), itemInfo); - } - - // write in map, from DB. - _ItemInfoMap[itemSlotId].readFromImpulse(itemInfo); - - // Look for Waiters that match this item slot => update - updateItemInfoWaiters(itemSlotId); - - // new msg to send? - updateItemInfoQueue(); -} - -// *************************************************************************** -void CInventoryManager::onRefreshItemInfoVersion(uint16 slotId, uint8 infoVersion) -{ - _ItemInfoMap[slotId].refreshInfoVersion(infoVersion); -} - -// *************************************************************************** -void CInventoryManager::onTradeChangeSession() -{ - // Dummy set a 255 InfoVersionMsg for all items in trade. Because Server cannot do the code. - for(uint i=0;iItemSlotId; - TItemInfoMap::iterator it= _ItemInfoMap.find(itemSlotId); - bool isItemFromTrading= (itemSlotId>>CItemInfos::SlotIdIndexBitSize)==INVENTORIES::trading; - if(it!=_ItemInfoMap.end()) - { - CClientItemInfo &itemInfo= it->second; - // If versions differ, and if a msg was not already sent to get the new version, then ask server - // SheetId must also match - if( itemInfo.InfoVersionFromSlot != itemInfo.InfoVersionFromMsg && - itemInfo.InfoVersionFromSlot != itemInfo.InfoVersionSlotServerWaiting && - ( isItemFromTrading || waiter->ItemSheet == getItemSheetForSlotId(itemSlotId)) ) - { - // Send a msg to server - if(!ClientCfg.Local) - { - CBitMemStream out; - if (GenericMsgHeaderMngr.pushNameToStream("ITEM_INFO:GET", out)) - { - uint16 slotId= itemSlotId; - out.serial( slotId ); - NetMngr.push(out); - //nlinfo("impulseCallBack : ITEM_INFO:GET %d sent", slotId); - } - else - { - nlwarning(" unknown message name 'ITEM_INFO:GET'"); - } - } - // Debug - else - { - // debug: - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - pIM->displaySystemInfo( toString("ITEM_INFO:GET, slotId: %d, slotVersion: %d", - itemSlotId, itemInfo.InfoVersionFromSlot) ); - } - - itemInfo.InfoVersionSlotServerWaiting= itemInfo.InfoVersionFromSlot; - } - } - } -} - -// *************************************************************************** -void CInventoryManager::debugItemInfoWaiters() -{ - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - - // For All waiters, log. - TItemInfoWaiters::iterator it; - for(it= _ItemInfoWaiters.begin();it!=_ItemInfoWaiters.end();it++) - { - IItemInfoWaiter *waiter=*it; - uint itemSlotId= waiter->ItemSlotId; - TItemInfoMap::iterator itMap= _ItemInfoMap.find(itemSlotId); - if(itMap!=_ItemInfoMap.end()) - { - CClientItemInfo &itemInfo= itMap->second; - pIM->displaySystemInfo( toString("ItemInfoWaiter: slotId: %d, slotVersion: %d, msgVersion: %d, msgVersionWait: %d", - itemSlotId, itemInfo.InfoVersionFromSlot, itemInfo.InfoVersionFromMsg, itemInfo.InfoVersionSlotServerWaiting) ); - } - } -} - -// *************************************************************************** -void CInventoryManager::debugItemInfoCache() const -{ - _ItemInfoCache.debugItemInfoCache(); -} - -// *************************************************************************** -void CInventoryManager::sortBag() -{ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CDBGroupIconListBag *pIconList; - CDBGroupListSheetBag *pList; - - pIconList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(LIST_BAG_ICONS)); - if (pIconList != NULL) pIconList->needToSort(); - pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(LIST_BAG_TEXT)); - if (pList != NULL) pList->needToSort(); - - pIconList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(LIST_ROOM_ICONS)); - if (pIconList != NULL) pIconList->needToSort(); - pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(LIST_ROOM_TEXT)); - if (pList != NULL) pList->needToSort(); - - pIconList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(LIST_GUILD_ICONS)); - if (pIconList != NULL) pIconList->needToSort(); - pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(LIST_GUILD_TEXT)); - if (pList != NULL) pList->needToSort(); - - pIconList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(LIST_PA0_ICONS)); - if (pIconList != NULL) pIconList->needToSort(); - pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(LIST_PA0_TEXT)); - if (pList != NULL) pList->needToSort(); - - pIconList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(LIST_PA1_ICONS)); - if (pIconList != NULL) pIconList->needToSort(); - pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(LIST_PA1_TEXT)); - if (pList != NULL) pList->needToSort(); - - pIconList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(LIST_PA2_ICONS)); - if (pIconList != NULL) pIconList->needToSort(); - pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(LIST_PA2_TEXT)); - if (pList != NULL) pList->needToSort(); - - pIconList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(LIST_PA3_ICONS)); - if (pIconList != NULL) pIconList->needToSort(); - pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(LIST_PA3_TEXT)); - if (pList != NULL) pList->needToSort(); - - pIconList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(LIST_PA4_ICONS)); - if (pIconList != NULL) pIconList->needToSort(); - pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(LIST_PA4_TEXT)); - if (pList != NULL) pList->needToSort(); - - pIconList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(LIST_PA5_ICONS)); - if (pIconList != NULL) pIconList->needToSort(); - pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(LIST_PA5_TEXT)); - if (pList != NULL) pList->needToSort(); - - pIconList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(LIST_PA6_ICONS)); - if (pIconList != NULL) pIconList->needToSort(); - pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(LIST_PA6_TEXT)); - if (pList != NULL) pList->needToSort(); -} - -// *************************************************************************** -bool CInventoryManager::isInventoryPresent(INVENTORIES::TInventory invId) -{ - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - - // PA present? - if(invId>=INVENTORIES::pet_animal && invIdgetDbProp(toString("SERVER:PACK_ANIMAL:BEAST%d:STATUS", invId-INVENTORIES::pet_animal), false); - if(!node) return false; - uint status= node->getValue32(); - - return ANIMAL_STATUS::isSpawned((ANIMAL_STATUS::EAnimalStatus)status); - } - else if (invId == INVENTORIES::guild) - { - return (NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:INVENTORY_GUILD_OPENED", true)->getValue8() != 0); - } - else if (invId == INVENTORIES::player_room) - { - return (NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:INVENTORY_ROOM_OPENED", true)->getValue8() != 0); - } - // other inventories (Bag...) are always present - else - return true; -} - - -// *************************************************************************** -bool CInventoryManager::isInventoryAvailable(INVENTORIES::TInventory invId) -{ - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - - // PA available? - if(invId>=INVENTORIES::pet_animal && invIdgetDbProp(toString("SERVER:PACK_ANIMAL:BEAST%d:STATUS", invId-INVENTORIES::pet_animal), false); - if(!node) return false; - uint status= node->getValue32(); - - return ANIMAL_STATUS::isInventoryAvailable((ANIMAL_STATUS::EAnimalStatus)status); - } - else if (invId == INVENTORIES::guild) - { - return (NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:INVENTORY_GUILD_OPENED", true)->getValue8() != 0); - } - else if (invId == INVENTORIES::player_room) - { - return (NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:INVENTORY_ROOM_OPENED", true)->getValue8() != 0); - } - // other inventories (Bag...) are always available - else - return true; -} - -// *************************************************************************** -bool CInventoryManager::isInventoryEmpty(INVENTORIES::TInventory invId) -{ - if (!isInventoryPresent(invId)) return true; - - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - - string sPath = "SERVER:INVENTORY"; - sint32 nNbEntries = 256; - - // PA present? - if(invId>=INVENTORIES::pet_animal && invIdgetDbProp(sPath+toString(":%d:SHEET", i), false); - if (pNL == NULL) return true; - if (pNL->getValue32() != 0) - return false; - } - return true; -} - -// *************************************************************************** -CItemImage &CInventoryManager::getPAItem(uint beastIndex, uint index) -{ - nlassert(beastIndex < MAX_INVENTORY_ANIMAL); - nlassert(index < MAX_ANIMALINV_ENTRIES); - return PAInv[beastIndex][index]; -} - -// *************************************************************************** -CItemImage &CInventoryManager::getServerPAItem(uint beastIndex, uint index) -{ - nlassert(beastIndex < MAX_INVENTORY_ANIMAL); - nlassert(index < MAX_ANIMALINV_ENTRIES); - return ServerPAInv[beastIndex][index]; -} - -const CItemImage &CInventoryManager::getServerPAItem(uint beastIndex, uint index) const -{ - nlassert(beastIndex < MAX_INVENTORY_ANIMAL); - nlassert(index < MAX_ANIMALINV_ENTRIES); - return ServerPAInv[beastIndex][index]; -} - - -// *************************************************************************** -CItemImage &CInventoryManager::getLocalItem(uint inv, uint index) -{ - if(inv==INVENTORIES::bag) - return getBagItem(index); - if(inv>=INVENTORIES::pet_animal && inv=INVENTORIES::pet_animal && inv= INVENTORIES::pet_animal && inv getDbBranch("SERVER:GUILD:INVENTORY:" + toString(index)); - if (itemBranch) - { - static CItemImage image; - image.build(itemBranch); - return ℑ - } - } - return NULL; - } - else if (inv == INVENTORIES::player_room) - { - // player is in their room - if (getInventory().isInventoryAvailable(INVENTORIES::player_room)) - { - CCDBNodeBranch *itemBranch = NLGUI::CDBManager::getInstance()->getDbBranch(SERVER_INVENTORY ":ROOM:" + toString(index)); - if (itemBranch) - { - static CItemImage image; - image.build(itemBranch); - return ℑ - } - } - return NULL; - } - else if (inv == INVENTORIES::trading) - { - CCDBNodeBranch *itemBranch = NLGUI::CDBManager::getInstance()->getDbBranch("LOCAL:TRADING:" + toString(index)); - if (itemBranch) - { - static CItemImage image; - image.build(itemBranch); - return ℑ - } - } - else if (inv == INVENTORIES::exchange) - { - CCDBNodeBranch *itemBranch = NLGUI::CDBManager::getInstance()->getDbBranch("LOCAL:EXCHANGE:GIVE:" + toString(index)); - if (itemBranch) - { - static CItemImage image; - image.build(itemBranch); - return ℑ - } - } - else if (inv == INVENTORIES::exchange_proposition) - { - CCDBNodeBranch *itemBranch = NLGUI::CDBManager::getInstance()->getDbBranch("LOCAL:EXCHANGE:RECEIVE:" + toString(index)); - if (itemBranch) - { - static CItemImage image; - image.build(itemBranch); - return ℑ - } - } - else - { - nlwarning("getServerItem: invalid inventory %d for slotId %d", inv, slotId); - } - - // invalid inventory - return NULL; -} - -// *************************************************************************** -CInventoryManager::TInvType CInventoryManager::invTypeFromString(const string &str) -{ - string sTmp = toLower(str); - if (sTmp == "inv_bag") return InvBag; - if (sTmp == "inv_pa0") return InvPA0; - if (sTmp == "inv_pa1") return InvPA1; - if (sTmp == "inv_pa2") return InvPA2; - if (sTmp == "inv_pa3") return InvPA3; - if (sTmp == "inv_pa4") return InvPA4; - if (sTmp == "inv_pa5") return InvPA5; - if (sTmp == "inv_pa6") return InvPA6; - if (sTmp == "inv_guild") return InvGuild; - if (sTmp == "inv_room") return InvRoom; - return InvUnknown; -} - -// *************************************************************************** -void CInventoryManager::getSlotInvIndex(uint slotId, uint &inv, uint &index) const -{ - inv = slotId >> CItemInfos::SlotIdIndexBitSize; - index = slotId & CItemInfos::SlotIdIndexBitMask; -} - diff --git a/code/ryzom/client/src/login.cpp b/code/ryzom/client/src/login.cpp deleted file mode 100644 index 244bb593c..000000000 --- a/code/ryzom/client/src/login.cpp +++ /dev/null @@ -1,3331 +0,0 @@ -// Ryzom - MMORPG Framework -// Copyright (C) 2010-2019 Winch Gate Property Limited -// -// This source file has been modified by the following contributors: -// Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2014-2019 Jan BOON (Kaetemi) -// -// 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 . - -////////////// -// Includes // -////////////// -#include "stdpch.h" - -#include "login.h" -#include "login_patch.h" - -#include "nel/misc/common.h" -#include "nel/misc/debug.h" -#include "nel/misc/path.h" -#include "nel/misc/thread.h" -#include "nel/misc/big_file.h" -#include "nel/misc/system_utils.h" -#include "nel/misc/streamed_package_manager.h" - -#include "nel/net/tcp_sock.h" -#include "nel/3d/u_driver.h" -#include "nel/misc/big_file.h" - -#include "interface_v3/interface_manager.h" -#include "interface_v3/input_handler_manager.h" -#include "nel/gui/group_editbox.h" -#include "interface_v3/group_quick_help.h" -#include "nel/gui/view_text.h" -#include "nel/gui/ctrl_button.h" -#include "nel/gui/ctrl_text_button.h" -#include "nel/gui/dbgroup_combo_box.h" -#include "sound_manager.h" -#include "far_tp.h" - -#include "actions_client.h" -#include "time_client.h" -#include "client_cfg.h" -#include "global.h" -#include "input.h" -#include "nel/gui/libwww.h" -#include "nel/web/http_client_curl.h" -#include "login_progress_post_thread.h" - -#include "init.h" -#include "release.h" -#include "bg_downloader_access.h" - -#include "game_share/crypt.h" -#include "game_share/bg_downloader_msg.h" - -#include "misc.h" -#include "user_agent.h" - -void ConnectToShard(); - -// *************************************************************************** - -using namespace NLMISC; -using namespace NLWEB; -using namespace NLNET; -using namespace NL3D; -using namespace std; - -#ifdef DEBUG_NEW -#define new DEBUG_NEW -#endif - -// *************************************************************************** - -extern bool SetMousePosFirstTime; - -vector Shards; - -string LoginLogin, LoginPassword, ClientApp, Salt, LoginCustomParameters; -uint32 LoginShardId = 0xFFFFFFFF; - - -// Completed only after that ryzom downloader has run its 'check' task : -// It is a bitfield indexed by BGDownloader::TDownloadID that indicate the parts that are available for patch -uint32 AvailablePatchs = 0; -// next wanted patch for the background downloader -BGDownloader::TDownloadID BGDownloaderWantedPatch = BGDownloader::DownloadID_RoS; - - - -// R2 mode var --------------- - -/// domain server version for patch -string R2ServerVersion; -/// name of the version (used to alias many version under the same name), -/// the value is used to get the release not if not empty -string VersionName; -/// Backup patch server to use in case of failure of all other servers -string R2BackupPatchURL; -/// a list of patch server to use randomly -vector R2PatchURLs; - - -#define CTRL_EDITBOX_LOGIN "ui:login:checkpass:content:eb_login:eb" -#define CTRL_EDITBOX_PASSWORD "ui:login:checkpass:content:eb_password:eb" -#define GROUP_LIST_SHARD "ui:login:sharddisp:content:shard_list" -#define CTRL_BUTTON_CONNECT "ui:login:sharddisp:content:but_con" -#define GROUP_LIST_CAT "ui:login:catdisp:content:cat_list" -#define CTRL_BUTTON_CLOSE_PATCH "ui:login:patching:content:but_close" -#define VIEW_TOTAL_SIZE "ui:login:catdisp:content:global_patch:size" -#define VIEW_NON_OPTIONAL_SIZE "ui:login:catdisp:content:nonopt_patch:size" -#define VIEW_TOTAL_SIZE_PATCH "ui:login:patching:content:global_patch:size" -#define CTRL_BUTTON_BACKTOLOGIN "ui:login:webstart:content:back_to_login" -#define CTRL_BUTTON_RELOADTESTPAGE "ui:login:webstart:content:reload_test_page" -#define CTRL_EDITBOX_CREATEACCOUNT_LOGIN "ui:login:create_account:content:submit_gr:eb_login:eb" -#define CTRL_EDITBOX_CREATEACCOUNT_PASSWORD "ui:login:create_account:content:submit_gr:eb_password:eb" -#define CTRL_EDITBOX_CREATEACCOUNT_CONFIRMPASSWORD "ui:login:create_account:content:submit_gr:eb_confirm_password:eb" -#define CTRL_EDITBOX_CREATEACCOUNT_EMAIL "ui:login:create_account:content:submit_gr:eb_email:eb" - -#define UI_VARIABLES_SCREEN_CHECKPASS 0 -#define UI_VARIABLES_SCREEN_SHARDDISP 1 -#define UI_VARIABLES_SCREEN_CHECKING 2 -#define UI_VARIABLES_SCREEN_CATDISP 3 -#define UI_VARIABLES_SCREEN_PATCHING 4 -#define UI_VARIABLES_SCREEN_REBOOT 5 -#define UI_VARIABLES_SCREEN_EULA 6 -#define UI_VARIABLES_SCREEN_DATASCAN 7 -#define UI_VARIABLES_SCREEN_CREATE_ACCOUNT 9 - - -// *************************************************************************** -// *************************************************************************** -// *************************************************************************** -// INTERFACE -// *************************************************************************** -// *************************************************************************** -// *************************************************************************** - -bool loginFinished = false; -bool loginOK = false; -sint32 ShardSelected = -1; -CPatchManager::SPatchInfo InfoOnPatch; -uint32 TotalPatchSize; - -CLoginStateMachine LoginSM; - -// TODO : nico : put this in an external file, this way it isn't included by the background downloader -#ifndef RY_BG_DOWNLOADER - -bool CStartupHttpClient::connectToLogin() -{ - bool checkConnect = connect(ClientCfg.ConfigFile.getVar("StartupHost").asString(0)); - - if (ClientCfg.ConfigFile.exists("StartupVerify")) - checkConnect = checkConnect && verifyServer(ClientCfg.ConfigFile.getVar("StartupVerify").asBool(0)); - - return checkConnect; -} - -CStartupHttpClient HttpClient; -#endif // RY_BG_DOWNLOADER - - -// *************************************************************************** -#define WIN_COMBO_BOX_SELECT_MENU "ui:interface:combo_box_select_menu" -#define WIN_COMBO_BOX_MEASURE_MENU "ui:interface:combo_box_measure_menu" -#define WIN_COMBO_BOX_SELECT_MENU_OUTGAME "ui:outgame:combo_box_select_menu" -#define WIN_COMBO_BOX_SELECT_MENU_LOGIN "ui:login:combo_box_select_menu" -#define WIN_COMBO_BOX_MEASURE_MENU_LOGIN "ui:login:combo_box_measure_menu" - -bool isLoginFinished() -{ - return loginFinished; -} - -void setLoginFinished( bool f ) -{ - loginFinished = f; - if( loginFinished ) - { - CDBGroupComboBox::measureMenu.assign( WIN_COMBO_BOX_MEASURE_MENU ); - CDBGroupComboBox::selectMenu.assign( WIN_COMBO_BOX_SELECT_MENU ); - } - else - { - CDBGroupComboBox::measureMenu.assign( WIN_COMBO_BOX_MEASURE_MENU_LOGIN ); - CDBGroupComboBox::selectMenu.assign( WIN_COMBO_BOX_SELECT_MENU_LOGIN ); - } -} - - -// *************************************************************************** -// Pop a fatal error message box, giving the option to 'quit' the client, plus a help button -static void fatalMessageBox(const ucstring &msg) -{ - CInterfaceManager *im = CInterfaceManager::getInstance(); - im->messageBoxWithHelp(msg, "ui:login", "login_quit"); -} - -// *************************************************************************** -// Pop an error message box, giving the option to go back to main menu, plus a help button -static void errorMessageBox(const ucstring &msg) -{ - CInterfaceManager *im = CInterfaceManager::getInstance(); - im->messageBoxWithHelp(msg, "ui:login", "on_back_to_login"); -} - -// *************************************************************************** -void createOptionalCatUI() -{ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CInterfaceGroup *pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_CAT)); - if (pList == NULL) - { - nlwarning("element " GROUP_LIST_CAT " not found probably bad login_main.xml"); - return; - } - - // Update optional categories - - CInterfaceGroup *pPrevLine = NULL; - for(uint i = 0; i < InfoOnPatch.OptCat.size(); i++) - { - vector< pair < string, string > > params; - params.clear(); - params.push_back(pair("id", "c"+toString(i))); - if (i>0) - params.push_back(pair("posref", "BL TL")); - - CInterfaceGroup *pNewLine = CWidgetManager::getInstance()->getParser()->createGroupInstance("t_cat", GROUP_LIST_CAT, params); - if (pNewLine != NULL) - { - CViewText *pVT = dynamic_cast(pNewLine->getView("name")); - if (pVT != NULL) pVT->setText(InfoOnPatch.OptCat[i].Name); - pVT = dynamic_cast(pNewLine->getView("size")); - if (pVT != NULL) - { - pVT->setText(BGDownloader::getWrittenSize(InfoOnPatch.OptCat[i].Size)); - } - - // Add to the list - pNewLine->setParent(pList); - pNewLine->setParentSize(pList); - pNewLine->setParentPos(pPrevLine); - pList->addGroup(pNewLine); - - pPrevLine = pNewLine; - } - } - pList->invalidateCoords(); -} - -// *************************************************************************** -void initEula() -{ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - if (!ClientCfg.SkipEULA && CFile::fileExists(getLogDirectory() + "show_eula")) - { - NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->setValue32(UI_VARIABLES_SCREEN_EULA); - - // if we display the eula, it means we make a patch so we clean the cache directory - // (clear cache after each patch) - nlinfo("Deleting cached files"); - vector cached; - CPath::getPathContent("cache", true, false, true, cached); - for(uint i = 0; i < cached.size(); i++) - CFile::deleteFile(cached[i]); - } - else - { - CAHManager::getInstance()->runActionHandler("accept_eula", NULL); - } -} - -// *************************************************************************** -static void setDataScanLog(const ucstring &text) -{ - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:login:datascan:content:log_txt:log")); - if (pVT != NULL) - { - pVT->setText(text); - } -} - -// *************************************************************************** -static void setDataScanState(const ucstring &text, ucstring progress= ucstring()) -{ - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:login:datascan:content:state")); - if (pVT != NULL) pVT->setText(text); - - pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:login:datascan:content:progress")); - if (pVT != NULL) pVT->setText(progress); -} - -void initCatDisplay() -{ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CPatchManager *pPM = CPatchManager::getInstance(); - - // Check is good now ask the player if he wants to apply the patch - pPM->getInfoToDisp(InfoOnPatch); - - if ((!InfoOnPatch.NonOptCat.empty()) || - (!InfoOnPatch.OptCat.empty()) || - (!InfoOnPatch.ReqCat.empty())) - { - createOptionalCatUI(); - NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->setValue32(UI_VARIABLES_SCREEN_CATDISP); - } - else - { - LoginSM.pushEvent(CLoginStateMachine::ev_run_patch); -// CAHManager::getInstance()->runActionHandler("login_patch", NULL); - } -} - -void initReboot() -{ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->setValue32(UI_VARIABLES_SCREEN_REBOOT); -} - - -// *************************************************************************** -static void setPatcherStateText(const std::string &baseUIPath, const ucstring &str) -{ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(baseUIPath + ":content:state")); - if (pVT != NULL) - { - pVT->setText(str); - } -} - -// *************************************************************************** -static void setPatcherProgressText(const std::string &baseUIPath, const ucstring &str) -{ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(baseUIPath + ":content:progress")); - if (pVT != NULL) - { - pVT->setText(str); - } -} - -// *************************************************************************** -static void updatePatchingInfoText(const std::string &baseUIPath) -{ - CPatchManager *pPM = CPatchManager::getInstance(); - CBGDownloaderAccess &bgDownloader = CBGDownloaderAccess::getInstance(); - if (isBGDownloadEnabled()) - { - bgDownloader.update(); - if (bgDownloader.getDownloadThreadPriority() == BGDownloader::ThreadPriority_Paused) - { - setPatcherStateText(baseUIPath, CI18N::get("uiBGD_Paused")); - setPatcherProgressText(baseUIPath, ucstring()); - } - else - { - setPatcherStateText(baseUIPath, bgDownloader.getCurrentMessage()); - if (bgDownloader.getTotalFilesToGet() != 0) - { - setPatcherProgressText(baseUIPath, toString("%d/%d", (int) bgDownloader.getCurrentFilesToGet(), (int) bgDownloader.getTotalFilesToGet())); - } - else - { - setPatcherProgressText(baseUIPath, ucstring()); - } - } - } - else - { - ucstring state; - vector log; - if(pPM->getThreadState(state, log)) - { - setPatcherStateText(baseUIPath, state); - if (pPM->getTotalFilesToGet() != 0) - { - setPatcherProgressText(baseUIPath, toString("%d/%d", pPM->getCurrentFilesToGet(), pPM->getTotalFilesToGet())); - } - else - { - setPatcherProgressText(baseUIPath, ucstring()); - } - } - } -} - -// *************************************************************************** -// Main loop of the login step -void loginMainLoop() -{ - CDBGroupComboBox::selectMenuOut.assign( WIN_COMBO_BOX_SELECT_MENU_OUTGAME ); - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CPatchManager *pPM = CPatchManager::getInstance(); - - CBGDownloaderAccess &bgDownloader = CBGDownloaderAccess::getInstance(); - - bool windowBlinkDone = false; - bool fatalMessageBoxShown = false; - - while (LoginSM.getCurrentState() != CLoginStateMachine::st_connect - && LoginSM.getCurrentState() != CLoginStateMachine::st_end - && LoginSM.getCurrentState() != CLoginStateMachine::st_ingame) -// while (loginFinished == false) - { - IngameDbMngr.flushObserverCalls(); - NLGUI::CDBManager::getInstance()->flushObserverCalls(); - - // Update the DT T0 and T1 global variables - updateClientTime(); - - - - CInputHandlerManager::getInstance()->pumpEvents(); - Driver->clearBuffers(CRGBA::Black); - Driver->setMatrixMode2D11(); - - // Update sound - if (SoundMngr != NULL) - SoundMngr->update(); - - // Interface handling & displaying - pIM->updateFrameEvents(); - pIM->updateFrameViews(NULL); - IngameDbMngr.flushObserverCalls(); - NLGUI::CDBManager::getInstance()->flushObserverCalls(); - - - -// if (::GetAsyncKeyState(VK_SPACE)) -// { -// pIM->displayUIViewBBoxs(""); -// pIM->displayUICtrlBBoxs(""); -// pIM->displayUIGroupBBoxs(""); -// } - - // Force the client to sleep a bit. - if(ClientCfg.Sleep >= 0) - { - nlSleep(ClientCfg.Sleep); - } - // Display - Driver->swapBuffers(); - -// sint32 screen = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->getValue32(); - if (LoginSM.getCurrentState() == CLoginStateMachine::st_check_patch) -// if (screen == UI_VARIABLES_SCREEN_CHECKING) // If we are in checking mode - { - nlSleep(10); // For the checking thread - bool res = false; - BGDownloader::TTaskResult taskResult = BGDownloader::TaskResult_Unknown; - bool finished = false; - ucstring bgDownloaderError; - if (isBGDownloadEnabled()) - { - finished = bgDownloader.isTaskEnded(taskResult, bgDownloaderError); - } - else - { - finished = pPM->isCheckThreadEnded(res); - } - - if (finished) - { - setPatcherStateText("ui:login:checking", ucstring()); - setPatcherProgressText("ui:login:checking", ucstring()); - - if (isBGDownloadEnabled()) - { - AvailablePatchs = bgDownloader.getAvailablePatchs(); - #ifdef NL_OS_WINDOWS - { - // Get the window - HWND hWnd = Driver->getDisplay(); - nlassert (hWnd); - // Show the window, unless it has been minimized, in - // which case we don't pop it unexpectedly - if (!windowBlinkDone) - { - bgDownloader.hideDownloader(); - ShowWindow (hWnd, SW_RESTORE); - windowBlinkDone = true; - } - - } - #endif - switch(taskResult) - { - case BGDownloader::TaskResult_Success: - if (AvailablePatchs & (1 << BGDownloaderWantedPatch)) // is there a patch for what we want now ? - { - LoginSM.pushEvent(CLoginStateMachine::ev_patch_needed); - } - else - { - LoginSM.pushEvent(CLoginStateMachine::ev_no_patch); - } - break; - case BGDownloader::TaskResult_Error: - { - if (!fatalMessageBoxShown) - { - fatalMessageBox(bgDownloaderError); - fatalMessageBoxShown = true; - } - } - break; - default: - if (!fatalMessageBoxShown) - { - fatalMessageBox(CI18N::get("uiErrChecking")); - fatalMessageBoxShown = true; - } - break; - } - - } - else - { - if(res) - { - // Check is good now ask the player if he wants to apply the patch - pPM->getInfoToDisp(InfoOnPatch); - - AvailablePatchs = InfoOnPatch.getAvailablePatchsBitfield(); - - if ((!InfoOnPatch.NonOptCat.empty()) || - (!InfoOnPatch.OptCat.empty()) || - (!InfoOnPatch.ReqCat.empty())) - { - LoginSM.pushEvent(CLoginStateMachine::ev_patch_needed); - // createOptionalCatUI(); - // NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->setValue32(UI_VARIABLES_SCREEN_CATDISP); - } - else - { - LoginSM.pushEvent(CLoginStateMachine::ev_no_patch); - // CAHManager::getInstance()->runActionHandler("login_patch", NULL); - } - } - else - { - ucstring errMsg = CI18N::get("uiErrChecking"); - if (!pPM->getLastErrorMessage().empty()) - { - errMsg = pPM->getLastErrorMessage(); - } - if (!fatalMessageBoxShown) - { - fatalMessageBox(errMsg); - fatalMessageBoxShown = true; - } - } - } - } - else - { - // update interface content - updatePatchingInfoText("ui:login:checking"); - } - } -// else if (screen == UI_VARIABLES_SCREEN_DATASCAN) // If we are in ScanData mode - else if (LoginSM.getCurrentState() == CLoginStateMachine::st_scan_data) - { - nlSleep(10); // For the checking thread - - bool res; - if (pPM->isScanDataThreadEnded(res)) - { - // if interface consider it was running before - if(NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:DATASCAN_RUNNING")->getValue32()!=0) - { - // no more running - NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:DATASCAN_RUNNING")->setValue32(0); - - if(res) - { - // touch any file with checksum error, and get their number - uint numFiles= pPM->applyScanDataResult(); - - // Report result - if(numFiles==0) - setDataScanState(CI18N::get("uiScanDataSucess")); - else - { - ucstring fmt= CI18N::get("uiScanDataErrors"); - strFindReplace(fmt, "%d", toString(numFiles)); - setDataScanState(fmt); - } - } - else - { - ucstring errMsg = CI18N::get("uiErrDataScanning"); - if (!pPM->getLastErrorMessage().empty()) - { - errMsg = pPM->getLastErrorMessage(); - } - pIM->messageBoxWithHelp(errMsg, "ui:login"); - } - - // the log may have changed - ucstring dsLog; - if(pPM->getDataScanLog(dsLog)) - setDataScanLog(dsLog); - } - } - else - { - // update inteface content - ucstring state; - vector log; - // get state - if(pPM->getThreadState(state, log)) - { - // set state - setDataScanState(state, toString("%d/%d", pPM->getCurrentFilesToGet(), pPM->getTotalFilesToGet())); - } - // set special data scan log - ucstring dsLog; - if(pPM->getDataScanLog(dsLog)) - setDataScanLog(dsLog); - } - } -// else if (screen == UI_VARIABLES_SCREEN_PATCHING) // If we are in patching mode - else if (LoginSM.getCurrentState() == CLoginStateMachine::st_patch) - { - nlSleep(30); // For the patching thread - - int currentPatchingSize; - int totalPatchSize; - - - if (isBGDownloadEnabled()) - { - currentPatchingSize = bgDownloader.getPatchingSize(); - totalPatchSize = bgDownloader.getTotalSize(); - BGDownloader::TTaskResult taskResult; - bool finished = false; - ucstring bgDownloaderError; - finished = bgDownloader.isTaskEnded(taskResult, bgDownloaderError); - if (finished) - { - //bgDownloader.hideDownloader(); - // restore the search paths (all bnp files were removed from CPath to allows - // the patcher to overwrite them) - - // create a file to prompt eula next time - CFile::createEmptyFile(getLogDirectory() + "show_eula"); - - if (taskResult == BGDownloader::TaskResult_Error) - { - setPatcherStateText("ui:login:patching", ucstring()); - setPatcherProgressText("ui:login:patching", ucstring()); - - if (!fatalMessageBoxShown) - { - fatalMessageBox(bgDownloaderError); - fatalMessageBoxShown = true; - } - } - else - { - bgDownloader.getPatchCompletionFlag(true /* clear flag */); - LoginSM.pushEvent(CLoginStateMachine::ev_close_patch); - } - } - else - { - updatePatchingInfoText("ui:login:patching"); - } - } - else - { - totalPatchSize = TotalPatchSize; - currentPatchingSize = pPM->getPatchingSize(); - bool res; - if (pPM->isPatchThreadEnded(res)) - { - if(res) - { - LoginSM.pushEvent(CLoginStateMachine::ev_close_patch); - } - else - { - ucstring errMsg = CI18N::get("uiErrPatchApply"); - if (!pPM->getLastErrorMessage().empty()) - { - errMsg = pPM->getLastErrorMessage(); - } - if (!fatalMessageBoxShown) - { - fatalMessageBox(errMsg); - fatalMessageBoxShown = true; - } - } - } - else - { - updatePatchingInfoText("ui:login:patching"); - } - } - - CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(VIEW_TOTAL_SIZE_PATCH)); - ucstring sTmp; - sTmp = BGDownloader::getWrittenSize(currentPatchingSize); - sTmp += " / " + BGDownloader::getWrittenSize(totalPatchSize); - if (pVT != NULL) pVT->setText(sTmp); - } -// else if (screen == UI_VARIABLES_SCREEN_CATDISP) // If we are displaying patch info - else if (LoginSM.getCurrentState() == CLoginStateMachine::st_display_cat) - { - // Non optional stuff (non opt cat and req cat) - - // Add req cat size : given the optional cat we determines the required cat - uint32 nNonOptSize = 0; - TotalPatchSize = 0; - vector ReqCat; - CInterfaceGroup *pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_CAT)); - if (pList != NULL) - { - for(uint i = 0; i < InfoOnPatch.OptCat.size(); i++) - { - CInterfaceGroup *pLine = pList->getGroup("c"+toString(i)); - if (pLine != NULL) - { - CCtrlButton *pCB = dynamic_cast(pLine->getCtrl("on_off")); - if ((pCB != NULL) && (pCB->getPushed())) - { - TotalPatchSize += InfoOnPatch.OptCat[i].Size; - if (InfoOnPatch.OptCat[i].Req != -1) - { - uint32 j; - for (j = 0; j < ReqCat.size(); ++j) - if (ReqCat[j] == InfoOnPatch.OptCat[i].Req) - break; - // Add just once the req cat size to the non optional size - if (j == ReqCat.size()) - { - ReqCat.push_back(InfoOnPatch.OptCat[i].Req); - nNonOptSize += InfoOnPatch.ReqCat[InfoOnPatch.OptCat[i].Req].Size; - } - } - } - } - } - } - - // Add non optional cats - for (uint32 i = 0; i < InfoOnPatch.NonOptCat.size(); ++i) - nNonOptSize += InfoOnPatch.NonOptCat[i].Size; - - TotalPatchSize += nNonOptSize; - // Total size of the patches is optional cats + required cat (f(optCat)) + non opt cat - - CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(VIEW_TOTAL_SIZE)); - if (pVT != NULL) pVT->setText(BGDownloader::getWrittenSize(TotalPatchSize)); - - pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(VIEW_NON_OPTIONAL_SIZE)); - if (pVT != NULL) pVT->setText(BGDownloader::getWrittenSize(nNonOptSize)); - } - } -} - -void initLoginScreen() -{ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CPatchManager *pPM = CPatchManager::getInstance(); - NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->setValue32(UI_VARIABLES_SCREEN_CHECKPASS); - NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:DISPLAY_ACCOUNT_BUTTONS")->setValue32(ClientCfg.DisplayAccountButtons); - - // Active inputs - Actions.enable(true); - EditActions.enable(true); - - if(ClientCfg.ConfigFile.exists("VerboseLog")) - pPM->setVerboseLog(ClientCfg.ConfigFile.getVar("VerboseLog").asInt() == 1); - if(pPM->isVerboseLog()) nlinfo("Using verbose log mode"); - - ClientApp = ClientCfg.ConfigFile.getVar("Application").asString(0); - - // version - std::string ext; - if (ClientApp.find("ryzom_") != ucstring::npos) - ext = " (" + ClientApp.substr(6) + ")"; - - CViewText *pV = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:login:checkpass:content:ver_value")); - if (pV) - pV->setHardText(getDisplayVersion() + (ext.empty() ? "" : ext)); - - // give priority to login specified as argument - string l = !LoginLogin.empty() ? LoginLogin:ClientCfg.LastLogin; - - if(!l.empty()) - { - CGroupEditBox *pGEB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_LOGIN)); - if (pGEB != NULL && (pGEB->getInputString().empty())) - { - pGEB->setInputString(l); - } - CAHManager::getInstance()->runActionHandler("set_keyboard_focus", NULL, "target=" CTRL_EDITBOX_PASSWORD "|select_all=false"); - } - else - { - CAHManager::getInstance()->runActionHandler("set_keyboard_focus", NULL, "target=" CTRL_EDITBOX_LOGIN "|select_all=false"); - } - - - CCtrlTextButton *pCB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_BUTTON_CONNECT)); - if (pCB != NULL) pCB->setActive(false); - - setLoginFinished( false ); - loginOK = false; -} - -void initAutoLogin() -{ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CGroupEditBox *pGEBLog = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_LOGIN)); - CGroupEditBox *pGEBPwd = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_PASSWORD)); - pGEBLog->setInputString(LoginLogin); - pGEBPwd->setInputString(LoginPassword); - CAHManager::getInstance()->runActionHandler("on_login", NULL, ""); - - if (ClientCfg.R2Mode) - { - LoginSM.pushEvent(CLoginStateMachine::ev_login_ok); - } - else - { - // Select good shard - ShardSelected = -1; - for (uint32 i = 0; i < Shards.size(); ++i) - { - if (Shards[i].ShardId == LoginShardId) - { - ShardSelected = i; - break; - } - } - - if (ShardSelected == -1) - { - pIM->messageBoxWithHelp(CI18N::get("uiErrServerLost"), "ui:login"); - LoginSM.pushEvent(CLoginStateMachine::ev_quit); - } - else - { - LoginSM.pushEvent(CLoginStateMachine::ev_login_ok); - // CAHManager::getInstance()->runActionHandler("login_connect_2", NULL); - } - } -} - -void initAltLogin() -{ - // Check the alt param - if (!LoginCustomParameters.empty() && LoginCustomParameters != "&dbg=1") - { - // don't use login and password for alternate login - string res = checkLogin("", "", ClientApp, LoginCustomParameters); - if (res.empty()) - { - if (ClientCfg.R2Mode) - { - LoginSM.pushEvent(CLoginStateMachine::ev_login_ok); - } - else - { - // Select good shard - ShardSelected = -1; - for (uint32 i = 0; i < Shards.size(); ++i) - { - if (Shards[i].ShardId == LoginShardId) - { - ShardSelected = i; - break; - } - } - - if (ShardSelected == -1) - { - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - pIM->messageBoxWithHelp(CI18N::get("uiErrServerLost"), "ui:login"); - LoginSM.pushEvent(CLoginStateMachine::ev_quit); - } - else - { - LoginSM.pushEvent(CLoginStateMachine::ev_login_ok); - } - } - - return; - } - } - - // close the socket in case of error - HttpClient.disconnect(); - - // ignore error - LoginSM.pushEvent(CLoginStateMachine::ev_login_not_alt); -} - - -// *************************************************************************** -// Called from client.cpp -bool login() -{ - CLoginProgressPostThread::getInstance().step(CLoginStep(LoginStep_LoginScreen, "login_step_login_screen")); - - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CPatchManager *pPM = CPatchManager::getInstance(); - - if (LoginLogin.empty()) - loginIntro(); - - pIM->initLogin(); - IngameDbMngr.flushObserverCalls(); - NLGUI::CDBManager::getInstance()->flushObserverCalls(); - - SetMousePosFirstTime = true; - InitMouseWithCursor(false); - Driver->showCursor (false); - SetMouseFreeLook (); - SetMouseCursor (false); - SetMouseSpeed (ClientCfg.CursorSpeed); - SetMouseAcceleration (ClientCfg.CursorAcceleration); - SetMousePosFirstTime = true; - InitMouseWithCursor (ClientCfg.HardwareCursor && !StereoDisplayAttached); - -// if (ClientCfg.TestBrowser) -// { -// NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->setValue32(UI_VARIABLES_SCREEN_WEBSTART); -// -// // hide 'back to login' button -// CInterfaceElement *backToLogin = CWidgetManager::getInstance()->getElementFromId(CTRL_BUTTON_BACKTOLOGIN); -// if (backToLogin) -// backToLogin->setActive(false); -// -// // show 'reload test page' button -// CInterfaceElement *reloadTest = CWidgetManager::getInstance()->getElementFromId(CTRL_BUTTON_RELOADTESTPAGE); -// if (reloadTest) -// reloadTest->setActive(true); -// -// // start the browser -// CGroupHTML *pGH = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_BROWSER)); -// -// pGH->browse(ClientCfg.TestBrowserUrl.c_str()); -// -// } -// else -// { -//// NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->setValue32(UI_VARIABLES_SCREEN_CHECKPASS); -//// NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:DISPLAY_ACCOUNT_BUTTONS")->setValue32(ClientCfg.DisplayAccountButtons); -// } - - // Active inputs - Actions.enable(true); - EditActions.enable(true); - - if(ClientCfg.ConfigFile.exists("VerboseLog")) - pPM->setVerboseLog(ClientCfg.ConfigFile.getVar("VerboseLog").asInt() == 1); - if(pPM->isVerboseLog()) nlinfo("Using verbose log mode"); - - ClientApp = ClientCfg.ConfigFile.getVar("Application").asString(0); - -// string l = getRegKeyValue("Login").c_str(); -// -// if(!l.empty()) -// { -// CGroupEditBox *pGEB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_LOGIN)); -// if (pGEB != NULL) -// pGEB->setInputString(l); -// CAHManager::getInstance()->runActionHandler("set_keyboard_focus", NULL, "target=" CTRL_EDITBOX_PASSWORD "|select_all=false"); -// } -// else -// { -// CAHManager::getInstance()->runActionHandler("set_keyboard_focus", NULL, "target=" CTRL_EDITBOX_LOGIN "|select_all=false"); -// } - - ShardSelected = -1; -// CCtrlTextButton *pCB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_BUTTON_CONNECT)); -// if (pCB != NULL) pCB->setActive(false); -// -// setLoginFinished( false ); -// loginFinished = false; -// loginOK = false; - - // Comes from a current patch -// if (!LoginLogin.empty()) -// { -// CInterfaceManager *pIM = CInterfaceManager::getInstance(); -// CGroupEditBox *pGEBLog = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_LOGIN)); -// CGroupEditBox *pGEBPwd = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_PASSWORD)); -// pGEBLog->setInputString(LoginLogin); -// pGEBPwd->setInputString(LoginPassword); -// CAHManager::getInstance()->runActionHandler("on_login", NULL, ""); -// // Select good shard -// ShardSelected = -1; -// for (uint32 i = 0; i < Shards.size(); ++i) -// { -// if (Shards[i].ShardId == LoginShardId) -// { -// ShardSelected = i; -// break; -// } -// } -// -// if (ShardSelected == -1) -// pIM->messageBox(CI18N::get("uiErrServerLost"), "ui:login"); -// else -// CAHManager::getInstance()->runActionHandler("login_connect_2", NULL); -// } - - // start the login state machine - LoginSM.pushEvent(CLoginStateMachine::ev_init_done); - - // run the main loop - loginMainLoop(); - - // Uninit all - pIM->uninitLogin(); - - // Disable inputs - Actions.enable(false); - EditActions.enable(false); - - return loginOK; -} - -// *************************************************************************** -// INTERFACE HELPERS -// *************************************************************************** - -// *************************************************************************** -void removeSpace(string &s) -{ - uint i = 0; - while (!s.empty()) - { - if (s[i] == ' ') - s.erase(i, 1); - else - i++; - if (i >= s.size()) break; - } -} - -// *************************************************************************** -static void getPatchParameters(std::string &url, std::string &ver, std::vector &patchURIs) -{ - if (ClientCfg.R2Mode) - { - url = ClientCfg.PatchUrl; - ver = ClientCfg.PatchVersion; - - // if PatchUrl is forced, don't use URLs returned by server - if (url.empty()) - { - patchURIs = R2PatchURLs; - url = R2BackupPatchURL; - ver = R2ServerVersion; - } - } - else - { - nlassert(ShardSelected != -1); - patchURIs = Shards[ShardSelected].PatchURIs; - url = Shards[ShardSelected].EmergencyPatchURL; - ver = Shards[ShardSelected].Version; - - if (!ClientCfg.PatchUrl.empty()) - url = ClientCfg.PatchUrl; - - if (!ClientCfg.PatchVersion.empty()) - ver = ClientCfg.PatchVersion; - } -} - -// *************************************************************************** -std::string getBGDownloaderCommandLine() -{ - #ifdef NL_DEBUG - CConfigFile::CVar *bgdCommandLine = ClientCfg.ConfigFile.getVarPtr("BackgroundDownloaderCommandLine"); - if (bgdCommandLine != NULL && !bgdCommandLine->asString().empty()) - { - return bgdCommandLine->asString(); - } - #endif - string url; - string ver; - std::vector patchURIs; - getPatchParameters(url, ver, patchURIs); - std::string commandLine = /*R2ServerVersion + " " + VersionName + " " + */ url + " " + ver; - for (uint i = 0; i < patchURIs.size(); ++i) - { - commandLine += " " + patchURIs[i]; - } - return commandLine; -} - -// *************************************************************************** -void initPatchCheck() -{ - // start the patching system - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CPatchManager *pPM = CPatchManager::getInstance(); - - string url; - string ver; - std::vector patchURIs; - - if (!ClientCfg.R2Mode) - { - // nb Nico : refactored this code. - // In previous code, the following was not set in R2Mode, possible bug ?...let as before anyway ... - // store the selected shard for restarting after patch - LoginShardId = Shards[ShardSelected].ShardId; - } - - if (!isBGDownloadEnabled()) - { - getPatchParameters(url, ver, patchURIs); - pPM->init(patchURIs, url, ver); - pPM->startCheckThread(true /* include background patchs */); - } - else - { - BGDownloader::CTaskDesc taskDesc(BGDownloader::DLState_CheckPatch); - CBGDownloaderAccess::getInstance().requestDownloadThreadPriority(BGDownloader::ThreadPriority_Normal, false); - CBGDownloaderAccess::getInstance().startTask(taskDesc, getBGDownloaderCommandLine(), true /* showDownloader */); - } - NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->setValue32(UI_VARIABLES_SCREEN_CHECKING); - - setPatcherStateText("ui:login:checking", ucstring()); - setPatcherProgressText("ui:login:checking", ucstring()); -} - -void initShardDisplay() -{ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->setValue32(UI_VARIABLES_SCREEN_SHARDDISP); - - CInterfaceGroup *pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_SHARD)); - if (pList == NULL) - { - nlwarning("element " GROUP_LIST_SHARD " not found probably bad login_main.xml"); - return; - } - /* // To test more servers - for (uint fff = 0; fff < 20; ++fff) - { - CShard s ( toString("%05d",fff), fff%3, fff+32, toString("%s%d","pipo",fff), - 32*fff%46546, "32.32.32.32", "http://www.ryzom.com" ); - Shards.push_back(s); - }*/ - - CInterfaceGroup *pPrevLine = NULL; - for(uint i = 0; i < Shards.size(); i++) - { - vector< pair < string, string > > params; - params.clear(); - params.push_back(pair("id", "s"+toString(i))); - if (i>0) - params.push_back(pair("posref", "BL TL")); - - CInterfaceGroup *pNewLine = CWidgetManager::getInstance()->getParser()->createGroupInstance("t_shard", GROUP_LIST_SHARD, params); - if (pNewLine != NULL) - { - CViewText *pVT = dynamic_cast(pNewLine->getView("name")); - if (pVT != NULL) pVT->setText(Shards[i].Name); - - pVT = dynamic_cast(pNewLine->getView("version")); - if (pVT != NULL) pVT->setText(Shards[i].Version); - - CViewBase *pVBon = pNewLine->getView("online"); - CViewBase *pVBoff = pNewLine->getView("offline"); - if ((pVBon != NULL) && (pVBoff != NULL)) - { - pVBon->setActive (Shards[i].Online); - pVBoff->setActive (!Shards[i].Online); - } - - pVT = dynamic_cast(pNewLine->getView("nbplayer")); - if (pVT != NULL) pVT->setText(toString(Shards[i].NbPlayers)); - - - // Add to the list - pNewLine->setParent(pList); - pNewLine->setParentSize(pList); - pNewLine->setParentPos(pPrevLine); - pList->addGroup(pNewLine); - - pPrevLine = pNewLine; - } - } - // UI Patch - if (!Shards.empty()) - { - CCtrlButton *pCB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_SHARD ":s0:but")); - if (pCB != NULL) - pCB->setPushed(true); - CAHManager::getInstance()->runActionHandler (pCB->getActionOnLeftClick(), pCB, pCB->getParamsOnLeftClick()); - - } - pList->invalidateCoords(); -} - -// *************************************************************************** - -void onlogin(bool vanishScreen = true) -{ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - - // Remove space before and after each string login & password - removeSpace(LoginLogin); - removeSpace(LoginPassword); - - if(!LoginLogin.empty()) - { - ClientCfg.LastLogin = LoginLogin; - ClientCfg.writeString("LastLogin", ClientCfg.LastLogin, true); - } - - if(vanishScreen) - NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->setValue32(-1); - - // Check the login/pass - - // main menu page for r2mode - string res = checkLogin(LoginLogin, LoginPassword, ClientApp, LoginCustomParameters); - if (res.empty()) - { - // if not in auto login, push login ok event - if (LoginSM.getCurrentState() != CLoginStateMachine::st_auto_login) - LoginSM.pushEvent(CLoginStateMachine::ev_login_ok); - - return; - // Ok there is something ! Display next window - - if (ClientCfg.R2Mode) - { -// if (ClientCfg.PatchWanted) -// { -// // start the patching system -// CPatchManager *pPM = CPatchManager::getInstance(); -// -// pPM->init(R2PatchURLs, R2BackupPatchURL, R2ServerVersion); -// -// pPM->startCheckThread(); -// NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->setValue32(UI_VARIABLES_SCREEN_CHECKING); -// } -// else -// { -// // go directly to web browser -// NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->setValue32(UI_VARIABLES_SCREEN_WEBSTART); -// -// CInterfaceManager *pIM = CInterfaceManager::getInstance(); -// // start the browser -// CGroupHTML *pGH = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_BROWSER)); -// -// pGH->browse(RingMainURL.c_str()); -// } -// return; - } - else - { -// NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->setValue32(UI_VARIABLES_SCREEN_SHARDDISP); - } - -// CInterfaceGroup *pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_SHARD)); -// if (pList == NULL) -// { -// nlwarning("element "GROUP_LIST_SHARD" not found probably bad login_main.xml"); -// return; -// } -// /* // To test more servers -// for (uint fff = 0; fff < 20; ++fff) -// { -// CShard s ( toString("%05d",fff), fff%3, fff+32, toString("%s%d","pipo",fff), -// 32*fff%46546, "32.32.32.32", "http://www.ryzom.com" ); -// Shards.push_back(s); -// }*/ -// -// CInterfaceGroup *pPrevLine = NULL; -// for(uint i = 0; i < Shards.size(); i++) -// { -// vector< pair < string, string > > params; -// params.clear(); -// params.push_back(pair("id", "s"+toString(i))); -// if (i>0) -// params.push_back(pair("posref", "BL TL")); -// -// CInterfaceGroup *pNewLine =pIM->createGroupInstance("t_shard", GROUP_LIST_SHARD, params); -// if (pNewLine != NULL) -// { -// CViewText *pVT = dynamic_cast(pNewLine->getView("name")); -// if (pVT != NULL) pVT->setText(Shards[i].Name); -// -// pVT = dynamic_cast(pNewLine->getView("version")); -// if (pVT != NULL) pVT->setText(Shards[i].Version); -// -// CViewBase *pVBon = pNewLine->getView("online"); -// CViewBase *pVBoff = pNewLine->getView("offline"); -// if ((pVBon != NULL) && (pVBoff != NULL)) -// { -// pVBon->setActive (Shards[i].Online); -// pVBoff->setActive (!Shards[i].Online); -// } -// -// pVT = dynamic_cast(pNewLine->getView("nbplayer")); -// if (pVT != NULL) pVT->setText(toString(Shards[i].NbPlayers)); -// -// -// // Add to the list -// pNewLine->setParent(pList); -// pNewLine->setParentSize(pList); -// pNewLine->setParentPos(pPrevLine); -// pList->addGroup(pNewLine); -// -// pPrevLine = pNewLine; -// } -// } -// // UI Patch -// if (!Shards.empty()) -// { -// CCtrlButton *pCB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_SHARD ":s0:but")); -// if (pCB != NULL) -// pCB->setPushed(true); -// CAHManager::getInstance()->runActionHandler (pCB->getActionOnLeftClick(), pCB, pCB->getParamsOnLeftClick()); -// -// } -// pList->invalidateCoords(); - } - else - { - // close the socket in case of error - HttpClient.disconnect(); - - pIM->messageBoxWithHelp("Error : " + res, "ui:login"); - - LoginSM.pushEvent(CLoginStateMachine::ev_bad_login); -// NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->setValue32(UI_VARIABLES_SCREEN_CHECKPASS); -// -// if (LoginLogin.empty()) -// CAHManager::getInstance()->runActionHandler("set_keyboard_focus", NULL, "target=" CTRL_EDITBOX_LOGIN "|select_all=false"); -// else -// CAHManager::getInstance()->runActionHandler("set_keyboard_focus", NULL, "target=" CTRL_EDITBOX_PASSWORD "|select_all=false"); - - } -} - -class CAHOnLogin : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) - { - //nlinfo("CAHOnLogin called"); - - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - - CGroupEditBox *pGEBLog = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_LOGIN)); - CGroupEditBox *pGEBPwd = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_PASSWORD)); - if ((pGEBLog == NULL) || (pGEBPwd == NULL)) - { - nlwarning("element " CTRL_EDITBOX_LOGIN " or " CTRL_EDITBOX_PASSWORD " not found probably bad login_main.xml"); - return; - } - - LoginLogin = pGEBLog->getInputStringAsStdString(); - LoginPassword = pGEBPwd->getInputStringAsStdString(); - - onlogin(); - } -}; -REGISTER_ACTION_HANDLER (CAHOnLogin, "on_login"); - - -// *************************************************************************** -class CAHOnGameConfiguration : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) - { - nlinfo("CAHOnGameConfiguration called"); - - static string Configurator = "ryzom_configuration_rd.exe"; - - if (CFile::fileExists (Configurator)) - { - // launch the ryzom configurator - launchProgram(Configurator, ""); - setLoginFinished( true ); - loginOK = false; - - LoginSM.pushEvent(CLoginStateMachine::ev_quit); - } - else - { - nlwarning(" can't find ryzom configurator : %s",Configurator.c_str()); - } - } -}; -REGISTER_ACTION_HANDLER (CAHOnGameConfiguration, "on_game_configuration"); - - -// *************************************************************************** -class CAHLoginQuit : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) - { - nlinfo("CAHLoginQuit called"); - - setLoginFinished( true ); - loginOK = false; - - LoginSM.pushEvent(CLoginStateMachine::ev_quit); - } -}; -REGISTER_ACTION_HANDLER (CAHLoginQuit, "login_quit"); - - -// *************************************************************************** -class CAHLoginTab : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) - { - nlinfo("CAHLoginTab called"); - - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - - if (NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->getValue32() == UI_VARIABLES_SCREEN_CHECKPASS) - { - CCtrlBase *pCB = CWidgetManager::getInstance()->getCaptureKeyboard(); - if (pCB != NULL) - { - CCtrlBase *pNewCB; - string sID = pCB->getId(); - if (sID == CTRL_EDITBOX_LOGIN) - pNewCB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_PASSWORD)); - else - pNewCB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_LOGIN)); - CWidgetManager::getInstance()->setCaptureKeyboard(pNewCB); - } - } - else if (NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->getValue32() == UI_VARIABLES_SCREEN_CREATE_ACCOUNT) - { - CCtrlBase *pCB = CWidgetManager::getInstance()->getCaptureKeyboard(); - if (pCB != NULL) - { - CCtrlBase *pNewCB; - string sID = pCB->getId(); - if (sID == CTRL_EDITBOX_CREATEACCOUNT_LOGIN) - pNewCB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_CREATEACCOUNT_PASSWORD)); - else if (sID == CTRL_EDITBOX_CREATEACCOUNT_PASSWORD) - pNewCB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_CREATEACCOUNT_CONFIRMPASSWORD)); - else if (sID == CTRL_EDITBOX_CREATEACCOUNT_CONFIRMPASSWORD) - pNewCB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_CREATEACCOUNT_EMAIL)); - else - pNewCB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_CREATEACCOUNT_LOGIN)); - CWidgetManager::getInstance()->setCaptureKeyboard(pNewCB); - } - } - } -}; -REGISTER_ACTION_HANDLER (CAHLoginTab, "login_tab"); - - -// *************************************************************************** -class CAHShardSelect : public IActionHandler -{ - virtual void execute (CCtrlBase *pCaller, const string &/* Params */) - { - nlinfo("CAHShardSelect called"); - - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - - CCtrlButton *pCB = NULL; - // Unselect - if (ShardSelected != -1) - { - pCB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_SHARD ":s"+toString(ShardSelected)+":but")); - if (pCB != NULL) - pCB->setPushed(false); - } - - pCB = dynamic_cast(pCaller); - if (pCB != NULL) - { - string name = pCB->getId(); - name = name.substr(0,name.rfind(':')); - name = name.substr(name.rfind(':')+2,name.size()); - fromString(name, ShardSelected); - - pCB->setPushed(true); - } - - CCtrlTextButton *pCTB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_BUTTON_CONNECT)); - if (pCTB != NULL) - pCTB->setActive(true); - } -}; -REGISTER_ACTION_HANDLER (CAHShardSelect, "shard_select"); - -// *************************************************************************** -void ConnectToShard() -{ - //nlinfo("ConnectToShard called"); - - if (ClientCfg.R2Mode) - { - // r2 mode - setLoginFinished( true ); - loginOK = true; - - LoginSM.pushEvent(CLoginStateMachine::ev_enter_game); - } - else - { - // legacy mode - nlassert(ShardSelected != -1); - - string res = selectShard(Shards[ShardSelected].ShardId, Cookie, FSAddr); - - if(res.empty()) - { - setLoginFinished( true ); - loginOK = true; - - LoginSM.pushEvent(CLoginStateMachine::ev_enter_game); - } - else - { - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - pIM->messageBoxWithHelp("Error :" + res, "ui:login"); - - LoginSM.pushEvent(CLoginStateMachine::ev_conn_failed); - } - - } - -} - -// *************************************************************************** -class CAHLoginConnect : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) - { - nlinfo("CAHLoginConnect called"); - - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - - if (ShardSelected == -1) - return; - - if (!Shards[ShardSelected].Online) - { - pIM->messageBoxWithHelp(CI18N::get("uiErrOffLineShard"), "ui:login"); - return; - } - - LoginSM.pushEvent(CLoginStateMachine::ev_shard_selected); - -// std::vector patchURIs = Shards[ShardSelected].PatchURIs; -// string url = Shards[ShardSelected].EmergencyPatchURL; -// string ver = Shards[ShardSelected].Version; -// -// if (!ClientCfg.PatchUrl.empty()) -// url = ClientCfg.PatchUrl; -// -// if (!ClientCfg.PatchVersion.empty()) -// ver = ClientCfg.PatchVersion; -// -// pPM->init(patchURIs, url, ver); -// -// LoginShardId = Shards[ShardSelected].ShardId; -// -// if (ClientCfg.PatchWanted) -// { -// pPM->startCheckThread(); -// NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->setValue32(UI_VARIABLES_SCREEN_CHECKING); -// } -// else -// { -// CAHManager::getInstance()->runActionHandler("login_patch",NULL); -// } - } -}; -REGISTER_ACTION_HANDLER (CAHLoginConnect, "login_connect"); - -// *************************************************************************** -// Can be called after a patching process (ryzom relaunch and call this AH to -// see if we have to continue patching or directly go ingame) -class CAHLoginConnect2 : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) - { - nlinfo("CAHLoginConnect2 called"); - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - - if (Shards[ShardSelected].PatchURIs.empty() && Shards[ShardSelected].EmergencyPatchURL.empty()) - { - pIM->messageBoxWithHelp(CI18N::get("uiErrCantPatch"), "ui:login"); - return; - } - - LoginSM.pushEvent(CLoginStateMachine::ev_shard_selected); - -// std::vector patchURIs = Shards[ShardSelected].PatchURIs; -// string url = Shards[ShardSelected].EmergencyPatchURL; -// string ver = Shards[ShardSelected].Version; -// -// if (!ClientCfg.PatchUrl.empty()) -// url = ClientCfg.PatchUrl; -// -// if (!ClientCfg.PatchVersion.empty()) -// ver = ClientCfg.PatchVersion; -// -// pPM->init(patchURIs, url, ver); -// -// if ((ClientCfg.PatchWanted) && -// (!Shards[ShardSelected].Version.empty()) && -// (Shards[ShardSelected].Version != pPM->getClientVersion())) -// { -// pPM->startCheckThread(); -// NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->setValue32(UI_VARIABLES_SCREEN_CHECKING); -// } -// else -// { -// // Version is good, eula then connect and launch the client -// showEULA(); -// } - } -}; -REGISTER_ACTION_HANDLER (CAHLoginConnect2, "login_connect_2"); - -void initPatch() -{ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CPatchManager *pPM = CPatchManager::getInstance(); - - - if (!isBGDownloadEnabled()) - { - // Get the list of optional categories to patch - vector vCategories; - - CInterfaceGroup *pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_CAT)); - if (pList == NULL) - { - nlwarning("element " GROUP_LIST_CAT " not found probably bad login_main.xml"); - return; - } - - for(uint i = 0; i < InfoOnPatch.OptCat.size(); i++) - { - // Ok for the moment all optional categories must be patched even if the player - // does not want it. Because we cant detect that a continent have to be patched ingame. - vCategories.push_back(InfoOnPatch.OptCat[i].Name); - - /* - // Code to check if the player wants an optional category or not - CInterfaceGroup *pLine = pList->getGroup("c"+toString(i)); - if (pLine != NULL) - { - CCtrlButton *pCB = dynamic_cast(pLine->getCtrl("on_off")); - if (pCB != NULL) - { - if (pCB->getPushed()) - vCategories.push_back(rAllCats[i]); - } - } - */ - - } - pPM->startPatchThread(vCategories, true); - } - else - { - // NB : here we only do a part of the download each time - BGDownloader::CTaskDesc taskDesc(BGDownloader::DLState_GetAndApplyPatch, (1 << BGDownloaderWantedPatch)); - CBGDownloaderAccess::getInstance().startTask(taskDesc, string(), true /* showDownloader */); // no command line since bg downloader should already be started - // release lock on bnp, so that they can be written - NLMISC::CBigFile::getInstance().removeAll(); - NLMISC::CStreamedPackageManager::getInstance().unloadAll(); - } - NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->setValue32(UI_VARIABLES_SCREEN_PATCHING); - - CInterfaceElement *closeBtn = CWidgetManager::getInstance()->getElementFromId(CTRL_BUTTON_CLOSE_PATCH); - if (closeBtn) - closeBtn->setActive(false); - - setPatcherStateText("ui:login:patching", ucstring()); - setPatcherProgressText("ui:login:patching", ucstring()); -} - -// *************************************************************************** -// Called after the check has been done. The page is full of optional categories that must be selected for patching -class CAHLoginPatch : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) - { - nlinfo("CAHLoginPatch called"); - - LoginSM.pushEvent(CLoginStateMachine::ev_run_patch); - -// CInterfaceManager *pIM = CInterfaceManager::getInstance(); -// CPatchManager *pPM = CPatchManager::getInstance(); -// -// // Get the list of optional categories to patch -// vector vCategories; -// -// CInterfaceGroup *pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_CAT)); -// if (pList == NULL) -// { -// nlwarning("element "GROUP_LIST_CAT" not found probably bad login_main.xml"); -// return; -// } -// -// for(uint i = 0; i < InfoOnPatch.OptCat.size(); i++) -// { -// // Ok for the moment all optional categories must be patched even if the player -// // does not want it. Because we cant detect that a continent have to be patched ingame. -// vCategories.push_back(InfoOnPatch.OptCat[i].Name); -// -// /* -// // Code to check if the player wants an optional category or not -// CInterfaceGroup *pLine = pList->getGroup("c"+toString(i)); -// if (pLine != NULL) -// { -// CCtrlButton *pCB = dynamic_cast(pLine->getCtrl("on_off")); -// if (pCB != NULL) -// { -// if (pCB->getPushed()) -// vCategories.push_back(rAllCats[i]); -// } -// } -// */ -// } -// -// // Start patching -// if (ClientCfg.PatchWanted) -// { -// pPM->startPatchThread(vCategories); -// NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->setValue32(UI_VARIABLES_SCREEN_PATCHING); -// } -// else -// { -// ConnectToShard(); -// } - } -}; -REGISTER_ACTION_HANDLER (CAHLoginPatch, "login_patch"); - -// *************************************************************************** -// Called after the check has been done. The page is full of optional categories that must be selected for patching -class CAHClosePatch : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) - { - nlinfo("CAHClosePatch called"); - - LoginSM.pushEvent(CLoginStateMachine::ev_close_patch); - } -}; -REGISTER_ACTION_HANDLER (CAHClosePatch, "close_patch"); - - -// *************************************************************************** -// Called after pushing the read note at the opening of the modal window -class CAHSetReleaseNote : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &sParams) - { - nlinfo("CAHSetReleaseNote called"); - - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - - string sShard = getParam(sParams, "shard"); - string sGroupHtml = getParam(sParams, "group"); - - CGroupHTML *pQH = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(sGroupHtml)); - if (pQH == NULL) - return; - - string sURL; - if (ClientCfg.R2Mode) - { - // ring release note - sURL = ClientCfg.RingReleaseNotePath + - "?version=" + (VersionName.empty() ? R2ServerVersion : VersionName)+ - "&lang=" + ClientCfg.LanguageCode + - "&ca=" + ClientCfg.ConfigFile.getVar("Application").asString(0); - "&startPage="+RingMainURL; - } - else - { - // legacy ryzom release note - uint32 nShardId; - if (sShard == "selected") - nShardId = ShardSelected; - else - fromString(sShard.substr(1), nShardId); - - sURL = ClientCfg.ReleaseNotePath + - "?version=" + Shards[nShardId].Version + - "&lang=" + ClientCfg.LanguageCode + - "&id=" + toString(Shards[nShardId].ShardId) + - "&ca=" + ClientCfg.ConfigFile.getVar("Application").asString(0); - - } - - pQH->browse(sURL.c_str()); - } -}; -REGISTER_ACTION_HANDLER (CAHSetReleaseNote, "set_release_note"); - -// *************************************************************************** -// Called after pushing the read note at the opening of the modal window -class CAHReboot : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* sParams */) - { - nlinfo("CAHReboot called"); - - // create a file to prompt eula next time - CFile::createEmptyFile(getLogDirectory() + "show_eula"); - - CInterfaceManager *im = CInterfaceManager::getInstance(); - try - { - if (isBGDownloadEnabled()) - { - CBGDownloaderAccess::getInstance().reboot(); - } - else - { - CPatchManager::getInstance()->reboot(); - } - LoginSM.pushEvent(CLoginStateMachine::ev_reboot); - } - catch (const NLMISC::EDiskFullError &) - { - im->messageBoxWithHelp(CI18N::get("uiPatchDiskFull"), "ui:login"); - } - catch (const NLMISC::EWriteError &) - { - im->messageBoxWithHelp(CI18N::get("uiPatchWriteError"), "ui:login"); - } - catch (const std::exception &e) - { - im->messageBoxWithHelp(ucstring::makeFromUtf8(e.what()), "ui:login", "login_quit"); - } - } -}; -REGISTER_ACTION_HANDLER (CAHReboot, "reboot"); - - - -// *************************************************************************** -class CAHAcceptEula : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* sParams */) - { - //nlinfo("CAHAcceptEula called"); - if(CFile::fileExists(getLogDirectory() + "show_eula")) - CFile::deleteFile(getLogDirectory() + "show_eula"); - LoginSM.pushEvent(CLoginStateMachine::ev_accept_eula); - -// if (ClientCfg.R2Mode) -// { -// // open web browser -// CInterfaceManager *pIM = CInterfaceManager::getInstance(); -// NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->setValue32(UI_VARIABLES_SCREEN_WEBSTART); -// -// // start the browser -// CGroupHTML *pGH = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(GROUP_BROWSER)); -// -// pGH->browse(RingMainURL.c_str()); -// } -// else -// { -// ConnectToShard(); -// } - } -}; -REGISTER_ACTION_HANDLER (CAHAcceptEula, "accept_eula"); - -// *************************************************************************** -class CAHOpenURL : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &sParams) - { - nlinfo("CAHOpenURL called"); - - string url; - - string installTag; - -#ifdef NL_OS_WINDOWS - - // Check for special install tag - const char *KeyName = "InstallTag"; - - installTag = CSystemUtils::getRegKey(KeyName); - - if (installTag.length() > 1) - { - nldebug("Found install tag '%s'", url.c_str()); - } - else - { - // Process any inserts in lpMsgBuf. - // ... - // Display the string. - nlwarning("RegQueryValue for '%s' : %s", KeyName, NLMISC::formatErrorMessage(0).c_str()); - } -#else - // TODO: for Linux and Mac OS -#endif - if (sParams == "cfg_CreateAccountURL") - { - url = ClientCfg.CreateAccountURL; - } - else if (sParams == "cfg_EditAccountURL") - { - url = ClientCfg.EditAccountURL; - } - else if (sParams == "cfg_BetaAccountURL") - { - url = ClientCfg.BetaAccountURL; - } - else if (sParams == "cfg_ForgetPwdURL") - { - url = ClientCfg.ForgetPwdURL; - } - else if (sParams == "cfg_LoginSupportURL") - { - url= ClientCfg.LoginSupportURL; - } - else if (sParams == "cfg_FreeTrialURL") - { - url = ClientCfg.FreeTrialURL; - - if (!installTag.empty()) - { - url += string("&from=")+installTag; - } - } - else if (sParams == "cfg_ConditionsTermsURL") - { - url = ClientCfg.ConditionsTermsURL; - } - else if (sParams == "cfg_NamingPolicyURL") - { - url = ClientCfg.NamingPolicyURL; - } - else - { - nlwarning("no URL found"); - return; - } - - if(sParams != "cfg_ConditionsTermsURL" && sParams != "cfg_NamingPolicyURL") - { - // modify existing languages - - // old site - string::size_type pos_lang = url.find("/en/"); - - // or new forums - if (pos_lang == string::npos) - pos_lang = url.find("=en#"); - - if (pos_lang != string::npos) - { - url.replace(pos_lang + 1, 2, ClientCfg.getHtmlLanguageCode()); - } - else - { - // append language - if (url.find('?') != string::npos) - url += "&"; - else - url += "?"; - - url += "language=" + ClientCfg.LanguageCode; - - if (!LoginCustomParameters.empty()) - url += LoginCustomParameters; - } - } - - openURL(url); - - nlinfo("openURL %s", url.c_str()); - } -}; -REGISTER_ACTION_HANDLER (CAHOpenURL, "open_url"); - -static vector VideoModes; -vector StringModeList; -vector StringPresetList; -vector< pair > CfgPresetList; -sint CurrentMode = -1; -sint CurrentPreset = -1; - -// *************************************************************************** -class CAHInitResLod : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* sParams */) - { - //nlinfo("CAHInitResLod called"); - if (Driver == NULL) return; - - VideoModes.clear(); - StringModeList.clear(); - - std::vector stringFreqList; - sint currentFreq; - - getRyzomModes(VideoModes, StringModeList, stringFreqList, CurrentMode, currentFreq); - - // getRyzomModes() expects empty list, so we need to insert 'Windowed' after mode list is filled - StringModeList.insert(StringModeList.begin(), "uiConfigWindowed"); - - // If the client is in windowed mode, still in windowed mode and do not change anything - if (ClientCfg.Windowed) - CurrentMode = 0; - // If we have not found the mode so it can be an error or machine change, so propose the first available - else if (CurrentMode == -1) - CurrentMode = 1; - // We inserted 'Windowed' as first mode, so index needs to move too - else - ++CurrentMode; - - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:login:checkpass:content:res_value")); - if (pVT != NULL) - pVT->setHardText(StringModeList[CurrentMode]); - - StringPresetList.clear(); - StringPresetList.push_back("uiLodValueLow"); - StringPresetList.push_back("uiLodValueMedium"); - StringPresetList.push_back("uiLodValueNormal"); - StringPresetList.push_back("uiLodValueHigh"); - StringPresetList.push_back("uiLodValueCustom"); - CurrentPreset = 4; // CInterfaceDDX::CustomPreset - - // first indicates the preset-able cfg-variable - // second indicates if its a double variable (else it's an int) - CfgPresetList.clear(); - CfgPresetList.push_back(pair("LandscapeTileNear", true)); - CfgPresetList.push_back(pair("LandscapeThreshold", true)); - CfgPresetList.push_back(pair("Vision", true)); - CfgPresetList.push_back(pair("MicroVeget", false)); - CfgPresetList.push_back(pair("MicroVegetDensity", true)); - CfgPresetList.push_back(pair("FxNbMaxPoly", false)); - CfgPresetList.push_back(pair("Cloud", false)); - CfgPresetList.push_back(pair("CloudQuality", true)); - CfgPresetList.push_back(pair("CloudUpdate", false)); - CfgPresetList.push_back(pair("Shadows", false)); - CfgPresetList.push_back(pair("SkinNbMaxPoly", false)); - CfgPresetList.push_back(pair("NbMaxSkeletonNotCLod", false)); - CfgPresetList.push_back(pair("CharacterFarClip", true)); - - CfgPresetList.push_back(pair("FXAA", false)); - CfgPresetList.push_back(pair("Bloom", false)); - CfgPresetList.push_back(pair("SquareBloom", false)); - CfgPresetList.push_back(pair("DensityBloom", true)); - - // Check if all the preset-able cfg-variable are in a preset mode - sint nPreset = -1; - for (uint32 i = 0; i < CfgPresetList.size(); ++i) - { - CConfigFile::CVar *cfgVarPtr = ClientCfg.ConfigFile.getVarPtr(CfgPresetList[i].first); - if (cfgVarPtr == NULL) continue; - // Get the preset of the variable i - sint nVarPreset = 0; - for (uint32 j = 0; j < 4; ++j) // CInterfaceDDX::NumPreset - { - string sPresetName = CfgPresetList[i].first + "_ps" + toString(j); - CConfigFile::CVar *presetVarPtr = ClientCfg.ConfigFile.getVarPtr(sPresetName); - if(presetVarPtr) - { - if (CfgPresetList[i].second) // Is it a double ? - { - if (cfgVarPtr->asDouble() == presetVarPtr->asDouble()) - nVarPreset |= (1 << j); - } - else - { - if (cfgVarPtr->asInt() == presetVarPtr->asInt()) - nVarPreset |= (1 << j); - } - } - } - - if (nPreset == -1) - nPreset = nVarPreset; - else - nPreset &= nVarPreset; - - if (nPreset == 0) - break; - } - - if (nPreset != 0) - { - if (nPreset&1) CurrentPreset = 0; - else if (nPreset&2) CurrentPreset = 1; - else if (nPreset&4) CurrentPreset = 2; - else if (nPreset&8) CurrentPreset = 3; - } - - pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:login:checkpass:content:lod_value")); - if (pVT != NULL) - pVT->setHardText(StringPresetList[CurrentPreset]); - } -}; -REGISTER_ACTION_HANDLER (CAHInitResLod, "init_res_lod"); - -// *************************************************************************** -class CAHMoreRes : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* sParams */) - { - nlinfo("CAHMoreRes called"); - if (CurrentMode < ((sint)StringModeList.size()-1)) - CurrentMode++; - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:login:checkpass:content:res_value")); - if (pVT != NULL) - pVT->setHardText(StringModeList[CurrentMode]); - } -}; -REGISTER_ACTION_HANDLER (CAHMoreRes, "more_res"); - -// *************************************************************************** -class CAHLessRes : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* sParams */) - { - nlinfo("CAHLessRes called"); - if (CurrentMode > 0) - CurrentMode--; - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:login:checkpass:content:res_value")); - if (pVT != NULL) - pVT->setHardText(StringModeList[CurrentMode]); - } -}; -REGISTER_ACTION_HANDLER (CAHLessRes, "less_res"); - -// *************************************************************************** -class CAHMoreLod : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* sParams */) - { - nlinfo("CAHMoreLod called"); - if (CurrentPreset < ((sint)StringPresetList.size()-1)) - CurrentPreset++; - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:login:checkpass:content:lod_value")); - if (pVT != NULL) - pVT->setHardText(StringPresetList[CurrentPreset]); - } -}; -REGISTER_ACTION_HANDLER (CAHMoreLod, "more_lod"); - -// *************************************************************************** -class CAHLessLod : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* sParams */) - { - nlinfo("CAHMoreLod called"); - if (CurrentPreset > 0) - CurrentPreset--; - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:login:checkpass:content:lod_value")); - if (pVT != NULL) - pVT->setHardText(StringPresetList[CurrentPreset]); - } -}; -REGISTER_ACTION_HANDLER (CAHLessLod, "less_lod"); - -// *************************************************************************** -class CAHUninitResLod : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* sParams */) - { - //nlinfo("CAHUninitResLod called"); - - // If the mode requested is a windowed mode do nothnig - if (CurrentMode == 0) - { - ClientCfg.Windowed = true; - ClientCfg.writeBool("FullScreen", false); - } - else - { - ClientCfg.Windowed = false; - // Get W, H - uint16 w = 0, h = 0; - { - string vidModeStr = StringModeList[CurrentMode]; - string tmp = vidModeStr.substr(0,vidModeStr.find('x')-1); - fromString(tmp, w); - tmp = vidModeStr.substr(vidModeStr.find('x')+2,vidModeStr.size()); - fromString(tmp, h); - } - ClientCfg.Width = w; - ClientCfg.Height = h; - - ClientCfg.writeBool("FullScreen", true); - ClientCfg.writeInt("Width", w); - ClientCfg.writeInt("Height", h); - } - - if (CurrentPreset != 4) // CInterfaceDDX::CustomPreset - { - for (uint32 i = 0; i < CfgPresetList.size(); ++i) - { - CConfigFile::CVar *cfgVarPtr = ClientCfg.ConfigFile.getVarPtr(CfgPresetList[i].first); - if (cfgVarPtr == NULL) continue; - - string sPresetName = CfgPresetList[i].first + "_ps" + toString(CurrentPreset); - CConfigFile::CVar *presetVarPtr = ClientCfg.ConfigFile.getVarPtr(sPresetName); - if(presetVarPtr) - { - if (CfgPresetList[i].second) // Is it a double ? - cfgVarPtr->setAsDouble(presetVarPtr->asDouble()); - else - cfgVarPtr->setAsInt(presetVarPtr->asInt()); - } - } - } - - // **** Save the config - if (ClientCfg.SaveConfig) - ClientCfg.ConfigFile.save (); - ClientCfg.IsInvalidated = true; - } -}; -REGISTER_ACTION_HANDLER (CAHUninitResLod, "uninit_res_lod"); - - -void initDataScan() -{ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CPatchManager *pPM = CPatchManager::getInstance(); - - // reset the log - setDataScanLog(ucstring()); - - // Start Scanning - pPM->startScanDataThread(); - NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->setValue32(UI_VARIABLES_SCREEN_DATASCAN); - NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:DATASCAN_RUNNING")->setValue32(1); -} - -// *************************************************************************** -// Called after the check has been done. The page is full of optional categories that must be selected for patching -class CAHOnScanDataStart : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) - { - nlinfo("CAHOnScanDataStart called"); - - LoginSM.pushEvent(CLoginStateMachine::ev_data_scan); - - } -}; -REGISTER_ACTION_HANDLER (CAHOnScanDataStart, "on_scan_data_start"); - -// *************************************************************************** -// Called when the user cancel the scan -class CAHOnScanDataClose : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) - { - nlinfo("CAHOnScanDataClose called"); - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CPatchManager *pPM = CPatchManager::getInstance(); - - // if the scan is still running - if(NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:DATASCAN_RUNNING")->getValue32()!=0) - { - // request to stop the thread - pPM->askForStopScanDataThread(); - - // Log. - setDataScanState(CI18N::get("uiCancelingScanData")); - } - else - { - LoginSM.pushEvent(CLoginStateMachine::ev_close_data_scan); - // Come Back to Login Screen. -// NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->setValue32(UI_VARIABLES_SCREEN_CHECKPASS); -// -// // Give focus to password if some login entered -// string loginEB; -// CGroupEditBox *pGEB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_LOGIN)); -// if(pGEB) -// loginEB= pGEB->getInputStringAsStdString(); -// // if none entered -// if (loginEB.empty()) -// CAHManager::getInstance()->runActionHandler("set_keyboard_focus", NULL, "target=" CTRL_EDITBOX_LOGIN "|select_all=false"); -// else -// CAHManager::getInstance()->runActionHandler("set_keyboard_focus", NULL, "target=" CTRL_EDITBOX_PASSWORD "|select_all=false"); - } - } -}; -REGISTER_ACTION_HANDLER (CAHOnScanDataClose, "on_scan_data_close"); - -// *************************************************************************** - -inline string parseTooltip(const string & initString, const string & tagName) -{ - string tooltip; - - string::size_type tooltipPos = initString.find(tagName); - if(tooltipPos != string::npos) - { - tooltip = initString.substr(tooltipPos); - - // start of tooltip - tooltip = tooltip.substr(tooltip.find(">")+1); - - // end of tooltip - tooltip = tooltip.substr(0, tooltip.find("<")); - } - - ucstring uc; - uc.fromUtf8(tooltip);; - tooltip = uc.toString(); - - return tooltip; -} - -inline string parseCommentError(const string & initString, const string & tagName) -{ - string error; - - string::size_type errorPos = initString.find(tagName); - if(errorPos != string::npos) - { - error = initString.substr(errorPos); - - // start of comment - error = error.substr(error.find(">")+1); - - // end of comment - error = error.substr(0, error.find("<")); - } - - ucstring uc; - uc.fromUtf8(error);; - error = uc.toString(); - - return error; -} - -bool initCreateAccount() -{ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - - // reset UI - CInterfaceGroup *createAccountUI = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:login:create_account")); - if(createAccountUI) - { - // show "submit interface", hide "login interface" - CInterfaceGroup * grSubmit = dynamic_cast(createAccountUI->findFromShortId("submit_gr")); - if(grSubmit) - grSubmit->setActive(true); - - CInterfaceGroup * grLogin = dynamic_cast(createAccountUI->findFromShortId("login_gr")); - if(grLogin) - grLogin->setActive(false); - - // empty edit boxes - std::vector< std::string > editBoxes(4); - editBoxes[0] = "eb_login"; - editBoxes[1] = "eb_password"; - editBoxes[2] = "eb_confirm_password"; - editBoxes[3] = "eb_email"; - - for(uint i=0; i(createAccountUI->findFromShortId(editBoxes[i] + ":eb")); - if(eb) - eb->setInputString(ucstring("")); - } - - // conditions button - CCtrlBaseButton * but = dynamic_cast(createAccountUI->findFromShortId("accept_cond")); - if(but) - but->setPushed(true); - - // get rules from url - string url = ClientCfg.CreateAccountURL; - CPatchManager *pPM = CPatchManager::getInstance(); - - if (!CurlHttpClient.connect(url)) - { - nlwarning("Can't connect"); - return false; - } - - std::string lang = ClientCfg.LanguageCode; - if(lang=="wk") lang = "uk"; - - CurlHttpClient.verifyServer(true); // set this to false if you need to connect to the test environment - - std::string params = "language=" + lang; - - if (!LoginCustomParameters.empty()) - params += LoginCustomParameters; - - if(!CurlHttpClient.sendGet(url, params, pPM->isVerboseLog())) - { - ucstring errorMessage("Can't send (error code 60)"); - errorMessageBox(errorMessage); - nlwarning(errorMessage.toString().c_str()); - return false; - } - - string res; - if(!CurlHttpClient.receive(res, pPM->isVerboseLog())) - { - ucstring errorMessage("Can't receive (error code 61)"); - errorMessageBox(errorMessage); - nlwarning(errorMessage.toString().c_str()); - return false; - } - - if(res.empty()) - { - ucstring errorMessage("Empty result (error code 13)"); - errorMessageBox(errorMessage); - nlwarning(errorMessage.toString().c_str()); - return false; - } - - CurlHttpClient.disconnect(); - - // initialize rules in interface - std::vector< std::pair< std::string , std::string > > rules(5); - rules[0] = std::pair("rules_login", "id=tooltip-Username"); - rules[1] = std::pair("rules_password", "id=tooltip-Password"); - rules[2] = std::pair("rules_password_conf", "id=tooltip-ConfirmPass"); - rules[3] = std::pair("rules_email", "id=tooltip-Email"); - rules[4] = std::pair("rules_conditions", "id=tooltip-TaC"); - - for(uint i=0; i(createAccountUI->findFromShortId(rules[i].first)); - if(text) - { - string tooltip = parseTooltip(res, rules[i].second); - text->setHardText(tooltip); - text->setActive(false); - } - } - - // welcome text - CViewText * text = dynamic_cast(createAccountUI->findFromShortId("errors_list")); - if(text) - { - text->setHardText(toString(CI18N::get("uiCreateAccountWelcome"))); - text->setColor(CRGBA(255, 255, 255, 255)); - - CInterfaceGroup * group = dynamic_cast(createAccountUI->findFromShortId("erros_txt")); - if(group) - { - group->updateCoords(); - - CInterfaceGroup * groupScroll = dynamic_cast(createAccountUI->findFromShortId("err_back_scrollbar")); - if(groupScroll) groupScroll->setActive(group->getHReal() > group->getMaxHReal()); - CCtrlScroll * scroll = dynamic_cast(createAccountUI->findFromShortId("err_scroll_bar")); - if(scroll) - scroll->setTrackPos(scroll->getHReal()); - } - } - - // hide rules - CInterfaceGroup * rulesGr = dynamic_cast(createAccountUI->findFromShortId("rules_gr")); - if(rulesGr) - rulesGr->setActive(false); - - // must be done after hide rules - CAHManager::getInstance()->runActionHandler("set_keyboard_focus", NULL, "target=" CTRL_EDITBOX_CREATEACCOUNT_LOGIN "|select_all=false"); - } - - - NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->setValue32(UI_VARIABLES_SCREEN_CREATE_ACCOUNT); - - return true; -} - -// *************************************************************************** -// Called when the user focus one of the edit boxes during the account creation -class CAHCreateAccountRules : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &Params) - { - nlinfo("CAHCreateAccountRules called"); - - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CInterfaceGroup *createAccountUI = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:login:create_account")); - if(createAccountUI) - { - CInterfaceGroup * rulesGr = dynamic_cast(createAccountUI->findFromShortId("rules_gr")); - if(rulesGr) - rulesGr->setActive(false); - - std::vector< std::string > rules(4); - rules[0] = "rules_login"; - rules[1] = "rules_password"; - rules[2] = "rules_password_conf"; - rules[3] = "rules_email"; - - for(uint i=0; i(createAccountUI->findFromShortId(rules[i])); - if(text) - { - text->setActive(Params==rules[i]); - if(Params==rules[i]) - { - if(rulesGr) - rulesGr->setActive(!text->getText().empty()); - } - } - } - } - } -}; -REGISTER_ACTION_HANDLER (CAHCreateAccountRules, "create_account_rules"); - -// *************************************************************************** -// Called when the user choose the account creation -class CAHOnCreateAccount : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) - { - nlinfo("CAHOnCreateAccount called"); - - LoginSM.pushEvent(CLoginStateMachine::ev_create_account); - } -}; -REGISTER_ACTION_HANDLER (CAHOnCreateAccount, "on_create_account"); - -// *************************************************************************** -// Called when the user submit the account creation -class CAHOnCreateAccountSubmit : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) - { - nlinfo("CAHOnCreateAccountSubmit called"); - - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - - CInterfaceGroup *createAccountUI = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:login:create_account")); - if(createAccountUI) - { - // recover data from UI - std::vector< std::string > editBoxes(4); - editBoxes[0] = "eb_login"; - editBoxes[1] = "eb_password"; - editBoxes[2] = "eb_confirm_password"; - editBoxes[3] = "eb_email"; - std::vector< std::string > results(4); - - for(uint i=0; i(createAccountUI->findFromShortId(editBoxes[i] + ":eb")); - if(eb) - results[i] = eb->getInputString().toUtf8(); - } - - // text - CViewText * text = dynamic_cast(createAccountUI->findFromShortId("email_adress")); - if(text) - text->setHardText(results[3]); - - // conditions button - bool conditionsPushed = false; - CCtrlBaseButton * but = dynamic_cast(createAccountUI->findFromShortId("accept_cond")); - if(but) - conditionsPushed = !but->getPushed(); - - string url = ClientCfg.CreateAccountURL; - CPatchManager *pPM = CPatchManager::getInstance(); - - if (!CurlHttpClient.connect(url)) - { - ucstring errorMessage("Can't connect"); - errorMessageBox(errorMessage); - nlwarning(errorMessage.toString().c_str()); - return; - } - - std::string params = "Username=" + results[0] + "&Password=" + results[1] - + "&ConfirmPass=" + results[2] + "&Email=" + results[3]; - - if(conditionsPushed) - params += "&TaC=1"; - - if (!LoginCustomParameters.empty()) - params += LoginCustomParameters; - - std::string md5 = results[0] + results[1] + "" + results[3]; - md5 = NLMISC::getMD5((uint8*)md5.data(), (uint32)md5.size()).toString(); - - params += "&SC=" + md5; - std::string lang = ClientCfg.LanguageCode; - if(lang=="wk") lang = "uk"; - params += "&Language=" + lang; - - CurlHttpClient.verifyServer(true); // set this to false if you need to connect to the test environment - - if(!CurlHttpClient.sendPost(url, params, pPM->isVerboseLog())) - { - ucstring errorMessage("Can't send (error code 60)"); - errorMessageBox(errorMessage); - nlwarning(errorMessage.toString().c_str()); - return; - } - - string res; - if(!CurlHttpClient.receive(res, pPM->isVerboseLog())) - { - ucstring errorMessage("Can't receive (error code 61)"); - errorMessageBox(errorMessage); - nlwarning(errorMessage.toString().c_str()); - return; - } - - if(res.empty()) - { - ucstring errorMessage("Empty result (error code 13)"); - errorMessageBox(errorMessage); - nlwarning(errorMessage.toString().c_str()); - return; - } - - CurlHttpClient.disconnect(); - - // parse html - string::size_type okPos = res.find("email_sent"); - if(okPos != string::npos) - { - // show "submit interface", hide "login interface" - CInterfaceGroup * grSubmit = dynamic_cast(createAccountUI->findFromShortId("submit_gr")); - if(grSubmit) - grSubmit->setActive(false); - - CInterfaceGroup * grLogin = dynamic_cast(createAccountUI->findFromShortId("login_gr")); - if(grLogin) - grLogin->setActive(true); - } - else - { - // initialize error comments in interface - CViewText * text = dynamic_cast(createAccountUI->findFromShortId("errors_list")); - if(text) - { - text->setColor(CRGBA(250, 30, 30, 255)); - - std::vector< std::string > errors(5); - errors[0] = "id=\"comment-Username\""; - errors[1] = "id=\"comment-Password\""; - errors[2] = "id=\"comment-ConfirmPass\""; - errors[3] = "id=\"comment-Email\""; - errors[4] = "id=\"comment-TaC\""; - - string error; - for(uint i=0; isetHardText(error); - - CInterfaceGroup * group = dynamic_cast(createAccountUI->findFromShortId("erros_txt")); - if(group) - { - group->updateCoords(); - - CInterfaceGroup * groupScroll = dynamic_cast(createAccountUI->findFromShortId("err_back_scrollbar")); - if(groupScroll) groupScroll->setActive(group->getHReal() > group->getMaxHReal()); - CCtrlScroll * scroll = dynamic_cast(createAccountUI->findFromShortId("err_scroll_bar")); - if(scroll) - scroll->setTrackPos(scroll->getHReal()); - } - } - } - } - } -}; -REGISTER_ACTION_HANDLER (CAHOnCreateAccountSubmit, "on_create_account_submit"); - -// *************************************************************************** -// Called when the user cancel the account creation -class CAHOnCreateAccountClose : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) - { - nlinfo("CAHOnCreateAccountClose called"); - - LoginSM.pushEvent(CLoginStateMachine::ev_close_create_account); - } -}; -REGISTER_ACTION_HANDLER (CAHOnCreateAccountClose, "on_create_account_close"); - -// *************************************************************************** -class CAHCreateAccountLogin : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) - { - nlinfo("CAHCreateAccountLogin called"); - - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - - CInterfaceGroup *createAccountUI = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:login:create_account")); - if(createAccountUI) - { - CGroupEditBox * eb = dynamic_cast(createAccountUI->findFromShortId("eb_login:eb")); - if(eb) - LoginLogin = eb->getInputString().toUtf8(); - - eb = dynamic_cast(createAccountUI->findFromShortId("eb_password:eb")); - if(eb) - LoginPassword = eb->getInputString().toUtf8(); - - onlogin(false); - } - } -}; -REGISTER_ACTION_HANDLER (CAHCreateAccountLogin, "create_account_login"); - -// *************************************************************************** -// Called by html embeded lua script -class CAHOnConnectToShard: public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const string &Params) - { - // warning : pCaller is null when event come from lua scrip embeded in HTML - Cookie = getParam(Params, "cookie"); - FSAddr = getParam(Params, "fsAddr"); - - // replace the '_' with '|' in the cookie string - for (uint i=0; igetDbProp("UI:VARIABLES:SCREEN")->setValue32(UI_VARIABLES_SCREEN_CHECKPASS); - } -}; -REGISTER_ACTION_HANDLER (CAHOnBackToLogin, "on_back_to_login"); - -// *************************************************************************** -// *************************************************************************** -// *************************************************************************** -// NETWORK CONNECTION -// *************************************************************************** -// *************************************************************************** -// *************************************************************************** - - -// *************************************************************************** -string checkLogin(const string &login, const string &password, const string &clientApp, const std::string &customParameters) -{ - CPatchManager *pPM = CPatchManager::getInstance(); - Shards.clear(); - - if(ClientCfg.ConfigFile.exists("VerboseLog")) - pPM->setVerboseLog(ClientCfg.ConfigFile.getVar("VerboseLog").asInt() == 1); - if(pPM->isVerboseLog()) nlinfo("Using verbose log mode"); - - if(!HttpClient.connectToLogin()) - return "Can't connect (error code 1)"; - - if(pPM->isVerboseLog()) nlinfo("Connected"); - - string res; - - std::string url = ClientCfg.ConfigFile.getVar("StartupHost").asString() + ClientCfg.ConfigFile.getVar("StartupPage").asString(); - - // don't use login with alt method - if (!login.empty()) - { - // ask server for salt - if(!HttpClient.sendGet(url + "?cmd=ask&cp=2&login=" + login + "&lg=" + ClientCfg.LanguageCode, "", pPM->isVerboseLog())) - return "Can't send (error code 60)"; - - if(pPM->isVerboseLog()) nlinfo("Sent request for password salt"); - - if(!HttpClient.receive(res, pPM->isVerboseLog())) - return "Can't receive (error code 61)"; - - if(pPM->isVerboseLog()) nlinfo("Received request login check"); - - if(res.empty()) - return "Empty answer from server (error code 62)"; - - size_t first = res.find("\n\n"); - if (first == std::string::npos) - { - first = res.find("\r\r"); - if (first == std::string::npos) - { - first = res.find("\r\n\r\n"); - if (first != std::string::npos) - { - res = res.substr(first + 4); - } - } - else - { - res = res.substr(first + 2); - } - } - else - { - res = res.substr(first + 2); - } - - nldebug("res1: %s", res.c_str()); - - if (res[0] == 'H') - { - nlwarning("missing response body: %s", res.c_str()); - return "missing response body (error code 64)"; - } - else if(res[0] == '0') - { - // server returns an error - nlwarning("server error: %s", res.substr(2).c_str()); - return res.substr(2); - } - else if(res[0] == '1') - { - Salt = res.substr(2); - } - else - { - // server returns ??? - nlwarning("%s", res.c_str()); - return res; - } - - // send login + crypted password + client app and cp=2 (as crypted password) - if(!HttpClient.connectToLogin()) - return "Can't connect (error code 63)"; - - if(pPM->isVerboseLog()) nlinfo("Connected"); - } - - if (ClientCfg.R2Mode) - { - // R2 login sequence - - if (!login.empty()) - { - std::string cryptedPassword = CCrypt::crypt(password, Salt); - - if(!HttpClient.sendGet(url + "?cmd=login&login=" + login + "&password=" + cryptedPassword + "&clientApplication=" + clientApp + "&cp=2" + "&lg=" + ClientCfg.LanguageCode + customParameters)) - return "Can't send (error code 2)"; - } - else - { - // don't send login and password if empty - if(!HttpClient.sendGet(url + "?cmd=login&clientApplication=" + clientApp + "&cp=2" + "&lg=" + ClientCfg.LanguageCode + customParameters)) - return "Can't send (error code 2)"; - } - - // the response should contains the result code and the cookie value - if(pPM->isVerboseLog()) nlinfo("Sent request login check"); - - if(!HttpClient.receive(res, pPM->isVerboseLog())) - return "Can't receive (error code 3)"; - - if(pPM->isVerboseLog()) nlinfo("Received request login check"); - - if(res.empty()) - return "Empty answer from server (error code 4)"; - - size_t first = res.find("\n\n"); - if (first == std::string::npos) - { - first = res.find("\r\r"); - if (first == std::string::npos) - { - first = res.find("\r\n\r\n"); - if (first != std::string::npos) - { - res = res.substr(first + 4); - } - } - else - { - res = res.substr(first + 2); - } - } - else - { - res = res.substr(first + 2); - } - - nldebug("res2: %s", res.c_str()); - - if (res[0] == 'H') - { - nlwarning("missing response body: %s", res.c_str()); - return "missing response body (error code 65)"; - } - else if(res[0] == '0') - { - // server returns an error - nlwarning("server error: %s", res.substr(2).c_str()); - return res.substr(2); - } - else if(res[0] == '1') - { - //nlwarning(res.c_str()); - vector lines; - explode(res, std::string("\n"), lines, false); - if (lines.size() != 2) - { - return toString("Invalid server return, found %u lines, want 2", lines.size()); - } - - vector parts; - explode(lines[0], std::string("#"), parts, false); - if (parts.size() < 5) - return "Invalid server return, missing cookie and/or Ring URLs"; - - // server returns ok, we have the cookie - - // store the cookie value and FS address for next page request - CurrentCookie = parts[1]; - Cookie = CurrentCookie; - FSAddr = parts[2]; - - // store the ring startup page - RingMainURL = parts[3]; - FarTP.setURLBase(parts[4]); - - if(parts.size() >= 6 && parts[5] == "1") - { - // we want stats - extern bool startStat; - startStat = true; - } - - // parse the second line (contains the domain info) - parts.clear(); - explode(lines[1], std::string("#"), parts, false); - if (parts.size() < 3) - return "Invalid server return, missing patch URLs"; - - R2ServerVersion = parts[0].c_str(); - R2BackupPatchURL = parts[1]; - explode(parts[2], std::string(" "), R2PatchURLs, true); - } - else - { - // unexpected content -#if !FINAL_VERSION - string ret = toString("DEV : Invalid server return, missing return code in \n%s", res.c_str()); - return ret; -#else - return "Invalid server return, missing return code"; -#endif - } - - } - else - { - // standard ryzom login sequence - std::string cryptedPassword = CCrypt::crypt(password, Salt); - - if(!HttpClient.sendGet(url + "?login=" + login + "&password=" + cryptedPassword + "&clientApplication=" + clientApp + "&cp=2")) - return "Can't send (error code 2)"; - /* - if(!send(ClientCfg.ConfigFile.getVar("StartupPage").asString()+"?login="+login+"&password="+password+"&clientApplication="+clientApp)) - return "Can't send (error code 2)"; - */ - if(pPM->isVerboseLog()) nlinfo("Sent request login check"); - - if(!HttpClient.receive(res, pPM->isVerboseLog())) - return "Can't receive (error code 3)"; - - if(pPM->isVerboseLog()) nlinfo("Received request login check"); - - if(res.empty()) - return "Empty answer from server (error code 4)"; - - size_t first = res.find("\n\n"); - if (first == std::string::npos) - { - first = res.find("\r\r"); - if (first == std::string::npos) - { - first = res.find("\r\n\r\n"); - if (first != std::string::npos) - { - res = res.substr(first + 4); - } - } - else - { - res = res.substr(first + 2); - } - } - else - { - res = res.substr(first + 2); - } - - nldebug("res2: %s", res.c_str()); - - if (res[0] == 'H') - { - nlwarning("missing response body: %s", res.c_str()); - return "missing response body (error code 66)"; - } - else if(res[0] == '0') - { - // server returns an error - nlwarning("server error: %s", res.substr(2).c_str()); - return res.substr(2); - } - else if(res[0] == '1') - { - // server returns ok, we have the list of shard - uint nbs; - fromString(res.substr(2), nbs); - vector lines; - - explode(res, std::string("\n"), lines, true); - - if(pPM->isVerboseLog()) - { - nlinfo ("Exploded, with nl, %u res", (uint)lines.size()); - /* for (uint i = 0; i < lines.size(); i++) - { - nlinfo (" > '%s'", lines[i].c_str()); - }*/ - } - - if(lines.size() != nbs+1) - { - nlwarning("bad shard lines number %u != %d", (uint)lines.size(), nbs+1); - nlwarning("'%s'", res.c_str()); - return "bad lines numbers (error code 5)"; - } - - for(uint i = 1; i < lines.size(); i++) - { - vector res; - explode(lines[i], std::string("|"), res); - - if(pPM->isVerboseLog()) - { - nlinfo ("Exploded with '%s', %u res", "|", (uint)res.size()); - /* for (uint i = 0; i < res.size(); i++) - { - nlinfo (" > '%s'", res[i].c_str()); - }*/ - } - - if (res.size() < 7 && res.size() > 8) - { - nlwarning("bad | numbers %u != %d", (uint)res.size(), 8); - nlwarning("'%s'", lines[i].c_str()); - return "bad pipe numbers (error code 6)"; - } - bool online; - fromString(res[1], online); - uint32 shardId; - fromString(res[2], shardId); - uint32 nbPlayers; - fromString(res[4], nbPlayers); - Shards.push_back(CShard(res[0], online, shardId, res[3], nbPlayers, res[5], res[6])); - nlinfo("Shard %u, addr = %s, id = %u, name = %s, PatchURIs = %s", i, res[5].c_str(), shardId, res[3].c_str(), res[6].c_str()); - if (res.size() == 8) - { - explode(res[7], std::string(" "), Shards.back().PatchURIs); - } - } - } - else - { - // server returns ??? - nlwarning("%s", res.c_str()); - return res; - } - } - - return ""; -} - -// *************************************************************************** -string selectShard(uint32 shardId, string &cookie, string &addr) -{ - cookie.clear(); - addr.clear(); - - if(!HttpClient.connectToLogin()) return "Can't connect (error code 7)"; - - if(LoginLogin.empty()) return "Empty Login (error code 8)"; - if(LoginPassword.empty()) return "Empty Password (error code 9)"; - if(ClientApp.empty()) return "Empty Client Application (error code 10)"; - - // send login + crypted password + client app and cp=2 (as crypted password) - std::string cryptedPassword = CCrypt::crypt(LoginPassword, Salt); - - std::string url = ClientCfg.ConfigFile.getVar("StartupHost").asString() + ClientCfg.ConfigFile.getVar("StartupPage").asString(); - - if(!HttpClient.sendGet(url + "?cmd=login&shardid=" + toString(shardId) + "&login=" + LoginLogin + "&password=" + cryptedPassword + "&clientApplication=" + ClientApp + "&cp=2")) - return "Can't send (error code 11)"; - - string res; - - CPatchManager *pPM = CPatchManager::getInstance(); - if(!HttpClient.receive(res, pPM->isVerboseLog())) - return "Can't receive (error code 12)"; - - if(res.empty()) - return "Empty result (error code 13)"; - - size_t first = res.find("\n\n"); - if (first == std::string::npos) - { - first = res.find("\r\r"); - if (first == std::string::npos) - { - first = res.find("\r\n\r\n"); - if (first != std::string::npos) - { - res = res.substr(first + 4); - } - } - else - { - res = res.substr(first + 2); - } - } - else - { - res = res.substr(first + 2); - } - - nldebug("res2: %s", res.c_str()); - - if (res[0] == 'H') - { - nlwarning("missing response body: %s", res.c_str()); - return "missing response body (error code 66)"; - } - else if(res[0] == '0') - { - // server returns an error - nlwarning("server error: %s", res.substr(2).c_str()); - return res.substr(2); - } - else if(res[0] == '1') - { - // server returns ok, we have the access - - vector line; - explode(res, std::string(" "), line, true); - - if (line.size() < 2 || line.size() > 3) - { - nlwarning("bad launch lines number %d != %d", line.size(), 2); - return "bad launch line number (error code 14)"; - } - - cookie = line[0].substr(2); - addr = line[1]; - - std::vector patchURIs; - - CShard* shard = NULL; - uint i; - for (i=0; i= 3) - { - explode(line[2], "|", shard->PatchURIs, true); - - nlinfo("received %d main patch server URIs:", shard->PatchURIs.size()); - uint i; - for (i=0; iPatchURIs.size(); ++i) - nlinfo("%d: '%s'", i, shard->PatchURIs[i].c_str()); - } -*/ - } - else - { - // server returns ??? - nlwarning("%s", res.c_str()); - return res; - } - - return ""; -} - - -/*void mainLandPatch() -{ - if (!AvailablePatchs) return; - nlassert(AvailablePatchs & (1 << BGDownloader::DownloadID_MainLand)); // only handled case for now - // no-op - BGDownloaderWantedPatch = BGDownloader::DownloadID_MainLand; - CInterfaceManager *im = CInterfaceManager::getInstance(); - im->initLogin(); - // login machine should be in the 'end' state !! - nlassert(LoginSM.getCurrentState() == CLoginStateMachine::st_end); - LoginSM.pushEvent(CLoginStateMachine::ev_mainland_patch); - loginMainLoop(); // patch is handled in the login mainloop - // there should have been a reboot there, so quit if something went wrong... - release(); - exit(0); -} -*/ - - - -// *************************************************************************** -// *************************************************************************** -// INTRO HANDLING -// *************************************************************************** -// *************************************************************************** - -#include "init_main_loop.h" - -bool loginIntroSkip; - -void loginIntro() -{ - // Display of nevrax logo is done at init time (see init.cpp) just before addSearchPath (second one) - for (uint i = 0; i < 1; i++) // previously display nevrax then nvidia - { - if (i != 0) - { - beginLoading(IntroNVidia); - ucstring nmsg(""); - ProgressBar.newMessage (nmsg); - } - - Driver->AsyncListener.reset(); - updateClientTime(); - CInputHandlerManager::getInstance()->pumpEventsNoIM(); - updateClientTime(); - - loginIntroSkip = false; - - sint64 CurTime = T0; - - while (loginIntroSkip == false) - { - updateClientTime(); - if ((T0 - CurTime) > 5000) // 5s before quiting - break; - // Update messages - CInputHandlerManager::getInstance()->pumpEventsNoIM(); - - // Exit ? - if (Driver->AsyncListener.isKeyPushed (KeyESCAPE) || Driver->AsyncListener.isKeyPushed (KeyRETURN) || - Driver->AsyncListener.isKeyPushed (KeySPACE)) - break; - - const ucstring nmsg(""); - ProgressBar.newMessage (nmsg); - IngameDbMngr.flushObserverCalls(); - NLGUI::CDBManager::getInstance()->flushObserverCalls(); - } - } - beginLoading(StartBackground); - ProgressBar.finish(); -} diff --git a/code/ryzom/client/src/net_manager.cpp b/code/ryzom/client/src/net_manager.cpp deleted file mode 100644 index ada437ec7..000000000 --- a/code/ryzom/client/src/net_manager.cpp +++ /dev/null @@ -1,4414 +0,0 @@ -// Ryzom - MMORPG Framework -// Copyright (C) 2010-2019 Winch Gate Property Limited -// -// This source file has been modified by the following contributors: -// Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2014-2019 Jan BOON (Kaetemi) -// -// 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 // -///////////// -#include "stdpch.h" -// Game Share -#include "game_share/generic_xml_msg_mngr.h" -#include "game_share/msg_client_server.h" -#include "game_share/bot_chat_types.h" -#include "game_share/mode_and_behaviour.h" -#include "game_share/chat_group.h" -#include "game_share/character_summary.h" -#include "game_share/sphrase_com.h" -#include "game_share/outpost.h" -#include "game_share/msg_client_server.h" -#include "game_share/ryzom_database_banks.h" -#include "game_share/msg_encyclopedia.h" -#include "game_share/prerequisit_infos.h" -#include "game_share/permanent_ban_magic_number.h" -#include "game_share/item_special_effect.h" -#include "game_share/combat_flying_text.h" -#include "game_share/shard_names.h" -// Client. -#include "nel/gui/group_list.h" -#include "interface_v3/interface_manager.h" -#include "net_manager.h" -#include "client_cfg.h" -#include "entities.h" -#include "client_chat_manager.h" -#include "world_database_manager.h" -#include "continent_manager.h" -#include "motion/user_controls.h" -#include "interface_v3/bot_chat_manager.h" -#include "interface_v3/bot_chat_page_all.h" -#include "interface_v3/bot_chat_page_trade.h" -#include "interface_v3/bot_chat_page_create_guild.h" -#include "interface_v3/obs_huge_list.h" -#include "string_manager_client.h" -#include "interface_v3/people_interraction.h" -#include "interface_v3/bot_chat_manager.h" -#include "interface_v3/bot_chat_page_all.h" -#include "nel/gui/view_text_id.h" -#include "nel/gui/ctrl_text_button.h" -#include "interface_v3/input_handler_manager.h" -#include "interface_v3/guild_manager.h" -#include "interface_v3/skill_manager.h" -#include "misc.h" -#include "interface_v3/inventory_manager.h" -#include "interface_v3/sphrase_manager.h" -#include "outpost_manager.h" -#include "interface_v3/encyclopedia_manager.h" -#include "user_entity.h" -#include "init_main_loop.h" -#include "interface_v3/group_map.h" -#include "sound_manager.h" -#include "interface_v3/group_compas.h" -#include "interface_v3/group_html_webig.h" -#include "interface_v3/bar_manager.h" -#include "permanent_ban.h" -#include "global.h" -#include "connection.h" -#include "faction_war_manager.h" -#include "far_tp.h" -#include "input.h" -#include "r2/editor.h" -#include "game_share/r2_share_itf.h" -#include "game_share/r2_types.h" -#include "npc_icon.h" -#include "interface_v3/action_handler_base.h" - -// Std. -#include - -#ifdef DEBUG_NEW -#define new DEBUG_NEW -#endif - -#define OLD_STRING_SYSTEM -#define BAR_STEP_TP 2 - -/////////// -// USING // -/////////// -using namespace NLMISC; -using namespace NL3D; -using namespace std; - - -extern bool FirstFrame; -extern void selectTipsOfTheDay (uint tips); - - -//////////// -// GLOBAL // -//////////// -CGenericXmlMsgHeaderManager GenericMsgHeaderMngr; // Manage messages -#ifdef CLIENT_MULTI -CNetManagerMulti NetMngr; // Manage the connection. -#else -CNetManager NetMngr; // Manage the connection. -#endif - -bool UseFemaleTitles = false; - -bool serverReceivedReady = false; - -static const std::string PLAYER_EXCHANGE_INVITATION_DIALOG = "ui:interface:accept_trade_invitation"; - -// Hierarchical timer -H_AUTO_DECL ( RZ_Client_Net_Mngr_Update ) - -//////////// -// EXTERN // -//////////// -extern bool noUserChar; // \todo GUIGUI : do this better. -extern bool userChar; // \todo GUIGUI : do this better. -extern std::vector CharacterSummaries; -extern uint8 ServerPeopleActive; -extern uint8 ServerCareerActive; -extern vector Mainlands; -extern bool UserCharPosReceived; -extern CGenericXmlMsgHeaderManager GenericMsgHeaderMngr; -extern CClientChatManager ChatMngr; - -extern bool CharNameValidArrived; -extern bool CharNameValid; -bool IsInRingSession = false; -TSessionId HighestMainlandSessionId; // highest in the position stack -ucstring lastUniversMessage; - -extern const char *CDBBankNames[INVALID_CDB_BANK+1]; - -void cbImpulsionGatewayOpen(NLMISC::CBitMemStream &bms); -void cbImpulsionGatewayMessage(NLMISC::CBitMemStream &bms); -void cbImpulsionGatewayClose(NLMISC::CBitMemStream &bms); - - - -/////////////// -// FUNCTIONS // -/////////////// - -void impulseDatabaseInitPlayer(NLMISC::CBitMemStream &impulse) -{ - try - { - sint32 p = impulse.getPos(); - - // get the egs tick of this change - TGameCycle serverTick; - impulse.serial(serverTick); - - // read delta - IngameDbMngr.readDelta( serverTick, impulse, CDBPlayer ); - IngameDbMngr.setInitPacketReceived(); - nlinfo( "DB_INIT:PLR done (%u bytes)", impulse.getPos()-p ); - } - catch (const Exception &e) - { - BOMB( NLMISC::toString( "Problem while decoding a DB_INIT:PLR msg, skipped: %s", e.what() ), return ); - } -} - -void impulseDatabaseUpdatePlayer(NLMISC::CBitMemStream &impulse) -{ - try - { - // get the egs tick of this change - TGameCycle serverTick; - impulse.serial(serverTick); - - // read delta - IngameDbMngr.readDelta( serverTick, impulse, CDBPlayer ); // unlike on the server, here there is only one unified CCDBSynchronized object - } - catch (const Exception &e) - { - - BOMB( NLMISC::toString( "Problem while decoding a DB_UPDATE_PLR msg, skipped: %s", e.what() ), return ); - } -} - -template -void updateInventoryFromStream(NLMISC::CBitMemStream &impulse, const CInventoryCategoryTemplate *templ, bool notifyItemSheetChanges); - -void impulseDatabaseUpdateBank(NLMISC::CBitMemStream &impulse) -{ - uint32 bank = INVALID_CDB_BANK; - try - { - // get the egs tick of this change - TGameCycle serverTick; - impulse.serial(serverTick); - - // decode bank - uint nbits; - FILL_nbits_WITH_NB_BITS_FOR_CDBBANK - impulse.serial( bank, nbits ); - - // read delta - IngameDbMngr.readDelta( serverTick, impulse, (TCDBBank)bank ); - - // read guild inventory update - if ( bank == CDBGuild ) - { - updateInventoryFromStream( impulse, (INVENTORIES::CInventoryCategoryForGuild*)NULL, false ); - } - } - catch (const Exception &e) - { - BOMB( NLMISC::toString( "Problem while decoding a DB_GROUP:UPDATE_BANK %s msg, skipped: %s", CDBBankNames[bank], e.what() ), return ); - } -} - -void impulseDatabaseInitBank(NLMISC::CBitMemStream &impulse) -{ - uint32 bank = INVALID_CDB_BANK; - try - { - // get the egs tick of this change - TGameCycle serverTick; - impulse.serial(serverTick); - - // decode bank - uint nbits; - FILL_nbits_WITH_NB_BITS_FOR_CDBBANK - impulse.serial( bank, nbits ); - - // read delta - IngameDbMngr.readDelta( serverTick, impulse, (TCDBBank)bank ); - nldebug( "CDB: DB_GROUP:INIT_BANK %s", CDBBankNames[bank] ); - - // read guild inventory update - if ( bank == CDBGuild ) - { - updateInventoryFromStream( impulse, (INVENTORIES::CInventoryCategoryForGuild*)NULL, false ); - } - } - catch (const Exception &e) - { - BOMB( NLMISC::toString( "Problem while decoding a DB_GROUP:INIT_BANK %s msg, skipped: %s", CDBBankNames[bank], e.what() ), return ); - } -} - -void impulseDatabaseResetBank(NLMISC::CBitMemStream &impulse) -{ - uint32 bank = INVALID_CDB_BANK; - try - { - // get the egs tick of this change - TGameCycle serverTick; - impulse.serial(serverTick); - - // read the bank to reset - uint nbits; - FILL_nbits_WITH_NB_BITS_FOR_CDBBANK - impulse.serial( bank, nbits ); - - // reset the bank - IngameDbMngr.resetBank( serverTick, bank ); - nldebug( "CDB: DB_GROUP:RESET_BANK %s", CDBBankNames[bank] ); - } - catch (const Exception &e) - { - BOMB( NLMISC::toString( "Problem while decoding a DB_GROUP:RESET_BANK %s msg, skipped: %s", CDBBankNames[bank], e.what() ), return ); - } -} - -static void readPrivileges(NLMISC::CBitMemStream &impulse) -{ - nlassert(impulse.isReading()); - // nico : temporarily uses a try block here to avoid prb with people having updated client and not the server - try - { - impulse.serial(UserPrivileges); - } - catch(const EStreamOverflow &) - { - nlwarning("User privileges not serialised, assuming none"); - UserPrivileges.clear(); - } -} - -void impulseNoUserChar(NLMISC::CBitMemStream &impulse) -{ - // received NO_USER_CHAR - //nlinfo("impulseCallBack : Received CONNECTION:NO_USER_CHAR"); - - impulse.serial(ServerPeopleActive); - impulse.serial(ServerCareerActive); - readPrivileges(impulse); - impulse.serialCont(Mainlands); - CharacterSummaries.clear(); - noUserChar = true; - - LoginSM.pushEvent(CLoginStateMachine::ev_no_user_char); - - updatePatcherPriorityBasedOnCharacters(); -} - -void impulseFarTP(NLMISC::CBitMemStream &impulse) -{ - // received FAR_TP - TSessionId sessionId; - impulse.serial(sessionId); - //nlinfo("impulseCallback : Received CONNECTION:FAR_TP %u", sessionId.asInt()); - bool bailOutIfSessionVanished; - impulse.serial(bailOutIfSessionVanished); - FarTP.requestFarTPToSession(sessionId, PlayerSelectedSlot, CFarTP::JoinSession, bailOutIfSessionVanished); -} - - -static std::string lookupSrcKeyFile(const std::string &src) -{ - if (CFile::isExists("save/" + src)) return "save/" + src; - return CPath::lookup(src, false); -} - -void copyKeySet(const std::string &srcPath, const std::string &destPath) -{ - // can't use CFile copyFile here, because src may be in a bnp file - std::string srcStr; - srcStr.resize(CFile::getFileSize(srcPath)); - if (srcStr.empty()) - { - nlwarning("Can't copy keys from %s : file not found or empty"); - return; - } - try - { - CIFile ifile(srcPath); - ifile.serialBuffer((uint8 *) &srcStr[0], (uint)srcStr.size()); - COFile ofile(destPath); - ofile.serialBuffer((uint8 *) &srcStr[0], (uint)srcStr.size()); - } - catch(const EStream &) - { - nlwarning("Couldn't copy %s to %s to create new character keyset", srcPath.c_str(), destPath.c_str()); - } -} - -void impulseUserChars(NLMISC::CBitMemStream &impulse) -{ - // received USER_CHARS - //nlinfo("impulseCallBack : Received CONNECTION:USER_CHARS"); - - impulse.serial(ServerPeopleActive); - impulse.serial(ServerCareerActive); - // read characters summary - CharacterSummaries.clear(); - impulse.serialCont (CharacterSummaries); - // read shard name summaries - std::vector shardNames; - impulse.serialCont (shardNames); - CShardNames::getInstance().loadShardNames(shardNames); - // read privileges - readPrivileges(impulse); - impulse.serial(FreeTrial); - FreeTrial = false; - impulse.serialCont(Mainlands); - userChar = true; - - LoginSM.pushEvent(CLoginStateMachine::ev_chars_received); - - // Create the message for the server to select the first character. -/* CBitMemStream out; - if(GenericMsgHeaderMngr.pushNameToStream("CONNECTION:SELECT_CHAR", out)) - { - CSelectCharMsg SelectCharMsg; - SelectCharMsg.c = 0; //TODO set here the character choosen by player - out.serial( SelectCharMsg ); - NetMngr.push(out); - NetMngr.send(NetMngr.getCurrentServerTick()); - // send CONNECTION:USER_CHARS - nldebug("impulseCallBack : CONNECTION:SELECT_CHAR sent"); - } - else - nlwarning("impulseCallBack : unknown message name : 'CONNECTION:SELECT_CHAR'."); - - noUserChar = true; - */ - - if (!NewKeysCharNameValidated.empty()) - { - // if there's a new char for which a key set was wanted, create it now - for (uint k = 0; k < CharacterSummaries.size(); ++k) - { - if (toLower(CharacterSummaries[k].Name) == toLower(NewKeysCharNameValidated)) - { - // first, stripes server name - copyKeySet(lookupSrcKeyFile(GameKeySet), "save/keys_" + buildPlayerNameForSaveFile(NewKeysCharNameValidated) + ".xml"); - copyKeySet(lookupSrcKeyFile(RingEditorKeySet), "save/keys_r2ed_" + buildPlayerNameForSaveFile(NewKeysCharNameValidated) + ".xml"); - break; - } - } - } - updatePatcherPriorityBasedOnCharacters(); -} - -void impulseUserChar(NLMISC::CBitMemStream &impulse) -{ - // received USER_CHAR - //nlinfo("impulseCallBack : Received CONNECTION:USER_CHAR"); - - // Serialize the message - COfflineEntityState posState; - extern uint8 ServerSeasonValue; - extern bool ServerSeasonReceived; - uint32 userRole; - CUserCharMsg::read( impulse, posState, ServerSeasonValue, userRole, IsInRingSession, HighestMainlandSessionId, CharFirstConnectedTime, CharPlayedTime ); - ServerSeasonReceived = true; // set the season that will be used when selecting the continent from the position - - if (UserEntity) - { - UserEntity->pos(CVectorD((float)posState.X/1000.0f, (float)posState.Y/1000.0f, (float)posState.Z/1000.0f)); - UserEntity->front(CVector((float)cos(posState.Heading), (float)sin(posState.Heading), 0.f)); - UserEntity->dir(UserEntity->front()); - UserEntity->setHeadPitch(0); - UserControls.resetCameraDeltaYaw(); - //nldebug(" pos : %f %f %f heading : %f",UserEntity->pos().x,UserEntity->pos().y,UserEntity->pos().z,posState.Heading); - - // Update the position for the vision. - NetMngr.setReferencePosition(UserEntity->pos()); - } - else - { - UserEntityInitPos = CVectorD((float)posState.X/1000.0f, (float)posState.Y/1000.0f, (float)posState.Z/1000.0f); - UserEntityInitFront = CVector((float)cos(posState.Heading), (float)sin(posState.Heading), 0.f); - //nldebug(" pos : %f %f %f heading : %f",UserEntityInitPos.x,UserEntityInitPos.y,UserEntityInitPos.z,posState.Heading); - - // Update the position for the vision. - NetMngr.setReferencePosition(UserEntityInitPos); - } - - UserCharPosReceived = true; - - // Configure the ring editor - extern R2::TUserRole UserRoleInSession; - UserRoleInSession = R2::TUserRole::TValues(userRole); - ClientCfg.R2EDEnabled = IsInRingSession /*&& (UserRoleInSession.getValue() != R2::TUserRole::ur_player)*/; - // !!!Do NOT uncomment the following line do the ClientCfg.R2EDEnabled = IsInRingSession && (UserRoleInSession != R2::TUserRole::ur_player); - // even with UserRoleInSession R2::TUserRole::ur_player the ring features must be activated - // because if the ring is not activated the dss do not know the existence of the player - // So we can not kick him, tp to him, tp in to next act .... - nldebug( "EnableR2Ed = %u, IsInRingSession = %u, UserRoleInSession = %u", (uint)ClientCfg.R2EDEnabled, (uint)IsInRingSession, userRole ); - - updatePatcherPriorityBasedOnCharacters(); -} - -void impulseCharNameValid(NLMISC::CBitMemStream &impulse) -{ - //nlinfo("impulseCallBack : Received CONNECTION:VALID_NAME"); - uint8 nTmp; - impulse.serial(nTmp); - CharNameValid = ((nTmp != 0) ? true : false); - CharNameValidArrived = true; - if (CharNameValid) NewKeysCharNameValidated = NewKeysCharNameWanted; -} - - -void checkHandshake( NLMISC::CBitMemStream &impulse ) -{ - // Decode handshake to check versions - uint16 handshakeVersion; - uint16 itemSlotVersion; - impulse.serial( handshakeVersion ); - if ( handshakeVersion > 0 ) - nlerror( "Server handshake version is more recent than client one" ); - impulse.serial( itemSlotVersion ); - if ( itemSlotVersion != INVENTORIES::CItemSlot::getVersion() ) - nlerror( "Handshake: itemSlotVersion mismatch (S:%hu C:%hu)", itemSlotVersion, INVENTORIES::CItemSlot::getVersion() ); -} - - -void impulseServerReady(NLMISC::CBitMemStream &impulse) -{ - // received CONNECTION:READY - //nlinfo("impulseCallBack : Received CONNECTION:READY"); - - serverReceivedReady = true; - - checkHandshake( impulse ); - - LoginSM.pushEvent(CLoginStateMachine::ev_ready_received); -} - -void impulseShardId(NLMISC::CBitMemStream &impulse) -{ - // received SHARD_ID - - uint32 shardId; - impulse.serial(shardId); - ShardId = shardId; - - string webHost; - impulse.serial(webHost); - if (!webHost.empty()) - { - WebServer = webHost; - } - - nlinfo("WEB: Received SHARD_ID %d, web hosted at '%s', using '%s'", shardId, webHost.c_str(), WebServer.c_str()); -} - -void impulseServerQuitOk(NLMISC::CBitMemStream &impulse) -{ - // receive CONNECTION:SERVER_QUIT_OK - if (FarTP.isFarTPInProgress()) - { - FarTP.onServerQuitOk(); - } - else - { - // ensure first a quit request is really asked - if(game_exit_request) - { - // quit! - game_exit= true; - ryzom_exit= true; - } - } -} - -void impulseServerQuitAbort(NLMISC::CBitMemStream &impulse) -{ - // receive CONNECTION:SERVER_QUIT_ABORT - if (FarTP.isFarTPInProgress()) - { - FarTP.onServerQuitAbort(); - } - else - { - // abort any quit request - game_exit_request= false; - ryzom_exit_request= false; - } -} - -void impulseMailNotification(NLMISC::CBitMemStream &impulse) -{ - if (PermanentlyBanned) return; - // receive CONNECTION:MAIL_AVAILABLE - CInterfaceManager::getInstance()->notifyMailAvailable(); -} - -void impulseForumNotification(NLMISC::CBitMemStream &impulse) -{ - if (PermanentlyBanned) return; - // receive CONNECTION:GUILD_MESSAGE_AVAILABLE - CInterfaceManager::getInstance()->notifyForumUpdated(); - -} - -void impulsePermanentBan(NLMISC::CBitMemStream &impulse) -{ - uint64 magicNumber; - impulse.serial(magicNumber); - if (magicNumber != PermanentBanMSGMagicNumber) return; // bad msg - setPermanentBanMarkers(true); - applyPermanentBanPunishment(); - PermanentlyBanned = true; -} - -void impulsePermanentUnban(NLMISC::CBitMemStream &impulse) -{ - uint64 magicNumber; - impulse.serial(magicNumber); - if (magicNumber != PermanentUnbanMSGMagicNumber) return; // bad msg - setPermanentBanMarkers(false); - PermanentlyBanned = false; - if (UserEntity) - { - // allows to walk / run again - UserEntity->walkVelocity(ClientCfg.Walk); - UserEntity->runVelocity(ClientCfg.Run); - } -} - - -// *************************************************************************** -class CInterfaceChatDisplayer : public CClientChatManager::IChatDisplayer -{ -public: - virtual void displayChat(TDataSetIndex compressedSenderIndex, const ucstring &ucstr, const ucstring &rawMessage, CChatGroup::TGroupType mode, NLMISC::CEntityId dynChatId, ucstring &senderName, uint bubbleTimer=0); - virtual void displayTell(/*TDataSetIndex senderIndex, */const ucstring &ucstr, const ucstring &senderName); - virtual void clearChannel(CChatGroup::TGroupType mode, uint32 dynChatDbIndex); - -private: - // Add colorization tag for sender name - void colorizeSender(ucstring &text, const ucstring &senderName, CRGBA baseColor); - -}; -static CInterfaceChatDisplayer InterfaceChatDisplayer; - -void CInterfaceChatDisplayer::colorizeSender(ucstring &text, const ucstring &senderName, CRGBA baseColor) -{ - // find the sender/text separator to put color tags - ucstring::size_type pos = senderName.length() - 1; - if (pos != ucstring::npos) - { - ucstring str; - - CInterfaceProperty prop; - prop.readRGBA("UI:SAVE:CHAT:COLORS:SPEAKER"," "); - - CChatWindow::encodeColorTag(prop.getRGBA(), str, false); - - str += text.substr(0, pos+1); - - CChatWindow::encodeColorTag(baseColor, str, true); - - str += text.substr(pos+1); - - text.swap(str); - } -} - -// display a chat from network to interface -void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, const ucstring &ucstr, const ucstring &rawMessage, CChatGroup::TGroupType mode, NLMISC::CEntityId dynChatId, ucstring &senderName, uint bubbleTimer) -{ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - ucstring finalString; - string stringCategory = getStringCategory(ucstr, finalString); - - bool bubbleWanted = true; - - // Subtract rawMessage from ucstr so that the 'sender' part remains. - ucstring senderPart = ucstr.luabind_substr(0, ucstr.length() - rawMessage.length()); - - // search a "{no_bubble}" tag - { - ucstring::size_type index = finalString.find(ucstring("{no_bubble}")); - const size_t tokenSize= 11; // length of "{no_bubble}" - if (index != ucstring::npos) - { - bubbleWanted = false; - finalString = finalString.luabind_substr(0, index) + finalString.substr(index+tokenSize,finalString.size()); - } - } - - - // **** get color - CRGBA col; - if (mode != CChatGroup::system) - { - // Remove all {break} - for(;;) - { - ucstring::size_type index = finalString.find(ucstring("{break}")); - if (index == ucstring::npos) break; - finalString = finalString.luabind_substr(0, index) + finalString.luabind_substr(index+7,finalString.size()); - } - - // select DB - sint32 dbIndex = ChatMngr.getDynamicChannelDbIndexFromId(dynChatId); - clamp(dbIndex, (sint32)0 , (sint32)CChatGroup::MaxDynChanPerPlayer); - string entry="UI:SAVE:CHAT:COLORS:"; - switch(mode) - { - case CChatGroup::dyn_chat: entry+="DYN:" + NLMISC::toString(dbIndex); break; - case CChatGroup::say: entry+="SAY"; break; - case CChatGroup::shout: entry+="SHOUT"; break; - case CChatGroup::team: entry+="GROUP"; break; - case CChatGroup::guild: entry+="CLADE"; break; - case CChatGroup::civilization: entry+="CIVILIZATION"; break; - case CChatGroup::territory: entry+="TERRITORY"; break; - case CChatGroup::universe: entry+="UNIVERSE_NEW"; break; - case CChatGroup::region: entry+="REGION"; break; - case CChatGroup::tell: entry+="TELL"; break; - default: nlwarning("unknown group type"); return; - } - - // read DB - CInterfaceProperty prop; - prop.readRGBA(entry.c_str()," "); - col = prop.getRGBA(); - - // Override color if the string contains the color - if (!stringCategory.empty() && stringCategory != "SYS") - { - map::const_iterator it; - it = ClientCfg.SystemInfoParams.find(toLower(stringCategory)); - if (it != ClientCfg.SystemInfoParams.end()) - { - col = it->second.Color; - } - } - } - - if (stringCategory == "emt") - { - bubbleWanted = false; - } - - if (mode != CChatGroup::system) - { - // find the sender/text separator to put color tags - if (senderPart.empty() && stringCategory == "emt") - { - size_t pos = finalString.find(ucstring(": "), 0); - if (pos != ucstring::npos) - { - senderPart = finalString.luabind_substr(0, pos + 2); - } - } - colorizeSender(finalString, senderPart, col); - } - - // play associated fx if any - if( !stringCategory.empty() ) - { - map::const_iterator it; - it = ClientCfg.SystemInfoParams.find( toLower(stringCategory) ); - if( it != ClientCfg.SystemInfoParams.end() ) - { - if( !(*it).second.SysInfoFxName.empty() ) - { - NL3D::UParticleSystemInstance sysInfoFx = FXMngr.instantFX((*it).second.SysInfoFxName); - if( !sysInfoFx.empty() ) - { - sysInfoFx.setClusterSystem( UserEntity->getClusterSystem() ); - sysInfoFx.setPos( UserEntity->pos() ); - } - else - { - nlwarning(" Can't set chat fx %s",(*it).second.SysInfoFxName.c_str()); - } - } - } - } - - // **** redirect to the correct interface output - if( stringCategory != "bbl" ) - { - bool windowVisible; - if (mode == CChatGroup::system) - { - pIM->displaySystemInfo(finalString, stringCategory); - } - else if (mode == CChatGroup::guild) - { - PeopleInterraction.ChatInput.Guild.displayMessage(finalString, col, 2, &windowVisible); - } - else if (mode == CChatGroup::team) - { - PeopleInterraction.ChatInput.Team.displayMessage(finalString, col, 2, &windowVisible); - } - else if (mode == CChatGroup::region) - { - PeopleInterraction.ChatInput.Region.displayMessage(finalString, col, 2, &windowVisible); - } - else if (mode == CChatGroup::universe) - { - if (lastUniversMessage != finalString) - { - PeopleInterraction.ChatInput.Universe.displayMessage(finalString, col, 2, &windowVisible); - lastUniversMessage = finalString; - } - } - else if (mode == CChatGroup::dyn_chat) - { - // retrieve the DBIndex from the dynamic chat id - sint32 dbIndex= ChatMngr.getDynamicChannelDbIndexFromId(dynChatId); - // if found, display, else discarded - if(dbIndex >= 0 && dbIndex < CChatGroup::MaxDynChanPerPlayer) - { - PeopleInterraction.ChatInput.DynamicChat[dbIndex].displayMessage(finalString, col, 2, &windowVisible); - - // Add dynchannel info before text so that the chat log will show the correct string. - CCDBNodeLeaf* node = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:CHAT:SHOW_DYN_CHANNEL_NAME_IN_CHAT_CB", false); - if (pIM->getLogState()) - { - // Add dyn chan number before string - ucstring prefix("[" + NLMISC::toString(dbIndex) + "]"); - // Find position to put the new string - // After timestamp? - size_t pos = finalString.find(ucstring("]")); - size_t colonpos = finalString.find(ucstring(": @{")); - // If no ] found or if found but after the colon (so part of the user chat) - if (pos == ucstring::npos || (colonpos < pos)) - { - // No timestamp, so put it right after the color and add a space - pos = finalString.find(ucstring("}"));; - prefix += " "; - } - finalString = finalString.substr(0, pos + 1) + prefix + finalString.substr(pos + 1); - - if (node && node->getValueBool()) - { - uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(dbIndex); - ucstring title; - STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title); - prefix = title.empty() ? ucstring("") : ucstring(" ") + title; - pos = finalString.find(ucstring("] ")); - finalString = finalString.substr(0, pos) + prefix + finalString.substr(pos); - } - } - } - else - { - nlwarning("Dynamic chat %s not found for message: %s", dynChatId.toString().c_str(), finalString.toString().c_str()); - } - } - else - { - ucstring::size_type index = finalString.find(ucstring("")); - if (index != ucstring::npos) - { - bubbleWanted = false; - finalString = finalString.substr(index+6,finalString.size()); - ucstring::size_type index2 = finalString.find(ucstring(" ")); - ucstring playerName; - if (index2 < (finalString.size()-3)) - { - playerName = finalString.substr(0,index2); - finalString = finalString.substr(index2+1,finalString.size()); - } - if (!senderName.empty()) - { - CEntityCL *senderEntity = EntitiesMngr.getEntityByName (CEntityCL::removeTitleAndShardFromName(senderName), true, true); - if (senderEntity) - { - if (senderEntity->Type != CEntityCL::Player) - { - if (playerName.empty()) - { - senderEntity->removeStateFx(); - senderEntity->setStateFx(finalString.toString()); - nlinfo("empty"); - } - else - { - CEntityCL *destEntity = EntitiesMngr.getEntityByName (CEntityCL::removeTitleAndShardFromName(playerName), false, true); - if (destEntity) - { - destEntity->removeStateFx(); - destEntity->setStateFx(finalString.toString()); - nlinfo("no empty"); - } - } - } - } - } - finalString.clear(); - } - else - { - PeopleInterraction.ChatInput.AroundMe.displayMessage(finalString, col, 2, &windowVisible); - } - } - // if tell, bkup sendername - if (mode == CChatGroup::tell && windowVisible && !senderName.empty()) - { - PeopleInterraction.LastSenderName = CEntityCL::removeTitleAndShardFromName(senderName); - } - } - - // received CHAT - //nldebug(" Received CHAT : %s with category %s",finalString.toString().c_str(),stringCategory.c_str()); - - - // **** Process chat entry for the bubbles - // todo hulud : registering a chat callback would be better than calling this hardcoded action handler - ucstring finalRawMessage; - // remove color qualifier from raw string - getStringCategory(rawMessage, finalRawMessage); - if (bubbleWanted) - { - InSceneBubbleManager.chatOpen(compressedSenderIndex, finalRawMessage, bubbleTimer); - } - - // Log - - string channel; - if (mode == CChatGroup::dyn_chat) - { - sint32 dbIndex = ChatMngr.getDynamicChannelDbIndexFromId(dynChatId); - clamp(dbIndex, (sint32)0 , (sint32)CChatGroup::MaxDynChanPerPlayer); - - channel = "dyn" + toString(dbIndex); - } - else - { - channel = CChatGroup::groupTypeToString(mode); - if (channel.empty()) - { - channel = "#" + toString((uint32)mode); - } - } - if (!stringCategory.empty() && NLMISC::toUpper(stringCategory) != "SYS") - { - channel = channel + "/" + stringCategory; - } - pIM->log (finalString, channel); - -} - - -// display a tell from network to interface -void CInterfaceChatDisplayer::displayTell(/*TDataSetIndex senderIndex, */const ucstring &ucstr, const ucstring &senderName) -{ - - ucstring finalString = ucstr; - - // for now, '&' are removed by server so use another format until a special msg is made - if (strFindReplace(finalString, ucstring(""), ucstring())) - { - CLuaManager::getInstance().executeLuaScript("RingAccessPoint:forceRefresh()"); - } - - - CInterfaceProperty prop; - prop.readRGBA("UI:SAVE:CHAT:COLORS:TELL"," "); - bool windowVisible; - - ucstring goodSenderName = CEntityCL::removeTitleAndShardFromName(senderName); - - // The sender part is up to and including the first ":" after the goodSenderName - ucstring::size_type pos = finalString.find(goodSenderName); - pos = finalString.find(':', pos); - pos = finalString.find(' ', pos); - ucstring senderPart = finalString.substr(0, pos+1); - colorizeSender(finalString, senderPart, prop.getRGBA()); - - PeopleInterraction.ChatInput.Tell.displayTellMessage(/*senderIndex, */finalString, goodSenderName, prop.getRGBA(), 2, &windowVisible); - CInterfaceManager::getInstance()->log(finalString, CChatGroup::groupTypeToString(CChatGroup::tell)); - - // Open the free teller window - CChatGroupWindow *pCGW = PeopleInterraction.getChatGroupWindow(); - if (pCGW != NULL) - pCGW->setActiveFreeTeller(goodSenderName); - - if (windowVisible && !goodSenderName.empty()) - PeopleInterraction.LastSenderName = goodSenderName; -} - -// clear a channel -void CInterfaceChatDisplayer::clearChannel(CChatGroup::TGroupType mode, uint32 dynChatDbIndex) -{ - if (mode == CChatGroup::guild) PeopleInterraction.ChatInput.Guild.clearMessages(); - else if (mode == CChatGroup::team) PeopleInterraction.ChatInput.Team.clearMessages(); - else if (mode == CChatGroup::region) PeopleInterraction.ChatInput.Region.clearMessages(); - else if (mode == CChatGroup::arround) PeopleInterraction.ChatInput.AroundMe.clearMessages(); - else if (mode == CChatGroup::universe) PeopleInterraction.ChatInput.Universe.clearMessages(); - else if (mode == CChatGroup::dyn_chat) - { - // if correct dbIndex, clear - if(dynChatDbIndex code; -// if( huff ) -// { -// impulse.serialCont( code ); -// } -// if (PermanentlyBanned) return; -// #ifdef OLD_STRING_SYSTEM -// ChatMngr.getDynamicDB().add( index, ucstr, code ); -// #else -// nlwarning( "// TRAP // WE MUST NEVER CALL THIS IMPULE ANYMORE : ALL IS HANDLED BY STRING_MANAGER NOW !!!" ); -// #endif -// -// // received ADD_DYN_STR -// nlinfo("impulseCallBack : Received ADD_DYN_STR : adding %s at index %d",ucstr.toString().c_str(),index); -//} -/* -string getInterfaceNameFromId (sint botType, sint interfaceId) -{ - string interfaceName = "ui:interface:bot_chat_"; - - switch (botType) - { - case 0: interfaceName += "figurant_"; break; - case 1: interfaceName += "figurant_presse_"; break; - case 2: interfaceName += "chef_village_"; break; - default: interfaceName += "figurant_"; break; - } - - switch (interfaceId) - { - case BOTCHATTYPE::Intro: interfaceName += "intro"; break; - case BOTCHATTYPE::FriendlyMainPage: interfaceName += "friendly_main"; break; - case BOTCHATTYPE::NeutralMainPage: interfaceName += "neutral_main"; break; - case BOTCHATTYPE::NastyMainPage: interfaceName += "nasty_main"; break; - case BOTCHATTYPE::MoreNewsPage: interfaceName += "more_news"; break; - case BOTCHATTYPE::Done: nlinfo ("end of bot chat"); interfaceName.clear(); break; - } - return interfaceName; -} - -static char *shortNews[] = { - "The wind is sour and brings only bad tidings...", "Kitins have been sighted near the village!", "", - "The tribe of the Black Circle has recently", "increased its activities in our region.", "", - "The Black Circle has made an incursion", "into our territory!", "", - "The Black Circle has been sighted near one", "of our forward posts, deep in dangerous territory.", "", - "The tide has washed up evil news, friend.", "The Black Circle is active in our region.", "", - "Our people suffer from a debilitating shortage.", "We are in sore need of KamiBast.", "", - "The economy is slow and our reserve of", "Live Seed low.", "", - "We are in sore need of Live Seed", "If there is a Goo epidemic, we shall all perish!", "", - "Our master mages have gotten wind of", "the growing Kami discontentment", "", -}; - -static char *longNews[] = { - "These powerful predators haven't come this near", "to the village since their devastating attack", "over 15 seasons ago!", - "They are after more KamiBast", "for their occult practices.", "", - "They have captured", "2 of our fortifications in the bush!", "", - "They have taken over one of our richest sources", "of KamiBast, and are exploiting it", "for their own occult purposes.", - "They now hold an important source", "of Live Seed hostage,", "close to one of our forward posts.", - "We use the magical properties of KamiBast and", "its unusually rich fibers for all our crafts.", "", - "If we don't harvest new Seed soon,", "we will have no way of purchasing goods", "and resources, beyond what we produce ourselves", - "We use the rich Sap of Live Seed to produce", "an antidote that counters the disastrous", "effects of the Goo on all Atysian life forms.", - "The Kamis are shaken by the Black Circle's", "presence. If the Circle continues it's occult", "practices, we will all suffer the Kamic anger.", -}; -*/ -/* -void setFakeNews () -{ - char *table[] = { "figurant", "chef_village", "garde", "commercant" }; - - sint rnd = rand ()%(sizeof(shortNews)/sizeof(shortNews[0])/3); - rnd; - - for (uint i = 0; i < sizeof(table)/sizeof(table[0]); i++) - { - { // set test for the friendly main - string iname; - iname = "ui:interface:bot_chat_"; - iname += table[i]; - iname += "_friendly_main"; - - CInterfaceGroup *inter = CWidgetManager::getInstance()->getWindowFromId(iname); - if (inter == NULL) - { - nlwarning ("cant find interface 's%'", iname.c_str()); - continue; - } - - CViewText *inter2 = (CViewText *)inter->getView("title0"); - nlassert (inter2 != NULL); - inter2->setText(ucstring(shortNews[rnd*3])); - - CViewText *inter3 = (CViewText *)inter->getView("title1"); - nlassert (inter3 != NULL); - inter3->setText(ucstring(shortNews[rnd*3+1])); - - CViewText *inter4 = (CViewText *)inter->getView("title2"); - nlassert (inter4 != NULL); - inter4->setText(ucstring(shortNews[rnd*3+2])); - } - { // set test for the neutral main - string iname; - iname = "ui:interface:bot_chat_"; - iname += table[i]; - iname += "_neutral_main"; - - CInterfaceGroup *inter = CWidgetManager::getInstance()->getWindowFromId(iname); - if (inter == NULL) - { - nlwarning ("cant find interface 's%'", iname.c_str()); - continue; - } - - CViewText *inter2 = (CViewText *)inter->getView("title0"); - nlassert (inter2 != NULL); - inter2->setText(ucstring(shortNews[rnd*3])); - - CViewText *inter3 = (CViewText *)inter->getView("title1"); - nlassert (inter3 != NULL); - inter3->setText(ucstring(shortNews[rnd*3+1])); - } - { // set test for the more news - string iname; - iname = "ui:interface:bot_chat_"; - iname += table[i]; - iname += "_more_news"; - - CInterfaceGroup *inter = CWidgetManager::getInstance()->getWindowFromId(iname); - if (inter == NULL) - { - nlwarning ("cant find interface 's%'", iname.c_str()); - continue; - } - - CViewText *inter2 = (CViewText *)inter->getView("title0"); - nlassert (inter2 != NULL); - inter2->setText(ucstring(longNews[rnd*3])); - - CViewText *inter3 = (CViewText *)inter->getView("title1"); - nlassert (inter3 != NULL); - inter3->setText(ucstring(longNews[rnd*3+1])); - - CViewText *inter4 = (CViewText *)inter->getView("title2"); - nlassert (inter4 != NULL); - inter4->setText(ucstring(longNews[rnd*3+2])); - } - } -} -*/ - - - - - -//========================================= -/** Temp setup for choice list - */ -/* -static void setupBotChatChoiceList(CInterfaceGroup *botChatGroup) -{ - // Temp for test. Should then be read from server msg - std::vector choices; - for(uint k = 0; k < 90; ++k) - { - choices.push_back("Choice " + toString(k)); - } - CBotChat::setChoiceList(botChatGroup, choices, false); -} -*/ - -//========================================= -/** Temp setup for description list - */ -/* -static void setupBotChatDescription(CInterfaceGroup *botChatGroup) -{ - ucstring desc; - for(uint k = 0; k < 90; ++k) - { - desc += "This is a multi line description. "; - } - CBotChat::setDescription(botChatGroup, desc); -} -*/ - -//========================================= -/** Temp setup for bot chat gift - */ -/* -static void setupBotChatBotGift(CInterfaceGroup *botChatGroup) -{ - // create dummy item in the db - CInterfaceManager *im = CInterfaceManager::getInstance(); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:INVENTORY:20:0:SHEET")->setValue32(CSheetId("ai_flesh_poisson.item").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:INVENTORY:20:0:QUALITY")->setValue32(0); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:INVENTORY:20:1:SHEET")->setValue32(CSheetId("fyros_sword_lvl_01_05.item").asInt()); - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:INVENTORY:20:1:QUALITY")->setValue32(2); - CBotChat::setBotGift(botChatGroup, ucstring("Thanks to have succeeded the mission"), ucstring("Here's your reward"), ucstring("The bot has taken the object quest from your inventory")); -} -*/ - -//----------------------------------------------- -// impulseBotChatSetInterface : -//----------------------------------------------- -#if 0 -void impulseBotChatSetInterface(NLMISC::CBitMemStream &impulse) -{ - // received ADD_DYN_STR - - CEntityId user; - uint32 happyness; - BOTCHATTYPE::TBotChatInterfaceId interfaceId; - bool hasNews; - - impulse.serial (user); - impulse.serial (happyness); - -// impulse.serialEnum (interfaceId); - uint16 interfId; - impulse.serial(interfId); - interfaceId = (BOTCHATTYPE::TBotChatInterfaceId)(interfId&0xff); - uint8 botType = (interfId>>8) & 0xff; - - impulse.serial (hasNews); - - nldebug("impulseCallBack : Received BOT_CHAT:SET_INTERFACE interface %d, have news %s, happy %d, bottype %hu", interfaceId, hasNews?"yes":"no", happyness,(uint16)botType); - - string stringId; - vector args; - if (hasNews) - { - -/* impulse.serial (stringId); - impulse.serialCont (args); - nlinfo ("receive the news '%s' with %d args", stringId.c_str(), args.size()); -*/ - // TEMP FOR THE DEMO, DON'T USE THE NETWORK NEW BUT SELECT A NEWS HERE -/* - CInterfaceGroup *inter = CWidgetManager::getInstance()->getWindowFromId("ui:interface:bot_chat_intro"); - nlassert (inter != NULL); - inter->setActive(true); - - CViewText *inter2 = (CViewText *)inter->getView("hi"); - nlassert (inter2 != NULL); - inter2->NetworkTextId.setString("IOS_NEWS_FOOTBALL_SHORT_EEII", &ChatMngr); - inter2->NetworkTextId.Args.push_back(10); - inter2->NetworkTextId.Args.push_back(20); - inter2->NetworkTextId.Args.push_back(1); - inter2->NetworkTextId.Args.push_back(2); -*/ } - - // FOR THE DEMO, find and set a fake news: -// setFakeNews (); - - string interfaceName = getInterfaceNameFromId (botType, interfaceId); - - if(interfaceName.empty()) - { - nlwarning ("Received an unknown bot chat interface %d", interfaceId); - } - else - { - CInterfaceGroup *inter = CWidgetManager::getInstance()->getWindowFromId(interfaceName); - if (inter == NULL) - { - nlwarning ("Can't find interface name '%s' %d", interfaceName.c_str(), interfaceId); - } - else - { - CInterfaceManager::getInstance()->setBotChatWin(inter); - if (inter->getActive()) - { - nlwarning ("Interface %s is already active, not normal!", interfaceName.c_str()); - } - else - { - nlinfo ("server want to me display the bot chat interface %s %d", interfaceName.c_str(), interfaceId); - inter->setActive(true); - } - } - } -} -#endif - - - -//----------------------------------------------- -// impulseBeginTrade : -//----------------------------------------------- -void impulseBeginTrade(NLMISC::CBitMemStream &impulse) -{ - if (PermanentlyBanned) return; - //open trade window - CInterfaceGroup* win = CWidgetManager::getInstance()->getWindowFromId("ui:interface:trade"); - if (!win) - { - nlwarning("invalid interface ui:interface:trade"); - return; - } - win->setActive(true); -} - -//----------------------------------------------- -// impulseBuyPrice : -//----------------------------------------------- -void impulseBuyPrice(NLMISC::CBitMemStream &impulse) -{ - uint16 botChatSession; - uint32 sheetID; - uint16 quality; - uint64 price; - impulse.serial(botChatSession); - impulse.serial(price); - impulse.serial(sheetID); - impulse.serial(quality); - // no more used -} - -//----------------------------------------------- -// impulseDynChatOpen -//----------------------------------------------- -void impulseDynChatOpen(NLMISC::CBitMemStream &impulse) -{ - uint32 BotUID; // Compressed Index - uint32 BotName; // Server string - vector DynStrs; // 0 - Desc, 1 - Option0, 2 - Option1, etc.... - impulse.serial(BotUID); - impulse.serial(BotName); - impulse.serialCont(DynStrs); - - if (PermanentlyBanned) return; - -/* string sTmp = "impulseCallback : Received BOTCHAT:DYNCHAT_OPEN BotUID:"; - sTmp += toString(BotUID) + " BotName:"; - sTmp += toString(BotName) + " DynStrs:"; - for (uint32 i = 0; i < DynStrs.size(); ++i) - { - sTmp += toString(DynStrs[i]); - if (i != DynStrs.size()-1) sTmp += ","; - } - nlinfo(sTmp.c_str());*/ - - InSceneBubbleManager.dynChatOpen(BotUID, BotName, DynStrs); -} - -//----------------------------------------------- -// impulseDynChatClose -//----------------------------------------------- -void impulseDynChatClose(NLMISC::CBitMemStream &impulse) -{ - uint32 BotUID; // Compressed Index - impulse.serial(BotUID); - if (PermanentlyBanned) return; - //nlinfo("impulseCallback : Received BOTCHAT:DYNCHAT_CLOSE BotUID:"+toString(BotUID)); - InSceneBubbleManager.dynChatClose(BotUID); -} - -//----------------------------------------------- -// impulseBeginCast: -//----------------------------------------------- -void impulseBeginCast(NLMISC::CBitMemStream &impulse) -{ - //open cast window - uint32 begin,end; - impulse.serial(begin); - impulse.serial(end); - if (PermanentlyBanned) return; - CInterfaceManager* iMngr = CInterfaceManager::getInstance(); - NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SPELL_CAST")->setValue32(1); - NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:CAST_BEGIN")->setValue32(begin); - NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:CAST_END")->setValue32(end); -} - - - -//----------------------------------------------- -// impulseCorrectPos : -// Message from the server to correct the user position because he is not at the same position on the server.. -//----------------------------------------------- -void impulseCorrectPos(NLMISC::CBitMemStream &impulse) -{ - // TP:CORRECT - //nlinfo("impulseCallback : Received TP:CORRECT"); - sint32 x, y, z; - impulse.serial(x); - impulse.serial(y); - impulse.serial(z); - nlinfo("impulseCorrectPos: new user position %d %d %d", x, y, z); - - if(UserEntity->mode() != MBEHAV::COMBAT_FLOAT) - { - if (x == 0) // Get SpeedAdjustement - { - UserEntity->setSpeedServerAdjust(-0.2f); - } - else - { - // Compute the destination. - CVectorD dest = CVectorD((float)x/1000.0f, (float)y/1000.0f, (float)z/1000.0f); - // Update the position for the vision. - NetMngr.setReferencePosition(dest); - // Change the user poisition. - UserEntity->correctPos(dest); - } - } -}// impulseCorrectPos // - -class CDummyProgress : public IProgressCallback -{ - void progress (float /* value */) {} -}; - -//----------------------------------------------- -// impulseTP : -// Message from the server to teleport the user. -// \warning This function remove the current target. Do no use to correct a position. -//----------------------------------------------- -void impulseTPCommon(NLMISC::CBitMemStream &impulse, bool hasSeason); -void impulseTPCommon2(NLMISC::CBitMemStream &impulse, bool hasSeason); - -void impulseTP(NLMISC::CBitMemStream &impulse) -{ - impulseTPCommon(impulse, false); -} - -void impulseTPWithSeason(NLMISC::CBitMemStream &impulse) -{ - impulseTPCommon(impulse, true); -} - -struct SQueuedTP -{ - NLMISC::CBitMemStream Impulse; - bool HasSeason; - - SQueuedTP(const NLMISC::CBitMemStream &impulse, bool hasSeason) - :Impulse(impulse), HasSeason(hasSeason) - { - } -}; - -// note - this method added by Sadge and Hamster to deal with unexplained recursive calls to impulseTPCommon -// these calls are provoked by the net manager update which is called during loading -void impulseTPCommon(NLMISC::CBitMemStream &impulse, bool hasSeason) -{ - CNiceInputAuto niceInputs; - static std::list queuedTPs; - SQueuedTP thisTP(impulse,hasSeason); - queuedTPs.push_back(thisTP); - - BOMB_IF(queuedTPs.size()!=1,NLMISC::toString("Queueing recursive TPs depth=%u",queuedTPs.size()),return); - - while(!queuedTPs.empty()) - { - impulseTPCommon2(queuedTPs.front().Impulse,queuedTPs.front().HasSeason); - queuedTPs.pop_front(); - }; - -} - - -void impulseTPCommon2(NLMISC::CBitMemStream &impulse, bool hasSeason) -{ - // choose a default screen if not setuped - if( LoadingBackground!=ResurectKamiBackground && LoadingBackground!=ResurectKaravanBackground && - LoadingBackground!=TeleportKamiBackground && LoadingBackground!=TeleportKaravanBackground) - LoadingBackground= TeleportKaravanBackground; - // if resurect but user not dead, choose default. NB: this is a bug, the tp impulse should tell - // which background to choose. \todo yoyo: this is a temp fix - if( UserEntity && !UserEntity->isDead() && - (LoadingBackground==ResurectKamiBackground || LoadingBackground==ResurectKaravanBackground) ) - LoadingBackground= TeleportKaravanBackground; - - // Play music according to the background - if(SoundMngr) - { - LoadingMusic.clear(); - if(LoadingBackground==TeleportKamiBackground) - LoadingMusic= "Kami Teleport.ogg"; - else if(LoadingBackground==TeleportKaravanBackground) - LoadingMusic= "Karavan Teleport.ogg"; - // if resurection, continue to play death music - else if(LoadingBackground==ResurectKamiBackground || LoadingBackground==ResurectKaravanBackground) - { - // noop - } - // default: loading music - else - { - LoadingMusic= "Loading Music Loop.ogg"; - } - - // start to play - SoundMngr->playEventMusic(LoadingMusic, CSoundManager::LoadingMusicXFade, true); - } - - // Create the loading texture. - beginLoading (LoadingBackground); - - // No ESCAPE key - UseEscapeDuringLoading = false; - - // Change the tips - selectTipsOfTheDay (rand()); - - // start progress bar and display background - ProgressBar.reset (BAR_STEP_TP); - ucstring nmsg("Loading..."); - ProgressBar.newMessage ( ClientCfg.buildLoadingString(nmsg) ); - - - // received ADD_DYN_STR - nlinfo("impulseTP: received a request for a TP."); - sint32 x, y, z; - impulse.serial(x); - impulse.serial(y); - impulse.serial(z); - bool useHeading; - impulse.serialBit( useHeading ); - // Is there an orientation too ? - if( useHeading ) - { - float angle; - impulse.serial(angle); - nlinfo("impulseTP: to %d %d %d %f", x, y, z, angle); - CVector ori = CVector((float)cos(angle), (float)sin(angle), 0.0f); - ori.normalize(); - UserEntity->dir(ori, false, false); - UserEntity->front(ori, false, false); - UserEntity->setHeadPitch(0); - UserControls.resetCameraDeltaYaw(); - } - else - nlinfo("impulseTP: to %d %d %d", x, y, z); - - if (hasSeason) - { - extern uint8 ServerSeasonValue; - extern bool ServerSeasonReceived; - impulse.serial(ServerSeasonValue); - ServerSeasonReceived = true; - } - - if (ClientCfg.R2EDEnabled) - { - R2::getEditor().tpReceived(); - } - - // Compute the destination. - CVectorD dest = CVectorD((float)x/1000.0f, (float)y/1000.0f, (float)z/1000.0f); - // Update the position for the vision. - NetMngr.setReferencePosition(dest); - // Change the position of the entity and in Pacs. - UserEntity->pos(dest); - - // Fade out the Game Sound - if(SoundMngr) - SoundMngr->fadeOutGameSound(ClientCfg.SoundTPFade); - - - R2::TTeleportContext tpContext = R2::TPContext_Unknown; - - ucstring tpReason; - ucstring tpCancelText; - - try - { - R2::TR2TpInfos tpInfos; - impulse.serial(tpInfos); - - - if ( tpInfos.UseTpMessage) - { - tpReason = CI18N::get(tpInfos.TpReasonId); - - uint32 size = (uint32)tpInfos.TpReasonParams.size(); - uint32 first = 0; - CSString str(tpReason.toString()); - for (;first != size ; ++first) - { - std::string value = tpInfos.TpReasonParams[first]; - std::string key = NLMISC::toString("%%%u", first +1); - str = str.replace( key.c_str(), value.c_str()); - } - tpReason = ucstring(str); - tpCancelText = CI18N::get(tpInfos.TpCancelTextId); - tpContext = tpInfos.TpContext; - } - - } - catch (const EStream &) - { - tpReason = ucstring("TP Reason"); - tpCancelText = ucstring("Cancel TP"); // for test - // try to deduce tp context from current editor mode - switch (R2::getEditor().getMode()) - { - case R2::CEditor::EditionMode: - case R2::CEditor::NotInitialized: - tpContext = R2::TPContext_Unknown; - tpReason = ucstring(); - tpCancelText = ucstring(); - break; - case R2::CEditor::GoingToDMMode: - case R2::CEditor::TestMode: - case R2::CEditor::DMMode: - tpContext = R2::TPContext_Edit; - break; - case R2::CEditor::AnimationModeLoading: - case R2::CEditor::AnimationModeWaitingForLoading: - case R2::CEditor::AnimationModeDm: - case R2::CEditor::AnimationModeGoingToDm: - tpContext = R2::TPContext_IslandOwner; - break; - case R2::CEditor::AnimationModePlay: - case R2::CEditor::AnimationModeGoingToPlay: - default: - tpContext = R2::TPContext_Mainland; - break; - } - } - - - - if (!tpReason.empty()) - { - std::string tpIcon; - switch(tpContext) - { - case R2::TPContext_Mainland: tpIcon = "cancel_tp_main_land.tga"; break; - case R2::TPContext_Edit: tpIcon = "cancel_tp_edit.tga"; break; - case R2::TPContext_IslandOwner: tpIcon = "cancel_tp_island_owner.tga"; break; - default: break; - } - ProgressBar.setTPMessages(tpReason, tpCancelText, tpIcon); - } - - ProgressBar.progress(0); - // enable hardware mouse to allow to click the buttons - //bool oldHardwareCursor = IsMouseCursorHardware(); - //InitMouseWithCursor(true); - // Select the closest continent from the new position. - ContinentMngr.select(dest, ProgressBar); - // - //InitMouseWithCursor(oldHardwareCursor); - - // reset 'cancel' button - ProgressBar.setTPMessages(ucstring(), ucstring(), ""); - - - // ProgressBar.enableQuitButton(false); // TMP TMP - ProgressBar.progress(1.f); // do a last display without the buttons because first frame may take a while to draw, and the buttons have no more effect at this point. - ProgressBar.finish(); - // ProgressBar.enableQuitButton(true); // TMP TMP - - // Teleport the User. - UserEntity->tp(dest); - - // Msg Received, send an acknowledge after the landscape has been loaded. - CBitMemStream out; - if(GenericMsgHeaderMngr.pushNameToStream("TP:ACK", out)) - { - NetMngr.push(out); - nlinfo("impulseTP: teleport acknowledge 'TP:ACK' sent."); - } - else - nlwarning("impulseTP: unknown message name : 'TP:ACK'."); - - - // First frame - FirstFrame = true; - - - // if tp canceling was asked, act accordingly - if (ProgressBar.getTPCancelFlag(true)) - { - switch(tpContext) - { - case R2::TPContext_Mainland: - CAHManager::getInstance()->runActionHandler("return_to_mainland", NULL); - break; - case R2::TPContext_Edit: - CAHManager::getInstance()->runActionHandler("r2ed_stop_test", NULL); - break; - case R2::TPContext_IslandOwner: - CAHManager::getInstance()->runActionHandler("r2_stop_live", NULL); - break; - default: - break; - } - } - - initHardwareCursor(true); -}// impulseTP // - -//----------------------------------------------- -// impulseCombatEngageFailed : -//----------------------------------------------- -void impulseCombatEngageFailed(NLMISC::CBitMemStream &impulse) -{ - if (PermanentlyBanned) return; - nlinfo("impulseCombatEngageFailed: Combat Engage Failed."); - - // Unlock the motion. - UserControls.locked(false); -}// impulseCombatEngageFailed // - -//----------------------------------------------- -// impulseTeamInvitation : -//----------------------------------------------- -void impulseTeamInvitation(NLMISC::CBitMemStream &impulse) -{ - nlinfo("impulseTeamInvitation: received an invitation"); - - uint32 textID; - impulse.serial(textID); - if (PermanentlyBanned) return; - - CLuaManager::getInstance().executeLuaScript("game:onTeamInvation("+toString(textID)+")", 0); -}// impulseTeamInvitation // - -//----------------------------------------------- -// impulseTeamShareOpen -// The server request that the client opens the team sharing system -//----------------------------------------------- -void impulseTeamShareOpen(NLMISC::CBitMemStream &impulse) -{ - if (PermanentlyBanned) return; - CInterfaceManager *im = CInterfaceManager::getInstance(); - CGroupContainer *gc = dynamic_cast( CWidgetManager::getInstance()->getElementFromId("ui:interface:team_share")); - if (!gc) return; - gc->setActive(true); - CWidgetManager::getInstance()->setTopWindow(gc); - gc->updateCoords(); - gc->center(); -}// impulseTeamShareOpen // - -//----------------------------------------------- -// impulseTeamShareInvalid -// invalidate the player validation. If someone has choosen an item/phrase after the player has validated -// the player receive this message to let him know that the chance percentage to obtain a specific item has -// changed and so the player can update its own settings to fit better to what he wants. -// On the client side we have just to show the valid button. All the resets are done on the server side. -//----------------------------------------------- -void impulseTeamShareInvalid(NLMISC::CBitMemStream &impulse) -{ - if (PermanentlyBanned) return; - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CCtrlTextButton *pTB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:team_share:content:ok")); - if (pTB != NULL) - pTB->setActive(true); -}// impulseTeamShareInvalid // - -//----------------------------------------------- -// impulseTeamShareClose -// The server wants to close the team sharing interface (if the sharing has been validated or other reasons) -//----------------------------------------------- -void impulseTeamShareClose(NLMISC::CBitMemStream &impulse) -{ - if (PermanentlyBanned) return; - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CGroupContainer - *pGC = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:team_share")); - if (pGC != NULL) - pGC->setActive(false); - CCtrlTextButton *pTB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:team_share:content:ok")); - if (pTB != NULL) - pTB->setActive(true); -}// impulseTeamShareClose // - -//----------------------------------------------- -// impulseTeamContactInit -// initialize friend list and ignore list from the contact list -//----------------------------------------------- -void impulseTeamContactInit(NLMISC::CBitMemStream &impulse) -{ - vector vFriendListName; - vector vFriendListOnline; - vector vIgnoreListName; - - impulse.serialCont(vFriendListName); - uint32 nbState; - impulse.serial(nbState); - vFriendListOnline.resize(nbState); - for (uint i=0; igetDbProp("UI:SAVE:CONTACT_LIST:SORT_ORDER")->getValue32()); - - if (order == CPeopleList::sort_online) - { - PeopleInterraction.FriendList.sortEx(order); - } -}// impulseTeamContactStatus // - - -//----------------------------------------------- -// impulseTeamContactRemove -// Remove a contact by the server -//----------------------------------------------- -void impulseTeamContactRemove(NLMISC::CBitMemStream &impulse) -{ - uint32 contactId; - uint8 nList; - - impulse.serial(contactId); - impulse.serial(nList); - - if (PermanentlyBanned) return; - - //nlinfo("impulseCallback : Received TEAM:CONTACT_REMOVE %d %d", contactId, nList); - - PeopleInterraction.removeContactFromList(contactId, nList); - -}// impulseTeamContactRemove // - - -//----------------------------------------------- -// servers sets information of a guild member: -// u16 ( member index ) u32 (player name ), u8 ( player grade + last bit set if player online ). -//----------------------------------------------- -/*void impulseGuildSetMemberInfo(NLMISC::CBitMemStream &impulse) -{ - uint16 index; - impulse.serial(index); - uint32 guildMemberName; - impulse.serial(guildMemberName); - uint8 grade; - impulse.serial(grade); - bool online = ((grade&0x80) != 0); - grade = (grade & 0x7F); - CGuildManager::getInstance()->set(index, guildMemberName, grade, online); -}*/ - -//----------------------------------------------- -// vector of pair( u32 (player name ), u8 ( player grade + last bit set if player online ) ) -//----------------------------------------------- -/*void impulseGuildInitMemberInfo(NLMISC::CBitMemStream &impulse) -{ - vector < pair < uint32, uint8 > > AllMembers; - uint16 nbEntries; - impulse.serial(nbEntries); - AllMembers.resize(nbEntries); - for (uint32 i = 0; i < nbEntries; ++i) - { - uint32 name; - impulse.serial(name); - uint8 gradeNonline; - impulse.serial(gradeNonline); - AllMembers[i].first = name; - AllMembers[i].second = gradeNonline; - } - - CGuildManager::getInstance()->init(AllMembers); -}*/ - - -//----------------------------------------------- -// impulseGuildInvitation -//----------------------------------------------- -/*void impulseGuildInvitation(NLMISC::CBitMemStream &impulse) -{ - nlinfo("impulseGuildInvitation"); - -}*/ - -//----------------------------------------------- -// impulseGuildJoinProposal -// server sent to client invitation (uint32 invitorNameId, uint32 guildNameId -//----------------------------------------------- -void impulseGuildJoinProposal(NLMISC::CBitMemStream &impulse) -{ - - uint32 phraseID; - impulse.serial(phraseID); - - if (PermanentlyBanned) return; - - //nlinfo("impulseCallback : Received GUILD:JOIN_PROPOSAL %d", phraseID); - - CGuildManager::getInstance()->launchJoinProposal(phraseID); - /*//activate the pop up window - CInterfaceManager *im = CInterfaceManager::getInstance(); - CGroupContainer *gc = dynamic_cast( CWidgetManager::getInstance()->getElementFromId("ui:interface:join_guild_proposal")); - if (!gc) return; - CViewText *vt = dynamic_cast(gc->getView("invitor_name")); - if (vt == NULL) return; - vt->setText(invitor); - gc->setActive(true); - CWidgetManager::getInstance()->setTopWindow(gc); - gc->updateCoords(); - gc->center(); - gc->enableBlink(2);*/ -}// impulseGuildJoinProposal // - - -//----------------------------------------------- -// impulseCloseTempInv -//----------------------------------------------- -void impulseCloseTempInv(NLMISC::CBitMemStream &impulse) -{ - CTempInvManager::getInstance()->close(); -} - -//----------------------------------------------- -// impulseAscencorTeleport -//----------------------------------------------- -void impulseAscencorTeleport(NLMISC::CBitMemStream &impulse) -{ - -} // impulseAscencorTeleport // - -//----------------------------------------------- -// impulseEnterCrZoneProposal -// server sent to client invitation (uint32 invitorNameId, uint32 guildNameId -//----------------------------------------------- -void impulseEnterCrZoneProposal(NLMISC::CBitMemStream &impulse) -{ - uint32 phraseID; - impulse.serial(phraseID); - if (PermanentlyBanned) return; - - //nlinfo("impulseCallback : Received MISSION:ASK_ENTER_CRITICAL %d", phraseID); - - //activate the pop up window - CInterfaceManager *im = CInterfaceManager::getInstance(); - CGroupContainer *gc = dynamic_cast( CWidgetManager::getInstance()->getElementFromId("ui:interface:enter_crzone_proposal")); - if (!gc) return; - CViewTextID *vti = dynamic_cast(gc->getView("phrase")); - if (!vti) return; - vti->setTextId(phraseID); - gc->setActive(true); - CWidgetManager::getInstance()->setTopWindow(gc); - gc->updateCoords(); - gc->center(); - gc->enableBlink(2); -}// impulseEnterCrZoneProposal // - -//----------------------------------------------- -// impulseCloseEnterCrZoneProposal -// server close proposal interface -//----------------------------------------------- -void impulseCloseEnterCrZoneProposal(NLMISC::CBitMemStream &impulse) -{ - // hide interface - CInterfaceManager* pIM = CInterfaceManager::getInstance(); - CInterfaceGroup *pIG = (CInterfaceGroup*)CWidgetManager::getInstance()->getElementFromId ("ui:interface:enter_crzone_proposal"); - if(pIG) - pIG->setActive(false); -}// impulseCloseEnterCrZoneProposal // - - -//----------------------------------------------- -// impulseExchangeInvitation : -//----------------------------------------------- -void impulseExchangeInvitation(NLMISC::CBitMemStream &impulse) -{ - uint32 textID; - impulse.serial(textID); - if (PermanentlyBanned) return; - CInterfaceManager* iMngr = CInterfaceManager::getInstance(); - - // show the modal window that allow the player to accept / decline the invitation - CGroupContainer *wnd = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(PLAYER_EXCHANGE_INVITATION_DIALOG)); - if (wnd) - { - wnd->setActive(true); - wnd->updateCoords(); - wnd->center(); - wnd->enableBlink(2); - CWidgetManager::getInstance()->setTopWindow(wnd); - } - - CViewTextID *vti = dynamic_cast(wnd->getView("invite_phrase")); - if (vti) - { - vti->setTextId(textID); - } - -}// impulseExchangeInvitation // - -//----------------------------------------------- -// impulseExchangeCloseInvitation : -//----------------------------------------------- -void impulseExchangeCloseInvitation(NLMISC::CBitMemStream &impulse) -{ - if (PermanentlyBanned) return; - CInterfaceManager* iMngr = CInterfaceManager::getInstance(); - // hide the modal window that allow the player to accept / decline the invitation - CInterfaceGroup *wnd = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(PLAYER_EXCHANGE_INVITATION_DIALOG)); - if (wnd) wnd->setActive(false); -} - -//----------------------------------------------- -// impulseMountAbort : -//----------------------------------------------- -void impulseMountAbort(NLMISC::CBitMemStream &impulse) -{ - nlwarning("impulseMountAbort: Received ANIMALS:MOUNT_ABORT => no more used"); -}// impulseMountAbort // - -//----------------------------------------------- -// impulseRyzomTime : -// Synchronize the ryzom time with the server. -//----------------------------------------------- -/* -void impulseRyzomTime(NLMISC::CBitMemStream &impulse) -{ - nlinfo("impulseRyzomTime: Ryzom Time Received"); - uint32 serverTick; - float ryzomTime; - uint32 ryzomDay; - impulse.serial(serverTick); - impulse.serial(ryzomTime); - impulse.serial(ryzomDay); - nlinfo("impulseRyzomTime: Day '%d' Time '%f'.", ryzomDay, ryzomTime); - - // Initialize - RT.setOrigin( serverTick, ryzomDay, ryzomTime ); -}// impulseRyzomTime // -*/ -//----------------------------------------------- -// impulseWhere : -// Display server position -//----------------------------------------------- -void impulseWhere(NLMISC::CBitMemStream &impulse) -{ - //nlinfo("impulseCallback : Received DEBUG:REPLY_WHERE"); - - sint32 x,y,z; - impulse.serial(x); - impulse.serial(y); - impulse.serial(z); - if (PermanentlyBanned) return; - char buf[128]; - - double xf = ((double)x)/1000.0f; - double yf = ((double)y)/1000.0f; - double zf = ((double)z)/1000.0f; - - sprintf(buf,"Your server position is : X= %g Y= %g Z= %g",xf,yf,zf); - nlinfo(buf); - CInterfaceManager::getInstance()->displaySystemInfo(ucstring(buf)); -}// impulseWhere // - -//----------------------------------------------- -// impulseWho : -// Display server position -//----------------------------------------------- -/* -void impulseWho(NLMISC::CBitMemStream &impulse) -{ - nlinfo("impulseWho Received"); - CInterfaceManager::getInstance()->displaySystemInfo(ucstring("Players currently in the game :")); - - ucstring name; - uint32 loginId; - uint16 dist; - uint8 dirshort; - string str; - while( impulse.getPos() < (sint32)impulse.length() ) - { - impulse.serial(name); - impulse.serial(loginId); - impulse.serial(dist); - impulse.serial(dirshort); - - double angle = dirshort * 2.0 * NLMISC::Pi / 255.0; - angle -= NLMISC::Pi; - nlinfo ("name %s uid %u dist %hu dirshort %hu angle %f", name.toString().c_str(),loginId, dist, (uint16)dirshort, angle); - sint direction =(sint) floor( 0.5 + ( 8.0 * (angle + NLMISC::Pi)/(NLMISC::Pi) ) ); - direction = ((direction%16)+16)%16; - static const string txts[]= - { - "uiW", - "uiWSW", - "uiSW", - "uiSSW", - "uiS", - "uiSSE", - "uiSE", - "uiESE", - "uiE", - "uiENE", - "uiNE", - "uiNNE", - "uiN", - "uiNNW", - "uiNW", - "uiWNW", - }; - - str = toString (" - uid %d - distance %hu meters - direction ", loginId, dist); - CInterfaceManager::getInstance()->displaySystemInfo(ucstring(name + ucstring(str) + CI18N::get(txts[direction]))); - } -}// impulseWho // -*/ - -/* -void impulseWhoGM(NLMISC::CBitMemStream &impulse) -{ - nlinfo("impulseWhoGM Received"); - CInterfaceManager::getInstance()->displaySystemInfo(ucstring("Players currently in the game :")); - - ucstring name; - uint32 loginId; - uint16 dist; - uint8 dirshort; - string str; - while( impulse.getPos() < (sint32)impulse.length() ) - { - impulse.serial(name); - impulse.serial(loginId); - impulse.serial(dist); - impulse.serial(dirshort); - - double angle = dirshort * 2.0 * NLMISC::Pi / 255.0; - angle -= NLMISC::Pi; - nlinfo ("name %s uid %u dist %hu dirshort %hu angle %f", name.toString().c_str(),loginId, dist, (uint16)dirshort, angle); - sint direction =(sint) floor( 0.5 + ( 8.0 * (angle + NLMISC::Pi)/(NLMISC::Pi) ) ); - direction = ((direction%16)+16)%16; - static const string txts[]= - { - "uiW", - "uiWSW", - "uiSW", - "uiSSW", - "uiS", - "uiSSE", - "uiSE", - "uiESE", - "uiE", - "uiENE", - "uiNE", - "uiNNE", - "uiN", - "uiNNW", - "uiNW", - "uiWNW", - }; - - str = toString (" - uid %d - distance %hu meters - direction ", loginId, dist); - CInterfaceManager::getInstance()->displaySystemInfo(ucstring(name + ucstring(str) + CI18N::get(txts[direction]))); - } -}// impulseWho // -*/ -//----------------------------------------------- -// impulseCounter : -// check UDP validity -//----------------------------------------------- -void impulseCounter(NLMISC::CBitMemStream &impulse) -{ - //nlinfo("impulseCallBack : Received DEBUG:COUNTER"); - try - { - uint32 counter; - impulse.serial(counter); - - static uint queueTop = 0; - static deque queue; - - if (counter > queueTop) - { - queue.resize(queue.size()+counter-queueTop, false); - queueTop = counter; - } - - if (queueTop-counter+1 > queue.size()) - { - nlinfo("COUNTER: counter %d arrived too late...", counter); - } - else - { - if (queue[queue.size()-1-(queueTop-counter)]) - { - nlwarning("COUNTER: Received counter %d more than once !", counter); - } - else - { - nldebug("COUNTER: set counter %d", counter); - queue[queue.size()-1-(queueTop-counter)] = true; - } - - while (queue.size() > 128) - { - if (!queue.front()) - { - nlwarning("COUNTER: counter %d not received !", queueTop-queue.size()-1); - } - - queue.pop_front(); - } - } - } - catch (const Exception &e) - { - nlwarning ("Problem while decoding a COUTNER msg, skipped: %s", e.what()); - } -} - -//----------------------------------------------- -// impulsePhraseSend : -// A dyn string (or phrase) is send (so, we receive it) -//----------------------------------------------- -void impulsePhraseSend(NLMISC::CBitMemStream &impulse) -{ - STRING_MANAGER::CStringManagerClient::instance()->receiveDynString(impulse); -} - -//----------------------------------------------- -// impulseStringResp : -// Update the local string set -//----------------------------------------------- -void impulseStringResp(NLMISC::CBitMemStream &impulse) -{ - uint32 stringId; - string strUtf8; - impulse.serial(stringId); - impulse.serial(strUtf8); - ucstring str; - str.fromUtf8(strUtf8); - - if (PermanentlyBanned) return; - - STRING_MANAGER::CStringManagerClient::instance()->receiveString(stringId, str); -} - -//----------------------------------------------- -// impulseReloadCache : -// reload the string cache -//----------------------------------------------- -void impulseReloadCache(NLMISC::CBitMemStream &impulse) -{ - uint32 timestamp;; - impulse.serial(timestamp); - if (PermanentlyBanned) return; - STRING_MANAGER::CStringManagerClient::instance()->loadCache(timestamp); -} - -//----------------------------------------------- -// impulseBotChatEnd -// ForceThe end of the bot chat -//----------------------------------------------- -void impulseBotChatForceEnd(NLMISC::CBitMemStream &impulse) -{ - if (PermanentlyBanned) return; - CBotChatManager::getInstance()->setCurrPage(NULL); -} - - -//----------------------------------------------- -// MISSION COMPLETED JOURNAL -//----------------------------------------------- -/* -#define MC_M_CONTAINER "ui:interface:info_player_journal" -#define MC_S_CONTAINER "ui:interface:ipj_com_missions" -#define MC_TEMPLATE "tipj_mission_complete" -//----------------------------------------------- -CGroupContainer *getMissionCompletedContainer() -{ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CInterfaceElement *pIE = CWidgetManager::getInstance()->getElementFromId(MC_M_CONTAINER); - CGroupContainer *pGCM = dynamic_cast(pIE); - if (pGCM == NULL) return NULL; - - CGroupList *pList = pGCM->getList(); - CGroupContainer *pGCS = dynamic_cast(pList->getGroup(MC_S_CONTAINER)); - return pGCS; -} - -//----------------------------------------------- -void clearMissions() -{ - CGroupContainer *pGCMC = getMissionCompletedContainer(); - CInterfaceGroup *pContent = pGCMC->getGroup("content"); - pContent->clearGroups(); -} -//----------------------------------------------- -void addMission(uint32 titleID) -{ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CGroupContainer *pGCMC = getMissionCompletedContainer(); - if (pGCMC == NULL) - { - nlwarning("cannot get container for missions completed"); - return; - } - CInterfaceGroup *pContent = pGCMC->getGroup("content"); - - uint32 nNbMission = pContent->getGroups().size(); - vector > vArgs; - - vArgs.push_back(pair("id", "mc"+NLMISC::toString(nNbMission))); - vArgs.push_back(pair("mcid", NLMISC::toString(titleID))); - - if (nNbMission == 0) - { - vArgs.push_back(pair("posref", "TL TL")); - vArgs.push_back(pair("posparent", "parent")); - vArgs.push_back(pair("y", "0")); - } - else - { - vArgs.push_back(pair("posref", "BL TL")); - } - - CInterfaceGroup *pIG = pIM->createGroupInstance(MC_TEMPLATE, pContent->getId(), vArgs); - if (pIG == NULL) - { - nlwarning("cannot create a mission completed"); - return; - } - pIG->setParent(pContent); - if (nNbMission == 0) - pIG->setParentPos(pContent); - else - pIG->setParentPos(pContent->getGroups()[nNbMission-1]); - pContent->addGroup(pIG); -} -*/ -//----------------------------------------------- -// impulseJournalInitCompletedMissions : -// initialize the player journal missions for completed missions -//----------------------------------------------- -void impulseJournalInitCompletedMissions (NLMISC::CBitMemStream &impulse) -{ -/* - vector vMissionCompleted; - impulse.serialCont(vMissionCompleted); - - clearMissions(); - - for (uint32 i = 0; i < vMissionCompleted.size(); ++i) - addMission (vMissionCompleted[i]); -*/ -} - -//----------------------------------------------- -// impulseJournalInitCompletedMissions : -// initialize the player journal missions for completed missions -//----------------------------------------------- -void impulseJournalUpdateCompletedMissions (NLMISC::CBitMemStream &impulse) -{ -/* - uint32 nNewCompletedMission; - impulse.serial(nNewCompletedMission); - - addMission (nNewCompletedMission); -*/ -} - - -//----------------------------------------------- -// impulseJournalCantAbandon : -// server refuses mission abandon -//----------------------------------------------- -void impulseJournalCantAbandon (NLMISC::CBitMemStream &impulse) -{ - if (PermanentlyBanned) return; - /// reactivate abandon button - CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:MISSION_ABANDON_BUTTON",false); - if (pNL != NULL) - pNL->setValue64(1); -} - - - -//----------------------------------------------- -// server add a compass target -//----------------------------------------------- -void impulseJournalAddCompass(NLMISC::CBitMemStream &impulse) -{ - sint32 x; - sint32 y; - uint32 text; - impulse.serial(x); - impulse.serial(y); - impulse.serial(text); - if (PermanentlyBanned) return; - //nlinfo("impulseCallback : Received JOURNAL:ADD_COMPASS %d %d %d", x, y, text); - CCompassDialogsManager::getInstance().addEntry( x,y,text ); -} - -//----------------------------------------------- -// server removes a compass target -//----------------------------------------------- -void impulseJournalRemoveCompass(NLMISC::CBitMemStream &impulse) -{ - uint32 text; - impulse.serial(text); - if (PermanentlyBanned) return; - //nlinfo("impulseCallback : Received JOURNAL:REMOVE_COMPASS %d", text); - CCompassDialogsManager::getInstance().removeEntry( text ); -} - - - -// -// the server ask me to execute a command -// -void impulseRemoteAdmin (NLMISC::CBitMemStream &impulse) -{ - CLog logDisplayVars; - CLightMemDisplayer mdDisplayVars; - logDisplayVars.addDisplayer (&mdDisplayVars); - mdDisplayVars.setParam (10); - - uint32 rid; - impulse.serial (rid); - string cmd; - impulse.serial (cmd); - - // remove the 2 first rc character if exists, only there to say to the EGS that is a remote command - if (cmd.size()>2 && tolower(cmd[0])=='r' && tolower(cmd[1])=='c') - cmd = cmd.substr(2); - - mdDisplayVars.clear (); - ICommand::execute(cmd, logDisplayVars, !ICommand::isCommand(cmd)); - const std::deque &strs = mdDisplayVars.lockStrings(); - - string str; - if (ICommand::isCommand(cmd)) - { - for (uint k = 0; k < strs.size(); k++) - { - str += strs[k]; - } - } - else - { - if (!strs.empty()) - { - str = strs[0].substr(0,strs[0].size()-1); - // replace all spaces into underscore because space is a reserved char - for (uint i = 0; i < str.size(); i++) if (str[i] == ' ') str[i] = '_'; - } - else - { - str = "???"; - } - } - mdDisplayVars.unlockStrings(); - - //nlinfo("impulseCallback : Received COMMAND:REMOTE_ADMIN : Server asked me to execute '%s', result is '%s'", cmd.c_str(), str.c_str()); - - CBitMemStream out; - if(GenericMsgHeaderMngr.pushNameToStream("COMMAND:REMOTE_ADMIN_ANSWER", out)) - { - out.serial (rid); - out.serial (cmd); - out.serial (str); - NetMngr.push (out); - //nlinfo("impulseCallback : COMMAND:REMOTE_ADMIN_ANSWER %d %s %s sent", rid, cmd.c_str(), str.c_str()); - } -} - - -//----------------------------------------------- -// impulseGuildAscensor : -// server request that the client launch the ascensor interface -//----------------------------------------------- - -void impulseGuildAscensor (NLMISC::CBitMemStream &impulse) -{ - if (PermanentlyBanned) return; - //nlinfo("impulseCallback : Received GUILD:ASCENSOR"); - CGuildManager::getInstance()->launchAscensor(); -} - -//----------------------------------------------- -//impulseGuildLeaveAscensor -//----------------------------------------------- -void impulseGuildLeaveAscensor (NLMISC::CBitMemStream &impulse) -{ - if (PermanentlyBanned) return; - //nlinfo("impulseCallback : Received GUILD:LEAVE_ASCENSOR"); - CGuildManager::getInstance()->quitAscensor(); -} - -//----------------------------------------------- -//impulseGuildAbortCreation -//----------------------------------------------- -void impulseGuildAbortCreation (NLMISC::CBitMemStream &impulse) -{ - CBotChatPage *pPage = CBotChatManager::getInstance()->getCurrPage(); - CBotChatPageCreateGuild *pPageCG = dynamic_cast(pPage); - if (pPageCG == BotChatPageAll->CreateGuild) - CBotChatManager::getInstance()->setCurrPage(NULL); -} - -void impulseGuildOpenGuildWindow(NLMISC::CBitMemStream &impulse) -{ - CGuildManager::getInstance()->openGuildWindow(); -} - - -//----------------------------------------------- -// impulseGuildOpenInventory -//----------------------------------------------- -void impulseGuildOpenInventory (NLMISC::CBitMemStream &impulse) -{ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:INVENTORY_GUILD_OPENED")->setValue32(1); -} - -//----------------------------------------------- -// impulseGuildCloseInventory -//----------------------------------------------- -void impulseGuildCloseInventory (NLMISC::CBitMemStream &impulse) -{ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:INVENTORY_GUILD_OPENED")->setValue32(0); -} - -//----------------------------------------------- -// impulseGuildUpdatePlayerTitle -// server block/unblock some reserved titles -//----------------------------------------------- -void impulseGuildUpdatePlayerTitle(NLMISC::CBitMemStream &impulse) -{ - CSkillManager *pSM = CSkillManager::getInstance(); - bool bUnblock; - impulse.serial(bUnblock); - vector vTitles; - impulse.serialCont(vTitles); - if (PermanentlyBanned) return; - if (bUnblock) - { - for (uint32 i = 0; i < vTitles.size(); ++i) - pSM->unblockTitleFromServer((CHARACTER_TITLE::ECharacterTitle)vTitles[i]); - } - else - { - for (uint32 i = 0; i < vTitles.size(); ++i) - pSM->blockTitleFromServer((CHARACTER_TITLE::ECharacterTitle)vTitles[i]); - } -} - -//----------------------------------------------- -// impulseGuildUseFemaleTitles -// server activates/deactivates use of female titles -//----------------------------------------------- -void impulseGuildUseFemaleTitles(NLMISC::CBitMemStream &impulse) -{ - impulse.serial( UseFemaleTitles ); -} - -//----------------------------------------------- -// impulsePhraseDownLoad -// server upload the phrases. -//----------------------------------------------- -void impulsePhraseDownLoad (NLMISC::CBitMemStream &impulse) -{ - std::vector phrases; - - // Read Known Phrases - impulse.serialCont(phrases); - CSPhraseManager *pPM= CSPhraseManager::getInstance(); - for(uint i=0;ibuildPhraseFromSheet(phraseCom, phrases[i].PhraseSheetId.asInt()); - pPM->setPhraseNoUpdateDB(phrases[i].KnownSlot, phraseCom); - } - else - { - pPM->setPhraseNoUpdateDB(phrases[i].KnownSlot, phrases[i].Phrase); - } - } - // must update the DB (NB: if initInGameDone) after all phrase set. - pPM->updateBookDB(); - - // Then Read Memorized Phrases - std::vector memorizedPhrases; - impulse.serialCont(memorizedPhrases); - if (PermanentlyBanned) return; - for(uint i=0;imemorizePhrase( - memorizedPhrases[i].MemoryLineId, - memorizedPhrases[i].MemorySlotId, - memorizedPhrases[i].PhraseId); - } - - // OK. - extern bool SabrinaPhraseBookLoaded; - SabrinaPhraseBookLoaded= true; - - // update gray state, if game inited. - pPM->updateMemoryBar(); -} - -//----------------------------------------------- -// impulsePhraseConfirmBuy -// server confirm/infirm the buy of botchat phrase. -//----------------------------------------------- -void impulsePhraseConfirmBuy (NLMISC::CBitMemStream &impulse) -{ - uint16 phraseId; - bool confirm; - - impulse.serial(phraseId); - impulse.serial(confirm); - - if (PermanentlyBanned) return; - - CSPhraseManager *pSM= CSPhraseManager::getInstance(); - pSM->receiveBotChatConfirmBuy(phraseId, confirm); -} - - -//----------------------------------------------- -// impulsePhraseAckExecuteCyclic -// server confirm/infirm the cyclic execution of a phrase -//----------------------------------------------- -void impulsePhraseAckExecuteCyclic (NLMISC::CBitMemStream &impulse) -{ - uint8 counter; - bool ok; - - impulse.serial(ok); - impulse.serial(counter); - - if (PermanentlyBanned) return; - - - CSPhraseManager *pSM= CSPhraseManager::getInstance(); - pSM->receiveAckExecuteFromServer(true, counter, ok); -} - - -//----------------------------------------------- -// impulsePhraseAckExecuteCyclic -// server confirm/infirm the execution of a phrase -//----------------------------------------------- -void impulsePhraseAckExecuteNext (NLMISC::CBitMemStream &impulse) -{ - uint8 counter; - bool ok; - - impulse.serial(ok); - impulse.serial(counter); - - if (PermanentlyBanned) return; - - CSPhraseManager *pSM= CSPhraseManager::getInstance(); - pSM->receiveAckExecuteFromServer(false, counter, ok); -} - -// Same params as in BOMB_IF -#ifdef FINAL_VERSION -#define SKIP_IF(condition,msg,skipAction) if (!(condition)); else skipAction; -#else -#define SKIP_IF(condition,msg,skipAction) if (!(condition)) WARN(msg); else skipAction; -#endif - -template -void updateInventoryFromStream (NLMISC::CBitMemStream &impulse, const CInventoryCategoryTemplate *templ, bool notifyItemSheetChanges) -{ - try - { - // get the egs tick of this change - TGameCycle serverTick; - impulse.serial(serverTick); - - // For All inventories - for ( uint invId=0; invId!=CInventoryCategoryTemplate::NbInventoryIds; ++invId ) - { - // Presence bit - bool hasContent; - impulse.serialBit( hasContent ); - if ( ! hasContent ) - continue; - - // Number field - uint32 nbChanges; - impulse.serial( nbChanges, INVENTORIES::LowNumberBits ); - if ( nbChanges == INVENTORIES::LowNumberBound ) - impulse.serial( nbChanges, 32 ); - - const string invBranchStr = CInventoryCategoryTemplate::getDbStr( (typename CInventoryCategoryTemplate::TInventoryId)invId ); - ICDBNode::CTextId textId( invBranchStr ); - ICDBNode *inventoryNode = IngameDbMngr.getNodePtr()->getNode( textId, false ); - BOMB_IF(!inventoryNode, "Inventory missing in database", return); - - // List of updates - for ( uint c=0; c!=nbChanges; ++c ) - { - // Unpack (the bitmemstream is written from high-order to low-order) - uint32 iuInfoVersion; - impulse.serial( iuInfoVersion, 1 ); - if ( iuInfoVersion == 1 ) - { - uint32 slotIndex; - impulse.serial( slotIndex, CInventoryCategoryTemplate::SlotBitSize ); - - // Access the database leaf - CCDBNodeBranch *slotNode = safe_cast(inventoryNode->getNode( (uint16)slotIndex )); - CCDBNodeLeaf *leafNode = type_cast(slotNode->find( INVENTORIES::InfoVersionStr )); - BOMB_IF( !leafNode, "Inventory slot property missing in database", continue ); - - // Apply or increment Info Version in database - if ( CInventoryCategoryTemplate::needPlainInfoVersionTransfer() ) - { - uint32 infoVersion; - impulse.serial( infoVersion, INVENTORIES::InfoVersionBitSize ); - leafNode->setPropCheckGC( serverTick, infoVersion ); - } - else - { - // NB: don't need to check GC on a info version upgrade, since this is always a delta of +1 - // the order of received of this impulse is not important - leafNode->setValue64( leafNode->getValue64() + 1 ); - } - - } - else - { - uint32 iuAll; - impulse.serial( iuAll, 1 ); - if ( iuAll == 1 ) - { - INVENTORIES::CItemSlot itemSlot; - itemSlot.serialAll( impulse, templ ); - //nldebug( "Inv %s Update %u", CInventoryCategoryTemplate::InventoryStr[invId], itemSlot.getSlotIndex() ); - - // Apply all properties to database - CCDBNodeBranch *slotNode = safe_cast(inventoryNode->getNode( (uint16)itemSlot.getSlotIndex() )); - for ( uint i=0; i!=INVENTORIES::NbItemPropId; ++i ) - { - CCDBNodeLeaf *leafNode = type_cast(slotNode->find( string(INVENTORIES::CItemSlot::ItemPropStr[i]) )); - SKIP_IF( !leafNode, "Inventory slot property missing in database", continue ); - leafNode->setPropCheckGC( serverTick, (sint64)itemSlot.getItemProp( ( INVENTORIES::TItemPropId)i ) ); - } - } - else - { - uint32 iuOneProp; - impulse.serial( iuOneProp, 1 ); - if ( iuOneProp == 1 ) - { - INVENTORIES::CItemSlot itemSlot; - itemSlot.serialOneProp( impulse, templ ); - //nldebug( "Inv %s Prop %u %s", CInventoryCategoryTemplate::InventoryStr[invId], itemSlot.getSlotIndex(), INVENTORIES::CItemSlot::ItemPropStr[itemSlot.getOneProp().ItemPropId] ); - - // Apply property to database - CCDBNodeBranch *slotNode = safe_cast(inventoryNode->getNode( (uint16)itemSlot.getSlotIndex() )); - CCDBNodeLeaf *leafNode = type_cast(slotNode->find( string(INVENTORIES::CItemSlot::ItemPropStr[itemSlot.getOneProp().ItemPropId]) )); - SKIP_IF( !leafNode, "Inventory slot property missing in database", continue ); - leafNode->setPropCheckGC( serverTick, (sint64)itemSlot.getOneProp().ItemPropValue ); - - } - else // iuReset - { - uint32 slotIndex; - impulse.serial( slotIndex, CInventoryCategoryTemplate::SlotBitSize ); - //nldebug( "Inv %s Reset %u", CInventoryCategoryTemplate::InventoryStr[invId], slotIndex ); - - // Reset all properties in database - CCDBNodeBranch *slotNode = safe_cast(inventoryNode->getNode( (uint16)slotIndex )); - for ( uint i=0; i!=INVENTORIES::NbItemPropId; ++i ) - { - // Instead of clearing all leaves (by index), we must find and clear only the - // properties in TItemPropId, because the actual database leaves may have - // less properties, and because we must not clear the leaf INFO_VERSION. - // NOTE: For example, only player BAG inventory has WORNED leaf. - CCDBNodeLeaf *leafNode = type_cast(slotNode->find( string(INVENTORIES::CItemSlot::ItemPropStr[i]) )); - SKIP_IF( !leafNode, "Inventory slot property missing in database", continue ); - leafNode->setPropCheckGC( serverTick, 0 ); - } - } - } - } - } - } - - CInventoryManager::getInstance()->sortBag(); - } - catch (const Exception &e) - { - nlwarning ("Problem while decoding a DB_UPD_INV msg, skipped: %s", e.what()); - } -} - -//----------------------------------------------- -// impulseUpdateInventory: -//----------------------------------------------- -void impulseUpdateInventory (NLMISC::CBitMemStream &impulse) -{ - updateInventoryFromStream( impulse, (INVENTORIES::CInventoryCategoryForCharacter*)NULL, true ); -}; - -//----------------------------------------------- -// impulseInitInventory: -//----------------------------------------------- -void impulseInitInventory (NLMISC::CBitMemStream &impulse) -{ - sint32 p = impulse.getPos(); - impulseUpdateInventory( impulse ); - IngameDbMngr.setInitPacketReceived(); - nlinfo( "DB_INIT:INV done (%u bytes)", impulse.getPos()-p ); -} - -//----------------------------------------------- -// impulseItemInfoSet: -//----------------------------------------------- -void impulseItemInfoSet (NLMISC::CBitMemStream &impulse) -{ - CItemInfos itemInfos; - impulse.serial(itemInfos); - - getInventory().onReceiveItemInfo(itemInfos); -} - -//----------------------------------------------- -// impulseItemInfoRefreshVersion: -//----------------------------------------------- -void impulseItemInfoRefreshVersion (NLMISC::CBitMemStream &impulse) -{ - uint16 slotId; - uint8 infoVersion; - impulse.serial(slotId); - impulse.serial(infoVersion); - - getInventory().onRefreshItemInfoVersion(slotId, infoVersion); -} - -//----------------------------------------------- -// impulsePrereqInfoSet: -//----------------------------------------------- -void impulsePrereqInfoSet (NLMISC::CBitMemStream &impulse) -{ - CPrerequisitInfos prereqInfos; - uint8 index; - impulse.serial(prereqInfos); - impulse.serial(index); - - //write infos in interface - CBotChatManager::getInstance()->onReceiveMissionInfo(index, prereqInfos); -} - -//----------------------------------------------- -//----------------------------------------------- -void impulseDeathRespawnPoint (NLMISC::CBitMemStream &impulse) -{ - CRespawnPointsMsg msg; - impulse.serial(msg); - if (PermanentlyBanned) return; - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CGroupMap *pMap = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:respawn_map:content:map_content:actual_map")); - if (pMap == NULL) - { - nlwarning("problem cannot find ui:interface:respawn_map:content:map_content:actual_map"); - return; - } - pMap->addRespawnPoints(msg); - - - pMap = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:map:content:map_content:actual_map")); - if (pMap == NULL) - { - nlwarning("problem cannot find ui:interface:map:content:map_content:actual_map"); - return; - } - pMap->addRespawnPoints(msg); -} - -//----------------------------------------------- -//----------------------------------------------- -void impulseDeathRespawn (NLMISC::CBitMemStream &impulse) -{ - // TODO : Bring me to life !!! -} - -//----------------------------------------------- -// impulseDuelInvitation : -//----------------------------------------------- -void impulseDuelInvitation(NLMISC::CBitMemStream &impulse) -{ - uint32 textID; - impulse.serial(textID); - - //nlinfo("impulseCallback : Received DUEL:INVITATION %d", textID); - - if (PermanentlyBanned) return; - - //activate the pop up window - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CGroupContainer *pGC = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:join_duel_proposal")); - if (pGC == NULL) return; - CViewTextID *pVTID = dynamic_cast(pGC->getView("invitor_name")); - if (pVTID == NULL) return; - pVTID->setTextId(textID); - pGC->setActive(true); - CWidgetManager::getInstance()->setTopWindow(pGC); - pGC->updateCoords(); - pGC->center(); - pGC->enableBlink(2); - -}// impulseDuelInvitation // - -//----------------------------------------------- -// impulseDuelCancelInvitation: -//----------------------------------------------- -void impulseDuelCancelInvitation(NLMISC::CBitMemStream &impulse) -{ - if (PermanentlyBanned) return; - //nlinfo("impulseCallback : Received DUEL:CANCEL_INVITATION"); - - //activate the pop up window - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CGroupContainer *pGC = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:join_duel_proposal")); - if (pGC == NULL) return; - pGC->setActive(false); - -}// impulseDuelCancelInvitation // - -//----------------------------------------------- -// impulsePVPChallengeInvitation : -//----------------------------------------------- -void impulsePVPChallengeInvitation(NLMISC::CBitMemStream &impulse) -{ - uint32 textID; - impulse.serial(textID); - - if (PermanentlyBanned) return; - - //nlinfo("impulseCallback : Received PVP_CHALLENGE:INVITATION %d", textID); - - //activate the pop up window - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CGroupContainer *pGC = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:join_pvp_challenge_proposal")); - if (pGC == NULL) return; - CViewTextID *pVTID = dynamic_cast(pGC->getView("invitor_name")); - if (pVTID == NULL) return; - pVTID->setTextId(textID); - pGC->setActive(true); - CWidgetManager::getInstance()->setTopWindow(pGC); - pGC->updateCoords(); - pGC->center(); - pGC->enableBlink(2); - -}// impulsePVPChallengeInvitation // - -//----------------------------------------------- -// impulsePVPChallengeCancelInvitation: -//----------------------------------------------- -void impulsePVPChallengeCancelInvitation(NLMISC::CBitMemStream &impulse) -{ - //nlinfo("impulseCallback : Received PVP_CHALLENGE:CANCEL_INVITATION"); - - //activate the pop up window - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CGroupContainer *pGC = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:join_pvp_challenge_proposal")); - if (pGC == NULL) return; - pGC->setActive(false); - -}// impulsePVPChallengeCancelInvitation // - - - -//----------------------------------------------- -// impulsePVPFactionPushFactionWar: -//----------------------------------------------- -void impulsePVPFactionPushFactionWar(NLMISC::CBitMemStream &impulse) -{ - //nlinfo("impulseCallback : Received PVP_FACTION:PUSH_FACTION_WAR"); - - PVP_CLAN::CFactionWar factionWar; - impulse.serialEnum(factionWar.Clan1); - impulse.serialEnum(factionWar.Clan2); - - CFactionWarManager::getInstance()->addFactionWar(factionWar); -} - - -//----------------------------------------------- -// impulsePVPFactionPopFactionWar: -//----------------------------------------------- -void impulsePVPFactionPopFactionWar(NLMISC::CBitMemStream &impulse) -{ - //nlinfo("impulseCallback : Received PVP_FACTION:POP_FACTION_WAR"); - - PVP_CLAN::CFactionWar factionWar; - impulse.serialEnum(factionWar.Clan1); - impulse.serialEnum(factionWar.Clan2); - - CFactionWarManager::getInstance()->stopFactionWar(factionWar); -} - - -//----------------------------------------------- -// impulsePVPFactionFactionWars: -//----------------------------------------------- -void impulsePVPFactionFactionWars(NLMISC::CBitMemStream &impulse) -{ - //nlinfo("impulseCallback : Received PVP_FACTION:FACTION_WARS"); - - CFactionWarsMsg factionWars; - impulse.serial(factionWars); - - for( uint i=0; iaddFactionWar(factionWars.FactionWarOccurs[i]); - } -} - - - -//----------------------------------------------- -// impulsePVPChooseClan -//----------------------------------------------- -/* -void impulsePVPChooseClan(NLMISC::CBitMemStream &impulse) -{ - nlinfo("impulsePVPChooseClan : Received PVP_CLAN:CHOOSE_CLAN"); - - EGSPD::CPeople::TPeople clan1= EGSPD::CPeople::Unknown, clan2= EGSPD::CPeople::Unknown; - impulse.serialEnum( clan1 ); - impulse.serialEnum( clan2 ); - - if (PermanentlyBanned) return; - - //activate the pop up window - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CGroupContainer *pGC = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:join_pvp_clan_proposal")); - if (pGC == NULL) return; - pGC->setActive(true); - - CCtrlTextButton * butClan1 = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:join_pvp_clan_proposal:content:clan1")); - if( butClan1 == NULL ) - return; - butClan1->setText( ucstring(EGSPD::CPeople::toString( clan1 )) ); - - CCtrlTextButton * butClan2 = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:join_pvp_clan_proposal:content:clan2")); - if( butClan2 == NULL ) - return; - butClan2->setText( ucstring(EGSPD::CPeople::toString( clan2 )) ); -} -*/ - -//----------------------------------------------- -// impulseEncyclopediaUpdate -//----------------------------------------------- -void impulseEncyclopediaUpdate(NLMISC::CBitMemStream &impulse) -{ - //nlinfo("impulseCallback : Received ENCYCLOPEDIA:UPDATE"); - - CEncyclopediaUpdateMsg msg; - impulse.serial(msg); - if (PermanentlyBanned) return; - CEncyclopediaManager::getInstance()->update(msg); -}// impulseEncyclopediaUpdate // - -//----------------------------------------------- -// impulseEncyclopediaInit -//----------------------------------------------- -void impulseEncyclopediaInit(NLMISC::CBitMemStream &impulse) -{ - //nlinfo("impulseCallback : Received ENCYCLOPEDIA:INIT"); - - CEncyclopediaUpdateMsg msg; - impulse.serial(msg); - if (PermanentlyBanned) return; - CEncyclopediaManager::getInstance()->update(msg); -}// impulseEncyclopediaInit // - -//----------------------------------------------- -//----------------------------------------------- -void impulseItemOpenRoomInventory(NLMISC::CBitMemStream &impulse) -{ - if (PermanentlyBanned) return; - // This is a message because we may do other things there - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:INVENTORY_ROOM_OPENED")->setValue32(1); -} - -//----------------------------------------------- -//----------------------------------------------- -void impulseItemCloseRoomInventory(NLMISC::CBitMemStream &impulse) -{ - if (PermanentlyBanned) return; - // This is a message because we may do other things there - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:INVENTORY_ROOM_OPENED")->setValue32(0); - - // deactivate the pop up window - CGroupContainer *pGC = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:inv_room")); - if (pGC == NULL) return; - pGC->setActive(false); -} - -//----------------------------------------------- -//----------------------------------------------- -void impulseUserBars(NLMISC::CBitMemStream &impulse) -{ - uint8 msgNumber; - sint32 hp, sap, sta, focus; - impulse.serial(msgNumber); - impulse.serial(hp); - impulse.serial(sap); - impulse.serial(sta); - impulse.serial(focus); - - if (PermanentlyBanned) return; - - // Setup the user Bars - CBarManager::CBarInfo bi; - CBarManager::getInstance()->setupUserBarInfo(msgNumber, hp, sap, sta, focus); -} - -//----------------------------------------------- -//----------------------------------------------- -void impulseOutpostChooseSide(NLMISC::CBitMemStream &impulse) -{ - // read message - uint8 type; - bool outpostInFire; - bool playerGuildInConflict; - bool playerGuildIsAttacker; - impulse.serial(type); - impulse.serial(outpostInFire); - impulse.serial(playerGuildInConflict); - impulse.serial(playerGuildIsAttacker); - uint32 ownerGuildNameId; - impulse.serial( ownerGuildNameId ); - uint32 attackerGuildNameId; - impulse.serial( attackerGuildNameId ); - uint32 declTimer; - impulse.serial( declTimer ); - - // start - OutpostManager.startPvpJoinProposal((OUTPOSTENUMS::TPVPType)type, outpostInFire, playerGuildInConflict, playerGuildIsAttacker, - ownerGuildNameId, attackerGuildNameId, declTimer); -} - -//----------------------------------------------- -//----------------------------------------------- -void impulseOutpostDeclareWarAck(NLMISC::CBitMemStream &impulse) -{ - bool canValidate; - uint32 docTextId; - uint32 timeStartAttack; - - impulse.serial(canValidate); - impulse.serial(docTextId); - impulse.serial(timeStartAttack); - - // write result in Local DB. - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - - // ack reception - CCDBNodeLeaf *node= NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:OUTPOST:DECLARE_WAR_ACK_RECEIVED"); - if(node) - node->setValueBool(true); - // set result of ACK - node= NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:OUTPOST:DECLARE_WAR_ACK_OK"); - if(node) - node->setValueBool(canValidate); - node= NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:OUTPOST:DECLARE_WAR_ACK_TEXTID"); - if(node) - node->setValue32(docTextId); - node= NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:OUTPOST:DECLARE_WAR_ACK_TIME_RANGE_ATT"); - if(node) - node->setValue32(timeStartAttack); -} - -extern void addWebIGParams(string &url, bool trustedDomain); - -//----------------------------------------------- -//----------------------------------------------- -class CServerMessageBoxOnReceiveTextId : public STRING_MANAGER::IStringWaitCallback -{ -private: - enum TTextType {TitleType= 0, ContentType, NumTextType}; - uint32 _TextId[NumTextType]; - bool _TextReceived[NumTextType]; - bool _AlreadyDisplayed; - - // show the window - void activateMsgBoxWindow() - { - STRING_MANAGER::CStringManagerClient *pSMC= STRING_MANAGER::CStringManagerClient::instance(); - - // get the content string (should have been received!) - ucstring contentStr; - ucstring titleStr; - if(!pSMC->getDynString(_TextId[ContentType], contentStr)) - return; - - if(!pSMC->getDynString(_TextId[TitleType], titleStr)) - return; - - // if the string start with a @{Wxxxx} code, remove it and get the wanted window size - sint w = 256; // default size to 256 !! - bool is_webig = false; - - if(contentStr.size()>=6 && contentStr[0]=='W' && contentStr[1]=='E' && contentStr[2]=='B' - && contentStr[3]==' ' && contentStr[4]==':' && contentStr[5]==' ' ) - { - uint i; - const uint digitStart= 6; - const uint digitMaxEnd= (uint)contentStr.size(); - - is_webig = true; - - for(i = digitStart; i < digitMaxEnd; i++) - { - if(contentStr[i] == ' ') - break; - } - if(i != digitMaxEnd) - { - ucstring web_app = contentStr.substr(digitStart, i-digitStart); - contentStr = ucstring(ClientCfg.WebIgMainDomain + "/") + web_app + ucstring("/index.php?") + contentStr.substr((size_t)i + 1); - } - else - { - contentStr.clear(); - i = digitStart; - } - } - else if(contentStr.size()>=5 && contentStr[0]=='@' && contentStr[1]=='{' && contentStr[2]=='W') - { - uint i; - const uint digitStart= 3; - const uint digitMaxEnd= 8; - for(i=digitStart;i - group = group.substr(9, group.size()-10); - groupHtml = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:"+group+":content:html")); - if (!groupHtml) - { - groupHtml = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:webig:content:html")); - group = "webig"; - } - - if (groupHtml) - { - CGroupContainer *pGC = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:"+group)); - if (pGC) - { - if (contentStr.empty()) - { - pGC->setActive(false); - } - else - { - if (group == "webig") - pGC->setActive(true); - string url = contentStr.toString(); - addWebIGParams(url, true); - groupHtml->browse(url.c_str()); - CWidgetManager::getInstance()->setTopWindow(pGC); - } - } - } - } - else - { - CGroupContainer *pGC = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:server_message_box")); - if (pGC) - { - // show the window with correct width - pGC->setW(w); - pGC->setActive(true); - - // must set the text by hand - CViewText *vt= dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CWidgetManager::getInstance()->getParser()->getDefine("server_message_box_content_view_text"))); - if(vt) - vt->setTextFormatTaged(contentStr); - - // open - CWidgetManager::getInstance()->setTopWindow(pGC); - pGC->invalidateCoords(); - // Yoyo: because of buggued group container, I found that 6 times is a good number.... - for(uint i=0;i<6;i++) - pGC->updateCoords(); - pGC->center(); - pGC->enableBlink(2); - } - } - } - -public: - // called when the string is available - virtual void onDynStringAvailable(uint stringId, const ucstring &value) - { - // don't care if already displayed - if(_AlreadyDisplayed) - return; - - // check if one of waited text - for(uint i=0;i display window - _AlreadyDisplayed= true; - activateMsgBoxWindow(); - } - - // start the waiter - void startWaitTexts(uint32 titleTextId, uint32 docTextId) - { - // reset - _TextId[TitleType]= titleTextId; - _TextId[ContentType]= docTextId; - _TextReceived[TitleType]= false; - _TextReceived[ContentType]= false; - _AlreadyDisplayed= false; - - // start to wait receive of those string (NB: they may be already here, but waitDynStrings calls directly the callback in this case) - STRING_MANAGER::CStringManagerClient *pSMC= STRING_MANAGER::CStringManagerClient::instance(); - pSMC->waitDynString(titleTextId, this); - pSMC->waitDynString(docTextId, this); - } -}; -CServerMessageBoxOnReceiveTextId ServerMessageBoxOnReceiveTextId; - - -void impulseUserPopup(NLMISC::CBitMemStream &impulse) -{ - uint32 titleTextId; - uint32 docTextId; - impulse.serial(titleTextId); - impulse.serial(docTextId); - - // setup TEMP DB for title - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - CCDBNodeLeaf *node= NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:SERVER_POPUP:TITLE"); - if(node) node->setValue32(titleTextId); - - // Open the Popup only when the 2 dyn strings are available - ServerMessageBoxOnReceiveTextId.startWaitTexts(titleTextId, docTextId); -} - -//----------------------------------------------- -//----------------------------------------------- -//extern void impulseCombatFlyingHpDelta(NLMISC::CBitMemStream &impulse); -void impulseCombatFlyingHpDelta(NLMISC::CBitMemStream &impulse) -{ - uint32 entityID; - uint32 rgba; - sint16 hpDelta; - impulse.serial(entityID); - impulse.serial(rgba); - impulse.serial(hpDelta); - CRGBA color((uint8)(rgba>>24&255), (uint8)(rgba>>16&255), (uint8)(rgba>>8&255), (uint8)(rgba&255)); - CEntityCL *entity = EntitiesMngr.getEntityByCompressedIndex(entityID); - if (entity) - entity->addHPOutput(ucstring(toString("%d", hpDelta)), color); -} - -void impulseCombatFlyingTextItemSpecialEffectProc(NLMISC::CBitMemStream &impulse) -{ - uint32 entityID; - uint32 rgba; - uint8 effect; - sint32 param; - impulse.serial(entityID); - impulse.serial(rgba); - impulse.serial(effect); - impulse.serial(param); - CRGBA color((uint8)(rgba>>24&255), (uint8)(rgba>>16&255), (uint8)(rgba>>8&255), (uint8)(rgba&255)); - ucstring text = CI18N::get(toString("uiItemSpecialEffectFlyingText%s", ITEM_SPECIAL_EFFECT::toString((ITEM_SPECIAL_EFFECT::TItemSpecialEffect)effect).c_str())); - strFindReplace(text, "%param", toString("%d", param)); - CEntityCL *entity = EntitiesMngr.getEntityByCompressedIndex(entityID); - if (entity) - entity->addHPOutput(text, color); -} - -void impulseCombatFlyingText(NLMISC::CBitMemStream &impulse) -{ - uint32 entityID; - uint8 tmp; - impulse.serial(entityID); - impulse.serial(tmp); - COMBAT_FLYING_TEXT::TCombatFlyingText type = (COMBAT_FLYING_TEXT::TCombatFlyingText)tmp; - - CRGBA color(255, 255, 255); - ucstring text(""); - float dt = 0.0f; - - switch (type) - { - case COMBAT_FLYING_TEXT::TargetDodge: // The target dodged - color = CRGBA(255, 128, 64); - text = CI18N::get("uiDodge"); - break; - - case COMBAT_FLYING_TEXT::TargetParry: // The target parried - color = CRGBA(255, 128, 64); - text = CI18N::get("uiParry"); - break; - - case COMBAT_FLYING_TEXT::TargetEvade: // Actually the user miss his hit - color = CRGBA(255, 128, 64); - text = CI18N::get("uiEvade"); - break; - - case COMBAT_FLYING_TEXT::SelfEvade: // Actually the target miss his hit - color = CRGBA(255, 255, 0); - text = CI18N::get("uiEvade"); - break; - - case COMBAT_FLYING_TEXT::TargetResist: // The target resisted magic - color = CRGBA(255, 128, 64); - text = CI18N::get("uiResist"); - break; - - case COMBAT_FLYING_TEXT::SelfResist: // The user resisted magic - color = CRGBA(255, 255, 0); - text = CI18N::get("uiResist"); - break; - - case COMBAT_FLYING_TEXT::SelfInterrupt: // the user cast was interupted - color = CRGBA(200, 0, 0); - text = CI18N::get("uiInterrupt"); - dt = 0.4f; - break; - - case COMBAT_FLYING_TEXT::SelfFailure: // The user failed to cast - color = CRGBA(200, 0, 0); - text = CI18N::get("uiFailure"); - break; - - default: // bad type - nlwarning("Bad type for COMBAT_FLYING_TEXT:TCombatFlyingText enum"); - break; - } - - CEntityCL *entity = EntitiesMngr.getEntityByCompressedIndex(entityID); - if (entity) - entity->addHPOutput(text, color, dt); -} - -void impulseSetSeason(NLMISC::CBitMemStream &impulse) -{ - extern uint8 ServerSeasonValue; - extern bool ServerSeasonReceived; - impulse.serial(ServerSeasonValue); - ServerSeasonReceived = true; -} - -void impulseDssDown(NLMISC::CBitMemStream &impulse) -{ - FarTP.onDssDown(); -} - -void impulseSetNpcIconDesc(NLMISC::CBitMemStream &impulse) -{ - uint8 nb8; - impulse.serial(nb8); - bool hasChanged = false; - for (uint i=0; i!=(uint)nb8; ++i) - { - TNPCIconCacheKey npcIconCacheKey; - impulse.serial(npcIconCacheKey); - uint32 state; - impulse.serial(state); - hasChanged = CNPCIconCache::getInstance().onReceiveMissionAvailabilityForThisChar(npcIconCacheKey, (NPC_ICON::TNPCMissionGiverState)state) || hasChanged; // mind the order to avoid partial evaluation - } - if (hasChanged) - CNPCIconCache::getInstance().refreshIconsOfScene(); -} - -void impulseServerEventForMissionAvailability(NLMISC::CBitMemStream &impulse) -{ - CNPCIconCache::getInstance().onEventForMissionAvailabilityForThisChar(); -} - -void impulseSetNpcIconTimer(NLMISC::CBitMemStream &impulse) -{ - NLMISC::TGameCycle delay; - impulse.serial(delay); - CNPCIconCache::getInstance().setMissionGiverTimer(delay); -} - -//----------------------------------------------- -// initializeNetwork : -//----------------------------------------------- -void initializeNetwork() -{ - GenericMsgHeaderMngr.setCallback("DB_UPD_PLR", impulseDatabaseUpdatePlayer); - GenericMsgHeaderMngr.setCallback("DB_INIT:PLR", impulseDatabaseInitPlayer); - GenericMsgHeaderMngr.setCallback("DB_UPD_INV", impulseUpdateInventory); - GenericMsgHeaderMngr.setCallback("DB_INIT:INV", impulseInitInventory); - GenericMsgHeaderMngr.setCallback("DB_GROUP:UPDATE_BANK", impulseDatabaseUpdateBank); - GenericMsgHeaderMngr.setCallback("DB_GROUP:INIT_BANK", impulseDatabaseInitBank); - GenericMsgHeaderMngr.setCallback("DB_GROUP:RESET_BANK", impulseDatabaseResetBank); - GenericMsgHeaderMngr.setCallback("CONNECTION:NO_USER_CHAR", impulseNoUserChar); - GenericMsgHeaderMngr.setCallback("CONNECTION:USER_CHARS", impulseUserChars); - GenericMsgHeaderMngr.setCallback("CONNECTION:USER_CHAR", impulseUserChar); - GenericMsgHeaderMngr.setCallback("CONNECTION:FAR_TP", impulseFarTP); - GenericMsgHeaderMngr.setCallback("CONNECTION:READY", impulseServerReady); - GenericMsgHeaderMngr.setCallback("CONNECTION:VALID_NAME", impulseCharNameValid); - GenericMsgHeaderMngr.setCallback("CONNECTION:SHARD_ID", impulseShardId); - GenericMsgHeaderMngr.setCallback("CONNECTION:SERVER_QUIT_OK", impulseServerQuitOk); - GenericMsgHeaderMngr.setCallback("CONNECTION:SERVER_QUIT_ABORT", impulseServerQuitAbort); - GenericMsgHeaderMngr.setCallback("CONNECTION:MAIL_AVAILABLE", impulseMailNotification); - GenericMsgHeaderMngr.setCallback("CONNECTION:GUILD_MESSAGE_AVAILABLE", impulseForumNotification); - GenericMsgHeaderMngr.setCallback("CONNECTION:PERMANENT_BAN", impulsePermanentBan); - GenericMsgHeaderMngr.setCallback("CONNECTION:UNBAN", impulsePermanentUnban); - - GenericMsgHeaderMngr.setCallback("STRING:CHAT", impulseChat); - GenericMsgHeaderMngr.setCallback("STRING:TELL", impulseTell); - GenericMsgHeaderMngr.setCallback("STRING:FAR_TELL", impulseFarTell); - GenericMsgHeaderMngr.setCallback("STRING:CHAT2", impulseChat2); - GenericMsgHeaderMngr.setCallback("STRING:DYN_STRING", impulseDynString); - GenericMsgHeaderMngr.setCallback("STRING:DYN_STRING_GROUP", inpulseDynStringInChatGroup); - GenericMsgHeaderMngr.setCallback("STRING:TELL2", impulseTell2); -// GenericMsgHeaderMngr.setCallback("STRING:ADD_DYN_STR", impulseAddDynStr); - GenericMsgHeaderMngr.setCallback("TP:DEST", impulseTP); - GenericMsgHeaderMngr.setCallback("TP:DEST_WITH_SEASON", impulseTPWithSeason); - GenericMsgHeaderMngr.setCallback("TP:CORRECT", impulseCorrectPos); - GenericMsgHeaderMngr.setCallback("COMBAT:ENGAGE_FAILED", impulseCombatEngageFailed); - GenericMsgHeaderMngr.setCallback("BOTCHAT:DYNCHAT_OPEN", impulseDynChatOpen); - GenericMsgHeaderMngr.setCallback("BOTCHAT:DYNCHAT_CLOSE", impulseDynChatClose); - - GenericMsgHeaderMngr.setCallback("CASTING:BEGIN", impulseBeginCast); - GenericMsgHeaderMngr.setCallback("TEAM:INVITATION", impulseTeamInvitation); - GenericMsgHeaderMngr.setCallback("TEAM:SHARE_OPEN", impulseTeamShareOpen); - GenericMsgHeaderMngr.setCallback("TEAM:SHARE_INVALID", impulseTeamShareInvalid); - GenericMsgHeaderMngr.setCallback("TEAM:SHARE_CLOSE", impulseTeamShareClose); - GenericMsgHeaderMngr.setCallback("TEAM:CONTACT_INIT", impulseTeamContactInit); - GenericMsgHeaderMngr.setCallback("TEAM:CONTACT_CREATE", impulseTeamContactCreate); - GenericMsgHeaderMngr.setCallback("TEAM:CONTACT_STATUS", impulseTeamContactStatus); - GenericMsgHeaderMngr.setCallback("TEAM:CONTACT_REMOVE", impulseTeamContactRemove); - - GenericMsgHeaderMngr.setCallback("EXCHANGE:INVITATION", impulseExchangeInvitation); - GenericMsgHeaderMngr.setCallback("EXCHANGE:CLOSE_INVITATION", impulseExchangeCloseInvitation); - GenericMsgHeaderMngr.setCallback("ANIMALS:MOUNT_ABORT", impulseMountAbort); - - GenericMsgHeaderMngr.setCallback("DEBUG:REPLY_WHERE", impulseWhere); - GenericMsgHeaderMngr.setCallback("DEBUG:COUNTER", impulseCounter); - - // - GenericMsgHeaderMngr.setCallback("STRING_MANAGER:PHRASE_SEND", impulsePhraseSend); - GenericMsgHeaderMngr.setCallback("STRING_MANAGER:STRING_RESP", impulseStringResp); - GenericMsgHeaderMngr.setCallback("STRING_MANAGER:RELOAD_CACHE", impulseReloadCache); - // - GenericMsgHeaderMngr.setCallback("BOTCHAT:FORCE_END", impulseBotChatForceEnd); - - GenericMsgHeaderMngr.setCallback("JOURNAL:INIT_COMPLETED_MISSIONS", impulseJournalInitCompletedMissions); - GenericMsgHeaderMngr.setCallback("JOURNAL:UPDATE_COMPLETED_MISSIONS", impulseJournalUpdateCompletedMissions); -// GenericMsgHeaderMngr.setCallback("JOURNAL:CANT_ABANDON", impulseJournalCantAbandon); - - GenericMsgHeaderMngr.setCallback("JOURNAL:ADD_COMPASS", impulseJournalAddCompass); - GenericMsgHeaderMngr.setCallback("JOURNAL:REMOVE_COMPASS", impulseJournalRemoveCompass); - - - //GenericMsgHeaderMngr.setCallback("GUILD:SET_MEMBER_INFO", impulseGuildSetMemberInfo); - //GenericMsgHeaderMngr.setCallback("GUILD:INIT_MEMBER_INFO", impulseGuildInitMemberInfo); - - GenericMsgHeaderMngr.setCallback("GUILD:JOIN_PROPOSAL", impulseGuildJoinProposal); - - GenericMsgHeaderMngr.setCallback("GUILD:ASCENSOR", impulseGuildAscensor); - GenericMsgHeaderMngr.setCallback("GUILD:LEAVE_ASCENSOR", impulseGuildLeaveAscensor); - GenericMsgHeaderMngr.setCallback("GUILD:ABORT_CREATION", impulseGuildAbortCreation); - GenericMsgHeaderMngr.setCallback("GUILD:OPEN_GUILD_WINDOW", impulseGuildOpenGuildWindow); - - GenericMsgHeaderMngr.setCallback("GUILD:OPEN_INVENTORY", impulseGuildOpenInventory); - GenericMsgHeaderMngr.setCallback("GUILD:CLOSE_INVENTORY", impulseGuildCloseInventory); - - GenericMsgHeaderMngr.setCallback("GUILD:UPDATE_PLAYER_TITLE", impulseGuildUpdatePlayerTitle); - GenericMsgHeaderMngr.setCallback("GUILD:USE_FEMALE_TITLES", impulseGuildUseFemaleTitles); - //GenericMsgHeaderMngr.setCallback("GUILD:INVITATION", impulseGuildInvitation); - - GenericMsgHeaderMngr.setCallback("HARVEST:CLOSE_TEMP_INVENTORY", impulseCloseTempInv); - - GenericMsgHeaderMngr.setCallback("COMMAND:REMOTE_ADMIN", impulseRemoteAdmin); - - GenericMsgHeaderMngr.setCallback("PHRASE:DOWNLOAD", impulsePhraseDownLoad); - GenericMsgHeaderMngr.setCallback("PHRASE:CONFIRM_BUY", impulsePhraseConfirmBuy); - GenericMsgHeaderMngr.setCallback("PHRASE:EXEC_CYCLIC_ACK", impulsePhraseAckExecuteCyclic); - GenericMsgHeaderMngr.setCallback("PHRASE:EXEC_NEXT_ACK", impulsePhraseAckExecuteNext); - - GenericMsgHeaderMngr.setCallback("ITEM_INFO:SET", impulseItemInfoSet); - GenericMsgHeaderMngr.setCallback("ITEM_INFO:REFRESH_VERSION", impulseItemInfoRefreshVersion); - GenericMsgHeaderMngr.setCallback("MISSION_PREREQ:SET", impulsePrereqInfoSet); - GenericMsgHeaderMngr.setCallback("ITEM:OPEN_ROOM_INVENTORY", impulseItemOpenRoomInventory); - GenericMsgHeaderMngr.setCallback("ITEM:CLOSE_ROOM_INVENTORY", impulseItemCloseRoomInventory); - - GenericMsgHeaderMngr.setCallback("DEATH:RESPAWN_POINT", impulseDeathRespawnPoint); - GenericMsgHeaderMngr.setCallback("DEATH:RESPAWN", impulseDeathRespawn); - - GenericMsgHeaderMngr.setCallback("DUEL:INVITATION", impulseDuelInvitation); - GenericMsgHeaderMngr.setCallback("DUEL:CANCEL_INVITATION", impulseDuelCancelInvitation); - - GenericMsgHeaderMngr.setCallback("PVP_CHALLENGE:INVITATION", impulsePVPChallengeInvitation); - GenericMsgHeaderMngr.setCallback("PVP_CHALLENGE:CANCEL_INVITATION", impulsePVPChallengeCancelInvitation); - - GenericMsgHeaderMngr.setCallback("PVP_FACTION:PUSH_FACTION_WAR", impulsePVPFactionPushFactionWar); - GenericMsgHeaderMngr.setCallback("PVP_FACTION:POP_FACTION_WAR", impulsePVPFactionPopFactionWar); - GenericMsgHeaderMngr.setCallback("PVP_FACTION:FACTION_WARS", impulsePVPFactionFactionWars); - - -// GenericMsgHeaderMngr.setCallback("PVP_VERSUS:CHOOSE_CLAN", impulsePVPChooseClan); - - GenericMsgHeaderMngr.setCallback("ENCYCLOPEDIA:UPDATE", impulseEncyclopediaUpdate); - GenericMsgHeaderMngr.setCallback("ENCYCLOPEDIA:INIT", impulseEncyclopediaInit); - - GenericMsgHeaderMngr.setCallback("USER:BARS", impulseUserBars); - GenericMsgHeaderMngr.setCallback("USER:POPUP", impulseUserPopup); - - - GenericMsgHeaderMngr.setCallback("MISSION:ASK_ENTER_CRITICAL", impulseEnterCrZoneProposal); - GenericMsgHeaderMngr.setCallback("MISSION:CLOSE_ENTER_CRITICAL", impulseCloseEnterCrZoneProposal); - - // Module gateway message - GenericMsgHeaderMngr.setCallback( "MODULE_GATEWAY:FEOPEN", cbImpulsionGatewayOpen); - GenericMsgHeaderMngr.setCallback( "MODULE_GATEWAY:GATEWAY_MSG", cbImpulsionGatewayMessage ); - GenericMsgHeaderMngr.setCallback( "MODULE_GATEWAY:FECLOSE", cbImpulsionGatewayClose ); - - GenericMsgHeaderMngr.setCallback( "OUTPOST:CHOOSE_SIDE", impulseOutpostChooseSide ); - GenericMsgHeaderMngr.setCallback( "OUTPOST:DECLARE_WAR_ACK", impulseOutpostDeclareWarAck ); - - GenericMsgHeaderMngr.setCallback( "COMBAT:FLYING_HP_DELTA", impulseCombatFlyingHpDelta ); - GenericMsgHeaderMngr.setCallback( "COMBAT:FLYING_TEXT_ISE", impulseCombatFlyingTextItemSpecialEffectProc ); - GenericMsgHeaderMngr.setCallback( "COMBAT:FLYING_TEXT", impulseCombatFlyingText ); - - GenericMsgHeaderMngr.setCallback( "SEASON:SET", impulseSetSeason ); - GenericMsgHeaderMngr.setCallback( "RING_MISSION:DSS_DOWN", impulseDssDown ); - - GenericMsgHeaderMngr.setCallback( "NPC_ICON:SET_DESC", impulseSetNpcIconDesc ); - GenericMsgHeaderMngr.setCallback( "NPC_ICON:SVR_EVENT_MIS_AVL", impulseServerEventForMissionAvailability ); - GenericMsgHeaderMngr.setCallback( "NPC_ICON:SET_TIMER", impulseSetNpcIconTimer ); -} - - -//----------------------------------------------- -// impulseCallBack : -// The impulse callback to receive all msg from the frontend. -//----------------------------------------------- -void impulseCallBack(NLMISC::CBitMemStream &impulse, sint32 packet, void *arg) -{ - GenericMsgHeaderMngr.execute(impulse); -} - - -//////////// -// METHOD // -//////////// -//----------------------------------------------- -// CNetManager : -// Constructor. -//----------------------------------------------- -CNetManager::CNetManager() : CNetworkConnection() -{ -#ifdef ENABLE_INCOMING_MSG_RECORDER - _IsReplayStarting = false; -#endif -}// CNetManager // - -//----------------------------------------------- -// update : -// Updates the whole connection with the frontend. -// Call this method evently. -// \return bool : 'true' if data were sent/received. -//----------------------------------------------- -bool CNetManager::update() -{ - H_AUTO_USE ( RZ_Client_Net_Mngr_Update ) - -#ifdef ENABLE_INCOMING_MSG_RECORDER - if(_IsReplayStarting) - return; -#endif - - // If the client is in Local Mode -> no network. - if(ClientCfg.Local) - { - // Init - if(_CurrentServerTick == 0) - { - if(T1 >= _LCT) - { - _MachineTimeAtTick = T1; - _CurrentClientTime = _MachineTimeAtTick - _LCT; - _CurrentClientTick = 0; - _CurrentServerTick = 10; - } - - return false; - } - - if((T1 - _MachineTimeAtTick) >= _MsPerTick) - { - NLMISC::TGameCycle nbTick = (NLMISC::TGameCycle)((T1 - _MachineTimeAtTick)/_MsPerTick); - _CurrentClientTick += nbTick; - _CurrentServerTick += nbTick; - _MachineTimeAtTick += nbTick*_MsPerTick; - } - - // update the smooth server tick for debug - CNetworkConnection::updateSmoothServerTick(); - - // emulation done -#ifdef ENABLE_INCOMING_MSG_RECORDER - return false; -#endif - } - - // Update the base class. - bool result = CNetworkConnection::update(); - // Get changes with the update. - const vector &changes = NetMngr.getChanges(); - - // Manage changes - vector::const_iterator it; - for(it = changes.begin(); it < changes.end(); ++it) - { - const CChange &change = *it; - // Update a property. - if(change.Property < AddNewEntity) - { - if (!IgnoreEntityDbUpdates || change.ShortId == 0) - { - // Update the visual property for the slot. - EntitiesMngr.updateVisualProperty(change.GameCycle, change.ShortId, change.Property, change.PositionInfo.PredictedInterval); - } - else - { - nlwarning("CNetManager::update : Skipping EntitiesMngr.updateVisualProperty() because IgnoreEntityDbUpdates=%s and change.ShortId=%d", (IgnoreEntityDbUpdates?"true":"false"), change.ShortId); - } - } - // Add New Entity (and remove the old one in the slot). - else if(change.Property == AddNewEntity) - { - if (!IgnoreEntityDbUpdates || change.ShortId == 0) - { - // Remove the old entity. - EntitiesMngr.remove(change.ShortId, false); - // Create the new entity. - if(EntitiesMngr.create(change.ShortId, get(change.ShortId), change.NewEntityInfo) == 0) - nlwarning("CNetManager::update : entity in the slot '%u' has not been created.", change.ShortId); - } - else - { - nlwarning("CNetManager::update : Skipping EntitiesMngr.create() because IgnoreEntityDbUpdates=%s and change.ShortId=%d", (IgnoreEntityDbUpdates?"true":"false"), change.ShortId); - } - } - // Delete an entity - else if(change.Property == RemoveOldEntity) - { - if (!IgnoreEntityDbUpdates || change.ShortId == 0) - { - // Remove the old entity. - EntitiesMngr.remove(change.ShortId, true); - } - else - { - nlwarning("CNetManager::update : Skipping EntitiesMngr.remove() because IgnoreEntityDbUpdates=%s and change.ShortId=%d", (IgnoreEntityDbUpdates?"true":"false"), change.ShortId); - } - } - // Lag detected. - else if(change.Property == LagDetected) - { - nldebug("CNetManager::update : Lag detected."); - } - // Probe received. - else if(change.Property == ProbeReceived) - { - nldebug("CNetManager::update : Probe Received."); - } - // Connection ready. - else if(change.Property == ConnectionReady) - { - nldebug("CNetManager::update : Connection Ready."); - } - // Property unknown. - else - nlwarning("CNetManager::update : The property '%d' is unknown.", change.Property); - } - ChatMngr.flushBuffer(InterfaceChatDisplayer); - // Clear all changes. - clearChanges(); - - // Update data base server state - if (IngameDbMngr.getNodePtr()) - { - CInterfaceManager *im = CInterfaceManager::getInstance(); - if (im) - { - CCDBNodeLeaf *node = NULL; - - if (!m_PingLeaf) - m_PingLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:PING", false); - - if (m_PingLeaf) - { - node = &*m_PingLeaf; - if (node) - node->setValue32(getPing()); - } - - if (!m_UploadLeaf) - m_UploadLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:UPLOAD", false); - - if (m_UploadLeaf) - { - node = &*m_UploadLeaf; - if (node) - node->setValue32((sint32)(getMeanUpload()*1024.f/8.f)); - } - - if (!m_DownloadLeaf) - m_DownloadLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:DOWNLOAD", false); - - if (m_DownloadLeaf) - { - node = &*m_DownloadLeaf; - if (node) - node->setValue32((sint32)(getMeanDownload()*1024.f/8.f)); - } - - if (!m_PacketLostLeaf) - m_PacketLostLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:PACKETLOST", false); - - if (m_PacketLostLeaf) - { - node = &*m_PacketLostLeaf; - if (node) - node->setValue32((sint32)getMeanPacketLoss()); - } - - if (!m_ServerStateLeaf) - m_ServerStateLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SERVERSTATE", false); - - if (m_ServerStateLeaf) - { - node = &*m_ServerStateLeaf; - if (node) - node->setValue32((sint32)getConnectionState()); - } - - if (!m_ConnectionQualityLeaf) - m_ConnectionQualityLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:CONNECTION_QUALITY", false); - - if (m_ConnectionQualityLeaf) - { - node = &*m_ConnectionQualityLeaf; - if (node) - node->setValue32((sint32)getConnectionQuality()); - } - } - } - - // Return 'true' if data were sent/received. - return result; - - -}// update // - -//----------------------------------------------- -// getConnectionQuality : -//----------------------------------------------- -bool CNetManager::getConnectionQuality() -{ - // If the client is in Local Mode -> no network. - if(ClientCfg.Local) - return true; - - return CNetworkConnection::getConnectionQuality(); -}// getConnectionQuality // - - -/** - * Buffers a bitmemstream, that will be converted into a generic action, to be sent later to the server (at next update). - */ -void CNetManager::push(NLMISC::CBitMemStream &msg) -{ - // If the client is in Local Mode -> no network. - if(ClientCfg.Local) - return; - - if (PermanentlyBanned) return; - - CNetworkConnection::push(msg); -} - -/** - * Buffers a target action - */ -void CNetManager::pushTarget(CLFECOMMON::TCLEntityId slot) -{ - // If the client is in Local Mode -> no network. - if(ClientCfg.Local) - { - if(UserEntity->mode() != MBEHAV::COMBAT - && UserEntity->mode() != MBEHAV::COMBAT_FLOAT) - { - UserEntity->targetSlot(slot); - } - return; - } - - CNetworkConnection::pushTarget(slot, LHSTATE::NONE); -} - - -/** - * Buffers a pick-up action - */ -void CNetManager::pushPickup(CLFECOMMON::TCLEntityId slot, LHSTATE::TLHState lootOrHarvest) -{ - // If the client is in Local Mode -> no network. - if(ClientCfg.Local) - { - return; - } - - CNetworkConnection::pushTarget(slot, lootOrHarvest); -} - - -/** - * Send - */ -void CNetManager::send(NLMISC::TGameCycle gameCycle) -{ - // If the client is in Local Mode -> no network. - if(ClientCfg.Local) - return; - - // wait till next server is received - if (_LastSentCycle >= gameCycle) - { - //nlinfo ("Try to CNetManager::send(%d) _LastSentCycle=%d more than one time with the same game cycle, so we wait new game cycle to send", gameCycle, _LastSentCycle); - while (_LastSentCycle >= gameCycle) - { - // Update network. - update(); - // Send dummy info - send(); - // Do not take all the CPU. - nlSleep(100); - - gameCycle = getCurrentServerTick(); - } - } - - CNetworkConnection::send(gameCycle); -} - -/** - * Send - */ -void CNetManager::send() -{ - // If the client is in Local Mode -> no network. - if(ClientCfg.Local) - return; - - CNetworkConnection::send(); -} - -/** - * Disconnects the current connection - */ -void CNetManager::disconnect() -{ - // If the client is in Local Mode -> no need to disconnect. - if(ClientCfg.Local) - return; - - CNetworkConnection::disconnect(); -}// disconnect // - - -/** - * Reset data and init the socket - */ -void CNetManager::reinit() -{ - if(ClientCfg.Local) - return; - - IngameDbMngr.resetInitState(); - CNetworkConnection::reinit(); -} - -void CNetManager::waitForServer() -{ - sint LastGameCycle = getCurrentServerTick(); - - for(;;) - { - // Event server get events - CInputHandlerManager::getInstance()->pumpEventsNoIM(); - // Update Network. - update(); - - if (LastGameCycle != (sint) getCurrentServerTick()) - break; - - nlSleep(100); - send(); - } - -}// waitForServer // - - -#ifdef ENABLE_INCOMING_MSG_RECORDER -//----------------------------------------------- -// setReplayingMode : -//----------------------------------------------- -void CNetManager::setReplayingMode( bool onOff, const std::string& filename ) -{ - CNetworkConnection::setReplayingMode(onOff, filename); - _IsReplayStarting = onOff; -}// setReplayingMode // - -//----------------------------------------------- -// startReplay : -//----------------------------------------------- -void CNetManager::startReplay() -{ - // Init Replay - _MachineTimeAtTick = T1; - if(_MachineTimeAtTick >= _LCT) - _CurrentClientTime = _MachineTimeAtTick - _LCT; - else - _CurrentClientTime = 0; - // Replay now in progress. - _IsReplayStarting = false; -}// startReplay // -#endif - - -/* - * Create the net managers in CLIENT_MULTI mode - */ -void CNetManagerMulti::init( const std::string& cookie, const std::string& addr ) -{ - uint nb, baseCookie; - NLMISC::CConfigFile::CVar *var = ClientCfg.ConfigFile.getVarPtr( "NbConnections" ); - if ( var ) - nb = var->asInt(); - else - nb = 1; - var = ClientCfg.ConfigFile.getVarPtr( "UserId" ); - if ( var ) - baseCookie = var->asInt(); - else - baseCookie = 0; - std::vector fsAddrs; - fsAddrs.push_back( addr ); - string portString = addr.substr( addr.find( ':' ) ); - var = ClientCfg.ConfigFile.getVarPtr( "AdditionalFSList" ); - if ( var ) - { - for ( uint i=0; i!=var->size(); ++i ) - fsAddrs.push_back( var->asString( i ) + portString ); - } - nlinfo( "CNetManagerMulti: Creating %u connections to %u front-ends, baseCookie=%u...", nb, fsAddrs.size(), baseCookie ); - - for ( uint i=0; i!=nb; ++i ) - { - CNetManager *nm = new CNetManager(); - string multicook = NLMISC::toString( "%8x|%8x|%8x", 0, 0, baseCookie + i ); - nm->init( multicook, fsAddrs[i % fsAddrs.size()] ); - _NetManagers.push_back( nm ); - } -} - -// -uint32 ShardId = 0; -std::string WebServer; - - - - -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -/////////// COMMANDS after should NOT appear IN the FINAL VERSION /////////// -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// - - -#if !FINAL_VERSION - -// temp : simulate a team msg in local mode -NLMISC_COMMAND(localTellTeam, "Temp : simulate a tell in local mode", " ") -{ - if (args.empty()) return false; - ucstring player = args[0]; - std::string msg; - if (args.size() >= 2) - { - msg = args[1]; - for(uint k = 2; k < args.size(); ++k) - { - msg += " " + args[k]; - } - } - TDataSetIndex dsi = INVALID_DATASET_INDEX; - InterfaceChatDisplayer.displayChat(dsi, ucstring(msg), ucstring(msg), CChatGroup::team, NLMISC::CEntityId::Unknown, player); - return true; -} - -// temp : simulate a tell in local mode -NLMISC_COMMAND(localTell, "Temp : simulate a tell in local mode", " ") -{ - if (args.empty()) return false; - ucstring player = args[0]; - std::string msg; - if (args.size() >= 2) - { - msg = args[1]; - for(uint k = 2; k < args.size(); ++k) - { - msg += " " + args[k]; - } - } -// TDataSetIndex dsi = INVALID_DATASET_ROW; - InterfaceChatDisplayer.displayTell(/*dsi, */ucstring(msg), player); - return true; -} - -NLMISC_COMMAND(testDynChatOpen, "", "") -{ - NLMISC::CBitMemStream bm; - if (bm.isReading()) bm.invert(); - uint32 BotUID = 22; // Compressed Index - uint32 BotName = 654; // Server string - vector DynStrs; // 0 - Desc, 1 - Option0, 2 - Option1, etc.... - DynStrs.push_back(16540); - DynStrs.push_back(11465); - DynStrs.push_back(12654); - bm.serial(BotUID); - bm.serial(BotName); - bm.serialCont(DynStrs); - bm.invert(); - bm.seek(0, NLMISC::IStream::begin); - impulseDynChatOpen(bm); - return true; -} - -NLMISC_COMMAND(testDynChatClose, "", "") -{ - NLMISC::CBitMemStream bm; - if (bm.isReading()) bm.invert(); - uint32 BotUID = 22; // Compressed Index - bm.serial(BotUID); - bm.invert(); - bm.seek(0, NLMISC::IStream::begin); - impulseDynChatClose(bm); - return true; -} - - -NLMISC_COMMAND(testCloseTempInv, "","") -{ - NLMISC::CBitMemStream bm; - impulseCloseTempInv(bm); - return true; -} - -NLMISC_COMMAND(testTeamInvite, "","") -{ - NLMISC::CBitMemStream bm; - if (bm.isReading()) bm.invert(); - uint32 index = 10; - bm.serial(index); - bm.invert(); - bm.seek(0, NLMISC::IStream::begin); - impulseTeamInvitation(bm); - return true; -} -NLMISC_COMMAND(testGuildInvite, "","") -{ - NLMISC::CBitMemStream bm; - if (bm.isReading()) bm.invert(); - uint32 index = 10; - bm.serial(index); - bm.serial(index); - bm.invert(); - bm.seek(0, NLMISC::IStream::begin); - impulseGuildJoinProposal(bm); - return true; -} - -NLMISC_COMMAND( testExchangeInvitation, "Test the modal window for invitation exchange", "" ) -{ - CBitMemStream impulse; - uint32 nameIndex = 0; - impulse.serial(nameIndex); - impulse.invert(); - impulseExchangeInvitation(impulse); - return true; -} - - -NLMISC_COMMAND(testAscensor, "Temp : Simulate a GUILD:ASCENSOR message coming from server","") -{ - NLMISC::CBitMemStream bm; - if (bm.isReading()) bm.invert(); - uint32 index = 10; - bm.serial(index); - bm.invert(); - bm.seek(0, NLMISC::IStream::begin); - impulseGuildAscensor(bm); - return true; -} - -NLMISC_COMMAND(testDuelInvite, "","") -{ - NLMISC::CBitMemStream bm; - if (bm.isReading()) bm.invert(); - uint32 index = 10; - bm.serial(index); - bm.invert(); - bm.seek(0, NLMISC::IStream::begin); - impulseDuelInvitation(bm); - return true; -} - -//NLMISC_COMMAND(receiveId, ""," ") -//{ -// uint32 index; -// fromString(args[0], index); -// ucstring ucstr = args[1]; -// -// vector code; -// -//#ifdef OLD_STRING_SYSTEM -// ChatMngr.getDynamicDB().add( index, ucstr, code ); -//#else -// // TRAP // WE MUST NEVER CALL THIS COMMAND ANYMORE : ALL IS HANDLED BY STRING_MANAGER NOW !!! -// nlstop; -//#endif -// -// return true; -//} - -NLMISC_COMMAND(testOutpostChooseSide, "","b b u32 u32") -{ - if(args.size()<4) - return false; - NLMISC::CBitMemStream bm; - if (bm.isReading()) bm.invert(); - bool playerGuildInConflict; - fromString(args[0], playerGuildInConflict); - bool playerGuildIsAttacker; - fromString(args[1], playerGuildIsAttacker); - bm.serial(playerGuildInConflict); - bm.serial(playerGuildIsAttacker); - uint32 ownerGuildNameId; - fromString(args[2], ownerGuildNameId); - bm.serial( ownerGuildNameId ); - uint32 attackerGuildNameId; - fromString(args[3], attackerGuildNameId); - bm.serial( attackerGuildNameId ); - uint32 declTimer= 100; - bm.serial( declTimer ); - - bm.invert(); - bm.seek(0, NLMISC::IStream::begin); - impulseOutpostChooseSide(bm); - return true; -} - -NLMISC_COMMAND(testUserPopup, "","u32 u32") -{ - if(args.size()<2) - return false; - NLMISC::CBitMemStream bm; - if (bm.isReading()) bm.invert(); - uint32 titleId; - fromString(args[0], titleId); - bm.serial( titleId ); - uint32 textId; - fromString(args[1], textId); - bm.serial( textId ); - - bm.invert(); - bm.seek(0, NLMISC::IStream::begin); - impulseUserPopup(bm); - return true; -} - - -#endif - diff --git a/code/ryzom/client/src/user_entity.cpp b/code/ryzom/client/src/user_entity.cpp deleted file mode 100644 index 0ddd61c41..000000000 --- a/code/ryzom/client/src/user_entity.cpp +++ /dev/null @@ -1,4542 +0,0 @@ -// Ryzom - MMORPG Framework -// Copyright (C) 2010-2019 Winch Gate Property Limited -// -// This source file has been modified by the following contributors: -// Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) -// Copyright (C) 2013-2019 Jan BOON (Kaetemi) -// -// 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 // -///////////// -#include "stdpch.h" -// Misc. -#include "nel/misc/vectord.h" -#include "nel/misc/matrix.h" -#include "nel/misc/quat.h" -// 3D Interface. -#include "nel/3d/u_scene.h" -#include "nel/3d/u_visual_collision_manager.h" -#include "nel/3d/viewport.h" -#include "nel/3d/u_bone.h" -#include "nel/3d/u_instance_material.h" -#include "nel/3d/u_play_list.h" -#include "nel/3d/u_point_light.h" -#include "nel/3d/u_particle_system_instance.h" -#include "nel/3d/u_camera.h" -// Pacs Interface -#include "nel/pacs/u_global_position.h" -// Client. -#include "user_entity.h" -#include "motion/user_controls.h" -#include "pacs_client.h" -#include "net_manager.h" -#include "time_client.h" -#include "entity_animation_manager.h" -#include "sheet_manager.h" -#include "sound_manager.h" -#include "interface_v3/interface_manager.h" -#include "entities.h" -#include "debug_client.h" -#include "misc.h" -#include "interface_v3/bot_chat_manager.h" -#include "fx_manager.h" -#include "main_loop.h" -#include "interface_v3/group_in_scene_bubble.h" -#include "interface_v3/inventory_manager.h" -#include "nel/gui/group_html.h" -#include "interface_v3/people_interraction.h" -#include "init_main_loop.h" -#include "view.h" -#include "interface_v3/sphrase_manager.h" -#include "interface_v3/sbrick_manager.h" -#include "interface_v3/action_phrase_faber.h" -#include "interface_v3/bar_manager.h" -#include "interface_v3/skill_manager.h" -#include "far_tp.h" -#include "npc_icon.h" -// game share -#include "game_share/slot_types.h" -#include "game_share/player_visual_properties.h" -#include "game_share/mode_and_behaviour.h" -#include "game_share/inventories.h" -#include "game_share/animal_type.h" -#include "game_share/bot_chat_types.h" -// Sound animation -#include "nel/sound/sound_anim_manager.h" -#include "nel/sound/sound_animation.h" -#include "nel/sound/sound_anim_marker.h" -// r2 -#include "r2/editor.h" - -#ifdef DEBUG_NEW -#define new DEBUG_NEW -#endif - -/////////// -// USING // -/////////// -using namespace NLMISC; -using namespace NLPACS; -using namespace std; -using NL3D::UScene; -using NL3D::UVisualCollisionManager; -using NL3D::UTextContext; - - -//////////// -// EXTERN // -//////////// -extern UScene *Scene; -extern UVisualCollisionManager *CollisionManager; -extern CEntityAnimationManager *EAM; -extern UTextContext *TextContext; -extern NL3D::UCamera MainCam; - -// Context help -extern void contextHelp (const std::string &help); - -extern void beastOrder (const std::string &orderStr, const std::string &beastIndexStr, bool confirmFree = true); - -// Out game received position -NLMISC::CVectorD UserEntityInitPos; -NLMISC::CVector UserEntityInitFront; -CUserEntity *UserEntity = NULL; - -uint32 CharFirstConnectedTime = 0; -uint32 CharPlayedTime = 0; - -const double MaxExtractionDistance = 1.0f; - -//////////// -// GLOBAL // -//////////// - -// Hierarchical timer -H_AUTO_DECL ( RZ_Client_Update_Sound ) - -////////////// -// FUNCTION // -////////////// -//string chooseRandom( const vector& sounds, uint32& previousIndex ); - -//----------------------------------------------- -// CUserEntity : -// Constructor. -//----------------------------------------------- -CUserEntity::CUserEntity() -: CPlayerCL() -{ - Type = User; - _Run = false; - _RunWhenAble = false; - _WalkVelocity = 1.0f; - _RunVelocity = 2.0f; - _CurrentVelocity = _WalkVelocity; - - _FrontVelocity = 0.0f; - _LateralVelocity = 0.0f; - - _SpeedServerAdjust = 1.0f; - - // \todo GUIGUI : do it more generic. - _First_Pos = false; - - // No selection, trader, interlocutor at the beginning. - _Selection = CLFECOMMON::INVALID_SLOT; - _Trader = CLFECOMMON::INVALID_SLOT; - _Interlocutor = CLFECOMMON::INVALID_SLOT; - - // Not selectable at the beginning. - _Selectable = false; - - // Your are not on a mount at the beginning. - _OnMount = false; - _HiddenMount = CLFECOMMON::INVALID_SLOT; - - _AnimAttackOn = false; - - _ViewMode = FirstPV; - _PermanentDeath = false; - _FollowMode = false; - - _CheckPrimitive = 0; - // The user is not in collision with someone else. - _ColOn = false; - // Collisions are not removed. - _ColRemoved = false; - - // No Move To at the beginning. - _MoveToSlot = CLFECOMMON::INVALID_SLOT; - _MoveToAction= CUserEntity::None; - _MoveToDist= 0.0; - _MoveToColStartTime= 0; - - _FollowForceHeadPitch= false; - - _ForceLookSlot= CLFECOMMON::INVALID_SLOT; - _LastExecuteCombatSlot= CLFECOMMON::INVALID_SLOT; - - _R2CharMode= R2::TCharMode::Player; - -}// CUserEntity // - - -//----------------------------------------------- -// ~CUserEntity : -// Destructor. -//----------------------------------------------- -CUserEntity::~CUserEntity() -{ - // Remove observers - _SpeedFactor.release(); - _MountHunger.release(); - _MountSpeeds.release(); - - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - - { - CCDBNodeLeaf *node = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:USER:IS_INVISIBLE", false); - if (node) - { - ICDBNode::CTextId textId; - node->removeObserver(&_InvisibleObs, textId); - } - } - - for(uint i=0;igetDbProp(toString("SERVER:USER:SKILL_POINTS_%d:VALUE", i), false); - if(node) - { - ICDBNode::CTextId textId; - node->removeObserver(_SkillPointObs+i, textId); - } - } - - for( uint i=0; i<_FamesObs.size(); ++i ) - { - uint32 factionIndex = _FamesObs[i]->FactionIndex; - uint32 fameIndexInDatabase = CStaticFames::getInstance().getDatabaseIndex(factionIndex); - string sDBPath = toString("SERVER:FAME:PLAYER%d:VALUE",fameIndexInDatabase); - - CCDBNodeLeaf * node = NLGUI::CDBManager::getInstance()->getDbProp(sDBPath, false); - if(node) - { - ICDBNode::CTextId textId; - node->removeObserver(_FamesObs[i], textId); - } - } - contReset(_FamesObs); - - CNPCIconCache::getInstance().removeObservers(); - - // Remove the Primitive used for check (because ~CEntityCL() will call CEntityCL::removePrimitive(), not CUserEntity::removePrimitive()) - removeCheckPrimitive(); - - CNPCIconCache::release(); - -}// ~CUserEntity // - -//----------------------------------------------- -// initProperties : -// Initialize properties of the entity (according to the class). -//----------------------------------------------- -void CUserEntity::initProperties() -{ - properties().selectable(true); -}// initProperties // - - -//----------------------------------------------- -// build : -// Build the entity from a sheet. -//----------------------------------------------- -bool CUserEntity::build(const CEntitySheet *sheet) // virtual -{ - // Init received position - pos(UserEntityInitPos); - front(UserEntityInitFront); - dir(front()); - setHeadPitch(0); - - // Cast the sheet in the right type. - _PlayerSheet = dynamic_cast(sheet); - if(_PlayerSheet == 0) - { - pushDebugStr("User Sheet is not a valid '.race_stats'."); - return false; - } - else - pushInfoStr("User Sheet is a valid '.race_stats'."); - // Get the DB Entry - if(IngameDbMngr.getNodePtr()) - { - CCDBNodeBranch *nodeRoot = dynamic_cast(IngameDbMngr.getNodePtr()->getNode(0)); - if(nodeRoot) - { - _DBEntry = dynamic_cast(nodeRoot->getNode(_Slot)); - if(_DBEntry == 0) - pushDebugStr("Cannot get a pointer on the DB entry."); - } - } - - disableFollow(); - // Walk/Run ? - if(ClientCfg.RunAtTheBeginning != _Run) - switchVelocity(); - - // Set the up of the user. - up(CVector(0,0,1)); - - // Init User infos. - eyesHeight(ClientCfg.EyesHeight); - walkVelocity(ClientCfg.Walk); - runVelocity(ClientCfg.Run); - - // Compute the first automaton. - _CurrentAutomaton = automatonType() + "_normal.automaton"; - - // Build the PACS Primitive. - if(initPrimitive(0.5f, 2.0f, 0.0f, 0.0f, UMovePrimitive::Slide, (UMovePrimitive::TTrigger)(UMovePrimitive::OverlapTrigger | UMovePrimitive::EnterTrigger), MaskColPlayer, MaskColPlayer | MaskColNpc | MaskColDoor)) - _Primitive->insertInWorldImage(dynamicWI); - - // Compute the element to be able to snap the entity to the ground. - computeCollisionEntity(); - - // Initialize properties of the client. - initProperties(); - - // Initialize the observer for the speed factor and mount stuff - _SpeedFactor.init(); - _MountHunger.init(); - _MountSpeeds.init(); - - // Create the user playlist - createPlayList(); - - // Initialize the internal time. - _LastFrameTime = ((double)T1) * 0.001; - - // Set the gender in local mode. - if(ClientCfg.Local) - { - _Mode = MBEHAV::NORMAL; - _ModeWanted = MBEHAV::NORMAL; - _Gender = ClientCfg.Sex; - SPropVisualA visualA = buildPropVisualA(_PlayerSheet->GenderInfos[_Gender]); - SPropVisualB visualB = buildPropVisualB(_PlayerSheet->GenderInfos[_Gender]); - SPropVisualC visualC; - visualA.PropertySubData.Sex = _Gender; - visualC.PropertyC = 0; - visualC.PropertySubData.CharacterHeight = 0; - visualC.PropertySubData.ArmsWidth = 7; - visualC.PropertySubData.LegsWidth = 7; - visualC.PropertySubData.TorsoWidth = 7; - visualC.PropertySubData.BreastSize = 7; - // Set the Database - sint64 *prop = (sint64 *)&visualA; - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:Entities:E0:P"+toString("%d", CLFECOMMON::PROPERTY_VPA))->setValue64(*prop); // Set the database - prop = (sint64 *)&visualB; - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:Entities:E0:P"+toString("%d", CLFECOMMON::PROPERTY_VPB))->setValue64(*prop); // Set the database - prop = (sint64 *)&visualC; - NLGUI::CDBManager::getInstance()->getDbProp("SERVER:Entities:E0:P"+toString("%d", CLFECOMMON::PROPERTY_VPC))->setValue64(*prop); // Set the database - // Apply Changes. - updateVisualProperty(0, CLFECOMMON::PROPERTY_VPA); - } - // \todo GUIGUI Retrieve the player's appearence during the avatar selection. - // Get Visual Properties From the character selection window. - else - { - } - - // Rebuild interface - buildInSceneInterface (); - - // Add observer on invisible property - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - { - CCDBNodeLeaf *node = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:USER:IS_INVISIBLE", false); - if (node) - { - ICDBNode::CTextId textId; - node->addObserver(&_InvisibleObs, textId); - } - } - - // Add an observer on skill points - for(uint i=0;igetDbProp(toString("SERVER:USER:SKILL_POINTS_%d:VALUE", i), false); - if(node) - { - ICDBNode::CTextId textId; - node->addObserver(_SkillPointObs+i, textId); - } - } - - // Add an observer on Fames - for( uint i=(uint)PVP_CLAN::BeginClans; i<=(uint)PVP_CLAN::EndClans; ++i ) - { - uint32 factionIndex = PVP_CLAN::getFactionIndex((PVP_CLAN::TPVPClan)i); - uint32 fameIndexInDatabase = CStaticFames::getInstance().getDatabaseIndex(factionIndex); - string sDBPath = toString("SERVER:FAME:PLAYER%d:VALUE",fameIndexInDatabase); - - CFameObserver * fameObs = new CFameObserver(); - if( fameObs ) - { - fameObs->FactionIndex = factionIndex; - CCDBNodeLeaf * node = NLGUI::CDBManager::getInstance()->getDbProp(sDBPath, false); - if(node) - { - ICDBNode::CTextId textId; - node->addObserver(fameObs, textId); - } - _FamesObs.push_back(fameObs); - } - } - - // Add an observer on Mission Journal - CNPCIconCache::getInstance().addObservers(); - - // Initialize the camera distance. - View.cameraDistance(ClientCfg.CameraDistance); - - // char and account time properties - CSkillManager *pSM = CSkillManager::getInstance(); - if( pSM ) - { - pSM->tryToUnblockTitleFromCharOldness( CharFirstConnectedTime ); - pSM->tryToUnblockTitleFromCharPlayedTime( CharPlayedTime ); - } - - // Entity created. - return true; -}// build // - - -//----------------------------------------------- -// eyesHeight : -// \todo GUIGUI : do it better in mount mode -//----------------------------------------------- -float CUserEntity::eyesHeight() -{ - if(!_OnMount) - return _EyesHeight * _CharacterScalePos; - else - return _EyesHeight * _CharacterScalePos; -}// eyesHeight // - - -///////////////////////////////////////////////// -///////////////////////////////////////////////// -/////////////// VISUAL PROPERTIES /////////////// -///////////////////////////////////////////////// -///////////////////////////////////////////////// -//----------------------------------------------- -// updateVisualPropertyPos : -// Update Entity Position. -//----------------------------------------------- -void CUserEntity::updateVisualPropertyPos(const NLMISC::TGameCycle &/* gameCycle */, const sint64 &/* prop */, const NLMISC::TGameCycle &/* pI */) -{ -}// updateVisualPropertyPos // - -//----------------------------------------------- -// updateVisualPropertyOrient : -// Update Entity Orientation. -//----------------------------------------------- -void CUserEntity::updateVisualPropertyOrient(const NLMISC::TGameCycle &/* gameCycle */, const sint64 &/* prop */) -{ -}// updateVisualPropertyOrient // - - -void CUserEntity::updateVisualPropertyTargetList(const NLMISC::TGameCycle &/* gameCycle */, const sint64 &/* prop */, uint /* listIndex */) -{ -} - -void CUserEntity::updateVisualPropertyVisualFX(const NLMISC::TGameCycle &/* gameCycle */, const sint64 &prop) -{ - applyVisualFX(prop); -} - -//----------------------------------------------- -// updateVisualPropertyBehaviour : -// Update Entity Behaviour. -//----------------------------------------------- -void CUserEntity::updateVisualPropertyBehaviour(const NLMISC::TGameCycle &/* gameCycle */, const sint64 &prop) -{ - // Compute the behaviour. - CBehaviourContext bc; - bc.Behav = MBEHAV::CBehaviour(prop); - bc.BehavTime = TimeInSec; - if(VerboseAnimUser) - { - nlinfo("UE::updateVPBeha: '%d(%s)'.", (sint)bc.Behav.Behaviour, MBEHAV::behaviourToString(bc.Behav.Behaviour).c_str()); - } - CCDBNodeLeaf *targetList0 = dynamic_cast(_DBEntry->getNode(CLFECOMMON::PROPERTY_TARGET_LIST_0)); - CCDBNodeLeaf *targetList1 = dynamic_cast(_DBEntry->getNode(CLFECOMMON::PROPERTY_TARGET_LIST_1)); - CCDBNodeLeaf *targetList2 = dynamic_cast(_DBEntry->getNode(CLFECOMMON::PROPERTY_TARGET_LIST_1)); - CCDBNodeLeaf *targetList3 = dynamic_cast(_DBEntry->getNode(CLFECOMMON::PROPERTY_TARGET_LIST_1)); - if (targetList0 && targetList1 && targetList2 && targetList3) - { - uint64 vp[4] = - { - (uint64) targetList0->getValue64(), - (uint64) targetList1->getValue64(), - (uint64) targetList2->getValue64(), - (uint64) targetList3->getValue64() - }; - bc.Targets.unpack(vp, 4); - } - applyBehaviour(bc); -}// updateVisualPropertyBehaviour // - -//----------------------------------------------- -// updateVisualPropertyName : -// Update Entity Name. -//----------------------------------------------- -void CUserEntity::updateVisualPropertyName(const NLMISC::TGameCycle &gameCycle, const sint64 &prop) -{ - uint32 oldNameId = _NameId; - - CPlayerCL::updateVisualPropertyName(gameCycle, prop); - - // Name changed ? -/* if (oldNameId != _NameId) - { - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CInterfaceElement *element = CWidgetManager::getInstance()->getElementFromId("ui:interface:mailbox:content:html"); - if (element) - { - CGroupHTML *html = dynamic_cast(element); - if (html) - html->browse("home"); - } - } -*/ -}// updateVisualPropertyName // - -//----------------------------------------------- -// updateVisualPropertyTarget : -// Update Entity Target. -//----------------------------------------------- -void CUserEntity::updateVisualPropertyTarget(const NLMISC::TGameCycle &/* gameCycle */, const sint64 &/* prop */) -{ - // Don't override the Player Target, cause client side entirely => no lag. - //targetSlot((CLFECOMMON::TCLEntityId)prop); -}// updateVisualPropertyTarget // - -//----------------------------------------------- -// updateVisualPropertyMode : -// New mode received -> immediately change the mode for the user. -// \warning Read the position or orientation from the database when reading the mode (no more updated in updateVisualPropertyPos and updateVisualPropertyOrient). -//----------------------------------------------- -void CUserEntity::updateVisualPropertyMode(const NLMISC::TGameCycle &/* gameCycle */, const sint64 &prop) -{ - // Combat Float Check - if((MBEHAV::EMode)prop == MBEHAV::COMBAT_FLOAT) - { - nlwarning("UE:updateVPMode: the user should never have the COMBAT_FLOAT mode."); - return; - } - // New Mode Received. - _TheoreticalMode = (MBEHAV::EMode)prop; - // Change the user mode. - mode(_TheoreticalMode); -}// updateVisualPropertyMode // - -//----------------------------------------------- -// updateVisualPropertyVpa : -// Update Entity Visual Property A -//----------------------------------------------- -void CUserEntity::updateVisualPropertyVpa(const NLMISC::TGameCycle &gameCycle, const sint64 &prop) -{ - CPlayerCL::updateVisualPropertyVpa(gameCycle, prop); - - // Special for user: Disable Character Lod, because always want it at full rez. - if(!_Skeleton.empty()) - { - _Skeleton.setLodCharacterShape(-1); - } - - updateVisualDisplay(); -}// updateVisualPropertyVpa // - -//----------------------------------------------- -// updateVisualPropertyVpb : -// Update Entity Visual Property B -//----------------------------------------------- -void CUserEntity::updateVisualPropertyVpb(const NLMISC::TGameCycle &gameCycle, const sint64 &prop) -{ - CPlayerCL::updateVisualPropertyVpb(gameCycle, prop); - updateVisualDisplay(); -}// updateVisualPropertyVpb // - -//----------------------------------------------- -// updateVisualPropertyVpc : -// Update Entity Visual Property C -//----------------------------------------------- -void CUserEntity::updateVisualPropertyVpc(const NLMISC::TGameCycle &gameCycle, const sint64 &prop) -{ - CPlayerCL::updateVisualPropertyVpc(gameCycle, prop); - updateVisualDisplay(); -}// updateVisualPropertyVpc // - -//----------------------------------------------- -// updateVisualPropertyEntityMounted : -// Update Entity Mount -//----------------------------------------------- -void CUserEntity::updateVisualPropertyEntityMounted(const NLMISC::TGameCycle &gameCycle, const sint64 &prop) -{ - if(isFighting()) - CPlayerCL::updateVisualPropertyEntityMounted(gameCycle, prop); - else - _Mount = (CLFECOMMON::TCLEntityId)prop; -}// updateVisualPropertyEntityMounted // - -//----------------------------------------------- -// updateVisualPropertyRiderEntity : -// Update Entity Rider -//----------------------------------------------- -void CUserEntity::updateVisualPropertyRiderEntity(const NLMISC::TGameCycle &gameCycle, const sint64 &prop) -{ - if(isFighting()) - CPlayerCL::updateVisualPropertyRiderEntity(gameCycle, prop); - else - _Rider = (CLFECOMMON::TCLEntityId)prop; -}// updateVisualPropertyRiderEntity // - -//----------------------------------------------- -//----------------------------------------------- -void CUserEntity::updateVisualPropertyPvpMode(const NLMISC::TGameCycle &gameCycle, const sint64 &prop) -{ - CPlayerCL::updateVisualPropertyPvpMode(gameCycle, prop); - // Additionaly, inform interface of the change - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - // For PVP ZoneFaction - CCDBNodeLeaf *pDB= NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:USER:TRACK_PVP_CHANGE_MODE"); - if(pDB) - { - sint32 val= pDB->getValue32(); - pDB->setValue32(val+1); - } - // For Any PVP change - pDB= NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:USER:TRACK_PVP_CHANGE_ANY"); - if(pDB) - { - sint32 val= pDB->getValue32(); - pDB->setValue32(val+1); - } -} - -//----------------------------------------------- -//----------------------------------------------- -void CUserEntity::updateVisualPropertyOutpostInfos(const NLMISC::TGameCycle &gameCycle, const sint64 &prop) -{ - CPlayerCL::updateVisualPropertyOutpostInfos(gameCycle, prop); - // For Any PVP change - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - CCDBNodeLeaf *pDB= NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:USER:TRACK_PVP_CHANGE_ANY"); - if(pDB) - { - sint32 val= pDB->getValue32(); - pDB->setValue32(val+1); - } -} - -//----------------------------------------------- -//----------------------------------------------- -void CUserEntity::updateVisualPropertyPvpClan(const NLMISC::TGameCycle &gameCycle, const sint64 &prop) -{ - CPlayerCL::updateVisualPropertyPvpClan(gameCycle, prop); - // For Any PVP change - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - CCDBNodeLeaf *pDB= NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:USER:TRACK_PVP_CHANGE_ANY"); - if(pDB) - { - sint32 val= pDB->getValue32(); - pDB->setValue32(val+1); - } -} - - -///////////////////////////////////////////////// -///////////////////////////////////////////////// -///////////////////////////////////////////////// -///////////////////////////////////////////////// - - -//----------------------------------------------- -// mode : -// Method called to change the mode (Combat/Mount/etc.). -// \todo GUIGUI : apply stage in combat modes instead of just removing them. -// \todo GUIGUI : go or teleport the player to the mode position (see how to manage it). -//----------------------------------------------- -bool CUserEntity::mode(MBEHAV::EMode m) -{ - if(Verbose & VerboseAnim) - nlinfo("UE::mode: old mode '%s(%d)' new mode '%s(%d)'.", MBEHAV::modeToString(_Mode).c_str(), _Mode, MBEHAV::modeToString(m).c_str(), m); - // Nothing to do if the mode is the same as the previous one. - if(m == _Mode) - return true; - // Release the old Mode. - switch(_Mode) - { - // Leave COMBAT Mode - case MBEHAV::COMBAT: - case MBEHAV::COMBAT_FLOAT: - { - // If there are some stage not complete -> remove them - if(_Stages._StageSet.size() != 0) - _Stages._StageSet.clear(); - } - break; - // Leave MOUNTED Mode - case MBEHAV::MOUNT_NORMAL: - case MBEHAV::MOUNT_SWIM: - { - if ( m == MBEHAV::REST ) - { - // can't go afk while mounting - return false; - } - - // if changing mode for another mount mode, do nothing - if (m != MBEHAV::MOUNT_NORMAL && m != MBEHAV::MOUNT_SWIM) - { - // Display the mount again. - CCharacterCL *mount = dynamic_cast(EntitiesMngr.entity(_Mount)); - if(mount) - { - // Set the mount. - mount->rider(CLFECOMMON::INVALID_SLOT); - mount->_Stages._StageSet.clear(); - mount->setMode(MBEHAV::NORMAL); - mount->computeAutomaton(); - mount->computeAnimSet(); - mount->setAnim(CAnimationStateSheet::Idle); - if(mount->getPrimitive()) - mount->getPrimitive()->setOcclusionMask(MaskColNpc); // the mount is an npc - mount->_ForbidClipping = false; - } - // - _Mount = CLFECOMMON::INVALID_SLOT; - // Restore the user Primitive - if(_Primitive) - { - _Primitive->setRadius( std::min(0.5f, (float)(RYZOM_ENTITY_SIZE_MAX/2)) ); - _Primitive->setHeight(2); - } - _OnMount = false; - - // Shift the player position (not to stand inside the mount) - CVectorD unmountShift; - unmountShift.sphericToCartesian(1.0, frontYaw() + NLMISC::Pi/2, 0); - pacsPos(pos() + unmountShift); - - // Restore running if necessary - if (!_Run && _RunWhenAble) - { - switchVelocity(); - } - } - - if (_Mode == MBEHAV::MOUNT_SWIM && ( m == MBEHAV::COMBAT || m == MBEHAV::COMBAT_FLOAT)) - { - //TODO : display "you can't fight while swimming" - return true; - } - } - break; - // Leave DEATH Mode - case MBEHAV::DEATH: - // Restore the last view. - viewMode(viewMode()); - break; - case MBEHAV::SWIM: - if( m == MBEHAV::COMBAT || m == MBEHAV::COMBAT_FLOAT) - { - //TODO : display "you can't fight while swimming" - return true; - } - break; - default: - nlwarning("Invalid behaviour change."); - } - - // Reset Parent, unless we stay in mount mode - if ((_Mode != MBEHAV::MOUNT_SWIM && _Mode != MBEHAV::MOUNT_NORMAL) - || (m != MBEHAV::MOUNT_SWIM && m != MBEHAV::MOUNT_NORMAL) - ) - { - parent(CLFECOMMON::INVALID_SLOT); - } - - // Change the Mode for the user ( if user sits down or stands up we wait in order to play the sit/stand transition anim) - if( m != MBEHAV::SIT && _Mode != MBEHAV::SIT ) - _Mode = m; - _ModeWanted = m; - - // Initialize the new Mode. - switch(m) - { - // Combat mode - case MBEHAV::COMBAT: - case MBEHAV::COMBAT_FLOAT: - { - C64BitsParts rot; - - // Compute the angle - const string propName = toString("SERVER:Entities:E%d:P%d", _Slot, CLFECOMMON::PROPERTY_ORIENTATION); - rot.i64[0] = NLGUI::CDBManager::getInstance()->getDbProp(propName)->getValue64(); - _TargetAngle = rot.f[0]; - - // Initialize controls for the combat. - UserControls.startCombat(); - - // Context help - contextHelp ("action_bar"); - } - break; - - // Mount Normal or mount swim - case MBEHAV::MOUNT_NORMAL: - { - CCharacterCL *mount = dynamic_cast(EntitiesMngr.entity(parent())); - if(mount) - { - mount->_Stages.removePosWithNoMode(); - dir(mount->dir()); - } - } - case MBEHAV::MOUNT_SWIM: - { - // Hide the mount unless we come from another mounted mode - if (_Mode != MBEHAV::MOUNT_SWIM && _Mode != MBEHAV::MOUNT_NORMAL) - { - if(_Mount != CLFECOMMON::INVALID_SLOT) // if _Mount is still invalid, the following code will be done in updatePos() - { - setOnMount(); - } - } - // refresh target - UserEntity->selection(_Selection); - } - break; - - // Dead mode. - case MBEHAV::DEATH: - setDead(); - if(isSwimming()) - _Mode = MBEHAV::SWIM_DEATH; - break; - - // Normal or Default mode. - case MBEHAV::NORMAL: - _CurrentBehaviour.Behaviour = MBEHAV::IDLE; - default: - // - setAlive(); - viewMode(viewMode()); - break; - } - - bool doSetAnim = true; - // if user sits down or stands up we set transition anim before changing animset - if( m == MBEHAV::SIT ) - { - setAnim(CAnimationStateSheet::SitMode); - _Mode = m; - doSetAnim = false; - } - else - if( _Mode == MBEHAV::SIT && m!=MBEHAV::DEATH ) - { - setAnim(CAnimationStateSheet::SitEnd); - _Mode = m; - doSetAnim = false; - } - - // Show/Hide all or parts of the body. - updateVisualDisplay(); - if( ClientCfg.AutomaticCamera ) - { - // Set the direction as the front. - dir(front()); - } - // Compute the current automaton - computeAutomaton(); - // Update the animation set according to the mode. - computeAnimSet(); - - if( doSetAnim ) - { - // Animset changed -> update current animation - setAnim(CAnimationStateSheet::Idle); - } - - // Changing the mode well done. - return true; -}// mode // - - -/* - * Mount the mount in _Mount - */ -void CUserEntity::setOnMount() -{ - CCharacterCL *mount = dynamic_cast(EntitiesMngr.entity(_Mount)); - if(mount) - { - // Update primitives for the mount and the rider. - if(_Primitive && mount->getPrimitive()) - { - _Primitive->setRadius( std::min(mount->getPrimitive()->getRadius(), (float)(RYZOM_ENTITY_SIZE_MAX/2)) ); - _Primitive->setHeight(mount->getPrimitive()->getHeight()); - mount->getPrimitive()->setOcclusionMask(MaskColNone); // Remove collisions. - } - // Now on a mount - _OnMount = true; - // Link the mount and the user. - parent(_Mount); - // Refresh the View Mode - viewMode(viewMode()); - // Close the crafting window if open - closeFaberCastWindow(); - - // Keep run in mind - _RunWhenAble = _Run; - - mount->_ForbidClipping = true; - } -} - - - -//----------------------------------------------- -// getVelocity : -// compute and return the entity velocity -//----------------------------------------------- -CVector CUserEntity::getVelocity() const -{ - static const CVector lateral(0,0,1); - static CVector velocity; - velocity = front() * _FrontVelocity + ( lateral ^ front()) * _LateralVelocity; - velocity.normalize(); - // User is Dead - if(isDead()) - { - velocity *= 0.0; - } - // User is sitting - else if(isSit()) - { - velocity *= 0.0; - } - // User is swimming - else if(isSwimming()) - { - // We are a Ring DM so speed up a litle - - - // Forward Run or Walk - if(_FrontVelocity > 0.0f) - { - if(_Run) - velocity *= 3.0; - else - velocity *= 1.0; - } - // Lateral or Backward Walk - else - velocity *= 1.0; - - if (_R2CharMode == R2::TCharMode::Editer || _R2CharMode == R2::TCharMode::Dm) - { - velocity *= (float(ClientCfg.DmRun) / 6.0f); // velocity max = max run / 2 - } - - } - else if(isRiding()) - { - // Forward Run or Walk - if(_FrontVelocity > 0.0f) - { - if(_Run) - velocity *= getMountRunVelocity(); - else - velocity *= getMountWalkVelocity(); - } - // Lateral or Backward Walk (currently, not used) - else - velocity *= 0.66f;//getMountWalkVelocity(); - } - else - { - // Forward Run or Walk - if(_FrontVelocity > 0.0f) - velocity *= currentVelocity(); - // Lateral or Backward Walk - else - velocity *= _WalkVelocity; - } - return velocity; -}// getVelocity // - -//----------------------------------------------- -// speed : -// Return the Entity Current Speed. -//----------------------------------------------- -double CUserEntity::speed() const // virtual -{ - return CPlayerCL::speed(); -// return (double)getVelocity().norm(); -}// speed // - -//----------------------------------------------- -// applyMotion : -// Apply the motion to the entity. -//----------------------------------------------- -void CUserEntity::applyMotion(CEntityCL *target) -{ - // default each frame - _ForceLookSlot= CLFECOMMON::INVALID_SLOT; - - bool lastHasMoved = _HasMoved; - _HasMoved = false; - // Remove Positions in stages - _Stages.removePosWithNoMode(); - // Remove Positions in stages for the mount. - CCharacterCL *mount = 0; - if(parent() != CLFECOMMON::INVALID_SLOT) - { - mount = dynamic_cast(EntitiesMngr.entity(parent())); - if(mount) - mount->_Stages.removePosWithNoMode(); - } - // NO PRIMITIVE -> NO MOVE - if(_Primitive == 0) - return; - // BAD CONNECTION -> NO MOVE - if(NetMngr.getConnectionQuality() == false) - return; - // MS per TICK <=0 -> NO MOVE - if(NetMngr.getMsPerTick() <= 0) - return; - // Compute Speed Vector - NLMISC::CVectorD speed; - if(_MoveToSlot != CLFECOMMON::INVALID_SLOT) - { - // Check the Target. - if(target == 0 || target == this) - return; - // Compute the vector between the user and the target. - CVectorD dir2targ = target->pos() - pos(); - dir2targ.z = 0.0; - if(dir2targ == CVectorD::Null) - dir2targ = front(); - const double angToTarget = atan2(dir2targ.y, dir2targ.x); - CVectorD aimingPos = target->getAttackerPos(angToTarget, attackRadius() + ClientCfg.AttackDist); - // Aiming Position - CVectorD dirToAimingPos = aimingPos-pos(); - dirToAimingPos.z = 0.0; - const double distToAimingPos = dirToAimingPos.norm(); - - // Decide if the target is reached or not - bool targetReached= false; - if(distToAimingPos > 0.5) - { - // Because of Tryker Counter, may increase the Threshold, when the player is stalled - if(distToAimingPos<_MoveToDist) - { - // If the player is stalled too much time, abort the move and launch the action - float actualSpeed= float((_Position - _LastFramePos).norm() / DT); - - // if player effectively runs twice slower, start colision timer - if( actualSpeed*2 < getMaxSpeed() ) - { - if(!_MoveToColStartTime) - _MoveToColStartTime= T1; - } - // else ok, reset colision timer - else - _MoveToColStartTime= 0; - - // if too much time stalled, stop run. - if(_MoveToColStartTime && (T1 - _MoveToColStartTime >= ClientCfg.MoveToTimeToStopStall) ) - targetReached= true; - } - else - _MoveToColStartTime= 0; - } - else - targetReached= true; - - // If the target is reached - if(targetReached) - { - // stop and execute action - speed = CVectorD::Null; - moveToAction(target); - } - // else continue follow - else - { - // Look at the entity. delay it after pacs evalCollision(), for correct orientation - _ForceLookSlot= target->slot(); - // but still estimate now an approximative front (may be used between now and applyForceLook()) - forceLookEntity(dir2targ, false); - - // Normalize - dirToAimingPos.normalize(); - // Set the Velocity Direction - speed = dirToAimingPos*distToAimingPos; - speed /= DT; - if(speed.norm() > getMaxSpeed()) - speed = dirToAimingPos*getMaxSpeed(); - } - } - else if(follow()) - { - // Check the Target. - if(target == 0 || target == this) - return; - // If the target is moving, orientate the user to the target. -// if(target->hasMoved()) - { - // Compute the vector between the user and the target. - CVectorD dir2targ = target->pos() - pos(); - dir2targ.z = 0.0; - if(dir2targ != CVectorD::Null) - { - // Look at the entity. delay it after pacs evalCollision(), for correct orientation - _ForceLookSlot= target->slot(); - // but still estimate now an approximative front (may be used between now and applyForceLook()) - forceLookEntity(dir2targ, false); - } - } - // Compute the angle in the world to attack the target. - const double angToTarget = frontYaw(); - // Get the best position to attack the target with the given angle. - const CVectorD aimingPos = target->getAttackerPos(angToTarget, attackRadius() + ClientCfg.AttackDist); - // Aiming Position - CVectorD dirToAimingPos = aimingPos-pos(); - dirToAimingPos.z = 0.0; - const double distToAimingPos = dirToAimingPos.norm(); - // If the User was not moving and the distance to re-move is not enough big, stay idle - if(lastHasMoved - || (isFighting() && distToAimingPos >= 0.5) - || (!isFighting() && distToAimingPos >= 3.0)) - { - dirToAimingPos.normalize(); - // User is in combat mode -> follow as close as possible. - if(isFighting()) - { - // Target is moving - if(target->hasMoved()) - { - // Get closer if too far. - if(distToAimingPos >= 0.2) - { - // Set the Velocity Direction - speed = dirToAimingPos*distToAimingPos; - speed /= DT; - if(speed.norm() > getMaxSpeed()) - speed = dirToAimingPos*getMaxSpeed(); - } - else - { - // Try to have the same speed as the target. - if(target->getSpeed() > getMaxSpeed()) - speed = target->dir()* ((float)getMaxSpeed()); - else - speed = target->dir()* ((float)target->getSpeed()); - } - } - // Target is not moving. - else - { - // Get closer if too far. - if(distToAimingPos >= 0.1) - { - // Set the Velocity Direction - speed = dirToAimingPos*distToAimingPos; - speed /= DT; - if(speed.norm() > getMaxSpeed()) - speed = dirToAimingPos*getMaxSpeed(); - } - else - speed = CVectorD::Null; - } - } - // User is not in combat mode -> follow not so close. - else - { - // Too far, get closer as fast as possible - if(distToAimingPos >= 3.0) - { - // Set the Velocity Direction - speed = dirToAimingPos*distToAimingPos; - speed /= DT; - if(speed.norm() > getMaxSpeed()) - speed = dirToAimingPos*getMaxSpeed(); - } - // Just far enough, adjust the user speed to the target - else if(target->hasMoved() && distToAimingPos >= 1.0) - { - // Try to have the same speed as the target. - if(target->getSpeed() > getMaxSpeed()) - speed = target->dir()* ((float)getMaxSpeed()); - else - speed = target->dir()* ((float)target->getSpeed()); - } - // Too close, Stop - else - speed = CVectorD::Null; - } - } - // User was stop and the next pos is to close to begin to move. - else - speed = CVectorD::Null; - } - else - { - speed = getVelocity()*_SpeedFactor.getValue(); - _SpeedFactor.addFactorValue(0.005f); - } - - // SPEED VECTOR NULL -> NO MOVE - if(speed == CVectorD::Null) - return; - - // First Person View - if(UserControls.isInternalView()) - { - // If the server is slow, the client move slower too (only needed in FPV). - double modif = (100.0f/(float)NetMngr.getMsPerTick()); - // don't increase speed - clamp(modif, 0.0, 1.0); - speed *= modif; - // Move - _HasMoved = true; - _Primitive->move(speed, dynamicWI); - if(mount && mount->getPrimitive()) - mount->getPrimitive()->move(speed, dynamicWI); - } - // Third Person View - else - { - double modif = (100.0f/(float)NetMngr.getMsPerTick()); - clamp(modif, 0.0, 1.0); - speed *= modif; - speed += pos(); - sint64 x = (sint64)((sint32)(speed.x * 1000.0)); - sint64 y = (sint64)((sint32)(speed.y * 1000.0)); - sint64 z = (sint64)((sint32)(speed.z * 1000.0)); - const uint time = 10; // = 1sec because the speed is in Meter per Sec. - _Stages.addStage(NetMngr.getCurrentClientTick()+time, CLFECOMMON::PROPERTY_POSX, x, 0); - _Stages.addStage(NetMngr.getCurrentClientTick()+time, CLFECOMMON::PROPERTY_POSY, y); - _Stages.addStage(NetMngr.getCurrentClientTick()+time, CLFECOMMON::PROPERTY_POSZ, z); - // Move the Mount - if(mount) - { - mount->_Stages.addStage(NetMngr.getCurrentClientTick()+time, CLFECOMMON::PROPERTY_POSX, x, 0); - mount->_Stages.addStage(NetMngr.getCurrentClientTick()+time, CLFECOMMON::PROPERTY_POSY, y); - mount->_Stages.addStage(NetMngr.getCurrentClientTick()+time, CLFECOMMON::PROPERTY_POSZ, z); - } - } - - -}// applyMotion // - - -//--------------------------------------------------- -//--------------------------------------------------- -void CUserEntity::applyForceLook() -{ - if(_ForceLookSlot!=CLFECOMMON::INVALID_SLOT) - { - CEntityCL *target= EntitiesMngr.entity(_ForceLookSlot); - if(target && target!=this) - { - // Compute the vector between the user and the target. - CVectorD dir2targ = target->pos() - pos(); - dir2targ.z = 0.0; - if(dir2targ == CVectorD::Null) - dir2targ = front(); - // Look at the entity - forceLookEntity(dir2targ, true); - } - } -} - - -//--------------------------------------------------- -// updatePosCombatFloatChanged : -//--------------------------------------------------- -void CUserEntity::updatePosCombatFloatChanged(CEntityCL * /* target */) // virtual -{ - if(viewMode() == FirstPV) - { - pos(_FirstPos); - } -}// updatePosCombatFloatChanged // - - -//----------------------------------------------- -// forceIndoorFPV // -// Return true if the user is indoor and the CFG want to force the FPV Indoor. -//----------------------------------------------- -bool CUserEntity::forceIndoorFPV() -{ - return (ClientCfg.ForceIndoorFPV && indoor()); -}// forceIndoorFPV // - - -//----------------------------------------------- -// enableFollow : -//----------------------------------------------- -void CUserEntity::disableFollow() -{ - if (_FollowMode==false) - return; - - _FollowMode = false; - - // Send the message to the server. - CBitMemStream out; - if(GenericMsgHeaderMngr.pushNameToStream("TARGET:NO_FOLLOW", out)) - NetMngr.push(out); - else - nlwarning("UE:follow: unknown message named 'TARGET:NO_FOLLOW'."); - -}// follow // - - -//----------------------------------------------- -// enableFollow : -//----------------------------------------------- -void CUserEntity::enableFollow(bool resetCameraRot) -{ - if (_FollowMode == true) - return; - - if( _Mode == MBEHAV::DEATH ) - return; - - _FollowMode = true; - - // Send the message to the server. - CBitMemStream out; - if(GenericMsgHeaderMngr.pushNameToStream("TARGET:FOLLOW", out)) - NetMngr.push(out); - else - nlwarning("UE:follow: unknown message named 'TARGET:FOLLOW'."); - - // Disable any autowalk (else when follow re-disabled, it will effect, which is weird) - UserControls.autowalkState(false); - - // disable afk mode - setAFK(false); - - // if want to reset camera rotation - if(resetCameraRot) - startForceLookEntity(targetSlot()); - -}// follow // - - -//----------------------------------------------- -// resetAnyMoveTo -//----------------------------------------------- -void CUserEntity::resetAnyMoveTo() -{ - // if we cancel a MoveToPhrase action, MUST dec the action counter, and hide the Action Icon - if(_MoveToAction==CUserEntity::CombatPhrase || _MoveToAction==CUserEntity::ExtractRM) - { - // the clientExecute has not been called in case of "ExtractRM autoFind" - bool autoFindExtractRM= _MoveToAction==CUserEntity::ExtractRM && _MoveToPhraseMemoryLine == std::numeric_limits::max(); - if(!autoFindExtractRM) - { - CSPhraseManager *pPM= CSPhraseManager::getInstance(); - pPM->cancelClientExecute(_MoveToPhraseCyclic); - } - } - - // reset to no moveTo - _MoveToSlot = CLFECOMMON::INVALID_SLOT; - _MoveToAction = CUserEntity::None; - _MoveToDist = 0.0; - _MoveToColStartTime= 0; -} - -//----------------------------------------------- -// moveToCheckStartDist : -// Check if the user is not already well placed. -//----------------------------------------------- -void CUserEntity::moveToCheckStartDist(CLFECOMMON::TCLEntityId slot, double dist, TMoveToAction /* action */) -{ - if(_MoveToSlot != CLFECOMMON::INVALID_SLOT) - { - // Start a new Force Look entity - startForceLookEntity(_MoveToSlot); - - // Disable any autowalk (else when moveTo re-disabled, it will effect, which is weird) - UserControls.autowalkState(false); - - // disable afk mode - setAFK(false); - - // if sufficiently near, launch the action - CEntityCL *target = EntitiesMngr.entity(slot); - if(target) - { - CVectorD dir2targ = target->pos() - pos(); - dir2targ.z = 0.0; - if((dir2targ==CVectorD::Null) || (dir2targ.norm() < dist)) - { - moveToAction(target); - } - } - } -}// moveToCheckStartDist // - -//----------------------------------------------- -// moveTo : -// Method to move to someone else. -//----------------------------------------------- -void CUserEntity::moveTo(CLFECOMMON::TCLEntityId slot, double dist, TMoveToAction action) -{ - resetAnyMoveTo(); - - // setup new state - _MoveToSlot = slot; - _MoveToDist = dist; - _MoveToAction = action; - - moveToCheckStartDist(_MoveToSlot, _MoveToDist, _MoveToAction); -}// moveTo // - -//----------------------------------------------- -// moveToMission : -// Method to move to someone else for a mission. NB: if prec action was a CombatPhrase action, action counter are decremented -//----------------------------------------------- -void CUserEntity::moveToMission(CLFECOMMON::TCLEntityId slot, double dist, uint32 id) -{ - resetAnyMoveTo(); - - // setup new state - _MoveToSlot = slot; - _MoveToDist = dist; - _MoveToAction = CUserEntity::Mission; - _MoveToMissionId = id; - - moveToCheckStartDist(_MoveToSlot, _MoveToDist, _MoveToAction); -}// moveToMission // - -//----------------------------------------------- -// moveToMissionRing : -// Method to move to someone else for a ring mission. NB: if prec action was a CombatPhrase action, action counter are decremented -//----------------------------------------------- -void CUserEntity::moveToMissionRing(CLFECOMMON::TCLEntityId slot, double dist, uint32 id) -{ - resetAnyMoveTo(); - - // setup new state - _MoveToSlot = slot; - _MoveToDist = dist; - _MoveToAction = CUserEntity::MissionRing; - _MoveToMissionId = id; - - moveToCheckStartDist(_MoveToSlot, _MoveToDist, _MoveToAction); -}// moveToMissionRing // - -//----------------------------------------------- -// moveTo : -// Method to move to someone else. -//----------------------------------------------- -void CUserEntity::moveToCombatPhrase(CLFECOMMON::TCLEntityId slot, double dist, uint phraseMemoryLine, uint phraseMemorySlot, bool phraseCyclic) -{ - resetAnyMoveTo(); - - // setup new state - _MoveToSlot = slot; - _MoveToDist = dist; - _MoveToAction = CUserEntity::CombatPhrase; - _MoveToPhraseMemoryLine= phraseMemoryLine; - _MoveToPhraseMemorySlot= phraseMemorySlot; - _MoveToPhraseCyclic= phraseCyclic; - - moveToCheckStartDist(_MoveToSlot, _MoveToDist, _MoveToAction); -} - -//----------------------------------------------- -// Method to move to someone else, for foraging extraction -// The caller MUST call after CSPhraseManager::clientExecute(), to increment action counter -//----------------------------------------------- -void CUserEntity::moveToExtractionPhrase(CLFECOMMON::TCLEntityId slot, double dist, uint phraseMemoryLine, uint phraseMemorySlot, bool cyclic) -{ - // Test if forage tool in hand, otherwise auto-equip with it - bool validForageToolInHand = false; - CInventoryManager * inv = CInventoryManager::getInstance(); - if ( !inv ) - { - return; - } - uint32 rightHandSheet = inv->getRightHandItemSheet(); - if ( rightHandSheet ) - { - validForageToolInHand = inv->isForageToolItem( rightHandSheet ); - } - if ( !validForageToolInHand ) - { - // Find a forage tool in the bag - uint i; - for ( i=0; igetBagItem(i).getSheetID(); - if ( itemSheet && inv->isForageToolItem(itemSheet) ) - { - break; - } - } - if ( i != MAX_BAGINV_ENTRIES && ClientCfg.AutoEquipTool ) - { - // remember last used weapon(s) - rememberWeaponsInHand(); - - // Clear hands - inv->unequip( "LOCAL:INVENTORY:HAND:1" ); - inv->unequip( "LOCAL:INVENTORY:HAND:0" ); - - // Equip hands - string bagPath = toString( "LOCAL:INVENTORY:BAG:%u", i ); - inv->equip( bagPath, "LOCAL:INVENTORY:HAND:0" ); - } - else - { - // No forage tool in bag - CInterfaceManager::getInstance()->displaySystemInfo( CI18N::get("uiForageToolMissing"), "CHK" ); - return; - } - } - - resetAnyMoveTo(); - - // setup new state - _MoveToSlot = slot; - _MoveToDist = dist; - _MoveToAction = CUserEntity::ExtractRM; - _MoveToPhraseMemoryLine= phraseMemoryLine; - _MoveToPhraseMemorySlot= phraseMemorySlot; - _MoveToPhraseCyclic= cyclic; - - moveToCheckStartDist(_MoveToSlot, _MoveToDist, _MoveToAction); -} - -//----------------------------------------------- -// Method to begin a spire construction -// The caller MUST call after CSPhraseManager::clientExecute(), to increment action counter -//----------------------------------------------- -void CUserEntity::moveToTotemBuildingPhrase(CLFECOMMON::TCLEntityId slot, double dist, uint phraseMemoryLine, uint phraseMemorySlot, bool cyclic) -{ - resetAnyMoveTo(); - - // setup new state - _MoveToSlot = slot; - _MoveToDist = dist; - _MoveToAction = CUserEntity::BuildTotem; - _MoveToPhraseMemoryLine= phraseMemoryLine; - _MoveToPhraseMemorySlot= phraseMemorySlot; - _MoveToPhraseCyclic= cyclic; - - moveToCheckStartDist(_MoveToSlot, _MoveToDist, _MoveToAction); -} - -//----------------------------------------------- -// moveToAction : -// Launch the Action Once the Move is done. -// \param CEntityCL * : pointer on the destination entity. -// \warning entity pointer must be valid(allocated). -//----------------------------------------------- -void CUserEntity::moveToAction(CEntityCL *ent) -{ - // Check entity pointer - nlassert(ent); - - UserControls.needReleaseForward(); - - // Get the interface instance. - CInterfaceManager *IM = CInterfaceManager::getInstance(); - switch(_MoveToAction) - { - // Attack - case CUserEntity::Attack: - UserEntity->attack(); - break; - // Quartering - case CUserEntity::Quarter: - if((ent->properties()).harvestable()) - CAHManager::getInstance()->runActionHandler("context_quartering", 0); - break; - // Loot - case CUserEntity::Loot: - if((ent->properties()).lootable()) - CAHManager::getInstance()->runActionHandler("context_loot", 0); - break; - // Pick Up - case CUserEntity::PickUp: - nlwarning("UE:checkMoveTo: not yet implemented"); - break; - case CUserEntity::ExtractRM: - extractRM(); - break; - // Trade Item - case CUserEntity::TradeItem: - CAHManager::getInstance()->runActionHandler("context_trade_item", 0); - break; - // Trade Phrase - case CUserEntity::TradePhrase: - CAHManager::getInstance()->runActionHandler("context_trade_phrase", 0); - break; - // Trade Pact - case CUserEntity::TradePact: - CAHManager::getInstance()->runActionHandler("context_trade_pact", 0); - break; - // Mission - case CUserEntity::Mission: - { - string param = toString("id=%d", _MoveToMissionId); - CAHManager::getInstance()->runActionHandler("mission_option", 0, param); - } - break; - // Dynamic Mission - case CUserEntity::DynamicMission: - CAHManager::getInstance()->runActionHandler("context_dynamic_mission", 0); - break; - // Static Mission - case CUserEntity::StaticMission: - CAHManager::getInstance()->runActionHandler("context_choose_mission", 0); - break; - // Mission - case CUserEntity::MissionRing: - { - string param = toString("id=%d", _MoveToMissionId); - CAHManager::getInstance()->runActionHandler("mission_ring", 0, param); - } - break; - // Create Guild - case CUserEntity::CreateGuild: - CAHManager::getInstance()->runActionHandler("context_create_guild", 0); - break; - // News - case CUserEntity::News: - CAHManager::getInstance()->runActionHandler("context_talk", 0); - break; - // Trade Teleport - case CUserEntity::TradeTeleport: - CAHManager::getInstance()->runActionHandler("context_trade_teleport", 0); - break; - // Trade Faction items - case CUserEntity::TradeFaction: - CAHManager::getInstance()->runActionHandler("context_trade_faction", 0); - break; - // Trade Cosmetic - case CUserEntity::TradeCosmetic: - CAHManager::getInstance()->runActionHandler("context_trade_cosmetic", 0); - break; - // Talk - case CUserEntity::Talk: - nlwarning("UE:checkMoveTo: not yet implemented"); - break; - // CombatPhrase - case CUserEntity::CombatPhrase: - UserEntity->attackWithPhrase(); - break; - // Mount - case CUserEntity::Mount: - { - string orderStr = "mount"; - string beastIndexStr = "@UI:GCM_BEAST_SELECTED"; - bool confirmFree = true; - beastOrder(orderStr,beastIndexStr,confirmFree); - break; - } - // WebPage - case CUserEntity::WebPage: - CAHManager::getInstance()->runActionHandler("context_web_page", 0); - break; - // Outpost - case CUserEntity::Outpost: - CLuaManager::getInstance().executeLuaScript("game:outpostBCOpenStateWindow()", 0); - break; - // BuildTotem - case CUserEntity::BuildTotem: - buildTotem(); - break; - // openArkUrl - case CUserEntity::OpenArkUrl: - CLuaManager::getInstance().executeLuaScript("getUI('ui:interface:web_transactions'):find('html'):browse(ArkTargetUrl)", 0); - break; - default: - break; - } - - // Move To Done. - resetAnyMoveTo(); -}// moveToAction // - - -//----------------------------------------------- -// sendToServer : -// Send the position and orientation to the server. -//----------------------------------------------- -bool CUserEntity::sendToServer(CBitMemStream &out) -{ - if(GenericMsgHeaderMngr.pushNameToStream("POSITION", out)) - { - // Backup the position sent. - if (_Primitive) _Primitive->getGlobalPosition(_LastGPosSent, dynamicWI); - // Send Position & Orientation - CPositionMsg positionMsg; - positionMsg.X = (sint32)(pos().x * 1000); - positionMsg.Y = (sint32)(pos().y * 1000); - positionMsg.Z = (sint32)(pos().z * 1000); - positionMsg.Heading = frontYaw(); - out.serial(positionMsg); - return true; - } - else - { - nlwarning("UE:sendToServer: unknown message named 'POSITION'."); - return false; - } -}// sendToServer // - -//----------------------------------------------- -// msgForCombatPos : -// Fill the msg to know if the user is well placed to fight. -//----------------------------------------------- -bool CUserEntity::msgForCombatPos(NLMISC::CBitMemStream &out) -{ - static bool wellPosition = false; - bool wellP = false; -// if(isFighting()) - { - // Is the user well Placed - CEntityCL *target = EntitiesMngr.entity(UserEntity->targetSlot()); - if(target) - wellP = target->isPlacedToFight(UserEntity->pos(), front(), attackRadius() + ClientCfg.AttackDist); - } - // If different from the last time - if(wellPosition != wellP) - { - wellPosition = wellP; - // Send state to server. - if(GenericMsgHeaderMngr.pushNameToStream("COMBAT:VALIDATE_MELEE", out)) - { - uint8 flag = wellP?1:0; - out.serial(flag); - return true; - } - else - nlwarning("UE:msgForCombatPos: unknown message named 'COMBAT:TOGGLE_COMBAT_FLOAT_MODE'."); - } - // Do not send the msg. - return false; -}// msgForCombatPos // - - -//----------------------------------------------- -// checkPos : -// Check the User Position according to the server code. -// \todo GUIGUI : put checks on GPos -// \todo GUIGUI : refact the check primitive when creating a PACS again -//----------------------------------------------- -void CUserEntity::checkPos() -{ - if(PACS && _Primitive) - { - // Is in water ? - if(GR) - { - UGlobalPosition gPos; - _Primitive->getGlobalPosition(gPos, dynamicWI); - float waterHeight; - if(GR->isWaterPosition(gPos, waterHeight)) - { - if(isSwimming() == false) - { - // Player is Dead set the right mode (swim and dead) - if(isDead()) - mode(MBEHAV::SWIM_DEATH); - else - { - // Do not swim when in combat mode. - if(isFighting()) - { - _HasMoved = false; - pacsPos(_LastPositionValidated, _LastGPosValidated); - } - // \todo GUIGUI : if the move was cancelled, do not switch to swimming mode. - else if (isRiding()) - { - mode(MBEHAV::MOUNT_SWIM); - // also change mounted entity mode - CCharacterCL *mount = dynamic_cast(EntitiesMngr.entity(_Mount)); - if(mount) - { - // Set the mount. - mount->setMode(MBEHAV::MOUNT_SWIM); - mount->computeAutomaton(); - mount->computeAnimSet(); - mount->setAnim(CAnimationStateSheet::Idle); - } - } - else - { - mode(MBEHAV::SWIM); - } - } - } - } - else - { - if(isSwimming()) - { - if(isDead()) - { - mode(MBEHAV::DEATH); - } - else if (isRiding()) - { - mode(MBEHAV::MOUNT_NORMAL); - // also change mounted entity mode - CCharacterCL *mount = dynamic_cast(EntitiesMngr.entity(_Mount)); - if(mount) - { - // Set the mount. - mount->setMode(MBEHAV::MOUNT_NORMAL); - mount->computeAutomaton(); - mount->computeAnimSet(); - mount->setAnim(CAnimationStateSheet::Idle); - } - } - else - { - mode(MBEHAV::NORMAL); - } - } - } - } - - // Create the Primitive used to check if the move will be accepted by the server - if(_CheckPrimitive == 0) - { - _Primitive->getGlobalPosition(_LastGPosSent, dynamicWI); - _Primitive->getGlobalPosition(_LastGPosValidated, dynamicWI); - _CheckPrimitive = PACS->addNonCollisionablePrimitive(_Primitive); - _CheckPrimitive->setOcclusionMask(MaskColNone); // Collide with nothing - _CheckPrimitive->setCollisionMask(MaskColNone); // Collide with nothing - _LastPositionValidated = pos(); - } - if(_CheckPrimitive) - { - _CheckPrimitive->setGlobalPosition(_LastGPosSent, dynamicWI); - CVectorD speed = _Primitive->getFinalPosition(dynamicWI) - _CheckPrimitive->getFinalPosition(dynamicWI); - - _CheckPrimitive->move(speed, dynamicWI); - if(PACS->evalNCPrimitiveCollision(1.0, _CheckPrimitive, dynamicWI) == false) - nlwarning("UE:checkPos: _CheckPrimitive is a collisionable primitive !!!"); - - CVectorD vectDist = _Primitive->getFinalPosition(dynamicWI) - _CheckPrimitive->getFinalPosition(dynamicWI); - if(vectDist.norm() > 0.001) - { - // The server will not be able to reproduce this move, restoring the last one. - _HasMoved = false; - pacsPos(_LastPositionValidated,_LastGPosValidated); - } - else - { - _LastPositionValidated = _Primitive->getFinalPosition(dynamicWI); - _Primitive->getGlobalPosition(_LastGPosValidated, dynamicWI); - } - } - } -}// checkPos // - - -//----------------------------------------------- -// testPacsPos : -// test the move from posToTest to current pos -//----------------------------------------------- -bool CUserEntity::testPacsPos( CVectorD& posToTest ) -{ - if(PACS && _Primitive && _CheckPrimitive) - { - _CheckPrimitive->setGlobalPosition(posToTest, dynamicWI); - CVectorD speed = _Primitive->getFinalPosition(dynamicWI) - _CheckPrimitive->getFinalPosition(dynamicWI); - - _CheckPrimitive->move(speed, dynamicWI); - if(PACS->evalNCPrimitiveCollision(1.0, _CheckPrimitive, dynamicWI) == false) - nlwarning("UE:testPacsPos: _CheckPrimitive is a collisionable primitive !!!"); - - CVectorD vectDist = _Primitive->getFinalPosition(dynamicWI) - _CheckPrimitive->getFinalPosition(dynamicWI); - if(vectDist.norm() > 0.001) - { - return false; - } - else - return true; - } - return false; - -} // testPacsPos // - - -//----------------------------------------------- -// tp : -// Teleport the player (remove selection, re-init checkPos, etc.). -//----------------------------------------------- -void CUserEntity::tp(const CVectorD &dest) -{ - // Remove the selection. - UserEntity->selection(CLFECOMMON::INVALID_SLOT); - // Update PACS - pacsPos(dest); - // Update the primitive useful to check the user position. - _LastPositionValidated = dest; - // Get the Global position - if(_Primitive) - { - // this is the last PACS position validated too - _Primitive->getGlobalPosition(_LastGPosValidated, dynamicWI); - // consider this is the last position sent to server (since actually received!) - _Primitive->getGlobalPosition(_LastGPosSent, dynamicWI); - // Set the new position of the 'check' primitive - if(_CheckPrimitive) - _CheckPrimitive->setGlobalPosition(_LastGPosSent, dynamicWI); - } - else - nlwarning("UE:tp: the entity has a Null primitive."); - // Return to interface mode. - viewMode(UserEntity->viewMode()); - // User well oriented. - dir(UserEntity->front()); - // Set Normal Mode after a teleport. - mode(MBEHAV::NORMAL); - // Set animation with idle. - setAnim(CAnimationStateSheet::Idle); -}// tp // - -//----------------------------------------------- -// correctPos : -// Teleport the player to correct his position. -//----------------------------------------------- -void CUserEntity::correctPos(const NLMISC::CVectorD &dest) -{ - nlinfo("UE:correctPos: new user position %f %f %f", dest.x, dest.y, dest.z); - // Change the user poisition. - UserEntity->pacsPos(dest); - // Update the primitive useful to check the user position. - _LastPositionValidated = dest; - // Get the Global position - if(_Primitive) - { - // this is the last PACS position validated too - _Primitive->getGlobalPosition(_LastGPosValidated, dynamicWI); - // consider this is the last position sent to server (since actually received!) - _Primitive->getGlobalPosition(_LastGPosSent, dynamicWI); - // Set the new position of the 'check' primitive - if(_CheckPrimitive) - _CheckPrimitive->setGlobalPosition(_LastGPosSent, dynamicWI); - } - else - nlwarning("UE:correctPos: the entity has a Null primitive."); - - // Correct the pos of the mount, if riding - if ( isRiding() ) - { - if ( _Mount < EntitiesMngr.entities().size() ) - { - CEntityCL *mount = EntitiesMngr.entities()[_Mount]; - if ( mount ) - mount->pacsPos( dest ); - } - } -}// correctPos // - - -/* - * Check if the mount is able to run, and force walking mode if not - * (if the player clicked on run, set back to walk). - */ -void CUserEntity::checkMountAbleToRun() -{ - if ( isRiding() ) - { - if ( running() ) - { - // Make the mount walk if she's hungry - if ( ! _MountHunger.canRun() ) - switchVelocity( false ); - } - else - { - // Make the mount run if she's not hungry anymore - if ( _RunWhenAble && _MountHunger.canRun() ) - switchVelocity( false ); - } - } -} - - -//----------------------------------------------- -// Update the position of the entity after the motion. -// \param t : Time for the position of the entity after the motion. -// \param target : pointer on the current target. -//----------------------------------------------- -void CUserEntity::updatePos(const TTime &t, CEntityCL *target) -{ - // Update Mount if mounting (if _Mount was still not valid when mode received) - if((_Mount != CLFECOMMON::INVALID_SLOT && isRiding()) && _OnMount==false) - { - setOnMount(); - } - // External view are managed like other entities. - if(!UserControls.isInternalView()) - { - // Update position according to the animations. - CPlayerCL::updatePos(t, target); - _LastFrameTime = t*0.001; - // Set The FPV when indoor. - if(forceIndoorFPV()) - viewMode(FirstPV, false); - return; - } - /* - else - { - // update anim state at least (needed when a spell is cast to play the cast fx at the right time, because they may be visible) - updateAnimationState(); - }*/ - - // Compute the Time Step. - double frameTimeRemaining = computeTimeStep(((double)t)*0.001); - // Do not update animation if Client Light - if (!ClientCfg.Light) - { - // Attack Animation. - if(_AnimAttackOn) - { - if(animIndex(MOVE) != ::CAnimation::UnknownAnim) - { - if(animOffset(MOVE) >= EAM->getAnimationLength(animId(MOVE))) - { - _AnimAttackOn = false; - updateVisualDisplay(); - } - } - } - - // Increase the time in the current animation. - double previousTimeOffset = animOffset(MOVE); - double offset = previousTimeOffset + frameTimeRemaining; - // Check Anim length - double animLength = EAM->getAnimationLength(animId(MOVE)); - if(offset > animLength) - animOffset(MOVE, animLength); - else - animOffset(MOVE, offset); - // Manage Events that could be created by the animation (like sound). - animEventsProcessing(previousTimeOffset, animOffset(MOVE)); - } - // Get the right pos from PACS. - if(_Primitive && GR) - { - UGlobalPosition gPos; - _Primitive->getGlobalPosition(gPos, dynamicWI); - - // Set the new current pos. - pos(GR->getGlobalPosition(gPos)); - } - // Set the direction. - if( ClientCfg.AutomaticCamera ) - { - //dir(front()); - } - // Reset the TPV when outdoor if needed. - if(_Primitive && GR) - { - UGlobalPosition gPos; - _Primitive->getGlobalPosition(gPos, dynamicWI); - if(!GR->isInterior(gPos)) - if(!ClientCfg.FPV) - viewMode(ThirdPV, false); - } - // Current time is now the entity time too. - _LastFrameTime = t*0.001; -}// updatePos // - -//----------------------------------------------- -// updateDisplay : -// Update the PACS position after the evalCollision. The entity position is set too. This is fast. -// If the entity position is too far from its PACS position, setGlobalPosition is called. -// After this call, the position.z is valid. -//----------------------------------------------- -void CUserEntity::pacsFinalizeMove() // virtual -{ - if(_Primitive == 0) - return; - - // Get the global position - _FinalPacsPos = _Primitive->getFinalPosition(dynamicWI); - - // Get the global position - UGlobalPosition gPos; - _Primitive->getGlobalPosition(gPos, dynamicWI); - if(gPos.InstanceId != -1) - { - pos(_FinalPacsPos); - if(_Mount != CLFECOMMON::INVALID_SLOT) - { - CEntityCL *mount = EntitiesMngr.entity(_Mount); - if(mount) - mount->pacsPos(pos()); - } - } - else - _SetGlobalPositionDone = false; -}// pacsFinalizeMove // - - -//----------------------------------------------- -// applyBehaviour : -// Apply the behaviour for the user. -//----------------------------------------------- -void CUserEntity::applyBehaviour(const CBehaviourContext &behaviourContext) // virtual -{ - const MBEHAV::CBehaviour &behaviour = behaviourContext.Behav; - // Special code for the First Person View - if((viewMode() == FirstPV) && behaviour.isCombat()) - { - // Backup the current behaviour. - _CurrentBehaviour = behaviourContext.Behav; - dir(front()); - - // check if self-target - bool selfSpell = false; - if (behaviourContext.Targets.Targets.size() == 1) - { - if (behaviourContext.Targets.Targets[0].TargetSlot == 0) - { - selfSpell = true; - } - } - bool isOffensif; - switch(behaviour.Behaviour) - { - case MBEHAV::CAST_OFF: - case MBEHAV::CAST_OFF_FAIL: - case MBEHAV::CAST_OFF_SUCCESS: - case MBEHAV::CAST_OFF_LINK: - isOffensif = true; - break; - default: - isOffensif = false; - break; - } - - // Default target hit dates - static vector targetHitDates; - targetHitDates.clear(); - targetHitDates.resize(behaviourContext.Targets.Targets.size(), TimeInSec); - - // cast projectiles/impact linked to behaviour - updateCurrentAttack(); - if (isCurrentBehaviourAttackEnd()) - { - // In First Person (don't care), use a default animation => will choose a default delay of 0.5 - performCurrentAttackEnd(behaviourContext, selfSpell && isOffensif, - targetHitDates, CAnimationStateSheet::UnknownState); - } - // - _RightFXActivated = false; - _LeftFXActivated = false; - if(EAM) - { - animState (MOVE, CAnimationStateSheet::FirstPersonAttack); - animIndex (MOVE, CAnimation::UnknownAnim); - animOffset(MOVE, 0.0); - _CurrentState = EAM->mState(_CurrentAutomaton, animState(MOVE)); - if(_CurrentState && _CurrentAnimSet[MOVE]) - { - const CAnimationState *animStatePtr = _CurrentAnimSet[MOVE]->getAnimationState(animState(MOVE)); - if(animStatePtr) - { - animIndex(MOVE, animStatePtr->chooseAnim(_AnimJobSpecialisation, people(), getGender(), 0.0)); - if(animIndex(MOVE) != CAnimation::UnknownAnim) - { - if(_PlayList) - { - _PlayList->setAnimation (MOVE, animId(MOVE)); - _PlayList->setTimeOrigin (MOVE, ryzomGetLocalTime ()*0.001);//_LastFrameTime); - _AnimAttackOn = true; - updateVisualDisplay(); - } - } - } - } - } - // Start FX to play at the animation beginning like trails. - if(_CurrentBehaviour.Behaviour == MBEHAV::RANGE_ATTACK) - { - startItemAttackFXs(_CurrentBehaviour.Range.ImpactIntensity != 0, _CurrentBehaviour.Range.ImpactIntensity); - } - else - { - startItemAttackFXs(_CurrentBehaviour.Combat.ImpactIntensity != 0 && _CurrentBehaviour.Combat.HitType != HITTYPE::Failed, _CurrentBehaviour.Combat.ImpactIntensity); - } - // DeltaHP - applyBehaviourFlyingHPs(behaviourContext, behaviour, targetHitDates); - } - // In third person view (or camera mode), play the same way than for the others. - else - CPlayerCL::applyBehaviour(behaviourContext); -}// applyBehaviour // - -//--------------------------------------------------- -// setDead : -// Method to Flag the character as dead and do everything needed. -//--------------------------------------------------- -void CUserEntity::setDead() // virtual -{ - // User is dead -> NO FOLLOW - disableFollow(); - // Remove the selection. - UserEntity->selection(CLFECOMMON::INVALID_SLOT); - // Death Mode Control and view. - UserControls.mode(CUserControls::DeathMode); - // Play the FX for the death - NL3D::UParticleSystemInstance deathFX = FXMngr.instantFX(ClientCfg.DeadFXName); - if(!deathFX.empty()) - deathFX.setPos(selectBox().getCenter()); - - // Last teleport is a death - - // get player's kami fame - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - sint8 kamiFame = 0; - uint kamiFameIndex = CStaticFames::getInstance().getFactionIndex("kami"); - if (pIM && kamiFameIndex != CStaticFames::INVALID_FACTION_INDEX) - { - CCDBNodeLeaf *pLeafKamiFame = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:FAME:PLAYER%d:VALUE", kamiFameIndex - 1), false); - if (pLeafKamiFame != NULL) - kamiFame = pLeafKamiFame->getValue8(); - } - - // get player's karavan fame - sint8 karavanFame = 0; - uint karavanFameIndex = CStaticFames::getInstance().getFactionIndex("karavan"); - if (pIM && karavanFameIndex != CStaticFames::INVALID_FACTION_INDEX) - { - CCDBNodeLeaf *pLeafKaravanFame = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:FAME:PLAYER%d:VALUE", karavanFameIndex - 1), false); - if (pLeafKaravanFame != NULL) - karavanFame = pLeafKaravanFame->getValue8(); - } - - // set loading background depending on player's faction fame - if (kamiFame > karavanFame) - LoadingBackground = ResurectKamiBackground; - else - LoadingBackground = ResurectKaravanBackground; - - // disable or enable shadowing - updateCastShadowMap(); - - // enable death warning popup - //CInterfaceManager * pIM = CInterfaceManager::getInstance(); - if( pIM ) - { - CAHManager::getInstance()->runActionHandler("set",NULL,"dblink=UI:VARIABLES:DEATH_WARNING_WANTED|value=1"); - } -}// setDead // - -//----------------------------------------------- -// skillUp : -// Skill Up -//----------------------------------------------- -void CUserEntity::skillUp() -{ - // Play the FX for the death - NL3D::UParticleSystemInstance skillUpFX = FXMngr.instantFX(ClientCfg.SkillUpFXName); - skillUpFX.setClusterSystem(getClusterSystem()); - if(!skillUpFX.empty()) - skillUpFX.setPos(pos()); -}// skillUp // - -//----------------------------------------------- -// startColTimer : -// After a few time, if the user is still in collision with someone else, remove collisions with other entitites. -//----------------------------------------------- -void CUserEntity::startColTimer() -{ - if(_ColOn) - { - if(_ColRemoved==false) - { - if((T1-_ColStartTime) > ClientCfg.TimeToRemoveCol) - { - EntitiesMngr.removeColUserOther(); - _ColRemoved = true; - } - } - } - else - { - _ColOn = true; - _ColStartTime = T1; - } -}// startColTimer // - -//----------------------------------------------- -// stopColTimer : -// Called when the user is no more in collision with another entity. -//----------------------------------------------- -void CUserEntity::stopColTimer() -{ - // Restore collisions. - if(_ColRemoved) - { - EntitiesMngr.restoreColUserOther(); - _ColRemoved = false; - } - _ColOn = false; -}// stopColTimer // - - - -//----------------------------------------------- -// getMaxSpeed -// Return the current max speed for the entity in meter per sec -// The method return a max according to the speed factor (given by the server) -// It's also return a value according to the landscape (water) -// Also managed mounts -//----------------------------------------------- -double CUserEntity::getMaxSpeed() const // virtual -{ - // Max Defined speed according to the current factor (slow, or speed increased) - double maxSpeed = _SpeedFactor.getValue(); - // User is Dead - if(isDead()) - { - maxSpeed *= 0.0; - } - // User is sitting - else if(isSit()) - { - maxSpeed *= 0.0; - } - // User is swimming - else if(isSwimming()) - { - - // We are a Ring DM so speed up a litle - if (_R2CharMode == R2::TCharMode::Editer || _R2CharMode == R2::TCharMode::Dm) - { - maxSpeed *= ClientCfg.DmRun / 2; - } - else - { - // Run - maxSpeed *= 3.0; - } - } - else if(isRiding()) - { - // Run if mount not hungry, otherwise, use walk velocity - if (_MountHunger.canRun()) - maxSpeed *= (double)getMountRunVelocity(); - else - maxSpeed *= (double)getMountWalkVelocity(); - } - else - { - // Run - maxSpeed *= runVelocity(); - } - // Return the current max - return maxSpeed; -// return ClientCfg.Run * _SpeedFactor.getValue(); -}// getMaxSpeed // - - -//----------------------------------------------- -// snapToGround : -// Snap the user to the ground. -//----------------------------------------------- -void CUserEntity::snapToGround() -{ - CEntityCL::snapToGround(); - - updateSound (ryzomGetLocalTime ()); -}// // snapToGround // - - -//----------------------------------------------- -// updateSound : -//----------------------------------------------- -void CUserEntity::updateSound(const TTime &time) -{ - H_AUTO_USE ( RZ_Client_Update_Sound ); - - // no sound manager, no need to update sound - if (SoundMngr == NULL) - return; - - if (!(StereoHMD && true)) // TODO: ClientCfg.Headphone - { - // NOTE: StereoHMD+Headphone impl in main_loop.cpp - SoundMngr->setListenerPos(pos()); - const CMatrix &camMat = MainCam.getMatrix(); - SoundMngr->setListenerOrientation(camMat.getJ(), camMat.getK()); - } - - if (ClientCfg.Light) - return; - - // step sound of self : refind the sound animations associated to the walk and run animation - - static bool computeAnim = true; - static bool lastMode = false; - static TTime previousTime = 0; - static TTime stepTime = 0; - static bool leftRight = false; - static NLSOUND::CSoundAnimMarker *leftStep = 0; - static NLSOUND::CSoundAnimMarker *rightStep = 0; - - // TODO : Remove when bug corrected: - if (_Gender == GSGENDER::unknown) - { - nlwarning("CUserEntity::updateSound : The gender is unknown, forcing it to male"); - _Gender = GSGENDER::male; - } - - // force recompute of anim if walk/run change. - computeAnim = computeAnim || (lastMode != _Run); - - // Check the sound animation to find the time between to step - if(computeAnim && SoundMngr && _CurrentAnimSet[MOVE] != 0) // && _SoundId[MOVE] != NLSOUND::CSoundAnimationNoId) - { - lastMode = _Run; - TAnimStateId mode = _Run ? CAnimationStateSheet::Run : CAnimationStateSheet::Walk; - const CAnimationState *animStatePtr = _CurrentAnimSet[MOVE]->getAnimationState (mode); - if (animStatePtr) - { - ::CAnimation::TAnimId animId = animStatePtr->chooseAnim (_AnimJobSpecialisation, people(), getGender(), 0); - if (animId != ::CAnimation::UnknownAnim) - { - const ::CAnimation *anim = animStatePtr->getAnimation (animId); - if(anim) - { - // Select the sound ID - _SoundId[MOVE] = anim->soundId(); - - if (_SoundId[MOVE] != NLSOUND::CSoundAnimationNoId) - { - // retrieve the anim - NLSOUND::CSoundAnimManager *mgr = NLSOUND::CSoundAnimManager::instance(); - - string name = mgr->idToName(_SoundId[MOVE]); - - if (!name.empty()) - { - NLSOUND::CSoundAnimation *sanim = mgr->findAnimation(name); - if (sanim->countMarkers() != 2) - { - static set warnOnce; - if (warnOnce.find(sanim->getName()) == warnOnce.end()) - { - nlwarning("Sound animation '%s' has not 2 markers, not a biped ? (Display Once)", sanim->getName().c_str()); - warnOnce.insert(sanim->getName()); - } - } - else - { - stepTime = TTime((sanim->getMarker(1)->getTime() - sanim->getMarker(0)->getTime()) * 1000); - rightStep = sanim->getMarker(0); - leftStep = sanim->getMarker(1); - computeAnim = false; - } - } - } - } - } - } - } - - if( SoundMngr && _Mode == MBEHAV::NORMAL) - { - if (!getVelocity().isNull()) - { - if (stepTime > 0 && time-previousTime>=stepTime) - { - previousTime = time; - - // set the sound 1 meter below listener - _SoundContext.Position = pos() + CVector(0,0,-1); - _SoundContext.RelativeGain = SoundMngr->getUserEntitySoundLevel();; - - uint32 matId= getGroundType(); - //nldebug("Current material = %u", matId); - _SoundContext.Args[0] = matId; - - if (leftRight) - { - if (leftStep) - // TODO : find the correct cluster - leftStep->play(SoundMngr->getMixer(), NULL, _SoundContext); - } - else - { - if (rightStep) - // TODO : find the correct cluster - rightStep->play(SoundMngr->getMixer(), NULL, _SoundContext); - - // recompute a new sound anim - computeAnim = true; - } - - leftRight = !leftRight; - } - } - else - { - // resets the counter - previousTime = 0; - } - } -}// updateSound // - - -//----------------------------------------------- -// rotate : -// rotate the body on the left or right (front changes). -//----------------------------------------------- -void CUserEntity::rotate(float ang) -{ - // Rotate the body. - CMatrix m; - m.identity(); - m.rotateZ(ang); - front(m * front().normed()); -}// rotate // - - -//----------------------------------------------- -// rotHeadVertically : -// rotate the head vertically. -//----------------------------------------------- -void CUserEntity::rotHeadVertically(float ang) -{ - setHeadPitch(_HeadPitch+ang); -}// rotHeadVertically // - - -//----------------------------------------------- -// setHeadPitch(double hp) -//----------------------------------------------- -void CUserEntity::setHeadPitch(double hp) -{ - _HeadPitch= hp; - const double bound= Pi/2 - 0.01; // epsilon to avoid gimbal lock - clamp(_HeadPitch, -bound, bound); -} - -//--------------------------------------------------- -// slotRemoved : -// To Inform about an entity removed (to remove from selection for example). -// This will remove the entity from the target. -// \param slot : Slot of the entity that will be removed. -//--------------------------------------------------- -void CUserEntity::slotRemoved(const CLFECOMMON::TCLEntityId &slot) -{ - // parent call - CPlayerCL::slotRemoved(slot); - - // reset also selection - if(selection() == slot) - selection(CLFECOMMON::INVALID_SLOT); -}// slotRemoved // - -//--------------------------------------------------- -// selection : -// Change the entity selected. -// \param slot : slot now selected (CLFECOMMON::INVALID_SLOT for an empty selection). -// \warning Can be different from the entity targeted (in combat mode for example). -//--------------------------------------------------- -void CUserEntity::selection(const CLFECOMMON::TCLEntityId &slot) // virtual -{ - //allows reselection in Ring client: even if the selected slots is equal to the selection, - //the client must send the messages. - if ((_Selection == slot) && !ClientCfg.R2EDEnabled) - return; - - // The selection will be the entity to watch - WatchedEntitySlot = slot; - disableFollow(); - - // Send the entity selected to the server. - NetMngr.pushTarget(slot); - - - // Target the slot on client, don't wait NetWork response - targetSlot(slot); - _TargetSlotNoLag= slot; - - if (ClientCfg.R2EDEnabled) - { - R2::getEditor().inGameSelection(slot); - } - - - // Change the current selection so un color the current selection. - CEntityCL *sel = EntitiesMngr.entity(_Selection); - if(sel != NULL) - sel->visualSelectionStop(); // Blink off == restore to normal - - // Set the entity selected - _Selection = slot; - - // Update visual selection and interface - if ( sel && sel->isForageSource() ) - sel->buildInSceneInterface(); // remove focus on previous selected source - sel = EntitiesMngr.entity(_Selection); - if(sel != NULL) - { - sel->visualSelectionStart(); - if ( sel->isForageSource() ) - sel->buildInSceneInterface(); // set focus on new selected source - } - - - // **** Update Target interface - //get the new target slot and set it in the database - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:TARGET:SLOT")->setValue64(slot); - - // Get the new target UID, and set in Database - uint tgtSlot= _Selection; - uint32 tgtEntityId= CLFECOMMON::INVALID_CLIENT_DATASET_INDEX; - CEntityCL *entity = NULL; - if (tgtSlot!=CLFECOMMON::INVALID_SLOT) - { - entity = EntitiesMngr.entity(tgtSlot); - if (entity) - tgtEntityId= entity->dataSetId(); - } - - // Set the User Target - CCDBNodeLeaf *prop = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:TARGET:UID", false); - if(prop) - prop->setValue32(tgtEntityId); - - // Bar Manager. Update now the Target View (so it takes VP if data available or 0... but result is immediate) - CBarManager::getInstance()->setLocalTarget(tgtEntityId); - - // **** Update DB for InGameMenu - // clear the entries for mission option - for(uint k = 0; k < NUM_MISSION_OPTIONS; ++k) - { - CCDBNodeLeaf *missionOption = NLGUI::CDBManager::getInstance()->getDbProp(toString("LOCAL:TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%d:TITLE", (int) k), false); - if (missionOption) - { - missionOption->setValue32(0); - } - CCDBNodeLeaf *playerGiftNeeded = NLGUI::CDBManager::getInstance()->getDbProp(toString("LOCAL:TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%d:PLAYER_GIFT_NEEDED", (int) k), false); - if (playerGiftNeeded) - { - playerGiftNeeded->setValue32(0); - } - } -/* TODO ULU : Add RP tags */ - - // update pvp tags - if ((tgtSlot!=CLFECOMMON::INVALID_SLOT) && entity) - { - CPlayerCL *pPlayer = dynamic_cast(entity); - - if (pPlayer) - { - /*// Pvp Mode - CViewBitmap * tagMode = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:target:pvp_tags:mode")); - if (tagMode) - { - if (pPlayer->getPvpMode()&PVP_MODE::PvpFaction) - tagMode->setTexture("pvp_orange.tga"); - else if (pPlayer->getPvpMode()&PVP_MODE::PvpFactionFlagged) - tagMode->setTexture("pvp_red.tga"); - else - tagMode->setTexture("alpha_10.tga"); - } -*/ - /*// Pvp available actions (attack, heal, both) - CViewBitmap * tagMode = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:target:pvp_tags:actions")); - if (tagMode) - { - if (pPlayer->getPvpMode()&PVP_MODE::PvpFaction) - tag->setTexture("pvp_orange.tga"); - else if (pPlayer->getPvpMode()&PVP_MODE::PvpFactionFlagged) - tag->setTexture("pvp_red.tga"); - else - tag->setTexture("alpha_10.tga"); - }*/ - - } - } - - // clear web page - prop= NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:TARGET:CONTEXT_MENU:WEB_PAGE_URL", false); - if(prop) prop->setValue32(0); - prop= NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:TARGET:CONTEXT_MENU:WEB_PAGE_TITLE", false); - if(prop) prop->setValue32(0); - - // clear mission ring - for(uint k = 0; k < BOTCHATTYPE::MaxR2MissionEntryDatabase; ++k) - { - prop= NLGUI::CDBManager::getInstance()->getDbProp(toString("LOCAL:TARGET:CONTEXT_MENU:MISSION_RING:%d:TITLE", k), false); - if(prop) prop->setValue32(0); - } - - // clear programs - prop= NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:TARGET:CONTEXT_MENU:PROGRAMMES", false); - if(prop) prop->setValue32(0); - prop= NLGUI::CDBManager::getInstance()->getDbProp("SERVER:TARGET:CONTEXT_MENU:PROGRAMMES"); - if(prop) prop->setValue32(0); - // increment db counter for context menu - pIM->incLocalSyncActionCounter(); - -}// selection // - -//--------------------------------------------------- -// moveToAttack : -// Method to place the user to attack the target and attack. -//--------------------------------------------------- -void CUserEntity::moveToAttack() -{ - // **** For clarity, try to launch a "default attack" found in the memory bar instead of an "anonymous" action - CSPhraseManager *pPM= CSPhraseManager::getInstance(); - uint32 memLine, memSlot; - CEntityCL *target= EntitiesMngr.entity(selection()); - - CInventoryManager *inv = CInventoryManager::getInstance(); - - // auto-equip with valid weapon - if( ClientCfg.AutoEquipTool ) - { - if(inv) - { - // if no valid weapons in had -> auto-equip with last used weapons - bool validWeaponInHand = true; - uint32 rightHandSheet = inv->getRightHandItemSheet(); - if(rightHandSheet) - { - validWeaponInHand = inv->isMeleeWeaponItem(rightHandSheet) || inv->isRangeWeaponItem(rightHandSheet); - } - if( !validWeaponInHand ) - { - autoEquipWithLastUsedWeapons(); - } - - // remember last used weapon(s) - rememberWeaponsInHand(); - } - } - - if(target && pPM->findDefaultAttack(memLine, memSlot)) - { - // launch instead a phrase execution with this phrase - executeCombatWithPhrase(target, memLine, memSlot, true); - } - // **** Else launch an anonymous "default attack" - else - { - // melee or range? - bool melee = true; - if(inv) - { - uint32 rightHandSheet = inv->getRightHandItemSheet(); - if(rightHandSheet) - melee = inv->isMeleeWeaponItem(rightHandSheet); - } - - // Move to target if melee weapon - if(melee) - moveTo(selection(), 2.0, CUserEntity::Attack); - // Just attack if range weapon. - else - attack(); - } -}// moveToAttack // - -//--------------------------------------------------- -// attack : -// Method to attack the target. -//--------------------------------------------------- -void CUserEntity::attack() -{ - // execute the default attack - CSPhraseManager *pPM= CSPhraseManager::getInstance(); - pPM->executeDefaultAttack(); - - bool melee = true; - CInventoryManager *inv = CInventoryManager::getInstance(); - if(inv) - { - uint32 rightHandSheet = inv->getRightHandItemSheet(); - if(rightHandSheet) - melee = inv->isMeleeWeaponItem(rightHandSheet); - } - - // If option ON, follow when attacking. - if(ClientCfg.FollowOnAtk) - { - // Follow only if attacking with a melee weapon - if(melee) - // enable, but don't reset camera rotation - enableFollow(false); - } -}// attack // - -//--------------------------------------------------- -// attack : -// Method to attack the target, with a special phrase -//--------------------------------------------------- -void CUserEntity::attackWithPhrase() -{ - if( !canEngageCombat() ) - return; - - CSPhraseManager *pPM= CSPhraseManager::getInstance(); - - // validate the execution on server - pPM->sendExecuteToServer(_MoveToPhraseMemoryLine, _MoveToPhraseMemorySlot, _MoveToPhraseCyclic); - - // If the Attack is a "Next", and not a cycle, do a default attack - if(!_MoveToPhraseCyclic) - pPM->executeDefaultAttack(); - - // If option ON, follow when attacking. - if(ClientCfg.FollowOnAtk) - { - bool melee = true; - CInventoryManager *inv = CInventoryManager::getInstance(); - if(inv) - { - uint32 rightHandSheet = inv->getRightHandItemSheet(); - if(rightHandSheet) - melee = inv->isMeleeWeaponItem(rightHandSheet); - } - // Follow only if attacking with a melee weapon - if(melee) - // enable, but don't reset camera rotation - enableFollow(false); - } - - // Because sendExecuteToServer() has been called, must NOT cancelClientExecute() at resetAnyMoveTo() - _MoveToAction= CUserEntity::None; -} - -//----------------------------------------------- -// assist : -// your current target become the target of your current one. -//----------------------------------------------- -void CUserEntity::assist() -{ - assist(targetSlot()); -}// assist // - -//----------------------------------------------- - -void CUserEntity::assist(uint slot) -{ - // Check the current target - if(slot == CLFECOMMON::INVALID_SLOT || slot == _Slot) - return; - // Check the target - CEntityCL *target = EntitiesMngr.entity(slot); - if(target == 0) - return; - // Check the new slot. - CLFECOMMON::TCLEntityId newSlot = target->targetSlot(); - if(newSlot == CLFECOMMON::INVALID_SLOT || newSlot == _Slot) - return; - // Select the new target. - selection(newSlot); -} - -//--------------------------------------------------- -// disengage : -// Method to disengage the target. -//--------------------------------------------------- -void CUserEntity::disengage() -{ - // Set the database in local. - if(ClientCfg.Local) - { - IngameDbMngr.setProp("Entities:E0:P" + toString(CLFECOMMON::PROPERTY_MODE), MBEHAV::NORMAL); // Mode - IngameDbMngr.setProp("Entities:E0:P" + toString(CLFECOMMON::PROPERTY_TARGET_ID), _Selection); // Target - UserEntity->updateVisualProperty(0, CLFECOMMON::PROPERTY_MODE); - UserEntity->updateVisualProperty(0, CLFECOMMON::PROPERTY_TARGET_ID); - return; - } - - // Disengage MSG. - const string msgName = "COMBAT:DISENGAGE"; - CBitMemStream out; - if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) - NetMngr.push(out); - else - nlwarning("UE::disengage: unknown message named '%s'.", msgName.c_str()); - - // Change the current mode. - mode(MBEHAV::NORMAL); -}// disengage // - -//----------------------------------------------- -// sit : -// Ask for the client to sit/stand ('true' to sit). -//----------------------------------------------- -bool CUserEntity::sit(bool s) -{ - bool ok= false; - - // SIT - if(s) - { - if(canSit() == true) - { - // disable afk mode - setAFK(false); - - // Sit MSG. - if(mode(MBEHAV::SIT)) - { - // autowalk disabled - UserControls.autowalkState(false); - - const string msgName = "COMMAND:SIT"; - CBitMemStream out; - if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) - { - out.serial(s); - NetMngr.push(out); - } - else - nlwarning("UE:sit: unknown message named '%s'.", msgName.c_str()); - - // mode changed - ok= true; - - // display sit msg - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - ucstring msg = CI18N::get("msgUserIsSitting"); - string cat = getStringCategory(msg, msg); - pIM->displaySystemInfo(msg, cat); - } - } - } - // STAND - else - { - if(_Mode == MBEHAV::SIT) - { - if(mode(MBEHAV::NORMAL)) - { - const string msgName = "COMMAND:SIT"; - CBitMemStream out; - if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) - { - out.serial(s); - NetMngr.push(out); - } - else - nlwarning("UE:sit: unknown message named '%s'.", msgName.c_str()); - - // mode changed - ok= true; - - // display stand msg - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - ucstring msg = CI18N::get("msgUserIsStanding"); - string cat = getStringCategory(msg, msg); - pIM->displaySystemInfo(msg, cat); - } - } - } - - // if mode changed, Write to the UI database, to update views - if(ok) - { - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - CCDBNodeLeaf *node= NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:PLAYER_STAND", false); - if(node) - node->setValue32(_Mode != MBEHAV::SIT); - } - - // mode changed - return ok; -}// sit // - -//----------------------------------------------- -// canSit : -// Return true if the user can sit. -//----------------------------------------------- -bool CUserEntity::canSit() const -{ - // If the user is not already sitting or is on a mount - if(!isSit() && (!isRiding()) && !isDead() && !isSwimming()) - { - return true; - } - else - return false; -}// canSit // - -//----------------------------------------------- -// setAFK -//----------------------------------------------- -void CUserEntity::setAFK(bool b, string afkTxt) -{ - if( isAFK() == b ) return; - - if (b) - { - if( isDead() || isRiding() || moveTo() || follow() ) - return; - - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - //sint64 start = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:USER:ACT_TSTART")->getValue64(); - //sint64 end = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:USER:ACT_TEND")->getValue64(); - //sint64 type = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:USER:ACT_TYPE")->getValue64(); - //sint64 num = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:USER:ACT_NUMBER")->getValue64(); - if( pIM ) - { - if( NLGUI::CDBManager::getInstance()->getDbProp("SERVER:USER:ACT_TYPE")->getValue64() != 0 ) - return; - } - - if( !isSit() && !isSwimming() ) - { - if( !mode(MBEHAV::REST) ) - return; - } - } - else - { - if( !isSit() && !isSwimming() ) - { - if (isDead()) - return; - else - mode(MBEHAV::NORMAL); - } - } - - // send afk state - string msgName = "COMMAND:AFK"; - CBitMemStream out; - if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) - { - out.serial(b); - NetMngr.push(out); - } - else - nlwarning("CUserEntity:setAFK: unknown message named '%s'.", msgName.c_str()); - - // custom afk txt - ucstring ucstr; - ucstr.fromUtf8( afkTxt ); - CBitMemStream outTxt; - msgName = "STRING:AFK_TXT"; - if( GenericMsgHeaderMngr.pushNameToStream(msgName,outTxt) ) - { - outTxt.serial( ucstr ); - NetMngr.push( outTxt ); - } - else - { - nlwarning("CUserEntity:setAFK: unknown message named '%s'.", msgName.c_str()); - } - - -}// setAFK // - -//----------------------------------------------- -// rollDice -//----------------------------------------------- -void CUserEntity::rollDice(sint16 min, sint16 max, bool local) -{ - if (local) - { - // no need to broadcast over network here - static NLMISC::CRandom* dice = (NLMISC::CRandom*)NULL; - if (!dice) - { - dice = new NLMISC::CRandom; - dice->srand(CTickEventHandler::getGameCycle()); - } - sint16 roll = min + (sint16)dice->rand(max-min); - - ucstring msg = CI18N::get("msgRollDiceLocal"); - strFindReplace(msg, "%min", toString(min)); - strFindReplace(msg, "%max", toString(max)); - strFindReplace(msg, "%roll", toString(roll)); - - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - - pIM->displaySystemInfo(msg, getStringCategory(msg, msg)); - return; - } - const string msgName = "COMMAND:RANDOM"; - CBitMemStream out; - if (GenericMsgHeaderMngr.pushNameToStream(msgName, out)) - { - out.serial(min); - out.serial(max); - NetMngr.push(out); - } - else - nlwarning("CUserEntity:rollDice: unknown message named '%s'.", msgName.c_str()); -}// rollDice // - -//--------------------------------------------------- -// canEngageCombat : -// return true if user can engage melee combat, else return false and display system msg -//--------------------------------------------------- -bool CUserEntity::canEngageCombat() -{ - if( isSit() ) - { - // display "you can't fight while sitting" message) - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - ucstring msg = CI18N::get("msgCantFightSit"); - string cat = getStringCategory(msg, msg); - pIM->displaySystemInfo(msg, cat); - - return false; - } - - if( isSwimming() ) - { - // display "you can't fight while swiming" message) - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - ucstring msg = CI18N::get("msgCantFightSwim"); - string cat = getStringCategory(msg, msg); - pIM->displaySystemInfo(msg, cat); - - return false; - } - - if ( isRiding() ) - { - // display "you can't fight while swimming" message) - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - ucstring msg = CI18N::get("msgCantFightRide"); - string cat = getStringCategory(msg, msg); - pIM->displaySystemInfo(msg, cat); - - return false; - } - - return true; -} // canEngageCombat // - - -//--------------------------------------------------- -// viewMode : -// Change the View (First/Third Person View). -//--------------------------------------------------- -void CUserEntity::viewMode(CUserEntity::TView viewMode, bool changeView) -{ - switch(viewMode) - { - // First Person View - case FirstPV: - if(changeView) - ClientCfg.FPV = true; - if(_Mount != CLFECOMMON::INVALID_SLOT) - { - CEntityCL *mount = EntitiesMngr.entity(_Mount); - if(mount) - mount->displayable(false); - - _HiddenMount = _Mount; - } - // Change Controls. - if( isRiding() ) - { - bool autoWalk = UserControls.autowalkState(); - UserControls.mode(CUserControls::MountMode); - if( autoWalk ) - UserControls.autowalkState( true ); - } - else - UserControls.mode(CUserControls::InterfaceMode); - break; - - // Third Person View - case ThirdPV: - if(changeView) - ClientCfg.FPV = false; - - if(_HiddenMount != CLFECOMMON::INVALID_SLOT) - { - CEntityCL *mount = EntitiesMngr.entity(_HiddenMount); - if(mount) - mount->displayable(true); - - _HiddenMount = CLFECOMMON::INVALID_SLOT; - } - // Change Controls. - UserControls.mode(CUserControls::ThirdMode); - break; - - // Unknown - default: - nlwarning("UE:viewMode: Unknown View Asked '%d'.", (sint)viewMode); - return; - } - - // Change the current View like asked. - _ViewMode = viewMode; - - // disable or enable shadowing - updateCastShadowMap(); -}// viewMode // - -//----------------------------------------------- -// toggleCamera : -// Toggle Camera (First/Third Person) -//----------------------------------------------- -void CUserEntity::toggleCamera() -{ - // You cannot change the camera view when dead. - if(isDead()) - return; - // Only if not inside a building. - if(!UserEntity->forceIndoorFPV()) - { - // Leave the 1st Person Mode -> Enter the 3rd Person View Mode - if (UserEntity->viewMode() == CUserEntity::FirstPV) - UserEntity->viewMode(CUserEntity::ThirdPV); - // Leave the 3rd Person Mode -> Enter the 1st Person View Mode - else - UserEntity->viewMode(CUserEntity::FirstPV); - } -}// toggleCamera // - -//----------------------------------------------- -// forceCameraFirstPerson : -// Force Camera to First Person View -//----------------------------------------------- -void CUserEntity::forceCameraFirstPerson() -{ - // You cannot change the camera view when dead. - if(isDead()) - return; - // Only if not inside a building. - if(!UserEntity->forceIndoorFPV()) - { - if (UserEntity->viewMode() != CUserEntity::FirstPV) - //Enter the 1st Person View Mode - UserEntity->viewMode(CUserEntity::FirstPV); - } -}// forceCameraFirstPerson // - -//--------------------------------------------------- -// getScale : -// Return the entity scale. (return 1.0 if there is any problem). -// \todo GUIGUI : do we have to take care of the user's race kwnowing it can favour him ? -//--------------------------------------------------- -float CUserEntity::getScale() const // virtual -{ - // Default Scale. - return 1.0f; -}// getScale // - -//--------------------------------------------------- -// removeCheckPrimitive : -// Remove the check primitive -//--------------------------------------------------- -void CUserEntity::removeCheckPrimitive() -{ - if(PACS && _CheckPrimitive) - PACS->removePrimitive(_CheckPrimitive); - _CheckPrimitive = 0; -} - -//--------------------------------------------------- -// removePrimitive : -// Remove the primitive -//--------------------------------------------------- -void CUserEntity::removePrimitive() // virtual (will not be called by ~CEntityCL()) -{ - // Remove the Primitive used for check - removeCheckPrimitive(); - - // Remove the other primitive - CPlayerCL::removePrimitive(); -}// removePrimitive // - -//--------------------------------------------------- -// computePrimitive : -// Create a primitive for the entity. -//--------------------------------------------------- -void CUserEntity::computePrimitive() // virtual -{ - // Initialize the primitive. - if(initPrimitive(0.5f, 2.0f, 0.0f, 0.0f, UMovePrimitive::Slide, (UMovePrimitive::TTrigger)(UMovePrimitive::OverlapTrigger | UMovePrimitive::EnterTrigger), MaskColPlayer, MaskColPlayer | MaskColNpc | MaskColDoor)) - _Primitive->insertInWorldImage(dynamicWI); - // Set the position. - pacsPos(pos()); -}// computePrimitive // - - -//--------------------------------------------------- -// isBusy : -// Return if the user is already busy (combat/bo chat/loot/ etc.). -//--------------------------------------------------- -bool CUserEntity::isBusy() const -{ - CInterfaceManager *IM = CInterfaceManager::getInstance (); - // Check Trade. - - // TODO : put the right DB entry ! - - CCDBNodeLeaf *nod = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:INVENTORY:EXCHANGE:BEGUN", false); - if(nod) - { - if(nod->getValueBool()) - return true; - } -// else -// nlwarning("UE:isBusy: Cannot get the nod 'SERVER:INVENTORY:EXCHANGE:BEGUN'."); - -/* - // Check Loot - static const uint nbSlot = 4; - uint i; - for(i=0; igetDbProp(NLMISC::toString("SERVER:INVENTORY:%d:%d:SHEET", INVENTORIES::pickup, i), false); - if(nod) - { - if(nod->getValue32() != 0) - return true; - } - else - nlwarning("UE:isBusy: Cannot get the nod 'SERVER:INVENTORY:%d:%d:SHEET'.", INVENTORIES::pickup, i); - } - - // Check Harvest - for(i=0; igetDbProp(NLMISC::toString("SERVER:INVENTORY:%d:%d:SHEET", INVENTORIES::harvest, i), false); - if(nod) - { - if(nod->getValue32() != 0) - return true; - } - else - nlwarning("UE:isBusy: Cannot get the nod 'SERVER:INVENTORY:%d:%d:SHEET'.", INVENTORIES::harvest, i); - } -*/ - - // Check Bot chat. - CBotChatPage * currPage = CBotChatManager::getInstance()->getCurrPage(); - if( currPage!= NULL ) - { - return true; - } - - // Not Busy - return false; -}// isBusy // - - -//--------------------------------------------------- -// updateVisualDisplay : -// Show/Hide all or parts of the user body. -// todo GUIGUI : it's bad for the _Face to be a separated instance -//--------------------------------------------------- -void CUserEntity::updateVisualDisplay() -{ - // We need a skeleton. - if(_Skeleton.empty()) - return; - - // 1st person View - if(UserControls.isInternalView() || View.forceFirstPersonView()) - { - // Hide the mount - if (_Mount != CLFECOMMON::INVALID_SLOT) - { - CCharacterCL *mount = dynamic_cast(EntitiesMngr.entity(_Mount)); - if(mount) - mount->displayable(false); - - _HiddenMount = _Mount; - } - else if (_HiddenMount != CLFECOMMON::INVALID_SLOT) - { - // not on mount anymore, but still in FPV - CCharacterCL *mount = dynamic_cast(EntitiesMngr.entity(_HiddenMount)); - if(mount) - mount->displayable(true); - - _HiddenMount = CLFECOMMON::INVALID_SLOT; - } - - // Hide all user body parts. - for(uint i=0; i<_Instances.size(); ++i) - if(!_Instances[i].Current.empty()) - { - _Instances[i].Current.hide(); - _Instances[i].hideStaticFXs(); - } - // Hide the face - if(!_Face.Current.empty()) - _Face.Current.hide(); - - // We want to display weapons in 1st person view when attacking. - if(modeWithHiddenItems() == false) - { - if( _Mode == MBEHAV::COMBAT_FLOAT || _Mode == MBEHAV::COMBAT ) - { - if( _ObjectsVisible ) - { - // Show just Few parts - if(!_Instances[SLOTTYPE::HANDS_SLOT].Current.empty()) - { - _Instances[SLOTTYPE::HANDS_SLOT].Current.show(); - _Instances[SLOTTYPE::HANDS_SLOT].showStaticFXs(); - } - if(!_Instances[SLOTTYPE::ARMS_SLOT].Current.empty()) - { - _Instances[SLOTTYPE::ARMS_SLOT].Current.show(); - _Instances[SLOTTYPE::ARMS_SLOT].showStaticFXs(); - } - if(!_Instances[SLOTTYPE::RIGHT_HAND_SLOT].Current.empty()) - { - _Instances[SLOTTYPE::RIGHT_HAND_SLOT].Current.show(); - _Instances[SLOTTYPE::RIGHT_HAND_SLOT].showStaticFXs(); - } - if(!_Instances[SLOTTYPE::LEFT_HAND_SLOT].Current.empty()) - { - _Instances[SLOTTYPE::LEFT_HAND_SLOT].Current.show(); - _Instances[SLOTTYPE::LEFT_HAND_SLOT].showStaticFXs(); - } - } - } - } - } - else - { - // Show the mount - CCharacterCL *mount = dynamic_cast(EntitiesMngr.entity(_Mount)); - if(mount) - { - mount->displayable(true); - - showOrHideBodyParts( objectsVisible() ); - } - - // Show the face - /* - if(!_Face.Current.empty()) - _Face.Current.show(); - */ - } -}// updateVisualDisplay // - -//--------------------------------------------------- -// light: -// Show/Hide the user light. -//--------------------------------------------------- -void CUserEntity::light() -{ - // Create the light - if(_Light.empty()) - { - // Check there is a skeleton and a bone to stick the light before to create it. - if(!_Skeleton.empty() && _NameBoneId!=-1) - { - _Light = Scene->createPointLight(); - if(!_Light.empty()) - { - // front of the player - _Light.setPos(0.f,0.3f,0.f); - // Setup the light - _Light.setupAttenuation(12.0f, 20.0f); - // Attach the light - _Skeleton.stickObject(_Light, _NameBoneId); - // The player light is the only one who can interact with Lightmapped objects - _Light.setInfluenceLightMap(true); - - // TestYoyo - /* - NL3D::UInstance inst; - inst= Scene->createInstance("box.shape"); - if(!inst.empty()) - { - inst.setScale(0.2f, 0.2f, 0.2f); - inst.parent(_Light); - } - */ - } - } - else - nlwarning("UE:light: there is no skeleton or Name Bone to stick the light."); - } - // Turn On/Off the Light - _LightOn = !_LightOn; - if(!_Light.empty()) - { - if(_LightOn) - _Light.show(); - else - _Light.hide(); - } -}// light // - -//--------------------------------------------------- -// CSpeedFactor::init : -// Initialize the Observer for the Speed Factor. -//--------------------------------------------------- -void CUserEntity::CSpeedFactor::init() -{ - _Value = 1.0f; // Default speed factor is 1. - _ServerFactor = 1.0f; - CInterfaceManager *IM = CInterfaceManager::getInstance (); - CCDBNodeLeaf *pNodeLeaf = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:USER:SPEED_FACTOR", false); - if(pNodeLeaf) - { - /* if(!pNodeLeaf->addToLeaves(this)) - nlwarning("UE:SP:init: cannot add the observer");*/ - ICDBNode::CTextId textId; - pNodeLeaf->addObserver(this, textId); - if ( pNodeLeaf->getValue64() != 0 ) - _Value = ((float)pNodeLeaf->getValue64())/100.0f; // may have been received before - } - else - nlwarning("UE:SP:init: 'SERVER:USER:SPEED_FACTOR' does not exist."); -}// CSpeedFactor::init // - -//--------------------------------------------------- -// CMountHunger::init : -//--------------------------------------------------- -void CUserEntity::CMountHunger::init() -{} - -//--------------------------------------------------- -// CMountSpeeds::init : -//--------------------------------------------------- -void CUserEntity::CMountSpeeds::init() -{ - CInterfaceManager *IM = CInterfaceManager::getInstance (); - CCDBNodeLeaf *pNodeLeaf = NLGUI::CDBManager::getInstance()->getDbProp( "SERVER:USER:MOUNT_WALK_SPEED", false ); - BOMB_IF( ! pNodeLeaf, "MOUNT_WALK_SPEED not found", return ); - if(pNodeLeaf) - { - ICDBNode::CTextId textId; - pNodeLeaf->addObserver(this, textId); - _WalkSpeed = ((float)pNodeLeaf->getValue32()) / 1000.0f; // may have been received before - } - pNodeLeaf = NLGUI::CDBManager::getInstance()->getDbProp( "SERVER:USER:MOUNT_RUN_SPEED", false ); - BOMB_IF( ! pNodeLeaf, "MOUNT_RUN_SPEED not found", return ); - if(pNodeLeaf) - { - ICDBNode::CTextId textId; - pNodeLeaf->addObserver(this, textId); - _RunSpeed = ((float)pNodeLeaf->getValue32()) / 1000.0f; // may have been received before - } -} - -//--------------------------------------------------- - -void CUserEntity::CSpeedFactor::release() -{ - CInterfaceManager *IM = CInterfaceManager::getInstance (); - CCDBNodeLeaf *pNodeLeaf = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:USER:SPEED_FACTOR", false); - if(pNodeLeaf) - { - /* if(!pNodeLeaf->addToLeaves(this)) - nlwarning("UE:SP:init: cannot add the observer");*/ - ICDBNode::CTextId textId; - pNodeLeaf->removeObserver(this, textId); - } - else - nlwarning("UE:SP:init: 'SERVER:USER:SPEED_FACTOR' does not exist."); -}// CSpeedFactor::init // - -void CUserEntity::CMountHunger::release() -{} - -void CUserEntity::CMountSpeeds::release() -{ - CInterfaceManager *IM = CInterfaceManager::getInstance (); - CCDBNodeLeaf *pNodeLeaf = NLGUI::CDBManager::getInstance()->getDbProp( "SERVER:USER:MOUNT_WALK_SPEED", false ); - BOMB_IF( ! pNodeLeaf, "MOUNT_WALK_SPEED not found", return ); - if(pNodeLeaf) - { - ICDBNode::CTextId textId; - pNodeLeaf->removeObserver(this, textId); - } - pNodeLeaf = NLGUI::CDBManager::getInstance()->getDbProp( "SERVER:USER:MOUNT_RUN_SPEED", false ); - BOMB_IF( ! pNodeLeaf, "MOUNT_RUN_SPEED not found", return ); - if(pNodeLeaf) - { - ICDBNode::CTextId textId; - pNodeLeaf->removeObserver(this, textId); - } -} - - -//--------------------------------------------------- -// CSpeedFactor::update : -// Callback called to update the speed factor. -//--------------------------------------------------- -void CUserEntity::CSpeedFactor::update(ICDBNode *node) // virtual -{ - CCDBNodeLeaf *leaf = safe_cast(node); - _Value = ((float)leaf->getValue64())/100.0f; - //nlinfo("SpeedFactor changed to %f / %" NL_I64 "u", _Value, leaf->getValue64()); - - // clamp the value (2.0 is the egg item or the level 6 speed up power up, nothing should be faster) - // commented because ring editor speed is in fact faster - //if(_Value > 2.0f) - //{ - //nlwarning("HACK: you try to change the speed factor to %f", _Value); - //nlstop; - //_Value = 2.0f; - //} -}// CSpeedFactor::update // - - -/* - * Return true if the mount can run. Precondition: UserEntity->isRiding(). - */ -bool CUserEntity::CMountHunger::canRun() const -{ - CEntityCL *mountEntity = UserEntity->getMountEntity(); - if ( ! mountEntity ) - return false; - - // Find the mount's db leaf and check hunger - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CCDBNodeBranch *animalsNode = safe_cast(NLGUI::CDBManager::getInstance()->getDB()->getNode( ICDBNode::CTextId( "SERVER:PACK_ANIMAL" ), false )); - BOMB_IF( ! animalsNode, "! animalsNode", return false; ); - uint nbAnimals = (uint)animalsNode->getNbNodes(); - for ( uint i=0; i!=nbAnimals; ++i ) - { - ICDBNode *beastNode = animalsNode->getNode( i ); - CCDBNodeLeaf *uidLeaf = safe_cast(beastNode->getNode( ICDBNode::CTextId( "UID" ) )); - if ( ((CLFECOMMON::TClientDataSetIndex)uidLeaf->getValue32()) == mountEntity->dataSetId() ) - { - CCDBNodeLeaf *hungerLeaf = safe_cast(beastNode->getNode( ICDBNode::CTextId( "HUNGER" ) )); - return (hungerLeaf->getValue32() != (sint)ANIMAL_TYPE::DbHungryValue); - } - } - return false; -} - - - -//--------------------------------------------------- -// CMountSpeeds::update : -// Callback called to update the mount speed. -//--------------------------------------------------- -void CUserEntity::CMountSpeeds::update(ICDBNode * /* node */) // virtual -{ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - _WalkSpeed = ((float)(NLGUI::CDBManager::getInstance()->getDbProp("SERVER:USER:MOUNT_WALK_SPEED")->getValue32())) / 1000.0f; - _RunSpeed = ((float)(NLGUI::CDBManager::getInstance()->getDbProp("SERVER:USER:MOUNT_RUN_SPEED")->getValue32())) / 1000.0f; -} - - -/* - * Return the mount entity if the user is riding, otherwise NULL - */ -CEntityCL* CUserEntity::getMountEntity() -{ - if ( _Mount < EntitiesMngr.entities().size() ) - { - return EntitiesMngr.entities()[_Mount]; - } - return NULL; -} - -/* - * Return the DB entry for the specified user's animal (NULL if not found) - */ -CCDBNodeBranch *CUserEntity::getBeastDBEntry( CLFECOMMON::TClientDataSetIndex uid ) -{ - // Find animal entry corresponding to datasetId - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CCDBNodeBranch *animalsNode = safe_cast(NLGUI::CDBManager::getInstance()->getDB()->getNode( ICDBNode::CTextId( "SERVER:PACK_ANIMAL" ), false )); - BOMB_IF( ! animalsNode, "! animalsNode", return NULL ); - uint nbAnimals = (uint)animalsNode->getNbNodes(); - for ( uint i=0; i!=nbAnimals; ++i ) - { - ICDBNode *beastNode = animalsNode->getNode( i ); - CCDBNodeLeaf *pNodeLeaf = safe_cast(beastNode->getNode( ICDBNode::CTextId( "UID" ) )); - if ( pNodeLeaf && (pNodeLeaf->getValue32() == (sint32)uid) ) - return (CCDBNodeBranch*)beastNode; - } - return NULL; -} - - -//--------------------------------------------------- -// displayDebug : -// Display Debug Information. -//--------------------------------------------------- -void CUserEntity::displayDebug(float x, float &y, float lineStep) // virtual -{ - CPlayerCL::displayDebug(x, y, lineStep); -}// displayDebug // - -//--------------------------------------------------- -// displayModifiers : -// Display dmg/heal numbers above the head. -//--------------------------------------------------- -void CUserEntity::displayModifiers() // virtual -{ - if(!UserControls.isInternalView()) - CPlayerCL::displayModifiers(); -}// displayModifiers // - -//--------------------------------------------------- -// isVisible : -// Return 'true' is the entity is displayed. -//--------------------------------------------------- -bool CUserEntity::isVisible() const // virtual -{ - return !UserControls.isInternalView(); -}// isVisible // - - - - - - -//--------------------------------------------------- -// readWrite : -// Read/Write Variables from/to the stream. -//--------------------------------------------------- -void CUserEntity::readWrite(NLMISC::IStream &f) -{ - CPlayerCL::readWrite(f); - - // PROTECTED - f.serial(_SpeedFactor); - f.serial(_FrontVelocity); - f.serial(_LateralVelocity); - CVector dummyHead; - f.serial(dummyHead); - f.serial(_HeadPitch); - f.serial(_EyesHeight); - f.serial(_Run); - f.serial(_WalkVelocity); - f.serial(_RunVelocity); - f.serial(_CurrentVelocity); - f.serial(_Selection); - f.serial(_Trader); - f.serial(_Interlocutor); - f.serial(_Selectable); - - // PRIVATE - f.serial(_OnMount); - f.serial(_AnimAttackOn); -// f.serialEnum(_ViewMode); -}// readWrite // - -//--------------------------------------------------- -// load : -// To call after a read from a stream to re-initialize the entity. -//--------------------------------------------------- -void CUserEntity::load() // virtual -{ - CInterfaceManager *IM = CInterfaceManager::getInstance (); - // Insert the user into PACS at his saved position - pacsPos(pos()); - - // update - if(!_WaitForAppearance) - { - // Visual properties A - sint64 prop = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:Entities:E"+toString("%d", _Slot)+":P"+toString("%d", CLFECOMMON::PROPERTY_VPA))->getValue64(); - updateVisualPropertyVpa(0, prop); // Vpa udapte vpb and vpc too. - } -}// load // - - -//--------------------------------------------------- -void CUserEntity::CInvisibleObserver::update(ICDBNode* node) -{ - UserEntity->buildInSceneInterface(); -} - -//--------------------------------------------------- -void CUserEntity::CSkillPointsObserver::update(ICDBNode* node ) -{ - if (FarTP.isFarTPInProgress() || IngameDbMngr.initInProgress()) // prevent from displaying at the beginning of a FarTP (due to RESET_BANK or CDB resetData()) - return; - - CInterfaceManager *pIM = CInterfaceManager::getInstance (); - CCDBNodeLeaf *leaf = dynamic_cast(node); - if (leaf) - { - sint32 oldValue = leaf->getOldValue32(); - if (oldValue != 0) - { - sint delta = leaf->getValue32()-oldValue; - string deltaStr = toString("%+d", delta); - - // get the sp title - ucstring spTitle; - spTitle= CI18N::get(toString("uiSkillPointsBold%d",SpType)); - - // run the popup - CAHManager::getInstance()->runActionHandler("message_popup", NULL, "text1="+deltaStr+"|text0="+spTitle.toUtf8()); - - // Context help - contextHelp ("skill_point"); - } - } -} - - -//--------------------------------------------------- -// CFameObserver::update -//--------------------------------------------------- -void CUserEntity::CFameObserver::update(ICDBNode* node ) -{ - CSkillManager *pSM = CSkillManager::getInstance(); - CCDBNodeLeaf *leaf = dynamic_cast(node); - if (leaf) - { - sint32 fameValue = leaf->getValue32(); - pSM->tryToUnblockTitleFromMinFames( FactionIndex, fameValue ); - pSM->tryToUnblockTitleFromMaxFames( FactionIndex, fameValue ); - } -} - - -//--------------------------------------------------- -void CUserEntity::makeTransparent(bool t) -{ - CPlayerCL::makeTransparent(t); - - uint32 opaMin= getOpacityMin(); - uint8 opacity = (uint8)(opaMin + (255-opaMin) * (1.0 - _TranspFactor)); - - getFace()->makeInstanceTransparent(opacity, (uint8)opaMin); -}// makeTransparent // - -//--------------------------------------------------- -void CUserEntity::setDiffuse(bool onOff, NLMISC::CRGBA diffuse) -{ - CPlayerCL::setDiffuse(onOff, diffuse); - getFace()->setDiffuse(onOff, diffuse); -} - - - - -// Helper for CUserEntity::extractRM() -bool findExtractionActionInMemory( CSPhraseManager *pm, CSBrickManager *bm, uint memoryLine, uint& index ) -{ - uint x; - for ( x=0; x!=PHRASE_MAX_MEMORY_SLOT; ++x ) - { - uint32 phraseSlot = pm->getMemorizedPhrase( memoryLine, x ); - const CSPhraseCom& phraseCom = pm->getPhrase( phraseSlot ); - if ( ! phraseCom.empty() ) - { - CSBrickSheet *brickSheet = bm->getBrick( phraseCom.Bricks[0] ); - if ( brickSheet->isForageExtraction() && (!brickSheet->MandatoryFamilies.empty()) ) // assumes care root bricks have not mandatories - { - index = x; - return true; - } - } - } - return false; -} - -//--------------------------------------------------- -void CUserEntity::extractRM() -{ - CSPhraseManager *pm = CSPhraseManager::getInstance(); - uint index; - uint memoryLine; - bool autoFindPhrase = (_MoveToPhraseMemoryLine == std::numeric_limits::max()); - if ( ! autoFindPhrase ) - { - // Use clicked phrase - memoryLine = _MoveToPhraseMemoryLine; - index = _MoveToPhraseMemorySlot; - } - else - { - // Find the first extraction phrase in the memory bar - CSBrickManager *bm = CSBrickManager::getInstance(); - memoryLine = pm->getSelectedMemoryLineDB(); - if ( ! findExtractionActionInMemory( pm, bm, memoryLine, index ) ) - { - // Search in other memory bar lines (because the auto-equip does not set the current line at once) - memoryLine = std::numeric_limits::max(); - uint nbLines = pm->getNbMemoryLines(); - for ( uint j=0; j!=nbLines; ++j ) - { - if ( j == memoryLine ) - continue; - if ( findExtractionActionInMemory( pm, bm, j, index ) ) - { - memoryLine = j; - break; - } - } - } - } - - if ( memoryLine != std::numeric_limits::max() ) - { - // Open the forage (but not for care actions). Necessary for the case of redoing an extraction after a Drop All on the same source. - uint32 phraseId = pm->getMemorizedPhrase( memoryLine, index ); - if ( phraseId != 0 ) - { - const CSPhraseCom& phraseCom = pm->getPhrase( phraseId ); - if ( ! phraseCom.empty() ) - { - CSBrickSheet *rootBrick = CSBrickManager::getInstance()->getBrick( phraseCom.Bricks[0] ); - if ( rootBrick ) - { - if ( rootBrick->IndexInFamily == 1 ) // only extracting actions - CTempInvManager::getInstance()->open( TEMP_INV_MODE::Forage ); - } - } - } - - // Cast the extraction. if autoFindPhrase, clientExecute() not already called. - if ( autoFindPhrase ) - { - // decide now if cyclic or not - _MoveToPhraseCyclic= true; - if(pm->avoidCyclicForPhrase(pm->getMemorizedPhrase(memoryLine, index))) - _MoveToPhraseCyclic= false; - - // execute on client now - pm->clientExecute( memoryLine, index, _MoveToPhraseCyclic); - } - - // execute on server - pm->sendExecuteToServer( memoryLine, index, _MoveToPhraseCyclic ); - - // Because sendExecuteToServer() has been called, must NOT cancelClientExecute() at resetAnyMoveTo() - _MoveToAction= CUserEntity::None; - } - else - { - CInterfaceManager::getInstance()->displaySystemInfo( CI18N::get("uiExtractionPhraseMissing"), "CHK" ); - return; - } -} - - -// *************************************************************************** -bool CUserEntity::canCastShadowMap() const -{ - if(!CCharacterCL::canCastShadowMap()) - return false; - - // don't cast shadow in first person, but in death mode (third person actually...) - return viewMode() != FirstPV || UserControls.mode() == CUserControls::DeathMode; -} - - -// *************************************************************************** -void CUserEntity::forceLookEntity(const NLMISC::CVectorD &dir2targIn, bool updateHeadPitch, bool /* start */) -{ - CVectorD dir2targ= dir2targIn; - float frontYawBefore = 0.f; - float frontYawAfter; - - // Third person: bkup current yaw - if(viewMode()==ThirdPV) - { - frontYawBefore = frontYaw(); - } - - - // **** Look at the entity - dir2targ.normalize(); - front(dir2targ, false, false); - - - // **** FirstPerson - if(viewMode() == FirstPV) - { - if(updateHeadPitch && _FollowForceHeadPitch) - { - // rotate the head to the target - CEntityCL *target = EntitiesMngr.entity(targetSlot()); - if(target) - { - // Both Z must be correct - snapToGround(); - target->snapToGround(); - - // don't update to the real head position each frame (else jitter too much cause of target anim) - CVector targetPos= target->pos() + CVector(0,0,_FollowHeadOffset); - - // then look at this target - CVector dirToTarget = targetPos - (pos()+CVector(0,0, UserEntity->eyesHeight())); - if((dirToTarget.x != 0.0f) || (dirToTarget.y!=0.0f)) - { - dirToTarget.normalize(); - setHeadPitch(atan2(dirToTarget.z, sqrt(sqr(dirToTarget.x)+sqr(dirToTarget.y)))); - } - - // TestYoyo - /*if(ClientCfg.Fly!=0.f) - { - nlinfo("Uy: %.3f. Hp: %.3f. UPos:(%.3f,%.3f,%.3f). TPos:(%.3f,%.3f,%.3f)", - UserEntity->frontYaw(), UserEntity->getHeadPitch(), pos().x, pos().y, pos().z, - targetPos.x, targetPos.y, targetPos.z); - static float uy=0.f; - static float hp=0.f; - if( fabs(fmod(UserEntity->frontYaw()-uy, 2*Pi))>ClientCfg.Fly || - fabs(fmod(UserEntity->getHeadPitch()-hp, 2*Pi))>ClientCfg.Fly ) - { - nlinfo("YOYOBREAK: ^^^^^^^^^^"); - } - uy=UserEntity->frontYaw(); - hp=UserEntity->getHeadPitch(); - }*/ - } - } - } - // **** Third person - else if(viewMode()==ThirdPV) - { - // keep the current effective yaw. ONLY if no SmoothResetCameraYaw forced - if(!UserControls.isResetSmoothCDYForced()) - { - frontYawAfter = frontYaw(); - float deltaYaw= frontYawAfter - frontYawBefore; - - // compensate rotation (NB: it stops also any SmoothReset) - UserControls.appendCameraDeltaYaw(-deltaYaw); - } - } - - // when looking to an entity, if automatic camera, center the view on it. - if( ClientCfg.AutomaticCamera /*&& start*/ ) - { - UserControls.resetSmoothCameraDeltaYaw(); - } -} - - -// *************************************************************************** -void CUserEntity::startForceLookEntity(CLFECOMMON::TCLEntityId slot) -{ - // Start a new follow: force head pitch to follow by default - _FollowForceHeadPitch= true; - // if a follow is started in first person, reset CameraYaw - if(viewMode()==FirstPV) - UserControls.resetCameraDeltaYaw(); - - // reorient now (important else may have a time shift because of resetCameraDeltaYaw above) - CEntityCL *target = EntitiesMngr.entity(slot); - if(target) - { - /* For complex reason, the target may not be still snapped on the ground. snap it now - - this is because in common case, entities are snap only if they are visible (for speed up) - => depends on camera - - but in this case, the camera depends on real entity position (headPitch in first person) - */ - target->snapToGround(); - - // For FirstPerson targeting. Get the current target head offset - _FollowHeadOffset= 0.f; - CVector headPos; - if(target->getHeadPos(headPos)) - { - _FollowHeadOffset= headPos.z - float(target->pos().z); - } - - // Look at the entity - CVectorD dir2targ = target->pos() - pos(); - dir2targ.z = 0.0; - if(dir2targ!=CVectorD::Null) - { - forceLookEntity(dir2targ, true, true); - } - } -} - - -// *************************************************************************** -void CUserEntity::stopForceHeadPitchInFollow() -{ - _FollowForceHeadPitch= false; -} - -// *************************************************************************** -void CUserEntity::switchVelocity(bool userRequest) -{ - if (ClientCfg.R2EDEnabled && R2::getEditor().getMode() == R2::CEditor::EditionMode) - { - // when in the R2 editor, force to run all the time - _Run = true; - } - else - { - _Run = !_Run; - } - _CurrentVelocity = _Run ? runVelocity() : walkVelocity(); - - if (userRequest) - { - _RunWhenAble = _Run; - } - - // display message : your are running, you are walking - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - ucstring msg; - if( _Run ) - msg = CI18N::get("msgUserIsRunning"); - else - msg = CI18N::get("msgUserIsWalking"); - string cat = getStringCategory(msg, msg); - pIM->displaySystemInfo(msg, cat); - - // Write to the UI database, to update views - CCDBNodeLeaf *node= NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:PLAYER_RUNNING", false); - if(node) - node->setValue32(_Run); -} - -//----------------------------------------------- -// autoEquipWithLastUsedWeapons -// -//----------------------------------------------- -void CUserEntity::autoEquipWithLastUsedWeapons() -{ - CInventoryManager *inv = CInventoryManager::getInstance(); - if ( !inv ) - { - return; - } - - // Clear hands - inv->unequip( "LOCAL:INVENTORY:HAND:1" ); - inv->unequip( "LOCAL:INVENTORY:HAND:0" ); - - uint ir,il; - // Equip right hand - if( _PreviousRightHandItem.Sheet != 0 ) - { - // find item in bag with same properties than last used one in right hand - for ( ir=0; irgetBagItem(ir).getSheetID() && - _PreviousRightHandItem.Quality == inv->getBagItem(ir).getQuality() && - _PreviousRightHandItem.Weight == inv->getBagItem(ir).getWeight() && - _PreviousRightHandItem.NameId == inv->getBagItem(ir).getNameId() ) - { - break; - } - } - if ( ir != MAX_BAGINV_ENTRIES ) - { - // Equip right hand - string bagPath = toString( "LOCAL:INVENTORY:BAG:%u", ir ); - inv->equip( bagPath, "LOCAL:INVENTORY:HAND:0" ); - - // Equip left hand if needed - if( _PreviousLeftHandItem.Sheet != 0 ) - { - for ( il=0; ilgetBagItem(il).getSheetID() && - _PreviousLeftHandItem.Quality == inv->getBagItem(il).getQuality() && - _PreviousLeftHandItem.Weight == inv->getBagItem(il).getWeight() && - _PreviousLeftHandItem.NameId == inv->getBagItem(il).getNameId() ) - { - break; - } - } - if ( il != MAX_BAGINV_ENTRIES ) - { - bagPath = toString( "LOCAL:INVENTORY:BAG:%u", il ); - inv->equip( bagPath, "LOCAL:INVENTORY:HAND:1" ); - } - } - return; - } - } - - - // TODO : choose the best one - -} - - -// *************************************************************************** -void CUserEntity::executeCombatWithPhrase(CEntityCL *target, uint32 memoryLine, uint32 memoryIndex, bool cyclic) -{ - nlassert(target); - CSPhraseManager *pPM= CSPhraseManager::getInstance(); - - // is a melee combat? - bool meleeCombat = false; - // empty hand => yes! - meleeCombat= true; - uint32 rightHandSheet = getInventory().getRightHandItemSheet(); - if(rightHandSheet) - meleeCombat = getInventory().isMeleeWeaponItem(rightHandSheet); - - // If melee combat, and if the user entity is not well placed for fight, or if it has changed his target - if( meleeCombat && - ( - !target->isPlacedToFight(pos(), front(), attackRadius() + ClientCfg.AttackDist) || - target->slot()!=_LastExecuteCombatSlot - ) - ) - { - _LastExecuteCombatSlot= target->slot(); - - // Cancel any follow - disableFollow(); - - // Launch the moveToCombatPhrase, canceling any old action client execution. - // NB: this will also force him to look at the entity - moveToCombatPhrase(target->slot(), 2.0, memoryLine, memoryIndex, cyclic); - - // And after (order is important), start the phrase execution on client - pPM->clientExecute(memoryLine, memoryIndex, cyclic); - } - else - { - // Cancel any moveTo(), because don't want to continue reaching the prec entity - // VERY important if previous MoveTo was a SPhrase MoveTo (because cancelClientExecute() must be called) - resetAnyMoveTo(); - - // start client execution: NB: start client execution even if it - pPM->clientExecute(memoryLine, memoryIndex, cyclic); - - // inform Server of phrase cast - pPM->sendExecuteToServer(memoryLine, memoryIndex, cyclic); - - if( !meleeCombat && !cyclic ) - { - pPM->executeDefaultAttack(); - } - } -} - -// *************************************************************************** -void CUserEntity::beginCast(const MBEHAV::CBehaviour &behaviour) -{ - if(viewMode()==ThirdPV) - { - // backup front yaw - float frontYawBefore = frontYaw(); - // begin cast - CCharacterCL::beginCast( behaviour ); - // compensate the front change using a camera move - float frontYawAfter = frontYaw(); - float deltaYaw= frontYawAfter - frontYawBefore; - UserControls.appendCameraDeltaYaw(-deltaYaw); - // if automatic camera, center the view behind the user - if( ClientCfg.AutomaticCamera ) - { - UserControls.resetSmoothCameraDeltaYaw(); - } - } - else - { - // in first person mode, reset the delta yaw - UserControls.resetCameraDeltaYaw(); - CCharacterCL::beginCast( behaviour ); - } -} - -// *************************************************************************** -void CUserEntity::updatePreCollision(const NLMISC::TTime &time, CEntityCL *target) -{ - CPlayerCL::updatePreCollision(time, target); - - // test each frame if the mode has changed - if(SoundMngr) - { - string deadMusic= "death.ogg"; - // Play/stop music if comes from or goes to dead - bool isDead= _Mode==MBEHAV::DEATH || _Mode==MBEHAV::SWIM_DEATH; - - // must start music? - if( isDead && SoundMngr->getEventMusicPlayed()!=deadMusic ) - { - SoundMngr->playEventMusic(deadMusic, 0, true); - } - - // must end music? - if( !isDead && SoundMngr->getEventMusicPlayed()==deadMusic ) - { - SoundMngr->stopEventMusic(deadMusic, CSoundManager::LoadingMusicXFade); - } - } -} - -// *************************************************************************** -void CUserEntity::buildTotem() -{ - const string msgName = "TOTEM:BUILD"; - CBitMemStream out; - if( GenericMsgHeaderMngr.pushNameToStream( msgName, out ) ) - { - NetMngr.push( out ); - nlinfo( "sending TOTEM:build message to server" ); - } -} - -// *************************************************************************** -void CUserEntity::setR2CharMode(R2::TCharMode mode) -{ - if (mode == R2::TCharMode::Editer || mode == R2::TCharMode::Dm) - { - _R2CharMode= mode; - walkVelocity(ClientCfg.DmWalk); - runVelocity(ClientCfg.DmRun); - View.setCameraDistanceMaxForDm(); - CEntityCL *user = EntitiesMngr.entity(0); - NLPACS::UMovePrimitive* prim = user?user->getPrimitive():0; - if (prim) - { - prim->setObstacle(false); - } - - } - else if (mode == R2::TCharMode::Player || mode == R2::TCharMode::Tester) - { - _R2CharMode= mode; - walkVelocity(ClientCfg.Walk); - runVelocity(ClientCfg.Run); - View.setCameraDistanceMaxForPlayer(); - CEntityCL *user = EntitiesMngr.entity(0); - NLPACS::UMovePrimitive* prim = user?user->getPrimitive():0; - if (prim) - { - prim->setObstacle(true); - } - } - else - { - nlwarning("R2Ed: Error Char Mode not handled %u", (uint32)mode.getValue()); - } -} - -bool CUserEntity::isInNpcControl() const -{ - CInterfaceManager* pIM = CInterfaceManager::getInstance(); - CCDBNodeLeaf *sheet = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:USER:NPC_CONTROL:SHEET", false); - return sheet && NLMISC::CSheetId(sheet->getValue32())!=NLMISC::CSheetId::Unknown; -} - - -void CUserEntity::updateNpcContolSpeed() -{ - CInterfaceManager* pIM = CInterfaceManager::getInstance(); - CCDBNodeLeaf *sheet = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:USER:NPC_CONTROL:SHEET", false); - CCDBNodeLeaf *walk = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:USER:NPC_CONTROL:WALK", false); - CCDBNodeLeaf *run = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:USER:NPC_CONTROL:RUN", false); - if (!sheet || !walk || !run) - { - return; - } - - static NLMISC::CSheetId oldSheet = NLMISC::CSheetId::Unknown; - static float oldRun=0.f; - static float oldWalk=0.f; - - NLMISC::CSheetId sheetId(sheet->getValue32()); - float newRun = float(run->getValue32()) / 1000.0f; - float newWalk = float(walk->getValue32()) / 1000.0f; - - if (sheetId == oldSheet && oldRun == newRun && oldWalk == newWalk ) - { - return; - } - - oldSheet = sheetId; - oldRun = newRun; - oldWalk = newWalk; - - if (sheetId != NLMISC::CSheetId::Unknown) - { - walkVelocity(newWalk); - runVelocity(newRun); - } - else - { - setR2CharMode(_R2CharMode); - } - -} - -//----------------------------------------------- -// cancelAllPhrases -//----------------------------------------------- -void CUserEntity::cancelAllPhrases() -{ - CBitMemStream out; - if(GenericMsgHeaderMngr.pushNameToStream("PHRASE:CANCEL_ALL", out)) - { - NetMngr.push(out); - } - else - { - nlwarning(" unknown message name '%s'", "PHRASE:CANCEL_ALL"); - } -} - - -//----------------------------------------------- -// canChangeFront -//----------------------------------------------- -bool CUserEntity::canChangeFront() -{ - return !(_CurrentBehaviour.Behaviour == MBEHAV::EXTRACTING - || (_CurrentBehaviour.Behaviour == MBEHAV::RANGE_ATTACK && _Mode==MBEHAV::COMBAT && !UserControls.isMoving()) - || (_CurrentBehaviour.Behaviour >= MBEHAV::MAGIC_CASTING_BEHAVIOUR_BEGIN && _CurrentBehaviour.Behaviour <= MBEHAV::MAGIC_CASTING_BEHAVIOUR_END)); -} - - -//----------------------------------------------- -// rememberWeaponsInHand -// -//----------------------------------------------- -void CUserEntity::rememberWeaponsInHand() -{ - CInventoryManager * inv = CInventoryManager::getInstance(); - if( !inv ) - { - return; - } - - // keep right hand item - CItemImage * rightItemImg = inv->getHandItem(0); - if( rightItemImg ) - { - if( inv->isMeleeWeaponItem(rightItemImg->getSheetID()) || inv->isRangeWeaponItem(rightItemImg->getSheetID()) ) - { - _PreviousRightHandItem = CItemSnapshot(*rightItemImg); - - // keep left hand item too (could be ammo, second weapon, etc ..) - CItemImage * leftItemImg = inv->getHandItem(1); - if( leftItemImg ) - { - _PreviousLeftHandItem = CItemSnapshot(*leftItemImg); - } - else - { - _PreviousLeftHandItem = CItemSnapshot(); - } - } - } -} - - -//----------------------------------------------- -// snapshot of a CItemImage -// -//----------------------------------------------- -CUserEntity::CItemSnapshot::CItemSnapshot( const CItemImage& i ) -{ - Sheet = i.getSheetID(); - Quality = i.getQuality(); - Quantity = i.getQuantity(); - UserColor = i.getUserColor(); - Price = i.getPrice(); - Weight = i.getWeight(); - NameId = i.getNameId(); - InfoVersion = i.getInfoVersion(); -} - -sint CUserEntity::getLevel() const -{ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - sint level = -1; - for(uint i=0;igetDbProp(toString("SERVER:USER:SKILL_POINTS_%d:VALUE", i), false); - if(node) - { - level = std::max(level, (sint) node->getValue32()); - } - } - return level; -} - -//----------------------------------------------- -// interlocutor -//----------------------------------------------- -void CUserEntity::interlocutor( const CLFECOMMON::TCLEntityId &slot) -{ - CLFECOMMON::TCLEntityId prevInterlocutor = _Interlocutor; - _Interlocutor = slot; - - // Refresh (hide or unhide) the icon for the interlocutor NPC - if (prevInterlocutor != CLFECOMMON::INVALID_SLOT) - EntitiesMngr.refreshInsceneInterfaceOfFriendNPC(prevInterlocutor); - if (_Interlocutor != CLFECOMMON::INVALID_SLOT) - EntitiesMngr.refreshInsceneInterfaceOfFriendNPC(_Interlocutor); -} - -//----------------------------------------------- -// trader -//----------------------------------------------- -void CUserEntity::trader(const CLFECOMMON::TCLEntityId &slot) -{ - CLFECOMMON::TCLEntityId prevTrader = _Trader; - _Trader = slot; - - // Refresh (hide or unhide) the icon for the trader NPC - if (prevTrader != CLFECOMMON::INVALID_SLOT) - EntitiesMngr.refreshInsceneInterfaceOfFriendNPC(prevTrader); - if (_Trader != CLFECOMMON::INVALID_SLOT) - EntitiesMngr.refreshInsceneInterfaceOfFriendNPC(_Trader); -} - From 3709ea452015e388f0e51062e5ad451d54c579e4 Mon Sep 17 00:00:00 2001 From: Nuno Date: Wed, 20 Oct 2021 15:00:13 +0200 Subject: [PATCH 10/13] Revert All core changes (to be reapplied on next commit) --- nel/include/nel/misc/debug.h | 8 +- nel/include/nel/misc/sha1.h | 39 +++-- nel/include/nel/misc/string_common.h | 15 +- nel/include/nel/misc/xml_macros.h | 74 +++++++++ nel/include/nel/sound/music_channel_fader.h | 2 +- nel/include/nel/sound/stream_file_source.h | 2 - nel/include/nel/web/http_client_curl.h | 2 +- .../3d/driver/direct3d/driver_direct3d.cpp | 8 +- nel/src/3d/driver/direct3d/driver_direct3d.h | 9 -- .../direct3d/driver_direct3d_material.cpp | 21 +-- .../direct3d/driver_direct3d_texture.cpp | 1 - nel/src/3d/fxaa.cpp | 1 - nel/src/3d/lod_character_manager.cpp | 3 - nel/src/misc/co_task.cpp | 4 - nel/src/misc/debug.cpp | 9 -- nel/src/misc/file.cpp | 2 +- nel/src/misc/i_xml.cpp | 5 +- nel/src/misc/win_thread.cpp | 3 - nel/src/sound/audio_decoder.cpp | 8 +- nel/src/sound/music_channel_fader.cpp | 12 +- nel/src/sound/stream_file_source.cpp | 10 +- nel/src/web/http_client_curl.cpp | 1 - ryzom/client/src/client_cfg.cpp | 96 +++++++++--- ryzom/client/src/client_cfg.h | 10 +- ryzom/client/src/connection.cpp | 142 ++++++++---------- ryzom/client/src/far_tp.cpp | 32 ++-- ryzom/client/src/init.cpp | 85 ++++++----- ryzom/client/src/init_main_loop.cpp | 21 --- .../interface_v3/input_handler_manager.cpp | 103 +++---------- .../src/interface_v3/input_handler_manager.h | 2 +- .../src/interface_v3/inventory_manager.cpp | 22 ++- ryzom/client/src/login.cpp | 52 ++++--- ryzom/client/src/main_loop.cpp | 16 +- ryzom/client/src/net_manager.cpp | 44 +++--- ryzom/client/src/user_entity.cpp | 22 +-- 35 files changed, 411 insertions(+), 475 deletions(-) create mode 100644 nel/include/nel/misc/xml_macros.h diff --git a/nel/include/nel/misc/debug.h b/nel/include/nel/misc/debug.h index 1d533c149..a8c23eced 100644 --- a/nel/include/nel/misc/debug.h +++ b/nel/include/nel/misc/debug.h @@ -89,9 +89,6 @@ void createDebug (const char *logPath = NULL, bool logInFile = true, bool eraseL /// Do not call this, unless you know what you're trying to do (it kills debug)! void destroyDebug(); -/// Attach exception handler, for new threads and fibers -void attachExceptionHandler(); - // call this if you want to change the dir of the log.log file void changeLogDirectory(const std::string &dir); @@ -355,7 +352,7 @@ void setCrashAlreadyReported(bool state); * Same as nlassertex(false,exp); */ -#if defined(NL_DEBUG) /* Debug break is only useful in debug builds */ +// removed because we always check assert (even in release mode) #if defined (NL_OS_WINDOWS) && defined (NL_DEBUG) #if defined(NL_OS_WINDOWS) #define NLMISC_BREAKPOINT __debugbreak() #elif defined(NL_OS_UNIX) && defined(NL_COMP_GCC) @@ -363,9 +360,6 @@ void setCrashAlreadyReported(bool state); #else #define NLMISC_BREAKPOINT abort() #endif -#else -#define NLMISC_BREAKPOINT do { } while (0) -#endif // Internal, don't use it (make smaller assert code) extern bool _assert_stop(bool &ignoreNextTime, sint line, const char *file, const char *funcName, const char *exp); diff --git a/nel/include/nel/misc/sha1.h b/nel/include/nel/misc/sha1.h index d458c6f8f..87edba44c 100644 --- a/nel/include/nel/misc/sha1.h +++ b/nel/include/nel/misc/sha1.h @@ -30,19 +30,19 @@ namespace NLMISC { struct CHashKey { - CHashKey() { HashKeyString.resize(20); } + CHashKey () { HashKeyString.resize(20); } - CHashKey(const unsigned char Message_Digest[20]) + CHashKey (const unsigned char Message_Digest[20]) { HashKeyString.clear(); - for (sint i = 0; i < 20; ++i) + for(sint i = 0; i < 20 ; ++i) { HashKeyString += Message_Digest[i]; } } // Init the hash key with a binary key format or a text key format - CHashKey(const std::string &str) + CHashKey (const std::string &str) { if (str.size() == 20) { @@ -51,25 +51,25 @@ struct CHashKey else if (str.size() == 40) { HashKeyString.clear(); - for (size_t i = 0; i < str.size(); i += 2) + for(uint i = 0; i < str.size(); i+=2) { uint8 val; - if (isdigit((unsigned char)str[i + 0])) - val = str[i + 0] - '0'; + if (isdigit((unsigned char)str[i+0])) + val = str[i+0]-'0'; else - val = 10 + tolower(str[i + 0]) - 'a'; + val = 10+tolower(str[i+0])-'a'; val *= 16; - if (isdigit((unsigned char)str[i + 1])) - val += str[i + 1] - '0'; + if (isdigit((unsigned char)str[i+1])) + val += str[i+1]-'0'; else - val += 10 + tolower(str[i + 1]) - 'a'; + val += 10+tolower(str[i+1])-'a'; HashKeyString += val; } } else { - nlwarning("SHA: Bad hash key format"); + nlwarning ("SHA: Bad hash key format"); } } @@ -85,28 +85,23 @@ struct CHashKey } // serial the hash key in binary format - void serial(NLMISC::IStream &stream) + void serial (NLMISC::IStream &stream) { - stream.serial(HashKeyString); + stream.serial (HashKeyString); } - bool operator==(const CHashKey &v) const + bool operator==(const CHashKey &v) const { return HashKeyString == v.HashKeyString; } - bool operator!=(const CHashKey &v) const - { - return !(*this == v); - } - // this string is always 20 bytes long and is the code in binary format (can't print it directly) std::string HashKeyString; }; -inline bool operator<(const struct CHashKey &a, const struct CHashKey &b) +inline bool operator <(const struct CHashKey &a,const struct CHashKey &b) { - return a.HashKeyString < b.HashKeyString; + return a.HashKeyString +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + + + +#ifndef XML_MACROS_H +#define XML_MACROS_H + +// +// xmlNodePtr cur; +// CXMLAutoPtr prop; +// +// sint i; +// XML_READ_SINT(cur, "prop_name", i, -1); +// + +#define XML_READ_UINT(node, name, var, def) { \ + uint tmp; \ + prop = (char *) xmlGetProp(node, (xmlChar*)name); \ + if (prop && fromString((const char*)prop, tmp)) \ + var = tmp; \ + else \ + var = def; \ +} + +#define XML_READ_SINT(node, name, var, def) { \ + sint tmp; \ + prop = (char *) xmlGetProp(node, (xmlChar*)name); \ + if (prop && fromString((const char*)prop, tmp)) \ + var = tmp; \ + else \ + var = def; \ +} + +#define XML_READ_BOOL(node, name, var, def) { \ + prop = (char *) xmlGetProp(node, (xmlChar*)name); \ + if (prop) \ + var = NLMISC::toBool((const char*)prop); \ + else \ + var = def; \ +} + +#define XML_READ_COLOR(node, name, var, def) { \ + NLMISC::CRGBA tmp; \ + prop = (char *) xmlGetProp(node, (xmlChar*)name); \ + if (prop && fromString((const char*)prop, tmp)) \ + var = tmp; \ + else \ + var = def; \ +} + +#define XML_READ_STRING(node, name, var, def) { \ + prop = (char *) xmlGetProp(node, (xmlChar*)name); \ + if (prop) \ + var = (const char*)prop; \ + else \ + var = def; \ +} + +#endif // XML_MACROS_H + diff --git a/nel/include/nel/sound/music_channel_fader.h b/nel/include/nel/sound/music_channel_fader.h index 577d23949..6bb5677f9 100644 --- a/nel/include/nel/sound/music_channel_fader.h +++ b/nel/include/nel/sound/music_channel_fader.h @@ -108,7 +108,7 @@ public: bool play(const std::string &filepath, uint xFadeTime = 0, bool async = true, bool loop = true); /// Stop the music previously loaded and played (the Memory is also freed) - bool stop(uint xFadeTime = 0); + void stop(uint xFadeTime = 0); /// Pause the music previously loaded and played (the Memory is not freed) void pause(); diff --git a/nel/include/nel/sound/stream_file_source.h b/nel/include/nel/sound/stream_file_source.h index c8cf91cf5..4069a2f58 100644 --- a/nel/include/nel/sound/stream_file_source.h +++ b/nel/include/nel/sound/stream_file_source.h @@ -96,8 +96,6 @@ private: IAudioDecoder *m_AudioDecoder; - std::string m_LookupPath; - bool m_Paused; bool m_DecodingEnded; diff --git a/nel/include/nel/web/http_client_curl.h b/nel/include/nel/web/http_client_curl.h index e130cd768..77cf335ca 100644 --- a/nel/include/nel/web/http_client_curl.h +++ b/nel/include/nel/web/http_client_curl.h @@ -34,7 +34,7 @@ class CCurlHttpClient public: /// Constructor - CCurlHttpClient() : _CurlStruct(NULL) {} + CCurlHttpClient() {} /// Connect to an http server (string by val is intended). If you specify a whole URL, an attempt will be made to determine the server. bool connect(const std::string &server); diff --git a/nel/src/3d/driver/direct3d/driver_direct3d.cpp b/nel/src/3d/driver/direct3d/driver_direct3d.cpp index 3a4f67aee..1ab29c3a0 100644 --- a/nel/src/3d/driver/direct3d/driver_direct3d.cpp +++ b/nel/src/3d/driver/direct3d/driver_direct3d.cpp @@ -3830,15 +3830,9 @@ void CDriverD3D::CLightState::apply(CDriverD3D *driver) void CDriverD3D::CRenderTargetState::apply(CDriverD3D *driver) { H_AUTO_D3D(CDriverD3D_CRenderTargetState); - nlassert(TargetOwned); // Can only apply once! - driver->_DeviceInterface->SetRenderTarget(0, Target); + driver->_DeviceInterface->SetRenderTarget (0, Target); driver->setupViewport(driver->_Viewport); driver->setupScissor(driver->_Scissor); - if (TargetOwned) - { - Target->Release(); - TargetOwned = false; - } } // *************************************************************************** diff --git a/nel/src/3d/driver/direct3d/driver_direct3d.h b/nel/src/3d/driver/direct3d/driver_direct3d.h index c021f052d..636695670 100644 --- a/nel/src/3d/driver/direct3d/driver_direct3d.h +++ b/nel/src/3d/driver/direct3d/driver_direct3d.h @@ -1546,13 +1546,11 @@ public: Texture = NULL; Level = 0; CubeFace = 0; - TargetOwned = false; } IDirect3DSurface9 *Target; ITexture *Texture; uint8 Level; uint8 CubeFace; - bool TargetOwned; virtual void apply(CDriverD3D *driver); }; @@ -2078,17 +2076,10 @@ public: NL_D3D_CACHE_TEST(CacheTest_RenderTarget, _RenderTarget.Target != target) #endif // NL_D3D_USE_RENDER_STATE_CACHE { - if (_RenderTarget.TargetOwned) - { - nlassert(_RenderTarget.Target); - _RenderTarget.Target->Release(); - } _RenderTarget.Target = target; _RenderTarget.Texture = texture; _RenderTarget.Level = level; _RenderTarget.CubeFace = cubeFace; - _RenderTarget.TargetOwned = target; - target->AddRef(); touchRenderVariable (&_RenderTarget); diff --git a/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp b/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp index 2285688d4..f902e9fb0 100644 --- a/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp +++ b/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp @@ -706,13 +706,9 @@ bool CDriverD3D::setupMaterial(CMaterial &mat) // Set the texture states if (text || (stage == 0)) { - if (matShader == CMaterial::Program) + // Doesn't use a pixel shader ? Set the textures stages + if (pShader->PixelShader == NULL) { - // Do nothing for user pixel shader - } - else if (!pShader->PixelShader) - { - // Doesn't use a pixel shader ? Set the textures stages if (pShader->RGBPipe[stage]) { setTextureState (stage, D3DTSS_COLOROP, pShader->ColorOp[stage]); @@ -1149,7 +1145,7 @@ bool CDriverD3D::setupMaterial(CMaterial &mat) } break; - case CMaterial::Cloud: + case CMaterial::Cloud: { H_AUTO_D3D(CDriverD3D_setupMaterial_setupCloudShader) activeShader (&_ShaderCloud); @@ -1171,7 +1167,7 @@ bool CDriverD3D::setupMaterial(CMaterial &mat) return false; } break; - case CMaterial::Water: + case CMaterial::Water: { H_AUTO_D3D(CDriverD3D_setupMaterial_setupWaterShader) activeShader(mat.getTexture(3) ? &_ShaderWaterDiffuse : &_ShaderWaterNoDiffuse); @@ -1300,14 +1296,7 @@ bool CDriverD3D::setupMaterial(CMaterial &mat) } } } - break; // CMaterial::Water - case CMaterial::Program: - { - H_AUTO_D3D(CDriverD3D_setupMaterial_setupProgramshader) - // No material shader - activeShader(NULL); - } - break; + // CMaterial::Water } // New material setuped diff --git a/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp b/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp index 15dcb7768..f45663f1b 100644 --- a/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp +++ b/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp @@ -1084,7 +1084,6 @@ void CDriverD3D::swapTextureHandle(ITexture &tex0, ITexture &tex1) swap(t0->Height, t1->Height); swap(t0->SrcCompressed, t1->SrcCompressed); swap(t0->IsCube, t1->IsCube); - swap(t0->RenderTarget, t1->RenderTarget); swap(t0->Levels, t1->Levels); swap(t0->FirstMipMap, t1->FirstMipMap); swap(t0->TextureMemory, t1->TextureMemory); diff --git a/nel/src/3d/fxaa.cpp b/nel/src/3d/fxaa.cpp index 6478abf8e..255f0234d 100644 --- a/nel/src/3d/fxaa.cpp +++ b/nel/src/3d/fxaa.cpp @@ -246,7 +246,6 @@ void CFXAA::applyEffect() // create render target CTextureUser *otherRenderTarget = m_Driver->getRenderTargetManager().getRenderTarget(width, height, mode2D); - nlassert(otherRenderTarget); // swap render target CTextureUser texNull; diff --git a/nel/src/3d/lod_character_manager.cpp b/nel/src/3d/lod_character_manager.cpp index f5d6a23c5..92dee846a 100644 --- a/nel/src/3d/lod_character_manager.cpp +++ b/nel/src/3d/lod_character_manager.cpp @@ -979,9 +979,6 @@ void CLodCharacterManager::addTextureCompute(CLodCharacterInstance &instance, // get lookup ptr. nlassert(lodTexture.Texture.size()==NL3D_CLOD_TEXT_SIZE); - if (lodTexture.Texture.size() < NL3D_CLOD_TEXT_SIZE) - return; - const CLodCharacterTexture::CTUVQ *lookUpPtr= &lodTexture.Texture[0]; // apply the lodTexture, taking only better quality (ie nearer 0) diff --git a/nel/src/misc/co_task.cpp b/nel/src/misc/co_task.cpp index 4548fbe86..524cc69c6 100644 --- a/nel/src/misc/co_task.cpp +++ b/nel/src/misc/co_task.cpp @@ -143,9 +143,6 @@ namespace NLMISC NL_CT_DEBUG("CoTask : task %p start func called", task); - // Attach exception handler - attachExceptionHandler(); - try { // run the task @@ -154,7 +151,6 @@ namespace NLMISC catch(...) { nlwarning("CCoTask::startFunc : the task has generated an unhandled exeption and will terminate"); - NLMISC_BREAKPOINT; } task->_Finished = true; diff --git a/nel/src/misc/debug.cpp b/nel/src/misc/debug.cpp index 1f7cf38db..cc3203a14 100644 --- a/nel/src/misc/debug.cpp +++ b/nel/src/misc/debug.cpp @@ -1157,15 +1157,6 @@ void destroyDebug() } } -void attachExceptionHandler() -{ -#ifndef NL_COMP_MINGW -# ifdef NL_OS_WINDOWS - _set_se_translator(exceptionTranslator); -# endif // NL_OS_WINDOWS -#endif //!NL_COMP_MINGW -} - void createDebug (const char *logPath, bool logInFile, bool eraseLastLog) { // Do some basic compiler time check on type size diff --git a/nel/src/misc/file.cpp b/nel/src/misc/file.cpp index 24222bdfe..89af07129 100644 --- a/nel/src/misc/file.cpp +++ b/nel/src/misc/file.cpp @@ -558,7 +558,7 @@ bool CIFile::seek (sint32 offset, IStream::TSeekOrigin origin) const return true; // seek in the file. NB: if not in bigfile, _BigFileOffset==0. - if (nlfseek64(_F, (sint64)_BigFileOffset + _ReadPos, SEEK_SET) != 0) + if (nlfseek64(_F, _BigFileOffset+_ReadPos, SEEK_SET) != 0) return false; return true; } diff --git a/nel/src/misc/i_xml.cpp b/nel/src/misc/i_xml.cpp index 24a2b7910..87f848ab9 100644 --- a/nel/src/misc/i_xml.cpp +++ b/nel/src/misc/i_xml.cpp @@ -171,16 +171,15 @@ bool CIXml::init (IStream &stream) // Try binary mode if (_TryBinaryMode) { - char header[5]; + char header[4]; header[0] = buffer[0]; header[1] = buffer[1]; header[2] = buffer[2]; header[3] = buffer[3]; - header[4] = '\0'; toLower(header); // Does it a xml stream ? - if (strcmp(header, "Runnable->run(); diff --git a/nel/src/sound/audio_decoder.cpp b/nel/src/sound/audio_decoder.cpp index db87bd990..1314cd448 100644 --- a/nel/src/sound/audio_decoder.cpp +++ b/nel/src/sound/audio_decoder.cpp @@ -56,12 +56,18 @@ IAudioDecoder::~IAudioDecoder() IAudioDecoder *IAudioDecoder::createAudioDecoder(const std::string &filepath, bool async, bool loop) { + std::string lookup = CPath::lookup(filepath, false); + if (lookup.empty()) + { + nlwarning("Music file %s does not exist!", filepath.c_str()); + return NULL; + } std::string type = CFile::getExtension(filepath); CIFile *ifile = new CIFile(); ifile->setCacheFileOnOpen(!async); ifile->allowBNPCacheFileOnOpen(!async); - ifile->open(filepath); + ifile->open(lookup); IAudioDecoder *mb = createAudioDecoder(type, ifile, loop); diff --git a/nel/src/sound/music_channel_fader.cpp b/nel/src/sound/music_channel_fader.cpp index 70ab890d2..ea2cc6341 100644 --- a/nel/src/sound/music_channel_fader.cpp +++ b/nel/src/sound/music_channel_fader.cpp @@ -147,7 +147,7 @@ void CMusicChannelFader::updateVolume() */ bool CMusicChannelFader::play(const std::string &filepath, uint xFadeTime, bool async, bool loop) { - bool stopped = stop(xFadeTime); + stop(xFadeTime); // Find the next best free music channel uint nextFader = _MaxMusicFader; @@ -164,7 +164,7 @@ bool CMusicChannelFader::play(const std::string &filepath, uint xFadeTime, bool // Play a song in it :) _CMusicFader &fader = _MusicFader[_ActiveMusicFader]; - if (xFadeTime && !stopped) fader.fadeIn(xFadeTime); // only fade in when fading out + if (xFadeTime) fader.fadeIn(xFadeTime); else fader.XFadeVolume = 1.0f; fader.Playing = true; updateVolume(); // make sure at ok volume to start :) @@ -173,17 +173,12 @@ bool CMusicChannelFader::play(const std::string &filepath, uint xFadeTime, bool } /// Stop the music previously loaded and played (the Memory is also freed) -bool CMusicChannelFader::stop(uint xFadeTime) +void CMusicChannelFader::stop(uint xFadeTime) { if (xFadeTime) { - bool stopped = true; for (uint i = 0; i < _MaxMusicFader; ++i) if (_MusicFader[i].Playing) - { _MusicFader[i].fadeOut(xFadeTime); - stopped = false; // fading - } - return stopped; } else { @@ -193,7 +188,6 @@ bool CMusicChannelFader::stop(uint xFadeTime) _MusicFader[i].Fade = false; _MusicFader[i].Playing = false; } - return true; } } diff --git a/nel/src/sound/stream_file_source.cpp b/nel/src/sound/stream_file_source.cpp index 50d9bda97..fbd720a89 100644 --- a/nel/src/sound/stream_file_source.cpp +++ b/nel/src/sound/stream_file_source.cpp @@ -108,13 +108,6 @@ void CStreamFileSource::play() //{ // nlwarning("Already waiting for play"); //} - std::string filepath = getStreamFileSound()->getFilePath(); - m_LookupPath = NLMISC::CPath::lookup(filepath, false, false); - if (m_LookupPath.empty()) - { - nlwarning("Music file %s does not exist!", filepath.c_str()); - return; - } if (!getStreamFileSound()->getAsync()) { if (!prepareDecoder()) @@ -279,8 +272,7 @@ bool CStreamFileSource::prepareDecoder() if (!m_AudioDecoder) { // load the file - nlassert(!m_LookupPath.empty()); - m_AudioDecoder = IAudioDecoder::createAudioDecoder(m_LookupPath, getStreamFileSound()->getAsync(), getStreamFileSound()->getLooping()); + m_AudioDecoder = IAudioDecoder::createAudioDecoder(getStreamFileSound()->getFilePath(), getStreamFileSound()->getAsync(), getStreamFileSound()->getLooping()); if (!m_AudioDecoder) { nlwarning("Failed to create IAudioDecoder, likely invalid format"); diff --git a/nel/src/web/http_client_curl.cpp b/nel/src/web/http_client_curl.cpp index e61baa89f..1ec244cd2 100644 --- a/nel/src/web/http_client_curl.cpp +++ b/nel/src/web/http_client_curl.cpp @@ -192,7 +192,6 @@ bool CCurlHttpClient::receive(string &res, bool verbose) void CCurlHttpClient::disconnect() { curl_easy_cleanup(_Curl); - _CurlStruct = NULL; curl_global_cleanup(); } diff --git a/ryzom/client/src/client_cfg.cpp b/ryzom/client/src/client_cfg.cpp index 9d030cdca..055260673 100644 --- a/ryzom/client/src/client_cfg.cpp +++ b/ryzom/client/src/client_cfg.cpp @@ -326,8 +326,8 @@ CClientConfig::CClientConfig() Local = false; // Default is Net Mode. FSHost = ""; // Default Host. - TexturesInterface.push_back("texture_interfaces_v3"); - TexturesInterfaceDXTC.push_back("texture_interfaces_dxtc"); + TexturesInterface.push_back("texture_interfaces_v3_2x"); + TexturesInterfaceDXTC.push_back("texture_interfaces_dxtc_2x"); TexturesOutGameInterface.push_back("texture_interfaces_v3_outgame_ui"); @@ -456,13 +456,7 @@ CClientConfig::CClientConfig() SoundOn = true; // Default is with sound. DriverSound = SoundDrvAuto; SoundForceSoftwareBuffer = true; - StartMusic = "main theme air.ogg"; // Use at game startup (originally no music) - EmptySlotMusic = "loading music loop.ogg"; // Use in character selection for empty slots - LoadingMusic = "main menu loop.ogg"; // Main loading used after leaving character selection, and when going back to character selection - KamiTeleportMusic = "kami teleport.ogg"; // Kami teleport - KaravanTeleportMusic = "karavan teleport.ogg"; // Karavan teleport - TeleportLoadingMusic = "loading music loop.ogg"; // Use for generic teleportations - DeathMusic = "death.ogg"; // Player death + SoundOutGameMusic = "main menu loop.ogg"; SoundSFXVolume = 1.f; SoundGameMusicVolume = 1.f; SoundTPFade = 500; @@ -473,7 +467,7 @@ CClientConfig::CClientConfig() UserEntitySoundLevel = 0.5f; // Default volume for sound in 1st person UseEax = true; // Default to use EAX; UseADPCM = false; // Defualt to PCM sample, NO ADPCM - MaxTrack = 32; // Default to 32 track + MaxTrack = 32; // DEfault to 32 track ColorShout = CRGBA(150,0,0,255); // Default Shout color. ColorTalk = CRGBA(255,255,255,255); // Default Talk color. @@ -788,8 +782,8 @@ void CClientConfig::setValues() READ_STRINGVECTOR_FV(TexturesOutGameInterfaceDXTC); // interface textures ingame and r2 - READ_STRINGVECTOR_FV(TexturesInterface); - READ_STRINGVECTOR_FV(TexturesInterfaceDXTC); + //READ_STRINGVECTOR_FV(TexturesInterface); + //READ_STRINGVECTOR_FV(TexturesInterfaceDXTC); // interface files login menus READ_STRINGVECTOR_FV(XMLLoginInterfaceFiles); @@ -909,16 +903,76 @@ void CClientConfig::setValues() READ_STRING_FV(FSHost) READ_BOOL_DEV(DisplayAccountButtons) - READ_STRING_DEV(CreateAccountURL) - READ_STRING_DEV(EditAccountURL) - READ_STRING_DEV(ForgetPwdURL) + + + READ_STRING_FV(CreateAccountURL) + READ_STRING_FV(EditAccountURL) + READ_STRING_FV(ForgetPwdURL) + READ_STRING_DEV(BetaAccountURL) READ_STRING_DEV(FreeTrialURL) // defined in client_default.cfg - READ_STRING_FV(ConditionsTermsURL) - READ_STRING_FV(NamingPolicyURL) READ_STRING_FV(LoginSupportURL) + + // read NamingPolicyURL from client_default.cfg + //READ_STRING_FV(NamingPolicyURL) + + std::string languageCo = "wk"; + CConfigFile::CVar *languageCodeVarPtr = ClientCfg.ConfigFile.getVarPtr("LanguageCode"); + + if (languageCodeVarPtr) + { + languageCo = languageCodeVarPtr->asString(); + } + + CConfigFile::CVar *policyurl = ClientCfg.ConfigFile.getVarPtr("NamingPolicyURL"); + + if (policyurl) + { + for (uint i = 0; i < policyurl->size(); ++i) + { + std::string entry = policyurl->asString(i); + if (entry.size() >= languageCo.size()) + { + if (nlstricmp(entry.substr(0, languageCo.size()), languageCo) == 0) + { + std::string::size_type pos = entry.find("="); + + if (pos != std::string::npos) + { + ClientCfg.NamingPolicyURL = entry.substr(pos + 1); + } + } + } + } + } + + // read NamingPolicyURL from client_default.cfg + //READ_STRING_FV(ConditionsTermsURL) + CConfigFile::CVar *coturl = ClientCfg.ConfigFile.getVarPtr("ConditionsTermsURL"); + + if (coturl) + { + for (uint i = 0; i < coturl->size(); ++i) + { + std::string entry = coturl->asString(i); + + if (entry.size() >= languageCo.size()) + { + if (nlstricmp(entry.substr(0, languageCo.size()), languageCo) == 0) + { + std::string::size_type pos = entry.find("="); + + if (pos != std::string::npos) + { + ClientCfg.ConditionsTermsURL = entry.substr(pos + 1); + } + } + } + } + } + #ifndef RZ_NO_CLIENT // if cookie is not empty, it means that the client was launch @@ -1244,13 +1298,7 @@ void CClientConfig::setValues() // SoundForceSoftwareBuffer READ_BOOL_FV(SoundForceSoftwareBuffer); // SoundOutGameMusic - READ_STRING_DEV(StartMusic) - READ_STRING_DEV(EmptySlotMusic) - READ_STRING_DEV(LoadingMusic) - READ_STRING_DEV(KamiTeleportMusic) - READ_STRING_DEV(KaravanTeleportMusic) - READ_STRING_DEV(TeleportLoadingMusic) - READ_STRING_DEV(DeathMusic) + READ_STRING_DEV(SoundOutGameMusic) // SoundSFXVolume READ_FLOAT_FV(SoundSFXVolume); // SoundGameMusicVolume diff --git a/ryzom/client/src/client_cfg.h b/ryzom/client/src/client_cfg.h index 16a1e9e0c..2b79dbf05 100644 --- a/ryzom/client/src/client_cfg.h +++ b/ryzom/client/src/client_cfg.h @@ -348,14 +348,8 @@ struct CClientConfig /// SoundForceSoftwareBuffer bool SoundForceSoftwareBuffer; - /// Music files - string StartMusic; - string EmptySlotMusic; - string LoadingMusic; - string KamiTeleportMusic; - string KaravanTeleportMusic; - string TeleportLoadingMusic; - string DeathMusic; + /// The outgame music file + string SoundOutGameMusic; /// The Sound SFX Volume (0-1) (ie all but music) float SoundSFXVolume; diff --git a/ryzom/client/src/connection.cpp b/ryzom/client/src/connection.cpp index ee1be3318..f57238991 100644 --- a/ryzom/client/src/connection.cpp +++ b/ryzom/client/src/connection.cpp @@ -193,6 +193,7 @@ bool hasPrivilegeG() { return (UserPrivileges.find(":G:") != std::string::npos); bool hasPrivilegeEM() { return (UserPrivileges.find(":EM:") != std::string::npos); } bool hasPrivilegeEG() { return (UserPrivileges.find(":EG:") != std::string::npos); } bool hasPrivilegeOBSERVER() { return (UserPrivileges.find(":OBSERVER:") != std::string::npos); } +bool hasPrivilegeTESTER() { return (UserPrivileges.find(":TESTER:") != std::string::npos); } // Restore the video mode (fullscreen for example) after the connection (done in a window) @@ -278,73 +279,6 @@ void setOutGameFullScreen() CViewRenderer::getInstance()->setInterfaceScale(1.0f, 1024, 768); } -// ------------------------------------------------------------------------------------------------ -class CSoundGlobalMenu -{ -public: - CSoundGlobalMenu() - { - _MusicWantedAsync= false; - _NbFrameBeforeChange= NbFrameBeforeChangeMax; - } - void reset(); - void setMusic(const string &music, bool async); - void updateSound(); -private: - string _MusicPlayed; - string _MusicWanted; - bool _MusicWantedAsync; - sint _NbFrameBeforeChange; - enum {NbFrameBeforeChangeMax= 10}; -}; - -void CSoundGlobalMenu::reset() -{ - _MusicPlayed.clear(); - _MusicWanted.clear(); -} - -void CSoundGlobalMenu::updateSound() -{ - // **** update the music played - // The first music played is the music played at loading, before select char - if (_MusicPlayed.empty()) - _MusicPlayed = toLower(LoadingMusic.empty() ? ClientCfg.StartMusic : LoadingMusic); - if (_MusicWanted.empty()) - _MusicWanted = toLower(LoadingMusic.empty() ? ClientCfg.StartMusic : LoadingMusic); - - // because music is changed when the player select other race for instance, - // wait the 3D to load (stall some secs) - - // if the wanted music is the same as the one currently playing, just continue playing - if(_MusicPlayed!=_MusicWanted) - { - // wait nbFrameBeforeChangeMax before actually changing the music - _NbFrameBeforeChange--; - if(_NbFrameBeforeChange<=0) - { - _MusicPlayed= _MusicWanted; - // play the music - if (SoundMngr != NULL) - SoundMngr->playMusic(_MusicPlayed, 500, _MusicWantedAsync, true, true); - } - } - - - // **** update mngr - if (SoundMngr != NULL) - SoundMngr->update(); -} - -void CSoundGlobalMenu::setMusic(const string &music, bool async) -{ - _MusicWanted= toLower(music); - _MusicWantedAsync= async; - // reset the counter - _NbFrameBeforeChange= NbFrameBeforeChangeMax; -} -static CSoundGlobalMenu SoundGlobalMenu; - // New version of the menu after the server connection // @@ -477,8 +411,6 @@ bool connection (const string &cookie, const string &fsaddr) InterfaceState = GLOBAL_MENU; } - // No loading music here, this is right before character selection, using the existing music - // Create the loading texture. We can't do that before because we need to add search path first. beginLoading (LoadBackground); UseEscapeDuringLoading = USE_ESCAPE_DURING_LOADING; @@ -581,7 +513,6 @@ bool reconnection() ProgressBar.setFontFactor(1.0f); // Init out game - SoundGlobalMenu.reset(); pIM->initOutGame(); // Hide cursor for interface @@ -597,9 +528,6 @@ bool reconnection() FarTP.setOutgame(); - if (SoundMngr) - SoundMngr->setupFadeSound(1.0f, 1.0f); - // these two globals sequence GlobalMenu to display the character select dialog WaitServerAnswer = true; userChar = true; @@ -634,8 +562,6 @@ bool reconnection() // this also kicks the state machine to sendReady() so we stop spinning in farTPmainLoop FarTP.setIngame(); - // Not loading music here, this is before character selection, keep existing music - // Create the loading texture. We can't do that before because we need to add search path first. beginLoading (LoadBackground); UseEscapeDuringLoading = USE_ESCAPE_DURING_LOADING; @@ -811,6 +737,66 @@ std::string buildPlayerNameForSaveFile(const ucstring &playerNameIn) return ret; } +// ------------------------------------------------------------------------------------------------ +class CSoundGlobalMenu +{ +public: + CSoundGlobalMenu() + { + _MusicWantedAsync= false; + _NbFrameBeforeChange= NbFrameBeforeChangeMax; + } + void setMusic(const string &music, bool async); + void updateSound(); +private: + string _MusicPlayed; + string _MusicWanted; + bool _MusicWantedAsync; + sint _NbFrameBeforeChange; + enum {NbFrameBeforeChangeMax= 10}; +}; + +void CSoundGlobalMenu::updateSound() +{ + // **** update the music played + // The first music played is the music played at loading, before select char + if(_MusicPlayed.empty()) + _MusicPlayed= toLower(ClientCfg.SoundOutGameMusic); + if(_MusicWanted.empty()) + _MusicWanted= toLower(ClientCfg.SoundOutGameMusic); + + // because music is changed when the player select other race for instance, + // wait the 3D to load (stall some secs) + + // if the wanted music is the same as the one currently playing, just continue playing + if(_MusicPlayed!=_MusicWanted) + { + // wait nbFrameBeforeChangeMax before actually changing the music + _NbFrameBeforeChange--; + if(_NbFrameBeforeChange<=0) + { + _MusicPlayed= _MusicWanted; + // play the music + if (SoundMngr != NULL) + SoundMngr->playMusic(_MusicPlayed, 500, _MusicWantedAsync, true, true); + } + } + + + // **** update mngr + if (SoundMngr != NULL) + SoundMngr->update(); +} + +void CSoundGlobalMenu::setMusic(const string &music, bool async) +{ + _MusicWanted= toLower(music); + _MusicWantedAsync= async; + // reset the counter + _NbFrameBeforeChange= NbFrameBeforeChangeMax; +} +static CSoundGlobalMenu SoundGlobalMenu; + static bool LuaBGDSuccessFlag = true; // tmp, for debug @@ -1127,7 +1113,7 @@ TInterfaceState globalMenu() charSelect = LoginCharsel; WaitServerAnswer = false; - if (charSelect == -1) + if (charSelect == -1 || FarTP.isReselectingChar()) { CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp("UI:SERVER_RECEIVED_CHARS", false); if (pNL != NULL) @@ -2061,8 +2047,8 @@ public: fromString(getParam(Params, "async"), async); // if empty name, return to default mode - if (sName.empty()) - sName = ClientCfg.EmptySlotMusic; + if(sName.empty()) + sName= ClientCfg.SoundOutGameMusic; // change the music SoundGlobalMenu.setMusic(sName, async); diff --git a/ryzom/client/src/far_tp.cpp b/ryzom/client/src/far_tp.cpp index 80134f26b..1c2a6e612 100644 --- a/ryzom/client/src/far_tp.cpp +++ b/ryzom/client/src/far_tp.cpp @@ -49,12 +49,12 @@ #include "login_progress_post_thread.h" #include "interface_v3/action_handler_base.h" #include "item_group_manager.h" +#include "nel/misc/cmd_args.h" #ifdef DEBUG_NEW #define new DEBUG_NEW #endif - using namespace NLMISC; using namespace NLNET; using namespace NL3D; @@ -210,6 +210,7 @@ extern bool IsInRingSession; extern void selectTipsOfTheDay (uint tips); #define BAR_STEP_TP 2 +extern NLMISC::CCmdArgs Args; CLoginStateMachine::TEvent CLoginStateMachine::waitEvent() { @@ -462,12 +463,14 @@ void CLoginStateMachine::run() case st_check_patch: /// check the data to check if patch needed CLoginProgressPostThread::getInstance().step(CLoginStep(LoginStep_PostLogin, "login_step_post_login")); - if (!ClientCfg.PatchWanted) + + if (!ClientCfg.PatchWanted || (Args.haveArg("n") && Args.getLongArg("nopatch").front() == "1")) { // client don't want to be patched ! _CurrentState = st_display_eula; break; } + initPatchCheck(); SM_BEGIN_EVENT_TABLE if (isBGDownloadEnabled()) @@ -1112,6 +1115,15 @@ void CFarTP::disconnectFromPreviousShard() beginLoading (StartBackground); UseEscapeDuringLoading = false; + // Play music and fade out the Game Sound + if (SoundMngr) + { + // Loading Music Loop.ogg + LoadingMusic = ClientCfg.SoundOutGameMusic; + SoundMngr->playEventMusic(LoadingMusic, CSoundManager::LoadingMusicXFade, true); + SoundMngr->fadeOutGameSound(ClientCfg.SoundTPFade); + } + // Change the tips selectTipsOfTheDay (rand()); @@ -1120,21 +1132,6 @@ void CFarTP::disconnectFromPreviousShard() ucstring nmsg("Loading..."); ProgressBar.newMessage ( ClientCfg.buildLoadingString(nmsg) ); ProgressBar.progress(0); - - // Play music and fade out the Game Sound - if (SoundMngr) - { - SoundMngr->fadeOutGameSound(ClientCfg.SoundTPFade); - - // Stop and enable music - SoundMngr->stopMusic(0); - SoundMngr->setupFadeSound(0.0f, 1.0f); - - // Loading Music Loop.ogg - LoadingMusic = ClientCfg.LoadingMusic; - // SoundMngr->playEventMusic(LoadingMusic, CSoundManager::LoadingMusicXFade, true); - SoundMngr->playMusic(LoadingMusic, 0, false, true, true); - } } // Disconnect from the FS @@ -1523,4 +1520,3 @@ void CFarTP::farTPmainLoop() if(welcomeWindow) initWelcomeWindow(); } - diff --git a/ryzom/client/src/init.cpp b/ryzom/client/src/init.cpp index 5e7b03549..efc137ee6 100644 --- a/ryzom/client/src/init.cpp +++ b/ryzom/client/src/init.cpp @@ -1410,42 +1410,6 @@ void prelogInit() StereoDisplay->setDriver(Driver); // VR_DRIVER } - { - H_AUTO(InitRZSound) - - // Init the sound manager - nmsg = "Initializing sound manager..."; - ProgressBar.newMessage(ClientCfg.buildLoadingString(nmsg)); - if (ClientCfg.SoundOn) - { - nlassert(!SoundMngr); - SoundMngr = new CSoundManager(&ProgressBar); - try - { - SoundMngr->init(&ProgressBar); - } - catch(const Exception &e) - { - nlwarning("init : Error when creating 'SoundMngr' : %s", e.what()); - delete SoundMngr; - SoundMngr = NULL; - } - - // Play Music just after the SoundMngr is inited - if (SoundMngr) - { - // init the SoundMngr with backuped volume - SoundMngr->setSFXVolume(ClientCfg.SoundSFXVolume); - SoundMngr->setGameMusicVolume(ClientCfg.SoundGameMusicVolume); - - // Play the login screen music - SoundMngr->playMusic(ClientCfg.StartMusic, 0, true, true, true); - } - } - - CPath::memoryCompress(); // Because sound calls addSearchPath - } - nlinfo ("PROFILE: %d seconds for prelogInit", (uint32)(ryzomGetLocalTime ()-initStart)/1000); FPU_CHECKER_ONCE @@ -1588,6 +1552,55 @@ void postlogInit() // set the primitive context CPrimitiveContext::instance().CurrentLigoConfig = &LigoConfig; + { + H_AUTO(InitRZSound) + + // Init the sound manager + nmsg = "Initializing sound manager..."; + ProgressBar.newMessage ( ClientCfg.buildLoadingString(nmsg) ); + if(ClientCfg.SoundOn) + { + SoundMngr = new CSoundManager(&ProgressBar); + try + { + SoundMngr->init(&ProgressBar); + } + catch(const Exception &e) + { + nlwarning("init : Error when creating 'SoundMngr' : %s", e.what()); + delete SoundMngr; + SoundMngr = NULL; + } + + // Play Music just after the SoundMngr is inited + if(SoundMngr) + { + // init the SoundMngr with backuped volume + SoundMngr->setSFXVolume(ClientCfg.SoundSFXVolume); + SoundMngr->setGameMusicVolume(ClientCfg.SoundGameMusicVolume); + + // no fadein, and not async because don't work well because of loading in the main thread + // Force use GameMusic volume + const uint fadeInTime= 500; + SoundMngr->playMusic(ClientCfg.SoundOutGameMusic, fadeInTime, false, true, true); + // Because of blocking loading, force the fadeIn + TTime t0= ryzomGetLocalTime(); + TTime t1; + while((t1=ryzomGetLocalTime())updateAudioMixerOnly(); + } + } + } + + CPath::memoryCompress(); // Because sound call addSearchPath + + initLast = initCurrent; + initCurrent = ryzomGetLocalTime(); + //nlinfo ("PROFILE: %d seconds (%d total) for Initializing sound manager", (uint32)(initCurrent-initLast)/1000, (uint32)(initCurrent-initStart)/1000); + } + { H_AUTO(InitRZShIdI) diff --git a/ryzom/client/src/init_main_loop.cpp b/ryzom/client/src/init_main_loop.cpp index deeda2149..2b391114c 100644 --- a/ryzom/client/src/init_main_loop.cpp +++ b/ryzom/client/src/init_main_loop.cpp @@ -473,27 +473,6 @@ void initMainLoop() FPU_CHECKER_ONCE - if (SoundMngr) - { - // Loading Music - LoadingMusic = ClientCfg.LoadingMusic; - - // SoundMngr->playEventMusic(LoadingMusic, CSoundManager::LoadingMusicXFade, true); - // no fadein, and not async because don't work well because of loading in the main thread - // Force use GameMusic volume - const uint fadeInTime = 500; - SoundMngr->playMusic(LoadingMusic, fadeInTime, false, true, true); - // Because of blocking loading, force the fadeIn - TTime t0 = ryzomGetLocalTime(); - TTime t1; - do - { - ProgressBar.progress(0); - SoundMngr->updateAudioMixerOnly(); - nlSleep(10); - } while ((t1 = ryzomGetLocalTime()) < t0 + fadeInTime); - } - // Get the interface manager CInterfaceManager *pIM = CInterfaceManager::getInstance(); diff --git a/ryzom/client/src/interface_v3/input_handler_manager.cpp b/ryzom/client/src/interface_v3/input_handler_manager.cpp index 67a1b2350..9d1e9292d 100644 --- a/ryzom/client/src/interface_v3/input_handler_manager.cpp +++ b/ryzom/client/src/interface_v3/input_handler_manager.cpp @@ -271,16 +271,16 @@ void CInputHandlerManager::operator ()(const NLMISC::CEvent &event) { - CViewPointer &rIP = *static_cast(CWidgetManager::getInstance()->getPointer()); + CViewPointer &rIP = *static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() ); NLGUI::CEventDescriptorMouse eventDesc; - sint32 x, y; - rIP.getPointerDispPos(x, y); - eventDesc.setX(x); - eventDesc.setY(y); + sint32 x,y; + rIP.getPointerDispPos (x, y); + eventDesc.setX (x); + eventDesc.setY (y); - bool handled = false; + bool handled= false; // button down ? static volatile bool doTest = false; @@ -291,7 +291,7 @@ void CInputHandlerManager::operator ()(const NLMISC::CEvent &event) { if (_RecoverFocusLost) { - handled |= updateMousePos((CEventMouse&)event); // must update mouse pos here, + handled |= updateMousePos((CEventMouse&)event, eventDesc); // must update mouse pos here, // because when app window focus is gained by a mouse click, this is // the only place where we can retrieve mouse pos before a mouse move _RecoverFocusLost = false; @@ -299,19 +299,10 @@ void CInputHandlerManager::operator ()(const NLMISC::CEvent &event) if (!handled) { if (R2::getEditor().isInitialized() - && (R2::isEditionCurrent() || R2::getEditor().getCurrentTool())) + && (R2::isEditionCurrent() || R2::getEditor().getCurrentTool()) + ) { - const NLMISC::CEventMouseDown *mouseDownEvent = static_cast(&event); - if (mouseDownEvent->Button & NLMISC::leftButton) - { - eventDesc.setEventTypeExtended(CEventDescriptorMouse::mouseleftdown); - handled |= R2::getEditor().handleEvent(eventDesc); - } - if (mouseDownEvent->Button & NLMISC::rightButton) - { - eventDesc.setEventTypeExtended(CEventDescriptorMouse::mouserightdown); - handled |= R2::getEditor().handleEvent(eventDesc); - } + handled |= R2::getEditor().handleEvent(eventDesc); } } handled |= inputHandler.handleMouseButtonDownEvent( event ); @@ -330,7 +321,7 @@ void CInputHandlerManager::operator ()(const NLMISC::CEvent &event) // mouse move? else if(event == EventMouseMoveId) { - handled |= updateMousePos((CEventMouse&)event); + handled |= updateMousePos((CEventMouse&)event, eventDesc); } else if (event == EventMouseWheelId) { @@ -339,77 +330,19 @@ void CInputHandlerManager::operator ()(const NLMISC::CEvent &event) } // if Event not handled, post to Action Manager - if (!handled) + if( !handled ) { + bool handled = false; if (R2::getEditor().isInitialized() - && (R2::isEditionCurrent() || R2::getEditor().getCurrentTool())) + && (R2::isEditionCurrent() || R2::getEditor().getCurrentTool()) + ) { - if (event == EventMouseDownId) - { - const NLMISC::CEventMouseDown *mouseDownEvent = static_cast(&event); - if (mouseDownEvent->Button & NLMISC::leftButton) - { - eventDesc.setEventTypeExtended(CEventDescriptorMouse::mouseleftdown); - handled |= R2::getEditor().handleEvent(eventDesc); - } - if (mouseDownEvent->Button & NLMISC::rightButton) - { - eventDesc.setEventTypeExtended(CEventDescriptorMouse::mouserightdown); - handled |= R2::getEditor().handleEvent(eventDesc); - } - } - else if (event == EventMouseUpId) - { - const NLMISC::CEventMouseUp *mouseUpEvent = static_cast(&event); - if (mouseUpEvent->Button & NLMISC::leftButton) - { - eventDesc.setEventTypeExtended(CEventDescriptorMouse::mouseleftup); - handled |= R2::getEditor().handleEvent(eventDesc); - } - if (mouseUpEvent->Button & NLMISC::rightButton) - { - eventDesc.setEventTypeExtended(CEventDescriptorMouse::mouserightup); - handled |= R2::getEditor().handleEvent(eventDesc); - } - } - else if (event == EventMouseDblClkId) - { - const NLMISC::CEventMouseDblClk *mouseDblClkEvent = static_cast(&event); - if (mouseDblClkEvent->Button & NLMISC::leftButton) - { - eventDesc.setEventTypeExtended(CEventDescriptorMouse::mouseleftdblclk); - handled |= R2::getEditor().handleEvent(eventDesc); - } - if (mouseDblClkEvent->Button & NLMISC::rightButton) - { - eventDesc.setEventTypeExtended(CEventDescriptorMouse::mouserightdblclk); - handled |= R2::getEditor().handleEvent(eventDesc); - } - } - else - { - if (event == EventMouseWheelId) - { - const NLMISC::CEventMouseWheel *wheelEvent = static_cast(&event); - eventDesc.setEventTypeExtended(CEventDescriptorMouse::mousewheel); - eventDesc.setWheel(wheelEvent->Direction ? 1 : -1); - handled = R2::getEditor().handleEvent(eventDesc); - } - else if (event == EventMouseMoveId) - { - eventDesc.setEventTypeExtended(CEventDescriptorMouse::mousemove); - handled = R2::getEditor().handleEvent(eventDesc); - } - else - { - nlwarning("R2 unknown mouse event '%s'", event.toString().c_str()); - } - } + handled = R2::getEditor().handleEvent(eventDesc); } if (!handled) { // post to Action Manager - FilteredEventServer.postEvent(event.clone()); + FilteredEventServer.postEvent( event.clone() ); } } } @@ -422,7 +355,7 @@ void CInputHandlerManager::operator ()(const NLMISC::CEvent &event) // *************************************************************************** -bool CInputHandlerManager::updateMousePos(NLMISC::CEventMouse &event) +bool CInputHandlerManager::updateMousePos(NLMISC::CEventMouse &event, NLGUI::CEventDescriptorMouse &eventDesc) { if (!IsMouseFreeLook()) return inputHandler.handleMouseMoveEvent( event ); diff --git a/ryzom/client/src/interface_v3/input_handler_manager.h b/ryzom/client/src/interface_v3/input_handler_manager.h index 4b078ee84..7971ef9a8 100644 --- a/ryzom/client/src/interface_v3/input_handler_manager.h +++ b/ryzom/client/src/interface_v3/input_handler_manager.h @@ -181,7 +181,7 @@ private: void parseKey(xmlNodePtr cur, std::vector &out); // return true if handled - bool updateMousePos(NLMISC::CEventMouse &event); + bool updateMousePos(NLMISC::CEventMouse &event, NLGUI::CEventDescriptorMouse &eventDesc); NLGUI::CInputHandler inputHandler; diff --git a/ryzom/client/src/interface_v3/inventory_manager.cpp b/ryzom/client/src/interface_v3/inventory_manager.cpp index 5c4799fe4..20480dc38 100644 --- a/ryzom/client/src/interface_v3/inventory_manager.cpp +++ b/ryzom/client/src/interface_v3/inventory_manager.cpp @@ -3648,23 +3648,19 @@ void CInventoryManager::onTradeChangeSession() // *************************************************************************** void CInventoryManager::updateItemInfoQueue() { - if (!ConnectionReadySent) // CONNECTION:READY not yet sent, so we cannot send requests yet! - { - // Caused by CNetworkConnection::reinit, and NLMISC::CCDBNodeBranch::resetData - // TODO: Item sheets are effectively being set to 0, any way to detect this in particular? - // Slots with sheet 0 won't have any info to request anyway! - // Remove this check in favour of the assert lower down when properly implemented. - nlwarning("Update item info queue (%i), but connection not ready", (int)_ItemInfoWaiters.size()); - return; - } - - // CONNECTION:READY not yet sent, so we cannot send requests yet! - nlassert(ConnectionReadySent || !_ItemInfoWaiters.size()); - // For All waiters, look if one need update. TItemInfoWaiters::iterator it; for(it= _ItemInfoWaiters.begin();it!=_ItemInfoWaiters.end();it++) { + /* yoyo remove: temp patch to be sure that the client does not send messages before the + CONNECTION:READY is sent + Ulukyn: this only happens if player ask to reselect a char before end of update items. + On this case, skip it... + */ + + if (!ConnectionReadySent) + continue; + IItemInfoWaiter *waiter=*it; uint itemSlotId= waiter->ItemSlotId; TItemInfoMap::iterator it= _ItemInfoMap.find(itemSlotId); diff --git a/ryzom/client/src/login.cpp b/ryzom/client/src/login.cpp index 9eb9688ae..244bb593c 100644 --- a/ryzom/client/src/login.cpp +++ b/ryzom/client/src/login.cpp @@ -1932,8 +1932,11 @@ class CAHOpenURL : public IActionHandler #else // TODO: for Linux and Mac OS #endif - - if (sParams == "cfg_EditAccountURL") + if (sParams == "cfg_CreateAccountURL") + { + url = ClientCfg.CreateAccountURL; + } + else if (sParams == "cfg_EditAccountURL") { url = ClientCfg.EditAccountURL; } @@ -1971,32 +1974,35 @@ class CAHOpenURL : public IActionHandler nlwarning("no URL found"); return; } + + if(sParams != "cfg_ConditionsTermsURL" && sParams != "cfg_NamingPolicyURL") + { + // modify existing languages - // modify existing languages - - // old site - string::size_type pos_lang = url.find("/en/"); + // old site + string::size_type pos_lang = url.find("/en/"); - // or new forums - if (pos_lang == string::npos) - pos_lang = url.find("=en#"); + // or new forums + if (pos_lang == string::npos) + pos_lang = url.find("=en#"); - if (pos_lang != string::npos) - { - url.replace(pos_lang + 1, 2, ClientCfg.getHtmlLanguageCode()); - } - else - { - // append language - if (url.find('?') != string::npos) - url += "&"; + if (pos_lang != string::npos) + { + url.replace(pos_lang + 1, 2, ClientCfg.getHtmlLanguageCode()); + } else - url += "?"; + { + // append language + if (url.find('?') != string::npos) + url += "&"; + else + url += "?"; - url += "language=" + ClientCfg.LanguageCode; + url += "language=" + ClientCfg.LanguageCode; - if (!LoginCustomParameters.empty()) - url += LoginCustomParameters; + if (!LoginCustomParameters.empty()) + url += LoginCustomParameters; + } } openURL(url); @@ -3283,7 +3289,6 @@ bool loginIntroSkip; void loginIntro() { // Display of nevrax logo is done at init time (see init.cpp) just before addSearchPath (second one) -#if 0 for (uint i = 0; i < 1; i++) // previously display nevrax then nvidia { if (i != 0) @@ -3321,7 +3326,6 @@ void loginIntro() NLGUI::CDBManager::getInstance()->flushObserverCalls(); } } -#endif beginLoading(StartBackground); ProgressBar.finish(); } diff --git a/ryzom/client/src/main_loop.cpp b/ryzom/client/src/main_loop.cpp index a62b72e73..5c4f99446 100644 --- a/ryzom/client/src/main_loop.cpp +++ b/ryzom/client/src/main_loop.cpp @@ -2255,21 +2255,19 @@ bool mainLoop() { StartPlayTime = NLMISC::CTime::getLocalTime(); } - // Start background sound play now ! (nb: restarted if load just ended, or if sound re-enabled) if (SoundMngr) { H_AUTO_USE ( RZ_Client_Main_Loop_Sound ) + SoundMngr->playBackgroundSound(); + } + // Fade in Game Sound now (before endLoading) + if(SoundMngr) + { // fade out loading music - if (SoundMngr->getEventMusicPlayed() == LoadingMusic) - { + if(LoadingMusic==SoundMngr->getEventMusicPlayed()) SoundMngr->stopEventMusic(LoadingMusic, CSoundManager::LoadingMusicXFade); - } - - SoundMngr->playBackgroundSound(); - - // Fade in Game Sound now (before endLoading) // fade in game sound SoundMngr->fadeInGameSound(ClientCfg.SoundTPFade); } @@ -2533,7 +2531,7 @@ bool mainLoop() EditActions.enable(true); // For stoping the outgame music, start after 30 frames, and duration of 3 seconds - outgameFader = CMusicFader(60, 3); +// CMusicFader outgameFader(60, 3); // check for banned player if (testPermanentBanMarkers()) diff --git a/ryzom/client/src/net_manager.cpp b/ryzom/client/src/net_manager.cpp index c6da153bc..ada437ec7 100644 --- a/ryzom/client/src/net_manager.cpp +++ b/ryzom/client/src/net_manager.cpp @@ -33,6 +33,7 @@ #include "game_share/chat_group.h" #include "game_share/character_summary.h" #include "game_share/sphrase_com.h" +#include "game_share/outpost.h" #include "game_share/msg_client_server.h" #include "game_share/ryzom_database_banks.h" #include "game_share/msg_encyclopedia.h" @@ -1488,33 +1489,32 @@ void impulseTPCommon(NLMISC::CBitMemStream &impulse, bool hasSeason) void impulseTPCommon2(NLMISC::CBitMemStream &impulse, bool hasSeason) { // choose a default screen if not setuped - if (LoadingBackground != ResurectKamiBackground && LoadingBackground != ResurectKaravanBackground - && LoadingBackground != TeleportKamiBackground && LoadingBackground != TeleportKaravanBackground) - LoadingBackground = ElevatorBackground; + if( LoadingBackground!=ResurectKamiBackground && LoadingBackground!=ResurectKaravanBackground && + LoadingBackground!=TeleportKamiBackground && LoadingBackground!=TeleportKaravanBackground) + LoadingBackground= TeleportKaravanBackground; // if resurect but user not dead, choose default. NB: this is a bug, the tp impulse should tell // which background to choose. \todo yoyo: this is a temp fix - if (UserEntity && !UserEntity->isDead() && (LoadingBackground == ResurectKamiBackground || LoadingBackground == ResurectKaravanBackground)) - LoadingBackground = ElevatorBackground; + if( UserEntity && !UserEntity->isDead() && + (LoadingBackground==ResurectKamiBackground || LoadingBackground==ResurectKaravanBackground) ) + LoadingBackground= TeleportKaravanBackground; // Play music according to the background - if (SoundMngr) + if(SoundMngr) { LoadingMusic.clear(); - switch (LoadingBackground) + if(LoadingBackground==TeleportKamiBackground) + LoadingMusic= "Kami Teleport.ogg"; + else if(LoadingBackground==TeleportKaravanBackground) + LoadingMusic= "Karavan Teleport.ogg"; + // if resurection, continue to play death music + else if(LoadingBackground==ResurectKamiBackground || LoadingBackground==ResurectKaravanBackground) { - case TeleportKamiBackground: - LoadingMusic = ClientCfg.KamiTeleportMusic; - break; - case TeleportKaravanBackground: - LoadingMusic = ClientCfg.KaravanTeleportMusic; - break; - case ResurectKamiBackground: - case ResurectKaravanBackground: - // TODO: Resurrect music - break; - default: - LoadingMusic = ClientCfg.TeleportLoadingMusic; - break; + // noop + } + // default: loading music + else + { + LoadingMusic= "Loading Music Loop.ogg"; } // start to play @@ -3206,9 +3206,11 @@ void impulseUserBars(NLMISC::CBitMemStream &impulse) void impulseOutpostChooseSide(NLMISC::CBitMemStream &impulse) { // read message + uint8 type; bool outpostInFire; bool playerGuildInConflict; bool playerGuildIsAttacker; + impulse.serial(type); impulse.serial(outpostInFire); impulse.serial(playerGuildInConflict); impulse.serial(playerGuildIsAttacker); @@ -3220,7 +3222,7 @@ void impulseOutpostChooseSide(NLMISC::CBitMemStream &impulse) impulse.serial( declTimer ); // start - OutpostManager.startPvpJoinProposal(outpostInFire, playerGuildInConflict, playerGuildIsAttacker, + OutpostManager.startPvpJoinProposal((OUTPOSTENUMS::TPVPType)type, outpostInFire, playerGuildInConflict, playerGuildIsAttacker, ownerGuildNameId, attackerGuildNameId, declTimer); } diff --git a/ryzom/client/src/user_entity.cpp b/ryzom/client/src/user_entity.cpp index 312fffca8..0ddd61c41 100644 --- a/ryzom/client/src/user_entity.cpp +++ b/ryzom/client/src/user_entity.cpp @@ -2674,17 +2674,6 @@ void CUserEntity::selection(const CLFECOMMON::TCLEntityId &slot) // virtual { playerGiftNeeded->setValue32(0); } - // - missionOption = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%d:TITLE", (int) k), false); - if (missionOption) - { - missionOption->setValue32(0); - } - playerGiftNeeded = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%d:PLAYER_GIFT_NEEDED", (int) k), false); - if (playerGiftNeeded) - { - playerGiftNeeded->setValue32(0); - } } /* TODO ULU : Add RP tags */ @@ -4313,19 +4302,20 @@ void CUserEntity::updatePreCollision(const NLMISC::TTime &time, CEntityCL *targe // test each frame if the mode has changed if(SoundMngr) { + string deadMusic= "death.ogg"; // Play/stop music if comes from or goes to dead - bool isDead = _Mode == MBEHAV::DEATH || _Mode == MBEHAV::SWIM_DEATH; + bool isDead= _Mode==MBEHAV::DEATH || _Mode==MBEHAV::SWIM_DEATH; // must start music? - if (isDead && SoundMngr->getEventMusicPlayed() != ClientCfg.DeathMusic) + if( isDead && SoundMngr->getEventMusicPlayed()!=deadMusic ) { - SoundMngr->playEventMusic(ClientCfg.DeathMusic, 0, true); + SoundMngr->playEventMusic(deadMusic, 0, true); } // must end music? - if (!isDead && SoundMngr->getEventMusicPlayed() == ClientCfg.DeathMusic) + if( !isDead && SoundMngr->getEventMusicPlayed()==deadMusic ) { - SoundMngr->stopEventMusic(ClientCfg.DeathMusic, CSoundManager::LoadingMusicXFade); + SoundMngr->stopEventMusic(deadMusic, CSoundManager::LoadingMusicXFade); } } } From d7d1bc60c2af00d7d1246b431c0b1aa97b105762 Mon Sep 17 00:00:00 2001 From: Nuno Date: Wed, 20 Oct 2021 15:01:38 +0200 Subject: [PATCH 11/13] Changes from Core --- nel/include/nel/misc/debug.h | 8 +- nel/include/nel/misc/sha1.h | 39 ++--- nel/include/nel/misc/string_common.h | 15 +- nel/include/nel/sound/music_channel_fader.h | 2 +- nel/include/nel/sound/stream_file_source.h | 2 + nel/include/nel/web/http_client_curl.h | 2 +- .../3d/driver/direct3d/driver_direct3d.cpp | 8 +- nel/src/3d/driver/direct3d/driver_direct3d.h | 9 ++ .../direct3d/driver_direct3d_material.cpp | 21 ++- .../direct3d/driver_direct3d_texture.cpp | 1 + nel/src/3d/fxaa.cpp | 1 + nel/src/3d/lod_character_manager.cpp | 3 + nel/src/misc/co_task.cpp | 4 + nel/src/misc/debug.cpp | 9 ++ nel/src/misc/file.cpp | 2 +- nel/src/misc/i_xml.cpp | 5 +- nel/src/misc/win_thread.cpp | 3 + nel/src/sound/audio_decoder.cpp | 8 +- nel/src/sound/music_channel_fader.cpp | 12 +- nel/src/sound/stream_file_source.cpp | 10 +- nel/src/web/http_client_curl.cpp | 1 + ryzom/client/src/client_cfg.cpp | 96 +++--------- ryzom/client/src/client_cfg.h | 10 +- ryzom/client/src/connection.cpp | 142 ++++++++++-------- ryzom/client/src/far_tp.cpp | 32 ++-- ryzom/client/src/init.cpp | 85 +++++------ ryzom/client/src/init_main_loop.cpp | 21 +++ .../interface_v3/input_handler_manager.cpp | 103 ++++++++++--- .../src/interface_v3/input_handler_manager.h | 2 +- .../src/interface_v3/inventory_manager.cpp | 22 +-- ryzom/client/src/login.cpp | 52 +++---- ryzom/client/src/main_loop.cpp | 16 +- ryzom/client/src/net_manager.cpp | 44 +++--- ryzom/client/src/user_entity.cpp | 22 ++- 34 files changed, 475 insertions(+), 337 deletions(-) diff --git a/nel/include/nel/misc/debug.h b/nel/include/nel/misc/debug.h index a8c23eced..1d533c149 100644 --- a/nel/include/nel/misc/debug.h +++ b/nel/include/nel/misc/debug.h @@ -89,6 +89,9 @@ void createDebug (const char *logPath = NULL, bool logInFile = true, bool eraseL /// Do not call this, unless you know what you're trying to do (it kills debug)! void destroyDebug(); +/// Attach exception handler, for new threads and fibers +void attachExceptionHandler(); + // call this if you want to change the dir of the log.log file void changeLogDirectory(const std::string &dir); @@ -352,7 +355,7 @@ void setCrashAlreadyReported(bool state); * Same as nlassertex(false,exp); */ -// removed because we always check assert (even in release mode) #if defined (NL_OS_WINDOWS) && defined (NL_DEBUG) +#if defined(NL_DEBUG) /* Debug break is only useful in debug builds */ #if defined(NL_OS_WINDOWS) #define NLMISC_BREAKPOINT __debugbreak() #elif defined(NL_OS_UNIX) && defined(NL_COMP_GCC) @@ -360,6 +363,9 @@ void setCrashAlreadyReported(bool state); #else #define NLMISC_BREAKPOINT abort() #endif +#else +#define NLMISC_BREAKPOINT do { } while (0) +#endif // Internal, don't use it (make smaller assert code) extern bool _assert_stop(bool &ignoreNextTime, sint line, const char *file, const char *funcName, const char *exp); diff --git a/nel/include/nel/misc/sha1.h b/nel/include/nel/misc/sha1.h index 87edba44c..d458c6f8f 100644 --- a/nel/include/nel/misc/sha1.h +++ b/nel/include/nel/misc/sha1.h @@ -30,19 +30,19 @@ namespace NLMISC { struct CHashKey { - CHashKey () { HashKeyString.resize(20); } + CHashKey() { HashKeyString.resize(20); } - CHashKey (const unsigned char Message_Digest[20]) + CHashKey(const unsigned char Message_Digest[20]) { HashKeyString.clear(); - for(sint i = 0; i < 20 ; ++i) + for (sint i = 0; i < 20; ++i) { HashKeyString += Message_Digest[i]; } } // Init the hash key with a binary key format or a text key format - CHashKey (const std::string &str) + CHashKey(const std::string &str) { if (str.size() == 20) { @@ -51,25 +51,25 @@ struct CHashKey else if (str.size() == 40) { HashKeyString.clear(); - for(uint i = 0; i < str.size(); i+=2) + for (size_t i = 0; i < str.size(); i += 2) { uint8 val; - if (isdigit((unsigned char)str[i+0])) - val = str[i+0]-'0'; + if (isdigit((unsigned char)str[i + 0])) + val = str[i + 0] - '0'; else - val = 10+tolower(str[i+0])-'a'; + val = 10 + tolower(str[i + 0]) - 'a'; val *= 16; - if (isdigit((unsigned char)str[i+1])) - val += str[i+1]-'0'; + if (isdigit((unsigned char)str[i + 1])) + val += str[i + 1] - '0'; else - val += 10+tolower(str[i+1])-'a'; + val += 10 + tolower(str[i + 1]) - 'a'; HashKeyString += val; } } else { - nlwarning ("SHA: Bad hash key format"); + nlwarning("SHA: Bad hash key format"); } } @@ -85,23 +85,28 @@ struct CHashKey } // serial the hash key in binary format - void serial (NLMISC::IStream &stream) + void serial(NLMISC::IStream &stream) { - stream.serial (HashKeyString); + stream.serial(HashKeyString); } - bool operator==(const CHashKey &v) const + bool operator==(const CHashKey &v) const { return HashKeyString == v.HashKeyString; } + bool operator!=(const CHashKey &v) const + { + return !(*this == v); + } + // this string is always 20 bytes long and is the code in binary format (can't print it directly) std::string HashKeyString; }; -inline bool operator <(const struct CHashKey &a,const struct CHashKey &b) +inline bool operator<(const struct CHashKey &a, const struct CHashKey &b) { - return a.HashKeyString_DeviceInterface->SetRenderTarget (0, Target); + nlassert(TargetOwned); // Can only apply once! + driver->_DeviceInterface->SetRenderTarget(0, Target); driver->setupViewport(driver->_Viewport); driver->setupScissor(driver->_Scissor); + if (TargetOwned) + { + Target->Release(); + TargetOwned = false; + } } // *************************************************************************** diff --git a/nel/src/3d/driver/direct3d/driver_direct3d.h b/nel/src/3d/driver/direct3d/driver_direct3d.h index 636695670..c021f052d 100644 --- a/nel/src/3d/driver/direct3d/driver_direct3d.h +++ b/nel/src/3d/driver/direct3d/driver_direct3d.h @@ -1546,11 +1546,13 @@ public: Texture = NULL; Level = 0; CubeFace = 0; + TargetOwned = false; } IDirect3DSurface9 *Target; ITexture *Texture; uint8 Level; uint8 CubeFace; + bool TargetOwned; virtual void apply(CDriverD3D *driver); }; @@ -2076,10 +2078,17 @@ public: NL_D3D_CACHE_TEST(CacheTest_RenderTarget, _RenderTarget.Target != target) #endif // NL_D3D_USE_RENDER_STATE_CACHE { + if (_RenderTarget.TargetOwned) + { + nlassert(_RenderTarget.Target); + _RenderTarget.Target->Release(); + } _RenderTarget.Target = target; _RenderTarget.Texture = texture; _RenderTarget.Level = level; _RenderTarget.CubeFace = cubeFace; + _RenderTarget.TargetOwned = target; + target->AddRef(); touchRenderVariable (&_RenderTarget); diff --git a/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp b/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp index f902e9fb0..2285688d4 100644 --- a/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp +++ b/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp @@ -706,9 +706,13 @@ bool CDriverD3D::setupMaterial(CMaterial &mat) // Set the texture states if (text || (stage == 0)) { - // Doesn't use a pixel shader ? Set the textures stages - if (pShader->PixelShader == NULL) + if (matShader == CMaterial::Program) { + // Do nothing for user pixel shader + } + else if (!pShader->PixelShader) + { + // Doesn't use a pixel shader ? Set the textures stages if (pShader->RGBPipe[stage]) { setTextureState (stage, D3DTSS_COLOROP, pShader->ColorOp[stage]); @@ -1145,7 +1149,7 @@ bool CDriverD3D::setupMaterial(CMaterial &mat) } break; - case CMaterial::Cloud: + case CMaterial::Cloud: { H_AUTO_D3D(CDriverD3D_setupMaterial_setupCloudShader) activeShader (&_ShaderCloud); @@ -1167,7 +1171,7 @@ bool CDriverD3D::setupMaterial(CMaterial &mat) return false; } break; - case CMaterial::Water: + case CMaterial::Water: { H_AUTO_D3D(CDriverD3D_setupMaterial_setupWaterShader) activeShader(mat.getTexture(3) ? &_ShaderWaterDiffuse : &_ShaderWaterNoDiffuse); @@ -1296,7 +1300,14 @@ bool CDriverD3D::setupMaterial(CMaterial &mat) } } } - // CMaterial::Water + break; // CMaterial::Water + case CMaterial::Program: + { + H_AUTO_D3D(CDriverD3D_setupMaterial_setupProgramshader) + // No material shader + activeShader(NULL); + } + break; } // New material setuped diff --git a/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp b/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp index f45663f1b..15dcb7768 100644 --- a/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp +++ b/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp @@ -1084,6 +1084,7 @@ void CDriverD3D::swapTextureHandle(ITexture &tex0, ITexture &tex1) swap(t0->Height, t1->Height); swap(t0->SrcCompressed, t1->SrcCompressed); swap(t0->IsCube, t1->IsCube); + swap(t0->RenderTarget, t1->RenderTarget); swap(t0->Levels, t1->Levels); swap(t0->FirstMipMap, t1->FirstMipMap); swap(t0->TextureMemory, t1->TextureMemory); diff --git a/nel/src/3d/fxaa.cpp b/nel/src/3d/fxaa.cpp index 255f0234d..6478abf8e 100644 --- a/nel/src/3d/fxaa.cpp +++ b/nel/src/3d/fxaa.cpp @@ -246,6 +246,7 @@ void CFXAA::applyEffect() // create render target CTextureUser *otherRenderTarget = m_Driver->getRenderTargetManager().getRenderTarget(width, height, mode2D); + nlassert(otherRenderTarget); // swap render target CTextureUser texNull; diff --git a/nel/src/3d/lod_character_manager.cpp b/nel/src/3d/lod_character_manager.cpp index 92dee846a..f5d6a23c5 100644 --- a/nel/src/3d/lod_character_manager.cpp +++ b/nel/src/3d/lod_character_manager.cpp @@ -979,6 +979,9 @@ void CLodCharacterManager::addTextureCompute(CLodCharacterInstance &instance, // get lookup ptr. nlassert(lodTexture.Texture.size()==NL3D_CLOD_TEXT_SIZE); + if (lodTexture.Texture.size() < NL3D_CLOD_TEXT_SIZE) + return; + const CLodCharacterTexture::CTUVQ *lookUpPtr= &lodTexture.Texture[0]; // apply the lodTexture, taking only better quality (ie nearer 0) diff --git a/nel/src/misc/co_task.cpp b/nel/src/misc/co_task.cpp index 524cc69c6..4548fbe86 100644 --- a/nel/src/misc/co_task.cpp +++ b/nel/src/misc/co_task.cpp @@ -143,6 +143,9 @@ namespace NLMISC NL_CT_DEBUG("CoTask : task %p start func called", task); + // Attach exception handler + attachExceptionHandler(); + try { // run the task @@ -151,6 +154,7 @@ namespace NLMISC catch(...) { nlwarning("CCoTask::startFunc : the task has generated an unhandled exeption and will terminate"); + NLMISC_BREAKPOINT; } task->_Finished = true; diff --git a/nel/src/misc/debug.cpp b/nel/src/misc/debug.cpp index cc3203a14..1f7cf38db 100644 --- a/nel/src/misc/debug.cpp +++ b/nel/src/misc/debug.cpp @@ -1157,6 +1157,15 @@ void destroyDebug() } } +void attachExceptionHandler() +{ +#ifndef NL_COMP_MINGW +# ifdef NL_OS_WINDOWS + _set_se_translator(exceptionTranslator); +# endif // NL_OS_WINDOWS +#endif //!NL_COMP_MINGW +} + void createDebug (const char *logPath, bool logInFile, bool eraseLastLog) { // Do some basic compiler time check on type size diff --git a/nel/src/misc/file.cpp b/nel/src/misc/file.cpp index 89af07129..24222bdfe 100644 --- a/nel/src/misc/file.cpp +++ b/nel/src/misc/file.cpp @@ -558,7 +558,7 @@ bool CIFile::seek (sint32 offset, IStream::TSeekOrigin origin) const return true; // seek in the file. NB: if not in bigfile, _BigFileOffset==0. - if (nlfseek64(_F, _BigFileOffset+_ReadPos, SEEK_SET) != 0) + if (nlfseek64(_F, (sint64)_BigFileOffset + _ReadPos, SEEK_SET) != 0) return false; return true; } diff --git a/nel/src/misc/i_xml.cpp b/nel/src/misc/i_xml.cpp index 87f848ab9..24a2b7910 100644 --- a/nel/src/misc/i_xml.cpp +++ b/nel/src/misc/i_xml.cpp @@ -171,15 +171,16 @@ bool CIXml::init (IStream &stream) // Try binary mode if (_TryBinaryMode) { - char header[4]; + char header[5]; header[0] = buffer[0]; header[1] = buffer[1]; header[2] = buffer[2]; header[3] = buffer[3]; + header[4] = '\0'; toLower(header); // Does it a xml stream ? - if (!strcmp(header, "Runnable->run(); diff --git a/nel/src/sound/audio_decoder.cpp b/nel/src/sound/audio_decoder.cpp index 1314cd448..db87bd990 100644 --- a/nel/src/sound/audio_decoder.cpp +++ b/nel/src/sound/audio_decoder.cpp @@ -56,18 +56,12 @@ IAudioDecoder::~IAudioDecoder() IAudioDecoder *IAudioDecoder::createAudioDecoder(const std::string &filepath, bool async, bool loop) { - std::string lookup = CPath::lookup(filepath, false); - if (lookup.empty()) - { - nlwarning("Music file %s does not exist!", filepath.c_str()); - return NULL; - } std::string type = CFile::getExtension(filepath); CIFile *ifile = new CIFile(); ifile->setCacheFileOnOpen(!async); ifile->allowBNPCacheFileOnOpen(!async); - ifile->open(lookup); + ifile->open(filepath); IAudioDecoder *mb = createAudioDecoder(type, ifile, loop); diff --git a/nel/src/sound/music_channel_fader.cpp b/nel/src/sound/music_channel_fader.cpp index ea2cc6341..70ab890d2 100644 --- a/nel/src/sound/music_channel_fader.cpp +++ b/nel/src/sound/music_channel_fader.cpp @@ -147,7 +147,7 @@ void CMusicChannelFader::updateVolume() */ bool CMusicChannelFader::play(const std::string &filepath, uint xFadeTime, bool async, bool loop) { - stop(xFadeTime); + bool stopped = stop(xFadeTime); // Find the next best free music channel uint nextFader = _MaxMusicFader; @@ -164,7 +164,7 @@ bool CMusicChannelFader::play(const std::string &filepath, uint xFadeTime, bool // Play a song in it :) _CMusicFader &fader = _MusicFader[_ActiveMusicFader]; - if (xFadeTime) fader.fadeIn(xFadeTime); + if (xFadeTime && !stopped) fader.fadeIn(xFadeTime); // only fade in when fading out else fader.XFadeVolume = 1.0f; fader.Playing = true; updateVolume(); // make sure at ok volume to start :) @@ -173,12 +173,17 @@ bool CMusicChannelFader::play(const std::string &filepath, uint xFadeTime, bool } /// Stop the music previously loaded and played (the Memory is also freed) -void CMusicChannelFader::stop(uint xFadeTime) +bool CMusicChannelFader::stop(uint xFadeTime) { if (xFadeTime) { + bool stopped = true; for (uint i = 0; i < _MaxMusicFader; ++i) if (_MusicFader[i].Playing) + { _MusicFader[i].fadeOut(xFadeTime); + stopped = false; // fading + } + return stopped; } else { @@ -188,6 +193,7 @@ void CMusicChannelFader::stop(uint xFadeTime) _MusicFader[i].Fade = false; _MusicFader[i].Playing = false; } + return true; } } diff --git a/nel/src/sound/stream_file_source.cpp b/nel/src/sound/stream_file_source.cpp index fbd720a89..50d9bda97 100644 --- a/nel/src/sound/stream_file_source.cpp +++ b/nel/src/sound/stream_file_source.cpp @@ -108,6 +108,13 @@ void CStreamFileSource::play() //{ // nlwarning("Already waiting for play"); //} + std::string filepath = getStreamFileSound()->getFilePath(); + m_LookupPath = NLMISC::CPath::lookup(filepath, false, false); + if (m_LookupPath.empty()) + { + nlwarning("Music file %s does not exist!", filepath.c_str()); + return; + } if (!getStreamFileSound()->getAsync()) { if (!prepareDecoder()) @@ -272,7 +279,8 @@ bool CStreamFileSource::prepareDecoder() if (!m_AudioDecoder) { // load the file - m_AudioDecoder = IAudioDecoder::createAudioDecoder(getStreamFileSound()->getFilePath(), getStreamFileSound()->getAsync(), getStreamFileSound()->getLooping()); + nlassert(!m_LookupPath.empty()); + m_AudioDecoder = IAudioDecoder::createAudioDecoder(m_LookupPath, getStreamFileSound()->getAsync(), getStreamFileSound()->getLooping()); if (!m_AudioDecoder) { nlwarning("Failed to create IAudioDecoder, likely invalid format"); diff --git a/nel/src/web/http_client_curl.cpp b/nel/src/web/http_client_curl.cpp index 1ec244cd2..e61baa89f 100644 --- a/nel/src/web/http_client_curl.cpp +++ b/nel/src/web/http_client_curl.cpp @@ -192,6 +192,7 @@ bool CCurlHttpClient::receive(string &res, bool verbose) void CCurlHttpClient::disconnect() { curl_easy_cleanup(_Curl); + _CurlStruct = NULL; curl_global_cleanup(); } diff --git a/ryzom/client/src/client_cfg.cpp b/ryzom/client/src/client_cfg.cpp index 055260673..9d030cdca 100644 --- a/ryzom/client/src/client_cfg.cpp +++ b/ryzom/client/src/client_cfg.cpp @@ -326,8 +326,8 @@ CClientConfig::CClientConfig() Local = false; // Default is Net Mode. FSHost = ""; // Default Host. - TexturesInterface.push_back("texture_interfaces_v3_2x"); - TexturesInterfaceDXTC.push_back("texture_interfaces_dxtc_2x"); + TexturesInterface.push_back("texture_interfaces_v3"); + TexturesInterfaceDXTC.push_back("texture_interfaces_dxtc"); TexturesOutGameInterface.push_back("texture_interfaces_v3_outgame_ui"); @@ -456,7 +456,13 @@ CClientConfig::CClientConfig() SoundOn = true; // Default is with sound. DriverSound = SoundDrvAuto; SoundForceSoftwareBuffer = true; - SoundOutGameMusic = "main menu loop.ogg"; + StartMusic = "main theme air.ogg"; // Use at game startup (originally no music) + EmptySlotMusic = "loading music loop.ogg"; // Use in character selection for empty slots + LoadingMusic = "main menu loop.ogg"; // Main loading used after leaving character selection, and when going back to character selection + KamiTeleportMusic = "kami teleport.ogg"; // Kami teleport + KaravanTeleportMusic = "karavan teleport.ogg"; // Karavan teleport + TeleportLoadingMusic = "loading music loop.ogg"; // Use for generic teleportations + DeathMusic = "death.ogg"; // Player death SoundSFXVolume = 1.f; SoundGameMusicVolume = 1.f; SoundTPFade = 500; @@ -467,7 +473,7 @@ CClientConfig::CClientConfig() UserEntitySoundLevel = 0.5f; // Default volume for sound in 1st person UseEax = true; // Default to use EAX; UseADPCM = false; // Defualt to PCM sample, NO ADPCM - MaxTrack = 32; // DEfault to 32 track + MaxTrack = 32; // Default to 32 track ColorShout = CRGBA(150,0,0,255); // Default Shout color. ColorTalk = CRGBA(255,255,255,255); // Default Talk color. @@ -782,8 +788,8 @@ void CClientConfig::setValues() READ_STRINGVECTOR_FV(TexturesOutGameInterfaceDXTC); // interface textures ingame and r2 - //READ_STRINGVECTOR_FV(TexturesInterface); - //READ_STRINGVECTOR_FV(TexturesInterfaceDXTC); + READ_STRINGVECTOR_FV(TexturesInterface); + READ_STRINGVECTOR_FV(TexturesInterfaceDXTC); // interface files login menus READ_STRINGVECTOR_FV(XMLLoginInterfaceFiles); @@ -903,76 +909,16 @@ void CClientConfig::setValues() READ_STRING_FV(FSHost) READ_BOOL_DEV(DisplayAccountButtons) - - - READ_STRING_FV(CreateAccountURL) - READ_STRING_FV(EditAccountURL) - READ_STRING_FV(ForgetPwdURL) - + READ_STRING_DEV(CreateAccountURL) + READ_STRING_DEV(EditAccountURL) + READ_STRING_DEV(ForgetPwdURL) READ_STRING_DEV(BetaAccountURL) READ_STRING_DEV(FreeTrialURL) // defined in client_default.cfg + READ_STRING_FV(ConditionsTermsURL) + READ_STRING_FV(NamingPolicyURL) READ_STRING_FV(LoginSupportURL) - - // read NamingPolicyURL from client_default.cfg - //READ_STRING_FV(NamingPolicyURL) - - std::string languageCo = "wk"; - CConfigFile::CVar *languageCodeVarPtr = ClientCfg.ConfigFile.getVarPtr("LanguageCode"); - - if (languageCodeVarPtr) - { - languageCo = languageCodeVarPtr->asString(); - } - - CConfigFile::CVar *policyurl = ClientCfg.ConfigFile.getVarPtr("NamingPolicyURL"); - - if (policyurl) - { - for (uint i = 0; i < policyurl->size(); ++i) - { - std::string entry = policyurl->asString(i); - if (entry.size() >= languageCo.size()) - { - if (nlstricmp(entry.substr(0, languageCo.size()), languageCo) == 0) - { - std::string::size_type pos = entry.find("="); - - if (pos != std::string::npos) - { - ClientCfg.NamingPolicyURL = entry.substr(pos + 1); - } - } - } - } - } - - // read NamingPolicyURL from client_default.cfg - //READ_STRING_FV(ConditionsTermsURL) - CConfigFile::CVar *coturl = ClientCfg.ConfigFile.getVarPtr("ConditionsTermsURL"); - - if (coturl) - { - for (uint i = 0; i < coturl->size(); ++i) - { - std::string entry = coturl->asString(i); - - if (entry.size() >= languageCo.size()) - { - if (nlstricmp(entry.substr(0, languageCo.size()), languageCo) == 0) - { - std::string::size_type pos = entry.find("="); - - if (pos != std::string::npos) - { - ClientCfg.ConditionsTermsURL = entry.substr(pos + 1); - } - } - } - } - } - #ifndef RZ_NO_CLIENT // if cookie is not empty, it means that the client was launch @@ -1298,7 +1244,13 @@ void CClientConfig::setValues() // SoundForceSoftwareBuffer READ_BOOL_FV(SoundForceSoftwareBuffer); // SoundOutGameMusic - READ_STRING_DEV(SoundOutGameMusic) + READ_STRING_DEV(StartMusic) + READ_STRING_DEV(EmptySlotMusic) + READ_STRING_DEV(LoadingMusic) + READ_STRING_DEV(KamiTeleportMusic) + READ_STRING_DEV(KaravanTeleportMusic) + READ_STRING_DEV(TeleportLoadingMusic) + READ_STRING_DEV(DeathMusic) // SoundSFXVolume READ_FLOAT_FV(SoundSFXVolume); // SoundGameMusicVolume diff --git a/ryzom/client/src/client_cfg.h b/ryzom/client/src/client_cfg.h index 2b79dbf05..16a1e9e0c 100644 --- a/ryzom/client/src/client_cfg.h +++ b/ryzom/client/src/client_cfg.h @@ -348,8 +348,14 @@ struct CClientConfig /// SoundForceSoftwareBuffer bool SoundForceSoftwareBuffer; - /// The outgame music file - string SoundOutGameMusic; + /// Music files + string StartMusic; + string EmptySlotMusic; + string LoadingMusic; + string KamiTeleportMusic; + string KaravanTeleportMusic; + string TeleportLoadingMusic; + string DeathMusic; /// The Sound SFX Volume (0-1) (ie all but music) float SoundSFXVolume; diff --git a/ryzom/client/src/connection.cpp b/ryzom/client/src/connection.cpp index f57238991..ee1be3318 100644 --- a/ryzom/client/src/connection.cpp +++ b/ryzom/client/src/connection.cpp @@ -193,7 +193,6 @@ bool hasPrivilegeG() { return (UserPrivileges.find(":G:") != std::string::npos); bool hasPrivilegeEM() { return (UserPrivileges.find(":EM:") != std::string::npos); } bool hasPrivilegeEG() { return (UserPrivileges.find(":EG:") != std::string::npos); } bool hasPrivilegeOBSERVER() { return (UserPrivileges.find(":OBSERVER:") != std::string::npos); } -bool hasPrivilegeTESTER() { return (UserPrivileges.find(":TESTER:") != std::string::npos); } // Restore the video mode (fullscreen for example) after the connection (done in a window) @@ -279,6 +278,73 @@ void setOutGameFullScreen() CViewRenderer::getInstance()->setInterfaceScale(1.0f, 1024, 768); } +// ------------------------------------------------------------------------------------------------ +class CSoundGlobalMenu +{ +public: + CSoundGlobalMenu() + { + _MusicWantedAsync= false; + _NbFrameBeforeChange= NbFrameBeforeChangeMax; + } + void reset(); + void setMusic(const string &music, bool async); + void updateSound(); +private: + string _MusicPlayed; + string _MusicWanted; + bool _MusicWantedAsync; + sint _NbFrameBeforeChange; + enum {NbFrameBeforeChangeMax= 10}; +}; + +void CSoundGlobalMenu::reset() +{ + _MusicPlayed.clear(); + _MusicWanted.clear(); +} + +void CSoundGlobalMenu::updateSound() +{ + // **** update the music played + // The first music played is the music played at loading, before select char + if (_MusicPlayed.empty()) + _MusicPlayed = toLower(LoadingMusic.empty() ? ClientCfg.StartMusic : LoadingMusic); + if (_MusicWanted.empty()) + _MusicWanted = toLower(LoadingMusic.empty() ? ClientCfg.StartMusic : LoadingMusic); + + // because music is changed when the player select other race for instance, + // wait the 3D to load (stall some secs) + + // if the wanted music is the same as the one currently playing, just continue playing + if(_MusicPlayed!=_MusicWanted) + { + // wait nbFrameBeforeChangeMax before actually changing the music + _NbFrameBeforeChange--; + if(_NbFrameBeforeChange<=0) + { + _MusicPlayed= _MusicWanted; + // play the music + if (SoundMngr != NULL) + SoundMngr->playMusic(_MusicPlayed, 500, _MusicWantedAsync, true, true); + } + } + + + // **** update mngr + if (SoundMngr != NULL) + SoundMngr->update(); +} + +void CSoundGlobalMenu::setMusic(const string &music, bool async) +{ + _MusicWanted= toLower(music); + _MusicWantedAsync= async; + // reset the counter + _NbFrameBeforeChange= NbFrameBeforeChangeMax; +} +static CSoundGlobalMenu SoundGlobalMenu; + // New version of the menu after the server connection // @@ -411,6 +477,8 @@ bool connection (const string &cookie, const string &fsaddr) InterfaceState = GLOBAL_MENU; } + // No loading music here, this is right before character selection, using the existing music + // Create the loading texture. We can't do that before because we need to add search path first. beginLoading (LoadBackground); UseEscapeDuringLoading = USE_ESCAPE_DURING_LOADING; @@ -513,6 +581,7 @@ bool reconnection() ProgressBar.setFontFactor(1.0f); // Init out game + SoundGlobalMenu.reset(); pIM->initOutGame(); // Hide cursor for interface @@ -528,6 +597,9 @@ bool reconnection() FarTP.setOutgame(); + if (SoundMngr) + SoundMngr->setupFadeSound(1.0f, 1.0f); + // these two globals sequence GlobalMenu to display the character select dialog WaitServerAnswer = true; userChar = true; @@ -562,6 +634,8 @@ bool reconnection() // this also kicks the state machine to sendReady() so we stop spinning in farTPmainLoop FarTP.setIngame(); + // Not loading music here, this is before character selection, keep existing music + // Create the loading texture. We can't do that before because we need to add search path first. beginLoading (LoadBackground); UseEscapeDuringLoading = USE_ESCAPE_DURING_LOADING; @@ -737,66 +811,6 @@ std::string buildPlayerNameForSaveFile(const ucstring &playerNameIn) return ret; } -// ------------------------------------------------------------------------------------------------ -class CSoundGlobalMenu -{ -public: - CSoundGlobalMenu() - { - _MusicWantedAsync= false; - _NbFrameBeforeChange= NbFrameBeforeChangeMax; - } - void setMusic(const string &music, bool async); - void updateSound(); -private: - string _MusicPlayed; - string _MusicWanted; - bool _MusicWantedAsync; - sint _NbFrameBeforeChange; - enum {NbFrameBeforeChangeMax= 10}; -}; - -void CSoundGlobalMenu::updateSound() -{ - // **** update the music played - // The first music played is the music played at loading, before select char - if(_MusicPlayed.empty()) - _MusicPlayed= toLower(ClientCfg.SoundOutGameMusic); - if(_MusicWanted.empty()) - _MusicWanted= toLower(ClientCfg.SoundOutGameMusic); - - // because music is changed when the player select other race for instance, - // wait the 3D to load (stall some secs) - - // if the wanted music is the same as the one currently playing, just continue playing - if(_MusicPlayed!=_MusicWanted) - { - // wait nbFrameBeforeChangeMax before actually changing the music - _NbFrameBeforeChange--; - if(_NbFrameBeforeChange<=0) - { - _MusicPlayed= _MusicWanted; - // play the music - if (SoundMngr != NULL) - SoundMngr->playMusic(_MusicPlayed, 500, _MusicWantedAsync, true, true); - } - } - - - // **** update mngr - if (SoundMngr != NULL) - SoundMngr->update(); -} - -void CSoundGlobalMenu::setMusic(const string &music, bool async) -{ - _MusicWanted= toLower(music); - _MusicWantedAsync= async; - // reset the counter - _NbFrameBeforeChange= NbFrameBeforeChangeMax; -} -static CSoundGlobalMenu SoundGlobalMenu; - static bool LuaBGDSuccessFlag = true; // tmp, for debug @@ -1113,7 +1127,7 @@ TInterfaceState globalMenu() charSelect = LoginCharsel; WaitServerAnswer = false; - if (charSelect == -1 || FarTP.isReselectingChar()) + if (charSelect == -1) { CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp("UI:SERVER_RECEIVED_CHARS", false); if (pNL != NULL) @@ -2047,8 +2061,8 @@ public: fromString(getParam(Params, "async"), async); // if empty name, return to default mode - if(sName.empty()) - sName= ClientCfg.SoundOutGameMusic; + if (sName.empty()) + sName = ClientCfg.EmptySlotMusic; // change the music SoundGlobalMenu.setMusic(sName, async); diff --git a/ryzom/client/src/far_tp.cpp b/ryzom/client/src/far_tp.cpp index 1c2a6e612..80134f26b 100644 --- a/ryzom/client/src/far_tp.cpp +++ b/ryzom/client/src/far_tp.cpp @@ -49,12 +49,12 @@ #include "login_progress_post_thread.h" #include "interface_v3/action_handler_base.h" #include "item_group_manager.h" -#include "nel/misc/cmd_args.h" #ifdef DEBUG_NEW #define new DEBUG_NEW #endif + using namespace NLMISC; using namespace NLNET; using namespace NL3D; @@ -210,7 +210,6 @@ extern bool IsInRingSession; extern void selectTipsOfTheDay (uint tips); #define BAR_STEP_TP 2 -extern NLMISC::CCmdArgs Args; CLoginStateMachine::TEvent CLoginStateMachine::waitEvent() { @@ -463,14 +462,12 @@ void CLoginStateMachine::run() case st_check_patch: /// check the data to check if patch needed CLoginProgressPostThread::getInstance().step(CLoginStep(LoginStep_PostLogin, "login_step_post_login")); - - if (!ClientCfg.PatchWanted || (Args.haveArg("n") && Args.getLongArg("nopatch").front() == "1")) + if (!ClientCfg.PatchWanted) { // client don't want to be patched ! _CurrentState = st_display_eula; break; } - initPatchCheck(); SM_BEGIN_EVENT_TABLE if (isBGDownloadEnabled()) @@ -1115,15 +1112,6 @@ void CFarTP::disconnectFromPreviousShard() beginLoading (StartBackground); UseEscapeDuringLoading = false; - // Play music and fade out the Game Sound - if (SoundMngr) - { - // Loading Music Loop.ogg - LoadingMusic = ClientCfg.SoundOutGameMusic; - SoundMngr->playEventMusic(LoadingMusic, CSoundManager::LoadingMusicXFade, true); - SoundMngr->fadeOutGameSound(ClientCfg.SoundTPFade); - } - // Change the tips selectTipsOfTheDay (rand()); @@ -1132,6 +1120,21 @@ void CFarTP::disconnectFromPreviousShard() ucstring nmsg("Loading..."); ProgressBar.newMessage ( ClientCfg.buildLoadingString(nmsg) ); ProgressBar.progress(0); + + // Play music and fade out the Game Sound + if (SoundMngr) + { + SoundMngr->fadeOutGameSound(ClientCfg.SoundTPFade); + + // Stop and enable music + SoundMngr->stopMusic(0); + SoundMngr->setupFadeSound(0.0f, 1.0f); + + // Loading Music Loop.ogg + LoadingMusic = ClientCfg.LoadingMusic; + // SoundMngr->playEventMusic(LoadingMusic, CSoundManager::LoadingMusicXFade, true); + SoundMngr->playMusic(LoadingMusic, 0, false, true, true); + } } // Disconnect from the FS @@ -1520,3 +1523,4 @@ void CFarTP::farTPmainLoop() if(welcomeWindow) initWelcomeWindow(); } + diff --git a/ryzom/client/src/init.cpp b/ryzom/client/src/init.cpp index efc137ee6..5e7b03549 100644 --- a/ryzom/client/src/init.cpp +++ b/ryzom/client/src/init.cpp @@ -1410,6 +1410,42 @@ void prelogInit() StereoDisplay->setDriver(Driver); // VR_DRIVER } + { + H_AUTO(InitRZSound) + + // Init the sound manager + nmsg = "Initializing sound manager..."; + ProgressBar.newMessage(ClientCfg.buildLoadingString(nmsg)); + if (ClientCfg.SoundOn) + { + nlassert(!SoundMngr); + SoundMngr = new CSoundManager(&ProgressBar); + try + { + SoundMngr->init(&ProgressBar); + } + catch(const Exception &e) + { + nlwarning("init : Error when creating 'SoundMngr' : %s", e.what()); + delete SoundMngr; + SoundMngr = NULL; + } + + // Play Music just after the SoundMngr is inited + if (SoundMngr) + { + // init the SoundMngr with backuped volume + SoundMngr->setSFXVolume(ClientCfg.SoundSFXVolume); + SoundMngr->setGameMusicVolume(ClientCfg.SoundGameMusicVolume); + + // Play the login screen music + SoundMngr->playMusic(ClientCfg.StartMusic, 0, true, true, true); + } + } + + CPath::memoryCompress(); // Because sound calls addSearchPath + } + nlinfo ("PROFILE: %d seconds for prelogInit", (uint32)(ryzomGetLocalTime ()-initStart)/1000); FPU_CHECKER_ONCE @@ -1552,55 +1588,6 @@ void postlogInit() // set the primitive context CPrimitiveContext::instance().CurrentLigoConfig = &LigoConfig; - { - H_AUTO(InitRZSound) - - // Init the sound manager - nmsg = "Initializing sound manager..."; - ProgressBar.newMessage ( ClientCfg.buildLoadingString(nmsg) ); - if(ClientCfg.SoundOn) - { - SoundMngr = new CSoundManager(&ProgressBar); - try - { - SoundMngr->init(&ProgressBar); - } - catch(const Exception &e) - { - nlwarning("init : Error when creating 'SoundMngr' : %s", e.what()); - delete SoundMngr; - SoundMngr = NULL; - } - - // Play Music just after the SoundMngr is inited - if(SoundMngr) - { - // init the SoundMngr with backuped volume - SoundMngr->setSFXVolume(ClientCfg.SoundSFXVolume); - SoundMngr->setGameMusicVolume(ClientCfg.SoundGameMusicVolume); - - // no fadein, and not async because don't work well because of loading in the main thread - // Force use GameMusic volume - const uint fadeInTime= 500; - SoundMngr->playMusic(ClientCfg.SoundOutGameMusic, fadeInTime, false, true, true); - // Because of blocking loading, force the fadeIn - TTime t0= ryzomGetLocalTime(); - TTime t1; - while((t1=ryzomGetLocalTime())updateAudioMixerOnly(); - } - } - } - - CPath::memoryCompress(); // Because sound call addSearchPath - - initLast = initCurrent; - initCurrent = ryzomGetLocalTime(); - //nlinfo ("PROFILE: %d seconds (%d total) for Initializing sound manager", (uint32)(initCurrent-initLast)/1000, (uint32)(initCurrent-initStart)/1000); - } - { H_AUTO(InitRZShIdI) diff --git a/ryzom/client/src/init_main_loop.cpp b/ryzom/client/src/init_main_loop.cpp index 2b391114c..deeda2149 100644 --- a/ryzom/client/src/init_main_loop.cpp +++ b/ryzom/client/src/init_main_loop.cpp @@ -473,6 +473,27 @@ void initMainLoop() FPU_CHECKER_ONCE + if (SoundMngr) + { + // Loading Music + LoadingMusic = ClientCfg.LoadingMusic; + + // SoundMngr->playEventMusic(LoadingMusic, CSoundManager::LoadingMusicXFade, true); + // no fadein, and not async because don't work well because of loading in the main thread + // Force use GameMusic volume + const uint fadeInTime = 500; + SoundMngr->playMusic(LoadingMusic, fadeInTime, false, true, true); + // Because of blocking loading, force the fadeIn + TTime t0 = ryzomGetLocalTime(); + TTime t1; + do + { + ProgressBar.progress(0); + SoundMngr->updateAudioMixerOnly(); + nlSleep(10); + } while ((t1 = ryzomGetLocalTime()) < t0 + fadeInTime); + } + // Get the interface manager CInterfaceManager *pIM = CInterfaceManager::getInstance(); diff --git a/ryzom/client/src/interface_v3/input_handler_manager.cpp b/ryzom/client/src/interface_v3/input_handler_manager.cpp index 9d1e9292d..67a1b2350 100644 --- a/ryzom/client/src/interface_v3/input_handler_manager.cpp +++ b/ryzom/client/src/interface_v3/input_handler_manager.cpp @@ -271,16 +271,16 @@ void CInputHandlerManager::operator ()(const NLMISC::CEvent &event) { - CViewPointer &rIP = *static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() ); + CViewPointer &rIP = *static_cast(CWidgetManager::getInstance()->getPointer()); NLGUI::CEventDescriptorMouse eventDesc; - sint32 x,y; - rIP.getPointerDispPos (x, y); - eventDesc.setX (x); - eventDesc.setY (y); + sint32 x, y; + rIP.getPointerDispPos(x, y); + eventDesc.setX(x); + eventDesc.setY(y); - bool handled= false; + bool handled = false; // button down ? static volatile bool doTest = false; @@ -291,7 +291,7 @@ void CInputHandlerManager::operator ()(const NLMISC::CEvent &event) { if (_RecoverFocusLost) { - handled |= updateMousePos((CEventMouse&)event, eventDesc); // must update mouse pos here, + handled |= updateMousePos((CEventMouse&)event); // must update mouse pos here, // because when app window focus is gained by a mouse click, this is // the only place where we can retrieve mouse pos before a mouse move _RecoverFocusLost = false; @@ -299,10 +299,19 @@ void CInputHandlerManager::operator ()(const NLMISC::CEvent &event) if (!handled) { if (R2::getEditor().isInitialized() - && (R2::isEditionCurrent() || R2::getEditor().getCurrentTool()) - ) + && (R2::isEditionCurrent() || R2::getEditor().getCurrentTool())) { - handled |= R2::getEditor().handleEvent(eventDesc); + const NLMISC::CEventMouseDown *mouseDownEvent = static_cast(&event); + if (mouseDownEvent->Button & NLMISC::leftButton) + { + eventDesc.setEventTypeExtended(CEventDescriptorMouse::mouseleftdown); + handled |= R2::getEditor().handleEvent(eventDesc); + } + if (mouseDownEvent->Button & NLMISC::rightButton) + { + eventDesc.setEventTypeExtended(CEventDescriptorMouse::mouserightdown); + handled |= R2::getEditor().handleEvent(eventDesc); + } } } handled |= inputHandler.handleMouseButtonDownEvent( event ); @@ -321,7 +330,7 @@ void CInputHandlerManager::operator ()(const NLMISC::CEvent &event) // mouse move? else if(event == EventMouseMoveId) { - handled |= updateMousePos((CEventMouse&)event, eventDesc); + handled |= updateMousePos((CEventMouse&)event); } else if (event == EventMouseWheelId) { @@ -330,19 +339,77 @@ void CInputHandlerManager::operator ()(const NLMISC::CEvent &event) } // if Event not handled, post to Action Manager - if( !handled ) + if (!handled) { - bool handled = false; if (R2::getEditor().isInitialized() - && (R2::isEditionCurrent() || R2::getEditor().getCurrentTool()) - ) + && (R2::isEditionCurrent() || R2::getEditor().getCurrentTool())) { - handled = R2::getEditor().handleEvent(eventDesc); + if (event == EventMouseDownId) + { + const NLMISC::CEventMouseDown *mouseDownEvent = static_cast(&event); + if (mouseDownEvent->Button & NLMISC::leftButton) + { + eventDesc.setEventTypeExtended(CEventDescriptorMouse::mouseleftdown); + handled |= R2::getEditor().handleEvent(eventDesc); + } + if (mouseDownEvent->Button & NLMISC::rightButton) + { + eventDesc.setEventTypeExtended(CEventDescriptorMouse::mouserightdown); + handled |= R2::getEditor().handleEvent(eventDesc); + } + } + else if (event == EventMouseUpId) + { + const NLMISC::CEventMouseUp *mouseUpEvent = static_cast(&event); + if (mouseUpEvent->Button & NLMISC::leftButton) + { + eventDesc.setEventTypeExtended(CEventDescriptorMouse::mouseleftup); + handled |= R2::getEditor().handleEvent(eventDesc); + } + if (mouseUpEvent->Button & NLMISC::rightButton) + { + eventDesc.setEventTypeExtended(CEventDescriptorMouse::mouserightup); + handled |= R2::getEditor().handleEvent(eventDesc); + } + } + else if (event == EventMouseDblClkId) + { + const NLMISC::CEventMouseDblClk *mouseDblClkEvent = static_cast(&event); + if (mouseDblClkEvent->Button & NLMISC::leftButton) + { + eventDesc.setEventTypeExtended(CEventDescriptorMouse::mouseleftdblclk); + handled |= R2::getEditor().handleEvent(eventDesc); + } + if (mouseDblClkEvent->Button & NLMISC::rightButton) + { + eventDesc.setEventTypeExtended(CEventDescriptorMouse::mouserightdblclk); + handled |= R2::getEditor().handleEvent(eventDesc); + } + } + else + { + if (event == EventMouseWheelId) + { + const NLMISC::CEventMouseWheel *wheelEvent = static_cast(&event); + eventDesc.setEventTypeExtended(CEventDescriptorMouse::mousewheel); + eventDesc.setWheel(wheelEvent->Direction ? 1 : -1); + handled = R2::getEditor().handleEvent(eventDesc); + } + else if (event == EventMouseMoveId) + { + eventDesc.setEventTypeExtended(CEventDescriptorMouse::mousemove); + handled = R2::getEditor().handleEvent(eventDesc); + } + else + { + nlwarning("R2 unknown mouse event '%s'", event.toString().c_str()); + } + } } if (!handled) { // post to Action Manager - FilteredEventServer.postEvent( event.clone() ); + FilteredEventServer.postEvent(event.clone()); } } } @@ -355,7 +422,7 @@ void CInputHandlerManager::operator ()(const NLMISC::CEvent &event) // *************************************************************************** -bool CInputHandlerManager::updateMousePos(NLMISC::CEventMouse &event, NLGUI::CEventDescriptorMouse &eventDesc) +bool CInputHandlerManager::updateMousePos(NLMISC::CEventMouse &event) { if (!IsMouseFreeLook()) return inputHandler.handleMouseMoveEvent( event ); diff --git a/ryzom/client/src/interface_v3/input_handler_manager.h b/ryzom/client/src/interface_v3/input_handler_manager.h index 7971ef9a8..4b078ee84 100644 --- a/ryzom/client/src/interface_v3/input_handler_manager.h +++ b/ryzom/client/src/interface_v3/input_handler_manager.h @@ -181,7 +181,7 @@ private: void parseKey(xmlNodePtr cur, std::vector &out); // return true if handled - bool updateMousePos(NLMISC::CEventMouse &event, NLGUI::CEventDescriptorMouse &eventDesc); + bool updateMousePos(NLMISC::CEventMouse &event); NLGUI::CInputHandler inputHandler; diff --git a/ryzom/client/src/interface_v3/inventory_manager.cpp b/ryzom/client/src/interface_v3/inventory_manager.cpp index 20480dc38..5c4799fe4 100644 --- a/ryzom/client/src/interface_v3/inventory_manager.cpp +++ b/ryzom/client/src/interface_v3/inventory_manager.cpp @@ -3648,19 +3648,23 @@ void CInventoryManager::onTradeChangeSession() // *************************************************************************** void CInventoryManager::updateItemInfoQueue() { + if (!ConnectionReadySent) // CONNECTION:READY not yet sent, so we cannot send requests yet! + { + // Caused by CNetworkConnection::reinit, and NLMISC::CCDBNodeBranch::resetData + // TODO: Item sheets are effectively being set to 0, any way to detect this in particular? + // Slots with sheet 0 won't have any info to request anyway! + // Remove this check in favour of the assert lower down when properly implemented. + nlwarning("Update item info queue (%i), but connection not ready", (int)_ItemInfoWaiters.size()); + return; + } + + // CONNECTION:READY not yet sent, so we cannot send requests yet! + nlassert(ConnectionReadySent || !_ItemInfoWaiters.size()); + // For All waiters, look if one need update. TItemInfoWaiters::iterator it; for(it= _ItemInfoWaiters.begin();it!=_ItemInfoWaiters.end();it++) { - /* yoyo remove: temp patch to be sure that the client does not send messages before the - CONNECTION:READY is sent - Ulukyn: this only happens if player ask to reselect a char before end of update items. - On this case, skip it... - */ - - if (!ConnectionReadySent) - continue; - IItemInfoWaiter *waiter=*it; uint itemSlotId= waiter->ItemSlotId; TItemInfoMap::iterator it= _ItemInfoMap.find(itemSlotId); diff --git a/ryzom/client/src/login.cpp b/ryzom/client/src/login.cpp index 244bb593c..9eb9688ae 100644 --- a/ryzom/client/src/login.cpp +++ b/ryzom/client/src/login.cpp @@ -1932,11 +1932,8 @@ class CAHOpenURL : public IActionHandler #else // TODO: for Linux and Mac OS #endif - if (sParams == "cfg_CreateAccountURL") - { - url = ClientCfg.CreateAccountURL; - } - else if (sParams == "cfg_EditAccountURL") + + if (sParams == "cfg_EditAccountURL") { url = ClientCfg.EditAccountURL; } @@ -1974,35 +1971,32 @@ class CAHOpenURL : public IActionHandler nlwarning("no URL found"); return; } - - if(sParams != "cfg_ConditionsTermsURL" && sParams != "cfg_NamingPolicyURL") - { - // modify existing languages - // old site - string::size_type pos_lang = url.find("/en/"); + // modify existing languages - // or new forums - if (pos_lang == string::npos) - pos_lang = url.find("=en#"); + // old site + string::size_type pos_lang = url.find("/en/"); - if (pos_lang != string::npos) - { - url.replace(pos_lang + 1, 2, ClientCfg.getHtmlLanguageCode()); - } + // or new forums + if (pos_lang == string::npos) + pos_lang = url.find("=en#"); + + if (pos_lang != string::npos) + { + url.replace(pos_lang + 1, 2, ClientCfg.getHtmlLanguageCode()); + } + else + { + // append language + if (url.find('?') != string::npos) + url += "&"; else - { - // append language - if (url.find('?') != string::npos) - url += "&"; - else - url += "?"; + url += "?"; - url += "language=" + ClientCfg.LanguageCode; + url += "language=" + ClientCfg.LanguageCode; - if (!LoginCustomParameters.empty()) - url += LoginCustomParameters; - } + if (!LoginCustomParameters.empty()) + url += LoginCustomParameters; } openURL(url); @@ -3289,6 +3283,7 @@ bool loginIntroSkip; void loginIntro() { // Display of nevrax logo is done at init time (see init.cpp) just before addSearchPath (second one) +#if 0 for (uint i = 0; i < 1; i++) // previously display nevrax then nvidia { if (i != 0) @@ -3326,6 +3321,7 @@ void loginIntro() NLGUI::CDBManager::getInstance()->flushObserverCalls(); } } +#endif beginLoading(StartBackground); ProgressBar.finish(); } diff --git a/ryzom/client/src/main_loop.cpp b/ryzom/client/src/main_loop.cpp index 5c4f99446..a62b72e73 100644 --- a/ryzom/client/src/main_loop.cpp +++ b/ryzom/client/src/main_loop.cpp @@ -2255,19 +2255,21 @@ bool mainLoop() { StartPlayTime = NLMISC::CTime::getLocalTime(); } + // Start background sound play now ! (nb: restarted if load just ended, or if sound re-enabled) if (SoundMngr) { H_AUTO_USE ( RZ_Client_Main_Loop_Sound ) - SoundMngr->playBackgroundSound(); - } - // Fade in Game Sound now (before endLoading) - if(SoundMngr) - { // fade out loading music - if(LoadingMusic==SoundMngr->getEventMusicPlayed()) + if (SoundMngr->getEventMusicPlayed() == LoadingMusic) + { SoundMngr->stopEventMusic(LoadingMusic, CSoundManager::LoadingMusicXFade); + } + + SoundMngr->playBackgroundSound(); + + // Fade in Game Sound now (before endLoading) // fade in game sound SoundMngr->fadeInGameSound(ClientCfg.SoundTPFade); } @@ -2531,7 +2533,7 @@ bool mainLoop() EditActions.enable(true); // For stoping the outgame music, start after 30 frames, and duration of 3 seconds -// CMusicFader outgameFader(60, 3); + outgameFader = CMusicFader(60, 3); // check for banned player if (testPermanentBanMarkers()) diff --git a/ryzom/client/src/net_manager.cpp b/ryzom/client/src/net_manager.cpp index ada437ec7..c6da153bc 100644 --- a/ryzom/client/src/net_manager.cpp +++ b/ryzom/client/src/net_manager.cpp @@ -33,7 +33,6 @@ #include "game_share/chat_group.h" #include "game_share/character_summary.h" #include "game_share/sphrase_com.h" -#include "game_share/outpost.h" #include "game_share/msg_client_server.h" #include "game_share/ryzom_database_banks.h" #include "game_share/msg_encyclopedia.h" @@ -1489,32 +1488,33 @@ void impulseTPCommon(NLMISC::CBitMemStream &impulse, bool hasSeason) void impulseTPCommon2(NLMISC::CBitMemStream &impulse, bool hasSeason) { // choose a default screen if not setuped - if( LoadingBackground!=ResurectKamiBackground && LoadingBackground!=ResurectKaravanBackground && - LoadingBackground!=TeleportKamiBackground && LoadingBackground!=TeleportKaravanBackground) - LoadingBackground= TeleportKaravanBackground; + if (LoadingBackground != ResurectKamiBackground && LoadingBackground != ResurectKaravanBackground + && LoadingBackground != TeleportKamiBackground && LoadingBackground != TeleportKaravanBackground) + LoadingBackground = ElevatorBackground; // if resurect but user not dead, choose default. NB: this is a bug, the tp impulse should tell // which background to choose. \todo yoyo: this is a temp fix - if( UserEntity && !UserEntity->isDead() && - (LoadingBackground==ResurectKamiBackground || LoadingBackground==ResurectKaravanBackground) ) - LoadingBackground= TeleportKaravanBackground; + if (UserEntity && !UserEntity->isDead() && (LoadingBackground == ResurectKamiBackground || LoadingBackground == ResurectKaravanBackground)) + LoadingBackground = ElevatorBackground; // Play music according to the background - if(SoundMngr) + if (SoundMngr) { LoadingMusic.clear(); - if(LoadingBackground==TeleportKamiBackground) - LoadingMusic= "Kami Teleport.ogg"; - else if(LoadingBackground==TeleportKaravanBackground) - LoadingMusic= "Karavan Teleport.ogg"; - // if resurection, continue to play death music - else if(LoadingBackground==ResurectKamiBackground || LoadingBackground==ResurectKaravanBackground) - { - // noop - } - // default: loading music - else + switch (LoadingBackground) { - LoadingMusic= "Loading Music Loop.ogg"; + case TeleportKamiBackground: + LoadingMusic = ClientCfg.KamiTeleportMusic; + break; + case TeleportKaravanBackground: + LoadingMusic = ClientCfg.KaravanTeleportMusic; + break; + case ResurectKamiBackground: + case ResurectKaravanBackground: + // TODO: Resurrect music + break; + default: + LoadingMusic = ClientCfg.TeleportLoadingMusic; + break; } // start to play @@ -3206,11 +3206,9 @@ void impulseUserBars(NLMISC::CBitMemStream &impulse) void impulseOutpostChooseSide(NLMISC::CBitMemStream &impulse) { // read message - uint8 type; bool outpostInFire; bool playerGuildInConflict; bool playerGuildIsAttacker; - impulse.serial(type); impulse.serial(outpostInFire); impulse.serial(playerGuildInConflict); impulse.serial(playerGuildIsAttacker); @@ -3222,7 +3220,7 @@ void impulseOutpostChooseSide(NLMISC::CBitMemStream &impulse) impulse.serial( declTimer ); // start - OutpostManager.startPvpJoinProposal((OUTPOSTENUMS::TPVPType)type, outpostInFire, playerGuildInConflict, playerGuildIsAttacker, + OutpostManager.startPvpJoinProposal(outpostInFire, playerGuildInConflict, playerGuildIsAttacker, ownerGuildNameId, attackerGuildNameId, declTimer); } diff --git a/ryzom/client/src/user_entity.cpp b/ryzom/client/src/user_entity.cpp index 0ddd61c41..312fffca8 100644 --- a/ryzom/client/src/user_entity.cpp +++ b/ryzom/client/src/user_entity.cpp @@ -2674,6 +2674,17 @@ void CUserEntity::selection(const CLFECOMMON::TCLEntityId &slot) // virtual { playerGiftNeeded->setValue32(0); } + // + missionOption = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%d:TITLE", (int) k), false); + if (missionOption) + { + missionOption->setValue32(0); + } + playerGiftNeeded = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%d:PLAYER_GIFT_NEEDED", (int) k), false); + if (playerGiftNeeded) + { + playerGiftNeeded->setValue32(0); + } } /* TODO ULU : Add RP tags */ @@ -4302,20 +4313,19 @@ void CUserEntity::updatePreCollision(const NLMISC::TTime &time, CEntityCL *targe // test each frame if the mode has changed if(SoundMngr) { - string deadMusic= "death.ogg"; // Play/stop music if comes from or goes to dead - bool isDead= _Mode==MBEHAV::DEATH || _Mode==MBEHAV::SWIM_DEATH; + bool isDead = _Mode == MBEHAV::DEATH || _Mode == MBEHAV::SWIM_DEATH; // must start music? - if( isDead && SoundMngr->getEventMusicPlayed()!=deadMusic ) + if (isDead && SoundMngr->getEventMusicPlayed() != ClientCfg.DeathMusic) { - SoundMngr->playEventMusic(deadMusic, 0, true); + SoundMngr->playEventMusic(ClientCfg.DeathMusic, 0, true); } // must end music? - if( !isDead && SoundMngr->getEventMusicPlayed()==deadMusic ) + if (!isDead && SoundMngr->getEventMusicPlayed() == ClientCfg.DeathMusic) { - SoundMngr->stopEventMusic(deadMusic, CSoundManager::LoadingMusicXFade); + SoundMngr->stopEventMusic(ClientCfg.DeathMusic, CSoundManager::LoadingMusicXFade); } } } From 557f5d3d6c20f4980d734f43471e41798c4f7b88 Mon Sep 17 00:00:00 2001 From: Nuno Date: Wed, 20 Oct 2021 15:03:17 +0200 Subject: [PATCH 12/13] Changes made after code-to-root-atys branch --- nel/src/3d/lod_character_manager.cpp | 3 +- ryzom/client/src/client_cfg.cpp | 78 ++++++++++++++++--- ryzom/client/src/connection.cpp | 3 +- ryzom/client/src/far_tp.cpp | 8 +- .../src/interface_v3/inventory_manager.cpp | 3 - ryzom/client/src/login.cpp | 52 +++++++------ ryzom/client/src/net_manager.cpp | 5 +- 7 files changed, 110 insertions(+), 42 deletions(-) diff --git a/nel/src/3d/lod_character_manager.cpp b/nel/src/3d/lod_character_manager.cpp index f5d6a23c5..fe129108d 100644 --- a/nel/src/3d/lod_character_manager.cpp +++ b/nel/src/3d/lod_character_manager.cpp @@ -978,9 +978,10 @@ void CLodCharacterManager::addTextureCompute(CLodCharacterInstance &instance, return; // get lookup ptr. - nlassert(lodTexture.Texture.size()==NL3D_CLOD_TEXT_SIZE); if (lodTexture.Texture.size() < NL3D_CLOD_TEXT_SIZE) return; + + nlassert(lodTexture.Texture.size()==NL3D_CLOD_TEXT_SIZE); const CLodCharacterTexture::CTUVQ *lookUpPtr= &lodTexture.Texture[0]; diff --git a/ryzom/client/src/client_cfg.cpp b/ryzom/client/src/client_cfg.cpp index 9d030cdca..532852bbe 100644 --- a/ryzom/client/src/client_cfg.cpp +++ b/ryzom/client/src/client_cfg.cpp @@ -326,8 +326,8 @@ CClientConfig::CClientConfig() Local = false; // Default is Net Mode. FSHost = ""; // Default Host. - TexturesInterface.push_back("texture_interfaces_v3"); - TexturesInterfaceDXTC.push_back("texture_interfaces_dxtc"); + TexturesInterface.push_back("texture_interfaces_v3_2x"); + TexturesInterfaceDXTC.push_back("texture_interfaces_dxtc_2x"); TexturesOutGameInterface.push_back("texture_interfaces_v3_outgame_ui"); @@ -788,8 +788,8 @@ void CClientConfig::setValues() READ_STRINGVECTOR_FV(TexturesOutGameInterfaceDXTC); // interface textures ingame and r2 - READ_STRINGVECTOR_FV(TexturesInterface); - READ_STRINGVECTOR_FV(TexturesInterfaceDXTC); + //READ_STRINGVECTOR_FV(TexturesInterface); + //READ_STRINGVECTOR_FV(TexturesInterfaceDXTC); // interface files login menus READ_STRINGVECTOR_FV(XMLLoginInterfaceFiles); @@ -909,16 +909,76 @@ void CClientConfig::setValues() READ_STRING_FV(FSHost) READ_BOOL_DEV(DisplayAccountButtons) - READ_STRING_DEV(CreateAccountURL) - READ_STRING_DEV(EditAccountURL) - READ_STRING_DEV(ForgetPwdURL) + + + READ_STRING_FV(CreateAccountURL) + READ_STRING_FV(EditAccountURL) + READ_STRING_FV(ForgetPwdURL) + READ_STRING_DEV(BetaAccountURL) READ_STRING_DEV(FreeTrialURL) // defined in client_default.cfg - READ_STRING_FV(ConditionsTermsURL) - READ_STRING_FV(NamingPolicyURL) READ_STRING_FV(LoginSupportURL) + + // read NamingPolicyURL from client_default.cfg + //READ_STRING_FV(NamingPolicyURL) + + std::string languageCo = "wk"; + CConfigFile::CVar *languageCodeVarPtr = ClientCfg.ConfigFile.getVarPtr("LanguageCode"); + + if (languageCodeVarPtr) + { + languageCo = languageCodeVarPtr->asString(); + } + + CConfigFile::CVar *policyurl = ClientCfg.ConfigFile.getVarPtr("NamingPolicyURL"); + + if (policyurl) + { + for (uint i = 0; i < policyurl->size(); ++i) + { + std::string entry = policyurl->asString(i); + if (entry.size() >= languageCo.size()) + { + if (nlstricmp(entry.substr(0, languageCo.size()), languageCo) == 0) + { + std::string::size_type pos = entry.find("="); + + if (pos != std::string::npos) + { + ClientCfg.NamingPolicyURL = entry.substr(pos + 1); + } + } + } + } + } + + // read NamingPolicyURL from client_default.cfg + //READ_STRING_FV(ConditionsTermsURL) + CConfigFile::CVar *coturl = ClientCfg.ConfigFile.getVarPtr("ConditionsTermsURL"); + + if (coturl) + { + for (uint i = 0; i < coturl->size(); ++i) + { + std::string entry = coturl->asString(i); + + if (entry.size() >= languageCo.size()) + { + if (nlstricmp(entry.substr(0, languageCo.size()), languageCo) == 0) + { + std::string::size_type pos = entry.find("="); + + if (pos != std::string::npos) + { + ClientCfg.ConditionsTermsURL = entry.substr(pos + 1); + } + } + } + } + } + #ifndef RZ_NO_CLIENT // if cookie is not empty, it means that the client was launch diff --git a/ryzom/client/src/connection.cpp b/ryzom/client/src/connection.cpp index ee1be3318..4352f456f 100644 --- a/ryzom/client/src/connection.cpp +++ b/ryzom/client/src/connection.cpp @@ -193,6 +193,7 @@ bool hasPrivilegeG() { return (UserPrivileges.find(":G:") != std::string::npos); bool hasPrivilegeEM() { return (UserPrivileges.find(":EM:") != std::string::npos); } bool hasPrivilegeEG() { return (UserPrivileges.find(":EG:") != std::string::npos); } bool hasPrivilegeOBSERVER() { return (UserPrivileges.find(":OBSERVER:") != std::string::npos); } +bool hasPrivilegeTESTER() { return (UserPrivileges.find(":TESTER:") != std::string::npos); } // Restore the video mode (fullscreen for example) after the connection (done in a window) @@ -1127,7 +1128,7 @@ TInterfaceState globalMenu() charSelect = LoginCharsel; WaitServerAnswer = false; - if (charSelect == -1) + if (charSelect == -1 || FarTP.isReselectingChar()) { CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp("UI:SERVER_RECEIVED_CHARS", false); if (pNL != NULL) diff --git a/ryzom/client/src/far_tp.cpp b/ryzom/client/src/far_tp.cpp index 80134f26b..6509b4d2a 100644 --- a/ryzom/client/src/far_tp.cpp +++ b/ryzom/client/src/far_tp.cpp @@ -49,12 +49,12 @@ #include "login_progress_post_thread.h" #include "interface_v3/action_handler_base.h" #include "item_group_manager.h" +#include "nel/misc/cmd_args.h" #ifdef DEBUG_NEW #define new DEBUG_NEW #endif - using namespace NLMISC; using namespace NLNET; using namespace NL3D; @@ -210,6 +210,7 @@ extern bool IsInRingSession; extern void selectTipsOfTheDay (uint tips); #define BAR_STEP_TP 2 +extern NLMISC::CCmdArgs Args; CLoginStateMachine::TEvent CLoginStateMachine::waitEvent() { @@ -462,12 +463,14 @@ void CLoginStateMachine::run() case st_check_patch: /// check the data to check if patch needed CLoginProgressPostThread::getInstance().step(CLoginStep(LoginStep_PostLogin, "login_step_post_login")); - if (!ClientCfg.PatchWanted) + + if (!ClientCfg.PatchWanted || (Args.haveArg("n") && Args.getLongArg("nopatch").front() == "1")) { // client don't want to be patched ! _CurrentState = st_display_eula; break; } + initPatchCheck(); SM_BEGIN_EVENT_TABLE if (isBGDownloadEnabled()) @@ -1523,4 +1526,3 @@ void CFarTP::farTPmainLoop() if(welcomeWindow) initWelcomeWindow(); } - diff --git a/ryzom/client/src/interface_v3/inventory_manager.cpp b/ryzom/client/src/interface_v3/inventory_manager.cpp index 5c4799fe4..99f18241c 100644 --- a/ryzom/client/src/interface_v3/inventory_manager.cpp +++ b/ryzom/client/src/interface_v3/inventory_manager.cpp @@ -3658,9 +3658,6 @@ void CInventoryManager::updateItemInfoQueue() return; } - // CONNECTION:READY not yet sent, so we cannot send requests yet! - nlassert(ConnectionReadySent || !_ItemInfoWaiters.size()); - // For All waiters, look if one need update. TItemInfoWaiters::iterator it; for(it= _ItemInfoWaiters.begin();it!=_ItemInfoWaiters.end();it++) diff --git a/ryzom/client/src/login.cpp b/ryzom/client/src/login.cpp index 9eb9688ae..244bb593c 100644 --- a/ryzom/client/src/login.cpp +++ b/ryzom/client/src/login.cpp @@ -1932,8 +1932,11 @@ class CAHOpenURL : public IActionHandler #else // TODO: for Linux and Mac OS #endif - - if (sParams == "cfg_EditAccountURL") + if (sParams == "cfg_CreateAccountURL") + { + url = ClientCfg.CreateAccountURL; + } + else if (sParams == "cfg_EditAccountURL") { url = ClientCfg.EditAccountURL; } @@ -1971,32 +1974,35 @@ class CAHOpenURL : public IActionHandler nlwarning("no URL found"); return; } + + if(sParams != "cfg_ConditionsTermsURL" && sParams != "cfg_NamingPolicyURL") + { + // modify existing languages - // modify existing languages - - // old site - string::size_type pos_lang = url.find("/en/"); + // old site + string::size_type pos_lang = url.find("/en/"); - // or new forums - if (pos_lang == string::npos) - pos_lang = url.find("=en#"); + // or new forums + if (pos_lang == string::npos) + pos_lang = url.find("=en#"); - if (pos_lang != string::npos) - { - url.replace(pos_lang + 1, 2, ClientCfg.getHtmlLanguageCode()); - } - else - { - // append language - if (url.find('?') != string::npos) - url += "&"; + if (pos_lang != string::npos) + { + url.replace(pos_lang + 1, 2, ClientCfg.getHtmlLanguageCode()); + } else - url += "?"; + { + // append language + if (url.find('?') != string::npos) + url += "&"; + else + url += "?"; - url += "language=" + ClientCfg.LanguageCode; + url += "language=" + ClientCfg.LanguageCode; - if (!LoginCustomParameters.empty()) - url += LoginCustomParameters; + if (!LoginCustomParameters.empty()) + url += LoginCustomParameters; + } } openURL(url); @@ -3283,7 +3289,6 @@ bool loginIntroSkip; void loginIntro() { // Display of nevrax logo is done at init time (see init.cpp) just before addSearchPath (second one) -#if 0 for (uint i = 0; i < 1; i++) // previously display nevrax then nvidia { if (i != 0) @@ -3321,7 +3326,6 @@ void loginIntro() NLGUI::CDBManager::getInstance()->flushObserverCalls(); } } -#endif beginLoading(StartBackground); ProgressBar.finish(); } diff --git a/ryzom/client/src/net_manager.cpp b/ryzom/client/src/net_manager.cpp index c6da153bc..c7a24ae2a 100644 --- a/ryzom/client/src/net_manager.cpp +++ b/ryzom/client/src/net_manager.cpp @@ -33,6 +33,7 @@ #include "game_share/chat_group.h" #include "game_share/character_summary.h" #include "game_share/sphrase_com.h" +#include "game_share/outpost.h" #include "game_share/msg_client_server.h" #include "game_share/ryzom_database_banks.h" #include "game_share/msg_encyclopedia.h" @@ -3206,9 +3207,11 @@ void impulseUserBars(NLMISC::CBitMemStream &impulse) void impulseOutpostChooseSide(NLMISC::CBitMemStream &impulse) { // read message + uint8 type; bool outpostInFire; bool playerGuildInConflict; bool playerGuildIsAttacker; + impulse.serial(type); impulse.serial(outpostInFire); impulse.serial(playerGuildInConflict); impulse.serial(playerGuildIsAttacker); @@ -3220,7 +3223,7 @@ void impulseOutpostChooseSide(NLMISC::CBitMemStream &impulse) impulse.serial( declTimer ); // start - OutpostManager.startPvpJoinProposal(outpostInFire, playerGuildInConflict, playerGuildIsAttacker, + OutpostManager.startPvpJoinProposal((OUTPOSTENUMS::TPVPType)type, outpostInFire, playerGuildInConflict, playerGuildIsAttacker, ownerGuildNameId, attackerGuildNameId, declTimer); } From 0d68ca05e2ce210f8ff83a6ea4220c2320b3605b Mon Sep 17 00:00:00 2001 From: Nuno Date: Wed, 20 Oct 2021 15:33:47 +0200 Subject: [PATCH 13/13] Revert xml_macros --- nel/include/nel/misc/xml_macros.h | 75 +++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/nel/include/nel/misc/xml_macros.h b/nel/include/nel/misc/xml_macros.h index e69de29bb..6d924954b 100644 --- a/nel/include/nel/misc/xml_macros.h +++ b/nel/include/nel/misc/xml_macros.h @@ -0,0 +1,75 @@ +// NeL - MMORPG Framework +// Copyright (C) 2010-2021 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + + + +#ifndef XML_MACROS_H +#define XML_MACROS_H + +// +// xmlNodePtr cur; +// CXMLAutoPtr prop; +// +// sint i; +// XML_READ_SINT(cur, "prop_name", i, -1); +// + +#define XML_READ_UINT(node, name, var, def) { \ + uint tmp; \ + prop = (char *) xmlGetProp(node, (xmlChar*)name); \ + if (prop && fromString((const char*)prop, tmp)) \ + var = tmp; \ + else \ + var = def; \ +} + +#define XML_READ_SINT(node, name, var, def) { \ + sint tmp; \ + prop = (char *) xmlGetProp(node, (xmlChar*)name); \ + if (prop && fromString((const char*)prop, tmp)) \ + var = tmp; \ + else \ + var = def; \ +} + +#define XML_READ_BOOL(node, name, var, def) { \ + prop = (char *) xmlGetProp(node, (xmlChar*)name); \ + if (prop) \ + var = NLMISC::toBool((const char*)prop); \ + else \ + var = def; \ +} + +#define XML_READ_COLOR(node, name, var, def) { \ + NLMISC::CRGBA tmp; \ + prop = (char *) xmlGetProp(node, (xmlChar*)name); \ + if (prop && fromString((const char*)prop, tmp)) \ + var = tmp; \ + else \ + var = def; \ +} + +#define XML_READ_STRING(node, name, var, def) { \ + prop = (char *) xmlGetProp(node, (xmlChar*)name); \ + if (prop) \ + var = (const char*)prop; \ + else \ + var = def; \ +} + +#endif // XML_MACROS_H + +