@Override public boolean run(final Item item) { final LocalPlayerCharacter character = WakfuGameEntity.getInstance().getLocalPlayer(); if (character.getBags().getItemFromInventories(item.getUniqueId()) == null) { ReduceDeadStateItemAction.m_logger.error( (Object) "[ItemAction] On essaye de lancer une action avec un item qui n'est pas dans les bags"); return false; } boolean hasDeadState = false; final List<StateRunningEffect> states = character.getRunningEffectManager().getRunningState(); for (int i = 0; i < states.size(); ++i) { final StateRunningEffect effect = states.get(i); if (effect.getState() == null || effect.getState().isStateForDeath()) { hasDeadState = true; break; } } if (!hasDeadState) { ReduceDeadStateItemAction.m_logger.warn( (Object) "Tentative d'utilisation d'un item de reduction de DEAD_STATE sans en avoir"); return false; } this.sendRequest(item.getUniqueId()); return true; }
@Override public boolean isRunnable() { final LocalPlayerCharacter localPlayer = WakfuGameEntity.getInstance().getLocalPlayer(); return !localPlayer.isWaitingForResult() && !localPlayer.isOnFight() && !ClientTradeHelper.INSTANCE.isTradeRunning(); }
@Override public boolean isRunnable(final Item item) { if (!super.isRunnable(item)) { return false; } final LocalPlayerCharacter localPlayer = WakfuGameEntity.getInstance().getLocalPlayer(); final ClientAchievementsContext achievementsContext = localPlayer.getAchievementsContext(); return !achievementsContext.isAchievementActive(this.m_achievementId) || achievementsContext.isAchievementComplete(this.m_achievementId); }