From 3bc2b6aa3e0abc95bd2412dcd9944bbb95448729 Mon Sep 17 00:00:00 2001
From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54>
Date: Sun, 14 Mar 2010 01:16:23 +0000
Subject: [PATCH] the weaponsmith in minas tiriths has things to teach

git-svn-id: http://svn.net-core.org/repos/t-engine4@413 51575b47-30f0-44d4-a5cc-537603b46e54
---
 game/engine/Map.lua                           |  3 ++
 game/engine/dialogs/Chat.lua                  | 16 +++++-----
 game/modules/tome/class/Store.lua             |  1 +
 game/modules/tome/data/autolevel_schemes.lua  |  8 +++++
 .../tome/data/chats/minas-tirith-elder.lua    |  2 +-
 .../data/chats/minas-tirith-weapon-store.lua  | 30 +++++++++++++++++++
 .../tome/data/maps/towns/minas-tirith.lua     |  2 +-
 .../tome/data/maps/wilderness/main.lua        |  2 +-
 .../tome/data/rooms/forest_clearing.lua       |  2 +-
 game/modules/tome/data/texts/intro-elf.lua    | 14 ++++-----
 game/modules/tome/data/zones/maze/npcs.lua    |  2 +-
 11 files changed, 62 insertions(+), 20 deletions(-)
 create mode 100644 game/modules/tome/data/chats/minas-tirith-weapon-store.lua

diff --git a/game/engine/Map.lua b/game/engine/Map.lua
index f470e1bc65..f28e371341 100644
--- a/game/engine/Map.lua
+++ b/game/engine/Map.lua
@@ -110,6 +110,7 @@ function _M:loaded()
 		if v ~= nil then
 			t[x + y * self.w] = v
 			self._map:setSeen(x, y, v)
+			self.changed = true
 		end
 		return t[x + y * self.w]
 	end
@@ -118,6 +119,7 @@ function _M:loaded()
 		if v ~= nil then
 			t[x + y * self.w] = v
 			self._map:setRemember(x, y, v)
+			self.changed = true
 		end
 		return t[x + y * self.w]
 	end
@@ -126,6 +128,7 @@ function _M:loaded()
 		if v ~= nil then
 			t[x + y * self.w] = v
 			self._map:setLite(x, y, v)
+			self.changed = true
 		end
 		return t[x + y * self.w]
 	end
diff --git a/game/engine/dialogs/Chat.lua b/game/engine/dialogs/Chat.lua
index 465160e221..902c99b88d 100644
--- a/game/engine/dialogs/Chat.lua
+++ b/game/engine/dialogs/Chat.lua
@@ -45,6 +45,14 @@ function _M:use()
 	self.changed = true
 
 	print("[CHAT] selected", a[1], a.action, a.jump)
+	if a.jump then
+		self.cur_id = a.jump
+		self:generateList()
+		self.sel = 1
+		self.scroll = 1
+	else
+		game:unregisterDialog(self)
+	end
 	if a.action then
 		local id = a.action(self.npc, self.player)
 		if id then
@@ -55,14 +63,6 @@ function _M:use()
 			return
 		end
 	end
-	if a.jump then
-		self.cur_id = a.jump
-		self:generateList()
-		self.sel = 1
-		self.scroll = 1
-	else
-		game:unregisterDialog(self)
-	end
 end
 
 function _M:generateList()
diff --git a/game/modules/tome/class/Store.lua b/game/modules/tome/class/Store.lua
index b5e1a6c8e1..1b878df035 100644
--- a/game/modules/tome/class/Store.lua
+++ b/game/modules/tome/class/Store.lua
@@ -40,6 +40,7 @@ function _M:onSell(who, o, item, nb)
 	local price = o:getPrice() / 10
 	if price <= 0 then return end
 	who.money = who.money + price * nb
+	o:identify(true)
 	return nb
 end
 
diff --git a/game/modules/tome/data/autolevel_schemes.lua b/game/modules/tome/data/autolevel_schemes.lua
index e3b7ae6a7d..6893679d7a 100644
--- a/game/modules/tome/data/autolevel_schemes.lua
+++ b/game/modules/tome/data/autolevel_schemes.lua
@@ -48,3 +48,11 @@ Autolevel:registerScheme{ name = "warriormage", levelup = function(self)
 		learnStats(self, { self.STAT_STR, self.STAT_STR, self.STAT_DEX })
 	end
 end}
+
+Autolevel:registerScheme{ name = "snake", levelup = function(self)
+	if self.level % 2 == 0 then
+		learnStats(self, { self.STAT_CUN, self.STAT_DEX, self.STAT_CON })
+	else
+		learnStats(self, { self.STAT_CUN, self.STAT_DEX, self.STAT_STR })
+	end
+end}
diff --git a/game/modules/tome/data/chats/minas-tirith-elder.lua b/game/modules/tome/data/chats/minas-tirith-elder.lua
index e409e588d5..807ebc8e2f 100644
--- a/game/modules/tome/data/chats/minas-tirith-elder.lua
+++ b/game/modules/tome/data/chats/minas-tirith-elder.lua
@@ -1,8 +1,8 @@
 newChat{ id="welcome",
 	text = [[Welcome @playername@ to Minas Tirith traveler, please be quick my time is precious.]],
 	answers = {
-		{"Nothing, excuse me. Bye!"},
 		{"I have found this staff in my travels, it looks really old and powerful. I dare not use it.", jump="found_staff", cond=function(npc, player) return player:isQuestStatus("staff-absorption", engine.Quest.PENDING) and player:findInAllInventories("Staff of Absorption") end},
+		{"Nothing, excuse me. Bye!"},
 	}
 }
 
diff --git a/game/modules/tome/data/chats/minas-tirith-weapon-store.lua b/game/modules/tome/data/chats/minas-tirith-weapon-store.lua
new file mode 100644
index 0000000000..73595eb037
--- /dev/null
+++ b/game/modules/tome/data/chats/minas-tirith-weapon-store.lua
@@ -0,0 +1,30 @@
+newChat{ id="welcome",
+	text = [[Welcome @playername@ to my shop.]],
+	answers = {
+		{"Let me see your wares.", action=function(npc, player)
+			npc.store:loadup(game.level, game.zone)
+			npc.store:interact(player)
+		end},
+		{"I am looking for martial training.", jump="training"},
+		{"Sorry I have to go!"},
+	}
+}
+
+newChat{ id="training",
+	text = [[I can indeed give some martial training (talent type Technique/Combat-training) for a fee of 50 gold pieces if you do not already know it.]],
+	answers = {
+		{"Please train me!", action=function(npc, player)
+			game.logPlayer(player, "The smith spends some time with you, teaching you the basics of armour and weapons usage.")
+			player.money = player.money - 50
+			player:learnTalentType("technique/combat-training", true)
+			player.changed = true
+		end, cond=function(npc, player)
+			if player.money < 50 then return end
+			if player:knowTalentType("technique/combat-training") then return end
+			return true
+		end},
+		{"No thanks."},
+	}
+}
+
+return "welcome"
diff --git a/game/modules/tome/data/maps/towns/minas-tirith.lua b/game/modules/tome/data/maps/towns/minas-tirith.lua
index ced381a08c..8b3142b668 100644
--- a/game/modules/tome/data/maps/towns/minas-tirith.lua
+++ b/game/modules/tome/data/maps/towns/minas-tirith.lua
@@ -13,7 +13,7 @@ quickEntity('^', {name='hills', display='^', color=colors.SLATE, image="terrain/
 
 quickEntity('1', {show_tooltip=true, name="Closed store", display='1', color=colors.LIGHT_UMBER, block_move=true, block_sight=true, image="terrain/wood_store_closed.png"})
 quickEntity('2', {show_tooltip=true, name="Armour Smith", display='2', color=colors.UMBER, resolvers.store("ARMOR"), image="terrain/wood_store_armor.png"})
-quickEntity('3', {show_tooltip=true, name="Weapon Smith", display='3', color=colors.UMBER, resolvers.store("WEAPON"), image="terrain/wood_store_weapon.png"})
+quickEntity('3', {show_tooltip=true, name="Weapon Smith", display='3', color=colors.UMBER, resolvers.store("WEAPON"), resolvers.chatfeature("minas-tirith-weapon-store"), image="terrain/wood_store_weapon.png"})
 quickEntity('4', {show_tooltip=true, name="Alchemist", display='4', color=colors.LIGHT_BLUE, resolvers.store("POTION"), image="terrain/wood_store_potion.png"})
 quickEntity('5', {show_tooltip=true, name="Scribe", display='5', color=colors.WHITE, resolvers.store("SCROLL"), image="terrain/wood_store_book.png"})
 quickEntity('6', {show_tooltip=true, name="Closed store", display='6', color=colors.LIGHT_UMBER, block_move=true, block_sight=true, image="terrain/wood_store_closed.png"})
diff --git a/game/modules/tome/data/maps/wilderness/main.lua b/game/modules/tome/data/maps/wilderness/main.lua
index 87e4b219b4..f0ef595a67 100644
--- a/game/modules/tome/data/maps/wilderness/main.lua
+++ b/game/modules/tome/data/maps/wilderness/main.lua
@@ -50,7 +50,7 @@ return {
 [[====.._...bbbb...._....hhhh__..........A..._.....mm..~.uuuuuu____........._........................]],
 [[=====.._..uubb..._........._......h......._Btt...mm..~6uuuuu&&&u._........._.......................]],
 [[====...__..ubbb._......hh.._.......hh...._.t^^^._mm..~..uuu&f&&&u._........._......................]],
-[[=====..._.....__......hho.-_.2....1hh......._L...mm..~..uuuuuuuuu._........_.......................]],
+[[=====..._.....__......hho.-_......1hh......._L...mm..~..uuuuuuuuu._........_.......................]],
 [[======..==..=__....h....h..._.hh..ih....._..^^^._m...~..uuuuuuuuuu._........_......................]],
 [[=============.....hhh......._.vvD.h......_.._.._mmm...~..uuuuuuuuu.._........_....................t]],
 [[======........bb...h........._vvv.hh...._.._...mm.....~..uuuuuuuu...._......_....................tt]],
diff --git a/game/modules/tome/data/rooms/forest_clearing.lua b/game/modules/tome/data/rooms/forest_clearing.lua
index 6fc9062184..2d72044dd2 100644
--- a/game/modules/tome/data/rooms/forest_clearing.lua
+++ b/game/modules/tome/data/rooms/forest_clearing.lua
@@ -11,7 +11,7 @@ return function(gen, id)
 		for i = 1, self.w do
 			for j = 1, self.h do
 				if hm.hmap[i][j] >= Heightmap.max * 5 / 6 then
-					gen.map.room_map[i-1+x][j-1+y].can_open = true
+--					gen.map.room_map[i-1+x][j-1+y].can_open = true
 					gen.map(i-1+x, j-1+y, Map.TERRAIN, gen.grid_list[gen:resolve('#')])
 				else
 					gen.map.room_map[i-1+x][j-1+y].room = id
diff --git a/game/modules/tome/data/texts/intro-elf.lua b/game/modules/tome/data/texts/intro-elf.lua
index 8a00fa7e24..6d6de06ab8 100644
--- a/game/modules/tome/data/texts/intro-elf.lua
+++ b/game/modules/tome/data/texts/intro-elf.lua
@@ -1,12 +1,12 @@
 return [[Welcome #LIGHT_GREEN#]]..name..[[#WHITE#.
-You are an elf, the first-born. Many of your kind having gone weary of Middle-earth and left for the immortal lands.
-Yet some elves do no wish to leave this land they fought so hard for. In the Mirkwood forest, now called Eryn Lasgalen, the kingdom of Thranduil still thrives.
-You lived a peaceful life deep in the forest for many hundred years but lately you have grown restless and decided to step into the world.
+You are an elf, one of the first born. Many of your kind, having grown weary of Middle Earth, have left for the immortal lands.
+Yet some elves do not wish to leave this land they fought so hard for. In Mirkwood Forest, now called Eryn Lasgalen, the kingdom of Thranduil still thrives.
+You lived a peaceful life deep in the forest for many years but lately you have grown restless and have decided to step into the world.
 
-You have decided to venture into the old and wild places of the world, looking for treasures of old and glory.
+You have decided to venture into the old and wild places looking for ancient treasures and glory.
 
-You have come to a land called Rhudaur, on the western steppes of the Misty Mountains, far away from your home, in search of the ruined tower of Amon Sûl. You heard the caves below were infested by vermin and undeads.
-Nearby to the east also lies the Trollshaws and other dangerous place, an old forest infested with trolls and all kinds of wild animals.
+You have come to a land called Rhudaur on the western side of the Misty Mountains, far away from your home in search of the ruined tower of Amon Sul. You have heard that the caverns below are infested with vermin and undead.
+Close by, to the east are the Trollshaws another dangerous place - an old forest infested with trolls and other dangerous animals.
 
-After days of travels you have found the ruined tower and entered the caves, what will you find there...
+After days of travel you have found the tower and are about to enter the caves. What will you discover...
 ]]
diff --git a/game/modules/tome/data/zones/maze/npcs.lua b/game/modules/tome/data/zones/maze/npcs.lua
index 36d6da048f..91343f66d7 100644
--- a/game/modules/tome/data/zones/maze/npcs.lua
+++ b/game/modules/tome/data/zones/maze/npcs.lua
@@ -21,7 +21,7 @@ newEntity{ define_as = "MINOTAUR_MAZE",
 	max_stamina = 200,
 	stats = { str=25, dex=10, cun=8, mag=20, wil=20, con=20 },
 
-	body = { INVEN = 10, MAINHAND=1, OFFHAND=1, BODY=1 },
+	body = { INVEN = 10, MAINHAND=1, OFFHAND=1, BODY=1, HEAD=1, },
 	equipment = resolvers.equip{
 		{type="weapon", subtype="battleaxe"},
 		{type="armor", subtype="head", defined="HELM_OF_HAMMERHAND"},
-- 
GitLab