Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Plugins & Mods

Quests::Plugins & Mods Completed plugins for public use as well as modifications.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 03-07-2018, 06:51 AM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

I knew more about all this crap when I wrote it.
This is an indication of how long ago that was...

Code:
package EQEmu::PlayerProfile_Struct;

use strict;
use warnings;

use EQEmu::BlobConvert;
use EQEmu::Bind_Struct;
use EQEmu::Color_Struct;

# constructor
sub new {
    my ($class, %params) = @_;
    my $self = {};
    bless ($self, $class);
    foreach my ($key, $val) (%params) {
        print "$key => $val.\n";
    }
    $self->parseBlob($blob);
    $self;
}

# data extraction/conversion happens here
sub parseBlob {
    my ($self, $blob) = @_;
    $self->{_checksum}    = asc2dec($blob,   0,  4);
    $self->{_name}        = asconly($blob,   4, 64);
    $self->{_last_name}   = asconly($blob,  68, 32);
    $self->{_gender}      = asc2dec($blob, 100,  4);
    $self->{_race}        = asc2dec($blob, 104,  4);
    $self->{_class_}      = asc2dec($blob, 108,  4);
    $self->{_unknown0112} = asc2dec($blob, 112,  4);
    $self->{_level}       = asc2dec($blob, 116,  4);
    foreach my $i (0..4) {
        $self->{_binds}[$i] = new EQEmu::Bind_Struct
        (
              asc2dec($blob, $i*20+120, 4), # zoneID
            asc2float($blob, $i*20+124, 4), # x
            asc2float($blob, $i*20+128, 4), # y
            asc2float($blob, $i*20+132, 4), # z
            asc2float($blob, $i*20+136, 4)  # heading
        );
    }
    $self->{_haircolor}        = asc2dec($blob,  296, 1);
    $self->{_beardcolor}       = asc2dec($blob,  297, 1);
    $self->{_eyecolor1}        = asc2dec($blob,  298, 1);
    $self->{_eyecolor2}        = asc2dec($blob,  299, 1);
    $self->{_hairstyle}        = asc2dec($blob,  300, 1);
    $self->{_beard}            = asc2dec($blob,  301, 1);
    $self->{_face}             = asc2dec($blob, 2504, 1);
    $self->{_drakkin_heritage} = asc2dec($blob, 5440, 4);
    $self->{_drakkin_tattoo}   = asc2dec($blob, 5444, 4);
    $self->{_drakin_details}   = asc2dec($blob, 5448, 4);
    foreach my $i (0..8) {
        $self->{_item_material}[$i] = asc2dec($blob, $i*4+312, 4);
    }
    foreach my $i (0..8) {
        $self->{_item_tint}[$i] = new EQEmu::Color_Struct
        (
            asc2dec($blob, $i*4+396, 1), # blue
            asc2dec($blob, $i*4+397, 1), # green
            asc2dec($blob, $i*4+398, 1), # red
            asc2dec($blob, $i*4+399, 1)  # use_tint
        );
    }
}

# read-only accessor methods
# array accessors return the specified element if an index is passed
# otherwise, the entire array is returned
sub checksum         { shift->{_checksum}; }
sub name             { shift->{_name}; }
sub last_name        { shift->{_last_name}; }
sub gender           { shift->{_gender}; }
sub race             { shift->{_race}; }
sub class_           { shift->{_class_}; }
sub level            { shift->{_level}; }
sub haircolor        { shift->{_haircolor}; }
sub beardcolor       { shift->{_beardcolor}; }
sub eyecolor1        { shift->{_eyecolor1}; }
sub eyecolor2        { shift->{_eyecolor2}; }
sub hairs            { shift->{_hairstyle}; }
sub beard            { shift->{_beard}; }
sub face             { shift->{_face}; }
sub drakkin_heritage { shift->{_drakkin_heritage}; }
sub drakkin_tattoo   { shift->{_drakkin_tattoo}; }
sub drakkin_details  { shift->{_drakkin_details}; }
sub item_material {
    my ($self, $i) = @_;
    defined($i) ? ${$self->{_item_material}}[$i] : @{$self->{_item_material}};
}
sub binds {
    my ($self, $i) = @_;
    defined($i) ? ${$self->{_binds}}[$i] : @{$self->{_binds}};
}
sub item_tint {
    my ($self, $i) = @_;
    defined($i) ? ${$self->{_item_tint}}[$i] : @{$self->{_item_tint}};
}

1;
__________________
I muck about @ The Forge.
say(rand 99>49?'try '.('0x'.join '',map{unpack 'H*',chr rand 256}1..2):'incoherent nonsense')while our $Noport=1;
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 04:55 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3