Noticias:

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

Menú Principal

Item Clan Full

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

Tema anterior - Siguiente tema

Swarlog




CitarCORE:

### Eclipse Workspace Patch 1.0
#P Dream_GameServer
Index: java/com/src/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/com/src/gameserver/model/actor/instance/L2PcInstance.java      (revision 580)
+++ java/com/src/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: java/com/src/Config.java
===================================================================
--- java/com/src/Config.java    (revision 579)
+++ java/com/src/Config.java    (working copy)
@@ -205,6 +205,18 @@
         public static float VIP_ADENA_RATE;
         public static float VIP_DROP_RATE;
         public static float VIP_SPOIL_RATE;
+       /** 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 CustomConfig()
         {
@@ -449,6 +461,46 @@
                                         }
                                                           }
                         }
+                       /** Clan Item **/
+                       ENABLE_CLAN_ITEM = Boolean.parseBoolean(p.getProperty("EnableClanItem", "True"));
+                       if(ENABLE_CLAN_ITEM)
+                       {
+                               String ItemSkillsSplit[] = p.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(p.getProperty("ClanItemID", "666"));
+                       ALLOW_ITEM_SET_LEVEL = TypeFormat.parseBoolean(p.getProperty("AllowClanItemLevel", "True"));
+                       CLAN_ITEM_LEVEL = Byte.parseByte(p.getProperty("ClanItemSetLevel", "8"));
+                       ALLOW_REPUTATION_ITEM = TypeFormat.parseBoolean(p.getProperty("AllowClanItemRep", "False"));
+                       REPUTATION_ITEM_QUANTITY = Integer.parseInt(p.getProperty("ReputationItemScore", "10000"));
+                       CLAN_TITLE = TypeFormat.parseBoolean(p.getProperty("ClanItemTitle", "False"));
+                       ADD_CLAN_TITLE = p.getProperty("ClanItemAddTitle", "L2JDream");
+                       ALLOW_CLAN_TCOLOR = TypeFormat.parseBoolean(p.getProperty("AllowClanItemTitle", "False"));
+                       CLAN_ITEM_TCOLOR = Integer.decode("0x" + p.getProperty("ClanTitleColor", "88AA88"));
+                       
                         p.clear();
                 }
                 catch(Exception e)
Index: config/custom/custom.properties
===================================================================
--- config/custom/custom.properties     (revision 579)
+++ config/custom/custom.properties     (working copy)
@@ -451,4 +451,42 @@
 VipDropRate = 1.5
 
 # Multipliers Spoil
VipSpoilRate = 1.5

+#========================================
+#                         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 = L2JDream
+
+# Allow Clan Item Title Colow
+AllowClanItemTitleColor = False
+
+# Clan Title Color in HEX
+ClanTitleColor = 88AA88
\ No newline at end of file
 

CitarDATA:

### Eclipse Workspace Patch 1.0
#P Dream_DataPack
Index: data/scripts/handlers/MasterHandler.java
===================================================================
--- data/scripts/handlers/MasterHandler.java    (revision 579)
+++ data/scripts/handlers/MasterHandler.java    (working copy)
@@ -102,6 +102,7 @@
 import handlers.itemhandlers.CharChangePotions;
 import handlers.itemhandlers.ChestKey;
 import handlers.itemhandlers.ChristmasTree;
+import handlers.itemhandlers.ClanItem;
 import handlers.itemhandlers.CrystalCarol;
 import handlers.itemhandlers.Crystals;
 import handlers.itemhandlers.EnchantScrolls;
@@ -286,6 +287,7 @@
                 ItemHandler.getInstance().registerItemHandler(new BeastSoulShot());
                 ItemHandler.getInstance().registerItemHandler(new BeastSpiritShot());
                 ItemHandler.getInstance().registerItemHandler(new ChestKey());
+               ItemHandler.getInstance().registerItemHandler(new ClanItem());
                 ItemHandler.getInstance().registerItemHandler(new PaganKeys());
                 ItemHandler.getInstance().registerItemHandler(new Maps());
                 ItemHandler.getInstance().registerItemHandler(new MapForestOfTheDead());
Index: data/scripts/handlers/itemhandlers/ClanItem.java
===================================================================
--- data/scripts/handlers/itemhandlers/ClanItem.java    (revision 0)
+++ data/scripts/handlers/itemhandlers/ClanItem.java    (working copy)
@@ -0,0 +1,65 @@
+package handlers.itemhandlers;
+
+import com.src.Config;
+import com.src.gameserver.handler.IItemHandler;
+import com.src.gameserver.model.actor.L2Playable;
+import com.src.gameserver.model.actor.instance.L2ItemInstance;
+import com.src.gameserver.model.actor.instance.L2PcInstance;
+import com.src.gameserver.network.SystemMessageId;
+import com.src.gameserver.network.serverpackets.SystemMessage;
+
+/**
+ * @author Bian
+ **/
+public class ClanItem implements IItemHandler
+{
+       private static final int ITEM_IDS[] = { Config.CLAN_ITEM_ID };
+       
+       @Override
+       public synchronized void useItem(L2Playable 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));
+                       return;
+               }
+               else if (player.isInOlympiadMode())
+               {
+                       player.sendPacket(new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED).addItemName(item));
+                       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("Congratulations you now have your clan 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;
+       }
+}
\ No newline at end of file
 

Creditos: Bian