Jump to content

Item_addon.cpp with case nvum


Recommended Posts

Hi,

I'd like to make that with a specific vnum (like 299, 399, 499 ecc) the   

 int iSkillBonus = 
int iNormalHitBonus =

will be different, I don't think this is the right way to do it, it is just an example to explain how i'd like to do it

Thank you

 

void CItemAddonManager::ApplyAddonTo(int iAddonType, LPITEM pItem)
{
	if (!pItem)
	{
		sys_err("ITEM pointer null");
		return;
	}

	//FOR EXAMPLE SOMETHING LIKE THIS:
  
  	    switch (item->GetVnum())
	    {
		case 299:	
		case 399:	
		case 499:	
		case 599:	
	
        int iSkillBonus = MINMAX(-40, (int) (gauss_random(0, 5) + 0.5f), 40);
		int iNormalHitBonus = 0;
		if (abs(iSkillBonus) <= 30)
			iNormalHitBonus = -2 * iSkillBonus + abs(number(-8, 8) + number(-8, 8)) + number(1, 4);
		else
			iNormalHitBonus = -2 * iSkillBonus + number(1, 5);

		pItem->RemoveAttributeType(APPLY_SKILL_DAMAGE_BONUS);
		pItem->RemoveAttributeType(APPLY_NORMAL_HIT_DAMAGE_BONUS);
		pItem->AddAttribute(APPLY_NORMAL_HIT_DAMAGE_BONUS, iNormalHitBonus);
		pItem->AddAttribute(APPLY_SKILL_DAMAGE_BONUS, iSkillBonus);
		}
  		//ELSE IF THE VNUM ISN'T ABOVE, DO THIS ATTRIBUTE
  
	int iSkillBonus = MINMAX(-30, (int) (gauss_random(0, 5) + 0.5f), 30);
	int iNormalHitBonus = 0;
	if (abs(iSkillBonus) <= 20)
		iNormalHitBonus = -2 * iSkillBonus + abs(number(-8, 8) + number(-8, 8)) + number(1, 4);
	else
		iNormalHitBonus = -2 * iSkillBonus + number(1, 5);

	pItem->RemoveAttributeType(APPLY_SKILL_DAMAGE_BONUS);
	pItem->RemoveAttributeType(APPLY_NORMAL_HIT_DAMAGE_BONUS);
	pItem->AddAttribute(APPLY_NORMAL_HIT_DAMAGE_BONUS, iNormalHitBonus);
	pItem->AddAttribute(APPLY_SKILL_DAMAGE_BONUS, iSkillBonus);
}

 

Link to comment
Share on other sites

  • Forum Moderator

That's what he requested in private, if someone need it, those are not my calculations/code.

void CItemAddonManager::ApplyAddonTo(int iAddonType, LPITEM pItem)
{
	if (!pItem)
	{
		sys_err("ITEM pointer null");
		return;
	}

	bool bCustomizedAddon = false;
	switch (pItem->GetVnum())
	{
		case 1129:	
		case 2129:	
		case 3129:	
		case 5129:	
			bCustomizedAddon = true;
			break;
	}
	
	int iSkillBonus = MINMAX(-30, static_cast<int>(gauss_random(0, 5) + 0.5f), 30);
	int iNormalHitBonus = 0;
	if (bCustomizedAddon)
	{
		if (abs(iSkillBonus) <= 0)
			iNormalHitBonus = (-1 * iSkillBonus) / 2 + abs(number(-2, 2) + number(-2, 2)) + number(1, 2);
		else
			iNormalHitBonus = (-1 * iSkillBonus) / 2 + abs(number(-3, 6));
	
		if (abs(iSkillBonus) <= 0)
			iSkillBonus = (1 * iSkillBonus) / 2 + abs(number(-1, 1) + number(-1, 1)) + number(1, 2);
		else
			iSkillBonus = (1 * iSkillBonus) / 2 + abs(number(-3, 1));
	}
	else
	{
		if (abs(iSkillBonus) <= 20)
			iNormalHitBonus = -2 * iSkillBonus + abs(number(-8, 8) + number(-8, 8)) + number(1, 4);
		else
			iNormalHitBonus = -2 * iSkillBonus + number(1, 5);
	}

	pItem->RemoveAttributeType(APPLY_SKILL_DAMAGE_BONUS);
	pItem->RemoveAttributeType(APPLY_NORMAL_HIT_DAMAGE_BONUS);
	pItem->AddAttribute(APPLY_NORMAL_HIT_DAMAGE_BONUS, iNormalHitBonus);
	pItem->AddAttribute(APPLY_SKILL_DAMAGE_BONUS, iSkillBonus);
}
  • Love 4
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



  • Similar Content

  • Activity

    1. 0

      I just implemented some costumes and they are not visible

    2. 0

      Skill Tree Problem

    3. 97

      Ulthar SF V2 (TMP4 Base)

    4. 5

      Client Crashes through Offline Shop (Ikarus)

    5. 5

      VIVY-WORLD2 - FARM TO THE TOP

    6. 0

      ToolTip Bug?

    7. 0

      Skill tree build erorr

    8. 0

      Visual Bug | How to fix this visual bug inside the Special Storage feature?

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.