Jump to content

Block 2 "Ring" types with the same Vnum


Recommended Posts

Hello guys I added Ring slots to my system and I searched for a function that blocks 2 rings with the same vnum (id) to be equipped at the same time. I found this:

Spoiler

if (item->GetType() & ITEM_RING)
    {
        if ((GetWear(WEAR_RING1) && GetWear(WEAR_RING1)->IsSameSpecialGroup(item)) || (GetWear(WEAR_RING2) && GetWear(WEAR_RING2)->IsSameSpecialGroup(item)))
        {
            ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can't put two same items in the same time."));
            return false;
        }
    }

 but this blocks 2 items with the same type (ring) to be equipped at the same time. I don't know C++ so is there anybody who can help me modify this function to work for 2 item vnums and not 2 item types?

Link to comment
Share on other sites

  • 6 months later...

Wrong post.

 
1 hour ago, arves100 said:

if (item->GetType() & ITEM_RING)
    {
        if ((GetWear(WEAR_RING1) && GetWear(WEAR_RING1)->GetVnum()) || (GetWear(WEAR_RING2) && GetWear(WEAR_RING2)->GetVnum()))
        {
            ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can't put two same items in the same time."));
            return false;
        }
    }

 

Try with this

this is work i use it too.

Link to comment
Share on other sites

Unfortunately isnt working... :(
Im searching this fix too...

With this Fix -> It blocks 2 Items with the same type - So Slot1: Ring - so i cant give a secound ring in the secound slot, because it is blocked...

 

What we need:

2 Items with same Type (ring)
you can use both rings into slots BUT, it isnt allowed 2 items with the Same item in these slots.
Ring1=CANDY, Ring2=CANDY ----- NO

RIng1=CANDY, Ring2=Ring of Lethal Power ---- YES

Edit:
This is my whole function:
not working.
http://pastebin.com/vQb38aZG

Please help...
thanks
Best Regards.

  • Love 1
Link to comment
Share on other sites

yes
i have in Slot 1: CANDY equipped


i will equip Ring of Lethal Power into Slot2
and if i click on the ring to equip, it displays me " You can't put two same items in the same time. "

So it isnt possible to equip 2 items with type "item_rings"


normally, it should be able to equip 2 rings, but different (ring of lethal... - candy), not the same one (candy - candy)

Link to comment
Share on other sites

  • Developer

Try now, should work..

if (item->GetType() == ITEM_RING) 
{
    if (GetWear(WEAR_RING1)->GetVnum() == GetWear(WEAR_RING2)->GetVnum())
        ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can't put two same items in the same time."));

 return false;
    else return true;
}
 

 

r

Link to comment
Share on other sites

i'll get errors when i'm compile the game-source

char_item.cpp:8215: error: expected primary-expression before 'return'
char_item.cpp:8215: error: expected `;' before 'return'

 

I Try this one:

    if (item->GetType() == ITEM_RING)
    {
        if (GetWear(WEAR_RING1)->GetVnum() == GetWear(WEAR_RING2)->GetVnum())
        {
            ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can't put two same items in the same time."));
            return false;
        }

    return true;

    }

And this one:
    if (item->GetType() == ITEM_RING)
    {
        if (GetWear(WEAR_RING1)->GetVnum() == GetWear(WEAR_RING2)->GetVnum())
        {
            ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can't put two same items in the same time."));
            return false;
        }
        else
        {
            return true;
        }
    }

i try this 2 functions, these are compileable and it isnt working too, it blocks the second ring.
Sorry if this code which i tryed isnt correct, but im not soo good in c++ ^^

Link to comment
Share on other sites

  • 2 weeks later...
  • 6 years later...

My new fix 100% work:

	if (item->GetType() == ITEM_RING)
	{
		std::vector<LPITEM> FixByMuchomor = { GetWear(WEAR_RING1), GetWear(WEAR_RING2) };
		const int FixByMuchomorSize = FixByMuchomor.size();

		for (int i = 0; i < FixByMuchomorSize; i++)
		{
			if (FixByMuchomor[i])
			{
				if (FixByMuchomor[i]->GetVnum() == item->GetVnum() || FixByMuchomor[i]->GetSubType() == item->GetSubType())
				{
					ChatPacket(CHAT_TYPE_INFO, "Nie możesz założyć tego przedmiotu dwa razy!");
					return false;
				}
			}
		}
	}

 

Edited by Grzyb
  • Lmao 1

Grzyb.ovh

Link to comment
Share on other sites

  • 2 months later...

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.