<?phpnamespace App\Revisited\Ui;use App\Revisited\Sim\Items;/** * Pictograms of the dashboard, drawn with GD in a 100 x 100 box at 4 times the size, then smoothed down to the pixel * size asked (anti-aliased edges): one per item of the catalogue (by id, else by kind), and the vitals ("v_health", * "v_blood"...). * * One style for all of them: * - flat colours of the thing, one family palette per kind: food warm, water blue, tools wood + grey stone / steel, * weapons steel, clothes fabric colours, medical white with red accents, quest items dark casing + cyan glow, * materials natural, trade goods ochre / gold; * - the light comes from the top left: a soft highlight on the top left of every volume, the whole picture shaded * lighter there and darker at the bottom right, a drop shadow toward the bottom right; * - the same dark outline around every silhouette (stamped from the shape itself, so its weight never varies); * - long tools and weapons lie on the same diagonal (handle bottom left, working end top right); * - states are badges in the bottom right corner (a flame: cooked; mud, filter, steam, tablet, spring: the water; * a red cross mark: broken), smoked food hangs from a string under smoke. */final class Icons{ private const SS = 4; private const OUTLINE = '#1c1915'; private const WOOD = '#9a6334'; private const WOOD_LT = '#c48a52'; private const WOOD_DK = '#6e4220'; private const STEEL = '#aab6c2'; private const STEEL_LT = '#e4ecf4'; private const STEEL_DK = '#6c7a88'; private const FLINT = '#4e5866'; private const FLINT_LT = '#8592a2'; private const CORD = '#dcc48e'; private const TECH = '#2d3742'; private const TECH_LT = '#4a5866'; private const CYAN = '#4fe0ff'; private const WHITE = '#f4f2ee'; private const RED = '#d8343c'; private const WATER = '#3f9be0'; private const WATER_LT = '#a8dcff'; private const LEATHER = '#9a6a40'; private const LEATHER_DK = '#6e4a2c'; private const FUR = '#e4dccb'; private const FUR_DK = '#bfb39a'; private const GOLD = '#e8b84a'; private const LEAF = '#4f9a3f'; private const LEAF_DK = '#2f6a28'; private \GdImage $im; private float $k; private float $rot = 0.0; private float $pivotX = 50.0; private float $pivotY = 50.0; private bool $fallback = false; /** @var list<\Closure> drawn after the outline (glows, smoke: translucent things without an outline) */ private array $post = []; private function __construct(int $px) { $size = $px * self::SS; $this->im = self::blank($size); $this->k = $size / 100; } private static function blank(int $size): \GdImage { $im = imagecreatetruecolor($size, $size); imagealphablending($im, false); imagefill($im, 0, 0, imagecolorallocatealpha($im, 0, 0, 0, 127)); imagesavealpha($im, true); imagealphablending($im, true); return $im; } /** Whether the item / vital has a picture of its own (not the "?" tag of its family). */ public static function covers(string $id): bool { $p = new self(8); $p->draw($id); return !$p->fallback; } public static function image(string $id, int $px): \GdImage { $p = new self($px); $p->draw($id); $big = $p->finish(); $out = imagecreatetruecolor($px, $px); imagealphablending($out, false); imagefill($out, 0, 0, imagecolorallocatealpha($out, 0, 0, 0, 127)); imagesavealpha($out, true); imagecopyresampled($out, $big, 0, 0, 0, 0, $px, $px, $px * self::SS, $px * self::SS); self::light($out, $px); return $out; } /** The outline and the shadow, stamped from the silhouette, then the picture over them and the glows. */ private function finish(): \GdImage { $size = imagesx($this->im); $k = $this->k; $sil = self::blank($size); imagealphablending($sil, false); imagecopy($sil, $this->im, 0, 0, 0, 0, $size, $size); imagefilter($sil, IMG_FILTER_BRIGHTNESS, -255); $shadow = self::blank($size); imagealphablending($shadow, false); imagecopy($shadow, $sil, 0, 0, 0, 0, $size, $size); imagefilter($shadow, IMG_FILTER_COLORIZE, 0, 0, 0, 86); $v = hexdec(ltrim(self::OUTLINE, '#')); imagefilter($sil, IMG_FILTER_COLORIZE, ($v >> 16) & 255, ($v >> 8) & 255, $v & 255, 0); $out = self::blank($size); imagecopy($out, $shadow, (int) (2.5 * $k), (int) (3.5 * $k), 0, 0, $size, $size); $w = 2.6 * $k; for ($i = 0; $i < 16; $i++) { $a = $i * M_PI / 8; imagecopy($out, $sil, (int) round(cos($a) * $w), (int) round(sin($a) * $w), 0, 0, $size, $size); } imagecopy($out, $this->im, 0, 0, 0, 0, $size, $size); $this->im = $out; $this->rot = 0.0; foreach ($this->post as $fn) { $fn(); } return $this->im; } /** The light from the top left: lighter there, darker toward the bottom right. */ private static function light(\GdImage $im, int $px): void { imagealphablending($im, false); for ($y = 0; $y < $px; $y++) { for ($x = 0; $x < $px; $x++) { $c = imagecolorat($im, $x, $y); $a = ($c >> 24) & 127; if ($a >= 127) { continue; } $f = 1.0 + 0.14 * (1.0 - ($x + $y) / $px); $r = min(255, (int) ((($c >> 16) & 255) * $f)); $g = min(255, (int) ((($c >> 8) & 255) * $f)); $b = min(255, (int) (($c & 255) * $f)); imagesetpixel($im, $x, $y, imagecolorallocatealpha($im, $r, $g, $b, $a)); } } } // ---- primitives (0..100 box, turned by $rot around the centre) ------------------------------------ private function c(string $hex, int $alpha = 0): int { $v = hexdec(ltrim($hex, '#')); return imagecolorallocatealpha($this->im, ($v >> 16) & 255, ($v >> 8) & 255, $v & 255, $alpha); } /** @return array{float, float} */ private function tp(float $x, float $y): array { if ($this->rot === 0.0) { return [$x, $y]; } $dx = $x - $this->pivotX; $dy = $y - $this->pivotY; $c = cos($this->rot); $s = sin($this->rot); return [$this->pivotX + $dx * $c - $dy * $s, $this->pivotY + $dx * $s + $dy * $c]; } /** Draws $fn with everything turned by $deg degrees (negative: counter-clockwise) around a pivot. */ private function turned(float $deg, \Closure $fn, float $px = 50.0, float $py = 50.0): void { [$old, $ox, $oy] = [$this->rot, $this->pivotX, $this->pivotY]; [$this->rot, $this->pivotX, $this->pivotY] = [deg2rad($deg), $px, $py]; $fn(); [$this->rot, $this->pivotX, $this->pivotY] = [$old, $ox, $oy]; } private function ell(float $cx, float $cy, float $rx, float $ry, string $col, int $alpha = 0): void { $k = $this->k; [$cx, $cy] = $this->tp($cx, $cy); imagefilledellipse($this->im, (int) ($cx * $k), (int) ($cy * $k), (int) (2 * $rx * $k), (int) (2 * $ry * $k), $this->c($col, $alpha)); } /** A highlight: translucent white, on the top left of a volume. */ private function hi(float $cx, float $cy, float $rx, float $ry, int $alpha = 60): void { $this->ell($cx, $cy, $rx, $ry, '#ffffff', $alpha); } private function box(float $x1, float $y1, float $x2, float $y2, string $col, int $alpha = 0): void { if ($this->rot !== 0.0) { $this->poly([$x1, $y1, $x2, $y1, $x2, $y2, $x1, $y2], $col, $alpha); return; } $k = $this->k; imagefilledrectangle($this->im, (int) ($x1 * $k), (int) ($y1 * $k), (int) ($x2 * $k), (int) ($y2 * $k), $this->c($col, $alpha)); } private function rbox(float $x1, float $y1, float $x2, float $y2, float $r, string $col): void { $this->box($x1 + $r, $y1, $x2 - $r, $y2, $col); $this->box($x1, $y1 + $r, $x2, $y2 - $r, $col); foreach ([[$x1 + $r, $y1 + $r], [$x2 - $r, $y1 + $r], [$x1 + $r, $y2 - $r], [$x2 - $r, $y2 - $r]] as [$x, $y]) { $this->ell($x, $y, $r, $r, $col); } } /** @param list<float> $pts x, y, x, y... */ private function poly(array $pts, string $col, int $alpha = 0): void { $k = $this->k; $p = []; for ($i = 0; $i + 1 < count($pts); $i += 2) { [$x, $y] = $this->tp($pts[$i], $pts[$i + 1]); $p[] = (int) ($x * $k); $p[] = (int) ($y * $k); } imagefilledpolygon($this->im, $p, $this->c($col, $alpha)); } private function seg(float $x1, float $y1, float $x2, float $y2, float $w, string $col, int $alpha = 0): void { $len = hypot($x2 - $x1, $y2 - $y1); if ($len <= 0) { return; } $nx = -($y2 - $y1) / $len * $w / 2; $ny = ($x2 - $x1) / $len * $w / 2; $this->poly([$x1 + $nx, $y1 + $ny, $x2 + $nx, $y2 + $ny, $x2 - $nx, $y2 - $ny, $x1 - $nx, $y1 - $ny], $col, $alpha); $this->ell($x1, $y1, $w / 2, $w / 2, $col, $alpha); $this->ell($x2, $y2, $w / 2, $w / 2, $col, $alpha); } /** A polyline of round segments. @param list<float> $pts */ private function path(array $pts, float $w, string $col): void { for ($i = 0; $i + 3 < count($pts); $i += 2) { $this->seg($pts[$i], $pts[$i + 1], $pts[$i + 2], $pts[$i + 3], $w, $col); } } private function arc(float $cx, float $cy, float $r, float $from, float $to, float $w, string $col, int $alpha = 0): void { // round dots along the arc: an even thickness at any size (GD's thick arcs are ragged) if ($to < $from) { $to += 360; } $steps = max(6, (int) (($to - $from) / 360 * $r * 1.6)); $prev = null; for ($i = 0; $i <= $steps; $i++) { $a = deg2rad($from + ($to - $from) * $i / $steps); $pt = [$cx + cos($a) * $r, $cy + sin($a) * $r]; if ($prev !== null) { $this->seg($prev[0], $prev[1], $pt[0], $pt[1], $w, $col, $alpha); } $prev = $pt; } } /** A wavy line of smoke or steam (after the outline: soft, translucent). */ private function wisp(float $x, float $y, float $h, string $col = '#e8eef4', int $alpha = 30): void { $this->post[] = function () use ($x, $y, $h, $col, $alpha): void { $pts = []; for ($i = 0; $i <= 8; $i++) { $pts[] = $x + sin($i * 0.9) * 4; $pts[] = $y - $h * $i / 8; } for ($i = 0; $i + 3 < count($pts); $i += 2) { $this->seg($pts[$i], $pts[$i + 1], $pts[$i + 2], $pts[$i + 3], 3.4, $col, $alpha); } }; } /** A cyan glow around a point (after the outline). */ private function glow(float $cx, float $cy, float $r, string $col = self::CYAN): void { $this->post[] = function () use ($cx, $cy, $r, $col): void { $this->ell($cx, $cy, $r, $r, $col, 104); $this->ell($cx, $cy, $r * 0.66, $r * 0.66, $col, 96); }; } /** The state badge, bottom right: a coloured disc with a white sign. */ private function badge(string $bg, string $sign): void { $this->rot = 0.0; $this->ell(78, 78, 17, 17, $bg); $this->hi(73, 72, 7, 5, 80); $w = self::WHITE; match ($sign) { 'flame' => $this->flameShape(78, 80, 0.42, '#ffd25a', '#fff4c8'), 'mud' => (function () use ($w): void { $this->path([67, 76, 72, 73, 78, 77, 84, 73, 89, 76], 3, $w); $this->ell(72, 84, 2.4, 2.4, $w); $this->ell(80, 86, 2.4, 2.4, $w); $this->ell(86, 83, 2, 2, $w); })(), 'filter' => (function () use ($w, $bg): void { $this->poly([66, 69, 90, 69, 81, 79, 81, 88, 75, 88, 75, 79], $w); $this->box(68, 72, 88, 73.5, $bg); })(), 'steam' => (function () use ($w): void { foreach ([70, 78, 86] as $x) { $this->path([$x, 88, $x - 2.5, 83, $x + 1.5, 78, $x - 1.5, 72, $x, 68], 2.6, $w); } })(), 'tablet' => (function () use ($w): void { $this->ell(78, 78, 10, 10, $w); $this->box(68, 77, 88, 79.5, '#7aa8c8'); $this->box(77, 68, 79.5, 88, '#7aa8c8'); })(), 'spring' => $this->poly([78, 64, 81, 75, 92, 78, 81, 81, 78, 92, 75, 81, 64, 78, 75, 75], $w), 'broken' => (function () use ($w): void { $this->seg(70, 70, 86, 86, 4.5, $w); $this->seg(86, 70, 70, 86, 4.5, $w); })(), default => null, }; } // ---- the catalogue -------------------------------------------------------------------------------- private function draw(string $id): void { match ($id) { // vitals 'v_health' => $this->heart('#e25b5b'), 'v_blood' => $this->drop('#c22c36'), 'v_temperature' => $this->thermometer(), 'v_hunger' => $this->drumstick(), 'v_thirst' => $this->drop(self::WATER), 'v_fatigue' => $this->moon(), 'v_morale' => $this->sun(), 'v_weight' => $this->bag(), 'v_fire' => $this->flameShape(50, 62, 1.15, '#e8742a', '#ffd25a'), 'v_shelter' => $this->tent(), // materials 'stick' => $this->stick(), 'wood' => $this->firewood(), 'log' => $this->trunk(), 'stone' => $this->stone(), 'flint' => $this->flint(), 'vine' => $this->vine(), 'fiber' => $this->fiber(), 'tinder' => $this->tinder(), 'leaves' => $this->leaves(), 'reed' => $this->reeds(), 'cane' => $this->cane(), 'bone' => $this->bone(), 'hide' => $this->pelt(self::LEATHER, '#7a5030', false), 'fur' => $this->pelt(self::FUR, self::FUR_DK, true), 'scale_hide' => $this->scalePelt(), 'shell' => $this->carapace(), 'resin' => $this->resin(), 'clay' => $this->clay(), 'metal_scrap' => $this->scrap(), 'wire' => $this->spool(), 'cloth' => $this->cloth(), 'rope' => $this->rope(), 'charcoal' => $this->charcoal(), 'sand' => $this->sand(), 'fat' => $this->fat(), 'credit' => $this->coins(), 'gun_parts' => $this->gunParts(), // ammunition 'arrow' => $this->arrow('stone'), 'arrow_bone' => $this->arrow('bone'), 'arrow_metal' => $this->arrow('metal'), 'bolt' => $this->bolt(), 'flare' => $this->flare(), 'energy_cell' => $this->magazine(), // food 'berries_blue' => $this->blueberries(), 'berries_red' => $this->redBerries(), 'fruit' => $this->fruit(), 'mushroom_brown' => $this->bolete(), 'mushroom_pale' => $this->paleMushroom(), 'meat_raw' => $this->steak(false), 'meat_cooked' => $this->steak(true), 'smoked_meat' => $this->hanging('meat'), 'dried_meat' => $this->jerky(), 'fish_raw' => $this->fish(false), 'fish_cooked' => $this->fish(true), 'smoked_fish' => $this->hanging('fish'), 'earthworm' => $this->worms(), 'worms_cooked' => $this->wormSkewer(), 'crab_meat' => $this->claw(), 'crab_cooked' => $this->crab(), 'root' => $this->root(), 'root_cooked' => $this->rootCooked(), 'ration' => $this->ration(), 'food_rotten' => $this->rotten(), // water and drinks 'gourd_empty' => $this->gourd(null, ''), 'gourd_dirty' => $this->gourd('#5e5a2a', 'dirty'), 'gourd_filtered' => $this->gourd('#9cc4d8', 'filtered'), 'gourd_boiled' => $this->gourd(self::WATER, 'boiled'), 'gourd_purified' => $this->gourd('#2a6ac0', 'purified'), 'gourd_clean' => $this->gourd('#5ad8ff', 'clean'), 'waterskin' => $this->waterskin(), 'ferment' => $this->jug(), 'water_filter' => $this->filter(), 'purification_tablets' => $this->blister(), // tools 'knife_flint' => $this->knife(), 'axe_stone' => $this->axe(), 'torch' => $this->torch(), 'fire_drill' => $this->bowDrill(), 'fishing_line' => $this->fishingLine(), 'pot' => $this->pot(), 'trap_snare' => $this->snare(), 'trap_spike' => $this->spikes(), 'shelter_kit' => $this->leanTo(), 'campfire_kit' => $this->pyre(), 'chest_wood' => $this->chest(false), 'chest_metal' => $this->chest(true), 'basket' => $this->basket(), 'scanner' => $this->scanner(), 'gps' => $this->gps(), 'needle_bone' => $this->needle(), 'raft_pole' => $this->pole(), 'climbing_stakes' => $this->stakes(), 'piolet', 'ice_axe', 'ice_pick' => $this->iceAxe(), // weapons 'spear' => $this->spear(), 'harpoon' => $this->harpoon(), 'club' => $this->club(), 'shield_hide' => $this->shield(false), 'shield_scrap' => $this->shield(true), 'machete' => $this->machete(), 'bow' => $this->bow(), 'crossbow' => $this->crossbow(), 'sling' => $this->sling(), 'flare_gun' => $this->flareGun(), 'plasma_gun' => $this->plasmaGun(), 'pulse_rifle' => $this->rifle(false), 'pulse_rifle_broken' => $this->rifle(true), // blueprints 'blueprint_crossbow' => $this->blueprint('crossbow'), 'blueprint_forge' => $this->blueprint('blade'), 'blueprint_pulse' => $this->blueprint('rifle'), // clothing 'flight_suit_torn' => $this->flightSuit(), 'helmet_pilot' => $this->helmet(), 'cap_hide' => $this->beanie(), 'hat_fur' => $this->furHat(), 'undershirt' => $this->undershirt(), 'tunic_fiber' => $this->tunic(), 'rags' => $this->rags(), 'jacket_hide' => $this->jacket(self::LEATHER, self::LEATHER_DK, 'hide'), 'jacket_scale' => $this->jacket('#3f8a7a', '#26584e', 'scale'), 'coat_fur' => $this->furCoat(), 'trousers_hide' => $this->trousers(false), 'leggings_fur' => $this->trousers(true), 'gloves_pilot' => $this->glove('#2e3036', '#55585f', 'pilot'), 'gloves_hide' => $this->glove(self::LEATHER, self::LEATHER_DK, 'hide'), 'mittens_fur' => $this->glove(self::FUR, self::FUR_DK, 'mitten'), 'boots' => $this->boot(self::LEATHER, self::LEATHER_DK, false), 'pilot_boots_worn' => $this->boot('#3a3a40', '#5e5e66', true), 'patch' => $this->patch(), // medical 'bandage' => $this->bandage(), 'splint' => $this->splint(), 'herb_heal' => $this->herbHeal(), 'herb_fever' => $this->herbFever(), 'herb_antidote' => $this->herbAntidote(), 'poultice' => $this->poultice(), 'antidote' => $this->vial(), 'tea_fever' => $this->cup(), 'medkit' => $this->medkit(), 'salve_burn' => $this->salve(), // quest 'power_cell' => $this->powerCell(), 'tuner' => $this->tuner(), 'antenna_part' => $this->antenna(), 'colony_log' => $this->book(), 'pod_log' => $this->datapad(), 'keycard' => $this->keycard(), 'fuel_canister' => $this->jerrycan(), 'nav_core' => $this->navCore(), 'heat_plates' => $this->heatPlates(), 'ignition_key' => $this->key(), 'launch_codes' => $this->codes(), 'shuttle_manual' => $this->manual(), // trade goods 'trade_beads' => $this->beads(), 'trade_salt' => $this->salt(), 'trade_amulet' => $this->amulet(), default => $this->unknown(str_starts_with($id, 'v_') ? 'vital' : (string) Items::get($id)['kind']), }; } /** An item without a picture of its own: a tag of its family's colour with a question mark. */ private function unknown(string $kind): void { $this->fallback = true; $col = match ($kind) { 'food' => '#e08a3a', 'drink' => self::WATER, 'tool' => self::WOOD, 'weapon' => self::STEEL_DK, 'clothing' => '#6a7ea8', 'medical' => self::RED, 'quest' => '#2a9ab8', 'trade', 'money' => self::GOLD, default => '#8a8a8a', }; $this->rbox(20, 20, 80, 80, 12, $col); $this->hi(36, 32, 12, 7); $this->arc(50, 40, 10, 180, 405, 6, self::WHITE); $this->seg(50, 50, 50, 58, 6, self::WHITE); $this->ell(50, 69, 4, 4, self::WHITE); } // ---- vitals --------------------------------------------------------------------------------------- private function heart(string $c): void { $this->ell(35, 38, 21, 21, $c); $this->ell(65, 38, 21, 21, $c); $this->poly([15, 45, 85, 45, 50, 88], $c); $this->hi(31, 32, 8, 6, 30); } private function drop(string $c): void { $this->poly([50, 8, 75, 52, 25, 52], $c); $this->ell(50, 62, 26, 26, $c); $this->hi(41, 58, 6, 10, 30); } private function thermometer(): void { $this->rbox(40, 10, 60, 70, 10, '#e9edf2'); $this->ell(50, 75, 17, 17, '#e9edf2'); $this->box(46, 32, 54, 72, '#e2513c'); $this->ell(50, 75, 11, 11, '#e2513c'); foreach ([24, 34, 44, 54] as $y) { $this->box(60, $y, 66, $y + 2, '#e9edf2'); } $this->hi(45, 70, 3, 4, 30); } private function drumstick(): void { $this->seg(54, 56, 76, 78, 10, '#efe6d2'); $this->ell(81, 75, 8, 8, '#efe6d2'); $this->ell(74, 84, 8, 8, '#efe6d2'); $this->ell(40, 40, 28, 25, '#c97a34'); $this->hi(32, 31, 10, 7); } private function moon(): void { $this->ell(48, 52, 34, 34, '#b9b4e8'); $k = $this->k; imagealphablending($this->im, false); imagefilledellipse($this->im, (int) (66 * $k), (int) (40 * $k), (int) (56 * $k), (int) (56 * $k), imagecolorallocatealpha($this->im, 0, 0, 0, 127)); imagealphablending($this->im, true); $this->ell(80, 18, 3.5, 3.5, '#e8e6ff'); $this->ell(88, 34, 2.5, 2.5, '#e8e6ff'); } private function sun(): void { for ($a = 0; $a < 8; $a++) { $r = $a * M_PI / 4; $this->seg(50 + cos($r) * 32, 50 + sin($r) * 32, 50 + cos($r) * 42, 50 + sin($r) * 42, 7, '#f0c64a'); } $this->ell(50, 50, 23, 23, '#f0c64a'); $this->ell(43, 46, 3, 4, '#5a4410'); $this->ell(57, 46, 3, 4, '#5a4410'); $this->arc(50, 52, 10, 30, 150, 3, '#5a4410'); } private function bag(): void { $this->arc(50, 34, 15, 180, 360, 6, '#8a6440'); $this->poly([22, 38, 78, 38, 88, 88, 12, 88], '#b08a56'); $this->box(36, 54, 64, 68, '#7d5a32'); $this->hi(30, 48, 7, 9); } private function flameShape(float $cx, float $cy, float $s, string $out, string $in): void { $this->poly([$cx - 22 * $s, $cy + 2 * $s, $cx - 4 * $s, $cy - 28 * $s, $cx + 2 * $s, $cy - 44 * $s, $cx + 14 * $s, $cy - 22 * $s, $cx + 22 * $s, $cy + 2 * $s], $out); $this->ell($cx, $cy + 4 * $s, 22 * $s, 18 * $s, $out); $this->poly([$cx - 11 * $s, $cy + 8 * $s, $cx, $cy - 20 * $s, $cx + 11 * $s, $cy + 8 * $s], $in); $this->ell($cx, $cy + 9 * $s, 11 * $s, 9 * $s, $in); } private function tent(): void { $this->poly([50, 12, 92, 86, 8, 86], '#d8b878'); $this->poly([50, 12, 92, 86, 64, 86], '#b8965a'); $this->poly([50, 40, 64, 86, 38, 86], '#3a2e1e'); $this->seg(50, 6, 50, 18, 4, self::WOOD_DK); } // ---- materials ------------------------------------------------------------------------------------ private function stick(): void { $this->turned(-25, function (): void { $this->seg(8, 52, 92, 50, 10, self::WOOD); $this->seg(10, 50, 90, 48, 3, self::WOOD_LT); $this->seg(56, 50, 74, 32, 6, self::WOOD); $this->ell(22, 52, 3, 2.4, self::WOOD_DK); $this->ell(42, 50, 3, 2.4, self::WOOD_DK); }); $this->ell(72, 22, 10, 5, self::LEAF); } private function firewood(): void { // two split quarters of a log, their triangular ends toward us foreach ([[30, 60, 1.0], [62, 46, 1.0]] as [$x, $y]) { $this->poly([$x - 18, $y + 22, $x + 22, $y + 22, $x + 4, $y - 16], self::WOOD); $this->poly([$x - 12, $y + 22, $x + 16, $y + 22, $x + 2, $y - 6], '#d8a86a'); $this->arc($x + 2, $y + 22, 9, 200, 340, 1.6, self::WOOD); $this->seg($x - 18, $y + 22, $x + 4, $y - 16, 3, self::WOOD_DK); } } private function trunk(): void { $this->rbox(18, 34, 90, 70, 6, self::WOOD); $this->box(24, 38, 90, 42, self::WOOD_LT); $this->seg(40, 54, 80, 56, 2.4, self::WOOD_DK); $this->seg(50, 62, 86, 63, 2.4, self::WOOD_DK); $this->ell(20, 52, 12, 18, '#e0b27a'); $this->arc(20, 52, 7, 0, 360, 2, self::WOOD); $this->ell(20, 52, 2, 2, self::WOOD_DK); } private function stone(): void { $this->ell(50, 60, 36, 26, '#8d9096'); $this->ell(56, 66, 28, 18, '#7a7d83'); $this->hi(38, 50, 14, 7, 50); } private function flint(): void { $this->poly([28, 82, 16, 50, 36, 20, 66, 14, 86, 38, 82, 70, 56, 88], self::FLINT); $this->poly([36, 20, 66, 14, 58, 38, 40, 44], self::FLINT_LT); $this->poly([16, 50, 40, 44, 34, 70, 28, 82], '#3a424e'); foreach ([[62, 56], [70, 72], [76, 50]] as [$x, $y]) { $this->arc($x, $y, 7, 200, 320, 2, self::FLINT_LT); } } private function vine(): void { $pts = []; for ($i = 0; $i <= 12; $i++) { $pts[] = 12 + $i * 6.5; $pts[] = 50 + sin($i * 0.9) * 18; } $this->path($pts, 6, '#4d8a3a'); foreach ([[24, 38, 1], [44, 70, -1], [66, 32, 1], [84, 64, -1]] as [$x, $y, $s]) { $this->ell($x, $y - $s * 6, 8, 5, self::LEAF); } } private function fiber(): void { for ($i = 0; $i < 9; $i++) { $x = 18 + $i * 8; $this->seg(50, 86, $x, 14 + abs(4 - $i) * 5, 3.5, $i % 2 ? '#a7c26a' : '#8fae52'); } $this->box(40, 66, 60, 74, self::CORD); } private function tinder(): void { // a nest of dry fibres with an ember in it $this->ell(50, 62, 36, 22, '#c6a062'); for ($i = 0; $i < 7; $i++) { $this->arc(50, 62, 26 - ($i % 3) * 6, 190 + $i * 15, 300 + $i * 10, 2.2, '#8a6a3a'); } $this->ell(50, 58, 12, 7, '#4a3016'); $this->ell(50, 57, 7, 4, '#ff7a2a'); $this->ell(50, 56, 3, 2, '#ffd25a'); $this->wisp(52, 46, 30); } private function leaves(): void { foreach ([[-35, '#3f8a34'], [-80, self::LEAF]] as [$t, $c]) { $this->turned((float) $t, function () use ($c): void { $this->ell(76, 88, 30, 14, $c); $this->seg(48, 88, 104, 88, 2.4, self::LEAF_DK); $this->hi(70, 82, 12, 4, 80); }, 44, 88); } $this->seg(44, 88, 34, 96, 3, self::LEAF_DK); } private function reeds(): void { foreach ([[30, 88, 26, 24], [50, 90, 52, 12], [70, 88, 76, 22]] as [$x, $y, $tx, $ty]) { $this->seg($x, $y, $tx, $ty, 4, '#b8b06a'); $this->rbox($tx - 5, $ty + 6, $tx + 5, $ty + 26, 5, '#7a4e2a'); } $this->seg(40, 88, 20, 52, 3, '#8fae52'); $this->seg(62, 90, 86, 58, 3, '#8fae52'); } private function cane(): void { foreach ([[34, -8], [62, 8]] as [$x, $tilt]) { $this->turned($tilt, function () use ($x): void { $this->rbox($x - 8, 10, $x + 8, 92, 4, '#b8c25a'); $this->box($x - 8, 10, $x - 3, 92, '#d8dc84'); foreach ([30, 52, 74] as $y) { $this->box($x - 9, $y - 2, $x + 9, $y + 2, '#7a8a2a'); } }); } $this->ell(70, 12, 14, 5, self::LEAF); } private function bone(): void { $this->seg(28, 72, 72, 28, 13, '#efe8d6'); foreach ([[21, 70], [30, 80], [70, 20], [80, 29]] as [$x, $y]) { $this->ell($x, $y, 10, 10, '#efe8d6'); } $this->seg(34, 62, 62, 34, 3, '#ffffff', 40); } private function pelt(string $c, string $dark, bool $fur): void { $pts = [18, 20, 36, 30, 64, 30, 82, 20, 74, 48, 86, 80, 62, 70, 38, 70, 14, 80, 26, 48]; $this->poly($pts, $c); $this->ell(50, 50, 16, 16, $dark); $this->ell(50, 50, 13, 13, $c); if ($fur) { // a tufted edge and stripes of darker fur for ($i = 0; $i < 20; $i += 2) { $this->ell($pts[$i], $pts[$i + 1], 6, 6, $c); } foreach ([[34, 40], [62, 40], [44, 62], [60, 60]] as [$x, $y]) { $this->seg($x - 5, $y - 3, $x + 5, $y + 3, 3, $dark); } } else { $this->seg(30, 40, 30, 60, 2, $dark); $this->seg(70, 40, 70, 60, 2, $dark); } $this->hi(38, 38, 10, 5); } private function scalePelt(): void { // a long scaly skin rolled in an S $pts = []; for ($i = 0; $i <= 10; $i++) { $pts[] = 14 + $i * 7.2; $pts[] = 50 + sin($i * 0.62 - 0.4) * 26; } $this->path($pts, 22, '#3f8a7a'); for ($i = 0; $i < 10; $i++) { $x = $pts[$i * 2]; $y = $pts[$i * 2 + 1]; $this->arc($x + 3, $y - 4, 4, 0, 180, 1.6, '#9ee0c8'); $this->arc($x + 3, $y + 4, 4, 0, 180, 1.6, '#9ee0c8'); } $this->ell(86, 46, 9, 7, '#2e6a5e'); $this->ell(89, 44, 2, 2, '#e0d040'); } private function carapace(): void { $this->ell(50, 56, 40, 30, '#6e7a3a'); $this->ell(50, 52, 34, 24, '#8a9648'); $this->poly([42, 40, 58, 40, 64, 52, 58, 64, 42, 64, 36, 52], '#a8b45a'); foreach ([[24, 48], [76, 48], [32, 68], [68, 68], [50, 32]] as [$x, $y]) { $this->ell($x, $y, 8, 6, '#a8b45a'); } $this->hi(38, 40, 10, 5); } private function resin(): void { // amber running down a piece of bark $this->poly([28, 10, 72, 10, 76, 90, 24, 90], '#6e4a2c'); foreach ([24, 40, 56, 72] as $y) { $this->seg(30, $y, 70, $y + 4, 2, '#4e3420'); } $this->poly([42, 22, 58, 22, 60, 46, 56, 60, 44, 60, 40, 46], '#e39a2a'); $this->ell(50, 64, 14, 14, '#e39a2a'); $this->ell(52, 80, 6, 7, '#e39a2a'); $this->hi(45, 58, 4, 7, 40); } private function clay(): void { $this->poly([14, 70, 22, 40, 50, 30, 80, 38, 88, 68, 70, 84, 30, 84], '#a8603a'); $this->poly([22, 40, 50, 30, 80, 38, 70, 48, 30, 50], '#c47a4e'); $this->ell(56, 62, 9, 6, '#8a4a2a'); $this->ell(36, 66, 7, 5, '#8a4a2a'); $this->hi(36, 40, 8, 3, 50); } private function scrap(): void { $this->poly([14, 60, 30, 26, 58, 34, 52, 70], self::STEEL_DK); $this->poly([40, 46, 84, 22, 90, 62, 56, 84], self::STEEL); $this->poly([40, 46, 84, 22, 86, 34, 46, 56], self::STEEL_LT); foreach ([[56, 64], [76, 54], [72, 72]] as [$x, $y]) { $this->ell($x, $y, 3, 3, self::STEEL_DK); } $this->ell(30, 46, 3, 3, '#4a5562'); } private function spool(): void { $this->box(30, 20, 70, 80, '#c87440'); for ($y = 24; $y <= 76; $y += 6) { $this->seg(30, $y, 70, $y + 3, 2, '#f0a868'); } $this->rbox(22, 12, 78, 22, 3, self::WOOD); $this->rbox(22, 78, 78, 88, 3, self::WOOD); $this->path([70, 40, 82, 44, 86, 60, 92, 70], 2.5, '#c87440'); } private function cloth(): void { $this->poly([14, 30, 80, 20, 88, 70, 22, 82], '#4f6f9e'); $this->poly([14, 30, 80, 20, 82, 34, 18, 44], '#6a8cbe'); $this->poly([52, 50, 88, 70, 64, 86], '#3a5680'); $this->path([20, 58, 30, 56, 40, 60, 50, 56], 1.6, '#8aa8d8'); } private function rope(): void { for ($i = 0; $i < 3; $i++) { $this->arc(50, 54, 32 - $i * 9, 0, 360, 6.5, '#c9a66b'); } for ($a = 0; $a < 360; $a += 24) { $r = deg2rad($a); $this->seg(50 + cos($r) * 29, 54 + sin($r) * 29, 50 + cos($r + 0.12) * 35, 54 + sin($r + 0.12) * 35, 1.4, '#8a6a3a'); } $this->seg(64, 26, 86, 10, 6.5, '#c9a66b'); $this->ell(87, 9, 5, 5, '#e8d6a8'); } private function charcoal(): void { $this->poly([14, 72, 22, 52, 44, 48, 52, 66, 40, 84, 20, 84], '#2c2c30'); $this->poly([46, 68, 54, 42, 80, 40, 88, 66, 74, 84, 52, 84], '#232327'); $this->poly([30, 44, 42, 22, 64, 20, 70, 38, 50, 46], '#38383e'); foreach ([[34, 60], [66, 56], [52, 30], [76, 72]] as [$x, $y]) { $this->seg($x - 6, $y, $x + 6, $y, 1.6, '#6a6a74'); } } private function sand(): void { $this->poly([8, 86, 30, 54, 50, 34, 70, 54, 92, 86], '#d8c28a'); $this->poly([50, 34, 70, 54, 92, 86, 60, 86], '#c2a870'); foreach ([[36, 66], [52, 52], [60, 72], [30, 80], [44, 78], [74, 78]] as [$x, $y]) { $this->ell($x, $y, 1.6, 1.6, '#9a8250'); } } private function fat(): void { $this->ell(50, 76, 40, 12, self::LEAF); $this->rbox(24, 38, 76, 76, 10, '#f2e4b0'); $this->rbox(24, 38, 76, 50, 8, '#fff4cc'); $this->ell(64, 64, 6, 4, '#e0cc88'); $this->hi(36, 46, 7, 4); } private function coins(): void { $this->ell(62, 62, 28, 28, '#b8862a'); $this->ell(40, 46, 30, 30, self::GOLD); $this->arc(40, 46, 22, 0, 360, 2.2, '#b8862a'); $this->seg(32, 34, 32, 58, 4, '#8a6418'); $this->seg(48, 34, 48, 58, 4, '#8a6418'); $this->seg(32, 46, 48, 46, 4, '#8a6418'); $this->hi(30, 34, 8, 5); } private function gunParts(): void { // a barrel, a spring and a screw $this->turned(-35, function (): void { $this->rbox(10, 30, 70, 42, 4, self::STEEL_DK); $this->box(12, 32, 68, 35, self::STEEL); }); for ($i = 0; $i < 6; $i++) { $this->arc(30 + $i * 6, 72, 8, 0, 360, 2.4, self::STEEL); } $this->box(72, 44, 80, 66, self::STEEL); $this->rbox(66, 38, 86, 46, 2, self::STEEL_DK); foreach ([50, 55, 60] as $y) { $this->seg(72, $y, 80, $y + 2, 1.4, self::STEEL_DK); } } // ---- ammunition ----------------------------------------------------------------------------------- private function arrow(string $tip): void { $this->turned(-45, function () use ($tip): void { $this->seg(-4, 50, 86, 50, 4, '#b07a44'); $fl = match ($tip) { 'bone' => '#efe8d6', 'metal' => '#d8343c', default => '#5c9a3c', }; $this->poly([-6, 50, 14, 50, 6, 36, -12, 36], $fl); $this->poly([-6, 50, 14, 50, 6, 64, -12, 64], $fl); match ($tip) { 'bone' => (function (): void { $this->poly([80, 40, 110, 50, 80, 60, 86, 50], '#efe8d6'); $this->poly([84, 44, 74, 36, 80, 50], '#efe8d6'); $this->poly([84, 56, 74, 64, 80, 50], '#efe8d6'); })(), 'metal' => (function (): void { $this->poly([78, 38, 112, 50, 78, 62, 84, 50], self::STEEL); $this->poly([84, 50, 112, 50, 78, 38], self::STEEL_LT); })(), default => $this->poly([80, 42, 94, 40, 108, 50, 94, 60, 80, 58], self::FLINT), }; $this->seg(74, 50, 82, 50, 6, self::CORD); }); } private function bolt(): void { $this->turned(-15, function (): void { $this->seg(16, 50, 80, 50, 9, '#8a5a32'); $this->poly([14, 38, 34, 42, 34, 50, 8, 50], '#3a3a40'); $this->poly([14, 62, 34, 58, 34, 50, 8, 50], '#3a3a40'); $this->poly([74, 38, 100, 50, 74, 62], self::STEEL); $this->poly([74, 38, 100, 50, 74, 50], self::STEEL_LT); }); } private function flare(): void { $this->turned(-30, function (): void { $this->rbox(22, 38, 80, 62, 5, '#d83a2a'); $this->box(26, 40, 78, 45, '#ff6a50'); $this->box(66, 38, 70, 62, '#f0f0f0'); $this->rbox(80, 40, 90, 60, 2, '#3a3a40'); }); $this->ell(24, 72, 6, 6, '#ffd25a'); $this->ell(24, 72, 3, 3, '#ffffff'); $this->glow(24, 72, 14, '#ff9a3a'); } private function magazine(): void { $this->rbox(30, 14, 70, 88, 5, self::TECH); $this->rbox(34, 18, 66, 84, 3, self::TECH_LT); foreach ([28, 46, 64] as $y) { $this->rbox(40, $y, 60, $y + 12, 3, '#c86aff'); $this->box(42, $y + 2, 50, $y + 5, '#f0d8ff'); } $this->box(34, 84, 66, 88, '#1a2028'); $this->glow(50, 52, 26, '#c86aff'); } // ---- food ----------------------------------------------------------------------------------------- private function cooked(): void { $this->badge('#d9532b', 'flame'); } private function blueberries(): void { $this->ell(50, 68, 36, 16, self::LEAF); foreach ([[34, 52], [52, 46], [68, 54], [42, 66], [60, 66], [26, 66], [76, 68]] as [$x, $y]) { $this->ell($x, $y, 9, 9, '#3a52b8'); $this->hi($x - 3, $y - 3, 3, 2.4, 50); $this->ell($x, $y + 1, 2.4, 2.4, '#202c66'); } } private function redBerries(): void { // three berries hanging on long stems from one twig $this->seg(30, 12, 70, 14, 4, self::WOOD_DK); foreach ([[30, 62], [52, 74], [72, 58]] as [$x, $y]) { $this->path([50, 14, ($x + 50) / 2, $y - 30, $x, $y - 12], 2.6, '#5a7a30'); $this->ell($x, $y, 13, 13, '#d4283c'); $this->hi($x - 4, $y - 4, 4, 3, 40); } $this->ell(64, 20, 12, 5, self::LEAF); $this->ell(38, 22, 10, 4, self::LEAF); } private function fruit(): void { $this->ell(50, 60, 32, 30, '#e8862e'); $this->ell(60, 66, 22, 20, '#d0701e'); $this->seg(50, 32, 54, 14, 5, '#6a4a26'); $this->ell(68, 18, 15, 7, self::LEAF); $this->hi(38, 48, 9, 7); } private function bolete(): void { $this->poly([38, 50, 62, 50, 70, 86, 30, 86], '#efe6cf'); $this->ell(50, 48, 40, 24, '#8a5a34'); $this->ell(50, 54, 38, 6, '#d8c49a'); $this->hi(36, 36, 12, 6); } private function paleMushroom(): void { $this->box(45, 40, 55, 82, '#f4f0e0'); $this->ell(50, 86, 14, 6, '#e0dac4'); $this->poly([20, 46, 50, 12, 80, 46], '#e8e2cf'); $this->ell(50, 46, 30, 6, '#e8e2cf'); $this->poly([40, 56, 60, 56, 64, 64, 36, 64], '#ffffff'); foreach ([[40, 32], [58, 28], [52, 40]] as [$x, $y]) { $this->ell($x, $y, 3, 2.4, '#c8c2a8'); } $this->hi(38, 34, 6, 4, 70); } private function steak(bool $cooked): void { $base = $cooked ? '#8e4f2a' : '#c8434a'; $in = $cooked ? '#a8643a' : '#e06d72'; $fat = $cooked ? '#d8b07a' : '#f4e6d8'; $this->poly([16, 50, 26, 24, 58, 16, 86, 30, 88, 60, 70, 82, 36, 84, 18, 72], $fat); $this->poly([22, 50, 30, 30, 58, 22, 80, 34, 82, 58, 66, 76, 38, 78, 24, 68], $base); $this->ell(52, 50, 20, 16, $in); $this->ell(64, 60, 7, 7, '#f4ecd8'); $this->ell(64, 60, 3, 3, '#c8b088'); if ($cooked) { foreach ([30, 44, 58] as $x) { $this->seg($x, 30, $x + 18, 70, 3, '#4a2614'); } $this->cooked(); } else { $this->path([34, 42, 42, 46, 46, 40, 56, 44], 1.6, '#f4c8c8'); $this->hi(38, 34, 10, 5, 70); } } private function hanging(string $what): void { $this->seg(10, 10, 90, 10, 4, self::WOOD_DK); $this->seg(50, 10, 50, 26, 2, self::CORD); if ($what === 'fish') { $this->poly([42, 24, 58, 24, 50, 34], '#a8642a'); $this->ell(50, 58, 14, 26, '#a8642a'); $this->ell(46, 54, 6, 18, '#c8843a'); $this->ell(50, 78, 3, 3, '#1a1a1a'); $this->seg(42, 50, 58, 54, 2, '#6a3a1a'); $this->seg(42, 62, 58, 66, 2, '#6a3a1a'); } else { $this->poly([34, 28, 66, 28, 72, 70, 50, 88, 28, 70], '#6a2e1e'); $this->poly([38, 32, 62, 32, 66, 66, 50, 80, 34, 66], '#8e3e24'); $this->ell(50, 26, 8, 4, '#f4ecd8'); $this->seg(38, 50, 62, 56, 2, '#d8a070'); } $this->wisp(28, 92, 50); $this->wisp(74, 90, 54); } private function jerky(): void { foreach ([[18, -20, '#6e3a24'], [40, -10, '#7e4428'], [62, 0, '#5e3020']] as [$x, $t, $c]) { $this->turned((float) $t, function () use ($x, $c): void { $this->poly([$x, 12, $x + 18, 14, $x + 16, 88, $x + 2, 86, $x + 4, 50], $c); $this->seg($x + 6, 20, $x + 10, 80, 1.6, '#a86a44'); }); } } private function fish(bool $cooked): void { $base = $cooked ? '#c08240' : '#8fb2c8'; $back = $cooked ? '#8a5428' : '#5a7a96'; $this->poly([66, 50, 92, 28, 88, 50, 92, 72], $base); $this->ell(42, 50, 32, 19, $base); $this->poly([20, 40, 60, 32, 72, 44, 40, 44], $back); $this->poly([40, 32, 54, 20, 58, 34], $back); $this->ell(24, 47, 4, 4, '#1a1a1a'); $this->arc(32, 50, 10, 300, 60, 2, $back); if ($cooked) { foreach ([36, 48, 60] as $x) { $this->seg($x, 36, $x - 6, 66, 3, '#4a2614'); } $this->cooked(); } else { $this->hi(36, 56, 14, 4, 70); } } private function worms(): void { foreach ([[18, 34, 1.0], [24, 54, -1.0], [16, 74, 1.0]] as [$x, $y, $s]) { $pts = []; for ($i = 0; $i < 8; $i++) { $pts[] = $x + $i * 9; $pts[] = $y + $s * sin($i * 1.2) * 6; } $this->path($pts, 8, '#e08f8f'); $this->ell($pts[0], $pts[1], 4.4, 4.4, '#c86a6a'); $this->seg($x + 18, $y - 6, $x + 18, $y + 6, 2, '#c86a6a'); } } private function wormSkewer(): void { $this->turned(-45, function (): void { $this->seg(0, 50, 100, 50, 4, self::WOOD_LT); foreach ([24, 44, 64] as $x) { $this->path([$x - 4, 38, $x + 4, 44, $x - 4, 50, $x + 4, 56, $x - 4, 62], 7, '#8e5a32'); } }); $this->cooked(); } private function claw(): void { $this->seg(18, 84, 40, 62, 14, '#6a7a5a'); $this->ell(52, 48, 22, 18, '#7a8a64'); $this->poly([56, 34, 70, 10, 84, 14, 74, 36], '#7a8a64'); $this->poly([66, 50, 92, 40, 92, 52, 70, 60], '#6a7a5a'); $this->ell(14, 88, 9, 8, '#f4e8e0'); $this->ell(14, 88, 5, 4, '#f0b8a8'); $this->hi(44, 42, 8, 5, 50); } private function crab(): void { foreach ([-1, 1] as $s) { for ($i = 0; $i < 3; $i++) { $this->path([50 + $s * 22, 56 + $i * 7, 50 + $s * 36, 60 + $i * 9, 50 + $s * 40, 72 + $i * 6], 3.4, '#c8402a'); } $this->path([50 + $s * 16, 44, 50 + $s * 30, 30, 50 + $s * 32, 20], 4, '#c8402a'); $this->ell(50 + $s * 32, 18, 8, 7, '#d8502e'); $this->poly([50 + $s * 30, 10, 50 + $s * 34, 18, 50 + $s * 28, 16], '#7a2a1a'); } $this->ell(50, 56, 24, 17, '#e05a32'); $this->ell(44, 46, 3, 3, '#1a1a1a'); $this->ell(56, 46, 3, 3, '#1a1a1a'); $this->hi(42, 52, 9, 5); $this->cooked(); } private function root(): void { $this->poly([34, 26, 60, 22, 66, 44, 58, 70, 46, 92, 40, 66, 30, 44], '#b8935e'); $this->poly([34, 26, 46, 24, 48, 48, 42, 70, 30, 44], '#d0aa72'); foreach ([[36, 40, 20, 36], [62, 50, 80, 54], [42, 62, 26, 70], [56, 74, 72, 82]] as [$a, $b, $c, $d]) { $this->seg($a, $b, $c, $d, 2.4, '#8a6a3e'); } foreach ([38, 48, 58] as $i => $x) { $this->seg(48, 24, $x - 10 + $i * 8, 6, 4, self::LEAF); } } private function rootCooked(): void { foreach ([[28, -30], [58, -30]] as [$x, $t]) { $this->turned((float) $t, function () use ($x): void { $this->ell($x + 8, 50, 14, 26, '#7a3e1a'); $this->ell($x + 10, 50, 9, 21, '#e88a3a'); $this->ell($x + 10, 44, 4, 8, '#ffb870'); }); } $this->cooked(); } private function ration(): void { $this->poly([10, 42, 80, 22, 90, 56, 20, 78], '#b8a070'); $this->poly([10, 42, 80, 22, 82, 30, 12, 50], '#d8c48e'); $this->poly([40, 34, 58, 29, 66, 62, 48, 68], '#3d6fb0'); $this->poly([47, 44, 52, 43, 54, 54, 49, 55], self::WHITE); $this->poly([44, 48, 56, 45, 57, 50, 45, 53], self::WHITE); } private function rotten(): void { $this->poly([22, 60, 30, 42, 52, 36, 74, 44, 82, 64, 66, 82, 34, 82], '#7a7a3a'); $this->ell(44, 58, 8, 6, '#5a6a2a'); $this->ell(62, 66, 6, 5, '#4a5a22'); $this->ell(56, 50, 4, 3, '#9aa850'); foreach ([[30, 22], [70, 18]] as [$x, $y]) { $this->ell($x, $y, 4, 3.4, '#1a1a1a'); $this->ell($x - 4, $y - 4, 4, 2.4, '#d0e0f0'); $this->ell($x + 4, $y - 4, 4, 2.4, '#d0e0f0'); } $this->wisp(46, 34, 22, '#a8c050', 50); $this->wisp(58, 34, 24, '#a8c050', 50); } // ---- water ---------------------------------------------------------------------------------------- private function gourd(?string $water, string $state): void { $this->ell(46, 62, 30, 28, '#c9a86a'); $this->ell(46, 30, 15, 15, '#c9a86a'); $this->box(39, 6, 53, 18, self::WOOD_DK); $this->arc(46, 46, 30, 200, 340, 3, self::LEATHER_DK); if ($water !== null) { $this->ell(46, 66, 22, 18, $water); $this->poly([24, 62, 68, 62, 68, 60, 24, 60], self::WATER_LT); $this->hi(38, 64, 4, 6, 50); } else { $this->ell(46, 66, 22, 18, '#a8884e'); $this->ell(46, 66, 18, 14, '#8a6c3a'); } $this->hi(34, 50, 6, 10, 60); match ($state) { 'dirty' => $this->badge('#4a3418', 'mud'), 'filtered' => $this->badge('#a8b2bc', 'filter'), 'boiled' => $this->badge('#e0402a', 'steam'), 'purified' => $this->badge('#3a8ae0', 'tablet'), 'clean' => $this->badge('#1e7a3e', 'spring'), default => null, }; } private function waterskin(): void { $this->arc(50, 40, 30, 200, 340, 3.5, self::LEATHER_DK); $this->poly([42, 14, 58, 14, 60, 30, 82, 50, 80, 84, 20, 84, 18, 50, 40, 30], self::LEATHER); $this->box(40, 28, 60, 34, self::CORD); $this->path([24, 60, 34, 70, 30, 78], 2, self::LEATHER_DK); $this->path([20, 82, 50, 78, 80, 82], 2, self::LEATHER_DK); $this->ell(50, 64, 10, 10, self::WATER); $this->hi(32, 52, 6, 10, 60); } private function jug(): void { $this->ell(50, 64, 28, 26, '#b8603a'); $this->box(40, 18, 60, 44, '#b8603a'); $this->rbox(38, 10, 62, 20, 3, self::WOOD_DK); $this->arc(66, 44, 12, 270, 90, 4.5, '#984a2a'); $this->box(24, 58, 76, 70, '#e8c050'); foreach ([[36, 62], [50, 66], [62, 61]] as [$x, $y]) { $this->ell($x, $y, 2, 2, '#fff4c8'); } $this->hi(38, 52, 6, 9, 60); } private function filter(): void { $this->poly([20, 14, 80, 14, 62, 66, 38, 66], '#c9a86a'); $this->box(27, 20, 73, 30, '#2c2c30'); $this->poly([30, 30, 70, 30, 66, 42, 34, 42], '#e0cc90'); $this->poly([34, 42, 66, 42, 63, 52, 37, 52], '#8fae52'); $this->box(46, 66, 54, 72, '#8a6440'); $this->poly([50, 74, 58, 86, 42, 86], self::WATER); $this->ell(50, 88, 8, 6, self::WATER); } private function blister(): void { $this->rbox(14, 26, 86, 76, 6, '#c8ccd2'); $this->rbox(14, 26, 86, 34, 4, '#3d8fd0'); foreach ([30, 50, 70] as $x) { foreach ([46, 64] as $y) { $this->ell($x, $y, 8, 7, '#eef2f6'); $this->ell($x - 2, $y - 2, 3, 2, '#ffffff'); } } $this->ell(70, 64, 8, 7, '#9aa0a8'); } // ---- tools ---------------------------------------------------------------------------------------- private function knife(): void { $this->turned(-45, function (): void { $this->rbox(4, 43, 44, 57, 5, self::WOOD); $this->box(8, 45, 42, 48, self::WOOD_LT); foreach ([14, 22, 30] as $x) { $this->box($x, 42, $x + 4, 58, self::CORD); } $this->poly([42, 41, 104, 45, 88, 57, 42, 59], self::FLINT); $this->poly([42, 41, 104, 45, 86, 49, 42, 48], self::FLINT_LT); foreach ([52, 64, 76] as $x) { $this->arc($x, 60, 5, 200, 340, 1.6, '#3a424e'); } }); } private function axe(): void { $this->turned(-45, function (): void { $this->seg(0, 54, 96, 54, 9, self::WOOD); $this->seg(2, 52, 94, 52, 2.4, self::WOOD_LT); $this->poly([68, 24, 92, 26, 92, 82, 68, 84, 76, 54], '#7c828a'); $this->poly([68, 24, 92, 26, 90, 40, 70, 40], '#a8aeb6'); $this->seg(66, 48, 94, 62, 4, self::CORD); $this->seg(66, 62, 94, 48, 4, self::CORD); }); } private function torch(): void { $this->seg(36, 92, 54, 50, 9, self::WOOD); $this->seg(48, 58, 58, 38, 15, '#5a4026'); foreach ([[46, 52], [50, 44]] as [$x, $y]) { $this->seg($x, $y, $x + 12, $y + 4, 2.4, self::CORD); } $this->flameShape(58, 32, 0.72, '#e8742a', '#ffd25a'); $this->glow(58, 24, 22, '#ffb040'); } private function bowDrill(): void { $this->rbox(10, 74, 90, 86, 3, self::WOOD); $this->box(12, 74, 88, 77, self::WOOD_LT); $this->seg(48, 76, 52, 16, 6, self::WOOD_LT); $this->rbox(40, 10, 62, 18, 3, '#8d9096'); $this->arc(30, 46, 22, 270, 90, 4, self::WOOD_DK); $this->seg(30, 24, 51, 46, 1.6, '#e8e2d0'); $this->seg(30, 68, 51, 46, 1.6, '#e8e2d0'); $this->ell(50, 76, 6, 4, '#ff7a2a'); $this->wisp(58, 72, 22); } private function fishingLine(): void { $this->arc(52, 20, 12, 180, 360, 4, self::WOOD); $this->seg(40, 20, 40, 34, 4, self::WOOD); $this->seg(64, 20, 64, 86, 1.6, '#e8e8e0'); $this->ell(64, 40, 8, 10, '#d23a3a'); $this->poly([56, 40, 72, 40, 64, 50], self::WHITE); $this->ell(64, 40, 8, 2, self::WHITE); $this->arc(52, 78, 12, 0, 160, 4.5, '#d8dde2'); $this->seg(40, 78, 40, 70, 4.5, '#d8dde2'); $this->poly([36, 70, 40, 62, 44, 72], '#d8dde2'); } private function pot(): void { $this->poly([18, 38, 82, 38, 76, 80, 24, 80], '#4a4a52'); $this->ell(50, 80, 26, 8, '#4a4a52'); $this->rbox(12, 30, 88, 40, 4, '#5e5e68'); $this->arc(12, 48, 7, 90, 270, 4, '#5e5e68'); $this->arc(88, 48, 7, 270, 90, 4, '#5e5e68'); $this->box(18, 32, 82, 36, '#8a4a2a'); $this->hi(30, 50, 5, 12, 80); $this->wisp(38, 26, 20); $this->wisp(60, 26, 22); } private function snare(): void { $this->seg(18, 92, 18, 14, 7, self::WOOD); $this->seg(18, 14, 76, 22, 4, self::WOOD_LT); $this->seg(72, 22, 66, 40, 1.6, self::CORD); $this->arc(62, 60, 20, 0, 360, 3.2, self::CORD); $this->seg(6, 92, 94, 92, 4, '#6a5a3a'); $this->ell(18, 92, 7, 3, '#6a5a3a'); } private function spikes(): void { $this->ell(50, 82, 44, 12, '#5a4026'); foreach ([[22, 30], [38, 20], [54, 26], [70, 16], [84, 32]] as $i => [$x, $top]) { $this->poly([$x - 6, 84, $x + 6, 84, $x + 1, $top], $i % 2 ? self::WOOD : self::WOOD_LT); $this->ell($x + 1, $top + 6, 1.4, 4, '#ffffff', 60); } $this->seg(10, 62, 92, 58, 3, self::CORD); } private function leanTo(): void { // a slanted frame of branches covered with leaves $this->seg(10, 88, 72, 20, 6, self::WOOD); $this->seg(62, 20, 90, 88, 6, self::WOOD_DK); foreach ([[24, 74], [36, 60], [48, 46], [60, 32]] as $i => [$x, $y]) { $this->ell($x + 4, $y, 14, 7, $i % 2 ? self::LEAF : '#3f8a34'); } $this->seg(6, 90, 94, 90, 3, '#6a5a3a'); } /** A chest seen three-quarters: a body of planks, a domed lid, bands and a lock; the crate: grey, riveted, rust bands. */ private function chest(bool $metal): void { $body = $metal ? '#7a6e62' : self::WOOD; $dark = $metal ? '#544a40' : self::WOOD_DK; $band = $metal ? '#a0582e' : '#3a3a40'; $this->box(14, 46, 86, 86, $body); foreach ([60, 73] as $y) { $this->seg(16, $y, 84, $y, 1.5, $dark); } $this->rbox(10, 26, 90, 48, 9, $metal ? '#8a7e70' : self::WOOD_LT); $this->seg(12, 47, 88, 47, 3, $dark); foreach ([30, 70] as $x) { $this->box($x - 4, 26, $x + 4, 86, $band); } if ($metal) { foreach ([[14, 26], [86, 26], [14, 86], [86, 86]] as [$x, $y]) { $this->box($x - 5, $y - 2, $x + 5, $y + 2, self::STEEL_DK); } foreach ([20, 40, 60, 80] as $x) { $this->ell($x, 66, 2, 2, self::STEEL_LT); } } $this->rbox(43, 42, 57, 60, 3, $metal ? self::STEEL : self::GOLD); $this->ell(50, 52, 2.5, 3, self::OUTLINE); $this->hi(26, 34, 10, 4); } /** A woven basket: a flared round body crossed by weave rows, a braided rim and a loop handle. */ private function basket(): void { $this->arc(50, 40, 28, 180, 360, 5, self::WOOD_DK); $this->poly([14, 40, 86, 40, 76, 88, 24, 88], '#d4a862'); foreach ([52, 64, 76] as $i => $y) { $this->seg(16 + $i * 3, $y, 84 - $i * 3, $y, 3, '#a87a3c'); } foreach ([30, 42, 54, 66] as $x) { $this->seg($x, 42, $x + ($x < 50 ? -2 : 2), 87, 2, '#b8884a'); } $this->ell(50, 40, 37, 7, '#e6c27a'); $this->ell(50, 40, 31, 4, '#6a4a24'); $this->hi(28, 56, 6, 12); } private function pyre(): void { // a ready fire: sticks in a teepee over tinder, not lit foreach ([[18, 86, 52, 18], [82, 86, 48, 18], [34, 88, 52, 20], [66, 88, 50, 20]] as $i => [$a, $b, $c, $d]) { $this->seg($a, $b, $c, $d, 7, $i % 2 ? self::WOOD : self::WOOD_DK); } $this->ell(50, 80, 18, 8, '#c6a062'); $this->seg(14, 92, 86, 92, 6, '#8d9096'); foreach ([14, 30, 50, 70, 86] as $x) { $this->ell($x, 92, 6, 4, '#8d9096'); } } private function scanner(): void { // a handheld with a round radar screen $this->seg(72, 22, 84, 8, 3, self::STEEL_DK); $this->ell(85, 7, 3.5, 3.5, '#d23a3a'); $this->rbox(16, 18, 84, 82, 12, '#e0a83a'); $this->rbox(20, 22, 80, 78, 9, '#3a4048'); $this->ell(50, 50, 24, 24, '#0e2a1c'); $this->arc(50, 50, 16, 0, 360, 1.2, '#3ad07a'); $this->seg(26, 50, 74, 50, 1, '#3ad07a'); $this->seg(50, 26, 50, 74, 1, '#3ad07a'); $this->poly([50, 50, 72, 38, 74, 50], '#3ad07a', 50); $this->seg(50, 50, 72, 38, 2, '#9affc0'); $this->ell(62, 62, 3, 3, '#ffe060'); $this->ell(38, 40, 2.4, 2.4, '#9affc0'); } private function gps(): void { // a handheld with an antenna, a rectangular map screen and a pin $this->seg(64, 22, 66, 4, 6, '#2e3036'); $this->rbox(26, 18, 74, 92, 8, '#ffd24a'); $this->rbox(31, 26, 69, 64, 3, '#cfe8c8'); $this->path([31, 50, 44, 44, 52, 52, 69, 40], 2, '#5aa0d8'); $this->seg(40, 26, 46, 64, 1.6, '#e0d0a0'); $this->ell(54, 38, 6, 6, '#d23a3a'); $this->poly([49, 40, 59, 40, 54, 50], '#d23a3a'); $this->ell(54, 38, 2.2, 2.2, '#ffffff'); $this->ell(42, 76, 5, 5, '#2e3036'); $this->ell(58, 76, 5, 5, '#2e3036'); } private function needle(): void { $this->turned(-45, function (): void { $this->poly([10, 47, 80, 48, 100, 50, 80, 52, 10, 53], '#efe8d6'); $this->ell(14, 50, 4, 2, '#5a4a30'); }); $this->path([24, 78, 14, 66, 24, 54, 40, 62, 36, 80, 52, 88, 70, 82], 2, '#c8402a'); } private function pole(): void { $this->turned(-45, function (): void { $this->seg(-14, 50, 114, 50, 7, self::WOOD_LT); $this->seg(-12, 48, 112, 48, 2, '#e0b27a'); foreach ([10, 22] as $x) { $this->box($x, 45, $x + 5, 55, self::CORD); } $this->poly([96, 44, 116, 40, 116, 60, 96, 56], self::WOOD); }); $this->path([6, 92, 16, 86, 26, 92, 36, 86, 46, 92], 3.5, self::WATER); $this->path([54, 92, 64, 86, 74, 92, 84, 86, 94, 92], 3.5, self::WATER); } private function stakes(): void { // three metal pitons with rings, fanned foreach ([-20, 0, 20] as $t) { $this->turned((float) $t, function (): void { $this->poly([45, 26, 55, 26, 52, 94, 48, 94], self::STEEL); $this->poly([45, 26, 50, 26, 49, 94, 48, 94], self::STEEL_LT); $this->rbox(42, 8, 58, 28, 6, self::STEEL_DK); $this->ell(50, 18, 4, 5, self::OUTLINE); }, 50, 94); } } private function iceAxe(): void { $this->turned(-45, function (): void { $this->seg(-4, 50, 94, 50, 7, '#3a6ab0'); $this->seg(-2, 48, 92, 48, 2, '#6a9ad8'); $this->poly([-10, 50, 0, 46, 0, 54], self::STEEL); $this->poly([86, 18, 98, 18, 98, 50, 94, 84, 86, 50], self::STEEL); $this->poly([86, 18, 98, 18, 98, 30, 86, 30], self::STEEL_LT); $this->poly([86, 50, 94, 84, 90, 88, 84, 60], self::STEEL_DK); }); } // ---- weapons -------------------------------------------------------------------------------------- private function spear(): void { $this->turned(-45, function (): void { $this->seg(-14, 50, 86, 50, 6, self::WOOD); $this->seg(-12, 48.5, 84, 48.5, 1.8, self::WOOD_LT); $this->poly([76, 50, 90, 36, 118, 50, 90, 64], self::FLINT); $this->poly([76, 50, 90, 36, 118, 50], self::FLINT_LT); $this->box(72, 44, 82, 56, self::CORD); }); [$x, $y] = [62.0, 46.0]; $this->path([$x, $y, $x - 2, $y + 10, $x + 2, $y + 18], 3, self::CORD); $this->ell($x + 2, $y + 22, 3.4, 7, '#d8343c'); } private function harpoon(): void { $this->turned(-45, function (): void { $this->seg(-14, 50, 84, 50, 5, self::WOOD); $this->seg(80, 50, 98, 50, 4, self::STEEL); $this->poly([96, 42, 116, 50, 96, 58], self::STEEL); $this->poly([90, 50, 82, 38, 94, 48], self::STEEL); $this->poly([90, 50, 82, 62, 94, 52], self::STEEL); }); $this->arc(24, 76, 15, 0, 360, 3, self::CORD); $this->arc(26, 74, 9, 0, 360, 3, self::CORD); $this->path([38, 70, 48, 66, 56, 56], 2.4, self::CORD); } private function club(): void { $this->turned(-45, function (): void { $this->poly([0, 46, 40, 44, 104, 34, 104, 66, 40, 56, 0, 54], self::WOOD); $this->ell(100, 50, 8, 16, self::WOOD); $this->poly([40, 44, 104, 34, 104, 42, 40, 48], self::WOOD_LT); foreach ([[64, 48], [80, 56], [90, 44]] as [$x, $y]) { $this->ell($x, $y, 3.4, 3, self::WOOD_DK); } $this->box(4, 45, 22, 55, self::LEATHER_DK); }); } /** A round shield seen from the front: a laced hide on a stick frame, or riveted scrap plates on a hide lining. */ private function shield(bool $scrap): void { if ($scrap) { $this->ell(50, 50, 40, 42, self::STEEL_DK); $this->ell(50, 50, 35, 37, '#7a5a40'); $this->poly([22, 28, 52, 20, 54, 50, 18, 54], self::STEEL); $this->poly([54, 18, 80, 30, 82, 54, 56, 50], '#b0603a'); $this->poly([18, 56, 52, 52, 50, 84, 28, 76], '#9a5232'); $this->poly([54, 52, 84, 56, 72, 80, 52, 86], self::STEEL); $this->rbox(40, 40, 60, 60, 4, self::STEEL_LT); for ($k = 0; $k < 12; $k++) { $a = $k / 12 * 2 * M_PI + 0.2; $this->ell(50 + cos($a) * 31, 50 + sin($a) * 33, 2.2, 2.2, '#3a3a3e'); } $this->hi(36, 32, 12, 7, 70); return; } $this->ell(50, 50, 40, 42, self::WOOD_DK); $this->ell(50, 50, 35, 37, '#d8b48a'); $this->ell(50, 50, 26, 28, '#c89c70'); $this->seg(50, 16, 50, 84, 3, self::WOOD, 70); $this->seg(16, 50, 84, 50, 3, self::WOOD, 70); $this->arc(50, 50, 22, 200, 340, 4, '#9c2e1e'); for ($k = 0; $k < 16; $k++) { $a = $k / 16 * 2 * M_PI; $this->seg(50 + cos($a) * 34, 50 + sin($a) * 36, 50 + cos($a) * 40, 50 + sin($a) * 42, 2.2, self::CORD); } $this->ell(50, 50, 5, 5, self::LEATHER_DK); $this->hi(36, 32, 12, 7, 70); } private function machete(): void { $this->turned(-40, function (): void { $this->rbox(-6, 43, 30, 57, 5, '#2b2b2e'); $this->ell(6, 50, 2.4, 2.4, self::STEEL_LT); $this->ell(20, 50, 2.4, 2.4, self::STEEL_LT); $this->box(28, 40, 33, 60, self::STEEL_DK); $this->poly([32, 42, 96, 36, 114, 42, 106, 60, 32, 58], self::STEEL); $this->poly([32, 54, 106, 54, 106, 60, 32, 58], self::STEEL_LT); }); } private function bow(): void { $this->arc(18, 50, 44, 300, 60, 7, self::WOOD); $this->arc(18, 50, 44, 340, 20, 9, self::LEATHER_DK); $this->seg(40, 12, 40, 88, 1.8, '#e8e2d0'); } private function crossbow(): void { $this->rbox(44, 26, 56, 92, 4, self::WOOD); $this->rbox(42, 70, 58, 92, 5, self::WOOD_DK); $this->arc(50, 58, 40, 220, 320, 6, self::STEEL_DK); $this->seg(19, 32, 50, 44, 1.6, '#e8e2d0'); $this->seg(81, 32, 50, 44, 1.6, '#e8e2d0'); $this->seg(50, 44, 50, 14, 3.5, '#8a5a32'); $this->poly([44, 16, 50, 4, 56, 16], self::STEEL); $this->box(47, 60, 53, 66, '#2e3036'); } private function sling(): void { $this->path([30, 10, 24, 30, 30, 52, 40, 66], 2.6, self::CORD); $this->path([70, 10, 76, 30, 70, 52, 60, 66], 2.6, self::CORD); $this->ell(30, 10, 5, 5, self::CORD); $this->ell(50, 74, 22, 14, self::LEATHER); $this->ell(50, 68, 13, 11, '#8d9096'); $this->hi(46, 64, 5, 4); } private function flareGun(): void { $this->rbox(14, 30, 84, 52, 6, '#e8742a'); $this->ell(84, 41, 8, 13, '#e8742a'); $this->ell(86, 41, 4, 7, '#2a1a10'); $this->poly([22, 48, 44, 48, 48, 88, 28, 90], '#c85a1a'); $this->arc(52, 54, 8, 0, 180, 3, '#c85a1a'); $this->box(18, 34, 70, 38, '#ffa060'); } private function plasmaGun(): void { $this->poly([10, 40, 56, 34, 62, 54, 14, 56], self::TECH); $this->poly([18, 52, 38, 52, 34, 88, 16, 86], self::TECH); $this->ell(70, 44, 18, 18, self::TECH_LT); $this->ell(70, 44, 12, 12, '#9aff6a'); $this->ell(66, 40, 4, 4, '#eaffd8'); $this->box(20, 42, 50, 45, '#9aff6a'); $this->box(88, 40, 94, 48, self::TECH); $this->glow(70, 44, 24, '#9aff6a'); } private function rifle(bool $broken): void { $body = $broken ? '#5a6068' : self::TECH; $glow = $broken ? '#7a8a90' : self::CYAN; $this->turned(-30, function () use ($body, $glow, $broken): void { $gap = $broken ? 6.0 : 0.0; // stock and grip $this->poly([2, 44, 30, 42, 34, 54, 4, 64], $body); $this->poly([34, 52, 46, 52, 42, 72, 32, 70], $body); // body, then the barrel (split when broken) $this->rbox(28, 38, 62 - $gap, 54, 4, $body); $this->rbox(62 + $gap, 40, 108, 50, 3, $body); foreach ([40, 48, 56] as $x) { $this->box($x, 42, $x + 4, 50, $glow); } $this->box(66 + $gap, 43, 104, 46, $glow); }); if ($broken) { $this->badge(self::RED, 'broken'); } else { $this->glow(84, 32, 18); } } private function blueprint(string $what): void { $this->poly([12, 14, 80, 14, 88, 22, 88, 86, 12, 86], '#2a5a9a'); $this->poly([80, 14, 88, 22, 80, 22], '#6a9ad8'); for ($x = 22; $x < 88; $x += 12) { $this->seg($x, 16, $x, 84, 0.8, '#4a7abe'); } for ($y = 26; $y < 86; $y += 12) { $this->seg(14, $y, 86, $y, 0.8, '#4a7abe'); } $w = '#e8f2ff'; match ($what) { 'crossbow' => (function () use ($w): void { $this->seg(50, 30, 50, 78, 3, $w); $this->arc(50, 60, 26, 220, 320, 3, $w); $this->path([30, 44, 50, 50, 70, 44], 1.4, $w); })(), 'blade' => (function () use ($w): void { $this->poly([28, 72, 66, 30, 72, 34, 34, 76], $w); $this->seg(20, 80, 30, 70, 5, $w); $this->seg(26, 64, 38, 76, 2.4, $w); })(), default => (function () use ($w): void { $this->seg(20, 54, 80, 46, 4, $w); $this->seg(22, 56, 30, 70, 4, $w); $this->seg(40, 54, 42, 66, 3, $w); $this->ell(60, 48, 4, 4, '#4fe0ff'); })(), }; } // ---- clothing ------------------------------------------------------------------------------------- private function flightSuit(): void { $c = '#46607a'; $this->poly([30, 10, 70, 10, 92, 34, 82, 44, 72, 34, 72, 54, 70, 92, 54, 92, 50, 60, 46, 92, 30, 92, 28, 54, 28, 34, 18, 44, 8, 34], $c); $this->poly([40, 10, 60, 10, 50, 22], '#2e4256'); $this->seg(50, 22, 50, 56, 2, '#c4c8ce'); $this->box(28, 50, 72, 55, '#22262c'); $this->box(60, 22, 68, 30, '#e2843a'); // tears $this->poly([30, 66, 40, 70, 34, 74, 42, 80, 30, 82], '#1a2028'); $this->poly([72, 38, 82, 44, 76, 46], '#1a2028'); $this->hi(36, 24, 6, 8, 80); } private function helmet(): void { $this->ell(50, 50, 36, 36, '#e4e8ec'); $this->box(14, 50, 86, 70, '#e4e8ec'); $this->rbox(22, 40, 84, 62, 10, '#2a3a52'); $this->poly([28, 44, 46, 44, 36, 58, 26, 58], '#5a7aa8'); $this->box(14, 34, 86, 38, '#e2843a'); $this->rbox(14, 66, 30, 84, 4, '#b8bcc2'); $this->hi(34, 24, 12, 6); } private function beanie(): void { $this->ell(50, 58, 34, 34, self::LEATHER); $this->box(10, 58, 90, 94, self::LEATHER); $this->rbox(12, 66, 88, 84, 4, self::LEATHER_DK); $this->seg(50, 26, 50, 64, 2, self::LEATHER_DK); $this->path([24, 74, 30, 78, 36, 74, 42, 78, 48, 74, 54, 78, 60, 74, 66, 78, 72, 74], 1.4, self::CORD); $this->hi(36, 40, 9, 7); // trim the overflow at the bottom imagealphablending($this->im, false); $k = $this->k; imagefilledrectangle($this->im, 0, (int) (85 * $k), imagesx($this->im), imagesy($this->im), imagecolorallocatealpha($this->im, 0, 0, 0, 127)); imagealphablending($this->im, true); } private function furHat(): void { $this->ell(50, 46, 30, 28, '#8a6440'); $this->rbox(14, 50, 86, 66, 8, self::FUR); $this->rbox(12, 54, 28, 90, 8, self::FUR); $this->rbox(72, 54, 88, 90, 8, self::FUR); foreach ([18, 30, 42, 54, 66, 78] as $x) { $this->ell($x, 52, 5, 4, self::FUR); } $this->seg(20, 60, 22, 80, 2, self::FUR_DK); $this->seg(80, 60, 78, 80, 2, self::FUR_DK); $this->hi(40, 32, 9, 6); } private function undershirt(): void { $c = '#6c7a88'; $this->poly([30, 12, 70, 12, 88, 22, 94, 74, 82, 76, 74, 40, 72, 90, 28, 90, 26, 40, 18, 76, 6, 74, 12, 22], $c); $this->ell(50, 14, 10, 5, '#3e4650'); for ($y = 30; $y <= 84; $y += 8) { $this->seg(32, $y, 68, $y, 1.4, '#8a98a6'); } $this->box(6, 70, 18, 76, '#3e4650'); $this->box(82, 70, 94, 76, '#3e4650'); $this->hi(38, 26, 6, 8, 80); } private function tunic(): void { $c = '#b8a670'; $this->poly([34, 8, 66, 8, 74, 22, 76, 94, 24, 94, 26, 22], $c); $this->ell(50, 10, 9, 5, '#6a5a30'); for ($y = 26; $y <= 90; $y += 8) { $this->seg(28, $y, 72, $y, 1.2, '#968650'); } for ($x = 32; $x <= 68; $x += 8) { $this->seg($x, 24, $x, 92, 1.2, '#968650'); } $this->box(24, 52, 76, 60, self::LEATHER_DK); $this->box(46, 51, 54, 61, self::GOLD); } private function rags(): void { $c = '#9b8f78'; $this->poly([30, 14, 70, 14, 90, 30, 80, 42, 72, 36, 72, 70, 66, 80, 60, 72, 54, 86, 46, 74, 40, 84, 34, 72, 28, 78, 28, 36, 20, 42, 10, 30], $c); $this->ell(50, 16, 9, 5, '#5a5040'); $this->ell(40, 46, 4, 6, '#3a3428'); $this->ell(60, 58, 5, 3, '#3a3428'); $this->box(52, 30, 62, 40, '#7a6e58'); $this->path([52, 30, 62, 30, 62, 40, 52, 40, 52, 30], 1, '#5a5040'); } private function jacket(string $c, string $dark, string $kind): void { $this->poly([30, 12, 70, 12, 90, 24, 94, 82, 80, 84, 74, 44, 74, 90, 26, 90, 26, 44, 20, 84, 6, 82, 10, 24], $c); // open front, collar $this->poly([44, 12, 56, 12, 54, 90, 46, 90], $dark); $this->poly([30, 12, 44, 12, 46, 34], $kind === 'scale' ? '#26584e' : '#c49a6a'); $this->poly([70, 12, 56, 12, 54, 34], $kind === 'scale' ? '#26584e' : '#c49a6a'); if ($kind === 'scale') { for ($y = 40; $y <= 84; $y += 8) { foreach ([[30, 40], [58, 68]] as [$a, $b]) { for ($x = $a + ($y % 16 ? 4 : 0); $x <= $b; $x += 8) { $this->arc($x, $y, 4, 0, 180, 1.5, '#9ee0c8'); } } } } else { foreach ([36, 50, 64] as $y) { $this->seg(42, $y, 58, $y + 4, 1.6, self::CORD); } $this->box(28, 60, 42, 72, $dark); } $this->hi(32, 28, 6, 8, 80); } private function furCoat(): void { $this->poly([30, 10, 70, 10, 88, 22, 94, 80, 80, 82, 78, 42, 82, 96, 18, 96, 22, 42, 20, 82, 6, 80, 12, 22], self::FUR); $this->seg(50, 22, 50, 96, 2, self::FUR_DK); foreach ([[30, 8], [42, 6], [50, 8], [58, 6], [70, 8], [36, 16], [64, 16]] as [$x, $y]) { $this->ell($x, $y + 4, 8, 6, '#f6f2e8'); } foreach ([[12, 80], [88, 80]] as [$x, $y]) { $this->ell($x, $y, 9, 6, '#f6f2e8'); } foreach ([[34, 40], [64, 52], [36, 70], [62, 80]] as [$x, $y]) { $this->seg($x - 4, $y - 3, $x + 4, $y + 3, 2.4, self::FUR_DK); } foreach ([40, 58, 76] as $y) { $this->ell(54, $y, 2.4, 2.4, self::LEATHER_DK); } } private function trousers(bool $fur): void { $c = $fur ? self::FUR : '#7e5836'; $this->poly([26, 10, 74, 10, 80, 90, 58, 90, 50, 36, 42, 90, 20, 90], $c); $this->box(26, 10, 74, 18, $fur ? '#a88a5e' : '#4e3420'); if ($fur) { foreach ([[22, 90], [32, 90], [60, 90], [70, 90], [78, 90]] as [$x, $y]) { $this->ell($x, $y, 6, 5, '#f6f2e8'); } foreach ([[32, 34], [30, 58], [68, 40], [70, 66]] as [$x, $y]) { $this->seg($x - 4, $y - 3, $x + 4, $y + 3, 2.4, self::FUR_DK); } } else { $this->seg(36, 22, 32, 86, 1.6, self::CORD); $this->seg(64, 22, 68, 86, 1.6, self::CORD); $this->box(42, 10, 58, 22, '#4e3420'); } } private function glove(string $c, string $dark, string $kind): void { $this->rbox(30, 30, 70, 74, 12, $c); if ($kind === 'mitten') { $this->ell(50, 34, 20, 22, $c); $this->ell(26, 56, 9, 15, $c); $this->rbox(26, 70, 74, 92, 8, '#f6f2e8'); foreach ([32, 44, 56, 68] as $x) { $this->ell($x, 72, 5, 4, '#f6f2e8'); } $this->seg(36, 40, 36, 60, 2, $dark); return; } foreach ([36, 46, 56, 66] as $i => $x) { $this->seg($x, 36, $x + ($i - 1.5) * 1.5, 12 + abs($i - 1.5) * 5, 9, $c); } $this->seg(32, 56, 18, 40, 10, $c); $this->rbox(28, 72, 72, 90, 3, $dark); if ($kind === 'pilot') { $this->box(28, 76, 72, 80, '#e2843a'); $this->ell(64, 84, 3, 3, self::STEEL_LT); } else { $this->seg(36, 46, 62, 46, 1.4, self::CORD); } $this->hi(40, 44, 6, 6, 80); } private function boot(string $c, string $trim, bool $worn): void { $this->poly([30, 10, 60, 10, 60, 56, 86, 64, 92, 76, 92, 88, 26, 88], $c); $this->rbox(24, 80, 94, 90, 3, '#1e1a16'); $this->box(30, 10, 60, 18, $trim); foreach ([26, 36, 46] as $y) { $this->seg(38, $y, 54, $y + 4, 2, self::CORD); } if ($worn) { $this->poly([70, 66, 78, 64, 74, 74], '#1a1a1e'); $this->box(34, 58, 46, 70, '#6a5a48'); $this->seg(62, 76, 72, 74, 1.4, '#8a8a90'); } $this->hi(38, 28, 5, 10, 80); } private function patch(): void { $this->turned(-10, function (): void { $this->rbox(18, 18, 82, 82, 6, '#8a7a5a'); for ($i = 0; $i < 8; $i++) { $t = 24 + $i * 7; $this->seg($t, 24, $t + 3, 24, 1.6, self::WHITE); $this->seg($t, 76, $t + 3, 76, 1.6, self::WHITE); $this->seg(24, $t, 24, $t + 3, 1.6, self::WHITE); $this->seg(76, $t, 76, $t + 3, 1.6, self::WHITE); } $this->seg(30, 40, 70, 40, 1, '#6a5a3e'); $this->seg(30, 56, 70, 56, 1, '#6a5a3e'); }); $this->seg(62, 90, 94, 58, 2.4, self::STEEL_LT); } // ---- medical -------------------------------------------------------------------------------------- private function cross(float $cx, float $cy, float $s, string $col = self::RED): void { $this->box($cx - $s * 0.3, $cy - $s, $cx + $s * 0.3, $cy + $s, $col); $this->box($cx - $s, $cy - $s * 0.3, $cx + $s, $cy + $s * 0.3, $col); } private function bandage(): void { $this->poly([54, 58, 94, 72, 88, 88, 50, 78], self::WHITE); $this->ell(40, 50, 30, 30, self::WHITE); $this->ell(40, 50, 22, 22, '#e4e0d8'); $this->ell(40, 50, 9, 9, '#b8b2a6'); $this->cross(72, 76, 5); $this->hi(30, 36, 9, 6); } private function splint(): void { $this->rbox(24, 8, 38, 92, 3, self::WOOD_LT); $this->rbox(62, 8, 76, 92, 3, self::WOOD_LT); foreach ([26, 66] as $y) { $this->box(18, $y, 82, $y + 10, self::WHITE); $this->seg(20, $y + 5, 80, $y + 5, 1, '#c8c2b6'); } $this->cross(50, 50, 7); } private function herbHeal(): void { // broad, ribbed leaves (plantain) with a small red cross tag foreach ([-40, 0, 40] as $t) { $this->turned((float) $t, function (): void { $this->ell(50, 46, 11, 26, '#46a05a'); $this->seg(50, 24, 50, 76, 2, '#2f7040'); }, 50, 80); } $this->seg(50, 70, 50, 92, 5, '#3f7a34'); $this->ell(76, 78, 11, 11, self::WHITE); $this->cross(76, 78, 6); } private function herbFever(): void { // a stem of daisies: white petals, yellow hearts $this->path([50, 92, 48, 60, 40, 34], 3.5, '#3f7a34'); $this->path([48, 64, 66, 46], 3.5, '#3f7a34'); $this->ell(34, 76, 12, 5, self::LEAF); foreach ([[38, 28, 16], [68, 40, 12]] as [$x, $y, $r]) { for ($a = 0; $a < 360; $a += 40) { $rr = deg2rad($a); $this->ell($x + cos($rr) * $r * 0.62, $y + sin($rr) * $r * 0.62, $r * 0.36, $r * 0.36, self::WHITE); } $this->ell($x, $y, $r * 0.4, $r * 0.4, '#f0c020'); } } private function herbAntidote(): void { // serrated purple-red leaves on a dark stem, a snake fang mark $this->seg(50, 92, 50, 18, 4, '#4a3a5a'); foreach ([[50, 30, -1], [50, 48, 1], [50, 66, -1]] as [$x, $y, $s]) { $pts = [$x, $y]; for ($i = 1; $i <= 6; $i++) { $pts[] = $x + $s * $i * 5; $pts[] = $y - 8 + ($i % 2) * 5 - $i * 0.5; } $pts[] = $x + $s * 34; $pts[] = $y + 2; for ($i = 6; $i >= 1; $i--) { $pts[] = $x + $s * $i * 5; $pts[] = $y + 6 + ($i % 2) * 3; } $this->poly($pts, '#8a3a7a'); $this->seg($x, $y, $x + $s * 30, $y, 1.4, '#5a1e50'); } $this->ell(50, 14, 6, 6, '#c8303c'); } private function poultice(): void { $this->turned(-12, function (): void { $this->rbox(14, 30, 86, 80, 6, self::WHITE); $this->ell(50, 55, 28, 18, '#5a9a3a'); $this->ell(46, 52, 16, 9, '#8fbf5a'); foreach ([[38, 58], [58, 50], [60, 62]] as [$x, $y]) { $this->ell($x, $y, 3, 2, '#3a6a2a'); } $this->box(14, 30, 86, 36, '#e4e0d8'); }); } private function vial(): void { $this->rbox(40, 8, 60, 20, 3, self::WOOD_DK); $this->box(42, 20, 58, 40, '#dceaf2'); $this->ell(50, 64, 28, 28, '#dceaf2'); $this->ell(50, 68, 22, 20, '#6ad05a'); $this->box(28, 58, 72, 62, '#a8f08a'); $this->ell(50, 70, 9, 9, self::WHITE); $this->cross(50, 70, 6); $this->hi(38, 54, 4, 9, 30); } private function cup(): void { $this->poly([18, 40, 74, 40, 68, 86, 24, 86], '#d8c8a8'); $this->arc(74, 58, 12, 280, 80, 5, '#d8c8a8'); $this->ell(46, 40, 28, 5, '#c89a3a'); $this->ell(56, 40, 7, 3, self::LEAF); $this->cross(46, 64, 7); $this->wisp(36, 34, 26); $this->wisp(54, 32, 28); } private function medkit(): void { $this->rbox(36, 14, 64, 30, 4, '#8a8a90'); $this->rbox(10, 26, 90, 86, 8, self::WHITE); $this->box(10, 50, 90, 54, '#d8d4cc'); $this->cross(50, 56, 18); $this->hi(22, 36, 8, 5); } private function salve(): void { $this->ell(50, 72, 36, 14, '#b8bcc2'); $this->box(14, 54, 86, 72, '#b8bcc2'); $this->ell(50, 54, 36, 14, '#dfe3e8'); $this->ell(50, 52, 30, 10, '#f4e4c8'); $this->ell(46, 48, 12, 4, '#fff4e0'); $this->rbox(30, 60, 70, 70, 3, self::RED); $this->flameShape(50, 34, 0.45, '#e8742a', '#ffd25a'); } // ---- quest items (dark casing, cyan glow) --------------------------------------------------------- private function powerCell(): void { $this->rbox(26, 18, 74, 90, 8, self::TECH); $this->rbox(38, 8, 62, 20, 3, self::STEEL); $this->rbox(32, 26, 68, 82, 5, '#164a5a'); $this->poly([54, 30, 38, 58, 50, 58, 44, 78, 64, 48, 52, 48, 58, 30], self::CYAN); $this->box(28, 40, 32, 46, self::CYAN); $this->glow(50, 54, 30); } private function tuner(): void { // a tuning fork with a cyan crystal in its throat $this->seg(50, 60, 50, 94, 7, self::STEEL); $this->arc(50, 46, 16, 0, 180, 7, self::STEEL); $this->seg(34, 46, 34, 10, 7, self::STEEL); $this->seg(66, 46, 66, 10, 7, self::STEEL); $this->seg(32, 12, 32, 40, 2, self::STEEL_LT); $this->poly([50, 24, 58, 38, 50, 54, 42, 38], self::CYAN); $this->poly([50, 24, 54, 38, 50, 54], '#c8f8ff'); $this->glow(50, 38, 22); } private function antenna(): void { $this->seg(50, 44, 50, 92, 6, self::STEEL); $this->seg(50, 62, 30, 86, 3.5, self::STEEL_DK); $this->seg(50, 62, 70, 86, 3.5, self::STEEL_DK); $this->ell(50, 34, 20, 8, '#d8dde2'); $this->poly([30, 34, 70, 34, 60, 46, 40, 46], '#b8bec6'); $this->seg(50, 34, 50, 14, 2.4, self::STEEL_DK); $this->ell(50, 12, 4, 4, self::CYAN); $this->arc(50, 12, 10, 200, 340, 2.4, self::CYAN); $this->arc(50, 12, 18, 210, 330, 2.4, self::CYAN); $this->glow(50, 12, 12); } private function book(): void { $this->rbox(18, 10, 80, 90, 4, '#7a4a2a'); $this->box(74, 14, 84, 86, '#f0e6cc'); $this->box(18, 10, 28, 90, '#5a3420'); $this->rbox(36, 26, 70, 46, 3, '#c8a060'); $this->seg(40, 32, 66, 32, 1.6, '#5a3420'); $this->seg(40, 40, 60, 40, 1.6, '#5a3420'); $this->box(60, 80, 66, 96, self::CYAN); $this->hi(36, 60, 8, 12, 90); } private function datapad(): void { $this->rbox(18, 10, 82, 90, 8, self::TECH); $this->rbox(24, 18, 76, 72, 3, '#0e3a4a'); foreach ([26, 36, 46, 56] as $i => $y) { $this->box(30, $y, 70 - ($i % 2) * 14, $y + 4, self::CYAN); } $this->ell(50, 81, 4, 4, self::TECH_LT); $this->glow(50, 44, 30); } private function keycard(): void { $this->turned(-12, function (): void { $this->rbox(10, 26, 90, 78, 6, '#d8dde2'); $this->box(10, 34, 90, 44, self::TECH); $this->rbox(18, 52, 38, 68, 2, self::GOLD); $this->seg(24, 56, 24, 64, 1, '#a8862a'); $this->seg(32, 56, 32, 64, 1, '#a8862a'); $this->box(46, 54, 82, 58, '#7a8590'); $this->box(46, 62, 72, 66, '#7a8590'); $this->box(10, 70, 90, 74, self::CYAN); }); $this->glow(50, 74, 18); } private function jerrycan(): void { $this->rbox(18, 22, 80, 90, 6, '#c83a2a'); $this->poly([18, 30, 30, 12, 54, 12, 54, 22, 18, 40], '#c83a2a'); $this->box(34, 14, 50, 20, '#7a2418'); $this->rbox(62, 8, 76, 24, 3, '#3a3a40'); $this->poly([28, 34, 70, 80, 70, 34, 28, 80], '#a82a1e'); $this->poly([28, 34, 34, 34, 70, 74, 70, 80, 64, 80, 28, 40], '#e85a40'); $this->poly([28, 74, 64, 34, 70, 34, 70, 40, 34, 80, 28, 80], '#e85a40'); $this->hi(26, 50, 4, 12, 70); } private function navCore(): void { $this->poly([50, 6, 88, 28, 88, 72, 50, 94, 12, 72, 12, 28], self::TECH); $this->poly([50, 14, 80, 32, 80, 68, 50, 86, 20, 68, 20, 32], self::TECH_LT); $this->ell(50, 50, 22, 22, '#0e3a4a'); $this->arc(50, 50, 18, 0, 360, 2, self::CYAN); $this->ell(50, 50, 10, 10, self::CYAN); $this->ell(46, 46, 4, 4, '#e8fcff'); foreach ([[50, 10], [84, 30], [84, 70], [50, 90], [16, 70], [16, 30]] as [$x, $y]) { $this->ell($x, $y, 2.4, 2.4, self::CYAN); } $this->glow(50, 50, 30); } private function heatPlates(): void { foreach ([[18, 62], [34, 46], [50, 30]] as $i => [$x, $y]) { $this->poly([$x, $y, $x + 34, $y - 8, $x + 42, $y + 14, $x + 8, $y + 22], '#24262c'); $this->poly([$x, $y, $x + 34, $y - 8, $x + 36, $y - 3, $x + 2, $y + 5], '#3e424a'); $this->seg($x + 8, $y + 22, $x + 42, $y + 14, 2.4, '#ff8a2a'); } $this->glow(70, 46, 16, '#ff8a2a'); } private function key(): void { $this->ell(30, 34, 20, 20, self::TECH); $this->ell(30, 34, 8, 8, self::TECH_LT); $this->arc(30, 34, 14, 0, 360, 1.6, self::CYAN); $this->turned(45, function (): void { $this->rbox(44, 44, 104, 56, 3, self::STEEL); $this->box(80, 56, 86, 64, self::STEEL); $this->box(92, 56, 98, 66, self::STEEL); $this->box(50, 48, 98, 51, self::CYAN); }); $this->glow(30, 34, 16); } private function codes(): void { $this->poly([14, 12, 72, 12, 86, 26, 86, 90, 14, 90], '#f0ead8'); $this->poly([72, 12, 86, 26, 72, 26], '#c8c0a8'); foreach ([24, 34, 44, 54] as $i => $y) { for ($j = 0; $j < 5; $j++) { $this->box(22 + $j * 11, $y, 29 + $j * 11, $y + 5, ($i + $j) % 3 ? '#2d3742' : '#d23a3a'); } } $this->ell(66, 74, 13, 13, '#b8232a'); $this->ell(66, 74, 8, 8, '#d8343c'); $this->box(20, 66, 50, 70, self::CYAN); $this->glow(35, 68, 12); } private function manual(): void { $this->rbox(14, 8, 82, 92, 4, '#2a4a7a'); $this->box(78, 12, 88, 88, '#f0ead8'); $this->box(14, 8, 24, 92, '#1a3050'); // a shuttle on the cover $this->poly([52, 20, 60, 36, 62, 62, 70, 72, 62, 74, 42, 74, 34, 72, 42, 62, 44, 36], '#e4e8ec'); $this->ell(52, 40, 4, 5, self::CYAN); $this->poly([46, 74, 58, 74, 52, 84], '#ff8a2a'); } // ---- trade goods ---------------------------------------------------------------------------------- private function beads(): void { $this->arc(50, 38, 32, 10, 170, 2, self::CORD); foreach ([[19, 46], [26, 60], [37, 70], [50, 74], [63, 70], [74, 60], [81, 46]] as $i => [$x, $y]) { $this->ell($x, $y, 8, 8, $i % 2 ? '#b8642e' : '#e8a050'); $this->hi($x - 2.5, $y - 2.5, 2.4, 2, 60); } $this->ell(50, 18, 4, 4, self::CORD); } private function salt(): void { $this->poly([20, 84, 28, 46, 44, 36, 52, 84], '#f6eef4'); $this->poly([44, 84, 56, 24, 74, 36, 80, 84], '#f0c8d8'); $this->poly([56, 24, 64, 30, 62, 84, 52, 84], '#ffffff'); $this->poly([12, 84, 88, 84, 92, 92, 8, 92], '#a88a6a'); $this->hi(34, 48, 4, 12, 40); } private function amulet(): void { $this->arc(50, 34, 26, 200, 340, 2.4, self::CORD); $this->poly([50, 30, 72, 58, 50, 94, 28, 58], '#efe8d6'); $this->poly([50, 30, 60, 58, 50, 94], '#d8cfb8'); $this->ell(50, 58, 7, 7, self::WOOD_DK); $this->ell(50, 58, 3, 3, '#c8402a'); foreach ([[24, 20], [76, 20]] as [$x, $y]) { $this->ell($x, $y + 2, 4, 4, '#b8642e'); } }}