Page 1 of 8

Implementing Pets (0.7.2)

Posted: Thu Aug 02, 2012 12:57 pm
by John Adams
Originally from:
In the Discovery phase, looking forward to 0.7.2 (hopefully), I have started looking at what it will take to summon Pets on EQ2Emu based on this bug, and this request. I always feel I need to state, don't drop everything we're doing and start a new system ;) we're just looking into the data, identifying the packets so someday (soon) structs can be built.

Using XinuxData/1153/Data_1153_freerespect_addadorment_noncombatpet.log


So far, I found the RemoteCmd (is this the spell cast?)

Code: Select all

-- OP_RemoteCmdMsg --
2/1/2012 03:33:30
192.168.1.198 -> 69.174.200.26
0000:	00 09 13 7D 2A 69 01 09 00 36 31 37 33 35 31 39 ...}*i...6173519
0010	34 34                                           44
Note: the # in this packet is the spell's CRC - interesting.


the start of casting of the Summon Ancient Tome spell:

Code: Select all

-- OP_ClientCmdMsg::OP_EqSpellCastStartCmd --
2/1/2012 03:33:30
69.174.200.26 -> 192.168.1.198
0000:	00 3A 1D 00 00 00 FF 70 02 00 00 A0 40 14 00 53 .:.....p....@..S
0010:	75 6D 6D 6F 6E 20 41 6E 69 6D 61 74 65 64 20 54 ummon Animated T
0020	6F 6D 65                                        ome

the end of casting of the Summon Ancient Tome spell:

Code: Select all

-- OP_ClientCmdMsg::OP_EqSpellCastEndCmd --
2/1/2012 03:33:35
69.174.200.26 -> 192.168.1.198
0000:	00 3A 1A 00 00 00 FF 71 02 00 14 00 53 75 6D 6D .:.....q....Summ
0010:	6F 6E 20 41 6E 69 6D 61 74 65 64 20 54 6F 6D 65 on Animated Tome

Between the cast and CharSheet are a bunch of OP_EqHearSpellCastCmd:

Code: Select all

-- OP_ClientCmdMsg::OP_EqHearSpellCastCmd --
2/1/2012 03:33:35
69.174.200.26 -> 192.168.1.198
0000:	00 3A 1C 00 00 00 FF 44 02 9C CB 1F 00 01 00 9C .:.....D........
0010:	CB 1F 00 94 F7 01 00 00 00 00 00 00 00 00 00 0A ................
0020	00 01                                           ..


-- OP_ClientCmdMsg::OP_EqHearSpellCastCmd --
2/1/2012 03:33:35
69.174.200.26 -> 192.168.1.198
0000:	00 3A 1C 00 00 00 FF 44 02 9C CB 1F 00 01 00 9C .:.....D........
0010:	CB 1F 00 97 F7 01 00 00 00 00 00 00 00 00 00 0A ................
0020	00 01                                           ..


-- OP_ClientCmdMsg::OP_EqHearSpellCastCmd --
2/1/2012 03:33:35
69.174.200.26 -> 192.168.1.198
0000:	00 3A 1C 00 00 00 FF 44 02 9C CB 1F 00 01 00 9C .:.....D........
0010:	CB 1F 00 9A F7 01 00 00 00 00 00 00 00 00 00 0A ................
0020	00 01                                           ..


-- OP_ClientCmdMsg::OP_EqHearSpellCastCmd --
2/1/2012 03:33:35
69.174.200.26 -> 192.168.1.198
0000:	00 3A 1C 00 00 00 FF 44 02 9C CB 1F 00 01 00 9C .:.....D........
0010:	CB 1F 00 9D F7 01 00 00 00 00 00 00 00 00 00 0A ................
0020	00 01                                           ..


-- OP_ClientCmdMsg::OP_EqHearSpellCastCmd --
2/1/2012 03:33:35
69.174.200.26 -> 192.168.1.198
0000:	00 3A 1C 00 00 00 FF 44 02 9C CB 1F 00 01 00 9C .:.....D........
0010:	CB 1F 00 A4 F7 01 00 00 00 00 00 00 00 00 00 0A ................
0020	00 01                                           ..


-- OP_ClientCmdMsg::OP_EqHearSpellCastCmd --
2/1/2012 03:33:35
69.174.200.26 -> 192.168.1.198
0000:	00 3A 1C 00 00 00 FF 44 02 9C CB 1F 00 01 00 9C .:.....D........
0010:	CB 1F 00 A7 F7 01 00 00 00 00 00 00 00 00 00 0A ................
0020	00 01                                           ..


-- OP_ClientCmdMsg::OP_EqHearSpellCastCmd --
2/1/2012 03:33:35
69.174.200.26 -> 192.168.1.198
0000:	00 3A 1C 00 00 00 FF 44 02 9C CB 1F 00 01 00 9C .:.....D........
0010:	CB 1F 00 94 F7 01 00 00 00 00 00 00 00 00 00 0A ................
0020	00 02                                           ..


-- OP_ClientCmdMsg::OP_EqHearSpellCastCmd --
2/1/2012 03:33:35
69.174.200.26 -> 192.168.1.198
0000:	00 3A 1C 00 00 00 FF 44 02 9C CB 1F 00 01 00 9C .:.....D........
0010:	CB 1F 00 97 F7 01 00 00 00 00 00 00 00 00 00 0A ................
0020	00 02                                           ..


-- OP_ClientCmdMsg::OP_EqHearSpellCastCmd --
2/1/2012 03:33:35
69.174.200.26 -> 192.168.1.198
0000:	00 3A 1C 00 00 00 FF 44 02 9C CB 1F 00 01 00 9C .:.....D........
0010:	CB 1F 00 9A F7 01 00 00 00 00 00 00 00 00 00 0A ................
0020	00 02                                           ..


-- OP_ClientCmdMsg::OP_EqHearSpellCastCmd --
2/1/2012 03:33:35
69.174.200.26 -> 192.168.1.198
0000:	00 3A 1C 00 00 00 FF 44 02 9C CB 1F 00 01 00 9C .:.....D........
0010:	CB 1F 00 9D F7 01 00 00 00 00 00 00 00 00 00 0A ................
0020	00 02                                           ..


-- OP_ClientCmdMsg::OP_EqHearSpellCastCmd --
2/1/2012 03:33:35
69.174.200.26 -> 192.168.1.198
0000:	00 3A 1C 00 00 00 FF 44 02 9C CB 1F 00 01 00 9C .:.....D........
0010:	CB 1F 00 A4 F7 01 00 00 00 00 00 00 00 00 00 0A ................
0020	00 02                                           ..


-- OP_ClientCmdMsg::OP_EqHearSpellCastCmd --
2/1/2012 03:33:35
69.174.200.26 -> 192.168.1.198
0000:	00 3A 1C 00 00 00 FF 44 02 9C CB 1F 00 01 00 9C .:.....D........
0010:	CB 1F 00 A7 F7 01 00 00 00 00 00 00 00 00 00 0A ................
0020	00 02                                           ..


A update ghost and position packet:

Code: Select all

-- OP_ClientCmdMsg::OP_EqUpdateGhostCmd --
2/1/2012 03:33:35
69.174.200.26 -> 192.168.1.198
0000:	00 3A 1C 00 00 00 FF 40 02 E6 FB B0 38 12 2B 20 .:.....@....8.+ 
0010:	FF 3D FF 60 FF E0 34 66 81 81 7F 7F 7F 7F 7F 2F .=.`..4f......./
0020	00 00                                           ..


-- OP_UpdatePositionMsg --
2/1/2012 03:33:35
192.168.1.198 -> 69.174.200.26
0000:	00 09 13 A3 27 2B 38 FC B0 38 83 C2 81 22 00 00 ....'+8..8..."..
0010	00 00                                           ..

And the CharSheet update:

Code: Select all

-- OP_UpdateCharacterSheetMsg --
2/1/2012 03:33:35
69.174.200.26 -> 192.168.1.198
0000:	01 3F A1 00 00 00 7F 7F 7F 7F 7F 7F 7F 47 E3 C9 .?...........G..
0010:	C0 57 AC BF 9A 38 D9 59 99 02 B0 27 8D F0 56 64 .W...8.Y...'..Vd
0020:	01 B5 FE C2 86 11 83 0D 01 C0 01 E0 44 4A C3 4E ............DJ.N
0030:	FF E0 8B 01 64 9A 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F ....d...........
0040:	7F 7F 24 FF 20 6E 6F 6D 6D 75 53 FF 65 74 61 6D ..$. nommuS.etam
0050:	69 6E 41 BF 65 6D 6F 54 20 64 2C 9F 02 DB 33 F4 inA.emoT d,...3.
0060:	F7 86 FF 60 8E 05 58 C0 7F 7F 7F 7F 7F 7F 7F 7F ...`..X.........
0070:	7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F ................
0080:	64 8F 40 15 81 06 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F d.@.............
0090:	7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F 7F ................
00A0	7F 7F 7F 7F 7F 7F 6C                            ......l

The create packet - looks like a standard CreateGhostCmd:

Code: Select all

-- OP_ClientCmdMsg::OP_EqCreateGhostCmd --
2/1/2012 03:33:35
69.174.200.26 -> 192.168.1.198
0000:	01 3A B3 00 00 00 FF 3C 02 5D 9C CB 1F 00 D8 32 .:.....<.].....2
0010:	00 00 00 00 94 CC 46 B8 00 00 00 00 00 00 00 00 ......F.........
0020:	B1 FC B0 38 65 00 00 00 FF 1C 58 B3 33 20 63 A8 ...8e.....X.3 c.
0030:	FF 30 C4 41 89 72 A4 41 83 C2 81 9E 2C 5B 2C 5B .0.A.r.A....,[,[
0040:	93 04 40 80 19 81 01 82 11 12 C1 C0 20 F9 9C 30 ..@......... ..0
0050:	3F 80 3F 81 1F 88 03 88 17 0D 81 64 7F 7A BF 88 ?.?........d.z..
0060:	0A FF E0 63 CF C0 0A 81 0A F0 17 01 17 FF FF FF ...c............
0070:	FF FF FF FF 01 85 FF FF 7F 7F 72 81 0C 10 BF 0A ..........r.....
0080:	0A 0A 0A 0A 0A 86 2B B7 B4 01 03 FF 0E 08 00 47 ......+........G
0090:	65 6E 61 6E 74 69 6B 00 00 00 00 00 00 00 00 00 enantik.........
00A0:	00 14 00 41 79 65 65 63 61 69 74 68 27 73 20 66 ...Ayeecaith's f
00B0	61 6D 69 6C 69 61 72 00 06                      amiliar..

-- OP_ClientCmdMsg::OP_EqUpdateGhostCmd --
2/1/2012 03:33:35
69.174.200.26 -> 192.168.1.198
0000:	00 3A 50 00 00 00 FF 40 02 B1 FC B0 38 00 46 42 .:P....@....8.FB
0010:	00 F0 07 1D 5D E6 32 42 07 76 C5 0B 05 21 9E 01 ....].2B.v...!..
0020:	64 01 64 08 B7 07 B7 1E 18 9D E8 20 ED 20 DD 95 d.d........ . ..
0030:	39 46 A8 04 87 01 D5 FC 34 45 00 1B 83 04 02 DC 9F......4E......
0040:	05 0F A5 41 BB 07 76 F9 06 23 B7 89 A6 0C 99 1F ...A..v..#......
0050	8E 0F 11 23 36 00                               ...#6.


-- OP_SkillInfoResponse --
2/1/2012 03:33:35
69.174.200.26 -> 192.168.1.198
0000:	00 09 0A BA 00 FF FE 01 00 00 00 00 99 CB 1F 00 ................
0010:	14 53 75 6D 6D 6F 6E 20 41 6E 69 6D 61 74 65 64 .Summon Animated
0020	20 54 6F 6D 65                                   Tome

Not exactly sure, I do not think Xinux grouped in this log, but here's a group member added packet. Is this what Pet's do? Join a group with the caster?

Code: Select all

-- OP_GroupMemberAddedMsg --
2/1/2012 03:33:43
69.174.200.26 -> 192.168.1.198
0000:	03 58 47 35 C6 C9 01 40 30 14 40 C1 EF DB D7 48 .XG5...@0.@....H
0010:	EC A4 04 ED E8 5B 37 8E C1 E1 CD 69 C2 A9 FA DC .....[7....i....
0020:	5E 22 11 B9 C2 47 49 4C 12 92 92 8C E4 A4 20 25 ^"...GIL...... %
0030:	A9 48 4D 1A D2 92 8E 18 D2 13 4B 1C 19 C8 48 26 .HM.......K...H&
0040:	32 93 85 AC 64 23 3B 39 88 27 F2 7B 01 BE 65 7D 2...d#;9.'.{..e}
0050	85                                              .


Posting this so Zcoretri and/or Jabantiz can tell me if I am even close to heading in the right direction. I have never made a struct from scratch, and not even sure how to begin so I am asking for advice.

I will keep digging through this log and add any other packets I think might be involved in summoning a pet, then controlling it.

Re: BugID: 379 (John Adams) Conjurer spell Tellurian Recruit

Posted: Thu Aug 02, 2012 2:33 pm
by xinux
Remember tho that one is a noncombat pet so you won't have any of the commands to control it you just get the buff bonuses. I know my Beastlord creation lvl 1-3 in the 1142 folder has me running through the commands for my warder and using him while leveling and you can also check out under design pet_name_rename_rawr_10152011.

Re: BugID: 379 (John Adams) Conjurer spell Tellurian Recruit

Posted: Thu Aug 02, 2012 2:35 pm
by John Adams
Yeah on my drive home, I just realized you said noncombat. Mostly to start, I wanted to understand how a spell becomes a pet/spawn, so it might be a simpler place to start.

I will look at the Warder ones too and compare. Thanks for the reminder.

Re: Implementing Pets (0.7.2)

Posted: Thu Aug 02, 2012 5:33 pm
by Jabantiz
I think the only packet/struct we need for base pet functionality is the packet to show the pet window, and update the pet window. The way I see it working is in the lua script all we do is spawn the pet on cast and depop the pet on remove. We will probably need a new lua command to spawn a special type of spawn but that is getting into the code, the new lua function should also set the info in char sheet and send the pet window.

When you click on a button in the pet window it just sends a / command, you can open the pet window with alt + p and hit the buttons and see the commands hit the server. I am pretty sure the rename window is also just / commands so we probably won't even need packets for that. The main thing right now is getting the pet window to show, the rest will be code.

Re: Implementing Pets (0.7.2)

Posted: Thu Aug 02, 2012 5:44 pm
by John Adams
Yup. I added handlers for most known Pet / commands earlier this year. They don't do anything, of course, but they're there, waiting for you. patiently :)

Re: Implementing Pets (0.7.2)

Posted: Fri Aug 03, 2012 7:10 pm
by Jabantiz
Found this in an 1122 log (pet_name_rename_rawr_10152011.log) while waiting for EQ2TC to freeze on me.

Code: Select all

-- OP_ModifyGuildMsg --
10/15/2011 21:34:35
199.108.202.72 -> 192.168.1.198
0000:	01 FA 0C 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0010:	00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0020:	00 00 00 00 00 00 06 00 61 74 74 61 63 6B 00 00 ........attack..
0030:	00 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00 ................
0040:	E5 01 3D 01 01 00 00 00 7D 3A 6F D3 A5 FF B0 C0 ..=.....}:o.....
0050:	00 00 00 00 00 00 00 00 00 00 00 00 02 00 00 00 ................
0060:	01 00 00 00 A1 00 3B 01 01 00 00 00 94 9E 03 EC ......;.........
0070:	50 65 B4 13 00 00 00 00 00 00 00 00 00 00 00 00 Pe..............
0080:	0A 00 00 00 01 00 00 00 A7 00 3D 01 00 00 00 00 ..........=.....
0090:	0F FC AA 6E E4 A7 0B 07 00 00 00 00 00 00 00 00 ...n............
00A0:	00 00 00 00 09 00 00 00 01 00 00 00 40 03 3D 01 ............@.=.
00B0:	00 00 00 00 83 D0 2A 2F 4F C2 96 AE 00 00 00 00 ......*/O.......
00C0:	00 00 00 00 00 00 00 00 08 00 00 00 01 00 00 00 ................
00D0:	9D 01 FF FF 00 00 00 00 E7 DD 76 AB B8 D6 A1 73 ..........v....s
00E0:	00 00 00 00 00 00 00 00 00 00 00 00 0B 00 00 00 ................
00F0:	01 00 00 00 2F 01 3D 01 00 00 00 00 2C 06 B1 5D ..../.=.....,..]
0100:	7E AF D3 17 00 00 00 00 01 00 00 00 00 00 00 00 ~...............
0110:	00 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 ................
0120:	00 00 00 00 00 00 00 00 09 00 70 65 74 41 74 74 ..........petAtt
0130:	61 63 6B 00 00 01 00 00 00 00 00 00 00 01 00 00 ack.............
0140:	00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0150:	00 00 00 00 00 0A 00 70 65 74 42 61 63 6B 4F 66 .......petBackOf
0160:	66 00 00 01 00 00 00 00 00 00 00 02 00 00 00 04 f...............
0170:	00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0180:	00 00 00 0C 00 70 65 74 50 72 6F 74 65 63 74 4D .....petProtectM
0190:	65 00 00 01 00 00 00 00 00 00 00 03 00 00 00 04 e...............
01A0:	00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
01B0:	00 00 00 0E 00 70 65 74 50 72 6F 74 65 63 74 53 .....petProtectS
01C0:	65 6C 66 00 00 01 00 00 00 00 00 00 00 04 00 00 elf.............
01D0:	00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
01E0:	00 00 00 00 00 09 00 70 65 74 46 6F 6C 6C 6F 77 .......petFollow
01F0	00 00                                           ..
This might be related to the pet window (has 5 of the 6 commands from the pet window), haven't identified the opcode for 1096 yet though.

Re: Implementing Pets (0.7.2)

Posted: Fri Aug 03, 2012 8:18 pm
by Jabantiz
No clue what the packet I posted above is for, it looks like the pet window is controlled from the char sheet
Image
As you can see it is not perfect but it is a start in identifying elements for the pet window.

In world structs I changed the WS_CharacterSheet for 1096 from this

Code: Select all

<Data ElementName="pet_id" Type="int32" Size="1" />
<Data ElementName="pet_name" Type="char" Size="32" />
<Data ElementName="unknown21" Type="float" Size="5" />
<Data ElementName="rain" Type="float" Size="1" />
to this (just changed unknown 21)

Code: Select all

<Data ElementName="pet_id" Type="int32" Size="1" />
<Data ElementName="pet_name" Type="char" Size="32" />
<Data ElementName="unknown21" Type="int8" Size="20" />
<Data ElementName="rain" Type="float" Size="1" />
and then I hardcoded the following into PlayerInfo::serialize()

Code: Select all

packet->setDataByName("pet_name", "Bob");
packet->setDataByName("unknown21", 0x80, 11);
packet->setDataByName("unknown21", 0x3F, 12);
packet->setDataByName("unknown21", 0x80, 15);
packet->setDataByName("unknown21", 0x3F, 16);
packet->setDataByName("unknown21", 0xFF, 17);
packet->setDataByName("unknown21", 0x02, 18);
packet->setDataByName("unknown21", 0x03, 19);
The Hex values I pulled from the 1122 log, I haven't played around with them at all yet to try and identify what they do. I also don't know if setting these will make the window show on its own or if there is another byte or packet to force the window open.

Re: Implementing Pets (0.7.2)

Posted: Sat Aug 04, 2012 3:52 pm
by John Adams
There was a while when something was off, and we would log in and our Pet windows would be up for non-pet classes (Guardian, Paladin). Probably that charsheet thing, if you're saying that pops the window. Used to be annoying ;) Now I wish I knew how that worked!

Re: Implementing Pets (0.7.2)

Posted: Sun Aug 05, 2012 5:59 pm
by Jabantiz
Identified some of the values new struct looks like this.

Code: Select all

<Data ElementName="pet_id" Type="int32" Size="1" />
<Data ElementName="pet_name" Type="char" Size="32" />
<Data ElementName="unknown21" Type="int8" Size="9" />
<Data ElementName="pet_health_pct" Type="float" Size="1" />
<Data ElementName="pet_power_pct" Type="float" Size="1" />
<Data ElementName="unknown21b" Type="int8" Size="1" />
<Data ElementName="pet_movement" Type="int8" Size="1" />
<Data ElementName="pet_behavior" Type="int8" Size="1" />  
<Data ElementName="rain" Type="float" Size="1" />
Health and power are % based but from 0 to 1

pet_movement is a bitmask, it effect what buttons are selected on the pet window 0 = none 1 = stay 2 = follow, 3 = both

pet_behavior is also a bitmask for the buttons 0 = none 1 = protect me 2 = protect self 3 = both

The bar below power (hate I believe) isn't effected by any of the unknowns left, probably some where else in the char sheet.

Re: Implementing Pets (0.7.2)

Posted: Sun Aug 05, 2012 7:02 pm
by John Adams
Excellent work, as usual. Pets make everyone happy.

Re: Implementing Pets (0.7.2)

Posted: Wed Sep 26, 2012 8:35 pm
by Jabantiz
I have a combat pet being summoned by a spell script and the pet will follow the owner around, the pet window is updated as well. I believe that is all that was planned for pets in 0.7.2 :D

Lots of work to be done but it is a very basic start. Code for this will be on Dev SVN tonight.

Re: Implementing Pets (0.7.2)

Posted: Wed Sep 26, 2012 9:21 pm
by John Adams
LOL dude, that's awesome. I guess I can add more stuff to 0.7.2 since you're burning through them so fast :mrgreen:


btw, I cannot wait to see your "follow" code. I've been wanting to do follows for 4 years, guards in formation, wandering parties, etc. I'm excited!

Re: Implementing Pets (0.7.2)

Posted: Wed Sep 26, 2012 9:42 pm
by John Adams
Hahah... note to self; don't use a spawn ID that is KOS to you :)
whengoodpetsgobad.jpg

Re: Implementing Pets (0.7.2)

Posted: Wed Sep 26, 2012 9:45 pm
by Jabantiz
John Adams wrote: btw, I cannot wait to see your "follow" code. I've been wanting to do follows for 4 years, guards in formation, wandering parties, etc. I'm excited!
You probably won't be when you see the code, just used the combat movement to have the pet walk to where the player is. This is the best way I could think of doing it right now, I really believe combat and ai need to be seperated but don't want to tackle something that huge so I just worked with what we currently have.

Re: Implementing Pets (0.7.2)

Posted: Wed Sep 26, 2012 9:46 pm
by Jabantiz
John Adams wrote:Hahah... note to self; don't use a spawn ID that is KOS to you :)
whengoodpetsgobad.jpg
LOL, ok guess that might be a bug...