Pets - Data, Growth and Shop Entry
A pet is a small companion a player hatches from an egg, feeds to raise its level, and can sell or merge. This guide shows which files control that and what to change.
All file names come from the code that loads them. Anything marked not confirmed yet was not verified in code or config.
How pets work
Section titled “How pets work”- The player buys an egg (an etc item) and uses it. The server rolls a rank (D to S, numbers 1 to 5), then a pet code from the egg table.
- The new pet is saved in the table
userPetDBwithgame_pet_add. - The player feeds the pet with feed items. The pet gains EXP and levels up until the maximum level of its rank.
- Two pets of the same rank at maximum level can be merged (compound). A pet can also be sold for pesos.
| What | Server file (ls_gamesvr\config\) |
Loaded by | Client file (config\) |
|---|---|---|---|
| Pet list, rank table, EXP | sp2_pet_info.ini |
ioPetInfoManager.cpp |
sp2_pet_info.ini |
| Egg hatch rates, merge rates | sp2_pet_gashapon.ini |
ioPetGashaponManager.cpp |
none |
| Pet look (model, animation) | none | not read by the server | sp2_pet.ini, pet\pet_01.ini |
| Eggs and feed in the shop | sp2_etcitem_info.ini |
ioEtcItemManager |
sp2_etcitem_info.ini |
Server and client must agree. If the client has no entry for a pet code, the pet cannot be shown.
Step 1: Add a pet
Section titled “Step 1: Add a pet”The pet code ties four places together.
-
Server list. In
sp2_pet_info.iniadd a block and raise the count:[pet_base_common]max_base_info_cnt = 47[pet_base_info47]pet_code = 47The loader reads
pet_base_info1up tomax_base_info_cntin order (ioPetInfoManager::LoadINI). A pet code that is not in this list is rejected by the merge check (CheckRightPetCode) and by the pet lookup inUser.cpp(GetPetInfo). -
Client look. In
pet\pet_01.iniadd[pet47]with the samepet_code, pluspet_main_type,pet_sub_type,max_model_infoand onemodel_info<n>_rank,_model,_scale_x/y/zper rank. Raisepet_cntin[common_info]. Animation names are in the same block (default_ani<n>_ani_name,state_ani...). -
Client group list.
sp2_pet.inilists the group files (pet_group_cnt,pet_group0 = pet/pet_01.ini). Only add a line here if you create a second file. -
Egg table. Add the pet to
sp2_pet_gashapon.ini(Step 3), otherwise nobody can hatch it.
The model files (animodel/pet_004_level1.txt and so on) and the pet icons must already exist in the client packs. The model and icon formats are not covered here.
Differences:
- 2014: each
pet_base_infoalso haspet_recommend_material_code(the piece that gives the best EXP, see Step 2). The testbed file setsmax_base_info_cnt = 503but defines blocks 1 to 40 and 501 to 503, so blocks 41 to 500 are read as empty (pet code 0). - 2019 and 2021:
sp2_pet_info.iniis identical in both. Blocks 1 to 46,max_base_info_cnt = 46.
Step 2: Change growth
Section titled “Step 2: Change growth”Open sp2_pet_info.ini. The keys below are read in ioPetInfoManager::LoadINI (2019 and 2021).
[common]max_have_pet = 20max_exp_const = 50.0fpet_eat_additive_count = 50pet_eat_additive_exp = 200sell_add_peso = 10000
[pet_rank_info]max_rank_info_cnt = 5rank_info1_type = 1rank_info1_max_level = 3rank_info1_value = 1.0f| Key | Meaning |
|---|---|
max_have_pet |
Pets a player can own. Over this, hatching fails (CheckPetHavePossible) |
max_exp_const and rank_infoN_value |
EXP needed for the next level = (current level + 1) x max_exp_const x rank value |
rank_infoN_max_level |
Maximum level of rank N. Shipped: 3, 6, 9, 12, 15 for ranks D, C, B, A, S |
pet_eat_additive_count, _exp |
Feeding with the additive piece uses this many pieces and gives this much EXP |
sell_add_peso |
Pesos a player gets when selling a pet (User::OnPetSell) |
With the shipped values a rank D pet needs 50, 100, 150 EXP for its first three levels, and a rank S pet needs three times that.
Feed items. Feed is a normal etc item with the key add_pet_exp in sp2_etcitem_info.ini. Only the codes 1012001 to 1012010 (EIT_ETC_PET_FEED_01 to _10) and the additive piece are accepted (ioUserPet::PetNurture). Shipped: fruit gives 50 EXP, bread gives 100 EXP. To add feed, copy a block, set a free code in that range and set add_pet_exp.
The client copy of sp2_pet_info.ini also holds max_exp_const, the rank table and sell_add_peso for its tooltips. Change both files the same way.
Differences:
- 2014 uses pieces, not feed.
sp2_pet_info.inihasright_material,diff_material,additive_material(EXP factor for the recommended piece, other pieces and the additive) and a[need_material_count]block withrank<N>_level<M>(pieces needed per level).pet_eat_additive_*does not exist there. - 2019 and 2021 use the feed and additive model above.
[need_material_count]is gone.
Step 3: Set hatch and merge rates
Section titled “Step 3: Set hatch and merge rates”Open sp2_pet_gashapon.ini (ioPetGashaponManager::LoadINI).
[buy_random_limit]peso_start_rank = 1peso_end_rank = 2gold_start_rank = 3gold_end_rank = 4
[rank_random]max_rank_count = 5rank1_random = 7500rank2_random = 2000rank3_random = 490rank4_random = 10rank5_random = 0
[rank_D]max_pet_count = 12pet1_rand = 100pet1_type = 11pet1_value1 = 1pet1_value2 = 1
[diff_pet_compound_rate]success_rate = 100fail_rate = 900- Rank odds.
rankN_randomare weights. A peso egg rolls only among rankspeso_start_ranktopeso_end_rank, a gold egg amonggold_start_ranktogold_end_rank. - Pet odds. Each
[rank_X]section lists pets withpet<n>_rand(weight),pet<n>_value1(pet code) andpet<n>_value2(start rank).max_pet_countmust match the number of entries. The pool for rank N is every pet listed in ranks D up to N, so a pet under[rank_D]can also hatch at rank C or B. - Merge odds. Two pets of the same rank, both at maximum level and not equipped, can be merged (
PetCompound). The same pet code gives that pet one rank higher. Two different pets give a rank-up withsuccess_rateout ofsuccess_rate + fail_rate(shipped: 10 percent), otherwise a random pet of the same rank. At the top rank the result is a random top-rank pet. - Which egg is gold. The egg is gold only if its block in
sp2_etcitem_info.inihassell_cash = 1(ioEtcItemPetEgg). No shipped block sets it, so every egg uses the peso ranks. Add the key to the gold egg if you want it to usegold_start_ranktogold_end_rank. Not tested.
Shipped state in all three sources: only [rank_D] has pets (12), the sections C to S have max_pet_count = 0. total_pet_count in [common] is only used to reserve memory.
Step 4: Sell eggs and feed
Section titled “Step 4: Sell eggs and feed”Eggs and feed are etc items, so the shop steps are the same as in Add, price and remove shop items.
- Egg codes run from 1004930 (
EIT_ETC_PET_EGG_001) to 1005029 (EIT_ETC_PET_EGG_100). Shipped:[etcitem1454](code 1004930, 48000 pesos) and[etcitem1455](code 1004931, 4800 gold). - Server block sets the price (
peso1,cash1),active1andsell_cash. - Client block with the same
typesets the shop tab and place:shop_name1,shop_tab_type,shop_order,buy_popup_type,icon_name,main_manual,sub_manual. In the 2021 client the egg block is inconfig\sp2_etcitem_info.ini.
If the item is in the server file but not in the client file, it is not listed. If the prices differ, the server price wins.
Database
Section titled “Database”| Item | Name |
|---|---|
| Table | userPetDB (petCode, petRank, petLevel, petExp, petEquip, petStatus) |
| Procedures | game_pet_get_list, game_pet_add, game_pet_delete (sets petStatus = 0), game_pet_save |
Query ids in ls_query.ini |
177 to 180; log query 1030 log_data_pet_add |
- 2019 and 2021: the table and procedures are in the testbed scripts (
scripts21\010_LosaGame.sql,03_LS21_LosaGame.sql). - 2014: the 2012 base scripts have no pets. The testbed first creates empty stubs (
05_LS14_LosaGame_stubs.sql) and then replaces them with the 2021 versions in10_LS14_2021_features.sql. Without that script, pets do not save.
Reload and check
Section titled “Reload and check”- Edit the server files, then restart the game server. A live reload needs
Change = 1in the file.CheckNeedReloadreads it from[common], and the GM tool sends reload type 19 (RELOAD_PET), listed ingame_server_reload_list.inion the main server. The shippedsp2_pet_info.iniandsp2_pet_gashapon.inihave noChangekey, so add it first. Live reload was not tested here. - Log in, buy and use an egg, feed the pet, and check the row in
userPetDB.
Not confirmed yet
Section titled “Not confirmed yet”- Pet pack contents of the 2014 and 2019 clients.
- The meaning of
pet<n>_type(the file header says 12, the shipped entries use 11). - Live reload with
Change = 1. - Models and icons for new pets.
