From 030d3735ef48908077db5c3c966e0ff2c96f4bf4 Mon Sep 17 00:00:00 2001 From: Michiel Sikma Date: Sun, 11 Dec 2016 00:19:51 +0100 Subject: [PATCH] Move egg and unknown pokemon to the 'pokemon' icon directory as special cases; update the script accordingly --- icons/etc/unknown-item-2.png | Bin 183 -> 0 bytes icons/etc/unknown-item.png | Bin 178 -> 184 bytes icons/etc/unknown-pkmn.png | Bin 244 -> 0 bytes icons/{etc => pokemon}/egg.png | Bin icons/pokemon/unknown.png | Bin 0 -> 308 bytes includes/defaults.php | 2 + includes/iconstack.php | 85 ++++++++++++++++++++++++++++++++- 7 files changed, 86 insertions(+), 1 deletion(-) delete mode 100644 icons/etc/unknown-item-2.png delete mode 100644 icons/etc/unknown-pkmn.png rename icons/{etc => pokemon}/egg.png (100%) create mode 100755 icons/pokemon/unknown.png diff --git a/icons/etc/unknown-item-2.png b/icons/etc/unknown-item-2.png deleted file mode 100644 index b512dd2f3a6cecfb2aba6e1ee2aabbe62cbade26..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 183 zcmeAS@N?(olHy`uVBq!ia0vp^av;pX1|+Qw)-3{3b)GJcAs)xyPQA@}K!L~g?p;%> zCT)u*?Gn-M`sqU1&T`u(Fn>SJ&wo&5nFve#(kZvX4TYcA_$2EsDJA=M{c;} zC9S#Q+Y_{hXR+QsZ}uy9`ixBtRi7Rb%l2?h()_=&;d z!oLM4+7Bizny^8zazXAQh6$53SpygrD#;oY=_oNQn7_MEGR2%>(MQJs#%EtQGfw0E zGPU1SgkkZ{rXBnb{PQFkCN5ZgAZN}(rt()j%3N#b<{rKGC7nSh^$!1oO6P6-d$u=L jweYW8@Q;=Cz!^5JIa6NA?ElRQbP9u~tDnm{r-UW|jlD&! literal 178 zcmeAS@N?(olHy`uVBq!ia0vp^av;pa3?$v++zf#fPk>K|>;M1%flMF(GJY7T!~!PF>(p>)jXH9(a|Gz!sp^B~Yhi=%L{%4%A zQQt(WcO%y^4&Jl#84_C@OIzKXd3k#4xKf`SmJGfq8EN2_p|Oi&SrShy3nRk;2JM}9 SxJ~#$_IkSdxvXX0002HNklCI)ls7fl_KrCWk^(hYT+b9Y0?uM-O*0$^gaKEuTwN2K1f+v=$PsWEDHQ=E zKzeKKGa!cI0o?&dZO0{0N^{`KG}Aw*0h+d&*YtY>l0I$JcUCbV!?Xw#?WW$#L0000Nn{1`ISV`@iy0XB4ude`@%$AjK*5uqE{-7)?r;0N`C1Hkj#_Yi-~VJm2wQ2Q z#?tvWuS^QpKY4mvgbv&0_rKqJ9($I2-sa>jnKzB*o9x82*G)7|-f&32Xq|r8l+!m_ z&pt7_#;?uUnZI%FgdO~00z%>&?@rhuYb__Fp0z3XQJL3qUH(qtr8OF1azg**tMydm z{8!%jG{GY9)a(t96$=-sS*zw9?`uEenq#i=u35C@$o3n49(VY)Po};(lvX79x?8k% zVlmJ{DNAE9?Kpkmn_stack[] = $item; } } + + // Add the special items (e.g. egg, unknown). + $special_items = $this->get_special_stack_items(); + $this->pkmn_stack = array_merge($this->pkmn_stack, $special_items); + } + + /** + * Returns the special items for the Pokémon stack. + * Currently, just "egg" and "unknown". These have no shiny icons. + */ + public function get_special_stack_items() + { + // Unhatched egg. + $egg = array( + 'idx' => null, + 'slug' => array( + 'eng' => 'egg', + 'jpn' => 'tamago', + ), + 'icons' => array( + '.' => array(), + ), + 'name' => array( + 'eng' => 'Egg', + 'jpn' => 'タマゴ', + 'jpn_ro' => 'Tamago', + ), + ); + + // Unknown (not Unown) or glitch Pokémon. + $unknown = array( + 'idx' => null, + 'slug' => array( + 'eng' => 'unknown', + 'jpn' => 'fumei', + ), + 'icons' => array( + '.' => array(), + ), + 'name' => array( + 'eng' => 'Unknown', + 'jpn' => 'ふめい', + 'jpn_ro' => 'Fumei', + ), + ); + + return array_merge( + $this->get_pkmn_stack_items('egg', $egg, true), + $this->get_pkmn_stack_items('unknown', $unknown, true) + ); } /** @@ -630,7 +680,7 @@ class IconStack * * @return mixed[] Pokémon icon stack data. */ - private function get_pkmn_stack_items($id, $pkmn) + private function get_pkmn_stack_items($id, $pkmn, $special=false) { // Base info that's the same for each stack item. $base_info = array( @@ -663,6 +713,39 @@ class IconStack uksort($pkmn['icons'], array($this, 'pkmn_variation_sort')); foreach ($pkmn['icons'] as $icon => $icon_data) { + // If this is a special icon (no variations, no shiny version), + // add only the plain icon and continue. + if ($special) { + $var = $this->get_icon_var_name( + 'pkmn', + $pkmn['slug'], + $icon, + '.', + 'regular' + ); + $pkmn_info = array_merge($base_info, + array( + 'version' => 'regular', + 'subvariation' => null, + 'is_duplicate' => false, + ), + $this->get_pkmn_icon_fit(), + array( + 'variation' => $icon, + 'var' => $var, + 'file' => ( + $dir_base. + $dir_pkmn. + Settings::get('dir_pkmn_special'). + $pkmn['slug'][Settings::get('img_slug_lang')]. + '.png' + ), + ) + ); + $tmp_stack[] = $pkmn_info; + continue; + } + // Loop through each icon twice: once for regular versions, and // (if requested), once more for shiny versions. // Every variation is added to the stack.