1
Fork 0
mirror of https://github.com/redstrate/Kawari.git synced 2025-07-09 15:37:45 +00:00

Fix a small issue with the !equip command

-It wasn't setting the item's condition, causing the game UI to behave strangely when looking at the item's tooltip
-Added a constant for the maximum item durability
This commit is contained in:
The Dax 2025-07-04 13:10:12 -04:00 committed by Joshua Goins
parent 85f0a0cd49
commit 7801398590
3 changed files with 11 additions and 13 deletions

View file

@ -1,3 +1,4 @@
use crate::ITEM_CONDITION_MAX;
use serde::{Deserialize, Serialize};
/// Represents an item, or if the quanity is zero an empty slot.
@ -14,7 +15,7 @@ impl Item {
Self {
quantity,
id,
condition: 30000,
condition: ITEM_CONDITION_MAX,
..Default::default()
}
}

View file

@ -76,6 +76,9 @@ pub const AETHERYTE_UNLOCK_BITMASK_SIZE: usize = 30;
/// The size of the completed quest bitmask.
pub const COMPLETED_QUEST_BITMASK_SIZE: usize = 691;
/// The maximum durability of an item.
pub const ITEM_CONDITION_MAX: u16 = 30000;
/// The operation opcode/type when discarding an item from the inventory.
pub const INVENTORY_ACTION_DISCARD: u8 = 145;

View file

@ -1,4 +1,5 @@
use crate::{
ITEM_CONDITION_MAX,
common::ItemInfoQuery,
inventory::{Item, Storage},
ipc::zone::{ChatMessage, GameMasterRank},
@ -65,18 +66,11 @@ impl ChatHandler {
.get_equipslot_category(item_info.equip_category)
.unwrap();
connection
.player_data
.inventory
.equipped
.get_slot_mut(slot)
.id = item_info.id;
connection
.player_data
.inventory
.equipped
.get_slot_mut(slot)
.quantity = 1;
let slot = connection.player_data.inventory.equipped.get_slot_mut(slot);
slot.id = item_info.id;
slot.quantity = 1;
slot.condition = ITEM_CONDITION_MAX;
}
}