Advertisement
Guest User

order.lua

a guest
Jan 30th, 2016
502
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 16.73 KB | None | 0 0
  1. local skills = specialabilities
  2. local surfborders = {4644, 4645, 4646, 4647, 4648, 4649, 4650, 4651, 4652, 4653, 4654, 4655, 4656, 4657, 4658, 4659, 4660, 4661, 4662, 4663}
  3.  
  4. local txt = {
  5. ["rock smash"] = {"quebre está pedra"},
  6. ["cut"] = {"use cut"},
  7. ["move"] = {"move!"},
  8. ["light"] = {"usar flash!!"},
  9. ["dig"] = {"abra este buraco"},
  10. ["blink"] = {"teleportar para lá!"},
  11. ["ride"] = {"deixe-me montar em você"},
  12. ["fly"] = {"vamos voar"},
  13. ["untransform"] = {"volte ao normal!"},
  14. ["headbutt"] = {"headbutt"},
  15. }
  16.  
  17. function onUse(cid, item, frompos, item2, topos)
  18.    if getPlayerStorageValue(cid,6598754) >= 1 or getPlayerStorageValue(cid, 6598755) >= 1  then
  19. doPlayerSendTextMessage(cid, 19, "Não pode usa order nessa área.")
  20. return true
  21. end
  22.     local checkpos = topos
  23.     checkpos.stackpos = 0
  24.  
  25.     if getTileThingByPos(checkpos).uid <= 0 then return true end
  26.  
  27. --------END FLY/RIDE --------
  28. if getCreatureCondition(cid, CONDITION_OUTFIT) and (item2.uid == cid or getRecorderPlayer(topos) == cid) and (getPlayerStorageValue(cid, 17000) >= 1 or getPlayerStorageValue(cid, 17001) >= 1) then
  29.  
  30.     if isInArray({460, 11675, 11676, 11677}, getTileInfo(getThingPos(cid)).itemid) then
  31.         doPlayerSendCancel(cid, "Você não pode parar de voar nesta altura!")
  32.         return true
  33.         end
  34.  
  35.     local item = getPlayerSlotItem(cid, 8)
  36.     local pokemon = getItemAttribute(item.uid, "poke")
  37.     local x = pokes[pokemon]
  38.  
  39.         if getTileInfo(getThingPos(cid)).itemid >= 4820 and getTileInfo(getThingPos(cid)).itemid <= 4825 then
  40.         doPlayerSendCancel(cid, "Você não pode parar de voar acima da água!")
  41.         return true
  42.         end
  43.  
  44.     doSummonMonster(cid, pokemon)
  45.  
  46.     local pk = getCreatureSummons(cid)[1]
  47.  
  48.         if not isCreature(pk) then
  49.             pk = doCreateMonster(pokemon, backupPos)
  50.             if not isCreature(pk) then
  51.                 doPlayerSendCancel(cid, "você não pode parar de voar/montar aqui.")
  52.             return true
  53.             end
  54.             doConvinceCreature(cid, pk)
  55.         end
  56.  
  57.     doTeleportThing(pk, getThingPos(cid), false)
  58.     doCreatureSetLookDir(pk, getCreatureLookDir(cid))
  59.  
  60.     adjustStatus(pk, item.uid, true, false, true)
  61.  
  62.     doPlayerSay(cid, ""..getPokeName(getCreatureSummons(cid)[1])..", Deixe-me descer!", 1)
  63.     if getCreatureCondition(cid, CONDITION_PARALYZE) == true then
  64.        doRemoveCondition(cid, CONDITION_PARALYZE)
  65.        addEvent(doAddCondition, 10, cid, paralizeArea)             --alterado v2.4
  66.     end
  67.    
  68.     if getCreatureCondition(cid, CONDITION_PARALYZE) == true then
  69.        doRemoveCondition(cid, CONDITION_PARALYZE)
  70.        addEvent(doAddCondition, 10, cid, paralizeArea2)             --alterado v2.5
  71.     end
  72.     doRegainSpeed(cid)
  73.    
  74.     doRemoveCondition(cid, CONDITION_OUTFIT)
  75.     setPlayerStorageValue(cid, 17000, -1)
  76.     setPlayerStorageValue(cid, 17001, -1)
  77.  
  78. return true
  79. end
  80.  
  81.  
  82. if #getCreatureSummons(cid) == 0 then return doPlayerSendCancel(cid, "Você precisa de um pokémon para dar ORDER") end
  83. if getCreatureNoMove(getCreatureSummons(cid)[1]) then return true end
  84. markLP(getCreatureSummons(cid)[1], -1)
  85.  
  86. if getMarkedPos(getCreatureSummons(cid)[1]).x == topos.x and getMarkedPos(getCreatureSummons(cid)[1]).y == topos.y then
  87. return true
  88. end
  89.  
  90. local unfix = {x = 1, y = 1, z = 1}
  91. local thisball = getPlayerSlotItem(cid, 8)
  92. local mysum = getCreatureSummons(cid)[1]
  93. local sid = mysum or cid
  94. local maxMoveDist = getDistanceBetween(getThingPos(sid), topos) * 2 + 1
  95.  
  96.     markPos(mysum, topos)
  97.     markOwnerPos(mysum, getThingPos(cid))
  98.  
  99. -------- ROCK SMASH ---------
  100. if item2.itemid == 1285 and isInArray(skills["rock smash"], getPokemonName(mysum)) then
  101.  
  102.     doPlayerSay(cid, ""..getPokeName(mysum)..", "..txt["rock smash"][math.random(1, #txt["rock smash"])].."", 1)
  103.     addEvent(goThere, 500, mysum, topos, "rock smash", isCreature(getCreatureTarget(cid)))
  104.  
  105. return true
  106. end
  107. -----------------------------
  108.  
  109. -------- HEADBUTT -----------
  110. if item2.itemid == 12591 and getPokemonLevel(mysum) >= 15 then  --alterado v2.6
  111.                   --id do item  arvore normal
  112. doPlayerSay(cid, ""..getPokeName(mysum)..", "..txt["headbutt"][math.random(1, #txt["headbutt"])].."", 1)
  113. addEvent(goThere, 500, mysum, topos, "headbutt", isCreature(getCreatureTarget(cid)))
  114.  
  115. return true
  116. end
  117. -----------------------------
  118.  
  119. -------- CUT ----------------
  120. if item2.itemid == 2767 and isInArray(skills["cut"], getPokemonName(mysum)) then
  121.  
  122.     doPlayerSay(cid, ""..getPokeName(mysum)..", "..txt["cut"][math.random(1, #txt["cut"])].."", 1)
  123.     addEvent(goThere, 500, mysum, topos, "cut", isCreature(getCreatureTarget(cid)))
  124.  
  125. return true
  126. end
  127. -----------------------------
  128.  
  129. -------- TRANSFORM ----------
  130. if getCreatureName(mysum) == "Ditto" and isMonster(item2.uid) then
  131.     if item2.uid == mysum then
  132.         if isTransformed(mysum) then
  133.             deTransform(mysum, getItemAttribute(thisball.uid, "transTurn"))
  134.             markPos(mysum, unfix)
  135.             doPlayerSay(cid, ""..getPokeName(mysum)..", "..txt["untransform"][math.random(1, #txt["untransform"])].."", 1)
  136.         return true
  137.         end
  138.     doPlayerSendCancel(cid, "Seu Ditto não está transformado.")
  139.     markPos(mysum, unfix)
  140.     return true
  141.     end
  142.  
  143.     if getCreatureName(item2.uid) == "Ditto" then
  144.         doPlayerSendCancel(cid, "Ditto não pode se transformar em Ditto.")
  145.         markPos(mysum, unfix)
  146.     return true
  147.     end
  148.  
  149.     if getCreatureName(item2.uid) == getPlayerStorageValue(mysum, 1010) then
  150.         doPlayerSendCancel(cid, "Seu Ditto já está transformado nesse pokémon")
  151.         markPos(mysum, unfix)
  152.     return true
  153.     end
  154.  
  155.     local cd = getCD(thisball.uid, "trans", 40)
  156.  
  157.     if cd > 0 then
  158.     doPlayerSendCancel(cid, "Espere: ("..getStringmytempo(cd)..") Segundos")
  159.     return true
  160.     end
  161.  
  162.     if getHappiness(mysum) <= 50 then
  163.         doSendMagicEffect(getThingPos(mysum), happinessRate[1].effect)
  164.         markPos(mysum, unfix)
  165.     return true
  166.     end
  167.  
  168.     local turn = getItemAttribute(thisball.uid, "transTurn")
  169.  
  170.         if not turn or turn > 10 then
  171.             doItemSetAttribute(thisball.uid, "transTurn", 0)
  172.         else
  173.             doItemSetAttribute(thisball.uid, "transTurn",  turn + 1)
  174.         end
  175.  
  176.     local time = 140 + 2 * getPokemonLevel(mysum)
  177.  
  178.     turn = getItemAttribute(thisball.uid, "transTurn")
  179.  
  180.     markPos(mysum, unfix)
  181.     setPlayerStorageValue(mysum, 1010, getCreatureName(item2.uid))
  182.     doSetCreatureOutfit(mysum, getCreatureOutfit(item2.uid), -1)
  183.     addEvent(deTransform, time * 1000, mysum, turn)
  184.     doSendMagicEffect(getThingPos(mysum), 184)
  185.     doCreatureSay(mysum, "TRANSFORM!", TALKTYPE_MONSTER)
  186.     local name = getCreatureName(item2.uid)
  187.     setCD(thisball.uid, "trans", 40)
  188.     doItemSetAttribute(thisball.uid, "transBegin", os.clock())
  189.     doSetItemAttribute(thisball.uid, "transLeft", time)
  190.     doSetItemAttribute(thisball.uid, "transOutfit", getCreatureOutfit(item2.uid).lookType)
  191.     doSetItemAttribute(thisball.uid, "transName", getCreatureName(item2.uid))
  192.     doFaceCreature(mysum, getThingPos(item2.uid))
  193.     doPlayerSay(cid, ""..getPokeName(mysum)..", transform into "..getArticle(name).." "..name.."!", 1)
  194.  
  195.     if useKpdoDlls then
  196.         doUpdateMoves(cid)  --alterado v2.6
  197.     end
  198.    
  199.         if dittoCopiesStatusToo then
  200.             doSetItemAttribute(thisball.uid, "boffense", dittoBonus * getOffense(item2.uid))
  201.             doSetItemAttribute(thisball.uid, "bdefense", dittoBonus * getDefense(item2.uid))
  202.             doSetItemAttribute(thisball.uid, "bsattack", dittoBonus * getSpecialAttack(item2.uid))
  203.             doSetItemAttribute(thisball.uid, "bagility", dittoBonus * getSpeed(item2.uid))
  204.             adjustStatus(mysum, thisball.uid)
  205.         end
  206.  
  207. return true
  208. end
  209. -----------------------------
  210.  
  211. -------- LIGHT --------------
  212. if isMonster(item2.uid) and getCreatureMaster(item2.uid) == cid then
  213.  
  214.     markPos(mysum, unfix)
  215.  
  216.     if not isInArray(skills["light"], getPokemonName(item2.uid)) then
  217.     doPlayerSendCancel(cid, "Este pokémon não pode usar flash.")
  218.     return true
  219.     end
  220.    
  221.     local cd = getCD(thisball.uid, "light", 30)
  222.  
  223.     if cd > 0 then
  224.     doPlayerSendCancel(cid, "Por favor, aguarde alguns segundos antes de usar o flash")
  225.     return true
  226.     end
  227.  
  228.     doPlayerSay(cid, ""..getPokeName(mysum)..", "..txt["light"][math.random(1, #txt["light"])].."", 1)
  229.     doCreatureSay(mysum, "FLASH!", TALKTYPE_MONSTER)
  230.     doSendMagicEffect(getThingPos(mysum), 28)
  231.  
  232.     local size = 5
  233.         size = size + math.floor(getSpecialAttack(mysum) / 60)
  234.         size = size + math.ceil(getPokemonLevel(mysum) / 60)
  235.  
  236.         if size > 11 then
  237.             size = 11
  238.         end
  239.  
  240.     doSetCreatureLight(mysum, size, 215, 600*1000)
  241.  
  242.     local delay = math.floor(30 - getPokemonLevel(mysum) / 4)
  243.         if delay > 0 then
  244.         setCD(thisball.uid, "light", delay)
  245.         end
  246.  
  247. return true
  248. end
  249. -----------------------------
  250.  
  251.  
  252. -------- DIG ----------------
  253. if isInArray(skills["digholes"], item2.itemid) and isInArray(skills["dig"], getPokemonName(mysum)) then
  254.  
  255.     doPlayerSay(cid, ""..getPokeName(mysum)..", "..txt["dig"][math.random(1, #txt["dig"])].."", 1)
  256.     addEvent(goThere, 500, mysum, topos, "dig", isCreature(getCreatureTarget(cid)))
  257.  
  258. return true
  259. end
  260. -----------------------------
  261.  
  262.  
  263. -------- BLINK / MOVE -------
  264.  
  265. if not isCreature(item2.uid) and isInArray(skills["blink"], getPokemonName(mysum)) then
  266.  
  267.     local cd = getCD(thisball.uid, "blink", 30)
  268.    
  269.     if getPlayerStorageValue(mysum, 2365487) ==  1 then
  270.     return true                  --alterado v2.4
  271.     end
  272.  
  273.     if cd > 0 or not canWalkOnPos(topos, false, false, true, true, true) then
  274.  
  275.         doPlayerSendCancel(cid, "Blink cooldown: ("..getStringmytempo(cd)..")")
  276.         doPlayerSay(cid, ""..getPokeName(mysum)..", "..txt["move"][math.random(1, #txt["move"])].."", 1)
  277.         addEvent(goThere, 500, mysum, topos, "move", isCreature(getCreatureTarget(cid)), maxMoveDist)
  278.  
  279.     return true
  280.     end
  281.  
  282.     local CD = isShinyName(getCreatureName(mysum)) and 20 or 30   --edited blink
  283.  
  284.     markPos(mysum, topos)
  285.     markOwnerPos(mysum, getThingPos(cid))
  286.     setCD(thisball.uid, "blink", CD)
  287.     doPlayerSay(cid, ""..getPokeName(mysum)..", "..txt["blink"][math.random(1, #txt["blink"])].."", 1)
  288.     doSendDistanceShoot(getThingPos(mysum), topos, 39)
  289.     doSendMagicEffect(getThingPos(mysum), 211)
  290.     doTeleportThing(mysum, topos, false)
  291.     doSendMagicEffect(topos, 134)
  292.     doCreatureSay(mysum, "BLINK!", TALKTYPE_MONSTER)
  293.     goThere(mysum, topos, "blink", isCreature(getCreatureTarget(cid)))  --edited blink
  294.  
  295. return true
  296. end
  297. -----------------------------
  298.  
  299.  
  300. ----START FLYorRIDE ---------
  301.  
  302. if (item2.uid == cid or getRecorderPlayer(topos) == cid) and (isInArray(skills["fly"], getPokemonName(mysum)) or isInArray(skills["ride"], getPokemonName(mysum))) then
  303.  
  304.  
  305.  
  306.  
  307.     if getPlayerStorageValue(cid, 212124) >= 1 then         --alterado v2.6
  308.        return doPlayerSendCancel(cid, "Você não pode fazer isso com um pokémon com mentre controlada")
  309.     end
  310.    
  311.     if getPlayerStorageValue(cid, 52480) >= 1 then
  312.        return doPlayerSendCancel(cid, "Você não pode fazer isso em Duelo!")  --alterado v2.6
  313.     end
  314.    
  315.     if getPlayerStorageValue(cid, 5700) == 1 then
  316.        doPlayerSendCancel(cid, "Você não pode fazer isso enquanto está montado em bike") --edited proteçao pra bike
  317.        return true
  318.     end
  319.    
  320.     local pct = getCreatureHealth(mysum) / getCreatureMaxHealth(mysum)
  321.     doItemSetAttribute(getPlayerSlotItem(cid, 8).uid, "hp", 1 - pct)
  322.  
  323.     if isInArray(skills["fly"], getPokemonName(mysum)) then
  324.     doPlayerSay(cid, ""..getPokeName(mysum)..", "..txt["fly"][math.random(1, #txt["fly"])].."", 1)
  325.     addEvent(goThere, 500, mysum, topos, "fly", isCreature(getCreatureTarget(cid)))
  326.     else
  327.     doPlayerSay(cid, ""..getPokeName(mysum)..", "..txt["ride"][math.random(1, #txt["ride"])].."", 1)
  328.     addEvent(goThere, 500, mysum, topos, "ride", isCreature(getCreatureTarget(cid)))
  329.     end
  330.  
  331. return true
  332. end
  333. ----------------------------------Control Mind--------------------------------------------   alterado v2.5
  334. if isCreature(item2.uid) and ehMonstro(item2.uid) and isInArray(skills["control mind"], getCreatureName(mysum)) and item2.uid ~= mysum then
  335.    if not isCreature(item2.uid) then
  336.    return true
  337.    end
  338.  
  339.    if isSleeping(mysum) then
  340.       return doPlayerSendCancel(cid, "Seu pokémon está dormindo.")
  341.    end
  342.  
  343.    if getTileInfo(getThingPos(cid)).protection or getTileInfo(getThingPos(getCreatureSummons(cid)[1])).protection then
  344.       return doPlayerSendCancel(cid, "Você ou seu pokémon estão em PZ.")
  345.    end
  346.  
  347.    if #getCreatureSummons(cid) == 2 then
  348.       return doPlayerSendCancel(cid, "Você só pode controlar um pokémon.")
  349.    end
  350.  
  351.    local cd = getCD(thisball.uid, "control", 120)
  352.    
  353.    if cd > 0 then
  354.       doPlayerSendCancel(cid, "Por favor espere, aguns segundos para usar Control Mind novamente.")
  355.       return true
  356.    end
  357.    
  358.    if getPokemonLevel(item2.uid) >= getPokemonLevel(mysum) then
  359.       return doPlayerSendCancel(cid, "O seu pokémon não pode controlar sua mente")
  360.    end
  361.    
  362. local cmed = item2.uid
  363. setCD(thisball.uid, "control", 120)
  364. doSendDistanceShoot(getThingPos(mysum), getThingPos(cmed), 39)
  365. --------------
  366. setPlayerStorageValue(cid, 212124, 1)
  367. doConvinceCreature(cid, cmed)
  368. setPlayerStorageValue(cmed, 212123, 1)
  369. doCreatureSay(cid, ""..getCreatureName(mysum)..", control "..string.lower(getCreatureName(cmed)).."'s mind!", 1)
  370.  
  371. local cmname = getCreatureName(mysum)
  372. local cmpos = getThingPos(mysum)
  373. local pokelife = (getCreatureHealth(mysum) / getCreatureMaxHealth(mysum))
  374. doItemSetAttribute(thisball.uid, "hp", pokelife)
  375. doRemoveCreature(mysum)
  376. local cmzao = doSummonCreature(""..cmname.." cm", cmpos)
  377. doConvinceCreature(cid, cmzao)
  378. setPlayerStorageValue(cid, 888, 1)
  379. if useKpdoDlls then
  380.    doUpdateMoves(cid)
  381. end
  382.  
  383. local function check(cid, controled, rod)
  384. if isCreature(cid) then
  385. ball2 = getPlayerSlotItem(cid, 8)
  386.    if getPlayerStorageValue(cid, 888) <= 0 then
  387.    return true
  388.    end
  389.    if not isCreature(controled) then
  390.       setPlayerStorageValue(cid, 212124, 0)
  391.       local sum = isCreature(getCreatureSummons(cid)[1]) and getCreatureSummons(cid)[1] or getCreatureSummons(cid)[2]
  392.       local pkcmpos = getThingPos(sum)
  393.       doRemoveCreature(sum)
  394.       local item = getPlayerSlotItem(cid, 8)
  395.       local pk = doSummonCreature(getItemAttribute(item.uid, "poke"), pkcmpos)
  396.       doConvinceCreature(cid, pk)
  397.       doCreatureSetLookDir(getCreatureSummons(cid)[1], 2)
  398.       addEvent(doAdjustWithDelay, 100, cid, pk, true, true, false)
  399.       setPlayerStorageValue(cid, 888, 0)
  400.       cleanCMcds(item.uid)
  401.       registerCreatureEvent(pk, "SummonDeath")  --alterado v2.6
  402.       if useKpdoDlls then
  403.          doUpdateMoves(cid)
  404.       end
  405.       return true
  406.    end
  407.    
  408.    if rod <= 0 then
  409.       --Pokemon controlado
  410.       local cmed2 = getCreatureSummons(cid)[1]
  411.       local poscmed = getThingPos(cmed2)
  412.       local cmeddir = getCreatureLookDir(cmed2)
  413.       local namecmed = getCreatureName(cmed2)
  414.       local gender = getPokemonGender(cmed2)
  415.       local level = getWildPokemonLevel(cmed2)
  416.       local hp, maxHp = getCreatureHealth(getCreatureSummons(cid)[1]), getCreatureMaxHealth(getCreatureSummons(cid)[1])
  417.       doRemoveCreature(getCreatureSummons(cid)[1])
  418.       local back = doCreateMonster(namecmed, poscmed)
  419.       addEvent(doCreatureSetSkullType, 150, back, gender)
  420.       addEvent(setWildPokemonLevel, 150, back, level)
  421.       doWildAttackPlayer(back, cid)
  422.       doCreatureSetLookDir(back, cmeddir)
  423.       addEvent(doCreatureAddHealth, 100, back, hp-maxHp)
  424.    
  425.       -- pokemon controlador   
  426.       local mynewpos = getThingPos(getCreatureSummons(cid)[1])
  427.       doRemoveCreature(getCreatureSummons(cid)[1])
  428.       local pk2 = doSummonCreature(getItemAttribute(ball2.uid, "poke"), mynewpos)
  429.       doConvinceCreature(cid, pk2)
  430.       addEvent(doAdjustWithDelay, 100, cid, pk2, true, true, false)
  431.       setPlayerStorageValue(cid, 888, 0)
  432.       doCreatureSetLookDir(getCreatureSummons(cid)[1], 2)
  433.       setPlayerStorageValue(cid, 212124, 0)
  434.       cleanCMcds(ball2.uid)
  435.       registerCreatureEvent(pk2, "SummonDeath")  --alterado v2.6
  436.       if useKpdoDlls then
  437.          doUpdateMoves(cid)
  438.       end
  439.    else
  440.        if isInArray({"Haunter", "Gengar", "Shiny Gengar"}, cmname) then
  441.           doSendMagicEffect(getThingPos(getCreatureSummons(cid)[1]), 214)
  442.        else
  443.           doSendMagicEffect(getThingPos(getCreatureSummons(cid)[1]), 220)
  444.        end
  445.    end
  446. end
  447. addEvent(check, 500, cid, controled, rod-1)
  448. end
  449.  
  450. check(cid, cmed, 40)
  451. return true
  452. end
  453. ---------------------------------------------------------------------
  454. -------- MOVE / END ---------
  455.    
  456.     local onlyWater = false
  457.  
  458.     if isWater(getTileThingByPos(checkpos).itemid) then
  459.         onlyWater = true
  460.         for checkwater = 0, 7 do
  461.             if not isWater(getTileThingByPos(getPosByDir(checkpos, checkwater)).itemid) then
  462.                 onlyWater = false
  463.             end
  464.         end
  465.     end
  466.  
  467.     if onlyWater then
  468.         doPlayerSendCancel(cid, "Destination is not reachable.")
  469.     return true
  470.     end
  471.  
  472.     doPlayerSay(cid, ""..getPokeName(mysum)..", "..txt["move"][math.random(1, #txt["move"])].."", 1)
  473.    
  474.     if isCreature(getCreatureTarget(cid)) then
  475.        goThere(mysum, topos, "move", isCreature(getCreatureTarget(cid)), maxMoveDist)          
  476.     else
  477.        addEvent(goThere, 500, mysum, topos, "move", isCreature(getCreatureTarget(cid)), maxMoveDist)                
  478.     end
  479. -----------------------------
  480. return true
  481. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement