Package org.freerealm.property

Examples of org.freerealm.property.ModifyResourceProduction


        xml.append("</modifyResourceProduction>");
        return xml.toString();
    }

    public ModifyResourceProduction initializeFromNode(Realm realm, Node node) {
        ModifyResourceProduction modifyResourceProduction = new ModifyResourceProduction();
        modifyResourceProduction.setResource(realm.getResourceManager().getResource(XMLConverterUtility.findNode(node, "resource").getFirstChild().getNodeValue()));
        modifyResourceProduction.setModifier(Integer.parseInt(XMLConverterUtility.findNode(node, "modifier").getFirstChild().getNodeValue()));
        Node modifyingOnlyIfResourceExistsNode = XMLConverterUtility.findNode(node, "modifyingOnlyIfResourceExists");
        if (modifyingOnlyIfResourceExistsNode != null) {
            modifyResourceProduction.setModifyingOnlyIfResourceExists(Boolean.valueOf(modifyingOnlyIfResourceExistsNode.getFirstChild().getNodeValue()));
        }
        return modifyResourceProduction;
    }
View Full Code Here


        int resourceModifier = 0;
        Iterator<Property> propertyIterator = getProperties().iterator();
        while (propertyIterator.hasNext()) {
            Property property = propertyIterator.next();
            if (property instanceof ModifyResourceProduction) {
                ModifyResourceProduction modifyResourceProduction = (ModifyResourceProduction) property;
                if (resource.equals(modifyResourceProduction.getResource())) {
                    if (!modifyResourceProduction.isModifyingOnlyIfResourceExists() || (modifyResourceProduction.isModifyingOnlyIfResourceExists() && resourceExists)) {
                        resourceModifier = resourceModifier + modifyResourceProduction.getModifier();
                    }
                }
            }
        }
        return resourceModifier;
View Full Code Here

TOP

Related Classes of org.freerealm.property.ModifyResourceProduction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.