Pet Entries (petbedge_interface.lua)
Server pet table src_PetTable in script/petbedge_interface.lua
How it works
Every pet has an entry in src_PetTable keyed by its pet ID. The server reads it when a pet is made, fused or reborn. Some fields are used by the script itself, and the rest are read directly by gs.
| Setting | Where | What it does |
|---|---|---|
| Pet entry | script/petbedge_interface.lua → src_PetTable |
Base settings, stats and growth for each pet |
| Pet record | elements.data (client and server) |
Name, model and many of the same values |
| Element bonus | script/petbedge_interface.lua → ELEMENT_BONUS |
Extra stats each element gives |
Note: The file is saved in Chinese (GBK) encoding. Keep it that way when you save, or the Chinese names break.
Warning: Back up
petbedge_interface.luabefore editing. A missing comma or bracket stops all pets from loading.
Status labels
| Label | Meaning |
|---|---|
| Confirmed | Read by the script, or matches across many pets |
| Likely | Fits the values seen, not tested |
| Unknown | Meaning not found yet |
Entry layout
Each entry has four parts:
[pet ID] = {
{ line 1: 18 settings },
{ part 2: 6 rows of 18 stats },
{ part 3: 4 chances },
{ part 4: lists },
},
Example: Unicorgi (30211)
The full entry as it appears in the file:
[30211] = {
{"金瞳犬",6,3,103000,0,1,128,2,0,137,2,.9,0,29,34,0,0,95,},
{ {40.8,2.196,1.116,7.696,.992,0,.16,.18,.18,.16,.18,0,.02,1.2,.02,1.2,90,1,}, {3.06,.1647,.0837,.5772,.0744,0,.012,.0135,.0135,.012,.0135,0,.0015,0,.0015,0,6.75,.075,}, {2400,6.588,3.348,23.088,2.976,0,.72,.72,.693,.693,.756,0,.0945,0,.0945,0,270,3,}, {29.0133333333333,2.6112,.6528,2.6112,.580266666666667,0,.145066666666667,.1632,.1632,.145066666666667,.1632,0,1.81333333333333E-04,0,1.81333333333333E-04,0,0,0,}, {2.176,.19584,.04896,.19584,.04352,0,.01088,.01224,.01224,.01088,.01224,0,.000014,0,.000014,0,0,0,}, {87,7.8,1.96,7.8,1.74,0,.36179,.36179,.36179,.36179,.396,0,.00066,0,.0006556,0,0,0,},},
{.26,.156,.104,.48,},
{0,0,{4},{10,11,14,15,16,17,51,52,25,26,29,30,31,32,42,43,},},
},
What it tells us about Unicorgi:
- Starts at level 6, native skill
137, model level34. - Field 14 is
29, so it isn't an affinity version. - Its element is fixed to
4(Pyros), from the{4}in part 4. - Nearly half its combat type chance is on the 4th type (
.48).
Line 1 – settings
| # | Example | Meaning | Status |
|---|---|---|---|
| 1 | 金瞳犬 |
Chinese name (the English name is in elements.data) |
Confirmed |
| 2 | 6 |
Start level | Confirmed |
| 3 | 3 |
Always 3 | Unknown |
| 4 | 103000 |
100500–160000 | Unknown |
| 5 | 0 |
0, 1, 2, 20 or 150 | Unknown |
| 6 | 1 |
Always 1 | Unknown |
| 7 | 128 |
Monster type (always one bit: 2, 4, 8 … 512) | Likely |
| 8 | 2 |
Combat type (0–4) | Likely |
| 9 | 0 |
Gender: 0 or 1, 2 = either | Confirmed |
| 10 | 137 |
Native skill ID | Confirmed |
| 11 | 2 |
Mostly 2 | Unknown |
| 12 | .9 |
0.75–3 | Unknown |
| 13 | 0 |
0–5 | Unknown |
| 14 | 29 |
Affinity on affinity versions (see below) | Confirmed |
| 15 | 34 |
Model level (used to pick fusion results) | Confirmed |
| 16 | 0 |
Flag, 0 or 1 | Unknown |
| 17 | 0 |
Flag, 0 or 1 | Unknown |
| 18 | 95 |
1–273 | Unknown |
Field 14: affinity
On pets that come in affinity versions, field 14 sets the affinity. Normal pets use 0 or 10–52 here instead, so Unicorgi's 29 means it isn't an affinity version.
| Value | Affinity |
|---|---|
1 |
Ferus |
2 |
Flora |
3 |
Terra |
4 |
Aquan |
5 |
Pyros |
- The affinity versions of a pet are identical except for this value, and their names match 2, 5 and 3.
- The order matches the client's pet affinity lines in
configs.pck→configs\item_desc.txt. - The script never reads field 14;
gsreads it directly.
Note: 1 (Ferus) and 4 (Aquan) come from the order only. Test them in game.
Part 2 – the 18 combat stats
Part 2 has six rows. Each row lists the same 18 stats in this order (from the script's own list, orig_pet.title):
Unicorgi's values are shown as the example.
| # | Stat | Start | Start cap | Growth | Growth cap |
|---|---|---|---|---|---|
| 1 | HP | 40.8 |
2400 |
29.01 |
87 |
| 2 | Phys attack | 2.196 |
6.588 |
2.611 |
7.8 |
| 3 | Phys defense | 1.116 |
3.348 |
0.6528 |
1.96 |
| 4 | Magic attack | 7.696 |
23.088 |
2.611 |
7.8 |
| 5 | Magic defense | 0.992 |
2.976 |
0.5803 |
1.74 |
| 6 | Phys resist | 0 |
0 |
0 |
0 |
| 7 | Ferus resist | 0.16 |
0.72 |
0.1451 |
0.3618 |
| 8 | Flora resist | 0.18 |
0.72 |
0.1632 |
0.3618 |
| 9 | Aquan resist | 0.18 |
0.693 |
0.1632 |
0.3618 |
| 10 | Pyros resist | 0.16 |
0.693 |
0.1451 |
0.3618 |
| 11 | Terra resist | 0.18 |
0.756 |
0.1632 |
0.396 |
| 12 | Void resist | 0 |
0 |
0 |
0 |
| 13 | Phys crit rate | 0.02 |
0.0945 |
0.00018 |
0.00066 |
| 14 | Phys crit damage | 1.2 |
0 |
0 |
0 |
| 15 | Magic crit rate | 0.02 |
0.0945 |
0.00018 |
0.0006556 |
| 16 | Magic crit damage | 1.2 |
0 |
0 |
0 |
| 17 | Hit | 90 |
270 |
0 |
0 |
| 18 | Dodge | 1 |
3 |
0 |
0 |
| Row | Meaning | Status |
|---|---|---|
| 1 | Starting value | Confirmed |
| 2 | Random spread on the start (always 7.5% of row 1) | Likely |
| 3 | Starting value cap | Confirmed |
| 4 | Growth (potential) | Confirmed |
| 5 | Random spread on the growth (7.5% of row 4) | Likely |
| 6 | Growth cap | Confirmed |
Tip: If you change row 1 or row 4, change row 2 or row 5 to match (7.5%).
Part 3 – four chances
Example: {.26,.156,.104,.48}. The four values always add up to 1. They're most likely the chance of each combat type when the pet is made. The most common set is {.4,.4,.2,0}.
Status: Likely. gs reads this part, not the script.
Part 4 – lists
{0, 0, {elements}, {list}}
| Item | Meaning | Status |
|---|---|---|
| 1st and 2nd | Always 0 | Unknown |
| 3rd list | Elements the pet can roll: {1,2,3,4,5} = any, one number = fixed |
Confirmed |
| 4th list | Same on almost every pet | Unknown |
Element IDs
Element IDs use a different order from field 14:
| ID | Element | Extra stats (ELEMENT_BONUS) |
|---|---|---|
1 |
Ferus | Phys attack, Ferus resist |
2 |
Flora | Magic attack, magic defense, dodge, Flora resist |
3 |
Aquan | HP, Aquan resist |
4 |
Pyros | Magic attack, Pyros resist |
5 |
Terra | Phys attack, phys defense, hit, Terra resist |
The same IDs are used by the element reroll item 15853 and by the client's "Elemental Type" text.
Warning: Don't mix up the two orders. Field 14 uses 3 = Terra, 4 = Aquan, 5 = Pyros. Element IDs use 3 = Aquan, 4 = Pyros, 5 = Terra.
Making an affinity version of a pet
- Copy the pet's record in
elements.datato a new ID and rename it (client and server copies). - In
petbedge_interface.lua, copy the pet's entry and give it the same new ID. - Set field 14 to the affinity value (1–5).
- Optional: set the 3rd list in part 4 to one element ID to fix the pet's element.
- Save as GBK and restart the server.
Still unknown
- Line 1 fields 3–6, 11–13 and 16–18. Most of them also appear in the pet's record in
elements.data, so its field names should explain them. - What the 1st, 2nd and 4th items of part 4 do.