public static void valid(final Event e) { final MessageBoxControler msgBox = Xulor.getInstance() .msgBox( WakfuTranslator.getInstance().getString("setItemElements.question"), WakfuMessageBoxConstants.getMessageBoxIconUrl(0), 2073L, 102, 1); msgBox.addEventListener( new MessageBoxEventListener() { @Override public void messageBoxClosed(final int type, final String userEntry) { if (type == 8) { final SelectItemElementsView elementsView = SelectItemElementsView.INSTANCE; final Item item = elementsView.getConcernedItem(); final SetItemElementsRequestMessage netMsg = new SetItemElementsRequestMessage(); netMsg.setItemUid(item.getUniqueId()); netMsg.setDamageElementMask( elementsView.getElementMask(SelectItemElementsView.DAMAGE_ACTION_ID)); netMsg.setResElementMask( elementsView.getElementMask(SelectItemElementsView.RES_ACTION_ID)); WakfuGameEntity.getInstance().getNetworkEntity().sendMessage(netMsg); WakfuGameEntity.getInstance().removeFrame(UISelectItemElementsFrame.getInstance()); } } }); }
@Override public void onFrameRemove(final FrameHandler frameHandler, final boolean isAboutToBeRemoved) { if (!isAboutToBeRemoved) { Xulor.getInstance().removeActionClass("wakfu.popupInfos"); this.m_lastDialog = null; this.m_fieldProvider = null; this.m_popupDialog = null; } }
public void setContent(final FieldProvider fieldProvider) { String dialog = ""; if (fieldProvider instanceof SpellLevel) { dialog = "spellDetailPopup"; this.m_property = "describedSpell"; } else if (fieldProvider instanceof Item || fieldProvider instanceof ReferenceItem || fieldProvider instanceof MerchantInventoryItem || fieldProvider instanceof ReferenceItemFieldProvider) { Item item = null; ReferenceItem refItem; if (fieldProvider instanceof Item) { refItem = (ReferenceItem) ((Item) fieldProvider).getReferenceItem(); item = (Item) fieldProvider; } else if (fieldProvider instanceof ReferenceItem) { refItem = (ReferenceItem) fieldProvider; } else if (fieldProvider instanceof MerchantInventoryItem) { refItem = (ReferenceItem) ((MerchantInventoryItem) fieldProvider).getItem().getReferenceItem(); } else { if (!(fieldProvider instanceof ReferenceItemFieldProvider)) { return; } refItem = ((ReferenceItemFieldProvider) fieldProvider).getReferenceItem(); } final ReferenceItemDisplayer refItemDisplayer = refItem.getReferenceItemDisplayer(); final ArrayList<String> characteristicsDesc = refItemDisplayer.getCharacteristicsString(); final ArrayList<String> effectsDesc = refItemDisplayer.getEffectsString(); if (effectsDesc == null && characteristicsDesc == null) { dialog = "itemSimplePopup"; } else { dialog = "itemDetailPopup"; } this.m_property = "itemPopupDetail"; } else if (fieldProvider instanceof Skill) { dialog = "skillDescription2"; } if (this.m_property != null && !this.m_property.isEmpty() && fieldProvider != null && !fieldProvider.equals( PropertiesProvider.getInstance().getObjectProperty(this.m_property))) { PropertiesProvider.getInstance().setPropertyValue(this.m_property, fieldProvider); } if (!dialog.isEmpty() && !dialog.equals(this.m_lastDialog)) { final ElementMap map = Xulor.getInstance().getEnvironment().getElementMap("worldAndFightBarDialog"); if (map != null) { this.m_popupDialog = (PopupElement) map.getElement(dialog); } this.m_lastDialog = dialog; } }
@Override public void onFrameAdd(final FrameHandler frameHandler, final boolean isAboutToBeAdded) { if (!isAboutToBeAdded) { Xulor.getInstance().putActionClass("wakfu.popupInfos", PopupInfosActions.class); } }