ZS: Remove pointless /lottery command.

This commit is contained in:
UnknownShadow200 2017-07-15 16:53:53 +10:00
parent 0ed93b3ac9
commit 6c456e9500
5 changed files with 1 additions and 94 deletions

View File

@ -1,58 +0,0 @@
/*
Copyright 2015 MCGalaxy
Dual-licensed under the Educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at
http://www.opensource.org/licenses/ecl2.php
http://www.gnu.org/licenses/gpl-3.0.html
Unless required by applicable law or agreed to in writing,
software distributed under the Licenses are distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
using System;
using System.Collections.Generic;
using System.Threading;
using MCGalaxy.Eco;
namespace MCGalaxy.Commands.Fun {
public sealed class CmdLottery : Command {
public override string name { get { return "lottery"; } }
public override string shortcut { get { return "luck"; } }
public override string type { get { return CommandTypes.Games; } }
public override bool museumUsable { get { return true; } }
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
public override CommandEnable Enabled { get { return CommandEnable.Zombie | CommandEnable.Lava; } }
public override bool SuperUseable { get { return false; } }
public override void Use(Player p, string message) {
if (p.money < 10) {
Player.Message(p, "You need &f10 " + ServerConfig.Currency + " %Sto enter the lottery."); return;
}
string[] players = Server.zombie.Lottery.Items;
for (int i = 0; i < players.Length; i++) {
if (players[i].CaselessEq(p.name)) {
Player.Message(p, "You are already in the lottery, which has &a"
+ players.Length + " %Splayers in it."); return;
}
}
p.SetMoney(p.money - 10);
Server.zombie.Lottery.Add(p.name);
if (Server.zombie.CurLevel != null)
Server.zombie.CurLevel.ChatLevel(p.ColoredName + " %Sentered the lottery");
}
public override void Help(Player p) {
Player.Message(p, "%T/lottery %H-Enters lottery for &f10 " + ServerConfig.Currency);
Player.Message(p, "%HThe winner is calculated at the end of each round.");
Player.Message(p, "%HYou are &cnot refunded %Hif you disconnect.");
}
}
}

View File

@ -40,7 +40,6 @@ namespace MCGalaxy.Games.ZS {
}
GiveMoney(game, alive);
DoLottery(game);
}
static void AnnounceWinners(ZSGame game, Player[] alive, Player[] dead) {
@ -108,35 +107,6 @@ namespace MCGalaxy.Games.ZS {
}
}
static void DoLottery(ZSGame game) {
string[] players = game.Lottery.Items;
if (players.Length == 0) return;
// Ensure the players are actually online
List<Player> online = new List<Player>(players.Length);
foreach (string name in players) {
Player pl = PlayerInfo.FindExact(name);
if (pl == null) continue;
online.Add(pl);
}
if (online.Count == 0) return;
int amount = 10;
Player winner = online[0];
if (online.Count == 1) {
winner.SendMessage("Your money was refunded as you were " +
"the only player still in the lottery.");
} else {
Random rand = new Random();
winner = online[rand.Next(online.Count)];
amount = 9 * online.Count;
game.CurLevel.ChatLevel(winner.ColoredName + " %Swon the lottery for &6"
+ amount + " " + ServerConfig.Currency);
}
game.Lottery.Clear();
winner.SetMoney(winner.money + amount);
}
static int GetMoneyReward(Player pl, Player[] alive, Random rand) {
if (pl.CheckIfInsideBlock()) return -1;

View File

@ -94,8 +94,5 @@ namespace MCGalaxy.Games {
/// <summary> List of players who have a bounty on them. </summary>
public VolatileArray<BountyData> Bounties = new VolatileArray<BountyData>();
/// <summary> List of players who are in the lottery. </summary>
public VolatileArray<string> Lottery = new VolatileArray<string>();
}
}

View File

@ -195,8 +195,7 @@ namespace MCGalaxy.Games {
Player[] online = PlayerInfo.Online.Items;
Alive.Clear();
Infected.Clear();
Lottery.Clear();
Bounties.Clear();
RecentMaps.Clear();

View File

@ -222,7 +222,6 @@
<Compile Include="Commands\Fun\CmdFlipHeads.cs" />
<Compile Include="Commands\Fun\CmdGun.cs" />
<Compile Include="Commands\Fun\CmdLavaSurvival.cs" />
<Compile Include="Commands\Fun\CmdLottery.cs" />
<Compile Include="Commands\Fun\CmdMapSet.cs" />
<Compile Include="Commands\Fun\CmdMissile.cs" />
<Compile Include="Commands\Fun\CmdSlap.cs" />