Skip to content
La2Base
Home
DownloadsWikiForumFAQ
Search
ruen
Sign up Login
HomeFilesWikiLogin
  • Home
  • Downloads
  • Wiki
  • FAQ
  • Contact Us
  • About
  • Rules
  • Privacy
  • Terms of Service

© 2026 la2base.com · All rights reserved

ruen
Forum/Дополнения от наших пользователей/Эвент Зомби
Search

Эвент Зомби

24 replies837 viewsCurrently viewing: 1
J
Juniorla

User

Участник

Posts: 86

На форуме с: 05/28/2009

Репутация: +1

Рейтинг: 0

· 11/27/2009, 10:05 PM

Краткое изложение сути:
1. Это некое мероприятие, в котором принимают участие игроки вашего сервера.
2. Зарегистрировавшись, через 15 минут игроков телепортирует в зону, где и развиваются события.
3. Через минуту один из игроков становится зомби и преследует других игроков, запятнав другого, тот становится зомби.
4. В итоге, либо все игроки были инфицированы, либо все зомби убиты, конец игры и соответственно победителю награда.

Патч на ядро:

Раскрывающийся текст
Код
### Eclipse Workspace Patch 1.0
#P L2_GameServer
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java    (revision 3514)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java    (working copy)
@@ -135,6 +138,8 @@
import net.sf.l2j.gameserver.model.entity.L2Event;
import net.sf.l2j.gameserver.model.entity.Siege;
import net.sf.l2j.gameserver.model.entity.TvTEvent;
+import net.sf.l2j.gameserver.model.entity.Biohazard;
import net.sf.l2j.gameserver.model.itemcontainer.Inventory;
import net.sf.l2j.gameserver.model.itemcontainer.ItemContainer;
import net.sf.l2j.gameserver.model.itemcontainer.PcFreight;
@@ -505,7 +522,82 @@
    private int _obsY;
    private int _obsZ;
    private boolean _observerMode = false;
+    
+    public boolean _isZombie = false;
+    public void setIsZombie(boolean a)
+    {
+        _isZombie = a;
+    }
+    public boolean isZombie()
+    {
+        return _isZombie;
+    }
+    
+    public int _bracket = 0;
+    
+    public void countBracket()
+    {
+        
+    }
+    
    /** Stored from last ValidatePosition **/
    private Point3D _lastServerPosition = new Point3D(0, 0, 0);
@@ -4377,7 +4645,6 @@
    {
        // Send a Server->Client packet UserInfo to this L2PcInstance
        sendPacket(new UserInfo(this));
-        sendPacket(new ExBrExtraUserInfo(this));

        // Send a Server->Client packet CharInfo to all L2PcInstance in _KnownPlayers of the L2PcInstance
        if (Config.DEBUG)
@@ -4867,6 +5134,8 @@
    
     public void untransform()
     {
+        if (inBiohazard() && Biohazard.isStarted() && _transformation != null && isZombie())
+            return;
         if (_transformation != null)
         {
             setTransformAllowedSkills(new int[]{});
@@ -5308,6 +5577,22 @@
        if (!super.doDie(killer))
            return false;
        
+        if (killer instanceof L2PcInstance)
+        {
+            L2PcInstance pl = (L2PcInstance) killer;
+            if (inBiohazard() && !isZombie() && pl.inBiohazard() && pl.isZombie() && Biohazard.isStarted())
+            {
+                pl.abortAttack();
+                pl.abortCast();
+                doRevive();
+                Biohazard.infectPlayer(this);
+                stopAllEffects();
+                setCurrentHp(getMaxHp());
+                setCurrentMp(getMaxMp());
+                setCurrentCp(getMaxCp());
+            }
+        }
+        
        if (isMounted())
            stopFeed();
        synchronized (this)
@@ -5424,12 +5732,33 @@
        {
            reviveRequest(this, null, false);
        }
+        
+        if (isZombie() && inBiohazard())
+        {
+            if(Biohazard._infected.contains(this))
+            {
+                Biohazard._infected.remove(this);
+                untransform();
+                if (Biohazard._infected.size() == 0)
+                    Biohazard.playersWin();
+            }
+        }
        return true;
    }
@@ -8365,7 +8873,25 @@
        // Check if the attacker isn't the L2PcInstance Pet
        if (attacker == this || attacker == getPet())
            return false;
-
+    
+        if (attacker instanceof L2PcInstance && this.OnDeathMatch && ((L2PcInstance)attacker).OnDeathMatch)
+            return true;
+        
+        L2PcInstance player = null;
+        if (attacker instanceof L2PcInstance)
+            player = (L2PcInstance) attacker;
+        if (attacker instanceof L2SummonInstance)
+            player = ((L2SummonInstance) attacker).getOwner();
+        
+        if (player != null)
+            if (Biohazard.isStarted() && player.inBiohazard() && inBiohazard() && player.isZombie() != isZombie())
+                return true;
        // TODO: check for friendly mobs
        // Check if the attacker is a L2MonsterInstance
        if (attacker instanceof L2MonsterInstance)
@@ -8753,18 +9279,54 @@
             sendPacket(ActionFailed.STATIC_PACKET);
             return false;
         }
-
+        
+        if (skill.getId() == 619 && inBiohazard() && isZombie())
+            return false;
+        
         //************************************* Check Skill Type *******************************************
-
         // Check if this is offensive magic skill
         if (skill.isOffensive())
        {
-            if ((isInsidePeaceZone(this, target)) && !getAccessLevel().allowPeaceAttack())
+            boolean cond = true;
+            L2PcInstance trgtF = null;
+            if (target instanceof L2PcInstance)
+                trgtF = (L2PcInstance)target;
+            else if (target instanceof L2SummonInstance)
+                trgtF = ((L2SummonInstance)target).getOwner();
+            if (trgtF != null)
-             {
-                // If L2Character or target is in a peace zone, send a system message TARGET_IN_PEACEZONE a Server->Client packet ActionFailed
-                sendPacket(new SystemMessage(SystemMessageId.TARGET_IN_PEACEZONE));
-                sendPacket(ActionFailed.STATIC_PACKET);
+                if (Biohazard.isStarted() && trgtF.inBiohazard() && inBiohazard())
+                {
+                    if (trgtF.isZombie() != isZombie())
+                        cond = true;
+                    if (trgtF.isZombie() == isZombie())
+                        cond = false;
+                }
+
+            if (!cond)
                return false;
            }

            if (isInOlympiadMode() && !isOlympiadStart()){
@@ -9179,6 +9748,8 @@
        {
            if(skill.isPvpSkill()) // pvp skill
            {
+                if (Biohazard.isStarted() && inBiohazard() && ((L2PcInstance)target).inBiohazard() && isZombie() != ((L2PcInstance)target).isZombie())
+                    return true;
                if(getClan() != null && ((L2PcInstance)target).getClan() != null)
                {
                    if(getClan().isAtWarWith(((L2PcInstance)target).getClan().getClanId()) && ((L2PcInstance)target).getClan().isAtWarWith(getClan().getClanId()))
@@ -11416,7 +11996,16 @@
        {
            _log.log(Level.SEVERE, "deleteMe()", e);
        }
-
+        
+        try
+        {
+            Biohazard.onLogout(this);
+        }
+        catch (Exception e)
+        {
+            _log.log(Level.SEVERE, "deleteMe()", e);
+        }
+        
        // Update database with items in its inventory and remove them from the world
        try
        {
Index: java/net/sf/l2j/gameserver/model/entity/Biohazard.java
===================================================================
--- java/net/sf/l2j/gameserver/model/entity/Biohazard.java    (revision 0)
+++ java/net/sf/l2j/gameserver/model/entity/Biohazard.java    (revision 0)
@@ -0,0 +1,313 @@
+/*
+ * 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 net.sf.l2j.gameserver.model.entity;
+
+import java.util.Calendar;
+import java.util.logging.Logger;
+
+import javolution.util.FastSet;
+import net.sf.l2j.gameserver.Announcements;
+import net.sf.l2j.gameserver.instancemanager.TransformationManager;
+import net.sf.l2j.gameserver.model.L2World;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.model.olympiad.Olympiad;
+import net.sf.l2j.gameserver.network.serverpackets.PlaySound;
+import net.sf.l2j.gameserver.util.Broadcast;
+import net.sf.l2j.util.Rnd;
+
+/**
+ * @author Laikeriz
+ */
+public class Biohazard
+{
+    enum EventState
+    {
+        INACTIVE,
+        INACTIVATING,
+        REGISTERING,
+        STARTED,
+        REWARDING
+    }
+
+    private final static Logger _log = Logger.getLogger(Biohazard.class.getName());
+    private static EventState _state = EventState.INACTIVE;
+    
+    public static FastSet<L2PcInstance> _participants = new FastSet<L2PcInstance>();
+    public static FastSet<L2PcInstance> _infected = new FastSet<L2PcInstance>();
+    public static FastSet<L2PcInstance> _notInfected = new FastSet<L2PcInstance>();
+    
+    public static boolean isStarted()
+    {
+        if (_state == EventState.STARTED)
+            return true;
+        return false;
+    }
+    
+    public static boolean isRegistering()
+    {
+        if (_state == EventState.REGISTERING)
+            return true;
+        return false;
+    }
+    
+    public static void startRegistering()
+    {
+        if (_state == EventState.REGISTERING || _state == EventState.STARTED)
+            return;
+        Announcements.getInstance().announceToAll("Biohazard: Registration is open.");
+        Announcements.getInstance().announceToAll("Biohazard: Type \".bhreg\" to register to event.");
+        Announcements.getInstance().announceToAll("Biohazard: Type \".bhunreg\" to unregister from event.");
+        _state = EventState.REGISTERING;
+        int step = 0;
+        int after = 0;
+        for (int i = 40; i > 0; i-=10)
+        {
+            switch(i)
+            {
+                case 40:
+                    step = 5;
+                    after = 15;
+                    break;
+                case 30:
+                    step = 5;
+                    after = 10;
+                    break;
+                case 20:
+                    step = 4;
+                    after = 5;
+                    break;
+                case 10:
+                    step = 1;
+                    after = 1;
+                    break;
+            }
+            if (_state == EventState.INACTIVE)
+                return;
+            Announcements.getInstance().announceToAll("Biohazard: Registration will be closed in " + after + " minute(s).");
+            try{Thread.sleep(step*60000);}catch (Exception e){}
+        }
+        sound = "";
+        try{Thread.sleep(60000);}catch (Exception e){}
+        if (_state == EventState.INACTIVE)
+            return;
+        if (_participants.size() >= 2)
+        {
+            Announcements.getInstance().announceToAll("Biohazard: Teleporting players in 20 seconds.");
+            try{Thread.sleep(20000);}catch (Exception e){}
+            _state = EventState.STARTED;
+            startEventAndTelePl();
+        }
+        else
+            Announcements.getInstance().announceToAll("Biohazard: Event aborted due to lack of participants.");
+    }
+    
+    public static void addParticipant(L2PcInstance player)
+    {
+        if (Olympiad.getInstance().isRegistered(player) || TvTEvent.isPlayerParticipant(player.getObjectId()))
+        {
+            player.sendMessage("You cannot register because of registration in another event");
+            return;
+        }
+        if (_state == EventState.REGISTERING && !_participants.contains(player))
+        {
+            _participants.add(player);
+            player.sendMessage("You have successfully registered to this event");
+        }
+        else
+            player.sendMessage("You are already registered or it's not registration time.");
+    }
+    
+    public static void removeParticipant(L2PcInstance player)
+    {
+        if (_state == EventState.REGISTERING)
+        {
+            if (_participants.contains(player))
+                _participants.remove(player);
+            else
+                player.sendMessage("You aren't registered in this event.");
+            player.setIsInBiohazard(false);
+        }
+        else
+            player.sendMessage("It's not registration time.");
+    }
+    public static void startEventAndTelePl()
+    {
+        if (_state == EventState.INACTIVE)
+            return;
+        synchronized(_participants)
+        {
+            for (L2PcInstance pl : _participants)
+                if (pl.isOnline() == 1)
+                {
+                    _notInfected.add(pl);
+                    pl._oldX = pl.getX();
+                    pl._oldY = pl.getY();
+                    pl._oldZ = pl.getZ();
+                    pl.teleToLocation(-17507,143206,-3911);
+                    pl.setTeam(0);
+                    pl.setIsInBiohazard(true);
+                    pl.untransform();
+                }
+        }
+    Announcements.getInstance().announceToAll("Biohazard: Teleportion done.");
+    Announcements.getInstance().announceToAll("Biohazard: One player was infected by untreatable virus!");
+    Announcements.getInstance().announceToAll("Biohazard: In about one minute virus will take over his body and he will become zombie!");
+    try{Thread.sleep(60000);}catch (Exception e){}
+    int num = Math.round(Rnd.get(_notInfected.size()-1));
+    L2PcInstance infectFirst = ((L2PcInstance[])getAllNotInfected())[num];
+    infectPlayer(infectFirst);
+    Announcements.getInstance().announceToAll("Biohazard: Virus took over " + infectFirst.getName() + " body and he wants to infect everybody else!");
+    }
+    
+    public static void infectPlayer(L2PcInstance zombie)
+    {
+        if (_state == EventState.INACTIVE)
+            return;
+        if (zombie.isTransformed())
+            zombie.untransform();
+        zombie.setIsZombie(true);
+        _notInfected.remove(zombie);
+        _infected.add(zombie);
+        TransformationManager.getInstance().transformPlayer(303, zombie);
+        if (_notInfected.size() == 0)
+            zombiesWin();
+    }
+    
+    public static void onLogout(L2PcInstance playerInstance)
+    {
+        if (_state == EventState.REGISTERING)
+            removeParticipant(playerInstance);
+        else if (_state == EventState.STARTED)
+        {
+            playerInstance.setXYZ(playerInstance._oldX,playerInstance._oldY,playerInstance._oldZ);
+            if (!playerInstance.isZombie())
+                _notInfected.remove(playerInstance);
+            else if (playerInstance.isZombie())
+                _infected.remove(playerInstance);
+            if (_notInfected.size() == 0)
+                zombiesWin();
+            if (_infected.size() == 0)
+                playersWin();
+        }
+    }
+    
+    public static void zombiesWin()
+    {
+        if (_state == EventState.INACTIVE)
+            return;
+        Announcements.getInstance().announceToAll("Biohazard: Zombies won.");
+        Announcements.getInstance().announceToAll("Biohazard: Rewarding and teleporting participants back to village in 20 seconds.");
+        _state = EventState.REWARDING;
+        try{Thread.sleep(20000);}catch (Exception e){}
+        synchronized(_infected)
+        {
+            for (L2PcInstance pl : _infected)
+                if (pl.isOnline() == 1)
+                    pl.addItem("Biohazard", 6673, 1, pl, true);
+        }
+        synchronized(_participants)
+        {
+            for (L2PcInstance pl : _participants)
+                if (pl.isOnline() == 1)
+                {
+                    pl.teleToLocation(pl._oldX,pl._oldY,pl._oldZ);
+                    pl.setIsInBiohazard(false);
+//                    if (pl.inWorld() == 1)
+                        pl.setTeam(pl.getFactionId());
+                    if (pl.isTransformed())
+                        pl.untransform();
+                }
+        }
+        _participants.clear();
+        _infected.clear();
+        _notInfected.clear();
+        _state = EventState.INACTIVE;
+    }
+    
+    public static void playersWin()
+    {
+        Announcements.getInstance().announceToAll("Biohazard: Players won.");
+        Announcements.getInstance().announceToAll("Biohazard: Rewarding and teleporting participants back to village in 20 seconds.");
+        _state = EventState.REWARDING;
+        try{Thread.sleep(20000);}catch (Exception e){}
+        synchronized(_notInfected)
+        {
+            for (L2PcInstance pl : _notInfected)
+                if (pl.isOnline() == 1)
+                {
+                    pl.addItem("Biohazard", 6673, 1, pl, true);
+                }
+        }
+        synchronized(_participants)
+        {
+            for (L2PcInstance pl : _participants)
+                if (pl.isOnline() == 1)
+                {
+                    pl.teleToLocation(pl._oldX,pl._oldY,pl._oldZ);
+                    pl.setIsInBiohazard(false);
+//                    if (pl.inWorld() == 1)
+                        pl.setTeam(pl.getFactionId());
+                    if (pl.isTransformed())
+                        pl.untransform();
+                }
+        }
+        _participants.clear();
+        _infected.clear();
+        _notInfected.clear();
+        _state = EventState.INACTIVE;
+    }
+    
+    public static L2PcInstance[] getAllNotInfected()
+    {
+        synchronized(_notInfected)
+        {
+            return _notInfected.toArray(new L2PcInstance[_notInfected.size()]);
+        }
+    }
+    
+    public static void abortEvent()
+    {
+        _state = EventState.INACTIVE;
+        _participants.clear();
+        _notInfected.clear();
+        _infected.clear();
+        Announcements.getInstance().announceToAll("Biohazard: Event aborted.");
+    }
+}


Патч на Датапак

Раскрывающийся текст
Код
### Eclipse Workspace Patch 1.0
#P voicedcommandhandlers
Index: castle.java
===================================================================
--- castle.java    (revision 6775)
+++ castle.java    (working copy)
@@ -19,6 +19,7 @@
import net.sf.l2j.gameserver.model.actor.instance.L2DoorInstance;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.entity.Castle;
+import net.sf.l2j.gameserver.model.entity.Biohazard;

/**
  *
@@ -30,7 +31,9 @@
    {
        "open doors",
        "close doors",
-        "ride wyvern"
+        "ride wyvern",
+        "bhreg",
+        "bhunreg"
    };
    
    /**
@@ -70,6 +73,10 @@
                activeChar.mount(12621, 0, true);
            }
        }
+        else if (command.equalsIgnoreCase("bhreg"))
+            Biohazard.addParticipant(playerInstance);
+        else if (command.equalsIgnoreCase("bhunreg"))
+            Biohazard.removeParticipant(playerInstance);
        return true;
    }

Index: AdminEventEngine.java
===================================================================
--- AdminEventEngine.java    (revision 6775)
+++ AdminEventEngine.java    (working copy)
@@ -34,6 +34,7 @@
import net.sf.l2j.gameserver.model.actor.L2Npc;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.entity.L2Event;
+import net.sf.l2j.gameserver.model.entity.Biohazard;
import net.sf.l2j.gameserver.network.serverpackets.CharInfo;
import net.sf.l2j.gameserver.network.serverpackets.ExBrExtraUserInfo;
import net.sf.l2j.gameserver.network.serverpackets.ItemList;
@@ -74,7 +75,9 @@
        "admin_event_control_unpoly",
        "admin_event_control_prize",
        "admin_event_control_chatban",
-        "admin_event_control_finish"
+        "admin_event_control_finish",
+        "admin_bh_start",
+        "admin_bh_abort"
    };
    
    private static String tempBuffer = "";
@@ -90,6 +93,14 @@
        {
            showNewEventPage(activeChar);
        }
+        else if (command.equals("admin_bh_start"))
+        {
+            Biohazard.startRegistering();
+        }
+        else if (command.equals("admin_bh_abort"))
+        {
+            Biohazard.abortEvent();
+        }
        else if (command.startsWith("admin_add"))
        {
            tempBuffer += command.substring(10);


sql

Код
INSERT INTO `admin_command_access_rights` VALUES ('admin_bh_abort', '1');
INSERT INTO `admin_command_access_rights` VALUES ('admin_bh_start', '1');


Всем удачи, юзайте на серваках. ;)

0
L
lekicha
· 11/28/2009, 05:42 AM

на La2base работает? там нету таблици admin_command_access_rights

0
F
Fred Perry
· 11/28/2009, 06:23 AM

Прям как в КС Зомби Мод)

0
T
TosikZOL
· 11/28/2009, 06:32 AM

Классно!спасибо! попробую на питоне реализовать может что то и получится !

0
J
justegg53
· 11/28/2009, 07:54 AM

Спасибо большое, пойду ставить, огромное спасибо за работу.

0
E
Esso-4ever
· 11/28/2009, 08:18 AM

Автору большой респектище.Давно хотел реализовать что-то на подобее этого у себя :)

Кст автор,вот идейка...

Можно сделать эвент,на подобее одной из карт КС death_run.

Вообщем,запустить игроков в какую-то локацию... И сделать чтобы в неопределенной время,в этой локации что-то происходило... Даеться например 5 минут и нужно выжить!
В локации спавняться какие-то сильные мобы или Эпик РБ к примеру,которые сразу дамажат всех игроков.
Ну вообщем и назвать этот эвент "Последний Герой". А за эвент можно сделать либо геройство до рестарта(Кст,это даже лучше,так как игроки не захотят выходить с игры,чтобы не потерять хиро... Чем существенно поднимет онлайн в статистике) xD

Если хочешь реализовать мою идею,могу помочь с продумкой сюжета и прочих мелочей.. ну а с тебя только знания явы :)
Вот если что обращайся в ICQ:243148.

0
T
TosikZOL
· 11/28/2009, 08:26 AM

Эвент ЛастХиро - Последний герой уже есть но другой =) придумай другое название !

0
-
-=Fly^Prince=-
· 11/28/2009, 08:59 AM

Делал не Malder тупо спизждено с MaxCheaters и не указан копирайт... _http://www.maxcheaters.com/forum/index.php?topic=103178.0

0
E
Esso-4ever
· 11/28/2009, 09:06 AM

А как название "1st after God" ? Что в переводе означает "Первый после Бога".

0
E
Esso-4ever
· 11/28/2009, 09:30 AM

Есть человек который толково знает Java,для реализации эвентов?
Есть куча хороших идей,могу обьяснить на примере чьих можно брать исходники для написания.
Деньги естественно не заплачу..но думаю что сие чудо будет выгодно и для меня и для программера.

0
Lapa
Lapa

User

Бывалый

Posts: 202

На форуме с: 01/26/2008

Репутация: +320

Рейтинг: 0

· 11/28/2009, 09:36 AM

Народ помогите плз качественно влить в этот файл _http://rghost.ru/652069

Вот это...... Буду очччччччень очень благодарен


Вот переделанный импорт

Раскрывающийся текст
### Eclipse Workspace Patch 1.0
#P L2_GameServer
Index: java/com/l2scoria/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/com/l2scoria/gameserver/actor/instance/L2PcInstance.java (revision 3514)
+++ java/com/l2scoria/gameserver/actor/instance/L2PcInstance.java (working copy)
@@ -135,6 +138,8 @@
import com.l2scoria.gameserver.model.entity.L2Event;
import com.l2scoria.gameserver.model.entity.Siege;
import com.l2scoria.gameserver.model.entity.TvTEvent;
+import com.l2scoria.gameserver.model.entity.Biohazard;
import com.l2scoria.gameserver.model.itemcontainer.Inventory;
import com.l2scoria.gameserver.model.itemcontainer.ItemContainer;
import com.l2scoria.gameserver.model.itemcontainer.PcFreight;
@@ -505,7 +522,82 @@
private int _obsY;
private int _obsZ;
private boolean _observerMode = false;
+
+ public boolean _isZombie = false;
+ public void setIsZombie(boolean a)
+ {
+ _isZombie = a;
+ }
+ public boolean isZombie()
+ {
+ return _isZombie;
+ }
+
+ public int _bracket = 0;
+
+ public void countBracket()
+ {
+
+ }
+
/** Stored from last ValidatePosition **/
private Point3D _lastServerPosition = new Point3D(0, 0, 0);
@@ -4377,7 +4645,6 @@
{
// Send a Server->Client packet UserInfo to this L2PcInstance
sendPacket(new UserInfo(this));
- sendPacket(new ExBrExtraUserInfo(this));

// Send a Server->Client packet CharInfo to all L2PcInstance in _KnownPlayers of the L2PcInstance
if (Config.DEBUG)
@@ -4867,6 +5134,8 @@

public void untransform()
{
+ if (inBiohazard() && Biohazard.isStarted() && _transformation != null && isZombie())
+ return;
if (_transformation != null)
{
setTransformAllowedSkills(new int[]{});
@@ -5308,6 +5577,22 @@
if (!super.doDie(killer))
return false;

+ if (killer instanceof L2PcInstance)
+ {
+ L2PcInstance pl = (L2PcInstance) killer;
+ if (inBiohazard() && !isZombie() && pl.inBiohazard() && pl.isZombie() && Biohazard.isStarted())
+ {
+ pl.abortAttack();
+ pl.abortCast();
+ doRevive();
+ Biohazard.infectPlayer(this);
+ stopAllEffects();
+ setCurrentHp(getMaxHp());
+ setCurrentMp(getMaxMp());
+ setCurrentCp(getMaxCp());
+ }
+ }
+
if (isMounted())
stopFeed();
synchronized (this)
@@ -5424,12 +5732,33 @@
{
reviveRequest(this, null, false);
}
+
+ if (isZombie() && inBiohazard())
+ {
+ if(Biohazard._infected.contains(this))
+ {
+ Biohazard._infected.remove(this);
+ untransform();
+ if (Biohazard._infected.size() == 0)
+ Biohazard.playersWin();
+ }
+ }
return true;
}
@@ -8365,7 +8873,25 @@
// Check if the attacker isn't the L2PcInstance Pet
if (attacker == this || attacker == getPet())
return false;
-
+
+ if (attacker instanceof L2PcInstance && this.OnDeathMatch && ((L2PcInstance)attacker).OnDeathMatch)
+ return true;
+
+ L2PcInstance player = null;
+ if (attacker instanceof L2PcInstance)
+ player = (L2PcInstance) attacker;
+ if (attacker instanceof L2SummonInstance)
+ player = ((L2SummonInstance) attacker).getOwner();
+
+ if (player != null)
+ if (Biohazard.isStarted() && player.inBiohazard() && inBiohazard() && player.isZombie() != isZombie())
+ return true;
// TODO: check for friendly mobs
// Check if the attacker is a L2MonsterInstance
if (attacker instanceof L2MonsterInstance)
@@ -8753,18 +9279,54 @@
sendPacket(ActionFailed.STATIC_PACKET);
return false;
}
-
+
+ if (skill.getId() == 619 && inBiohazard() && isZombie())
+ return false;
+
//************************************* Check Skill Type *******************************************
-
// Check if this is offensive magic skill
if (skill.isOffensive())
{
- if ((isInsidePeaceZone(this, target)) && !getAccessLevel().allowPeaceAttack())
+ boolean cond = true;
+ L2PcInstance trgtF = null;
+ if (target instanceof L2PcInstance)
+ trgtF = (L2PcInstance)target;
+ else if (target instanceof L2SummonInstance)
+ trgtF = ((L2SummonInstance)target).getOwner();
+ if (trgtF != null)
- {
- // If L2Character or target is in a peace zone, send a system message TARGET_IN_PEACEZONE a Server->Client packet ActionFailed
- sendPacket(new SystemMessage(SystemMessageId.TARGET_IN_PEACEZONE));
- sendPacket(ActionFailed.STATIC_PACKET);
+ if (Biohazard.isStarted() && trgtF.inBiohazard() && inBiohazard())
+ {
+ if (trgtF.isZombie() != isZombie())
+ cond = true;
+ if (trgtF.isZombie() == isZombie())
+ cond = false;
+ }
+
+ if (!cond)
return false;
}

if (isInOlympiadMode() && !isOlympiadStart()){
@@ -9179,6 +9748,8 @@
{
if(skill.isPvpSkill()) // pvp skill
{
+ if (Biohazard.isStarted() && inBiohazard() && ((L2PcInstance)target).inBiohazard() && isZombie() != ((L2PcInstance)target).isZombie())
+ return true;
if(getClan() != null && ((L2PcInstance)target).getClan() != null)
{
if(getClan().isAtWarWith(((L2PcInstance)target).getClan().getClanId()) && ((L2PcInstance)target).getClan().isAtWarWith(getClan().getClanId()))
@@ -11416,7 +11996,16 @@
{
_log.log(Level.SEVERE, "deleteMe()", e);
}
-
+
+ try
+ {
+ Biohazard.onLogout(this);
+ }
+ catch (Exception e)
+ {
+ _log.log(Level.SEVERE, "deleteMe()", e);
+ }
+
// Update database with items in its inventory and remove them from the world
try
{
Index: java/com/l2scoria/gameserver/model/entity/Biohazard.java
===================================================================
--- java/net/sf/l2j/gameserver/model/entity/Biohazard.java (revision 0)
+++ java/net/sf/l2j/gameserver/model/entity/Biohazard.java (revision 0)
@@ -0,0 +1,313 @@
+/*
+ * 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.l2scoria.gameserver.model.entity;
+
+import java.util.Calendar;
+import java.util.logging.Logger;
+
+import javolution.util.FastSet;
+import com.l2scoria.gameserver.Announcements;
+import com.l2scoria.gameserver.instancemanager.TransformationManager;
+import com.l2scoria.gameserver.model.L2World;
+import com.l2scoria.gameserver.model.actor.instance.L2PcInstance;
+import com.l2scoria.gameserver.model.olympiad.Olympiad;
+import com.l2scoria.gameserver.network.serverpackets.PlaySound;
+import com.l2scoria.gameserver.util.Broadcast;
+import com.l2scoria.util.Rnd;
+
+/**
+ * @author Laikeriz
+ */
+public class Biohazard
+{
+ enum EventState
+ {
+ INACTIVE,
+ INACTIVATING,
+ REGISTERING,
+ STARTED,
+ REWARDING
+ }
+
+ private final static Logger _log = Logger.getLogger(Biohazard.class.getName());
+ private static EventState _state = EventState.INACTIVE;
+
+ public static FastSet<L2PcInstance> _participants = new FastSet<L2PcInstance>();
+ public static FastSet<L2PcInstance> _infected = new FastSet<L2PcInstance>();
+ public static FastSet<L2PcInstance> _notInfected = new FastSet<L2PcInstance>();
+
+ public static boolean isStarted()
+ {
+ if (_state == EventState.STARTED)
+ return true;
+ return false;
+ }
+
+ public static boolean isRegistering()
+ {
+ if (_state == EventState.REGISTERING)
+ return true;
+ return false;
+ }
+
+ public static void startRegistering()
+ {
+ if (_state == EventState.REGISTERING || _state == EventState.STARTED)
+ return;
+ Announcements.getInstance().announceToAll("Biohazard: Registration is open.");
+ Announcements.getInstance().announceToAll("Biohazard: Type \".bhreg\" to register to event.");
+ Announcements.getInstance().announceToAll("Biohazard: Type \".bhunreg\" to unregister from event.");
+ _state = EventState.REGISTERING;
+ int step = 0;
+ int after = 0;
+ for (int i = 40; i > 0; i-=10)
+ {
+ switch(i)
+ {
+ case 40:
+ step = 5;
+ after = 15;
+ break;
+ case 30:
+ step = 5;
+ after = 10;
+ break;
+ case 20:
+ step = 4;
+ after = 5;
+ break;
+ case 10:
+ step = 1;
+ after = 1;
+ break;
+ }
+ if (_state == EventState.INACTIVE)
+ return;
+ Announcements.getInstance().announceToAll("Biohazard: Registration will be closed in " + after + " minute(s).");
+ try{Thread.sleep(step*60000);}catch (Exception e){}
+ }
+ sound = "";
+ try{Thread.sleep(60000);}catch (Exception e){}
+ if (_state == EventState.INACTIVE)
+ return;
+ if (_participants.size() >= 2)
+ {
+ Announcements.getInstance().announceToAll("Biohazard: Teleporting players in 20 seconds.");
+ try{Thread.sleep(20000);}catch (Exception e){}
+ _state = EventState.STARTED;
+ startEventAndTelePl();
+ }
+ else
+ Announcements.getInstance().announceToAll("Biohazard: Event aborted due to lack of participants.");
+ }
+
+ public static void addParticipant(L2PcInstance player)
+ {
+ if (Olympiad.getInstance().isRegistered(player) || TvTEvent.isPlayerParticipant(player.getObjectId()))
+ {
+ player.sendMessage("You cannot register because of registration in another event");
+ return;
+ }
+ if (_state == EventState.REGISTERING && !_participants.contains(player))
+ {
+ _participants.add(player);
+ player.sendMessage("You have successfully registered to this event");
+ }
+ else
+ player.sendMessage("You are already registered or it's not registration time.");
+ }
+
+ public static void removeParticipant(L2PcInstance player)
+ {
+ if (_state == EventState.REGISTERING)
+ {
+ if (_participants.contains(player))
+ _participants.remove(player);
+ else
+ player.sendMessage("You aren't registered in this event.");
+ player.setIsInBiohazard(false);
+ }
+ else
+ player.sendMessage("It's not registration time.");
+ }
+ public static void startEventAndTelePl()
+ {
+ if (_state == EventState.INACTIVE)
+ return;
+ synchronized(_participants)
+ {
+ for (L2PcInstance pl : _participants)
+ if (pl.isOnline() == 1)
+ {
+ _notInfected.add(pl);
+ pl._oldX = pl.getX();
+ pl._oldY = pl.getY();
+ pl._oldZ = pl.getZ();
+ pl.teleToLocation(-17507,143206,-3911);
+ pl.setTeam(0);
+ pl.setIsInBiohazard(true);
+ pl.untransform();
+ }
+ }
+ Announcements.getInstance().announceToAll("Biohazard: Teleportion done.");
+ Announcements.getInstance().announceToAll("Biohazard: One player was infected by untreatable virus!");
+ Announcements.getInstance().announceToAll("Biohazard: In about one minute virus will take over his body and he will become zombie!");
+ try{Thread.sleep(60000);}catch (Exception e){}
+ int num = Math.round(Rnd.get(_notInfected.size()-1));
+ L2PcInstance infectFirst = ((L2PcInstance[])getAllNotInfected())[num];
+ infectPlayer(infectFirst);
+ Announcements.getInstance().announceToAll("Biohazard: Virus took over " + infectFirst.getName() + " body and he wants to infect everybody else!");
+ }
+
+ public static void infectPlayer(L2PcInstance zombie)
+ {
+ if (_state == EventState.INACTIVE)
+ return;
+ if (zombie.isTransformed())
+ zombie.untransform();
+ zombie.setIsZombie(true);
+ _notInfected.remove(zombie);
+ _infected.add(zombie);
+ TransformationManager.getInstance().transformPlayer(303, zombie);
+ if (_notInfected.size() == 0)
+ zombiesWin();
+ }
+
+ public static void onLogout(L2PcInstance playerInstance)
+ {
+ if (_state == EventState.REGISTERING)
+ removeParticipant(playerInstance);
+ else if (_state == EventState.STARTED)
+ {
+ playerInstance.setXYZ(playerInstance._oldX,playerInstance._oldY,playerInstance._
oldZ);
+ if (!playerInstance.isZombie())
+ _notInfected.remove(playerInstance);
+ else if (playerInstance.isZombie())
+ _infected.remove(playerInstance);
+ if (_notInfected.size() == 0)
+ zombiesWin();
+ if (_infected.size() == 0)
+ playersWin();
+ }
+ }
+
+ public static void zombiesWin()
+ {
+ if (_state == EventState.INACTIVE)
+ return;
+ Announcements.getInstance().announceToAll("Biohazard: Zombies won.");
+ Announcements.getInstance().announceToAll("Biohazard: Rewarding and teleporting participants back to village in 20 seconds.");
+ _state = EventState.REWARDING;
+ try{Thread.sleep(20000);}catch (Exception e){}
+ synchronized(_infected)
+ {
+ for (L2PcInstance pl : _infected)
+ if (pl.isOnline() == 1)
+ pl.addItem("Biohazard", 6673, 1, pl, true);
+ }
+ synchronized(_participants)
+ {
+ for (L2PcInstance pl : _participants)
+ if (pl.isOnline() == 1)
+ {
+ pl.teleToLocation(pl._oldX,pl._oldY,pl._oldZ);
+ pl.setIsInBiohazard(false);
+// if (pl.inWorld() == 1)
+ pl.setTeam(pl.getFactionId());
+ if (pl.isTransformed())
+ pl.untransform();
+ }
+ }
+ _participants.clear();
+ _infected.clear();
+ _notInfected.clear();
+ _state = EventState.INACTIVE;
+ }
+
+ public static void playersWin()
+ {
+ Announcements.getInstance().announceToAll("Biohazard: Players won.");
+ Announcements.getInstance().announceToAll("Biohazard: Rewarding and teleporting participants back to village in 20 seconds.");
+ _state = EventState.REWARDING;
+ try{Thread.sleep(20000);}catch (Exception e){}
+ synchronized(_notInfected)
+ {
+ for (L2PcInstance pl : _notInfected)
+ if (pl.isOnline() == 1)
+ {
+ pl.addItem("Biohazard", 6673, 1, pl, true);
+ }
+ }
+ synchronized(_participants)
+ {
+ for (L2PcInstance pl : _participants)
+ if (pl.isOnline() == 1)
+ {
+ pl.teleToLocation(pl._oldX,pl._oldY,pl._oldZ);
+ pl.setIsInBiohazard(false);
+// if (pl.inWorld() == 1)
+ pl.setTeam(pl.getFactionId());
+ if (pl.isTransformed())
+ pl.untransform();
+ }
+ }
+ _participants.clear();
+ _infected.clear();
+ _notInfected.clear();
+ _state = EventState.INACTIVE;
+ }
+
+ public static L2PcInstance[] getAllNotInfected()
+ {
+ synchronized(_notInfected)
+ {
+ return _notInfected.toArray(new L2PcInstance[_notInfected.size()]);
+ }
+ }
+
+ public static void abortEvent()
+ {
+ _state = EventState.INACTIVE;
+ _participants.clear();
+ _notInfected.clear();
+ _infected.clear();
+ Announcements.getInstance().announceToAll("Biohazard: Event aborted.");
+ }
+}


И ешё хотелось бы узнать куда вливать этото всё, просто и понятно, для нубов 3c2f1c34aa11.gif 3c2f1c34aa11.gif 3c2f1c34aa11.gif

— Кот ЦАРЬ

0
Brain
Brain

User

Бывалый

Posts: 324

На форуме с: 07/17/2007

Репутация: +46

Рейтинг: 0

· 11/28/2009, 09:40 AM

скрины эвента в студию..))

Заходи на форум..епЭ xDD

0
J
Juniorla

User

Участник

Posts: 86

На форуме с: 05/28/2009

Репутация: +1

Рейтинг: 0

· 11/28/2009, 09:51 AM

Esso-4ever: Автору большой респектище.Давно хотел реализовать что-то на подобее этого у себя :)

Кст автор,вот идейка...

Можно сделать эвент,на подобее одной из карт КС death_run.

Вообщем,запустить игроков в какую-то локацию... И сделать чтобы в неопределенной время,в этой локации что-то происходило... Даеться например 5 минут и нужно выжить!
В локации спавняться какие-то сильные мобы или Эпик РБ к примеру,которые сразу дамажат всех игроков.
Ну вообщем и назвать этот эвент "Последний Герой". А за эвент можно сделать либо геройство до рестарта(Кст,это даже лучше,так как игроки не захотят выходить с игры,чтобы не потерять хиро... Чем существенно поднимет онлайн в статистике) xD

Если хочешь реализовать мою идею,могу помочь с продумкой сюжета и прочих мелочей.. ну а с тебя только знания явы :)
Вот если что обращайся в ICQ:243148.


Такая вещь делается за 1час ;)
И проще написать на питоне ;)
Можно и на яве ;)

Код
package net.sf.l2j.gameserver.model.actor.instance;

import java.util.List;
import java.util.StringTokenizer;
import java.util.Vector;

import net.sf.l2j.Config;
import net.sf.l2j.gameserver.model.entity.event.L2EventChecks;
import net.sf.l2j.gameserver.serverpackets.ActionFailed;
import net.sf.l2j.gameserver.serverpackets.ConfirmDlg;
import net.sf.l2j.gameserver.templates.L2NpcTemplate;

public class L2EventManagerInstance extends L2NpcInstance
{
    //Local Variables Definition
    //--------------------------
    /** Number of Current Events */
    public static int _currentEvents = 0;
    /** Players from which we're waiting an answer */
    public static Vector<L2PcInstance> _awaitingplayers = new Vector<L2PcInstance>();
    /** Players that will finally get inside the Event  */
    public static Vector<L2PcInstance> _finalPlayers = new Vector<L2PcInstance>();
    
    public L2EventManagerInstance(int objectId, L2NpcTemplate template)
    {
        super(objectId, template);
    }
    
    public void onBypassFeedback(L2PcInstance player, String command)
    {
        player.sendPacket(new ActionFailed());
        StringTokenizer st = new StringTokenizer(command, " ");
        String actualCommand = st.nextToken();
        _finalPlayers = new Vector<L2PcInstance>();
        
        if (actualCommand.equalsIgnoreCase("iEvent"))
        {
            try
            {
                /*Type:1- Single //2- Clan //3- Party*/
                   int type = Integer.parseInt(st.nextToken());
                   /*Required Event Points needed to participate*/
                   int eventPoints = Integer.parseInt(st.nextToken());
                   /* NpcId of the Event mobs */
                   int npcId = Integer.parseInt(st.nextToken());
                   /* Number of NPcs */
                   int npcAm =Integer.parseInt(st.nextToken());
                   /* Minimum number of needed persons players to participate */
                   int minPeople = Integer.parseInt(st.nextToken());
                   /* Minimum level to participate */
                   int minLevel = Integer.parseInt(st.nextToken());
                   /* Buff List to apply */
                   int bufflist = Integer.parseInt(st.nextToken());
                   /* Level of The Prize to Hand out */
                   int prizeLevel = Integer.parseInt(st.nextToken());
                   if (player == null){return;}
                this.setTarget(player);
                
                if (_currentEvents>=Config.RAID_SYSTEM_MAX_EVENTS)
                {
                    player.sendMessage("У вас "+_currentEvents+" уже эвентов. " +
                            "Wait untill one of them ends to get into another one.");
                    return;
                }
                
                if (L2EventChecks.usualChecks(player,minLevel))
                    _finalPlayers.add(player);
                else return;
                // If the player has passed the checks, then continue.
                switch (type)
                {
                // Case Clan Events.
                case 2:
                    {
                        if(player.getClan()== null)
                        {
                            player.sendMessage("У вас нет клана!");
                            return;
                        }
                        L2PcInstance[] onlineclanMembers = player.getClan().getOnlineMembers("");
                        for (L2PcInstance member: onlineclanMembers)
                        {
                            boolean eligible = true;
                            if(member == null)
                                continue;
                            if(!L2EventChecks.usualChecks(member,minLevel))
                                eligible = false;
                            if(eligible && !(_finalPlayers.contains(member)))
                                _finalPlayers.add(member);
                        }
                        if (_finalPlayers.size()>1 && _finalPlayers.size()>=minPeople)
                        {
                            player.setRaidParameters(player,type,eventPoints,npcId,npcAm,minPeople,bufflist,prizeLevel,this, _finalPlayers);
                            _awaitingplayers.add(player);
                            player.sendPacket(new ConfirmDlg(614," Данное"+(_finalPlayers.size())+" members of your "
                                    +" кол-во человек в клане маловато. Вы готовы?"));
                        }
                        else
                        {
                            String reason;
                            if(_finalPlayers.size()>1)
                                reason =": Only 1 Clan Member Online.";
                            else if(_finalPlayers.size()<minPeople)
                                reason =": Not enough members online to participate.";
                            else reason=".";
                            player.sendMessage("Cannot participate"+reason);
                        }
                        break;
                    }
                // Case Party Events.
                case 3:
                    {
                        if(player.getParty()== null)
                        {
                            player.sendMessage("У вас нет группы!");
                            return;
                        }
                        List<L2PcInstance> partyMembers = player.getParty().getPartyMembers();
                        for (L2PcInstance member: partyMembers)
                        {
                            boolean eligible = true;
                            if(member == null)
                                continue;
                            if(!L2EventChecks.usualChecks(member,minLevel))
                                eligible = false;
                            if(eligible && !(_finalPlayers.contains(member)))
                                _finalPlayers.add(member);
                        }
                        if ((_finalPlayers.size())>1 && _finalPlayers.size()>=minPeople)
                        {
                            player.setRaidParameters(player,type,eventPoints,npcId,npcAm,minPeople,bufflist,prizeLevel,this, _finalPlayers);
                            _awaitingplayers.add(player);
                            player.sendPacket(new ConfirmDlg(614," A total of "+(_finalPlayers.size())+" members of your " +
                                    "Пачки маловата. Вы всё таки готовы?"));
                        }
                        else
                        {
                            String reason;
                            if(_finalPlayers.size()>1)
                                reason =": Only 1 Party Member.";
                            else if(_finalPlayers.size()<minPeople)
                                reason =": Недостаточно народу для участия.";
                            else reason=".";
                            player.sendMessage("Cannot participate"+reason);
                        }
                        break;
                    }
                    
                default:
                {
                    player.setRaidParameters(player,type,eventPoints,npcId,npcAm,minPeople,bufflist,prizeLevel,this, _finalPlayers);
                    player.setRaidAnswear(1);        
                }
            }
                return;
                
            }
            catch (Exception e)
            {
                _log.warning("L2EventManagerInstance: Error while getting html command");
                e.printStackTrace();
            }
        }
        super.onBypassFeedback(player, command);
    }

    public String getHtmlPath(int npcId, int val)
    {
        String pom = "";
        if (val == 0)
        {            
            pom = "" + npcId;
        }
        else
        {
            pom = npcId + "-" + val;
        }

        return "data/html/event/" + pom + ".htm";
    }
    
    public static boolean addEvent()
    {
        if (_currentEvents>=Config.RAID_SYSTEM_MAX_EVENTS)
            return false;
        else
        {
            _currentEvents += 1;
            return true;
        }
    }
    
    public static boolean removeEvent()
    {
        if(_currentEvents>0)
        {
            _currentEvents-=1;
            return true;
        }
        else return false;
    }
}

0
T
TosikZOL
· 11/28/2009, 09:53 AM

Esso-4ever: Есть человек который толково знает Java,для реализации эвентов?
Есть куча хороших идей,могу объяснить на примере чьих можно брать исходники для написания.
Деньги естественно не заплачу..но думаю что сие чудо будет выгодно и для меня и для программера.


Да можно на питоне строчить =) в легкою!

0
E
Esso-4ever
· 11/28/2009, 09:56 AM

Похвально,надеюсь на тесное сотруднечиство))

0
T
TosikZOL
· 11/28/2009, 09:58 AM

Esso-4ever: Похвально,надеюсь на тесное сотруднечиство))


стукнул в ICQ!

0
L
lekicha
· 11/28/2009, 11:40 AM

на La2base работает? там нету таблици admin_command_access_rights

0
-
-=Fly^Prince=-
· 11/28/2009, 11:59 AM

Делал не Malder тупо спизждено с MaxCheaters и не указан копирайт... _http://www.maxcheaters.com/forum/index.php?topic=103178.0
P.S. Там же вариант и на питоне...

0
S
Sheriff
· 11/28/2009, 12:03 PM

Автор эвент нормально ложится на сборку ла2 база ?

0
E
Esso-4ever
· 11/28/2009, 12:21 PM

Так есть нормальный скриптер,который хочет присоедениться к серьезному проекту?
Если что ICQ:243-148.

0
Войдите или зарегистрируйтесь чтобы ответить