Exemple #1
0
        public static void OnGameEnd(C3Mod.GameEndArgs e)
        {
            int winnings = 0;

            switch (e.GameType.ToLower())
            {
            case "tdm":
            {
                int multiplier = e.WinningTeamScore - e.LosingTeamScore;
                winnings = CEConfig.TDMReward * multiplier;
                break;
            }

            case "ctf":
            {
                winnings = CEConfig.CTFReward;
                break;
            }

            case "1v1":
            {
                winnings = GetCEPlayer(e.WinningTeamPlayers[0].TSPlayer.Index).DuelReward *2;
                break;
            }

            case "oneflag":
            {
                winnings = CEConfig.OFReward;
                break;
            }
            }
            foreach (C3Player player in e.WinningTeamPlayers)
            {
                if (player.TSPlayer.IsLoggedIn)
                {
                    EPREvents.PointOperate(ServerPointSystem.ServerPointSystem.GetEPRPlayerByIndex(player.Index),
                                           winnings, PointOperateReason.PVPEvent);
                    player.TSPlayer.SendMessage(
                        "You gained " + winnings.ToString() + " " + ServerPointSystem.ServerPointSystem.currname + "s!",
                        Color.Green);
                }
            }
        }
Exemple #2
0
 private static void OnPvPdeath(C3Mod.DeathArgs e)
 {
     if (e.PvPKill)
     {
         if (e.Killer.TSPlayer.IsLoggedIn && e.Killed.TSPlayer.IsLoggedIn)
         {
             EPRPlayer EKiller   = ServerPointSystem.ServerPointSystem.GetEPRPlayerByIndex(e.Killer.TSPlayer.Index);
             EPRPlayer EKilled   = ServerPointSystem.ServerPointSystem.GetEPRPlayerByIndex(e.Killed.TSPlayer.Index);
             int       killerbal = EKiller.DisplayAccount;
             int       killedbal = EKilled.DisplayAccount;
             if (InPointRange(killerbal, killedbal))
             {
                 float gain = (killedbal * (100 - ServerPointSystem.ServerPointSystem.DeathToll) / 100) + PvPKillReward;
                 e.Killer.TSPlayer.SendMessage("You gained " + ((int)gain).ToString() + " " + ServerPointSystem.ServerPointSystem.currname + "(s)!", Color.Green);
                 EPREvents.PointOperate(EKiller, (int)gain, PointOperateReason.PVP);
             }
         }
     }
 }
Exemple #3
0
        private static void OnPvPdeath(C3Mod.DeathArgs e)
        {
            if (e.PvPKill)
            {
                if (e.Killer.TSPlayer.IsLoggedIn && e.Killed.TSPlayer.IsLoggedIn)
                {
                    EPRPlayer EKiller = ServerPointSystem.ServerPointSystem.GetEPRPlayerByIndex(e.Killer.TSPlayer.Index);
                    EPRPlayer EKilled = ServerPointSystem.ServerPointSystem.GetEPRPlayerByIndex(e.Killed.TSPlayer.Index);

                    int killerbal = EKiller.DisplayAccount;

                    int killedbal = EKilled.DisplayAccount;

                    float gain = (killedbal * ((100f - CEConfig.PVPDeathToll) / 100f));
                    float max  = (killerbal * ((100f - CEConfig.MaxPVPGain) / 100f));

                    int actual = (int)Math.Min(gain, max);

                    int killergets = actual + CEConfig.PvPKillReward;

                    e.Killer.TSPlayer.SendMessage(String.Format("You gained {0} {1}(s)!", (killergets),
                                                                ServerPointSystem.ServerPointSystem.currname), Color.Green);

                    EPREvents.PointOperate(EKiller, killergets, PointOperateReason.PVP);

                    if (!e.Killed.TSPlayer.Group.HasPermission("ignoredeathtax"))
                    {
                        e.Killed.TSPlayer.SendMessage(String.Format("You lost {0} {1}(s)!", actual,
                                                                    ServerPointSystem.ServerPointSystem.currname), Color.Green);
                        EPREvents.PointOperate(EKilled, -((int)actual), PointOperateReason.PVP);
                    }

                    string log = string.Format("{0} killed {1}. {0} received {2} {3}(s) and {1} lost {4} {3}(s)",
                                               e.Killer.PlayerName, e.Killed.PlayerName, killergets,
                                               ServerPointSystem.ServerPointSystem.currname,
                                               (e.Killed.TSPlayer.Group.HasPermission("ignoredeathtax") ? 0 : -actual));

                    Log.ConsoleInfo(log);
                }
            }
        }