Schopenhauer's moral theory addresses the real agents of morality, human beings as they actually are in their everyday conduct (in his view) and not as mere Kantian rational agents. As human beings actually are, the main barriers to moral conduct are egoism and malice or spitefulness (not just egoism) :
▻ Egoism (Egoismus) and spitefulness (Gehdssigkeit)
'From egoism we should probably derive greed, gluttony, lust, selfishness, avarice, covetousness, injustice, hardness of heart, pride, arrogance, etc.; while to spitefulness (Gehdssigkeit) might be ascribed disaffection, envy, ill-will, malice, pleasure in seeing others suffer, prying curiosity, slander, insolence, petulance, hatred, anger, treachery, fraud, thirst for revenge, cruelty, etc.' (G., III, p. 582; B., pp. I57-I58 : 'G' = Arthur Schopenhauer: Sämtliche Werke in sechs Bänden, (ed. E. Grisebach, Reclam, Leipzig 1891–1895. Text, Schopenhauer, De Grundlage de Morale - 'On the Basis of Morality', 1840.)
▻ Compassion (Mitleid) or pity
Egoism and spitefulness can be combatted only, but can be effectively combatted and overcome, by compassion.
'There are only-three fundamental springs of human conduct, and all possible motives arise from one or other of these: They are (i) Egoism, which desires the weal of the self, and is limitless; (2) Malice, which desires the woe of others, and may develop to the utmost cruelty; (3) Compassion, which desires the weal of others, and may rise to nobleness and magnanimity. Every human act is referable to one of these springs, although two of them may work together.' (G., III, p. 59I; B., pp. I7I-I72.)
▻ Taxonomy of compassion : negative and positive.
Negative compassion is justice : the just 'respect the rights of every man, and abstain from all encroachment on them; they keep themselves free from self-reproach, by refusing to be the cause of others' trouble; they do not shift on to shoulders not their own, by force or by trickery, the burdens and sorrows of life, which circumstances bring to everyone; they prefer to bear themselves the portions allotted to them, so as not to double those of their neighbours. (G., III, pp. 595-596; B., p.179.)
Positive compassion is lovingkindness. If justice respects the rights of others, lovingkindness extends beyond the claims of rights. It responds to pain helplessness, distress. It is a universal response to the various plights of humankind and not constrained by rights, duties and contracts - the stock in trade of justice.
You had Schopenhauer's theory essentially correct. I have merely refined a few points and added detail.