summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2012-06-08 19:40:49 +0200
committerBardur Arantsson <bardur@scientician.net>2012-06-08 19:40:49 +0200
commit3e79a19e687364bf7022ca91ee02978e504093fd (patch)
tree9bd1f601a5ada92c46068156a9e9d872e00f5bca
parent4abf66423998e520ea81b6b4e7544a21e313d36b (diff)
Lua: Move level-triggered help to C
-rw-r--r--lib/mods/theme/scpt/help.lua24
-rw-r--r--lib/scpt/help.lua24
-rw-r--r--src/help.c30
3 files changed, 29 insertions, 49 deletions
diff --git a/lib/mods/theme/scpt/help.lua b/lib/mods/theme/scpt/help.lua
index 0773e879..d827e5dc 100644
--- a/lib/mods/theme/scpt/help.lua
+++ b/lib/mods/theme/scpt/help.lua
@@ -8,18 +8,6 @@
ingame_help
{
- ["hook"] = HOOK_PLAYER_LEVEL,
- ["event"] = function(y, x) if player.lev > 1 then return TRUE end end,
- ["desc"] =
- {
- "Ok, so you now gained a level, and you have skill points to spend.",
- "To do so simply press G to learn skills. Reading the documentation",
- "about skills and abilities is also strongly recommended.",
- }
-}
-
-ingame_help
-{
["callback"] = "monster_chat",
["desc"] =
{
@@ -260,15 +248,3 @@ ingame_help
"and select the switch melee type option.",
}
}
-
-ingame_help
-{
- ["hook"] = HOOK_PLAYER_LEVEL,
- ["event"] = function(y, x) if player.lev >= 20 then return TRUE end end,
- ["desc"] =
- {
- "I see you are now at least level 20. Nice! If you want to gloat about your",
- "character you could press 'C' then 'f' to make a character dump and post it to",
- "http://angband.oook.cz/ where it will end up in the ladder.",
- }
-}
diff --git a/lib/scpt/help.lua b/lib/scpt/help.lua
index e6bb6a34..bbda148d 100644
--- a/lib/scpt/help.lua
+++ b/lib/scpt/help.lua
@@ -8,18 +8,6 @@
ingame_help
{
- ["hook"] = HOOK_PLAYER_LEVEL,
- ["event"] = function(y, x) if player.lev > 1 then return TRUE end end,
- ["desc"] =
- {
- "Ok, so you now gained a level, and you have skill points to spend.",
- "To do so simply press G to learn skills. Reading the documentation",
- "about skills and abilities is also strongly recommended.",
- }
-}
-
-ingame_help
-{
["callback"] = "monster_chat",
["desc"] =
{
@@ -226,15 +214,3 @@ ingame_help
"and select the switch melee type option.",
}
}
-
-ingame_help
-{
- ["hook"] = HOOK_PLAYER_LEVEL,
- ["event"] = function(y, x) if player.lev >= 20 then return TRUE end end,
- ["desc"] =
- {
- "I see you are now at least level 20. Nice! If you want to gloat about your",
- "character you could press 'C' then 'f' to make a character dump and post it to",
- "http://angband.oook.cz/ where it will end up in the ladder.",
- }
-}
diff --git a/src/help.c b/src/help.c
index d90ffe58..73892ff7 100644
--- a/src/help.c
+++ b/src/help.c
@@ -14,7 +14,7 @@
#include "angband.h"
#define DESC_MAX 14
-#define TRIGGERED_HELP_MAX 14
+#define TRIGGERED_HELP_MAX 16
#define HELP_VOID_JUMPGATE 0
#define HELP_FOUNTAIN 1
@@ -30,6 +30,8 @@
#define HELP_WILDERNESS 11
#define HELP_GAME_TOME 12
#define HELP_GAME_THEME 13
+#define HELP_1ST_LEVEL 14
+#define HELP_20TH_LEVEL 15
/**
* Struct for help triggered by a boolean condition
@@ -122,6 +124,14 @@ static bool_ trigger_game_tome(void *in, void *out) {
return (game_module_idx == MODULE_TOME);
}
+static bool_ trigger_1st_level(void *in, void *out) {
+ return (p_ptr->lev > 1);
+}
+
+static bool_ trigger_20th_level(void *in, void *out) {
+ return (p_ptr->lev >= 20);
+}
+
/**
* Trigger-based help items
*/
@@ -268,6 +278,24 @@ static triggered_help_type triggered_help[TRIGGERED_HELP_MAX] =
"You can see your quest log by pressing ctrl+q. Now go to your destiny!",
NULL
}
+ },
+ { HELP_1ST_LEVEL,
+ HOOK_PLAYER_LEVEL,
+ trigger_1st_level,
+ { "Ok, so you now gained a level, and you have skill points to spend.",
+ "To do so simply press G to learn skills. Reading the documentation",
+ "about skills and abilities is also strongly recommended.",
+ NULL
+ }
+ },
+ { HELP_20TH_LEVEL,
+ HOOK_PLAYER_LEVEL,
+ trigger_20th_level,
+ { "I see you are now at least level 20. Nice! If you want to gloat about your",
+ "character you could press 'C' then 'f' to make a character dump and post it to",
+ "http://angband.oook.cz/ where it will end up in the ladder.",
+ NULL
+ }
}
};