new FileInputStream ("data/events/" + eventName)));
BufferedReader inbr =
new BufferedReader(new InputStreamReader(in));
TextBuilder replyMSG = new TextBuilder("<html><body>");
replyMSG.append("<center><font color=\"LEVEL\">" + eventName + "</font><font color=\"FF0000\"> bY " + inbr.readLine() + "</font></center><br>");
replyMSG.append("<br>" + inbr.readLine());
replyMSG.append("</body></html>");
adminReply.setHtml(replyMSG.toString());
activeChar.sendPacket(adminReply);
}
catch (Exception e) {System.out.println(e);}
}
else if (command.startsWith("admin_event_del"))
{
String eventName = command.substring(16);
File file = new File("data/events/" + eventName);
file.delete();
showMainPage(activeChar);
}
else if (command.startsWith("admin_event_name"))
{
tempName+=command.substring(17);
showNewEventPage(activeChar);
}
else if (command.equalsIgnoreCase("admin_delete_buffer"))
{
try {tempBuffer+=tempBuffer.substring(0,tempBuffer.length()-10);
showNewEventPage(activeChar); }
catch (Exception e) {tempBuffer="";}
}
else if (command.startsWith("admin_event_store"))
{
try{
FileOutputStream file = new FileOutputStream("data/events/" + tempName);
PrintStream p = new PrintStream(file);
p.println(activeChar.getName());
p.println(tempBuffer);
file.close();
}
catch (Exception e) {System.out.println(e);}
tempBuffer = "";
tempName = "";
showMainPage(activeChar);
}
else if (command.startsWith("admin_event_set"))
{
L2Event.eventName = command.substring(16);
showEventParameters(activeChar, 2);
}
else if (command.startsWith("admin_event_change_teams_number"))
{
showEventParameters(activeChar, Integer.parseInt(command.substring(32)));
}
else if (command.startsWith("admin_event_panel"))
{
showEventControl(activeChar);
}
else if (command.startsWith("admin_event_control_begin"))
{
try {
L2Event.active = true;
L2Event.players.clear();
L2Event.connectionLossData.clear();
for(int j=0;j<L2Event.teamsNumber;j++){
LinkedList<String> link = new LinkedList<String>();
L2Event.players.put(j+1,link);
}
int i = 0;
while(L2Event.participatingPlayers.size()>0){
String target = getMaxLeveledPlayer();
if(!target.equals("")) {
L2Event.players.get(i+1).add(target);
i=(i+1)%L2Event.teamsNumber;
}
}
destroyEventNpcs();
npcsDeleted = true;
} catch(Exception e) {System.out.println(e);}
showEventControl(activeChar);
}
else if (command.startsWith("admin_event_control_teleport"))
{
StringTokenizer st = new StringTokenizer(command.substring(29),"-");
while(st.hasMoreElements()){
teleportTeam(activeChar, Integer.parseInt(st.nextToken()));
}
showEventControl(activeChar);
}
else if (command.startsWith("admin_event_control_sit"))
{
StringTokenizer st = new StringTokenizer(command.substring(24),"-");
while(st.hasMoreElements()){
sitTeam(Integer.parseInt(st.nextToken()));
}
showEventControl(activeChar);
}
else if (command.startsWith("admin_event_control_kill"))
{
StringTokenizer st = new StringTokenizer(command.substring(25),"-");
while(st.hasMoreElements()){
killTeam(activeChar, Integer.parseInt(st.nextToken()));
}
showEventControl(activeChar);
}
else if (command.startsWith("admin_event_control_res"))
{
StringTokenizer st = new StringTokenizer(command.substring(24),"-");
while(st.hasMoreElements()){
resTeam(Integer.parseInt(st.nextToken()));
}
showEventControl(activeChar);
}
else if (command.startsWith("admin_event_control_poly"))
{
StringTokenizer st0 = new StringTokenizer(command.substring(25));
StringTokenizer st = new StringTokenizer(st0.nextToken(),"-");
String id = st0.nextToken();
while(st.hasMoreElements()){
polyTeam(Integer.parseInt(st.nextToken()), id);
}
showEventControl(activeChar);
}
else if (command.startsWith("admin_event_control_unpoly"))
{
StringTokenizer st = new StringTokenizer(command.substring(27),"-");
while(st.hasMoreElements()){
unpolyTeam(Integer.parseInt(st.nextToken()));
}
showEventControl(activeChar);
}
else if (command.startsWith("admin_event_control_prize"))
{
StringTokenizer st0 = new StringTokenizer(command.substring(26));
StringTokenizer st = new StringTokenizer(st0.nextToken(),"-");
String n = st0.nextToken();
StringTokenizer st1 = new StringTokenizer(n,"*");
n = st1.nextToken();
String type = "";
if(st1.hasMoreElements()) type = st1.nextToken();
String id = st0.nextToken();
while(st.hasMoreElements()){
regardTeam(activeChar, Integer.parseInt(st.nextToken()),Integer.parseInt(n), Integer.parseInt(id), type);
}
showEventControl(activeChar);
}
else if (command.startsWith("admin_event_control_finish"))
{
for(int i = 0; i<L2Event.teamsNumber; i++){
telePlayersBack(i+1);
}
L2Event.eventName = "";
L2Event.teamsNumber = 0;
L2Event.names.clear();
L2Event.participatingPlayers.clear();
L2Event.players.clear();
L2Event.id = 12760;
L2Event.npcs.clear();
L2Event.active = false;
npcsDeleted = false;
}
else if (command.startsWith("admin_event_announce"))
{
StringTokenizer st = new StringTokenizer(command.substring(21));
L2Event.id = Integer.parseInt(st.nextToken());
L2Event.teamsNumber = Integer.parseInt(st.nextToken());
String temp = " ";
String temp2 = "";
while(st.hasMoreElements()){
temp+=st.nextToken() + " ";
}
st = new StringTokenizer(temp,"-");
Integer i = 1;
while(st.hasMoreElements()){
temp2 = st.nextToken();
if(!temp2.equals(" ")){
L2Event.names.put (i, temp2.substring(1,temp2.length()-1));
i++;}
}
L2Event.participatingPlayers.clear();
muestraNpcConInfoAPlayers(activeChar, L2Event.id);
PlaySound _snd = new PlaySound(1,"B03_F",0,0,0,0,0);
activeChar.sendPacket(_snd);
activeChar.broadcastPacket(_snd);
NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
TextBuilder replyMSG = new TextBuilder("<html><body>");
replyMSG.append("<center><font color=\"LEVEL\">[ L2J EVENT ENGINE</font></center><br>");
replyMSG.append("<center>The event <font color=\"LEVEL\">"+ L2Event.eventName + "</font> has been announced, now you can type //event_panel to see the event panel control</center><br>");
replyMSG.append("</body></html>");
adminReply.setHtml(replyMSG.toString());
activeChar.sendPacket(adminReply);
}
return true;