| allanalcantara |
16-08-2011 12:24 PM |
Ant Heavy System
1 Anexo(s)
eawe galerinha bonita belezA? pois é, vim aqui postar minhas contribuições. rsrss
Código:
va no arquivo option.settings ou em qualquer local a sua escolha e adiocionar :
+#=============================================================
+# Anti heavy system =
+#=============================================================
+# Heavy Equipment Restriction
+# IF False , Dagger Classes Won't Be Able To Use Heavy Armors
+AllowDaggersUseHeavy = False
+# IF False , Archer Classes Won't Be Able To Use Heavy Armors
+AllowArchersUseHeavy = False
Enseguida, Ir no Arquivo config.java e adicionar :
+public static boolean ALLOW_DAGGERS_WEAR_HEAVY;
+public static boolean ALLOW_ARCHERS_WEAR_HEAVY;
+ALLOW_DAGGERS_WEAR_HEAVY = Boolean.parseBoolean(optionSettings.getProperty("AllowDaggersUseHeavy", "True"));
+ALLOW_ARCHERS_WEAR_HEAVY = Boolean.parseBoolean(optionSettings.getProperty("AllowArchersUseHeavy", "True"));
Enseguida, Ir no Arquivo L2ClassMasterInstance.java, adicionar :
+import net.sf.l2j.gameserver.model.Inventory;
+import net.sf.l2j.gameserver.model.actor.instance.L2ItemInstance;
+import net.sf.l2j.gameserver.serverpackets.InventoryUpdate;
html.setHtml(sb.toString());
player.sendPacket(html);
+ if (!Config.ALLOW_ARCHERS_WEAR_HEAVY)
+ {
+ if (player.getClassId().getId() == 9 || player.getClassId().getId() == 92 || player.getClassId().getId() == 24 || player.getClassId().getId() == 102
+ || player.getClassId().getId() == 37 || player.getClassId().getId() == 109)
+ {
+ L2ItemInstance armor = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_CHEST);
+ if (armor != null)
+ {
+ L2ItemInstance[] unequipped = player.getInventory().unEquipItemInBodySlotAndRecord(armor.getItem().getBodyPart());
+ InventoryUpdate iu = new InventoryUpdate();
+ for (L2ItemInstance element : unequipped)
+ iu.addModifiedItem(element);
+ sendPacket(iu);
+ }
+ L2ItemInstance legs = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEGS);
+ if (legs != null)
+ {
+ L2ItemInstance[] unequipped = player.getInventory().unEquipItemInBodySlotAndRecord(legs.getItem().getBodyPart());
+ InventoryUpdate iu = new InventoryUpdate();
+ for (L2ItemInstance element : unequipped)
+ iu.addModifiedItem(element);
+ sendPacket(iu);
+ }
+ }
+ if (!Config.ALLOW_DAGGERS_WEAR_HEAVY)
+ {
+ if (player.getClassId().getId() == 93 || player.getClassId().getId() == 108 || player.getClassId().getId() == 101 || player.getClassId().getId() == 8
+ || player.getClassId().getId() == 23 || player.getClassId().getId() == 36)
+ {
+ L2ItemInstance chest = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_CHEST);
+ if (chest != null)
+ {
+ L2ItemInstance[] unequipped = player.getInventory().unEquipItemInBodySlotAndRecord(chest.getItem().getBodyPart());
+ InventoryUpdate iu = new InventoryUpdate();
+ for (L2ItemInstance element : unequipped)
+ iu.addModifiedItem(element);
+ sendPacket(iu);
+ }
+ L2ItemInstance legs = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEGS);
+ if (legs != null)
+ {
+ L2ItemInstance[] unequipped = player.getInventory().unEquipItemInBodySlotAndRecord(legs.getItem().getBodyPart());
+ InventoryUpdate iu = new InventoryUpdate();
+ for (L2ItemInstance element : unequipped)
+ iu.addModifiedItem(element);
+ sendPacket(iu);
+ }
+ }
+ }
+ else
+ {
+ super.onBypassFeedback(player, command);
+ }
+ }
sb = null;
Depois Procure o UseItem.java depois adicione :
+import net.sf.l2j.gameserver.templates.L2ArmorType;
if(activeChar.isCursedWeaponEquiped() && (bodyPart == L2Item.SLOT_LR_HAND || bodyPart == L2Item.SLOT_L_HAND || bodyPart == L2Item.SLOT_R_HAND))
return;
+ if (!Config.ALLOW_DAGGERS_WEAR_HEAVY)
+ {
+ if (activeChar.getClassId().getId() == 93 || activeChar.getClassId().getId() == 108 || activeChar.getClassId().getId() == 101 ||
+ activeChar.getClassId().getId() == 8 || activeChar.getClassId().getId() == 23 || activeChar.getClassId().getId() == 36)
+ {
+ if (item.getItemType() == L2ArmorType.HEAVY)
+ {
+ activeChar.sendMessage("You cannot use this item when you class dagger.");
+ return;
+ }
+ }
+ }
+
+ if (!Config.ALLOW_ARCHERS_WEAR_HEAVY)
+ {
+ if (activeChar.getClassId().getId() == 9 || activeChar.getClassId().getId() == 92 || activeChar.getClassId().getId() == 24 ||
+ activeChar.getClassId().getId() == 102 || activeChar.getClassId().getId() == 37 || activeChar.getClassId().getId() == 109)
+ {
+ if (item.getItemType() == L2ArmorType.HEAVY)
+ {
+ activeChar.sendMessage("You cannot use this item when you class archer.");
+ return;
+ }
+ }
+ }
+
// Don't allow weapon/shield hero equipment during Olimpia
|