Fix buff suppression state not persisting across zones

When a player zones while having suppressed buffs (via the spell
suppression system), the suppression state was not saved to the
database. On zone-in, suppressed buffs were restored as normal active
buffs, causing non-persistent illusions to be incorrectly removed.

Changes:
- Add 'suppressed' column to character_buffs table (tinyint, default 0)
- SaveBuffs(): Save suppressed flag (1 when buff is in SPELL_SUPPRESSED state)
- LoadBuffs(): Restore buffs in suppressed state when suppressed=1,
  setting spellid=SPELL_SUPPRESSED and populating suppressedid/
  suppressedticsremaining from the saved spell_id and ticsremaining
- LoadBuffs(): Skip suppressed buffs in the illusion/charm removal loop
  so they are not incorrectly stripped on zone-in

Fixes #33
This commit is contained in:
Vayle
2026-01-31 02:24:33 +00:00
parent b3c40242f0
commit 9d98f95317
3 changed files with 29 additions and 2 deletions
@@ -36,6 +36,7 @@ public:
int32_t caston_z;
int32_t ExtraDIChance;
int32_t instrument_mod;
uint8_t suppressed;
};
static std::string PrimaryKey()
@@ -63,6 +64,7 @@ public:
"caston_z",
"ExtraDIChance",
"instrument_mod",
"suppressed",
};
}
@@ -86,6 +88,7 @@ public:
"caston_z",
"ExtraDIChance",
"instrument_mod",
"suppressed",
};
}
@@ -143,6 +146,7 @@ public:
e.caston_z = 0;
e.ExtraDIChance = 0;
e.instrument_mod = 10;
e.suppressed = 0;
return e;
}
@@ -196,6 +200,7 @@ public:
e.caston_z = row[14] ? static_cast<int32_t>(atoi(row[14])) : 0;
e.ExtraDIChance = row[15] ? static_cast<int32_t>(atoi(row[15])) : 0;
e.instrument_mod = row[16] ? static_cast<int32_t>(atoi(row[16])) : 10;
e.suppressed = row[17] ? static_cast<uint8_t>(strtoul(row[17], nullptr, 10)) : 0;
return e;
}
@@ -246,6 +251,7 @@ public:
v.push_back(columns[14] + " = " + std::to_string(e.caston_z));
v.push_back(columns[15] + " = " + std::to_string(e.ExtraDIChance));
v.push_back(columns[16] + " = " + std::to_string(e.instrument_mod));
v.push_back(columns[17] + " = " + std::to_string(e.suppressed));
auto results = db.QueryDatabase(
fmt::format(
@@ -284,6 +290,7 @@ public:
v.push_back(std::to_string(e.caston_z));
v.push_back(std::to_string(e.ExtraDIChance));
v.push_back(std::to_string(e.instrument_mod));
v.push_back(std::to_string(e.suppressed));
auto results = db.QueryDatabase(
fmt::format(
@@ -330,6 +337,7 @@ public:
v.push_back(std::to_string(e.caston_z));
v.push_back(std::to_string(e.ExtraDIChance));
v.push_back(std::to_string(e.instrument_mod));
v.push_back(std::to_string(e.suppressed));
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
}
@@ -380,6 +388,7 @@ public:
e.caston_z = row[14] ? static_cast<int32_t>(atoi(row[14])) : 0;
e.ExtraDIChance = row[15] ? static_cast<int32_t>(atoi(row[15])) : 0;
e.instrument_mod = row[16] ? static_cast<int32_t>(atoi(row[16])) : 10;
e.suppressed = row[17] ? static_cast<uint8_t>(strtoul(row[17], nullptr, 10)) : 0;
all_entries.push_back(e);
}
@@ -421,6 +430,7 @@ public:
e.caston_z = row[14] ? static_cast<int32_t>(atoi(row[14])) : 0;
e.ExtraDIChance = row[15] ? static_cast<int32_t>(atoi(row[15])) : 0;
e.instrument_mod = row[16] ? static_cast<int32_t>(atoi(row[16])) : 10;
e.suppressed = row[17] ? static_cast<uint8_t>(strtoul(row[17], nullptr, 10)) : 0;
all_entries.push_back(e);
}
@@ -512,6 +522,7 @@ public:
v.push_back(std::to_string(e.caston_z));
v.push_back(std::to_string(e.ExtraDIChance));
v.push_back(std::to_string(e.instrument_mod));
v.push_back(std::to_string(e.suppressed));
auto results = db.QueryDatabase(
fmt::format(
@@ -551,6 +562,7 @@ public:
v.push_back(std::to_string(e.caston_z));
v.push_back(std::to_string(e.ExtraDIChance));
v.push_back(std::to_string(e.instrument_mod));
v.push_back(std::to_string(e.suppressed));
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
}