Jump to content

Recommended Posts

Posted (edited)
Hello mate you do not have to buy it there is a working version of that shared here http://www.maxcheaters.com/topic/188957-vote-manager-npc/
i translate that for you and is realy simple to add it ..
 
we start::
head-src\com\l2jfrozen\gameserver\model\actor\instance\L2PcInstance.java
 
search
private static final String RESTORE_CHARACTER = 
and in the end ofcode we find (  aio,aio_end, )
 and we add
lastVoteHopzone, lastVoteTopzone, hasVotedHop, hasVotedTop, monthVotes, totalVotes, tries
then search
private long _lastTeleportAction = 0;
and down from there we put
private boolean _isVoting = false;


public final boolean isVoting()
{
return _isVoting;
}


public final void setIsVoting(boolean value)
{
_isVoting = value;
}
 private boolean hasVotedTop,hasVotedHop;




public boolean hasVotedBoth()


   {
       return hasVotedHop && hasVotedTop;
   }
   public void setHop(boolean target)
   {
       hasVotedHop=target;
   }
   public void setTop(boolean target)
   {
       hasVotedTop=target;
   }


private void loadVotes()
   {
       int flag=0;
       try (Connection con = L2DatabaseFactory.getInstance().getConnection())
       {
           PreparedStatement statement = con.prepareStatement("SELECT hasVotedTop FROM characters WHERE obj_Id=?");
           statement.setInt(1, getObjectId());
           ResultSet rset = statement.executeQuery();
           while (rset.next())
           {
               flag = rset.getInt("hasVotedTop");
           }
           if (flag == 1)
           {
               setTop(true);
           }
           else
           {
               setTop(false);
           }
       }
       catch (Exception e)
       {
          
           if (Config.DEVELOPER)
           {
               e.printStackTrace();
           }
       }
       flag=0;
       try (Connection con = L2DatabaseFactory.getInstance().getConnection())
       {
           PreparedStatement statement = con.prepareStatement("SELECT hasVotedHop FROM characters WHERE obj_Id=?");
           statement.setInt(1, getObjectId());
           ResultSet rset = statement.executeQuery();
           while (rset.next())
           {
               flag = rset.getInt("hasVotedHop");
           }
           if (flag == 1)
           {
               setHop(true);
           }
           else
           {
               setHop(false);
           }
       }
       catch (Exception e)
       {
          
           if (Config.DEVELOPER)
           {
               e.printStackTrace();
           }
       }
   }
then search
startWarnUserTakeBreak();
and we put down there:
loadVotes();
then we go on  head-src\com\l2jfrozen\Config.java
and search
public static int HERO_CUSTOM_DAY;
and we put down there 
public static String VOTE_LINK_HOPZONE;
public static String VOTE_LINK_TOPZONE;
public static int VOTE_REWARD_ID1;
public static int VOTE_REWARD_ID2;
public static int VOTE_REWARD_ID3;
public static int VOTE_REWARD_ID4;
public static int VOTE_REWARD_AMOUNT1;
public static int VOTE_REWARD_AMOUNT2;
public static int VOTE_REWARD_AMOUNT3;
public static int VOTE_REWARD_AMOUNT4;
public static int SECS_TO_VOTE;
public static int EXTRA_REW_VOTE_AM;

then we search for

HERO_CUSTOM_DAY = Integer.parseInt(L2JFrozenSettings.getProperty("HeroCustomDay", "0"));
and we put down there:
VOTE_LINK_HOPZONE = L2JFrozenSettings.getProperty("HopzoneUrl", "null");
VOTE_LINK_TOPZONE = L2JFrozenSettings.getProperty("TopzoneUrl", "null");
VOTE_REWARD_ID1 = Integer.parseInt(L2JFrozenSettings.getProperty("VoteRewardId1", "300"));
VOTE_REWARD_ID2 = Integer.parseInt(L2JFrozenSettings.getProperty("VoteRewardId2", "300"));
VOTE_REWARD_ID3 = Integer.parseInt(L2JFrozenSettings.getProperty("VoteRewardId3", "300"));
VOTE_REWARD_ID4 = Integer.parseInt(L2JFrozenSettings.getProperty("VoteRewardId4", "300"));
VOTE_REWARD_AMOUNT1 = Integer.parseInt(L2JFrozenSettings.getProperty("VoteRewardAmount1", "300"));
VOTE_REWARD_AMOUNT2 = Integer.parseInt(L2JFrozenSettings.getProperty("VoteRewardAmount2", "300"));
VOTE_REWARD_AMOUNT3 = Integer.parseInt(L2JFrozenSettings.getProperty("VoteRewardAmount3", "300"));
VOTE_REWARD_AMOUNT4 = Integer.parseInt(L2JFrozenSettings.getProperty("VoteRewardAmount4", "300"));
SECS_TO_VOTE = Integer.parseInt(L2JFrozenSettings.getProperty("SecondsToVote", "20"));
EXTRA_REW_VOTE_AM = Integer.parseInt(L2JFrozenSettings.getProperty("ExtraRewVoteAm", "20"));
then go  head-src\com\l2jfrozen\gameserver\GameServer.java
 
and find
 // Load GameServer Configs
        Config.load();
and we put down there:
VoteManager.load();
then go to gameserver\config\functions\l2jfrozen.properties
and we put everywhere we want 
# ------------------------------
# Vote System Ingame  -
# ------------------------------
HopzoneUrl = 
TopzoneUrl = 


# The characters will have a choice between 3 rewards.Set id for them
VoteRewardId1 = 6392
VoteRewardId2 = 6393
VoteRewardId3 = 4357


# Set the amount of each reward.
VoteRewardAmount1 = 1
VoteRewardAmount2 = 1
VoteRewardAmount3 = 30


# Set the seconds that the character has
# until he votes in the site's banners
SecondsToVote = 45


# Amount of votes a character must collect
# in order to get the 4th vote reward
ExtraRewVoteAm = 20


# Info of the extra reward item
VoteRewardId4 = 6673
VoteRewardAmount4 = 1

then we go to navicat and left click on Characters and we click on Design table

and we add
 
lastVoteHopzone bigint 20 0


lastVoteTopzone bigint 20 0


hasVotedHop int 10 0


hasVotedTop int 10 0


monthVotes int 10 0


totalVotes int 10 0


tries int 10 0
 
and now we must create a new npc and  (type)       L2VoteManager
Edited by L2LostWard

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock