Jump to content

Refine item with switch


Go to solution Solved by Cripplez,

Recommended Posts

Hello

I'm trying to make this refine item only for item_weapon and another refine item for item_armor

I tried something like this but it's not working, the item 71032 should only work for weapon but when i use it on a weapon or another item it says the message of error

Do you know how i can fix this? Thank you

					case USE_TUNING:
					case USE_DETACHMENT:
						{
							LPITEM item2;
							switch (item->GetVnum())
							{
								case 71032:
									if (item2->GetType() != ITEM_WEAPON)
									{
										ChatPacket(CHAT_TYPE_INFO, LC_TEXT("error_refine_only_weapon"));
										return false;
									}
									break;
								case 39022:
									if (item2->GetSubType() != ARMOR_BODY)
									{
										ChatPacket(CHAT_TYPE_INFO, LC_TEXT("error_refine_only_armor"));
										return false;
									}
									break;
							}
                          

							if (!IsValidItemPosition(DestCell) || !(item2 = GetItem(DestCell)))
								return false;

							if (item2->IsExchanging() || item2->IsEquipped()) // @fixme114
								return false;

#ifdef ENABLE_ACCE_SYSTEM
							if (item->GetValue(0) == ACCE_CLEAN_ATTR_VALUE0)
							{
								if (!CleanAcceAttr(item, item2))
									return false;

								return true;
							}
#endif

 

Edited by Cripplez
Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Solution

Solved doing this instead:

 

					case USE_TUNING:
					case USE_DETACHMENT:
						{
							LPITEM item2;
                          
							if (!IsValidItemPosition(DestCell) || !(item2 = GetItem(DestCell)))
								return false;

							if (item2->IsExchanging() || item2->IsEquipped()) // @fixme114
								return false;
                          
							switch (item->GetVnum())
							{
								case 71032:
									if (item2->GetType() != ITEM_WEAPON)
									{
										ChatPacket(CHAT_TYPE_INFO, LC_TEXT("error_refine_only_weapon"));
										return false;
									}
									break;
								case 39022:
									if (item2->GetSubType() == ARMOR_BODY)
									{
									}
                                	else
									{
										ChatPacket(CHAT_TYPE_INFO, LC_TEXT("error_refine_only_armor"));
										return false;
									}
									break;
							}

#ifdef ENABLE_ACCE_SYSTEM
							if (item->GetValue(0) == ACCE_CLEAN_ATTR_VALUE0)
							{
								if (!CleanAcceAttr(item, item2))
									return false;

								return true;
							}
#endif

 

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.