diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-03-11 18:16:16 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-03-11 19:27:32 +0100 |
commit | 5ff34fd2458dff28d664c90fb93f455231f8633c (patch) | |
tree | 533151e5f3002c1e24ce4d44e5cd32c66c026b51 /example/scripts/npcs/merchant.lua | |
parent | b822dcee52d15d41c4186a250e73b85b16c9dc39 (diff) | |
download | manaserv-5ff34fd2458dff28d664c90fb93f455231f8633c.tar.gz manaserv-5ff34fd2458dff28d664c90fb93f455231f8633c.tar.bz2 manaserv-5ff34fd2458dff28d664c90fb93f455231f8633c.tar.xz manaserv-5ff34fd2458dff28d664c90fb93f455231f8633c.zip |
Register Lua script API functions into the global namespace
Scripts mostly execute the Mana script API, and it seems like just
unnecessary verbosity to refer to the 'mana' table all the time. This table
no longer exists now.
Reviewed-by: Erik Schilling
Diffstat (limited to 'example/scripts/npcs/merchant.lua')
-rw-r--r-- | example/scripts/npcs/merchant.lua | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/example/scripts/npcs/merchant.lua b/example/scripts/npcs/merchant.lua index 71d05441..2ef0a6b7 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) - mana.npc_message(npc, ch, message) + npc_message(npc, ch, message) end -- Important note: You can add two tables made of trinoms here when calling the @@ -22,11 +22,11 @@ function Merchant(npc, ch, buy_sell_table) -- buy_sell_table[1] will corresponds to the first table (used to list -- boughtable items, and buy_sell_table[2] listing sellable items. - local rights = mana.chr_get_rights(ch); + local rights = chr_get_rights(ch); if (rights >= 128) then - mana.announce(mana.being_get_name(ch) .. " the big administrator was at my shop!", - mana.being_get_name(npc)) + announce(being_get_name(ch) .. " the big administrator was at my shop!", + being_get_name(npc)) say "Oh mighty server administrator, how can I avoid your wrath?" elseif (rights >= 8) then say "How can I be of assistance, sir gamemaster?" @@ -35,7 +35,7 @@ function Merchant(npc, ch, buy_sell_table) elseif (rights >= 2) then say "How can I assist you in your testing duties?" elseif (rights >= 1) then - if mana.being_get_gender(ch) == GENDER_FEMALE then + if being_get_gender(ch) == GENDER_FEMALE then say "What do you want, Madam?" else say "What do you want, Sir?" @@ -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 = mana.npc_choice(npc, ch, choice_table) + local v = npc_choice(npc, ch, choice_table) --Debug and learning purpose --for i,k in ipairs(choice_table) do print(i,k) end @@ -67,7 +67,7 @@ function Merchant(npc, ch, buy_sell_table) if v == 1 then -- "To buy." - local buycase = mana.npc_trade(npc, ch, false, buy_sell_table[1]) + local buycase = npc_trade(npc, ch, false, buy_sell_table[1]) if buycase == 0 then say "What do you want to buy?" elseif buycase == 1 then @@ -80,7 +80,7 @@ function Merchant(npc, ch, buy_sell_table) if buy_sell_table[2] == nil then -- "To sell stuff..." - local sellcase = mana.npc_trade(npc, ch, true) + local sellcase = npc_trade(npc, ch, true) if sellcase == 0 then say "Ok, what do you want to sell?" elseif sellcase == 1 then @@ -90,7 +90,7 @@ function Merchant(npc, ch, buy_sell_table) end else -- "Can you make me a price for what I have?" - local sellcase = mana.npc_trade(npc, ch, true, buy_sell_table[2]) + local sellcase = npc_trade(npc, ch, true, buy_sell_table[2]) if sellcase == 0 then say "Here we go:" elseif sellcase == 1 then @@ -102,7 +102,7 @@ function Merchant(npc, ch, buy_sell_table) elseif v == 3 then - local objects = mana.map_get_objects() + local objects = map_get_objects() say("There are " .. #objects .. " objects on this map, their names are:") for i=1,#objects do say(tostring(i) .. ": " .. objects[i]:name()) |