feat(Core): Implement account play time restrictions (CAIS) (#24576)

Co-authored-by: ratkosrb <35845488+ratkosrb@users.noreply.github.com>
Co-authored-by: sudlud <sudlud@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: DDuarte <530940+DDuarte@users.noreply.github.com>
This commit is contained in:
Benjamin Jackson
2026-07-21 06:40:37 -04:00
committed by GitHub
parent 2adaf94e13
commit a16ef90f28
20 changed files with 344 additions and 46 deletions

View File

@@ -15,17 +15,28 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "GameTime.h"
#include "Opcodes.h"
#include "WorldPacket.h"
#include "WorldSession.h"
void WorldSession::SendAuthResponse(uint8 code, bool shortForm, uint32 queuePos)
{
// BillingTimeRested: seconds of "healthy" play left before CAIS halves XP/loot from creatures
// and quests (read by the client's GetBillingTimeRested()); 0 unless the CAIS flag is set.
uint32 billingTimeRested = 0;
if (IsAffectedByCAIS())
{
Seconds const played = GetConsecutivePlayTime(GameTime::GetGameTime());
if (played < PLAY_TIME_LIMIT_PARTIAL)
billingTimeRested = uint32((PLAY_TIME_LIMIT_PARTIAL - played).count());
}
WorldPacket packet(SMSG_AUTH_RESPONSE, 1 + 4 + 1 + 4 + 1 + (shortForm ? 0 : (4 + 1)));
packet << uint8(code);
packet << uint32(0); // BillingTimeRemaining
packet << GetBillingPlanFlags();
packet << uint32(0); // BillingTimeRested
packet << billingTimeRested;
uint8 exp = Expansion(); // 0 - normal, 1 - TBC, 2 - WotLK, must be set in database manually for each account
if (exp >= MAX_EXPANSIONS)