EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Support::Windows Servers (https://www.eqemulator.org/forums/forumdisplay.php?f=587)
-   -   Bank Items? (https://www.eqemulator.org/forums/showthread.php?t=31736)

blindaviator 07-26-2010 05:25 PM

Bank Items?
 
I have searched around but haven't seen anything specific to this question...

How are regular bank items and coin stored (not shared items)??
Are they stored in the database or is it somehow hard coded??

I have looked everywhere in the database but haven't seen anything that would point me in the right direction...

Anyone can help with an answer??

I have found where shared items and coin are stored but nothing on regular bank items and coin...

GeorgeS 07-26-2010 06:04 PM

Coins are in the profile struct BLOB in the database under table character_
I think the inventory of bank items should be in the inventory table

GeorgeS

blindaviator 07-26-2010 11:31 PM

Quote:

Originally Posted by GeorgeS (Post 190139)
Coins are in the profile struct BLOB in the database under table character_
I think the inventory of bank items should be in the inventory table

GeorgeS

Well I had already checked the inventory table but it only contains character inventory items... It doesn't hold the coin amounts for inventory or regular bank slots...

Also what is the structure for the coin held in the BLOB of character_ table??
I can see it is in HEX format but what is the structure that tells the system what item is where?

I appreciate the help...

GeorgeS 07-27-2010 12:24 AM

Here's the relevant profile struct

Quote:

'/*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
use little endian byte order to decode

GeorgeS

GeorgeS 07-27-2010 12:33 AM

Here's the inventory table data

Quote:

Equipped slots
(somebody should make this prettier some day)

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,


Inventory Slots
NOTE: Numbering for personal inventory goes top to bottom, then left to right
It's the opposite for inside bags: left to right, then top to bottom
Example:
inventory: containers:
1 6 1 2
2 7 3 4
3 8 5 6
4 9 7 8
5 10 9 10



Personal Inventory
Personal inventory slots 22 through 29.
Bags in personal inventory are:
22: 251->260
23: 261->270
24: 271->280
25: 281->290
26: 291->300
27: 301->310
28: 311->320
29: 321->330


Cursor
Cursor is slot 30, and the bag slots for the cursor are 331->340.


Tribute
Tribute items are slots 400->404, these items are not visible, but are counted for stats/effects.


Bank
Bank slots are 2000->2015
Bags in the bank are:
2000: 2031->2040
2001: 2041->2050
2002: 2051->2060
2003: 2061->2070
2004: 2071->2080
2005: 2081->2090
2006: 2091->2100
2007: 2101->2110
2008: 2111->2120
2009: 2121->2130
2010: 2131->2140
2011: 2141->2150
2012: 2151->2160
2013: 2161->2170
2014: 2171->2180
2015: 2181->2190


Shared Bank
Shared bank slots are 2500 and 2501
Bags in the shared bank are:
2500: 2531->2540
2501: 2541->2550

blindaviator 07-27-2010 12:43 AM

Much appreciated GeorgeS.... With that info and some investigations on my own I am slowly getting it...

blindaviator 07-27-2010 09:39 PM

Ok I have figured it out mostly...I appreciate the help so far but I have another question...

Sorry for all the questions but when I hit a road block that I just cannot figure out on my own I must ask someone...

I got the idea to look at the code for the PEQ PHP editor and found out a lot of what I needed...

This block of code in the "player.php" file is obviously what I have been needing but apparently it is somehow lacking....
Code:

$player_array['platinum'] = ord(substr($profile,4720,4));
The problem is it only returns 2 HEX characters... So if your platinum hits 256 it returns 0... I have looked everywhere and tried everything that makes sense trying to get it to return more than just the 2 characters to no avail... I am semi-new to PHP and cannot figure this one out... It is the first time I have had to deal with BLOB's and pulling HEX from a database...

Any suggestions on what would be a better solution??

GeorgeS 07-27-2010 09:47 PM

That does not sound correct. You need to remember these are short integers as in 4 bytes per record (1 word = 4 bytes)
Little endian - as in reverse byte order, so the order is -

(example of a conversion 4 HEX bytes => 4 byte integer)

0A 0B 0C 0D
0D*16777216 + 0C*65536 + 0B*256 + 0A*1

So convert the 8 bit -Hex into 8 bit decimal - so that $FF = 255 etc..
and use the formula above.

here's my code for the above
Code:

Function getbytes_convert32bit(location As Integer, bytes As Integer)
Dim result32 As Long
Dim byte1 As Byte
Dim byte2 As Byte
Dim byte3 As Byte
Dim byte4 As Byte
'start position=location  ,  bytes=#bytes to read
Open "profile.bin" For Binary As #1
 
    Get #1, location + 1, byte1: Get #1, location + 2, byte2: Get #1, location + 3, byte3: Get #1, location + 4, byte4
    result32 = (byte4 * 16777216#) + (byte3 * 65536#) + (byte2 * 256#) + (byte1 * 1#)
    getbytes_convert32bit = result32
Close #1
End Function

..btw my program serverstats does profile editing of toons and other things..

GeorgeS

GeorgeS 07-27-2010 09:57 PM

Also continues - editing directly via sql

Code:

Quote:
UPDATE character_ SET profile = INSERT((SELECT profile FROM (SELECT * FROM character_)
 AS x WHERE id = 748),(4720+1),4,RPAD(CHAR(100),4,CHAR(0))) WHERE id = 748;

This would give a character with an ID of 748 100 platinum.

In theory, you can change 4720 to any field # in the profile blob & the 100 to whatever numeric value you want it set to. You would then need to change the 4's to correspond with however many characters the data takes up (32-bit integers are 4, for example), otherwise the blob will become corrupt (too many/too few characters).

Some might be wondering why there are 2 subqueries. The answer is discussed here, and it's basically a workaround for not being able to query the same table in an update.

GeorgeS

GeorgeS 07-27-2010 10:01 PM

Lastly, here's the entire struct

Code:

struct PlayerProfile_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*/
};


GeorgeS

blindaviator 07-27-2010 10:43 PM

Ok that is information overload ATM... Will take me a bit to read through all that and understand it but I will get it...

Mainly what I am trying to do is setup a webpage where players can see all their toons, stats, bank and inventory items and so on...
Make it so they can unstick their own toons from their own control panel without assistance...
Make it so they can read and send in-game mail from their CP area also...
And so on... Am sure none of this is new to most here but I am relatively new to programming so it has been a great learning experience for me...
So far the learning curve for the BLOB has outdone anything I expected to do though...

I appreciate the help GeorgeS... :-D
I will look into that tool of yours for Administration purposes.... That is one of the few tools you make that I didn't download...
The PHP PEQ editor from code source is a nice tool but it has some limitations that your tools don't have... The PEQ editor is a quick easy one for fast editing
but when I need power I use yours...

I very much appreciate those tools and the efforts you put into them...


All times are GMT -4. The time now is 12:07 PM.

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