public new void PacketBytesToClass( byte[] data) { Type infotype = this.GetType(); FieldInfo headerinfo = null; int index = ParsePacketHeader( data); // nNpcIdx byte[] npcIdx = new byte[ sizeof( Int32)]; headerinfo = infotype.GetField( "nNpcIdx", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, npcIdx, 0, sizeof( Int32)); headerinfo.SetValue( this, BitConverter.ToInt32( npcIdx, 0)); index += sizeof( Int32); // // nSessionIdx // byte[] sessionIdx = new byte[ sizeof( UInt16)]; // headerinfo = infotype.GetField( "nSessionIdx", BINDING_FLAGS_PIG); // Buffer.BlockCopy( data, index, sessionIdx, 0, sizeof( UInt16)); // headerinfo.SetValue( this, BitConverter.ToUInt16( sessionIdx, 0)); // index += sizeof( UInt16); // // // nCharUniqKey // byte[] charUniqKey = new byte[ sizeof( UInt32)]; // headerinfo = infotype.GetField( "nCharUniqKey", BINDING_FLAGS_PIG); // Buffer.BlockCopy( data, index, charUniqKey, 0, sizeof( UInt32)); // headerinfo.SetValue( this, BitConverter.ToUInt32( charUniqKey, 0)); // index += sizeof( UInt32); // nSessionIdx for( int i=0; i<TargetDecider.MAX_SKILL_TARGET; ++i) { byte[] sessionIdx = new byte[ sizeof( UInt16)]; Buffer.BlockCopy( data, index, sessionIdx, 0, sizeof( UInt16)); nSessionIdx[i] = BitConverter.ToUInt16( sessionIdx, 0); index += sizeof( UInt16); } // nCharUniqKey for( int i=0; i<TargetDecider.MAX_SKILL_TARGET; ++i) { byte[] charUniqKey = new byte[ sizeof( UInt32)]; Buffer.BlockCopy( data, index, charUniqKey, 0, sizeof( UInt32)); nCharUniqKey[i] = BitConverter.ToUInt32( charUniqKey, 0); index += sizeof( UInt32); } // nHpCur byte[] hpCur = new byte[ sizeof( Single)]; headerinfo = infotype.GetField( "nHpCur", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, hpCur, 0, sizeof( Single)); headerinfo.SetValue( this, BitConverter.ToSingle( hpCur, 0)); index += sizeof( Single); // nMonsterSkillLevelTableIdx byte[] monsterSkillLevelTableIdx = new byte[ sizeof( Int32)]; headerinfo = infotype.GetField( "nMonsterSkillLevelTableIdx", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, monsterSkillLevelTableIdx, 0, sizeof( Int32)); headerinfo.SetValue( this, BitConverter.ToInt32( monsterSkillLevelTableIdx, 0)); index += sizeof( Int32); // bCasting byte[] casting = new byte[ sizeof( bool)]; headerinfo = infotype.GetField( "bCasting", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, casting, 0, sizeof( bool)); headerinfo.SetValue( this, BitConverter.ToBoolean( casting, 0)); index += sizeof( bool); // nCastingMilliSec byte[] castingMilliSec = new byte[ sizeof( Int32)]; headerinfo = infotype.GetField( "nCastingMilliSec", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, castingMilliSec, 0, sizeof( Int32)); headerinfo.SetValue( this, BitConverter.ToInt32( castingMilliSec, 0)); index += sizeof( Int32); // bReady byte[] ready = new byte[ sizeof( bool)]; headerinfo = infotype.GetField( "bReady", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, ready, 0, sizeof( bool)); headerinfo.SetValue( this, BitConverter.ToBoolean( ready, 0)); index += sizeof( bool); // nCharCnt byte[] charCnt = new byte[ sizeof( Int32)]; headerinfo = infotype.GetField( "nCharCnt", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, charCnt, 0, sizeof( Int32)); headerinfo.SetValue( this, BitConverter.ToInt32( charCnt, 0)); index += sizeof( Int32); // nNpcCnt byte[] npcCnt = new byte[ sizeof( Int32)]; headerinfo = infotype.GetField( "nNpcCnt", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, npcCnt, 0, sizeof( Int32)); headerinfo.SetValue( this, BitConverter.ToInt32( npcCnt, 0)); index += sizeof( Int32); bodyChar = new AS_SC_NPC_ATTACK_CHAR_2[nCharCnt]; for( int i = 0; i < nCharCnt; i++) { bodyChar[i] = new AS_SC_NPC_ATTACK_CHAR_2(); byte[] tmpData = new byte[AS_SC_NPC_ATTACK_CHAR_2.size]; Buffer.BlockCopy( data, index, tmpData, 0, tmpData.Length); bodyChar[i].ByteArrayToClass( tmpData); index += AS_SC_NPC_ATTACK_CHAR_2.size; } bodyNpc = new AS_SC_NPC_ATTACK_CHAR_3[nNpcCnt]; for( int i = 0; i < nNpcCnt; i++) { bodyNpc[i] = new AS_SC_NPC_ATTACK_CHAR_3(); byte[] tmpData = new byte[AS_SC_NPC_ATTACK_CHAR_3.size]; Buffer.BlockCopy( data, index, tmpData, 0, tmpData.Length); bodyNpc[i].ByteArrayToClass( tmpData); index += AS_SC_NPC_ATTACK_CHAR_3.size; } }
//ADDITINAL INFO // public AsNpcEntity attacker_; // public Tbl_MonsterSkillLevel_Record skillLv_; // public Tbl_Action_Record action_; public Msg_NpcAttackChar2( Msg_NpcAttackChar1 _parent, AS_SC_NPC_ATTACK_CHAR_2 _info) { m_MessageType = eMessageType.NPC_ATTACK_CHAR2; parent_ = _parent; sessionId_ = _info.nSessionIdx; charUniqKey_ = _info.nCharUniqKey; hpCur_ = _info.fHpCur; mpCur_ = _info.fMpCur; eDamageType_ = ( eDAMAGETYPE)_info.eDamageType; // ilmeda, 20120731 damage_ = _info.nDamage; hpHeal_ = _info.fHpHeal; mpHeal_ = _info.fMpHeal; reflection_ = _info.fReflection; drain_ = _info.fDrain; knockBack_ = _info.bKnockBack; }