本文整理汇总了C#中GSPacketIn.ReadByte方法的典型用法代码示例。如果您正苦于以下问题:C# GSPacketIn.ReadByte方法的具体用法?C# GSPacketIn.ReadByte怎么用?C# GSPacketIn.ReadByte使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GSPacketIn
的用法示例。
在下文中一共展示了GSPacketIn.ReadByte方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandlePacket
public void HandlePacket(GameClient client, GSPacketIn packet)
{
ushort playerID = packet.ReadShort(); // no use for that.
// house is null, return
var house = client.Player.CurrentHouse;
if(house == null)
return;
// grab all valid changes
var changes = new List<int>();
for (int i = 0; i < 10; i++)
{
int swtch = packet.ReadByte();
int change = packet.ReadByte();
if (swtch != 255)
{
changes.Add(change);
}
}
// apply changes
if (changes.Count > 0)
{
house.Edit(client.Player, changes);
}
}
示例2: HandlePacket
public void HandlePacket(GameClient client, GSPacketIn packet)
{
ushort housenumber = packet.ReadShort();
var index = (byte) packet.ReadByte();
var unk1 = (byte) packet.ReadByte();
// house is null, return
var house = HouseMgr.GetHouse(housenumber);
if (house == null)
return;
// player is null, return
if (client.Player == null)
return;
// rotation only works for inside items
if (!client.Player.InHouse)
return;
// no permission to change the interior, return
if (!house.CanChangeInterior(client.Player, DecorationPermissions.Add))
return;
var pak = new GSTCPPacketOut(client.Out.GetPacketCode(eServerPackets.HouseDecorationRotate));
pak.WriteShort(housenumber);
pak.WriteByte(index);
pak.WriteByte(0x01);
client.Out.SendTCP(pak);
}
示例3: HandlePacket
public void HandlePacket(GameClient client, GSPacketIn packet)
{
int rc4 = packet.ReadByte();
byte clientType = (byte)packet.ReadByte();
client.ClientType = (GameClient.eClientType)(clientType & 0x0F);
client.ClientAddons = (GameClient.eClientAddons)(clientType & 0xF0);
byte major = (byte)packet.ReadByte();
byte minor = (byte)packet.ReadByte();
byte build = (byte)packet.ReadByte();
if(rc4==1)
{
//DOLConsole.Log("SBox=\n");
//DOLConsole.LogDump(client.PacketProcessor.Encoding.SBox);
packet.Read(((PacketEncoding168)client.PacketProcessor.Encoding).SBox,0,256);
((PacketEncoding168)client.PacketProcessor.Encoding).EncryptionState=PacketEncoding168.eEncryptionState.PseudoRC4Encrypted;
//DOLConsole.WriteLine(client.Socket.RemoteEndPoint.ToString()+": SBox set!");
//DOLConsole.Log("SBox=\n");
//DOLConsole.LogDump(((PacketEncoding168)client.PacketProcessor.Encoding).SBox);
}
else
{
//Send the crypt key to the client
client.Out.SendVersionAndCryptKey();
}
}
示例4: HandlePacket
public void HandlePacket(GameClient client, GSPacketIn packet)
{
int permissionSlot = packet.ReadByte();
int newPermissionLevel = packet.ReadByte();
ushort houseNumber = packet.ReadShort();
// house is null, return
var house = HouseMgr.GetHouse(houseNumber);
if (house == null)
return;
// player is null, return
if (client.Player == null)
return;
// can't set permissions unless you're the owner.
if (!house.HasOwnerPermissions(client.Player) && client.Account.PrivLevel <= 1)
return;
// check if we're setting or removing permissions
if (newPermissionLevel == 100)
{
house.RemovePermission(permissionSlot);
}
else
{
house.AdjustPermissionSlot(permissionSlot, newPermissionLevel);
}
}
示例5: HandlePacket
public void HandlePacket(GameClient client, GSPacketIn packet)
{
int flagSpeedData = packet.ReadShort();
int heading = packet.ReadShort();
if (client.Version > GameClient.eClientVersion.Version171)
{
int xOffsetInZone = packet.ReadShort();
int yOffsetInZone = packet.ReadShort();
int currentZoneID = packet.ReadShort();
int realZ = packet.ReadShort();
Zone newZone = WorldMgr.GetZone((ushort) currentZoneID);
if (newZone == null)
{
if (Log.IsWarnEnabled)
Log.Warn("Unknown zone in UseSpellHandler: " + currentZoneID + " player: " + client.Player.Name);
}
else
{
client.Player.X = newZone.XOffset + xOffsetInZone;
client.Player.Y = newZone.YOffset + yOffsetInZone;
client.Player.Z = realZ;
client.Player.MovementStartTick = Environment.TickCount;
}
}
int spellLevel = packet.ReadByte();
int spellLineIndex = packet.ReadByte();
client.Player.Heading = (ushort) (heading & 0xfff);
new UseSpellAction(client.Player, flagSpeedData, spellLevel, spellLineIndex).Start(1);
}
示例6: HandlePacket
public void HandlePacket(GameClient client, GSPacketIn packet)
{
var aggroState = (byte) packet.ReadByte(); // 1-Aggressive, 2-Deffensive, 3-Passive
var walkState = (byte) packet.ReadByte(); // 1-Follow, 2-Stay, 3-GoTarg, 4-Here
var command = (byte) packet.ReadByte(); // 1-Attack, 2-Release
//[Ganrod] Nidel: Animist can removed his TurretFnF without MainPet.
if (client.Player.TargetObject != null && command == 2 && client.Player.ControlledBrain == null &&
client.Player.CharacterClass.ID == (int) eCharacterClass.Animist)
{
var turret = client.Player.TargetObject as TurretPet;
if (turret != null && turret.Brain is TurretFNFBrain && client.Player.IsControlledNPC(turret))
{
//release
new HandlePetCommandAction(client.Player, 0, 0, 2).Start(1);
return;
}
}
//[Ganrod] Nidel: Call only if player has controllednpc
if (client.Player.ControlledBrain != null)
{
new HandlePetCommandAction(client.Player, aggroState, walkState, command).Start(1);
return;
}
}
示例7: HandlePacket
public void HandlePacket(GameClient client, GSPacketIn packet)
{
ushort keepId = packet.ReadShort();
ushort wallId = packet.ReadShort();
int hookpointID = packet.ReadShort();
ushort itemslot = packet.ReadShort();
int payType = packet.ReadByte();//gold RP BP contrat???
int unk2 = packet.ReadByte();
int unk3 = packet.ReadByte();
int unk4 = packet.ReadByte();
// client.Player.Out.SendMessage("x="+unk2+"y="+unk3+"z="+unk4,eChatType.CT_Say,eChatLoc.CL_SystemWindow);
AbstractGameKeep keep = GameServer.KeepManager.GetKeepByID(keepId);
if (keep == null) return;
GameKeepComponent component = keep.KeepComponents[wallId] as GameKeepComponent;
if (component == null) return;
/*GameKeepHookPoint hookpoint = component.HookPoints[hookpointID] as GameKeepHookPoint;
if (hookpoint == null) return 1;
*/
HookPointInventory inventory = null;
if(hookpointID > 0x80) inventory = HookPointInventory.YellowHPInventory; //oil
else if(hookpointID > 0x60) inventory = HookPointInventory.GreenHPInventory;//big siege
else if(hookpointID > 0x40) inventory = HookPointInventory.LightGreenHPInventory; //small siege
else if (hookpointID > 0x20) inventory = HookPointInventory.BlueHPInventory;//npc
else inventory = HookPointInventory.RedHPInventory;//guard
if (inventory != null)
{
HookPointItem item = inventory.GetItem(itemslot);
if (item != null)
item.Invoke(client.Player, payType, component.HookPoints[hookpointID] as GameKeepHookPoint, component);
}
}
示例8: HandlePacket
public void HandlePacket(GameClient client, GSPacketIn packet)
{
if (client.Player == null)
return;
int slot = packet.ReadByte();
int unk1 = packet.ReadByte();
ushort unk2 = packet.ReadShort();
uint price = packet.ReadInt();
GameConsignmentMerchant con = client.Player.ActiveConMerchant;
House house = HouseMgr.GetHouse(con.HouseNumber);
if (house == null)
return;
if (!house.HasOwnerPermissions(client.Player))
return;
int dbSlot = (int)eInventorySlot.Consignment_First + slot;
InventoryItem item = GameServer.Database.SelectObject<InventoryItem>("OwnerID = '" + client.Player.DBCharacter.ObjectId + "' AND SlotPosition = '" + dbSlot.ToString() + "'");
if (item != null)
{
item.SellPrice = (int)price;
GameServer.Database.SaveObject(item);
}
else
{
client.Player.TempProperties.setProperty(NEW_PRICE, (int)price);
}
// another update required here,currently the player needs to reopen the window to see the price, thats why we msg him
client.Out.SendMessage("New price set! (open the merchant window again to see the price)", eChatType.CT_System, eChatLoc.CL_SystemWindow);
}
示例9: HandlePacket
public void HandlePacket(GameClient client, GSPacketIn packet)
{
int unk1 = packet.ReadByte();
int position = packet.ReadByte();
ushort housenumber = packet.ReadShort();
ushort angle = packet.ReadShort();
ushort unk2 = packet.ReadShort();
// rotation only works for inside items
if (!client.Player.InHouse)
return;
// house is null, return
var house = HouseMgr.GetHouse(housenumber);
if (house == null)
return;
// player is null, return
if (client.Player == null)
return;
// no permission to change the interior, return
if (!house.CanChangeInterior(client.Player, DecorationPermissions.Add))
return;
if (house.IndoorItems.ContainsKey(position) == false)
return;
// grab the item in question
IndoorItem iitem = house.IndoorItems[position];
if (iitem == null)
{
client.Player.Out.SendMessage("error: id was null", eChatType.CT_Help, eChatLoc.CL_SystemWindow);
return;
} //should this ever happen?
// adjust the item's roation
int old = iitem.Rotation;
iitem.Rotation = (iitem.Rotation + angle)%360;
if (iitem.Rotation < 0)
{
iitem.Rotation = 360 + iitem.Rotation;
}
iitem.DatabaseItem.Rotation = iitem.Rotation;
// save item
GameServer.Database.SaveObject(iitem.DatabaseItem);
ChatUtil.SendSystemMessage(client,
string.Format("Interior decoration rotated from {0} degrees to {1}", old, iitem.Rotation));
// update all players in the house.
foreach (GamePlayer plr in house.GetAllPlayersInHouse())
{
plr.Client.Out.SendFurniture(house, position);
}
}
示例10: HandlePacket
public void HandlePacket(GameClient client, GSPacketIn packet)
{
int flagSpeedData = packet.ReadShort();
int index = packet.ReadByte();
int type = packet.ReadByte();
new UseSkillAction(client.Player, flagSpeedData, index, type).Start(1);
}
示例11: HandlePacket
public void HandlePacket(GameClient client, GSPacketIn packet)
{
var mode = (byte) packet.ReadByte();
bool userAction = packet.ReadByte() == 0;
// set to 0 if user pressed the button, set to 1 if client decided to stop attack
new AttackRequestHandler(client.Player, mode != 0, userAction).Start(1);
}
示例12: HandlePacket
public void HandlePacket(GameClient client, GSPacketIn packet)
{
ushort data1 = packet.ReadShort();
ushort data2 = packet.ReadShort();
ushort data3 = packet.ReadShort();
var messageType = (byte) packet.ReadByte();
var response = (byte) packet.ReadByte();
new DialogBoxResponseAction(client.Player, data1, data2, data3, messageType, response).Start(1);
}
示例13: HandlePacket
public void HandlePacket(GameClient client, GSPacketIn packet)
{
if (client == null || client.Player == null)
return;
if ((client.Player.TargetObject is IGameInventoryObject) == false)
return;
MarketSearch.SearchData search = new MarketSearch.SearchData();
search.name = packet.ReadString(64);
search.slot = (int)packet.ReadInt();
search.skill = (int)packet.ReadInt();
search.resist = (int)packet.ReadInt();
search.bonus = (int)packet.ReadInt();
search.hp = (int)packet.ReadInt();
search.power = (int)packet.ReadInt();
search.proc = (int)packet.ReadInt();
search.qtyMin = (int)packet.ReadInt();
search.qtyMax = (int)packet.ReadInt();
search.levelMin = (int)packet.ReadInt();
search.levelMax = (int)packet.ReadInt();
search.priceMin = (int)packet.ReadInt();
search.priceMax = (int)packet.ReadInt();
search.visual = (int)packet.ReadInt();
search.page = (byte)packet.ReadByte();
byte unk1 = (byte)packet.ReadByte();
short unk2 = (short)packet.ReadShort();
byte unk3 = 0;
byte unk4 = 0;
byte unk5 = 0;
byte unk6 = 0;
byte unk7 = 0;
byte unk8 = 0;
if (client.Version >= GameClient.eClientVersion.Version198)
{
// Dunnerholl 2009-07-28 Version 1.98 introduced new options to Market search. 12 Bytes were added, but only 7 are in usage so far in my findings.
// update this, when packets change and keep in mind, that this code reflects only the 1.98 changes
search.armorType = search.page; // page is now used for the armorType (still has to be logged, i just checked that 2 means leather, 0 = standard
search.damageType = (byte)packet.ReadByte(); // 1=crush, 2=slash, 3=thrust
unk3 = (byte)packet.ReadByte();
unk4 = (byte)packet.ReadByte();
unk5 = (byte)packet.ReadByte();
search.playerCrafted = (byte)packet.ReadByte(); // 1 = show only Player crafted, 0 = all
// 3 bytes unused
packet.Skip(3);
search.page = (byte)packet.ReadByte(); // page is now sent here
unk6 = (byte)packet.ReadByte();
unk7 = (byte)packet.ReadByte();
unk8 = (byte)packet.ReadByte();
}
search.clientVersion = client.Version.ToString();
(client.Player.TargetObject as IGameInventoryObject).SearchInventory(client.Player, search);
}
示例14: HandlePacket
//rewritten by Corillian so if it doesn't work you know who to yell at ;)
public void HandlePacket(GameClient client, GSPacketIn packet)
{
byte grouped = (byte)packet.ReadByte();
ArrayList list = new ArrayList();
if (grouped != 0x00)
{
ArrayList groups = GroupMgr.ListGroupByStatus(0x00);
if (groups != null)
{
foreach (Group group in groups)
if (GameServer.ServerRules.IsAllowedToGroup(group.Leader, client.Player, true))
{
list.Add(group.Leader);
}
}
}
ArrayList Lfg = GroupMgr.LookingForGroupPlayers();
if (Lfg != null)
{
foreach (GamePlayer player in Lfg)
{
if (player != client.Player && GameServer.ServerRules.IsAllowedToGroup(client.Player, player, true))
{
list.Add(player);
}
}
}
client.Out.SendFindGroupWindowUpdate((GamePlayer[])list.ToArray(typeof(GamePlayer)));
}
示例15: HandlePacket
public void HandlePacket(GameClient client, GSPacketIn packet)
{
byte isok =(byte) packet.ReadByte();
byte repair =(byte) packet.ReadByte();
byte combine =(byte) packet.ReadByte();
packet.ReadByte();//unknow
ITradeWindow trade = client.Player.TradeWindow;
if (trade == null)
return;
if (isok==0)
{
trade.CloseTrade();
}
else if(isok==1)
{
if(trade.Repairing != (repair == 1)) trade.Repairing = (repair == 1);
if(trade.Combine != (combine == 1)) trade.Combine = (combine == 1);
ArrayList tradeSlots = new ArrayList(10);
for (int i=0;i<10;i++)
{
int slotPosition = packet.ReadByte();
InventoryItem item = client.Player.Inventory.GetItem((eInventorySlot)slotPosition);
if(item != null && ((item.IsDropable && item.IsTradable) || (client.Player.CanTradeAnyItem || client.Player.TradeWindow.Partner.CanTradeAnyItem)))
{
tradeSlots.Add(item);
}
}
trade.TradeItems = tradeSlots;
packet.ReadShort();
int[] tradeMoney = new int[5];
for(int i=0;i<5;i++)
tradeMoney[i]=packet.ReadShort();
long money = Money.GetMoney(tradeMoney[0],tradeMoney[1],tradeMoney[2],tradeMoney[3],tradeMoney[4]);
trade.TradeMoney = money;
trade.TradeUpdate();
}
else if (isok == 2)
{
trade.AcceptTrade();
}
}