예제 #1
0
        // Allows cooking a custom item.
        public static Item Cook(Player player, string name)
        {
            int       hash       = StringHashHelper.HashItemName(name);
            ItemTable definition = Items[hash];

            return(CookFromDefinition(player, definition));
        }
예제 #2
0
        private static void LoadHandlers()
        {
            foreach (var type in Assembly.GetExecutingAssembly().GetTypes())
            {
                if (!type.IsSubclassOf(typeof(Item)))
                {
                    continue;
                }

                var attributes = (HandledItemAttribute[])type.GetCustomAttributes(typeof(HandledItemAttribute), true);
                if (attributes.Length != 0)
                {
                    foreach (var name in attributes.First().Names)
                    {
                        GBIDHandlers.Add(StringHashHelper.HashItemName(name), type);
                    }
                }

                var typeAttributes = (HandledTypeAttribute[])type.GetCustomAttributes(typeof(HandledTypeAttribute), true);
                if (typeAttributes.Length != 0)
                {
                    foreach (var typeName in typeAttributes.First().Types)
                    {
                        TypeHandlers.Add(StringHashHelper.HashItemName(typeName), type);
                    }
                }
            }
        }
예제 #3
0
파일: Scoundrel.cs 프로젝트: xPathin/DiIiS-
        public Scoundrel(World world, int snoId, TagMap tags)
            : base(world, snoId, tags)
        {
            Brain = new AI.Brains.HirelingBrain(this);

            mainSNO      = 4644;
            hirelingSNO  = 52694;
            proxySNO     = 192941;
            skillKit     = 0x8AFE;
            hirelingGBID = StringHashHelper.HashItemName("Scoundrel");
            Attributes[GameAttribute.Hireling_Class] = 2;

            try
            {
                foreach (var player in world.Players)
                {
                    Master = world.GetActorBySNO(player.Value.ActorSNO.Id);
                }
            }catch { }
            this.Attributes[GameAttribute.Attacks_Per_Second]     = 1.0f;
            this.Attributes[GameAttribute.Damage_Weapon_Min, 0]   = 5f;
            this.Attributes[GameAttribute.Damage_Weapon_Delta, 0] = 5f;
            //RandomDirection(player.Value.Position, 3f, 8f);
            //this.WalkSpeed = 0.3f * monsterData.Floats[129];  // TODO: this is probably multiplied by something erekose the 0.3 is because he is way too fast otherwise
            this.WalkSpeed = this.RunSpeed;
        }
예제 #4
0
        public LeahParty(World world, int snoId, TagMap tags)
            : base(world, snoId, tags)
        {
            Brain = new AI.Brains.HirelingBrain(this);


            mainSNO      = 144681;
            hirelingSNO  = 52694;
            proxySNO     = 192941;
            skillKit     = 0x8AFE;
            hirelingGBID = StringHashHelper.HashItemName("Leah_Party");
            Attributes[GameAttribute.Hireling_Class] = 2;

            try
            {
                foreach (var player in world.Players)
                {
                    Master = world.GetActorBySNO(player.Value.ActorSNO.Id);
                }
            }
            catch { }
            this.Attributes[GameAttribute.Attacks_Per_Second]     = 1.0f;
            this.Attributes[GameAttribute.Damage_Weapon_Min, 0]   = 5f;
            this.Attributes[GameAttribute.Damage_Weapon_Delta, 0] = 5f;
            this.WalkSpeed = this.RunSpeed;

            (Brain as AI.Brains.HirelingBrain).AddPresetPower(30252); //Range_instant
        }
예제 #5
0
        private static ItemTable GetRandom(List <ItemTable> pool)
        {
            var       found          = false;
            ItemTable itemDefinition = null;

            while (!found)
            {
                itemDefinition = pool[RandomHelper.Next(0, pool.Count() - 1)];

                if (itemDefinition.SNOActor == -1)
                {
                    continue;
                }

                // if ((itemDefinition.ItemType1 == StringHashHelper.HashItemName("Book")) && (itemDefinition.BaseGoldValue != 0)) return itemDefinition; // testing books /xsochor
                // if (itemDefinition.ItemType1 != StringHashHelper.HashItemName("Book")) continue; // testing books /xsochor
                // if (!ItemGroup.SubTypesToHashList("SpellRune").Contains(itemDefinition.ItemType1)) continue; // testing spellrunes /xsochor

                // ignore gold and healthglobe, they should drop only when expect, not randomly
                if (itemDefinition.Name.ToLower().Contains("gold"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("healthglobe"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("pvp"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("unique"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("crafted"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("debug"))
                {
                    continue;
                }
                if ((itemDefinition.ItemType1 == StringHashHelper.HashItemName("Book")) && (itemDefinition.BaseGoldValue == 0))
                {
                    continue;                                                                                                             // i hope it catches all lore with npc spawned /xsochor
                }
                if (!GBIDHandlers.ContainsKey(itemDefinition.Hash) &&
                    !AllowedItemTypes.Contains(itemDefinition.ItemType1))
                {
                    continue;
                }

                found = true;
            }

            return(itemDefinition);
        }
예제 #6
0
        public string HashItem(string[] @params, MooNetClient invokerClient)
        {
            if (@params.Count() < 1)
            {
                return("Invalid arguments. Type 'help hash show' to get help.");
            }

            return(StringHashHelper.HashItemName(@params[0]).ToString());
        }
예제 #7
0
 public Enchantress(World world, int snoId, TagMap tags)
     : base(world, snoId, tags)
 {
     mainSNO      = 4062;
     hirelingSNO  = -1;
     proxySNO     = 192942;
     skillKit     = 87094;
     hirelingGBID = StringHashHelper.HashItemName("Enchantress");
     Attributes[Mooege.Net.GS.Message.GameAttribute.Hireling_Class] = 3;
 }
예제 #8
0
 public Templar(World world, int snoId, TagMap tags)
     : base(world, snoId, tags)
 {
     mainSNO      = 4538;
     hirelingSNO  = 0x0000CDD5;
     proxySNO     = 0x0002F1AC;
     skillKit     = 0x8AFB;
     hirelingGBID = StringHashHelper.HashItemName("Templar");
     this.Attributes[GameAttribute.Hireling_Class] = 1;
 }
예제 #9
0
파일: Scoundrel.cs 프로젝트: wlasser/D3Emu
 public Scoundrel(World world, int snoId, TagMap tags)
     : base(world, snoId, tags)
 {
     mainSNO      = 4644;
     hirelingSNO  = 52694;
     proxySNO     = 192941;
     skillKit     = 0x8AFE;
     hirelingGBID = StringHashHelper.HashItemName("Scoundrel");
     Attributes[GameAttribute.Hireling_Class] = 2;
 }
예제 #10
0
        // Allows cooking a custom item.
        public static Item Cook(Player player, string name)
        {
            int       hash       = StringHashHelper.HashItemName(name);
            ItemTable definition = Items[hash];
            Type      type       = GetItemClass(definition);

            var item = (Item)Activator.CreateInstance(type, new object[] { player.World, definition });

            //player.GroundItems[item.DynamicID] = item;

            return(item);
        }
예제 #11
0
        public Item generateRandomElement(ItemType itemType)
        {
            try
            {
                // select count of Items with correct Type
                // the itemname structure ITEMTYPE_NUMBER example: BOOTS_001 , BELT_004
                String querypart  = String.Format("from items where itemname like '{0}_%'", itemType.ToString());
                String countQuery = String.Format("SELECT count(*) {0}", querypart);
                var    cmd        = new SQLiteCommand(countQuery, Storage.GameDataDBManager.Connection);
                var    reader     = cmd.ExecuteReader();
                reader.Read();
                int itemsCount = reader.GetInt32(0);

                // Now select random element
                int    selectedElementNr = RandomHelper.Next(itemsCount);
                String selectRandom      = String.Format("SELECT itemname {0} limit {1},1", querypart, selectedElementNr);
                cmd    = new SQLiteCommand(selectRandom, Storage.GameDataDBManager.Connection);
                reader = cmd.ExecuteReader();

                if (!reader.HasRows)
                {
                    throw new Exception("Missing Data in DB");
                }

                while (reader.Read())
                {
                    var itemName = (String)reader.GetString(0);
                    var id       = (int)StringHashHelper.HashItemName(itemName);
                    var item     = new Item(id, itemType);
                    return(item);
                }
            }
            catch (Exception e)
            {
                Logger.ErrorException(e, "Error generating Item");
            }

            return(null);
        }
예제 #12
0
 public static bool IsValidItem(string name)
 {
     return(Items.ContainsKey(StringHashHelper.HashItemName(name)));
 }
예제 #13
0
        public static ItemTypeTable FromString(string name)
        {
            int hash = StringHashHelper.HashItemName(name);

            return(FromHash(hash));
        }
예제 #14
0
 public static bool IsSubType(ItemTypeTable type, string rootTypeName)
 {
     return(IsSubType(type, StringHashHelper.HashItemName(rootTypeName)));
 }
예제 #15
0
        private static ItemTable GetRandomWeaponToVendor(List <ItemTable> pool, Player player)
        {
            var       found          = false;
            ItemTable itemDefinition = null;
            int       MaxLevel       = 0;

            while (!found)
            {
                itemDefinition = pool[RandomHelper.Next(0, pool.Count() - 1)];

                if (itemDefinition.SNOActor == -1)
                {
                    continue;
                }

                // if ((itemDefinition.ItemType1 == StringHashHelper.HashItemName("Book")) && (itemDefinition.BaseGoldValue != 0)) return itemDefinition; // testing books /xsochor
                // if (itemDefinition.ItemType1 != StringHashHelper.HashItemName("Book")) continue; // testing books /xsochor
                // if (!ItemGroup.SubTypesToHashList("SpellRune").Contains(itemDefinition.ItemType1)) continue; // testing spellrunes /xsochor

                // ignore gold and healthglobe, they should drop only when expect, not randomly
                if (itemDefinition.Name.ToLower().Contains("gold"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("_104"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("healthglobe"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("pvp"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("unique"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("crafted"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("test"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("debug"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("unique"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("missing"))
                {
                    continue;                                                    //I believe I've seen a missing item before, may have been affix though. //Wetwlly
                }
                if ((itemDefinition.ItemType1 == StringHashHelper.HashItemName("Book")) && (itemDefinition.BaseGoldValue == 0))
                {
                    continue;                                                                                                             // i hope it catches all lore with npc spawned /xsochor
                }
                //if (itemDefinition.Name.Contains("Debug"))  continue;
                //if (itemDefinition.Quality == ItemTable.ItemQuality.Invalid) continue;
                if (itemDefinition.Name.Contains("StaffOfCow"))
                {
                    continue;
                }
                if (itemDefinition.Name.Contains("BladeoftheAncients"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("book"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("staffofcow"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("angelwings"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("journal"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("lore"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("craftingplan"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("set"))
                {
                    continue;
                }
                if (itemDefinition.Name.Contains("TalismanUnlock"))
                {
                    continue;
                }
                if (itemDefinition.Name.Contains("StoneOfRecall"))
                {
                    continue;
                }
                if (itemDefinition.Name.Contains("StoneOfWealth"))
                {
                    continue;
                }

                if (!GBIDHandlers.ContainsKey(itemDefinition.Hash) &&
                    !AllowedWeaponTypes.Contains(itemDefinition.ItemType1))
                {
                    continue;
                }

                if (player != null)
                {
                    if (itemDefinition.RequiredLevel > player.Toon.Level + 3 &
                        itemDefinition.RequiredLevel < player.Toon.Level - 3
                        )
                    {
                        continue;
                    }
                }
                found = true;
            }

            return(itemDefinition);
        }
예제 #16
0
        private static ItemTable GetRandom(List <ItemTable> pool, Player player)
        {
            var       found          = false;
            ItemTable itemDefinition = null;

            //if (player.Toon.Class == ToonClass.Monk)
            while (!found)
            {
                itemDefinition = pool[RandomHelper.Next(0, pool.Count() - 1)];

                if (itemDefinition.SNOActor == -1)
                {
                    continue;
                }

                // if ((itemDefinition.ItemType1 == StringHashHelper.HashItemName("Book")) && (itemDefinition.BaseGoldValue != 0)) return itemDefinition; // testing books /xsochor
                // if (itemDefinition.ItemType1 != StringHashHelper.HashItemName("Book")) continue; // testing books /xsochor
                // if (!ItemGroup.SubTypesToHashList("SpellRune").Contains(itemDefinition.ItemType1)) continue; // testing spellrunes /xsochor

                if (itemDefinition.Name.ToLower().Contains("gold"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("healthglobe"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("_104"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("pvp"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("unique"))
                {
                    if (player != null)
                    {
                        if (player.Attributes[GameAttribute.Skill, 30476] == 1)
                        {
                            int Percent = RandomHelper.Next(0, 1000);
                            if (Percent < 880)
                            {
                                continue;
                            }
                        }
                        else
                        {
                            int Percent = RandomHelper.Next(0, 1000);
                            if (Percent < 980)
                            {
                                continue;
                            }
                        }
                    }
                    else
                    {
                        continue;
                    }
                }
                if (itemDefinition.Name.ToLower().Contains("dye"))
                {
                    if (player != null)
                    {
                        if (player.Attributes[GameAttribute.Skill, 30476] == 1)
                        {
                            int Percent = RandomHelper.Next(0, 1000);
                            if (Percent < 880)
                            {
                                continue;
                            }
                        }
                        else
                        {
                            int Percent = RandomHelper.Next(0, 1000);
                            if (Percent < 980)
                            {
                                continue;
                            }
                        }
                    }
                    else
                    {
                        continue;
                    }
                }
                if (itemDefinition.Name.ToLower().Contains("crafted"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("test"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("debug"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("missing"))
                {
                    continue;                                                    //I believe I've seen a missing item before, may have been affix though. //Wetwlly
                }
                if ((itemDefinition.ItemType1 == StringHashHelper.HashItemName("Book")) && (itemDefinition.BaseGoldValue == 0))
                {
                    continue;                                                                                                             // i hope it catches all lore with npc spawned /xsochor
                }
                //if (itemDefinition.Name.Contains("Debug"))  continue;
                //if (itemDefinition.Quality == ItemTable.ItemQuality.Invalid) continue;
                if (itemDefinition.Name.Contains("StaffOfCow"))
                {
                    continue;
                }
                if (itemDefinition.Name.Contains("NephalemCube"))
                {
                    continue;
                }
                if (itemDefinition.Name.Contains("BladeoftheAncients"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("book"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("staffofcow"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("angelwings"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("journal"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("lore"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("craftingplan"))
                {
                    continue;
                }
                if (itemDefinition.Name.ToLower().Contains("set"))
                {
                    continue;
                }
                if (itemDefinition.Name.Contains("TalismanUnlock"))
                {
                    continue;
                }
                if (itemDefinition.Name.Contains("StoneOfRecall"))
                {
                    continue;
                }

                if (!GBIDHandlers.ContainsKey(itemDefinition.Hash) &&
                    !AllowedItemTypes.Contains(itemDefinition.ItemType1))
                {
                    continue;
                }

                if (player != null)
                {
                    if (player.Toon.Level <= 60)
                    {
                        if (itemDefinition.RequiredLevel < player.Toon.Level - 3 || itemDefinition.RequiredLevel > player.Toon.Level + 1)
                        {
                            continue;
                        }
                    }

                    if (AllowedArmorTypes.Contains(itemDefinition.Hash) || AllowedWeaponTypes.Contains(itemDefinition.Hash))
                    {
                        ItemTypeTable Type = ItemGroup.FromHash(itemDefinition.ItemType1);
                        switch (player.Toon.Class)
                        {
                        case LogNet.Toons.ToonClass.Barbarian:
                            if (Type.Flags.HasFlag(ItemFlags.Barbarian) & RandomHelper.Next(0, 100) > 40)
                            {
                                break;
                            }
                            else
                            {
                                continue;
                            }

                        case LogNet.Toons.ToonClass.DemonHunter:
                            if (Type.Flags.HasFlag(ItemFlags.DemonHunter) & RandomHelper.Next(0, 100) > 40)
                            {
                                break;
                            }
                            else
                            {
                                continue;
                            }

                        case LogNet.Toons.ToonClass.Monk:
                            if (Type.Flags.HasFlag(ItemFlags.Monk) & RandomHelper.Next(0, 100) > 40)
                            {
                                break;
                            }
                            else
                            {
                                continue;
                            }

                        case LogNet.Toons.ToonClass.WitchDoctor:
                            if (Type.Flags.HasFlag(ItemFlags.WitchDoctor) & RandomHelper.Next(0, 100) > 40)
                            {
                                break;
                            }
                            else
                            {
                                continue;
                            }

                        case LogNet.Toons.ToonClass.Wizard:
                            if (Type.Flags.HasFlag(ItemFlags.Wizard) & RandomHelper.Next(0, 100) > 40)
                            {
                                break;
                            }
                            else
                            {
                                continue;
                            }
                        }
                    }
                }
                found = true;
            }

            return(itemDefinition);
        }