Skip to content

Commit

Permalink
update datapack
Browse files Browse the repository at this point in the history
  • Loading branch information
MillhioreBT committed Apr 4, 2024
1 parent 15ea75c commit ec80b8a
Show file tree
Hide file tree
Showing 11 changed files with 508 additions and 219 deletions.
71 changes: 71 additions & 0 deletions data/actions/scripts/other/construction_kits.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
local constructionKits = {
[3901] = 1666,
[3902] = 1670,
[3903] = 1652,
[3904] = 1674,
[3905] = 1658,
[3906] = 3813,
[3907] = 3817,
[3908] = 1619,
[3909] = 12799,
[3910] = 2105,
[3911] = 1614,
[3912] = 3806,
[3913] = 3807,
[3914] = 3809,
[3915] = 1716,
[3916] = 1724,
[3917] = 1732,
[3918] = 1775,
[3919] = 1774,
[3920] = 1750,
[3921] = 3832,
[3922] = 2095,
[3923] = 2098,
[3924] = 2064,
[3925] = 2582,
[3926] = 2117,
[3927] = 1728,
[3928] = 1442,
[3929] = 1446,
[3930] = 1447,
[3931] = 2034,
[3932] = 2604,
[3933] = 2080,
[3934] = 2084,
[3935] = 3821,
[3936] = 3811,
[3937] = 2101,
[3938] = 3812,
[5086] = 5046,
[5087] = 5055,
[5088] = 5056,
[6114] = 6111,
[6115] = 6109,
[6372] = 6356,
[6373] = 6371,
[8692] = 8688,
[9974] = 9975,
[11126] = 11127,
[11133] = 11129,
[11124] = 11125,
[11205] = 11203
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local kit = constructionKits[item.itemid]
if not kit then return false end

local tile = Tile(item:getPosition())
if tile and tile:getHouse() then
if fromPosition.x ~= CONTAINER_POSITION then
item:transform(kit)
fromPosition:sendMagicEffect(CONST_ME_POFF)
else
player:sendTextMessage(MESSAGE_STATUS_SMALL, "Put the construction kit on the floor first.")
end
else
player:sendTextMessage(MESSAGE_STATUS_SMALL, "You may construct this only inside a house.")
end
return true
end
50 changes: 11 additions & 39 deletions data/actions/scripts/other/music.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,10 @@ local instruments = {
[2077] = {effect = CONST_ME_SOUND_GREEN}, -- royal fanfare
[2078] = {effect = CONST_ME_SOUND_GREEN}, -- post horn
[2079] = {effect = CONST_ME_SOUND_GREEN}, -- war horn
[2080] = {
effects = {failure = CONST_ME_SOUND_PURPLE, success = CONST_ME_SOUND_GREEN},
chance = 50
}, -- piano
[2081] = {
effects = {failure = CONST_ME_SOUND_PURPLE, success = CONST_ME_SOUND_GREEN},
chance = 50
}, -- piano
[2082] = {
effects = {failure = CONST_ME_SOUND_PURPLE, success = CONST_ME_SOUND_GREEN},
chance = 50
}, -- piano
[2083] = {
effects = {failure = CONST_ME_SOUND_PURPLE, success = CONST_ME_SOUND_GREEN},
chance = 50
}, -- piano
[2080] = {effects = {failure = CONST_ME_SOUND_PURPLE, success = CONST_ME_SOUND_GREEN}, chance = 50}, -- piano
[2081] = {effects = {failure = CONST_ME_SOUND_PURPLE, success = CONST_ME_SOUND_GREEN}, chance = 50}, -- piano
[2082] = {effects = {failure = CONST_ME_SOUND_PURPLE, success = CONST_ME_SOUND_GREEN}, chance = 50}, -- piano
[2083] = {effects = {failure = CONST_ME_SOUND_PURPLE, success = CONST_ME_SOUND_GREEN}, chance = 50}, -- piano
[2084] = {effect = CONST_ME_SOUND_GREEN}, -- harp
[2085] = {effect = CONST_ME_SOUND_GREEN}, -- harp
[2332] = {effect = CONST_ME_SOUND_GREEN}, -- Waldo's post horn
Expand All @@ -42,10 +30,7 @@ local instruments = {
[2372] = {effect = CONST_ME_SOUND_GREEN}, -- lyre (immovable)
[2373] = {effect = CONST_ME_SOUND_GREEN}, -- panpipes (immovable)
[3951] = {effect = CONST_ME_SOUND_BLUE}, -- bongo drum (actual effect is unknown)
[3952] = {
effects = {failure = CONST_ME_POFF, success = CONST_ME_SOUND_GREEN},
chance = 20
}, -- didgeridoo
[3952] = {effects = {failure = CONST_ME_POFF, success = CONST_ME_SOUND_GREEN}, chance = 20}, -- didgeridoo
[3953] = {effect = CONST_ME_SOUND_RED}, -- war drum
[3957] = {
effect = CONST_ME_SOUND_YELLOW,
Expand All @@ -60,18 +45,8 @@ local instruments = {
chance = 60,
remove = true
}, -- wooden whistle
[6572] = {
effect = CONST_ME_SOUND_GREEN,
text = "TOOOOOOT",
transformId = 13578,
decayId = 6572
}, -- party trumpet
[6573] = {
effect = CONST_ME_SOUND_GREEN,
text = "TOOOOOOT",
transformId = 13578,
decayId = 6573
} -- party trumpet
[6572] = {effect = CONST_ME_SOUND_GREEN, text = "TOOOOOOT", transformId = 13578, decayId = 6572}, -- party trumpet
[6573] = {effect = CONST_ME_SOUND_GREEN, text = "TOOOOOOT", transformId = 13578, decayId = 6573} -- party trumpet
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
Expand All @@ -80,21 +55,18 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)
chance = instrument.chance >= math.random(1, 100)

if instrument.monster and chance then
local monster = Game.createMonster(instrument.monster, player:getPosition(),
true)
local monster = Game.createMonster(instrument.monster, player:getPosition(), true)
if monster then player:addSummon(monster) end
elseif instrument.itemId and chance then
player:addItem(instrument.itemId, instrument.itemCount)
end
end

item:getPosition():sendMagicEffect(instrument.effect or instrument.effects and
chance and instrument.effects.success or
instrument.effects.failure)
item:getPosition():sendMagicEffect(instrument.effect or instrument.effects and chance and
instrument.effects.success or instrument.effects.failure)

if instrument.transformId then
player:say(instrument.text, TALKTYPE_MONSTER_SAY, false, nil,
item:getPosition())
player:say(instrument.text, TALKTYPE_MONSTER_SAY, false, nil, item:getPosition())
item:transform(instrument.transformId)
item:decay(instrument.decayId)
end
Expand Down
Loading

0 comments on commit ec80b8a

Please sign in to comment.