mirror of
https://github.com/redstrate/Kawari.git
synced 2025-07-17 10:47:44 +00:00
Remove appearance updates from ZoneConnection::send_inventory
This isn't needed anymore.
This commit is contained in:
parent
b84462fd6f
commit
7cfa20052d
3 changed files with 33 additions and 49 deletions
|
@ -259,7 +259,7 @@ async fn client_loop(
|
|||
database.find_chara_make(connection.player_data.content_id);
|
||||
|
||||
// Send inventory
|
||||
connection.send_inventory(false, true).await;
|
||||
connection.send_inventory(true).await;
|
||||
|
||||
// set chara gear param
|
||||
connection
|
||||
|
@ -347,7 +347,7 @@ async fn client_loop(
|
|||
|
||||
let chara_details = database.find_chara_make(connection.player_data.content_id);
|
||||
|
||||
connection.send_inventory(false, false).await;
|
||||
connection.send_inventory(false).await;
|
||||
connection.send_stats(&chara_details).await;
|
||||
|
||||
let online_status = if connection.player_data.gm_rank == GameMasterRank::NormalUser {
|
||||
|
@ -813,24 +813,7 @@ async fn client_loop(
|
|||
|
||||
// if updated equipped items, we have to process that
|
||||
if action.src_storage_id == ContainerType::Equipped || action.dst_storage_id == ContainerType::Equipped {
|
||||
let main_weapon_id;
|
||||
let model_ids;
|
||||
{
|
||||
let mut game_data = connection.gamedata.lock().unwrap();
|
||||
let inventory = &connection.player_data.inventory;
|
||||
|
||||
main_weapon_id = inventory.get_main_weapon_id(&mut game_data);
|
||||
model_ids = inventory.get_model_ids(&mut game_data);
|
||||
}
|
||||
|
||||
connection.handle
|
||||
.send(ToServer::Equip(
|
||||
connection.id,
|
||||
connection.player_data.actor_id,
|
||||
main_weapon_id,
|
||||
model_ids,
|
||||
))
|
||||
.await;
|
||||
connection.inform_equip().await;
|
||||
}
|
||||
|
||||
if action.operation_type == ItemOperationKind::Discard {
|
||||
|
@ -906,7 +889,7 @@ async fn client_loop(
|
|||
// TODO: send the proper response packets!
|
||||
connection.player_data.inventory.currency.gil.quantity -= item_info.price_mid;
|
||||
connection.player_data.inventory.add_in_next_free_slot(Item::new(1, item_info.id));
|
||||
connection.send_inventory(false, false).await;
|
||||
connection.send_inventory(false).await;
|
||||
// TODO: send an actual system notice, this is just a placeholder to provide feedback that the player actually bought something.
|
||||
connection.send_message(&format!("You obtained one or more items: {} (id: {})!", item_info.name, item_info.id)).await;
|
||||
} else {
|
||||
|
|
|
@ -74,7 +74,8 @@ impl ChatHandler {
|
|||
}
|
||||
}
|
||||
|
||||
connection.send_inventory(true, false).await;
|
||||
connection.send_inventory(false).await;
|
||||
connection.inform_equip().await;
|
||||
true
|
||||
}
|
||||
"!item" => {
|
||||
|
@ -93,7 +94,7 @@ impl ChatHandler {
|
|||
}
|
||||
}
|
||||
|
||||
connection.send_inventory(false, false).await;
|
||||
connection.send_inventory(false).await;
|
||||
true
|
||||
}
|
||||
"!reload" => {
|
||||
|
|
|
@ -518,7 +518,29 @@ impl ZoneConnection {
|
|||
self.spawn_index
|
||||
}
|
||||
|
||||
pub async fn send_inventory(&mut self, send_appearance_update: bool, first_update: bool) {
|
||||
/// Inform other clients (including yourself) that you changed your equipped model ids.
|
||||
pub async fn inform_equip(&mut self) {
|
||||
let main_weapon_id;
|
||||
let model_ids;
|
||||
{
|
||||
let mut game_data = self.gamedata.lock().unwrap();
|
||||
let inventory = &self.player_data.inventory;
|
||||
|
||||
main_weapon_id = inventory.get_main_weapon_id(&mut game_data);
|
||||
model_ids = inventory.get_model_ids(&mut game_data);
|
||||
}
|
||||
|
||||
self.handle
|
||||
.send(ToServer::Equip(
|
||||
self.id,
|
||||
self.player_data.actor_id,
|
||||
main_weapon_id,
|
||||
model_ids,
|
||||
))
|
||||
.await;
|
||||
}
|
||||
|
||||
pub async fn send_inventory(&mut self, first_update: bool) {
|
||||
let mut last_sequence = 0;
|
||||
for (sequence, (container_type, container)) in (&self.player_data.inventory.clone())
|
||||
.into_iter()
|
||||
|
@ -654,28 +676,6 @@ impl ZoneConnection {
|
|||
.await;
|
||||
sequence += 1;
|
||||
}
|
||||
|
||||
// send them an appearance update
|
||||
if send_appearance_update {
|
||||
let main_weapon_id;
|
||||
let model_ids;
|
||||
{
|
||||
let mut game_data = self.gamedata.lock().unwrap();
|
||||
let inventory = &self.player_data.inventory;
|
||||
|
||||
main_weapon_id = inventory.get_main_weapon_id(&mut game_data);
|
||||
model_ids = inventory.get_model_ids(&mut game_data);
|
||||
}
|
||||
|
||||
self.handle
|
||||
.send(ToServer::Equip(
|
||||
self.id,
|
||||
self.player_data.actor_id,
|
||||
main_weapon_id,
|
||||
model_ids,
|
||||
))
|
||||
.await;
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn update_equip(&mut self, actor_id: u32, main_weapon_id: u64, model_ids: [u32; 10]) {
|
||||
|
@ -828,11 +828,11 @@ impl ZoneConnection {
|
|||
}
|
||||
Task::AddGil { amount } => {
|
||||
self.player_data.inventory.currency.get_slot_mut(0).quantity += *amount;
|
||||
self.send_inventory(false, false).await;
|
||||
self.send_inventory(false).await;
|
||||
}
|
||||
Task::RemoveGil { amount } => {
|
||||
self.player_data.inventory.currency.get_slot_mut(0).quantity -= *amount;
|
||||
self.send_inventory(false, false).await;
|
||||
self.send_inventory(false).await;
|
||||
}
|
||||
Task::UnlockOrchestrion { id, on } => {
|
||||
// id == 0 means "all"
|
||||
|
@ -860,7 +860,7 @@ impl ZoneConnection {
|
|||
self.player_data
|
||||
.inventory
|
||||
.add_in_next_free_slot(Item::new(1, *id));
|
||||
self.send_inventory(false, false).await;
|
||||
self.send_inventory(false).await;
|
||||
}
|
||||
Task::CompleteAllQuests {} => {
|
||||
self.player_data.completed_quests = vec![0xFF; COMPLETED_QUEST_BITMASK_SIZE];
|
||||
|
|
Loading…
Add table
Reference in a new issue