MCPcopy Index your code
hub / github.com/codecombat/codecombat / initialize

Method initialize

app/views/play/menu/InventoryModal.js:81–123  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

79 // - Setup
80
81 initialize (options) {
82 super.initialize(...arguments)
83 if (application.getHocCampaign() === 'game-dev-hoc-2') {
84 if (!me.get('earned')) {
85 me.set('earned', {})
86 }
87 if (!me.get('earned').items) {
88 me.attributes.earned.items = []
89 }
90 const baseItems = [
91 '53e2384453457600003e3f07', // leather boots
92 '53e218d853457600003e3ebe', // simple sword
93 '53e22aa153457600003e3ef5', // wooden shield
94 '5744e3683af6bf590cd27371' // cougar
95 ]
96 for (const item of baseItems) {
97 var needle
98 if ((needle = item, !me.get('earned').items.includes(needle))) {
99 me.get('earned').items.push(item) // Allow HoC players to access the cat
100 }
101 }
102 }
103
104 this.onScrollUnequipped = _.throttle(_.bind(this.onScrollUnequipped, this), 200)
105 this.items = new CocoCollection([], { model: ThangType })
106 // TODO: switch to item store loading system?
107 this.items.url = '/db/thang.type?view=items'
108 this.items.setProjection([
109 'name',
110 'slug',
111 'components',
112 'original',
113 'rasterIcon',
114 'dollImages',
115 'gems',
116 'tier',
117 'description',
118 'heroClass',
119 'i18n',
120 'subscriber'
121 ])
122 this.equipment = {} // Assign for real when we have loaded the session and items.
123 }
124
125 onItemsLoaded () {
126 let item

Callers

nothing calls this directly

Calls 3

getMethod · 0.45
setMethod · 0.45
setProjectionMethod · 0.45

Tested by

no test coverage detected