本文整理汇总了C#中PacketIn.ReadUInt32方法的典型用法代码示例。如果您正苦于以下问题:C# PacketIn.ReadUInt32方法的具体用法?C# PacketIn.ReadUInt32怎么用?C# PacketIn.ReadUInt32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PacketIn
的用法示例。
在下文中一共展示了PacketIn.ReadUInt32方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DropItem
public static void DropItem(Client client, PacketIn packet)
{
int IID = (int)packet.ReadUInt32();
PlayerItem pItem = PlayerItem.GetItem(IID);
int quantity = (int)packet.ReadUInt32();
//check if the item exists
if (pItem == null)
{
Hackshield.AddOffense(client, OffenseSeverity.IncorrectPacketDetails);
return;
}
//check if player owns the item
if (pItem.PID != client.Character.Player.PID)
{
Hackshield.AddOffense(client, OffenseSeverity.IncorrectPacketDetails);
return;
}
CodeHandler handler = CodeManager.GetHandler(pItem.Item.Code);
handler.Drop(pItem, quantity, client.Character, client);
}
示例2: DropItem
public static void DropItem(Client client, PacketIn packet)
{
int itemId = (int)packet.ReadUInt32();
PlayerItem item = PlayerItem.Get(itemId);
int quantity = (int)packet.ReadUInt32();
if(item == null) {
ServerConsole.WriteLine(
"Player #{0} attempted to drop non-existant item #{1} !",
client.Character.Player.PlayerId,
itemId
);
return;
}
if(item.PlayerId != client.Character.Player.PlayerId) {
ServerConsole.WriteLine(
"Player #{0} attempted to drop item that belongs to #{1}!",
client.Character.Player.PlayerId,
item.PlayerId
);
return;
}
uint worldId = World.NewId();
Server.WorldDrops[worldId] = new Drop(item,client.Character,quantity,worldId);
client.Send(new Packets.SpawnDrop(Server.WorldDrops[worldId]),"Spawn Drop");
client.Send(new Packets.RemoveFromInventory(item.ItemId,quantity),"Update Inventory");
client.Character.Player.Inventory.Items.Remove(item);
}
示例3: EquipItem
public static void EquipItem(Client client, PacketIn packet)
{
int itemId = (int)packet.ReadUInt32();
PlayerItem item = PlayerItem.Get(itemId);
if(item == null) {
ServerConsole.WriteLine(
System.Drawing.Color.Red,
"Player #{0} attempted to equip non-existant item!",
client.Character.Player.PlayerId
);
return;
}
if(item.PlayerId != client.Character.Player.PlayerId) {
ServerConsole.WriteLine(System.Drawing.Color.Red,
"Player #{0} attempted to equip item that belongs to #{1}!",
client.Character.Player.PlayerId,
item.PlayerId
);
return;
}
if(!item.Wearable) {
ServerConsole.WriteLine(
System.Drawing.Color.Red,
"Player #{0} attempted to equip non-equipable item #{1}!",
item.PlayerId,item.ItemId
);
return;
}
PlayerItem.Equip(item);
client.Send(new Packets.EquipItem(item),"Equip Item");
}
示例4: BuyNpcItem
public static void BuyNpcItem(Client client, PacketIn packet)
{
int npcWorldId = (int)packet.ReadUInt32();
byte v1 = packet.ReadByte();
byte amount = packet.ReadByte();
int totalPrice = 0;
ushort[] items = new ushort[amount];
ushort[] amounts = new ushort[amount];
for(int i=0;i<amount;i++)
{
items[i] = packet.ReadUShort();
amounts[i] = packet.ReadUShort();
// TODO, calculate correct price
totalPrice += 100 * amounts[i];
}
// TODO, add geon amount check
for(int i=0;i<amount;i++)
{
// should be items, not player items
PlayerItem item = PlayerItem.Get((int)items[i]);
client.Character.Player.Inventory.Items.Add(item);
// update AddToInventory with generic item-object
client.Send(new Packets.AddToInventory((int)items[i],(int)amounts[i]),"Buy Item");
// update amout of geons !
}
}
示例5: SkillRequest
public static void SkillRequest(Client client,PacketIn packet)
{
byte skillId = packet.ReadByte();
uint playerId = packet.ReadUInt32();
client.SkillHandler.Request(skillId,playerId);
client.Send(new Packets.SkillExecute(client.Character,skillId,1));
}
示例6: NpcTalk
public static void NpcTalk(Client client, PacketIn packet)
{
Npc npc = Server.WorldNPCs[packet.ReadUInt32()];
if(npc != null)
{
if(npc.Talk != 0) {
//ServerConsole.WriteLine("Talking with npc #{0} returning Talk #{1}",npc.NpcId,npc.Talk);
client.Send(new Packets.OpenDialog(npc.Talk));
}
}
}
示例7: PickupDrop
public static void PickupDrop(Client client, PacketIn packet)
{
UInt32 worldId = packet.ReadUInt32();
Drop drop;
//check if the drop exists
if (ServerWorld.Entities.ContainsKey(worldId))
{
drop = ServerWorld.Entities[worldId] as Drop;
}
else
{
return;
}
CodeHandler handler = CodeManager.GetHandler(drop.PlayerItem.Item.Code);
handler.Pickup(drop, client.Character, client);
}
示例8: PickupDrop
public static void PickupDrop(Client client, PacketIn packet)
{
Drop drop;
try {
drop = Server.WorldDrops[packet.ReadUInt32()];
} catch(Exception) {
return;
}
PlayerItem item = PlayerItem.Get(drop.PlayerItem.ItemId);
client.Character.Player.Inventory.Items.Add(item);
client.Send(new Packets.PickupDrop(item),"Pickup Drop");
client.Send(new Packets.AddToInventory(drop.ItemId,drop.Quantity),"Update Inventory");
client.Send(new Packets.UnspawnDrop(drop),"Unspawn Drop");
Server.WorldDrops.Remove((uint)drop.WorldId);
World.FreeId((uint)drop.WorldId);
}
示例9: RestorePlayer
public static void RestorePlayer(Client client, PacketIn packet)
{
int pid = (int)packet.ReadUInt32();
client.RestorePlayer(pid);
client.Send(new Packets.DisconnectMessage(Packets.DISCONNECT_MESSAGE.RESTORING_CHARACTER_COMPLETED));
}
示例10: PlayerSelect
public static void PlayerSelect(Client client, PacketIn packet)
{
client.PlayerSelect((int)packet.ReadUInt32());
}
示例11: DeletePlayer
public static void DeletePlayer(Client client, PacketIn packet)
{
int pid = (int)packet.ReadUInt32();
client.DeletePlayer(pid);
client.SendPlayerList();
}