18 nam = self.docked_un.getName()
19 VS.IOmessage(0,
'game',
'news',self.callsign+
' has docked to the '+nam)
20 VS.IOmessage(0,
'game',
'all',self.callsign+
' has docked to the '+nam)
28 if not self.docked_un:
29 print 'Base for'+self.callsign+
'blew up!'
33 nam = self.docked_un.getName()
36 VS.IOmessage(0,
'game',
'news',self.callsign+
' has undocked from the '+nam)
37 VS.IOmessage(0,
'game',
'all',self.callsign+
' has undocked from the '+nam)
42 self.sendMessage(
'Welcome, '+self.callsign+
' to the server.')
46 self.player_num=self.current_un.isPlayerStarship()
49 from trading
import trading
50 from random_encounters
import random_encounters
51 import dynamic_universe
61 if (self.loopnum % 10000) == 0:
66 return callsign.lower().
replace(
' ',
'_')
70 donor = srv.getPlayer(VS.getCurrentPlayer())
71 plrcreds = player.current_un.getCredits()
77 player.current_un.setCredits(plrcreds-amt)
80 if Director.getSaveDataLength(0,
"bounty_"+callsign) < 1:
81 Director.pushSaveData(0,
"bounty_"+callsign, amt)
83 oldamt = Director.getSaveData(0,
"bounty_"+callsign,0)
84 Director.putSaveData(0,
"bounty_"+callsign,0,amt+oldamt)
88 "help": (0,
"/help [command]",
"Gives a list of commands or describes one."),
89 "write": (1,
"/write callsign text...",
"Gives a personal message to callsign."),
90 "userlist": (0,
"/userlist",
"Lists users in this starsystem"),
93 "shiplist": (1,
"/shiplist pagenum",
"Lists all the ships available"),
94 "launchme": (1,
"/launchme ship [faction] [quantity]",
"Launches a ship around yourself"),
95 "launchtarg": (1,
"/launchtarg ship [faction] [quantity]",
"Launches a ship around your computer target"),
96 "launch": (2,
"/launch ship aroundship [faction] [quantity]",
"Launches a ship around 'aroundship'"),
97 "reload": (0,
"/reload",
"Reloads the server_lib.py file"),
98 "setadmin": (2,
"/setadmin callsign level",
"Sets player either to have 1"),
102 "message":
"write",
"whisper":
"write",
104 "info":
"help",
"?":
"help",
109 if command
in aliasinfo:
110 command = aliasinfo[command]
112 if auth>=1
and command
in authcommandinfo:
113 cmdinfo = authcommandinfo[command]
114 elif command
in commandinfo:
115 cmdinfo = commandinfo[command]
119 if command
in aliasinfo:
120 command = aliasinfo[command]
122 if auth<1
and command
in authcommandinfo:
123 player.sendMessage(
"#884400You must be authorized to use "+command)
130 cmdstr =
'#8800cc'+
' '.
join(commandinfo)
132 cmdstr +=
'#cc0088 '+
' '.
join(authcommandinfo)
133 player.sendMessage(
'#888800Valid commands: '+cmdstr)
136 if cmdinfo
and len(cmdinfo)>=3:
137 player.sendMessage(
"#888800Usage: #880088"+cmdinfo[1]+
"#888800 - "+cmdinfo[2])
139 player.sendMessage(
"#884400/"+args[0]+
" does not exist. Use /help for a list of commands.")
140 elif command==
'reload':
144 reload(__import__(
'server_lib'))
145 vsmod.IOmessage(0,
"game",
"all",
"The server python script has been reloaded.")
146 elif command==
'userlist':
147 cstr =
'#44cc44Users on the server:#888800'
153 cstr +=
' '+x.callsign
154 player.sendMessage(cstr)
155 elif command==
'shipinfo':
159 if Director.getSaveDataLength(0,
"bounty_"+callsign):
160 amt = Director.getSaveData(0,
"bounty_"+callsign,0)
162 response.append(
"WANTED for %g credits!"%amt)
164 response.append(
"* Artifically Intelligent *")
169 player.sendMessage(msg)
170 elif command==
'shiplist':
177 cstr =
'#44cc44Available ships (#888800'+
str(page)+
'#44cc44):#888800'
186 shiplist=faction_ships.stattableexp.keys()
190 if cnt>=min
and cnt<max:
192 player.sendMessage(cstr)
193 elif command==
'launcheach':
196 shiplist = faction_ships.stattableexp.keys()
199 elif command==
'setadmin':
207 player.sendMessage(
"#884400Cannot find player "+args[0])
211 if args[1]==
'yes' or args[1]==
'1':
213 pnum=playerto.player_num
214 if Director.getSaveDataLength(pnum,
'serveradmin')<1:
215 Director.pushSaveData(pnum,
'serveradmin', value)
217 Director.putSaveData(pnum,
'serveradmin', 0, value)
218 playerto.sendMessage(
"Your admin status set to "+
str(value))
219 elif command==
'write':
224 player.sendMessage(
"#884400Cannot find player "+args[0])
226 playerto.sendMessage(
' '.
join(args[1:]), player.callsign)
227 player.sendMessage(
'Message to '+args[0]+
': '+(
' '.
join(args[1:])))
229 VS.IOmessage(0, player.callsign,
'all',
' '.
join(args))
230 elif command==
'launchme' or command==
'launchtarg' or command==
'launch':
236 if command==
"launchtarg" or command==
"launchme":
237 if not player.current_un:
238 player.sendMessage(
"#884400Use /launch <unit> <aroundname> to launch when you are null.")
241 factquan=(args[1],args[2])
244 targun = player.current_un
245 if command==
"launchtarg":
246 metarg=targun.GetTarget()
254 factquan=(args[2],args[3])
257 targunname = args[1].
lower()
258 iter = VS.getUnitList()
259 while iter.notDone():
260 targun=iter.current()
261 if targun.getName().
lower()==targunname:
263 if targun.getFullname().
lower()==targunname:
266 faction = targun.getFactionName()