Skip to content

Commit

Permalink
Add support for newest conditions.
Browse files Browse the repository at this point in the history
  • Loading branch information
brotalnia committed Mar 20, 2021
1 parent 86432bf commit cd11bc9
Show file tree
Hide file tree
Showing 28 changed files with 975 additions and 99 deletions.
2 changes: 1 addition & 1 deletion ScriptEditor/DataFinderForms/FormAreaFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected override void AddByText(string searchText)
{
foreach (AreaInfo area in GameData.AreaInfoList)
{
if (area.Name.Contains(searchText))
if (area.Name.ToUpper().Contains(searchText))
AddAreaToListView(area);
}
}
Expand Down
40 changes: 20 additions & 20 deletions ScriptEditor/DataFinderForms/FormConditionFinder.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

102 changes: 69 additions & 33 deletions ScriptEditor/DataFinderForms/FormConditionFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,9 @@ private void ShowConditionSpecificForm(ConditionInfo selectedCondition)
lblConditionNotCondition.Text = "Condition Id:";
lblConditionNotCondition.Visible = true;
btnConditionNotCondition1.Visible = true;
uint conditionId1 = selectedCondition.Value1;
int conditionId1 = selectedCondition.Value1;
if (conditionId1 > 0)
btnConditionNotCondition1.Text = conditionId1.ToString() + " - " + GameData.FindConditionName(conditionId1);
btnConditionNotCondition1.Text = conditionId1.ToString() + " - " + GameData.FindConditionName((uint)conditionId1);
frmConditionNot.Visible = true;
break;
}
Expand All @@ -300,18 +300,18 @@ private void ShowConditionSpecificForm(ConditionInfo selectedCondition)
}
}

uint conditionId1 = selectedCondition.Value1;
int conditionId1 = selectedCondition.Value1;
if (conditionId1 > 0)
btnConditionAndCondition1.Text = conditionId1.ToString() + " - " + GameData.FindConditionName(conditionId1);
uint conditionId2 = selectedCondition.Value2;
btnConditionAndCondition1.Text = conditionId1.ToString() + " - " + GameData.FindConditionName((uint)conditionId1);
int conditionId2 = selectedCondition.Value2;
if (conditionId2 > 0)
btnConditionAndCondition2.Text = conditionId2.ToString() + " - " + GameData.FindConditionName(conditionId2);
uint conditionId3 = selectedCondition.Value3;
btnConditionAndCondition2.Text = conditionId2.ToString() + " - " + GameData.FindConditionName((uint)conditionId2);
int conditionId3 = selectedCondition.Value3;
if (conditionId3 > 0)
btnConditionAndCondition3.Text = conditionId3.ToString() + " - " + GameData.FindConditionName(conditionId3);
uint conditionId4 = selectedCondition.Value4;
btnConditionAndCondition3.Text = conditionId3.ToString() + " - " + GameData.FindConditionName((uint)conditionId3);
int conditionId4 = selectedCondition.Value4;
if (conditionId4 > 0)
btnConditionAndCondition4.Text = conditionId4.ToString() + " - " + GameData.FindConditionName(conditionId4);
btnConditionAndCondition4.Text = conditionId4.ToString() + " - " + GameData.FindConditionName((uint)conditionId4);

frmConditionAnd.Visible = true;
break;
Expand Down Expand Up @@ -410,9 +410,9 @@ private void ShowConditionSpecificForm(ConditionInfo selectedCondition)
}
}

uint spellId = selectedCondition.Value1;
int spellId = selectedCondition.Value1;
if (spellId > 0)
btnAuraSpellId.Text = GameData.FindSpellName(spellId) + " (" + spellId.ToString() + ")";
btnAuraSpellId.Text = GameData.FindSpellName((uint)spellId) + " (" + spellId.ToString() + ")";
txtAuraEffectIndex.Text = selectedCondition.Value2.ToString();
frmConditionAura.Visible = true;
break;
Expand Down Expand Up @@ -447,18 +447,18 @@ private void ShowConditionSpecificForm(ConditionInfo selectedCondition)
break;
}
}
uint itemId = selectedCondition.Value1;
int itemId = selectedCondition.Value1;
if (itemId > 0)
btnItemId.Text = GameData.FindItemName(itemId) + " (" + itemId.ToString() + ")";
btnItemId.Text = GameData.FindItemName((uint)itemId) + " (" + itemId.ToString() + ")";
txtItemCount.Text = selectedCondition.Value2.ToString();
frmConditionItem.Visible = true;
break;
}
case 4: // CONDITION_AREAID
{
uint areaId = selectedCondition.Value1;
int areaId = selectedCondition.Value1;
if (areaId > 0)
btnAreaId.Text = GameData.FindAreaName(areaId) + " (" + areaId.ToString() + ")";
btnAreaId.Text = GameData.FindAreaName((uint)areaId) + " (" + areaId.ToString() + ")";
frmConditionArea.Visible = true;
break;
}
Expand All @@ -479,9 +479,9 @@ private void ShowConditionSpecificForm(ConditionInfo selectedCondition)
}
}

uint factionId = selectedCondition.Value1;
int factionId = selectedCondition.Value1;
if (factionId > 0)
btnReputationFactionId.Text = GameData.FindFactionName(factionId) + " (" + factionId.ToString() + ")";
btnReputationFactionId.Text = GameData.FindFactionName((uint)factionId) + " (" + factionId.ToString() + ")";
cmbReputationRank.SelectedIndex = (int)selectedCondition.Value2;
frmConditionReputation.Visible = true;
break;
Expand Down Expand Up @@ -608,9 +608,9 @@ private void ShowConditionSpecificForm(ConditionInfo selectedCondition)
break;
}
}
uint questId = selectedCondition.Value1;
int questId = selectedCondition.Value1;
if (questId > 0)
btnQuestId.Text = GameData.FindQuestTitle(questId) + " (" + questId.ToString() + ")";
btnQuestId.Text = GameData.FindQuestTitle((uint)questId) + " (" + questId.ToString() + ")";
frmConditionQuest.Visible = true;
break;
}
Expand Down Expand Up @@ -721,16 +721,16 @@ private void ShowConditionSpecificForm(ConditionInfo selectedCondition)
}
case 12: // CONDITION_ACTIVE_GAME_EVENT
{
uint eventId = selectedCondition.Value1;
int eventId = selectedCondition.Value1;
if (eventId > 0)
btnGameEventId.Text = GameData.FindEventName(eventId) + " (" + eventId.ToString() + ")";
btnGameEventId.Text = GameData.FindEventName((uint)eventId) + " (" + eventId.ToString() + ")";
frmConditionGameEvent.Visible = true;
break;
}
case 14: // CONDITION_RACE_CLASS
{
btnRaceMask.Text = GetRaceNamesFromMask(selectedCondition.Value1);
btnClassMask.Text = GetClassNamesFromMask(selectedCondition.Value2);
btnRaceMask.Text = GetRaceNamesFromMask((uint)selectedCondition.Value1);
btnClassMask.Text = GetClassNamesFromMask((uint)selectedCondition.Value2);
frmConditionRaceClass.Visible = true;
break;
}
Expand All @@ -743,9 +743,9 @@ private void ShowConditionSpecificForm(ConditionInfo selectedCondition)
}
case 20: // CONDITION_NEARBY_CREATURE
{
uint creatureId = selectedCondition.Value1;
int creatureId = selectedCondition.Value1;
if (creatureId > 0)
btnNearbyCreatureId.Text = GameData.FindCreatureName(creatureId) + " (" + creatureId.ToString() + ")";
btnNearbyCreatureId.Text = GameData.FindCreatureName((uint)creatureId) + " (" + creatureId.ToString() + ")";
txtNearbyCreatureDistance.Text = selectedCondition.Value2.ToString();
cmbNearbyCreatureDead.SelectedIndex = (int)selectedCondition.Value3;
cmbNearbyCreatureNotSelf.SelectedIndex = (int)selectedCondition.Value4;
Expand All @@ -754,9 +754,9 @@ private void ShowConditionSpecificForm(ConditionInfo selectedCondition)
}
case 21: // CONDITION_NEARBY_GAMEOBJECT
{
uint objectId = selectedCondition.Value1;
int objectId = selectedCondition.Value1;
if (objectId > 0)
btnNearbyObjectId.Text = GameData.FindGameObjectName(objectId) + " (" + objectId.ToString() + ")";
btnNearbyObjectId.Text = GameData.FindGameObjectName((uint)objectId) + " (" + objectId.ToString() + ")";
txtNearbyObjectDistance.Text = selectedCondition.Value2.ToString();
frmConditionNearbyObject.Visible = true;
break;
Expand Down Expand Up @@ -814,14 +814,38 @@ private void ShowConditionSpecificForm(ConditionInfo selectedCondition)
}
}
txtMapEventTargetsEventId.Text = selectedCondition.Value1.ToString();
uint conditionId = selectedCondition.Value2;
int conditionId = selectedCondition.Value2;
if (conditionId > 0)
btnMapEventTargetsConditionId.Text = conditionId.ToString() + " - " + GameData.FindConditionName(conditionId);
btnMapEventTargetsConditionId.Text = conditionId.ToString() + " - " + GameData.FindConditionName((uint)conditionId);
frmConditionMapEventTargets.Visible = true;
break;
}
case 52: // CONDITION_DB_GUID
case 54: // CONDITION_DISTANCE_TO_POSITION
{
switch (selectedCondition.Type)
{
case 52: // CONDITION_DB_GUID
{
lblConditionDbGuidTooltip.Text = "Returns true if the source object\'s database guid matches any of the ones specified.";
lblConditionDbGuid1.Text = "GUID 1:";
lblConditionDbGuid2.Text = "GUID 2:";
lblConditionDbGuid3.Text = "GUID 3:";
lblConditionDbGuid4.Text = "GUID 4:";

break;
}
case 54: // CONDITION_DISTANCE_TO_POSITION
{
lblConditionDbGuidTooltip.Text = "Returns true if the target object is within a given distance of the coordinates.";
lblConditionDbGuid1.Text = "X:";
lblConditionDbGuid2.Text = "Y:";
lblConditionDbGuid3.Text = "Z:";
lblConditionDbGuid4.Text = "Distance:";
break;
}
}

txtConditionDbGuid1.Text = selectedCondition.Value1.ToString();
txtConditionDbGuid2.Text = selectedCondition.Value2.ToString();
txtConditionDbGuid3.Text = selectedCondition.Value3.ToString();
Expand Down Expand Up @@ -918,7 +942,7 @@ protected override void AddByText(string searchText)

foreach (ConditionInfo condition in GameData.ConditionInfoList)
{
if (GameData.FindConditionTypeName(condition.Type).Contains(searchText))
if (GameData.FindConditionTypeName(condition.Type).ToUpper().Contains(searchText))
AddConditionToListView(condition);
}
}
Expand Down Expand Up @@ -1015,7 +1039,18 @@ private void lstData_SelectedIndexChanged(object sender, EventArgs e)
ListViewItem selectedItem = lstData.SelectedItems[0];
ConditionInfo selectedCondition = (ConditionInfo)selectedItem.Tag;

cmbConditionType.SelectedIndex = selectedCondition.Type + 3;
int conditionIndex = -1;
foreach (var item in cmbConditionType.Items)
{
ComboboxPair conditionTypePair = item as ComboboxPair;
if (conditionTypePair.Value == selectedCondition.Type)
{
conditionIndex = cmbConditionType.Items.IndexOf(item);
break;
}
}

cmbConditionType.SelectedIndex = conditionIndex;
cmbConditionType.Enabled = true;

txtConditionId.Text = selectedCondition.ID.ToString();
Expand Down Expand Up @@ -1046,7 +1081,8 @@ private void cmbConditionType_SelectedIndexChanged(object sender, EventArgs e)
// Get the associated ConditionInfo.
ConditionInfo currentCondition = (ConditionInfo)currentItem.Tag;

currentCondition.Type = cmbConditionType.SelectedIndex - 3;
ComboboxPair selectedType = cmbConditionType.SelectedItem as ComboboxPair;
currentCondition.Type = selectedType.Value;
currentCondition.Value1 = 0;
currentCondition.Value2 = 0;
currentCondition.Value3 = 0;
Expand Down
2 changes: 1 addition & 1 deletion ScriptEditor/DataFinderForms/FormCreatureFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected override void AddByText(string searchText)
{
foreach (CreatureInfo creature in GameData.CreatureInfoList)
{
if (creature.Name.Contains(searchText))
if (creature.Name.ToUpper().Contains(searchText))
AddCreatureToListView(creature);
}
}
Expand Down
2 changes: 1 addition & 1 deletion ScriptEditor/DataFinderForms/FormDataFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private void btnSearch_Click(object sender, EventArgs e)
}
else // Add items that contain this text.
{
AddByText(txtSearch.Text);
AddByText(txtSearch.Text.ToUpper());
lstData.ListViewItemSorter = textComparer;
}
}
Expand Down
2 changes: 1 addition & 1 deletion ScriptEditor/DataFinderForms/FormEventFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected override void AddByText(string searchText)
{
foreach (GameEventInfo game_event in GameData.GameEventInfoList)
{
if (game_event.Name.Contains(searchText))
if (game_event.Name.ToUpper().Contains(searchText))
AddGameEventToListView(game_event);
}
}
Expand Down
2 changes: 1 addition & 1 deletion ScriptEditor/DataFinderForms/FormFactionFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected override void AddByText(string searchText)
{
foreach (FactionInfo faction in GameData.FactionInfoList)
{
if (faction.Name.Contains(searchText))
if (faction.Name.ToUpper().Contains(searchText))
AddFactionToListView(faction);
}
}
Expand Down
2 changes: 1 addition & 1 deletion ScriptEditor/DataFinderForms/FormFactionTemplateFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected override void AddByText(string searchText)
{
foreach (FactionTemplateInfo faction in GameData.FactionTemplateInfoList)
{
if (GameData.FindFactionName(faction.FactionId).Contains(searchText))
if (GameData.FindFactionName(faction.FactionId).ToUpper().Contains(searchText))
AddFactionToListView(faction);
}
}
Expand Down
2 changes: 1 addition & 1 deletion ScriptEditor/DataFinderForms/FormGameObjectFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected override void AddByText(string searchText)
{
foreach (GameObjectInfo gameobject in GameData.GameObjectInfoList)
{
if (gameobject.Name.Contains(searchText))
if (gameobject.Name.ToUpper().Contains(searchText))
AddGameObjectToListView(gameobject);
}
}
Expand Down
2 changes: 1 addition & 1 deletion ScriptEditor/DataFinderForms/FormItemFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected override void AddByText(string searchText)
{
foreach (ItemInfo item in GameData.ItemInfoList)
{
if (item.Name.Contains(searchText))
if (item.Name.ToUpper().Contains(searchText))
AddItemToListView(item);
}
}
Expand Down
Loading

0 comments on commit cd11bc9

Please sign in to comment.