If he's drinking every day he's an alcoholic. That's the first thing to realise. He's probably drinking more than you know. He's not going to recover unless he wants to. There's help out there for people to quit drinking, but he has to accept the help and he has to do the work himself, they can't do it for him. So unless he really wants it to, it won't work. It does need to be quit, cutting down doesn't work for alcoholics, it just creeps back up again, if they ever manage to cut down in the first place. The lies, the denial, the failure to take care of himself, the malnutrition (most of his calorie intake coming from alcohol), the mental symptoms including depression, memory loss and confusion, and eventually the weight loss - it's all part of alcoholism.
If he ever goes into hospital ensure they're informed of how much he's drinking. He's at risk of seizures if he goes cold turkey. And it affects how much of other drugs they can safely give him.
The Red Cross in my area used to run a befriending service who visit. That's the sort of thing that helps lonely people. Although if he won't go to the social club next door, he doesn't sound the type to help himself. Most likely he doesn't want to go because he can't chain smoke in there or people don't want to talk to him because he smells. I imagine he's not washing either himself or his clothes/bedding and could also be wetting himself at times with that level of alcohol consumption, in addition to the smell of smoke.
The best thing he could do would be a massive life overhaul, which he doesn't sound up for. Quit alcohol, engaging with alcohol services, referred by GP. Quit smoking, referral by GP for help. Sort out pain relief if his is ineffective. If the leg is next to useless and there's no effective pain relief, amputation would probably be the lesser of the evils and he'd maybe manage better and have better quality of life after recovering from the operation and making the necessary adjustments to his life, but understandably it may not feel that way to the person with the problem who can't bear the thought of losing a limb. They'd also not be able to safely give an alcoholic the necessary anaesthetic for the operation without possibly permanently ruining their already strained liver, so would maybe expect him to quit drinking first. Antidepressants would help if he's depressed even after quitting drinking and getting adequate pain relief. The sedating types act like a sleeping pill too. He must have some sort of income so could pay a cleaner, but some people are happy in their messy and filthy environment, everyone has their own standards. Even if he's not happy, you cleaning up maybe shames him so he'd rather ignore it. His friend isn't a friend but a user, but you already know that. He could start socialising at the club next door or get a hobby. But he sounds like he's given up. I'm not sure if a person can come back from that if they don't want to try.
You could make his GP aware of what's going on. They might call him in for a checkup, although you can't force him to go or to take the GPs advice. No point contacting social services, they'll call it a lifestyle choice, so no help given and if it was he'd have capacity, so they'd allow him to refuse help. Help they won't want to give anyway because they've no budget for it.
It is heartbreaking to watch someone self destruct like this. The best thing you can do is get in touch with Al-Anon, who help the families of alcoholics. So you can learn to keep yourself sane, not become too sucked into this mess he's creating and come to terms with the fact there's almost nothing you can do for someone who doesn't want help. Sorry OP, I know that's not what you want to hear