feat: Implement dvd watermark :xdskull:
This commit is contained in:
@@ -71,8 +71,8 @@ impl Gateway {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn establish_kcp_session(&mut self, data: u32, addr: SocketAddr) -> Result<()> {
|
async fn establish_kcp_session(&mut self, data: u32, addr: SocketAddr) -> Result<()> {
|
||||||
tracing::info!("New connection from {addr}");
|
|
||||||
let (conv_id, session_token) = self.next_conv_pair();
|
let (conv_id, session_token) = self.next_conv_pair();
|
||||||
|
tracing::info!("New connection from addr: {addr} with conv_id: {conv_id}");
|
||||||
|
|
||||||
self.sessions.lock().await.insert(
|
self.sessions.lock().await.insert(
|
||||||
conv_id,
|
conv_id,
|
||||||
@@ -127,6 +127,13 @@ impl Gateway {
|
|||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO: Temporary fix
|
||||||
|
if session.read().await.is_destroyed {
|
||||||
|
drop(session);
|
||||||
|
self.sessions.lock().await.remove(&conv_id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
if let Err(err) = Box::pin(session.write().await.consume(&data)).await {
|
if let Err(err) = Box::pin(session.write().await.consume(&data)).await {
|
||||||
tracing::error!("An error occurred while processing session ({addr}): {err}");
|
tracing::error!("An error occurred while processing session ({addr}): {err}");
|
||||||
|
|||||||
@@ -191,20 +191,8 @@ async fn create_battle_info(caster_id: u32, skill_index: u32) -> SceneBattleInfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
// pf score object
|
// pf score object
|
||||||
if player.battle_config.battle_type == BattleType::PF && battle_info.stage_id < 30309041 {
|
if player.battle_config.battle_type == BattleType::PF {
|
||||||
battle_info.battle_target_info.insert(
|
if battle_info.stage_id >= 30309011 {
|
||||||
1,
|
|
||||||
BattleTargetList {
|
|
||||||
battle_target_list: vec![BattleTarget {
|
|
||||||
id: 10002,
|
|
||||||
progress: 0,
|
|
||||||
..Default::default()
|
|
||||||
}],
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
else { // idk wtf im doing, someone pls optimal it, but atleast it work
|
|
||||||
battle_info.battle_target_info.insert(
|
battle_info.battle_target_info.insert(
|
||||||
1,
|
1,
|
||||||
BattleTargetList {
|
BattleTargetList {
|
||||||
@@ -215,13 +203,25 @@ async fn create_battle_info(caster_id: u32, skill_index: u32) -> SceneBattleInfo
|
|||||||
}],
|
}],
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
battle_info.battle_target_info.insert(
|
||||||
|
1,
|
||||||
|
BattleTargetList {
|
||||||
|
battle_target_list: vec![BattleTarget {
|
||||||
|
id: 10002,
|
||||||
|
progress: 0,
|
||||||
|
..Default::default()
|
||||||
|
}],
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
for i in 2..=4 {
|
for i in 2..=4 {
|
||||||
battle_info
|
battle_info
|
||||||
.battle_target_info
|
.battle_target_info
|
||||||
.insert(i, BattleTargetList::default());
|
.insert(i, BattleTargetList::default());
|
||||||
}
|
}
|
||||||
if player.battle_config.battle_type == BattleType::PF {
|
|
||||||
battle_info.battle_target_info.insert(
|
battle_info.battle_target_info.insert(
|
||||||
5,
|
5,
|
||||||
BattleTargetList {
|
BattleTargetList {
|
||||||
@@ -240,6 +240,7 @@ if player.battle_config.battle_type == BattleType::PF {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apocalyptic Shadow
|
// Apocalyptic Shadow
|
||||||
if player.battle_config.battle_type == BattleType::AS {
|
if player.battle_config.battle_type == BattleType::AS {
|
||||||
battle_info.battle_target_info.insert(
|
battle_info.battle_target_info.insert(
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
use std::sync::atomic::Ordering;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
net::{
|
net::{
|
||||||
tools::{FreesrData, MultiPathAvatar},
|
tools::{FreesrData, MultiPathAvatar},
|
||||||
@@ -11,7 +13,8 @@ use super::*;
|
|||||||
const SERVER_UID: u32 = 727;
|
const SERVER_UID: u32 = 727;
|
||||||
const SERVER_HEAD_ICON: u32 = 201008;
|
const SERVER_HEAD_ICON: u32 = 201008;
|
||||||
const SERVER_CHAT_BUBBLE_ID: u32 = 220005;
|
const SERVER_CHAT_BUBBLE_ID: u32 = 220005;
|
||||||
const SERVER_CHAT_HISTORY: [&str; 4] = [
|
const SERVER_CHAT_HISTORY: [&str; 5] = [
|
||||||
|
"'dvd' render a dvd bouncing effect. you need to put the image into your game folder, with name \"image.png\"",
|
||||||
"'sync'",
|
"'sync'",
|
||||||
"'mc {mc_id}' mc_id can be set from 8001 to 8006",
|
"'mc {mc_id}' mc_id can be set from 8001 to 8006",
|
||||||
"'march {march_id}' march_id can be set 1001 or 1224",
|
"'march {march_id}' march_id can be set 1001 or 1224",
|
||||||
@@ -155,6 +158,23 @@ pub async fn on_send_msg_cs_req(
|
|||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
"dvd" => {
|
||||||
|
session.toggle_dvd().await;
|
||||||
|
session
|
||||||
|
.send(RevcMsgScNotify {
|
||||||
|
msg_type: body.msg_type,
|
||||||
|
text: format!(
|
||||||
|
"DVD toggled to {}",
|
||||||
|
session.dvd_running.load(Ordering::SeqCst)
|
||||||
|
),
|
||||||
|
emote: body.emote,
|
||||||
|
from_uid: SERVER_UID,
|
||||||
|
to_uid: 25,
|
||||||
|
chat_type: body.chat_type,
|
||||||
|
})
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,12 +24,12 @@ pub async fn on_player_heart_beat_cs_req(
|
|||||||
) {
|
) {
|
||||||
res.client_time_ms = body.client_time_ms;
|
res.client_time_ms = body.client_time_ms;
|
||||||
res.server_time_ms = cur_timestamp_ms();
|
res.server_time_ms = cur_timestamp_ms();
|
||||||
res.download_data = Some(ClientDownloadData {
|
// res.download_data = Some(ClientDownloadData {
|
||||||
version: 51,
|
// version: 51,
|
||||||
time: res.server_time_ms as i64,
|
// time: res.server_time_ms as i64,
|
||||||
data: rbase64::decode("bG9jYWwgZnVuY3Rpb24gYmV0YV90ZXh0KG9iaikKICAgIGxvY2FsIGdhbWVPYmplY3QgPSBDUy5Vbml0eUVuZ2luZS5HYW1lT2JqZWN0LkZpbmQoIlVJUm9vdC9BYm92ZURpYWxvZy9CZXRhSGludERpYWxvZyhDbG9uZSkiKQoKICAgIGlmIGdhbWVPYmplY3QgdGhlbgogICAgICAgIGxvY2FsIHRleHRDb21wb25lbnQgPSBnYW1lT2JqZWN0OkdldENvbXBvbmVudEluQ2hpbGRyZW4odHlwZW9mKENTLlJQRy5DbGllbnQuTG9jYWxpemVkVGV4dCkpCgogICAgICAgIGlmIHRleHRDb21wb25lbnQgdGhlbgogICAgICAgICAgICB0ZXh0Q29tcG9uZW50LnRleHQgPSAiUm9iaW5TUiBpcyBhIGZyZWUgYW5kIG9wZW4gc291cmNlIHNvZnR3YXJlLiBkaXNjb3JkLmdnL3JldmVyc2Vkcm9vbXMiCiAgICAgICAgZW5kCiAgICBlbHNlCiAgICBlbmQKZW5kCgpiZXRhX3RleHQoKQ==").unwrap(),
|
// data: rbase64::decode("bG9jYWwgZnVuY3Rpb24gYmV0YV90ZXh0KG9iaikKICAgIGxvY2FsIGdhbWVPYmplY3QgPSBDUy5Vbml0eUVuZ2luZS5HYW1lT2JqZWN0LkZpbmQoIlVJUm9vdC9BYm92ZURpYWxvZy9CZXRhSGludERpYWxvZyhDbG9uZSkiKQoKICAgIGlmIGdhbWVPYmplY3QgdGhlbgogICAgICAgIGxvY2FsIHRleHRDb21wb25lbnQgPSBnYW1lT2JqZWN0OkdldENvbXBvbmVudEluQ2hpbGRyZW4odHlwZW9mKENTLlJQRy5DbGllbnQuTG9jYWxpemVkVGV4dCkpCgogICAgICAgIGlmIHRleHRDb21wb25lbnQgdGhlbgogICAgICAgICAgICB0ZXh0Q29tcG9uZW50LnRleHQgPSAiUm9iaW5TUiBpcyBhIGZyZWUgYW5kIG9wZW4gc291cmNlIHNvZnR3YXJlLiBkaXNjb3JkLmdnL3JldmVyc2Vkcm9vbXMiCiAgICAgICAgZW5kCiAgICBlbHNlCiAgICBlbmQKZW5kCgpiZXRhX3RleHQoKQ==").unwrap(),
|
||||||
njddjhapnbo: 0
|
// njddjhapnbo: 0
|
||||||
});
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn on_player_login_finish_cs_req(
|
pub async fn on_player_login_finish_cs_req(
|
||||||
@@ -53,7 +53,9 @@ pub async fn on_player_login_finish_cs_req(
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
.await
|
.await?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn on_get_multi_path_avatar_info_cs_req(
|
pub async fn on_get_multi_path_avatar_info_cs_req(
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -4,7 +4,7 @@ use std::{collections::HashMap, fs, sync::LazyLock};
|
|||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Vector {
|
pub struct Vector {
|
||||||
pub x: i32, // or f32 depending on your needs
|
pub x: i32,
|
||||||
pub y: i32,
|
pub y: i32,
|
||||||
pub z: i32,
|
pub z: i32,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2897,6 +2897,15 @@ pub struct Cijjendfjlo {
|
|||||||
#[prost(uint32, tag = "1")]
|
#[prost(uint32, tag = "1")]
|
||||||
pub kklaobblgce: u32,
|
pub kklaobblgce: u32,
|
||||||
}
|
}
|
||||||
|
/// Obf: CIJNHLEPACK
|
||||||
|
#[derive(proto_derive::CmdID)]
|
||||||
|
#[cmdid(15)]
|
||||||
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||||
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
|
pub struct ClientDownloadDataScNotify {
|
||||||
|
#[prost(message, optional, tag = "2")]
|
||||||
|
pub download_data: ::core::option::Option<ClientDownloadData>,
|
||||||
|
}
|
||||||
#[derive(proto_derive::CmdID)]
|
#[derive(proto_derive::CmdID)]
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
||||||
#[repr(i32)]
|
#[repr(i32)]
|
||||||
|
|||||||
Reference in New Issue
Block a user