Changeset 357 for dev/common/includes/class.item.php
- Timestamp:
- 10/27/08 12:26:01 (14 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
dev/common/includes/class.item.php
r355 r357 17 17 { 18 18 $this->execQuery(); 19 if (DB_USE_CCP) 20 { 21 return $this->row_['typeName']; 22 } 23 return $this->row_['itm_name']; 19 return $this->row_['typeName']; 24 20 } 25 21 … … 43 39 { 44 40 $img = IMG_URL.'/blueprints/'.$size.'_'.$size.'/'.$this->row_['itm_externalid'].'.png'; 45 } 46 else 47 { 48 // fix for new db structure, just make sure old clients dont break 49 if (!strstr($this->row_['itm_icon'], 'icon')) 50 { 51 $this->row_['itm_icon'] = 'icon'.$this->row_['itm_icon']; 52 } 53 $img = IMG_URL.'/items/'.$size.'_'.$size.'/'.$this->row_['itm_icon'].'.png'; 54 } 41 } 42 55 43 if ($size == 24) 56 44 { … … 166 154 return false; 167 155 } 168 $this->sql_ = "select * 169 from kb3_items 170 left join kb3_item_types on itm_type = itt_id 171 where itm_id = '".$this->id_."'"; 172 173 if (DB_USE_CCP) 174 { 175 // new 176 $this->sql_ = "select inv.*, kb3_item_types.*, dga.value as techlevel, itp.price 156 157 $this->sql_ = "select inv.*, kb3_item_types.*, dga.value as techlevel, itp.price 177 158 from kb3_invtypes inv 178 159 left join kb3_dgmtypeattributes dga on dga.typeID=inv.typeID and dga.attributeID=633 … … 180 161 left join kb3_item_types on groupID=itt_id 181 162 where inv.typeID = '".$this->id_."'"; 182 }183 163 $this->qry_->execute($this->sql_); 184 164 $this->row_ = $this->qry_->getRow(); 185 if (DB_USE_CCP) 186 { 187 $this->row_['itm_icon'] = $this->row_['icon']; 188 $this->row_['itm_techlevel'] = $this->row_['techlevel']; 189 $this->row_['itm_externalid'] = $this->row_['typeID']; 190 $this->row_['itm_value'] = $this->row_['price']; 191 } 192 } 193 } 194 165 $this->row_['itm_icon'] = $this->row_['icon']; 166 $this->row_['itm_techlevel'] = $this->row_['techlevel']; 167 $this->row_['itm_externalid'] = $this->row_['typeID']; 168 $this->row_['itm_value'] = $this->row_['price']; 169 } 170 } 171 172 // loads $this->id_ by name 195 173 function lookup($name) 196 174 { 197 175 $name = trim($name); 198 176 $qry = new DBQuery(); 199 $query = "select * from kb3_items itm 200 where itm_name = '".slashfix($name)."'"; 201 if (DB_USE_CCP) 202 { 203 $query = "select *,typeID as itm_id from kb3_invtypes itm 204 where typeName = '".slashfix($name)."'"; 205 } 177 $query = "select *,typeID as itm_id from kb3_invtypes itm 178 where typeName = '".slashfix($name)."'"; 206 179 $qry->execute($query); 207 180 $row = $qry->getRow(); 208 181 if (!isset($row['itm_id'])) 209 182 { 210 if (config::get('adapt_items') && DB_USE_CCP !== true) 211 { 212 // if the item is a tec2 we likely have the tec1 213 if (substr($name, -2, 2) == 'II') 214 { 215 $qry->execute("select * from kb3_items itm 216 where itm_name = '".slashfix(substr($name,0,-1))."'"); 217 $row = $qry->getRow(); 218 if (!$row['itm_type']) 219 { 220 return false; 221 } 222 $qry->execute("INSERT INTO kb3_items (itm_name,itm_volume,itm_type,itm_externalid,itm_techlevel,itm_icon) 223 VALUES ('".slashfix($name)."','".$row['itm_volume']."','".$row['itm_type']."','".$row['itm_externalid']."','2','".$row['itm_icon']."')"); 224 } 225 else 226 { 227 // no idea what this is, insert as 'Temp' 228 $qry->execute("INSERT INTO kb3_items (itm_name,itm_type) 229 VALUES ('".slashfix($name)."','721')"); 230 } 231 $row['itm_id'] = $qry->getInsertID(); 232 } 233 else 234 { 235 // that item doesnt exist or is misspelled 236 return false; 237 } 183 return false; 238 184 } 239 185 $this->id_ = $row['itm_id']; 240 186 } 241 187 242 188 // return typeID by name, dont change $this->id_ 243 189 function get_item_id($name) 244 190 { 245 191 $qry = new DBQuery(); 246 $query = "select * 247 from kb3_items 248 where itm_name = '".slashfix($name)."'"; 249 if (DB_USE_CCP) 250 { 251 $query = "select *,typeID as itm_id 252 from kb3_items 253 where typeName = '".slashfix($name)."'"; 254 } 192 $query = "select *,typeID as itm_id 193 from kb3_items 194 where typeName = '".slashfix($name)."'"; 255 195 $qry->execute($query); 256 196 … … 316 256 } 317 257 318 258 function get_group_id($name) 319 259 { 320 260 $qry = new DBQuery();