split rare announcement item sets by game version
This commit is contained in:
+3
-2
@@ -66,8 +66,9 @@ bool ItemCreator::are_rare_drops_allowed() const {
|
|||||||
// Note: The client has an additional check here, which appears to be a subtle
|
// Note: The client has an additional check here, which appears to be a subtle
|
||||||
// anti-cheating measure. There is a flag on the client, initially zero, which
|
// anti-cheating measure. There is a flag on the client, initially zero, which
|
||||||
// is set to 1 when certain unexpected item-related things happen (for
|
// is set to 1 when certain unexpected item-related things happen (for
|
||||||
// example, a player possessing a mag with a level above 200). When the flag
|
// example, a player possessing a mag with a level above 200, or a stack of
|
||||||
// is set, this function returns false, which prevents all rare item drops.
|
// consumables with an amount above the stack size limit). When the flag is
|
||||||
|
// set, this function returns false, which prevents all rare item drops.
|
||||||
// newserv intentionally does not implement this flag.
|
// newserv intentionally does not implement this flag.
|
||||||
return (this->mode != GameMode::CHALLENGE);
|
return (this->mode != GameMode::CHALLENGE);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1999,8 +1999,18 @@ static void on_pick_up_item_generic(
|
|||||||
|
|
||||||
if (fi->flags & 0x1000) {
|
if (fi->flags & 0x1000) {
|
||||||
uint32_t pi = fi->data.primary_identifier();
|
uint32_t pi = fi->data.primary_identifier();
|
||||||
bool should_send_game_notif = s->notify_game_for_item_primary_identifiers.count(pi);
|
bool should_send_game_notif, should_send_global_notif;
|
||||||
bool should_send_global_notif = s->notify_server_for_item_primary_identifiers.count(pi);
|
if (is_v1_or_v2(c->version()) && (c->version() != Version::GC_NTE)) {
|
||||||
|
should_send_game_notif = s->notify_game_for_item_primary_identifiers_v1_v2.count(pi);
|
||||||
|
should_send_global_notif = s->notify_server_for_item_primary_identifiers_v1_v2.count(pi);
|
||||||
|
} else if (!is_v4(c->version())) {
|
||||||
|
should_send_game_notif = s->notify_game_for_item_primary_identifiers_v3.count(pi);
|
||||||
|
should_send_global_notif = s->notify_server_for_item_primary_identifiers_v3.count(pi);
|
||||||
|
} else {
|
||||||
|
should_send_game_notif = s->notify_game_for_item_primary_identifiers_v4.count(pi);
|
||||||
|
should_send_global_notif = s->notify_server_for_item_primary_identifiers_v4.count(pi);
|
||||||
|
}
|
||||||
|
|
||||||
if (should_send_game_notif || should_send_global_notif) {
|
if (should_send_game_notif || should_send_global_notif) {
|
||||||
string p_name = p->disp.name.decode();
|
string p_name = p->disp.name.decode();
|
||||||
string desc = s->describe_item(c->version(), fi->data, true);
|
string desc = s->describe_item(c->version(), fi->data, true);
|
||||||
|
|||||||
+26
-22
@@ -1214,30 +1214,34 @@ void ServerState::load_config_late() {
|
|||||||
} catch (const out_of_range&) {
|
} catch (const out_of_range&) {
|
||||||
}
|
}
|
||||||
|
|
||||||
this->notify_game_for_item_primary_identifiers.clear();
|
auto parse_primary_identifier_list = [&](const char* key, Version base_version) -> std::unordered_set<uint32_t> {
|
||||||
try {
|
std::unordered_set<uint32_t> ret;
|
||||||
for (const auto& pi_json : this->config_json->get_list("NotifyGameForItemPrimaryIdentifiers")) {
|
try {
|
||||||
if (pi_json->is_int()) {
|
for (const auto& pi_json : this->config_json->get_list(key)) {
|
||||||
this->notify_game_for_item_primary_identifiers.emplace(pi_json->as_int());
|
if (pi_json->is_int()) {
|
||||||
} else {
|
ret.emplace(pi_json->as_int());
|
||||||
auto item = this->parse_item_description(Version::BB_V4, pi_json->as_string());
|
} else {
|
||||||
this->notify_game_for_item_primary_identifiers.emplace(item.primary_identifier());
|
auto item = this->parse_item_description(base_version, pi_json->as_string());
|
||||||
|
ret.emplace(item.primary_identifier());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (const out_of_range&) {
|
||||||
}
|
}
|
||||||
} catch (const out_of_range&) {
|
return ret;
|
||||||
}
|
};
|
||||||
this->notify_server_for_item_primary_identifiers.clear();
|
this->notify_game_for_item_primary_identifiers_v1_v2 = parse_primary_identifier_list(
|
||||||
try {
|
"NotifyGameForItemPrimaryIdentifiersV1V2", Version::PC_V2);
|
||||||
for (const auto& pi_json : this->config_json->get_list("NotifyServerForItemPrimaryIdentifiers")) {
|
this->notify_game_for_item_primary_identifiers_v3 = parse_primary_identifier_list(
|
||||||
if (pi_json->is_int()) {
|
"NotifyGameForItemPrimaryIdentifiersV3", Version::GC_V3);
|
||||||
this->notify_server_for_item_primary_identifiers.emplace(pi_json->as_int());
|
this->notify_game_for_item_primary_identifiers_v4 = parse_primary_identifier_list(
|
||||||
} else {
|
"NotifyGameForItemPrimaryIdentifiersV4", Version::BB_V4);
|
||||||
auto item = this->parse_item_description(Version::BB_V4, pi_json->as_string());
|
this->notify_server_for_item_primary_identifiers_v1_v2 = parse_primary_identifier_list(
|
||||||
this->notify_server_for_item_primary_identifiers.emplace(item.primary_identifier());
|
"NotifyServerForItemPrimaryIdentifiersV1V2", Version::PC_V2);
|
||||||
}
|
this->notify_server_for_item_primary_identifiers_v3 = parse_primary_identifier_list(
|
||||||
}
|
"NotifyServerForItemPrimaryIdentifiersV3", Version::GC_V3);
|
||||||
} catch (const out_of_range&) {
|
this->notify_server_for_item_primary_identifiers_v4 = parse_primary_identifier_list(
|
||||||
}
|
"NotifyServerForItemPrimaryIdentifiersV4", Version::BB_V4);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
config_log.warning("BB item name index is missing; cannot load quest reward lists from config");
|
config_log.warning("BB item name index is missing; cannot load quest reward lists from config");
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-2
@@ -129,8 +129,12 @@ struct ServerState : public std::enable_shared_from_this<ServerState> {
|
|||||||
bool use_game_creator_section_id = false;
|
bool use_game_creator_section_id = false;
|
||||||
bool default_rare_notifs_enabled_v1_v2 = false;
|
bool default_rare_notifs_enabled_v1_v2 = false;
|
||||||
bool default_rare_notifs_enabled_v3_v4 = false;
|
bool default_rare_notifs_enabled_v3_v4 = false;
|
||||||
std::unordered_set<uint32_t> notify_game_for_item_primary_identifiers;
|
std::unordered_set<uint32_t> notify_game_for_item_primary_identifiers_v1_v2;
|
||||||
std::unordered_set<uint32_t> notify_server_for_item_primary_identifiers;
|
std::unordered_set<uint32_t> notify_game_for_item_primary_identifiers_v3;
|
||||||
|
std::unordered_set<uint32_t> notify_game_for_item_primary_identifiers_v4;
|
||||||
|
std::unordered_set<uint32_t> notify_server_for_item_primary_identifiers_v1_v2;
|
||||||
|
std::unordered_set<uint32_t> notify_server_for_item_primary_identifiers_v3;
|
||||||
|
std::unordered_set<uint32_t> notify_server_for_item_primary_identifiers_v4;
|
||||||
bool notify_server_for_max_level_achieved = false;
|
bool notify_server_for_max_level_achieved = false;
|
||||||
std::vector<std::shared_ptr<const PSOBBEncryption::KeyFile>> bb_private_keys;
|
std::vector<std::shared_ptr<const PSOBBEncryption::KeyFile>> bb_private_keys;
|
||||||
std::shared_ptr<const FunctionCodeIndex> function_code_index;
|
std::shared_ptr<const FunctionCodeIndex> function_code_index;
|
||||||
|
|||||||
@@ -992,8 +992,12 @@
|
|||||||
// notifications regardless of their stats. For textual descriptions, the
|
// notifications regardless of their stats. For textual descriptions, the
|
||||||
// items are parsed as they would be on BB, so certain V2-only items cannot
|
// items are parsed as they would be on BB, so certain V2-only items cannot
|
||||||
// be represented this way.
|
// be represented this way.
|
||||||
"NotifyGameForItemPrimaryIdentifiers": [],
|
"NotifyGameForItemPrimaryIdentifiersV1V2": [],
|
||||||
"NotifyServerForItemPrimaryIdentifiers": [],
|
"NotifyGameForItemPrimaryIdentifiersV3": [],
|
||||||
|
"NotifyGameForItemPrimaryIdentifiersV4": [],
|
||||||
|
"NotifyServerForItemPrimaryIdentifiersV1V2": [],
|
||||||
|
"NotifyServerForItemPrimaryIdentifiersV3": [],
|
||||||
|
"NotifyServerForItemPrimaryIdentifiersV4": [],
|
||||||
|
|
||||||
// Whether to notify the entire server when a player reaches the maximum level
|
// Whether to notify the entire server when a player reaches the maximum level
|
||||||
// (100 on v1, 200 on other versions, or 999 on Episode 3).
|
// (100 on v1, 200 on other versions, or 999 on Episode 3).
|
||||||
|
|||||||
+6
-2
@@ -31,8 +31,12 @@
|
|||||||
"DefaultDropModeV4Challenge": "SERVER_SHARED",
|
"DefaultDropModeV4Challenge": "SERVER_SHARED",
|
||||||
"CheatModeBehavior": "OnByDefault",
|
"CheatModeBehavior": "OnByDefault",
|
||||||
"RareNotificationsEnabledByDefault": false,
|
"RareNotificationsEnabledByDefault": false,
|
||||||
"NotifyGameForItemPrimaryIdentifiers": [],
|
"NotifyGameForItemPrimaryIdentifiersV1V2": [],
|
||||||
"NotifyServerForItemPrimaryIdentifiers": [],
|
"NotifyGameForItemPrimaryIdentifiersV3": [],
|
||||||
|
"NotifyGameForItemPrimaryIdentifiersV4": [],
|
||||||
|
"NotifyServerForItemPrimaryIdentifiersV1V2": [],
|
||||||
|
"NotifyServerForItemPrimaryIdentifiersV3": [],
|
||||||
|
"NotifyServerForItemPrimaryIdentifiersV4": [],
|
||||||
"NotifyServerForMaxLevelAchieved": false,
|
"NotifyServerForMaxLevelAchieved": false,
|
||||||
|
|
||||||
"LocalAddress": "en0",
|
"LocalAddress": "en0",
|
||||||
|
|||||||
Reference in New Issue
Block a user