Registruotis    Prisijungti    Forumas    Ieškoti    DUK




Kaip padaryti,kad item duotu hero(gidas)

Įvairūs serverio failai, gidai, skriptai

Kaip padaryti,kad item duotu hero(gidas)

Standartinė Bosiux » Balandis 1st, 2010, 12:37 am

Taigi nusprendziau sukurti pamoka.
Tai pradedam einam i gameserver/config/mod.properties
Ten susirandam turetu but taip:


# Hero Custom Item Configuration.
# Item Id = 3481.
# When ActiveChar will use this item will gain Hero Status.
EnableHeroCustomItem = False
HItemID = 3481
AllowUseHeroItemOnSub = False
AllowHeroCustomItemOnEvents = False

Keiciam taip:

# Hero Custom Item Configuration.
# Item Id = 3481.
# When ActiveChar will use this item will gain Hero Status.
EnableHeroCustomItem = True
HItemID = 3481
AllowUseHeroItemOnSub = False / čia yra ar duot skilus kai pasimsi kita suba čia kaip jau norit.
AllowHeroCustomItemOnEvents = False / čia tipo ant eventu ar duot čia irgi renkates kaip norit

3481 Tai itemo id siuo atveju tai gold ji galit keist i ka norit.

Stai ir viskas dabar koki item id parasysit ir zaidejas ant jo paspaudes taps herojumi. Sekmes.
Vartotojo avataras
Bosiux
Užkietėjęs dalyvis
Užkietėjęs dalyvis
 
Pranešimai: 369
Užsiregistravo: Kovas 3rd, 2010, 10:25 pm
Karma:
Karma:
Increase user’s karma Decrease user’s karma

Re: Kaip padaryti,kad item duotu hero(gidas)

Standartinė bauwbas » Balandis 3rd, 2010, 12:33 pm

Nesamone :D čia gi configa is false ijungei i true. Wow sunku :D Taigi dauguma packu net neturi tos funkcijos, tad reikejo gido kur butu kaip sukurt ta item :)
bauwbas
Naujokas
Naujokas
 
Pranešimai: 5
Užsiregistravo: Vasaris 25th, 2010, 4:45 pm
Karma:
Karma:
Increase user’s karma Decrease user’s karma

Re: Kaip padaryti,kad item duotu hero(gidas)

Standartinė savas » Balandis 4th, 2010, 9:48 am

Nu siektiek pritariu, kaip is False pakeisti i True :D
Stai issamesnis scriptas:

Kodas: Pasirinkti visus
Index: /java/net/sf/l2j/Config.java
===================================================================
--- /java/net/sf/l2j/Config.java (revision 23)
+++ /java/net/sf/l2j/Config.java (revision 28)
@@ -354,4 +354,8 @@
     public static boolean   ANNOUNCE_GM_LOGIN;
     public static boolean   ENABLE_AIO_WAREHOUSE;
+    public static boolean   HERO_CUSTOM_ITEM;
+    public static int       HERO_ITEM_ID;
+    public static boolean   NOBLE_CUSTOM_ITEM;
+    public static int       NOBLE_ITEM_ID;
     
     /** Event Settings Parameters */
@@ -1667,4 +1671,8 @@
                 ANNOUNCE_GM_LOGIN                = Boolean.parseBoolean(l2jmods.getProperty("AnnounceGMLogin", "False"));
                 ENABLE_AIO_WAREHOUSE             = Boolean.parseBoolean(l2jmods.getProperty("EnableAIOWh", "False"));
+                HERO_CUSTOM_ITEM                 = Boolean.parseBoolean(l2jmods.getProperty("HeroCustomItem", "False"));
+                HERO_ITEM_ID                     = Integer.parseInt(l2jmods.getProperty("HeroItemId", "3481"));
+                NOBLE_CUSTOM_ITEM                = Boolean.parseBoolean(l2jmods.getProperty("NobleCustomItem", "False"));
+                NOBLE_ITEM_ID                    = Integer.parseInt(l2jmods.getProperty("NobleItemId", "3480"));
             }
             catch (Exception e)

Kodas: Pasirinkti visus
Index: /java/net/sf/l2j/gameserver/handler/itemhandlers/HeroCustomItem.java
===================================================================
--- /java/net/sf/l2j/gameserver/handler/itemhandlers/HeroCustomItem.java (revision 28)
+++ /java/net/sf/l2j/gameserver/handler/itemhandlers/HeroCustomItem.java (revision 28)
@@ -0,0 +1,62 @@
+/*
+ * 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 2, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+package net.sf.l2j.gameserver.handler.itemhandlers;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.handler.IItemHandler;
+import net.sf.l2j.gameserver.model.L2ItemInstance;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.model.actor.instance.L2PlayableInstance;
+import net.sf.l2j.gameserver.network.serverpackets.SocialAction;
+
+public class HeroCustomItem implements IItemHandler
+{
+    public HeroCustomItem(){}
+
+    public void useItem(L2PlayableInstance playable, L2ItemInstance item)
+    {
+        if(Config.HERO_CUSTOM_ITEM)
+        {
+            if(!(playable instanceof L2PcInstance))
+                return;
+            L2PcInstance activeChar = (L2PcInstance)playable;
+            if(activeChar.isHero())
+            {
+                activeChar.sendMessage("You are already hero !");
+            }
+            else
+            {
+                activeChar.broadcastPacket(new SocialAction(activeChar.getObjectId(), 16));
+                activeChar.setHero(true);
+                activeChar.sendMessage("Now you are granded with hero status & hero skills. Have fun !");
+                activeChar.broadcastUserInfo();
+                playable.destroyItem("Consume", item.getObjectId(), 1, null, false);
+            }
+        }
+    }
+
+    public int[] getItemIds()
+    {
+        return ITEM_IDS;
+    }
+
+    private static final int ITEM_IDS[] = { Config.HERO_ITEM_ID };
+}
+

Kodas: Pasirinkti visus
Index: /java/net/sf/l2j/gameserver/handler/itemhandlers/NobleCustomItem.java
===================================================================
--- /java/net/sf/l2j/gameserver/handler/itemhandlers/NobleCustomItem.java (revision 28)
+++ /java/net/sf/l2j/gameserver/handler/itemhandlers/NobleCustomItem.java (revision 28)
@@ -0,0 +1,62 @@
+/*
+ * 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 2, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+package net.sf.l2j.gameserver.handler.itemhandlers;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.handler.IItemHandler;
+import net.sf.l2j.gameserver.model.L2ItemInstance;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.model.actor.instance.L2PlayableInstance;
+import net.sf.l2j.gameserver.network.serverpackets.SocialAction;
+
+public class NobleCustomItem implements IItemHandler
+{
+   public NobleCustomItem(){}
+
+    public void useItem(L2PlayableInstance playable, L2ItemInstance item)
+    {
+        if(Config.NOBLE_CUSTOM_ITEM)
+        {
+            if(!(playable instanceof L2PcInstance))
+                return;
+            L2PcInstance activeChar = (L2PcInstance)playable;
+            if(activeChar.isNoble())
+            {
+                activeChar.sendMessage("You are already noblesse blessed.");
+            }
+            else
+            {
+                activeChar.broadcastPacket(new SocialAction(activeChar.getObjectId(), 16));
+                activeChar.setNoble(true);
+                activeChar.sendMessage("You are now granded with noblesse status & noblesse skills. Have fun !");
+                activeChar.broadcastUserInfo();
+                playable.destroyItem("Consume", item.getObjectId(), 1, null, false);
+                activeChar.getInventory().addItem("Tiara", 7694, 1, activeChar, null);
+            }
+        }
+    }
+
+    public int[] getItemIds()
+    {
+        return ITEM_IDS;
+    }
+
+    private static final int ITEM_IDS[] = { Config.NOBLE_ITEM_ID };
+}

Kodas: Pasirinkti visus
Index: /java/net/sf/l2j/gameserver/GameServer.java
===================================================================
--- /java/net/sf/l2j/gameserver/GameServer.java (revision 17)
+++ /java/net/sf/l2j/gameserver/GameServer.java (revision 28)
@@ -136,6 +136,8 @@
 import net.sf.l2j.gameserver.handler.itemhandlers.FishShots;
 import net.sf.l2j.gameserver.handler.itemhandlers.Harvester;
+import net.sf.l2j.gameserver.handler.itemhandlers.HeroCustomItem;
 import net.sf.l2j.gameserver.handler.itemhandlers.MercTicket;
 import net.sf.l2j.gameserver.handler.itemhandlers.MysteryPotion;
+import net.sf.l2j.gameserver.handler.itemhandlers.NobleCustomItem;
 import net.sf.l2j.gameserver.handler.itemhandlers.PaganKeys;
 import net.sf.l2j.gameserver.handler.itemhandlers.Potions;
@@ -471,4 +473,6 @@
       _itemHandler.registerItemHandler(new SummonItems());
       _itemHandler.registerItemHandler(new BeastSpice());
+      _itemHandler.registerItemHandler(new HeroCustomItem());
+      _itemHandler.registerItemHandler(new NobleCustomItem());
         _log.config("ItemHandler: Loaded " + _itemHandler.size() + " handlers.");


Kodas: Pasirinkti visus
Index: java/config/l2jmods.properties
===================================================================
--- java/config/l2jmods.properties (revision 12)
+++ java/config/l2jmods.properties (revision 28)
@@ -297,2 +297,20 @@
 MinLevelToAnnounce = 1
 MaxLevelToAnnounce = 80
+
+# ========================== #
+#       Item Handlers        #
+# ========================== #
+# Hero Custom Item
+# This item will make the char hero untill he restart
+HeroCustomItem = False
+
+# Id of the item
+HeroItemId = 3481
+
+# Noble Custom Item
+# This item will grand the char with noble status
+NobleCustomItem = False
+
+# Id of the item
+NobleItemId = 3480
+
savas
Dalyvis
Dalyvis
 
Pranešimai: 34
Užsiregistravo: Kovas 31st, 2010, 3:37 pm
Miestas: Kaunas
Karma:
Karma:
Increase user’s karma Decrease user’s karma


Grįžti į L2j serverio failai, gidai, skriptai

Dabar prisijungę

Vartotojai naršantys šį forumą: Registruotų vartotojų nėra ir 0 svečių