Special gatekeeper

Administratoriau, galbut galetumete parodyti koda ar kazka, labai noretusi to kodo, aciu :)
    
  1. Atsijungęs

    daumis269

    Pranešimai: 0

    Administratoriau, galbut galetumete parodyti koda ar kazka, labai noretusi to kodo, aciu :)
    http://maxcheaters.com/forum/index.php?topic=218969.0
    Paskutinį kartą redagavo: daumis269 30 Balandžio 2013 - 22:34
    30 Balandžio 2013 - 22:33 / #1
  2. 
  3. Atsijungęs

    maugllis

    Administratorius

    Pranešimai: 542

    Description: Normal Gatekeeper, but with special ability, to show how many players are inside those locations.

    It may be easily edited, for default it has only 3 locations, without subcategories etc, but if u wish may be added.

    Its quest based, not an instance.

    Also more statistics like player killers inside etc may be added (...) Sample screenshot:


    package custom.SpecialGatekeeper;
    
    import com.l2jarchid.Config;
    import com.l2jarchid.gameserver.instancemanager.ZoneManager;
    import com.l2jarchid.gameserver.model.actor.L2Character;
    import com.l2jarchid.gameserver.model.actor.L2Npc;
    import com.l2jarchid.gameserver.model.actor.L2Player;
    import com.l2jarchid.gameserver.model.quest.Quest;
    import com.l2jarchid.gameserver.model.quest.QuestState;
    import com.l2jarchid.gameserver.model.zone.L2ZoneType;
    
    /**
     * @author Matim
     * <br>Special Gatekeeper NPC.
     * <br>Show current players count from zone.
     * <br>This code may be easily edited.
     * <br>By default it has few arenas teleports.
     */
    public class SpecialGatekeeper extends Quest
    {
    	protected static L2Player player;
    	
    	private final static String qn = "SpecialGatekeeper";
    	private final static int NPC = Config.SPECIAL_GK_NPC_ID;
    	
    	public SpecialGatekeeper(int questId, String name, String descr) 
    	{
    		super(questId, name, descr);
    		addFirstTalkId(NPC);
    		addStartNpc(NPC);
    		addTalkId(NPC);
    	}
    	
    	@Override
    	public String onAdvEvent(String event, L2Npc npc, L2Player player)
    	{
    		String htmltext = "";
    		
    		if(event.equalsIgnoreCase("1"))
    			player.teleToLocation(73890, 142656, -3778);
    		else if (event.equalsIgnoreCase("2"))
    			player.teleToLocation(-86979, 142402, -3643);
    		else if (event.equalsIgnoreCase("3"))
    			player.teleToLocation(147451, 46728, -3410);
    		else if (event.equalsIgnoreCase("4"))
    			player.teleToLocation(12312, 182752, -3558);
    		else	
    			htmltext = "Error, check whole GK code!";
    		return htmltext;
    	}
    
    	@Override
    	public String onFirstTalk(L2Npc npc, L2Player player)
    	{
    		String htmltext = "";
    		QuestState qs = player.getQuestState(qn);
    		if (qs == null)
    			qs = newQuestState(player);
    
    		htmltext = "<html><title>Special Gatekeeper</title><head><body><center>" +
    				   "<br><img src=l2ui.bbs_lineage2 height=16 width=80>" +
    				   "<font color=AAAAAA>Special Gatekeeper</font><br>" +
                       "<img src=L2UI_CH3.herotower_deco width=256 height=32>" +
                       
                       "Players Inside: <font color=\"LEVEL\">" + getPlayerInsideCount(11600) + "</font>" +
                       "<button value=\"Aden\" action=\"bypass -h Quest SpecialGatekeeper 1\" back=\"L2UI_ch3.bigbutton_over\" fore=\"L2UI_ch3.bigbutton\" width=95 height=21><br>" +
                       
                       "Players Inside: <font color=\"LEVEL\">" + getPlayerInsideCount(10500) + "</font>" +
                       "<button value=\"Giran\" action=\"bypass -h Quest SpecialGatekeeper 2\" back=\"L2UI_ch3.bigbutton_over\" fore=\"L2UI_ch3.bigbutton\" width=95 height=21><br>" +
                       
                       "Players Inside: <font color=\"LEVEL\">" + getPlayerInsideCount(11012) + "</font>" +
                       "<button value=\"MOS\" action=\"bypass -h Quest SpecialGatekeeper 3\" back=\"L2UI_ch3.bigbutton_over\" fore=\"L2UI_ch3.bigbutton\" width=95 height=21><br>" +
                       
                       "Players Inside: <font color=\"LEVEL\">" + getPlayerInsideCount(11013) + "</font>" +
                       "<button value=\"VARKA\" action=\"bypass -h Quest SpecialGatekeeper 4\" back=\"L2UI_ch3.bigbutton_over\" fore=\"L2UI_ch3.bigbutton\" width=95 height=21><br>" +
    				   
    				   "Players Inside: <font color=\"PI\">" + getPlayerInsideCount(11013) + "</font>" +
                       "<button value=\"VARKA\" action=\"bypass -h Quest SpecialGatekeeper 4\" back=\"L2UI_ch3.bigbutton_over\" fore=\"L2UI_ch3.bigbutton\" width=95 height=21><br>" +
    
    				   "<font color=\"cc9900\"><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32></font><br1></center></body></head></html>";
    				   
    		return htmltext;
    	}
    		
    	/**
    	 * @param zoneId
    	 * @return player count from given zone ID
    	 */
    	public static int getPlayerInsideCount(int zoneId)
    	{
    		int i = 0;
    		for (L2ZoneType zone : ZoneManager.getInstance().getAllZones())
    			if (zone.getId() == zoneId)
    			{
    				for (L2Character character : zone.getCharactersInside().values())
    					if (character instanceof L2Player)
    						i++;
    					return i;
    			}
    		return -1;
    	}
    	
    	public static void main(String[] args)
    	{
    		new SpecialGatekeeper(-1, qn, "SpecialGatekeeper");
    	}
    }
    Paskutinį kartą redagavo: maugllis 30 Balandžio 2013 - 23:04
    30 Balandžio 2013 - 23:03 / #2
  4. 
  5. Atsijungęs

    daumis269

    Pranešimai: 0

    mauglis, galbut paaiskinsi, cia sukurti npc quest skilytje??
    30 Balandžio 2013 - 23:19 / #3
  6. 
  7. Atsijungęs

    maugllis

    Administratorius

    Pranešimai: 542

    Jo, sukuri kaip quest npc.
    30 Balandžio 2013 - 23:48 / #4
  8. 
  9. Atsijungęs

    daumis269

    Pranešimai: 0

    maugli, galbut gali paasikinti, na sukuriau ta kaip quest, o kaip tam npc priskirti, kad rodytu??
    1 Geg. 2013 - 00:32 / #5
  10. 
  11. Atsijungęs

    daumis269

    Pranešimai: 0

    maugli, gal gali padeti man koda persirasyti ant l2jfrozen'o?
    4 Geg. 2013 - 00:18 / #6
  12. 
  13. Atsijungęs

    maugllis

    Administratorius

    Pranešimai: 542

    import com.l2jarchid.Config;
    import com.l2jarchid.gameserver.instancemanager.ZoneManager;
    import com.l2jarchid.gameserver.model.actor.L2Character;
    import com.l2jarchid.gameserver.model.actor.L2Npc;
    import com.l2jarchid.gameserver.model.actor.L2Player;
    import com.l2jarchid.gameserver.model.quest.Quest;
    import com.l2jarchid.gameserver.model.quest.QuestState;
    import com.l2jarchid.gameserver.model.zone.L2ZoneType;

    Raudonai pažymėtus pakeiti į savo serverio importus.
    4 Geg. 2013 - 00:51 / #7
  14. 
  15. Atsijungęs

    daumis269

    Pranešimai: 0

    o kaip ji atsispawninti zaidime/>?
    4 Geg. 2013 - 01:09 / #8
  16. 
  17. Atsijungęs

    maugllis

    Administratorius

    Pranešimai: 542

    Taigi susikurk npc navicate kuriam ir priskirsi ta scriptą.
    4 Geg. 2013 - 03:32 / #9