Jump to content

Recommended Posts

Hello! I've changed the blacksmith to make it like the "scroll" (the item will not be lost if fail) with a guide on turkmmo, but I've a problem, if I did up an item +0 and fail, it gave me error and crash, so i've added this line of code:

		if (result_fail_vnum == 0)
		{
			return false;
		}

and it worked, no more crash or error, but there is another problem, when I upgrade a +0 item and fail, it doens't make the classic popup failed, i tried with this:

		if (result_fail_vnum == 0)
		{
			NotifyRefineFail(this, item, IsRefineThroughGuild() ? "GUILD" : "POWER");
			return false;
		}

this:

 

		if (result_fail_vnum == 0)
		{
			NotifyRefineFail(this, item, szRefineType);
			return false;
		}

and this:

		if (result_fail_vnum == 0)
		{
			ChatPacket(CHAT_TYPE_COMMAND, "RefineFailed");
			return false;
		}

and none of them worked.

What I should change?

This is the "full" guilty code 

Spoiler

	{	
		// 실패! 모든 아이템이 사라짐.
		DWORD result_fail_vnum = item->GetRefineFromVnum();
		
		if (result_fail_vnum == 0)
		{
			return false;
		}

		LPITEM pkNewItem = ITEM_MANAGER::instance().CreateItem(result_fail_vnum, 1, 0, true);
		BYTE bCell = item->GetCell();
		NotifyRefineFail(this, item, IsRefineThroughGuild() ? "GUILD" : "POWER");
		ITEM_MANAGER::CopyAllAttrTo(item, pkNewItem);
		pkNewItem->AddToCharacter(this, TItemPos(INVENTORY, bCell));

		//PointChange(POINT_GOLD, -cost);
		PayRefineFee(cost);
	}

	return true;
}

 

 

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

  • Premium

Could you c/p here the affected code snippets before and after the changes?

  • Love 1

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
Share on other sites

16 minutes ago, Syreldar said:

Could you c/p here the affected code snippets before and after the changes?

Thank you @Syreldar, but i've solved 3 minutes ago using a method by Vegas to change the failures prompt depending from cases (like by scroll / blacksmith / ecc)
Anyway i've put here the before and after code:

Before my code was:

	else
	{	
		// ½ÇÆÐ! ¸ðµç ¾ÆÀÌÅÛÀÌ »ç¶óÁü.
		DBManager::instance().SendMoneyLog(MONEY_LOG_REFINE, item->GetVnum(), -cost);
		NotifyRefineFail(this, item, IsRefineThroughGuild() ? "GUILD" : "POWER");
		item->AttrLog();
		ITEM_MANAGER::instance().RemoveItem(item, "REMOVE (REFINE FAIL)");

		//PointChange(POINT_GOLD, -cost);
		PayRefineFee(cost);
	}

	return true;
}

then i change it like this to make the blacksmith not destroy items:

	else
	{	
		// ½ÇÆÐ! ¸ðµç ¾ÆÀÌÅÛÀÌ »ç¶óÁü.
		DWORD result_fail_vnum = item->GetRefineFromVnum();
		LPITEM pkNewItem = ITEM_MANAGER::instance().CreateItem(result_fail_vnum, 1, 0, true);
		BYTE bCell = item->GetCell();
		ITEM_MANAGER::CopyAllAttrTo(item, pkNewItem);
		pkNewItem->AddToCharacter(this, TItemPos(INVENTORY, bCell)); 

		//PointChange(POINT_GOLD, -cost);
		PayRefineFee(cost);
	}

	return true;
}

and then i add 2 lines to solve the crash issue when fail to upgrade an item +0:

	else
	{	
		// ½ÇÆÐ! ¸ðµç ¾ÆÀÌÅÛÀÌ »ç¶óÁü.
		DWORD result_fail_vnum = item->GetRefineFromVnum();
		
		if (result_fail_vnum == 0)
		{
			return false;
		}

		LPITEM pkNewItem = ITEM_MANAGER::instance().CreateItem(result_fail_vnum, 1, 0, true);
		BYTE bCell = item->GetCell();
		ITEM_MANAGER::CopyAllAttrTo(item, pkNewItem);
		pkNewItem->AddToCharacter(this, TItemPos(INVENTORY, bCell));

		//PointChange(POINT_GOLD, -cost);
		PayRefineFee(cost);
	}

	return true;
}

Anyway thanks for help!

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



×
×
  • 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.