Jump to content

Recommended Posts

Posted

kalispera  mxc  !!  iparxi tropos  px na balis ola ta guard  siege  px  na dilonis gia siege  px olla ta npc  nane giran ??

apo java
Posted

πήγαινε εδώ: net.sf.l2j.gameserver.model.actor.instance;

 

κάνε ένα καινούργιο αρχείο με όνομα: L2SiegeInformerInstance.java

 

και βάλε μέσα τον παρακάτω κώδικα:

 

/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
* 
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
* 
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.sf.l2j.gameserver.model.actor.instance;

import net.sf.l2j.gameserver.ai.CtrlIntention;
import net.sf.l2j.gameserver.instancemanager.CastleManager;
import net.sf.l2j.gameserver.model.actor.L2Npc;
import net.sf.l2j.gameserver.model.entity.Castle;
import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
import net.sf.l2j.gameserver.network.serverpackets.MyTargetSelected;
import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
import net.sf.l2j.gameserver.network.serverpackets.SiegeInfo;
import net.sf.l2j.gameserver.network.serverpackets.SocialAction;
import net.sf.l2j.gameserver.network.serverpackets.ValidateLocation;
import net.sf.l2j.gameserver.templates.chars.L2NpcTemplate;
import net.sf.l2j.util.Rnd;

/**
* @author Debian
*
*/
public class L2SiegeInformerInstance extends L2Npc
{
        public L2SiegeInformerInstance(int objectId, L2NpcTemplate template)
        {
                super(objectId, template);
        }
        
        @Override
        public void onBypassFeedback(L2PcInstance activeChar, String command)
        {
                if (activeChar == null)
                {
                        return;
                }
                
                if (command.startsWith("giran")){
                        Castle castle = CastleManager.getInstance().getCastleById(3);
                        if (castle != null)
                                activeChar.sendPacket(new SiegeInfo(castle));}
                
                if (command.startsWith("aden")){
                        Castle castle = CastleManager.getInstance().getCastleById(5);
                        if (castle != null)
                                activeChar.sendPacket(new SiegeInfo(castle));}
                
                if (command.startsWith("goddard")){
                        Castle castle = CastleManager.getInstance().getCastleById(7);
                        if (castle != null)
                                activeChar.sendPacket(new SiegeInfo(castle));}
                
                if (command.startsWith("gludio")){
                        Castle castle = CastleManager.getInstance().getCastleById(1);
                        if (castle != null)
                                activeChar.sendPacket(new SiegeInfo(castle));}
        }
        
        @Override
        public void onAction(L2PcInstance activeChar)
        {
                if (this != activeChar.getTarget())
                {
                        activeChar.setTarget(this);
                        activeChar.sendPacket(new MyTargetSelected(getObjectId(), activeChar.getLevel() - getLevel()));
                        activeChar.sendPacket(new ValidateLocation(this));
                }
                else if (isInsideRadius(activeChar, INTERACTION_DISTANCE, false, false))
                {
                        SocialAction sa = new SocialAction(this, Rnd.get(8));
                        broadcastPacket(sa);
                        activeChar.setCurrentFolkNPC(this);
                        showHtmlWindow(activeChar);
                        activeChar.sendPacket(ActionFailed.STATIC_PACKET);
                }
                else
                {
                        activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this);
                        activeChar.sendPacket(ActionFailed.STATIC_PACKET);
                }
        }
        
        private void showHtmlWindow(L2PcInstance activeChar)
        {
            NpcHtmlMessage debian = new NpcHtmlMessage(5);
            StringBuilder tb = new StringBuilder("");
                
            tb.append("<html><head><title>Siege Informer</title></head><body>");
            tb.append("<center>");
            tb.append("<img src=\"L2Font-e.replay_logo-e\" width=256 height=80>");
            tb.append("<br>");
            tb.append("<img src=\"l2ui_ch3.herotower_deco\" width=256 height=32 align=center>"); 
            tb.append("<br>");
            tb.append("<font color=\"FFAA00\">Siegable Castles</font>");
            tb.append("<br>");
            tb.append("</center>");
            tb.append("<center>");
            tb.append("<a action=\"bypass -h npc_" + getObjectId() + "_giran\">Giran</a><br>");
            tb.append("<a action=\"bypass -h npc_" + getObjectId() + "_aden\">Aden</a><br>");
            tb.append("<a action=\"bypass -h npc_" + getObjectId() + "_goddard\">Goddard</a><br>");
            tb.append("<a action=\"bypass -h npc_" + getObjectId() + "_gludio\">Gludio</a><br>");
            tb.append("</center>");
            tb.append("<center>");
            tb.append("<img src=\"l2ui_ch3.herotower_deco\" width=256 height=32 align=center>");
            tb.append("</center>");
            tb.append("</body></html>");
                
            debian.setHtml(tb.toString());
            activeChar.sendPacket(debian);
        }
}

 

μετά πήγαινε στην database, βρές ένα οποιοδήποτε npc και βάλε type L2SiegeInformer

 

P.S: Δεν είναι όλα τα castle, επειδή εγώ χρησιμοποιώ μόνο 4.

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