示例#1
0
文件: Obj.cs 项目: zy1911/JxqyHD
 public void Save(KeyDataCollection keyDataCollection)
 {
     keyDataCollection.AddKey("ObjName", _objName);
     AddKey(keyDataCollection, "Kind", _kind);
     AddKey(keyDataCollection, "Dir", _dir);
     keyDataCollection.AddKey("MapX", MapX.ToString());
     keyDataCollection.AddKey("MapY", MapY.ToString());
     AddKey(keyDataCollection, "Damage", _damage);
     AddKey(keyDataCollection, "Frame", CurrentFrameIndex - FrameBegin);
     AddKey(keyDataCollection, "Height", _height);
     AddKey(keyDataCollection, "Lum", _lum);
     AddKey(keyDataCollection, "ObjFile", _objFileName);
     AddKey(keyDataCollection, "OffX", _offX);
     AddKey(keyDataCollection, "OffY", _offY);
     if (_scriptFile != null)
     {
         AddKey(keyDataCollection, "ScriptFile", _scriptFile);
     }
     if (_timerScriptFile != null)
     {
         AddKey(keyDataCollection, "TimerScriptFile", _timerScriptFile);
     }
     if (_wavFileSoundEffect != null)
     {
         AddKey(keyDataCollection, "WavFile", _wavFileName);
     }
     if (_timerScriptInterval != Globals.DefaultNpcObjTimeScriptInterval)
     {
         AddKey(keyDataCollection, "TimerScriptInterval", _timerScriptInterval);
     }
 }
    internal string GameHandler_Move(string arg)
    {
        if (LastMoveTime > 0 &&
            LastMoveTime >= ApiDateTime.SecondsFromBegin())
        {
            return(AWebServerUtils.OnGetJsonError(ErrorDefs.MoveInCold));
        }
        switch (arg)
        {
        case "up":
            if (!CheckCanMoveTo(0, -1))
            {
                return(AWebServerUtils.OnGetJsonError(ErrorDefs.InvalidMove));
            }
            MapY--;
            break;

        case "down":
            if (!CheckCanMoveTo(0, 1))
            {
                return(AWebServerUtils.OnGetJsonError(ErrorDefs.InvalidMove));
            }
            MapY++;
            break;

        case "left":
            if (!CheckCanMoveTo(-1))
            {
                return(AWebServerUtils.OnGetJsonError(ErrorDefs.InvalidMove));
            }
            MapX--;
            break;

        case "right":
            if (!CheckCanMoveTo(1))
            {
                return(AWebServerUtils.OnGetJsonError(ErrorDefs.InvalidMove));
            }
            MapX++;
            break;
        }
        LastMoveTime = ApiDateTime.SecondsFromBegin();

        var l = new List <string>();

        l.AddRange(new string[] { InfoNameDefs.MapX, MapX.ToString()
                                  , InfoNameDefs.MapY, MapY.ToString()
                                  , InfoNameDefs.LastMoveTime, LastMoveTime.ToString() });
        var monster = AMapManager.Instance.OnGetMonster(MapX, MapY);

        if (monster != null)
        {
            l.Add("m");
            l.Add(JsonConvert.SerializeObject(monster));
        }
        return(AWebServerUtils.OnGetJsonError(l.ToArray()));
    }
示例#3
0
 public GroundEffectPacket GenerateEffect(bool isRemoval)
 {
     return(new GroundEffectPacket
     {
         Effect = (ushort)Effect,
         XYCoordinates = $"{MapX}{MapY.ToString("00")}",
         MapX = (ushort)MapX,
         MapY = (ushort)MapY,
         IsRemoval = isRemoval
     });
 }
示例#4
0
        /// <summary>
        /// Gets a string representation of this object.
        /// </summary>
        /// <returns>T string representation of this object.</returns>
        public override string ToString()
        {
            string type;

            if (Item < types.Length)
            {
                type = types[Item];
            }
            else
            {
                type = "Item " + Item.ToString("X");
            }

            return
                (MapX.ToString("x").PadLeft(2, '0') + " "
                 + MapY.ToString("x").PadLeft(2, '0') + ": " +
                 type);
        }
示例#5
0
 public string GenerateEffect(bool removed)
 {
     return($"eff_g  {ItemInstance.Item?.EffectValue ?? ItemInstance.Design} {MapX.ToString("00")}{MapY.ToString("00")} {MapX} {MapY} {(removed ? 1 : 0)}");
 }
示例#6
0
 public string GenerateMinilandEffect(bool removed)
 {
     return($"eff_g  {ItemInstance.Item.EffectValue} {MapX.ToString("00")}{MapY.ToString("00")} {MapX} {MapY} {(removed ? 1 : 0)}");
 }