Jump to content

B1ggBoss

Legendary Member
  • Posts

    494
  • Credits

  • Joined

  • Last visited

  • Days Won

    1
  • Feedback

    0%

Posts posted by B1ggBoss

  1. every time I give one pj subtract and when I think a new

     

    did not understand that, but error is caused by a non setted parameter for the sql query in the character database storage. Probably, you are using a edited pack, from any unknown fork or smth. Main l2j and forks wont have this error.

  2. Index: data/scripts/handlers/bypasshandlers/OlympiadManagerLink.java
    ===================================================================
    --- data/scripts/handlers/bypasshandlers/OlympiadManagerLink.java	(revision 8230)
    +++ data/scripts/handlers/bypasshandlers/OlympiadManagerLink.java	(working copy)
    @@ -124,10 +124,16 @@
    						activeChar.sendPacket(html);
    						break;
    					case 4:
    -						OlympiadManager.getInstance().registerNoble(activeChar, CompetitionType.NON_CLASSED);
    +						if(activeChar.getPvpKills() >= 100)
    +							OlympiadManager.getInstance().registerNoble(activeChar, CompetitionType.NON_CLASSED);
    +						else
    +							activeChar.sendMessage("You need "+(100 - activeChar.getPvpKills())+" Pvp's to register in Olympiad");
    						break;
    					case 5:
    -						OlympiadManager.getInstance().registerNoble(activeChar, CompetitionType.CLASSED);
    +						if(activeChar.getPvpKills() >= 100)
    +							OlympiadManager.getInstance().registerNoble(activeChar, CompetitionType.CLASSED);
    +						else
    +							activeChar.sendMessage("You need "+(100 - activeChar.getPvpKills())+" Pvp's to register in Olympiad");
    						break;
    					case 6:
    						passes = Olympiad.getInstance().getNoblessePasses(activeChar, false);
    @@ -174,7 +180,10 @@
    						}
    						break;
    					case 11:
    -						OlympiadManager.getInstance().registerNoble(activeChar, CompetitionType.TEAMS);
    +						if(activeChar.getPvpKills() >= 100)
    +							OlympiadManager.getInstance().registerNoble(activeChar, CompetitionType.TEAMS);
    +						else
    +							activeChar.sendMessage("You need "+(100 - activeChar.getPvpKills())+" Pvp's to register in Olympiad");
    						break;
    					default:
    						_log.warning("Olympiad System: Couldnt send packet for request " + val);
    

  3. import javolution.util.FastMap;
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import com.l2jserver.L2DatabaseFactory;
    
    public final class LastIPTable
    {
    public static FastMap<String, String> cachedLastIPs = new FastMap<String, String>();
    
    static 
    {
    	Connection con = null;
    	try
    	{
    		con = L2DatabaseFactory.getInstance().getConnection();
    		PreparedStatement st = con.prepareStatement("SELECT login, lastIP FROM accounts");
    		ResultSet rset = st.executeQuery();
    		while(rset.next())
    		{
    			cachedLastIPs.put(rset.getString("login"), rset.getString("lastIP"));
    		}
    		rset.close();
    		st.close();
    	}
    	catch(Exception e)
    	{
    		e.printStackTrace();
    	}
    	finally
    	{
    		L2DatabaseFactory.close(con);
    	}
    }
    
    public static String getLastIP(final String account)
    {
    	return cachedLastIPs.get(account);
    }
    
    // Should be called on player's log out
    public static void updateLastIP(final String account, final String lastIp)
    {
    	cachedLastIPs.put(account, lastIP);
    }
    }
    

  4. 1) Question

     

    class ShopBuffer extends Quest
    {
    private static final String qn = "ShopBuffer";
    private static final int COST_ID = 0;
    private static final int COST_AMOUNT = 0;
    
    private FastList<L2Skill> _npcBuffs = new FastList<L2Skill>();
    
    public ShopBuffer(int questId, String name, String descr)
    {	
    	super(questId, name, descr);
    	// Buff loading, manual put, from db, whatever...
    }
    
    @Override
    public String onFirstTalk(L2Npc npc, L2PcInstance player)
    {
    	String content = getBuyHtml(npc.getObjectId());
    	NpcHtmlMessage msg = new NpcHtmlMesage(npc.getObjectId());
    	msg.setText(content);
    	player.sendPakcet(content);
    	updateMPStatus(player);
    	return null;
    }
    
    
    private String getBuyHtml(final int objectId)
    {
    	StringBuilder sb = new StringBuilder();
    	sb.append("<html><title>Shop Buffer</title><body><br> +
    		"Welcome to the Shop buffer. Click on the buffs you wanna get!<br><br>");
    
    	for(L2Skill sk : _npcBuffs)
    	{
    		final int id = sk.getId();
    		String iconSkill = id > 1000? "icon.skill"+id : "icon.skill0"+id;
    		sb.append("<a action=\"bypass -h Quest ShopBuffer addBuffToQueue_"+id+"\"><img src=\""+iconSkill+"\"> width=32 height=32></a>
    	}
    
    	sb.append("<br><br>");
    	sb.append("Your selected buffs:<br>");
    
    	List<L2Skill> playerBuffQueue = player.getBuffQueue(); 	// This should be created in pcisntance or another store class and will containt the
    								// buffs that player has choosen, cleared once he has buff himself
    
    	if(playerBuffQueue.size() > 0)
    	{
    		for(L2Skill sk : playerBuffQueue)	
    		{
    			final int id = sk.getId();
    			String iconSkill = id > 1000? "icon.skill"+id : "icon.skill0"+id;
    			sb.append("<img src=\""+iconSkill+"\" width=32 height=32>
    		}
    	}
    
    	sb.append("</body></html>
    	return sb.toString();
    }
    
    public double getConsumedMp(FastList<L2Skill> queue)
    {
    	double result = 0;
    	for(L2Skill sk : queue)
    	{
    		result += sk.getMpConsume();
    	}
    	return result;
    
    private void updateMPStatus(L2PcInstance player)
    {
    	double consume = getConsumeMp(player);
    	ExDuelUpdateUserInfo eduui = new ExDuelUpdateUserInfo(player, consume);
    	player.sendPacket(eduui); 
    }
    
    public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
    {
    	if(event.startsWith("addBuffToQueue"))
    	{
    		String[] split = event.split("_");
    		if(split < 2)
    			return null;
    
    		int skillId = 0;
    		try { skillId = Integer.parseInt(split[1]); } catch(Exception e) { e.printStackTrace(); }
    		if(skillId > 0)
    		{
    			L2Skill choosen = null;
    			for(L2Skill sk : _npcBuffs)
    				if(sk.getId() == skillId)
    				{
    					choosen = sk;
    					break;
    				}
    			if(choosen != null)
    			{
    				if(getConsumeMp(player.getBuffQueue) + choosen.getConsumeMp() > player.getMp())
    					player.sendMessage("You dont have enough mana to use this skills!");
    				else
    				{
    					player.addSkillToQueue(choosen);
    					updateMpStatus(player);
    				}
    			}
    	}
    	else if(event.equals("buffMe"))
    	{
    		if(player.getBuffQueue().size() > 0)
    		{
    			if(getConsumeMp(player.getBuffQueue) > player.getMp())
    				player.sendMessage("You dont have enough mana to buff yourself!");
    			else if(player.destroyItem("Shop Buffer", COST_ID, COST_AMOUNT, npc, true))
    			{
    				for(L2Skil sk : player.getBuffQueue())
    					sk.getEffects(player, player);
    				player.clearBuffQueue();
    				updateMPStatus(player);
    			}
    		}
    	}
    }
    }
    

     

    You will need to modify a little ExDuelUpdateUserInfo to build a constructor to pass a custom mp var.

    Also, the script it self wont be working, is written using notepad, so it miss imports and im prolly will have any syntax error

  5. yea? never watched it because i never searched for something like this :P , but tell him the "way" to do it.

     

    EDIT:TRY THIS:

    if (getNpcId() == 3234)
    	{
    		if (activeChar.getPvpFlag() > 0 )
                          {
                             activeChar.sendMessage("You can't by pass in this npc while you are in flag");
                             return;
                          } 
    	}
    
    
    

     

    try this on your onbypassfeedback method of your instance of your npc.

     

    he is talking about a jython-quest script, prolly the bypass for heal will be the way of "Quest 9999_Buffer_heal etc..", that means that the onBypassfeedback method from the npc instance isnt called

     

    jython isnt hard, just find the command

     

    if st.getPlayer().getPvpFlag() > 0:
    st.getPlayer().sendMessage("Cannot heal while flagged!");
    else:
    #Restore cp/hp/mp code...
    

×
×
  • Create New...