fix: Codegens mahjong (#1070)
This commit is contained in:
parent
800f864335
commit
6edccfe2aa
15 changed files with 1272 additions and 1122 deletions
|
|
@ -1,45 +1,41 @@
|
||||||
namespace Server.Engines.Mahjong
|
using ModernUO.Serialization;
|
||||||
|
|
||||||
|
namespace Server.Engines.Mahjong;
|
||||||
|
|
||||||
|
[SerializationGenerator(1, false)]
|
||||||
|
public partial class MahjongDealerIndicator
|
||||||
{
|
{
|
||||||
public class MahjongDealerIndicator
|
[DirtyTrackingEntity]
|
||||||
|
private readonly MahjongGame _game;
|
||||||
|
|
||||||
|
[SerializableField(0, setter: "private")]
|
||||||
|
private Point2D _position;
|
||||||
|
|
||||||
|
[SerializableField(1, setter: "private")]
|
||||||
|
private MahjongPieceDirection _direction;
|
||||||
|
|
||||||
|
[SerializableField(2, setter: "private")]
|
||||||
|
private MahjongWind _wind;
|
||||||
|
|
||||||
|
public MahjongDealerIndicator(MahjongGame game)
|
||||||
{
|
{
|
||||||
|
_game = game;
|
||||||
|
}
|
||||||
|
|
||||||
public MahjongDealerIndicator(MahjongGame game, Point2D position, MahjongPieceDirection direction, MahjongWind wind)
|
public MahjongDealerIndicator(MahjongGame game, Point2D position, MahjongPieceDirection direction, MahjongWind wind)
|
||||||
{
|
{
|
||||||
Game = game;
|
_game = game;
|
||||||
Position = position;
|
_position = position;
|
||||||
Direction = direction;
|
_direction = direction;
|
||||||
Wind = wind;
|
_wind = wind;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MahjongDealerIndicator(MahjongGame game, IGenericReader reader)
|
public MahjongPieceDim Dimensions => GetDimensions(_position, _direction);
|
||||||
{
|
|
||||||
Game = game;
|
|
||||||
|
|
||||||
var version = reader.ReadInt();
|
public static MahjongPieceDim GetDimensions(Point2D position, MahjongPieceDirection direction) =>
|
||||||
|
direction is MahjongPieceDirection.Up or MahjongPieceDirection.Down
|
||||||
Position = reader.ReadPoint2D();
|
? new MahjongPieceDim(position, 40, 20)
|
||||||
Direction = (MahjongPieceDirection)reader.ReadInt();
|
: new MahjongPieceDim(position, 20, 40);
|
||||||
Wind = (MahjongWind)reader.ReadInt();
|
|
||||||
}
|
|
||||||
|
|
||||||
public MahjongGame Game { get; }
|
|
||||||
|
|
||||||
public Point2D Position { get; private set; }
|
|
||||||
|
|
||||||
public MahjongPieceDirection Direction { get; private set; }
|
|
||||||
|
|
||||||
public MahjongWind Wind { get; private set; }
|
|
||||||
|
|
||||||
public MahjongPieceDim Dimensions => GetDimensions(Position, Direction);
|
|
||||||
|
|
||||||
public static MahjongPieceDim GetDimensions(Point2D position, MahjongPieceDirection direction)
|
|
||||||
{
|
|
||||||
if (direction is MahjongPieceDirection.Up or MahjongPieceDirection.Down)
|
|
||||||
{
|
|
||||||
return new MahjongPieceDim(position, 40, 20);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new MahjongPieceDim(position, 20, 40);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Move(Point2D position, MahjongPieceDirection direction, MahjongWind wind)
|
public void Move(Point2D position, MahjongPieceDirection direction, MahjongWind wind)
|
||||||
{
|
{
|
||||||
|
|
@ -50,20 +46,17 @@ namespace Server.Engines.Mahjong
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Position = position;
|
_position = position;
|
||||||
Direction = direction;
|
_direction = direction;
|
||||||
Wind = wind;
|
_wind = wind;
|
||||||
|
|
||||||
Game.Players.SendGeneralPacket(true, true);
|
_game.Players.SendGeneralPacket(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Save(IGenericWriter writer)
|
private void Deserialize(IGenericReader reader, int version)
|
||||||
{
|
{
|
||||||
writer.Write(0); // version
|
_position = reader.ReadPoint2D();
|
||||||
|
_direction = (MahjongPieceDirection)reader.ReadInt();
|
||||||
writer.Write(Position);
|
_wind = (MahjongWind)reader.ReadInt();
|
||||||
writer.Write((int)Direction);
|
|
||||||
writer.Write((int)Wind);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,52 +1,37 @@
|
||||||
namespace Server.Engines.Mahjong
|
using ModernUO.Serialization;
|
||||||
{
|
|
||||||
public class MahjongDices
|
namespace Server.Engines.Mahjong;
|
||||||
|
|
||||||
|
[SerializationGenerator(0, false)]
|
||||||
|
public partial class MahjongDices
|
||||||
{
|
{
|
||||||
|
[DirtyTrackingEntity]
|
||||||
|
private readonly MahjongGame _game;
|
||||||
|
|
||||||
|
[SerializableField(0, setter: "private")]
|
||||||
|
private int _first;
|
||||||
|
|
||||||
|
[SerializableField(1, setter: "private")]
|
||||||
|
private int _second;
|
||||||
|
|
||||||
public MahjongDices(MahjongGame game)
|
public MahjongDices(MahjongGame game)
|
||||||
{
|
{
|
||||||
Game = game;
|
_game = game;
|
||||||
First = Utility.Random(1, 6);
|
_first = Utility.Random(1, 6);
|
||||||
Second = Utility.Random(1, 6);
|
_second = Utility.Random(1, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MahjongDices(MahjongGame game, IGenericReader reader)
|
|
||||||
{
|
|
||||||
Game = game;
|
|
||||||
|
|
||||||
var version = reader.ReadInt();
|
|
||||||
|
|
||||||
First = reader.ReadInt();
|
|
||||||
Second = reader.ReadInt();
|
|
||||||
}
|
|
||||||
|
|
||||||
public MahjongGame Game { get; }
|
|
||||||
|
|
||||||
public int First { get; private set; }
|
|
||||||
|
|
||||||
public int Second { get; private set; }
|
|
||||||
|
|
||||||
public void RollDices(Mobile from)
|
public void RollDices(Mobile from)
|
||||||
{
|
{
|
||||||
First = Utility.Random(1, 6);
|
_first = Utility.Random(1, 6);
|
||||||
Second = Utility.Random(1, 6);
|
_second = Utility.Random(1, 6);
|
||||||
|
|
||||||
Game.Players.SendGeneralPacket(true, true);
|
_game.Players.SendGeneralPacket(true, true);
|
||||||
|
|
||||||
if (from != null)
|
if (from != null)
|
||||||
{
|
{
|
||||||
Game.Players.SendLocalizedMessage(
|
// ~1_name~ rolls the dice and gets a ~2_number~ and a ~3_number~!
|
||||||
1062695,
|
_game.Players.SendLocalizedMessage(1062695, $"{from.Name}\t{_first}\t{_second}");
|
||||||
$"{from.Name}\t{First}\t{Second}"
|
|
||||||
); // ~1_name~ rolls the dice and gets a ~2_number~ and a ~3_number~!
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Save(IGenericWriter writer)
|
|
||||||
{
|
|
||||||
writer.Write(0); // version
|
|
||||||
|
|
||||||
writer.Write(First);
|
|
||||||
writer.Write(Second);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
namespace Server.Engines.Mahjong
|
namespace Server.Engines.Mahjong;
|
||||||
{
|
|
||||||
public enum MahjongPieceDirection
|
public enum MahjongPieceDirection
|
||||||
{
|
{
|
||||||
Up,
|
Up,
|
||||||
|
|
@ -53,4 +53,3 @@ namespace Server.Engines.Mahjong
|
||||||
Red,
|
Red,
|
||||||
White
|
White
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,44 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using ModernUO.Serialization;
|
||||||
using Server.ContextMenus;
|
using Server.ContextMenus;
|
||||||
using Server.Gumps;
|
using Server.Gumps;
|
||||||
using Server.Multis;
|
using Server.Multis;
|
||||||
|
|
||||||
namespace Server.Engines.Mahjong
|
namespace Server.Engines.Mahjong;
|
||||||
{
|
|
||||||
public class MahjongGame : Item, ISecurable
|
[SerializationGenerator(1, false)]
|
||||||
|
public partial class MahjongGame : Item, ISecurable
|
||||||
{
|
{
|
||||||
public const int MaxPlayers = 4;
|
public const int MaxPlayers = 4;
|
||||||
public const int BaseScore = 30000;
|
public const int BaseScore = 30000;
|
||||||
private DateTime m_LastReset;
|
|
||||||
|
|
||||||
private bool m_ShowScores;
|
[SerializableField(0)]
|
||||||
private bool m_SpectatorVision;
|
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
|
||||||
|
private SecureLevel _level;
|
||||||
|
|
||||||
|
[SerializableField(1, setter: "private")]
|
||||||
|
private MahjongTile[] _tiles;
|
||||||
|
|
||||||
|
[SerializableField(2, setter: "private")]
|
||||||
|
private MahjongDealerIndicator _dealerIndicator;
|
||||||
|
|
||||||
|
[SerializableField(3, setter: "private")]
|
||||||
|
private MahjongWallBreakIndicator _wallBreakIndicator;
|
||||||
|
|
||||||
|
[SerializableField(4, setter: "private")]
|
||||||
|
private MahjongDices _dices;
|
||||||
|
|
||||||
|
[SerializableField(5, setter: "private")]
|
||||||
|
private MahjongPlayers _players;
|
||||||
|
|
||||||
|
// Field 6
|
||||||
|
private bool _showScores;
|
||||||
|
|
||||||
|
// Field 7
|
||||||
|
private bool _spectatorVision;
|
||||||
|
|
||||||
|
private DateTime _lastReset;
|
||||||
|
|
||||||
[Constructible]
|
[Constructible]
|
||||||
public MahjongGame() : base(0xFAA)
|
public MahjongGame() : base(0xFAA)
|
||||||
|
|
@ -21,82 +46,66 @@ namespace Server.Engines.Mahjong
|
||||||
Weight = 5.0;
|
Weight = 5.0;
|
||||||
|
|
||||||
BuildWalls();
|
BuildWalls();
|
||||||
DealerIndicator =
|
_dealerIndicator =
|
||||||
new MahjongDealerIndicator(this, new Point2D(300, 300), MahjongPieceDirection.Up, MahjongWind.North);
|
new MahjongDealerIndicator(this, new Point2D(300, 300), MahjongPieceDirection.Up, MahjongWind.North);
|
||||||
WallBreakIndicator = new MahjongWallBreakIndicator(this, new Point2D(335, 335));
|
_wallBreakIndicator = new MahjongWallBreakIndicator(this, new Point2D(335, 335));
|
||||||
Dices = new MahjongDices(this);
|
_dices = new MahjongDices(this);
|
||||||
Players = new MahjongPlayers(this, MaxPlayers, BaseScore);
|
_players = new MahjongPlayers(this, MaxPlayers, BaseScore);
|
||||||
m_LastReset = Core.Now;
|
_lastReset = Core.Now;
|
||||||
Level = SecureLevel.CoOwners;
|
_level = SecureLevel.CoOwners;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MahjongGame(Serial serial) : base(serial)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public MahjongTile[] Tiles { get; private set; }
|
|
||||||
|
|
||||||
public MahjongDealerIndicator DealerIndicator { get; private set; }
|
|
||||||
|
|
||||||
public MahjongWallBreakIndicator WallBreakIndicator { get; private set; }
|
|
||||||
|
|
||||||
public MahjongDices Dices { get; private set; }
|
|
||||||
|
|
||||||
public MahjongPlayers Players { get; private set; }
|
|
||||||
|
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[CommandProperty(AccessLevel.GameMaster)]
|
||||||
|
[SerializableField(6)]
|
||||||
public bool ShowScores
|
public bool ShowScores
|
||||||
{
|
{
|
||||||
get => m_ShowScores;
|
get => _showScores;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (m_ShowScores == value)
|
if (_showScores == value)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ShowScores = value;
|
_showScores = value;
|
||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
{
|
{
|
||||||
Players.SendPlayersPacket(true, true);
|
_players.SendPlayersPacket(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Players.SendGeneralPacket(true, true);
|
_players.SendGeneralPacket(true, true);
|
||||||
|
_players.SendLocalizedMessage(value ? 1062777 : 1062778); // The dealer has enabled/disabled score display.
|
||||||
Players.SendLocalizedMessage(value ? 1062777 : 1062778); // The dealer has enabled/disabled score display.
|
this.MarkDirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[CommandProperty(AccessLevel.GameMaster)]
|
||||||
|
[SerializableField(7)]
|
||||||
public bool SpectatorVision
|
public bool SpectatorVision
|
||||||
{
|
{
|
||||||
get => m_SpectatorVision;
|
get => _spectatorVision;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (m_SpectatorVision == value)
|
if (_spectatorVision == value)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_SpectatorVision = value;
|
_spectatorVision = value;
|
||||||
|
|
||||||
if (Players.IsInGamePlayer(Players.DealerPosition))
|
if (_players.IsInGamePlayer(_players.DealerPosition))
|
||||||
{
|
{
|
||||||
Players.Dealer.NetState.SendMahjongGeneralInfo(this);
|
_players.Dealer.NetState.SendMahjongGeneralInfo(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Players.SendTilesPacket(false, true);
|
_players.SendTilesPacket(false, true);
|
||||||
|
_players.SendLocalizedMessage(value ? 1062715 : 1062716); // The dealer has enabled/disabled Spectator Vision.
|
||||||
Players.SendLocalizedMessage(value ? 1062715 : 1062716); // The dealer has enabled/disabled Spectator Vision.
|
|
||||||
|
|
||||||
InvalidateProperties();
|
InvalidateProperties();
|
||||||
|
this.MarkDirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
|
||||||
public SecureLevel Level { get; set; }
|
|
||||||
|
|
||||||
private void BuildHorizontalWall(
|
private void BuildHorizontalWall(
|
||||||
ref int index, int x, int y, int stackLevel, MahjongPieceDirection direction,
|
ref int index, int x, int y, int stackLevel, MahjongPieceDirection direction,
|
||||||
MahjongTileTypeGenerator typeGenerator
|
MahjongTileTypeGenerator typeGenerator
|
||||||
|
|
@ -117,6 +126,7 @@ namespace Server.Engines.Mahjong
|
||||||
}
|
}
|
||||||
|
|
||||||
index += 17;
|
index += 17;
|
||||||
|
this.MarkDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BuildVerticalWall(
|
private void BuildVerticalWall(
|
||||||
|
|
@ -139,6 +149,7 @@ namespace Server.Engines.Mahjong
|
||||||
}
|
}
|
||||||
|
|
||||||
index += 17;
|
index += 17;
|
||||||
|
this.MarkDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BuildWalls()
|
private void BuildWalls()
|
||||||
|
|
@ -166,7 +177,7 @@ namespace Server.Engines.Mahjong
|
||||||
{
|
{
|
||||||
base.GetProperties(list);
|
base.GetProperties(list);
|
||||||
|
|
||||||
if (m_SpectatorVision)
|
if (_spectatorVision)
|
||||||
{
|
{
|
||||||
list.Add(1062717); // Spectator Vision Enabled
|
list.Add(1062717); // Spectator Vision Enabled
|
||||||
}
|
}
|
||||||
|
|
@ -180,9 +191,9 @@ namespace Server.Engines.Mahjong
|
||||||
{
|
{
|
||||||
base.GetContextMenuEntries(from, list);
|
base.GetContextMenuEntries(from, list);
|
||||||
|
|
||||||
Players.CheckPlayers();
|
_players.CheckPlayers();
|
||||||
|
|
||||||
if (from.Alive && IsAccessibleTo(from) && Players.GetInGameMobiles(true, false).Count == 0)
|
if (from.Alive && IsAccessibleTo(from) && _players.GetInGameMobiles(true, false).Count == 0)
|
||||||
{
|
{
|
||||||
list.Add(new ResetGameEntry(this));
|
list.Add(new ResetGameEntry(this));
|
||||||
}
|
}
|
||||||
|
|
@ -192,26 +203,25 @@ namespace Server.Engines.Mahjong
|
||||||
|
|
||||||
public override void OnDoubleClick(Mobile from)
|
public override void OnDoubleClick(Mobile from)
|
||||||
{
|
{
|
||||||
Players.CheckPlayers();
|
_players.CheckPlayers();
|
||||||
|
_players.Join(from);
|
||||||
Players.Join(from);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResetGame(Mobile from)
|
public void ResetGame(Mobile from)
|
||||||
{
|
{
|
||||||
if (Core.Now - m_LastReset < TimeSpan.FromSeconds(5.0))
|
if (Core.Now - _lastReset < TimeSpan.FromSeconds(5.0))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_LastReset = Core.Now;
|
_lastReset = Core.Now;
|
||||||
|
|
||||||
if (from != null)
|
if (from != null)
|
||||||
{
|
{
|
||||||
Players.SendLocalizedMessage(1062771, from.Name); // ~1_name~ has reset the game.
|
_players.SendLocalizedMessage(1062771, from.Name); // ~1_name~ has reset the game.
|
||||||
}
|
}
|
||||||
|
|
||||||
Players.SendRelievePacket(true, true);
|
_players.SendRelievePacket(true, true);
|
||||||
|
|
||||||
BuildWalls();
|
BuildWalls();
|
||||||
DealerIndicator =
|
DealerIndicator =
|
||||||
|
|
@ -222,27 +232,27 @@ namespace Server.Engines.Mahjong
|
||||||
|
|
||||||
public void ResetWalls(Mobile from)
|
public void ResetWalls(Mobile from)
|
||||||
{
|
{
|
||||||
if (Core.Now - m_LastReset < TimeSpan.FromSeconds(5.0))
|
if (Core.Now - _lastReset < TimeSpan.FromSeconds(5.0))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_LastReset = Core.Now;
|
_lastReset = Core.Now;
|
||||||
|
|
||||||
BuildWalls();
|
BuildWalls();
|
||||||
|
|
||||||
Players.SendTilesPacket(true, true);
|
_players.SendTilesPacket(true, true);
|
||||||
|
|
||||||
if (from != null)
|
if (from != null)
|
||||||
{
|
{
|
||||||
Players.SendLocalizedMessage(1062696); // The dealer rebuilds the wall.
|
_players.SendLocalizedMessage(1062696); // The dealer rebuilds the wall.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetStackLevel(MahjongPieceDim dim)
|
public int GetStackLevel(MahjongPieceDim dim)
|
||||||
{
|
{
|
||||||
var level = -1;
|
var level = -1;
|
||||||
foreach (var tile in Tiles)
|
foreach (var tile in _tiles)
|
||||||
{
|
{
|
||||||
if (tile.StackLevel > level && dim.IsOverlapping(tile.Dimensions))
|
if (tile.StackLevel > level && dim.IsOverlapping(tile.Dimensions))
|
||||||
{
|
{
|
||||||
|
|
@ -253,95 +263,54 @@ namespace Server.Engines.Mahjong
|
||||||
return level;
|
return level;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Serialize(IGenericWriter writer)
|
private void Deserialize(IGenericReader reader, int number)
|
||||||
{
|
{
|
||||||
base.Serialize(writer);
|
_level = (SecureLevel)reader.ReadInt();
|
||||||
|
|
||||||
writer.Write(1); // version
|
|
||||||
|
|
||||||
writer.Write((int)Level);
|
|
||||||
|
|
||||||
writer.Write(Tiles.Length);
|
|
||||||
|
|
||||||
for (var i = 0; i < Tiles.Length; i++)
|
|
||||||
{
|
|
||||||
Tiles[i].Save(writer);
|
|
||||||
}
|
|
||||||
|
|
||||||
DealerIndicator.Save(writer);
|
|
||||||
|
|
||||||
WallBreakIndicator.Save(writer);
|
|
||||||
|
|
||||||
Dices.Save(writer);
|
|
||||||
|
|
||||||
Players.Save(writer);
|
|
||||||
|
|
||||||
writer.Write(m_ShowScores);
|
|
||||||
writer.Write(m_SpectatorVision);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Deserialize(IGenericReader reader)
|
|
||||||
{
|
|
||||||
base.Deserialize(reader);
|
|
||||||
|
|
||||||
var version = reader.ReadInt();
|
|
||||||
|
|
||||||
switch (version)
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
Level = (SecureLevel)reader.ReadInt();
|
|
||||||
|
|
||||||
goto case 0;
|
|
||||||
}
|
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
if (version < 1)
|
|
||||||
{
|
|
||||||
Level = SecureLevel.CoOwners;
|
|
||||||
}
|
|
||||||
|
|
||||||
var length = reader.ReadInt();
|
var length = reader.ReadInt();
|
||||||
Tiles = new MahjongTile[length];
|
_tiles = new MahjongTile[length];
|
||||||
|
|
||||||
for (var i = 0; i < length; i++)
|
for (var i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
Tiles[i] = new MahjongTile(this, reader);
|
var tile = _tiles[i] = new MahjongTile(this);
|
||||||
|
tile.Deserialize(reader);
|
||||||
}
|
}
|
||||||
|
|
||||||
DealerIndicator = new MahjongDealerIndicator(this, reader);
|
_dealerIndicator = new MahjongDealerIndicator(this);
|
||||||
|
_dealerIndicator.Deserialize(reader);
|
||||||
|
|
||||||
WallBreakIndicator = new MahjongWallBreakIndicator(this, reader);
|
_wallBreakIndicator = new MahjongWallBreakIndicator(this);
|
||||||
|
_wallBreakIndicator.Deserialize(reader);
|
||||||
|
|
||||||
Dices = new MahjongDices(this, reader);
|
_dices = new MahjongDices(this);
|
||||||
|
_dices.Deserialize(reader);
|
||||||
|
|
||||||
Players = new MahjongPlayers(this, reader);
|
_players = new MahjongPlayers(this);
|
||||||
|
_players.Deserialize(reader);
|
||||||
|
|
||||||
m_ShowScores = reader.ReadBool();
|
_showScores = reader.ReadBool();
|
||||||
m_SpectatorVision = reader.ReadBool();
|
_spectatorVision = reader.ReadBool();
|
||||||
|
|
||||||
m_LastReset = Core.Now;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[AfterDeserialization]
|
||||||
|
private void AfterDeserialization()
|
||||||
|
{
|
||||||
|
_lastReset = Core.Now;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ResetGameEntry : ContextMenuEntry
|
private class ResetGameEntry : ContextMenuEntry
|
||||||
{
|
{
|
||||||
private readonly MahjongGame m_Game;
|
private readonly MahjongGame _game;
|
||||||
|
|
||||||
public ResetGameEntry(MahjongGame game) : base(6162) => m_Game = game;
|
public ResetGameEntry(MahjongGame game) : base(6162) => _game = game;
|
||||||
|
|
||||||
public override void OnClick()
|
public override void OnClick()
|
||||||
{
|
{
|
||||||
var from = Owner.From;
|
var from = Owner.From;
|
||||||
|
|
||||||
if (from.CheckAlive() && !m_Game.Deleted && m_Game.IsAccessibleTo(from) &&
|
if (from.CheckAlive() && !_game.Deleted && _game.IsAccessibleTo(from) &&
|
||||||
m_Game.Players.GetInGameMobiles(true, false).Count == 0)
|
_game.Players.GetInGameMobiles(true, false).Count == 0)
|
||||||
{
|
{
|
||||||
m_Game.ResetGame(from);
|
_game.ResetGame(from);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
namespace Server.Engines.Mahjong
|
namespace Server.Engines.Mahjong;
|
||||||
{
|
|
||||||
public struct MahjongPieceDim
|
public struct MahjongPieceDim
|
||||||
{
|
{
|
||||||
public Point2D Position { get; }
|
public Point2D Position { get; }
|
||||||
|
|
@ -47,4 +47,3 @@ namespace Server.Engines.Mahjong
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,77 +1,91 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using ModernUO.Serialization;
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.Engines.Mahjong
|
namespace Server.Engines.Mahjong;
|
||||||
|
|
||||||
|
[SerializationGenerator(1, false)]
|
||||||
|
public partial class MahjongPlayers
|
||||||
{
|
{
|
||||||
public class MahjongPlayers
|
[SerializableField(0, setter: "private")]
|
||||||
{
|
private Mobile[] _players;
|
||||||
private readonly bool[] m_InGame;
|
|
||||||
private readonly Mobile[] m_Players;
|
[SerializableField(1, setter: "private")]
|
||||||
private readonly bool[] m_PublicHand;
|
private bool[] _inGame;
|
||||||
private readonly int[] m_Scores;
|
|
||||||
private readonly List<Mobile> m_Spectators;
|
[SerializableField(2, setter: "private")]
|
||||||
|
private bool[] _publicHand;
|
||||||
|
|
||||||
|
[SerializableField(3, setter: "private")]
|
||||||
|
private int[] _scores;
|
||||||
|
|
||||||
|
[SerializableField(4, setter: "private")]
|
||||||
|
private int _dealerPosition;
|
||||||
|
|
||||||
|
private List<Mobile> _spectators;
|
||||||
|
|
||||||
|
[DirtyTrackingEntity]
|
||||||
|
private readonly MahjongGame _game;
|
||||||
|
|
||||||
public MahjongPlayers(MahjongGame game, int maxPlayers, int baseScore)
|
public MahjongPlayers(MahjongGame game, int maxPlayers, int baseScore)
|
||||||
{
|
{
|
||||||
Game = game;
|
_game = game;
|
||||||
m_Spectators = new List<Mobile>();
|
_spectators = new List<Mobile>();
|
||||||
|
|
||||||
m_Players = new Mobile[maxPlayers];
|
_players = new Mobile[maxPlayers];
|
||||||
m_InGame = new bool[maxPlayers];
|
_inGame = new bool[maxPlayers];
|
||||||
m_PublicHand = new bool[maxPlayers];
|
_publicHand = new bool[maxPlayers];
|
||||||
m_Scores = new int[maxPlayers];
|
_scores = new int[maxPlayers];
|
||||||
|
|
||||||
for (var i = 0; i < m_Scores.Length; i++)
|
for (var i = 0; i < _scores.Length; i++)
|
||||||
{
|
{
|
||||||
m_Scores[i] = baseScore;
|
_scores[i] = baseScore;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public MahjongPlayers(MahjongGame game, IGenericReader reader)
|
public MahjongPlayers(MahjongGame game)
|
||||||
{
|
{
|
||||||
Game = game;
|
_game = game;
|
||||||
m_Spectators = new List<Mobile>();
|
_spectators = new List<Mobile>();
|
||||||
|
}
|
||||||
var version = reader.ReadInt();
|
|
||||||
|
|
||||||
|
private void Deserialize(IGenericReader reader, int version)
|
||||||
|
{
|
||||||
var seats = reader.ReadInt();
|
var seats = reader.ReadInt();
|
||||||
m_Players = new Mobile[seats];
|
_players = new Mobile[seats];
|
||||||
m_InGame = new bool[seats];
|
_inGame = new bool[seats];
|
||||||
m_PublicHand = new bool[seats];
|
_publicHand = new bool[seats];
|
||||||
m_Scores = new int[seats];
|
_scores = new int[seats];
|
||||||
|
|
||||||
for (var i = 0; i < seats; i++)
|
for (var i = 0; i < seats; i++)
|
||||||
{
|
{
|
||||||
m_Players[i] = reader.ReadEntity<Mobile>();
|
_players[i] = reader.ReadEntity<Mobile>();
|
||||||
m_PublicHand[i] = reader.ReadBool();
|
_publicHand[i] = reader.ReadBool();
|
||||||
m_Scores[i] = reader.ReadInt();
|
_scores[i] = reader.ReadInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
DealerPosition = reader.ReadInt();
|
_dealerPosition = reader.ReadInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
public MahjongGame Game { get; }
|
public int Seats => _players.Length;
|
||||||
|
public Mobile Dealer => _players[DealerPosition];
|
||||||
public int Seats => m_Players.Length;
|
|
||||||
public Mobile Dealer => m_Players[DealerPosition];
|
|
||||||
public int DealerPosition { get; private set; }
|
|
||||||
|
|
||||||
public Mobile GetPlayer(int index)
|
public Mobile GetPlayer(int index)
|
||||||
{
|
{
|
||||||
if (index < 0 || index >= m_Players.Length)
|
if (index < 0 || index >= _players.Length)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_Players[index];
|
return _players[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetPlayerIndex(Mobile mobile)
|
public int GetPlayerIndex(Mobile mobile)
|
||||||
{
|
{
|
||||||
for (var i = 0; i < m_Players.Length; i++)
|
for (var i = 0; i < _players.Length; i++)
|
||||||
{
|
{
|
||||||
if (m_Players[i] == mobile)
|
if (_players[i] == mobile)
|
||||||
{
|
{
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
@ -87,17 +101,17 @@ namespace Server.Engines.Mahjong
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_InGame[DealerPosition];
|
return _inGame[DealerPosition];
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsInGamePlayer(int index)
|
public bool IsInGamePlayer(int index)
|
||||||
{
|
{
|
||||||
if (index < 0 || index >= m_Players.Length || m_Players[index] == null)
|
if (index < 0 || index >= _players.Length || _players[index] == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_InGame[index];
|
return _inGame[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsInGamePlayer(Mobile mobile)
|
public bool IsInGamePlayer(Mobile mobile)
|
||||||
|
|
@ -107,42 +121,42 @@ namespace Server.Engines.Mahjong
|
||||||
return IsInGamePlayer(index);
|
return IsInGamePlayer(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsSpectator(Mobile mobile) => m_Spectators.Contains(mobile);
|
public bool IsSpectator(Mobile mobile) => _spectators.Contains(mobile);
|
||||||
|
|
||||||
public int GetScore(int index)
|
public int GetScore(int index)
|
||||||
{
|
{
|
||||||
if (index < 0 || index >= m_Scores.Length)
|
if (index < 0 || index >= _scores.Length)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_Scores[index];
|
return _scores[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsPublic(int index)
|
public bool IsPublic(int index)
|
||||||
{
|
{
|
||||||
if (index < 0 || index >= m_PublicHand.Length)
|
if (index < 0 || index >= _publicHand.Length)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_PublicHand[index];
|
return _publicHand[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetPublic(int index, bool value)
|
public void SetPublic(int index, bool value)
|
||||||
{
|
{
|
||||||
if (index < 0 || index >= m_PublicHand.Length || m_PublicHand[index] == value)
|
if (index < 0 || index >= _publicHand.Length || _publicHand[index] == value)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_PublicHand[index] = value;
|
_publicHand[index] = value;
|
||||||
|
|
||||||
SendTilesPacket(true, !Game.SpectatorVision);
|
SendTilesPacket(true, !_game.SpectatorVision);
|
||||||
|
|
||||||
if (IsInGamePlayer(index))
|
if (IsInGamePlayer(index))
|
||||||
{
|
{
|
||||||
m_Players[index].SendLocalizedMessage(value ? 1062775 : 1062776); // Your hand is [not] publicly viewable.
|
_players[index].SendLocalizedMessage(value ? 1062775 : 1062776); // Your hand is [not] publicly viewable.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -152,18 +166,18 @@ namespace Server.Engines.Mahjong
|
||||||
|
|
||||||
if (players)
|
if (players)
|
||||||
{
|
{
|
||||||
for (var i = 0; i < m_Players.Length; i++)
|
for (var i = 0; i < _players.Length; i++)
|
||||||
{
|
{
|
||||||
if (IsInGamePlayer(i))
|
if (IsInGamePlayer(i))
|
||||||
{
|
{
|
||||||
list.Add(m_Players[i]);
|
list.Add(_players[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spectators)
|
if (spectators)
|
||||||
{
|
{
|
||||||
list.AddRange(m_Spectators);
|
list.AddRange(_spectators);
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
|
@ -175,9 +189,9 @@ namespace Server.Engines.Mahjong
|
||||||
|
|
||||||
Span<byte> relievePacket = stackalloc byte[MahjongPackets.MahjongRelievePacketLength].InitializePacket();
|
Span<byte> relievePacket = stackalloc byte[MahjongPackets.MahjongRelievePacketLength].InitializePacket();
|
||||||
|
|
||||||
for (var i = 0; i < m_Players.Length; i++)
|
for (var i = 0; i < _players.Length; i++)
|
||||||
{
|
{
|
||||||
var player = m_Players[i];
|
var player = _players[i];
|
||||||
|
|
||||||
if (player == null)
|
if (player == null)
|
||||||
{
|
{
|
||||||
|
|
@ -186,30 +200,30 @@ namespace Server.Engines.Mahjong
|
||||||
|
|
||||||
if (player.Deleted)
|
if (player.Deleted)
|
||||||
{
|
{
|
||||||
m_Players[i] = null;
|
_players[i] = null;
|
||||||
|
|
||||||
SendPlayerExitMessage(player);
|
SendPlayerExitMessage(player);
|
||||||
UpdateDealer(true);
|
UpdateDealer(true);
|
||||||
|
|
||||||
removed = true;
|
removed = true;
|
||||||
}
|
}
|
||||||
else if (m_InGame[i])
|
else if (_inGame[i])
|
||||||
{
|
{
|
||||||
if (player.NetState == null)
|
if (player.NetState == null)
|
||||||
{
|
{
|
||||||
m_InGame[i] = false;
|
_inGame[i] = false;
|
||||||
|
|
||||||
SendPlayerExitMessage(player);
|
SendPlayerExitMessage(player);
|
||||||
UpdateDealer(true);
|
UpdateDealer(true);
|
||||||
|
|
||||||
removed = true;
|
removed = true;
|
||||||
}
|
}
|
||||||
else if (!Game.IsAccessibleTo(player) || player.Map != Game.Map ||
|
else if (!_game.IsAccessibleTo(player) || player.Map != _game.Map ||
|
||||||
!player.InRange(Game.GetWorldLocation(), 5))
|
!player.InRange(_game.GetWorldLocation(), 5))
|
||||||
{
|
{
|
||||||
m_InGame[i] = false;
|
_inGame[i] = false;
|
||||||
|
|
||||||
MahjongPackets.CreateMahjongRelieve(relievePacket, Game.Serial);
|
MahjongPackets.CreateMahjongRelieve(relievePacket, _game.Serial);
|
||||||
player.NetState?.Send(relievePacket);
|
player.NetState?.Send(relievePacket);
|
||||||
|
|
||||||
SendPlayerExitMessage(player);
|
SendPlayerExitMessage(player);
|
||||||
|
|
@ -220,20 +234,20 @@ namespace Server.Engines.Mahjong
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < m_Spectators.Count;)
|
for (var i = 0; i < _spectators.Count;)
|
||||||
{
|
{
|
||||||
var mobile = m_Spectators[i];
|
var mobile = _spectators[i];
|
||||||
|
|
||||||
if (mobile.NetState == null || mobile.Deleted)
|
if (mobile.NetState == null || mobile.Deleted)
|
||||||
{
|
{
|
||||||
m_Spectators.RemoveAt(i);
|
_spectators.RemoveAt(i);
|
||||||
}
|
}
|
||||||
else if (!Game.IsAccessibleTo(mobile) || mobile.Map != Game.Map ||
|
else if (!_game.IsAccessibleTo(mobile) || mobile.Map != _game.Map ||
|
||||||
!mobile.InRange(Game.GetWorldLocation(), 5))
|
!mobile.InRange(_game.GetWorldLocation(), 5))
|
||||||
{
|
{
|
||||||
m_Spectators.RemoveAt(i);
|
_spectators.RemoveAt(i);
|
||||||
|
|
||||||
MahjongPackets.CreateMahjongRelieve(relievePacket, Game.Serial);
|
MahjongPackets.CreateMahjongRelieve(relievePacket, _game.Serial);
|
||||||
mobile.NetState?.Send(relievePacket);
|
mobile.NetState?.Send(relievePacket);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -255,7 +269,7 @@ namespace Server.Engines.Mahjong
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = DealerPosition + 1; i < m_Players.Length; i++)
|
for (var i = DealerPosition + 1; i < _players.Length; i++)
|
||||||
{
|
{
|
||||||
if (IsInGamePlayer(i))
|
if (IsInGamePlayer(i))
|
||||||
{
|
{
|
||||||
|
|
@ -288,9 +302,9 @@ namespace Server.Engines.Mahjong
|
||||||
|
|
||||||
private int GetNextSeat()
|
private int GetNextSeat()
|
||||||
{
|
{
|
||||||
for (var i = DealerPosition; i < m_Players.Length; i++)
|
for (var i = DealerPosition; i < _players.Length; i++)
|
||||||
{
|
{
|
||||||
if (m_Players[i] == null)
|
if (_players[i] == null)
|
||||||
{
|
{
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
@ -298,7 +312,7 @@ namespace Server.Engines.Mahjong
|
||||||
|
|
||||||
for (var i = 0; i < DealerPosition; i++)
|
for (var i = 0; i < DealerPosition; i++)
|
||||||
{
|
{
|
||||||
if (m_Players[i] == null)
|
if (_players[i] == null)
|
||||||
{
|
{
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
@ -309,7 +323,7 @@ namespace Server.Engines.Mahjong
|
||||||
|
|
||||||
private bool UpdateSpectators()
|
private bool UpdateSpectators()
|
||||||
{
|
{
|
||||||
if (m_Spectators.Count == 0)
|
if (_spectators.Count == 0)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -318,9 +332,9 @@ namespace Server.Engines.Mahjong
|
||||||
|
|
||||||
if (nextSeat >= 0)
|
if (nextSeat >= 0)
|
||||||
{
|
{
|
||||||
var newPlayer = m_Spectators[0];
|
var newPlayer = _spectators[0];
|
||||||
|
|
||||||
m_Spectators.RemoveAt(0);
|
_spectators.RemoveAt(0);
|
||||||
|
|
||||||
AddPlayer(newPlayer, nextSeat, false);
|
AddPlayer(newPlayer, nextSeat, false);
|
||||||
|
|
||||||
|
|
@ -334,20 +348,20 @@ namespace Server.Engines.Mahjong
|
||||||
|
|
||||||
private void AddPlayer(Mobile player, int index, bool sendJoinGame)
|
private void AddPlayer(Mobile player, int index, bool sendJoinGame)
|
||||||
{
|
{
|
||||||
m_Players[index] = player;
|
_players[index] = player;
|
||||||
m_InGame[index] = true;
|
_inGame[index] = true;
|
||||||
|
|
||||||
UpdateDealer(false);
|
UpdateDealer(false);
|
||||||
|
|
||||||
if (sendJoinGame)
|
if (sendJoinGame)
|
||||||
{
|
{
|
||||||
player.NetState.SendMahjongJoinGame(Game.Serial);
|
player.NetState.SendMahjongJoinGame(_game.Serial);
|
||||||
}
|
}
|
||||||
|
|
||||||
SendPlayersPacket(true, true);
|
SendPlayersPacket(true, true);
|
||||||
|
|
||||||
player.NetState.SendMahjongGeneralInfo(Game);
|
player.NetState.SendMahjongGeneralInfo(_game);
|
||||||
player.NetState.SendMahjongTilesInfo(Game, player);
|
player.NetState.SendMahjongTilesInfo(_game, player);
|
||||||
|
|
||||||
if (DealerPosition == index)
|
if (DealerPosition == index)
|
||||||
{
|
{
|
||||||
|
|
@ -363,13 +377,13 @@ namespace Server.Engines.Mahjong
|
||||||
{
|
{
|
||||||
if (!IsSpectator(mobile))
|
if (!IsSpectator(mobile))
|
||||||
{
|
{
|
||||||
m_Spectators.Add(mobile);
|
_spectators.Add(mobile);
|
||||||
}
|
}
|
||||||
|
|
||||||
mobile.NetState.SendMahjongJoinGame(Game.Serial);
|
mobile.NetState.SendMahjongJoinGame(_game.Serial);
|
||||||
mobile.NetState.SendMahjongPlayersInfo(Game, mobile);
|
mobile.NetState.SendMahjongPlayersInfo(_game, mobile);
|
||||||
mobile.NetState.SendMahjongGeneralInfo(Game);
|
mobile.NetState.SendMahjongGeneralInfo(_game);
|
||||||
mobile.NetState.SendMahjongTilesInfo(Game, mobile);
|
mobile.NetState.SendMahjongTilesInfo(_game, mobile);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Join(Mobile mobile)
|
public void Join(Mobile mobile)
|
||||||
|
|
@ -399,7 +413,7 @@ namespace Server.Engines.Mahjong
|
||||||
var index = GetPlayerIndex(player);
|
var index = GetPlayerIndex(player);
|
||||||
if (index >= 0)
|
if (index >= 0)
|
||||||
{
|
{
|
||||||
m_InGame[index] = false;
|
_inGame[index] = false;
|
||||||
|
|
||||||
SendPlayerExitMessage(player);
|
SendPlayerExitMessage(player);
|
||||||
UpdateDealer(true);
|
UpdateDealer(true);
|
||||||
|
|
@ -408,18 +422,18 @@ namespace Server.Engines.Mahjong
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_Spectators.Remove(player);
|
_spectators.Remove(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResetScores(int value)
|
public void ResetScores(int value)
|
||||||
{
|
{
|
||||||
for (var i = 0; i < m_Scores.Length; i++)
|
for (var i = 0; i < _scores.Length; i++)
|
||||||
{
|
{
|
||||||
m_Scores[i] = value;
|
_scores[i] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
SendPlayersPacket(true, Game.ShowScores);
|
SendPlayersPacket(true, _game.ShowScores);
|
||||||
|
|
||||||
SendLocalizedMessage(1062697); // The dealer redistributes the score sticks evenly.
|
SendLocalizedMessage(1062697); // The dealer redistributes the score sticks evenly.
|
||||||
}
|
}
|
||||||
|
|
@ -429,22 +443,22 @@ namespace Server.Engines.Mahjong
|
||||||
var fromPosition = GetPlayerIndex(from);
|
var fromPosition = GetPlayerIndex(from);
|
||||||
var to = GetPlayer(toPosition);
|
var to = GetPlayer(toPosition);
|
||||||
|
|
||||||
if (fromPosition < 0 || to == null || m_Scores[fromPosition] < amount)
|
if (fromPosition < 0 || to == null || _scores[fromPosition] < amount)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Scores[fromPosition] -= amount;
|
_scores[fromPosition] -= amount;
|
||||||
m_Scores[toPosition] += amount;
|
_scores[toPosition] += amount;
|
||||||
|
|
||||||
if (Game.ShowScores)
|
if (_game.ShowScores)
|
||||||
{
|
{
|
||||||
SendPlayersPacket(true, true);
|
SendPlayersPacket(true, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
from.NetState.SendMahjongPlayersInfo(Game, from);
|
from.NetState.SendMahjongPlayersInfo(_game, from);
|
||||||
to.NetState.SendMahjongPlayersInfo(Game, to);
|
to.NetState.SendMahjongPlayersInfo(_game, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~1_giver~ gives ~2_receiver~ ~3_number~ points.
|
// ~1_giver~ gives ~2_receiver~ ~3_number~ points.
|
||||||
|
|
@ -459,12 +473,12 @@ namespace Server.Engines.Mahjong
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_InGame[index])
|
if (_inGame[index])
|
||||||
{
|
{
|
||||||
player.NetState.SendMahjongRelieve(Game.Serial);
|
player.NetState.SendMahjongRelieve(_game.Serial);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Players[index] = null;
|
_players[index] = null;
|
||||||
|
|
||||||
SendLocalizedMessage(1062699, player.Name); // ~1_name~ is relieved from the game by the dealer.
|
SendLocalizedMessage(1062699, player.Name); // ~1_name~ is relieved from the game by the dealer.
|
||||||
|
|
||||||
|
|
@ -480,7 +494,7 @@ namespace Server.Engines.Mahjong
|
||||||
{
|
{
|
||||||
var to = GetPlayer(index);
|
var to = GetPlayer(index);
|
||||||
|
|
||||||
if (to == null || !m_InGame[index])
|
if (to == null || !_inGame[index])
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -491,10 +505,10 @@ namespace Server.Engines.Mahjong
|
||||||
|
|
||||||
if (IsInGamePlayer(oldDealer))
|
if (IsInGamePlayer(oldDealer))
|
||||||
{
|
{
|
||||||
m_Players[oldDealer].NetState.SendMahjongPlayersInfo(Game, m_Players[oldDealer]);
|
_players[oldDealer].NetState.SendMahjongPlayersInfo(_game, _players[oldDealer]);
|
||||||
}
|
}
|
||||||
|
|
||||||
to.NetState.SendMahjongPlayersInfo(Game, to);
|
to.NetState.SendMahjongPlayersInfo(_game, to);
|
||||||
|
|
||||||
SendDealerChangedMessage();
|
SendDealerChangedMessage();
|
||||||
}
|
}
|
||||||
|
|
@ -516,7 +530,7 @@ namespace Server.Engines.Mahjong
|
||||||
{
|
{
|
||||||
foreach (var mobile in GetInGameMobiles(players, spectators))
|
foreach (var mobile in GetInGameMobiles(players, spectators))
|
||||||
{
|
{
|
||||||
mobile.NetState.SendMahjongPlayersInfo(Game, mobile);
|
mobile.NetState.SendMahjongPlayersInfo(_game, mobile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -533,7 +547,7 @@ namespace Server.Engines.Mahjong
|
||||||
|
|
||||||
foreach (var mobile in mobiles)
|
foreach (var mobile in mobiles)
|
||||||
{
|
{
|
||||||
MahjongPackets.CreateMahjongGeneralInfo(generalInfo, Game);
|
MahjongPackets.CreateMahjongGeneralInfo(generalInfo, _game);
|
||||||
mobile.NetState?.Send(generalInfo);
|
mobile.NetState?.Send(generalInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -542,7 +556,7 @@ namespace Server.Engines.Mahjong
|
||||||
{
|
{
|
||||||
foreach (var mobile in GetInGameMobiles(players, spectators))
|
foreach (var mobile in GetInGameMobiles(players, spectators))
|
||||||
{
|
{
|
||||||
mobile.NetState.SendMahjongTilesInfo(Game, mobile);
|
mobile.NetState.SendMahjongTilesInfo(_game, mobile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -567,7 +581,7 @@ namespace Server.Engines.Mahjong
|
||||||
|
|
||||||
foreach (var mobile in mobiles)
|
foreach (var mobile in mobiles)
|
||||||
{
|
{
|
||||||
MahjongPackets.CreateMahjongRelieve(relievePacket, Game.Serial);
|
MahjongPackets.CreateMahjongRelieve(relievePacket, _game.Serial);
|
||||||
mobile.NetState?.Send(relievePacket);
|
mobile.NetState?.Send(relievePacket);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -587,21 +601,4 @@ namespace Server.Engines.Mahjong
|
||||||
mobile.SendLocalizedMessage(number, args);
|
mobile.SendLocalizedMessage(number, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Save(IGenericWriter writer)
|
|
||||||
{
|
|
||||||
writer.Write(0); // version
|
|
||||||
|
|
||||||
writer.Write(Seats);
|
|
||||||
|
|
||||||
for (var i = 0; i < Seats; i++)
|
|
||||||
{
|
|
||||||
writer.Write(m_Players[i]);
|
|
||||||
writer.Write(m_PublicHand[i]);
|
|
||||||
writer.Write(m_Scores[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
writer.Write(DealerPosition);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,63 +1,67 @@
|
||||||
namespace Server.Engines.Mahjong
|
using ModernUO.Serialization;
|
||||||
|
|
||||||
|
namespace Server.Engines.Mahjong;
|
||||||
|
|
||||||
|
[SerializationGenerator(1, false)]
|
||||||
|
public partial class MahjongTile
|
||||||
{
|
{
|
||||||
public class MahjongTile
|
[DirtyTrackingEntity]
|
||||||
{
|
private readonly MahjongGame _game;
|
||||||
protected Point2D m_Position;
|
|
||||||
|
[SerializableField(0, setter: "private")]
|
||||||
|
private int _number;
|
||||||
|
|
||||||
|
[SerializableField(1, setter: "private")]
|
||||||
|
private MahjongTileType _value;
|
||||||
|
|
||||||
|
[SerializableField(2, setter: "private")]
|
||||||
|
private Point2D _position;
|
||||||
|
|
||||||
|
[SerializableField(3, setter: "private")]
|
||||||
|
private int _stackLevel;
|
||||||
|
|
||||||
|
[SerializableField(4, setter: "private")]
|
||||||
|
private MahjongPieceDirection _direction;
|
||||||
|
|
||||||
|
[SerializableField(5, setter: "private")]
|
||||||
|
private bool _flipped;
|
||||||
|
|
||||||
|
public MahjongTile(MahjongGame game) => _game = game;
|
||||||
|
|
||||||
public MahjongTile(
|
public MahjongTile(
|
||||||
MahjongGame game, int number, MahjongTileType value, Point2D position, int stackLevel,
|
MahjongGame game, int number, MahjongTileType value, Point2D position, int stackLevel,
|
||||||
MahjongPieceDirection direction, bool flipped
|
MahjongPieceDirection direction, bool flipped
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Game = game;
|
_game = game;
|
||||||
Number = number;
|
_number = number;
|
||||||
Value = value;
|
_value = value;
|
||||||
m_Position = position;
|
_position = position;
|
||||||
StackLevel = stackLevel;
|
_stackLevel = stackLevel;
|
||||||
Direction = direction;
|
_direction = direction;
|
||||||
Flipped = flipped;
|
_flipped = flipped;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MahjongTile(MahjongGame game, IGenericReader reader)
|
public MahjongGame Game => _game;
|
||||||
|
|
||||||
|
private void Deserialize(IGenericReader reader, int version)
|
||||||
{
|
{
|
||||||
Game = game;
|
_number = reader.ReadInt();
|
||||||
|
_value = (MahjongTileType)reader.ReadInt();
|
||||||
var version = reader.ReadInt();
|
_position = reader.ReadPoint2D();
|
||||||
|
_stackLevel = reader.ReadInt();
|
||||||
Number = reader.ReadInt();
|
_direction = (MahjongPieceDirection)reader.ReadInt();
|
||||||
Value = (MahjongTileType)reader.ReadInt();
|
_flipped = reader.ReadBool();
|
||||||
m_Position = reader.ReadPoint2D();
|
|
||||||
StackLevel = reader.ReadInt();
|
|
||||||
Direction = (MahjongPieceDirection)reader.ReadInt();
|
|
||||||
Flipped = reader.ReadBool();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MahjongGame Game { get; }
|
public MahjongPieceDim Dimensions => GetDimensions(_position, _direction);
|
||||||
|
|
||||||
public int Number { get; }
|
public bool IsMovable => _game.GetStackLevel(Dimensions) <= _stackLevel;
|
||||||
|
|
||||||
public MahjongTileType Value { get; }
|
public static MahjongPieceDim GetDimensions(Point2D position, MahjongPieceDirection direction) =>
|
||||||
|
direction is MahjongPieceDirection.Up or MahjongPieceDirection.Down
|
||||||
public Point2D Position => m_Position;
|
? new MahjongPieceDim(position, 20, 30)
|
||||||
public int StackLevel { get; private set; }
|
: new MahjongPieceDim(position, 30, 20);
|
||||||
|
|
||||||
public MahjongPieceDirection Direction { get; private set; }
|
|
||||||
|
|
||||||
public bool Flipped { get; private set; }
|
|
||||||
|
|
||||||
public MahjongPieceDim Dimensions => GetDimensions(m_Position, Direction);
|
|
||||||
|
|
||||||
public bool IsMovable => Game.GetStackLevel(Dimensions) <= StackLevel;
|
|
||||||
|
|
||||||
public static MahjongPieceDim GetDimensions(Point2D position, MahjongPieceDirection direction)
|
|
||||||
{
|
|
||||||
if (direction is MahjongPieceDirection.Up or MahjongPieceDirection.Down)
|
|
||||||
{
|
|
||||||
return new MahjongPieceDim(position, 20, 30);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new MahjongPieceDim(position, 30, 20);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Move(Point2D position, MahjongPieceDirection direction, bool flip, int validHandArea)
|
public void Move(Point2D position, MahjongPieceDirection direction, bool flip, int validHandArea)
|
||||||
{
|
{
|
||||||
|
|
@ -71,25 +75,12 @@ namespace Server.Engines.Mahjong
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Position = position;
|
Position = position;
|
||||||
Direction = direction;
|
Direction = direction;
|
||||||
StackLevel = -1; // Avoid self interference
|
StackLevel = -1; // Avoid self interference
|
||||||
StackLevel = Game.GetStackLevel(dim) + 1;
|
StackLevel = _game.GetStackLevel(dim) + 1;
|
||||||
Flipped = flip;
|
Flipped = flip;
|
||||||
|
|
||||||
Game.Players.SendTilePacket(this, true, true);
|
_game.Players.SendTilePacket(this, true, true);
|
||||||
}
|
|
||||||
|
|
||||||
public void Save(IGenericWriter writer)
|
|
||||||
{
|
|
||||||
writer.Write(0); // version
|
|
||||||
|
|
||||||
writer.Write(Number);
|
|
||||||
writer.Write((int)Value);
|
|
||||||
writer.Write(m_Position);
|
|
||||||
writer.Write(StackLevel);
|
|
||||||
writer.Write((int)Direction);
|
|
||||||
writer.Write(Flipped);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,31 +1,28 @@
|
||||||
using System.Collections.Generic;
|
namespace Server.Engines.Mahjong;
|
||||||
|
|
||||||
namespace Server.Engines.Mahjong
|
|
||||||
{
|
|
||||||
public class MahjongTileTypeGenerator
|
public class MahjongTileTypeGenerator
|
||||||
{
|
{
|
||||||
|
private MahjongTileType[] _leftTileTypes;
|
||||||
|
private int _nextTile;
|
||||||
|
|
||||||
public MahjongTileTypeGenerator()
|
public MahjongTileTypeGenerator()
|
||||||
{
|
{
|
||||||
LeftTileTypes = new List<MahjongTileType>(136);
|
_leftTileTypes = new MahjongTileType[136];
|
||||||
|
|
||||||
for (var i = 1; i <= 34; i++)
|
for (int i = 1, j = 0; i <= 34; i++)
|
||||||
{
|
{
|
||||||
var tile = (MahjongTileType)i;
|
var tile = (MahjongTileType)i;
|
||||||
LeftTileTypes.Add(tile);
|
_leftTileTypes[j++] = tile;
|
||||||
LeftTileTypes.Add(tile);
|
_leftTileTypes[j++] = tile;
|
||||||
LeftTileTypes.Add(tile);
|
_leftTileTypes[j++] = tile;
|
||||||
LeftTileTypes.Add(tile);
|
_leftTileTypes[j++] = tile;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MahjongTileType> LeftTileTypes { get; }
|
_leftTileTypes.Shuffle();
|
||||||
|
_leftTileTypes.Shuffle();
|
||||||
|
_leftTileTypes.Shuffle();
|
||||||
|
_leftTileTypes.Shuffle();
|
||||||
|
}
|
||||||
|
|
||||||
public MahjongTileType Next()
|
public MahjongTileType Next() => _leftTileTypes[_nextTile++];
|
||||||
{
|
|
||||||
var next = LeftTileTypes.RandomElement();
|
|
||||||
LeftTileTypes.Remove(next);
|
|
||||||
|
|
||||||
return next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,25 @@
|
||||||
namespace Server.Engines.Mahjong
|
using ModernUO.Serialization;
|
||||||
{
|
|
||||||
public class MahjongWallBreakIndicator
|
namespace Server.Engines.Mahjong;
|
||||||
|
|
||||||
|
[SerializationGenerator(0, false)]
|
||||||
|
public partial class MahjongWallBreakIndicator
|
||||||
{
|
{
|
||||||
|
[DirtyTrackingEntity]
|
||||||
|
private readonly MahjongGame _game;
|
||||||
|
|
||||||
|
[SerializableField(0, setter: "private")]
|
||||||
|
private Point2D _position;
|
||||||
|
|
||||||
|
public MahjongWallBreakIndicator(MahjongGame game) => _game = game;
|
||||||
|
|
||||||
public MahjongWallBreakIndicator(MahjongGame game, Point2D position)
|
public MahjongWallBreakIndicator(MahjongGame game, Point2D position)
|
||||||
{
|
{
|
||||||
Game = game;
|
_game = game;
|
||||||
Position = position;
|
_position = position;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MahjongWallBreakIndicator(MahjongGame game, IGenericReader reader)
|
public MahjongPieceDim Dimensions => GetDimensions(_position);
|
||||||
{
|
|
||||||
Game = game;
|
|
||||||
|
|
||||||
var version = reader.ReadInt();
|
|
||||||
|
|
||||||
Position = reader.ReadPoint2D();
|
|
||||||
}
|
|
||||||
|
|
||||||
public MahjongGame Game { get; }
|
|
||||||
|
|
||||||
public Point2D Position { get; private set; }
|
|
||||||
|
|
||||||
public MahjongPieceDim Dimensions => GetDimensions(Position);
|
|
||||||
|
|
||||||
public static MahjongPieceDim GetDimensions(Point2D position) => new(position, 20, 20);
|
public static MahjongPieceDim GetDimensions(Point2D position) => new(position, 20, 20);
|
||||||
|
|
||||||
|
|
@ -34,16 +32,8 @@ namespace Server.Engines.Mahjong
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Position = position;
|
_position = position;
|
||||||
|
|
||||||
Game.Players.SendGeneralPacket(true, true);
|
_game.Players.SendGeneralPacket(true, true);
|
||||||
}
|
|
||||||
|
|
||||||
public void Save(IGenericWriter writer)
|
|
||||||
{
|
|
||||||
writer.Write(0); // version
|
|
||||||
|
|
||||||
writer.Write(Position);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"type": "Server.Engines.Mahjong.MahjongDealerIndicator",
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"name": "Position",
|
||||||
|
"type": "Server.Point2D",
|
||||||
|
"rule": "PrimitiveUOTypeMigrationRule",
|
||||||
|
"ruleArguments": [
|
||||||
|
"Point2D"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Direction",
|
||||||
|
"type": "Server.Engines.Mahjong.MahjongPieceDirection",
|
||||||
|
"rule": "EnumMigrationRule"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Wind",
|
||||||
|
"type": "Server.Engines.Mahjong.MahjongWind",
|
||||||
|
"rule": "EnumMigrationRule"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
"version": 0,
|
||||||
|
"type": "Server.Engines.Mahjong.MahjongDices",
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"name": "First",
|
||||||
|
"type": "int",
|
||||||
|
"rule": "PrimitiveTypeMigrationRule",
|
||||||
|
"ruleArguments": [
|
||||||
|
""
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Second",
|
||||||
|
"type": "int",
|
||||||
|
"rule": "PrimitiveTypeMigrationRule",
|
||||||
|
"ruleArguments": [
|
||||||
|
""
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"type": "Server.Engines.Mahjong.MahjongGame",
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"name": "Level",
|
||||||
|
"type": "Server.Multis.SecureLevel",
|
||||||
|
"rule": "EnumMigrationRule"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Tiles",
|
||||||
|
"type": "Server.Engines.Mahjong.MahjongTile[]",
|
||||||
|
"rule": "ArrayMigrationRule",
|
||||||
|
"ruleArguments": [
|
||||||
|
"Server.Engines.Mahjong.MahjongTile",
|
||||||
|
"RawSerializableMigrationRule",
|
||||||
|
"DeserializationRequiresParent"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "DealerIndicator",
|
||||||
|
"type": "Server.Engines.Mahjong.MahjongDealerIndicator",
|
||||||
|
"rule": "RawSerializableMigrationRule",
|
||||||
|
"ruleArguments": [
|
||||||
|
"DeserializationRequiresParent"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "WallBreakIndicator",
|
||||||
|
"type": "Server.Engines.Mahjong.MahjongWallBreakIndicator",
|
||||||
|
"rule": "RawSerializableMigrationRule",
|
||||||
|
"ruleArguments": [
|
||||||
|
"DeserializationRequiresParent"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Dices",
|
||||||
|
"type": "Server.Engines.Mahjong.MahjongDices",
|
||||||
|
"rule": "RawSerializableMigrationRule",
|
||||||
|
"ruleArguments": [
|
||||||
|
"DeserializationRequiresParent"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Players",
|
||||||
|
"type": "Server.Engines.Mahjong.MahjongPlayers",
|
||||||
|
"rule": "RawSerializableMigrationRule",
|
||||||
|
"ruleArguments": [
|
||||||
|
"DeserializationRequiresParent"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ShowScores",
|
||||||
|
"type": "bool",
|
||||||
|
"rule": "PrimitiveTypeMigrationRule",
|
||||||
|
"ruleArguments": [
|
||||||
|
""
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "SpectatorVision",
|
||||||
|
"type": "bool",
|
||||||
|
"rule": "PrimitiveTypeMigrationRule",
|
||||||
|
"ruleArguments": [
|
||||||
|
""
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"type": "Server.Engines.Mahjong.MahjongPlayers",
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"name": "Players",
|
||||||
|
"type": "Server.Mobile[]",
|
||||||
|
"rule": "ArrayMigrationRule",
|
||||||
|
"ruleArguments": [
|
||||||
|
"Server.Mobile",
|
||||||
|
"SerializableInterfaceMigrationRule"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "InGame",
|
||||||
|
"type": "bool[]",
|
||||||
|
"rule": "ArrayMigrationRule",
|
||||||
|
"ruleArguments": [
|
||||||
|
"bool",
|
||||||
|
"PrimitiveTypeMigrationRule",
|
||||||
|
""
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "PublicHand",
|
||||||
|
"type": "bool[]",
|
||||||
|
"rule": "ArrayMigrationRule",
|
||||||
|
"ruleArguments": [
|
||||||
|
"bool",
|
||||||
|
"PrimitiveTypeMigrationRule",
|
||||||
|
""
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Scores",
|
||||||
|
"type": "int[]",
|
||||||
|
"rule": "ArrayMigrationRule",
|
||||||
|
"ruleArguments": [
|
||||||
|
"int",
|
||||||
|
"PrimitiveTypeMigrationRule",
|
||||||
|
""
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "DealerPosition",
|
||||||
|
"type": "int",
|
||||||
|
"rule": "PrimitiveTypeMigrationRule",
|
||||||
|
"ruleArguments": [
|
||||||
|
""
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"type": "Server.Engines.Mahjong.MahjongTile",
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"name": "Number",
|
||||||
|
"type": "int",
|
||||||
|
"rule": "PrimitiveTypeMigrationRule",
|
||||||
|
"ruleArguments": [
|
||||||
|
""
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Value",
|
||||||
|
"type": "Server.Engines.Mahjong.MahjongTileType",
|
||||||
|
"rule": "EnumMigrationRule"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Position",
|
||||||
|
"type": "Server.Point2D",
|
||||||
|
"rule": "PrimitiveUOTypeMigrationRule",
|
||||||
|
"ruleArguments": [
|
||||||
|
"Point2D"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "StackLevel",
|
||||||
|
"type": "int",
|
||||||
|
"rule": "PrimitiveTypeMigrationRule",
|
||||||
|
"ruleArguments": [
|
||||||
|
""
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Direction",
|
||||||
|
"type": "Server.Engines.Mahjong.MahjongPieceDirection",
|
||||||
|
"rule": "EnumMigrationRule"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Flipped",
|
||||||
|
"type": "bool",
|
||||||
|
"rule": "PrimitiveTypeMigrationRule",
|
||||||
|
"ruleArguments": [
|
||||||
|
""
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"version": 0,
|
||||||
|
"type": "Server.Engines.Mahjong.MahjongWallBreakIndicator",
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"name": "Position",
|
||||||
|
"type": "Server.Point2D",
|
||||||
|
"rule": "PrimitiveUOTypeMigrationRule",
|
||||||
|
"ruleArguments": [
|
||||||
|
"Point2D"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue