Ir para conteúdo

KevinLuzetti

Membro
  • Registro em

  • Última visita

Histórico de Curtidas

  1. Gostei
    KevinLuzetti recebeu reputação de Jeff Delay em NPC Cassino   
    Oi gente, eu estava procurando aqui um npc de aposta de 21 e achei no meio das minhas coisas vou disponibilizar pra vcs.
     
    Testado em 0.3.6 e 0.4
     
    XML

    <?xml version="1.0"?> <npc name="Brian O'Conner" script="data/npc/scripts/dicer.lua" walkinterval="0" floorchange="0"> <health now="100" max="100"/> <look type="132" head="114" body="0" legs="0" feet="114" addons="3"/> <parameters> <parameter key="message_greet" value="Ola |PLAYERNAME|, quer {apostar} comigo? " /> </parameters> </npc>
     
     
     
     
    LUA

    price_21 = 1000 -- 1k ou 1000gold price_jogo6 = 5000 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 if(msgcontains(msg, 'apostar')) then selfSay('Eu faco 2 jogos: {21}, e jogo do {6}, escolha um deles!', cid) talkState[talkUser] = 5 elseif (msgcontains(msg, '6') and talkState[talkUser] == 5)    then selfSay('O Jogo do 6 funciona assim: Eu vou rodar um dado, e se cair no numero 6 voce ganha o sextuplo (6 vezes) do valor apostado.', cid) selfSay('Caso nao caia no 6, voce perde apenas o dinheiro da aposta.', cid) selfSay('Esta pronto para {comecar}?.', cid) talkState[talkUser] = 3 elseif(msgcontains(msg, 'comecar') and talkState[talkUser] == 3) then selfSay('Voce possui o {dinheiro} da aposta ('..price_jogo6..')golds ?', cid) if doPlayerRemoveMoney(cid, price_jogo6) == TRUE then talkState[talkUser] = 2 else selfSay('Desculpe, mais voce nao tem dinheiro para apostar comigo.',cid) end elseif(msgcontains(msg, 'dinheiro') and talkState[talkUser] == 2) then sorteio6 = math.random(1,6) if sorteio6 == 6 then talkState[talkUser] = 3 selfSay('Parabens, o numero sorteado foi 6 e voce acaba de ganhar '..(price_jogo6*6) ..'golds, mais o dinheiro que voce pagou da aposta.',cid) doPlayerAddMoney(cid,price_jogo6*6) else talkState[talkUser] = 2 selfSay('Que azar, o numero sorteado foi '..sorteio6..', mais sorte na proxima.',cid) end elseif(msgcontains(msg, '21') and talkState[talkUser] == 5) then selfSay('O 21 funciona assim: Voce ira ganhar 1 numero e o numero tem quer ser 21, ou chegar o mais proximo possivel sem ultrapassar esse valor.', cid) selfSay('E a mesma coisa sera feita comigo, ganharei 1 numero.', cid) selfSay('Voce pode ir comprando mais numeros dizendo {comprar} e se quiser parar e so dizer {parar}.', cid) selfSay('Se voce ganhar de mim, voce leva o triplo do dinheiro apostado.', cid) selfSay('Esta pronto para {comecar}?.', cid) talkState[talkUser] = 0 elseif(msgcontains(msg, 'comecar') and talkState[talkUser] == 0) then selfSay('Voce possui o {dinheiro} da aposta ('..price_21..')golds ?', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'dinheiro') and talkState[talkUser] == 1) then if doPlayerRemoveMoney(cid, price_21) == TRUE then talkState[talkUser] = 0 local mpn = math.random(1,21) setPlayerStorageValue(cid, 55411,mpn)   local pn = getPlayerStorageValue(cid, 55411)         selfSay('Seu numero e '..pn..', quer comprar mais ou parar?',cid) else selfSay('Desculpe, mais voce nao tem dinheiro para apostar comigo.',cid) end elseif(msgcontains(msg, 'comprar') and talkState[talkUser] == 0) then local cp = math.random(1,10) setPlayerStorageValue(cid, 55411, (getPlayerStorageValue(cid, 55411))+cp) selfSay('Seu numero e '..getPlayerStorageValue(cid, 55411)..', quer comprar mais ou parar?',cid) talkState[talkUser] = 0   elseif(msgcontains(msg, 'parar') and talkState[talkUser] == 0) then local npcn = math.random(1,21) setPlayerStorageValue(cid, 2224, npcn) if getPlayerStorageValue(cid, 55411) < getPlayerStorageValue(cid, 2224) then selfSay('Meu numero e '..getPlayerStorageValue(cid, 2224)..'.',cid)        selfSay('Seu numero final e '..getPlayerStorageValue(cid, 55411)..'.',cid)   selfSay('Ganhei, mais sorte na proxima vez.',cid)    talkState[talkUser] = 1 elseif getPlayerStorageValue(cid, 55411) == getPlayerStorageValue(cid, 2224) then selfSay('Meu numero e '..getPlayerStorageValue(cid, 2224)..'.',cid)        selfSay('Seu numero final e '..getPlayerStorageValue(cid, 55411)..'.',cid)   selfSay('Empato, portanto ninguem ganha nada.',cid) talkState[talkUser] = 1 elseif  getPlayerStorageValue(cid, 55411) > getPlayerStorageValue(cid, 2224) and getPlayerStorageValue(cid, 55411) <= 21 then selfSay('Meu numero e '..getPlayerStorageValue(cid, 2224)..'.',cid)        selfSay('Seu numero final e '..getPlayerStorageValue(cid, 55411)..'.',cid)   local somag = (price_21*3) selfSay('Voce ganhou '..somag..'golds, mais os seus '..price_21..'golds de volta. Parabens !!!',cid)    doPlayerAddMoney(cid, somag) doPlayerAddMoney(cid, price_21) talkState[talkUser] = 1 else selfSay('Você tirou um numero maior que 21, então você perdeu.',cid) end                        end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
  2. Gostei
    KevinLuzetti recebeu reputação de SHADOWBREACK em (Resolvido)Bau / Chest Adicionando description   
    veja se ajuda é tfs 0.3.6 deve funcionar
  3. Curtir
    KevinLuzetti recebeu reputação de Cat em NPC Cassino   
    Oi gente, eu estava procurando aqui um npc de aposta de 21 e achei no meio das minhas coisas vou disponibilizar pra vcs.
     
    Testado em 0.3.6 e 0.4
     
    XML

    <?xml version="1.0"?> <npc name="Brian O'Conner" script="data/npc/scripts/dicer.lua" walkinterval="0" floorchange="0"> <health now="100" max="100"/> <look type="132" head="114" body="0" legs="0" feet="114" addons="3"/> <parameters> <parameter key="message_greet" value="Ola |PLAYERNAME|, quer {apostar} comigo? " /> </parameters> </npc>
     
     
     
     
    LUA

    price_21 = 1000 -- 1k ou 1000gold price_jogo6 = 5000 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 if(msgcontains(msg, 'apostar')) then selfSay('Eu faco 2 jogos: {21}, e jogo do {6}, escolha um deles!', cid) talkState[talkUser] = 5 elseif (msgcontains(msg, '6') and talkState[talkUser] == 5)    then selfSay('O Jogo do 6 funciona assim: Eu vou rodar um dado, e se cair no numero 6 voce ganha o sextuplo (6 vezes) do valor apostado.', cid) selfSay('Caso nao caia no 6, voce perde apenas o dinheiro da aposta.', cid) selfSay('Esta pronto para {comecar}?.', cid) talkState[talkUser] = 3 elseif(msgcontains(msg, 'comecar') and talkState[talkUser] == 3) then selfSay('Voce possui o {dinheiro} da aposta ('..price_jogo6..')golds ?', cid) if doPlayerRemoveMoney(cid, price_jogo6) == TRUE then talkState[talkUser] = 2 else selfSay('Desculpe, mais voce nao tem dinheiro para apostar comigo.',cid) end elseif(msgcontains(msg, 'dinheiro') and talkState[talkUser] == 2) then sorteio6 = math.random(1,6) if sorteio6 == 6 then talkState[talkUser] = 3 selfSay('Parabens, o numero sorteado foi 6 e voce acaba de ganhar '..(price_jogo6*6) ..'golds, mais o dinheiro que voce pagou da aposta.',cid) doPlayerAddMoney(cid,price_jogo6*6) else talkState[talkUser] = 2 selfSay('Que azar, o numero sorteado foi '..sorteio6..', mais sorte na proxima.',cid) end elseif(msgcontains(msg, '21') and talkState[talkUser] == 5) then selfSay('O 21 funciona assim: Voce ira ganhar 1 numero e o numero tem quer ser 21, ou chegar o mais proximo possivel sem ultrapassar esse valor.', cid) selfSay('E a mesma coisa sera feita comigo, ganharei 1 numero.', cid) selfSay('Voce pode ir comprando mais numeros dizendo {comprar} e se quiser parar e so dizer {parar}.', cid) selfSay('Se voce ganhar de mim, voce leva o triplo do dinheiro apostado.', cid) selfSay('Esta pronto para {comecar}?.', cid) talkState[talkUser] = 0 elseif(msgcontains(msg, 'comecar') and talkState[talkUser] == 0) then selfSay('Voce possui o {dinheiro} da aposta ('..price_21..')golds ?', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'dinheiro') and talkState[talkUser] == 1) then if doPlayerRemoveMoney(cid, price_21) == TRUE then talkState[talkUser] = 0 local mpn = math.random(1,21) setPlayerStorageValue(cid, 55411,mpn)   local pn = getPlayerStorageValue(cid, 55411)         selfSay('Seu numero e '..pn..', quer comprar mais ou parar?',cid) else selfSay('Desculpe, mais voce nao tem dinheiro para apostar comigo.',cid) end elseif(msgcontains(msg, 'comprar') and talkState[talkUser] == 0) then local cp = math.random(1,10) setPlayerStorageValue(cid, 55411, (getPlayerStorageValue(cid, 55411))+cp) selfSay('Seu numero e '..getPlayerStorageValue(cid, 55411)..', quer comprar mais ou parar?',cid) talkState[talkUser] = 0   elseif(msgcontains(msg, 'parar') and talkState[talkUser] == 0) then local npcn = math.random(1,21) setPlayerStorageValue(cid, 2224, npcn) if getPlayerStorageValue(cid, 55411) < getPlayerStorageValue(cid, 2224) then selfSay('Meu numero e '..getPlayerStorageValue(cid, 2224)..'.',cid)        selfSay('Seu numero final e '..getPlayerStorageValue(cid, 55411)..'.',cid)   selfSay('Ganhei, mais sorte na proxima vez.',cid)    talkState[talkUser] = 1 elseif getPlayerStorageValue(cid, 55411) == getPlayerStorageValue(cid, 2224) then selfSay('Meu numero e '..getPlayerStorageValue(cid, 2224)..'.',cid)        selfSay('Seu numero final e '..getPlayerStorageValue(cid, 55411)..'.',cid)   selfSay('Empato, portanto ninguem ganha nada.',cid) talkState[talkUser] = 1 elseif  getPlayerStorageValue(cid, 55411) > getPlayerStorageValue(cid, 2224) and getPlayerStorageValue(cid, 55411) <= 21 then selfSay('Meu numero e '..getPlayerStorageValue(cid, 2224)..'.',cid)        selfSay('Seu numero final e '..getPlayerStorageValue(cid, 55411)..'.',cid)   local somag = (price_21*3) selfSay('Voce ganhou '..somag..'golds, mais os seus '..price_21..'golds de volta. Parabens !!!',cid)    doPlayerAddMoney(cid, somag) doPlayerAddMoney(cid, price_21) talkState[talkUser] = 1 else selfSay('Você tirou um numero maior que 21, então você perdeu.',cid) end                        end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
  4. Gostei
    KevinLuzetti recebeu reputação de ITALOx em NPC Cassino   
    Oi gente, eu estava procurando aqui um npc de aposta de 21 e achei no meio das minhas coisas vou disponibilizar pra vcs.
     
    Testado em 0.3.6 e 0.4
     
    XML

    <?xml version="1.0"?> <npc name="Brian O'Conner" script="data/npc/scripts/dicer.lua" walkinterval="0" floorchange="0"> <health now="100" max="100"/> <look type="132" head="114" body="0" legs="0" feet="114" addons="3"/> <parameters> <parameter key="message_greet" value="Ola |PLAYERNAME|, quer {apostar} comigo? " /> </parameters> </npc>
     
     
     
     
    LUA

    price_21 = 1000 -- 1k ou 1000gold price_jogo6 = 5000 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 if(msgcontains(msg, 'apostar')) then selfSay('Eu faco 2 jogos: {21}, e jogo do {6}, escolha um deles!', cid) talkState[talkUser] = 5 elseif (msgcontains(msg, '6') and talkState[talkUser] == 5)    then selfSay('O Jogo do 6 funciona assim: Eu vou rodar um dado, e se cair no numero 6 voce ganha o sextuplo (6 vezes) do valor apostado.', cid) selfSay('Caso nao caia no 6, voce perde apenas o dinheiro da aposta.', cid) selfSay('Esta pronto para {comecar}?.', cid) talkState[talkUser] = 3 elseif(msgcontains(msg, 'comecar') and talkState[talkUser] == 3) then selfSay('Voce possui o {dinheiro} da aposta ('..price_jogo6..')golds ?', cid) if doPlayerRemoveMoney(cid, price_jogo6) == TRUE then talkState[talkUser] = 2 else selfSay('Desculpe, mais voce nao tem dinheiro para apostar comigo.',cid) end elseif(msgcontains(msg, 'dinheiro') and talkState[talkUser] == 2) then sorteio6 = math.random(1,6) if sorteio6 == 6 then talkState[talkUser] = 3 selfSay('Parabens, o numero sorteado foi 6 e voce acaba de ganhar '..(price_jogo6*6) ..'golds, mais o dinheiro que voce pagou da aposta.',cid) doPlayerAddMoney(cid,price_jogo6*6) else talkState[talkUser] = 2 selfSay('Que azar, o numero sorteado foi '..sorteio6..', mais sorte na proxima.',cid) end elseif(msgcontains(msg, '21') and talkState[talkUser] == 5) then selfSay('O 21 funciona assim: Voce ira ganhar 1 numero e o numero tem quer ser 21, ou chegar o mais proximo possivel sem ultrapassar esse valor.', cid) selfSay('E a mesma coisa sera feita comigo, ganharei 1 numero.', cid) selfSay('Voce pode ir comprando mais numeros dizendo {comprar} e se quiser parar e so dizer {parar}.', cid) selfSay('Se voce ganhar de mim, voce leva o triplo do dinheiro apostado.', cid) selfSay('Esta pronto para {comecar}?.', cid) talkState[talkUser] = 0 elseif(msgcontains(msg, 'comecar') and talkState[talkUser] == 0) then selfSay('Voce possui o {dinheiro} da aposta ('..price_21..')golds ?', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'dinheiro') and talkState[talkUser] == 1) then if doPlayerRemoveMoney(cid, price_21) == TRUE then talkState[talkUser] = 0 local mpn = math.random(1,21) setPlayerStorageValue(cid, 55411,mpn)   local pn = getPlayerStorageValue(cid, 55411)         selfSay('Seu numero e '..pn..', quer comprar mais ou parar?',cid) else selfSay('Desculpe, mais voce nao tem dinheiro para apostar comigo.',cid) end elseif(msgcontains(msg, 'comprar') and talkState[talkUser] == 0) then local cp = math.random(1,10) setPlayerStorageValue(cid, 55411, (getPlayerStorageValue(cid, 55411))+cp) selfSay('Seu numero e '..getPlayerStorageValue(cid, 55411)..', quer comprar mais ou parar?',cid) talkState[talkUser] = 0   elseif(msgcontains(msg, 'parar') and talkState[talkUser] == 0) then local npcn = math.random(1,21) setPlayerStorageValue(cid, 2224, npcn) if getPlayerStorageValue(cid, 55411) < getPlayerStorageValue(cid, 2224) then selfSay('Meu numero e '..getPlayerStorageValue(cid, 2224)..'.',cid)        selfSay('Seu numero final e '..getPlayerStorageValue(cid, 55411)..'.',cid)   selfSay('Ganhei, mais sorte na proxima vez.',cid)    talkState[talkUser] = 1 elseif getPlayerStorageValue(cid, 55411) == getPlayerStorageValue(cid, 2224) then selfSay('Meu numero e '..getPlayerStorageValue(cid, 2224)..'.',cid)        selfSay('Seu numero final e '..getPlayerStorageValue(cid, 55411)..'.',cid)   selfSay('Empato, portanto ninguem ganha nada.',cid) talkState[talkUser] = 1 elseif  getPlayerStorageValue(cid, 55411) > getPlayerStorageValue(cid, 2224) and getPlayerStorageValue(cid, 55411) <= 21 then selfSay('Meu numero e '..getPlayerStorageValue(cid, 2224)..'.',cid)        selfSay('Seu numero final e '..getPlayerStorageValue(cid, 55411)..'.',cid)   local somag = (price_21*3) selfSay('Voce ganhou '..somag..'golds, mais os seus '..price_21..'golds de volta. Parabens !!!',cid)    doPlayerAddMoney(cid, somag) doPlayerAddMoney(cid, price_21) talkState[talkUser] = 1 else selfSay('Você tirou um numero maior que 21, então você perdeu.',cid) end                        end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
  5. Gostei
    KevinLuzetti recebeu reputação de Lurk em NPC Cassino   
    Oi gente, eu estava procurando aqui um npc de aposta de 21 e achei no meio das minhas coisas vou disponibilizar pra vcs.
     
    Testado em 0.3.6 e 0.4
     
    XML

    <?xml version="1.0"?> <npc name="Brian O'Conner" script="data/npc/scripts/dicer.lua" walkinterval="0" floorchange="0"> <health now="100" max="100"/> <look type="132" head="114" body="0" legs="0" feet="114" addons="3"/> <parameters> <parameter key="message_greet" value="Ola |PLAYERNAME|, quer {apostar} comigo? " /> </parameters> </npc>
     
     
     
     
    LUA

    price_21 = 1000 -- 1k ou 1000gold price_jogo6 = 5000 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 if(msgcontains(msg, 'apostar')) then selfSay('Eu faco 2 jogos: {21}, e jogo do {6}, escolha um deles!', cid) talkState[talkUser] = 5 elseif (msgcontains(msg, '6') and talkState[talkUser] == 5)    then selfSay('O Jogo do 6 funciona assim: Eu vou rodar um dado, e se cair no numero 6 voce ganha o sextuplo (6 vezes) do valor apostado.', cid) selfSay('Caso nao caia no 6, voce perde apenas o dinheiro da aposta.', cid) selfSay('Esta pronto para {comecar}?.', cid) talkState[talkUser] = 3 elseif(msgcontains(msg, 'comecar') and talkState[talkUser] == 3) then selfSay('Voce possui o {dinheiro} da aposta ('..price_jogo6..')golds ?', cid) if doPlayerRemoveMoney(cid, price_jogo6) == TRUE then talkState[talkUser] = 2 else selfSay('Desculpe, mais voce nao tem dinheiro para apostar comigo.',cid) end elseif(msgcontains(msg, 'dinheiro') and talkState[talkUser] == 2) then sorteio6 = math.random(1,6) if sorteio6 == 6 then talkState[talkUser] = 3 selfSay('Parabens, o numero sorteado foi 6 e voce acaba de ganhar '..(price_jogo6*6) ..'golds, mais o dinheiro que voce pagou da aposta.',cid) doPlayerAddMoney(cid,price_jogo6*6) else talkState[talkUser] = 2 selfSay('Que azar, o numero sorteado foi '..sorteio6..', mais sorte na proxima.',cid) end elseif(msgcontains(msg, '21') and talkState[talkUser] == 5) then selfSay('O 21 funciona assim: Voce ira ganhar 1 numero e o numero tem quer ser 21, ou chegar o mais proximo possivel sem ultrapassar esse valor.', cid) selfSay('E a mesma coisa sera feita comigo, ganharei 1 numero.', cid) selfSay('Voce pode ir comprando mais numeros dizendo {comprar} e se quiser parar e so dizer {parar}.', cid) selfSay('Se voce ganhar de mim, voce leva o triplo do dinheiro apostado.', cid) selfSay('Esta pronto para {comecar}?.', cid) talkState[talkUser] = 0 elseif(msgcontains(msg, 'comecar') and talkState[talkUser] == 0) then selfSay('Voce possui o {dinheiro} da aposta ('..price_21..')golds ?', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'dinheiro') and talkState[talkUser] == 1) then if doPlayerRemoveMoney(cid, price_21) == TRUE then talkState[talkUser] = 0 local mpn = math.random(1,21) setPlayerStorageValue(cid, 55411,mpn)   local pn = getPlayerStorageValue(cid, 55411)         selfSay('Seu numero e '..pn..', quer comprar mais ou parar?',cid) else selfSay('Desculpe, mais voce nao tem dinheiro para apostar comigo.',cid) end elseif(msgcontains(msg, 'comprar') and talkState[talkUser] == 0) then local cp = math.random(1,10) setPlayerStorageValue(cid, 55411, (getPlayerStorageValue(cid, 55411))+cp) selfSay('Seu numero e '..getPlayerStorageValue(cid, 55411)..', quer comprar mais ou parar?',cid) talkState[talkUser] = 0   elseif(msgcontains(msg, 'parar') and talkState[talkUser] == 0) then local npcn = math.random(1,21) setPlayerStorageValue(cid, 2224, npcn) if getPlayerStorageValue(cid, 55411) < getPlayerStorageValue(cid, 2224) then selfSay('Meu numero e '..getPlayerStorageValue(cid, 2224)..'.',cid)        selfSay('Seu numero final e '..getPlayerStorageValue(cid, 55411)..'.',cid)   selfSay('Ganhei, mais sorte na proxima vez.',cid)    talkState[talkUser] = 1 elseif getPlayerStorageValue(cid, 55411) == getPlayerStorageValue(cid, 2224) then selfSay('Meu numero e '..getPlayerStorageValue(cid, 2224)..'.',cid)        selfSay('Seu numero final e '..getPlayerStorageValue(cid, 55411)..'.',cid)   selfSay('Empato, portanto ninguem ganha nada.',cid) talkState[talkUser] = 1 elseif  getPlayerStorageValue(cid, 55411) > getPlayerStorageValue(cid, 2224) and getPlayerStorageValue(cid, 55411) <= 21 then selfSay('Meu numero e '..getPlayerStorageValue(cid, 2224)..'.',cid)        selfSay('Seu numero final e '..getPlayerStorageValue(cid, 55411)..'.',cid)   local somag = (price_21*3) selfSay('Voce ganhou '..somag..'golds, mais os seus '..price_21..'golds de volta. Parabens !!!',cid)    doPlayerAddMoney(cid, somag) doPlayerAddMoney(cid, price_21) talkState[talkUser] = 1 else selfSay('Você tirou um numero maior que 21, então você perdeu.',cid) end                        end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
  6. Obrigado
    KevinLuzetti recebeu reputação de L3K0T em NPC Cassino   
    Oi gente, eu estava procurando aqui um npc de aposta de 21 e achei no meio das minhas coisas vou disponibilizar pra vcs.
     
    Testado em 0.3.6 e 0.4
     
    XML

    <?xml version="1.0"?> <npc name="Brian O'Conner" script="data/npc/scripts/dicer.lua" walkinterval="0" floorchange="0"> <health now="100" max="100"/> <look type="132" head="114" body="0" legs="0" feet="114" addons="3"/> <parameters> <parameter key="message_greet" value="Ola |PLAYERNAME|, quer {apostar} comigo? " /> </parameters> </npc>
     
     
     
     
    LUA

    price_21 = 1000 -- 1k ou 1000gold price_jogo6 = 5000 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 if(msgcontains(msg, 'apostar')) then selfSay('Eu faco 2 jogos: {21}, e jogo do {6}, escolha um deles!', cid) talkState[talkUser] = 5 elseif (msgcontains(msg, '6') and talkState[talkUser] == 5)    then selfSay('O Jogo do 6 funciona assim: Eu vou rodar um dado, e se cair no numero 6 voce ganha o sextuplo (6 vezes) do valor apostado.', cid) selfSay('Caso nao caia no 6, voce perde apenas o dinheiro da aposta.', cid) selfSay('Esta pronto para {comecar}?.', cid) talkState[talkUser] = 3 elseif(msgcontains(msg, 'comecar') and talkState[talkUser] == 3) then selfSay('Voce possui o {dinheiro} da aposta ('..price_jogo6..')golds ?', cid) if doPlayerRemoveMoney(cid, price_jogo6) == TRUE then talkState[talkUser] = 2 else selfSay('Desculpe, mais voce nao tem dinheiro para apostar comigo.',cid) end elseif(msgcontains(msg, 'dinheiro') and talkState[talkUser] == 2) then sorteio6 = math.random(1,6) if sorteio6 == 6 then talkState[talkUser] = 3 selfSay('Parabens, o numero sorteado foi 6 e voce acaba de ganhar '..(price_jogo6*6) ..'golds, mais o dinheiro que voce pagou da aposta.',cid) doPlayerAddMoney(cid,price_jogo6*6) else talkState[talkUser] = 2 selfSay('Que azar, o numero sorteado foi '..sorteio6..', mais sorte na proxima.',cid) end elseif(msgcontains(msg, '21') and talkState[talkUser] == 5) then selfSay('O 21 funciona assim: Voce ira ganhar 1 numero e o numero tem quer ser 21, ou chegar o mais proximo possivel sem ultrapassar esse valor.', cid) selfSay('E a mesma coisa sera feita comigo, ganharei 1 numero.', cid) selfSay('Voce pode ir comprando mais numeros dizendo {comprar} e se quiser parar e so dizer {parar}.', cid) selfSay('Se voce ganhar de mim, voce leva o triplo do dinheiro apostado.', cid) selfSay('Esta pronto para {comecar}?.', cid) talkState[talkUser] = 0 elseif(msgcontains(msg, 'comecar') and talkState[talkUser] == 0) then selfSay('Voce possui o {dinheiro} da aposta ('..price_21..')golds ?', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'dinheiro') and talkState[talkUser] == 1) then if doPlayerRemoveMoney(cid, price_21) == TRUE then talkState[talkUser] = 0 local mpn = math.random(1,21) setPlayerStorageValue(cid, 55411,mpn)   local pn = getPlayerStorageValue(cid, 55411)         selfSay('Seu numero e '..pn..', quer comprar mais ou parar?',cid) else selfSay('Desculpe, mais voce nao tem dinheiro para apostar comigo.',cid) end elseif(msgcontains(msg, 'comprar') and talkState[talkUser] == 0) then local cp = math.random(1,10) setPlayerStorageValue(cid, 55411, (getPlayerStorageValue(cid, 55411))+cp) selfSay('Seu numero e '..getPlayerStorageValue(cid, 55411)..', quer comprar mais ou parar?',cid) talkState[talkUser] = 0   elseif(msgcontains(msg, 'parar') and talkState[talkUser] == 0) then local npcn = math.random(1,21) setPlayerStorageValue(cid, 2224, npcn) if getPlayerStorageValue(cid, 55411) < getPlayerStorageValue(cid, 2224) then selfSay('Meu numero e '..getPlayerStorageValue(cid, 2224)..'.',cid)        selfSay('Seu numero final e '..getPlayerStorageValue(cid, 55411)..'.',cid)   selfSay('Ganhei, mais sorte na proxima vez.',cid)    talkState[talkUser] = 1 elseif getPlayerStorageValue(cid, 55411) == getPlayerStorageValue(cid, 2224) then selfSay('Meu numero e '..getPlayerStorageValue(cid, 2224)..'.',cid)        selfSay('Seu numero final e '..getPlayerStorageValue(cid, 55411)..'.',cid)   selfSay('Empato, portanto ninguem ganha nada.',cid) talkState[talkUser] = 1 elseif  getPlayerStorageValue(cid, 55411) > getPlayerStorageValue(cid, 2224) and getPlayerStorageValue(cid, 55411) <= 21 then selfSay('Meu numero e '..getPlayerStorageValue(cid, 2224)..'.',cid)        selfSay('Seu numero final e '..getPlayerStorageValue(cid, 55411)..'.',cid)   local somag = (price_21*3) selfSay('Voce ganhou '..somag..'golds, mais os seus '..price_21..'golds de volta. Parabens !!!',cid)    doPlayerAddMoney(cid, somag) doPlayerAddMoney(cid, price_21) talkState[talkUser] = 1 else selfSay('Você tirou um numero maior que 21, então você perdeu.',cid) end                        end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
  7. Obrigado
    KevinLuzetti deu reputação a Gengo em [OTClient] Sistema de Dialogo Otpokemon   
    [OTClient] Sistema de Dialogo Otpokemon
     
    Venho através desse tópico contribuir para a comunidade, um simples modulo de dialogo no estilo do Otpokemon,
    não é um sistema de dialogo avançado é algo simples que deixa seu servidor intuitivo.
     
    1) Faça o download do modulo no qual se encontra no final do tópico e abrindo a pasta do seu client,, extraia e coloque o modulo na pasta modules.
     
    2) O módulo utiliza uma função chamada switch que não é comum ter no otclient, porem podemos colocar sem muito esforço, na pasta do otclient abra o arquivo util.lua que se encontra em modules/corelib/ e no final do arquivo coloque o seguinte código:
     
    Feito o passo 1 e 2, vamos para a parte do servidor.
     
    1) Crie um arquivo na pasta data/lib/ podendo ter o nome de npcdialog_lib.lua e coloque o seguinte código:
     
    2) O arquivo que acabamos de criar utiliza uma função chamada table.serialize que não é comum ter nos servidores, para que funcione sem erros vamos adicionar, abra o arquivo 012-table.lua que fica na pasta do seu servidor em data/lib/ ou você pode criar o arquivo e adicionar o seguinte código:
     
     
    Feito todo esse procedimento, estarei disponibilizando um npc para que vocês possam ter uma noção de como utilizar esse sistema de dialogo.
     
    1) Crie um arquivo na pasta do servidor em data/npc/ chamado Gengo.xml e adicione o seguinte código:
     
    2) Crie um arquivo na pasta do servidor em data/npc/lib/ com o nome gengo.lua e adicione o seguinte código:
     
     
    O npc é algo simples, porem serve para que você possa ter uma noção de como utilizar as funções do npc.
     
    Demostrativo dentro do game:

     
    Arquivos para download e o scan:
  8. Obrigado
    KevinLuzetti deu reputação a L3K0T em Fade Tile OTCliente 0.6.6   
    by L3K0T
     
    Fade Tile
    Bom galera hoje vou ensina a vocês como deixar seu mapa com a alteração fade tile, exatamente igual ao vídeo do meu canal abaixo, com apenas algumas "alterações" na SOURCE do seu Otclient 0.6.6.
     
    VÍDEO;;
     
    TUTORIALBY L3K0T
     
     
     
    1° VÁ EM  na source do seu otcliente src\client e abra o mapview.cpp e ache;;
     
    m_optimizedSize = Size(g_map.getAwareRange().horizontal(), g_map.getAwareRange().vertical()) * Otc::TILE_PIXELS; abaixo coloque;;
    m_fadeL3K0TTime = 150; ache;;
    void MapView::draw(const Rect& rect) { // update visible tiles cache when needed if(m_mustUpdateVisibleTilesCache || m_updateTilesPos > 0) updateVisibleTilesCache(m_mustUpdateVisibleTilesCache ? 0 : m_updateTilesPos); float scaleFactor = m_tileSize/(float)Otc::TILE_PIXELS; Position cameraPosition = getCameraPosition(); int drawFlags = 0; if(unlikely(g_map.isForcingAnimations()) || (likely(g_map.isShowingAnimations()) && m_viewMode == NEAR_VIEW)) drawFlags = Otc::DrawAnimations; if(m_viewMode == NEAR_VIEW) drawFlags |= Otc::DrawGround | Otc::DrawGroundBorders | Otc::DrawWalls | Otc::DrawItems | Otc::DrawCreatures | Otc::DrawEffects | Otc::DrawMissiles; else drawFlags |= Otc::DrawGround | Otc::DrawGroundBorders | Otc::DrawWalls | Otc::DrawItems; if(m_mustDrawVisibleTilesCache || (drawFlags & Otc::DrawAnimations)) { m_framebuffer->bind(); if(m_mustCleanFramebuffer) { Rect clearRect = Rect(0, 0, m_drawDimension * m_tileSize); g_painter->setColor(Color::black); g_painter->drawFilledRect(clearRect); if(m_drawLights) { m_lightView->reset(); m_lightView->resize(m_framebuffer->getSize()); Light ambientLight; if(cameraPosition.z <= Otc::SEA_FLOOR) { ambientLight = g_map.getLight(); } else { ambientLight.color = 215; ambientLight.intensity = 0; } ambientLight.intensity = std::max<int>(m_minimumAmbientLight*255, ambientLight.intensity); m_lightView->setGlobalLight(ambientLight); } } g_painter->setColor(Color::white); auto it = m_cachedVisibleTiles.begin(); auto end = m_cachedVisibleTiles.end(); for(int z=m_cachedLastVisibleFloor;z>=m_cachedFirstVisibleFloor;--z) { while(it != end) { const TilePtr& tile = *it; Position tilePos = tile->getPosition(); if(tilePos.z != z) break; else ++it; if (g_map.isCovered(tilePos, m_cachedFirstVisibleFloor)) tile->draw(transformPositionTo2D(tilePos, cameraPosition), scaleFactor, drawFlags); else tile->draw(transformPositionTo2D(tilePos, cameraPosition), scaleFactor, drawFlags, m_lightView.get()); } if(drawFlags & Otc::DrawMissiles) { for(const MissilePtr& missile : g_map.getFloorMissiles(z)) { missile->draw(transformPositionTo2D(missile->getPosition(), cameraPosition), scaleFactor, drawFlags & Otc::DrawAnimations, m_lightView.get()); } } } m_framebuffer->release(); // generating mipmaps each frame can be slow in older cards //m_framebuffer->getTexture()->buildHardwareMipmaps(); m_mustDrawVisibleTilesCache = false; } altere para;;
    void MapView::draw(const Rect& rect) { // update visible tiles cache when needed if(m_mustUpdateVisibleTilesCache || m_updateTilesPos > 0) updateVisibleTilesCache(m_mustUpdateVisibleTilesCache ? 0 : m_updateTilesPos); float scaleFactor = m_tileSize/(float)Otc::TILE_PIXELS; Position cameraPosition = getCameraPosition(); int drawFlags = 0; if(unlikely(g_map.isForcingAnimations()) || (likely(g_map.isShowingAnimations()) && m_viewMode == NEAR_VIEW)) drawFlags = Otc::DrawAnimations; if(m_viewMode == NEAR_VIEW) drawFlags |= Otc::DrawGround | Otc::DrawGroundBorders | Otc::DrawWalls | Otc::DrawItems | Otc::DrawCreatures | Otc::DrawEffects | Otc::DrawMissiles; else drawFlags |= Otc::DrawGround | Otc::DrawGroundBorders | Otc::DrawWalls | Otc::DrawItems; if(m_mustDrawVisibleTilesCache || (drawFlags & Otc::DrawAnimations)) { m_framebuffer->bind(); if(m_mustCleanFramebuffer) { Rect clearRect = Rect(0, 0, m_drawDimension * m_tileSize); g_painter->setColor(Color::black); g_painter->drawFilledRect(clearRect); if(m_drawLights) { m_lightView->reset(); m_lightView->resize(m_framebuffer->getSize()); Light ambientLight; if(cameraPosition.z <= Otc::SEA_FLOOR) { ambientLight = g_map.getLight(); } else { ambientLight.color = 215; ambientLight.intensity = 0; } ambientLight.intensity = std::max<int>(m_minimumAmbientLight*255, ambientLight.intensity); m_lightView->setGlobalLight(ambientLight); } } g_painter->setColor(Color::white); int ms = stdext::millis(); auto it = m_cachedVisibleTiles.begin(); auto end = m_cachedVisibleTiles.end(); for(int z=m_cachedLastVisibleFloor;z>=m_cachedFirstVisibleFloor;--z) { while(it != end) { const TilePtr& tile = *it; Position tilePos = tile->getPosition(); if(tilePos.z != z) break; else ++it; if (m_mustDrawFadeInTilesCache && ((ms - m_fadeStart) / (float)m_fadeL3K0TTime) < 1.0 && z <= m_fadeCachedLastVisibleFloor) g_painter->setOpacity(((float)((int)(ms - m_fadeStart) % m_fadeL3K0TTime) / (float)m_fadeL3K0TTime)); if (g_map.isCovered(tilePos, m_cachedFirstVisibleFloor)) tile->draw(transformPositionTo2D(tilePos, cameraPosition), scaleFactor, drawFlags); else tile->draw(transformPositionTo2D(tilePos, cameraPosition), scaleFactor, drawFlags, m_lightView.get()); if (m_mustDrawFadeInTilesCache) g_painter->resetOpacity(); } if(drawFlags & Otc::DrawMissiles) { for(const MissilePtr& missile : g_map.getFloorMissiles(z)) { missile->draw(transformPositionTo2D(missile->getPosition(), cameraPosition), scaleFactor, drawFlags & Otc::DrawAnimations, m_lightView.get()); } } } if (m_mustDrawFadeOutTilesCache && ((ms - m_fadeStart) / (float)m_fadeL3K0TTime) < 1.0) { g_painter->setOpacity(1.0 - ((float)((int)(ms - m_fadeStart) % m_fadeL3K0TTime) / (float)m_fadeL3K0TTime)); auto f_it = m_cachedFadeTiles.begin(); auto f_end = m_cachedFadeTiles.end(); for (int z = m_fadeCachedLastVisibleFloor; z >= m_fadeCachedFirstVisibleFloor; --z) { while (f_it != f_end) { const TilePtr& tile = *f_it; Position tilePos = tile->getPosition(); if (tilePos.z != z) break; else ++f_it; if (g_map.isCovered(tilePos, m_fadeCachedFirstVisibleFloor)) tile->draw(transformPositionTo2D(tilePos, cameraPosition), scaleFactor, drawFlags); else tile->draw(transformPositionTo2D(tilePos, cameraPosition), scaleFactor, drawFlags, m_lightView.get()); } } g_painter->setOpacity(1); } m_framebuffer->release(); // generating mipmaps each frame can be slow in older cards //m_framebuffer->getTexture()->buildHardwareMipmaps(); m_mustDrawVisibleTilesCache = false; } float fadeOpacity = 1.0f; if(!m_shaderSwitchDone && m_fadeOutTime > 0) { fadeOpacity = 1.0f - (m_fadeTimer.timeElapsed() / m_fadeOutTime); if(fadeOpacity < 0.0f) { m_shader = m_nextShader; m_nextShader = nullptr; m_shaderSwitchDone = true; m_fadeTimer.restart(); } } if(m_shaderSwitchDone && m_shader && m_fadeInTime > 0) fadeOpacity = std::min<float>(m_fadeTimer.timeElapsed() / m_fadeInTime, 1.0f); Rect srcRect = calcFramebufferSource(rect.size()); Point drawOffset = srcRect.topLeft(); if(m_shader && g_painter->hasShaders() && g_graphics.shouldUseShaders() && m_viewMode == NEAR_VIEW) { Rect framebufferRect = Rect(0,0, m_drawDimension * m_tileSize); Point center = srcRect.center(); Point globalCoord = Point(cameraPosition.x - m_drawDimension.width()/2, -(cameraPosition.y - m_drawDimension.height()/2)) * m_tileSize; m_shader->bind(); m_shader->setUniformValue(ShaderManager::MAP_CENTER_COORD, center.x / (float)framebufferRect.width(), 1.0f - center.y / (float)framebufferRect.height()); m_shader->setUniformValue(ShaderManager::MAP_GLOBAL_COORD, globalCoord.x / (float)framebufferRect.height(), globalCoord.y / (float)framebufferRect.height()); m_shader->setUniformValue(ShaderManager::MAP_ZOOM, scaleFactor); g_painter->setShaderProgram(m_shader); } g_painter->setColor(Color::white); g_painter->setOpacity(fadeOpacity); glDisable(GL_BLEND); #if 0 // debug source area g_painter->saveAndResetState(); m_framebuffer->bind(); g_painter->setColor(Color::green); g_painter->drawBoundingRect(srcRect, 2); m_framebuffer->release(); g_painter->restoreSavedState(); m_framebuffer->draw(rect); #else m_framebuffer->draw(rect, srcRect); #endif g_painter->resetShaderProgram(); g_painter->resetOpacity(); glEnable(GL_BLEND); // this could happen if the player position is not known yet if(!cameraPosition.isValid()) return; float horizontalStretchFactor = rect.width() / (float)srcRect.width(); float verticalStretchFactor = rect.height() / (float)srcRect.height(); // avoid drawing texts on map in far zoom outs if(m_viewMode == NEAR_VIEW) { for(const CreaturePtr& creature : m_cachedFloorVisibleCreatures) { if(!creature->canBeSeen()) continue; PointF jumpOffset = creature->getJumpOffset() * scaleFactor; Point creatureOffset = Point(16 - creature->getDisplacementX(), - creature->getDisplacementY() - 2); Position pos = creature->getPosition(); Point p = transformPositionTo2D(pos, cameraPosition) - drawOffset; p += (creature->getDrawOffset() + creatureOffset) * scaleFactor - Point(stdext::round(jumpOffset.x), stdext::round(jumpOffset.y)); p.x = p.x * horizontalStretchFactor; p.y = p.y * verticalStretchFactor; p += rect.topLeft(); int flags = 0; if(m_drawNames){ flags = Otc::DrawNames; } if(m_drawHealthBars) { flags |= Otc::DrawBars; } creature->drawInformation(p, g_map.isCovered(pos, m_cachedFirstVisibleFloor), rect, flags); } } // lights are drawn after names and before texts if(m_drawLights) m_lightView->draw(rect, srcRect); if(m_viewMode == NEAR_VIEW && m_drawTexts) { for(const StaticTextPtr& staticText : g_map.getStaticTexts()) { Position pos = staticText->getPosition(); // ony draw static texts from current camera floor, unless yells //if(pos.z != cameraPosition.z && !staticText->isYell()) // continue; if(pos.z != cameraPosition.z && staticText->getMessageMode() == Otc::MessageNone) continue; Point p = transformPositionTo2D(pos, cameraPosition) - drawOffset; p.x = p.x * horizontalStretchFactor; p.y = p.y * verticalStretchFactor; p += rect.topLeft(); staticText->drawText(p, rect); } for(const AnimatedTextPtr& animatedText : g_map.getAnimatedTexts()) { Position pos = animatedText->getPosition(); /* // only draw animated texts from visible floors if(pos.z < m_cachedFirstVisibleFloor || pos.z > m_cachedLastVisibleFloor) continue; // dont draw animated texts from covered tiles if(pos.z != cameraPosition.z && g_map.isCovered(pos, m_cachedFirstVisibleFloor)) continue; */ if(pos.z != cameraPosition.z) continue; Point p = transformPositionTo2D(pos, cameraPosition) - drawOffset; p.x = p.x * horizontalStretchFactor; p.y = p.y * verticalStretchFactor; p += rect.topLeft(); animatedText->drawText(p, rect); } } } ache;;
    void MapView::updateVisibleTilesCache(int start) { if(start == 0) { m_cachedFirstVisibleFloor = calcFirstVisibleFloor(); m_cachedLastVisibleFloor = calcLastVisibleFloor(); assert(m_cachedFirstVisibleFloor >= 0 && m_cachedLastVisibleFloor >= 0 && m_cachedFirstVisibleFloor <= Otc::MAX_Z && m_cachedLastVisibleFloor <= Otc::MAX_Z); if(m_cachedLastVisibleFloor < m_cachedFirstVisibleFloor) m_cachedLastVisibleFloor = m_cachedFirstVisibleFloor; m_cachedFloorVisibleCreatures.clear(); m_cachedVisibleTiles.clear(); m_mustCleanFramebuffer = true; m_mustDrawVisibleTilesCache = true; m_mustUpdateVisibleTilesCache = false; m_updateTilesPos = 0; } else m_mustCleanFramebuffer = false; // there is no tile to render on invalid positions Position cameraPosition = getCameraPosition(); if(!cameraPosition.isValid()) return; bool stop = false; // clear current visible tiles cache m_cachedVisibleTiles.clear(); m_mustDrawVisibleTilesCache = true; m_updateTilesPos = 0; // cache visible tiles in draw order // draw from last floor (the lower) to first floor (the higher) for(int iz = m_cachedLastVisibleFloor; iz >= m_cachedFirstVisibleFloor && !stop; --iz) { if(m_viewMode <= FAR_VIEW) { const int numDiagonals = m_drawDimension.width() + m_drawDimension.height() - 1; // loop through / diagonals beginning at top left and going to top right for(int diagonal = 0; diagonal < numDiagonals && !stop; ++diagonal) { // loop current diagonal tiles int advance = std::max<int>(diagonal - m_drawDimension.height(), 0); for(int iy = diagonal - advance, ix = advance; iy >= 0 && ix < m_drawDimension.width() && !stop; --iy, ++ix) { // only start really looking tiles in the desired start if(m_updateTilesPos < start) { m_updateTilesPos++; continue; } // avoid rendering too much tiles at once if((int)m_cachedVisibleTiles.size() > MAX_TILE_DRAWS && m_viewMode >= HUGE_VIEW) { stop = true; break; } // position on current floor //TODO: check position limits Position tilePos = cameraPosition.translated(ix - m_virtualCenterOffset.x, iy - m_virtualCenterOffset.y); // adjust tilePos to the wanted floor tilePos.coveredUp(cameraPosition.z - iz); if(const TilePtr& tile = g_map.getTile(tilePos)) { // skip tiles that have nothing if(!tile->isDrawable()) continue; // skip tiles that are completely behind another tile if(g_map.isCompletelyCovered(tilePos, m_cachedFirstVisibleFloor)) continue; m_cachedVisibleTiles.push_back(tile); } m_updateTilesPos++; } } } else { // cache tiles in spiral mode static std::vector<Point> m_spiral; if(start == 0) { m_spiral.resize(m_drawDimension.area()); int width = m_drawDimension.width(); int height = m_drawDimension.height(); int tpx = width/2 - 2; int tpy = height/2 - 2; int count = 0; Rect area(0, 0, m_drawDimension); m_spiral[count++] = Point(tpx+1,tpy+1); for(int step = 1; tpx >= 0 || tpy >= 0; ++step, --tpx, --tpy) { int qs = 2*step; Rect lines[4] = { Rect(tpx, tpy, qs, 1), Rect(tpx + qs, tpy, 1, qs), Rect(tpx + 1, tpy + qs, qs, 1), Rect(tpx, tpy + 1, 1, qs), }; for(int i=0;i<4;++i) { int sx = std::max<int>(lines[i].left(), area.left()); int ex = std::min<int>(lines[i].right(), area.right()); int sy = std::max<int>(lines[i].top(), area.top()); int ey = std::min<int>(lines[i].bottom(), area.bottom()); for(int qx=sx;qx<=ex;++qx) for(int qy=sy;qy<=ey;++qy) m_spiral[count++] = Point(qx, qy); } } } for(m_updateTilesPos = start; m_updateTilesPos < (int)m_spiral.size(); ++m_updateTilesPos) { // avoid rendering too much tiles at once if((int)m_cachedVisibleTiles.size() > MAX_TILE_DRAWS) { stop = true; break; } const Point& p = m_spiral[m_updateTilesPos]; Position tilePos = cameraPosition.translated(p.x - m_virtualCenterOffset.x, p.y - m_virtualCenterOffset.y); tilePos.coveredUp(cameraPosition.z - iz); if(const TilePtr& tile = g_map.getTile(tilePos)) { if(tile->isDrawable()) m_cachedVisibleTiles.push_back(tile); } } } } if(!stop) { m_updateTilesPos = 0; m_spiral.clear(); } if(start == 0 && m_viewMode <= NEAR_VIEW) m_cachedFloorVisibleCreatures = g_map.getSightSpectators(cameraPosition, false); } altere para;;
    void MapView::updateVisibleTilesCache(int start) { int m_oldCachedFirstVisibleFloor = m_cachedFirstVisibleFloor; int m_oldCachedLastVisibleFloor = m_cachedLastVisibleFloor; bool m_mustUpdateFadeTilesCache = false; if(start == 0) { m_cachedFirstVisibleFloor = calcFirstVisibleFloor(); m_cachedLastVisibleFloor = calcLastVisibleFloor(); if (m_drawFadeEffect && m_oldCachedFirstVisibleFloor != m_cachedFirstVisibleFloor) m_mustUpdateFadeTilesCache = true; assert(m_cachedFirstVisibleFloor >= 0 && m_cachedLastVisibleFloor >= 0 && m_cachedFirstVisibleFloor <= Otc::MAX_Z && m_cachedLastVisibleFloor <= Otc::MAX_Z); if(m_cachedLastVisibleFloor < m_cachedFirstVisibleFloor) m_cachedLastVisibleFloor = m_cachedFirstVisibleFloor; m_cachedFloorVisibleCreatures.clear(); m_cachedVisibleTiles.clear(); m_mustCleanFramebuffer = true; m_mustDrawVisibleTilesCache = true; m_mustUpdateVisibleTilesCache = false; m_updateTilesPos = 0; } else m_mustCleanFramebuffer = false; // there is no tile to render on invalid positions Position cameraPosition = getCameraPosition(); if(!cameraPosition.isValid()) return; bool stop = false; // clear current visible tiles cache m_cachedVisibleTiles.clear(); m_mustDrawVisibleTilesCache = true; m_updateTilesPos = 0; // cache fade visible tiles // draw from first floor that is currently visible (the higher) to the last seen visible floor // effect is only present in view mode lower than FAR_VIEW. if (m_viewMode <= FAR_VIEW && m_mustUpdateFadeTilesCache) { m_cachedFadeTiles.clear(); if (m_oldCachedFirstVisibleFloor < m_cachedFirstVisibleFloor) { m_fadeCachedLastVisibleFloor = m_cachedFirstVisibleFloor-1; // The lowest floor will be the highest floor in cache, at least one floor above it. m_fadeCachedFirstVisibleFloor = m_oldCachedFirstVisibleFloor; // The highest floor will be the old highest visible floor. m_mustDrawFadeOutTilesCache = true; m_mustDrawFadeInTilesCache = false; } else { m_fadeCachedLastVisibleFloor = m_oldCachedFirstVisibleFloor - 1; // The lowest floor will be the highest floor in cache, at least one floor above it. m_fadeCachedFirstVisibleFloor = m_cachedFirstVisibleFloor; // The highest floor will be the old highest visible floor. m_mustDrawFadeOutTilesCache = false; m_mustDrawFadeInTilesCache = true; } if (m_lastCameraFloor != cameraPosition.z) { m_lastCameraFloor = cameraPosition.z; m_fadeStart = 0; } else { m_fadeStart = stdext::millis(); } for (int iz = m_fadeCachedLastVisibleFloor; iz >= m_fadeCachedFirstVisibleFloor; --iz) { const int numDiagonals = m_drawDimension.width() + m_drawDimension.height() - 1; // loop through / diagonals beginning at top left and going to top right for (int diagonal = 0; diagonal < numDiagonals; ++diagonal) { // loop current diagonal tiles int advance = std::max<int>(diagonal - m_drawDimension.height(), 0); for (int iy = diagonal - advance, ix = advance; iy >= 0 && ix < m_drawDimension.width(); --iy, ++ix) { // position on current floor // TODO: check position limits Position tilePos = cameraPosition.translated(ix - m_virtualCenterOffset.x, iy - m_virtualCenterOffset.y); // adjust tilePos to the wanted floor tilePos.coveredUp(cameraPosition.z - iz); if (const TilePtr& tile = g_map.getTile(tilePos)) { //skip tiles that have nothing if (!tile->isDrawable()) continue; //skip tiles that are completely behind another tile if (g_map.isCompletelyCovered(tilePos, m_fadeCachedFirstVisibleFloor)) continue; m_cachedFadeTiles.push_back(tile); } } } } } // cache visible tiles in draw order // draw from last floor (the lower) to first floor (the higher) for(int iz = m_cachedLastVisibleFloor; iz >= m_cachedFirstVisibleFloor && !stop; --iz) { if(m_viewMode <= FAR_VIEW) { const int numDiagonals = m_drawDimension.width() + m_drawDimension.height() - 1; // loop through / diagonals beginning at top left and going to top right for(int diagonal = 0; diagonal < numDiagonals && !stop; ++diagonal) { // loop current diagonal tiles int advance = std::max<int>(diagonal - m_drawDimension.height(), 0); for(int iy = diagonal - advance, ix = advance; iy >= 0 && ix < m_drawDimension.width() && !stop; --iy, ++ix) { // only start really looking tiles in the desired start if(m_updateTilesPos < start) { m_updateTilesPos++; continue; } // avoid rendering too much tiles at once if((int)m_cachedVisibleTiles.size() > MAX_TILE_DRAWS && m_viewMode >= HUGE_VIEW) { stop = true; break; } // position on current floor //TODO: check position limits Position tilePos = cameraPosition.translated(ix - m_virtualCenterOffset.x, iy - m_virtualCenterOffset.y); // adjust tilePos to the wanted floor tilePos.coveredUp(cameraPosition.z - iz); if(const TilePtr& tile = g_map.getTile(tilePos)) { // skip tiles that have nothing if(!tile->isDrawable()) continue; // skip tiles that are completely behind another tile if(g_map.isCompletelyCovered(tilePos, m_cachedFirstVisibleFloor)) if (m_mustDrawFadeInTilesCache && tilePos.z < m_fadeCachedLastVisibleFloor + 1) continue; m_cachedVisibleTiles.push_back(tile); } m_updateTilesPos++; } } } else { // cache tiles in spiral mode static std::vector<Point> m_spiral; if(start == 0) { m_spiral.resize(m_drawDimension.area()); int width = m_drawDimension.width(); int height = m_drawDimension.height(); int tpx = width/2 - 2; int tpy = height/2 - 2; int count = 0; Rect area(0, 0, m_drawDimension); m_spiral[count++] = Point(tpx+1,tpy+1); for(int step = 1; tpx >= 0 || tpy >= 0; ++step, --tpx, --tpy) { int qs = 2*step; Rect lines[4] = { Rect(tpx, tpy, qs, 1), Rect(tpx + qs, tpy, 1, qs), Rect(tpx + 1, tpy + qs, qs, 1), Rect(tpx, tpy + 1, 1, qs), }; for(int i=0;i<4;++i) { int sx = std::max<int>(lines[i].left(), area.left()); int ex = std::min<int>(lines[i].right(), area.right()); int sy = std::max<int>(lines[i].top(), area.top()); int ey = std::min<int>(lines[i].bottom(), area.bottom()); for(int qx=sx;qx<=ex;++qx) for(int qy=sy;qy<=ey;++qy) m_spiral[count++] = Point(qx, qy); } } } for(m_updateTilesPos = start; m_updateTilesPos < (int)m_spiral.size(); ++m_updateTilesPos) { // avoid rendering too much tiles at once if((int)m_cachedVisibleTiles.size() > MAX_TILE_DRAWS) { stop = true; break; } const Point& p = m_spiral[m_updateTilesPos]; Position tilePos = cameraPosition.translated(p.x - m_virtualCenterOffset.x, p.y - m_virtualCenterOffset.y); tilePos.coveredUp(cameraPosition.z - iz); if(const TilePtr& tile = g_map.getTile(tilePos)) { if(tile->isDrawable()) m_cachedVisibleTiles.push_back(tile); } } } } if(!stop) { m_updateTilesPos = 0; m_spiral.clear(); } if(start == 0 && m_viewMode <= NEAR_VIEW) m_cachedFloorVisibleCreatures = g_map.getSightSpectators(cameraPosition, false); } ache;;
    void MapView::updateGeometry(const Size& visibleDimension, const Size& optimizedSize) { int tileSize = 0; Size bufferSize; int possiblesTileSizes[] = {1,2,4,8,16,32}; for(int candidateTileSize : possiblesTileSizes) { bufferSize = (visibleDimension + Size(3,3)) * candidateTileSize; if(bufferSize.width() > g_graphics.getMaxTextureSize() || bufferSize.height() > g_graphics.getMaxTextureSize()) break; tileSize = candidateTileSize; if(optimizedSize.width() < bufferSize.width() - 3*candidateTileSize && optimizedSize.height() < bufferSize.height() - 3*candidateTileSize) break; } if(tileSize == 0) { g_logger.traceError("reached max zoom out"); return; } Size drawDimension = visibleDimension + Size(3,3); Point virtualCenterOffset = (drawDimension/2 - Size(1,1)).toPoint(); Point visibleCenterOffset = virtualCenterOffset; ViewMode viewMode = m_viewMode; if(m_autoViewMode) { if(tileSize >= 32 && visibleDimension.area() <= NEAR_VIEW_AREA) viewMode = NEAR_VIEW; else if(tileSize >= 16 && visibleDimension.area() <= MID_VIEW_AREA) viewMode = MID_VIEW; else if(tileSize >= 8 && visibleDimension.area() <= FAR_VIEW_AREA) viewMode = FAR_VIEW; else viewMode = HUGE_VIEW; if(viewMode >= FAR_VIEW) m_multifloor = false; else m_multifloor = true; } // draw actually more than what is needed to avoid massive recalculations on huge views /* if(viewMode >= HUGE_VIEW) { Size oldDimension = drawDimension; drawDimension = (m_framebuffer->getSize() / tileSize); virtualCenterOffset += (drawDimension - oldDimension).toPoint() / 2; } m_viewMode = viewMode; m_visibleDimension = visibleDimension; m_drawDimension = drawDimension; m_tileSize = tileSize; m_virtualCenterOffset = virtualCenterOffset; m_visibleCenterOffset = visibleCenterOffset; m_optimizedSize = optimizedSize; m_framebuffer->resize(bufferSize); requestVisibleTilesCacheUpdate(); } altere para;;
    void MapView::updateGeometry(const Size& visibleDimension, const Size& optimizedSize) { int tileSize = 0; Size bufferSize; int possiblesTileSizes[] = {1,2,4,8,16,32}; for(int candidateTileSize : possiblesTileSizes) { bufferSize = (visibleDimension + Size(3,3)) * candidateTileSize; if(bufferSize.width() > g_graphics.getMaxTextureSize() || bufferSize.height() > g_graphics.getMaxTextureSize()) break; tileSize = candidateTileSize; if(optimizedSize.width() < bufferSize.width() - 3*candidateTileSize && optimizedSize.height() < bufferSize.height() - 3*candidateTileSize) break; } if(tileSize == 0) { g_logger.traceError("reached max zoom out"); return; } Size drawDimension = visibleDimension + Size(3,3); Point virtualCenterOffset = (drawDimension/2 - Size(1,1)).toPoint(); Point visibleCenterOffset = virtualCenterOffset; ViewMode viewMode = m_viewMode; if(m_autoViewMode) { if(tileSize >= 32 && visibleDimension.area() <= NEAR_VIEW_AREA) viewMode = NEAR_VIEW; else if(tileSize >= 16 && visibleDimension.area() <= MID_VIEW_AREA) viewMode = MID_VIEW; else if(tileSize >= 8 && visibleDimension.area() <= FAR_VIEW_AREA) viewMode = FAR_VIEW; else viewMode = HUGE_VIEW; if(viewMode >= FAR_VIEW) m_multifloor = false; else m_multifloor = true; } m_viewMode = viewMode; m_visibleDimension = visibleDimension; m_drawDimension = drawDimension; m_tileSize = tileSize; m_virtualCenterOffset = virtualCenterOffset; m_visibleCenterOffset = visibleCenterOffset; m_optimizedSize = optimizedSize; m_framebuffer->resize(bufferSize); requestVisibleTilesCacheUpdate(); } Agora em  mapview.h
    ache:;;
    stdext::boolean<true> m_shaderSwitchDone; abaixo adicione;;
    //efeito mapa by l3k0t stdext::boolean<true> m_drawFadeEffect; stdext::boolean<false> m_mustDrawFadeOutTilesCache; stdext::boolean<false> m_mustDrawFadeInTilesCache; std::vector<TilePtr> m_cachedFadeTiles; int m_fadeCachedFirstVisibleFloor; int m_lastCameraFloor; int m_fadeCachedLastVisibleFloor; ticks_t m_fadeStart; int m_fadeL3K0TTime;  
    Feito isso é só salvar e compilar com as alterações no modo REBUILDER e bom uso.
    Ajudei?? REP+  
     
    Créditos:
    Criadores do PokezRing
    ReyHammer (criador original)
     
     
     
     
  9. Obrigado
    KevinLuzetti recebeu reputação de L3K0T em First to Speak Summon System - talkactions   
    parabéns belo codigo, vai ajudar muitos.
  10. Curtir
    KevinLuzetti deu reputação a L3K0T em First to Speak Summon System - talkactions   
    L3K0TTFS 04 e TFS 0.3.6
    Olá galera, hoje vim trazer um sistema chamado "First to Speak Summon" mais pera ai L3K0T, como funciona? Bom ele sumonar um monstro numa posição setada por sua preferencia, também verifica uma posxyz que você pode setar também e assim falar o comando "!fss"... mais pera ai L3K0T oque tem de diferente??? ... calma ... esse comando só pode ser pronunciado por 1 player somente, no caso se alguém falar o comando depois de você... não irá sumonar até que o tempo pra falar novamente acabe "configurado" e BORA PRO TUTORIAL???
     
     
    TUTORIAL;;
     
    1° vai na pasta Servidor\data\talkactions\scripts copia um arquivo.lua e renomeia para fss e dentro coloque;;
     
    local t = { sto = 565674, --Storage global; temp = 300, --Tempo para falar em milesimo 300 = 5 minutos // segundos o comando; monstro = "Demon", --Nome monstrinho que vá nascer; localmapa = {x=1569, y=214, z=7}, --Posição aonde o monstrinho vai nascer; pisomapa = {x=1565, y=215, z=7}, --Posição aonde o player precisa estar para falar o comando de sua preferencia; msgsucesso = "monstro foi criado!!!", --Mensagem que manda ao player ao criar o monstrinho; msgsono = "Demon Está dormindo zzzZZZ", --Mensagem ao tentar usar o comando com intervalo de espera do comando; msgnull = "Está acordado corra lá", --Mensagem quando o monstro acordar } function onSay(cid, words, param, channel) local tp = getThingPos(cid) --verficação --inicio if tp.x == t.pisomapa.x and tp.y == t.pisomapa.y and tp.z == t.pisomapa.z then --verificação if getPlayerStorageValue(cid, t.sto) > os.time() then --verificação tempo doPlayerSendTextMessage(cid, 27, t.msgsono) return true end for _, cid in ipairs(getPlayersOnline()) do --verificação players global setPlayerStorageValue(cid, t.sto, os.time() + t.temp) --seta storage end doCreateMonster(t.monstro, t.localmapa) doPlayerSendTextMessage(cid, 27, t.msgsucesso) else --fora do tile if getPlayerStorageValue(cid, t.sto) > os.time() then --verificação tempo doPlayerSendTextMessage(cid, 27, t.msgsono) return true end if getPlayerStorageValue(cid, t.sto) < os.time() then --verificação tempo doPlayerSendTextMessage(cid, 27, t.msgnull) return true end end --fim script BY L3K0T return true end tag xml;;
     
    <talkaction words="!fss" event="script" value="fss.lua"/> feito isso salva tudinho e use da melhor forma que achar.
     
    Video;;
     
     
    Créditos: @L3K0T
     
     

Informação Importante

Confirmação de Termo