EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Development (https://www.eqemulator.org/forums/forumdisplay.php?f=590)
-   -   Starting Work on SoF Opcodes/Structs (https://www.eqemulator.org/forums/showthread.php?t=26939)

AndMetal 02-15-2009 06:35 AM

Quote:

Originally Posted by KLS (Post 164538)
Code:

[Sun Feb 15 00:02:36 2009]00162:Received an item via EQI_STARTING_ITEM at loc 16777216

Not sure if it's been noticed, but 16777216 is 1000000 in hex, so it looks like we're getting 3 extra bytes in there. In the log, it doesn't look like slot 1 was sent, so that's probably it. I've also seen 436207616 (1A000000 so 1A -> 26) while messing around myself.

I've also seen some in-game errors from the server about issues with slots:
Code:

[Debug] Error: Server found no item in slot 13245 (->12274), Deleting Item!
[Debug] DeleteItemInInventory(12274, 0, true)
[Debug] Error: Server found no item in slot 14192 (->12274), Deleting Item!
[Debug] DeleteItemInInventory(12274, 0, true)
[Debug] Error: Server found no item in slot 15118 (->12274), Deleting Item!
[Debug] DeleteItemInInventory(12274, 0, true)
[Debug] Error: Server found no item in slot 16054 (->12274), Deleting Item!
[Debug] DeleteItemInInventory(12274, 0, true)
[Debug] Error: Server found no item in slot 16990 (->12274), Deleting Item!
[Debug] DeleteItemInInventory(12274, 0, true)
[Debug] Error: Server found no item in slot 17900 (->12274), Deleting Item!
[Debug] DeleteItemInInventory(12274, 0, true)
[Debug] Error: Server found no item in slot 9796 (->8841), Deleting Item!
[Debug] DeleteItemInInventory(8841, 0, true)
[Debug] Error: Server found no item in slot 8476 (->7542), Deleting Item!
[Debug] DeleteItemInInventory(7542, 0, true)
[Debug] Error: Server found no item in slot 9400 (->7542), Deleting Item!
[Debug] DeleteItemInInventory(7542, 0, true)

I'm not sure if it's directly related, but I think Attack might be also suffering a similar issue.

trevius 02-15-2009 09:56 AM

Yeah, after looking and the error I posted earlier from the EQ debug, I just noticed that slot 1792 would be 700 in hex, so it was probably off a byte since it had just loaded slot 6 and slot 7 would have been next. So, it sounds like we are just adding an extra byte somewhere that isn't needed.

I made some corrections to the item structure and am going to commit them to the SVN in a minute. It still isn't perfect, but seems to be loading at least the starter items I have tried very well now. Using the 13th floor info that AndMetal posted has helped alot I think, though it doesn't seem to be 100% accurate for SoF. At least it is a better guide.

One important one is that it seems like the filename field is just like any other string field. It should load a null byte if there is nothing in that field. The booktype field being set to int16 should have actually been int8, and the other byte there would be the filename field. The FF FF FF FF or 00 00 00 00 after that is actually an sint32 for loregroup. So, I think that makes a bit more sense now.

I am sure we can definitely get most of this structure sorted out without too many issues. Especially once we figure out where it is getting that extra byte from. I am thinking maybe one of the strings isn't supposed to have a null terminator after it or something. From what I can tell, I don't see any major difference between the items it was able to load and the item that threw off the struct by 1 byte. Maybe there is supposed to be an extra byte every few items or something...

KLS 02-15-2009 04:17 PM

I'm thinking maybe I'm not supposed to send bag content on initial serialization. When you open a bag this client sends a small packet to the server that includes the item slot opened...

KLS 02-15-2009 05:08 PM

Bah my packets were too long!

I had two nifty packets to show the diff between an item loading correct slot and an item not loading in correct slot but the forums ate them D=

Long and short of it: the headers are almost exactly the same they just differ by what I've labeled as potion type.. I've gotta look more into it tho.

KLS 02-16-2009 01:12 AM

I devised a workaround for the crashing and failure to load of items... well for the crashing at least :rolleyes:

I'd still like to figure out why it sometimes doesn't work when put into an EQI packet, but this should let us move onto more important things for now.

KLS 02-16-2009 04:10 AM

Work around for items seems to work fine, tho they still need a lot of work. I checked out AAs quickly but I'm kinda at a loss. Using the log I got from derision the data doesn't seem to of changed at all other than how they do string ids. I updated that to match and still nothing.

I notice that the window tabs don't even appear, which isn't entirely unusual. One thing I notice is the AA table is sent directly after the client requests the zone, right before the player profile. And for titanium and below we send it... considerably later, maybe the client is getting picky with how it's sent, or maybe there's some other packet that needs to be sent to get AAs to work.

trevius 02-16-2009 05:11 AM

Yeah, I think the tabs only display as needed. I have messed with it quite a bit and haven't had any luck at all yet. Though, I haven't tried changing when they get sent yet, which is a good point. I noticed that they are one of the first things that get sent now. The only other thing I noticed, but kinda doubt would be a problem is that they all come in as combined packets on live. I don't know how we are sending them exactly, so I am not really sure.

One other thing I was thinking is that there is a good chance that the player profile isn't setup to load the proper AA info yet, but I think that only affects what AAs it shows you as having purchased.

For now, I am working some more on lining up the item struct and maybe getting merchants and combat working.

trevius 02-16-2009 09:26 PM

Derision already mentioned it in this thread, but before the info gets lost, I figured I would note it a bit more clearly here. To enable the use of SoF content (Drakken race and new zones), you must update the Expansions field in the Variables table to have a value of 16383. This number tells the client which expansions to use and you can set it to allow or disallow any expansion you wish. Here is how that number breaks down:

Code:

0 - Classic
1 - Ruins of Kunark
2 - Scars of Velious
4 - Shadows of Luclin
8 - Planes of Power
16 - Legacy of Ykesha
32 - Lost Dungeons of Norrath
64 - Gates of Discord
128 - Omens of War
256 - Dragons of Norrath
512 - Depths of Darkhallow
1024 - Prophecy of Ro
2048 - Serpent's Spine
4096 - The Burried Sea
8192 - Secrets of Faydwer

All Expansions combined = 16383

You just add up the numbers from the expansions you want to enable to set the Expansions value to that total. I verified this as well on my EQLive account, which is only enabled up to SoF, and it sends me the same number. It would probably be a good idea to note this in the changelog or maybe put an Optional SQL update file in the /utils/sql/svn/ folder so people don't forget to do it when they update.

Also, I forgot to mention it in the changelog, but I cleaned up the patch_SoF.conf file quite a bit last night. I still plan to reorganize it further by sorting the opcodes into related sections so they aren't just all over the place.

After thinking about AAs more, I am starting to think that there is a very good chance that the expansion field in the Player Profile is in the wrong place and/or not sending the proper expansion information needed for SoF. I will try forcing that field to use 16383 in the encode for all SoF clients. Then, I will see if I can work on it to align the expansion field into the correct place in that struct if it isn't already. I wouldn't be surprised at all if that was the reason the AAs aren't showing up yet. Though, if that is the case, I am surprised that the Power Source slot works and the AAs don't.

I was also thinking that the issue with AAs may be something new for AAs (as KLS mentioned). It could be very possible that there might be a new packet for the new sorting/filtering feature in the AA window. I would think that the client should be doing this sorting and filtering, but I figure it is better to consider all possibilities at this point to hopefully come up with a good solution soon.

trevius 02-17-2009 07:27 PM

I made some changes to the source so it can recognize the new Drakkin race. I haven't looked around much at what else might need to be changed yet though. So far, $race in perl scripts seems to report properly for Drakkin now instead of reporting unknown.

It looks like the reason that weapons and other items aren't working properly for Drakkin is because the source isn't set to handle the Drakkin race properly yet. I added this last night:

Code:

#define human_1                        1
#define barbarian_1                2
#define erudite_1                4
#define woodelf_1                8
#define highelf_1                16
#define darkelf_1                32
#define halfelf_1                64
#define dwarf_1                        128
#define troll_1                        256
#define ogre_1                        512
#define halfling_1                1024
#define gnome_1                        2048
#define iksar_1                        4096
#define vahshir_1                8192
#define rall_1                        16384 //guessing this is froglok?
#define drakkin_1                32768

From looking at item stats on 13th floor and adding up the races on items, it seems like 32768 should be the correct number for the Drakkin race. ALL/ALL items should be set to 65535 and it seems like most already are. I did notice that it looks like GeorgeS item editor may have been using a value of 131071 for ALL/ALL items at some point. I think that should still work properly, but that may be the source of some issues. If so, I think it would probably be safe to convert all race fields in the items table from 131071 to 65535. I think the main thing is that something else needs to be changed in the source so that the server knows that Drakkins are a player race and that items with 32768 in them should be usable by Drakkins.

For the issues with Item Slot Numbers being re-arranged in SoF, the slots are defined here:

/common/eq_constants.h
Code:

        ////////////////////////
        // Equip slots
        ////////////////////////
       
        SLOT_CHARM                = 0,
        SLOT_EAR01                = 1,
        SLOT_HEAD                = 2,
        SLOT_FACE                = 3,
        SLOT_EAR02                = 4,
        SLOT_NECK                = 5,
        SLOT_SHOULDER        = 6,
        SLOT_ARMS                = 7,
        SLOT_BACK                = 8,
        SLOT_BRACER01        = 9,
        SLOT_BRACER02        = 10,
        SLOT_RANGE                = 11,
        SLOT_HANDS                = 12,
        SLOT_PRIMARY        = 13,
        SLOT_SECONDARY        = 14,
        SLOT_RING01                = 15,
        SLOT_RING02                = 16,
        SLOT_CHEST                = 17,
        SLOT_LEGS                = 18,
        SLOT_FEET                = 19,
        SLOT_WAIST                = 20,
        SLOT_AMMO                = 21,
       
        ////////////////////////
        // All other slots
        ////////////////////////
        SLOT_PERSONAL_BEGIN = 22,
        SLOT_PERSONAL_END = 29,
       
        SLOT_CURSOR                = 30,
       
        SLOT_CURSOR_END        = (sint16)0xFFFE,        // Last item on cursor queue
        // Cursor bag slots are 331->340 (10 slots)
       
        // Personal Inventory Slots
        // Slots 1 through 8 are slots 22->29
        // Inventory bag slots are 251->330 (10 slots per bag)

Is there some way we can do an IF check that would use different lists depending on the expansion that the client is using? If so, then all we should have to do is do another IF check on usable slots for ammo items and convert 21 to 22.

trevius 02-17-2009 10:37 PM

I just figured out why combat with weapons wasn't working for Drakkin. The bool for IsEquipable was being set to false every time because it had not been adjusted to use the new total of 16 races. I corrected it on my test server and now combat seems to work perfectly. The actual damage during combat isn't being reported yet, but that it is still working. We still need the OP_Damage opcode and structure corrected before the damage will display. At least with this change, it makes basic gameplay functional. I will commit the change tonight when I get home.

I also found that Drakkin weren't set to start with any language skills, so I added Common Tongue and the 2 Dragon languages to them since I figure they would probably be able to speak the Dragon ones due to their nature. I will also commit that tonight.

Drakkin also have a unique racial starting skill that is really a special AA that only they get. Depending on the Heritage they chose, they get a slightly different affect from it, but I think the AA is called Dragon Breath. For that to work properly, we would have to write new code to handle heritage and also implement the AAs. Heritage also defines some slight differences in starting resists from what I have read. None of this needs to be done any time soon, but I figured I would note it for later use.

I don't think the item database needs to be updated much, but I will probably update a small SQL change to change any item set to 32767 (Titanium ALL races) to 65535 (SoF ALL races). I know I have seen at least one item that was supposed to be ALL/ALL that wasn't because it didn't have Drakkin on it. It may have been set that way by GeorgeS tool at some point, but I am not sure. We will need to verify his tool is setting ALL races to 65535 now.

trevius 02-18-2009 04:07 AM

LOL, I got combat damage working finally. ShowEQ was throwing me off, because they call OP_Damage OP_Action2. I finally saw it in some combat logs and tried it and it worked. All I had to do was add 5 more bytes to the end of the combat damage struct and it seems to work fine now.

That leaves AAs as what I consider to be the last major issue. They still aren't displaying properly yet. For now, I am going to try to get doors working properly and maybe adjust the objects structure, because it seems like heading is in the wrong place, since all objects face the same directions.

KLS 02-18-2009 06:34 AM

I tried changing the order of when AAs are sent, did nothing. Either there's another packet, the opcodes are wrong or there's something that needs to be set in the player profile. I lean toward 1 or 3, hopefully 1 but I bet it's 3 =(

trevius 02-18-2009 07:22 AM

Yeah, I am pretty sure that the opcode to send AAs is correct. It could be option 1, but you are probably right that it is something in the player profile. I am going to work back through the PP anyway soon to try to align some of the areas that are harder to confirm. I am going to be using a Live packet as a reference, so it might not be too easy. The only good thing is that the difference from EQLive and SoF is only about 96 bytes in size (live is actually less now, which is rare for structures to shrink). I will just base the changes off of relative fields that we know are correct. Hopefully I can get it more accurately aligned and that may resolve a few issues. It is a big struct, so it may take a while to complete though lol.

trevius 02-18-2009 08:31 AM

Unfortunately, I just had to back out of the fix I put in for Drakkin to be able to use equipment and weapons and gain stats from them. It was working great for SoF, but the fix caused the same problem to start happening in Titanium. So, right now, it seems like only 1 or the other can work. I am sure there is a way to let both work properly, but I just don't know of a good solution right now. If anyone has a suggestion, it would help :)

Here is the piece of code that needs to be changed to work with both client versions:

/common/item.cpp
Code:

bool ItemInst::IsEquipable(int16 race, int16 class_) const
{
        if (!m_item)
                return false;
       
        bool israce = false;
        bool isclass = false;
       
        if (m_item->Slots == 0) {
                return false;
        }
       
        uint32 classes_ = m_item->Classes;
        uint32 races_ = m_item->Races;
        int32 race_ = 0;
        #ifndef PACKETCOLLECTOR
        race_ = GetArrayRace(race);
        #endif

        race_ = (race_==17? 15 : race_); // For SoF this should be: race_ = (race_==18? 16 : race_);
        // @merth: can this be optimized?  i.e., will (race & common->Races) suffice?
        for (int cur_class = 1; cur_class<=PLAYER_CLASS_COUNT; cur_class++) {
                if (classes_ % 2 == 1) {
                    if (cur_class == class_) {
                            isclass = true;
                                break;
                        }
                }
                classes_ >>= 1;
        }
        for (unsigned int cur_race = 1; cur_race <= PLAYER_RACE_COUNT; cur_race++) {
               
                if (races_ % 2 == 1) {
                    if (cur_race == race_) {
                            israce = true;
                                break;
                          }
                }
                races_ >>= 1;
        }
        return (israce && isclass);
}


cubber 02-18-2009 11:04 AM

I take it we need to copy the 2 spells_ text files from the SoF client and replace the old titanium ones with them in order to use the new spells from the new expansions?

Will the new files be compatable with old clients? If so is there any harm in making the switch now, or should I wait?


All times are GMT -4. The time now is 05:31 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.