public static String getGoalText(
     final ChallengeGoalData goal, final ChallengeData data, final ChallengeDataModel model) {
   String rawText = goal.getFormattedString();
   if (rawText == null || rawText.length() == 0) {
     return null;
   }
   rawText =
       (String)
           ChallengeFormatter.extractValue(
               rawText, ChallengeFormatter.Type.STRING, model.getParams());
   for (Matcher match = ChallengeGoalView.GOAL_BREED_PATTERN.matcher(rawText);
       match.find();
       match = ChallengeGoalView.GOAL_BREED_PATTERN.matcher(rawText)) {
     final String name =
         WakfuTranslator.getInstance()
             .getString(7, PrimitiveConverter.getInteger(match.group(1)), new Object[0]);
     rawText = match.replaceFirst(name);
   }
   for (Matcher match = ChallengeGoalView.GOAL_RESOURCE_PATTERN.matcher(rawText);
       match.find();
       match = ChallengeGoalView.GOAL_RESOURCE_PATTERN.matcher(rawText)) {
     final String name =
         WakfuTranslator.getInstance()
             .getString(12, PrimitiveConverter.getInteger(match.group(1)), new Object[0]);
     rawText = match.replaceFirst(name);
   }
   for (Matcher match = ChallengeGoalView.GOAL_VAR_PATTERN.matcher(rawText);
       match.find();
       match = ChallengeGoalView.GOAL_VAR_PATTERN.matcher(rawText)) {
     final Long value = data.getVarValue(match.group().substring(1, match.group().length() - 1));
     rawText = match.replaceFirst(value.toString());
   }
   return rawText;
 }
 @Override
 public String getAdditionalRequirementDescription() {
   return WakfuTranslator.getInstance()
       .getString(
           "item.action.resetAchievement",
           WakfuTranslator.getInstance().getString(62, this.m_achievementId, new Object[0]));
 }
 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());
           }
         }
       });
 }
 public static void displayNameError(final byte errorCode) {
   String errorString = null;
   switch (errorCode) {
     case 10:
       {
         errorString = "error.characterCreation.existingName";
         break;
       }
     case 11:
       {
         errorString = "error.characterCreation.invalidName";
         break;
       }
     case 12:
       {
         errorString = "error.characterCreation.tooManyCharacters";
         break;
       }
     default:
       {
         errorString = "error.characterCreation";
         break;
       }
   }
   Xulor.getInstance()
       .msgBox(
           WakfuTranslator.getInstance().getString(errorString),
           WakfuMessageBoxConstants.getMessageBoxIconUrl(1),
           1027L,
           8,
           1);
 }
Exemplo n.º 5
0
 @Override
 public String getName() {
   if (this.m_boardParameters != null) {
     return WakfuTranslator.getInstance()
         .getString(78, this.m_boardParameters.getId(), new Object[0]);
   }
   return "#ERROR#";
 }
 @Override
 public Object getFieldValue(final String fieldName) {
   if (fieldName.equals("titleText")) {
     return (this.m_title == null)
         ? null
         : WakfuTranslator.getInstance().getString(this.m_title.getTranslatorKey());
   }
   return null;
 }
 WakfuApplicationUI() {
   super();
   this.m_minDimensions = new Dimension(800, 600);
   try {
     final String skinPath = WakfuConfiguration.getInstance().getString("appSkinPath");
     final ApplicationSkin skinNormal = new ApplicationSkin(skinPath);
     final ApplicationSkin skinOff = new ApplicationSkin(skinPath, "Off", skinNormal);
     this.setTitle(WakfuTranslator.getInstance().getString("desc.wakfu"));
     this.setSkins(skinNormal, skinOff);
     final int minWidth = WakfuConfiguration.getInstance().getInteger("resolution.min.width", 800);
     final int minHeight =
         WakfuConfiguration.getInstance().getInteger("resolution.min.height", 600);
     this.m_minDimensions.setSize(minWidth, minHeight);
   } catch (PropertyException e) {
     WakfuApplicationUI.m_logger.error((Object) "Unable to create skinPath", (Throwable) e);
   }
 }
 @Override
 public AbstractMRUAction[] getInteractiveMRUActions() {
   if (!SystemConfiguration.INSTANCE.getBooleanValue(
       SystemConfigurationType.KROSMOZ_GAMES_ENABLE)) {
     return AbstractMRUAction.EMPTY_ARRAY;
   }
   final KrosmozGame game = KrosmozGame.byId(this.m_boardParameters.getGameId());
   if (WakfuGameCalendar.getInstance().getDate().before(game.getUnlockDate())) {
     return AbstractMRUAction.EMPTY_ARRAY;
   }
   final MRUInteractifMachine activateAction = MRUActions.INTERACTIF_ACTION.getMRUAction();
   if (!WakfuSWT.isInit()) {
     activateAction.setEnabled(false);
     activateAction.setErrorMsg(
         WakfuTranslator.getInstance().getString("krosmoz.gameBoard.systemRequirementsNotMet"));
   }
   return new AbstractMRUAction[] {activateAction};
 }
 private void askToCloseRequest() {
   if (this.m_isRunning) {
     final MessageBoxData data =
         new MessageBoxData(
             102, 0, WakfuTranslator.getInstance().getString("contactModerator.suretoclose"), 24L);
     final MessageBoxControler controler = Xulor.getInstance().msgBox(data);
     controler.addEventListener(
         new MessageBoxEventListener() {
           @Override
           public void messageBoxClosed(final int type, final String userEntry) {
             if (type == 8) {
               WakfuGameEntity.getInstance().removeFrame(UIModeratorChatFrame.this);
             }
           }
         });
   } else {
     WakfuGameEntity.getInstance().removeFrame(this);
   }
 }
 @Override
 public boolean run(final Message message) {
   final MessageBoxControler controler =
       Xulor.getInstance()
           .msgBox(WakfuTranslator.getInstance().getString("guild.leave.validate"), 6L, 102, 3);
   controler.addEventListener(
       new MessageBoxEventListener() {
         @Override
         public void messageBoxClosed(final int type, final String userEntry) {
           if (type != 2) {
             return;
           }
           final LocalPlayerCharacter localPlayer = WakfuGameEntity.getInstance().getLocalPlayer();
           WakfuGuildView.getInstance().requestRemoveById(localPlayer.getId());
           WakfuGameEntity.getInstance().removeFrame(UIGuildManagementFrame.getInstance());
         }
       });
   return false;
 }
 @Override
 public boolean onMessage(final Message message) {
   switch (message.getId()) {
     case 2050:
       {
         final boolean success =
             NetCharacterChoiceFrame.onCharacterSelectionResult(
                 (CharacterSelectionResultMessage) message, this);
         if (!success) {
           WakfuProgressMonitorManager.getInstance().done();
           WakfuGameEntity.getInstance().removeFrame(this);
           NetCharacterChoiceFrame.getInstance().enableLoadUI(true);
           WakfuGameEntity.getInstance().pushFrame(NetCharacterChoiceFrame.getInstance());
         }
         return false;
       }
     case 2054:
       {
         final CharacterCreationResultMessage msg = (CharacterCreationResultMessage) message;
         NetCharacterCreationFrame.m_logger.info(
             (Object)
                 ("R\u00e9sultat de la cr\u00e9ation de perso : succes="
                     + msg.isCreationSuccessful()
                     + ", code="
                     + msg.getCreationCode()));
         if (msg.isCreationSuccessful()) {
           WakfuProgressMonitorManager.getInstance()
               .getProgressMonitor(true)
               .beginTask(WakfuTranslator.getInstance().getString("loadingWorld.progress"), 0);
         } else {
           WakfuProgressMonitorManager.getInstance().done();
           displayNameError(msg.getCreationCode());
           CharacterCreationDialogActions.setCreateCharacterFlag(false);
         }
         return false;
       }
     default:
       {
         return true;
       }
   }
 }
 @Override
 public void onCreation(final ChatViewManager manager) {
   final int idPrivate = ChatWindowManager.getInstance().getModeratorWindowId();
   final GameDateConst tmp = BaseGameDateProvider.INSTANCE.getDate();
   final String time = "[" + tmp.getHours() + ':' + tmp.getMinutes() + "] ";
   final TextWidgetFormater msg = new TextWidgetFormater();
   msg.openText();
   msg.addColor(new Color(0.84f, 0.27f, 0.29f, 1.0f));
   msg.append(time);
   msg.b().u();
   msg.addId("characterName_" + this.m_sourceId);
   msg.append(this.m_sourceName);
   msg._u()._b();
   msg.append(WakfuTranslator.getInstance().getString("colon")).append(this.m_message);
   msg.closeText();
   final ChatMessage chatMessage = new ChatMessage(msg.finishAndToString());
   chatMessage.setPipeDestination(3);
   chatMessage.setWindowId(idPrivate);
   ChatManager.getInstance().pushMessage(chatMessage);
 }
 @Override
 public boolean onMessage(final Message message) {
   switch (message.getId()) {
     case 19070:
       {
         this.askToCloseRequest();
         return false;
       }
     case 19071:
       {
         final AbstractUIMessage msg = (AbstractUIMessage) message;
         final byte closedReason = msg.getByteValue();
         final int idPrivate = ChatWindowManager.getInstance().getModeratorWindowId();
         String translatorKey = "contactModerator.closed";
         switch (closedReason) {
           case 4:
             {
               translatorKey = "contactModerator.closed";
               break;
             }
           case 5:
             {
               translatorKey = "contactModerator.disconnected";
               break;
             }
         }
         final ChatMessage chatMessage =
             new ChatMessage(WakfuTranslator.getInstance().getString(translatorKey));
         chatMessage.setPipeDestination(3);
         chatMessage.setWindowId(idPrivate);
         ChatManager.getInstance().pushMessage(chatMessage);
         return this.m_isRunning = false;
       }
     default:
       {
         return true;
       }
   }
 }
 @Override
 public void onCloseEvent() {
   if (SWFWrapper.INSTANCE.isOpened()) {
     SWFWrapper.INSTANCE.unload();
     return;
   }
   final MessageBoxControler messageBoxControler =
       Xulor.getInstance()
           .msgBox(
               WakfuTranslator.getInstance().getString("question.quit"),
               WakfuMessageBoxConstants.getMessageBoxIconUrl(0),
               2073L,
               102,
               1);
   messageBoxControler.addEventListener(
       new MessageBoxEventListener() {
         @Override
         public void messageBoxClosed(final int type, final String userEntry) {
           if (type == 8) {
             WakfuApplicationUI.this.onCloseEvent();
           }
         }
       });
 }
 @Override
 public String getName() {
   return WakfuTranslator.getInstance().getString("contentLoader.ground");
 }
 @Override
 public String getName() {
   return WakfuTranslator.getInstance().getString("contentLoader.interactiveElement");
 }