Hardcoded render command, future version will write to the clipboard and possibly be implemented in Lua
| 443 | |
| 444 | // Hardcoded render command, future version will write to the clipboard and possibly be implemented in Lua |
| 445 | String ClientCommandProcessor::render(String const& path) { |
| 446 | if (path.empty()) { |
| 447 | return "Specify a path to render an image, or for worn armor: " |
| 448 | "^cyan;hat^reset;/^cyan;chest^reset;/^cyan;legs^reset;/^cyan;back^reset; " |
| 449 | "or for body parts: " |
| 450 | "^cyan;head^reset;/^cyan;body^reset;/^cyan;hair^reset;/^cyan;facialhair^reset;/" |
| 451 | "^cyan;facialmask^reset;/^cyan;frontarm^reset;/^cyan;backarm^reset;/^cyan;emote^reset;"; |
| 452 | } |
| 453 | AssetPath assetPath; |
| 454 | bool outputSheet = false; |
| 455 | String outputName = "render"; |
| 456 | auto player = m_universeClient->mainPlayer(); |
| 457 | if (player && path.utf8Size() < 100) { |
| 458 | auto args = m_parser.tokenizeToStringList(path); |
| 459 | auto first = args.maybeFirst().value().toLower(); |
| 460 | auto humanoid = player->humanoid(); |
| 461 | auto& identity = humanoid->identity(); |
| 462 | auto species = identity.imagePath.value(identity.species); |
| 463 | outputSheet = true; |
| 464 | outputName = first; |
| 465 | if (first.equals("hat")) { |
| 466 | assetPath.basePath = humanoid->headArmorFrameset(); |
| 467 | assetPath.directives += humanoid->headArmorDirectives(); |
| 468 | } else if (first.equals("chest")) { |
| 469 | if (args.size() <= 1) { |
| 470 | return "Chest armors have multiple spritesheets. Do: " |
| 471 | "^white;/chest torso ^cyan;front^reset;/^cyan;torso^reset;/^cyan;back^reset;. " |
| 472 | "To repair old generated clothes, then also specify ^cyan;old^reset;."; |
| 473 | } |
| 474 | String sheet = args[1].toLower(); |
| 475 | outputName += " " + sheet; |
| 476 | if (sheet == "torso") { |
| 477 | assetPath.basePath = humanoid->chestArmorFrameset(); |
| 478 | assetPath.directives += humanoid->chestArmorDirectives(); |
| 479 | } else if (sheet == "front") { |
| 480 | assetPath.basePath = humanoid->frontSleeveFrameset(); |
| 481 | assetPath.directives += humanoid->chestArmorDirectives(); |
| 482 | } else if (sheet == "back") { |
| 483 | assetPath.basePath = humanoid->backSleeveFrameset(); |
| 484 | assetPath.directives += humanoid->chestArmorDirectives(); |
| 485 | } else { |
| 486 | return strf("^red;Invalid chest sheet type '{}'^reset;", sheet); |
| 487 | } |
| 488 | // recovery for custom chests made by a very old generator |
| 489 | if (args.size() > 2 && args[2].toLower() == "old" && assetPath.basePath.beginsWith("/items/armors/avian/avian-tier6separator/")) |
| 490 | assetPath.basePath = "/items/armors/avian/avian-tier6separator/old/" + assetPath.basePath.substr(41); |
| 491 | } else if (first.equals("legs")) { |
| 492 | assetPath.basePath = humanoid->legsArmorFrameset(); |
| 493 | assetPath.directives += humanoid->legsArmorDirectives(); |
| 494 | } else if (first.equals("back")) { |
| 495 | assetPath.basePath = humanoid->backArmorFrameset(); |
| 496 | assetPath.directives += humanoid->backArmorDirectives(); |
| 497 | } else if (first.equals("body")) { |
| 498 | assetPath.basePath = humanoid->getBodyFromIdentity(); |
| 499 | assetPath.directives += identity.bodyDirectives; |
| 500 | } else if (first.equals("head")) { |
| 501 | outputSheet = false; |
| 502 | assetPath.basePath = humanoid->getHeadFromIdentity(); |
nothing calls this directly
no test coverage detected