Gacha Boxes, Rates and Rewards
Lost Saga has two kinds of box that give random rewards:
| Box | Server file | Reads rate from | One roll gives |
|---|---|---|---|
| Gashapon | sp2_gashapon_present.ini |
GashaponN_Rand |
one reward |
| Super gashapon | sp2_super_gashapon_present.ini |
PackageN_Rand |
a package of several rewards |
Both files live in ls_gamesvr\config\. The client has a copy of the same file name in config\. It shows what the box can give. The server decides what it really gives. Keep both lists the same, otherwise the preview lies.
Names and line numbers come from ioPresentHelper.cpp (LoadGashaponPresent), ioSuperGashaponMgr.cpp and the client ioGashaponMgr.cpp. Anything not checked is marked not confirmed yet.
Step 1: pick the box item
Section titled “Step 1: pick the box item”A box is an etc item. Its type in sp2_etcitem_info.ini is the key that links everything.
- Look at
sp2_etcitem_info.ini(server and client). The box block hasname,typeand a price. Example:type = 1000022is the first gashapon. - Choose a
typefrom a range the code already knows. The clientioEtcItemManager::CreateEtcItemaccepts these ranges for gashapon (ioEtcItem.h):EIT_ETC_GASHAPON(1000022), 1000034 to 1000045, 1000053 to 1000092, 1000525 to 1000724, 1003530 to 1003829 and more. Super gashapon usesEIT_ETC_SUPER_GASHAPON1(1002230) to 1002429 and the later ranges up toEIT_ETC_SUPER_GASHAPON2000. - A type outside the known ranges is skipped with
UNKOWN ETCITEM TYPEin the log. Do not make up a number. - Put the box in the shop as described in Shop items.
Step 2: add a gashapon (one reward per roll)
Section titled “Step 2: add a gashapon (one reward per roll)”Add a block to sp2_gashapon_present.ini:
[Common]Change = 1MaxInfo = 883
[GashaponPresent1]EtcItemType = 1000022PresentSendID = EventPresentAlarm = 0PresentMent = 12PresentPeriod = 7MaxItem = 2
Gashapon1_Rand = 9000Whole1_Alarm = 0Present1_Type = 1Present1_Value1 = 1Present1_Value2 = 7200Present1_Peso = 0
Gashapon2_Rand = 1000Whole2_Alarm = 1Present2_Type = 4Present2_Value1 = 5000Present2_Value2 = 0Present2_Peso = 0| Key | Meaning |
|---|---|
MaxInfo (in [Common]) |
Number of [GashaponPresentN] blocks. Blocks past it are not read. Raise it when you add one |
EtcItemType |
The type of the box item |
MaxItem |
Number of reward entries. Entries past it are not read |
PresentSendID, PresentMent, PresentPeriod, PresentAlarm |
Sender name, message id, gift period and alarm flag. The units of PresentPeriod and PresentMent are not confirmed yet |
GashaponN_Rand |
Weight of reward N |
WholeN_Alarm |
1 announces the win to the whole server |
PresentN_Type, Value1, Value2 |
The reward, see step 4 |
PresentN_Peso |
Peso value linked to the reward (read as m_iPresentPeso). Exact use: not confirmed yet |
Step 3: understand the rates
Section titled “Step 3: understand the rates”The server adds all Rand values of one box into a seed (m_dwGashaponPresentSeed), rolls a number from 0 to seed, and walks the list.
chance of reward N = GashaponN_Rand / sum of all Rand in the boxIn the example, the sum is 10000, so reward 1 has 90 percent and reward 2 has 10 percent. Notes from the loader:
- An entry with
Rand = 0is skipped, with the log line “Rand is zero. it is not setting.” - You do not need to add up to 10000. Any total works.
- The list is sorted after loading (
GashaponPresentSort). The file order does not matter. - The client file has no rates. Players see the list but not the odds.
Step 4: choose a reward type
Section titled “Step 4: choose a reward type”The comment block at the top of sp2_gashapon_present.ini explains Type, Value1 and Value2:
| Type | Reward | Value1 | Value2 |
|---|---|---|---|
| 1 | Hero | hero number | hours (0 is permanent) |
| 2 | Decoration | part | code |
| 3 | Etc item or permission | item type | count |
| 4 | Peso | amount | not used |
| 5 | Gear | gear code | enhance x 10000 + hours |
| 5 | Growth gear | gear code | 100000000 + enhance x 10000 + hours |
| 6 | Gear box | machine code | sell-back price |
| 7 | Random decoration | part (gender 5, hair 2, hair color 4, face 1, skin 3, base clothes 7; add 1000 for female) | code |
| 8 | Experience | amount | not used |
| 9 | Medal | medal type | hours |
| 14 | Accessory | code | see file |
The code defines more types in ioUserPresent.h: 10 alchemic item, 11 pet, 12 costume, 13 bonus cash. Types 15 (costume box) and 16 (spirit) exist in 2019 and 2021 only. In 2014 the list ends at 14. The server ioPresentHelper handles each type when it hands out the gift. What every type does with Value2: not confirmed yet for types 10 to 16.
Check that the reward exists in the other config files: the hero number in sp2_setitem_info.ini, the gear code in sp2_extraitem_info.ini, the medal type in sp2_medalitem_info.ini. A reward that does not exist cannot be created.
Step 5: add a super gashapon (package per roll)
Section titled “Step 5: add a super gashapon (package per roll)”Add a block to sp2_super_gashapon_present.ini:
[GashaponPresent2]EtcItemType = 1002232PresentSendID = EventMaxPackage = 2Period = 28
Package1_Alaram = 0Package1_Rand = 90000Package1_Ment = 77Package1_Element_Cnt = 2Package1_Element1_Type = 1Package1_Element1_Value1 = 64Package1_Element1_Value2 = 0Package1_Element2_Type = 5Package1_Element2_Value1 = 10064Package1_Element2_Value2 = 30000
Package2_Alaram = 1Package2_Rand = 10000Package2_Ment = 77Package2_Element_Cnt = 1Package2_Element1_Type = 3Package2_Element1_Value1 = 1012011Package2_Element1_Value2 = 300| Key | Meaning |
|---|---|
MaxInfo ([Common]) |
Number of blocks |
MaxPackage |
Number of packages in the block |
PackageN_Rand |
Weight of package N. Same rule as step 3. 0 skips the package |
PackageN_Alaram |
Server announcement (the spelling “Alaram” is in the code) |
PackageN_Ment |
Message id |
PackageN_limit |
Stock for this package. The server counts it down |
PackageN_Element_Cnt |
Number of rewards in the package |
PackageN_ElementM_Type, Value1, Value2 |
One reward, same types as step 4. Also _Ment and _Period per element |
Period |
Gift period of the box (m_iSuperGashaponPeriod). The unit is not confirmed yet |
MaxLimit |
If above 0, the box also reads a second list with the prefix Sub (SubMaxPackage, SubPackage1_Rand, …) |
Limited stock is saved in sp2_super_gashapon_present_leftovercount_<port>.ini, named after the game server port. On reload, a package with no stock left is skipped (“SOLD OUT” in the log). To restock, edit or delete that file. The exact stock rules for the Sub list: not confirmed yet.
The client file for the 2021 source shows the same blocks and elements without the Rand values.
Step 6: reload and test
Section titled “Step 6: reload and test”- Save the server file.
ioSuperGashaponMgr::CheckNeedReloadreloads the super gashapon file every time it runs. For the normal gashapon, a comment in the file saysChange = 1refreshes the data within one minute. In the 2021 loader theChangekey is commented out, so the claim is not confirmed yet. If in doubt, restart the game server. - Update the client copy and restart the client.
- Open the box with a test account. Check the gift box (type, hours) and the preview window.
Differences between versions
Section titled “Differences between versions”| 2014 | 2019 | 2021 | |
|---|---|---|---|
| Gashapon and super gashapon loaders | yes | yes | yes |
PresentLimitedQuantity, PresentN_Limited |
no | no | yes |
Client reads PresentN_order, PresentN_Special_Type |
yes | yes | yes |
| Reward types 15 and 16 | no | yes | yes |
| Server config in the repo | ls_gamesvr\config\ (plus a differing copy in ls_mainsvr\config\; no ls_mainsvr code loads it) |
ls_gamesvr\config\ |
ls_gamesvr\config\ |
