i like the ending but i never expected luffy to leave. Knowing his personality he would never have left Z to die whatever that man might have said.
They weren't friends, and Z was pretty adamant about going out fighting since he was dying of sickness anyway. He hated the marines for making the man who slaughtered his entire platoon a Shichibukai, and he hated pirates for killing his wife and child.
There is also the fact that Most of the VA's and Kizaru were there.