From 53bf1478ad25f03d6df584371b0653f83ead1b6d Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Fri, 1 Jun 2012 05:37:37 +0200 Subject: Lua: Move "Temple" and "Magic shop" hook code to C --- lib/mods/theme/scpt/stores.lua | 27 --------------------------- 1 file changed, 27 deletions(-) (limited to 'lib/mods/theme/scpt/stores.lua') diff --git a/lib/mods/theme/scpt/stores.lua b/lib/mods/theme/scpt/stores.lua index 4902c4d0..61a97f5a 100644 --- a/lib/mods/theme/scpt/stores.lua +++ b/lib/mods/theme/scpt/stores.lua @@ -132,30 +132,3 @@ store_buy_list TV_INSTRUMENT, }, } - --- Take care to have Magic shop/Temple have specific spells only -add_hooks -{ - [HOOK_STORE_STOCK] = function (index, name, level) - if name == "Magic shop" then - -- Books - if magik(20) == TRUE then - object_prep(obj_forge, lookup_kind(TV_BOOK, 255)) - local spell = get_random_spell(SKILL_MAGIC, 20) - if spell > -1 then - obj_forge.pval = spell - return TRUE, obj_forge - end - end - elseif name == "Temple" then - if magik(20) == TRUE then - object_prep(obj_forge, lookup_kind(TV_BOOK, 255)) - local spell = get_random_spell(SKILL_SPIRITUALITY, 20) - if spell > -1 then - obj_forge.pval = spell - return TRUE, obj_forge - end - end - end - end, -} -- cgit v1.2.3 From 3756182bf99335d02f7872c105b5ae5f9b5c4e57 Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Sat, 2 Jun 2012 21:46:20 +0200 Subject: Lua: Move store handling to C --- lib/mods/theme/scpt/stores.lua | 134 ----------------------------------------- 1 file changed, 134 deletions(-) delete mode 100644 lib/mods/theme/scpt/stores.lua (limited to 'lib/mods/theme/scpt/stores.lua') diff --git a/lib/mods/theme/scpt/stores.lua b/lib/mods/theme/scpt/stores.lua deleted file mode 100644 index 61a97f5a..00000000 --- a/lib/mods/theme/scpt/stores.lua +++ /dev/null @@ -1,134 +0,0 @@ --- Whats shops can buy what -store_buy_list -{ - ["General Store"] = - { - TV_CORPSE, - TV_FOOD, - TV_LITE, - TV_FLASK, - TV_SPIKE, - TV_SHOT, - TV_ARROW, - TV_BOLT, - TV_DIGGING, - TV_CLOAK, - TV_BOTTLE, - }, - ["Armoury"] = - { - TV_BOOTS, - TV_GLOVES, - TV_CROWN, - TV_HELM, - TV_SHIELD, - TV_CLOAK, - TV_SOFT_ARMOR, - TV_HARD_ARMOR, - TV_DRAG_ARMOR, - }, - ["Weaponsmith"] = - { - TV_SHOT, - TV_BOLT, - TV_ARROW, - TV_BOOMERANG, - TV_BOW, - TV_DIGGING, - TV_HAFTED, - TV_POLEARM, - TV_SWORD, - TV_AXE, - TV_MSTAFF, - }, - -- We use a function because we want to restrict to blessed weapons and god spells - ["Temple"] = function (obj) - if obj.tval == TV_DRUID_BOOK then return TRUE - elseif obj.tval == TV_BOOK and obj.sval == 255 and (can_spell_random(obj.pval) == SKILL_SPIRITUALITY) then return TRUE - elseif obj.tval == TV_SCROLL then return TRUE - elseif obj.tval == TV_POTION2 then return TRUE - elseif obj.tval == TV_POTION then return TRUE - elseif obj.tval == TV_HAFTED then return TRUE - elseif obj.tval == TV_POLEARM and is_blessed(obj) == TRUE then return TRUE - elseif obj.tval == TV_SWORD and is_blessed(obj) == TRUE then return TRUE - elseif obj.tval == TV_AXE and is_blessed(obj) == TRUE then return TRUE - elseif obj.tval == TV_BOOMERANG and is_blessed(obj) == TRUE then return TRUE - end - end, - ["Alchemy shop"] = - { - TV_SCROLL, - TV_POTION2, - TV_POTION, - TV_BATERIE, - TV_BOTTLE, - }, - -- We use a function because we dont want god spells - ["Magic shop"] = function (obj) - local buy = - { - [TV_SYMBIOTIC_BOOK] = TRUE, - [TV_AMULET] = TRUE, - [TV_RING] = TRUE, - [TV_STAFF] = TRUE, - [TV_WAND] = TRUE, - [TV_ROD] = TRUE, - [TV_ROD_MAIN] = TRUE, - [TV_SCROLL] = TRUE, - [TV_POTION2] = TRUE, - [TV_POTION] = TRUE, - [TV_MSTAFF] = TRUE, - [TV_RANDART] = TRUE, - } - - if obj.tval == TV_BOOK and obj.sval == 255 and (can_spell_random(obj.pval) == SKILL_MAGIC) then return TRUE - elseif obj.tval == TV_BOOK and obj.sval ~= 255 then return TRUE - elseif buy[obj.tval] == TRUE then return TRUE - end - end, - -- Black markets wants ALL! - ["Black Market"] = function (obj) - return TRUE - end, - ["Book Store"] = - { - TV_BOOK, - TV_SYMBIOTIC_BOOK, - TV_MUSIC_BOOK, - TV_DAEMON_BOOK, - TV_DRUID_BOOK, - }, - ["Pet Shop"] = - { - TV_EGG, - }, --- Theme stores - - ["Hunting Supply Store"] = - { - TV_TRAPKIT, - TV_BOOMERANG, - TV_SHOT, - TV_BOLT, - TV_ARROW, - TV_BOW, - TV_POTION2, - }, - - ["Runic Magic Shop"] = - { - TV_RUNE1, - TV_RUNE2, - }, - - ["Construction Supply Store"] = - { - TV_LITE, - TV_DIGGING, - }, - - ["Music Store"] = - { - TV_INSTRUMENT, - }, -} -- cgit v1.2.3