-- 직업별 소모품
local ConsumeDef
local class = UnitClass("Player")
if class == "전사" then
	ConsumeDef = { }
elseif class == "사냥꾼" then
	ConsumeDef = { }
elseif class == "도적" then
      ConsumeDef = {
        { name = "맹독 IX", icon = nil },
	{ name = "순간 효과 독 IX", icon = nil },
	{ name = "상처 감염 독 VII", icon = nil },
        { name = "신경 마비 독", icon = nil },
        { name = "정신 마비 독", icon = nil },
        { name = "정신 마취 독 II", icon = nil },
      }
elseif class == "사제" then
      ConsumeDef = {
        { name = "신성한 양초", icon = nil },
        { name = "성스러운 양초", icon = nil },
        { name = "기원의 양초", icon = nil },
      }
elseif class == "마법사" then
      ConsumeDef = {
        { name = "불가사의한 가루", icon = nil },
        { name = "순간이동의 룬", icon = nil },
        { name = "차원이동의 룬", icon = nil },
        { name = "가벼운 깃털", icon = nil },
      }
elseif class == "주술사" then
      ConsumeDef = {
        { name = "십자가", icon = nil },
        { name = "반짝이는 물고기 비늘", icon = nil },
        { name = "물고기 오일", icon = nil },
      }
elseif class == "성기사" then
      ConsumeDef = {
        { name = "신앙의 징표", icon = nil },
        { name = "왕의 징표", icon = nil },
      }
elseif class == "흑마법사" then
      ConsumeDef = {
        { name = "영혼의 조각", icon = nil },
        { name = "지옥의 돌", icon = nil },
        { name = "악마의 구슬", icon = nil },
      }
elseif class == "드루이드" then
      ConsumeDef = {
	{ name = "야생 가시돌기", icon = nil },
	{ name = "야생 가시덩굴", icon = nil },
	{ name = "별잎 씨앗", icon = nil },
      }
elseif class == "죽음의 기사" then
      ConsumeDef = {
    	{ name = "시체 가루", icon = nil },
      }
else
	ConsumeDef = { }
end

-- 문장
local EmblemDef = {
        { name = "", icon = nil },
        { name = "바위 문지기의 조각", icon = nil },
        { name = "무용의 문장", icon = nil },
        { name = "용맹의 문장", icon = nil },
	{ name = "정복의 문장", icon = nil },
	{ name = "승전의 문장", icon = nil },
}

-- 훈장
local MarkDef = {
        { name = "", icon = nil },
        { name = "겨울손아귀 명예 훈장", icon = nil },
        { name = "고대의 해안 명예 훈장", icon = nil },
        { name = "폭풍의 눈 명예 훈장", icon = nil },
        { name = "아라시 분지 명예 훈장", icon = nil },
        { name = "전쟁노래 협곡 명예 훈장", icon = nil },
        { name = "알터랙 계곡 명예 훈장", icon = nil },
        { name = "정복의 섬 명예 훈장", icon = nil },
}



local CanMerchantRepair = CanMerchantRepair
local EquipItemByName = EquipItemByName
local GetContainerItemInfo = GetContainerItemInfo
local GetContainerItemLink = GetContainerItemLink
local GetContainerNumSlots = GetContainerNumSlots
local GetInventoryItemDurability = GetInventoryItemDurability
local GetInventoryItemLink = GetInventoryItemLink
local GetInventorySlotInfo = GetInventorySlotInfo
local GetItemCount = GetItemCount
local GetMoney = GetMoney
local GetRepairAllCost = GetRepairAllCost
local RepairAllItems = RepairAllItems
local UnitName = UnitName

--------------------------------------------------------------------------------
-- Library
--------------------------------------------------------------------------------
--[[
local print = function(s)
  DEFAULT_CHAT_FRAME:AddMessage("|cffff7d0aJN_Info : "..s.."|r")
end
]]

local getGSC = function(money)
  local gold, silver, copper
  g = floor(money / COPPER_PER_GOLD)
  s = floor(money / COPPER_PER_SILVER) - g * SILVER_PER_GOLD
  c = money - g * COPPER_PER_GOLD - s * COPPER_PER_SILVER
  return g,s,c
end

local setFont = function(parent, fontHeight, r, g, b)
	local fs = parent:CreateFontString(nil, "OVERLAY")
	fs:SetFont(STANDARD_TEXT_FONT, fontHeight)
	fs:SetShadowColor(0,0,0)
	fs:SetShadowOffset(0.8, -0.8)
	fs:SetTextColor(r,g,b)
	fs:SetHeight(16)
  fs:SetJustifyV("MIDDLE")
  fs:Show()
	return fs
end
--[[
local setIcon = function(parent, texture, l,r,t,b)
	local ic = parent:CreateTexture(nil, "ARTWORK")
  ic:SetTexture(texture)
  ic:SetTexCoord(l,r,t,b)
	ic:SetWidth(16)
	ic:SetHeight(16)
  ic:Show()
	return ic
end
]]
local getMoneyText = function(money)
  local g,s,c = getGSC(money)
  local str = string.format("|cFFFFD200%d● |cFFE0E0E0%.2d● |cFFF06679%.2d●|r", g, s, c)
  local moneytext = GetCoinTextureString and GetCoinTextureString(money) or str		-- 수정: 골드 텍스쳐를 활용한다.
  return moneytext
end


--------------------------------------------------------------------------------
-- Update Money
--------------------------------------------------------------------------------
local updateMoney = function()
  local money = GetMoney()
  if money == nil or money < 1 then return end

  local player = UnitName("player")

  JN_InfoDB[player].money = money
  JN_InfoDB[player].realm = GetRealmName()

  JN_Info.textG:SetText(getMoneyText(money))
end


---------------
-- 항목 생성 --
---------------
local CreateInfoMenu = function(items, Emblem, Mark)
  local level = UnitLevel("player")
  -- 직업별 소모품
  if items then
	  for k,v in pairs(items) do
	    table.insert(JN_Info.Items, {name = v.name, icon = v.icon})
	  end
  end
  -- 문장류
  if Emblem and level > 70 then
	  for k,v in pairs(Emblem) do
	    table.insert(JN_Info.Items, {name = v.name, icon = v.icon})
	  end
  end
  -- 훈장류
  if Mark and level > 70 then
	  for k,v in pairs(Mark) do
	    table.insert(JN_Info.Items, {name = v.name, icon = v.icon})
	  end
  end
end


--------------------------------------------------------------------------------
-- Initialize
--------------------------------------------------------------------------------

local initiaizeInfo = function()

  JN_Info.OnColor = { r = 0.0, g = 1.0, b = 0.0 }
  JN_Info.OffColor = { r = 1.0, g = 1.0, b = 1.0 }
  JN_Info.BgColor = { r = 0.4, g = 0.4, b = 0.4, a = 0.2 }

  CreateInfoMenu(
	ConsumeSV,	-- 직업별 소모품
	EmblemSV,	-- 문장류
	MarkSV		-- 훈장류
    )
end
--------------------------------------------------------------------------------
-- Auto-Size Money Frame
--------------------------------------------------------------------------------
local resizeMoneyFrame = function()
  if InCombatLockdown() then return end

  JN_Info:SetWidth(150)

  JN_InfoOptionsDB.FrameWidth = JN_Info.textG:GetStringWidth() + 20


  if JN_InfoOptionsDB.FrameWidth > 150 then
	  JN_Info:SetWidth(JN_InfoOptionsDB.FrameWidth)
  end

end

local searchIcon = function()
  if JN_Info.Items and #JN_Info.Items > 0 then
    for k,v in pairs(JN_Info.Items) do
      -- Icon이 없으면....
      --if v.icon == nil or v.icon == "" then
      if not v.icon then
        -- JN_InfoIconDB 서 찾아보자
        if JN_InfoIconDB[v.name] then
          v.icon = JN_InfoIconDB[v.name]
        else
          v.icon = GetItemIcon(v.name)
          -- JN_InfoIconDB 에 삽입
          if v.icon then
            JN_InfoIconDB[v.name] = v.icon
          end
        end
      else
            JN_InfoIconDB[v.name] = v.icon
      end
    end
  end
end

--------------------------------------------------------------------------------
-- Calc Arena Team Info
--------------------------------------------------------------------------------
local getTeamPoints = function(id)

  local teamName, teamSize, teamRating, weekPlayed, weekWins, seasonPlayed, seasonWins, playerPlayed, _, _, playerRating  = GetArenaTeam(id);

	local playedPercent, arenaValid = 0, 0
	if weekPlayed ~= 0 then
  	playedPercent = (playerPlayed / weekPlayed) * 100;
  	if weekPlayed >= 10 and playedPercent >= 30 then
      arenaValid = 1
  	end
  end

	if (teamRating < 1500) then
	  teamPoints = (0.22 * teamRating) + 14;
	else
	  teamPoints = 1511.26 / (1 + 1639.28 * 2.71828^(-0.00412 * teamRating));
	end

  if (teamSize == 2) then
	  teamPoints = teamPoints * 0.76;
	elseif (teamSize == 3) then
	  teamPoints = teamPoints * 0.88;
  end

  if (teamPoints < 0 ) then
	  teamPoints = 0;
	end

	return floor(teamPoints + 0.5), teamSize, arenaValid, weekWins, weekPlayed, playerPlayed, playedPercent, teamRating, playerRating
end


--------------------------------------------------------------------------------
-- Update Instance Info
--------------------------------------------------------------------------------
local normalSet = {1,1,1}
local extendedSet = {0,1,0}
local lockedSet = {1,0.8,0}

local updateInstanceInfo = function()
  local player = UnitName("player")
  JN_InfoDB[player].InstanceInfo = {}
  JN_InfoDB[player].classname = select(2,UnitClass("player"))

  for i = 1, GetNumSavedInstances() do
    local instanceName, instanceID, instanceReset, difficulty, locked, extended, _, isRaid, _, instanceType = GetSavedInstanceInfo(i)
    --if instanceReset > 0 then
    table.insert(JN_InfoDB[player].InstanceInfo, { name = instanceName, id = instanceID, reset = instanceReset, time = GetTime(), instype = instanceType, lock = locked, extend = extended })
    --end
  end
end

--------------------------------------------------------------------------------
-- Show Tooltip
--------------------------------------------------------------------------------
local subAddArenaToolTip = function(arenas, size)
  local r,g,b = 1, 1, 1
	if arenas[size].point ~= nil then
    if arenas[size].valid ~= 1 then r,g,b = 0.5, 0.5, 0.5 end
	  GameTooltip:AddDoubleLine("  "..size.." vs "..size, "예상 점수: "..arenas[size].point, r,g,b, r,g,b)
    GameTooltip:AddDoubleLine("  ", "전적: "..arenas[size].win.."승"..arenas[size].lost.."패  출전: "..arenas[size].played.."/"..arenas[size].playedtotal.." "..format("%.0f",arenas[size].percent).."%", r,g,b, r,g,b)
	  GameTooltip:AddDoubleLine("  ", "팀 평점: "..arenas[size].rating.."  개인 평점: "..arenas[size].prating, r,g,b, r,g,b)
	end
end

local showTooltip = function(self)
	if JN_InfoDB == nil then return end

	updateMoney()
	resizeMoneyFrame()


  local str
	local total = 0
  local player = UnitName("player")
  local realm = GetRealmName()

	--GameTooltip:SetOwner(JN_Info, "ANCHOR_BOTTOMRIGHT", -200, 0)
	GameTooltip:SetOwner(JN_Info, "ANCHOR_TOPRIGHT", 0, 10)

  local money = GetMoney()
  if money ~= nil then
    str = getMoneyText(money)
    GameTooltip:AddDoubleLine(player, str, 0, 1, 0)
    total = money
  end

  -- Show Money
  for k,v in pairs(JN_InfoDB) do
    if v ~= nil then
      if v.name ~= nil and v.money ~= nil and player ~= v.name and realm == v.realm then
        str = getMoneyText(v.money)
  	  	GameTooltip:AddDoubleLine(v.name, str, 1, 1, 1)
  	  	total = total + v.money
  	  end
    end
	end
  str = getMoneyText(total)
	GameTooltip:AddDoubleLine("\n총합", str, 0, 1, 1)

  local r,g,b
  -- Show Comsumption Item Count
  local count
  if JN_Info.Items and #JN_Info.Items > 0 then
    GameTooltip:AddLine(" ")
    for k,v in pairs(JN_Info.Items) do
      if v.name == "" then
        GameTooltip:AddLine(" ")
      else
        count = GetItemCount(v.name, true)
        if count > 0 then
          r,g,b = 1, 1, 1
        else
	  r,g,b = 1,0.3,0.1
        end
        GameTooltip:AddDoubleLine(v.name, count, r,g,b, r,g,b)
        GameTooltip:AddTexture(v.icon)
	-- 아이콘이 중간까지 나오다가 나타나지 않는 이유는, API 자체적으로 한 툴팁당 10개 미만으로 아이콘 표시 제한되기 때문.
      end
    end
  end

  -- Show Arena Points
  local arenas = {[2] = {}, [3] = {}, [5] = {}}
  for i = 1, 3 do
    local teamPoints, teamSize, arenaValid, weekWins, weekPlayed, playerPlayed, playedPercent, teamRating, playerRating  = getTeamPoints(i)

    if arenas[teamSize] ~= nil then
      arenas[teamSize].point = teamPoints
      arenas[teamSize].rating = teamRating
      arenas[teamSize].prating = playerRating
      arenas[teamSize].valid = arenaValid
      arenas[teamSize].win = weekWins
      arenas[teamSize].lost = weekPlayed-weekWins
      arenas[teamSize].played = playerPlayed
      arenas[teamSize].playedtotal = weekPlayed
      arenas[teamSize].percent = playedPercent
    end
  end

  local maxp = 0
	if arenas[2].point ~= nil and arenas[2].valid == 1 then maxp = arenas[2].point end
	if arenas[3].point ~= nil and arenas[3].valid == 1 and maxp < arenas[3].point then maxp = arenas[3].point end
	if arenas[5].point ~= nil and arenas[5].valid == 1 and maxp < arenas[5].point then maxp = arenas[5].point end

  local arenaCur = GetArenaCurrency()
  if UnitLevel('player') == MAX_PLAYER_LEVEL then
	  GameTooltip:AddLine(" ")
	  GameTooltip:AddDoubleLine("투기장 점수", arenaCur.." + "..maxp.." = "..arenaCur+maxp, 0, 1, 0)
  end

  subAddArenaToolTip(arenas, 2)
  subAddArenaToolTip(arenas, 3)
  subAddArenaToolTip(arenas, 5)

  GameTooltip:AddLine(" ")
  GameTooltip:AddDoubleLine("명예 점수", GetHonorCurrency(), 0, 1, 0)

	-- Instance Info
	local  _, cname = UnitClass("PLAYER")
	local colorclass = { }
	for k, v in pairs (RAID_CLASS_COLORS[cname]) do
	   tinsert(colorclass, 1, v)
	end
	local rcolor, gcolor, bcolor = unpack(colorclass)

	RequestRaidInfo()	-- 현재 접속중이 캐릭터의 인던 귀속 정보 시간을 툴팁 표시 때 갱신해준다. 다만 갱신 시간 딜레이로 바로 업뎃되지 않으며, 다음 툴팁 표시에 반영된다.
        GameTooltip:AddLine(" ")
	local insnum = GetNumSavedInstances()
	if insnum > 0 then
		GameTooltip:AddLine(player, rcolor, gcolor, bcolor)
  		for i = 1, insnum do
			local instanceName, instanceID, instanceReset, difficulty, locked, extended, _, isRaid, _, instanceType = GetSavedInstanceInfo(i)
		    if instanceReset > 0 then
			local rLock, gLock, bLock = unpack(locked and lockedSet or normalSet)
			local rExt, gExt, bExt = unpack(extended and extendedSet or normalSet)
			GameTooltip:AddDoubleLine("   "..instanceName.." - "..instanceType.." ("..instanceID..")", SecondsToTime(instanceReset), rLock, gLock, bLock, rExt, gExt, bExt)
		    end
	        end
	else
		GameTooltip:AddDoubleLine(player, "귀속 인던 없음", rcolor, gcolor, bcolor, 0,1,1)
	end
--[[
  local found = 0
  for k,v in pairs(JN_InfoDB) do
    if v.name ~= player and realm == v.realm then
      for q,r in pairs(v.InstanceInfo) do
        if r.reset - r.time * 2 + GetTime() < 1 then
          found = 1
          break
        end
      end

      if found == 0 and v.InstanceInfo ~= nil and #v.InstanceInfo > 0 then
        GameTooltip:AddLine(v.name, 1, 0.6, 0.3)
        for q,r in pairs(v.InstanceInfo) do
          if r.reset - r.time * 2 + GetTime() > 1 then
            GameTooltip:AddDoubleLine("   "..r.name..r.instype.." ("..r.id..")", SecondsToTime(r.reset - r.time * 2 + GetTime()), 1,0.3,0.1, 1,0.3,0.1)
          end
        end
      else
        GameTooltip:AddDoubleLine(v.name, "귀속 인던 없음", 1,1,1, 1,1,1)
      end
    end
  end
  ]]
  for k,v in pairs(JN_InfoDB) do
    if v.name ~= player and realm == v.realm then

	local colorclass = { }
	for k, v in pairs (RAID_CLASS_COLORS[v.classname]) do
	   tinsert(colorclass, 1, v)
	end
	local rcolor, gcolor, bcolor = unpack(colorclass)

      if v.InstanceInfo ~= nil and #v.InstanceInfo > 0 then
        GameTooltip:AddLine(v.name, rcolor, gcolor, bcolor)
	for q,r in pairs(v.InstanceInfo) do
		local rLock, gLock, bLock = unpack(r.lock and lockedSet or normalSet)
		local rExt, gExt, bExt = unpack(r.extend and extendedSet or normalSet)
		if r.reset > 0 then
			GameTooltip:AddDoubleLine("   "..r.name.." - "..r.instype.." ("..r.id..")", SecondsToTime(r.reset + r.time - GetTime()), rLock, gLock, bLock, rExt, gExt, bExt)
		end
        end
      else
	        GameTooltip:AddDoubleLine(v.name, "귀속 인던 없음", rcolor,gcolor,bcolor, 0,1,1)
      end
    end
  end


	GameTooltip:Show()
end

--------------------------------------------------------------------------------
-- Init
--------------------------------------------------------------------------------
local initVariables = function()

  local player = UnitName("player")

  if JN_InfoDB == nil then JN_InfoDB = {} end
  if JN_InfoDB[player] == nil then JN_InfoDB[player] = {} end
  if JN_InfoDB[player].name == nil then JN_InfoDB[player].name = player end
  if JN_InfoDB[player].money == nil then JN_InfoDB[player].money = GetMoney() end

  if JN_InfoOptionsDB == nil then
    JN_InfoOptionsDB = {}
    JN_InfoOptionsDB.FrameWidth = 65
  end

  JN_Info:SetWidth(JN_InfoOptionsDB.FrameWidth)

  local money = GetMoney()
  if money ~= nil then
    JN_Info.textG:SetText(getMoneyText(money))
  end




  if not JN_InfoIconDB then JN_InfoIconDB = {} end
  searchIcon()
end

--------------------------------------------------------------------------------
-- Event
--------------------------------------------------------------------------------
local onEvent = function()
  if event == "PLAYER_LOGIN" then
      updateMoney()
  elseif event == "VARIABLES_LOADED" then

	ConsumeSV = ConsumeSV or ConsumeDef
	EmblemSV = EmblemSV or EmblemDef
	MarkSV = MarkSV or MarkDef

    initiaizeInfo()
    initVariables()
    local player = UnitName("player")
    local realm = GetRealmName()
    if JN_InfoDB[player].money ~= nil and JN_InfoDB[player].realm == GetRealmName() then
      JN_Info.textG:SetText(getMoneyText(JN_InfoDB[player].money))
    else
      updateMoney()
    end
  elseif event == "PLAYER_MONEY" or event == "MAIL_CLOSED" then
    updateMoney()
  elseif event == "UPDATE_INSTANCE_INFO" then
    updateInstanceInfo()
  end
end

--------------------------------------------------------------------------------
-- Create Main Frame
--------------------------------------------------------------------------------
local createAddon = function()
  local frame = CreateFrame("Frame", "JN_Info_Frame", UIParent)
  frame:SetPoint("CENTER")
  frame:SetFrameStrata("HIGH")
  frame:SetWidth(16)
  frame:SetHeight(16)
  frame:SetClampedToScreen(true)
  frame:RegisterForDrag("LeftButton")
  frame:SetMovable(true)
  frame:EnableMouse(true)

  -- General
  frame:RegisterEvent("PLAYER_LOGIN")
  frame:RegisterEvent("VARIABLES_LOADED")


  -- Money
  frame:RegisterEvent("PLAYER_MONEY")
  frame:RegisterEvent("MAIL_CLOSED")

  -- Instance Info
  frame:RegisterEvent("UPDATE_INSTANCE_INFO")

  --frame.iconD = setIcon(frame, "Interface\\Icons\\Trade_Blacksmithing", 0.0, 1.0, 0.0, 1.0)
  --frame.iconD:SetPoint("LEFT")

--[[
  --frame.textD = setFont(frame, 16, 1, 1, 1)
  frame.textD = setFont(frame, 15, 1, 0.82, 0)
  frame.textD:SetPoint("LEFT")
  --frame.textD:SetPoint("LEFT", frame.iconD, "RIGHT", 2, 0)
  frame.textD:SetWidth(35)
  frame.textD:SetJustifyH("LEFT")
]]
  --frame.textG = setFont(frame,  13, 1.0, 1.0, 0.0)
  frame.textG = setFont(frame,  15, 1.0, 0.82, 0.0)
  frame.textG:SetPoint("RIGHT")
  --frame.textG:SetPoint("LEFT", frame.textD, "RIGHT", 5, 0)
  frame.textG:SetJustifyH("RIGHT")

  --frame:SetScript("OnDragStart", frame.StartMoving)
  frame:SetScript("OnDragStart", function(self) if (IsShiftKeyDown()) then frame:StartMoving() end end)
  frame:SetScript("OnDragStop", frame.StopMovingOrSizing)
  frame:SetScript("OnEnter", showTooltip)
  frame:SetScript("OnLeave", function(self) GameTooltip:Hide(); end)
  frame:SetScript("OnEvent", onEvent)

  frame:Show()
  return frame
end


--------------------------------------------------------------------------------
-- AddOn
--------------------------------------------------------------------------------
JN_Info = createAddon()
JN_Info.Items = {}



SlashCmdList["JN_Info"] = function(msg)
	if (string.sub(msg, 1, 1) == "c") then
		if (string.sub(msg, 3, 5) == "add") then
			table.insert(ConsumeSV, {name = string.sub(msg, 7), icon = nil})
		elseif (string.sub(msg, 3, 5) == "del") then
			for i = 1, #ConsumeSV do
				if ConsumeSV[i].name == string.sub(msg, 7) then
					table.remove(ConsumeSV, i)
					break;
				end
			end
		end
	elseif (string.sub(msg, 1, 1) == "e") then
		if (string.sub(msg, 3, 5) == "add") then
			table.insert(EmblemSV, {name = string.sub(msg, 7), icon = nil})
		elseif (string.sub(msg, 3, 5) == "del") then
			for i = 1, #EmblemSV do
				if EmblemSV[i].name == string.sub(msg, 7) then
					table.remove(EmblemSV, i)
					break;
				end
			end
		end
	elseif (string.sub(msg, 1, 1) == "m") then
		if (string.sub(msg, 3, 5) == "add") then
			table.insert(MarkSV, {name = string.sub(msg, 7), icon = nil})
		elseif (string.sub(msg, 3, 5) == "del") then
			for i = 1, #MarkSV do
				if MarkSV[i].name == string.sub(msg, 7) then
					table.remove(MarkSV, i)
					break;
				end
			end
		end
	else
		DEFAULT_CHAT_FRAME:AddMessage("|cff88ffaa JN Info |c0000CC00사용법");
		DEFAULT_CHAT_FRAME:AddMessage("|cff88ffaa 명령어: |cFFFFCC00/info");
		DEFAULT_CHAT_FRAME:AddMessage("  |cFFFFCC00/info |c00FFFFFFc |c0000CC00add |cff88ffaa또는 |c00FF0000del |c00FFFFFF아이템~ 목록에 아이템을 추가 또는 삭제합니다.");
		DEFAULT_CHAT_FRAME:AddMessage("  |cFFFFCC00/info |c00FFFFFFe |c0000CC00add |cff88ffaa또는 |c00FF0000del |c00FFFFFF문장~ 목록에 문장을 추가 또는 삭제합니다.");
		DEFAULT_CHAT_FRAME:AddMessage("  |cFFFFCC00/info |c00FFFFFFm |c0000CC00add |cff88ffaa또는 |c00FF0000del |c00FFFFFF훈장~ 목록에 훈장을 추가 또는 삭제합니다.");
	end
	-- 툴팁 초기화
	JN_Info.Items = {}
	initiaizeInfo()
	initVariables()
end
SLASH_JN_Info1 = "/info"
