Skip to content

Commit

Permalink
move zones from hardcode to JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
KorGgenT committed Oct 31, 2019
1 parent f9c2d14 commit a966e8d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 51 deletions.
20 changes: 20 additions & 0 deletions data/json/item_category.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,63 @@
"id": "guns",
"type": "ITEM_CATEGORY",
"name": "GUNS",
"zone": "LOOT_GUNS",
"sort_rank": -23
},
{
"id": "magazines",
"type": "ITEM_CATEGORY",
"name": "MAGAZINES",
"zone": "LOOT_MAGAZINES",
"sort_rank": -22
},
{
"id": "ammo",
"type": "ITEM_CATEGORY",
"name": "AMMO",
"zone": "LOOT_AMMO",
"sort_rank": -21
},
{
"id": "weapons",
"type": "ITEM_CATEGORY",
"name": "WEAPONS",
"zone": "LOOT_WEAPONS",
"sort_rank": -20
},
{
"id": "tools",
"type": "ITEM_CATEGORY",
"name": "TOOLS",
"zone": "LOOT_TOOLS",
"sort_rank": -19
},
{
"id": "clothing",
"type": "ITEM_CATEGORY",
"name": "CLOTHING",
"//": "zone is hardcoded due to filthy clothing",
"sort_rank": -18
},
{
"id": "food",
"type": "ITEM_CATEGORY",
"name": "FOOD",
"//": "zone is hardcoded",
"sort_rank": -17
},
{
"id": "drugs",
"type": "ITEM_CATEGORY",
"name": "DRUGS",
"zone": "LOOT_DRUGS",
"sort_rank": -16
},
{
"id": "books",
"type": "ITEM_CATEGORY",
"name": "BOOKS",
"zone": "LOOT_BOOKS",
"sort_rank": -15
},
{
Expand All @@ -63,66 +72,77 @@
"id": "mods",
"type": "ITEM_CATEGORY",
"name": "MODS",
"zone": "LOOT_MODS",
"sort_rank": -13
},
{
"id": "mutagen",
"type": "ITEM_CATEGORY",
"name": "MUTAGENS",
"zone": "LOOT_MUTAGENS",
"sort_rank": -12
},
{
"id": "bionics",
"type": "ITEM_CATEGORY",
"name": "BIONICS",
"zone": "LOOT_BIONICS",
"sort_rank": -12
},
{
"id": "veh_parts",
"type": "ITEM_CATEGORY",
"name": "VEHICLE PARTS",
"zone": "LOOT_VEHICLE_PARTS",
"sort_rank": -10
},
{
"id": "other",
"type": "ITEM_CATEGORY",
"name": "OTHER",
"zone": "LOOT_OTHER",
"sort_rank": -9
},
{
"id": "fuel",
"type": "ITEM_CATEGORY",
"name": "FUEL",
"zone": "LOOT_FUEL",
"sort_rank": -8
},
{
"id": "seeds",
"type": "ITEM_CATEGORY",
"name": "SEEDS",
"zone": "LOOT_SEEDS",
"sort_rank": -7
},
{
"id": "chems",
"type": "ITEM_CATEGORY",
"name": "CHEMICAL STUFF",
"zone": "LOOT_CHEMICAL",
"sort_rank": 5
},
{
"id": "spare_parts",
"type": "ITEM_CATEGORY",
"name": "SPARE PARTS",
"zone": "LOOT_SPARE_PARTS",
"sort_rank": 8
},
{
"id": "artifacts",
"type": "ITEM_CATEGORY",
"name": "ARTIFACTS",
"zone": "LOOT_ARTIFACTS",
"sort_rank": 10
},
{
"id": "armor",
"type": "ITEM_CATEGORY",
"name": "ARMOR",
"//": "zone is hardcoded due to filthy clothing",
"sort_rank": 20
},
{
Expand Down
51 changes: 0 additions & 51 deletions src/clzones.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -870,63 +870,12 @@ zone_type_id zone_manager::get_near_zone_type_for_item( const item &it,

return zone_type_id( "LOOT_FOOD" );
}
if( cat.get_id() == "guns" ) {
return zone_type_id( "LOOT_GUNS" );
}
if( cat.get_id() == "magazines" ) {
return zone_type_id( "LOOT_MAGAZINES" );
}
if( cat.get_id() == "ammo" ) {
return zone_type_id( "LOOT_AMMO" );
}
if( cat.get_id() == "weapons" ) {
return zone_type_id( "LOOT_WEAPONS" );
}
if( cat.get_id() == "tools" ) {
return zone_type_id( "LOOT_TOOLS" );
}
if( cat.get_id() == "clothing" ) {
if( it.is_filthy() && has_near( zone_type_id( "LOOT_FCLOTHING" ), where, range ) ) {
return zone_type_id( "LOOT_FCLOTHING" );
}
return zone_type_id( "LOOT_CLOTHING" );
}
if( cat.get_id() == "drugs" ) {
return zone_type_id( "LOOT_DRUGS" );
}
if( cat.get_id() == "books" ) {
return zone_type_id( "LOOT_BOOKS" );
}
if( cat.get_id() == "mods" ) {
return zone_type_id( "LOOT_MODS" );
}
if( cat.get_id() == "mutagen" ) {
return zone_type_id( "LOOT_MUTAGENS" );
}
if( cat.get_id() == "bionics" ) {
return zone_type_id( "LOOT_BIONICS" );
}
if( cat.get_id() == "veh_parts" ) {
return zone_type_id( "LOOT_VEHICLE_PARTS" );
}
if( cat.get_id() == "other" ) {
return zone_type_id( "LOOT_OTHER" );
}
if( cat.get_id() == "fuel" ) {
return zone_type_id( "LOOT_FUEL" );
}
if( cat.get_id() == "seeds" ) {
return zone_type_id( "LOOT_SEEDS" );
}
if( cat.get_id() == "chems" ) {
return zone_type_id( "LOOT_CHEMICAL" );
}
if( cat.get_id() == "spare_parts" ) {
return zone_type_id( "LOOT_SPARE_PARTS" );
}
if( cat.get_id() == "artifacts" ) {
return zone_type_id( "LOOT_ARTIFACTS" );
}
if( cat.get_id() == "armor" ) {
if( it.is_filthy() && has_near( zone_type_id( "LOOT_FARMOR" ), where, range ) ) {
return zone_type_id( "LOOT_FARMOR" );
Expand Down

0 comments on commit a966e8d

Please sign in to comment.