Secret Experience

Secret Experience (https://secretexperience.net/index.php)
-   [Lineage] Java Mods (https://secretexperience.net/forumdisplay.php?f=636)
-   -   [L2JServer] Voiced Command .hero (https://secretexperience.net/showthread.php?t=25163)

C.Bartowski 09-09-2010 05:37 PM

Voiced Command .hero
 
1 Anexo(s)
Bom galera outro mod ae pra voces...

Esse aqui faz com que quando o player digitar .hero

ele virará hero...

Você pode mudar o item que voce quer que o player "Pague" para se tornar hero...

Segue abaixo a Diff em forma de Code e depois vai anexada =)

Código:

Index: Trunk/L2JStep_CORE/config/Custom/L2JMods.properties
===================================================================
--- Trunk/L2JStep_CORE/config/Custom/L2JMods.properties (revision 1)
+++ TTrunk/L2JStep_CORE/config/Custom/L2JMods.properties (working copy)                       
@@ -881,6 +881,18 @@
       
+#--------------------------------------------------
+# Set this to True to enable .hero voiced command #
+#--------------------------------------------------
+AllowHeroCommand = False
+# Item id that it will take and make you hero
+HeroItemId = 3481
+# How many of this item will it take?
+HeroItemCount = 1


Index: Trunk/java/com/l2jstep/Config.java
===================================================================
--- Trunk/java/com/l2jstep/Config.java (revision 1)
+++ Trunk/java/com/l2jstep/Config.java (working copy)

@@ -881,6 +881,18 @@

    public static boolean ALT_GAME_KARMA_PLAYER_CAN_USE_WAREHOUSE;
+  public static boolean ALLOW_HERO_COMMAND;
+  public static int HERO_ITEM_ID;
+  public static int HERO_ITEM_COUNT;
    public static boolean L2JMOD_CHAMPION_ENABLE;


@@ -881,6 +881,18 @@


+                    ALLOW_HERO_COMMAND = Boolean.parseBoolean(L2JModSettings.getProperty("AllowHeroCommand", "false"));
+              HERO_ITEM_ID = Integer.parseInt(L2JModSettings.getProperty("HeroItemId", "3481"));
+              HERO_ITEM_COUNT = Integer.parseInt(L2JModSettings.getProperty("HeroItemCount", "1"));
                L2JMOD_CHAMPION_ENABLE = Boolean.parseBoolean(L2JModSettings.getProperty("ChampionEnable", "false"));
                L2JMOD_CHAMPION_FREQUENCY = Integer.parseInt(L2JModSettings.getProperty("ChampionFrequency", "0"));
                L2JMOD_CHAMP_MIN_LVL = Integer.parseInt(L2JModSettings.getProperty("ChampionMinLevel", "20"));

                       
Index: Trunk/L2JStep_CORE/java/com/l2jstep/gameserver/handler/voicedcommandhandlers/hero.java
===================================================================
--- Trunk/L2JStep_CORE/java/com/l2jstep/gameserver/handler/voicedcommandhandlers/hero.java (revision 1)
+++ Trunk/L2JStep_CORE/java/com/l2jstep/gameserver/handler/voicedcommandhandlers/hero.java (working copy)       
+/*
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+package com.it.br.gameserver.handler.voicedcommandhandlers;
+
+import com.l2jstep.Config;
+import com.l2jstep.gameserver.handler.IVoicedCommandHandler;
+import com.l2jstep.gameserver.model.actor.instance.L2PlayableInstance;
+import com.l2jstep.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jstep.gameserver.model.L2ItemInstance;
+import com.l2jstep.gameserver.serverpackets.ActionFailed;
+import com.l2jstep.gameserver.serverpackets.SocialAction;
+
+/**
+ * @author Kinho!
+ */
+public class hero implements IVoicedCommandHandler
+{
+        private static final String[] VOICED_COMMANDS = {"hero"};
+       
+        public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
+        {
+                if (command.equalsIgnoreCase("hero"))
+                {
+            if(activeChar.getInventory().getItemByItemId(Config.HERO_ITEM_ID) != null && activeChar.getInventory().getItemByItemId(Config.HERO_ITEM_ID).getCount() >= Config.HERO_ITEM_COUNT)
+            {
+                    activeChar.getInventory().destroyItemByItemId("GoldDragon", Config.HERO_ITEM_ID, Config.HERO_ITEM_COUNT, activeChar, activeChar.getTarget());
+                activeChar.broadcastPacket(new SocialAction(activeChar.getObjectId(), 16));
+                    activeChar.setHero(true);
+                activeChar.sendMessage("You became hero untill restart and gave 1 gold dragon");
+                activeChar.broadcastUserInfo();
+              }
+            else
+            {
+                      activeChar.sendMessage("You need 1 gold dragon to become hero.");
+                return true;
+            }
+                }
+                return false;
+                }
+        public String[] getVoicedCommandList()
+        {
+                return VOICED_COMMANDS;
+        }
+}

Index: Trunk/L2JStep_CORE/java/com/l2jstep/gameserver/handler/voicedcommandhandlers.java
===================================================================
--- Trunk/L2JStep_CORE/java/com/l2jstep/gameserver/handler/voicedcommandhandlers.java (revision 1)
+++ Trunk/L2JStep_CORE/java/com/l2jstep/gameserver/handler/voicedcommandhandlers.java (working copy)

@@ -881,6 +881,18 @@
 import com.l2jstep.gameserver.handler.voicedcommandhandlers.BuyRec;
+import com.l2jstep.gameserver.handler.voicedcommandhandlers.hero;       
 import com.l2jstep.gameserver.handler.voicedcommandhandlers.OnlinePlayers;
@@ -881,6 +881,18 @@

+            if (Config.ALLOW_HERO_COMMAND)
+            registerVoicedCommandHandler(new hero());
            registerVoicedCommandHandler(new stats());

Segue abaixo o anexo e os creditos

Créditos pelo MOD: Kinho! e Mazokista

Vlw's


Kinho! 09-09-2010 10:14 PM

Opa maninho...

Java MOD nao tem creditos definidos.... Apenas Usei um comando como base e alterei umas linha e saiu isso... Achoque o creditos tem que sre todo do Pedro, pois ele que praticamente que fez o Mod....

Obs: Nao me lembro o nick do pedro do outro forum,( Forum Ingles) vou pergunta ele e ja edito o topico...


Horários baseados na GMT -3. Agora são 01:00 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.