public static byte[] CreateSpawnPacket(Player._General general, Player._Flags flags, _Position position, Player._Stats stats, Player._Speeds speeds) { PacketWriter writer = new PacketWriter(); writer.SetOpcode(SERVER_OPCODES.GAME_SERVER_SPAWN); writer.AppendDword(stats.Model); writer.AppendByte(stats.Volume); if (flags.GM == 1) writer.AppendByte(1); else writer.AppendByte((byte)(stats.Level < 20 ? 1 : 0)); writer.AppendByte(1); writer.AppendByte(general.MaxSlots); int tmpCharacterIndex = DatabaseCore.Character.GetIndexByName(general.CharacterName); int[] CharacterItemIndex = DatabaseCore.Item.GetIndexByName(general.CharacterName); byte PlayerItemCount = 0; for (byte j = 0; j < 10; j++) { if (DatabaseCore.Item.ItemId[CharacterItemIndex[j]] != 0) PlayerItemCount++; } writer.AppendByte(PlayerItemCount); for (int j = 0; j < 10; j++) { if (DatabaseCore.Item.ItemId[CharacterItemIndex[j]] != 0) { writer.AppendDword(DatabaseCore.Item.ItemId[CharacterItemIndex[j]]); writer.AppendByte(DatabaseCore.Item.PlusValue[CharacterItemIndex[j]]); } } writer.AppendByte(4); writer.AppendByte(0); writer.AppendByte(0); writer.AppendDword((uint)general.UniqueID); writer.AppendByte(position.XSector); writer.AppendByte(position.YSector); writer.AppendFloat(position.X); writer.AppendFloat(position.Z); writer.AppendFloat(position.Y); writer.AppendWord(0); writer.AppendByte(0); writer.AppendByte(1); writer.AppendByte(0); writer.AppendWord(0); writer.AppendWord(1); writer.AppendByte(flags.Berserk); writer.AppendFloat(speeds.WalkSpeed); writer.AppendFloat(speeds.RunSpeed); writer.AppendFloat(speeds.BerserkSpeed); writer.AppendByte(0); if (flags.GM == 1) { string gmname = string.Format("[GM]{0}", general.CharacterName); writer.AppendWord((ushort)gmname.Length); writer.AppendString(false, gmname); } else { writer.AppendWord((ushort)general.CharacterName.Length); writer.AppendString(false, general.CharacterName); } writer.AppendByte(0); writer.AppendByte(1); writer.AppendDword(0); writer.AppendDword(0); writer.AppendDword(0); writer.AppendDword(0); writer.AppendDword(0); writer.AppendDword(0); writer.AppendDword(0); writer.AppendByte(1); writer.AppendByte((byte)flags.PvP); return writer.getWorkspace(); }
public static bool MoveToObject(int Index_, ref _Position obj_1, _Position obj_2, Player._General general, bool Monster) { return MoveToObject(Index_, ref obj_1, obj_2, general.UniqueID, general.CharacterID, 28, general.WeaponType, Monster); }