private void LoadInitialEquipment()
        {
            int       equipmentSetNumber = (Tribe * 100) + CurrentClassId;
            uint      underShirtId       = (uint)8040000 + Tribe;
            uint      underGarmentId     = (uint)8060000 + Tribe;
            DataTable defaultSet         = GameData.Instance.GetGameData("boot_skillequip");

            uint[] itemGraphicIds = defaultSet.Select("id = '" + equipmentSetNumber + "'")[0].ItemArray.Select(Convert.ToUInt32).ToArray();

            Appearance.SetToSlots(itemGraphicIds, underShirtId, underGarmentId);
            Inventory = new Inventory();
            Inventory.AddDefaultItems(itemGraphicIds, underShirtId, underGarmentId);
        }
Exemple #2
0
        public Aetheryte(uint classId, AetheryteType type, Position position, uint menuPageId = 0, uint menuId = 0, uint body = 1024)
        {
            ClassId            = classId;
            Appearance.Size    = 0x02;
            Position           = position;
            AetheryteType      = type;
            TeleportMenuPageId = menuPageId;
            TeleportMenuId     = menuId;
            AnimaCost          = 2; //calculated by distance from current location?
            Appearance         = new Appearance {
                Body = body
            };

            switch (AetheryteType)
            {
            case AetheryteType.Crystal:
                NameId          = 4010014;
                ClassName       = "AetheryteParent";
                ClassPath       = "/Chara/Npc/Object/Aetheryte/";
                ClassCode       = 0x26000000;
                PushEventRadius = 10.0f;
                break;

            case AetheryteType.Gate:
                NameId          = 4010015;
                ClassName       = "AetheryteChild";
                ClassPath       = "/Chara/Npc/Object/Aetheryte/";
                ClassCode       = 0x26000000;
                PushEventRadius = 3.0f;
                break;

            case AetheryteType.Shard:
                ClassName = "PopulaceStandard";
                ClassPath = "/Chara/Npc/Populace/";
                ClassId   = 0x001250A0;
                ClassCode = 0x33800000;
                break;
            }
        }
        public List <Actor> LoadZoneNpc(uint zoneId)
        {
            string       npcListPath  = @"" + zoneId.ToString("X");
            string       fileNamePath = npcListPath + @".npc.xml";
            XmlDocument  npcFile      = new XmlDocument();
            string       file         = GetResourceXmlResource(fileNamePath);
            List <Actor> zoneNpcs     = new List <Actor>();

            if (file != "")
            {
                try
                {
                    //get game data tables with actors data
                    DataTable actorsGraphics = GameData.Instance.GetGameData("actorclass_graphic");
                    DataTable actorsNameIds  = GameData.Instance.GetGameData("actorclass");

                    //prepare xml nodes
                    npcFile.LoadXml(file);
                    var PopulaceStandardList = npcFile.SelectNodes("npc/PopulaceStandard");

                    //each npc node in xml
                    foreach (XmlNode node in PopulaceStandardList)
                    {
                        //XmlNode node = objNode.SelectSingleNode("PopulaceStandard");
                        uint classId = Convert.ToUInt32(node.SelectSingleNode("classId").InnerText);
                        uint state   = node.SelectSingleNode("state") != null?Convert.ToUInt32(node.SelectSingleNode("state").InnerText) : 0; //TODO: fix this as it is 2 bytes. so far it's alaways 0 so it's ok.

                        ushort animation = node.SelectSingleNode("animation") != null?Convert.ToUInt16(node.SelectSingleNode("animation").InnerText) : (ushort)0;

                        int questIcon = node.SelectSingleNode("questIcon") != null?Convert.ToInt32(node.SelectSingleNode("questIcon").InnerText) : -1;

                        //get table lines with npc info
                        DataRow actorGraphics = actorsGraphics.Select("id = '" + classId + "'")[0];
                        DataRow actorNameId   = actorsNameIds.Select("id = '" + classId + "'")[0];

                        //Spawn position
                        XmlNode  positionNode = node.SelectSingleNode("position");
                        Position position     = new Position
                        {
                            ZoneId = zoneId,
                            X      = Convert.ToSingle(positionNode.Attributes["x"].Value),
                            Y      = Convert.ToSingle(positionNode.Attributes["y"].Value),
                            Z      = Convert.ToSingle(positionNode.Attributes["z"].Value),
                            R      = Convert.ToSingle(positionNode.Attributes["r"].Value)
                        };

                        Face face = new Face
                        {
                            Characteristics      = Convert.ToByte(actorGraphics.ItemArray[7]),
                            CharacteristicsColor = Convert.ToByte(actorGraphics.ItemArray[8]),
                            Type     = Convert.ToByte(actorGraphics.ItemArray[6]),
                            Ears     = Convert.ToByte(actorGraphics.ItemArray[15]),
                            Mouth    = Convert.ToByte(actorGraphics.ItemArray[14]),
                            Features = Convert.ToByte(actorGraphics.ItemArray[13]),
                            Nose     = Convert.ToByte(actorGraphics.ItemArray[12]),
                            EyeShape = Convert.ToByte(actorGraphics.ItemArray[11]),
                            IrisSize = Convert.ToByte(actorGraphics.ItemArray[10]),
                            EyeBrows = Convert.ToByte(actorGraphics.ItemArray[9])
                        };

                        Appearance appearance = new Appearance
                        {
                            BaseModel         = Convert.ToUInt32(actorGraphics.ItemArray[1]),
                            Size              = Convert.ToUInt32(actorGraphics.ItemArray[2]),
                            MainWeapon        = Convert.ToUInt32(actorGraphics.ItemArray[20]),
                            SecondaryWeapon   = Convert.ToUInt32(actorGraphics.ItemArray[21]),
                            SPMainWeapon      = Convert.ToUInt32(actorGraphics.ItemArray[22]),
                            SPSecondaryWeapon = Convert.ToUInt32(actorGraphics.ItemArray[23]),
                            Throwing          = Convert.ToUInt32(actorGraphics.ItemArray[24]),
                            Pack              = Convert.ToUInt32(actorGraphics.ItemArray[25]),
                            Pouch             = Convert.ToUInt32(actorGraphics.ItemArray[26]),
                            Head              = Convert.ToUInt32(actorGraphics.ItemArray[27]),
                            Body              = Convert.ToUInt32(actorGraphics.ItemArray[28]),
                            Legs              = Convert.ToUInt32(actorGraphics.ItemArray[29]),
                            Hands             = Convert.ToUInt32(actorGraphics.ItemArray[30]),
                            Feet              = Convert.ToUInt32(actorGraphics.ItemArray[31]),
                            Waist             = Convert.ToUInt32(actorGraphics.ItemArray[32]),
                            Neck              = Convert.ToUInt32(actorGraphics.ItemArray[33]),
                            RightEar          = Convert.ToUInt32(actorGraphics.ItemArray[34]),
                            LeftEar           = Convert.ToUInt32(actorGraphics.ItemArray[35]),
                            RightIndex        = Convert.ToUInt32(actorGraphics.ItemArray[36]),
                            LeftIndex         = Convert.ToUInt32(actorGraphics.ItemArray[37]),
                            RightFinger       = Convert.ToUInt32(actorGraphics.ItemArray[38]),
                            LeftFinger        = Convert.ToUInt32(actorGraphics.ItemArray[39])
                        };

                        SubState subState = new SubState
                        {
                            MotionPack = animation
                        };

                        //Npc obj
                        PopulaceStandard npc = new PopulaceStandard
                        {
                            ClassId            = classId,
                            NameId             = Convert.ToInt32(actorNameId.ItemArray[1]),
                            HairStyle          = Convert.ToUInt16(actorGraphics.ItemArray[3]),
                            HairHighlightColor = Convert.ToUInt16(actorGraphics.ItemArray[4]),
                            HairColor          = Convert.ToUInt16(actorGraphics.ItemArray[16]),
                            SkinColor          = Convert.ToUInt16(actorGraphics.ItemArray[17]),
                            EyeColor           = Convert.ToUInt16(actorGraphics.ItemArray[18]),
                            Appearance         = appearance,
                            Face      = face,
                            Position  = position,
                            QuestIcon = questIcon,
                            SubState  = subState
                        };

                        zoneNpcs.Add(npc);
                    }
                }
                catch (Exception e)
                {
                    _log.Warning(e.Message);
                }
            }

            return(zoneNpcs);
        }
Exemple #4
0
 public void setAppearance(Appearance appearance)
 {
     this.appearance = appearance;
 }