Рейтинг темы:
  • 0 Голос(ов) - 0 в среднем
  • 1
  • 2
  • 3
  • 4
  • 5
Ночные скиллы L2Open
#1
Сборка l2Open 12++ (Gracia Epilogue).

Начнём с того, что попроше:
Решил сделать скилл, на подобии Shadow Sense, суть заключается в том, что мне нужно было,
чтобы он работал ТОЛЬКО ночью (пассивка).
Но столкнулся со следуюшей проблемой: создал скилл, запустил сервер (по игравому времени днём), добавил скилл персонажу и вуаля - эффект появился днём тоже. Вроде, прописал всё верно, вот сам скилл:
Код:
<skill id="8554" levels="8" name="Night Hunter">
        <set name="target" val="TARGET_SELF" />
        <set name="skillType" val="BUFF" />
        <set name="operateType" val="OP_PASSIVE" />
        <for>
            <mul order="0x30" stat="maxHp" val="3" />
                <game night="true" />
        </for>
    </skill>


Как вы видите, <game night="true" /> прописанно (вроде) правильно, почему такая проблема,
понять не могу. Возможно дело в ядре, вот временой контроль:

Код:
package ru.l2open.gameserver;

import java.util.Iterator;
import java.util.Map;
import java.util.logging.Logger;

import javolution.util.FastMap;

import ru.l2open.Config;
import ru.l2open.gameserver.ai.CtrlEvent;
import ru.l2open.gameserver.instancemanager.DayNightSpawnManager;
import ru.l2open.gameserver.model.actor.L2Character;

/**
* Removed TimerThread watcher [DrHouse]
*
* @version $Date: 2010/02/02 22:43:00 $
*/
public class GameTimeController
{
    protected static final Logger _log = Logger.getLogger(GameTimeController.class.getName());
    
    public static final int TICKS_PER_SECOND = 10; // not able to change this without checking through code
    public static final int MILLIS_IN_TICK = 1000 / TICKS_PER_SECOND;
    
    protected static int _gameTicks;
    protected static long _gameStartTime;
    protected static boolean _isNight = false;
    protected static boolean _interruptRequest = false;
    
    private static final FastMap<Integer, L2Character> _movingObjects = new FastMap<Integer, L2Character>().shared();
    
    protected static TimerThread _timer;
    
    /**
     * one ingame day is 240 real minutes
     */
    public static GameTimeController getInstance()
    {
        return SingletonHolder._instance;
    }
    
    private GameTimeController()
    {
        _gameStartTime = System.currentTimeMillis() - 3600000; // offset so that the server starts a day begin
        _gameTicks = 3600000 / MILLIS_IN_TICK; // offset so that the server starts a day begin
        
        _timer = new TimerThread();
        _timer.start();
        
        ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new BroadcastSunState(), 0, 600000);
        
    }
    
    public boolean isNowNight()
    {
        return _isNight;
    }
    
    public int getGameTime()
    {
        return (_gameTicks / (TICKS_PER_SECOND * 10));
    }
    
    public static int getGameTicks()
    {
        return _gameTicks;
    }
    
    /**
     * Add a L2Character to movingObjects of GameTimeController.<BR><BR>
     *
     * <B><U> Concept</U> :</B><BR><BR>
     * All L2Character in movement are identified in <B>movingObjects</B> of GameTimeController.<BR><BR>
     *
     * @param cha The L2Character to add to movingObjects of GameTimeController
     *
     */
    public void registerMovingObject(L2Character cha)
    {
        if (cha == null)
            return;
        
        _movingObjects.putIfAbsent(cha.getObjectId(), cha);
    }
    
    /**
     * Move all L2Characters contained in movingObjects of GameTimeController.<BR><BR>
     *
     * <B><U> Concept</U> :</B><BR><BR>
     * All L2Character in movement are identified in <B>movingObjects</B> of GameTimeController.<BR><BR>
     *
     * <B><U> Actions</U> :</B><BR><BR>
     * <li>Update the position of each L2Character </li>
     * <li>If movement is finished, the L2Character is removed from movingObjects </li>
     * <li>Create a task to update the _knownObject and _knowPlayers of each L2Character that finished its movement and of their already known L2Object then notify AI with EVT_ARRIVED </li><BR><BR>
     *
     */
    protected void moveObjects()
    {
        // Go throw the table containing L2Character in movement
        Iterator<Map.Entry<Integer, L2Character>> it = _movingObjects.entrySet().iterator();
        while (it.hasNext())
        {
            // If movement is finished, the L2Character is removed from
            // movingObjects and added to the ArrayList ended
            L2Character ch = it.next().getValue();
            if (ch.updatePosition(_gameTicks))
            {
                it.remove();
                ThreadPoolManager.getInstance().executeTask(new MovingObjectArrived(ch));
            }
        }
    }
    
    public void stopTimer()
    {
        _interruptRequest = true;
        _timer.interrupt();
    }
    
    class TimerThread extends Thread
    {
        public TimerThread()
        {
            super("GameTimeController");
            setDaemon(true);
            setPriority(MAX_PRIORITY);
        }
        
        @Override
        public void run()
        {
            int oldTicks;
            long runtime;
            int sleepTime;
            
            for(;;)
            {
                try
                {
                    oldTicks = _gameTicks; // save old ticks value to avoid moving objects 2x in same tick
                    runtime = System.currentTimeMillis() - _gameStartTime; // from server boot to now
                    
                    _gameTicks = (int) (runtime / MILLIS_IN_TICK); // new ticks value (ticks now)
                    
                    if (oldTicks != _gameTicks)
                        moveObjects(); // Runs possibly too often
                        
                    runtime = (System.currentTimeMillis() - _gameStartTime) - runtime;
                    
                    // calculate sleep time... time needed to next tick minus time it takes to call moveObjects()
                    sleepTime = 1 + MILLIS_IN_TICK - ((int) runtime) % MILLIS_IN_TICK;
                    
                    //_log.finest("TICK: "+_gameTicks);
                    
                    if (sleepTime > 0)
                        Thread.sleep(sleepTime);
                }
                catch (InterruptedException ie)
                {
                    if (_interruptRequest)
                        return;
                    
                    ie.printStackTrace();
                }
                catch (Exception e)
                {
                    e.printStackTrace();
                }
            }
        }
    }
    
    /**
     * Update the _knownObject and _knowPlayers of each L2Character that finished its movement and of their already known L2Object then notify AI with EVT_ARRIVED.<BR><BR>
     */
    class MovingObjectArrived implements Runnable
    {
        private final L2Character _ended;
        
        MovingObjectArrived(L2Character ended)
        {
            _ended = ended;
        }
        
        public void run()
        {
            try
            {
                if (_ended.hasAI()) // AI could be just disabled due to region turn off
                {
                    if (Config.MOVE_BASED_KNOWNLIST)
                        _ended.getKnownList().findObjects();
                    _ended.getAI().notifyEvent(CtrlEvent.EVT_ARRIVED);
                }
            }
            catch (NullPointerException e)
            {
                e.printStackTrace();
            }
        }
    }
    
    /**
     * @param rise
     */
    class BroadcastSunState implements Runnable
    {
        int h;
        boolean tempIsNight;
        
        public void run()
        {
            h = (getGameTime() / 60) % 24; // Time in hour
            tempIsNight = (h < 6);
            
            if (tempIsNight != _isNight)
            { // If diff day/night state
                _isNight = tempIsNight; // Set current day/night varible to value of temp varible
                DayNightSpawnManager.getInstance().notifyChangeMode();
            }
        }
    }
    
    @SuppressWarnings("synthetic-access")
    private static class SingletonHolder
    {
        protected static final GameTimeController _instance = new GameTimeController();
    }
}

Или где то в другом ява файле надо прописывать?....
Ответ
#2
Xantrax Написал:Сборка l2Open 12++ (Gracia Epilogue).

Начнём с того, что попроше:
Решил сделать скилл, на подобии Shadow Sense, суть заключается в том, что мне нужно было,
чтобы он работал ТОЛЬКО ночью (пассивка).
Но столкнулся со следуюшей проблемой: создал скилл, запустил сервер (по игравому времени днём), добавил скилл персонажу и вуаля - эффект появился днём тоже. Вроде, прописал всё верно, вот сам скилл:
Код:
<skill id="8554" levels="8" name="Night Hunter">
        <set name="target" val="TARGET_SELF" />
        <set name="skillType" val="BUFF" />
        <set name="operateType" val="OP_PASSIVE" />
        <for>
            <mul order="0x30" stat="maxHp" val="3" />
                <game night="true" />
        </for>
    </skill>


Как вы видите, <game night="true" /> прописанно (вроде) правильно, почему такая проблема,
понять не могу. Возможно дело в ядре, вот временой контроль:

Код:
package ru.l2open.gameserver;

import java.util.Iterator;
import java.util.Map;
import java.util.logging.Logger;

import javolution.util.FastMap;

import ru.l2open.Config;
import ru.l2open.gameserver.ai.CtrlEvent;
import ru.l2open.gameserver.instancemanager.DayNightSpawnManager;
import ru.l2open.gameserver.model.actor.L2Character;

/**
* Removed TimerThread watcher [DrHouse]
*
* @version $Date: 2010/02/02 22:43:00 $
*/
public class GameTimeController
{
    protected static final Logger _log = Logger.getLogger(GameTimeController.class.getName());
    
    public static final int TICKS_PER_SECOND = 10; // not able to change this without checking through code
    public static final int MILLIS_IN_TICK = 1000 / TICKS_PER_SECOND;
    
    protected static int _gameTicks;
    protected static long _gameStartTime;
    protected static boolean _isNight = false;
    protected static boolean _interruptRequest = false;
    
    private static final FastMap<Integer, L2Character> _movingObjects = new FastMap<Integer, L2Character>().shared();
    
    protected static TimerThread _timer;
    
    /**
     * one ingame day is 240 real minutes
     */
    public static GameTimeController getInstance()
    {
        return SingletonHolder._instance;
    }
    
    private GameTimeController()
    {
        _gameStartTime = System.currentTimeMillis() - 3600000; // offset so that the server starts a day begin
        _gameTicks = 3600000 / MILLIS_IN_TICK; // offset so that the server starts a day begin
        
        _timer = new TimerThread();
        _timer.start();
        
        ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new BroadcastSunState(), 0, 600000);
        
    }
    
    public boolean isNowNight()
    {
        return _isNight;
    }
    
    public int getGameTime()
    {
        return (_gameTicks / (TICKS_PER_SECOND * 10));
    }
    
    public static int getGameTicks()
    {
        return _gameTicks;
    }
    
    /**
     * Add a L2Character to movingObjects of GameTimeController.<BR><BR>
     *
     * <B><U> Concept</U> :</B><BR><BR>
     * All L2Character in movement are identified in <B>movingObjects</B> of GameTimeController.<BR><BR>
     *
     * @param cha The L2Character to add to movingObjects of GameTimeController
     *
     */
    public void registerMovingObject(L2Character cha)
    {
        if (cha == null)
            return;
        
        _movingObjects.putIfAbsent(cha.getObjectId(), cha);
    }
    
    /**
     * Move all L2Characters contained in movingObjects of GameTimeController.<BR><BR>
     *
     * <B><U> Concept</U> :</B><BR><BR>
     * All L2Character in movement are identified in <B>movingObjects</B> of GameTimeController.<BR><BR>
     *
     * <B><U> Actions</U> :</B><BR><BR>
     * <li>Update the position of each L2Character </li>
     * <li>If movement is finished, the L2Character is removed from movingObjects </li>
     * <li>Create a task to update the _knownObject and _knowPlayers of each L2Character that finished its movement and of their already known L2Object then notify AI with EVT_ARRIVED </li><BR><BR>
     *
     */
    protected void moveObjects()
    {
        // Go throw the table containing L2Character in movement
        Iterator<Map.Entry<Integer, L2Character>> it = _movingObjects.entrySet().iterator();
        while (it.hasNext())
        {
            // If movement is finished, the L2Character is removed from
            // movingObjects and added to the ArrayList ended
            L2Character ch = it.next().getValue();
            if (ch.updatePosition(_gameTicks))
            {
                it.remove();
                ThreadPoolManager.getInstance().executeTask(new MovingObjectArrived(ch));
            }
        }
    }
    
    public void stopTimer()
    {
        _interruptRequest = true;
        _timer.interrupt();
    }
    
    class TimerThread extends Thread
    {
        public TimerThread()
        {
            super("GameTimeController");
            setDaemon(true);
            setPriority(MAX_PRIORITY);
        }
        
        @Override
        public void run()
        {
            int oldTicks;
            long runtime;
            int sleepTime;
            
            for(;;)
            {
                try
                {
                    oldTicks = _gameTicks; // save old ticks value to avoid moving objects 2x in same tick
                    runtime = System.currentTimeMillis() - _gameStartTime; // from server boot to now
                    
                    _gameTicks = (int) (runtime / MILLIS_IN_TICK); // new ticks value (ticks now)
                    
                    if (oldTicks != _gameTicks)
                        moveObjects(); // Runs possibly too often
                        
                    runtime = (System.currentTimeMillis() - _gameStartTime) - runtime;
                    
                    // calculate sleep time... time needed to next tick minus time it takes to call moveObjects()
                    sleepTime = 1 + MILLIS_IN_TICK - ((int) runtime) % MILLIS_IN_TICK;
                    
                    //_log.finest("TICK: "+_gameTicks);
                    
                    if (sleepTime > 0)
                        Thread.sleep(sleepTime);
                }
                catch (InterruptedException ie)
                {
                    if (_interruptRequest)
                        return;
                    
                    ie.printStackTrace();
                }
                catch (Exception e)
                {
                    e.printStackTrace();
                }
            }
        }
    }
    
    /**
     * Update the _knownObject and _knowPlayers of each L2Character that finished its movement and of their already known L2Object then notify AI with EVT_ARRIVED.<BR><BR>
     */
    class MovingObjectArrived implements Runnable
    {
        private final L2Character _ended;
        
        MovingObjectArrived(L2Character ended)
        {
            _ended = ended;
        }
        
        public void run()
        {
            try
            {
                if (_ended.hasAI()) // AI could be just disabled due to region turn off
                {
                    if (Config.MOVE_BASED_KNOWNLIST)
                        _ended.getKnownList().findObjects();
                    _ended.getAI().notifyEvent(CtrlEvent.EVT_ARRIVED);
                }
            }
            catch (NullPointerException e)
            {
                e.printStackTrace();
            }
        }
    }
    
    /**
     * @param rise
     */
    class BroadcastSunState implements Runnable
    {
        int h;
        boolean tempIsNight;
        
        public void run()
        {
            h = (getGameTime() / 60) % 24; // Time in hour
            tempIsNight = (h < 6);
            
            if (tempIsNight != _isNight)
            { // If diff day/night state
                _isNight = tempIsNight; // Set current day/night varible to value of temp varible
                DayNightSpawnManager.getInstance().notifyChangeMode();
            }
        }
    }
    
    @SuppressWarnings("synthetic-access")
    private static class SingletonHolder
    {
        protected static final GameTimeController _instance = new GameTimeController();
    }
}

Или где то в другом ява файле надо прописывать?....

Там другой принцып работы) Попробуйте сделать релог, и больше всего еффекта не будет)

А смотреть ищо на сам конд ConditionGameTime
Ответ
#3
VISTALL Написал:Там другой принцып работы

Какой?
VISTALL Написал:Попробуйте сделать релог

Делал релоги миллион раз - эффект остаётся. (может в самой сборке косяк?).
VISTALL Написал:А смотреть ищо на сам конд ConditionGameTime

По подробнее можно?.
Ответ


Возможно похожие темы ...
Тема Автор Ответы Просмотры Последний пост
  скиллы от саб класса сохраняются только у ГМА aaansideee 5 1,708 10-11-2016, 12:26 PM
Последний пост: Hack
  Не сохраняет скиллы с саб класса aaansideee 5 1,869 10-08-2016, 08:51 PM
Последний пост: HiredKiller
  Квесты и Скиллы PTS monami 6 2,041 01-14-2016, 10:13 PM
Последний пост: monami
  [Шара] Сборки L2Open-Team Каратель 61 54,984 12-27-2014, 02:59 AM
Последний пост: Rey84306
  Прошу помоч найти сборку l2Open 1853 lorelion 0 1,174 12-26-2014, 07:58 PM
Последний пост: lorelion
  l2open 1115 error Womix 3 1,238 06-22-2014, 09:29 PM
Последний пост: flopix
  Vortex пробленые скиллы Map 4 1,599 07-25-2013, 12:19 PM
Последний пост: Map
  Скиллы sashachapalo 2 1,233 05-01-2013, 08:03 PM
Последний пост: elastic
  Пропадают Скиллы С Панели[Epilogue] sniper1234 2 1,498 03-27-2013, 02:23 PM
Последний пост: sniper1234
  Error: Could not find or load main class com.l2open.gameserver.util.BootManager Nasdomlan 6 2,362 03-25-2013, 05:59 PM
Последний пост: Nasdomlan

Перейти к форуму:


Пользователи, просматривающие эту тему: 2 Гость(ей)