Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="UTF-8"?>
- <mod name="Buffs" version="1.0" author="GarQet" contact="http://otland.net/members/garqet/" enabled="yes">
- <description>
- Add this to your login.lua in creaturescripts:
- registerCreatureEvent(cid, "Buffs_dead")
- registerCreatureEvent(cid, "Buffs_logout")
- registerCreatureEvent(cid, "Buffs_dmg")
- registerCreatureEvent(cid, "Buffs_login")
- </description>
- <config name="buffs"><![CDATA[
- config = {
- spells = {"utamo mage strong", "utamo sorc super strong", "utamo druid super strong", "utamo strong", "utamo super strong", "utamo mega strong", "utamo supro strong", "utamo knight strong", "utamo knight hyper strong", "utamo wizard strong", "utamo priest strong", "utamo archer strong", "utamo warrior strong", "utamo wizard vita strong", "utamo wizard power strong", "utamo priest vita strong", "utamo priest power strong", "utamo archer vita strong", "utamo archer power strong", "utamo warrior vita strong", "utamo warrior power strong"},
- storage = {27280, 27282, 27284, 27286, 27288, 27290, 27292, 27294, 27296, 27298, 27300, 27302, 27304, 27306, 27308, 27310, 27312, 27314, 27316, 27318, 27320},
- storage_block_1 = 27322,
- storage_block_2 = 27324,
- ["utamo mage strong"] = {
- cast_name = "utamo mage strong",
- manacost = 30000,
- vocation = {5, 6},
- level = 200000,
- time = 5,
- mana = TRUE,
- percent = 18
- },
- ["utamo sorc super strong"] = {
- cast_name = "utamo sorc super strong",
- manacost = 30000,
- vocation = {5},
- level = 300000,
- time = 5,
- mana = TRUE,
- percent = 22
- },
- ["utamo wizard strong"] = {
- cast_name = "utamo wizard strong",
- manacost = 30000,
- vocation = {5},
- level = 450000,
- time = 5,
- mana = TRUE,
- percent = 31
- },
- ["utamo wizard vita strong"] = {
- cast_name = "utamo wizard vita strong",
- manacost = 30000,
- vocation = {5},
- level = 650000,
- time = 5,
- mana = TRUE,
- percent = 40
- },
- ["utamo wizard power strong"] = {
- cast_name = "utamo wizard power strong",
- manacost = 3000,
- vocation = {5},
- level = 950000,
- time = 5,
- mana = TRUE,
- percent = 50
- },
- ["utamo druid super strong"] = {
- cast_name = "utamo druid super strong",
- manacost = 30000,
- vocation = {6},
- level = 300000,
- time = 5,
- mana = TRUE,
- percent = 22
- },
- ["utamo priest strong"] = {
- cast_name = "utamo priest strong",
- manacost = 30000,
- vocation = {6},
- level = 450000,
- time = 5,
- mana = TRUE,
- percent = 31
- },
- ["utamo priest vita strong"] = {
- cast_name = "utamo priest vita strong",
- manacost = 30000,
- vocation = {6},
- level = 650000,
- time = 5,
- mana = TRUE,
- percent = 41
- },
- ["utamo priest power strong"] = {
- cast_name = "utamo priest power strong",
- manacost = 30000,
- vocation = {6},
- level = 950000,
- time = 5,
- mana = TRUE,
- percent = 51
- },
- ["utamo strong"] = {
- cast_name = "utamo strong",
- manacost = 30000,
- vocation = {7},
- level = 10000,
- time = 10,
- mana = FALSE,
- percent = 80
- },
- ["utamo super strong"] = {
- cast_name = "utamo super strong",
- manacost = 80000,
- vocation = {7},
- level = 150000,
- time = 10,
- mana = FALSE,
- percent = 100
- },
- ["utamo mega strong"] = {
- cast_name = "utamo mega strong",
- manacost = 160000,
- vocation = {7},
- level = 250000,
- time = 10,
- mana = FALSE,
- percent = 125
- },
- ["utamo supro strong"] = {
- cast_name = "utamo supro strong",
- manacost = 160000,
- vocation = {7},
- level = 3000000,
- time = 10,
- mana = FALSE,
- percent = 135
- },
- ["utamo archer strong"] = {
- cast_name = "utamo archer strong",
- manacost = 160000,
- vocation = {7},
- level = 300000,
- time = 10,
- mana = FALSE,
- percent = 145
- },
- ["utamo archer vita strong"] = {
- cast_name = "utamo archer vita strong",
- manacost = 160000,
- vocation = {7},
- level = 450000,
- time = 10,
- mana = FALSE,
- percent = 153
- },
- ["utamo archer power strong"] = {
- cast_name = "utamo archer power strong",
- manacost = 160000,
- vocation = {7},
- level = 650000,
- time = 10,
- mana = FALSE,
- percent = 162
- },
- ["utamo knight strong"] = {
- cast_name = "utamo knight strong",
- manacost = 30000,
- vocation = {8},
- level = 30000,
- time = 10,
- mana = FALSE,
- percent = 130
- },
- ["utamo knight hyper strong"] = {
- cast_name = "utamo knight hyper strong",
- manacost = 30000,
- vocation = {8},
- level = 300000,
- time = 10,
- mana = FALSE,
- percent = 140
- },
- ["utamo warrior strong"] = {
- cast_name = "utamo warrior strong",
- manacost = 30000,
- vocation = {8},
- level = 300000,
- time = 10,
- mana = FALSE,
- percent = 150
- },
- ["utamo warrior vita strong"] = {
- cast_name = "utamo warrior vita strong",
- manacost = 30000,
- vocation = {8},
- level = 450000,
- time = 10,
- mana = FALSE,
- percent = 160
- },
- ["utamo warrior power strong"] = {
- cast_name = "utamo warrior power strong",
- manacost = 30000,
- vocation = {8},
- level = 650000,
- time = 10,
- mana = FALSE,
- percent = 170
- },
- talents = 4595,
- talents_hp = 25091,
- talents_mp = 25092,
- talents_dmg = 25093,
- rings = {7697, 2357, 10502, 6300},
- boots = {11117, 9933, 7892},
- [7697] = {
- percent_mana = 2,
- percent_hp = 2,
- storage_mana = 27400,
- storage_hp = 27402
- },
- [2357] = {
- percent_mana = 4,
- percent_hp = 4,
- storage_mana = 27404,
- storage_hp = 27406
- },
- [11117] = {
- percent_mana = 10,
- percent_hp = 10,
- storage_mana = 27408,
- storage_hp = 27410
- },
- [10502] = {
- percent_mana = 7,
- percent_hp = 7,
- storage_mana = 27412,
- storage_hp = 27414
- },
- [9933] = {
- percent_mana = 2,
- percent_hp = 2,
- storage_mana = 27416,
- storage_hp = 27418
- },
- [7892] = {
- percent_mana = 3,
- percent_hp = 3,
- storage_mana = 27420,
- storage_hp = 27422
- },
- storage_items = {27400, 27404, 27408, 27412, 27416, 27420},
- storage_IDs = {7697, 2357, 11117, 10502, 9933, 7892},
- additional_knight_hp = 1.81,
- additional_paladin_hp = 1.75
- }
- ]]></config>
- <talkaction words="utamo" event="script"><![CDATA[
- domodlib('buffs')
- local function removeBuff(x)
- if not isPlayer(x.cid) then
- return true
- end
- local time_2 = db.getResult("SELECT `time` FROM `buffs` WHERE `name` = '".. x.nick .."' LIMIT 1;")
- if(time_2:getID() == -1) then
- return true
- end
- local timek = time_2:getDataInt("time")
- time_2:free()
- if(x.tajm_2 ~= timek) then
- return true
- end
- if(x.tajm_2 - x.tajm >= -100) then
- if(x.manas == TRUE) then
- setCreatureMaxMana(x.cid, getCreatureMaxMana(x.cid) - getPlayerStorageValue(x.cid, x.storage_1 + 1))
- else
- setCreatureMaxHealth(x.cid, getCreatureMaxHealth(x.cid) - getPlayerStorageValue(x.cid, x.storage_1 + 1))
- end
- setPlayerStorageValue(x.cid, x.storage_1, -1)
- setPlayerStorageValue(x.cid, x.storage_1 + 1, -1)
- setPlayerStorageValue(x.cid, x.storage_2, -1)
- doSendAnimatedText(getCreaturePosition(x.cid), "BUFF ENDS", TEXTCOLOR_RED)
- doSendMagicEffect(getCreaturePosition(x.cid), CONST_ME_POFF)
- else
- return true
- end
- end
- function onSay(cid, words, param, channel)
- local tekst = string.lower(param)
- local params = split(tekst, ' ')
- local drugie = {"mage", "sorc", "druid", "strong", "super", "mega", "supro", "knight", "wizard", "priest", "archer", "warrior"}
- local trzecie = {"strong", "super", "hyper", "vita", "power"}
- local czwarte = {"strong"}
- if(table.contains(drugie, params[1]) == FALSE) then
- return false
- end
- if(table.contains(drugie, params[1]) == TRUE and table.contains(trzecie, params[2]) == FALSE and params[2]) then
- return false
- end
- if(table.contains(drugie, params[1]) == TRUE and table.contains(trzecie, params[2]) == TRUE and table.contains(czwarte, params[3]) == FALSE and params[3]) then
- return false
- end
- if(table.contains(drugie, params[1]) == TRUE and table.contains(trzecie, params[2]) == TRUE and table.contains(czwarte, params[3]) == TRUE and params[4]) then
- return false
- end
- local exhaust = {
- storage = 27420,
- duration = 1
- }
- if(os.time() - getPlayerStorageValue(cid, exhaust.storage)) < exhaust.duration then
- doPlayerSendCancel(cid, "You are exhausted.")
- doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
- return true
- end
- setPlayerStorageValue(cid, exhaust.storage, os.time())
- local nick = string.gsub(getCreatureName(cid), "'", "", 20)
- if(nick == getCreatureName(cid)) then
- nick = getCreatureName(cid)
- end
- if(table.contains(drugie, params[1]) == TRUE and not params[2]) then
- local czar = ""..words.." "..params[1]..""
- if(table.contains(config.spells, czar) == FALSE) then
- return false
- end
- if(getPlayerLevel(cid) < config[czar].level) then
- doPlayerSendCancel(cid, "Your level is too low.")
- doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
- return true
- end
- if(table.contains(config[czar].vocation, getPlayerVocation(cid)) == FALSE) then
- doPlayerSendCancel(cid, "You cannot cast this type of buff.")
- doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
- return true
- end
- local find = 0
- for i = 1, #config.spells do
- if config[czar].cast_name == config.spells[i] then
- find = i
- end
- end
- if(getPlayerStorageValue(cid, config.storage[find]) == 1) then
- if(config[czar].mana == TRUE) then
- setCreatureMaxMana(cid, getCreatureMaxMana(cid) - getPlayerStorageValue(cid, config.storage[find] + 1))
- else
- setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) - getPlayerStorageValue(cid, config.storage[find] + 1))
- end
- setPlayerStorageValue(cid, config.storage[find], -1)
- setPlayerStorageValue(cid, config.storage[find] + 1, -1)
- setPlayerStorageValue(cid, config.storage_block_1, -1)
- doPlayerSendCancel(cid, "You activated once again the same buff.")
- db.executeQuery("UPDATE `buffs` SET `time` = '".. os.time() + config[czar].time * 60 * 1000 .. "' WHERE `name` = '".. nick .."' LIMIT 1;")
- end
- if(getPlayerStorageValue(cid, config.storage_block_1) > 0) then
- doPlayerSendCancel(cid, "Other buff is activated on your character, please wait until ends.")
- doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
- return true
- end
- if(config[czar].mana == TRUE) then
- local percent = getPlayerStorageValue(cid, config.talents_mp)
- setPlayerStorageValue(cid, config.storage[find] + 1, getStandartMANA(cid) * ((percent + config[czar].percent) / 100))
- setCreatureMaxMana(cid, getCreatureMaxMana(cid) + (getStandartMANA(cid) * ((percent + config[czar].percent) / 100)))
- doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_BLUE)
- setPlayerStorageValue(cid, config.storage_block_2, 1)
- doSendAnimatedText(getCreaturePosition(cid), "BUFF", TEXTCOLOR_LIGHTBLUE)
- addEvent(function() doSendAnimatedText(getCreaturePosition(cid), "ACTIVE", TEXTCOLOR_LIGHTBLUE) end, 100)
- else
- local percent = getPlayerStorageValue(cid, config.talents_hp)
- if isKnight(cid) then
- percent = percent * config.additional_knight_hp
- elseif isPaladin(cid) then
- percent = percent * config.additional_paladin_hp
- end
- setPlayerStorageValue(cid, config.storage[find] + 1, getStandartHP(cid) * ((percent + config[czar].percent) / 100))
- setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + (getStandartHP(cid) * ((percent + config[czar].percent) / 100)))
- doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_RED)
- setPlayerStorageValue(cid, config.storage_block_2, 2)
- doSendAnimatedText(getCreaturePosition(cid), "BUFF", TEXTCOLOR_RED)
- addEvent(function() doSendAnimatedText(getCreaturePosition(cid), "ACTIVE", TEXTCOLOR_RED) end, 100)
- end
- -- doAddCondition(cid, combat)
- doCreatureSay(cid, config[czar].cast_name, TALKTYPE_ORANGE_1)
- setPlayerStorageValue(cid, config.storage_block_1, config.storage[find])
- setPlayerStorageValue(cid, config.storage[find], 1)
- db.executeQuery("UPDATE `buffs` SET `time` = '".. os.time() + config[czar].time * 60 * 1000 .. "' WHERE `name` = '".. nick .."' LIMIT 1;")
- local time_2 = db.getResult("SELECT `time` FROM `buffs` WHERE `name` = '".. nick .."' LIMIT 1;")
- if(time_2:getID() == -1) then
- return true
- end
- local timek = time_2:getDataInt("time")
- time_2:free()
- addEvent(removeBuff, config[czar].time * 60 * 1000, {cid = cid, timing = config[czar].time * 60 * 1000, manas = config[czar].mana, storage_1 = config.storage[find], storage_2 = config.storage_block_1, tajm = os.time(), tajm_2 = timek, nick = nick})
- elseif(table.contains(drugie, params[1]) == TRUE and table.contains(trzecie, params[2]) == TRUE and not params[3]) then
- local czar = ""..words.." "..params[1].." "..params[2]..""
- if(table.contains(config.spells, czar) == FALSE) then
- return false
- end
- if(getPlayerLevel(cid) < config[czar].level) then
- doPlayerSendCancel(cid, "Your level is too low.")
- doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
- return true
- end
- if(table.contains(config[czar].vocation, getPlayerVocation(cid)) == FALSE) then
- doPlayerSendCancel(cid, "You cannot cast this type of buff.")
- doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
- return true
- end
- local find = 0
- for i = 1, #config.spells do
- if config[czar].cast_name == config.spells[i] then
- find = i
- end
- end
- if(getPlayerStorageValue(cid, config.storage[find]) == 1) then
- if(config[czar].mana == TRUE) then
- setCreatureMaxMana(cid, getCreatureMaxMana(cid) - getPlayerStorageValue(cid, config.storage[find] + 1))
- else
- setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) - getPlayerStorageValue(cid, config.storage[find] + 1))
- end
- setPlayerStorageValue(cid, config.storage[find], -1)
- setPlayerStorageValue(cid, config.storage[find] + 1, -1)
- setPlayerStorageValue(cid, config.storage_block_1, -1)
- doPlayerSendCancel(cid, "You activated once again the same buff.")
- db.executeQuery("UPDATE `buffs` SET `time` = '".. os.time() + config[czar].time * 60 * 1000 .. "' WHERE `name` = '".. nick .."' LIMIT 1;")
- end
- if(getPlayerStorageValue(cid, config.storage_block_1) > 0) then
- doPlayerSendCancel(cid, "Other buff is activated on your character, please wait until ends.")
- doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
- return true
- end
- if(config[czar].mana == TRUE) then
- local percent = getPlayerStorageValue(cid, config.talents_mp)
- setPlayerStorageValue(cid, config.storage[find] + 1, getStandartMANA(cid) * ((percent + config[czar].percent) / 100))
- setCreatureMaxMana(cid, getCreatureMaxMana(cid) + (getStandartMANA(cid) * ((percent + config[czar].percent) / 100)))
- doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_BLUE)
- setPlayerStorageValue(cid, config.storage_block_2, 1)
- doSendAnimatedText(getCreaturePosition(cid), "BUFF", TEXTCOLOR_LIGHTBLUE)
- addEvent(function() doSendAnimatedText(getCreaturePosition(cid), "ACTIVE", TEXTCOLOR_LIGHTBLUE) end, 100)
- else
- local percent = getPlayerStorageValue(cid, config.talents_hp)
- if isKnight(cid) then
- percent = percent * config.additional_knight_hp
- elseif isPaladin(cid) then
- percent = percent * config.additional_paladin_hp
- end
- setPlayerStorageValue(cid, config.storage[find] + 1, getStandartHP(cid) * ((percent + config[czar].percent) / 100))
- setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + (getStandartHP(cid) * ((percent + config[czar].percent) / 100)))
- doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_RED)
- setPlayerStorageValue(cid, config.storage_block_2, 2)
- doSendAnimatedText(getCreaturePosition(cid), "BUFF", TEXTCOLOR_RED)
- addEvent(function() doSendAnimatedText(getCreaturePosition(cid), "ACTIVE", TEXTCOLOR_RED) end, 100)
- end
- -- doAddCondition(cid, combat)
- doCreatureSay(cid, config[czar].cast_name, TALKTYPE_ORANGE_1)
- setPlayerStorageValue(cid, config.storage_block_1, config.storage[find])
- setPlayerStorageValue(cid, config.storage[find], 1)
- db.executeQuery("UPDATE `buffs` SET `time` = '".. os.time() + config[czar].time * 60 * 1000 .. "' WHERE `name` = '".. nick .."' LIMIT 1;")
- local time_2 = db.getResult("SELECT `time` FROM `buffs` WHERE `name` = '".. nick .."' LIMIT 1;")
- if(time_2:getID() == -1) then
- return true
- end
- local timek = time_2:getDataInt("time")
- time_2:free()
- addEvent(removeBuff, config[czar].time * 60 * 1000, {cid = cid, timing = config[czar].time * 60 * 1000, manas = config[czar].mana, storage_1 = config.storage[find], storage_2 = config.storage_block_1, tajm = os.time(), tajm_2 = timek, nick = nick})
- elseif(table.contains(drugie, params[1]) == TRUE and table.contains(trzecie, params[2]) == TRUE and table.contains(czwarte, params[3]) == TRUE and not params[4]) then
- local czar = ""..words.." "..params[1].." "..params[2].." "..params[3]..""
- if(table.contains(config.spells, czar) == FALSE) then
- return false
- end
- if(getPlayerLevel(cid) < config[czar].level) then
- doPlayerSendCancel(cid, "Your level is too low.")
- doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
- return true
- end
- if(table.contains(config[czar].vocation, getPlayerVocation(cid)) == FALSE) then
- doPlayerSendCancel(cid, "You cannot cast this type of buff.")
- doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
- return true
- end
- local find = 0
- for i = 1, #config.spells do
- if config[czar].cast_name == config.spells[i] then
- find = i
- end
- end
- if(getPlayerStorageValue(cid, config.storage[find]) == 1) then
- if(config[czar].mana == TRUE) then
- setCreatureMaxMana(cid, getCreatureMaxMana(cid) - getPlayerStorageValue(cid, config.storage[find] + 1))
- else
- setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) - getPlayerStorageValue(cid, config.storage[find] + 1))
- end
- setPlayerStorageValue(cid, config.storage[find], -1)
- setPlayerStorageValue(cid, config.storage[find] + 1, -1)
- setPlayerStorageValue(cid, config.storage_block_1, -1)
- doPlayerSendCancel(cid, "You activated once again the same buff.")
- db.executeQuery("UPDATE `buffs` SET `time` = '".. os.time() + config[czar].time * 60 * 1000 .. "' WHERE `name` = '".. nick .."' LIMIT 1;")
- end
- if(getPlayerStorageValue(cid, config.storage_block_1) > 0) then
- doPlayerSendCancel(cid, "Other buff is activated on your character, please wait until ends.")
- doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
- return true
- end
- if(config[czar].mana == TRUE) then
- local percent = getPlayerStorageValue(cid, config.talents_mp)
- setPlayerStorageValue(cid, config.storage[find] + 1, getStandartMANA(cid) * ((percent + config[czar].percent) / 100))
- setCreatureMaxMana(cid, getCreatureMaxMana(cid) + (getStandartMANA(cid) * ((percent + config[czar].percent) / 100)))
- doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_BLUE)
- setPlayerStorageValue(cid, config.storage_block_2, 1)
- doSendAnimatedText(getCreaturePosition(cid), "BUFF", TEXTCOLOR_LIGHTBLUE)
- addEvent(function() doSendAnimatedText(getCreaturePosition(cid), "ACTIVE", TEXTCOLOR_LIGHTBLUE) end, 100)
- else
- local percent = getPlayerStorageValue(cid, config.talents_hp)
- if isKnight(cid) then
- percent = percent * config.additional_knight_hp
- elseif isPaladin(cid) then
- percent = percent * config.additional_paladin_hp
- end
- setPlayerStorageValue(cid, config.storage[find] + 1, getStandartHP(cid) * ((percent + config[czar].percent) / 100))
- setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + (getStandartHP(cid) * ((percent + config[czar].percent) / 100)))
- doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_RED)
- setPlayerStorageValue(cid, config.storage_block_2, 2)
- doSendAnimatedText(getCreaturePosition(cid), "BUFF", TEXTCOLOR_RED)
- addEvent(function() doSendAnimatedText(getCreaturePosition(cid), "ACTIVE", TEXTCOLOR_RED) end, 100)
- end
- -- doAddCondition(cid, combat)
- doCreatureSay(cid, config[czar].cast_name, TALKTYPE_ORANGE_1)
- setPlayerStorageValue(cid, config.storage_block_1, config.storage[find])
- setPlayerStorageValue(cid, config.storage[find], 1)
- db.executeQuery("UPDATE `buffs` SET `time` = '".. os.time() + config[czar].time * 60 * 1000 .. "' WHERE `name` = '".. nick .."' LIMIT 1;")
- local time_2 = db.getResult("SELECT `time` FROM `buffs` WHERE `name` = '".. nick .."' LIMIT 1;")
- if(time_2:getID() == -1) then
- return true
- end
- local timek = time_2:getDataInt("time")
- time_2:free()
- addEvent(removeBuff, config[czar].time * 60 * 1000, {cid = cid, timing = config[czar].time * 60 * 1000, manas = config[czar].mana, storage_1 = config.storage[find], storage_2 = config.storage_block_1, tajm = os.time(), tajm_2 = timek, nick = nick})
- return true
- end
- return true
- end
- ]]></talkaction>
- <event type="login" name="Buffs_login" event="script"><![CDATA[
- domodlib('buffs')
- function onLogin(cid)
- if(getPlayerLastLoginSaved(cid) <= 0) then
- setPlayerStorageValue(cid, config.talents_hp, 0)
- setPlayerStorageValue(cid, config.talents_mp, 0)
- setPlayerStorageValue(cid, config.talents_dmg, 0)
- setPlayerStorageValue(cid, config.talents, 0)
- end
- if(getPlayerStorageValue(cid, config.talents_hp) == -1) then
- setPlayerStorageValue(cid, config.talents_hp, 0)
- end
- if(getPlayerStorageValue(cid, config.talents_mp) == -1) then
- setPlayerStorageValue(cid, config.talents_mp, 0)
- end
- if(getPlayerStorageValue(cid, config.talents_dmg) == -1) then
- setPlayerStorageValue(cid, config.talents_dmg, 0)
- end
- if(getPlayerStorageValue(cid, config.talents) == -1) then
- setPlayerStorageValue(cid, config.talents, 0)
- end
- --local hp = getPlayerStorageValue(cid, config.talents_hp)
- --local mp = getPlayerStorageValue(cid, config.talents_mp)
- --local dmg = getPlayerStorageValue(cid, config.talents_dmg)
- --local note = getPlayerStorageValue(cid, config.talents)
- --local x = getPlayerLevel(cid)
- --local z = {}
- --for i = 1, 50 do
- --if x >= 50000 then
- --x = x - 50000
- --else
- --table.insert(z, i - 1)
- --end
- --end
- --local dodaj = 0
- --if(z[1] <= 9) then
- --dodaj = 2 * z[1]
- --else
- --dodaj = (2 * 9) + (z[1] - 9)
- --end
- --if(hp + mp + dmg + note) ~= dodaj then
- --setPlayerStorageValue(cid, config.talents_hp, 0)
- --setPlayerStorageValue(cid, config.talents_mp, 0)
- --setPlayerStorageValue(cid, config.talents_dmg, 0)
- --setPlayerStorageValue(cid, config.talents, dodaj)
- --end
- recalculateHPandMana(cid)
- local nick = string.gsub(getCreatureName(cid), "'", "", 20)
- if(nick == getCreatureName(cid)) then
- nick = getCreatureName(cid)
- end
- local res = db.getResult("SELECT `name` FROM `buffs` WHERE `name` = '".. nick .."' LIMIT 1;")
- if(res:getID() == -1) then
- db.executeQuery("INSERT INTO `buffs` (name) VALUES ('".. nick .."')")
- end
- return true
- end
- ]]></event>
- <event type="preparedeath" name="Buffs_dead" event="script"><![CDATA[
- domodlib('buffs')
- function onPrepareDeath(cid, deathList)
- if(not isPlayer(cid)) then
- return true
- end
- if(getPlayerStorageValue(cid, 49597) == 1) then
- return true
- end
- setPlayerStorageValue(cid, 27400, 0)
- for i = 1, 38 do
- setPlayerStorageValue(cid, (27400 + i), 0)
- end
- if(getPlayerStorageValue(cid, config.storage_block_1) > 0) then
- local find = getPlayerStorageValue(cid, config.storage_block_1)
- local find_2 = getPlayerStorageValue(cid, config.storage_block_1) + 1
- local what = getPlayerStorageValue(cid, config.storage_block_2)
- if(what == 1) then
- setCreatureMaxMana(cid, -(getPlayerStorageValue(cid, find_2)))
- setPlayerStorageValue(cid, find, -1)
- setPlayerStorageValue(cid, find_2, -1)
- setPlayerStorageValue(cid, config.storage_block_1, -1)
- setPlayerStorageValue(cid, config.storage_block_2, -1)
- elseif(what == 2) then
- setCreatureMaxHealth(cid, -(getPlayerStorageValue(cid, find_2)))
- setPlayerStorageValue(cid, find, -1)
- setPlayerStorageValue(cid, find_2, -1)
- setPlayerStorageValue(cid, config.storage_block_1, -1)
- setPlayerStorageValue(cid, config.storage_block_2, -1)
- end
- return true
- end
- return true
- end
- ]]></event>
- <event type="logout" name="Buffs_logout" event="script"><![CDATA[
- domodlib('buffs')
- function onLogout(cid)
- if(not isPlayer(cid)) then
- return true
- end
- setPlayerStorageValue(cid, 27400, 0)
- for i = 1, 38 do
- setPlayerStorageValue(cid, (27400 + i), 0)
- end
- if(getPlayerStorageValue(cid, config.storage_block_1) == nil or getPlayerStorageValue(cid, config.storage_block_1) == "nan") then
- setPlayerStorageValue(cid, config.storage_block_1, -1)
- end
- if(getPlayerStorageValue(cid, config.storage_block_1) >= 0) then
- local find = getPlayerStorageValue(cid, config.storage_block_1)
- local find_2 = getPlayerStorageValue(cid, config.storage_block_1) + 1
- local what = getPlayerStorageValue(cid, config.storage_block_2)
- if(what == 1) then
- setCreatureMaxMana(cid, -(getPlayerStorageValue(cid, find_2)))
- setPlayerStorageValue(cid, find, -1)
- setPlayerStorageValue(cid, find_2, -1)
- setPlayerStorageValue(cid, config.storage_block_1, -1)
- setPlayerStorageValue(cid, config.storage_block_2, -1)
- elseif(what == 2) then
- setCreatureMaxHealth(cid, -(getPlayerStorageValue(cid, find_2)))
- setPlayerStorageValue(cid, find, -1)
- setPlayerStorageValue(cid, find_2, -1)
- setPlayerStorageValue(cid, config.storage_block_1, -1)
- setPlayerStorageValue(cid, config.storage_block_2, -1)
- end
- return true
- end
- return true
- end
- ]]></event>
- <event type="statschange" name="Buffs_dmg" event="script"><![CDATA[
- domodlib('buffs')
- function onStatsChange(cid, attacker, type, combat, value)
- if isPlayer(attacker) and isCreature(cid) and not isPlayer(cid) then
- local tal = getPlayerStorageValue(attacker, config.talents_dmg)
- if tal < 1 then
- return true
- end
- local dmg = tal / 100
- local total = value * dmg
- local rest = 0
- local mana = 0
- if((type == STATSCHANGE_HEALTHLOSS or STATSCHANGE_MANALOSS) and tal > 0 and value > 0) then
- doCreatureAddHealth(cid, -total)
- doSendAnimatedText(getCreaturePosition(cid), total, TEXTCOLOR_RED)
- return doPlayerSendTextMessage(attacker, 24, "You deal ".. total .." additional damage to ".. getCreatureName(cid) .." (talent points).") and true
- end
- elseif isPlayer(attacker) and isCreature(cid) and isPlayer(cid) then
- local tal = getPlayerStorageValue(attacker, config.talents_dmg)
- if tal < 1 then
- return true
- end
- local dmg = tal / 100
- local total = value * dmg
- local rest = 0
- local mana = 0
- if((type == STATSCHANGE_HEALTHLOSS or STATSCHANGE_MANALOSS) and tal > 0 and value > 0) then
- if(getCreatureCondition(cid, CONDITION_MANASHIELD)) then
- if(total > getCreatureMana(cid)) then
- rest = total - getCreatureMana(cid)
- end
- mana = 1
- end
- if(type == STATSCHANGE_MANAGAIN or type == STATSCHANGE_HEALTHGAIN) then
- return true
- end
- if(mana == 1 and rest == 0) then
- doCreatureAddMana(cid, -total)
- elseif(mana == 1 and rest > 0) then
- doCreatureAddMana(cid, -(total - rest))
- doCreatureAddHealth(cid, -rest)
- doSendAnimatedText(getCreaturePosition(cid), rest, TEXTCOLOR_RED)
- else
- doCreatureAddHealth(cid, -total)
- doSendAnimatedText(getCreaturePosition(cid), total, TEXTCOLOR_RED)
- end
- return doPlayerSendTextMessage(attacker, 24, "You deal ".. total .." additional damage to ".. getCreatureName(cid) .." (talent points).") and true
- end
- end
- return true
- end
- ]]></event>
- <event type="combat" name="buffs_combat" event="script"><![CDATA[
- domodlib('buffs')
- function onCombat(cid, target)
- if not isPlayer(target) and isCreature(target) then
- registerCreatureEvent(target, "Buffs_dmg")
- end
- return true
- end
- ]]></event>
- <event type="attack" name="buffs_attack" event="script"><![CDATA[
- domodlib('buffs')
- function onAttack(cid, target)
- if not isPlayer(target) and isCreature(target) then
- registerCreatureEvent(target, "Buffs_dmg")
- end
- return true
- end
- ]]></event>
- <talkaction words="!wille" access="3" event="script"><![CDATA[
- domodlib('buffs')
- function onSay(cid, words, param, channel)
- if getPlayerGroupId(cid) > 3 then
- if(param == '') then
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Missing param, write nick.")
- return true
- end
- local t = split(param, ',')
- local pid = getPlayerByNameWildcard(t[1])
- if(t[1]) then
- if(not pid) then
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player '" .. t[1] .. "' not found.")
- return true
- end
- if(getCreatureName(pid) == getCreatureName(cid)) then
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You cannot use this command on yourself.")
- return true
- end
- end
- recalculateHPandMana(pid)
- doSendMagicEffect(getCreaturePosition(pid), CONST_ME_FIREWORK_RED)
- doCreatureSay(pid, "Recalculated!", 20)
- return true
- end
- return true
- end
- ]]></talkaction>
- <talkaction words="!buffs" event="script"><![CDATA[
- domodlib('buffs')
- function onSay(cid, words, param, channel)
- local text = "Buffs on Evolera.tk:\n"
- local a = ""
- local amount = 0
- for i = 1, #config.spells do
- a = config.spells[i]
- local b = 0
- if(getPlayerLevel(cid) >= config[a].level and table.contains(config[a].vocation, getPlayerVocation(cid)) == TRUE) then
- if(b == 0) then
- text = text .. "\nNow can use:\n"
- b = 1
- end
- text = text .. "* " .. config[a].cast_name .. " - " .. config[a].manacost .. " MP, " .. config[a].time .. " mins, + " .. config[a].percent .. "% of your current " .. (config[a].mana == TRUE and "MP" or "HP") .. "\n"
- amount = amount + 1
- end
- end
- if(amount > 0) then
- for i = 1, #config.spells do
- a = config.spells[i]
- local c = 0
- if(getPlayerLevel(cid) < config[a].level and table.contains(config[a].vocation, getPlayerVocation(cid)) == TRUE) then
- if(c == 0) then
- text = text .. "\nStill you can get:\n"
- c = 1
- end
- text = text .. "* " .. config[a].cast_name .. " - " .. config[a].manacost .. " MP, min. " .. config[a].level .. " level, " .. config[a].time .. " mins, + " .. config[a].percent .. "% of your current " .. (config[a].mana == TRUE and "MP" or "HP") .. "\n"
- end
- end
- elseif(amount == 0) then
- text = text .. "\n\nCurrently you cannot use any buff.\n\nAvailable buffs for your vocation:\n"
- for i = 1, #config.spells do
- a = config.spells[i]
- if(getPlayerLevel(cid) < config[a].level and table.contains(config[a].vocation, getPlayerVocation(cid)) == TRUE) then
- text = text .. "* " .. config[a].cast_name .. " - " .. config[a].manacost .. " MP, min. " .. config[a].level .. " level, " .. config[a].time .. " mins, + " .. config[a].percent .. "% of your current " .. (config[a].mana == TRUE and "MP" or "HP") .. "\n"
- end
- end
- end
- text = text .."\nAmount of additional percent depends of talent points MP/HP!"
- doShowTextDialog(cid, 2175, text)
- return true
- end
- ]]></talkaction>
- <globalevent name="checking" interval="1500" event="script"><![CDATA[
- domodlib('buffs')
- function onThink(interval, lastExecution, thinkInterval)
- local online = getPlayersOnline()
- local Online = {}
- local playersOnline = {}
- for _, kid in pairs(online) do
- if(isPlayer(kid)) then
- table.insert(Online, kid)
- end
- end
- if #Online > 0 then
- for _, cid in ipairs(getPlayersOnline()) do
- local wear = {}
- local items = {}
- local cur = {}
- if not isPlayer(cid) then
- return true
- end
- for i = 1, #config.storage_items do
- if getPlayerStorageValue(cid, config.storage_items[i]) == 1 then
- table.insert(wear, config.storage_items[i])
- table.insert(items, config.storage_IDs[i])
- else
- table.insert(wear, 0)
- table.insert(items, 0)
- end
- if getPlayerSlotItem(cid, CONST_SLOT_RING).itemid == config.rings[1] and i == 1 then
- table.insert(cur, getPlayerSlotItem(cid, CONST_SLOT_RING).itemid)
- elseif getPlayerSlotItem(cid, CONST_SLOT_RING).itemid ~= config.rings[1] and i == 1 then
- table.insert(cur, 0)
- end
- if getPlayerSlotItem(cid, CONST_SLOT_RING).itemid == config.rings[2] and i == 2 then
- table.insert(cur, getPlayerSlotItem(cid, CONST_SLOT_RING).itemid)
- elseif getPlayerSlotItem(cid, CONST_SLOT_RING).itemid ~= config.rings[2] and i == 2 then
- table.insert(cur, 0)
- end
- if getPlayerSlotItem(cid, CONST_SLOT_RING).itemid == config.rings[3] and i == 4 then
- table.insert(cur, getPlayerSlotItem(cid, CONST_SLOT_RING).itemid)
- elseif getPlayerSlotItem(cid, CONST_SLOT_RING).itemid ~= config.rings[3] and i == 4 then
- table.insert(cur, 0)
- end
- if getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid == config.boots[1] and i == 3 then
- table.insert(cur, getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid)
- elseif getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid ~= config.boots[1] and i == 3 then
- table.insert(cur, 0)
- end
- if getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid == config.boots[2] and i == 5 then
- table.insert(cur, getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid)
- elseif getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid ~= config.boots[2] and i == 5 then
- table.insert(cur, 0)
- end
- if getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid == config.boots[3] and i == 6 then
- table.insert(cur, getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid)
- elseif getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid ~= config.boots[3] and i == 6 then
- table.insert(cur, 0)
- end
- end
- local slot_2 = ""
- for a = 1, #wear do
- if a == 1 or a == 2 or a == 4 then
- slot_2 = CONST_SLOT_RING
- elseif a == 3 or a == 5 or a == 6 then
- slot_2 = CONST_SLOT_FEET
- end
- if wear[a] ~= 0 then
- if wear[a] > 0 and items[a] > 0 then
- if getPlayerSlotItem(cid, slot_2).itemid ~= items[a] then
- local item = items[a]
- setPlayerStorageValue(cid, config[item].storage_mana, 0)
- setPlayerStorageValue(cid, config[item].storage_hp, 0)
- setCreatureMaxMana(cid, getCreatureMaxMana(cid) - (getPlayerStorageValue(cid, config[item].storage_mana + 1)))
- setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) - (getPlayerStorageValue(cid, config[item].storage_hp + 1)))
- setPlayerStorageValue(cid, config[item].storage_mana + 1, 0)
- setPlayerStorageValue(cid, config[item].storage_hp + 1, 0)
- doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
- doSendAnimatedText(getCreaturePosition(cid), "EXTRAS", TEXTCOLOR_RED)
- addEvent(function() doSendAnimatedText(getCreaturePosition(cid), "DEACTIVE", TEXTCOLOR_RED) end, 300)
- table.remove(wear, a)
- table.insert(wear, a, 0)
- table.remove(items, a)
- table.insert(items, a, 0)
- table.remove(cur, a)
- table.insert(cur, a, 0)
- end
- end
- end
- end
- local slot = ""
- local c = ""
- for z = 1, #items do
- if items[z] ~= cur[z] then
- if z == 1 or z == 2 or z == 4 then
- slot = CONST_SLOT_RING
- c = config.rings
- elseif z == 3 or z == 5 or z == 6 then
- slot = CONST_SLOT_FEET
- c = config.boots
- end
- if table.contains(c, getPlayerSlotItem(cid, slot).itemid) == TRUE then
- local item = getPlayerSlotItem(cid, slot).itemid
- setCreatureMaxMana(cid, getCreatureMaxMana(cid) + (getStandartMANA(cid) * (config[item].percent_mana / 100)))
- setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + (getStandartHP(cid) * (config[item].percent_hp / 100)))
- setPlayerStorageValue(cid, config[item].storage_mana, 1)
- setPlayerStorageValue(cid, config[item].storage_hp, 1)
- setPlayerStorageValue(cid, config[item].storage_mana + 1, getStandartMANA(cid) * (config[item].percent_mana / 100))
- setPlayerStorageValue(cid, config[item].storage_hp + 1, getStandartHP(cid) * (config[item].percent_hp / 100))
- doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_YELLOW)
- doSendAnimatedText(getCreaturePosition(cid), "EXTRAS", TEXTCOLOR_YELLOW)
- addEvent(function() doSendAnimatedText(getCreaturePosition(cid), "ACTIVE", TEXTCOLOR_YELLOW) end, 300)
- end
- end
- end
- end
- end
- return true
- end
- ]]></globalevent>
- </mod>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement