Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Entering the Color Zone by Bluur (L2jBrasil)
- CORE
- ### Eclipse Workspace Patch 1.0
- Index: java/net/sf/l2j/gameserver/model/zone/ZoneId.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/zone/ZoneId.java (revision 1)
- +++ java/net/sf/l2j/gameserver/model/zone/ZoneId.java (working copy)
- @@ -38,7 +38,8 @@
- DANGER_AREA(15),
- CAST_ON_ARTIFACT(16),
- NO_RESTART(17),
- - SCRIPT(18);
- + SCRIPT(18),
- + COLOR_ZONE(19);
- private final int _id;
- Index: java/net/sf/l2j/gameserver/model/zone/type/L2ColorZone.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/zone/type/L2ColorZone.java (revision 0)
- +++ java/net/sf/l2j/gameserver/model/zone/type/L2ColorZone.java (working copy)
- @@ -0,0 +1,93 @@
- +/*
- + * 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.zone.type;
- +
- +import net.sf.l2j.gameserver.model.actor.L2Character;
- +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- +import net.sf.l2j.gameserver.model.zone.L2SpawnZone;
- +import net.sf.l2j.gameserver.model.zone.ZoneId;
- +import net.sf.l2j.gameserver.network.serverpackets.ExShowScreenMessage;
- +
- +/**
- + * @author Bluur
- + * @version 1.0
- + */
- +public class L2ColorZone extends L2SpawnZone
- +{
- + private int colorNamePlayer;
- + private boolean enableMessageOnEnter;
- + private String messageTextOnEnter;
- + private int durationMessage;
- +
- + public L2ColorZone(int id)
- + {
- + super(id);
- + }
- +
- + @Override
- + protected void onEnter(L2Character character)
- + {
- + character.setInsideZone(ZoneId.COLOR_ZONE, true);
- +
- + if (character instanceof L2PcInstance)
- + {
- + final L2PcInstance player = (L2PcInstance ) character;
- +
- + if (enableMessageOnEnter && !messageTextOnEnter.isEmpty())
- + player.sendPacket(new ExShowScreenMessage(messageTextOnEnter, durationMessage ));
- +
- + player.setColorNameInZone(player.getAppearance().getNameColor());
- + player.getAppearance().setNameColor(colorNamePlayer);
- + player.broadcastUserInfo();
- + }
- + }
- +
- + @Override
- + protected void onExit(L2Character character)
- + {
- + character.setInsideZone(ZoneId.COLOR_ZONE, false);
- +
- + if (character instanceof L2PcInstance)
- + {
- + final L2PcInstance player = (L2PcInstance ) character;
- + player.getAppearance().setNameColor(player.getColorNameInZone());
- + player.broadcastUserInfo();
- + }
- + }
- +
- + @Override
- + public void onDieInside(L2Character character)
- + {
- + }
- +
- + @Override
- + public void onReviveInside(L2Character character)
- + {
- + }
- +
- + @Override
- + public void setParameter(String name, String value)
- + {
- + if (name.equals("ColorNamePlayer"))
- + colorNamePlayer = Integer.decode("0x" + value);
- + else if (name.equals("EnableMessageOnEnter"))
- + enableMessageOnEnter = Boolean.parseBoolean(value);
- + else if (name.equals("MessageTextOnEnter"))
- + messageTextOnEnter = value;
- + else if (name.equals("DurationMessage"))
- + durationMessage = Integer.parseInt(value) * 1000;
- + }
- +}
- Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 1)
- +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy)
- private boolean _hero = false;
- + // saves the color name of the player entering the area L2ColorZone
- + private int _colorNameInZone;
- +
- private L2Npc _currentFolkNpc = null;
- @@ -8052,6 +8072,15 @@
- return _hero;
- }
- + public int getColorNameInZone()
- + {
- + return _colorNameInZone;
- + }
- + public void setColorNameInZone(int color)
- + {
- + _colorNameInZone = color;
- + }
- +
- public boolean isInOlympiadMode()
- {
- return _inOlympiadMode;
- DP
- zones/ColorZone.xml
- <?xml version="1.0" encoding="UTF-8"?>
- <list>
- <zone type="ColorZone" shape="NPoly" minZ="-3600" maxZ="-3400"><!-- Floran Village -->
- <node X="16529" Y="170516" />
- <node X="16645" Y="170141" />
- <node X="16747" Y="169833" />
- <node X="16770" Y="169677" />
- <node X="16822" Y="169464" />
- <node X="16858" Y="169431" />
- <node X="17457" Y="169398" />
- <node X="17939" Y="169475" />
- <node X="18109" Y="169528" />
- <node X="18435" Y="169666" />
- <node X="18628" Y="169781" />
- <node X="18641" Y="169828" />
- <node X="18531" Y="170204" />
- <node X="18473" Y="170530" />
- <node X="18452" Y="170686" />
- <node X="18394" Y="170900" />
- <node X="18361" Y="170937" />
- <node X="17771" Y="170962" />
- <node X="17220" Y="170888" />
- <node X="16897" Y="170757" />
- <node X="16543" Y="170561" />
- <!-- Color name -->
- <stat name="ColorNamePlayer" val="00FF00" />
- <stat name="EnableMessageOnEnter" val="true" />
- <stat name="MessageTextOnEnter" val="Entering the Color Zone!" />
- <stat name="DurationMessage" val="5" /> <!-- in seconds -->
- </zone>
- </list>
Advertisement
Add Comment
Please, Sign In to add comment