diff --git a/server/gameserver/creature.cc b/server/gameserver/creature.cc index a98b590..e0eab1c 100644 --- a/server/gameserver/creature.cc +++ b/server/gameserver/creature.cc @@ -1431,8 +1431,15 @@ Weapon* Creature::ChooseNextWeapon(int curr_weapon_slot_id, int begin_slot_id, i for (int i = 1; i <= (end_slot_id - begin_slot_id); ++i) { int slot_id = begin_slot_id + (i + curr_weapon_slot_id - begin_slot_id) % (end_slot_id - begin_slot_id + 1); - if (weapons[slot_id].weapon_id != 0) { - next_weapon = &weapons[slot_id]; + int idx = -1; + if (slot_id >= SPEC1_IS_BEGIN && slot_id <= SPEC1_IS_END) { + idx = SPEC1_SLOT_BEGIN + (slot_id - SPEC1_IS_BEGIN); + } + if (slot_id >= SPEC2_IS_BEGIN && slot_id <= SPEC2_IS_END) { + idx = SPEC2_SLOT_BEGIN + (slot_id - SPEC2_IS_BEGIN); + } + if (idx != -1 && weapons.at(idx).weapon_id != 0) { + next_weapon = &weapons[idx]; break; } }