comparison orpg/mapper/fog_msg.py @ 122:36919b8a3ef9 alpha

Traipse Alpha 'OpenRPG' {091031-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 (Cleaning up for Beta) Added Bookmarks Fix to Remote Admin Commands Minor fix to text based Server Fix to Pretty Print, from Core Fix to Splitter Nodes not being created Fix to massive amounts of images loading, from Core 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 default_manifest.xml renamed to default_upmana.xml Cleaner clode for saved repositories New TrueDebug Class in orpg_log Mercurial's hgweb folder is ported to upmana Happy Halloween!
author sirebral
date Sat, 31 Oct 2009 22:07:55 -0500
parents 449a8900f9ac
children 54446a995007 e842a5f1b775
comparison
equal deleted inserted replaced
121:496dbf12a6cb 122:36919b8a3ef9
25 # 25 #
26 __version__ = "$Id: fog_msg.py,v 1.16 2006/11/04 21:24:21 digitalxero Exp $" 26 __version__ = "$Id: fog_msg.py,v 1.16 2006/11/04 21:24:21 digitalxero 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 orpg.minidom import Element
31 import string 31 import string
32 from xml.etree.ElementTree import ElementTree
32 33
33 class fog_msg(map_element_msg_base): 34 class fog_msg(map_element_msg_base):
34 35
35 def __init__(self,reentrant_lock_object = None): 36 def __init__(self,reentrant_lock_object = None):
36 self.tagname = "fog" 37 self.tag = "fog"
37 map_element_msg_base.__init__(self,reentrant_lock_object) 38 map_element_msg_base.__init__(self,reentrant_lock_object)
38 self.use_fog = 0 39 self.use_fog = 0
39 self.fogregion=IRegion() 40 self.fogregion=IRegion()
40 self.fogregion.Clear() 41 self.fogregion.Clear()
41 42
42 def get_line(self,outline,action,output_act): 43 def get_line(self,outline,action,output_act):
43 elem = Element( "poly" ) 44 elem = Element( "poly" )
44 if ( output_act ): elem.setAttribute( "action", action ) 45 if ( output_act ): elem.set( "action", action )
45 if ( outline == 'all' ) or ( outline == 'none' ): elem.setAttribute( "outline", outline ) 46 if ( outline == 'all' ) or ( outline == 'none' ): elem.set( "outline", outline )
46 else: 47 else:
47 elem.setAttribute( "outline", "points" ) 48 elem.set( "outline", "points" )
48 for pair in string.split( outline, ";" ): 49 for pair in string.split( outline, ";" ):
49 p = string.split( pair, "," ) 50 p = string.split( pair, "," )
50 point = Element( "point" ) 51 point = Element( "point" )
51 point.setAttribute( "x", p[ 0 ] ) 52 point.set( "x", p[ 0 ] )
52 point.setAttribute( "y", p[ 1 ] ) 53 point.set( "y", p[ 1 ] )
53 elem.appendChild( point ) 54 elem.append( point )
54 str = elem.toxml() 55 str = elem.toxml()
55 elem.unlink() 56 elem.unlink()
56 return str 57 return str
57 58
58 # convenience method to use if only this line is modified 59 # convenience method to use if only this line is modified
92 return s 93 return s
93 94
94 def interpret_dom(self,xml_dom): 95 def interpret_dom(self,xml_dom):
95 self.use_fog=1 96 self.use_fog=1
96 #print 'fog_msg.interpret_dom called' 97 #print 'fog_msg.interpret_dom called'
97 children = xml_dom._get_childNodes() 98 children = xml_dom.getchildren()
98 #print "children",children 99 #print "children",children
99 for l in children: 100 for l in children:
100 action = l.getAttribute("action") 101 action = l.get("action")
101 outline = l.getAttribute("outline") 102 outline = l.get("outline")
102 #print "action/outline",action, outline 103 #print "action/outline",action, outline
103 if (outline=="all"): 104 if (outline=="all"):
104 polyline=[] 105 polyline=[]
105 self.fogregion.Clear() 106 self.fogregion.Clear()
106 elif (outline=="none"): 107 elif (outline=="none"):
107 polyline=[] 108 polyline=[]
108 self.use_fog=0 109 self.use_fog=0
109 self.fogregion.Clear() 110 self.fogregion.Clear()
110 else: 111 else:
111 polyline=[] 112 polyline=[]
112 list = l._get_childNodes() 113 list = l.getchildren()
113 for node in list: 114 for node in list:
114 polyline.append( IPoint().make( int(node.getAttribute("x")), int(node.getAttribute("y")) ) ) 115 polyline.append( IPoint().make( int(node.get("x")), int(node.get("y")) ) )
115 # pointarray = outline.split(";") 116 # pointarray = outline.split(";")
116 # for m in range(len(pointarray)): 117 # for m in range(len(pointarray)):
117 # pt=pointarray[m].split(",") 118 # pt=pointarray[m].split(",")
118 # polyline.append(IPoint().make(int(pt[0]),int(pt[1]))) 119 # polyline.append(IPoint().make(int(pt[0]),int(pt[1])))
119 #print "length of polyline", len(polyline) 120 #print "length of polyline", len(polyline)