local config = {
waterIds = {493, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625},
rateSkill = getConfigValue("rateSkill"),
allowFromPz = false,
useWorms = true
}
local v = {
[{200,80}] = {name = "Enraged Water Elemental", chance = 10}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if not isInArray(config.waterIds, itemEx.itemid) then
return false
end
if (config.allowFromPz or not getTileInfo(getThingPos(cid)).protection) and itemEx.itemid ~= 493 and math.random((100 + (getPlayerSkill(cid, SKILL_FISHING) / 50))) < getPlayerSkill(cid, SKILL_FISHING) and (not config.useWorms or (getPlayerItemCount(cid, ITEM_WORM) > 0 and doPlayerRemoveItem(cid, ITEM_WORM, 1))) then
local bsMessage = "%s have caught %s"
for i, k in pairs(v) do
if getPlayerLevel(cid) >= i[1] and getPlayerSkillLevel(cid, SKILL_FISHING) >= i[2] then
local c = math.random(100)
if c <= k.chance then
doSummonCreature(k.name, getThingPos(cid))
end
end
if k.broadcast then
doBroadcastMessage(bsMessage:format(getCreatureName(cid), k.name))
break
end
end
end
return doSendMagicEffect(toPosition, CONST_ME_LOSEENERGY)
end
waterIds = {493, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625},
rateSkill = getConfigValue("rateSkill"),
allowFromPz = false,
useWorms = true
}
local v = {
[{200,80}] = {name = "Enraged Water Elemental", chance = 10}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if not isInArray(config.waterIds, itemEx.itemid) then
return false
end
if (config.allowFromPz or not getTileInfo(getThingPos(cid)).protection) and itemEx.itemid ~= 493 and math.random((100 + (getPlayerSkill(cid, SKILL_FISHING) / 50))) < getPlayerSkill(cid, SKILL_FISHING) and (not config.useWorms or (getPlayerItemCount(cid, ITEM_WORM) > 0 and doPlayerRemoveItem(cid, ITEM_WORM, 1))) then
local bsMessage = "%s have caught %s"
for i, k in pairs(v) do
if getPlayerLevel(cid) >= i[1] and getPlayerSkillLevel(cid, SKILL_FISHING) >= i[2] then
local c = math.random(100)
if c <= k.chance then
doSummonCreature(k.name, getThingPos(cid))
end
end
if k.broadcast then
doBroadcastMessage(bsMessage:format(getCreatureName(cid), k.name))
break
end
end
end
return doSendMagicEffect(toPosition, CONST_ME_LOSEENERGY)
end