Tudo que OWeen postou
-
Miss System
.Qual servidor ou website você utiliza como base? DXP Qual o motivo deste tópico? preciso de ajuda com o Miss System Está surgindo algum erro? Se sim coloque-o aqui. Os pokemons tipo Dark estão tomando o efeito do confusion sendo que eles são imunes a golpes do tipo Psychic Você tem o código disponível? Se tiver publique-o aqui: conds = { ["Slow"] = 3890, ["Confusion"] = 3891, ["Burn"] = 3892, ["Poison"] = 3893, ["Fear"] = 3894, ["Stun"] = 3895, ["Paralyze"] = 3896, --alterado v1.6 \/ peguem o script todo! ["Leech"] = 3897, ["Buff1"] = 3898, ["Buff2"] = 3899, ["Buff3"] = 3900, ["Miss"] = 32659, ["Silence"] = 32698, ["Sleep"] = 98271, } injuries2 = { [1] = {n = "slow", m = 3890}, [2] = {n = "confuse", m = 3891}, [3] = {n = "burn", m = 3892}, [4] = {n = "poison", m = 3893}, [5] = {n = "fear", m = 3894}, [6] = {n = "stun", m = 3895}, [7] = {n = "paralyze", m = 3896}, [8] = {n = "leech", m = 3897}, [9] = {n = "Buff1", m = 3898}, [10] = {n = "Buff2", m = 3899}, [11] = {n = "Buff3", m = 3900}, [12] = {n = "miss", m = 32659}, [13] = {n = "silence", m = 32698}, [14] = {n = "sleep", m = 98271}, } Buffs = { [1] = {"Buff1", 3898}, [2] = {"Buff2", 3899}, [3] = {"Buff3", 3900}, } paralizeArea2 = createConditionObject(CONDITION_PARALYZE) setConditionParam(paralizeArea2, CONDITION_PARAM_TICKS, 50000) setConditionFormula(paralizeArea2, -0.63, -0.63, -0.63, -0.63) local roardirections = { [NORTH] = {SOUTH}, [SOUTH] = {NORTH}, [WEST] = {EAST}, --edited sistema de roar [EAST] = {WEST}} function doSendSleepEffect(cid) if not isCreature(cid) or not isSleeping(cid) then return true end doSendMagicEffect(getThingPos(cid), 32) addEvent(doSendSleepEffect, 1500, cid) end local outFurys = { ["Shiny Charizard"] = {outFury = 1073}, ["Elder Charizard"] = {outFury = 1073}, ["Shiny Blastoise"] = {outFury = 1074}, ["Shiny Typhlosion"] = {outFury = 2327}, ["Typhlosion"] = {outFury = 675}, ["Ancient Blastoise"] = {outFury = 1074}, ["Mega Charizard Y"] = {outFury = 2175}, ["Mega Charizard X"] = {outFury = 1856}, ["Kingdra"] = {outFury = 2317}, ["Salamence"] = {outFury = 1827}, ["Mega Sceptile"] = {outFury = 2318}, ["Ditto"] = {outFury = null}, } local outImune = { ["Camouflage"] = 2087, ["Acid Armor"] = 1453, ["Iron Defense"] = 1401, ["Defense"] = 2137, ["Minimize"] = 1455, ["Future Sight"] = 1446, ["Psychic Sight"] = 1536, ["Heal Bell"] = 946, ["Sky Fall"] = 1849, } local outShock = { ["Electabuzz"] = {outShock = 1462}, ["Shiny Electabuzz"] = {outShock = 1460}, ["Electivire"] = {outShock = 1814}, ["Ditto"] = {outShock = null}, } local function transBack(cid) if isCreature(cid) then if getPlayerStorageValue(cid, 974848) >= 1 then setPlayerStorageValue(cid, 974848, 0) doRemoveCondition(cid, CONDITION_OUTFIT) end end end function doCondition2(ret) -- function doMiss2(cid, cd, eff, check, spell) local stg = conds["Miss"] if not isCreature(cid) then return true end --is creature? if getPlayerStorageValue(cid, 21100) >= 1 and getPlayerStorageValue(cid, stg) <= -1 then return true end --alterado v1.6 reflect if not canDoMiss(cid, spell) then return true end if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then setPlayerStorageValue(cid, stg, cd) --allterado v1.8 return true end if not check and getPlayerStorageValue(cid, stg) >= 1 then setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1) else setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd) end local a = getPlayerStorageValue(cid, stg) if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then local item = getPlayerSlotItem(getCreatureMaster(cid), 8) doItemSetAttribute(item.uid, "miss", a) doItemSetAttribute(item.uid, "missEff", eff) doItemSetAttribute(item.uid, "missSpell", spell) end if a <= -1 then setPlayerStorageValue(cid, stg, -1) return true end doSendMagicEffect(getThingPos(cid), eff) addEvent(doMiss2, 1000, cid, -1, eff, a, spell) end function doSilence2(cid, cd, eff, check) local stg = conds["Silence"] if not isCreature(cid) then return true end --is creature? if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then setPlayerStorageValue(cid, stg, cd) --allterado v1.8 return true end if not check and getPlayerStorageValue(cid, stg) >= 1 then setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1) else setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd) end local a = getPlayerStorageValue(cid, stg) if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then local item = getPlayerSlotItem(getCreatureMaster(cid), 8) doItemSetAttribute(item.uid, "silence", a) doItemSetAttribute(item.uid, "silenceEff", eff) end if a <= -1 then setPlayerStorageValue(cid, stg, -1) return true end doSendMagicEffect(getThingPos(cid), eff) addEvent(doSilence2, 1000, cid, -1, eff, a) end function doSlow2(cid, cd, eff, check, first) local stg = conds["Slow"] if not isCreature(cid) then return true end --is creature? if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then setPlayerStorageValue(cid, stg, cd) --allterado v1.8 return true end if not check and getPlayerStorageValue(cid, stg) >= 1 then setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1) else setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd) end local a = getPlayerStorageValue(cid, stg) if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then local item = getPlayerSlotItem(getCreatureMaster(cid), 8) doItemSetAttribute(item.uid, "slow", a) doItemSetAttribute(item.uid, "slowEff", eff) end if a <= -1 then doRemoveCondition(cid, CONDITION_PARALYZE) if not isSleeping(cid) and not isParalyze(cid) then addEvent(doRegainSpeed, 50, cid) --alterado end setPlayerStorageValue(cid, stg, -1) return true end if first then doAddCondition(cid, paralizeArea2) end doSendMagicEffect(getThingPos(cid), eff) addEvent(doSlow2, 1000, cid, -1, eff, a) end function doConfusion2(cid, cd, check) local stg = conds["Confusion"] if not isCreature(cid) then return true end --is creature? if getPlayerStorageValue(cid, 212123) >= 1 and getPlayerStorageValue(cid, stg) <= -1 then return true end --alterado v1.6 reflect if not canDoMiss(cid, spell) then return true end if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then setPlayerStorageValue(cid, stg, cd) --allterado v1.8 return true end if not check and getPlayerStorageValue(cid, stg) >= 1 then setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1) else setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd) end local a = getPlayerStorageValue(cid, stg) if not canDoMiss(cid, spell) then return true end if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then local item = getPlayerSlotItem(getCreatureMaster(cid), 8) doItemSetAttribute(item.uid, "confuse", a) end if a <= -1 then if getCreatureCondition(cid, CONDITION_PARALYZE) == true then end if not isSleeping(cid) and not isParalyze(cid) then end setPlayerStorageValue(cid, stg, -1) return true end if math.random(1, 6) >= 4 then doSendMagicEffect(getThingPos(cid), 31) end local isTarget = isSummon(cid) and getCreatureTarget(getCreatureMaster(cid)) or getCreatureTarget(cid) if isCreature(isTarget) and not isSleeping(cid) and not isParalyze(cid) and getPlayerStorageValue(cid, 654878) <= 0 then --alterado v1.6 if not canDoMiss(cid, spell) then return true end doAddCondition(cid, confusioncondition) end local pos = getThingPos(cid) addEvent(doSendMagicEffect, math.random(0, 450), pos, 31) addEvent(doConfusion2, 1000, cid, -1, a) end function doBurn2(cid, cd, check, damage) local stg = conds["Burn"] if not isCreature(cid) then return true end --is creature? if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then setPlayerStorageValue(cid, stg, cd) --allterado v1.8 return true end if not check and getPlayerStorageValue(cid, stg) >= 1 then setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1) else setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd) end local a = getPlayerStorageValue(cid, stg) if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then local item = getPlayerSlotItem(getCreatureMaster(cid), 8) doItemSetAttribute(item.uid, "burn", a) doItemSetAttribute(item.uid, "burndmg", damage) end if a <= -1 then setPlayerStorageValue(cid, stg, -1) return true end local dano = getCreatureHealth(cid)-damage <= 0 and getCreatureHealth(cid)-1 or damage if isSummon(ret.attacker) then -- morrer para veneno local player = getCreatureMaster(ret.attacker) addPlayerDano(ret.im, player, dano) end doCreatureAddHealth(cid, -dano, ret.eff, ret.color and ret.color or COLOR_BURN) addEvent(doBurn2, 1500, cid, -1, a, damage) end function doPoison2(cid, cd, check, damage) local stg = conds["Poison"] if not isCreature(cid) then return true end --is creature? ---------- if isSummon(cid) or ehMonstro(cid) and pokes[getCreatureName(cid)] then --alterado v1.6 local type = pokes[getCreatureName(cid)].type local type2 = pokes[getCreatureName(cid)].type2 if isInArray({"poison", "steel"}, type) or isInArray({"poison", "steel"}, type2) then return true end end --------- if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then setPlayerStorageValue(cid, stg, cd) --allterado v1.8 return true end if not check and getPlayerStorageValue(cid, stg) >= 1 then setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1) else setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd) end local a = getPlayerStorageValue(cid, stg) if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then local item = getPlayerSlotItem(getCreatureMaster(cid), 8) doItemSetAttribute(item.uid, "poison", a) doItemSetAttribute(item.uid, "poisondmg", damage) end if a <= -1 or getCreatureHealth(cid) == 1 then setPlayerStorageValue(cid, stg, -1) return true end local dano = getCreatureHealth(cid)-damage <= 0 and getCreatureHealth(cid)-1 or damage if isSummon(ret.attacker) then -- morrer para veneno local player = getCreatureMaster(ret.attacker) addPlayerDano(ret.im, player, dano) end doCreatureAddHealth(cid, -dano, 8, COLOR_GRASS) addEvent(doPoison2, 1500, cid, -1, a, damage) end function doFear2(cid, cd, check, skill) local stg = conds["Fear"] if not isCreature(cid) then return true end --is creature? if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then setPlayerStorageValue(cid, stg, cd) --allterado v1.8 return true end if not check and getPlayerStorageValue(cid, stg) >= 1 then setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1) else setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd) end local a = getPlayerStorageValue(cid, stg) if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then local item = getPlayerSlotItem(getCreatureMaster(cid), 8) doItemSetAttribute(item.uid, "fear", a) doItemSetAttribute(item.uid, "fearSkill", skill) end if a <= -1 then if getCreatureCondition(cid, CONDITION_PARALYZE) == true then doRemoveCondition(cid, CONDITION_PARALYZE) addEvent(doAddCondition, 10, cid, paralizeArea2) end if not isSleeping(cid) and not isParalyze(cid) then doRegainSpeed(cid) --alterado end setPlayerStorageValue(cid, stg, -1) setCreatureTargetDistance(cid, getCreatureDefaultTargetDistance(cid)) return true end if skill == "Roar" then eff = 244 else --edited Roar eff = 139 end if math.random(1, 6) >= 4 then doSendMagicEffect(getThingPos(cid), eff) end local isTarget = isSummon(cid) and getCreatureTarget(getCreatureMaster(cid)) or getCreatureTarget(cid) if isCreature(isTarget) and not isSleeping(cid) and not isParalyze(cid) and getPlayerStorageValue(cid, 654878) <= 0 then --alterado v1.6 local dir = getCreatureDirectionToTarget(cid, isTarget) setCreatureTargetDistance(cid, 6) end local pos = getThingPos(cid) addEvent(doSendMagicEffect, math.random(0, 450), pos, eff) addEvent(doFear2, 400, cid, -1, a, skill) end function doStun2(cid, cd, eff, check, spell) local stg = conds["Stun"] if not isCreature(cid) then return true end --is creature? if not canDoMiss(cid, spell) then return true end if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then setPlayerStorageValue(cid, stg, cd) --allterado v1.8 return true end if not check and getPlayerStorageValue(cid, stg) >= 1 then setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1) else setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd) end local a = getPlayerStorageValue(cid, stg) if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then local item = getPlayerSlotItem(getCreatureMaster(cid), 8) doItemSetAttribute(item.uid, "stun", a) doItemSetAttribute(item.uid, "stunEff", eff) doItemSetAttribute(item.uid, "stunSpell", spell) end if a <= -1 then doRemoveCondition(cid, CONDITION_PARALYZE) if not isSleeping(cid) and not isParalyze(cid) then addEvent(doRegainSpeed, 50, cid) --alterado end setPlayerStorageValue(cid, stg, -1) return true end if getCreatureCondition(cid, CONDITION_PARALYZE) == false then doAddCondition(cid, paralizeArea2) end doSendMagicEffect(getThingPos(cid), eff) addEvent(doStun2, 1000, cid, -1, eff, a, spell) end function doParalyze2(cid, cd, eff, check, first) local stg = conds["Paralyze"] if not isCreature(cid) then return true end --is creature? if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then setPlayerStorageValue(cid, stg, cd) --allterado v1.8 return true end if not check and getPlayerStorageValue(cid, stg) >= 1 then setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1) else setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd) end local a = getPlayerStorageValue(cid, stg) if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then local item = getPlayerSlotItem(getCreatureMaster(cid), 8) doItemSetAttribute(item.uid, "paralyze", a) doItemSetAttribute(item.uid, "paralyzeEff", eff) end if a <= -1 then if isPlayer(cid) then if not isSleeping(cid) then --alterado mayNotMove(cid, false) end else if getCreatureCondition(cid, CONDITION_PARALYZE) == true then doRemoveCondition(cid, CONDITION_PARALYZE) addEvent(doAddCondition, 10, cid, paralizeArea2) end if not isSleeping(cid) then doRegainSpeed(cid) --alterado end end setPlayerStorageValue(cid, stg, -1) return true end if isPlayer(cid) then mayNotMove(cid, true) else --alterado v1.6 doChangeSpeed(cid, -2000) end doSendMagicEffect(getThingPos(cid), eff) addEvent(doParalyze2, 1000, cid, -1, eff, a, false) end function doSleep2(cid, cd, check, first) local stg = conds["Sleep"] if not isCreature(cid) then return true end --is creature? if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then setPlayerStorageValue(cid, stg, cd) --allterado v1.8 return true end if not isSleeping(cid) then addEvent(doSendSleepEffect, 500, cid) end if not check and getPlayerStorageValue(cid, stg) >= 1 then setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1) else setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd) end local a = getPlayerStorageValue(cid, stg) if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then local item = getPlayerSlotItem(getCreatureMaster(cid), 8) doItemSetAttribute(item.uid, "sleep", a) end if a <= -1 then if isPlayer(cid) then if not isParalyze(cid) then mayNotMove(cid, false) --alterado end else if getCreatureCondition(cid, CONDITION_PARALYZE) == true then doRemoveCondition(cid, CONDITION_PARALYZE) addEvent(doAddCondition, 10, cid, paralizeArea2) end if not isParalyze(cid) then doRegainSpeed(cid) --alterado end end setPlayerStorageValue(cid, stg, -1) return true end if first then if getCreatureName(cid) == "Ursaring" and getCreatureCondition(cid, CONDITION_OUTFIT) == true then elseif not isPlayer(cid) then if isInArray({604, 605, 1015, 1016, 1183, 1184}, getCreatureOutfit(cid).lookType) then Info = 0 --alterado v1.6 else Info = getMonsterInfo(getCreatureName(cid)).lookCorpse end local look = getCreatureOutfit(cid) --------- local dittoStg = getPlayerStorageValue(cid, 1010) if getCreatureName(cid) == "Ditto" and isSummon(cid) and tostring(dittoStg) and dittoStg ~= "Ditto" then local InfoDitto = getMonsterInfo(tostring(dittoStg)).lookCorpse if InfoDitto ~= 0 and look.lookType ~= 0 then --doSetCreatureOutfit(cid, {lookType = 0, lookTypeEx = getMonsterInfo(tostring(dittoStg)).lookCorpse}, -1) end else if getCreatureName(cid) == "Shiny Golem" and getCreatureOutfit(cid).lookType == 1403 then doRemoveCondition(cid, CONDITION_OUTFIT) elseif Info ~= 0 and look.lookType ~= 0 then --doSetCreatureOutfit(cid, {lookType = 0, lookTypeEx = getMonsterInfo(getCreatureName(cid)).lookCorpse}, -1) end end end end --alterado v1.6 if isPlayer(cid) then mayNotMove(cid, true) else doChangeSpeed(cid, -getCreatureSpeed(cid)) end addEvent(doSleep2, 1000, cid, -1, a, false) end function doLeech2(cid, attacker, cd, check, damage) local stg = conds["Leech"] if not isCreature(cid) then return true end --is creature? if attacker ~= 0 and not isCreature(attacker) then return true end --is creature? if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then setPlayerStorageValue(cid, stg, cd) --allterado v1.8 return true end if not check and getPlayerStorageValue(cid, stg) >= 1 then setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1) else setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd) end local a = getPlayerStorageValue(cid, stg) if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then local item = getPlayerSlotItem(getCreatureMaster(cid), 8) doItemSetAttribute(item.uid, "leech", a) doItemSetAttribute(item.uid, "leechdmg", damage) end if a <= -1 then setPlayerStorageValue(cid, stg, -1) return true end local life = getCreatureHealth(cid) --damage = getCreatureHealth(cid) - damage <= 0 and getCreatureHealth(cid) - 1 or damage if damage >= life then if isSummon(cid) then if isInDuel(getCreatureMaster(cid)) then doRemoveCountPokemon(getCreatureMaster(cid)) end end doSendAnimatedText(getThingPos(cid), "-"..damage.."", 144) doSendAnimatedText(getThingPos(attacker), "+"..damage.."", 32) doKillWildPoke(attacker, cid) return false end ------ doCreatureAddHealth(cid, -damage) doSendAnimatedText(getThingPos(cid), "-"..damage.."", 144) doSendMagicEffect(getThingPos(cid), 45) ------ local newlife = life - getCreatureHealth(cid) if newlife >= 1 and attacker ~= 0 then doSendMagicEffect(getThingPos(attacker), 14) doCreatureAddHealth(attacker, newlife) doSendAnimatedText(getThingPos(attacker), "+"..newlife.."", 32) local dano = getCreatureHealth(cid)-damage <= 0 and getCreatureHealth(cid)-1 or damage if isSummon(attacker) then -- morrer para veneno local player = getCreatureMaster(attacker) addPlayerDano(cid, player, dano) end end addEvent(doLeech2, 2000, cid, attacker, -1, a, damage) end function doBuff2(cid, cd, eff, check, buff, first, attr) if not isCreature(cid) then return true end --is creature? --------------------- local atributo = attr and attr or "" if first and atributo == "" then for i = 1, 3 do if getPlayerStorageValue(cid, Buffs[i][2]) <= 0 then atributo = Buffs[i][1] break end end end if atributo == "" then return true end if ehMonstro(cid) then atributo = "Buff1" end ---------------------- local stg = conds[atributo] if getPlayerStorageValue(cid, stg) >= 1 and cd ~= -1 then return true end --n usar 2x if not check and getPlayerStorageValue(cid, stg) >= 1 then setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd - 1) else setPlayerStorageValue(cid, stg, getPlayerStorageValue(cid, stg) + cd) end local a = getPlayerStorageValue(cid, stg) if isSummon(cid) and getPlayerStorageValue(cid, 212123) <= 0 then local item = getPlayerSlotItem(getCreatureMaster(cid), 8) doItemSetAttribute(item.uid, atributo, a) doItemSetAttribute(item.uid, atributo.."eff", eff) doItemSetAttribute(item.uid, atributo.."skill", buff) end if a <= -1 then --alterado v1.6 if isInArray({"Psychic Sight", "Heal Bell", "Future Sight", "Defense", "Sky Fall", "Camouflage", "Acid Armor", "Iron Defense", "Minimize", "Bug Fighter", "Ancient Fury"}, buff) then if not isSleeping(cid) then doRemoveCondition(cid, CONDITION_OUTFIT) end setPlayerStorageValue(cid, 9658783, -1) setPlayerStorageValue(cid, 625877, -1) --alterado v1.6 end if isInArray({"Eruption", "Elecball", "Strafe", "Agility", "Ancient Fury", "War Dog", "Fighter Spirit", "Furious Legs", "Ultimate Champion", "Bug Fighter"}, buff) then setPlayerStorageValue(cid, 374896, -1) --alterado v1.6 end setPlayerStorageValue(cid, stg, -1) return true end doSendMagicEffect(getThingPos(cid), eff) if first then if buff == "Strafe" then setPlayerStorageValue(cid, 374896, 1) --velo atk --alterado v1.6 doRaiseStatus(cid, 2, 0, 1000, a) elseif buff == "Eruption" or buff == "Elecball" then doSetCreatureOutfit(cid, {lookType = outFurys[doCorrectString(getCreatureName(cid))].outFury}, a*1000) setPlayerStorageValue(cid, 374896, 1) --velo atk if getCreatureName(cid) == "Shiny Typhlosion" or getCreatureName(cid) == "Elder Typhlosion" then doRaiseStatus(cid, 2, 0, 1000, a) --atk melee --alterado v1.6 else doRaiseStatus(cid, 0, 2, 1000, a) --def end elseif buff == "Tailwind" then doRaiseStatus(cid, 0, 2, 1000, a) elseif buff == "Agility" then doRaiseStatus(cid, 0, 2, 1000, a) elseif buff == "Rage" then setPlayerStorageValue(cid, 374896, 1) --velo atk --alterado v1.6 doRaiseStatus(cid, 2, 0, 1000, a) elseif buff == "Dragon Dance" then setPlayerStorageValue(cid, 374896, 1) --velo atk --alterado v1.6 doRaiseStatus(cid, 2, 2, 1000, a) elseif buff == "Harden" then doRaiseStatus(cid, 0, 2, 0, a) elseif buff == "Charm" then doRaiseStatus(cid, 0, 2, 0, a) elseif buff == "Defense Curl" then doRaiseStatus(cid, 0, 2, 0, a) elseif buff == "Defense Curl" then doRaiseStatus(cid, 0, 7, 0, a) elseif buff == "Kinesis" then doRaiseStatus(cid, 0, 2, 0, a) elseif buff == "Calm Mind" then doRaiseStatus(cid, 2, 0, 0, a) elseif buff == "Dragon Fury" then setPlayerStorageValue(cid, 374896, 1) --velo atk --alterado v1.6 doRaiseStatus(cid, 0, 0, 1000, a) elseif buff == "Ancient Fury" then doSetCreatureOutfit(cid, {lookType = outFurys[doCorrectString(getCreatureName(cid))].outFury}, a*1000) setPlayerStorageValue(cid, 374896, 1) --velo atk if getCreatureName(cid) == "Shiny Charizard" or getCreatureName(cid) == "Elder Charizard" then doRaiseStatus(cid, 2, 0, 1000, a) --atk melee --alterado v1.6 else doRaiseStatus(cid, 0, 2, 1000, a) --def end setPlayerStorageValue(cid, 625877, outFurys[doCorrectString(getCreatureName(cid))].outFury) --alterado v1.6 elseif buff == "War Dog" or buff == "Bulk Up" then doRaiseStatus(cid, 2, 2, 1000, a) elseif buff == "Rest" then doSleep2(cid, cd, getPlayerStorageValue(cid, conds["Sleep"]), true) doCreatureAddHealth(cid, getCreatureMaxHealth(cid)) elseif isInArray({"Fighter Spirit", "Furious Legs", "Ultimate Champion"}, buff) then doRaiseStatus(cid, 2, 2, 1000, a) --atk melee --alterado v1.6 setPlayerStorageValue(cid, 374896, 1) --velo atk addEvent(setPlayerStorageValue, a*1000, cid, 465987, -1) elseif isInArray({"Psychic Sight", "Heal Bell", "Future Sight", "Sky Fall", "Defense", "Camouflage", "Acid Armor", "Iron Defense", "Minimize"}, buff) then doSetCreatureOutfit(cid, {lookType = outImune[buff]}, -1) setPlayerStorageValue(cid, 9658783, 1) setPlayerStorageValue(cid, 625877, outImune[buff]) --alterado v1.6 elseif isInArray({ "Fury Mode"}, buff) then doSetCreatureOutfit(cid, {lookType = outImune[buff]}, -1) doRaiseStatus(cid, 2, 2, 1000, a) --atk melee --alterado v1.6 setPlayerStorageValue(cid, 625877, outImune[buff]) --alterado v1.6 elseif buff == "Bug Fighter" then setPlayerStorageValue(cid, 374896, 1) --velo atk --alterado v1.6 doRaiseStatus(cid, 2, 2, 1000, a) doSetCreatureOutfit(cid, {lookType = 1448}, a*1000) setPlayerStorageValue(cid, 625877, 1448) --alterado v1.6 end end addEvent(doBuff2, 1000, cid, -1, eff, a, buff, false, atributo) end if ret.buff and ret.buff ~= "" then doBuff2(ret.id, ret.cd, ret.eff, ret.check, ret.buff, ret.first, (ret.attr and ret.attr or false)) end if (string.find(getCreatureName(ret.id):lower(), "mega") and isWild(ret.id)) then return true end if isGod(ret.id) then return true end if isSummon(ret.id) and getPokemonBoost(ret.id) ~= 0 and math.random(1, 100) <= getPokemonBoost(ret.id) then --sistema "pegou no boost" if ret.cond and not isInArray({"Poison", "Leech", "Fear"}, ret.cond) then doSendMagicEffect(getThingPosWithDebug(ret.id), 114) doSendAnimatedText(getThingPosWithDebug(ret.id), "BOOST", 215) --alterado v1.8 return true end end if ret.cond and ret.cond == "Miss" then doMiss2(ret.id, ret.cd, ret.eff, ret.check, ret.spell) elseif ret.cond and ret.cond == "Silence" then doSilence2(ret.id, ret.cd, ret.eff, ret.check) elseif ret.cond and ret.cond == "Slow" then doSlow2(ret.id, ret.cd, ret.eff, ret.check, ret.first) elseif ret.cond and ret.cond == "Confusion" then doConfusion2(ret.id, ret.cd, ret.check) elseif ret.cond and ret.cond == "Burn" then doBurn2(ret.id, ret.cd, ret.check, ret.damage) elseif ret.cond and ret.cond == "Poison" then doPoison2(ret.id, ret.cd, ret.check, ret.damage) elseif ret.cond and ret.cond == "Fear" then doFear2(ret.id, ret.cd, ret.check, ret.skill) elseif ret.cond and ret.cond == "Stun" then doStun2(ret.id, ret.cd, ret.eff, ret.check, ret.spell) elseif ret.cond and ret.cond == "Paralyze" then doParalyze2(ret.id, ret.cd, ret.eff, ret.check, ret.first) elseif ret.cond and ret.cond == "Sleep" then doSleep2(ret.id, ret.cd, ret.check, ret.first) elseif ret.cond and ret.cond == "Leech" then doLeech2(ret.id, ret.attacker, ret.cd, ret.check, ret.damage) end end -------------------------------- function cleanBuffs2(item) if item ~= 0 then for i = 1, 3 do doItemEraseAttribute(item, Buffs[i][1]) doItemEraseAttribute(item, Buffs[i][1].."eff") doItemEraseAttribute(item, Buffs[i][1].."skill") end end end -------------------------------- function doCureStatus(cid, type, playerballs) if not isCreature(cid) then return true end if playerballs and isPlayer(cid) then local bp = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK) local mb = getPlayerSlotItem(cid, 8) if isPokeball(mb.itemid) then if not type or type == "all" then for b = 1, #injuries2 do doItemSetAttribute(mb.uid, ""..injuries2[b].n.."", -1) end else doItemSetAttribute(mb.uid, ""..type.."", -1) end end for bname, balls in pairs (pokeballs) do for times = 1,3 do local items = getItemsInContainerById(bp.uid, balls.all[times]) for _, uid in pairs(items) do if not type or type == "all" then for b = 1, #injuries2 do doItemSetAttribute(uid, ""..injuries2[b].n.."", -1) end else doItemSetAttribute(uid, ""..type.."", -1) end end end end end if type == "all" then for a = 1, #injuries2 do setPlayerStorageValue(cid, injuries2[a].m, -1) end return true end for a, b in pairs (injuries2) do if b.n == type then setPlayerStorageValue(cid, b.m, -1) end end end --------------------------------- function isWithCondition(cid) for i = 1, #injuries2 do if getPlayerStorageValue(cid, injuries2[i].m) >= 1 then return true end end return false end --------------------------------- function doCureBallStatus(item, type) if not type or type == "all" then for b = 1, #injuries2 do doItemSetAttribute(item, ""..injuries2[b].n.."", -1) end else doItemSetAttribute(item, ""..type.."", -1) end end --------------------------------- function isBurning(cid) if not isCreature(cid) then return false end if getPlayerStorageValue(cid, conds["Burn"]) >= 0 then return true end return false end function isPoisoned(cid) if not isCreature(cid) then return false end if getPlayerStorageValue(cid, conds["Poison"]) >= 0 then return true end return false end function isSilence(cid) if not isCreature(cid) then return false end if getPlayerStorageValue(cid, conds["Silence"]) >= 0 then return true end return false end function isParalyze(cid) if not isCreature(cid) then return false end if getPlayerStorageValue(cid, conds["Paralyze"]) >= 0 then return true end return false end function isSleeping(cid) if not isCreature(cid) then return false end if getPlayerStorageValue(cid, conds["Sleep"]) >= 0 then return true end return false end function isWithFear(cid) if not isCreature(cid) then return false end if getPlayerStorageValue(cid, conds["Fear"]) >= 0 then return true end return false end ----------------------------------- function doMoveInArea2(cid, eff, area, element, min, max, spell, ret) if not isCreature(cid) then return true end local pos = getPosfromArea(cid, area) --alterado v1.8 setPlayerStorageValue(cid, 21101, -1) local skills = { "Skull Bash", "Gust", "Water Pulse", "Stick Throw", "Last Resort", "Ground Crusher", "Overheat", "Toxic", "Take Down", "Gyro Ball"} --alterado v1.7 local n = 0 local l = 0 while n < #pos do if not isCreature(cid) then return true end if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end n = n+1 thing = {x=pos[n].x,y=pos[n].y,z=pos[n].z,stackpos=253} local pid = getThingFromPosWithProtect(thing) ---- if pid ~= cid then if spell and isInArray(skills, spell) then if spell and spell == "Gyro Ball" then --alterado v1.7 pos[n].x = pos[n].x+1 addEvent(sendEffWithProtect, l*200, cid, pos[n], eff) addEvent(doMoveDano2, l*200, cid, pid, element, min, max, ret, spell) else addEvent(sendEffWithProtect, l*200, cid, pos[n], eff) addEvent(doMoveDano2, l*200, cid, pid, element, min, max, ret, spell) --alterado v1.6 end elseif spell and spell == "Epicenter" then local random = math.random(50, 500) addEvent(sendEffWithProtect, random, cid, pos[n], eff) addEvent(doDanoWithProtect, random, cid, GROUNDDAMAGE, pos[n], crusher, -min, -max, 255) elseif spell and spell == "Shadowave" then posi = {x=pos[n].x, y=pos[n].y+1, z=pos[n].z} sendEffWithProtect(cid, posi, eff) doMoveDano2(cid, pid, element, min, max, ret, spell) --alterado v1.6 elseif spell and spell == "Surf" then addEvent(sendEffWithProtect, math.random(50, 500), cid, pos[n], eff) addEvent(doMoveDano2, 400, cid, pid, element, min, max, ret, spell) --alterado v1.6 elseif spell and spell == "Sand Attack" then addEvent(sendEffWithProtect, n*200, cid, pos[n], eff) addEvent(doMoveDano2, n*200, cid, pid, element, min, max, ret, spell) --alterado v1.6 elseif spell and (spell == "Muddy Water" or spell == "Venom Motion") then local arr = { [1] = 0, [2] = 0, [3] = 0, [4] = 200, [5] = 200, [6] = 200, [7] = 400, [8] = 400, [9] = 400, [10] = 600, [11] = 600, [12] = 600, [13] = 800, [14] = 800, [15] = 800 } local time = {0, 200, 400, 600, 800} addEvent(sendEffWithProtect, arr[n], cid, pos[n], eff) addEvent(doMoveDano2, arr[n], cid, pid, element, min, max, ret, spell) elseif spell and (spell == "Inferno" or spell == "Fissure") then addEvent(sendEffWithProtect, math.random(0, 500), cid, pos[n], eff) addEvent(doMoveDano2, math.random(0, 500), cid, pid, element, min, max, ret, spell) elseif spell == "Last Resort" then local pos = getThingPosWithDebug(cid) local areas = {rock5, rock4, rock3, rock2, rock1, rock5, rock4, rock3, rock2, rock1} for i = 0, 9 do addEvent(doMoveInArea2, i*400, cid, 3, areas[i+1], NORMALDAMAGE, min, max, spell) addEvent(doMoveInArea2, i*410, cid, 3, areas[i+1], NORMALDAMAGE, 0, 0, spell) end else sendEffWithProtect(cid, pos[n], eff) doMoveDano2(cid, pid, element, min, max, ret, spell) end end l = l+1 end end ------------------------------------------- function doMoveDano2(cid, pid, element, min, max, ret, spell) if isCreature(pid) and isCreature(cid) and cid ~= pid then if isNpcSummon(pid) and getCreatureTarget(pid) ~= cid then return true --alterado v1.6 end if ehNPC(pid) then return true end --- local canAtk = true --alterado v1.6 if getPlayerStorageValue(pid, 21099) >= 1 then doSendMagicEffect(getThingPosWithDebug(pid), 135) doSendAnimatedText(getThingPosWithDebug(pid), "REFLECT", COLOR_GRASS) addEvent(docastspell, 100, pid, spell) if getCreatureName(pid) == "Wobbuffet" or getCreatureName(pid) == "Reflector Wobbuffet" or getCreatureName(pid) == "Wowofet" then doRemoveCondition(pid, CONDITION_OUTFIT) end canAtk = false setPlayerStorageValue(pid, 21099, -1) setPlayerStorageValue(pid, 21100, 1) setPlayerStorageValue(pid, 21101, cid) setPlayerStorageValue(pid, 21103, getTableMove(cid, getPlayerStorageValue(cid, 21102)).f) end --- if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end if isSummon(cid) and (ehMonstro(pid) or (isSummon(pid) and canAttackOther(cid, pid) == "Can") or (isPlayer(pid) and canAttackOther(cid, pid) == "Can" and #getCreatureSummons(pid) <= 0)) and pid ~= cid then if canAtk then --alterado v1.6 if ret and ret.cond then ret.id = pid ret.check = getPlayerStorageValue(pid, conds[ret.cond]) doCondition2(ret) end doTargetCombatHealth(cid, pid, element, -(math.abs(min)), -(math.abs(max)), 255) end elseif ehMonstro(cid) and (isSummon(pid) or (isPlayer(pid) and #getCreatureSummons(pid) <= 0)) and pid ~= cid then if canAtk then --alterado v1.6 if ret and ret.cond then ret.id = pid ret.check = getPlayerStorageValue(pid, conds[ret.cond]) doCondition2(ret) end doTargetCombatHealth(cid, pid, element, -(math.abs(min)), -(math.abs(max)), 255) end elseif isPlayer(cid) and ehMonstro(pid) and pid ~= cid then if canAtk then --alterado v1.6 if ret and ret.cond then ret.id = pid ret.check = getPlayerStorageValue(pid, conds[ret.cond]) doCondition2(ret) end doTargetCombatHealth(cid, pid, element, -(math.abs(min)), -(math.abs(max)), 255) end end end end -------------------------------------------------------------------------------- function sendEffWithProtect(cid, pos, eff) --Manda algum magic effect com proteçoes if not isCreature(cid) then return true end if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end local checkpos = pos checkpos.stackpos = 0 if not hasTile(checkpos) then return true end if not canWalkOnPos2(pos, false, true, false, true, false) then --alterado v1.6 return true end doSendMagicEffect(pos, eff) end --------------------------------------------------------------------------------- function getThingPosWithDebug(what) if not isCreature(what) or getCreatureHealth(what) <= 0 then return {x = 1, y = 1, z = 10} end return getThingPos(what) end --------------------------------------------------------------------------------- function doDanoWithProtect(cid, element, pos, area, min, max, eff) --Da dano com proteçoes if not isCreature(cid) then return true end if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end doAreaCombatHealth(cid, element, pos, area, -(math.abs(min)), -(math.abs(max)), eff) --print("Erro subistituir magia: " .. getPlayerStorageValue(cid, 21102)) end --------------------------------------------------------------------------------- function doDanoWithProtectWithDelay(cid, target, element, min, max, eff, area) const_distance_delay = 56 if not isCreature(cid) then return true end if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end if target ~= 0 and isCreature(target) and not area then delay = getDistanceBetween(getThingPosWithDebug(cid), getThingPosWithDebug(target)) * const_distance_delay addEvent(doDanoWithProtect, delay, cid, element, getThingPosWithDebug(target), 0, min, max, eff) return true end addEvent(doDanoWithProtect, 200, cid, element, getThingPosWithDebug(target), area, min, max, eff) end -------------------------------------------------------------------------------- function sendDistanceShootWithProtect(cid, frompos, topos, eff) --Manda um efeito de distancia com proteçoes if not isCreature(cid) then return true end if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end doSendDistanceShoot(frompos, topos, eff) end --------------------------------------------------------------------------------- function sendMoveBack(cid, pos, eff, min, max) --Manda o Atk do farfetchd de volta... local m = #pos+1 for i = 1, #pos do if not isCreature(cid) then return true end --- m = m-1 thing = {x=pos[m].x,y=pos[m].y,z=pos[m].z,stackpos=253} local pid = getThingFromPosWithProtect(thing) addEvent(doMoveDano2, i*200, cid, pid, FLYINGDAMAGE, min/4, max/4) addEvent(sendEffWithProtect, i*200, cid, pos[m], eff) --alterado v1.3 -- end end --------------------------------------------------------------------------------- function upEffect(cid, effDis) if not isCreature(cid) then return true end if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end pos = getThingPos(cid) frompos = {x = pos.x+1, y = pos.y, z = pos.z} frompos.x = pos.x - math.random(4, 7) frompos.y = pos.y - math.random(5, 8) doSendDistanceShoot(getThingPos(cid), frompos, effDis) end --------------------------------------------------------------------------------- function fall(cid, master, element, effDis, effArea) --Function pra jogar efeitos pra cima e cair depois... tpw falling rocks e blizzard if isCreature(cid) then if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end pos = getThingPos(cid) pos.x = pos.x + math.random(-4,4) pos.y = pos.y + math.random(-4,4) if isMonster(cid) or isPlayer(cid) then frompos = {x = pos.x+1, y = pos.y, z = pos.z} elseif isSummon(cid) then frompos = getThingPos(master) end frompos.x = pos.x - 7 frompos.y = pos.y - 6 if effDis ~= -1 then --alterado! doSendDistanceShoot(frompos, pos, effDis) end doAreaCombatHealth(cid, element, pos, 0, 0, 0, effArea) end end --------------------------------------------------------------------------------- function canDoMiss(cid, nameAtk) --alterado v1.5 local atkPsy = {"Confusion", "Confuse Ray", "Night Shade", "Fear", "Dizzy Punch", "Psyusion", "Divine Punishment", "Focus Blast", "Stunning Confusion"} local atkPhan = {"Night Shade"} --alterado v1.7 local atkTerra = {"Sand Attack", "Mud Shot", "Mud Bomb", "Stomp", "Crusher Stomp", "Mud Slap", "Sand Tomb", "Super Sonic"} --alterado v1.7 local atkElectric = {"Electric Storm", "Thunder Wave", "Thunder", "Shock-Counter", "Wild Charge"} --alterado v1.7 if not isCreature(cid) then return false end if isPlayer(cid) then return true end if not pokes[getCreatureName(cid)] then return true end if isInArray(atkTerra, nameAtk) then if (pokes[getCreatureName(cid)].type == "flying") or (pokes[getCreatureName(cid)].type2 == "flying") or isInArray(specialabilities["levitate"], getCreatureName(cid)) then return false end elseif isInArray(atkPsy, nameAtk) then if (pokes[getCreatureName(cid)].type == "dark") or (pokes[getCreatureName(cid)].type2 == "dark") or isInArray(specialabilities["never"], getCreatureName(cid)) then return false end elseif isInArray(atkElectric, nameAtk) then if (pokes[getCreatureName(cid)].type == "ground") or (pokes[getCreatureName(cid)].type2 == "ground") then return false end elseif isInArray(atkPhan, nameAtk) then if (pokes[getCreatureName(cid)].type == "normal") or (pokes[getCreatureName(cid)].type2 == "normal") then return false end end return true end function doMoveInAreaMulti(cid, effDis, effMagic, areaEff, areaDano, element, min, max, ret) --alterado v1.7 if not isCreature(cid) then return true end local pos = getPosfromArea(cid, areaEff) local pos2 = getPosfromArea(cid, areaDano) local n = 0 while n < #pos2 do if not isCreature(cid) then return true end if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end n = n+1 thing = {x=pos2[n].x,y=pos2[n].y,z=pos2[n].z,stackpos=253} if n < #pos then addEvent(sendDistanceShootWithProtect, 50, cid, getThingPos(cid), pos[n], effDis) --39 addEvent(sendEffWithProtect, 100, cid, pos[n], effMagic) -- 112 --- --alterado v1.6.1 if math.random(1, 2) == 2 then addEvent(sendDistanceShootWithProtect, 450, cid, getThingPos(cid), pos[n], effDis) --550 addEvent(sendEffWithProtect, 550, cid, pos[n], effMagic) -- 650 end end local pid = getThingFromPosWithProtect(thing) if isCreature(pid) then if ret and ret.id == 0 then --alterado v1.8 ret.id = pid ret.check = getPlayerStorageValue(pid, conds[ret.cond]) end if not ret then ret = {} end --alterado v1.7 doMoveDano2(cid, pid, element, min, max, ret, getPlayerStorageValue(cid, 21102)) end end end --------------------------------------------------------------------------------------- function doDoubleHit(cid, pid, valor, cor) --alterado v1.6 if isCreature(cid) and isCreature(pid) then if getPlayerStorageValue(cid, 374896) >= 1 then if isInArray({"Kadabra", "Alakazam", "Mew", "Shiny Abra", "Shiny Alakazam"}, getCreatureName(cid)) then doSendDistanceShoot(getThingPosWithDebug(cid), getThingPosWithDebug(pid), 39) end valor = valor * -1 doCreatureAddHealth(pid, -math.abs(valor)) doSendMagicEffect(getThingPos(pid), 3) doSendAnimatedText(getThingPos(pid), (valor == 0 and "" or valor), cor) end end end --------------------------------------------------------------------------------------- function doDanoInTarget(cid, target, combat, min, max, eff) --alterado v1.7 if not isCreature(cid) or not isCreature(target) then return true end if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end doTargetCombatHealth(cid, target, combat, -math.abs(min), -math.abs(max), eff) end ----------------------------------------------------------------------------------------- function doDanoInTargetWithDelay(cid, target, combat, min, max, eff) --alterado v1.7 const_distance_delay = 56 if not isCreature(cid) or not isCreature(target) then return true end if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end local delay = getDistanceBetween(getThingPosWithDebug(cid), getThingPosWithDebug(target)) * const_distance_delay addEvent(doDanoInTarget, delay, cid, target, combat, min, max, eff) end Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui.
-
[BUG] Move não funciona quando está em target
falei errado kzkzk PZ n é battle se voce tiver em Battle n funfa o order eu to tentando tirar isso também mas sempre da erro no código
-
[BUG] Move não funciona quando está em target
é PZ man tipo ele tem uma configuração que quando ta em PZ o poke n move e pode testar usar rock smash com PZ pra vc ver ele n se move
-
NPC OAK!
Script! local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid msg = msg:lower() local reward_starter = { {2160, 5}, {12344, 10}, {12345, 10}, {12346, 10}, {12347, 10}, {12348, 15}, {12349, 15}, {2394, 50} } local places = { ["pallet"] = 1, ["viridian"] = 2, ["pewter"] = 3, ["cerulean"] = 4, ["saffron"] = 5, ["celadon"] = 6, ["lavender"] = 7, ["vermilion"] = 8, ["fuchsia"] = 9, ["cinnabar"] = 10, } local Choose = {"bulbasaur", "charmander", "squirtle", "chikorita", "cyndaquil", "totodile", "treecko", "mudkip", "torchic"} local sto_Oak = 748513 local sto_city = 13611 if msgcontains(string.lower(msg), 'cidade') or msgcontains(string.lower(msg), 'help') then if getPlayerStorageValue(cid, sto_city) == 1 then selfSay("Please choose now your new pokemon!", cid) doPlayerSendCancel(cid, "#cnp#") talkState[talkUser] = 0 return true elseif getPlayerStorageValue(cid, sto_city) == 2 then selfSay("Voce ja escolheu seu pokemon!", cid) return true elseif getPlayerStorageValue(cid, sto_Oak) < 1 then selfSay("Go talk with the Delia first!", cid) return true else selfSay("You can choose your beginner town between: {Saffron, Cerulean, Lavender, Fuchsia, Celadon, Viridian, Vermilion, Pewter or Cinnabar}.", cid) talkState[talkUser] = 2 return true end elseif places[msg] and talkState[talkUser] == 2 then city = msg selfSay("Are you sure which you want to begin in {".. doCorrectString(msg) .."}?", cid) talkState[talkUser] = 3 return true elseif msgcontains(msg, "yes") or msgcontains(msg, "sim") and talkState[talkUser] == 3 then selfSay("OK then... Now your beginner town is ".. doCorrectString(city)..".", cid) selfSay("Ok, talk {Choose poke or escolhe poke} and complete this mission!", cid) doPlayerSetTown(cid, places[city]) talkState[talkUser] = 4 -- alterado a baixo \/ elseif msgcontains(msg, "choose poke") or msgcontains(msg, "escolhe poke") and talkState[talkUser] == 4 then selfSay("pronto para {iniciar}?", cid) talkState[talkUser] = 5 elseif msgcontains(msg, "iniciar") or msgcontains(msg, "antigo") and talkState[talkUser] == 5 then selfSay("Ok, escolha seu pokemon, Pokes Kanto! {Charmander, Bulbasaur, Squirtle}, Pokes Johto! {Chikorita, Cyndaquil, Totodile} ou Hooen {Treecko, Mudkip, Torchic} qual voce prefere?", cid) talkState[talkUser] = 6 elseif isInArray(Choose, msg) and talkState[talkUser] == 6 then addPokeToPlayer(cid, msg, 0, -1, 'normal', true) doSendMagicEffect(getThingPos(cid), 21) selfSay("Ok, good luck on your journey.", cid) for i = 1, #reward_starter do doPlayerAddItem(cid, reward_starter[i][1], reward_starter[i][2]) end setPlayerStorageValue(cid, sto_city, 2) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), false) talkState[talkUser] = 0 elseif msgcontains(msg, "new") or msgcontains(msg, "novo") and talkState[talkUser] == 4 then -- botei talkState 4 reve pra min ce ta certo setPlayerStorageValue(cid, sto_city, 1) selfSay("Please choose now your new pokemon!", cid) doPlayerSendCancel(cid, "#cnp#") talkState[talkUser] = 0 return true elseif msgcontains(msg, "no") or msgcontains(msg, "No") and talkState[talkUser] == 3 then selfSay("Ok then... say again what city you want to begin!", cid) talkState[talkUser] = 0 return true end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) galera preciso que OAK não deixe os player pegar novamente os pokes iniciais!você consegue voltar e ficar pegando quantas vezes quiser se você pular a frase no lugar de cidade escrever Iniciar ele te coloca na lista de seleção de poke
-
(Resolvido)Preciso de uma Talkaction ou Npc
Eu mesmo já resolvi hehe vou deixar as scripts aki pra quem quiser testado no DXP HeldRecovery --> para helds no estilo X HeldRecovery2 --> para helds no estilo Y heldRecovery.lua heldRecovery2.lua São Actions de itens creio eu que muitos sabem como configurar
-
[BUG] Status do pokemon [DXP]
Mano eu uso essa base tem um tempão modifiquei muita coisa e eu consegui uma balanceada certa nele se quiser te passo as scripts
-
[Vault System] Sistema de Cofre
Cara mto bom mesmo se ja conseguiu a edição com a Janela pro OTClient?
-
Problema com arquivo a ser importado no site
Erro Comando SQL: -- Table: server_config CREATE TABLE server_config( config VARCHAR( 35 ) NOT NULL DEFAULT '', value INTEGER NOT NULL , UNIQUE ( config ) ); Mensagens do MySQL : #1050 - Table 'server_config' already exists Então galera quando tento importar minha SQL aparece esse erro alguém sabe resolver isso?
- Erro com site
-
Erro com site
tento criar o site e da esses erros Um erro do PHP foi encontrado Gravidade: aviso Mensagem: apenas variáveis devem ser passadas por referência Nome do arquivo: codeigniter / Common.php Número de linha: 148 Um erro do PHP foi encontrado Gravidade: 8192 Mensagem: Métodos com o mesmo nome de sua classe não serão construtores em uma versão futura do PHP; CI_Hooks tem um construtor obsoleto Nome do arquivo: libraries / Hooks.php Número de linha: 30 Um erro do PHP foi encontrado Gravidade: 8192 Mensagem: Métodos com o mesmo nome de sua classe não serão construtores em uma versão futura do PHP; CI_Config tem um construtor obsoleto Nome do arquivo: libraries / Config.php Número de linha: 29 Um erro do PHP foi encontrado Gravidade: aviso Mensagem: apenas variáveis devem ser passadas por referência Nome do arquivo: codeigniter / Common.php Número de linha: 148 Um erro do PHP foi encontrado Gravidade: aviso Mensagem: apenas variáveis devem ser passadas por referência Nome do arquivo: codeigniter / Common.php Número de linha: 148 Um erro do PHP foi encontrado Gravidade: 8192 Mensagem: Métodos com o mesmo nome de sua classe não serão construtores em uma versão futura do PHP; CI_URI tem um construtor obsoleto Nome do arquivo: libraries / URI.php Número de linha: 29 Um erro do PHP foi encontrado Gravidade: aviso Mensagem: apenas variáveis devem ser passadas por referência Nome do arquivo: codeigniter / Common.php Número de linha: 148 Um erro do PHP foi encontrado Gravidade: 8192 Mensagem: Métodos com o mesmo nome de sua classe não serão construtores em uma versão futura do PHP; CI_Router tem um construtor obsoleto Nome do arquivo: libraries / Router.php Número de linha: 29 Um erro do PHP foi encontrado Gravidade: aviso Mensagem: apenas variáveis devem ser passadas por referência Nome do arquivo: codeigniter / Common.php Número de linha: 148 Um erro do PHP foi encontrado Gravidade: 8192 Mensagem: Métodos com o mesmo nome de sua classe não serão construtores em uma versão futura do PHP; CI_Output possui um construtor obsoleto Nome do arquivo: libraries / Output.php Número de linha: 29 Um erro do PHP foi encontrado Gravidade: aviso Mensagem: apenas variáveis devem ser passadas por referência Nome do arquivo: codeigniter / Common.php Número de linha: 148 Um erro do PHP foi encontrado Gravidade: 8192 Mensagem: Métodos com o mesmo nome de sua classe não serão construtores em uma versão futura do PHP; CI_Input tem um construtor obsoleto Nome do arquivo: libraries / Input.php Número de linha: 29 Um erro do PHP foi encontrado Gravidade: aviso Mensagem: apenas variáveis devem ser passadas por referência Nome do arquivo: codeigniter / Common.php Número de linha: 148 Um erro do PHP foi encontrado Gravidade: 8192 Mensagem: Métodos com o mesmo nome de sua classe não serão construtores em uma versão futura do PHP; CI_Language tem um construtor obsoleto Nome do arquivo: libraries / Language.php Número de linha: 27 Um erro do PHP foi encontrado Gravidade: aviso Mensagem: apenas variáveis devem ser passadas por referência Nome do arquivo: codeigniter / Common.php Número de linha: 148 Um erro do PHP foi encontrado Gravidade: 8192 Mensagem: Métodos com o mesmo nome de sua classe não serão construtores em uma versão futura do PHP; CI_Base tem um construtor obsoleto Nome do arquivo: codeigniter / Base5.php Número de linha: 33 Um erro do PHP foi encontrado Gravidade: 8192 Mensagem: Métodos com o mesmo nome de sua classe não serão construtores em uma versão futura do PHP; O controlador tem um construtor obsoleto Nome do arquivo: libraries / Controller.php Número de linha: 30 Um erro do PHP foi encontrado Gravidade: 8192 Mensagem: Métodos com o mesmo nome de sua classe não serão construtores em uma versão futura do PHP; CI_Loader tem um construtor obsoleto Nome do arquivo: libraries / Loader.php Número de linha: 29 Um erro do PHP foi encontrado Gravidade: aviso Mensagem: apenas variáveis devem ser passadas por referência Nome do arquivo: codeigniter / Common.php Número de linha: 148 Um erro do PHP foi encontrado Gravidade: 8192 Mensagem: Métodos com o mesmo nome de sua classe não serão construtores em uma versão futura do PHP; O modelo tem um construtor obsoleto Nome do arquivo: libraries / Model.php Número de linha: 27 Um erro do PHP foi encontrado Gravidade: 8192 Mensagem: Métodos com o mesmo nome de sua classe não serão construtores em uma versão futura do PHP; CI_DB_driver tem um construtor obsoleto Nome do arquivo: database / DB_driver.php Número de linha: 31 Um erro do PHP foi encontrado Gravidade: aviso Mensagem: apenas variáveis devem ser passadas por referência Nome do arquivo: database / DB.php Número de linha: 133 Erro fatal : Erro não detectado: Chamar a função indefinida mysql_pconnect () em ? \ xampp \ htdocs \ system \ banco de dados \ drivers \ mysql \ mysql_driver.php: 88 Rastreamento de pilha: # 0 ? \ xampp \ htdocs \ system \ database \ DB_driver.php (115): CI_DB_mysql_driver-> db_pconnect () # 1 ? \ xampp \ htdocs \ system \ banco de dados \ DB.php (137): CI_DB_driver-> inicializar () # 2 ? \ xampp \ htdocs \ system \ bibliotecas \ Loader.php (224): DB (matriz, falsa) # 3 ? \ xampp \ htdocs \ system \ aplicativo \ models \ home_model.php (6): CI_Loader-> banco de dados () # 4 ? \ xampp \ htdocs \ system \ libraries \ Loader.php (184): home_model -> __ construct () # 5 ? \ xampp \ htdocs \ system \ aplicativo \ controllers \ home.php (7): CI_Loader-> model ('Home_model') # 6 ? \ xampp \ htdocs \ system \ codeigniter \ CodeIgniter.php (236): Home-> índice () # 7 ? \ xampp \ htdocs \ index.php (165): require_once ('C: \\ xampp \\ htdocs ... ') # 8 {main} lançado em? \ xampp \ htdocs \ system \ banco de dados \ drivers \ mysql \ mysql_driver.php na linha 88
-
Problemas em deixar o Serv ON
-
Problemas em deixar o Serv ON
Galera estou tento problemas em colocar o servidor online pelo no-ip configurei as portas 7171/7172 no win10 acessei no roteador Dir-615 da D-Link já abri as portas la tambem porem quando vou colcoar o servidor online ele não entra da erro de conect fiz o test nas portas e dizem que estão fechadas tem como alguem me ajudar?
-
(Resolvido)Preciso de uma Talkaction ou Npc
Galera quero uma script talk ou que um npc execute pra seguinte sistema todos conhecemos o Sistema de Held's X e Y do Pokemon eu gostaria de um comando ou npc que removessem os helds e o devolvessem ao player que solicitou Ex: tenho um Scyther com X-Attack (tier :7) quero vender ele mas sem o held dai pelo comando ou npc eu retiro e vendo pois o npc não vai cobrar o valor do held que há nele Caso o tópico esteja no lugar errado arrumem pra mim pois fiquei indeciso em onde colocar para quem conseguir me ajudar agradeço desde já Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui.
-
[Link Quebrado]DarkXPoke - Download Servidor.
Link quebrado '-' arruma aew
-
Dinheiro!!!
Mano é a Padrão do Market sabe Aquela bem old que você coloca o nome do item, id, preço
-
Dinheiro!!!
Galera é possível aumentar o dinheiro que o NPC reconhece? Meus NPCs apenas reconhecem 20KK séria possível aumentar pra mais?
-
Erro Com Smeargle System!!!
Até o momento nada man
-
(Resolvido)TFS Problema no Creaturescript.cpp
Valeu mano consegui arrumar hehe REP+
-
(Resolvido)TFS Problema no Creaturescript.cpp
estou com um problema na linha 1941 na script . a script é esta //////////////////////////////////////////////////////////////////////// // OpenTibia - an opensource roleplaying game //////////////////////////////////////////////////////////////////////// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. //////////////////////////////////////////////////////////////////////// #include "otpch.h" #ifdef __DEBUG_LUASCRIPTS__ #include <sstream> #endif #include "creatureevent.h" #include "player.h" #include "tools.h" CreatureEvents::CreatureEvents(): m_interface("CreatureScript Interface") { m_interface.initState(); } CreatureEvents::~CreatureEvents() { CreatureEventList::iterator it; for(it = m_creatureEvents.begin(); it != m_creatureEvents.end(); ++it) delete it->second; } void CreatureEvents::clear() { //clear creature events for(CreatureEventList::iterator it = m_creatureEvents.begin(); it != m_creatureEvents.end(); ++it) it->second->clearEvent(); //clear lua state m_interface.reInitState(); } Event* CreatureEvents::getEvent(const std::string& nodeName) { std::string tmpNodeName = asLowerCaseString(nodeName); if(tmpNodeName == "event" || tmpNodeName == "creaturevent" || tmpNodeName == "creatureevent" || tmpNodeName == "creaturescript") return new CreatureEvent(&m_interface); return NULL; } bool CreatureEvents::registerEvent(Event* event, xmlNodePtr p, bool override) { CreatureEvent* creatureEvent = dynamic_cast<CreatureEvent*>(event); if(!creatureEvent) return false; if(creatureEvent->getEventType() == CREATURE_EVENT_NONE) { std::cout << "[Error - CreatureEvents::registerEvent] Trying to register event without type!" << std::endl; return false; } if(CreatureEvent* oldEvent = getEventByName(creatureEvent->getName(), false)) { //if there was an event with the same type that is not loaded (happens when realoading), it is reused if(oldEvent->getEventType() == creatureEvent->getEventType() && (!oldEvent->isLoaded() || override)) oldEvent->copyEvent(creatureEvent); /*delete creatureEvent; return override;*/ return false; } //if not, register it normally m_creatureEvents[creatureEvent->getName()] = creatureEvent; return true; } CreatureEvent* CreatureEvents::getEventByName(const std::string& name, bool forceLoaded /*= true*/) { CreatureEventList::iterator it = m_creatureEvents.find(name); if(it != m_creatureEvents.end()) { if(!forceLoaded || it->second->isLoaded()) return it->second; } return NULL; } bool CreatureEvents::playerLogin(Player* player) { //fire global event if is registered bool result = true; for(CreatureEventList::iterator it = m_creatureEvents.begin(); it != m_creatureEvents.end(); ++it) { if(it->second->getEventType() == CREATURE_EVENT_LOGIN && !it->second->executeLogin(player) && result) result = false; } return result; } bool CreatureEvents::playerLogout(Player* player, bool forceLogout) { //fire global event if is registered bool result = true; for(CreatureEventList::iterator it = m_creatureEvents.begin(); it != m_creatureEvents.end(); ++it) { if(it->second->getEventType() == CREATURE_EVENT_LOGOUT && !it->second->executeLogout(player, forceLogout) && result) result = false; } return forceLogout || result; } ///////////////////////////////////// CreatureEvent::CreatureEvent(LuaScriptInterface* _interface): Event(_interface) { m_type = CREATURE_EVENT_NONE; m_isLoaded = false; } bool CreatureEvent::configureEvent(xmlNodePtr p) { std::string str; if(!readXMLString(p, "name", str)) { std::cout << "[Error - CreatureEvent::configureEvent] No name for creature event." << std::endl; return false; } m_eventName = str; if(!readXMLString(p, "type", str)) { std::cout << "[Error - CreatureEvent::configureEvent] No type for creature event." << std::endl; return false; } std::string tmpStr = asLowerCaseString(str); if(tmpStr == "login") m_type = CREATURE_EVENT_LOGIN; else if(tmpStr == "logout") m_type = CREATURE_EVENT_LOGOUT; else if(tmpStr == "joinchannel") m_type = CREATURE_EVENT_CHANNEL_JOIN; else if(tmpStr == "leavechannel") m_type = CREATURE_EVENT_CHANNEL_LEAVE; else if(tmpStr == "advance") m_type = CREATURE_EVENT_ADVANCE; else if(tmpStr == "sendmail") m_type = CREATURE_EVENT_MAIL_SEND; else if(tmpStr == "receivemail") m_type = CREATURE_EVENT_MAIL_RECEIVE; else if(tmpStr == "traderequest") m_type = CREATURE_EVENT_TRADE_REQUEST; else if(tmpStr == "tradeaccept") m_type = CREATURE_EVENT_TRADE_ACCEPT; else if(tmpStr == "textedit") m_type = CREATURE_EVENT_TEXTEDIT; else if(tmpStr == "reportbug") m_type = CREATURE_EVENT_REPORTBUG; else if(tmpStr == "look") m_type = CREATURE_EVENT_LOOK; else if(tmpStr == "think") m_type = CREATURE_EVENT_THINK; else if(tmpStr == "direction") m_type = CREATURE_EVENT_DIRECTION; else if(tmpStr == "outfit") m_type = CREATURE_EVENT_OUTFIT; else if(tmpStr == "statschange") m_type = CREATURE_EVENT_STATSCHANGE; else if(tmpStr == "areacombat") m_type = CREATURE_EVENT_COMBAT_AREA; else if(tmpStr == "push") m_type = CREATURE_EVENT_PUSH; else if(tmpStr == "target") m_type = CREATURE_EVENT_TARGET; else if(tmpStr == "follow") m_type = CREATURE_EVENT_FOLLOW; else if(tmpStr == "combat") m_type = CREATURE_EVENT_COMBAT; else if(tmpStr == "attack") m_type = CREATURE_EVENT_ATTACK; else if(tmpStr == "cast") m_type = CREATURE_EVENT_CAST; else if(tmpStr == "kill") m_type = CREATURE_EVENT_KILL; else if(tmpStr == "death") m_type = CREATURE_EVENT_DEATH; else if(tmpStr == "preparedeath") m_type = CREATURE_EVENT_PREPAREDEATH; else if(tmpStr == "spawn") m_type = CREATURE_EVENT_SPAWN; else { std::cout << "[Error - CreatureEvent::configureEvent] No valid type for creature event." << str << std::endl; return false; } m_isLoaded = true; return true; } std::string CreatureEvent::getScriptEventName() const { switch(m_type) { case CREATURE_EVENT_LOGIN: return "onLogin"; case CREATURE_EVENT_LOGOUT: return "onLogout"; case CREATURE_EVENT_CHANNEL_JOIN: return "onJoinChannel"; case CREATURE_EVENT_CHANNEL_LEAVE: return "onLeaveChannel"; case CREATURE_EVENT_THINK: return "onThink"; case CREATURE_EVENT_ADVANCE: return "onAdvance"; case CREATURE_EVENT_LOOK: return "onLook"; case CREATURE_EVENT_DIRECTION: return "onDirection"; case CREATURE_EVENT_OUTFIT: return "onOutfit"; case CREATURE_EVENT_MAIL_SEND: return "onSendMail"; case CREATURE_EVENT_MAIL_RECEIVE: return "onReceiveMail"; case CREATURE_EVENT_TRADE_REQUEST: return "onTradeRequest"; case CREATURE_EVENT_TRADE_ACCEPT: return "onTradeAccept"; case CREATURE_EVENT_TEXTEDIT: return "onTextEdit"; case CREATURE_EVENT_REPORTBUG: return "onReportBug"; case CREATURE_EVENT_STATSCHANGE: return "onStatsChange"; case CREATURE_EVENT_COMBAT_AREA: return "onAreaCombat"; case CREATURE_EVENT_PUSH: return "onPush"; case CREATURE_EVENT_TARGET: return "onTarget"; case CREATURE_EVENT_FOLLOW: return "onFollow"; case CREATURE_EVENT_COMBAT: return "onCombat"; case CREATURE_EVENT_ATTACK: return "onAttack"; case CREATURE_EVENT_CAST: return "onCast"; case CREATURE_EVENT_KILL: return "onKill"; case CREATURE_EVENT_DEATH: return "onDeath"; case CREATURE_EVENT_PREPAREDEATH: return "onPrepareDeath"; case CREATURE_EVENT_SPAWN: return "onSpawn"; case CREATURE_EVENT_NONE: default: break; } return ""; } std::string CreatureEvent::getScriptEventParams() const { switch(m_type) { case CREATURE_EVENT_LOGIN: return "cid"; case CREATURE_EVENT_LOGOUT: return "cid, forceLogout"; case CREATURE_EVENT_CHANNEL_JOIN: case CREATURE_EVENT_CHANNEL_LEAVE: return "cid, channel, users"; case CREATURE_EVENT_ADVANCE: return "cid, skill, oldLevel, newLevel"; case CREATURE_EVENT_LOOK: return "cid, thing, position, lookDistance"; case CREATURE_EVENT_MAIL_SEND: return "cid, receiver, item, openBox"; case CREATURE_EVENT_MAIL_RECEIVE: return "cid, sender, item, openBox"; case CREATURE_EVENT_TRADE_REQUEST: case CREATURE_EVENT_TRADE_ACCEPT: return "cid, target, item"; case CREATURE_EVENT_TEXTEDIT: return "cid, item, newText"; case CREATURE_EVENT_REPORTBUG: return "cid, comment"; case CREATURE_EVENT_THINK: return "cid, interval"; case CREATURE_EVENT_DIRECTION: case CREATURE_EVENT_OUTFIT: return "cid, old, current"; case CREATURE_EVENT_STATSCHANGE: return "cid, attacker, type, combat, value"; case CREATURE_EVENT_COMBAT_AREA: return "cid, ground, position, aggressive"; case CREATURE_EVENT_PUSH: case CREATURE_EVENT_TARGET: case CREATURE_EVENT_FOLLOW: case CREATURE_EVENT_COMBAT: case CREATURE_EVENT_ATTACK: case CREATURE_EVENT_CAST: return "cid, target"; case CREATURE_EVENT_KILL: return "cid, target, lastHit"; case CREATURE_EVENT_DEATH: return "cid, corpse, deathList"; case CREATURE_EVENT_PREPAREDEATH: return "cid, deathList"; case CREATURE_EVENT_SPAWN: return "cid"; case CREATURE_EVENT_NONE: default: break; } return ""; } void CreatureEvent::copyEvent(CreatureEvent* creatureEvent) { m_scriptId = creatureEvent->m_scriptId; m_interface = creatureEvent->m_interface; m_scripted = creatureEvent->m_scripted; m_isLoaded = creatureEvent->m_isLoaded; } void CreatureEvent::clearEvent() { m_scriptId = 0; m_interface = NULL; m_scripted = EVENT_SCRIPT_FALSE; m_isLoaded = false; } uint32_t CreatureEvent::executeLogin(Player* player) { //onLogin(cid) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(player->getPosition()); std::stringstream scriptstream; scriptstream << "local cid = " << env->addThing(player) << std::endl; scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ char desc[35]; sprintf(desc, "%s", player->getName().c_str()); env->setEventDesc(desc); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(player->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(player)); bool result = m_interface->callFunction(1); m_interface->releaseEnv(); return result; } } else { std::cout << "[Error - CreatureEvent::executeLogin] Call stack overflow." << std::endl; return 0; } } uint32_t CreatureEvent::executeLogout(Player* player, bool forceLogout) { //onLogout(cid, forceLogout) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(player->getPosition()); std::stringstream scriptstream; scriptstream << "local cid = " << env->addThing(player) << std::endl; scriptstream << "local forceLogout = " << (forceLogout ? "true" : "false") << std::endl; scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ char desc[35]; sprintf(desc, "%s", player->getName().c_str()); env->setEventDesc(desc); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(player->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(player)); lua_pushboolean(L, forceLogout); bool result = m_interface->callFunction(2); m_interface->releaseEnv(); return result; } } else { std::cout << "[Error - CreatureEvent::executeLogout] Call stack overflow." << std::endl; return 0; } } uint32_t CreatureEvent::executeChannelJoin(Player* player, uint16_t channelId, UsersMap usersMap) { //onJoinChannel(cid, channel, users) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(player->getPosition()); std::stringstream scriptstream; scriptstream << "local cid = " << env->addThing(player) << std::endl; scriptstream << "local channel = " << channelId << std::endl; scriptstream << "local users = {}" << std::endl; for(UsersMap::iterator it = usersMap.begin(); it != usersMap.end(); ++it) scriptstream << "users:insert(" << env->addThing(it->second) << ")" << std::endl; scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ char desc[35]; sprintf(desc, "%s", player->getName().c_str()); env->setEventDesc(desc); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(player->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(player)); lua_pushnumber(L, channelId); UsersMap::iterator it = usersMap.begin(); lua_newtable(L); for(int32_t i = 1; it != usersMap.end(); ++it, ++i) { lua_pushnumber(L, i); lua_pushnumber(L, env->addThing(it->second)); lua_settable(L, -3); } bool result = m_interface->callFunction(3); m_interface->releaseEnv(); return result; } } else { std::cout << "[Error - CreatureEvent::executeChannelJoin] Call stack overflow." << std::endl; return 0; } } uint32_t CreatureEvent::executeChannelLeave(Player* player, uint16_t channelId, UsersMap usersMap) { //onLeaveChannel(cid, channel, users) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(player->getPosition()); std::stringstream scriptstream; scriptstream << "local cid = " << env->addThing(player) << std::endl; scriptstream << "local channel = " << channelId << std::endl; scriptstream << "local users = {}" << std::endl; for(UsersMap::iterator it = usersMap.begin(); it != usersMap.end(); ++it) scriptstream << "users:insert(" << env->addThing(it->second) << ")" << std::endl; scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ char desc[35]; sprintf(desc, "%s", player->getName().c_str()); env->setEventDesc(desc); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(player->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(player)); lua_pushnumber(L, channelId); UsersMap::iterator it = usersMap.begin(); lua_newtable(L); for(int32_t i = 1; it != usersMap.end(); ++it, ++i) { lua_pushnumber(L, i); lua_pushnumber(L, env->addThing(it->second)); lua_settable(L, -3); } bool result = m_interface->callFunction(3); m_interface->releaseEnv(); return result; } } else { std::cout << "[Error - CreatureEvent::executeChannelLeave] Call stack overflow." << std::endl; return 0; } } uint32_t CreatureEvent::executeAdvance(Player* player, skills_t skill, uint32_t oldLevel, uint32_t newLevel) { //onAdvance(cid, skill, oldLevel, newLevel) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(player->getPosition()); std::stringstream scriptstream; scriptstream << "local cid = " << env->addThing(player) << std::endl; scriptstream << "local skill = " << skill << std::endl; scriptstream << "local oldLevel = " << oldLevel << std::endl; scriptstream << "local newLevel = " << newLevel << std::endl; scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ char desc[35]; sprintf(desc, "%s", player->getName().c_str()); env->setEventDesc(desc); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(player->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(player)); lua_pushnumber(L, (uint32_t)skill); lua_pushnumber(L, oldLevel); lua_pushnumber(L, newLevel); bool result = m_interface->callFunction(4); m_interface->releaseEnv(); return result; } } else { std::cout << "[Error - CreatureEvent::executeAdvance] Call stack overflow." << std::endl; return 0; } } uint32_t CreatureEvent::executeMailSend(Player* player, Player* receiver, Item* item, bool openBox) { //onSendMail(cid, receiver, item, openBox) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(player->getPosition()); std::stringstream scriptstream; scriptstream << "local cid = " << env->addThing(player) << std::endl; scriptstream << "local receiver = " << env->addThing(receiver) << std::endl; env->streamThing(scriptstream, "item", item, env->addThing(item)); scriptstream << "local openBox = " << (openBox ? "true" : "false") << std::endl; scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ char desc[30]; sprintf(desc, "%s", player->getName().c_str()); env->setEventDesc(desc); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(player->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(player)); lua_pushnumber(L, env->addThing(receiver)); LuaScriptInterface::pushThing(L, item, env->addThing(item)); lua_pushboolean(L, openBox); bool result = m_interface->callFunction(4); m_interface->releaseEnv(); return result; } } else { std::cout << "[Error - CreatureEvent::executeMailSend] Call stack overflow." << std::endl; return 0; } } uint32_t CreatureEvent::executeMailReceive(Player* player, Player* sender, Item* item, bool openBox) { //onReceiveMail(cid, sender, item, openBox) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(player->getPosition()); std::stringstream scriptstream; scriptstream << "local cid = " << env->addThing(player) << std::endl; scriptstream << "local sender = " << env->addThing(sender) << std::endl; env->streamThing(scriptstream, "item", item, env->addThing(item)); scriptstream << "local openBox = " << (openBox ? "true" : "false") << std::endl; scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ char desc[30]; sprintf(desc, "%s", player->getName().c_str()); env->setEventDesc(desc); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(player->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(player)); lua_pushnumber(L, env->addThing(sender)); LuaScriptInterface::pushThing(L, item, env->addThing(item)); lua_pushboolean(L, openBox); bool result = m_interface->callFunction(4); m_interface->releaseEnv(); return result; } } else { std::cout << "[Error - CreatureEvent::executeMailReceive] Call stack overflow." << std::endl; return 0; } } uint32_t CreatureEvent::executeTradeRequest(Player* player, Player* target, Item* item) { //onTradeRequest(cid, target, item) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(player->getPosition()); std::stringstream scriptstream; scriptstream << "local cid = " << env->addThing(player) << std::endl; scriptstream << "local target = " << env->addThing(target) << std::endl; env->streamThing(scriptstream, "item", item, env->addThing(item)); scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ char desc[35]; sprintf(desc, "%s", player->getName().c_str()); env->setEventDesc(desc); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(player->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(player)); lua_pushnumber(L, env->addThing(target)); LuaScriptInterface::pushThing(L, item, env->addThing(item)); bool result = m_interface->callFunction(3); m_interface->releaseEnv(); return result; } } else { std::cout << "[Error - CreatureEvent::executeTradeRequest] Call stack overflow." << std::endl; return 0; } } uint32_t CreatureEvent::executeTradeAccept(Player* player, Player* target, Item* item, Item* targetItem) { //onTradeAccept(cid, target, item, targetItem) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(player->getPosition()); std::stringstream scriptstream; scriptstream << "local cid = " << env->addThing(player) << std::endl; scriptstream << "local target = " << env->addThing(target) << std::endl; env->streamThing(scriptstream, "item", item, env->addThing(item)); scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ char desc[35]; sprintf(desc, "%s", player->getName().c_str()); env->setEventDesc(desc); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(player->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(player)); lua_pushnumber(L, env->addThing(target)); LuaScriptInterface::pushThing(L, item, env->addThing(item)); LuaScriptInterface::pushThing(L, targetItem, env->addThing(targetItem)); bool result = m_interface->callFunction(4); m_interface->releaseEnv(); return result; } } else { std::cout << "[Error - CreatureEvent::executeTradeAccept] Call stack overflow." << std::endl; return 0; } } uint32_t CreatureEvent::executeLook(Player* player, Thing* thing, const Position& position, int16_t stackpos, int32_t lookDistance) { //onLook(cid, thing, position, lookDistance) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(player->getPosition()); std::stringstream scriptstream; scriptstream << "local cid = " << env->addThing(player) << std::endl; scriptstream << "local thing = " << env->addThing(thing) << std::endl; env->streamPosition(scriptstream, "position", position, stackpos); scriptstream << "local lookDistance = " << lookDistance << std::endl; scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ char desc[30]; sprintf(desc, "%s", player->getName().c_str()); env->setEventDesc(desc); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(player->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(player)); LuaScriptInterface::pushThing(L, thing, env->addThing(thing)); LuaScriptInterface::pushPosition(L, position, stackpos); lua_pushnumber(L, lookDistance); bool result = m_interface->callFunction(4); m_interface->releaseEnv(); return result; } } else { std::cout << "[Error - CreatureEvent::executeLook] Call stack overflow." << std::endl; return 0; } } uint32_t CreatureEvent::executeDirection(Creature* creature, Direction old, Direction current) { //onDirection(cid, old, current) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(creature->getPosition()); std::stringstream scriptstream; scriptstream << "local cid = " << env->addThing(creature) << std::endl; scriptstream << "local old = " << old << std::endl; scriptstream << "local current = " << current << std::endl; scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ char desc[30]; sprintf(desc, "%s", creature->getName().c_str()); env->setEventDesc(desc); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(creature->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(creature)); lua_pushnumber(L, old); lua_pushnumber(L, current); bool result = m_interface->callFunction(3); m_interface->releaseEnv(); return result; } } else { std::cout << "[Error - CreatureEvent::executeDirection] Call stack overflow." << std::endl; return 0; } } uint32_t CreatureEvent::executeOutfit(Creature* creature, const Outfit_t& old, const Outfit_t& current) { //onOutfit(cid, old, current) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(creature->getPosition()); std::stringstream scriptstream; scriptstream << "local cid = " << env->addThing(creature) << std::endl; env->streamOutfit(scriptstream, "old", old); env->streamOutfit(scriptstream, "current", current); scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ char desc[30]; sprintf(desc, "%s", creature->getName().c_str()); env->setEventDesc(desc); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(creature->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(creature)); LuaScriptInterface::pushOutfit(L, old); LuaScriptInterface::pushOutfit(L, current); bool result = m_interface->callFunction(3); m_interface->releaseEnv(); return result; } } else { std::cout << "[Error - CreatureEvent::executeOutfit] Call stack overflow." << std::endl; return 0; } } uint32_t CreatureEvent::executeThink(Creature* creature, uint32_t interval) { //onThink(cid, interval) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(creature->getPosition()); std::stringstream scriptstream; scriptstream << "local cid = " << env->addThing(creature) << std::endl; scriptstream << "local interval = " << interval << std::endl; scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ char desc[35]; sprintf(desc, "%s", creature->getName().c_str()); env->setEventDesc(desc); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(creature->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(creature)); lua_pushnumber(L, interval); bool result = m_interface->callFunction(2); m_interface->releaseEnv(); return result; } } else { std::cout << "[Error - CreatureEvent::executeThink] Call stack overflow." << std::endl; return 0; } } uint32_t CreatureEvent::executeStatsChange(Creature* creature, Creature* attacker, StatsChange_t type, CombatType_t combat, int32_t value) { //onStatsChange(cid, attacker, type, combat, value) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(creature->getPosition()); std::stringstream scriptstream; scriptstream << "local cid = " << env->addThing(creature) << std::endl; scriptstream << "local attacker = " << env->addThing(attacker) << std::endl; scriptstream << "local type = " << (uint32_t)type << std::endl; scriptstream << "local combat = " << (uint32_t)combat << std::endl; scriptstream << "local value = " << value << std::endl; scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ char desc[35]; sprintf(desc, "%s", creature->getName().c_str()); env->setEventDesc(desc); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(creature->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(creature)); lua_pushnumber(L, env->addThing(attacker)); lua_pushnumber(L, (uint32_t)type); lua_pushnumber(L, (uint32_t)combat); lua_pushnumber(L, value); bool result = m_interface->callFunction(5); m_interface->releaseEnv(); return result; } } else { std::cout << "[Error - CreatureEvent::executeStatsChange] Call stack overflow." << std::endl; return 0; } } uint32_t CreatureEvent::executeCombatArea(Creature* creature, Tile* tile, bool aggressive) { //onAreaCombat(cid, ground, position, aggressive) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(creature->getPosition()); std::stringstream scriptstream; scriptstream << "local cid = " << env->addThing(creature) << std::endl; env->streamThing(scriptstream, "ground", tile->ground, env->addThing(tile->ground)); env->streamPosition(scriptstream, "position", tile->getPosition(), 0); scriptstream << "local aggressive = " << (aggressive ? "true" : "false") << std::endl; scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ std::stringstream desc; desc << creature->getName(); env->setEventDesc(desc.str()); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(creature->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(creature)); LuaScriptInterface::pushThing(L, tile->ground, env->addThing(tile->ground)); LuaScriptInterface::pushPosition(L, tile->getPosition(), 0); lua_pushboolean(L, aggressive); bool result = m_interface->callFunction(4); m_interface->releaseEnv(); return result; } } else { std::cout << "[Error - CreatureEvent::executeAreaCombat] Call stack overflow." << std::endl; return 0; } } uint32_t CreatureEvent::executeCombat(Creature* creature, Creature* target) { //onCombat(cid, target) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(creature->getPosition()); std::stringstream scriptstream; scriptstream << "local cid = " << env->addThing(creature) << std::endl; scriptstream << "local target = " << env->addThing(target) << std::endl; scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ std::stringstream desc; desc << creature->getName(); env->setEventDesc(desc.str()); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(creature->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(creature)); lua_pushnumber(L, env->addThing(target)); bool result = m_interface->callFunction(2); m_interface->releaseEnv(); return result; } } else { std::cout << "[Error - CreatureEvent::executeCombat] Call stack overflow." << std::endl; return 0; } } uint32_t CreatureEvent::executeAttack(Creature* creature, Creature* target) { //onAttack(cid, target) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(creature->getPosition()); std::stringstream scriptstream; scriptstream << "local cid = " << env->addThing(creature) << std::endl; scriptstream << "local target = " << env->addThing(target) << std::endl; scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ std::stringstream desc; desc << creature->getName(); env->setEventDesc(desc.str()); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(creature->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(creature)); lua_pushnumber(L, env->addThing(target)); bool result = m_interface->callFunction(2); m_interface->releaseEnv(); return result; } } else { std::cout << "[Error - CreatureEvent::executeAttack] Call stack overflow." << std::endl; return 0; } } uint32_t CreatureEvent::executeCast(Creature* creature, Creature* target/* = NULL*/) { //onCast(cid[, target]) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(creature->getPosition()); std::stringstream scriptstream; scriptstream << "local cid = " << env->addThing(creature) << std::endl; scriptstream << "local target = "; if(target) scriptstream << env->addThing(target); else scriptstream << "nil"; scriptstream << std::endl << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ std::stringstream desc; desc << creature->getName(); env->setEventDesc(desc.str()); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(creature->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(creature)); lua_pushnumber(L, env->addThing(target)); bool result = m_interface->callFunction(2); m_interface->releaseEnv(); return result; } } else { std::cout << "[Error - CreatureEvent::executeCast] Call stack overflow." << std::endl; return 0; } } uint32_t CreatureEvent::executeKill(Creature* creature, Creature* target, bool lastHit) { //onKill(cid, target, lastHit) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(creature->getPosition()); std::stringstream scriptstream; scriptstream << "local cid = " << env->addThing(creature) << std::endl; scriptstream << "local target = " << env->addThing(target) << std::endl; scriptstream << "local lastHit = " << (lastHit ? "true" : "false") << std::endl; scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ std::stringstream desc; desc << creature->getName(); env->setEventDesc(desc.str()); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(creature->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(creature)); lua_pushnumber(L, env->addThing(target)); lua_pushboolean(L, lastHit); bool result = m_interface->callFunction(3); m_interface->releaseEnv(); return result; } } else { std::cout << "[Error - CreatureEvent::executeKill] Call stack overflow." << std::endl; return 0; } } uint32_t CreatureEvent::executeDeath(Creature* creature, Item* corpse, DeathList deathList) { //onDeath(cid, corpse, deathList) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(creature->getPosition()); std::stringstream scriptstream; scriptstream << "local cid = " << env->addThing(creature) << std::endl; env->streamThing(scriptstream, "corpse", corpse, env->addThing(corpse)); scriptstream << "local deathList = {}" << std::endl; for(DeathList::iterator it = deathList.begin(); it != deathList.end(); ++it) { scriptstream << "deathList:insert("; // if(it->isCreatureKill()) // scriptstream << env->addThing(it->getKillerCreature()); // else scriptstream << it->getKillerName(); scriptstream << ")" << std::endl; } scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ char desc[35]; sprintf(desc, "%s", creature->getName().c_str()); env->setEventDesc(desc); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(creature->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(creature)); LuaScriptInterface::pushThing(L, corpse, env->addThing(corpse)); lua_newtable(L); DeathList::iterator it = deathList.begin(); for(int32_t i = 1; it != deathList.end(); ++it, ++i) { lua_pushnumber(L, i); // if(it->isCreatureKill()) // lua_pushnumber(L, env->addThing(it->getKillerCreature())); // else lua_pushstring(L, it->getKillerName().c_str()); lua_settable(L, -3); } bool result = m_interface->callFunction(3); m_interface->releaseEnv(); return result; } } else { std::cout << "[Error - CreatureEvent::executeDeath] Call stack overflow." << std::endl; return 0; } } uint32_t CreatureEvent::executePrepareDeath(Creature* creature, DeathList deathList) { //onPrepareDeath(cid, deathList) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(creature->getPosition()); std::stringstream scriptstream; scriptstream << "local cid = " << env->addThing(creature) << std::endl; scriptstream << "local deathList = {}" << std::endl; for(DeathList::iterator it = deathList.begin(); it != deathList.end(); ++it) { scriptstream << "deathList:insert("; if(it->isCreatureKill()) scriptstream << env->addThing(it->getKillerCreature()); else scriptstream << it->getKillerName(); scriptstream << ")" << std::endl; } scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ char desc[35]; sprintf(desc, "%s", creature->getName().c_str()); env->setEventDesc(desc); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(creature->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(creature)); lua_newtable(L); DeathList::iterator it = deathList.begin(); for(int32_t i = 1; it != deathList.end(); ++it, ++i) { lua_pushnumber(L, i); if(it->isCreatureKill()) lua_pushnumber(L, env->addThing(it->getKillerCreature())); else lua_pushstring(L, it->getKillerName().c_str()); lua_settable(L, -3); } bool result = m_interface->callFunction(2); m_interface->releaseEnv(); return result; } } else { std::cout << "[Error - CreatureEvent::executePrepareDeath] Call stack overflow." << std::endl; return 0; } } uint32_t CreatureEvent::executeTextEdit(Player* player, Item* item, std::string newText) { //onTextEdit(cid, item, newText) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(player->getPosition()); std::stringstream scriptstream; scriptstream << "local cid = " << env->addThing(player) << std::endl; env->streamThing(scriptstream, "item", item, env->addThing(item)); scriptstream << "local newText = " << newText.c_str() << std::endl; scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ char desc[35]; sprintf(desc, "%s", player->getName().c_str()); env->setEventDesc(desc); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(player->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(player)); LuaScriptInterface::pushThing(L, item, env->addThing(item)); lua_pushstring(L, newText.c_str()); bool result = m_interface->callFunction(3); m_interface->releaseEnv(); return result; } } else { std::cout << "[Error - CreatureEvent::executeTextEdit] Call stack overflow." << std::endl; return 0; } } uint32_t CreatureEvent::executeReportBug(Player* player, std::string comment) { //onReportBug(cid, comment) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(player->getPosition()); std::stringstream scriptstream; scriptstream << "local cid = " << env->addThing(player) << std::endl; scriptstream << "local comment = " << comment.c_str() << std::endl; scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ char desc[35]; sprintf(desc, "%s", player->getName().c_str()); env->setEventDesc(desc); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(player->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(player)); lua_pushstring(L, comment.c_str()); bool result = m_interface->callFunction(2); m_interface->releaseEnv(); return result; } } else { std::cout << "[Error - CreatureEvent::executeReportBug] Call stack overflow." << std::endl; return 0; } } uint32_t CreatureEvent::executePush(Player* player, Creature* target) { //onPush(cid, target) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(player->getPosition()); std::stringstream scriptstream; scriptstream << "local cid = " << env->addThing(player) << std::endl; scriptstream << "local target = " << env->addThing(target) << std::endl; scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ std::stringstream desc; desc << player->getName(); env->setEventDesc(desc.str()); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(player->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(player)); lua_pushnumber(L, env->addThing(target)); bool result = m_interface->callFunction(2); m_interface->releaseEnv(); return result; } } else { std::cout << "[Error - CreatureEvent::executePush] Call stack overflow." << std::endl; return 0; } } uint32_t CreatureEvent::executeTarget(Creature* creature, Creature* target) { //onTarget(cid, target) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(creature->getPosition()); std::stringstream scriptstream; scriptstream << "local cid = " << env->addThing(creature) << std::endl; scriptstream << "local target = " << env->addThing(target) << std::endl; scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ std::stringstream desc; desc << creature->getName(); env->setEventDesc(desc.str()); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(creature->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(creature)); lua_pushnumber(L, env->addThing(target)); bool result = m_interface->callFunction(2); m_interface->releaseEnv(); return result; } } else { std::cout << "[Error - CreatureEvent::executeTarget] Call stack overflow." << std::endl; return 0; } } uint32_t CreatureEvent::executeFollow(Creature* creature, Creature* target) { //onFollow(cid, target) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(creature->getPosition()); std::stringstream scriptstream; scriptstream << "local cid = " << env->addThing(creature) << std::endl; scriptstream << "local target = " << env->addThing(target) << std::endl; scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ std::stringstream desc; desc << creature->getName(); env->setEventDesc(desc.str()); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(creature->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(creature)); lua_pushnumber(L, env->addThing(target)); bool result = m_interface->callFunction(2); m_interface->releaseEnv(); return result; } } else { std::cout << "[Error - CreatureEvent::executeFollow] Call stack overflow." << std::endl; return 0; } } uint32_t CreatureEvent::executeOnSpawn(Creature* creature) { //onSpawn(cid) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(creature->getPosition()); std::stringstream scriptstream; scriptstream << "local cid = " << env->addThing(creature) << std::endl; scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ std::stringstream desc; desc << creature->getName(); env->setEvent(desc.str()); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(creature->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(creature)); bool result = m_interface->callFunction(1); m_interface->releaseEnv(); return result; } } else { std::clog << "[Error - CreatureEvent::executeCast] Call stack overflow." << std::endl; return 0; } } uint32_t CreatureEvent::executeMatou(Creature* creature, Creature* target) { //onFollow(cid, target) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(creature->getPosition()); std::stringstream scriptstream; scriptstream << "local cid = " << env->addThing(creature) << std::endl; scriptstream << "local target = " << env->addThing(target) << std::endl; scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ std::stringstream desc; desc << creature->getName(); env->setEventDesc(desc.str()); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(creature->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(creature)); lua_pushnumber(L, env->addThing(target)); bool result = m_interface->callFunction(2); m_interface->releaseEnv(); return result; } } else { std::cout << "[Error - CreatureEvent::executeMatou] Call stack overflow." << std::endl; return 0; } }
-
[Link Quebrado] Pokemon Evolution [DxP]
Amigão como que configura o held Y-Ghost no seu client ele funfa mas no que esta descompilado não
-
Login e Depot
Galera meu problema é o que muitos que tentaram mexer na base do DxP tem a depot não funciona quando configurado com account manager você não tem os itens no inventario tais como pokebag, pokedex... eu sei como configurar manualmente no SQL mas isso é chato e da muito trabalho fazer alguem sabe como arrumar?
-
Y-Ghost!!!
Alguem sabe como configurar o held Y-Ghost?
-
Premio na Pokedex
Alguem pode me ajudar com essa script eu quero que ela de os premios aos players assim que atingirem o numero de dex local function checkDex(cid) local unlock = 0 for i = 1, #oldpokedex do if getPlayerInfoAboutPokemon(cid, oldpokedex[1]).dex then unlock = unlock + 1 end end return unlock end local rate = 250 local rewards = { [10] = {{2160, 1}, {11638, 1}, {12344, 5}}, [20] = {{2160, 1}, {11638, 1}, {12344, 5}}, [30] = {{2160, 1}, {11638, 1}, {12344, 5}}, [40] = {{2160, 1}, {11639, 1}, {12344, 10}}, [50] = {{2160, 2}, {11639, 1}, {12344, 10}}, [60] = {{2160, 2}, {11639, 1}, {12344, 15}}, [70] = {{2160, 2}, {11640, 1}, {12344, 15}}, [80] = {{2160, 2}, {11640, 1}, {12344, 20}}, [90] = {{2160, 3}, {11640, 1}, {12344, 20}}, [100] = {{2160, 3}, {11640, 1}, {12344, 25}}, [120] = {{2160, 3}, {11640, 1}, {12344, 30}}, [150] = {{2160, 3}, {11641, 1}, {12344, 30}}, [180] = {{2160, 3}, {11641, 1}, {12344, 30}}, [210] = {{2160, 5}, {11641, 1}, {12344, 30}}, [250] = {{2160, 5}, {11641, 1}, {12344, 30}}, } local sto = 63999 function onUse(cid, item, fromPos, item2, toPos) if not isCreature(item2.uid) or isWatchingTv(cid) then return true end local poke = getCreatureName(item2.uid) if isMonster(item2.uid) then local name = doCorrectString(getCreatureName(item2.uid)) local this = newpokedex[name] local myball = 0 if isSummon(item2.uid) then myball = getPlayerSlotItem(getCreatureMaster(item2.uid), 8) end if not getPlayerInfoAboutPokemon(cid, poke).dex then local exp = this.level * rate doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have unlocked ".. getCreatureName(item2.uid).." in your pokedex!") doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have gained "..exp.." experience points.") doSendMagicEffect(getThingPos(cid), 210) doPlayerAddExperience(cid, exp) doAddPokemonInDexList(cid, poke) else local name = doCorrectString(getCreatureName(item2.uid)) doShowPokedexRegistration(cid, name, myball, item2) end return true end if not isPlayer(item2.uid) then return true end local kanto = 0 local johto = 0 --alterado v1.7 \/\/ for i = 1, #oldpokedex do if getPlayerInfoAboutPokemon(item2.uid, oldpokedex[1]).dex then if i <= 151 then kanto = kanto+1 elseif i >= 209 then johto = johto+1 end end end --alterado v1.6 local player = getRecorderPlayer(toPos, cid) if cid == player then doPlayerSendTextMessage(cid, 27, "You has unlocked "..kanto.." kanto's and "..johto.." johto's pokémons until now.") doPlayerSetVocation(cid, 9) --alterado v1.6 openChannelDialog(cid) end return true end
-
Source Para DXP sem site
Alguém tem uma source para o Pokémon DXP sem site?? to com uns problemas aqui nas configurações que se estiver com a programação sem usar site eu consigo reconfigurar! Quem tiver se puder compartilhar eu agradeço!!
- Pokemon HuatsonOT (DXP) Custom lvl sys