comparison orpg/networking/mplay_client.py @ 184:dcae32e219f1 beta

Traipse Beta 'OpenRPG' {100117-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 (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 New DieRoller portability for odd Dice Added 7th Sea die roller; 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)]. Included for Mythos roller also New Warhammer FRPG Die Roller (Special thanks to Puu-san for the support) New EZ_Tree Reference system. Push a button, Traipse the tree, get a reference (Beta!) 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 Fix to Whiteboard ID to prevent random line or text deleting. Fixes to Server, Remote Server, and Server GUI Fix to Update Manager; cleaner clode for saved repositories Fixes made to Settings Panel and now reactive settings when Ok is pressed Fixes to Alternity roller's attack roll. Uses a simple Tuple instead of a Splice Fix to Use panel of Forms and Tabbers. Now longer enters design mode Fix made Image Fetching. New fetching image and new failed image Modified ID's to prevent non updated clients from ruining the fix. default_manifest.xml renamed to default_upmana.xml
author sirebral
date Sun, 17 Jan 2010 21:37:34 -0600
parents 6081bdc2b8d5
children 9230a33defd9
comparison
equal deleted inserted replaced
183:0d9b746b5751 184:dcae32e219f1
19 # 19 #
20 # File: mplay_client.py 20 # File: mplay_client.py
21 # Author: Chris Davis 21 # Author: Chris Davis
22 # Maintainer: 22 # Maintainer:
23 # Version: 23 # Version:
24 # $Id: mplay_client.py,v 1.71 2007/05/12 20:41:54 digitalxero Exp $ 24 # $Id: mplay_client.py,v Traipse 'Ornery-Orc' prof.ebral Exp $
25 # 25 #
26 # Description: This file contains the code for the client stubs of the multiplayer 26 # Description: This file contains the code for the client stubs of the multiplayer
27 # features in the orpg project. 27 # features in the orpg project.
28 # 28 #
29 29
30 __version__ = "$Id: mplay_client.py,v 1.71 2007/05/12 20:41:54 digitalxero Exp $" 30 __version__ = "$Id: mplay_client.py,v Traipse 'Ornery-Orc' prof.ebral Exp $"
31 31
32 ### Alpha ###
33 ##import orpg.minidom ## Deprecated. xml.parseXml calls minidom.parseString so it was superfluous and wasteful.
34 import socket, Queue, thread, traceback, errno, os, time 32 import socket, Queue, thread, traceback, errno, os, time
35 33
36 from threading import Event, Lock 34 from threading import Event, Lock
37 from xml.sax.saxutils import escape 35 from xml.sax.saxutils import escape
38 from struct import pack, unpack, calcsize 36 from struct import pack, unpack, calcsize
121 self.ROLE_GM = "GM" 119 self.ROLE_GM = "GM"
122 self.ROLE_PLAYER = "Player" 120 self.ROLE_PLAYER = "Player"
123 self.ROLE_LURKER = "Lurker" 121 self.ROLE_LURKER = "Lurker"
124 ## --TaS 122 ## --TaS
125 try: self.ip = socket.gethostbyname(socket.gethostname()) 123 try: self.ip = socket.gethostbyname(socket.gethostname())
126 except: self.ip = socket.gethostbyname('localhost') 124 except: self.ip = socket.gethostbyname('localhost')
127 self.remote_ip = None 125 self.remote_ip = None
128 self.version = VERSION 126 self.version = VERSION
129 self.protocol_version = PROTOCOL_VERSION 127 self.protocol_version = PROTOCOL_VERSION
130 self.client_string = CLIENT_STRING 128 self.client_string = CLIENT_STRING
131 self.status = MPLAY_DISCONNECTED 129 self.status = MPLAY_DISCONNECTED
623 if (group_id != 0): self.update_role("Lurker") 621 if (group_id != 0): self.update_role("Lurker")
624 el = Element('join_group') 622 el = Element('join_group')
625 el.set('from', self.id) 623 el.set('from', self.id)
626 el.set('pwd', pwd) 624 el.set('pwd', pwd)
627 el.set('group_id', str(group_id)) 625 el.set('group_id', str(group_id))
628
629 self.outbox.put(tostring(el)) 626 self.outbox.put(tostring(el))
630 627
631 def poll(self, evt=None): 628 def poll(self, evt=None):
632 try: msg = self.inbox.get_nowait() 629 try: msg = self.inbox.get_nowait()
633 except: 630 except:
764 self.on_mplay_event(mplay_event(MPLAY_GROUP_CHANGE_F)) 761 self.on_mplay_event(mplay_event(MPLAY_GROUP_CHANGE_F))
765 elif act == "del": 762 elif act == "del":
766 self.on_player_event(mplay_event(PLAYER_DEL, self.players[id])) 763 self.on_player_event(mplay_event(PLAYER_DEL, self.players[id]))
767 if self.players.has_key(id): del self.players[id] 764 if self.players.has_key(id): del self.players[id]
768 if id == self.id: self.do_disconnect() 765 if id == self.id: self.do_disconnect()
769 # the next two cases handle the events that are used to let you know when others are typing
770 elif act == "update": 766 elif act == "update":
771 if id == self.id: 767 if id == self.id:
772 self.players[id] = player 768 self.players[id] = player
773 self.update_self_from_player(player) 769 self.update_self_from_player(player)
774 else: self.players[id] = player 770 else: self.players[id] = player
840 def start_disconnect(self): 836 def start_disconnect(self):
841 self.on_mplay_event(mplay_event(MPLAY_DISCONNECTING)) 837 self.on_mplay_event(mplay_event(MPLAY_DISCONNECTING))
842 outgoing = self.toxml('del') 838 outgoing = self.toxml('del')
843 if iselement(outgoing): outgoing = tostring(outgoing) 839 if iselement(outgoing): outgoing = tostring(outgoing)
844 self.outbox.put(outgoing) 840 self.outbox.put(outgoing)
845 ## Client Side Disconect Forced -- Snowdog 10-09-2003 841 ## Client Side Disconnect Forced -- Snowdog 10-09-2003
846 #pause to allow GUI events time to sync. 842 #pause to allow GUI events time to sync.
847 time.sleep(1) 843 time.sleep(1)
848 self.do_disconnect() 844 self.do_disconnect()
849 845
850 def do_disconnect(self): 846 def do_disconnect(self):
860 856
861 def get_next_id(self): 857 def get_next_id(self):
862 self.unique_cookie += 1 858 self.unique_cookie += 1
863 return_str = self.id + "-" + str(self.unique_cookie) 859 return_str = self.id + "-" + str(self.unique_cookie)
864 return return_str 860 return return_str
861