mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-07 15:28:02 +00:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user