1
2
3
4
5
6 package hoplugins.conv;
7
8 import plugins.IHOMiniModel;
9
10 import java.io.File;
11
12 import java.util.Properties;
13
14 import javax.swing.ImageIcon;
15 import javax.swing.JOptionPane;
16
17
18 /***
19 * DOCUMENT ME!
20 *
21 * @author Thorsten Dietz
22 */
23 public final class RSC {
24
25
26 /*** TODO Missing Parameter Documentation */
27 protected static IHOMiniModel MINIMODEL = null;
28
29 /*** TODO Missing Parameter Documentation */
30 protected static final byte TYPE_BUDDY = 0;
31
32 /*** TODO Missing Parameter Documentation */
33 protected static final byte TYPE_HAM = 1;
34
35 /*** TODO Missing Parameter Documentation */
36 protected static final byte TYPE_HTFOREVER = 2;
37
38 /*** TODO Missing Parameter Documentation */
39 protected static final byte TYPE_HTCOACH = 3;
40 private static Properties properties = null;
41
42 /*** TODO Missing Parameter Documentation */
43 public static String NAME = "Converter";
44
45 /*** TODO Missing Parameter Documentation */
46 public static String BUDDY_TO_HRF = "Tools => hrf";
47
48 /*** TODO Missing Parameter Documentation */
49 public static String DB_TO_HRF = "DB => hrf";
50
51 /*** TODO Missing Parameter Documentation */
52 protected static String[] BUDDY_EXTENSION = new String[]{
53 ".arenaDetails.xml", ".club.xml", ".economy.xml",
54 ".players.xml", ".teamDetails.xml",
55 ".training.xml"
56 };
57
58 /*** TODO Missing Parameter Documentation */
59 protected static String[] HTFOREVER_EXTENSION = new String[]{
60 " ArenaDetails.xml", " Club.xml",
61 " Economy.xml", " Players.xml",
62 " TeamDetails.xml", " Training.xml",
63 " WorldDetails.xml", " RegionDetails.xml",
64 " LeagueDetails.xml"
65 };
66
67 /*** TODO Missing Parameter Documentation */
68 protected static String[] HTCOACH_EXTENSION = new String[]{
69 "arenadetails", "clubdetails",
70 "economydetails", "playerdetails",
71 "teamdetails", "trainingdetails",
72 "matchorders", "worlddetails"
73 };
74
75 /*** TODO Missing Parameter Documentation */
76 protected static String HOPLUGINS_DIRECTORY = System.getProperty("user.dir") + File.separator
77 + "hoplugins";
78
79 /*** TODO Missing Parameter Documentation */
80 protected static String ACT_CANCEL = "CANCEL";
81
82 /*** TODO Missing Parameter Documentation */
83 protected static String PROP_ADD = null;
84
85 /*** TODO Missing Parameter Documentation */
86 protected static String PROP_CANCEL = null;
87
88 /*** TODO Missing Parameter Documentation */
89 protected static String PROP_ERROR = null;
90
91 /*** TODO Missing Parameter Documentation */
92 public static String PROP_FILE = null;
93
94 /*** TODO Missing Parameter Documentation */
95 protected static String PROP_DEFAULT_ERROR_MESSAGE = null;
96
97 /*** TODO Missing Parameter Documentation */
98 protected static String PROP_NO_SERVER = null;
99
100 /*** TODO Missing Parameter Documentation */
101 protected static String PROP_FILE_NOT_FOUND = null;
102
103 /*** TODO Missing Parameter Documentation */
104 protected static String PROP_NAME = null;
105
106 /*** TODO Missing Parameter Documentation */
107 public static String PROP_PLAYERS = null;
108
109 /*** TODO Missing Parameter Documentation */
110 protected static final String DEFAULT = "0";
111
112 /*** TODO Missing Parameter Documentation */
113 protected static ImageIcon ICON_UP = null;
114
115 /*** TODO Missing Parameter Documentation */
116 protected static ImageIcon ICON_DOWN = null;
117
118 /*** TODO Missing Parameter Documentation */
119 protected static ImageIcon ICON_ADD = null;
120
121 /*** TODO Missing Parameter Documentation */
122 protected static ImageIcon ICON_DELETE = null;
123
124 /*** TODO Missing Parameter Documentation */
125 protected static CColumn[] playerColumns = null;
126
127 /*** TODO Missing Parameter Documentation */
128 protected static final int PLAYER_ID = 0;
129
130 /*** TODO Missing Parameter Documentation */
131 protected static final int PLAYER_NAME = 1;
132
133 /*** TODO Missing Parameter Documentation */
134 protected static final int PLAYER_AGE = 2;
135
136 /*** TODO Missing Parameter Documentation */
137 protected static final int PLAYER_SALARY = 3;
138
139 /*** TODO Missing Parameter Documentation */
140 protected static final int PLAYER_VERLETZT = 4;
141
142 /*** TODO Missing Parameter Documentation */
143 protected static final int PLAYER_LEADERSHIP = 5;
144
145 /*** TODO Missing Parameter Documentation */
146 protected static final int PLAYER_EXPERIENCE = 6;
147
148 /*** TODO Missing Parameter Documentation */
149 protected static final int PLAYER_FORM = 7;
150
151 /*** TODO Missing Parameter Documentation */
152 protected static final int PLAYER_STAMINA = 8;
153
154 /*** TODO Missing Parameter Documentation */
155 protected static final int PLAYER_KEEPER = 9;
156
157 /*** TODO Missing Parameter Documentation */
158 protected static final int PLAYER_DEFENCE = 10;
159
160 /*** TODO Missing Parameter Documentation */
161 protected static final int PLAYER_WING = 11;
162
163 /*** TODO Missing Parameter Documentation */
164 protected static final int PLAYER_PLAYMAKING = 12;
165
166 /*** TODO Missing Parameter Documentation */
167 protected static final int PLAYER_PASSING = 13;
168
169 /*** TODO Missing Parameter Documentation */
170 protected static final int PLAYER_SCORING = 14;
171
172 /*** TODO Missing Parameter Documentation */
173 protected static final int PLAYER_SETPIECES = 15;
174
175 /*** TODO Missing Parameter Documentation */
176 protected static final int PLAYER_GENTLESS = 16;
177
178 /*** TODO Missing Parameter Documentation */
179 protected static final int PLAYER_CHARACTER = 17;
180
181 /*** TODO Missing Parameter Documentation */
182 protected static final int PLAYER_SPECIAL = 18;
183
184 /*** TODO Missing Parameter Documentation */
185 protected static final int PLAYER_NOTE = 19;
186
187 /*** TODO Missing Parameter Documentation */
188 protected static final int PLAYER_NATIONALITY = 20;
189
190 /*** TODO Missing Parameter Documentation */
191 protected static final String[][] clubValueDefault = new String[][]{
192 {"[club]", ""},
193 {"mvTranare=", RSC.DEFAULT},
194 {"hjTranare=", DEFAULT},
195 {"psykolog=", DEFAULT},
196 {"presstalesman=", DEFAULT},
197 {"ekonom=", DEFAULT},
198 {"massor=", DEFAULT},
199 {"lakare=", DEFAULT},
200 {"juniorverksamhet=", DEFAULT},
201 {"undefeated=", DEFAULT},
202 {"victories=", DEFAULT},
203 {"fanclub=", DEFAULT}
204 };
205
206 /*** TODO Missing Parameter Documentation */
207 protected static final String[][] basicsValueDefault = new String[][]{
208 {"[basics]", ""},
209 {"application=", "HO"},
210 {"appversion=", ""},
211 {"date=", DEFAULT},
212 {"season=", DEFAULT},
213 {"matchround=", DEFAULT},
214 {"teamID=", DEFAULT},
215 {"teamName=", ""},
216 {"owner=", ""},
217 {"ownerEmail=", ""},
218 {"ownerICQ=", ""},
219 {"ownerHomepage=", ""},
220 {"countryID=", ""},
221 {"leagueID=", DEFAULT}
222 };
223
224 /*** TODO Missing Parameter Documentation */
225 protected static final String[][] arenaValueDefault = new String[][]{
226 {"[arena]", ""},
227 {"arenaname=", DEFAULT},
228 {"antalStaplats=", DEFAULT},
229 {"antalSitt=", DEFAULT},
230 {"antalTak=", DEFAULT},
231 {"antalVIP=", RSC.DEFAULT},
232 {"seatTotal=", DEFAULT},
233 {"expandingStaplats=", DEFAULT},
234 {"expandingSitt=", DEFAULT},
235 {"expandingTak=", DEFAULT},
236 {"expandingVIP=", DEFAULT},
237 {"expandingSseatTotal=", DEFAULT},
238 {"isExpanding=", DEFAULT},
239 {"ExpansionDate=", DEFAULT}
240 };
241
242 /*** TODO Missing Parameter Documentation */
243 protected static final String[][] teamValueDefault = new String[][]{
244 {"[team]", ""},
245 {"trLevel=", DEFAULT},
246 {"trTypeValue=", DEFAULT},
247 {"trType=", DEFAULT},
248 {"stamningValue=", DEFAULT},
249 {"stamning=", DEFAULT},
250 {"sjalvfortroendeValue=", DEFAULT},
251 {"sjalvfortroende=", DEFAULT},
252 {"exper433=", DEFAULT},
253 {"exper451=", DEFAULT},
254 {"exper352=", DEFAULT},
255 {"exper532=", DEFAULT},
256 {"exper343=", DEFAULT},
257 {"exper541=", DEFAULT},
258 };
259
260 /*** TODO Missing Parameter Documentation */
261 protected static final String[][] leagueValueDefault = new String[][]{
262 {"[league]", ""},
263 {"serie=", DEFAULT},
264 {"spelade=", DEFAULT},
265 {"gjorda=", DEFAULT},
266 {"inslappta=", DEFAULT},
267 {"poang=", DEFAULT},
268 {"placering=", DEFAULT},
269 };
270
271 /*** TODO Missing Parameter Documentation */
272 protected static final String[][] linupValueDefault = new String[][]{
273 {"[lineup]", ""},
274 {"trainer=", DEFAULT},
275 {"installning=", DEFAULT},
276 {"tactictype=", DEFAULT},
277 {"keeper=", DEFAULT},
278 {"rightBack=", DEFAULT},
279 {"insideBack1=", DEFAULT},
280 {"insideBack2=", DEFAULT},
281 {"leftBack=", DEFAULT},
282 {"rightWinger=", DEFAULT},
283 {"insideMid1=", DEFAULT},
284 {"insideMid2=", DEFAULT},
285 {"leftWinger=", DEFAULT},
286 {"forward1=", DEFAULT},
287 {"forward2=", DEFAULT},
288 {"substBack=", DEFAULT},
289 {"substInsideMid=", DEFAULT},
290 {"substWinger=", DEFAULT},
291 {"substKeeper=", DEFAULT},
292 {"substForward=", DEFAULT},
293 {"captain=", DEFAULT},
294 {"kicker1=", DEFAULT},
295 {"behRightBack=", DEFAULT},
296 {"behInsideBack1=", DEFAULT},
297 {"behInsideBack2=", DEFAULT},
298 {"behLeftBack=", DEFAULT},
299 {"behRightWinger=", DEFAULT},
300 {"behInsideMid1=", DEFAULT},
301 {"behInsideMid2=", DEFAULT},
302 {"behLeftWinger=", DEFAULT},
303 {"behForward1=", DEFAULT},
304 {"behForward2=", DEFAULT}
305 };
306
307 /*** TODO Missing Parameter Documentation */
308 protected static final String[][] lastlinupValueDefault = new String[][]{
309 {"[lastlineup]", ""},
310 {"trainer=", DEFAULT},
311 {"installning=", DEFAULT},
312 {"tactictype=", DEFAULT},
313 {"keeper=", DEFAULT},
314 {"rightBack=", DEFAULT},
315 {"insideBack1=", DEFAULT},
316 {"insideBack2=", DEFAULT},
317 {"leftBack=", DEFAULT},
318 {"rightWinger=", DEFAULT},
319 {"insideMid1=", DEFAULT},
320 {"insideMid2=", DEFAULT},
321 {"leftWinger=", DEFAULT},
322 {"forward1=", DEFAULT},
323 {"forward2=", DEFAULT},
324 {"substBack=", DEFAULT},
325 {"substInsideMid=", DEFAULT},
326 {"substWinger=", DEFAULT},
327 {"substKeeper=", DEFAULT},
328 {"substForward=", DEFAULT},
329 {"captain=", DEFAULT},
330 {"kicker1=", DEFAULT},
331 {"behRightBack=", DEFAULT},
332 {"behInsideBack1=", DEFAULT},
333 {"behInsideBack2=", DEFAULT},
334 {"behLeftBack=", DEFAULT},
335 {"behRightWinger=", DEFAULT},
336 {"behInsideMid1=", DEFAULT},
337 {"behInsideMid2=", DEFAULT},
338 {"behLeftWinger=", DEFAULT},
339 {"behForward1=", DEFAULT},
340 {"behForward2=", DEFAULT}
341 };
342
343 /*** TODO Missing Parameter Documentation */
344 protected static final String[][] xtraValueDefault = new String[][]{
345 {"[xtra]", ""},
346 {"TrainingDate=", DEFAULT},
347 {"EconomyDate=", DEFAULT},
348 {"SeriesMatchDate=", DEFAULT},
349 {"CurrencyName=", ""},
350 {"CurrencyRate=", DEFAULT},
351 {"LogoURL=", ""},
352 {"HasPromoted=", ""},
353 {"TrainerID=", DEFAULT},
354 {"TrainerName=", ""},
355 {"ArrivalDate=", DEFAULT},
356 {"LeagueLevelUnitID=", DEFAULT}
357 };
358
359 /*** TODO Missing Parameter Documentation */
360 protected static final String[][] economyValue = new String[][]{
361 {"[economy]", ""},
362 {"supporters=", DEFAULT},
363 {"sponsors=", DEFAULT},
364 {"cash=", DEFAULT},
365 {"IncomeSponsorer=", DEFAULT},
366 {"incomePublik=", DEFAULT},
367 {"incomeFinansiella=", DEFAULT},
368 {"incomeTillfalliga=", DEFAULT},
369 {"incomeSumma=", DEFAULT},
370 {"costsSpelare=", DEFAULT},
371 {"costsPersonal=", DEFAULT},
372 {"costsArena=", DEFAULT},
373 {"costsJuniorverksamhet=", DEFAULT},
374 {"costsRantor=", DEFAULT},
375 {"costsTillfalliga=", DEFAULT},
376 {"costsSumma=", DEFAULT},
377 {"total=", DEFAULT},
378 {"lastIncomeSponsorer=", DEFAULT},
379 {"lastIncomePublik=", DEFAULT},
380 {"lastIncomeFinansiella=", DEFAULT},
381 {"lastIncomeTillfalliga=", DEFAULT},
382 {"lastIncomeSumma=", DEFAULT},
383 {"lastCostsSpelare=", DEFAULT},
384 {"lastCostsPersonal=", DEFAULT},
385 {"lastCostsArena=", DEFAULT},
386 {"lastCostsJuniorverksamhet=", DEFAULT},
387 {"lastCostsRantor=", DEFAULT},
388 {"lastCostsTillfalliga=", DEFAULT},
389 {"lastCostsSumma=", DEFAULT},
390 {"lastTotal=", DEFAULT}
391 };
392
393 /*** TODO Missing Parameter Documentation */
394 protected static final String[] TEAM = new String[]{
395 "No-Team.png", "A-Team.png", "B-Team.png",
396 "C-Team.png", "D-Team.png", "E-Team.png"
397 };
398
399
400
401 /***
402 * TODO Missing Method Documentation
403 *
404 * @param key TODO Missing Method Parameter Documentation
405 *
406 * @return TODO Missing Return Method Documentation
407 */
408 public static String getProperty(String key) {
409 return properties.getProperty(key);
410 }
411
412 /***
413 * TODO Missing Method Documentation
414 *
415 * @param miniModel TODO Missing Method Parameter Documentation
416 */
417 public static void initializeStrings(IHOMiniModel miniModel) {
418 MINIMODEL = miniModel;
419 PROP_FILE = MINIMODEL.getResource().getProperty("Datei");
420 PROP_ADD = MINIMODEL.getResource().getProperty("Speichern");
421 PROP_CANCEL = MINIMODEL.getResource().getProperty("Abbrechen");
422 PROP_ERROR = MINIMODEL.getResource().getProperty("Fehler");
423 PROP_DEFAULT_ERROR_MESSAGE = "see pluginUpdaterErr.log for details";
424 PROP_NO_SERVER = MINIMODEL.getResource().getProperty("KeinServer");
425 PROP_FILE_NOT_FOUND = MINIMODEL.getResource().getProperty("DateiNichtGefunden");
426 PROP_NAME = MINIMODEL.getResource().getProperty("Name");
427 PROP_PLAYERS = MINIMODEL.getResource().getProperty("Spieleruebersicht");
428 ICON_UP = new javax.swing.ImageIcon(MINIMODEL.getHelper().makeColorTransparent(MINIMODEL.getHelper()
429 .loadImage("gui/bilder/Taktik_Defensiv.png"),
430 210, 210,
431 185, 255,
432 255, 255));
433 ICON_DOWN = new javax.swing.ImageIcon(MINIMODEL.getHelper().makeColorTransparent(MINIMODEL.getHelper()
434 .loadImage("gui/bilder/Taktik_Offensiv.png"),
435 210, 210,
436 185, 255,
437 255, 255));
438 ICON_ADD = new javax.swing.ImageIcon(MINIMODEL.getHelper().makeColorTransparent(MINIMODEL.getHelper()
439 .loadImage("gui/bilder/verletzt.gif"),
440 210, 210,
441 185, 255,
442 255, 255));
443 ICON_DELETE = new javax.swing.ImageIcon(MINIMODEL.getHelper().makeColorTransparent(MINIMODEL.getHelper()
444 .loadImage("gui/bilder/Reload.png"),
445 210,
446 210,
447 185,
448 255,
449 255, 255));
450 initRessourcen();
451 initPlayerColumns();
452 }
453
454 /***
455 * TODO Missing Method Documentation
456 *
457 * @param f TODO Missing Method Parameter Documentation
458 *
459 * @return TODO Missing Return Method Documentation
460 */
461 protected static final boolean isBuddyFile(File f) {
462 if (f.getName().endsWith(RSC.BUDDY_EXTENSION[1].substring(1, RSC.BUDDY_EXTENSION[1].length()))) {
463 return true;
464 }
465
466 return false;
467 }
468
469 /***
470 * TODO Missing Method Documentation
471 *
472 * @param f TODO Missing Method Parameter Documentation
473 *
474 * @return TODO Missing Return Method Documentation
475 */
476 protected static final boolean isHAMFile(File f) {
477 if (f.getName().startsWith("HAM") && f.getName().endsWith(".xml")) {
478 return true;
479 }
480
481 return false;
482 }
483
484 /***
485 * TODO Missing Method Documentation
486 *
487 * @param f TODO Missing Method Parameter Documentation
488 *
489 * @return TODO Missing Return Method Documentation
490 */
491 protected static final boolean isHTCoachFile(File f) {
492 String name = f.getName();
493
494 for (int i = 0; i < RSC.HTCOACH_EXTENSION.length; i++) {
495 if (name.startsWith(RSC.HTCOACH_EXTENSION[i]) && !f.isDirectory()) {
496 return true;
497 }
498 }
499
500 return false;
501 }
502
503 /***
504 * TODO Missing Method Documentation
505 *
506 * @param f TODO Missing Method Parameter Documentation
507 *
508 * @return TODO Missing Return Method Documentation
509 */
510 protected static final boolean isHTForverFile(File f) {
511 if (f.getName().endsWith(RSC.HTFOREVER_EXTENSION[1].substring(1,
512 RSC.HTFOREVER_EXTENSION[1]
513 .length()))) {
514 return true;
515 }
516
517 return false;
518 }
519
520 /***
521 * TODO Missing Method Documentation
522 *
523 * @param e TODO Missing Method Parameter Documentation
524 * @param txt TODO Missing Method Parameter Documentation
525 */
526 protected static void handleException(Exception e, String txt) {
527 if (e != null) {
528 JOptionPane.showMessageDialog(null, e.getMessage(), RSC.NAME, JOptionPane.ERROR_MESSAGE);
529 } else {
530 JOptionPane.showMessageDialog(null, txt, RSC.NAME, JOptionPane.ERROR_MESSAGE);
531 }
532 }
533
534 /***
535 * TODO Missing Method Documentation
536 */
537 protected static void initPlayerColumns() {
538 playerColumns = new CColumn[20];
539 playerColumns[0] = new CColumn(PLAYER_ID,
540 MINIMODEL.getResource().getProperty("Spieler")
541 + MINIMODEL.getResource().getProperty("ID"));
542 playerColumns[1] = new CColumn(PLAYER_NAME, PROP_NAME);
543 playerColumns[2] = new CColumn(PLAYER_AGE,
544 MINIMODEL.getResource().getProperty("FaktorSpieleralter"));
545 playerColumns[3] = new CColumn(PLAYER_SALARY, MINIMODEL.getResource().getProperty("Gehalt"));
546 playerColumns[4] = new CColumn(PLAYER_VERLETZT,
547 MINIMODEL.getResource().getProperty("Verletzt"));
548
549 playerColumns[5] = new CColumn(PLAYER_LEADERSHIP,
550 MINIMODEL.getResource().getProperty("Fuehrung"));
551 playerColumns[6] = new CColumn(PLAYER_EXPERIENCE,
552 MINIMODEL.getResource().getProperty("Erfahrung"));
553 playerColumns[7] = new CColumn(PLAYER_FORM, MINIMODEL.getResource().getProperty("Form"));
554 playerColumns[8] = new CColumn(PLAYER_STAMINA,
555 MINIMODEL.getResource().getProperty("Kondition"));
556 playerColumns[9] = new CColumn(PLAYER_KEEPER, MINIMODEL.getResource().getProperty("Torwart"));
557
558 playerColumns[10] = new CColumn(PLAYER_DEFENCE,
559 MINIMODEL.getResource().getProperty("Verteidigung"));
560 playerColumns[11] = new CColumn(PLAYER_WING,
561 MINIMODEL.getResource().getProperty("Fluegelspiel"));
562 playerColumns[12] = new CColumn(PLAYER_PLAYMAKING,
563 MINIMODEL.getResource().getProperty("Spielaufbau"));
564 playerColumns[13] = new CColumn(PLAYER_PASSING,
565 MINIMODEL.getResource().getProperty("Passpiel"));
566 playerColumns[14] = new CColumn(PLAYER_SCORING,
567 MINIMODEL.getResource().getProperty("Torschuss"));
568
569 playerColumns[15] = new CColumn(PLAYER_GENTLESS,
570 MINIMODEL.getResource().getProperty("Ansehen"));
571 playerColumns[16] = new CColumn(PLAYER_CHARACTER,
572 MINIMODEL.getResource().getProperty("Charakter"));
573 playerColumns[17] = new CColumn(PLAYER_SPECIAL,
574 MINIMODEL.getResource().getProperty("Spezialitaet"));
575 playerColumns[18] = new CColumn(PLAYER_GENTLESS,
576 MINIMODEL.getResource().getProperty("Notizen"));
577 playerColumns[19] = new CColumn(PLAYER_CHARACTER,
578 MINIMODEL.getResource().getProperty("Nationalitaet"));
579 }
580
581 /***
582 * TODO Missing Method Documentation
583 */
584 private static void initRessourcen() {
585 properties = new java.util.Properties();
586
587
588
589 File languagefile = new File("hoPlugins/conv/Sprache/"
590 + MINIMODEL.getHelper().getLanguageName() + ".properties");
591
592 if (!languagefile.exists()) {
593 languagefile = new File("hoPlugins/conv/Sprache/English.properties");
594 }
595
596 if (languagefile.exists()) {
597 java.util.Properties props = new java.util.Properties();
598
599 try {
600 props.load(new java.io.FileInputStream(languagefile));
601 properties.putAll(props);
602 } catch (java.io.IOException e) {
603 }
604 }
605 }
606 }