summaryrefslogtreecommitdiffstats
path: root/example/scripts
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-03-10 23:20:44 +0100
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-03-11 16:56:47 +0100
commit2dd3c5c06978584e3e076609554f225ffbabd3e2 (patch)
tree0673264e014e235982dca26dbfd426ae09a94c62 /example/scripts
parent520705579d6a68cf6908275026eef2edee0758af (diff)
downloadmanaserv-2dd3c5c06978584e3e076609554f225ffbabd3e2.tar.gz
manaserv-2dd3c5c06978584e3e076609554f225ffbabd3e2.tar.xz
manaserv-2dd3c5c06978584e3e076609554f225ffbabd3e2.zip
Removed deprecated NPC helper functions
Reviewed-by: Erik Schilling
Diffstat (limited to 'example/scripts')
-rw-r--r--example/scripts/maps/desert.lua18
-rw-r--r--example/scripts/npcs/banker.lua42
-rw-r--r--example/scripts/npcs/barber.lua14
-rw-r--r--example/scripts/npcs/debugger.lua34
-rw-r--r--example/scripts/npcs/emotemaker.lua4
-rw-r--r--example/scripts/npcs/healer.lua4
-rw-r--r--example/scripts/npcs/merchant.lua4
-rw-r--r--example/scripts/npcs/postman.lua16
8 files changed, 68 insertions, 68 deletions
diff --git a/example/scripts/maps/desert.lua b/example/scripts/maps/desert.lua
index ffe9062..02ca4f6 100644
--- a/example/scripts/maps/desert.lua
+++ b/example/scripts/maps/desert.lua
@@ -39,7 +39,7 @@ end)
function Smith(npc, ch, list)
local sword_count = mana.chr_inv_count(ch, true, true, "Sword")
if sword_count > 0 then
- do_message(npc, ch, "Ah! I can see you already have a sword.")
+ mana.npc_message(npc, ch, "Ah! I can see you already have a sword.")
end
Merchant(npc, ch, list)
end
@@ -54,7 +54,7 @@ function possessions_table(npc, ch)
..inventory_table[i].id..", "..inventory_table[i].name..", "
..inventory_table[i].amount
end
- do_message(npc, ch, item_message)
+ mana.npc_message(npc, ch, item_message)
item_message = "Equipment:"..
"\nSlot id, item id, item name:"..
@@ -64,7 +64,7 @@ function possessions_table(npc, ch)
item_message = item_message.."\n"..equipment_table[i].slot..", "
..equipment_table[i].id..", "..equipment_table[i].name
end
- do_message(npc, ch, item_message)
+ mana.npc_message(npc, ch, item_message)
end
@@ -73,21 +73,21 @@ harmony_have_talked_to_someone = false
function Harmony(npc, ch, list)
-- Say all the messages in the messages list.
for i = 1, #list do
- do_message(npc, ch, list[i])
+ mana.npc_message(npc, ch, list[i])
end
--- Give the player 100 units of money the first time.
if harmony_have_talked_to_someone == false then
- do_message(npc, ch, "Here is some money for you to find some toys to play with.\nEh Eh!")
+ mana.npc_message(npc, ch, "Here is some money for you to find some toys to play with.\nEh Eh!")
mana.chr_money_change(ch, 100)
- do_message(npc, ch, string.format("You now have %d shiny coins!", mana.chr_money(ch)))
+ mana.npc_message(npc, ch, string.format("You now have %d shiny coins!", mana.chr_money(ch)))
harmony_have_talked_to_someone = true
- do_message(npc, ch, string.format("Try to come back with a better level than %i.", mana.chr_get_level(ch)))
+ mana.npc_message(npc, ch, string.format("Try to come back with a better level than %i.", mana.chr_get_level(ch)))
else
- do_message(npc, ch, "Let me see what you've got so far... Don't be afraid!")
+ mana.npc_message(npc, ch, "Let me see what you've got so far... Don't be afraid!")
mana.effect_create(EMOTE_WINK, npc)
possessions_table(npc, ch)
end
- do_message(npc, ch, "Have fun!")
+ mana.npc_message(npc, ch, "Have fun!")
mana.effect_create(EMOTE_HAPPY, npc)
-- Make Harmony disappear for a while... with a small earthquake effect!
local shakeX = mana.posX(npc)
diff --git a/example/scripts/npcs/banker.lua b/example/scripts/npcs/banker.lua
index 790f9a5..762e0bb 100644
--- a/example/scripts/npcs/banker.lua
+++ b/example/scripts/npcs/banker.lua
@@ -12,21 +12,21 @@
function Banker(npc, ch)
if mana.being_get_gender(ch) == GENDER_MALE then
- do_message(npc, ch, "Welcome to the bank, sir!")
+ mana.npc_message(npc, ch, "Welcome to the bank, sir!")
elseif mana.being_get_gender(ch) == GENDER_FEMALE then
- do_message(npc, ch, "Welcome to the bank, madam!")
+ mana.npc_message(npc, ch, "Welcome to the bank, madam!")
else
- do_message(npc, ch, "Welcome to the bank... uhm... person of unspecified gender!")
+ mana.npc_message(npc, ch, "Welcome to the bank... uhm... person of unspecified gender!")
end
- local account = tonumber(get_quest_var(ch, "BankAccount"))
+ local account = tonumber(mana.chr_get_quest(ch, "BankAccount"))
local result = -1
if (account == nil) then --Initial account creation, if needed
- do_message(npc, ch, "Hello! Would you like to setup a bank account? There is a sign-on bonus right now!")
- result = do_choice(npc, ch, "Yes", "No")
+ mana.npc_message(npc, ch, "Hello! Would you like to setup a bank account? There is a sign-on bonus right now!")
+ result = mana.npc_choice(npc, ch, "Yes", "No")
if (result == 1) then
mana.chr_set_quest(ch, "BankAccount", 5)
- do_message(npc, ch, "Your account has been made. Your sign-on bonus is 5GP.")
+ mana.npc_message(npc, ch, "Your account has been made. Your sign-on bonus is 5GP.")
account = 5
end
end
@@ -36,42 +36,42 @@ function Banker(npc, ch)
local input = 0
result = 1
while (result < 3) do --While they've choosen a valid option that isn't "Never mind"
- account = tonumber(get_quest_var(ch, "BankAccount")) --Why do I need to convert this?
- do_message(npc, ch, "Your balance: " .. account .. ".\nYour money: " .. mana.chr_money(ch) .. ".")
- result = do_choice(npc, ch, "Deposit", "Withdraw", "Never mind")
+ account = tonumber(mana.chr_get_quest(ch, "BankAccount")) --Why do I need to convert this?
+ mana.npc_message(npc, ch, "Your balance: " .. account .. ".\nYour money: " .. mana.chr_money(ch) .. ".")
+ result = mana.npc_choice(npc, ch, "Deposit", "Withdraw", "Never mind")
if (result == 1) then --Deposit
money = mana.chr_money(ch);
if (money > 0) then --Make sure they have money to deposit
- do_message(npc, ch, "How much would you like to deposit? (0 will cancel)")
- input = do_ask_integer(npc, ch, 0, money, 1)
+ mana.npc_message(npc, ch, "How much would you like to deposit? (0 will cancel)")
+ input = mana.npc_ask_integer(npc, ch, 0, money, 1)
money = mana.chr_money(ch)
if (input > 0 and input <= money) then --Make sure something weird doesn't happen and they try to deposit more than they have
mana.chr_money_change(ch, -input)
mana.chr_set_quest(ch, "BankAccount", account + input)
- do_message(npc, ch, input .. " GP deposited.")
+ mana.npc_message(npc, ch, input .. " GP deposited.")
elseif (input > money) then --Chosen more than they have
- do_message(npc, ch, "You don't have that much money. But you just did....")
+ mana.npc_message(npc, ch, "You don't have that much money. But you just did....")
end
else
- do_message(npc, ch, "You don't have any money to deposit!")
+ mana.npc_message(npc, ch, "You don't have any money to deposit!")
end
elseif (result == 2) then --Withdraw
if (account > 0) then --Make sure they have money to withdraw
- do_message(npc, ch, "How much would you like to withdraw? (0 will cancel)")
- input = do_ask_integer(npc, ch, 0, account, 1)
+ mana.npc_message(npc, ch, "How much would you like to withdraw? (0 will cancel)")
+ input = mana.npc_ask_integer(npc, ch, 0, account, 1)
if (input > 0 and input <= account) then --Make sure something weird doesn't happen and they try to withdraw more than they have
mana.chr_money_change(ch, input)
mana.chr_set_quest(ch, "BankAccount", account - input)
- do_message(npc, ch, input .. " GP withdrawn.")
+ mana.npc_message(npc, ch, input .. " GP withdrawn.")
elseif (input > account) then --Chosen more than they have
- do_message(npc, ch, "You don't have that much in your account. But you just did....")
+ mana.npc_message(npc, ch, "You don't have that much in your account. But you just did....")
end
else
- do_message(npc, ch, "Your account is empty!")
+ mana.npc_message(npc, ch, "Your account is empty!")
end
end
end --This ends the while loop
end
- do_message(npc, ch, "Thank you. Come again!")
+ mana.npc_message(npc, ch, "Thank you. Come again!")
end
diff --git a/example/scripts/npcs/barber.lua b/example/scripts/npcs/barber.lua
index fbb2862..79f9252 100644
--- a/example/scripts/npcs/barber.lua
+++ b/example/scripts/npcs/barber.lua
@@ -79,11 +79,11 @@ function Barber(npc, ch, data)
-- Choose an appropriate message
if result == 1 then
- do_message(npc, ch, "Hello! What style would you like today?")
+ mana.npc_message(npc, ch, "Hello! What style would you like today?")
elseif result == 2 then
- do_message(npc, ch, "Hello! What color would you like today?")
+ mana.npc_message(npc, ch, "Hello! What color would you like today?")
else
- do_message(npc, ch, "Hello! What can I do for you today?")
+ mana.npc_message(npc, ch, "Hello! What can I do for you today?")
end
print("#styles ==", #styles)
@@ -91,7 +91,7 @@ function Barber(npc, ch, data)
-- Repeat until the user selects nothing
repeat
if (result == 1) then -- Do styles
- result = do_choice(npc, ch, "Bald", styles, "Surprise me", "Never mind")
+ result = mana.npc_choice(npc, ch, "Bald", styles, "Surprise me", "Never mind")
result = result -1
@@ -113,7 +113,7 @@ function Barber(npc, ch, data)
result = 3
end
elseif (result == 2) then -- Do colors
- result = do_choice(npc, ch, colors, "Surprise me", "Never mind")
+ result = mana.npc_choice(npc, ch, colors, "Surprise me", "Never mind")
--Random
if (result == #colors + 1) then
@@ -130,10 +130,10 @@ function Barber(npc, ch, data)
-- If we have both styles and colors, show the main menu
if #styles > 0 and #colors > 0 then
- result = do_choice(npc, ch, "Change my style", "Change my color", "Never mind")
+ result = mana.npc_choice(npc, ch, "Change my style", "Change my color", "Never mind")
end
until result >= 3 --While they've choosen a valid option that isn't "Never mind"
-- Let's close up
- do_message(npc, ch, "Thank you. Come again!")
+ mana.npc_message(npc, ch, "Thank you. Come again!")
end
diff --git a/example/scripts/npcs/debugger.lua b/example/scripts/npcs/debugger.lua
index 142c3fd..80f765c 100644
--- a/example/scripts/npcs/debugger.lua
+++ b/example/scripts/npcs/debugger.lua
@@ -12,38 +12,38 @@
function npc1_talk(npc, ch)
on_remove(ch, function() print "Player has left the map." end);
- do_message(npc, ch, "Hello! I am the testing NPC.")
+ mana.npc_message(npc, ch, "Hello! I am the testing NPC.")
local rights = mana.chr_get_rights(ch);
if (rights >= 128) then
- do_message(npc, ch, "Oh mighty server administrator, how can I avoid your wrath?")
+ mana.npc_message(npc, ch, "Oh mighty server administrator, how can I avoid your wrath?")
elseif (rights >= 8) then
- do_message(npc, ch, "How can I be of assistance, sir gamemaster?")
+ mana.npc_message(npc, ch, "How can I be of assistance, sir gamemaster?")
elseif (rights >= 4) then
- do_message(npc, ch, "What feature would you like to debug, developer?")
+ mana.npc_message(npc, ch, "What feature would you like to debug, developer?")
elseif (rights >= 2) then
- do_message(npc, ch, "How can I assist you in your testing duties?")
+ mana.npc_message(npc, ch, "How can I assist you in your testing duties?")
elseif (rights >= 1) then
- do_message(npc, ch, "What do you want, lowly player?")
+ mana.npc_message(npc, ch, "What do you want, lowly player?")
else
- do_message(npc, ch, "...aren't you supposed to be banned??")
+ mana.npc_message(npc, ch, "...aren't you supposed to be banned??")
end
- local v = do_choice(npc, ch, "Guns! Lots of guns!",
+ local v = mana.npc_choice(npc, ch, "Guns! Lots of guns!",
"A Christmas party!",
"To make a donation.",
"Slowly count from one to ten.",
"Tablepush Test")
if v == 1 then
- do_message(npc, ch, "Sorry, this is a heroic-fantasy game, I do not have any gun.")
+ mana.npc_message(npc, ch, "Sorry, this is a heroic-fantasy game, I do not have any gun.")
elseif v == 2 then
local n1, n2 = mana.chr_inv_count(ch, 524, 511)
if n1 == 0 or n2 ~= 0 then
- do_message(npc, ch, "Yeah right...")
+ mana.npc_message(npc, ch, "Yeah right...")
else
- do_message(npc, ch, "I can't help you with the party. But I see you have a fancy hat. I could change it into Santa's hat. Not much of a party, but it would get you going.")
- v = do_choice(npc, ch, "Please do.", "No way! Fancy hats are classier.")
+ mana.npc_message(npc, ch, "I can't help you with the party. But I see you have a fancy hat. I could change it into Santa's hat. Not much of a party, but it would get you going.")
+ v = mana.npc_choice(npc, ch, "Please do.", "No way! Fancy hats are classier.")
if v == 1 then
mana.chr_inv_change(ch, 524, -1, 511, 1)
end
@@ -51,14 +51,14 @@ function npc1_talk(npc, ch)
elseif v == 3 then
if mana.chr_money_change(ch, -100) then
- do_message(npc, ch, string.format("Thank you for you patronage! You are left with %d GP.", mana.chr_money(ch)))
- local g = tonumber(get_quest_var(ch, "001_donation"))
+ mana.npc_message(npc, ch, string.format("Thank you for you patronage! You are left with %d GP.", mana.chr_money(ch)))
+ local g = tonumber(mana.chr_get_quest(ch, "001_donation"))
if not g then g = 0 end
g = g + 100
mana.chr_set_quest(ch, "001_donation", g)
- do_message(npc, ch, string.format("As of today, you have donated %d GP.", g))
+ mana.npc_message(npc, ch, string.format("As of today, you have donated %d GP.", g))
else
- do_message(npc, ch, "I would feel bad taking money from someone that poor.")
+ mana.npc_message(npc, ch, "I would feel bad taking money from someone that poor.")
end
elseif v == 4 then
@@ -95,6 +95,6 @@ function npc1_talk(npc, ch)
print("---------------");
end
- do_message(npc, ch, "See you later!")
+ mana.npc_message(npc, ch, "See you later!")
end
diff --git a/example/scripts/npcs/emotemaker.lua b/example/scripts/npcs/emotemaker.lua
index 83d2f56..4aa39e8 100644
--- a/example/scripts/npcs/emotemaker.lua
+++ b/example/scripts/npcs/emotemaker.lua
@@ -21,8 +21,8 @@ function emote_talk(npc, ch)
elseif emo_state == EMOTE_HAPPY then
state = "happy"
end
- do_message(npc, ch, string.format("The emotional palm seems %s.", state))
- v = do_choice(npc, ch,
+ mana.npc_message(npc, ch, string.format("The emotional palm seems %s.", state))
+ v = mana.npc_choice(npc, ch,
"Stupid palm, you are ugly and everyone hates you!",
"You are such a nice palm, let me give you a hug.",
"Are you a cocos nucifera or a syagrus romanzoffiana?")
diff --git a/example/scripts/npcs/healer.lua b/example/scripts/npcs/healer.lua
index a4a0db5..478047b 100644
--- a/example/scripts/npcs/healer.lua
+++ b/example/scripts/npcs/healer.lua
@@ -5,8 +5,8 @@
--]]
function Healer(npc, ch)
- do_message(npc, ch, "Do you need healing?")
- local c = do_choice(npc, ch, "Heal me fully", "Heal 100 HP", "Don't heal me")
+ mana.npc_message(npc, ch, "Do you need healing?")
+ local c = mana.npc_choice(npc, ch, "Heal me fully", "Heal 100 HP", "Don't heal me")
if c == 1 then
mana.being_heal(ch)
elseif c == 2 then
diff --git a/example/scripts/npcs/merchant.lua b/example/scripts/npcs/merchant.lua
index 92eeea3..71d0544 100644
--- a/example/scripts/npcs/merchant.lua
+++ b/example/scripts/npcs/merchant.lua
@@ -13,7 +13,7 @@
function Merchant(npc, ch, buy_sell_table)
local function say(message)
- do_message(npc, ch, message)
+ mana.npc_message(npc, ch, message)
end
-- Important note: You can add two tables made of trinoms here when calling the
@@ -56,7 +56,7 @@ function Merchant(npc, ch, buy_sell_table)
table.insert (choice_table, "Tell me about the objects on this map")
table.insert (choice_table, "Nevermind...")
- local v = do_choice(npc, ch, choice_table)
+ local v = mana.npc_choice(npc, ch, choice_table)
--Debug and learning purpose
--for i,k in ipairs(choice_table) do print(i,k) end
diff --git a/example/scripts/npcs/postman.lua b/example/scripts/npcs/postman.lua
index 712ea99..ef64b16 100644
--- a/example/scripts/npcs/postman.lua
+++ b/example/scripts/npcs/postman.lua
@@ -11,20 +11,20 @@
----------------------------------------------------------------------------------
function post_talk(npc, ch)
- do_message(npc, ch, "Hello " .. mana.being_get_name(ch))
+ mana.npc_message(npc, ch, "Hello " .. mana.being_get_name(ch))
local strength = mana.being_get_attribute(ch, ATTR_STRENGTH)
- do_message(npc, ch, "You have " .. tostring(strength) .. " strength")
- do_message(npc, ch, "What would you like to do?")
- local answer = do_choice(npc, ch, "View Mail", "Send Mail", "Nothing")
+ mana.npc_message(npc, ch, "You have " .. tostring(strength) .. " strength")
+ mana.npc_message(npc, ch, "What would you like to do?")
+ local answer = mana.npc_choice(npc, ch, "View Mail", "Send Mail", "Nothing")
if answer == 1 then
- local sender, post = getpost(ch)
+ local sender, post = mana.chr_get_post(ch)
if sender == "" then
- do_message(npc, ch, "No Post right now, sorry")
+ mana.npc_message(npc, ch, "No Post right now, sorry")
else
- do_message(npc, ch, tostring(sender) .. " sent you " .. tostring(post))
+ mana.npc_message(npc, ch, tostring(sender) .. " sent you " .. tostring(post))
end
end
if answer == 2 then
- do_post(npc, ch)
+ mana.npc_post(npc, ch)
end
end