本文整理汇总了C#中FrameWork.PacketIn.GetUint16方法的典型用法代码示例。如果您正苦于以下问题:C# PacketIn.GetUint16方法的具体用法?C# PacketIn.GetUint16怎么用?C# PacketIn.GetUint16使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrameWork.PacketIn
的用法示例。
在下文中一共展示了PacketIn.GetUint16方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: F_INTERACT
public static void F_INTERACT(BaseClient client, PacketIn packet)
{
GameClient cclient = client as GameClient;
if (cclient.Plr == null || !cclient.Plr.IsInWorld())
return;
Log.Dump("F_INTERACT", packet.ToArray(), 0, packet.ToArray().Length);
InteractMenu Menu = new InteractMenu();
Menu.Unk = packet.GetUint16();
Menu.Oid = packet.GetUint16();
Menu.Menu = packet.GetUint16();
Menu.Page = packet.GetUint8();
Menu.Num = packet.GetUint8();
Menu.SellCount = packet.GetUint16();
Menu.Count = packet.GetUint16();
Object Obj = cclient.Plr.Region.GetObject(Menu.Oid);
if (Obj == null)
return;
if (Obj.GetDistanceTo(cclient.Plr) > 20)
{
Log.Error("F_INTERACT", "Distance = " + Obj.GetDistanceTo(cclient.Plr));
return;
}
Obj.SendInteract(cclient.Plr, Menu);
}
示例2: F_FLIGHT
public static void F_FLIGHT(BaseClient client, PacketIn packet)
{
GameClient cclient = client as GameClient;
UInt16 TargetOID = packet.GetUint16();
UInt16 State = packet.GetUint16();
Log.Info("F_FLIGHT", "TargetOid = " + TargetOID + ",State=" + State);
if (State == 20) // Flight Master
{
Object Obj = cclient.Plr.Zone.GetObject(TargetOID);
if (Obj == null || !Obj.IsCreature())
{
Log.Error("F_FLIGHT", "Invalid Creature OID : " + TargetOID);
return;
}
UInt16 FlyID = packet.GetUint16();
List<Zone_Taxi> Taxis = WorldMgr.GetTaxis(cclient.Plr);
if (Taxis.Count <= FlyID - 1)
return;
if (!cclient.Plr.RemoveMoney(Taxis[FlyID - 1].Info.Price))
{
cclient.Plr.SendLocalizeString("", GameData.Localized_text.TEXT_MERCHANT_INSUFFICIENT_MONEY_TO_BUY);
return;
}
cclient.Plr.Teleport(Taxis[FlyID - 1].ZoneID, Taxis[FlyID - 1].WorldX, Taxis[FlyID - 1].WorldY, Taxis[FlyID - 1].WorldZ, Taxis[FlyID - 1].WorldO);
}
}
示例3: F_SOCIAL_NETWORK
static public void F_SOCIAL_NETWORK(BaseClient client, PacketIn packet)
{
GameClient cclient = client as GameClient;
if (!cclient.IsPlaying() || !cclient.Plr.IsInWorld())
return;
Player Plr = cclient.Plr;
byte Type = packet.GetUint8();
switch (Type)
{
case 11: // Inspection
{
Player Target = Plr.CbtInterface.GetTarget(GameData.TargetTypes.TARGETTYPES_TARGET_ALLY) as Player;
if (Target == null)
Plr.SendLocalizeString("", GameData.Localized_text.TEXT_SN_LISTS_ERR_PLAYER_NOT_FOUND);
else
Target.ItmInterface.SendInspect(Plr);
}
break;
case 8:
{
packet.Skip(1);
byte NameSize = packet.GetUint8();
packet.Skip(1);
string Name = packet.GetString(NameSize);
byte GuildSize = packet.GetUint8();
packet.Skip(1);
string GuildName = packet.GetString(GuildSize);
packet.Skip(1);
UInt16 Career = packet.GetUint16();
packet.Skip(4);
UInt16 ZoneId = packet.GetUint16();
while (ZoneId > 256)
ZoneId -= 256;
while (packet.GetUint8() != 0xFF) ;
packet.Skip(2 + (ZoneId == 255 ? 0 : 1));
byte MinLevel = packet.GetUint8();
byte MaxLevel = packet.GetUint8();
Plr.SocInterface.SendPlayers(Player.GetPlayers(Name, GuildName, Career, ZoneId, MinLevel, MaxLevel));
} break;
}
}
示例4: F_PLAYER_INFO
static public void F_PLAYER_INFO(BaseClient client, PacketIn packet)
{
GameClient cclient = client as GameClient;
if (cclient.Plr == null || !cclient.Plr.IsInWorld())
return;
packet.GetUint16();
UInt16 Oid = packet.GetUint16();
byte Unk = packet.GetUint8();
byte TargetType = packet.GetUint8();
cclient.Plr.CbtInterface.SetTarget(Oid, (GameData.TargetTypes)TargetType);
}
示例5: F_TRANSFER_ITEM
public static void F_TRANSFER_ITEM(BaseClient client, PacketIn packet)
{
GameClient cclient = client as GameClient;
if (cclient.Plr == null || !cclient.Plr.IsInWorld())
return;
ushort Oid = packet.GetUint16();
ushort To = packet.GetUint16();
ushort From = packet.GetUint16();
ushort Count = packet.GetUint16();
cclient.Plr.ItmInterface.MoveSlot(From, To, Count);
}
示例6: F_USE_ITEM
static public void F_USE_ITEM(BaseClient client, PacketIn packet)
{
GameClient cclient = client as GameClient;
if (!cclient.IsPlaying())
return;
Player Plr = cclient.Plr;
ushort slot = packet.GetUint16();
Item item = Plr.ItmInterface.GetItemInSlot(slot);
if (Plr.Level < item.Info.MinRank)
{
Plr.SendLocalizeString("", GameData.Localized_text.TEST_ITEM_PLAYER_LEVEL_TOO_LOW);
return;
}
else if (Plr.Rank < item.Info.MinRenown)
{
Plr.SendLocalizeString("", GameData.Localized_text.TEST_ITEM_PLAYER_RENOWN_TOO_LOW);
return;
}
if (item.Info.Type == 31 && item.Info.ScriptName == "HealthPotion") // Potion
{
Plr.DealHeal(Plr, (uint)item.Info.MinRank * 100);
Plr.ItmInterface.DeleteItem(slot, 1, true);
}
}
示例7: F_DUMP_STATICS
public static void F_DUMP_STATICS(BaseClient client, PacketIn packet)
{
GameClient cclient = client as GameClient;
if (cclient.Plr == null || !cclient.Plr.IsInWorld())
return;
UInt32 Unk1 = packet.GetUint32();
UInt16 Unk2 = packet.GetUint16();
UInt16 OffX = packet.GetUint16();
UInt16 Unk3 = packet.GetUint16();
UInt16 OffY = packet.GetUint16();
Log.Success("F_DUMP_STATIC", "X=" + OffX + ",Y=" + OffY);
cclient.Plr.SetOffset(OffX, OffY);
}
示例8: F_DO_ABILITY
public static void F_DO_ABILITY(BaseClient client, PacketIn packet)
{
GameClient cclient = client as GameClient;
if (cclient.Plr == null)
return;
UInt32 Unk, Unk2, Unk3 = 0;
UInt16 AbilityID = 0;
Unk = packet.GetUint32();
Unk2 = packet.GetUint32();
Unk3 = packet.GetUint32();
AbilityID = packet.GetUint16();
cclient.Plr.AbtInterface.StartCast(AbilityID);
}
示例9: BuildMail
public void BuildMail(PacketIn packet)
{
Player Plr = GetPlayer();
if (Plr == null)
return;
if (nextSend >= TCPServer.GetTimeStamp())
{
SendResult(GameData.MailResult.TEXT_MAIL_RESULT6);
return;
}
// Recipient read
packet.Skip(1);
byte NameSize = packet.GetUint8();
string Name = packet.GetString(NameSize);
Character Receiver = CharMgr.GetCharacter(Name);
if (Receiver == null)
{
SendResult(GameData.MailResult.TEXT_MAIL_RESULT7);
return;
}
if (Receiver.Name == Plr.Name) // You cannot mail yourself
{
Plr.SendLocalizeString("", GameData.Localized_text.TEXT_PLAYER_CANT_MAIL_YOURSELF);
return;
}
// Subject
byte SubjectSize = packet.GetUint8();
packet.Skip(1);
string Subject = packet.GetString(SubjectSize);
// Message
byte MessageSize = packet.GetUint8();
packet.Skip(1);
string Message = packet.GetString(MessageSize);
// Money
UInt32 money = ByteOperations.ByteSwap.Swap(packet.GetUint32());
// COD?
byte cr = packet.GetUint8();
// Item
byte itemcounts = packet.GetUint8();
if (!Plr.RemoveMoney((cr == 0 ? money : 0) + MAIL_PRICE))
{
SendResult(MailResult.TEXT_MAIL_RESULT8);
return;
}
// Make a Mail
Character_mail CMail = new Character_mail();
CMail.Guid = CharMgr.GenerateMailGUID();
CMail.CharacterId = Receiver.CharacterId;
CMail.CharacterIdSender = Plr._Info.CharacterId;
CMail.SenderName = Plr._Info.Name;
CMail.ReceiverName = Name;
CMail.Title = Subject;
CMail.Content = Message;
CMail.Money = money;
CMail.Cr = true;
CMail.Opened = false;
Log.Debug("Mail", "Itemcount: " + itemcounts + "");
for (byte i = 0; i < itemcounts; ++i)
{
UInt16 itmslot = ByteOperations.ByteSwap.Swap(packet.GetUint16());
packet.Skip(2);
ByteOperations.ByteSwap.Swap(itmslot);
Item itm = Plr.ItmInterface.GetItemInSlot(itmslot);
if (itm != null)
{
CMail.ItemsReqInfo.Add(itm.CharItem);
Plr.ItmInterface.DeleteItem(itmslot, itm.CharItem.Counts, false);
itm.Owner = null;
}
}
SendResult(MailResult.TEXT_MAIL_RESULT4);
CharMgr.Database.AddObject(CMail);
//If player exists let them know they have mail.
Player mailToPlayer = Player.GetPlayer(Name);
if (mailToPlayer != null)
mailToPlayer.MlInterface.AddMail(CMail);
nextSend = (uint)TCPServer.GetTimeStamp() + 5;
}
示例10: F_QUEST
public static void F_QUEST(BaseClient client, PacketIn packet)
{
GameClient cclient = client as GameClient;
UInt16 QuestID = packet.GetUint16();
UInt16 State = packet.GetUint16();
UInt16 Unk1 = packet.GetUint16();
byte Unk2 = packet.GetUint8();
byte Unk3 = packet.GetUint8();
UInt16 Unk4 = packet.GetUint16();
UInt16 CreatureOID = packet.GetUint16();
Creature Crea = cclient.Plr.Region.GetObject(CreatureOID) as Creature;
if (Crea == null)
return;
switch (State)
{
case 1: // Show Quest
{
Log.Info("F_QUEST", "Show Quest : " + QuestID);
if (Crea.QtsInterface.HasQuestStarter(QuestID))
Crea.QtsInterface.BuildQuest(QuestID, cclient.Plr);
} break;
case 2: // Accept Quest
{
Log.Info("F_QUEST", "Accept Quest : " + QuestID);
if (Crea.QtsInterface.HasQuestStarter(QuestID))
{
if (cclient.Plr.QtsInterface.AcceptQuest(QuestID))
{
if (!Crea.QtsInterface.CreatureHasStartQuest(cclient.Plr))
{
Crea.SendRemove(cclient.Plr);
Crea.SendMeTo(cclient.Plr);
}
}
}
}break;
case 3: // Quest Done
{
if (Crea.QtsInterface.hasQuestFinisher(QuestID))
{
Log.Info("F_QUEST", "Done Quest : " + QuestID);
if (cclient.Plr.QtsInterface.DoneQuest(QuestID))
{
Crea.SendRemove(cclient.Plr);
Crea.SendMeTo(cclient.Plr);
}
else
{
Crea.QtsInterface.BuildQuest(QuestID, cclient.Plr);
}
}
} break;
case 4: // Quest Done Info
{
if (Crea.QtsInterface.hasQuestFinisher(QuestID))
Crea.QtsInterface.SendQuestDoneInfo(cclient.Plr, QuestID);
else if (Crea.QtsInterface.HasQuestStarter(QuestID))
{
Log.Info("F_QUEST", "InProgress Quest : " + QuestID);
Crea.QtsInterface.SendQuestInProgressInfo(cclient.Plr, QuestID);
}
} break;
case 5: // Select Quest Reward
{
Log.Info("F_QUEST", "Select Quest Reward: " + QuestID);
if (Crea.QtsInterface.hasQuestFinisher(QuestID))
cclient.Plr.QtsInterface.SelectRewards(QuestID, Unk3);
} break;
};
}
示例11: F_REQUEST_QUEST
public static void F_REQUEST_QUEST(BaseClient client, PacketIn packet)
{
GameClient cclient = client as GameClient;
Log.Success("HandlePacket", "Handle F_REQUEST_QUEST");
UInt16 QuestID = packet.GetUint16();
byte State = packet.GetUint8();
switch (State)
{
case 0: // Show Quest
{
Log.Info("F_REQUEST_QUEST", "Show Quest : " + QuestID);
cclient.Plr.QtsInterface.SendQuest(QuestID);
} break;
case 1: // Decline Quest
{
Log.Info("F_REQUEST_QUEST", "Decline Quest : " + QuestID);
cclient.Plr.QtsInterface.DeclineQuest(QuestID);
} break;
case 2: // Send To Group
{
} break;
};
}
示例12: F_REQUEST_CHAR
public static void F_REQUEST_CHAR(BaseClient client, PacketIn packet)
{
GameClient cclient = client as GameClient;
cclient.State = (int)eClientState.CharScreen;
UInt16 Operation = packet.GetUint16();
if (Operation == 0x2D58)
{
PacketOut Out = new PacketOut((byte)Opcodes.F_REQUEST_CHAR_ERROR);
Out.WriteByte((byte)CharMgr.GetAccountRealm(cclient._Account.AccountId));
cclient.SendTCP(Out);
}
else{
PacketOut Out = new PacketOut((byte)Opcodes.F_REQUEST_CHAR_RESPONSE);
Out.FillString(cclient._Account.Username, 25); // account name
Out.WriteByte(0xFF);
Out.WriteByte(CharMgr.MAX_SLOT); // Max characters 20
Out.WriteUInt16(0); // unk
Out.WriteByte(0); // name changing tokens, 1 will enable button
Out.WriteUInt16(0); //unk
byte[] Chars = CharMgr.BuildCharactersList(cclient._Account.AccountId);
Out.Write(Chars, 0, Chars.Length);
cclient.SendTCP(Out);
}
}
示例13: F_DUMP_STATICS
public static void F_DUMP_STATICS(BaseClient client, PacketIn packet)
{
GameClient cclient = client as GameClient;
if (cclient.Plr == null || !cclient.Plr.IsInWorld())
return;
UInt32 Unk1 = packet.GetUint32();
UInt16 Unk2 = packet.GetUint16();
UInt16 OffX = packet.GetUint16();
UInt16 Unk3 = packet.GetUint16();
UInt16 OffY = packet.GetUint16();
cclient.Plr.SetOffset(OffX, OffY);
if (!cclient.Plr.IsActive)
{
cclient.Plr.IsActive = true;
}
}
示例14: F_CREATE_CHARACTER
static public void F_CREATE_CHARACTER(BaseClient client, PacketIn packet)
{
GameClient cclient = client as GameClient;
CreateInfo Info;
Info.slot = packet.GetUint8();
Info.race = packet.GetUint8();
Info.career = packet.GetUint8();
Info.sex = packet.GetUint8();
Info.model = packet.GetUint8();
Info.NameSize = packet.GetUint16();
packet.Skip(2);
byte[] Traits = new byte[8];
packet.Read(Traits, 0, Traits.Length);
packet.Skip(7);
string Name = packet.GetString(Info.NameSize);
if (Name.Length > 2 && !CharMgr.NameIsUsed(Name))
{
CharacterInfo CharInfo = CharMgr.GetCharacterInfo(Info.career);
if (CharInfo == null)
{
Log.Error("ON_CREATE", "Can not find career :" + Info.career);
}
else
{
Log.Success("OnCreate", "New Character : " + Name);
Character Char = new Character();
Char.AccountId = cclient._Account.AccountId;
Char.bTraits = Traits;
Char.Career = Info.career;
Char.CareerLine = CharInfo.CareerLine;
Char.ModelId = Info.model;
Char.Name = Name;
Char.Race = Info.race;
Char.Realm = CharInfo.Realm;
Char.RealmId = Program.Rm.RealmId;
Char.Sex = Info.sex;
Char.FirstConnect = true;
if (!CharMgr.CreateChar(Char))
{
Log.Error("CreateCharacter", "Hack : can not create more than 10 characters!");
}
else
{
Character_item Citm = null;
List < CharacterInfo_item > Items = CharMgr.GetCharacterInfoItem(Char.CareerLine);
foreach (CharacterInfo_item Itm in Items)
{
if (Itm == null)
continue;
Citm = new Character_item();
Citm.Counts = Itm.Count;
Citm.CharacterId = Char.CharacterId;
Citm.Entry = Itm.Entry;
Citm.ModelId = Itm.ModelId;
Citm.SlotId = Itm.SlotId;
CharMgr.CreateItem(Citm);
}
Character_value CInfo = new Character_value();
CInfo.CharacterId = Char.CharacterId;
CInfo.Level = 1;
CInfo.Money = 0;
CInfo.Online = false;
CInfo.RallyPoint = CharInfo.RallyPt;
CInfo.RegionId = CharInfo.Region;
CInfo.Renown = 0;
CInfo.RenownRank = 1;
CInfo.RestXp = 0;
CInfo.Skills = CharInfo.Skills;
CInfo.Speed = 100;
CInfo.WorldO = CharInfo.WorldO;
CInfo.WorldX = CharInfo.WorldX;
CInfo.WorldY = CharInfo.WorldY;
CInfo.WorldZ = CharInfo.WorldZ;
CInfo.Xp = 0;
CInfo.ZoneId = CharInfo.ZoneId;
CharMgr.Database.AddObject(CInfo);
Program.AcctMgr.UpdateRealmCharacters(Program.Rm.RealmId, (uint)CharMgr.Database.GetObjectCount<Character>(" Realm=1"), (uint)CharMgr.Database.GetObjectCount<Character>(" Realm=2"));
Char.Value = CInfo;
PacketOut Out = new PacketOut((byte)Opcodes.F_SEND_CHARACTER_RESPONSE);
Out.WritePascalString(cclient._Account.Username);
cclient.SendPacket(Out);
}
}
}
else
{
//.........这里部分代码省略.........
示例15: HandleTrade
public void HandleTrade(PacketIn packet)
{
TradingUpdated = false;
byte Status = packet.GetUint8();
byte Unk = packet.GetUint8();
UInt16 Oid = packet.GetUint16();
if (!_Owner.IsInWorld())
return;
if (!_Owner.IsPlayer())
return;
Player Plr = _Owner.GetPlayer();
if (Oid <= 0)
{
Plr.SendLocalizeString("", GameData.Localized_text.TEXT_TRADE_ERR_NO_TARGET);
SendTradeClose(Oid);
return;
}
if (Oid == _Owner.Oid)
{
Plr.SendLocalizeString("", GameData.Localized_text.TEXT_TRADE_ERR_CANT_TRADE_WITH_YOURSELF);
SendTradeClose(Oid);
return;
}
Log.Success("HandleTrade", "Status=" + Status + ",Oid=" + Oid);
Trading = Plr.Region.GetPlayer(Oid);
if (Trading == null)
{
SendTradeClose(Oid);
return;
}
if (Status == 0 && TradingAccepted == 0) // Nouveau Trade
{
if (!CanTrading(Trading))
{
Plr.SendLocalizeString("", GameData.Localized_text.TEXT_TRADE_ERR_TARGET_ALREADY_TRADING);
CloseTrade();
return;
}
SendTradeInfo(this);
Trading.ItmInterface.SendTradeInfo(this);
TradingAccepted = 1;
}
else if (Status == 1 && IsTrading()) // Trade mis a jours
{
uint Money = packet.GetUint32();
byte Update = packet.GetUint8();
byte ItemCounts = packet.GetUint8();
//Log.Info("Trade", "Money=" + Money + ",Update=" + Update + ",Items=" + ItemCounts);
Trading.ItmInterface.TradingAccepted = 1;
TradingAccepted = 1;
TradingMoney = Money;
if (TradingMoney > Plr.GetMoney())
{
TradingMoney = Plr.GetMoney();
Plr.SendLocalizeString("", GameData.Localized_text.TEXT_TRADE_ERR_INSUFFICIENT_MONEY);
SendTradeInfo(this);
Trading.ItmInterface.SendTradeInfo(this);
return;
}
SendTradeInfo(Trading.ItmInterface);
Trading.ItmInterface.SendTradeInfo(this);
}
else if (Status == 2 && IsTrading()) // J'accept le trade
{
TradingAccepted = 2;
Trading.ItmInterface.SendTradeInfo(this);
if (TradingAccepted == 2 && Trading.ItmInterface.TradingAccepted == 2)
Trade(Trading.ItmInterface);
}
else if (Status == 3 && IsTrading()) // Je Ferme le Trade
{
Trading.ItmInterface.SendTradeClose(_Owner.Oid);
SendTradeClose(Oid);
}
}