adrianoswatt

Digimon: Fly, Ride System

Jun 2nd, 2016
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 25.50 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. local storages = {17000, 63215, 17001, 13008, 5700}   --alterado v1.9 \/
  4. local unfix = {x = 1, y = 1, z = 1}
  5.  
  6. local txt = {
  7. ["rock smash"] = {"break that rock!", "smash that rock!", "destroy that rock!", "smash it!", "break it!", "destroy it!"},
  8. ["cut"] = {"cut that bush!", "cut it down!", "cut it off!", "cut off that bush!", "cut down that bush!", "cut that bush down!"},
  9. ["move"] = {"move!", "move there!", "go there!", "walk there!"},
  10. ["light"] = {"flash!", "light!", "flash this place!", "light up this place!"},
  11. ["dig"] = {"open that hole!", "dig that hole!", "open it!", "dig it!"},
  12. ["blink"] = {"teleport there!", "blink there!", "blink!", "teleport!"},
  13. ["ride"] = {"let me ride you!", "let's ride!", "let me mount you!", "let me get on you!"},
  14. ["fly"] = {"let's fly!", "let me get on you!"} ,
  15. ["untransform"] = {"go back to normal!", "transform into yourself again!", "stop transformation!"},
  16. ["headbutt"] = {"headbutt on three", "headbutt that three!", "headbutt it off"},
  17. ["levitate_fly"] = {"let's levitate!", "let me get on you!", "let's scary someone!"},  --alterado v1.8
  18. ["cock"] = {"vá no banheiro!", "esta querendo cagar!", "gogo cock!"},  --alterado v1.8
  19. }
  20.  
  21. function onUse(cid, item, frompos, item2, topos)
  22.     local checkpos = topos
  23.     checkpos.stackpos = 0
  24.    
  25.     if getPlayerStorageValue(cid, 75846) >= 1 then return true end --alterado v1.9
  26.  
  27.     if getTileThingByPos(checkpos).uid <= 0 then return true end
  28.  
  29. --------END FLY/RIDE --------
  30. if getCreatureCondition(cid, CONDITION_OUTFIT) and (item2.uid == cid or getRecorderPlayer(topos) == cid) and (getPlayerStorageValue(cid, 17000) >= 1 or getPlayerStorageValue(cid, 17001) >= 1) then
  31.  
  32.     if isInArray({460, 11675, 11676, 11677}, getTileInfo(getThingPos(cid)).itemid) then
  33.         doPlayerSendCancel(cid, "You can\'t stop flying at this height!")
  34.         return true
  35.     end
  36.  
  37.     local item = getPlayerSlotItem(cid, 8)
  38.     local pokemon = getItemAttribute(item.uid, "poke")
  39.     local x = pokes[pokemon]
  40.  
  41.         if getTileInfo(getThingPos(cid)).itemid >= 4820 and getTileInfo(getThingPos(cid)).itemid <= 4825 then
  42.         doPlayerSendCancel(cid, "You can\'t stop flying above the water!")
  43.         return true
  44.         end
  45.  
  46.     doSummonMonster(cid, pokemon)
  47.  
  48.     local pk = getCreatureSummons(cid)[1]
  49.  
  50.         if not isCreature(pk) then
  51.             pk = doCreateMonster(pokemon, backupPos)
  52.             if not isCreature(pk) then
  53.                 doPlayerSendCancel(cid, "You can't stop flying/riding here.")
  54.             return true
  55.             end
  56.             doConvinceCreature(cid, pk)
  57.         end
  58.  
  59.     doTeleportThing(pk, getThingPos(cid), false)
  60.     doCreatureSetLookDir(pk, getCreatureLookDir(cid))
  61.  
  62.     adjustStatus(pk, item.uid, true, false, true)
  63.  
  64.     doPlayerSay(cid, ""..getPokeName(getCreatureSummons(cid)[1])..", let me get down!", 1)
  65.    
  66.     doRegainSpeed(cid)
  67.    
  68.     doRemoveCondition(cid, CONDITION_OUTFIT)
  69.     setPlayerStorageValue(cid, 17000, -1)
  70.     setPlayerStorageValue(cid, 17001, -1)
  71.    
  72.     if useOTClient then
  73.        doUpdateMoves(cid)
  74.        doPlayerSendCancel(cid, '12//,show') --alterado aki
  75.     end
  76.  
  77. return true
  78. end
  79. -----------------------------
  80. local player = getRecorderPlayer(topos)                        --alterado v1.8 \/
  81. -------- DUEL SYSTEM ------------------------
  82. if isPlayer(player) and player ~= cid and getPlayerStorageValue(player, 6598754) <= -1 and getPlayerStorageValue(player, 52480) <= -1 then  
  83. if getPlayerStorageValue(cid, 52480) <= -1 or (getPlayerStorageValue(cid, 52481) >= 1 and getPlayerStorageValue(cid, 52482) ~= -1) then                  
  84. ---
  85. for s = 1, #storages do
  86.     if getPlayerStorageValue(cid, storages[s]) >= 1 then
  87.        return doPlayerSendTextMessage(cid, 20, "You can't do that while is Flying, Riding, Surfing, Diving or mount a bike!")
  88.     end
  89. end
  90. if getPlayerStorageValue(cid, 6598754) == 1 or getPlayerStorageValue(cid, 6598755) == 1 then
  91. return doPlayerSendTextMessage(cid, 20, "You can't do that while in PVP zone!")
  92. end
  93. if #getCreatureSummons(cid) < 1 then
  94. return doPlayerSendTextMessage(cid, 20, "You need a Digimon to invit someone to duel!")
  95. end
  96. ---
  97. if getPlayerStorageValue(cid, 52480) <= -1 then
  98.    doPlayerSetVocation(cid, 7)
  99.    openChannelDialog(cid)  
  100.    setPlayerStorageValue(cid, 52480, 1)
  101.    setPlayerStorageValue(cid, 6598754, 5)          
  102.    setPlayerStorageValue(cid, 52482, getCreatureName(cid)..",")                      
  103.    setPlayerStorageValue(cid, 52483, getCreatureName(player)..",")
  104.    doCreatureSetSkullType(cid, 2)
  105.    doSendAnimatedText(getThingPosWithDebug(cid), "FIRST TEAM", 215)
  106.    return true
  107. elseif getPlayerStorageValue(cid, 52481) >= 1 and getPlayerStorageValue(cid, 52482) ~= -1 then
  108.    local t1 = string.explode(getPlayerStorageValue(cid, 52482), ",")
  109.    local t2 = string.explode(getPlayerStorageValue(cid, 52483), ",")
  110.    
  111.    if (#t1 >= getPlayerStorageValue(cid, 52480) and #t2 >= getPlayerStorageValue(cid, 52480)) or (isInArray(t1, getCreatureName(player)) or isInArray(t2, getCreatureName(player))) then
  112.    return true
  113.    end
  114.    
  115.    local sto2, sto3, name = getPlayerStorageValue(cid, 52482), getPlayerStorageValue(cid, 52483), getCreatureName(player)
  116.    if getPlayerStorageValue(cid, 52480) == 2 then
  117.       setPlayerStorageValue(cid, 52483, sto3.. name..",") --time adversario
  118.       doSendAnimatedText(getThingPosWithDebug(player), "SECOND TEAM", 215)  
  119.    elseif getPlayerStorageValue(cid, 52480) == 3 and #t1 < 3 then
  120.       setPlayerStorageValue(cid, 52482, sto2.. name..",") --time aliado
  121.       doSendAnimatedText(getThingPosWithDebug(player), "FIRST TEAM", 215)
  122.    elseif getPlayerStorageValue(cid, 52480) == 3 and #t1 >= 3 then
  123.       setPlayerStorageValue(cid, 52483, sto3.. name..",") --time adversario
  124.       doSendAnimatedText(getThingPosWithDebug(player), "SECOND TEAM", 215)  
  125.    end  
  126.      
  127.    setPlayerStorageValue(player, 52481, getPlayerStorageValue(cid, 52481))
  128.    setPlayerStorageValue(player, 52485, getCreatureName(cid))
  129.    
  130.    local players, pokes = getPlayerStorageValue(cid, 52480), getPlayerStorageValue(cid, 52481)
  131.    
  132.    local str = {}
  133.    table.insert(str, getCreatureName(cid).." is inviting you to a duel! Use order in him to accept it!\n")
  134.    table.insert(str, "Info Battle: Duel "..players.."x"..players.." - "..pokes.." digis.")     --alterado aki
  135.  
  136.    doPlayerSendTextMessage(player, 20, table.concat(str))
  137.    return true
  138. end
  139. end
  140. ---  
  141. elseif isPlayer(player) and player ~= cid and getPlayerStorageValue(player, 6598754) == 5 and getPlayerStorageValue(player, 52481) >= 1 then
  142.  
  143. local t1 = string.explode(getPlayerStorageValue(player, 52482), ",")
  144. local t2 = string.explode(getPlayerStorageValue(player, 52483), ",")
  145. ---
  146. if not isInArray(t1, getCreatureName(cid)) and not isInArray(t2, getCreatureName(cid)) then
  147. return true
  148. end
  149. ---
  150. for s = 1, #storages do
  151.     if getPlayerStorageValue(cid, storages[s]) >= 1 then
  152.        return doPlayerSendTextMessage(cid, 20, "You can't do that while is Flying, Riding, Surfing, Diving or mount a bike!")
  153.     end
  154. end
  155. if getPlayerStorageValue(cid, 6598754) == 1 or getPlayerStorageValue(cid, 6598755) == 1 then
  156. return doPlayerSendTextMessage(cid, 20, "You can't do that while in PVP zone!")
  157. end
  158. local pokes = getLivePokeballs(cid, getPlayerSlotItem(cid, 3).uid, true)
  159. if #pokes < getPlayerStorageValue(player, 52481) then
  160. return doPlayerSendTextMessage(cid, 20, "You need atleast ".. getPlayerStorageValue(player, 52481).." Digimons to duel with this person!")
  161. end
  162. if getPlayerStorageValue(cid, 52482) ~= -1 then
  163. return doPlayerSendTextMessage(cid, 20, "You already invit someone to duel!")
  164. end
  165. if #getCreatureSummons(cid) < 1 then
  166. return doPlayerSendTextMessage(cid, 20, "You need a Digimon to accept a duel!")
  167. end
  168. ---  
  169.    setPlayerStorageValue(cid, 52480, getPlayerStorageValue(player, 52480))
  170.    setPlayerStorageValue(player, 52484, getPlayerStorageValue(player, 52484)-1)
  171.    if getPlayerStorageValue(player, 52484) == 0 then  
  172.       for a = 1, #t1 do
  173.           local pid, sid = getPlayerByName(t1[a]), getPlayerByName(t2[a])
  174.           if not isCreature(pid) or getPlayerStorageValue(pid, 52480) <= -1 then
  175.              removeFromTableDuel(player, t1[a])
  176.           else
  177.              doCreatureSetSkullType(pid, 1)
  178.           end
  179.           if not isCreature(sid) or getPlayerStorageValue(sid, 52480) <= -1 then
  180.              removeFromTableDuel(player, t2[a])
  181.           else
  182.              doCreatureSetSkullType(sid, 1)
  183.           end
  184.       end
  185.       beginDuel(player, 6)
  186.    else
  187.       doCreatureSetSkullType(cid, 2)
  188.    end
  189.    doSendAnimatedText(getThingPos(cid), "BATTLE", COLOR_ELECTRIC)
  190.    return true
  191.    
  192. elseif isPlayer(player) and player == cid and getPlayerStorageValue(player, 52480) >= 1 then
  193.    doEndDuel(cid, true)
  194.    return true
  195. end
  196. ------------------------------------------------------------------------------------
  197.  
  198. if #getCreatureSummons(cid) == 0 then return doPlayerSendCancel(cid, "You need a Digimon to use order!") end
  199. if getCreatureNoMove(getCreatureSummons(cid)[1]) then return true end
  200. markLP(getCreatureSummons(cid)[1], -1)
  201.  
  202. local marked = getMarkedPos(getCreatureSummons(cid)[1])    --alterado v1.8 \/
  203.  
  204. if type(marked) == "table" and marked.x == topos.x and marked.y == topos.y then
  205. return true
  206. end
  207.  
  208. local thisball = getPlayerSlotItem(cid, 8)
  209. local mysum = getCreatureSummons(cid)[1]
  210. local sid = mysum or cid
  211. local maxMoveDist = getDistanceBetween(getThingPos(sid), topos) * 2 + 1
  212.  
  213.     markPos(mysum, topos)
  214.     markOwnerPos(mysum, getThingPos(cid))
  215.  
  216. -------- ROCK SMASH ---------
  217. if item2.itemid == 1285 and isInArray(skills["rock smash"], getPokemonName(mysum)) then
  218.  
  219.     doPlayerSay(cid, ""..getPokeName(mysum)..", "..txt["rock smash"][math.random(1, #txt["rock smash"])].."", 1)
  220.     addEvent(goThere, 500, mysum, topos, "rock smash", isCreature(getCreatureTarget(cid)))
  221.  
  222. return true
  223. end
  224. -----------------------------
  225.  
  226. -------- HEADBUTT -----------
  227. if item2.itemid == 11604 and getPokemonLevel(mysum) >= 15 then  --alterado v1.6
  228.                   --id do item  arvore normal
  229. doPlayerSay(cid, ""..getPokeName(mysum)..", "..txt["headbutt"][math.random(1, #txt["headbutt"])].."", 1)
  230. addEvent(goThere, 500, mysum, topos, "headbutt", isCreature(getCreatureTarget(cid)))
  231.  
  232. return true
  233. end
  234. -----------------------------
  235.  
  236. -------- CUT ----------------
  237. if item2.itemid == 2767 and isInArray(skills["cut"], getPokemonName(mysum)) then
  238.  
  239.     doPlayerSay(cid, ""..getPokeName(mysum)..", "..txt["cut"][math.random(1, #txt["cut"])].."", 1)
  240.     addEvent(goThere, 500, mysum, topos, "cut", isCreature(getCreatureTarget(cid)))
  241.  
  242. return true
  243. end
  244. -----------------------------
  245.  
  246. -------- TRANSFORM ----------                                                                                  --alterado v1.7
  247. if (getCreatureName(mysum) == "Puttimon" or getCreatureName(mysum) == "Shiny Puttimon") and isMonster(item2.uid) and pokes[getCreatureName(item2.uid)] then
  248.     if item2.uid == mysum then                                                                 --edited
  249.         if isTransformed(mysum) then
  250.             deTransform(mysum, getItemAttribute(thisball.uid, "transTurn"))
  251.             markPos(mysum, unfix)
  252.             doPlayerSay(cid, ""..getPokeName(mysum)..", "..txt["untransform"][math.random(1, #txt["untransform"])].."", 1)
  253.             if useKpdoDlls then
  254.                doUpdateMoves(cid) --alterado v1.9
  255.             end
  256.         return true
  257.         end
  258.     doPlayerSendCancel(cid, "Your Puttimon is not transformed.")
  259.     markPos(mysum, unfix)
  260.     return true
  261.     end
  262.  
  263.     if getCreatureName(item2.uid) == "Puttimon" or getCreatureName(item2.uid) == "Shiny Puttimon" then    --edited transform for shiny Puttimon
  264.         doPlayerSendCancel(cid, "Your Puttimon can't transform into another Puttimon.")
  265.         markPos(mysum, unfix)
  266.     return true
  267.     end
  268.  
  269.     if getCreatureName(item2.uid) == getPlayerStorageValue(mysum, 1010) then
  270.         doPlayerSendCancel(cid, "Your Puttimon is already transformed into that Digimon.")
  271.         markPos(mysum, unfix)
  272.     return true
  273.     end
  274.  
  275.     local cd = getCD(thisball.uid, "trans", 40)
  276.  
  277.     if cd > 0 then
  278.     doPlayerSendCancel(cid, "Your Digimon is too tired to transform again. Cooldown: ("..getStringmytempo(cd)..")")
  279.     return true
  280.     end
  281.  
  282.     if getHappiness(mysum) <= 50 then
  283.         doSendMagicEffect(getThingPos(mysum), happinessRate[1].effect)
  284.         markPos(mysum, unfix)
  285.     return true
  286.     end
  287.  
  288.     local turn = getItemAttribute(thisball.uid, "transTurn")
  289.  
  290.         if not turn or turn > 10 then
  291.             doItemSetAttribute(thisball.uid, "transTurn", 0)
  292.         else
  293.             doItemSetAttribute(thisball.uid, "transTurn",  turn + 1)
  294.         end
  295.  
  296.     local time = 140 + 2 * getPokemonLevel(mysum)
  297.  
  298.     turn = getItemAttribute(thisball.uid, "transTurn")
  299.  
  300.     markPos(mysum, unfix)
  301.     setPlayerStorageValue(mysum, 1010, getCreatureName(item2.uid))
  302.     doSetCreatureOutfit(mysum, {lookType = getPokemonXMLOutfit(getCreatureName(item2.uid))}, -1)  --alterado v1.8
  303.     addEvent(deTransform, time * 1000, mysum, turn)
  304.     doSendMagicEffect(getThingPos(mysum), 184)
  305.     doCreatureSay(mysum, "TRANSFORM!", TALKTYPE_MONSTER)
  306.     local name = getCreatureName(item2.uid)
  307.     setCD(thisball.uid, "trans", 40)
  308.     doItemSetAttribute(thisball.uid, "transBegin", os.clock())
  309.     doSetItemAttribute(thisball.uid, "transLeft", time)
  310.     doSetItemAttribute(thisball.uid, "transOutfit", getPokemonXMLOutfit(getCreatureName(item2.uid)))  --alterado v1.8
  311.     doSetItemAttribute(thisball.uid, "transName", getCreatureName(item2.uid))
  312.     doFaceCreature(mysum, getThingPos(item2.uid))
  313.     doPlayerSay(cid, ""..getPokeName(mysum)..", transform into "..getArticle(name).." "..name.."!", 1)
  314.    
  315.     if useKpdoDlls then
  316.         doUpdateMoves(cid)  --alterado v1.6
  317.     end
  318.  
  319. if dittoCopiesStatusToo then
  320.    setPlayerStorageValue(mysum, 1001, dittoBonus*getOffense(item2.uid))
  321.    setPlayerStorageValue(mysum, 1002, dittoBonus*getDefense(item2.uid))
  322.    setPlayerStorageValue(mysum, 1003, getSpeed(item2.uid))
  323.    setPlayerStorageValue(mysum, 1004, dittoBonus*getVitality(item2.uid))
  324.    setPlayerStorageValue(mysum, 1005, dittoBonus*getSpecialAttack(item2.uid))
  325.    ------------------
  326.    local pct = getCreatureHealth(mysum) / getCreatureMaxHealth(mysum)
  327.    local vit = (getVitality(mysum) * getMasterLevel(mysum)) / 100
  328.    setCreatureMaxHealth(mysum, ( vit * HPperVITsummon ))   --alterado v1.6
  329.    doCreatureAddHealth(mysum, pct * vit * HPperVITsummon)
  330. end
  331.  
  332. return true
  333. end
  334. -----------------------------
  335.  
  336. -------- LIGHT --------------
  337. if isMonster(item2.uid) and getCreatureMaster(item2.uid) == cid then
  338.  
  339.     markPos(mysum, unfix)
  340.  
  341.     if not isInArray(skills["light"], getPokemonName(item2.uid)) then
  342.     doPlayerSendCancel(cid, "Your Digimon can't use flash.")
  343.     return true
  344.     end
  345.    
  346.     local cd = getCD(thisball.uid, "light", 30)
  347.  
  348.     if cd > 0 then
  349.     doPlayerSendCancel(cid, "Your Digimon is too tired to use flash. Cooldown: ("..getStringmytempo(cd)..")")
  350.     return true
  351.     end
  352.  
  353.     doPlayerSay(cid, ""..getPokeName(mysum)..", "..txt["light"][math.random(1, #txt["light"])].."", 1)
  354.     doCreatureSay(mysum, "FLASH!", TALKTYPE_MONSTER)
  355.     doSendMagicEffect(getThingPos(mysum), 28)
  356.  
  357.     local size = 5
  358.         size = size + math.floor(getSpecialAttack(mysum) / 60)
  359.         size = size + math.ceil(getPokemonLevel(mysum) / 60)
  360.  
  361.         if size > 11 then
  362.             size = 11
  363.         end
  364.  
  365.     doSetCreatureLight(mysum, size, 215, 600*1000)
  366.  
  367.     local delay = math.floor(30 - getPokemonLevel(mysum) / 4)
  368.         if delay > 0 then
  369.         setCD(thisball.uid, "light", delay)
  370.         end
  371.  
  372. return true
  373. end  
  374. -----------------------------
  375.  
  376.  
  377. -------- DIG ----------------
  378. if isInArray(skills["digholes"], item2.itemid) and isInArray(skills["dig"], getPokemonName(mysum)) then
  379.     doPlayerSay(cid, ""..getPokeName(mysum)..", "..txt["dig"][math.random(1, #txt["dig"])].."", 1)
  380.     stackPos = getThingPos(item2.uid).stackpos
  381.     addEvent(goThere, 500, mysum, topos, "dig", isCreature(getCreatureTarget(cid)), stackPos)
  382. return true
  383. end
  384. -----------------------------
  385.  
  386.  
  387. -------- BLINK / MOVE -------
  388. if not isCreature(item2.uid) and isInArray(skills["blink"], getPokemonName(mysum)) then
  389.  
  390.     local cd = getCD(thisball.uid, "blink", 30)
  391.    
  392.     if getPlayerStorageValue(mysum, 2365487) ==  1 then
  393.     return true                  --alterado v1.4
  394.     end
  395.    
  396.     if cd > 0 or not canWalkOnPos(topos, false, false, true, true, true) then
  397.  
  398.         doPlayerSendCancel(cid, "Blink cooldown: ("..getStringmytempo(cd)..")")
  399.         doPlayerSay(cid, ""..getPokeName(mysum)..", "..txt["move"][math.random(1, #txt["move"])].."", 1)
  400.         addEvent(goThere, 500, mysum, topos, "move", isCreature(getCreatureTarget(cid)), maxMoveDist)
  401.  
  402.     return true
  403.     end
  404.  
  405.     local CD = isShinyName(getCreatureName(mysum)) and 20 or 30   --edited blink
  406.  
  407.     markPos(mysum, topos)
  408.     markOwnerPos(mysum, getThingPos(cid))
  409.     setCD(thisball.uid, "blink", CD)
  410.     doPlayerSay(cid, ""..getPokeName(mysum)..", "..txt["blink"][math.random(1, #txt["blink"])].."", 1)
  411.     doSendDistanceShoot(getThingPos(mysum), topos, 39)
  412.     doSendMagicEffect(getThingPos(mysum), 211)
  413.     doTeleportThing(mysum, topos, false)
  414.     doSendMagicEffect(topos, 134)
  415.     doCreatureSay(mysum, "BLINK!", TALKTYPE_MONSTER)
  416.     goThere(mysum, topos, "blink", isCreature(getCreatureTarget(cid)))  --edited blink
  417.  
  418. return true
  419. end
  420. -----------------------------  
  421.  
  422.  
  423. ----START FLY or RIDE or LEVITATE ---------
  424. if (item2.uid == cid or getRecorderPlayer(topos) == cid) and (isInArray(skills["fly"], getPokemonName(mysum)) or isInArray(skills["ride"], getPokemonName(mysum)) or isInArray(skills["levitate_fly"], getPokemonName(mysum))) then
  425.                                                                                                            --alterado v1.8 >>
  426.     if getPlayerStorageValue(cid, 6598754) == 1 or getPlayerStorageValue(cid, 6598755) == 1 then
  427.        return doPlayerSendCancel(cid, "You can't do it while in the PVP Zone!")   --alterado v1.7
  428.     end
  429.    
  430.     if #getCreatureSummons(cid) > 1 then         --alterado v1.9
  431.        return doPlayerSendCancel(cid, "You can't do it right now!")
  432.     end
  433.    
  434.     if getPlayerStorageValue(cid, 52480) >= 1 then
  435.        return doPlayerSendCancel(cid, "You can't do it while a duel!")  --alterado v1.6
  436.     end  
  437.  
  438.     if getPlayerStorageValue(cid, 5700) >= 1 then   --alterado v1.9
  439.        doPlayerSendCancel(cid, "You can't do that while is mount in a bike!")
  440.        return true
  441.     end                                                                
  442.    
  443.     if getPlayerStorageValue(cid, 22545) >= 1 and (isInArray(skills["fly"], getPokemonName(mysum)) or isInArray(skills["levitate_fly"], getPokemonName(mysum))) then      
  444.        return doPlayerSendCancel(cid, "You can't do that while in the Golden Arena!")                          --alterado v1.8
  445.     end
  446.     if not isPremium(cid) then
  447.        doPlayerSendCancel(cid, "Only premium members are allowed to fly or ride.")
  448.        return true
  449.     end
  450.     local pct = getCreatureHealth(mysum) / getCreatureMaxHealth(mysum)
  451.     doItemSetAttribute(getPlayerSlotItem(cid, 8).uid, "hp", 1 - pct)
  452.                                                        
  453.     if isInArray(skills["fly"], getPokemonName(mysum)) then
  454.        doPlayerSay(cid, ""..getPokeName(mysum)..", "..txt["fly"][math.random(1, #txt["fly"])].."", 1)
  455.        addEvent(goThere, 500, mysum, topos, "fly", isCreature(getCreatureTarget(cid)))
  456.     elseif isInArray(skills["levitate_fly"], getPokemonName(mysum)) then
  457.        doPlayerSay(cid, ""..getPokeName(mysum)..", "..txt["levitate_fly"][math.random(1, #txt["levitate_fly"])].."", 1)   --alterado v1.8
  458.        addEvent(goThere, 500, mysum, topos, "fly", isCreature(getCreatureTarget(cid)))
  459.     else
  460.        doPlayerSay(cid, ""..getPokeName(mysum)..", "..txt["ride"][math.random(1, #txt["ride"])].."", 1)
  461.        addEvent(goThere, 500, mysum, topos, "ride", isCreature(getCreatureTarget(cid)))
  462.     end
  463.  
  464. return true
  465. end
  466. -----------------------------
  467. ----------------------------------Control Mind--------------------------------------------   alterado v1.5
  468. if isCreature(item2.uid) and ehMonstro(item2.uid) and isInArray(skills["control mind"], getCreatureName(mysum)) and item2.uid ~= mysum then
  469.    if not isCreature(item2.uid) then
  470.    return true
  471.    end
  472.  
  473.    if isSleeping(mysum) then
  474.       return doPlayerSendCancel(cid, "Your Digimon is sleeping...zZzZ")
  475.    end
  476.  
  477.    if getTileInfo(getThingPos(cid)).protection or getTileInfo(getThingPos(getCreatureSummons(cid)[1])).protection then
  478.       return doPlayerSendCancel(cid, "You or your Digimon are in Pz zone!")
  479.    end
  480.  
  481.    if #getCreatureSummons(cid) == 2 then
  482.       return doPlayerSendCancel(cid, "You only can control one Digimon!")
  483.    end
  484.  
  485.    local cd = getCD(thisball.uid, "control", 120)
  486.    
  487.    if cd > 0 then
  488.       doPlayerSendCancel(cid, "You have to wait "..cd.." segs to use Control Mind again!")
  489.       return true
  490.    end
  491.    
  492.    if getPokemonLevel(item2.uid) >= getPokemonLevel(mysum) then
  493.       return doPlayerSendCancel(cid, "Your Digimon can't control this mind!")
  494.    end
  495.    
  496.    if getPlayerStorageValue(cid, 22545) >= 1 then       --alterado v1.7
  497.       return doPlayerSendCancel(cid, "You can't do that while in the Golden Arena!")
  498.    end
  499.    
  500. local cmed = item2.uid
  501. setCD(thisball.uid, "control", 120)
  502. local gender = getPokemonGender(cmed)
  503. doSendDistanceShoot(getThingPos(mysum), getThingPos(cmed), 39)
  504. --------------
  505. setPlayerStorageValue(cid, 212124, 1)
  506. doConvinceCreature(cid, cmed)
  507. setPlayerStorageValue(cmed, 212123, 1)
  508. doCreatureSay(cid, ""..getCreatureName(mysum)..", control "..string.lower(getCreatureName(cmed)).."'s mind!", 1)
  509.  
  510. local cmname = getCreatureName(mysum)
  511. local cmpos = getThingPos(mysum)
  512. local pokelife = (getCreatureHealth(mysum) / getCreatureMaxHealth(mysum))
  513. doItemSetAttribute(thisball.uid, "hp", pokelife)
  514. doRemoveCreature(mysum)
  515. local cmzao = doSummonCreature(""..cmname.." cm", cmpos)
  516. doConvinceCreature(cid, cmzao)
  517. setPlayerStorageValue(cid, 888, 1)
  518. if useKpdoDlls then
  519.    doUpdateMoves(cid)
  520. end
  521.  
  522. local function check(cid, controled, rod)
  523. if isCreature(cid) then
  524. ball2 = getPlayerSlotItem(cid, 8)
  525.    if getPlayerStorageValue(cid, 888) <= 0 then
  526.    return true
  527.    end
  528.    if not isCreature(controled) then
  529.       setPlayerStorageValue(cid, 212124, 0)
  530.       local sum = isCreature(getCreatureSummons(cid)[1]) and getCreatureSummons(cid)[1] or getCreatureSummons(cid)[2]
  531.       local pkcmpos = getThingPos(sum)
  532.       doRemoveCreature(sum)
  533.       local item = getPlayerSlotItem(cid, 8)
  534.       local pk = doSummonCreature(getItemAttribute(item.uid, "poke"), pkcmpos)
  535.       doConvinceCreature(cid, pk)
  536.       doCreatureSetLookDir(getCreatureSummons(cid)[1], 2)
  537.       addEvent(doAdjustWithDelay, 100, cid, pk, true, true, false)
  538.       setPlayerStorageValue(cid, 888, -1)  --alterado v1.7
  539.       cleanCMcds(item.uid)
  540.       registerCreatureEvent(pk, "SummonDeath")  --alterado v1.6
  541.       if useKpdoDlls then
  542.          doUpdateMoves(cid)
  543.       end
  544.       return true
  545.    end
  546.    
  547.    if rod <= 0 then
  548.       --Pokemon controlado
  549.       local cmed2 = getCreatureSummons(cid)[1]
  550.       local poscmed = getThingPos(cmed2)
  551.       local cmeddir = getCreatureLookDir(cmed2)
  552.       local namecmed = getCreatureName(cmed2)
  553.       local gender = getPokemonGender(cmed2)
  554.       local hp, maxHp = getCreatureHealth(getCreatureSummons(cid)[1]), getCreatureMaxHealth(getCreatureSummons(cid)[1])
  555.       doRemoveCreature(getCreatureSummons(cid)[1])
  556.       local back = doCreateMonster(namecmed, poscmed)
  557.       addEvent(doCreatureSetSkullType, 150, back, gender)
  558.       doWildAttackPlayer(back, cid)
  559.       doCreatureSetLookDir(back, cmeddir)
  560.       addEvent(doCreatureAddHealth, 100, back, hp-maxHp)
  561.    
  562.       -- pokemon controlador   
  563.       local mynewpos = getThingPos(getCreatureSummons(cid)[1])
  564.       doRemoveCreature(getCreatureSummons(cid)[1])
  565.       local pk2 = doSummonCreature(getItemAttribute(ball2.uid, "poke"), mynewpos)
  566.       doConvinceCreature(cid, pk2)
  567.       addEvent(doAdjustWithDelay, 100, cid, pk2, true, true, false)
  568.       setPlayerStorageValue(cid, 888, -1) --alterado v1.7
  569.       doCreatureSetLookDir(getCreatureSummons(cid)[1], 2)
  570.       setPlayerStorageValue(cid, 212124, 0)
  571.       cleanCMcds(ball2.uid)
  572.       registerCreatureEvent(pk2, "SummonDeath")  --alterado v1.6
  573.       if useKpdoDlls then
  574.          doUpdateMoves(cid)
  575.       end
  576.    else
  577.        if isInArray({"Bakemon", "Soulmon", "Phantomon"}, cmname) then
  578.           doSendMagicEffect(getThingPos(getCreatureSummons(cid)[1]), 214)
  579.        else
  580.           doSendMagicEffect(getThingPos(getCreatureSummons(cid)[1]), 220)
  581.        end
  582.    end
  583. end
  584. addEvent(check, 500, cid, controled, rod-1)
  585. end
  586.  
  587. check(cid, cmed, 40)
  588. return true
  589. end
  590. ---------------------------------------------------------------------
  591. -------- MOVE / END ---------
  592.    
  593.     local onlyWater = false
  594.  
  595.     if isWater(getTileThingByPos(checkpos).itemid) then
  596.         onlyWater = true
  597.         for checkwater = 0, 7 do
  598.             if not isWater(getTileThingByPos(getPosByDir(checkpos, checkwater)).itemid) then
  599.                 onlyWater = false
  600.             end
  601.         end
  602.     end
  603.  
  604.     if onlyWater then
  605.         doPlayerSendCancel(cid, "Destination is not reachable.")
  606.     return true
  607.     end
  608.  
  609.     doPlayerSay(cid, ""..getPokeName(mysum)..", "..txt["move"][math.random(1, #txt["move"])].."", 1)
  610.    
  611.     if isCreature(getCreatureTarget(cid)) then
  612.            goThere(mysum, topos, "move", isCreature(getCreatureTarget(cid)), maxMoveDist)          
  613.     else
  614.        addEvent(goThere, 500, mysum, topos, "move", isCreature(getCreatureTarget(cid)), maxMoveDist)                
  615.     end
  616.     -----------------------------
  617. -- Cock System
  618. -- if item2.uid == 11433 or item2.uid == 11432  then
  619. -- local b = getPlayerStorageValue(mysum, 1008)
  620. -- doPlayerSay(cid, ""..getPokeName(mysum)..", "..txt["cock"][math.random(1, #txt["cock"])].."", 1)
  621. -- addEvent(goThere, 500, mysum, topos, "cock", isCreature(getCreatureTarget(cid)))
  622. -- if b < 250 then
  623. -- setPlayerStorageValue(mysum, 1008, b + 100)
  624. -- doCreatureSay(mysum, "CocK!", TALKTYPE_MONSTER)
  625. -- end
  626. -- return true
  627. -- end
  628. -----------------------------
  629.  
  630. return true
  631. end
Advertisement
Add Comment
Please, Sign In to add comment