本文整理汇总了C#中Framework.PacketWriter.LWord方法的典型用法代码示例。如果您正苦于以下问题:C# PacketWriter.LWord方法的具体用法?C# PacketWriter.LWord怎么用?C# PacketWriter.LWord使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Framework.PacketWriter
的用法示例。
在下文中一共展示了PacketWriter.LWord方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AlchemyResponse
public static byte[] AlchemyResponse(bool isSuccess, Global.slotItem sItem, byte type, byte totalblue)
{
PacketWriter Writer = new PacketWriter();
Writer.Create(Systems.SERVER_ALCHEMY);
Writer.Byte(1);
Writer.Byte(2);
Writer.Bool(isSuccess);
Writer.Byte(sItem.Slot);
if (!isSuccess) { Writer.Byte(0); }
Writer.DWord(0);
Writer.DWord(sItem.ID);
Writer.Byte(sItem.PlusValue);
Writer.LWord(0);
Writer.DWord(sItem.Durability);
Writer.Byte(Data.ItemBlue[sItem.dbID].totalblue);
for (int i = 0; i <= Data.ItemBlue[sItem.dbID].totalblue - 1; i++)
{
Writer.DWord(Data.MagicOptions.Find(mg => (mg.Name == Convert.ToString(Data.ItemBlue[sItem.dbID].blue[i]))).ID);
Writer.DWord(Data.ItemBlue[sItem.dbID].blueamount[i]);
}
Writer.Word(1);
Writer.Word(2);
Writer.Word(3);
return Writer.GetBytes();
}
示例2: PetSpawn
///////////////////////////////////////////////////////////////////////////
// Despawn Pet
///////////////////////////////////////////////////////////////////////////
public static byte[] PetSpawn(int petid, byte type, pet_obj o)
{
PacketWriter Writer = new PacketWriter();
Writer.Create(Systems.SERVER_PLAYER_SPAWN_PET); //Select Opcode
Writer.DWord(petid); //Pet ID
switch (type)
{
case 1:
//Despawn pet
Writer.Byte(1);
break;
case 2:
//Rename pet respawn
Writer.Byte(5);
Writer.Text(o.Petname);
break;
case 3:
//Attack pet respawn for exp info
Writer.Byte(3);//Static
Writer.LWord(o.exp);//New exp
Writer.DWord(o.OwnerID);//Owner id
break;
}
return Writer.GetBytes();
}
示例3: OpenWarehouse
public static byte[] OpenWarehouse(long t)
{
PacketWriter Writer = new PacketWriter();
Writer.Create(Systems.SERVER_OPEN_WAREHOUSE);
Writer.LWord(t);
return Writer.GetBytes();
}
示例4: InfoUpdate
public static byte[] InfoUpdate(byte type, int obje, byte bT)
{
PacketWriter Writer = new PacketWriter();
Writer.Create(Systems.SERVER_INFO_UPDATE);
Writer.Byte(type);
switch (type)
{
case 1:
Writer.LWord(obje);
Writer.Byte(0);
break;
case 2:
Writer.DWord(obje);
Writer.Byte(0);
break;
case 4:
Writer.Byte(bT);
Writer.DWord(obje);
break;
default:
break;
}
return Writer.GetBytes();
}
示例5: Exchange_Gold
public static byte[] Exchange_Gold(long gold)
{
PacketWriter Writer = new PacketWriter();
Writer.Create(Systems.SERVER_EXCHANGE_GOLD);
Writer.Byte(2);
Writer.LWord(gold);
return Writer.GetBytes();
}
示例6: AttackPetStats
public static byte[] AttackPetStats(pet_obj c,byte slot)
{
PacketWriter writer = new PacketWriter();
writer.Create(Systems.SERVER_PET_INFORMATION);
writer.DWord(c.UniqueID);
writer.DWord(c.Model);
writer.DWord(0x00000168);//stats
writer.DWord(0x00000168);//stats
writer.LWord(c.exp);//Experience
writer.Byte(c.Level);//Level
writer.Word(0);//Angle
writer.DWord(0x00000001);//1 = Attack icon enabled, 2 = disabled
if (c.Petname != "No name") writer.Text(c.Petname);//Petname
else
writer.Word(0);//No name
writer.Byte(0);//Static perhaps
writer.DWord(c.OwnerID);//Owner
writer.Byte(slot);
return writer.GetBytes();
}
示例7: CharacterListing
////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Character listening packet
////////////////////////////////////////////////////////////////////////////////////////////////////////////
public static byte[] CharacterListing(string name)
{
Systems.MsSQL ms = new Systems.MsSQL("SELECT TOP 4 * FROM character WHERE account='" + name + "'");
PacketWriter Writer = new PacketWriter();
Writer.Create(Systems.SERVER_CHARACTERSCREEN); // Select opcode
Writer.Byte(2); // Static byte 2
Writer.Byte(1); // Static byte 1
Writer.Byte(ms.Count()); // Byte Character Count
using (System.Data.SqlClient.SqlDataReader reader = ms.Read())
{
while (reader.Read())
{
Writer.DWord(reader.GetInt32(3)); // DWord Skin Model
Writer.Text(reader.GetString(2)); // String Name
Writer.Byte(reader.GetByte(4)); // Byte Skin Volume
Writer.Byte(reader.GetByte(5)); // Byte Level
Writer.LWord(reader.GetInt64(12)); // Long Experience
Writer.Word(reader.GetInt16(6)); // Word STR
Writer.Word(reader.GetInt16(7)); // Word INT
Writer.Word(reader.GetInt16(8)); // Attribute points
Writer.DWord(reader.GetInt32(9)); // HP
Writer.DWord(reader.GetInt32(10)); // MP
TimeSpan ts = Convert.ToDateTime(reader.GetDateTime(43)) - DateTime.Now;
double time = ts.TotalMinutes;
if (Math.Round(time) > 0)
{
Writer.Byte(1);
Writer.DWord(Math.Round(time));
}
else
{
Writer.Byte(0);
}
if (Math.Round(time) < 0 && DateTime.Now != reader.GetDateTime(43))
{
Systems.MsSQL.UpdateData("UPDATE character SET deleted='1' Where id='" + reader.GetInt32(0) + "'");
}
Writer.Word(0);
Writer.Byte(0);
Function.Items.PrivateItemPacket(Writer, reader.GetInt32(0), 8, 0,false);
Function.Items.PrivateItemPacket(Writer, reader.GetInt32(0), 5, 1,false);
}
//Jobtype information
int jobinfo = Systems.MsSQL.GetDataInt("SELECT * FROM users WHERE id='"+ name +"'", "jobtype");
Writer.Byte(Convert.ToByte(jobinfo));
}
ms.Close();
return Writer.GetBytes();
}
示例8: UpdateGold
////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Update gold
////////////////////////////////////////////////////////////////////////////////////////////////////////////
public static byte[] UpdateGold(long gold)
{
PacketWriter Writer = new PacketWriter();
Writer.Create(Systems.SERVER_UPDATEGOLD);
Writer.Byte(1);
Writer.LWord(gold);
Writer.Byte(0);
return Writer.GetBytes();
}
示例9: MoveItem
////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Inventory item movement
////////////////////////////////////////////////////////////////////////////////////////////////////////////
public static byte[] MoveItem(byte type, byte fromSlot, byte toSlot, short quantity, long gold, string action)
{
PacketWriter Writer = new PacketWriter();
Writer.Create(Systems.SERVER_ITEM_MOVE);
switch (action)
{
case "MOVE_INSIDE_INVENTORY":
Writer.Byte(1);
Writer.Byte(type);
Writer.Byte(fromSlot);
Writer.Byte(toSlot);
Writer.Word(quantity);
Writer.Byte(0);
break;
case "MOVE_INSIDE_STORAGE":
Writer.Bool(true);
Writer.Byte(1);
Writer.Byte(fromSlot);
Writer.Byte(toSlot);
Writer.Word(quantity);
break;
case "MOVE_INSIDE_GUILD_STORAGE":
Writer.Byte(1);
Writer.Byte(0x1D);//Type
Writer.Byte(fromSlot);
Writer.Byte(toSlot);
Writer.Word(quantity);
break;
case "MOVE_TO_STORAGE":
Writer.Byte(1);
Writer.Byte(2);
Writer.Byte(fromSlot);
Writer.Byte(toSlot);
break;
case "MOVE_TO_GUILD_STORAGE":
Writer.Byte(1);
Writer.Byte(0x1E);
Writer.Byte(fromSlot);
Writer.Byte(toSlot);
break;
case "MOVE_FROM_STORAGE":
Writer.Byte(1);
Writer.Byte(3);
Writer.Byte(fromSlot);
Writer.Byte(toSlot);
break;
case "MOVE_FROM_GUILD_STORAGE":
Writer.Byte(1);
Writer.Byte(0x1F);
Writer.Byte(fromSlot);
Writer.Byte(toSlot);
break;
case "MOVE_WAREHOUSE_GOLD":
Writer.Bool(true);
Writer.Byte(type);
Writer.LWord(gold);
break;
case "MOVE_GENDER_CHANGE":
Writer.Byte(1);
Writer.Byte(fromSlot);
Writer.Byte(0x13);
Writer.Byte(2);
break;
case "DELETE_ITEM":
Writer.Byte(1);
Writer.Byte(type);
Writer.Byte(fromSlot);
if (type == 0x0F) Writer.Byte(4);
break;
case "DELETE_GOLD":
Writer.Byte(1);
Writer.Byte(type);
Writer.LWord(gold);
break;
}
return Writer.GetBytes();
}
示例10: Exchange_ItemPacket
public static byte[] Exchange_ItemPacket(int id, List<Global.slotItem> Exhange, bool mine)
{
PacketWriter Writer = new PacketWriter();
Writer.Create(Systems.SERVER_EXCHANGE_ITEM);
Writer.DWord(id);
Writer.Byte(Exhange.Count);
for (byte i = 0; i < Exhange.Count; i++)
{
Systems.LoadBluesid(Exhange[i].dbID);
if (mine) Writer.Byte(Exhange[i].Slot);
Writer.Byte(i);
Writer.DWord(0);
Writer.DWord(Exhange[i].ID);
if (Data.ItemBase[Exhange[i].ID].Type == Global.item_database.ArmorType.ARMOR ||
Data.ItemBase[Exhange[i].ID].Type == Global.item_database.ArmorType.GARMENT ||
Data.ItemBase[Exhange[i].ID].Type == Global.item_database.ArmorType.GM ||
Data.ItemBase[Exhange[i].ID].Type == Global.item_database.ArmorType.HEAVY ||
Data.ItemBase[Exhange[i].ID].Type == Global.item_database.ArmorType.LIGHT ||
Data.ItemBase[Exhange[i].ID].Type == Global.item_database.ArmorType.PROTECTOR ||
Data.ItemBase[Exhange[i].ID].Type == Global.item_database.ArmorType.ROBE ||
Data.ItemBase[Exhange[i].ID].Itemtype == Global.item_database.ItemType.EARRING ||
Data.ItemBase[Exhange[i].ID].Itemtype == Global.item_database.ItemType.RING ||
Data.ItemBase[Exhange[i].ID].Itemtype == Global.item_database.ItemType.NECKLACE ||
Data.ItemBase[Exhange[i].ID].Itemtype == Global.item_database.ItemType.BLADE ||
Data.ItemBase[Exhange[i].ID].Itemtype == Global.item_database.ItemType.BOW ||
Data.ItemBase[Exhange[i].ID].Itemtype == Global.item_database.ItemType.EU_AXE ||
Data.ItemBase[Exhange[i].ID].Itemtype == Global.item_database.ItemType.EU_CROSSBOW ||
Data.ItemBase[Exhange[i].ID].Itemtype == Global.item_database.ItemType.EU_DAGGER ||
Data.ItemBase[Exhange[i].ID].Itemtype == Global.item_database.ItemType.EU_DARKSTAFF ||
Data.ItemBase[Exhange[i].ID].Itemtype == Global.item_database.ItemType.EU_HARP ||
Data.ItemBase[Exhange[i].ID].Itemtype == Global.item_database.ItemType.EU_STAFF ||
Data.ItemBase[Exhange[i].ID].Itemtype == Global.item_database.ItemType.EU_SWORD ||
Data.ItemBase[Exhange[i].ID].Itemtype == Global.item_database.ItemType.EU_TSTAFF ||
Data.ItemBase[Exhange[i].ID].Itemtype == Global.item_database.ItemType.EU_TSWORD ||
Data.ItemBase[Exhange[i].ID].Itemtype == Global.item_database.ItemType.GLAVIE ||
Data.ItemBase[Exhange[i].ID].Itemtype == Global.item_database.ItemType.SPEAR ||
Data.ItemBase[Exhange[i].ID].Itemtype == Global.item_database.ItemType.SWORD ||
Data.ItemBase[Exhange[i].ID].Itemtype == Global.item_database.ItemType.CH_SHIELD ||
Data.ItemBase[Exhange[i].ID].Itemtype == Global.item_database.ItemType.EU_SHIELD)
{
Writer.Byte(Exhange[i].PlusValue);
Writer.LWord(0);
Writer.DWord(Data.ItemBase[Exhange[i].ID].Defans.Durability);
if (Data.ItemBlue[Exhange[i].dbID].totalblue != 0)
{
Writer.Byte(Convert.ToByte(Data.ItemBlue[Exhange[i].dbID].totalblue));
for (int a = 1; a <= Data.ItemBlue[Exhange[i].dbID].totalblue; a++)
{
Writer.DWord(Data.MagicOptions.Find(mg => (mg.Name == Convert.ToString(Data.ItemBlue[Exhange[i].dbID].blue[i]))).ID);
Writer.DWord(Data.ItemBlue[Exhange[i].dbID].blueamount[i]);
}
}
else
{
Writer.Byte(0);
}
Writer.Word(1);
Writer.Word(2);
Writer.Word(3);
}
else if (Data.ItemBase[Exhange[i].ID].Etctype == Global.item_database.EtcType.STONES)
{
Writer.Word(Exhange[i].Amount);
Writer.Byte(0);
}
else if (Data.ItemBase[Exhange[i].ID].Etctype == Global.item_database.EtcType.MONSTERMASK)
{
Writer.DWord(0);
}
else if (Data.ItemBase[Exhange[i].ID].Etctype == Global.item_database.EtcType.ELIXIR)
{
Writer.Word(1);
}
else if (Data.ItemBase[Exhange[i].ID].Itemtype == Global.item_database.ItemType.ARROW ||
Data.ItemBase[Exhange[i].ID].Itemtype == Global.item_database.ItemType.BOLT ||
Data.ItemBase[Exhange[i].ID].Etctype == Global.item_database.EtcType.HP_POTION ||
Data.ItemBase[Exhange[i].ID].Etctype == Global.item_database.EtcType.MP_POTION ||
Data.ItemBase[Exhange[i].ID].Etctype == Global.item_database.EtcType.VIGOR_POTION ||
Data.ItemBase[Exhange[i].ID].Etctype == Global.item_database.EtcType.SPEED_POTION ||
Data.ItemBase[Exhange[i].ID].Ticket == Global.item_database.Tickets.BEGINNER_HELPERS ||
Data.ItemBase[Exhange[i].ID].Etctype == Global.item_database.EtcType.ELIXIR ||
Data.ItemBase[Exhange[i].ID].Etctype == Global.item_database.EtcType.ALCHEMY_MATERIAL ||
Data.ItemBase[Exhange[i].ID].Etctype == Global.item_database.EtcType.EVENT ||
Data.ItemBase[Exhange[i].ID].Class_D == 3)
{
Writer.Word(Exhange[i].Amount);
}
}
return Writer.GetBytes();
}
示例11: ItemExchange_Gold
public static byte[] ItemExchange_Gold(long gold)
{
PacketWriter Writer = new PacketWriter();
Writer.Create(Systems.SERVER_ITEM_MOVE);
Writer.Byte(1);
Writer.Byte(13);
Writer.LWord(gold);
return Writer.GetBytes();
}
示例12: GuildGoldUpdate
public static byte[] GuildGoldUpdate(long info, byte type)
{
PacketWriter Writer = new PacketWriter();
Writer.Create(Systems.SERVER_ITEM_MOVE);
Writer.Byte(1);
Writer.Byte(type);
Writer.LWord(info);
return Writer.GetBytes();
}
示例13: CharacterListing
//Listening main uses a single packet only so we write our packet here
public static byte[] CharacterListing(player p)
{
//Create new sql query to get all characters except fully deleted
Systems.MsSQL ms = new Systems.MsSQL("SELECT TOP 4 * FROM character WHERE account='" + p.AccountName + "' AND deleted='0' OR account='" + p.AccountName + "' AND deleted ='1'");
//Create new packet writer
PacketWriter Writer = new PacketWriter();
Writer.Create(Systems.SERVER_CHARACTERSCREEN); // Select opcode
Writer.Byte(2); // Static byte 2
Writer.Byte(1); // Static byte 1
Writer.Byte(ms.Count()); // Byte Character Count
//Create new sql data reader
using (System.Data.SqlClient.SqlDataReader reader = ms.Read())
{
//While the reader is reading data from the database
while (reader.Read())
{
Writer.DWord(reader.GetInt32(3)); // DWord Skin Model
Writer.Text(reader.GetString(2)); // String Name
Writer.Byte(reader.GetByte(4)); // Byte Skin Volume
Writer.Byte(reader.GetByte(5)); // Byte Level
Writer.LWord(reader.GetInt64(12)); // Long Experience
Writer.Word(reader.GetInt16(6)); // Word STR
Writer.Word(reader.GetInt16(7)); // Word INT
Writer.Word(reader.GetInt16(8)); // Attribute points
Writer.DWord(reader.GetInt32(9)); // HP
Writer.DWord(reader.GetInt32(10)); // MP
//Set defnition for current time
DateTime CurrentTime = DateTime.Now;
//Subtract the current time with deletion time information
TimeSpan TIMESPAN = reader.GetDateTime(43) - DateTime.Now;
//If the character has been deleted but still sitting
if (reader.GetByte(42) == 1)
{
//Write state byte 1 for sitting
Writer.Byte(1);
//Display deletion time reamining
Writer.DWord((double)TIMESPAN.TotalMinutes);
//If time has expired delete the character
if (TIMESPAN.TotalMinutes <= 0)
{
//Note: There are more ways like full delete but if someone got deleted by someone else's action
//It will be easy to recover the character by changing the deletion byte in the database
//0 = Not deleted , 1 = Deletion in progress, 2 = Deleted
//Set deletion state so it wont be listed again.
Systems.MsSQL.UpdateData("UPDATE character SET deleted='2' Where id='" + reader.GetInt32(0) + "'");
}
}
//If not deleted
else
{
//State byte = 0 Standing
Writer.Byte(0);
}
//Static
Writer.Word(0);
Writer.Byte(0);
//Get normal equipped items upto slot 8 not in avatar slots
Function.Items.PrivateItemPacket(Writer, reader.GetInt32(0), 8, 0, false);
//Get avatar type items
Function.Items.PrivateItemPacket(Writer, reader.GetInt32(0), 5, 1, false);
}
//Jobtype information
int jobinfo = Systems.MsSQL.GetDataInt("SELECT * FROM users WHERE id='" + p.AccountName + "'", "jobtype");
Writer.Byte(Convert.ToByte(jobinfo));
}
ms.Close();
//Return all bytes to the client
return Writer.GetBytes();
}
示例14: Load
public static byte[] Load(character c)
{
PacketWriter Writer = new PacketWriter();
Writer.Create(Systems.SERVER_PLAYERDATA);
/////////////////////////////////////////////////////// Character basic info
#region Basic info
Writer.DWord(c.Ids.GetLoginID);
Writer.DWord(c.Information.Model);
Writer.Byte(c.Information.Volume);
Writer.Byte(c.Information.Level);
Writer.Byte(c.Information.Level);
Writer.LWord(c.Information.XP);
Writer.DWord(c.Information.SpBar);
Writer.LWord(c.Information.Gold);
Writer.DWord(c.Information.SkillPoint);
Writer.Word(c.Information.Attributes);
Writer.Byte(c.Information.BerserkBar);
Writer.DWord(0);
Writer.DWord(c.Stat.SecondHp);
Writer.DWord(c.Stat.SecondMP);
Writer.Bool(c.Information.Level < 20 ? true : false);
#endregion
/////////////////////////////////////////////////////// Character Player Kill Info
#region Pk information
//Mssql perfection reading with multiple data adapters... while this one is open i can still read anything else from the database
//With no speed reduction...
Systems.MsSQL checkpk = new Systems.MsSQL("SELECT * FROM character WHERE name ='" + c.Information.Name + "'");
using (System.Data.SqlClient.SqlDataReader getinfo = checkpk.Read())
{
while (getinfo.Read())
{
byte dailypk = getinfo.GetByte(48);
byte pklevel = getinfo.GetByte(49);
byte murderlevel = getinfo.GetByte(50);
Writer.Byte(dailypk);
Writer.Word(pklevel);
Writer.DWord(murderlevel);
if (murderlevel != 0) c.Information.Murderer = true;
}
}
#endregion
/////////////////////////////////////////////////////// Character Title
#region Title
Writer.Byte(c.Information.Title);
#endregion
/////////////////////////////////////////////////////// Character Pvpstate
#region Pvp
Writer.Byte(c.Information.Pvpstate);
if (c.Information.Pvpstate > 0)
c.Information.PvP = true;
#endregion
/////////////////////////////////////////////////////// Character Items
#region Item
Writer.Byte(c.Information.Slots);
Systems.MsSQL ms = new Systems.MsSQL("SELECT * FROM char_items WHERE owner='" + c.Information.CharacterID + "' AND slot >= '0' AND slot <= '" + c.Information.Slots + "' AND inavatar='0' AND storagetype='0'");
Writer.Byte(ms.Count());
using (System.Data.SqlClient.SqlDataReader msreader = ms.Read())
{
while (msreader.Read())
{
short amount = msreader.GetInt16(6);
if (amount < 1) amount = 1;
Systems.MsSQL.InsertData("UPDATE char_items SET quantity='" + amount + "' WHERE owner='" + c.Information.CharacterID + "' AND itemid='" + msreader.GetInt32(2) + "' AND id='" + msreader.GetInt32(0) + "' AND storagetype='0'");
if (msreader.GetByte(5) == 6)
c.Information.Item.wID = Convert.ToInt32(msreader.GetInt32(2));
if (msreader.GetByte(5) == 7)
{
c.Information.Item.sID = msreader.GetInt32(2);
c.Information.Item.sAmount = msreader.GetInt16(6);
}
Item.AddItemPacket(Writer, msreader.GetByte(5), msreader.GetInt32(2), msreader.GetByte(4), amount, msreader.GetInt32(7),msreader.GetInt32(0), msreader.GetInt32(9), msreader.GetInt32(30));
}
}
ms.Close();
//Avatar
Writer.Byte(5);
ms = new Systems.MsSQL("SELECT * FROM char_items WHERE owner='" + c.Information.CharacterID + "' AND slot >= '0' AND slot <= '" + c.Information.Slots + "' AND inavatar='1' AND storagetype='0'");
Writer.Byte(ms.Count());
using (System.Data.SqlClient.SqlDataReader msreader = ms.Read())
{
while (msreader.Read())
{
Item.AddItemPacket(Writer, msreader.GetByte(5), msreader.GetInt32(2), msreader.GetByte(4), msreader.GetInt16(6), msreader.GetInt32(7), msreader.GetInt32(0), msreader.GetInt32(9),msreader.GetInt32(30));
}
}
ms.Close();
Writer.Byte(0);
//.........这里部分代码省略.........
示例15: Player_getExp
public static byte[] Player_getExp(int id, long exp, long sp, short level)
{
PacketWriter Writer = new PacketWriter();
Writer.Create(Systems.SERVER_PLAYER_GET_EXP);
Writer.DWord(id);
Writer.LWord(exp);
Writer.LWord(sp);
Writer.Byte(0);
if (level != 0) Writer.Word(level);
return Writer.GetBytes();
}