From bb5558ddb5ebb4fd6a4026e1fe0ff2f24505f9f1 Mon Sep 17 00:00:00 2001
From: St3eT <St3eT@users.noreply.github.com>
Date: Sat, 14 Jun 2014 09:16:29 +0000
Subject: [PATCH] BETA: Fixed/reworked '''Budenka''' AI. * Reported by: maneco2

---
 .../dist/game/data/html/default/32294.htm     |  8 ----
 .../AI/NPC/Budenka/32294-premium.htm          |  3 --
 .../AI/NPC/Budenka/32294-standart.htm         |  3 --
 .../hellbound/AI/NPC/Budenka/Budenka-01.html  |  8 ++++
 .../hellbound/AI/NPC/Budenka/Budenka-02.html} |  0
 .../hellbound/AI/NPC/Budenka/Budenka-03.html} |  0
 .../hellbound/AI/NPC/Budenka/Budenka-04.html} |  2 +-
 .../hellbound/AI/NPC/Budenka/Budenka-05.html} |  0
 .../hellbound/AI/NPC/Budenka/Budenka-06.html  |  3 ++
 .../hellbound/AI/NPC/Budenka/Budenka-07.html  |  3 ++
 .../hellbound/AI/NPC/Budenka/Budenka.java     | 39 ++++++++++++++++---
 11 files changed, 48 insertions(+), 21 deletions(-)
 delete mode 100644 L2J_DataPack_BETA/dist/game/data/html/default/32294.htm
 delete mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/32294-premium.htm
 delete mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/32294-standart.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/Budenka-01.html
 rename L2J_DataPack_BETA/dist/game/data/{html/default/32294-1.htm => scripts/hellbound/AI/NPC/Budenka/Budenka-02.html} (100%)
 rename L2J_DataPack_BETA/dist/game/data/{html/default/32294-2.htm => scripts/hellbound/AI/NPC/Budenka/Budenka-03.html} (100%)
 rename L2J_DataPack_BETA/dist/game/data/{html/default/32294-3.htm => scripts/hellbound/AI/NPC/Budenka/Budenka-04.html} (81%)
 rename L2J_DataPack_BETA/dist/game/data/{html/default/32294-4.htm => scripts/hellbound/AI/NPC/Budenka/Budenka-05.html} (100%)
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/Budenka-06.html
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/Budenka-07.html

diff --git a/L2J_DataPack_BETA/dist/game/data/html/default/32294.htm b/L2J_DataPack_BETA/dist/game/data/html/default/32294.htm
deleted file mode 100644
index dea1a3d1bb..0000000000
--- a/L2J_DataPack_BETA/dist/game/data/html/default/32294.htm
+++ /dev/null
@@ -1,8 +0,0 @@
-<html><body>Budenka:<br>
-Oh... From your appearance, I can see that you have crossed the Great Sea to come here.<br>
-<a action="bypass -h npc_%objectId%_Chat 1">Ask who he is.</a><br>
-<a action="bypass -h npc_%objectId%_Chat 2">Ask if he knows Jirrone.</a><br>
-<a action="bypass -h npc_%objectId%_Chat 3">Ask if he knows Beleth.</a><br>
-<a action="bypass -h npc_%objectId%_Chat 4">Ask if he knows Bernarde.</a><br>
-<a action="bypass -h npc_%objectId%_Quest">Quest.</a>
-</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/32294-premium.htm b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/32294-premium.htm
deleted file mode 100644
index 3278cc9cfa..0000000000
--- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/32294-premium.htm
+++ /dev/null
@@ -1,3 +0,0 @@
-<html><body>Budenka:<br>
-Well, you already have enough high reputation in Guild. How are you?
-</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/32294-standart.htm b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/32294-standart.htm
deleted file mode 100644
index 9272af8500..0000000000
--- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/32294-standart.htm
+++ /dev/null
@@ -1,3 +0,0 @@
-<html><body>Budenka:<br>
-Oh, it's you?! I heard about you from Guild. Did you analyze that, Bernard is engaged in what, to give the estimation?
-</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/Budenka-01.html b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/Budenka-01.html
new file mode 100644
index 0000000000..7ae77a167d
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/Budenka-01.html
@@ -0,0 +1,8 @@
+<html><body>Budenka:<br>
+Oh... From your appearance, I can see that you have crossed the Great Sea to come here.<br>
+<a action="bypass -h Quest Budenka Budenka-02.html">Ask who he is.</a><br>
+<a action="bypass -h Quest Budenka Budenka-03.html">Ask if he knows Jirrone.</a><br>
+<a action="bypass -h Quest Budenka Budenka-04.html">Ask if he knows Beleth.</a><br>
+<a action="bypass -h Quest Budenka Budenka-05.html">Ask if he knows Bernarde.</a><br>
+<a action="bypass -h npc_%objectId%_Quest">Quest.</a>
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/html/default/32294-1.htm b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/Budenka-02.html
similarity index 100%
rename from L2J_DataPack_BETA/dist/game/data/html/default/32294-1.htm
rename to L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/Budenka-02.html
diff --git a/L2J_DataPack_BETA/dist/game/data/html/default/32294-2.htm b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/Budenka-03.html
similarity index 100%
rename from L2J_DataPack_BETA/dist/game/data/html/default/32294-2.htm
rename to L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/Budenka-03.html
diff --git a/L2J_DataPack_BETA/dist/game/data/html/default/32294-3.htm b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/Budenka-04.html
similarity index 81%
rename from L2J_DataPack_BETA/dist/game/data/html/default/32294-3.htm
rename to L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/Budenka-04.html
index 57405202d6..f347e3f80a 100644
--- a/L2J_DataPack_BETA/dist/game/data/html/default/32294-3.htm
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/Budenka-04.html
@@ -1,3 +1,3 @@
 <html><body>Budenka:<br>
-Who is Beleth, you ask? Only the master of this island! Sure, it's rumored that he is actually a Demon, but as long as he rules fairly and well, I say "Who cares?" 
+Who is Beleth, you ask? Only the master of this island! Sure, it's rumored that he is actually a Demon, but as long as he rules fairly and well, I say "Who cares?"
 </body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/html/default/32294-4.htm b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/Budenka-05.html
similarity index 100%
rename from L2J_DataPack_BETA/dist/game/data/html/default/32294-4.htm
rename to L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/Budenka-05.html
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/Budenka-06.html b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/Budenka-06.html
new file mode 100644
index 0000000000..0d6cc9914a
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/Budenka-06.html
@@ -0,0 +1,3 @@
+<html><body>Budenka:<br>
+Oh, it's you! I heard about you from the Guild. Did you see Bernarde's business through to a fit conclusion?
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/Budenka-07.html b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/Budenka-07.html
new file mode 100644
index 0000000000..a0e9d69ff4
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/Budenka-07.html
@@ -0,0 +1,3 @@
+<html><body>Budenka:<br>
+Eh, you have a pretty lofty reputation in the Guild already. How are you?
+</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/Budenka.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/Budenka.java
index 502018bb73..cf55da87fd 100644
--- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/Budenka.java
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/Budenka.java
@@ -25,31 +25,58 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 
 /**
  * Budenka AI.
+ * @author St3eT
  */
 public final class Budenka extends AbstractNpcAI
 {
+	// NPCs
 	private static final int BUDENKA = 32294;
+	// Items
 	private static final int STANDART_CERT = 9851;
 	private static final int PREMIUM_CERT = 9852;
 	
 	public Budenka()
 	{
 		super(Budenka.class.getSimpleName(), "hellbound/AI/NPC");
+		addStartNpc(BUDENKA);
 		addFirstTalkId(BUDENKA);
+		addTalkId(BUDENKA);
+	}
+	
+	@Override
+	public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
+	{
+		String htmltext = null;
+		switch (event)
+		{
+			case "Budenka-02.html":
+			case "Budenka-03.html":
+			case "Budenka-04.html":
+			case "Budenka-05.html":
+			{
+				htmltext = event;
+				break;
+			}
+		}
+		return htmltext;
 	}
 	
 	@Override
 	public final String onFirstTalk(L2Npc npc, L2PcInstance player)
 	{
-		if (hasAtLeastOneQuestItem(player, PREMIUM_CERT))
+		String htmltext = null;
+		if (hasQuestItems(player, STANDART_CERT, PREMIUM_CERT))
+		{
+			htmltext = "Budenka-07.html";
+		}
+		else if (hasQuestItems(player, STANDART_CERT))
 		{
-			return "32294-premium.htm";
+			htmltext = "Budenka-06.html";
 		}
-		else if (hasAtLeastOneQuestItem(player, STANDART_CERT))
+		else
 		{
-			return "32294-standart.htm";
+			htmltext = "Budenka-01.html";
 		}
-		npc.showChatWindow(player);
-		return super.onFirstTalk(npc, player);
+		return htmltext;
 	}
 }
\ No newline at end of file
-- 
GitLab