mirror of
https://github.com/redstrate/Kawari.git
synced 2025-04-21 15:07:45 +00:00
Fix sending status effects setting the player HP/MP to 0
For some reason we send some of the player's stats in this packet, and we can't keep them as 0 because the client will just kill the player.
This commit is contained in:
parent
5a358dd1b6
commit
88c7d2ee77
4 changed files with 36 additions and 14 deletions
|
@ -5,6 +5,5 @@ end
|
||||||
|
|
||||||
function doAction(player)
|
function doAction(player)
|
||||||
-- give sprint
|
-- give sprint
|
||||||
-- commented out because it breaks other stats due to stubs
|
player:give_status_effect(50, 5.0)
|
||||||
--player:give_status_effect(50, 5.0)
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,8 +2,8 @@ use std::sync::{Arc, Mutex};
|
||||||
|
|
||||||
use kawari::common::custom_ipc::{CustomIpcData, CustomIpcSegment, CustomIpcType};
|
use kawari::common::custom_ipc::{CustomIpcData, CustomIpcSegment, CustomIpcType};
|
||||||
use kawari::common::{
|
use kawari::common::{
|
||||||
INVALID_OBJECT_ID, ObjectId, ObjectTypeId, Position, determine_initial_starting_zone,
|
ObjectId, ObjectTypeId, Position, determine_initial_starting_zone, get_citystate,
|
||||||
get_citystate, get_world_name,
|
get_world_name,
|
||||||
};
|
};
|
||||||
use kawari::common::{get_racial_base_attributes, timestamp_secs};
|
use kawari::common::{get_racial_base_attributes, timestamp_secs};
|
||||||
use kawari::config::get_config;
|
use kawari::config::get_config;
|
||||||
|
@ -115,6 +115,13 @@ async fn main() {
|
||||||
// collect actor data
|
// collect actor data
|
||||||
connection.player_data =
|
connection.player_data =
|
||||||
database.find_player_data(actor_id.parse::<u32>().unwrap());
|
database.find_player_data(actor_id.parse::<u32>().unwrap());
|
||||||
|
// some still hardcoded values
|
||||||
|
connection.player_data.classjob_id = 1;
|
||||||
|
connection.player_data.level = 5;
|
||||||
|
connection.player_data.curr_hp = 100;
|
||||||
|
connection.player_data.max_hp = 100;
|
||||||
|
connection.player_data.curr_mp = 10000;
|
||||||
|
connection.player_data.max_mp = 10000;
|
||||||
|
|
||||||
exit_position = Some(connection.player_data.position);
|
exit_position = Some(connection.player_data.position);
|
||||||
exit_rotation = Some(connection.player_data.rotation);
|
exit_rotation = Some(connection.player_data.rotation);
|
||||||
|
@ -274,8 +281,8 @@ async fn main() {
|
||||||
vitality: attributes.vitality,
|
vitality: attributes.vitality,
|
||||||
intelligence: attributes.intelligence,
|
intelligence: attributes.intelligence,
|
||||||
mind: attributes.mind,
|
mind: attributes.mind,
|
||||||
hp: 100,
|
hp: connection.player_data.max_hp,
|
||||||
mp: 100,
|
mp: connection.player_data.max_mp as u32,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -373,12 +380,14 @@ async fn main() {
|
||||||
gm_rank: GameMasterRank::Debug,
|
gm_rank: GameMasterRank::Debug,
|
||||||
online_status: OnlineStatus::GameMasterBlue,
|
online_status: OnlineStatus::GameMasterBlue,
|
||||||
common: CommonSpawn {
|
common: CommonSpawn {
|
||||||
class_job: 1,
|
class_job: connection
|
||||||
|
.player_data
|
||||||
|
.classjob_id,
|
||||||
name: chara_details.name,
|
name: chara_details.name,
|
||||||
hp_curr: 100,
|
hp_curr: connection.player_data.curr_hp,
|
||||||
hp_max: 100,
|
hp_max: connection.player_data.max_hp,
|
||||||
mp_curr: 100,
|
mp_curr: connection.player_data.curr_mp,
|
||||||
mp_max: 100,
|
mp_max: connection.player_data.max_mp,
|
||||||
object_kind: ObjectKind::Player(
|
object_kind: ObjectKind::Player(
|
||||||
PlayerSubKind::Player,
|
PlayerSubKind::Player,
|
||||||
),
|
),
|
||||||
|
|
|
@ -25,6 +25,13 @@ pub struct PlayerData {
|
||||||
pub content_id: u64,
|
pub content_id: u64,
|
||||||
pub account_id: u32,
|
pub account_id: u32,
|
||||||
|
|
||||||
|
pub classjob_id: u8,
|
||||||
|
pub level: u8,
|
||||||
|
pub curr_hp: u32,
|
||||||
|
pub max_hp: u32,
|
||||||
|
pub curr_mp: u16,
|
||||||
|
pub max_mp: u16,
|
||||||
|
|
||||||
// Dynamic data
|
// Dynamic data
|
||||||
pub position: Position,
|
pub position: Position,
|
||||||
/// In radians.
|
/// In radians.
|
||||||
|
@ -132,10 +139,10 @@ impl ZoneConnection {
|
||||||
op_code: ServerZoneIpcType::UpdateClassInfo,
|
op_code: ServerZoneIpcType::UpdateClassInfo,
|
||||||
timestamp: timestamp_secs(),
|
timestamp: timestamp_secs(),
|
||||||
data: ServerZoneIpcData::UpdateClassInfo(UpdateClassInfo {
|
data: ServerZoneIpcData::UpdateClassInfo(UpdateClassInfo {
|
||||||
class_id: 1,
|
class_id: self.player_data.classjob_id as u16,
|
||||||
unknown: 1,
|
unknown: 1,
|
||||||
synced_level: 90,
|
synced_level: self.player_data.level as u16,
|
||||||
class_level: 90,
|
class_level: self.player_data.level as u16,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -323,6 +330,12 @@ impl ZoneConnection {
|
||||||
timestamp: timestamp_secs(),
|
timestamp: timestamp_secs(),
|
||||||
data: ServerZoneIpcData::StatusEffectList(StatusEffectList {
|
data: ServerZoneIpcData::StatusEffectList(StatusEffectList {
|
||||||
statues: list,
|
statues: list,
|
||||||
|
classjob_id: self.player_data.classjob_id,
|
||||||
|
level: self.player_data.level,
|
||||||
|
curr_hp: self.player_data.curr_hp,
|
||||||
|
max_hp: self.player_data.max_hp,
|
||||||
|
curr_mp: self.player_data.curr_mp,
|
||||||
|
max_mp: self.player_data.max_mp,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|
|
@ -84,6 +84,7 @@ impl WorldDatabase {
|
||||||
},
|
},
|
||||||
rotation,
|
rotation,
|
||||||
zone_id,
|
zone_id,
|
||||||
|
..Default::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue