Esempio n. 1
0
		/// <summary>
		/// Creates creature:pet combination for the account.
		/// Returns false if either failed, true on success.
		/// pet's ids are set to the new ids.
		/// </summary>
		/// <param name="accountId"></param>
		/// <param name="pet"></param>
		/// <returns></returns>
		public bool CreatePet(string accountId, Character pet)
		{
			return this.Create("pets", accountId, pet, null);
		}
Esempio n. 2
0
		/// <summary>
		/// Creates creature:partner combination for the account.
		/// Returns false if either failed, true on success.
		/// partner's ids are set to the new ids.
		/// </summary>
		/// <param name="accountId"></param>
		/// <param name="partner"></param>
		/// <param name="items"></param>
		/// <returns></returns>
		public bool CreatePartner(string accountId, Character partner, List<Item> items)
		{
			return this.Create("partners", accountId, partner, items);
		}
Esempio n. 3
0
		/// <summary>
		/// Queries characters/pets/partners and adds them to result.
		/// </summary>
		/// <param name="accountId"></param>
		/// <param name="table"></param>
		/// <param name="primary"></param>
		/// <param name="type"></param>
		/// <param name="result"></param>
		/// <param name="conn"></param>
		private void GetCharacters(string accountId, string table, CharacterType type, ref List<Character> result, MySqlConnection conn)
		{
			using (var mc = new MySqlCommand(
				"SELECT * " +
				"FROM `" + table + "` AS c " +
				"INNER JOIN `creatures` AS cr ON c.creatureId = cr.creatureId " +
				"WHERE `accountId` = @accountId "
			, conn))
			{
				mc.Parameters.AddWithValue("@accountId", accountId);

				using (var reader = mc.ExecuteReader())
				{
					while (reader.Read())
					{
						var character = new Character();
						character.EntityId = reader.GetInt64("entityId");
						character.CreatureId = reader.GetInt64("creatureId");
						character.Name = reader.GetStringSafe("name");
						character.Server = reader.GetStringSafe("server");
						character.Race = reader.GetInt32("race");
						character.DeletionTime = reader.GetDateTimeSafe("deletionTime");
						character.SkinColor = reader.GetByte("skinColor");
						character.EyeType = reader.GetInt16("eyeType");
						character.EyeColor = reader.GetByte("eyeColor");
						character.MouthType = reader.GetByte("mouthType");
						character.State = (CreatureStates)reader.GetUInt32("state");
						character.Height = reader.GetFloat("height");
						character.Weight = reader.GetFloat("weight");
						character.Upper = reader.GetFloat("upper");
						character.Lower = reader.GetInt32("lower");
						character.Color1 = reader.GetUInt32("color1");
						character.Color2 = reader.GetUInt32("color2");
						character.Color3 = reader.GetUInt32("color3");

						result.Add(character);
					}
				}
			}
		}
Esempio n. 4
0
		/// <summary>
		/// Creates creature:character combination for the account.
		/// Returns false if either failed, true on success.
		/// character's ids are set to the new ids.
		/// </summary>
		/// <param name="accountId"></param>
		/// <param name="character"></param>
		/// <param name="items"></param>
		/// <returns></returns>
		public bool CreateCharacter(string accountId, Character character, List<Item> items)
		{
			return this.Create("characters", accountId, character, items);
		}
Esempio n. 5
0
		/// <summary>
		/// Creates new partner for this account. Returns true if successful,
		/// pet's ids are also set in that case.
		/// </summary>
		/// <param name="partner"></param>
		/// <returns></returns>
		public bool CreatePartner(Character partner)
		{
			int setId = 0;
			if (partner.Race == 730201 || partner.Race == 730202 || partner.Race == 730204 || partner.Race == 730205)
				setId = 1000;
			else if (partner.Race == 730203)
				setId = 1001;
			else if (partner.Race == 730206)
				setId = 1002;
			else if (partner.Race == 730207)
				setId = 1004;

			// Create start items for card and hair/face
			var cardItems = AuraData.CharCardSetDb.Find(setId, partner.Race);
			if (cardItems == null)
			{
				Log.Error("Partner creation: Invalid item set ({0}) for race {1}.", setId, partner.Race);
				return false;
			}

			// TODO: Hash seems to be incorrect.
			var items = Item.CardItemsToItems(cardItems);
			Item.GenerateItemColors(ref items, (this.Name + partner.Race + partner.SkinColor + partner.Hair + partner.HairColor + 1 + partner.EyeType + partner.EyeColor + partner.MouthType + partner.Face));

			items.Add(new Item(partner.Face, Pocket.Face, partner.SkinColor, 0, 0));
			items.Add(new Item(partner.Hair, Pocket.Hair, partner.HairColor + 0x10000000u, 0, 0));

			if (!LoginServer.Instance.Database.CreatePartner(this.Name, partner, items))
			{
				Log.Error("Partner creation: Failed for unknown reasons.");
				return false;
			}

			this.Pets.Add(partner);

			return true;
		}
Esempio n. 6
0
        private List<Character> GetCharacters(string accountName, string type)
        {
            using (var conn = MabiDb.Instance.GetConnection())
            {
                var mc = new MySqlCommand("SELECT * FROM `characters` WHERE `accountId` = @id AND type = @type", conn);
                mc.Parameters.AddWithValue("@id", accountName);
                mc.Parameters.AddWithValue("@type", type);

                var result = new List<Character>();
                using (var reader = mc.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        var character = new Character(type == "CHARACTER" ? CharacterType.Character : CharacterType.Pet);
                        character.Id = reader.GetUInt64("characterId");
                        character.Name = reader.GetString("name");
                        character.Server = reader.GetString("server");
                        character.Race = reader.GetUInt32("race");
                        character.DeletionTime = reader["deletionTime"] as DateTime? ?? DateTime.MinValue;
                        character.SkinColor = reader.GetByte("skinColor");
                        character.Eye = reader.GetByte("eyeType");
                        character.EyeColor = reader.GetByte("eyeColor");
                        character.Mouth = reader.GetByte("mouthType");
                        character.Height = reader.GetFloat("height");
                        character.Weight = reader.GetFloat("fatness");
                        character.Upper = reader.GetFloat("upper");
                        character.Lower = reader.GetUInt32("lower");
                        character.Color1 = reader.GetUInt32("color1");
                        character.Color2 = reader.GetUInt32("color2");
                        character.Color3 = reader.GetUInt32("color3");
                        result.Add(character);
                    }
                }

                return result;
            }
        }
Esempio n. 7
0
		/// <summary>
		/// Sends xInfoRequestR to client.
		/// </summary>
		/// <param name="client"></param>
		/// <param name="op"></param>
		/// <param name="character"></param>
		/// <param name="items"></param>
		public static void CharacterInfoRequestR(LoginClient client, int op, Character character, List<Item> items)
		{
			var packet = new Packet(op, MabiId.Login);
			packet.PutByte(character != null);

			if (character != null)
			{
				packet.PutString(character.Server);
				packet.PutLong(character.EntityId);
				packet.PutByte(1);
				packet.PutString(character.Name);
				packet.PutString("");
				packet.PutString("");
				packet.PutInt(character.Race);
				packet.PutByte(character.SkinColor);
				packet.PutShort(character.EyeType);
				packet.PutByte(character.EyeColor);
				packet.PutByte(character.MouthType);
				packet.PutUInt((uint)character.State);
				packet.PutFloat(character.Height);
				packet.PutFloat(character.Weight);
				packet.PutFloat(character.Upper);
				packet.PutFloat(character.Lower);
				packet.PutInt(0);
				packet.PutInt(0);
				packet.PutInt(0);
				packet.PutByte(0);
				packet.PutInt(0);
				packet.PutByte(0);
				packet.PutInt((int)character.Color1);
				packet.PutInt((int)character.Color2);
				packet.PutInt((int)character.Color3);
				packet.PutFloat(0.0f);
				packet.PutString("");
				packet.PutFloat(49.0f);
				packet.PutFloat(49.0f);
				packet.PutFloat(0.0f);
				packet.PutFloat(49.0f);
				// [180800, NA196 (14.10.2014)] ?
				{
					packet.PutShort(0);
				}
				packet.PutInt(0);
				packet.PutInt(0);
				packet.PutShort(0);
				packet.PutLong(0);
				packet.PutString("");
				packet.PutByte(0);

				packet.PutInt(items.Count);
				foreach (var item in items)
				{
					packet.PutLong(item.Id);
					packet.PutBin(item.Info);
				}

				packet.PutInt(0);  // PetRemainingTime
				packet.PutLong(0); // PetLastTime
				packet.PutLong(0); // PetExpireTime
			}

			client.Send(packet);
		}
Esempio n. 8
0
		/// <summary>
		/// Updates deletion time for character, or deletes it.
		/// </summary>
		/// <param name="character"></param>
		public void UpdateDeletionTime(Character character)
		{
			using (var conn = this.Connection)
			{
				if (character.DeletionFlag == DeletionFlag.Delete)
				{
					using (var mc = new MySqlCommand("DELETE FROM `creatures` WHERE `creatureId` = @creatureId", conn))
					{
						mc.Parameters.AddWithValue("@creatureId", character.CreatureId);
						mc.ExecuteNonQuery();
					}
				}
				else
				{
					using (var cmd = new UpdateCommand("UPDATE `creatures` SET {0} WHERE `creatureId` = @creatureId", conn))
					{
						cmd.AddParameter("@creatureId", character.CreatureId);
						cmd.Set("deletionTime", character.DeletionTime);

						cmd.Execute();
					}
				}
			}
		}
Esempio n. 9
0
		/// <summary>
		/// Creates new partner for this account. Returns true if successful,
		/// pet's ids are also set in that case.
		/// </summary>
		/// <param name="partner"></param>
		/// <returns></returns>
		public bool CreatePartner(Character partner)
		{
			int setId = 0;
			if (partner.Race == 730201 || partner.Race == 730202 || partner.Race == 730204 || partner.Race == 730205)
				setId = 1000;
			else if (partner.Race == 730203)
				setId = 1001;
			else if (partner.Race == 730206)
				setId = 1002;

			// Create start items for card and hair/face
			var cardItems = AuraData.CharCardSetDb.Find(setId, partner.Race);

			// TODO: Hash seems to be incorrect.
			var items = this.CardItemsToItems(cardItems);
			this.GenerateItemColors(ref items, (this.Name + partner.Race + partner.SkinColor + partner.Hair + partner.HairColor + 1 + partner.EyeType + partner.EyeColor + partner.MouthType + partner.Face));

			items.Add(new Item(partner.Face, Pocket.Face, partner.SkinColor, 0, 0));
			items.Add(new Item(partner.Hair, Pocket.Hair, partner.HairColor + 0x10000000u, 0, 0));

			if (!LoginServer.Instance.Database.CreatePartner(this.Name, partner, items))
				return false;

			this.Pets.Add(partner);

			return true;
		}
Esempio n. 10
0
		/// <summary>
		/// Creates new character for this account. Returns true if successful,
		/// character's ids are also set in that case.
		/// </summary>
		/// <param name="character"></param>
		/// <param name="cardInfo"></param>
		/// <returns></returns>
		public bool CreateCharacter(Character character, CharCardData cardInfo)
		{
			// Create start items for card and hair/face
			var cardItems = AuraData.CharCardSetDb.Find(cardInfo.SetId, character.Race);

			var items = this.CardItemsToItems(cardItems);
			this.GenerateItemColors(ref items, (this.Name + character.Race + character.SkinColor + character.Hair + character.HairColor + character.Age + character.EyeType + character.EyeColor + character.MouthType + character.Face));

			items.Add(new Item(character.Face, Pocket.Face, character.SkinColor, 0, 0));
			items.Add(new Item(character.Hair, Pocket.Hair, character.HairColor + 0x10000000u, 0, 0));

			if (!LoginServer.Instance.Database.CreateCharacter(this.Name, character, items))
				return false;

			this.Characters.Add(character);

			return true;
		}
Esempio n. 11
0
		/// <summary>
		/// Creates new pet for this account. Returns true if successful,
		/// pet's ids are also set in that case.
		/// </summary>
		/// <param name="pet"></param>
		/// <returns></returns>
		public bool CreatePet(Character pet)
		{
			if (!LoginServer.Instance.Database.CreatePet(this.Name, pet))
				return false;

			this.Pets.Add(pet);

			return true;
		}
Esempio n. 12
0
File: LoginDb.cs Progetto: Rai/aura
		/// <summary>
		/// Adds trade item and points of card to character.
		/// </summary>
		/// <param name="account"></param>
		/// <param name="targetCharacter"></param>
		/// <param name="charCard"></param>
		public void TradeCard(Account account, Character targetCharacter, CharCardData charCard)
		{
			// Add item
			using (var conn = this.Connection)
			using (var cmd = new InsertCommand("INSERT INTO `items` {0}", conn))
			{
				cmd.Set("creatureId", targetCharacter.CreatureId);
				cmd.Set("itemId", charCard.TradeItem);
				cmd.Set("pocket", Pocket.Temporary);
				cmd.Set("color1", 0x808080);
				cmd.Set("color2", 0x808080);
				cmd.Set("color3", 0x808080);

				cmd.Execute();
			}

			// Add points
			using (var conn = this.Connection)
			using (var cmd = new InsertCommand("UPDATE `accounts` SET `points` = `points` + @points WHERE `accountId` = @accountId", conn))
			{
				cmd.Set("accountId", account.Name);
				cmd.Set("points", charCard.TradePoints);

				cmd.Execute();
			}
		}
Esempio n. 13
0
		/// <summary>
		/// Creates new character for this account. Returns true if successful,
		/// character's ids are also set in that case.
		/// </summary>
		/// <param name="character"></param>
		/// <param name="cardInfo"></param>
		/// <returns></returns>
		public bool CreateCharacter(Character character, List<Item> items)
		{
			if (!LoginServer.Instance.Database.CreateCharacter(this.Name, character, items))
				return false;

			this.Characters.Add(character);

			return true;
		}
Esempio n. 14
0
		/// <summary>
		/// Creates creature:x combination for the account.
		/// Returns false if either failed, true on success.
		/// character's ids are set to the new ids.
		/// </summary>
		/// <param name="table"></param>
		/// <param name="accountId"></param>
		/// <param name="character"></param>
		/// <param name="items"></param>
		/// <returns></returns>
		private bool Create(string table, string accountId, Character character, List<Item> items)
		{
			using (var conn = this.Connection)
			using (var transaction = conn.BeginTransaction())
			{
				try
				{
					// Creature
					character.CreatureId = this.CreateCreature(character, conn, transaction);

					// Character
					using (var cmd = new InsertCommand("INSERT INTO `" + table + "` {0}", conn, transaction))
					{
						cmd.Set("accountId", accountId);
						cmd.Set("creatureId", character.CreatureId);

						cmd.Execute();

						character.EntityId = cmd.LastId;
					}

					// Items
					if (items != null)
						this.AddItems(character.CreatureId, items, conn, transaction);

					transaction.Commit();

					return true;
				}
				catch (Exception ex)
				{
					character.EntityId = character.CreatureId = 0;

					Log.Exception(ex);

					return false;
				}
			}
		}
Esempio n. 15
0
        /// <summary>
        /// Adds the given character to the database, with a new id.
        /// </summary>
        /// <param name="accountName"></param>
        /// <param name="character"></param>
        /// <returns></returns>
        public ulong CreateCharacter(string accountName, Character character)
        {
            using (var conn = MabiDb.Instance.GetConnection())
            {
                if (character.Type == CharacterType.Character)
                    character.Id = MabiDb.Instance.GetNewCharacterId();
                else if (character.Type == CharacterType.Pet)
                    character.Id = MabiDb.Instance.GetNewPetId();
                else if (character.Type == CharacterType.Partner)
                {
                    character.Id = MabiDb.Instance.GetNewPartnerId();
                    character.Type = CharacterType.Pet;
                }

                var mc = new MySqlCommand(
                    "INSERT INTO `characters`"
                    + " (`characterId`, `server`, `type`, `lastLogin`, `accountId`, `name`, `race`, `skinColor`, `eyeType`, `eyeColor`, `mouthType`,"
                    + " `status`, `height`, `fatness`, `upper`, `lower`, `region`, `x`, `y`, `direction`, `battleState`, `weaponSet`,"
                    + " `lifeDelta`, `injuries`, `lifeMax`, `manaDelta`, `manaMax`, `staminaDelta`, `staminaMax`, `food`, `level`, `totalLevel`,"
                    + " `experience`, `age`, `strength`, `dexterity`, `intelligence`, `will`, `luck`, `abilityPoints`, `attackMin`, `attackMax`,"
                    + " `wattackMin`, `wattackMax`, `critical`, `protect`, `defense`, `rate`,"
                    + " `color1`, `color2`, `color3`,"
                    + " `lastTown`, `lastDungeon`, `birthday`, `title`, `deletionTime`, `maxLevel`, `rebirthCount`, `jobId`) "

                    + " VALUES"
                    + " (@characterId, @server, @type, @lastLogin, @accountId, @name, @race, @skinColor, @eyeType, @eyeColor, @mouthType,"
                    + " @status, @height, @fatness, @upper, @lower, @region, @x, @y, @direction, @battleState, @weaponSet,"
                    + " @lifeDelta, @injuries, @lifeMax, @manaDelta, @manaMax, @staminaDelta, @staminaMax, @food, @level, @totalLevel,"
                    + " @experience, @age, @strength, @dexterity, @intelligence, @will, @luck, @abilityPoints, @attackMin, @attackMax,"
                    + " @wattackMin, @wattackMax, @critical, @protect, @defense, @rate,"
                    + " @color1, @color2, @color3,"
                    + " @lastTown, @lastDungeon, @birthday, @title, @deletionTime, @maxLevel, @rebirthCount, @jobId) "
                , conn);

                mc.Parameters.AddWithValue("@characterId", character.Id);
                mc.Parameters.AddWithValue("@server", character.Server);
                mc.Parameters.AddWithValue("@accountId", accountName);
                mc.Parameters.AddWithValue("@type", character.Type.ToString().ToUpper());
                mc.Parameters.AddWithValue("@lastLogin", DateTime.Now);
                mc.Parameters.AddWithValue("@name", character.Name);
                mc.Parameters.AddWithValue("@race", character.Race);
                mc.Parameters.AddWithValue("@skinColor", character.SkinColor);
                mc.Parameters.AddWithValue("@eyeType", character.Eye);
                mc.Parameters.AddWithValue("@eyeColor", character.EyeColor);
                mc.Parameters.AddWithValue("@mouthType", character.Mouth);
                mc.Parameters.AddWithValue("@status", 0);

                mc.Parameters.AddWithValue("@height", character.Height);
                mc.Parameters.AddWithValue("@fatness", character.Weight);
                mc.Parameters.AddWithValue("@upper", character.Upper);
                mc.Parameters.AddWithValue("@lower", character.Lower);

                mc.Parameters.AddWithValue("@region", character.Region);
                mc.Parameters.AddWithValue("@x", character.X);
                mc.Parameters.AddWithValue("@y", character.Y);

                mc.Parameters.AddWithValue("@direction", 0);
                mc.Parameters.AddWithValue("@battleState", 0);
                mc.Parameters.AddWithValue("@weaponSet", 0);

                mc.Parameters.AddWithValue("@lifeDelta", 0);
                mc.Parameters.AddWithValue("@injuries", 0);
                mc.Parameters.AddWithValue("@lifeMax", character.Life);
                mc.Parameters.AddWithValue("@manaDelta", 0);
                mc.Parameters.AddWithValue("@manaMax", character.Mana);
                mc.Parameters.AddWithValue("@staminaDelta", 0);
                mc.Parameters.AddWithValue("@staminaMax", character.Stamina);
                mc.Parameters.AddWithValue("@food", 0);
                mc.Parameters.AddWithValue("@level", 1);
                mc.Parameters.AddWithValue("@totalLevel", 1);
                mc.Parameters.AddWithValue("@experience", 0);
                mc.Parameters.AddWithValue("@age", character.Age);
                mc.Parameters.AddWithValue("@strength", character.Str);
                mc.Parameters.AddWithValue("@dexterity", character.Dex);
                mc.Parameters.AddWithValue("@intelligence", character.Int);
                mc.Parameters.AddWithValue("@will", character.Will);
                mc.Parameters.AddWithValue("@luck", character.Luck);
                mc.Parameters.AddWithValue("@abilityPoints", character.AP);
                mc.Parameters.AddWithValue("@attackMin", 0);
                mc.Parameters.AddWithValue("@attackMax", 0);
                mc.Parameters.AddWithValue("@wattackMin", 0);
                mc.Parameters.AddWithValue("@wattackMax", 0);
                mc.Parameters.AddWithValue("@critical", 0);
                mc.Parameters.AddWithValue("@protect", character.Protection);
                mc.Parameters.AddWithValue("@defense", character.Defense);
                mc.Parameters.AddWithValue("@rate", 0);
                mc.Parameters.AddWithValue("@lastTown", "");
                mc.Parameters.AddWithValue("@lastDungeon", "");
                mc.Parameters.AddWithValue("@birthday", DateTime.MinValue);
                mc.Parameters.AddWithValue("@title", 0);
                mc.Parameters.AddWithValue("@deletionTime", DateTime.MinValue);
                mc.Parameters.AddWithValue("@maxLevel", 200);
                mc.Parameters.AddWithValue("@rebirthCount", 0);
                mc.Parameters.AddWithValue("@jobId", 0);
                mc.Parameters.AddWithValue("@color1", character.Color1);
                mc.Parameters.AddWithValue("@color2", character.Color2);
                mc.Parameters.AddWithValue("@color3", character.Color3);

                mc.ExecuteNonQuery();

                return character.Id;
            }
        }
Esempio n. 16
0
		/// <summary>
		/// Creatures creature based on character and returns its id.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="conn"></param>
		/// <param name="transaction"></param>
		/// <returns></returns>
		private long CreateCreature(Character creature, MySqlConnection conn, MySqlTransaction transaction)
		{
			using (var cmd = new InsertCommand("INSERT INTO `creatures` {0}", conn, transaction))
			{
				cmd.Set("server", creature.Server);
				cmd.Set("name", creature.Name);
				cmd.Set("age", creature.Age);
				cmd.Set("race", creature.Race);
				cmd.Set("skinColor", creature.SkinColor);
				cmd.Set("eyeType", creature.EyeType);
				cmd.Set("eyeColor", creature.EyeColor);
				cmd.Set("mouthType", creature.MouthType);
				cmd.Set("state", (uint)creature.State);
				cmd.Set("height", creature.Height);
				cmd.Set("weight", creature.Weight);
				cmd.Set("upper", creature.Upper);
				cmd.Set("lower", creature.Lower);
				cmd.Set("color1", creature.Color1);
				cmd.Set("color2", creature.Color2);
				cmd.Set("color3", creature.Color3);
				cmd.Set("lifeMax", creature.Life);
				cmd.Set("manaMax", creature.Mana);
				cmd.Set("staminaMax", creature.Stamina);
				cmd.Set("str", creature.Str);
				cmd.Set("int", creature.Int);
				cmd.Set("dex", creature.Dex);
				cmd.Set("will", creature.Will);
				cmd.Set("luck", creature.Luck);
				cmd.Set("defense", creature.Defense);
				cmd.Set("protection", creature.Protection);
				cmd.Set("ap", creature.AP);
				cmd.Set("creationTime", DateTime.Now);
				cmd.Set("lastAging", DateTime.Now);

				cmd.Execute();

				return cmd.LastId;
			}
		}
Esempio n. 17
0
 /// <summary>
 /// Updates deletionTime or deletes character, depending on DeletionFlag.
 /// </summary>
 /// <param name="character"></param>
 public void SetDelete(Character character)
 {
     using (var conn = MabiDb.Instance.GetConnection())
     {
         if (character.DeletionFlag == DeletionFlag.Delete)
         {
             var mc = new MySqlCommand("DELETE FROM `characters` WHERE `characterId` = @characterId", conn);
             mc.Parameters.AddWithValue("@characterId", character.Id);
             mc.ExecuteNonQuery();
         }
         else
         {
             var mc = new MySqlCommand("UPDATE `characters` SET `deletionTime` = @time WHERE `characterId` = @characterId", conn);
             mc.Parameters.AddWithValue("@characterId", character.Id);
             mc.Parameters.AddWithValue("@time", character.DeletionTime);
             mc.ExecuteNonQuery();
         }
     }
 }
Esempio n. 18
0
		/// <summary>
		/// Adds trade item and points of card to character.
		/// </summary>
		/// <param name="targetCharacter"></param>
		/// <param name="charCard"></param>
		public void TradeCard(Character targetCharacter, CharCardData charCard)
		{
			using (var conn = this.Connection)
			using (var cmd = new InsertCommand("INSERT INTO `items` {0}", conn))
			{
				cmd.Set("creatureId", targetCharacter.CreatureId);
				cmd.Set("itemId", charCard.TradeItem);
				cmd.Set("pocket", Pocket.Temporary);
				cmd.Set("color1", 0x808080);
				cmd.Set("color2", 0x808080);
				cmd.Set("color3", 0x808080);

				cmd.Execute();
			}

			// TODO: Add points (pons)...
		}
Esempio n. 19
0
        /// <summary>
        /// Sends character info. 
        /// </summary>
        /// <param name="client"></param>
        /// <param name="character"></param>
        public static void CharacterInfo(LoginClient client, uint op, Character character, IEnumerable<Item> items)
        {
            var packet = new MabiPacket(op, Id.Login);
            if (character != null)
            {
                packet.PutByte(true);
                packet.PutString(character.Server);
                packet.PutLong(character.Id);
                packet.PutByte(1);
                packet.PutString(character.Name);
                packet.PutString("");
                packet.PutString("");
                packet.PutInt(character.Race);
                packet.PutByte(character.SkinColor);
                packet.PutByte(character.Eye);
                packet.PutByte(character.EyeColor);
                packet.PutByte(character.Mouth);
                packet.PutInt(0);
                packet.PutFloat(character.Height);
                packet.PutFloat(character.Weight);
                packet.PutFloat(character.Upper);
                packet.PutFloat(character.Lower);
                packet.PutInt(0);
                packet.PutInt(0);
                packet.PutInt(0);
                packet.PutByte(0);
                packet.PutInt(0);
                packet.PutByte(0);
                packet.PutInt(character.Color1);
                packet.PutInt(character.Color2);
                packet.PutInt(character.Color3);
                packet.PutFloat(0.0f);
                packet.PutString("");
                packet.PutFloat(49.0f);
                packet.PutFloat(49.0f);
                packet.PutFloat(0.0f);
                packet.PutFloat(49.0f);
                packet.PutInt(0);
                packet.PutInt(0);
                packet.PutShort(0);
                packet.PutLong(0);
                packet.PutString("");
                packet.PutByte(0);

                packet.PutSInt(items.Count());
                foreach (var item in items)
                {
                    packet.PutLong(item.Id);
                    packet.PutBin(item.Info);
                }

                packet.PutInt(0);  // PetRemainingTime
                packet.PutLong(0); // PetLastTime
                packet.PutLong(0); // PetExpireTime
            }
            else
            {
                packet.PutByte(false);
            }

            client.Send(packet);
        }