Skip to content

Commit

Permalink
reverted changegold.lua and piggybank.lua
Browse files Browse the repository at this point in the history
a small patch
  • Loading branch information
andypsylon committed Mar 26, 2014
1 parent badb6fe commit 6c3276d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 22 deletions.
16 changes: 8 additions & 8 deletions data/actions/scripts/other/changegold.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 2148 and item.type == 100 then -- gold coin
if item.itemid == ITEM_GOLD_COIN and item.type == ITEMCOUNT_MAX then
Item(item.uid):remove()
Player(cid):addItem(2152, 1) -- platinum coin
elseif item.itemid == 2152 and item.type == 100 then -- platinum coin
Player(cid):addItem(ITEM_PLATINUM_COIN, 1)
elseif item.itemid == ITEM_PLATINUM_COIN and item.type == ITEMCOUNT_MAX then
Item(item.uid):remove()
Player(cid):addItem(2160, 1) -- crystal coin
elseif item.itemid == 2152 and item.type < 100 then -- platinum coin
Player(cid):addItem(ITEM_CRYSTAL_COIN, 1)
elseif item.itemid == ITEM_PLATINUM_COIN and item.type < ITEMCOUNT_MAX then
Item(item.uid):transform(item.itemid, item.type - 1)
Player(cid):addItem(2148, 100) -- gold coin
elseif item.itemid == 2160 then -- crystal coin
Player(cid):addItem(ITEM_GOLD_COIN, ITEMCOUNT_MAX)
elseif item.itemid == ITEM_CRYSTAL_COIN then
Item(item.uid):transform(item.itemid, item.type - 1)
Player(cid):addItem(2152, 100) -- platinum coin
Player(cid):addItem(ITEM_PLATINUM_COIN, ITEMCOUNT_MAX)
else
return false
end
Expand Down
4 changes: 2 additions & 2 deletions data/actions/scripts/other/piggybank.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ function onUse(cid, item, fromPosition, itemEx, toPosition)

if math.random(6) == 1 then
fromPosition:sendMagicEffect(CONST_ME_POFF)
player:addItem(2148, 1) -- gold coin
player:addItem(ITEM_GOLD_COIN, 1)
Item(item.uid):transform(2115)
else
fromPosition:sendMagicEffect(CONST_ME_SOUND_YELLOW)
player:addItem(2152, 1) -- platinum coin
player:addItem(ITEM_PLATINUM_COIN, 1)
end

return true
Expand Down
14 changes: 7 additions & 7 deletions data/actions/scripts/quests/annihilator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ local newPosition = {
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 1945 then
local players = {}
for _, posi in ipairs(playerPosition) do
local pl = Tile(posi):getTopCreature()
if pl == nil or not pl:isPlayer() or pl:getLevel() < 100 or pl:getStorageValue(30015) ~= -1 then
for _, pos in ipairs(playerPosition) do
local player = Tile(pos):getTopCreature()
if player == nil or not player:isPlayer() or player:getLevel() < 100 or player:getStorageValue(30015) ~= -1 then
Player(cid):sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_NOTPOSSIBLE))
return false
end
players[#players+1] = pl
players[#players+1] = player
end
for i, pl in ipairs(players) do
for i, player in ipairs(players) do
Position(playerPosition[i]):sendMagicEffect(CONST_ME_POFF)
pl:teleportTo(newPosition[i], false)
pl:getPosition():sendMagicEffect(CONST_ME_ENERGYAREA)
player:teleportTo(newPosition[i], false)
player:getPosition():sendMagicEffect(CONST_ME_ENERGYAREA)
end
Item(item.uid):transform(1946)
elseif item.itemid == 1946 then
Expand Down
11 changes: 6 additions & 5 deletions data/actions/scripts/quests/quests.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
local annihilatorReward = {1990, 2400, 2431, 2494}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.uid > 1000 and item.uid <= 22670 then
local itemWeight = ItemType(item.itemid):getWeight(false)
local itemType = ItemType(item.itemid)
local itemWeight = itemType:getWeight(false)
local player = Player(cid)
local playerCap = player:getFreeCapacity()
if isInArray(annihilatorReward, item.uid) then
Expand All @@ -12,21 +13,21 @@ function onUse(cid, item, fromPosition, itemEx, toPosition)
else
player:addItem(item.uid, 1)
end
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. ItemType(item.itemid):getName() .. '.')
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. '.')
player:setStorageValue(30015, 1)
else
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. ItemType(item.itemid):getName() .. ' weighing ' .. itemWeight .. ' oz it\'s too heavy.')
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. ' weighing ' .. itemWeight .. ' oz it\'s too heavy.')
end
else
player:sendTextMessage(MESSAGE_INFO_DESCR, "It is empty.")
end
elseif player:getStorageValue(item.uid) == -1 then
if playerCap >= itemWeight then
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. ItemType(item.itemid):getName() .. '.')
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. '.')
player:addItem(item.uid, 1)
player:setStorageValue(item.uid, 1)
else
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. ItemType(item.itemid):getName() .. ' weighing ' .. itemWeight .. ' oz it\'s too heavy.')
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. ' weighing ' .. itemWeight .. ' oz it\'s too heavy.')
end
else
player:sendTextMessage(MESSAGE_INFO_DESCR, "It is empty.")
Expand Down

0 comments on commit 6c3276d

Please sign in to comment.