EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Archive::Bugs (https://www.eqemulator.org/forums/forumdisplay.php?f=622)
-   -   Strange Container Issues (https://www.eqemulator.org/forums/showthread.php?t=15492)

fathernitwit 08-23-2004 01:44 AM

Strange Container Issues
 
Hello,

I figured I would report this as a bug to see if anybody else can figure out what is up with it. It happens to me on the 7-31-04 CVS dump.

The issue I am seeing is that in certain places, the data in the Container struct of an item is not correct. It is all shifted downwards by four bytes.

The two places I have seen this is:
Object::HandleCombine()
where it uses item->Container.PackType, but that was giving me invalid things, and I finally figured out that the correct number for the packtype was stored in item->Container.Slots.

Inventory::FindFreeSlot()
it tries to use inst->GetItem()->Container.Slots but the real number of slots is stored in inst->GetItem()->Container.SizeCapacity. I found this one because when I purchased from vendors, they would only place 5 items into my bags, which had 8 slots, finally I figured out that 5 was the packtype (shifted into the Slots place).


Now, I have tried to figure this one out, and have been unsuccessful. If I change the order of the struct, it breaks a bunch of other things, so it seems to be correct in some places, and incorrect in others... I think it is very strange. Maybe somebody with more knowledge of the item system will be able to figure out what is going on.

Darkwaters 08-23-2004 04:11 AM

just an idea and i'll give a shot at it in a few minutes waking up from my 4 hour nap hehe =). compare the items_ vs items where items_.id=items.id and run a query to verify inconsistency. could have been someone changed something in their packetcollected logs or changed source or just a flukey bug that introduced it if the data in those two tables is different. first cup of coffee and going to monkey with it a bit if this is for specific fields only that would help tremendously in cutting down my query structures.
Darkwaters

fathernitwit 08-23-2004 05:06 AM

it is specifically the 4 fields in the Container struct in an ItemInst.
I am not 100% sure what item DB I am using, so if it might be DB related, I will try to update my items.

From what I can tell, the 4 fields are correct some time, and not others... because the items stop working in other places if I jack with the ordering, and make it right.

One thought I just had was maybe the serialization of containers is wrong, and it just matches the wrong ordering stored in the DB too.. i'll have to check later.

Darkwaters 08-23-2004 05:21 AM

looking at the items.h and database.h & .cpp atm. I'm really curious why there was the confusion in the code comments by confusion I mean "?" question marks in the commenting specifically this section of database.cpp ln: 6978
Code:

                        else if (olditem->type == (int)ItemTypeContainer)
                        {
                                cout << "Container: " << olditem->name << endl;
                                //newitem.Container.Combine = olditem->container.?
                                //newitem.Container.Contents = olditem->container.?
                                //newitem.Container.Open = olditem->container.?
                                //newitem.Container.PackType = olditem->container.?
                                newitem.Container.SizeCapacity = olditem->container.sizeCapacity;
                                newitem.Container.Slots = olditem->container.numSlots;
                                newitem.Container.WeightReduction = olditem->container.weightReduction;
                                //newitem.Container.PackType = olditem->container.packType;
                                newitem.Container.PackType = 1;
                        }
                       
                        char idfile[20] = {0};
                        DoEscapeString(idfile, newitem.IDFile, strlen(newitem.IDFile)+1);
                        char lore[200] = {0};
                        DoEscapeString(lore, newitem.LoreName, strlen(newitem.LoreName)+1);
                        char name[200] = {0};
                        DoEscapeString(name, newitem.Name, strlen(newitem.Name)+1);
                        char bookfile[600] = {0};
                        DoEscapeString(bookfile, newitem.Book.File, strlen(newitem.Book.File)+1);
                       
                        char* query2 = new char[20000];
                        memset(query2, 0, 20000);
                        int len = MakeAnyLenString(&query2,
                                "insert into items (\n "
                                        "id,weight,norent,nodrop,size,itemclass,idfile,lore,slots,cost,name,icon,\n "                                // common 0->11
                                        "filename,\n "                                                                                                                                                                // books 12->13
                                        "bagtype,bagslots,bagsize,bagwr,\n "                                                                                                                // bags 14->17
                                        "astr,asta,aagi,adex,awis,aint,acha,pr,mr,dr,fr,cr,skillmodvalue,skillmodtype,\n "                        // common 18->31
                                        "banedmgamt,banedmgrace,magic,hasteproclvl,light,delay,effecttype,range,damage,material,\n "// common 31->41
                                        "maxcharges,reclevel,factionmod1,factionmod2,factionmod3,\n "                                                                // common 42->49
                                        "factionmod4,factionamt1,factionamt2,factionamt3,factionamt4,reqlevel,hp,mana,ac,color,\n "        // common 50->59
                                        "classes,races,spellid,casttime,focusid,itemtype\n"                                                                                // common 60->66
                                ") values (\n "
                                        "%i, %i, %i, %i, %i, %i, '%s', '%s', %i, %i, '%s', %i,\n "
                                        "'%s',\n "
                                        "%i, %i, %i, %i,\n "
                                        "%i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i,\n "
                                        "%i, %i, %i, %i, %i, %i, %i, %i, %i, %i,\n "
                                        "%i, %i, 0, 0, 0,\n "
                                        "0, 0, 0, 0, 0, %i, %i, %i, %i, %i,\n "
                                        "%i, %i, %i, %i, %i, %i\n"
                                ")",
                                newitem.ItemNumber, newitem.Weight, newitem.NoRent, newitem.NoDrop, newitem.Size, newitem.ItemClass, idfile, lore, newitem.EquipSlots, newitem.Cost, name, newitem.IconNumber,
                                bookfile,
                                newitem.Container.PackType, newitem.Container.Slots, newitem.Container.SizeCapacity, newitem.Container.WeightReduction,
                                newitem.Common.STR, newitem.Common.STA, newitem.Common.AGI, newitem.Common.DEX, newitem.Common.WIS, newitem.Common.INT,
                                        newitem.Common.CHA, newitem.Common.SvPoison, newitem.Common.SvMagic, newitem.Common.SvDisease, newitem.Common.SvFire, newitem.Common.SvCold,
                                        newitem.Common.SkillModValue, newitem.Common.SkillModType,
                                newitem.Common.BaneDmg, newitem.Common.BaneDmgRace, newitem.Common.Magic, newitem.hastepercent, newitem.Common.Light,
                                        newitem.Common.Delay, newitem.Common.EffectType, newitem.Common.Range, newitem.Common.Damage, newitem.Common.Material,
                                newitem.Common.MaxCharges, newitem.Common.RecommendedLevel,
                                newitem.Common.RequiredLevel, newitem.Common.HP, newitem.Common.Mana, newitem.Common.AC, newitem.Common.Color,
                                newitem.Common.Classes, newitem.Common.Races, newitem.Common.SpellId, newitem.Common.CastTime, newitem.Common.FocusId, newitem.Common.Skill
                                );

Still digging =)
Darkwaters

EDIT (ADD): PS I'm not an avid C++ coder but I can follow it for the most part. Not a big question just curious. =)

Darkwaters 08-23-2004 06:02 AM

I see the items.name='backpack' shows the following data
bagsize=3
bagslots=8
bagtype=5
bagwr=0

Edit/Add
It only right-clicky into inventory's backpack 5 items which is the bagtype's value.
Edit/Done_Add

"Now this is the Lore Backpack" probably a newb item for starting but when you #summonitem 17005 you right click items into your inventory and eventually it ends up stuck on your mouse cursor where I have to manually drop the item into the large auto-inventory window which does not have the issue.
Is there a difference between right-clicking items into your inventory vs dropping into the auto-inventory code. Like I said I can follow the code well I just wont pretend to know where to look here for comparison's.
Hope this points in a bit of the right direction cuz this is a booger of an issue thats only annoying some of the time.
Darkwaters

fathernitwit 08-23-2004 06:16 AM

yea,
I really think the items are in the DB correctly, and that they are getting used correctly in most places... it is just under certain circumstances that they get shifted down a slot... but im not sure at this point

I have noticed that using auto inventory like the big blank in the equipment area does not use the same code that buying items from a vendor does... It might even be taken care of by the client. That is the only time I can get it to occurr, is when I buy lots from a vendor.

ultimately it isnt a huge deal... just something that is bothering me.

Darkwaters 08-23-2004 06:20 AM

Yep I know what ya mean. Not only vendor's but creating a newb with only the backpack atm and trying to collect crap without running non-legit means I'm foobar'd. I have to left click and drop in main window items from looting after a point.

On the otherhand, if faction really starts kicking in and mobs aggro from LOS this will become an issue. It'd be no fun looting a few good items: left click, drop in auto-inventory (big blank in center inventory), go to next item, all while a new mob is kicking on your tail.

Darkwaters

Darkwaters 08-23-2004 07:06 AM

This is a crazy bug LOL.
Tried commenting out this section of code in Item.cpp in the common source folder:
Code:

        // Doodman:  Do ten even tho we will only have 5 augments.  We need to fill 10 fields
        //  6-10 should always be empty (well, 5-9, actually)
//        for(uint8 i=0; i<10; i++) {
//                serialized+="|";
//               
//                iter_augment it = m_augments.find(i);
//                if (it != m_augments.end()) {
//                        const ItemCommonInst* common = it->second;
//                        if (common) {
//                                subitem=common->Serialize(slot_id);
//                                Protect(subitem,'"');
//                                serialized+='"';
//                                serialized+=subitem;
//                                serialized+='"';
//                        }
//                }
//        }

Compiled (EMuShareMem.dll, World.exe and Zone.exe again Win32 release version) ran client. Unstacked a few items to fill 4 slots of backpack item# 17005 and inventory slots full. Ran around freportw killing stupid mobs. Looted two more items and second still stuck on the "arrow cursor". It was a shot, I was hoping that the way it read could have accidently added a fluke, but obviously still there.
Gonna go investigate some more.
Darkwaters


All times are GMT -4. The time now is 08:32 PM.

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