Pets: the book decides the animal

One rule

You can tame an animal only after learning the 御兽宝典 for its kind. There are 27 books and 27 kinds, one each. A book teaches one move — a 篇 named for the animal, 山君篇 for the tiger — and knowing that move carries an aura (SpellAuraChongWuJiaoHu) that marks the kind as one you can handle (PlayerEntity.SetCanJiaoHuChongWuType). That aura is the whole gate: the 驯化 row on an animal is shown on any tameable one, locked until the aura is there, and the padlock's hover reads 需要装备 followed by the 篇 you lack (SetCustomLockDes fills the pet's own move into the text). Lose the move and the pets of that kind stop following (CheckAndRemoveChongWu).

The animals

npc_chongwu lists 35 tameable characters over 27 kinds; a few kinds have a named individual as well as the common animal.

kind animal named ones book (volume · 篇) item
1 兔 家禽卷 · 月德 69001
2 羊 阿沸 家禽卷 · 卷娄 69002
3 牛 家禽卷 · 乌键 69003
4 猫 锦绣 家禽卷 · 狸奴 69004
5 狗 二黄 家禽卷 · 黄耳 69005
6 鸭 轩辕十四 家禽卷 · 晨凫 69006
7 猪 公主 家禽卷 · 豕豚 69007
8 鸡 (土申) 家禽卷 · 烛夜 69008
9 鹿 走兽卷 · 玉角 69051
10 虎 走兽卷 · 山君 69052
11 鳄鱼 走兽卷 · 土龙 69053
12 狼 大蓝 走兽卷 · 胡犲 69054
13 狐 走兽卷 · 玄狐 69055
14 熊 走兽卷 · 熊罴 69056
15 大雁 飞禽卷 · 辞鸿 69101
16 麻雀 飞禽卷 · 照夜 69102
17 乌鸦 飞禽卷 · 凤黯 69103
18 丹鹤 丹鹤王 飞禽卷 · 仙驭 69104
19 雷鹏 传说卷 · 雷鹏 69151
20 白龙 传说卷 · 白龙 69152
21 开明兽 传说卷 · 开明 69153
22 王龟 传说卷 · 王龟 69154
23 仙鹿 传说卷 · 仙鹿 69155
24 蛇 毒虫卷 · 苍蛇 69201
25 蝎子 毒虫卷 · 虿尾 69202
26 蜈蚣 毒虫卷 · 百足 69203
27 壁虎 毒虫卷 · 墨龙 69205

Each kind's move is spell 3000 + kind (山君篇 is 3010). One data oddity: of the two 仙鹿 rows, one carries the 王龟 move.

Where the books are

Every book is a shop item. The merchants the tables name, by book:

keeper where (x, z) books
飞狐客 1376, 847 黄耳 (狗), 晨凫 (鸭), 凤黯 (乌鸦), 仙驭 (丹鹤)
风云剑 1365, 850 豕豚 (猪), 烛夜 (鸡), 雷鹏, 白龙
神秘客 1400, 857 玉角 (鹿), 山君 (虎), 开明, 王龟
逐秋风 1400, 847 土龙 (鳄鱼), 胡犲 (狼), 仙鹿, 苍蛇 (蛇)
逍天雄 1408, 791 乌键 (牛), 狸奴 (猫), 辞鸿 (大雁), 照夜 (麻雀), 墨龙 (壁虎)
不留手 1519, 685 月德 (兔), 卷娄 (羊), 玄狐 (狐), 熊罴 (熊), 虿尾 (蝎子), 百足 (蜈蚣)
宗清宁 1029, 1476 月德 (兔), 乌键 (牛), 晨凫 (鸭)

Five of the seven stand within sixty metres of each other around (1400, 850); 不留手 is a short way east and 宗清宁 carries only three farm-animal books far to the south. The 万兽秘技 books that go on a pet through 关注 are a different item and are not on these shelves.

Every book also sits in one further shop group (3591) that no character's shopID names, so it is a shop the world creates rather than a keeper standing somewhere. With the game running, the People tab finds any of the keepers above, and /ways?item=<id> lists a book's sources with distances and says whether the shelf holds it today.

What the menu on a pet does

Almost every default interaction is hidden on a pet (the default rows carry condition2 = 0&86, hide on a 宠物), so the F menu on one is short:

row what it does
驯化 shown on any tameable animal, locked until you know its 篇; when it works, the animal joins your follow list (TeamManager.AddFollowPlayerNpc) and comes with you. There is no cap on that list in the code
关注 opens a picker of the 万兽秘技 books you are holding (item type 3, sub-class 23) and puts the chosen book's move into the pet's own spell slot (EquipSpell(…, slot 0, …)), consuming the book. One slot, so one 秘技 per pet, and a second replaces the first. The book is animal-specific: 万兽秘技·山君 says when the pet uses 猛虎出林 you gain 27 阳 — that move belongs to the tiger, so the book does nothing on anything else
喂食 opens a picker of food and applies the item's attribute change to the pet (ModAttriField on the pet's own sheet)
更名 renames it
驱逐 dismisses it
遗忘 a stub — the game answers 未开放

Whether a following pet fights beside you was not traced; its AI script is what decides that, and the script was not read.

Where this was read

NpcChongWuPrototype / table npc_chongwu (id, npcId, chongWuType, chongWuSubType, spellId); NpcEntity.IsChongWu; AnswerViewNew.CheckISCHONGWU / CheckIsXunHua / CheckIsHaveCurrentChongWuBuff; SpellAuraChongWuJiaoHu (aura slot 47) → PlayerEntity.SetCanJiaoHuChongWuType; the npc_interact default rows 66–70 and their conditions (0&86, 0&88, 0&87); InteractSlot.InteractWithNpc cases IT_XUNHUA, IT_GUANZHU, IT_WEISHI, IT_YIWANG, IT_GENGMING; CommonTipView.XsySelect for the 关注 and 喂食 pickers; TeamManager.AddFollowPlayerNpc / CheckAndRemoveChongWu; item strings 71001–71008 and the 万兽秘技 descriptions in db2.txt; the shop table for the sellers.