• Welcome to the Kancolle Wiki!
  • If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord

Changes

Jump to navigation Jump to search
Testing がか's suggested fix for multi-letter nodes.
Line 8: Line 8:     
-- checks if data is in the array as a key
 
-- checks if data is in the array as a key
 +
 +
function getLetterNum(x)
 +
  local ab = mw.text.split(x, "-")
 +
  return ab[2] and ab[1] or x:sub(1, 1), ab[2] and ab[2]:sub(1, 1) or x:sub(2, 2)
 +
end
 +
-- local letter, num = getLetterNum("A1_xxx") -- A and 1
 +
-- local letter, num = getLetterNum("XX3-1_xxx") -- XX3 and 1
 +
 
function valid(data, array)
 
function valid(data, array)
 
     local valid = {}
 
     local valid = {}
Line 345: Line 353:  
     for k,v in pairs(frame.args) do
 
     for k,v in pairs(frame.args) do
 
         if string.lower(k) ~= "boss_node" and string.lower(k) ~= "final_form" and string.lower(k) ~= "post_final_form" then
 
         if string.lower(k) ~= "boss_node" and string.lower(k) ~= "final_form" and string.lower(k) ~= "post_final_form" then
             local letter = mw.text.split(k,"")[1]
+
             local letter, num = getLetterNum(k)
            local num = mw.text.split(k,"")[2]
  −
            if letter == 'z' then
  −
            val = string.find(k, "-")
  −
            if val ~= nil then
  −
            letter = mw.text.split(k, "-")[1]
  −
            num = mw.text.split(k, "")[val + 1]
  −
            end
  −
            end
   
             if validNodeLetters[letter] and tonumber(num) ~= nil then
 
             if validNodeLetters[letter] and tonumber(num) ~= nil then
 
                 mapEncounterTable[letter] = {}
 
                 mapEncounterTable[letter] = {}
Line 379: Line 379:  
     -- nodePattern should be like A1_xp, B3_lv, C1_form or something
 
     -- nodePattern should be like A1_xp, B3_lv, C1_form or something
 
     for nodePattern,patternInfo in pairs(frame.args) do
 
     for nodePattern,patternInfo in pairs(frame.args) do
         local letter = mw.text.split(nodePattern,"")[1]
+
         local letter, patternNum = getLetterNum(nodePattern)
        if letter == 'z' then
  −
        val = string.find(k, "-")
  −
            if val ~= nil then
  −
            letter = mw.text.split(k, "-")[1]
  −
            end
  −
        end
      
         if mapEncounterTable[letter] ~= nil and nodePattern ~= "final_form" and nodePattern ~= "post_final_form" then
 
         if mapEncounterTable[letter] ~= nil and nodePattern ~= "final_form" and nodePattern ~= "post_final_form" then
3,663

edits

Navigation menu