def __readBonus_customizations(bonus, _name, section):
    lst = []
    for subsection in section.values():
        custData = {
            'value': subsection.readInt('value', 0),
            'custType': subsection.readString('custType', ''),
            'id': subsection.readInt('id', -1)
        }
        if subsection.has_key('boundVehicle'):
            custData['vehTypeCompDescr'] = vehicles.makeIntCompactDescrByID(
                'vehicle',
                *vehicles.g_list.getIDsByName(
                    subsection.readString('boundVehicle', '')))
        elif subsection.has_key('boundToCurrentVehicle'):
            custData['boundToCurrentVehicle'] = True
        if subsection.has_key('customCompensation'):
            credits = subsection['customCompensation'].readInt('credits', 0)
            gold = subsection['customCompensation'].readInt('gold', 0)
            custData['customCompensation'] = (credits, gold)
        isValid, item = validateCustomizationItem(custData)
        if not isValid:
            raise SoftException(item)
        lst.append(custData)

    bonus['customizations'] = lst
예제 #2
0
def __readBonus_customizations(bonus, _name, section, eventType):
    lst = []
    for subsection in section.values():
        custData = {
            'value': subsection.readInt('value', 0),
            'custType': subsection.readString('custType', ''),
            'id': subsection.readInt('id', -1)
        }
        if subsection.has_key('boundVehicle'):
            custData['vehTypeCompDescr'] = vehicles.makeIntCompactDescrByID(
                'vehicle',
                *vehicles.g_list.getIDsByName(
                    subsection.readString('boundVehicle', '')))
        elif subsection.has_key('boundToCurrentVehicle'):
            if eventType in EVENT_TYPE.LIKE_TOKEN_QUESTS:
                raise SoftException(
                    "Unsupported tag 'boundToCurrentVehicle' in 'like token' quests"
                )
            custData['boundToCurrentVehicle'] = True
        if subsection.has_key('customCompensation'):
            __readBonus_customCompensation(custData, None,
                                           subsection['customCompensation'])
        isValid, item = validateCustomizationItem(custData)
        if not isValid:
            raise SoftException(item)
        lst.append(custData)

    bonus['customizations'] = lst
    return
예제 #3
0
def __readBonus_customizations(bonus, _name, section):
    lst = []
    for subsection in section.values():
        custData = {
            "isPermanent": subsection.readBool("isPermanent", False),
            "value": subsection.readInt("value", 0),
            "custType": subsection.readString("custType", ""),
            "id": (subsection.readInt("nationID", -1), subsection.readInt("innationID", -1)),
        }
        if subsection.has_key("boundVehicle"):
            custData["vehTypeCompDescr"] = vehicles.makeIntCompactDescrByID(
                "vehicle", *vehicles.g_list.getIDsByName(subsection.readString("boundVehicle", ""))
            )
        elif subsection.has_key("boundToCurrentVehicle"):
            custData["boundToCurrentVehicle"] = True
        if custData["custType"] == "emblems":
            custData["id"] = custData["id"][1]
        isValid, reason = validateCustomizationItem(custData)
        if not isValid:
            raise Exception, reason
        if "boundToCurrentVehicle" in custData:
            customization = vehicles.g_cache.customization
            if custData["custType"] == "camouflages":
                nationID, innationID = custData["id"]
                descr = customization(nationID)["camouflages"][innationID]
                if descr["allow"] or descr["deny"]:
                    raise Exception, "Unsupported camouflage because allow and deny tags %s, %s, %s" % (
                        custData,
                        descr["allow"],
                        descr["deny"],
                    )
            elif custData["custType"] == "inscriptions":
                nationID, innationID = custData["id"]
                groupName = customization(nationID)["inscriptions"][innationID][0]
                allow, deny = customization(nationID)["inscriptionGroups"][groupName][3:5]
                if allow or deny:
                    raise Exception, "Unsupported inscription because allow and deny tags %s, %s, %s" % (
                        custData,
                        allow,
                        deny,
                    )
            elif custData["custType"] == "emblems":
                innationID = custData["id"]
                groups, emblems, _ = vehicles.g_cache.playerEmblems()
                allow, deny = groups[emblems[innationID][0]][4:6]
                if allow or deny:
                    raise Exception, "Unsupported inscription because allow and deny tags %s, %s, %s" % (
                        custData,
                        allow,
                        deny,
                    )
        lst.append(custData)

    bonus["customizations"] = lst
예제 #4
0
def __readBonus_vehicleCustomizations(bonus, _name, section):
    custData = {'value': 1,
     'custType': 'style',
     'id': section.readInt('styleId', -1)}
    if section.has_key('customCompensation'):
        __readBonus_customCompensation(custData, None, section['customCompensation'])
    isValid, item = validateCustomizationItem(custData)
    if not isValid:
        raise SoftException(item)
    bonus['customization'] = {'styleId': custData['id'],
     'customCompensation': custData['customCompensation']}
    return
예제 #5
0
    def __readBonus_customizations(self, eventType, bonus, _name, section, _gFinishTime):
        lst = []
        for subsection in section.values():
            custData = {'isPermanent': subsection.readBool('isPermanent', False),
             'value': subsection.readInt('value', 0),
             'custType': subsection.readString('custType', ''),
             'id': (subsection.readInt('nationID', -1), subsection.readInt('innationID', -1))}
            if subsection.has_key('boundVehicle'):
                custData['vehTypeCompDescr'] = vehicles.makeIntCompactDescrByID('vehicle', *vehicles.g_list.getIDsByName(subsection.readString('boundVehicle', '')))
            elif subsection.has_key('boundToCurrentVehicle'):
                if eventType in EVENT_TYPE.LIKE_TOKEN_QUESTS:
                    raise Exception, "Unsupported tag 'boundToCurrentVehicle' in 'like token' quests"
                custData['boundToCurrentVehicle'] = True
            if custData['custType'] == 'emblems':
                custData['id'] = custData['id'][1]
            isValid, reason = validateCustomizationItem(custData)
            if not isValid:
                raise Exception, reason
            if 'boundToCurrentVehicle' in custData:
                customization = vehicles.g_cache.customization
                if custData['custType'] == 'camouflages':
                    nationID, innationID = custData['id']
                    descr = customization(nationID)['camouflages'][innationID]
                    if descr['allow'] or descr['deny']:
                        raise Exception, 'Unsupported camouflage because allow and deny tags %s, %s, %s' % (custData, descr['allow'], descr['deny'])
                elif custData['custType'] == 'inscriptions':
                    nationID, innationID = custData['id']
                    groupName = customization(nationID)['inscriptions'][innationID][0]
                    allow, deny = customization(nationID)['inscriptionGroups'][groupName][3:5]
                    if allow or deny:
                        raise Exception, 'Unsupported inscription because allow and deny tags %s, %s, %s' % (custData, allow, deny)
                elif custData['custType'] == 'emblems':
                    innationID = custData['id']
                    groups, emblems, _ = vehicles.g_cache.playerEmblems()
                    allow, deny = groups[emblems[innationID][0]][4:6]
                    if allow or deny:
                        raise Exception, 'Unsupported inscription because allow and deny tags %s, %s, %s' % (custData, allow, deny)
            lst.append(custData)

        bonus['customizations'] = lst
예제 #6
0
def __readBonus_customizations(bonus, _name, section):
    lst = []
    for subsection in section.values():
        custData = {'isPermanent': subsection.readBool('isPermanent', False),
         'value': subsection.readInt('value', 0),
         'custType': subsection.readString('custType', ''),
         'id': (subsection.readInt('nationID', -1), subsection.readInt('innationID', -1))}
        if subsection.has_key('boundVehicle'):
            custData['vehTypeCompDescr'] = vehicles.makeIntCompactDescrByID('vehicle', *vehicles.g_list.getIDsByName(subsection.readString('boundVehicle', '')))
        elif subsection.has_key('boundToCurrentVehicle'):
            custData['boundToCurrentVehicle'] = True
        if custData['custType'] == 'emblems':
            custData['id'] = custData['id'][1]
        isValid, reason = validateCustomizationItem(custData)
        if not isValid:
            raise Exception(reason)
        if 'boundToCurrentVehicle' in custData:
            customization = vehicles.g_cache.customization
            if custData['custType'] == 'camouflages':
                nationID, innationID = custData['id']
                descr = customization(nationID)['camouflages'][innationID]
                if descr['allow'] or descr['deny']:
                    raise Exception('Unsupported camouflage because allow and deny tags %s, %s, %s' % (custData, descr['allow'], descr['deny']))
            elif custData['custType'] == 'inscriptions':
                nationID, innationID = custData['id']
                groupName = customization(nationID)['inscriptions'][innationID][0]
                allow, deny = customization(nationID)['inscriptionGroups'][groupName][3:5]
                if allow or deny:
                    raise Exception('Unsupported inscription because allow and deny tags %s, %s, %s' % (custData, allow, deny))
            elif custData['custType'] == 'emblems':
                innationID = custData['id']
                groups, emblems, _ = vehicles.g_cache.playerEmblems()
                allow, deny = groups[emblems[innationID][0]][4:6]
                if allow or deny:
                    raise Exception('Unsupported inscription because allow and deny tags %s, %s, %s' % (custData, allow, deny))
        lst.append(custData)

    bonus['customizations'] = lst