Подскажите где ошибся

BlueBarsik

Heir
Customer
Решил немного переписать скрипт с билетами для инстов. Сделать откат по группам

Сделал массив

Code:
private static final int[] INSTANCE_IDS_Group_3 = new int[]{228, 229};

для инстов с типом
Code:
sharedReuseGroup="3"


Вот место с вызовом события для предмета ID 13299:

Code:
case 13299:
for (int i =0; i < INSTANCE_IDS_Group_3.length; i++)
{
if(player.getInstanceReuse(INSTANCE_IDS_Group_3[i]) > 0)
{
useItem(player, item, 1L);
player.removeInstanceReusesByGroupId(3);
System.out.println("ID Naiden " + INSTANCE_IDS_Group_3[i] );
} else {
System.out.println("ID Net");
}
}

Если у нас закрыта инста с ID 228 то все хорошо. Билет юзается, кд снимается
Если закрыта инста 229 то скрипт как-будто не проваливается в IF (System.Out внутри IF и внутри Else не срабатывает)
 
Моя реализация. Работает

Code:
case 13299:
                for (int i = 0; i < INSTANCE_IDS_Group_3.length; i++) {
                    if (player.getInstanceReuse(INSTANCE_IDS_Group_3[i]) != null) {
                        useItem(player, item, 1L);
                        player.removeInstanceReusesByGroupId(3);
                        i = INSTANCE_IDS_Group_3.length;
                    } else {
                        System.out.println("Зоны " + NSTANCE_IDS_Group_3[i] + " нет");
                    }
                }
 
Не могу победить двери. И так:

Что есть:
XML с координатами дверей. Двери открываются/закрываются командой open/close
XML Файл с рабочей инстой, двери прописаны (у дверей 16180032 и 16180033 стоит <door id="16180032" opened="false"/>)
jar.ext который сделан по аналогии с файлом "EventReflectionMobInstance" (scripts/npc.model/) в котором изменено ID мобов в case, ID дверей, имя класса

Code:
<!DOCTYPE list SYSTEM "instances.dtd">
<list>
    <instance id="235" name="Labyrinth of Kartias" maxChannels="20" collapseIfEmpty="5" timelimit="30" dispelBuffs="true">
        <collapse on-party-dismiss="true" timer="60"/>
        <level min="24" max="34"/>
        <party min="1" max="1"/>
        <return loc="43928 -49144 -792"/>
        <teleport loc="-107634 22041 -10952"/>
        <geodata map="16_18"/>
        <remove itemId="0" count="0" necessary="false"/>
        <give itemId="0" count="0"/>
        <quest id="0"/>
        <reuse resetReuse="30 6 * * *" setUponEntry="true" sharedReuseGroup="3"/> <!-- Instance reuse at 6:30 every day -->
        <spawns>
            <spawn mobId="40100" type="point">
                <coords loc="-110281 22041 -10576"/>
            </spawn>
            <spawn mobId="40101" type="point">
                <coords loc="-111910 20201 -10462"/>
            </spawn>
            <spawn mobId="40102" type="point">
                <coords loc="-111607 17147 -10313 "/>
            </spawn>      
        </spawns>
        <doors>
            <door id="16180031" opened="true"/>
            <door id="16180032" opened="false"/>
            <door id="16180033" opened="false"/>
        </doors>
    </instance>
</list>

Code:
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package npc.model;

import l2.gameserver.instancemanager.ReflectionManager;
import l2.gameserver.model.Creature;
import l2.gameserver.model.instances.DoorInstance;
import l2.gameserver.model.instances.MonsterInstance;
import l2.gameserver.templates.npc.NpcTemplate;

public class EventReflectionMobInstance extends MonsterInstance {
    public EventReflectionMobInstance(int var1, NpcTemplate var2) {
        super(var1, var2);
    }

    protected void onDeath(Creature var1) {
        super.onDeath(var1);
        if (this.getReflection() == var1.getReflection() && this.getReflection() != ReflectionManager.DEFAULT) {
            DoorInstance var2;
            switch (this.getNpcId()) {
                case 25657:
                    var2 = this.getReflection().getDoor(25150002);
                    if (var2 != null) {
                        var2.openMe();
                    }
                    break;
                case 25658:
                    var2 = this.getReflection().getDoor(25150003);
                    if (var2 != null) {
                        var2.openMe();
                    }
            }
        }

    }
}

Code:
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package npc.model;


import l2.gameserver.instancemanager.ReflectionManager;
import l2.gameserver.model.Creature;
import l2.gameserver.model.instances.DoorInstance;
import l2.gameserver.model.instances.MonsterInstance;
import l2.gameserver.templates.npc.NpcTemplate;

public class kartia29 extends MonsterInstance {
    public kartia29(int var1, NpcTemplate var2) {
        super(var1, var2);
    }

    protected void onDeath(Creature var1) {
        super.onDeath(var1);
        if (this.getReflection() == var1.getReflection() && this.getReflection() != ReflectionManager.DEFAULT) {
            DoorInstance var2;
            switch (this.getNpcId()) {
                case 40100:
                    var2 = this.getReflection().getDoor(16180032);
                    if (var2 != null) {
                        var2.openMe();
                    }
                    break;
                case 40101:
                    var2 = this.getReflection().getDoor(16180033);
                    if (var2 != null) {
                        var2.openMe();
                    }
            }
        }

    }
}

Мобы 40100 40101 имеют тип <set name="type" value="EventReflectionMob"/>

Файл с расширением ext.jar добавил в папку с gameserver.

Итог:
Двери не открываются.
 
kartia29 вместо EventReflectionMob вставь
Тыж сам название класса поменял, соответственно меняй и тип

Хотя могу ошибаться, но попробуй, занимался этим давненько)
 
Last edited:
Попробовал
kartia29 вместо EventReflectionMob вставь
Огромное тебе спасибо.

Надо было просто в public class kartia29 extends MonsterInstance сделать public class Kartia29Instance extends MonsterInstance
И тип моба ставить <set name="type" value="Kartia29"/>
 
Попробовал

Огромное тебе спасибо.

Надо было просто в public class kartia29 extends MonsterInstance сделать public class Kartia29Instance extends MonsterInstance
И тип моба ставить <set name="type" value="Kartia29"/>
:D Во память меня не подвела
 
Back
Top