Skip to content

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.

  1. 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.
  2. The new pet is saved in the table userPetDB with game_pet_add.
  3. The player feeds the pet with feed items. The pet gains EXP and levels up until the maximum level of its rank.
  4. 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.

The pet code ties four places together.

  1. Server list. In sp2_pet_info.ini add a block and raise the count:

    [pet_base_common]
    max_base_info_cnt = 47
    [pet_base_info47]
    pet_code = 47

    The loader reads pet_base_info1 up to max_base_info_cnt in order (ioPetInfoManager::LoadINI). A pet code that is not in this list is rejected by the merge check (CheckRightPetCode) and by the pet lookup in User.cpp (GetPetInfo).

  2. Client look. In pet\pet_01.ini add [pet47] with the same pet_code, plus pet_main_type, pet_sub_type, max_model_info and one model_info<n>_rank, _model, _scale_x/y/z per rank. Raise pet_cnt in [common_info]. Animation names are in the same block (default_ani<n>_ani_name, state_ani...).

  3. Client group list. sp2_pet.ini lists the group files (pet_group_cnt, pet_group0 = pet/pet_01.ini). Only add a line here if you create a second file.

  4. 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_info also has pet_recommend_material_code (the piece that gives the best EXP, see Step 2). The testbed file sets max_base_info_cnt = 503 but 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.ini is identical in both. Blocks 1 to 46, max_base_info_cnt = 46.

Open sp2_pet_info.ini. The keys below are read in ioPetInfoManager::LoadINI (2019 and 2021).

[common]
max_have_pet = 20
max_exp_const = 50.0f
pet_eat_additive_count = 50
pet_eat_additive_exp = 200
sell_add_peso = 10000
[pet_rank_info]
max_rank_info_cnt = 5
rank_info1_type = 1
rank_info1_max_level = 3
rank_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.ini has right_material, diff_material, additive_material (EXP factor for the recommended piece, other pieces and the additive) and a [need_material_count] block with rank<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.

Open sp2_pet_gashapon.ini (ioPetGashaponManager::LoadINI).

[buy_random_limit]
peso_start_rank = 1
peso_end_rank = 2
gold_start_rank = 3
gold_end_rank = 4
[rank_random]
max_rank_count = 5
rank1_random = 7500
rank2_random = 2000
rank3_random = 490
rank4_random = 10
rank5_random = 0
[rank_D]
max_pet_count = 12
pet1_rand = 100
pet1_type = 11
pet1_value1 = 1
pet1_value2 = 1
[diff_pet_compound_rate]
success_rate = 100
fail_rate = 900
  1. Rank odds. rankN_random are weights. A peso egg rolls only among ranks peso_start_rank to peso_end_rank, a gold egg among gold_start_rank to gold_end_rank.
  2. Pet odds. Each [rank_X] section lists pets with pet<n>_rand (weight), pet<n>_value1 (pet code) and pet<n>_value2 (start rank). max_pet_count must 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.
  3. 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 with success_rate out of success_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.
  4. Which egg is gold. The egg is gold only if its block in sp2_etcitem_info.ini has sell_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 use gold_start_rank to gold_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.

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), active1 and sell_cash.
  • Client block with the same type sets 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 in config\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.

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 in 10_LS14_2021_features.sql. Without that script, pets do not save.
  1. Edit the server files, then restart the game server. A live reload needs Change = 1 in the file. CheckNeedReload reads it from [common], and the GM tool sends reload type 19 (RELOAD_PET), listed in game_server_reload_list.ini on the main server. The shipped sp2_pet_info.ini and sp2_pet_gashapon.ini have no Change key, so add it first. Live reload was not tested here.
  2. Log in, buy and use an egg, feed the pet, and check the row in userPetDB.
  • 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.