Example #1
0
 public Prize(int Exp, int Gold, DescribedProfile Item)
 {
     AmountExp  = Exp;
     AmountGold = Gold;
     ItemsList  = new List <DescribedProfile>();
     ItemsList.Add(Item);
 }
Example #2
0
        public Items()
        {
            I = new Dictionary<string, DescribedProfile>();

            XmlDocument File = new XmlDocument();
            File.Load("Media\\Profiles\\Items.xml");

            XmlElement root = File.DocumentElement;
            XmlNodeList Items = root.SelectNodes("//items/item");

            foreach (XmlNode item in Items)
            {
                if (item["type"].InnerText == "DescribedProfile")
                {
                    DescribedProfile Kriper = new DescribedProfile();
                    Kriper.DisplayName = item["name"].InnerText;
                    Kriper.Description = item["description"].InnerText;
                    Kriper.MeshName = item["mesh"].InnerText;
                    Kriper.InventoryPictureMaterial = item["inventory_material"].InnerText;
                    Kriper.Mass = int.Parse(item["mass"].InnerText);
                    Kriper.IsPickable = bool.Parse(item["ispickable"].InnerText);
                    Kriper.DisplayNameOffset = Vector3.ZERO;
                    Kriper.DisplayNameOffset.x = float.Parse(item["nameoffsetx"].InnerText);
                    Kriper.DisplayNameOffset.y = float.Parse(item["nameoffsety"].InnerText);
                    Kriper.DisplayNameOffset.z = float.Parse(item["nameoffsetz"].InnerText);
                    Kriper.ProfileName = item["idstring"].InnerText;
                    Kriper.Price = int.Parse(item["price"].InnerText);
                    Kriper.IsContainer = bool.Parse(item["iscontainer"].InnerText);

                    if (Kriper.IsContainer)
                        Kriper.PrizeID = item["prizeid"].InnerText;

                    I.Add(item["idstring"].InnerText, Kriper);
                }
                else if (item["type"].InnerText == "ItemSword")
                {
                    ItemSword Kriper = new ItemSword();
                    Kriper.DisplayName = item["name"].InnerText;
                    Kriper.Description = item["description"].InnerText;
                    Kriper.MeshName = item["mesh"].InnerText;
                    Kriper.InventoryPictureMaterial = item["inventory_material"].InnerText;
                    Kriper.Mass = int.Parse(item["mass"].InnerText);
                    Kriper.IsPickable = bool.Parse(item["ispickable"].InnerText);
                    Kriper.DisplayNameOffset = Vector3.ZERO;
                    Kriper.DisplayNameOffset.x = float.Parse(item["nameoffsetx"].InnerText);
                    Kriper.DisplayNameOffset.y = float.Parse(item["nameoffsety"].InnerText);
                    Kriper.DisplayNameOffset.z = float.Parse(item["nameoffsetz"].InnerText);
                    Kriper.HandleOffset = Vector3.ZERO;
                    Kriper.HandleOffset.x = float.Parse(item["handleoffsetx"].InnerText);
                    Kriper.HandleOffset.y = float.Parse(item["handleoffsety"].InnerText);
                    Kriper.HandleOffset.z = float.Parse(item["handleoffsetz"].InnerText);
                    Kriper.ProfileName = item["idstring"].InnerText;
                    Kriper.Price = int.Parse(item["price"].InnerText);
                    Kriper.JakoscRzutow = int.Parse(item["jakoscrzutow"].InnerText);
                    Kriper.IloscRzutow = int.Parse(item["iloscrzutow"].InnerText);

                    I.Add(item["idstring"].InnerText, Kriper);
                }
            }
        }
Example #3
0
        public Described(DescribedProfile profile)
        {
            Profile = profile.Clone();

            Entity = Engine.Singleton.SceneManager.CreateEntity(Profile.MeshName);
            Node   = Engine.Singleton.SceneManager.RootSceneNode.CreateChildSceneNode();
            Node.AttachObject(Entity);

            Vector3 scaledSize = Entity.BoundingBox.Size * Profile.BodyScaleFactor;

            IsContainer = profile.IsContainer;

            if (IsContainer)
            {
                Container = new Container();

                if (profile.PrizeID != null)
                {
                    Prize p1 = PrizeManager.P[profile.PrizeID].prize_Clone();
                    Container.Contains = new List <DescribedProfile>(p1.ItemsList); //PrizeManager.P[profile.PrizeID].ItemsList;
                    Container.Gold     = p1.AmountGold;                             //PrizeManager.P[profile.PrizeID].AmountGold;
                    Container.MaxItems = p1.AmountExp;                              //PrizeManager.P[profile.PrizeID].AmountExp;
                }
            }

            if (Profile.Mass != 0)
            {
                ConvexCollision coll = new MogreNewt.CollisionPrimitives.ConvexHull(Engine.Singleton.NewtonWorld,
                                                                                    Node,
                                                                                    Quaternion.IDENTITY,
                                                                                    0.01f,
                                                                                    Engine.Singleton.GetUniqueBodyId());

                Vector3 inertia = new Vector3(1, 1, 1), offset;
                coll.CalculateInertialMatrix(out inertia, out offset);


                Body = new Body(Engine.Singleton.NewtonWorld, coll, true);
                coll.Dispose();
                Body.AttachNode(Node);
                Body.SetMassMatrix(Profile.Mass, Profile.Mass * inertia);
            }
            else
            {
                //Collision coll = new MogreNewt.CollisionPrimitives.TreeCollision(Engine.Singleton.NewtonWorld, Node, true, Engine.Singleton.GetUniqueBodyId());

                Collision coll = new MogreNewt.CollisionPrimitives.TreeCollision(Engine.Singleton.NewtonWorld, Entity, true, Engine.Singleton.GetUniqueBodyId());

                //Body = new Body(Engine.Singleton.NewtonWorld, coll, true);
                Body = new Body(Engine.Singleton.NewtonWorld, coll, false);
                coll.Dispose();
                Body.AttachNode(Node);
            }
            Body.UserData        = this;
            Body.MaterialGroupID = Engine.Singleton.MaterialManager.DescribedMaterialID;
        }
Example #4
0
 public void SetItem(DescribedProfile item)
 {
     if (item != null)
     {
         Picture.Panel.MaterialName = item.InventoryPictureMaterial;
     }
     else
     {
         Picture.Panel.MaterialName = "QuadMaterial";
     }
 }
Example #5
0
 public void SetItem(DescribedProfile item)
 {
     if (item != null)
     {
         Picture.Panel.MaterialName = item.InventoryPictureMaterial;
         BlueQuad.IsVisible         = item.IsEquipment;
     }
     else
     {
         Picture.Panel.MaterialName = "QuadMaterial";
         BlueQuad.IsVisible         = false;
     }
 }
Example #6
0
        public bool Add(DescribedProfile item)
        {
            if (CanAdd)
            {
                if (Contains.Count < MaxItems)
                {
                    Contains.Add(item);
                    return true;
                }

                return false;
            }
            else
                return false;
        }
Example #7
0
        public bool Add(DescribedProfile item)
        {
            if (CanAdd)
            {
                if (Contains.Count < MaxItems)
                {
                    Contains.Add(item);
                    return(true);
                }

                return(false);
            }
            else
            {
                return(false);
            }
        }
Example #8
0
 public ItemShield(DescribedProfile prof)
 {
     MeshName = prof.MeshName;
 }
Example #9
0
 public void SetItem(DescribedProfile item)
 {
     if (item != null)
     {
         Picture.Panel.MaterialName = item.InventoryPictureMaterial;
         BlueQuad.IsVisible = item.IsEquipment;
     }
     else
     {
         Picture.Panel.MaterialName = "QuadMaterial";
         BlueQuad.IsVisible = false;
     }
 }
Example #10
0
        public Items()
        {
            I = new Dictionary <string, DescribedProfile>();

            XmlDocument File = new XmlDocument();

            File.Load("Media\\Profiles\\Items.xml");

            XmlElement  root  = File.DocumentElement;
            XmlNodeList Items = root.SelectNodes("//items/item");

            foreach (XmlNode item in Items)
            {
                if (item["type"].InnerText == "DescribedProfile")
                {
                    DescribedProfile Kriper = new DescribedProfile();
                    Kriper.DisplayName = item["name"].InnerText;
                    Kriper.Description = item["description"].InnerText;
                    Kriper.MeshName    = item["mesh"].InnerText;
                    Kriper.InventoryPictureMaterial = item["inventory_material"].InnerText;
                    Kriper.Mass                = int.Parse(item["mass"].InnerText);
                    Kriper.IsPickable          = bool.Parse(item["ispickable"].InnerText);
                    Kriper.DisplayNameOffset   = Vector3.ZERO;
                    Kriper.DisplayNameOffset.x = float.Parse(item["nameoffsetx"].InnerText);
                    Kriper.DisplayNameOffset.y = float.Parse(item["nameoffsety"].InnerText);
                    Kriper.DisplayNameOffset.z = float.Parse(item["nameoffsetz"].InnerText);
                    Kriper.ProfileName         = item["idstring"].InnerText;
                    Kriper.Price               = int.Parse(item["price"].InnerText);
                    Kriper.IsContainer         = bool.Parse(item["iscontainer"].InnerText);

                    if (Kriper.IsContainer)
                    {
                        Kriper.PrizeID = item["prizeid"].InnerText;
                    }

                    I.Add(item["idstring"].InnerText, Kriper);
                }
                else if (item["type"].InnerText == "ItemSword")
                {
                    ItemSword Kriper = new ItemSword();
                    Kriper.DisplayName = item["name"].InnerText;
                    Kriper.Description = item["description"].InnerText;
                    Kriper.MeshName    = item["mesh"].InnerText;
                    Kriper.InventoryPictureMaterial = item["inventory_material"].InnerText;
                    Kriper.Mass                = int.Parse(item["mass"].InnerText);
                    Kriper.IsPickable          = bool.Parse(item["ispickable"].InnerText);
                    Kriper.DisplayNameOffset   = Vector3.ZERO;
                    Kriper.DisplayNameOffset.x = float.Parse(item["nameoffsetx"].InnerText);
                    Kriper.DisplayNameOffset.y = float.Parse(item["nameoffsety"].InnerText);
                    Kriper.DisplayNameOffset.z = float.Parse(item["nameoffsetz"].InnerText);
                    Kriper.HandleOffset        = Vector3.ZERO;
                    Kriper.HandleOffset.x      = float.Parse(item["handleoffsetx"].InnerText);
                    Kriper.HandleOffset.y      = float.Parse(item["handleoffsety"].InnerText);
                    Kriper.HandleOffset.z      = float.Parse(item["handleoffsetz"].InnerText);
                    Kriper.ProfileName         = item["idstring"].InnerText;
                    Kriper.Price               = int.Parse(item["price"].InnerText);
                    Kriper.JakoscRzutow        = int.Parse(item["jakoscrzutow"].InnerText);
                    Kriper.IloscRzutow         = int.Parse(item["iloscrzutow"].InnerText);

                    I.Add(item["idstring"].InnerText, Kriper);
                }
            }
        }