示例#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);
         }
     }
 }
示例#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);
                    //The two ints here are the two account balances.
                    int killerbal = EKiller.DisplayAccount;
                    int killedbal = EKilled.DisplayAccount;
                    //If the two are within the proper range, it will add and deduct.
                    if(InPointRange(killerbal, killedbal))
                    {
                        //gain is one percent of the balance of the player killed multiplied by one hundred minus the deathtoll.
                        float gain = (killedbal * (100 - ServerPointSystem.ServerPointSystem.DeathToll)/100) + PvPKillReward;
                        //This notifies the player that they just pwned someone, and got some shards from them.
                        e.Killer.TSPlayer.SendMessage("You gained " + ((int)gain).ToString() + " " + ServerPointSystem.ServerPointSystem.currname + "(s)!", Color.Green);
                        //This adds points to the killer's shard count.
                        EPREvents.PointOperate(EKiller, (int)gain, PointOperateReason.PVP);
                        //The following is my proposed changes.
                        //Notify the loser of his losses.
                        e.Killed.TSPlayer.SendMessage("You lost " + ((int)gain)).ToString() + " " + ServerPointSystem.ServerPointSystem.currname +"(s)!", Color.Green);
                        //Deduct the amount the killer gained by adding a negative amount. This appears to be how /deduct works, so I am mimicking it.
                        EPREvents.PointOperate(EKilled, -((int)gain),PointOperateReason.PVP);
                        //The comments were mainly for my own use, by the way.

                    }
                }
            }
        }
示例#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);
                }
            }
        }
示例#4
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);
             }
         }
     }
 }