Advertisement
Guest User

Untitled

a guest
Jul 26th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.27 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # This file is part of the CMaNGOS Project. See AUTHORS file for Copyright information
  4. #
  5. # This file is free software; as a special exception the author gives
  6. # unlimited permission to copy and/or distribute it, with or without
  7. # modifications, as long as this notice is preserved.
  8. #
  9. # This program is distributed in the hope that it will be useful, but
  10. # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
  11. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12.  
  13. ## Expected param 1 to be 'a' for all, else ask some questions
  14.  
  15. ## Normal log file (if not overwritten by second param
  16. LOG_FILE="MaNGOSExtractor.log"
  17. ## Detailed log file
  18. DETAIL_LOG_FILE="MaNGOSExtractor_detailed.log"
  19.  
  20. ## Change this to a value fitting for your sys!
  21. NUM_CPU="4"
  22.  
  23. ## ! Use below only for finetuning or if you know what you are doing !
  24.  
  25. USE_AD="0"
  26. USE_VMAPS="0"
  27. USE_MMAPS="0"
  28. USE_MMAPS_OFFMESH="0"
  29. USE_MMAPS_DELAY=""
  30.  
  31. if [ "$1" = "a" ]
  32. then
  33. ## extract all
  34. USE_AD="1"
  35. USE_VMAPS="1"
  36. USE_MMAPS="1"
  37. USE_MMAPS_DELAY="no"
  38. else
  39. ## do some questioning!
  40. echo
  41. echo "Welcome to helper script to extract required dataz for MaNGOS!"
  42. echo "Should all dataz (dbc, maps, vmaps and mmaps be extracted? (y/n)"
  43. read line
  44. if [ "$line" = "y" ]
  45. then
  46. ## extract all
  47. USE_AD="1"
  48. USE_VMAPS="1"
  49. USE_MMAPS="1"
  50. else
  51. echo
  52. echo "Should dbc and maps be extracted? (y/n)"
  53. read line
  54. if [ "$line" = "y" ]; then USE_AD="1"; fi
  55.  
  56. echo
  57. echo "Should vmaps be extracted? (y/n)"
  58. read line
  59. if [ "$line" = "y" ]; then USE_VMAPS="1"; fi
  60.  
  61. echo
  62. echo "Should mmaps be extracted? (y/n)"
  63. echo "WARNING! This will take several hours! (you can later tell to start delayed)"
  64. read line
  65. if [ "$line" = "y" ]
  66. then
  67. USE_MMAPS="1";
  68. else
  69. echo "Only reextract offmesh tiles for mmaps?"
  70. read line
  71. if [ "$line" = "y" ]
  72. then
  73. USE_MMAPS_OFFMESH="1";
  74. fi
  75. fi
  76. fi
  77. fi
  78.  
  79. ## Special case: Only reextract offmesh tiles
  80. if [ "$USE_MMAPS_OFFMESH" = "1" ]
  81. then
  82. echo "Only extracting offmesh meshes"
  83. MoveMapGen.sh offmesh $LOG_FILE $DETAIL_LOG_FILE
  84. exit 0
  85. fi
  86.  
  87. ## MMap Extraction specific
  88. if [ "$USE_MMAPS" = "1" ]
  89. then
  90. ## Obtain number ob processes
  91. echo "How many CPUs should be used for extracting mmaps? (1-4)"
  92. read line
  93. echo
  94. if [ "$line" -ge "1" -a "$line" -le "4" ]
  95. then
  96. NUM_CPU=$line
  97. else
  98. echo "Only number between 1 and 4 supported!"
  99. exit 1
  100. fi
  101. ## Extract MMaps delayed?
  102. if [ "$USE_MMAPS_DELAY" != "no" ]; then
  103. echo "MMap extraction can be started delayed"
  104. echo "If you do _not_ want MMap Extraction to start delayed, just press return"
  105. echo "Else enter number followed by s for seconds, m for minutes, h for hours"
  106. echo "Example: \"3h\" - will start mmap extraction in 3 hours"
  107. read -p"MMap Extraction Delay (leave blank for direct extraction): " USE_MMAPS_DELAY
  108. echo
  109. else
  110. USE_MMAPS_DELAY=""
  111. fi
  112. fi
  113.  
  114. ## Give some status
  115. echo "Current Settings: Extract DBCs/maps: $USE_AD, Extract vmaps: $USE_VMAPS, Extract mmaps: $USE_MMAPS on $NUM_CPU processes"
  116. if [ "$USE_MMAPS_DELAY" != "" ]; then
  117. echo "MMap Extraction will be started delayed by $USE_MMAPS_DELAY"
  118. fi
  119. echo
  120. if [ "$1" != "a" ]
  121. then
  122. echo "If you don't like this settings, interrupt with CTRL+C"
  123. read line
  124. fi
  125.  
  126. echo "`date`: Start extracting dataz for MaNGOS" | tee $LOG_FILE
  127.  
  128. ## Handle log messages
  129. if [ "$USE_AD" = "1" ];
  130. then
  131. echo "DBC and map files will be extracted" | tee -a $LOG_FILE
  132. else
  133. echo "DBC and map files won't be extracted!" | tee -a $LOG_FILE
  134. fi
  135. if [ "$USE_VMAPS" = "1" ]
  136. then
  137. echo "Vmaps will be extracted" | tee -a $LOG_FILE
  138. else
  139. echo "Vmaps won't be extracted!" | tee -a $LOG_FILE
  140. fi
  141. if [ "$USE_MMAPS" = "1" ]
  142. then
  143. echo "Mmaps will be extracted with $NUM_CPU processes" | tee -a $LOG_FILE
  144. else
  145. echo "Mmaps files won't be extracted!" | tee -a $LOG_FILE
  146. fi
  147. echo | tee -a $LOG_FILE
  148.  
  149. echo "`date`: Start extracting dataz for MaNGOS, DBCs/maps $USE_AD, vmaps $USE_VMAPS, mmaps $USE_MMAPS on $NUM_CPU processes" | tee $DETAIL_LOG_FILE
  150. echo | tee -a $DETAIL_LOG_FILE
  151.  
  152. ## Extract dbcs and maps
  153. if [ "$USE_AD" = "1" ]
  154. then
  155. echo "`date`: Start extraction of DBCs and map files..." | tee -a $LOG_FILE
  156. ./ad | tee -a $DETAIL_LOG_FILE
  157. echo "`date`: Extracting of DBCs and map files finished" | tee -a $LOG_FILE
  158. echo | tee -a $LOG_FILE
  159. echo | tee -a $DETAIL_LOG_FILE
  160. fi
  161.  
  162. ## Extract vmaps
  163. if [ "$USE_VMAPS" = "1" ]
  164. then
  165. echo "`date`: Start extraction of vmaps..." | tee -a $LOG_FILE
  166. ./vmapExtractor | tee -a $DETAIL_LOG_FILE
  167. echo "`date`: Extracting of vmaps finished" | tee -a $LOG_FILE
  168. mkdir vmaps
  169. echo "`date`: Start assembling of vmaps..." | tee -a $LOG_FILE
  170. ./vmap_assembler Buildings vmaps | tee -a $DETAIL_LOG_FILE
  171. echo "`date`: Assembling of vmaps finished" | tee -a $LOG_FILE
  172.  
  173. echo | tee -a $LOG_FILE
  174. echo | tee -a $DETAIL_LOG_FILE
  175. fi
  176.  
  177. ## Extract mmaps
  178. if [ "$USE_MMAPS" = "1" ]
  179. then
  180. if [ "$USE_MMAPS_DELAY" != "" ]; then
  181. echo "Extracting of MMaps is set to be started delayed by $USE_MMAPS_DELAY"
  182. echo "Current time: $(date)"
  183. sleep $USE_MMAPS_DELAY
  184. fi
  185. sh MoveMapGen.sh $NUM_CPU $LOG_FILE $DETAIL_LOG_FILE
  186. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement