Skip to content

Commit

Permalink
Fixed Allow Gunner bug and added Neset armor to advanced search
Browse files Browse the repository at this point in the history
  • Loading branch information
AthenaADP committed Sep 30, 2018
1 parent 9c67fb5 commit 3760698
Show file tree
Hide file tree
Showing 19 changed files with 116 additions and 38 deletions.
2 changes: 1 addition & 1 deletion About.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ using namespace System::Data;
using namespace System::Drawing;


namespace MHXXASS {
namespace MHGUASS {

public ref class About : public System::Windows::Forms::Form
{
Expand Down
28 changes: 24 additions & 4 deletions Advanced.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;

namespace MHXXASS {
namespace MHGUASS {

public ref class Advanced : public System::Windows::Forms::Form
{
Expand All @@ -25,13 +25,15 @@ namespace MHXXASS {
const static Color color_default = Color::Black;
const static Color color_enabled = Color::Green;
const static Color color_disabled = Color::Gray;
bool manual_checking, want_taunt;
bool manual_checking, want_taunt, checking_neset;
public:

#pragma warning( disable : 4677 )
Advanced( Query^ query )
{
manual_checking = false;
checking_neset = false;

want_taunt = query->want_taunt;
InitializeComponent();
this->query = query;
Expand Down Expand Up @@ -743,6 +745,23 @@ namespace MHXXASS {
RecheckDefaultItems( sender );

manual_checking = true;

if( !checking_neset && op->is_armor && safe_cast<Armor^>( op )->charm_up )
UpdateNesetArmor( op->force_disable );
}

System::Void UpdateNesetArmor( const bool disabled )
{
checking_neset = true;

for( int i = 0; i < int( Armor::ArmorType::NumArmorTypes ); ++i )
{
ListView^ lv = boxes[ i ];
ListViewItem^ item = lv->Items[ lv->Items->Count - 1 ];
item->Checked = !disabled;
}

checking_neset = false;
}

System::Void contextMenuStrip1_Opening(System::Object^ sender, System::ComponentModel::CancelEventArgs^ e)
Expand All @@ -757,11 +776,12 @@ namespace MHXXASS {
else
{
List_t< Armor^ > preview_armors;
for( unsigned i = 0; i < 5; ++i )
for( unsigned i = 0; i < unsigned( Armor::ArmorType::NumArmorTypes ); ++i )
{
if( boxes[ i ]->Focused && boxes[ i ]->SelectedIndices->Count == 1 )
{
Armor^ armor = query->inf_armor[ i ][ boxes[ i ]->SelectedIndices[ 0 ] ];
List_t< Armor^ >^ inf_armor = query->inf_armor[ i ];
Armor^ armor = inf_armor[ boxes[ i ]->SelectedIndices[ 0 ] ];
Utility::UpdateContextMenu( contextMenuStrip1, armor );
e->Cancel = false;

Expand Down
4 changes: 3 additions & 1 deletion Armor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ void Armor::Load( String^ filename, ArmorType armor_type )
armor->gender = split[ data_start ] == L"1" ? Gender::MALE : split[ data_start ] == L"2" ? Gender::FEMALE : Gender::BOTH_GENDERS;
armor->type = split[ data_start + 1 ] == L"1" ? HunterType::BLADEMASTER : split[ data_start + 1 ] == L"2" ? HunterType::GUNNER : HunterType::BOTH_TYPES;
armor->rarity = split[ data_start + 2 ] == L"X" ? 11 : Convert::ToInt32( split[ data_start + 2 ] );
armor->is_helm = armor_type == ArmorType::HEAD;
armor->is_event = false;
armor->is_armor = true;

armor->num_slots = ConvertNum( split[ data_start + 3 ] );

Expand Down Expand Up @@ -269,7 +271,7 @@ bool Armor::MatchesQuery( Query^ query, List_t< Ability^ >^ danger_skills, const
!query->allow_event && this->is_event ||
!query->allow_japs && this->jap_only ||
query->allow_japs && this->nonjap ||
!query->allow_gunner_helms && this->gunner_def ||
!query->allow_gunner_helms && this->gunner_def && this->is_helm ||
!query->allow_lower_tier && !relic && GetTier( this ) < GetTier( query->hr, this->elder_star ) ||
type != HunterType::BOTH_TYPES && query->hunter_type != type ||
gender != Gender::BOTH_GENDERS && gender != query->gender && !(jap_genders_only && !query->allow_japs) ||
Expand Down
2 changes: 1 addition & 1 deletion Armor.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ref struct Armor : public AdvancedSearchOptions
int ice_res, water_res, fire_res, thunder_res, dragon_res;
Gender gender;
HunterType type;
bool torso_inc, no_skills, is_event, jap_only, arena, chakra, jap_genders_only, nonjap, relic, gunner_def, hr_or, charm_up;
bool torso_inc, no_skills, is_event, jap_only, arena, chakra, jap_genders_only, nonjap, relic, gunner_def, hr_or, charm_up, is_helm;
Ability^ danger;
List_t< AbilityPair^ > abilities;
List_t< MaterialComponent^ > components;
Expand Down
2 changes: 1 addition & 1 deletion Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ref struct Skill;

ref struct AdvancedSearchOptions abstract
{
bool force_enable, force_disable, default_piece;
bool force_enable, force_disable, default_piece, is_armor;
unsigned adv_index;
};

Expand Down
Binary file modified Decoration.cpp
Binary file not shown.
2 changes: 1 addition & 1 deletion Find.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ using namespace System::Data;
using namespace System::Drawing;


namespace MHXXASS {
namespace MHGUASS {

public ref class Find : public System::Windows::Forms::Form
{
Expand Down
93 changes: 73 additions & 20 deletions Form1.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "NumericUpDownHR.h"
#include "PreviewImage.h"

namespace MHXXASS
namespace MHGUASS
{
using namespace System;
using namespace System::ComponentModel;
Expand Down Expand Up @@ -131,8 +131,8 @@ namespace MHXXASS
private: System::Windows::Forms::TabPage^ tabGunner;
private: System::Windows::Forms::GroupBox^ grpGSkillFilters;
private: System::Windows::Forms::GroupBox^ grpGSkills;
private: MHXXASS::NumericUpDownHR^ nudHR;
private: MHXXASS::NumericUpDownVE^ nudElder;
private: MHGUASS::NumericUpDownHR^ nudHR;
private: MHGUASS::NumericUpDownVE^ nudElder;
private: System::Windows::Forms::NumericUpDown^ nudWeaponSlots;
private: System::Windows::Forms::GroupBox^ groupBox1;
private: System::Windows::Forms::Label^ lblHR;
Expand Down Expand Up @@ -831,12 +831,20 @@ namespace MHXXASS
fout.WriteLine( bSkillFilters[ i ]->SelectedIndex );
if( bSkills[ i ]->SelectedIndex <= 0 )
fout.WriteLine( -1 );
else fout.WriteLine( bIndexMaps[ i ][ bSkills[ i ]->SelectedIndex ] );
else
{
Map_t< unsigned, unsigned >^ imap = bIndexMaps[ i ];
fout.WriteLine( imap[ bSkills[ i ]->SelectedIndex ] );
}

fout.WriteLine( gSkillFilters[ i ]->SelectedIndex );
if( gSkills[ i ]->SelectedIndex <= 0 )
fout.WriteLine( -1 );
else fout.WriteLine( gIndexMaps[ i ][ gSkills[ i ]->SelectedIndex ] );
else
{
Map_t< unsigned, unsigned >^ imap = gIndexMaps[ i ];
fout.WriteLine( imap[ gSkills[ i ]->SelectedIndex ] );
}
}

const unsigned num_searched_skills = query ? query->skills.Count : 0;
Expand Down Expand Up @@ -955,8 +963,8 @@ namespace MHXXASS
this->nudWeaponSlots = ( gcnew System::Windows::Forms::NumericUpDown() );
this->lblElder = ( gcnew System::Windows::Forms::Label() );
this->lblSlots = ( gcnew System::Windows::Forms::Label() );
this->nudHR = ( gcnew MHXXASS::NumericUpDownHR() );
this->nudElder = ( gcnew MHXXASS::NumericUpDownVE() );
this->nudHR = ( gcnew MHGUASS::NumericUpDownHR() );
this->nudElder = ( gcnew MHGUASS::NumericUpDownVE() );
this->lblHR = ( gcnew System::Windows::Forms::Label() );
this->grpBSkills = ( gcnew System::Windows::Forms::GroupBox() );
this->btnSearch = ( gcnew System::Windows::Forms::Button() );
Expand Down Expand Up @@ -1727,6 +1735,7 @@ namespace MHXXASS
query->allow_lower_tier = mnuAllowLowerTierArmor->Checked;
query->add_extra = mnuSpendSpareSlots->Checked;
query->allow_gunner_helms = mnuAllowGunnerHelms->Checked;
query->neset_disabled = false;

query->want_taunt = false;
for each( Skill^ s in skills )
Expand All @@ -1747,14 +1756,24 @@ namespace MHXXASS
if( !use_gunner_skills )
{
for( unsigned i = 0; i < NumSkills; ++i )
{
if( bSkills[ i ]->SelectedIndex >= 0 )
skills.Add( data->FindSkill( bIndexMaps[ i ][ bSkills[ i ]->SelectedIndex ] ) );
{
Map_t< unsigned, unsigned >^ imap = bIndexMaps[ i ];
skills.Add( data->FindSkill( imap[ bSkills[ i ]->SelectedIndex ] ) );
}
}
}
else
{
for( unsigned i = 0; i < NumSkills; ++i )
{
if( gSkills[ i ]->SelectedIndex >= 0 )
skills.Add( data->FindSkill( gIndexMaps[ i ][ gSkills[ i ]->SelectedIndex ] ) );
{
Map_t< unsigned, unsigned >^ imap = gIndexMaps[ i ];
skills.Add( data->FindSkill( imap[ gSkills[ i ]->SelectedIndex ] ) );
}
}
}

FormulateQuery( danger, use_gunner_skills, %skills );
Expand Down Expand Up @@ -1828,6 +1847,9 @@ namespace MHXXASS

System::Void QueueTask2( Query^ query, List_t< Charm^ >^ cts )
{
if( query->neset_disabled )
return;

BackgroundWorker^ new_thread = gcnew BackgroundWorker;
new_thread->WorkerSupportsCancellation = true;
new_thread->WorkerReportsProgress = true;
Expand Down Expand Up @@ -1946,14 +1968,14 @@ namespace MHXXASS

if( !to_search || to_search->Count == 0 )
{
if( query->hr >= 13 )
if( query->AllowNesetArmor() )
QueueTask2( query, nullptr );

QueueTask( query, nullptr );
}
else
{
if( query->hr >= 13 )
if( query->AllowNesetArmor() )
QueueTask2( query, to_search );

for each( Charm^ ct in to_search )
Expand All @@ -1968,9 +1990,20 @@ namespace MHXXASS

System::Void btnAdvancedSearch_Click( System::Object^ sender, System::EventArgs^ e )
{
//updatedata();
//return;
FormulateQuery( true, tabHunterType->SelectedIndex == 1 );

array< Armor^ >^ neset_armors = query->hunter_type == HunterType::GUNNER ? Armor::charm_up_armors_g : Armor::charm_up_armors_b;
Assert( neset_armors->Length == int( Armor::ArmorType::NumArmorTypes ), L"Wrong number of Neset armors" );

if( query->AllowNesetArmor() )
{
for( int i = 0; i < neset_armors->Length; ++i )
{
query->rel_armor[ i ]->Add( neset_armors[ i ] );
query->inf_armor[ i ]->Add( neset_armors[ i ] );
}
}

Advanced advanced_search( query );
advanced_search.Width = adv_x;
advanced_search.Height = adv_y;
Expand All @@ -1983,13 +2016,28 @@ namespace MHXXASS
if( advanced_search.DialogResult != System::Windows::Forms::DialogResult::OK )
return;

if( query->AllowNesetArmor() )
{
query->neset_disabled = false;
for( int i = 0; i < neset_armors->Length; ++i )
{
if( neset_armors[ i ]->force_disable )
{
query->neset_disabled = true;
break;
}
}
}

for( int p = 0; p < int( Armor::ArmorType::NumArmorTypes ); ++p )
{
query->rel_armor[ p ]->Clear();
for( int i = 0; i < query->inf_armor[ p ]->Count; ++i )
List_t< Armor^ >^ inf_armor = query->inf_armor[ p ];
inf_armor->Remove( neset_armors[ p ] );
for( int i = 0; i < inf_armor->Count; ++i )
{
if( advanced_search.boxes[ p ]->Items[ i ]->Checked )
query->rel_armor[ p ]->Add( query->inf_armor[ p ][ i ] );
query->rel_armor[ p ]->Add( inf_armor[ i ] );
}
}
query->rel_decorations.Clear();
Expand Down Expand Up @@ -2031,7 +2079,8 @@ namespace MHXXASS
if( skills[ i ]->SelectedIndex < 1 )
continue;

Skill^ skill = Skill::static_skills[ index_maps[ i ][ skills[ i ]->SelectedIndex ] ];
Map_t< unsigned, unsigned >^ imap = index_maps[ i ];
Skill^ skill = Skill::static_skills[ imap[ skills[ i ]->SelectedIndex ] ];
if( sender == skill_filters[ i ] )
selected_skill = skill;
else old_skills.Add( skill->ability );
Expand Down Expand Up @@ -2083,7 +2132,8 @@ namespace MHXXASS
}
else
{
selected_skill = Skill::static_skills[ index_maps[ index ][ skills[ index ]->SelectedIndex ] ];
Map_t< unsigned, unsigned >^ imap = index_maps[ index ];
selected_skill = Skill::static_skills[ imap[ skills[ index ]->SelectedIndex ] ];

//if( last_abilities[ index ] == selected_skill->ability )
// return;
Expand All @@ -2108,14 +2158,16 @@ namespace MHXXASS
if( i == index && skill_filters[ i ]->SelectedIndex != 2 )
continue;

Skill^ skill = skills[ i ]->SelectedIndex <= 0 ? nullptr : Skill::static_skills[ index_maps[ i ][ skills[ i ]->SelectedIndex ] ];
Map_t< unsigned, unsigned >^ imap = index_maps[ i ];
Skill^ skill = skills[ i ]->SelectedIndex <= 0 ? nullptr : Skill::static_skills[ imap[ skills[ i ]->SelectedIndex ] ];
List_t< Ability^ > old_skills;
for( int j = 0; j < NumSkills; ++j )
{
if( skills[ j ]->SelectedIndex <= 0 )
continue;

Skill^ os = Skill::static_skills[ index_maps[ j ][ skills[ j ]->SelectedIndex ] ];
Map_t< unsigned, unsigned >^ jmap = index_maps[ j ];
Skill^ os = Skill::static_skills[ jmap[ skills[ j ]->SelectedIndex ] ];
if( j != i )
old_skills.Add( os->ability );

Expand All @@ -2134,7 +2186,8 @@ namespace MHXXASS
//check compound skills aren't overlapping their component skills
for( int i = 0; i < NumSkills; ++i )
{
Skill^ skill = skills[ i ]->SelectedIndex <= 0 ? nullptr : Skill::static_skills[ index_maps[ i ][ skills[ i ]->SelectedIndex ] ];
Map_t< unsigned, unsigned >^ imap = index_maps[ i ];
Skill^ skill = skills[ i ]->SelectedIndex <= 0 ? nullptr : Skill::static_skills[ imap[ skills[ i ]->SelectedIndex ] ];
if( i != index && skill && selected_skill )
{
if( Skill::CompoundSkillOverrides( skill, selected_skill ) ||
Expand Down
2 changes: 1 addition & 1 deletion ImportCharms.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ using namespace System::Data;
using namespace System::Drawing;


namespace MHXXASS {
namespace MHGUASS {

public ref class ImportCharms : public System::Windows::Forms::Form
{
Expand Down
2 changes: 1 addition & 1 deletion LoadedData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void AddToList( List_t< Decoration^ >^ list, Decoration^ item, List_t< Ability^

void AddToList( List_t< Armor^ >^ list, Armor^ armor, List_t< Ability^ >^ rel_abilities, List_t< Armor^ >^ inf_armor, const bool adv, const bool want_taunt )
{
if( adv && armor->force_disable )
if( adv && ( armor->force_disable || armor->charm_up ) )
return;

const bool may_remove_self = !adv || !armor->force_enable;
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion MHXX ASS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "stdafx.h"
#include "Form1.h"

using namespace MHXXASS;
using namespace MHGUASS;

[STAThreadAttribute]
int main(array<System::String ^> ^args)
Expand Down
3 changes: 2 additions & 1 deletion MHXX ASS.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{A81954DD-AC39-4BA0-89B7-209D242373BF}</ProjectGuid>
<RootNamespace>MHXXASS</RootNamespace>
<RootNamespace>MHGUASS</RootNamespace>
<Keyword>ManagedCProj</Keyword>
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
<TargetFrameworkVersion>4.5</TargetFrameworkVersion>
<ProjectName>MHGU ASS</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
Expand Down
2 changes: 1 addition & 1 deletion ManageCharms.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ using namespace System::Drawing;

#pragma warning( disable: 4677 ) //warning for passing my own class into this form

namespace MHXXASS {
namespace MHGUASS {

public ref class ManageCharms : public System::Windows::Forms::Form
{
Expand Down
Binary file modified NumericUpDownHR.h
Binary file not shown.
2 changes: 1 addition & 1 deletion PreviewImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ using namespace System::Data;
using namespace System::Drawing;


namespace MHXXASS
namespace MHGUASS
{

public ref class PreviewImage : public System::Windows::Forms::Form
Expand Down
Loading

0 comments on commit 3760698

Please sign in to comment.