//// public void AddToMe(KillData data, Player forPlayer = null) { var mymod = RewardsMod.Instance; foreach (var kv in data.KilledNpcs) { if (this.KilledNpcs.ContainsKey(kv.Key)) { this.KilledNpcs[kv.Key] += kv.Value; } else { this.KilledNpcs[kv.Key] = kv.Value; } } this.GoblinsConquered += data.GoblinsConquered; this.FrostLegionConquered += data.FrostLegionConquered; this.PiratesConquered += data.PiratesConquered; this.MartiansConquered += data.MartiansConquered; this.PumpkinMoonWavesConquered += data.PumpkinMoonWavesConquered; this.FrostMoonWavesConquered += data.FrostMoonWavesConquered; this.ProgressPoints += data.ProgressPoints; if (mymod.SettingsConfig.DebugModePPInfo && data.ProgressPoints != 0) { LogHelpers.Alert("PP added: " + data.ProgressPoints + " (now " + this.ProgressPoints + ", for " + (forPlayer?.name ?? "world?") + ")"); } }
private bool UpdateFrostMoonWavesForKillData(KillData killData) { if (NPC.waveNumber > killData.FrostMoonWavesConquered) // Change wave { killData.FrostMoonWavesConquered = NPC.waveNumber; return(true); } return(false); }
private void AddKillRewardForPlayer_Host(Player toPlayer, NPC npc) { bool _; KillData data = this.GetPlayerData(toPlayer); if (data == null) { return; } data.RewardKill_Host(toPlayer, npc); data.RecordKill(npc, out _, out _); }
public void AddKillReward_Host(NPC npc) { if (npc.lastInteraction < 0 || npc.lastInteraction >= Main.player.Length) { return; } var mymod = RewardsMod.Instance; var myworld = ModContent.GetInstance <RewardsWorld>(); bool toAll = KillData.CanReceiveOtherPlayerKillRewards(); if (Main.netMode == 2) { if (toAll) { for (int i = 0; i < Main.player.Length; i++) { Player toPlayer = Main.player[i]; if (toPlayer == null || !toPlayer.active) { continue; } this.AddKillRewardForPlayer_Host(toPlayer, npc); } } else { Player toPlayer = Main.player[npc.lastInteraction]; if (toPlayer != null && toPlayer.active) { this.AddKillRewardForPlayer_Host(Main.player[npc.lastInteraction], npc); } } } else if (Main.netMode == 0) { this.AddKillRewardForPlayer_Host(Main.LocalPlayer, npc); } // Also for the world bool _; this.WorldData.RecordKill(npc, out _, out _); }