fix event lookups in quest availability expressions
This commit is contained in:
@@ -767,19 +767,6 @@ Lobby::JoinError Lobby::join_error_for_client(std::shared_ptr<Client> c, const s
|
|||||||
return JoinError::ALLOWED;
|
return JoinError::ALLOWED;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t Lobby::game_event_for_lobby_event(uint8_t lobby_event) {
|
|
||||||
if (lobby_event > 7) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (lobby_event == 7) {
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
if (lobby_event == 2) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return lobby_event;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Lobby::item_exists(uint8_t floor, uint32_t item_id) const {
|
bool Lobby::item_exists(uint8_t floor, uint32_t item_id) const {
|
||||||
if (floor >= this->floor_item_managers.size()) {
|
if (floor >= this->floor_item_managers.size()) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -294,8 +294,6 @@ struct Lobby : public std::enable_shared_from_this<Lobby> {
|
|||||||
|
|
||||||
QuestIndex::IncludeCondition quest_include_condition() const;
|
QuestIndex::IncludeCondition quest_include_condition() const;
|
||||||
|
|
||||||
static uint8_t game_event_for_lobby_event(uint8_t lobby_event);
|
|
||||||
|
|
||||||
std::unordered_map<uint32_t, std::shared_ptr<Client>> clients_by_serial_number() const;
|
std::unordered_map<uint32_t, std::shared_ptr<Client>> clients_by_serial_number() const;
|
||||||
|
|
||||||
static void dispatch_on_idle_timeout(evutil_socket_t, short, void* ctx);
|
static void dispatch_on_idle_timeout(evutil_socket_t, short, void* ctx);
|
||||||
|
|||||||
@@ -252,14 +252,14 @@ bool QuestAvailabilityExpression::EventLookupNode::operator==(const Node& other)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int64_t QuestAvailabilityExpression::EventLookupNode::evaluate(const Env& env) const {
|
int64_t QuestAvailabilityExpression::EventLookupNode::evaluate(const Env& env) const {
|
||||||
return env.num_players;
|
return env.event;
|
||||||
}
|
}
|
||||||
|
|
||||||
string QuestAvailabilityExpression::EventLookupNode::str() const {
|
string QuestAvailabilityExpression::EventLookupNode::str() const {
|
||||||
return "V_Event";
|
return "V_Event";
|
||||||
}
|
}
|
||||||
|
|
||||||
QuestAvailabilityExpression::ConstantNode::ConstantNode(bool value)
|
QuestAvailabilityExpression::ConstantNode::ConstantNode(int64_t value)
|
||||||
: value(value) {}
|
: value(value) {}
|
||||||
|
|
||||||
bool QuestAvailabilityExpression::ConstantNode::operator==(const Node& other) const {
|
bool QuestAvailabilityExpression::ConstantNode::operator==(const Node& other) const {
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ protected:
|
|||||||
|
|
||||||
class ConstantNode : public Node {
|
class ConstantNode : public Node {
|
||||||
public:
|
public:
|
||||||
ConstantNode(bool value);
|
ConstantNode(int64_t value);
|
||||||
virtual ~ConstantNode() = default;
|
virtual ~ConstantNode() = default;
|
||||||
virtual bool operator==(const Node& other) const;
|
virtual bool operator==(const Node& other) const;
|
||||||
virtual int64_t evaluate(const Env& env) const;
|
virtual int64_t evaluate(const Env& env) const;
|
||||||
|
|||||||
@@ -4233,7 +4233,7 @@ shared_ptr<Lobby> create_game_generic(
|
|||||||
throw logic_error("invalid quest script version");
|
throw logic_error("invalid quest script version");
|
||||||
}
|
}
|
||||||
|
|
||||||
game->event = Lobby::game_event_for_lobby_event(current_lobby->event);
|
game->event = current_lobby->event;
|
||||||
game->block = 0xFF;
|
game->block = 0xFF;
|
||||||
game->max_clients = game->check_flag(Lobby::Flag::IS_SPECTATOR_TEAM) ? 12 : 4;
|
game->max_clients = game->check_flag(Lobby::Flag::IS_SPECTATOR_TEAM) ? 12 : 4;
|
||||||
game->min_level = min_level;
|
game->min_level = min_level;
|
||||||
|
|||||||
Reference in New Issue
Block a user