mirror of
https://github.com/redstrate/Kawari.git
synced 2025-06-30 11:47:45 +00:00
Initial support for item glamours and condition
The only way to glamour items is to import them from Auracite, same with condition. But these are actually sent to the client now!
This commit is contained in:
parent
9d4f1eeb93
commit
0a740198f8
6 changed files with 37 additions and 20 deletions
|
@ -10,7 +10,7 @@ pub struct CurrencyStorage {
|
||||||
impl Default for CurrencyStorage {
|
impl Default for CurrencyStorage {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
gil: Item { quantity: 0, id: 1 },
|
gil: Item::new(0, 1),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,25 @@ use serde::{Deserialize, Serialize};
|
||||||
pub struct Item {
|
pub struct Item {
|
||||||
pub quantity: u32,
|
pub quantity: u32,
|
||||||
pub id: u32,
|
pub id: u32,
|
||||||
|
pub condition: u16,
|
||||||
|
pub glamour_catalog_id: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Item {
|
impl Item {
|
||||||
pub fn new(quantity: u32, id: u32) -> Self {
|
pub fn new(quantity: u32, id: u32) -> Self {
|
||||||
Self { quantity, id }
|
Self {
|
||||||
|
quantity,
|
||||||
|
id,
|
||||||
|
condition: 30000,
|
||||||
|
..Default::default()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns the catalog ID of the glamour, if applicable.
|
||||||
|
pub fn apparent_id(&self) -> u32 {
|
||||||
|
if self.glamour_catalog_id > 0 {
|
||||||
|
return self.glamour_catalog_id;
|
||||||
|
}
|
||||||
|
self.id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -258,41 +258,41 @@ impl Inventory {
|
||||||
|
|
||||||
pub fn get_main_weapon_id(&self, game_data: &mut GameData) -> u64 {
|
pub fn get_main_weapon_id(&self, game_data: &mut GameData) -> u64 {
|
||||||
game_data
|
game_data
|
||||||
.get_primary_model_id(self.equipped.main_hand.id)
|
.get_primary_model_id(self.equipped.main_hand.apparent_id())
|
||||||
.unwrap_or(0)
|
.unwrap_or(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_model_ids(&self, game_data: &mut GameData) -> [u32; 10] {
|
pub fn get_model_ids(&self, game_data: &mut GameData) -> [u32; 10] {
|
||||||
[
|
[
|
||||||
game_data
|
game_data
|
||||||
.get_primary_model_id(self.equipped.head.id)
|
.get_primary_model_id(self.equipped.head.apparent_id())
|
||||||
.unwrap_or(0) as u32,
|
.unwrap_or(0) as u32,
|
||||||
game_data
|
game_data
|
||||||
.get_primary_model_id(self.equipped.body.id)
|
.get_primary_model_id(self.equipped.body.apparent_id())
|
||||||
.unwrap_or(0) as u32,
|
.unwrap_or(0) as u32,
|
||||||
game_data
|
game_data
|
||||||
.get_primary_model_id(self.equipped.hands.id)
|
.get_primary_model_id(self.equipped.hands.apparent_id())
|
||||||
.unwrap_or(0) as u32,
|
.unwrap_or(0) as u32,
|
||||||
game_data
|
game_data
|
||||||
.get_primary_model_id(self.equipped.legs.id)
|
.get_primary_model_id(self.equipped.legs.apparent_id())
|
||||||
.unwrap_or(0) as u32,
|
.unwrap_or(0) as u32,
|
||||||
game_data
|
game_data
|
||||||
.get_primary_model_id(self.equipped.feet.id)
|
.get_primary_model_id(self.equipped.feet.apparent_id())
|
||||||
.unwrap_or(0) as u32,
|
.unwrap_or(0) as u32,
|
||||||
game_data
|
game_data
|
||||||
.get_primary_model_id(self.equipped.ears.id)
|
.get_primary_model_id(self.equipped.ears.apparent_id())
|
||||||
.unwrap_or(0) as u32,
|
.unwrap_or(0) as u32,
|
||||||
game_data
|
game_data
|
||||||
.get_primary_model_id(self.equipped.neck.id)
|
.get_primary_model_id(self.equipped.neck.apparent_id())
|
||||||
.unwrap_or(0) as u32,
|
.unwrap_or(0) as u32,
|
||||||
game_data
|
game_data
|
||||||
.get_primary_model_id(self.equipped.wrists.id)
|
.get_primary_model_id(self.equipped.wrists.apparent_id())
|
||||||
.unwrap_or(0) as u32,
|
.unwrap_or(0) as u32,
|
||||||
game_data
|
game_data
|
||||||
.get_primary_model_id(self.equipped.left_ring.id)
|
.get_primary_model_id(self.equipped.left_ring.apparent_id())
|
||||||
.unwrap_or(0) as u32,
|
.unwrap_or(0) as u32,
|
||||||
game_data
|
game_data
|
||||||
.get_primary_model_id(self.equipped.right_ring.id)
|
.get_primary_model_id(self.equipped.right_ring.apparent_id())
|
||||||
.unwrap_or(0) as u32,
|
.unwrap_or(0) as u32,
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ impl ChatHandler {
|
||||||
connection
|
connection
|
||||||
.player_data
|
.player_data
|
||||||
.inventory
|
.inventory
|
||||||
.add_in_next_free_slot(Item { quantity: 1, id });
|
.add_in_next_free_slot(Item::new(1, id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -524,7 +524,8 @@ impl ZoneConnection {
|
||||||
slot: slot_index,
|
slot: slot_index,
|
||||||
quantity: item.quantity,
|
quantity: item.quantity,
|
||||||
catalog_id: item.id,
|
catalog_id: item.id,
|
||||||
condition: 30000,
|
condition: item.condition,
|
||||||
|
glamour_catalog_id: item.glamour_catalog_id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -768,10 +769,9 @@ impl ZoneConnection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Task::AddItem { id } => {
|
Task::AddItem { id } => {
|
||||||
self.player_data.inventory.add_in_next_free_slot(Item {
|
self.player_data
|
||||||
id: *id,
|
.inventory
|
||||||
quantity: 1,
|
.add_in_next_free_slot(Item::new(1, *id));
|
||||||
});
|
|
||||||
self.send_inventory(false).await;
|
self.send_inventory(false).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ impl WorldDatabase {
|
||||||
struct InventoryItem {
|
struct InventoryItem {
|
||||||
slot: i32,
|
slot: i32,
|
||||||
quantity: u32,
|
quantity: u32,
|
||||||
condition: i32,
|
condition: u16,
|
||||||
id: u32,
|
id: u32,
|
||||||
glamour_id: u32,
|
glamour_id: u32,
|
||||||
}
|
}
|
||||||
|
@ -195,6 +195,8 @@ impl WorldDatabase {
|
||||||
*target.get_slot_mut(item.slot as u16) = Item {
|
*target.get_slot_mut(item.slot as u16) = Item {
|
||||||
quantity: item.quantity,
|
quantity: item.quantity,
|
||||||
id: item.id,
|
id: item.id,
|
||||||
|
condition: item.condition,
|
||||||
|
glamour_catalog_id: item.glamour_id,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue