Extensive player ownership check for single or multiple items.
This commit is contained in:
		@@ -207,7 +207,7 @@ public class Hardin extends AbstractNpcAI
 | 
			
		||||
		}
 | 
			
		||||
		if (player.isDualClassActive()) // dual class
 | 
			
		||||
		{
 | 
			
		||||
			if (!hasQuestItems(player, CHAOS_ESSENCE_DUAL_CLASS))
 | 
			
		||||
			if (!ownsAtLeastOneItem(player, CHAOS_ESSENCE_DUAL_CLASS))
 | 
			
		||||
			{
 | 
			
		||||
				return "33870-no_already_reawakened.html";
 | 
			
		||||
			}
 | 
			
		||||
@@ -216,11 +216,11 @@ public class Hardin extends AbstractNpcAI
 | 
			
		||||
		{
 | 
			
		||||
			return "33870-no.html";
 | 
			
		||||
		}
 | 
			
		||||
		else if (!hasQuestItems(player, CHAOS_ESSENCE)) // main class
 | 
			
		||||
		else if (!ownsAtLeastOneItem(player, CHAOS_ESSENCE)) // main class
 | 
			
		||||
		{
 | 
			
		||||
			return "33870-no_already_reawakened.html";
 | 
			
		||||
		}
 | 
			
		||||
		if (player.hasServitors())
 | 
			
		||||
		if (player.hasSummon())
 | 
			
		||||
		{
 | 
			
		||||
			return "33870-no_summon.html";
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -279,7 +279,7 @@ public class Raina extends AbstractNpcAI
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "noSubChange.html";
 | 
			
		||||
				}
 | 
			
		||||
				else if (!hasQuestItems(player, SUBCLASS_CERTIFICATE))
 | 
			
		||||
				else if (!ownsAtLeastOneItem(player, SUBCLASS_CERTIFICATE))
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "noCertificate.html";
 | 
			
		||||
				}
 | 
			
		||||
@@ -378,7 +378,7 @@ public class Raina extends AbstractNpcAI
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "reawakenNoDual.html";
 | 
			
		||||
				}
 | 
			
		||||
				else if ((player.getAdena() < REAWAKEN_PRICE[index]) || !hasQuestItems(player, getCloakId(player)))
 | 
			
		||||
				else if ((player.getAdena() < REAWAKEN_PRICE[index]) || !ownsAtLeastOneItem(player, getCloakId(player)))
 | 
			
		||||
				{
 | 
			
		||||
					final NpcHtmlMessage html = getNpcHtmlMessage(player, npc, "reawakenNoFee.html");
 | 
			
		||||
					html.replace("%price%", REAWAKEN_PRICE[index]);
 | 
			
		||||
@@ -587,7 +587,7 @@ public class Raina extends AbstractNpcAI
 | 
			
		||||
				}
 | 
			
		||||
				
 | 
			
		||||
				final int index = player.getLevel() > 94 ? REAWAKEN_PRICE.length - 1 : player.getLevel() - 85;
 | 
			
		||||
				if ((player.getAdena() < REAWAKEN_PRICE[index]) || !hasQuestItems(player, getCloakId(player)))
 | 
			
		||||
				if ((player.getAdena() < REAWAKEN_PRICE[index]) || !ownsAtLeastOneItem(player, getCloakId(player)))
 | 
			
		||||
				{
 | 
			
		||||
					final NpcHtmlMessage html = getNpcHtmlMessage(player, npc, "reawakenNoFee.html");
 | 
			
		||||
					html.replace("%price%", REAWAKEN_PRICE[index]);
 | 
			
		||||
 
 | 
			
		||||
@@ -174,7 +174,7 @@ public class Trandon extends AbstractNpcAI
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "33490-15.html";
 | 
			
		||||
				}
 | 
			
		||||
				else if (player.isSubClassActive() || !hasQuestItems(player, SUB_CERTIFICATE))
 | 
			
		||||
				else if (player.isSubClassActive() || !ownsAtLeastOneItem(player, SUB_CERTIFICATE))
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "33490-21.html";
 | 
			
		||||
				}
 | 
			
		||||
@@ -283,7 +283,7 @@ public class Trandon extends AbstractNpcAI
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "33490-30.html";
 | 
			
		||||
				}
 | 
			
		||||
				else if (!hasQuestItems(player, DUAL_CERTIFICATE))
 | 
			
		||||
				else if (!ownsAtLeastOneItem(player, DUAL_CERTIFICATE))
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "33490-31.html";
 | 
			
		||||
				}
 | 
			
		||||
 
 | 
			
		||||
@@ -104,7 +104,7 @@ public class BirthOfDraco extends LongTimeEvent
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
			/*
 | 
			
		||||
			 * case "giveAgathion": { if (hasQuestItems(player, AGATHION)) { htmltext = "33687-03.htm"; } else { giveItems(player, AGATHION, 1); htmltext = "33687-02.htm"; } break; }
 | 
			
		||||
			 * case "giveAgathion": { if (hasQuestItemss(player, AGATHION)) { htmltext = "33687-03.htm"; } else { giveItems(player, AGATHION, 1); htmltext = "33687-02.htm"; } break; }
 | 
			
		||||
			 */
 | 
			
		||||
		}
 | 
			
		||||
		return htmltext;
 | 
			
		||||
 
 | 
			
		||||
@@ -77,7 +77,7 @@ public class CharacterBirthday extends AbstractNpcAI
 | 
			
		||||
		else if (event.equalsIgnoreCase("change"))
 | 
			
		||||
		{
 | 
			
		||||
			// Change Hat
 | 
			
		||||
			if (hasQuestItems(player, 10250))
 | 
			
		||||
			if (ownsAtLeastOneItem(player, 10250))
 | 
			
		||||
			{
 | 
			
		||||
				takeItems(player, 10250, 1); // Adventurer Hat (Event)
 | 
			
		||||
				giveItems(player, 21594, 1); // Birthday Hat
 | 
			
		||||
 
 | 
			
		||||
@@ -65,7 +65,7 @@ public class HappyHours extends LongTimeEvent
 | 
			
		||||
				{
 | 
			
		||||
					return "34262-2.htm";
 | 
			
		||||
				}
 | 
			
		||||
				if (hasQuestItems(player, SUPPLY_BOX))
 | 
			
		||||
				if (ownsAtLeastOneItem(player, SUPPLY_BOX))
 | 
			
		||||
				{
 | 
			
		||||
					return "34262-3.htm";
 | 
			
		||||
				}
 | 
			
		||||
 
 | 
			
		||||
@@ -68,7 +68,7 @@ public class LoversJubilee extends LongTimeEvent
 | 
			
		||||
		{
 | 
			
		||||
			case "50020_1":
 | 
			
		||||
			{
 | 
			
		||||
				htmtext = hasQuestItems(player, SPIRIT_TEST_REPORT) ? "4305-010.htm" : "4305-002.htm";
 | 
			
		||||
				htmtext = ownsAtLeastOneItem(player, SPIRIT_TEST_REPORT) ? "4305-010.htm" : "4305-002.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
			case "50020_2":
 | 
			
		||||
 
 | 
			
		||||
@@ -73,7 +73,7 @@ public class MasterOfEnchanting extends LongTimeEvent
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		if (event.equalsIgnoreCase("buy_staff"))
 | 
			
		||||
		{
 | 
			
		||||
			if (!hasQuestItems(player, MASTER_YOGI_STAFF) && (getQuestItemsCount(player, Inventory.ADENA_ID) > STAFF_PRICE))
 | 
			
		||||
			if (!ownsAtLeastOneItem(player, MASTER_YOGI_STAFF) && (getQuestItemsCount(player, Inventory.ADENA_ID) > STAFF_PRICE))
 | 
			
		||||
			{
 | 
			
		||||
				takeItems(player, Inventory.ADENA_ID, STAFF_PRICE);
 | 
			
		||||
				giveItems(player, MASTER_YOGI_STAFF, 1);
 | 
			
		||||
 
 | 
			
		||||
@@ -80,7 +80,7 @@ public class RudolphsBlessing extends LongTimeEvent
 | 
			
		||||
		{
 | 
			
		||||
			case "rudolph":
 | 
			
		||||
			{
 | 
			
		||||
				if (hasQuestItems(player, AGATHION_SEAL_BRACELET_RUDOLPH))
 | 
			
		||||
				if (ownsAtLeastOneItem(player, AGATHION_SEAL_BRACELET_RUDOLPH))
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "13285-05.htm";
 | 
			
		||||
				}
 | 
			
		||||
 
 | 
			
		||||
@@ -72,7 +72,7 @@ public class ThePowerOfLove extends LongTimeEvent
 | 
			
		||||
			}
 | 
			
		||||
			case "ct":
 | 
			
		||||
			{
 | 
			
		||||
				if (!hasQuestItems(player, CT) && !hasQuestItems(player, CH) && !hasQuestItems(player, CC))
 | 
			
		||||
				if (!ownsAtLeastOneItem(player, CT) && !ownsAtLeastOneItem(player, CH) && !ownsAtLeastOneItem(player, CC))
 | 
			
		||||
				{
 | 
			
		||||
					giveItems(player, CT, 1);
 | 
			
		||||
					giveItems(player, CT_TRANSORM, 1);
 | 
			
		||||
@@ -87,7 +87,7 @@ public class ThePowerOfLove extends LongTimeEvent
 | 
			
		||||
			}
 | 
			
		||||
			case "ch":
 | 
			
		||||
			{
 | 
			
		||||
				if (!hasQuestItems(player, CT) && !hasQuestItems(player, CH) && !hasQuestItems(player, CC))
 | 
			
		||||
				if (!ownsAtLeastOneItem(player, CT) && !ownsAtLeastOneItem(player, CH) && !ownsAtLeastOneItem(player, CC))
 | 
			
		||||
				{
 | 
			
		||||
					giveItems(player, CH, 1);
 | 
			
		||||
					giveItems(player, CH_TRANSORM, 1);
 | 
			
		||||
@@ -102,7 +102,7 @@ public class ThePowerOfLove extends LongTimeEvent
 | 
			
		||||
			}
 | 
			
		||||
			case "cc":
 | 
			
		||||
			{
 | 
			
		||||
				if (!hasQuestItems(player, CT) && !hasQuestItems(player, CH) && !hasQuestItems(player, CC))
 | 
			
		||||
				if (!ownsAtLeastOneItem(player, CT) && !ownsAtLeastOneItem(player, CH) && !ownsAtLeastOneItem(player, CC))
 | 
			
		||||
				{
 | 
			
		||||
					giveItems(player, CC, 1);
 | 
			
		||||
					giveItems(player, CC_TRANSORM, 1);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user