mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-27 15:30:58 -04:00
Add initial basis for a /human (similiar to /ironman in MCDzienny) command for zombie survival.
This commit is contained in:
parent
2ad392819c
commit
440b1d4982
48
Commands/Fun/ZombieSurvival/CmdHuman.cs
Normal file
48
Commands/Fun/ZombieSurvival/CmdHuman.cs
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2011 MCForge
|
||||||
|
|
||||||
|
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 MCGalaxy.Games;
|
||||||
|
|
||||||
|
namespace MCGalaxy.Commands {
|
||||||
|
|
||||||
|
public sealed class CmdHuman : Command {
|
||||||
|
public override string name { get { return "human"; } }
|
||||||
|
public override string shortcut { get { return ""; } }
|
||||||
|
public override string type { get { return CommandTypes.Moderation; } }
|
||||||
|
public override bool museumUsable { get { return true; } }
|
||||||
|
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
|
||||||
|
public override bool Enabled { get { return Server.ZombieModeOn; } }
|
||||||
|
public CmdHuman() { }
|
||||||
|
|
||||||
|
public override void Use(Player p, string message) {
|
||||||
|
if (p == null) { MessageInGameOnly(p); return; }
|
||||||
|
if (p.assertingSurvive) {
|
||||||
|
Player.SendMessage(p, "You cannot un-assert that you will be infected."); return;
|
||||||
|
}
|
||||||
|
|
||||||
|
p.assertingSurvive = true;
|
||||||
|
Server.zombie.CurrentLevel
|
||||||
|
.ChatLevel(p.FullName + " %Sasserts that they will not succumb to the infection!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Help(Player p) {
|
||||||
|
Player.SendMessage(p, "%T/human %H- asserts that you will not be infected.");
|
||||||
|
Player.SendMessage(p, "%HIf you survive, you receive an &aextra 5 %3" + Server.moneys);
|
||||||
|
Player.SendMessage(p, "%HHowever, if you are infected, you will &close 2 %3" + Server.moneys);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -303,6 +303,7 @@ namespace MCGalaxy.Games
|
|||||||
Player[] online = PlayerInfo.Online.Items;
|
Player[] online = PlayerInfo.Online.Items;
|
||||||
foreach (Player pl in online) {
|
foreach (Player pl in online) {
|
||||||
pl.ratedMap = false;
|
pl.ratedMap = false;
|
||||||
|
pl.assertingSurvive = false;
|
||||||
if (pl.level == oldMap)
|
if (pl.level == oldMap)
|
||||||
{
|
{
|
||||||
if (sendAfkMain && Server.afkset.Contains(pl.name)) Command.all.Find("main").Use(pl, "");
|
if (sendAfkMain && Server.afkset.Contains(pl.name)) Command.all.Find("main").Use(pl, "");
|
||||||
|
@ -80,7 +80,7 @@ namespace MCGalaxy.Games {
|
|||||||
UpdatePlayerColor(first, Colors.red);
|
UpdatePlayerColor(first, Colors.red);
|
||||||
|
|
||||||
RoundInProgress = true;
|
RoundInProgress = true;
|
||||||
int roundMins = random.Next(5, 8);
|
int roundMins = random.Next(4, 7);
|
||||||
CurrentLevel.ChatLevel("The round will last for " + roundMins + " minutes!");
|
CurrentLevel.ChatLevel("The round will last for " + roundMins + " minutes!");
|
||||||
RoundEnd = DateTime.UtcNow.AddMinutes(roundMins);
|
RoundEnd = DateTime.UtcNow.AddMinutes(roundMins);
|
||||||
timer = new System.Timers.Timer(roundMins * 60 * 1000);
|
timer = new System.Timers.Timer(roundMins * 60 * 1000);
|
||||||
@ -181,6 +181,26 @@ namespace MCGalaxy.Games {
|
|||||||
Colors.red + pKiller.DisplayName + Colors.yellow,
|
Colors.red + pKiller.DisplayName + Colors.yellow,
|
||||||
Colors.red + pAlive.DisplayName + Colors.yellow));
|
Colors.red + pAlive.DisplayName + Colors.yellow));
|
||||||
|
|
||||||
|
CheckAssertHuman(pAlive);
|
||||||
|
CheckBounty(pAlive, pKiller);
|
||||||
|
UpdatePlayerColor(pAlive, Colors.red);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (aliveChanged) alive = Alive.Items;
|
||||||
|
}
|
||||||
|
Thread.Sleep(50);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CheckAssertHuman(Player pAlive) {
|
||||||
|
if (!pAlive.assertingSurvive) return;
|
||||||
|
pAlive.assertingSurvive = false;
|
||||||
|
CurrentLevel.ChatLevel(pAlive.FullName + "%Sfailed the challenge of not being infected.");
|
||||||
|
pAlive.money = Math.Max(pAlive.money - 2, 0);
|
||||||
|
pAlive.OnMoneyChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CheckBounty(Player pAlive, Player pKiller) {
|
||||||
BountyData bounty;
|
BountyData bounty;
|
||||||
if (Bounties.TryGetValue(pAlive.name, out bounty))
|
if (Bounties.TryGetValue(pAlive.name, out bounty))
|
||||||
Bounties.Remove(pAlive.name);
|
Bounties.Remove(pAlive.name);
|
||||||
@ -192,13 +212,6 @@ namespace MCGalaxy.Games {
|
|||||||
pKiller.money += bounty.Amount;
|
pKiller.money += bounty.Amount;
|
||||||
pKiller.OnMoneyChanged();
|
pKiller.OnMoneyChanged();
|
||||||
}
|
}
|
||||||
UpdatePlayerColor(pAlive, Colors.red);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (aliveChanged) alive = Alive.Items;
|
|
||||||
}
|
|
||||||
Thread.Sleep(50);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void UpdatePlayerColor(Player p, string color) {
|
static void UpdatePlayerColor(Player p, string color) {
|
||||||
@ -240,9 +253,16 @@ namespace MCGalaxy.Games {
|
|||||||
foreach (Player pl in online)
|
foreach (Player pl in online)
|
||||||
ResetPlayer(pl, ref playersString);
|
ResetPlayer(pl, ref playersString);
|
||||||
} else {
|
} else {
|
||||||
foreach (Player pl in alive)
|
foreach (Player pl in alive) {
|
||||||
|
if (pl.assertingSurvive) {
|
||||||
|
pl.SendMessage("You received &a5 %3" + Server.moneys +
|
||||||
|
"%s for successfully asserting that you would survive.");
|
||||||
|
pl.money += 5;
|
||||||
|
pl.OnMoneyChanged();
|
||||||
|
}
|
||||||
ResetPlayer(pl, ref playersString);
|
ResetPlayer(pl, ref playersString);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CurrentLevel.ChatLevel(playersString);
|
CurrentLevel.ChatLevel(playersString);
|
||||||
online = PlayerInfo.Online.Items;
|
online = PlayerInfo.Online.Items;
|
||||||
|
@ -178,6 +178,7 @@ namespace MCGalaxy.Games {
|
|||||||
online = PlayerInfo.Online.Items;
|
online = PlayerInfo.Online.Items;
|
||||||
foreach (Player pl in online) {
|
foreach (Player pl in online) {
|
||||||
pl.ratedMap = false;
|
pl.ratedMap = false;
|
||||||
|
pl.assertingSurvive = false;
|
||||||
if (!pl.level.name.CaselessEq(next) && pl.level.name.CaselessEq(LastLevelName)) {
|
if (!pl.level.name.CaselessEq(next) && pl.level.name.CaselessEq(LastLevelName)) {
|
||||||
pl.SendMessage("Going to the next map!");
|
pl.SendMessage("Going to the next map!");
|
||||||
Command.all.Find("goto").Use(pl, next);
|
Command.all.Find("goto").Use(pl, next);
|
||||||
@ -201,8 +202,10 @@ namespace MCGalaxy.Games {
|
|||||||
CurrentLevel = null;
|
CurrentLevel = null;
|
||||||
|
|
||||||
Player[] online = PlayerInfo.Online.Items;
|
Player[] online = PlayerInfo.Online.Items;
|
||||||
foreach (Player pl in online)
|
foreach (Player pl in online) {
|
||||||
pl.ratedMap = false;
|
pl.ratedMap = false;
|
||||||
|
pl.assertingSurvive = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdatePlayerStatus(Player p) {
|
void UpdatePlayerStatus(Player p) {
|
||||||
|
@ -195,6 +195,7 @@
|
|||||||
<Compile Include="Commands\Fun\ZombieSurvival\CmdDisinfect.cs" />
|
<Compile Include="Commands\Fun\ZombieSurvival\CmdDisinfect.cs" />
|
||||||
<Compile Include="Commands\Fun\ZombieSurvival\CmdEndRound.cs" />
|
<Compile Include="Commands\Fun\ZombieSurvival\CmdEndRound.cs" />
|
||||||
<Compile Include="Commands\Fun\ZombieSurvival\CmdFliphead.cs" />
|
<Compile Include="Commands\Fun\ZombieSurvival\CmdFliphead.cs" />
|
||||||
|
<Compile Include="Commands\Fun\ZombieSurvival\CmdHuman.cs" />
|
||||||
<Compile Include="Commands\Fun\ZombieSurvival\CmdInfect.cs" />
|
<Compile Include="Commands\Fun\ZombieSurvival\CmdInfect.cs" />
|
||||||
<Compile Include="Commands\Fun\ZombieSurvival\CmdInfected.cs" />
|
<Compile Include="Commands\Fun\ZombieSurvival\CmdInfected.cs" />
|
||||||
<Compile Include="Commands\Fun\ZombieSurvival\CmdQueue.cs" />
|
<Compile Include="Commands\Fun\ZombieSurvival\CmdQueue.cs" />
|
||||||
|
@ -198,6 +198,7 @@ namespace MCGalaxy {
|
|||||||
public int playersInfected = 0;
|
public int playersInfected = 0;
|
||||||
internal string lastSpawnColor = "";
|
internal string lastSpawnColor = "";
|
||||||
internal bool ratedMap = false;
|
internal bool ratedMap = false;
|
||||||
|
internal bool assertingSurvive = false;
|
||||||
|
|
||||||
//Tnt Wars
|
//Tnt Wars
|
||||||
public bool PlayingTntWars = false;
|
public bool PlayingTntWars = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user