示例#1
0
 public static a80_WeaponRecoil.Struct ReadInfo(ActionModel ac, ReceivePacket p, bool genLog)
 {
     a80_WeaponRecoil.Struct @struct = new a80_WeaponRecoil.Struct()
     {
         _RecoilHorzAngle = p.readT(),
         _RecoilHorzMax   = p.readT(),
         _RecoilVertAngle = p.readT(),
         _RecoilVertMax   = p.readT(),
         _Deviation       = p.readT(),
         _weaponId        = p.readUH(),
         _weaponSlot      = p.readC(),
         _unkV            = p.readC(),
         _RecoilHorzCount = p.readC()
     };
     if (genLog)
     {
         Logger.warning("Slot " + (object)ac._slot + " weapon info: (" + (object)@struct._RecoilHorzAngle + ";" + (object)@struct._RecoilHorzMax + ";" + (object)@struct._RecoilVertAngle + ";" + (object)@struct._RecoilVertMax + ";" + (object)@struct._Deviation + ";" + (object)@struct._weaponId + ";" + (object)@struct._weaponSlot + ";" + (object)@struct._unkV + ";" + (object)@struct._RecoilHorzCount + ")", false);
     }
     return(@struct);
 }
        public static Struct ReadInfo(ActionModel ac, ReceivePacket p, bool genLog)
        {
            Struct info = new Struct
            {
                _RecoilHorzAngle = p.readT(),
                _RecoilHorzMax   = p.readT(),
                _RecoilVertAngle = p.readT(),
                _RecoilVertMax   = p.readT(),
                _Deviation       = p.readT(),
                _weaponId        = p.readUH(), //weaponId / 64
                _weaponSlot      = p.readC(),  //weaponSlot
                _unkV            = p.readC(),  //ping?
                _RecoilHorzCount = p.readC()
            };

            if (genLog)
            {
                Printf.warning("Slot " + ac._slot + " weapon info: (" + info._RecoilHorzAngle + ";" + info._RecoilHorzMax + ";" + info._RecoilVertAngle + ";" + info._RecoilVertMax + ";" + info._Deviation + ";" + info._weaponId + ";" + info._weaponSlot + ";" + info._unkV + ";" + info._RecoilHorzCount + ")");
            }
            return(info);
        }
示例#3
0
 public static code6_ObjectAnim.Struct ReadInfo(ReceivePacket p, bool genLog)
 {
     code6_ObjectAnim.Struct @struct = new code6_ObjectAnim.Struct()
     {
         _life     = p.readUH(),
         _anim1    = p.readC(),
         _anim2    = p.readC(),
         _syncDate = p.readT()
     };
     if (genLog)
     {
         Logger.warning("[code6_ObjectAnim] u: " + (object)@struct._life + "; u2: " + (object)@struct._anim1 + "; u3: " + (object)@struct._anim2 + "; u4: " + (object)@struct._syncDate, false);
     }
     return(@struct);
 }
示例#4
0
 public static code12_StageObjAnim.Struct ReadInfo(ReceivePacket p, bool genLog)
 {
     code12_StageObjAnim.Struct @struct = new code12_StageObjAnim.Struct()
     {
         _unk      = p.readC(),
         _life     = p.readUH(),
         _syncDate = p.readT(),
         _anim1    = p.readC(),
         _anim2    = p.readC()
     };
     if (genLog)
     {
         Logger.warning("[code12_StageObjAnim] " + (object)@struct._unk + ";" + (object)@struct._life + ";" + (object)@struct._syncDate + ";" + (object)@struct._anim1 + ";" + (object)@struct._anim2, false);
     }
     return(@struct);
 }
        public static Struct ReadInfo(ReceivePacket p, bool genLog)
        {
            Struct info = new Struct
            {
                _life     = p.readUH(),
                _anim1    = p.readC(),
                _anim2    = p.readC(),
                _syncDate = p.readT()
            };

            if (genLog)
            {
                Printf.warning("[code6_ObjectAnim] u: " + info._life + "; u2: " + info._anim1 + "; u3: " + info._anim2 + "; u4: " + info._syncDate);
            }
            return(info);
        }
示例#6
0
        public static Struct ReadInfo(ReceivePacket p, bool genLog)
        {
            Struct info = new Struct
            {
                _unk      = p.readC(),
                _life     = p.readUH(),
                _syncDate = p.readT(),
                _anim1    = p.readC(),
                _anim2    = p.readC()
            };

            if (genLog)
            {
                Printf.warning("[code12_StageObjAnim] " + info._unk + ";" + info._life + ";" + info._syncDate + ";" + info._anim1 + ";" + info._anim2);
            }
            return(info);
        }
示例#7
0
 public static a400_Mission.Struct ReadInfo(ActionModel ac, ReceivePacket p, bool genLog, float time, bool OnlyBytes = false)
 {
     a400_Mission.Struct @struct = new a400_Mission.Struct()
     {
         _bombAll   = (int)p.readC(),
         _plantTime = p.readT()
     };
     if (!OnlyBytes)
     {
         @struct.BombEnum = (BombFlag)(@struct._bombAll & 15);
         @struct.BombId   = @struct._bombAll >> 4;
     }
     if (genLog)
     {
         Logger.warning("Slot " + (object)ac._slot + " bomb: (" + (object)@struct.BombEnum + "; Id: " + (object)@struct.BombId + "; sTime: " + (object)@struct._plantTime + "; aTime: " + (object)time + ")", false);
     }
     return(@struct);
 }
示例#8
0
        /// <summary>
        /// Puxa todas as informações. OnlyBytes desativado.
        /// </summary>
        /// <param name="ac"></param>
        /// <param name="p"></param>
        /// <param name="genLog"></param>
        /// <param name="time"></param>
        /// <param name="OnlyBytes">Não calcular informações adicionais?</param>
        /// <returns></returns>
        public static Struct ReadInfo(ActionModel ac, ReceivePacket p, bool genLog, float time, bool OnlyBytes = false)
        {
            Struct info = new Struct
            {
                _bombAll   = p.readC(),
                _plantTime = p.readT()
            };

            if (!OnlyBytes)
            {
                info.BombEnum = (BombFlag)(info._bombAll & 15);
                info.BombId   = (info._bombAll >> 4);
            }
            if (genLog)
            {
                Printf.warning("Slot " + ac._slot + " bomb: (" + info.BombEnum + "; Id: " + info.BombId + "; sTime: " + info._plantTime + "; aTime: " + time + ")");
            }
            return(info);
        }
示例#9
0
        public static byte[] getBaseData132(byte[] data)
        {
            ReceivePacket p = new ReceivePacket(data);

            using (SendPacket s = new SendPacket())
            {
                s.writeT(p.readT());
                for (int i = 0; i < 16; i++)
                {
                    ActionModel ac = new ActionModel();
                    try
                    {
                        bool exception;
                        ac._type = (P2P_SUB_HEAD)p.readC(out exception);
                        if (exception)
                        {
                            break;
                        }
                        ac._slot       = p.readUH();
                        ac._lengthData = p.readUH();
                        if (ac._lengthData == 65535)
                        {
                            break;
                        }
                        s.writeC((byte)ac._type);
                        s.writeH(ac._slot);
                        s.writeH(ac._lengthData);
                        if (ac._type == P2P_SUB_HEAD.GRENADE)
                        {
                            code1_GrenadeSync.writeInfo(s, p);
                        }
                        else if (ac._type == P2P_SUB_HEAD.DROPEDWEAPON)
                        {
                            code2_WeaponSync.writeInfo(s, p);
                        }
                        else if (ac._type == P2P_SUB_HEAD.OBJECT_STATIC)
                        {
                            code3_ObjectStatic.writeInfo(s, p);
                        }
                        else if (ac._type == P2P_SUB_HEAD.OBJECT_ANIM)
                        {
                            code6_ObjectAnim.writeInfo(s, p);
                        }
                        else if (ac._type == P2P_SUB_HEAD.STAGEINFO_OBJ_STATIC)
                        {
                            code9_StageInfoObjStatic.writeInfo(s, p, false);
                        }
                        else if (ac._type == P2P_SUB_HEAD.STAGEINFO_OBJ_ANIM)
                        {
                            code12_StageObjAnim.writeInfo(s, p);
                        }
                        else if (ac._type == P2P_SUB_HEAD.CONTROLED_OBJECT)
                        {
                            code13_ControledObj.writeInfo(s, p, false);
                        }
                        else if (ac._type == P2P_SUB_HEAD.USER || ac._type == P2P_SUB_HEAD.STAGEINFO_CHARA)
                        {
                            ac._flags = (Events)p.readUD();
                            ac._data  = p.readB(ac._lengthData - 9);
                            s.writeD((uint)ac._flags);
                            s.writeB(ac._data);
                            if (ac._data.Length == 0 && (uint)ac._flags != 0)
                            {
                                break;
                            }
                        }
                        else
                        {
                            SaveLog.warning("[New user packet type2 '" + ac._type + "' or '" + (int)ac._type + "']: " + BitConverter.ToString(data));
                            throw new Exception("Unknown action type2");
                        }
                    }
                    catch (Exception ex)
                    {
                        SaveLog.fatal(ex.ToString());
                        Printf.b_danger("[Packet132Creator.getBaseData132] Erro fatal!");
                        s.mstream = new MemoryStream();
                        break;
                    }
                }
                return(s.mstream.ToArray());
            }
        }
示例#10
0
        public static byte[] getBaseData132(byte[] data)
        {
            ReceivePacket p = new ReceivePacket(data);

            using (SendPacket s = new SendPacket())
            {
                s.writeT(p.readT());
                for (int index = 0; index < 16; ++index)
                {
                    ActionModel actionModel = new ActionModel();
                    try
                    {
                        bool exception;
                        actionModel._type = (P2P_SUB_HEAD)p.readC(out exception);
                        if (!exception)
                        {
                            actionModel._slot       = p.readUH();
                            actionModel._lengthData = p.readUH();
                            if (actionModel._lengthData != ushort.MaxValue)
                            {
                                s.writeC((byte)actionModel._type);
                                s.writeH(actionModel._slot);
                                s.writeH(actionModel._lengthData);
                                if (actionModel._type == P2P_SUB_HEAD.GRENADE)
                                {
                                    code1_GrenadeSync.writeInfo(s, p);
                                }
                                else if (actionModel._type == P2P_SUB_HEAD.DROPEDWEAPON)
                                {
                                    code2_WeaponSync.writeInfo(s, p);
                                }
                                else if (actionModel._type == P2P_SUB_HEAD.OBJECT_STATIC)
                                {
                                    code3_ObjectStatic.writeInfo(s, p);
                                }
                                else if (actionModel._type == P2P_SUB_HEAD.OBJECT_ANIM)
                                {
                                    code6_ObjectAnim.writeInfo(s, p);
                                }
                                else if (actionModel._type == P2P_SUB_HEAD.STAGEINFO_OBJ_STATIC)
                                {
                                    code9_StageInfoObjStatic.writeInfo(s, p, false);
                                }
                                else if (actionModel._type == P2P_SUB_HEAD.STAGEINFO_OBJ_ANIM)
                                {
                                    code12_StageObjAnim.writeInfo(s, p);
                                }
                                else if (actionModel._type == P2P_SUB_HEAD.CONTROLED_OBJECT)
                                {
                                    code13_ControledObj.writeInfo(s, p, false);
                                }
                                else if (actionModel._type == P2P_SUB_HEAD.USER || actionModel._type == P2P_SUB_HEAD.STAGEINFO_CHARA)
                                {
                                    actionModel._flags = (Events)p.readUD();
                                    actionModel._data  = p.readB((int)actionModel._lengthData - 9);
                                    s.writeD((uint)actionModel._flags);
                                    s.writeB(actionModel._data);
                                    if (actionModel._data.Length == 0 && actionModel._flags > (Events)0)
                                    {
                                        break;
                                    }
                                }
                                else
                                {
                                    Logger.warning("[New user packet type2 '" + (object)actionModel._type + "' or '" + (object)actionModel._type + "']: " + BitConverter.ToString(data), false);
                                    throw new Exception("Unknown action type2");
                                }
                            }
                            else
                            {
                                break;
                            }
                        }
                        else
                        {
                            break;
                        }
                    }
                    catch (Exception ex)
                    {
                        Logger.warning("B: " + BitConverter.ToString(data), false);
                        Logger.warning(ex.ToString(), false);
                        s.mstream = new MemoryStream();
                        break;
                    }
                }
                return(s.mstream.ToArray());
            }
        }