From 02b08cc93297fa5b38c5ecb97223950a66be0b2a Mon Sep 17 00:00:00 2001
From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54>
Date: Mon, 8 Mar 2010 16:51:11 +0000
Subject: [PATCH] into texts

git-svn-id: http://svn.net-core.org/repos/t-engine4@381 51575b47-30f0-44d4-a5cc-537603b46e54
---
 game/modules/tome/class/Game.lua              |  6 ++-
 game/modules/tome/class/Player.lua            |  6 +--
 game/modules/tome/data/birth/races/dwarf.lua  |  1 +
 game/modules/tome/data/birth/races/elf.lua    |  1 +
 game/modules/tome/data/birth/races/hobbit.lua | 47 ++++---------------
 game/modules/tome/data/birth/races/human.lua  |  9 ++--
 .../tome/data/texts/intro-bree-man.lua        |  9 ++++
 .../modules/tome/data/texts/intro-dunadan.lua |  9 ++++
 game/modules/tome/data/texts/intro-dwarf.lua  | 11 +++++
 game/modules/tome/data/texts/intro-elf.lua    | 12 +++++
 game/modules/tome/data/texts/intro-hobbit.lua | 10 ++++
 .../tome/dialogs/LevelupStatsDialog.lua       |  4 +-
 .../tome/dialogs/LevelupTalentsDialog.lua     |  4 +-
 13 files changed, 78 insertions(+), 51 deletions(-)
 create mode 100644 game/modules/tome/data/texts/intro-bree-man.lua
 create mode 100644 game/modules/tome/data/texts/intro-dunadan.lua
 create mode 100644 game/modules/tome/data/texts/intro-dwarf.lua
 create mode 100644 game/modules/tome/data/texts/intro-elf.lua
 create mode 100644 game/modules/tome/data/texts/intro-hobbit.lua

diff --git a/game/modules/tome/class/Game.lua b/game/modules/tome/class/Game.lua
index f193d2dcc0..7fcdaa54fe 100644
--- a/game/modules/tome/class/Game.lua
+++ b/game/modules/tome/class/Game.lua
@@ -90,8 +90,10 @@ function _M:newGame()
 		self:changeLevel(1, self.player.starting_zone)
 		self.player:resolve()
 		self.player:resolve(nil, true)
-		self.player:playerLevelup()
-		self.player:grantQuest(self.player.starting_quest)
+		self.player:playerLevelup(function()
+			self.player:grantQuest(self.player.starting_quest)
+			self:registerDialog(require("mod.dialogs.IntroDialog").new(self.player))
+		end)
 	end)
 	self:registerDialog(birth)
 end
diff --git a/game/modules/tome/class/Player.lua b/game/modules/tome/class/Player.lua
index ffa0df04cc..c30b83f453 100644
--- a/game/modules/tome/class/Player.lua
+++ b/game/modules/tome/class/Player.lua
@@ -289,12 +289,12 @@ function _M:playerUseItem(object, item)
 	)
 end
 
-function _M:playerLevelup()
+function _M:playerLevelup(on_finish)
 	if self.unused_stats > 0 then
-		local ds = LevelupStatsDialog.new(self)
+		local ds = LevelupStatsDialog.new(self, on_finish)
 		game:registerDialog(ds)
 	else
-		local dt = LevelupTalentsDialog.new(self)
+		local dt = LevelupTalentsDialog.new(self, on_finish)
 		game:registerDialog(dt)
 	end
 end
diff --git a/game/modules/tome/data/birth/races/dwarf.lua b/game/modules/tome/data/birth/races/dwarf.lua
index a9d367cb03..49f180fa03 100644
--- a/game/modules/tome/data/birth/races/dwarf.lua
+++ b/game/modules/tome/data/birth/races/dwarf.lua
@@ -31,6 +31,7 @@ newBirthDescriptor{
 		default_wilderness = {"wilderness/main", 39, 19},
 		starting_zone = "tower-amon-sul",
 		starting_quest = "start-dunadan",
+		starting_intro = "dwarf",
 		life_rating=12,
 	},
 	experience = 1.1,
diff --git a/game/modules/tome/data/birth/races/elf.lua b/game/modules/tome/data/birth/races/elf.lua
index 167da5edea..995a14c517 100644
--- a/game/modules/tome/data/birth/races/elf.lua
+++ b/game/modules/tome/data/birth/races/elf.lua
@@ -26,6 +26,7 @@ newBirthDescriptor{
 		default_wilderness = {"wilderness/main", 39, 19},
 		starting_zone = "tower-amon-sul",
 		starting_quest = "start-dunadan",
+		starting_intro = "elf",
 	},
 	experience = 1.05,
 }
diff --git a/game/modules/tome/data/birth/races/hobbit.lua b/game/modules/tome/data/birth/races/hobbit.lua
index 20c0c2aef4..7d389f9c9a 100644
--- a/game/modules/tome/data/birth/races/hobbit.lua
+++ b/game/modules/tome/data/birth/races/hobbit.lua
@@ -5,29 +5,16 @@ newBirthDescriptor{
 	type = "race",
 	name = "Hobbit",
 	desc = {
-		"Hobbits, or halflings, are very good at ranged combat ",
-		"(especially with slings), throwing, and have good saving ",
-		"throws. They also are very good at searching, disarming, ",
-		"perception and stealth; so they make excellent rogues, but ",
-		"prefer to be called burglars.  They are much weaker than ",
-		"humans, thus not as good at melee fighting, and also not ",
-		"capable of carrying as many objects.  Halflings have fair ",
-		"infra-vision, so they can detect warm creatures at a ",
-		"distance. Hobbits have their dexterity sustained and in time ",
-		"they learn to cook a delicious meal from available ",
-		"ingredients.  Their sturdy constitutions also allow them to ",
-		"resist the insidious poison of the ring-wraiths.  Their feet ",
-		"are cover from the ankle down in brown hairy fur, preventing ",
-		"them from wearing boots and shoes. ",
+		"Hobbits, or halflings, are a race of very short stature, rarely exceeded four feet in height.",
+		"Most of them are happy to live a quiet life farming and gardening, but a few get an adventurous heart.",
+		"Hobbits are agile, lucky and resilient but lack in strength.",
 	},
 	descriptor_choices =
 	{
 		subrace =
 		{
 			__ALL__ = "never",
-			Harfoot = "allow",
-			Stoor = "allow",
-			Fallohide = "allow",
+			Hobbit = "allow",
 		},
 	},
 	stats = { str=-3, dex=3, con=1, cun=3, lck=5, },
@@ -41,6 +28,7 @@ newBirthDescriptor{
 		default_wilderness = {"wilderness/main", 39, 19},
 		starting_zone = "tower-amon-sul",
 		starting_quest = "start-dunadan",
+		starting_intro = "hobbit",
 	},
 }
 
@@ -50,27 +38,10 @@ newBirthDescriptor{
 newBirthDescriptor
 {
 	type = "subrace",
-	name = "Harfoot",
-	desc = {
-		"An old but quiet race related to humans.",
-		"They are small and quite weak but good at many things.",
-	},
-}
-newBirthDescriptor
-{
-	type = "subrace",
-	name = "Fallohide",
-	desc = {
-		"An old but quiet race related to humans.",
-		"They are small and quite weak but good at many things.",
-	},
-}
-newBirthDescriptor
-{
-	type = "subrace",
-	name = "Stoor",
+	name = "Hobbit",
 	desc = {
-		"An old but quiet race related to humans.",
-		"They are small and quite weak but good at many things.",
+		"Hobbits, or halflings, are a race of very short stature, rarely exceeded four feet in height.",
+		"Most of them are happy to live a quiet life farming and gardening, but a few get an adventurous heart.",
+		"Hobbits are agile, lucky and resilient but lack in strength.",
 	},
 }
diff --git a/game/modules/tome/data/birth/races/human.lua b/game/modules/tome/data/birth/races/human.lua
index df2f25cfbb..1ef7070376 100644
--- a/game/modules/tome/data/birth/races/human.lua
+++ b/game/modules/tome/data/birth/races/human.lua
@@ -12,7 +12,7 @@ newBirthDescriptor{
 		subrace =
 		{
 			["Bree-man"] = "allow",
-			Dunadan = "allow",
+			["Dúnadan"] = "allow",
 			Rohirrim = "allow",
 			Beorning = "allow",
 			__ALL__ = "never",
@@ -39,16 +39,16 @@ newBirthDescriptor
 		default_wilderness = {"wilderness/main", 39, 19},
 		starting_zone = "tower-amon-sul",
 		starting_quest = "start-dunadan",
+		starting_intro = "bree-man",
 	},
 }
 
 newBirthDescriptor
 {
 	type = "subrace",
-	name = "Dunadan",
+	name = "Dúnadan",
 	desc = {
-		"The greatest of the Edain, humans in all respects but",
-		"stronger, smarter and wiser.",
+		"The greatest of the Edain, humans in all respects but stronger, smarter and wiser.",
 		"They posses the Gift of Kings which allows them to regenerate their wounds once in a while.",
 	},
 	stats = { str=1, cun=1, dex=1, wil=1 },
@@ -61,6 +61,7 @@ newBirthDescriptor
 		default_wilderness = {"wilderness/main", 39, 19},
 		starting_zone = "tower-amon-sul",
 		starting_quest = "start-dunadan",
+		starting_intro = "dunadan",
 	},
 }
 --[[
diff --git a/game/modules/tome/data/texts/intro-bree-man.lua b/game/modules/tome/data/texts/intro-bree-man.lua
new file mode 100644
index 0000000000..11c1a0e747
--- /dev/null
+++ b/game/modules/tome/data/texts/intro-bree-man.lua
@@ -0,0 +1,9 @@
+return [[Welcome #LIGHT_GREEN#]]..name..[[#WHITE#.
+You are a native of the town of Bree, a multicultural town that both men and hobbits call home.
+Humans are the most common race of the land, and you are part of them. In an attempt to prove your worth you have decided to venture into the old and wild places of the world, looking for treasures of old and glory.
+
+You have come to a land called Rhudaur, just east of Bree, 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.
+
+After days of travels you have found the ruined tower and entered the caves, what will you find there...
+]]
diff --git a/game/modules/tome/data/texts/intro-dunadan.lua b/game/modules/tome/data/texts/intro-dunadan.lua
new file mode 100644
index 0000000000..80f49f860c
--- /dev/null
+++ b/game/modules/tome/data/texts/intro-dunadan.lua
@@ -0,0 +1,9 @@
+return [[Welcome #LIGHT_GREEN#]]..name..[[#WHITE#.
+You are a Dúnedain, one of the last descendant of the pround men of Númenor.
+Hailing from a great line of greater men you have decided to prove your worth by venturing into the old and wild places of the world, looking for treasures of old and glory.
+
+You have come to a northern land called Rhudaur, on the western steppes of the Misty Mountains 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.
+
+After days of travels you have found the ruined tower and entered the caves, what will you find there...
+]]
diff --git a/game/modules/tome/data/texts/intro-dwarf.lua b/game/modules/tome/data/texts/intro-dwarf.lua
new file mode 100644
index 0000000000..a354c5ef07
--- /dev/null
+++ b/game/modules/tome/data/texts/intro-dwarf.lua
@@ -0,0 +1,11 @@
+return [[Welcome #LIGHT_GREEN#]]..name..[[#WHITE#.
+You are a member of the pround race of the Dwarves.
+Hailing from the dwarven kingdom under the Lonely Mountain you have decided to take the road and start a new life of aventuring.
+
+You have decided to venture into the old and wild places of the world, looking for treasures of old 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.
+
+After days of travels you have found the ruined tower and entered the caves, what will you find there...
+]]
diff --git a/game/modules/tome/data/texts/intro-elf.lua b/game/modules/tome/data/texts/intro-elf.lua
new file mode 100644
index 0000000000..8a00fa7e24
--- /dev/null
+++ b/game/modules/tome/data/texts/intro-elf.lua
@@ -0,0 +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 have decided to venture into the old and wild places of the world, looking for treasures of old 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.
+
+After days of travels you have found the ruined tower and entered the caves, what will you find there...
+]]
diff --git a/game/modules/tome/data/texts/intro-hobbit.lua b/game/modules/tome/data/texts/intro-hobbit.lua
new file mode 100644
index 0000000000..21d2d3dc86
--- /dev/null
+++ b/game/modules/tome/data/texts/intro-hobbit.lua
@@ -0,0 +1,10 @@
+return [[Welcome #LIGHT_GREEN#]]..name..[[#WHITE#.
+You are a hobbit of the Shire. Most hobbits never leave the borders of their beloved Shire, even in this time of peace. Few know about the distant lands and fewer yet are willing to venture there.
+
+You are one of those rare few, inpired by the stories of dragons, gold and treasures of Bilbo nearly two hundred years before, you have decided to venture into the old and wild places of the world, looking for treasures of old and glory.
+
+You have come to a land called Rhudaur, east of the Shire, 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.
+
+After days of travels you have found the ruined tower and entered the caves, what will you find there...
+]]
diff --git a/game/modules/tome/dialogs/LevelupStatsDialog.lua b/game/modules/tome/dialogs/LevelupStatsDialog.lua
index 3bcc446aea..dcecf9b36e 100644
--- a/game/modules/tome/dialogs/LevelupStatsDialog.lua
+++ b/game/modules/tome/dialogs/LevelupStatsDialog.lua
@@ -4,7 +4,7 @@ local LevelupTalentsDialog = require "mod.dialogs.LevelupTalentsDialog"
 
 module(..., package.seeall, class.inherit(engine.Dialog))
 
-function _M:init(actor)
+function _M:init(actor, on_finish)
 	self.actor = actor
 	self.actor_dup = actor:clone()
 	engine.Dialog.init(self, "Stats Levelup: "..actor.name, 500, 300)
@@ -22,7 +22,7 @@ function _M:init(actor)
 
 			-- if talents to spend, do it now
 			if self.actor.unused_talents > 0 or self.actor.unused_talents_types > 0 then
-				local dt = LevelupTalentsDialog.new(self.actor)
+				local dt = LevelupTalentsDialog.new(self.actor, on_finish)
 				game:registerDialog(dt)
 			end
 		end,
diff --git a/game/modules/tome/dialogs/LevelupTalentsDialog.lua b/game/modules/tome/dialogs/LevelupTalentsDialog.lua
index 34c0f5ef23..878a72ca11 100644
--- a/game/modules/tome/dialogs/LevelupTalentsDialog.lua
+++ b/game/modules/tome/dialogs/LevelupTalentsDialog.lua
@@ -3,7 +3,7 @@ require "engine.Dialog"
 
 module(..., package.seeall, class.inherit(engine.Dialog))
 
-function _M:init(actor)
+function _M:init(actor, on_finish)
 	self.actor = actor
 	self.actor_dup = actor:clone()
 	engine.Dialog.init(self, "Talents Levelup: "..actor.name, 800, 600)
@@ -20,7 +20,7 @@ function _M:init(actor)
 		MOVE_LEFT = function() self:learn(false) self.changed = true end,
 		MOVE_RIGHT = function() self:learn(true) self.changed = true end,
 		ACCEPT = "EXIT",
-		EXIT = function() game:unregisterDialog(self) end,
+		EXIT = function() game:unregisterDialog(self) if on_finish then on_finish() end end,
 	})
 	self:mouseZones{
 		{ x=2, y=45, w=350, h=self.font_h*self.max, fct=function(button, x, y, xrel, yrel, tx, ty)
-- 
GitLab