Skip to content

Commit

Permalink
Merge pull request #267 from the-hideout/armor-slots
Browse files Browse the repository at this point in the history
Add armor slots
  • Loading branch information
Razzmatazzz authored Jan 10, 2024
2 parents ec93b83 + 655cb46 commit 240daa4
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
30 changes: 30 additions & 0 deletions resolvers/itemResolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,36 @@ module.exports = {
return data.inspectImageLink;
}
},
ItemArmorSlot: {
__resolveType(data) {
if (data.allowedPlates) return 'ItemArmorSlotOpen';
return 'ItemArmorSlotLocked';
}
},
ItemArmorSlotLocked: {
name(data) {
if (data.name) return data.name;
return data.type;
},
zones(data, args, context, info) {
return context.data.item.getLocale(data.zones, context, info);
},
material(data, args, context) {
return context.data.item.getArmorMaterial(context, data.armor_material_id);
},
},
ItemArmorSlotOpen: {
name(data) {
if (data.name) return data.name;
return data.type;
},
zones(data, args, context, info) {
return context.data.item.getLocale(data.zones, context, info);
},
allowedPlates(data, args, context) {
return data.allowedPlates.map(id => context.data.item.getItem(context, id));
},
},
ItemAttribute: {
type(data, args, context) {
if (data.type) return data.type;
Expand Down
37 changes: 37 additions & 0 deletions schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,35 @@ type Item {
gridImageLinkFallback: String! @deprecated(reason: "Fallback handled automatically by gridImageLink.")
}
interface ItemArmorSlot {
#id: ID!
nameId: String
zones: [String]
}
type ItemArmorSlotLocked implements ItemArmorSlot {
nameId: String
name: String
bluntThroughput: Float
class: Int
durability: Int
repairCost: Int
speedPenalty: Float
turnPenalty: Float
ergoPenalty: Float
material: ArmorMaterial
zones: [String]
armorType: String
baseValue: Int
}
type ItemArmorSlotOpen implements ItemArmorSlot {
nameId: String
name: String
zones: [String]
allowedPlates: [Item]
}
type ItemAttribute {
type: String!
name: String!
Expand Down Expand Up @@ -344,6 +373,7 @@ type ItemPropertiesArmor {
material: ArmorMaterial
armorType: String
bluntThroughput: Float
armorSlots: [ItemArmorSlot]
}
type ItemPropertiesArmorAttachment {
Expand Down Expand Up @@ -394,6 +424,7 @@ type ItemPropertiesChestRig {
pouches: [ItemStorageGrid] @deprecated(reason: "Use grids instead.")
armorType: String
bluntThroughput: Float
armorSlots: [ItemArmorSlot]
}
type ItemPropertiesContainer {
Expand Down Expand Up @@ -462,6 +493,7 @@ type ItemPropertiesHelmet {
ricochetZ: Float
armorType: String
bluntThroughput: Float
armorSlots: [ItemArmorSlot]
}
type ItemPropertiesKey {
Expand Down Expand Up @@ -1255,6 +1287,11 @@ type TraderReputationLevelFence {
hostileScavs: Boolean
scavAttackSupport: Boolean
availableScavExtracts: Int
btrEnabled: Boolean
btrDeliveryDiscount: Int
btrDeliveryGridSize: MapPosition
btrTaxiDiscount: Int
btrCoveringFireDiscount: Int
}
type TraderStanding {
Expand Down

0 comments on commit 240daa4

Please sign in to comment.