add $song on proxy server
This commit is contained in:
+12
-2
@@ -1012,7 +1012,17 @@ static void server_command_song(shared_ptr<ServerState>, shared_ptr<Lobby>,
|
||||
check_is_ep3(c, true);
|
||||
|
||||
uint32_t song = stoul(encode_sjis(args), nullptr, 0);
|
||||
send_ep3_change_music(c, song);
|
||||
send_ep3_change_music(c->channel, song);
|
||||
}
|
||||
|
||||
static void proxy_command_song(shared_ptr<ServerState>,
|
||||
ProxyServer::LinkedSession& session, const std::u16string& args) {
|
||||
int32_t song = stol(encode_sjis(args), nullptr, 0);
|
||||
if (song < 0) {
|
||||
song = -song;
|
||||
send_ep3_change_music(session.server_channel, song);
|
||||
}
|
||||
send_ep3_change_music(session.client_channel, song);
|
||||
}
|
||||
|
||||
static void server_command_infinite_hp(shared_ptr<ServerState>, shared_ptr<Lobby> l,
|
||||
@@ -1200,7 +1210,7 @@ static const unordered_map<u16string, ChatCommandDefinition> chat_commands({
|
||||
{u"$secid", {server_command_secid, proxy_command_secid, u"Usage:\nsecid [section ID]\nomit section ID to\nrevert to normal"}},
|
||||
{u"$silence", {server_command_silence, nullptr, u"Usage:\nsilence <name-or-number>"}},
|
||||
// TODO: implement this on proxy server
|
||||
{u"$song", {server_command_song, nullptr, u"Usage:\nsong <song-number>"}},
|
||||
{u"$song", {server_command_song, proxy_command_song, u"Usage:\nsong <song-number>"}},
|
||||
{u"$spec", {server_command_spec, nullptr, u"Usage:\nspec"}},
|
||||
{u"$ss", {nullptr, proxy_command_send_server, u"Usage:\nss <data>"}},
|
||||
{u"$swa", {server_command_switch_assist, proxy_command_switch_assist, u"Usage:\nswa"}},
|
||||
|
||||
@@ -226,7 +226,7 @@ void on_login_complete(shared_ptr<ServerState> s, shared_ptr<Client> c) {
|
||||
// menu or welcome message
|
||||
if (c->flags & Client::Flag::IS_EPISODE_3) {
|
||||
if (s->ep3_menu_song >= 0) {
|
||||
send_ep3_change_music(c, s->ep3_menu_song);
|
||||
send_ep3_change_music(c->channel, s->ep3_menu_song);
|
||||
} else if (s->pre_lobby_event) {
|
||||
send_change_event(c, s->pre_lobby_event);
|
||||
}
|
||||
|
||||
+2
-2
@@ -1743,9 +1743,9 @@ void send_warp(shared_ptr<Client> c, uint32_t area) {
|
||||
c->area = area;
|
||||
}
|
||||
|
||||
void send_ep3_change_music(shared_ptr<Client> c, uint32_t song) {
|
||||
void send_ep3_change_music(Channel& ch, uint32_t song) {
|
||||
G_ChangeLobbyMusic_GC_Ep3_6xBF cmd = {{0xBF, 0x02, 0}, song};
|
||||
send_command_t(c, 0x60, 0x00, cmd);
|
||||
ch.send(0x60, 0x00, cmd);
|
||||
}
|
||||
|
||||
void send_set_player_visibility(shared_ptr<Lobby> l, shared_ptr<Client> c,
|
||||
|
||||
+1
-1
@@ -292,7 +292,7 @@ void send_player_stats_change(
|
||||
void send_warp(Channel& ch, uint8_t client_id, uint32_t area);
|
||||
void send_warp(std::shared_ptr<Client> c, uint32_t area);
|
||||
|
||||
void send_ep3_change_music(std::shared_ptr<Client> c, uint32_t song);
|
||||
void send_ep3_change_music(Channel& ch, uint32_t song);
|
||||
void send_set_player_visibility(std::shared_ptr<Lobby> l,
|
||||
std::shared_ptr<Client> c, bool visible);
|
||||
void send_revive_player(std::shared_ptr<Lobby> l, std::shared_ptr<Client> c);
|
||||
|
||||
Reference in New Issue
Block a user