Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tips and tricks for gossip migration to SAI #2

Open
aletson opened this issue Jan 3, 2016 · 28 comments
Open

Tips and tricks for gossip migration to SAI #2

aletson opened this issue Jan 3, 2016 · 28 comments

Comments

@aletson
Copy link
Owner

aletson commented Jan 3, 2016

Per title

@ghost ghost changed the title SAI migration todos Gossip migration from core to SAI or DB ToDo List Jan 3, 2016
@ghost ghost changed the title Gossip migration from core to SAI or DB ToDo List Gossip migration from core scripts to SAI/DB ToDo List Jan 3, 2016
@ghost
Copy link

ghost commented Jan 3, 2016

Just as an example of what I tried starting on, but could not actually find how to change it in the .cpp:
EasternKingdoms/ScarletEnclave/chapter1.cpp:#define GOSSIP_ACCEPT_DUEL

SELECT `entry`,`name`,`Subname`,`ScriptName`,`AIName` FROM `creature_template`
WHERE `ScriptName` = 'npc_death_knight_initiate';
 entry  name                   gossip_menu_id  AIName  ScriptName
------  ---------------------  --------------  ------  -------------------------
 28406  Death Knight Initiate            9765          npc_death_knight_initiate
SELECT * FROM `gossip_menu` WHERE `entry` = 9765;
 entry  text_id  
------  ---------
  9765    13433
SELECT * FROM `npc_text` WHERE `id` = 13433;
   ID  text0_0                                      text0_1                                      BroadcastTextID0   lang0  Probability0   em0_0   em0_1   em0_2   em0_3   em0_4   em0_5  text1_0  text1_1  BroadcastTextID1   lang1  Probability1   em1_0   em1_1   em1_2   em1_3   em1_4   em1_5  text2_0  text2_1  BroadcastTextID2   lang2  Probability2   em2_0   em2_1   em2_2   em2_3   em2_4   em2_5  text3_0  text3_1  BroadcastTextID3   lang3  Probability3   em3_0   em3_1   em3_2   em3_3   em3_4   em3_5  text4_0  text4_1  BroadcastTextID4   lang4  Probability4   em4_0   em4_1   em4_2   em4_3   em4_4   em4_5  text5_0  text5_1  BroadcastTextID5   lang5  Probability5   em5_0   em5_1   em5_2   em5_3   em5_4   em5_5  text6_0  text6_1  BroadcastTextID6   lang6  Probability6   em6_0   em6_1   em6_2   em6_3   em6_4   em6_5  text7_0  text7_1  BroadcastTextID7   lang7  Probability7   em7_0   em7_1   em7_2   em7_3   em7_4   em7_5  VerifiedBuild
------  -------------------------------------------  -------------------------------------------  ----------------  ------  ------------  ------  ------  ------  ------  ------  ------  -------  -------  ----------------  ------  ------------  ------  ------  ------  ------  ------  ------  -------  -------  ----------------  ------  ------------  ------  ------  ------  ------  ------  ------  -------  -------  ----------------  ------  ------------  ------  ------  ------  ------  ------  ------  -------  -------  ----------------  ------  ------------  ------  ------  ------  ------  ------  ------  -------  -------  ----------------  ------  ------------  ------  ------  ------  ------  ------  ------  -------  -------  ----------------  ------  ------------  ------  ------  ------  ------  ------  ------  -------  -------  ----------------  ------  ------------  ------  ------  ------  ------  ------  ------  -------------
 13433  Are you challenging me, $g brother:sister;?  Are you challenging me, $g brother:sister;?             29254       0             1       0     397       0       0       0       0                                   0       0             0       0       0       0       0       0       0                                   0       0             0       0       0       0       0       0       0                                   0       0             0       0       0       0       0       0       0                                   0       0             0       0       0       0       0       0       0                                   0       0             0       0       0       0       0       0       0                                   0       0             0       0       0       0       0       0       0                                   0       0             0       0       0       0       0       0       0          11723

And then the text line from ScarletEnclave/chapter1.cpp:

SELECT * FROM `gossip_menu_option` WHERE `option_text` = "I challenge you, death knight!";
menu_id      id  option_icon  option_text                     OptionBroadcastTextID  option_id  npc_option_npcflag  action_menu_id  action_poi_id  box_coded  box_money  box_text  BoxBroadcastTextID
-------  ------  -----------  ------------------------------  ---------------------  ---------  ------------------  --------------  -------------  ---------  ---------  --------  ------------------
   9765       0            0  I challenge you, death knight!                  29255          1                   1               0              0          0          0                             0

The tool I am lacking at the moment, is to find out how to change

#define GOSSIP_ACCEPT_DUEL      "I challenge you, death knight!"

into a DB reference in the script, but I start to worry that the actual solution could involve going all the way to transform the entire script npc_death_knight_initiate into SAI, which is quite a task. Then again, the NPCs "Death Knight Initiate" in Death's Breach currently don't have a working gossip outside of the quest, although they are flagged as having gossip constantly available, but it does not work to talk to them when not doing the quest Death's Challenge. What I can remember from last year about these NPCs and the quest, is that I managed to turn it over so that they say the funny comments instead of the lines appearing from the player character. The giveaway was that the speech bubble contained $c which would translate into "death knight" ($class) in NPC speech. It is tricky for a player to target an NPC and get a direct NPC creature class flag from the DB.

@aletson
Copy link
Owner Author

aletson commented Jan 3, 2016

Yeah, I figured I'd start with the taxi NPC's. It's a nice intro for me to learn conditions in any case.

I'm not clear on the interaction between the C++ script and SAI (as a general case - are they exclusive?), but would probably need to do something along the lines of condition -

INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
 +(15,9765,0,0,0,9,0,quest_id,0,0,0,0,'','Death Knight Initiate - Show gossip option 0 if player has taken quest ID quest_id');

but then not sure whether it's possible to make changes modularly or whether you'd have to then do everything via SAI.

@ghost
Copy link

ghost commented Jan 4, 2016

First run through and the sniffer didn't pick up the gossip menu for the Initiates. Gonna try again. I miss-understood originally and thought you were looking for multiple sniffs from the DK starting area. When you need specific sniffs for something else let me know.

So I fought around 25 initiates and this is what the sniffer picked up. It did not pick up their gossip menu, so I don't know if that means they do it through C++ as well, or what. Hope this helps.

INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `BroadcastTextID`, `comment`) VALUES
(28406, x, x, 'The Crusade has been marked for death!', 12, 0, 100, 1, 0, 0, 0, 'Death Knight Initiate'),
(28406, x, x, 'You have challenged death itself!', 12, 0, 100, 397, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'The duel will begin in...', 42, 0, 100, 0, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '3...', 42, 0, 100, 0, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '2...', 42, 0, 100, 66, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '1...', 42, 0, 100, 66, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'You''re going down!', 12, 0, 100, 397, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '2...', 42, 0, 100, 0, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '1...', 42, 0, 100, 0, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'Here come the tears...', 12, 0, 100, 397, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '3...', 42, 0, 100, 1, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '2...', 42, 0, 100, 397, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'Remember this day, $n, for it is the day that you will be thoroughly owned.', 12, 0, 100, 397, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'The duel will begin in...', 42, 0, 100, 20, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '2...', 42, 0, 100, 6, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'The duel will begin in...', 42, 0, 100, 1, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '3...', 42, 0, 100, 397, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'I''m going to tear your heart out, cupcake!', 12, 0, 100, 397, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'Here come the tears...', 12, 0, 100, 5, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'The duel will begin in...', 42, 0, 100, 66, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '3...', 42, 0, 100, 66, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '1...', 42, 0, 100, 397, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '2...', 42, 0, 100, 20, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '3...', 42, 0, 100, 274, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '2...', 42, 0, 100, 274, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'At your beck and call, horseman!', 12, 0, 100, 274, 0, 0, 0, 'Death Knight Initiate'),
(28406, x, x, 'You have challenged death itself!', 12, 0, 100, 6, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '3...', 42, 0, 100, 6, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'You''re going down!', 12, 0, 100, 20, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '1...', 42, 0, 100, 274, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'Here come the tears...', 12, 0, 100, 1, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '3...', 42, 0, 100, 20, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '2...', 42, 0, 100, 1, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '1...', 42, 0, 100, 1, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'Don''t make me laugh.', 12, 0, 100, 1, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '1...', 42, 0, 100, 5, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'You''re going down!', 12, 0, 100, 1, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'Suffering to the weak!', 12, 0, 100, 66, 0, 0, 0, 'Death Knight Initiate'),
(28406, x, x, 'I''m going to tear your heart out, cupcake!', 12, 0, 100, 397, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'The duel will begin in...', 42, 0, 100, 1, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '3...', 42, 0, 100, 0, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '2...', 42, 0, 100, 0, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '1...', 42, 0, 100, 0, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'Remember this day, $n, for it is the day that you will be thoroughly owned.', 12, 0, 100, 1, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '3...', 42, 0, 100, 66, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'A dozen will fall before I am slain!', 12, 0, 100, 66, 0, 0, 0, 'Death Knight Initiate'),
(28406, x, x, '2...', 42, 0, 100, 66, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '1...', 42, 0, 100, 1, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'The duel will begin in...', 42, 0, 100, 66, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '2...', 42, 0, 100, 6, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '1...', 42, 0, 100, 6, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'The duel will begin in...', 42, 0, 100, 273, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '3...', 42, 0, 100, 1, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'You have challenged death itself!', 12, 0, 100, 397, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, 'The duel will begin in...', 42, 0, 100, 5, 0, 0, 0, 'Death Knight Initiate to Player'),
(28406, x, x, '2...', 42, 0, 100, 273, 0, 0, 0, 'Death Knight Initiate to Player');

@ghost
Copy link

ghost commented Jan 4, 2016

OK, thanks for the response, @Saben65. I just wondered if those Death Knight Initiates can be spoken to when not on the quest, I haven't been there online since 2011.


If you look at the images I posted in issue TrinityCore#14700 [3.3.5] Core/Scripts: Death's Challenge & The Endless Hunger, you will see that there has been several issues in the TC source related to gossip or NPC text in the DK starting area. My PR, which is not perfect, solved a little bit of it:
[Core/Scripts: The Endless Hunger & Death's Challenge, creature text] TrinityCore#15680


@Saben65 : Thanks again for sniff info, it confirms what I counted on in PR 15680 and issue 14700. :)
Edit: looking at a random other sniff from Rushor in a different PR, I found this related to Gossip:

ServerToClient: SMSG_GOSSIP_MESSAGE (0x1746) Length: 89 ConnIdx: 0 EP:  Time: 02/12/2015 13:35:59.688 Number: 3429

(this is just an update on what I found randomly, nothing wrong with your sniff, I suppose)

@ghost
Copy link

ghost commented Jan 4, 2016

My suggestion for a fix to replace the hardcoded text in chapter1.cpp with DB reference:
https://gist.github.com/tkrokli/05405982971a7e33ba5b

diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
index c65ee54..04d8f44 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
@@ -449,8 +449,6 @@ class npc_eye_of_acherus : public CreatureScript
 ## npc_death_knight_initiate
 ######*/

-#define GOSSIP_ACCEPT_DUEL      "I challenge you, death knight!"
-
 enum Spells_DKI
 {
     SPELL_DUEL                  = 52996,
@@ -468,7 +466,8 @@ enum Says_VBM
 enum Misc_VBN
 {
     QUEST_DEATH_CHALLENGE       = 12733,
-    FACTION_HOSTILE             = 2068
+    FACTION_HOSTILE             = 2068,
+    GOSSIP_ACCEPT_DUEL          = 9765
 };

 class npc_death_knight_initiate : public CreatureScript
@@ -511,7 +510,7 @@ public:
             if (player->IsInCombat() || creature->IsInCombat())
                 return true;

-            player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ACCEPT_DUEL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
+            player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, player->GetOptionTextWithEntry(GOSSIP_ACCEPT_DUEL), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
             player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
         }
         return true;

Although there is something missing to define GetOptionTextWithEntry, so I get errors:
https://gist.github.com/tkrokli/f58db198b1085dd8ff64

Error 1 error C2039: 'GetOptionTextWithEntry' : is not a member of 'Player'
Error 2 error C2661: 'GossipMenu::AddMenuItem' : no overloaded function takes 6 arguments
Error 3 error LNK1181: cannot open input file '..\scripts\Release\scripts.lib'

@ghost
Copy link

ghost commented Jan 4, 2016

I did grab this from the sniff, just no SQL data relating to the gossip menu (which is what I thought you wanted originally, sorry).

Uploaded to pastebin to save space. http://pastebin.com/nEMqNPBY

@ghost
Copy link

ghost commented Jan 4, 2016

Thanks. No need to be sorry, it's OK. Blizzard may be using C++, that is likely why TC scripted it in C++.


Update on the Gossip issue: vincent-michael suggested that I call the text from broadcast_text.

@Treeston
Copy link

Treeston commented Jan 4, 2016

@velinath

I'm not clear on the interaction between the C++ script and SAI (as a general case - are they exclusive?)

Every creature has a C++ AI (an element of type CreatureAI*) assigned to it. This can either be a custom AI (specified in ScriptName) that's instantiated in the core using the CreatureScript/CreatureAI combination like this, or any of the base AIs included with the core (specified in AIName, or one of the default AIs depending on flags if not specified).

So yeah, SmartAI is also a C++ AI and you thus cannot have both SAI and custom AI (well, you can - inheritance - but it'd get messy) at the same time on a single creature. Of course, custom AI of another creature (or the zone script, or spell scripts, or one of about 50 other things) can still control the SAI creature. The creature's AI is not the only thing that can make the creature do things, it's just the most natural place to do so (because of virtual callbacks on various events).

@aletson
Copy link
Owner Author

aletson commented Jan 4, 2016

Makes sense. I figured it should pretty much be all or nothing with these migrations anyway, so works for me :P Thanks for the clarification!

e: phone posting leads to terrible typos

@ghost
Copy link

ghost commented Jan 4, 2016

I just checked the creature_template table for creatures using both SmartAI and ScriptName:

SELECT `entry`,`name`,`subname`,`gossip_menu_id`,`faction`,`npcflag`,`unit_flags`,`AIName`,`ScriptName`
FROM `creature_template` WHERE `ScriptName` != '' AND `AIName` != '';
 entry  name                    subname        gossip_menu_id  faction  npcflag  unit_flags  AIName   ScriptName
------  ----------------------  -------------  --------------  -------  -------  ----------  -------  --------------------
  9978  Wesley                  Stable Master            9821       12  4194305         512  SmartAI  npc_stable_master
 10052  Maluressian             Stable Master            9821       80  4194305         512  SmartAI  npc_stable_master
 16764  Arthaid                 Stable Master            9821     1638  4194305         512  SmartAI  npc_stable_master
 19226  Void Traveler           (NULL)                      0       16        0           0  SmartAI  npc_voidtraveler
 23392  Skyguard Stable Master  Stable Master            9821     1856  4194305           0  SmartAI  npc_stable_master
 23778  Dark Ranger Lyana                                8879     1897        3           0  SmartAI  npc_razael_and_lyana
 28033  Weslex Quickwrench                               9635       35        3           0  SmartAI  npc_the_etymidian
 32582  Ethereal Sphere                                     0       16        0           0  SmartAI  npc_ethereal_sphere
 33854  Thomas Partridge        Stable Master            9821     2070  4194305           0  SmartAI  npc_stable_master

Most of these NPCs are Stable Master and I suppose they are an exception to the rule of either using SmartAI or ScriptName. For all I know, it could be some kind of scripting that is not supported by SAI yet, like retrieving lost companions (non-combat) pets or something other.

@Treeston
Copy link

Treeston commented Jan 4, 2016

ScriptName takes precedence, AIName is irrelevant if ScriptName is set.

@ghost
Copy link

ghost commented Jan 4, 2016

OK, nice to know. I was pondering whether it would be possible to add gossip via SAI and let the C++ scripts to the rest, but I suppose that won't work at all during runtime (in-game), then.

@Treeston
Copy link

Treeston commented Jan 4, 2016

Well like I said you can technically implement a C++ script that inherits SmartAI and builds on top of it, but what's the point.

As for implementing DB gossip text in C++, if SmartAI does it, then you can do it - check the SAI implementation (is that the right event?) for how it works there.

@ghost
Copy link

ghost commented Jan 4, 2016

Well, player->SEND_GOSSIP_MENU is already in use in those scripts, but that is not where it fails.
It is when the author of the script wrote the line before, similar to this:

player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_NPC, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);

(GOSSIP_NPC is a placeholder for the gossip text in the script header)

What is actually wrong, is that the script author hardcoded the text instead of linking it from DB via the use of enumerating, but I understand that it is only possible to use for the TALK(SAY) commands.
r00ty suggested that I should copy the text from broadcast_text into creature_text and give it the broadcast_text ID, then call it from the core script, as long as it is not intended to convert the complete script to SAI (npc_death_knight_initiate in my case). TBH, I think it goes for most of the scripts, unless Aokromes meant that all of them should be converted to SAI and not just "replace the hardcoded text".

@Treeston
Copy link

Treeston commented Jan 4, 2016

@tkrokli c++ where needed is fine, hardcoded text is bad. Use creature_text / broadcast_text wherever possible appropriate.

@ghost
Copy link

ghost commented Jan 4, 2016

Yes, I have got the intention of removing hardcoded text as priority 1. SAI comes second, if it is possible to just replace the hardcoded text with a call to the DB for the text.

@ghost
Copy link

ghost commented Jan 11, 2016

Addendum to line 2 in the list, EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp: (EDIT)
Sorry, I did not fully grasp the problem. There is nothing wrong with any of Deathstalker Adamants lines:

wowscrnshot_011116_170524
It is the player who is supposed to "say" that line to the NPC to initiate the door opening event.
Checking some YouTube videos to see what the text should be in live sources (hoping to find old ones).
So basically, the issue is identical to the DK line 1 issue, need to find a way to pull the text from DB.
Last week I talked with r00ty in #trinity, he suggested copying the text from broadcast_text to npc_text and then pull it from there. I don't remember clearly if he meant using TALK commands or not.


OK, confirmed in 6+ years old, level 80 player videos: Please unlock the courtyard door.
This is the same line for both the alliance and horde event NPC:
Horde version: https://youtu.be/IhfTsEseeEw?t=37s
Alliance: https://youtu.be/XkaH_64IiV0?t=58s || https://youtu.be/11dA2ETNreE?t=15s (speed-video)

    ID  Language  MaleText                           FemaleText                         EmoteID0  EmoteID1  EmoteID2  EmoteDelay0  EmoteDelay1  EmoteDelay2  SoundId    Unk1    Unk2  VerifiedBuild  
------  --------  ---------------------------------  ---------------------------------  --------  --------  --------  -----------  -----------  -----------  -------  ------  ------  ---------------
  2802         0  Please unlock the courtyard door.  Please unlock the courtyard door.         0         0         0            0            0            0        0       0       1          18019

Interestingly enough, in https://youtu.be/XkaH_64IiV0?t=47s I noticed that Landen Stilwell is supposed to have gossip text, but it is missing in TC source / DB (unlinked, I guess).


OK, so now that gossip for Landen Stilwell is posted. Just wish there was a way of disabling the gossip_menu_option text in the core script so the DB gossip/gossip menu lookup would be an automatic fallback when right-clicking an NPC with npc_flag for gossip. No such luck, I suppose.
Anyway: I suspect that the TC source does not have a feature or method for pulling gossip_menu_option text, only broadcast_text and creature_text in TALK(SAY) commands.


Some times I need to read things twice to set my head straight. OK:

As for implementing DB gossip text in C++, if SmartAI does it, then you can do it - check the SAI implementation (is that the right event?) for how it works there.

Sure thing, will get on it and check that ASAP so I can get some progress here.

@ghost
Copy link

ghost commented Jan 12, 2016

I agree that it probably could be done in SAI and might be easier some times. I am just not comfortable with scripting the escort part (with waypoints, pauses and such) of the 2 NPCs from the cells up to the door yet. Maybe I'm too slow. :-p Just thought I would show you 2 pieces I dug up after re-reading r00ty's comments in #trinity:

-- Copy broadcast_text ID 2802 into creature_text for use in the script 'npc_shadowfang_prisoner'
DELETE FROM `creature_text` WHERE `entry`= 3849 AND `groupid`= 5;
DELETE FROM `creature_text` WHERE `entry`= 3850 AND `groupid`= 4;
INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`BroadcastTextId`,`TextRange`,`comment`) VALUES
(3849,5,0,'Please unlock the courtyard door.',12,1,100,0,0,0,2802,0,'prisoner adamant GOSSIP_MENU_OPTION'),
(3850,4,0,'Please unlock the courtyard door.',12,7,100,1,0,0,2802,0,'prisoner ashcrombe GOSSIP_MENU_OPTION');

-- Insert missing gossip_menu_option 21213 for Sorcerer Ashcrombe and 21214 for Deathstalker Adamant:
DELETE FROM `gossip_menu_option` WHERE `menu_id` IN (21213,21214) AND `OptionBroadcastTextID`= 2802;
INSERT INTO `gossip_menu_option` (`menu_id`,`id`,`option_icon`,`option_text`,`OptionBroadcastTextID`,`option_id`,`npc_option_npcflag`,`action_menu_id`,`action_poi_id`,`box_coded`,`box_money`,`box_text`,`BoxBroadcastTextID`) VALUES
(21213,0,0,'Please unlock the courtyard door.',2802,1,1,0,0,0,0,'',0),
(21214,0,0,'Please unlock the courtyard door.',2802,1,1,0,0,0,0,'',0);

Just to line up the existing texts in creature_text to show a slightly different text accessibility:

SELECT * FROM `creature_text` WHERE `entry` IN (3849,3850) ORDER BY `entry`,`groupid`;
 entry  groupid      id  text                                                                                                                  type  language  probability   emote  duration   sound  BroadcastTextId  TextRange  comment
------  -------  ------  ------------------------------------------------------------------------------------------------------------------  ------  --------  -----------  ------  --------  ------  ---------------  ---------  ---------------------------------------
  3849        0       0  Free from this wretched cell at last! Let me show you to the courtyard....                                              14         1          100       0         0       0             1320          0  prisoner adamant SAY_FREE_AD
  3849        1       0  You are indeed courageous for wanting to brave the horrors that lie beyond this door.                                   14         1          100       0         0       0             1321          0  prisoner adamant SAY_OPEN_DOOR_AD
  3849        2       0  There we go!                                                                                                            14         1          100       0         0       0             1323          0  prisoner adamant SAY_POST1_DOOR_AD
  3849        3       0  Good luck with Arugal. I must hurry back to Hadrec now.                                                                 14         1          100       0         0       0             1324          0  prisoner adamant SAY_POST2_DOOR_AD
  3849        4       0  About time someone killed the wretch.                                                                                   12         1          100       0         0       0             1328          0  prisoner adamant SAY_BOSS_DIE_AD
  3849        5       0  Please unlock the courtyard door.                                                                                       12         1          100       0         0       0             2802          0  prisoner adamant GOSSIP_MENU_OPTION
  3850        0       0  Follow me and I'll open the courtyard door for you.                                                                     14         7          100       1         0       0             1331          0  prisoner ashcrombe SAY_FREE_AS
  3850        1       0  I have just the spell to get this door open. Too bad the cell doors weren't locked so haphazardly.                      14         7          100       1         0       0             1332          0  prisoner ashcrombe SAY_OPEN_DOOR_AS
  3850        2       0  There it is! Wide open. Good luck to you conquering what lies beyond. I must report back to the Kirin Tor at once!      14         7          100       1         0       0             1334          0  prisoner ashcrombe SAY_POST_DOOR_AS
  3850        3       0  For once I agree with you... scum.                                                                                      12         7          100       1         0       0             1329          0  prisoner ashcrombe SAY_BOSS_DIE_AS
  3850        4       0  Please unlock the courtyard door.                                                                                       12         7          100       1         0       0             2802          0  prisoner ashcrombe GOSSIP_MENU_OPTION

So instead of picking the #define text to insert into the gossip_menu_option, it would be possible to use a different aspect of CreatureTextMgr to pick (and maybe even enum) the "gossip_menu_option".

(I hope I'm making some sense here, felt a bit confused after making sure that my new issue was correct.)


Another interesting line I found during my search for a way to get rid of hardcoded text easier:

player->ADD_GOSSIP_ITEM_DB(Player::GetDefaultGossipMenuForSource(creature), 0, GOSSIP_SENDER_MAIN, GOSSIP_OPTION_VENDOR);

I am hoping at great lenghts that it will be useful in replacing those foul lines like

player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SUSURRUS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);

because the lines of this last kind is the root of our evil in this battle against hardcoded text.


Addendum: tip I got from @ForesterDev in my first PR today:

#define
ADD_GOSSIP_ITEM_DB(h, i, c, d) PlayerTalkClass->GetGossipMenu().AddMenuItem(h, i, c, d)

// h - Menu ID from DB
// i - Menu item ID from DB
// c - Sender(this is to identify the current Menu with this item)
// d - Action (identifys this Menu Item)

@ghost
Copy link

ghost commented Jan 14, 2016

New update from Aokromes: the list http://pastebin.com/x7wZLpxH just got updated with emotes... 👿
Example: https://github.com/TrinityCore/TrinityCore/blob/478cc756eb05591f36857be3ffd1895684529710/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp#L59

He also recommends grouping to make the sections smaller and with better overview (I think).

I was thinking whether to add a column with - [ ] - [X] in the existing list, but that might even look more discouraging to have extra visual evidence of how much there is left to do, since it adds the feature "milestone" to this issue. I also thought about creating more narrow list entries with links to gists for some groups of text belonging in the same file or group of files. Not sure if that is more work than helpful.
(Just a random thought.)

Repository owner deleted a comment Sep 24, 2017
Repository owner deleted a comment Sep 24, 2017
Repository owner deleted a comment Sep 24, 2017
Repository owner deleted a comment from malcrom Sep 24, 2017
Repository owner deleted a comment from Treeston Sep 24, 2017
Repository owner deleted a comment Sep 24, 2017
Repository owner deleted a comment Sep 24, 2017
Repository owner deleted a comment Sep 24, 2017
Repository owner deleted a comment Sep 24, 2017
Repository owner deleted a comment Sep 25, 2017
Repository owner deleted a comment Sep 25, 2017
@aletson aletson changed the title Gossip migration from core scripts to SAI/DB ToDo List Tips and tricks for gossip migration to SAI Sep 25, 2017
Repository owner locked and limited conversation to collaborators Sep 25, 2017
Repository owner deleted a comment Nov 8, 2017
Repository owner deleted a comment from FrancescoBorzi Nov 8, 2017
Repository owner deleted a comment Nov 8, 2017
Repository owner deleted a comment Nov 8, 2017
Repository owner deleted a comment Nov 8, 2017
Repository owner deleted a comment Nov 8, 2017
Repository owner deleted a comment from Treeston Nov 8, 2017
Repository owner deleted a comment Nov 8, 2017
Repository owner deleted a comment Nov 8, 2017
Repository owner deleted a comment Nov 8, 2017
Repository owner deleted a comment Nov 8, 2017
Repository owner deleted a comment from Treeston Nov 8, 2017
Repository owner deleted a comment Nov 8, 2017
Repository owner deleted a comment Nov 8, 2017
Repository owner deleted a comment Nov 8, 2017
Repository owner deleted a comment Nov 8, 2017
Repository owner deleted a comment Nov 8, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants