Skip to content

Instantly share code, notes, and snippets.

@x1nixmzeng
Created April 9, 2016 15:21
Show Gist options
  • Save x1nixmzeng/f027dc3a3fe7e1936d86bc7c87812fcf to your computer and use it in GitHub Desktop.
Save x1nixmzeng/f027dc3a3fe7e1936d86bc7c87812fcf to your computer and use it in GitHub Desktop.
Soul Worker Update Checker
#!/usr/bin/env python
import io
import urllib
import zipfile
import ConfigParser
import datetime
# constants
sw_base = "http://down.hangame.co.jp/jp/purple/plii/j_sw/"
sw_update = sw_base + "j_sw_m.xml"
sw_server_ini = "ServerVer.ini"
sw_version = sw_base + sw_server_ini + ".zip"
# set user-agent
class PurpleAgent(urllib.FancyURLopener):
version = "purple"
urllib._urlopener = PurpleAgent()
#
print "Soul Worker Update Status"
print "----------------------------------------------------"
# get config xml
#urllib.urlretrieve (sw_update, "update.xml")
# returns 3 files we need to patch on opening the launcher:
# <rpc>
# <OnFirstUIAfter>
# <download>
# <item path="$(gamefolder)" version="1.0.0.0" overwrite="always">ServerVer.ini</item>
# these are zip files "item.zip"
# download new data
# turple of temporay filename and headers
tmp = urllib.urlretrieve (sw_version)
myzip = zipfile.ZipFile(tmp[0], 'r')
# get version info:
config = ConfigParser.RawConfigParser()
# hack around patchy unicode support in python 2.6
data = myzip.read(sw_server_ini).translate(None, "\0")
config.readfp(io.BytesIO(data))
print "Latest version is ", config.get('Client', 'ver')
# last modified:
info = myzip.getinfo(sw_server_ini)
print "Updated: ", datetime.datetime(*info.date_time)
print "----------------------------------------------------"
myzip.close()
@x1nixmzeng
Copy link
Author

@ulkyome The game moved from Hangame to WeMade Online so this no longer works 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment