diff --git a/MCGalaxy/MCGalaxy_.csproj b/MCGalaxy/MCGalaxy_.csproj
index 93733928b..b9f0c283a 100644
--- a/MCGalaxy/MCGalaxy_.csproj
+++ b/MCGalaxy/MCGalaxy_.csproj
@@ -554,9 +554,11 @@
+
+
@@ -576,7 +578,7 @@
-
+
diff --git a/MCGalaxy/Modules/Games/LavaSurvival/LSGame.DB.cs b/MCGalaxy/Modules/Games/LavaSurvival/LSGame.DB.cs
new file mode 100644
index 000000000..38cf16d3c
--- /dev/null
+++ b/MCGalaxy/Modules/Games/LavaSurvival/LSGame.DB.cs
@@ -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();
+ }
+}
diff --git a/MCGalaxy/Modules/Games/LavaSurvival/LSGame.Round.cs b/MCGalaxy/Modules/Games/LavaSurvival/LSGame.Round.cs
index 48e83a368..b268ebe16 100644
--- a/MCGalaxy/Modules/Games/LavaSurvival/LSGame.Round.cs
+++ b/MCGalaxy/Modules/Games/LavaSurvival/LSGame.Round.cs
@@ -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
}
}
}
diff --git a/MCGalaxy/Modules/Games/LavaSurvival/LSGame.cs b/MCGalaxy/Modules/Games/LavaSurvival/LSGame.cs
index ba76dd06a..da452b152 100644
--- a/MCGalaxy/Modules/Games/LavaSurvival/LSGame.cs
+++ b/MCGalaxy/Modules/Games/LavaSurvival/LSGame.cs
@@ -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) {
diff --git a/MCGalaxy/Modules/Games/LavaSurvival/LSItems.cs b/MCGalaxy/Modules/Games/LavaSurvival/LSItems.cs
new file mode 100644
index 000000000..9f89e9d0a
--- /dev/null
+++ b/MCGalaxy/Modules/Games/LavaSurvival/LSItems.cs
@@ -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:");
+ }
+ }
+}
diff --git a/MCGalaxy/Modules/Games/ZombieSurvival/ZombieItems.cs b/MCGalaxy/Modules/Games/ZombieSurvival/ZSItems.cs
similarity index 95%
rename from MCGalaxy/Modules/Games/ZombieSurvival/ZombieItems.cs
rename to MCGalaxy/Modules/Games/ZombieSurvival/ZSItems.cs
index feeae4b60..f1405fd34 100644
--- a/MCGalaxy/Modules/Games/ZombieSurvival/ZombieItems.cs
+++ b/MCGalaxy/Modules/Games/ZombieSurvival/ZSItems.cs
@@ -15,12 +15,10 @@
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
-using System;
-using System.Collections.Generic;
-using MCGalaxy.Commands;
-using MCGalaxy.DB;
-using MCGalaxy.Eco;
-using MCGalaxy.Games;
+using System;
+using System.Collections.Generic;
+using MCGalaxy.Commands;
+using MCGalaxy.Eco;
namespace MCGalaxy.Modules.Games.ZS
{
@@ -126,9 +124,9 @@ 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;
+ "when a round of zombie survival is in progress."); return;
}
ZSData data = ZSGame.Get(p);
@@ -177,9 +175,9 @@ 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;
+ "when a round of zombie survival is in progress."); return;
}
ZSData data = ZSGame.Get(p);