Beispiel #1
0
    def is_equipped_illegal(self, item, in_slotindex):
        entity_data = self.connection.entity_data

        power_item = get_power(item.level)
        power_char = get_power(entity_data.level)
        if power_item > power_char:
            self.log(
                (
                    "item level too high for character "
                    + "item: level:{level1} (power: {power1}) "
                    + "character: level:{level2} (power: {power2})"
                ).format(level1=item.level, power1=power_item, level2=entity_data.level, power2=power_char),
                LOG_LEVEL_VERBOSE,
            )
            return True

        if not item.type in LEGAL_ITEMSLOTS:
            self.log(
                "non equipable item slot:"
                + "type={type} subtype={subtype} slot={slot}".format(
                    type=item.type, subtype=item.sub_type, slot=in_slotindex
                ),
                LOG_LEVEL_VERBOSE,
            )
            return True

        if not in_slotindex in LEGAL_ITEMSLOTS[item.type]:
            self.log(
                "item in invalid slot:"
                + "type={type} subtype={subtype} slot={slot}".format(
                    type=item.type, subtype=item.sub_type, slot=in_slotindex
                ),
                LOG_LEVEL_VERBOSE,
            )
            return True

        if in_slotindex == 6 and item.sub_type in TWOHANDED_WEAPONS:
            if self.allow_dual_wield is False and entity_data.equipment[7].type != 0:
                self.log(
                    "dual wield bug"
                    + (" weapon (slot6) = {item1}" + " weapon (slot7) = {item2}").format(
                        item1=item.sub_type, item2=entity_data.equipment[7].sub_type
                    ),
                    LOG_LEVEL_VERBOSE,
                )
                return True
            if entity_data.equipment[7].sub_type in TWOHANDED_WEAPONS:
                self.log(
                    "dual wield two handers"
                    + (" weapon (slot6) = {item1}" + " weapon (slot7) = {item2}").format(
                        item1=entity_data.equipment[6].sub_type, item2=entity_data.equipment[7].sub_type
                    ),
                    LOG_LEVEL_VERBOSE,
                )
                return True

        if in_slotindex == 7 and item.sub_type in TWOHANDED_WEAPONS:
            if self.allow_dual_wield is False and entity_data.equipment[6].type != 0:
                self.log(
                    "dual wield bug"
                    + (" weapon (slot6) = {item1}" + " weapon (slot7) = {item2}").format(
                        item1=entity_data.equipment[6].sub_type, item2=item.sub_type
                    ),
                    LOG_LEVEL_VERBOSE,
                )
                return True

        if item.type == 3 and not item.sub_type in CLASS_WEAPONS[entity_data.class_type]:
            self.log(
                "weapon not allowed for class"
                + " subtype={subtype} class={classid} item={item}".format(
                    subtype=item.sub_type, classid=entity_data.class_type, item=get_item_name(item)
                ),
                LOG_LEVEL_VERBOSE,
            )
            return True

        if item.type in ARMOR_IDS and not item.material in CLASS_ARMOR[entity_data.class_type]:
            self.log(
                "armor not allowed for class "
                + " material={material} class={classid} item={item}".format(
                    material=item.material, classid=entity_data.class_type, item=get_item_name(item)
                ),
                LOG_LEVEL_VERBOSE,
            )
            return True

        return False
Beispiel #2
0
    def is_equipped_illegal(self, item, in_slotindex):
        entity = self.connection.entity

        power_item = get_power(item.level)
        power_char = get_power(entity.level)
        if power_item > power_char:
            self.log(("item level too high for character "
                      "item: level:{level1} (power: {power1}) "
                      "character: level:{level2} (power: {power2})").format(
                          level1=item.level,
                          power1=power_item,
                          level2=entity.level,
                          power2=power_char), LOG_LEVEL_VERBOSE)
            return True

        if item.type not in LEGAL_ITEMSLOTS:
            self.log(
                "non equipable item slot:" +
                "type={type} subtype={subtype} slot={slot}".format(
                    type=item.type, subtype=item.sub_type, slot=in_slotindex),
                LOG_LEVEL_VERBOSE)
            return True

        if in_slotindex not in LEGAL_ITEMSLOTS[item.type]:
            self.log(
                "item in invalid slot:" +
                "type={type} subtype={subtype} slot={slot}".format(
                    type=item.type, subtype=item.sub_type, slot=in_slotindex),
                LOG_LEVEL_VERBOSE)
            return True

        if in_slotindex == 6 and item.sub_type in TWOHANDED_WEAPONS:
            if (self.allow_dual_wield is False
                    and entity.equipment[7].type != 0):
                self.log(
                    "dual wield bug" +
                    (" weapon (slot6) = {item1}" +
                     " weapon (slot7) = {item2}").format(
                         item1=item.sub_type,
                         item2=entity.equipment[7].sub_type),
                    LOG_LEVEL_VERBOSE)
                return True
            if entity.equipment[7].sub_type in TWOHANDED_WEAPONS:
                self.log(
                    "dual wield two handers" +
                    (" weapon (slot6) = {item1}" +
                     " weapon (slot7) = {item2}").format(
                         item1=entity.equipment[6].sub_type,
                         item2=entity.equipment[7].sub_type),
                    LOG_LEVEL_VERBOSE)
                return True

        if in_slotindex == 7 and item.sub_type in TWOHANDED_WEAPONS:
            if (self.allow_dual_wield is False
                    and entity.equipment[6].type != 0):
                self.log(
                    "dual wield bug" + (" weapon (slot6) = {item1}" +
                                        " weapon (slot7) = {item2}").format(
                                            item1=entity.equipment[6].sub_type,
                                            item2=item.sub_type),
                    LOG_LEVEL_VERBOSE)
                return True

        if (item.type == 3
                and not item.sub_type in CLASS_WEAPONS[entity.class_type]):
            self.log(
                "weapon not allowed for class" +
                " subtype={subtype} class={classid} item={item}".format(
                    subtype=item.sub_type,
                    classid=entity.class_type,
                    item=get_item_name(item)), LOG_LEVEL_VERBOSE)
            return True

        if (item.type in ARMOR_IDS
                and not item.material in CLASS_ARMOR[entity.class_type]):
            self.log(
                "armor not allowed for class " +
                " material={material} class={classid} item={item}".format(
                    material=item.material,
                    classid=entity.class_type,
                    item=get_item_name(item)), LOG_LEVEL_VERBOSE)
            return True

        return False
Beispiel #3
0
    def is_item_illegal(self, item):
        # Negative item levels... almost as bad as rarity 255
        if item.level < 0:
            self.log("negative item level: level = {level}".format(level=item.level), LOG_LEVEL_VERBOSE)
            return True

        if item.upgrade_count > 32:
            self.log(
                "too many customization blocks on item: "
                + "level = {upgradecount}".format(upgradecount=item.upgrade_count),
                LOG_LEVEL_VERBOSE,
            )
            return True

        # Rarity is what makes the items truely broken and overpowered,
        # A rarity of 255 will make even a lvl 1 weapon do 2 billion damage.
        if item.rarity > self.rarity_cap:
            self.log("item rarity: {rarity}".format(rarity=item.rarity), LOG_LEVEL_VERBOSE)
            return True

        if item.type == 1 and item.rarity > 0:
            self.log(
                ("consumable with rarity above 0, item={item}" + " item rarity: {rarity}").format(
                    item=get_item_name(item), rarity=item.rarity
                ),
                LOG_LEVEL_VERBOSE,
            )
            return True

        # Item type 2 is a recipe they are handled differently.
        # minus modifier is the item type of the crafted item
        if item.type == 2:
            if not item.minus_modifier in LEGAL_RECIPE_ITEMS:
                self.log(
                    ("invalid recipe:type={type} " + "subtype={stype} material={mat} item={item}").format(
                        type=item.minus_modifier, stype=item.sub_type, mat=item.material, item=get_item_name(item)
                    ),
                    LOG_LEVEL_VERBOSE,
                )
                return True

            if not (item.material in LEGAL_ITEMS[(item.minus_modifier, item.sub_type)]):
                self.log(
                    ("invalid recipe:type={type} " + "subtype={stype} material={mat} item={item}").format(
                        type=item.minus_modifier, stype=item.sub_type, mat=item.material, item=get_item_name(item)
                    ),
                    LOG_LEVEL_VERBOSE,
                )
                return True

            return False

        if not (item.type, item.sub_type) in LEGAL_ITEMS:
            self.log(
                ("invalid item:type={type} " + "subtype={stype} material={material} item={item}").format(
                    type=item.type, stype=item.sub_type, material=item.material, item=get_item_name(item)
                ),
                LOG_LEVEL_VERBOSE,
            )
            return True

        if not item.material in LEGAL_ITEMS[(item.type, item.sub_type)]:
            self.log(
                ("invalid material:type={type} " + "subtype={stype} material={mat} item={item}").format(
                    type=item.type, stype=item.sub_type, mat=item.material, item=get_item_name(item)
                ),
                LOG_LEVEL_VERBOSE,
            )
            return True

        return False
Beispiel #4
0
    def is_item_illegal(self, item):
        # Negative item levels... almost as bad as rarity 255
        if item.level < 0:
            self.log(
                "negative item level: level = {level}".format(
                    level=item.level), LOG_LEVEL_VERBOSE)
            return True

        if item.upgrade_count > 32:
            self.log(
                "too many customization blocks on item: " +
                "level = {upgradecount}".format(
                    upgradecount=item.upgrade_count), LOG_LEVEL_VERBOSE)
            return True

        # Rarity is what makes the items truely broken and overpowered,
        # A rarity of 255 will make even a lvl 1 weapon do 2 billion damage.
        if item.rarity > self.rarity_cap:
            self.log("item rarity: {rarity}".format(rarity=item.rarity),
                     LOG_LEVEL_VERBOSE)
            return True

        if item.type == 1 and item.rarity > 0:
            self.log(
                ("consumable with rarity above 0, item={item}" +
                 " item rarity: {rarity}").format(item=get_item_name(item),
                                                  rarity=item.rarity),
                LOG_LEVEL_VERBOSE)
            return True

        # Item type 2 is a recipe they are handled differently.
        # minus modifier is the item type of the crafted item
        if item.type == 2:
            if item.minus_modifier not in LEGAL_RECIPE_ITEMS:
                self.log(("invalid recipe:type={type} " +
                          "subtype={stype} material={mat} item={item}").format(
                              type=item.minus_modifier,
                              stype=item.sub_type,
                              mat=item.material,
                              item=get_item_name(item)), LOG_LEVEL_VERBOSE)
                return True

            if not (item.material
                    in LEGAL_ITEMS[(item.minus_modifier, item.sub_type)]):
                self.log(("invalid recipe:type={type} " +
                          "subtype={stype} material={mat} item={item}").format(
                              type=item.minus_modifier,
                              stype=item.sub_type,
                              mat=item.material,
                              item=get_item_name(item)), LOG_LEVEL_VERBOSE)
                return True

            return False

        if (item.type, item.sub_type) not in LEGAL_ITEMS:
            self.log(
                ("invalid item:type={type} " +
                 "subtype={stype} material={material} item={item}").format(
                     type=item.type,
                     stype=item.sub_type,
                     material=item.material,
                     item=get_item_name(item)), LOG_LEVEL_VERBOSE)
            return True

        if item.material not in LEGAL_ITEMS[(item.type, item.sub_type)]:
            self.log(("invalid material:type={type} " +
                      "subtype={stype} material={mat} item={item}").format(
                          type=item.type,
                          stype=item.sub_type,
                          mat=item.material,
                          item=get_item_name(item)), LOG_LEVEL_VERBOSE)
            return True

        return False