Exemple #1
0
        public MannequinStatsGump(Mannequin mann, Item item, int page)
            : base(100, 100)
        {
            _Mannequin = mann;
            _Item      = item;

            AddPage(0);

            AddBackground(0, 0, 604, 820, 0x6DB);
            AddAlphaRegion(5, 5, 594, 810);
            AddHtmlLocalized(10, 10, 584, 18, 1114513, "#1159279", 0x43F7, false, false); // <DIV ALIGN=CENTER>~1_TOKEN~</DIV>

            List <ValuedProperty>     lm;
            List <ItemPropDefinition> CompareItem = null;
            List <Item> list;

            if (_Item != null)
            {
                Item sameItem = null;

                for (var index = 0; index < _Mannequin.Items.Count; index++)
                {
                    var x = _Mannequin.Items[index];

                    if (_Mannequin.LayerValidation(x, item))
                    {
                        sameItem = x;
                        break;
                    }
                }

                _SameItem = sameItem;

                if (_SameItem != null)
                {
                    CompareItem = new List <ItemPropDefinition>
                    {
                        new ItemPropDefinition(_Item, _SameItem)
                    };

                    list = new List <Item>();

                    for (var index = 0; index < _Mannequin.Items.Count; index++)
                    {
                        var x = _Mannequin.Items[index];

                        if (x != _SameItem)
                        {
                            list.Add(x);
                        }
                    }

                    list.Add(_Item);
                }
                else
                {
                    list = new List <Item>();

                    for (var index = 0; index < _Mannequin.Items.Count; index++)
                    {
                        var mannequinItem = _Mannequin.Items[index];

                        list.Add(mannequinItem);
                    }

                    list.Add(_Item);
                }
            }
            else
            {
                list = _Mannequin.Items;
            }

            lm = Mannequin.GetProperty(list);

            AddHtmlLocalized(479, 10, 75, 18, 1114514, "#1158215", 0x42FF, false, false); // <DIV ALIGN=RIGHT>~1_TOKEN~</DIV>

            if (page > 0)
            {
                AddButton(554, 10, 0x15E3, 0x15E7, 1000, GumpButtonType.Reply, 0); // Next Page Button
            }
            else
            {
                AddButton(554, 10, 0x15E1, 0x15E5, 1001, GumpButtonType.Reply, 0); // Previous Page Button
            }

            int y = 0;

            LabelDefinition[] pages = page > 0 ? Page2 : Page1;

            for (var index = 0; index < pages.ToList().Count; index++)
            {
                var x = pages.ToList()[index];

                y += 28;

                if (lm.Any(l => l.Catalog == x.Catalog))
                {
                    AddHtmlLocalized(10, y, 150, 18, x.TitleLabel, 0x6A05, false, false);
                    AddImageTiled(10, y + 18, 584, 5, 0x6DC);

                    y += 32;

                    List <ValuedProperty> cataloglist =
                        lm.Where(i => i.Catalog == x.Catalog).OrderBy(ii => ii.Order).ToList();

                    int columncount = x.ColumnLeftCount == 0 ? (int)Math.Ceiling(cataloglist.Count / (decimal)2) : x.ColumnLeftCount;

                    for (int i = 0; i < cataloglist.Count; i++)
                    {
                        int label = cataloglist[i].LabelNumber;

                        if (i < columncount)
                        {
                            AddHtmlLocalized(45, y, 200, 18, label, 0x560A, false, false);
                            AddSpriteImage(10, y - 5, 0x9D3B, cataloglist[i].SpriteW, cataloglist[i].SpriteH, 30, 30);
                            AddTooltip(cataloglist[i].Description);

                            if (cataloglist[i].LabelNumber == 1159280) // Medable Armor
                            {
                                if (cataloglist[i].Matches(list))
                                {
                                    AddHtmlLocalized(195, y, 100, 18, 1046362, 0x42FF, false, false); // Yes
                                }
                                else
                                {
                                    AddHtmlLocalized(195, y, 100, 18, 1046363, 0x42FF, false, false); // No
                                }
                            }
                            else
                            {
                                AddHtml(195, y, 100, 18, Color(cataloglist[i].Value, GetItemValue(CompareItem, label), cataloglist[i].Cap), false, false);
                            }
                        }
                        else
                        {
                            if (i == columncount)
                            {
                                y -= i * 30;
                            }

                            AddHtmlLocalized(342, y, 200, 18, label, 0x560A, false, false);
                            AddSpriteImage(307, y - 5, 0x9D3B, cataloglist[i].SpriteW, cataloglist[i].SpriteH, 30, 30);
                            AddTooltip(cataloglist[i].Description);

                            if (!cataloglist[i].IsBoolen)
                            {
                                AddHtml(492, y, 100, 18, Color(cataloglist[i].Value, GetItemValue(CompareItem, label), cataloglist[i].Cap), false, false);
                            }
                        }

                        y += 30;
                    }

                    y += 3;
                }
            }
        }
Exemple #2
0
 public MannequinStatsGump(Mannequin mann)
     : this(mann, null)
 {
 }
Exemple #3
0
 public MannequinStatsGump(Mannequin mann, Item item)
     : this(mann, item, 0)
 {
 }
Exemple #4
0
        public MannequinCompareGump(Mannequin mann, Item item)
            : base(100, 100)
        {
            Item matches = null;

            for (var index = 0; index < mann.Items.Count; index++)
            {
                var x = mann.Items[index];

                if (mann.LayerValidation(x, item))
                {
                    matches = x;
                    break;
                }
            }

            _SameItem = matches;

            if (_SameItem == null)
            {
                return;
            }

            AddPage(0);

            AddBackground(0, 0, 560, 720, 0x6DB);
            AddImageTiled(270, 5, 6, 710, 0x6DE);
            AddHtmlLocalized(5, 5, 270, 18, 1114513, "#1159291", 0x42FF, false, false); // <DIV ALIGN=CENTER>~1_TOKEN~</DIV>
            AddAlphaRegion(5, 5, 550, 710);

            AddHtmlLocalized(0, 23, 270, 18, 1114513, string.Format("#{0}", _SameItem.LabelNumber), 0x7FFF, false, false); // <DIV ALIGN=CENTER>~1_TOKEN~</DIV>
            AddImageTiled(4, 80, 550, 5, 0x6DC);

            List <ValuedProperty> EquipmentItem = Mannequin.FindItemProperty(_SameItem);

            int si = 0;

            for (int i = 0; i < EquipmentItem.Count; i++)
            {
                if (EquipmentItem[i].LabelNumber == 1159280) // Medable Armor - not appear
                {
                    continue;
                }

                if (EquipmentItem[i].IsSpriteGraph)
                {
                    AddSpriteImage(5 + 35 * si, 41, 0x9D3B, EquipmentItem[i].SpriteW, EquipmentItem[i].SpriteH, 30, 30);
                    AddTooltip(EquipmentItem[i].LabelNumber);

                    si++;
                }
                else
                {
                    AddHtmlLocalized(45, 94 + 18 * i, 140, 18, EquipmentItem[i].LabelNumber, EquipmentItem[i].Hue, false, false);
                    AddTooltip(EquipmentItem[i].Description);

                    if (!EquipmentItem[i].IsBoolen)
                    {
                        AddHtml(190, 94 + 18 * i, 100, 18, Color(EquipmentItem[i].Value, EquipmentItem[i].Cap), false, false);
                    }
                }
            }

            AddHtmlLocalized(270, 23, 270, 18, 1114513, string.Format("#{0}", item.LabelNumber), 0x7FFF, false, false); // <DIV ALIGN=CENTER>~1_TOKEN~</DIV>

            List <ValuedProperty> SelectItem = Mannequin.FindItemProperty(item);

            si = 0;

            for (int i = 0; i < SelectItem.Count; i++)
            {
                if (SelectItem[i].LabelNumber == 1159280) // Medable Armor - not appear
                {
                    continue;
                }

                if (SelectItem[i].IsSpriteGraph)
                {
                    AddSpriteImage(275 + 35 * si, 41, 0x9D3B, SelectItem[i].SpriteW, SelectItem[i].SpriteH, 30, 30);
                    AddTooltip(SelectItem[i].LabelNumber);

                    si++;
                }
                else
                {
                    AddHtmlLocalized(315, 94 + 18 * i, 140, 18, SelectItem[i].LabelNumber, SelectItem[i].Hue, false, false);
                    AddTooltip(SelectItem[i].Description);

                    if (!SelectItem[i].IsBoolen)
                    {
                        double ev = 0;

                        for (var index = 0; index < EquipmentItem.Count; index++)
                        {
                            var a1 = EquipmentItem[index];

                            if (a1.LabelNumber == SelectItem[i].LabelNumber)
                            {
                                ev = EquipmentItem.Find(a => a.LabelNumber == SelectItem[i].LabelNumber).Value;
                                break;
                            }
                        }

                        AddHtml(460, 94 + 18 * i, 100, 18, Color(SelectItem[i].Value, SelectItem[i].Cap, ev), false, false);
                    }
                }
            }
        }
Exemple #5
0
 public ItemPropDefinition(Item tl, Item ctlg)
 {
     SelectItem    = Mannequin.GetProperty(tl);
     EquipmentItem = Mannequin.GetProperty(ctlg);
 }
Exemple #6
0
 public bool CheckMagicalItem(Item item)
 {
     return(Mannequin.GetProperty(item).Any(x => x.Value != 0));
 }
        public MannequinControl(Mannequin controlled, Mobile controller, int curpage)
            : base(0, 0)
        {
            controller.SendMessage("CurrentPage = {0}", curpage);
            m_Controlled  = controlled;
            m_Controller  = controller;
            m_CurrentPage = curpage;

            Closable   = true;
            Disposable = true;
            Dragable   = true;
            Resizable  = false;

            AddPage(0);
            AddBackground(0, 0, 180, 300, 9270);

            AddLabel(60, 20, 68, m_Controlled.Name);

            AddButton(20, 75, 2117, 2118, 1, GumpButtonType.Reply, 0);
            AddButton(20, 125, 2117, 2118, 2, GumpButtonType.Reply, 0);
            AddButton(20, 175, 2117, 2118, 3, GumpButtonType.Reply, 0);
            AddButton(20, 225, 2117, 2118, 4, GumpButtonType.Reply, 0);
            AddLabel(45, 75, 49, "Move Me");
            AddLabel(45, 125, 49, "Face Me");
            AddLabel(45, 175, 49, "Change Hue");
            AddLabel(45, 225, 49, "Change Gender");

            AddPage(1);

            switch (m_CurrentPage)
            {
            case (1):
            {
                AddBackground(180, 0, 180, 250, 9270);
                AddButton(262, 25, 2117, 2118, 5, GumpButtonType.Reply, 0);
                AddButton(262, 140, 2117, 2118, 6, GumpButtonType.Reply, 0);
                AddHtml(194, 45, 150, 75, "<basefont color=#33aa33>Click here and I will move to your location.</basefont>", false, false);
                AddHtml(194, 160, 150, 75, "<basefont color=#aa3333>Click here and I will move to where you target.</basefont>", false, false);
                break;
            }

            case (2):
            {
                AddBackground(180, 0, 250, 250, 9270);
                AddImage(205, 25, 5010);
                AddImage(270, 70, 9000);

                if (m_Controlled.Direction == Direction.Mask)
                {
                    AddImage(298, 60, 1209);
                }
                else if (m_Controlled.Direction == Direction.North)
                {
                    AddImage(338, 78, 1209);
                }
                else if (m_Controlled.Direction == Direction.Right)
                {
                    AddImage(356, 118, 1209);
                }
                else if (m_Controlled.Direction == Direction.East)
                {
                    AddImage(339, 157, 1209);
                }
                else if (m_Controlled.Direction == Direction.Down)
                {
                    AddImage(298, 175, 1209);
                }
                else if (m_Controlled.Direction == Direction.South)
                {
                    AddImage(258, 158, 1209);
                }
                else if (m_Controlled.Direction == Direction.Left)
                {
                    AddImage(240, 118, 1209);
                }
                else if (m_Controlled.Direction == Direction.West)
                {
                    AddImage(258, 77, 1209);
                }

                AddButton(281, 8, 4500, 4500, 7, GumpButtonType.Reply, 0);
                AddButton(345, 37, 4501, 4501, 8, GumpButtonType.Reply, 0);
                AddButton(372, 100, 4502, 4502, 9, GumpButtonType.Reply, 0);
                AddButton(342, 164, 4503, 4503, 10, GumpButtonType.Reply, 0);
                AddButton(281, 191, 4504, 4504, 11, GumpButtonType.Reply, 0);
                AddButton(216, 165, 4505, 4505, 12, GumpButtonType.Reply, 0);
                AddButton(188, 100, 4506, 4506, 13, GumpButtonType.Reply, 0);
                AddButton(216, 35, 4507, 4507, 14, GumpButtonType.Reply, 0);
                break;
            }

            case (3):
            {
                AddBackground(180, 0, 180, 250, 9270);
                AddButton(262, 74, 2117, 2118, 15, GumpButtonType.Reply, 0);
                AddButton(262, 118, 2117, 2118, 16, GumpButtonType.Reply, 0);
                AddButton(262, 162, 2117, 2118, 17, GumpButtonType.Reply, 0);
                AddHtml(194, 89, 150, 75, "<basefont color=#33aa33>Change my hue to white.</basefont>", false, false);
                AddHtml(194, 133, 150, 75, "<basefont color=#33aa33>Change my hue to black.</basefont>", false, false);
                AddHtml(194, 175, 150, 75, "<basefont color=#33aa33>Change my hue to grey.</basefont>", false, false);
                break;
            }
            }
        }
Exemple #8
0
            public override void OnResponse(NetState sender, RelayInfo info)
            {
                Mobile m = sender.Mobile;

                switch (info.ButtonID)
                {
                case 0:
                {
                    break;
                }

                case 1:
                {
                    if (!Potion.IsChildOf(m.Backpack))
                    {
                        m.SendLocalizedMessage(1062334);     // This item must be in your backpack to be used.
                        return;
                    }

                    if (Potion.Destination == null || Potion.Destination.Item == null || Potion.Destination.Item.Deleted ||
                        Potion.Source == null || Potion.Source.Item == null || Potion.Source.Item.Deleted)
                    {
                        return;
                    }

                    if (!Potion.Source.Item.IsChildOf(m.Backpack) || !Potion.Destination.Item.IsChildOf(m.Backpack))
                    {
                        Potion.Source = null;
                        m.SendLocalizedMessage(1062334);     // This item must be in your backpack to be used.
                        return;
                    }

                    Potion.Destination.Props = Mannequin.FindMagicalItemProperty(Potion.Destination.Item);

                    if (Potion.CheckMagicalItem(Potion.Destination.Props))
                    {
                        m.SendLocalizedMessage(1159504);     // The destination item must be free of any magical properties.
                        return;
                    }

                    if (Potion.Destination.Props.Except(Potion.Source.Props).Any(x => x is MedableArmorProperty))
                    {
                        m.SendLocalizedMessage(1159678);     // Both source and destination objects must allow the use of the meditation skill (medable) or both block the meditation skill (non-medable).
                    }

                    m.CloseGump(typeof(BaseTransmogrificationPotionGump));

                    m.PlaySound(491);

                    Potion.Source.Item.AttachSocket(new Transmogrified());

                    var socket = Potion.Source.Item.GetSocket <Transmogrified>();

                    if (socket != null)
                    {
                        socket.SourceName = Potion.Source.Item.Name;
                    }

                    Potion.Source.Item.ItemID   = Potion.Destination.Item.ItemID;
                    Potion.Source.Item.Hue      = Potion.Destination.Item.Hue;
                    Potion.Source.Item.LootType = Potion.Destination.Item.LootType;
                    Potion.Source.Item.Insured  = Potion.Destination.Item.Insured;

                    Potion.Destination.Item.Delete();
                    Potion.Delete();

                    break;
                }
                }
            }
Exemple #9
0
            public override void OnResponse(NetState sender, RelayInfo info)
            {
                if (Potion.Deleted)
                {
                    return;
                }

                Mobile m = sender.Mobile;

                switch (info.ButtonID)
                {
                case 0:
                    break;

                case 1:
                    m.SendLocalizedMessage(1159498);     // Target the object that you wish to transfer properties FROM...
                    Potion.Source = null;
                    m.Target      = new InternalTarget(Potion, true);
                    break;

                case 2:
                    m.SendLocalizedMessage(1159499);     // Target the object you wish to transfer properties TO...
                    Potion.Destination = null;
                    m.Target           = new InternalTarget(Potion, false);
                    break;

                case 3:
                    if (!Potion.IsChildOf(m.Backpack))
                    {
                        m.SendLocalizedMessage(1062334);     // This item must be in your backpack to be used.
                        return;
                    }

                    if (Potion.Destination == null || Potion.Destination.Item == null || Potion.Destination.Item.Deleted ||
                        Potion.Source == null || Potion.Source.Item == null || Potion.Source.Item.Deleted)
                    {
                        return;
                    }

                    if (!Potion.Source.Item.IsChildOf(m.Backpack) || !Potion.Destination.Item.IsChildOf(m.Backpack))
                    {
                        Potion.Source = null;
                        m.SendLocalizedMessage(1062334);     // This item must be in your backpack to be used.
                        return;
                    }

                    Potion.Destination.Props = Mannequin.FindMagicalItemProperty(Potion.Destination.Item);

                    if (Potion.CheckMagicalItem(Potion.Destination.Props))
                    {
                        m.SendLocalizedMessage(1159504);     // The destination item must be free of any magical properties.
                        return;
                    }

                    if (Potion.Destination.Props.Except(Potion.Source.Props).Any(x => x is MedableArmorProperty))
                    {
                        m.SendLocalizedMessage(1159678);     // Both source and destination objects must allow the use of the meditation skill (medable) or both block the meditation skill (non-medable).
                    }

                    m.CloseGump(typeof(BaseTransmogrificationPotionGump));
                    m.SendGump(new BaseTransmogrificationPotionGump(Potion));

                    m.CloseGump(typeof(BaseTransmogrificationPotionConfirmGump));
                    m.SendGump(new BaseTransmogrificationPotionConfirmGump(Potion));

                    break;
                }
            }
Exemple #10
0
                protected override void OnTarget(Mobile from, object targeted)
                {
                    if (!(targeted is Item targetitem) || Potion.Deleted)
                    {
                        return;
                    }

                    if (!Potion.IsChildOf(from.Backpack) || !targetitem.IsChildOf(from.Backpack))
                    {
                        from.SendLocalizedMessage(1060640); // The item must be in your backpack to use it.
                        return;
                    }

                    var ip = new ItemProps {
                        Item = targetitem, Props = Mannequin.FindMagicalItemProperty(targetitem)
                    };

                    if (IsSource)
                    {
                        Potion.Source = ip;
                    }
                    else
                    {
                        if (Potion.CheckMagicalItem(ip.Props))
                        {
                            from.SendLocalizedMessage(1159504); // The destination item must be free of any magical properties.
                            return;
                        }

                        if (targetitem.HasSocket <Transmogrified>())
                        {
                            from.Send(new AsciiMessage(-1, -1, MessageType.Label, 946, 3, "System", "This item has already been transmogrified."));
                        }
                        else
                        {
                            Potion.Destination = ip;
                        }
                    }

                    int message = 0;

                    if (targetitem.Layer != Potion.ItemLayer)
                    {
                        message = Potion.ValidFailMessage;
                    }
                    else if (Potion.Destination != null && Potion.Destination.Item != null && !Potion.Destination.Item.Deleted &&
                             Potion.Source != null && Potion.Source.Item != null && !Potion.Source.Item.Deleted)
                    {
                        if (Potion.Destination.Item == Potion.Source.Item)
                        {
                            message = 1159518; // You may not set the source and destination objects to the same object!
                        }
                        else if (RaceDefinitions.GetRequiredRace(Potion.Destination.Item) != RaceDefinitions.GetRequiredRace(Potion.Source.Item))
                        {
                            message = 1159560; // You may not set the source and destination objects to objects of different race requirements.
                        }
                        else if (!Potion.CheckRules())
                        {
                            message = Potion.ValidFailMessage;
                        }
                        else if (Potion.Destination.Props.Except(Potion.Source.Props).Any(x => x is MedableArmorProperty))
                        {
                            message = 1159678; // Both source and destination objects must allow the use of the meditation skill (medable) or both block the meditation skill (non-medable).
                        }
                    }

                    if (message == 0)
                    {
                        from.CloseGump(typeof(BaseTransmogrificationPotionGump));
                        from.SendGump(new BaseTransmogrificationPotionGump(Potion));
                    }
                    else
                    {
                        if (IsSource)
                        {
                            Potion.Source = null;
                        }
                        else
                        {
                            Potion.Destination = null;
                        }

                        from.SendLocalizedMessage(message);
                    }
                }
 public MannequinTarget(Mobile from, Mannequin man) : base(-1, true, TargetFlags.None)
 {
     m_From   = from;
     m_Man    = man;
     CheckLOS = false;
 }
Exemple #12
0
        static void Main(string[] args)
        {
            /*
             *               //Test 1
             *
             * Mannequin test = new Mannequin() { Age=20,CIN="12345678",Poid=60,Taille=160,NumContact=12345678};
             * DefileContext ctx = new DefileContext();
             * //Mannequin test = new Mannequin();
             * ctx.Mannequins.Add(test);
             * ctx.SaveChanges();
             * System.Console.WriteLine("FIN");
             * System.Console.ReadKey();
             */
            //Test 2
            Mannequin test1 = new Mannequin()
            {
                Age = 20, CIN = "12345671", Poid = 60, Taille = 160, NumContact = 12345678, PrixParHeure = 200
            };
            Mannequin test2 = new Mannequin()
            {
                Age = 20, CIN = "12345672", Poid = 60, Taille = 160, NumContact = 12345678, PrixParHeure = 200
            };

            StylisteModeliste st = new StylisteModeliste {
                Nom = "admin", Prenom = "admin", Telephone = 12345678
            };

            Article a = new Article()
            {
                nbAccessoires           = 2,
                Couleur                 = "rouge",
                Matiere                 = "velour de soie",
                PrixUnitaireFabrication = 100,
                PrixUnitaireVente       = 9000
            };
            Article b = new Article()
            {
                nbAccessoires           = 5,
                Couleur                 = "jaune",
                Matiere                 = "satin de soie",
                PrixUnitaireFabrication = 150,
                PrixUnitaireVente       = 7000
            };



            LeDefile def = new LeDefile
            {
                DateEvennement    = new DateTime(2017, 10, 14),
                StylisteModeliste = st,
                Duree             = 5,
                Lieu = new Lieu()
                {
                    Avenue = "test", Rue = "test"
                },
                Articles = new List <Article>()
                {
                    a, b
                }
            };



            DefileContext ctx = new DefileContext();

            //ctx.Mannequins.Add(test1);
            //ctx.Mannequins.Add(test2);
            ctx.Articles.Add(a);
            ctx.Articles.Add(b);
            ctx.StylisteModelistes.Add(st);
            ctx.Deliles.Add(def);

            ctx.SaveChanges();
            System.Console.WriteLine("FIN p1");

            //Test 3

            List <Affectation> aff1 = new List <Affectation>()
            {
                new Affectation {
                    Defile = def, Mannequin = test2, DateEnvoi = new DateTime(2016, 5, 10), Etat = Etat.approuvée
                },
                new Affectation()
                {
                    Defile = def, Mannequin = test2, DateEnvoi = new DateTime(2016, 6, 10), Etat = Etat.envoyée
                },
                new Affectation()
                {
                    Defile = def, Mannequin = test1, DateEnvoi = new DateTime(2016, 9, 10), Etat = Etat.désapprouvée
                }
            };

            ctx.Affectations.AddRange(aff1);


            ctx.SaveChanges();
            System.Console.WriteLine("FIN p2");
            System.Console.ReadKey();



            IMyServiceStyliste service = new MyServiceStyliste();

            System.Console.WriteLine(" gain  = " + service.CalculGain(1, new DateTime(2017, 10, 14)));

            System.Console.WriteLine("Fin p3");
            System.Console.ReadKey();
        }