public CharacterEquipmentChange(int characterId, byte slot, Item item)
        {
            CharacterId = characterId;
            Slot        = slot;

            if (item != null)
            {
                Type         = item.Type;
                TypeId       = item.TypeId;
                EnchantLevel = 20; // TODO: implement enchant here.
                HasColor     = item.DyeColor.IsEnabled;
                if (HasColor)
                {
                    DyeColor = new DyeColorSerialized(item.DyeColor.Saturation, item.DyeColor.R, item.DyeColor.G, item.DyeColor.B);
                }
                else
                {
                    DyeColor = new DyeColorSerialized();
                }
            }
            else
            {
                DyeColor = new DyeColorSerialized();
            }
        }
Ejemplo n.º 2
0
        public CharacterShape(Character character)
        {
            IsDead    = character.HealthManager.IsDead;
            Motion    = character.Motion;
            Country   = character.CountryProvider.Country;
            Race      = character.AdditionalInfoManager.Race;
            Hair      = character.AdditionalInfoManager.Hair;
            Face      = character.AdditionalInfoManager.Face;
            Height    = character.AdditionalInfoManager.Height;
            Class     = character.AdditionalInfoManager.Class;
            Gender    = character.AdditionalInfoManager.Gender;
            Mode      = character.AdditionalInfoManager.Grow;
            Kills     = character.KillsManager.Kills;
            Name      = character.AdditionalInfoManager.FakeName is null ? character.AdditionalInfoManager.Name : character.AdditionalInfoManager.FakeName;
            GuildName = character.AdditionalInfoManager.FakeGuildName is null ? character.GuildManager.GuildName : character.AdditionalInfoManager.FakeGuildName;

            for (byte i = 0; i < 17; i++)
            {
                character.InventoryManager.InventoryItems.TryGetValue((0, i), out var item);
                EquipmentItems[i] = new EquipmentItem(item);

                if (item != null)
                {
                    EquipmentItemHasColor[i] = item.DyeColor.IsEnabled;
                    if (item.DyeColor.IsEnabled)
                    {
                        EquipmentItemColor[i] = new DyeColorSerialized(item.DyeColor.Saturation, item.DyeColor.R, item.DyeColor.G, item.DyeColor.B);
                    }
                    else
                    {
                        EquipmentItemColor[i] = new DyeColorSerialized();
                    }
                }
                else
                {
                    EquipmentItemColor[i] = new DyeColorSerialized();
                }
            }

            if (character.PartyManager.HasParty)
            {
                if (character.PartyManager.IsPartyLead)
                {
                    PartyDefinition = 2;
                }
                else
                {
                    PartyDefinition = 1;
                }
            }
            else
            {
                PartyDefinition = 0;
            }
        }
Ejemplo n.º 3
0
        public CharacterShape(Character character)
        {
            CharId  = character.Id;
            IsDead  = character.IsDead;
            Motion  = character.Motion;
            Country = character.Country;
            Race    = character.Race;
            Hair    = character.Hair;
            Face    = character.Face;
            Height  = character.Height;
            Class   = character.Class;
            Gender  = character.Gender;
            Mode    = character.Mode;
            Kills   = character.Kills;
            Name    = character.NameAsByteArray;
            Name2   = character.NameAsByteArray; // not sure why, but server definitely sends name twice

            for (byte i = 0; i < 17; i++)
            {
                character.InventoryItems.TryGetValue((0, i), out var item);
                EquipmentItems[i] = new EquipmentItem(item);

                if (item != null)
                {
                    EquipmentItemHasColor[i] = item.DyeColor.IsEnabled;
                    if (item.DyeColor.IsEnabled)
                    {
                        EquipmentItemColor[i] = new DyeColorSerialized(item.DyeColor.Saturation, item.DyeColor.R, item.DyeColor.G, item.DyeColor.B);
                    }
                }
            }

            if (character.HasParty)
            {
                if (character.IsPartyLead)
                {
                    PartyDefinition = 2;
                }
                else
                {
                    PartyDefinition = 1;
                }
            }
            else
            {
                PartyDefinition = 0;
            }

            var chars = character.GuildName.ToCharArray();

            for (var i = 0; i < chars.Length; i++)
            {
                GuildName[i] = (byte)chars[i];
            }
        }
Ejemplo n.º 4
0
        public CharacterSelectionScreen(DbCharacter character)
        {
            CharacterId   = character.Id;
            Level         = character.Level;
            Race          = character.Race;
            Mode          = character.Mode;
            Hair          = character.Hair;
            Face          = character.Face;
            Height        = character.Height;
            Class         = character.Class;
            Gender        = character.Gender;
            Map           = character.Map;
            Strength      = character.Strength;
            Dexterity     = character.Dexterity;
            Rec           = character.Rec;
            Intelligence  = character.Intelligence;
            Wisdom        = character.Wisdom;
            Luck          = character.Luck;
            HealthPoints  = character.HealthPoints;
            ManaPoints    = character.ManaPoints;
            StaminaPoints = character.StaminaPoints;
            IsRename      = character.IsRename;

            var equipmentItems = character.Items.Where(item => item.Bag == 0);

            for (var i = 0; i < 17; i++)
            {
                var item = equipmentItems.FirstOrDefault(itm => itm.Slot == i);
                if (item != null)
                {
                    EquipmentItemsType[i]    = item.Type;
                    EquipmentItemsTypeId[i]  = item.TypeId;
                    EquipmentItemHasColor[i] = item.HasDyeColor;
                    if (item.HasDyeColor)
                    {
                        Colors[i] = new DyeColorSerialized(item.DyeColorAlpha, item.DyeColorR, item.DyeColorG, item.DyeColorB, item.DyeColorSaturation);
                    }
                    else
                    {
                        Colors[i] = new DyeColorSerialized();
                    }
                }
                else
                {
                    Colors[i] = new DyeColorSerialized();
                }
            }

            Name     = character.Name;
            IsDelete = character.IsDelete;
        }