BAndysc / BAndysc/WoWDatabaseEditor

[Feature] Unused fields in conditions should be zero

Open
#153 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C#
Stars
564
Forks
169
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**
When first creating a quest state condition (e.g. for phase_area) with flags 2|8 and then changing the exact same condition to objective complete and generate SQL the generated data will contain the 2|8 in ConditionValue2 from the previous condition.

**Describe the solution you'd like**
Zero all unused fields of the used condition on sql generation

**Additional context**
Setting initial conditions
![image](https://user-images.githubusercontent.com/12143653/183955111-0e8f5229-51c9-459b-91f5-601bcdb78657.png)
Changing condition type
![image](https://user-images.githubusercontent.com/12143653/183955258-0897375f-fa9c-4747-a20b-6085c188e80c.png)
Generating sql results in
```sql
DELETE FROM `conditions` WHERE (`SourceTypeOrReferenceId` = 26) AND (`SourceEntry` IN (493));
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `Comment`) VALUES
(26, 5950, 493, 0, 0, 48, 0, 12341234, 10, 0, 0, 'Player has completed objective 12341234 (but hasn\'t rewarded quest yet)');
```
(Notice the 10 for ConditionValue2)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing SQL generation for quest state conditions from the condition editor, using the reported transition from phase_area to objective complete as the reproduction case. Ensure generated INSERT data sets fields unused by the selected condition to zero, and verify the output no longer preserves the previous ConditionValue2 value.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, sql
Domain
databases, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.