mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-26 14:54:12 -04:00
Fix bounties for zombie survival.
This commit is contained in:
parent
50f43e5bd2
commit
c9ae84d5f6
@ -14,7 +14,7 @@
|
|||||||
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||||
or implied. See the Licenses for the specific language governing
|
or implied. See the Licenses for the specific language governing
|
||||||
permissions and limitations under the Licenses.
|
permissions and limitations under the Licenses.
|
||||||
*/
|
*/
|
||||||
namespace MCGalaxy.Commands {
|
namespace MCGalaxy.Commands {
|
||||||
|
|
||||||
public sealed class CmdBounty : Command {
|
public sealed class CmdBounty : Command {
|
||||||
@ -41,13 +41,19 @@ namespace MCGalaxy.Commands {
|
|||||||
Player.SendMessage(p, "You do not have enough " + Server.moneys + " to place such a large bountry."); return;
|
Player.SendMessage(p, "You do not have enough " + Server.moneys + " to place such a large bountry."); return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BountyData data;
|
BountyData old;
|
||||||
if (Server.zombie.Bounties.TryGetValue(who.name, out data) && data.Amount >= amount) {
|
if (Server.zombie.Bounties.TryGetValue(who.name, out old) && old.Amount >= amount) {
|
||||||
Player.SendMessage(p, "There is already a larger active bounty for " + who.name + "."); return;
|
Player.SendMessage(p, "There is already a larger active bounty for " + who.name + "."); return;
|
||||||
}
|
}
|
||||||
// TODO here - actually announce the bounty and place it
|
|
||||||
// "Looks like someone really wants the brains of <name>! An bounty for x <money> was placed on them.
|
if (old == null) {
|
||||||
// "<name> is popular! The bounty on them was increased from <old> to <new> money.
|
Player.GlobalMessage("Looks like someone really wants the brains of " + who.FullName
|
||||||
|
+ "%S! A bounty of &a" + amount + " %S" + Server.moneys + " was placed on them.");
|
||||||
|
} else {
|
||||||
|
Player.GlobalMessage(who.FullName + " %Sis popular! The bounty on them was increased from &a" + old.Amount +
|
||||||
|
" %Sto &a" + amount + " %S" + Server.moneys + ".");
|
||||||
|
}
|
||||||
|
Server.zombie.Bounties[who.name] = new BountyData(p, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Help(Player p) {
|
public override void Help(Player p) {
|
||||||
|
@ -75,7 +75,7 @@ namespace MCGalaxy {
|
|||||||
|
|
||||||
Player.GlobalMessage(player.color + player.name + " %Sstarted the infection!");
|
Player.GlobalMessage(player.color + player.name + " %Sstarted the infection!");
|
||||||
player.infected = true;
|
player.infected = true;
|
||||||
CheckPlayerColor(player, Colors.red);
|
UpdatePlayerColor(player, Colors.red);
|
||||||
|
|
||||||
RoundInProgress = true;
|
RoundInProgress = true;
|
||||||
int roundMins = random.Next(5, 8);
|
int roundMins = random.Next(5, 8);
|
||||||
@ -149,11 +149,11 @@ namespace MCGalaxy {
|
|||||||
infectd.ForEach(
|
infectd.ForEach(
|
||||||
delegate(Player pKiller)
|
delegate(Player pKiller)
|
||||||
{
|
{
|
||||||
CheckPlayerColor(pKiller, Colors.red);
|
UpdatePlayerColor(pKiller, Colors.red);
|
||||||
alive.ForEach(
|
alive.ForEach(
|
||||||
delegate(Player pAlive)
|
delegate(Player pAlive)
|
||||||
{
|
{
|
||||||
CheckPlayerColor(pAlive, pAlive.group.color);
|
UpdatePlayerColor(pAlive, pAlive.group.color);
|
||||||
if (Math.Abs(pAlive.pos[0] - pKiller.pos[0]) > HitboxPrecision
|
if (Math.Abs(pAlive.pos[0] - pKiller.pos[0]) > HitboxPrecision
|
||||||
|| Math.Abs(pAlive.pos[1] - pKiller.pos[1]) > HitboxPrecision
|
|| Math.Abs(pAlive.pos[1] - pKiller.pos[1]) > HitboxPrecision
|
||||||
|| Math.Abs(pAlive.pos[2] - pKiller.pos[2]) > HitboxPrecision)
|
|| Math.Abs(pAlive.pos[2] - pKiller.pos[2]) > HitboxPrecision)
|
||||||
@ -178,13 +178,22 @@ namespace MCGalaxy {
|
|||||||
infectCombo = 0;
|
infectCombo = 0;
|
||||||
}
|
}
|
||||||
lastPlayerToInfect = pKiller.name;
|
lastPlayerToInfect = pKiller.name;
|
||||||
pKiller.infectThisRound++;
|
|
||||||
pKiller.playersInfected++;
|
pKiller.playersInfected++;
|
||||||
Player.GlobalMessage(String.Format(
|
Player.GlobalMessage(String.Format(
|
||||||
messages[random.Next(messages.Length)],
|
messages[random.Next(messages.Length)],
|
||||||
Colors.red + pKiller.DisplayName + Colors.yellow,
|
Colors.red + pKiller.DisplayName + Colors.yellow,
|
||||||
Colors.red + pAlive.DisplayName + Colors.yellow));
|
Colors.red + pAlive.DisplayName + Colors.yellow));
|
||||||
CheckPlayerColor(pAlive, Colors.red);
|
|
||||||
|
BountyData bounty;
|
||||||
|
if (Bounties.TryGetValue(pAlive.name, out bounty))
|
||||||
|
Bounties.Remove(pAlive.name);
|
||||||
|
if (bounty != null) {
|
||||||
|
Player.GlobalMessage(pKiller.FullName + " %Scollected the bounty of &a" +
|
||||||
|
bounty.Amount + " %S" + Server.moneys + " on " + pAlive.FullName + "%S.");
|
||||||
|
bounty.Origin.money = Math.Max(0, bounty.Origin.money - bounty.Amount);
|
||||||
|
pKiller.money += bounty.Amount;
|
||||||
|
}
|
||||||
|
UpdatePlayerColor(pAlive, Colors.red);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -192,7 +201,7 @@ namespace MCGalaxy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CheckPlayerColor(Player p, string color) {
|
static void UpdatePlayerColor(Player p, string color) {
|
||||||
if (p.color == color) return;
|
if (p.color == color) return;
|
||||||
p.color = color;
|
p.color = color;
|
||||||
Player.GlobalDespawn(p, false);
|
Player.GlobalDespawn(p, false);
|
||||||
@ -211,12 +220,13 @@ namespace MCGalaxy {
|
|||||||
|
|
||||||
public void HandOutRewards() {
|
public void HandOutRewards() {
|
||||||
RoundInProgress = false;
|
RoundInProgress = false;
|
||||||
|
Bounties.Clear();
|
||||||
if (Status == ZombieGameStatus.NotStarted) return;
|
if (Status == ZombieGameStatus.NotStarted) return;
|
||||||
Player.GlobalMessage(Colors.lime + "The game has ended!");
|
Player.GlobalMessage(Colors.lime + "The game has ended!");
|
||||||
if(aliveCount == 0)
|
if (aliveCount == 0) Player.GlobalMessage(Colors.maroon + "Zombies have won this round.");
|
||||||
Player.GlobalMessage(Colors.maroon + "Zombies have won this round.");
|
else if (aliveCount == 1) Player.GlobalMessage(Colors.green + "Congratulations to the sole survivor:");
|
||||||
else
|
else Player.GlobalMessage(Colors.green + "Congratulations to the survivors:");
|
||||||
Player.GlobalMessage(Colors.green + "Congratulations to our survivor(s)");
|
|
||||||
timer.Enabled = false;
|
timer.Enabled = false;
|
||||||
string playersString = "";
|
string playersString = "";
|
||||||
Player[] online = null;
|
Player[] online = null;
|
||||||
@ -248,14 +258,14 @@ namespace MCGalaxy {
|
|||||||
Player.GlobalDespawn(pl, false);
|
Player.GlobalDespawn(pl, false);
|
||||||
Player.GlobalSpawn(pl, pl.pos[0], pl.pos[1], pl.pos[2], pl.rot[0], pl.rot[1], false);
|
Player.GlobalSpawn(pl, pl.pos[0], pl.pos[1], pl.pos[2], pl.rot[0], pl.rot[1], false);
|
||||||
if (money == -1) {
|
if (money == -1) {
|
||||||
pl.SendMessage("You may not hide inside a block! No " + Server.moneys + " for you!"); money = 0;
|
pl.SendMessage("You may not hide inside a block! No " + Server.moneys + " for you."); money = 0;
|
||||||
} else if (money > 0) {
|
} else if (money > 0) {
|
||||||
pl.SendMessage( Colors.gold + "You gained " + money + " " + Server.moneys);
|
pl.SendMessage( Colors.gold + "You gained " + money + " " + Server.moneys);
|
||||||
}
|
}
|
||||||
|
|
||||||
pl.blockCount = 50;
|
pl.blockCount = 50;
|
||||||
pl.playersInfected = 0;
|
pl.playersInfected = 0;
|
||||||
pl.money += money;
|
pl.money += money;
|
||||||
|
|
||||||
pl.infected = false;
|
pl.infected = false;
|
||||||
pl.color = pl.group.color;
|
pl.color = pl.group.color;
|
||||||
if (pl.referee) {
|
if (pl.referee) {
|
||||||
@ -269,7 +279,7 @@ namespace MCGalaxy {
|
|||||||
void ResetPlayer(Player p, ref string playersString) {
|
void ResetPlayer(Player p, ref string playersString) {
|
||||||
p.blockCount = 50;
|
p.blockCount = 50;
|
||||||
p.infected = false;
|
p.infected = false;
|
||||||
p.infectThisRound = 0;
|
p.playersInfected = 0;
|
||||||
|
|
||||||
if (p.level.name == currentLevelName) {
|
if (p.level.name == currentLevelName) {
|
||||||
p.color = p.group.color;
|
p.color = p.group.color;
|
||||||
|
@ -134,9 +134,7 @@ namespace MCGalaxy {
|
|||||||
infectd.Add(p);
|
infectd.Add(p);
|
||||||
alive.Remove(p);
|
alive.Remove(p);
|
||||||
p.infected = true;
|
p.infected = true;
|
||||||
p.color = Colors.red;
|
UpdatePlayerColor(p, Colors.red);
|
||||||
Player.GlobalDespawn(p, false);
|
|
||||||
Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false);
|
|
||||||
aliveCount = alive.Count;
|
aliveCount = alive.Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,9 +144,7 @@ namespace MCGalaxy {
|
|||||||
infectd.Remove(p);
|
infectd.Remove(p);
|
||||||
alive.Add(p);
|
alive.Add(p);
|
||||||
p.infected = false;
|
p.infected = false;
|
||||||
p.color = p.group.color;
|
UpdatePlayerColor(p, p.group.color);
|
||||||
Player.GlobalDespawn(p, false);
|
|
||||||
Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false);
|
|
||||||
aliveCount = alive.Count;
|
aliveCount = alive.Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,16 +190,11 @@ namespace MCGalaxy {
|
|||||||
public int blockCount = 50;
|
public int blockCount = 50;
|
||||||
public bool voted = false;
|
public bool voted = false;
|
||||||
public int blocksStacked = 0;
|
public int blocksStacked = 0;
|
||||||
public int infectThisRound = 0;
|
public int lastYblock = 0, lastXblock = 0, lastZblock = 0;
|
||||||
public int lastYblock = 0;
|
|
||||||
public int lastXblock = 0;
|
|
||||||
public int lastZblock = 0;
|
|
||||||
public bool infected = false;
|
public bool infected = false;
|
||||||
public bool aka = false;
|
public bool aka = false;
|
||||||
public bool flipHead = true;
|
public bool flipHead = true;
|
||||||
public int playersInfected = 0;
|
public int playersInfected = 0;
|
||||||
public int NoClipcount = 0;
|
|
||||||
|
|
||||||
|
|
||||||
//Tnt Wars
|
//Tnt Wars
|
||||||
public bool PlayingTntWars = false;
|
public bool PlayingTntWars = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user