Jump to content

mt2meleb - make a maps data list with shell script


Recommended Posts

sorry my english.

let´s program!

access your file server with PUTTY;

and access the maps folder. something like '/root/metin2/srv1/share/locale/germany/map'.

cd /root/metin2/srv1/share/locale/germany/map

now... create a file named 'datamaps.sh'.

edit datamaps.sh

the file must contain the content below:

#!/bin/sh
gecho () { echo -e "\033[32m$1\033[0m"; }
cecho () { echo -e "\033[36m$1\033[0m"; }

echo "CH	INDEX	MAP_FOLDER	WARP	X	Y" >LISTARGEM_WARP.TXT

clear 
echo "Script writed by Helio Galvão [Meleb.Net] - Gerar dados dos Mapas"
cecho "Aguarde. Gerando lista de informações dos Mapas..."

for map in $(find . -maxdepth 1 -mindepth 1 -type d | awk '{print substr ($1, 3, 100)}' | awk '{print $1} ')
do
replace=warp
index=$(cat index | grep -w $map | awk '{print $1}')
mapa=$(cat index | grep -w $map | awk '{print $2}')
warp=$(cat $map/Setting.txt | grep BasePosition | sed "s/BasePosition/${replace}/Ig")
if [ -z "$index" ]; then
	index=0
fi

achou=$(cat /root/metin2/srv1/share/conf/CONFIG_CH1_1 | grep -i MAP_ALLOW | grep -w $index )
if [ -n "$achou" ]; then	
	chans=$(echo "[CH1_1]")
fi
achou=$(cat /root/metin2/srv1/share/conf/CONFIG_CH1_2 | grep -i MAP_ALLOW | grep -w $index )
if [ -n "$achou" ]; then	
	chans=$(echo "$chans[CH1_2]")
fi
achou=$(cat /root/metin2/srv1/share/conf/CONFIG_CH1_3 | grep -i MAP_ALLOW | grep -w $index )
if [ -n "$achou" ]; then	
	chans=$(echo "$chans[CH1_3]")
fi
achou=$(cat /root/metin2/srv1/share/conf/CONFIG_CH2_1 | grep -i MAP_ALLOW | grep -w $index )
if [ -n "$achou" ]; then	
	chans=$(echo "$chans[CH2_1]")
fi
achou=$(cat /root/metin2/srv1/share/conf/CONFIG_CH2_2 | grep -i MAP_ALLOW | grep -w $index )
if [ -n "$achou" ]; then	
	chans=$(echo "$chans[CH2_2]")
fi
achou=$(cat /root/metin2/srv1/share/conf/CONFIG_CH99 | grep -i MAP_ALLOW | grep -w $index )
if [ -n "$achou" ]; then	
	chans=$(echo "$chans[CH_99]")
fi
if [ -z "$chans" ]; then	
	chans=[NONE]
fi
if [ -z "$warp" ]; then	
	warp="warp	0	0"
fi

echo "$chans	$index	$map	$warp" >>LISTARGEM_WARP.TXT
chans=
achou=
warp=
done

cat LISTARGEM_WARP.TXT

echo "-------------------------------------"
gecho "LISTARGEM_WARP.TXT foi Gerado."
cecho "Abra o arquivo para consultar as coordenadas dos mapas"
cecho "bem como seus index e em quais canais estão instalados."
echo "**Você pode importar para uma planilha se preferir."
echo ""

 

Note: change paths similar to '/root/metin2/srv1/share/conf/CONFIG_CH1_1' to paths with your CONFIGURATION FILES.

 

set the permission for it

chmod 774 datamaps.sh

 

execute.

./datamaps.sh

 

a new one will be generated containing information from the maps, such as:
* coordinates: values to use in /warp commands;
* index: identification of the map within the system;
* active channels: on which CH the map is enabled.

 

Below is an example of the generated file. Very useful to consult and assist in testing.

CHANNEL	INDEX	MAP_FOLDER	WARP	X	Y
[NONE]	0	metin2_map_siege_01	warp	102400	332800
[CH1_2]	217	metin2_map_spiderdungeon_03	warp	51200	563200
[NONE]	0	metin2_map_sungzi_snow_pass01	warp	1177600	102400
[NONE]	0	metin2_map_battlearena03	warp	768000	230400
[CH_99]	105	metin2_map_t2	warp	6400	0
[CH1_1][CH2_1][CH2_2]	21	metin2_map_b1	warp	0	102400
[NONE]	0	metin2_map_sungzi_snow_pass02	warp	1177600	204800
[CH1_3][CH2_2]	66	metin2_map_deviltower1	warp	204800	665600
[CH2_2]	101	metin2_map_resources_zon	warp	3200000	51200
[NONE]	0	metin2_map_n_desert_02	warp	307200	1049600
[CH2_2][CH_99]	103	metin2_map_t1	warp	0	25600
[NONE]	0	metin2_map_n_flame_01	warp	588800	614400
[CH1_2]	7	metin2_map_b2	warp	955100	955100
[CH1_3]	351	metin2_map_n_flame_dungeon_01	warp	742400	614400
[NONE]	0	metin2_map_holyplace_ice	warp	1484800	0

 

Note: [NONE] These are maps that have not been installed but the folder exists.

 

thank you guys!
any doubts, ask!

 

 

  • Good 4
Link to comment
Share on other sites

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.