Пример #1
0
VOID Obj_Monster::InitBackupAttr()
{
__ENTER_FUNCTION

	m_AttrBackUp.m_bNameModified		= FALSE;
	m_AttrBackUp.m_bTitleModified		= FALSE;
	m_AttrBackUp.m_HP					= GetHP();
	m_AttrBackUp.m_MP					= GetMP();	//	add by gh 2010/03/25
	const _CAMP_DATA *pCampData = GetCampData();
	if ( pCampData != NULL )
		m_AttrBackUp.m_CampData			= *pCampData;
	m_AttrBackUp.m_MaxHp				= GetMaxHP();
	m_AttrBackUp.m_MaxMp				= GetMaxMP();	//	add by gh 2010/03/25
	m_AttrBackUp.m_MoveSpeed			= GetMoveSpeed();
	m_AttrBackUp.m_nDataID				= GetDataID();
	m_AttrBackUp.m_nModelID				= GetModelID();
	m_AttrBackUp.m_nMountID				= GetMountID();
	m_AttrBackUp.m_nAIType				= GetAIType();
	m_AttrBackUp.m_OwnerID				= GetOwnerID();
	m_AttrBackUp.m_OccupantGUID			= GetOccupantGUID();
	m_AttrBackUp.m_nStealthLevel		= GetStealthLevel();
	m_AttrBackUp.m_nMoodState			= GetMoodState();
	m_AttrBackUp.m_iHorseID				= GetHorseID();
	m_AttrBackUp.m_iWeaponID			= GetWeaponID();
__LEAVE_FUNCTION
}
Пример #2
0
void AddBotDialog::ShowAIOptions()
{
	m_opts_list->DeleteAllItems();
	m_opt_list_map.clear();
	m_battle.CustomBattleOptions().loadAIOptions(m_battle.GetHostGameName(), GetAIType(), STD_STRING(GetNick()));
	AddMMOptionsToList(0, m_battle.CustomBattleOptions().GetAIOptionIndex(STD_STRING(GetNick())));
	m_opts_list->SetColumnWidth(0, wxLIST_AUTOSIZE);
	m_opts_list->SetColumnWidth(1, wxLIST_AUTOSIZE);
	Layout();
	SetSize(wxDefaultSize);
}
Пример #3
0
void AddBotDialog::ShowAIOptions()
{
    if ( !usync().VersionSupports( IUnitSync::USYNC_GetSkirmishAI ) ) return;
    m_opts_list->DeleteAllItems();
    m_opt_list_map.clear();
    m_battle.CustomBattleOptions().loadAIOptions( m_battle.GetHostModName(), GetAIType(), GetNick() );
    AddMMOptionsToList( 0, m_battle.CustomBattleOptions().GetAIOptionIndex( GetNick() ) );
    m_opts_list->SetColumnWidth( 0, wxLIST_AUTOSIZE );
    m_opts_list->SetColumnWidth( 1, wxLIST_AUTOSIZE );
    Layout();
    SetSize( wxDefaultSize );
}
Пример #4
0
void AddBotDialog::ShowAIInfo()
{
	m_add_btn->Enable(m_ai->GetStringSelection() != wxEmptyString);
	m_ai_infos_lst->DeleteAllItems();
	const wxArrayString info = lslTowxArrayString(LSL::usync().GetAIInfos(GetAIType()));
	int count = info.GetCount();
	for (int i = 0; i < count; i = i + 3) {
		long index = m_ai_infos_lst->InsertItem(i, info[i]);
		m_ai_infos_lst->SetItem(index, 0, info[i]);
		m_ai_infos_lst->SetItem(index, 1, info[i + 1]);
	}
	m_ai_infos_lst->SetColumnWidth(0, wxLIST_AUTOSIZE);
	m_ai_infos_lst->SetColumnWidth(1, wxLIST_AUTOSIZE);
	Layout();
	SetSize(wxDefaultSize);
}
Пример #5
0
void AddBotDialog::ShowAIInfo()
{
    m_add_btn->Enable( m_ai->GetStringSelection() != wxEmptyString );
    if ( !usync().VersionSupports( IUnitSync::USYNC_GetSkirmishAI ) ) return;
    m_ai_infos_lst->DeleteAllItems();
    wxArrayString info = usync().GetAIInfos( GetAIType() );
    int count = info.GetCount();
    for ( int i = 0; i < count; i = i + 3 )
    {
        long index = m_ai_infos_lst->InsertItem( i, info[i] );
        m_ai_infos_lst->SetItem( index, 0,  info[i] );
        m_ai_infos_lst->SetItem( index, 1,  info[i+1] );
    }
    m_ai_infos_lst->SetColumnWidth( 0, wxLIST_AUTOSIZE );
    m_ai_infos_lst->SetColumnWidth( 1, wxLIST_AUTOSIZE );
    Layout();
    SetSize( wxDefaultSize );
}
Пример #6
0
VOID Obj_Monster::SendMsg_RefeshAttrib( VOID )
{
__ENTER_FUNCTION

	BOOL bPublicAttrModified ;
	bPublicAttrModified		= FALSE;

	GCCharBaseAttrib msgPublicAttr, msgProtectedAttr;

	msgPublicAttr.setObjID( GetID() );
	msgProtectedAttr.setObjID( GetID() );

	//msgPublicAttr.setName( GetName() );
	//msgProtectedAttr.setName( GetName() );

	//msgPublicAttr.setTitle( GetTitle() );
	//msgProtectedAttr.setTitle( GetTitle() );

	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 );
		msgProtectedAttr.setHPPercent( yHPPercent );
	}

	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 );
		msgProtectedAttr.setHPPercent( yHPPercent );
	}

	// add by gh 2010/03/30
	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 );
		msgProtectedAttr.setMPPercent( yMPPercent );
	}

	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 );
		msgProtectedAttr.setMPPercent( yMPPercent );
	}
	// end of add
	if(fabs(m_AttrBackUp.m_MoveSpeed-GetMoveSpeed()) > 0.001f)
	{
		bPublicAttrModified = TRUE;
		m_AttrBackUp.m_MoveSpeed = GetMoveSpeed();

		msgPublicAttr.setMoveSpeed( GetMoveSpeed() );
		msgProtectedAttr.setMoveSpeed( GetMoveSpeed() );
	}

	if(m_AttrBackUp.m_nDataID != GetDataID())
	{
		bPublicAttrModified = TRUE;
		m_AttrBackUp.m_nDataID = GetDataID();

	}

	const _CAMP_DATA *pCampData = GetCampData();
	if ( pCampData != NULL )
	{
		if(m_AttrBackUp.m_CampData != *pCampData)
		{
			bPublicAttrModified = TRUE;
			m_AttrBackUp.m_CampData = *pCampData;

			msgPublicAttr.setCampData( pCampData );
			msgProtectedAttr.setCampData( pCampData );
		}
	}

	if(m_AttrBackUp.m_OwnerID != GetOwnerID())
	{
		bPublicAttrModified = TRUE;
		m_AttrBackUp.m_OwnerID = GetOwnerID();

		msgPublicAttr.setOwnerID( GetOwnerID() );
		msgProtectedAttr.setOwnerID( GetOwnerID() );
	}

	if(m_AttrBackUp.m_OccupantGUID != GetOccupantGUID())
	{
		bPublicAttrModified = TRUE;
		m_AttrBackUp.m_OccupantGUID = GetOccupantGUID();

		msgPublicAttr.setOccupantGUID( GetOccupantGUID() );
		msgProtectedAttr.setOccupantGUID( GetOccupantGUID() );
	}

	if(m_AttrBackUp.m_nModelID != GetModelID())
	{
		bPublicAttrModified = TRUE;
		m_AttrBackUp.m_nModelID = GetModelID();
		msgPublicAttr.setModelID( GetModelID() );
		msgProtectedAttr.setModelID( GetModelID() );
	}

	if(m_AttrBackUp.m_nMountID != GetMountID())
	{
		bPublicAttrModified = TRUE;
		m_AttrBackUp.m_nMountID = GetMountID();
		msgPublicAttr.setMountID( GetMountID() );
		msgProtectedAttr.setMountID( GetMountID() );
	}

	if (m_AttrBackUp.m_nAIType != GetAIType() )
	{
		bPublicAttrModified = TRUE;
		m_AttrBackUp.m_nAIType = GetAIType();
		INT nRet = GetMonsterAIType();
		msgPublicAttr.setAIType(nRet);
		msgProtectedAttr.setAIType(nRet);
	}

	if(m_AttrBackUp.m_nStealthLevel != GetStealthLevel())
	{
		bPublicAttrModified = TRUE;
		m_AttrBackUp.m_nStealthLevel = GetStealthLevel();

		msgPublicAttr.setStealthLevel( GetStealthLevel() );
		msgProtectedAttr.setStealthLevel( GetStealthLevel() );
	}

	if(m_AttrBackUp.m_nMoodState != GetMoodState())
	{
		bPublicAttrModified = TRUE;
		m_AttrBackUp.m_nMoodState = GetMoodState();

		msgPublicAttr.setMoodState( GetMoodState() );
		msgProtectedAttr.setMoodState( GetMoodState() );
	}

	//if( m_AttrBackUp.m_iWeaponID != GetWeaponID() )
	//{
	//	bPublicAttrModified = TRUE;
	//	m_AttrBackUp.m_iWeaponID = GetWeaponID();
	//	//msgPublicAttr.setWeaponID( m_AttrBackUp.m_iWeaponID );
	//	msgProtectedAttr.setWeaponID( m_AttrBackUp.m_iWeaponID );
	//}

	if( m_AttrBackUp.m_iHorseID != GetHorseID() )
	{
		bPublicAttrModified = TRUE;
		m_AttrBackUp.m_iHorseID = GetHorseID();
		msgPublicAttr.setMountID( m_AttrBackUp.m_iHorseID );
		msgProtectedAttr.setMountID( m_AttrBackUp.m_iHorseID );
	}

	if ( bPublicAttrModified )
	{
		if ( bPublicAttrModified )
		{
			m_PublicAttrVersion++;
		}

		if ( bPublicAttrModified || m_ProtectedAttrVersion )
		{
			m_ProtectedAttrVersion++;
		}

		HUMANLIST listHuman;
		getScene()->ScanHuman( getZoneID(), MAX_REFESH_OBJ_ZONE_RADIUS, &(listHuman) );

		BOOL bSendPublicMsg				= bPublicAttrModified;
		BOOL bSendProtectedMsg			= (BOOL)(bPublicAttrModified || m_ProtectedAttrVersion);
		BYTE i;
		for ( i = 0; i < listHuman.m_Count; i++ )
		{
			Obj_Human *pTargetHuman = listHuman.m_aHuman[i];
			if ( IsCanViewMe( pTargetHuman ) )
			{
				ENUM_REFESH_ATTR_TYPE eType = CalcRefeshAttrType( this, pTargetHuman );
				switch( eType )
				{
				case REFESH_ATTR_TYPE_NONE:
					break;
				case REFESH_ATTR_TYPE_PUBLIC:
				case REFESH_ATTR_TYPE_PUBLIC_AND_LEVEL:
					if ( bSendPublicMsg )
					{
						pTargetHuman->GetPlayer()->SendPacket( &msgPublicAttr );
					}
					break;
				case REFESH_ATTR_TYPE_PROTECTED:
					if ( bSendProtectedMsg )
					{
						pTargetHuman->GetPlayer()->SendPacket( &msgProtectedAttr );
					}
					break;
				default:
					break;
				}
			}
		}
	}

__LEAVE_FUNCTION
}