summaryrefslogtreecommitdiffstats
path: root/example
diff options
context:
space:
mode:
authorPhilipp Sehmisch <mana@crushnet.org>2011-02-08 18:15:08 +0100
committerPhilipp Sehmisch <mana@crushnet.org>2011-02-08 18:15:08 +0100
commita36fd4479a22281ea6e9d03e434d5dc6768f6c5a (patch)
treecd0a0d19703f155f372283e11bd99366097aacd0 /example
parent19d140fb6989ada459b0a71ec3bf5647ff93bec2 (diff)
downloadmanaserv-a36fd4479a22281ea6e9d03e434d5dc6768f6c5a.tar.gz
manaserv-a36fd4479a22281ea6e9d03e434d5dc6768f6c5a.tar.xz
manaserv-a36fd4479a22281ea6e9d03e434d5dc6768f6c5a.zip
Implemented LUA binding to get the gender of a character
The function is named mana.chr_get_gender. It returns 0 for male and 1 for female. libmana-constants.lua defines the variables GENDER_MALE and GENDER_FEMALE with these values. Also made the banker NPC refer to the gender of the player character. Reviewed-by: Jaxad0127
Diffstat (limited to 'example')
-rw-r--r--example/serverdata/scripts/npcs/banker.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/example/serverdata/scripts/npcs/banker.lua b/example/serverdata/scripts/npcs/banker.lua
index 79d6af6..bd11ba5 100644
--- a/example/serverdata/scripts/npcs/banker.lua
+++ b/example/serverdata/scripts/npcs/banker.lua
@@ -11,7 +11,13 @@
----------------------------------------------------------------------------------
function Banker(npc, ch)
- do_message(npc, ch, "Welcome to the bank!")
+ if mana.chr_get_gender(ch) == GENDER_MALE then
+ do_message(npc, ch, "Welcome to the bank, sir!")
+ elseif mana.chr_get_gender(ch) == GENDER_FEMALE then
+ do_message(npc, ch, "Welcome to the bank, madam!")
+ else
+ do_message(npc, ch, "Welcome to the bank... uhm... person of unspecified gender!")
+ end
local account = tonumber(get_quest_var(ch, "BankAccount"))
local result = -1
do_wait()