Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My last work #213

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions data/XML/quests.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1334,4 +1334,7 @@
<missionstate id="1" description="You completed this Quest!" />
</mission>
</quest>
<quest name="Oramond" startstorageid="10060" startstoragevalue="1">
<mission name="To Take Roots" storageid="20061" startvalue="0" endvalue="1000" description="Five Juicy roots from the outskirts of Rathleton may already help feed the poor. Try to find a city official to deliver them to or go to the Rathleton poor house./n/nRoots harvested: |STATE|/5" />
</quest>
</quests>
16 changes: 15 additions & 1 deletion data/actions/actions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,14 @@
<action itemid="9750" function="decreaseItemId" />
<action itemid="19691" function="increaseItemId" />
<action itemid="19692" function="decreaseItemId" />
<action itemid="22868" function="increaseItemId" />
<action itemid="22869" function="decreaseItemId" />
<action itemid="22870" function="increaseItemId" />
<action itemid="22871" function="decreaseItemId" />
<action itemid="22872" function="increaseItemId" />
<action itemid="22873" function="decreaseItemId" />
<action itemid="22874" function="increaseItemId" />
<action itemid="22875" function="decreaseItemId" />

<!-- Food -->
<action itemid="2328" script="other/food.lua" />
Expand Down Expand Up @@ -665,7 +673,7 @@
<action fromid="2406" toid="2415" script="other/destroy.lua" />
<action fromid="2417" toid="2419" script="other/destroy.lua" />
<action fromid="2421" toid="2453" script="other/destroy.lua" />
<action fromid="5792" toid="5797" script="other/dice.lua" />
<action fromid="5792" toid="5797" script="other/die.lua" />
<action itemid="6558" script="other/concentrated_demonic_blood.lua" />
<action itemid="6277" script="other/baking.lua" />
<action itemid="8846" script="other/baking.lua" />
Expand Down Expand Up @@ -703,5 +711,11 @@
<action itemid="13670" script="valuables/randomitems.lua" />
<action itemid="15572" script="valuables/randomitems.lua" />
<action itemid="18215" script="valuables/randomitems.lua" />
<action itemid="22598" script="valuables/unrealizedDream.lua"/>

<!-- Oramond -->
<action itemid="23422" script="other/rathletonElevator.lua" />
<action itemid="23429" script="other/rathletonElevator.lua" />
<action fromid="23475" toid="23478" script="quests/oramond/totakeroots.lua" />

</actions>
3 changes: 2 additions & 1 deletion data/actions/scripts/adventurers guild/adventurers_stone.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ local config = {
{fromPos = Position(32785, 31274, 7), toPos = Position(32789, 31279, 7), townId = 13},
{fromPos = Position(33018, 31514, 11), toPos = Position(33032, 31531, 11), townId = 14},
{fromPos = Position(33442, 31312, 9), toPos = Position(33454, 31326, 9), townId = 28},
{fromPos = Position(33510, 32360, 6), toPos = Position(33516, 32366, 6), townId = 29}
{fromPos = Position(33510, 32360, 6), toPos = Position(33516, 32366, 6), townId = 29},
{fromPos = Position(33586, 31895, 6), toPos = Position(33603, 31903, 6), townId = 33}
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
Expand Down
File renamed without changes.
90 changes: 90 additions & 0 deletions data/actions/scripts/other/rathletonElevator.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
local elevatorPosition = {
Position(33638, 31903, 5),
Position(33638, 31903, 6)
}

local config = {
[1] = {
fromPosition = elevatorPosition[1],
toPosition = elevatorPosition[2],
itemIds = { 23432, 23421 },
transform = {
position = { elevatorPosition[1], elevatorPosition[2] },
itemId = { 23421, 23421 },
transformId = { 23424, 23428 }
},
sound = 'Srrrt!',
soundPosition = Position(33639, 31903, 5),
relocatePosition = Position(33638, 31902, 5)
},
[2] = {
fromPosition = elevatorPosition[2],
toPosition = elevatorPosition[1],
itemIds = { 23432, 23428 },
transform = {
position = { elevatorPosition[1], elevatorPosition[1] },
itemId = { 23424, 23428 },
transformId = { 23421, 23421 },
},
sound = 'Zrrrt!',
soundPosition = Position(33639, 31903, 6),
relocatePosition = Position(33638, 31904, 6)
}
}

local winch = {
[23422] = { config[2], config[1] },
[23429] = { config[1], config[2] }
}

local relocate = true

local function moveElevator(config, player)
for i = 1, #config.itemIds do
local item = Tile(config.fromPosition):getItemById(config.itemIds[i])
if item then
item:moveTo(config.toPosition)
end
end

for i = 1, #config.transform.position do
local item = Tile(config.transform.position[i]):getItemById(config.transform.itemId[i])
if item then
item:transform(config.transform.transformId[i])
end
end

if player then
player:say(config.sound, TALKTYPE_MONSTER_YELL, false, player, config.soundPosition)
end
end

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local useItem = winch[item.itemid]
if not useItem then
return true
end

toPosition.x = toPosition.x - 1
local tile = Tile(toPosition)
if not tile:getItemById(23432) then
local option = useItem[1]
if relocate then
Tile(option.fromPosition):relocateTo(option.relocatePosition)
end

moveElevator(option, player)
return true
end

local creature = tile:getTopCreature()
if not creature or creature.uid ~= player.uid then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Step inside the elevator to use it.')
return true
end

local option = useItem[2]
moveElevator(option, player)
player:teleportTo(option.toPosition)
return true
end
54 changes: 54 additions & 0 deletions data/actions/scripts/quests/oramond/totakeroots.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
local function revertRoot(position, itemId, transformId)
local item = Tile(position):getItemById(itemId)
if item then
item:transform(transformId)
end
end

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local harvestedCount = player:getStorageValue(Storage.Oramond.HarvestedRootCount)
local rand = math.random(1, 100)
if item.itemid == 23475 then
if((rand >= 1) and (rand < 50)) then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You successfully harvest some juicy roots.')
player:addItem(23662, 1)
item:transform(item.itemid + 2)
addEvent(revertRoot, 300000, toPosition, 23477, 23475)
toPosition:sendMagicEffect(CONST_ME_MAGIC_GREEN)
if player:getStorageValue(Storage.Oramond.MissionToTakeRoots) < 0 then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete the tab

player:setStorageValue(Storage.Oramond.HarvestedRootCount, 1)
player:setStorageValue(Storage.Oramond.MissionToTakeRoots, 1)
player:setStorageValue(Storage.Oramond.QuestLine, 1)
elseif player:getStorageValue(Storage.Oramond.MissionToTakeRoots) == 1 then
player:setStorageValue(Storage.Oramond.HarvestedRootCount, harvestedCount + 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation

end
elseif((rand >= 50) and (rand < 100)) then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Your harvesting attempt destroyed more of the juicy roots than you could salvage.')
item:transform(item.itemid + 2)
addEvent(revertRoot, 300000, toPosition, 23477, 23475)
toPosition:sendMagicEffect(CONST_ME_MAGIC_GREEN)
end
end
if item.itemid == 23476 then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the end above, use the elseif statment insted.

if((rand >= 1) and (rand < 50)) then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You successfully harvest some juicy roots.')
player:addItem(23662, 1)
item:transform(item.itemid + 2)
addEvent(revertRoot, 300000, toPosition, 23478, 23476)
toPosition:sendMagicEffect(CONST_ME_MAGIC_GREEN)
if player:getStorageValue(Storage.Oramond.MissionToTakeRoots) < 0 then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete the tab

player:setStorageValue(Storage.Oramond.HarvestedRootCount, 1)
player:setStorageValue(Storage.Oramond.MissionToTakeRoots, 1)
player:setStorageValue(Storage.Oramond.QuestLine, 1)
elseif player:getStorageValue(Storage.Oramond.MissionToTakeRoots) == 1 then
player:setStorageValue(Storage.Oramond.HarvestedRootCount, harvestedCount + 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete the tab

end
elseif((rand >= 50) and (rand < 100)) then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Your harvesting attempt destroyed more of the juicy roots than you could salvage.')
item:transform(item.itemid + 2)
addEvent(revertRoot, 300000, toPosition, 23478, 23476)
toPosition:sendMagicEffect(CONST_ME_MAGIC_GREEN)
end
end
return true
end
105 changes: 105 additions & 0 deletions data/actions/scripts/valuables/unrealizedDream.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great update.

I hope saying this won't demotivate you,
but chances are not correct and shouldn't the player himself go to the dreamcatcher device?

http://tibia.wikia.com/wiki/Unrealized_Dream/Statistics

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

easy loop here bra

local amountOfPlayers = 1
local spectators = Game.getSpectators(Position(33628, 32370, 5), false, true, 20, 20, 20, 20)
if #spectators < amountOfPlayers then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "you need a dreamcatcher device.")
return true
end

--Unrealized Dream--
chance = math.random(1,22)

if chance == 1 then
player:addItem(2111,1) -- Snowball
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. You wished for something cool.")

elseif chance == 2 then
player:addItem(2223,1) -- Rubbish
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. You knew it would be some rubbish!")

elseif chance == 3 then
player:addItem(2114,1) -- Piggy Bank
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. You just thought about your wealth.")

elseif chance == 4 then
player:addItem(2745,1) -- Blue Rose
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. You just thought about spring.")

elseif chance == 5 then
player:addItem(2072,1) -- Lute
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. Well, part of. You thought about getting rich and a pile of loot...")

elseif chance == 6 then
player:addItem(9074,1) -- Present (Explosive)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. You were that curious for the surprise.")

elseif chance == 7 then
player:addItem(2657,1) -- Simple Dress
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and ... Oops, where did that dream come from?")

elseif chance == 8 then
player:addItem(22604,1) -- Silver Prison Key
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. You just thought about a true challenge.")

elseif chance == 9 then
player:addItem(7735,1) -- Spellwand
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. Somehow you seemed to get distracted when you thought of Ferumbras.")

elseif chance == 10 then
player:addItem(5792,1) -- Die
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. You just wondered if you\'d be lucky this time.")

elseif chance == 11 then
player:addItem(2560,1) -- Mirror
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. You shouldn\'t really think about yourself that often.")

elseif chance == 12 then
player:addItem(22396,1) -- Cluster of Solace
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "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.")

elseif chance == 13 then
player:addItem(2666,1) -- Meat
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. Unfortunately you were subconsciouly thinking about something to eat.")

elseif chance == 14 then
player:addItem(5929,1) -- Goldfish Bowl
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. You just thought about a loyal companion.")

elseif chance == 15 then
player:addItem(22605,1) -- Copper Prison Key
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. You just thought about a true challenge.")

elseif chance == 16 then
player:addItem(22606,1) -- Bronze Prison Key
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. You just thought about a true challenge.")

elseif chance == 17 then
player:addItem(22607,1) -- Golden Prison Key
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. You just thought about a true challenge.")

elseif chance == 18 then
player:addItem(2121,1) -- Wedding Ring
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. You wonder what were you thinking about.")

elseif chance == 19 then
player:addItem(2355,1) -- Stuffed Bunny
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. You just thought about having a true friend.")

elseif chance == 20 then
player:addItem(22609,1) -- Dream Warden Claw
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. You wonder what were you thinking about.")

elseif chance == 21 then
player:addItem(7459,1) -- Pair of Earmuffs
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. Sadly you had cold ears just in that moment.")

elseif chance == 22 then
player:addItem(13537,1) -- Bag of Apple Slices
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You try to concentrate and your dream comes true. You thought about your sore feet.")
end

item:getPosition():sendMagicEffect(26)
item:remove(1)
return true
end
14 changes: 9 additions & 5 deletions data/items/items.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9001,7 +9001,7 @@
<item id="5791" article="a" name="stuffed dragon">
<attribute key="weight" value="850" />
</item>
<item fromid="5792" toid="5797" article="a" name="dice">
<item fromid="5792" toid="5797" article="a" name="die">
<attribute key="weight" value="200" />
</item>
<item id="5798" article="an" name="abacus">
Expand Down Expand Up @@ -24106,9 +24106,13 @@
<item id="16096" article="a" name="dung ball">
<attribute key="weight" value="190" />
</item>
<item id="16099" article="a" name="cake cabinet kit">
<attribute key="description" value="Use it in your house to construct a cake cabinet." />
<attribute key="weight" value="7500" />
<item id="16097" article="a" name="cake cabinet">
<attribute key="containerSize" value="8" />
<attribute key="rotateTo" value="16098" />
</item>
<item id="16098" article="a" name="cake cabinet">
<attribute key="containerSize" value="8" />
<attribute key="rotateTo" value="16097" />
</item>
<item id="16101" article="a" name="premium scroll">
<attribute key="description" value="Using this scroll will add 30 days of premium time to your account once." />
Expand Down Expand Up @@ -30648,7 +30652,7 @@
<attribute key="slotType" value="two-handed" />
<attribute key="weight" value="9600" />
</item>
<item id="23662" name="juicy roots">
<item id="23662" name="juicy roots" plural="juicy roots">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need since the name dosen't change

<attribute key="weight" value="200" />
</item>
<item id="23663" article="a" name="feedbag">
Expand Down
Loading