Reikalinga scripterių pagalba :)

    
  1. Atsijungęs

    Harden

    Pranešimai: 0

    Būčiau dėkingas jeigu kuris nors iš jūsų galėtų perdaryt šitą services npc, kad veiktų ant naujausio aCis rev. :)

    /*
     * Copyright (C) 2004-2013 L2J DataPack
     *
     * This file is part of L2J DataPack.
     *
     * L2J DataPack 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.
     *
     * L2J DataPack 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 custom.Services;
     
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.util.logging.Logger;
    
    import net.sf.l2j.L2DatabaseFactory;
    import net.sf.l2j.gameserver.datatables.CharNameTable;
    import net.sf.l2j.gameserver.datatables.ClanTable;
    import net.sf.l2j.gameserver.model.actor.L2Npc;
    import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
    import net.sf.l2j.gameserver.model.olympiad.OlympiadManager;
    import net.sf.l2j.gameserver.model.quest.Quest;
    import net.sf.l2j.gameserver.model.quest.QuestState;
    import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse;
     
    /**
     * @author Colet
     * Interlude rework SweeTs
     */
    public class Services extends Quest
    {
        public static final Logger _log = Logger.getLogger(Services.class.getName());
       
        // NPC Id
        int servicesNpc = 50009;
       
        // Noble Items
        int nobleItemId = 7679;
        int nobleItemCount = 1;
       
        // PK Reduce Items
        int pkReduceItemId = 57;
        int pkReduceItemCount = 1000;
       
        // Change Name Items
        int changeNameItemId = 57;
        int changeNameItemCount = 1000000;
        boolean logNameChanges = true;
       
        // Change Clan Name Items
        int changeClanNameItemId = 57;
        long changeClanNameItemCount = 300;
        boolean logClanNameChanges = true;
        int clanMinLevel = 5;
        
        // Clan Level Items
        int[] clanLevelItemsId =
        {
        	57, // Level 5 to 6
        	57, // Level 6 to 7
        	57, // Level 7 to 8
        };
        
        int[] clanLevelItemsCount =
        {
        	250, // Level 5 to 6
        	250, // Level 6 to 7
        	250, // Level 7 to 8
        };
        
        // Clan Reputation Points Items
        int clanReputationPointsItemId = 57;
        int clanReputationPointsItemCount = 20;
        
        // Change Gender Items
        int changeGenderItemId = 57;
        int changeGenderItemCount = 50;
        
        public Services(int questId, String name, String descr)
        {
            super(questId, name, descr);
           
            addStartNpc(servicesNpc);
            addFirstTalkId(servicesNpc);
            addTalkId(servicesNpc);
        }
       
        public static void main(String[] args)
        {
            new Services(-1, Services.class.getSimpleName(), "custom");
        }
       
        @Override
        public String onFirstTalk(L2Npc npc, L2PcInstance player)
        {
            if (player.getQuestState(getName()) == null)
            {
                newQuestState(player);
            }
            else if (player.isInCombat())
            	return "Services-Blocked.htm";
            
            else if (player.getPvpFlag() == 1)
            	return "Services-Blocked.htm";
            
            else if (player.getKarma() != 0)
            	return "Services-Blocked.htm";
            
            else if (OlympiadManager.getInstance().isRegistered(player))
            	return "Services-Blocked.htm";
            
            else if (player.isDead() || player.isFakeDeath())
            	return "Services-Blocked.htm";
            
            return "Services.htm";
        }
       
        @Override
        public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
        {
            String htmlText = event;
            QuestState st = player.getQuestState(getName());
           
            if (event.equals("setNoble"))
            {
                if (!player.isNoble())
                {
                    if (st.getQuestItemsCount(nobleItemId) >= nobleItemCount)
                    {
                        st.takeItems(nobleItemId, nobleItemCount);
                        player.setNoble(true, true);
                        player.setTarget(player);
                        player.broadcastPacket(new MagicSkillUse(player, 5103, 1, 1000, 0));
                        player.broadcastUserInfo();
                        return "NoblesseServices-Success.htm";
                    }
    				return "NoblesseServices-NoItems.htm";
                }
    			return "NoblesseServices-AlredyNoble.htm";
            }
            else if (event.equals("levelUpClan"))
            {
            	if (player.getClan() == null)
                {
                	return "ClanLevelUp-NoClan.htm";
                }
            	else if (!player.isClanLeader())
            	{
            		return "ClanLevelUp-NoLeader.htm";
            	}
            	else
            	{
            		if (player.getClan().getLevel() == 8)
            		{
            			return "ClanLevelUp-MaxLevel.htm";
            		}
    				if (((player.getClan().getLevel() <= 1) || (player.getClan().getLevel() == 2) || (player.getClan().getLevel() == 3) || (player.getClan().getLevel() == 4)))
    				{
    					player.getClan().changeLevel(player.getClan().getLevel() + 1);
    					player.getClan().broadcastClanStatus();
    					player.sendMessage("Your clan is now level " + player.getClan().getLevel() + ".");
    				    player.setTarget(player);
    				    player.broadcastPacket(new MagicSkillUse(player, 5103, 1, 1000, 0));
    				    
    				    return "ClanLevelUp.htm";
    				}
    				else if (player.getClan().getLevel() == 5)
    				{
    					if (st.getQuestItemsCount(clanLevelItemsId[0]) >= clanLevelItemsCount[0])
    					{
    						st.takeItems(clanLevelItemsId[0], clanLevelItemsCount[0]);
    						player.getClan().changeLevel(player.getClan().getLevel() + 1);
    						player.getClan().broadcastClanStatus();
    						player.sendMessage("Your clan is now level " + player.getClan().getLevel() + ".");
    				        player.setTarget(player);
    				        player.broadcastPacket(new MagicSkillUse(player, 5103, 1, 1000, 0));
    				        
    				        return "ClanLevelUp.htm";
    					}
    					return "ClanLevelUp-NoItems.htm";
    				}
    				else if (player.getClan().getLevel() == 6)
    				{
    					if (st.getQuestItemsCount(clanLevelItemsId[1]) >= clanLevelItemsCount[1])
    					{
    						st.takeItems(clanLevelItemsId[1], clanLevelItemsCount[1]);
    						player.getClan().changeLevel(player.getClan().getLevel() + 1);
    						player.getClan().broadcastClanStatus();
    						player.sendMessage("Your clan is now level " + player.getClan().getLevel() + ".");
    				        player.setTarget(player);
    				        player.broadcastPacket(new MagicSkillUse(player, 5103, 1, 1000, 0));
    				        
    				        return "ClanLevelUp.htm";
    					}
    					return "ClanLevelUp-NoItems.htm";
    				}
    				else if (player.getClan().getLevel() == 7)
    				{
    					if (st.getQuestItemsCount(clanLevelItemsId[2]) >= clanLevelItemsCount[2])
    					{
    						st.takeItems(clanLevelItemsId[2], clanLevelItemsCount[2]);
    						player.getClan().changeLevel(player.getClan().getLevel() + 1);
    						player.getClan().broadcastClanStatus();
    						player.sendMessage("Your clan is now level " + player.getClan().getLevel() + ".");
    				        player.setTarget(player);
    				        player.broadcastPacket(new MagicSkillUse(player, 5103, 1, 1000, 0));
    				        
    				        return "ClanLevelUp.htm";
    					}
    					return "ClanLevelUp-NoItems.htm";
    				}
    				
    				player.getClan().broadcastClanStatus();
    				return "ClanLevelUp.htm";
            	}
            }
            else if (event.equals("changeGender"))
            {
            	if (st.getQuestItemsCount(changeGenderItemId) >= changeGenderItemCount)
            	{
                	st.takeItems(changeGenderItemId, changeGenderItemCount);
                	player.getAppearance().setSex(player.getAppearance().getSex() ? false : true);
                    player.setTarget(player);
                    player.broadcastPacket(new MagicSkillUse(player, 5103, 1, 1000, 0));
                	player.broadcastUserInfo();
                	
                	return "ChangeGender-Success.htm";
            	}
    			return "ChangeGender-NoItems.htm";
            }
            else if (event.startsWith("changeName"))
            {
                try
                {
                    String newName = event.substring(11);
                   
                    if (st.getQuestItemsCount(changeNameItemId) >= changeNameItemCount)
                    {                                                      
                        if (newName == null)
                        {                                                      
                            return "ChangeName.htm";
                        }
    					if (!newName.matches("^[a-zA-Z0-9]+$"))
    					{
    					    player.sendMessage("Incorrect name. Please try again.");
    					    return "ChangeName.htm";
    					}
    					else if (newName.equals(player.getName()))
    					{
    					    player.sendMessage("Please, choose a different name.");
    					    return "ChangeName.htm";
    					}
    					else if (CharNameTable.doesCharNameExist(newName))
    					{
    					    player.sendMessage("The name " + newName + " already exists.");
    					    return "ChangeName.htm";
    					}
    					else
    					{
    					    st.takeItems(changeNameItemId, changeNameItemCount);
    					    player.setName(newName);
    					    player.store();
    					    player.sendMessage("Your new character name is " + newName);
    					    player.broadcastUserInfo();
    					    player.getClan().broadcastClanStatus();
    					    
    					    return "ChangeName-Success.htm";
    					}
                    }
    				return "ChangeName-NoItems.htm";
                }
                catch (Exception e)
                {
                    player.sendMessage("Please, insert a correct name.");
                    return "ChangeName.htm";
                }
            }
            else if (event.startsWith("reducePks"))
            {
                try
                {
                    String pkReduceString = event.substring(10);
                    int pkReduceCount = Integer.parseInt(pkReduceString);
                    
                    if (player.getPkKills() != 0)
                    {
                        if (pkReduceCount == 0)
                        {
                            player.sendMessage("Please, put a higher value.");
                            return "PkServices.htm";
                        }
    					if (st.getQuestItemsCount(pkReduceItemId) >= pkReduceItemCount)
    					{
    					    st.takeItems(pkReduceItemId, pkReduceItemCount * pkReduceCount);
    					    player.setPkKills(player.getPkKills() - pkReduceCount);
    					    player.sendMessage("You have successfuly cleaned " + pkReduceCount + " PKs.");
    					    player.broadcastUserInfo();
    					    
    					    return "PkServices-Success.htm";
    					}
    					return "PkServices-NoItems.htm";
                    }
    				return "PkServices-NoPks.htm";
                }
                catch (Exception e)
                {
                    player.sendMessage("Incorrect value. Please try again.");
                    return "PkServices.htm";
                }
            }
            else if (event.startsWith("changeClanName"))
            {
            	if (player.getClan() == null)
            	{
            		return "ChangeClanName-NoClan.htm";
            	}
    			try
    			{
    				String newClanName = event.substring(15);
    				
    				if (st.getQuestItemsCount(changeClanNameItemId) >= changeClanNameItemCount)
    				{
    					if (newClanName == null)
    					{
    						return "ChangeClanName.htm";
    					}
    					if (!player.isClanLeader())
    					{
    						player.sendMessage("Only the clan leader can change the clan name.");
    						return "ChangeClanName.htm";
    					}
    					else if (player.getClan().getLevel() < clanMinLevel)
    					{
    						player.sendMessage("Your clan must be at least level " + clanMinLevel + " to change the name.");
    						return "ChangeClanName.htm";
    					}
    					else if (!newClanName.matches("^[a-zA-Z0-9]+$"))
    					{
    					    player.sendMessage("Incorrect name. Please try again.");
    					    return "ChangeClanName.htm";
    					}
    					else if (newClanName.equals(player.getClan().getName()))
    					{
    					    player.sendMessage("Please, choose a different name.");
    					    return "ChangeClanName.htm";
    					}
    					else if (ClanTable.getInstance().getClanByName(newClanName) != null)
    					{
    					    player.sendMessage("The name " + newClanName + " already exists.");
    					    return "ChangeClanName.htm";
    					}
    					else
    					{
    					    st.takeItems(changeNameItemId, changeNameItemCount);
    					    player.getClan().setName(newClanName);
    					    
    					    try (Connection con = L2DatabaseFactory.getInstance().getConnection())
    					    {
    					    	PreparedStatement statement = con.prepareStatement("UPDATE clan_data SET clan_name=? WHERE clan_id=?");
    					    	statement.setString(1, newClanName);
    					    	statement.setInt(2, player.getClan().getClanId());
    					    	statement.execute();
    					    	statement.close();
    					    }
    					    catch (Exception e)
    					    {
    					    	_log.info("Error updating clan name for player " + player.getName() + ". Error: " + e);
    					    }
    					    
    					    player.sendMessage("Your new clan name is " + newClanName);
    					    player.getClan().broadcastClanStatus();
    					    
    					    return "ChangeClanName-Success.htm";
    					}
    				}
    				return "ChangeClanName-NoItems.htm";
    			}
    			catch (Exception e)
    			{
    			    player.sendMessage("Please, insert a correct name.");
    			    return "ChangeClanName.htm";
    			}
            }
            else if (event.startsWith("setReputationPoints"))
            {
                try
                {
                    String reputationPointsString = event.substring(20);
                    int reputationPointsCount = Integer.parseInt(reputationPointsString);
                    
                    if (player.getClan() == null)
                    {
                    	return "ClanReputationPoints-NoClan.htm";
                    }
                    else if (!player.isClanLeader())
                    {
                    	return "ClanReputationPoints-NoLeader.htm";
                    }
                    else
                    {
    	                if (reputationPointsCount == 0)
    	                {
    	                    player.sendMessage("Please, put a higher value.");
    	                    return "ClanReputationPoints.htm";
    	                }
    					if (st.getQuestItemsCount(clanReputationPointsItemId) >= clanReputationPointsItemCount)
    					{
    						st.takeItems(clanReputationPointsItemId, clanReputationPointsItemCount);
    						player.getClan().addReputationScore(100);
    					    player.getClan().broadcastClanStatus();
    					    return "ClanReputationPoints-Success.htm";
    					}
    					return "ClanReputationPoints-NoItems.htm";
                    }
                }
                catch (Exception e)
                {
                    player.sendMessage("Incorrect value. Please try again.");
                    return "ClanReputationPoints.htm";
                }
            }
            
            return htmlText;
    	}
    }
    20 Rugpjūčio 2016 - 21:10 / #1
  2. 
  3. Atsijungęs

    povis111

    Pranešimai: 0

    kuris tas tavo naujausias..?
    20 Rugpjūčio 2016 - 22:58 / #2
  4. 
  5. Atsijungęs

    Harden

    Pranešimai: 0

    350 arba 362. Manau jau nebesiskirs, bet galiu ir klyst. :>
    20 Rugpjūčio 2016 - 23:50 / #3
  6. 
  7. Atsijungęs

    povis111

    Pranešimai: 0

    gali, nes ant 362 questai i source perkelti
    362:
    package net.sf.l2j.gameserver.scripting.scripts.custom;
    
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.util.logging.Logger;
    
    import net.sf.l2j.L2DatabaseFactory;
    import net.sf.l2j.gameserver.datatables.CharNameTable;
    import net.sf.l2j.gameserver.datatables.ClanTable;
    import net.sf.l2j.gameserver.model.actor.L2Npc;
    import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
    import net.sf.l2j.gameserver.model.base.Sex;
    import net.sf.l2j.gameserver.model.olympiad.OlympiadManager;
    import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse;
    import net.sf.l2j.gameserver.scripting.Quest;
    import net.sf.l2j.gameserver.scripting.QuestState;
    
    public class Services extends Quest
    {
        public static final Logger _log = Logger.getLogger(Services.class.getName());
       
        // NPC Id
        int servicesNpc = 50009;
       
        // Noble Items
        int nobleItemId = 7679;
        int nobleItemCount = 1;
       
        // PK Reduce Items
        int pkReduceItemId = 57;
        int pkReduceItemCount = 1000;
       
        // Change Name Items
        int changeNameItemId = 57;
        int changeNameItemCount = 1000000;
        boolean logNameChanges = true;
       
        // Change Clan Name Items
        int changeClanNameItemId = 57;
        long changeClanNameItemCount = 300;
        boolean logClanNameChanges = true;
        int clanMinLevel = 5;
        
        // Clan Level Items
        int[] clanLevelItemsId =
        {
        	57, // Level 5 to 6
        	57, // Level 6 to 7
        	57, // Level 7 to 8
        };
        
        int[] clanLevelItemsCount =
        {
        	250, // Level 5 to 6
        	250, // Level 6 to 7
        	250, // Level 7 to 8
        };
        
        // Clan Reputation Points Items
        int clanReputationPointsItemId = 57;
        int clanReputationPointsItemCount = 20;
        
        // Change Gender Items
        int changeGenderItemId = 57;
        int changeGenderItemCount = 50;
        
        public Services()
        {
            super(-1, "custom");
           
            addStartNpc(servicesNpc);
            addFirstTalkId(servicesNpc);
            addTalkId(servicesNpc);
        }
       
        @Override
        public String onFirstTalk(L2Npc npc, L2PcInstance player)
        {
            if (player.getQuestState(getName()) == null)
            {
                newQuestState(player);
            }
            else if (player.isInCombat())
            	return "Services-Blocked.htm";
            
            else if (player.getPvpFlag() == 1)
            	return "Services-Blocked.htm";
            
            else if (player.getKarma() != 0)
            	return "Services-Blocked.htm";
            
            else if (OlympiadManager.getInstance().isRegistered(player))
            	return "Services-Blocked.htm";
            
            else if (player.isDead() || player.isFakeDeath())
            	return "Services-Blocked.htm";
            
            return "Services.htm";
        }
       
        @Override
        public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
        {
            String htmlText = event;
            QuestState st = player.getQuestState(getName());
           
            if (event.equals("setNoble"))
            {
                if (!player.isNoble())
                {
                    if (st.getQuestItemsCount(nobleItemId) >= nobleItemCount)
                    {
                        st.takeItems(nobleItemId, nobleItemCount);
                        player.setNoble(true, true);
                        player.setTarget(player);
                        player.broadcastPacket(new MagicSkillUse(player, 5103, 1, 1000, 0));
                        player.broadcastUserInfo();
                        return "NoblesseServices-Success.htm";
                    }
    				return "NoblesseServices-NoItems.htm";
                }
    			return "NoblesseServices-AlredyNoble.htm";
            }
            else if (event.equals("levelUpClan"))
            {
            	if (player.getClan() == null)
                {
                	return "ClanLevelUp-NoClan.htm";
                }
            	else if (!player.isClanLeader())
            	{
            		return "ClanLevelUp-NoLeader.htm";
            	}
            	else
            	{
            		if (player.getClan().getLevel() == 8)
            		{
            			return "ClanLevelUp-MaxLevel.htm";
            		}
    				if (((player.getClan().getLevel() <= 1) || (player.getClan().getLevel() == 2) || (player.getClan().getLevel() == 3) || (player.getClan().getLevel() == 4)))
    				{
    					player.getClan().changeLevel(player.getClan().getLevel() + 1);
    					player.getClan().broadcastClanStatus();
    					player.sendMessage("Your clan is now level " + player.getClan().getLevel() + ".");
    				    player.setTarget(player);
    				    player.broadcastPacket(new MagicSkillUse(player, 5103, 1, 1000, 0));
    				    
    				    return "ClanLevelUp.htm";
    				}
    				else if (player.getClan().getLevel() == 5)
    				{
    					if (st.getQuestItemsCount(clanLevelItemsId[0]) >= clanLevelItemsCount[0])
    					{
    						st.takeItems(clanLevelItemsId[0], clanLevelItemsCount[0]);
    						player.getClan().changeLevel(player.getClan().getLevel() + 1);
    						player.getClan().broadcastClanStatus();
    						player.sendMessage("Your clan is now level " + player.getClan().getLevel() + ".");
    				        player.setTarget(player);
    				        player.broadcastPacket(new MagicSkillUse(player, 5103, 1, 1000, 0));
    				        
    				        return "ClanLevelUp.htm";
    					}
    					return "ClanLevelUp-NoItems.htm";
    				}
    				else if (player.getClan().getLevel() == 6)
    				{
    					if (st.getQuestItemsCount(clanLevelItemsId[1]) >= clanLevelItemsCount[1])
    					{
    						st.takeItems(clanLevelItemsId[1], clanLevelItemsCount[1]);
    						player.getClan().changeLevel(player.getClan().getLevel() + 1);
    						player.getClan().broadcastClanStatus();
    						player.sendMessage("Your clan is now level " + player.getClan().getLevel() + ".");
    				        player.setTarget(player);
    				        player.broadcastPacket(new MagicSkillUse(player, 5103, 1, 1000, 0));
    				        
    				        return "ClanLevelUp.htm";
    					}
    					return "ClanLevelUp-NoItems.htm";
    				}
    				else if (player.getClan().getLevel() == 7)
    				{
    					if (st.getQuestItemsCount(clanLevelItemsId[2]) >= clanLevelItemsCount[2])
    					{
    						st.takeItems(clanLevelItemsId[2], clanLevelItemsCount[2]);
    						player.getClan().changeLevel(player.getClan().getLevel() + 1);
    						player.getClan().broadcastClanStatus();
    						player.sendMessage("Your clan is now level " + player.getClan().getLevel() + ".");
    				        player.setTarget(player);
    				        player.broadcastPacket(new MagicSkillUse(player, 5103, 1, 1000, 0));
    				        
    				        return "ClanLevelUp.htm";
    					}
    					return "ClanLevelUp-NoItems.htm";
    				}
    				
    				player.getClan().broadcastClanStatus();
    				return "ClanLevelUp.htm";
            	}
            }
            else if (event.equals("changeGender"))
            {
            	if (st.getQuestItemsCount(changeGenderItemId) >= changeGenderItemCount)
            	{
                	st.takeItems(changeGenderItemId, changeGenderItemCount);
                	player.getAppearance().setSex(player.getAppearance().getSex() == Sex.MALE ? Sex.FEMALE : Sex.MALE);
                    player.setTarget(player);
                    player.broadcastPacket(new MagicSkillUse(player, 5103, 1, 1000, 0));
                	player.broadcastUserInfo();
                	
                	return "ChangeGender-Success.htm";
            	}
    			return "ChangeGender-NoItems.htm";
            }
            else if (event.startsWith("changeName"))
            {
                try
                {
                    String newName = event.substring(11);
                   
                    if (st.getQuestItemsCount(changeNameItemId) >= changeNameItemCount)
                    {                                                      
                        if (newName == null)
                        {                                                      
                            return "ChangeName.htm";
                        }
    					if (!newName.matches("^[a-zA-Z0-9]+$"))
    					{
    					    player.sendMessage("Incorrect name. Please try again.");
    					    return "ChangeName.htm";
    					}
    					else if (newName.equals(player.getName()))
    					{
    					    player.sendMessage("Please, choose a different name.");
    					    return "ChangeName.htm";
    					}
    					else if (CharNameTable.getInstance().getPlayerObjectId(newName) > 0)
    					{
    					    player.sendMessage("The name " + newName + " already exists.");
    					    return "ChangeName.htm";
    					}
    					else
    					{
    					    st.takeItems(changeNameItemId, changeNameItemCount);
    					    player.setName(newName);
    					    player.store();
    					    player.sendMessage("Your new character name is " + newName);
    					    player.broadcastUserInfo();
    					    player.getClan().broadcastClanStatus();
    					    
    					    return "ChangeName-Success.htm";
    					}
                    }
    				return "ChangeName-NoItems.htm";
                }
                catch (Exception e)
                {
                    player.sendMessage("Please, insert a correct name.");
                    return "ChangeName.htm";
                }
            }
            else if (event.startsWith("reducePks"))
            {
                try
                {
                    String pkReduceString = event.substring(10);
                    int pkReduceCount = Integer.parseInt(pkReduceString);
                    
                    if (player.getPkKills() != 0)
                    {
                        if (pkReduceCount == 0)
                        {
                            player.sendMessage("Please, put a higher value.");
                            return "PkServices.htm";
                        }
    					if (st.getQuestItemsCount(pkReduceItemId) >= pkReduceItemCount)
    					{
    					    st.takeItems(pkReduceItemId, pkReduceItemCount * pkReduceCount);
    					    player.setPkKills(player.getPkKills() - pkReduceCount);
    					    player.sendMessage("You have successfuly cleaned " + pkReduceCount + " PKs.");
    					    player.broadcastUserInfo();
    					    
    					    return "PkServices-Success.htm";
    					}
    					return "PkServices-NoItems.htm";
                    }
    				return "PkServices-NoPks.htm";
                }
                catch (Exception e)
                {
                    player.sendMessage("Incorrect value. Please try again.");
                    return "PkServices.htm";
                }
            }
            else if (event.startsWith("changeClanName"))
            {
            	if (player.getClan() == null)
            	{
            		return "ChangeClanName-NoClan.htm";
            	}
    			try
    			{
    				String newClanName = event.substring(15);
    				
    				if (st.getQuestItemsCount(changeClanNameItemId) >= changeClanNameItemCount)
    				{
    					if (newClanName == null)
    					{
    						return "ChangeClanName.htm";
    					}
    					if (!player.isClanLeader())
    					{
    						player.sendMessage("Only the clan leader can change the clan name.");
    						return "ChangeClanName.htm";
    					}
    					else if (player.getClan().getLevel() < clanMinLevel)
    					{
    						player.sendMessage("Your clan must be at least level " + clanMinLevel + " to change the name.");
    						return "ChangeClanName.htm";
    					}
    					else if (!newClanName.matches("^[a-zA-Z0-9]+$"))
    					{
    					    player.sendMessage("Incorrect name. Please try again.");
    					    return "ChangeClanName.htm";
    					}
    					else if (newClanName.equals(player.getClan().getName()))
    					{
    					    player.sendMessage("Please, choose a different name.");
    					    return "ChangeClanName.htm";
    					}
    					else if (ClanTable.getInstance().getClanByName(newClanName) != null)
    					{
    					    player.sendMessage("The name " + newClanName + " already exists.");
    					    return "ChangeClanName.htm";
    					}
    					else
    					{
    					    st.takeItems(changeNameItemId, changeNameItemCount);
    					    player.getClan().setName(newClanName);
    					    
    					    try (Connection con = L2DatabaseFactory.getInstance().getConnection())
    					    {
    					    	PreparedStatement statement = con.prepareStatement("UPDATE clan_data SET clan_name=? WHERE clan_id=?");
    					    	statement.setString(1, newClanName);
    					    	statement.setInt(2, player.getClan().getClanId());
    					    	statement.execute();
    					    	statement.close();
    					    }
    					    catch (Exception e)
    					    {
    					    	_log.info("Error updating clan name for player " + player.getName() + ". Error: " + e);
    					    }
    					    
    					    player.sendMessage("Your new clan name is " + newClanName);
    					    player.getClan().broadcastClanStatus();
    					    
    					    return "ChangeClanName-Success.htm";
    					}
    				}
    				return "ChangeClanName-NoItems.htm";
    			}
    			catch (Exception e)
    			{
    			    player.sendMessage("Please, insert a correct name.");
    			    return "ChangeClanName.htm";
    			}
            }
            else if (event.startsWith("setReputationPoints"))
            {
                try
                {
                    String reputationPointsString = event.substring(20);
                    int reputationPointsCount = Integer.parseInt(reputationPointsString);
                    
                    if (player.getClan() == null)
                    {
                    	return "ClanReputationPoints-NoClan.htm";
                    }
                    else if (!player.isClanLeader())
                    {
                    	return "ClanReputationPoints-NoLeader.htm";
                    }
                    else
                    {
    	                if (reputationPointsCount == 0)
    	                {
    	                    player.sendMessage("Please, put a higher value.");
    	                    return "ClanReputationPoints.htm";
    	                }
    					if (st.getQuestItemsCount(clanReputationPointsItemId) >= clanReputationPointsItemCount)
    					{
    						st.takeItems(clanReputationPointsItemId, clanReputationPointsItemCount);
    						player.getClan().addReputationScore(100);
    					    player.getClan().broadcastClanStatus();
    					    return "ClanReputationPoints-Success.htm";
    					}
    					return "ClanReputationPoints-NoItems.htm";
                    }
                }
                catch (Exception e)
                {
                    player.sendMessage("Incorrect value. Please try again.");
                    return "ClanReputationPoints.htm";
                }
            }
            
            return htmlText;
    	}
    }
    Paskutinį kartą redagavo: povis111 21 Rugpjūčio 2016 - 02:35
    21 Rugpjūčio 2016 - 02:33 / #4
  8. 
  9. Atsijungęs

    Harden

    Pranešimai: 0

    Gali gal numest 362rev'ą? P.s questai ir ant 350 jau į java perkelti.
    21 Rugpjūčio 2016 - 12:09 / #5
  10. 
  11. Atsijungęs

    povis111

    Pranešimai: 0

    http://www5.zippyshare.com/v/kHI4w7G9/file.html
    Paskutinį kartą redagavo: povis111 21 Rugpjūčio 2016 - 13:44
    21 Rugpjūčio 2016 - 13:40 / #6
  12. 
  13. Atsijungęs

    Harden

    Pranešimai: 0

    povis111,
    Dėkoju! Viskas veikia apart klano pavadinimo keitimo, paima ne tiek kiek reikia adenų, o visas kiek turi. :D Jeigu netyngi ir žinai kaip gali sutvarkyti, jeigu ne - irgi ne problema. Dėkoju dar kartą :)
    Paskutinį kartą redagavo: Harden 21 Rugpjūčio 2016 - 19:04
    21 Rugpjūčio 2016 - 19:03 / #7
  14. 
  15. Atsijungęs

    povis111

    Pranešimai: 0

    klaida ivelta buvo, patikrindavo ar uztenka klano vardui itemu ir imdavo charo vardo keitimui itemus

    package net.sf.l2j.gameserver.scripting.scripts.custom;
    
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.util.logging.Logger;
    
    import net.sf.l2j.L2DatabaseFactory;
    import net.sf.l2j.gameserver.datatables.CharNameTable;
    import net.sf.l2j.gameserver.datatables.ClanTable;
    import net.sf.l2j.gameserver.model.actor.L2Npc;
    import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
    import net.sf.l2j.gameserver.model.base.Sex;
    import net.sf.l2j.gameserver.model.olympiad.OlympiadManager;
    import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse;
    import net.sf.l2j.gameserver.scripting.Quest;
    import net.sf.l2j.gameserver.scripting.QuestState;
    
    public class Services extends Quest
    {
        public static final Logger _log = Logger.getLogger(Services.class.getName());
       
        // NPC Id
        int servicesNpc = 50009;
       
        // Noble Items
        int nobleItemId = 7679;
        int nobleItemCount = 1;
       
        // PK Reduce Items
        int pkReduceItemId = 57;
        int pkReduceItemCount = 1000;
       
        // Change Name Items
        int changeNameItemId = 57;
        int changeNameItemCount = 1000000;
        boolean logNameChanges = true;
       
        // Change Clan Name Items
        int changeClanNameItemId = 57;
        int changeClanNameItemCount = 300;
        boolean logClanNameChanges = true;
        int clanMinLevel = 5;
        
        // Clan Level Items
        int[] clanLevelItemsId =
        {
        	57, // Level 5 to 6
        	57, // Level 6 to 7
        	57, // Level 7 to 8
        };
        
        int[] clanLevelItemsCount =
        {
        	250, // Level 5 to 6
        	250, // Level 6 to 7
        	250, // Level 7 to 8
        };
        
        // Clan Reputation Points Items
        int clanReputationPointsItemId = 57;
        int clanReputationPointsItemCount = 20;
        
        // Change Gender Items
        int changeGenderItemId = 57;
        int changeGenderItemCount = 50;
        
        public Services()
        {
            super(-1, "custom");
           
            addStartNpc(servicesNpc);
            addFirstTalkId(servicesNpc);
            addTalkId(servicesNpc);
        }
       
        @Override
        public String onFirstTalk(L2Npc npc, L2PcInstance player)
        {
            if (player.getQuestState(getName()) == null)
            {
                newQuestState(player);
            }
            else if (player.isInCombat())
            	return "Services-Blocked.htm";
            
            else if (player.getPvpFlag() == 1)
            	return "Services-Blocked.htm";
            
            else if (player.getKarma() != 0)
            	return "Services-Blocked.htm";
            
            else if (OlympiadManager.getInstance().isRegistered(player))
            	return "Services-Blocked.htm";
            
            else if (player.isDead() || player.isFakeDeath())
            	return "Services-Blocked.htm";
            
            return "Services.htm";
        }
       
        @Override
        public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
        {
            String htmlText = event;
            QuestState st = player.getQuestState(getName());
           
            if (event.equals("setNoble"))
            {
                if (!player.isNoble())
                {
                    if (st.getQuestItemsCount(nobleItemId) >= nobleItemCount)
                    {
                        st.takeItems(nobleItemId, nobleItemCount);
                        player.setNoble(true, true);
                        player.setTarget(player);
                        player.broadcastPacket(new MagicSkillUse(player, 5103, 1, 1000, 0));
                        player.broadcastUserInfo();
                        return "NoblesseServices-Success.htm";
                    }
    				return "NoblesseServices-NoItems.htm";
                }
    			return "NoblesseServices-AlredyNoble.htm";
            }
            else if (event.equals("levelUpClan"))
            {
            	if (player.getClan() == null)
                {
                	return "ClanLevelUp-NoClan.htm";
                }
            	else if (!player.isClanLeader())
            	{
            		return "ClanLevelUp-NoLeader.htm";
            	}
            	else
            	{
            		if (player.getClan().getLevel() == 8)
            		{
            			return "ClanLevelUp-MaxLevel.htm";
            		}
    				if (((player.getClan().getLevel() <= 1) || (player.getClan().getLevel() == 2) || (player.getClan().getLevel() == 3) || (player.getClan().getLevel() == 4)))
    				{
    					player.getClan().changeLevel(player.getClan().getLevel() + 1);
    					player.getClan().broadcastClanStatus();
    					player.sendMessage("Your clan is now level " + player.getClan().getLevel() + ".");
    				    player.setTarget(player);
    				    player.broadcastPacket(new MagicSkillUse(player, 5103, 1, 1000, 0));
    				    
    				    return "ClanLevelUp.htm";
    				}
    				else if (player.getClan().getLevel() == 5)
    				{
    					if (st.getQuestItemsCount(clanLevelItemsId[0]) >= clanLevelItemsCount[0])
    					{
    						st.takeItems(clanLevelItemsId[0], clanLevelItemsCount[0]);
    						player.getClan().changeLevel(player.getClan().getLevel() + 1);
    						player.getClan().broadcastClanStatus();
    						player.sendMessage("Your clan is now level " + player.getClan().getLevel() + ".");
    				        player.setTarget(player);
    				        player.broadcastPacket(new MagicSkillUse(player, 5103, 1, 1000, 0));
    				        
    				        return "ClanLevelUp.htm";
    					}
    					return "ClanLevelUp-NoItems.htm";
    				}
    				else if (player.getClan().getLevel() == 6)
    				{
    					if (st.getQuestItemsCount(clanLevelItemsId[1]) >= clanLevelItemsCount[1])
    					{
    						st.takeItems(clanLevelItemsId[1], clanLevelItemsCount[1]);
    						player.getClan().changeLevel(player.getClan().getLevel() + 1);
    						player.getClan().broadcastClanStatus();
    						player.sendMessage("Your clan is now level " + player.getClan().getLevel() + ".");
    				        player.setTarget(player);
    				        player.broadcastPacket(new MagicSkillUse(player, 5103, 1, 1000, 0));
    				        
    				        return "ClanLevelUp.htm";
    					}
    					return "ClanLevelUp-NoItems.htm";
    				}
    				else if (player.getClan().getLevel() == 7)
    				{
    					if (st.getQuestItemsCount(clanLevelItemsId[2]) >= clanLevelItemsCount[2])
    					{
    						st.takeItems(clanLevelItemsId[2], clanLevelItemsCount[2]);
    						player.getClan().changeLevel(player.getClan().getLevel() + 1);
    						player.getClan().broadcastClanStatus();
    						player.sendMessage("Your clan is now level " + player.getClan().getLevel() + ".");
    				        player.setTarget(player);
    				        player.broadcastPacket(new MagicSkillUse(player, 5103, 1, 1000, 0));
    				        
    				        return "ClanLevelUp.htm";
    					}
    					return "ClanLevelUp-NoItems.htm";
    				}
    				
    				player.getClan().broadcastClanStatus();
    				return "ClanLevelUp.htm";
            	}
            }
            else if (event.equals("changeGender"))
            {
            	if (st.getQuestItemsCount(changeGenderItemId) >= changeGenderItemCount)
            	{
                	st.takeItems(changeGenderItemId, changeGenderItemCount);
                	player.getAppearance().setSex(player.getAppearance().getSex() == Sex.MALE ? Sex.FEMALE : Sex.MALE);
                    player.setTarget(player);
                    player.broadcastPacket(new MagicSkillUse(player, 5103, 1, 1000, 0));
                	player.broadcastUserInfo();
                	
                	return "ChangeGender-Success.htm";
            	}
    			return "ChangeGender-NoItems.htm";
            }
            else if (event.startsWith("changeName"))
            {
                try
                {
                    String newName = event.substring(11);
                   
                    if (st.getQuestItemsCount(changeNameItemId) >= changeNameItemCount)
                    {                                                      
                        if (newName == null)
                        {                                                      
                            return "ChangeName.htm";
                        }
    					if (!newName.matches("^[a-zA-Z0-9]+$"))
    					{
    					    player.sendMessage("Incorrect name. Please try again.");
    					    return "ChangeName.htm";
    					}
    					else if (newName.equals(player.getName()))
    					{
    					    player.sendMessage("Please, choose a different name.");
    					    return "ChangeName.htm";
    					}
    					else if (CharNameTable.getInstance().getPlayerObjectId(newName) > 0)
    					{
    					    player.sendMessage("The name " + newName + " already exists.");
    					    return "ChangeName.htm";
    					}
    					else
    					{
    					    st.takeItems(changeNameItemId, changeNameItemCount);
    					    player.setName(newName);
    					    player.store();
    					    player.sendMessage("Your new character name is " + newName);
    					    player.broadcastUserInfo();
    					    player.getClan().broadcastClanStatus();
    					    
    					    return "ChangeName-Success.htm";
    					}
                    }
    				return "ChangeName-NoItems.htm";
                }
                catch (Exception e)
                {
                    player.sendMessage("Please, insert a correct name.");
                    return "ChangeName.htm";
                }
            }
            else if (event.startsWith("reducePks"))
            {
                try
                {
                    String pkReduceString = event.substring(10);
                    int pkReduceCount = Integer.parseInt(pkReduceString);
                    
                    if (player.getPkKills() != 0)
                    {
                        if (pkReduceCount == 0)
                        {
                            player.sendMessage("Please, put a higher value.");
                            return "PkServices.htm";
                        }
    					if (st.getQuestItemsCount(pkReduceItemId) >= pkReduceItemCount)
    					{
    					    st.takeItems(pkReduceItemId, pkReduceItemCount * pkReduceCount);
    					    player.setPkKills(player.getPkKills() - pkReduceCount);
    					    player.sendMessage("You have successfuly cleaned " + pkReduceCount + " PKs.");
    					    player.broadcastUserInfo();
    					    
    					    return "PkServices-Success.htm";
    					}
    					return "PkServices-NoItems.htm";
                    }
    				return "PkServices-NoPks.htm";
                }
                catch (Exception e)
                {
                    player.sendMessage("Incorrect value. Please try again.");
                    return "PkServices.htm";
                }
            }
            else if (event.startsWith("changeClanName"))
            {
            	if (player.getClan() == null)
            	{
            		return "ChangeClanName-NoClan.htm";
            	}
    			try
    			{
    				String newClanName = event.substring(15);
    				
    				if (st.getQuestItemsCount(changeClanNameItemId) >= changeClanNameItemCount)
    				{
    					if (newClanName == null)
    					{
    						return "ChangeClanName.htm";
    					}
    					if (!player.isClanLeader())
    					{
    						player.sendMessage("Only the clan leader can change the clan name.");
    						return "ChangeClanName.htm";
    					}
    					else if (player.getClan().getLevel() < clanMinLevel)
    					{
    						player.sendMessage("Your clan must be at least level " + clanMinLevel + " to change the name.");
    						return "ChangeClanName.htm";
    					}
    					else if (!newClanName.matches("^[a-zA-Z0-9]+$"))
    					{
    					    player.sendMessage("Incorrect name. Please try again.");
    					    return "ChangeClanName.htm";
    					}
    					else if (newClanName.equals(player.getClan().getName()))
    					{
    					    player.sendMessage("Please, choose a different name.");
    					    return "ChangeClanName.htm";
    					}
    					else if (ClanTable.getInstance().getClanByName(newClanName) != null)
    					{
    					    player.sendMessage("The name " + newClanName + " already exists.");
    					    return "ChangeClanName.htm";
    					}
    					else
    					{
    					    st.takeItems(changeClanNameItemId, changeClanNameItemCount);
    					    player.getClan().setName(newClanName);
    					    
    					    try (Connection con = L2DatabaseFactory.getInstance().getConnection())
    					    {
    					    	PreparedStatement statement = con.prepareStatement("UPDATE clan_data SET clan_name=? WHERE clan_id=?");
    					    	statement.setString(1, newClanName);
    					    	statement.setInt(2, player.getClan().getClanId());
    					    	statement.execute();
    					    	statement.close();
    					    }
    					    catch (Exception e)
    					    {
    					    	_log.info("Error updating clan name for player " + player.getName() + ". Error: " + e);
    					    }
    					    
    					    player.sendMessage("Your new clan name is " + newClanName);
    					    player.getClan().broadcastClanStatus();
    					    
    					    return "ChangeClanName-Success.htm";
    					}
    				}
    				return "ChangeClanName-NoItems.htm";
    			}
    			catch (Exception e)
    			{
    			    player.sendMessage("Please, insert a correct name.");
    			    return "ChangeClanName.htm";
    			}
            }
            else if (event.startsWith("setReputationPoints"))
            {
                try
                {
                    String reputationPointsString = event.substring(20);
                    int reputationPointsCount = Integer.parseInt(reputationPointsString);
                    
                    if (player.getClan() == null)
                    {
                    	return "ClanReputationPoints-NoClan.htm";
                    }
                    else if (!player.isClanLeader())
                    {
                    	return "ClanReputationPoints-NoLeader.htm";
                    }
                    else
                    {
    	                if (reputationPointsCount == 0)
    	                {
    	                    player.sendMessage("Please, put a higher value.");
    	                    return "ClanReputationPoints.htm";
    	                }
    					if (st.getQuestItemsCount(clanReputationPointsItemId) >= clanReputationPointsItemCount)
    					{
    						st.takeItems(clanReputationPointsItemId, clanReputationPointsItemCount);
    						player.getClan().addReputationScore(100);
    					    player.getClan().broadcastClanStatus();
    					    return "ClanReputationPoints-Success.htm";
    					}
    					return "ClanReputationPoints-NoItems.htm";
                    }
                }
                catch (Exception e)
                {
                    player.sendMessage("Incorrect value. Please try again.");
                    return "ClanReputationPoints.htm";
                }
            }
            
            return htmlText;
    	}
    }
    21 Rugpjūčio 2016 - 21:52 / #8
  16. 
  17. Atsijungęs

    Harden

    Pranešimai: 0

    Dėkingas! :)
    22 Rugpjūčio 2016 - 19:27 / #9