comparison plugins/xxheroinit.py @ 167:5c9a118476b2 alpha

Traipse Alpha 'OpenRPG' {091210-00} Traipse is a distribution of OpenRPG that is designed to be easy to setup and go. Traipse also makes it easy for developers to work on code without fear of sacrifice. 'Ornery-Orc' continues the trend of 'Grumpy' and adds fixes to the code. 'Ornery-Orc's main goal is to offer more advanced features and enhance the productivity of the user. Update Summary (Keeping up with Beta) New Features: Added Bookmarks Added 'boot' command to remote admin Added confirmation window for sent nodes Minor changes to allow for portability to an OpenSUSE linux OS Miniatures Layer pop up box allows users to turn off Mini labels, from FlexiRPG Zoom Mouse plugin added Images added to Plugin UI Switching to Element Tree Map efficiency, from FlexiRPG Added Status Bar to Update Manager New TrueDebug Class in orpg_log (See documentation for usage) Portable Mercurial Tip of the Day added, from Core and community New Reference Syntax added for custom PC sheets New Child Reference for gametree New Parent Reference for gametree New Gametree Recursion method, mapping, context sensitivity, and effeciency.. New Features node with bonus nodes and Node Referencing help added Dieroller structure from Core Added 7th Sea die roller method; ie [7k3] = [7d10.takeHighest(3).open(10)] New 'Mythos' System die roller added Added new vs. die roller method for WoD; ie [3v3] = [3d10.vs(3)]. Includes support for Mythos roller Fixes: Fix to Text based Server Fix to Remote Admin Commands Fix to Pretty Print, from Core Fix to Splitter Nodes not being created Fix to massive amounts of images loading, from Core Fix to Map from gametree not showing to all clients Fix to gametree about menus Fix to Password Manager check on startup Fix to PC Sheets from tool nodes. They now use the tabber_panel Fixed Whiteboard ID to prevent random line or text deleting. Modified ID's to prevent non updated clients from ruining the fix. default_manifest.xml renamed to default_upmana.xml Fix to Update Manager; cleaner clode for saved repositories Fixes made to Settings Panel and no reactive settings when Ok is pressed Fixes to Alternity roller's attack roll. Uses a simple Tuple instead of a Splice
author sirebral
date Thu, 10 Dec 2009 10:53:33 -0600
parents c54768cffbd4
children
comparison
equal deleted inserted replaced
166:eef2463cd441 167:5c9a118476b2
9 def __init__(self, plugindb, parent): 9 def __init__(self, plugindb, parent):
10 orpg.pluginhandler.PluginHandler.__init__(self, plugindb, parent) 10 orpg.pluginhandler.PluginHandler.__init__(self, plugindb, parent)
11 11
12 # The Following code should be edited to contain the proper information 12 # The Following code should be edited to contain the proper information
13 self.name = 'Hero Turn Tool' 13 self.name = 'Hero Turn Tool'
14 self.author = 'Heroman, based on xxxinit.py' 14 self.author = 'Heroman, based on xxxinit.py\n'
15 self.help = """This is the Hero Games turn turn. It is a bit more complex than other games.""" 15 self.author = 'debugged for Traipse by Prof. Ebral'
16 self.help = """This is the Hero Games turn tool. It is a bit more complex than other games."""
16 17
17 18
18 def plugin_enabled(self): 19 def plugin_enabled(self):
19 #You can add new /commands like
20 # self.plugin_addcommand(cmd, function, helptext)
21 self.plugin_addcommand('/hinit', self.on_hinit, '- Toggle Init Recording on or off') 20 self.plugin_addcommand('/hinit', self.on_hinit, '- Toggle Init Recording on or off')
22 self.plugin_addcommand('/hhelp', self.on_hhelp, '- List all of the Hero Init Commands') 21 self.plugin_addcommand('/hhelp', self.on_hhelp, '- List all of the Hero Init Commands')
23 self.plugin_addcommand('/hstart', self.on_hstart, '- Start the Hero Init Tool', False) 22 self.plugin_addcommand('/hstart', self.on_hstart, '- Start the Hero Init Tool', False)
24 self.plugin_addcommand('/hact', self.on_hact, '- Start the Hero Init Tool', False) 23 self.plugin_addcommand('/hact', self.on_hact, '- Start the Hero Init Tool', False)
25 self.plugin_addcommand('/hseg', self.on_hseg, '- Start the Hero Init Tool', False) 24 self.plugin_addcommand('/hseg', self.on_hseg, '- Start the Hero Init Tool', False)
49 self.toggle = True 48 self.toggle = True
50 self.init_list = [] 49 self.init_list = []
51 self.backup_list = [] 50 self.backup_list = []
52 self.dexterity = 99 51 self.dexterity = 99
53 self.segment = 12 52 self.segment = 12
54 self.state_strings = ["0 Phase","1/2 Phase","Full Phase","Stunned","Not Gone", "Held Full", "Held Half", "Abort"] 53 self.state_strings = ["0 Phase",
54 "1/2 Phase",
55 "Full Phase",
56 "Stunned",
57 "Not Gone",
58 "Held Full", "Held Half", "Abort"]
55 59
56 def plugin_disabled(self): 60 def plugin_disabled(self):
57 #Here you need to remove any commands you added, and anything else you want to happen when you disable the plugin 61 self.plugin_removecmd('/hinit')
58 #such as closing windows created by the plugin 62 self.plugin_removecmd('/hhelp')
59 self.plugin_removecmd('/test') 63 self.plugin_removecmd('/hstart')
60 self.plugin_removecmd('/example') 64 self.plugin_removecmd('/hact')
61 65 self.plugin_removecmd('/hseg')
62 #This is the command to delete a message handler 66 self.plugin_removecmd('/hdex')
63 self.plugin_delete_msg_handler('xxblank') 67 self.plugin_removecmd('/hclear')
64 68 self.plugin_removecmd('/hadd')
65 #This is how you should destroy a frame when the plugin is disabled 69 self.plugin_removecmd('/hdel')
66 #This same method should be used in close_module as well 70 self.plugin_removecmd('/hown')
67 try: 71 self.plugin_removecmd('/hlist')
68 self.frame.Destroy() 72 self.plugin_removecmd('/hsort')
69 except: 73 self.plugin_removecmd('/hrun')
70 pass 74 self.plugin_removecmd('/hchange')
75 self.plugin_removecmd('/hset')
76 self.plugin_removecmd('/hchange')
77
78 try: self.frame.Destroy()
79 except: pass
71 80
72 def plugin_incoming_msg(self, text, type, name, player): 81 def plugin_incoming_msg(self, text, type, name, player):
73 #This is called whenever a message from someone else is received, no matter
74 #what type of message it is.
75 #The text variable is the text of the message. If the type is a regular
76 #message, it is already formatted. Otherwise, it's not.
77 #The type variable is an integer which tells you the type: 1=chat, 2=whisper
78 #3=emote, 4=info, and 5=system.
79 #The name variable is the name of the player who sent you the message.
80 #The player variable contains lots of info about the player sending the
81 #message, including name, ID#, and currently-set role.
82 #Uncomment the following line to see the format for the player variable.
83 #print player
84 82
85 if self.toggle: 83 if self.toggle:
86 if text.lower().find("heroinit") != -1: 84 if text.lower().find("heroinit") != -1:
87 command = text[text.rfind("(")+1:text.rfind(")")] 85 command = text[text.rfind("(")+1:text.rfind(")")]
88 self.process_user(command, player) 86 self.process_user(command, player)
89 return text, type, name 87 return text, type, name
90 88
91 #Chat Commands 89 #Chat Commands
92 def on_hinit(self, cmdargs): 90 def on_hinit(self, cmdargs):
93 self.toggle = not self.toggle 91 self.toggle = not self.toggle
94 92 if self.toggle: self.chat.SystemPost("Init recording on. Enter your info")
95 if self.toggle: 93 else: self.chat.SystemPost("Init recording off")
96 self.chat.SystemPost("Init recording on. Enter your info")
97 else:
98 self.chat.SystemPost("Init recording off")
99 94
100 def on_hhelp(self, cmdargs): 95 def on_hhelp(self, cmdargs):
101 self.chat.InfoPost("Commands:<br>/hclear : Clears out list<br>" + 96 self.chat.InfoPost("Commands:<br>/hclear : Clears out list<br>" +
102 "/hstart : Sets you to segment 12, highest dex<br>" + 97 "/hstart : Sets you to segment 12, highest dex<br>" +
103 "/hgo : Proceed to the next DEX/segment<br>" + 98 "/hgo : Proceed to the next DEX/segment<br>" +
123 self.chat.Post("Combat Starting. ") 118 self.chat.Post("Combat Starting. ")
124 self.call_time() 119 self.call_time()
125 120
126 def on_hact(self, cmdargs): 121 def on_hact(self, cmdargs):
127 cmds = cmdargs.split(None) 122 cmds = cmdargs.split(None)
128 123 if len(cmds) == 1: msg = self.do_action(-1, -1, cmds[0])
129 if len(cmds) == 1: 124 elif len(cmds) == 2: msg = self.do_action(-1, int(cmds[0]), cmds[1])
130 msg = self.do_action(-1, -1, cmds[0]) 125 else: msg = "Error in command. See format with hero init"
131 elif len(cmds) == 2:
132 msg = self.do_action(-1, int(cmds[0]), cmds[1])
133 else:
134 msg = "Error in command. See format with hero init"
135
136 self.chat.InfoPost(msg) 126 self.chat.InfoPost(msg)
137 127
138 def on_hseg(self, cmdargs): 128 def on_hseg(self, cmdargs):
139 cmds = cmdargs.split(None, 3) 129 cmds = cmdargs.split(None, 3)
140 130
141 try: 131 try:
142 new_seg = int(cmds[0]) 132 new_seg = int(cmds[0])
143 self.segment = new_seg 133 self.segment = new_seg
144 self.call_time() 134 self.call_time()
145 except: 135 except: self.chat.SystemPost("Invalid format. correct command is: /hseg SEGMENT#")
146 self.chat.SystemPost("Invalid format. correct command is: /hseg SEGMENT#")
147 136
148 def on_hdex(self, cmdargs): 137 def on_hdex(self, cmdargs):
149 cmds = cmdargs.split(None, 3) 138 cmds = cmdargs.split(None, 3)
150 139
151 try: 140 try:
152 new_dex = int(cmds[0]) 141 new_dex = int(cmds[0])
153 self.dexterity = new_dex 142 self.dexterity = new_dex
154 self.call_time() 143 self.call_time()
155 except: 144 except: self.chat.SystemPost("Invalid format. correct command is: /hdex DEX#")
156 self.chat.SystemPost("Invalid format. correct command is: /hdex DEX#")
157 145
158 def on_hclear(self, cmdargs): 146 def on_hclear(self, cmdargs):
159 self.init_list = [] 147 self.init_list = []
160 self.backup_list = [] 148 self.backup_list = []
161 self.dexterity = 99 149 self.dexterity = 99
162 self.segment = 12 150 self.segment = 12
163 self.chat.Post("<hr><font color='#ff0000'>New Initiative</font><br><font color='#0000ff'>Set new Initiatives</font>", True) 151 self.chat.Post("<hr><font color='#ff0000'>New Initiative</font><br><font color='#0000ff'>Set new Initiatives</font>", True)
164 152
165 def on_hadd(self, cmdargs): 153 def on_hadd(self, cmdargs):
154 print cmdargs
166 cmds = cmdargs.split(None, 3) 155 cmds = cmdargs.split(None, 3)
156 print cmds, len(cmds)
167 try: 157 try:
168 if len(cmds) == 3: 158 if len(cmds) == 3:
169 new_dex = int(txt[0]) 159 new_dex = int(cmds[0])
170 new_spd = int(txt[1]) 160 new_spd = int(cmds[1])
171 self.init_list.append([new_dex, new_spd, cmds[2], 0, -1]) 161 self.init_list.append([new_dex, new_spd, cmds[2], 0, -1])
172 self.backup_list.append([new_dex, new_spd, cmds[2], 0, -1]) 162 self.backup_list.append([new_dex, new_spd, cmds[2], 0, -1])
173 self.list_inits() 163 self.list_inits()
174 else: 164 else: self.chat.SystemPost("Invalid format. correct command is: /hadd dex spd description (" + str(len(cmds)) + " arguments give)")
175 self.chat.SystemPost("Invalid format. correct command is: /hadd dex spd description (" + str(len(cmds)) + " arguments give)") 165
176 166 except Exception, e:
177 except: 167 print e
178 self.chat.SystemPost("Invalid format. correct command is: /hadd dex spd description") 168 self.chat.SystemPost("Invalid format. correct command is: /hadd dex spd description")
179 169
180 def on_hdel(self, cmdargs): 170 def on_hdel(self, cmdargs):
181 try: 171 try:
182 cmds = cmdargs.split(None, 1) 172 cmds = cmdargs.split(None, 1)
203 self.backup_list.sort() 193 self.backup_list.sort()
204 194
205 if cmdargs == "high": 195 if cmdargs == "high":
206 self.init_list.reverse() 196 self.init_list.reverse()
207 self.backup_list.reverse() 197 self.backup_list.reverse()
208
209 self.list_inits() 198 self.list_inits()
210 199
211 def on_hrun(self, cmdargs): 200 def on_hrun(self, cmdargs):
212 advance = True 201 advance = True
213 nextlowest = 0 202 nextlowest = 0
214 heldactions = False 203 heldactions = False
215
216 for player in self.init_list: 204 for player in self.init_list:
217 if self.actson(player[1]. self.segment): 205 if self.actson(player[1], self.segment):
218 if player[3] == 5 or player[3] == 6: 206 if player[3] == 5 or player[3] == 6: heltactions = True
219 heltactions = True
220 continue 207 continue
221
222 if player[3] == 1 or player[3] == 2: 208 if player[3] == 1 or player[3] == 2:
223 self.chat.InfoPost("Hero " + player[2] + " needs to act before we advance DEX") 209 self.chat.InfoPost("Hero " + player[2] + " needs to act before we advance DEX")
224 advance = False 210 advance = False
225
226 elif player[3] == 3 or player[3] == 4 or player[3] == 7: 211 elif player[3] == 3 or player[3] == 4 or player[3] == 7:
227 if player[0] > nextlowest: 212 if player[0] > nextlowest: nextlowest = player[0]
228 nextlowest = player[0] 213 elif player[3] == 5 or player[3] == 6: heltactions = True
229
230 elif player[3] == 5 or player[3] == 6:
231 heltactions = True
232
233 if not advance: 214 if not advance:
234 return 215 return
235 216
236 advanceseg = False 217 advanceseg = False
237 218
238 if nextlowest == 0 and self.dexterity != 0: 219 if nextlowest == 0 and self.dexterity != 0:
239 if heldactions or self.segment == 12: 220 if heldactions or self.segment == 12:
240 msg = "End of Segment " + str(self.segment) + "." 221 msg = "End of Segment " + str(self.segment) + "."
241 if heldactions: 222 if heldactions: msg += " There are held actions."
242 msg += " There are held actions."
243
244 msg += " Issue command again to advance to next segment." 223 msg += " Issue command again to advance to next segment."
245
246 self.chat.InfoPost(msg) 224 self.chat.InfoPost(msg)
247 self.dexterity = 0 225 self.dexterity = 0
248 return 226 return
249 else: 227 else: advanceseg = True
250 advanceseg = True 228 elif nextlowest == 0 and self.dexterity == 0:
251 elif nextlowest == 0 and self.dexterify == 0:
252 advanceseg = True 229 advanceseg = True
253 230
254 if advanceseg: 231 if advanceseg:
255 self.dexterity = nextlowest 232 self.dexterity = nextlowest
256 for player in self.init_list: 233 for player in self.init_list:
257 if player[0] == self.dexterity: 234 if player[0] == self.dexterity:
258 if player[3] == 3 or player[3] == 7: 235 if player[3] == 3 or player[3] == 7: player[3] = 0
259 player[3] = 0 236 elif player[3] == 4: player[3] = 2
260 elif player[3] == 4:
261 player[3] = 2
262 else: 237 else:
263 nextsegment = 0 238 nextsegment = 0
264 while nextsegment == 0: 239 while nextsegment == 0:
265 self.segment += 1 240 self.segment += 1
266 if self.segment == 13: 241 if self.segment == 13: self.segment = 1
267 self.segment = 1
268
269 elif self.segment == 12: 242 elif self.segment == 12:
270 nextsegment = 12 243 nextsegment = 12
271 break 244 break
272 245
273 for player in self.init_list: 246 for player in self.init_list:
274 if self.actson(player[1], self.segment): 247 if self.actson(player[1], self.segment):
275 if player[3] == 0 or player[3] == 3 or player[3] == 7: 248 if player[3] == 0 or player[3] == 3 or player[3] == 7: nextsegment = self.segment
276 nextsegment = self.segment 249 if player[3] == 5 or player[3] == 6: nextsegment = self.segment
277
278 if player[3] == 5 or player[3] == 6:
279 nextsegment = self.segment
280 250
281 self.dexterity = self.highestdex() 251 self.dexterity = self.highestdex()
282 for player in self.init_list: 252 for player in self.init_list:
283 heldactions = False 253 heldactions = False
284 if self.actson(player[1], self.segment): 254 if self.actson(player[1], self.segment):
285 if player[3] != 3 and player[3] != 7: 255 if player[3] != 3 and player[3] != 7: player[3] = 4
286 player[3] = 4
287
288 if player[0] == self.dexterity: 256 if player[0] == self.dexterity:
289 if player[3] == 3: 257 if player[3] == 3:
290 self.chat.InfoPost(player[2] + " unstuns.") 258 self.chat.InfoPost(player[2] + " unstuns.")
291 player[3] = 0 259 player[3] = 0
292 elif player[3] == 7: 260 elif player[3] == 7:
293 self.chat.InfoPost(player[2] + " recovers from the abort") 261 self.chat.InfoPost(player[2] + " recovers from the abort")
294 player[3] = 0 262 player[3] = 0
295 else: 263 else: player[3] = 2
296 player[3] = 2
297
298 if player[3] == 5 or player[3] == 6 and self.dexterity == 0: 264 if player[3] == 5 or player[3] == 6 and self.dexterity == 0:
299 self.chat.InfoPost("There are held actions. Issue command again to advance to next segment.") 265 self.chat.InfoPost("There are held actions. Issue command again to advance to next segment.")
300 self.call_time() 266 self.call_time()
301 267
302 def on_hchange(self, cmdargs): 268 def on_hchange(self, cmdargs):
323 #Other Methods 289 #Other Methods
324 def statelist(self): 290 def statelist(self):
325 msg = "" 291 msg = ""
326 stateindex = 0 292 stateindex = 0
327 for state in self.state_strings: 293 for state in self.state_strings:
328 if stateindex != 0: 294 if stateindex != 0: msg += ", "
329 msg += ", "
330 msg += str(stateindex) + "=" + state 295 msg += str(stateindex) + "=" + state
331 stateindex += 1 296 stateindex += 1
332 return msg 297 return msg
333 298
334 def is_index(self, value): 299 def is_index(self, value):
335 try: 300 try:
336 if value[:1] == "+": 301 if value[:1] == "+": offset = 1
337 offset = 1
338 return True 302 return True
339 except: 303 except: return False
340 return False
341 304
342 def actson(self, spd, segment): 305 def actson(self, spd, segment):
343 speeds=[[0,0,0,0,0,0,0,0,0,0,0,1], 306 speeds=[[0,0,0,0,0,0,0,0,0,0,0,1],
344 [0,0,0,0,0,1,0,0,0,0,0,1], 307 [0,0,0,0,0,1,0,0,0,0,0,1],
345 [0,0,0,1,0,0,0,1,0,0,0,1], 308 [0,0,0,1,0,0,0,1,0,0,0,1],
351 [0,1,1,1,0,1,1,1,0,1,1,1], 314 [0,1,1,1,0,1,1,1,0,1,1,1],
352 [0,1,1,1,1,1,0,1,1,1,1,1], 315 [0,1,1,1,1,1,0,1,1,1,1,1],
353 [0,1,1,1,1,1,1,1,1,1,1,1], 316 [0,1,1,1,1,1,1,1,1,1,1,1],
354 [1,1,1,1,1,1,1,1,1,1,1,1]] 317 [1,1,1,1,1,1,1,1,1,1,1,1]]
355 318
356 if spd < 1 or spd > 12: 319 if spd < 1 or spd > 12: return False
357 return False 320 if speeds[spd-1][segment-1] == 1: return True
358
359 if speeds[spd-1][segment-1] == 1:
360 return True
361
362 return False 321 return False
363 322
364 def highestdex(self): 323 def highestdex(self):
365 dex = 0 324 dex = 0
366 for player in self.init_list: 325 for player in self.init_list:
367 if self.actson(player[1], self.segment) and player[0] > dex: 326 if self.actson(player[1], self.segment) and player[0] > dex: dex = player[0]
368 dex = player[0]
369 return dex 327 return dex
370 328
371 def do_action(self, playerid, index, action): 329 def do_action(self, playerid, index, action):
372 if index == -1: 330 if index == -1:
373 count = 1 331 count = 1
374 for player in self.init_list: 332 for player in self.init_list:
375 if player[4] == playerid: 333 if player[4] == playerid: index = count
376 index = count
377 count += 1 334 count += 1
378 335 if index == -1: return "You do not have any players in the combat list"
379 if index == -1:
380 return "You do not have any players in the combat list"
381
382 index -= 1 336 index -= 1
383 player = self.init_list[index] 337 player = self.init_list[index]
384 if playerid != -1 and playerid != player[4]: 338 if playerid != -1 and playerid != player[4]: return "You do not own that player."
385 return "You do not own that player."
386 339
387 # You can only perform a full action if you have a full or held full 340 # You can only perform a full action if you have a full or held full
388 if action == "full": 341 if action == "full":
389 if player[3] != 2 and player[3] != 5: 342 if player[3] != 2 and player[3] != 5: msg = player[2] + " cannot perform a full action."
390 msg = player[2] + " cannot perform a full action."
391 else: 343 else:
392 player[3] = 0 344 player[3] = 0
393 msg = player[2] + " performs a full action." 345 msg = player[2] + " performs a full action."
394 elif action == "half": 346 elif action == "half":
395 if player[3] != 1 and player[3] != 2 and player[3] != 5 and player[3] != 6: 347 if player[3] != 1 and player[3] != 2 and player[3] != 5 and player[3] != 6:
400 msg = player[2] + " performs a half action." 352 msg = player[2] + " performs a half action."
401 else: 353 else:
402 player[3] = 1 354 player[3] = 1
403 msg = player[2] + " performs a half action (half remaining)" 355 msg = player[2] + " performs a half action (half remaining)"
404 elif action == "hold": 356 elif action == "hold":
405 if player[3] != 1 and player[3] != 2: 357 if player[3] != 1 and player[3] != 2: msg = player[2] + " cannot hold an action."
406 msg = player[2] + " cannot hold an action."
407 else: 358 else:
408 if player[3] == 2: 359 if player[3] == 2:
409 player[3] = 5 360 player[3] = 5
410 msg = player[2] + " holding a full action." 361 msg = player[2] + " holding a full action."
411 else: 362 else:
421 msg = player[2] + " aborts!" 372 msg = player[2] + " aborts!"
422 # if you have 0 remaining and did not act this seg, regular abort 373 # if you have 0 remaining and did not act this seg, regular abort
423 elif player[3] == 0 and not self.actson(player[1], self.segment): 374 elif player[3] == 0 and not self.actson(player[1], self.segment):
424 player[3] = 7 375 player[3] = 7
425 msg = player[2] + " aborts!" 376 msg = player[2] + " aborts!"
426 else: 377 else: msg = player[2] + " cannot abort yet."
427 msg = player[2] + " cannot abort yet." 378 else: msg = "Unknown command."
428 else:
429 msg = "Unknown command."
430
431 return msg 379 return msg
432 380
433 def list_inits(self, player=0, send=False): 381 def list_inits(self, player=0, send=False):
434 msg = "Combat Turn:<br>" 382 msg = "Combat Turn:<br>"
435 msg += "<table border=1 cellspacing=1 cellpadding=1><tr><th><th></th></th><th></th><th></th><th></th><th></th><th colspan=12>Segments</th></tr>" 383 msg += "<table border=1 cellspacing=1 cellpadding=1><tr><th><th></th></th><th></th><th></th><th></th><th></th><th colspan=12>Segments</th></tr>"
436 msg += "<tr><th>#</th><th>Owner</th><th>Name</th><th>Spd</th><th>Dex</th><th>State</th>" 384 msg += "<tr><th>#</th><th>Owner</th><th>Name</th><th>Spd</th><th>Dex</th><th>State</th>"
437 for x in xrange(1,13): 385 for x in xrange(1,13): msg += "<th>" + str(x) + "</th>"
438 msg += "<th>" + str(x) + "</th>"
439 msg += "</tr>" 386 msg += "</tr>"
440 count=1 387 count=1
441 for m in self.init_list: 388 for m in self.init_list:
442 msg += "<tr><td align=center>"+str(count)+"</td>" 389 msg += "<tr><td align=center>"+str(count)+"</td>"
443 if m[4]==-1: 390 if m[4]==-1: msg += "<td><font color=red>GM</font></td>"
444 msg += "<td><font color=red>GM</font></td>" 391 else: msg += "<td>" + m[4] + "</td>"
445 else:
446 msg += "<td>" + m[4] + "</td>"
447 msg += "<td><font color='#0000ff'>" + m[2] + "</font></td>" 392 msg += "<td><font color='#0000ff'>" + m[2] + "</font></td>"
448 msg += "<td align=center><font color='#0000ff'>" + str(m[1]) + "</font></td>" 393 msg += "<td align=center><font color='#0000ff'>" + str(m[1]) + "</font></td>"
449 msg += "<td align=center><font color='#0000ff'>" + str(m[0]) + "</font></td>" 394 msg += "<td align=center><font color='#0000ff'>" + str(m[0]) + "</font></td>"
450 msg +="<td>" + self.state_strings[m[3]] + "</td>" 395 msg +="<td>" + self.state_strings[m[3]] + "</td>"
451 396
452 for segment in xrange(1,13): 397 for segment in xrange(1,13):
453 if self.actson(m[1],segment): 398 if self.actson(m[1],segment): msg += "<td align=center>" + str(m[0]) + "</td>"
454 msg += "<td align=center>" + str(m[0]) + "</td>" 399 else: msg += "<td></td>"
455 else:
456 msg += "<td></td>"
457 msg += "</tr>" 400 msg += "</tr>"
458 count += 1 401 count += 1
459 msg += "</table><br>" 402 msg += "</table><br>"
460 403 msg += "It is currently Segment " + str(self.segment) + ", DEX " + str(self.dexterity) + "<br>"
461 msg += "It is currently Segment " + str(v.segment) + ", DEX " + str(v.dexterity) + "<br>" 404
462 405 if send and player != 0: chat.whisper_to_players(msg, [player])
463 if send and player != 0: 406 else: self.chat.InfoPost(msg)
464 chat.whisper_to_players(msg, [player])
465 else:
466 self.chat.InfoPost(msg)
467 407
468 def call_time(self): 408 def call_time(self):
469 plist = "" 409 plist = ""
470 msg = "Segment is now " + str(self.segment) + ", DEX " + str(self.dexterity) 410 msg = "Segment is now " + str(self.segment) + ", DEX " + str(self.dexterity)
471 for player in self.init_list: 411 for player in self.init_list:
472 if player[3] == 1 or player[3] == 2 or player[3] == 5 or player[3] == 6: 412 if player[3] == 1 or player[3] == 2 or player[3] == 5 or player[3] == 6:
473 if plist != "": 413 if plist != "": plist += ", "
474 plist += ", "
475 plist += player[2] + "(" + self.state_strings[player[3]] + ")" 414 plist += player[2] + "(" + self.state_strings[player[3]] + ")"
476 if plist != "": 415 if plist != "": msg += ": " + plist
477 msg += ": " + plist
478 self.chat.Post(msg, True) 416 self.chat.Post(msg, True)
479 417
480 def process_user(self, command, player): 418 def process_user(self, command, player):
481 if command == "hadd": 419 if command == "hadd":
482 txt = command.split(None, 3) 420 txt = command.split(None, 3)
485 new_dex = int(txt[1]) 423 new_dex = int(txt[1])
486 new_spd = int(txt[2]) 424 new_spd = int(txt[2])
487 self.init_list.append([new_dex, new_spd, txt[3], 0, player[2]]) 425 self.init_list.append([new_dex, new_spd, txt[3], 0, player[2]])
488 self.backup_list.append([new_dex, new_spd, txt[3], 0, player[2]]) 426 self.backup_list.append([new_dex, new_spd, txt[3], 0, player[2]])
489 msg = "Character " + txt[3] + " added to initiative." 427 msg = "Character " + txt[3] + " added to initiative."
490 else: 428 else: msg = "Error in command. See format with heroinit"
491 msg = "Error in command. See format with heroinit" 429 except: msg = "Error in command. See format with heroinit"
492 except:
493 msg = "Error in command. See format with heroinit"
494
495 self.chat.whisper_to_players(msg, [player[2]]) 430 self.chat.whisper_to_players(msg, [player[2]])
496 431
497 elif command == "hact": 432 elif command == "hact":
498 txt = command.split(None) 433 txt = command.split(None)
499 if len(txt) == 2: 434 if len(txt) == 2:
502 msg = self.do_action(player[2], index, action) 437 msg = self.do_action(player[2], index, action)
503 elif len(txt) == 3: 438 elif len(txt) == 3:
504 index = int(txt[1]) 439 index = int(txt[1])
505 action = txt[2] 440 action = txt[2]
506 msg = self.do_action(player[2], index, action) 441 msg = self.do_action(player[2], index, action)
507 else: 442 else: msg = "Error in command. See format with heroinit"
508 msg = "Error in command. See format with heroinit"
509
510 self.chat.whisper_to_players(msg, [player[2]]) 443 self.chat.whisper_to_players(msg, [player[2]])
511 444 elif command == "hlist": self.list_inits(player[2], True)
512 elif command == "hlist":
513 self.list_inits(player[2], True)
514
515 else: 445 else:
516 msg = "Commands:<br>heroinit (hadd DEX SPEED CHARACTERNAME) : add character CHARACTERNAME with dex DEX and speed SPD to initiative list<br>" 446 msg = "Commands:<br>heroinit (hadd DEX SPEED CHARACTERNAME) : add character CHARACTERNAME with dex DEX and speed SPD to initiative list<br>"
517 msg += " Example: heroinit (hadd 18 4 Joey)<br>" 447 msg += " Example: heroinit (hadd 18 4 Joey)<br>"
518 msg += "heroinit (hact # (full|half|hold|stunned|abort) : Have character # perform an action. # is the number from hlist. If ommited, uses first owned character<br>" 448 msg += "heroinit (hact # (full|half|hold|stunned|abort) : Have character # perform an action. # is the number from hlist. If ommited, uses first owned character<br>"
519 msg += " Example: heroinit (hact 1 full) : Make character index 1 perform a full action.<br>" 449 msg += " Example: heroinit (hact 1 full) : Make character index 1 perform a full action.<br>"