Skip to content
This repository has been archived by the owner on Sep 16, 2018. It is now read-only.

Commit

Permalink
Add bread as a new item and use it in guardduty quest
Browse files Browse the repository at this point in the history
  • Loading branch information
jtoelke committed Jan 14, 2015
1 parent 838c8a1 commit eb4d77a
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 15 deletions.
5 changes: 5 additions & 0 deletions items.xml
Expand Up @@ -450,4 +450,9 @@
<consumes />
</effect>
</item>
<item id="60" max-per-slot="255" name="Bread"
description="Hard Bread"
image="FoodBread.png"
value="5">
</item>
</items>
5 changes: 5 additions & 0 deletions scripts/global_constants.lua
Expand Up @@ -22,6 +22,11 @@
TUTORIAL_DUMMY_AMOUNT = 6
-- Guardduty quest
GUARDDUTY_BREADAMOUNT = 6
GUARDDUTY_BREADAMOUNT_M = 4
GUARDDUTY_BREADAMOUNT_F = 2
-- Needed in context of Innkeeper Norman
GOLDENFIELDS_TAXES = 160
REBEL_FOOD_PUMPKIN = 5
Expand Down
19 changes: 12 additions & 7 deletions scripts/npcs/casern_cellar/guarddain.lua
Expand Up @@ -31,13 +31,18 @@ local function guard_talk(npc, ch)
if (res == 1) then
say("Fine. Go ahead, just follow the stink, you can't miss it.")
else
say("Great! Now you can go upst-")
say("Did you hear that? I bet that was this farmer brat again. "
.. "Can you go and check him out in the cell?")
-- TODO: check and remove items from inventory
chr_set_quest(ch, "soldier_goldenfields_guardduty", "deliveredfood")
ch:set_questlog_description(QUESTID_GODWIN_GUARDDUTY,
"Talk to Prisoner Asher in the casern prison cell.", true)
local bread = ch:inv_count("Bread")
if (bread >= GUARDDUTY_BREADAMOUNT) then
ch:inv_change("Bread", -GUARDDUTY_BREADAMOUNT)
chr_set_quest(ch, "soldier_goldenfields_guardduty", "deliveredfood")
ch:set_questlog_description(QUESTID_GODWIN_GUARDDUTY,
"Talk to Prisoner Asher in the casern prison cell.", true)
say("Great! Now you can go upst-")
say("Did you hear that? I bet that was this farmer brat again. "
.. "Can you go and check him out in the cell?")
else
say("Hey, did you forget to bring it with you? Fool!")
end
end
end
Expand Down
13 changes: 10 additions & 3 deletions scripts/npcs/casern_cellar/prisonerasher.lua
Expand Up @@ -55,9 +55,16 @@ local function prisoner_talk(npc, ch)
local function deliver_food()
say("Do you have our food? Finally!")
-- TODO: remove from inventory
local bread = ch:inv_count("Bread")
if (bread >= GUARDDUTY_BREADAMOUNT_M) then
ch:inv_change("Bread", -GUARDDUTY_BREADAMOUNT_M)
else
say("Oh, you don't have it?")
end
if guardduty == "gotfood" then
chr_set_quest(ch, "soldier_goldenfields_guardduty", "delivered4food")
chr_set_quest(ch, "soldier_goldenfields_guardduty", "deliveredfoodmales")
say("Don't forget the female prisoners in the other cell.")
say("But please, can you come back here afterwards? I have a small favor to ask.")
else
Expand All @@ -72,7 +79,7 @@ local function prisoner_talk(npc, ch)
local guardduty = chr_get_quest(ch, "soldier_goldenfields_guardduty")
if guardduty == "gotfood" or guardduty == "delivered2food" then
if guardduty == "gotfood" or guardduty == "deliveredfoodfemales" then
deliver_food()
elseif guardduty == "deliveredfood" then
ask_favor()
Expand Down
13 changes: 10 additions & 3 deletions scripts/npcs/casern_cellar/prisonerberta.lua
Expand Up @@ -22,13 +22,20 @@
local function prisoner_talk(npc, ch)
local guardduty = chr_get_quest(ch, "soldier_goldenfields_guardduty")
if guardduty == "gotfood" or guardduty == "delivered4food" then
if guardduty == "gotfood" or guardduty == "deliveredfoodmales" then
say("Do you bring our food? I'm so glad.")
say("The regular guard often takes some of the food for himself, "
.."so we're starving.")
-- TODO: remove from inventory
local bread = ch:inv_count("Bread")
if (bread >= GUARDDUTY_BREADAMOUNT_F) then
ch:inv_change("Bread", -GUARDDUTY_BREADAMOUNT_F)
else
say("Oh, you don't have it?")
end
if guardduty == "gotfood" then
chr_set_quest(ch, "soldier_goldenfields_guardduty", "delivered2food")
chr_set_quest(ch, "soldier_goldenfields_guardduty", "deliveredfoodfemales")
say("Don't forget the male prisoners in the other cell.")
else
chr_set_quest(ch, "soldier_goldenfields_guardduty", "deliveredfood")
Expand Down
2 changes: 1 addition & 1 deletion scripts/npcs/casern_north/scullionjohn.lua
Expand Up @@ -34,7 +34,7 @@ local function scullion_talk(npc, ch)
say("Finally, you're late. Here it is.")
say("Oh, and you might want to give it to the prisoners directly. "
.. "Sometimes the guard down there... likes some extra rations, if you know what I mean.")
-- TODO: give food items: add new item bread?
ch:inv_change("Bread", GUARDDUTY_BREADAMOUNT)
chr_set_quest(ch, "soldier_goldenfields_guardduty", "gotfood")
ch:set_questlog_description(QUESTID_GODWIN_GUARDDUTY,
"Deliver the food to the prison in the casern's cellar.", true)
Expand Down
3 changes: 2 additions & 1 deletion scripts/npcs/village/merchantanabel.lua
Expand Up @@ -37,7 +37,8 @@ local function merchant_talk(npc, ch)
trade(false, {
{ "Pumpkin", 10, 50 },
{ "Food Shank", 10, 130 },
{ "Apple", 10, 40 }
{ "Apple", 10, 40 },
{ "Bread", 10, 50 }
})
elseif res== 2 then
say("Sure. Show me what you have.")
Expand Down

0 comments on commit eb4d77a

Please sign in to comment.