Go Back   EQEmulator Home > EQEmulator Forums > Support > Support::General Support

Support::General Support Post all topics here having to do with errors while trying to connect to an EQEMu server but not about the setup/running of the Server itself.

Reply
 
Thread Tools Display Modes
  #1  
Old 07-14-2008, 12:12 PM
spider661
Discordant
 
Join Date: Oct 2005
Location: michigain
Posts: 260
Default skills in the database?

is there a way to extract skills from the database?

maybe something i could use in a php script

maybe skill id/value i was looking at the old magelo clone and it has something in there about it but it looks like it bases it off you lvl verses item bonuses. not the actual skills itself.

here is the code they use maybe you can modify it?

Code:
$results = mysql_query("SELECT * from character_ where name='$charName' limit 1;");
$row = mysql_fetch_array($results);
$charID = $row['id'];
$profile = $row['profile'];		

$profile = bin2hex($profile);

function getSkillName($skill) {
    switch($skill) {
     case '0': return "1H Blunt"; break;
     case '1': return "1H Slashing"; break;
     case '2': return "2H Blunt"; break;
     case '3': return "2H Slashing"; break;
     case '4': return "Abjuration"; break;
     case '5': return "Alteration"; break;
     case '6': return "Apply Poison"; break;
     case '7': return "Archery"; break;
     case '8': return "Backstab"; break;
     case '9': return "Bind Wound"; break;
     case '10': return "Bash"; break;
     case '11': return "Block"; break;
     case '12': return "Brass Instuments"; break;
     case '13': return "Channeling"; break;
     case '14': return "Conjuration"; break;
     case '15': return "Defense"; break;
     case '16': return "Disarm"; break;
     case '17': return "Disarm Traps"; break;
     case '18': return "Divination"; break;
     case '19': return "Dodge"; break;
     case '20': return "Double Attack"; break;
     case '21': return "Dragon Punch"; break;
     case '22': return "Dual Wield"; break;
     case '23': return "Eagle Strike"; break;
     case '24': return "Evocation"; break;
     case '25': return "Feign Death"; break;
     case '26': return "Flying Kick"; break;
     case '27': return "Forage"; break;
     case '28': return "Hand to Hand"; break;
     case '29': return "Hide"; break;
     case '30': return "Kick"; break;
     case '31': return "Meditate"; break;
     case '32': return "Mend"; break;
     case '33': return "Offense"; break;
     case '34': return "Parry"; break;
     case '35': return "Pick Lock"; break;
     case '36': return "Piercing"; break;
     case '37': return "Riposte"; break;
     case '38': return "Round Kick"; break;
     case '39': return "Safe Fall"; break;
     case '40': return "Sense Heading"; break;
     case '41': return "Singing"; break;
     case '42': return "Sneak"; break;
     case '43': return "Specialize Abjuration"; break;
     case '44': return "Specialize Alteration"; break;
     case '45': return "Specialize Conjuration"; break;
     case '46': return "Specialize Divination"; break;
     case '47': return "Specialize Evocation"; break;
     case '48': return "Pick Pocket"; break;
     case '49': return "Stringed Instruments"; break;
     case '50': return "Swimming"; break;
     case '51': return "Throwing"; break;
     case '52': return "Tiger Claw"; break;
     case '53': return "Tracking"; break;
     case '54': return "Wind Instruments"; break;
     case '55': return "Fishing"; break;
     case '56': return "Make Poison"; break;
     case '57': return "Tinkering"; break;
     case '58': return "Research"; break;
     case '59': return "Alchemy"; break;
     case '60': return "Baking"; break;
     case '61': return "Tailoring"; break;
     case '62': return "Sense Traps"; break;
     case '63': return "Blacksmithing"; break;
     case '64': return "Fletching"; break;
     case '65': return "Brewing"; break;
     case '66': return "Alchohol Tolerance"; break;
     case '67': return "Begging"; break;
     case '68': return "Jewelry"; break;
     case '69': return "Pottery"; break;
     case '70': return "Percussion Instruments"; break;
     case '71': return "Intimidation"; break;
     case '72': return "Berserking"; break;
     case '73': return "Taunt"; break;
    }
}

$skills = array();

for($i = 0; $i < 74; $i++) {
	$skills[$i] = 0;
}	

#for($i = 5984, $j = 0; $i < 5984 + (8 * 75); $i += 8, $j++) {
for($i = 7664, $j = 0; $i < 7664 + (8 * 75); $i += 8, $j++) {
  $skill = hexdec(substr($profile, $i, 2));

  $skill += floor($skill * $itemSkills[$j] / 100);
  
  $skills[$j] = $skill;
}
?>
<table border="0" width="210" cellspacing="0" cellpadding="0" id="table1">
	<tr>
		<td align="left" width="100" valign="top">
		<font face="Arial" style="font-size: 8pt" color="#6699FF">Skill Name</font><font face="Arial" style="font-size: 8pt" color="#FFFFFF"><br>

<?php for($i = 0; $i < 74; $i++) {
	  if($skills[$i] != 0)
        echo getSkillName($i) . '<br>';
    }
?>	
        </font></td>
		<td width="10" align="right" valign="top">
		<font face="Arial" style="font-size: 8pt" color="#6699FF">Value</font><font face="Arial" style="font-size: 8pt" color="#FFFFFF"><br>

<?php for($i = 0; $i < 74; $i++) {
	  if($skills[$i] != 0) {
	    if($itemSkills[$i] != 0) { echo "<font color=\"#00FF00\">"; }

        echo "$skills[$i]<br>";

        if($itemSkills[$i] != 0) echo "</font>";
	  }
	  
}
?>	
		</font></td>
		<td width="45" align="right" valign="top">
		<font face="Arial" style="font-size: 8pt" color="#6699FF">Bonus</font><font face="Arial" style="font-size: 8pt" color="#FFFFFF"><br>

<?php for($i = 0; $i < 74; $i++) {
	  if($itemSkills[$i] != 0)
        echo "$itemSkills[$i]%";
        
      if($skills[$i] != 0)
        echo "<br>";
    }
?>	
		
		</font></td>
	</tr>
</table>
i get it to print out like it should useing this and some code from the table script. but it list all the skills and then sets them to 255 and thats not the skills the char has.
Reply With Quote
  #2  
Old 07-14-2008, 03:44 PM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

If you're asking how to read the profile (which I think you are), I have made a script that does this. As a result, you can then pull a list of skill IDs with their corresponding skill level. I have listed this in the Wiki, but I've also posted some source on Sourceforge. It requires a few functions to make things a bit easier to convert from ASCII (which is how the blob is stored) to integers (signed or unsigned depending on the data). Here's the main stuff you'll need:

First, the functions:
Code:
    1 <?php
    2 
    3 // convert an input string into it's binary equivalent.
    4 function asc2bin($asciiInput, $byteLength=8) {
    5 	// Numerical data is reverse ASCII, so we need to turn it around
    6 	$asciiRev = strrev($asciiInput);
    7 
    8 	$binaryOutput = '';
    9 	$strSize = strlen($asciiRev);
   10 
   11 	for($x=0; $x<$strSize; $x++)
   12 	{
   13 		$charBin = decbin(ord($asciiRev{$x}));
   14 		$charBin = str_pad($charBin, $byteLength, '0', STR_PAD_LEFT);
   15 		$binaryOutput .= $charBin;
   16 	}
   17 
   18 	return $binaryOutput;
   19 }

   28 // Convert ASCII to unsigned integer (requires asc2bin)
   29 function asc2uint($asciiInput) {
   30 	if ($decimalOutput = bindec(asc2bin($asciiInput))) {
   31 		return $decimalOutput;
   32 	} else {
   33 		return "0";
   34 	}
   35 }
   36 
   37 // Convert ASCII to a Hex representation of its string (requires asc2bin)
   38 function asc2hex($asciiInput) {
   39 	if ($hexOutput = bin2hex(asc2bin($asciiInput))) {
   40 		return $hexOutput;
   41 	}
   42 }
Next, the code to pull the profile & spit out the skills:
Code:
    1 <?php
    2 $query_profile = "SELECT profile FROM character_ WHERE id=" . $_GET["id"];
    3 $result_profile = mysql_query($query_profile,$db);
    4 $db_row_profile = mysql_fetch_array($result_profile);
    5 
    6 $profileResult = $db_row_profile["profile"];

  178 // skills[75]
  179 	for ($x = 0; $x <= 74; $x++) {
  180 		$Profile["skills"][$x] = asc2uint(substr($profileResult,$x*4+4796,4));
  181 	};

  300 ?>
You can then access the skills by using $Profile[skills][x] where x is the number associated with the skill (which there are actually 74 including Frenzy). If you want just the skills, you could probably simplify the function by just using ord() to convert each character to a number, but it could also cause more problems.

On a side note, if you're looking to pull any other information from the profile, the script I made, listed above, splits everything up from the profile into a nice array. I've modified it since to also convert the extprofile blob, but I haven't updated it to CVS yet. If you want to use any of it for any tools you're making, feel free, since I have it published under the GNU GPL.

In any case, hope this helps.
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
Reply With Quote
  #3  
Old 07-14-2008, 07:18 PM
spider661
Discordant
 
Join Date: Oct 2005
Location: michigain
Posts: 260
Default

WOW thats amazing and the wiki will help me alot in finding the diff strings.. thanks alot you have been a really big help.
Reply With Quote
Reply


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 03:23 PM.


 

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