Ir para conteúdo
  • Cadastre-se
  • 0

Alguém sabe? Event not setted propertly


astro10

Pergunta

PESSOAL EU COLOQUEI UM MOD DO CTF, PORÉM O MESMO QUANDO TENTO DA JOIN CTF, DA ESTÁ MSG, DAI TENTO DAR AUTO EVENT E N ACONTECE NADA, DEIXO PRA DAR AUTO CTF PELA PROPRIEDADES E MESMO ASIM N INICIA, ALGUÉM SABE COMO ARRUMAR ISSO??

Spoiler

RNsUu8q.png

 

Editado por astro10
corrigir a img
Link para o comentário
Compartilhar em outros sites

4 respostass a esta questão

Posts recomendados

  • 0
9 minutos atrás, Failed disse:

Olá dentro do seu código procure por essa mensagem ela ira mostrar o motivo do erro pode ser alguma restrição. Ou  poste o código para analisamos, um forte abraço e boa sorte.

Spoiler

/*
 * 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 com.l2jserver.gameserver.model.entity;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Map;
import java.util.Vector;
import java.util.Calendar;
import java.util.concurrent.ScheduledFuture;
import java.util.logging.Logger;

import javolution.text.TextBuilder;
import javolution.util.FastMap;

import com.l2jserver.Config;
import com.l2jserver.L2DatabaseFactory;
import com.l2jserver.gameserver.Announcements;
import com.l2jserver.gameserver.GmListTable;
import com.l2jserver.gameserver.ThreadPoolManager;
import com.l2jserver.gameserver.datatables.ItemTable;
import com.l2jserver.gameserver.datatables.NpcTable;
import com.l2jserver.gameserver.datatables.SpawnTable;
import com.l2jserver.gameserver.model.L2Effect;
import com.l2jserver.gameserver.model.L2ItemInstance;
import com.l2jserver.gameserver.model.L2Party;
import com.l2jserver.gameserver.model.L2Radar;
import com.l2jserver.gameserver.model.L2Spawn;
import com.l2jserver.gameserver.model.actor.L2Summon;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PetInstance;
import com.l2jserver.gameserver.model.itemcontainer.Inventory;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
import com.l2jserver.gameserver.network.serverpackets.InventoryUpdate;
import com.l2jserver.gameserver.network.serverpackets.ItemList;
import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.network.serverpackets.PlaySound;
import com.l2jserver.gameserver.network.serverpackets.RadarControl;
import com.l2jserver.gameserver.network.serverpackets.SocialAction;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.templates.chars.L2NpcTemplate;
import com.l2jserver.gameserver.templates.skills.L2EffectType;
import com.l2jserver.util.Rnd;

/**
 * 
 * @author SqueezeD & Darki699 (idea by FBIAgent)
 * 
 */
public class CTF
{        
        /** Task for event cycles<br> */
        private CTFStartTask _task1;
        
        private CTF()
        {
            if (Config.CTF_EVENT_ENABLED)
            {
                loadData();                
                this.scheduleCTFEventStart();
                _log.warning("CTFEventEngine[CTF.CTF()]: Started.");
            }
            else
            {
                _log.warning("CTFEventEngine[CTF.CTF()]: Engine is disabled.");
            }
        }
        
        /**
         * Initialize new/Returns the one and only instance<br><br>
         *
         * @return CTF<br>
         */
        public static CTF getInstance()
        {
            return SingletonHolder._instance;
        }
        
        /**
         * Starts CTFStartTask
         */
        public void scheduleCTFEventStart()
        {
            try
            {
                Calendar currentTime = Calendar.getInstance();
                Calendar nextStartTime = null;
                Calendar testStartTime = null;
                for (String timeOfDay : Config.CTF_EVENT_INTERVAL)
                {
                    // Creating a Calendar object from the specified interval value
                    testStartTime = Calendar.getInstance();
                    testStartTime.setLenient(true);
                    String[] splitTimeOfDay = timeOfDay.split(":");
                    testStartTime.set(Calendar.HOUR_OF_DAY, Integer.parseInt(splitTimeOfDay[0]));
                    testStartTime.set(Calendar.MINUTE, Integer.parseInt(splitTimeOfDay[1]));
                    // If the date is in the past, make it the next day (Example: Checking for "1:00", when the time is 23:57.)
                    if (testStartTime.getTimeInMillis() < currentTime.getTimeInMillis())
                    {
                        testStartTime.add(Calendar.DAY_OF_MONTH, 1);
                    }
                    // Check for the test date to be the minimum (smallest in the specified list)
                    if (nextStartTime == null || testStartTime.getTimeInMillis() < nextStartTime.getTimeInMillis())
                    {
                        nextStartTime = testStartTime;
                    }
                }
                _task1 = new CTFStartTask(nextStartTime.getTimeInMillis());
                ThreadPoolManager.getInstance().executeTask(_task1);
            }
            catch (Exception e)
            {
                _log.warning("CTFEventEngine: Error figuring out a start time. Check CTFEventInterval in config file.");
            }
        }
        
            
        public void skipDelay()
        {
            if (_task1.nextRun.cancel(false))
            {
                _task1.setStartTime(System.currentTimeMillis());
                ThreadPoolManager.getInstance().executeTask(_task1);
            }
        }
        
        /**
         * Class forCTFT cycles
         */
        class CTFStartTask implements Runnable
        {
            private long _startTime;
            public ScheduledFuture<?> nextRun;
            
            public CTFStartTask(long startTime)
            {
                _startTime = startTime;
            }
            
            public void setStartTime(long startTime)
            {
                _startTime = startTime;
            }
            
            /**
             * @see java.lang.Runnable#run()
             */
            public void run()
            {
                int delay = (int) Math.round((_startTime - System.currentTimeMillis()) / 1000.0);
                
                
                int nextMsg = 0;
                if (delay > 3600)
                {
                    nextMsg = delay - 3600;
                }
                else if (delay > 1800)
                {
                    nextMsg = delay - 1800;
                }
                else if (delay > 900)
                {
                    nextMsg = delay - 900;
                }
                else if (delay > 600)
                {
                    nextMsg = delay - 600;
                }
                else if (delay > 300)
                {
                    nextMsg = delay - 300;
                }
                else if (delay > 60)
                {
                    nextMsg = delay - 60;
                }
                else if (delay > 5)
                {
                    nextMsg = delay - 5;
                }
                else if (delay > 0)
                {
                    nextMsg = delay;
                }
                else
                {
                    // start

                    autoEvent();
                    _task1.setStartTime(System.currentTimeMillis() + 60000L * 225);
                    ThreadPoolManager.getInstance().executeTask(_task1);
                }
                
                if (delay > 0)
                {
                    nextRun = ThreadPoolManager.getInstance().scheduleGeneral(this, nextMsg * 1000);
                }
            }
        }
            
    private final static Logger _log = Logger.getLogger(CTF.class.getName());
    private static int _FlagNPC = 35062, _FLAG_IN_HAND_ITEM_ID = 6718;
    public static String _eventName = new String(), _eventDesc = new String(), _topTeam = new String(), _joiningLocationName = new String();
    public static Vector<String> _teams = new Vector<String>(), _savePlayers = new Vector<String>(), _savePlayerTeams = new Vector<String>();
    public static Vector<L2PcInstance> _players = new Vector<L2PcInstance>(), _playersShuffle = new Vector<L2PcInstance>();
    public static Vector<Integer> _teamPlayersCount = new Vector<Integer>(), _teamColors = new Vector<Integer>(), _teamsX = new Vector<Integer>(), _teamsY = new Vector<Integer>(), _teamsZ = new Vector<Integer>(), _teamsBaseX = new Vector<Integer>(), _teamsBaseY = new Vector<Integer>(),
            _teamsBaseZ = new Vector<Integer>();
    public static boolean _joining = false, _teleport = false, _started = false, _sitForced = false;
    public static L2Spawn _npcSpawn;
    public static int _npcId = 0, _npcX = 0, _npcY = 0, _npcZ = 0, _npcHeading = 0, _rewardId = 0, _rewardAmount = 0, _minlvl = 0, _maxlvl = 0, _joinTime = 0, _eventTime = 0, _minPlayers = 0, _maxPlayers = 0;
    public static long _flagHoldTime = 0;
    public static Vector<Integer> _teamPointsCount = new Vector<Integer>();
    public static Vector<Integer> _flagIds = new Vector<Integer>(), _flagsX = new Vector<Integer>(), _flagsY = new Vector<Integer>(), _flagsZ = new Vector<Integer>();
    public static Vector<L2Spawn> _flagSpawns = new Vector<L2Spawn>(), _throneSpawns = new Vector<L2Spawn>();
    public static Vector<Boolean> _flagsTaken = new Vector<Boolean>(), _flagsNotRemoved = new Vector<Boolean>();
    public static int _topScore = 0, eventCenterX = 0, eventCenterY = 0, eventCenterZ = 0, eventOffset = 0;
    public static Map<String, Integer> _playerScores = new FastMap<String, Integer>();
    
    public static void showFlagHtml(L2PcInstance eventPlayer, String objectId, String teamName)
    {
        if (eventPlayer == null)
            return;
        
        try
        {
            NpcHtmlMessage adminReply = new NpcHtmlMessage(0);
            
            TextBuilder replyMSG = new TextBuilder();
            
            replyMSG.append("<html><body><center>");
            replyMSG.append("CTF Flag<br><br>");
            replyMSG.append("<font color=\"00FF00\">" + teamName + "'s Flag</font><br>");
            if (eventPlayer._teamNameCTF != null && eventPlayer._teamNameCTF.equals(teamName))
                replyMSG.append("<font color=\"LEVEL\">This is your Flag</font><br>");
            else
                replyMSG.append("<font color=\"LEVEL\">Enemy Flag!</font><br>");
            if (_started)
            {
                processInFlagRange(eventPlayer);
            }
            else
                replyMSG.append("CTF match is not in progress yet.<br>Wait for a GM to start the event<br>");
            replyMSG.append("</center></body></html>

 

Link para o comentário
Compartilhar em outros sites


  • 0
1 minuto atrás, Failed disse:

Boa noite provavel erro !! aqui você tem uma verificação duplicada e não tem nenhum sentido chamar um player ao spawn de npc !!	

remova esses :

public static void startJoin(L2PcInstance activeChar)
	{
		if (!startJoinOk())
		{
			activeChar.sendMessage("Event not setted propertly.");
			if (Config.DEBUG)
				_log.fine("CTF Engine[startJoin(" + activeChar.getName() + ")]: startJoinOk() = false");
			return;
		}
		
		_joining = true;
		spawnEventNpc(activeChar);
		AnnounceToPlayers(true, "CTF Event: Registration opened for 15 minute(s)! Use .joinctf command to register. Rewards: 10 gold bars for the team winner!");
	}

	private static void spawnEventNpc(L2PcInstance activeChar)
	{
		L2NpcTemplate tmpl = NpcTable.getInstance().getTemplate(_npcId);
		
		try
		{
			_npcSpawn = new L2Spawn(tmpl);
			
			_npcSpawn.setLocx(_npcX);
			_npcSpawn.setLocy(_npcY);
			_npcSpawn.setLocz(_npcZ);
			_npcSpawn.setAmount(1);
			_npcSpawn.setHeading(_npcHeading);
			_npcSpawn.setRespawnDelay(1);
			
			SpawnTable.getInstance().addNewSpawn(_npcSpawn, false);
			
			_npcSpawn.init();
			_npcSpawn.getLastSpawn().getStatus().setCurrentHp(999999999);
			_npcSpawn.getLastSpawn().setTitle(_eventName);
			_npcSpawn.getLastSpawn()._isEventMobCTF = true;
			_npcSpawn.getLastSpawn().isAggressive();
			_npcSpawn.getLastSpawn().decayMe();
			_npcSpawn.getLastSpawn().spawnMe(_npcSpawn.getLastSpawn().getX(), _npcSpawn.getLastSpawn().getY(), _npcSpawn.getLastSpawn().getZ());
			
			_npcSpawn.getLastSpawn().broadcastPacket(new MagicSkillUse(_npcSpawn.getLastSpawn(), _npcSpawn.getLastSpawn(), 1034, 1, 1, 1));
		}
		catch (Exception e)
		{
			_log.warning("CTF Engine[spawnEventNpc(" + activeChar.getName() + ")]: exception: " + e.getMessage());
		}
	}

	

beleza vou fazer isso, se der certo lhe aviso. vlw mesmo !!!

Link para o comentário
Compartilhar em outros sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Processando...



×
×
  • Criar Novo...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.