Exemplo n.º 1
0
def new_vehicleValues(_, xmlCtx, section, sectionName, defNationID):
    section = section[sectionName]
    if section is None:
        return
    ctx = (xmlCtx, sectionName)
    for vehName, subsection in section.items():
        if vehName != 'all':
            if ':' not in vehName:
                vehName = nations.NAMES[defNationID] + ':' + vehName
            try:
                nationID, vehID = iv.g_list.getIDsByName(vehName)
            except Exception:
                ix.raiseWrongXml(xmlCtx, sectionName, "unknown vehicle name '%s'" % vehName)
            # noinspection PyUnboundLocalVariable
            yield iv.VehicleValue(vehName, makeCD('vehicle', nationID, vehID), ctx, subsection)
        else:
            for vehNameAll in iv.g_list._VehicleList__ids.keys():
                nationID, vehID = iv.g_list.getIDsByName(vehNameAll)
                yield iv.VehicleValue(vehNameAll, makeCD('vehicle', nationID, vehID), ctx, subsection)
def getCDFromId(itemType, itemId):
    return makeCD('customizationItem', _CUSTOMIZATION_TYPES_MAP[itemType],
                  itemId) if itemType in _CUSTOMIZATION_ITEM_TYPE else itemId