1 package cz.cuni.amis.pogamut.ut3.communication.messages;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 import cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId;
20 import cz.cuni.amis.pogamut.ut2004.communication.messages.ItemType;
21 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Self;
22 import cz.cuni.amis.utils.maps.HashMapSet;
23
24 import java.util.HashMap;
25 import java.util.Iterator;
26 import java.util.Map;
27 import java.util.Set;
28
29
30
31
32
33 public class UT3ItemType extends ItemType {
34
35
36
37
38 private static final long serialVersionUID = 6128208226173615461L;
39
40
41
42
43 protected static Map<String, ItemType> protos = new HashMap<String, ItemType>();
44
45
46
47
48 public static final HashMapSet<UT3Group, ItemType> GROUPS = new HashMapSet<UT3Group, ItemType>();
49
50
51
52
53 private Category category;
54
55
56
57
58 private UT3Group group;
59
60
61
62
63 private String name;
64
65 public static UT3ItemType getWeaponForAmmo(ItemType itemType) {
66 if (itemType == null)
67 return UT3ItemType.NONE;
68 Set<ItemType> mySet = GROUPS.get(itemType.getGroup());
69 if (mySet != null) {
70 Iterator<ItemType> myIterator = mySet.iterator();
71 while (myIterator.hasNext()) {
72 ItemType type = myIterator.next();
73 if (type.getGroup() == itemType.getGroup()
74 && type.getCategory() == Category.WEAPON)
75 return (UT3ItemType) type;
76 }
77 }
78
79 return UT3ItemType.NONE;
80 }
81
82 public static UT3ItemType getAmmoForWeapon(ItemType itemType) {
83 if (itemType == null)
84 return UT3ItemType.NONE;
85 Set<ItemType> mySet = GROUPS.get(itemType.getGroup());
86 if (mySet != null) {
87 Iterator<ItemType> myIterator = mySet.iterator();
88 while (myIterator.hasNext()) {
89 ItemType type = myIterator.next();
90 if (type.getGroup() == itemType.getGroup()
91 && type.getCategory() == Category.AMMO)
92 return (UT3ItemType) type;
93 }
94 }
95
96 return UT3ItemType.NONE;
97 }
98
99 @Override
100 public String toString() {
101 return "ItemType[name = " + name + ", category = " + category
102 + ", group = " + group + "]";
103 }
104
105 @Override
106 public Category getCategory() {
107 return category;
108 }
109
110 @Override
111 public UT3Group getGroup() {
112 return group;
113 }
114
115 @Override
116 public boolean equals(Object obj) {
117
118 if (this == obj)
119 return true;
120
121
122 if (obj instanceof UT3ItemType) {
123
124 if ((category == ((UT3ItemType) obj).getCategory())
125 && (group == ((UT3ItemType) obj).getGroup())
126 && (name == ((UT3ItemType) obj).getName()))
127 return true;
128 }
129
130 return false;
131 }
132
133 @Override
134 public int hashCode() {
135 return getName().hashCode();
136 }
137
138 @Override
139 public int compareTo(ItemType o) {
140 if (o == null)
141 return 1;
142
143 if (getName() == null) {
144 if (o.getName() == null)
145 return 0;
146 return 1;
147 } else {
148 if (o.getName() == null)
149 return -1;
150 return getName().compareTo(o.getName());
151 }
152 }
153
154
155
156
157
158
159
160 public enum UT3Group implements Group {
161
162 TRANSLOCATOR("Translocator"),
163
164 IMPACT_HAMMER("ImpactHammer"),
165
166 ENFORCER("Enforcer"),
167
168 BIO_RIFLE("BioRifle"),
169
170 SHOCK_RIFLE("ShockRifle"),
171
172 LINK_GUN("LinkGun"),
173
174 STINGER_MINIGUN("Stinger"),
175
176 FLAK_CANNON("FlakCannon"),
177
178 ROCKET_LAUNCHER("RocketLauncher"),
179
180 AVRIL("Avril"),
181
182 SNIPER_RIFLE("SniperRifle"),
183
184 REDEEMER("Redeemer"),
185
186 WEAPON_LOCKER("WeaponLocker"),
187
188 SLOW_FIELD("SlowField"),
189
190
191 MEDIUM_HEALTH("MediumHealth"),
192
193 HEALTH_VIAL("HealthVial"),
194
195 SUPER_HEALTH("SuperHealth"),
196
197
198 ARMOR_HELMET("Helmet"), ARMOR_VEST("Vest"), ARMOR_THIGHPADS("Thighpads"), ARMOR_SHIELD_BELT(
199 "ShieldBelt"),
200
201
202 JUMP_BOOTS("JumpBoots"),
203
204 UDAMAGE("UDamage"), BERSERK("Berserk"), INVULNERABILITY(
205 "Invulnerability"), INVISIBILITY("Invisibility"),
206
207
208 KEY("Key"),
209
210 OTHER("Unknown"),
211
212 XRAY_VOLUME("XRayVolume"), SPIDERMINE_TRAP("SpiderMineTrap"), ENERGY_SHIELD(
213 "EnergyShield"), EMP_MINE("EMPMine"), LINK_GENERATOR(
214 "LinkGenerator"), SHAPED_CHARGE("ShapedCharge"), SLOW_VOLUME(
215 "SlowVolume"),
216
217
218 NONE("None");
219
220
221
222
223 public String name;
224
225
226
227
228
229
230
231
232
233 UT3Group(String name) {
234 this.name = name;
235 }
236
237 @Override
238 public Set<ItemType> getTypes() {
239 return GROUPS.get(this);
240 }
241
242 @Override
243 public String getName() {
244 return this.name;
245 }
246 }
247
248
249
250
251
252
253
254
255
256
257
258 public static final UT3ItemType TRANSLOCATOR = MakePrototype(
259 Category.WEAPON, UT3Group.TRANSLOCATOR, new String[] {"UTGame.UTWeap_Translocator_Content",
260 "Translocator", "Translocator.WeaponPickup" });
261
262
263 public static final UT3ItemType TRANSLOCATOR_PROJECTILE = MakePrototype(
264 Category.PROJECTILE, UT3Group.TRANSLOCATOR, new String[] {
265 "UTProj_TransDisc", "UT_Proj_TransDisc_ContentBlue",
266 "UT_Proj_TransDisc_ContentRed" });
267
268
269 public static final UT3ItemType IMPACT_HAMMER = MakePrototype(
270 Category.WEAPON, UT3Group.IMPACT_HAMMER, new String[] { "UTGame.UTWeap_ImpactHammer",
271 "ImpactHammer", "ImpactHammer.WeaponPickup" });
272
273
274 public static final UT3ItemType IMPACT_HAMMER_AMMO = MakePrototype(
275 Category.AMMO, UT3Group.IMPACT_HAMMER, new String[] {
276 "ImpactHammerAmmo", "ImpactHammerAmmo.AmmoPickup" });
277
278
279 public static final UT3ItemType ENFORCER = MakePrototype(Category.WEAPON,
280 UT3Group.ENFORCER, new String[] { "UTGame.UTWeap_Enforcer", "Enforcer",
281 "Enforcer.WeaponPickup" });
282
283 public static final UT3ItemType ENFORCER_AMMO = MakePrototype(
284 Category.AMMO, UT3Group.ENFORCER, new String[] { "GameBotsUT3.GBAmmo_Enforcer", "EnforcerAmmo",
285 "EnforcerAmmo.AmmoPickup" });
286
287
288 public static final UT3ItemType BIO_RIFLE = MakePrototype(Category.WEAPON,
289 UT3Group.BIO_RIFLE, new String[] { "UTGameContent.UTWeap_BioRifle_Content", "BioRifle",
290 "BioRifle.WeaponPickup" });
291
292 public static final UT3ItemType BIO_RIFLE_AMMO = MakePrototype(
293 Category.AMMO, UT3Group.BIO_RIFLE, new String[] { "GameBotsUT3.GBAmmo_BioRifle_Content", "BioRifleAmmo",
294 "BioRifleAmmo.AmmoPickup" });
295
296
297 public static final UT3ItemType BIO_RIFLE_PROJECTILE = MakePrototype(
298 Category.PROJECTILE, UT3Group.BIO_RIFLE, new String[] {
299 "UTProj_BioShot", "UTProj_BioGlob", "UTProj_BioGlobling" });
300
301
302 public static final UT3ItemType SHOCK_RIFLE = MakePrototype(
303 Category.WEAPON, UT3Group.SHOCK_RIFLE, new String[] { "UTGame.UTWeap_ShockRifle", "ShockRifle",
304 "ShockRifle.WeaponPickup" });
305
306 public static final UT3ItemType SHOCK_RIFLE_AMMO = MakePrototype(
307 Category.AMMO, UT3Group.SHOCK_RIFLE, new String[] { "GameBotsUT3.GBAmmo_ShockRifle",
308 "ShockRifleAmmo", "ShockRifleAmmo.AmmoPickup" });
309
310
311 public static final UT3ItemType SHOCK_RIFLE_PROJECTILE = MakePrototype(
312 Category.PROJECTILE, UT3Group.SHOCK_RIFLE, new String[] {
313 "UTProj_ShockBall", "UTProj_HeroShockBall" });
314
315
316 public static final UT3ItemType LINK_GUN = MakePrototype(Category.WEAPON,
317 UT3Group.LINK_GUN, new String[] { "UTGame.UTWeap_LinkGun", "LinkGun",
318 "LinkGun.WeaponPickup" });
319
320 public static final UT3ItemType LINK_GUN_AMMO = MakePrototype(
321 Category.AMMO, UT3Group.LINK_GUN, new String[] { "GameBotsUT3.GBAmmo_LinkGun", "LinkGunAmmo",
322 "LinkGunAmmo.AmmoPickup" });
323
324
325 public static final UT3ItemType LINK_GUN_PROJECTILE = MakePrototype(
326 Category.PROJECTILE, UT3Group.LINK_GUN,
327 new String[] { "XWeapons.LinkProjectile" });
328
329
330 public static final UT3ItemType STINGER_MINIGUN = MakePrototype(
331 Category.WEAPON, UT3Group.STINGER_MINIGUN, new String[] { "UTGame.UTWeap_Stinger",
332 "Stinger", "Stinger.WeaponPickup" });
333
334 public static final UT3ItemType STINGER_MINIGUN_AMMO = MakePrototype(
335 Category.AMMO, UT3Group.STINGER_MINIGUN, new String[] { "GameBotsUT3.GBAmmo_Stinger",
336 "StingerAmmo", "StingerAmmo.AmmoPickup" });
337
338 public static final UT3ItemType STINGER_MINIGUN_SHARD = MakePrototype(
339 Category.PROJECTILE, UT3Group.STINGER_MINIGUN,
340 new String[] { "UTProj_StingerShard" });
341
342
343 public static final UT3ItemType FLAK_CANNON = MakePrototype(
344 Category.WEAPON, UT3Group.FLAK_CANNON, new String[] { "UTGame.UTWeap_FlakCannon", "FlakCannon",
345 "FlakCannon.WeaponPickup" });
346
347 public static final UT3ItemType FLAK_CANNON_AMMO = MakePrototype(
348 Category.AMMO, UT3Group.FLAK_CANNON, new String[] { "GameBotsUT3.GBAmmo_FlakCannon",
349 "FlakCannonAmmo", "FlakCannonAmmo.AmmoPickup" });
350
351
352 public static final UT3ItemType FLAK_CANNON_CHUNK = MakePrototype(
353 Category.PROJECTILE, UT3Group.FLAK_CANNON, new String[] {
354 "UTProj_FlakShard", "UTProj_FlakShardMain" });
355
356
357 public static final UT3ItemType FLAK_CANNON_SHELL = MakePrototype(
358 Category.PROJECTILE, UT3Group.FLAK_CANNON,
359 new String[] { "UTProj_FlakShell" });
360
361
362 public static final UT3ItemType AVRIL = MakePrototype(Category.WEAPON,
363 UT3Group.AVRIL, new String[] { "UTGameContent.UTWeap_Avril_Content", "Avril",
364 "Avril.WeaponPickup" });
365
366 public static final UT3ItemType AVRIL_AMMO = MakePrototype(
367 Category.AMMO,
368 UT3Group.AVRIL,
369 new String[] { "GameBotsUT3.GBAmmo_AVRiL", "AVRiLAmmo",
370 "AVRiLAmmo.AmmoPickup" });
371
372
373 public static final UT3ItemType ROCKET_LAUNCHER = MakePrototype(
374 Category.WEAPON, UT3Group.ROCKET_LAUNCHER, new String[] { "UTGame.UTWeap_RocketLauncher",
375 "RocketLauncher", "RocketLauncher.WeaponPickup" });
376
377 public static final UT3ItemType ROCKET_LAUNCHER_AMMO = MakePrototype(
378 Category.AMMO, UT3Group.ROCKET_LAUNCHER, new String[] { "GameBotsUT3.RocketLauncher",
379 "RocketLauncherAmmo", "RocketLauncherAmmo.AmmoPickup" });
380
381
382 public static final UT3ItemType ROCKET_LAUNCHER_PROJECTILE = MakePrototype(
383 Category.PROJECTILE, UT3Group.ROCKET_LAUNCHER, new String[] {
384 "UTProj_Rocket", "UTProj_HeroRocket",
385 "UTProj_LoadedRocket", "UTProj_SeekingRocket" });
386
387
388 public static final UT3ItemType SNIPER_RIFLE = MakePrototype(
389 Category.WEAPON, UT3Group.SNIPER_RIFLE, new String[] { "UTGame.UTWeap_SniperRifle",
390 "SniperRifle", "SniperRifle.WeaponPickup" });
391
392 public static final UT3ItemType SNIPER_RIFLE_AMMO = MakePrototype(
393 Category.AMMO, UT3Group.SNIPER_RIFLE, new String[] { "GameBotsUT3.GBAmmo_SniperRifle",
394 "SniperRifleAmmo", "SniperRifleAmmo.AmmoPickup" });
395
396
397 public static final UT3ItemType REDEEMER = MakePrototype(Category.WEAPON,
398 UT3Group.REDEEMER, new String[] { "UTGameContent.UTWeap_Redeemer_Content", "Redeemer",
399 "Redeemer.WeaponPickup" });
400
401 public static final UT3ItemType REDEEMER_AMMO = MakePrototype(
402 Category.AMMO, UT3Group.REDEEMER, new String[] { "UTGameContent.UTAmmo_Redeemer_Content", "RedeemerAmmo",
403 "RedeemerAmmo.AmmoPickup" });
404
405 public static final UT3ItemType REDEEMER_PROJECTILE = MakePrototype(
406 Category.PROJECTILE, UT3Group.REDEEMER, new String[] {
407 "UTProj_Redeemer", "UTProj_RedeemerRed" });
408
409
410 public static final UT3ItemType MEDIUM_HEALTH = MakePrototype(
411 Category.HEALTH, UT3Group.MEDIUM_HEALTH, new String[] { "UTGame.UTPickup_MediumHealth",
412 "MediumHealth", "MediumHealth.HealthPickup" });
413
414 public static final UT3ItemType HEALTH_VIAL = MakePrototype(
415 Category.HEALTH, UT3Group.HEALTH_VIAL, new String[] { "UTGame.UTPickup_HealthVial", "HealthVial",
416 "HealthVial.HealthPickup" });
417
418 public static final UT3ItemType SUPER_HEALTH_PACK = MakePrototype(
419 Category.HEALTH, UT3Group.SUPER_HEALTH, new String[] { "UTGame.UTPickup_SuperHealth",
420 "SuperHealth", "SuperHealth.HealthPickup" });
421
422
423 public static final UT3ItemType ARMOR_HELMET = MakePrototype(
424 Category.ARMOR, UT3Group.ARMOR_HELMET, new String[] { "UTGame.UTArmorHelmet", "Helmet",
425 "Helmet.ArmorPickup" });
426
427 public static final UT3ItemType ARMOR_SHIELD_BELT = MakePrototype(
428 Category.ARMOR, UT3Group.ARMOR_SHIELD_BELT, new String[] { "UTGame.UTArmor_ShieldBelt",
429 "ShieldBelt", "ShieldBelt.ArmorPickup" });
430
431 public static final UT3ItemType ARMOR_THIGHPADS = MakePrototype(
432 Category.ARMOR, UT3Group.ARMOR_THIGHPADS, new String[] { "UTGame.UTArmor_Thighpads",
433 "Thighpads", "Thighpads.ArmorPickup" });
434
435 public static final UT3ItemType ARMOR_VEST = MakePrototype(Category.ARMOR,
436 UT3Group.ARMOR_VEST, new String[] { "UTGame.UTArmor_Vest", "Vest", "Vest.ArmorPickup" });
437
438
439 public static final UT3ItemType U_DAMAGE_PACK = MakePrototype(
440 Category.OTHER, UT3Group.UDAMAGE, new String[] { "UTGameContent.UTUDamage", "UDamage",
441 "UDamage.Pickup" });
442
443 public static final UT3ItemType BERSERK_PACK = MakePrototype(
444 Category.OTHER, UT3Group.BERSERK, new String[] { "UTGameContent.UTBerserk", "Berserk",
445 "Berserk.Pickup" });
446
447 public static final UT3ItemType JUMP_BOOTS = MakePrototype(Category.OTHER,
448 UT3Group.JUMP_BOOTS, new String[] { "UTGameContent.UTJumpBoots", "JumpBoots",
449 "JumpBoots.Pickup" });
450
451
452
453
454 public static final UT3ItemType XRAY_VOLUME = MakePrototype(
455 Category.WEAPON, UT3Group.XRAY_VOLUME, new String[] { "UT3Gold.UTDeployableXRayVolume", "UTDeployableXRayVolume",
456 "UTDeployableXRayVolume.WeaponPickup" });
457
458
459 public static final UT3ItemType XRAY_VOLUME_AMMO = MakePrototype(
460 Category.AMMO, UT3Group.XRAY_VOLUME, new String[] {
461 "UTDeployableXRayVolumeAmmo", "UTDeployableXRayVolume.AmmoPickup" });
462
463
464 public static final UT3ItemType SPIDERMINE_TRAP = MakePrototype(
465 Category.WEAPON, UT3Group.SPIDERMINE_TRAP, new String[] { "UTGameContent.UTDeployableSpiderMineTrap",
466 "UTDeployableSpiderMineTrap", "UTDeployableSpiderMineTrap.WeaponPickup" });
467
468
469 public static final UT3ItemType SPIDERMINE_TRAP_AMMO = MakePrototype(
470 Category.AMMO, UT3Group.SPIDERMINE_TRAP, new String[] {
471 "UTDeployableSpiderMineTrapAmmo", "UTDeployableSpiderMineTrap.AmmoPickup" });
472
473
474 public static final UT3ItemType ENERGY_SHIELD = MakePrototype(
475 Category.WEAPON, UT3Group.ENERGY_SHIELD, new String[] { "UTGameContent.UTDeployableEnergyShield",
476 "UTDeployableEnergyShield", "UTDeployableEnergyShield.WeaponPickup" });
477
478
479 public static final UT3ItemType ENERGY_SHIELD_AMMO = MakePrototype(
480 Category.AMMO, UT3Group.ENERGY_SHIELD, new String[] {
481 "UTDeployableEnergyShieldAmmo", "UTDeployableEnergyShield.AmmoPickup" });
482
483
484 public static final UT3ItemType EMP_MINE = MakePrototype(Category.WEAPON,
485 UT3Group.EMP_MINE, new String[] { "EMPMine",
486 "EMPMine.WeaponPickup", "UTDeployableEMPMine" });
487
488
489 public static final UT3ItemType EMP_MINE_AMMO = MakePrototype(
490 Category.AMMO, UT3Group.EMP_MINE, new String[] { "UTGameContent.UTDeployableEMPMine",
491 "UTDeployableEMPMineAmmo", "UTDeployableEMPMine.AmmoPickup" });
492
493
494 public static final UT3ItemType LINK_GENERATOR = MakePrototype(
495 Category.WEAPON, UT3Group.LINK_GENERATOR, new String[] { "UTGameContent.UTDeployableLinkGenerator",
496 "UTDeployableLinkGenerator", "UTDeployableLinkGenerator.WeaponPickup" });
497
498
499 public static final UT3ItemType LINK_GENERATOR_AMMO = MakePrototype(
500 Category.AMMO, UT3Group.LINK_GENERATOR, new String[] {
501 "UTDeployableLinkGeneratorAmmo", "UTDeployableLinkGenerator.AmmoPickup" });
502
503
504 public static final UT3ItemType SHAPED_CHARGE = MakePrototype(
505 Category.WEAPON, UT3Group.SHAPED_CHARGE, new String[] { "UTGameContent.UTDeployableShapedCharge",
506 "UTDeployableShapedCharge", "UTDeployableShapedCharge.WeaponPickup" });
507
508
509 public static final UT3ItemType SHAPED_CHARGE_AMMO = MakePrototype(
510 Category.AMMO, UT3Group.SHAPED_CHARGE, new String[] {
511 "UTDeployableShapedChargeAmmo", "ShapedCharge.AmmoPickup" });
512
513
514 public static final UT3ItemType SLOW_VOLUME = MakePrototype(
515 Category.WEAPON, UT3Group.SLOW_VOLUME, new String[] { "UTGameContent.UTDeployableSlowVolume",
516 "UTDeployableSlowVolume", "UTDeployableSlowVolume.WeaponPickup" });
517
518
519 public static final UT3ItemType SLOW_VOLUME_CONTENT = MakePrototype (
520 Category.OTHER, UT3Group.SLOW_VOLUME, new String[] { "UTSlowVolume_Content" });
521
522
523 public static final UT3ItemType SLOW_VOLUME_AMMO = MakePrototype(
524 Category.AMMO, UT3Group.SLOW_VOLUME, new String[] {
525 "UTDeployableSlowVolumeAmmo", "UTDeployableSlowVolume.AmmoPickup" });
526
527
528 public static final UT3ItemType SLOW_FIELD = MakePrototype(Category.OTHER,
529 UT3Group.SLOW_FIELD, new String[] { "SlowField",
530 "SlowField.Pickup" });
531
532
533 public static final UT3ItemType INVISIBILITY = MakePrototype(
534 Category.OTHER, UT3Group.INVISIBILITY, new String[] {
535 "Invisibility", "Invisibility.Pickup" });
536
537
538 public static final UT3ItemType INVULNERABILITY = MakePrototype(
539 Category.OTHER,
540 UT3Group.INVULNERABILITY,
541 new String[] { "Invulnerability",
542 "Invulnerability.Pickup", });
543
544
545 public static final UT3ItemType WEAPON_LOCKER = MakePrototype(Category.OTHER,
546 UT3Group.WEAPON_LOCKER, new String[] { "WeaponLocker", "WeaponLocker.Pickup" });
547
548
549 public static final UT3ItemType KEY = MakePrototype(Category.OTHER,
550 UT3Group.KEY, new String[] { "UnrealGame.KeyPickup" });
551
552
553 public static final UT3ItemType NONE = MakePrototype(Category.OTHER,
554 UT3Group.NONE, new String[] { "None", "NONE", "none" });
555
556
557
558
559
560
561
562
563 public UT3ItemType(String name) {
564 this.name = name;
565 this.category = Category.OTHER;
566 this.group = UT3Group.OTHER;
567 }
568
569
570
571
572 private UT3ItemType(String name, Category category, UT3Group group) {
573 this.name = name;
574 this.category = category;
575 this.group = group;
576 }
577
578
579
580
581
582
583
584
585
586
587
588
589 public static UT3ItemType MakePrototype(Category category, UT3Group group,
590 String[] utNames) {
591 UT3ItemType type;
592 synchronized (protos) {
593
594 type = new UT3ItemType(utNames[0], category, group);
595
596 for (String utName : utNames)
597 protos.put(utName, type);
598
599 if (category != null) {
600 CATEGORIES.get(category).add(type);
601 }
602 if (group != null) {
603 GROUPS.get(group).add(type);
604 }
605 }
606 return type;
607 }
608
609 public static UT3ItemType getWeaponItemType(UnrealId id) {
610 if (id == null)
611 return null;
612
613 return getWeaponItemType(id.getStringId());
614 }
615
616
617
618
619
620
621
622
623
624
625
626
627 public static UT3ItemType getWeaponItemType(String str) {
628 str = str.toLowerCase();
629 if (str.contains("enforcer"))
630 return UT3ItemType.ENFORCER;
631 if (str.contains("impacthammer"))
632 return UT3ItemType.IMPACT_HAMMER;
633 if (str.contains("flakcannon"))
634 return UT3ItemType.FLAK_CANNON;
635 if (str.contains("biorifle"))
636 return UT3ItemType.BIO_RIFLE;
637 if (str.contains("shockrifle"))
638 return UT3ItemType.SHOCK_RIFLE;
639 if (str.contains("linkgun"))
640 return UT3ItemType.LINK_GUN;
641 if (str.contains("sniperrifle"))
642 return UT3ItemType.SNIPER_RIFLE;
643 if (str.contains("rocketlauncher"))
644 return UT3ItemType.ROCKET_LAUNCHER;
645 if (str.contains("minigun"))
646 return UT3ItemType.STINGER_MINIGUN;
647 if (str.contains("translocator"))
648 return UT3ItemType.TRANSLOCATOR;
649 if (str.contains("translauncher"))
650 return UT3ItemType.TRANSLOCATOR;
651 if (str.contains("xrayvolume"))
652 return UT3ItemType.XRAY_VOLUME;
653 if (str.contains("spiderminetrap"))
654 return UT3ItemType.SPIDERMINE_TRAP;
655 if (str.contains("energyshield"))
656 return UT3ItemType.ENERGY_SHIELD;
657 if (str.contains("empmine"))
658 return UT3ItemType.EMP_MINE;
659 if (str.contains("linkgenerator"))
660 return UT3ItemType.LINK_GENERATOR;
661 if (str.contains("shapedcharge"))
662 return UT3ItemType.SHAPED_CHARGE;
663 if (str.contains("slowvolume"))
664 return UT3ItemType.SLOW_VOLUME;
665 return null;
666 }
667
668
669
670
671
672
673
674
675
676 public static boolean isDeployable(ItemType item) {
677 return (item == UT3ItemType.EMP_MINE
678 || item == UT3ItemType.ENERGY_SHIELD
679 || item == UT3ItemType.LINK_GENERATOR
680 || item == UT3ItemType.SHAPED_CHARGE
681 || item == UT3ItemType.SLOW_VOLUME
682 || item == UT3ItemType.SPIDERMINE_TRAP || item == UT3ItemType.XRAY_VOLUME);
683 }
684
685 @Override
686 public String getName() {
687 return name;
688 }
689
690
691
692
693
694
695
696
697 public static ItemType getItemType(String utName) {
698 ItemType type;
699
700 synchronized (protos) {
701 type = protos.get(utName);
702 if (type != null)
703 return type;
704
705 type = new UT3ItemType(utName);
706 protos.put(utName, type);
707 }
708 return type;
709 }
710
711
712
713 }