fix Ep3 card auction
This commit is contained in:
@@ -96,8 +96,6 @@ struct Client {
|
||||
LOADING_QUEST = 0x00000040,
|
||||
// Client is loading a joinable quest that has already started
|
||||
LOADING_RUNNING_QUEST = 0x00100000,
|
||||
// Client is waiting to join an Episode 3 card auction
|
||||
AWAITING_CARD_AUCTION = 0x00010000,
|
||||
// Client is in the information menu (login server only)
|
||||
IN_INFORMATION_MENU = 0x00000080,
|
||||
// Client is at the welcome message (login server only)
|
||||
|
||||
@@ -3495,9 +3495,9 @@ struct S_CardTradeComplete_GC_Ep3_EE_FlagD4 {
|
||||
// scrolls to the left.
|
||||
|
||||
// EF (C->S): Join card auction (Episode 3)
|
||||
// This command should be treated like AC (quest barrier); that is, when all
|
||||
// players in the same game have sent an EF command, the server should send an
|
||||
// EF back to them all at the same time to start the auction.
|
||||
// When a card auction is ready to begin, the leader sends this command to
|
||||
// request the card list. The server then sends an EF command to all players
|
||||
// to start the auction.
|
||||
|
||||
// EF (S->C): Start card auction (Episode 3)
|
||||
|
||||
|
||||
+3
-11
@@ -28,7 +28,6 @@ using namespace std;
|
||||
|
||||
const char* BATTLE_TABLE_DISCONNECT_HOOK_NAME = "battle_table_state";
|
||||
const char* QUEST_BARRIER_DISCONNECT_HOOK_NAME = "quest_barrier";
|
||||
const char* CARD_AUCTION_DISCONNECT_HOOK_NAME = "card_auction";
|
||||
const char* ADD_NEXT_CLIENT_DISCONNECT_HOOK_NAME = "add_next_game_client";
|
||||
|
||||
static shared_ptr<const Menu> proxy_options_menu_for_client(
|
||||
@@ -3743,21 +3742,14 @@ static void on_EF_Ep3(shared_ptr<ServerState> s, shared_ptr<Client> c,
|
||||
check_size_v(data.size(), 0);
|
||||
|
||||
if (!(c->flags & Client::Flag::IS_EPISODE_3)) {
|
||||
throw runtime_error("non-Ep3 client sent card auction join command");
|
||||
throw runtime_error("non-Ep3 client sent card auction request");
|
||||
}
|
||||
auto l = s->find_lobby(c->lobby_id);
|
||||
if (!l->is_game() || !l->is_ep3()) {
|
||||
throw runtime_error("client sent card auction join command outside of Ep3 game");
|
||||
throw runtime_error("client sent card auction request outside of Ep3 game");
|
||||
}
|
||||
|
||||
if (c->flags & Client::Flag::AWAITING_CARD_AUCTION) {
|
||||
return;
|
||||
}
|
||||
c->flags |= Client::Flag::AWAITING_CARD_AUCTION;
|
||||
c->disconnect_hooks.emplace(CARD_AUCTION_DISCONNECT_HOOK_NAME, [s, l]() -> void {
|
||||
send_card_auction_if_all_clients_ready(s, l);
|
||||
});
|
||||
send_card_auction_if_all_clients_ready(s, l);
|
||||
send_ep3_card_auction(s, l);
|
||||
}
|
||||
|
||||
static void on_xxEA_BB(shared_ptr<ServerState>, shared_ptr<Client> c,
|
||||
|
||||
+2
-29
@@ -21,7 +21,6 @@
|
||||
using namespace std;
|
||||
|
||||
extern const char* QUEST_BARRIER_DISCONNECT_HOOK_NAME;
|
||||
extern const char* CARD_AUCTION_DISCONNECT_HOOK_NAME;
|
||||
|
||||
const unordered_set<uint32_t> v2_crypt_initial_client_commands({
|
||||
0x00260088, // (17) DCNTE license check
|
||||
@@ -2769,28 +2768,7 @@ bool send_quest_barrier_if_all_clients_ready(shared_ptr<Lobby> l) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void send_card_auction_if_all_clients_ready(
|
||||
shared_ptr<ServerState> s, shared_ptr<Lobby> l) {
|
||||
// Check if any client is still not ready
|
||||
size_t x;
|
||||
for (x = 0; x < l->max_clients; x++) {
|
||||
if (!l->clients[x]) {
|
||||
continue;
|
||||
}
|
||||
if (!(l->clients[x]->flags & Client::Flag::AWAITING_CARD_AUCTION)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (x != l->max_clients) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (x = 0; x < l->max_clients; x++) {
|
||||
if (l->clients[x]) {
|
||||
l->clients[x]->flags &= ~Client::Flag::AWAITING_CARD_AUCTION;
|
||||
}
|
||||
}
|
||||
|
||||
void send_ep3_card_auction(shared_ptr<ServerState> s, shared_ptr<Lobby> l) {
|
||||
if ((s->ep3_card_auction_points == 0) ||
|
||||
(s->ep3_card_auction_min_size == 0) ||
|
||||
(s->ep3_card_auction_max_size == 0)) {
|
||||
@@ -2830,13 +2808,8 @@ void send_card_auction_if_all_clients_ready(
|
||||
}
|
||||
}
|
||||
send_command_t(l, 0xEF, num_cards, cmd);
|
||||
|
||||
for (auto c : l->clients) {
|
||||
if (c) {
|
||||
c->disconnect_hooks.erase(CARD_AUCTION_DISCONNECT_HOOK_NAME);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void send_server_time(shared_ptr<Client> c) {
|
||||
uint64_t t = now();
|
||||
|
||||
|
||||
+2
-3
@@ -369,6 +369,8 @@ void send_ep3_game_details(
|
||||
|
||||
void send_ep3_update_spectator_count(std::shared_ptr<Lobby> l);
|
||||
|
||||
void send_ep3_card_auction(std::shared_ptr<ServerState> s, std::shared_ptr<Lobby> l);
|
||||
|
||||
// Pass mask_key = 0 to unmask the command
|
||||
void set_mask_for_ep3_game_command(void* vdata, size_t size, uint8_t mask_key);
|
||||
|
||||
@@ -394,9 +396,6 @@ void send_quest_file_chunk(
|
||||
bool is_download_quest);
|
||||
bool send_quest_barrier_if_all_clients_ready(std::shared_ptr<Lobby> l);
|
||||
|
||||
void send_card_auction_if_all_clients_ready(
|
||||
std::shared_ptr<ServerState> s, std::shared_ptr<Lobby> l);
|
||||
|
||||
void send_server_time(std::shared_ptr<Client> c);
|
||||
|
||||
void send_change_event(std::shared_ptr<Client> c, uint8_t new_event);
|
||||
|
||||
Reference in New Issue
Block a user