JDB
OtLand Veteran
- Joined
- Jun 1, 2009
- Messages
- 4,145
- Solutions
- 2
- Reaction score
- 115
The Forgotten Server 0.3.6pl1
Update Log: v1.1
data/actions/actions.xml
data/actions/scripts/runes.lua
Update Log: v1.1
- Checks if you have enough space and cap.
- Charges added to the runes in the shop.
- ALL is easily configurable.
data/actions/actions.xml
PHP:
<action actionid="1000;1001" event="script" value="runes.lua"/>
data/actions/scripts/runes.lua
Code:
local shop = {
[1000] = {
id = 2268, container = 2000, cost = 5000, charges = 3, effect = CONST_ME_GIFT_WRAPS
},
[1001] = {
id = 2273, container = 2001, cost = 3000, charges = 3, effect = CONST_ME_GIFT_WRAPS
}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local v = shop[item.actionid]
local weight = getItemWeightById(v.id, tonumber(getItemInfo(v.container).maxItems)) + getItemWeightById(v.container, 1)
if(getPlayerFreeCap(cid) >= weight) then
if(getPlayerMoney(cid) >= v.cost) then
local bp = doCreateItemEx(cid, v.container, 1)
if(doPlayerAddItemEx(cid, bp) ~= RETURNVALUE_NOERROR) then
doPlayerSendCancel(cid, "Sorry, you do not have enough space.")
else
for i = 1, tonumber(getItemInfo(v.container).maxItems) do
doAddContainerItem(bp, v.id, v.charges or 1)
end
doPlayerRemoveMoney(cid, v.cost)
doSendMagicEffect(getThingPos(cid), v.effect)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have purchased a backpack of " .. getItemInfo(v.id).plural .. ".")
end
else
doPlayerSendCancel(cid, "Sorry, you must have " .. v.cost .. " gold.")
end
else
doPlayerSendCancel(cid, "Sorry, you need " .. weight:format("%.2f") .. " oz. to carry this container of " .. getItemInfo(v.id).plural .. ".")
end
return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
Last edited: