Модуль:Test2

Материал из Neverwinter Wiki
Перейти к: навигация, поиск

Для документации этого модуля может быть создана страница Модуль:Test2/doc

local itemIcon = require('Модуль:Item_icon')

local p = {}

function p.Main( frame )
    local cargo = mw.ext.cargo
    tables = 'Items'
    fields = '_pageName,name,icon,type,item_use,hit_points_max,stat_accuracy,stat_armor_penetration,stat_awareness,stat_combat_advantage,stat_crit_chance,stat_crit_resist,stat_defense,stat_deflection,stat_movement,stat_power,stat_recovery,stat_regeneration,stat_resilience,stat_universal,utility_companion_influence,utility_gold_boost,utility_glory_boost,utility_xp_bonus,utility_incoming_healing,utility_control_bonus,utility_control_resist'
    local args = {
        where='type HOLDS LIKE "%Артефакт Единения%" OR type HOLDS LIKE "%Артефакт Равновесия%" OR type HOLDS LIKE "%Артефакт Силы%"',
        orderBy = '_pageName,'
    }

    local result = cargo.query( tables, fields, args )
    local r = result[1]

    --Start the table

    local tbl = mw.html.create('table')
	tbl:addClass('wikitable sortable filter-table')
			tbl:tag("th"):attr('style', 'width: 15%'):wikitext("Предмет"):done()
            tbl:tag("th"):attr('style', 'width: 25%'):wikitext("Параметры"):done()
            tbl:tag("th"):wikitext("Использовать"):done()
		tbl:done()
         --Construct the rows in the table
        for _,row in ipairs(result) do
            local hit_points_max = ''
            local stat_accuracy = ''
            local stat_armor_penetration = ''
            local stat_awareness = ''
            local stat_combat_advantage = ''
            local stat_crit_chance = ''
            local stat_crit_resist = ''
            local stat_defense = ''
            local stat_deflection = ''
            local stat_movement = ''
            local stat_power = ''
            local stat_regeneration = ''
            local utility_companion_influence = ''
            local utility_incoming_healing = ''
            local utility_control_bonus = ''
            local utility_control_resist = ''
            if row.hit_points_max ~= '' then
                hit_points_max = 'Максимум хитов'
            end
            if row.stat_accuracy ~= '' then
                stat_accuracy = ', Точность'
            end
            if row.stat_armor_penetration ~= '' then
                stat_armor_penetration = ', Проникающий урон'
            end
            if row.stat_awareness ~= '' then
                stat_awareness = ', Осведомленность'
            end
            if row.stat_combat_advantage ~= '' then
                stat_combat_advantage = ', Боевое преимущество'
            end
            if row.stat_crit_chance ~= '' then
                stat_crit_chance = ', Вероятность критического удара'
            end
            if row.stat_crit_resist ~= '' then
                stat_crit_resist = ', Критическое уклонение'
            end
            if row.stat_defense ~= '' then
                stat_defense = ', Оборона'
            end
            if row.stat_deflection ~= '' then
                stat_deflection = ', Уклонение'
            end
            if row.stat_movement ~= '' then
                stat_movement = ', Скорость движения'
            end
            if row.stat_power ~= '' then
                stat_power = ', Могущество'
            end
            if row.stat_regeneration ~= '' then
                stat_regeneration = ', Восстановление здоровья'
            end
            if row.utility_companion_influence ~= '' then
                utility_companion_influence = ', Влияние спутника'
            end
            if row.utility_incoming_healingv ~= '' then
                utility_incoming_healing = ', Принимаемое лечение'
            end
            if row.utility_control_bonus ~= '' then
                utility_control_bonus = ', Бонус к контролю'
            end
            if row.utility_control_resist ~= '' then
                utility_control_resist = ', Сопротивляемость контролю'
            end
            local dataFilter = {hit_points_max,stat_accuracy, stat_armor_penetration, stat_awareness, stat_combat_advantage, stat_crit_chance, stat_crit_resist, stat_defense, stat_deflection, stat_movement, stat_power, stat_regeneration, utility_companion_influence, utility_incoming_healing, utility_control_bonus, utility_control_resist}
            tr = tbl:tag("tr"):attr("data-filter", table.concat(dataFilter))
                tr:tag("td"):wikitext(itemIcon.Main({args={row._pageName,""}})):done()
                local hit_points_max_number = ''
                local stat_accuracy_number = ''
                local stat_armor_penetration_number = ''
                local stat_awareness_number = ''
                local stat_combat_advantage_number = ''
                local stat_crit_chance_number = ''
                local stat_crit_resist_number = ''
                local stat_defense_number = ''
                local stat_deflection_number = ''
                local stat_movement_number = ''
                local stat_power_number = ''
                local stat_regeneration_number = ''
                local utility_companion_influence_number = ''
                local utility_incoming_healing_number = ''
                local utility_control_bonus_number = ''
                local utility_control_resist_number = ''
                if row.hit_points_max ~= '' then
                    hit_points_max_number = '+' .. row.hit_points_max .. ' <span class="slate">Максимум хитов</span><br>'
                end
                if row.stat_accuracy ~= '' then
                    stat_accuracy_number = '+' .. row.stat_accuracy .. ' <span class="slate">Точность</span><br>'
                end
                if row.stat_armor_penetration ~= '' then
                    stat_armor_penetration_number = '+' .. row.stat_armor_penetration .. ' <span class="slate">Проникающий урон</span><br>'
                end
                if row.stat_awareness ~= '' then
                    stat_awareness_number = '+' .. row.stat_awareness .. ' <span class="slate">Осведомленность</span><br>'
                end
                if row.stat_combat_advantage ~= '' then
                    stat_combat_advantage_number = '+' .. row.stat_combat_advantage .. ' <span class="slate">Боевое преимущество</span><br>'
                end
                if row.stat_crit_chance ~= '' then
                    stat_crit_chance_number = '+' .. row.stat_crit_chance .. ' <span class="slate">Вероятность критического удара</span><br>'
                end
                if row.stat_crit_resist ~= '' then
                    stat_crit_resist_number = '+' .. row.stat_crit_resist .. ' <span class="slate">Критическое уклонение</span><br>'
                end
                if row.stat_defense ~= '' then
                    stat_defense_number = '+' .. row.stat_defense .. ' <span class="slate">Оборона</span><br>'
                end
                if row.stat_deflection ~= '' then
                    stat_deflection_number = '+' .. row.stat_deflection .. ' <span class="slate">Уклонение</span><br>'
                end
                if row.stat_movement ~= '' then
                    stat_movement_number = '+' .. row.stat_movement .. ' <span class="slate">Скорость движения</span><br>'
                end
                if row.stat_power ~= '' then
                    stat_power_number = '+' .. row.stat_power .. ' <span class="slate">Могущество</span><br>'
                end
                if row.stat_regeneration ~= '' then
                    stat_regeneration_number = '+' .. row.stat_regeneration .. ' <span class="slate">Восстановление здоровья</span><br>'
                end
                if row.utility_companion_influence ~= '' then
                    utility_companion_influence_number = '+' .. row.utility_companion_influence .. ' <span class="slate">Влияние спутника</span><br>'
                end
                if row.utility_incoming_healing ~= '' then
                    utility_incoming_healing_number = '+' .. row.utility_incoming_healing .. ' <span class="slate">Принимаемое лечение</span><br>'
                end
                if row.utility_control_bonus ~= '' then
                    utility_control_bonus_number = '+' .. row.utility_control_bonus .. ' <span class="slate">Бонус к контролю</span><br>'
                end
                if row.utility_control_resist ~= '' then
                    utility_control_resis_numbert = '+' .. row.utility_control_resist .. ' <span class="slate">Сопротивляемость контролю</span><br>'
                end

            tr:tag("td"):wikitext(hit_points_max_number .. ' ' .. stat_accuracy_number .. ' ' .. stat_armor_penetration_number .. ' ' .. stat_awareness_number .. ' ' .. stat_combat_advantage_number .. ' ' .. stat_crit_chance_number .. ' ' .. stat_crit_resist_number .. ' ' .. stat_defense_number .. ' ' .. stat_deflection_number .. ' ' .. stat_movement_number .. ' ' .. stat_power_number .. ' ' .. stat_regeneration_number .. ' ' .. utility_companion_influence_number .. ' ' .. utility_incoming_healing_number.. ' ' .. utility_control_bonus_number.. ' ' .. utility_control_resist_number):done() 
	        tr:tag("td"):wikitext(row.item_use):done()
	        --end
			end
	return tbl
end
return p