UINT WGDetailOtherOnlineAttrib_HumanHandler::Execute( WGDetailOtherOnlineAttrib_Human* pPacket, Player* pPlayer ) { __ENTER_FUNCTION PlayerID_t PlayerID = pPacket->GetPlayerID(); //发起查看者的ID GamePlayer* pGamePlayer = g_pPlayerPool->GetPlayer(PlayerID); if( pGamePlayer==NULL ) { Assert(FALSE); return PACKET_EXE_CONTINUE; } GCDetailAttrib Msg; Msg.SetLevel(pPacket->GetLevel()); Msg.SetCountry(pPacket->GetCountry()); Msg.SetMenpai(pPacket->GetMenpai()); Msg.SetDataID(pPacket->GetDataID()); pGamePlayer->SendPacket(&Msg); g_pLog->FastSaveLog( LOG_FILE_1, "WGDetailOtherOnlineAttrib_HumanHandler: ok obj=%d,scene=%d", pGamePlayer->GetHuman()->GetID(), pGamePlayer->GetHuman()->getScene()->SceneID()); return PACKET_EXE_CONTINUE; __LEAVE_FUNCTION return PACKET_EXE_ERROR; }
VOID Obj_Human::SendMsg_RefeshAttrib( VOID ) { __ENTER_FUNCTION INT nAttr = 0; BOOL bPublicAttrModified, bEquipmentModified, bDetailAttrModified; bPublicAttrModified = FALSE; bEquipmentModified = FALSE; bDetailAttrModified = FALSE; GCCharBaseAttrib msgPublicAttr; GCCharEquipment msgEquipment; GCDetailAttrib msgDetail; msgPublicAttr.setObjID( GetID() ); msgDetail.SetObjID( GetID() ); if ( m_AttrBackUp.m_bNameModified ) { bPublicAttrModified = TRUE; msgPublicAttr.setName( GetName() ); m_AttrBackUp.m_bNameModified = FALSE; } if ( m_AttrBackUp.m_bTitleModified ) { bPublicAttrModified = TRUE; msgPublicAttr.setTitle( GetTitle() ); msgPublicAttr.setTitleType( GetTitleType() ); m_AttrBackUp.m_bTitleModified = FALSE; } if(m_AttrBackUp.m_MaxHp != GetMaxHP()) { bPublicAttrModified = TRUE; m_AttrBackUp.m_MaxHp = GetMaxHP(); BYTE yHPPercent = (GetMaxHP())?((BYTE)((GetHP()*100 + GetMaxHP() - 1)/GetMaxHP())):(0); msgPublicAttr.setHPPercent( yHPPercent ); msgDetail.SetMAXHP( GetMaxHP() ); } if(m_AttrBackUp.m_HP != GetHP()) { bPublicAttrModified = TRUE; m_AttrBackUp.m_HP = GetHP(); BYTE yHPPercent = (GetMaxHP())?((BYTE)((GetHP()*100 + GetMaxHP() - 1)/GetMaxHP())):(0); msgPublicAttr.setHPPercent( yHPPercent ); msgDetail.SetHP( GetHP() ); } if(m_AttrBackUp.m_MaxMp != GetMaxMP()) { bPublicAttrModified = TRUE; m_AttrBackUp.m_MaxMp = GetMaxMP(); BYTE yMPPercent = (GetMaxMP())?((BYTE)((GetMP()*100 + GetMaxMP() - 1)/GetMaxMP())):(0); msgPublicAttr.setMPPercent( yMPPercent ); msgDetail.SetMAXMP( GetMaxMP() ); } if(m_AttrBackUp.m_MP != GetMP()) { bPublicAttrModified = TRUE; m_AttrBackUp.m_MP = GetMP(); BYTE yMPPercent = (GetMaxMP())?((BYTE)((GetMP()*100 + GetMaxMP() - 1)/GetMaxMP())):(0); msgPublicAttr.setMPPercent( yMPPercent ); msgDetail.SetMP( GetMP() ); } if(m_AttrBackUp.m_nRage != GetRage()) { bPublicAttrModified = TRUE; m_AttrBackUp.m_nRage = GetRage(); msgPublicAttr.setRage( GetRage() ); msgDetail.SetRage( GetRage() ); } if(fabs(m_AttrBackUp.m_MoveSpeed-GetMoveSpeed()) > 0.001f) { bPublicAttrModified = TRUE; m_AttrBackUp.m_MoveSpeed = GetMoveSpeed(); msgPublicAttr.setMoveSpeed( GetMoveSpeed() ); msgDetail.SetMoveSpeed( GetMoveSpeed() ); } const _CAMP_DATA *pCampData = GetCampData(); if ( pCampData != NULL ) { if(m_AttrBackUp.m_CampData != *pCampData) { bPublicAttrModified = TRUE; m_AttrBackUp.m_CampData = *pCampData; msgPublicAttr.setCampData( pCampData ); msgDetail.SetCampData( pCampData ); } } //if( m_AttrBackUp.m_nCampType != m_nCampType ) //{ // bPublicAttrModified = TRUE; // m_AttrBackUp.m_nCampType = m_nCampType; // msgPublicAttr.setCampType( m_nCampType ); // msgDetail.SetCampType( m_nCampType ); //} if(m_AttrBackUp.m_nOwnerID != GetOwnerID()) { bPublicAttrModified = TRUE; m_AttrBackUp.m_nOwnerID = GetOwnerID(); msgPublicAttr.setOwnerID( GetOwnerID() ); //msgDetail.SetOwnerID( GetOwnerID() ); } if(m_AttrBackUp.m_guidCurrentPet != GetCurrentPetGUID()) { bDetailAttrModified = TRUE; m_AttrBackUp.m_guidCurrentPet = GetCurrentPetGUID(); msgDetail.SetCurrentPetGUID( GetCurrentPetGUID() ); } if(m_AttrBackUp.m_RMBMoney != GetRMB()) { bDetailAttrModified = TRUE; m_AttrBackUp.m_RMBMoney = GetRMB() ; msgDetail.SetRMB( GetRMB() ) ; } if(m_AttrBackUp.m_BankRMB != GetBankRMB()) { bDetailAttrModified = TRUE; m_AttrBackUp.m_BankRMB = GetBankRMB() ; msgDetail.SetBankRMB( GetBankRMB() ) ; } if(m_AttrBackUp.m_DoubleExpTime_Num != GetDoubleExpTime_Num()) { bDetailAttrModified = TRUE; m_AttrBackUp.m_DoubleExpTime_Num = GetDoubleExpTime_Num() ; msgDetail.SetDoubleExpTime_Num( GetDoubleExpTime_Num() ) ; } /*if(m_AttrBackUp.m_GmRight != GetGmRight()) { bDetailAttrModified = TRUE; m_AttrBackUp.m_GmRight = GetGmRight() ; msgDetail.SetGmRight( GetGmRight() ) ; }*/ if(m_AttrBackUp.m_nDataID != GetDataID()) { bPublicAttrModified = TRUE; m_AttrBackUp.m_nDataID = GetDataID(); msgPublicAttr.setDataID( GetDataID() ); msgDetail.SetDataID( GetDataID() ); } if(m_AttrBackUp.m_nPortraitID != GetPortraitID()) { bPublicAttrModified = TRUE; m_AttrBackUp.m_nPortraitID = GetPortraitID(); msgPublicAttr.setPortraitID( GetPortraitID() ); msgDetail.SetPortraitID( GetPortraitID() ); } if(m_AttrBackUp.m_nModelID != GetModelID()) { bPublicAttrModified = TRUE; m_AttrBackUp.m_nModelID = GetModelID(); msgPublicAttr.setModelID( GetModelID() ); msgDetail.SetModelID( GetModelID() ); } if(m_AttrBackUp.m_nMountID != GetMountID()) { bPublicAttrModified = TRUE; m_AttrBackUp.m_nMountID = GetMountID(); msgPublicAttr.setMountID( GetMountID() ); msgDetail.SetMountID( GetMountID() ); } if(m_AttrBackUp.m_uHairMeshID != __GetHairModel() || m_AttrBackUp.m_uHairColor != __GetHairColor() || m_AttrBackUp.m_uFaceMeshID != __GetFaceModel()) { bPublicAttrModified = TRUE; m_AttrBackUp.m_uHairMeshID = __GetHairModel(); m_AttrBackUp.m_uFaceMeshID = __GetFaceModel(); m_AttrBackUp.m_uHairColor = __GetHairColor(); msgPublicAttr.setFaceMeshID( __GetFaceModel() ); msgPublicAttr.setHairMeshID( __GetHairModel() ); msgPublicAttr.setHairMatrixID( __GetHairColor() ); } if(m_AttrBackUp.m_nStealthLevel != GetStealthLevel()) { bPublicAttrModified = TRUE; m_AttrBackUp.m_nStealthLevel = GetStealthLevel(); msgPublicAttr.setStealthLevel( GetStealthLevel() ); } if(m_AttrBackUp.m_nMoodState != GetMoodState()) { bPublicAttrModified = TRUE; m_AttrBackUp.m_nMoodState = GetMoodState(); msgPublicAttr.setMoodState( GetMoodState() ); } if(m_AttrBackUp.m_Level != GetLevel()) { bPublicAttrModified = TRUE; m_AttrBackUp.m_Level = GetLevel(); msgPublicAttr.setLevel( GetLevel() ); msgDetail.SetLevel( GetLevel() ); } if ( m_AttrBackUp.m_bStallIsOpen != m_StallBox.GetStallIsOpen() ) {//摊位状态发生变化 bPublicAttrModified = TRUE; m_AttrBackUp.m_bStallIsOpen = m_StallBox.GetStallIsOpen(); msgPublicAttr.setIsOpen(m_AttrBackUp.m_bStallIsOpen); } if ( m_AttrBackUp.m_bStallNameChanged ) {//摊位名发生变化 m_AttrBackUp.m_bStallNameChanged = FALSE; if(m_StallBox.GetStallIsOpen()) { bPublicAttrModified = TRUE; msgPublicAttr.setStallName( m_StallBox.GetStallName() ); } } if(m_AttrBackUp.m_bLimitMove != IsLimitMove()) { bDetailAttrModified = TRUE; m_AttrBackUp.m_bLimitMove = IsLimitMove(); //msgPublicAttr.SetLimitMove( IsLimitMove() ); //msgPublicAttrAndLevel.SetLimitMove( IsLimitMove() ); //msgProtectedAttr.SetLimitMove( IsLimitMove() ); msgDetail.SetLimitMove( IsLimitMove() ); } if(m_AttrBackUp.m_bCanActionFlag1 != CanActionFlag1()) { bDetailAttrModified = TRUE; m_AttrBackUp.m_bCanActionFlag1 = CanActionFlag1(); msgDetail.SetCanActionFlag1(CanActionFlag1()); } if(m_AttrBackUp.m_bCanActionFlag2 != CanActionFlag2()) { bDetailAttrModified = TRUE; m_AttrBackUp.m_bCanActionFlag2 = CanActionFlag2(); msgDetail.SetCanActionFlag2(CanActionFlag1()); } if(m_AttrBackUp.m_Exp != GetExp()) { bDetailAttrModified = TRUE; m_AttrBackUp.m_Exp = GetExp(); msgDetail.SetExp( GetExp() ); } if(m_AttrBackUp.m_Money != GetMoney()) { bDetailAttrModified = TRUE; m_AttrBackUp.m_Money = GetMoney(); msgDetail.SetMoney( GetMoney() ); } if(m_AttrBackUp.m_RMBMoney != GetRMB()) { bDetailAttrModified = TRUE; m_AttrBackUp.m_RMBMoney = GetRMB(); msgDetail.SetRMB( GetRMB() ); } if(m_AttrBackUp.m_nMenpai != GetMenPai()) { bDetailAttrModified = TRUE; m_AttrBackUp.m_nMenpai = GetMenPai(); msgDetail.SetMenpai(GetMenPai()); } if(m_AttrBackUp.m_GuildID != GetGuildID()) { bDetailAttrModified = TRUE; m_AttrBackUp.m_GuildID = GetGuildID(); msgDetail.SetGuild(GetGuildID()); } if(m_AttrBackUp.m_nStr != GetStr()) { bDetailAttrModified = TRUE; m_AttrBackUp.m_nStr = GetStr(); msgDetail.SetStr(GetStr()); } if(m_AttrBackUp.m_nSpr != GetSpr()) { bDetailAttrModified = TRUE; m_AttrBackUp.m_nSpr = GetSpr(); msgDetail.SetSpr(GetSpr()); } if(m_AttrBackUp.m_nCon != GetCon()) { bDetailAttrModified = TRUE; m_AttrBackUp.m_nCon = GetCon(); msgDetail.SetCon(GetCon()); } if(m_AttrBackUp.m_nInt != GetInt()) { bDetailAttrModified = TRUE; m_AttrBackUp.m_nInt = GetInt(); msgDetail.SetInt(GetInt()); } if(m_AttrBackUp.m_nDex != GetDex()) { bDetailAttrModified = TRUE; m_AttrBackUp.m_nDex = GetDex(); msgDetail.SetDex(GetDex()); } if(m_AttrBackUp.m_nPointRemain != Get_RemainPoints()) { bDetailAttrModified = TRUE; m_AttrBackUp.m_nPointRemain = Get_RemainPoints(); msgDetail.SetPoint_Remain( Get_RemainPoints() ); } if(m_AttrBackUp.m_nReHpSpeed != GetHPRegenerate()) { bDetailAttrModified = TRUE; m_AttrBackUp.m_nReHpSpeed = GetHPRegenerate(); msgDetail.SetHP_ReSpeed( GetHPRegenerate() ); } if(m_AttrBackUp.m_nReMpSpeed != GetMPRegenerate()) { bDetailAttrModified = TRUE; m_AttrBackUp.m_nReMpSpeed = GetMPRegenerate(); msgDetail.SetMP_ReSpeed( GetMPRegenerate() ); } nAttr = Attr_VerifyGeneralAttack(GetAttackPhysics()); if(m_AttrBackUp.m_nAttPhysics != nAttr) { bDetailAttrModified = TRUE; m_AttrBackUp.m_nAttPhysics = nAttr; msgDetail.SetAtt_Physics(nAttr); } nAttr = Attr_VerifyGeneralAttack(GetAttackMagic()); if(m_AttrBackUp.m_nAttMagic != nAttr) { bDetailAttrModified = TRUE; m_AttrBackUp.m_nAttMagic = nAttr; msgDetail.SetAtt_Magic(nAttr); } nAttr = Attr_VerifyDefence(GetDefencePhysics()); if(m_AttrBackUp.m_nDefPhysics != nAttr) { bDetailAttrModified = TRUE; m_AttrBackUp.m_nDefPhysics = nAttr; msgDetail.SetDef_Physics(nAttr); } nAttr = Attr_VerifyDefence(GetDefenceMagic()); if(m_AttrBackUp.m_nDefMagic != nAttr) { bDetailAttrModified = TRUE; m_AttrBackUp.m_nDefMagic = nAttr; msgDetail.SetDef_Magic(nAttr); } nAttr = Attr_VerifyHitMiss(GetHit()); if(m_AttrBackUp.m_nHit != nAttr) { bDetailAttrModified = TRUE; m_AttrBackUp.m_nHit = nAttr; msgDetail.SetHit(nAttr); } nAttr = Attr_VerifyHitMiss(GetMiss()); if(m_AttrBackUp.m_nMiss != nAttr) { bDetailAttrModified = TRUE; m_AttrBackUp.m_nMiss = nAttr; msgDetail.SetMiss(nAttr); } nAttr = Attr_VerifyCritical(GetCritical()); if(m_AttrBackUp.m_nCritic != nAttr) { bDetailAttrModified = TRUE; m_AttrBackUp.m_nCritic = nAttr; msgDetail.SetCritic(nAttr); } if(m_AttrBackUp.m_nStrikePoint != GetStrikePoint()) { bDetailAttrModified = TRUE; m_AttrBackUp.m_nStrikePoint = GetStrikePoint(); msgDetail.SetStrikePoint( GetStrikePoint() ); } if(m_AttrBackUp.m_nAttSpeed != GetAttackSpeed()) { bDetailAttrModified = TRUE; m_AttrBackUp.m_nAttSpeed = GetAttackSpeed(); msgDetail.SetAttSpeed( GetAttackSpeed() ); } nAttr = Attr_VerifyTraitAttack(GetAttackCold()); if(m_AttrBackUp.m_nAttCold != nAttr) { bDetailAttrModified = TRUE; m_AttrBackUp.m_nAttCold = nAttr; msgDetail.SetAttCold(nAttr); } nAttr = Attr_VerifyResist(GetDefenceCold()); if(m_AttrBackUp.m_nDefCold != nAttr) { bDetailAttrModified = TRUE; m_AttrBackUp.m_nDefCold = nAttr; msgDetail.SetDefCold(nAttr); } nAttr = Attr_VerifyTraitAttack(GetAttackFire()); if(m_AttrBackUp.m_nAttFire != nAttr) { bDetailAttrModified = TRUE; m_AttrBackUp.m_nAttFire = nAttr; msgDetail.SetAttFire(nAttr); } nAttr = Attr_VerifyResist(GetDefenceFire()); if(m_AttrBackUp.m_nDefFire != nAttr) { bDetailAttrModified = TRUE; m_AttrBackUp.m_nDefFire = nAttr; msgDetail.SetDefFire(nAttr); } nAttr = Attr_VerifyTraitAttack(GetAttackLight()); if(m_AttrBackUp.m_nAttLight != nAttr) { bDetailAttrModified = TRUE; m_AttrBackUp.m_nAttLight = nAttr; msgDetail.SetAttLight(nAttr); } nAttr = Attr_VerifyResist(GetDefenceLight()); if(m_AttrBackUp.m_nDefLight != nAttr) { bDetailAttrModified = TRUE; m_AttrBackUp.m_nDefLight = nAttr; msgDetail.SetDefLight(nAttr); } nAttr = Attr_VerifyTraitAttack(GetAttackPoison()); if(m_AttrBackUp.m_nAttPoison != nAttr) { bDetailAttrModified = TRUE; m_AttrBackUp.m_nAttPoison = nAttr; msgDetail.SetAttPoison(nAttr); } nAttr = Attr_VerifyResist(GetDefencePoison()); if(m_AttrBackUp.m_nDefPoison != nAttr) { bDetailAttrModified = TRUE; m_AttrBackUp.m_nDefPoison = nAttr; msgDetail.SetDefPoison(nAttr); } // 装备刷新 if ( m_AttrBackUp.m_bWeaponModified ) { bEquipmentModified = TRUE; msgEquipment.setWeaponID( GetEquipID( HEQUIP_WEAPON ) ); Item *pWeaponItem = GetEquipContain()->GetItem(HEQUIP_WEAPON); UINT uGemID = INVALID_ID; if(pWeaponItem != NULL) { uGemID = GetEquipmentMaxLevelGemID(pWeaponItem); } msgEquipment.setWeaponGemID(uGemID); m_AttrBackUp.m_bWeaponModified = FALSE; } if ( m_AttrBackUp.m_bCapModified ) { bEquipmentModified = TRUE; msgEquipment.setCapID( GetEquipID( HEQUIP_CAP ) ); Item *pCapItem = GetEquipContain()->GetItem(HEQUIP_CAP); UINT uGemID = INVALID_ID; if(pCapItem != NULL) { uGemID = GetEquipmentMaxLevelGemID(pCapItem); } msgEquipment.setCapGemID( uGemID ); m_AttrBackUp.m_bCapModified = FALSE; } if ( m_AttrBackUp.m_bArmorModified ) { bEquipmentModified = TRUE; msgEquipment.setArmourID( GetEquipID( HEQUIP_ARMOR ) ); Item *pArmorItem = GetEquipContain()->GetItem(HEQUIP_ARMOR); UINT uGemID = INVALID_ID; if(pArmorItem != NULL) { uGemID = GetEquipmentMaxLevelGemID(pArmorItem); } msgEquipment.setArmourGemID( uGemID ); m_AttrBackUp.m_bArmorModified = FALSE; } if ( m_AttrBackUp.m_bCuffModified ) { bEquipmentModified = TRUE; msgEquipment.setCuffID( GetEquipID( HEQUIP_CUFF ) ); Item *pCuffItem = GetEquipContain()->GetItem(HEQUIP_CUFF); UINT uGemID = INVALID_ID; if(pCuffItem != NULL) { uGemID = GetEquipmentMaxLevelGemID(pCuffItem); } msgEquipment.setCuffGemID( uGemID ); m_AttrBackUp.m_bCuffModified = FALSE; } if ( m_AttrBackUp.m_bBootModified ) { bEquipmentModified = TRUE; msgEquipment.setBootID( GetEquipID( HEQUIP_BOOT ) ); Item *pBootItem = GetEquipContain()->GetItem(HEQUIP_BOOT); UINT uGemID = INVALID_ID; if(pBootItem != NULL) { uGemID = GetEquipmentMaxLevelGemID(pBootItem); } msgEquipment.setBootGemID( uGemID ); m_AttrBackUp.m_bBootModified = FALSE; } if ( m_AttrBackUp.m_bSashModified ) { bEquipmentModified = TRUE; //msgEquipment.setSashID( GetEquipID( HEQUIP_SASH ) ); m_AttrBackUp.m_bSashModified = FALSE; } if ( bPublicAttrModified ) { if ( bPublicAttrModified ) { m_PublicAttrVersion++; } if ( bEquipmentModified ) { m_EquipVer++; } HUMANLIST listHuman; getScene()->ScanHuman( getZoneID(), MAX_REFESH_OBJ_ZONE_RADIUS, &(listHuman) ); BOOL bSendPublicMsg = bPublicAttrModified; BYTE i; for ( i = 0; i < listHuman.m_Count; i++ ) { Obj_Human *pTargetHuman = listHuman.m_aHuman[i]; if ( IsCanViewMe( pTargetHuman ) ) { pTargetHuman->GetPlayer()->SendPacket( &msgPublicAttr ); if ( bEquipmentModified ) { pTargetHuman->GetPlayer()->SendPacket( &msgEquipment ); } } } } bDetailAttrModified |= bPublicAttrModified; if ( bDetailAttrModified ) { GetPlayer()->SendPacket(&msgDetail); //发送给自己的详细消息 } __LEAVE_FUNCTION }