Skip to content

Commit

Permalink
Prevent equipping an item with wrong display id to avoid client crash…
Browse files Browse the repository at this point in the history
…es on next login.
  • Loading branch information
GrenderG committed Apr 2, 2022
1 parent 33031e6 commit 43d30d2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion game/world/managers/objects/units/player/InventoryManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,11 +530,17 @@ def item_can_be_moved_to_slot(self, source_template, dest_slot, dest_bag, source
self.send_equip_error(InventoryError.BAG_NOT_WHILE_DEAD, source_item, dest_item)
return False

# Check equipment skill and level requirement
# Equipment requirements.
if self.is_equipment_pos(dest_bag, dest_slot):
# If the display id of the item is invalid, prevent equipping it to avoid a client crash on next login.
if source_template.display_id > MAX_3368_ITEM_DISPLAY_ID:
self.send_equip_error(InventoryError.BAG_NOT_EQUIPPABLE, source_item, dest_item)
return False
# Check if the player has the required level.
if source_template.required_level > self.owner.level:
self.send_equip_error(InventoryError.BAG_LEVEL_MISMATCH, source_item, dest_item)
return False
# Check if the player has the required proficiency.
if not self.owner.skill_manager.can_use_equipment(source_template.class_,
source_template.subclass):
self.send_equip_error(InventoryError.BAG_PROFICIENCY_NEEDED, source_item, dest_item)
Expand Down

0 comments on commit 43d30d2

Please sign in to comment.