Jump to content
  • 0

[Request] Daily status, please all good devs come here!


NumL0ck

Question

Hello MXC!

Who can make java code for interlude, then you wrote .getstats to you show

Today [PVP] : 0 [Deaths] : 0 [PK] : 0

and...

Cancel Skill after x time you receive back your loosing buffs.

Big big thanks!!! Big big thanks!!! Big big thanks!!! Big big thanks!!!

Link to comment
Share on other sites

Recommended Posts

  • 0

lets make pvp points first.

replace setDayPvp(getDayPvp() + 1); with addDayPvp();

and now create new method in L2PcInstance at the end:

private void addDayPvp()

{

//inside this method we will increase number in database. Find an example of code that is using INSERT INTO statement and send it here

}

Link to comment
Share on other sites

  • 0

lets make pvp points first.

replace setDayPvp(getDayPvp() + 1); with addDayPvp();

and now create new method in L2PcInstance at the end:

private void addDayPvp()

{

//inside this method we will increase number in database. Find an example of code that is using INSERT INTO statement and send it here

}

Link to comment
Share on other sites

  • 0

sorry, i wasnt at the code clear enough, delete this lines:

+        if(isPvpMaster())
+        masterkills++;
+        
+        switch(masterkills){
+        	case 4:
+        		getStatus().setCurrentCp(getMaxCp());
+        		getStatus().setCurrentHp(getMaxHp());
+        		getStatus().setCurrentMp(getMaxMp());
+        		sendMessage("You rewarded with full hp,cp,mp cause of your pvp master's ability");
+        		masterkills = 0;
+        		break;
+        		default:
+        			;
+        }

u dont need them, also delete this from your command:

public void DayPvpandPk(L2PcInstance l2pcinstance)
              {
            	  try
            	  {
            		  Connection connection = L2DatabaseFactory.getInstance().getConnection();
            		  PreparedStatement preparedstatement = connection.prepareStatement("SELECT todaypvps,char_name FROM characters WHERE accesslevel=? ORDER BY todaypvps DESC LIMIT 1");
            		  preparedstatement = connection.setInt(1, 0);
            		  ResultSet resultset = preparedstatement.executeQuery();
  					
  					if (rSet.next())
  					{
  						newPvpLord = rSet.getString("char_name");
  						topTodayPvps = rSet.getInt("todaypvps");
  					}
  					
  					rSet.close();
  					stm.close();
  					

            	  }
            	  catch(SQLException sqlexception)
            	  {
            	          
            	  }
              }

replace DayPvp() with activeChar.getDayPvp() and tell me about the results :)

Link to comment
Share on other sites

  • 0

package com.l2jfrozen.gameserver.handler.voicedcommandhandlers;
    
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Calendar;

import com.l2jfrozen.util.database.L2DatabaseFactory;
import com.l2jfrozen.gameserver.model.entity.Announcements;
import com.l2jfrozen.gameserver.templates.StatsSet;
import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
import com.l2jfrozen.gameserver.model.L2World;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler;
import com.l2jfrozen.gameserver.network.serverpackets.CreatureSay;
import com.l2jfrozen.gameserver.network.clientpackets.Say2;

/**
* Allow player to enable or disable Experience and SP Gain.
*/

           public class getstatus implements IVoicedCommandHandler

                {

              private static final String[] VOICED_COMMANDS =

              {
                      "getstatus"
              };

       

              public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params)

              {
            	  
                  if (command.equalsIgnoreCase("getstatus"))
                  {
                	  DayPvpandPk(activeChar);
                   }
    return true;
}              
              public void DayPvpandPk(L2PcInstance l2pcinstance)
              {
          		int DayPvp = 0;
          		int DayPk = 0;
        		Connection con = null;
        		PreparedStatement state = null;
        		ResultSet rset = null;
            	  try
            	  {
          			con = L2DatabaseFactory.getInstance().getConnection();
        			state = con.prepareStatement("SELECT daypvp,daypk FROM characters WHERE charId=?");
        			rset = state.executeQuery();
        			if(rset.next())
        			{
        			DayPvp = rset.getInt("daypvp");
        			DayPk = rset.getInt("daypvp");
        			}
        			
        			state.close();
        			rset.close();
        			
        			for(L2PcInstance p : L2World.getInstance().getAllPlayers()){
        				{
        					p.broadcastUserInfo();
        					
        					p.sendMessage("Today PvPs: "+DayPvp);
        					p.sendMessage("Today PKs: "+DayPk);
        				}
        			}
            	  }
        					catch (Exception e)
        					{ }
        					finally
        					{
        					try
        					{
        					con.close();
        					}
        					catch (Exception e)
        					{ }
        					}
        					}
              public String[] getVoicedCommandList()

              {

                      return VOICED_COMMANDS;

              }

      }

i maked this, no errors, but DON'T working... and your example don't working...

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.



×
×
  • Create New...