Jump to content

[Feature] General Support for Not - Conditions


Schmoozerd

Recommended Posts

Hi guys,

for a AQ-Opening Chain related Gossip (http://www.wowhead.com/quest=8575) I needed a Condition to lookup if a player has a Quest Not-Rewarded,

for Go-Gossip with http://www.wowhead.com/object=142696 I think there would be needed a check whether one has engeneering, but below 160 (not yet entirely sure of menu structure there)

So, I created a patch for generally allowing NOT-conditions for every Condition there is;

implemented by allowing negative conditions, which means NOT -condition

With this Code, it would be possible, to remove the NoAura and NoItem condition.

Atm I have not changed the Event-Ai Condition fields, as this is field has multiple meaning.

patch: (I tested the patch on an older mangos version with gossip_menu and gossip_menu_option and it worked fine.)

for Mangos R 9748

http://paste2.org/p/773698

http://paste2.org/p/773751 (Also with deletion of then unneeded Conditions)

sql-support: (remark, this would do many changes to yours DB, so I cannot recomand testing this :P)

http://paste2.org/p/773708

for Mangos R 9991 (only simple version, untested)

http://paste2.org/p/854423

Any comments are welcome :)

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 weeks later...

thanks for your reply

do you have any pointed lines which are strange? (and if you really had much time also some suggestions in which directions to modify)

It is very hard to see which code is good and bad, because I totally lack the experience (or serious c++ learning)

Link to comment
Share on other sites

It would help if the criticism were more constructive. Simply saying "stupid code" does nothing to solve any issues with said code. Otherwise, how would anyone here grow and learn as a developer if nobody provided feedback that has technical merit?

This does involve some fairly extensive changes and I agree that having input from Vladimir and the other core devs is essential. It just would not be worthwhile to be forced into rewriting major parts of the code if you overlooked something. On the other hand, you've come this far on your own and it's very likely you can complete this code with a bit more research, Schmoozerd.

I'd be a willing tester for this. Compiling one more core patch would be little trouble since I'm in the middle of patching my server's source for an update. If I understand correctly, the second patch does remove the NoAura and NoItem functions? Is this the one you would prefer to have tested? I have no experience with retail so forgive me if I must ask for some information. Which quests would you recommend using as part of the testing, aside from Azuregos' Magical Ledger?

Link to comment
Share on other sites

Great idea.

What is the reason to have Meets and MeetsCondition at same time? Also, replacing enum with int8 looks bad.

The change enum-> int8 was the idea to get the additional information without adding another collumn.

the idea is: negative value means Not Condition, ie -2 means NOT (Condition) 2

that means, if int8 < 0 bIsNotCondition = true;

so, there are I think two ways to check if a (not)condition is Meet:

use a bool result in the function, and at the end use return bIsNotCondition ? !result : result

or my way:

Meets(player) { bIsNotCondition? return !MeetsConditon(player) : MeetsConditon(player) }

and most likely this could be done somehow better with some C++ coding technique

Edit: @UnkleNuke

thanks for your suggested help, but this patch needs absolutely no testing;

there is a possible conflict with Acid (but this is minor)

and there are style problems.

And the discussion whether this direction is ok -

I even wouldn't know if (if accepted) such SQL-Update Statements would be delivered with mangos

Link to comment
Share on other sites

I would think most of the SQL portion to be handled by MaNGOS rather than, say, UDB. The reason being that some tables, especially the templates, are not touched by the database developer groups.

I was looking forward to trying this one, but I will instead heed your warning and wait patiently for the completed code.

Link to comment
Share on other sites

ok, in this case: (present switch to generic NOT-conditions, no deletion of old ones yet)

http://paste2.org/p/854423

this patch changes the Loot Conditions to allow generic Not-Conditions.

To fully test it, modify the columns in the related databases (iE Gossip) such that condition type is signed.

With these sql-statements you won't use the NoAura or NoItem Conditions any more (for gossips)

but you can play with any condition you want

-- NoAura (11) to NOT Aura (-1)
UPDATE gossip_menu SET cond_1= -1 WHERE cond_1 = 11;
UPDATE gossip_menu SET cond_2= -1 WHERE cond_2 = 11;

UPDATE gossip_menu_option SET cond_1= -1 WHERE cond_1 = 11;
UPDATE gossip_menu_option SET cond_2= -1 WHERE cond_2 = 11;
UPDATE gossip_menu_option SET cond_3= -1 WHERE cond_3 = 11;

-- NoItem (16) to NOT Item (-2)
UPDATE gossip_menu SET cond_1= -2 WHERE cond_1 = 16;
UPDATE gossip_menu SET cond_2= -2 WHERE cond_2 = 16;

To restore your DB just change -2 -> 16 and -1 -> 11

Link to comment
Share on other sites

  • 1 year later...

why cleaning?

This was a suggested feature - no patch that could be rejected or accepted - hence it is still valid, and might be interesting.

From current view this generic NOT support did not come through, mainly because for many conditons a NOT would be "stupid" - and for others direct not-x conditons where already added since this patch was created.

So - in continuouity of this style - it is likely to add individual non-x conditions if required.

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use