Ignore:
Timestamp:
Jan 16, 2012 7:56:19 AM (4 months ago)
Author:
MELERIX
Message:

STABLE: Sync with BETA [8629]

Location:
trunk/L2J_DataPack
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/L2J_DataPack

  • trunk/L2J_DataPack/dist/game/data/scripts/handlers/admincommandhandlers/AdminEventEngine.java

    r8406 r8630  
    2525import java.util.StringTokenizer; 
    2626 
     27import com.l2jserver.Config; 
    2728import com.l2jserver.gameserver.Announcements; 
    2829import com.l2jserver.gameserver.GmListTable; 
     
    3536import com.l2jserver.gameserver.network.serverpackets.CharInfo; 
    3637import com.l2jserver.gameserver.network.serverpackets.ExBrExtraUserInfo; 
    37 import com.l2jserver.gameserver.network.serverpackets.ItemList; 
    3838import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; 
    3939import com.l2jserver.gameserver.network.serverpackets.PlaySound; 
    4040import com.l2jserver.gameserver.network.serverpackets.UserInfo; 
     41import com.l2jserver.util.Rnd; 
    4142import com.l2jserver.util.StringUtil; 
    4243 
     
    8485        private static boolean npcsDeleted = false; 
    8586         
     87        @Override 
    8688        public boolean useAdminCommand(String command, L2PcInstance activeChar) 
    8789        { 
     90                StringTokenizer st = new StringTokenizer(command); 
     91                String actualCommand = st.nextToken(); 
    8892                try 
    8993                { 
    90                         if (command.equals("admin_event")) 
     94                        if (actualCommand.equals("admin_event")) 
    9195                        { 
    9296                                if (L2Event.eventState != EventState.OFF) 
     
    96100                        } 
    97101                         
    98                         else if (command.equals("admin_event_new")) 
     102                        else if (actualCommand.equals("admin_event_new")) 
    99103                        { 
    100104                                showNewEventPage(activeChar); 
    101105                        } 
    102                         else if (command.startsWith("admin_add")) 
    103                         { 
     106                        else if (actualCommand.startsWith("admin_add")) 
     107                        { 
     108                                // There is an exception here for not using the ST. We use spaces (ST delim) for the event info. 
    104109                                tempBuffer += command.substring(10); 
    105110                                showNewEventPage(activeChar); 
    106111                                 
    107112                        } 
    108                         else if (command.startsWith("admin_event_see")) 
    109                         { 
     113                        else if (actualCommand.startsWith("admin_event_see")) 
     114                        { 
     115                                // There is an exception here for not using the ST. We use spaces (ST delim) for the event name. 
    110116                                String eventName = command.substring(16); 
    111117                                try 
     
    113119                                        NpcHtmlMessage adminReply = new NpcHtmlMessage(5); 
    114120                                         
    115                                         DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream("data/events/" + eventName))); 
     121                                        DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(Config.DATAPACK_ROOT+"/data/events/" + eventName))); 
    116122                                        BufferedReader inbr = new BufferedReader(new InputStreamReader(in)); 
    117                                          
    118                                         final String replyMSG = StringUtil.concat( 
    119                                                         "<html><body>" + 
    120                                                         "<center><font color=\"LEVEL\">", 
    121                                                         eventName, 
    122                                                         "</font><font color=\"FF0000\"> bY ", 
    123                                                         inbr.readLine(), 
    124                                                         "</font></center><br>" + 
    125                                                         "<br>", 
    126                                                         inbr.readLine(), 
    127                                                         "</body></html>" 
    128                                         ); 
    129                                         adminReply.setHtml(replyMSG); 
     123                                        adminReply.setFile("en", "data/html/mods/EventEngine/Participation.htm"); 
     124                                        adminReply.replace("%eventName%", eventName); 
     125                                        adminReply.replace("%eventCreator%", inbr.readLine()); 
     126                                        adminReply.replace("%eventInfo%", inbr.readLine()); 
     127                                        adminReply.replace("npc_%objectId%_event_participate", "admin_event"); // Weird, but nice hack, isnt it? :) 
     128                                        adminReply.replace("button value=\"Participate\"", "button value=\"Back\""); 
    130129                                        activeChar.sendPacket(adminReply); 
    131130                                        inbr.close(); 
     
    139138                                 
    140139                        } 
    141                         else if (command.startsWith("admin_event_del")) 
    142                         { 
     140                        else if (actualCommand.startsWith("admin_event_del")) 
     141                        { 
     142                                // There is an exception here for not using the ST. We use spaces (ST delim) for the event name. 
    143143                                String eventName = command.substring(16); 
    144                                 File file = new File("data/events/" + eventName); 
     144                                File file = new File(Config.DATAPACK_ROOT+"/data/events/" + eventName); 
    145145                                file.delete(); 
    146146                                showMainPage(activeChar); 
    147                                  
    148                         } 
    149                          
    150                         else if (command.startsWith("admin_event_name")) 
    151                         { 
     147                        } 
     148                        else if (actualCommand.startsWith("admin_event_name")) 
     149                        { 
     150                                // There is an exception here for not using the ST. We use spaces (ST delim) for the event name. 
    152151                                tempName += command.substring(17); 
    153152                                showNewEventPage(activeChar); 
    154                                  
    155                         } 
    156                          
    157                         else if (command.equalsIgnoreCase("admin_delete_buffer")) 
     153                        } 
     154                        else if (actualCommand.equalsIgnoreCase("admin_delete_buffer")) 
     155                        { 
     156                                tempBuffer = ""; 
     157                                showNewEventPage(activeChar); 
     158                        } 
     159                        else if (actualCommand.startsWith("admin_event_store")) 
    158160                        { 
    159161                                try 
    160162                                { 
    161                                         tempBuffer += tempBuffer.substring(0, tempBuffer.length() - 10); 
    162                                         showNewEventPage(activeChar); 
    163                                 } 
    164                                 catch (Exception e) 
    165                                 { 
    166                                         tempBuffer = ""; 
    167                                 } 
    168                         } 
    169                          
    170                         else if (command.startsWith("admin_event_store")) 
    171                         { 
    172                                  
    173                                 try 
    174                                 { 
    175                                         FileOutputStream file = new FileOutputStream("data/events/" + tempName); 
     163                                        FileOutputStream file = new FileOutputStream(new File(Config.DATAPACK_ROOT, "data/events/" + tempName)); 
    176164                                        PrintStream p = new PrintStream(file); 
    177165                                        p.println(activeChar.getName()); 
     
    189177                                showMainPage(activeChar); 
    190178                        } 
    191                         else if (command.startsWith("admin_event_set")) 
    192                         { 
     179                        else if (actualCommand.startsWith("admin_event_set")) 
     180                        { 
     181                                // There is an exception here for not using the ST. We use spaces (ST delim) for the event name. 
    193182                                L2Event._eventName = command.substring(16); 
    194183                                showEventParameters(activeChar, 2); 
    195                                  
    196                         } 
    197                         else if (command.startsWith("admin_event_change_teams_number")) 
    198                         { 
    199                                 showEventParameters(activeChar, Integer.parseInt(command.substring(32))); 
    200                         } 
    201                         else if (command.startsWith("admin_event_panel")) 
    202                         { 
    203                                 showEventControl(activeChar); 
    204                         } 
    205                         else if (command.startsWith("admin_event_announce")) 
    206                         { 
    207                                 StringTokenizer st = new StringTokenizer(command.substring(21)); 
     184                        } 
     185                        else if (actualCommand.startsWith("admin_event_change_teams_number")) 
     186                        { 
     187                                showEventParameters(activeChar, Integer.parseInt(st.nextToken())); 
     188                        } 
     189                        else if (actualCommand.startsWith("admin_event_panel")) 
     190                        { 
     191                                showEventControl(activeChar); 
     192                        } 
     193                        else if (actualCommand.startsWith("admin_event_announce")) 
     194                        { 
    208195                                L2Event._npcId = Integer.parseInt(st.nextToken()); 
    209196                                L2Event._teamsNumber = Integer.parseInt(st.nextToken()); 
     
    238225                                 
    239226                                final String replyMSG = StringUtil.concat( 
    240                                                 "<html><body>" + 
    241                                                 "<center><font color=\"LEVEL\">[ L2J EVENT ENGINE</font></center><br>" + 
     227                                                "<html><title>[ L2J EVENT ENGINE ]</title><body><br>", 
    242228                                                "<center>The event <font color=\"LEVEL\">", 
    243229                                                L2Event._eventName, 
    244                                                 "</font> has been announced, now you can type //event_panel to see the event panel control</center><br>" + 
     230                                                "</font> has been announced, now you can type //event_panel to see the event panel control</center><br>", 
    245231                                                "</body></html>" 
    246232                                ); 
     
    248234                                activeChar.sendPacket(adminReply); 
    249235                        } 
    250                         else if (command.startsWith("admin_event_control_begin")) 
     236                        else if (actualCommand.startsWith("admin_event_control_begin")) 
    251237                        { 
    252238                                // Starts the event and sends a message of the result 
     
    254240                                showEventControl(activeChar); 
    255241                        } 
    256                         else if (command.startsWith("admin_event_control_finish")) 
     242                        else if (actualCommand.startsWith("admin_event_control_finish")) 
    257243                        { 
    258244                                // Finishes the event and sends a message of the result 
    259245                                activeChar.sendMessage(L2Event.finishEvent()); 
    260246                        } 
    261                         else if (command.startsWith("admin_event_control_teleport")) 
    262                         { 
    263                                 StringTokenizer st = new StringTokenizer(command.substring(29), "-"); 
    264                                  
    265                                 while (st.hasMoreElements()) 
     247                        else if (actualCommand.startsWith("admin_event_control_teleport")) 
     248                        { 
     249                                while (st.hasMoreElements()) // Every next ST should be a team number 
    266250                                { 
    267251                                        int teamId = Integer.parseInt(st.nextToken()); 
     
    276260                                showEventControl(activeChar); 
    277261                        } 
    278                          
    279                         else if (command.startsWith("admin_event_control_sit")) 
    280                         { 
    281                                 StringTokenizer st = new StringTokenizer(command.substring(24), "-"); 
    282                                  
    283                                 while (st.hasMoreElements()) 
     262                        else if (actualCommand.startsWith("admin_event_control_sit")) 
     263                        { 
     264                                while (st.hasMoreElements()) // Every next ST should be a team number 
    284265                                { 
    285266                                        // Integer.parseInt(st.nextToken()) == teamId 
     
    298279                                showEventControl(activeChar); 
    299280                        } 
    300                         else if (command.startsWith("admin_event_control_kill")) 
    301                         { 
    302                                 StringTokenizer st = new StringTokenizer(command.substring(25), "-"); 
    303                                  
    304                                 while (st.hasMoreElements()) 
     281                        else if (actualCommand.startsWith("admin_event_control_kill")) 
     282                        { 
     283                                while (st.hasMoreElements()) // Every next ST should be a team number 
    305284                                { 
    306285                                        for (L2PcInstance player : L2Event._teams.get(Integer.parseInt(st.nextToken()))) 
     
    309288                                showEventControl(activeChar); 
    310289                        } 
    311                         else if (command.startsWith("admin_event_control_res")) 
    312                         { 
    313                                 StringTokenizer st = new StringTokenizer(command.substring(24), "-"); 
    314                                  
    315                                 while (st.hasMoreElements()) 
     290                        else if (actualCommand.startsWith("admin_event_control_res")) 
     291                        { 
     292                                while (st.hasMoreElements()) // Every next ST should be a team number 
    316293                                { 
    317294                                        for (L2PcInstance player : L2Event._teams.get(Integer.parseInt(st.nextToken()))) 
     
    327304                                showEventControl(activeChar); 
    328305                        } 
    329                         else if (command.startsWith("admin_event_control_poly")) 
    330                         { 
    331                                 StringTokenizer st0 = new StringTokenizer(command.substring(25)); 
    332                                 StringTokenizer st = new StringTokenizer(st0.nextToken(), "-"); 
    333                                 String id = st0.nextToken(); 
    334                                 while (st.hasMoreElements()) 
    335                                 { 
    336                                         for (L2PcInstance player : L2Event._teams.get(Integer.parseInt(st.nextToken()))) 
    337                                         { 
    338                                                 player.getPoly().setPolyInfo("npc", id); 
    339                                                 player.teleToLocation(player.getX(), player.getY(), player.getZ(), true); 
    340                                                 CharInfo info1 = new CharInfo(player); 
    341                                                 player.broadcastPacket(info1); 
    342                                                 UserInfo info2 = new UserInfo(player); 
    343                                                 player.sendPacket(info2); 
    344                                                 player.broadcastPacket(new ExBrExtraUserInfo(player)); 
    345                                         } 
    346                                 } 
    347                                 showEventControl(activeChar); 
    348                         } 
    349                         else if (command.startsWith("admin_event_control_unpoly")) 
    350                         { 
    351                                 StringTokenizer st = new StringTokenizer(command.substring(27), "-"); 
    352                                  
    353                                 while (st.hasMoreElements()) 
     306                        else if (actualCommand.startsWith("admin_event_control_poly")) 
     307                        { 
     308                                int teamId = Integer.parseInt(st.nextToken()); 
     309                                String[] polyIds = new String[st.countTokens()]; 
     310                                int i = 0; 
     311                                while (st.hasMoreElements()) // Every next ST should be a polymorph ID 
     312                                { 
     313                                        polyIds[i++] = st.nextToken(); 
     314                                } 
     315                                 
     316                                for (L2PcInstance player : L2Event._teams.get(teamId)) 
     317                                { 
     318                                        player.getPoly().setPolyInfo("npc", polyIds[Rnd.get(polyIds.length)]); 
     319                                        player.teleToLocation(player.getX(), player.getY(), player.getZ(), true); 
     320                                        CharInfo info1 = new CharInfo(player); 
     321                                        player.broadcastPacket(info1); 
     322                                        UserInfo info2 = new UserInfo(player); 
     323                                        player.sendPacket(info2); 
     324                                        player.broadcastPacket(new ExBrExtraUserInfo(player)); 
     325                                } 
     326                                showEventControl(activeChar); 
     327                        } 
     328                        else if (actualCommand.startsWith("admin_event_control_unpoly")) 
     329                        { 
     330                                while (st.hasMoreElements()) // Every next ST should be a team number 
    354331                                { 
    355332                                        for (L2PcInstance player : L2Event._teams.get(Integer.parseInt(st.nextToken()))) 
     
    367344                                showEventControl(activeChar); 
    368345                        } 
    369                         else if (command.startsWith("admin_event_control_transform")) 
    370                         { 
    371                                 StringTokenizer st0 = new StringTokenizer(command.substring(30)); 
    372                                 StringTokenizer st = new StringTokenizer(st0.nextToken(), "-"); 
    373                                 while (st.hasMoreElements()) 
    374                                 { 
    375                                         for (L2PcInstance player : L2Event._teams.get(Integer.parseInt(st.nextToken()))) 
    376                                         { 
    377                                                 int id = Integer.parseInt(st0.nextToken()); 
    378                                                 if (!TransformationManager.getInstance().transformPlayer(id, player)) 
    379                                                         GmListTable.broadcastMessageToGMs("EventEngine: Unknow transformation id: " + id); 
    380                                         } 
    381                                 } 
    382                                 showEventControl(activeChar); 
    383                         } 
    384                         else if (command.startsWith("admin_event_control_untransform")) 
    385                         { 
    386                                 StringTokenizer st = new StringTokenizer(command.substring(32), "-"); 
    387                                  
    388                                 while (st.hasMoreElements()) 
     346                        else if (actualCommand.startsWith("admin_event_control_transform")) 
     347                        { 
     348                                int teamId = Integer.parseInt(st.nextToken()); 
     349                                int[] transIds = new int[st.countTokens()]; 
     350                                int i = 0; 
     351                                while (st.hasMoreElements()) // Every next ST should be a transform ID 
     352                                { 
     353                                        transIds[i++] = Integer.parseInt(st.nextToken()); 
     354                                } 
     355                                 
     356                                for (L2PcInstance player : L2Event._teams.get(teamId)) 
     357                                { 
     358                                        int transId = transIds[Rnd.get(transIds.length)]; 
     359                                        if (!TransformationManager.getInstance().transformPlayer(transId, player)) 
     360                                                GmListTable.broadcastMessageToGMs("EventEngine: Unknow transformation id: " + transId); 
     361                                } 
     362                                showEventControl(activeChar); 
     363                        } 
     364                        else if (actualCommand.startsWith("admin_event_control_untransform")) 
     365                        { 
     366                                while (st.hasMoreElements()) // Every next ST should be a team number 
    389367                                { 
    390368                                        for (L2PcInstance player : L2Event._teams.get(Integer.parseInt(st.nextToken()))) 
     
    393371                                showEventControl(activeChar); 
    394372                        } 
    395                         else if (command.startsWith("admin_event_control_kick")) 
    396                         { 
    397                                 StringTokenizer st = new StringTokenizer(command.substring(25), "-"); 
    398                                  
    399                                 if (st.hasMoreElements()) 
    400                                 { 
    401                                         L2PcInstance player = L2World.getInstance().getPlayer(st.nextToken()); 
    402                                         if (player != null) 
    403                                                 L2Event.removeAndResetPlayer(player); 
     373                        else if (actualCommand.startsWith("admin_event_control_kick")) 
     374                        { 
     375                                if (st.hasMoreElements()) // If has next token, it should be player name. 
     376                                { 
     377                                        while (st.hasMoreElements()) 
     378                                        { 
     379                                                L2PcInstance player = L2World.getInstance().getPlayer(st.nextToken()); 
     380                                                if (player != null) 
     381                                                        L2Event.removeAndResetPlayer(player); 
     382                                        } 
    404383                                } 
    405384                                else 
     
    410389                                showEventControl(activeChar); 
    411390                        } 
    412                         else if (command.startsWith("admin_event_control_prize")) 
    413                         { 
    414                                 StringTokenizer st0 = new StringTokenizer(command.substring(26)); 
    415                                 StringTokenizer st = new StringTokenizer(st0.nextToken(), "-"); 
    416                                 String n = st0.nextToken(); 
    417                                 StringTokenizer st1 = new StringTokenizer(n, "*"); 
    418                                 n = st1.nextToken(); 
    419                                 String type = ""; 
    420                                 if (st1.hasMoreElements()) 
    421                                         type = st1.nextToken(); 
    422                                  
    423                                 String id = st0.nextToken(); 
    424                                 while (st.hasMoreElements()) 
    425                                 { 
    426                                         rewardTeam(activeChar, Integer.parseInt(st.nextToken()), Integer.parseInt(n), Integer.parseInt(id), type); 
     391                        else if (actualCommand.startsWith("admin_event_control_prize")) 
     392                        { 
     393                                int[] teamIds = new int[st.countTokens() - 2]; 
     394                                int i = 0; 
     395                                while (st.countTokens() - 2 > 0) // The last 2 tokens are used for "n" and "item id" 
     396                                { 
     397                                        teamIds[i++] = Integer.parseInt(st.nextToken()); 
     398                                } 
     399                                 
     400                                String[] n = st.nextToken().split("\\*"); 
     401                                int itemId = Integer.parseInt(st.nextToken()); 
     402                                 
     403                                for (int teamId : teamIds) 
     404                                { 
     405                                        rewardTeam(activeChar, teamId, Integer.parseInt(n[0]), itemId, n.length == 2 ? n[1] : ""); 
    427406                                } 
    428407                                showEventControl(activeChar); 
     
    434413                        GmListTable.broadcastMessageToGMs("EventEngine: Error! Possible blank boxes while executing a command which requires a value in the box?");  
    435414                } 
    436                  
    437415                return true; 
    438416        } 
    439417         
     418        @Override 
    440419        public String[] getAdminCommandList() 
    441420        { 
     
    443422        } 
    444423         
    445         String showStoredEvents() 
    446         { 
    447                 File dir = new File("data/events"); 
    448                 String[] files = dir.list(); 
    449                  
    450                 if (files == null) { 
    451                         return "<font color=\"FF0000\"> No 'data/events' directory! <font> <BR>" +  
    452                                         "<font color=\"FF0000\"> UNABLE TO CREATE AN EVENT!!! Please create this folder. <font>"; 
    453                 } 
    454                  
     424        private String showStoredEvents() 
     425        { 
     426                final File dir = new File(Config.DATAPACK_ROOT, "/data/events"); 
     427                if (dir.isFile()) 
     428                { 
     429                        return "<font color=\"FF0000\">The directory '"+ dir.getAbsolutePath() + "' is a file or is corrupted!<font><br>"; 
     430                } 
     431                 
     432                String note = ""; 
     433                if (!dir.exists()) 
     434                { 
     435                        note = "<font color=\"FF0000\">The directory '"+ dir.getAbsolutePath() + "' does not exist!<font><br><font color=\"0099FF\">Trying to create it now...<br><font><br>"; 
     436                        if (dir.mkdirs()) 
     437                        { 
     438                                note += "<font color=\"006600\">The directory '"+ dir.getAbsolutePath() + "' has been created!<font><br>"; 
     439                        } 
     440                        else 
     441                        { 
     442                                note += "<font color=\"FF0000\">The directory '"+ dir.getAbsolutePath() + "' hasn't been created!<font><br>"; 
     443                                return note; 
     444                        } 
     445                } 
     446                 
     447                final String[] files = dir.list(); 
    455448                final StringBuilder result = new StringBuilder(files.length * 500); 
    456                  
    457                 for (int i = 0; i < files.length; i++) { 
    458                         final File file = new File("data/events/" + files[i]); 
    459                         final String fileName = file.getName(); 
     449                result.append("<table>"); 
     450                for (String fileName : files)  
     451                { 
    460452                        StringUtil.append(result, 
    461                                         "<font color=\"LEVEL\">", 
     453                                        "<tr><td align=center>", 
    462454                                        fileName, 
    463                                         " </font><br><button value=\"select\" action=\"bypass -h admin_event_set ", 
     455                                        " </td></tr><tr><td><table cellspacing=0><tr><td><button value=\"Select Event\" action=\"bypass -h admin_event_set ", 
    464456                                        fileName, 
    465                                         "\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"><button value=\"ver\" action=\"bypass -h admin_event_see ", 
     457                                        "\" width=90 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><button value=\"View Event\" action=\"bypass -h admin_event_see ", 
    466458                                        fileName, 
    467                                         "\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"><button value=\"delete\" action=\"bypass -h admin_event_del ", 
     459                                        "\" width=90 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><button value=\"Delete Event\" action=\"bypass -h admin_event_del ", 
    468460                                        fileName, 
    469                                         "\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"><br><br>" 
     461                                        "\" width=90 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table></td></tr>", 
     462                                        "<tr><td>&nbsp;</td></tr><tr><td>&nbsp;</td></tr>" 
    470463                        ); 
    471464                } 
    472465                 
    473                 return result.toString(); 
     466                result.append("</table>"); 
     467                 
     468                return note + result.toString(); 
    474469        } 
    475470         
     
    479474                 
    480475                final String replyMSG = StringUtil.concat( 
    481                                 "<html><body>" + 
    482                                 "<center><font color=\"LEVEL\">[ L2J EVENT ENGINE ]</font></center><br>" + 
    483                                 "<br><center><button value=\"Create NEW event \" action=\"bypass -h admin_event_new\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + 
    484                                 "<center><br>Stored Events<br></center>", 
     476                                "<html><title>[ L2J EVENT ENGINE ]</title><body>" + 
     477                                "<br><center><button value=\"Create NEW event \" action=\"bypass -h admin_event_new\" width=150 height=32 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + 
     478                                "<center><br><font color=LEVEL>Stored Events:</font><br></center>", 
    485479                                showStoredEvents(), 
    486480                                "</body></html>" 
     
    495489                 
    496490                final StringBuilder replyMSG = StringUtil.startAppend(500, 
    497                                 "<html><body>" + 
    498                                 "<center><font color=\"LEVEL\">[ L2J EVENT ENGINE ]</font></center><br>" + 
    499                                 "<br><center>Event's Title <br><font color=\"LEVEL\">" 
     491                                "<html><title>[ L2J EVENT ENGINE ]</title><body><br><br><center><font color=LEVEL>Event name:</font><br>" 
    500492                ); 
    501493                 
    502494                if (tempName.isEmpty()) 
    503                         replyMSG.append("Use //event_name text to insert a new title"); 
     495                { 
     496                        replyMSG.append("You can also use //event_name text to insert a new title"); 
     497                        replyMSG.append("<center><multiedit var=\"name\" width=260 height=24> <button value=\"Set Event Name\" action=\"bypass -h admin_event_name $name\" width=120 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"); 
     498                } 
    504499                else 
    505500                        replyMSG.append(tempName); 
    506                 replyMSG.append("</font></center><br><br>Event's description<br>"); 
     501                 
     502                replyMSG.append("<br><br><font color=LEVEL>Event description:</font><br></center>"); 
     503                 
    507504                if (tempBuffer.isEmpty()) 
    508                         replyMSG.append("Use //add text o //delete_buffer to modify this text field"); 
     505                        replyMSG.append("You can also use //add text to add text or //delete_buffer to remove the text."); 
    509506                else 
    510507                        replyMSG.append(tempBuffer); 
    511508                 
     509                 replyMSG.append("<center><multiedit var=\"txt\" width=270 height=100> <button value=\"Add text\" action=\"bypass -h admin_add $txt\" width=120 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"); 
     510                 replyMSG.append("<button value=\"Remove text\" action=\"bypass -h admin_delete_buffer\" width=120 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"); 
     511                 
    512512                if (!(tempName.isEmpty() && tempBuffer.isEmpty())) 
    513                         replyMSG.append("<br><button value=\"Crear\" action=\"bypass -h admin_event_store\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"); 
    514                  
    515                 replyMSG.append("</body></html>"); 
     513                        replyMSG.append("<br><button value=\"Store Event Data\" action=\"bypass -h admin_event_store\" width=160 height=32 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"); 
     514                 
     515                replyMSG.append("</center></body></html>"); 
    516516                 
    517517                adminReply.setHtml(replyMSG.toString()); 
     
    522522        { 
    523523                NpcHtmlMessage adminReply = new NpcHtmlMessage(5); 
    524                  
    525                 final StringBuilder replyMSG = StringUtil.startAppend( 
    526                                 1000 + teamnumbers * 150, 
    527                                 "<html><body>" + 
    528                                 "<center><font color=\"LEVEL\">[ L2J EVENT ENGINE ]</font></center><br>" + 
    529                                 "<center><font color=\"LEVEL\">", 
    530                                 L2Event._eventName, 
    531                                 "</font></center><br>" + 
    532                                 "<br><center><button value=\"Change number of teams to\" action=\"bypass -h admin_event_change_teams_number $event_teams_number\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"> <edit var=\"event_teams_number\" width=100 height=20><br><br>" + 
    533                                 "<font color=\"LEVEL\">Team's Names</font><br>" 
    534                 ); 
    535                  
    536                 for (int i = 0; i < teamnumbers; i++) { 
    537                         StringUtil.append(replyMSG, 
    538                                         String.valueOf(i + 1), 
    539                                         ".- <edit var=\"event_teams_name", 
    540                                         String.valueOf(i + 1), 
    541                         "\" width=100 height=20><br>"); 
    542                 } 
    543                  
    544                 StringUtil.append(replyMSG, 
    545                                 "<br><br>Announcer NPC id<edit var=\"event_npcid\" width=100 height=20><br><br><button value=\"Announce Event!!\" action=\"bypass -h admin_event_announce $event_npcid ", 
    546                                 String.valueOf(teamnumbers), 
    547                 " "); 
    548                  
    549                 for (int i = 0; i < teamnumbers; i++) { 
    550                         StringUtil.append(replyMSG, 
    551                                         "$event_teams_name", 
    552                                         String.valueOf(i + 1), 
    553                         " - "); 
    554                 } 
    555                 replyMSG.append("\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" + 
    556                 "</body></html>"); 
    557                  
    558                 adminReply.setHtml(replyMSG.toString()); 
     524                StringBuilder sb = new StringBuilder(); 
     525                 
     526                sb.append("<html><body><title>[ L2J EVENT ENGINE ]</title><br><center> Current event: <font color=\"LEVEL\">"); 
     527                sb.append(L2Event._eventName); 
     528                sb.append("</font></center><br>INFO: To start an event, you must first set the number of teams, then type their names in the boxes and finally type the NPC ID that will be the event manager (can be any existing npc) next to the \"Announce Event!\" button.<br><table width=100%>"); 
     529                sb.append("<tr><td><button value=\"Announce Event!\" action=\"bypass -h admin_event_announce $event_npcid "); 
     530                sb.append(teamnumbers); 
     531                sb.append(" "); 
     532                for (int i = 1; (i - 1) < teamnumbers; i++)  // Event announce params 
     533                { 
     534                        sb.append("$event_teams_name"); 
     535                        sb.append(i); 
     536                        sb.append(" - "); 
     537                } 
     538                sb.append("\" width=140 height=32 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>"); 
     539                sb.append("<td><edit var=\"event_npcid\" width=100 height=20></td></tr>"); 
     540                sb.append("<tr><td><button value=\"Set number of teams\" action=\"bypass -h admin_event_change_teams_number $event_teams_number\" width=140 height=32 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>"); 
     541                sb.append("<td><edit var=\"event_teams_number\" width=100 height=20></td></tr>"); 
     542                sb.append("</table><br><center> <br><br>"); 
     543                sb.append("<font color=\"LEVEL\">Teams' names:</font><br><table width=100% cellspacing=8>"); 
     544                for (int i = 1; (i - 1) < teamnumbers; i++) // Team names params 
     545                { 
     546                        sb.append("<tr><td align=center>Team #"); 
     547                        sb.append(i); 
     548                        sb.append(" name:</td><td><edit var=\"event_teams_name"); 
     549                        sb.append(i); 
     550                        sb.append("\" width=150 height=15></td></tr>"); 
     551                } 
     552                sb.append("</table></body></html>"); 
     553                 
     554                adminReply.setHtml(sb.toString()); 
    559555                activeChar.sendPacket(adminReply); 
    560556        } 
     
    564560                 
    565561                NpcHtmlMessage adminReply = new NpcHtmlMessage(5); 
    566                  
    567                 final StringBuilder replyMSG = StringUtil.startAppend(1000, 
    568                                 "<html><body>" + 
    569                                 "<center><font color=\"LEVEL\">[ L2J EVENT ENGINE ]</font></center><br><font color=\"LEVEL\">", 
    570                                 L2Event._eventName, 
    571                                 "</font><br><br><table width=200>" + 
    572                                 "<tr><td>Apply this command to teams number </td><td><edit var=\"team_number\" width=100 height=15></td></tr>" + 
    573                                 "<tr><td>&nbsp;</td></tr>" 
    574                 ); 
     562                StringBuilder sb = new StringBuilder(); 
     563                sb.append("<html><title>[ L2J EVENT ENGINE ]</title><body><br><center>Current event: <font color=\"LEVEL\">"); 
     564                sb.append(L2Event._eventName); 
     565                sb.append("</font></center><br><table cellspacing=-1 width=280><tr><td align=center>Type the team ID(s) that will be affected by the commands. Commands with '*' work with only 1 team ID in the field, while '!' - none.</td></tr><tr><td align=center><edit var=\"team_number\" width=100 height=15></td></tr>"); 
     566                sb.append("<tr><td>&nbsp;</td></tr><tr><td><table width=200>"); 
    575567                if (!npcsDeleted) { 
    576                         replyMSG.append("<tr><td><button value=\"Start\" action=\"bypass -h admin_event_control_begin\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Destroys all event npcs so no more people can't participate now on</font></td></tr>"); 
    577                 } 
    578                  
    579                 replyMSG.append( 
    580                                 "<tr><td>&nbsp;</td></tr>" + 
    581                                 "<tr><td><button value=\"Teleport\" action=\"bypass -h admin_event_control_teleport $team_number\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Teleports the specified team to your position</font></td></tr>" + 
    582                                 "<tr><td>&nbsp;</td></tr>" + 
    583                                 "<tr><td><button value=\"Sit\" action=\"bypass -h admin_event_control_sit $team_number\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Sits/Stands up the team</font></td></tr>" + 
    584                                 "<tr><td>&nbsp;</td></tr>" + 
    585                                 "<tr><td><button value=\"Kill\" action=\"bypass -h admin_event_control_kill $team_number\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Finish with the life of all the players in the selected team</font></td></tr>" + 
    586                                 "<tr><td>&nbsp;</td></tr>" + 
    587                                 "<tr><td><button value=\"Resurrect\" action=\"bypass -h admin_event_control_res $team_number\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Resurrect Team's members</font></td></tr>" + 
    588                                 "<tr><td>&nbsp;</td></tr>" + 
    589                                 "<tr><td><button value=\"Polymorph\" action=\"bypass -h admin_event_control_poly $team_number $poly_id\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><edit var=\"poly_id\" width=100 height=15><font color=\"LEVEL\">Polymorphs the team into the NPC with the id specified</font></td></tr>" + 
    590                                 "<tr><td>&nbsp;</td></tr>" + 
    591                                 "<tr><td><button value=\"UnPolymorph\" action=\"bypass -h admin_event_control_unpoly $team_number\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Unpolymorph the team</font></td></tr>" + 
    592                                 "<tr><td>&nbsp;</td></tr>" + 
    593                                 "<tr><td><button value=\"Transform\" action=\"bypass -h admin_event_control_transform $team_number $transf_id\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><edit var=\"transf_id\" width=100 height=15><font color=\"LEVEL\">Transforms the team into the transformation with the id specified</font></td></tr>" + 
    594                                 "<tr><td>&nbsp;</td></tr>" + 
    595                                 "<tr><td><button value=\"UnTransform\" action=\"bypass -h admin_event_control_untransform $team_number\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Untransforms the team</font></td></tr>" + 
    596                                 "<tr><td>&nbsp;</td></tr>" + 
    597                                 "<tr><td>&nbsp;</td></tr>" + 
    598                                 "<tr><td><button value=\"Give Item\" action=\"bypass -h admin_event_control_prize $team_number $n $id\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"> number <edit var=\"n\" width=100 height=15> item id <edit var=\"id\" width=100 height=15></td><td><font color=\"LEVEL\">Give the specified item id to every single member of the team, you can put 5*level, 5*kills or 5 in the number field for example</font></td></tr>" + 
    599                                 "<tr><td>&nbsp;</td></tr>" + 
    600                                 "<tr><td><button value=\"Kick Player\" action=\"bypass -h admin_event_control_kick $player_name\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><edit var=\"player_name\" width=100 height=15><font color=\"LEVEL\">Kicks the specified player from the event. Blank field kicks target.</font></td></tr>" +   
     568                        sb.append("<tr><td><button value=\"Start!\" action=\"bypass -h admin_event_control_begin\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Destroys all event npcs so no more people can't participate now on</font></td></tr>"); 
     569                } 
     570                 
     571                sb.append( 
     572                                "<tr><td>&nbsp;</td></tr>" + 
     573                                "<tr><td><button value=\"Teleport\" action=\"bypass -h admin_event_control_teleport $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Teleports the specified team to your position</font></td></tr>" + 
     574                                "<tr><td>&nbsp;</td></tr>" + 
     575                                "<tr><td><button value=\"Sit/Stand\" action=\"bypass -h admin_event_control_sit $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Sits/Stands up the team</font></td></tr>" + 
     576                                "<tr><td>&nbsp;</td></tr>" + 
     577                                "<tr><td><button value=\"Kill\" action=\"bypass -h admin_event_control_kill $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Finish with the life of all the players in the selected team</font></td></tr>" + 
     578                                "<tr><td>&nbsp;</td></tr>" + 
     579                                "<tr><td><button value=\"Resurrect\" action=\"bypass -h admin_event_control_res $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Resurrect Team's members</font></td></tr>" + 
     580                                "<tr><td>&nbsp;</td></tr>" + 
     581                                "<tr><td><table cellspacing=-1><tr><td><button value=\"Polymorph*\" action=\"bypass -h admin_event_control_poly $team_number $poly_id\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><tr><td><edit var=\"poly_id\" width=98 height=15></td></tr></table></td><td><font color=\"LEVEL\">Polymorphs the team into the NPC with the ID specified. Multiple IDs result in randomly chosen one for each player.</font></td></tr>" + 
     582                                "<tr><td>&nbsp;</td></tr>" + 
     583                                "<tr><td><button value=\"UnPolymorph\" action=\"bypass -h admin_event_control_unpoly $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Unpolymorph the team</font></td></tr>" + 
     584                                "<tr><td>&nbsp;</td></tr>" + 
     585                                "<tr><td><table cellspacing=-1><tr><td><button value=\"Transform*\" action=\"bypass -h admin_event_control_transform $team_number $transf_id\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><tr><td><edit var=\"transf_id\" width=98 height=15></td></tr></table></td><td><font color=\"LEVEL\">Transforms the team into the transformation with the ID specified. Multiple IDs result in randomly chosen one for each player.</font></td></tr>" + 
     586                                "<tr><td>&nbsp;</td></tr>" + 
     587                                "<tr><td><button value=\"UnTransform\" action=\"bypass -h admin_event_control_untransform $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Untransforms the team</font></td></tr>" + 
     588                                "<tr><td>&nbsp;</td></tr>" + 
     589                                "<tr><td><table cellspacing=-1><tr><td><button value=\"Give Item\" action=\"bypass -h admin_event_control_prize $team_number $n $id\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table><table><tr><td width=32>Num</td><td><edit var=\"n\" width=60 height=15></td></tr><tr><td>ID</td><td><edit var=\"id\" width=60 height=15></td></tr></table></td><td><font color=\"LEVEL\">Give the specified item id to every single member of the team, you can put 5*level, 5*kills or 5 in the number field for example</font></td></tr>" + 
     590                                "<tr><td>&nbsp;</td></tr>" + 
     591                                "<tr><td><table cellspacing=-1><tr><td><button value=\"Kick Player\" action=\"bypass -h admin_event_control_kick $player_name\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><tr><td><edit var=\"player_name\" width=98 height=15></td></tr></table></td><td><font color=\"LEVEL\">Kicks the specified player(s) from the event. Blank field kicks target.</font></td></tr>" +   
    601592                                "<tr><td>&nbsp;</td></tr>" +   
    602                                 "<tr><td><button value=\"End\" action=\"bypass -h admin_event_control_finish\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Will finish the event teleporting back all the players</font></td></tr>" + 
    603                 "</table></body></html>"); 
    604                  
    605                 adminReply.setHtml(replyMSG.toString()); 
     593                                "<tr><td><button value=\"End!\" action=\"bypass -h admin_event_control_finish\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Will finish the event teleporting back all the players</font></td></tr>" + 
     594                                "<tr><td>&nbsp;</td></tr>" + 
     595                "</table></td></tr></table></body></html>"); 
     596                 
     597                adminReply.setHtml(sb.toString()); 
    606598                activeChar.sendPacket(adminReply); 
    607599        } 
     
    621613                                num = n; 
    622614                         
    623                         player.getInventory().addItem("Event", id, num, player, activeChar); 
    624                         player.sendPacket(new ItemList(player, true)); 
     615                        player.addItem("Event", id, num, activeChar, true); 
    625616                         
    626617                        NpcHtmlMessage adminReply = new NpcHtmlMessage(5); 
    627                         adminReply.setHtml( 
    628                                         "<html><body>" + 
    629                                         "CONGRATULATIONS, you should have a present in your inventory" + 
    630                         "</body></html>"); 
     618                        adminReply.setHtml("<html><body> CONGRATULATIONS! You should have been rewarded. </body></html>"); 
    631619                        player.sendPacket(adminReply); 
    632620                } 
Note: See TracChangeset for help on using the changeset viewer.