IdleLands / IdleLandsOld

[DEPRECATED] A full-blown idling RPG. It has a modular backend that can be added to any existing frontend via a REST API.
http://idlelands.github.io/IdleLandsOld
MIT License
41 stars 28 forks source link

removing erroneous check on pet item find / equip logic #864

Closed seiyria closed 9 years ago

Oipo commented 9 years ago

So uh, what happens when you equip something in a slot that already has something in that slot? Doesn't this make it so pets can equip 153242542+ body armours?

seiyria commented 9 years ago

Actually, I thought that too. Then I followed the execution path, and this follows immediately after:

    itemsInSlot = @equippedItemsOfType item.type
    if itemsInSlot.length >= PetData[@type].slots[item.type]
      lowestScoreItem = _.min itemsInSlot, (item) => @calc.itemScore item

      if lowestScoreItem.score() < item.score()
        @equip item
        @equipment = _.without @equipment, lowestScoreItem
        @sellItem lowestScoreItem

        return true

    else if itemsInSlot.length < PetData[@type].slots[item.type]
      @equip item

      return true

Which means that first check is bad, because pets can technically equip the item so long as the score is within their bounds. The actual equip logic pasted above does the same check, and handles it better.

Oipo commented 9 years ago

Yes, except that when the player tells IdleMaster, for example, to equip an item to pet, the tryToEquipToSelf function isn't called at all. Thus enabling a player to equip multiple items in the same slot. Unless I'm missing something?