Initial commit
This commit is contained in:
+240
@@ -0,0 +1,240 @@
|
||||
using Server.Commands;
|
||||
using Server.Custom.UOSurvivalEvent.Islands;
|
||||
|
||||
namespace Server.Custom.UOSurvivalEvent.Commands
|
||||
{
|
||||
internal class SurvivalCommands
|
||||
{
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
CommandSystem.Register("TestSurvival", AccessLevel.Administrator, new CommandEventHandler(TestSurvival_OnCommand));
|
||||
CommandSystem.Register("ToggleSurvival", AccessLevel.GameMaster, new CommandEventHandler(ToggleSurvival_OnCommand));
|
||||
CommandSystem.Register("StaffStartSurvival", AccessLevel.GameMaster, new CommandEventHandler(StaffStartSurvival_OnCommand));
|
||||
CommandSystem.Register("StartSurvival", AccessLevel.Player, new CommandEventHandler(StartSurvival_OnCommand));
|
||||
}
|
||||
|
||||
[Usage("TestSurvival <type>")]
|
||||
[Description("Test Survival: ON/OFF")]
|
||||
private static void TestSurvival_OnCommand(CommandEventArgs e)
|
||||
{
|
||||
if (SurvivalCore.GameRunning)
|
||||
{
|
||||
SurvivalCore.EndMatch();
|
||||
|
||||
e.Mobile.SendMessage(53, "Test Game => Stopped!");
|
||||
}
|
||||
else
|
||||
{
|
||||
var biome = IslandType.Default;
|
||||
|
||||
if (e.Arguments.Length > 0)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(e.Arguments[0]))
|
||||
{
|
||||
switch (e.Arguments[0].ToLower())
|
||||
{
|
||||
case "grass":
|
||||
{
|
||||
biome = IslandType.Grass;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case "forest":
|
||||
{
|
||||
biome = IslandType.Forest;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case "desert":
|
||||
{
|
||||
biome = IslandType.Desert;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case "snow":
|
||||
{
|
||||
biome = IslandType.Snow;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case "swamp":
|
||||
{
|
||||
biome = IslandType.Swamp;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case "fire":
|
||||
{
|
||||
biome = IslandType.Fire;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case "blood":
|
||||
{
|
||||
biome = IslandType.Blood;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var loc = e.Mobile.Location;
|
||||
|
||||
SurvivalCore.GameBounds = new Rectangle2D(new Point2D(loc.X - 40, loc.Y - 40), new Point2D(loc.X + 40, loc.Y + 40));
|
||||
|
||||
SurvivalCore.TeamOne = new SurvivalTeam();
|
||||
|
||||
SurvivalCore.TeamOne.AddPlayer(new SurvivalPlayer(e.Mobile));
|
||||
|
||||
SurvivalCore.TeamOne.AddIslandLocation(new Rectangle2D(new Point2D(loc.X - 40, loc.Y - 40), loc));
|
||||
|
||||
SurvivalCore.TeamOne.SpawnIsland(e.Mobile.Map, biome);
|
||||
|
||||
SurvivalCore.TeamTwo = new SurvivalTeam();
|
||||
|
||||
SurvivalCore.TeamTwo.AddIslandLocation(new Rectangle2D(loc, new Point2D(loc.X + 40, loc.Y + 40)));
|
||||
|
||||
SurvivalCore.TeamTwo.SpawnIsland(e.Mobile.Map, biome);
|
||||
|
||||
SurvivalCore.StartMatch();
|
||||
|
||||
e.Mobile.SendMessage(62, "Test Game => Started!");
|
||||
}
|
||||
}
|
||||
|
||||
[Usage("ToggleSurvival <bool>?")]
|
||||
[Description("Toggle Survival Event On/Off : Optional AutoOff On/Off")]
|
||||
private static void ToggleSurvival_OnCommand(CommandEventArgs e)
|
||||
{
|
||||
if (e.Arguments.Length > 0)
|
||||
{
|
||||
if (bool.TryParse(e.Arguments[0], out bool isAuto))
|
||||
{
|
||||
SurvivalSettings.IsAutoOff = isAuto;
|
||||
|
||||
SendSurvivalMessage(e.Mobile);
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Mobile.SendMessage(53, "ToggleSurvival <bool>");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (SurvivalCore.GameStage == SurvivalGameStage.Ready)
|
||||
{
|
||||
SurvivalSettings.SurvivalEnabled = !SurvivalSettings.SurvivalEnabled;
|
||||
|
||||
SendSurvivalMessage(e.Mobile);
|
||||
|
||||
if (SurvivalSettings.SurvivalEnabled)
|
||||
{
|
||||
BroadCastEvent();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Mobile.SendMessage(53, "Please wait for event to end!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Usage("StaffStartSurvival")]
|
||||
[Description("Staff Start Survival Event")]
|
||||
private static void StaffStartSurvival_OnCommand(CommandEventArgs e)
|
||||
{
|
||||
if (SurvivalSettings.StaffOnlyStart && SurvivalCore.GameStage == SurvivalGameStage.Waiting)
|
||||
{
|
||||
if (SurvivalCore.PlayerLobby.Count >= SurvivalSettings.MinPlayers)
|
||||
{
|
||||
SurvivalCore.SetUpMatch();
|
||||
|
||||
e.Mobile.SendMessage(53, "Match Started!");
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Mobile.SendMessage(53, "Not enough players to start!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Usage("StartSurvival")]
|
||||
[Description("Start Survival Event")]
|
||||
private static void StartSurvival_OnCommand(CommandEventArgs e)
|
||||
{
|
||||
if (SurvivalSettings.SurvivalEnabled)
|
||||
{
|
||||
switch (SurvivalCore.GameStage)
|
||||
{
|
||||
case SurvivalGameStage.Ready:
|
||||
{
|
||||
e.Mobile.SendMessage(53, $"Starting Survival Setup, waiting for players, min {SurvivalSettings.MinPlayers} needed!");
|
||||
|
||||
SurvivalCore.AddToLobby(e.Mobile);
|
||||
|
||||
SurvivalCore.SendGump();
|
||||
|
||||
BroadCastEvent();
|
||||
|
||||
break;
|
||||
}
|
||||
case SurvivalGameStage.Waiting:
|
||||
{
|
||||
e.Mobile.SendMessage(53, "You have been added to the event starting soon!");
|
||||
|
||||
SurvivalCore.AddToLobby(e.Mobile);
|
||||
|
||||
SurvivalCore.SendGump();
|
||||
|
||||
break;
|
||||
}
|
||||
case SurvivalGameStage.Running:
|
||||
{
|
||||
if (SurvivalSettings.CanJoinLate)
|
||||
{
|
||||
e.Mobile.SendMessage(53, "There is a match in progress, you'll be added to a team!");
|
||||
|
||||
SurvivalCore.JoinLate(e.Mobile);
|
||||
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Mobile.SendMessage(53, "There is a match in progress, please try again later!"); break;
|
||||
}
|
||||
}
|
||||
case SurvivalGameStage.Ending:
|
||||
{
|
||||
e.Mobile.SendMessage(53, "There is a match ending, please try again later!"); break;
|
||||
}
|
||||
case SurvivalGameStage.Resetting:
|
||||
{
|
||||
e.Mobile.SendMessage(53, "The last match is just cleaning up, try in a few minutes!"); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Mobile.SendMessage(53, "Survival Event is not enabled at this time!");
|
||||
}
|
||||
}
|
||||
|
||||
private static void SendSurvivalMessage(Mobile from)
|
||||
{
|
||||
from.SendMessage(53, $"Survival Event Enabled = {SurvivalSettings.SurvivalEnabled} : AutoOff = {SurvivalSettings.IsAutoOff}");
|
||||
}
|
||||
|
||||
private static void BroadCastEvent()
|
||||
{
|
||||
World.Broadcast(53, true, "Survival Event Activated - Use [StartSurvival to join!");
|
||||
}
|
||||
}
|
||||
}
|
||||
+152
@@ -0,0 +1,152 @@
|
||||
using System;
|
||||
using Server.Misc;
|
||||
using System.Linq;
|
||||
|
||||
namespace Server.Custom.UOSurvivalEvent.Islands
|
||||
{
|
||||
public enum IslandType
|
||||
{
|
||||
Default,
|
||||
Grass,
|
||||
Forest,
|
||||
Desert,
|
||||
Snow,
|
||||
Swamp,
|
||||
Fire,
|
||||
Blood
|
||||
}
|
||||
|
||||
public class BaseIsland
|
||||
{
|
||||
public string Name { get; private set; } = string.Empty;
|
||||
|
||||
public IslandType IslandBiome { get; private set; } = IslandType.Default;
|
||||
|
||||
public Rectangle2D IslandBounds { get; private set; }
|
||||
|
||||
public DefaultIsland IslandEntity { get; private set; }
|
||||
|
||||
public bool TeamOne { get; private set; } = true;
|
||||
|
||||
public BaseIsland(Rectangle2D bounds)
|
||||
{
|
||||
if (bounds.Width > 10 && bounds.Height > 10)
|
||||
{
|
||||
IslandBounds = bounds;
|
||||
}
|
||||
else
|
||||
{
|
||||
IslandBounds = new Rectangle2D(bounds.Start, new Point2D(bounds.Start.X + 11, bounds.Start.Y + 11));
|
||||
}
|
||||
}
|
||||
|
||||
public void SpawnIsland(SurvivalTeam team, Map map, IslandType biome)
|
||||
{
|
||||
IslandBiome = biome;
|
||||
|
||||
IslandEntity = SurvivalUtility.GetIslandEntity(IslandBiome);
|
||||
|
||||
SurvivalUtility.AddIsland(team, map, map.GetAverageZ(IslandBounds.Start.X, IslandBounds.Start.Y));
|
||||
}
|
||||
|
||||
private bool inCallBack = false;
|
||||
|
||||
public void CheckTotem(SurvivalTeam myTeam, SurvivalTeam theirTeam, Mobile m)
|
||||
{
|
||||
if (!inCallBack)
|
||||
{
|
||||
var mobs = theirTeam.TeamTotem.GetMobilesInRange(1).ToList();
|
||||
|
||||
if (mobs == null || mobs.Count == 0)
|
||||
{
|
||||
if (theirTeam.TotemTime > 0)
|
||||
{
|
||||
theirTeam.TotemTime--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mobs != null && mobs.Contains(m))
|
||||
{
|
||||
if (theirTeam.TotemTime == 0)
|
||||
{
|
||||
SurvivalCore.SendTotemMsg(theirTeam, "I am being deactivated, help!");
|
||||
}
|
||||
else
|
||||
{
|
||||
var timeLeft = SurvivalCore.TotemDeactivation - theirTeam.TotemTime;
|
||||
|
||||
SurvivalCore.SendTotemMsg(theirTeam, $"I am being deactivated, {timeLeft}");
|
||||
}
|
||||
|
||||
if (theirTeam.TotemTime < SurvivalCore.TotemDeactivation)
|
||||
{
|
||||
theirTeam.TotemTime++;
|
||||
|
||||
inCallBack = true;
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(3), () =>
|
||||
{
|
||||
inCallBack = false;
|
||||
|
||||
IslandEntity.CheckIslandMove(myTeam, theirTeam, m);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
SurvivalCore.SendTotemMsg(theirTeam, "I am deactivated, Game Over!");
|
||||
|
||||
theirTeam.TeamTotem.Hue = Utility.RandomRedHue();
|
||||
|
||||
inCallBack = true;
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(3), () =>
|
||||
{
|
||||
SurvivalCore.Winner = myTeam;
|
||||
|
||||
SurvivalCore.EndMatch();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Weather
|
||||
private static bool hasWeather = false;
|
||||
|
||||
internal static bool HasWeather()
|
||||
{
|
||||
return hasWeather;
|
||||
}
|
||||
|
||||
internal static void SetWeather(bool isHot)
|
||||
{
|
||||
if (!hasWeather)
|
||||
{
|
||||
hasWeather = true;
|
||||
|
||||
Rectangle2D[] rectArray = { SurvivalCore.GameBounds };
|
||||
|
||||
if (isHot)
|
||||
{
|
||||
_ = new Weather(Map.Felucca, rectArray, 15, 100, 0, TimeSpan.FromSeconds(5));
|
||||
}
|
||||
else
|
||||
{
|
||||
_ = new Weather(Map.Felucca, rectArray, -15, 100, 0, TimeSpan.FromSeconds(5));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal static void EndWeather()
|
||||
{
|
||||
if (hasWeather)
|
||||
{
|
||||
hasWeather = false;
|
||||
|
||||
Weather.Initialize();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Server.Custom.UOSurvivalEvent.Islands
|
||||
{
|
||||
internal class BloodIsland : DefaultIsland
|
||||
{
|
||||
public BloodIsland() : base(nameof(BloodIsland))
|
||||
{
|
||||
}
|
||||
|
||||
public override (int ID, int Hue) GetRandomLandTile()
|
||||
{
|
||||
int hue = Utility.RandomList(Utility.RandomRedHue());
|
||||
|
||||
return Utility.RandomList((0x0495, hue), (0x0496, hue), (0x0497, hue), (0x0498, hue), (0x07BD, 1175), (0x07BE, 1175)); // marble
|
||||
}
|
||||
|
||||
public override int GetRandomDecorTile()
|
||||
{
|
||||
if (Utility.RandomDouble() < 0.95)
|
||||
{
|
||||
if (Utility.RandomDouble() < 0.4)
|
||||
{
|
||||
return Utility.RandomList // splatter
|
||||
(
|
||||
0x122A, 0x122B,
|
||||
0x122C, 0x122D,
|
||||
0x122E, 0x122F
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Utility.RandomList // blood decor
|
||||
(
|
||||
0x1CDD, 0x1CDE, 0x1CDF,
|
||||
0x1CE0, 0x1CE1, 0x1CE2,
|
||||
0x1CE3, 0x1CE4, 0x1CE5,
|
||||
0x1CE6, 0x1CE7, 0x1CE8,
|
||||
0x1CE9, 0x1CEA, 0x1CEB,
|
||||
0x1CEC, 0x1CED, 0x1CEE,
|
||||
0x1CEF, 0x1CF0, 0x1E90,
|
||||
0x1E91, 0x1E88, 0x1E89
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Utility.RandomList // Animations
|
||||
(
|
||||
0x374A, 0x42CF,
|
||||
0x4AA4
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private readonly List<int> m_Splatter = new List<int>()
|
||||
{
|
||||
0x122A, 0x122B,
|
||||
0x122C, 0x122D,
|
||||
0x122E, 0x122F
|
||||
};
|
||||
|
||||
public override void CheckIslandMove(SurvivalTeam myTeam, SurvivalTeam theirTeam, Mobile m)
|
||||
{
|
||||
if (m.Alive && theirTeam.IslandHasPlayer(m))
|
||||
{
|
||||
theirTeam.TeamIsland.CheckTotem(myTeam, theirTeam, m);
|
||||
|
||||
var tiles = theirTeam.IslandStatics?.FindAll(s => s.Location.X == m.Location.X && s.Location.Y == m.Location.Y)?.ToList();
|
||||
|
||||
if (tiles != null && tiles.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < tiles.Count; i++)
|
||||
{
|
||||
if (m_Splatter.Contains(tiles[i].ItemID))
|
||||
{
|
||||
if (Utility.RandomDouble() > m.Skills.MagicResist.Value * 0.01)
|
||||
{
|
||||
SurvivalUtility.PlayBloodEffect(m.Map, m.Location);
|
||||
|
||||
m.Damage(Utility.Random(m.Hits / 2));
|
||||
|
||||
m.SendMessage(53, "You are bleeding to death!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Utility.RandomDouble() < 0.5 && m.Z <= myTeam.HomeLocation.Z)
|
||||
{
|
||||
SurvivalUtility.PlayBloodEffect(m.Map, m.Location);
|
||||
|
||||
m.Damage(Utility.RandomMinMax(5, 15));
|
||||
|
||||
m.SendMessage(53, "You are bleeding to death!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SurvivalUtility.TryResPlayer(m, myTeam);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+138
@@ -0,0 +1,138 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Custom.UOSurvivalEvent.Islands
|
||||
{
|
||||
public class DefaultIsland
|
||||
{
|
||||
public string Name { get; private set; } = nameof(DefaultIsland);
|
||||
|
||||
public DefaultIsland()
|
||||
{
|
||||
}
|
||||
|
||||
public DefaultIsland(string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public virtual (int ID, int Hue) GetRandomLandTile()
|
||||
{
|
||||
if (Utility.RandomDouble() < 0.5)
|
||||
{
|
||||
return Utility.RandomList((0x9B34, 2498), (0x9B39, 2749), (0x9B3A, 2753), (0x9B3B, 2743));
|
||||
}
|
||||
else
|
||||
{
|
||||
return (0x9B34, 2498);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual int GetRandomDecorTile()
|
||||
{
|
||||
return Utility.RandomList(-1);
|
||||
}
|
||||
|
||||
public virtual void CheckIslandMove(SurvivalTeam myTeam, SurvivalTeam theirTeam, Mobile m)
|
||||
{
|
||||
if (m.Alive && theirTeam.IslandHasPlayer(m))
|
||||
{
|
||||
var tiles = theirTeam.IslandStatics?.FindAll(s => s.Location.X == m.Location.X && s.Location.Y == m.Location.Y)?.ToList();
|
||||
|
||||
if (tiles != null && tiles.Count > 0)
|
||||
{
|
||||
theirTeam.TeamIsland.CheckTotem(myTeam, theirTeam, m);
|
||||
|
||||
foreach (var tile in tiles)
|
||||
{
|
||||
if (SurvivalCore.MaskTiles.Contains(tile.ItemID))
|
||||
{
|
||||
tile.Delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (tile.ItemID)
|
||||
{
|
||||
case 0x9B34: // Safe Tile
|
||||
{
|
||||
m.SendMessage(62, "That was safe!");
|
||||
|
||||
SurvivalUtility.PlayHealEffect(myTeam.TeamTotem.Map, myTeam.TeamTotem.Location);
|
||||
|
||||
if (Utility.RandomDouble() < 0.1)
|
||||
{
|
||||
m.Heal(Utility.RandomMinMax(1, 10));
|
||||
|
||||
m.Say(62, "That felt goood!");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x9B39: // Damage Tile
|
||||
{
|
||||
m.SendMessage(42, "That was damaging, opps!");
|
||||
|
||||
SurvivalUtility.PlayDamageEffect(myTeam.TeamTotem.Map, myTeam.TeamTotem.Location);
|
||||
|
||||
if (m.Alive)
|
||||
{
|
||||
if (m.Hits > 10)
|
||||
{
|
||||
m.Damage(Utility.RandomMinMax(m.Hits / 10, m.Hits / 2));
|
||||
}
|
||||
else
|
||||
{
|
||||
m.Damage(Utility.RandomMinMax(1, m.Hits - 1));
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x9B3A: // Lethal
|
||||
{
|
||||
m.SendMessage(42, "That was lethal, oh my you might die!");
|
||||
|
||||
if (m.Alive && m.Hits > 0)
|
||||
{
|
||||
m.Damage(m.Hits - 1);
|
||||
|
||||
if (!m.Poisoned)
|
||||
{
|
||||
m.ApplyPoison(m, Poison.Lethal);
|
||||
|
||||
SurvivalUtility.PlayPoisonEffect(m, myTeam.TeamTotem.Map, myTeam.TeamTotem.Location);
|
||||
}
|
||||
else
|
||||
{
|
||||
SurvivalUtility.PlayDamageEffect(myTeam.TeamTotem.Map, myTeam.TeamTotem.Location);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x9B3B: // Teleport
|
||||
{
|
||||
m.SendMessage(42, "That was unlucky, start again!");
|
||||
|
||||
SurvivalUtility.ReturnHome(m, myTeam);
|
||||
|
||||
SurvivalCore.SendTotemMsg(myTeam, "Hurry up, get back into the fight!");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SurvivalUtility.TryResPlayer(m, myTeam);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+232
@@ -0,0 +1,232 @@
|
||||
using System.Linq;
|
||||
|
||||
namespace Server.Custom.UOSurvivalEvent.Islands
|
||||
{
|
||||
internal class DesertIsland : DefaultIsland
|
||||
{
|
||||
public DesertIsland() : base(nameof(DesertIsland))
|
||||
{
|
||||
}
|
||||
|
||||
public override (int ID, int Hue) GetRandomLandTile()
|
||||
{
|
||||
return Utility.RandomList // sand
|
||||
(
|
||||
(0x245E, 0), (0x245F, 0),
|
||||
(0x2460, 0), (0x2461, 0),
|
||||
(0x2462, 0), (0x2463, 0),
|
||||
(0x2468, 0), (0x2469, 0),
|
||||
(0x246A, 0), (0x246B, 0)
|
||||
);
|
||||
}
|
||||
|
||||
public override int GetRandomDecorTile()
|
||||
{
|
||||
if (Utility.RandomDouble() < 0.5)
|
||||
{
|
||||
if (Utility.RandomDouble() < 0.2)
|
||||
{
|
||||
return Utility.RandomList(0x2464, 0x2465); // hot rocks
|
||||
}
|
||||
else
|
||||
{
|
||||
return Utility.RandomList // misc items
|
||||
(
|
||||
0x24D5, 0x24D6, 0x24D7,
|
||||
0x24D8, 0x24D9, 0x24DA,
|
||||
0x24DB, 0x24DC, 0x24DD,
|
||||
0x24DE, 0x24DF, 0x24E0
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Utility.RandomDouble() < 0.2)
|
||||
{
|
||||
return Utility.RandomList(0x2466, 0x2467); // hot rocks
|
||||
}
|
||||
else
|
||||
{
|
||||
return Utility.RandomList(0x246C, 0x246D, 0x246E, 0x246F, 0x2470); // Bamboo
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void CheckIslandMove(SurvivalTeam myTeam, SurvivalTeam theirTeam, Mobile m)
|
||||
{
|
||||
if (m.Alive && theirTeam.IslandHasPlayer(m))
|
||||
{
|
||||
theirTeam.TeamIsland.CheckTotem(myTeam, theirTeam, m);
|
||||
|
||||
var tiles = theirTeam.IslandStatics?.FindAll(s => s.Location.X == m.Location.X && s.Location.Y == m.Location.Y)?.ToList();
|
||||
|
||||
if (tiles != null && tiles.Count > 0)
|
||||
{
|
||||
bool wasHit = false;
|
||||
|
||||
for (int i = 0; i < tiles.Count; i++)
|
||||
{
|
||||
switch (tiles[i].ItemID)
|
||||
{
|
||||
case 0x2464:
|
||||
{
|
||||
if (Utility.RandomDouble() > m.FireResistance * 0.01)
|
||||
{
|
||||
SurvivalUtility.PlayFireEffect(m.Map, m.Location);
|
||||
|
||||
m.Damage(Utility.RandomMinMax(1, m.Hits / 4));
|
||||
|
||||
m.SendMessage(53, "You sustain heat damage!");
|
||||
|
||||
wasHit = true;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x2465:
|
||||
{
|
||||
if (Utility.RandomDouble() > m.ColdResistance * 0.01)
|
||||
{
|
||||
SurvivalUtility.PlayColdEffect(m.Map, m.Location);
|
||||
|
||||
m.Damage(Utility.RandomMinMax(1, m.Hits / 4));
|
||||
|
||||
m.SendMessage(53, "You sustain cold damage!");
|
||||
|
||||
wasHit = true;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x2466:
|
||||
{
|
||||
if (Utility.RandomDouble() > m.PoisonResistance * 0.01)
|
||||
{
|
||||
SurvivalUtility.PlayPoisonEffect(m, m.Map, m.Location);
|
||||
|
||||
m.Damage(Utility.RandomMinMax(1, m.Hits / 4));
|
||||
|
||||
m.ApplyPoison(m, Poison.Lesser);
|
||||
|
||||
m.SendMessage(53, "You sustain poison damage!");
|
||||
|
||||
wasHit = true;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x2467:
|
||||
{
|
||||
if (Utility.RandomDouble() > m.EnergyResistance * 0.01)
|
||||
{
|
||||
m.BoltEffect(Utility.RandomYellowHue());
|
||||
|
||||
m.Damage(Utility.RandomMinMax(1, m.Hits / 4));
|
||||
|
||||
m.SendMessage(53, "You sustain electrical damage!");
|
||||
|
||||
wasHit = true;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!wasHit && Utility.RandomDouble() < 0.05)
|
||||
{
|
||||
m.Frozen = true;
|
||||
|
||||
SurvivalUtility.PlayWindEffect(m.Map, m.Location);
|
||||
|
||||
if (m.Hits > 9)
|
||||
{
|
||||
m.Damage(Utility.RandomMinMax(1, m.Hits / 10));
|
||||
}
|
||||
else
|
||||
{
|
||||
m.Damage(Utility.RandomMinMax(1, m.Hits - 1));
|
||||
}
|
||||
|
||||
if (Utility.RandomDouble() < 0.1)
|
||||
{
|
||||
m.SendMessage(53, "You sustained damage slipping in the sand!");
|
||||
|
||||
switch (Utility.Random(7))
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m.Direction = Direction.North;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 1:
|
||||
{
|
||||
m.Direction = Direction.Up;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 2:
|
||||
{
|
||||
m.Direction = Direction.South;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 3:
|
||||
{
|
||||
m.Direction = Direction.Down;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 4:
|
||||
{
|
||||
m.Direction = Direction.West;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 5:
|
||||
{
|
||||
m.Direction = Direction.Left;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 6:
|
||||
{
|
||||
m.Direction = Direction.East;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 7:
|
||||
{
|
||||
m.Direction = Direction.Right;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m.SendMessage(53, "You sustained damage from the sand!");
|
||||
}
|
||||
|
||||
m.Frozen = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SurvivalUtility.TryResPlayer(m, myTeam);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Server.Custom.UOSurvivalEvent.Islands
|
||||
{
|
||||
internal class FireIsland : DefaultIsland
|
||||
{
|
||||
public FireIsland() : base(nameof(FireIsland))
|
||||
{
|
||||
}
|
||||
|
||||
public override (int ID, int Hue) GetRandomLandTile()
|
||||
{
|
||||
int hue = Utility.RandomList(Utility.RandomRedHue(), Utility.RandomYellowHue(), Utility.RandomOrangeHue(), 1175);
|
||||
|
||||
return Utility.RandomList((0x0495, hue), (0x0496, hue), (0x0497, hue), (0x0498, hue)); // marble
|
||||
}
|
||||
|
||||
public override int GetRandomDecorTile()
|
||||
{
|
||||
if (Utility.RandomDouble() < 0.9)
|
||||
{
|
||||
if (Utility.RandomDouble() < 0.3)
|
||||
{
|
||||
return Utility.RandomList // cracks
|
||||
(
|
||||
0x1B01, 0x1B02, 0x1B03,
|
||||
0x1B04, 0x1B05, 0x1B06,
|
||||
0x1B07, 0x1B08
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Utility.RandomList // stone steps
|
||||
(
|
||||
0x0915, 0x0916,
|
||||
0x0917, 0x0918
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Utility.RandomList // Animations
|
||||
(
|
||||
0x1A75, 0x2AE4,
|
||||
0x3709, 0x0DE3,
|
||||
0x29FD
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private readonly List<int> m_Cracks = new List<int>()
|
||||
{
|
||||
0x1B01, 0x1B02, 0x1B03,
|
||||
0x1B04, 0x1B05, 0x1B06,
|
||||
0x1B07, 0x1B08
|
||||
};
|
||||
|
||||
public override void CheckIslandMove(SurvivalTeam myTeam, SurvivalTeam theirTeam, Mobile m)
|
||||
{
|
||||
if (m.Alive && theirTeam.IslandHasPlayer(m))
|
||||
{
|
||||
theirTeam.TeamIsland.CheckTotem(myTeam, theirTeam, m);
|
||||
|
||||
var tiles = theirTeam.IslandStatics?.FindAll(s => s.Location.X == m.Location.X && s.Location.Y == m.Location.Y)?.ToList();
|
||||
|
||||
if (tiles != null && tiles.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < tiles.Count; i++)
|
||||
{
|
||||
if (m_Cracks.Contains(tiles[i].ItemID))
|
||||
{
|
||||
if (Utility.RandomDouble() > m.FireResistance * 0.01)
|
||||
{
|
||||
SurvivalUtility.PlayFireEffect(m.Map, m.Location);
|
||||
|
||||
m.Damage(Utility.Random(m.Hits / 2));
|
||||
|
||||
m.SendMessage(53, "You are burning to death!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Utility.RandomDouble() < 0.5 && m.Z <= myTeam.HomeLocation.Z)
|
||||
{
|
||||
SurvivalUtility.PlayFireEffect(m.Map, m.Location);
|
||||
|
||||
m.Damage(Utility.RandomMinMax(5, 15));
|
||||
|
||||
m.SendMessage(53, "You are burning to death!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SurvivalUtility.TryResPlayer(m, myTeam);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
using System.Linq;
|
||||
|
||||
namespace Server.Custom.UOSurvivalEvent.Islands
|
||||
{
|
||||
internal class ForestIsland : DefaultIsland
|
||||
{
|
||||
public ForestIsland() : base(nameof(ForestIsland))
|
||||
{
|
||||
}
|
||||
|
||||
public override (int ID, int Hue) GetRandomLandTile()
|
||||
{
|
||||
return (0x337A, 0); // forest
|
||||
}
|
||||
|
||||
public override int GetRandomDecorTile()
|
||||
{
|
||||
if (Utility.RandomDouble() < 0.5)
|
||||
{
|
||||
if (Utility.RandomDouble() < 0.2)
|
||||
{
|
||||
return 0x1125; // killer mushroom
|
||||
}
|
||||
else
|
||||
{
|
||||
return Utility.RandomList(0x0C9F, 0x0CA0, 0x0CA1, 0x0CA2, 0x0CA3, 0x0CA4); // trees
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Utility.RandomDouble() < 0.2)
|
||||
{
|
||||
return 0x1125; // killer mushroom
|
||||
}
|
||||
else
|
||||
{
|
||||
return Utility.RandomList(0xA63F, 0xA640, 0xA641, 0xA642, 0xA643, 0xA644); // ferns
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void CheckIslandMove(SurvivalTeam myTeam, SurvivalTeam theirTeam, Mobile m)
|
||||
{
|
||||
SurvivalUtility.UpdateWeather(true);
|
||||
|
||||
if (m.Alive && theirTeam.IslandHasPlayer(m))
|
||||
{
|
||||
theirTeam.TeamIsland.CheckTotem(myTeam, theirTeam, m);
|
||||
|
||||
var tiles = theirTeam.IslandStatics?.FindAll(s => s.Location.X == m.Location.X && s.Location.Y == m.Location.Y)?.ToList();
|
||||
|
||||
if (tiles != null && tiles.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < tiles.Count; i++)
|
||||
{
|
||||
if (tiles[i].ItemID == 0x1125)
|
||||
{
|
||||
if (Utility.RandomDouble() > (int)m.Skills.DetectHidden.Value * 0.01)
|
||||
{
|
||||
SurvivalUtility.PlayMushroomEffect(tiles[i], tiles[i].Map, tiles[i].Location);
|
||||
|
||||
m.Damage(Utility.RandomMinMax(1, m.Hits - 1));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Utility.RandomDouble() < 0.05)
|
||||
{
|
||||
m.BoltEffect(Utility.RandomBlueHue());
|
||||
|
||||
m.Damage(Utility.RandomMinMax(1, m.Hits - 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SurvivalUtility.TryResPlayer(m, myTeam);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
using Server.Items;
|
||||
using System;
|
||||
|
||||
namespace Server.Custom.UOSurvivalEvent.Islands
|
||||
{
|
||||
public class GrassIsland : DefaultIsland
|
||||
{
|
||||
public GrassIsland() : base(nameof(GrassIsland))
|
||||
{
|
||||
}
|
||||
|
||||
public override (int ID, int Hue) GetRandomLandTile()
|
||||
{
|
||||
return Utility.RandomList((0x177D, 0), (0x177E, 0), (0x177F, 0), (0x1780, 0), (0x1781, 0));
|
||||
}
|
||||
|
||||
public override int GetRandomDecorTile()
|
||||
{
|
||||
return Utility.RandomList(0x0CAC, 0x0CAD, 0x0CAE, 0x0CAF, 0x0CB0, 0x0CB1, 0x0CB2, 0x0CB3, 0x0CB4, 0x0CB5, 0x0CB6, 0x0CC5);
|
||||
}
|
||||
|
||||
private bool inCallBack = false;
|
||||
|
||||
public override void CheckIslandMove(SurvivalTeam myTeam, SurvivalTeam theirTeam, Mobile m)
|
||||
{
|
||||
if (m.Alive && theirTeam.IslandHasPlayer(m))
|
||||
{
|
||||
theirTeam.TeamIsland.CheckTotem(myTeam, theirTeam, m);
|
||||
|
||||
if (!inCallBack && Utility.RandomDouble() > (int)m.Skills.RemoveTrap.Value * 0.01)
|
||||
{
|
||||
inCallBack = true;
|
||||
|
||||
m.Frozen = true;
|
||||
|
||||
m.SendMessage(53, "You are snared by the sticky grass!");
|
||||
|
||||
Static grass = new Static(Utility.RandomList(0x0C55, 0x0C56, 0x0C57, 0x0C58, 0x0C59, 0x0C5A, 0x0C5B))
|
||||
{
|
||||
Hue = Utility.RandomList(2758, 2760)
|
||||
};
|
||||
|
||||
grass.MoveToWorld(new Point3D(m.Location.X, m.Location.Y, m.Location.Z + 3), m.Map);
|
||||
|
||||
Effects.PlaySound(m.Location, m.Map, 0x4F);
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(3), () =>
|
||||
{
|
||||
inCallBack = false;
|
||||
|
||||
m.Frozen = false;
|
||||
|
||||
grass.Delete();
|
||||
|
||||
Effects.PlaySound(m.Location, m.Map, 0x4F);
|
||||
|
||||
if (Utility.RandomDouble() > (int)m.Skills.Wrestling.Value * 0.01)
|
||||
{
|
||||
var max = (int)m.Skills.Wrestling.Value > m.Hits - 1 ? m.Hits - 1 : (int)m.Skills.Wrestling.Value;
|
||||
|
||||
m.Damage(Utility.Random(1, max));
|
||||
|
||||
m.SendMessage(53, "You were damaged by the sticky grass!");
|
||||
}
|
||||
else
|
||||
{
|
||||
m.SendMessage(53, "You freed yourself from the sticky grass!");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SurvivalUtility.TryResPlayer(m, myTeam);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Server.Custom.UOSurvivalEvent.Islands
|
||||
{
|
||||
internal class SnowIsland : DefaultIsland
|
||||
{
|
||||
public SnowIsland() : base(nameof(SnowIsland))
|
||||
{
|
||||
}
|
||||
|
||||
public override (int ID, int Hue) GetRandomLandTile()
|
||||
{
|
||||
return Utility.RandomList((0x17BD, 0), (0x17BE, 0), (0x17BF, 0), (0x17C0, 0), (0x4C0E, 0), (0x4C0F, 0), (0x4C10, 0), (0x4C11, 0)); // snow
|
||||
}
|
||||
|
||||
public override int GetRandomDecorTile()
|
||||
{
|
||||
if (Utility.RandomDouble() < 0.9)
|
||||
{
|
||||
if (Utility.RandomDouble() < 0.3)
|
||||
{
|
||||
return Utility.RandomList(0xA672, 0xA673, 0xA674, 0xA675, 0x17CD, 0x17CE); // Snow Piles
|
||||
}
|
||||
else
|
||||
{
|
||||
return Utility.RandomList // Crystals
|
||||
(
|
||||
0x2FDC, 0x2FDD, 0x2FE6,
|
||||
0x2FE7, 0x9CB6, 0x9CB5,
|
||||
0x2207, 0x2208, 0x2211,
|
||||
0x2212, 0x221B, 0x221C,
|
||||
0x2225, 0x2226, 0x9CB7,
|
||||
0x9CB8, 0x9CAA, 0x9CAB,
|
||||
0x9CAC
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Utility.RandomList // Animations
|
||||
(
|
||||
0x1153, 0x9CBB, 0x9CC1,
|
||||
0x9CC8, 0x9CB8, 0x9CAC,
|
||||
0x9CAB, 0x483B, 0x4853,
|
||||
0x4883, 0x3967, 0x3979
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private readonly List<int> m_Piles = new List<int>() { 0xA672, 0xA673, 0xA674, 0xA675, 0x17CD, 0x17CE };
|
||||
|
||||
public override void CheckIslandMove(SurvivalTeam myTeam, SurvivalTeam theirTeam, Mobile m)
|
||||
{
|
||||
SurvivalUtility.UpdateWeather(false);
|
||||
|
||||
if (m.Alive && theirTeam.IslandHasPlayer(m))
|
||||
{
|
||||
theirTeam.TeamIsland.CheckTotem(myTeam, theirTeam, m);
|
||||
|
||||
var tiles = theirTeam.IslandStatics?.FindAll(s => s.Location.X == m.Location.X && s.Location.Y == m.Location.Y)?.ToList();
|
||||
|
||||
if (tiles != null && tiles.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < tiles.Count; i++)
|
||||
{
|
||||
if (m_Piles.Contains(tiles[i].ItemID))
|
||||
{
|
||||
if (Utility.RandomDouble() > m.ColdResistance * 0.01)
|
||||
{
|
||||
SurvivalUtility.PlayColdEffect(m.Map, m.Location);
|
||||
|
||||
m.Damage(Utility.Random(m.Hits / 2));
|
||||
|
||||
m.SendMessage(53, "You are freezing to death!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Utility.RandomDouble() < 0.1)
|
||||
{
|
||||
SurvivalUtility.PlayColdEffect(m.Map, m.Location);
|
||||
|
||||
m.Damage(Utility.RandomMinMax(5, 15));
|
||||
|
||||
m.SendMessage(53, "You are freezing to death!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SurvivalUtility.TryResPlayer(m, myTeam);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Server.Custom.UOSurvivalEvent.Islands
|
||||
{
|
||||
internal class SwampIsland : DefaultIsland
|
||||
{
|
||||
public SwampIsland() : base(nameof(SwampIsland))
|
||||
{
|
||||
}
|
||||
|
||||
public override (int ID, int Hue) GetRandomLandTile()
|
||||
{
|
||||
return Utility.RandomList((0x3258, 0), (0x3259, 0), (0x325A, 0), (0x325B, 0), (0x325C, 0), (0x325D, 0)); // swamp
|
||||
}
|
||||
|
||||
public override int GetRandomDecorTile()
|
||||
{
|
||||
if (Utility.RandomDouble() < 0.9)
|
||||
{
|
||||
if (Utility.RandomDouble() < 0.1)
|
||||
{
|
||||
return Utility.RandomList(0xA85F, 0xA860); // swamp
|
||||
}
|
||||
else
|
||||
{
|
||||
return Utility.RandomList // Logs
|
||||
(
|
||||
0x324B, 0x324C, 0x324D,
|
||||
0x325E, 0x325F, 0x3260,
|
||||
0x1B09, 0x1B0A, 0x1B0B,
|
||||
0x1B0C, 0x1B0D, 0x1B0E,
|
||||
0x1B0F, 0x1B10
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Utility.RandomList(0x322C, 0x0D05, 0x11A6);
|
||||
}
|
||||
}
|
||||
|
||||
private readonly List<int> m_SwampPiles = new List<int>() { 0xA85F, 0xA860 };
|
||||
|
||||
public override void CheckIslandMove(SurvivalTeam myTeam, SurvivalTeam theirTeam, Mobile m)
|
||||
{
|
||||
if (m.Alive && theirTeam.IslandHasPlayer(m))
|
||||
{
|
||||
theirTeam.TeamIsland.CheckTotem(myTeam, theirTeam, m);
|
||||
|
||||
var tiles = theirTeam.IslandStatics?.FindAll(s => s.Location.X == m.Location.X && s.Location.Y == m.Location.Y)?.ToList();
|
||||
|
||||
if (tiles != null && tiles.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < tiles.Count; i++)
|
||||
{
|
||||
if (m_SwampPiles.Contains(tiles[i].ItemID))
|
||||
{
|
||||
if (Utility.RandomDouble() > m.PoisonResistance * 0.01)
|
||||
{
|
||||
SurvivalUtility.PlayPoisonEffect(m, m.Map, m.Location);
|
||||
|
||||
if (m.Poisoned)
|
||||
{
|
||||
m.Damage(Utility.Random(m.Hits / 2));
|
||||
}
|
||||
else
|
||||
{
|
||||
m.ApplyPoison(m, Utility.RandomList(Poison.Lesser, Poison.Deadly, Poison.Lethal));
|
||||
}
|
||||
|
||||
m.SendMessage(62, "You are being poisoned to death!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m.Poisoned && Utility.RandomDouble() < 0.1)
|
||||
{
|
||||
m.ApplyPoison(m, Poison.Lesser);
|
||||
|
||||
m.SendMessage(62, "You are being poisoned to death!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SurvivalUtility.TryResPlayer(m, myTeam);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+176
@@ -0,0 +1,176 @@
|
||||
using System.Linq;
|
||||
using Server.Items;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Custom.UOSurvivalEvent.Items
|
||||
{
|
||||
[Flipable(0xA92D, 0xA92E)]
|
||||
internal class TopPlayersBook : Static, IFlipable
|
||||
{
|
||||
private static List<SurvivalLeaderEntity> TopPlayers = new List<SurvivalLeaderEntity>();
|
||||
|
||||
private static TopPlayersBook b_Instance;
|
||||
|
||||
internal static void ValidateTopPlayer(SurvivalPlayer player)
|
||||
{
|
||||
if (TopPlayers == null)
|
||||
{
|
||||
TopPlayers = new List<SurvivalLeaderEntity>();
|
||||
}
|
||||
|
||||
if (TopPlayers.Count == 0)
|
||||
{
|
||||
TopPlayers.Add(new SurvivalLeaderEntity(player.S_Player.Name, player.Kills, player.Deaths, player.Points));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < TopPlayers.Count; i++)
|
||||
{
|
||||
if (TopPlayers[i].Points < player.Points)
|
||||
{
|
||||
TopPlayers.Insert(i, new SurvivalLeaderEntity(player.S_Player.Name, player.Kills, player.Deaths, player.Points));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (TopPlayers.Count > 25)
|
||||
{
|
||||
TopPlayers.Remove(TopPlayers.Last());
|
||||
}
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public TopPlayersBook() : base(0xA92D)
|
||||
{
|
||||
Name = "Survival Island - Top 25";
|
||||
|
||||
Hue = 2500;
|
||||
|
||||
Movable = false;
|
||||
|
||||
if (b_Instance == null)
|
||||
{
|
||||
b_Instance = this;
|
||||
}
|
||||
else
|
||||
{
|
||||
World.Broadcast(43, false, "Already have book placed in world!");
|
||||
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
|
||||
public void OnFlip(Mobile m)
|
||||
{
|
||||
if (ItemID == 0xA92D)
|
||||
{
|
||||
base.ItemID = 0xA92E;
|
||||
}
|
||||
else
|
||||
{
|
||||
base.ItemID = 0xA92D;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (TopPlayers.Count > 0)
|
||||
{
|
||||
from.SendMessage(33, "Top 25 Players");
|
||||
|
||||
for (int i = 0; i < TopPlayers.Count; i++)
|
||||
{
|
||||
from.SendMessage(53, "--------------------------------");
|
||||
from.SendMessage(63, $"{i + 1}. {TopPlayers[i].Name}");
|
||||
from.SendMessage(63, $"{i + 1}. {TopPlayers[i].Kills} - Kills");
|
||||
from.SendMessage(63, $"{i + 1}. {TopPlayers[i].Deaths} - Deaths");
|
||||
from.SendMessage(63, $"{i + 1}. {TopPlayers[i].Points} - Points");
|
||||
from.SendMessage(53, "--------------------------------");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage(43, "Leaderboard - Empty!");
|
||||
from.SendMessage(53, "--------------------------");
|
||||
from.SendMessage(63, "Start Event : [StartSurvival ");
|
||||
}
|
||||
|
||||
base.OnDoubleClick(from);
|
||||
}
|
||||
|
||||
public TopPlayersBook(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(TopPlayers.Count);
|
||||
|
||||
if (TopPlayers.Count > 0)
|
||||
{
|
||||
foreach (var entity in TopPlayers)
|
||||
{
|
||||
writer.Write(entity.Name);
|
||||
writer.Write(entity.Kills);
|
||||
writer.Write(entity.Deaths);
|
||||
writer.Write(entity.Points);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int count = reader.ReadInt();
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
List<SurvivalLeaderEntity> temp = new List<SurvivalLeaderEntity>();
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
var entity = new SurvivalLeaderEntity(reader.ReadString(), reader.ReadInt(), reader.ReadInt(), reader.ReadInt());
|
||||
|
||||
temp.Add(entity);
|
||||
}
|
||||
|
||||
if (TopPlayers == null)
|
||||
{
|
||||
TopPlayers = new List<SurvivalLeaderEntity>();
|
||||
}
|
||||
|
||||
if (TopPlayers.Count == 0)
|
||||
{
|
||||
TopPlayers.AddRange(temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal class SurvivalLeaderEntity
|
||||
{
|
||||
public string Name { get; private set; }
|
||||
|
||||
public int Kills { get; private set; }
|
||||
|
||||
public int Deaths { get; private set; }
|
||||
|
||||
public int Points { get; private set; }
|
||||
|
||||
public SurvivalLeaderEntity(string name, int kills, int deaths, int points)
|
||||
{
|
||||
Name = name;
|
||||
|
||||
Kills = kills;
|
||||
|
||||
Deaths = deaths;
|
||||
|
||||
Points = points;
|
||||
}
|
||||
}
|
||||
}
|
||||
+483
@@ -0,0 +1,483 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Server.Items;
|
||||
using Server.Multis;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using System.Collections.Generic;
|
||||
using Server.Custom.UOSurvivalEvent.Islands;
|
||||
using Server.Custom.UOSurvivalEvent.Commands;
|
||||
using Server.Gumps;
|
||||
|
||||
namespace Server.Custom.UOSurvivalEvent
|
||||
{
|
||||
public enum SurvivalGameStage
|
||||
{
|
||||
Ready,
|
||||
Waiting,
|
||||
Running,
|
||||
Paused,
|
||||
Ending,
|
||||
Resetting
|
||||
}
|
||||
|
||||
internal static class SurvivalCore
|
||||
{
|
||||
internal static SurvivalGameStage GameStage { get; private set; } = SurvivalGameStage.Ready;
|
||||
|
||||
internal static List<SurvivalPlayer> PlayerLobby { get; private set; } = new List<SurvivalPlayer>();
|
||||
|
||||
internal static bool GameRunning { get { return GameStage == SurvivalGameStage.Running; } }
|
||||
|
||||
internal static Rectangle2D GameBounds { get; set; }
|
||||
|
||||
internal static List<Static> BoundryList { get; set; } = new List<Static>();
|
||||
|
||||
internal static SurvivalTeam TeamOne { get; set; }
|
||||
|
||||
internal static SurvivalTeam TeamTwo { get; set; }
|
||||
|
||||
internal static SurvivalTeam Winner { get; set; }
|
||||
|
||||
internal const int TotemDeactivation = 10;
|
||||
|
||||
internal static List<int> MaskTiles = new List<int>() { 0x050D, 0x050E, 0x050F, 0x0510, 0x0511, 0x0512, 0x0513, 0x0514 };
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
EventSink.Movement += EventSink_Movement;
|
||||
|
||||
EventSink.PlayerDeath += EventSink_PlayerDeath;
|
||||
|
||||
EventSink.Logout += EventSink_Logout;
|
||||
|
||||
EventSink.BeforeWorldSave += EventSink_BeforeWorldSave;
|
||||
|
||||
EventSink.AfterWorldSave += EventSink_AfterWorldSave;
|
||||
|
||||
EventSink.Crashed += EventSink_Crashed;
|
||||
|
||||
EventSink.Shutdown += EventSink_Shutdown;
|
||||
}
|
||||
|
||||
internal static void AddToLobby(Mobile m)
|
||||
{
|
||||
if (PlayerLobby != null)
|
||||
{
|
||||
if (GameStage == SurvivalGameStage.Ready)
|
||||
{
|
||||
GameStage = SurvivalGameStage.Waiting;
|
||||
}
|
||||
|
||||
PlayerLobby.Add(new SurvivalPlayer(m));
|
||||
|
||||
GiveInstructions(m);
|
||||
}
|
||||
}
|
||||
|
||||
internal static void RemoveFromLobby(PlayerMobile user)
|
||||
{
|
||||
var playerInfo = PlayerLobby.Find(i => i.S_Player == user);
|
||||
|
||||
if (playerInfo != null)
|
||||
{
|
||||
PlayerLobby.Remove(playerInfo);
|
||||
|
||||
playerInfo.S_Player.SendMessage(53, "You were removed from the next match!");
|
||||
}
|
||||
|
||||
if (PlayerLobby.Count == 0)
|
||||
{
|
||||
EndMatch();
|
||||
}
|
||||
}
|
||||
|
||||
internal static void SendGump()
|
||||
{
|
||||
foreach (var playerInfo in PlayerLobby)
|
||||
{
|
||||
if (playerInfo.S_Player.HasGump(typeof(SurvivalGump)))
|
||||
{
|
||||
playerInfo.S_Player.CloseGump(typeof(SurvivalGump));
|
||||
}
|
||||
|
||||
BaseGump.SendGump(new SurvivalGump(playerInfo.S_Player as PlayerMobile));
|
||||
}
|
||||
}
|
||||
|
||||
private static void GiveInstructions(Mobile m)
|
||||
{
|
||||
m.SendMessage(53, "Welcome to the Survival Island Event!");
|
||||
m.SendMessage(53, "This is a pvp style event!");
|
||||
m.SendMessage(53, "You'll be given a boat deed!");
|
||||
m.SendMessage(53, "Use boat to travel to other teams island!");
|
||||
m.SendMessage(53, "Win by deactivating the other teams Totem!");
|
||||
m.SendMessage(53, "Stand next to the Totem until it deactivates!");
|
||||
m.SendMessage(53, "Have Fun!");
|
||||
}
|
||||
|
||||
internal static void SetUpMatch()
|
||||
{
|
||||
|
||||
TeamOne = new SurvivalTeam();
|
||||
|
||||
TeamTwo = new SurvivalTeam();
|
||||
|
||||
for (int i = 0; i < PlayerLobby.Count; i++)
|
||||
{
|
||||
if (TeamTwo.TeamPlayers.Count >= TeamOne.TeamPlayers.Count)
|
||||
{
|
||||
TeamOne.AddPlayer(PlayerLobby[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
TeamTwo.AddPlayer(PlayerLobby[i]);
|
||||
}
|
||||
|
||||
PlayerLobby[i].S_Player.SendMessage(53, "Game Starting!!!");
|
||||
|
||||
PlayerLobby[i].S_Player.PlaySound(0x5B4);
|
||||
}
|
||||
|
||||
var sizeBase = 10 * (TeamOne.TeamPlayers.Count > 5 ? 5 : TeamOne.TeamPlayers.Count) + 1;
|
||||
|
||||
int StartPoint = 3450;
|
||||
|
||||
Point2D teamOneStart = new Point2D(StartPoint, StartPoint + 300);
|
||||
|
||||
Point2D teamTwoStart = new Point2D(StartPoint + 100, StartPoint + 300);
|
||||
|
||||
GameBounds = new Rectangle2D
|
||||
(
|
||||
new Point2D(teamOneStart.X - sizeBase, teamOneStart.Y - sizeBase),
|
||||
new Point2D(teamTwoStart.X + (sizeBase * 2), teamTwoStart.Y + (sizeBase * 2))
|
||||
);
|
||||
|
||||
SurvivalUtility.SpawnGameBoundry();
|
||||
|
||||
IslandType biome = (IslandType)Utility.Random(Enum.GetValues(typeof(IslandType)).Length - 1);
|
||||
|
||||
// Team One Island
|
||||
TeamOne.AddIslandLocation(new Rectangle2D(teamOneStart, new Point2D(teamOneStart.X + sizeBase, teamOneStart.Y + sizeBase)));
|
||||
|
||||
TeamOne.SpawnIsland(Map.Felucca, biome);
|
||||
|
||||
// Team Two Island
|
||||
TeamTwo.AddIslandLocation(new Rectangle2D(teamTwoStart, new Point2D(teamTwoStart.X + sizeBase, teamTwoStart.Y + sizeBase)));
|
||||
|
||||
if (Utility.RandomDouble() < 0.1)
|
||||
{
|
||||
TeamTwo.SpawnIsland(Map.Felucca, (IslandType)Utility.Random(Enum.GetValues(typeof(IslandType)).Length - 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
TeamTwo.SpawnIsland(Map.Felucca, biome);
|
||||
}
|
||||
|
||||
StartMatch();
|
||||
}
|
||||
|
||||
internal static void StartMatch()
|
||||
{
|
||||
if (TeamOne != null && TeamTwo != null)
|
||||
{
|
||||
TeamOne.MoveToIsland();
|
||||
|
||||
TeamTwo.MoveToIsland();
|
||||
|
||||
PlayerLobby.Clear();
|
||||
|
||||
GameStage = SurvivalGameStage.Running;
|
||||
|
||||
Console.WriteLine($"Survival Event - Started : {DateTime.Now.ToShortTimeString()}");
|
||||
}
|
||||
}
|
||||
|
||||
internal static void JoinLate(Mobile m)
|
||||
{
|
||||
SurvivalPlayer sp = new SurvivalPlayer(m);
|
||||
|
||||
if (TeamOne.TeamPlayers.Count > TeamTwo.TeamPlayers.Count)
|
||||
{
|
||||
TeamTwo.AddPlayer(sp);
|
||||
|
||||
TeamTwo.LateMove(sp);
|
||||
}
|
||||
else
|
||||
{
|
||||
TeamOne.AddPlayer(new SurvivalPlayer(m));
|
||||
|
||||
TeamOne.LateMove(sp);
|
||||
}
|
||||
}
|
||||
|
||||
private static void EventSink_Movement(MovementEventArgs e)
|
||||
{
|
||||
if (e.Mobile is PlayerMobile pm && GameRunning)
|
||||
{
|
||||
if (TeamOne.HasPlayer(pm))
|
||||
{
|
||||
if (GameBounds.Contains(pm.Location))
|
||||
{
|
||||
Timer.DelayCall(TimeSpan.FromMilliseconds(100), () =>
|
||||
{
|
||||
if (GameRunning && TeamTwo != null && TeamTwo.TeamIsland != null && TeamTwo.TeamIsland.IslandEntity != null)
|
||||
{
|
||||
TeamTwo.TeamIsland.IslandEntity.CheckIslandMove(TeamOne, TeamTwo, pm);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
TeamOne.RemovePlayer(pm);
|
||||
|
||||
pm.SendMessage(53, "You were removed from the game!");
|
||||
}
|
||||
}
|
||||
else if (TeamTwo.HasPlayer(pm))
|
||||
{
|
||||
if (GameBounds.Contains(pm.Location))
|
||||
{
|
||||
Timer.DelayCall(TimeSpan.FromMilliseconds(100), () =>
|
||||
{
|
||||
if (GameRunning && TeamOne != null && TeamOne.TeamIsland != null && TeamOne.TeamIsland.IslandEntity != null)
|
||||
{
|
||||
TeamOne.TeamIsland.IslandEntity.CheckIslandMove(TeamTwo, TeamOne, pm);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
TeamTwo.RemovePlayer(pm);
|
||||
|
||||
pm.SendMessage(53, "You were removed from the game!");
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private static void EventSink_PlayerDeath(PlayerDeathEventArgs e)
|
||||
{
|
||||
if (GameRunning)
|
||||
{
|
||||
var killer = TeamOne.GetPlayerInfo(e.Killer);
|
||||
|
||||
if (killer != null)
|
||||
{
|
||||
var victim = TeamTwo.GetPlayerInfo(e.Mobile);
|
||||
|
||||
if (victim != null)
|
||||
{
|
||||
UpdatePlayerStats(killer, victim);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
killer = TeamTwo.GetPlayerInfo(e.Killer);
|
||||
|
||||
if (killer != null)
|
||||
{
|
||||
var victim = TeamOne.GetPlayerInfo(e.Mobile);
|
||||
|
||||
if (victim != null)
|
||||
{
|
||||
UpdatePlayerStats(killer, victim);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void EventSink_Logout(LogoutEventArgs e)
|
||||
{
|
||||
if (TeamOne != null && TeamOne.HasPlayer(e.Mobile))
|
||||
{
|
||||
TeamOne.RemovePlayer(e.Mobile);
|
||||
|
||||
RemoveBoat(e.Mobile);
|
||||
}
|
||||
else if (TeamTwo != null && TeamTwo.HasPlayer(e.Mobile))
|
||||
{
|
||||
TeamOne.RemovePlayer(e.Mobile);
|
||||
|
||||
RemoveBoat(e.Mobile);
|
||||
}
|
||||
|
||||
if (GameRunning && TeamOne?.TeamPlayers.Count == 0 && TeamTwo?.TeamPlayers.Count == 0)
|
||||
{
|
||||
EndMatch();
|
||||
}
|
||||
}
|
||||
|
||||
private static void EventSink_BeforeWorldSave(BeforeWorldSaveEventArgs e)
|
||||
{
|
||||
if (GameRunning)
|
||||
{
|
||||
GameStage = SurvivalGameStage.Paused;
|
||||
|
||||
TeamOne?.FreezeAllPlayers();
|
||||
|
||||
TeamTwo?.FreezeAllPlayers();
|
||||
}
|
||||
}
|
||||
|
||||
private static void EventSink_AfterWorldSave(AfterWorldSaveEventArgs e)
|
||||
{
|
||||
if (GameStage == SurvivalGameStage.Paused)
|
||||
{
|
||||
TeamOne?.UnFreezeAllPlayers();
|
||||
|
||||
TeamTwo?.UnFreezeAllPlayers();
|
||||
|
||||
GameStage = SurvivalGameStage.Running;
|
||||
}
|
||||
}
|
||||
|
||||
private static void EventSink_Crashed(CrashedEventArgs e)
|
||||
{
|
||||
if (GameRunning)
|
||||
{
|
||||
EndMatch();
|
||||
}
|
||||
}
|
||||
|
||||
private static void EventSink_Shutdown(ShutdownEventArgs e)
|
||||
{
|
||||
if (GameRunning)
|
||||
{
|
||||
EndMatch();
|
||||
}
|
||||
}
|
||||
|
||||
private static void UpdatePlayerStats(SurvivalPlayer killer, SurvivalPlayer victim, bool isEnd = false)
|
||||
{
|
||||
if (isEnd)
|
||||
{
|
||||
// Kill Bonus
|
||||
for (int i = 0; i < killer.Kills; i++)
|
||||
{
|
||||
killer.UpdateStats(false, false, true);
|
||||
}
|
||||
|
||||
killer.UpdateStats(false, false, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
killer.UpdateStats(true, false, true);
|
||||
|
||||
victim.UpdateStats(false, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
internal static void RemoveBoat(Mobile m)
|
||||
{
|
||||
var boat = m.Backpack.FindItemByType(typeof(SmallBoatDeed));
|
||||
|
||||
boat?.Delete();
|
||||
}
|
||||
|
||||
internal static void SendTotemMsg(SurvivalTeam team, string message)
|
||||
{
|
||||
team.TeamTotem.PublicOverheadMessage(MessageType.Yell, 53, false, message);
|
||||
|
||||
SurvivalUtility.PlayTotemEffect(team.TeamTotem.Map, team.TeamTotem.Location, team == TeamOne);
|
||||
}
|
||||
|
||||
private static void DespawnBoundry()
|
||||
{
|
||||
if (BoundryList.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < BoundryList.Count; i++)
|
||||
{
|
||||
BoundryList[i].Delete();
|
||||
}
|
||||
|
||||
BoundryList.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
internal static void EndMatch()
|
||||
{
|
||||
GameStage = SurvivalGameStage.Ending;
|
||||
|
||||
TeamOne?.PlayEndGameSound();
|
||||
|
||||
TeamTwo?.PlayEndGameSound();
|
||||
|
||||
if (Winner != null)
|
||||
{
|
||||
for (int i = 0; i < Winner.TeamPlayers.Count; i++)
|
||||
{
|
||||
UpdatePlayerStats(Winner.TeamPlayers[i], null, true);
|
||||
}
|
||||
|
||||
Winner.IsWinner = true;
|
||||
}
|
||||
|
||||
TeamOne?.MoveToHome();
|
||||
|
||||
TeamTwo?.MoveToHome();
|
||||
|
||||
TeamOne?.DespawnIsland();
|
||||
|
||||
TeamOne?.TeamTotem.Delete();
|
||||
|
||||
TeamTwo?.DespawnIsland();
|
||||
|
||||
TeamTwo?.TeamTotem.Delete();
|
||||
|
||||
DespawnBoundry();
|
||||
|
||||
CleanSurvivalZone();
|
||||
|
||||
GameStage = SurvivalGameStage.Resetting;
|
||||
|
||||
if (SurvivalSettings.IsAutoOff)
|
||||
{
|
||||
SurvivalSettings.SurvivalEnabled = false;
|
||||
}
|
||||
|
||||
TeamOne = null;
|
||||
|
||||
TeamTwo = null;
|
||||
|
||||
Winner = null;
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(SurvivalSettings.MatchDelay), () =>
|
||||
{
|
||||
ResetGame();
|
||||
|
||||
Console.WriteLine($"Survival Event - Reset : {DateTime.Now.ToShortTimeString()}");
|
||||
});
|
||||
}
|
||||
|
||||
private static void CleanSurvivalZone()
|
||||
{
|
||||
if (GameBounds.Start != Point2D.Zero && GameBounds.End != Point2D.Zero)
|
||||
{
|
||||
var garbage = Map.Felucca.GetObjectsInBounds(GameBounds).ToList();
|
||||
|
||||
for (int i = 0; i < garbage.Count; i++)
|
||||
{
|
||||
if (garbage[i] is BaseBoat boat)
|
||||
{
|
||||
if (boat.IsClassicBoat)
|
||||
{
|
||||
boat.RemoveKeys(boat.Owner);
|
||||
}
|
||||
}
|
||||
|
||||
if (garbage[i] is Item)
|
||||
{
|
||||
garbage[i].Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void ResetGame()
|
||||
{
|
||||
GameStage = SurvivalGameStage.Ready;
|
||||
}
|
||||
}
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Custom.UOSurvivalEvent
|
||||
{
|
||||
internal class SurvivalGump : BaseGump
|
||||
{
|
||||
public SurvivalGump(PlayerMobile user) : base(user, 50, 50, null)
|
||||
{
|
||||
}
|
||||
|
||||
public override void AddGumpLayout()
|
||||
{
|
||||
Closable = false;
|
||||
Resizable = false;
|
||||
Dragable = true;
|
||||
|
||||
AddBackground(X, Y, 150, SurvivalCore.PlayerLobby.Count * 25 + 130, 40000);
|
||||
|
||||
AddLabel(X + 30, Y + 12, 2720, "Survival Islands");
|
||||
|
||||
AddButton(X + 25, Y + 41, 2360, 2361, 1, GumpButtonType.Reply, 0);
|
||||
AddLabel(X + 45, Y + 37, 2499, "Start Match");
|
||||
|
||||
AddButton(X + 25, Y + 71, 2361, 2360, 2, GumpButtonType.Reply, 0);
|
||||
AddLabel(X + 45, Y + 67, 2499, "Leave Match");
|
||||
|
||||
AddLabel(X + 25, Y + 97, 43, "Current Players");
|
||||
|
||||
int y = Y + 97;
|
||||
|
||||
foreach (var player in SurvivalCore.PlayerLobby)
|
||||
{
|
||||
y += 25;
|
||||
|
||||
AddLabel(X + 25, y, 62, player.S_Player.Name);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse(RelayInfo info)
|
||||
{
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 1: // Start
|
||||
{
|
||||
if (SurvivalCore.PlayerLobby.Count >= SurvivalSettings.MinPlayers)
|
||||
{
|
||||
if (!SurvivalSettings.StaffOnlyStart)
|
||||
{
|
||||
SurvivalCore.SetUpMatch();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
User.SendMessage(53, "Not enough players to start match!");
|
||||
|
||||
Refresh(true, false);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 2: // Cancel
|
||||
{
|
||||
SurvivalCore.RemoveFromLobby(User);
|
||||
|
||||
Close();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
Close();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
namespace Server.Custom.UOSurvivalEvent
|
||||
{
|
||||
public class SurvivalPlayer
|
||||
{
|
||||
public Mobile S_Player { get; private set; }
|
||||
|
||||
public int Kills { get; private set; } = 0;
|
||||
|
||||
public int Deaths { get; private set; } = 0;
|
||||
|
||||
public int Points { get; private set; } = 0;
|
||||
|
||||
public (Point3D oldLocation, Map map) HomeLocation { get; private set; }
|
||||
|
||||
public SurvivalPlayer(Mobile m)
|
||||
{
|
||||
S_Player = m;
|
||||
}
|
||||
|
||||
public void UpdateStats(bool kill, bool death, bool point)
|
||||
{
|
||||
if (kill)
|
||||
{
|
||||
Kills++;
|
||||
}
|
||||
|
||||
if (death)
|
||||
{
|
||||
Deaths++;
|
||||
}
|
||||
|
||||
if (point)
|
||||
{
|
||||
Points++;
|
||||
}
|
||||
}
|
||||
|
||||
public void MarkHomeLocation()
|
||||
{
|
||||
HomeLocation = (S_Player.Location, S_Player.Map);
|
||||
}
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Custom.UOSurvivalEvent
|
||||
{
|
||||
internal static class SurvivalSettings
|
||||
{
|
||||
// Core
|
||||
internal static bool SurvivalEnabled { get; set; } = false;
|
||||
|
||||
internal static bool IsAutoOff { get; set; } = true;
|
||||
|
||||
internal static int MinPlayers { get; set; } = 2;
|
||||
|
||||
internal static bool CanJoinLate { get; set; } = false;
|
||||
|
||||
internal static int MatchDelay { get; set; } = 10; // seconds
|
||||
|
||||
internal static bool StaffOnlyStart { get; set; } = true;
|
||||
|
||||
// Rewards
|
||||
internal static bool IsGoldPrize { get; set; } = true;
|
||||
|
||||
internal static int GoldAmount { get; set; } = 50;
|
||||
|
||||
internal static bool IsItemPrize { get; set; } = false;
|
||||
|
||||
internal static Type ItemPrize { get; set; } = typeof(ClothingBlessDeed);
|
||||
}
|
||||
}
|
||||
+263
@@ -0,0 +1,263 @@
|
||||
using Server.Custom.UOSurvivalEvent.Islands;
|
||||
using Server.Custom.UOSurvivalEvent.Items;
|
||||
using System.Collections.Generic;
|
||||
using Server.Multis;
|
||||
using Server.Items;
|
||||
using System;
|
||||
|
||||
namespace Server.Custom.UOSurvivalEvent
|
||||
{
|
||||
public class SurvivalTeam
|
||||
{
|
||||
public List<SurvivalPlayer> TeamPlayers { get; private set; }
|
||||
|
||||
public BaseIsland TeamIsland { get; private set; }
|
||||
|
||||
public List<Static> IslandStatics { get; private set; }
|
||||
|
||||
public Static TeamTotem { get; private set; }
|
||||
|
||||
internal int TotemTime { get; set; } = 0;
|
||||
|
||||
public Point3D HomeLocation { get; private set; }
|
||||
|
||||
public bool IsWinner { get; set; } = false;
|
||||
|
||||
public SurvivalTeam()
|
||||
{
|
||||
TeamPlayers = new List<SurvivalPlayer>();
|
||||
|
||||
IslandStatics = new List<Static>();
|
||||
}
|
||||
|
||||
public void AddPlayer(SurvivalPlayer player)
|
||||
{
|
||||
if (!TeamPlayers.Contains(player))
|
||||
{
|
||||
TeamPlayers.Add(player);
|
||||
|
||||
player.S_Player.AddToBackpack(new SmallBoatDeed());
|
||||
|
||||
player.S_Player.SendMessage(53, "A small boat deed has been added to your pack!");
|
||||
}
|
||||
}
|
||||
|
||||
internal SurvivalPlayer GetPlayerInfo(Mobile player)
|
||||
{
|
||||
return TeamPlayers.Find(sp => sp.S_Player == player);
|
||||
}
|
||||
|
||||
internal bool HasPlayer(Mobile player)
|
||||
{
|
||||
return GetPlayerInfo(player) != null;
|
||||
}
|
||||
|
||||
internal void RemovePlayer(Mobile player)
|
||||
{
|
||||
var info = GetPlayerInfo(player);
|
||||
|
||||
if (info != null)
|
||||
{
|
||||
TeamPlayers.Remove(info);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddIslandLocation(Rectangle2D bounds)
|
||||
{
|
||||
if (TeamIsland == null)
|
||||
{
|
||||
TeamIsland = new BaseIsland(bounds);
|
||||
}
|
||||
}
|
||||
|
||||
public void SpawnIsland(Map map, IslandType biome)
|
||||
{
|
||||
TeamIsland?.SpawnIsland(this, map, biome);
|
||||
}
|
||||
|
||||
public void DespawnIsland()
|
||||
{
|
||||
if (IslandStatics.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < IslandStatics.Count; i++)
|
||||
{
|
||||
IslandStatics[i].Delete();
|
||||
}
|
||||
|
||||
IslandStatics.Clear();
|
||||
}
|
||||
|
||||
if (BaseIsland.HasWeather())
|
||||
{
|
||||
BaseIsland.EndWeather();
|
||||
}
|
||||
}
|
||||
|
||||
public void AddTotem(Static totem)
|
||||
{
|
||||
TeamTotem = totem;
|
||||
}
|
||||
|
||||
public bool IslandHasPlayer(Mobile player)
|
||||
{
|
||||
if (TeamIsland.IslandBounds.Contains(player))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
internal void AddHomeLocation(Point3D location)
|
||||
{
|
||||
HomeLocation = location;
|
||||
}
|
||||
|
||||
internal void MoveToIsland()
|
||||
{
|
||||
if (TeamPlayers.Count > 0)
|
||||
{
|
||||
var count = TeamPlayers.Count;
|
||||
|
||||
var dropOuts = new List<SurvivalPlayer>();
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
if (TeamPlayers[i] is SurvivalPlayer sp)
|
||||
{
|
||||
if (sp.S_Player.HasGump(typeof(SurvivalGump)))
|
||||
{
|
||||
sp.S_Player.CloseGump(typeof(SurvivalGump));
|
||||
}
|
||||
|
||||
if (TeamPlayers.Count > i && sp.S_Player.Map != Map.Internal && sp.S_Player.Alive)
|
||||
{
|
||||
sp.MarkHomeLocation();
|
||||
|
||||
sp.S_Player.MoveToWorld(HomeLocation, TeamTotem.Map);
|
||||
}
|
||||
|
||||
if (!TeamIsland.IslandBounds.Contains(sp.S_Player))
|
||||
{
|
||||
dropOuts.Add(TeamPlayers[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var oldPlayer in dropOuts)
|
||||
{
|
||||
if (TeamPlayers.Contains(oldPlayer))
|
||||
{
|
||||
TeamPlayers.Remove(oldPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal void LateMove(SurvivalPlayer sp)
|
||||
{
|
||||
sp.MarkHomeLocation();
|
||||
|
||||
sp.S_Player.MoveToWorld(HomeLocation, TeamTotem.Map);
|
||||
}
|
||||
|
||||
internal void MoveToHome()
|
||||
{
|
||||
if (TeamPlayers.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < TeamPlayers.Count; i++)
|
||||
{
|
||||
var info = TeamPlayers[i];
|
||||
|
||||
SurvivalCore.RemoveBoat(info.S_Player);
|
||||
|
||||
info.S_Player.MoveToWorld(info.HomeLocation.oldLocation, info.HomeLocation.map);
|
||||
|
||||
if (!info.S_Player.Alive)
|
||||
{
|
||||
info.S_Player.Resurrect();
|
||||
}
|
||||
|
||||
info.S_Player.Heal(100);
|
||||
|
||||
info.S_Player.Frozen = false;
|
||||
|
||||
RewardPlayer(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void RewardPlayer(SurvivalPlayer info)
|
||||
{
|
||||
var total = info.Points;
|
||||
|
||||
total += info.Kills * 2;
|
||||
|
||||
total -= info.Deaths;
|
||||
|
||||
if (IsWinner)
|
||||
{
|
||||
AddWinReward(info, total);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddLoseReward(info, total);
|
||||
}
|
||||
|
||||
TopPlayersBook.ValidateTopPlayer(info);
|
||||
}
|
||||
|
||||
private static void AddWinReward(SurvivalPlayer info, int total)
|
||||
{
|
||||
if (SurvivalSettings.IsGoldPrize)
|
||||
{
|
||||
int amount = total * SurvivalSettings.GoldAmount;
|
||||
|
||||
info.S_Player.AddToBackpack(new Gold(amount));
|
||||
|
||||
info.S_Player.SendMessage(53, $"Thanks for playing, You recieved {amount} Gold!");
|
||||
}
|
||||
|
||||
if (SurvivalSettings.IsItemPrize)
|
||||
{
|
||||
var prize = Activator.CreateInstance(SurvivalSettings.ItemPrize);
|
||||
|
||||
if (prize is Item p)
|
||||
{
|
||||
info.S_Player.AddToBackpack(p);
|
||||
|
||||
info.S_Player.SendMessage(53, $"Thanks for playing, Your reward [{p.Name}]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void AddLoseReward(SurvivalPlayer info, int total)
|
||||
{
|
||||
AddWinReward(info, total);
|
||||
}
|
||||
|
||||
internal void FreezeAllPlayers()
|
||||
{
|
||||
for (int i = 0; i < TeamPlayers.Count; i++)
|
||||
{
|
||||
TeamPlayers[i].S_Player.Frozen = true;
|
||||
}
|
||||
}
|
||||
|
||||
internal void UnFreezeAllPlayers()
|
||||
{
|
||||
for (int i = 0; i < TeamPlayers.Count; i++)
|
||||
{
|
||||
TeamPlayers[i].S_Player.Frozen = false;
|
||||
}
|
||||
}
|
||||
|
||||
internal void PlayEndGameSound()
|
||||
{
|
||||
for (int i = 0; i < TeamPlayers.Count; i++)
|
||||
{
|
||||
TeamPlayers[i].S_Player.PlaySound(0x543);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+378
@@ -0,0 +1,378 @@
|
||||
using System;
|
||||
using Server.Items;
|
||||
using Server.Custom.UOSurvivalEvent.Islands;
|
||||
|
||||
|
||||
namespace Server.Custom.UOSurvivalEvent
|
||||
{
|
||||
internal static class SurvivalUtility
|
||||
{
|
||||
internal static void SpawnGameBoundry()
|
||||
{
|
||||
var bounds = SurvivalCore.GameBounds;
|
||||
|
||||
var height = Map.Felucca.GetAverageZ(bounds.Start.X, bounds.Start.Y);
|
||||
|
||||
for (int x = bounds.Start.X; x <= bounds.End.X; x++)
|
||||
{
|
||||
AddBoundry(Map.Felucca, new Point3D(x, bounds.Start.Y, height));
|
||||
|
||||
AddBoundry(Map.Felucca, new Point3D(x, bounds.End.Y, height));
|
||||
}
|
||||
|
||||
for (int y = bounds.Start.Y; y <= bounds.End.Y; y++)
|
||||
{
|
||||
AddBoundry(Map.Felucca, new Point3D(bounds.Start.X, y, height));
|
||||
|
||||
AddBoundry(Map.Felucca, new Point3D(bounds.End.X, y, height));
|
||||
}
|
||||
}
|
||||
|
||||
private static void AddBoundry(Map map, Point3D location)
|
||||
{
|
||||
Static boundry = new Static(Utility.RandomList(0x45B4, 0x45B5));
|
||||
|
||||
boundry.MoveToWorld(location, map);
|
||||
|
||||
SurvivalCore.BoundryList.Add(boundry);
|
||||
}
|
||||
|
||||
public static void AddIsland(SurvivalTeam team, Map map, int height)
|
||||
{
|
||||
var bounds = team.TeamIsland.IslandBounds;
|
||||
|
||||
var center = new Point2D(bounds.X + bounds.Width / 2, bounds.Y + bounds.Height / 2);
|
||||
|
||||
PlaceXPedestals(team, map, bounds.Start.X, bounds.End.X, bounds.Start.Y, height);
|
||||
|
||||
PlaceYPedestals(team, map, bounds.Start.Y, bounds.End.Y, bounds.Start.X, height);
|
||||
|
||||
PlaceXPedestals(team, map, bounds.Start.X, bounds.End.X, bounds.End.Y - 1, height);
|
||||
|
||||
PlaceYPedestals(team, map, bounds.Start.Y, bounds.End.Y, bounds.End.X - 1, height);
|
||||
|
||||
for (int x = bounds.Start.X + 1; x < bounds.End.X - 1; x++)
|
||||
{
|
||||
for (int y = bounds.Start.Y + 1; y < bounds.End.Y - 1; y++)
|
||||
{
|
||||
AddSurface(team, map, new Point3D(x, y, height + 6));
|
||||
|
||||
if (team.TeamIsland.IslandEntity.Name == nameof(DefaultIsland))
|
||||
{
|
||||
AddMask(team, map, new Point3D(x, y, height + 7));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (team.TeamIsland.IslandEntity.Name == nameof(BloodIsland))
|
||||
{
|
||||
AddBlood(team, map, new Point3D(x, y, height + 7));
|
||||
|
||||
if (center != new Point2D(x, y))
|
||||
{
|
||||
AddSurfaceDecor(team, map, new Point3D(x, y, height + 8));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (center != new Point2D(x, y))
|
||||
{
|
||||
AddSurfaceDecor(team, map, new Point3D(x, y, height + 7));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SetTeamTotem(team, map, new Point3D(center.X, center.Y, height + 8));
|
||||
}
|
||||
|
||||
private static void PlaceXPedestals(SurvivalTeam team, Map map, int startX, int endX, int y, int height)
|
||||
{
|
||||
for (int x = startX; x < endX; x++)
|
||||
{
|
||||
AddPedestal(team, map, new Point3D(x, y, height));
|
||||
}
|
||||
}
|
||||
|
||||
private static void PlaceYPedestals(SurvivalTeam team, Map map, int startY, int endY, int x, int height)
|
||||
{
|
||||
for (int y = startY; y < endY; y++)
|
||||
{
|
||||
AddPedestal(team, map, new Point3D(x, y, height));
|
||||
}
|
||||
}
|
||||
|
||||
private static void AddPedestal(SurvivalTeam team, Map map, Point3D location, bool pedOnly = false)
|
||||
{
|
||||
if (!pedOnly)
|
||||
{
|
||||
Static surface = new Static(0x40A3);
|
||||
|
||||
if (Utility.RandomDouble() < 0.5)
|
||||
{
|
||||
Static boulder = new Static(Utility.RandomList(0x9CAA, 0x9CAB, 0x9CAC))
|
||||
{
|
||||
Movable = false
|
||||
};
|
||||
|
||||
boulder.MoveToWorld(new Point3D(location.X, location.Y, location.Z + 7), map);
|
||||
|
||||
team.IslandStatics.Add(boulder);
|
||||
}
|
||||
else
|
||||
{
|
||||
Static surfaceTop = new Static(Utility.RandomList(0x40A3, 0x40A4, 0x40A5, 0x40A6, 0x40A7, 0x40A8, 0x40A9, 0x40AA, 0x40AB, 0x40AC, 0x40AD, 0x40AE, 0x40AF))
|
||||
{
|
||||
Movable = false
|
||||
};
|
||||
|
||||
surfaceTop.MoveToWorld(new Point3D(location.X, location.Y, location.Z + 7), map);
|
||||
|
||||
team.IslandStatics.Add(surfaceTop);
|
||||
}
|
||||
|
||||
surface.Movable = false;
|
||||
|
||||
surface.MoveToWorld(new Point3D(location.X, location.Y, location.Z + 6), map);
|
||||
|
||||
team.IslandStatics.Add(surface);
|
||||
|
||||
}
|
||||
|
||||
Static pedestal = pedOnly ? new Static(0x0720) : new Static(0x32F2);
|
||||
|
||||
pedestal.MoveToWorld(location, map);
|
||||
|
||||
team.IslandStatics.Add(pedestal);
|
||||
}
|
||||
|
||||
private static void AddSurface(SurvivalTeam team, Map map, Point3D location)
|
||||
{
|
||||
var (ID, Hue) = team.TeamIsland.IslandEntity.GetRandomLandTile();
|
||||
|
||||
Static surface = new Static(ID)
|
||||
{
|
||||
Hue = Hue,
|
||||
Movable = false
|
||||
};
|
||||
|
||||
surface.MoveToWorld(location, map);
|
||||
|
||||
team.IslandStatics.Add(surface);
|
||||
}
|
||||
|
||||
private static void AddMask(SurvivalTeam team, Map map, Point3D location)
|
||||
{
|
||||
Static mask = new Static(Utility.RandomList(0x050D, 0x050E, 0x050F, 0x0510, 0x0511, 0x0512, 0x0513, 0x0514))
|
||||
{
|
||||
Movable = false
|
||||
};
|
||||
|
||||
mask.MoveToWorld(location, map);
|
||||
|
||||
team.IslandStatics.Add(mask);
|
||||
}
|
||||
|
||||
private static void AddBlood(SurvivalTeam team, Map map, Point3D location)
|
||||
{
|
||||
Static blood = new Static(Utility.RandomList(0x1CD9, 0x1CDA, 0x1CDB, 0x1CDC))
|
||||
{
|
||||
Movable = false
|
||||
};
|
||||
|
||||
blood.MoveToWorld(location, map);
|
||||
|
||||
team.IslandStatics.Add(blood);
|
||||
}
|
||||
|
||||
private static void AddSurfaceDecor(SurvivalTeam team, Map map, Point3D location)
|
||||
{
|
||||
if (Utility.RandomDouble() < 0.25)
|
||||
{
|
||||
Static decor = new Static(team.TeamIsland.IslandEntity.GetRandomDecorTile())
|
||||
{
|
||||
Movable = false
|
||||
};
|
||||
|
||||
decor.MoveToWorld(location, map);
|
||||
|
||||
team.IslandStatics.Add(decor);
|
||||
}
|
||||
}
|
||||
|
||||
private static void SetTeamTotem(SurvivalTeam team, Map map, Point3D location)
|
||||
{
|
||||
Static totem;
|
||||
|
||||
if (team == SurvivalCore.TeamOne)
|
||||
{
|
||||
totem = new Static(0x9F41);
|
||||
}
|
||||
else
|
||||
{
|
||||
totem = new Static(0x9F5E);
|
||||
}
|
||||
|
||||
totem.Movable = false;
|
||||
|
||||
totem.MoveToWorld(location, map);
|
||||
|
||||
team.AddTotem(totem);
|
||||
|
||||
PlayTotemEffect(map, location, team == SurvivalCore.TeamOne);
|
||||
|
||||
team.AddHomeLocation(new Point3D(location.X + 1, location.Y + 1, location.Z - 2));
|
||||
}
|
||||
|
||||
internal static void TryResPlayer(Mobile m, SurvivalTeam team)
|
||||
{
|
||||
if (!m.Alive)
|
||||
{
|
||||
if (!team.IslandHasPlayer(m))
|
||||
{
|
||||
ReturnHome(m, team);
|
||||
}
|
||||
|
||||
m.Resurrect();
|
||||
|
||||
if (Utility.RandomDouble() < 0.5)
|
||||
{
|
||||
SurvivalCore.SendTotemMsg(team, $"{m.Name}, Get back out there and fight!");
|
||||
}
|
||||
else
|
||||
{
|
||||
SurvivalCore.SendTotemMsg(team, $"{m.Name}, Your alive, for now, see you soon!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal static void ReturnHome(Mobile m, SurvivalTeam team)
|
||||
{
|
||||
PlayTeleportEffect(team.TeamTotem.Map, team.TeamTotem.Location);
|
||||
|
||||
m.MoveToWorld(team.HomeLocation, m.Map);
|
||||
|
||||
m.AddToBackpack(new RecallScroll());
|
||||
|
||||
m.SendMessage(53, "A recall scroll magically appeared in your pack!");
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromMilliseconds(500), () =>
|
||||
{
|
||||
if (m.Z < team.HomeLocation.Z)
|
||||
{
|
||||
m.Z = team.HomeLocation.Z;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void PlayTotemEffect(Map map, Point3D location, bool teamOne)
|
||||
{
|
||||
if (teamOne)
|
||||
{
|
||||
Effects.SendLocationEffect(location, map, 0x9F42, 9);
|
||||
|
||||
Effects.PlaySound(location, map, 0x23B);
|
||||
}
|
||||
else
|
||||
{
|
||||
Effects.SendLocationEffect(location, map, 0x9F5F, 9);
|
||||
|
||||
Effects.PlaySound(location, map, 0x23C);
|
||||
}
|
||||
}
|
||||
|
||||
public static void PlayHealEffect(Map map, Point3D location)
|
||||
{
|
||||
Effects.SendLocationEffect(location, map, 0x3789, 15);
|
||||
|
||||
Effects.PlaySound(location, map, 0x1F2);
|
||||
}
|
||||
|
||||
public static void PlayDamageEffect(Map map, Point3D location)
|
||||
{
|
||||
Effects.SendLocationEffect(location, map, Utility.RandomList(0x42CF, 0x374A), 15);
|
||||
|
||||
Effects.PlaySound(location, map, 0x1F8);
|
||||
}
|
||||
|
||||
internal static void PlayFireEffect(Map map, Point3D location)
|
||||
{
|
||||
Effects.SendLocationEffect(location, map, Utility.RandomList(0x36B0, 0x36BD), 13);
|
||||
|
||||
Effects.PlaySound(location, map, Utility.RandomList(0x11B, 0x11C, 0x11D, 0x11E));
|
||||
}
|
||||
|
||||
internal static void PlayColdEffect(Map map, Point3D location)
|
||||
{
|
||||
Effects.SendLocationEffect(location, map, 0x3789, 20);
|
||||
|
||||
Effects.PlaySound(location, map, Utility.RandomList(0xFA, 0xFC));
|
||||
}
|
||||
|
||||
public static void PlayPoisonEffect(Mobile m, Map map, Point3D location)
|
||||
{
|
||||
m.FixedParticles(0x374A, 10, 15, 5021, EffectLayer.Waist);
|
||||
|
||||
Effects.PlaySound(location, map, 0x205);
|
||||
}
|
||||
|
||||
internal static void PlayWindEffect(Map map, Point3D location)
|
||||
{
|
||||
Effects.SendLocationEffect(location, map, 0x37CC, 25, 2, 0x4001, 0);
|
||||
|
||||
Effects.PlaySound(location, map, Utility.RandomList(0x14, 0x15, 0x16));
|
||||
}
|
||||
|
||||
public static void PlayTeleportEffect(Map map, Point3D location)
|
||||
{
|
||||
Effects.SendLocationEffect(location, map, 0x9F89, 15);
|
||||
|
||||
Effects.PlaySound(location, map, Utility.RandomList(0x3E, 0x3F));
|
||||
}
|
||||
|
||||
internal static void PlayBloodEffect(Map map, Point3D location)
|
||||
{
|
||||
Effects.SendLocationEffect(location, map, Utility.RandomList(0x37B9, 0x37BE, 0x37C4), 15);
|
||||
|
||||
Effects.PlaySound(location, map, Utility.RandomList(0x5DC, 0x5DD));
|
||||
}
|
||||
|
||||
public static void PlayMushroomEffect(Static mushroom, Map map, Point3D location)
|
||||
{
|
||||
mushroom.ItemID = 0x1126;
|
||||
|
||||
Effects.PlaySound(location, map, 0x306);
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(2), () => { OnMushroomReset(mushroom); });
|
||||
}
|
||||
|
||||
private static void OnMushroomReset(Static mushroom)
|
||||
{
|
||||
mushroom.ItemID = 0x1125;
|
||||
}
|
||||
|
||||
internal static DefaultIsland GetIslandEntity(IslandType biome)
|
||||
{
|
||||
switch (biome)
|
||||
{
|
||||
case IslandType.Grass: return new GrassIsland();
|
||||
case IslandType.Forest: return new ForestIsland();
|
||||
case IslandType.Desert: return new DesertIsland();
|
||||
case IslandType.Snow: return new SnowIsland();
|
||||
case IslandType.Swamp: return new SwampIsland();
|
||||
case IslandType.Fire: return new FireIsland();
|
||||
case IslandType.Blood: return new BloodIsland();
|
||||
}
|
||||
|
||||
return new DefaultIsland();
|
||||
}
|
||||
|
||||
internal static void UpdateWeather(bool isHot)
|
||||
{
|
||||
if (!BaseIsland.HasWeather())
|
||||
{
|
||||
BaseIsland.SetWeather(isHot);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user