comparison orpg/gametree/nodehandlers/minilib.py @ 66:c54768cffbd4 ornery-dev

Traipse Dev 'OpenRPG' {090818-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: *Unstable* This is the first wave of Code Refinement updates. Includes new material from Core Beta; new debugger material (partially implemented), beginnings of switch to etree, TerminalWriter, and a little more. open_rpg has been renamed to component; functioning now as component.get(), component.add(), component.delete(). This version has known bugs, specifically with the gametree and nodes. I think the XML files where not removed during testing of Core and switching back.
author sirebral
date Tue, 18 Aug 2009 06:33:37 -0500
parents 4385a7d0efd1
children 449a8900f9ac
comparison
equal deleted inserted replaced
65:4840657c23c5 66:c54768cffbd4
30 30
31 """Nodehandler for collections of miniatures. User can add, delete, edit 31 """Nodehandler for collections of miniatures. User can add, delete, edit
32 miniatures as sending them to the map singly or in batches. 32 miniatures as sending them to the map singly or in batches.
33 """ 33 """
34 from core import * 34 from core import *
35 import orpg.dirpath 35 from orpg.dirpath import dir_struct
36 import string 36 import string
37 import map_miniature_nodehandler 37 import map_miniature_nodehandler
38 import orpg.mapper.map_msg 38 import orpg.mapper.map_msg
39 # import scriptkit 39 # import scriptkit
40 40
187 if mini == None: 187 if mini == None:
188 return 188 return
189 if mini.getAttribute( ATTRIBUTE_URL ) == '' or mini.getAttribute( ATTRIBUTE_URL ) == 'http://': 189 if mini.getAttribute( ATTRIBUTE_URL ) == '' or mini.getAttribute( ATTRIBUTE_URL ) == 'http://':
190 self.chat.ParsePost( self.chat.colorize(self.chat.syscolor, '"%s" is not a valid URL, the mini "%s" will not be added to the map' % ( mini.getAttribute( ATTRIBUTE_URL ), mini.getAttribute( ATTRIBUTE_NAME ) )) ) 190 self.chat.ParsePost( self.chat.colorize(self.chat.syscolor, '"%s" is not a valid URL, the mini "%s" will not be added to the map' % ( mini.getAttribute( ATTRIBUTE_URL ), mini.getAttribute( ATTRIBUTE_NAME ) )) )
191 return 191 return
192 session = open_rpg.get_component( COMPONENT_SESSION ) 192 session = component.get( COMPONENT_SESSION )
193 if (session.my_role() != session.ROLE_GM) and (session.my_role() != session.ROLE_PLAYER): 193 if (session.my_role() != session.ROLE_GM) and (session.my_role() != session.ROLE_PLAYER):
194 open_rpg.get_component("chat").InfoPost("You must be either a player or GM to use the miniature Layer") 194 component.get("chat").InfoPost("You must be either a player or GM to use the miniature Layer")
195 return 195 return
196 map = open_rpg.get_component(COMPONENT_MAP) 196 map = component.get(COMPONENT_MAP)
197 for loop in range( count ): 197 for loop in range( count ):
198 msg = self.get_miniature_XML( mini, addName) 198 msg = self.get_miniature_XML( mini, addName)
199 msg = str("<map action='update'><miniatures>" + msg + "</miniatures></map>") 199 msg = str("<map action='update'><miniatures>" + msg + "</miniatures></map>")
200 map.new_data( msg ) 200 map.new_data( msg )
201 session.send( msg ) 201 session.send( msg )
202 202
203 def get_miniature_XML( self, mini, addName = True ): 203 def get_miniature_XML( self, mini, addName = True ):
204 msg = orpg.mapper.map_msg.mini_msg() 204 msg = orpg.mapper.map_msg.mini_msg()
205 map = open_rpg.get_component( COMPONENT_MAP ) 205 map = component.get( COMPONENT_MAP )
206 session = open_rpg.get_component( COMPONENT_SESSION ) 206 session = component.get( COMPONENT_SESSION )
207 msg.init_prop( ATTRIBUTE_ID, session.get_next_id() ) 207 msg.init_prop( ATTRIBUTE_ID, session.get_next_id() )
208 for k in mini.getAttributeKeys(): 208 for k in mini.getAttributeKeys():
209 # translate our attributes to map attributes 209 # translate our attributes to map attributes
210 key = FROM_MINILIB_MAP.get( k, k ) 210 key = FROM_MINILIB_MAP.get( k, k )
211 if key != None: 211 if key != None:
270 """ 270 """
271 wx.Panel.__init__( self, frame, -1 ) 271 wx.Panel.__init__( self, frame, -1 )
272 self.handler = handler 272 self.handler = handler
273 self.frame = frame 273 self.frame = frame
274 274
275 self.map = open_rpg.get_component('map') 275 self.map = component.get('map')
276 names = self.buildList() 276 names = self.buildList()
277 # self.keys = self.list.keys() 277 # self.keys = self.list.keys()
278 # self.keys.sort() 278 # self.keys.sort()
279 279
280 280