Jump to content
  • 0

Vote Reward Help Please


Question

Posted

 

 private void mainHtml(L2PcInstance activeChar)

  {
 
   generateLogo(activeChar, 11888);
   generateLogo(activeChar, 65531);
   generateLogo(activeChar, 65532);
   generateLogo(activeChar, 65533);
   NpcHtmlMessage nhm = new NpcHtmlMessage(5);
   TextBuilder tb = new TextBuilder("");
   
       tb.append("<html><head><title>Vote reward Panel</title></head><body>");
       tb.append("<center>");
       tb.append("<table width=\"250\" cellpadding=\"5\" bgcolor=\"000000\">");
       tb.append("<tr>");
       tb.append("<td width=\"45\" valign=\"top\" align=\"center\"><img src=\"L2ui_ch3.menubutton4\" width=\"38\" height=\"38\"></td>");
       tb.append("<td valign=\"top\"><font color=\"FF6600\">Vote Panel</font>");  
       tb.append("<br1><font color=\"00FF00\">"+activeChar.getName()+"</font>, use this menu to Vote for our server.<br1></td>");
       tb.append("</tr>");
       tb.append("</table>");
       tb.append("</center>");
       if(!hasVotedTop(activeChar))
       {
       tb.append("<table width=\"250\" cellpadding=\"5\" bgcolor=\"000000\">");
       tb.append("<tr>");
       tb.append("<td width=\"45\" valign=\"top\" align=\"center\"><button action=\"bypass -h npc_" + getObjectId() + "_votehopzone\" width=256 height=64 back=\"Crest.crest_" + Config.SERVER_ID + "_" + 1821 + "\" fore=\"Crest.crest_" + Config.SERVER_ID + "_" + 1821 + "\"></td>");
       tb.append("</tr>");
       tb.append("</table>");
       tb.append("<table width=\"250\" cellpadding=\"5\" bgcolor=\"000000\">");
       tb.append("<tr>");
       tb.append("<td width=\"45\" valign=\"top\" align=\"center\"><button action=\"bypass -h npc_" + getObjectId() + "_votetopzone\" width=256 height=64 back=\"Crest.crest_" + Config.SERVER_ID + "_" + 11888 + "\" fore=\"Crest.crest_" + Config.SERVER_ID + "_" + 11888 + "\"></td>");
       tb.append("</tr>");
       tb.append("</table>");
       }
       if(!hasVotedTop(activeChar))
       {
       tb.append("<table width=\"250\" cellpadding=\"5\" bgcolor=\"FFFFFF\">");
       tb.append("<tr>");
       tb.append("<td width=\"45\" valign=\"top\" align=\"center\"><button action=\"bypass -h npc_" + getObjectId() + "_rewards\" width=256 height=64 back=\"Crest.crest_" + Config.SERVER_ID + "_" + 65531 + "\" fore=\"Crest.crest_" + Config.SERVER_ID + "_" + 65531 + "\"></td>");
       tb.append("</tr>");
       tb.append("</table>");
       }
       tb.append("<center><table width=\"250\" cellpadding=\"5\" bgcolor=\"000000\">");
       if(!hasVotedHop(activeChar))
        tb.append("<tr><td width=\"45\" valign=\"top\" align=\"center\"><font color=\"FF6600\">Hopzone Status: </font><img src=\"Crest.crest_" + Config.SERVER_ID + "_" + 65533 + "\" width=32 height=32>");
       if(hasVotedHop(activeChar))
        tb.append("<tr><td width=\"45\" valign=\"top\" align=\"center\"><font color=\"FF6600\">Hopzone Status: </font><img src=\"Crest.crest_" + Config.SERVER_ID + "_" + 65532 + "\" width=32 height=32>");
       if(!hasVotedTop(activeChar))
        tb.append("<br1><font color=\"FF6600\">Topzone Status: </font><img src=\"Crest.crest_" + Config.SERVER_ID + "_" + 65533 + "\" width=32 height=32></td></tr>");
       if(hasVotedTop(activeChar))
        tb.append("<br1><font color=\"FF6600\">Topzone Status: </font><img src=\"Crest.crest_" + Config.SERVER_ID + "_" + 65532 + "\" width=32 height=32></td></tr>");
       tb.append("</table></center>");
       tb.append("</body></html>");
 
 
   nhm.setHtml(tb.toString());
   activeChar.sendPacket(nhm);
  }
 
protected int getTopZoneVotes()
{
int votes = -1;
URL url = null;
URLConnection con = null;
InputStream is = null;
InputStreamReader isr = null;
BufferedReader in = null;
try
{
url = new URL(Config.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)
{
_log.info("[AutoVoteReward] Server TOPZONE is offline or something is wrong in link");
//e.printStackTrace();
}
finally
{
if(in!=null)
try
{
in.close();
}
catch(IOException e1)
{
e1.printStackTrace();
}
if(isr!=null)
try
{
isr.close();
}
catch(IOException e1)
{
e1.printStackTrace();
}
if(is!=null)
try
{
is.close();
}
catch(IOException e1)
{
e1.printStackTrace();
}
}
return votes;
}
  
  private void generateLogo(L2PcInstance activeChar,int imgId)
  {
      try
      {
     if(imgId == 11888)
     {
              File captcha = new File("data/images/topzone.png");    
              PledgeCrest packet = new PledgeCrest(imgId, DDSConverter.convertToDDS(captcha).array());
              activeChar.sendPacket(packet);
     }
   
     if(imgId == 65531)
     {
              File captcha = new File("data/images/rewards.png");    
              PledgeCrest packet = new PledgeCrest(imgId, DDSConverter.convertToDDS(captcha).array());
              activeChar.sendPacket(packet);
     }
   
     if(imgId == 65532)
     {
              File captcha = new File("data/images/check.png");    
              PledgeCrest packet = new PledgeCrest(imgId, DDSConverter.convertToDDS(captcha).array());
              activeChar.sendPacket(packet);
     }
   
     if(imgId == 65533)
     {
              File captcha = new File("data/images/noncheck.png");    
              PledgeCrest packet = new PledgeCrest(imgId, DDSConverter.convertToDDS(captcha).array());
              activeChar.sendPacket(packet);
     }
      }
      catch (Exception e)
      {}
  }
  
     
 
}

 

please who can help me i add only l2topzone Image!!

1 answer to this question

Recommended Posts

  • 0
Posted (edited)

Can you SPAM elsewhere ? My inbox was clear until you sent me this kind of crap.

 

Also...

 

Wrong Section !!

Edited by Sighed

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