mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-15 02:09:21 -04:00
LS: Add WIP Life store item
This commit is contained in:
parent
de2fdb4c5c
commit
adfce5bb5b
@ -554,9 +554,11 @@
|
||||
<Compile Include="Modules\Games\LavaSurvival\CmdLavaSurvival.cs" />
|
||||
<Compile Include="Modules\Games\LavaSurvival\LSConfig.cs" />
|
||||
<Compile Include="Modules\Games\LavaSurvival\LSGame.cs" />
|
||||
<Compile Include="Modules\Games\LavaSurvival\LSGame.DB.cs" />
|
||||
<Compile Include="Modules\Games\LavaSurvival\LSGame.Physics.cs" />
|
||||
<Compile Include="Modules\Games\LavaSurvival\LSGame.Plugin.cs" />
|
||||
<Compile Include="Modules\Games\LavaSurvival\LSGame.Round.cs" />
|
||||
<Compile Include="Modules\Games\LavaSurvival\LSItems.cs" />
|
||||
<Compile Include="Modules\Games\LavaSurvival\LSPlugin.cs" />
|
||||
<Compile Include="Modules\Games\TNTWars\CmdTntWars.cs" />
|
||||
<Compile Include="Modules\Games\TNTWars\TWConfig.cs" />
|
||||
@ -576,7 +578,7 @@
|
||||
<Compile Include="Modules\Games\ZombieSurvival\Commands\CmdLastLevels.cs" />
|
||||
<Compile Include="Modules\Games\ZombieSurvival\Commands\CmdQueue.cs" />
|
||||
<Compile Include="Modules\Games\ZombieSurvival\Commands\CmdShowQueue.cs" />
|
||||
<Compile Include="Modules\Games\ZombieSurvival\ZombieItems.cs" />
|
||||
<Compile Include="Modules\Games\ZombieSurvival\ZSItems.cs" />
|
||||
<Compile Include="Modules\Games\ZombieSurvival\ZSConfig.cs" />
|
||||
<Compile Include="Modules\Games\ZombieSurvival\ZSGame.cs" />
|
||||
<Compile Include="Modules\Games\ZombieSurvival\ZSGame.DB.cs" />
|
||||
|
38
MCGalaxy/Modules/Games/LavaSurvival/LSGame.DB.cs
Normal file
38
MCGalaxy/Modules/Games/LavaSurvival/LSGame.DB.cs
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
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 MCGalaxy.DB;
|
||||
using MCGalaxy.Eco;
|
||||
using MCGalaxy.Games;
|
||||
using MCGalaxy.SQL;
|
||||
|
||||
namespace MCGalaxy.Modules.Games.LS
|
||||
{
|
||||
public sealed partial class LSGame : RoundsGame
|
||||
{
|
||||
static void HookItems() {
|
||||
Economy.RegisterItem(itemLife);
|
||||
}
|
||||
|
||||
static void UnhookItems() {
|
||||
Economy.Items.Remove(itemLife);
|
||||
}
|
||||
|
||||
static Item itemLife = new LifeItem();
|
||||
}
|
||||
}
|
@ -142,6 +142,7 @@ namespace MCGalaxy.Modules.Games.LS
|
||||
|
||||
Chat.MessageFromLevel(p, "λNICK &4ran out of lives, and is out of the round!");
|
||||
p.Message("&4You can still watch, but you cannot build.");
|
||||
// TODO: Buy life message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ using BlockID = System.UInt16;
|
||||
|
||||
namespace MCGalaxy.Modules.Games.LS
|
||||
{
|
||||
internal sealed class LSData
|
||||
public sealed class LSData
|
||||
{
|
||||
public int TimesDied, SpongesLeft;
|
||||
}
|
||||
@ -38,11 +38,12 @@ namespace MCGalaxy.Modules.Games.LS
|
||||
BlockID floodBlock;
|
||||
int curLayer, spreadDelay;
|
||||
int roundTotalSecs, floodDelaySecs, layerIntervalSecs;
|
||||
static bool hooked;
|
||||
|
||||
public static LSGame Instance = new LSGame();
|
||||
public LSGame() { Picker = new LevelPicker(); }
|
||||
|
||||
static LSData Get(Player p) {
|
||||
public static LSData Get(Player p) {
|
||||
object data;
|
||||
if (!p.Extras.TryGet("MCG_LS_DATA", out data)) {
|
||||
data = new LSData();
|
||||
@ -85,12 +86,19 @@ namespace MCGalaxy.Modules.Games.LS
|
||||
|
||||
protected override void StartGame() {
|
||||
ResetPlayerDeaths();
|
||||
if (hooked) return;
|
||||
|
||||
hooked = true;
|
||||
HookItems();
|
||||
}
|
||||
|
||||
protected override void EndGame() {
|
||||
flooded = false;
|
||||
ResetPlayerDeaths();
|
||||
if (Map != null) UpdateBlockHandlers();
|
||||
|
||||
hooked = false;
|
||||
UnhookItems();
|
||||
}
|
||||
|
||||
public bool IsPlayerDead(Player p) {
|
||||
|
45
MCGalaxy/Modules/Games/LavaSurvival/LSItems.cs
Normal file
45
MCGalaxy/Modules/Games/LavaSurvival/LSItems.cs
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
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 MCGalaxy.Eco;
|
||||
|
||||
namespace MCGalaxy.Modules.Games.LS
|
||||
{
|
||||
sealed class LifeItem : SimpleItem
|
||||
{
|
||||
public LifeItem() {
|
||||
Aliases = new string[] { "life", "lifes", "live", "lives" };
|
||||
Price = 20;
|
||||
}
|
||||
|
||||
public override string Name { get { return "Life"; } }
|
||||
|
||||
protected internal override void OnPurchase(Player p, string args) {
|
||||
if (!LSGame.Instance.RoundInProgress) {
|
||||
p.Message("You can only buy a life " +
|
||||
"when a round of lava survival is in progress."); return;
|
||||
}
|
||||
|
||||
if (!CheckPrice(p)) return;
|
||||
|
||||
LSGame.Get(p).TimesDied--;
|
||||
// TODO: announce lifes left
|
||||
Economy.MakePurchase(p, Price, "%3Life:");
|
||||
}
|
||||
}
|
||||
}
|
@ -18,9 +18,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MCGalaxy.Commands;
|
||||
using MCGalaxy.DB;
|
||||
using MCGalaxy.Eco;
|
||||
using MCGalaxy.Games;
|
||||
|
||||
namespace MCGalaxy.Modules.Games.ZS
|
||||
{
|
||||
@ -126,7 +124,7 @@ namespace MCGalaxy.Modules.Games.ZS
|
||||
|
||||
protected internal override void OnPurchase(Player p, string args) {
|
||||
if (!CheckPrice(p, Price, "an invisibility potion")) return;
|
||||
if (!ZSGame.Instance.Running || !ZSGame.Instance.RoundInProgress) {
|
||||
if (!ZSGame.Instance.RoundInProgress) {
|
||||
p.Message("You can only buy an invisiblity potion " +
|
||||
"when a round of zombie survival is in progress."); return;
|
||||
}
|
||||
@ -177,7 +175,7 @@ namespace MCGalaxy.Modules.Games.ZS
|
||||
|
||||
protected internal override void OnPurchase(Player p, string args) {
|
||||
if (!CheckPrice(p, Price, "a revive potion")) return;
|
||||
if (!ZSGame.Instance.Running || !ZSGame.Instance.RoundInProgress) {
|
||||
if (!ZSGame.Instance.RoundInProgress) {
|
||||
p.Message("You can only buy a revive potion " +
|
||||
"when a round of zombie survival is in progress."); return;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user