Purpose

When a character logs in, gives a random item bag, once per account per day. The bag depends on the account's VIP level. If the inventory does not have enough free slots, the reward is not granted and is not marked as claimed: the player receives it at the next login after clearing space.

How to enable

  1. Run the file Includes\DailyReward\DailyReward.sql once on the game DB. If you already have an older table with the two columns AccountID and LastReceiveDate, set TableName in Config.lua to that table's name instead of creating a new table.
  2. Remove the -- in front of LoadModule("DailyReward\\DailyReward") in Main.lua.
  3. Edit Config.lua.
  4. Click Reload LuaAPI.

The module attaches OnCharacterEntry and OnSQLAsyncResult.

SQL to create (SQL Server)

IF OBJECT_ID(N'dbo.DailyReward', N'U') IS NULL
CREATE TABLE dbo.DailyReward (
    AccountID NVARCHAR(10) NOT NULL,
    LastReceiveDate DATE NULL,
    CONSTRAINT PK_DailyReward PRIMARY KEY (AccountID)
);

Configuration (Config.lua, DailyRewardConfig table)

KeyValueDefaultMeaning
Enabletrue / falsetrueTurns the module on / off.
TableNamestring"DailyReward"DB table name.
MinFreeSlotsnumber8Number of free slots required before the reward is granted.
Rewardtablebag 48 (VIP -1..3), 49 (VIP 4)Maps VIP level to an item bag (GUID or name in Data\ItemBags). [-1] = no VIP. A VIP level not in the table gets no reward.
VipNametableNormal, Bronze VIP...VIP name shown to the player.
Texttable(built in)The notice messages (Given, Level, Wish, Already, NextTime, NoSpace, NoReward). Set "" to hide a message.
The day changes at 00:00 server time. The check is per account, so several characters on the same account share one reward per day.