Societies rely on individual contributions to sustain public goods that benefit the entire community. Several mechanisms, that specify how individuals change their decisions based on past experiences, have been proposed to explain how altruists are not outcompeted by selfish counterparts. A key aspect of such strategy updates involves a comparison of an individuals latest payoff with that of a random neighbour. In reality, both the economic and social milieu often shapes cooperative behaviour. We propose a new decision heuristic, where the propensity of an individual to cooperate depends on the local strategy environment in which she is embedded as well as her wealth relative to that of her neighbours. Our decision-making model allows cooperation to be sustained and also explains the results of recent experiments on social dilemmas in dynamic networks. Final cooperation levels depend only on the extent to which the strategy environment influences altruistic behaviour but are largely unaffected by network restructuring. However, the extent of wealth inequality in the community is affected by a subtle interplay between the environmental influence on a persons decision to contribute and the likelihood of reshaping social ties, with wealth-inequality levels rising with increasing likelihood of network restructuring in some situations.