Jump to content

Block riding on mount with wedding armor equipped


Recommended Posts

  • Active Member

Hey guys,

I'm trying to prevent player from using mount (RideItem) with wedding armor equipped.

I tried to do this, but it doesn't work (questlua_pc.cpp - pc_mount):

Spoiler
//PLAYER CAN'T RIDE ON MOUNT WITH WEDDING ARMOR EQUIPPED
		LPITEM armor = ch->GetWear(WEAR_BODY);
		LPITEM item = ch->GetWear(WEAR_UNIQUE1);
		LPITEM item2 = ch->GetWear(WEAR_UNIQUE2);
		
		if (armor && (armor->GetVnum() >= 11901 && armor->GetVnum() <= 11904))
		{
			if ((item->IsRideItem()) || (item2->IsRideItem()))
			{
				ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You cannot ride a mount when wedding armor is equipped."));
				return 0;
			}
		}
//PLAYER CAN'T RIDE ON MOUNT WITH WEDDING ARMOR EQUIPPED

 

Anyone got another idea for fix?

Thanks for answers!

Sincerely,

ReFresh

Edited by ReFresh

I'll be always helpful! 👊 

Link to comment
Share on other sites

  • Active Member

@SamuraiHUN Thanks, but there is still one problem. It doesn't work when you click on RideItem with mouse, you can still ride on mount with wedding dress. (Your code working only when you use CTRL+G shortcut). Could it be fixed by source side too or it's quest problem now and I need to add some check in ride.quest?

I'll be always helpful! 👊 

Link to comment
Share on other sites

  • Contributor
On 10/28/2021 at 10:44 PM, ReFresh said:

I need to add some check in ride.quest?

Actually yes, look for if pc.is_polymorphed() then syschat("You are polymorphed...") and add

            elseif pc.get_wear(0) >= 11901 and pc.get_wear(0) <= 11904 then
                syschat("No wedding dress allowed.")
Spoiler
		when 71114.use or 71115.use or 71116.use or 71117.use or 71118.use or 71119.use or 71120.use or 71121.use 
		or 71171.use or 71172.use or 71161.use or 71124.use or 71125.use or 71126.use or 71127.use or 71128.use 
		or 71137.use or 71138.use or 71139.use or 71140.use or 71141.use or 71142.use 
		or 71131.use or 71132.use or 71133.use or 71134.use or 71164.use or 71165.use or 71166.use 
		begin
			 if pc.is_polymorphed() then
				syschat("Átváltozva nem használhatod!")
			elseif pc.get_wear(0) >= 11901 and pc.get_wear(0) <= 11904 then
				syschat("Nem viselhetsz esküvői ruhát!")
			elseif false == pc.is_riding() then
			 	if true == horse.is_summon() then
					horse.unsummon()
				end
				 ride.Ride(item.vnum, 0)
			 else
				syschat("Először szállj le a mountról a ctrl+g billentyűvel!")
			 end
		end

 

Link to comment
Share on other sites

  • Active Member

@ TMP4 I did the same thing:

Spoiler
			local blockedItems = {11901, 11902, 11903, 11904};
			local wearPositions = {0}
			

				for i = 1, table.getn(blockedItems) do
					for j = 1, table.getn(wearPositions) do
						if (pc.get_wear(wearPositions[j]) == blockedItems[i]) then
							syschat("No wedding dress allowed")
							return
						end -- if
					end -- for
				end -- for
			end

 

But ride item is still equipping that's the last thing which I need to fix.

Edited by ReFresh

I'll be always helpful! 👊 

Link to comment
Share on other sites

  • Contributor
59 minutes ago, ReFresh said:

@ TMP4 I did the same thing:

  Reveal hidden contents
			local blockedItems = {11901, 11902, 11903, 11904};
			local wearPositions = {0}
			

				for i = 1, table.getn(blockedItems) do
					for j = 1, table.getn(wearPositions) do
						if (pc.get_wear(wearPositions[j]) == blockedItems[i]) then
							syschat("No wedding dress allowed")
							return
						end -- if
					end -- for
				end -- for
			end

 

But ride item is still equipping that's the last thing which I need to fix.

I think Samurai code is not right here in char_item CHARACTER::EquipItem:

    if (item->IsRideItem())
    {
        if (IsRiding())
        {
            ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ŔĚąĚ Ĺ»°ÍŔ» ŔĚżëÁßŔÔ´Ď´Ů."));
            return false;
        }

        if (IsPolymorphed())
        {
            ChatPacket(CHAT_TYPE_INFO, LC_TEXT("şŻ˝Ĺ »óĹÂżˇĽ­´Â ¸»żˇ Ĺ» Ľö ľř˝Ŕ´Ď´Ů."));
            return false;
        }
        
        if (iWearCell == (item->GetVnum() >= 11901 && item->GetVnum() <= 11904))
        {
            ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¸»Ŕ» Ĺş »óĹÂżˇĽ­ żąşąŔ» ŔÔŔ» Ľö ľř˝Ŕ´Ď´Ů."));
            return false;
        }
    }

Change it to:

    if (item->IsRideItem())
    {
        if (IsRiding())
        {
            ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ŔĚąĚ Ĺ»°ÍŔ» ŔĚżëÁßŔÔ´Ď´Ů."));
            return false;
        }

        if (IsPolymorphed())
        {
            ChatPacket(CHAT_TYPE_INFO, LC_TEXT("şŻ˝Ĺ »óĹÂżˇĽ­´Â ¸»żˇ Ĺ» Ľö ľř˝Ŕ´Ď´Ů."));
            return false;
        }
        
        LPITEM checkItem = GetWear(WEAR_BODY);
        if (checkItem && checkItem->GetVnum() >= 11901 && checkItem->GetVnum() <= 11904)
        {
            ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¸»Ŕ» Ĺş »óĹÂżˇĽ­ żąşąŔ» ŔÔŔ» Ľö ľř˝Ŕ´Ď´Ů."));
            return false;
        }
    }
                                                                                       

I tested and it should work.

Edited by TMP4
  • Love 2
Link to comment
Share on other sites

14 hours ago, TMP4 said:

I think Samurai code is not right here in char_item CHARACTER::EquipItem:

    if (item->IsRideItem())
    {
        if (IsRiding())
        {
            ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ŔĚąĚ Ĺ»°ÍŔ» ŔĚżëÁßŔÔ´Ď´Ů."));
            return false;
        }

        if (IsPolymorphed())
        {
            ChatPacket(CHAT_TYPE_INFO, LC_TEXT("şŻ˝Ĺ »óĹÂżˇĽ­´Â ¸»żˇ Ĺ» Ľö ľř˝Ŕ´Ď´Ů."));
            return false;
        }
        
        if (iWearCell == (item->GetVnum() >= 11901 && item->GetVnum() <= 11904))
        {
            ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¸»Ŕ» Ĺş »óĹÂżˇĽ­ żąşąŔ» ŔÔŔ» Ľö ľř˝Ŕ´Ď´Ů."));
            return false;
        }
    }

Change it to:

    if (item->IsRideItem())
    {
        if (IsRiding())
        {
            ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ŔĚąĚ Ĺ»°ÍŔ» ŔĚżëÁßŔÔ´Ď´Ů."));
            return false;
        }

        if (IsPolymorphed())
        {
            ChatPacket(CHAT_TYPE_INFO, LC_TEXT("şŻ˝Ĺ »óĹÂżˇĽ­´Â ¸»żˇ Ĺ» Ľö ľř˝Ŕ´Ď´Ů."));
            return false;
        }
        
        LPITEM checkItem = GetWear(WEAR_BODY);
        if (checkItem && checkItem->GetVnum() >= 11901 && checkItem->GetVnum() <= 11904)
        {
            ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¸»Ŕ» Ĺş »óĹÂżˇĽ­ żąşąŔ» ŔÔŔ» Ľö ľř˝Ŕ´Ď´Ů."));
            return false;
        }
    }
                                                                                       

I tested and it should work.

thank you i updated. ^^

  • Love 1
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.