Noticias:

Debes de estar registrado para poder ver el contenido indicado. Registrate o Conectate

Menú Principal

Evento Trivial

Iniciado por Swarlog, Ago 06, 2022, 01:59 AM

Tema anterior - Siguiente tema

Swarlog

Debes de estar registrado para poder ver el contenido indicado. Registrate o Conectate

Debes de estar registrado para poder ver el contenido indicado. Registrate o Conectate

[code]Index: /trunk/L2jColiseum_GS/java/config/Events.properties
===================================================================
--- /trunk/L2jColiseum_GS/java/config/Events.properties (revision 41)
+++ /trunk/L2jColiseum_GS/java/config/Events.properties (revision 45)
@@ -146,2 +146,14 @@
 # Delay on revive when dead, NOTE: 20000 equals to 20 seconds, minimum 1000 (1 second)
 DMReviveDelay = 20000
+
+# ---------------------------------------------------------------------------
+# Setting for Trivial Event
+# ---------------------------------------------------------------------------
+# Enable/Disable Trivial Engine Interface
+TrivialAllowInterface = True
+# Enable/Disable Announce Correct Answer after check
+TrivialAnnounceCorrectAnswer = True
+# Enable/Disable Announce Reward
+TrivialAnnounceReward = True
+#Enable/Disable Join jailed character by voicecommand
+TrivialAllowPlayInJail = True
Index: /trunk/L2jColiseum_GS/java/com/l2jserver/gameserver/network/clientpackets/RequestBypassToServer.java
===================================================================
--- /trunk/L2jColiseum_GS/java/com/l2jserver/gameserver/network/clientpackets/RequestBypassToServer.java (revision 41)
+++ /trunk/L2jColiseum_GS/java/com/l2jserver/gameserver/network/clientpackets/RequestBypassToServer.java (revision 45)
@@ -34,4 +34,5 @@
 import Debes de estar registrado para poder ver el contenido indicado. Registrate o Conectate;
 import com.l2jserver.gameserver.model.entity.L2Event;
+import com.l2jserver.gameserver.model.entity.Trivial;
 import com.l2jserver.gameserver.model.olympiad.Olympiad;
 import com.l2jserver.gameserver.network.SystemMessageId;
@@ -113,4 +114,8 @@
             playerHelp(activeChar, _command.substring(12));
          }
+         else if (_command.startsWith("trivial_"))
+         {
+            activeChar.setTrivialAnswer(_command.substring(8));
+         }
          else if (_command.startsWith("npc_"))
          {
@@ -160,7 +165,25 @@
                   if (DM._joining)
                      DM.removePlayer(activeChar);
+                  
                   else
                      activeChar.sendMessage("The event is already started. You can not leave now!");
                }
+               //trivial
+               if (_command.substring(endOfId+1).startsWith("trivial_player_join"))
+               {
+                  if (Trivial._joining)
+                     Trivial.addPlayer(activeChar);
+                  else
+                     activeChar.sendMessage("The event is already started. You can not join now!");
+               }
+               else if (_command.substring(endOfId+1).startsWith("trivial_player_leave"))
+               {
+                  if (Trivial._joining)
+                     Trivial.removePlayer(activeChar);
+                  
+                  else
+                     activeChar.sendMessage("The event is already started. You can not leave now!");
+               }
+               //termina trivial
                activeChar.sendPacket(ActionFailed.STATIC_PACKET);
             }
Index: /trunk/L2jColiseum_GS/java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java
===================================================================
--- /trunk/L2jColiseum_GS/java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java (revision 41)
+++ /trunk/L2jColiseum_GS/java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java (revision 45)
@@ -49,6 +49,8 @@
 import com.l2jserver.gameserver.model.actor.instance.L2ClassMasterInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.entity.CTF;
 import com.l2jserver.gameserver.model.entity.ClanHall;
 import com.l2jserver.gameserver.model.entity.Couple;
+import Debes de estar registrado para poder ver el contenido indicado. Registrate o Conectate;
 import com.l2jserver.gameserver.model.entity.Fort;
 import com.l2jserver.gameserver.model.entity.FortSiege;
@@ -56,4 +58,5 @@
 import com.l2jserver.gameserver.model.entity.L2Event;
 import com.l2jserver.gameserver.model.entity.Siege;
+import com.l2jserver.gameserver.model.entity.Trivial;
 import com.l2jserver.gameserver.model.entity.TvTEvent;
 import Debes de estar registrado para poder ver el contenido indicado. Registrate o Conectate;
@@ -514,4 +517,25 @@
       L2ClassMasterInstance.showQuestionMark(activeChar);
       
+      if(Trivial._started)
+      {
+         if (Trivial._players.contains(activeChar))
+         {
+         Trivial.addDisconnectedPlayer(activeChar);
+         }
+      }
+      if(DM._started)
+      {
+         if (DM._savePlayers.contains(activeChar.getName()))
+         {
+            DM.addDisconnectedPlayer(activeChar);
+         }
+      }
+      if (CTF._started)
+      {
+         if (CTF._savePlayers.contains(activeChar.getName()))
+         {
+            CTF.addDisconnectedPlayer(activeChar);
+         }
+      }
       
       int birthday = activeChar.checkBirthDay();
Index: /trunk/L2jColiseum_GS/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- /trunk/L2jColiseum_GS/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (revision 44)
+++ /trunk/L2jColiseum_GS/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (revision 45)
@@ -745,4 +745,8 @@
                _originalKarmaDM;
    public boolean   _inEventDM = false;
+   
+   /** Trivial Engine parameter*/
+   public String _trivialAnswer = "";
+   public boolean _inEventTrivial = false;
 
    /** new loto ticket **/
@@ -14779,3 +14783,12 @@
    }
 }
+public void setTrivialAnswer(String answer)
+{
+   _trivialAnswer = answer;
 }
+
+public String getTrivialAnswer()
+{
+   return _trivialAnswer;
+}
+}
Index: /trunk/L2jColiseum_GS/java/com/l2jserver/gameserver/model/actor/L2Npc.java
===================================================================
--- /trunk/L2jColiseum_GS/java/com/l2jserver/gameserver/model/actor/L2Npc.java (revision 41)
+++ /trunk/L2jColiseum_GS/java/com/l2jserver/gameserver/model/actor/L2Npc.java (revision 45)
@@ -75,4 +75,5 @@
 import com.l2jserver.gameserver.model.entity.Fort;
 import com.l2jserver.gameserver.model.entity.L2Event;
+import com.l2jserver.gameserver.model.entity.Trivial;
 import com.l2jserver.gameserver.model.olympiad.Olympiad;
 import Debes de estar registrado para poder ver el contenido indicado. Registrate o Conectate;
@@ -155,4 +156,6 @@
    public boolean _isCTF_Flag = false;
    public String _CTF_FlagTeamName;
+   
+   public boolean _isEventMobTrivial = false;
 
    public boolean _isEventMobDM = false ;
@@ -1123,4 +1126,6 @@
                else if (_isEventMobDM)
                    DM.showEventHtml(player, String.valueOf(getObjectId()));
+               else if (_isEventMobTrivial)
+                   Trivial.showEventHtm(player, String.valueOf(getObjectId()));
                else
                {
Index: /trunk/L2jColiseum_GS/java/com/l2jserver/gameserver/model/entity/Trivial.java
===================================================================
--- /trunk/L2jColiseum_GS/java/com/l2jserver/gameserver/model/entity/Trivial.java (revision 45)
+++ /trunk/L2jColiseum_GS/java/com/l2jserver/gameserver/model/entity/Trivial.java (revision 45)
@@ -0,0 +1,637 @@
+/*
+ * 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 <Debes de estar registrado para poder ver el contenido indicado. Registrate o Conectate>.
+ */
+package com.l2jserver.gameserver.model.entity;
+
+import com.l2jserver.gameserver.datatables.ItemTable;
+import com.l2jserver.gameserver.datatables.NpcTable;
+import com.l2jserver.gameserver.datatables.SpawnTable;
+import com.l2jserver.gameserver.model.L2Spawn;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
+import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
+import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse;
+import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
+import com.l2jserver.gameserver.network.serverpackets.StatusUpdate;
+import com.l2jserver.gameserver.templates.chars.L2NpcTemplate;
+
+import java.sql.SQLException;
+
+import com.l2jserver.Config;
+import com.l2jserver.L2DatabaseFactory;
+import com.l2jserver.gameserver.Announcements;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.Connection;
+import java.util.Vector;
+import java.util.logging.Logger;
+
+import javolution.text.TextBuilder;
+
+/**
+ *
+ * @author Tuccy && DarkPele
+ *
+ */
+
+public class Trivial
+{
+   private final static Logger   _log = Logger.getLogger(Trivial.class.getName());
+   //fases del evento
+   public static boolean   _joining,
+                      _started;
+   
+   public static String   _eventName ="",
+                     _eventDesc ="",
+                     _joiningLocationName ="",
+                     _question ="",
+                     _answer1 ="",
+                     _answer2 ="",
+                     _answer3 ="",
+                     _answer4 ="",
+                     _answer5 ="",
+                     _correctAnswer ="",
+                     _newQuestion ="",
+                     _newAnswer1 ="",
+                     _newAnswer2 ="",
+                     _newAnswer3 ="",
+                     _newAnswer4 ="",
+                     _newAnswer5 ="",
+                     _newCorrectAnswer ="";
+   
+   public static int      _npcId = 0,
+                     _npcX = 0,
+                     _npcY = 0,
+                     _npcZ = 0,
+                     _npcHeading = 0,
+                     _rewardId = 0,
+                     _rewardAmount = 0,
+                     _joinTime = 0,
+                     _answerTime = 0,
+                     _questionNumber = 5;
+   
+   public static L2Spawn _npcSpawn;
+   public static Vector<L2PcInstance> _players = new Vector<L2PcInstance>();
+   
+   //metodos de cargar y guardar datos de la tabla del evento
+   public static void loadData()
+   {
+      Connection con = null;
+      try
+      {
+         PreparedStatement statement;
+         ResultSet rs;
+
+         con = L2DatabaseFactory.getInstance().getConnection();
+
+         statement = con.prepareStatement("Select * from trivial");
+         rs = statement.executeQuery();
+         
+         while (rs.next())
+         {
+            _eventName = rs.getString("eventName");
+            _eventDesc = rs.getString("eventDesc");
+            _joiningLocationName = rs.getString("joiningLocation");
+            _npcId = rs.getInt("npcId");
+            _npcX = rs.getInt("npcX");
+            _npcY = rs.getInt("npcY");
+            _npcZ = rs.getInt("npcZ");
+            _npcHeading = rs.getInt("npcHeading");
+            _rewardId = rs.getInt("rewardId");
+            _rewardAmount = rs.getInt("rewardAmount");
+            _joinTime = rs.getInt("joinTime");
+            _answerTime = rs.getInt("answerTime");
+            _questionNumber = rs.getInt("questionNumber");
+            
+         }
+         statement.close();
+      }
+      catch (Exception e)
+      {
+         _log.warning("Exception: Trivial.loadData(): " + e.getMessage());
+      }
+      finally
+      {
+         try
+         {
+            if (con != null) con.close();
+         }
+         catch (SQLException e)
+         {
+            e.printStackTrace();
+         }
+      }
+   }
+   //guarda los datos en la base de datos
+   public static void saveData()
+   {
+         Connection con = null;
+         try
+         {
+            con = L2DatabaseFactory.getInstance().getConnection();
+            PreparedStatement statement;
+            
+            statement = con.prepareStatement("Delete from trivial");
+            statement.execute();
+            statement.close();
+
+            statement = con.prepareStatement("INSERT INTO trivial (eventName, eventDesc, joiningLocation, npcId, npcX, npcY, npcZ, npcHeading, rewardId, rewardAmount, joinTime, answerTime, questionNumber ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
+            statement.setString(1, _eventName);
+            statement.setString(2, _eventDesc);
+            statement.setString(3, _joiningLocationName);
+            statement.setInt(4, _npcId);
+            statement.setInt(5, _npcX);
+            statement.setInt(6, _npcY);
+            statement.setInt(7, _npcZ);
+            statement.setInt(8, _npcHeading);
+            statement.setInt(9, _rewardId);
+            statement.setInt(10, _rewardAmount);
+            statement.setInt(11, _joinTime);
+            statement.setInt(12, _answerTime);
+            statement.setInt(13, _questionNumber);
+            statement.execute();
+            statement.close();
+         }
+         catch (Exception e)
+         {
+            _log.warning("Exception: Trivial.saveData(): " + e.getMessage());
+         }
+         finally
+         {
+            try
+            {
+               if (con != null) con.close();
+            }
+            catch (SQLException e)
+            {
+               e.printStackTrace();
+            }
+         }
+   }
+   
+//metodo para meter players al evento
+   public static void addPlayer(L2PcInstance player)
+   {
+      player._inEventTrivial = true;
+      _players.add(player);
+      
+   }
+//metodo para borrar players del evento
+   public static void removePlayer(L2PcInstance player)
+   {
+      player._inEventTrivial = false;
+      player.setTrivialAnswer(null);
+      _players.remove(player);
+   }
+//metodo de spawnear el npc
+   public static void spawnNpc()
+   {
+      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(_npcHeading);
+         _npcSpawn.setRespawnDelay(1);
+
+         SpawnTable.getInstance().addNewSpawn(_npcSpawn, false);
+
+         _npcSpawn.init();
+         _npcSpawn.getLastSpawn().getStatus().setCurrentHp(999999999);
+         _npcSpawn.getLastSpawn().setTitle(_eventName);
+         _npcSpawn.getLastSpawn()._isEventMobTrivial = true;
+         _npcSpawn.getLastSpawn().isAggressive();
+         _npcSpawn.getLastSpawn().decayMe();
+         _npcSpawn.getLastSpawn().spawnMe(_npcSpawn.getLastSpawn().getX(), _npcSpawn.getLastSpawn().getY(), _npcSpawn.getLastSpawn().getZ());
+
+         _npcSpawn.getLastSpawn().broadcastPacket(new MagicSkillUse(_npcSpawn.getLastSpawn(), _npcSpawn.getLastSpawn(), 1034, 1, 1, 1));
+      }
+      catch (Exception e)
+      {
+         _log.warning("Trivial Engine[spawnEventNpc(exception: " + e.getMessage());
+      }
+   }
+   //borra el npc del evento
+   public static void unspawnNpc()
+   {
+      if (_npcSpawn == null)
+      {
+         return;
+         
+      }
+
+      _npcSpawn.getLastSpawn().deleteMe();
+      _npcSpawn.stopRespawn();
+      SpawnTable.getInstance().deleteSpawn(_npcSpawn, true);
+   }
+   //dar recompensa a las respuestas correctas
+   public static void addReward()
+   {
+      if(Config.TRIVIAL_ANNOUNCE_CORRECT_ANSWER)
+      {
+         if(_correctAnswer.toString().equals("answer1"))
+         {
+            AnnounceToPlayers(false,"The correct answer was : " +_answer1);
+         }
+         else if (_correctAnswer.toString().equals("answer2"))
+         {
+            AnnounceToPlayers(false,"The correct answer was : " +_answer2);
+         }
+         else if (_correctAnswer.toString().equals("answer3"))
+         {
+            AnnounceToPlayers(false,"The correct answer was : " +_answer3);
+         }
+         else if (_correctAnswer.toString().equals("answer4"))
+         {
+            AnnounceToPlayers(false,"The correct answer was : " +_answer4);
+         }
+         else if (_correctAnswer.toString().equals("answer5"))
+         {
+            AnnounceToPlayers(false,"The correct answer was : " +_answer5);
+         }
+      }
+      for (L2PcInstance player : _players)
+      {
+         if(player.getTrivialAnswer().equals(_correctAnswer))
+         {
+            player.addItem("Trivial Engine :", _rewardId, _rewardAmount, player, true);
+
+            StatusUpdate su = new StatusUpdate(player.getObjectId());
+            su.addAttribute(StatusUpdate.CUR_LOAD, player.getCurrentLoad());
+            player.sendPacket(su);
+         }
+      }
+   }
+   //metodo para abortar el evento
+   public static void abort()
+   {
+      for (L2PcInstance player : _players)
+      {
+         removePlayer(player);
+      }
+      
+      if(_joining)
+      {
+         _joining = false;
+      }
+      if(_started)
+      {
+         _started = false;
+      }
+      unspawnNpc();
+      AnnounceToPlayers(true,_eventName + " Event aborted!");
+   }
+   
+   //metodo para finalizar el evento
+   public static void finish()
+   {
+      
+      if(_joining)
+      {
+         _joining = false;
+      }
+      if(_started)
+      {
+         _started = false;
+      }
+      unspawnNpc();
+      AnnounceToPlayers(false,_eventName + " Event finish!");
+      for (L2PcInstance player : _players)
+      {
+         removePlayer(player);
+      }
+   }
+   
+   public static void loadQuestion()
+   {
+      String   sentence = "SELECT question,answer1,answer2,answer3,answer4,answer5,correctAnswer FROM trivial_questions ORDER BY RAND() LIMIT 1";
+      
+      Connection con = null;
+
+      try
+      {
+         con = L2DatabaseFactory.getInstance().getConnection();
+         PreparedStatement statement = con.prepareStatement(sentence);
+         ResultSet rset = statement.executeQuery();
+         while (rset.next())
+         {
+            _question=(rset.getString("question"));
+            _answer1=(rset.getString("answer1"));
+            _answer2=(rset.getString("answer2"));
+            _answer3=(rset.getString("answer3"));
+            _answer4=(rset.getString("answer4"));
+            _answer5=(rset.getString("answer5"));
+            _correctAnswer=(rset.getString("correctAnswer"));
+         }
+
+         rset.close();
+         statement.close();
+      }
+      catch (Exception e)
+      {
+         _log.warning("Exception: Trivial.loadQuestion(): " + e.getMessage());
+      }
+      finally
+      {
+         try
+         {
+            if (con != null)
+               con.close();
+         }
+         catch (SQLException e)
+         {
+            e.printStackTrace();
+         }
+      }
+   }
+   
+   //metodo para ver el html de anotarse
+   public static void showEventHtm(L2PcInstance eventPlayer, String objectId)
+   {
+      try
+      {
+         NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
+
+         TextBuilder replyMSG = new TextBuilder("<html><body>");
+         replyMSG.append("Trivial Event<br><br><br>");
+         if(_joining)
+         {
+            if(eventPlayer.isInJail() && !Config.TRIVIAL_ALLOW_PLAY_IN_JAIL)
+            {
+               replyMSG.append("<center>You cant join while are in jail.</center>");
+            }
+            replyMSG.append("Description: " +_eventDesc + "<br>");
+            replyMSG.append("players joining: " +_players.size() + "<br><br>");
+            if (Config.TRIVIAL_ANNOUNCE_REWARD)
+            {
+            replyMSG.append("   ... reward: (" + _rewardAmount + ") " + ItemTable.getInstance().getTemplate(_rewardId).getName() +" porcada respuesta corecta."+"<br>");
+            }
+            if (_players.contains(eventPlayer))
+            {
+               replyMSG.append("You are already participating!<br><br>");
+
+               replyMSG.append("<table border=\"0\"><tr>");
+               replyMSG.append("<td width=\"200\">Wait till event start or</td>");
+               replyMSG.append("<td width=\"60\"><center><button value=\"remove\" action=\"bypass -h npc_" + objectId + "_trivial_player_leave\" width=50 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></center></td>");
+               replyMSG.append("<td width=\"100\">your participation!</td>");
+               replyMSG.append("</tr></table>");
+            }
+            else
+            {
+               replyMSG.append("Would you like join in the Trivial Event?<br><br>");
+               replyMSG.append("<button value=\"Join\" action=\"bypass -h npc_" + objectId + "_trivial_player_join\" width=50 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">");
+               
+            }
+         }
+         else if (_started && !_joining)
+         {
+            replyMSG.append("<center>Trivial event is in progress.</center>");
+         }
+         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.warning("Trivial Engine[showEventHtm(" + eventPlayer.getName() + ", " + objectId + ")]: exception" + e.getMessage());
+      }
+   }
+   //metodo para ver el html con las preguntas y posibles respuestas
+   public static void showEventQuestion()
+   {
+      for(L2PcInstance player: _players)
+      {
+         
+         TextBuilder replyMSG = new TextBuilder();
+         replyMSG.append("<html><title>Trivial event</title>");
+         replyMSG.append("<body>Select the correct answer/Selecciona la pregunta correcta<br><br>");
+         replyMSG.append(_question+"<br><br>");
+
+         replyMSG.append("<table border=\"0\">");
+         replyMSG.append("<tr><td width=\"150\"><center><button value=\""+_answer1+"\" action=\"bypass -h trivial_answer1\" width=220 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></center></td></tr>");
+         replyMSG.append("<tr><td width=\"150\"><center><button value=\""+_answer2+"\" action=\"bypass -h trivial_answer2\" width=220 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></center></td></tr>");
+         replyMSG.append("<tr><td width=\"150\"><center><button value=\""+_answer3+"\" action=\"bypass -h trivial_answer3\" width=220 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></center></td></tr>");
+         replyMSG.append("<tr><td width=\"150\"><center><button value=\""+_answer4+"\" action=\"bypass -h trivial_answer4\" width=220 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></center></td></tr>");
+         replyMSG.append("<tr><td width=\"150\"><center><button value=\""+_answer5+"\" action=\"bypass -h trivial_answer5\" width=220 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></center></td></tr>");
+         replyMSG.append("</table>");
+         replyMSG.append("</body></html>");
+         NpcHtmlMessage html = new NpcHtmlMessage(1);
+         html.setHtml(replyMSG.toString());
+         player.sendPacket(html);
+
+      }
+
+   }
+   //metodo de autoevento
+   public static synchronized void autoEvent()
+   {
+      if (_joinTime > 0)
+      {
+         _joining = true;
+         spawnNpc();
+         waiter(_joinTime * 60 * 1000); // minutes for join event
+      }
+      else if (_joinTime <= 0)
+      {
+         abort();
+         return;
+      }
+      _joining = false;
+      _started = true;
+      if(_started)
+      {
+         for(int x=1; x<=_questionNumber;x++)
+         {
+            loadQuestion();
+            showEventQuestion();
+            waiter(_answerTime * 60 * 1000); // minutes for join event
+            addReward();
+         }
+         finish();
+      }
+      
+   }
+
+   //metodo de sincronizacon del evento
+   private static synchronized void waiter(long interval)
+   {
+      long startWaiterTime = System.currentTimeMillis();
+      int seconds = (int) (interval / 1000);
+
+      while (startWaiterTime + interval > System.currentTimeMillis())
+      {
+         seconds--; // here because we don't want to see two time announce at the same time
+
+         if (_joining || _started)
+         {
+            switch (seconds)
+            {
+            case 3600: // 1 hour left
+               if (_joining)
+               {
+                  AnnounceToPlayers(true,_eventName + "Engine Joinable in " + _joiningLocationName + "!");
+                  AnnounceToPlayers(true,_eventName +" Engine: " + seconds / 60 / 60 + " hour(s) till registration close!");
+               }
+               else if (_started)
+                  AnnounceToPlayers(false,_eventName + " Engine: " + seconds / 60 / 60 + " hour(s) till next question!");
+
+               break;
+            case 1800: // 30 minutes left
+            case 600: //  10 minutes left
+            case 180: // 3 minutes left
+            case 120: // 2 minutes left
+            case 60: // 1 minute left
+               if (_joining)
+               {
+                  removeOfflinePlayers();
+                  AnnounceToPlayers(true,_eventName + " Engine : Joinable in " + _joiningLocationName + "!");
+                  AnnounceToPlayers(true,_eventName + " Engine : " + seconds / 60 + " minute(s) till registration ends!");
+               }
+               else if (_started)
+                  AnnounceToPlayers(false,_eventName + " Engine : " + seconds / 60 + " minute(s) till next Question!");
+
+               break;
+            case 30: // 30 seconds left
+            case 10: // 10 seconds left
+            case 3: // 3 seconds left
+            case 2: // 2 seconds left
+            case 1: // 1 seconds left
+               if (_joining)
+                  AnnounceToPlayers(true,_eventName + " Engine : " + seconds + " second(s) till registration close!");
+               else if (_started)
+                  AnnounceToPlayers(false,_eventName + " Engine : " + seconds + " second(s) till next Question!");
+
+               break;
+            }
+         }
+
+         long startOneSecondWaiterStartTime = System.currentTimeMillis();
+
+         // only the try catch with Thread.sleep(1000) give bad countdown on high wait times
+         while (startOneSecondWaiterStartTime + 1000 > System.currentTimeMillis())
+         {
+            try
+            {
+               Thread.sleep(1);
+            }
+            catch (InterruptedException ie)
+            {
+            }
+         }
+      }
+   }
+   //borra los player que no estan online del evento
+   public static synchronized void removeOfflinePlayers()
+   {
+      try
+      {
+         if (_players == null)
+            return;
+         else if (_players.isEmpty())
+            return;
+         else if (_players.size() > 0)
+         {
+            for (L2PcInstance player : _players)
+            {
+               if (player == null)
+                  _players.remove(player);
+               else if (player.isOnline() == 0 || player.isInJail())
+                  removePlayer(player);
+               if (_players.size() == 0 || _players.isEmpty())
+                  break;
+            }
+         }
+      }
+      catch (Exception e)
+      {
+         _log.warning("Trivial Engine exception: " + e.getMessage());
+         return;
+      }
+   }
+   //metodo que establece la posicion del npc desde el menu
+   public static void setNpcPos(L2PcInstance activeChar)
+   {
+      _npcX = activeChar.getX();
+      _npcY = activeChar.getY();
+      _npcZ = activeChar.getZ();
+   }
+   //metodo de anuncio a los player en evento o fuera de el depende del boolean true para todos false only participants
+   public static void AnnounceToPlayers(Boolean toall, String announce)
+   {
+      if (toall)
+         Announcements.getInstance().announceToAll(announce);
+      else
+      {
+         CreatureSay cs = new CreatureSay(0, 2, "", "Announcements : " + announce);
+         if (_players != null && !_players.isEmpty())
+         {
+            for (L2PcInstance player : _players)
+            {
+               if (player != null && player.isOnline() != 0)
+                  player.sendPacket(cs);
+            }
+         }
+      }
+   }
+   //metodo para guardar preguntas
+   public static void saveQuestion()
+   {
+         Connection con = null;
+         try
+         {
+            con = L2DatabaseFactory.getInstance().getConnection();
+            PreparedStatement statement;
+
+            statement = con.prepareStatement("INSERT INTO trivial_questions (question, answer1, answer2, answer3, answer4, answer5, correctAnswer ) VALUES (?, ?, ?, ?, ?, ?, ?)");
+            statement.setString(1, _newQuestion);
+            statement.setString(2, _newAnswer1);
+            statement.setString(3, _newAnswer2);
+            statement.setString(4, _newAnswer3);
+            statement.setString(5, _newAnswer4);
+            statement.setString(6, _newAnswer5);
+            statement.setString(7, _newCorrectAnswer);
+            statement.execute();
+            statement.close();
+         }
+         catch (Exception e)
+         {
+            _log.warning("Exception: Trivial.saveQuestion(): " + e.getMessage());
+         }
+         finally
+         {
+            try
+            {
+               if (con != null) con.close();
+            }
+            catch (SQLException e)
+            {
+               e.printStackTrace();
+            }
+         }
+   }
+   //metodo que devuelve al evento a los players que se han desconectado
+   public static void addDisconnectedPlayer(L2PcInstance player)
+   {
+      _players.add(player);
+      player._inEventTrivial=true;
+   }
+}
Index: /trunk/L2jColiseum_GS/java/com/l2jserver/Config.java
===================================================================
--- /trunk/L2jColiseum_GS/java/com/l2jserver/Config.java (revision 44)
+++ /trunk/L2jColiseum_GS/java/com/l2jserver/Config.java (revision 45)
@@ -971,4 +971,8 @@
    public static boolean DM_REVIVE_RECOVERY;
    public static long DM_REVIVE_DELAY;
+   public static boolean TRIVIAL_ALLOW_INTERFACE;
+   public static boolean TRIVIAL_ANNOUNCE_CORRECT_ANSWER;
+   public static boolean TRIVIAL_ANNOUNCE_REWARD;
+   public static boolean TRIVIAL_ALLOW_PLAY_IN_JAIL;
    
    //--------------------------------------------------
@@ -2525,4 +2529,9 @@
                      DM_REVIVE_DELAY = 1000; //can't be set less then 1 second
                
+               TRIVIAL_ALLOW_INTERFACE = Boolean.parseBoolean(EventsSettings.getProperty("TrivialAllowInterface", "true"));
+               TRIVIAL_ANNOUNCE_CORRECT_ANSWER = Boolean.parseBoolean(EventsSettings.getProperty("TrivialAnnounceCorrectAnswer", "true"));
+               TRIVIAL_ANNOUNCE_REWARD = Boolean.parseBoolean(EventsSettings.getProperty("TrivialAnnounceReward", "true"));
+               TRIVIAL_ALLOW_PLAY_IN_JAIL = Boolean.parseBoolean(EventsSettings.getProperty("TrivialAllowPlayInJail", "true"));
+               
             }
             catch (Exception e)
Index: /trunk/L2jColiseum_DP/sql/Trivial.sql
===================================================================
--- /trunk/L2jColiseum_DP/sql/Trivial.sql (revision 45)
+++ /trunk/L2jColiseum_DP/sql/Trivial.sql (revision 45)
@@ -0,0 +1,75 @@
+INSERT INTO `admin_command_access_rights` VALUES ('admin_trivial', '1');
+INSERT INTO `admin_command_access_rights` VALUES ('admin_trivial_name', '1');
+INSERT INTO `admin_command_access_rights` VALUES ('admin_trivial_desc', '1');
+INSERT INTO `admin_command_access_rights` VALUES ('admin_trivial_join_loc', '1');
+INSERT INTO `admin_command_access_rights` VALUES ('admin_trivial_npc', '1');
+INSERT INTO `admin_command_access_rights` VALUES ('admin_trivial_npc_pos', '1');
+INSERT INTO `admin_command_access_rights` VALUES ('admin_trivial_reward', '1');
+INSERT INTO `admin_command_access_rights` VALUES ('admin_trivial_reward_amount', '1');
+INSERT INTO `admin_command_access_rights` VALUES ('admin_trivial_abort', '1');
+INSERT INTO `admin_command_access_rights` VALUES ('admin_trivial_save', '1');
+INSERT INTO `admin_command_access_rights` VALUES ('admin_trivial_load', '1');
+INSERT INTO `admin_command_access_rights` VALUES ('admin_trivial_questionNumber', '1');
+INSERT INTO `admin_command_access_rights` VALUES ('admin_trivial_jointime', '1');
+INSERT INTO `admin_command_access_rights` VALUES ('admin_trivial_answerTime', '1');
+INSERT INTO `admin_command_access_rights` VALUES ('admin_trivial_autoevent', '1');
+INSERT INTO `admin_command_access_rights` VALUES ('admin_trivial_addQuestion', '1');
+INSERT INTO `admin_command_access_rights` VALUES ('admin_trivial_setQuestion', '1');
+INSERT INTO `admin_command_access_rights` VALUES ('admin_trivial_setAnswer1', '1');
+INSERT INTO `admin_command_access_rights` VALUES ('admin_trivial_setAnswer2', '1');
+INSERT INTO `admin_command_access_rights` VALUES ('admin_trivial_setAnswer3', '1');
+INSERT INTO `admin_command_access_rights` VALUES ('admin_trivial_setAnswer4', '1');
+INSERT INTO `admin_command_access_rights` VALUES ('admin_trivial_setAnswer5', '1');
+INSERT INTO `admin_command_access_rights` VALUES ('admin_trivial_setCorrectAnswer', '1');
+INSERT INTO `admin_command_access_rights` VALUES ('admin_trivial_saveQuestion', '1');
+
+
+--
+-- Estructura de tabla para la tabla `trivial`
+--
+
+CREATE TABLE `trivial` (
+  `eventName` varchar(255) NOT NULL,
+  `eventDesc` varchar(255) NOT NULL,
+  `joiningLocation` varchar(255) NOT NULL,
+  `npcId` int(11) 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',
+  `npcHeading` int(11) NOT NULL default '0',
+  `rewardId` int(11) NOT NULL default '0',
+  `rewardAmount` int(11) NOT NULL default '0',
+  `joinTime` int(11) NOT NULL default '0',
+  `answerTime` int(11) NOT NULL default '0',
+  `questionNumber` int(11) NOT NULL default '0'
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+--
+-- Volcar la base de datos para la tabla `trivial`
+--
+
+INSERT INTO `trivial` VALUES ('Trivial', 'Chose your answer', 'Giran', 70006, 83306, 148626, -3408, 0, 6673, 1, 5, 1, 15);
+
+CREATE TABLE `trivial_questions` (
+  `question` longtext NOT NULL,
+  `answer1` varchar(255) NOT NULL,
+  `answer2` varchar(255) NOT NULL,
+  `answer3` varchar(255) NOT NULL,
+  `answer4` varchar(255) NOT NULL,
+  `answer5` varchar(255) NOT NULL,
+  `correctAnswer` varchar(255) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+--
+-- Volcar la base de datos para la tabla `trivial_questions`
+--
+
+INSERT INTO `trivial_questions` VALUES ('Capital de francia', 'Tolous', 'Dublin', 'Madrid', 'Roma', 'Paris', 'answer5');
+INSERT INTO `trivial_questions` VALUES ('Amigo inseparable de ash en pokemon', 'Chikorita', 'Charmander', 'Pikachu', 'Tamagochi', 'Potorro', 'answer3');
+INSERT INTO `trivial_questions` VALUES ('Los 3 reyes magos son', 'gaspar, la porta, guardiola', 'mechon, caspa, vasaltar', 'pikolo, goku, vegeta', 'tinkiwinki, dipsey, poh', 'melchor, gaspar, baltasar', 'answer5');
+INSERT INTO `trivial_questions` VALUES ('cual de las sigientes no es una de <br> las 7 maravillas del mundo:', 'muralla china', 'Chichen Itza', 'cataratas del niagara', 'taj mahal', 'coliseo romano', 'answer3');
+INSERT INTO `trivial_questions` VALUES ('el lenguaje de programacion gracias al cual podemos disfrutar de lineageII de forma gratuita fue programado por?', 'sun microsystem', 'denys richey', 'bill gates', 'tuccy', 'pol halan', 'answer1');
+INSERT INTO `trivial_questions` VALUES ('capital de Alemania', 'Dubai', 'Dublin', 'Berlin', 'Alcorcon', 'Monaco', 'answer3');
+
+
+INSERT INTO `npc` VALUES (70006, 32558, 'Trivial', 1, 'Trivial Event Manager', 1, 'LineageNPC2.K_M1_master', 23.00, 37.00, 70, 'male', 'L2Npc', 40, 2444, 2444, 0.00, 0.00, 10, 10, 10, 10, 10, 10, 0, 0, 500, 500, 500, 500, 278, 0, 333, 9376, 0, 0, 0, 30, 120, '', 0, 0, 0, 'LAST_HIT', 0, 0, 0, 'balanced', 'false');
Index: /trunk/L2jColiseum_DP/sql/dm.sql
===================================================================
--- /trunk/L2jColiseum_DP/sql/dm.sql (revision 41)
+++ /trunk/L2jColiseum_DP/sql/dm.sql (revision 45)
@@ -56,3 +56,4 @@
 --
 
-INSERT INTO `npc` VALUES (70005, 32558, 'DM', 1, 'DM Event Manager', 1, 'LineageNPC2.K_M1_master', 23.00, 37.00, 70, 'male', 'L2Npc', 40, 2444, 2444, 0.00, 0.00, 10, 10, 10, 10, 10, 10, 0, 0, 500, 500, 500, 500, 278, 0, 333, 9376, 0, 0, 0, 30, 120, '', 0, 0, 0, 'LAST_HIT', 0, 0, 0, 'balanced', 'false');
+
+INSERT INTO `npc` VALUES (70005, 32558, 'Pele', 1, 'DM Event Manager', 1, 'LineageNPC2.K_M1_master', 23.00, 37.00, 70, 'male', 'L2Npc', 40, 2444, 2444, 0.00, 0.00, 10, 10, 10, 10, 10, 10, 0, 0, 500, 500, 500, 500, 278, 0, 333, 9376, 0, 0, 0, 30, 120, '', 0, 0, 0, 'LAST_HIT', 0, 0, 0, 'balanced', 'false');
Index: /trunk/L2jColiseum_DP/tools/database_installer.bat
===================================================================
--- /trunk/L2jColiseum_DP/tools/database_installer.bat (revision 41)
+++ /trunk/L2jColiseum_DP/tools/database_installer.bat (revision 45)
@@ -740,4 +740,5 @@
 ctf.sql
 dm.sql
+Trivial.sql
 cursed_weapons.sql
 dimensional_rift.sql
Index: /trunk/L2jColiseum_DP/tools/full_install.sql
===================================================================
--- /trunk/L2jColiseum_DP/tools/full_install.sql (revision 41)
+++ /trunk/L2jColiseum_DP/tools/full_install.sql (revision 45)
@@ -36,4 +36,6 @@
 DROP TABLE IF EXISTS ctf_teams;
 DROP TABLE IF EXISTS dm;
+DROP TABLE IF EXISTS trivial;
+DROP TABLE IF EXISTS trivial_questions;
 DROP TABLE IF EXISTS cursed_weapons;
 DROP TABLE IF EXISTS dimensional_rift;
Index: /trunk/L2jColiseum_DP/tools/database_installer.sh
===================================================================
--- /trunk/L2jColiseum_DP/tools/database_installer.sh (revision 41)
+++ /trunk/L2jColiseum_DP/tools/database_installer.sh (revision 45)
@@ -396,4 +396,5 @@
 $MYG < ../sql/ctf.sql &> /dev/null
 $MYG < ../sql/dm.sql &> /dev/null
+$MYG < ../sql/Trivial.sql &> /dev/null
 $MYG < ../sql/cursed_weapons.sql &> /dev/null
 $MYG < ../sql/dimensional_rift.sql &> /dev/null
Index: /trunk/L2jColiseum_DP/data/scripts/handlers/admincommandhandlers/AdminTrivialEngine.java
===================================================================
--- /trunk/L2jColiseum_DP/data/scripts/handlers/admincommandhandlers/AdminTrivialEngine.java (revision 45)
+++ /trunk/L2jColiseum_DP/data/scripts/handlers/admincommandhandlers/AdminTrivialEngine.java (revision 45)
@@ -0,0 +1,335 @@
+/*
+ * 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 <Debes de estar registrado para poder ver el contenido indicado. Registrate o Conectate>.
+ */
+package handlers.admincommandhandlers;
+
+/**
+ *
+ * @author SqueezeD
+ *
+ */
+
+import javolution.text.TextBuilder;
+
+import com.l2jserver.gameserver.ThreadPoolManager;
+import com.l2jserver.gameserver.handler.IAdminCommandHandler;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.entity.Trivial;
+import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
+
+public class AdminTrivialEngine implements IAdminCommandHandler
+{
+   private static final String[]   ADMIN_COMMANDS   =
+                                       {
+         "admin_trivial",
+         "admin_trivial_name",
+         "admin_trivial_desc",
+         "admin_trivial_join_loc",
+         "admin_trivial_npc",
+         "admin_trivial_npc_pos",
+         "admin_trivial_reward",
+         "admin_trivial_reward_amount",
+         "admin_trivial_abort",
+         "admin_trivial_save",
+         "admin_trivial_load",
+         "admin_trivial_questionNumber",
+         "admin_trivial_jointime",
+         "admin_trivial_answerTime",
+         "admin_trivial_autoevent",
+         "admin_trivial_addQuestion",
+         "admin_trivial_setQuestion",
+         "admin_trivial_setAnswer1",
+         "admin_trivial_setAnswer2",
+         "admin_trivial_setAnswer3",
+         "admin_trivial_setAnswer4",
+         "admin_trivial_setAnswer5",
+         "admin_trivial_setCorrectAnswer",
+         "admin_trivial_saveQuestion"
+         };
+
+   public boolean useAdminCommand(String command, L2PcInstance activeChar)
+   {
+      if (command.equals("admin_trivial"))
+         showMainPage(activeChar);
+      else if (command.startsWith("admin_trivial_name "))
+      {
+         Trivial._eventName = command.substring(19);
+         showMainPage(activeChar);
+      }
+      else if (command.startsWith("admin_trivial_desc "))
+      {
+         Trivial._eventDesc = command.substring(19);
+         showMainPage(activeChar);
+      }
+      else if (command.startsWith("admin_trivial_join_loc "))
+      {
+         Trivial._joiningLocationName = command.substring(23);
+         showMainPage(activeChar);
+      }
+      else if (command.startsWith("admin_trivial_npc "))
+      {
+         Trivial._npcId = Integer.valueOf(command.substring(18));
+         showMainPage(activeChar);
+      }
+      else if (command.equals("admin_trivial_npc_pos"))
+      {
+         Trivial.setNpcPos(activeChar);
+         showMainPage(activeChar);
+      }
+      else if (command.startsWith("admin_trivial_reward "))
+      {
+         Trivial._rewardId = Integer.valueOf(command.substring(21));
+         showMainPage(activeChar);
+      }
+      else if (command.startsWith("admin_trivial_reward_amount "))
+      {
+         Trivial._rewardAmount = Integer.valueOf(command.substring(28));
+         showMainPage(activeChar);
+      }
+      else if (command.startsWith("admin_trivial_questionNumber "))
+      {
+         Trivial._questionNumber = Integer.valueOf(command.substring(29));
+         showMainPage(activeChar);
+      }
+      else if (command.startsWith("admin_trivial_jointime "))
+      {
+         Trivial._joinTime = Integer.valueOf(command.substring(23));
+         showMainPage(activeChar);
+      }
+      else if (command.startsWith("admin_trivial_answerTime "))
+      {
+         Trivial._answerTime = Integer.valueOf(command.substring(25));
+         showMainPage(activeChar);
+      }
+      else if (command.equals("admin_trivial_abort"))
+      {
+         activeChar.sendMessage("Aborting event");
+         Trivial.abort();
+         showMainPage(activeChar);
+      }
+      else if (command.equals("admin_trivial_load"))
+      {
+         Trivial.loadData();
+         showMainPage(activeChar);
+      }
+      else if (command.equals("admin_trivial_autoevent"))
+      {
+         if (Trivial._joinTime > 0 && Trivial._questionNumber > 0)
+               ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
+               {
+                   public void run()
+                   {
+                      Trivial.autoEvent();
+                   }
+               }, 0);
+         else
+            activeChar.sendMessage("Wrong usege: join time or event time invallid.");
+         showMainPage(activeChar);
+      }
+      else if (command.equals("admin_trivial_save"))
+      {
+         Trivial.saveData();
+         showMainPage(activeChar);
+      }
+      else if (command.startsWith("admin_trivial_addQuestion"))
+      {
+         showQuestionPage(activeChar);
+      }
+      else if (command.startsWith("admin_trivial_setQuestion "))
+      {
+         Trivial._newQuestion = command.substring(26);
+         showQuestionPage(activeChar);
+      }
+      else if (command.startsWith("admin_trivial_setAnswer1 "))
+      {
+         Trivial._newAnswer1 = command.substring(25);
+         showQuestionPage(activeChar);
+      }
+      else if (command.startsWith("admin_trivial_setAnswer2 "))
+      {
+         Trivial._newAnswer2 = command.substring(25);
+         showQuestionPage(activeChar);
+      }
+      else if (command.startsWith("admin_trivial_setAnswer3 "))
+      {
+         Trivial._newAnswer3 = command.substring(25);
+         showQuestionPage(activeChar);
+      }
+      else if (command.startsWith("admin_trivial_setAnswer4 "))
+      {
+         Trivial._newAnswer4 = command.substring(25);
+         showQuestionPage(activeChar);
+      }
+      else if (command.startsWith("admin_trivial_setAnswer5 "))
+      {
+         Trivial._newAnswer5 = command.substring(25);
+         showQuestionPage(activeChar);
+      }
+      else if (command.startsWith("admin_trivial_setCorrectAnswer "))
+      {
+         Trivial._newCorrectAnswer = command.substring(31);
+         showQuestionPage(activeChar);
+      }
+      else if (command.startsWith("admin_trivial_saveQuestion"))
+      {
+         Trivial.saveQuestion();
+         showQuestionPage(activeChar);
+      }
+
+      return true;
+   }
+
+   public String[] getAdminCommandList()
+   {
+      return ADMIN_COMMANDS;
+   }
+
+   public void showMainPage(L2PcInstance activeChar)
+   {
+      NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
+      TextBuilder replyMSG = new TextBuilder("<html><body>");
+
+      replyMSG.append("<center><font color=\"LEVEL\">[Trivial Engine - by Tuccy]</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=\"Name\" action=\"bypass -h admin_trivial_name $input1\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
+      replyMSG
+            .append("<td width=\"100\"><button value=\"Description\" action=\"bypass -h admin_trivial_desc $input1\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
+      replyMSG
+            .append("<td width=\"100\"><button value=\"Join Location\" action=\"bypass -h admin_trivial_join_loc $input1\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
+      replyMSG.append("</tr></table><br><table><tr>");
+      replyMSG
+            .append("<td width=\"100\"><button value=\"NPC\" action=\"bypass -h admin_trivial_npc $input1\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
+      replyMSG
+            .append("<td width=\"100\"><button value=\"NPC Pos\" action=\"bypass -h admin_trivial_npc_pos\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
+      replyMSG.append("</tr></table><br><table><tr>");
+      replyMSG
+            .append("<td width=\"100\"><button value=\"Reward\" action=\"bypass -h admin_trivial_reward $input1\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
+      replyMSG
+            .append("<td width=\"100\"><button value=\"Reward Amount\" action=\"bypass -h admin_trivial_reward_amount $input1\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
+      replyMSG.append("</tr></table><br><table><tr>");
+      replyMSG
+            .append("<td width=\"100\"><button value=\"Question number\" action=\"bypass -h admin_trivial_questionNumber $input1\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
+      replyMSG
+            .append("<td width=\"100\"><button value=\"Join Time\" action=\"bypass -h admin_trivial_jointime $input1\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
+      replyMSG
+            .append("<td width=\"100\"><button value=\"Answer Time\" action=\"bypass -h admin_trivial_answerTime $input1\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
+      replyMSG.append("</tr></table><br><br><br><table><tr>");
+      replyMSG
+            .append("<td width=\"100\"><button value=\"Abort\" action=\"bypass -h admin_trivial_abort\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
+      replyMSG.append("</tr></table><br><table><tr>");
+      replyMSG
+            .append("<td width=\"100\"><button value=\"Auto Event\" action=\"bypass -h admin_trivial_autoevent\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
+      replyMSG.append("</tr></table><br><br><table><tr>");
+      replyMSG
+            .append("<td width=\"100\"><button value=\"Save\" action=\"bypass -h admin_trivial_save\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
+      replyMSG
+            .append("<td width=\"100\"><button value=\"Load\" action=\"bypass -h admin_trivial_load\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
+      replyMSG.append("</tr></table><br><br>");
+      replyMSG.append("<center><button value=\"Add question\" action=\"bypass -h admin_trivial_addQuestion\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></center>");
+      replyMSG.append("<br><br>");
+      replyMSG.append("Current event...<br1>");
+      replyMSG.append("    ... name:&nbsp;<font color=\"00FF00\">" + Trivial._eventName + "</font><br1>");
+      replyMSG.append("    ... description:&nbsp;<font color=\"00FF00\">" + Trivial._eventDesc + "</font><br1>");
+      replyMSG.append("    ... joining location name:&nbsp;<font color=\"00FF00\">" + Trivial._joiningLocationName + "</font><br1>");
+      replyMSG.append("    ... joining NPC ID:&nbsp;<font color=\"00FF00\">" + Trivial._npcId + " on pos " + Trivial._npcX + "," + Trivial._npcY + "," + Trivial._npcZ
+            + "</font><br1>");
+      replyMSG.append("    ... reward ID:&nbsp;<font color=\"00FF00\">" + Trivial._rewardId + "</font><br1>");
+      replyMSG.append("    ... reward Amount:&nbsp;<font color=\"00FF00\">" + Trivial._rewardAmount + "</font><br><br>");
+      replyMSG.append("    ... question number:&nbsp;<font color=\"00FF00\">" + Trivial._questionNumber + "</font><br><br>");
+      replyMSG.append("    ... join Time:&nbsp;<font color=\"00FF00\">" + Trivial._joinTime + "</font><br><br>");
+      replyMSG.append("    ... event Answer Time:&nbsp;<font color=\"00FF00\">" + Trivial._answerTime + "</font><br><br>");
+      replyMSG.append("Current players:<br1>");
+
+      if (!Trivial._started)
+      {
+         replyMSG.append("<br1>");
+         replyMSG.append(Trivial._players.size() + " players participating.");
+         replyMSG.append("<br><br>");
+      }
+      else if (Trivial._started)
+      {
+         replyMSG.append("<br1>");
+         replyMSG.append(Trivial._players.size() + " players in fighting event.");
+         replyMSG.append("<br><br>");
+      }
+
+      replyMSG.append("</body></html>");
+      adminReply.setHtml(replyMSG.toString());
+      activeChar.sendPacket(adminReply);
+   }
+   
+   
+   
+   public void showQuestionPage(L2PcInstance activeChar)
+   {
+      NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
+      TextBuilder replyMSG = new TextBuilder("<html><body>");
+
+      replyMSG.append("<center><font color=\"LEVEL\">[Trivial Engine - by Tuccy]</font></center><br><br><br>");
+      replyMSG.append("inserta los valores de toda la nueva pregunta en las casillas<br>");
+      replyMSG.append("la respuesta correcta debe indicarse como answer1,answer2,answer3,answer4 o answer5");
+      replyMSG.append("<table>");
+      replyMSG.append("<tr>");
+      replyMSG.append("<td>question :</td>");
+      replyMSG.append("<td><edit var=\"input1\" width=\"100\"></td>");
+      replyMSG.append("<td width=\"60\"><button value=\"Set\" action=\"bypass -h admin_trivial_setQuestion $input1\" width=50 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
+      replyMSG.append("</tr>");
+      replyMSG.append("<tr>");
+      replyMSG.append("<td>answer1 :</td>");
+      replyMSG.append("<td><edit var=\"input2\" width=\"100\"></td>");
+      replyMSG.append("<td width=\"60\"><button value=\"Set\" action=\"bypass -h admin_trivial_setAnswer1 $input2\" width=50 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
+      replyMSG.append("</tr>");
+      replyMSG.append("<tr>");
+      replyMSG.append("<td>answer2 :</td>");
+      replyMSG.append("<td><edit var=\"input3\" width=\"100\"></td>");
+      replyMSG.append("<td width=\"60\"><button value=\"Set\" action=\"bypass -h admin_trivial_setAnswer2 $input3\" width=50 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
+      replyMSG.append("</tr>");
+      replyMSG.append("<tr>");
+      replyMSG.append("<td>answer3 :</td>");
+      replyMSG.append("<td><edit var=\"input4\" width=\"100\"></td>");
+      replyMSG.append("<td width=\"60\"><button value=\"Set\" action=\"bypass -h admin_trivial_setAnswer3 $input4\" width=50 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
+      replyMSG.append("</tr>");
+      replyMSG.append("<tr>");
+      replyMSG.append("<td>answer4 :</td>");
+      replyMSG.append("<td><edit var=\"input5\" width=\"100\"></td>");
+      replyMSG.append("<td width=\"60\"><button value=\"Set\" action=\"bypass -h admin_trivial_setAnswer4 $input5\" width=50 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
+      replyMSG.append("</tr>");
+      replyMSG.append("<tr>");
+      replyMSG.append("<td>answer5 :</td>");
+      replyMSG.append("<td><edit var=\"input6\" width=\"100\"></td>");
+      replyMSG.append("<td width=\"60\"><button value=\"Set\" action=\"bypass -h admin_trivial_setAnswer5 $input6\" width=50 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
+      replyMSG.append("</tr>");
+      replyMSG.append("<tr>");
+      replyMSG.append("<td>correct answer :</td>");
+      replyMSG.append("<td><edit var=\"input7\" width=\"100\"></td>");
+      replyMSG.append("<td width=\"60\"><button value=\"Set\" action=\"bypass -h admin_trivial_setCorrectAnswer $input7\" width=50 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
+      replyMSG.append("</tr>");
+      replyMSG.append("</table>");
+      replyMSG.append("<br><br>");
+      replyMSG.append("Current question...<br1>");
+      replyMSG.append("    ... Question:&nbsp;<font color=\"00FF00\">" + Trivial._newQuestion + "</font><br1>");
+      replyMSG.append("    ... answer1:&nbsp;<font color=\"00FF00\">" + Trivial._newAnswer1 + "</font><br1>");
+      replyMSG.append("    ... answer2:&nbsp;<font color=\"00FF00\">" + Trivial._newAnswer2 + "</font><br1>");
+      replyMSG.append("    ... answer3:&nbsp;<font color=\"00FF00\">" + Trivial._newAnswer3 + "</font><br1>");
+      replyMSG.append("    ... answer4:&nbsp;<font color=\"00FF00\">" + Trivial._newAnswer4 + "</font><br1>");
+      replyMSG.append("    ... answer5:&nbsp;<font color=\"00FF00\">" + Trivial._newAnswer5 + "</font><br><br>");
+      replyMSG.append("    ... Correct answer:&nbsp;<font color=\"00FF00\">" + Trivial._newCorrectAnswer + "</font><br><br>");
+      replyMSG.append("<center><button value=\"Save\" action=\"bypass -h admin_trivial_saveQuestion\" width=150 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></center>");
+      replyMSG.append("</body></html>");
+      adminReply.setHtml(replyMSG.toString());
+      activeChar.sendPacket(adminReply);
+   }
+}
Index: /trunk/L2jColiseum_DP/data/scripts/handlers/MasterHandler.java
===================================================================
--- /trunk/L2jColiseum_DP/data/scripts/handlers/MasterHandler.java (revision 41)
+++ /trunk/L2jColiseum_DP/data/scripts/handlers/MasterHandler.java (revision 45)
@@ -107,4 +107,5 @@
       AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminCTFEngine());
       AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminDMEngine());
+      AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminTrivialEngine());
       _log.config("Loaded " + AdminCommandHandler.getInstance().size() + "  AdminCommandHandlers");
    }
@@ -239,4 +240,6 @@
        if (Config.DM_ALLOW_INTERFERENCE)
          VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new DMCmd());
+       if (Config.TRIVIAL_ALLOW_INTERFACE)
+         VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new TrivialCmd());
       _log.config("Loaded " + VoicedCommandHandler.getInstance().size() + " VoicedHandlers");
    }

Index: /trunk/L2jColiseum_DP/data/scripts/handlers/voicedcommandhandlers/TrivialCmd.java
===================================================================
--- /trunk/L2jColiseum_DP/data/scripts/handlers/voicedcommandhandlers/TrivialCmd.java (revision 45)
+++ /trunk/L2jColiseum_DP/data/scripts/handlers/voicedcommandhandlers/TrivialCmd.java (revision 45)
@@ -0,0 +1,112 @@
+/*
+ * 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.