Purpose
An NPC gives gifts based on the total amount topped up. Each time the player talks to it, if the account has topped up enough, the player receives the next gift tier; the items are sent to the Gremory Case (K key). For example: tier 1 requires 20000, tier 2 requires 500000, tier 3 requires 1000000... After the tiers in the list, the required amount doubles at each tier up to MaxLevel (and the items of the last tier in the list are received).
The total top-up and the most recently claimed tier are read from your top-up table (by default acc_recharge with the columns AccountId, TotalAmount, ClaimedLevel, ClaimedDate).
How to enable
- Make sure the top-up table exists (
acc_rechargeis in the standard game DB) or edit the table / column names inDatabaseofConfig.lua. - Remove the
--in front ofLoadModule("RechargeGift\\RechargeGift")inMain.lua. - Check the NPC position and the DB columns in
Includes\RechargeGift\Config.lua. - Click Reload LuaAPI.
The module attaches OnReadScript (creates the NPC), OnNpcTalk, OnSQLAsyncResult. The NPC is created only if its map runs on this GameServer; the NPC is removed when LuaAPI is reloaded and created again (no duplicates). This module was previously named NpcAddOption.
Configuration (Config.lua, RechargeGiftConfig table)
| Key | Meaning |
|---|---|
Enable | Turns the module on / off. |
Npc | NPC created by the module: Class (Data\Monster\MonsterList.xml), Map, X, Y, Dir. |
Database | Table and column names: Table, Account (account ID column, numeric), Total (total topped up), Claimed (most recently claimed gift tier), ClaimedTime (column recording the claim time, "" = not used). |
Levels | The gift tiers in order: Name, Money (required total top-up), Items (each entry: Item = { group, index }, Level, Count, Duration in seconds, 0 = 7 days). |
MaxLevel | The last gift tier. |
Storage | Gremory Case: 1 = the character's, 2 = the account's. |
Text | The notice messages. |
Levels = {
{ Name = "First Recharge Gift", Money = 20000,
Items = { { Item = { 12, 15 }, Count = 1, Duration = 604800 } } },
},
MaxLevel = 22,
Storage = 1,