From 29562ee7fe8daf4287c9e8b841eb1da2c5238557 Mon Sep 17 00:00:00 2001 From: Josh Freeman Date: Tue, 21 Mar 2017 10:00:10 +0000 Subject: [PATCH] Create icon_paths.md --- research/icon_paths.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 research/icon_paths.md diff --git a/research/icon_paths.md b/research/icon_paths.md new file mode 100644 index 000000000..77be45c8c --- /dev/null +++ b/research/icon_paths.md @@ -0,0 +1,20 @@ +# FFXIV Icon Paths + +The path for icons are very funky, depending on the icon number you need to format the path very specifically, here is a function that does it in PHP which should be easy to translate into other languages: + +```php +// Is the number 6 or more characters? +$extended = (strlen($number) >= 6); + +// get icon based on number size, prepend 0 if its below 6 characters. +$icon = $extended + ? str_pad($number, 5, "0", STR_PAD_LEFT) + : '0' . str_pad($number, 5, "0", STR_PAD_LEFT); + +// build path, take values [0, 1, 2] from the number, add 000 for extended +// for non extended start with 0 and add [1,2] + 000 for path. +$path = $extended + ? $icon[0] . $icon[1] . $icon[2] .'000' + : '0'. $icon[1] . $icon[2] .'000'; +``` +