/** * @param item * @param cgs */ public static void onItemEquipment(Item item, Player owner) { owner.getController().cancelUseItem(); ItemTemplate itemTemplate = item.getItemTemplate(); onItemEquipment(item, owner.getGameStats()); // Check if belongs to ItemSet if (itemTemplate.isItemSet()) { recalculateItemSet(itemTemplate.getItemSet(), owner, item.getItemTemplate().isWeapon()); } if (item.hasManaStones()) addStonesStats(item, item.getItemStones(), owner.getGameStats()); if (item.hasFusionStones()) addStonesStats(item, item.getFusionStones(), owner.getGameStats()); IdianStone idianStone = item.getIdianStone(); if (idianStone != null && (owner.getEquipment().getOffHandWeapon() != item || item.getItemTemplate().isTwoHandWeapon())) { idianStone.onEquip(owner); } addGodstoneEffect(owner, item); RandomStats randomStats = item.getRandomStats(); if (randomStats != null) { randomStats.onEquip(owner); } if (item.getConditioningInfo() != null) { owner.getObserveController().addObserver(item.getConditioningInfo()); item.getConditioningInfo().setPlayer(owner); } if (item.getItemTemplate().isStigma()) StigmaService.recheckHiddenStigma(owner); EnchantService.onItemEquip(owner, item); }
/** * @param item * @param owner */ public static void onItemUnequipment(Item item, Player owner) { owner.getController().cancelUseItem(); ItemTemplate itemTemplate = item.getItemTemplate(); // Check if belongs to ItemSet if (itemTemplate.isItemSet()) { recalculateItemSet(itemTemplate.getItemSet(), owner, item.getItemTemplate().isWeapon()); } owner.getGameStats().endEffect(item); if (item.hasManaStones()) removeStoneStats(item.getItemStones(), owner.getGameStats()); if (item.hasFusionStones()) removeStoneStats(item.getFusionStones(), owner.getGameStats()); if (item.getConditioningInfo() != null) { owner.getObserveController().removeObserver(item.getConditioningInfo()); item.getConditioningInfo().setPlayer(null); } IdianStone idianStone = item.getIdianStone(); if (idianStone != null) { idianStone.onUnEquip(owner); } removeGodstoneEffect(owner, item); RandomStats randomStats = item.getRandomStats(); if (randomStats != null) { randomStats.onUnEquip(owner); } }