Esempio n. 1
0
        /// <summary>
        ///
        /// @param i 屏幕上的位置
        /// </summary>
        public void SetOriginalCombatPos(int i)
        {
            FightingSprite fightingSprite = FightingSprite;

            fightingSprite.SetCombatPos(_monsterPos[i][0] - (fightingSprite.Width / 6) + fightingSprite.Width / 2,
                                        _monsterPos[i][1] - (fightingSprite.Height / 10) + fightingSprite.Height / 2);
        }
        public void Deserialize(BinaryReader binaryReader)
        {
            Type         = binaryReader.ReadInt32();
            Index        = binaryReader.ReadInt32();
            _imgHead     = Context.LibData.GetImage(1, Index);
            LevelupChain = Context.LibData.GetLevelupChain(Index);

            SetWalkingSprite(new WalkingSprite(Context, Type, binaryReader.ReadInt32()));
            FightingSprite = new FightingSprite(Context, false, Index);
            Direction      = (Direction)binaryReader.ReadInt32();
            SetStep(binaryReader.ReadInt32());
            SetPosInMap(binaryReader.ReadInt32(), binaryReader.ReadInt32());

            var hasMagicChain = binaryReader.ReadBoolean();

            if (hasMagicChain)
            {
                MagicChain = new ResMagicChain(Context);
                MagicChain.Deserialize(binaryReader);
            }

            Name       = binaryReader.ReadString();
            Level      = binaryReader.ReadInt32();
            MaxHP      = binaryReader.ReadInt32();
            HP         = binaryReader.ReadInt32();
            MaxMP      = binaryReader.ReadInt32();
            MP         = binaryReader.ReadInt32();
            Attack     = binaryReader.ReadInt32();
            Defend     = binaryReader.ReadInt32();
            Speed      = binaryReader.ReadInt32();
            Lingli     = binaryReader.ReadInt32();
            Luck       = binaryReader.ReadInt32();
            CurrentExp = binaryReader.ReadInt32();

            for (int i = 0; i < 8; i++)
            {
                var type  = binaryReader.ReadInt32();
                var index = binaryReader.ReadInt32();
                if (type != 0 && index != 0)
                {
                    Equipments[i] = Context.LibData.GetGoods(type, index) as GoodsEquipment;
                }
            }
        }
Esempio n. 3
0
        public override void SetData(byte[] buf, int offset)
        {
            Type  = buf[offset] & 0xff;
            Index = buf[offset + 1] & 0xff;
            ResMagicChain magicChain = Context.LibData.GetMagicChain(buf[offset + 0x2f] & 0xff);

            if (magicChain != null)
            {
                magicChain.LearnFromChain(buf[offset + 2] & 0xff);
                MagicChain = magicChain;
            }

            AddBuff((CombatBuff)(buf[offset + 3] & 0xff));
            AttackBuff     = (CombatBuff)(buf[offset + 4] & 0xff);
            BuffLastRound  = buf[offset + 0x17] & 0xff;
            Name           = buf.GetString(offset + 6);
            Level          = buf[offset + 0x12] & 0xff;
            MaxHP          = buf.Get2BytesUInt(offset + 0x18);
            HP             = buf.Get2BytesUInt(offset + 0x1a);
            MaxMP          = buf.Get2BytesUInt(offset + 0x1c);
            MP             = buf.Get2BytesUInt(offset + 0x1e);
            Attack         = buf.Get2BytesUInt(offset + 0x20);
            Defend         = buf.Get2BytesUInt(offset + 0x22);
            Speed          = buf[offset + 0x13] & 0xff;
            Lingli         = buf[offset + 0x14] & 0xff;
            Luck           = buf[offset + 0x16] & 0xff;
            MonsterIQ      = buf[offset + 0x15] & 0xff;
            Money          = buf.Get2BytesUInt(offset + 0x24);
            EXP            = buf.Get2BytesUInt(offset + 0x26);
            _carryGoods[0] = (int)buf[offset + 0x28] & 0xff;
            _carryGoods[1] = (int)buf[offset + 0x29] & 0xff;
            _carryGoods[2] = (int)buf[offset + 0x2a] & 0xff;
            _dropGoods[0]  = (int)buf[offset + 0x2b] & 0xff;
            _dropGoods[1]  = (int)buf[offset + 0x2c] & 0xff;
            _dropGoods[2]  = (int)buf[offset + 0x2d] & 0xff;
            FightingSprite = new FightingSprite(Context, true, (int)buf[offset + 0x2e] & 0xff);
        }
        public override void SetData(byte[] buf, int offset)
        {
            Type     = buf[offset] & 0xFF;
            Index    = buf[offset + 1] & 0xFF;
            _imgHead = Context.LibData.GetImage(1, Index);
            SetWalkingSprite(new WalkingSprite(Context, Type, buf[offset + 0x16] & 0xFF));
            FightingSprite = new FightingSprite(Context, false, Index);
            Direction direction = Direction.North;

            switch (buf[offset + 2] & 0xFF)
            {
            case 1:
                direction = Direction.North;
                break;

            case 2:
                direction = Direction.East;
                break;

            case 3:
                direction = Direction.South;
                break;

            case 4:
                direction = Direction.West;
                break;
            }
            Direction = direction;
            SetStep(buf[offset + 3] & 0xff);
            SetPosInMap(buf[offset + 5] & 0xFF, buf[offset + 6] & 0xFF);
            MagicChain = Context.LibData.GetMagicChain(buf[offset + 0x17] & 0xff);
            if (MagicChain != null)
            {
                MagicChain.LearnFromChain(buf[offset + 9] & 0xff);
            }
            else
            {
                MagicChain = new ResMagicChain(Context);
            }
            Name   = buf.GetString(offset + 0x0a);
            Level  = buf[offset + 0x20] & 0xff;
            MaxHP  = buf.Get2BytesUInt(offset + 0x26);
            HP     = buf.Get2BytesUInt(offset + 0x28);
            MaxMP  = buf.Get2BytesUInt(offset + 0x2a);
            MP     = buf.Get2BytesUInt(offset + 0x2c);
            Attack = buf.Get2BytesUInt(offset + 0x2e);
            Defend = buf.Get2BytesUInt(offset + 0x30);
            Speed  = buf[offset + 0x36] & 0xff;
            Lingli = buf[offset + 0x37] & 0xff;
            Luck   = buf[offset + 0x38] & 0xff;

            CurrentExp = buf.Get2BytesUInt(offset + 0x32);

            LevelupChain = Context.LibData.GetLevelupChain(Index);

            int tmp;

            tmp = buf[offset + 0x1e] & 0xff;
            if (tmp != 0)
            {
                Equipments[0] = Context.LibData.GetGoods(6, tmp) as GoodsEquipment;
            }

            tmp = buf[offset + 0x1f] & 0xff;
            if (tmp != 0)
            {
                Equipments[1] = Context.LibData.GetGoods(6, tmp) as GoodsEquipment;
            }

            tmp = buf[offset + 0x1b] & 0xff;
            if (tmp != 0)
            {
                Equipments[2] = Context.LibData.GetGoods(5, tmp) as GoodsEquipment;
            }

            tmp = buf[offset + 0x1d] & 0xff;
            if (tmp != 0)
            {
                Equipments[3] = Context.LibData.GetGoods(3, tmp) as GoodsEquipment;
            }

            tmp = buf[offset + 0x1c] & 0xff;
            if (tmp != 0)
            {
                Equipments[4] = Context.LibData.GetGoods(7, tmp) as GoodsEquipment;
            }

            tmp = buf[offset + 0x19] & 0xff;
            if (tmp != 0)
            {
                Equipments[5] = Context.LibData.GetGoods(2, tmp) as GoodsEquipment;
            }

            tmp = buf[offset + 0x1a] & 0xff;
            if (tmp != 0)
            {
                Equipments[6] = Context.LibData.GetGoods(4, tmp) as GoodsEquipment;
            }

            tmp = buf[offset + 0x18] & 0xff;
            if (tmp != 0)
            {
                Equipments[7] = Context.LibData.GetGoods(1, tmp) as GoodsEquipment;
            }
        }