local storage = {
[1] = {17070,function(hmax,hmin,cid) doCreatureAddHealth(cid, math.random(hmin,hmax)) end},
[2] = {17071,function(hmax,hmin,cid) doCreatureAddMana(cid, math.random(hmin,hmax)) end},
[3] = {17072,function(hmax,hmin,cid) doCreatureAddHealth(cid, math.random(hmin[1],hmax[1])) doCreatureAddMana(cid, math.random(hmin[2],hmax[2])) end},
}
local potions = {
-- Small
[7620] = {lvl=0,tipo=2,hmax=101,hmin=100,vasio=7636,vocs={0,1,2,3,4,5,6,7,8},exaust=1},
[7618] = {lvl=0,tipo=1,hmax=100,hmin=50,vasio=7636,vocs={0,1,2,3,4,5,6,7,8},exaust=1},
[8474] = {lvl=0,tipo=1,hmax=100,hmin=50,vasio=7636,vocs={0,1,2,3,4,5,6,7,8},exaust=1},
-- Strong
[7589] = {lvl=50,tipo=2,hmax=190,hmin=110,vasio=7634,vocs={0,1,2,3,5,6,7},exaust=1},
[7588] = {lvl=50,tipo=1,hmax=400,hmin=200,vasio=7634,vocs={0,3,4,7,8},exaust=1},
-- Great
[7591] = {lvl=80,tipo=1,hmax=800,hmin=600,vasio=7635,vocs={0,4,8},exaust=1},
[7590] = {lvl=80,tipo=2,hmax=800,hmin=600,vasio=7635,vocs={0,1,2,5,6},exaust=1},
[8472] = {lvl=80,tipo=3,hmax={400,190},hmin={200,110},vasio=7635,vocs={0,3,7},exaust=1},
-- Ultimate
[8473] = {lvl=130,tipo=1,hmax=1000,hmin=800,vasio=7635,vocs={0,4,8,0,0},exaust=1},
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if isPlayer(itemEx.uid) == false or potions[item.itemid] == nil or isCreature(itemEx.uid) == false then
return FALSE
elseif getPlayerStorageValue(itemEx.uid, storage[potions[item.itemid].tipo][1]) > os.time() and (type(getPlayerStorageValue(itemEx.uid, storage[potions[item.itemid].tipo][1])) == 'number' and getPlayerStorageValue(itemEx.uid, storage[potions[item.itemid].tipo][1]) ~= -1) then
doPlayerSendDefaultCancel(itemEx.uid, RETURNVALUE_YOUAREEXHAUSTED)
return TRUE
elseif getPlayerLevel(itemEx.uid) < potions[item.itemid].lvl or isInArray(potions[item.itemid].vocs,getPlayerVocation(itemEx.uid)) == FALSE then
doCreatureSay(itemEx.uid, "Only required vocation and level "..potions[item.itemid].lvl.." or above may drink this fluid.", TALKTYPE_ORANGE_1)
return TRUE
end
setPlayerStorageValue(itemEx.uid, storage[potions[item.itemid].tipo][1], os.time()+potions[item.itemid].exaust)
storage[potions[item.itemid].tipo][2](potions[item.itemid].hmax,potions[item.itemid].hmin,itemEx.uid)
local _, _, cnt =string.find(getItemName(item.uid),'(%d+)')
if tonumber(cnt) ~= nil and tonumber(cnt) > 1 then
local _, _, cnt =string.find(getItemName(item.uid),'(%d+)')
setItemName(item.uid, getItemNameById(item.itemid).." x "..cnt-1)
else
doRemoveItem(item.uid,1)
end
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
return TRUE
end
local config = {
removeOnUse = "no",
usableOnTarget = "yes", -- can be used on target? (fe. healing friend)
splashable = "no",
realAnimation = "no", -- make text effect visible only for players in range 1x1
healthMultiplier = 1.0,
manaMultiplier = 1.0
}
config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.usableOnTarget = getBooleanFromString(config.usableOnTarget)
config.splashable = getBooleanFromString(config.splashable)
config.realAnimation = getBooleanFromString(config.realAnimation)
local POTIONS = {
[8704] = {empty = 7636, splash = 2, health = {50, 100}}, -- small health potion
[7618] = {empty = 7636, splash = 2, health = {100, 200}}, -- health potion
[7588] = {empty = 7634, splash = 2, health = {200, 400}, level = 50, vocations = {3, 4, 7, 8, 11 ,12}, vocStr = "knights and paladins"}, -- strong health potion
[7591] = {empty = 7635, splash = 2, health = {500, 700}, level = 80, vocations = {4, 8, 12}, vocStr = "knights"}, -- great health potion
[8473] = {empty = 7635, splash = 2, health = {800, 1000}, level = 130, vocations = {4, 8, 12}, vocStr = "knights"}, -- ultimate health potion
[7620] = {empty = 7636, splash = 7, mana = {70, 130}}, -- mana potion
[7589] = {empty = 7634, splash = 7, mana = {110, 190}, level = 50, vocations = {1, 2, 3, 5, 6, 7, 9, 10, 11}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion
[7590] = {empty = 7635, splash = 7, mana = {200, 300}, level = 80, vocations = {1, 2, 5, 6, 9, 10}, vocStr = "sorcerers and druids"}, -- great mana potion
[8472] = {empty = 7635, splash = 3, health = {200, 400}, mana = {110, 190}, level = 80, vocations = {3, 7, 11}, vocStr = "paladins"} -- great spirit potion
}
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (1000))
function onUse(cid, item, fromPosition, itemEx, toPosition)
local potion = POTIONS[item.itemid]
if(not potion) then
return false
end
if(not isPlayer(itemEx.uid) or (not config.usableOnTarget and cid ~= itemEx.uid)) then
if(not config.splashable) then
return false
end
if(toPosition.x == CONTAINER_POSITION) then
toPosition = getThingPos(item.uid)
end
doDecayItem(doCreateItem(2016, potion.splash, toPosition))
if(fromPosition.x == CONTAINER_POSITION) then
--doCreateItem(potion.empty, 1, getThingPos(item.uid)) --fix me!!!
doRemoveItem(item.uid, 1)
else
doCreateItem(potion.empty, 1, getThingPos(item.uid))
doRemoveItem(item.uid, 1)
end
return true
end
if(hasCondition(cid, CONDITION_EXHAUST)) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
return true
end
if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and
not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES))
then
doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1)
return true
end
local health = potion.health
if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.healthMultiplier))) then
return false
end
local mana = potion.mana
if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.manaMultiplier))) then
return false
end
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
if(not realAnimation) then
doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
else
for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
if(isPlayer(tid)) then
doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1, false, tid)
end
end
end
doAddCondition(cid, exhaust)
if(not potion.empty or config.removeOnUse) then
doRemoveItem(item.uid)
return true
end
if(fromPosition.x == CONTAINER_POSITION) then
--doCreateItem(potion.empty, 1, getThingPos(item.uid)) --fix me!!!
doRemoveItem(item.uid, 1)
else
doCreateItem(potion.empty, 1, getThingPos(item.uid))
doRemoveItem(item.uid, 1)
end
--doTransformItem(item.uid, potion.empty, 1)
return true
end
if(!itemCount)
{
/* if(item->isRune())
countMap[item->getID()] += item->getCharges();
else */
countMap[item->getID()] += item->getItemCount();
}
else
function onSay(cid, words, param, channel)
if(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
return true
end
local t = string.explode(param, ",")
t[1] = tonumber(t[1])
if(not t[1]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires numeric param.")
return true
end
local pid = cid
if(t[2]) then
pid = getPlayerByNameWildcard(t[2])
if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[2] .. " not found.")
return true
end
end
if(t[1] <= 1 or t[1] == 135 or (t[1] > 160 and t[1] < 192) or t[1] > 367) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Such outfit does not exist.")
return true
end
local tmp = getCreatureOutfit(pid)
tmp.lookType = t[1]
doCreatureChangeOutfit(pid, tmp)
return true
end
.../
find-> {"insects", MAGIC_EFFECT_INSECTS},
add-> {"dragonhead", MAGIC_EFFECT_DRAGONHEAD}
};
.../
find-> MAGIC_EFFECT_INSECTS = 0x44, //68
add-> MAGIC_EFFECT_DRAGONHEAD = 0x45, //69
change-> MAGIC_EFFECT_LAST = MAGIC_EFFECT_DRAGONHEAD,
I'm fix
you have new monsters or items?
New effect:
tools.cpp
const.hCode:.../ find-> {"insects", MAGIC_EFFECT_INSECTS}, add-> {"dragonhead", MAGIC_EFFECT_DRAGONHEAD} };
Code:.../ find-> MAGIC_EFFECT_INSECTS = 0x44, //68 add-> MAGIC_EFFECT_DRAGONHEAD = 0x45, //69 change-> MAGIC_EFFECT_LAST = MAGIC_EFFECT_DRAGONHEAD,
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
@fireelement
Please fix potions.lua from 04dev ;]
and how add wayfarer outfit?
<?xml version="1.0"?>
<outfits>
<outfit id="1">
<list gender="0" lookType="136" name="Citizen"/>
<list gender="1" lookType="128" name="Citizen"/>
</outfit>
<outfit id="2">
<list gender="0" lookType="137" name="Hunter"/>
<list gender="1" lookType="129" name="Hunter"/>
</outfit>
<outfit id="3">
<list gender="0" lookType="138" name="Mage"/>
<list gender="1" lookType="130" name="Mage"/>
</outfit>
<outfit id="4">
<list gender="0" lookType="139" name="Knight"/>
<list gender="1" lookType="131" name="Knight"/>
</outfit>
<outfit id="5" premium="yes">
<list gender="0" lookType="140" name="Noblewoman"/>
<list gender="1" lookType="132" name="Nobleman"/>
</outfit>
<outfit id="6" premium="yes">
<list gender="0" lookType="141" name="Summoner"/>
<list gender="1" lookType="133" name="Summoner"/>
</outfit>
<outfit id="7" premium="yes">
<list gender="0" lookType="142" name="Warrior"/>
<list gender="1" lookType="134" name="Warrior"/>
</outfit>
<outfit id="8" premium="yes">
<list gender="0" lookType="147" name="Barbarian"/>
<list gender="1" lookType="143" name="Barbarian"/>
</outfit>
<outfit id="9" premium="yes">
<list gender="0" lookType="148" name="Druid"/>
<list gender="1" lookType="144" name="Druid"/>
</outfit>
<outfit id="10" premium="yes">
<list gender="0" lookType="149" name="Wizard"/>
<list gender="1" lookType="145" name="Wizard"/>
</outfit>
<outfit id="11" premium="yes">
<list gender="0" lookType="150" name="Oriental"/>
<list gender="1" lookType="146" name="Oriental"/>
</outfit>
<outfit id="12" premium="yes">
<list gender="0" lookType="155" name="Pirate"/>
<list gender="1" lookType="151" name="Pirate"/>
</outfit>
<outfit id="13" premium="yes">
<list gender="0" lookType="156" name="Assassin"/>
<list gender="1" lookType="152" name="Assassin"/>
</outfit>
<outfit id="14" premium="yes">
<list gender="0" lookType="157" name="Beggar"/>
<list gender="1" lookType="153" name="Beggar"/>
</outfit>
<outfit id="15" premium="yes">
<list gender="0" lookType="158" name="Shaman"/>
<list gender="1" lookType="154" name="Shaman"/>
</outfit>
<outfit id="16" premium="yes">
<list gender="0" lookType="252" name="Norsewoman"/>
<list gender="1" lookType="251" name="Norseman"/>
</outfit>
<outfit id="17" premium="yes">
<list gender="0" lookType="269" name="Nightmare"/>
<list gender="1" lookType="268" name="Nightmare"/>
</outfit>
<outfit id="18" premium="yes">
<list gender="0" lookType="270" name="Jester"/>
<list gender="1" lookType="273" name="Jester"/>
</outfit>
<outfit id="19" premium="yes">
<list gender="0" lookType="279" name="Brotherhood"/>
<list gender="1" lookType="278" name="Brotherhood"/>
</outfit>
<outfit id="20" premium="yes">
<list gender="0" lookType="288" name="Demonhunter"/>
<list gender="1" lookType="289" name="Demonhunter"/>
</outfit>
<outfit id="21" premium="yes">
<list gender="0" lookType="324" name="Yalaharian"/>
<list gender="1" lookType="325" name="Yalaharian"/>
</outfit>
<outfit id="22" premium="yes">
<list gender="0" lookType="336" name="Warmaster"/>
<list gender="1" lookType="335" name="Warmaster"/>
</outfit>
<outfit id="23" default="0">
<list gender="0" lookType="329" name="Wife"/>
<list gender="1" lookType="328" name="Husband"/>
</outfit>
<outfit id="24" premium="yes">
<list gender="0" lookType="366" name="Wayfarer"/>
<list gender="1" lookType="367" name="Wayfarer"/>
</outfit>
</outfits>
local config = {
removeOnUse = "no",
usableOnTarget = "yes", -- can be used on target? (fe. healing friend)
splashable = "no",
realAnimation = "no", -- make text effect visible only for players in range 1x1
healthMultiplier = 1.0,
manaMultiplier = 1.0
}
config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.usableOnTarget = getBooleanFromString(config.usableOnTarget)
config.splashable = getBooleanFromString(config.splashable)
config.realAnimation = getBooleanFromString(config.realAnimation)
local POTIONS = {
[8704] = {empty = 7636, splash = 2, health = {50, 100}}, -- small health potion
[7618] = {empty = 7636, splash = 2, health = {100, 200}}, -- health potion
[7588] = {empty = 7634, splash = 2, health = {200, 400}, level = 50, vocations = {3, 4, 7, 8}, vocStr = "knights and paladins"}, -- strong health potion
[7591] = {empty = 7635, splash = 2, health = {500, 700}, level = 80, vocations = {4, 8}, vocStr = "knights"}, -- great health potion
[8473] = {empty = 7635, splash = 2, health = {800, 1000}, level = 130, vocations = {4, 8}, vocStr = "knights"}, -- ultimate health potion
[7620] = {empty = 7636, splash = 7, mana = {70, 130}}, -- mana potion
[7589] = {empty = 7634, splash = 7, mana = {110, 190}, level = 50, vocations = {1, 2, 3, 5, 6, 7}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion
[7590] = {empty = 7635, splash = 7, mana = {200, 300}, level = 80, vocations = {1, 2, 5, 6}, vocStr = "sorcerers and druids"}, -- great mana potion
[8472] = {empty = 7635, splash = 3, health = {200, 400}, mana = {110, 190}, level = 80, vocations = {3, 7}, vocStr = "paladins"} -- great spirit potion
}
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))
function onUse(cid, item, fromPosition, itemEx, toPosition)
local potion = POTIONS[item.itemid]
if(not potion) then
return false
end
if(not isPlayer(itemEx.uid) or (not config.usableOnTarget and cid ~= itemEx.uid)) then
if(not config.splashable) then
return false
end
if(toPosition.x == CONTAINER_POSITION) then
toPosition = getThingPos(item.uid)
end
doDecayItem(doCreateItem(2016, potion.splash, toPosition))
doTransformItem(item.uid, potion.empty)
return true
end
if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
return true
end
if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and
not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES))
then
doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1)
return true
end
local health = potion.health
if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.healthMultiplier))) then
return false
end
local mana = potion.mana
if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.manaMultiplier))) then
return false
end
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
if(not realAnimation) then
doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
else
for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
if(isPlayer(tid)) then
doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1, false, tid)
end
end
end
doAddCondition(cid, exhaust)
if(not potion.empty or config.removeOnUse) then
doRemoveItem(item.uid, 1)
return true
end
doRemoveItem(item.uid, 1)
doPlayerAddItem(cid, potion.empty, 1)
return true
end
here you guys have 8.60 items.otb (not final)
http://opentibia.svn.sourceforge.ne...60/items/items.otb?revision=5502&pathrev=5502
nice
how to edit RME to support 8.6?
potions.lua (empty potions worked)
Lua:local config = { removeOnUse = "no", usableOnTarget = "yes", -- can be used on target? (fe. healing friend) splashable = "no", realAnimation = "no", -- make text effect visible only for players in range 1x1 healthMultiplier = 1.0, manaMultiplier = 1.0 } config.removeOnUse = getBooleanFromString(config.removeOnUse) config.usableOnTarget = getBooleanFromString(config.usableOnTarget) config.splashable = getBooleanFromString(config.splashable) config.realAnimation = getBooleanFromString(config.realAnimation) local POTIONS = { [8704] = {empty = 7636, splash = 2, health = {50, 100}}, -- small health potion [7618] = {empty = 7636, splash = 2, health = {100, 200}}, -- health potion [7588] = {empty = 7634, splash = 2, health = {200, 400}, level = 50, vocations = {3, 4, 7, 8}, vocStr = "knights and paladins"}, -- strong health potion [7591] = {empty = 7635, splash = 2, health = {500, 700}, level = 80, vocations = {4, 8}, vocStr = "knights"}, -- great health potion [8473] = {empty = 7635, splash = 2, health = {800, 1000}, level = 130, vocations = {4, 8}, vocStr = "knights"}, -- ultimate health potion [7620] = {empty = 7636, splash = 7, mana = {70, 130}}, -- mana potion [7589] = {empty = 7634, splash = 7, mana = {110, 190}, level = 50, vocations = {1, 2, 3, 5, 6, 7}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion [7590] = {empty = 7635, splash = 7, mana = {200, 300}, level = 80, vocations = {1, 2, 5, 6}, vocStr = "sorcerers and druids"}, -- great mana potion [8472] = {empty = 7635, splash = 3, health = {200, 400}, mana = {110, 190}, level = 80, vocations = {3, 7}, vocStr = "paladins"} -- great spirit potion } local exhaust = createConditionObject(CONDITION_EXHAUST) setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100)) function onUse(cid, item, fromPosition, itemEx, toPosition) local potion = POTIONS[item.itemid] if(not potion) then return false end if(not isPlayer(itemEx.uid) or (not config.usableOnTarget and cid ~= itemEx.uid)) then if(not config.splashable) then return false end if(toPosition.x == CONTAINER_POSITION) then toPosition = getThingPos(item.uid) end doDecayItem(doCreateItem(2016, potion.splash, toPosition)) doTransformItem(item.uid, potion.empty) return true end if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED) return true end if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES)) then doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1) return true end local health = potion.health if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.healthMultiplier))) then return false end local mana = potion.mana if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.manaMultiplier))) then return false end doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE) if(not realAnimation) then doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1) else for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do if(isPlayer(tid)) then doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1, false, tid) end end end doAddCondition(cid, exhaust) if(not potion.empty or config.removeOnUse) then doRemoveItem(item.uid, 1) return true end doRemoveItem(item.uid, 1) doPlayerAddItem(cid, potion.empty, 1) return true end