This repository has been archived by the owner on Apr 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
WorldUpdate.py
77 lines (49 loc) · 1.71 KB
/
WorldUpdate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Copyright (C) 2004-2007 Prairie Games, Inc
# Please see LICENSE.TXT for details
#world update script
import imp, os, sys
from mud.gamesettings import *
def main_is_frozen():
return (hasattr(sys, "frozen") or # new py2exe
hasattr(sys, "importers") # old py2exe
or imp.is_frozen("__main__")) # tools/freeze
if main_is_frozen():
#maindir = get_main_dir()
if sys.platform[:6] == 'darwin':
#need to go up three folders
os.chdir("../../../mom")
maindir = os.getcwd()
else:
os.chdir("../common")
maindir = os.getcwd()
sys.path.append(maindir)
print "\n\n-------------------------------------"
print "Solinia Online World Updater v .01a"
print "-------------------------------------"
mode = False
world = ""
try:
index = 1
if ".py" in sys.argv[1].lower():
index = 2
if sys.argv[index].lower()=="single":
mode = "singleplayer"
elif sys.argv[index].lower()=="multi":
mode = "multiplayer"
else:
raise "error"
#case?
worldname = sys.argv[index+1]
except:
#traceback.print_exception(sys.exc_info()[0],sys.exc_info()[1],sys.exc_info()[2])
print "Usage: WorldUpdate single|multi worldname"
sys.exit()
print "Updating World: %s"%worldname
#backup in case something goes wrong
wpath = "%s/%s/data/worlds/%s/%s/world.db"%(os.getcwd(),GAMEROOT,mode,worldname)
basepath = "%s/%s/data/worlds/multiplayer.baseline/world.db"%(os.getcwd(),GAMEROOT)
from mud.world.worldupdate import WorldUpdate
if WorldUpdate(wpath,basepath,False,True):
print "Error Updating World"
else:
print "World Updated"