本文整理汇总了C#中Game.Base.Packets.GSPacketIn.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# GSPacketIn.Clone方法的具体用法?C# GSPacketIn.Clone怎么用?C# GSPacketIn.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Game.Base.Packets.GSPacketIn
的用法示例。
在下文中一共展示了GSPacketIn.Clone方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandlePacket
public int HandlePacket(GameClient client, GSPacketIn packet)
{
GSPacketIn pkg = packet.Clone();
//pkg.ClearContext();
if (client.Player.PlayerCharacter.HasBagPassword && client.Player.PlayerCharacter.IsLocked)
{
client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("Bag.Locked"));
return 0;
}
int id = packet.ReadInt();
int senderID;
using (PlayerBussiness db = new PlayerBussiness())
{
if (db.DeleteMail(client.Player.PlayerCharacter.ID, id, out senderID))
{
client.Out.SendMailResponse(senderID,eMailRespose.Receiver);
pkg.WriteBoolean(true);
}
else
{
pkg.WriteBoolean(false);
}
}
client.Out.SendTCP(pkg);
return 0;
}
示例2: HandlePacket
//修改: Xiaov
//时间: 2009-11-4
//描述: 修改邮件的已读未读标志<已测试>
public int HandlePacket(GameClient client, GSPacketIn packet)
{
GSPacketIn pkg = packet.Clone();
pkg.ClearContext();
int id = packet.ReadInt();
using (PlayerBussiness db = new PlayerBussiness())
{
MailInfo mes = db.GetMailSingle(client.Player.PlayerCharacter.ID, id);
if (mes != null && !mes.IsRead)
{
mes.IsRead = true;
if (mes.Type < 100)
{
mes.ValidDate = 3 * 24;
mes.SendTime = DateTime.Now;
}
db.UpdateMail(mes, mes.Money);
pkg.WriteBoolean(true);
}
else
{
pkg.WriteBoolean(false);
}
}
client.Out.SendTCP(pkg);
return 0;
}
示例3: HandlePacket
//修改: Xiaov
//时间: 2009-11-7
//描述: 用户与用户之间私聊<已测试>
public int HandlePacket(GameClient client, GSPacketIn packet)
{
int receiverID = packet.ReadInt();
//int senderID = packet.ReadInt();
string receiver = packet.ReadString();
string sender = packet.ReadString();
string msg = packet.ReadString();
bool isAutoReply = packet.ReadBoolean();
if (receiverID == 0)
{
using (PlayerBussiness db = new PlayerBussiness())
{
PlayerInfo info = db.GetUserSingleByNickName(receiver);
if (info != null)
receiverID = info.ID;
}
}
if (receiverID != 0)
{
GSPacketIn pkg = packet.Clone();
pkg.ClearContext();
pkg.WriteInt(receiverID);
pkg.ClientID = (client.Player.PlayerCharacter.ID);
//pkg.WriteInt(senderID);
pkg.WriteString(receiver);
pkg.WriteString(sender);
pkg.WriteString(msg);
pkg.WriteBoolean(false);
GamePlayer player = Managers.WorldMgr.GetPlayerById(receiverID);
if (player != null)
{
if (player.IsBlackFriend(client.Player.PlayerCharacter.ID))
return 1;
player.Out.SendTCP(pkg);
}
else
{
GameServer.Instance.LoginServer.SendPacket(pkg);
}
client.Out.SendTCP(pkg);
}
else
{
client.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("UserPrivateChatHandler.NoUser"));
}
return 1;
}
示例4: HandlePacket
public int HandlePacket(GameClient client, GSPacketIn packet)
{
GSPacketIn pkg = packet.Clone();
//if (DateTime.Now.Date != client.Player.PlayerCharacter.LastDate.Date)
//{
pkg.WriteBoolean(true);
//}
//else
//{
// pkg.WriteBoolean(false);
//}
client.SendTCP(pkg);
return 0;
}
示例5: HandlePacket
public int HandlePacket(GameClient client, GSPacketIn packet)
{
packet = packet.Clone();
packet.ClearContext();
int num = packet.ReadInt();
int num2 = packet.ReadInt();
int num3 = packet.ReadInt();
int num4 = packet.ReadInt();
int num5 = packet.ReadInt();
int num6 = packet.ReadInt();
int num7 = packet.ReadInt();
client.Player.CurrentHotSpringRoom = new HotSpringRoom(new HotSpringRoomInfo(), new TankHotSpringLogicProcessor());
client.Player.CurrentHotSpringRoom.ProcessData(client.Player, packet);
return 0;
}
示例6: HandleCommand
public bool HandleCommand(TankGameLogicProcessor process, GamePlayer player, GSPacketIn packet)
{
if (player.CurrentGame.Data.CurrentIndex == player || player.CurrentGame.Data.Players[player].State == TankGameState.DEAD)
{
GSPacketIn pkg = packet.Clone();
pkg.ClientID = player.PlayerCharacter.ID;
player.CurrentGame.SendToPlayerExceptSelf(pkg, player);
byte type = packet.ReadByte();
int tx = packet.ReadInt();
int ty = packet.ReadInt();
byte dir = packet.ReadByte();
bool isLiving = packet.ReadBoolean();
Player p = player.CurrentGame.Data.Players[player];
switch (type)
{
case 0:
case 1:
//p.X = tx;
//p.Y = ty;
p.SetXY(tx, ty);
if (player.CurrentGame != null)
{
p.StartMoving();
if (p.Y - ty > 1 || p.IsLiving != isLiving)
{
//GameServer.log.Error(string.Format("修正掉落: 动作类型 {0} 原始Y:{1} 最新Y:{2}", type, ty, p.Y));
//把服务器修正的掉落指令和客户掉落指令加以区分。
pkg = player.Out.SendPlayerMove(3, p.X, p.Y, 0, p.IsLiving);
player.CurrentGame.SendToPlayerExceptSelf(pkg, player);
}
}
break;
case 2:
if (player.CurrentGame.Data.Players[player].State == TankGameState.DEAD)
{
p.EndX = tx;
p.EndY = ty;
}
break;
}
return true;
}
return false;
}
示例7: HandlePacket
public int HandlePacket(GameClient client, GSPacketIn packet)
{
byte unknow = packet.ReadByte();
int id = packet.ReadInt();
if (client.Player.PlayerCharacter.AnswerSite < id)
{
List<ItemInfo> infos = null;
client.Player.PlayerCharacter.AnswerSite = id;
if (DropInventory.AnswerDrop(id, ref infos))
{
int gold = 0;
int money = 0;
int giftToken = 0;
int medal = 0;
foreach (ItemInfo info in infos)
{
ItemInfo.FindSpecialItemInfo(info, ref gold, ref money, ref giftToken, ref medal);
//if ((info != null) && (info.Template.BagType == eBageType.PropBag))
//{
client.Player.MainBag.AddTemplate(info, info.Count);
//}
client.Player.AddGold(gold);
client.Player.AddMoney(money);
client.Player.AddGiftToken(giftToken);
client.Player.AddMedal(medal);
LogMgr.LogMoneyAdd(LogMoneyType.Award, LogMoneyType.Award_Answer, client.Player.PlayerCharacter.ID, giftToken, client.Player.PlayerCharacter.Money, money, 0, 0,0, "", "", "");
}
}
}
GSPacketIn pkg = packet.Clone();
pkg.ClearContext();
pkg.WriteInt(client.Player.PlayerCharacter.AnswerSite);
for (int i = 0; i < client.Player.PlayerCharacter.AnswerSite; i++)
{
pkg.WriteByte(unknow);
}
client.Player.Out.SendTCP(pkg);
return 1;
}
示例8: HandlePacket
public int HandlePacket(GameClient client, GSPacketIn packet)
{
//修改: Xiaov
//时间: 2009-11-4
//描述: 小喇叭<未测试>
ItemInfo item = client.Player.PropBag.GetItemByCategoryID(0,11, 4);
if (item != null)
{
//item.Count--;
//if (item.Count <= 0)
//{
// client.Player.RemoveItem(item);
//}
//else
//{
client.Player.PropBag.RemoveCountFromStack(item, 1);
// }
int senderID = packet.ReadInt();
string senderName = packet.ReadString();
string msg = packet.ReadString();
GSPacketIn pkg = packet.Clone();
pkg.ClearContext();
pkg.ClientID = (client.Player.PlayerCharacter.ID);
pkg.WriteInt(client.Player.PlayerCharacter.ID);
pkg.WriteString(client.Player.PlayerCharacter.NickName);
pkg.WriteString(msg);
GamePlayer[] players = Managers.WorldMgr.GetAllPlayers();
foreach (GamePlayer p in players)
{
p.Out.SendTCP(pkg);
}
}
return 0;
}
示例9: HandleCommand
public bool HandleCommand(TankHotSpringLogicProcessor process, GamePlayer player, GSPacketIn packet)
{
if ((player.CurrentHotSpringRoom != null) && (player.CurrentHotSpringRoom.RoomState == eRoomState.FREE))
{
if (player.PlayerCharacter.ID != player.CurrentHotSpringRoom.Info.PlayerID)
{
return false;
}
GSPacketIn pkg = packet.Clone();
pkg.ClearContext();
GamePlayer playerById = WorldMgr.GetPlayerById(packet.ReadInt());
if (((playerById != null) && (playerById.CurrentRoom == null)) && (playerById.CurrentHotSpringRoom == null))
{
pkg.WriteByte((byte)HotSpringCmdType.HOTSPRING_ROOM_INVITE);
pkg.WriteInt(player.CurrentHotSpringRoom.Info.RoomID);
playerById.Out.SendTCP(pkg);
return true;
}
}
return false;
}
示例10: HandleCommand
public void HandleCommand(BaseGame game, Player player, GSPacketIn packet)
{
if (player.IsAttacking)
{
GSPacketIn pkg = packet.Clone();
pkg.ClientID = player.PlayerDetail.PlayerCharacter.ID;
pkg.Parameter1 = player.Id;
game.SendToAll(pkg, player.PlayerDetail);
byte type = packet.ReadByte();
int tx = packet.ReadInt();
int ty = packet.ReadInt();
byte dir = packet.ReadByte();
bool isLiving = packet.ReadBoolean();
//Console.WriteLine("isLiving : {0}, tx : {1}, ty : {2}, type : {3}, playerId : {4}", isLiving, tx, ty, type, player.Id);
switch (type)
{
case 0:
case 1:
//p.X = tx;
//p.Y = ty;
// if (player.PlayerDetail.PlayerCharacter.NickName == "jacken123")
// Console.WriteLine(player.PlayerDetail.PlayerCharacter.NickName + "X坐标" + player.X.ToString() + "Y坐标" + player.Y.ToString());
player.SetXY(tx, ty);
player.StartMoving();
// if (player.PlayerDetail.PlayerCharacter.NickName == "jacken123")
// Console.WriteLine(string.Format("修正掉落: 动作类型 {0} 原始Y:{1} 最新Y:{2}", type, ty, player.Y));
if (player.Y - ty > 1 || player.IsLiving != isLiving)
{
//Console.WriteLine("player.IsLiving : {0}, playerId : {1}", player.IsLiving, player.Id);
//把服务器修正的掉落指令和客户掉落指令加以区分。
Console.WriteLine("玩家移动掉落:"+player.IsLiving.ToString());
game.SendPlayerMove(player, 3, player.X, player.Y, 0, player.IsLiving, null);
}
break;
case 2:
break;
}
}
}
示例11: HandleCommand
public void HandleCommand(BaseGame game, Player player, GSPacketIn packet)
{
if (player.IsLiving || player.IsAttacking)
{
GSPacketIn pkg = packet.Clone();
pkg.ClientID = player.Id;
game.SendToAll(pkg, player.PlayerDetail);
byte type = packet.ReadByte();
int tx = packet.ReadInt();
int ty = packet.ReadInt();
byte dir = packet.ReadByte();
bool isLiving = packet.ReadBoolean();
switch (type)
{
case 0:
case 1:
//p.X = tx;
//p.Y = ty;
player.SetXY(tx, ty);
player.StartMoving();
if (player.Y - ty > 1 || player.IsLiving != isLiving)
{
//GameServer.log.Error(string.Format("修正掉落: 动作类型 {0} 原始Y:{1} 最新Y:{2}", type, ty, p.Y));
//把服务器修正的掉落指令和客户掉落指令加以区分。
pkg = player.PlayerDetail.Out.SendPlayerMove(player,3, player.X, player.Y, 0, player.IsLiving);
game.SendToAll(pkg, player.PlayerDetail);
}
break;
case 2:
if (player.IsLiving == false)
{
player.TargetPoint = new Point(tx, ty);
}
break;
}
}
}
示例12: HandlePacket
public int HandlePacket(GameClient client,GSPacketIn packet )
{
ItemInfo item = client.Player.PropBag.GetItemByCategoryID(0,11, 5);
if (item != null)
{
//item.Count--;
//if (item.Count <= 0)
//{
// //client.Player.RemoveAllItem(item, false, Game.Server.Statics.ItemRemoveType.Use, item.GetBagType());
// client.Player.RemoveItem(item);
//}
//else
//{
// client.Player.PropBag.RefreshItem(item);
client.Player.PropBag.RemoveCountFromStack(item,1);
// }
int senderID = packet.ReadInt();
string senderName = packet.ReadString();
string msg = packet.ReadString();
GSPacketIn pkg = packet.Clone();
pkg.ClearContext();
pkg.ClientID = (client.Player.PlayerCharacter.ID);
pkg.WriteInt(client.Player.PlayerCharacter.ID);
pkg.WriteString(client.Player.PlayerCharacter.NickName);
pkg.WriteString(msg);
GameServer.Instance.LoginServer.SendPacket(pkg);
GamePlayer[] players = Managers.WorldMgr.GetAllPlayers();
foreach (GamePlayer p in players)
{
p.Out.SendTCP(pkg);
}
}
return 0;
}
示例13: HandlePacket
public int HandlePacket(GameClient client, GSPacketIn packet)
{
GSPacketIn pkg = packet.Clone();
pkg.ClearContext();
byte page = packet.ReadByte();
byte count = packet.ReadByte();
GamePlayer[] players = Managers.WorldMgr.GetAllPlayersNoGame();
int total = players.Length;
byte length = total > count ? count : (byte)total;
pkg.WriteByte(length);
for (int i = page * count; i < page * count + length; i++)
{
PlayerInfo info = players[i % total].PlayerCharacter;
pkg.WriteInt(info.ID);
pkg.WriteString(info.NickName);
pkg.WriteByte(info.typeVIP);
pkg.WriteInt(info.VIPLevel);
pkg.WriteBoolean(info.Sex);
pkg.WriteInt(info.Grade);
pkg.WriteInt(info.ConsortiaID);
pkg.WriteString(info.ConsortiaName);// == null ? "" : info.ConsortiaName);
pkg.WriteInt(info.Offer);
pkg.WriteInt(info.Win);
pkg.WriteInt(info.Total);
pkg.WriteInt(info.Escape);
pkg.WriteInt(info.Repute);
pkg.WriteInt(info.FightPower);
pkg.WriteBoolean(info.IsOldPlayer);//_loc_6.isOld = _loc_2.readBoolean();
}
client.Out.SendTCP(pkg);
return 0;
}
示例14: HandleCommand
public bool HandleCommand(TankMarryLogicProcessor process, GamePlayer player, GSPacketIn packet)
{
if (player.CurrentMarryRoom == null || player.CurrentMarryRoom.RoomState != eRoomState.FREE)
{
return false;
}
if (player.CurrentMarryRoom.Info.GuestInvite == false)
{
if( player.PlayerCharacter.ID != player.CurrentMarryRoom.Info.GroomID && player.PlayerCharacter.ID != player.CurrentMarryRoom.Info.BrideID)
{
return false;
}
}
GSPacketIn pkg = packet.Clone();
pkg.ClearContext();
int id = packet.ReadInt();
GamePlayer invitedplayer = Managers.WorldMgr.GetPlayerById(id);
if (invitedplayer != null && invitedplayer.CurrentRoom == null && invitedplayer.CurrentMarryRoom == null)
{
pkg.WriteByte((byte)MarryCmdType.INVITE);
pkg.WriteInt(player.PlayerCharacter.ID);
pkg.WriteString(player.PlayerCharacter.NickName);
pkg.WriteInt(player.CurrentMarryRoom.Info.ID);
//pkg.WriteInt(player.CurrentMarryRoom.Info.MapIndex);
pkg.WriteString(player.CurrentMarryRoom.Info.Name);
pkg.WriteString(player.CurrentMarryRoom.Info.Pwd);
pkg.WriteInt(player.MarryMap);
invitedplayer.Out.SendTCP(pkg);
return true;
}
return false;
}
示例15: HandlePacket
//修改: Xiaov
//时间: 2009-11-7
//描述: 进入结婚场景<已测试>
public int HandlePacket(GameClient client, GSPacketIn packet)
{
GSPacketIn pkg = packet.Clone();
if (WorldMgr.MarryScene.AddPlayer(client.Player))
{
pkg.WriteBoolean(true);
}
else
{
pkg.WriteBoolean(false);
}
client.Out.SendTCP(pkg);
if (client.Player.CurrentMarryRoom==null)
{
MarryRoom[] list = MarryRoomMgr.GetAllMarryRoom();
foreach (MarryRoom g in list)
{
client.Player.Out.SendMarryRoomInfo(client.Player, g);
}
}
return 0;
//if (client.Player.CurrentScene == WorldMgr.MarryScene)
//{
// MarryRoom[] list = MarryRoomMgr.GetAllMarryRoom();
// foreach (MarryRoom g in list)
// {
// client.Player.Out.SendMarryRoomInfo(client.Player, g);
// }
// client.Out.SendPingTime();
//}
}