Ir para conteúdo
  • Cadastre-se
  • 0

ajude me olympiadas


cazaquistaoo

Pergunta

4 respostass a esta questão

Posts recomendados


  • 0

core

 

 

Index: head-src/com/l2jfrozen/gameserver/handler/AdminCommandHandler.java

===================================================================

--- head-src/com/l2jfrozen/gameserver/handler/AdminCommandHandler.java (revision 936)

+++ head-src/com/l2jfrozen/gameserver/handler/AdminCommandHandler.java (working copy)

@@ -92,7 +94,12 @@

import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminTvTEngine;

import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminUnblockIp;

import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminVIPEngine;

import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminZone;

+import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminOlympiad;

 

 

@@ -186,7 +194,13 @@

registerAdminCommandHandler(new AdminCharSupervision());

+ registerAdminCommandHandler(new AdminOlympiad());

//ATTENTION: adding new command handlers, you have to change the

//sql file containing the access levels rights

Index: head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminOlympiad.java

===================================================================

--- head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminOlympiad.java (revision 0)

+++ head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminOlympiad.java (revision 0)

@@ -0,0 +1,203 @@

+/*

+ * 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 <

O conteúdo está oculto, favor efetuar login ou se cadastrar!

+ */

+package com.l2jfrozen.gameserver.handler.admincommandhandlers;

+

+import com.l2jfrozen.gameserver.handler.IAdminCommandHandler;

+import com.l2jfrozen.gameserver.model.L2Object;

+import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;

+import com.l2jfrozen.gameserver.model.entity.olympiad.Olympiad;

+import com.l2jfrozen.gameserver.templates.StatsSet;

+

+public class AdminOlympiad implements IAdminCommandHandler

+{

+ private static final String[] ADMIN_COMMANDS =

+ {

+ "admin_addolypoints",

+ "admin_removeolypoints",

+ "admin_setolypoints",

+ "admin_getolypoints"

+ };

+

+ public boolean useAdminCommand(String command, L2PcInstance activeChar)

+ {

+ if (command.startsWith("admin_addolypoints"))

+ {

+ try

+ {

+ String val = command.substring(19);

+ L2Object target = activeChar.getTarget();

+ L2PcInstance player = null;

+ if (target instanceof L2PcInstance)

+ {

+ player = (L2PcInstance)target;

+ if (player.isNoble())

+ {

+ StatsSet playerStat = Olympiad.getNobleStats(player.getObjectId());

+ if (playerStat == null)

+ {

+ activeChar.sendMessage("Oops! This player hasn't played on Olympiad yet!");

+ return false;

+ }

+ int oldpoints = Olympiad.getInstance().getNoblePoints(player.getObjectId());

+ int points = oldpoints + Integer.parseInt(val);

+ if (points > 1000)

+ {

+ activeChar.sendMessage("You can't set more than 1000 or less than 0 Olympiad points!");

+ return false;

+ }

+ playerStat.set("olympiad_points", points);

+

+ activeChar.sendMessage("Player " + player.getName() + " now has " + points + " Olympiad points.");

+ }

+ else

+ {

+ activeChar.sendMessage("Oops! This player is not noblesse!");

+ return false;

+ }

+ }

+ else

+ {

+ activeChar.sendMessage("Usage: target a player and write the amount of points you would like to add.");

+ activeChar.sendMessage("Example: //addolypoints 10");

+ activeChar.sendMessage("However, keep in mind that you can't have less than 0 or more than 1000 points.");

+ }

+ }

+ catch (StringIndexOutOfBoundsException e)

+ {

+ activeChar.sendMessage("Usage: //addolypoints <points>");

+ }

+ }

+ else if (command.startsWith("admin_removeolypoints"))

+ {

+ try

+ {

+ String val = command.substring(22);

+ L2Object target = activeChar.getTarget();

+ L2PcInstance player = null;

+ if (target instanceof L2PcInstance)

+ {

+ player = (L2PcInstance)target;

+ if (player.isNoble())

+ {

+ StatsSet playerStat = Olympiad.getNobleStats(player.getObjectId());

+ if (playerStat == null)

+ {

+ activeChar.sendMessage("Oops! This player hasn't played on Olympiad yet!");

+ return false;

+ }

+ int oldpoints = Olympiad.getInstance().getNoblePoints(player.getObjectId());

+ int points = oldpoints - Integer.parseInt(val);

+ if (points < 0)

+ points = 0;

+ playerStat.set("olympiad_points", points);

+ activeChar.sendMessage("Player " + player.getName() + " now has " + points + " Olympiad points.");

+ }

+ else

+ {

+ activeChar.sendMessage("Oops! This player is not noblesse!");

+ return false;

+ }

+ }

+ else

+ {

+ activeChar.sendMessage("Usage: target a player and write the amount of points you would like to remove.");

+ activeChar.sendMessage("Example: //removeolypoints 10");

+ activeChar.sendMessage("However, keep in mind that you can't have less than 0 or more than 1000 points.");

+ }

+ }

+ catch (StringIndexOutOfBoundsException e)

+ {

+ activeChar.sendMessage("Usage: //removeolypoints points");

+ }

+ }

+ else if (command.startsWith("admin_setolypoints"))

+ {

+ try

+ {

+ String val = command.substring(19);

+ L2Object target = activeChar.getTarget();

+ L2PcInstance player = null;

+ if (target instanceof L2PcInstance)

+ {

+ player = (L2PcInstance)target;

+ if (player.isNoble())

+ {

+ StatsSet playerStat = Olympiad.getNobleStats(player.getObjectId());

+ if (playerStat == null)

+ {

+ activeChar.sendMessage("Oops! This player hasn't played on Olympiad yet!");

+ return false;

+ }

+ if (Integer.parseInt(val) < 1 && Integer.parseInt(val) > 1000)

+ {

+ activeChar.sendMessage("You can't set more than 1000 or less than 0 Olympiad points! or lower then 0");

+ return false;

+ }

+ playerStat.set("olympiad_points", Integer.parseInt(val));

+ activeChar.sendMessage("Player " + player.getName() + " now has " + Integer.parseInt(val) + " Olympiad points.");

+ }

+ else

+ {

+ activeChar.sendMessage("Oops! This player is not noblesse!");

+ return false;

+ }

+ }

+ else

+ {

+ activeChar.sendMessage("Usage: target a player and write the amount of points you would like to set.");

+ activeChar.sendMessage("Example: //setolypoints 10");

+ activeChar.sendMessage("However, keep in mind that you can't have less than 0 or more than 1000 points.");

+ }

+ }

+ catch (StringIndexOutOfBoundsException e)

+ {

+ activeChar.sendMessage("Usage: //setolypoints <points>");

+ }

+ }

+ else if (command.startsWith("admin_getolypoints"))

+ {

+ try

+ {

+ L2Object target = activeChar.getTarget();

+ L2PcInstance player = null;

+ if (target instanceof L2PcInstance)

+ {

+ player = (L2PcInstance)target;

+ if (player.isNoble())

+ {

+ activeChar.sendMessage("The current record of " + player.getName() + " for this Grand Olympiad is " + Olympiad.getInstance().getCompetitionDone(player.getObjectId()) + " match(s) played. " + player.getName() + " have earned " + Olympiad.getInstance().getNoblePoints(player.getObjectId()) + " Olympiad Point(s)");

+ }

+ else

+ {

+ activeChar.sendMessage("Oops! This player is not noblesse!");

+ return false;

+ }

+ }

+ else

+ activeChar.sendMessage("You must target a player to use the command.");

+ }

+ catch (StringIndexOutOfBoundsException e)

+ {

+ activeChar.sendMessage("Usage: //getolypoints");

+ }

+ }

+ return true;

+ }

+

+ public String[] getAdminCommandList()

+ {

+ return ADMIN_COMMANDS;

+ }

+}

\ No newline at end of file

Index: head-src/com/l2jfrozen/gameserver/model/entity/olympiad/Olympiad.java

===================================================================

--- head-src/com/l2jfrozen/gameserver/model/entity/olympiad/Olympiad.java (revision 936)

+++ head-src/com/l2jfrozen/gameserver/model/entity/olympiad/Olympiad.java (working copy)

@@ -1577,4 +1577,16 @@

_classBasedRegisters.remove(Integer.valueOf(player.getClassId().getId()));

_nonClassBasedRegisters.remove(player);

}

+

+ public static StatsSet getNobleStats(int playerId)

+ {

+ return _nobles.get(playerId);

+ }

+

+ protected static synchronized void updateNobleStats(int playerId, StatsSet stats)

+ {

+ _nobles.remove(playerId);

+ _nobles.put(playerId, stats);

+ }

+

}

 

 

navicat

 

 

INSERT INTO admin_command_access_rights VALUES ('admin_addolypoints', '2');

INSERT INTO admin_command_access_rights VALUES ('admin_removeolypoints', '2');

INSERT INTO admin_command_access_rights VALUES ('admin_setolypoints', '2');

INSERT INTO admin_command_access_rights VALUES ('admin_getolypoints', '2');

 

 

kainsuperior.gif
Link para o comentário
Compartilhar em outros sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Processando...



×
×
  • Criar Novo...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.