本文整理汇总了C#中Game.Base.Packets.GSPacketIn.ReadInt方法的典型用法代码示例。如果您正苦于以下问题:C# GSPacketIn.ReadInt方法的具体用法?C# GSPacketIn.ReadInt怎么用?C# GSPacketIn.ReadInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Game.Base.Packets.GSPacketIn
的用法示例。
在下文中一共展示了GSPacketIn.ReadInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleCommand
public void HandleCommand(BaseGame game, Player player, GSPacketIn packet)
{
if (game.GameState != eGameState.Playing || player.GetSealState())
return;
int type = packet.ReadByte();
int place = packet.ReadInt();
int templateID = packet.ReadInt();
ItemTemplateInfo template = ItemMgr.FindItemTemplate(templateID);
if (player.CanUseItem(template))
{
//if (player.CurrentBall.ID == 3 && template.TemplateID == 10003)
// return;
//if (player.PlayerDetail.UsePropItem(game, type, place, templateID, player.IsLiving))
//{
// if (player.UseItem(template) == false)
// {
// BaseGame.log.Error("Using prop error");
// }
//}
if (player.PlayerDetail.UsePropItem(game, type, place, templateID, player.IsLiving))
{
if (player.UseItem(template) == false)
{
BaseGame.log.Error("Using prop error");
}
}
else
{
player.UseItem(template);
}
}
}
示例2: HandlePacket
public int HandlePacket(GameClient client, GSPacketIn packet)
{
int hallType=packet.ReadInt();
int updateType=packet.ReadInt();
int page=packet.ReadInt();
if(page<0)page=0;
page++;
BaseRoom[] list = RoomMgr.Rooms;
List<BaseRoom> tempList = new List<BaseRoom>();
//int maxRoomInList = 7;
var count = 0;
for (int i = 0; i < list.Length; i++)
{
if (!list[i].IsEmpty )
{
// if(!list[i].IsPlaying&&cou) countPr
count++;
if (count < page * numberRoomInPage&&count>(page-1)*numberRoomInPage)
tempList.Add(list[i]);
else if(count > page * numberRoomInPage) {
break;
}
//m_player.Out.SendUpdateRoomList(list[i]);
}
}
if(tempList.Count>0) client.Out.SendUpdateRoomList(tempList);
return 0;
}
示例3: HandlePacket
public int HandlePacket(GameClient client, GSPacketIn packet)
{
int gold = 0;
int money = 0;
int offer = 0;
int gifttoken = 0;
int type = 1;
List<int> needitemsinfo = new List<int>();
int index = packet.ReadInt();
int GoodsID = packet.ReadInt();
ItemInfo item = client.Player.FightBag.GetItemAt(index);
if (item != null)
{
client.Player.FightBag.RemoveItem(item);
ShopItemInfo shopitem = Bussiness.Managers.ShopMgr.GetShopItemInfoById(GoodsID); //获取商品信息
needitemsinfo = ItemInfo.SetItemType(shopitem, type, ref gold, ref money, ref offer, ref gifttoken); //商品的购买条件
client.Player.AddGold(gold);
}
return 0;
}
示例4: HandlePacket
public int HandlePacket(GameClient client, GSPacketIn packet)
{
//TODO: 储存物品
if (client.Player.PlayerCharacter.ConsortiaID == 0)
return 1;
int bagType = packet.ReadByte();
int bagPlace = packet.ReadInt();
int storePlace = packet.ReadInt();
if (bagType == 0 && bagPlace < 31)
return 1;
ConsortiaInfo info = ConsortiaMgr.FindConsortiaInfo(client.Player.PlayerCharacter.ConsortiaID);
if (info != null)
{
PlayerInventory storeBag = client.Player.StoreBag;
PlayerInventory toBag = client.Player.GetInventory((eBageType)bagType);
// client.Player.StoreBag.MoveToStore(storeBag, storePlace, bagPlace, toBag, info.StoreLevel * 10);
}
return 0;
}
示例5: HandleCommand
public bool HandleCommand(TankGameLogicProcessor process, GamePlayer player, GSPacketIn packet)
{
//if (player.CurrentGame.Data.CurrentIndex == player || player.CurrentGame.Data.Players[player].State == TankGameState.FRIST || player.CurrentGame.Data.Players[player].State == TankGameState.DEAD)
if (player.CurrentGame.Data.CurrentIndex == player || player.CurrentGame.Data.Players[player].State == TankGameState.DEAD)
{
player.CurrentGame.ReturnPacket(player, packet);
player.CurrentGame.Data.Players[player].SetXY(packet.ReadInt(), packet.ReadInt());
//player.CurrentGame.Data.Players[player].StartMoving();
//GameServer.log.Error(string.Format("StopMoving {0} {1}",player.CurrentGame.Data.Players[player].X,player.CurrentGame.Data.Players[player].Y));
//由于同步问题,暂时去掉
//if (player.CurrentGame != null)
// player.CurrentGame.Data.Players[player].StartMoving();
// GameServer.log.Error(string.Format("StopMoving {0} {1}", player.CurrentGame.Data.Players[player].X, player.CurrentGame.Data.Players[player].Y));
return true;
}
else
{
//if (player.CurrentGame.Data.CurrentFire != null)
//{
//int x = packet.ReadInt();
//player.CurrentGame.Data.Players[player].PosY = packet.ReadInt();
//}
//return true;
}
return false;
}
示例6: HandlePacket
public int HandlePacket(GameClient client, GSPacketIn packet)
{
if (client.Player.PlayerCharacter.ConsortiaID == 0)
return 0;
//Type 1表示商城,2表示铁匠铺
bool result = false;
string msg = "ConsortiaEquipControlHandler.Fail";
ConsortiaEquipControlInfo info = new ConsortiaEquipControlInfo();
info.ConsortiaID = client.Player.PlayerCharacter.ConsortiaID;
using (ConsortiaBussiness db = new ConsortiaBussiness())
{
for (int i = 0; i < 5; i++)
{
info.Riches = packet.ReadInt();
info.Type = 1;
info.Level = i + 1;
db.AddAndUpdateConsortiaEuqipControl(info, client.Player.PlayerCharacter.ID, ref msg);
}
info.Riches = packet.ReadInt();
info.Type = 2;
info.Level = 0;
db.AddAndUpdateConsortiaEuqipControl(info, client.Player.PlayerCharacter.ID, ref msg);
msg = "ConsortiaEquipControlHandler.Success";
result = true;
}
packet.WriteBoolean(result);
packet.WriteString(LanguageMgr.GetTranslation(msg));
client.Out.SendTCP(packet);
return 0;
}
示例7: HandlePacket
public int HandlePacket(GameClient client, GSPacketIn packet)
{
if (client.Player.CurrentRoom != null && client.Player == client.Player.CurrentRoom.Host && !client.Player.CurrentRoom.IsPlaying)
{
//string name = packet.ReadString();
//string pwd = packet.ReadString();
int mapId = packet.ReadInt();
if (mapId == 10000) return 0;
byte rT = packet.ReadByte();
eRoomType roomType;
if (rT == 10) roomType = eRoomType.Exploration;
else
roomType = (eRoomType)rT;
byte timeType = packet.ReadByte();
byte hardLevel = packet.ReadByte();
int levelLimits = packet.ReadInt();
//eRoomType roomType = (eRoomType)packet.ReadByte();
//eTeamType teamType = (eTeamType)packet.ReadByte();
RoomMgr.UpdateRoomGameType(client.Player.CurrentRoom, packet, roomType, timeType, (eHardLevel)hardLevel, levelLimits, mapId);
//RoomMgr.StartGame(client.Player.CurrentRoom);
}
return 0;
}
示例8: HandlePacket
public int HandlePacket(GameClient client, GSPacketIn packet)
{
eBageType bagType = (eBageType)packet.ReadByte();
int place = packet.ReadInt();
int count = packet.ReadInt();
client.Player.BeginChanges();
PlayerInventory bag = client.Player.GetInventory(bagType);
if (bag != null && bag.GetItemAt(place) != null)
{
ItemTemplateInfo item = bag.GetItemAt(place).Template;
int price = count * item.ReclaimValue;
if (item.ReclaimType == 2)
{
client.Player.AddGiftToken(price);
//client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ItemReclaimHandler.Success1", price));
}
if (item.ReclaimType == 1)
{
client.Player.AddGold(price);
//client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ItemReclaimHandler.Success2", price));
}
bag.RemoveItemAt(place);
}
else
{
client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ItemReclaimHandler.NoSuccess"));
return 1;
}
client.Player.CommitChanges();
//LogMgr.LogMoneyAdd(LogMoneyType.Shop, LogMoneyType.Shop_Continue, client.Player.PlayerCharacter.ID, 25, client.Player.PlayerCharacter.Money, 25, 0, 0, 0, "牌子编号",));
//client.Player.SaveIntoDatabase();//保存到数据库
return 0;
}
示例9: HandleCommand
public void HandleCommand(BaseGame game, Player player, GSPacketIn packet)
{
if (player.IsLiving == false)
{
player.TargetPoint.X = packet.ReadInt();
player.TargetPoint.Y = packet.ReadInt();
}
}
示例10: HandleConsortiaAlly
public void HandleConsortiaAlly(GSPacketIn pkg)
{
BaseGame game = GameMgr.FindGame(pkg.ClientID);
if (game != null)
{
game.ConsortiaAlly = pkg.ReadInt();
game.RichesRate = pkg.ReadInt();
}
}
示例11: HandleGameRoomCreate
public void HandleGameRoomCreate(GSPacketIn pkg)
{
int roomId = pkg.ReadInt();
int gameType = pkg.ReadInt();
int count = pkg.ReadInt();
IGamePlayer[] players = new IGamePlayer[count];
for (int i = 0; i < count; i++)
{
PlayerInfo info = new PlayerInfo();
info.ID = pkg.ReadInt();
info.Attack = pkg.ReadInt();
info.Defence = pkg.ReadInt();
info.Agility = pkg.ReadInt();
info.Luck = pkg.ReadInt();
double baseAttack = pkg.ReadDouble();
double baseDefence = pkg.ReadDouble();
double baseAgility = pkg.ReadDouble();
double baseBlood = pkg.ReadDouble();
int templateId = pkg.ReadInt();
ItemTemplateInfo itemTemplate = ItemMgr.FindItemTemplate(templateId);
ItemInfo item = new ItemInfo(itemTemplate);
players[i] = new ProxyPlayer(info, item, baseAttack, baseDefence, baseAgility, baseBlood);
}
ProxyRoomMgr.CreateRoom(players, roomId, this);
}
示例12: HandleCommand
public bool HandleCommand(TankHotSpringLogicProcessor process, GamePlayer player, GSPacketIn packet)
{
if (player.CurrentHotSpringRoom != null)
{
int num = packet.ReadInt();
if (ItemMgr.FindItemTemplate(packet.ReadInt()) != null)
{
}
}
return false;
}
示例13: HandlePacket
public int HandlePacket(GameClient client, GSPacketIn packet)
{
bool result = packet.ReadBoolean();
int UserID = packet.ReadInt();
int AnswerId = packet.ReadInt(); //答复对话框ID
//先判断自已有没有结婚
if (result && client.Player.PlayerCharacter.IsMarried)
{
client.Player.Out.SendMessage(eMessageType.ChatERROR, LanguageMgr.GetTranslation("MarryApplyReplyHandler.Msg2"));
}
using (PlayerBussiness db = new PlayerBussiness())
{
PlayerInfo tempSpouse = db.GetUserSingleByUserID(UserID);
//发送好人卡
if (!result)
{
SendGoodManCard(tempSpouse.NickName, tempSpouse.ID, client.Player.PlayerCharacter.NickName, client.Player.PlayerCharacter.ID, db);
GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(tempSpouse.ID);
}
//判断对方有没有结婚
if (tempSpouse == null || tempSpouse.Sex == client.Player.PlayerCharacter.Sex)
{
return 1;
}
if (tempSpouse.IsMarried)
{
client.Player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("MarryApplyReplyHandler.Msg3"));
}
MarryApplyInfo info = new MarryApplyInfo();
info.UserID = UserID;
info.ApplyUserID = client.Player.PlayerCharacter.ID;
info.ApplyUserName = client.Player.PlayerCharacter.NickName;
info.ApplyType = 2;
info.LoveProclamation = "";
info.ApplyResult = result;
int id = 0;
if (db.SavePlayerMarryNotice(info, AnswerId, ref id))
{
if (result)
{
client.Player.Out.SendMarryApplyReply(client.Player, tempSpouse.ID, tempSpouse.NickName, result, false, id);
client.Player.LoadMarryProp();
SendSYSMessages(client.Player, tempSpouse);
}
GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(tempSpouse.ID);
return 0;
}
}
return 1;
}
示例14: HandleCommand
public bool HandleCommand(TankMarryLogicProcessor process, GamePlayer player, GSPacketIn packet)
{
if (player.CurrentMarryRoom != null && player.CurrentMarryRoom.RoomState == eRoomState.FREE)
{
player.X = packet.ReadInt();
player.Y = packet.ReadInt();
//0 player.CurrentMarryRoom.ReturnPacket(player, packet);
player.CurrentMarryRoom.ReturnPacketForScene(player, packet);
return true;
}
return false;
}
示例15: HandleCommand
public bool HandleCommand(TankMarryLogicProcessor process, GamePlayer player, GSPacketIn packet)
{
if(player.CurrentMarryRoom != null)
{
player.X = packet.ReadInt();
player.Y = packet.ReadInt();
return true;
}
return false;
}