Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add armor slots #267

Merged
merged 3 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading