|
Você não é registrado, por favor registre-se para ter acesso ao conteúdo completo. Caso seja registrado, efetue login. Esqueceu sua senha? Clique aqui Recomendamos o uso do Mozilla Firefox para uma melhor visualização. |
|
| Início | Postados Hoje | Marcar Fóruns Como Lidos | Álbums | Banidos | SE Team | Medalhas |
|
|||||||
| Registrar | Loteria VIP | Staff SE | Regras do fórum | Comunidade | Arcade | Postados Hoje | Pesquisar | Experience |
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
![]() |
|
|
LinkBack | Ferramentas do Tópico | Modos de Exibição |
|
|
#1 (permalink) |
|
Membro - Veterano
![]() Registrado em: Dec 2009
Posts: 1,335
Agradeceu: 490
Agradecido 803 Vezes em 427 Posts
Nome Real: Roberto
|
Resolvi posta aqui para voces EVENTO DM ENGINE 100% Funcionando Perfeitamente
Código:
[Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]
Index: C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_CORE/java/config/Eventos/DM_Engine.ini
===================================================================
--- C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_CORE/java/config/Eventos/DM_Engine.ini (revision 0)
+++ C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_CORE/java/config/Eventos/DM_Engine.ini (revision 0)
@@ -0,0 +1,39 @@
+#===================================================================#
+# L2JTitanPlus Engine Event #
+#===================================================================#
+# #
+# These Settings have been added by the L2JTitanPlus Dev Team. #
+# However that does not mean that the L2JTitanPlus Dev Team Created #
+# all these customizations. All credits to respective owners! #
+# Your server will not be "retail" if you enable or use any of #
+# the below configurations. #
+# #
+# These Settings give the Administrator/Owner of a server more #
+# power in terms of customizations. #
+# USE THE BELOW SETTINGS AT YOUR OWN RISK! #
+# READ CAREFULLY BEFORE USING ANY OPTION BELOW! #
+# #
+#===================================================================#
+# ----------------------------------------------------------------- #
+# DM Event Engine (Mazokista) #
+# ----------------------------------------------------------------- #
+
+# Setting for DM Event Engine
+# players there not participated in dm can target dm participants?
+DMAllowInterference = False
+
+# dm participants can use potions?
+DMAllowPotions = False
+
+# dm participants can summon by item?
+DMAllowSummon = False
+
+# remove all effects of dm participants on event start?
+DMOnStartRemoveAllEffects = True
+
+# unsummon pet of dm participants on event start?
+DMOnStartUnsummonPet = True
+
+# On revive participants regain full hp/mp/cp ?
+DMReviveRecovery = False
+
Index: C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_CORE/java/com/l2jtitanplus/Config.java
===================================================================
--- C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_CORE/java/com/l2jtitanplus/Config.java (revision 164)
+++ C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_CORE/java/com/l2jtitanplus/Config.java (working copy)
@@ -83,6 +83,7 @@
public static final String SEPULCHERS_FILE = "./config/Mods/foursepulchers.ini";
public static final String BANNED_IP_XML = "./config/banned.xml";
public static final String TVT_CONFIG_FILE = "./config/Eventos/TeamVsTeam.ini";
+ public static final String DM_ENGINE_FILE = "./config/Eventos/DM_Engine.ini";
public static boolean PVP_COLOR_SYSTEM_ENABLED;
public static int PVP_AMOUNT1;
public static int PVP_AMOUNT2;
@@ -496,6 +497,12 @@
public static int L2JMOD_CHAMPION_REWARD;
public static int L2JMOD_CHAMPION_REWARD_ID;
public static int L2JMOD_CHAMPION_REWARD_QTY;
+ public static boolean DM_ALLOW_INTERFERENCE;
+ public static boolean DM_ALLOW_POTIONS;
+ public static boolean DM_ALLOW_SUMMON;
+ public static boolean DM_ON_START_REMOVE_ALL_EFFECTS;
+ public static boolean DM_ON_START_UNSUMMON_PET;
+ public static boolean DM_REVIVE_RECOVERY;
public static boolean TVT_EVENT_ENABLED;
public static int TVT_EVENT_INTERVAL;
public static int TVT_EVENT_PARTICIPATION_TIME;
@@ -2200,7 +2207,27 @@
e.printStackTrace();
throw new Error("Failed to Load "+TVT_CONFIG_FILE+" File.");
}
-
+
+ //DM Engine
+ try
+ {
+ Properties DMevent = new Properties();
+ is = new FileInputStream(new File (DM_ENGINE_FILE));
+ DMevent.load(is);
+ is.close();
+
+ DM_ALLOW_INTERFERENCE = Boolean.parseBoolean(DMevent.getProperty("DMAllowInterference", "False"));
+ DM_ALLOW_POTIONS = Boolean.parseBoolean(DMevent.getProperty("DMAllowPotions", "False"));
+ DM_ALLOW_SUMMON = Boolean.parseBoolean(DMevent.getProperty("DMAllowSummon", "False"));
+ DM_ON_START_REMOVE_ALL_EFFECTS = Boolean.parseBoolean(DMevent.getProperty("DMOnStartRemoveAllEffects", "True"));
+ DM_ON_START_UNSUMMON_PET = Boolean.parseBoolean(DMevent.getProperty("DMOnStartUnsummonPet", "True"));
+ DM_REVIVE_RECOVERY = Boolean.parseBoolean(DMevent.getProperty("DMReviveRecovery", "False"));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ throw new Error("Failed to Load "+DM_ENGINE_FILE+" File.");
+ }
try
{
@@ -2885,6 +2912,11 @@
else if (pName.equalsIgnoreCase("TvTEventParticipationTime")) TVT_EVENT_PARTICIPATION_TIME = Integer.parseInt(pValue);
else if (pName.equalsIgnoreCase("TvTEventRunningTime")) TVT_EVENT_RUNNING_TIME = Integer.parseInt(pValue);
else if (pName.equalsIgnoreCase("TvTEventParticipationNpcId")) TVT_EVENT_PARTICIPATION_NPC_ID = Integer.parseInt(pValue);
+ else if (pName.equalsIgnoreCase("DMAllowInterference")) DM_ALLOW_INTERFERENCE = Boolean.parseBoolean(pValue);
+ else if (pName.equalsIgnoreCase("DMAllowPotions")) DM_ALLOW_POTIONS = Boolean.parseBoolean(pValue);
+ else if (pName.equalsIgnoreCase("DMAllowSummon")) DM_ALLOW_SUMMON = Boolean.parseBoolean(pValue);
+ else if (pName.equalsIgnoreCase("DMOnStartRemoveAllEffects")) DM_ON_START_REMOVE_ALL_EFFECTS = Boolean.parseBoolean(pValue);
+ else if (pName.equalsIgnoreCase("DMOnStartUnsummonPet")) DM_ON_START_UNSUMMON_PET = Boolean.parseBoolean(pValue);
else if (pName.equalsIgnoreCase("MinKarma")) KARMA_MIN_KARMA = Integer.parseInt(pValue);
else if (pName.equalsIgnoreCase("MaxKarma")) KARMA_MAX_KARMA = Integer.parseInt(pValue);
else if (pName.equalsIgnoreCase("XPDivider")) KARMA_XP_DIVIDER = Integer.parseInt(pValue);
Index: C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_CORE/java/com/l2jtitanplus/gameserver/network/L2GameClient.java
===================================================================
--- C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_CORE/java/com/l2jtitanplus/gameserver/network/L2GameClient.java (revision 143)
+++ C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_CORE/java/com/l2jtitanplus/gameserver/network/L2GameClient.java (working copy)
@@ -506,7 +506,8 @@
@Override
protected void onForcedDisconnection()
{
- _log.info("Client " + toString() + " disconnected abnormally.");
+ if (Config.DEBUG)
+ System.out.println("Client "+toString()+" disconnected abnormally.");
if (activeChar == null)
return;
Index: C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_CORE/java/com/l2jtitanplus/gameserver/network/clientpackets/RequestBypassToServer.java
===================================================================
--- C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_CORE/java/com/l2jtitanplus/gameserver/network/clientpackets/RequestBypassToServer.java (revision 144)
+++ C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_CORE/java/com/l2jtitanplus/gameserver/network/clientpackets/RequestBypassToServer.java (working copy)
@@ -34,6 +34,7 @@
import com.l2jtitanplus.gameserver.model.L2World;
import com.l2jtitanplus.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jtitanplus.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jtitanplus.gameserver.model.entity.DM;
import com.l2jtitanplus.gameserver.model.entity.L2Event;
import com.l2jtitanplus.gameserver.network.SystemMessageId;
import com.l2jtitanplus.gameserver.network.serverpackets.ActionFailed;
@@ -246,6 +247,24 @@
else if (object != null && object instanceof L2NpcInstance && endOfId > 0 && activeChar.isInsideRadius(object, L2NpcInstance.INTERACTION_DISTANCE, false, false))
{
((L2NpcInstance)object).onBypassFeedback(activeChar, _command.substring(endOfId+1));
+ if (_command.substring(endOfId + 1).startsWith("dmevent_player_join"))
+ {
+ if (DM._joining)
+ DM.addPlayer(activeChar);
+ else
+ activeChar.sendMessage("The event is already started. You can not join now!");
+ }
+ else if (_command.substring(endOfId + 1).startsWith("dmevent_player_leave"))
+ {
+ if (DM._joining)
+ DM.removePlayer(activeChar);
+ else
+ activeChar.sendMessage("The event is already started. You can not leave now!");
+ }
+ if (_command.substring(endOfId+1).startsWith("event_participate"))
+ {
+ L2Event.inscribePlayer(activeChar);
+ }
}
activeChar.sendPacket(new ActionFailed());
}
Index: C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_CORE/java/com/l2jtitanplus/gameserver/model/actor/instance/L2NpcInstance.java
===================================================================
--- C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_CORE/java/com/l2jtitanplus/gameserver/model/actor/instance/L2NpcInstance.java (revision 154)
+++ C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_CORE/java/com/l2jtitanplus/gameserver/model/actor/instance/L2NpcInstance.java (working copy)
@@ -66,6 +66,7 @@
import com.l2jtitanplus.gameserver.model.actor.status.NpcStatus;
import com.l2jtitanplus.gameserver.model.entity.Fort;
import com.l2jtitanplus.gameserver.model.entity.Castle;
+import com.l2jtitanplus.gameserver.model.entity.DM;
import com.l2jtitanplus.gameserver.model.entity.L2Event;
import com.l2jtitanplus.gameserver.model.entity.FortressSiege;
import com.l2jtitanplus.gameserver.model.Olympiad.Olympiad;
@@ -133,6 +134,7 @@
private int _fortIndex = -2;
public boolean isEventMob = false,
+ _isEventMobDM = false,
_isEventMobFOS = false,
_isFOS_Artifact = false;
private boolean _isInTown = false;
@@ -697,6 +699,8 @@
// Open a chat window on client with the text of the L2NpcInstance
if(isEventMob)
L2Event.showEventHtml(player, String.valueOf(getObjectId()));
+ else if (_isEventMobDM)
+ DM.showEventHtml(player, String.valueOf(getObjectId()));
else if (_isEventMobFOS)
FortressSiege.showEventHtml(player, String.valueOf(getObjectId()));
else if (_isFOS_Artifact)
Index: C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_CORE/java/com/l2jtitanplus/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_CORE/java/com/l2jtitanplus/gameserver/model/actor/instance/L2PcInstance.java (revision 159)
+++ C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_CORE/java/com/l2jtitanplus/gameserver/model/actor/instance/L2PcInstance.java (working copy)
@@ -133,6 +133,7 @@
import com.l2jtitanplus.gameserver.model.entity.Siege;
import com.l2jtitanplus.gameserver.model.entity.FortSiege;
import com.l2jtitanplus.gameserver.model.entity.FortressSiege;
+import com.l2jtitanplus.gameserver.model.entity.DM;
import com.l2jtitanplus.gameserver.model.entity.TvTEvent;
import com.l2jtitanplus.gameserver.model.Olympiad.Olympiad;
import com.l2jtitanplus.gameserver.model.quest.Quest;
@@ -357,6 +358,10 @@
private int _pkKills;
/** The PvP Flag state of the L2PcInstance (0=White, 1=Purple) */
private byte _pvpFlag;
+ /** The hexadecimal Color of players name (white is 0xFFFFFF) */
+ private int _nameColor;
+ /** The hexadecimal Color of players title (white is 0xFFFFFF) */
+ private int _titleColor;
/** The Siege state of the L2PcInstance */
private byte _siegeState = 0;
private int _curWeightPenalty = 0;
@@ -628,6 +633,10 @@
public boolean eventSitForced = false;
public boolean atEvent = false;
+ /** DM Engine parameters */
+ public int _originalNameColorDM, _countDMkills, _originalKarmaDM;
+ public boolean _inEventDM = false;
+
/** new loto ticket **/
private int _loto[] = new int[5];
//public static int _loto_nums[] = {0,1,2,3,4,5,6,7,8,9,};
@@ -926,6 +935,8 @@
_accountName = accountName;
_appearance = app;
+ _nameColor = 0xFFFFFF;
+ _titleColor = 0xFFFF77;
// Create an AI
_ai = new L2PlayerAI(new L2PcInstance.AIAccessor());
@@ -2501,7 +2512,7 @@
{
sendMessage("A dark force beyond your mortal understanding makes your knees to shake when you try to stand up ...");
}
- else if (FortressSiege._sitForced && _inEventFOS)
+ else if (FortressSiege._sitForced && _inEventFOS || DM._sitForced && _inEventDM)
sendMessage("The Admin/GM handle if you sit or stand in this match!");
else if (_waitTypeSitting && !isInStoreMode() && !isAlikeDead())
{
@@ -3510,6 +3521,11 @@
{
player.sendPacket(new ActionFailed());
return;
+ }
+ else if (_inEventDM && !player._inEventDM || !_inEventDM && player._inEventDM)
+ {
+ player.sendPacket(ActionFailed.STATIC_PACKET);
+ return;
}
// Check if the L2PcInstance is confused
@@ -3554,7 +3570,7 @@
else
{
// Check if this L2PcInstance is autoAttackable
- if (isAutoAttackable(player) || (player._inEventFOS && FortressSiege._started))
+ if (isAutoAttackable(player) || (player._inEventFOS && FortressSiege._started) || (player._inEventDM && DM._started))
{
// Player with lvl < 21 can't attack a cursed weapon holder
// And a cursed weapon holder can't attack players with lvl < 21
@@ -4397,6 +4413,39 @@
}, 5000);
}
}
+ else if (killer instanceof L2PcInstance && ((L2PcInstance) killer)._inEventDM && _inEventDM)
+ {
+ if (DM._teleport || DM._started)
+ {
+ ((L2PcInstance) killer)._countDMkills++;
+ sendMessage("You will be revived and teleported to spot in 20 seconds!");
+ ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
+ {
+ public void run()
+ {
+ if (Config.DM_ON_START_REMOVE_ALL_EFFECTS)
+ stopAllEffects();
+ teleToLocation(DM._playerX, DM._playerY, DM._playerZ, false);
+ doRevive();
+ }
+ }, 20000);
+ }
+ }
+ else if (_inEventDM)
+ if (DM._teleport || DM._started)
+ {
+ sendMessage("You will be revived and teleported to spot in 20 seconds!");
+ ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
+ {
+ public void run()
+ {
+ if (Config.DM_ON_START_REMOVE_ALL_EFFECTS)
+ stopAllEffects();
+ teleToLocation(DM._playerX, DM._playerY, DM._playerZ, false);
+ doRevive();
+ }
+ }, 20000);
+ }
if (killer instanceof L2PcInstance)
pk = (L2PcInstance) killer;
@@ -4485,7 +4534,7 @@
private void onDieDropItem(L2Character killer)
{
- if (atEvent || (FortressSiege._started && _inEventFOS) || killer == null)
+ if (atEvent || (FortressSiege._started && _inEventFOS) || (DM._started && _inEventDM) || killer == null)
return;
if (getKarma()<=0
@@ -4603,7 +4652,7 @@
return;
if (!(target instanceof L2PlayableInstance))
return;
- if (_inEventFOS)
+ if (_inEventFOS || _inEventDM)
return;
L2PcInstance targetPlayer = null;
@@ -4697,7 +4746,7 @@
*/
public void increasePvpKills()
{
- if ((FortressSiege._started && _inEventFOS))
+ if ((FortressSiege._started && _inEventFOS) || (DM._started && _inEventDM))
return;
// Add karma to attacker and increase its PK counter
@@ -4725,7 +4774,7 @@
*/
public void increasePkKillsAndKarma(int targLVL)
{
- if ((FortressSiege._started && _inEventFOS))
+ if ((FortressSiege._started && _inEventFOS) || (DM._started && _inEventDM))
return;
int baseKarma = Config.KARMA_MIN_KARMA;
int newKarma = baseKarma;
@@ -4832,7 +4881,7 @@
{
if (isInsideZone(ZONE_PVP))
return;
- if ((FortressSiege._started && _inEventFOS))
+ if ((FortressSiege._started && _inEventFOS) || (DM._started && _inEventDM))
return;
setPvpFlagLasts(System.currentTimeMillis() + Config.PVP_NORMAL_TIME);
@@ -4914,7 +4963,7 @@
// Calculate the Experience loss
long lostExp = 0;
- if (!atEvent && !_inEventFOS)
+ if (!atEvent && !_inEventFOS && !_inEventDM)
if (lvl < Experience.MAX_LEVEL)
lostExp = Math.round((getStat().getExpForLevel(lvl+1) - getStat().getExpForLevel(lvl)) * percentLost /100);
else
@@ -7610,7 +7659,7 @@
}
// Check if a Forced ATTACK is in progress on non-attackable target
- if (!target.isAutoAttackable(this) && !forceUse && !(_inEventFOS && FortressSiege._started) &&
+ if (!target.isAutoAttackable(this) && !forceUse && !(_inEventFOS && FortressSiege._started) && !(_inEventDM && DM._started) &&
sklTargetType != SkillTargetType.TARGET_AURA &&
sklTargetType != SkillTargetType.TARGET_CLAN &&
sklTargetType != SkillTargetType.TARGET_ALLY &&
@@ -7819,7 +7868,7 @@
*/
public boolean checkPvpSkill(L2Object target, L2Skill skill)
{
- if ((_inEventFOS && FortressSiege._started))
+ if ((_inEventFOS && FortressSiege._started) || (_inEventDM && DM._started))
return true;
// check for PC->PC Pvp status
@@ -8872,7 +8921,37 @@
public int getTeam()
{
return _team;
- }
+ }
+
+ public int getNameColor()
+ {
+ return _nameColor;
+ }
+
+ public void setNameColor(int nameColor)
+ {
+ _nameColor = nameColor;
+ }
+
+ public int getTitleColor()
+ {
+ return _titleColor;
+ }
+
+ public void setTitleColor(int titleColor)
+ {
+ _titleColor = titleColor;
+ }
+
+ public void setTitleColor(int red, int green, int blue)
+ {
+ _titleColor = (red & 0xFF) + ((green & 0xFF) << 8) + ((blue & 0xFF) << 16);
+ }
+
+ public void setNameColor(int red, int green, int blue)
+ {
+ _nameColor = (red & 0xFF) + ((green & 0xFF) << 8) + ((blue & 0xFF) << 16);
+ }
public void setWantsPeace(int wantsPeace)
{
@@ -9550,7 +9629,7 @@
if (!DimensionalRiftManager.getInstance().checkIfInPeaceZone(getX(), getY(), getZ()))
getParty().getDimensionalRift().memberRessurected(this);
}
- if((_inEventFOS && FortressSiege._started && Config.FortressSiege_REVIVE_RECOVERY))
+ if((_inEventFOS && FortressSiege._started && Config.FortressSiege_REVIVE_RECOVERY) && (_inEventDM && DM._started && Config.DM_REVIVE_RECOVERY))
{
getStatus().setCurrentHp(getMaxHp());
getStatus().setCurrentMp(getMaxMp());
Index: C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_CORE/java/com/l2jtitanplus/gameserver/model/entity/DM.java
===================================================================
--- C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_CORE/java/com/l2jtitanplus/gameserver/model/entity/DM.java (revision 0)
+++ C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_CORE/java/com/l2jtitanplus/gameserver/model/entity/DM.java (revision 0)
@@ -0,0 +1,660 @@
+/*
+ * 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 2, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+/**
+ * @author SqueezeD
+ */
+package com.l2jtitanplus.gameserver.model.entity;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.Vector;
+
+import javolution.text.TextBuilder;
+import com.l2jtitanplus.Config;
+import com.l2jtitanplus.L2DatabaseFactory;
+import com.l2jtitanplus.gameserver.Announcements;
+import com.l2jtitanplus.gameserver.ThreadPoolManager;
+import com.l2jtitanplus.gameserver.datatables.ItemTable;
+import com.l2jtitanplus.gameserver.datatables.NpcTable;
+import com.l2jtitanplus.gameserver.datatables.SpawnTable;
+import com.l2jtitanplus.gameserver.model.L2Effect;
+import com.l2jtitanplus.gameserver.model.L2Party;
+import com.l2jtitanplus.gameserver.model.L2Spawn;
+import com.l2jtitanplus.gameserver.model.L2Summon;
+import com.l2jtitanplus.gameserver.model.L2World;
+import com.l2jtitanplus.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jtitanplus.gameserver.model.actor.instance.L2PetInstance;
+import com.l2jtitanplus.gameserver.network.serverpackets.CreatureSay;
+import com.l2jtitanplus.gameserver.network.serverpackets.ActionFailed;
+import com.l2jtitanplus.gameserver.network.serverpackets.MagicSkillUser;
+import com.l2jtitanplus.gameserver.network.serverpackets.NpcHtmlMessage;
+import com.l2jtitanplus.gameserver.network.serverpackets.StatusUpdate;
+import com.l2jtitanplus.gameserver.templates.L2NpcTemplate;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class DM
+{
+ private final static Log _log = LogFactory.getLog(DM.class.getName());
+ public static String _eventName = new String(), _eventDesc = new String(), _joiningLocationName = new String();
+ public static Vector<String> _savePlayers = new Vector<String>();
+ public static Vector<L2PcInstance> _players = new Vector<L2PcInstance>();
+ public static boolean _joining = false, _teleport = false, _started = false, _sitForced = false;
+ public static L2Spawn _npcSpawn;
+ public static L2PcInstance _topPlayer;
+ public static int _npcId = 0, _npcX = 0, _npcY = 0, _npcZ = 0, _rewardId = 0, _rewardAmount = 0, _topKills = 0, _minlvl = 0, _maxlvl = 0, _playerColors = 0, _playerX = 0, _playerY = 0, _playerZ = 0;
+
+ public static void setNpcPos(L2PcInstance activeChar)
+ {
+ _npcX = activeChar.getX();
+ _npcY = activeChar.getY();
+ _npcZ = activeChar.getZ();
+ }
+
+ public static boolean checkMaxLevel(int maxlvl)
+ {
+ if (_minlvl >= maxlvl)
+ return false;
+ return true;
+ }
+
+ public static boolean checkMinLevel(int minlvl)
+ {
+ if (_maxlvl <= minlvl)
+ return false;
+ return true;
+ }
+
+ public static void setPlayersPos(L2PcInstance activeChar)
+ {
+ _playerX = activeChar.getX();
+ _playerY = activeChar.getY();
+ _playerZ = activeChar.getZ();
+ }
+
+ public static boolean checkPlayerOk()
+ {
+ if (_started || _teleport || _joining)
+ return false;
+ return true;
+ }
+
+ public static void startJoin(L2PcInstance activeChar)
+ {
+ if (!startJoinOk())
+ {
+ if (_log.isDebugEnabled())
+ _log.debug("DM Engine[startJoin(" + activeChar.getName() + ")]: startJoinOk() = false");
+ return;
+ }
+ _joining = true;
+ spawnEventNpc(activeChar);
+ Announcements("Death Match Event Engine Iniciado !");
+ Announcements("Premiacao: " + _rewardAmount + " " + ItemTable.getInstance().getTemplate(_rewardId).getName());
+ Announcements("Levels Permitidos: " + _minlvl + " ou " + _maxlvl);
+ Announcements("Localizacao do Evento " + _joiningLocationName + "!");
+ }
+
+ private static boolean startJoinOk()
+ {
+ if (_started || _teleport || _joining || _eventName.equals("") || _joiningLocationName.equals("") || _eventDesc.equals("") || _npcId == 0 || _npcX == 0 || _npcY == 0 || _npcZ == 0 || _rewardId == 0 || _rewardAmount == 0 || _playerX == 0 || _playerY == 0 || _playerZ == 0)
+ return false;
+ return true;
+ }
+
+ private static void spawnEventNpc(L2PcInstance activeChar)
+ {
+ L2NpcTemplate tmpl = NpcTable.getInstance().getTemplate(_npcId);
+ try
+ {
+ _npcSpawn = new L2Spawn(tmpl);
+ _npcSpawn.setLocx(_npcX);
+ _npcSpawn.setLocy(_npcY);
+ _npcSpawn.setLocz(_npcZ);
+ _npcSpawn.setAmount(1);
+ _npcSpawn.setHeading(activeChar.getHeading());
+ _npcSpawn.setRespawnDelay(1);
+ SpawnTable.getInstance().addNewSpawn(_npcSpawn, false);
+ _npcSpawn.init();
+ _npcSpawn.getLastSpawn().getStatus().setCurrentHp(999999999);
+ _npcSpawn.getLastSpawn().setTitle(_eventName);
+ _npcSpawn.getLastSpawn()._isEventMobDM = true;
+ _npcSpawn.getLastSpawn().isAggressive();
+ _npcSpawn.getLastSpawn().decayMe();
+ _npcSpawn.getLastSpawn().spawnMe(_npcSpawn.getLastSpawn().getX(), _npcSpawn.getLastSpawn().getY(), _npcSpawn.getLastSpawn().getZ());
+ _npcSpawn.getLastSpawn().broadcastPacket(new MagicSkillUser(_npcSpawn.getLastSpawn(), _npcSpawn.getLastSpawn(), 1034, 1, 1, 1));
+ }
+ catch (Exception e)
+ {
+ if (_log.isDebugEnabled())
+ _log.debug("DM Engine[spawnEventNpc(" + activeChar.getName() + ")]: exception: " + e.getMessage());
+ }
+ }
+
+ public static void teleportStart()
+ {
+ if (!_joining || _started || _teleport)
+ return;
+ _joining = false;
+ Announcements("A Equipe sera teleportada para a areana em 20 segundos!");
+ setUserData();
+ ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
+ {
+ public void run()
+ {
+ DM.sit();
+ for (L2PcInstance player : DM._players)
+ if (player != null)
+ {
+ if (Config.DM_ON_START_UNSUMMON_PET)
+ // Remove Summon's buffs
+ if (player.getPet() != null)
+ {
+ L2Summon summon = player.getPet();
+ for (L2Effect e : summon.getAllEffects())
+ e.exit();
+ if (summon instanceof L2PetInstance)
+ summon.unSummon(player);
+ }
+ if (Config.DM_ON_START_REMOVE_ALL_EFFECTS)
+ for (L2Effect e : player.getAllEffects())
+ if (e != null)
+ e.exit();
+ // Remove player from his party
+ if (player.getParty() != null)
+ {
+ L2Party party = player.getParty();
+ party.removePartyMember(player);
+ }
+ player.teleToLocation(_playerX, _playerY, _playerZ);
+ }
+ }
+ }, 20000);
+ _teleport = true;
+ }
+
+
+ public static void startEvent(L2PcInstance activeChar)
+ {
+ if (!startEventOk())
+ {
+ if (_log.isDebugEnabled())
+ _log.debug("DM Engine[startEvent(" + activeChar.getName() + ")]: startEventOk() = false");
+ return;
+ }
+ _teleport = false;
+ sit();
+ Announcements("A Partida foi iniciada Agora mate Seus Inimigos!");
+ _started = true;
+ }
+
+ private static boolean startEventOk()
+ {
+ if (_joining || !_teleport || _started)
+ return false;
+ return true;
+ }
+
+ public static void setUserData()
+ {
+ for (L2PcInstance player : _players)
+ {
+ player._originalNameColorDM = player.getAppearance().getNameColor();
+ player._originalKarmaDM = player.getKarma();
+ player._inEventDM = true;
+ player._countDMkills = 0;
+ player.getAppearance().setNameColor(_playerColors);
+ player.setKarma(0);
+ player.broadcastUserInfo();
+ }
+ }
+
+ public static void removeUserData()
+ {
+ for (L2PcInstance player : _players)
+ {
+ player.getAppearance().setNameColor(player._originalNameColorDM);
+ player.setKarma(player._originalKarmaDM);
+ player._inEventDM = false;
+ player._countDMkills = 0;
+ player.broadcastUserInfo();
+ }
+ }
+
+ public static void finishEvent(L2PcInstance activeChar)
+ {
+ if (!finishEventOk())
+ {
+ if (_log.isDebugEnabled())
+ _log.debug("DM Engine[finishEvent(" + activeChar.getName() + ")]: finishEventOk() = false");
+ return;
+ }
+ _started = false;
+ unspawnEventNpc();
+ processTopPlayer();
+ if (_topKills == 0)
+ Announcements("Nenhum jogador ganhou o jogo (Por Falta de Kills)");
+ else
+ {
+ Announcements(_eventName + _topPlayer.getName() + " Ganhou o Jogo Com " + _topKills + " kills.");
+ rewardPlayer(activeChar);
+ }
+ teleportFinish();
+ }
+
+ private static boolean finishEventOk()
+ {
+ if (!_started)
+ return false;
+ return true;
+ }
+
+ public static void processTopPlayer()
+ {
+ for (L2PcInstance player : _players)
+ if (player._countDMkills > _topKills)
+ {
+ _topPlayer = player;
+ _topKills = player._countDMkills;
+ }
+ }
+
+ public static void rewardPlayer(L2PcInstance activeChar)
+ {
+ if (_topPlayer != null)
+ {
+ _topPlayer.addItem("DM : " + _eventName, _rewardId, _rewardAmount, _topPlayer, true);
+ StatusUpdate su = new StatusUpdate(_topPlayer.getObjectId());
+ su.addAttribute(StatusUpdate.CUR_LOAD, _topPlayer.getCurrentLoad());
+ _topPlayer.sendPacket(su);
+ NpcHtmlMessage nhm = new NpcHtmlMessage(5);
+ TextBuilder replyMSG = new TextBuilder("");
+ replyMSG.append("<html><body>Voce ganhou o evento. Olhe no seu inventario para a recompensa.</body></html>");
+ nhm.setHtml(replyMSG.toString());
+ _topPlayer.sendPacket(nhm);
+ // Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet
+ _topPlayer.sendPacket(ActionFailed.STATIC_PACKET);
+ }
+ }
+
+ public static void abortEvent()
+ {
+ if (!_joining && !_teleport && !_started)
+ return;
+ _joining = false;
+ _teleport = false;
+ _started = false;
+ unspawnEventNpc();
+ Announcements(_eventName + "Partida Anulada");
+ teleportFinish();
+ }
+
+ public static void sit()
+ {
+ if (_sitForced)
+ _sitForced = false;
+ else
+ _sitForced = true;
+ for (L2PcInstance player : _players)
+ if (player != null)
+ if (_sitForced)
+ {
+ player.stopMove(null, false);
+ player.abortAttack();
+ player.abortCast();
+ if (!player.isSitting())
+ player.sitDown();
+ } else if (player.isSitting())
+ player.standUp();
+ }
+
+ public static void dumpData()
+ {
+ System.out.println("");
+ System.out.println("");
+ if (!_joining && !_teleport && !_started)
+ {
+ System.out.println("<<---------------------------------->>");
+ System.out.println(">> DM Engine infos dump (INACTIVE) <<");
+ System.out.println("<<--^----^^-----^----^^------^^----->>");
+ }
+ else if (_joining && !_teleport && !_started)
+ {
+ System.out.println("<<--------------------------------->>");
+ System.out.println(">> DM Engine infos dump (JOINING) <<");
+ System.out.println("<<--^----^^-----^----^^------^----->>");
+ }
+ else if (!_joining && _teleport && !_started)
+ {
+ System.out.println("<<---------------------------------->>");
+ System.out.println(">> DM Engine infos dump (TELEPORT) <<");
+ System.out.println("<<--^----^^-----^----^^------^^----->>");
+ }
+ else if (!_joining && !_teleport && _started)
+ {
+ System.out.println("<<--------------------------------->>");
+ System.out.println(">> DM Engine infos dump (STARTED) <<");
+ System.out.println("<<--^----^^-----^----^^------^----->>");
+ }
+ System.out.println("Name: " + _eventName);
+ System.out.println("Desc: " + _eventDesc);
+ System.out.println("Join location: " + _joiningLocationName);
+ System.out.println("Min lvl: " + _minlvl);
+ System.out.println("Max lvl: " + _maxlvl);
+ System.out.println("");
+ System.out.println("##################################");
+ System.out.println("# _players(Vector<L2PcInstance>) #");
+ System.out.println("##################################");
+ System.out.println("Total Players : " + _players.size());
+ for (L2PcInstance player : _players)
+ if (player != null)
+ System.out.println("Name: " + player.getName() + " kills :" + player._countDMkills);
+ System.out.println("");
+ System.out.println("################################");
+ System.out.println("# _savePlayers(Vector<String>) #");
+ System.out.println("################################");
+ for (String player : _savePlayers)
+ System.out.println("Name: " + player);
+ System.out.println("");
+ System.out.println("");
+ }
+
+ public static void loadData()
+ {
+ _eventName = new String();
+ _eventDesc = new String();
+ _joiningLocationName = new String();
+ _savePlayers = new Vector<String>();
+ _players = new Vector<L2PcInstance>();
+ _topPlayer = null;
+ _npcSpawn = null;
+ _joining = false;
+ _teleport = false;
+ _started = false;
+ _sitForced = false;
+ _npcId = 0;
+ _npcX = 0;
+ _npcY = 0;
+ _npcZ = 0;
+ _rewardId = 0;
+ _rewardAmount = 0;
+ _topKills = 0;
+ _minlvl = 0;
+ _maxlvl = 0;
+ _playerColors = 0;
+ _playerX = 0;
+ _playerY = 0;
+ _playerZ = 0;
+ java.sql.Connection con = null;
+ try
+ {
+ PreparedStatement statement;
+ ResultSet rs;
+ con = L2DatabaseFactory.getInstance().getConnection();
+ statement = con.prepareStatement("Select * from dm");
+ rs = statement.executeQuery();
+ while (rs.next())
+ {
+ _eventName = rs.getString("eventName");
+ _eventDesc = rs.getString("eventDesc");
+ _joiningLocationName = rs.getString("joiningLocation");
+ _minlvl = rs.getInt("minlvl");
+ _maxlvl = rs.getInt("maxlvl");
+ _npcId = rs.getInt("npcId");
+ _npcX = rs.getInt("npcX");
+ _npcY = rs.getInt("npcY");
+ _npcZ = rs.getInt("npcZ");
+ _rewardId = rs.getInt("rewardId");
+ _rewardAmount = rs.getInt("rewardAmount");
+ _playerColors = rs.getInt("color");
+ _playerX = rs.getInt("playerX");
+ _playerY = rs.getInt("playerY");
+ _playerZ = rs.getInt("playerZ");
+ }
+ statement.close();
+ }
+ catch (Exception e)
+ {
+ _log.error("Exception: DM.loadData(): " + e.getMessage());
+ }
+ finally
+ {
+ try
+ {
+ con.close();
+ }
+ catch (Exception e)
+ {
+ }
+ }
+ }
+
+ public static void saveData()
+ {
+ java.sql.Connection con = null;
+ try
+ {
+ con = L2DatabaseFactory.getInstance().getConnection();
+ PreparedStatement statement;
+ statement = con.prepareStatement("Delete from dm");
+ statement.execute();
+ statement.close();
+ statement = con.prepareStatement("INSERT INTO dm (eventName, eventDesc, joiningLocation, minlvl, maxlvl, npcId, npcX, npcY, npcZ, rewardId, rewardAmount, color, playerX, playerY, playerZ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
+ statement.setString(1, _eventName);
+ statement.setString(2, _eventDesc);
+ statement.setString(3, _joiningLocationName);
+ statement.setInt(4, _minlvl);
+ statement.setInt(5, _maxlvl);
+ statement.setInt(6, _npcId);
+ statement.setInt(7, _npcX);
+ statement.setInt(8, _npcY);
+ statement.setInt(9, _npcZ);
+ statement.setInt(10, _rewardId);
+ statement.setInt(11, _rewardAmount);
+ statement.setInt(12, _playerColors);
+ statement.setInt(13, _playerX);
+ statement.setInt(14, _playerY);
+ statement.setInt(15, _playerZ);
+ statement.execute();
+ statement.close();
+ }
+ catch (Exception e)
+ {
+ _log.error("Exception: DM.saveData(): " + e.getMessage());
+ }
+ finally
+ {
+ try
+ {
+ con.close();
+ }
+ catch (Exception e)
+ {
+ }
+ }
+ }
+
+ public static void showEventHtml(L2PcInstance eventPlayer, String objectId)
+ {
+ try
+ {
+ NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
+ TextBuilder replyMSG = new TextBuilder("<html><body>");
+ replyMSG.append("Death Match!<br1>");
+ replyMSG.append("Evento Atual...<br1>");
+ replyMSG.append(" ... Nome: <font color=\"00FF00\">" + _eventName + "</font><br1>");
+ replyMSG.append(" ... Descricao: <font color=\"00FF00\">" + _eventDesc + "</font><br><br>");
+ if (!_started && !_joining)
+ replyMSG.append("<center>Aguarde ate que o gm / admin inicie a participacao no Evento.</center>");
+ else if (!_started && _joining && eventPlayer.getLevel() >= _minlvl && eventPlayer.getLevel() <= _maxlvl)
+ {
+ if (_players.contains(eventPlayer))
+ {
+ replyMSG.append("Voce ja Esta participando do Evento!<br><br>");
+ replyMSG.append("<table border=\"0\"><tr>");
+ replyMSG.append("<td width=\"200\">Espere ate início do evento ou</td>");
+ replyMSG.append("<td width=\"60\"><center><button value=\"Remova\" action=\"bypass -h npc_" + objectId + "_dmevent_player_leave\" width=50 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></center></td>");
+ replyMSG.append("<td width=\"100\">Sua participacao!</td>");
+ replyMSG.append("</tr></table>");
+ }
+ else
+ {
+ replyMSG.append("Voce deseja participar do evento?<br><br>");
+ replyMSG.append("<td width=\"200\">Minimo lvl Permitido : <font color=\"00FF00\">" + _minlvl + "</font></td><br>");
+ replyMSG.append("<td width=\"200\">Maximo lvl Permitido : <font color=\"00FF00\">" + _maxlvl + "</font></td><br><br>");
+ replyMSG.append("<button value=\"Registra\" action=\"bypass -h npc_" + objectId + "_dmevent_player_join\" width=50 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
+ replyMSG.append("<img src=l2font-e.mini_logo-e width=180 height=80>");
+ }
+ }
+ else if (_started && !_joining)
+ replyMSG.append("<center>O Evento esta em andamento.</center>");
+ else if (eventPlayer.getLevel() < _minlvl || eventPlayer.getLevel() > _maxlvl)
+ {
+ replyMSG.append("Seu lvl : <font color=\"00FF00\">" + eventPlayer.getLevel() + "</font><br>");
+ replyMSG.append("Minimo lvl Permitido : <font color=\"00FF00\">" + _minlvl + "</font><br>");
+ replyMSG.append("Maximo lvl Permitido : <font color=\"00FF00\">" + _maxlvl + "</font><br><br>");
+ replyMSG.append("<font color=\"FFFF00\">Voce nao pode participar deste evento.</font><br>");
+ }
+ replyMSG.append("</body></html>");
+ adminReply.setHtml(replyMSG.toString());
+ eventPlayer.sendPacket(adminReply);
+ // Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet
+ eventPlayer.sendPacket(ActionFailed.STATIC_PACKET);
+ }
+ catch (Exception e)
+ {
+ _log.error("DM Engine[showEventHtlm(" + eventPlayer.getName() + ", " + objectId + ")]: exception" + e.getMessage());
+ }
+ }
+
+ public static void addPlayer(L2PcInstance player)
+ {
+ if (!addPlayerOk(player))
+ return;
+ _players.add(player);
+ player._originalNameColorDM = player.getAppearance().getNameColor();
+ player._originalKarmaDM = player.getKarma();
+ player._inEventDM = true;
+ player._countDMkills = 0;
+ _savePlayers.add(player.getName());
+ }
+
+ public static boolean addPlayerOk(L2PcInstance eventPlayer)
+ {
+ if (eventPlayer._inEventDM)
+ {
+ eventPlayer.sendMessage("Voce ja Esta participando do Evento!");
+ return false;
+ }
+ return true;
+ }
+
+ public static synchronized void addDisconnectedPlayer(L2PcInstance player)
+ {
+ if (!_players.contains(player) && _savePlayers.contains(player.getName()))
+ {
+ if (Config.DM_ON_START_REMOVE_ALL_EFFECTS)
+ for (L2Effect e : player.getAllEffects())
+ if (e != null)
+ e.exit();
+ _players.add(player);
+ player._originalNameColorDM = player.getAppearance().getNameColor();
+ player._originalKarmaDM = player.getKarma();
+ player._inEventDM = true;
+ player._countDMkills = 0;
+ if (_teleport || _started)
+ {
+ player.getAppearance().setNameColor(_playerColors);
+ player.setKarma(0);
+ player.broadcastUserInfo();
+ player.teleToLocation(_playerX, _playerY, _playerZ);
+ }
+ }
+ }
+
+ public static void removePlayer(L2PcInstance player)
+ {
+ if (player != null)
+ _players.remove(player);
+ }
+
+ public static void cleanDM()
+ {
+ for (L2PcInstance player : _players)
+ removePlayer(player);
+ _savePlayers = new Vector<String>();
+ _topPlayer = null;
+ _npcSpawn = null;
+ _joining = false;
+ _teleport = false;
+ _started = false;
+ _sitForced = false;
+ _topKills = 0;
+ _players = new Vector<L2PcInstance>();
+ }
+
+ public static void unspawnEventNpc()
+ {
+ if (_npcSpawn == null)
+ return;
+ _npcSpawn.getLastSpawn().deleteMe();
+ _npcSpawn.stopRespawn();
+ SpawnTable.getInstance().deleteSpawn(_npcSpawn, true);
+ }
+
+ // Collored Announcements 8D for DM Engine
+ public static void Announcements(String announce)
+ {
+ CreatureSay cs = new CreatureSay(0, 18, "", "DM : "+announce);
+ if(!_started && !_teleport)
+ for(L2PcInstance player: L2World.getInstance().getAllPlayers())
+ {
+ if(player != null)
+ if(player.isOnline()!=0)
+ player.sendPacket(cs);
+ }
+ else
+ {
+ if(_players!=null && !_players.isEmpty())
+ for(L2PcInstance player: _players)
+ {
+ if(player != null)
+ if(player.isOnline()!=0)
+ player.sendPacket(cs);
+ }
+ }
+ }
+
+ public static void teleportFinish()
+ {
+ Announcements("Voce sera Teleportado de Volta em 20 segundos!");
+ removeUserData();
+ ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
+ {
+ public void run()
+ {
+ for (L2PcInstance player : _players)
+ if (player != null)
+ player.teleToLocation(_npcX, _npcY, _npcZ);
+ cleanDM();
+ }
+ }, 20000);
+ }
+}
\ No newline at end of file
Index: C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_CORE/java/com/l2jtitanplus/gameserver/handler/AdminCommandHandler.java
===================================================================
--- C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_CORE/java/com/l2jtitanplus/gameserver/handler/AdminCommandHandler.java (revision 144)
+++ C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_CORE/java/com/l2jtitanplus/gameserver/handler/AdminCommandHandler.java (working copy)
@@ -29,6 +29,7 @@
import com.l2jtitanplus.Config;
import com.l2jtitanplus.gameserver.handler.admincommandhandlers.AdminAdmin;
import com.l2jtitanplus.gameserver.handler.admincommandhandlers.AdminAio;
+import com.l2jtitanplus.gameserver.handler.admincommandhandlers.AdminDMEngine;
import com.l2jtitanplus.gameserver.handler.admincommandhandlers.AdminAnnouncements;
import com.l2jtitanplus.gameserver.handler.admincommandhandlers.AdminAutoAnnouncements;
import com.l2jtitanplus.gameserver.handler.admincommandhandlers.AdminBBS;
@@ -125,6 +126,7 @@
{
_datatable = new FastMap<String, IAdminCommandHandler>();
registerAdminCommandHandler(new AdminAdmin());
+ registerAdminCommandHandler(new AdminDMEngine());
registerAdminCommandHandler(new AdminAio());
registerAdminCommandHandler(new AdminInvul());
registerAdminCommandHandler(new AdminDelete());
Index: C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_CORE/java/com/l2jtitanplus/gameserver/handler/admincommandhandlers/AdminDMEngine.java
===================================================================
--- C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_CORE/java/com/l2jtitanplus/gameserver/handler/admincommandhandlers/AdminDMEngine.java (revision 0)
+++ C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_CORE/java/com/l2jtitanplus/gameserver/handler/admincommandhandlers/AdminDMEngine.java (revision 0)
@@ -0,0 +1,245 @@
+/*
+ * 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 2, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * [Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]
+ */
+/**
+ * @author SqueezeD
+ */
+package com.l2jtitanplus.gameserver.handler.admincommandhandlers;
+
+import javolution.text.TextBuilder;
+import com.l2jtitanplus.gameserver.handler.IAdminCommandHandler;
+import com.l2jtitanplus.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jtitanplus.gameserver.model.entity.DM;
+import com.l2jtitanplus.gameserver.network.serverpackets.NpcHtmlMessage;
+
+public class AdminDMEngine implements IAdminCommandHandler
+{
+ private static final String[] ADMIN_COMMANDS =
+ {
+ "admin_dmevent",
+ "admin_dmevent_name",
+ "admin_dmevent_desc",
+ "admin_dmevent_join_loc",
+ "admin_dmevent_minlvl",
+ "admin_dmevent_maxlvl",
+ "admin_dmevent_npc",
+ "admin_dmevent_npc_pos",
+ "admin_dmevent_reward",
+ "admin_dmevent_reward_amount",
+ "admin_dmevent_spawnpos",
+ "admin_dmevent_color",
+ "admin_dmevent_join",
+ "admin_dmevent_teleport",
+ "admin_dmevent_start",
+ "admin_dmevent_abort",
+ "admin_dmevent_finish",
+ "admin_dmevent_sit",
+ "admin_dmevent_dump",
+ "admin_dmevent_save",
+ "admin_dmevent_load"
+ };
+ private static final int REQUIRED_LEVEL = 100;
+
+ public boolean useAdminCommand(String command, L2PcInstance activeChar)
+ {
+ if (!(checkLevel(activeChar.getAccessLevel()) && activeChar.isGM()))
+ return false;
+ if (command.equals("admin_dmevent"))
+ showMainPage(activeChar);
+ else if (command.startsWith("admin_dmevent_name "))
+ {
+ DM._eventName = command.substring(19);
+ showMainPage(activeChar);
+ }
+ else if (command.startsWith("admin_dmevent_desc "))
+ {
+ DM._eventDesc = command.substring(19);
+ showMainPage(activeChar);
+ }
+ else if (command.startsWith("admin_dmevent_minlvl "))
+ {
+ if (!DM.checkMinLevel(Integer.valueOf(command.substring(21))))
+ return false;
+ DM._minlvl = Integer.valueOf(command.substring(21));
+ showMainPage(activeChar);
+ }
+ else if (command.startsWith("admin_dmevent_maxlvl "))
+ {
+ if (!DM.checkMaxLevel(Integer.valueOf(command.substring(21))))
+ return false;
+ DM._maxlvl = Integer.valueOf(command.substring(21));
+ showMainPage(activeChar);
+ }
+ else if (command.startsWith("admin_dmevent_join_loc "))
+ {
+ DM._joiningLocationName = command.substring(23);
+ showMainPage(activeChar);
+ }
+ else if (command.startsWith("admin_dmevent_npc "))
+ {
+ DM._npcId = Integer.valueOf(command.substring(18));
+ showMainPage(activeChar);
+ }
+ else if (command.equals("admin_dmevent_npc_pos"))
+ {
+ DM.setNpcPos(activeChar);
+ showMainPage(activeChar);
+ }
+ else if (command.startsWith("admin_dmevent_reward "))
+ {
+ DM._rewardId = Integer.valueOf(command.substring(21));
+ showMainPage(activeChar);
+ }
+ else if (command.startsWith("admin_dmevent_reward_amount "))
+ {
+ DM._rewardAmount = Integer.valueOf(command.substring(28));
+ showMainPage(activeChar);
+ }
+ else if (command.equals("admin_dmevent_spawnpos"))
+ {
+ DM.setPlayersPos(activeChar);
+ showMainPage(activeChar);
+ }
+ else if (command.startsWith("admin_dmevent_color "))
+ {
+ DM._playerColors = Integer.decode("0x" + command.substring(20));
+ showMainPage(activeChar);
+ }
+ else if (command.equals("admin_dmevent_join"))
+ {
+ DM.startJoin(activeChar);
+ showMainPage(activeChar);
+ }
+ else if (command.equals("admin_dmevent_teleport"))
+ {
+ DM.teleportStart();
+ showMainPage(activeChar);
+ }
+ else if (command.equals("admin_dmevent_start"))
+ {
+ DM.startEvent(activeChar);
+ showMainPage(activeChar);
+ }
+ else if (command.equals("admin_dmevent_abort"))
+ {
+ activeChar.sendMessage("Partida Anulada");
+ DM.abortEvent();
+ showMainPage(activeChar);
+ }
+ else if (command.equals("admin_dmevent_finish"))
+ {
+ DM.finishEvent(activeChar);
+ showMainPage(activeChar);
+ }
+ else if (command.equals("admin_dmevent_sit"))
+ {
+ DM.sit();
+ showMainPage(activeChar);
+ }
+ else if (command.equals("admin_dmevent_load"))
+ {
+ DM.loadData();
+ showMainPage(activeChar);
+ }
+ else if (command.equals("admin_dmevent_save"))
+ {
+ DM.saveData();
+ showMainPage(activeChar);
+ }
+ else if (command.equals("admin_dmevent_dump"))
+ DM.dumpData();
+ return true;
+ }
+
+ public String[] getAdminCommandList()
+ {
+ return ADMIN_COMMANDS;
+ }
+
+ private boolean checkLevel(int level)
+ {
+ return level >= REQUIRED_LEVEL;
+ }
+
+ public void showMainPage(L2PcInstance activeChar)
+ {
+ NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
+ TextBuilder replyMSG = new TextBuilder("<html><body>");
+ replyMSG.append("<center><font color=\"LEVEL\">[Death Match - Autor: Mazokista]</font></center><br><br><br>");
+ replyMSG.append("<table><tr><td><edit var=\"input1\" width=\"125\"></td><td><edit var=\"input2\" width=\"125\"></td></tr></table>");
+ replyMSG.append("<table border=\"0\"><tr>");
+ replyMSG.append("<td width=\"100\"><button value=\"Nome\" action=\"bypass -h admin_dmevent_name $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+ replyMSG.append("<td width=\"100\"><button value=\"Descricao\" action=\"bypass -h admin_dmevent_desc $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+ replyMSG.append("<td width=\"100\"><button value=\"Localizacao\" action=\"bypass -h admin_dmevent_join_loc $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+ replyMSG.append("</tr></table><br><table><tr>");
+ replyMSG.append("</tr></table><br><table><tr>");
+ replyMSG.append("<td width=\"100\"><button value=\"Minimo lvl\" action=\"bypass -h admin_dmevent_maxlvl $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+ replyMSG.append("<td width=\"100\"><button value=\"Maximo lvl\" action=\"bypass -h admin_dmevent_minlvl $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+ replyMSG.append("</tr></table><br><table><tr>");
+ replyMSG.append("<td width=\"100\"><button value=\"NPC\" action=\"bypass -h admin_dmevent_npc $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+ replyMSG.append("<td width=\"100\"><button value=\"NPC Pos\" action=\"bypass -h admin_dmevent_npc_pos\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+ replyMSG.append("</tr></table><br><table><tr>");
+ replyMSG.append("<td width=\"100\"><button value=\"Premiacao\" action=\"bypass -h admin_dmevent_reward $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+ replyMSG.append("<td width=\"100\"><button value=\"Quantidade\" action=\"bypass -h admin_dmevent_reward_amount $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+ replyMSG.append("</tr></table><br><table><tr>");
+ replyMSG.append("<td width=\"100\"><button value=\"DM Color\" action=\"bypass -h admin_dmevent_color $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+ replyMSG.append("<td width=\"100\"><button value=\"DM SpawnPos\" action=\"bypass -h admin_dmevent_spawnpos\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+ replyMSG.append("</tr></table><table><br><br><tr>");
+ replyMSG.append("<td width=\"100\"><button value=\"Iniciar Evento\" action=\"bypass -h admin_dmevent_join\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+ replyMSG.append("<td width=\"100\"><button value=\"Teleporte\" action=\"bypass -h admin_dmevent_teleport\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+ replyMSG.append("<td width=\"100\"><button value=\"Iniciar Luta\" action=\"bypass -h admin_dmevent_start\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+ replyMSG.append("</tr></table><table><tr>");
+ replyMSG.append("<td width=\"100\"><button value=\"Aborta Evento\" action=\"bypass -h admin_dmevent_abort\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+ replyMSG.append("<td width=\"100\"><button value=\"Finalizar Evento\" action=\"bypass -h admin_dmevent_finish\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+ replyMSG.append("</tr></table><br><table><tr>");
+ replyMSG.append("<td width=\"100\"><button value=\"Sit Force\" action=\"bypass -h admin_dmevent_sit\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+ replyMSG.append("<td width=\"100\"><button value=\"Estastisticas\" action=\"bypass -h admin_dmevent_dump\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+ replyMSG.append("</tr></table><br><br><table><tr>");
+ replyMSG.append("<td width=\"100\"><button value=\"Salve\" action=\"bypass -h admin_dmevent_save\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+ replyMSG.append("<td width=\"100\"><button value=\"Load Configs\" action=\"bypass -h admin_dmevent_load\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+ replyMSG.append("</tr></table><br><br>");
+ replyMSG.append("Evento Atual...<br1>");
+ replyMSG.append(" ... Nome: <font color=\"00FF00\">" + DM._eventName + "</font><br1>");
+ replyMSG.append(" ... Descricao: <font color=\"00FF00\">" + DM._eventDesc + "</font><br1>");
+ replyMSG.append(" ... Localizacao do evento: <font color=\"00FF00\">" + DM._joiningLocationName + "</font><br1>");
+ replyMSG.append(" ... Localizacao do NPC: <font color=\"00FF00\">" + DM._npcId + " on pos " + DM._npcX + "," + DM._npcY + "," + DM._npcZ + "</font><br1>");
+ replyMSG.append(" ... Premiacao ID: <font color=\"00FF00\">" + DM._rewardId + "</font><br1>");
+ replyMSG.append(" ... Quantidade da Premiacao: <font color=\"00FF00\">" + DM._rewardAmount + "</font><br><br>");
+ replyMSG.append(" ... Minimo lvl Permitido: <font color=\"00FF00\">" + DM._minlvl + "</font><br>");
+ replyMSG.append(" ... Maximo lvl Permitido: <font color=\"00FF00\">" + DM._maxlvl + "</font><br><br>");
+ replyMSG.append(" ... Death Match Color: <font color=\"00FF00\">" + DM._playerColors + "</font><br>");
+ replyMSG.append(" ... Death Match Spawn Pos: <font color=\"00FF00\">" + DM._playerX + "," + DM._playerY + "," + DM._playerZ + "</font><br><br>");
+ replyMSG.append("<img src=l2font-e.mini_logo-e width=180 height=80><br1>");
+ replyMSG.append("Os jogadores atuais:<br1>");
+ if (!DM._started)
+ {
+ replyMSG.append("<br1>");
+ replyMSG.append(DM._players.size() + " Jogadores participantes.");
+ replyMSG.append("<br><br>");
+ }
+ else if (DM._started)
+ {
+ replyMSG.append("<br1>");
+ replyMSG.append(DM._players.size() + " Jogadores ativos no evento.");
+ replyMSG.append("<br><br>");
+ }
+ replyMSG.append("</body></html>");
+ adminReply.setHtml(replyMSG.toString());
+ activeChar.sendPacket(adminReply);
+ }
+}
Index: C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_DP/sql/dm.sql
===================================================================
--- C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_DP/sql/dm.sql (revision 0)
+++ C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_DP/sql/dm.sql (revision 0)
@@ -0,0 +1,35 @@
+/*
+MySQL Data Transfer
+Source Host: localhost
+Source Database: la2chaos
+Target Host: localhost
+Target Database: la2chaos
+Date: 18/1/2011 10:11:34
+*/
+
+SET FOREIGN_KEY_CHECKS=0;
+-- ----------------------------
+-- Table structure for dm
+-- ----------------------------
+CREATE TABLE `dm` (
+ `eventName` varchar(255) NOT NULL default '',
+ `eventDesc` varchar(255) NOT NULL default '',
+ `joiningLocation` varchar(255) NOT NULL default '',
+ `minlvl` int(4) NOT NULL default '0',
+ `maxlvl` int(4) NOT NULL default '0',
+ `npcId` int(8) NOT NULL default '0',
+ `npcX` int(11) NOT NULL default '0',
+ `npcY` int(11) NOT NULL default '0',
+ `npcZ` int(11) NOT NULL default '0',
+ `rewardId` int(11) NOT NULL default '0',
+ `rewardAmount` int(11) NOT NULL default '0',
+ `color` int(11) NOT NULL default '0',
+ `playerX` int(11) NOT NULL default '0',
+ `playerY` int(11) NOT NULL default '0',
+ `playerZ` int(11) NOT NULL default '0'
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+-- Records
+-- ----------------------------
+INSERT INTO `dm` VALUES ('DM Event', 'Cada um por si', 'Giran Tower', '1', '80', '70011', '83441', '148661', '-3400', '6673', '500', '255', '149568', '46626', '-3408');
Index: C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_DP/tools/database_installer.bat
===================================================================
--- C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_DP/tools/database_installer.bat (revision 147)
+++ C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_DP/tools/database_installer.bat (working copy)
@@ -558,6 +558,7 @@
custom_npc.sql
custom_spawnlist.sql
dimensional_rift.sql
+dm.sql
droplist.sql
enchant_skill_trees.sql
etcitem.sql
Index: C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_DP/tools/full_install.sql
===================================================================
--- C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_DP/tools/full_install.sql (revision 147)
+++ C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_DP/tools/full_install.sql (working copy)
@@ -37,6 +37,7 @@
DROP TABLE IF EXISTS class_list;
DROP TABLE IF EXISTS cursed_weapons;
DROP TABLE IF EXISTS droplist;
+DROP TABLE IF EXISTS dm;
DROP TABLE IF EXISTS games;
DROP TABLE IF EXISTS enchant_skill_trees;
DROP TABLE IF EXISTS etcitem;
Index: C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_DP/tools/database_installer.sh
===================================================================
--- C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_DP/tools/database_installer.sh (revision 147)
+++ C:/Documents and Settings/ROBERTO/workspace/L2TitanPlus/Trunk/L2JTitanPlus/L2JTitanPlus_DP/tools/database_installer.sh (working copy)
@@ -295,6 +295,7 @@
$MYG < ../sql/custom_droplist.sql &> /dev/null
$MYG < ../sql/custom_npc.sql &> /dev/null
$MYG < ../sql/dimensional_rift.sql &> /dev/null
+$MYG < ../sql/dm.sql &> /dev/null
$MYG < ../sql/droplist.sql &> /dev/null
$MYG < ../sql/enchant_skill_trees.sql &> /dev/null
$MYG < ../sql/etcitem.sql &> /dev/null
Creditos Por Refazer a DM praticamente Toda : Meus Creditos Pela DM q nao tinha nem a metade desses Codigos : SqueezeD |
|
|
| Os Seguintes 7 Usuários disseram Obrigado(a) para Mazokista por gostarem deste post : |
douglinhas (30-03-2011), gatesofnaia (06-07-2011), llJuniorll (30-03-2011), Sirius (23-01-2012),
thugstronda (06-07-2011), vicfelipe (29-03-2011), xseu02x (16-04-2011) |
| Links Patrocinados |
|
|
#2 (permalink) | |
|
Amigo SE
![]() Registrado em: Nov 2008
Localização: Fim de Mundo chamado: Hortolândia
Posts: 778
Agradeceu: 434
Agradecido 2,796 Vezes em 416 Posts
Nome Real: Victor Felipe Alencastro
|
Citação:
Ele é o dono do código base, então os créditos são dele
__________________
[Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]
|
|
|
|
|
|
|
#5 (permalink) | ||||||||||||||
|
Membro - Aspirante
![]() Registrado em: May 2010
Posts: 52
Agradeceu: 4
Agradecido 14 Vezes em 14 Posts
Achei Ruim:
Acharam ruim Vezes em Posts
Meu Estado:
![]()
|
aqui funcionou perfeitamente, só é chato pq é tudo manual. pra iniciar, o evento, dpois teleporta, ai inicar a luta e dpois finalizar o evento. :S
|
||||||||||||||
|
|
|
||||||||||||||
|
|
#8 (permalink) |
|
Banido
![]() Registrado em: Aug 2010
Localização: Cáceres - MT
Posts: 155
Agradeceu: 13
Agradecido 174 Vezes em 46 Posts
Achei Ruim:
Acharam ruim Vezes em Posts
Meu Estado:
![]() Nome Real: @over12_devdag
|
@exity; serve para qualquer versão porém cada uma será necessária realizar algumas alterações.
|
|
|
|
![]() |
|
|