Ir para conteúdo
  • Cadastre-se

Vote Reward System


TheKon

Posts recomendados

Bom Dia!

Percebi que muitos estavão atras desse Sistema

Em que alguns Servidores usam pagos

Porém encontrei um desenvolvedor dele na L2JFree

Segue abaixo:

 

Adicionar na tabela Characters:

Name: 'vote'  Type: 'int' Lenght: 10  Decimals: 0 Allow null:[ ] Default: 0 Unsigned: [x]

 

Agora segue o codigo para o Java:

   1. Index: D:/Eclipse/Core/com/java/com/l2j/gameserver/model/actor/instance/L2PcInstance.java
  2. ===================================================================
  3. --- D:/Eclipse/Core/com/java/com/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 4875)
  4. +++ D:/Eclipse/Core/com/java/com/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy)
  5. @@ -267,8 +267,8 @@
  6. private static final String DELETE_SKILL_SAVE = "DELETE FROM character_skills_save WHERE charId=? AND class_index=?";
  7.  
  8. // Character Character SQL String Definitions:
  9. - private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,in_jail=?,jail_timer=?,newbie=?,nobless=?,pledge_rank=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,banchat_timer=?,char_name=?,death_penalty_level=?,trust_level=? WHERE charId=?";
 10. - private static final String RESTORE_CHARACTER = "SELECT account_name, charId, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, in_jail, jail_timer, banchat_timer, newbie, nobless, pledge_rank, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally, clan_join_expiry_time,clan_create_expiry_time,charViP,death_penalty_level,trust_level FROM characters WHERE charId=?";
 11. + private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,in_jail=?,jail_timer=?,newbie=?,nobless=?,pledge_rank=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,banchat_timer=?,char_name=?,death_penalty_level=?,trust_level=?,vote=? WHERE charId=?";
 12. + private static final String RESTORE_CHARACTER = "SELECT account_name, charId, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, in_jail, jail_timer, banchat_timer, newbie, nobless, pledge_rank, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally, clan_join_expiry_time,clan_create_expiry_time,charViP,death_penalty_level,trust_level,vote FROM characters WHERE charId=?";
 13.  
 14. // Character Subclass SQL String Definitions:
 15. private static final String RESTORE_CHAR_SUBCLASSES = "SELECT class_id,exp,sp,level,class_index FROM character_subclasses WHERE charId=? ORDER BY class_index ASC";
 16. @@ -289,7 +289,9 @@
 17. private static final String RESTORE_CHAR_RECOMS = "SELECT charId,target_id FROM character_recommends WHERE charId=?";
 18. private static final String ADD_CHAR_RECOM = "INSERT INTO character_recommends (charId,target_id) VALUES (?,?)";
 19. private static final String DELETE_CHAR_RECOMS = "DELETE FROM character_recommends WHERE charId=?";
 20. -
 21. + private static final String RESTORE_CHAR_VOTE = "SELECT vote FROM characters WHERE charId=?";
 22. + private static final String UPDATE_CHAR_VOTE = "UPDATE characters SET vote=? WHERE charId=?";
 23. +
 24. // Character Transformation SQL String Definitions:
 25. private static final String SELECT_CHAR_TRANSFORM = "SELECT transform_id FROM characters WHERE charId=?";
 26. private static final String UPDATE_CHAR_TRANSFORM = "UPDATE characters SET transform_id=? WHERE charId=?";
 27. @@ -408,6 +410,10 @@
 28.  
 29. /** The number of player killed during a PvP (the player killed was PvP Flagged) */
 30. private int _pvpKills;
 31. +
 32. + /** The number of the player's votes */
 33. +
 34. + private int _voteCount;
 35.  
 36. /** The PK counter of the L2PcInstance (= number of non PvP Flagged player killed) */
 37. private int _pkKills;
 38. @@ -2****6 +2107,19 @@
 39. return _pvpKills;
 40. }
 41.  
 42. +
 43. + public int getVoteCount()
 44. + {
 45. + restoreVote();
 46. + return _voteCount;
 47. + }
 48. +
 49. + public void setVoteCount(int vote)
 50. + {
 51. + _voteCount = vote;
 52. + updateVote();
 53. + }
 54. +
 55. /**
 56. * Set the the PvP Kills of the L2PcInstance (Number of player killed during a PvP).<BR><BR>
 57. */
 58. @@ -6794,7 +6813,8 @@
 59. player.setAllianceWithVarkaKetra(rset.getInt("varka_ketra_ally"));
 60. player.setDeathPenaltyBuffLevel(rset.getInt("death_penalty_level"));
 61. player.setTrustLevel(rset.getInt("trust_level"));
 62. -
 63. + player.setVoteCount(rset.getInt("vote"));
 64. +
 65. // Add the L2PcInstance object in _allObjects
 66. // L2World.getInstance().storeObject(player);
 67.  
 68. @@ -7030,6 +7050,57 @@
 69. finally { try { if (con != null) con.close(); } catch (SQLException e) { e.printStackTrace(); } }
 70. }
 71.  
 72. +
 73. + private void restoreVote()
 74. + {
 75. + Connection con = null;
 76. +
 77. + try
 78. + {
 79. + con = L2DatabaseFactory.getInstance().getConnection(con);
 80. + PreparedStatement statement = con.prepareStatement(RESTORE_CHAR_VOTE);
 81. + statement.setInt(1, getObjectId());
 82. + ResultSet rset = statement.executeQuery();
 83. + while (rset.next())
 84. + {
 85. + _voteCount=(rset.getInt("vote"));
 86. + }
 87. +
 88. + rset.close();
 89. + statement.close();
 90. + }
 91. + catch (Exception e)
 92. + {
 93. + _log.error("could not restore vote: ", e);
 94. + }
 95. + finally { try { if (con != null) con.close(); } catch (SQLException e) { e.printStackTrace(); } }
 96. + }
 97. +
 98. +
 99. + private void updateVote()
100. + {
101. +
102. +
103. +
104. + Connection con = null;
105. + try
106. + {
107. + con = L2DatabaseFactory.getInstance().getConnection(con);
108. + PreparedStatement statement = con.prepareStatement(UPDATE_CHAR_VOTE);
109. + statement.setInt(1, _voteCount);
110. + statement.setInt(2, getObjectId());
111. +
112. + statement.execute();
113. + statement.close();
114. + }
115. + catch (Exception e)
116. + {
117. + _log.fatal("Vote insert info: " + e);
118. + }
119. + finally { try { if (con != null) con.close(); } catch (SQLException e) { e.printStackTrace(); } }
120. + }
121. +
122. +
123. /**
124. * Store recipe book data for this L2PcInstance, if not on an active sub-class.
125. */
126. @@ -7203,7 +7274,8 @@
127. statement.setString(49, getName());
128. statement.setLong(50, getDeathPenaltyBuffLevel());
129. statement.setLong(51, getTrustLevel());
130. - statement.setInt(52, getObjectId());
131. + statement.setInt(52, getVoteCount());
132. + statement.setInt(53, getObjectId());
133. statement.execute();
134. statement.close();
135. }
136. Index: D:/Eclipse/Core Version 1.2.6/src/main/java/com/l2jfree/gameserver/handler/VoicedCommandHandler.java
137. ===================================================================
138. --- D:/Eclipse/Core/com/l2j/gameserver/handler/VoicedCommandHandler.java
139. +++ D:/Eclipse/Core/com/l2j/gameserver/handler/VoicedCommandHandler.java (working copy)
140. @@ -48,6 +48,8 @@
141. registerVoicedCommandHandler(new CastleDoors());
142. registerVoicedCommandHandler(new Hellbound());
143. registerVoicedCommandHandler(new VersionInfo());
144. + registerVoicedCommandHandler(new VoteCount());
145. + registerVoicedCommandHandler(new VoteChange());
146. if (Config.ALLOW_WEDDING)
147. {
148. registerVoicedCommandHandler(new Wedding());

Este acima é para reconhece a nova linha Adicionada no Sql do DataBase

Juntamente com o comando de voto

 

Criar arquivo seguinte a linha:

handler/voicedcommandhandlers/VoteChange.java

 

Logo adicionar:

   1. package com.l2j.gameserver.handler.voicedcommandhandlers;
  2. import com.l2j.gameserver.handler.IVoicedCommandHandler;
  3. import com.l2j.gameserver.model.actor.instance.L2PcInstance;
  4. /**
  5. * @author Rizel
  6. *
  7. */
  8. public class VoteChange implements IVoicedCommandHandler
  9. {
 10. private static final String[] VOICED_COMMANDS =
 11. { "change" };
 12. public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
 13. {
 14. if (command.startsWith("change"))
 15. {
 16. if (activeChar.getVoteCount() == 0)
 17. {
 18. activeChar.sendMessage("You don't have any vote points.");
 19. return true;
 20. }
 21. else
 22. {
 23. activeChar.addItem("Loot", 6393, activeChar.getVoteCount(), activeChar, true);
 24. activeChar.sendMessage("You changed " + activeChar.getVoteCount() + " vote points to Medal!");
 25. activeChar.setVoteCount(0);
 26. return true;
 27. }
 28. }
 29. return false;
 30. }
 31. public String[] getVoicedCommandList()
 32. {
 33. return VOICED_COMMANDS;
 34. }
 35. }

 

E o ultimo arquivo java a ser criado:

handler/voicedcommandhandlers/VoteCount.java

 

   1. package com.l2j.gameserver.handler.voicedcommandhandlers;
  2. import com.l2j.gameserver.handler.IVoicedCommandHandler;
  3. import com.l2j.gameserver.model.actor.instance.L2PcInstance;
  4. /**
  5. * @author Rizel
  6. *
  7. */
  8. public class VoteCount implements IVoicedCommandHandler
  9. {
 10. private static final String[] VOICED_COMMANDS =
 11. { "vote" };
 12. public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
 13. {
 14. if (command.startsWith("vote"))
 15. {
 16. activeChar.sendMessage("Your vote points: " + activeChar.getVoteCount());
 17. return true;
 18. }
 19. return false;
 20. }
 21. public String[] getVoicedCommandList()
 22. {
 23. return VOICED_COMMANDS;
 24. }
 25. }

 

Então porque esta em Desenvolvimento?

Porque precisamos de 3 Arquivos PhP

1 para Reconhecer a Conta

2 para Confirma junto com o database o Ip do voto junto com a conta

3 para reconhecimento da configuração do Database

 

Não so fera em PhP mas estou tentando criar essas paginas com formas avançadas

Caso eu consiga estarei postando para vcs

 

Creditos de Desenvolvimento : Rizel

class L2JBrasil {
   protected function L2JBr() {
if($user->logon = 'FALSE'){
return "Leecher-> ALT+F5";}}}

Link para o comentário
Compartilhar em outros sites


3 Arquivos Fabio

Para que possa reconhecer a conta do Player

E o seu voto mandando tipo um comando para o Server avisando

sobre o voto junto com um bloqueio de sql injection :D

class L2JBrasil {
   protected function L2JBr() {
if($user->logon = 'FALSE'){
return "Leecher-> ALT+F5";}}}

Link para o comentário
Compartilhar em outros sites

  • L2JBr ADM

Como seria feita a checagem do voto?

EJoOSOj.gif

Sua pergunta foi respondida? Certifique-se de marcar a resposta como a solução aceita.
Se existe mais de uma resposta, utilize o "vote up" para destacá-la.
Se você achar uma resposta útil, diga obrigado clicando no botão "Gostei".

Link para o comentário
Compartilhar em outros sites

Diretamente no Ip

Mas pelo que to vendo acho que esse script so seria possivel na HopZone

Sendo os outros Top Sites acho que precisaria da conexao com o db deles

Tambem poderia prover de 1 codigo direcionando para a pessoa Utilizar no Painel

e conferindo a checagem do Ip juntamente com a conta

class L2JBrasil {
   protected function L2JBr() {
if($user->logon = 'FALSE'){
return "Leecher-> ALT+F5";}}}

Link para o comentário
Compartilhar em outros sites

olha esses

vai em vote system do canto esquerdo , coloca o login e senha ,ai ele aparece os dados, e pra votar, quando vc vota, aparece 1 ponto, no painel que vc logar ai, depois troca o ponto por item , mais ou menos assim,

http://www.l2solares.ddns.com.br/Elisios/index.html

 

http://l2blackbird.net/votesite/index.php

Link para o comentário
Compartilhar em outros sites

A partir do momento que você abre o site para interferir em seu banco de dados (diretamente), você está vulnerável a qualquer ataque. Felicidades com seu sistema de votação e cuidado com sql injectors.

Rock'n Roll2, Lineage Gracia Epilogue Server

forum.jpg

Rates: Experiência 8x, Skill Points 8x, Drop 6x, Spoil 8x, Adena 20x.

Sistema custom de drops para aquisição de equipamentos, áreas editadas para farm, sistema de elementos, servidor 100% diversão

Link para o comentário
Compartilhar em outros sites

Rock Roll vc não entendeu?

Eu falei logo nos comentarios que seria necessario sql protection na body do config

E logo os dados são criptografados não haveria problemas com sqstm

class L2JBrasil {
   protected function L2JBr() {
if($user->logon = 'FALSE'){
return "Leecher-> ALT+F5";}}}

Link para o comentário
Compartilhar em outros sites

  • L2JBr ADM

Eu tenho esse sistema da Hopzone aqui... mas mesmo assim.. ele nao funciona legal.. é fácil de burlar... só usar proxy... pessoas com ip dinâmico tbm fodem com tudo.... em fim... nao vale a pena ao meu ver. é prejuizo.

EJoOSOj.gif

Sua pergunta foi respondida? Certifique-se de marcar a resposta como a solução aceita.
Se existe mais de uma resposta, utilize o "vote up" para destacá-la.
Se você achar uma resposta útil, diga obrigado clicando no botão "Gostei".

Link para o comentário
Compartilhar em outros sites

bom, nunca tinha ouvido falar neste mod, mas mano vo tentar fazer ai pra vcs quando tiver tempo...

P7U9a.png

pensecmg.png

 

" Se cada um clicar em curtir, em cada post que eu ajudar, eu serei mais feliz e ajudarei mais pessoas '-'! Então CLICA LOGO!!! "

Cleiton Costa

Link para o comentário
Compartilhar em outros sites

isso ja existe pronto

python,html,php,sql

 

download:

http://sharex.xpg.com.br/files/6137328282/Hopzone_Reward_System.rar.html

account_tiny.gif

svn | timeline

activeMember.sendMessage("Quase tudo é possível quando se tem dedicação e habilidade. Grandes trabalhos são realizados não pela força, mas pela perseverança")

Link para o comentário
Compartilhar em outros sites

mas no fim é a msm coisa

boa sorte.

Editado por Guma

account_tiny.gif

svn | timeline

activeMember.sendMessage("Quase tudo é possível quando se tem dedicação e habilidade. Grandes trabalhos são realizados não pela força, mas pela perseverança")

Link para o comentário
Compartilhar em outros sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Processando...
  • Registre-se

    Faça parte da maior e  mais antigas comunidades sobre Lineage2 da América Latina.





×
×
  • Criar Novo...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.