aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--contrib/extract/extract_data.sh162
-rw-r--r--contrib/extract/only_extract_offmesh.sh158
2 files changed, 320 insertions, 0 deletions
diff --git a/contrib/extract/extract_data.sh b/contrib/extract/extract_data.sh
new file mode 100644
index 00000000000..d44dd7d12fd
--- /dev/null
+++ b/contrib/extract/extract_data.sh
@@ -0,0 +1,162 @@
+#!/bin/sh
+
+# Copyright (C) 2005-2012 MaNGOS project <http://getmangos.com/>
+#
+# This file is free software; as a special exception the author gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+## Expected param 1 to be 'a' for all, else ask some questions
+
+## Normal log file (if not overwritten by second param
+LOG_FILE="TrinityCoreExtractor.log"
+## Detailed log file
+DETAIL_LOG_FILE="TrinityCoreExtractor_detailed.log"
+
+## Change this to a value fitting for your sys!
+NUM_CPU="2"
+
+## ! Use below only for finetuning or if you know what you are doing !
+
+USE_AD="0"
+USE_VMAPS="0"
+USE_MMAPS="0"
+USE_MMAPS_OFFMESH="0"
+
+if [ "$1" = "a" ]
+then
+ ## extract all
+ USE_AD="1"
+ USE_VMAPS="1"
+ USE_MMAPS="1"
+else
+ ## do some questioning!
+ echo
+ echo "Welcome to helper script to extract required dataz for TrinityCore!"
+ echo "Should all dataz (dbc, maps, vmaps and mmaps be extracted? (y/n)"
+ read line
+ if [ "$line" = "y" ]
+ then
+ ## extract all
+ USE_AD="1"
+ USE_VMAPS="1"
+ USE_MMAPS="1"
+ else
+ echo
+ echo "Should dbc and maps be extracted? (y/n)"
+ read line
+ if [ "$line" = "y" ]; then USE_AD="1"; fi
+
+ echo
+ echo "Should vmaps be extracted? (y/n)"
+ read line
+ if [ "$line" = "y" ]; then USE_VMAPS="1"; fi
+
+ echo
+ echo "Should mmaps be extracted? (y/n)"
+ echo "WARNING! This will take several hours!"
+ read line
+ if [ "$line" = "y" ]
+ then
+ USE_MMAPS="1";
+ else
+ echo "Only reextract offmesh tiles for mmaps?"
+ read line
+ if [ "$line" = "y" ]
+ then
+ USE_MMAPS_OFFMESH="1";
+ fi
+ fi
+ fi
+fi
+
+## Special case: Only reextract offmesh tiles
+if [ "$USE_MMAPS_OFFMESH" = "1" ]
+then
+ echo "Only extracting offmesh meshes"
+ only_extract_offmesh.sh offmesh $LOG_FILE $DETAIL_LOG_FILE
+ exit 0
+fi
+
+## Obtain numbe ob processes
+if [ "$USE_MMAPS" = "1" ]
+then
+ echo "How many CPUs should be used for extracting mmaps? (1-4)"
+ read line
+ if [ "$line" -ge "1" -a "$line" -le "4" ]
+ then
+ NUM_CPU=$line
+ else
+ echo "Only number between 1 and 4 supported!"
+ exit 1
+ fi
+fi
+
+## Give some status
+echo "Current Settings: Extract DBCs/maps: $USE_AD, Extract vmaps: $USE_VMAPS, Extract mmaps: $USE_MMAPS on $NUM_CPU processes"
+if [ "$1" != "a" ]
+then
+ echo "If you don't like this settings, interrupt with CTRL+C"
+ read line
+fi
+
+echo "`date`: Start extracting dataz for TrinityCore" | tee $LOG_FILE
+
+## Handle log messages
+if [ "$USE_AD" = "1" ];
+then
+ echo "DBC and map files will be extracted" | tee -a $LOG_FILE
+else
+ echo "DBC and map files won't be extracted!" | tee -a $LOG_FILE
+fi
+if [ "$USE_VMAPS" = "1" ]
+then
+ echo "Vmaps will be extracted" | tee -a $LOG_FILE
+else
+ echo "Vmaps won't be extracted!" | tee -a $LOG_FILE
+fi
+if [ "$USE_MMAPS" = "1" ]
+then
+ echo "Mmaps will be extracted with $NUM_CPU processes" | tee -a $LOG_FILE
+else
+ echo "Mmaps files won't be extracted!" | tee -a $LOG_FILE
+fi
+echo | tee -a $LOG_FILE
+
+echo "`date`: Start extracting dataz for TrinityCore, DBCs/maps $USE_AD, vmaps $USE_VMAPS, mmaps $USE_MMAPS on $NUM_CPU processes" | tee $DETAIL_LOG_FILE
+echo | tee -a $DETAIL_LOG_FILE
+
+## Extract dbcs and maps
+if [ "$USE_AD" = "1" ]
+then
+ echo "`date`: Start extraction of DBCs and map files..." | tee -a $LOG_FILE
+ ad | tee -a $DETAIL_LOG_FILE
+ echo "`date`: Extracting of DBCs and map files finished" | tee -a $LOG_FILE
+ echo | tee -a $LOG_FILE
+ echo | tee -a $DETAIL_LOG_FILE
+fi
+
+## Extract vmaps
+if [ "$USE_VMAPS" = "1" ]
+then
+ echo "`date`: Start extraction of vmaps..." | tee -a $LOG_FILE
+ vmap4extractor | tee -a $DETAIL_LOG_FILE
+ echo "`date`: Extracting of vmaps finished" | tee -a $LOG_FILE
+ mkdir vmaps
+ echo "`date`: Start assembling of vmaps..." | tee -a $LOG_FILE
+ vmap4assembler.exe buildings vmaps | tee -a $DETAIL_LOG_FILE
+ echo "`date`: Assembling of vmaps finished" | tee -a $LOG_FILE
+
+ echo | tee -a $LOG_FILE
+ echo | tee -a $DETAIL_LOG_FILE
+fi
+
+## Extract mmaps
+if [ "$USE_MMAPS" = "1" ]
+then
+ only_extract_offmesh.sh $NUM_CPU $LOG_FILE $DETAIL_LOG_FILE
+fi
diff --git a/contrib/extract/only_extract_offmesh.sh b/contrib/extract/only_extract_offmesh.sh
new file mode 100644
index 00000000000..29beb3fdf18
--- /dev/null
+++ b/contrib/extract/only_extract_offmesh.sh
@@ -0,0 +1,158 @@
+#!/bin/sh
+
+# Copyright (C) 2005-2012 MaNGOS project <http://getmangos.com/>
+#
+# This file is free software; as a special exception the author gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+## Syntax of this helper
+## First param must be number of to be used CPUs (only 1, 2, 3, 4 supported) or "offmesh" to recreate the special tiles from the OFFMESH_FILE
+## Second param can be an additional filename for storing log
+## Third param can be an addition filename for storing detailed log
+
+## Additional Parameters to be forwarded to MoveMapGen, see mmaps/readme for instructions
+PARAMS="--silent"
+
+## Already a few map extracted, and don't care anymore
+EXCLUDE_MAPS=""
+#EXCLUDE_MAPS="0 1 530 571" # example to exclude the continents
+
+## Offmesh file
+OFFMESH_FILE="offmesh.txt"
+
+## Normal log file (if not overwritten by second param
+LOG_FILE="MoveMapGen.log"
+## Detailed log file
+DETAIL_LOG_FILE="MoveMapGen_detailed.log"
+
+## ! Use below only for finetuning or if you know what you are doing !
+
+## All maps
+MAP_LIST_A="1 37 543 595 289 572 529 562 531 269 47 649 650 599 548 559 429 230 573 349 13 25 409 229 43 48 546 553 547 604 545 90 576"
+MAP_LIST_B="571 628 560 509 723 532 607 600 668 33 585 566 389 601 369 129 550 189 542 70 109 554 632 552 555 540 598 450 558 249 35 624 557"
+MAP_LIST_C="0 631 609 534 533 619 469 602 329 580 615 578 36 556 44 565 544 34 617 608 618 449 616 42 451 582 584 586 587 588 589 590 591 592"
+MAP_LIST_D="530 169 575 603 309 574 30 564 568 209 724 658 489 593 594 596 597 605 606 610 612 613 614 620 621 622 623 641 642 647 672 673 712 713 718"
+MAP_LIST_D1="209 724 658 489 606 610 612 613 614 620 621"
+MAP_LIST_D2="169 575 603 309 574 30 564 568 622 623 641 642 647 672 673 712 713 718"
+MAP_LIST_D3="530 593 594 596 597 605"
+
+badParam()
+{
+ echo "ERROR! Bad arguments!"
+ echo "You can (re)extract mmaps with this helper script,"
+ echo "or recreate only the tiles from the offmash file"
+ echo
+ echo "Call with number of processes (1 - 4) to create mmaps"
+ echo "Call with 'offmesh' to reextract the tiles from offmash file"
+ echo
+ echo "For further fine-tuning edit this helper script"
+ echo
+}
+
+if [ "$#" = "3" ]
+then
+ LOG_FILE=$2
+ DETAIL_LOG_FILE=$3
+elif [ "$#" = "2" ]
+then
+ LOG_FILE=$2
+fi
+
+# Offmesh file provided?
+OFFMESH=""
+if [ "$OFFMESH_FILE" != "" ]
+then
+ if [ ! -f "$OFFMESH_FILE" ]
+ then
+ echo "ERROR! Offmesh file $OFFMESH_FILE could not be found."
+ echo "Provide valid file or none. You need to edit the script"
+ exit 1
+ else
+ OFFMESH="--offMeshInput $OFFMESH_FILE"
+ fi
+fi
+
+# Function to process a list
+createMMaps()
+{
+ for i in $@
+ do
+ for j in $EXCLUDE_MAPS
+ do
+ if [ "$i" = "$j" ]
+ then
+ continue 2
+ fi
+ done
+ ./MoveMapGen $PARAMS $OFFMESH $i | tee -a $DETAIL_LOG_FILE
+ echo "`date`: (Re)created map $i" | tee -a $LOG_FILE
+ done
+}
+
+createHeader()
+{
+ echo "`date`: Start creating MoveMaps" | tee -a $LOG_FILE
+ echo "Used params: $PARAMS $OFFMESH" | tee -a $LOG_FILE
+ echo "Detailed log can be found in $DETAIL_LOG_FILE" | tee -a $LOG_FILE
+ echo "Start creating MoveMaps" | tee -a $DETAIL_LOG_FILE
+ echo
+ echo "Be PATIENT - This will take a long time and might also have gaps between visible changes on the console."
+ echo "WAIT until you are informed that 'creating MoveMaps' is 'finished'!"
+}
+
+# Create mmaps directory if not exist
+if [ ! -d mmaps ]
+then
+ mkdir mmaps
+fi
+
+# Param control
+case "$1" in
+ "1" )
+ createHeader $1
+ createMMaps $MAP_LIST_A $MAP_LIST_B $MAP_LIST_C $MAP_LIST_D &
+ ;;
+ "2" )
+ createHeader $1
+ createMMaps $MAP_LIST_A $MAP_LIST_D &
+ createMMaps $MAP_LIST_B $MAP_LIST_C &
+ ;;
+ "3" )
+ createHeader $1
+ createMMaps $MAP_LIST_A $MAP_LIST_D1&
+ createMMaps $MAP_LIST_B $MAP_LIST_D2&
+ createMMaps $MAP_LIST_C $MAP_LIST_D3&
+ ;;
+ "4" )
+ createHeader $1
+ createMMaps $MAP_LIST_A &
+ createMMaps $MAP_LIST_B &
+ createMMaps $MAP_LIST_C &
+ createMMaps $MAP_LIST_D &
+ ;;
+ "offmesh" )
+ echo "`date`: Recreate offmeshs from file $OFFMESH_FILE" | tee -a $LOG_FILE
+ echo "Recreate offmeshs from file $OFFMESH_FILE" | tee -a $DETAIL_LOG_FILE
+ while read map tile line
+ do
+ ./movement_extractor $PARAMS $OFFMESH $map --tile $tile | tee -a $DETAIL_LOG_FILE
+ echo "`date`: Recreated $map $tile from $OFFMESH_FILE" | tee -a $LOG_FILE
+ done < $OFFMESH_FILE &
+ ;;
+ * )
+ badParam
+ exit 1
+ ;;
+esac
+
+wait
+
+echo | tee -a $LOG_FILE
+echo | tee -a $DETAIL_LOG_FILE
+echo "`date`: Finished creating MoveMaps" | tee -a $LOG_FILE
+echo "`date`: Finished creating MoveMaps" >> $DETAIL_LOG_FILE