Renames pvSrc (#277)
This commit is contained in:
parent
4211835b5d
commit
24bf97282e
12 changed files with 533 additions and 533 deletions
|
|
@ -2,7 +2,7 @@ using Server.Network;
|
|||
|
||||
namespace Server.Engines.Mahjong
|
||||
{
|
||||
public delegate void OnMahjongPacketReceive(MahjongGame game, NetState state, PacketReader pvSrc);
|
||||
public delegate void OnMahjongPacketReceive(MahjongGame game, NetState state, PacketReader reader);
|
||||
|
||||
public sealed class MahjongPacketHandlers
|
||||
{
|
||||
|
|
@ -41,25 +41,25 @@ namespace Server.Engines.Mahjong
|
|||
RegisterSubCommand(0x18, MoveDealerIndicator);
|
||||
}
|
||||
|
||||
public static void OnPacket(NetState state, PacketReader pvSrc)
|
||||
public static void OnPacket(NetState state, PacketReader reader)
|
||||
{
|
||||
var game = World.FindItem(pvSrc.ReadUInt32()) as MahjongGame;
|
||||
var game = World.FindItem(reader.ReadUInt32()) as MahjongGame;
|
||||
|
||||
game?.Players.CheckPlayers();
|
||||
|
||||
pvSrc.ReadByte();
|
||||
reader.ReadByte();
|
||||
|
||||
int cmd = pvSrc.ReadByte();
|
||||
int cmd = reader.ReadByte();
|
||||
|
||||
var onReceive = GetSubCommandDelegate(cmd);
|
||||
|
||||
if (onReceive != null)
|
||||
{
|
||||
onReceive(game, state, pvSrc);
|
||||
onReceive(game, state, reader);
|
||||
}
|
||||
else
|
||||
{
|
||||
pvSrc.Trace(state);
|
||||
reader.Trace(state);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ namespace Server.Engines.Mahjong
|
|||
};
|
||||
}
|
||||
|
||||
public static void ExitGame(MahjongGame game, NetState state, PacketReader pvSrc)
|
||||
public static void ExitGame(MahjongGame game, NetState state, PacketReader reader)
|
||||
{
|
||||
if (game == null)
|
||||
{
|
||||
|
|
@ -97,20 +97,20 @@ namespace Server.Engines.Mahjong
|
|||
game.Players.LeaveGame(from);
|
||||
}
|
||||
|
||||
public static void GivePoints(MahjongGame game, NetState state, PacketReader pvSrc)
|
||||
public static void GivePoints(MahjongGame game, NetState state, PacketReader reader)
|
||||
{
|
||||
if (game?.Players.IsInGamePlayer(state.Mobile) != true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int to = pvSrc.ReadByte();
|
||||
var amount = pvSrc.ReadInt32();
|
||||
int to = reader.ReadByte();
|
||||
var amount = reader.ReadInt32();
|
||||
|
||||
game.Players.TransferScore(state.Mobile, to, amount);
|
||||
}
|
||||
|
||||
public static void RollDice(MahjongGame game, NetState state, PacketReader pvSrc)
|
||||
public static void RollDice(MahjongGame game, NetState state, PacketReader reader)
|
||||
{
|
||||
if (game?.Players.IsInGamePlayer(state.Mobile) != true)
|
||||
{
|
||||
|
|
@ -120,7 +120,7 @@ namespace Server.Engines.Mahjong
|
|||
game.Dices.RollDices(state.Mobile);
|
||||
}
|
||||
|
||||
public static void BuildWalls(MahjongGame game, NetState state, PacketReader pvSrc)
|
||||
public static void BuildWalls(MahjongGame game, NetState state, PacketReader reader)
|
||||
{
|
||||
if (game?.Players.IsInGameDealer(state.Mobile) != true)
|
||||
{
|
||||
|
|
@ -130,7 +130,7 @@ namespace Server.Engines.Mahjong
|
|||
game.ResetWalls(state.Mobile);
|
||||
}
|
||||
|
||||
public static void ResetScores(MahjongGame game, NetState state, PacketReader pvSrc)
|
||||
public static void ResetScores(MahjongGame game, NetState state, PacketReader reader)
|
||||
{
|
||||
if (game?.Players.IsInGameDealer(state.Mobile) != true)
|
||||
{
|
||||
|
|
@ -140,26 +140,26 @@ namespace Server.Engines.Mahjong
|
|||
game.Players.ResetScores(MahjongGame.BaseScore);
|
||||
}
|
||||
|
||||
public static void AssignDealer(MahjongGame game, NetState state, PacketReader pvSrc)
|
||||
public static void AssignDealer(MahjongGame game, NetState state, PacketReader reader)
|
||||
{
|
||||
if (game?.Players.IsInGameDealer(state.Mobile) != true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int position = pvSrc.ReadByte();
|
||||
int position = reader.ReadByte();
|
||||
|
||||
game.Players.AssignDealer(position);
|
||||
}
|
||||
|
||||
public static void OpenSeat(MahjongGame game, NetState state, PacketReader pvSrc)
|
||||
public static void OpenSeat(MahjongGame game, NetState state, PacketReader reader)
|
||||
{
|
||||
if (game?.Players.IsInGameDealer(state.Mobile) != true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int position = pvSrc.ReadByte();
|
||||
int position = reader.ReadByte();
|
||||
|
||||
if (game.Players.GetPlayer(position) == state.Mobile)
|
||||
{
|
||||
|
|
@ -169,98 +169,98 @@ namespace Server.Engines.Mahjong
|
|||
game.Players.OpenSeat(position);
|
||||
}
|
||||
|
||||
public static void ChangeOption(MahjongGame game, NetState state, PacketReader pvSrc)
|
||||
public static void ChangeOption(MahjongGame game, NetState state, PacketReader reader)
|
||||
{
|
||||
if (game?.Players.IsInGameDealer(state.Mobile) != true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pvSrc.ReadInt16();
|
||||
pvSrc.ReadByte();
|
||||
reader.ReadInt16();
|
||||
reader.ReadByte();
|
||||
|
||||
int options = pvSrc.ReadByte();
|
||||
int options = reader.ReadByte();
|
||||
|
||||
game.ShowScores = (options & 0x1) != 0;
|
||||
game.SpectatorVision = (options & 0x2) != 0;
|
||||
}
|
||||
|
||||
public static void MoveWallBreakIndicator(MahjongGame game, NetState state, PacketReader pvSrc)
|
||||
public static void MoveWallBreakIndicator(MahjongGame game, NetState state, PacketReader reader)
|
||||
{
|
||||
if (game?.Players.IsInGameDealer(state.Mobile) != true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int y = pvSrc.ReadInt16();
|
||||
int x = pvSrc.ReadInt16();
|
||||
int y = reader.ReadInt16();
|
||||
int x = reader.ReadInt16();
|
||||
|
||||
game.WallBreakIndicator.Move(new Point2D(x, y));
|
||||
}
|
||||
|
||||
public static void TogglePublicHand(MahjongGame game, NetState state, PacketReader pvSrc)
|
||||
public static void TogglePublicHand(MahjongGame game, NetState state, PacketReader reader)
|
||||
{
|
||||
if (game?.Players.IsInGamePlayer(state.Mobile) != true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pvSrc.ReadInt16();
|
||||
pvSrc.ReadByte();
|
||||
reader.ReadInt16();
|
||||
reader.ReadByte();
|
||||
|
||||
var publicHand = pvSrc.ReadBoolean();
|
||||
var publicHand = reader.ReadBoolean();
|
||||
|
||||
game.Players.SetPublic(game.Players.GetPlayerIndex(state.Mobile), publicHand);
|
||||
}
|
||||
|
||||
public static void MoveTile(MahjongGame game, NetState state, PacketReader pvSrc)
|
||||
public static void MoveTile(MahjongGame game, NetState state, PacketReader reader)
|
||||
{
|
||||
if (game?.Players.IsInGamePlayer(state.Mobile) != true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int number = pvSrc.ReadByte();
|
||||
int number = reader.ReadByte();
|
||||
|
||||
if (number < 0 || number >= game.Tiles.Length)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pvSrc.ReadByte(); // Current direction
|
||||
reader.ReadByte(); // Current direction
|
||||
|
||||
var direction = GetDirection(pvSrc.ReadByte());
|
||||
var direction = GetDirection(reader.ReadByte());
|
||||
|
||||
pvSrc.ReadByte();
|
||||
reader.ReadByte();
|
||||
|
||||
var flip = pvSrc.ReadBoolean();
|
||||
var flip = reader.ReadBoolean();
|
||||
|
||||
pvSrc.ReadInt16(); // Current Y
|
||||
pvSrc.ReadInt16(); // Current X
|
||||
reader.ReadInt16(); // Current Y
|
||||
reader.ReadInt16(); // Current X
|
||||
|
||||
pvSrc.ReadByte();
|
||||
reader.ReadByte();
|
||||
|
||||
int y = pvSrc.ReadInt16();
|
||||
int x = pvSrc.ReadInt16();
|
||||
int y = reader.ReadInt16();
|
||||
int x = reader.ReadInt16();
|
||||
|
||||
pvSrc.ReadByte();
|
||||
reader.ReadByte();
|
||||
|
||||
game.Tiles[number].Move(new Point2D(x, y), direction, flip, game.Players.GetPlayerIndex(state.Mobile));
|
||||
}
|
||||
|
||||
public static void MoveDealerIndicator(MahjongGame game, NetState state, PacketReader pvSrc)
|
||||
public static void MoveDealerIndicator(MahjongGame game, NetState state, PacketReader reader)
|
||||
{
|
||||
if (game?.Players.IsInGameDealer(state.Mobile) != true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var direction = GetDirection(pvSrc.ReadByte());
|
||||
var direction = GetDirection(reader.ReadByte());
|
||||
|
||||
var wind = GetWind(pvSrc.ReadByte());
|
||||
var wind = GetWind(reader.ReadByte());
|
||||
|
||||
int y = pvSrc.ReadInt16();
|
||||
int x = pvSrc.ReadInt16();
|
||||
int y = reader.ReadInt16();
|
||||
int x = reader.ReadInt16();
|
||||
|
||||
game.DealerIndicator.Move(new Point2D(x, y), direction, wind);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue