Skip to content

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.

A box is an etc item. Its type in sp2_etcitem_info.ini is the key that links everything.

  1. Look at sp2_etcitem_info.ini (server and client). The box block has name, type and a price. Example: type = 1000022 is the first gashapon.
  2. Choose a type from a range the code already knows. The client ioEtcItemManager::CreateEtcItem accepts 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 uses EIT_ETC_SUPER_GASHAPON1 (1002230) to 1002429 and the later ranges up to EIT_ETC_SUPER_GASHAPON2000.
  3. A type outside the known ranges is skipped with UNKOWN ETCITEM TYPE in the log. Do not make up a number.
  4. 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 = 1
MaxInfo = 883
[GashaponPresent1]
EtcItemType = 1000022
PresentSendID = Event
PresentAlarm = 0
PresentMent = 12
PresentPeriod = 7
MaxItem = 2
Gashapon1_Rand = 9000
Whole1_Alarm = 0
Present1_Type = 1
Present1_Value1 = 1
Present1_Value2 = 7200
Present1_Peso = 0
Gashapon2_Rand = 1000
Whole2_Alarm = 1
Present2_Type = 4
Present2_Value1 = 5000
Present2_Value2 = 0
Present2_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

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 box

In 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 = 0 is 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.

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 = 1002232
PresentSendID = Event
MaxPackage = 2
Period = 28
Package1_Alaram = 0
Package1_Rand = 90000
Package1_Ment = 77
Package1_Element_Cnt = 2
Package1_Element1_Type = 1
Package1_Element1_Value1 = 64
Package1_Element1_Value2 = 0
Package1_Element2_Type = 5
Package1_Element2_Value1 = 10064
Package1_Element2_Value2 = 30000
Package2_Alaram = 1
Package2_Rand = 10000
Package2_Ment = 77
Package2_Element_Cnt = 1
Package2_Element1_Type = 3
Package2_Element1_Value1 = 1012011
Package2_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.

  1. Save the server file. ioSuperGashaponMgr::CheckNeedReload reloads the super gashapon file every time it runs. For the normal gashapon, a comment in the file says Change = 1 refreshes the data within one minute. In the 2021 loader the Change key is commented out, so the claim is not confirmed yet. If in doubt, restart the game server.
  2. Update the client copy and restart the client.
  3. Open the box with a test account. Check the gift box (type, hours) and the preview window.
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\