コード例 #1
0
ファイル: TinkingMenu.cs プロジェクト: zerodowned/Origins
        public override void OnResponse(NetState state, int index)
        {
            if (IsFrom == "Wood")
            {
                Type type = null;

                CraftContext   context  = DefTinkering.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefTinkering.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex)).UseSubRes2 ? DefTinkering.CraftSystem.CraftSubRes2 : DefTinkering.CraftSystem.CraftSubRes);
                int            resIndex = (DefTinkering.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex)).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }

                DefTinkering.CraftSystem.CreateItem(m_Mobile, DefTinkering.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex)).ItemType, typeof(Log), m_Tool, DefTinkering.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex)));
            }
            else if (IsFrom == "Metal")
            {
                Type type = null;

                CraftContext   context  = DefTinkering.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefTinkering.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex + 5)).UseSubRes2 ? DefTinkering.CraftSystem.CraftSubRes2 : DefTinkering.CraftSystem.CraftSubRes);
                int            resIndex = (DefTinkering.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex + 5)).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }

                DefTinkering.CraftSystem.CreateItem(m_Mobile, DefTinkering.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex + 5)).ItemType, typeof(IronIngot), m_Tool, DefTinkering.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex + 5)));
            }
        }
コード例 #2
0
        public override void OnResponse(NetState state, int index)
        {
            Type type = null;

            CraftContext   context  = DefBowFletching.CraftSystem.GetContext(m_Mobile);
            CraftSubResCol res      = (DefBowFletching.CraftSystem.CraftItems.GetAt(m_Entries[index].craftIndex).UseSubRes2 ? DefBlacksmithy.CraftSystem.CraftSubRes2 : DefBowFletching.CraftSystem.CraftSubRes);
            int            resIndex = (DefBowFletching.CraftSystem.CraftItems.GetAt(m_Entries[index].craftIndex).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

            if (resIndex > -1)
            {
                type = res.GetAt(resIndex).ItemType;
            }
            DefBowFletching.CraftSystem.CreateItem(m_Mobile, DefBowFletching.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex)).ItemType, type, m_Tool, DefBowFletching.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex)));
        }
コード例 #3
0
        public ItemListEntry[] CreateResList()
        {
            CraftSubResCol       res      = CurrentCraftSystem.CraftSubRes;
            List <ItemListEntry> toReturn = new List <ItemListEntry>();
            CraftSubRes          subResource;

            if (CurrentCraftSystem.CraftSubRes.Init && CurrentCraftSystem.CraftSubRes.Count >= 1)
            {
                for (int i = 0; i < res.Count; ++i)
                {
                    subResource = res.GetAt(i);

                    int hue = ResourceInfoList[subResource].Hue;

                    if (hue > 1)
                    {
                        hue--;
                    }

                    if (subResource.NameNumber > 0)
                    {
                        toReturn.Add(new ItemListEntry(CliLoc.LocToString(subResource.NameNumber), ResourceInfoList[subResource].ItemID, hue));
                    }
                    else
                    {
                        toReturn.Add(new ItemListEntry(subResource.NameString, ResourceInfoList[subResource].ItemID, hue));
                    }
                }
            }

            if (CurrentCraftSystem.CraftSubRes2.Init)
            {
                res = CurrentCraftSystem.CraftSubRes2;
                for (int i = 0; i < res.Count; ++i)
                {
                    subResource = res.GetAt(i);

                    if (subResource.NameNumber > 0)
                    {
                        toReturn.Add(new ItemListEntry(CliLoc.LocToString(subResource.NameNumber), ResourceInfoList[subResource].ItemID, ResourceInfoList[subResource].Hue));
                    }
                    else
                    {
                        toReturn.Add(new ItemListEntry(subResource.NameString, ResourceInfoList[subResource].ItemID, ResourceInfoList[subResource].Hue));
                    }
                }
            }

            return(toReturn.ToArray());
        }
コード例 #4
0
        public Type GetResource(int itemID, itemTable[] table)
        {
            itemTable temp = itemTable.Find(table, itemID);

            // recall the selected resource
            CraftContext context = Craft.CraftSystem.GetContext(Craft.From);
            Type         type    = null;

            if (context != null)
            {
                CraftSubResCol res      = (temp.CraftItem.UseSubRes2 ? Craft.CraftSystem.CraftSubRes2 : Craft.CraftSystem.CraftSubRes);
                int            resIndex = (temp.CraftItem.UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }
            }

            return(type);
        }
コード例 #5
0
        public bool ConsumeRes(Mobile from, Type typeRes, CraftSystem craftSystem, ref int resHue, ref int maxAmount,
                               ConsumeType consumeType, ref object message, bool isFailure)
        {
            Container ourPack = from.Backpack;

            if (ourPack == null)
            {
                return(false);
            }

            if (m_NeedHeat && !Find(from, m_HeatSources))
            {
                message = 1044487; // You must be near a fire source to cook.
                return(false);
            }

            if (m_NeedOven && !Find(from, m_Ovens))
            {
                message = 1044493; // You must be near an oven to bake that.
                return(false);
            }

            if (m_NeedMill && !Find(from, m_Mills))
            {
                message = 1044491; // You must be near a flour mill to do that.
                return(false);
            }

            Type[][] types   = new Type[m_arCraftRes.Count][];
            int[]    amounts = new int[m_arCraftRes.Count];

            maxAmount = int.MaxValue;

            CraftSubResCol resCol = m_UseSubRes2 ? craftSystem.CraftSubRes2 : craftSystem.CraftSubRes;

            for (int i = 0; i < types.Length; ++i)
            {
                CraftRes craftRes = m_arCraftRes.GetAt(i);
                Type     baseType = craftRes.ItemType;

                // Resource Mutation
                if (baseType == resCol.ResType && typeRes != null)
                {
                    baseType = typeRes;

                    CraftSubRes subResource = resCol.SearchFor(baseType);

                    if (subResource != null && from.Skills[craftSystem.MainSkill].Base < subResource.RequiredSkill)
                    {
                        message = subResource.Message;
                        return(false);
                    }
                }
                // ******************

                for (int j = 0; types[i] == null && j < m_TypesTable.Length; ++j)
                {
                    if (m_TypesTable[j][0] == baseType)
                    {
                        types[i] = m_TypesTable[j];
                    }
                }

                if (types[i] == null)
                {
                    types[i] = new[] { baseType }
                }
                ;

                amounts[i] = craftRes.Amount;

                // For stackable items that can ben crafted more than one at a time
                if (UseAllRes)
                {
                    int tempAmount = ourPack.GetAmount(types[i]);
                    tempAmount /= amounts[i];
                    if (tempAmount < maxAmount)
                    {
                        maxAmount = tempAmount;

                        if (maxAmount == 0)
                        {
                            CraftRes res = m_arCraftRes.GetAt(i);

                            if (res.MessageNumber > 0)
                            {
                                message = res.MessageNumber;
                            }
                            else if (!String.IsNullOrEmpty(res.MessageString))
                            {
                                message = res.MessageString;
                            }
                            else
                            {
                                message = 502925; // You don't have the resources required to make that item.
                            }
                            return(false);
                        }
                    }
                }
                // ****************************

                if (isFailure && !craftSystem.ConsumeOnFailure(from, types[i][0], this))
                {
                    amounts[i] = 0;
                }
            }

            // We adjust the amount of each resource to consume the max posible
            if (UseAllRes)
            {
                for (int i = 0; i < amounts.Length; ++i)
                {
                    amounts[i] *= maxAmount;
                }
            }
            else
            {
                maxAmount = -1;
            }

            Item consumeExtra = null;

            if (m_NameNumber == 1041267)
            {
                // Runebooks are a special case, they need a blank recall rune

                List <RecallRune> runes = ourPack.FindItemsByType <RecallRune>();

                for (int i = 0; i < runes.Count; ++i)
                {
                    RecallRune rune = runes[i];

                    if (rune != null && !rune.Marked)
                    {
                        consumeExtra = rune;
                        break;
                    }
                }

                if (consumeExtra == null)
                {
                    message = 1044253; // You don't have the components needed to make that.
                    return(false);
                }
            }

            int index = 0;

            // Consume ALL
            if (consumeType == ConsumeType.All)
            {
                m_ResHue    = 0;
                m_ResAmount = 0;
                m_System    = craftSystem;

                if (IsQuantityType(types))
                {
                    index = ConsumeQuantity(ourPack, types, amounts);
                }
                else
                {
                    index = ourPack.ConsumeTotalGrouped(types, amounts, true, OnResourceConsumed, CheckHueGrouping);
                }

                resHue = m_ResHue;
            }

            // Consume Half ( for use all resource craft type )
            else if (consumeType == ConsumeType.Half)
            {
                for (int i = 0; i < amounts.Length; i++)
                {
                    amounts[i] /= 2;

                    if (amounts[i] < 1)
                    {
                        amounts[i] = 1;
                    }
                }

                m_ResHue    = 0;
                m_ResAmount = 0;
                m_System    = craftSystem;

                if (IsQuantityType(types))
                {
                    index = ConsumeQuantity(ourPack, types, amounts);
                }
                else
                {
                    index = ourPack.ConsumeTotalGrouped(types, amounts, true, OnResourceConsumed, CheckHueGrouping);
                }

                resHue = m_ResHue;
            }

            else // ConstumeType.None ( it's basicaly used to know if the crafter has enough resource before starting the process )
            {
                index = -1;

                if (IsQuantityType(types))
                {
                    for (int i = 0; i < types.Length; i++)
                    {
                        if (GetQuantity(ourPack, types[i]) < amounts[i])
                        {
                            index = i;
                            break;
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < types.Length; i++)
                    {
                        if (ourPack.GetBestGroupAmount(types[i], true, CheckHueGrouping) < amounts[i])
                        {
                            index = i;
                            break;
                        }
                    }
                }
            }

            if (index == -1)
            {
                if (consumeType != ConsumeType.None)
                {
                    if (consumeExtra != null)
                    {
                        consumeExtra.Delete();
                    }
                }

                return(true);
            }
            else
            {
                CraftRes res = m_arCraftRes.GetAt(index);

                if (res.MessageNumber > 0)
                {
                    message = res.MessageNumber;
                }
                else if (res.MessageString != null && res.MessageString != String.Empty)
                {
                    message = res.MessageString;
                }
                else
                {
                    message = 502925; // You don't have the resources required to make that item.
                }
                return(false);
            }
        }
コード例 #6
0
        /*public static ItemListEntry[] Other(Mobile from)
         * {
         *  Type type;
         *  int itemid;
         *  string name;
         *  Item item;
         *  CraftRes craftResource;
         *  bool allRequiredSkills = true;
         *  double chance;
         *
         *  ItemListEntry[] entries = new ItemListEntry[DefCarpentry.CraftSystem.CraftItems.Count];
         *
         *  for (int i = 0; i < DefCarpentry.CraftSystem.CraftItems.Count; ++i)
         *  {
         *      chance = DefCarpentry.CraftSystem.CraftItems.GetAt(i).GetSuccessChance(from, typeof(Board), DefCarpentry.CraftSystem, false, ref allRequiredSkills);
         *
         *      if (chance > 0)
         *      {
         *          type = DefCarpentry.CraftSystem.CraftItems.GetAt(i).ItemType;
         *          craftResource = DefCarpentry.CraftSystem.CraftItems.SearchFor(type).Ressources.GetAt(0);
         *
         *          item = null;
         *          try { item = Activator.CreateInstance(type) as Item; }
         *          catch { }
         *          name = item.GetType().Name;
         *          name = name.ToLower();
         *          itemid = item.ItemID;
         *
         *          entries[i-missing] = new ItemListEntry(String.Format("{0}", name), itemid, 0, i);
         *
         *          if (item != null)
         *              item.Delete();
         *      }
         *      else
         *          missing++;//entries[i]= new ItemListEntry("", -1);
         *  }
         *
         *  return entries;
         * }*/

        public override void OnResponse(NetState state, int index)
        {
            if (IsFrom == "Main")
            {
                if (m_Entries[index].craftIndex == 0)
                {
                    IsFrom = "Chairs";
                    m_Mobile.SendMenu(new CarpentryMenu(m_Mobile, Chairs(m_Mobile), IsFrom, m_Tool));
                }
                if (m_Entries[index].craftIndex == 1)
                {
                    IsFrom = "Tables";
                    m_Mobile.SendMenu(new CarpentryMenu(m_Mobile, Tables(m_Mobile), IsFrom, m_Tool));
                }
                else if (m_Entries[index].craftIndex == 2)
                {
                    IsFrom = "Containers";
                    m_Mobile.SendMenu(new CarpentryMenu(m_Mobile, Containers(m_Mobile), IsFrom, m_Tool));
                }
                else if (m_Entries[index].craftIndex == 3)
                {
                    IsFrom = "Misc";
                    m_Mobile.SendMenu(new CarpentryMenu(m_Mobile, Misc(m_Mobile), IsFrom, m_Tool));
                }
            }
            else if (IsFrom == "Chairs")
            {
                Type type = null;

                CraftContext   context  = DefCarpentry.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefCarpentry.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 6).UseSubRes2 ? DefCarpentry.CraftSystem.CraftSubRes2 : DefCarpentry.CraftSystem.CraftSubRes);
                int            resIndex = (DefCarpentry.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 6).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }

                DefCarpentry.CraftSystem.CreateItem(m_Mobile, DefCarpentry.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 6).ItemType, type, m_Tool, DefCarpentry.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 6));
            }
            else if (IsFrom == "Tables")
            {
                Type type = null;

                CraftContext   context  = DefCarpentry.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefCarpentry.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 15).UseSubRes2 ? DefCarpentry.CraftSystem.CraftSubRes2 : DefCarpentry.CraftSystem.CraftSubRes);
                int            resIndex = (DefCarpentry.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 15).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }

                DefCarpentry.CraftSystem.CreateItem(m_Mobile, DefCarpentry.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 15).ItemType, type, m_Tool, DefCarpentry.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 15));
            }
            else if (IsFrom == "Containers")
            {
                Type type = null;

                CraftContext   context  = DefCarpentry.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefCarpentry.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 19).UseSubRes2 ? DefCarpentry.CraftSystem.CraftSubRes2 : DefCarpentry.CraftSystem.CraftSubRes);
                int            resIndex = (DefCarpentry.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 19).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }

                DefCarpentry.CraftSystem.CreateItem(m_Mobile, DefCarpentry.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 19).ItemType, type, m_Tool, DefCarpentry.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 19));
            }
            else if (IsFrom == "Misc")
            {
                Type type = null;

                CraftContext   context  = DefCarpentry.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefCarpentry.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 28).UseSubRes2 ? DefCarpentry.CraftSystem.CraftSubRes2 : DefCarpentry.CraftSystem.CraftSubRes);
                int            resIndex = (DefCarpentry.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 28).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }

                DefCarpentry.CraftSystem.CreateItem(m_Mobile, DefCarpentry.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 28).ItemType, type, m_Tool, DefCarpentry.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 28));
            }
        }
コード例 #7
0
ファイル: TailoringMenu.cs プロジェクト: phpjunkie420/RunUO
        public override void OnResponse(NetState state, int index)
        {
            if (IsFrom == "Main")
            {
                if (Entries[index].craftIndex == 0)
                {
                    IsFrom = "Shirts";
                    m_Mobile.SendMenu(new TailoringMenu(m_Mobile, Shirts(m_Mobile), IsFrom, m_Tool));
                }
                else if (Entries[index].craftIndex == 1)
                {
                    IsFrom = "Pants";
                    m_Mobile.SendMenu(new TailoringMenu(m_Mobile, Pants(m_Mobile), IsFrom, m_Tool));
                }
                else if (Entries[index].craftIndex == 2)
                {
                    IsFrom = "Misc";
                    m_Mobile.SendMenu(new TailoringMenu(m_Mobile, Misc(m_Mobile), IsFrom, m_Tool));
                }
                else if (Entries[index].craftIndex == 3)
                {
                    IsFrom = "BoltOfCloth";
                    m_Mobile.SendMenu(new TailoringMenu(m_Mobile, Bolt(m_Mobile), IsFrom, m_Tool));
                }
            }
            else if (IsFrom == "LeatherMain")
            {
                if (Entries[index].craftIndex == 0)
                {
                    IsFrom = "Footwear";
                    m_Mobile.SendMenu(new TailoringMenu(m_Mobile, Footwear(m_Mobile), IsFrom, m_Tool));
                }
                else if (Entries[index].craftIndex == 1)
                {
                    IsFrom = "Leather";
                    m_Mobile.SendMenu(new TailoringMenu(m_Mobile, Leather(m_Mobile), IsFrom, m_Tool));
                }
                else if (Entries[index].craftIndex == 2)
                {
                    IsFrom = "Studded";
                    m_Mobile.SendMenu(new TailoringMenu(m_Mobile, Studded(m_Mobile), IsFrom, m_Tool));
                }
                else if (Entries[index].craftIndex == 3)
                {
                    IsFrom = "Female";
                    m_Mobile.SendMenu(new TailoringMenu(m_Mobile, Female(m_Mobile), IsFrom, m_Tool));
                }
            }
            else if (IsFrom == "Shirts")
            {
                Type type = null;

                CraftContext   context  = DefTailoring.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefTailoring.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex)).UseSubRes2 ? DefTailoring.CraftSystem.CraftSubRes2 : DefTailoring.CraftSystem.CraftSubRes);
                int            resIndex = (DefTailoring.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex)).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }

                DefTailoring.CraftSystem.CreateItem(m_Mobile, DefTailoring.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex)).ItemType, typeof(Cloth), m_Tool, DefTailoring.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex)));
            }
            else if (IsFrom == "Pants")
            {
                Type type = null;

                CraftContext   context  = DefTailoring.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefTailoring.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 6).UseSubRes2 ? DefTailoring.CraftSystem.CraftSubRes2 : DefTailoring.CraftSystem.CraftSubRes);
                int            resIndex = (DefTailoring.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 6).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }

                DefTailoring.CraftSystem.CreateItem(m_Mobile, DefTailoring.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 6).ItemType, typeof(Cloth), m_Tool, DefTailoring.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 6));
            }
            else if (IsFrom == "Misc")
            {
                Type type = null;

                CraftContext   context  = DefTailoring.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefTailoring.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 9).UseSubRes2 ? DefTailoring.CraftSystem.CraftSubRes2 : DefTailoring.CraftSystem.CraftSubRes);
                int            resIndex = (DefTailoring.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 9).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }

                DefTailoring.CraftSystem.CreateItem(m_Mobile, DefTailoring.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 9).ItemType, typeof(Cloth), m_Tool, DefTailoring.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 9));
            }
            else if (IsFrom == "BoltOfCloth")
            {
                Type type = null;

                CraftContext   context  = DefTailoring.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefTailoring.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 14).UseSubRes2 ? DefTailoring.CraftSystem.CraftSubRes2 : DefTailoring.CraftSystem.CraftSubRes);
                int            resIndex = (DefTailoring.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 14).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }

                DefTailoring.CraftSystem.CreateItem(m_Mobile, DefTailoring.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 14).ItemType, typeof(Cloth), m_Tool, DefTailoring.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 14));
            }
            else if (IsFrom == "Footwear")
            {
                Type type = null;

                CraftContext   context  = DefTailoring.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefTailoring.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 17).UseSubRes2 ? DefTailoring.CraftSystem.CraftSubRes2 : DefTailoring.CraftSystem.CraftSubRes);
                int            resIndex = (DefTailoring.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 17).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }

                DefTailoring.CraftSystem.CreateItem(m_Mobile, DefTailoring.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 17).ItemType, typeof(Leather), m_Tool, DefTailoring.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 17));
            }
            else if (IsFrom == "Leather")
            {
                Type type = null;

                CraftContext   context  = DefTailoring.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefTailoring.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 21).UseSubRes2 ? DefTailoring.CraftSystem.CraftSubRes2 : DefTailoring.CraftSystem.CraftSubRes);
                int            resIndex = (DefTailoring.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 21).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }

                DefTailoring.CraftSystem.CreateItem(m_Mobile, DefTailoring.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 21).ItemType, typeof(Leather), m_Tool, DefTailoring.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 21));
            }
            else if (IsFrom == "Studded")
            {
                Type type = null;

                CraftContext   context  = DefTailoring.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefTailoring.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 26).UseSubRes2 ? DefTailoring.CraftSystem.CraftSubRes2 : DefTailoring.CraftSystem.CraftSubRes);
                int            resIndex = (DefTailoring.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 26).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }

                DefTailoring.CraftSystem.CreateItem(m_Mobile, DefTailoring.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 26).ItemType, typeof(Leather), m_Tool, DefTailoring.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 26));
            }
            else if (IsFrom == "Female")
            {
                Type type = null;

                CraftContext   context  = DefTailoring.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefTailoring.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 31).UseSubRes2 ? DefTailoring.CraftSystem.CraftSubRes2 : DefTailoring.CraftSystem.CraftSubRes);
                int            resIndex = (DefTailoring.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 31).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }

                DefTailoring.CraftSystem.CreateItem(m_Mobile, DefTailoring.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 31).ItemType, typeof(Leather), m_Tool, DefTailoring.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 31));
            }
        }
コード例 #8
0
ファイル: InscriptionMenu.cs プロジェクト: zerodowned/Origins
        public override void OnResponse(NetState state, int index)
        {
            if (m_Mobile.Backpack.GetAmount(typeof(BlankScroll)) == 0)
            {
                m_Mobile.SendAsciiMessage("You do not have enough blank scrolls to make that.");
                return;
            }

            if (IsFrom == "Main")
            {
                if (m_Entries[index].craftIndex == 0)
                {
                    IsFrom = "First";
                    m_Mobile.SendMenu(new InscriptionMenu(m_Mobile, First(m_Mobile), IsFrom, m_Tool));
                }
                else if (m_Entries[index].craftIndex == 1)
                {
                    IsFrom = "Second";
                    m_Mobile.SendMenu(new InscriptionMenu(m_Mobile, Second(m_Mobile), IsFrom, m_Tool));
                }
                else if (m_Entries[index].craftIndex == 2)
                {
                    IsFrom = "Third";
                    m_Mobile.SendMenu(new InscriptionMenu(m_Mobile, Third(m_Mobile), IsFrom, m_Tool));
                }
                else if (m_Entries[index].craftIndex == 3)
                {
                    IsFrom = "Fourth";
                    m_Mobile.SendMenu(new InscriptionMenu(m_Mobile, Fourth(m_Mobile), IsFrom, m_Tool));
                }
                else if (m_Entries[index].craftIndex == 4)
                {
                    IsFrom = "Fifth";
                    m_Mobile.SendMenu(new InscriptionMenu(m_Mobile, Fifth(m_Mobile), IsFrom, m_Tool));
                }
                else if (m_Entries[index].craftIndex == 5)
                {
                    IsFrom = "Sixth";
                    m_Mobile.SendMenu(new InscriptionMenu(m_Mobile, Sixth(m_Mobile), IsFrom, m_Tool));
                }
                else if (m_Entries[index].craftIndex == 6)
                {
                    IsFrom = "Seventh";
                    m_Mobile.SendMenu(new InscriptionMenu(m_Mobile, Seventh(m_Mobile), IsFrom, m_Tool));
                }
                else if (m_Entries[index].craftIndex == 7)
                {
                    IsFrom = "Eighth";
                    m_Mobile.SendMenu(new InscriptionMenu(m_Mobile, Eighth(m_Mobile), IsFrom, m_Tool));
                }
            }
            else if (IsFrom == "First")
            {
                Type type = null;
                //int num = DefInscription.CraftSystem.CanCraft(m_Mobile, m_Tool, DefInscription.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex)).ItemType);

                CraftContext   context  = DefInscription.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefInscription.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex)).UseSubRes2 ? DefInscription.CraftSystem.CraftSubRes2 : DefInscription.CraftSystem.CraftSubRes);
                int            resIndex = (DefInscription.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex)).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }
                DefInscription.CraftSystem.CreateItem(m_Mobile, DefInscription.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex)).ItemType, type, m_Tool, DefInscription.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex)));
            }
            else if (IsFrom == "Second")
            {
                Type type = null;

                CraftContext   context  = DefInscription.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefInscription.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 8).UseSubRes2 ? DefInscription.CraftSystem.CraftSubRes2 : DefInscription.CraftSystem.CraftSubRes);
                int            resIndex = (DefInscription.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 8).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }
                DefInscription.CraftSystem.CreateItem(m_Mobile, DefInscription.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 8).ItemType, type, m_Tool, DefInscription.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 8));
            }
            else if (IsFrom == "Third")
            {
                Type type = null;

                CraftContext   context  = DefInscription.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefInscription.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 16).UseSubRes2 ? DefInscription.CraftSystem.CraftSubRes2 : DefInscription.CraftSystem.CraftSubRes);
                int            resIndex = (DefInscription.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 16).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }
                DefInscription.CraftSystem.CreateItem(m_Mobile, DefInscription.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 16).ItemType, type, m_Tool, DefInscription.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 16));
            }
            else if (IsFrom == "Fourth")
            {
                Type type = null;

                CraftContext   context  = DefInscription.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefInscription.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 24).UseSubRes2 ? DefInscription.CraftSystem.CraftSubRes2 : DefInscription.CraftSystem.CraftSubRes);
                int            resIndex = (DefInscription.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 24).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }
                DefInscription.CraftSystem.CreateItem(m_Mobile, DefInscription.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 24).ItemType, type, m_Tool, DefInscription.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 24));
            }
            else if (IsFrom == "Fifth")
            {
                Type type = null;

                CraftContext   context  = DefInscription.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefInscription.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 32).UseSubRes2 ? DefInscription.CraftSystem.CraftSubRes2 : DefInscription.CraftSystem.CraftSubRes);
                int            resIndex = (DefInscription.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 32).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }
                DefInscription.CraftSystem.CreateItem(m_Mobile, DefInscription.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 32).ItemType, type, m_Tool, DefInscription.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 32));
            }
            else if (IsFrom == "Sixth")
            {
                Type type = null;

                CraftContext   context  = DefInscription.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefInscription.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 40).UseSubRes2 ? DefInscription.CraftSystem.CraftSubRes2 : DefInscription.CraftSystem.CraftSubRes);
                int            resIndex = (DefInscription.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 40).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }
                DefInscription.CraftSystem.CreateItem(m_Mobile, DefInscription.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 40).ItemType, type, m_Tool, DefInscription.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 40));
            }
            else if (IsFrom == "Seventh")
            {
                Type type = null;

                CraftContext   context  = DefInscription.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefInscription.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 48).UseSubRes2 ? DefInscription.CraftSystem.CraftSubRes2 : DefInscription.CraftSystem.CraftSubRes);
                int            resIndex = (DefInscription.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 48).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }
                DefInscription.CraftSystem.CreateItem(m_Mobile, DefInscription.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 48).ItemType, type, m_Tool, DefInscription.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 48));
            }
            else if (IsFrom == "Eighth")
            {
                Type type = null;

                CraftContext   context  = DefInscription.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefInscription.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 56).UseSubRes2 ? DefInscription.CraftSystem.CraftSubRes2 : DefInscription.CraftSystem.CraftSubRes);
                int            resIndex = (DefInscription.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 56).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }
                DefInscription.CraftSystem.CreateItem(m_Mobile, DefInscription.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 56).ItemType, type, m_Tool, DefInscription.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 56));
            }
        }
コード例 #9
0
ファイル: AlchemyMenu.cs プロジェクト: phpjunkie420/RunUO
        public override void OnResponse(NetState state, int index)
        {
            if (m_Mobile.Backpack.GetAmount(typeof(Bottle)) == 0)
            {
                m_Mobile.SendAsciiMessage("You need an empty bottle to make a potion.");
                return;
            }

            if (IsFrom == "Refresh")
            {
                Type type = null;

                CraftContext   context  = DefAlchemy.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefAlchemy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex)).UseSubRes2 ? DefAlchemy.CraftSystem.CraftSubRes2 : DefAlchemy.CraftSystem.CraftSubRes);
                int            resIndex = (DefAlchemy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex)).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }

                DefAlchemy.CraftSystem.CreateItem(m_Mobile, DefAlchemy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex)).ItemType, typeof(BlackPearl), m_Tool, DefAlchemy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex)));
            }
            else if (IsFrom == "Agility")
            {
                Type type = null;

                CraftContext   context  = DefAlchemy.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefAlchemy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 2).UseSubRes2 ? DefAlchemy.CraftSystem.CraftSubRes2 : DefAlchemy.CraftSystem.CraftSubRes);
                int            resIndex = (DefAlchemy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 2).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }

                DefAlchemy.CraftSystem.CreateItem(m_Mobile, DefAlchemy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 2).ItemType, typeof(Bloodmoss), m_Tool, DefAlchemy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 2));
            }
            else if (IsFrom == "NightSight")
            {
                Type type = null;

                CraftContext   context  = DefAlchemy.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefAlchemy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 4).UseSubRes2 ? DefAlchemy.CraftSystem.CraftSubRes2 : DefAlchemy.CraftSystem.CraftSubRes);
                int            resIndex = (DefAlchemy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 4).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }

                /* int OldHue = m_Mobile.SpeechHue;
                 * m_Mobile.SpeechHue = 0x22;
                 * m_Mobile.SayTo(m_Mobile, true, String.Format("*{0} begins grinding some spiders' silk in a mortar*", m_Mobile.Name));
                 * m_Mobile.SpeechHue = OldHue;*/

                DefAlchemy.CraftSystem.CreateItem(m_Mobile, DefAlchemy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 4).ItemType, typeof(SpidersSilk), m_Tool, DefAlchemy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 4));
            }
            else if (IsFrom == "Heal")
            {
                Type type = null;

                CraftContext   context  = DefAlchemy.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefAlchemy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 5).UseSubRes2 ? DefAlchemy.CraftSystem.CraftSubRes2 : DefAlchemy.CraftSystem.CraftSubRes);
                int            resIndex = (DefAlchemy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 5).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }

                DefAlchemy.CraftSystem.CreateItem(m_Mobile, DefAlchemy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 5).ItemType, typeof(Ginseng), m_Tool, DefAlchemy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 5));
            }
            else if (IsFrom == "Strength")
            {
                Type type = null;

                CraftContext   context  = DefAlchemy.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefAlchemy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 8).UseSubRes2 ? DefAlchemy.CraftSystem.CraftSubRes2 : DefAlchemy.CraftSystem.CraftSubRes);
                int            resIndex = (DefAlchemy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 8).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }

                DefAlchemy.CraftSystem.CreateItem(m_Mobile, DefAlchemy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 8).ItemType, typeof(MandrakeRoot), m_Tool, DefAlchemy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 8));
            }
            else if (IsFrom == "Poison")
            {
                Type type = null;

                CraftContext   context  = DefAlchemy.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefAlchemy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 10).UseSubRes2 ? DefAlchemy.CraftSystem.CraftSubRes2 : DefAlchemy.CraftSystem.CraftSubRes);
                int            resIndex = (DefAlchemy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 10).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }

                DefAlchemy.CraftSystem.CreateItem(m_Mobile, DefAlchemy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 10).ItemType, typeof(Nightshade), m_Tool, DefAlchemy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 10));
            }
            else if (IsFrom == "Cure")
            {
                Type type = null;

                CraftContext   context  = DefAlchemy.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefAlchemy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 14).UseSubRes2 ? DefAlchemy.CraftSystem.CraftSubRes2 : DefAlchemy.CraftSystem.CraftSubRes);
                int            resIndex = (DefAlchemy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 14).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }

                DefAlchemy.CraftSystem.CreateItem(m_Mobile, DefAlchemy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 14).ItemType, typeof(Garlic), m_Tool, DefAlchemy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 14));
            }
            else if (IsFrom == "Explosion")
            {
                Type type = null;

                CraftContext   context  = DefAlchemy.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefAlchemy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 17).UseSubRes2 ? DefAlchemy.CraftSystem.CraftSubRes2 : DefAlchemy.CraftSystem.CraftSubRes);
                int            resIndex = (DefAlchemy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 17).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }

                DefAlchemy.CraftSystem.CreateItem(m_Mobile, DefAlchemy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 17).ItemType, typeof(SulfurousAsh), m_Tool, DefAlchemy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 17));
            }
        }
コード例 #10
0
        /*private static ItemListEntry[] Test()
         * {
         *  Type type;
         *  int itemid;
         *  string name;
         *  Item item;
         *
         *  ItemListEntry[] entries = new ItemListEntry[DefBlacksmithy.CraftSystem.CraftItems.Count];
         *
         *  for (int i = 0; i < DefBlacksmithy.CraftSystem.CraftItems.Count; ++i)
         *  {
         *      type = DefBlacksmithy.CraftSystem.CraftItems.GetAt(i).ItemType;
         *
         *      item = null;
         *      try { item = Activator.CreateInstance(type) as Item; }
         *      catch { }
         *      name = item.Name;
         *      itemid = item.ItemID;
         *
         *      entries[i-missing] = new ItemListEntry(name, itemid, 0, i);
         *
         *      if (item != null)
         *          item.Delete();
         *  }
         *
         *  return entries;
         * }*/

        public override void OnResponse(NetState state, int index)
        {
            if (IsFrom == "Main")
            {
                if (m_Entries[index].craftIndex == 0)
                {
                    Repair.Do(m_Mobile, DefBlacksmithy.CraftSystem, m_Tool);
                }
                if (m_Entries[index].craftIndex == 1)
                {
                    IsFrom = "Shields";
                    m_Mobile.SendMenu(new BlacksmithMenu(m_Mobile, Shields(m_Mobile), IsFrom, m_Tool));
                }
                else if (m_Entries[index].craftIndex == 2)
                {
                    IsFrom = "Armor";
                    m_Mobile.SendMenu(new BlacksmithMenu(m_Mobile, Armor(m_Mobile), IsFrom, m_Tool));
                }
                else if (m_Entries[index].craftIndex == 3)
                {
                    IsFrom = "Weapons";
                    m_Mobile.SendMenu(new BlacksmithMenu(m_Mobile, Weapons(m_Mobile), IsFrom, m_Tool));
                }
            }
            else if (IsFrom == "Shields")
            {
                Type type = null;

                CraftContext   context  = DefBlacksmithy.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 18).UseSubRes2 ? DefBlacksmithy.CraftSystem.CraftSubRes2 : DefBlacksmithy.CraftSystem.CraftSubRes);
                int            resIndex = (DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 18).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }

                DefBlacksmithy.CraftSystem.CreateItem(m_Mobile, DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 18).ItemType, type, m_Tool, DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 18));
            }
            else if (IsFrom == "Weapons")
            {
                if (m_Entries[index].craftIndex == 0)
                {
                    IsFrom = "Blades";
                    m_Mobile.SendMenu(new BlacksmithMenu(m_Mobile, Blades(m_Mobile), IsFrom, m_Tool));
                }
                else if (m_Entries[index].craftIndex == 1)
                {
                    IsFrom = "Axes";
                    m_Mobile.SendMenu(new BlacksmithMenu(m_Mobile, Axes(m_Mobile), IsFrom, m_Tool));
                }
                else if (m_Entries[index].craftIndex == 2)
                {
                    IsFrom = "Maces";
                    m_Mobile.SendMenu(new BlacksmithMenu(m_Mobile, Maces(m_Mobile), IsFrom, m_Tool));
                }
                else if (m_Entries[index].craftIndex == 3)
                {
                    IsFrom = "Polearms";
                    m_Mobile.SendMenu(new BlacksmithMenu(m_Mobile, Polearms(m_Mobile), IsFrom, m_Tool));
                }
            }
            else if (IsFrom == "Blades")
            {
                Type type = null;

                CraftContext   context  = DefBlacksmithy.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 24).UseSubRes2 ? DefBlacksmithy.CraftSystem.CraftSubRes2 : DefBlacksmithy.CraftSystem.CraftSubRes);
                int            resIndex = (DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 24).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }

                DefBlacksmithy.CraftSystem.CreateItem(m_Mobile, DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 24).ItemType, type, m_Tool, DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 24));
            }
            else if (IsFrom == "Axes")
            {
                Type type = null;

                CraftContext   context  = DefBlacksmithy.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 32).UseSubRes2 ? DefBlacksmithy.CraftSystem.CraftSubRes2 : DefBlacksmithy.CraftSystem.CraftSubRes);
                int            resIndex = (DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 32).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }

                DefBlacksmithy.CraftSystem.CreateItem(m_Mobile, DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 32).ItemType, type, m_Tool, DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 32));
            }
            else if (IsFrom == "Maces")
            {
                Type type = null;

                CraftContext   context  = DefBlacksmithy.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 43).UseSubRes2 ? DefBlacksmithy.CraftSystem.CraftSubRes2 : DefBlacksmithy.CraftSystem.CraftSubRes);
                int            resIndex = (DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 43).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }

                DefBlacksmithy.CraftSystem.CreateItem(m_Mobile, DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 43).ItemType, type, m_Tool, DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 43));
            }
            else if (IsFrom == "Polearms")
            {
                Type type = null;

                CraftContext   context  = DefBlacksmithy.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 39).UseSubRes2 ? DefBlacksmithy.CraftSystem.CraftSubRes2 : DefBlacksmithy.CraftSystem.CraftSubRes);
                int            resIndex = (DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 39).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }

                DefBlacksmithy.CraftSystem.CreateItem(m_Mobile, DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 39).ItemType, type, m_Tool, DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 39));
            }
            else if (IsFrom == "Armor")
            {
                if (m_Entries[index].craftIndex == 0)
                {
                    IsFrom = "Platemail";
                    m_Mobile.SendMenu(new BlacksmithMenu(m_Mobile, Platemail(m_Mobile), IsFrom, m_Tool));
                }
                else if (m_Entries[index].craftIndex == 1)
                {
                    IsFrom = "Chainmail";
                    m_Mobile.SendMenu(new BlacksmithMenu(m_Mobile, Chainmail(m_Mobile), IsFrom, m_Tool));
                }
                else if (m_Entries[index].craftIndex == 2)
                {
                    IsFrom = "Ringmail";
                    m_Mobile.SendMenu(new BlacksmithMenu(m_Mobile, Ringmail(m_Mobile), IsFrom, m_Tool));
                }
                else if (m_Entries[index].craftIndex == 3)
                {
                    IsFrom = "Helmets";
                    m_Mobile.SendMenu(new BlacksmithMenu(m_Mobile, Helmets(m_Mobile), IsFrom, m_Tool));
                }
            }
            else if (IsFrom == "Platemail")
            {
                Type type = null;

                CraftContext   context  = DefBlacksmithy.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 7).UseSubRes2 ? DefBlacksmithy.CraftSystem.CraftSubRes2 : DefBlacksmithy.CraftSystem.CraftSubRes);
                int            resIndex = (DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 7).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }

                DefBlacksmithy.CraftSystem.CreateItem(m_Mobile, DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 7).ItemType, type, m_Tool, DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 7));
            }
            else if (IsFrom == "Chainmail")
            {
                Type type = null;

                CraftContext   context  = DefBlacksmithy.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 5).UseSubRes2 ? DefBlacksmithy.CraftSystem.CraftSubRes2 : DefBlacksmithy.CraftSystem.CraftSubRes);
                int            resIndex = (DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 5).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }

                DefBlacksmithy.CraftSystem.CreateItem(m_Mobile, DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 5).ItemType, type, m_Tool, DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 5));
            }
            else if (IsFrom == "Ringmail")
            {
                Type type = null;

                CraftContext   context  = DefBlacksmithy.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex)).UseSubRes2 ? DefBlacksmithy.CraftSystem.CraftSubRes2 : DefBlacksmithy.CraftSystem.CraftSubRes);
                int            resIndex = (DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex)).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }

                DefBlacksmithy.CraftSystem.CreateItem(m_Mobile, DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex)).ItemType, type, m_Tool, DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex)));
            }
            else if (IsFrom == "Helmets")
            {
                Type type = null;

                CraftContext   context  = DefBlacksmithy.CraftSystem.GetContext(m_Mobile);
                CraftSubResCol res      = (DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 12).UseSubRes2 ? DefBlacksmithy.CraftSystem.CraftSubRes2 : DefBlacksmithy.CraftSystem.CraftSubRes);
                int            resIndex = (DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 12).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);

                //chainmail coif
                if (index == 0)
                {
                    res      = (DefBlacksmithy.CraftSystem.CraftItems.GetAt(4).UseSubRes2 ? DefBlacksmithy.CraftSystem.CraftSubRes2 : DefBlacksmithy.CraftSystem.CraftSubRes);
                    resIndex = (DefBlacksmithy.CraftSystem.CraftItems.GetAt(4).UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);
                }

                if (resIndex > -1)
                {
                    type = res.GetAt(resIndex).ItemType;
                }

                //chainmail coif
                if (index == 0)
                {
                    DefBlacksmithy.CraftSystem.CreateItem(m_Mobile, DefBlacksmithy.CraftSystem.CraftItems.GetAt(4).ItemType, type, m_Tool, DefBlacksmithy.CraftSystem.CraftItems.GetAt(4));
                }
                //the rest
                else
                {
                    DefBlacksmithy.CraftSystem.CreateItem(m_Mobile, DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 12).ItemType, type, m_Tool, DefBlacksmithy.CraftSystem.CraftItems.GetAt((m_Entries[index].craftIndex) + 12));
                }
            }
        }