# How to push updates
# BronzeEagle

# anything with a leading # is a comment.

### PACKAGES ###
You're going to need apache2 or nginx(I would recommend apache2 for the starter guys), you will also need gcc,for later use git-core, and lastly filezilla (if your server is not local)
$ sudo apt-get install apache2 gcc git-core filezilla

Now you want to go ahead and make your updates folder after that installs so
$ sudo mkdir /var/www/updates

### TIPS ###
I find it useful to have an organized, local updates folder
In the folder have the following files and folders:
archives/
adler32.c
adler32
news.txt
resources.xml
resources2.txt # for the older clients :x

### ZIPPING YOUR UPDATES ###

	### DOWNLOADING THE UPDATES ###
	Now that we have git installed you want to clone the client-data
	$ git clone git:github.com/themanaworld/tmwa-client-data.git
	### FINISHED ###

once you have the main updates (the entire graphics folder, maps, etc) you don't have to re-upload the whole thing just the new content
so if you have new update from XML run the following command:

this will pack all the xml files into their own zip
$ zip -r xml-update-with-the-name-of-your-choice.zip ea-skills.xml effects.xml emotes.xml hair.xml items.xml monsters.xml npcs.xml paths.xml skills.xml status-effects.xml

(where it says update-with-the-name-of-your-choice.zip replace with the name you prefer)

if you have updates for graphics do the following command:

$ zip -r update-with-the-name-of-your-choice.zip.zip graphics/

Make sure you follow this step for graphics, maps, sfx, and the XML!!!
### HASHING YOUR UPDATES ###

	### COMPILING ADLER32 ###
	Note you only have to compile adler32 once so after you do it you never need to do this step again
	cd ~/updates
	$ gcc adler32.c -lz -o adler32
	
	Thats it it's compiled
	### FINISHED ##

now when hashing your updates you need to run the following command:
Make sure you change directories to where the adler32 program is
$ ./adler32 nameofyourupdates.zip >> resources2.txt
do this step till all your compressed files are zipped.

### UPLOADING THE UPDATES ###
Using filezilla connect to the server
upload the zip files to the /var/www/updates/
then open terminal and SSH to the server and edit /var/www/updates/resources2.txt and /var/www/updates/resources.xml with the new hash(es)
save the files and when you're down restart the map server!

### Congrats you've completed the updating process ###

### FINAL NOTES ###
MAKE SURE you point your TMW server at the new update host ! ! !

Make sure when you do this, on your local updates folder move the .zips to the archives folder just so you have backups if the current server farts away all data
also if you break the server - don't worry just try and revert the changes and if that doesn't work let me know. Nothing bad has happened you probably just fed it bad data :)

Have fun!!!
