From 090ade8c99ff06576445e4efe8cc914fdffe69ca Mon Sep 17 00:00:00 2001
From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54>
Date: Sun, 19 Feb 2012 23:12:15 +0000
Subject: [PATCH] Mage apprentice quest changed, he wont collect rings/..
 anymore, he just needs one arcane powered artifact

git-svn-id: http://svn.net-core.org/repos/t-engine4@4894 51575b47-30f0-44d4-a5cc-537603b46e54
---
 .../tome/data/chats/mage-apprentice-quest.lua | 11 ++--
 .../tome/data/quests/mage-apprentice.lua      | 52 ++-----------------
 2 files changed, 8 insertions(+), 55 deletions(-)

diff --git a/game/modules/tome/data/chats/mage-apprentice-quest.lua b/game/modules/tome/data/chats/mage-apprentice-quest.lua
index 74f09a1e78..50fc7d7e92 100644
--- a/game/modules/tome/data/chats/mage-apprentice-quest.lua
+++ b/game/modules/tome/data/chats/mage-apprentice-quest.lua
@@ -38,12 +38,7 @@ newChat{ id="welcome",
 Good day to you, fellow traveler!]],
 	answers = {
 		{"What brings an apprentice mage out into the wilds?", jump="quest", cond=function(npc, player) return not player:hasQuest("mage-apprentice") end},
-		{"I have something for you!",
-			jump="welcome",
-			cond=function(npc, player) return player:hasQuest("mage-apprentice") and player:hasQuest("mage-apprentice"):can_offer(player) end,
-			action=function(npc, player, dialog) player:hasQuest("mage-apprentice"):collect_staff(npc, player, dialog) end
-		},
-		{"I found this artefact; it looks powerful. Maybe it would be enough?",
+		{"I found this artefact; it looks powerful and arcane infused. Maybe it would be enough?",
 			jump="unique",
 			cond=function(npc, player) return player:hasQuest("mage-apprentice") and player:hasQuest("mage-apprentice"):can_offer_unique(player) end,
 			action=function(npc, player, dialog) player:hasQuest("mage-apprentice"):collect_staff_unique(npc, player, dialog) end
@@ -81,7 +76,7 @@ I am a novice mage, as you might have noticed, and my goal is to be accepted by
 }
 newChat{ id="quest3",
 	text = [[The keepers of ar... err, I do not think I am supposed to talk about them... sorry, my friend...
-In any case, I must collect 10 magic staves, rings or amulets, and I have yet to find one. I would be grateful if you could bring me some should you find any!]],
+In any case, I must collect many items. I have some already but I am still looking for an arcane-infused artefact. You do not happen to have one I imagine... Well if you do, tell me please!]],
 	answers = {
 		{"I will keep that in mind!", action=function(npc, player) player:grantQuest("mage-apprentice") end},
 		{"No way, bye!"},
@@ -89,7 +84,7 @@ In any case, I must collect 10 magic staves, rings or amulets, and I have yet to
 }
 newChat{ id="quest3_mage",
 	text = [[I hope I will too ...
-In any case, I must collect 10 magic staves, rings or amulets and I have yet to find one. I would be grateful if you could bring me some should you find any!]],
+In any case, I must collect many items. I have some already but I am still looking for an arcane-infused artefact. You do not happen to have one I imagine... Well if you do, tell me please!]],
 	answers = {
 		{"I will keep that in mind!", action=function(npc, player) player:grantQuest("mage-apprentice") end},
 		{"No way, bye!"},
diff --git a/game/modules/tome/data/quests/mage-apprentice.lua b/game/modules/tome/data/quests/mage-apprentice.lua
index 5bf9bad07e..ca8434d400 100644
--- a/game/modules/tome/data/quests/mage-apprentice.lua
+++ b/game/modules/tome/data/quests/mage-apprentice.lua
@@ -41,47 +41,9 @@ on_status_change = function(self, who, status, sub)
 	end
 end
 
-collect_staff = function(self, npc, who, dialog)
-	who:showInventory("Offer which item?", who:getInven("INVEN"),
-		function(o) return
-			(
-				(o.type == "weapon" and o.subtype == "staff") or
-				(o.type == "jewelry" and o.subtype == "ring") or
-				(o.type == "jewelry" and o.subtype == "amulet")
-			) and not o.unique
-		end,
-		function(o, item)
-			self.nb_collect = self.nb_collect + 1
-			if self.nb_collect >= 10 then who:setQuestStatus(self, self.COMPLETED) end
-			who:removeObject(who:getInven("INVEN"), item)
-			game.log("You have no more %s", o:getName{no_count=true, do_color=true})
-			who:sortInven(who:getInven(inven))
-			dialog.next_dialog:regen()
-			return true
-		end
-	)
-end
-
-can_offer = function(self, who)
-	if self.nb_collect >= 10 then return end
-	if not who:getInven("INVEN") then return end
-
-	for item, o in ipairs(who:getInven("INVEN")) do
-		if (
-			(o.type == "weapon" and o.subtype == "staff") or
-			(o.type == "jewelry" and o.subtype == "ring") or
-			(o.type == "jewelry" and o.subtype == "amulet")
-		) and not o.unique then return true end
-	end
-end
-
 collect_staff_unique = function(self, npc, who, dialog)
 	who:showInventory("Offer which item?", who:getInven("INVEN"),
-		function(o) return (
-				(o.type == "weapon" and o.subtype == "staff") or
-				(o.type == "jewelry" and o.subtype == "ring") or
-				(o.type == "jewelry" and o.subtype == "amulet")
-			) and o.unique
+		function(o) return o.power_source and o.power_source.arcane and o.unique
 		end,
 		function(o, item)
 			-- Special handling for the staff of absorption
@@ -95,8 +57,8 @@ collect_staff_unique = function(self, npc, who, dialog)
 				return true
 			end
 
-			self.nb_collect = self.nb_collect + 10
-			if self.nb_collect >= 10 then who:setQuestStatus(self, self.COMPLETED) end
+			self.nb_collect = self.nb_collect + 1
+			if self.nb_collect >= 1 then who:setQuestStatus(self, self.COMPLETED) end
 			who:removeObject(who:getInven("INVEN"), item)
 			game.log("You have no more %s", o:getName{no_count=true, do_color=true})
 			who:sortInven(who:getInven(inven))
@@ -107,15 +69,11 @@ collect_staff_unique = function(self, npc, who, dialog)
 end
 
 can_offer_unique = function(self, who)
-	if self.nb_collect >= 10 then return end
+	if self.nb_collect >= 1 then return end
 	if not who:getInven("INVEN") then return end
 
 	for item, o in ipairs(who:getInven("INVEN")) do
-		if (
-			(o.type == "weapon" and o.subtype == "staff") or
-			(o.type == "jewelry" and o.subtype == "ring") or
-			(o.type == "jewelry" and o.subtype == "amulet")
-		) and o.unique then return true end
+		if o.power_source and o.power_source.arcane and o.unique then return true end
 	end
 end
 
-- 
GitLab