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
- Run the file
Includes\DailyReward\DailyReward.sqlonce on the game DB. If you already have an older table with the two columnsAccountIDandLastReceiveDate, setTableNameinConfig.luato that table's name instead of creating a new table. - Remove the
--in front ofLoadModule("DailyReward\\DailyReward")inMain.lua. - Edit
Config.lua. - 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)
| Key | Value | Default | Meaning |
|---|---|---|---|
Enable | true / false | true | Turns the module on / off. |
TableName | string | "DailyReward" | DB table name. |
MinFreeSlots | number | 8 | Number of free slots required before the reward is granted. |
Reward | table | bag 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. |
VipName | table | Normal, Bronze VIP... | VIP name shown to the player. |
Text | table | (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.