Ejemplo n.º 1
0
        private void CopyFromLayer(Mobile from, Mobile mimic, Layer layer)
        {
            Item newItem;
            Item oldItem = from.FindItemOnLayer(layer);

            if (oldItem != null)
            {
                Type            t = oldItem.GetType();
                ConstructorInfo c = t.GetConstructor(Type.EmptyTypes);
                if (c != null)
                {
                    try
                    {
                        object o = c.Invoke(null);

                        if (o != null && o is Item)
                        {
                            newItem = (Item)o;
                            Dupe.CopyProperties(newItem, oldItem);//copy.Dupe( item, copy.Amount );
                            mimic.AddItem(newItem);
                            newItem.LootType = LootType.Newbied;
                        }
                    }
                    catch
                    {
                        from.SendMessage("Error!  Please check Charm.cs!");
                        return;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        protected virtual void GenerateTreasure()
        {
            Item item = null;

            AddLoot(LootPack.Food, m_FoodQuantity);
            AddLoot(LootPack.Junk, m_JunkQuantity);
            AddLoot(LootPack.UtilityItems, m_UtilityQuantity);
            AddLoot(LootPack.Regs, m_RegsQuantity);
            AddLoot(LootPack.NecroRegs, m_NecroRegsQuantity);
            AddLoot(LootPack.LeatherAr, m_LeatherARQuantity);
            AddLoot(LootPack.ChainAr, m_ChainARQuantity);
            AddLoot(LootPack.RingAr, m_RingARQuantity);
            AddLoot(LootPack.PlateAr, m_PlateARQuantity);
            //AddLoot(LootPack.Scrolls, m_ScrollsQuantity);

            if (m_GoldQuantity >= 1)
            {
                item = new Gold(m_GoldQuantity + Utility.Random(1, 5));
                this.DropItem(item);
            }

            if (m_SpecialItemsQuantity >= 1)
            {
                for (int i = 0; i < m_SpecialItemsQuantity; ++i)
                {
                    this.DropItem(Dupe.DupeItem(null, cont.Items[Utility.Random(0, cont.Items.Count - 1)], true));
                }
            }
        }
Ejemplo n.º 3
0
        public override IEntity GetEntity()
        {
            if (Item != null && !Item.Deleted)
            {
                return(Dupe.DupeItem(Item));
            }

            return(_Init ? base.GetEntity() : null);
        }
Ejemplo n.º 4
0
        private static Entity [] GetEntities(Dupe dupe)
        {
            Table Entities = dupe.DupeData ["Entities"].TypeTable;

            Entity [] outp = new Entity [Entities.Count];
            Int32     i    = 0;

            foreach (AdvDupeObject Ent in Entities.Values)
            {
                Entity NewEnt          = new Entity();
                Table  EntData         = Ent.TypeTable;
                Table  PropDataPhysics = EntData ["PhysicsObjects"].TypeTable ["0"].TypeTable;
                NewEnt.Pos   = PropDataPhysics ["Pos"].TypeVec;
                NewEnt.Angle = PropDataPhysics ["Angle"].TypeAng;
                NewEnt.Model = EntData ["Model"].TypeString;
                Table Mods = EntData ["EntityMods"].TypeTable;
                if (Mods != null)
                {
                    Table colour = Mods ["colour"].TypeTable;
                    if (colour != null)
                    {
                        NewEnt.HasColorAndEffects = true;
                        NewEnt.RenderFX           = colour ["RenderFX"].TypeDouble;
                        // Render mode is ignored due to not being implamentable
                        Table Colour = colour ["Color"].TypeTable;
                        NewEnt.Color = new Color()
                        {
                            R = Colour ["r"].TypeDouble ?? 0,
                            G = Colour ["g"].TypeDouble ?? 0,
                            B = Colour ["b"].TypeDouble ?? 0,
                            A = Colour ["a"].TypeDouble ?? 0,
                        };
                    }

                    Table material = Mods ["material"].TypeTable;
                    if (material != null)
                    {
                        NewEnt.HasMaterial = true;
                        NewEnt.Material    = material ["MaterialOverride"].TypeString;
                        if (String.IsNullOrWhiteSpace(NewEnt.Material))
                        {
                            NewEnt.HasMaterial = false;
                            NewEnt.Material    = null;
                        }
                    }
                }
                outp [i] = NewEnt;
                i++;
            }

            return(outp);
        }
Ejemplo n.º 5
0
        protected virtual void Morph(Mobile m)
        {
            Body             = m.Body;
            Hue              = m.Hue;
            Female           = m.Female;
            Name             = m.Name;
            NameHue          = m.NameHue;
            Title            = m.Title;
            Kills            = m.Kills;
            HairItemID       = m.HairItemID;
            HairHue          = m.HairHue;
            FacialHairItemID = m.FacialHairItemID;
            FacialHairHue    = m.FacialHairHue;

            MorphSkills(m);


            foreach (Item item in m.Items)
            {
                Item            newItem;
                Type            t;
                ConstructorInfo c;
                object          o;
                if (item.Layer != Layer.Backpack && item.Layer != Layer.Mount && item.Layer != Layer.Bank)
                {
                    t = item.GetType();
                    c = t.GetConstructor(Type.EmptyTypes);

                    if (c != null)
                    {
                        o = c.Invoke(null);
                        if (o != null && o is Item)
                        {
                            //TODO: How to copy ASHammer
                            newItem = (Item)o;
                            Dupe.CopyProperties(newItem, item);
                            newItem.LootType = LootType.Newbied;
                            item.OnAfterDuped(newItem);
                            newItem.Parent = null;
                            AddItem(newItem);
                            newItem.InvalidateProperties();
                        }
                    }
                }
            }

            PlaySound(0x511);
            FixedParticles(0x376A, 1, 14, 5045, EffectLayer.Waist);
        }
Ejemplo n.º 6
0
 protected override void OnTarget(Mobile from, object targeted)
 {
     if (targeted is Item)
     {
         foreach (Mobile m in World.Mobiles.Values)
         {
             Item i = Dupe.DupeItem(null, (Item)targeted, true);
             m.AddToBackpack(i);
         }
     }
     else
     {
         from.SendMessage("Ceci n'est pas un item.");
     }
 }
Ejemplo n.º 7
0
 private void dupeFinderWorker_DoWork(object sender, DoWorkEventArgs e)
 {
     /*Track t=null;
      * Expression<Func<Dupe, bool>> exp;
      * if(radioHash.Checked) exp=HashPredicate(t);
      * else if(radioTitle.Checked) exp=TitlePredicate(t);
      * else exp=FilenamePredicate(t);*/
     listOfDupes.Clear();
     for (int i = 0; i < tracks.Count; i++)
     {
         Track t = tracks[i];
         if (!File.Exists(t.filename))
         {
             continue;
         }
         Dupe where;
         string matchstring;
         if (radioHash.Checked)
         {
             matchstring = GetMd5(t.filename).ToHex(false);
             where       = listOfDupes.FirstOrDefault(d => new FileInfo(t.filename).Length == new FileInfo(d.files.FirstOrDefault().filename).Length&& matchstring == GetMd5(d.files.FirstOrDefault().filename).ToHex(false));
         }
         else if (radioTitle.Checked)
         {
             where       = listOfDupes.FirstOrDefault(d => d.files.FirstOrDefault().title.ToLower() == t.title.ToLower());
             matchstring = t.title;
         }
         else
         {
             where       = listOfDupes.FirstOrDefault(d => d.files.FirstOrDefault().filename == t.filename);
             matchstring = t.filename;
         }
         if (where != null)
         {
             where.files.Add(t);
         }
         else
         {
             Dupe dp = new Dupe(matchstring);
             dp.files.Add(t);
             listOfDupes.Add(dp);
         }
         dupeFinderWorker.ReportProgress((int)((float)i / (float)tracks.Count * 100));
     }
     listOfDupes = listOfDupes.Where(x => x.files.Count > 1).ToList();
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Rewards the top 3 place winners by giving the specified item(s) and
        /// placing them in thier banks.Notifies the winners that thier winnings
        /// have been placed in thier bank.
        /// Loads the previous tournaments.xml file
        /// Saves the results to the tournaments.xml file
        /// Removes the spectator gates.
        /// Moves the winners so they may leave.
        /// Stops the tournament timer to officially end the tournament.
        /// </summary>
        /// <param name="first"> First place contestant</param>
        /// <param name="second"> Second place contestant</param>
        /// <param name="third"> Third place contestant</param>
        public static void TournamentReward(Tournament t, string place, Teams team)
        {
            BankBox bank;
            Item    prize = (Item)Activator.CreateInstance(t.Prizes[place].GetType(), false);

            Dupe.CopyProperties(prize, t.Prizes[place]);

            foreach (Mobile m in team.getOwners())
            {
                bank = m.BankBox;
                bank.AddItem(prize);
                m.SendMessage("Your winnings have been sent to your bankbox.");
                if (place.Contains("first"))
                {
                    World.Broadcast(0, false, m.Name + " has won the " + t.TeamSize + " tournament.");
                }
            }
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Augmente le rang du joueur de 1 si c'est possible, et lui donne le stock lié à son nouveau rang.
 /// Si le rang est == à 1, on vérifie si il n'a pas déjà eu son stock de départ.
 /// </summary>
 /// <param name="m">Le mobile à rankup.</param>
 public void RankUp(Mobile m)
 {
     if (m_Mobiles.ContainsKey(m))
     {
         if (m_Mobiles[m] >= 0 && m_Mobiles[m] < RANKMAX)
         {
             m_Mobiles[m]++;
             if (!(m_RegisteredMobiles.Contains(m)) || m_Mobiles[m] != 1)  // Si le nouveau rang est == 1, cela veut dire que l'ancien était 0.
             {
                 if (Containers[m_Mobiles[m]] != null)
                 {
                     Item i = Dupe.DupeItem(m, Containers[m_Mobiles[m]], true); // On dupe le container lié au rang du mobile.
                     i.Visible = true;
                     m.Backpack.AddItem(i);
                 }
             }
         }
     }
 }
Ejemplo n.º 10
0
        public Fetichisme(Mobile Target)
            : base(AIType.AI_Animal, FightMode.None, 10, 1, 0.1, 0.1)
        {
            Name = Target.Name;
            Hue  = Target.Hue;

            Body = Target.Body;

            SetStr(Target.Str);
            SetDex(Target.Dex);
            SetInt(Target.Int);

            SetHits(Target.HitsMax);
            Hits = Target.Hits;
            Mana = Target.Mana;
            Stam = Target.Stam;

            if (Target.Weapon != null)
            {
                BaseWeapon weapon = (BaseWeapon)Target.Weapon;
                SetDamage((int)weapon.MinDamage - 5, (int)weapon.MaxDamage + 5);
            }
            else
            {
                SetDamage(10, 30);
            }

            //SetSkill(SkillName.EvalInt, Target.Skills[SkillName.EvalInt].Value);
            SetSkill(SkillName.ArtMagique, Target.Skills[SkillName.ArtMagique].Value);
            //SetSkill(SkillName.MagicResist, Target.Skills[SkillName.MagicResist].Value);
            SetSkill(SkillName.Tactiques, Target.Skills[SkillName.Tactiques].Value);
            SetSkill(SkillName.Anatomie, Target.Skills[SkillName.Anatomie].Value);
            //SetSkill(SkillName.Swords, Target.Skills[SkillName.Swords].Value);
            //SetSkill(SkillName.Macing, Target.Skills[SkillName.Macing].Value);
            //SetSkill(SkillName.Archery, Target.Skills[SkillName.Archery].Value);
            //SetSkill(SkillName.Fencing, Target.Skills[SkillName.Fencing].Value);


            VirtualArmor = Target.VirtualArmor;
            ControlSlots = 1;

            ArrayList PossessItems = new ArrayList(Target.Items);

            try
            {
                for (int i = 0; i < PossessItems.Count; i++)
                {
                    Item item = (Item)PossessItems[i];
                    if (Array.IndexOf(ItemLayers, item.Layer) != -1)
                    {
                        Item itemb = Dupe.DupeItem(Target, item, false);

                        if (itemb != null)
                        {
                            this.EquipItem(itemb);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Possess: MoveItems Exception: {0}", e.Message);
            }

            FocusMob  = Target;
            Combatant = Target;
        }
Ejemplo n.º 11
0
 public static void CopyProps(Item dest, Item src)
 {
     Dupe.CopyProperties(dest, src, dest.GetType(), m_PropsToNotChange);
 }
Ejemplo n.º 12
0
        public Copie(Mobile caster, Mobile lacopie)
            : base(AIType.AI_Animal, FightMode.None, 10, 1, 0.1, 0.1)
        {
            m_Caster = caster;

            Name = lacopie.Name;
            Hue  = lacopie.Hue;

            Body = lacopie.Body;

            SetStr(lacopie.Str);
            SetDex(lacopie.Dex);
            SetInt(lacopie.Int);

            SetHits(lacopie.HitsMax / 2);

            if (lacopie.Weapon != null)
            {
                BaseWeapon weapon = (BaseWeapon)lacopie.Weapon;
                SetDamage((int)weapon.MinDamage - 5, (int)weapon.MaxDamage + 5);
            }
            else
            {
                SetDamage(10, 30);
            }

            //SetSkill(SkillName.EvalInt, lacopie.Skills[SkillName.EvalInt].Value);
            SetSkill(SkillName.ArtMagique, lacopie.Skills[SkillName.ArtMagique].Value);
            //SetSkill(SkillName.MagicResist, lacopie.Skills[SkillName.MagicResist].Value);
            SetSkill(SkillName.Tactiques, lacopie.Skills[SkillName.Tactiques].Value);
            SetSkill(SkillName.Anatomie, lacopie.Skills[SkillName.Anatomie].Value);
            SetSkill(SkillName.Epee, lacopie.Skills[SkillName.Epee].Value);
            SetSkill(SkillName.ArmeContondante, lacopie.Skills[SkillName.ArmeContondante].Value);
            SetSkill(SkillName.ArmeDistance, lacopie.Skills[SkillName.ArmeDistance].Value);
            SetSkill(SkillName.ArmePerforante, lacopie.Skills[SkillName.ArmePerforante].Value);

            VirtualArmor = lacopie.VirtualArmor;
            ControlSlots = 2;

            ArrayList PossessItems = new ArrayList(lacopie.Items);

            try
            {
                for (int i = 0; i < PossessItems.Count; i++)
                {
                    Item item = (Item)PossessItems[i];
                    if (Array.IndexOf(ItemLayers, item.Layer) != -1)
                    {
                        Item itemb = Dupe.DupeItem(this, item, false);

                        if (itemb != null)
                        {
                            this.EquipItem(itemb);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Possess: MoveItems Exception: {0}", e.Message);
            }

            new CopieTimer(this as Copie).Start();

            m_CopieTable[Caster] = this;

            Aggro = false;
        }
Ejemplo n.º 13
0
        public void CompleteCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CustomCraft customCraft)
        {
            int badCraft = craftSystem.CanCraft(from, tool, m_Type);

            if (badCraft > 0)
            {
                if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                {
                    from.SendGump(new CraftGump(from, craftSystem, tool, badCraft));
                }
                else
                {
                    from.SendLocalizedMessage(badCraft);
                }

                return;
            }

            int    checkResHue = 0, checkMaxAmount = 0;
            object checkMessage = null;

            // Not enough resource to craft it
            if (!ConsumeRes(from, typeRes, craftSystem, ref checkResHue, ref checkMaxAmount, ConsumeType.None, ref checkMessage))
            {
                if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                {
                    from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage));
                }

                else if (checkMessage is int && (int)checkMessage > 0)
                {
                    from.SendLocalizedMessage((int)checkMessage);
                }

                else if (checkMessage is string)
                {
                    from.SendMessage((string)checkMessage);
                }

                return;
            }

            else if (!ConsumeAttributes(from, ref checkMessage, false))
            {
                if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                {
                    from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage));
                }

                else if (checkMessage is int && (int)checkMessage > 0)
                {
                    from.SendLocalizedMessage((int)checkMessage);
                }

                else if (checkMessage is string)
                {
                    from.SendMessage((string)checkMessage);
                }

                return;
            }

            bool toolBroken = false;

            int ignored    = 1;
            int endquality = 1;

            bool allRequiredSkills = true;

            if (CheckSkills(from, typeRes, craftSystem, ref ignored, ref allRequiredSkills))
            {
                // Resource
                int resHue    = 0;
                int maxAmount = 0;

                object message = null;

                // Not enough resource to craft it
                if (!ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref message))
                {
                    if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                    {
                        from.SendGump(new CraftGump(from, craftSystem, tool, message));
                    }

                    else if (message is int && (int)message > 0)
                    {
                        from.SendLocalizedMessage((int)message);
                    }

                    else if (message is string)
                    {
                        from.SendMessage((string)message);
                    }

                    return;
                }

                else if (!ConsumeAttributes(from, ref message, true))
                {
                    if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                    {
                        from.SendGump(new CraftGump(from, craftSystem, tool, message));
                    }

                    else if (message is int && (int)message > 0)
                    {
                        from.SendLocalizedMessage((int)message);
                    }

                    else if (message is string)
                    {
                        from.SendMessage((string)message);
                    }

                    return;
                }

                tool.UsesRemaining--;

                if (craftSystem is DefBlacksmithy)
                {
                    AncientSmithyHammer hammer = from.FindItemOnLayer(Layer.OneHanded) as AncientSmithyHammer;

                    if (hammer != null && hammer != tool)
                    {
                        hammer.UsesRemaining--;

                        if (hammer.UsesRemaining < 1)
                        {
                            hammer.Delete();
                        }
                    }
                }

                if (tool.UsesRemaining < 1)
                {
                    toolBroken = true;
                }

                if (toolBroken)
                {
                    tool.Delete();
                }

                int num = 0;

                Item item;

                if (customCraft != null)
                {
                    item = customCraft.CompleteCraft(out num);
                }

                else if (typeof(MapItem).IsAssignableFrom(ItemType) && from.Map != Map.Trammel && from.Map != Map.Felucca)
                {
                    item = new IndecipherableMap();
                    from.SendLocalizedMessage(1070800); // The map you create becomes mysteriously indecipherable.
                }

                else
                {
                    item = Activator.CreateInstance(ItemType) as Item;
                }

                if (item != null)
                {
                    if (item is ICraftable)
                    {
                        endquality = ((ICraftable)item).OnCraft(quality, makersMark, from, craftSystem, typeRes, tool, this, resHue);

                        //TEST: CHECK THIS
                        if (craftSystem is DefCarpentry)
                        {
                            item.Hue = resHue;
                        }
                    }

                    else if (item.Hue == 0 && resHue != 0)
                    {
                        item.Hue = resHue;
                    }

                    if (maxAmount > 0)
                    {
                        if (!item.Stackable && item is IUsesRemaining)
                        {
                            ((IUsesRemaining)item).UsesRemaining *= maxAmount;
                        }

                        else
                        {
                            item.Amount = maxAmount;
                        }
                    }

                    item.CraftedBy   = from;
                    item.CrafterName = from.RawName;
                    item.ItemGroup   = ItemGroupType.Crafted;

                    if (m_Count > 1)
                    {
                        if (item.Stackable)
                        {
                            item.Amount = m_Count;
                            from.AddToBackpack(item);
                        }

                        else
                        {
                            for (int a = 0; a < m_Count; a++)
                            {
                                Item duplicate = Dupe.DupeItem(item);

                                if (duplicate != null)
                                {
                                    from.AddToBackpack(duplicate);
                                }
                            }
                        }
                    }

                    else
                    {
                        from.AddToBackpack(item);
                    }

                    if (from.AccessLevel > AccessLevel.Player)
                    {
                        CommandLogging.WriteLine(from, "Crafting {0} with craft system {1}", CommandLogging.Format(item), craftSystem.GetType().Name);
                    }
                }

                if (num == 0)
                {
                    num = craftSystem.PlayEndingEffect(from, false, true, toolBroken, endquality, makersMark, this);
                }

                bool queryFactionImbue = false;

                int availableSilver = 0;

                if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                {
                    from.SendGump(new CraftGump(from, craftSystem, tool, num));
                }

                else if (num > 0)
                {
                    from.SendLocalizedMessage(num);
                }
            }

            else if (!allRequiredSkills)
            {
                if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                {
                    from.SendGump(new CraftGump(from, craftSystem, tool, 1044153));
                }

                else
                {
                    from.SendLocalizedMessage(1044153); // You don't have the required skills to attempt this item.
                }
            }

            else
            {
                ConsumeType consumeType = (UseAllRes ? ConsumeType.Half : ConsumeType.All);

                int resHue    = 0;
                int maxAmount = 0;

                object message = null;

                // Not enough resource to craft it
                if (!ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, consumeType, ref message, true))
                {
                    if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                    {
                        from.SendGump(new CraftGump(from, craftSystem, tool, message));
                    }

                    else if (message is int && (int)message > 0)
                    {
                        from.SendLocalizedMessage((int)message);
                    }

                    else if (message is string)
                    {
                        from.SendMessage((string)message);
                    }

                    return;
                }

                tool.UsesRemaining--;

                if (tool.UsesRemaining < 1)
                {
                    toolBroken = true;
                }

                if (toolBroken)
                {
                    tool.Delete();
                }

                int num = craftSystem.PlayEndingEffect(from, true, true, toolBroken, endquality, false, this);

                if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
                {
                    from.SendGump(new CraftGump(from, craftSystem, tool, num));
                }

                else if (num > 0)
                {
                    from.SendLocalizedMessage(num);
                }
            }
        }
Ejemplo n.º 14
0
    public override void ExecuteBuild()
    {
        Log("************************* Analyze Third Party Libs");

        // figure out what batch/script to run
        switch (UnrealBuildTool.BuildHostPlatform.Current.Platform)
        {
        case UnrealTargetPlatform.Win64:
        case UnrealTargetPlatform.Mac:
        case UnrealTargetPlatform.Linux:
            break;

        default:
            throw new AutomationException("Unknown runtime platform!");
        }

        // go to the third party lib dir
        CommandUtils.PushDir(LibDir);

        // figure out what libraries to evaluate
        string LibsToEvaluateString = ParseParamValue("Libs");

        // Determine which libraries to evaluate
        List <string> LibsToEvaluate = new List <string>();

        if (string.IsNullOrEmpty(LibsToEvaluateString))
        {
            // loop over third party directories looking for the right batch files
            foreach (string Dir in Directory.EnumerateDirectories("."))
            {
                LibsToEvaluate.Add(Path.GetFileName(Dir));
            }
        }
        else
        {
            // just split up the param and make sure the batch file exists
            string[] Libs = LibsToEvaluateString.Split('+');
            foreach (string Dir in Libs)
            {
                LibsToEvaluate.Add(Path.GetFileName(Dir));
            }
        }

        // Make a list of platforms
        List <PlatformLibraryInfo> Platforms = new List <PlatformLibraryInfo>();

        Platforms.Add(new PlatformLibraryInfo("Windows", "Windows", "Win32", "Win64", "VS20"));
        Platforms.Add(new PlatformLibraryInfo("Mac", "Osx", "Mac"));
        Platforms.Add(new PlatformLibraryInfo("iOS", "IOS"));
        Platforms.Add(new PlatformLibraryInfo("Android", "Android"));
        Platforms.Add(new PlatformLibraryInfo("PS4", "PS4"));
        Platforms.Add(new PlatformLibraryInfo("XB1", "XBoxOne"));
        Platforms.Add(new PlatformLibraryInfo("HTML5", "HTML5"));
        Platforms.Add(new PlatformLibraryInfo("Linux", "Linux"));
        Platforms.Add(new PlatformLibraryInfo("WinRT", "WinRT"));

        Platforms.Add(new PlatformLibraryInfo("VS2012", "VS2012", "vs11"));
        Platforms.Add(new PlatformLibraryInfo("VS2013", "VS2013", "vs12"));

        List <long> LastSizes = new List <long>();

        foreach (var Platform in Platforms)
        {
            LastSizes.Add(0);
        }

        // now go through and evaluate each package
        long TotalSize = 0;

        foreach (string Lib in LibsToEvaluate)
        {
            ThirdPartyLibraryInfo Info = new ThirdPartyLibraryInfo(Lib);

            long Size = Info.GetSize(Platforms);

            Log("Library {0} is {1}", Lib, ToMegabytes(Size));

            long Total = 0;
            for (int Index = 0; Index < Platforms.Count; ++Index)
            {
                PlatformLibraryInfo Platform = Platforms[Index];
                long Growth = Platform.TotalSize - LastSizes[Index];
                Log("  {0} is {1}", Platform.PlatformName, ToMegabytes(Growth));

                LastSizes[Index] = Platform.TotalSize;
                Total           += Growth;
            }
            Log("  Platform neutral is probably {0} (specific sum {1})", ToMegabytes(Size - Total), ToMegabytes(Total));

            TotalSize += Size;
        }


        // Make a list of known large file types
        List <string> LargeFileExtensions = new List <string>();

        LargeFileExtensions.AddRange(new string[] { ".pdb", ".a", ".lib", ".dll", ".dylib", ".bc", ".so" });

        // Hackery, look for big files (re-traverses everything)
        Log("----");
        foreach (string Lib in LibsToEvaluate)
        {
            ThirdPartyLibraryInfo Info = new ThirdPartyLibraryInfo(Lib);
            Info.FindLargeFiles(LargeFileExtensions, 1024 * 1024);
        }

        // Hackery, look for VS mixes (re-traverses everything)
        Log("----");
        long TotalShadow12 = 0;

        Log("Listing VS2012 directories that are shadowed by a VS2013 dir");
        foreach (string Lib in LibsToEvaluate)
        {
            string[] Dirs = Directory.GetDirectories(Lib, "*.*", SearchOption.AllDirectories);

            List <string> Dupes = new List <string>();

            foreach (string Dir in Dirs)
            {
                string VS2012 = "VS2012";
                string VS2013 = "VS2013";

                int Index = Dir.IndexOf(VS2013);
                if (Dir.EndsWith(VS2013))
                {
                    string Prefix = Dir.Substring(0, Index);

                    foreach (string OtherDir in Dirs)
                    {
                        if (OtherDir == (Prefix + VS2012))
                        {
                            Dupes.Add(OtherDir);
                        }
                    }
                }
            }

            foreach (string Dupe in Dupes)
            {
                long          Size = 0;
                DirectoryInfo DI   = new DirectoryInfo(Dupe);
                foreach (FileInfo FI in DI.EnumerateFiles("*.*", SearchOption.AllDirectories))
                {
                    Size += FI.Length;
                }

                if (Size > 128 * 1024)
                {
                    TotalShadow12 += Size;

                    string GoodPath = (LibDir + "/" + Dupe).Replace("\\", "/");
                    Log("{0}", GoodPath);
                }
            }
        }
        Log("OVERALL {0} of VS2012 files are shadowed by a VS2013 dir", ToMegabytes(TotalShadow12));

        Log("----");
        foreach (var Platform in Platforms)
        {
            Log("  {0} is {1} (estimate)", Platform.PlatformName, ToMegabytes(Platform.TotalSize));
        }
        Log("  OVERALL is {0} (accurate)", ToMegabytes(TotalSize));

        // undo the LibDir push
        CommandUtils.PopDir();


        Log("Listing VS2012 bin directories that are shadowed by a VS2013 dir");
        //string[] BinaryDirs
        //foreach (string Lib in BinaryDirs)
        {
            string BinDir = "Engine/Binaries";

            string[] Dirs = Directory.GetDirectories(BinDir, "*.*", SearchOption.AllDirectories);

            List <string> Dupes = new List <string>();

            foreach (string Dir in Dirs)
            {
                string VS2012 = "VS2012";
                string VS2013 = "VS2013";

                int Index = Dir.IndexOf(VS2013);
                if (Dir.EndsWith(VS2013))
                {
                    string Prefix = Dir.Substring(0, Index);

                    foreach (string OtherDir in Dirs)
                    {
                        if (OtherDir == (Prefix + VS2012))
                        {
                            Dupes.Add(OtherDir);
                        }
                    }
                }
            }

            foreach (string Dupe in Dupes)
            {
                long          Size = 0;
                DirectoryInfo DI   = new DirectoryInfo(Dupe);
                foreach (FileInfo FI in DI.EnumerateFiles("*.*", SearchOption.AllDirectories))
                {
                    Size += FI.Length;
                }

//				if (Size > 128 * 1024)
                {
                    TotalShadow12 += Size;

                    string GoodPath = Dupe.Replace("\\", "/");
                    Log("{0}", GoodPath);
                }
            }
        }

        PrintRunTime();
    }
Ejemplo n.º 15
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                Item target = ((Item)targeted);

                Container pack = from.Backpack;

                if (pack == null)
                {
                    from.SendMessage("Please ensure you have a pack.");
                    return;
                }

                if (target == null || target.Deleted || !(target is Runebook) || ((Runebook)target).Entries.Count > 0)
                {
                    from.SendMessage("You can only copy to an empty runebook.");
                    return;
                }

                if (target.RootParent != from)
                {
                    from.SendMessage("The runebook you wish to write to must be in your backpack.");
                    return;
                }

                if (ConsumeTotal(pack, ((Runebook)m_Source).Entries.Count, true) > -1)
                {
                    from.SendMessage("This operation requires unmarked recall runes and mark scrolls.");
                    from.SendMessage("Total of each needed: {0}.", ((Runebook)m_Source).Entries.Count);
                    return;
                }

                Type t = typeof(Runebook);

                ConstructorInfo c = t.GetConstructor(Type.EmptyTypes);

                if (c != null)
                {
                    try
                    {
                        from.SendMessage("Writing Copy...");

                        object o = c.Invoke(null);

                        if (o != null && o is Item)
                        {
                            Item newItem = (Item)o;
                            Dupe.CopyProperties(newItem, m_Source);
                            m_Source.OnAfterDuped(newItem);
                            newItem.Parent = null;
                            pack.DropItem(newItem);

                            newItem.InvalidateProperties();
                            from.SendMessage("Done");
                            m_Pen.UsesRemaining -= 1;
                            m_Pen.InvalidateProperties();
                            target.Delete();
                        }
                    }
                    catch
                    {
                        from.SendMessage("Error, please notify a GM!");
                    }
                }
            }