mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 09:35:39 -05:00
Autocomplete game.
And don’t create duplicate entries for hero. autocompletes Closes #3883
This commit is contained in:
parent
b8d4e51331
commit
a700a00c94
1 changed files with 6 additions and 8 deletions
|
@ -321,14 +321,12 @@ module.exports = class Autocomplete
|
||||||
attackEntry.content = attackEntry.content.replace '${1:enemy}', '"${1:Enemy Name}"'
|
attackEntry.content = attackEntry.content.replace '${1:enemy}', '"${1:Enemy Name}"'
|
||||||
snippetEntries.push attackEntry
|
snippetEntries.push attackEntry
|
||||||
|
|
||||||
# Add copied hero. entries for most important ones that start with hero.
|
# Update 'hero.' and 'game.' entries to include their prefixes
|
||||||
sortedEntries = _.sortBy snippetEntries, (entry) -> -1 * parseInt(entry.importance ? 0)
|
for entry in snippetEntries
|
||||||
for entry in sortedEntries
|
if entry.content?.indexOf('hero.') is 0 and entry.name?.indexOf('hero.') < 0
|
||||||
if entry.content?.indexOf('hero.') is 0
|
entry.name = "hero.#{entry.name}"
|
||||||
newEntry = _.cloneDeep(entry)
|
else if entry.content?.indexOf('game.') is 0 and entry.name?.indexOf('game.') < 0
|
||||||
entry.name = "hero.#{newEntry.name}"
|
entry.name = "game.#{entry.name}"
|
||||||
snippetEntries.push(newEntry)
|
|
||||||
break if snippetEntries.length - sortedEntries.length >= 10
|
|
||||||
|
|
||||||
if haveFindNearest and not haveFindNearestEnemy
|
if haveFindNearest and not haveFindNearestEnemy
|
||||||
spellView.translateFindNearest()
|
spellView.translateFindNearest()
|
||||||
|
|
Loading…
Reference in a new issue