Noticias:

Debes de estar registrado para poder ver el contenido indicado. Registrate o Conectate

Menú Principal

Clan Full Item

Iniciado por Swarlog, Ago 19, 2022, 12:53 AM

Tema anterior - Siguiente tema

Swarlog

### Eclipse Workspace Patch 1.0
#L2JFrozen
Index: com/l2jfrozen/gameserver/handler/ItemHandler.java
===================================================================
--- com/l2jfrozen/gameserver/handler/ItemHandler.java    (revision 979)
+++ com/l2jfrozen/gameserver/handler/ItemHandler.java    (working copy)

@@ -102,6 +102,7 @@
import com.l2jfrozen.gameserver.handler.itemhandlers.ChristmasTree;
import com.l2jfrozen.gameserver.handler.itemhandlers.ClanRepsItem;
+import com.l2jfrozen.gameserver.handler.itemhandlers.ClanItem;
import com.l2jfrozen.gameserver.handler.itemhandlers.CrystalCarol;
import com.l2jfrozen.gameserver.handler.itemhandlers.Crystals;

@@ -286,6 +287,7 @@
registerItemHandler(new BreakingArrow());
registerItemHandler(new ChristmasTree());
registerItemHandler(new Crystals());
+registerItemHandler(new ClanItem());

Index: com/l2jfrozen/gameserver/handler/itemhandlers/ClanItem.java
===================================================================
--- com/l2jfrozen/gameserver/handler/itemhandlers/ClanItem.java    (revision 0)
+++ com/l2jfrozen/gameserver/handler/itemhandlers/ClanItem.java    (working copy)
@@ -0,0 +1,65 @@
/*
 * 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.l2jfrozen.gameserver.handler.itemhandlers;

import com.l2jfrozen.Config;
import com.l2jfrozen.gameserver.handler.IItemHandler;
import com.l2jfrozen.gameserver.model.actor.instance.L2PlayableInstance;
import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.network.SystemMessageId;
import com.l2jfrozen.gameserver.network.serverpackets.SystemMessage;

/**
 * @author Bian - Dream Team
 * @adaptacion L2jfrozen ViejoMULA
 **/
public class ClanItem implements IItemHandler
{
       private static final int ITEM_IDS[] = { Config.CLAN_ITEM_ID };
       
       @Override
       public synchronized void useItem(L2PlayableInstance playable, L2ItemInstance item)
       {
               if(!(playable instanceof L2PcInstance))
                       return;
               
               if (item == null)
               {
                       return;
               }
                       
               L2PcInstance player = (L2PcInstance)playable;
               if (!player.isClanLeader())
               {
                       player.sendPacket(new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED).addItemName(item.getItemId()));
                       return;
               }
               else if (player.isInOlympiadMode())
               {
                       player.sendPacket(new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED).addItemName(item.getItemId()));
                       return;
               }
               else
               {
                       if(player.destroyItem("Consume", item.getObjectId(), 1, null, false))
                       {
                               if (Config.ALLOW_ITEM_SET_LEVEL)
                               {
                                       player.getClan().changeLevel(Config.CLAN_ITEM_LEVEL);
                                       player.sendMessage((new StringBuilder()).append("Felicidades tu clan es ahora level  ").append(Config.CLAN_ITEM_LEVEL).append(".").toString());
                               }
                               
                               if (Config.CLAN_TITLE)
                               {
                                       player.setTitle(Config.ADD_CLAN_TITLE);
                               }
                               
                               player.ClanItem();
                       }
               }
       }
       
       @Override
       public int[] getItemIds()
       {
               return ITEM_IDS;
       }
}

Index: com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java      (revision 979)
+++ com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java      (working copy)
@@ -26,6 +26,7 @@
 import java.util.Collection;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
@@ -13606,8 +13607,38 @@
                 return _lastAttackPacket;
         }
       
+       public void ClanItem()
+       {
+               for(Iterator<Integer> i = Config.CLAN_ITEM_SKILLS.keySet().iterator(); i.hasNext(); broadcastUserInfo())
+               {
+                       Integer skillid = (Integer)i.next();
+                       int skilllvl = ((Integer)Config.CLAN_ITEM_SKILLS.get(skillid)).intValue();
+                       L2Skill skill = SkillTable.getInstance().getInfo(skillid.intValue(), skilllvl);
+                       if(skill != null)
+                               addSkill(skill, true);
+                       getClan().addNewSkill(skill);
+                       sendSkillList();
+               }
+
+               if (Config.ALLOW_REPUTATION_ITEM)
+               {
+                       L2Clan clan = getClan();
+                       clan.setReputationScore(clan.getReputationScore() + Config.REPUTATION_ITEM_QUANTITY, true);
+                       sendMessage((new StringBuilder()).append("You received ").append(Config.REPUTATION_ITEM_QUANTITY).append(" Reputation Points.").toString());
+               }
+               
+               if (Config.ALLOW_CLAN_TCOLOR)
+               {
+                       getAppearance().setTitleColor(Config.CLAN_ITEM_TCOLOR);
+               }
+               
+               sendSkillList();
+               broadcastUserInfo();
         }
+
 }
\ No newline at end of file
Index:com/l2jfrozen/Config.java
===================================================================
--- com/l2jfrozen/Config.java    (revision 979)
+++ com/l2jfrozen/Config.java    (working copy)
@@ -205,6 +205,18 @@
         
+       /** Clan Item **/
+       public static boolean CLAN_TITLE;
+       public static String ADD_CLAN_TITLE;
+       public static boolean ENABLE_CLAN_ITEM;
+       public static Map<Integer, Integer> CLAN_ITEM_SKILLS;
+       public static int CLAN_ITEM_ID;
+       public static boolean ALLOW_ITEM_SET_LEVEL;
+       public static byte CLAN_ITEM_LEVEL;
+       public static boolean ALLOW_REPUTATION_ITEM;
+       public static int REPUTATION_ITEM_QUANTITY;
+       public static boolean ALLOW_CLAN_TCOLOR;
+       public static int CLAN_ITEM_TCOLOR;

//============================================================
public static void loadL2JFrozenConfig()
{
    final String L2JFROZEN = FService.L2JFROZEN_CONFIG_FILE;

@@ -449,6 +461,46 @@

+/** Clan Item **/
+ENABLE_CLAN_ITEM = Boolean.parseBoolean(L2JFrozenSettings.getProperty("EnableClanItem", "True"));
+if(ENABLE_CLAN_ITEM)
+{
+String ItemSkillsSplit[] = L2JFrozenSettings.getProperty("ClanItemSkills", "").split(";");
+CLAN_ITEM_SKILLS = new FastMap<Integer, Integer>(ItemSkillsSplit.length);
+String arr[] = ItemSkillsSplit;
+int len = arr.length;
+for(int i = 0; i < len; i++)
+{
+String skill = arr[i];
+String skillSplit[] = skill.split(",");
+if(skillSplit.length != 2)
+{
+System.out.println((new StringBuilder()).append("[Clan Item]: invalid config property in custom.properties -> ClanItemSkills \"").append(skill).append("\"").toString());
+continue;
+}
+try
+{
+CLAN_ITEM_SKILLS.put(Integer.valueOf(Integer.parseInt(skillSplit[0])), Integer.valueOf(Integer.parseInt(skillSplit[1])));
+continue;
+}
+catch(NumberFormatException nfe)
+{
+
+}
+if(!skill.equals(""))
+System.out.println((new StringBuilder()).append("[Clan Item]: invalid config property in custom.properties -> ClanItemSkills \"").append(skillSplit[0]).append("\"").append(skillSplit[1]).toString());
+}
+}
+CLAN_ITEM_ID = Integer.parseInt(L2JFrozenSettings.getProperty("ClanItemID", "666"));
+ALLOW_ITEM_SET_LEVEL = Boolean.parseBoolean(L2JFrozenSettings.getProperty("AllowClanItemLevel", "False"));
+CLAN_ITEM_LEVEL = Byte.parseByte(L2JFrozenSettings.getProperty("ClanItemSetLevel", "8"));
+ALLOW_REPUTATION_ITEM = Boolean.parseBoolean(L2JFrozenSettings.getProperty("AllowClanItemRep", "False"));
+REPUTATION_ITEM_QUANTITY = Integer.parseInt(L2JFrozenSettings.getProperty("ReputationItemScore", "10000"));
+CLAN_TITLE = Boolean.parseBoolean(L2JFrozenSettings.getProperty("ClanItemTitle", "False"));
+ADD_CLAN_TITLE = L2JFrozenSettings.getProperty("ClanItemAddTitle", "L2WaR");
+ALLOW_CLAN_TCOLOR = Boolean.parseBoolean(L2JFrozenSettings.getProperty("AllowClanItemTitle", "False"));
+CLAN_ITEM_TCOLOR = Integer.decode("0x" + L2JFrozenSettings.getProperty("ClanTitleColor", "88AA88"));

}
        catch(Exception e)
        {
            e.printStackTrace();
            throw new Error("Failed to Load " + L2JFROZEN + " File.");
        }
Index: config/functions/l2jfrozen.properties
===================================================================
--- config/functions/l2jfrozen.properties     (revision 579)
+++ config/functions/l2jfrozen.properties     (working copy)

+#========================================
+#                         Clan Item
+#========================================
+
+# Enable and Disable Item
+EnableClanItem = True
+
+# ItemID for Clan Item
+ClanItemID = 666
+
+# List of Skills reward for clan
+# Format : skillid,skilllvl;skillid2,skilllvl2;....skillidn,skilllvln
+ClanItemSkills = 370,3;371,3;372,3;373,3;374,3;375,3;376,3;377,3;378,3;379,3;380,3;381,3;382,3;383,3;384,3;385,3;386,3;387,3;388,3;389,3;390,3;391,3;
+
+# Allow Clan Item Set Level
+AllowClanItemLevel = True
+
+# LvL Clan Reward
+ClanItemSetLevel = 8
+
+# Allow Clan Item Set Reputation
+AllowClanItemRep = False
+
+# Quantity Reputation Points
+ReputationItemScore = 10000
+
+# Allow Clan Item Title ADD
+ClanItemTitle = False
+
+# Clan Title ADD
+ClanItemAddTitle = L2Frozen
+
+# Allow Clan Item Title Colow
+AllowClanItemTitleColor = False
+
+# Clan Title Color in HEX
+ClanTitleColor = 88AA88
\ No newline at end of file
 

Créditos: Bian - Dream Team