本文整理汇总了C#中GSPacketIn.ReadShort方法的典型用法代码示例。如果您正苦于以下问题:C# GSPacketIn.ReadShort方法的具体用法?C# GSPacketIn.ReadShort怎么用?C# GSPacketIn.ReadShort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GSPacketIn
的用法示例。
在下文中一共展示了GSPacketIn.ReadShort方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandlePacket
public void HandlePacket(GameClient client, GSPacketIn packet)
{
uint x = packet.ReadInt();
uint y = packet.ReadInt();
ushort id = packet.ReadShort();
ushort item_slot = packet.ReadShort();
if (client.Player.TargetObject == null)
{
client.Out.SendMessage("You must select an NPC to sell to.", eChatType.CT_Merchant, eChatLoc.CL_SystemWindow);
return;
}
lock (client.Player.Inventory)
{
InventoryItem item = client.Player.Inventory.GetItem((eInventorySlot)item_slot);
if (item == null)
return;
int itemCount = Math.Max(1, item.Count);
int packSize = Math.Max(1, item.PackSize);
if (client.Player.TargetObject is GameMerchant)
{
//Let the merchant choos how to handle the trade.
((GameMerchant)client.Player.TargetObject).OnPlayerSell(client.Player, item);
}
else if (client.Player.TargetObject is GameLotMarker)
{
((GameLotMarker)client.Player.TargetObject).OnPlayerSell(client.Player, item);
}
}
}
示例2: HandlePacket
public void HandlePacket(GameClient client, GSPacketIn packet)
{
ushort unk1 = packet.ReadShort();
ushort questIndex = packet.ReadShort();
ushort unk2 = packet.ReadShort();
ushort unk3 = packet.ReadShort();
AbstractQuest quest = null;
int index = 0;
lock (client.Player.QuestList)
{
foreach (AbstractQuest q in client.Player.QuestList)
{
// ignore completed quests
if (q.Step == -1)
continue;
if (index == questIndex)
{
quest = q;
break;
}
index++;
}
}
if (quest != null)
quest.AbortQuest();
}
示例3: 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);
}
}
示例4: HandlePacket
public void HandlePacket(GameClient client, GSPacketIn packet)
{
ushort keepId = packet.ReadShort();
ushort wallId = packet.ReadShort();
ushort responce = packet.ReadShort();
int HPindex = packet.ReadShort();
AbstractGameKeep keep = GameServer.KeepManager.GetKeepByID(keepId);
if (keep == null || !(GameServer.ServerRules.IsSameRealm(client.Player, (GameKeepComponent)keep.KeepComponents[wallId], true) || client.Account.PrivLevel > 1))
return;
if (responce == 0x00)//show info
client.Out.SendKeepComponentInteract(((GameKeepComponent)keep.KeepComponents[wallId]));
else if (responce == 0x01)// click on hookpoint button
client.Out.SendKeepComponentHookPoint(((GameKeepComponent)keep.KeepComponents[wallId]), HPindex);
else if (responce == 0x02)//select an hookpoint
{
if (client.Account.PrivLevel > 1)
client.Out.SendMessage("DEBUG : selected hookpoint id " + HPindex, eChatType.CT_Say, eChatLoc.CL_SystemWindow);
GameKeepComponent hp = keep.KeepComponents[wallId] as GameKeepComponent;
client.Out.SendClearKeepComponentHookPoint(hp, HPindex);
client.Out.SendHookPointStore(hp.HookPoints[HPindex] as GameKeepHookPoint);
}
}
示例5: 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);
}
}
示例6: HandlePacket
public void HandlePacket(GameClient client, GSPacketIn packet)
{
uint X = packet.ReadInt();
uint Y = packet.ReadInt();
ushort id = packet.ReadShort();
ushort item_slot = packet.ReadShort();
new AppraiseActionHandler(client.Player, item_slot).Start(1);
}
示例7: HandlePacket
public void HandlePacket(GameClient client, GSPacketIn packet)
{
ushort checkerOID = packet.ReadShort();
ushort targetOID = packet.ReadShort();
ushort response = packet.ReadShort();
ushort unknow = packet.ReadShort();
new HandleCheckAction(client.Player, checkerOID, targetOID, response).Start(1);
}
示例8: 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);
}
示例9: HandlePacket
public void HandlePacket(GameClient client, GSPacketIn packet)
{
// packet.Skip(10);
uint playerX = packet.ReadInt();
uint playerY = packet.ReadInt();
int sessionId = packet.ReadShort();
ushort targetOid = packet.ReadShort();
//TODO: utilize these client-sent coordinates to possibly check for exploits which are spoofing position packets but not spoofing them everywhere
new InteractActionHandler(client.Player, targetOid).Start(1);
}
示例10: HandlePacket
public void HandlePacket(GameClient client, GSPacketIn packet)
{
int pid = packet.ReadShort();
int housenumber = packet.ReadShort();
int enter = packet.ReadByte();
// house is null, return
House house = HouseMgr.GetHouse(housenumber);
if (house == null)
return;
new EnterLeaveHouseAction(client.Player, house, enter).Start(1);
}
示例11: HandlePacket
public void HandlePacket(GameClient client, GSPacketIn packet)
{
int pid = packet.ReadShort();
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;
// player has no owner permissions and isn't a GM or admin, return
if (!house.HasOwnerPermissions(client.Player) && client.Account.PrivLevel <= 1)
return;
// send out the house permissions
using (var pak = new GSTCPPacketOut(client.Out.GetPacketCode(eServerPackets.HousingPermissions)))
{
pak.WriteByte(HousingConstants.MaxPermissionLevel); // number of permissions ?
pak.WriteByte(0x00); // unknown
pak.WriteShort((ushort)house.HouseNumber);
foreach (var entry in house.PermissionLevels)
{
var level = entry.Key;
var permission = entry.Value;
pak.WriteByte((byte)level);
pak.WriteByte(permission.CanEnterHouse ? (byte)1 : (byte)0);
pak.WriteByte(permission.Vault1);
pak.WriteByte(permission.Vault2);
pak.WriteByte(permission.Vault3);
pak.WriteByte(permission.Vault4);
pak.WriteByte(permission.CanChangeExternalAppearance ? (byte)1 : (byte)0);
pak.WriteByte(permission.ChangeInterior);
pak.WriteByte(permission.ChangeGarden);
pak.WriteByte(permission.CanBanish ? (byte)1 : (byte)0);
pak.WriteByte(permission.CanUseMerchants ? (byte)1 : (byte)0);
pak.WriteByte(permission.CanUseTools ? (byte)1 : (byte)0);
pak.WriteByte(permission.CanBindInHouse ? (byte)1 : (byte)0);
pak.WriteByte(permission.ConsignmentMerchant);
pak.WriteByte(permission.CanPayRent ? (byte)1 : (byte)0);
pak.WriteByte(0x00); // ??
}
client.Out.SendTCP(pak);
}
}
示例12: HandlePacket
/// <summary>
/// Handles every received packet
/// </summary>
/// <param name="client">The client that sent the packet</param>
/// <param name="packet">The received packet data</param>
/// <returns></returns>
public void HandlePacket(GameClient client, GSPacketIn packet)
{
ushort targetID = packet.ReadShort();
ushort flags = packet.ReadShort();
/*
* 0x8000 = 'examine' bit
* 0x4000 = LOS1 bit; is 0 if no LOS
* 0x2000 = LOS2 bit; is 0 if no LOS
* 0x0001 = players attack mode bit (not targets!)
*/
new ChangeTargetAction(client.Player, targetID, (flags & (0x4000 | 0x2000)) != 0, (flags & 0x8000) != 0).Start(1);
}
示例13: 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);
}
}
示例14: 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);
}
示例15: 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);
}