From e6637a7432a18f32cb5ea5a02e1bd89895ef8e79 Mon Sep 17 00:00:00 2001 From: Atte Date: Fri, 22 May 2015 18:38:52 +0300 Subject: [PATCH 1/4] Add unrealized dream --- data/actions/actions.xml | 1 + .../actions/scripts/other/unrealizedDream.lua | 69 +++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 data/actions/scripts/other/unrealizedDream.lua diff --git a/data/actions/actions.xml b/data/actions/actions.xml index 236d9df..6e04f83 100644 --- a/data/actions/actions.xml +++ b/data/actions/actions.xml @@ -627,6 +627,7 @@ + diff --git a/data/actions/scripts/other/unrealizedDream.lua b/data/actions/scripts/other/unrealizedDream.lua new file mode 100644 index 0000000..6fa17e4 --- /dev/null +++ b/data/actions/scripts/other/unrealizedDream.lua @@ -0,0 +1,69 @@ +local items = { + {1032, "Snowball", "You try to concentrate and your dream comes true. You wished for something cool."}, + {1070, "Rubbish", "You try to concentrate and your dream comes true. You knew it would be some rubbish!"}, + {485, "Piggy Bank", "You try to concentrate and your dream comes true. You just thought about your wealth."}, + {956, "Blue Rose", "You try to concentrate and your dream comes true. You just thought about spring."}, + {481, "Lute", "You try to concentrate and your dream comes true. Well, part of. You thought about getting rich and a pile of loot..."}, + {960, "Present", "You try to concentrate and your dream comes true. You were that curious for the surprise."}, + {956, "Simple Dress", "You try to concentrate and ... Oops, where did that dream come from?"}, + {188, "Silver Prison Key", "You try to concentrate and your dream comes true. You just thought about a true challenge."}, + {419, "Spellwand", "You try to concentrate and your dream comes true. Somehow you seemed to get distracted when you thought of Ferumbras."}, + {977, "Dice", "You try to concentrate and your dream comes true. You just wondered if you'd be lucky this time."}, + {95, "Mirror", "You try to concentrate and your dream comes true. You shouldn't really think about yourself that often."}, + {128, "Cluster of Solace", "You try to concentrate and your dream comes true. You thought of your last night's dream, You try to concentrate and your dream comes true. You couldn't focus on anything specific."}, + {320, "Meat", "You try to concentrate and your dream comes true. Unfortunately you were subconsciouly thinking about something to eat."}, + {383, "Goldfish Bowl", "You try to concentrate and your dream comes true. You just thought about a loyal companion."}, + {204, "Copper Prison Key", "You try to concentrate and your dream comes true. You just thought about a true challenge."}, + {203, "Bronze Prison Key", "You try to concentrate and your dream comes true. You just thought about a true challenge."}, + {50, "Golden Prison Key", "You try to concentrate and your dream comes true. You just thought about a true challenge."}, + {60, "Wedding Ring", "You try to concentrate and your dream comes true. You wonder what were you thinking about."}, + {41, "Stuffed Bunny", "You try to concentrate and your dream comes true. You just thought about having a true friend."}, + {51, "Dream Warden Claw", "You try to concentrate and your dream comes true. You wonder what were you thinking about."}, + {59, "Pair of Earmuffs", "You try to concentrate and your dream comes true. Sadly you had cold ears just in that moment."}, + {23, "Bag of Apple Slices", "You try to concentrate and your dream comes true. You thought about your sore feet."} +} + +local function randomizeItem() + local x, y = 0, 0 + for i = 1, #items do + local itemChance = items[i][1] + x = x + itemChance + end + + local chance = math.random(x) + for i = 1, #items do + local dasChance = items[i][1] + itemName = items[i][2] + itemMessage = items[i][3] + y = y + dasChance + if y > chance then + break + end + end + return itemName, itemMessage +end + +function onUse(player, item, fromPosition, target, toPosition, isHotkey) + local spectators = Game.getSpectators(Position(33628, 32370, 5), false, true, 20, 20, 20, 20) + if #spectators < 1 then + return false + end + + for i = 1, #spectators do + local spectator = spectators[i] + if spectator.uid ~= player.uid then + -- should it send some message if player isn't near the dreamcatcher device? + return false + end + end + + randomizeItem() + if not player:addItem(itemName) then + print("Bug in unrealizedDream.lua. Could not create ".. itemName ..". Player name: ".. player:getName() ..".") + return false + end + + item:remove(1) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, itemMessage) + return true +end \ No newline at end of file From ed40581331984b8202726f7196737178bc2aa140 Mon Sep 17 00:00:00 2001 From: Atte Date: Fri, 22 May 2015 19:01:42 +0300 Subject: [PATCH 2/4] Explosive present and minor fixes --- data/actions/actions.xml | 3 ++- data/actions/scripts/other/explosive_present.lua | 6 ++++++ .../other/{unrealizedDream.lua => unrealized_dream.lua} | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 data/actions/scripts/other/explosive_present.lua rename data/actions/scripts/other/{unrealizedDream.lua => unrealized_dream.lua} (97%) diff --git a/data/actions/actions.xml b/data/actions/actions.xml index 6e04f83..a7e0729 100644 --- a/data/actions/actions.xml +++ b/data/actions/actions.xml @@ -627,7 +627,8 @@ - + + diff --git a/data/actions/scripts/other/explosive_present.lua b/data/actions/scripts/other/explosive_present.lua new file mode 100644 index 0000000..fc2648f --- /dev/null +++ b/data/actions/scripts/other/explosive_present.lua @@ -0,0 +1,6 @@ +function onUse(player, item, fromPosition, target, toPosition, isHotkey) + player:say("KABOOOOOOOOOOM!", TALKTYPE_MONSTER_SAY) + player:getPosition():sendMagicEffect(CONST_ME_EXPLOSIONHIT) + item:remove() + return true +end \ No newline at end of file diff --git a/data/actions/scripts/other/unrealizedDream.lua b/data/actions/scripts/other/unrealized_dream.lua similarity index 97% rename from data/actions/scripts/other/unrealizedDream.lua rename to data/actions/scripts/other/unrealized_dream.lua index 6fa17e4..4f4ec60 100644 --- a/data/actions/scripts/other/unrealizedDream.lua +++ b/data/actions/scripts/other/unrealized_dream.lua @@ -4,7 +4,7 @@ local items = { {485, "Piggy Bank", "You try to concentrate and your dream comes true. You just thought about your wealth."}, {956, "Blue Rose", "You try to concentrate and your dream comes true. You just thought about spring."}, {481, "Lute", "You try to concentrate and your dream comes true. Well, part of. You thought about getting rich and a pile of loot..."}, - {960, "Present", "You try to concentrate and your dream comes true. You were that curious for the surprise."}, + {960, 8110, "You try to concentrate and your dream comes true. You were that curious for the surprise."}, {956, "Simple Dress", "You try to concentrate and ... Oops, where did that dream come from?"}, {188, "Silver Prison Key", "You try to concentrate and your dream comes true. You just thought about a true challenge."}, {419, "Spellwand", "You try to concentrate and your dream comes true. Somehow you seemed to get distracted when you thought of Ferumbras."}, From 50e49224e90c5c8ff2150b1396590f9b36b62195 Mon Sep 17 00:00:00 2001 From: Atte Date: Sat, 23 May 2015 08:51:34 +0300 Subject: [PATCH 3/4] add achievement to explosive present --- data/actions/scripts/other/explosive_present.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/data/actions/scripts/other/explosive_present.lua b/data/actions/scripts/other/explosive_present.lua index fc2648f..fb162c5 100644 --- a/data/actions/scripts/other/explosive_present.lua +++ b/data/actions/scripts/other/explosive_present.lua @@ -1,6 +1,7 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey) player:say("KABOOOOOOOOOOM!", TALKTYPE_MONSTER_SAY) player:getPosition():sendMagicEffect(CONST_ME_EXPLOSIONHIT) + player:addAchievement("Joke's on You") item:remove() return true -end \ No newline at end of file +end From d8d39d171553897dbf4d2b763e6a1f1c2c179982 Mon Sep 17 00:00:00 2001 From: Atte Date: Sat, 23 May 2015 08:51:53 +0300 Subject: [PATCH 4/4] add new line --- data/actions/scripts/other/unrealized_dream.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/actions/scripts/other/unrealized_dream.lua b/data/actions/scripts/other/unrealized_dream.lua index 4f4ec60..9086497 100644 --- a/data/actions/scripts/other/unrealized_dream.lua +++ b/data/actions/scripts/other/unrealized_dream.lua @@ -66,4 +66,4 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey) item:remove(1) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, itemMessage) return true -end \ No newline at end of file +end