Update of /cvsroot/wpdev/xmlscripts/scripts/wolfpack
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23692/wolfpack
Modified Files:
properties.py
Log Message:
enhancing
Index: properties.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/wolfpack/properties.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** properties.py 9 Oct 2004 23:31:03 -0000 1.20
--- properties.py 13 Oct 2004 18:45:43 -0000 1.21
***************
*** 175,178 ****
--- 175,206 ----
#
+ # Get a property bonus from a given resource
+ #
+ def fromresource(resource, property, type):
+ if not PROPERTIES.has_key(property):
+ raise Exception, "Unknown property value %u" % property
+
+ info = PROPERTIES[property]
+
+ if type == ITEM_ARMOR or type == ITEM_SHIELD:
+ resboni = wolfpack.armorinfo.ARMOR_RESNAME_BONI
+ elif type == ITEM_WEAPON:
+ resboni = wolfpack.weaponinfo.WEAPON_RESNAME_BONI
+ else:
+ return info[1]
+
+ # Default value for unknown resources
+ if not resboni.has_key(resource):
+ return info[1]
+
+ resboni = resboni[resource]
+
+ # Unkown property for this resource
+ if not resboni.has_key(property):
+ return info[1]
+
+ return resboni[property]
+
+ #
# Calculates a certain property for the character by
# recursing trough all of his equipment.
|