mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-01 15:50:11 -04:00
Getting a few more placeholder stats filled in automatically in ItemDetailsView. Showing buildTypes for Builder's Hammer docs. Fixed font casing / humanizing for skills granted.
This commit is contained in:
parent
b359c25c97
commit
c7f8565ae7
2 changed files with 15 additions and 6 deletions
app
|
@ -23,7 +23,7 @@
|
|||
h3.big-font(data-i18n="play.skills_granted")
|
||||
for prop in props
|
||||
p
|
||||
strong.big-font= prop.name
|
||||
strong= prop.name
|
||||
span.spr :
|
||||
span!= prop.description
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ template = require 'templates/play/modal/item-details-view'
|
|||
CocoCollection = require 'collections/CocoCollection'
|
||||
LevelComponent = require 'models/LevelComponent'
|
||||
|
||||
{downTheChain} = require 'lib/world/world_utils'
|
||||
utils = require 'lib/utils'
|
||||
|
||||
module.exports = class ItemDetailsView extends CocoView
|
||||
|
@ -21,6 +22,7 @@ module.exports = class ItemDetailsView extends CocoView
|
|||
@item.affordable = me.gems() >= @item.get('gems')
|
||||
@item.owned = me.ownsItem @item.get('original')
|
||||
@item.comingSoon = not @item.getFrontFacingStats().props.length and not _.size @item.getFrontFacingStats().stats # Temp: while there are placeholder items
|
||||
@componentConfigs = (c.config for c in @item.get('components') when c.config)
|
||||
|
||||
stats = @item.getFrontFacingStats()
|
||||
props = (p for p in stats.props when not @propDocs[p])
|
||||
|
@ -78,15 +80,22 @@ module.exports = class ItemDetailsView extends CocoView
|
|||
description = description.replace(/#{spriteName}/g, 'hero')
|
||||
if fact = stats.stats.shieldDefenseFactor
|
||||
description = description.replace(/#{shieldDefensePercent}%/g, fact.display)
|
||||
## We don't have the full components loaded here, so we can't really get most of these values.
|
||||
#description = description.replace /#{([^.]+?)}/g, (match, keyChain) ->
|
||||
# console.log 'gotta find', keyChain, 'from', match, 'and have', stats
|
||||
# match
|
||||
if prop is 'buildTypes'
|
||||
buildsConfig = _.find @componentConfigs, 'buildables'
|
||||
description = description.replace '#{buildTypes}', "`[\"#{_.keys(buildsConfig.buildables).join('\", \"')}\"]`"
|
||||
# We don't have the full components loaded here, so we can't really get most of these values.
|
||||
componentConfigs = @componentConfigs ? []
|
||||
description = description.replace /#{([^.]+?)}/g, (match, keyChain) ->
|
||||
for componentConfig in componentConfigs
|
||||
if value = downTheChain componentConfig, keyChain
|
||||
return value
|
||||
#console.log 'gotta find', keyChain, 'from', match
|
||||
match
|
||||
description = description.replace(/#{(.+?)}/g, '`$1`')
|
||||
description = $(marked(description)).html()
|
||||
|
||||
c.props.push {
|
||||
name: _.string.humanize prop
|
||||
name: prop
|
||||
description: description or '...'
|
||||
}
|
||||
c
|
||||
|
|
Loading…
Add table
Reference in a new issue