EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development: Custom Code (https://www.eqemulator.org/forums/forumdisplay.php?f=665)
-   -   utils/ppconvert (https://www.eqemulator.org/forums/showthread.php?t=29268)

Shin Noir 08-18-2009 06:43 AM

utils/ppconvert
 
I'm writing this horrid hack job to try to get the playerprofile tool to work with a new struct.

Any programmers out there wish to help me? My skills with this sort of stuff is terribly lacking.

Essentially, with ppconvert, I need to convert this struct:

Code:

struct VZTZ_Struct
{
/*0000*/        uint32                                checksum;                        // Checksum from CRC32::SetEQChecksum
/*0004*/        char                                name[64];                        // Name of player sizes not right
/*0068*/        char                                last_name[32];                // Last name of player sizes not right
/*0100*/        uint32                                gender;                                // Player Gender - 0 Male, 1 Female
/*0104*/        uint32                                race;                                // Player race
/*0108*/        uint32                                class_;                                // Player class
/*0112*/        uint32                                unknown0112;                //
/*0116*/        uint32                                level;                                // Level of player (might be one byte)
/*0120*/        BindStruct                        binds[5];          // Bind points (primary is first)
/*0220*/        uint32                                deity;                                // deity
/*0224*/        uint32                                guild_id;
/*0228*/        uint32                                birthday;                        // characters bday
/*0232*/        uint32                                lastlogin;                        // last login or zone time
/*0236*/        uint32                                timePlayedMin;                        // in minutes
/*0240*/        uint8                                pvp;
/*0241*/        uint8                                level2; //no idea why this is here, but thats how it is on live
/*0242*/        uint8                                anon;                // 2=roleplay, 1=anon, 0=not anon
/*0243*/        uint8                                gm;
/*0244*/        uint8                                guildrank;
/*0245*/        uint8                                unknown0245[7];        //
/*0252*/        uint32                                intoxication;
/*0256*/        uint32                                spellSlotRefresh[MAX_PP_MEMSPELL];        //in ms
/*0292*/        uint8                          unknown0392[4];
/*0296*/        uint8                                haircolor;                        // Player hair color
/*0297*/        uint8                                beardcolor;                        // Player beard color
/*0298*/        uint8                                eyecolor1;                        // Player left eye color
/*0299*/        uint8                                eyecolor2;                        // Player right eye color
/*0300*/        uint8                                hairstyle;                        // Player hair style
/*0301*/        uint8                                beard;                                // Beard type
/*0302*/        uint8                                ability_time_seconds; //The following four spots are unknown right now.....
/*0303*/        uint8                                ability_number; //ability used
/*0304*/        uint8                                ability_time_minutes;
/*0305*/        uint8                                ability_time_hours;//place holder
/*0306*/        uint8                                unknown0306[6];                // @bp Spacer/Flag?
/*0312*/        uint32                                item_material[MAX_MATERIALS];        // Item texture/material of worn/held items
/*0348*/        uint8                                unknown0256[44];
/*0396*/        Color_Struct                item_tint[MAX_MATERIALS];
/*0432*/        AA_Array                        aa_array[MAX_PP_AA_ARRAY];
/*2348*/        float                                unknown2348;                //seen ~128, ~47
/*2352*/        char                                servername[32];                // length probably not right
/*2384*/        char                                title[32];                        //length might be wrong
/*2416*/        char                                suffix[32];                        //length might be wrong
/*2448*/        uint32                                guildid2;                //
/*2452*/        uint32                                exp;                                // Current Experience
/*2456*/        uint32                                unknown1496;
/*2460*/        uint32                                points;                                // Unspent Practice points
/*2464*/        uint32                                mana;                                // current mana
/*2468*/        uint32                                cur_hp;                                // current hp
/*2472*/        uint32                                unknown1512;                // 0x05
/*2476*/        uint32                                STR;                                // Strength
/*2480*/        uint32                                STA;                                // Stamina
/*2484*/        uint32                                CHA;                                // Charisma
/*2488*/        uint32                                DEX;                                // Dexterity
/*2492*/        uint32                                INT;                                // Intelligence
/*2496*/        uint32                                AGI;                                // Agility
/*2500*/        uint32                                WIS;                                // Wisdom
/*2504*/        uint8                                face;                                // Player face
/*2505*/        uint8                                unknown1545[47];        // ?
/*2552*/        uint8                                languages[MAX_PP_LANGUAGE];
/*2580*/        uint8                                unknown1620[4];
/*2584*/        int32                                spell_book[MAX_PP_SPELLBOOK];
/*4184*/        uint8                                unknown3224[448];        // all 0xff
/*4632*/        int32                                mem_spells[MAX_PP_MEMSPELL];
/*4668*/        uint8                                unknown3704[32];        //
/*4700*/        float                                y;                                        // Player y position
/*4704*/        float                                x;                                        // Player x position
/*4708*/        float                                z;                                        // Player z position
/*4712*/        float                                heading;                        // Direction player is facing
/*4716*/        uint8                                unknown3756[4];                //
/*4720*/        sint32                                platinum;                        // Platinum Pieces on player
/*4724*/        sint32                                gold;                                // Gold Pieces on player
/*4728*/        sint32                                silver;                                // Silver Pieces on player
/*4732*/        sint32                                copper;                                // Copper Pieces on player
/*4736*/        sint32                                platinum_bank;                // Platinum Pieces in Bank
/*4740*/        sint32                                gold_bank;                        // Gold Pieces in Bank
/*4744*/        sint32                                silver_bank;                // Silver Pieces in Bank
/*4748*/        sint32                                copper_bank;                // Copper Pieces in Bank
/*4752*/        sint32                                platinum_cursor;        // Platinum on cursor
/*4756*/        sint32                                gold_cursor;                // Gold on cursor
/*4760*/        sint32                                silver_cursor;                // Silver on cursor
/*4764*/        sint32                                copper_cursor;                // Copper on cursor
/*4768*/        sint32                                platinum_shared;        // Platinum shared between characters
/*4772*/        uint8                                unknown3812[24];        // @bp unknown skills?
/*4796*/        uint32                                skills[MAX_PP_SKILL];
/*5096*/        uint8                                unknown5096[284];    // @bp unknown skills?
/*5380*/        int32                                pvp2;        //
/*5384*/        int32                                unknown4420;        //
/*5388*/        int32                                pvptype;        //
/*5392*/        int32                                unknown4428;        //
/*5396*/        uint32                                ability_down;                        // Doodman - Guessing
/*5400*/        uint8                                unknown4436[8];        //
/*5408*/        uint32                                autosplit;                        //not used right now
/*5412*/        uint8                                unknown4448[8];
/*5420*/        int32                                zone_change_count;      // Number of times user has zoned in their career (guessing)
/*5424*/        uint8                                unknown4460[28];        //
/*5452*/        int32                                expansions;                // expansion setting, bit field of expansions avaliable
/*5456*/        sint32                                toxicity;        //from drinking potions, seems to increase by 3 each time you drink
/*5460*/        char                                unknown4496[16];        //
/*5476*/        sint32                                hunger_level;
/*5480*/        sint32                                thirst_level;
/*5484*/        int32                                ability_up;
/*5488*/        char                                unknown4524[16];
/*5504*/        uint16                                zone_id;                        // Current zone of the player
/*5506*/        uint16                                zoneInstance;                        // Instance ID
/*5508*/        SpellBuff_Struct        buffs[BUFF_COUNT];                        // Buffs currently on the player
/*6008*/        char                                groupMembers[6][64];                //
/*6392*/        char                                unknown6392[668];
/*7060*/        sint32                                ldon_points_guk;                //client uses these as signed
/*7064*/        sint32                                ldon_points_mir;
/*7068*/        sint32                                ldon_points_mmc;
/*7072*/        sint32                                ldon_points_ruj;
/*7076*/        sint32                                ldon_points_tak;
/*7080*/        sint32                                ldon_points_available;
/*7084*/        uint8                                unknown5940[112];
/*7196*/        uint32                                tribute_time_remaining;        //in miliseconds
/*7200*/        uint32                                unknown6048;
/*7204*/        uint32                                career_tribute_points;
/*7208*/        uint32                                unknown6056;
/*7212*/        uint32                                tribute_points;
/*7216*/        uint32                                unknown6064;
/*7220*/        uint32                                tribute_active;                //1=active
/*7224*/        Tribute_Struct                tributes[MAX_PLAYER_TRIBUTES];
/*7264*/        Disciplines_Struct        disciplines;                        //fathernitwit: 10-06-04
/*7664*/        char                                unknown7464[240];
/*7904*/        uint32                                endurance;
/*7908*/        uint32                                group_leadership_exp;        //0-1000
/*7912*/        uint32                                raid_leadership_exp;        //0-2000
/*7916*/        uint32                                group_leadership_points;
/*7920*/        uint32                                raid_leadership_points;
/*7924*/        LeadershipAA_Struct        leader_abilities;
/*8052*/        uint8                                unknown8052[132];
/*8184*/        uint32                                air_remaining;
/*8188*/        uint8                                unknown8188[4608];
/*12796*/        uint32                                aapoints_spent;
/*12800*/        uint32                                expAA;
/*12804*/        uint32                                aapoints;        //avaliable, unspent
/*12808*/        uint8                                unknown12808[36];
/*12844*/        Bandolier_Struct        bandoliers[MAX_PLAYER_BANDOLIER];
/*14124*/        uint8                                unknown14124[5120];
/*19244*/        PotionBelt_Struct        potionbelt;        //there should be 3 more of these
/*19532*/        uint8                                unknown19532[8];
/*19540*/        uint32                                currentRadCrystals;        // Current count of radiant crystals
/*19544*/        uint32                                careerRadCrystals; // Total count of radiant crystals ever
/*19548*/        uint32                                currentEbonCrystals;                // Current count of ebon crystals
/*19552*/        uint32                                careerEbonCrystals;        // Total count of ebon crystals ever
/*19556*/        uint8                                groupAutoconsent;  // 0=off, 1=on
/*19557*/        uint8                                raidAutoconsent;    // 0=off, 1=on
/*19558*/        uint8                                guildAutoconsent;  // 0=off, 1=on
/*19559*/        uint8                                unknown19559[5];    // ***Placeholder (6/29/2005)
/*19564*/        uint32                                unknown15964;
/*19568*/
};

to latest SVN struct.


I wrote a terrible hack job (that actually seems to semi work) here:

Code:

        case (sizeof(VZTZ_Struct)+1305): { //Shin: Added a converter for our version.
                VZTZ_Struct* ops = (VZTZ_Struct*)src;
                PlayerProfile_Struct* pp = (PlayerProfile_Struct*)dst;
                memcpy(dst, ops, sizeof(VZTZ_Struct));

This is a case I threw in at around line 301 of the ppconvert source. The problem is that it leaves a ton of discrepancies from the two different structs, one being that buffs aren't properly removed, so e.g. if you had a debuff prior to this conversion, it comes up as a permanent "unknown" debuff that has negative #showbuff ticks remaining and never goes away, even after death.

I tried to do this:
memset(pp->buffs, 0, sizeof(VZTZ_Struct)); //Zero out buffs?

but I can't figure out the sizeof() portion, the other routines utilize a e.g. "memcpy(pp->unknown0245, &ops->fatigue, StructDist(ops, fatigue, guild_id2));"
which seems to call the struct again after modifying the value or something, it kind of confuses me how this thing works.

Not sure what else is broken. I wrote a semi change log of the differences here:

Code:

                //Changes needed: abilitySlotRefresh from uint32 to uint 8
                //Resize from uint8 unknown3224[448] to uint8 unknown3224[128]
                //Add empty uint32                                drakkin_heritage;        //
                //Add empty uint32                                drakkin_tattoo;                //
                //Add empty        uint32                                drakkin_details;        //
                //Resize from char unknown6392[668]; to char unknown6392[656];
                //add empty uint32                                entityid;
                //add empty uint32                                leadAAActive;
                //add empty uint32                                unknown7056;
                //recasttimers added uint32                                recastTimers[MAX_RECAST_TYPES]
                //unknown 7744 should be empty? char unknown7744[160]
                //add uint32                                timeentitledonaccount
                //add uint32                                RestTimer

I can give you the source, or would love any direction. Spent a ton of time on this and it's really showing how much I suck at C++. I hate this kind of bit-sensitive crap.

Also, ppconvert by default doesn't include a db.ini file and that's an old EtherealQuest route of handling data, so may want to have the format distributed for that util..


All times are GMT -4. The time now is 06:19 AM.

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