Jump to content

Question

Posted
there is no prob with consoles....

i want give reward every 5 votes at hopzone and topzone .. can some1 help me? :)

 

 

 

 

 

 

 

package vortextengine;

 

import java.io.BufferedReader;

import java.io.InputStream;

import java.io.InputStreamReader;

import java.net.URL;

import java.net.URLConnection;

 

import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;

import com.l2jfrozen.gameserver.network.clientpackets.Say2;

import com.l2jfrozen.gameserver.network.serverpackets.CreatureSay;

import com.l2jfrozen.gameserver.thread.ThreadPoolManager;

 

import vortextengine.datatables.PlayerTable;

import vortextengine.tasks.HopzoneVoteDelay;

import vortextengine.tasks.MonthlyResetTask;

import vortextengine.tasks.TopzoneVoteDelay;

import vortextengine.tasks.TriesResetTask;

 

import javolution.util.FastList;

 

 

public class VoteMain

{

public static FastList<String> voterList = new FastList<String>();

private static boolean isVoting;

public static int firstvoteshop;

public static int firstvotestop;

public static long lastVoteCheck = 0L;

public static long voteDelay = 43200000L;

 

public VoteMain()

{

}

 

public static void load()

{

System.out.println("Vote Reward System Started Successfully.");

VoteConfig.loadConfigs();

TriesResetTask.getInstance();

MonthlyResetTask.getInstance();

}

 

public static int getHopZoneVotes()

{

int votes = -1;

URL url = null;

URLConnection con = null;

InputStream is = null;

InputStreamReader isr = null;

BufferedReader in = null;

try

{

url = new URL(VoteConfig.VOTE_LINK_HOPZONE);

con = url.openConnection();

con.addRequestProperty("User-Agent", "Mozilla/4.76");

is = con.getInputStream();

isr = new InputStreamReader(is);

in = new BufferedReader(isr);

String inputLine;

while ((inputLine = in.readLine()) != null)

{

if (inputLine.contains("rank anonymous tooltip"))

{

votes = Integer.valueOf(inputLine.split(">")[2].replace("</span", ""));

break;

}

}

}

catch (Exception e)

{

System.out.println("VortexEngine: Server HOPZONE is offline or something is wrong in link.");

}

return votes;

}

 

public static int getTopZoneVotes()

{

int votes = -1;

URL url = null;

URLConnection con = null;

InputStream is = null;

InputStreamReader isr = null;

BufferedReader in = null;

try

{

url = new URL(VoteConfig.VOTE_LINK_TOPZONE);

con = url.openConnection();

con.addRequestProperty("User-Agent", "Mozilla/4.76");

is = con.getInputStream();

isr = new InputStreamReader(is);

in = new BufferedReader(isr);

String inputLine;

while ((inputLine = in.readLine()) != null)

{

if (inputLine.contains("Votes"))

{

String votesLine = inputLine;

 

votes = Integer.valueOf(votesLine.split(">")[3].replace("</div", ""));

break;

}

}

}

catch (Exception e)

{

System.out.println("VortexEngine: Server TOPZONE is offline or something is wrong in link.");

}

 

return votes;

}

 

public static void hopvote(final L2PcInstance player)

{

if (isVoting())

{

player.sendPacket(new CreatureSay(0, Say2.ALLIANCE, "Server", "Someone is already voting.Wait for your turn please!"));

return;

}

 

if (VoteConfig.ENABLE_TRIES)

{

if (PlayerTable.getTries(player) <= 0)

{

player.sendPacket(new CreatureSay(0, Say2.ALLIANCE, "Server", "Due to your multiple failures in voting you lost your chance to vote today"));

return;

}

}

 

setFirstvoteshop(getHopZoneVotes());

PlayerTable.loadLastVoteHopzone(player);

 

if ((getLastVoteCheck() + getVoteDelay()) < System.currentTimeMillis())

{

activateVoting(player, "hopzone");

ThreadPoolManager.getInstance().scheduleGeneral(new HopzoneVoteDelay(player), VoteConfig.SECS_TO_VOTE * 1000);

}

else

{

player.sendPacket(new CreatureSay(0, Say2.ALLIANCE, "Server", "12 hours have to pass till you are able to vote again."));

}

}

 

public static void topvote(final L2PcInstance player)

{

if (isVoting())

{

player.sendPacket(new CreatureSay(0, Say2.ALLIANCE, "Server", "Someone is already voting.Wait for your turn please!"));

return;

}

 

if (VoteConfig.ENABLE_TRIES)

{

if (PlayerTable.getTries(player) <= 0)

{

player.sendPacket(new CreatureSay(0, Say2.ALLIANCE, "Server", "Due to your multiple failures in voting you lost your chance to vote today"));

return;

}

}

 

setFirstvotestop(getTopZoneVotes());

PlayerTable.loadLastVoteTopzone(player);

 

if ((getLastVoteCheck() + getVoteDelay()) < System.currentTimeMillis())

{

activateVoting(player, "topzone");

ThreadPoolManager.getInstance().scheduleGeneral(new TopzoneVoteDelay(player), VoteConfig.SECS_TO_VOTE * 1000);

}

else

{

player.sendPacket(new CreatureSay(0, Say2.ALLIANCE, "Server", "12 hours have to pass till you are able to vote again."));

}

}

 

public static String whosVoting()

{

String voterName = "None";

if (!voterList.isEmpty())

{

voterName = voterList.getFirst();

}

return voterName;

}

 

private static void activateVoting(L2PcInstance player, String banner)

{

setisVoting(true);

player.sendPacket(new CreatureSay(0, Say2.TELL, "Server", "Go fast on the site and vote on the " + banner + " banner!"));

}

 

// Getters and Setters

public static boolean isVoting()

{

return isVoting;

}

 

public static void setisVoting(boolean _isVoting)

{

VoteMain.isVoting = _isVoting;

}

 

public static int getFirstvoteshop()

{

return firstvoteshop;

}

 

public static void setFirstvoteshop(int firstvoteshop)

{

VoteMain.firstvoteshop = firstvoteshop;

}

 

public static int getFirstvotestop()

{

return firstvotestop;

}

 

public static void setFirstvotestop(int firstvotestop)

{

VoteMain.firstvotestop = firstvotestop;

}

 

public static long getLastVoteCheck()

{

return lastVoteCheck;

}

 

public static void setLastVoteCheck(long lastVoteCheck)

{

VoteMain.lastVoteCheck = lastVoteCheck;

}

 

public static long getVoteDelay()

{

return voteDelay;

}

12 answers to this question

Recommended Posts

  • 0
Posted

 

there is no prob with consoles....
i want give reward every 5 votes at hopzone and topzone .. can some1 help me? :)

I guess is on your config....

Take a look there...

  • 0
Posted (edited)

u mean here? :)

 

 

 

I guess is on your config....

Take a look there...

package vortextengine;
 
import java.io.File;
import java.io.FileInputStream;
import java.util.Properties;
 
public class VoteConfig
{
public static boolean ENABLE_TRIES;
public static String VOTE_LINK_HOPZONE;
public static String VOTE_LINK_TOPZONE;
public static int SERVER_ID;
public static int VOTE_REWARD_ID1;
public static int VOTE_REWARD_AMOUNT1;
public static int SECS_TO_VOTE;
public static int EXTRA_REW_VOTE_AM;
 
public static void loadConfigs()
{
try
{
Properties prop = new Properties();
prop.load(new FileInputStream(new File("config/custom/VortexEngine.properties")));
 
ENABLE_TRIES = Boolean.parseBoolean(prop.getProperty("EnableTries", "true"));
VOTE_LINK_HOPZONE = prop.getProperty("HopzoneUrl", "null");
VOTE_LINK_TOPZONE = prop.getProperty("TopzoneUrl", "null");
SERVER_ID = Integer.parseInt(prop.getProperty("ServerId", "1"));
VOTE_REWARD_ID1 = Integer.parseInt(prop.getProperty("VoteRewardId1", "300"));
VOTE_REWARD_AMOUNT1 = Integer.parseInt(prop.getProperty("VoteRewardAmount1", "300"));
SECS_TO_VOTE = Integer.parseInt(prop.getProperty("SecondsToVote", "60"));
EXTRA_REW_VOTE_AM = Integer.parseInt(prop.getProperty("ExtraRewVoteAm", "20"));
}
catch (Exception e)
{
System.out.println("Error while loading Vortex Engine settings!");
}
}
}
Edited by blademarios
  • 0
Posted (edited)

You must to edit this from gameserver files/config
No inside on eclipse..

 

Also, this is the amount of vote. But you have to change it from config of gameserver files.

VOTE_REWARD_AMOUNT1 = Integer.parseInt(prop.getProperty("VoteRewardAmount1", "300"));

 

Go at Workspace/Your server name/gameserver/config and find the vote property.

You had already this code in your pack?

If you put this code, then you have to pass and config.

Edited by 'Baggos'
  • 0
Posted

You must to edit this from gameserver files/config

No inside on eclipse..

 

Also, this is the amount of vote. But you have to change it from config of gameserver files.

VOTE_REWARD_AMOUNT1 = Integer.parseInt(prop.getProperty("VoteRewardAmount1", "300"));

 

Go at Workspace/Your server name/gameserver/config and find the vote property.

You had already this code in your pack?

If you put this code, then you have to pass and config.

 

maybe you can add me one min at skype to help me? xristosmpou@hotmail.com

  • 0
Posted

maybe you can add me one min at skype to help me? xristosmpou@hotmail.com

I can't to give you help for something like this... Because this is not problem.. You just must to understand some things...

It is easy... I'll talk you in greek..

 

[GR]

Τι project χρησιμοποιείς?

Επίσης, ο κώδικας ήταν ήδη στο project σου ή εσύ τον πέρασες?

Αν ήταν ήδη, τότε θα πρέπει να υπάρχει κάποιο config με το όνομα "prob".

Εκεί μέσα θα υπάρχει το "VoteRewardAmount1". Απλά βάλε τα πόσα Votes θες να δίνει...

  • 0
Posted

I can't to give you help for something like this... Because this is not problem.. You just must to understand some things...

It is easy... I'll talk you in greek..

 

[GR]

Τι project χρησιμοποιείς?

Επίσης, ο κώδικας ήταν ήδη στο project σου ή εσύ τον πέρασες?

Αν ήταν ήδη, τότε θα πρέπει να υπάρχει κάποιο config με το όνομα "prob".

Εκεί μέσα θα υπάρχει το "VoteRewardAmount1". Απλά βάλε τα πόσα Votes θες να δίνει...

 

 

ekana oti mou eipes  alla den douleuei :) an mporouses ligo na me kaneis add sto skype na mou deikseis na ma8w kai egw tha sou eixa upoxrewsei :)

  • 0
Posted

ma pos na dulepsi? :O oute to code tou hopzone oute t topzone dn ine sosto pia.. exoun allaksi.

 

dokimase afto

package vortextengine;
 
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
 
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.network.clientpackets.Say2;
import com.l2jfrozen.gameserver.network.serverpackets.CreatureSay;
import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
 
import vortextengine.datatables.PlayerTable;
import vortextengine.tasks.HopzoneVoteDelay;
import vortextengine.tasks.MonthlyResetTask;
import vortextengine.tasks.TopzoneVoteDelay;
import vortextengine.tasks.TriesResetTask;
 
import javolution.util.FastList;
 
 
public class VoteMain
{
public static FastList<String> voterList = new FastList<String>();
private static boolean isVoting;
public static int firstvoteshop;
public static int firstvotestop;
public static long lastVoteCheck = 0L;
public static long voteDelay = 43200000L;
 
public VoteMain()
{
}
 
public static void load()
{
System.out.println("Vote Reward System Started Successfully.");
VoteConfig.loadConfigs();
TriesResetTask.getInstance();
MonthlyResetTask.getInstance();
}
 
public static int getHopZoneVotes()
{
InputStreamReader isr = null;
BufferedReader br = null;

try
{
if(!VoteConfig.VOTE_LINK_HOPZONE.endsWith(".html"))
VoteConfig.VOTE_LINK_HOPZONE+=".html";

URLConnection con = new URL(VoteConfig.VOTE_LINK_HOPZONE).openConnection();


con.addRequestProperty("User-L2Hopzone", "Mozilla/4.76");
isr = new InputStreamReader(con.getInputStream());
br = new BufferedReader(isr);

String line;
while ((line = br.readLine()) != null)
{
if (line.contains("no steal make love")||line.contains("no votes here")||line.contains("bang, you don't have votes")|| line.contains("la vita e bella"))
{
int votes = Integer.valueOf(line.split(">")[2].replace("</span", ""));

return votes;
}
}

br.close();
isr.close();
}
catch (Exception e)
{
System.out.println("[VoteRewardManager]: Problem occured while getting Hopzone votes. Error Trace: " + e.getMessage());
}
return -1;
}
 
public static int getTopZoneVotes()
{
int votes = -1;
URL url = null;
URLConnection con = null;
InputStream is = null;
InputStreamReader isr = null;
BufferedReader in = null;
try
{
url = new URL(VoteConfig.VOTE_LINK_TOPZONE);
con = url.openConnection();
con.addRequestProperty("User-Agent", "L2TopZone");
is = con.getInputStream();
isr = new InputStreamReader(is);
in = new BufferedReader(isr);
String inputLine;
while ((inputLine = in.readLine()) != null)
{
if (inputLine.contains("Votes"))
{
String votesLine = inputLine;
 
votes = Integer.valueOf(votesLine.split(">")[3].replace("</div", ""));
break;
}
}
}
catch (Exception e)
{
System.out.println("VortexEngine: Server TOPZONE is offline or something is wrong in link.");
}
 
return votes;
}
 
public static void hopvote(final L2PcInstance player)
{
if (isVoting())
{
player.sendPacket(new CreatureSay(0, Say2.ALLIANCE, "Server", "Someone is already voting.Wait for your turn please!"));
return;
}
 
if (VoteConfig.ENABLE_TRIES)
{
if (PlayerTable.getTries(player) <= 0)
{
player.sendPacket(new CreatureSay(0, Say2.ALLIANCE, "Server", "Due to your multiple failures in voting you lost your chance to vote today"));
return;
}
}
 
setFirstvoteshop(getHopZoneVotes());
PlayerTable.loadLastVoteHopzone(player);
 
if ((getLastVoteCheck() + getVoteDelay()) < System.currentTimeMillis())
{
activateVoting(player, "hopzone");
ThreadPoolManager.getInstance().scheduleGeneral(new HopzoneVoteDelay(player), VoteConfig.SECS_TO_VOTE * 1000);
}
else
{
player.sendPacket(new CreatureSay(0, Say2.ALLIANCE, "Server", "12 hours have to pass till you are able to vote again."));
}
}
 
public static void topvote(final L2PcInstance player)
{
if (isVoting())
{
player.sendPacket(new CreatureSay(0, Say2.ALLIANCE, "Server", "Someone is already voting.Wait for your turn please!"));
return;
}
 
if (VoteConfig.ENABLE_TRIES)
{
if (PlayerTable.getTries(player) <= 0)
{
player.sendPacket(new CreatureSay(0, Say2.ALLIANCE, "Server", "Due to your multiple failures in voting you lost your chance to vote today"));
return;
}
}
 
setFirstvotestop(getTopZoneVotes());
PlayerTable.loadLastVoteTopzone(player);
 
if ((getLastVoteCheck() + getVoteDelay()) < System.currentTimeMillis())
{
activateVoting(player, "topzone");
ThreadPoolManager.getInstance().scheduleGeneral(new TopzoneVoteDelay(player), VoteConfig.SECS_TO_VOTE * 1000);
}
else
{
player.sendPacket(new CreatureSay(0, Say2.ALLIANCE, "Server", "12 hours have to pass till you are able to vote again."));
}
}
 
public static String whosVoting()
{
String voterName = "None";
if (!voterList.isEmpty())
{
voterName = voterList.getFirst();
}
return voterName;
}
 
private static void activateVoting(L2PcInstance player, String banner)
{
setisVoting(true);
player.sendPacket(new CreatureSay(0, Say2.TELL, "Server", "Go fast on the site and vote on the " + banner + " banner!"));
}
 
// Getters and Setters
public static boolean isVoting()
{
return isVoting;
}
 
public static void setisVoting(boolean _isVoting)
{
VoteMain.isVoting = _isVoting;
}
 
public static int getFirstvoteshop()
{
return firstvoteshop;
}
 
public static void setFirstvoteshop(int firstvoteshop)
{
VoteMain.firstvoteshop = firstvoteshop;
}
 
public static int getFirstvotestop()
{
return firstvotestop;
}
 
public static void setFirstvotestop(int firstvotestop)
{
VoteMain.firstvotestop = firstvotestop;
}
 
public static long getLastVoteCheck()
{
return lastVoteCheck;
}
 
public static void setLastVoteCheck(long lastVoteCheck)
{
VoteMain.lastVoteCheck = lastVoteCheck;
}
 
public static long getVoteDelay()
{
return voteDelay;
}

  • 0
Posted

re c se pio java na to perasw eksigise mou ligo gt eimai new ston xwro :)



package vortextengine;
 
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
 
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.network.clientpackets.Say2;
import com.l2jfrozen.gameserver.network.serverpackets.CreatureSay;
import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
 
import vortextengine.datatables.PlayerTable;
import vortextengine.tasks.HopzoneVoteDelay;
import vortextengine.tasks.MonthlyResetTask;
import vortextengine.tasks.TopzoneVoteDelay;
import vortextengine.tasks.TriesResetTask;
 
import javolution.util.FastList;
 
 
public class VoteMain
{
public static FastList<String> voterList = new FastList<String>();
private static boolean isVoting;
public static int firstvoteshop;
public static int firstvotestop;
public static long lastVoteCheck = 0L;
public static long voteDelay = 43200000L;
 
public VoteMain()
{
}
 
public static void load()
{
System.out.println("Vote Reward System Started Successfully.");
VoteConfig.loadConfigs();
TriesResetTask.getInstance();
MonthlyResetTask.getInstance();
}
 
public static int getHopZoneVotes()
{
InputStreamReader isr = null;
BufferedReader br = null;

try
{
if(!VoteConfig.VOTE_LINK_HOPZONE.endsWith(".html"))
VoteConfig.VOTE_LINK_HOPZONE+=".html";

URLConnection con = new URL(VoteConfig.VOTE_LINK_HOPZONE).openConnection();


con.addRequestProperty("User-L2Hopzone", "Mozilla/4.76");
isr = new InputStreamReader(con.getInputStream());
br = new BufferedReader(isr);

String line;
while ((line = br.readLine()) != null)
{
if (line.contains("no steal make love")||line.contains("no votes here")||line.contains("bang, you don't have votes")|| line.contains("la vita e bella"))
{
int votes = Integer.valueOf(line.split(">")[2].replace("</span", ""));

return votes;
}
}

br.close();
isr.close();
}
catch (Exception e)
{
System.out.println("[VoteRewardManager]: Problem occured while getting Hopzone votes. Error Trace: " + e.getMessage());
}
return -1;
}
 
public static int getTopZoneVotes()
{
int votes = -1;
URL url = null;
URLConnection con = null;
InputStream is = null;
InputStreamReader isr = null;
BufferedReader in = null;
try
{
url = new URL(VoteConfig.VOTE_LINK_TOPZONE);
con = url.openConnection();
con.addRequestProperty("User-Agent", "L2TopZone");
is = con.getInputStream();
isr = new InputStreamReader(is);
in = new BufferedReader(isr);
String inputLine;
while ((inputLine = in.readLine()) != null)
{
if (inputLine.contains("Votes"))
{
String votesLine = inputLine;
 
votes = Integer.valueOf(votesLine.split(">")[3].replace("</div", ""));
break;
}
}
}
catch (Exception e)
{
System.out.println("VortexEngine: Server TOPZONE is offline or something is wrong in link.");
}
 
return votes;
}
 
public static void hopvote(final L2PcInstance player)
{
if (isVoting())
{
player.sendPacket(new CreatureSay(0, Say2.ALLIANCE, "Server", "Someone is already voting.Wait for your turn please!"));
return;
}
 
if (VoteConfig.ENABLE_TRIES)
{
if (PlayerTable.getTries(player) <= 0)
{
player.sendPacket(new CreatureSay(0, Say2.ALLIANCE, "Server", "Due to your multiple failures in voting you lost your chance to vote today"));
return;
}
}
 
setFirstvoteshop(getHopZoneVotes());
PlayerTable.loadLastVoteHopzone(player);
 
if ((getLastVoteCheck() + getVoteDelay()) < System.currentTimeMillis())
{
activateVoting(player, "hopzone");
ThreadPoolManager.getInstance().scheduleGeneral(new HopzoneVoteDelay(player), VoteConfig.SECS_TO_VOTE * 1000);
}
else
{
player.sendPacket(new CreatureSay(0, Say2.ALLIANCE, "Server", "12 hours have to pass till you are able to vote again."));
}
}
 
public static void topvote(final L2PcInstance player)
{
if (isVoting())
{
player.sendPacket(new CreatureSay(0, Say2.ALLIANCE, "Server", "Someone is already voting.Wait for your turn please!"));
return;
}
 
if (VoteConfig.ENABLE_TRIES)
{
if (PlayerTable.getTries(player) <= 0)
{
player.sendPacket(new CreatureSay(0, Say2.ALLIANCE, "Server", "Due to your multiple failures in voting you lost your chance to vote today"));
return;
}
}
 
setFirstvotestop(getTopZoneVotes());
PlayerTable.loadLastVoteTopzone(player);
 
if ((getLastVoteCheck() + getVoteDelay()) < System.currentTimeMillis())
{
activateVoting(player, "topzone");
ThreadPoolManager.getInstance().scheduleGeneral(new TopzoneVoteDelay(player), VoteConfig.SECS_TO_VOTE * 1000);
}
else
{
player.sendPacket(new CreatureSay(0, Say2.ALLIANCE, "Server", "12 hours have to pass till you are able to vote again."));
}
}
 
public static String whosVoting()
{
String voterName = "None";
if (!voterList.isEmpty())
{
voterName = voterList.getFirst();
}
return voterName;
}
 
private static void activateVoting(L2PcInstance player, String banner)
{
setisVoting(true);
player.sendPacket(new CreatureSay(0, Say2.TELL, "Server", "Go fast on the site and vote on the " + banner + " banner!"));
}
 
// Getters and Setters
public static boolean isVoting()
{
return isVoting;
}
 
public static void setisVoting(boolean _isVoting)
{
VoteMain.isVoting = _isVoting;
}
 
public static int getFirstvoteshop()
{
return firstvoteshop;
}
 
public static void setFirstvoteshop(int firstvoteshop)
{
VoteMain.firstvoteshop = firstvoteshop;
}
 
public static int getFirstvotestop()
{
return firstvotestop;
}
 
public static void setFirstvotestop(int firstvotestop)
{
VoteMain.firstvotestop = firstvotestop;
}
 
public static long getLastVoteCheck()
{
return lastVoteCheck;
}
 
public static void setLastVoteCheck(long lastVoteCheck)
{
VoteMain.lastVoteCheck = lastVoteCheck;
}
 
public static long getVoteDelay()
{
return voteDelay;
}

  • 0
Posted

 

re c se pio java na to perasw eksigise mou ligo gt eimai new ston xwro :)

 

package vortextengine;
 
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
 
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.network.clientpackets.Say2;
import com.l2jfrozen.gameserver.network.serverpackets.CreatureSay;
import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
 
import vortextengine.datatables.PlayerTable;
import vortextengine.tasks.HopzoneVoteDelay;
import vortextengine.tasks.MonthlyResetTask;
import vortextengine.tasks.TopzoneVoteDelay;
import vortextengine.tasks.TriesResetTask;
 
import javolution.util.FastList;
 
 
public class VoteMain
{
public static FastList<String> voterList = new FastList<String>();
private static boolean isVoting;
public static int firstvoteshop;
public static int firstvotestop;
public static long lastVoteCheck = 0L;
public static long voteDelay = 43200000L;
 
public VoteMain()
{
}
 
public static void load()
{
System.out.println("Vote Reward System Started Successfully.");
VoteConfig.loadConfigs();
TriesResetTask.getInstance();
MonthlyResetTask.getInstance();
}
 
public static int getHopZoneVotes()
{
InputStreamReader isr = null;
BufferedReader br = null;

try
{
if(!VoteConfig.VOTE_LINK_HOPZONE.endsWith(".html"))
VoteConfig.VOTE_LINK_HOPZONE+=".html";

URLConnection con = new URL(VoteConfig.VOTE_LINK_HOPZONE).openConnection();


con.addRequestProperty("User-L2Hopzone", "Mozilla/4.76");
isr = new InputStreamReader(con.getInputStream());
br = new BufferedReader(isr);

String line;
while ((line = br.readLine()) != null)
{
if (line.contains("no steal make love")||line.contains("no votes here")||line.contains("bang, you don't have votes")|| line.contains("la vita e bella"))
{
int votes = Integer.valueOf(line.split(">")[2].replace("</span", ""));

return votes;
}
}

br.close();
isr.close();
}
catch (Exception e)
{
System.out.println("[VoteRewardManager]: Problem occured while getting Hopzone votes. Error Trace: " + e.getMessage());
}
return -1;
}
 
public static int getTopZoneVotes()
{
int votes = -1;
URL url = null;
URLConnection con = null;
InputStream is = null;
InputStreamReader isr = null;
BufferedReader in = null;
try
{
url = new URL(VoteConfig.VOTE_LINK_TOPZONE);
con = url.openConnection();
con.addRequestProperty("User-Agent", "L2TopZone");
is = con.getInputStream();
isr = new InputStreamReader(is);
in = new BufferedReader(isr);
String inputLine;
while ((inputLine = in.readLine()) != null)
{
if (inputLine.contains("Votes"))
{
String votesLine = inputLine;
 
votes = Integer.valueOf(votesLine.split(">")[3].replace("</div", ""));
break;
}
}
}
catch (Exception e)
{
System.out.println("VortexEngine: Server TOPZONE is offline or something is wrong in link.");
}
 
return votes;
}
 
public static void hopvote(final L2PcInstance player)
{
if (isVoting())
{
player.sendPacket(new CreatureSay(0, Say2.ALLIANCE, "Server", "Someone is already voting.Wait for your turn please!"));
return;
}
 
if (VoteConfig.ENABLE_TRIES)
{
if (PlayerTable.getTries(player) <= 0)
{
player.sendPacket(new CreatureSay(0, Say2.ALLIANCE, "Server", "Due to your multiple failures in voting you lost your chance to vote today"));
return;
}
}
 
setFirstvoteshop(getHopZoneVotes());
PlayerTable.loadLastVoteHopzone(player);
 
if ((getLastVoteCheck() + getVoteDelay()) < System.currentTimeMillis())
{
activateVoting(player, "hopzone");
ThreadPoolManager.getInstance().scheduleGeneral(new HopzoneVoteDelay(player), VoteConfig.SECS_TO_VOTE * 1000);
}
else
{
player.sendPacket(new CreatureSay(0, Say2.ALLIANCE, "Server", "12 hours have to pass till you are able to vote again."));
}
}
 
public static void topvote(final L2PcInstance player)
{
if (isVoting())
{
player.sendPacket(new CreatureSay(0, Say2.ALLIANCE, "Server", "Someone is already voting.Wait for your turn please!"));
return;
}
 
if (VoteConfig.ENABLE_TRIES)
{
if (PlayerTable.getTries(player) <= 0)
{
player.sendPacket(new CreatureSay(0, Say2.ALLIANCE, "Server", "Due to your multiple failures in voting you lost your chance to vote today"));
return;
}
}
 
setFirstvotestop(getTopZoneVotes());
PlayerTable.loadLastVoteTopzone(player);
 
if ((getLastVoteCheck() + getVoteDelay()) < System.currentTimeMillis())
{
activateVoting(player, "topzone");
ThreadPoolManager.getInstance().scheduleGeneral(new TopzoneVoteDelay(player), VoteConfig.SECS_TO_VOTE * 1000);
}
else
{
player.sendPacket(new CreatureSay(0, Say2.ALLIANCE, "Server", "12 hours have to pass till you are able to vote again."));
}
}
 
public static String whosVoting()
{
String voterName = "None";
if (!voterList.isEmpty())
{
voterName = voterList.getFirst();
}
return voterName;
}
 
private static void activateVoting(L2PcInstance player, String banner)
{
setisVoting(true);
player.sendPacket(new CreatureSay(0, Say2.TELL, "Server", "Go fast on the site and vote on the " + banner + " banner!"));
}
 
// Getters and Setters
public static boolean isVoting()
{
return isVoting;
}
 
public static void setisVoting(boolean _isVoting)
{
VoteMain.isVoting = _isVoting;
}
 
public static int getFirstvoteshop()
{
return firstvoteshop;
}
 
public static void setFirstvoteshop(int firstvoteshop)
{
VoteMain.firstvoteshop = firstvoteshop;
}
 
public static int getFirstvotestop()
{
return firstvotestop;
}
 
public static void setFirstvotestop(int firstvotestop)
{
VoteMain.firstvotestop = firstvotestop;
}
 
public static long getLastVoteCheck()
{
return lastVoteCheck;
}
 
public static void setLastVoteCheck(long lastVoteCheck)
{
VoteMain.lastVoteCheck = lastVoteCheck;
}
 
public static long getVoteDelay()
{
return voteDelay;
}

 

ti na s po dn ksero pos ine to code s..

diegrapse to file p mas anevases emas k perase afto

  • 0
Posted

 

re c se pio java na to perasw eksigise mou ligo gt eimai new ston xwro :)

 

Τον κώδικα που ανέβασες εδώ, τον έχεις περάσει? ή απλά θέλεις να τον περάσεις?

Επίσης, μήπως χρησιμοποιείς l2jfrozen? Επειδή έχει ήδη μέσα Vote reward system.

  • 0
Posted

Τον κώδικα που ανέβασες εδώ, τον έχεις περάσει? ή απλά θέλεις να τον περάσεις?

Επίσης, μήπως χρησιμοποιείς l2jfrozen? Επειδή έχει ήδη μέσα Vote reward system.

l2jfrozen einai to pack alla den kserw akrivws pos na to kanw to vote system :)

  • 0
Posted

l2jfrozen einai to pack alla den kserw akrivws pos na to kanw to vote system :)

Πήγαινε gameserver/config/powerpak και άνοιξε με επεξεργασία το powerpak.properties

Εκεί μέσα θα δεις:

 

# Automatic Vote Reward System
VoteRewardSystem= False
VotesRequiredForReward = 50
VotesSystemInitialDelay= 60000
VotesSystemStepDelay= 1800000
VotesRewards= 6392,20;

# Leave empty to disable one site
#
# Hopzone: http://l2.hopzone.net
VotesSiteHopZoneUrl =
# Topzone: http://l2topzone.com
VotesSiteTopZoneUrl =
# L2Network: http://l2network.eu
VotesSiteL2NetworkUrl =
# Put your website url
ServerWebSite = http://www.l2jfrozen.com

Και αρχίζεις,

VoteRewardSystem= False το κάνεις True

VotesRequiredForReward = 50 βάζεις στα πόσα votes θες να δίνει reward

VotesRewards= 6392,20; το id από το item που θες στην θέση του 6392 και το πόσα τέτοια να πετάει στη θέση του 20

 

# Hopzone: http://l2.hopzone.net

VotesSiteHopZoneUrl = το link σου από το hopzone

# Topzone: http://l2topzone.com

VotesSiteTopZoneUrl = το link σου από το topzone

# L2Network: http://l2network.eu

VotesSiteL2NetworkUrl = το link σου από το l2network

 

ServerWebSite = http://www.l2jfrozen.comεδώ βάζεις το link της σελίδας σου.

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.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  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.

×
×
  • Create New...