304 | function SellingStation:loadFromXMLFile(xmlFile, key) |
305 | local i=0 |
306 | while true do |
307 | local statsKey = string.format(key..".stats(%d)", i) |
308 | if not xmlFile:hasProperty(statsKey) then |
309 | break |
310 | end |
311 | local fillTypeStr = xmlFile:getValue(statsKey.."#fillType") |
312 | local fillType = g_fillTypeManager:getFillTypeIndexByName(fillTypeStr) |
313 | if fillType ~= nil and self.acceptedFillTypes[fillType] then |
314 | self.totalReceived[fillType] = xmlFile:getValue(statsKey.."#received", 0) |
315 | self.totalPaid[fillType] = xmlFile:getValue(statsKey.."#paid", 0) |
316 | self.pricingDynamics[fillType]:loadFromXMLFile(xmlFile, statsKey) |
317 | end |
318 | i = i + 1 |
319 | end |
320 | |
321 | return true |
322 | end |
683 | function SellingStation.loadSpecValueFillTypes(xmlFile, customEnvironment, baseDir) |
684 | local fillTypeNames |
685 | local fillTypesNamesString = xmlFile:getValue("placeable.sellingStation#fillTypes") |
686 | |
687 | if fillTypesNamesString ~= nil and fillTypesNamesString:trim() ~= "" then |
688 | fillTypeNames = {} |
689 | for _, fillTypeName in pairs(string.split(fillTypesNamesString, " ")) do |
690 | fillTypeNames[fillTypeName] = true |
691 | end |
692 | end |
693 | xmlFile:iterate("placeable.sellingStation.unloadTrigger", function(_, unloadTriggerKey) |
694 | local fillTypeNamesString = xmlFile:getValue(unloadTriggerKey .. "#fillTypes") |
695 | if fillTypeNamesString ~= nil and fillTypeNamesString:trim() ~= "" then |
696 | fillTypeNames = fillTypeNames or {} |
697 | for _, fillTypeName in pairs(string.split(fillTypeNamesString, " ")) do |
698 | fillTypeNames[fillTypeName] = true |
699 | end |
700 | end |
701 | end) |
702 | |
703 | return fillTypeNames |
704 | end |
673 | function SellingStation.registerSavegameXMLPaths(schema, basePath) |
674 | schema:register(XMLValueType.STRING, basePath .. ".stats(?)#fillType", "Fill type") |
675 | schema:register(XMLValueType.FLOAT, basePath .. ".stats(?)#received", "Recieved fill level", 0) |
676 | schema:register(XMLValueType.FLOAT, basePath .. ".stats(?)#paid", "Payed fill level", 0) |
677 | |
678 | PricingDynamics.registerSavegameXMLPaths(schema, basePath .. ".stats(?)") |
679 | end |
653 | function SellingStation.registerXMLPaths(schema, basePath) |
654 | schema:register(XMLValueType.BOOL, basePath .. "#appearsOnStats", "Appears on Stats", false) |
655 | schema:register(XMLValueType.BOOL, basePath .. "#suppressWarnings", "Suppress warnings", false) |
656 | schema:register(XMLValueType.BOOL, basePath .. "#allowMissions", "Allow missions", true) |
657 | schema:register(XMLValueType.BOOL, basePath .. "#hasDynamic", "Has dynamic prices", true) |
658 | schema:register(XMLValueType.INT, basePath .. "#litersForFullPriceDrop", "Liters for full price drop") |
659 | schema:register(XMLValueType.FLOAT, basePath .. "#fullPriceRecoverHours", "Full price recover ingame hours") |
660 | schema:register(XMLValueType.STRING, basePath .. "#fillTypeCategories", "Supported filltypes if no unloadtriggers defined") |
661 | schema:register(XMLValueType.STRING, basePath .. "#fillTypes", "Supported filltypes if no unloadtriggers defined") |
662 | |
663 | schema:register(XMLValueType.STRING, basePath .. ".fillType(?)#name", "Fill type name") |
664 | schema:register(XMLValueType.FLOAT, basePath .. ".fillType(?)#priceScale", "Price scale", 1) |
665 | schema:register(XMLValueType.BOOL, basePath .. ".fillType(?)#supportsGreatDemand", "Supports great demand", false) |
666 | schema:register(XMLValueType.BOOL, basePath .. ".fillType(?)#disablePriceDrop", "Disable price drop", false) |
667 | |
668 | UnloadingStation.registerXMLPaths(schema, basePath) |
669 | end |