From 6de5259bff1a4bfc55096646cca8004fd61c5068 Mon Sep 17 00:00:00 2001 From: ErikasKontenis Date: Sun, 22 Nov 2020 22:33:11 +0200 Subject: [PATCH] introduce christmas items and santa claus --- data/actions/actions.xml | 1 + .../actions/scripts/misc/christmas_bundle.lua | 50 +++++++++++++++++++ data/npc/gen-xmas.ndb | 41 +++++++++------ data/npc/santaclaus.npc | 11 ++++ 4 files changed, 89 insertions(+), 14 deletions(-) create mode 100644 data/actions/scripts/misc/christmas_bundle.lua create mode 100644 data/npc/santaclaus.npc diff --git a/data/actions/actions.xml b/data/actions/actions.xml index 1d4936f..72566eb 100644 --- a/data/actions/actions.xml +++ b/data/actions/actions.xml @@ -240,6 +240,7 @@ + diff --git a/data/actions/scripts/misc/christmas_bundle.lua b/data/actions/scripts/misc/christmas_bundle.lua new file mode 100644 index 0000000..fa1368d --- /dev/null +++ b/data/actions/scripts/misc/christmas_bundle.lua @@ -0,0 +1,50 @@ +function onUse(player, item, fromPosition, target, toPosition, isHotkey) + + local bundleTypes = { + [6506] = { -- red christmas bundle + 6503 + }, + [6507] = { -- blue christmas bundle + 6504 + }, + [6508] = { -- green christmas bundle + 6502 + } + } + + local common = { + {6569, 15}, {3598, 20}, {3599, 10}, {3586, 10}, {3585, 5}, 6500, 6501, 6489, 6387 + } + + local targetItem = bundleTypes[item.itemid] + if not targetItem then + return true + end + + targetItem = common + + -- In case there's going to be more than one unique item per bundle + for i = 1, #bundleTypes[item.itemid] do + table.insert(targetItem, bundleTypes[item.itemid][i]) + end + + local rewards = {} + repeat + local count = 1 + local rand = math.random(#targetItem) + local gift = targetItem[rand] + if type(gift) == "table" then + count = gift[2] + gift = gift[1] + end + rewards[#rewards + 1] = {gift, count} + table.remove(targetItem, rand) + until #rewards == 7 + + for i = 1, #rewards do + player:addItem(rewards[i][1], rewards[i][2]) + end + item:remove(1) + fromPosition:sendMagicEffect(CONST_ME_GIFT_WRAPS) + return true +end \ No newline at end of file diff --git a/data/npc/gen-xmas.ndb b/data/npc/gen-xmas.ndb index 885ee48..3a4490b 100644 --- a/data/npc/gen-xmas.ndb +++ b/data/npc/gen-xmas.ndb @@ -13,21 +13,34 @@ VANISH,! -> "Good bye, little %N!" "farewell" -> * "job" -> "Ho ho ho! You don't know Santa Claus? Never mind. You may ask me for a present." "name" -> "Sorry, I don't have time to chat. Please ask for your present." +"thank" -> "You had a few hard times last year, I know. Considering all that you did well and I'm proud of you." +"thank",amount>9000 -> "You're one of my favourite children, little %N. But pssht, don't tell the others! I love all of you, of course." -#verteilt orange -"present",QuestValue(217)<3,amount<1000,! -> "Here is your present! Enjoy!",SetQuestValue(217,3),Type=3586, Amount=10,Create(Type),Idle -#verteilt candy canes -"present",QuestValue(217)<3,amount<3500,amount>999,! -> "Here is your present! Enjoy!",SetQuestValue(217,3),Type=3599, Amount=8,Create(Type),Idle -#verteilt apfel -"present",QuestValue(217)<3,amount<5000,amount>3499,! -> "Here is your present! Enjoy!",SetQuestValue(217,3),Type=3585, Amount=15,Create(Type),Idle -#verteilt kekse -"present",QuestValue(217)<3,amount<6000,amount>4999,! -> "Here is your present! Enjoy!",SetQuestValue(217,3),Type=3598, Amount=8,Create(Type),Idle -#verteilt schneeball -"present",QuestValue(217)<3,amount<9950,amount>5999,! -> "Here is your present! Enjoy!",SetQuestValue(217,3),Type=2992, Amount=5,Create(Type),Idle -#verteilt doll -"present",QuestValue(217)<3,amount<9999,amount>9949,! -> "Here is your present! Enjoy!",SetQuestValue(217,3),Type=2991, Amount=1,Create(Type),Idle -#verteilt teddy -"present",QuestValue(217)<3,amount=10000,! -> "Here is your present! Enjoy!",SetQuestValue(217,3),Type=2993, Amount=1,Create(Type),Idle +"present",QuestValue(217)<999,amount<2000,! -> "Here is your present! Enjoy!",SetQuestValue(217,3),Type=3599, Amount=10,Create(Type),Type=6506, Amount=1,Create(Type),Idle +"present",QuestValue(217)<999,amount<4000,amount>1999,! -> "Here is your present! Enjoy!",SetQuestValue(217,3),Type=3599, Amount=10,Create(Type),Type=6507, Amount=1,Create(Type),Idle +"present",QuestValue(217)<999,amount<6000,amount>3999,! -> "Here is your present! Enjoy!",SetQuestValue(217,3),Type=3599, Amount=10,Create(Type),Type=6508, Amount=1,Create(Type),Idle +"present",QuestValue(217)<999,amount<8000,amount>5999,! -> "Here is your present! Enjoy!",SetQuestValue(217,3),Type=3599, Amount=10,Create(Type),Type=2992, Amount=10,Create(Type),Idle +"present",QuestValue(217)<999,Level>20,amount<9000,amount>7999,! -> "Here is your present! Enjoy!",SetQuestValue(217,3),Type=3039, Amount=1,Create(Type),Idle +"present",QuestValue(217)<999,Level>20,amount<9500,amount>8999,! -> "Here is your present! Enjoy!",SetQuestValue(217,3),Type=3036, Amount=1,Create(Type),Idle +"present",QuestValue(217)<999,amount<9982,amount>9499,! -> "Here is your present! Enjoy!",SetQuestValue(217,3),Type=2991, Amount=1,Create(Type),Idle +"present",QuestValue(217)<999,Level>20,amount=9983,! -> "Here is your present! Enjoy!",SetQuestValue(217,3),Type=3382, Amount=1,Create(Type),Idle +"present",QuestValue(217)<999,Level>20,amount=9984,! -> "Here is your present! Enjoy!",SetQuestValue(217,3),Type=3419, Amount=1,Create(Type),Idle +"present",QuestValue(217)<999,Level>20,amount=9985,! -> "Here is your present! Enjoy!",SetQuestValue(217,3),Type=3381, Amount=1,Create(Type),Idle +"present",QuestValue(217)<999,Level>20,amount=9986,! -> "Here is your present! Enjoy!",SetQuestValue(217,3),Type=3420, Amount=1,Create(Type),Idle +"present",QuestValue(217)<999,Level>20,amount=9987,! -> "Here is your present! Enjoy!",SetQuestValue(217,3),Type=3279, Amount=1,Create(Type),Idle +"present",QuestValue(217)<999,Level>20,amount=9988,! -> "Here is your present! Enjoy!",SetQuestValue(217,3),Type=3079, Amount=1,Create(Type),Idle +"present",QuestValue(217)<999,Level>20,amount=9989,! -> "Here is your present! Enjoy!",SetQuestValue(217,3),Type=3386, Amount=1,Create(Type),Idle +"present",QuestValue(217)<999,Level>20,amount=9990,! -> "Here is your present! Enjoy!",SetQuestValue(217,3),Type=3567, Amount=1,Create(Type),Idle +"present",QuestValue(217)<999,Level>20,amount=9991,! -> "Here is your present! Enjoy!",SetQuestValue(217,3),Type=3364, Amount=1,Create(Type),Idle +"present",QuestValue(217)<999,Level>20,amount=9992,! -> "Here is your present! Enjoy!",SetQuestValue(217,3),Type=3366, Amount=1,Create(Type),Idle +"present",QuestValue(217)<999,Level>20,amount=9993,! -> "Here is your present! Enjoy!",SetQuestValue(217,3),Type=3389, Amount=1,Create(Type),Idle +"present",QuestValue(217)<999,Level>20,amount=9994,! -> "Here is your present! Enjoy!",SetQuestValue(217,3),Type=3001, Amount=1,Create(Type),Idle +"present",QuestValue(217)<999,Level>20,amount=9995,! -> "Here is your present! Enjoy!",SetQuestValue(217,3),Type=3570, Amount=1,Create(Type),Idle +"present",QuestValue(217)<999,Level>20,amount=9996,! -> "Here is your present! Enjoy!",SetQuestValue(217,3),Type=5919, Amount=1,Create(Type),Idle +"present",QuestValue(217)<999,Level>20,amount=9997,! -> "Here is your present! Enjoy!",SetQuestValue(217,3),Type=3553, Amount=1,Create(Type),Idle +"present",QuestValue(217)<999,Level>20,amount=9998,! -> "Here is your present! Enjoy!",SetQuestValue(217,3),Type=3057, Amount=1,Create(Type),Idle +"present",QuestValue(217)<999,Level>20,amount=9999,! -> "Here is your present! Enjoy!",SetQuestValue(217,3),Type=5080, Amount=1,Create(Type),Idle +"present",QuestValue(217)<999,Level>20,amount=10000,! -> "Here is your present! Enjoy!",SetQuestValue(217,3),Type=2993, Amount=1,Create(Type),Idle "present",QuestValue(217)=3 -> "You already got your present! Next please!", Idle diff --git a/data/npc/santaclaus.npc b/data/npc/santaclaus.npc new file mode 100644 index 0000000..200eac8 --- /dev/null +++ b/data/npc/santaclaus.npc @@ -0,0 +1,11 @@ +# GIMUD - Graphical Interface Multi User Dungeon +# 17608 - any task in progress + +Name = "Santa Claus" +Outfit = (160,0-112-93-95-0) +Home = [32362,32207,7] +Radius = 3 + +Behaviour = { +@"gen-xmas.ndb" +}