/// <summary>
 /// ???
 /// </summary>
 /// <param name="context"></param>
 public CommandDisCmp(ArraySegment <byte> data, SimulatorContext context) : base(data, 8, context)
 {
     _varIndex = data.Get2BytesUInt(0);
     _value    = data.Get2BytesUInt(2);
     _addr1    = data.Get2BytesUInt(4);
     _addr2    = data.Get2BytesUInt(6);
 }
Esempio n. 2
0
 /// <summary>
 /// 使用指定数量的物品命令
 /// </summary>
 /// <param name="context"></param>
 public CommandUseGoodsNum(ArraySegment <byte> data, SimulatorContext context) : base(data, 8, context)
 {
     _type    = data.Get2BytesUInt(0);
     _index   = data.Get2BytesUInt(2);
     _num     = data.Get2BytesUInt(4);
     _address = data.Get2BytesUInt(6);
 }
Esempio n. 3
0
            public CommandFaceToFaceOperate(ArraySegment <byte> data, SimulatorContext context) : base(context)
            {
                _characterId1 = data.Get2BytesUInt(0);
                _characterId2 = data.Get2BytesUInt(2);

                Character character1 = GetCharacter(_characterId1);
                Character character2 = GetCharacter(_characterId2);
                Point     point1     = character1.PosInMap;
                Point     point2     = character2.PosInMap;

                if (point1.X > point2.X)
                {
                    character2.Direction = Direction.East;
                }
                else if (point1.X < point2.X)
                {
                    character2.Direction = Direction.West;
                }
                else
                {
                    if (point1.Y > point2.Y)
                    {
                        character2.Direction = Direction.South;
                    }
                    else if (point1.Y < point2.Y)
                    {
                        character2.Direction = Direction.North;
                    }
                }
            }
            public CommandCreateCharacterOperate(ArraySegment <byte> data, SimulatorContext context) : base(context)
            {
                _id = data.Get2BytesUInt(0);
                _x  = data.Get2BytesUInt(2);
                _y  = data.Get2BytesUInt(4);

                Context.PlayContext.CreateActor(_id, _x, _y);
            }
 /// <summary>
 /// 属性测试命令
 /// </summary>
 /// <param name="context"></param>
 public CommandAttributeTest(ArraySegment <byte> data, SimulatorContext context) : base(data, 10, context)
 {
     _actorid = data.Get2BytesUInt(0);
     _type    = data.Get2BytesUInt(2);
     _value   = data.Get2BytesUInt(4);
     _addr1   = data.Get2BytesUInt(6);
     _addr2   = data.Get2BytesUInt(8);
 }
Esempio n. 6
0
 /// <summary>
 /// 测试物品数量命令
 /// </summary>
 /// <param name="context"></param>
 public CommandTestGoodsNum(ArraySegment <byte> data, SimulatorContext context) : base(data, 10, context)
 {
     _type  = data.Get2BytesUInt(0);
     _index = data.Get2BytesUInt(2);
     _num   = data.Get2BytesUInt(4);
     _addr1 = data.Get2BytesUInt(6);
     _addr2 = data.Get2BytesUInt(8);
 }
Esempio n. 7
0
            public CommandMoveOperate(ArraySegment <byte> data, SimulatorContext context) : base(context)
            {
                _npcId        = data.Get2BytesUInt(0);
                _destinationX = data.Get2BytesUInt(2);
                _destinationY = data.Get2BytesUInt(4);

                _targetNPC = Context.SceneMap.SceneNPCs[_npcId];
                _interval  = 400;
            }
Esempio n. 8
0
            public CommandMovieOperate(ArraySegment <byte> data, SimulatorContext context) : base(context)
            {
                _type    = data.Get2BytesUInt(0);
                _index   = data.Get2BytesUInt(2);
                _showX   = data.Get2BytesUInt(4);
                _showY   = data.Get2BytesUInt(6);
                _control = data.Get2BytesUInt(8);

                _movie = Context.LibData.GetSrs(_type, _index);
                _movie.SetIteratorNum(5);
                _movie.StartAni();
            }
Esempio n. 9
0
            public CommandLearnMagicOperate(ArraySegment <byte> data, SimulatorContext context) : base(context)
            {
                _isAnyKeyDown = false;
                _showTime     = 0;

                var actorId = data.Get2BytesUInt(0);
                var type    = data.Get2BytesUInt(2);
                var index   = data.Get2BytesUInt(4);

                var magic           = Context.LibData.GetMagic(type, index) ?? throw new ArgumentException();
                var playerCharacter = Context.PlayContext.GetPlayer(actorId);

                playerCharacter.MagicChain.LearnMagic(type, index);

                _learnShowScreen = new LearnMagicScreen(Context, playerCharacter.Name, magic.Name);
            }
            public CommandTimeMsgOperate(ArraySegment <byte> data, SimulatorContext context) : base(context)
            {
                _time    = data.Get2BytesUInt(0);
                _message = data.GetString(2);

                _downKey      = SimulatorKeys.KEY_INVALID;
                _isAnyKeyDown = false;
                _countDown    = _time * 10;
            }
Esempio n. 11
0
 public CommandMenuOperate(ArraySegment <byte> data, SimulatorContext context) : base(context)
 {
     _varIndex  = data.Get2BytesUInt(0);
     _menuItems = data.GetString(2).Split(' ');
     _menu      = new ScreenCommonMenu(_menuItems, selectedIndex =>
     {
         Context.ScriptProcess.ScriptState.Variables[_varIndex] = selectedIndex;
         _finished = true;
     }, Context);
     Context.PushScreen(_menu);
 }
Esempio n. 12
0
            public CommandChoiceOperate(ArraySegment <byte> data, SimulatorContext context) : base(context)
            {
                _choice1 = data.GetStringBytes(0);
                _choice2 = data.GetStringBytes(_choice1.Length);

                _addrOffset = _choice1.Length + _choice2.Length;

                int maxLength = _choice1.Length > _choice2.Length ? _choice1.Length : _choice2.Length;
                int width     = maxLength * 8 - 8 + 6;

                _choice1 = _choice1.FixStringLength(maxLength);
                _choice2 = _choice2.FixStringLength(maxLength);

                _background  = Context.Util.GetFrameBitmap(width, 16 * 2 + 6);
                _backgroundX = (160 - _background.Width) / 2;
                _backgroundY = (96 - _background.Height) / 2;

                _address = data.Get2BytesUInt(_addrOffset);

                _selectedIndex = 0;
                _hasSelected   = false;
            }
Esempio n. 13
0
 /// <summary>
 /// 设置事件Timer命令
 /// </summary>
 /// <param name="context"></param>
 public CommandSetEventTimer(ArraySegment <byte> data, SimulatorContext context) : base(data, 4, context)
 {
     _timer   = data.Get2BytesUInt(0);
     _eventId = data.Get2BytesUInt(2);
 }
Esempio n. 14
0
 /// <summary>
 /// 测试金钱命令
 /// </summary>
 /// <param name="context"></param>
 public CommandTestMoney(ArraySegment <byte> data, SimulatorContext context) : base(data, 6, context)
 {
     _value   = data.Get4BytesInt(0);
     _address = data.Get2BytesUInt(4);
 }
Esempio n. 15
0
 /// <summary>
 /// 调用章节命令
 /// </summary>
 /// <param name="context"></param>
 public CommandCallChapter(ArraySegment <byte> data, SimulatorContext context) : base(data, 4, context)
 {
     _type  = data.Get2BytesUInt(0);
     _index = data.Get2BytesUInt(2);
 }
Esempio n. 16
0
 /// <summary>
 /// SetTo命令?
 /// </summary>
 /// <param name="context"></param>
 public CommandSetTo(ArraySegment <byte> data, SimulatorContext context) : base(data, 4, context)
 {
     _varIndex1 = data.Get2BytesUInt(2);
     _varIndex2 = data.Get2BytesUInt(0);
 }
Esempio n. 17
0
 /// <summary>
 /// 随机事件命令
 /// </summary>
 /// <param name="context"></param>
 public CommandRandRade(ArraySegment <byte> data, SimulatorContext context) : base(data, 4, context)
 {
     _value   = data.Get2BytesUInt(0);
     _address = data.Get2BytesUInt(2);
 }
Esempio n. 18
0
 /// <summary>
 /// 属性加命令
 /// </summary>
 /// <param name="context"></param>
 public CommandAttributeAdd(ArraySegment <byte> data, SimulatorContext context) : base(data, 6, context)
 {
     _actorid = data.Get2BytesUInt(0);
     _type    = data.Get2BytesUInt(2);
     _value   = data.Get2BytesUInt(4);
 }