/**
   * @param itemTemplate
   * @param slot
   * @param cgs
   */
  private static void onItemEquipment(Item item, CreatureGameStats<?> cgs) {
    ItemTemplate itemTemplate = item.getItemTemplate();
    long slot = item.getEquipmentSlot();
    List<StatFunction> modifiers = itemTemplate.getModifiers();
    if (modifiers == null) {
      return;
    }

    List<StatFunction> allModifiers = null;

    if ((slot & ItemSlot.MAIN_OR_SUB.getSlotIdMask()) != 0) {
      allModifiers = wrapModifiers(item, modifiers);
      if (item.hasFusionedItem()) {
        // add all bonus modifiers according to rules
        ItemTemplate fusionedItemTemplate = item.getFusionedItemTemplate();
        WeaponType weaponType = fusionedItemTemplate.getWeaponType();
        List<StatFunction> fusionedItemModifiers = fusionedItemTemplate.getModifiers();
        if (fusionedItemModifiers != null) {
          allModifiers.addAll(wrapModifiers(item, fusionedItemModifiers));
        }
        // add 10% of Magic Boost and Attack
        WeaponStats weaponStats = fusionedItemTemplate.getWeaponStats();
        if (weaponStats != null) {
          int boostMagicalSkill = Math.round(0.1f * weaponStats.getBoostMagicalSkill());
          int attack = Math.round(0.1f * weaponStats.getMeanDamage());
          if (weaponType == WeaponType.ORB_2H
              || weaponType == WeaponType.BOOK_2H
              || weaponType == WeaponType.GUN_1H
              || weaponType == WeaponType.KEYBLADE_2H
              || weaponType == WeaponType.CANNON_2H
              || weaponType == WeaponType.HARP_2H) {
            allModifiers.add(new StatAddFunction(StatEnum.MAGICAL_ATTACK, attack, false));
            allModifiers.add(
                new StatAddFunction(StatEnum.BOOST_MAGICAL_SKILL, boostMagicalSkill, false));
          } else allModifiers.add(new StatAddFunction(StatEnum.PHYSICAL_ATTACK, attack, false));
        }
      }
    } else {
      WeaponStats weaponStat = itemTemplate.getWeaponStats();
      if (weaponStat != null) {
        allModifiers = wrapModifiersW(item, modifiers);
      } else allModifiers = modifiers;
    }

    item.setCurrentModifiers(allModifiers);
    cgs.addEffect(item, allModifiers);
  }
  private static List<StatFunction> wrapModifiersW(Item item, List<StatFunction> modifiers) {
    List<StatFunction> allModifiers = new ArrayList<StatFunction>();
    ItemTemplate itemTemplate = item.getItemTemplate();
    WeaponStats weaponStats = itemTemplate.getWeaponStats();
    for (StatFunction modifier : modifiers) {
      switch (modifier.getName()) {
        default:
          allModifiers.add(modifier);
      }
    }
    allModifiers.add(new StatAddFunction(StatEnum.PARRY, weaponStats.getParry(), false));
    allModifiers.add(
        new StatAddFunction(StatEnum.MAGICAL_ACCURACY, weaponStats.getMagicalAccuracy(), false));
    allModifiers.add(
        new StatAddFunction(StatEnum.PHYSICAL_ACCURACY, weaponStats.getPhysicalAccuracy(), false));

    return allModifiers;
  }