Пример #1
0
        private static void AssignVPM(VPMCreateAbs obj, Monsters.Monster x, bool v)
        {
            obj.Number    = (ushort)(x.Index | (v?0x8000:0));
            obj.Position  = x.Position;
            obj.TPosition = x.TPosition;
            obj.Type      = x.Info.Monster;
            obj.Path      = (byte)(x.Direction << 4);
            try
            {
                obj.Set("ViewSkillState", x.Spells.ViewSkillStates);
            }catch (Exception)
            {
                obj.Set("ViewSkillState", x.Spells.ViewSkillStates.Select(y => (byte)y).ToArray());
            }
            obj.Set("PentagramMainAttribute", x.Element);
            obj.Set("Level", new ushortle(x.Level));
            obj.Set("Life", (uint)x.Life);
            obj.Set("MaxLife", (uint)x.MaxLife);

            obj.Set("CriticalDMGResistance", (byte)0);
            obj.Set("ExcellentDMGResistance", (byte)0);
            obj.Set("DebuffResistance", new ushortle(0));
            obj.Set("DamageAbsorb", (byte)0);
            obj.Set("Elite", (byte)0);
        }
Пример #2
0
        public void LoadSetBase(string file)
        {
            XmlMonsterSetBase xml = null;

            if (File.Exists(file + ".xml"))
            {
                Logger.Information(ServerMessages.GetMessage(Messages.MonsterMng_Loading2), file + ".xml");
                xml = ResourceLoader.XmlLoader <XmlMonsterSetBase>(file + ".xml");
            }
            else if (File.Exists(file + ".txt"))
            {
                Logger.Information(ServerMessages.GetMessage(Messages.MonsterMng_Loading2), file + ".txt");
                var loader = new LoadWZTXT <XmlMonsterSetBase>();
                xml = loader.Load(file + ".txt");
                ResourceLoader.XmlSaver(file + ".xml", xml);
            }

            foreach (var npc in xml.NPCs)
            {
                Monsters.Add(new Monster(npc.Type, ObjectType.NPC, npc.Map, new Point(npc.PosX, npc.PosY), (byte)npc.Dir)
                {
                    Index = GetNewIndex()
                });
            }

            foreach (var npc in xml.Normal)
            {
                Monsters.Add(new Monster(npc.Type, ObjectType.Monster, npc.Map, new Point(npc.PosX, npc.PosY), (byte)npc.Dir)
                {
                    Index = GetNewIndex()
                });
            }

            foreach (var npc in xml.BloodCastles)
            {
                Monsters.Add(new Monster(npc.Type, ObjectType.Monster, npc.Map, new Point(npc.PosX, npc.PosY), (byte)npc.Dir)
                {
                    Index = GetNewIndex()
                });
            }

            foreach (var npc in xml.Golden)
            {
                for (var i = 0; i < npc.Quant; i++)
                {
                    var dir  = (byte)_rand.Next(7);
                    var mPos = GetSpawn(npc.Map, npc.PosX, npc.PosX2, npc.PosY, npc.PosY2);
                    var mob  = new Monster(npc.Type, ObjectType.Monster, npc.Map, mPos, dir)
                    {
                        Index = GetNewIndex()
                    };
                    Monsters.Add(mob);
                    Program.GoldenInvasionManager.AddMonster(mob);
                }
            }

            foreach (var npc in xml.Spots)
            {
                for (var i = 0; i < npc.Quant; i++)
                {
                    try
                    {
                        var dir  = (byte)_rand.Next(7);
                        var mPos = GetSpawn(npc.Map, npc.PosX, npc.PosX2, npc.PosY, npc.PosY2);
                        var mob  = new Monster(npc.Type, ObjectType.Monster, npc.Map, mPos, dir, npc.Element)
                        {
                            Index = GetNewIndex()
                        };
                        Monsters.Add(mob);
                    }catch (InvalidOperationException)
                    { }
                }
            }
            Logger.Information(ServerMessages.GetMessage(Messages.MonsterMng_Loaded), Monsters.Count);
        }