EquipmentMode em = e.nextElement();
m_chMode.add(em.getDisplayableName());
}
m_chMode.select(m.curMode().getDisplayableName());
} else {
CriticalSlot cs = getSelectedCritical();
if ((cs != null) && (cs.getType() == CriticalSlot.TYPE_SYSTEM)) {
if ((cs.getIndex() == Mech.SYSTEM_COCKPIT)
&& en.hasEiCockpit() && (en instanceof Mech)) {
m_chMode.removeAll();
m_chMode.setEnabled(true);
m_chMode.add("EI Off");
m_chMode.add("EI On");
m_chMode.add("Aimed shot");
m_chMode.select(((Mech) en)
.getCockpitStatusNextRound());
}
}
}
} else if (ev.getItemSelectable() == m_chMode) {
Mounted m = getSelectedEquipment();
CriticalSlot cs = getSelectedCritical();
if ((m != null) && m.getType().hasModes()) {
int nMode = m_chMode.getSelectedIndex();
if (nMode >= 0) {
if ((m.getType() instanceof MiscType)
&& ((MiscType) m.getType()).isShield()
&& (clientgui.getClient().game.getPhase() != IGame.Phase.PHASE_FIRING)) {
clientgui.systemMessage(Messages.getString(
"MechDisplay.ShieldModePhase", null));//$NON-NLS-1$
return;
}
if ((m.getType() instanceof MiscType)
&& ((MiscType) m.getType()).isVibroblade()
&& (clientgui.getClient().game.getPhase() != IGame.Phase.PHASE_PHYSICAL)) {
clientgui.systemMessage(Messages.getString(
"MechDisplay.VibrobladeModePhase", null));//$NON-NLS-1$
return;
}
if ((m.getType() instanceof MiscType)
&& ((MiscType) m.getType())
.hasSubType(MiscType.S_RETRACTABLE_BLADE)
&& (clientgui.getClient().game.getPhase() != IGame.Phase.PHASE_MOVEMENT)) {
clientgui
.systemMessage(Messages
.getString(
"MechDisplay.RetractableBladeModePhase", null));//$NON-NLS-1$
return;
}
// Can only charge a capacitor if the weapon has not
// been fired.
if ((m.getType() instanceof MiscType)
&& (m.getLinked() != null)
&& ((MiscType) m.getType())
.hasFlag(MiscType.F_PPC_CAPACITOR)
&& m.getLinked().isUsedThisRound()
&& (nMode == 1)) {
clientgui.systemMessage(Messages.getString(
"MechDisplay.CapacitorCharging", null));//$NON-NLS-1$
return;
}
m.setMode(nMode);
// send the event to the server
clientgui.getClient().sendModeChange(en.getId(),
en.getEquipmentNum(m), nMode);
// notify the player
if (m.canInstantSwitch(nMode)) {
clientgui
.systemMessage(Messages
.getString(
"MechDisplay.switched", new Object[] { m.getName(), m.curMode().getDisplayableName() }));//$NON-NLS-1$
} else {
if (IGame.Phase.PHASE_DEPLOYMENT == clientgui
.getClient().game.getPhase()) {
clientgui
.systemMessage(Messages
.getString(
"MechDisplay.willSwitchAtStart", new Object[] { m.getName(), m.pendingMode().getDisplayableName() }));//$NON-NLS-1$
} else {
clientgui
.systemMessage(Messages
.getString(
"MechDisplay.willSwitchAtEnd", new Object[] { m.getName(), m.pendingMode().getDisplayableName() }));//$NON-NLS-1$
}
}
}
} else if ((cs != null)
&& (cs.getType() == CriticalSlot.TYPE_SYSTEM)) {
int nMode = m_chMode.getSelectedIndex();
if (nMode >= 0) {
if ((cs.getIndex() == Mech.SYSTEM_COCKPIT)
&& en.hasEiCockpit() && (en instanceof Mech)) {
Mech mech = (Mech) en;
mech.setCockpitStatus(nMode);
clientgui.getClient().sendSystemModeChange(
en.getId(), Mech.SYSTEM_COCKPIT, nMode);