MCPcopy Create free account
hub / github.com/PCGen/pcgen / generateHeightWeight

Method generateHeightWeight

code/src/java/pcgen/core/BioSet.java:495–561  ·  view source on GitHub ↗
(final PlayerCharacter pc)

Source from the content-addressed store, hash-verified

493 }
494
495 private void generateHeightWeight(final PlayerCharacter pc)
496 {
497 int baseHeight = 0;
498 int baseWeight = 0;
499 int htAdd = 0;
500 int wtAdd = 0;
501 String totalWeight = null;
502 final String htwt =
503 getTokenNumberInMaps("SEX", 0, pc.getDisplay().getRegion(), pc.getRace().getKeyName().trim());
504
505 if (htwt == null || "0".equals(htwt))
506 {
507 return;
508 }
509
510 final StringTokenizer genderTok = new StringTokenizer(htwt, "[]", false);
511
512 while (genderTok.hasMoreTokens())
513 {
514 if (genderTok.nextToken().equals(pc.getGenderString()))
515 {
516 final String htWtLine = genderTok.nextToken();
517 final StringTokenizer htwtTok = new StringTokenizer(htWtLine, "|", false);
518
519 while (htwtTok.hasMoreTokens())
520 {
521 final String tag = htwtTok.nextToken();
522
523 if (tag.startsWith("BASEHT:"))
524 {
525 baseHeight = Integer.parseInt(tag.substring(7));
526 }
527 else if (tag.startsWith("BASEWT:"))
528 {
529 baseWeight = Integer.parseInt(tag.substring(7));
530 }
531 else if (tag.startsWith("HTDIEROLL:"))
532 {
533 htAdd = RollingMethods.roll(tag.substring(10));
534 }
535 else if (tag.startsWith("WTDIEROLL:"))
536 {
537 wtAdd = RollingMethods.roll(tag.substring(10));
538 }
539 else if (tag.startsWith("TOTALWT:"))
540 {
541 totalWeight = tag.substring(8);
542 }
543 }
544
545 if ((baseHeight != 0) && (htAdd != 0))
546 {
547 HeightCompat.setCurrentHeight(pc.getCharID(), baseHeight + htAdd);
548 }
549
550 if ((totalWeight != null) && (baseWeight != 0) && (wtAdd != 0))
551 {
552 totalWeight = replaceString(totalWeight, "HTDIEROLL", htAdd);

Callers 1

randomizeMethod · 0.95

Calls 15

getTokenNumberInMapsMethod · 0.95
rollMethod · 0.95
setCurrentHeightMethod · 0.95
replaceStringMethod · 0.95
trimMethod · 0.80
hasMoreTokensMethod · 0.80
nextTokenMethod · 0.80
getGenderStringMethod · 0.80
parseIntMethod · 0.80
intValueMethod · 0.80
getKeyNameMethod · 0.65
equalsMethod · 0.65

Tested by

no test coverage detected