コード例 #1
0
ファイル: sets.php プロジェクト: sinfocol/gwf3
 private static function displaySet(SR_Player $player, $set)
 {
     if (false === ($data = SR_SetItems::getSetByName($set)) && false === ($data = SR_SetItems::getSetForItem($set))) {
         return self::rply($player, '1189');
     }
     $modifiers = SR_SetItems::getModifiersForSet($set);
     $modstr = '';
     $format = ', %s:%s';
     $i = $i2 = '';
     if (SR_SetItems::hasSet($player, $set)) {
         $i = "6";
         $i2 = "";
     }
     foreach ($data[0] as $key => $value) {
         $modstr .= sprintf($format, $key, $value);
     }
     $modstr = $i . trim($modstr, ',; ') . $i2;
     $itemstr = '';
     $format = ', %s%s%s';
     foreach ($data[1] as $items2) {
         $items2 = GWF_Array::arrify($items2);
         $pre = count($items2) > 1 ? '(' : '';
         $aft = count($items2) > 1 ? ')' : '';
         $itemstr .= $pre;
         foreach ($items2 as $itemname) {
             if ($player->hasEquipped($itemname)) {
                 $i = "3";
                 $i2 = "";
                 $itename = shadowlang::displayItemNameS($itemname);
             } elseif (false === ($item = $player->getItemByName($itemname, false))) {
                 $i = "15";
                 $i2 = "";
                 $itename = shadowlang::displayItemNameS($itemname);
             } else {
                 $i = $i2 = '';
                 $itemname = $item->displayName($player);
             }
             $itemstr .= sprintf($format, $i, $itemname, $i2);
         }
         $itemstr .= $aft;
     }
     $itemstr = str_replace('(, ', ', (', $itemstr);
     $itemstr = trim($itemstr, ',; ');
     return self::rply($player, '5296', array($set, $itemstr, $modstr));
 }
コード例 #2
0
ファイル: SR_City.php プロジェクト: sinfocol/gwf3
 private function checkNPCEquipmentB(SR_NPC $npc, $key = NULL, $items)
 {
     if ($items === '') {
         return;
     }
     foreach (GWF_Array::arrify($items) as $iname) {
         if (false === ($item = SR_Item::createByName($iname, true, false))) {
             die(sprintf('The NPC %s has an invalid item: %s.', get_class($npc), $iname));
         }
         if ($key !== NULL && $item->getItemType() !== $key) {
             die(sprintf('The NPC %s has %s item in wrong slot %s: %s.', get_class($npc), $item->getItemType(), $key, $iname));
         }
     }
 }