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 της σελίδας σου.

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


  • Posts

    • ⚡ Fast order delivery is active 24/7! Upgrade your personal Gmail to Gemini Pro with full 2TB storage and premium Google One features today.
    • Update M54: Global HP/MP/CP consumable handling expanded beyond combat-only usage. Offensive mage idle recovery with learned skill Battle Heal. Spellhowler/Storm Screamer prioritizes Hurricane, using Vampiric Claw mostly below 90% HP. Major structural refactor initialized: Added category/class organization such as Archer, Dagger, Tank, Mage, Healer, Support and Specialized class files. Further structural cleanup. Extracted combat memory/state and more class-policy logic from the main controller. Added global stuck/inactivity watchdog for bots blocked by terrain/geodata. Added unreachable dropped ground-item timeout/temporary blacklist. Reworked Necromancer/Soultaker PvP: Dominator level 78+ maintains learned Arcane Power toggle on. Overlord/Dominator level 44+ maintains learned Soul Guard toggle automatically. Stability/scalability update: Bot controller ticks staggered instead of all starting in the same phase: Same 350 ms update rate retained Reduces simultaneous AI workload bursts. Removed the old manual aggressive-monster EVT_AGGRESSION bridge. Phantoms now use native Lucera setActive() behavior so monsters aggro them naturally. Reduced unnecessary NPC scans and native AI event pressure. Added saved-bot equipment overrides using a separate database table:         lucera_autobots_items Existing lucera_autobots remains the main saved-bot identity/state table. Equipment rows are linked to saved bots through bot_id. Added optional convenience view to show bot name together with equipment overrides:         lucera_autobots_items_view Added editable equipment slots in columns: Weapon Shield Helmet Chest Legs Gloves Boots Necklace Left/Right Earrings Left/Right Rings Equipment override values: 0 = use normal class/level profile item -1 = force slot empty >0 = equip that Item ID Custom equipment works only for saved database bots. Default class/level equipment profiles remain unchanged. Supports custom equipment from No Grade to S Grade, regardless of the bot's current level. Added validation for invalid item IDs and incompatible equipment slots. Added handling for: Two-handed weapons vs shields Full-body armor vs separate leggings Added all-grade Soulshots and Spiritshots to bot inventory/replenishment so custom lower-grade weapons still use the correct shots. Mage profiles that already use Blessed Spiritshots keep that behavior with all relevant grades available. First save the bot normally so it exists in table:         lucera_autobots Then open:         lucera_autobots_items Find the row with the same bot_id and edit only the equipment slots you want. Example: weapon_id = 6608 shield_id = -1 helmet_id = 0 chest_id = 0 legs_id = 0 gloves_id = 0 boots_id = 0 This means: weapon_id 6608 → custom weapon shield_id -1 → no shield all 0 values → keep normal default profile equipment After editing the DB, despawn and respawn the saved bot so M54 reloads its equipment overrides. Do not edit bot_id. Use it only to identify which saved bot the equipment row belongs to.   DOWNLOAD
    • It will be multi client so it will detect the client from the files and adapt the packets and asset loading. I am aiming for C4 and H5 after IL
    • this is just to simplify your life, time, and can be done for free by yourself just watch some tutorials, in case you don't wanna waste time check it out!   https://l2getwork.art   https://l2getwork.art/showcase.html  
    • Good job! Any chance for it to be downgradeable or at least compatible with older chronicles?
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and 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..