Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
LeekWars.get('forum/get-messages/' + topic + '/' + this.page).then(data => {
this.topic = data.topic
if (!this.topic) { return }
this.category = data.category
if (this.topic) {
Vue.set(this.topic, 'messages', data.messages)
if (this.topic.messages) {
for (const message of this.topic.messages) {
Vue.set(message, 'editing', false)
Vue.set(message, 'height', 100)
}
}
}
this.pages = data.pages
LeekWars.setTitle(this.topic.name, this.$t('forum_topic.n_messages', [data.total]))
LeekWars.setActions([this.action])
if (this.topic.subscribed) { this.action.icon = 'notifications_active' }
this.$root.$emit('loaded')
this.newMessage = localStorage.getItem('forum/draft') as string
})
}
} else if (alarmInfo.delayInMinutes) {
timeout = alarmInfo.delayInMinutes * 60 * 1000;
} else if (alarmInfo.periodInMinutes) {
timeout = alarmInfo.periodInMinutes * 60 * 1000;
}
if (timeout !== 0) {
alarm.handler
= setTimeout(() => this.onAlarmEvent.emit(this.getAlarm(name)), timeout);
if (alarmInfo.periodInMinutes) {
timeout = alarmInfo.periodInMinutes * 60 * 1000;
alarm.handler
= setInterval(() => this.onAlarmEvent.emit(this.getAlarm(name)), timeout);
alarm.periodInMinutes = alarmInfo.periodInMinutes;
}
Vue.set(this.alarms, name, alarm);
}
}
addContextMenus(menuItems, webContentsId: number): void {
setBrowserActionBadgeBackgroundColor(extensionId: string, details): void {
if (this.badgeBackgroundColorArray[extensionId] === undefined) {
Vue.set(this.badgeBackgroundColorArray, extensionId, []);
}
const badge = this.badgeBackgroundColorArray[extensionId];
if (badge) {
if (details.tabId) {
Vue.set(badge,
`${require('lulumi').tabs.get(details.tabId).index}`,
details.color);
} else {
Vue.set(badge, '-1', details.color);
}
}
}
showBrowserActionBadgeBackgroundColor(extensionId: string): string | number {
clickCell(x: number, y: number) {
if (this.map[y][x] === 1) {
for (let h = 0; h < this.height; ++h) {
for (let w = 0; w < this.width; ++w) {
if (this.map[h][w] !== 1) {
Vue.set(this.map[h], w, 0)
}
}
}
} else {
for (let h = 0; h < this.height; ++h) {
for (let w = 0; w < this.width; ++w) {
if (this.map[h][w] !== 1) {
Vue.set(this.map[h], w, this.los(x, y, w, h) ? 2 : 0)
}
}
}
Vue.set(this.map[y], x, 3)
}
}
los(x1: number, y1: number, x2: number, y2: number) {
setBrowserActionBadgeText(extensionId: string, details): void {
if (this.badgeTextArray[extensionId] === undefined) {
Vue.set(this.badgeTextArray, extensionId, []);
}
const badge = this.badgeTextArray[extensionId];
if (badge) {
if (details.tabId) {
Vue.set(badge,
`${require('lulumi').tabs.get(details.tabId).index}`,
details.text);
} else {
Vue.set(badge, '-1', details.text);
}
}
}
showBrowserActionBadgeText(extensionId: string): string | number {
folder.expanded = localStorage.getItem('editor/folder/' + id) === 'true'
}
folder.items = data.folders
.filter((f: any) => f.folder === id)
.map((f: any) => buildFolder(f.id, folder))
folder.items.push(...(data.ais
.filter((ai: any) => ai.folder === id)
.map((ai: any) => new AIItem(ai, folder))
))
this.folderById[folder.id] = folder
return folder
}
this.rootFolder = buildFolder(0, this.rootFolder as Folder)
for (const ai of data.ais) {
ai.path = this.getAIFullPath(ai)
Vue.set(ai, 'modified', false)
Vue.set(this.ais, '' + ai.id, ai)
this.items[ai.name] = ai
}
this.update()
LeekWars.setTitle(this.$t('editor.title'), this.$t('editor.n_ais', [LeekWars.objectSize(data.ais)]))
})
}
function mouseover(i: number) {
Vue.set(active.value, i, true);
}
}
folder.items = data.folders
.filter((f: any) => f.folder === id)
.map((f: any) => buildFolder(f.id, folder))
folder.items.push(...(data.ais
.filter((ai: any) => ai.folder === id)
.map((ai: any) => new AIItem(ai, folder))
))
this.folderById[folder.id] = folder
return folder
}
this.rootFolder = buildFolder(0, this.rootFolder as Folder)
for (const ai of data.ais) {
ai.path = this.getAIFullPath(ai)
Vue.set(ai, 'modified', false)
Vue.set(this.ais, '' + ai.id, ai)
this.items[ai.name] = ai
}
this.update()
LeekWars.setTitle(this.$t('editor.title'), this.$t('editor.n_ais', [LeekWars.objectSize(data.ais)]))
})
}
this.getClassUsageCounts(record.nonemptySubClasses).then((usage) => {
for (const subclassId of record.nonemptySubClasses) {
const instances = usage.get(subclassId)!
const subclasses = this.getHierarchyRecord(subclassId).allSubclasses
if (instances) {
Vue.set(this.subclassesInstances, subclassId, instances)
}
if (subclasses) {
Vue.set(this.subclassesSubclasses, subclassId, subclasses)
}
}
})
}
set hasDamageReduce(value) {
if (!this.abilityData.props)
this.abilityData.props = {};
if (!value)
Vue.delete(this.abilityData.props, "DamageReduce");
else if (!this.abilityData.props.DamageReduce)
Vue.set(this.abilityData.props, "DamageReduce", {})
}