mirror of
https://github.com/yoncodes/BD2PS.git
synced 2026-08-05 06:12:14 +02:00
changed file section
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
use actix_web::{put, web, HttpResponse, Result};
|
||||
use bd2::proto::proto_net::CafeteriaCumulativeRewardRequest;
|
||||
use crypto::network::parse_packet;
|
||||
use gameserver::logic::game::cafeteria::cafeteria_cumulative_reward;
|
||||
use sqlx::SqlitePool;
|
||||
|
||||
#[put("CafeteriaCumulativeReward")]
|
||||
async fn cafeteria_cumulative_reward_handler(
|
||||
pool: web::Data<SqlitePool>,
|
||||
body: String,
|
||||
user_id: web::ReqData<i64>,
|
||||
) -> Result<HttpResponse> {
|
||||
let uid = *user_id;
|
||||
let req = parse_packet::<CafeteriaCumulativeRewardRequest>("CafeteriaCumulativeReward", &body)
|
||||
.map_err(|e| {
|
||||
tracing::warn!("Failed to parse CafeteriaCumulativeReward: {}", e);
|
||||
actix_web::error::ErrorBadRequest("Invalid packet")
|
||||
})?;
|
||||
let response = cafeteria_cumulative_reward::handle(&pool, uid, req).await;
|
||||
Ok(HttpResponse::Ok().json(response))
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
use actix_web::{put, web, HttpResponse, Result};
|
||||
use bd2::proto::proto_net::CafeteriaDailyConnectionCostumeRefreshRequest;
|
||||
use crypto::network::parse_packet;
|
||||
use gameserver::logic::game::cafeteria::cafeteria_daily_connection_costume_refresh;
|
||||
use sqlx::SqlitePool;
|
||||
|
||||
#[put("CafeteriaDailyConnectionCostumeRefresh")]
|
||||
async fn cafeteria_daily_connection_costume_refresh_handler(
|
||||
pool: web::Data<SqlitePool>,
|
||||
body: String,
|
||||
user_id: web::ReqData<i64>,
|
||||
) -> Result<HttpResponse> {
|
||||
let uid = *user_id;
|
||||
let req = parse_packet::<CafeteriaDailyConnectionCostumeRefreshRequest>(
|
||||
"CafeteriaDailyConnectionCostumeRefresh",
|
||||
&body,
|
||||
)
|
||||
.map_err(|e| {
|
||||
tracing::warn!(
|
||||
"Failed to parse CafeteriaDailyConnectionCostumeRefresh: {}",
|
||||
e
|
||||
);
|
||||
actix_web::error::ErrorBadRequest("Invalid packet")
|
||||
})?;
|
||||
let response = cafeteria_daily_connection_costume_refresh::handle(&pool, uid, req).await;
|
||||
Ok(HttpResponse::Ok().json(response))
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
use actix_web::{put, web, HttpResponse, Result};
|
||||
use bd2::proto::proto_net::CafeteriaEventNpcInteractionRewardRequest;
|
||||
use crypto::network::parse_packet;
|
||||
use gameserver::logic::game::cafeteria::cafeteria_event_npc_interaction_reward;
|
||||
use sqlx::SqlitePool;
|
||||
|
||||
#[put("CafeteriaEventNpcInteractionReward")]
|
||||
async fn cafeteria_event_npc_interaction_reward_handler(
|
||||
pool: web::Data<SqlitePool>,
|
||||
body: String,
|
||||
user_id: web::ReqData<i64>,
|
||||
) -> Result<HttpResponse> {
|
||||
let uid = *user_id;
|
||||
let req = parse_packet::<CafeteriaEventNpcInteractionRewardRequest>(
|
||||
"CafeteriaEventNpcInteractionReward",
|
||||
&body,
|
||||
)
|
||||
.map_err(|e| {
|
||||
tracing::warn!("Failed to parse CafeteriaEventNpcInteractionReward: {}", e);
|
||||
actix_web::error::ErrorBadRequest("Invalid packet")
|
||||
})?;
|
||||
let response = cafeteria_event_npc_interaction_reward::handle(&pool, uid, req).await;
|
||||
Ok(HttpResponse::Ok().json(response))
|
||||
}
|
||||
20
httpserver/src/routes/game/cafeteria/cafeteria_info.rs
Normal file
20
httpserver/src/routes/game/cafeteria/cafeteria_info.rs
Normal file
@@ -0,0 +1,20 @@
|
||||
use actix_web::{put, web, HttpResponse, Result};
|
||||
use bd2::proto::proto_net::CafeteriaInfoRequest;
|
||||
use crypto::network::parse_packet;
|
||||
use gameserver::logic::game::cafeteria::cafeteria_info;
|
||||
use sqlx::SqlitePool;
|
||||
|
||||
#[put("CafeteriaInfo")]
|
||||
async fn cafeteria_info_handler(
|
||||
pool: web::Data<SqlitePool>,
|
||||
body: String,
|
||||
user_id: web::ReqData<i64>,
|
||||
) -> Result<HttpResponse> {
|
||||
let uid = *user_id;
|
||||
let req = parse_packet::<CafeteriaInfoRequest>("CafeteriaInfo", &body).map_err(|e| {
|
||||
tracing::warn!("Failed to parse CafeteriaInfo: {}", e);
|
||||
actix_web::error::ErrorBadRequest("Invalid packet")
|
||||
})?;
|
||||
let response = cafeteria_info::handle(&pool, uid, req).await;
|
||||
Ok(HttpResponse::Ok().json(response))
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
use actix_web::{put, web, HttpResponse, Result};
|
||||
use bd2::proto::proto_net::CafeteriaIntroductionStoryRewardRequest;
|
||||
use crypto::network::parse_packet;
|
||||
use gameserver::logic::game::cafeteria::cafeteria_introduction_story_reward;
|
||||
use sqlx::SqlitePool;
|
||||
|
||||
#[put("CafeteriaIntroductionStoryReward")]
|
||||
async fn cafeteria_introduction_story_reward_handler(
|
||||
pool: web::Data<SqlitePool>,
|
||||
body: String,
|
||||
user_id: web::ReqData<i64>,
|
||||
) -> Result<HttpResponse> {
|
||||
let uid = *user_id;
|
||||
let req = parse_packet::<CafeteriaIntroductionStoryRewardRequest>(
|
||||
"CafeteriaIntroductionStoryReward",
|
||||
&body,
|
||||
)
|
||||
.map_err(|e| {
|
||||
tracing::warn!("Failed to parse CafeteriaIntroductionStoryReward: {}", e);
|
||||
actix_web::error::ErrorBadRequest("Invalid packet")
|
||||
})?;
|
||||
let response = cafeteria_introduction_story_reward::handle(&pool, uid, req).await;
|
||||
Ok(HttpResponse::Ok().json(response))
|
||||
}
|
||||
20
httpserver/src/routes/game/cafeteria/cafeteria_level_up.rs
Normal file
20
httpserver/src/routes/game/cafeteria/cafeteria_level_up.rs
Normal file
@@ -0,0 +1,20 @@
|
||||
use actix_web::{put, web, HttpResponse, Result};
|
||||
use bd2::proto::proto_net::CafeteriaLevelUpRequest;
|
||||
use crypto::network::parse_packet;
|
||||
use gameserver::logic::game::cafeteria::cafeteria_level_up;
|
||||
use sqlx::SqlitePool;
|
||||
|
||||
#[put("CafeteriaLevelUp")]
|
||||
async fn cafeteria_level_up_handler(
|
||||
pool: web::Data<SqlitePool>,
|
||||
body: String,
|
||||
user_id: web::ReqData<i64>,
|
||||
) -> Result<HttpResponse> {
|
||||
let uid = *user_id;
|
||||
let req = parse_packet::<CafeteriaLevelUpRequest>("CafeteriaLevelUp", &body).map_err(|e| {
|
||||
tracing::warn!("Failed to parse CafeteriaLevelUp: {}", e);
|
||||
actix_web::error::ErrorBadRequest("Invalid packet")
|
||||
})?;
|
||||
let response = cafeteria_level_up::handle(&pool, uid, req).await;
|
||||
Ok(HttpResponse::Ok().json(response))
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
use actix_web::{put, web, HttpResponse, Result};
|
||||
use bd2::proto::proto_net::CafeteriaManageItemAddRequest;
|
||||
use crypto::network::parse_packet;
|
||||
use gameserver::logic::game::cafeteria::cafeteria_manage_item_add;
|
||||
use sqlx::SqlitePool;
|
||||
|
||||
#[put("CafeteriaManageItemAdd")]
|
||||
async fn cafeteria_manage_item_add_handler(
|
||||
pool: web::Data<SqlitePool>,
|
||||
body: String,
|
||||
user_id: web::ReqData<i64>,
|
||||
) -> Result<HttpResponse> {
|
||||
let uid = *user_id;
|
||||
let req = parse_packet::<CafeteriaManageItemAddRequest>("CafeteriaManageItemAdd", &body)
|
||||
.map_err(|e| {
|
||||
tracing::warn!("Failed to parse CafeteriaManageItemAdd: {}", e);
|
||||
actix_web::error::ErrorBadRequest("Invalid packet")
|
||||
})?;
|
||||
let response = cafeteria_manage_item_add::handle(&pool, uid, req).await;
|
||||
Ok(HttpResponse::Ok().json(response))
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
use actix_web::{put, web, HttpResponse, Result};
|
||||
use bd2::proto::proto_net::CafeteriaRareNpcInteractionRewardRequest;
|
||||
use crypto::network::parse_packet;
|
||||
use gameserver::logic::game::cafeteria::cafeteria_rare_npc_interaction_reward;
|
||||
use sqlx::SqlitePool;
|
||||
|
||||
#[put("CafeteriaRareNpcInteractionReward")]
|
||||
async fn cafeteria_rare_npc_interaction_reward_handler(
|
||||
pool: web::Data<SqlitePool>,
|
||||
body: String,
|
||||
user_id: web::ReqData<i64>,
|
||||
) -> Result<HttpResponse> {
|
||||
let uid = *user_id;
|
||||
let req = parse_packet::<CafeteriaRareNpcInteractionRewardRequest>(
|
||||
"CafeteriaRareNpcInteractionReward",
|
||||
&body,
|
||||
)
|
||||
.map_err(|e| {
|
||||
tracing::warn!("Failed to parse CafeteriaRareNpcInteractionReward: {}", e);
|
||||
actix_web::error::ErrorBadRequest("Invalid packet")
|
||||
})?;
|
||||
let response = cafeteria_rare_npc_interaction_reward::handle(&pool, uid, req).await;
|
||||
Ok(HttpResponse::Ok().json(response))
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
use actix_web::{put, web, HttpResponse, Result};
|
||||
use bd2::proto::proto_net::CafeteriaRegularCostumeInteractionAllRewardRequest;
|
||||
use crypto::network::parse_packet;
|
||||
use gameserver::logic::game::cafeteria::cafeteria_regular_costume_interaction_all_reward;
|
||||
use sqlx::SqlitePool;
|
||||
|
||||
#[put("CafeteriaRegularCostumeInteractionAllReward")]
|
||||
async fn cafeteria_regular_costume_interaction_all_reward_handler(
|
||||
pool: web::Data<SqlitePool>,
|
||||
body: String,
|
||||
user_id: web::ReqData<i64>,
|
||||
) -> Result<HttpResponse> {
|
||||
let uid = *user_id;
|
||||
let req = parse_packet::<CafeteriaRegularCostumeInteractionAllRewardRequest>(
|
||||
"CafeteriaRegularCostumeInteractionAllReward",
|
||||
&body,
|
||||
)
|
||||
.map_err(|e| {
|
||||
tracing::warn!(
|
||||
"Failed to parse CafeteriaRegularCostumeInteractionAllReward: {}",
|
||||
e
|
||||
);
|
||||
actix_web::error::ErrorBadRequest("Invalid packet")
|
||||
})?;
|
||||
let response = cafeteria_regular_costume_interaction_all_reward::handle(&pool, uid, req).await;
|
||||
Ok(HttpResponse::Ok().json(response))
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
use actix_web::{put, web, HttpResponse, Result};
|
||||
use bd2::proto::proto_net::CafeteriaRegularCostumeInteractionRewardRequest;
|
||||
use crypto::network::parse_packet;
|
||||
use gameserver::logic::game::cafeteria::cafeteria_regular_costume_interaction_reward;
|
||||
use sqlx::SqlitePool;
|
||||
|
||||
#[put("CafeteriaRegularCostumeInteractionReward")]
|
||||
async fn cafeteria_regular_costume_interaction_reward_handler(
|
||||
pool: web::Data<SqlitePool>,
|
||||
body: String,
|
||||
user_id: web::ReqData<i64>,
|
||||
) -> Result<HttpResponse> {
|
||||
let uid = *user_id;
|
||||
let req = parse_packet::<CafeteriaRegularCostumeInteractionRewardRequest>(
|
||||
"CafeteriaRegularCostumeInteractionReward",
|
||||
&body,
|
||||
)
|
||||
.map_err(|e| {
|
||||
tracing::warn!(
|
||||
"Failed to parse CafeteriaRegularCostumeInteractionReward: {}",
|
||||
e
|
||||
);
|
||||
actix_web::error::ErrorBadRequest("Invalid packet")
|
||||
})?;
|
||||
let response = cafeteria_regular_costume_interaction_reward::handle(&pool, uid, req).await;
|
||||
Ok(HttpResponse::Ok().json(response))
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
use actix_web::{put, web, HttpResponse, Result};
|
||||
use bd2::proto::proto_net::CafeteriaRegularCostumeNoteAllRewardRequest;
|
||||
use crypto::network::parse_packet;
|
||||
use gameserver::logic::game::cafeteria::cafeteria_regular_costume_note_all_reward;
|
||||
use sqlx::SqlitePool;
|
||||
|
||||
#[put("CafeteriaRegularCostumeNoteAllReward")]
|
||||
async fn cafeteria_regular_costume_note_all_reward_handler(
|
||||
pool: web::Data<SqlitePool>,
|
||||
body: String,
|
||||
user_id: web::ReqData<i64>,
|
||||
) -> Result<HttpResponse> {
|
||||
let uid = *user_id;
|
||||
let req = parse_packet::<CafeteriaRegularCostumeNoteAllRewardRequest>(
|
||||
"CafeteriaRegularCostumeNoteAllReward",
|
||||
&body,
|
||||
)
|
||||
.map_err(|e| {
|
||||
tracing::warn!(
|
||||
"Failed to parse CafeteriaRegularCostumeNoteAllReward: {}",
|
||||
e
|
||||
);
|
||||
actix_web::error::ErrorBadRequest("Invalid packet")
|
||||
})?;
|
||||
let response = cafeteria_regular_costume_note_all_reward::handle(&pool, uid, req).await;
|
||||
Ok(HttpResponse::Ok().json(response))
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
use actix_web::{put, web, HttpResponse, Result};
|
||||
use bd2::proto::proto_net::CafeteriaRegularCostumeNoteInfoRequest;
|
||||
use crypto::network::parse_packet;
|
||||
use gameserver::logic::game::cafeteria::cafeteria_regular_costume_note_info;
|
||||
use sqlx::SqlitePool;
|
||||
|
||||
#[put("CafeteriaRegularCostumeNoteInfo")]
|
||||
async fn cafeteria_regular_costume_note_info_handler(
|
||||
pool: web::Data<SqlitePool>,
|
||||
body: String,
|
||||
user_id: web::ReqData<i64>,
|
||||
) -> Result<HttpResponse> {
|
||||
let uid = *user_id;
|
||||
let req = parse_packet::<CafeteriaRegularCostumeNoteInfoRequest>(
|
||||
"CafeteriaRegularCostumeNoteInfo",
|
||||
&body,
|
||||
)
|
||||
.map_err(|e| {
|
||||
tracing::warn!("Failed to parse CafeteriaRegularCostumeNoteInfo: {}", e);
|
||||
actix_web::error::ErrorBadRequest("Invalid packet")
|
||||
})?;
|
||||
let response = cafeteria_regular_costume_note_info::handle(&pool, uid, req).await;
|
||||
Ok(HttpResponse::Ok().json(response))
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
use actix_web::{put, web, HttpResponse, Result};
|
||||
use bd2::proto::proto_net::CafeteriaRegularCostumeNoteRewardRequest;
|
||||
use crypto::network::parse_packet;
|
||||
use gameserver::logic::game::cafeteria::cafeteria_regular_costume_note_reward;
|
||||
use sqlx::SqlitePool;
|
||||
|
||||
#[put("CafeteriaRegularCostumeNoteReward")]
|
||||
async fn cafeteria_regular_costume_note_reward_handler(
|
||||
pool: web::Data<SqlitePool>,
|
||||
body: String,
|
||||
user_id: web::ReqData<i64>,
|
||||
) -> Result<HttpResponse> {
|
||||
let uid = *user_id;
|
||||
let req = parse_packet::<CafeteriaRegularCostumeNoteRewardRequest>(
|
||||
"CafeteriaRegularCostumeNoteReward",
|
||||
&body,
|
||||
)
|
||||
.map_err(|e| {
|
||||
tracing::warn!("Failed to parse CafeteriaRegularCostumeNoteReward: {}", e);
|
||||
actix_web::error::ErrorBadRequest("Invalid packet")
|
||||
})?;
|
||||
let response = cafeteria_regular_costume_note_reward::handle(&pool, uid, req).await;
|
||||
Ok(HttpResponse::Ok().json(response))
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
use actix_web::{put, web, HttpResponse, Result};
|
||||
use bd2::proto::proto_net::CafeteriaRewardReceiptTimeUpdateUsingCheatRequest;
|
||||
use crypto::network::parse_packet;
|
||||
use gameserver::logic::game::cafeteria::cafeteria_reward_receipt_time_update_using_cheat;
|
||||
use sqlx::SqlitePool;
|
||||
|
||||
#[put("CafeteriaRewardReceiptTimeUpdateUsingCheat")]
|
||||
async fn cafeteria_reward_receipt_time_update_using_cheat_handler(
|
||||
pool: web::Data<SqlitePool>,
|
||||
body: String,
|
||||
user_id: web::ReqData<i64>,
|
||||
) -> Result<HttpResponse> {
|
||||
let uid = *user_id;
|
||||
let req = parse_packet::<CafeteriaRewardReceiptTimeUpdateUsingCheatRequest>(
|
||||
"CafeteriaRewardReceiptTimeUpdateUsingCheat",
|
||||
&body,
|
||||
)
|
||||
.map_err(|e| {
|
||||
tracing::warn!(
|
||||
"Failed to parse CafeteriaRewardReceiptTimeUpdateUsingCheat: {}",
|
||||
e
|
||||
);
|
||||
actix_web::error::ErrorBadRequest("Invalid packet")
|
||||
})?;
|
||||
let response = cafeteria_reward_receipt_time_update_using_cheat::handle(&pool, uid, req).await;
|
||||
Ok(HttpResponse::Ok().json(response))
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
use actix_web::{put, web, HttpResponse, Result};
|
||||
use bd2::proto::proto_net::CafeteriaSpawnResetRequest;
|
||||
use crypto::network::parse_packet;
|
||||
use gameserver::logic::game::cafeteria::cafeteria_spawn_reset;
|
||||
use sqlx::SqlitePool;
|
||||
|
||||
#[put("CafeteriaSpawnReset")]
|
||||
async fn cafeteria_spawn_reset_handler(
|
||||
pool: web::Data<SqlitePool>,
|
||||
body: String,
|
||||
user_id: web::ReqData<i64>,
|
||||
) -> Result<HttpResponse> {
|
||||
let uid = *user_id;
|
||||
let req =
|
||||
parse_packet::<CafeteriaSpawnResetRequest>("CafeteriaSpawnReset", &body).map_err(|e| {
|
||||
tracing::warn!("Failed to parse CafeteriaSpawnReset: {}", e);
|
||||
actix_web::error::ErrorBadRequest("Invalid packet")
|
||||
})?;
|
||||
let response = cafeteria_spawn_reset::handle(&pool, uid, req).await;
|
||||
Ok(HttpResponse::Ok().json(response))
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
use actix_web::{put, web, HttpResponse, Result};
|
||||
use bd2::proto::proto_net::CafeteriaSpawnResetCheatRequest;
|
||||
use crypto::network::parse_packet;
|
||||
use gameserver::logic::game::cafeteria::cafeteria_spawn_reset_cheat;
|
||||
use sqlx::SqlitePool;
|
||||
|
||||
#[put("CafeteriaSpawnResetCheat")]
|
||||
async fn cafeteria_spawn_reset_cheat_handler(
|
||||
pool: web::Data<SqlitePool>,
|
||||
body: String,
|
||||
user_id: web::ReqData<i64>,
|
||||
) -> Result<HttpResponse> {
|
||||
let uid = *user_id;
|
||||
let req = parse_packet::<CafeteriaSpawnResetCheatRequest>("CafeteriaSpawnResetCheat", &body)
|
||||
.map_err(|e| {
|
||||
tracing::warn!("Failed to parse CafeteriaSpawnResetCheat: {}", e);
|
||||
actix_web::error::ErrorBadRequest("Invalid packet")
|
||||
})?;
|
||||
let response = cafeteria_spawn_reset_cheat::handle(&pool, uid, req).await;
|
||||
Ok(HttpResponse::Ok().json(response))
|
||||
}
|
||||
16
httpserver/src/routes/game/cafeteria/mod.rs
Normal file
16
httpserver/src/routes/game/cafeteria/mod.rs
Normal file
@@ -0,0 +1,16 @@
|
||||
pub mod cafeteria_cumulative_reward;
|
||||
pub mod cafeteria_daily_connection_costume_refresh;
|
||||
pub mod cafeteria_event_npc_interaction_reward;
|
||||
pub mod cafeteria_info;
|
||||
pub mod cafeteria_introduction_story_reward;
|
||||
pub mod cafeteria_level_up;
|
||||
pub mod cafeteria_manage_item_add;
|
||||
pub mod cafeteria_rare_npc_interaction_reward;
|
||||
pub mod cafeteria_regular_costume_interaction_all_reward;
|
||||
pub mod cafeteria_regular_costume_interaction_reward;
|
||||
pub mod cafeteria_regular_costume_note_all_reward;
|
||||
pub mod cafeteria_regular_costume_note_info;
|
||||
pub mod cafeteria_regular_costume_note_reward;
|
||||
pub mod cafeteria_reward_receipt_time_update_using_cheat;
|
||||
pub mod cafeteria_spawn_reset;
|
||||
pub mod cafeteria_spawn_reset_cheat;
|
||||
Reference in New Issue
Block a user