Mercurial > traipse_dev
comparison orpg/mapper/fog_msg.py @ 236:9230a33defd9 beta
Traipse Beta 'OpenRPG' {100616-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 (Closing/Closed)
New Features:
New to Map, can re-order Grid, Miniatures, and Whiteboard layer draw order
New to Server GUI, can now clear log
Updates:
Update to Warhammer PC Sheet. Rollers set as macros. Should work with little maintanence.
Update to Browser Server window. Display rooms with ' " & cleaner
Update to Server. Handles ' " & cleaner.
Fixes:
Fix to InterParse that was causing an Infernal Loop with Namespace Internal
Fix to XML data, removed old Minidom and switched to Element Tree
Fix to Server that was causing eternal attempt to find a Server ID, in Register Rooms thread
Fix to metaservers.xml file not being created
Fix to Single and Double quotes in Whiteboard text
Fix to Background images not showing when using the Image Server
Fix to Duplicate chat names appearing
Fix to Server GUI's logging output
Fix to FNB.COLORFUL_TABS bug.
author | sirebral |
---|---|
date | Wed, 16 Jun 2010 03:06:20 -0500 |
parents | dcae32e219f1 |
children |
comparison
equal
deleted
inserted
replaced
226:b29454610f36 | 236:9230a33defd9 |
---|---|
25 # | 25 # |
26 __version__ = "$Id: fog_msg.py,v Traipse 'Ornery-Orc' prof.ebral Exp $" | 26 __version__ = "$Id: fog_msg.py,v Traipse 'Ornery-Orc' prof.ebral Exp $" |
27 | 27 |
28 from base_msg import * | 28 from base_msg import * |
29 from region import * | 29 from region import * |
30 from orpg.minidom import Element | 30 from xml.etree.ElementTree import Element, tostring |
31 import string | 31 import string |
32 | 32 |
33 class fog_msg(map_element_msg_base): | 33 class fog_msg(map_element_msg_base): |
34 | 34 |
35 def __init__(self,reentrant_lock_object = None): | 35 def __init__(self,reentrant_lock_object = None): |
39 self.fogregion=IRegion() | 39 self.fogregion=IRegion() |
40 self.fogregion.Clear() | 40 self.fogregion.Clear() |
41 | 41 |
42 def get_line(self,outline,action,output_act): | 42 def get_line(self,outline,action,output_act): |
43 elem = Element( "poly" ) | 43 elem = Element( "poly" ) |
44 if ( output_act ): elem.setAttribute( "action", action ) | 44 if ( output_act ): elem.set( "action", action ) |
45 if ( outline == 'all' ) or ( outline == 'none' ): elem.setAttribute( "outline", outline ) | 45 if ( outline == 'all' ) or ( outline == 'none' ): elem.set( "outline", outline ) |
46 else: | 46 else: |
47 elem.setAttribute( "outline", "points" ) | 47 elem.set( "outline", "points" ) |
48 for pair in string.split( outline, ";" ): | 48 for pair in string.split( outline, ";" ): |
49 p = string.split( pair, "," ) | 49 p = string.split( pair, "," ) |
50 point = Element( "point" ) | 50 point = Element( "point" ) |
51 point.setAttribute( "x", p[ 0 ] ) | 51 point.set( "x", p[ 0 ] ) |
52 point.setAttribute( "y", p[ 1 ] ) | 52 point.set( "y", p[ 1 ] ) |
53 elem.appendChild( point ) | 53 elem.append( point ) |
54 str = elem.toxml() | 54 return tostring(elem) |
55 elem.unlink() | |
56 return str | |
57 | 55 |
58 # convenience method to use if only this line is modified | 56 # convenience method to use if only this line is modified |
59 # outputs a <map/> element containing only the changes to this line | 57 # outputs a <map/> element containing only the changes to this line |
60 def standalone_update_text(self,update_id_string): | 58 def standalone_update_text(self,update_id_string): |
61 buffer = "<map id='" + update_id_string + "'>" | 59 buffer = "<map id='" + update_id_string + "'>" |
81 y2=y1+ri.GetH()-1 | 79 y2=y1+ri.GetH()-1 |
82 fog_string += self.get_line(str(x1)+","+str(y1)+";"+ | 80 fog_string += self.get_line(str(x1)+","+str(y1)+";"+ |
83 str(x2)+","+str(y1)+";"+ | 81 str(x2)+","+str(y1)+";"+ |
84 str(x2)+","+str(y2)+";"+ | 82 str(x2)+","+str(y2)+";"+ |
85 str(x1)+","+str(y2),action,output_action) | 83 str(x1)+","+str(y2),action,output_action) |
86 s = "<fog" | 84 s = "<fog>" |
87 if fog_string: | 85 if fog_string: |
88 s += ">" | |
89 s += fog_string | 86 s += fog_string |
90 s += "</fog>" | 87 s += "</fog>" |
91 else: s+="/>" | |
92 return s | 88 return s |
93 | 89 |
94 def interpret_dom(self,xml_dom): | 90 def interpret_dom(self,xml_dom): |
95 self.use_fog=1 | 91 self.use_fog=1 |
96 #print 'fog_msg.interpret_dom called' | 92 children = xml_dom.getchildren() |
97 children = xml_dom._get_childNodes() | |
98 #print "children",children | |
99 for l in children: | 93 for l in children: |
100 action = l.getAttribute("action") | 94 action = l.get("action") |
101 outline = l.getAttribute("outline") | 95 outline = l.get("outline") |
102 #print "action/outline",action, outline | |
103 if (outline=="all"): | 96 if (outline=="all"): |
104 polyline=[] | 97 polyline=[] |
105 self.fogregion.Clear() | 98 self.fogregion.Clear() |
106 elif (outline=="none"): | 99 elif (outline=="none"): |
107 polyline=[] | 100 polyline=[] |
108 self.use_fog=0 | 101 self.use_fog=0 |
109 self.fogregion.Clear() | 102 self.fogregion.Clear() |
110 else: | 103 else: |
111 polyline=[] | 104 polyline=[] |
112 list = l._get_childNodes() | 105 list = l.getchildren() |
113 for node in list: | 106 for node in list: |
114 polyline.append( IPoint().make( int(node.getAttribute("x")), int(node.getAttribute("y")) ) ) | 107 polyline.append( IPoint().make( int(node.get("x")), int(node.get("y")) ) ) |
115 # pointarray = outline.split(";") | 108 # pointarray = outline.split(";") |
116 # for m in range(len(pointarray)): | 109 # for m in range(len(pointarray)): |
117 # pt=pointarray[m].split(",") | 110 # pt=pointarray[m].split(",") |
118 # polyline.append(IPoint().make(int(pt[0]),int(pt[1]))) | 111 # polyline.append(IPoint().make(int(pt[0]),int(pt[1]))) |
119 #print "length of polyline", len(polyline) | |
120 if (len(polyline)>2): | 112 if (len(polyline)>2): |
121 if action=="del": self.fogregion.FromPolygon(polyline,0) | 113 if action=="del": self.fogregion.FromPolygon(polyline,0) |
122 else: self.fogregion.FromPolygon(polyline,1) | 114 else: self.fogregion.FromPolygon(polyline,1) |
123 | 115 |
124 def init_from_dom(self,xml_dom): | 116 def init_from_dom(self,xml_dom): |