+ UpdateParty event
This commit is contained in:
@@ -108,3 +108,31 @@ macro_rules! decode_float {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
macro_rules! decode_vec_of_number_vec {
|
||||||
|
($val:expr, $index:expr, $name:expr) => {
|
||||||
|
if let Some(p) = $val.get(&$index) {
|
||||||
|
match p {
|
||||||
|
Value::Array(v) => {
|
||||||
|
let mut ret = vec![];
|
||||||
|
for i in v {
|
||||||
|
let mut params = Parameters::new();
|
||||||
|
params.insert(0, i.clone());
|
||||||
|
let item = decode_number_vec!(params, 0, $name)?;
|
||||||
|
ret.push(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
Some(ret)
|
||||||
|
},
|
||||||
|
_ => {
|
||||||
|
error!("Failed to decode {}", $name);
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -152,6 +152,130 @@
|
|||||||
"param_type": "Items"
|
"param_type": "Items"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "PartyInvitation",
|
||||||
|
"code": 210,
|
||||||
|
"params": [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "PartyJoined",
|
||||||
|
"code": 211,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"name": "party_id",
|
||||||
|
"id": 0,
|
||||||
|
"param_type": "Number"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "party_structures",
|
||||||
|
"id": 4,
|
||||||
|
"param_type": "ListOfNumberList"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "character_names",
|
||||||
|
"id": 5,
|
||||||
|
"param_type": "StringList"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "PartyDisbanded",
|
||||||
|
"code": 212,
|
||||||
|
"params": [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "PartyPlayerJoined",
|
||||||
|
"code": 213,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"name": "party_id",
|
||||||
|
"id": 0,
|
||||||
|
"param_type": "Number"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "party_structure",
|
||||||
|
"id": 1,
|
||||||
|
"param_type": "NumberList"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "name",
|
||||||
|
"id": 2,
|
||||||
|
"param_type": "String"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "PartyChangedOrder",
|
||||||
|
"code": 214,
|
||||||
|
"params": [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "PartyPlayerLeft",
|
||||||
|
"code": 215,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"name": "party_id",
|
||||||
|
"id": 0,
|
||||||
|
"param_type": "Number"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "party_structure",
|
||||||
|
"id": 1,
|
||||||
|
"param_type": "NumberList"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "PartyLeaderChanged",
|
||||||
|
"code": 216,
|
||||||
|
"params": [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "PartyLootSettingChangedPlayer",
|
||||||
|
"code": 217,
|
||||||
|
"params": [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "PartySilverGained",
|
||||||
|
"code": 218,
|
||||||
|
"params": [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "PartyPlayerUpdated",
|
||||||
|
"code": 219,
|
||||||
|
"params": [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "PartyInvitationPlayerBusy",
|
||||||
|
"code": 220,
|
||||||
|
"params": [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "PartyMarkedObjectsUpdated",
|
||||||
|
"code": 221,
|
||||||
|
"params": [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "PartyOnClusterPartyJoined",
|
||||||
|
"code": 222,
|
||||||
|
"params": [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "PartySetRoleFlag",
|
||||||
|
"code": 223,
|
||||||
|
"params": [
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": [
|
"responses": [
|
||||||
|
|||||||
+7
-1
@@ -11,7 +11,9 @@ enum ParamType
|
|||||||
Float,
|
Float,
|
||||||
String,
|
String,
|
||||||
Items,
|
Items,
|
||||||
StringList
|
StringList,
|
||||||
|
NumberList,
|
||||||
|
ListOfNumberList,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ParamType {
|
impl ParamType {
|
||||||
@@ -22,6 +24,8 @@ impl ParamType {
|
|||||||
ParamType::String => "String",
|
ParamType::String => "String",
|
||||||
ParamType::Items => "Items",
|
ParamType::Items => "Items",
|
||||||
ParamType::StringList => "Vec<String>",
|
ParamType::StringList => "Vec<String>",
|
||||||
|
ParamType::NumberList => "Vec<u32>",
|
||||||
|
ParamType::ListOfNumberList => "Vec<Vec<u32>>",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,6 +36,8 @@ impl ParamType {
|
|||||||
ParamType::String => "decode_string!",
|
ParamType::String => "decode_string!",
|
||||||
ParamType::Items => "decode_number_vec!",
|
ParamType::Items => "decode_number_vec!",
|
||||||
ParamType::StringList => "decode_string_vec!",
|
ParamType::StringList => "decode_string_vec!",
|
||||||
|
ParamType::NumberList => "decode_number_vec!",
|
||||||
|
ParamType::ListOfNumberList => "decode_vec_of_number_vec!",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,10 @@ impl ToPyObject for Event {
|
|||||||
Event::HealthReceived(e) => {
|
Event::HealthReceived(e) => {
|
||||||
event.set_item(py, "name", "HealthReceived".into_py_object(py)).unwrap_or(());
|
event.set_item(py, "name", "HealthReceived".into_py_object(py)).unwrap_or(());
|
||||||
event.set_item(py, "value", e.into_py_object(py)).unwrap_or(());
|
event.set_item(py, "value", e.into_py_object(py)).unwrap_or(());
|
||||||
|
},
|
||||||
|
Event::UpdateParty(e) => {
|
||||||
|
event.set_item(py, "name", "UpdateParty".into_py_object(py)).unwrap_or(());
|
||||||
|
event.set_item(py, "value", e.into_py_object(py)).unwrap_or(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,6 +113,17 @@ impl ToPyObject for events::Items {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl ToPyObject for events::Party {
|
||||||
|
type ObjectType = PyObject;
|
||||||
|
fn to_py_object(&self, py: Python) -> Self::ObjectType {
|
||||||
|
let event = PyDict::new(py);
|
||||||
|
|
||||||
|
event.set_item(py, "player_names", self.player_names.clone().into_py_object(py)).unwrap_or(());
|
||||||
|
event.into_object()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
macro_rules! set_dict_item {
|
macro_rules! set_dict_item {
|
||||||
($py:ident, $dict:ident, $from:ident, $field_name:ident) => {
|
($py:ident, $dict:ident, $from:ident, $field_name:ident) => {
|
||||||
if let Ok(_) = $dict.set_item($py, stringify!($field_name), $from.$field_name.to_py_object($py))
|
if let Ok(_) = $dict.set_item($py, stringify!($field_name), $from.$field_name.to_py_object($py))
|
||||||
|
|||||||
@@ -29,6 +29,11 @@ pub struct Items {
|
|||||||
pub value: photon_messages::Items,
|
pub value: photon_messages::Items,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
|
pub struct Party {
|
||||||
|
pub player_names: Vec<String>,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub enum Event {
|
pub enum Event {
|
||||||
MainPlayerAppeared(Player),
|
MainPlayerAppeared(Player),
|
||||||
@@ -40,4 +45,5 @@ pub enum Event {
|
|||||||
LeaveCombat(Player),
|
LeaveCombat(Player),
|
||||||
UpdateFame(Fame),
|
UpdateFame(Fame),
|
||||||
UpdateItems(Items),
|
UpdateItems(Items),
|
||||||
|
UpdateParty(Party),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ pub mod convert;
|
|||||||
pub mod world;
|
pub mod world;
|
||||||
pub mod id_cache;
|
pub mod id_cache;
|
||||||
|
|
||||||
|
mod party;
|
||||||
mod unconsumed_messages;
|
mod unconsumed_messages;
|
||||||
mod player;
|
mod player;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,75 @@
|
|||||||
|
use crate::photon_messages::messages;
|
||||||
|
|
||||||
|
use super::events;
|
||||||
|
|
||||||
|
use log::*;
|
||||||
|
|
||||||
|
#[derive(Debug, PartialEq, Default)]
|
||||||
|
struct Item {
|
||||||
|
name: String,
|
||||||
|
id: u32,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, PartialEq, Default)]
|
||||||
|
pub struct Party {
|
||||||
|
main_player_name: Option<String>,
|
||||||
|
items: Vec<Item>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Party {
|
||||||
|
pub fn set_main_player_name(&mut self, name: &str) {
|
||||||
|
self.main_player_name = Some(name.to_owned());
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn player_left(&mut self, left: messages::PartyPlayerLeft) -> Option<events::Event> {
|
||||||
|
let main_player_name = self.main_player_name.as_ref()?;
|
||||||
|
let party_item = self.items.iter().find(|i| i.id == into_id(&left.party_structure))?;
|
||||||
|
if &party_item.name == main_player_name {
|
||||||
|
return self.disbanded();
|
||||||
|
}
|
||||||
|
|
||||||
|
let index = self.items.iter().position(|i| i.id == into_id(&left.party_structure))?;
|
||||||
|
self.items.remove(index);
|
||||||
|
|
||||||
|
self.game_event()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn single_player_joined(&mut self, joined: messages::PartyPlayerJoined) -> Option<events::Event> {
|
||||||
|
self.items.push(Item{name: joined.name.clone(), id: into_id(&joined.party_structure)});
|
||||||
|
|
||||||
|
self.game_event()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn joined(&mut self, joined: messages::PartyJoined) -> Option<events::Event> {
|
||||||
|
let structures_and_names = joined
|
||||||
|
.party_structures
|
||||||
|
.iter()
|
||||||
|
.zip(joined.character_names.iter());
|
||||||
|
|
||||||
|
self.items = structures_and_names
|
||||||
|
.map(|(structure, name)| Item {
|
||||||
|
name: name.clone(),
|
||||||
|
id: into_id(&structure),
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
self.game_event()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn disbanded(&mut self) -> Option<events::Event> {
|
||||||
|
self.items = vec![];
|
||||||
|
self.game_event()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn game_event(&self) -> Option<events::Event> {
|
||||||
|
let names : Vec<String> = self.items.iter().map(|i| i.name.clone()).collect();
|
||||||
|
let evt = Some(events::Event::UpdateParty(events::Party{player_names: names}));
|
||||||
|
|
||||||
|
info!("Party changed: {:?}", evt);
|
||||||
|
evt
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn into_id(party_structure: &[u32]) -> u32 {
|
||||||
|
party_structure.into_iter().fold(0, |acc, x| acc + x)
|
||||||
|
}
|
||||||
@@ -10,6 +10,7 @@ use super::events;
|
|||||||
use super::convert;
|
use super::convert;
|
||||||
use super::convert::EventList;
|
use super::convert::EventList;
|
||||||
use super::id_cache;
|
use super::id_cache;
|
||||||
|
use super::party::{Party};
|
||||||
use super::player::{StaticId, DynamicId};
|
use super::player::{StaticId, DynamicId};
|
||||||
use super::unconsumed_messages::UnconsumedMessages;
|
use super::unconsumed_messages::UnconsumedMessages;
|
||||||
|
|
||||||
@@ -18,6 +19,7 @@ pub struct World {
|
|||||||
cache: id_cache::IdCache,
|
cache: id_cache::IdCache,
|
||||||
unconsumed_messages: UnconsumedMessages,
|
unconsumed_messages: UnconsumedMessages,
|
||||||
main_player_id: Option<StaticId>,
|
main_player_id: Option<StaticId>,
|
||||||
|
party: Party
|
||||||
}
|
}
|
||||||
|
|
||||||
impl World {
|
impl World {
|
||||||
@@ -60,7 +62,7 @@ impl World {
|
|||||||
if self.main_player_id.is_none() {
|
if self.main_player_id.is_none() {
|
||||||
result.push(events::Event::ZoneChange)
|
result.push(events::Event::ZoneChange)
|
||||||
}
|
}
|
||||||
|
self.party.set_main_player_name(&msg.character_name);
|
||||||
result.push(self.get_intermediate(static_id, msg)?.into());
|
result.push(self.get_intermediate(static_id, msg)?.into());
|
||||||
|
|
||||||
|
|
||||||
@@ -107,7 +109,53 @@ impl World {
|
|||||||
self.unconsumed_messages.add(
|
self.unconsumed_messages.add(
|
||||||
photon_messages::messages::Message::CharacterEquipmentChanged(msg), id);
|
photon_messages::messages::Message::CharacterEquipmentChanged(msg), id);
|
||||||
None
|
None
|
||||||
}
|
},
|
||||||
|
photon_messages::Message::PartyInvitation(_) => {
|
||||||
|
None
|
||||||
|
},
|
||||||
|
photon_messages::Message::PartyJoined(msg) => {
|
||||||
|
let evt = self.party.joined(msg)?;
|
||||||
|
Some(vec![evt])
|
||||||
|
},
|
||||||
|
photon_messages::Message::PartyDisbanded(_) => {
|
||||||
|
let evt = self.party.disbanded()?;
|
||||||
|
Some(vec![evt])
|
||||||
|
},
|
||||||
|
photon_messages::Message::PartyPlayerJoined(msg) => {
|
||||||
|
let evt = self.party.single_player_joined(msg)?;
|
||||||
|
Some(vec![evt])
|
||||||
|
},
|
||||||
|
photon_messages::Message::PartyChangedOrder(_) => {
|
||||||
|
None
|
||||||
|
},
|
||||||
|
photon_messages::Message::PartyPlayerLeft(msg) => {
|
||||||
|
let evt = self.party.player_left(msg)?;
|
||||||
|
Some(vec![evt])
|
||||||
|
},
|
||||||
|
photon_messages::Message::PartyLeaderChanged(_) => {
|
||||||
|
None
|
||||||
|
},
|
||||||
|
photon_messages::Message::PartyLootSettingChangedPlayer(_) => {
|
||||||
|
None
|
||||||
|
},
|
||||||
|
photon_messages::Message::PartySilverGained(_) => {
|
||||||
|
None
|
||||||
|
},
|
||||||
|
photon_messages::Message::PartyPlayerUpdated(_) => {
|
||||||
|
None
|
||||||
|
},
|
||||||
|
photon_messages::Message::PartyInvitationPlayerBusy(_) => {
|
||||||
|
None
|
||||||
|
},
|
||||||
|
photon_messages::Message::PartyMarkedObjectsUpdated(_) => {
|
||||||
|
None
|
||||||
|
},
|
||||||
|
photon_messages::Message::PartyOnClusterPartyJoined(_) => {
|
||||||
|
None
|
||||||
|
},
|
||||||
|
photon_messages::Message::PartySetRoleFlag(_) => {
|
||||||
|
None
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn assign_dynamic_id(&mut self, id: DynamicId, name: &str) {
|
fn assign_dynamic_id(&mut self, id: DynamicId, name: &str) {
|
||||||
|
|||||||
@@ -114,6 +114,34 @@ macro_rules! decode_float {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
macro_rules! decode_vec_of_number_vec {
|
||||||
|
($val:expr, $index:expr, $name:expr) => {
|
||||||
|
if let Some(p) = $val.get(&$index) {
|
||||||
|
match p {
|
||||||
|
Value::Array(v) => {
|
||||||
|
let mut ret = vec![];
|
||||||
|
for i in v {
|
||||||
|
let mut params = Parameters::new();
|
||||||
|
params.insert(0, i.clone());
|
||||||
|
let item = decode_number_vec!(params, 0, $name)?;
|
||||||
|
ret.push(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
Some(ret)
|
||||||
|
},
|
||||||
|
_ => {
|
||||||
|
error!("Failed to decode {}", $name);
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Default)]
|
#[derive(Debug, Clone, PartialEq, Default)]
|
||||||
pub struct Leave {
|
pub struct Leave {
|
||||||
pub source: usize,
|
pub source: usize,
|
||||||
@@ -258,6 +286,218 @@ impl CharacterEquipmentChanged {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, Default)]
|
||||||
|
pub struct PartyInvitation {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PartyInvitation {
|
||||||
|
pub fn parse(val: Parameters) -> Option<Message> {
|
||||||
|
info!("PartyInvitation parameters: {:?}", val);
|
||||||
|
|
||||||
|
|
||||||
|
Some(Message::PartyInvitation(PartyInvitation { }))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, Default)]
|
||||||
|
pub struct PartyJoined {
|
||||||
|
pub party_id: usize,
|
||||||
|
pub party_structures: Vec<Vec<u32>>,
|
||||||
|
pub character_names: Vec<String>,
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PartyJoined {
|
||||||
|
pub fn parse(val: Parameters) -> Option<Message> {
|
||||||
|
info!("PartyJoined parameters: {:?}", val);
|
||||||
|
let party_id = decode_number!(val, 0, "PartyJoined::party_id")?;
|
||||||
|
let party_structures = decode_vec_of_number_vec!(val, 4, "PartyJoined::party_structures")?;
|
||||||
|
let character_names = decode_string_vec!(val, 5, "PartyJoined::character_names")?;
|
||||||
|
|
||||||
|
|
||||||
|
Some(Message::PartyJoined(PartyJoined { party_id, party_structures, character_names, }))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, Default)]
|
||||||
|
pub struct PartyDisbanded {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PartyDisbanded {
|
||||||
|
pub fn parse(val: Parameters) -> Option<Message> {
|
||||||
|
info!("PartyDisbanded parameters: {:?}", val);
|
||||||
|
|
||||||
|
|
||||||
|
Some(Message::PartyDisbanded(PartyDisbanded { }))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, Default)]
|
||||||
|
pub struct PartyPlayerJoined {
|
||||||
|
pub party_id: usize,
|
||||||
|
pub party_structure: Vec<u32>,
|
||||||
|
pub name: String,
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PartyPlayerJoined {
|
||||||
|
pub fn parse(val: Parameters) -> Option<Message> {
|
||||||
|
info!("PartyPlayerJoined parameters: {:?}", val);
|
||||||
|
let party_id = decode_number!(val, 0, "PartyPlayerJoined::party_id")?;
|
||||||
|
let party_structure = decode_number_vec!(val, 1, "PartyPlayerJoined::party_structure")?;
|
||||||
|
let name = decode_string!(val, 2, "PartyPlayerJoined::name")?;
|
||||||
|
|
||||||
|
|
||||||
|
Some(Message::PartyPlayerJoined(PartyPlayerJoined { party_id, party_structure, name, }))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, Default)]
|
||||||
|
pub struct PartyChangedOrder {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PartyChangedOrder {
|
||||||
|
pub fn parse(val: Parameters) -> Option<Message> {
|
||||||
|
info!("PartyChangedOrder parameters: {:?}", val);
|
||||||
|
|
||||||
|
|
||||||
|
Some(Message::PartyChangedOrder(PartyChangedOrder { }))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, Default)]
|
||||||
|
pub struct PartyPlayerLeft {
|
||||||
|
pub party_id: usize,
|
||||||
|
pub party_structure: Vec<u32>,
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PartyPlayerLeft {
|
||||||
|
pub fn parse(val: Parameters) -> Option<Message> {
|
||||||
|
info!("PartyPlayerLeft parameters: {:?}", val);
|
||||||
|
let party_id = decode_number!(val, 0, "PartyPlayerLeft::party_id")?;
|
||||||
|
let party_structure = decode_number_vec!(val, 1, "PartyPlayerLeft::party_structure")?;
|
||||||
|
|
||||||
|
|
||||||
|
Some(Message::PartyPlayerLeft(PartyPlayerLeft { party_id, party_structure, }))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, Default)]
|
||||||
|
pub struct PartyLeaderChanged {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PartyLeaderChanged {
|
||||||
|
pub fn parse(val: Parameters) -> Option<Message> {
|
||||||
|
info!("PartyLeaderChanged parameters: {:?}", val);
|
||||||
|
|
||||||
|
|
||||||
|
Some(Message::PartyLeaderChanged(PartyLeaderChanged { }))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, Default)]
|
||||||
|
pub struct PartyLootSettingChangedPlayer {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PartyLootSettingChangedPlayer {
|
||||||
|
pub fn parse(val: Parameters) -> Option<Message> {
|
||||||
|
info!("PartyLootSettingChangedPlayer parameters: {:?}", val);
|
||||||
|
|
||||||
|
|
||||||
|
Some(Message::PartyLootSettingChangedPlayer(PartyLootSettingChangedPlayer { }))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, Default)]
|
||||||
|
pub struct PartySilverGained {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PartySilverGained {
|
||||||
|
pub fn parse(val: Parameters) -> Option<Message> {
|
||||||
|
info!("PartySilverGained parameters: {:?}", val);
|
||||||
|
|
||||||
|
|
||||||
|
Some(Message::PartySilverGained(PartySilverGained { }))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, Default)]
|
||||||
|
pub struct PartyPlayerUpdated {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PartyPlayerUpdated {
|
||||||
|
pub fn parse(val: Parameters) -> Option<Message> {
|
||||||
|
info!("PartyPlayerUpdated parameters: {:?}", val);
|
||||||
|
|
||||||
|
|
||||||
|
Some(Message::PartyPlayerUpdated(PartyPlayerUpdated { }))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, Default)]
|
||||||
|
pub struct PartyInvitationPlayerBusy {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PartyInvitationPlayerBusy {
|
||||||
|
pub fn parse(val: Parameters) -> Option<Message> {
|
||||||
|
info!("PartyInvitationPlayerBusy parameters: {:?}", val);
|
||||||
|
|
||||||
|
|
||||||
|
Some(Message::PartyInvitationPlayerBusy(PartyInvitationPlayerBusy { }))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, Default)]
|
||||||
|
pub struct PartyMarkedObjectsUpdated {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PartyMarkedObjectsUpdated {
|
||||||
|
pub fn parse(val: Parameters) -> Option<Message> {
|
||||||
|
info!("PartyMarkedObjectsUpdated parameters: {:?}", val);
|
||||||
|
|
||||||
|
|
||||||
|
Some(Message::PartyMarkedObjectsUpdated(PartyMarkedObjectsUpdated { }))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, Default)]
|
||||||
|
pub struct PartyOnClusterPartyJoined {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PartyOnClusterPartyJoined {
|
||||||
|
pub fn parse(val: Parameters) -> Option<Message> {
|
||||||
|
info!("PartyOnClusterPartyJoined parameters: {:?}", val);
|
||||||
|
|
||||||
|
|
||||||
|
Some(Message::PartyOnClusterPartyJoined(PartyOnClusterPartyJoined { }))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, Default)]
|
||||||
|
pub struct PartySetRoleFlag {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PartySetRoleFlag {
|
||||||
|
pub fn parse(val: Parameters) -> Option<Message> {
|
||||||
|
info!("PartySetRoleFlag parameters: {:?}", val);
|
||||||
|
|
||||||
|
|
||||||
|
Some(Message::PartySetRoleFlag(PartySetRoleFlag { }))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Default)]
|
#[derive(Debug, Clone, PartialEq, Default)]
|
||||||
pub struct Join {
|
pub struct Join {
|
||||||
pub source: usize,
|
pub source: usize,
|
||||||
@@ -293,6 +533,20 @@ pub enum Message {
|
|||||||
NewCharacter(NewCharacter),
|
NewCharacter(NewCharacter),
|
||||||
UpdateFame(UpdateFame),
|
UpdateFame(UpdateFame),
|
||||||
CharacterEquipmentChanged(CharacterEquipmentChanged),
|
CharacterEquipmentChanged(CharacterEquipmentChanged),
|
||||||
|
PartyInvitation(PartyInvitation),
|
||||||
|
PartyJoined(PartyJoined),
|
||||||
|
PartyDisbanded(PartyDisbanded),
|
||||||
|
PartyPlayerJoined(PartyPlayerJoined),
|
||||||
|
PartyChangedOrder(PartyChangedOrder),
|
||||||
|
PartyPlayerLeft(PartyPlayerLeft),
|
||||||
|
PartyLeaderChanged(PartyLeaderChanged),
|
||||||
|
PartyLootSettingChangedPlayer(PartyLootSettingChangedPlayer),
|
||||||
|
PartySilverGained(PartySilverGained),
|
||||||
|
PartyPlayerUpdated(PartyPlayerUpdated),
|
||||||
|
PartyInvitationPlayerBusy(PartyInvitationPlayerBusy),
|
||||||
|
PartyMarkedObjectsUpdated(PartyMarkedObjectsUpdated),
|
||||||
|
PartyOnClusterPartyJoined(PartyOnClusterPartyJoined),
|
||||||
|
PartySetRoleFlag(PartySetRoleFlag),
|
||||||
Join(Join),
|
Join(Join),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,6 +565,20 @@ pub fn into_game_message(photon_message: photon_decode::Message) -> Option<Messa
|
|||||||
Some(photon_decode::Value::Short(24)) => NewCharacter::parse(parameters),
|
Some(photon_decode::Value::Short(24)) => NewCharacter::parse(parameters),
|
||||||
Some(photon_decode::Value::Short(72)) => UpdateFame::parse(parameters),
|
Some(photon_decode::Value::Short(72)) => UpdateFame::parse(parameters),
|
||||||
Some(photon_decode::Value::Short(79)) => CharacterEquipmentChanged::parse(parameters),
|
Some(photon_decode::Value::Short(79)) => CharacterEquipmentChanged::parse(parameters),
|
||||||
|
Some(photon_decode::Value::Short(210)) => PartyInvitation::parse(parameters),
|
||||||
|
Some(photon_decode::Value::Short(211)) => PartyJoined::parse(parameters),
|
||||||
|
Some(photon_decode::Value::Short(212)) => PartyDisbanded::parse(parameters),
|
||||||
|
Some(photon_decode::Value::Short(213)) => PartyPlayerJoined::parse(parameters),
|
||||||
|
Some(photon_decode::Value::Short(214)) => PartyChangedOrder::parse(parameters),
|
||||||
|
Some(photon_decode::Value::Short(215)) => PartyPlayerLeft::parse(parameters),
|
||||||
|
Some(photon_decode::Value::Short(216)) => PartyLeaderChanged::parse(parameters),
|
||||||
|
Some(photon_decode::Value::Short(217)) => PartyLootSettingChangedPlayer::parse(parameters),
|
||||||
|
Some(photon_decode::Value::Short(218)) => PartySilverGained::parse(parameters),
|
||||||
|
Some(photon_decode::Value::Short(219)) => PartyPlayerUpdated::parse(parameters),
|
||||||
|
Some(photon_decode::Value::Short(220)) => PartyInvitationPlayerBusy::parse(parameters),
|
||||||
|
Some(photon_decode::Value::Short(221)) => PartyMarkedObjectsUpdated::parse(parameters),
|
||||||
|
Some(photon_decode::Value::Short(222)) => PartyOnClusterPartyJoined::parse(parameters),
|
||||||
|
Some(photon_decode::Value::Short(223)) => PartySetRoleFlag::parse(parameters),
|
||||||
|
|
||||||
_ => None
|
_ => None
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user