Extend item pickup UI to group members

This commit is contained in:
Couls 2022-09-20 22:13:50 +00:00 committed by Imbris
parent 7ea720b2ef
commit 4a4c061b55
32 changed files with 106 additions and 64 deletions

View File

@ -33,6 +33,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
distance at which lower detail models are used for entities).
- Present mode options renamed for clarity: Fifo -> 'Vsync capped', Mailbox -> 'Vsync uncapped',
Immediate -> 'Vsync off'.
- Item pickup UI now displays items that members of your group pick up.
### Removed

View File

@ -23,7 +23,7 @@ hud-chat-npc_ranged_kill_msg = { $attacker } застрэліў(-ла) [{ $victi
hud-chat-npc_explosion_kill_msg = { $attacker } падарваў(-ла) [{ $victim }]
hud-chat-npc_energy_kill_msg = { $attacker } забіў(-ла) [{ $victim }] чарамі
hud-chat-npc_other_kill_msg = { $attacker } забіў(-ла) [{ $victim }]
hud-chat-loot_msg = Вы падабралі [{ $item }]
hud-chat-loot_fail = У вашых торбах не хапае месца!
hud-chat-goodbye = Да пабачэння!
hud-chat-connection_lost = Злучэнне згублена. Вас выштурхнуць праз { $time } сек.

View File

@ -23,7 +23,7 @@ hud-chat-npc_ranged_kill_msg = { $attacker } ha disparat [{ $victim }]
hud-chat-npc_explosion_kill_msg = { $attacker } ha fet explotar [{ $victim }]
hud-chat-npc_energy_kill_msg = { $attacker } ha matat [{ $victim }] amb màgia
hud-chat-npc_other_kill_msg = { $attacker } ha matat [{ $victim }]
hud-chat-loot_msg = Has recollit [{ $item }]
hud-chat-loot_fail = La teva bossa és plena!
hud-chat-goodbye = Adeu!
hud-chat-connection_lost = S'ha perdut la connexió. Tancament en { $time } segons.

View File

@ -23,7 +23,7 @@ hud-chat-npc_ranged_kill_msg = { $attacker } zastřelil/a [{ $victim }]
hud-chat-npc_explosion_kill_msg = { $attacker } vyhodil/a do vzduchu [{ $victim }]
hud-chat-npc_energy_kill_msg = { $attacker } zabil/a [{ $victim }] kouzlem
hud-chat-npc_other_kill_msg = { $attacker } zabil/a [{ $victim }]
hud-chat-loot_msg = Sebral/a jsi [{ $item }]
hud-chat-loot_fail = Máš plný inventář!
hud-chat-goodbye = Nashledanou!
hud-chat-connection_lost = Připojení ztraceno. Ukončuji za { $time } sekund.

View File

@ -23,7 +23,7 @@ hud-chat-npc_ranged_kill_msg = { $attacker } erschoss [{ $victim }]
hud-chat-npc_explosion_kill_msg = { $attacker } sprengte [{ $victim }] aus dem Leben
hud-chat-npc_energy_kill_msg = { $attacker } tötete [{ $victim }] mit Magie
hud-chat-npc_other_kill_msg = { $attacker } tötete [{ $victim }]
hud-chat-loot_msg = Du hast [{ $item }] aufgehoben
hud-chat-loot_fail = Dein Inventar ist voll!
hud-chat-goodbye = Auf Wiedersehen!
hud-chat-connection_lost = Verbindungsabbruch. Du wirst in { $time } Sekunden gekickt.

View File

@ -23,7 +23,10 @@ hud-chat-npc_ranged_kill_msg = { $attacker } shot [{ $victim }]
hud-chat-npc_explosion_kill_msg = { $attacker } blew up [{ $victim }]
hud-chat-npc_energy_kill_msg = { $attacker } killed [{ $victim }] with magic
hud-chat-npc_other_kill_msg = { $attacker } killed [{ $victim }]
hud-chat-loot_msg = You picked up [{ $item }]
hud-loot-pickup-msg = {$actor} picked up { $amount ->
[one] { $item }
*[other] {$amount}x {$item}
}
hud-chat-loot_fail = Your Inventory is full!
hud-chat-goodbye = Goodbye!
hud-chat-connection_lost = Connection lost. Kicking in { $time } seconds.

View File

@ -23,7 +23,7 @@ hud-chat-npc_ranged_kill_msg = { $attacker } disparó a [{ $victim }]
hud-chat-npc_explosion_kill_msg = { $attacker } hizo explotar a [{ $victim }]
hud-chat-npc_energy_kill_msg = [{ $attacker }] mató a [{ $victim }] con magia
hud-chat-npc_other_kill_msg = [{ $attacker }] mató a [{ $victim }]
hud-chat-loot_msg = Recogiste [{ $item }]
hud-chat-loot_fail = ¡Tu inventario está lleno!
hud-chat-goodbye = ¡Adiós!
hud-chat-connection_lost = Conexión perdida. Expulsando en { $time } segundos.

View File

@ -23,7 +23,7 @@ hud-chat-npc_ranged_kill_msg = { $attacker } le disparó a [{ $victim }]
hud-chat-npc_explosion_kill_msg = { $attacker } hizo explotar a [{ $victim }]
hud-chat-npc_energy_kill_msg = { $attacker } usó magia para matar a [{ $victim }]
hud-chat-npc_other_kill_msg = { $attacker } mató a [{ $victim }]
hud-chat-loot_msg = Recogiste [{ $item }]
hud-chat-loot_fail = ¡Tu inventario está lleno!
hud-chat-goodbye = ¡Adiós!
hud-chat-connection_lost = Conexión perdida. Expulsando en { $time } segundos.

View File

@ -23,7 +23,7 @@ hud-chat-npc_ranged_kill_msg = { $attacker }-(e)k [{ $victim }] tiroz hil du
hud-chat-npc_explosion_kill_msg = { $attacker }-(e)k [{ $victim }] leherrarazi du
hud-chat-npc_energy_kill_msg = { $attacker }-(e)k [{ $victim }] magiaz hil du
hud-chat-npc_other_kill_msg = { $attacker }-(e)k [{ $victim }] hil du
hud-chat-loot_msg = [{ $item }] jaso duzu
hud-chat-loot_fail = Inbentarioa beteta duzu!
hud-chat-goodbye = Agur!
hud-chat-connection_lost = Konexioa galdu duzu. { $time } segundo barru kanporatua izango zara.

View File

@ -23,7 +23,7 @@ hud-chat-npc_ranged_kill_msg = { $attacker } a tiré sur [{ $victim }]
hud-chat-npc_explosion_kill_msg = { $attacker } a fait exploser [{ $victim }]
hud-chat-npc_energy_kill_msg = [{ $attacker }] a tué [{ $victim }] avec de la magie
hud-chat-npc_other_kill_msg = [{ $attacker }] a tué [{ $victim }]
hud-chat-loot_msg = Vous avez ramassé [{ $item }]
hud-chat-loot_fail = Votre inventaire est plein !
hud-chat-goodbye = Au revoir!
hud-chat-connection_lost = Connexion perdue. Expulsion dans { $time } secondes.

View File

@ -23,7 +23,7 @@ hud-chat-npc_ranged_kill_msg = { $attacker } lelőtte őt: [{ $victim }]
hud-chat-npc_explosion_kill_msg = { $attacker } felrobbantotta őt:[{ $victim }]
hud-chat-npc_energy_kill_msg = { $attacker } mágiával megölte őt: [{ $victim }]
hud-chat-npc_other_kill_msg = { $attacker } megölte őt: [{ $victim }]
hud-chat-loot_msg = Felvetted a következőt: [{ $item }]
hud-chat-loot_fail = Túl sok a holmid!
hud-chat-goodbye = Viszlát!
hud-chat-connection_lost = Megszakadt a kapcsolat. Szétkapcsolás { $time } másodpercen belül.

View File

@ -23,7 +23,7 @@ hud-chat-npc_ranged_kill_msg = { $attacker } ha assassinato [{ $victim }]
hud-chat-npc_explosion_kill_msg = { $attacker } ha fatto esplodere [{ $victim }]
hud-chat-npc_energy_kill_msg = { $attacker } ha ucciso [{ $victim }] con la magia
hud-chat-npc_other_kill_msg = { $attacker } ha ucciso [{ $victim }]
hud-chat-loot_msg = Hai raccolto [{ $item }]
hud-chat-loot_fail = Il tuo inventario è pieno!
hud-chat-goodbye = Arrivederci!
hud-chat-connection_lost = Connessione persa. Verrai cacciato tra { $time } secondi.

View File

@ -16,7 +16,7 @@ hud-chat-npc_ranged_kill_msg = { $attacker }は[{ $victim }]を撃ちました
hud-chat-npc_explosion_kill_msg = { $attacker }は[{ $victim }]を爆破しました
hud-chat-npc_energy_kill_msg = { $attacker }は魔法で[{ $victim }]を殺しました
hud-chat-npc_other_kill_msg = { $attacker }は[{ $victim }]を殺しました
hud-chat-loot_msg = [{ $item }]を拾った
hud-chat-loot_fail = 持ち物がいっぱいです!
hud-chat-goodbye = さようなら!
hud-chat-connection_lost = 接続が切れました。キックされて{ $time }秒。

View File

@ -11,7 +11,7 @@ hud-chat-pvp_energy_kill_msg = [{ $attacker }] gebruikte magie om [{ $victim }]
hud-chat-npc_melee_kill_msg = { $attacker } dode [{ $victim }]
hud-chat-npc_ranged_kill_msg = { $attacker } schoot [{ $victim }]
hud-chat-npc_explosion_kill_msg = { $attacker } blies [{ $victim }] op
hud-chat-loot_msg = Je raapte [{ $item }] op
hud-chat-loot_fail = Jouw inventory is vol!
hud-chat-goodbye = Vaarwel!
hud-chat-connection_lost = Verbinding verloren. Je wordt in { $time } seconden gekicked.

View File

@ -14,7 +14,7 @@ hud-chat-npc_ranged_kill_msg = { $attacker } skjøt [{ $victim }]
hud-chat-npc_explosion_kill_msg = { $attacker } sprengte [{ $victim }]
hud-chat-npc_energy_kill_msg = { $attacker } drepte [{ $victim }] med magi
hud-chat-npc_other_kill_msg = { $attacker } drepte [{ $victim }]
hud-chat-loot_msg = Du plukket opp [{ $item }]
hud-chat-loot_fail = Ditt inventar er fullt!
hud-chat-goodbye = Adjø!
hud-chat-connection_lost = Forbindelse mistet. Utkastet om { $time } sekunder.

View File

@ -23,7 +23,7 @@ hud-chat-npc_ranged_kill_msg = { $attacker } ustrzela [{ $victim }]
hud-chat-npc_explosion_kill_msg = { $attacker } wysadza [{ $victim }]
hud-chat-npc_energy_kill_msg = { $attacker } zabija [{ $victim }] magią
hud-chat-npc_other_kill_msg = { $attacker } zabija [{ $victim }]
hud-chat-loot_msg = Podniesiono [{ $item }]
hud-chat-loot_fail = Twój ekwipunek jest pełen!
hud-chat-goodbye = Żegnaj!
hud-chat-connection_lost = Stracono połączenie. Wyrzucanie za { $time } sekund.

View File

@ -23,7 +23,7 @@ hud-chat-npc_ranged_kill_msg = { $attacker } atirou em [{ $victim }]
hud-chat-npc_explosion_kill_msg = { $attacker } explodiu [{ $victim }]
hud-chat-npc_energy_kill_msg = [{ $attacker }] matou [{ $victim }] com magia
hud-chat-npc_other_kill_msg = [{ $attacker }] matou [{ $victim }]
hud-chat-loot_msg = Você pegou [{ $item }]
hud-chat-loot_fail = Seu Inventário está cheio!
hud-chat-goodbye = Até Logo!
hud-chat-connection_lost = Conexão perdida. Expulsando em { $time } segundos.

View File

@ -23,7 +23,7 @@ hud-chat-npc_ranged_kill_msg = { $attacker } a tras în [{ $victim }]
hud-chat-npc_explosion_kill_msg = { $attacker } a facut ca [{ $victim }] să explodeze
hud-chat-npc_energy_kill_msg = { $attacker } a omorât [{ $victim }] cu magie
hud-chat-npc_other_kill_msg = { $attacker } a omorât [{ $victim }]
hud-chat-loot_msg = Ai luat [{ $item }]
hud-chat-loot_fail = Inventarul tău este plin!
hud-chat-goodbye = Pe curând!
hud-chat-connection_lost = Conexiune pierdută. Vei fi dat afară în { $time } secunde.

View File

@ -23,7 +23,6 @@ hud-chat-npc_ranged_kill_msg = { $attacker } застрелил [{ $victim }]
hud-chat-npc_explosion_kill_msg = { $attacker } взорвал [{ $victim }]
hud-chat-npc_energy_kill_msg = { $attacker } убил [{ $victim }] магией
hud-chat-npc_other_kill_msg = { $attacker } убил [{ $victim }]
hud-chat-loot_msg = Вы подобрали [{ $item }]
hud-chat-loot_fail = Ваш инвентарь полон!
hud-chat-loot_fail = Ваш инвернарь полон!
hud-chat-goodbye = До свидания!
hud-chat-connection_lost = Соединение потеряно. Выход через { $time } секунд.

View File

@ -23,7 +23,7 @@ hud-chat-npc_ranged_kill_msg = { $attacker } је упуца/ла [{ $victim }]
hud-chat-npc_explosion_kill_msg = { $attacker } је разнео/ла [{ $victim }]
hud-chat-npc_energy_kill_msg = { $attacker } је убио/ла [{ $victim }] магијомc
hud-chat-npc_other_kill_msg = { $attacker } је убио/ла [{ $victim }]
hud-chat-loot_msg = Покупио/ла си [{ $item }]
hud-chat-loot_fail = Твој инвентар је пун!
hud-chat-goodbye = Збогом!
hud-chat-connection_lost = Веза се прекинула. Бићеш избачен/а за { $time } секунди.

View File

@ -23,7 +23,7 @@ hud-chat-npc_ranged_kill_msg = { $attacker } sköt [{ $victim }]
hud-chat-npc_explosion_kill_msg = { $attacker } sprängde [{ $victim }]
hud-chat-npc_energy_kill_msg = { $attacker } dödade [{ $victim }] med trolldom
hud-chat-npc_other_kill_msg = { $attacker } dödade [{ $victim }]
hud-chat-loot_msg = Du plockade upp [{ $item }]
hud-chat-loot_fail = Din packning är full!
hud-chat-goodbye = Hejdå!
hud-chat-connection_lost = Anslutningen bröts. Sparkas ut om { $time } sekunder.

View File

@ -23,7 +23,7 @@ hud-chat-npc_ranged_kill_msg = [{ $victim }] โดนลั่นหัวค
hud-chat-npc_explosion_kill_msg = [{ $victim }] โดนระเบิดเป็นชิ้น ๆ โดย { $attacker } น่าเเห็นใจ
hud-chat-npc_energy_kill_msg = { $attacker } สังหาร [{ $victim }] ด้วยไสยเวทย์ น่าเเห็นใจ
hud-chat-npc_other_kill_msg = [{ $victim }] ถูกสังหารโดย { $attacker } น่าเเห็นใจ
hud-chat-loot_msg = ได้รับ [{ $item }]
hud-chat-loot_fail = กระเป๋าเต็มแล้ว
hud-chat-goodbye = ลาก่อน
hud-chat-connection_lost = ถูกตัดการเชื่อมต่อ เชื่อมต่อใหม่ในอีก { $time } วินาที

View File

@ -14,7 +14,7 @@ hud-chat-npc_ranged_kill_msg = [{ $victim }], { $attacker } tarafından vuruldu.
hud-chat-npc_explosion_kill_msg = [{ $victim }], { $attacker } tarafından havaya uçuruldu.
hud-chat-npc_energy_kill_msg = [{ $victim }], { $attacker } tarafından büyü ile mağlup edildi.
hud-chat-npc_other_kill_msg = [{ $victim }], { $attacker } tarafından öldürüldü.
hud-chat-loot_msg = [{ $item }] topladın.
hud-chat-loot_fail = Envanterin dolu!
hud-chat-goodbye = Hoşçakal!
hud-chat-connection_lost = Bağlantı koptu. { $time } saniye içinde sunucudan atılacaksın.

View File

@ -23,7 +23,7 @@ hud-chat-npc_ranged_kill_msg = { $attacker } застрелили [{ $victim }]
hud-chat-npc_explosion_kill_msg = { $attacker } підірвали [{ $victim }]
hud-chat-npc_energy_kill_msg = { $attacker } вбили [{ $victim }] магією
hud-chat-npc_other_kill_msg = { $attacker } вбили [{ $victim }]
hud-chat-loot_msg = Ви підібрали [{ $item }]
hud-chat-loot_fail = Ваш інвентар переповнено!
hud-chat-goodbye = До побачення!
hud-chat-connection_lost = З'єднання втрачено. Перепідключення через { $time } секунд(и/у).

View File

@ -23,7 +23,7 @@ hud-chat-npc_ranged_kill_msg = { $attacker } đã bắn [{ $victim }]
hud-chat-npc_explosion_kill_msg = { $attacker } đã nổ tung [{ $victim }]
hud-chat-npc_energy_kill_msg = { $attacker } đã giết [{ $victim }] bằng phép thuật
hud-chat-npc_other_kill_msg = { $attacker } đã giết [{ $victim }]
hud-chat-loot_msg = Bạn đã nhặt được [{ $item }]
hud-chat-loot_fail = Kho đồ của bạn đã đầy!
hud-chat-goodbye = Tạm biệt!
hud-chat-connection_lost = Mất kết nối. Thoát ra sau { $time } giây.

View File

@ -16,7 +16,7 @@ hud-chat-npc_ranged_kill_msg = { $attacker }射杀了[{ $victim }]
hud-chat-npc_explosion_kill_msg = { $attacker }炸死了[{ $victim }]
hud-chat-npc_energy_kill_msg = { $attacker }用魔法击杀了[{ $victim }]
hud-chat-npc_other_kill_msg = { $attacker }击杀了[{ $victim }]
hud-chat-loot_msg = 你捡起了[{ $item }]
hud-chat-loot_fail = 你的背包已满!
hud-chat-goodbye = 再见!
hud-chat-connection_lost = 连接已断开. { $time }秒内将被踢出.

View File

@ -88,6 +88,7 @@ const PING_ROLLING_AVERAGE_SECS: usize = 10;
#[derive(Debug)]
pub enum Event {
Chat(comp::ChatMsg),
GroupInventoryUpdate(comp::Item, String, Uid),
InviteComplete {
target: Uid,
answer: InviteAnswer,
@ -2247,6 +2248,9 @@ impl Client {
kind,
});
},
ServerGeneral::GroupInventoryUpdate(item, taker, uid) => {
frontend_events.push(Event::GroupInventoryUpdate(item, taker, uid));
},
// Cleanup for when the client goes back to the `presence = None`
ServerGeneral::ExitInGameSuccess => {
self.presence = None;
@ -2595,7 +2599,7 @@ impl Client {
}
/// Change player alias to "You" if client belongs to matching player
fn personalize_alias(&self, uid: Uid, alias: String) -> String {
pub fn personalize_alias(&self, uid: Uid, alias: String) -> String {
let client_uid = self.uid().expect("Client doesn't have a Uid!!!");
if client_uid == uid {
"You".to_string() // TODO: Localize

View File

@ -152,6 +152,8 @@ pub enum ServerGeneral {
/// Indicate to the client that their sent invite was not invalid and is
/// currently pending
InvitePending(Uid),
/// Update the HUD of the clients in the group
GroupInventoryUpdate(comp::Item, String, Uid),
/// Note: this could potentially include all the failure cases such as
/// inviting yourself in which case the `InvitePending` message could be
/// removed and the client could consider their invite pending until
@ -310,6 +312,7 @@ impl ServerMsg {
| ServerGeneral::InviteComplete { .. }
| ServerGeneral::ExitInGameSuccess
| ServerGeneral::InventoryUpdate(_, _)
| ServerGeneral::GroupInventoryUpdate(_, _, _)
| ServerGeneral::TerrainChunkUpdate { .. }
| ServerGeneral::LodZoneUpdate { .. }
| ServerGeneral::TerrainBlockUpdates(_)

View File

@ -183,6 +183,7 @@ impl Client {
| ServerGeneral::InviteComplete { .. }
| ServerGeneral::ExitInGameSuccess
| ServerGeneral::InventoryUpdate(_, _)
| ServerGeneral::GroupInventoryUpdate(_, _, _)
| ServerGeneral::SetViewDistance(_)
| ServerGeneral::Outcomes(_)
| ServerGeneral::Knockback(_)

View File

@ -25,8 +25,7 @@ use comp::LightEmitter;
use crate::{client::Client, Server, StateExt};
use common::{
comp::{
pet::is_tameable, Alignment, Body, ChatType, CollectFailedReason, Group,
InventoryUpdateEvent, Player,
pet::is_tameable, Alignment, Body, CollectFailedReason, Group, InventoryUpdateEvent, Player,
},
event::{EventBus, ServerEvent},
};
@ -228,7 +227,15 @@ pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::Inv
);
let ecs = state.ecs();
if let Some(group_id) = ecs.read_storage::<Group>().get(entity) {
announce_loot_to_group(group_id, ecs, entity, &item_msg.name());
announce_loot_to_group(
group_id,
ecs,
entity,
item_msg.duplicate(
&state.ecs().read_resource::<AbilityMap>(),
&state.ecs().read_resource::<MaterialStatManifest>(),
),
);
}
comp::InventoryUpdate::new(InventoryUpdateEvent::Collected(item_msg))
},
@ -256,7 +263,15 @@ pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::Inv
Ok(_) => {
let ecs = state.ecs();
if let Some(group_id) = ecs.read_storage::<Group>().get(entity) {
announce_loot_to_group(group_id, ecs, entity, &item_msg.name());
announce_loot_to_group(
group_id,
ecs,
entity,
item_msg.duplicate(
&state.ecs().read_resource::<AbilityMap>(),
&state.ecs().read_resource::<MaterialStatManifest>(),
),
);
}
comp::InventoryUpdate::new(InventoryUpdateEvent::Collected(
item_msg,
@ -907,28 +922,34 @@ fn announce_loot_to_group(
group_id: &Group,
ecs: &specs::World,
entity: EcsEntity,
item_name: &str,
item: comp::Item,
) {
let clients = ecs.read_storage::<Client>();
members(
*group_id,
&ecs.read_storage(),
&ecs.entities(),
&ecs.read_storage(),
&ecs.read_storage::<Uid>(),
)
.filter(|(member_e, _)| member_e != &entity)
.for_each(|(e, _)| {
clients.get(e).and_then(|c| {
ecs.read_storage::<comp::Stats>().get(entity).map(|stats| {
c.send_fallible(ServerGeneral::server_msg(
ChatType::Meta,
format!("{} picked up {}", stats.name, item_name),
));
})
let uids = ecs.read_storage();
if let Some(uid) = uids.get(entity) {
members(
*group_id,
&ecs.read_storage(),
&ecs.entities(),
&ecs.read_storage(),
&ecs.read_storage::<Uid>(),
)
.filter(|(member_e, _)| member_e != &entity)
.for_each(|(e, _)| {
clients.get(e).and_then(|c| {
ecs.read_storage::<comp::Stats>().get(entity).map(|stats| {
c.send_fallible(ServerGeneral::GroupInventoryUpdate(
item.duplicate(
&ecs.read_resource::<AbilityMap>(),
&ecs.read_resource::<MaterialStatManifest>(),
),
stats.name.to_string(),
*uid,
))
})
});
});
});
}
}
#[cfg(test)]

View File

@ -102,6 +102,7 @@ impl<'a> LootScroller<'a> {
pub struct LootMessage {
pub item: Item,
pub amount: u32,
pub taken_by: String,
}
pub struct State {
@ -291,7 +292,11 @@ impl<'a> Widget for LootScroller<'a> {
let i = list_message.i;
let (message, age) = messages_to_display[i];
let LootMessage { item, amount } = message;
let LootMessage {
item,
amount,
taken_by,
} = message;
let alpha = 1.0 - age.min(show_all_age).powi(4);
@ -340,12 +345,14 @@ impl<'a> Widget for LootScroller<'a> {
&item_tooltip,
)
.set(state.ids.message_icons[i], ui);
let label = if *amount == 1 {
item.name().into_owned()
} else {
format!("{}x {}", amount, item.name())
};
let label = self.localized_strings.get_msg_ctx(
"hud-loot-pickup-msg",
&i18n::fluent_args! {
"actor" => taken_by,
"amount" => amount,
"item" => item.name(),
},
);
let label_font_size = 20;
Text::new(&label)

View File

@ -17,10 +17,7 @@ use common::{
comp::{
inventory::slot::{EquipSlot, Slot},
invite::InviteKind,
item::{
tool::{AbilityMap, ToolKind},
ItemDesc, MaterialStatManifest,
},
item::{tool::ToolKind, ItemDesc},
ChatMsg, ChatType, InputKind, InventoryUpdateEvent, Pos, Stats, UtteranceKind, Vel,
},
consts::MAX_MOUNT_RANGE,
@ -223,6 +220,13 @@ impl SessionState {
client::Event::Chat(m) => {
self.hud.new_message(m);
},
client::Event::GroupInventoryUpdate(item, taker, uid) => {
self.hud.new_loot_message(LootMessage {
amount: item.amount(),
item,
taken_by: client.personalize_alias(uid, taker),
});
},
client::Event::InviteComplete {
target,
answer,
@ -312,11 +316,10 @@ impl SessionState {
}
},
InventoryUpdateEvent::Collected(item) => {
let ability_map = AbilityMap::load().read();
let msm = MaterialStatManifest::load().read();
self.hud.new_loot_message(LootMessage {
item: item.duplicate(&ability_map, &msm),
amount: item.amount(),
item,
taken_by: "You".to_string(),
});
},
_ => {},