mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +00:00
[Feature] Lazy Load Bank Contents (#4453)
* initial work porting this to upstream * more * track complete connect * it sucks to suck * Few optimizations * Move sent_inventory init * Move var * Adjustments --------- Co-authored-by: Akkadius <akkadius1@gmail.com>
This commit is contained in:
parent
ffd68eb63d
commit
ff16a76481
@ -909,6 +909,7 @@ RULE_BOOL(Inventory, AllowAnyWeaponTransformation, false, "Weapons can use any w
|
|||||||
RULE_BOOL(Inventory, TransformSummonedBags, false, "Transforms summoned bags into disenchanted ones instead of deleting")
|
RULE_BOOL(Inventory, TransformSummonedBags, false, "Transforms summoned bags into disenchanted ones instead of deleting")
|
||||||
RULE_BOOL(Inventory, AllowMultipleOfSameAugment, false, "Allows multiple of the same augment to be placed in an item via #augmentitem or MQ2, set to true to allow")
|
RULE_BOOL(Inventory, AllowMultipleOfSameAugment, false, "Allows multiple of the same augment to be placed in an item via #augmentitem or MQ2, set to true to allow")
|
||||||
RULE_INT(Inventory, AlternateAugmentationSealer, 53, "Allows RoF+ clients to augment items from a special container type")
|
RULE_INT(Inventory, AlternateAugmentationSealer, 53, "Allows RoF+ clients to augment items from a special container type")
|
||||||
|
RULE_BOOL(Inventory, LazyLoadBank, true, "Don't load bank during zoning, only when in proximinity to a banker. May increase zone speed and stability")
|
||||||
RULE_CATEGORY_END()
|
RULE_CATEGORY_END()
|
||||||
|
|
||||||
RULE_CATEGORY(Client)
|
RULE_CATEGORY(Client)
|
||||||
|
|||||||
@ -185,7 +185,8 @@ Client::Client(EQStreamInterface *ieqs) : Mob(
|
|||||||
position_update_timer(10000),
|
position_update_timer(10000),
|
||||||
consent_throttle_timer(2000),
|
consent_throttle_timer(2000),
|
||||||
tmSitting(0),
|
tmSitting(0),
|
||||||
parcel_timer(RuleI(Parcel, ParcelDeliveryDelay))
|
parcel_timer(RuleI(Parcel, ParcelDeliveryDelay)),
|
||||||
|
lazy_load_bank_check_timer(1000)
|
||||||
{
|
{
|
||||||
for (auto client_filter = FilterNone; client_filter < _FilterCount; client_filter = eqFilterType(client_filter + 1)) {
|
for (auto client_filter = FilterNone; client_filter < _FilterCount; client_filter = eqFilterType(client_filter + 1)) {
|
||||||
SetFilter(client_filter, FilterShow);
|
SetFilter(client_filter, FilterShow);
|
||||||
@ -391,7 +392,6 @@ Client::Client(EQStreamInterface *ieqs) : Mob(
|
|||||||
SetBotPrecombat(false);
|
SetBotPrecombat(false);
|
||||||
|
|
||||||
AI_Init();
|
AI_Init();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Client::~Client() {
|
Client::~Client() {
|
||||||
|
|||||||
@ -2056,6 +2056,10 @@ private:
|
|||||||
Timer task_request_timer;
|
Timer task_request_timer;
|
||||||
Timer pick_lock_timer;
|
Timer pick_lock_timer;
|
||||||
Timer parcel_timer; //Used to limit the number of parcels to one every 30 seconds (default). Changable via rule.
|
Timer parcel_timer; //Used to limit the number of parcels to one every 30 seconds (default). Changable via rule.
|
||||||
|
Timer lazy_load_bank_check_timer;
|
||||||
|
|
||||||
|
bool m_lazy_load_bank = false;
|
||||||
|
int m_lazy_load_sent_bank_slots = 0;
|
||||||
|
|
||||||
glm::vec3 m_Proximity;
|
glm::vec3 m_Proximity;
|
||||||
glm::vec4 last_position_before_bulk_update;
|
glm::vec4 last_position_before_bulk_update;
|
||||||
@ -2175,7 +2179,6 @@ private:
|
|||||||
bool m_has_quest_compass = false;
|
bool m_has_quest_compass = false;
|
||||||
std::vector<uint32_t> m_dynamic_zone_ids;
|
std::vector<uint32_t> m_dynamic_zone_ids;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum BotOwnerOption : size_t {
|
enum BotOwnerOption : size_t {
|
||||||
booDeathMarquee,
|
booDeathMarquee,
|
||||||
|
|||||||
@ -289,6 +289,37 @@ bool Client::Process() {
|
|||||||
entity_list.ScanCloseMobs(close_mobs, this, IsMoving());
|
entity_list.ScanCloseMobs(close_mobs, this, IsMoving());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (RuleB(Inventory, LazyLoadBank)) {
|
||||||
|
// poll once a second to see if we are close to a banker and we haven't loaded the bank yet
|
||||||
|
if (!m_lazy_load_bank && lazy_load_bank_check_timer.Check()) {
|
||||||
|
if (m_lazy_load_sent_bank_slots <= EQ::invslot::SHARED_BANK_END && IsCloseToBanker()) {
|
||||||
|
m_lazy_load_bank = true;
|
||||||
|
lazy_load_bank_check_timer.Disable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_lazy_load_bank && m_lazy_load_sent_bank_slots <= EQ::invslot::SHARED_BANK_END) {
|
||||||
|
const EQ::ItemInstance *inst = nullptr;
|
||||||
|
|
||||||
|
// Jump the gaps
|
||||||
|
if (m_lazy_load_sent_bank_slots < EQ::invslot::BANK_BEGIN) {
|
||||||
|
m_lazy_load_sent_bank_slots = EQ::invslot::BANK_BEGIN;
|
||||||
|
}
|
||||||
|
else if (m_lazy_load_sent_bank_slots > EQ::invslot::BANK_END &&
|
||||||
|
m_lazy_load_sent_bank_slots < EQ::invslot::SHARED_BANK_BEGIN) {
|
||||||
|
m_lazy_load_sent_bank_slots = EQ::invslot::SHARED_BANK_BEGIN;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_lazy_load_sent_bank_slots++;
|
||||||
|
}
|
||||||
|
|
||||||
|
inst = m_inv[m_lazy_load_sent_bank_slots];
|
||||||
|
if (inst) {
|
||||||
|
SendItemPacket(m_lazy_load_sent_bank_slots, inst, ItemPacketType::ItemPacketTrade);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool may_use_attacks = false;
|
bool may_use_attacks = false;
|
||||||
/*
|
/*
|
||||||
Things which prevent us from attacking:
|
Things which prevent us from attacking:
|
||||||
@ -780,6 +811,7 @@ void Client::BulkSendInventoryItems()
|
|||||||
last_pos = ob.tellp();
|
last_pos = ob.tellp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!RuleB(Inventory, LazyLoadBank)) {
|
||||||
// Bank items
|
// Bank items
|
||||||
for (int16 slot_id = EQ::invslot::BANK_BEGIN; slot_id <= EQ::invslot::BANK_END; slot_id++) {
|
for (int16 slot_id = EQ::invslot::BANK_BEGIN; slot_id <= EQ::invslot::BANK_END; slot_id++) {
|
||||||
const EQ::ItemInstance* inst = m_inv[slot_id];
|
const EQ::ItemInstance* inst = m_inv[slot_id];
|
||||||
@ -807,6 +839,7 @@ void Client::BulkSendInventoryItems()
|
|||||||
|
|
||||||
last_pos = ob.tellp();
|
last_pos = ob.tellp();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
auto outapp = new EQApplicationPacket(OP_CharInventory);
|
auto outapp = new EQApplicationPacket(OP_CharInventory);
|
||||||
outapp->size = ob.size();
|
outapp->size = ob.size();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user