comparison orpg/mapper/fog_msg.py @ 140:e842a5f1b775 beta

Traipse Beta 'OpenRPG' {091123-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) 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 (See documentation for usage) Mercurial's hgweb folder is ported to upmana Pretty important update that can help remove thousands of dead children from your gametree. Children, <forms />, <group_atts />, <horizontal />, <cols />, <rows />, <height />, etc... are all tags now. Check your gametree and look for dead children!! New Gametree Recursion method, mapping, and context sensitivity. !Infinite Loops return error instead of freezing the software! New Syntax added for custom PC sheets Tip of the Day added, from Core and community Fixed Whiteboard ID to prevent random line or text deleting. Modified ID's to prevent non updated clients from ruining the fix.
author sirebral
date Mon, 23 Nov 2009 03:36:26 -0600
parents dcf4fbe09b70
children dcae32e219f1
comparison
equal deleted inserted replaced
135:dcf4fbe09b70 140:e842a5f1b775
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
33 32
34 class fog_msg(map_element_msg_base): 33 class fog_msg(map_element_msg_base):
35 34
36 def __init__(self,reentrant_lock_object = None): 35 def __init__(self,reentrant_lock_object = None):
37 self.tag = "fog" 36 self.tagname = "fog"
38 map_element_msg_base.__init__(self,reentrant_lock_object) 37 map_element_msg_base.__init__(self,reentrant_lock_object)
39 self.use_fog = 0 38 self.use_fog = 0
40 self.fogregion=IRegion() 39 self.fogregion=IRegion()
41 self.fogregion.Clear() 40 self.fogregion.Clear()
42 41
43 def get_line(self,outline,action,output_act): 42 def get_line(self,outline,action,output_act):
44 elem = Element( "poly" ) 43 elem = Element( "poly" )
45 if ( output_act ): elem.set( "action", action ) 44 if ( output_act ): elem.setAttribute( "action", action )
46 if ( outline == 'all' ) or ( outline == 'none' ): elem.set( "outline", outline ) 45 if ( outline == 'all' ) or ( outline == 'none' ): elem.setAttribute( "outline", outline )
47 else: 46 else:
48 elem.set( "outline", "points" ) 47 elem.setAttribute( "outline", "points" )
49 for pair in string.split( outline, ";" ): 48 for pair in string.split( outline, ";" ):
50 p = string.split( pair, "," ) 49 p = string.split( pair, "," )
51 point = Element( "point" ) 50 point = Element( "point" )
52 point.set( "x", p[ 0 ] ) 51 point.setAttribute( "x", p[ 0 ] )
53 point.set( "y", p[ 1 ] ) 52 point.setAttribute( "y", p[ 1 ] )
54 elem.append( point ) 53 elem.appendChild( point )
55 str = elem.toxml() 54 str = elem.toxml()
56 elem.unlink() 55 elem.unlink()
57 return str 56 return str
58 57
59 # convenience method to use if only this line is modified 58 # convenience method to use if only this line is modified
93 return s 92 return s
94 93
95 def interpret_dom(self,xml_dom): 94 def interpret_dom(self,xml_dom):
96 self.use_fog=1 95 self.use_fog=1
97 #print 'fog_msg.interpret_dom called' 96 #print 'fog_msg.interpret_dom called'
98 children = xml_dom.getchildren() 97 children = xml_dom._get_childNodes()
99 #print "children",children 98 #print "children",children
100 for l in children: 99 for l in children:
101 action = l.get("action") 100 action = l.getAttribute("action")
102 outline = l.get("outline") 101 outline = l.getAttribute("outline")
103 #print "action/outline",action, outline 102 #print "action/outline",action, outline
104 if (outline=="all"): 103 if (outline=="all"):
105 polyline=[] 104 polyline=[]
106 self.fogregion.Clear() 105 self.fogregion.Clear()
107 elif (outline=="none"): 106 elif (outline=="none"):
108 polyline=[] 107 polyline=[]
109 self.use_fog=0 108 self.use_fog=0
110 self.fogregion.Clear() 109 self.fogregion.Clear()
111 else: 110 else:
112 polyline=[] 111 polyline=[]
113 list = l.getchildren() 112 list = l._get_childNodes()
114 for node in list: 113 for node in list:
115 polyline.append( IPoint().make( int(node.get("x")), int(node.get("y")) ) ) 114 polyline.append( IPoint().make( int(node.getAttribute("x")), int(node.getAttribute("y")) ) )
116 # pointarray = outline.split(";") 115 # pointarray = outline.split(";")
117 # for m in range(len(pointarray)): 116 # for m in range(len(pointarray)):
118 # pt=pointarray[m].split(",") 117 # pt=pointarray[m].split(",")
119 # polyline.append(IPoint().make(int(pt[0]),int(pt[1]))) 118 # polyline.append(IPoint().make(int(pt[0]),int(pt[1])))
120 #print "length of polyline", len(polyline) 119 #print "length of polyline", len(polyline)