Pet Focus
Below are changes that can be used to make pet focii work about as close as possible to live without maintaining multiple versions of pets per focus, which is a maintenance headache.
First, in pets.cpp I add a parameter to makepet to allow new pets to be created at a specified pet power level (suspend minion, zoning, etc.) Then, I take out the current focus code, and call virtual GetPetFocusEffects, so it works for both clients and bots. Then, after the pet is created, I set the pet's focus power level so it can be recalled later if needed. I then create a method to call a single CalcPetFocusEffects() method that can be called from both clients and bots (to keep all the calcs in one place). The CalcPetFocusEffects() method contains all of the focus effect code. I update HP, AC, min and max damage, regen, size, and accuracy. HP, AC, min and max damage are as close to live as I could get. The actual values seen vary by class pet (mage pet increase was average- mostly hps, while necro increased AC significantly more, and beastlord warders increased melee damage the most. These equations keep the values within observed live values all the way up to pet power 90, which won't likely be seen here unless SoD is added. Lower level pet focus numbers (shovel of ponz, broom of trilon, etc. numbers couldn't be found, but the numbers end up in line with the rest. Code:
--- pets.cpp (revision 1126) The declarations in mob.h: Code:
--- mob.h (revision 1205) A few changes to account for added parameter to MakePet: Code:
--- perl_mob.cpp (revision 1205) Code:
--- command.cpp (revision 1213) Code:
--- client_packet.cpp (revision 1227) Code:
--- spell_effects.cpp (revision 1126) Next, is the code to save petFocusPower within the pet. Code:
--- npc.h (revision 1175) Code:
--- bot.h (revision 1132) Code:
--- bot.cpp (revision 1180) Code:
--- eq_packet_structs.h (revision 1208) Change to client.cpp to suspend and unsuspend pet, saving and restoring pet with same pet level. Code:
--- client.cpp (revision 1207) |
Note one: I don't update the database for the player profile to account for the changes to the suspend minion struct, so I assume unless someone can write one, there may be some weirdness if a player has a suspended pet while this patch is applied. I wasn't sure how to make that change to the player profile in the database, so I didn't want to mess something up.
Second Note: This does NOT work with zoning. A similar change would need to be made to extprofile to account for the petFocusPower to be saved along with the pet to be recalled after the zone, but that would be an easy code fix (just send the petFocusPower to the MakePet call) if the database change was made (again I didn't want to mess anythign up as I wasn't sure how to make the change, and this one would actually change the size of the blob in the database, instead of just shifting the structure around). Third Note: I also have the code finished to allow for pets and npcs to equip a full inventory, instead of just the visible items. I ran into the same issue as the Second Note with the extprofile needing to be modified, so I wanted to go ahead and submit these changes, and add the equipment later. Pets will be summoned with equipment, with the quality increasing based on caster level and petPowerLEvel. The equipment include a high quality cloak with mod2s on it. Note 4: Instead of just making the change to allow pet power to persist over zoning, I would go ahead and make the change to allow for the increased number inventory items to be saved with the pet. Note 5: I will try and submit my code with equipment as soon as I can, and I know KLS wants to work on the npc inventory issue after spells, but this could be an intermediary step, or something for private servers to mess around with. IF I submit it, it will still suffer from the issues of saving the extra pet power and extra equipment (haste mask, cloak, etc) through zoning. It will be able to persist through suspend, though, so one workaround would be to suspend the pet before zoning (this is tested as working). |
Nice, this will fix the 2nd most annoying thing about pets (needing to have your focus equipped everytime you zone). The 1st is, of course, the equipment thing!
Updating the extprofile really isn't that hard, it just requires tossing in a little buffer offset, and there isn't really much stored in there anyway. I'd been messing with it myself with the intent of doing what you've already done here. The one thing you might want to include with the equipment stuff is not having that auto-equip with full equipment on summon part, but I'll just put that option in anyway if you don't want to. Anyway, I'll try testing this code sometime today and reply if I find anything odd. |
With the equipment fixes, focused pets will come pre-equipped with gear based on focus power and level. I.E. level < 71 will come equipped with phantom armor, Muzzle of Mardu and the 65ish level mage summoned focus items (Jolum's Bauble, Tavee's Mantle, etc.). >78 level, they come with Prime Armor, Nastrel's heirlooms, and upgraded haste mask. The cloak will be based on focus power, although at the current levels, most will only have the lowest tier.
If you (or anyone) has code to make the database changes for adding to the extprofile (and not messing up what's already there), please let me know. I couldn't find anything searching, and if I can find that, I can finish the pet equipment. It was nice summoning a pet with full armor (minus weapons). |
Well, assuming you start with the current code and want to insert more in this area:
Code:
struct ExtendedProfile_Struct { Code:
update character_ set extprofile = concat(left(extprofile, length(extprofile) - (64 + 4 + 4)), repeat(char(0), ???), right(extprofile, 64 + 4 + 4)); From what I can see in the code, it'd be safer to add everything under the current data so that if someone's extprofile isn't updated, it won't try to use faulty data for things like AAs or their pet name. However, it'd be pretty odd and annoying to split up the pet equipment array like that. Another option would be to update the SetExtendedProfile function in extprofile.cpp to do basically this same thing except with memcpy/memmove and SecureZeroMemory. Maybe on a special case if the length is the same as the old one, reformat its data like that or however you need it, and then do the dump into the player's ExtendedProfile_Struct. Again, I'm assuming it's preferable to fill everything new with 0x00, which I think should be the case? |
Thanks for that. I did most of the work last night, with just a little debugging, then I'll be able to try this out. I've had to rework some things I had finished earlier, since some of the basic pet focus code had changed.
|
Grr. Almost finished with this. I was losing items on zone, but I think I have it figured out. I'm going to try and test it out tonight, if I can get on my computer. My wife may have it to do school stuff.
|
That's odd, I had extra items zoning fine by extending the pet equipment array and altering the loops that use it in a couple places to use the new size. Try doing a search for that array and make sure everything looping through it isn't using MAX_MATERIALS as an upper bound.
|
I didn't allocate space for the array, and was truncating it.. I missed one line copying code in from when I worked on it before, and that's what caused my problem. New code posted in other thread.
|
All times are GMT -4. The time now is 05:11 PM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.