local function isWeeb(player) return player:getDescriptor():getProfession() == 'Weeb' end


local function OnCreatePlayer(n,player) 
    local data = player:getModData()
    if data.WaifuDakisWIP_spawned then return end

    if isWeeb(player) then
        local DakimakuraWeapons = DakimakuraWeapons  --global DakimakuraWeapons
        if DakimakuraWeapons and not DakimakuraWeapons:isEmpty() then
            local item = player:getInventory():AddItem(DakimakuraWeapons:get(ZombRand(DakimakuraWeapons:size()-1))) --adds daki to inventory

           local ISHotbar = getPlayerHotbar(player:getPlayerNum())
           local slot = ISHotbar.availableSlot[1]
           local slotDef = slot.def
            ISHotbar:attachItem(item, slotDef.attachments[item:getAttachmentType()], 1, ISHotbar:getSlotDef("Back"), false)--attached daki to back
            ISHotbar:update()
        
        end
    end
    if player:HasTrait("Blade") then
        --local item = InventoryItemFactory.CreateItem("Base.Katana")
        --local inv = player:getInventory()
        --inv:Additem(item)
        local item = player:getInventory():AddItem("Base.Katana")
        item:setCondition(item:getCondition()/8)
        player:setPrimaryHandItem(item)
        player:setSecondaryHandItem(item)
        --ISInventoryPage.renderDirty = true
    end

    data.WaifuDakisWIP_spawned = true
end


Events.OnCreatePlayer.Add(OnCreatePlayer)


