当前位置: 首页>>代码示例>>PHP>>正文


PHP Weapon::where方法代码示例

本文整理汇总了PHP中Weapon::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Weapon::where方法的具体用法?PHP Weapon::where怎么用?PHP Weapon::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Weapon的用法示例。


在下文中一共展示了Weapon::where方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Get_Item_Information

 public function Get_Item_Information($itemtypeid)
 {
     $itemtypeid = urldecode($itemtypeid);
     if (!is_numeric($itemtypeid)) {
         return Response::json(array('status' => 'error', 'error' => 'This is not a proper ItemTypeID.'));
     }
     if (strlen($itemtypeid) > 8) {
         return Response::json(array('status' => 'error', 'error' => 'This is not a proper ItemTypeID.'));
     }
     //check the cache
     if (Cache::has($this->class_name . "_" . $itemtypeid)) {
         //pull from cache
         $itemtypeid_info = Cache::get($this->class_name . "_" . $itemtypeid);
         return json_encode($itemtypeid_info);
     }
     $basic_info = hWebIcon::where(function ($query) use($itemtypeid) {
         $query->where('itemTypeId', '=', $itemtypeid);
         $query->where('version', '=', $this->version);
     })->first(array('asset_path', 'abilitymodule_id', 'backpack_id', 'basic_id', 'blueprint_id', 'chassis_id', 'consumable_id', 'craftingcomponent_id', 'craftingstation_id', 'craftingsubcomponent_id', 'framemodule_id', 'palettemodule_id', 'powerup_id', 'resourceitem_id', 'scopemodule_id', 'weapon_id', 'weaponmodule_id'));
     if (empty($basic_info)) {
         return Response::json(array('status' => 'error', 'error' => 'ItemTypeID not found in db.'));
     }
     //break up the types
     $detailed_info = array();
     $constraint_info = array();
     $weapon_info = array();
     if ($basic_info['abilitymodule_id'] != "") {
         $detailed_info = AbilityModule::where('id', '=', $basic_info['abilitymodule_id'])->first(array('type', 'abilityId', 'craftingTypeId', 'subTypeId', 'description', 'level', 'name', 'powerLevel', 'rarity', 'durability'));
         $constraint_info = hConstraint::where(function ($query) use($itemtypeid) {
             $query->where('itemTypeId', '=', $itemtypeid);
             $query->where('version', '=', $this->version);
         })->first(array('cpu', 'mass', 'power'));
     }
     if ($basic_info['basic_id'] != "") {
         $detailed_info = Basic::where('id', '=', $basic_info['basic_id'])->first(array('type', 'craftingTypeId', 'subTypeId', 'description', 'level', 'name', 'rarity'));
     }
     if ($basic_info['blueprint_id'] != "") {
         //Note -> blueprint_id = recipe_id
     }
     if ($basic_info['chassis_id'] != "") {
         //Note -> links to hattributes
         $detailed_info = Chassis::where('id', '=', $basic_info['chassis_id'])->first(array('type', 'craftingTypeId', 'subTypeId', 'description', 'level', 'name', 'rarity', 'progression_item_id', 'progression_resource_id'));
         $chassis_info = hAttributes::where(function ($query) use($itemtypeid) {
             $query->where('itemTypeId', '=', $itemtypeid);
             $query->where('version', '=', $this->version);
         })->get(array('description', 'display_name', 'value', 'stat_id'));
     }
     if ($basic_info['consumable_id'] != "") {
         $detailed_info = Consumable::where('id', '=', $basic_info['consumable_id'])->first(array('type', 'craftingTypeId', 'subTypeId', 'description', 'level', 'powerLevel', 'name', 'rarity'));
     }
     if ($basic_info['craftingcomponent_id'] != "") {
         $detailed_info = CraftingComponent::where('id', '=', $basic_info['craftingcomponent_id'])->first(array('type', 'craftingTypeId', 'subTypeId', 'description', 'level', 'name', 'rarity'));
     }
     if ($basic_info['craftingsubcomponent_id'] != "") {
         $detailed_info = CraftingSubcomponent::where('id', '=', $basic_info['craftingsubcomponent_id'])->first(array('type', 'craftingTypeId', 'subTypeId', 'description', 'level', 'name', 'rarity'));
     }
     if ($basic_info['framemodule_id'] != "") {
         $detailed_info = FrameModule::where('id', '=', $basic_info['framemodule_id'])->first(array('type', 'abilityId', 'craftingTypeId', 'subTypeId', 'description', 'level', 'name', 'powerLevel', 'rarity', 'durability'));
         $constraint_info = hConstraint::where(function ($query) use($itemtypeid) {
             $query->where('itemTypeId', '=', $itemtypeid);
             $query->where('version', '=', $this->version);
         })->first(array('cpu', 'mass', 'power'));
     }
     if ($basic_info['palletmodule_id'] != "") {
         $detailed_info = PaletteModule::where('id', '=', $basic_info['palettemodule_id'])->first(array('type', 'craftingTypeId', 'subTypeId', 'description', 'level', 'name', 'rarity'));
     }
     if ($basic_info['powerup_id'] != "") {
         $detailed_info = Powerup::where('id', '=', $basic_info['powerup_id'])->first(array('type', 'craftingTypeId', 'subTypeId', 'description', 'level', 'name', 'rarity'));
     }
     if ($basic_info['resourceitem_id'] != "") {
         $detailed_info = ResourceItem::where('id', '=', $basic_info['resourceitem_id'])->first(array('type', 'craftingTypeId', 'subTypeId', 'description', 'level', 'name', 'rarity', 'resource_color'));
     }
     if ($basic_info['weapon_id'] != "") {
         //weapons have hstats also!
         $detailed_info = Weapon::where('id', '=', $basic_info['weapon_id'])->first(array('type', 'craftingTypeId', 'subTypeId', 'description', 'level', 'name', 'rarity', 'durability'));
         $constraint_info = hConstraint::where(function ($query) use($itemtypeid) {
             $query->where('itemTypeId', '=', $itemtypeid);
             $query->where('version', '=', $this->version);
         })->first(array('cpu', 'mass', 'power'));
         $weapon_info = hStat::where(function ($query) use($itemtypeid) {
             $query->where('itemTypeId', '=', $itemtypeid);
             $query->where('version', '=', $this->version);
         })->first(array('ammoPerBurst', 'clipSize', 'damagePerRound', 'damagePerSecond', 'healthPerRound', 'maxAmmo', 'range', 'reloadTime', 'roundsPerBurst', 'roundsPerMinute', 'splashRadius', 'spread'));
     }
     if (empty($detailed_info)) {
         return Response::json(array('status' => 'error', 'error' => 'error getting detailed information for this itemtypeid.'));
     }
     $detailed_info = $detailed_info->toArray();
     $detailed_info['asset_path'] = $basic_info['asset_path'];
     //add contstraint details
     if (!empty($constraint_info)) {
         $constraint_info = $constraint_info->toArray();
         $detailed_info['cpu'] = $constraint_info['cpu'];
         $detailed_info['mass'] = $constraint_info['mass'];
         $detailed_info['power'] = $constraint_info['power'];
     }
     if (!empty($weapon_info)) {
         $weapon_info = $weapon_info->toArray();
         foreach ($weapon_info as $key => $data) {
             $detailed_info[$key] = $data;
//.........这里部分代码省略.........
开发者ID:odie5533,项目名称:ThumpDumpDB,代码行数:101,代码来源:ItemAPIController.php

示例2: get_player_profile_chassis

 public function get_player_profile_chassis($name, $chassis_id)
 {
     //quality control (get it?)
     function quality_control($quality)
     {
         switch ($quality) {
             case 0:
                 return "common";
                 break;
             case 1000:
                 return "legendary";
                 break;
             case $quality >= 901:
                 return "epic";
                 break;
             case $quality >= 701:
                 return "rare";
                 break;
             case $quality >= 401:
                 return "uncommon";
                 break;
             default:
                 return "common";
                 break;
         }
     }
     //searching by name, null name = no buenos
     if ($name == NULL) {
         return Response::error('404');
     } else {
         $input_name = urldecode($name);
     }
     //Look up the player, latest to account for deletes with the same name
     $player = Player::where('name', '=', $input_name)->order_by('created_at', 'DESC')->first();
     //no player found, why not search?
     if (!$player) {
         return Response::error('404');
     }
     //Pull this chassis_id loadout from cache
     $cache_key_loadouts = $player->db_id . "_loadouts";
     $loadout = Cache::Get($cache_key_loadouts . '_' . $chassis_id);
     $cache_set_check = Cache::Get($cache_key_loadouts . "_" . $chassis_id . "_md5");
     if ($cache_set_check == md5(serialize($loadout))) {
         //load this chassis entirely from cache
         $player_item_abilities = Cache::Get($cache_key_loadouts . "_" . $chassis_id . "_abilities");
         $player_item_gear = Cache::Get($cache_key_loadouts . "_" . $chassis_id . "_gear");
         $player_item_weapons = Cache::Get($cache_key_loadouts . "_" . $chassis_id . "_weapons");
     } else {
         //List of "secret" gear we don't want displayed
         $processor_framemods = array(75780, 75782, 75784, 75786, 75915, 75916, 75917, 75918, 75878, 75691, 76013, 76014, 76015, 76016, 76017);
         $player_gear_sdb_id = array();
         //Add all of our gear and abilities to the list
         for ($i = 0; $i < count($loadout->Gear); $i++) {
             if (isset($loadout->Gear[$i]->info->item_sdb_id)) {
                 $player_gear_sdb_id[$i] = $loadout->Gear[$i]->info->item_sdb_id;
             }
         }
         //Now add weapons to that
         for ($i = 0; $i < count($loadout->Weapons); $i++) {
             if (isset($loadout->Weapons[$i]->info->item_sdb_id)) {
                 $player_gear_sdb_id[] = $loadout->Weapons[$i]->info->item_sdb_id;
             }
         }
         $player_gear = array();
         if (!empty($player_gear_sdb_id)) {
             $player_gear = hWebIcon::where(function ($query) use($player_gear_sdb_id) {
                 $query->where_in('itemTypeId', $player_gear_sdb_id);
                 $query->where('version', '=', Base_Controller::getVersionDate());
             })->get();
             //reindex the get result
             $player_gear_base_item = array();
             foreach ($player_gear_sdb_id as $id) {
                 foreach ($player_gear as $item) {
                     if ($item->itemtypeid == $id) {
                         $player_gear_base_item[] = $item;
                     }
                 }
             }
             //remove player_gear variable;
             $player_gear = null;
         } else {
             $player_gear_base_item = null;
         }
         $gear_counter = 0;
         $ability_counter = 0;
         $weapon_counter = 0;
         $player_item_abilities = array();
         $player_item_gear = array();
         $player_item_weapons = array();
         for ($i = 0; $i < count($player_gear_base_item); $i++) {
             $player_gear_icons[$i] = $player_gear_base_item[$i]->asset_path;
             //the gear is either going to be an ability, frame mod or weapon
             if (isset($player_gear_base_item[$i]->backpack_id)) {
                 //do nothing we don't display backpacks
             }
             if (isset($player_gear_base_item[$i]->abilitymodule_id)) {
                 //we has an ability
                 $temp_ability_id = $player_gear_base_item[$i]->attributes['itemtypeid'];
                 $player_equipped_ability_info = AbilityModule::where(function ($query) use($temp_ability_id) {
                     $query->where('itemTypeId', '=', $temp_ability_id);
//.........这里部分代码省略.........
开发者ID:odie5533,项目名称:ThumpDumpDB,代码行数:101,代码来源:player_data.php


注:本文中的Weapon::where方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。