Renames pvSrc (#277)
This commit is contained in:
parent
4211835b5d
commit
24bf97282e
12 changed files with 533 additions and 533 deletions
|
|
@ -330,13 +330,13 @@ namespace Server.Items
|
|||
/*public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
|
||||
|
||||
if (m_Title?.Length > 0)
|
||||
list.Add( 1060658, "Title\t{0}", m_Title ); // ~1_val~: ~2_val~
|
||||
|
||||
|
||||
if (m_Author?.Length > 0)
|
||||
list.Add( 1060659, "Author\t{0}", m_Author ); // ~1_val~: ~2_val~
|
||||
|
||||
|
||||
if (m_Pages?.Length > 0)
|
||||
list.Add( 1060660, "Pages\t{0}", m_Pages.Length ); // ~1_val~: ~2_val~
|
||||
}*/
|
||||
|
|
@ -366,70 +366,70 @@ namespace Server.Items
|
|||
PacketHandlers.Register(0x93, 99, true, OldHeaderChange);
|
||||
}
|
||||
|
||||
public static void OldHeaderChange(NetState state, PacketReader pvSrc)
|
||||
public static void OldHeaderChange(NetState state, PacketReader reader)
|
||||
{
|
||||
var from = state.Mobile;
|
||||
|
||||
if (!(World.FindItem(pvSrc.ReadUInt32()) is BaseBook book) || !book.Writable ||
|
||||
if (!(World.FindItem(reader.ReadUInt32()) is BaseBook book) || !book.Writable ||
|
||||
!from.InRange(book.GetWorldLocation(), 1) || !book.IsAccessibleTo(from))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pvSrc.Seek(4, SeekOrigin.Current); // Skip flags and page count
|
||||
reader.Seek(4, SeekOrigin.Current); // Skip flags and page count
|
||||
|
||||
var title = pvSrc.ReadStringSafe(60);
|
||||
var author = pvSrc.ReadStringSafe(30);
|
||||
var title = reader.ReadStringSafe(60);
|
||||
var author = reader.ReadStringSafe(30);
|
||||
|
||||
book.Title = Utility.FixHtml(title);
|
||||
book.Author = Utility.FixHtml(author);
|
||||
}
|
||||
|
||||
public static void HeaderChange(NetState state, PacketReader pvSrc)
|
||||
public static void HeaderChange(NetState state, PacketReader reader)
|
||||
{
|
||||
var from = state.Mobile;
|
||||
|
||||
if (!(World.FindItem(pvSrc.ReadUInt32()) is BaseBook book) || !book.Writable ||
|
||||
if (!(World.FindItem(reader.ReadUInt32()) is BaseBook book) || !book.Writable ||
|
||||
!from.InRange(book.GetWorldLocation(), 1) || !book.IsAccessibleTo(from))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pvSrc.Seek(4, SeekOrigin.Current); // Skip flags and page count
|
||||
reader.Seek(4, SeekOrigin.Current); // Skip flags and page count
|
||||
|
||||
int titleLength = pvSrc.ReadUInt16();
|
||||
int titleLength = reader.ReadUInt16();
|
||||
|
||||
if (titleLength > 60)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var title = pvSrc.ReadUTF8StringSafe(titleLength);
|
||||
var title = reader.ReadUTF8StringSafe(titleLength);
|
||||
|
||||
int authorLength = pvSrc.ReadUInt16();
|
||||
int authorLength = reader.ReadUInt16();
|
||||
|
||||
if (authorLength > 30)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var author = pvSrc.ReadUTF8StringSafe(authorLength);
|
||||
var author = reader.ReadUTF8StringSafe(authorLength);
|
||||
|
||||
book.Title = Utility.FixHtml(title);
|
||||
book.Author = Utility.FixHtml(author);
|
||||
}
|
||||
|
||||
public static void ContentChange(NetState state, PacketReader pvSrc)
|
||||
public static void ContentChange(NetState state, PacketReader reader)
|
||||
{
|
||||
var from = state.Mobile;
|
||||
|
||||
if (!(World.FindItem(pvSrc.ReadUInt32()) is BaseBook book) || !book.Writable ||
|
||||
if (!(World.FindItem(reader.ReadUInt32()) is BaseBook book) || !book.Writable ||
|
||||
!from.InRange(book.GetWorldLocation(), 1) || !book.IsAccessibleTo(from))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int pageCount = pvSrc.ReadUInt16();
|
||||
int pageCount = reader.ReadUInt16();
|
||||
|
||||
if (pageCount > book.PagesCount)
|
||||
{
|
||||
|
|
@ -438,13 +438,13 @@ namespace Server.Items
|
|||
|
||||
for (var i = 0; i < pageCount; ++i)
|
||||
{
|
||||
int index = pvSrc.ReadUInt16();
|
||||
int index = reader.ReadUInt16();
|
||||
|
||||
if (index >= 1 && index <= book.PagesCount)
|
||||
{
|
||||
--index;
|
||||
|
||||
int lineCount = pvSrc.ReadUInt16();
|
||||
int lineCount = reader.ReadUInt16();
|
||||
|
||||
if (lineCount <= 8)
|
||||
{
|
||||
|
|
@ -452,7 +452,7 @@ namespace Server.Items
|
|||
|
||||
for (var j = 0; j < lineCount; ++j)
|
||||
{
|
||||
if ((lines[j] = pvSrc.ReadUTF8StringSafe()).Length >= 80)
|
||||
if ((lines[j] = reader.ReadUTF8StringSafe()).Length >= 80)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -334,20 +334,20 @@ namespace Server.Items
|
|||
PacketHandlers.Register(0x56, 11, true, OnMapCommand);
|
||||
}
|
||||
|
||||
private static void OnMapCommand(NetState state, PacketReader pvSrc)
|
||||
private static void OnMapCommand(NetState state, PacketReader reader)
|
||||
{
|
||||
var from = state.Mobile;
|
||||
|
||||
if (!(World.FindItem(pvSrc.ReadUInt32()) is MapItem map))
|
||||
if (!(World.FindItem(reader.ReadUInt32()) is MapItem map))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int command = pvSrc.ReadByte();
|
||||
int number = pvSrc.ReadByte();
|
||||
int command = reader.ReadByte();
|
||||
int number = reader.ReadByte();
|
||||
|
||||
int x = pvSrc.ReadInt16();
|
||||
int y = pvSrc.ReadInt16();
|
||||
int x = reader.ReadInt16();
|
||||
int y = reader.ReadInt16();
|
||||
|
||||
switch (command)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -232,13 +232,13 @@ namespace Server.Items
|
|||
PacketHandlers.Register(0x71, 0, true, BBClientRequest);
|
||||
}
|
||||
|
||||
public static void BBClientRequest(NetState state, PacketReader pvSrc)
|
||||
public static void BBClientRequest(NetState state, PacketReader reader)
|
||||
{
|
||||
var from = state.Mobile;
|
||||
|
||||
int packetID = pvSrc.ReadByte();
|
||||
int packetID = reader.ReadByte();
|
||||
|
||||
if (!(World.FindItem(pvSrc.ReadUInt32()) is BaseBulletinBoard board) || !board.CheckRange(from))
|
||||
if (!(World.FindItem(reader.ReadUInt32()) is BaseBulletinBoard board) || !board.CheckRange(from))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -246,23 +246,23 @@ namespace Server.Items
|
|||
switch (packetID)
|
||||
{
|
||||
case 3:
|
||||
BBRequestContent(from, board, pvSrc);
|
||||
BBRequestContent(from, board, reader);
|
||||
break;
|
||||
case 4:
|
||||
BBRequestHeader(from, board, pvSrc);
|
||||
BBRequestHeader(from, board, reader);
|
||||
break;
|
||||
case 5:
|
||||
BBPostMessage(from, board, pvSrc);
|
||||
BBPostMessage(from, board, reader);
|
||||
break;
|
||||
case 6:
|
||||
BBRemoveMessage(from, board, pvSrc);
|
||||
BBRemoveMessage(from, board, reader);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void BBRequestContent(Mobile from, BaseBulletinBoard board, PacketReader pvSrc)
|
||||
public static void BBRequestContent(Mobile from, BaseBulletinBoard board, PacketReader reader)
|
||||
{
|
||||
if (!(World.FindItem(pvSrc.ReadUInt32()) is BulletinMessage msg) || msg.Parent != board)
|
||||
if (!(World.FindItem(reader.ReadUInt32()) is BulletinMessage msg) || msg.Parent != board)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -270,9 +270,9 @@ namespace Server.Items
|
|||
from.Send(new BBMessageContent(board, msg));
|
||||
}
|
||||
|
||||
public static void BBRequestHeader(Mobile from, BaseBulletinBoard board, PacketReader pvSrc)
|
||||
public static void BBRequestHeader(Mobile from, BaseBulletinBoard board, PacketReader reader)
|
||||
{
|
||||
if (!(World.FindItem(pvSrc.ReadUInt32()) is BulletinMessage msg) || msg.Parent != board)
|
||||
if (!(World.FindItem(reader.ReadUInt32()) is BulletinMessage msg) || msg.Parent != board)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -280,9 +280,9 @@ namespace Server.Items
|
|||
from.Send(new BBMessageHeader(board, msg));
|
||||
}
|
||||
|
||||
public static void BBPostMessage(Mobile from, BaseBulletinBoard board, PacketReader pvSrc)
|
||||
public static void BBPostMessage(Mobile from, BaseBulletinBoard board, PacketReader reader)
|
||||
{
|
||||
var thread = World.FindItem(pvSrc.ReadUInt32()) as BulletinMessage;
|
||||
var thread = World.FindItem(reader.ReadUInt32()) as BulletinMessage;
|
||||
|
||||
if (thread != null && thread.Parent != board)
|
||||
{
|
||||
|
|
@ -315,14 +315,14 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
var subject = pvSrc.ReadUTF8StringSafe(pvSrc.ReadByte());
|
||||
var subject = reader.ReadUTF8StringSafe(reader.ReadByte());
|
||||
|
||||
if (subject.Length == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var lines = new string[pvSrc.ReadByte()];
|
||||
var lines = new string[reader.ReadByte()];
|
||||
|
||||
if (lines.Length == 0)
|
||||
{
|
||||
|
|
@ -331,15 +331,15 @@ namespace Server.Items
|
|||
|
||||
for (var i = 0; i < lines.Length; ++i)
|
||||
{
|
||||
lines[i] = pvSrc.ReadUTF8StringSafe(pvSrc.ReadByte());
|
||||
lines[i] = reader.ReadUTF8StringSafe(reader.ReadByte());
|
||||
}
|
||||
|
||||
board.PostMessage(from, thread, subject, lines);
|
||||
}
|
||||
|
||||
public static void BBRemoveMessage(Mobile from, BaseBulletinBoard board, PacketReader pvSrc)
|
||||
public static void BBRemoveMessage(Mobile from, BaseBulletinBoard board, PacketReader reader)
|
||||
{
|
||||
if (!(World.FindItem(pvSrc.ReadUInt32()) is BulletinMessage msg) || msg.Parent != board)
|
||||
if (!(World.FindItem(reader.ReadUInt32()) is BulletinMessage msg) || msg.Parent != board)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue