Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Development

Development::Development Forum for development topics and for those interested in EQEMu development. (Not a support forum)

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 11-17-2008, 06:42 AM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

Quote:
Originally Posted by trevius View Post
mob.cpp:
Code:
int Mob::GetPrimarySkillValue(SkillType &PrimarySkill, const ItemInst* Item_ID)
{
	int16 Item_ID = CastToClient()->GetItemIDAt(13);

	if (Item_ID = NULL)
		PrimarySkill = HAND_TO_HAND;

	else {
		const Item_Struct* item = Item_ID->GetItem();

		switch (item->ItemType)
		{
			case ItemType1HS: // 1H Slashing
			{
				PrimarySkill = _1H_SLASHING;
				break;
			}
			case ItemType2HS: // 2H Slashing
			{
				PrimarySkill = _2H_SLASHING;
				break;
			}
			case ItemTypePierce: // Piercing
			{
				PrimarySkill = PIERCING;
				break;
			}
			case ItemType1HB: // 1H Blunt
			{
				PrimarySkill = _1H_BLUNT;
				break;
			}
			case ItemType2HB: // 2H Blunt
			{
				PrimarySkill = _2H_BLUNT;
				break;
			}
			case ItemType2HPierce: // 2H Piercing
			{
				PrimarySkill = PIERCING;
				break;
			}
			case ItemTypeHand2Hand:
			{
				PrimarySkill = HAND_TO_HAND;
				break;
			}
			default:
			{
				PrimarySkill = NULL;
				break;
			}
		}
	}

	uint16 skill = GetSkill(PrimarySkill);

	return skill;
}
Per trev and my collaboration, corrections to the first function:

client.cpp:
Code:
uint16 Client::GetPrimarySkillValue()
{
	uint8 type = m_inv.GetItem(13)->GetItem()->ItemType;	//is this the best way to do this?
	SkillType skill = HIGHEST_SKILL + 1;	//because NULL == 0, which is 1H Slashing, & we want it to return 0 from GetSkill

	if (!type)
		skill = HAND_TO_HAND;

	else {

		switch (type)
		{
			case ItemType1HS: // 1H Slashing
			{
				skill = _1H_SLASHING;
				break;
			}
			case ItemType2HS: // 2H Slashing
			{
				skill = _2H_SLASHING;
				break;
			}
			case ItemTypePierce: // Piercing
			{
				skill = PIERCING;
				break;
			}
			case ItemType1HB: // 1H Blunt
			{
				skill = _1H_BLUNT;
				break;
			}
			case ItemType2HB: // 2H Blunt
			{
				skill = _2H_BLUNT;
				break;
			}
			case ItemType2HPierce: // 2H Piercing
			{
				skill = PIERCING;
				break;
			}
			case ItemTypeHand2Hand:
			{
				skill = HAND_TO_HAND;
				break;
			}
		}
	}

	return GetSkill(skill);
}
One thing to note is that we'll probably want to put this in the Mob class, then create a virtual function in the NPC class to always return 0, since as far as we know, NPCs don't have "skillz", plus a virtual function (above) for the Client class.
__________________
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
 


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