Форум администраторов игровых серверов

Форум администраторов игровых серверов (https://forum.zone-game.info/TT.php)
-   Работа со скриптами (https://forum.zone-game.info/forumdisplay.php?f=37)
-   -   Ветка 7 семи печатей (https://forum.zone-game.info/showthread.php?t=29087)

KID 30.05.2013 16:05

Re: Ветка 7 семи печатей
 
тьма и ужас. скинь этот квест :\

sakson 30.05.2013 18:27

Re: Ветка 7 семи печатей
 
http://www.fayloobmennik.net/2897802

KID 30.05.2013 23:22

Re: Ветка 7 семи печатей
 
Код:

        private void teleportWithTag(L2PcInstance player, int x, int y, int z) {
                L2Npc npc = (L2Npc) player.getKnownList().getKnownObjects().get(AbyssalSaintessElcadia2);
                player.teleToLocation(x, y, z);
                if (npcTag != null)
                        npcTag.teleToLocation(x, y, z);
        }

сменить на
Код:

        private void teleportWithTag(L2PcInstance player, int x, int y, int z) {
                L2Npc npc = (L2Npc) player.getKnownList().getKnownObjects().get(AbyssalSaintessElcadia2);
                player.teleToLocation(x, y, z);
                if (npc != null)
                        npc.teleToLocation(x, y, z);
        }


sakson 31.05.2013 13:24

Re: Ветка 7 семи печатей
 
Цитата:

Сообщение от KID (Сообщение 302560)
Код:

        private void teleportWithTag(L2PcInstance player, int x, int y, int z) {
                L2Npc npc = (L2Npc) player.getKnownList().getKnownObjects().get(AbyssalSaintessElcadia2);
                player.teleToLocation(x, y, z);
                if (npcTag != null)
                        npcTag.teleToLocation(x, y, z);
        }

сменить на
Код:

        private void teleportWithTag(L2PcInstance player, int x, int y, int z) {
                L2Npc npc = (L2Npc) player.getKnownList().getKnownObjects().get(AbyssalSaintessElcadia2);
                player.teleToLocation(x, y, z);
                if (npc != null)
                        npc.teleToLocation(x, y, z);
        }


Спасибо вроде кв работает

KID 31.05.2013 14:11

Re: Ветка 7 семи печатей
 
Читай больше, ты сталкиваешься со слишком простыми ошибками

sakson 05.06.2013 08:42

Re: Ветка 7 семи печатей
 
Help!!
Не получается написать правельную переменную
Код:

----------
3. ERROR in \Q10295_SevenSignSolinaTomb.java (at line 218)
        for (L2DoorInstance d : world.getDoors())
                                      ^^^^^^^^
The method getDoors() is undefined for the type InstanceManager.InstanceWorld

Вот сам код
Код:

private void openEnterDoors(L2PcInstance player)
        {
               
                InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
                for (L2DoorInstance d : world.getDoors())
                {
                        for (int i = 0;i < enterDoors.length; i++)
                        {
                                if (d.getDoorId() == enterDoors[i])
                                        d.openMe();
                        }
                }
        }

Помогите пожалуйста
Вот если кому нужно gameserver\model\actor\instance\L2DoorIns tance
http://www.fayloobmennik.net/2900705

Буду очень признателен вам!

KID 05.06.2013 14:10

Re: Ветка 7 семи печатей
 
Скинь InstanceWorld.java

sakson 06.06.2013 15:38

Re: Ветка 7 семи печатей
 
Цитата:

Сообщение от KID (Сообщение 303797)
Скинь InstanceWorld.java

Интернет не работал.
Есть только InstanceManager$InstanceWorld
Код:

package l2.brick.gameserver.instancemanager;

import javolution.util.FastList;

public static class InstanceManager$InstanceWorld
{

    public boolean isLocked;
    public int instanceId;
    public int templateId;
    public FastList allowed;
    public volatile int status;

    public InstanceManager$InstanceWorld()
    {
        isLocked = false;
        templateId = -1;
        allowed = new FastList();
    }
}

И на всякий случай InstanceManager
Код:

// Decompiled by DJ v3.12.12.96 Copyright 2011 Atanas Neshkov  Date: 06.06.2013 20:37:49
// Home Page: http://members.fortunecity.com/neshkov/dj.html  http://www.neshkov.com/dj.html - Check often for new version!
// Decompiler options: packimports(3)
// Source File Name:  InstanceManager.java

package l2.brick.gameserver.instancemanager;

import java.io.*;
import java.sql.*;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javolution.io.UTF8StreamReader;
import javolution.text.CharArray;
import javolution.util.FastList;
import javolution.util.FastMap;
import javolution.xml.stream.XMLStreamException;
import javolution.xml.stream.XMLStreamReaderImpl;
import l2.brick.Config;
import l2.brick.L2DatabaseFactory;
import l2.brick.gameserver.model.actor.instance.L2PcInstance;
import l2.brick.gameserver.model.entity.Instance;

public class InstanceManager
{
    private static class SingletonHolder
    {

        protected static final InstanceManager _instance = new InstanceManager();


        private SingletonHolder()
        {
        }
    }

    public static class InstanceWorld
    {

        public boolean isLocked;
        public int instanceId;
        public int templateId;
        public FastList allowed;
        public volatile int status;

        public InstanceWorld()
        {
            isLocked = false;
            templateId = -1;
            allowed = new FastList();
        }
    }


    public long getInstanceTime(int playerObjId, int id)
    {
        if(!_playerInstanceTimes.containsKey(Integer.valueOf(playerObjId)))
            restoreInstanceTimes(playerObjId);
        if(((Map)_playerInstanceTimes.get(Integer.valueOf(playerObjId))).containsKey(Integer.valueOf(id)))
            return ((Long)((Map)_playerInstanceTimes.get(Integer.valueOf(playerObjId))).get(Integer.valueOf(id))).longValue();
        else
            return -1L;
    }

    public Map getAllInstanceTimes(int playerObjId)
    {
        if(!_playerInstanceTimes.containsKey(Integer.valueOf(playerObjId)))
            restoreInstanceTimes(playerObjId);
        return (Map)_playerInstanceTimes.get(Integer.valueOf(playerObjId));
    }

    public void setInstanceTime(int playerObjId, int id, long time)
    {
        Connection con;
        if(!_playerInstanceTimes.containsKey(Integer.valueOf(playerObjId)))
            restoreInstanceTimes(playerObjId);
        con = null;
        con = L2DatabaseFactory.getInstance().getConnection();
        PreparedStatement statement = con.prepareStatement("INSERT INTO character_instance_time (charId,instanceId,time) values (?,?,?) ON DUPLICATE KEY UPDATE time=?");
        statement.setInt(1, playerObjId);
        statement.setInt(2, id);
        statement.setLong(3, time);
        statement.setLong(4, time);
        statement.execute();
        statement.close();
        ((Map)_playerInstanceTimes.get(Integer.valueOf(playerObjId))).put(Integer.valueOf(id), Long.valueOf(time));
        L2DatabaseFactory.close(con);
        break MISSING_BLOCK_LABEL_186;
        Exception e;
        e;
        _log.log(Level.WARNING, (new StringBuilder()).append("Could not insert character instance time data: ").append(e.getMessage()).toString(), e);
        L2DatabaseFactory.close(con);
        break MISSING_BLOCK_LABEL_186;
        Exception exception;
        exception;
        L2DatabaseFactory.close(con);
        throw exception;
    }

    public void deleteInstanceTime(int playerObjId, int id)
    {
        Connection con = null;
        con = L2DatabaseFactory.getInstance().getConnection();
        PreparedStatement statement = con.prepareStatement("DELETE FROM character_instance_time WHERE charId=? AND instanceId=?");
        statement.setInt(1, playerObjId);
        statement.setInt(2, id);
        statement.execute();
        statement.close();
        ((Map)_playerInstanceTimes.get(Integer.valueOf(playerObjId))).remove(Integer.valueOf(id));
        L2DatabaseFactory.close(con);
        break MISSING_BLOCK_LABEL_137;
        Exception e;
        e;
        _log.log(Level.WARNING, (new StringBuilder()).append("Could not delete character instance time data: ").append(e.getMessage()).toString(), e);
        L2DatabaseFactory.close(con);
        break MISSING_BLOCK_LABEL_137;
        Exception exception;
        exception;
        L2DatabaseFactory.close(con);
        throw exception;
    }

    public void restoreInstanceTimes(int playerObjId)
    {
        Connection con;
        if(_playerInstanceTimes.containsKey(Integer.valueOf(playerObjId)))
            return;
        _playerInstanceTimes.put(Integer.valueOf(playerObjId), new FastMap());
        con = null;
        con = L2DatabaseFactory.getInstance().getConnection();
        PreparedStatement statement = con.prepareStatement("SELECT instanceId,time FROM character_instance_time WHERE charId=?");
        statement.setInt(1, playerObjId);
        ResultSet rset;
        for(rset = statement.executeQuery(); rset.next();)
        {
            int id = rset.getInt("instanceId");
            long time = rset.getLong("time");
            if(time < System.currentTimeMillis())
                deleteInstanceTime(playerObjId, id);
            else
                ((Map)_playerInstanceTimes.get(Integer.valueOf(playerObjId))).put(Integer.valueOf(id), Long.valueOf(time));
        }

        rset.close();
        statement.close();
        L2DatabaseFactory.close(con);
        break MISSING_BLOCK_LABEL_227;
        Exception e;
        e;
        _log.log(Level.WARNING, (new StringBuilder()).append("Could not delete character instance time data: ").append(e.getMessage()).toString(), e);
        L2DatabaseFactory.close(con);
        break MISSING_BLOCK_LABEL_227;
        Exception exception;
        exception;
        L2DatabaseFactory.close(con);
        throw exception;
    }

    public String getInstanceIdName(int id)
    {
        if(_instanceIdNames.containsKey(Integer.valueOf(id)))
            return (String)_instanceIdNames.get(Integer.valueOf(id));
        else
            return "UnknownInstance";
    }

    private void loadInstanceNames()
    {
        InputStream in = null;
        in = new FileInputStream((new StringBuilder()).append(Config.DATAPACK_ROOT).append("/data/instancenames.xml").toString());
        XMLStreamReaderImpl xpp = new XMLStreamReaderImpl();
        xpp.setInput((new UTF8StreamReader()).setInput(in));
        for(int e = xpp.getEventType(); e != 8; e = xpp.next())
            if(e == 1 && xpp.getLocalName().toString().equals("instance"))
            {
                Integer id = Integer.valueOf(xpp.getAttributeValue(null, "id").toString());
                String name = xpp.getAttributeValue(null, "name").toString();
                _instanceIdNames.put(id, name);
            }

        FileNotFoundException e;
        try
        {
            in.close();
        }
        // Misplaced declaration of an exception variable
        catch(FileNotFoundException e) { }
        break MISSING_BLOCK_LABEL_222;
        e;
        _log.warning("instancenames.xml could not be loaded: file not found");
        try
        {
            in.close();
        }
        // Misplaced declaration of an exception variable
        catch(FileNotFoundException e) { }
        break MISSING_BLOCK_LABEL_222;
        XMLStreamException xppe;
        xppe;
        _log.log(Level.WARNING, (new StringBuilder()).append("Error while loading instance names: ").append(xppe.getMessage()).toString(), xppe);
        try
        {
            in.close();
        }
        // Misplaced declaration of an exception variable
        catch(XMLStreamException xppe) { }
        break MISSING_BLOCK_LABEL_222;
        Exception exception;
        exception;
        try
        {
            in.close();
        }
        catch(Exception e) { }
        throw exception;
    }

    public void addWorld(InstanceWorld world)
    {
        _instanceWorlds.put(Integer.valueOf(world.instanceId), world);
    }

    public InstanceWorld getWorld(int instanceId)
    {
        return (InstanceWorld)_instanceWorlds.get(Integer.valueOf(instanceId));
    }

    public InstanceWorld getPlayerWorld(L2PcInstance player)
    {
        for(Iterator i$ = _instanceWorlds.values().iterator(); i$.hasNext();)
        {
            InstanceWorld temp = (InstanceWorld)i$.next();
            if(temp != null && temp.allowed.contains(Integer.valueOf(player.getObjectId())))
                return temp;
        }

        return null;
    }

    private InstanceManager()
    {
        _instanceList = new FastMap();
        _instanceWorlds = new FastMap();
        _dynamic = 0x493e0;
        _playerInstanceTimes = new FastMap();
        _log.info("Initializing InstanceManager");
        loadInstanceNames();
        _log.info((new StringBuilder()).append("Loaded ").append(_instanceIdNames.size()).append(" instance names").toString());
        createWorld();
    }

    public static final InstanceManager getInstance()
    {
        return SingletonHolder._instance;
    }

    private void createWorld()
    {
        Instance themultiverse = new Instance(-1);
        themultiverse.setName("multiverse");
        _instanceList.put(Integer.valueOf(-1), themultiverse);
        _log.info("Multiverse Instance created");
        Instance universe = new Instance(0);
        universe.setName("universe");
        _instanceList.put(Integer.valueOf(0), universe);
        _log.info("Universe Instance created");
    }

    public void destroyInstance(int instanceid)
    {
        if(instanceid <= 0)
            return;
        Instance temp = (Instance)_instanceList.get(Integer.valueOf(instanceid));
        if(temp != null)
        {
            temp.removeNpcs();
            temp.removePlayers();
            temp.removeDoors();
            temp.cancelTimer();
            _instanceList.remove(Integer.valueOf(instanceid));
            if(_instanceWorlds.containsKey(Integer.valueOf(instanceid)))
                _instanceWorlds.remove(Integer.valueOf(instanceid));
        }
    }

    public Instance getInstance(int instanceid)
    {
        return (Instance)_instanceList.get(Integer.valueOf(instanceid));
    }

    public FastMap getInstances()
    {
        return _instanceList;
    }

    public int getPlayerInstance(int objectId)
    {
        for(Iterator i$ = _instanceList.values().iterator(); i$.hasNext();)
        {
            Instance temp = (Instance)i$.next();
            if(temp != null && temp.containsPlayer(objectId))
                return temp.getId();
        }

        return 0;
    }

    public boolean createInstance(int id)
    {
        if(getInstance(id) != null)
        {
            return false;
        } else
        {
            Instance instance = new Instance(id);
            _instanceList.put(Integer.valueOf(id), instance);
            return true;
        }
    }

    public boolean createInstanceFromTemplate(int id, String template)
    {
        if(getInstance(id) != null)
        {
            return false;
        } else
        {
            Instance instance = new Instance(id);
            _instanceList.put(Integer.valueOf(id), instance);
            instance.loadInstanceTemplate(template);
            return true;
        }
    }

    public int createDynamicInstance(String template)
    {
        do
        {
            if(getInstance(_dynamic) == null)
                break;
            _dynamic++;
            if(_dynamic == 0x7fffffff)
            {
                _log.warning("InstanceManager: More then 2147183647 instances created");
                _dynamic = 0x493e0;
            }
        } while(true);
        Instance instance = new Instance(_dynamic);
        _instanceList.put(Integer.valueOf(_dynamic), instance);
        if(template != null)
            instance.loadInstanceTemplate(template);
        return _dynamic;
    }


    private static final Logger _log = Logger.getLogger(l2/brick/gameserver/instancemanager/InstanceManager.getName());
    private FastMap _instanceList;
    private FastMap _instanceWorlds;
    private int _dynamic;
    private static final Map _instanceIdNames = new FastMap();
    private Map _playerInstanceTimes;
    private static final String ADD_INSTANCE_TIME = "INSERT INTO character_instance_time (charId,instanceId,time) values (?,?,?) ON DUPLICATE KEY UPDATE time=?";
    private static final String RESTORE_INSTANCE_TIMES = "SELECT instanceId,time FROM character_instance_time WHERE charId=?";
    private static final String DELETE_INSTANCE_TIME = "DELETE FROM character_instance_time WHERE charId=? AND instanceId=?";

}


bot2b 06.06.2013 16:01

Re: Ветка 7 семи печатей
 
В Вашем ядре нет метода getDoors у класса InstanceWorld.
Если Вам нужно в квесте открывать определенные двери, реализуйте это независимо от инстанса.

Если нужна помощь - пишите в лс, скайп или icq, помогу :)


Текущее время: 23:08. Часовой пояс GMT +3.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd. Перевод: zCarot