Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P gameserver
- Index: java/net/sf/l2j/gameserver/GameServer.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/GameServer.java (revision 36)
- +++ java/net/sf/l2j/gameserver/GameServer.java (working copy)
- @@ -101,6 +101,7 @@
- import net.sf.l2j.gameserver.model.PartyMatchWaitingList;
- import net.sf.l2j.gameserver.model.entity.Castle;
- import net.sf.l2j.gameserver.model.entity.Hero;
- +import net.sf.l2j.gameserver.model.entity.TriviaEventManager;
- import net.sf.l2j.gameserver.model.olympiad.Olympiad;
- import net.sf.l2j.gameserver.model.olympiad.OlympiadGameManager;
- import net.sf.l2j.gameserver.model.votereward.VoteMain;
- @@ -271,6 +272,8 @@
- OlympiadGameManager.getInstance();
- Olympiad.getInstance();
- Hero.getInstance();
- +
- + TriviaEventManager.getInstance();
- Util.printSection("Four Sepulchers");
- FourSepulchersManager.getInstance().init();
- Index: java/net/sf/l2j/gameserver/model/entity/Trivia.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/entity/Trivia.java (revision 0)
- +++ java/net/sf/l2j/gameserver/model/entity/Trivia.java (revision 0)
- @@ -0,0 +1,216 @@
- +package net.sf.l2j.gameserver.model.entity;
- +
- +
- +import java.io.File;
- +import java.util.logging.Logger;
- +
- +import javax.xml.parsers.DocumentBuilder;
- +import javax.xml.parsers.DocumentBuilderFactory;
- +
- +import javolution.util.FastMap;
- +import net.sf.l2j.gameserver.Announcements;
- +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- +import net.sf.l2j.gameserver.network.clientpackets.Say2;
- +import net.sf.l2j.gameserver.network.serverpackets.CreatureSay;
- +import net.sf.l2j.util.Rnd;
- +
- +import org.w3c.dom.Document;
- +import org.w3c.dom.Element;
- +import org.w3c.dom.Node;
- +import org.w3c.dom.NodeList;
- +
- +
- +public class Trivia
- +{
- + enum EventState
- + {
- + INACTIVE,
- + ASKING,
- + ANSWERING,
- + CORRECT,
- + REWARDING,
- + ENDING
- + }
- + protected static final Logger _log = Logger.getLogger(Trivia.class.getName());
- + private static EventState _state = EventState.INACTIVE;
- + //ID of the reward
- + private static int _rewardID = 9142;
- + //Ammount of the reward
- + private static int _rewardCount = 1;
- + private static long questionTime=0;
- + private static FastMap<String,String> q_a = new FastMap<String,String>();
- + public static int asked=0;
- + private static String question,answer;
- +
- + private Trivia()
- + {
- +
- + }
- + public static void init()
- + {
- + setState(EventState.INACTIVE);
- + getQuestions();
- + }
- + private static void getQuestions()
- + {
- + File file = new File("config/Trivia.xml");
- + String ask, answer;
- + try
- + {
- + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- + DocumentBuilder db = dbf.newDocumentBuilder();
- + Document doc = db.parse(file);
- + doc.getDocumentElement().normalize();
- + NodeList trvLst = doc.getElementsByTagName("trivia");
- + for (int s = 0; s < trvLst.getLength(); s++)
- + {
- + Node trvNode = trvLst.item(s);
- + if (trvNode.getNodeType() == Node.ELEMENT_NODE)
- + {
- + Element triviaElement = (Element)trvNode;
- + NodeList trvList = triviaElement.getElementsByTagName("question");
- + Element questionElement = (Element)trvList.item(0);
- +
- + NodeList textQsList = questionElement.getChildNodes();
- + ask = ((Node)textQsList.item(0)).getNodeValue().trim();
- +
- + NodeList answerList = triviaElement.getElementsByTagName("answer");
- + Element answerElement = (Element)answerList.item(0);
- +
- + NodeList textAnList = answerElement.getChildNodes();
- + answer = ((Node)textAnList.item(0)).getNodeValue().trim();
- + q_a.put(ask, answer);
- + }
- +
- + }
- + }
- + catch (Exception e)
- + {
- + e.printStackTrace();
- + }
- + }
- + public static void handleAnswer(String s,L2PcInstance pi)
- + {
- + if(s.equalsIgnoreCase(answer))
- + {
- + pi.sendPacket(new CreatureSay(12345, Say2.TELL, "Trivia", "Correct!"));
- + setState(EventState.REWARDING);
- + Announcements.announceToAll("Winner is "+pi.getName()+"! He answered in "+(System.currentTimeMillis()-questionTime)/1000+" seconds!");
- + announceCorrect();
- + pi.addItem("Trivia", _rewardID, _rewardCount, pi, true);
- + }
- + else
- + pi.sendPacket(new CreatureSay(1234, 2, "Trivia", "Wrong answer."));
- +
- + }
- + public static void startTrivia()
- + {
- + Announcements.announceToAll("Trivia Event begins! You have to PM Trivia with your answer, get ready!");
- + setState(EventState.ASKING);
- + }
- + public static void askQuestion()
- + {
- + pickQuestion();
- + Announcements.announceToAll("Question: "+question);
- + questionTime=System.currentTimeMillis();
- + setState(EventState.ANSWERING);
- + }
- + public static void announceCorrect()
- + {
- + setState(EventState.CORRECT);
- + Announcements.announceToAll("The correct answer was: "+answer);
- + asked++;
- + setState(EventState.ASKING);
- + }
- + public static void endEvent()
- + {
- + setState(EventState.INACTIVE);
- + asked = 0;
- + }
- + private static void pickQuestion()
- + {
- + int roll=Rnd.get(q_a.size())+1;
- + int i=0;
- + for(String q:q_a.keySet())
- + {
- + ++i;
- + if(i==roll)
- + {
- + answer=q_a.get(q);
- + question=q;
- + return;
- + }
- + }
- + }
- + public static boolean isInactive()
- + {
- + boolean isInactive;
- + synchronized (_state)
- + {
- + isInactive = _state == EventState.INACTIVE;
- + }
- + return isInactive;
- + }
- + public static boolean isAnswering()
- + {
- + boolean isAnswering;
- + synchronized (_state)
- + {
- + isAnswering = _state == EventState.ANSWERING;
- + }
- + return isAnswering;
- + }
- + public static boolean isEnding()
- + {
- + boolean isEnding;
- + synchronized (_state)
- + {
- + isEnding = _state == EventState.ENDING;
- + }
- + return isEnding;
- + }
- + public static boolean isCorrect()
- + {
- + boolean isCorrect;
- + synchronized (_state)
- + {
- + isCorrect = _state == EventState.CORRECT;
- + }
- + return isCorrect;
- + }
- + public static boolean isRewarding()
- + {
- + boolean isRewarding;
- + synchronized (_state)
- + {
- + isRewarding = _state == EventState.REWARDING;
- + }
- + return isRewarding;
- + }
- + public static boolean isAsking()
- + {
- + boolean isAsking;
- + synchronized (_state)
- + {
- + isAsking = _state == EventState.ASKING;
- + }
- + return isAsking;
- + }
- + private static void setState(EventState state)
- + {
- + synchronized (_state)
- + {
- + _state = state;
- + }
- + }
- + public static Trivia getInstance()
- + {
- + return SingletonHolder._instance;
- + }
- +
- + private static class SingletonHolder
- + {
- + protected static final Trivia _instance = new Trivia();
- + }
- +
- +}
- \ No newline at end of file
- Index: java/net/sf/l2j/gameserver/model/entity/TriviaEventManager.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/entity/TriviaEventManager.java (revision 0)
- +++ java/net/sf/l2j/gameserver/model/entity/TriviaEventManager.java (revision 0)
- @@ -0,0 +1,189 @@
- +package net.sf.l2j.gameserver.model.entity;
- +
- +
- +import java.util.Calendar;
- +import java.util.concurrent.ScheduledFuture;
- +import java.util.logging.Logger;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.ThreadPoolManager;
- +
- +
- +public class TriviaEventManager
- +{
- + protected static final Logger _log = Logger.getLogger(TriviaEventManager.class.getName());
- +
- + /** Task for event cycles<br> */
- + private TriviaStartTask _task;
- +
- + /**
- + * New instance only by getInstance()<br>
- + */
- + private TriviaEventManager()
- + {
- + if (Config.TRIVIA_ENABLED)
- + {
- + Trivia.init();
- + this.scheduleEventStart();
- + _log.warning("TriviaEventEngine[TriviaManager.TriviaManager()]: Started.");
- + }
- + else
- + {
- + _log.warning("TriviaEventEngine[TriviaManager.TriviaManager()]: Engine is disabled.");
- + }
- + }
- + public static TriviaEventManager getInstance()
- + {
- + return SingletonHolder._instance;
- + }
- +
- + /**
- + * Starts the event
- + */
- + public void scheduleEventStart()
- + {
- + try
- + {
- + Calendar currentTime = Calendar.getInstance();
- + Calendar nextStartTime = null;
- + Calendar testStartTime = null;
- + for (String timeOfDay : Config.TRIVIA_INTERVAL)
- + {
- + // Creating a Calendar object from the specified interval value
- + testStartTime = Calendar.getInstance();
- + testStartTime.setLenient(true);
- + String[] splitTimeOfDay = timeOfDay.split(":");
- + testStartTime.set(Calendar.HOUR_OF_DAY, Integer.parseInt(splitTimeOfDay[0]));
- + testStartTime.set(Calendar.MINUTE, Integer.parseInt(splitTimeOfDay[1]));
- + // If the date is in the past, make it the next day (Example: Checking for "1:00", when the time is 23:57.)
- + if (testStartTime.getTimeInMillis() < currentTime.getTimeInMillis())
- + {
- + testStartTime.add(Calendar.DAY_OF_MONTH, 1);
- + }
- + // Check for the test date to be the minimum (smallest in the specified list)
- + if (nextStartTime == null || testStartTime.getTimeInMillis() < nextStartTime.getTimeInMillis())
- + {
- + nextStartTime = testStartTime;
- + }
- + }
- + _task = new TriviaStartTask(nextStartTime.getTimeInMillis());
- + ThreadPoolManager.getInstance().executeTask(_task);
- + }
- + catch (Exception e)
- + {
- + _log.warning("TriviaEventEngine[TriviaManager.scheduleEventStart()]: Error figuring out a start time. Check TriviaEventInterval in config file.");
- + }
- + }
- +
- + class TriviaStartTask implements Runnable
- + {
- + private long _startTime;
- + public ScheduledFuture<?> nextRun;
- +
- + public TriviaStartTask(long startTime)
- + {
- + _startTime = startTime;
- + }
- +
- + public void setStartTime(long startTime)
- + {
- + _startTime = startTime;
- + }
- +
- + /**
- + * @see java.lang.Runnable#run()
- + */
- + public void run()
- + {
- + int delay = (int) Math.round((_startTime - System.currentTimeMillis()) / 1000.0);
- + int nextMsg = 0;
- + if (delay > 3600)
- + {
- + nextMsg = delay - 3600;
- + }
- + else if (delay > 1800)
- + {
- + nextMsg = delay - 1800;
- + }
- + else if (delay > 900)
- + {
- + nextMsg = delay - 900;
- + }
- + else if (delay > 600)
- + {
- + nextMsg = delay - 600;
- + }
- + else if (delay > 300)
- + {
- + nextMsg = delay - 300;
- + }
- + else if (delay > 60)
- + {
- + nextMsg = delay - 60;
- + }
- + else if (delay > 5)
- + {
- + nextMsg = delay - 5;
- + }
- + else if (delay > 0)
- + {
- + nextMsg = delay;
- + }
- + else
- + {
- + if (Trivia.isInactive())
- + {
- + startTrivia();
- + }
- + else if(Trivia.isAsking())
- + {
- + if(Trivia.asked<Config.TRIVIA_TO_ASK)
- + {
- + startQuestion();
- + }
- + else
- + {
- + endTrivia();
- + }
- + }
- + else if(Trivia.isAnswering())
- + {
- + announceAnswer();
- + }
- + }
- +
- + if (delay > 0)
- + {
- + nextRun = ThreadPoolManager.getInstance().scheduleGeneral(this, nextMsg * 1000);
- + }
- + }
- + }
- + public void startTrivia()
- + {
- + Trivia.startTrivia();
- + _task.setStartTime(System.currentTimeMillis() + 1000L *10);
- + ThreadPoolManager.getInstance().executeTask(_task);
- + }
- + public void startQuestion()
- + {
- + Trivia.askQuestion();
- + _task.setStartTime(System.currentTimeMillis() + 1000L *Config.TRIVIA_ANSWER_TIME);
- + ThreadPoolManager.getInstance().executeTask(_task);
- + }
- + public void endTrivia()
- + {
- + Trivia.endEvent();
- + this.scheduleEventStart();
- + }
- + public void announceAnswer()
- + {
- + Trivia.announceCorrect();
- + _task.setStartTime(System.currentTimeMillis() +1000L *10);
- + ThreadPoolManager.getInstance().executeTask(_task);
- + }
- + @SuppressWarnings("synthetic-access")
- + private static class SingletonHolder
- + {
- + protected static final TriviaEventManager _instance = new TriviaEventManager();
- + }
- +}
- \ No newline at end of file
- Index: config/Trivia.xml
- ===================================================================
- --- config/Trivia.xml (revision 0)
- +++ config/Trivia.xml (revision 0)
- @@ -0,0 +1,334 @@
- +<?xml version="1.0" encoding="UTF-8"?>
- +<event>
- + <trivia>
- + <question>What current branch of the U.S. military was a corps of only 50 soldiers when World War I broke out</question>
- + <answer>The U.S. Air Force</answer>
- + </trivia>
- +
- + <trivia>
- + <question>What game was created by French mathematician Blaise Pascal, which he discovered when doing experiments into perpetual motion?</question>
- + <answer>The Game of Roulette</answer>
- + </trivia>
- +
- + <trivia>
- + <question>Who said: " I'm the president of the United States and I'm not going to eat any more broccoli "?</question>
- + <answer>George Bush</answer>
- + </trivia>
- +
- + <trivia>
- + <question>What future Soviet dictator was training to be a priest when he got turned on to Marxism?</question>
- + <answer>Joseph Stalin</answer>
- + </trivia>
- +
- + <trivia>
- + <question>What election year saw bumper stickers reading "Wallace, Wallace, Uber Alles"</question>
- + <answer>1968</answer>
- + </trivia>
- +
- + <trivia>
- + <question>Which is the last NPC you have to talk to, to obtain a Portal Stone?</question>
- + <answer>Theodoric</answer>
- + </trivia>
- +
- + <trivia>
- + <question>What color Soul Crystal do you need to have for Acumen SA on Arcana mace?</question>
- + <answer>Red</answer>
- + </trivia>
- +
- + <trivia>
- + <question>How many rooms do the 4 Sepulchers have in total?</question>
- + <answer>4</answer>
- + </trivia>
- +
- + <trivia>
- + <question>When does the Merchant of Mammon appear in Catacombs?</question>
- + <answer>Never</answer>
- + </trivia>
- +
- + <trivia>
- + <question>How many A-grade grandboss jewels exists?</question>
- + <answer>3</answer>
- + </trivia>
- +
- + <trivia>
- + <question>What is the name of the only B-grade grandboss jewel?</question>
- + <answer>Ring of queen ant</answer>
- + </trivia>
- +
- + <trivia>
- + <question>How many Olympiad points does a Noblesse character have at the end of each month, if he does not compete?</question>
- + <answer>18</answer>
- + </trivia>
- +
- + <trivia>
- + <question>When creating a character, you can choose to be a mage or fighter. There is one race that doesn't offer this choice. Which race is that?</question>
- + <answer>Dwarf</answer>
- + </trivia>
- +
- + <trivia>
- + <question>What TV show lost Jim Carrey when he stepped into the movies?</question>
- + <answer>In Living Color</answer>
- + </trivia>
- +
- + <trivia>
- + <question>At which level can you make the Hatchling quest?</question>
- + <answer>35</answer>
- + </trivia>
- +
- + <trivia>
- + <question>What's the name of the item you need to get your clan to level 4?</question>
- + <answer>Alliance Manifesto</answer>
- + </trivia>
- +
- + <trivia>
- + <question>What level does your clan have to be in order to start an Alliance?</question>
- + <answer>5</answer>
- + </trivia>
- +
- + <trivia>
- + <question>Baium is the father of...</question>
- + <answer>Frintezza</answer>
- + </trivia>
- +
- + <trivia>
- + <question>What are the names of the two "teams" on the Seven Signs Quest?</question>
- + <answer>Dawn and Dusk</answer>
- + </trivia>
- +
- + <trivia>
- + <question>How many servers are there on the offical lineage II?</question>
- + <answer>8</answer>
- + </trivia>
- +
- + <trivia>
- + <question>as a fighter, what is the first level when you can learn your first skills?</question>
- + <answer>5</answer>
- + </trivia>
- +
- + <trivia>
- + <question>In what level can you create a clan?</question>
- + <answer>10</answer>
- + </trivia>
- +
- + <trivia>
- + <question>What so-called "war" spawned the dueling slogans "Better Dead Than RED" and "Better Red Than Dead" in the 1950's?</question>
- + <answer>The Cold War</answer>
- + </trivia>
- +
- + <trivia>
- + <question>What president was shot while walking to California Governor Jerry Brown' office?</question>
- + <answer>Gerald Ford</answer>
- + </trivia>
- +
- + <trivia>
- + <question>What modern vehicle was invented to circumvent trench warfare?</question>
- + <answer>Tank</answer>
- + </trivia>
- +
- + <trivia>
- + <question>What congressional award was Dr. Mary Edwards Walker the first woman to receive?</question>
- + <answer>Medal of Honor</answer>
- + </trivia>
- +
- + <trivia>
- + <question>What congressional award was Dr. Mary Edwards Walker the first woman to receive?</question>
- + <answer>Medal of Honor</answer>
- + </trivia>
- +
- + <trivia>
- + <question>In which television series did Roger Moore star from 1962 to 1970?</question>
- + <answer>The Saint</answer>
- + </trivia>
- +
- + <trivia>
- + <question>Who introduced the Betamax video cassette system?</question>
- + <answer>Sony</answer>
- + </trivia>
- +
- + <trivia>
- + <question>What is Bugs Bunny's catchphrase?</question>
- + <answer>Eh, whats up Doc?</answer>
- + </trivia>
- +
- + <trivia>
- + <question>Which Hollywood film maker produced a string of films in the 1950s and 1960s using animals as actors in a drama?</question>
- + <answer>Walt Disney</answer>
- + </trivia>
- +
- + <trivia>
- + <question>Which character made his debut in the silent film Plane Crazy in 1928?</question>
- + <answer>Mickey Mouse</answer>
- + </trivia>
- +
- + <trivia>
- + <question>How did James Dean die?</question>
- + <answer>In a car accident</answer>
- + </trivia>
- +
- + <trivia>
- + <question>Which world-famous cartoon cat was created in 1920 by Pat Sullivan?</question>
- + <answer>Felix the Cat</answer>
- + </trivia>
- +
- + <trivia>
- + <question>Which group flew into the Hotel California?</question>
- + <answer>The Eagles</answer>
- + </trivia>
- +
- + <trivia>
- + <question>Which all time great band featured Harrison and Starkey?</question>
- + <answer>The Beatles</answer>
- + </trivia>
- +
- + <trivia>
- + <question>Arnold Schwarzenegger married the niece of which US president?</question>
- + <answer>John F. Kennedy</answer>
- + </trivia>
- +
- + <trivia>
- + <question>In which city did Steve McQueen take part in the car chase in Bullitt?</question>
- + <answer>San Francisco</answer>
- + </trivia>
- +
- + <trivia>
- + <question>In which movie did Alex Guinness first appear as Ben Obi Wan Kenobi?</question>
- + <answer>Star Wars</answer>
- + </trivia>
- +
- + <trivia>
- + <question>Marlon and Tito were two members of which famous family group?</question>
- + <answer>Jackson Five</answer>
- + </trivia>
- +
- + <trivia>
- + <question>Where did Crazy For You lose half a million dollars before finding success on Broadway?</question>
- + <answer>Washington</answer>
- + </trivia>
- +
- + <trivia>
- + <question>Leslie Rogge was the first person to be arrested due to what?</question>
- + <answer>The Internet</answer>
- + </trivia>
- +
- + <trivia>
- + <question>In 1908 Wilbur Wright traveled what record-breaking number of miles in 2 hours 20 minutes?</question>
- + <answer>77</answer>
- + </trivia>
- +
- + <trivia>
- + <question>How long did Bleriot's first flight across the English Channel last?</question>
- + <answer>43 minutes</answer>
- + </trivia>
- +
- + <trivia>
- + <question>What nationality of plane first broke the 100mph sound barrier?</question>
- + <answer>French</answer>
- + </trivia>
- +
- + <trivia>
- + <question>The first air collision took place over which country?</question>
- + <answer>Austria</answer>
- + </trivia>
- +
- + <trivia>
- + <question>How long did the record-breaking space walk from space shuttle Endeavor last in 1993?</question>
- + <answer>Five hours</answer>
- + </trivia>
- +
- + <trivia>
- + <question>Where did the European space probe Ulysses set off for in 1991?</question>
- + <answer>The Sun</answer>
- + </trivia>
- +
- + <trivia>
- + <question>What was the name of the first probe to send back pictures from Mars?</question>
- + <answer>Viking</answer>
- + </trivia>
- +
- + <trivia>
- + <question>Who was the second Soviet cosmonaut?</question>
- + <answer>Titov</answer>
- + </trivia>
- +
- + <trivia>
- + <question>Who said, "All I need to make a comedy is a park, a policeman and a pretty girl?"</question>
- + <answer>Charlie Chaplin</answer>
- + </trivia>
- +
- + <trivia>
- + <question>In which country did Steve McQueen die?</question>
- + <answer>Mexico</answer>
- + </trivia>
- +
- + <trivia>
- + <question>In 1998 who did Vanity Fair describe as "simply the world's biggest heart throb?"</question>
- + <answer>Leonardo DiCaprio</answer>
- + </trivia>
- +
- + <trivia>
- + <question>In 1998 who did Vanity Fair describe as "simply the world's biggest heart throb?"</question>
- + <answer>Leonardo DiCaprio</answer>
- + </trivia>
- +
- + <trivia>
- + <question>How many friends are there in Friends?</question>
- + <answer>Six</answer>
- + </trivia>
- +
- + <trivia>
- + <question>In which magazine did The Addams Family first appear?</question>
- + <answer>New Yorker</answer>
- + </trivia>
- +
- + <trivia>
- + <question>What is Alpha World?</question>
- + <answer>Multi user game</answer>
- + </trivia>
- +
- + <trivia>
- + <question>What is a MUD?</question>
- + <answer>Multi User Computer Game</answer>
- + </trivia>
- +
- + <trivia>
- + <question>In which European country is the theme park De Efteling?</question>
- + <answer>The Netherlands</answer>
- + </trivia>
- +
- + <trivia>
- + <question>Which ethnic group popularized salsa dancing in New York in the 1980s?</question>
- + <answer>Puerto Ricans</answer>
- + </trivia>
- +
- + <trivia>
- + <question>Which Russian city was famous for its State Circus?</question>
- + <answer>Moscow</answer>
- + </trivia>
- +
- + <trivia>
- + <question>Pokemon is an abbreviation of what?</question>
- + <answer>Pocket Monster</answer>
- + </trivia>
- +
- + <trivia>
- + <question>Who is the Princess in the Super Mario Gang?</question>
- + <answer>Daisy</answer>
- + </trivia>
- +
- + <trivia>
- + <question>What is russian's favourite gambling game?</question>
- + <answer>Russian Roulette</answer>
- + </trivia>
- +
- +
- + <trivia>
- + <question>What is russian's favourite drink?</question>
- + <answer>Vodka</answer>
- + </trivia>
- +
- + <trivia>
- + <question>What is the quest item used to make a level 5 clan</question>
- + <answer>Seal of aspiration</answer>
- + </trivia>
- +
- +</event>
- \ No newline at end of file
- Index: build.xml
- ===================================================================
- --- build.xml (revision 5)
- +++ build.xml (working copy)
- @@ -99,6 +99,7 @@
- <copy todir="${build.dist.game}/config">
- <fileset dir="config">
- <include name="*.properties" />
- + <include name="*.xml" />
- <exclude name="loginserver.properties" />
- </fileset>
- <fileset dir="config">
- Index: config/events.properties
- ===================================================================
- --- config/events.properties (revision 5)
- +++ config/events.properties (working copy)
- @@ -256,3 +256,19 @@
- AltFishChampionshipReward3 = 300000
- AltFishChampionshipReward4 = 200000
- AltFishChampionshipReward5 = 100000
- +
- +#Trivia event will occur those times
- +#Default = 22:00,22:15,22:30
- +TriviaInterval = 21:40,22:40,22:45,22:50,23:40
- +
- +#Time allowed to answer a question in seconds
- +#Default = 30
- +TriviaAnswerTime = 60
- +
- +#Trivia event enabled?
- +#Default = True
- +TriviaEnabled = True
- +
- +#Each event will have a number of questions.Decide how many to ask
- +#Default = 1
- +TriviaAsk = 1
- Index: java/net/sf/l2j/gameserver/handler/chathandlers/ChatTell.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/handler/chathandlers/ChatTell.java (revision 5)
- +++ java/net/sf/l2j/gameserver/handler/chathandlers/ChatTell.java (working copy)
- @@ -18,6 +18,7 @@
- import net.sf.l2j.gameserver.model.BlockList;
- import net.sf.l2j.gameserver.model.L2World;
- import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- +import net.sf.l2j.gameserver.model.entity.Trivia;
- import net.sf.l2j.gameserver.network.SystemMessageId;
- import net.sf.l2j.gameserver.network.serverpackets.CreatureSay;
- @@ -39,10 +40,30 @@
- @Override
- public void handleChat(int type, L2PcInstance activeChar, String target, String text)
- {
- +
- // Return if no target is set.
- if (target == null)
- return;
- + if(target.equalsIgnoreCase("trivia"))
- + {
- + if(Trivia.isInactive())
- + {
- + activeChar.sendMessage("Trivia event is not currently running.");
- + return;
- + }
- + else if(!Trivia.isAnswering() || Trivia.isCorrect() || Trivia.isRewarding())
- + {
- + activeChar.sendMessage("You cannot answer now.");
- + return;
- + }
- + else
- + {
- + Trivia.handleAnswer(text,activeChar);
- + return;
- + }
- + }
- +
- final L2PcInstance receiver = L2World.getInstance().getPlayer(target);
- if (receiver != null)
- {
- Index: java/net/sf/l2j/Config.java
- ===================================================================
- --- java/net/sf/l2j/Config.java (revision 35)
- +++ java/net/sf/l2j/Config.java (working copy)
- @@ -18,8 +18,10 @@
- import gnu.trove.map.hash.TIntObjectHashMap;
- import java.io.File;
- +import java.io.FileInputStream;
- import java.io.FileOutputStream;
- import java.io.IOException;
- +import java.io.InputStream;
- import java.io.OutputStream;
- import java.math.BigInteger;
- import java.util.ArrayList;
- @@ -57,6 +59,8 @@
- public static final String SIEGE_FILE = "./config/siege.properties";
- public static final String ELFOCRASH_FILE = "./config/elfocrash.properties";
- +
- +
- // --------------------------------------------------
- // Clans settings
- // --------------------------------------------------
- @@ -139,6 +143,13 @@
- // Events settings
- // --------------------------------------------------
- +
- +
- + public static ArrayList<String>TRIVIA_INTERVAL = new ArrayList<String>();
- + public static int TRIVIA_ANSWER_TIME;
- + public static boolean TRIVIA_ENABLED;
- + public static int TRIVIA_TO_ASK;
- +
- /** Olympiad */
- public static int ALT_OLY_START_TIME;
- public static int ALT_OLY_MIN;
- @@ -839,6 +850,13 @@
- // Events config
- ExProperties events = load(EVENTS_FILE);
- + String [] times=events.getProperty("TriviaInterval", "22:00,22:15,:22:30").split(",");
- + TRIVIA_INTERVAL = new ArrayList<String>();
- + for(String t:times)
- + TRIVIA_INTERVAL.add(t);
- + TRIVIA_ANSWER_TIME = Integer.parseInt(events.getProperty("TriviaAnswerTime", "30"));
- + TRIVIA_ENABLED = Boolean.parseBoolean(events.getProperty("TriviaEnabled", "true"));
- + TRIVIA_TO_ASK = Integer.parseInt(events.getProperty("TriviaAsk", "1"));
- ALT_OLY_START_TIME = events.getProperty("AltOlyStartTime", 18);
- ALT_OLY_MIN = events.getProperty("AltOlyMin", 0);
- ALT_OLY_CPERIOD = events.getProperty("AltOlyCPeriod", 21600000);
Add Comment
Please, Sign In to add comment