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
|
||||
// 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
|
||||
// example, a player possessing a mag with a level above 200). When the flag
|
||||
// is set, this function returns false, which prevents all rare item drops.
|
||||
// example, a player possessing a mag with a level above 200, or a stack of
|
||||
// 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.
|
||||
return (this->mode != GameMode::CHALLENGE);
|
||||
}
|
||||
|
||||
@@ -1999,8 +1999,18 @@ static void on_pick_up_item_generic(
|
||||
|
||||
if (fi->flags & 0x1000) {
|
||||
uint32_t pi = fi->data.primary_identifier();
|
||||
bool should_send_game_notif = s->notify_game_for_item_primary_identifiers.count(pi);
|
||||
bool should_send_global_notif = s->notify_server_for_item_primary_identifiers.count(pi);
|
||||
bool should_send_game_notif, should_send_global_notif;
|
||||
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) {
|
||||
string p_name = p->disp.name.decode();
|
||||
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&) {
|
||||
}
|
||||
|
||||
this->notify_game_for_item_primary_identifiers.clear();
|
||||
try {
|
||||
for (const auto& pi_json : this->config_json->get_list("NotifyGameForItemPrimaryIdentifiers")) {
|
||||
if (pi_json->is_int()) {
|
||||
this->notify_game_for_item_primary_identifiers.emplace(pi_json->as_int());
|
||||
} else {
|
||||
auto item = this->parse_item_description(Version::BB_V4, pi_json->as_string());
|
||||
this->notify_game_for_item_primary_identifiers.emplace(item.primary_identifier());
|
||||
auto parse_primary_identifier_list = [&](const char* key, Version base_version) -> std::unordered_set<uint32_t> {
|
||||
std::unordered_set<uint32_t> ret;
|
||||
try {
|
||||
for (const auto& pi_json : this->config_json->get_list(key)) {
|
||||
if (pi_json->is_int()) {
|
||||
ret.emplace(pi_json->as_int());
|
||||
} else {
|
||||
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&) {
|
||||
}
|
||||
this->notify_server_for_item_primary_identifiers.clear();
|
||||
try {
|
||||
for (const auto& pi_json : this->config_json->get_list("NotifyServerForItemPrimaryIdentifiers")) {
|
||||
if (pi_json->is_int()) {
|
||||
this->notify_server_for_item_primary_identifiers.emplace(pi_json->as_int());
|
||||
} else {
|
||||
auto item = this->parse_item_description(Version::BB_V4, pi_json->as_string());
|
||||
this->notify_server_for_item_primary_identifiers.emplace(item.primary_identifier());
|
||||
}
|
||||
}
|
||||
} catch (const out_of_range&) {
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
this->notify_game_for_item_primary_identifiers_v1_v2 = parse_primary_identifier_list(
|
||||
"NotifyGameForItemPrimaryIdentifiersV1V2", Version::PC_V2);
|
||||
this->notify_game_for_item_primary_identifiers_v3 = parse_primary_identifier_list(
|
||||
"NotifyGameForItemPrimaryIdentifiersV3", Version::GC_V3);
|
||||
this->notify_game_for_item_primary_identifiers_v4 = parse_primary_identifier_list(
|
||||
"NotifyGameForItemPrimaryIdentifiersV4", Version::BB_V4);
|
||||
this->notify_server_for_item_primary_identifiers_v1_v2 = parse_primary_identifier_list(
|
||||
"NotifyServerForItemPrimaryIdentifiersV1V2", Version::PC_V2);
|
||||
this->notify_server_for_item_primary_identifiers_v3 = parse_primary_identifier_list(
|
||||
"NotifyServerForItemPrimaryIdentifiersV3", Version::GC_V3);
|
||||
this->notify_server_for_item_primary_identifiers_v4 = parse_primary_identifier_list(
|
||||
"NotifyServerForItemPrimaryIdentifiersV4", Version::BB_V4);
|
||||
|
||||
} else {
|
||||
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 default_rare_notifs_enabled_v1_v2 = 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_server_for_item_primary_identifiers;
|
||||
std::unordered_set<uint32_t> notify_game_for_item_primary_identifiers_v1_v2;
|
||||
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;
|
||||
std::vector<std::shared_ptr<const PSOBBEncryption::KeyFile>> bb_private_keys;
|
||||
std::shared_ptr<const FunctionCodeIndex> function_code_index;
|
||||
|
||||
Reference in New Issue
Block a user